forked from teamnwah/openmw-tes3coop
Merge remote-tracking branch 'scrawl/master' into columns
This commit is contained in:
commit
501753c01b
133 changed files with 869 additions and 1105 deletions
191
CMakeLists.txt
191
CMakeLists.txt
|
@ -19,7 +19,7 @@ include (OpenMWMacros)
|
|||
# Version
|
||||
|
||||
set (OPENMW_VERSION_MAJOR 0)
|
||||
set (OPENMW_VERSION_MINOR 24)
|
||||
set (OPENMW_VERSION_MINOR 25)
|
||||
set (OPENMW_VERSION_RELEASE 0)
|
||||
|
||||
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")
|
||||
|
||||
# Location of morrowind data files
|
||||
if(DPKG_PROGRAM)
|
||||
if (APPLE)
|
||||
set(MORROWIND_DATA_FILES "./data" CACHE PATH "location of Morrowind data 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()
|
||||
if (APPLE)
|
||||
set(MORROWIND_DATA_FILES "./data" CACHE PATH "location of Morrowind data files")
|
||||
set(MORROWIND_RESOURCE_FILES "./resources" CACHE PATH "location of OpenMW resources files")
|
||||
else()
|
||||
set(MORROWIND_DATA_FILES "data" CACHE PATH "location of Morrowind data files")
|
||||
set(MORROWIND_RESOURCE_FILES "resources" CACHE PATH "location of OpenMW resources files")
|
||||
endif(APPLE)
|
||||
endif(DPKG_PROGRAM)
|
||||
set(MORROWIND_DATA_FILES "data" CACHE PATH "location of Morrowind data files")
|
||||
set(MORROWIND_RESOURCE_FILES "resources" CACHE PATH "location of OpenMW resources files")
|
||||
endif(APPLE)
|
||||
|
||||
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)
|
||||
|
@ -85,10 +83,6 @@ set(OENGINE_OGRE
|
|||
${LIBDIR}/openengine/ogre/imagerotate.cpp
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
set(OENGINE_OGRE ${OENGINE_OGRE} ${LIBDIR}/openengine/ogre/osx_utils.mm)
|
||||
endif ()
|
||||
|
||||
set(OENGINE_GUI
|
||||
${LIBDIR}/openengine/gui/manager.cpp
|
||||
)
|
||||
|
@ -333,60 +327,104 @@ if (CMAKE_COMPILER_IS_GNUCC)
|
|||
endif("${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
||||
endif (CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
if(DPKG_PROGRAM)
|
||||
SET(CMAKE_INSTALL_PREFIX "/usr")
|
||||
IF(NOT WIN32 AND NOT APPLE)
|
||||
## Debian and non debian Linux building
|
||||
# Paths
|
||||
IF (DPKG_PROGRAM)
|
||||
## Debian specific
|
||||
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")
|
||||
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()
|
||||
# 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 file
|
||||
# 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(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")
|
||||
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(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}/transparency-overrides.cfg" DESTINATION "../etc/openmw/" 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}/opencs.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||
# Install global configuration files
|
||||
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 "${SYSCONFDIR}" 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")
|
||||
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 DESTINATION "share/games/openmw/data/" COMPONENT "Resources")
|
||||
|
||||
SET(CPACK_GENERATOR "DEB")
|
||||
SET(CPACK_PACKAGE_NAME "openmw")
|
||||
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://openmw.org")
|
||||
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "${PACKAGE_MAINTAINER}")
|
||||
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "A reimplementation of The Elder Scrolls III: Morrowind
|
||||
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_PACKAGE_NAME "openmw")
|
||||
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://openmw.org")
|
||||
SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "${PACKAGE_MAINTAINER}")
|
||||
SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "A reimplementation of The Elder Scrolls III: Morrowind
|
||||
OpenMW is a reimplementation of the Bethesda Game Studios game The Elder Scrolls III: Morrowind.
|
||||
Data files from the original game is required to run it.")
|
||||
SET(CPACK_DEBIAN_PACKAGE_NAME "openmw")
|
||||
SET(CPACK_DEBIAN_PACKAGE_VERSION "${VERSION_STRING}")
|
||||
SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW bsatool;Bsatool esmtool;Esmtool omwlauncher;OMWLauncher mwiniimporter;MWiniImporter")
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.11.2), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libmpg123-0 (>= 1.12.1), libopenal1 (>= 1:1.12.854), libsndfile1 (>= 1.0.23), libstdc++6 (>= 4.4.5), libuuid1 (>= 2.17.2), libqtgui4 (>= 4.7.0)")
|
||||
SET(CPACK_DEBIAN_PACKAGE_NAME "openmw")
|
||||
SET(CPACK_DEBIAN_PACKAGE_VERSION "${VERSION_STRING}")
|
||||
SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW bsatool;Bsatool esmtool;Esmtool omwlauncher;OMWLauncher mwiniimporter;MWiniImporter")
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.11.2), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libmpg123-0 (>= 1.12.1), libopenal1 (>= 1:1.12.854), libsndfile1 (>= 1.0.23), libstdc++6 (>= 4.4.5), libuuid1 (>= 2.17.2), libqtgui4 (>= 4.7.0)")
|
||||
|
||||
SET(CPACK_DEBIAN_PACKAGE_SECTION "Games")
|
||||
SET(CPACK_DEBIAN_PACKAGE_SECTION "Games")
|
||||
|
||||
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
|
||||
execute_process(
|
||||
COMMAND ${DPKG_PROGRAM} --print-architecture
|
||||
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||
STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${DPKG_PROGRAM} --print-architecture
|
||||
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME_LOWERCASE}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||
|
||||
|
||||
include(CPack)
|
||||
endif(DPKG_PROGRAM)
|
||||
INCLUDE(CPack)
|
||||
ENDIF(DPKG_PROGRAM)
|
||||
ENDIF(NOT WIN32 AND NOT APPLE)
|
||||
|
||||
if(WIN32)
|
||||
FILE(GLOB dll_files "${OpenMW_BINARY_DIR}/Release/*.dll")
|
||||
|
@ -669,50 +707,3 @@ if (APPLE)
|
|||
include(CPack)
|
||||
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 value(line.substr(pos+1));
|
||||
if(value.empty()) {
|
||||
std::cout << "Warning: ignored empty value for key '" << key << "'." << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
multistrmap::iterator it;
|
||||
if((it = map.find(key)) == map.end()) {
|
||||
|
|
|
@ -141,6 +141,10 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
|||
, mFSStrict (false)
|
||||
, mScriptConsoleMode (false)
|
||||
, mCfgMgr(configurationManager)
|
||||
, mEncoding(ToUTF8::WINDOWS_1252)
|
||||
, mEncoder(NULL)
|
||||
, mActivationDistanceOverride(-1)
|
||||
|
||||
{
|
||||
std::srand ( std::time(NULL) );
|
||||
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);
|
||||
|
||||
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(",");
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -103,13 +103,16 @@ namespace MWBase
|
|||
///< Play a 2D audio track, using a custom decoder
|
||||
|
||||
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
|
||||
///< @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,
|
||||
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
|
||||
///< @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;
|
||||
///< Stop the given object from playing the given sound,
|
||||
|
@ -123,6 +126,12 @@ namespace MWBase
|
|||
virtual void stopSound(const std::string& soundId) = 0;
|
||||
///< 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;
|
||||
///< Is the given sound currently playing on the given object?
|
||||
|
||||
|
|
|
@ -188,6 +188,7 @@ namespace MWBase
|
|||
virtual void setMinimapVisibility(bool visible) = 0;
|
||||
virtual void setWeaponVisibility(bool visible) = 0;
|
||||
virtual void setSpellVisibility(bool visible) = 0;
|
||||
virtual void setSneakVisibility(bool visible) = 0;
|
||||
|
||||
virtual void activateQuickKey (int index) = 0;
|
||||
|
||||
|
|
|
@ -46,7 +46,11 @@ namespace MWClass
|
|||
{
|
||||
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
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
|
|
|
@ -79,6 +79,8 @@ namespace MWClass
|
|||
|
||||
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 (1, ref->mBase->mAiData.mFight);
|
||||
data->mCreatureStats.setAiSetting (2, ref->mBase->mAiData.mFlee);
|
||||
|
@ -89,6 +91,10 @@ namespace MWClass
|
|||
iter!=ref->mBase->mSpells.mList.end(); ++iter)
|
||||
data->mCreatureStats.getSpells().add (*iter);
|
||||
|
||||
// inventory
|
||||
data->mContainerStore.fill(ref->mBase->mInventory, getId(ptr),
|
||||
MWBase::Environment::get().getWorld()->getStore());
|
||||
|
||||
// store
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
}
|
||||
|
@ -370,13 +376,13 @@ namespace MWClass
|
|||
MWWorld::Store<ESM::SoundGenerator>::iterator sound = store.begin();
|
||||
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()),
|
||||
sound->mCreature))
|
||||
sounds.push_back(&*sound);
|
||||
sound++;
|
||||
++sound;
|
||||
}
|
||||
if(sounds.size() > 0)
|
||||
if(!sounds.empty())
|
||||
return sounds[(int)(rand()/(RAND_MAX+1.0)*sounds.size())]->mSound;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
@ -142,9 +143,23 @@ namespace MWClass
|
|||
// animated door
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionDoor(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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
|
|
@ -215,6 +215,8 @@ namespace MWClass
|
|||
autoCalculateAttributes(ref->mBase, data->mCreatureStats);
|
||||
}
|
||||
|
||||
data->mCreatureStats.getAiSequence().fill(ref->mBase->mAiPackage);
|
||||
|
||||
data->mCreatureStats.setAiSetting (0, ref->mBase->mAiData.mHello);
|
||||
data->mCreatureStats.setAiSetting (1, ref->mBase->mAiData.mFight);
|
||||
data->mCreatureStats.setAiSetting (2, ref->mBase->mAiData.mFlee);
|
||||
|
@ -225,8 +227,14 @@ namespace MWClass
|
|||
iter!=ref->mBase->mSpells.mList.end(); ++iter)
|
||||
data->mCreatureStats.getSpells().add (*iter);
|
||||
|
||||
// inventory
|
||||
data->mInventoryStore.fill(ref->mBase->mInventory, getId(ptr),
|
||||
MWBase::Environment::get().getWorld()->getStore());
|
||||
|
||||
// store
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
|
||||
getInventoryStore(ptr).autoEquip(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,10 +274,10 @@ namespace MWClass
|
|||
ptr.get<ESM::NPC>();
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
std::string headID = ref->mBase->mHead;
|
||||
//std::string headID = ref->mBase->mHead;
|
||||
|
||||
int end = headID.find_last_of("head_") - 4;
|
||||
std::string bodyRaceID = headID.substr(0, end);
|
||||
//int end = headID.find_last_of("head_") - 4;
|
||||
//std::string bodyRaceID = headID.substr(0, end);
|
||||
|
||||
std::string model = "meshes\\base_anim.nif";
|
||||
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(ref->mBase->mRace);
|
||||
|
@ -323,18 +331,18 @@ namespace MWClass
|
|||
return;
|
||||
|
||||
const MWWorld::Class &othercls = MWWorld::Class::get(victim);
|
||||
if(!othercls.isActor() || othercls.getCreatureStats(victim).isDead())
|
||||
{
|
||||
// Can't hit non-actors, or dead actors
|
||||
if(!othercls.isActor()) // Can't hit non-actors
|
||||
return;
|
||||
MWMechanics::CreatureStats &otherstats = getCreatureStats(victim);
|
||||
if(otherstats.isDead()) // Can't hit dead actors
|
||||
return;
|
||||
}
|
||||
|
||||
if(ptr.getRefData().getHandle() == "player")
|
||||
MWBase::Environment::get().getWindowManager()->setEnemy(ptr);
|
||||
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
|
||||
|
||||
int weapskill = ESM::Skill::HandToHand;
|
||||
if(!weapon.isEmpty())
|
||||
weapskill = MWWorld::Class::get(weapon).getEquipmentSkill(weapon);
|
||||
weapskill = get(weapon).getEquipmentSkill(weapon);
|
||||
|
||||
MWMechanics::CreatureStats &crstats = getCreatureStats(ptr);
|
||||
MWMechanics::NpcStats &npcstats = getNpcStats(ptr);
|
||||
|
@ -345,7 +353,7 @@ namespace MWClass
|
|||
hitchance *= crstats.getFatigueTerm();
|
||||
hitchance += mageffects.get(MWMechanics::EffectKey(ESM::MagicEffect::FortifyAttack)).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)
|
||||
{
|
||||
|
@ -404,8 +412,7 @@ namespace MWClass
|
|||
MWBase::Environment::get().getSoundManager()->playSound3D(victim, "critical damage", 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
healthdmg = (othercls.getCreatureStats(victim).getFatigue().getCurrent() < 1.0f ||
|
||||
npcstats.isWerewolf());
|
||||
healthdmg = (otherstats.getFatigue().getCurrent() < 1.0f || npcstats.isWerewolf());
|
||||
if(healthdmg)
|
||||
damage *= gmst.find("fHandtoHandHealthPer")->getFloat();
|
||||
}
|
||||
|
|
|
@ -172,7 +172,6 @@ namespace MWDialogue
|
|||
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext));
|
||||
executeScript (info->mResultScript);
|
||||
mLastTopic = Misc::StringUtils::lowerCase(it->mId);
|
||||
mLastDialogue = *info;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +292,6 @@ namespace MWDialogue
|
|||
executeScript (info->mResultScript);
|
||||
|
||||
mLastTopic = topic;
|
||||
mLastDialogue = *info;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -455,7 +453,6 @@ namespace MWDialogue
|
|||
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse (Interpreter::fixDefinesDialog(text, interpreterContext));
|
||||
MWBase::Environment::get().getJournal()->addTopic (mLastTopic, info->mId);
|
||||
executeScript (info->mResultScript);
|
||||
mLastDialogue = *info;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ namespace MWDialogue
|
|||
|
||||
int mChoice;
|
||||
std::string mLastTopic;
|
||||
ESM::DialInfo mLastDialogue;
|
||||
bool mIsInChoice;
|
||||
|
||||
float mTemporaryDispositionChange;
|
||||
|
|
|
@ -47,6 +47,8 @@ namespace MWGui
|
|||
, mIngredients (4)
|
||||
, mSortModel(NULL)
|
||||
{
|
||||
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
|
||||
getWidget(mCreateButton, "CreateButton");
|
||||
getWidget(mCancelButton, "CancelButton");
|
||||
getWidget(mIngredients[0], "Ingredient1");
|
||||
|
@ -150,10 +152,10 @@ namespace MWGui
|
|||
|
||||
mNameEdit->setCaption("");
|
||||
|
||||
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
|
||||
int index = 0;
|
||||
|
||||
mAlchemy.setAlchemist (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
|
||||
for (MWMechanics::Alchemy::TToolsIterator iter (mAlchemy.beginTools());
|
||||
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));
|
||||
|
||||
if (i->size () == 0)
|
||||
if (i->empty())
|
||||
return Range (Utf8Point (NULL), Utf8Point (NULL));
|
||||
|
||||
Utf8Point begin = &i->front ();
|
||||
|
@ -768,6 +768,11 @@ public:
|
|||
PageDisplay ()
|
||||
{
|
||||
mPage = -1;
|
||||
mViewTop = 0;
|
||||
mViewBottom = 0;
|
||||
mFocusItem = NULL;
|
||||
mItemActive = false;
|
||||
mNode = NULL;
|
||||
}
|
||||
|
||||
void dirtyFocusItem ()
|
||||
|
@ -1093,7 +1098,6 @@ class BookPageImpl : public BookPage
|
|||
MYGUI_RTTI_DERIVED(BookPage)
|
||||
public:
|
||||
|
||||
|
||||
void showPage (TypesetBook::Ptr book, size_t page)
|
||||
{
|
||||
if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ()))
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace MWGui
|
|||
: WindowBase("openmw_book.layout")
|
||||
, mTakeButtonShow(true)
|
||||
, mTakeButtonAllowed(true)
|
||||
, mCurrentPage(0)
|
||||
{
|
||||
getWidget(mCloseButton, "CloseButton");
|
||||
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BookWindow::onCloseButtonClicked);
|
||||
|
|
|
@ -70,6 +70,9 @@ namespace MWGui
|
|||
, mGenerateClassStep(0)
|
||||
{
|
||||
mCreationStage = CSE_NotStarted;
|
||||
mGenerateClassSpecializations[0] = 0;
|
||||
mGenerateClassSpecializations[1] = 0;
|
||||
mGenerateClassSpecializations[2] = 0;
|
||||
}
|
||||
|
||||
void CharacterCreation::setValue (const std::string& id, const MWMechanics::Stat<int>& value)
|
||||
|
|
|
@ -372,6 +372,8 @@ namespace MWGui
|
|||
, mAttribDialog(NULL)
|
||||
, mSkillDialog(NULL)
|
||||
, mDescDialog(NULL)
|
||||
, mAffectedAttribute(NULL)
|
||||
, mAffectedSkill(NULL)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
@ -718,6 +720,7 @@ namespace MWGui
|
|||
|
||||
SelectAttributeDialog::SelectAttributeDialog()
|
||||
: WindowModal("openmw_chargen_select_attribute.layout")
|
||||
, mAttributeId(ESM::Attribute::Strength)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace MWGui
|
|||
mCommandLine->setCaption(complete( mCommandLine->getCaption(), matches ));
|
||||
#if 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 );
|
||||
if( i == 50 )
|
||||
|
@ -237,7 +237,7 @@ namespace MWGui
|
|||
|
||||
if(mCurrent != mCommandHistory.begin())
|
||||
{
|
||||
mCurrent--;
|
||||
--mCurrent;
|
||||
mCommandLine->setCaption(*mCurrent);
|
||||
}
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ namespace MWGui
|
|||
{
|
||||
if(mCurrent != mCommandHistory.end())
|
||||
{
|
||||
mCurrent++;
|
||||
--mCurrent;
|
||||
|
||||
if(mCurrent != mCommandHistory.end())
|
||||
mCommandLine->setCaption(*mCurrent);
|
||||
|
@ -333,7 +333,7 @@ namespace MWGui
|
|||
continue;
|
||||
|
||||
/* 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) ) {
|
||||
string_different=true;
|
||||
break;
|
||||
|
@ -372,7 +372,7 @@ namespace MWGui
|
|||
/* Check if all matching strings match further than input. If yes complete to this match. */
|
||||
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) {
|
||||
if( tolower((*it)[i]) != tolower(*iter) ) {
|
||||
/* Append the longest match to the end of the output string*/
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace
|
|||
return string.getChar(0);
|
||||
}
|
||||
|
||||
bool is_not_empty(const std::string s) {
|
||||
bool is_not_empty(const std::string& s) {
|
||||
std::string temp = s;
|
||||
boost::algorithm::trim(temp);
|
||||
return !temp.empty();
|
||||
|
|
|
@ -84,6 +84,9 @@ namespace MWGui
|
|||
mSpellBoxBaseLeft = mSpellBox->getLeft();
|
||||
mSpellBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
||||
|
||||
getWidget(mSneakBox, "SneakBox");
|
||||
mSneakBoxBaseLeft = mSneakBox->getLeft();
|
||||
|
||||
getWidget(mEffectBox, "EffectBox");
|
||||
mEffectBoxBaseRight = viewSize.width - mEffectBox->getRight();
|
||||
|
||||
|
@ -503,6 +506,12 @@ namespace MWGui
|
|||
updatePositions();
|
||||
}
|
||||
|
||||
void HUD::setSneakVisible(bool visible)
|
||||
{
|
||||
mSneakBox->setVisible(visible);
|
||||
updatePositions();
|
||||
}
|
||||
|
||||
void HUD::setEffectVisible(bool visible)
|
||||
{
|
||||
mEffectBox->setVisible (visible);
|
||||
|
@ -517,12 +526,18 @@ namespace MWGui
|
|||
|
||||
void HUD::updatePositions()
|
||||
{
|
||||
int weapDx = 0, spellDx = 0;
|
||||
int weapDx = 0, spellDx = 0, sneakDx = 0;
|
||||
if (!mHealth->getVisible())
|
||||
spellDx = weapDx = mWeapBoxBaseLeft - mHealthManaStaminaBaseLeft;
|
||||
sneakDx = spellDx = weapDx = mWeapBoxBaseLeft - mHealthManaStaminaBaseLeft;
|
||||
|
||||
if (!mWeapBox->getVisible())
|
||||
{
|
||||
spellDx += mSpellBoxBaseLeft - mWeapBoxBaseLeft;
|
||||
sneakDx = spellDx;
|
||||
}
|
||||
|
||||
if (!mSpellBox->getVisible())
|
||||
sneakDx += mSneakBoxBaseLeft - mSpellBoxBaseLeft;
|
||||
|
||||
mWeaponVisible = mWeapBox->getVisible();
|
||||
mSpellVisible = mSpellBox->getVisible();
|
||||
|
@ -531,6 +546,7 @@ namespace MWGui
|
|||
|
||||
mWeapBox->setPosition(mWeapBoxBaseLeft - weapDx, mWeapBox->getTop());
|
||||
mSpellBox->setPosition(mSpellBoxBaseLeft - spellDx, mSpellBox->getTop());
|
||||
mSneakBox->setPosition(mSneakBoxBaseLeft - sneakDx, mSneakBox->getTop());
|
||||
|
||||
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace MWGui
|
|||
void setHmsVisible(bool visible);
|
||||
void setWeapVisible(bool visible);
|
||||
void setSpellVisible(bool visible);
|
||||
void setSneakVisible(bool visible);
|
||||
|
||||
void setEffectVisible(bool visible);
|
||||
void setMinimapVisible(bool visible);
|
||||
|
@ -51,7 +52,7 @@ namespace MWGui
|
|||
private:
|
||||
MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth;
|
||||
MyGUI::Widget* mHealthFrame;
|
||||
MyGUI::Widget *mWeapBox, *mSpellBox;
|
||||
MyGUI::Widget *mWeapBox, *mSpellBox, *mSneakBox;
|
||||
MyGUI::ImageBox *mWeapImage, *mSpellImage;
|
||||
MyGUI::ProgressBar *mWeapStatus, *mSpellStatus;
|
||||
MyGUI::Widget *mEffectBox, *mMinimapBox;
|
||||
|
@ -70,7 +71,7 @@ namespace MWGui
|
|||
MyGUI::TextBox* mBatchCounter;
|
||||
|
||||
// bottom left elements
|
||||
int mHealthManaStaminaBaseLeft, mWeapBoxBaseLeft, mSpellBoxBaseLeft;
|
||||
int mHealthManaStaminaBaseLeft, mWeapBoxBaseLeft, mSpellBoxBaseLeft, mSneakBoxBaseLeft;
|
||||
// bottom right elements
|
||||
int mMinimapBoxBaseRight, mEffectBoxBaseRight;
|
||||
|
||||
|
|
|
@ -36,6 +36,12 @@ namespace MWGui
|
|||
, mPreview(MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ())
|
||||
, mPreviewDirty(true)
|
||||
, 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);
|
||||
|
||||
|
@ -67,7 +73,7 @@ namespace MWGui
|
|||
|
||||
mFilterAll->setStateSelected(true);
|
||||
|
||||
setCoord(0, 342, 498, 258);
|
||||
setCoord(mPositionInventory.left, mPositionInventory.top, mPositionInventory.width, mPositionInventory.height);
|
||||
onWindowResize(static_cast<MyGUI::Window*>(mMainWidget));
|
||||
|
||||
mPreview.setup();
|
||||
|
@ -83,6 +89,27 @@ namespace MWGui
|
|||
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()
|
||||
{
|
||||
return mTradeModel;
|
||||
|
@ -210,6 +237,21 @@ namespace MWGui
|
|||
_sender->getSize().width - 12 - (_sender->getSize().height-44) * aspect - 15,
|
||||
_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)
|
||||
{
|
||||
mLastXSize = mMainWidget->getSize().width;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "windowpinnablebase.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "mode.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
@ -47,6 +48,8 @@ namespace MWGui
|
|||
|
||||
void updatePlayer();
|
||||
|
||||
void setGuiMode(GuiMode mode);
|
||||
|
||||
private:
|
||||
DragAndDrop* mDragAndDrop;
|
||||
|
||||
|
@ -73,6 +76,13 @@ namespace MWGui
|
|||
MyGUI::Button* mFilterMagic;
|
||||
MyGUI::Button* mFilterMisc;
|
||||
|
||||
MyGUI::IntCoord mPositionInventory;
|
||||
MyGUI::IntCoord mPositionContainer;
|
||||
MyGUI::IntCoord mPositionCompanion;
|
||||
MyGUI::IntCoord mPositionBarter;
|
||||
|
||||
GuiMode mGuiMode;
|
||||
|
||||
int mLastXSize;
|
||||
int mLastYSize;
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace MWGui
|
|||
|
||||
ItemSelectionDialog::ItemSelectionDialog(const std::string &label)
|
||||
: WindowModal("openmw_itemselection_dialog.layout")
|
||||
, mSortModel(NULL)
|
||||
, mModel(NULL)
|
||||
{
|
||||
getWidget(mItemView, "ItemView");
|
||||
mItemView->eventItemClicked += MyGUI::newDelegate(this, &ItemSelectionDialog::onSelectedItem);
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace MWGui
|
|||
|
||||
ItemView::ItemView()
|
||||
: mModel(NULL)
|
||||
, mScrollView(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
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
|
||||
|
||||
// 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)
|
||||
, mFirstLoad(true)
|
||||
, mTotalRefsLoading(0)
|
||||
, mCurrentCellLoading(0)
|
||||
, mTotalCellsLoading(0)
|
||||
, mCurrentRefLoading(0)
|
||||
, mCurrentRefList(0)
|
||||
{
|
||||
getWidget(mLoadingText, "LoadingText");
|
||||
getWidget(mProgressBar, "ProgressBar");
|
||||
|
|
|
@ -89,9 +89,6 @@ namespace MWGui
|
|||
{
|
||||
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)) + "_"
|
||||
+ boost::lexical_cast<std::string>(mCurY + (-1*(my-1)));
|
||||
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)) + "_"
|
||||
+ 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];
|
||||
|
||||
if (MyGUI::RenderManager::getInstance().getTexture(image) != 0)
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace MWGui
|
|||
else {
|
||||
(*it2)->update(height);
|
||||
height += (*it2)->getHeight();
|
||||
it2++;
|
||||
++it2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ namespace MWGui
|
|||
}
|
||||
else
|
||||
{
|
||||
it++;
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -226,6 +226,7 @@ namespace MWGui
|
|||
: WindowModal("openmw_interactive_messagebox.layout")
|
||||
, mMessageBoxManager(parMessageBoxManager)
|
||||
, mButtonPressed(-1)
|
||||
, mTextButtonPadding(0)
|
||||
{
|
||||
WindowModal::open();
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace MWGui
|
|||
, mAssignDialog(0)
|
||||
, mItemSelectionDialog(0)
|
||||
, mMagicSelectionDialog(0)
|
||||
, mSelectedIndex(-1)
|
||||
{
|
||||
getWidget(mOkButton, "OKButton");
|
||||
getWidget(mInstructionLabel, "InstructionLabel");
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace MWGui
|
|||
, mHairIndex(0)
|
||||
, mCurrentAngle(0)
|
||||
, mPreviewDirty(true)
|
||||
, mPreview(NULL)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
|
|
@ -18,7 +18,6 @@ namespace MWGui
|
|||
|
||||
ReviewDialog::ReviewDialog()
|
||||
: WindowModal("openmw_chargen_review.layout")
|
||||
, mLastPos(0)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
@ -321,9 +320,7 @@ namespace MWGui
|
|||
if (!mMiscSkills.empty())
|
||||
addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2);
|
||||
|
||||
mClientHeight = coord1.top;
|
||||
|
||||
mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), mClientHeight));
|
||||
mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), coord1.top));
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
|
|
@ -79,7 +79,6 @@ namespace MWGui
|
|||
|
||||
MyGUI::TextBox *mNameWidget, *mRaceWidget, *mClassWidget, *mBirthSignWidget;
|
||||
MyGUI::ScrollView* mSkillView;
|
||||
int mLastPos, mClientHeight;
|
||||
|
||||
Widgets::MWDynamicStatPtr mHealth, mMagicka, mFatigue;
|
||||
|
||||
|
|
|
@ -81,6 +81,15 @@ namespace MWGui
|
|||
mDeleteButton->setVisible (false);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -93,11 +102,6 @@ namespace MWGui
|
|||
mMagnitudeMinValue->setCaption("1");
|
||||
mMagnitudeMaxValue->setCaption("- 1");
|
||||
mAreaValue->setCaption("0");
|
||||
|
||||
mEffect.mMagnMin = 1;
|
||||
mEffect.mMagnMax = 1;
|
||||
mEffect.mDuration = 1;
|
||||
mEffect.mArea = 0;
|
||||
}
|
||||
|
||||
void EditEffectDialog::editEffect (ESM::ENAMstruct effect)
|
||||
|
@ -106,7 +110,7 @@ namespace MWGui
|
|||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
|
||||
|
||||
setMagicEffect(magicEffect);
|
||||
|
||||
mOldEffect = effect;
|
||||
mEffect = effect;
|
||||
mEditing = true;
|
||||
|
||||
|
@ -121,6 +125,7 @@ namespace MWGui
|
|||
onMagnitudeMaxChanged (mMagnitudeMinSlider, effect.mMagnMax-1);
|
||||
onAreaChanged (mAreaSlider, effect.mArea);
|
||||
onDurationChanged (mDurationSlider, effect.mDuration-1);
|
||||
eventEffectModified(mEffect);
|
||||
}
|
||||
|
||||
void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect)
|
||||
|
@ -163,7 +168,7 @@ namespace MWGui
|
|||
mDurationBox->setVisible (true);
|
||||
curY += mDurationBox->getSize().height;
|
||||
}
|
||||
if (mEffect.mRange == ESM::RT_Target)
|
||||
if (mEffect.mRange != ESM::RT_Self)
|
||||
{
|
||||
mAreaBox->setPosition(mAreaBox->getPosition().left, curY);
|
||||
mAreaBox->setVisible (true);
|
||||
|
@ -182,9 +187,6 @@ namespace MWGui
|
|||
else if (mEffect.mRange == ESM::RT_Touch)
|
||||
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
|
||||
if (mEffect.mRange == ESM::RT_Target && !(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTarget))
|
||||
onRangeButtonClicked(sender);
|
||||
|
@ -193,7 +195,13 @@ namespace MWGui
|
|||
if (mEffect.mRange == ESM::RT_Touch && !(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTouch))
|
||||
onRangeButtonClicked(sender);
|
||||
|
||||
if(mEffect.mRange == ESM::RT_Self)
|
||||
{
|
||||
mAreaSlider->setScrollPosition(0);
|
||||
onAreaChanged(mAreaSlider,0);
|
||||
}
|
||||
updateBoxes();
|
||||
eventEffectModified(mEffect);
|
||||
}
|
||||
|
||||
void EditEffectDialog::onDeleteButtonClicked (MyGUI::Widget* sender)
|
||||
|
@ -206,26 +214,27 @@ namespace MWGui
|
|||
void EditEffectDialog::onOkButtonClicked (MyGUI::Widget* sender)
|
||||
{
|
||||
setVisible(false);
|
||||
|
||||
if (mEditing)
|
||||
eventEffectModified(mEffect);
|
||||
else
|
||||
eventEffectAdded(mEffect);
|
||||
}
|
||||
|
||||
void EditEffectDialog::onCancelButtonClicked (MyGUI::Widget* sender)
|
||||
{
|
||||
setVisible(false);
|
||||
if(mEditing)
|
||||
eventEffectModified(mOldEffect);
|
||||
else
|
||||
eventEffectRemoved(mEffect);
|
||||
}
|
||||
|
||||
void EditEffectDialog::setSkill (int skill)
|
||||
{
|
||||
mEffect.mSkill = skill;
|
||||
eventEffectModified(mEffect);
|
||||
}
|
||||
|
||||
void EditEffectDialog::setAttribute (int attribute)
|
||||
{
|
||||
mEffect.mAttribute = attribute;
|
||||
eventEffectModified(mEffect);
|
||||
}
|
||||
|
||||
void EditEffectDialog::onMagnitudeMinChanged (MyGUI::ScrollBar* sender, size_t pos)
|
||||
|
@ -235,6 +244,7 @@ namespace MWGui
|
|||
|
||||
// trigger the check again (see below)
|
||||
onMagnitudeMaxChanged(mMagnitudeMaxSlider, mMagnitudeMaxSlider->getScrollPosition ());
|
||||
eventEffectModified(mEffect);
|
||||
}
|
||||
|
||||
void EditEffectDialog::onMagnitudeMaxChanged (MyGUI::ScrollBar* sender, size_t pos)
|
||||
|
@ -250,18 +260,22 @@ namespace MWGui
|
|||
mEffect.mMagnMax = pos+1;
|
||||
|
||||
mMagnitudeMaxValue->setCaption("- " + boost::lexical_cast<std::string>(pos+1));
|
||||
|
||||
eventEffectModified(mEffect);
|
||||
}
|
||||
|
||||
void EditEffectDialog::onDurationChanged (MyGUI::ScrollBar* sender, size_t pos)
|
||||
{
|
||||
mDurationValue->setCaption(boost::lexical_cast<std::string>(pos+1));
|
||||
mEffect.mDuration = pos+1;
|
||||
eventEffectModified(mEffect);
|
||||
}
|
||||
|
||||
void EditEffectDialog::onAreaChanged (MyGUI::ScrollBar* sender, size_t pos)
|
||||
{
|
||||
mAreaValue->setCaption(boost::lexical_cast<std::string>(pos));
|
||||
mEffect.mArea = pos;
|
||||
eventEffectModified(mEffect);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -615,6 +629,7 @@ namespace MWGui
|
|||
void EffectEditorBase::onEffectAdded (ESM::ENAMstruct effect)
|
||||
{
|
||||
mEffects.push_back(effect);
|
||||
mSelectedEffect=mEffects.size()-1;
|
||||
|
||||
updateEffectsView();
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ namespace MWGui
|
|||
|
||||
protected:
|
||||
ESM::ENAMstruct mEffect;
|
||||
ESM::ENAMstruct mOldEffect;
|
||||
|
||||
const ESM::MagicEffect* mMagicEffect;
|
||||
};
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace MWGui
|
|||
if (adjustSize)
|
||||
{
|
||||
int s = effects.size() * 16+4;
|
||||
if (!effects.size())
|
||||
if (effects.empty())
|
||||
s = 0;
|
||||
int diff = parent->getWidth() - s;
|
||||
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
|
||||
struct MagicEffectInfo
|
||||
{
|
||||
MagicEffectInfo() : mPermanent(false) {}
|
||||
MagicEffectInfo()
|
||||
: mPermanent(false)
|
||||
, mMagnitude(0)
|
||||
, mRemainingTime(0)
|
||||
{}
|
||||
std::string mSource; // display name for effect source (e.g. potion name)
|
||||
MWMechanics::EffectKey mKey;
|
||||
int mMagnitude;
|
||||
|
|
|
@ -21,7 +21,6 @@ namespace MWGui
|
|||
StatsWindow::StatsWindow ()
|
||||
: WindowPinnableBase("openmw_stats_window.layout")
|
||||
, mSkillView(NULL)
|
||||
, mClientHeight(0)
|
||||
, mMajorSkills()
|
||||
, mMinorSkills()
|
||||
, mMiscSkills()
|
||||
|
@ -82,7 +81,7 @@ namespace MWGui
|
|||
{
|
||||
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) );
|
||||
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)
|
||||
|
@ -422,7 +421,6 @@ namespace MWGui
|
|||
mSkillWidgets.clear();
|
||||
|
||||
mSkillView->setViewOffset (MyGUI::IntPoint(0,0));
|
||||
mClientHeight = 0;
|
||||
|
||||
const int valueSize = 40;
|
||||
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}");
|
||||
}
|
||||
|
||||
mClientHeight = coord1.top;
|
||||
|
||||
mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), mClientHeight));
|
||||
mSkillView->setCanvasSize (mSkillView->getWidth(), std::max(mSkillView->getHeight(), coord1.top));
|
||||
}
|
||||
|
||||
void StatsWindow::onPinToggled()
|
||||
|
|
|
@ -57,7 +57,6 @@ namespace MWGui
|
|||
MyGUI::Widget* mRightPane;
|
||||
|
||||
MyGUI::ScrollView* mSkillView;
|
||||
int mLastPos, mClientHeight;
|
||||
|
||||
SkillList mMajorSkills, mMinorSkills, mMiscSkills;
|
||||
std::map<int, MWMechanics::Stat<float> > mSkillValues;
|
||||
|
|
|
@ -149,7 +149,6 @@ namespace MWGui
|
|||
}
|
||||
|
||||
std::string type = focus->getUserString("ToolTipType");
|
||||
std::string text = focus->getUserString("ToolTipText");
|
||||
|
||||
if (type == "")
|
||||
{
|
||||
|
|
|
@ -36,6 +36,9 @@ namespace MWGui
|
|||
, mBalanceButtonsState(BBS_None)
|
||||
, mBalanceChangePause(0.0)
|
||||
, mItemToSell(-1)
|
||||
, mTradeModel(NULL)
|
||||
, mSortModel(NULL)
|
||||
, mCurrentMerchantOffer(0)
|
||||
{
|
||||
getWidget(mFilterAll, "AllButton");
|
||||
getWidget(mFilterWeapon, "WeaponButton");
|
||||
|
|
|
@ -47,6 +47,8 @@ namespace MWGui
|
|||
, mSleeping(false)
|
||||
, mHours(1)
|
||||
, mRemainingTime(0.05)
|
||||
, mCurHour(0)
|
||||
, mManualHours(1)
|
||||
{
|
||||
getWidget(mDateTimeText, "DateTimeText");
|
||||
getWidget(mRestText, "RestText");
|
||||
|
@ -216,7 +218,13 @@ namespace MWGui
|
|||
|
||||
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}");
|
||||
mRestText->setCaptionWithReplacing (canRest ? "#{sRestMenu3}" : "#{sRestIllegal}");
|
||||
|
||||
|
|
|
@ -899,6 +899,7 @@ namespace MWGui
|
|||
: mEnableRepeat(true)
|
||||
, mRepeatTriggerTime(0.5)
|
||||
, mRepeatStepTime(0.1)
|
||||
, mIsIncreasing(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -441,16 +441,19 @@ namespace MWGui
|
|||
mMap ->setVisible(eff & GW_Map);
|
||||
mStatsWindow ->setVisible(eff & GW_Stats);
|
||||
mInventoryWindow->setVisible(eff & GW_Inventory);
|
||||
mInventoryWindow->setGuiMode(mode);
|
||||
mSpellWindow ->setVisible(eff & GW_Magic);
|
||||
break;
|
||||
}
|
||||
case GM_Container:
|
||||
mContainerWindow->setVisible(true);
|
||||
mInventoryWindow->setVisible(true);
|
||||
mInventoryWindow->setGuiMode(mode);
|
||||
break;
|
||||
case GM_Companion:
|
||||
mCompanionWindow->setVisible(true);
|
||||
mInventoryWindow->setVisible(true);
|
||||
mInventoryWindow->setGuiMode(mode);
|
||||
break;
|
||||
case GM_Dialogue:
|
||||
mDialogueWindow->setVisible(true);
|
||||
|
@ -458,6 +461,7 @@ namespace MWGui
|
|||
case GM_Barter:
|
||||
mInventoryWindow->setVisible(true);
|
||||
mInventoryWindow->setTrading(true);
|
||||
mInventoryWindow->setGuiMode(mode);
|
||||
mTradeWindow->setVisible(true);
|
||||
break;
|
||||
case GM_SpellBuying:
|
||||
|
@ -830,6 +834,11 @@ namespace MWGui
|
|||
mHud->setEffectVisible (visible);
|
||||
}
|
||||
|
||||
void WindowManager::setSneakVisibility(bool visible)
|
||||
{
|
||||
mHud->setSneakVisible(visible);
|
||||
}
|
||||
|
||||
void WindowManager::setDragDrop(bool dragDrop)
|
||||
{
|
||||
mToolTips->setEnabled(!dragDrop);
|
||||
|
|
|
@ -179,6 +179,7 @@ namespace MWGui
|
|||
virtual void setMinimapVisibility(bool visible);
|
||||
virtual void setWeaponVisibility(bool visible);
|
||||
virtual void setSpellVisibility(bool visible);
|
||||
virtual void setSneakVisibility(bool visible);
|
||||
|
||||
virtual void activateQuickKey (int index);
|
||||
|
||||
|
|
|
@ -844,8 +844,8 @@ namespace MWInput
|
|||
defaultKeyBindings[A_QuickKey8] = SDLK_8;
|
||||
defaultKeyBindings[A_QuickKey9] = SDLK_9;
|
||||
defaultKeyBindings[A_QuickKey10] = SDLK_0;
|
||||
defaultKeyBindings[A_Screenshot] = SDLK_PRINTSCREEN;
|
||||
defaultKeyBindings[A_ToggleHUD] = SDLK_F12;
|
||||
defaultKeyBindings[A_Screenshot] = SDLK_F12;
|
||||
defaultKeyBindings[A_ToggleHUD] = SDLK_F11;
|
||||
defaultKeyBindings[A_AlwaysRun] = SDLK_y;
|
||||
|
||||
std::map<int, int> defaultMouseButtonBindings;
|
||||
|
@ -880,12 +880,20 @@ namespace MWInput
|
|||
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::map<int, std::string> descriptions;
|
||||
|
||||
if (action == A_Screenshot)
|
||||
return "Screenshot";
|
||||
|
||||
descriptions[A_Use] = "sUse";
|
||||
descriptions[A_Activate] = "sActivate";
|
||||
descriptions[A_MoveBackward] = "sBack";
|
||||
|
@ -958,6 +966,7 @@ namespace MWInput
|
|||
ret.push_back(A_Journal);
|
||||
ret.push_back(A_Rest);
|
||||
ret.push_back(A_Console);
|
||||
ret.push_back(A_Screenshot);
|
||||
ret.push_back(A_QuickKeysMenu);
|
||||
ret.push_back(A_QuickKey1);
|
||||
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)
|
||||
: mActorId(actorId), mX(x), mY(y), mZ(z), mDuration(duration)
|
||||
, cellX(std::numeric_limits<int>::max())
|
||||
, cellY(std::numeric_limits<int>::max())
|
||||
{
|
||||
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)
|
||||
: 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;
|
||||
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
|
||||
#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)
|
||||
{
|
||||
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());
|
||||
}
|
||||
|
||||
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 <components/esm/loadnpc.hpp>
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Ptr;
|
||||
|
@ -48,6 +50,8 @@ namespace MWMechanics
|
|||
void queue (const AiPackage& package);
|
||||
///< Add \a package to the end of the sequence (executed after all other packages have been
|
||||
/// completed)
|
||||
|
||||
void fill (const ESM::AIPackageList& list);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ namespace MWMechanics
|
|||
{
|
||||
AiTravel::AiTravel(float x, float y, float z)
|
||||
: 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):
|
||||
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++)
|
||||
{
|
||||
|
@ -38,7 +45,6 @@ namespace MWMechanics
|
|||
if(mDuration == 0)
|
||||
mTimeOfDay = 0;
|
||||
|
||||
srand(time(NULL));
|
||||
mStartTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
||||
mPlayedIdle = 0;
|
||||
mPathgrid = NULL;
|
||||
|
@ -182,13 +188,13 @@ namespace MWMechanics
|
|||
mPlayedIdle = 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 randSelect = (int)(rand() / ((double)RAND_MAX + 1) * int(100 / mIdleChanceMultiplier));
|
||||
if(randSelect < idleChance && randSelect > idleRoll)
|
||||
{
|
||||
mPlayedIdle = counter;
|
||||
mPlayedIdle = counter+2;
|
||||
idleRoll = randSelect;
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +209,7 @@ namespace MWMechanics
|
|||
// Play idle animation and recreate vanilla (broken?) behavior of resetting start time of AIWander:
|
||||
MWWorld::TimeStamp currentTime = MWBase::Environment::get().getWorld()->getTimeStamp();
|
||||
mStartTime = currentTime;
|
||||
playIdle(actor, mPlayedIdle + 1);
|
||||
playIdle(actor, mPlayedIdle);
|
||||
mChooseAction = false;
|
||||
mIdleNow = true;
|
||||
}
|
||||
|
@ -211,7 +217,7 @@ namespace MWMechanics
|
|||
|
||||
if(mIdleNow)
|
||||
{
|
||||
if(!checkIdle(actor, mPlayedIdle + 1))
|
||||
if(!checkIdle(actor, mPlayedIdle))
|
||||
{
|
||||
mPlayedIdle = 0;
|
||||
mIdleNow = false;
|
||||
|
|
|
@ -501,9 +501,12 @@ bool CharacterController::updateNpcState()
|
|||
if(mAttackType != "shoot")
|
||||
{
|
||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||
// NOTE: SwishL, SwishM, SwishS - large, medium, small.
|
||||
// Based on weapon weight, speed, or attack strength?
|
||||
sndMgr->playSound3D(mPtr, "SwishL", 1.0f, 1.0f);
|
||||
if(complete < 0.5f)
|
||||
sndMgr->playSound3D(mPtr, "SwishM", 1.0f, 0.8f); //Weak attack
|
||||
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);
|
||||
|
||||
|
@ -560,10 +563,18 @@ bool CharacterController::updateNpcState()
|
|||
weapSpeed, mAttackType+" follow start", mAttackType+" follow stop",
|
||||
0.0f, 0);
|
||||
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,
|
||||
MWRender::Animation::Group_UpperBody, true,
|
||||
weapSpeed, mAttackType+" large follow start", mAttackType+" large follow stop",
|
||||
0.0f, 0);
|
||||
weapSpeed, start, stop, 0.0f, 0);
|
||||
}
|
||||
mUpperBodyState = UpperCharState_FollowStartToFollowStop;
|
||||
}
|
||||
}
|
||||
|
@ -699,7 +710,7 @@ void CharacterController::update(float duration, Movement &movement)
|
|||
if(movestate != CharState_None)
|
||||
clearAnimQueue();
|
||||
|
||||
if(mAnimQueue.size() == 0)
|
||||
if(mAnimQueue.empty())
|
||||
idlestate = (inwater ? CharState_IdleSwim : (sneak ? CharState_IdleSneak : CharState_Idle));
|
||||
else if(mAnimQueue.size() > 1)
|
||||
{
|
||||
|
@ -765,7 +776,7 @@ void CharacterController::playGroup(const std::string &groupname, int mode, int
|
|||
else
|
||||
{
|
||||
count = std::max(count, 1);
|
||||
if(mode != 0 || mAnimQueue.size() == 0)
|
||||
if(mode != 0 || mAnimQueue.empty())
|
||||
{
|
||||
clearAnimQueue();
|
||||
mAnimQueue.push_back(std::make_pair(groupname, count-1));
|
||||
|
@ -801,7 +812,7 @@ bool CharacterController::isAnimPlaying(const std::string &groupName)
|
|||
|
||||
void CharacterController::clearAnimQueue()
|
||||
{
|
||||
if(mAnimQueue.size() > 0)
|
||||
if(!mAnimQueue.empty())
|
||||
mAnimation->disable(mAnimQueue.front().first);
|
||||
mAnimQueue.clear();
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace MWMechanics
|
|||
: mLevel (0), mLevelHealthBonus(0.f), mDead (false), mDied (false), mFriendlyHits (0),
|
||||
mTalkedTo (false), mAlarmed (false),
|
||||
mAttacked (false), mHostile (false),
|
||||
mAttackingOrSpell(false)
|
||||
mAttackingOrSpell(false), mAttackType(AT_Chop)
|
||||
{
|
||||
for (int i=0; i<4; ++i)
|
||||
mAiSettings[i] = 0;
|
||||
|
@ -319,6 +319,16 @@ namespace MWMechanics
|
|||
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)
|
||||
{
|
||||
mLastHitObject = objectid;
|
||||
|
|
|
@ -158,6 +158,8 @@ namespace MWMechanics
|
|||
|
||||
bool getCreatureTargetted() const;
|
||||
|
||||
float getEvasion() const;
|
||||
|
||||
void setLastHitObject(const std::string &objectid);
|
||||
const std::string &getLastHitObject() const;
|
||||
};
|
||||
|
|
|
@ -11,8 +11,10 @@
|
|||
|
||||
namespace MWMechanics
|
||||
{
|
||||
Enchanting::Enchanting():
|
||||
mCastStyle(ESM::Enchantment::CastOnce)
|
||||
Enchanting::Enchanting()
|
||||
: mCastStyle(ESM::Enchantment::CastOnce)
|
||||
, mSelfEnchanting(false)
|
||||
, mOldItemCount(0)
|
||||
{}
|
||||
|
||||
void Enchanting::setOldItem(MWWorld::Ptr oldItem)
|
||||
|
|
|
@ -416,7 +416,7 @@ namespace MWMechanics
|
|||
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();
|
||||
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;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ namespace MWMechanics
|
|||
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();
|
||||
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() )
|
||||
{
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace
|
|||
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])
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace MWRender
|
|||
Actors(OEngine::Render::OgreRenderer& _rend, MWRender::RenderingManager* rendering)
|
||||
: mRend(_rend)
|
||||
, mRendering(rendering)
|
||||
, mRootNode(NULL)
|
||||
{}
|
||||
~Actors();
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ Animation::~Animation()
|
|||
|
||||
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)
|
||||
mInsert = node->createChildSceneNode();
|
||||
|
||||
|
@ -126,7 +126,7 @@ void Animation::setObjectRoot(Ogre::SceneNode *node, const std::string &model, b
|
|||
else
|
||||
{
|
||||
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;
|
||||
Ogre::SharedPtr<AnimSource> animsrc(OGRE_NEW AnimSource);
|
||||
NifOgre::Loader::createKfControllers(mSkelBase, kfname, animsrc->mTextKeys, ctrls);
|
||||
if(animsrc->mTextKeys.size() == 0 || ctrls.size() == 0)
|
||||
if(animsrc->mTextKeys.empty() || ctrls.empty())
|
||||
return;
|
||||
|
||||
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)
|
||||
{
|
||||
float time = key->first;
|
||||
//float time = key->first;
|
||||
const std::string &evt = key->second;
|
||||
|
||||
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)
|
||||
{
|
||||
if(!mSkelBase || mAnimSources.size() == 0)
|
||||
if(!mSkelBase || mAnimSources.empty())
|
||||
return;
|
||||
|
||||
if(groupname.empty())
|
||||
|
@ -567,7 +567,7 @@ void Animation::play(const std::string &groupname, int priority, int groups, boo
|
|||
if(stateiter->second.mPriority == priority)
|
||||
mStates.erase(stateiter++);
|
||||
else
|
||||
stateiter++;
|
||||
++stateiter;
|
||||
}
|
||||
|
||||
stateiter = mStates.find(groupname);
|
||||
|
@ -642,7 +642,7 @@ void Animation::resetActiveGroups()
|
|||
AnimStateMap::const_iterator active = mStates.end();
|
||||
|
||||
AnimStateMap::const_iterator state = mStates.begin();
|
||||
for(;state != mStates.end();state++)
|
||||
for(;state != mStates.end();++state)
|
||||
{
|
||||
if(!(state->second.mGroups&(1<<grp)))
|
||||
continue;
|
||||
|
@ -773,7 +773,7 @@ Ogre::Vector3 Animation::runAnimation(float duration)
|
|||
resetActiveGroups();
|
||||
}
|
||||
else
|
||||
stateiter++;
|
||||
++stateiter;
|
||||
}
|
||||
|
||||
for(size_t i = 0;i < mObjectRoot.mControllers.size();i++)
|
||||
|
|
|
@ -36,6 +36,8 @@ namespace MWRender
|
|||
|
||||
mPreviewCam.yaw = 0.f;
|
||||
mPreviewCam.offset = 400.f;
|
||||
mMainCam.yaw = 0.f;
|
||||
mMainCam.offset = 400.f;
|
||||
}
|
||||
|
||||
Camera::~Camera()
|
||||
|
@ -99,9 +101,11 @@ namespace MWRender
|
|||
MWBase::Environment::get().getSoundManager()->setListenerPosDir(pos, dir, up);
|
||||
}
|
||||
|
||||
void Camera::update(float duration)
|
||||
void Camera::update(float duration, bool paused)
|
||||
{
|
||||
updateListener();
|
||||
if (paused)
|
||||
return;
|
||||
|
||||
// only show the crosshair in game mode and in first person mode.
|
||||
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace MWRender
|
|||
|
||||
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.
|
||||
/// \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,
|
||||
Ogre::Vector3 position, Ogre::Vector3 lookAt)
|
||||
|
||||
: mSceneMgr (0)
|
||||
, mPosition(position)
|
||||
, mLookAt(lookAt)
|
||||
|
@ -31,6 +30,10 @@ namespace MWRender
|
|||
, mName(name)
|
||||
, mSizeX(sizeX)
|
||||
, mSizeY(sizeY)
|
||||
, mRenderTarget(NULL)
|
||||
, mViewport(NULL)
|
||||
, mCamera(NULL)
|
||||
, mNode(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace MWRender
|
|||
: mCacheDir(cacheDir)
|
||||
, mMinX(0), mMaxX(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 hillColour(0.16, 0.12, 0.08);
|
||||
|
||||
float mountainHeight = 15000.f;
|
||||
float hillHeight = 2500.f;
|
||||
|
||||
unsigned char r,g,b;
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -286,7 +286,7 @@ void NpcAnimation::updateParts(bool forceupdate)
|
|||
{
|
||||
typedef std::multimap<ESM::BodyPart::MeshPart,ESM::PartReferenceType> BodyPartMapType;
|
||||
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_Chest, ESM::PRT_Cuirass));
|
||||
|
@ -345,7 +345,7 @@ void NpcAnimation::updateParts(bool forceupdate)
|
|||
{
|
||||
if(!parts[bIt->second])
|
||||
parts[bIt->second] = &*it;
|
||||
bIt++;
|
||||
++bIt;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
@ -354,7 +354,7 @@ void NpcAnimation::updateParts(bool forceupdate)
|
|||
while(bIt != sBodyPartMap.end() && bIt->first == bodypart.mData.mPart)
|
||||
{
|
||||
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") ||
|
||||
anyTransparency || objects.mParticles.size() > 0)
|
||||
anyTransparency || !objects.mParticles.empty())
|
||||
{
|
||||
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();
|
||||
mRenderer.getScene()->destroyEntity(*iter);
|
||||
iter++;
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,12 @@ class Objects{
|
|||
///< Remove all movable objects from \a node.
|
||||
|
||||
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(){}
|
||||
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
||||
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);
|
||||
}
|
||||
catch (Ogre::Exception e)
|
||||
catch (Ogre::Exception& e)
|
||||
{
|
||||
mSupported = false;
|
||||
}
|
||||
|
|
|
@ -351,11 +351,11 @@ void RenderingManager::update (float duration, bool paused)
|
|||
|
||||
applyFog(world->isUnderwater(player.getCell(), cam));
|
||||
|
||||
mCamera->update(duration, paused);
|
||||
|
||||
if(paused)
|
||||
return;
|
||||
|
||||
mCamera->update(duration);
|
||||
|
||||
mActors.update (duration);
|
||||
mObjects.update (duration);
|
||||
|
||||
|
|
|
@ -1042,6 +1042,8 @@ VideoPlayer::VideoPlayer(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* windo
|
|||
, mNode(NULL)
|
||||
, mAllowSkipping(false)
|
||||
, mWindow(window)
|
||||
, mWidth(0)
|
||||
, mHeight(0)
|
||||
{
|
||||
mVideoMaterial = Ogre::MaterialManager::getSingleton().getByName("VideoMaterial", "General");
|
||||
if (mVideoMaterial.isNull ())
|
||||
|
|
|
@ -43,6 +43,8 @@ namespace MWRender {
|
|||
Reflection(Ogre::SceneManager* sceneManager)
|
||||
: mSceneMgr(sceneManager)
|
||||
, mIsUnderwater(false)
|
||||
, mCamera(NULL)
|
||||
, mParentCamera(NULL)
|
||||
{}
|
||||
virtual ~Reflection() {}
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ namespace MWScript
|
|||
|
||||
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();
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ struct OpenAL_Output::StreamThread {
|
|||
if((*iter)->process() == false)
|
||||
iter = mStreams.erase(iter);
|
||||
else
|
||||
iter++;
|
||||
++iter;
|
||||
}
|
||||
mMutex.unlock();
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds(50));
|
||||
|
@ -491,6 +491,7 @@ public:
|
|||
virtual void stop();
|
||||
virtual bool isPlaying();
|
||||
virtual double getTimeOffset();
|
||||
virtual double getLength();
|
||||
virtual void update();
|
||||
};
|
||||
|
||||
|
@ -554,6 +555,17 @@ double OpenAL_Sound::getTimeOffset()
|
|||
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)
|
||||
{
|
||||
alSourcef(mSource, AL_REFERENCE_DISTANCE, mMinDistance);
|
||||
|
@ -797,7 +809,7 @@ ALuint OpenAL_Output::getBuffer(const std::string &fname)
|
|||
if(nameiter->second == oldbuf)
|
||||
mBufferCache.erase(nameiter++);
|
||||
else
|
||||
nameiter++;
|
||||
++nameiter;
|
||||
}
|
||||
|
||||
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)
|
||||
MWBase::SoundPtr OpenAL_Output::playSound(const std::string &fname, float vol, float basevol, float pitch, int flags,float offset)
|
||||
{
|
||||
boost::shared_ptr<OpenAL_Sound> sound;
|
||||
ALuint src=0, buf=0;
|
||||
|
@ -843,8 +854,13 @@ MWBase::SoundPtr OpenAL_Output::playSound(const std::string &fname, float vol, f
|
|||
}
|
||||
|
||||
sound->updateAll(true);
|
||||
if(offset<0)
|
||||
offset=0;
|
||||
if(offset>1)
|
||||
offset=1;
|
||||
|
||||
alSourcei(src, AL_BUFFER, buf);
|
||||
alSourcef(src, AL_SEC_OFFSET, sound->getLength()*offset/pitch);
|
||||
alSourcePlay(src);
|
||||
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,
|
||||
float min, float max, int flags)
|
||||
float min, float max, int flags, float offset)
|
||||
{
|
||||
boost::shared_ptr<OpenAL_Sound> sound;
|
||||
ALuint src=0, buf=0;
|
||||
|
@ -878,7 +894,14 @@ MWBase::SoundPtr OpenAL_Output::playSound3D(const std::string &fname, const Ogre
|
|||
|
||||
sound->updateAll(false);
|
||||
|
||||
if(offset<0)
|
||||
offset=0;
|
||||
if(offset>1)
|
||||
offset=1;
|
||||
|
||||
alSourcei(src, AL_BUFFER, buf);
|
||||
alSourcef(src, AL_SEC_OFFSET, sound->getLength()*offset/pitch);
|
||||
|
||||
alSourcePlay(src);
|
||||
throwALerror();
|
||||
|
||||
|
@ -951,9 +974,9 @@ void OpenAL_Output::pauseSounds(int types)
|
|||
if(sound && sound->mSource && (sound->getPlayType()&types))
|
||||
sources.push_back(sound->mSource);
|
||||
}
|
||||
iter++;
|
||||
++iter;
|
||||
}
|
||||
if(sources.size() > 0)
|
||||
if(!sources.empty())
|
||||
{
|
||||
alSourcePausev(sources.size(), &sources[0]);
|
||||
throwALerror();
|
||||
|
@ -978,9 +1001,9 @@ void OpenAL_Output::resumeSounds(int types)
|
|||
if(sound && sound->mSource && (sound->getPlayType()&types))
|
||||
sources.push_back(sound->mSource);
|
||||
}
|
||||
iter++;
|
||||
++iter;
|
||||
}
|
||||
if(sources.size() > 0)
|
||||
if(!sources.empty())
|
||||
{
|
||||
alSourcePlayv(sources.size(), &sources[0]);
|
||||
throwALerror();
|
||||
|
|
|
@ -45,9 +45,11 @@ namespace MWSound
|
|||
virtual void init(const std::string &devname="");
|
||||
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,
|
||||
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 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 mMaxDistance;
|
||||
int mFlags;
|
||||
float mFadeOutTime;
|
||||
|
||||
public:
|
||||
virtual void stop() = 0;
|
||||
|
@ -29,7 +30,7 @@ namespace MWSound
|
|||
virtual double getTimeOffset() = 0;
|
||||
void setPosition(const Ogre::Vector3 &pos) { mPos = pos; }
|
||||
void setVolume(float volume) { mVolume = volume; }
|
||||
|
||||
void setFadeout(float duration) { mFadeOutTime=duration; }
|
||||
MWBase::SoundManager::PlayType getPlayType() const
|
||||
{ return (MWBase::SoundManager::PlayType)(mFlags&MWBase::SoundManager::Play_TypeMask); }
|
||||
|
||||
|
@ -42,6 +43,7 @@ namespace MWSound
|
|||
, mMinDistance(mindist)
|
||||
, mMaxDistance(maxdist)
|
||||
, mFlags(flags)
|
||||
, mFadeOutTime(0)
|
||||
{ }
|
||||
virtual ~Sound() { }
|
||||
|
||||
|
|
|
@ -24,9 +24,11 @@ namespace MWSound
|
|||
virtual void init(const std::string &devname="") = 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,
|
||||
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 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)
|
||||
, mVoiceVolume(1.0f)
|
||||
, mPausedSoundTypes(0)
|
||||
, mListenerPos(0,0,0)
|
||||
, mListenerDir(1,0,0)
|
||||
, mListenerUp(0,0,1)
|
||||
{
|
||||
if(!useSound)
|
||||
return;
|
||||
|
@ -170,7 +173,7 @@ namespace MWSound
|
|||
{
|
||||
if(snditer->second.first == ptr && snditer->second.second == id)
|
||||
return snditer->first->isPlaying();
|
||||
snditer++;
|
||||
++snditer;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -252,7 +255,7 @@ namespace MWSound
|
|||
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,
|
||||
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"));
|
||||
}
|
||||
catch(std::exception &e)
|
||||
|
@ -270,7 +273,7 @@ namespace MWSound
|
|||
float basevol = volumeFromType(Play_TypeVoice);
|
||||
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"));
|
||||
}
|
||||
catch(std::exception &e)
|
||||
|
@ -295,7 +298,7 @@ namespace MWSound
|
|||
mActiveSounds.erase(snditer++);
|
||||
}
|
||||
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;
|
||||
if(!mOutput->isInitialized())
|
||||
|
@ -328,7 +331,7 @@ namespace MWSound
|
|||
float 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);
|
||||
}
|
||||
catch(std::exception &e)
|
||||
|
@ -339,7 +342,7 @@ namespace MWSound
|
|||
}
|
||||
|
||||
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;
|
||||
if(!mOutput->isInitialized())
|
||||
|
@ -350,10 +353,10 @@ namespace MWSound
|
|||
float basevol = volumeFromType(type);
|
||||
float 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]);
|
||||
|
||||
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))
|
||||
mActiveSounds[sound] = std::make_pair(MWWorld::Ptr(), soundId);
|
||||
else
|
||||
|
@ -377,7 +380,7 @@ namespace MWSound
|
|||
mActiveSounds.erase(snditer++);
|
||||
}
|
||||
else
|
||||
snditer++;
|
||||
++snditer;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,7 +395,7 @@ namespace MWSound
|
|||
mActiveSounds.erase(snditer++);
|
||||
}
|
||||
else
|
||||
snditer++;
|
||||
++snditer;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -408,7 +411,7 @@ namespace MWSound
|
|||
mActiveSounds.erase(snditer++);
|
||||
}
|
||||
else
|
||||
snditer++;
|
||||
++snditer;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -424,7 +427,21 @@ namespace MWSound
|
|||
mActiveSounds.erase(snditer++);
|
||||
}
|
||||
else
|
||||
snditer++;
|
||||
++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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -487,7 +504,7 @@ namespace MWSound
|
|||
while(soundIter != regn->mSoundList.end())
|
||||
{
|
||||
total += (int)soundIter->mChance;
|
||||
soundIter++;
|
||||
++soundIter;
|
||||
}
|
||||
if(total == 0)
|
||||
return;
|
||||
|
@ -506,7 +523,7 @@ namespace MWSound
|
|||
}
|
||||
pos += soundIter->mChance;
|
||||
|
||||
soundIter++;
|
||||
++soundIter;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -517,6 +534,7 @@ namespace MWSound
|
|||
timePassed += duration;
|
||||
if(timePassed < (1.0f/30.0f))
|
||||
return;
|
||||
duration = timePassed;
|
||||
timePassed = 0.0f;
|
||||
|
||||
// Make sure music is still playing
|
||||
|
@ -539,6 +557,7 @@ namespace MWSound
|
|||
);
|
||||
|
||||
// Check if any sounds are finished playing, and trash them
|
||||
// Lower volume on fading out sounds
|
||||
SoundMap::iterator snditer = mActiveSounds.begin();
|
||||
while(snditer != mActiveSounds.end())
|
||||
{
|
||||
|
@ -553,8 +572,18 @@ namespace MWSound
|
|||
const Ogre::Vector3 objpos(pos.pos[0], pos.pos[1], pos.pos[2]);
|
||||
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++;
|
||||
++snditer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -581,7 +610,7 @@ namespace MWSound
|
|||
{
|
||||
snditer->first->mBaseVolume = volumeFromType(snditer->first->getPlayType());
|
||||
snditer->first->update();
|
||||
snditer++;
|
||||
++snditer;
|
||||
}
|
||||
if(mMusic)
|
||||
{
|
||||
|
|
|
@ -106,13 +106,15 @@ namespace MWSound
|
|||
virtual MWBase::SoundPtr playTrack(const DecoderPtr& decoder, PlayType type);
|
||||
///< 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
|
||||
///< @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,
|
||||
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
|
||||
///< @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);
|
||||
///< Stop the given object from playing the given sound,
|
||||
|
@ -126,6 +128,12 @@ namespace MWSound
|
|||
virtual void stopSound(const std::string& soundId);
|
||||
///< 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;
|
||||
///< Is the given sound currently playing on the given object?
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ const MWWorld::Ptr& MWWorld::Action::getTarget() const
|
|||
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() {}
|
||||
|
@ -21,14 +21,16 @@ void MWWorld::Action::execute (const Ptr& actor)
|
|||
if (!mSoundId.empty())
|
||||
{
|
||||
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
|
||||
{
|
||||
bool local = mTarget.isEmpty() || !mTarget.isInCell(); // no usable target
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(local ? actor : mTarget,
|
||||
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;
|
||||
}
|
||||
|
||||
void MWWorld::Action::setSoundOffset(float offset)
|
||||
{
|
||||
mSoundOffset=offset;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace MWWorld
|
|||
{
|
||||
std::string mSoundId;
|
||||
bool mKeepSound;
|
||||
float mSoundOffset;
|
||||
Ptr mTarget;
|
||||
|
||||
// not implemented
|
||||
|
@ -34,6 +35,7 @@ namespace MWWorld
|
|||
void execute (const Ptr& actor);
|
||||
|
||||
void setSound (const std::string& id);
|
||||
void setSoundOffset(float offset);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -44,39 +44,6 @@ void MWWorld::Cells::clear()
|
|||
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)
|
||||
{
|
||||
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.
|
||||
result->second.load (mStore, mReader);
|
||||
fillContainers (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)
|
||||
{
|
||||
result->second.load (mStore, mReader);
|
||||
fillContainers (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))
|
||||
{
|
||||
cell.load (mStore, mReader);
|
||||
fillContainers (cell);
|
||||
}
|
||||
else
|
||||
return Ptr();
|
||||
|
|
|
@ -31,8 +31,6 @@ namespace MWWorld
|
|||
|
||||
CellStore *getCellStore (const ESM::Cell *cell);
|
||||
|
||||
void fillContainers (CellStore& cellStore);
|
||||
|
||||
Ptr getPtrAndCache (const std::string& name, CellStore& cellStore);
|
||||
|
||||
public:
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace MWWorld
|
|||
{
|
||||
assert (mCell);
|
||||
|
||||
if (mCell->mContextList.size() == 0)
|
||||
if (mCell->mContextList.empty())
|
||||
return; // this is a dynamically generated cell -> skipping.
|
||||
|
||||
// Load references from all plugins that do something with this cell.
|
||||
|
@ -113,7 +113,7 @@ namespace MWWorld
|
|||
{
|
||||
assert (mCell);
|
||||
|
||||
if (mCell->mContextList.size() == 0)
|
||||
if (mCell->mContextList.empty())
|
||||
return; // this is a dynamically generated cell -> skipping.
|
||||
|
||||
// Load references from all plugins that do something with this cell.
|
||||
|
@ -174,7 +174,7 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
// 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...
|
||||
ESM::CellRef &ref = const_cast<ESM::CellRef&>(*it);
|
||||
|
|
|
@ -79,18 +79,6 @@ namespace MWWorld
|
|||
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
|
||||
{
|
||||
throw std::runtime_error("class cannot hit");
|
||||
|
@ -244,11 +232,6 @@ namespace MWWorld
|
|||
return *iter->second;
|
||||
}
|
||||
|
||||
const Class& Class::get (const Ptr& ptr)
|
||||
{
|
||||
return get (ptr.getTypeName());
|
||||
}
|
||||
|
||||
bool Class::isPersistent(const Ptr &ptr) const
|
||||
{
|
||||
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
|
||||
/// (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;
|
||||
///< Execute a melee hit, using the current weapon. This will check the relevant skills
|
||||
/// of the given attacker, and whoever is hit.
|
||||
|
@ -230,7 +227,10 @@ namespace MWWorld
|
|||
static const Class& get (const std::string& key);
|
||||
///< 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.
|
||||
|
||||
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;
|
||||
std::string item = candidates[std::rand()%candidates.size()];
|
||||
addInitialItem(item, owner, count, failChance, false);
|
||||
|
|
|
@ -118,7 +118,8 @@ namespace MWWorld
|
|||
newPosition = trace.endpos;
|
||||
|
||||
physicActor->setOnGround(hit && getSlope(trace.planenormal) <= sMaxSlope);
|
||||
physicActor->enableCollisions(wasCollisionMode);
|
||||
if (wasCollisionMode)
|
||||
physicActor->enableCollisions(true);
|
||||
|
||||
if (hit)
|
||||
return newPosition+Ogre::Vector3(0,0,4);
|
||||
|
@ -148,6 +149,7 @@ namespace MWWorld
|
|||
float remainingTime = time;
|
||||
bool isInterior = !ptr.getCell()->isExterior();
|
||||
Ogre::Vector3 halfExtents = physicActor->getHalfExtents();// + Vector3(1,1,1);
|
||||
bool wasCollisionMode = physicActor->getCollisionMode();
|
||||
physicActor->enableCollisions(false);
|
||||
Ogre::Quaternion orient = Ogre::Quaternion(Ogre::Radian(ptr.getRefData().getPosition().rot[2]), Ogre::Vector3::UNIT_Z);
|
||||
Ogre::Vector3 velocity;
|
||||
|
@ -228,7 +230,8 @@ namespace MWWorld
|
|||
}
|
||||
physicActor->setOnGround(onground);
|
||||
physicActor->setVerticalForce(!onground ? clippedVelocity.z - time*627.2f : 0.0f);
|
||||
physicActor->enableCollisions(true);
|
||||
if (wasCollisionMode)
|
||||
physicActor->enableCollisions(true);
|
||||
return newPosition;
|
||||
}
|
||||
};
|
||||
|
@ -507,7 +510,7 @@ namespace MWWorld
|
|||
|
||||
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")
|
||||
{
|
||||
|
|
|
@ -123,6 +123,9 @@ namespace MWWorld
|
|||
MWWorld::Ptr ptr = getPlayer();
|
||||
|
||||
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)
|
||||
|
|
|
@ -74,7 +74,7 @@ void Store<ESM::Cell>::load(ESM::ESMReader &esm, const std::string &id)
|
|||
// copy list into new cell
|
||||
cell->mContextList = oldcell->mContextList;
|
||||
// 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
|
||||
ESM::MovedCellRefTracker::iterator itold = std::find(oldcell->mMovedRefs.begin(), oldcell->mMovedRefs.end(), it->mRefnum);
|
||||
if (itold != oldcell->mMovedRefs.end()) {
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace MWWorld
|
|||
|
||||
SharedIterator operator++(int) {
|
||||
SharedIterator iter = *this;
|
||||
mIter++;
|
||||
++mIter;
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace MWWorld
|
|||
|
||||
SharedIterator operator--(int) {
|
||||
SharedIterator iter = *this;
|
||||
mIter--;
|
||||
--mIter;
|
||||
|
||||
return iter;
|
||||
}
|
||||
|
|
|
@ -165,8 +165,9 @@ namespace MWWorld
|
|||
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride)
|
||||
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
|
||||
mSky (true), mCells (mStore, mEsm),
|
||||
mNumFacing(0), mActivationDistanceOverride (mActivationDistanceOverride),
|
||||
mFallback(fallbackMap), mPlayIntro(0), mTeleportEnabled(true)
|
||||
mActivationDistanceOverride (mActivationDistanceOverride),
|
||||
mFallback(fallbackMap), mPlayIntro(0), mTeleportEnabled(true),
|
||||
mFacedDistance(FLT_MAX)
|
||||
{
|
||||
mPhysics = new PhysicsSystem(renderer);
|
||||
mPhysEngine = mPhysics->getEngine();
|
||||
|
@ -235,7 +236,6 @@ namespace MWWorld
|
|||
|
||||
// Rebuild player
|
||||
setupPlayer();
|
||||
const ESM::NPC* playerNpc = mStore.get<ESM::NPC>().find("player");
|
||||
MWWorld::Ptr player = mPlayer->getPlayer();
|
||||
renderPlayer();
|
||||
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
|
||||
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();
|
||||
|
||||
ESM::Position pos;
|
||||
|
@ -1117,7 +1114,7 @@ namespace MWWorld
|
|||
|
||||
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);
|
||||
return mPhysics->castRay(a,b,false,true);
|
||||
}
|
||||
|
@ -1329,7 +1326,7 @@ namespace MWWorld
|
|||
++it;
|
||||
}
|
||||
|
||||
if (results.size() == 0)
|
||||
if (results.empty())
|
||||
{
|
||||
mFacedHandle = "";
|
||||
mFacedDistance = FLT_MAX;
|
||||
|
@ -1717,8 +1714,6 @@ namespace MWWorld
|
|||
|
||||
void World::getContainersOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out)
|
||||
{
|
||||
std::string refId = npc.getCellRef().mRefID;
|
||||
|
||||
const Scene::CellStoreCollection& collection = mWorldScene->getActiveCells();
|
||||
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());
|
||||
|
||||
if (enable)
|
||||
{
|
||||
physicActor->enableCollisionBody();
|
||||
}
|
||||
else
|
||||
{
|
||||
physicActor->disableCollisionBody();
|
||||
}
|
||||
physicActor->enableCollisions(enable);
|
||||
}
|
||||
|
||||
bool World::findInteriorPosition(const std::string &name, ESM::Position &pos)
|
||||
|
|
|
@ -77,13 +77,6 @@ namespace MWWorld
|
|||
int mActivationDistanceOverride;
|
||||
std::string mFacedHandle;
|
||||
float mFacedDistance;
|
||||
Ptr mFaced1;
|
||||
Ptr mFaced2;
|
||||
std::string mFaced1Name;
|
||||
std::string mFaced2Name;
|
||||
float mFaced1Distance;
|
||||
float mFaced2Distance;
|
||||
int mNumFacing;
|
||||
|
||||
std::map<MWWorld::Ptr, int> mDoorStates;
|
||||
///< 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());
|
||||
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) ||
|
||||
(recursive && Ogre::StringUtil::match(iter->first, "*/"+normalizedPattern)))
|
||||
|
@ -169,7 +169,7 @@ public:
|
|||
}
|
||||
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) ||
|
||||
(recursive && Ogre::StringUtil::match(iter->first, "*/"+normalizedPattern)))
|
||||
|
@ -249,7 +249,7 @@ public:
|
|||
std::string normalizedPattern = normalize_path(pattern.begin(), pattern.end());
|
||||
const Bsa::BSAFile::FileList &filelist = arc.getList();
|
||||
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));
|
||||
if(Ogre::StringUtil::match(ent, normalizedPattern) ||
|
||||
|
@ -266,7 +266,7 @@ public:
|
|||
FileInfoListPtr ptr = FileInfoListPtr(new FileInfoList());
|
||||
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));
|
||||
if(Ogre::StringUtil::match(ent, normalizedPattern) ||
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Compiler
|
|||
Literals& literals, std::vector<Interpreter::Type_Code>& code, bool allowExpression)
|
||||
: Parser (errorHandler, context), mLocals (locals), mLiterals (literals), mCode (code),
|
||||
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)
|
||||
|
|
|
@ -509,7 +509,7 @@ namespace Compiler
|
|||
Scanner::Scanner (ErrorHandler& errorHandler, std::istream& inputStream,
|
||||
const Extensions *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()
|
||||
: mBuffer(50*1024)
|
||||
, mRecordFlags(0)
|
||||
, mIdx(0)
|
||||
, mGlobalReaderList(NULL)
|
||||
, mEncoder(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -66,10 +66,11 @@ Land::Land()
|
|||
, mX(0)
|
||||
, mY(0)
|
||||
, mEsm(NULL)
|
||||
// , hasData(false)
|
||||
, mDataTypes(0)
|
||||
, mDataLoaded(false)
|
||||
, mLandData(NULL)
|
||||
, mPlugin(0)
|
||||
, mHasData(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -56,14 +56,14 @@ void Pathgrid::load(ESMReader &esm)
|
|||
std::vector<int>::const_iterator rawIt = rawConnections.begin();
|
||||
int pointIndex = 0;
|
||||
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;
|
||||
for (int i = 0; i < connectionNum; ++i) {
|
||||
Edge edge;
|
||||
edge.mV0 = pointIndex;
|
||||
edge.mV1 = *rawIt;
|
||||
rawIt++;
|
||||
++rawIt;
|
||||
mEdges.push_back(edge);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
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;
|
||||
if(retval){
|
||||
(*i) += escword.length();
|
||||
|
@ -18,7 +18,7 @@ namespace Interpreter{
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
namespace Interpreter
|
||||
{
|
||||
Runtime::Runtime() : mContext (0), mCode (0), mPC (0) {}
|
||||
Runtime::Runtime() : mContext (0), mCode (0), mPC (0), mCodeSize(0) {}
|
||||
|
||||
int Runtime::getPC() const
|
||||
{
|
||||
|
|
|
@ -75,12 +75,12 @@ btVector3 ManualBulletShapeLoader::getbtVector(Ogre::Vector3 const &v)
|
|||
|
||||
void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
||||
{
|
||||
cShape = static_cast<OEngine::Physic::BulletShape *>(resource);
|
||||
resourceName = cShape->getName();
|
||||
cShape->mCollide = false;
|
||||
mShape = static_cast<OEngine::Physic::BulletShape *>(resource);
|
||||
mResourceName = mShape->getName();
|
||||
mShape->mCollide = false;
|
||||
mBoundingBox = NULL;
|
||||
cShape->mBoxTranslation = Ogre::Vector3(0,0,0);
|
||||
cShape->mBoxRotation = Ogre::Quaternion::IDENTITY;
|
||||
mShape->mBoxTranslation = Ogre::Vector3(0,0,0);
|
||||
mShape->mBoxRotation = Ogre::Quaternion::IDENTITY;
|
||||
mHasShape = false;
|
||||
|
||||
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
|
||||
// every error as early and intrusively as possible, as it's most
|
||||
// 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 ();
|
||||
if (nif.numRoots() < 1)
|
||||
{
|
||||
|
@ -108,29 +108,29 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||
return;
|
||||
}
|
||||
|
||||
cShape->mHasCollisionNode = hasRootCollisionNode(node);
|
||||
mShape->mHasCollisionNode = hasRootCollisionNode(node);
|
||||
|
||||
//do a first pass
|
||||
handleNode(mesh1, node,0,false,false,false);
|
||||
|
||||
if(mBoundingBox != NULL)
|
||||
{
|
||||
cShape->mCollisionShape = mBoundingBox;
|
||||
mShape->mCollisionShape = mBoundingBox;
|
||||
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
|
||||
delete mesh1;
|
||||
|
||||
//second pass which create a shape for raycasting.
|
||||
resourceName = cShape->getName();
|
||||
cShape->mCollide = false;
|
||||
mResourceName = mShape->getName();
|
||||
mShape->mCollide = false;
|
||||
mBoundingBox = NULL;
|
||||
cShape->mBoxTranslation = Ogre::Vector3(0,0,0);
|
||||
cShape->mBoxRotation = Ogre::Quaternion::IDENTITY;
|
||||
mShape->mBoxTranslation = Ogre::Vector3(0,0,0);
|
||||
mShape->mBoxRotation = Ogre::Quaternion::IDENTITY;
|
||||
mHasShape = false;
|
||||
|
||||
btTriangleMesh* mesh2 = new btTriangleMesh();
|
||||
|
@ -139,12 +139,12 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
|
|||
|
||||
if(mBoundingBox != NULL)
|
||||
{
|
||||
cShape->mRaycastingShape = mBoundingBox;
|
||||
mShape->mRaycastingShape = mBoundingBox;
|
||||
delete mesh2;
|
||||
}
|
||||
else if (mHasShape)
|
||||
{
|
||||
cShape->mRaycastingShape = new TriangleMeshShape(mesh2,true);
|
||||
mShape->mRaycastingShape = new TriangleMeshShape(mesh2,true);
|
||||
}
|
||||
else
|
||||
delete mesh2;
|
||||
|
@ -224,18 +224,18 @@ void ManualBulletShapeLoader::handleNode(btTriangleMesh* mesh, const Nif::Node *
|
|||
}
|
||||
}
|
||||
|
||||
if ( (isCollisionNode || (!cShape->mHasCollisionNode && !raycasting))
|
||||
&& (!isMarker || (cShape->mHasCollisionNode && !raycasting)))
|
||||
if ( (isCollisionNode || (!mShape->mHasCollisionNode && !raycasting))
|
||||
&& (!isMarker || (mShape->mHasCollisionNode && !raycasting)))
|
||||
{
|
||||
if(node->hasBounds)
|
||||
{
|
||||
cShape->mBoxTranslation = node->boundPos;
|
||||
cShape->mBoxRotation = node->boundRot;
|
||||
mShape->mBoxTranslation = node->boundPos;
|
||||
mShape->mBoxRotation = node->boundRot;
|
||||
mBoundingBox = new btBoxShape(getbtVector(node->boundXYZ));
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue