forked from mirror/openmw-tes3mp
update master
This commit is contained in:
commit
d14cc5a435
490 changed files with 15480 additions and 15964 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,3 +13,4 @@ cmake_install.cmake
|
|||
Makefile
|
||||
makefile
|
||||
data
|
||||
*.kdev4
|
||||
|
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "extern/shiny"]
|
||||
path = extern/shiny
|
||||
url = git://github.com/scrawl/shiny.git
|
111
CMakeLists.txt
111
CMakeLists.txt
|
@ -15,7 +15,7 @@ include (OpenMWMacros)
|
|||
# Version
|
||||
|
||||
set (OPENMW_VERSION_MAJOR 0)
|
||||
set (OPENMW_VERSION_MINOR 15)
|
||||
set (OPENMW_VERSION_MINOR 16)
|
||||
set (OPENMW_VERSION_RELEASE 0)
|
||||
|
||||
set (OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
||||
|
@ -37,6 +37,9 @@ option(USE_FFMPEG "use ffmpeg for sound" OFF)
|
|||
option(USE_AUDIERE "use audiere for sound" OFF)
|
||||
option(USE_MPG123 "use mpg123 + libsndfile for sound" ON)
|
||||
|
||||
# OS X deployment
|
||||
option(OPENMW_OSX_DEPLOYMENT OFF)
|
||||
|
||||
find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
|
||||
|
||||
# Location of morrowind data files
|
||||
|
@ -93,9 +96,8 @@ ENDIF()
|
|||
|
||||
set(LIBDIR ${CMAKE_SOURCE_DIR}/libs)
|
||||
|
||||
set(MANGLE_VFS ${LIBDIR}/mangle/vfs/servers/ogre_vfs.cpp)
|
||||
set(MANGLE_INPUT ${LIBDIR}/mangle/input/servers/ois_driver.cpp)
|
||||
set(MANGLE_ALL ${MANGLE_VFS} ${MANGLE_INPUT})
|
||||
set(MANGLE_ALL ${MANGLE_INPUT})
|
||||
source_group(libs\\mangle FILES ${MANGLE_ALL})
|
||||
|
||||
set(OENGINE_OGRE
|
||||
|
@ -187,14 +189,24 @@ if (UNIX AND NOT APPLE)
|
|||
find_package (Threads)
|
||||
endif()
|
||||
|
||||
# find boost without components so we can use Boost_VERSION
|
||||
find_package(Boost REQUIRED)
|
||||
|
||||
set(BOOST_COMPONENTS system filesystem program_options thread)
|
||||
|
||||
if (Boost_VERSION LESS 104900)
|
||||
set(SHINY_USE_WAVE_SYSTEM_INSTALL "TRUE")
|
||||
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} wave)
|
||||
endif()
|
||||
|
||||
find_package(OGRE REQUIRED)
|
||||
find_package(MyGUI REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS system filesystem program_options thread)
|
||||
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
find_package(OIS REQUIRED)
|
||||
find_package(OpenAL REQUIRED)
|
||||
find_package(Bullet REQUIRED)
|
||||
IF(OGRE_STATIC)
|
||||
find_package(Cg REQUIRED)
|
||||
find_package(Cg)
|
||||
IF(WIN32)
|
||||
set(OGRE_PLUGIN_INCLUDE_DIRS ${OGRE_Plugin_CgProgramManager_INCLUDE_DIRS} ${OGRE_Plugin_OctreeSceneManager_INCLUDE_DIRS} ${OGRE_Plugin_ParticleFX_INCLUDE_DIRS} ${OGRE_RenderSystem_Direct3D9_INCLUDE_DIRS} ${OGRE_RenderSystem_GL_INCLUDE_DIRS})
|
||||
ELSE(WIN32)
|
||||
|
@ -221,8 +233,48 @@ if (APPLE)
|
|||
${OGRE_Plugin_OctreeSceneManager_LIBRARY_REL}
|
||||
${OGRE_Plugin_CgProgramManager_LIBRARY_REL}
|
||||
${OGRE_Plugin_ParticleFX_LIBRARY_REL})
|
||||
|
||||
if (${OGRE_PLUGIN_DIR_REL}})
|
||||
set(OGRE_PLUGINS_REL_FOUND TRUE)
|
||||
endif ()
|
||||
|
||||
if (${OGRE_PLUGIN_DIR_DBG})
|
||||
set(OGRE_PLUGINS_DBG_FOUND TRUE)
|
||||
endif ()
|
||||
|
||||
if (${OGRE_PLUGINS_REL_FOUND})
|
||||
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_REL})
|
||||
else ()
|
||||
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_DBG})
|
||||
endif ()
|
||||
|
||||
#set(OGRE_PLUGIN_DIR "${OGRE_PLUGIN_DIR}/")
|
||||
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/mac/Info.plist
|
||||
"${APP_BUNDLE_DIR}/Contents/Info.plist")
|
||||
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/mac/openmw.icns
|
||||
"${APP_BUNDLE_DIR}/Contents/Resources/OpenMW.icns" COPYONLY)
|
||||
endif (APPLE)
|
||||
|
||||
|
||||
# Set up Ogre plugin folder & debug suffix
|
||||
if (APPLE)
|
||||
# Ogre on OS X doesn't use "_d" suffix (see Ogre's CMakeLists.txt)
|
||||
add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="")
|
||||
else ()
|
||||
add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="_d")
|
||||
endif()
|
||||
|
||||
add_definitions(-DOGRE_PLUGIN_DIR_REL="${OGRE_PLUGIN_DIR_REL}")
|
||||
add_definitions(-DOGRE_PLUGIN_DIR_DBG="${OGRE_PLUGIN_DIR_DBG}")
|
||||
if (APPLE AND OPENMW_OSX_DEPLOYMENT)
|
||||
add_definitions(-DOGRE_PLUGIN_DIR="${APP_BUNDLE_NAME}/Contents/Plugins")
|
||||
else()
|
||||
add_definitions(-DOGRE_PLUGIN_DIR="${OGRE_PLUGIN_DIR}")
|
||||
endif()
|
||||
|
||||
|
||||
add_subdirectory(files/)
|
||||
add_subdirectory(files/mygui)
|
||||
|
||||
|
@ -247,53 +299,12 @@ configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg.local
|
|||
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg
|
||||
"${OpenMW_BINARY_DIR}/openmw.cfg.install")
|
||||
|
||||
if (WIN32)
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.win32
|
||||
"${OpenMW_BINARY_DIR}/plugins.cfg" COPYONLY)
|
||||
endif (WIN32)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.linux
|
||||
"${OpenMW_BINARY_DIR}/plugins.cfg")
|
||||
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.desktop
|
||||
"${OpenMW_BINARY_DIR}/openmw.desktop")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
if (${OGRE_PLUGIN_DIR_REL}})
|
||||
set(OGRE_PLUGINS_REL_FOUND TRUE)
|
||||
endif ()
|
||||
|
||||
if (${OGRE_PLUGIN_DIR_DBG})
|
||||
set(OGRE_PLUGINS_DBG_FOUND TRUE)
|
||||
endif ()
|
||||
|
||||
if (${OGRE_PLUGINS_REL_FOUND})
|
||||
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_REL})
|
||||
else ()
|
||||
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_DBG})
|
||||
endif ()
|
||||
|
||||
set(OGRE_PLUGIN_DIR "${OGRE_PLUGIN_DIR}/")
|
||||
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.mac
|
||||
"${OpenMW_BINARY_DIR}/plugins.cfg")
|
||||
|
||||
set(OGRE_PLUGIN_DIR_2 ${OGRE_PLUGIN_DIR})
|
||||
set(OGRE_PLUGIN_DIR "")
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.mac
|
||||
"${OpenMW_BINARY_DIR}/plugins.cfg.install")
|
||||
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_2})
|
||||
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/mac/Info.plist
|
||||
"${APP_BUNDLE_DIR}/Contents/Info.plist")
|
||||
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/mac/openmw.icns
|
||||
"${APP_BUNDLE_DIR}/Contents/Resources/OpenMW.icns" COPYONLY)
|
||||
endif (APPLE)
|
||||
|
||||
|
||||
# Compiler settings
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
add_definitions (-Wall -Wextra -Wno-unused-parameter -Wno-reorder)
|
||||
|
@ -330,7 +341,6 @@ if(DPKG_PROGRAM)
|
|||
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}/plugins.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||
|
||||
#Install resources
|
||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "share/games/openmw/" FILE_PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT "Resources")
|
||||
|
@ -347,7 +357,7 @@ if(DPKG_PROGRAM)
|
|||
SET(CPACK_DEBIAN_PACKAGE_NAME "openmw")
|
||||
SET(CPACK_DEBIAN_PACKAGE_VERSION "${VERSION_STRING}")
|
||||
SET(CPACK_PACKAGE_EXECUTABLES "openmw;OpenMW esmtool;Esmtool omwlauncher;OMWLauncher mwiniimporter;MWiniImporter")
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "nvidia-cg-toolkit (>= 2.1), libboost-filesystem1.46.1 (>= 1.46.1), libboost-program-options1.46.1 (>= 1.46.1), libboost-system1.46.1 (>= 1.46.1), libboost-thread1.46.1 (>= 1.46.1), libc6 (>= 2.11.2), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libmpg123-0 (>= 1.12.1), libois-1.3.0 (>= 1.3.0), 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_DEPENDS "libboost-filesystem1.46.1 (>= 1.46.1), libboost-program-options1.46.1 (>= 1.46.1), libboost-system1.46.1 (>= 1.46.1), libboost-thread1.46.1 (>= 1.46.1), libc6 (>= 2.11.2), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libmpg123-0 (>= 1.12.1), libois-1.3.0 (>= 1.3.0), 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")
|
||||
|
||||
|
@ -368,7 +378,6 @@ if(WIN32)
|
|||
INSTALL(FILES ${dll_files} DESTINATION ".")
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg")
|
||||
INSTALL(FILES
|
||||
"${OpenMW_BINARY_DIR}/plugins.cfg"
|
||||
"${OpenMW_SOURCE_DIR}/readme.txt"
|
||||
"${OpenMW_SOURCE_DIR}/GPL3.txt"
|
||||
"${OpenMW_SOURCE_DIR}/OFL.txt"
|
||||
|
@ -432,6 +441,9 @@ if(WIN32)
|
|||
include(CPack)
|
||||
endif(WIN32)
|
||||
|
||||
# Extern
|
||||
add_subdirectory (extern/shiny)
|
||||
|
||||
# Components
|
||||
add_subdirectory (components)
|
||||
|
||||
|
@ -537,7 +549,6 @@ if (APPLE)
|
|||
install(DIRECTORY "${APP_BUNDLE_DIR}" USE_SOURCE_PERMISSIONS DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
install(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
install(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" RENAME "openmw.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
install(FILES "${OpenMW_BINARY_DIR}/plugins.cfg.install" RENAME "plugins.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
install(FILES "${OpenMW_BINARY_DIR}/launcher.qss" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
|
||||
install(FILES "${OpenMW_BINARY_DIR}/settings-default.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
|
|
|
@ -187,7 +187,7 @@ int main(int argc, char**argv)
|
|||
case REC_ALCH:
|
||||
{
|
||||
Potion p;
|
||||
p.load(esm);
|
||||
p.load(esm, id);
|
||||
if(quiet) break;
|
||||
cout << " Name: " << p.name << endl;
|
||||
break;
|
||||
|
|
|
@ -140,7 +140,7 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, QWidget *parent)
|
|||
|
||||
createActions();
|
||||
setupConfig();
|
||||
setupDataFiles();
|
||||
//setupDataFiles();
|
||||
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ void DataFilesPage::setupConfig()
|
|||
}
|
||||
|
||||
|
||||
void DataFilesPage::setupDataFiles()
|
||||
bool DataFilesPage::setupDataFiles()
|
||||
{
|
||||
// We use the Configuration Manager to retrieve the configuration values
|
||||
boost::program_options::variables_map variables;
|
||||
|
@ -245,21 +245,15 @@ void DataFilesPage::setupDataFiles()
|
|||
mCfgMgr.processPaths(mDataDirs);
|
||||
} else {
|
||||
// Cancel from within the dir selection dialog
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
// Cancel
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if cancel was clicked because we can't exit from while loop
|
||||
if (mDataDirs.empty()) {
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a file collection for the data dirs
|
||||
Files::Collections fileCollections(mDataDirs, !variables["fs-strict"].as<bool>());
|
||||
|
||||
|
@ -362,6 +356,7 @@ void DataFilesPage::setupDataFiles()
|
|||
}
|
||||
|
||||
readConfig();
|
||||
return true;
|
||||
}
|
||||
|
||||
void DataFilesPage::createActions()
|
||||
|
@ -1076,7 +1071,7 @@ void DataFilesPage::writeConfig(QString profile)
|
|||
Please make sure you have the right permissions and try again.<br>").arg(pathStr));
|
||||
msgBox.exec();
|
||||
|
||||
qApp->exit(1);
|
||||
qApp->quit();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1093,7 +1088,7 @@ void DataFilesPage::writeConfig(QString profile)
|
|||
Please make sure you have the right permissions and try again.<br>").arg(file.fileName()));
|
||||
msgBox.exec();
|
||||
|
||||
qApp->exit(1);
|
||||
qApp->quit();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1124,7 +1119,7 @@ void DataFilesPage::writeConfig(QString profile)
|
|||
Please make sure you have the right permissions and try again.<br>").arg(file.fileName()));
|
||||
msgBox.exec();
|
||||
|
||||
qApp->exit(1);
|
||||
qApp->quit();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
ComboBox *mProfilesComboBox;
|
||||
|
||||
void writeConfig(QString profile = QString());
|
||||
bool setupDataFiles();
|
||||
|
||||
public slots:
|
||||
void masterSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||
|
@ -92,7 +93,6 @@ private:
|
|||
void removePlugins(const QModelIndex &index);
|
||||
void uncheckPlugins();
|
||||
void createActions();
|
||||
void setupDataFiles();
|
||||
void setupConfig();
|
||||
void readConfig();
|
||||
void scrollToSelection();
|
||||
|
|
|
@ -28,13 +28,13 @@ QString FileDialog::getExistingDirectory(QWidget *parent,
|
|||
// create a non-native file dialog
|
||||
FileDialog dialog;
|
||||
dialog.setFileMode(DirectoryOnly);
|
||||
dialog.setOptions(options & (DontUseNativeDialog | ShowDirsOnly));
|
||||
dialog.setOptions(options |= QFileDialog::DontUseNativeDialog | QFileDialog::ShowDirsOnly | QFileDialog::ReadOnly);
|
||||
|
||||
if (!caption.isEmpty())
|
||||
dialog.setWindowTitle(caption);
|
||||
|
||||
if (!dir.isEmpty())
|
||||
dialog.setDirectory(dir);
|
||||
dialog.setDirectory(dir);
|
||||
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
return dialog.selectedFiles().value(0);
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
#include "graphicspage.hpp"
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <boost/math/common_factor.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
#include <components/files/ogreplugin.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "graphicspage.hpp"
|
||||
#include "naturalsort.hpp"
|
||||
|
||||
QString getAspect(int x, int y)
|
||||
{
|
||||
int gcd = boost::math::gcd (x, y);
|
||||
int xaspect = x / gcd;
|
||||
int yaspect = y / gcd;
|
||||
// special case: 8 : 5 is usually referred to as 16:10
|
||||
if (xaspect == 8 && yaspect == 5)
|
||||
return QString("16:10");
|
||||
|
||||
return QString(QString::number(xaspect) + ":" + QString::number(yaspect));
|
||||
}
|
||||
|
||||
GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, mCfgMgr(cfg)
|
||||
|
@ -21,83 +38,49 @@ GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, QWidget *parent)
|
|||
renderSystemLayout->addWidget(rendererLabel, 0, 0, 1, 1);
|
||||
renderSystemLayout->addWidget(mRendererComboBox, 0, 1, 1, 1);
|
||||
|
||||
QVBoxLayout *rendererGroupLayout = new QVBoxLayout(rendererGroup);
|
||||
|
||||
rendererGroupLayout->addLayout(renderSystemLayout);
|
||||
|
||||
// Display
|
||||
QGroupBox *displayGroup = new QGroupBox(tr("Display"), this);
|
||||
|
||||
mDisplayStackedWidget = new QStackedWidget(displayGroup);
|
||||
mVSyncCheckBox = new QCheckBox(tr("Vertical Sync"), displayGroup);
|
||||
mFullScreenCheckBox = new QCheckBox(tr("Full Screen"), displayGroup);
|
||||
|
||||
QVBoxLayout *displayGroupLayout = new QVBoxLayout(displayGroup);
|
||||
QSpacerItem *vSpacer3 = new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
QLabel *antiAliasingLabel = new QLabel(tr("Antialiasing:"), displayGroup);
|
||||
QLabel *resolutionLabel = new QLabel(tr("Resolution:"), displayGroup);
|
||||
|
||||
displayGroupLayout->addWidget(mDisplayStackedWidget);
|
||||
displayGroupLayout->addItem(vSpacer3);
|
||||
mResolutionComboBox = new QComboBox(displayGroup);
|
||||
mAntiAliasingComboBox = new QComboBox(displayGroup);
|
||||
|
||||
QVBoxLayout *rendererGroupLayout = new QVBoxLayout(rendererGroup);
|
||||
rendererGroupLayout->addLayout(renderSystemLayout);
|
||||
|
||||
QGridLayout *displayGroupLayout = new QGridLayout(displayGroup);
|
||||
displayGroupLayout->addWidget(mVSyncCheckBox, 0, 0, 1, 1);
|
||||
displayGroupLayout->addWidget(mFullScreenCheckBox, 1, 0, 1, 1);
|
||||
displayGroupLayout->addWidget(antiAliasingLabel, 2, 0, 1, 1);
|
||||
displayGroupLayout->addWidget(mAntiAliasingComboBox, 2, 1, 1, 1);
|
||||
displayGroupLayout->addWidget(resolutionLabel, 3, 0, 1, 1);
|
||||
displayGroupLayout->addWidget(mResolutionComboBox, 3, 1, 1, 1);
|
||||
|
||||
// Layout for the whole page
|
||||
QVBoxLayout *pageLayout = new QVBoxLayout(this);
|
||||
QSpacerItem *vSpacer1 = new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
|
||||
pageLayout->addWidget(rendererGroup);
|
||||
pageLayout->addWidget(displayGroup);
|
||||
pageLayout->addItem(vSpacer1);
|
||||
|
||||
connect(mRendererComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(rendererChanged(const QString&)));
|
||||
|
||||
createPages();
|
||||
setupConfig();
|
||||
setupOgre();
|
||||
|
||||
readConfig();
|
||||
}
|
||||
|
||||
void GraphicsPage::createPages()
|
||||
bool GraphicsPage::setupOgre()
|
||||
{
|
||||
QWidget *main = new QWidget();
|
||||
QGridLayout *grid = new QGridLayout(main);
|
||||
|
||||
mVSyncCheckBox = new QCheckBox(tr("Vertical Sync"), main);
|
||||
grid->addWidget(mVSyncCheckBox, 0, 0, 1, 1);
|
||||
|
||||
mFullScreenCheckBox = new QCheckBox(tr("Full Screen"), main);
|
||||
grid->addWidget(mFullScreenCheckBox, 1, 0, 1, 1);
|
||||
|
||||
QLabel *antiAliasingLabel = new QLabel(tr("Antialiasing:"), main);
|
||||
mAntiAliasingComboBox = new QComboBox(main);
|
||||
grid->addWidget(antiAliasingLabel, 2, 0, 1, 1);
|
||||
grid->addWidget(mAntiAliasingComboBox, 2, 1, 1, 1);
|
||||
|
||||
QLabel *resolutionLabel = new QLabel(tr("Resolution:"), main);
|
||||
mResolutionComboBox = new QComboBox(main);
|
||||
grid->addWidget(resolutionLabel, 3, 0, 1, 1);
|
||||
grid->addWidget(mResolutionComboBox, 3, 1, 1, 1);
|
||||
|
||||
QSpacerItem *vSpacer1 = new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
grid->addItem(vSpacer1, 4, 0, 1, 1);
|
||||
|
||||
mDisplayStackedWidget->addWidget(main);
|
||||
}
|
||||
|
||||
void GraphicsPage::setupConfig()
|
||||
{
|
||||
}
|
||||
|
||||
void GraphicsPage::setupOgre()
|
||||
{
|
||||
QString pluginCfg = mCfgMgr.getPluginsConfigPath().string().c_str();
|
||||
QFile file(pluginCfg);
|
||||
|
||||
// Create a log manager so we can surpress debug text to stdout/stderr
|
||||
Ogre::LogManager* logMgr = OGRE_NEW Ogre::LogManager;
|
||||
logMgr->createLog((mCfgMgr.getLogPath().string() + "/launcherOgre.log"), true, false, false);
|
||||
|
||||
try
|
||||
{
|
||||
#if defined(ENABLE_PLUGIN_GL) || defined(ENABLE_PLUGIN_Direct3D9)
|
||||
mOgre = new Ogre::Root("", "", "./launcherOgre.log");
|
||||
#else
|
||||
mOgre = new Ogre::Root(pluginCfg.toStdString(), "", "./launcherOgre.log");
|
||||
#endif
|
||||
}
|
||||
catch(Ogre::Exception &ex)
|
||||
{
|
||||
|
@ -107,25 +90,47 @@ void GraphicsPage::setupOgre()
|
|||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(tr("<br><b>Failed to create the Ogre::Root object</b><br><br> \
|
||||
Make sure the plugins.cfg is present and valid.<br><br> \
|
||||
Press \"Show Details...\" for more information.<br>"));
|
||||
msgBox.setDetailedText(ogreError);
|
||||
msgBox.exec();
|
||||
|
||||
qCritical("Error creating Ogre::Root, the error reported was:\n %s", qPrintable(ogreError));
|
||||
|
||||
qApp->exit(1);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_PLUGIN_GL
|
||||
mGLPlugin = new Ogre::GLPlugin();
|
||||
mOgre->installPlugin(mGLPlugin);
|
||||
#endif
|
||||
#ifdef ENABLE_PLUGIN_Direct3D9
|
||||
mD3D9Plugin = new Ogre::D3D9Plugin();
|
||||
mOgre->installPlugin(mD3D9Plugin);
|
||||
#endif
|
||||
|
||||
std::string pluginDir;
|
||||
const char* pluginEnv = getenv("OPENMW_OGRE_PLUGIN_DIR");
|
||||
if (pluginEnv)
|
||||
pluginDir = pluginEnv;
|
||||
else
|
||||
{
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
||||
pluginDir = ".\\";
|
||||
#endif
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
pluginDir = OGRE_PLUGIN_DIR;
|
||||
#endif
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
|
||||
pluginDir = OGRE_PLUGIN_DIR_REL;
|
||||
#endif
|
||||
}
|
||||
|
||||
boost::filesystem::path absPluginPath = boost::filesystem::absolute(boost::filesystem::path(pluginDir));
|
||||
|
||||
pluginDir = absPluginPath.string();
|
||||
|
||||
Files::loadOgrePlugin(pluginDir, "RenderSystem_GL", *mOgre);
|
||||
Files::loadOgrePlugin(pluginDir, "RenderSystem_Direct3D9", *mOgre);
|
||||
|
||||
#ifdef ENABLE_PLUGIN_GL
|
||||
mGLPlugin = new Ogre::GLPlugin();
|
||||
mOgre->installPlugin(mGLPlugin);
|
||||
#endif
|
||||
#ifdef ENABLE_PLUGIN_Direct3D9
|
||||
mD3D9Plugin = new Ogre::D3D9Plugin();
|
||||
mOgre->installPlugin(mD3D9Plugin);
|
||||
#endif
|
||||
|
||||
// Get the available renderers and put them in the combobox
|
||||
const Ogre::RenderSystemList &renderers = mOgre->getAvailableRenderers();
|
||||
|
@ -135,6 +140,26 @@ void GraphicsPage::setupOgre()
|
|||
mRendererComboBox->addItem((*r)->getName().c_str());
|
||||
}
|
||||
|
||||
QString openGLName = QString("OpenGL Rendering Subsystem");
|
||||
QString direct3DName = QString("Direct3D9 Rendering Subsystem");
|
||||
|
||||
// Create separate rendersystems
|
||||
mOpenGLRenderSystem = mOgre->getRenderSystemByName(openGLName.toStdString());
|
||||
mDirect3DRenderSystem = mOgre->getRenderSystemByName(direct3DName.toStdString());
|
||||
|
||||
if (!mOpenGLRenderSystem && !mDirect3DRenderSystem) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle(tr("Error creating renderer"));
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(tr("<br><b>Could not select a valid render system</b><br><br> \
|
||||
Please make sure the plugins.cfg file exists and contains a valid rendering plugin.<br>"));
|
||||
msgBox.exec();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now fill the GUI elements
|
||||
int index = mRendererComboBox->findText(QString::fromStdString(Settings::Manager::getString("render system", "Video")));
|
||||
|
||||
if ( index != -1) {
|
||||
|
@ -143,37 +168,19 @@ void GraphicsPage::setupOgre()
|
|||
else
|
||||
{
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
||||
mRendererComboBox->setCurrentIndex(mRendererComboBox->findText("Direct3D9 Rendering Subsystem"));
|
||||
mRendererComboBox->setCurrentIndex(mRendererComboBox->findText(direct3DName));
|
||||
#else
|
||||
mRendererComboBox->setCurrentIndex(mRendererComboBox->findText("OpenGL Rendering Subsystem"));
|
||||
mRendererComboBox->setCurrentIndex(mRendererComboBox->findText(openGLName));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Create separate rendersystems
|
||||
QString openGLName = mRendererComboBox->itemText(mRendererComboBox->findText(QString("OpenGL"), Qt::MatchStartsWith));
|
||||
QString direct3DName = mRendererComboBox->itemText(mRendererComboBox->findText(QString("Direct3D"), Qt::MatchStartsWith));
|
||||
|
||||
mOpenGLRenderSystem = mOgre->getRenderSystemByName(openGLName.toStdString());
|
||||
mDirect3DRenderSystem = mOgre->getRenderSystemByName(direct3DName.toStdString());
|
||||
|
||||
if (!mOpenGLRenderSystem && !mDirect3DRenderSystem) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("Error creating renderer");
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(tr("<br><b>Could not select a valid render system</b><br><br> \
|
||||
Please make sure the plugins.cfg file exists and contains a valid rendering plugin.<br>"));
|
||||
msgBox.exec();
|
||||
|
||||
qApp->exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
// Now fill the GUI elements
|
||||
mAntiAliasingComboBox->clear();
|
||||
mResolutionComboBox->clear();
|
||||
mAntiAliasingComboBox->addItems(getAvailableOptions(QString("FSAA"), mSelectedRenderSystem));
|
||||
mResolutionComboBox->addItems(getAvailableOptions(QString("Video Mode"), mSelectedRenderSystem));
|
||||
mResolutionComboBox->addItems(getAvailableResolutions(mSelectedRenderSystem));
|
||||
|
||||
readConfig();
|
||||
return true;
|
||||
}
|
||||
|
||||
void GraphicsPage::readConfig()
|
||||
|
@ -188,9 +195,10 @@ void GraphicsPage::readConfig()
|
|||
if (aaIndex != -1)
|
||||
mAntiAliasingComboBox->setCurrentIndex(aaIndex);
|
||||
|
||||
std::string resolution = boost::lexical_cast<std::string>(Settings::Manager::getInt("resolution x", "Video"))
|
||||
+ " x " + boost::lexical_cast<std::string>(Settings::Manager::getInt("resolution y", "Video"));
|
||||
int resIndex = mResolutionComboBox->findText(QString::fromStdString(resolution));
|
||||
QString resolution = QString::number(Settings::Manager::getInt("resolution x", "Video"));
|
||||
resolution.append(" x " + QString::number(Settings::Manager::getInt("resolution y", "Video")));
|
||||
|
||||
int resIndex = mResolutionComboBox->findText(resolution, Qt::MatchStartsWith);
|
||||
if (resIndex != -1)
|
||||
mResolutionComboBox->setCurrentIndex(resIndex);
|
||||
}
|
||||
|
@ -202,11 +210,12 @@ void GraphicsPage::writeConfig()
|
|||
Settings::Manager::setString("antialiasing", "Video", mAntiAliasingComboBox->currentText().toStdString());
|
||||
Settings::Manager::setString("render system", "Video", mRendererComboBox->currentText().toStdString());
|
||||
|
||||
// parse resolution x and y from a string like "800 x 600"
|
||||
QString resolution = mResolutionComboBox->currentText();
|
||||
// Get the current resolution, but with the tabs replaced with a single space
|
||||
QString resolution = mResolutionComboBox->currentText().simplified();
|
||||
QStringList tokens = resolution.split(" ", QString::SkipEmptyParts);
|
||||
int resX = boost::lexical_cast<int>(tokens.at(0).toStdString());
|
||||
int resY = boost::lexical_cast<int>(tokens.at(2).toStdString());
|
||||
|
||||
int resX = tokens.at(0).toInt();
|
||||
int resY = tokens.at(2).toInt();
|
||||
Settings::Manager::setInt("resolution x", "Video", resX);
|
||||
Settings::Manager::setInt("resolution y", "Video", resY);
|
||||
}
|
||||
|
@ -228,15 +237,21 @@ QStringList GraphicsPage::getAvailableOptions(const QString &key, Ogre::RenderSy
|
|||
|
||||
if (strcmp (key.toStdString().c_str(), i->first.c_str()) == 0)
|
||||
{
|
||||
if (key == "FSAA" && *opt_it == "0")
|
||||
result << QString("none");
|
||||
else
|
||||
result << ((key == "FSAA") ? QString("MSAA ") : QString("")) + QString::fromStdString((*opt_it).c_str()).simplified();
|
||||
result << ((key == "FSAA") ? QString("MSAA ") : QString("")) + QString::fromStdString((*opt_it).c_str()).simplified();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Sort ascending
|
||||
qSort(result.begin(), result.end(), naturalSortLessThanCI);
|
||||
|
||||
// Replace the zero option with Off
|
||||
int index = result.indexOf("MSAA 0");
|
||||
|
||||
if (index != -1)
|
||||
result.replace(index, tr("Off"));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -255,24 +270,36 @@ QStringList GraphicsPage::getAvailableResolutions(Ogre::RenderSystem *renderer)
|
|||
|
||||
Ogre::StringVector::iterator opt_it;
|
||||
uint idx = 0;
|
||||
|
||||
for (opt_it = i->second.possibleValues.begin ();
|
||||
opt_it != i->second.possibleValues.end (); opt_it++, idx++)
|
||||
opt_it != i->second.possibleValues.end (); opt_it++, idx++)
|
||||
{
|
||||
QString qval = QString::fromStdString(*opt_it).simplified();
|
||||
// remove extra tokens after the resolution (for example bpp, can be there or not depending on rendersystem)
|
||||
QStringList tokens = qval.split(" ", QString::SkipEmptyParts);
|
||||
assert (tokens.size() >= 3);
|
||||
QString resolutionStr = tokens.at(0) + QString(" x ") + tokens.at(2);
|
||||
{
|
||||
|
||||
// do not add duplicate resolutions
|
||||
if (!result.contains(resolutionStr))
|
||||
result << resolutionStr;
|
||||
// do not add duplicate resolutions
|
||||
if (!result.contains(resolutionStr)) {
|
||||
|
||||
QString aspect = getAspect(tokens.at(0).toInt(),tokens.at(2).toInt());
|
||||
|
||||
if (aspect == QLatin1String("16:9") || aspect == QLatin1String("16:10")) {
|
||||
resolutionStr.append(tr("\t(Widescreen ") + aspect + ")");
|
||||
|
||||
} else if (aspect == QLatin1String("4:3")) {
|
||||
resolutionStr.append(tr("\t(Standard 4:3)"));
|
||||
}
|
||||
|
||||
result << resolutionStr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Sort the resolutions in descending order
|
||||
qSort(result.begin(), result.end(), naturalSortGreaterThanCI);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ class GraphicsPage : public QWidget
|
|||
public:
|
||||
GraphicsPage(Files::ConfigurationManager &cfg, QWidget *parent = 0);
|
||||
|
||||
bool setupOgre();
|
||||
void writeConfig();
|
||||
|
||||
public slots:
|
||||
|
@ -62,8 +63,6 @@ private:
|
|||
QStringList getAvailableResolutions(Ogre::RenderSystem *renderer);
|
||||
|
||||
void createPages();
|
||||
void setupConfig();
|
||||
void setupOgre();
|
||||
void readConfig();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "maindialog.hpp"
|
||||
|
||||
|
@ -32,9 +31,13 @@ int main(int argc, char *argv[])
|
|||
QDir::setCurrent(dir.absolutePath());
|
||||
|
||||
MainDialog mainWin;
|
||||
mainWin.show();
|
||||
|
||||
return app.exec();
|
||||
if (mainWin.setup()) {
|
||||
|
||||
mainWin.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,28 +7,6 @@
|
|||
|
||||
MainDialog::MainDialog()
|
||||
{
|
||||
// Create the settings manager and load default settings file
|
||||
const std::string localdefault = mCfgMgr.getLocalPath().string() + "/settings-default.cfg";
|
||||
const std::string globaldefault = mCfgMgr.getGlobalPath().string() + "/settings-default.cfg";
|
||||
|
||||
// prefer local
|
||||
if (boost::filesystem::exists(localdefault))
|
||||
mSettings.loadDefault(localdefault);
|
||||
else if (boost::filesystem::exists(globaldefault))
|
||||
mSettings.loadDefault(globaldefault);
|
||||
else
|
||||
throw std::runtime_error ("No default settings file found! Make sure the file \"settings-default.cfg\" was properly installed.");
|
||||
|
||||
// load user settings if they exist, otherwise just load the default settings as user settings
|
||||
const std::string settingspath = mCfgMgr.getUserPath().string() + "/settings.cfg";
|
||||
if (boost::filesystem::exists(settingspath))
|
||||
mSettings.loadUser(settingspath);
|
||||
else if (boost::filesystem::exists(localdefault))
|
||||
mSettings.loadUser(localdefault);
|
||||
else if (boost::filesystem::exists(globaldefault))
|
||||
mSettings.loadUser(globaldefault);
|
||||
|
||||
|
||||
QWidget *centralWidget = new QWidget(this);
|
||||
setCentralWidget(centralWidget);
|
||||
|
||||
|
@ -72,22 +50,22 @@ MainDialog::MainDialog()
|
|||
// Install the stylesheet font
|
||||
QFile file;
|
||||
QFontDatabase fontDatabase;
|
||||
|
||||
|
||||
const QStringList fonts = fontDatabase.families();
|
||||
|
||||
|
||||
// Check if the font is installed
|
||||
if (!fonts.contains("EB Garamond")) {
|
||||
|
||||
|
||||
QString font = QString::fromStdString((mCfgMgr.getGlobalDataPath() / "resources/mygui/EBGaramond-Regular.ttf").string());
|
||||
file.setFileName(font);
|
||||
|
||||
|
||||
if (!file.exists()) {
|
||||
font = QString::fromStdString((mCfgMgr.getLocalPath() / "resources/mygui/EBGaramond-Regular.ttf").string());
|
||||
font = QString::fromStdString((mCfgMgr.getLocalPath() / "resources/mygui/EBGaramond-Regular.ttf").string());
|
||||
}
|
||||
|
||||
|
||||
fontDatabase.addApplicationFont(font);
|
||||
}
|
||||
|
||||
|
||||
// Load the stylesheet
|
||||
QString config = QString::fromStdString((mCfgMgr.getGlobalDataPath() / "resources/launcher.qss").string());
|
||||
file.setFileName(config);
|
||||
|
@ -101,7 +79,6 @@ MainDialog::MainDialog()
|
|||
qApp->setStyleSheet(styleSheet);
|
||||
file.close();
|
||||
|
||||
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(play()));
|
||||
|
||||
|
@ -172,6 +149,53 @@ void MainDialog::createPages()
|
|||
|
||||
}
|
||||
|
||||
|
||||
bool MainDialog::setup()
|
||||
{
|
||||
// Create the settings manager and load default settings file
|
||||
const std::string localdefault = (mCfgMgr.getLocalPath() / "settings-default.cfg").string();
|
||||
const std::string globaldefault = (mCfgMgr.getGlobalPath() / "settings-default.cfg").string();
|
||||
|
||||
// prefer local
|
||||
if (boost::filesystem::exists(localdefault)) {
|
||||
mSettings.loadDefault(localdefault);
|
||||
} else if (boost::filesystem::exists(globaldefault)) {
|
||||
mSettings.loadDefault(globaldefault);
|
||||
} else {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("Error reading OpenMW configuration file");
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(tr("<br><b>Could not find %0</b><br><br> \
|
||||
The problem may be due to an incomplete installation of OpenMW.<br> \
|
||||
Reinstalling OpenMW may resolve the problem.").arg(QString::fromStdString(globaldefault)));
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
|
||||
// load user settings if they exist, otherwise just load the default settings as user settings
|
||||
const std::string settingspath = (mCfgMgr.getUserPath() / "settings.cfg").string();
|
||||
|
||||
if (boost::filesystem::exists(settingspath))
|
||||
mSettings.loadUser(settingspath);
|
||||
else if (boost::filesystem::exists(localdefault))
|
||||
mSettings.loadUser(localdefault);
|
||||
else if (boost::filesystem::exists(globaldefault))
|
||||
mSettings.loadUser(globaldefault);
|
||||
|
||||
// Setup the Graphics page
|
||||
if (!mGraphicsPage->setupOgre()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Setup the Data Files page
|
||||
if (!mDataFilesPage->setupDataFiles()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainDialog::profileChanged(int index)
|
||||
{
|
||||
// Just to be sure, should always have a selection
|
||||
|
@ -204,7 +228,7 @@ void MainDialog::closeEvent(QCloseEvent *event)
|
|||
mGraphicsPage->writeConfig();
|
||||
|
||||
// Save user settings
|
||||
const std::string settingspath = mCfgMgr.getUserPath().string() + "/settings.cfg";
|
||||
const std::string settingspath = (mCfgMgr.getUserPath() / "settings.cfg").string();
|
||||
mSettings.saveUser(settingspath);
|
||||
|
||||
event->accept();
|
||||
|
@ -216,6 +240,10 @@ void MainDialog::play()
|
|||
mDataFilesPage->writeConfig();
|
||||
mGraphicsPage->writeConfig();
|
||||
|
||||
// Save user settings
|
||||
const std::string settingspath = (mCfgMgr.getUserPath() / "settings.cfg").string();
|
||||
mSettings.saveUser(settingspath);
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
QString game = "./openmw.exe";
|
||||
QFile file(game);
|
||||
|
@ -248,7 +276,7 @@ void MainDialog::play()
|
|||
if (!info.isExecutable()) {
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowTitle("Error starting OpenMW");
|
||||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(tr("<br><b>Could not start OpenMW</b><br><br> \
|
||||
The OpenMW application is not executable.<br> \
|
||||
|
@ -272,6 +300,7 @@ void MainDialog::play()
|
|||
|
||||
return;
|
||||
} else {
|
||||
close();
|
||||
qApp->quit();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ public slots:
|
|||
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
void play();
|
||||
void profileChanged(int index);
|
||||
bool setup();
|
||||
|
||||
private:
|
||||
void createIcons();
|
||||
|
|
|
@ -93,3 +93,13 @@ bool naturalSortLessThanCI( const QString &left, const QString &right )
|
|||
{
|
||||
return (naturalCompare( left, right, Qt::CaseInsensitive ) < 0);
|
||||
}
|
||||
|
||||
bool naturalSortGreaterThanCS( const QString &left, const QString &right )
|
||||
{
|
||||
return (naturalCompare( left, right, Qt::CaseSensitive ) > 0);
|
||||
}
|
||||
|
||||
bool naturalSortGreaterThanCI( const QString &left, const QString &right )
|
||||
{
|
||||
return (naturalCompare( left, right, Qt::CaseInsensitive ) > 0);
|
||||
}
|
||||
|
|
|
@ -5,5 +5,7 @@
|
|||
|
||||
bool naturalSortLessThanCS( const QString &left, const QString &right );
|
||||
bool naturalSortLessThanCI( const QString &left, const QString &right );
|
||||
bool naturalSortGreaterThanCS( const QString &left, const QString &right );
|
||||
bool naturalSortGreaterThanCI( const QString &left, const QString &right );
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#include <QDebug>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "pluginsview.hpp"
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 63 KiB |
Binary file not shown.
Before Width: | Height: | Size: 231 KiB After Width: | Height: | Size: 236 KiB |
|
@ -15,42 +15,43 @@ source_group(game FILES ${GAME} ${GAME_HEADER})
|
|||
|
||||
add_openmw_dir (mwrender
|
||||
renderingmanager debugging sky player animation npcanimation creatureanimation actors objects
|
||||
renderinginterface localmap occlusionquery terrain terrainmaterial water shadows shaderhelper
|
||||
renderinginterface localmap occlusionquery terrain terrainmaterial water shadows
|
||||
compositors
|
||||
)
|
||||
|
||||
add_openmw_dir (mwinput
|
||||
inputmanager
|
||||
inputmanagerimp
|
||||
mouselookevent
|
||||
)
|
||||
|
||||
add_openmw_dir (mwgui
|
||||
text_input widgets race class birth review window_manager console dialogue
|
||||
text_input widgets race class birth review windowmanagerimp console dialogue
|
||||
dialogue_history window_base stats_window messagebox journalwindow charactercreation
|
||||
map_window window_pinnable_base cursorreplace tooltips scrollwindow bookwindow list
|
||||
formatting inventorywindow container hud countdialog tradewindow settingswindow
|
||||
confirmationdialog alchemywindow referenceinterface spellwindow
|
||||
confirmationdialog alchemywindow referenceinterface spellwindow mainmenu
|
||||
)
|
||||
|
||||
add_openmw_dir (mwdialogue
|
||||
dialoguemanager journal journalentry quest topic
|
||||
dialoguemanagerimp journalimp journalentry quest topic
|
||||
)
|
||||
|
||||
add_openmw_dir (mwscript
|
||||
locals scriptmanager compilercontext interpretercontext cellextensions miscextensions
|
||||
locals scriptmanagerimp compilercontext interpretercontext cellextensions miscextensions
|
||||
guiextensions soundextensions skyextensions statsextensions containerextensions
|
||||
aiextensions controlextensions extensions globalscripts ref dialogueextensions
|
||||
animationextensions
|
||||
animationextensions transformationextensions consoleextensions userextensions
|
||||
)
|
||||
|
||||
add_openmw_dir (mwsound
|
||||
soundmanager openal_output audiere_decoder mpgsnd_decoder ffmpeg_decoder
|
||||
soundmanagerimp openal_output audiere_decoder mpgsnd_decoder ffmpeg_decoder
|
||||
)
|
||||
|
||||
add_openmw_dir (mwworld
|
||||
refdata world physicssystem scene globals class action nullaction actionteleport
|
||||
refdata worldimp physicssystem scene globals class action nullaction actionteleport
|
||||
containerstore actiontalk actiontake manualref player cellfunctors
|
||||
cells localscripts customdata weather inventorystore ptr actionopen actionread
|
||||
actionequip timestamp actionalchemy
|
||||
actionequip timestamp actionalchemy cellstore actionapply
|
||||
)
|
||||
|
||||
add_openmw_dir (mwclass
|
||||
|
@ -59,12 +60,13 @@ add_openmw_dir (mwclass
|
|||
)
|
||||
|
||||
add_openmw_dir (mwmechanics
|
||||
mechanicsmanager stat creaturestats magiceffects movement actors drawstate spells
|
||||
activespells
|
||||
mechanicsmanagerimp stat creaturestats magiceffects movement actors drawstate spells
|
||||
activespells npcstats
|
||||
)
|
||||
|
||||
add_openmw_dir (mwbase
|
||||
environment
|
||||
environment world scriptmanager dialoguemanager journal soundmanager mechanicsmanager
|
||||
inputmanager windowmanager
|
||||
)
|
||||
|
||||
# Main executable
|
||||
|
@ -79,7 +81,6 @@ ENDIF(WIN32)
|
|||
ENDIF(OGRE_STATIC)
|
||||
add_executable(openmw
|
||||
${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
|
||||
${COMPONENT_FILES}
|
||||
${OPENMW_FILES}
|
||||
${GAME} ${GAME_HEADER}
|
||||
${APPLE_BUNDLE_RESOURCES}
|
||||
|
@ -101,6 +102,8 @@ target_link_libraries(openmw
|
|||
${BULLET_LIBRARIES}
|
||||
${MYGUI_LIBRARIES}
|
||||
${MYGUI_PLATFORM_LIBRARIES}
|
||||
"shiny"
|
||||
"shiny.OgrePlatform"
|
||||
components
|
||||
)
|
||||
|
||||
|
|
|
@ -1,56 +1,38 @@
|
|||
#include "engine.hpp"
|
||||
#include "components/esm/loadcell.hpp"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
#include <OgreRoot.h>
|
||||
#include <OgreRenderWindow.h>
|
||||
|
||||
#include <MyGUI_WidgetManager.h>
|
||||
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
#include <openengine/gui/manager.hpp>
|
||||
|
||||
#include <components/esm/records.hpp>
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
#include <components/bsa/bsa_archive.hpp>
|
||||
#include <components/esm/esm_reader.hpp>
|
||||
#include <components/files/fixedpath.hpp>
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
#include <components/nifoverrides/nifoverrides.hpp>
|
||||
|
||||
#include <components/nifbullet/bullet_nif_loader.hpp>
|
||||
#include <components/nifogre/ogre_nif_loader.hpp>
|
||||
|
||||
#include "mwinput/inputmanager.hpp"
|
||||
#include "mwinput/inputmanagerimp.hpp"
|
||||
|
||||
#include "mwgui/window_manager.hpp"
|
||||
#include "mwgui/windowmanagerimp.hpp"
|
||||
#include "mwgui/cursorreplace.hpp"
|
||||
|
||||
#include "mwscript/scriptmanager.hpp"
|
||||
#include "mwscript/compilercontext.hpp"
|
||||
#include "mwscript/interpretercontext.hpp"
|
||||
#include "mwscript/scriptmanagerimp.hpp"
|
||||
#include "mwscript/extensions.hpp"
|
||||
#include "mwscript/globalscripts.hpp"
|
||||
|
||||
#include "mwsound/soundmanager.hpp"
|
||||
#include "mwsound/soundmanagerimp.hpp"
|
||||
|
||||
#include "mwworld/world.hpp"
|
||||
#include "mwworld/class.hpp"
|
||||
#include "mwworld/player.hpp"
|
||||
#include "mwworld/worldimp.hpp"
|
||||
|
||||
#include "mwclass/classes.hpp"
|
||||
|
||||
#include "mwdialogue/dialoguemanager.hpp"
|
||||
#include "mwdialogue/journal.hpp"
|
||||
#include "mwdialogue/dialoguemanagerimp.hpp"
|
||||
#include "mwdialogue/journalimp.hpp"
|
||||
|
||||
#include "mwmechanics/mechanicsmanager.hpp"
|
||||
|
||||
#include "mwbase/environment.hpp"
|
||||
#include "mwmechanics/mechanicsmanagerimp.hpp"
|
||||
|
||||
|
||||
void OMW::Engine::executeLocalScripts()
|
||||
|
@ -74,11 +56,8 @@ void OMW::Engine::executeLocalScripts()
|
|||
localScripts.setIgnore (MWWorld::Ptr());
|
||||
}
|
||||
|
||||
void OMW::Engine::setAnimationVerbose(bool animverbose){
|
||||
if(animverbose){
|
||||
NifOgre::NIFLoader::getSingletonPtr()->setOutputAnimFiles(true);
|
||||
NifOgre::NIFLoader::getSingletonPtr()->setVerbosePath(mCfgMgr.getLogPath().string());
|
||||
}
|
||||
void OMW::Engine::setAnimationVerbose(bool animverbose)
|
||||
{
|
||||
}
|
||||
|
||||
bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
||||
|
@ -126,9 +105,9 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
|||
|
||||
// update GUI
|
||||
Ogre::RenderWindow* window = mOgre->getWindow();
|
||||
MWBase::Environment::get().getWindowManager()->wmUpdateFps(window->getLastFPS(),
|
||||
window->getTriangleCount(),
|
||||
window->getBatchCount());
|
||||
unsigned int tri, batch;
|
||||
MWBase::Environment::get().getWorld()->getTriangleBatchCount(tri, batch);
|
||||
MWBase::Environment::get().getWindowManager()->wmUpdateFps(window->getLastFPS(), tri, batch);
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->onFrame(evt.timeSinceLastFrame);
|
||||
}
|
||||
|
@ -150,6 +129,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
|||
, mCompileAll (false)
|
||||
, mScriptContext (0)
|
||||
, mFSStrict (false)
|
||||
, mScriptConsoleMode (false)
|
||||
, mCfgMgr(configurationManager)
|
||||
{
|
||||
std::srand ( std::time(NULL) );
|
||||
|
@ -310,7 +290,6 @@ void OMW::Engine::go()
|
|||
}
|
||||
mOgre->configure(
|
||||
mCfgMgr.getLogPath().string(),
|
||||
mCfgMgr.getPluginsConfigPath().string(),
|
||||
renderSystem,
|
||||
false);
|
||||
|
||||
|
@ -348,7 +327,8 @@ void OMW::Engine::go()
|
|||
MWScript::registerExtensions (mExtensions);
|
||||
|
||||
mEnvironment.setWindowManager (new MWGui::WindowManager(
|
||||
mExtensions, mFpsLevel, mNewGame, mOgre, mCfgMgr.getLogPath().string() + std::string("/")));
|
||||
mExtensions, mFpsLevel, mNewGame, mOgre, mCfgMgr.getLogPath().string() + std::string("/"),
|
||||
mScriptConsoleMode));
|
||||
|
||||
// Create sound system
|
||||
mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound));
|
||||
|
@ -410,6 +390,9 @@ void OMW::Engine::go()
|
|||
<< std::endl;
|
||||
}
|
||||
|
||||
if (!mStartupScript.empty())
|
||||
MWBase::Environment::get().getWindowManager()->executeInConsole (mStartupScript);
|
||||
|
||||
// Start the main rendering loop
|
||||
mOgre->start();
|
||||
|
||||
|
@ -512,3 +495,13 @@ void OMW::Engine::setFallbackValues(std::map<std::string,std::string> fallbackMa
|
|||
{
|
||||
mFallbackMap = fallbackMap;
|
||||
}
|
||||
|
||||
void OMW::Engine::setScriptConsoleMode (bool enabled)
|
||||
{
|
||||
mScriptConsoleMode = enabled;
|
||||
}
|
||||
|
||||
void OMW::Engine::setStartupScript (const std::string& path)
|
||||
{
|
||||
mStartupScript = path;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#ifndef ENGINE_H
|
||||
#define ENGINE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <OgreFrameListener.h>
|
||||
|
||||
#include <components/compiler/extensions.hpp>
|
||||
|
@ -77,6 +73,8 @@ namespace OMW
|
|||
bool mCompileAll;
|
||||
std::string mFocusName;
|
||||
std::map<std::string,std::string> mFallbackMap;
|
||||
bool mScriptConsoleMode;
|
||||
std::string mStartupScript;
|
||||
|
||||
Compiler::Extensions mExtensions;
|
||||
Compiler::Context *mScriptContext;
|
||||
|
@ -162,6 +160,12 @@ namespace OMW
|
|||
|
||||
void setFallbackValues(std::map<std::string,std::string> map);
|
||||
|
||||
/// Enable console-only script functionality
|
||||
void setScriptConsoleMode (bool enabled);
|
||||
|
||||
/// Set path for a script that is run on startup in the console.
|
||||
void setStartupScript (const std::string& path);
|
||||
|
||||
private:
|
||||
Files::ConfigurationManager& mCfgMgr;
|
||||
};
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
#include <iostream>
|
||||
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include <components/files/fileops.hpp>
|
||||
#include <components/files/fixedpath.hpp>
|
||||
#include <components/files/collections.hpp>
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
|
||||
#include "engine.hpp"
|
||||
|
@ -16,15 +8,10 @@
|
|||
#include <boost/iostreams/concepts.hpp>
|
||||
#include <boost/iostreams/stream_buffer.hpp>
|
||||
|
||||
# if !defined(_DEBUG)
|
||||
# include <iostream>
|
||||
# include <fstream>
|
||||
# endif
|
||||
|
||||
// For OutputDebugString
|
||||
#include <Windows.h>
|
||||
// makes __argc and __argv available on windows
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -52,8 +39,6 @@ inline boost::filesystem::path lexical_cast<boost::filesystem::path, std::string
|
|||
} /* namespace boost */
|
||||
#endif /* (BOOST_VERSION <= 104600) */
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct FallbackMap {
|
||||
std::map<std::string,std::string> mMap;
|
||||
};
|
||||
|
@ -139,12 +124,20 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||
("script-verbose", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(false), "verbose script output")
|
||||
|
||||
("new-game", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(false), "activate char gen/new game mechanics")
|
||||
|
||||
("script-all", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(false), "compile all scripts (excluding dialogue scripts) at startup")
|
||||
|
||||
("script-console", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(false), "enable console-only script functionality")
|
||||
|
||||
("script-run", bpo::value<std::string>()->default_value(""),
|
||||
"select a file that is executed in the console on startup\n\n"
|
||||
"Note: The file contains a list of script lines, but not a complete scripts. "
|
||||
"That means no begin/end and no variable declarations.")
|
||||
|
||||
("new-game", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(false), "activate char gen/new game mechanics")
|
||||
|
||||
("fs-strict", bpo::value<bool>()->implicit_value(true)
|
||||
->default_value(false), "strict file system handling (no case folding)")
|
||||
|
||||
|
@ -264,6 +257,8 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Files::Configurat
|
|||
engine.setCompileAll(variables["script-all"].as<bool>());
|
||||
engine.setAnimationVerbose(variables["anim-verbose"].as<bool>());
|
||||
engine.setFallbackValues(variables["fallback"].as<FallbackMap>().mMap);
|
||||
engine.setScriptConsoleMode (variables["script-console"].as<bool>());
|
||||
engine.setStartupScript (variables["script-run"].as<std::string>());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
46
apps/openmw/mwbase/dialoguemanager.hpp
Normal file
46
apps/openmw/mwbase/dialoguemanager.hpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#ifndef GAME_MWBASE_DIALOGUEMANAGER_H
|
||||
#define GAME_MWBASE_DIALOGUEMANAGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Ptr;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for dialogue manager (implemented in MWDialogue)
|
||||
class DialogueManager
|
||||
{
|
||||
DialogueManager (const DialogueManager&);
|
||||
///< not implemented
|
||||
|
||||
DialogueManager& operator= (const DialogueManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
DialogueManager() {}
|
||||
|
||||
virtual ~DialogueManager() {}
|
||||
|
||||
virtual void startDialogue (const MWWorld::Ptr& actor) = 0;
|
||||
|
||||
virtual void addTopic (const std::string& topic) = 0;
|
||||
|
||||
virtual void askQuestion (const std::string& question,int choice) = 0;
|
||||
|
||||
virtual void goodbye() = 0;
|
||||
|
||||
///get the faction of the actor you are talking with
|
||||
virtual std::string getFaction() const = 0;
|
||||
|
||||
//calbacks for the GUI
|
||||
virtual void keywordSelected (const std::string& keyword) = 0;
|
||||
virtual void goodbyeSelected() = 0;
|
||||
virtual void questionAnswered (const std::string& answer) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -3,18 +3,14 @@
|
|||
|
||||
#include <cassert>
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
|
||||
#include "../mwscript/scriptmanager.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "../mwworld/world.hpp"
|
||||
|
||||
#include "../mwdialogue/dialoguemanager.hpp"
|
||||
#include "../mwdialogue/journal.hpp"
|
||||
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "world.hpp"
|
||||
#include "scriptmanager.hpp"
|
||||
#include "dialoguemanager.hpp"
|
||||
#include "journal.hpp"
|
||||
#include "soundmanager.hpp"
|
||||
#include "mechanicsmanager.hpp"
|
||||
#include "inputmanager.hpp"
|
||||
#include "windowmanager.hpp"
|
||||
|
||||
MWBase::Environment *MWBase::Environment::sThis = 0;
|
||||
|
||||
|
@ -32,42 +28,42 @@ MWBase::Environment::~Environment()
|
|||
sThis = 0;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setWorld (MWWorld::World *world)
|
||||
void MWBase::Environment::setWorld (World *world)
|
||||
{
|
||||
mWorld = world;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setSoundManager (MWSound::SoundManager *soundManager)
|
||||
void MWBase::Environment::setSoundManager (SoundManager *soundManager)
|
||||
{
|
||||
mSoundManager = soundManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setScriptManager (MWScript::ScriptManager *scriptManager)
|
||||
void MWBase::Environment::setScriptManager (ScriptManager *scriptManager)
|
||||
{
|
||||
mScriptManager = scriptManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setWindowManager (MWGui::WindowManager *windowManager)
|
||||
void MWBase::Environment::setWindowManager (WindowManager *windowManager)
|
||||
{
|
||||
mWindowManager = windowManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setMechanicsManager (MWMechanics::MechanicsManager *mechanicsManager)
|
||||
void MWBase::Environment::setMechanicsManager (MechanicsManager *mechanicsManager)
|
||||
{
|
||||
mMechanicsManager = mechanicsManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setDialogueManager (MWDialogue::DialogueManager *dialogueManager)
|
||||
void MWBase::Environment::setDialogueManager (DialogueManager *dialogueManager)
|
||||
{
|
||||
mDialogueManager = dialogueManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setJournal (MWDialogue::Journal *journal)
|
||||
void MWBase::Environment::setJournal (Journal *journal)
|
||||
{
|
||||
mJournal = journal;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setInputManager (MWInput::MWInputManager *inputManager)
|
||||
void MWBase::Environment::setInputManager (InputManager *inputManager)
|
||||
{
|
||||
mInputManager = inputManager;
|
||||
}
|
||||
|
@ -77,49 +73,49 @@ void MWBase::Environment::setFrameDuration (float duration)
|
|||
mFrameDuration = duration;
|
||||
}
|
||||
|
||||
MWWorld::World *MWBase::Environment::getWorld() const
|
||||
MWBase::World *MWBase::Environment::getWorld() const
|
||||
{
|
||||
assert (mWorld);
|
||||
return mWorld;
|
||||
}
|
||||
|
||||
MWSound::SoundManager *MWBase::Environment::getSoundManager() const
|
||||
MWBase::SoundManager *MWBase::Environment::getSoundManager() const
|
||||
{
|
||||
assert (mSoundManager);
|
||||
return mSoundManager;
|
||||
}
|
||||
|
||||
MWScript::ScriptManager *MWBase::Environment::getScriptManager() const
|
||||
MWBase::ScriptManager *MWBase::Environment::getScriptManager() const
|
||||
{
|
||||
assert (mScriptManager);
|
||||
return mScriptManager;
|
||||
}
|
||||
|
||||
MWGui::WindowManager *MWBase::Environment::getWindowManager() const
|
||||
MWBase::WindowManager *MWBase::Environment::getWindowManager() const
|
||||
{
|
||||
assert (mWindowManager);
|
||||
return mWindowManager;
|
||||
}
|
||||
|
||||
MWMechanics::MechanicsManager *MWBase::Environment::getMechanicsManager() const
|
||||
MWBase::MechanicsManager *MWBase::Environment::getMechanicsManager() const
|
||||
{
|
||||
assert (mMechanicsManager);
|
||||
return mMechanicsManager;
|
||||
}
|
||||
|
||||
MWDialogue::DialogueManager *MWBase::Environment::getDialogueManager() const
|
||||
MWBase::DialogueManager *MWBase::Environment::getDialogueManager() const
|
||||
{
|
||||
assert (mDialogueManager);
|
||||
return mDialogueManager;
|
||||
}
|
||||
|
||||
MWDialogue::Journal *MWBase::Environment::getJournal() const
|
||||
MWBase::Journal *MWBase::Environment::getJournal() const
|
||||
{
|
||||
assert (mJournal);
|
||||
return mJournal;
|
||||
}
|
||||
|
||||
MWInput::MWInputManager *MWBase::Environment::getInputManager() const
|
||||
MWBase::InputManager *MWBase::Environment::getInputManager() const
|
||||
{
|
||||
assert (mInputManager);
|
||||
return mInputManager;
|
||||
|
@ -150,6 +146,9 @@ void MWBase::Environment::cleanup()
|
|||
delete mScriptManager;
|
||||
mScriptManager = 0;
|
||||
|
||||
delete mWindowManager;
|
||||
mWindowManager = 0;
|
||||
|
||||
delete mWorld;
|
||||
mWorld = 0;
|
||||
}
|
||||
|
|
|
@ -1,44 +1,17 @@
|
|||
#ifndef GAME_BASE_INVIRONMENT_H
|
||||
#define GAME_BASE_INVIRONMENT_H
|
||||
|
||||
namespace MWSound
|
||||
{
|
||||
class SoundManager;
|
||||
}
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
class ScriptManager;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
}
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
class MechanicsManager;
|
||||
}
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
class DialogueManager;
|
||||
class Journal;
|
||||
}
|
||||
|
||||
namespace MWInput
|
||||
{
|
||||
struct MWInputManager;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class World;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
class World;
|
||||
class ScriptManager;
|
||||
class DialogueManager;
|
||||
class Journal;
|
||||
class SoundManager;
|
||||
class MechanicsManager;
|
||||
class InputManager;
|
||||
class WindowManager;
|
||||
|
||||
/// \brief Central hub for mw-subsystems
|
||||
///
|
||||
/// This class allows each mw-subsystem to access any others subsystem's top-level manager class.
|
||||
|
@ -49,14 +22,14 @@ namespace MWBase
|
|||
{
|
||||
static Environment *sThis;
|
||||
|
||||
MWWorld::World *mWorld;
|
||||
MWSound::SoundManager *mSoundManager;
|
||||
MWScript::ScriptManager *mScriptManager;
|
||||
MWGui::WindowManager *mWindowManager;
|
||||
MWMechanics::MechanicsManager *mMechanicsManager;
|
||||
MWDialogue::DialogueManager *mDialogueManager;
|
||||
MWDialogue::Journal *mJournal;
|
||||
MWInput::MWInputManager *mInputManager;
|
||||
World *mWorld;
|
||||
SoundManager *mSoundManager;
|
||||
ScriptManager *mScriptManager;
|
||||
WindowManager *mWindowManager;
|
||||
MechanicsManager *mMechanicsManager;
|
||||
DialogueManager *mDialogueManager;
|
||||
Journal *mJournal;
|
||||
InputManager *mInputManager;
|
||||
float mFrameDuration;
|
||||
|
||||
Environment (const Environment&);
|
||||
|
@ -71,40 +44,40 @@ namespace MWBase
|
|||
|
||||
~Environment();
|
||||
|
||||
void setWorld (MWWorld::World *world);
|
||||
void setWorld (World *world);
|
||||
|
||||
void setSoundManager (MWSound::SoundManager *soundManager);
|
||||
void setSoundManager (SoundManager *soundManager);
|
||||
|
||||
void setScriptManager (MWScript::ScriptManager *scriptManager);
|
||||
void setScriptManager (MWBase::ScriptManager *scriptManager);
|
||||
|
||||
void setWindowManager (MWGui::WindowManager *windowManager);
|
||||
void setWindowManager (WindowManager *windowManager);
|
||||
|
||||
void setMechanicsManager (MWMechanics::MechanicsManager *mechanicsManager);
|
||||
void setMechanicsManager (MechanicsManager *mechanicsManager);
|
||||
|
||||
void setDialogueManager (MWDialogue::DialogueManager *dialogueManager);
|
||||
void setDialogueManager (DialogueManager *dialogueManager);
|
||||
|
||||
void setJournal (MWDialogue::Journal *journal);
|
||||
void setJournal (Journal *journal);
|
||||
|
||||
void setInputManager (MWInput::MWInputManager *inputManager);
|
||||
void setInputManager (InputManager *inputManager);
|
||||
|
||||
void setFrameDuration (float duration);
|
||||
///< Set length of current frame in seconds.
|
||||
|
||||
MWWorld::World *getWorld() const;
|
||||
World *getWorld() const;
|
||||
|
||||
MWSound::SoundManager *getSoundManager() const;
|
||||
SoundManager *getSoundManager() const;
|
||||
|
||||
MWScript::ScriptManager *getScriptManager() const;
|
||||
ScriptManager *getScriptManager() const;
|
||||
|
||||
MWGui::WindowManager *getWindowManager() const;
|
||||
WindowManager *getWindowManager() const;
|
||||
|
||||
MWMechanics::MechanicsManager *getMechanicsManager() const;
|
||||
MechanicsManager *getMechanicsManager() const;
|
||||
|
||||
MWDialogue::DialogueManager *getDialogueManager() const;
|
||||
DialogueManager *getDialogueManager() const;
|
||||
|
||||
MWDialogue::Journal *getJournal() const;
|
||||
Journal *getJournal() const;
|
||||
|
||||
MWInput::MWInputManager *getInputManager() const;
|
||||
InputManager *getInputManager() const;
|
||||
|
||||
float getFrameDuration() const;
|
||||
|
||||
|
|
37
apps/openmw/mwbase/inputmanager.hpp
Normal file
37
apps/openmw/mwbase/inputmanager.hpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef GAME_MWBASE_INPUTMANAGER_H
|
||||
#define GAME_MWBASE_INPUTMANAGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for input manager (implemented in MWInput)
|
||||
class InputManager
|
||||
{
|
||||
InputManager (const InputManager&);
|
||||
///< not implemented
|
||||
|
||||
InputManager& operator= (const InputManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
InputManager() {}
|
||||
|
||||
virtual ~InputManager() {}
|
||||
|
||||
virtual void update() = 0;
|
||||
|
||||
virtual void changeInputMode(bool guiMode) = 0;
|
||||
|
||||
virtual void processChangedSettings(const Settings::CategorySettingVector& changed) = 0;
|
||||
|
||||
virtual void setDragDrop(bool dragDrop) = 0;
|
||||
|
||||
virtual void toggleControlSwitch (const std::string& sw, bool value) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
73
apps/openmw/mwbase/journal.hpp
Normal file
73
apps/openmw/mwbase/journal.hpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
#ifndef GAME_MWBASE_JOURNAL_H
|
||||
#define GAME_MWBASE_JOURNAL_H
|
||||
|
||||
#include <string>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
|
||||
#include "../mwdialogue/journalentry.hpp"
|
||||
#include "../mwdialogue/topic.hpp"
|
||||
#include "../mwdialogue/quest.hpp"
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for the player's journal (implemented in MWDialogue)
|
||||
class Journal
|
||||
{
|
||||
Journal (const Journal&);
|
||||
///< not implemented
|
||||
|
||||
Journal& operator= (const Journal&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
typedef std::deque<MWDialogue::StampedJournalEntry> TEntryContainer;
|
||||
typedef TEntryContainer::const_iterator TEntryIter;
|
||||
typedef std::map<std::string, MWDialogue::Quest> TQuestContainer; // topc, quest
|
||||
typedef TQuestContainer::const_iterator TQuestIter;
|
||||
typedef std::map<std::string, MWDialogue::Topic> TTopicContainer; // topic-id, topic-content
|
||||
typedef TTopicContainer::const_iterator TTopicIter;
|
||||
|
||||
public:
|
||||
|
||||
Journal() {}
|
||||
|
||||
virtual ~Journal() {}
|
||||
|
||||
virtual void addEntry (const std::string& id, int index) = 0;
|
||||
///< Add a journal entry.
|
||||
|
||||
virtual void setJournalIndex (const std::string& id, int index) = 0;
|
||||
///< Set the journal index without adding an entry.
|
||||
|
||||
virtual int getJournalIndex (const std::string& id) const = 0;
|
||||
///< Get the journal index.
|
||||
|
||||
virtual void addTopic (const std::string& topicId, const std::string& infoId) = 0;
|
||||
|
||||
virtual TEntryIter begin() const = 0;
|
||||
///< Iterator pointing to the begin of the main journal.
|
||||
///
|
||||
/// \note Iterators to main journal entries will never become invalid.
|
||||
|
||||
virtual TEntryIter end() const = 0;
|
||||
///< Iterator pointing past the end of the main journal.
|
||||
|
||||
virtual TQuestIter questBegin() const = 0;
|
||||
///< Iterator pointing to the first quest (sorted by topic ID)
|
||||
|
||||
virtual TQuestIter questEnd() const = 0;
|
||||
///< Iterator pointing past the last quest.
|
||||
|
||||
virtual TTopicIter topicBegin() const = 0;
|
||||
///< Iterator pointing to the first topic (sorted by topic ID)
|
||||
///
|
||||
/// \note The topic ID is identical with the user-visible topic string.
|
||||
|
||||
virtual TTopicIter topicEnd() const = 0;
|
||||
///< Iterator pointing past the last topic.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
77
apps/openmw/mwbase/mechanicsmanager.hpp
Normal file
77
apps/openmw/mwbase/mechanicsmanager.hpp
Normal file
|
@ -0,0 +1,77 @@
|
|||
#ifndef GAME_MWBASE_MECHANICSMANAGER_H
|
||||
#define GAME_MWBASE_MECHANICSMANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class Vector3;
|
||||
}
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
struct Class;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class Ptr;
|
||||
class CellStore;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for game mechanics manager (implemented in MWMechanics)
|
||||
class MechanicsManager
|
||||
{
|
||||
MechanicsManager (const MechanicsManager&);
|
||||
///< not implemented
|
||||
|
||||
MechanicsManager& operator= (const MechanicsManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
MechanicsManager() {}
|
||||
|
||||
virtual ~MechanicsManager() {}
|
||||
|
||||
virtual void addActor (const MWWorld::Ptr& ptr) = 0;
|
||||
///< Register an actor for stats management
|
||||
|
||||
virtual void removeActor (const MWWorld::Ptr& ptr) = 0;
|
||||
///< Deregister an actor for stats management
|
||||
|
||||
virtual void dropActors (const MWWorld::CellStore *cellStore) = 0;
|
||||
///< Deregister all actors in the given cell.
|
||||
|
||||
virtual void watchActor (const MWWorld::Ptr& ptr) = 0;
|
||||
///< On each update look for changes in a previously registered actor and update the
|
||||
/// GUI accordingly.
|
||||
|
||||
virtual void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement,
|
||||
float duration, bool paused) = 0;
|
||||
///< Update actor stats and store desired velocity vectors in \a movement
|
||||
///
|
||||
/// \param paused In game type does not currently advance (this usually means some GUI
|
||||
/// component is up).
|
||||
|
||||
virtual void setPlayerName (const std::string& name) = 0;
|
||||
///< Set player name.
|
||||
|
||||
virtual void setPlayerRace (const std::string& id, bool male) = 0;
|
||||
///< Set player race.
|
||||
|
||||
virtual void setPlayerBirthsign (const std::string& id) = 0;
|
||||
///< Set player birthsign.
|
||||
|
||||
virtual void setPlayerClass (const std::string& id) = 0;
|
||||
///< Set player class to stock class.
|
||||
|
||||
virtual void setPlayerClass (const ESM::Class& class_) = 0;
|
||||
///< Set player class to custom class.
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
62
apps/openmw/mwbase/scriptmanager.hpp
Normal file
62
apps/openmw/mwbase/scriptmanager.hpp
Normal file
|
@ -0,0 +1,62 @@
|
|||
#ifndef GAME_MWBASE_SCRIPTMANAGER_H
|
||||
#define GAME_MWBASE_SCRIPTMANAGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Interpreter
|
||||
{
|
||||
class Context;
|
||||
}
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
class Locals;
|
||||
}
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
class GlobalScripts;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for script manager (implemented in MWScript)
|
||||
class ScriptManager
|
||||
{
|
||||
ScriptManager (const ScriptManager&);
|
||||
///< not implemented
|
||||
|
||||
ScriptManager& operator= (const ScriptManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
ScriptManager() {}
|
||||
|
||||
virtual ~ScriptManager() {}
|
||||
|
||||
virtual void run (const std::string& name, Interpreter::Context& interpreterContext) = 0;
|
||||
///< Run the script with the given name (compile first, if not compiled yet)
|
||||
|
||||
virtual bool compile (const std::string& name) = 0;
|
||||
///< Compile script with the given namen
|
||||
/// \return Success?
|
||||
|
||||
virtual std::pair<int, int> compileAll() = 0;
|
||||
///< Compile all scripts
|
||||
/// \return count, success
|
||||
|
||||
virtual Compiler::Locals& getLocals (const std::string& name) = 0;
|
||||
///< Return locals for script \a name.
|
||||
|
||||
virtual MWScript::GlobalScripts& getGlobalScripts() = 0;
|
||||
|
||||
virtual int getLocalIndex (const std::string& scriptId, const std::string& variable,
|
||||
char type) = 0;
|
||||
///< Return index of the variable of the given name and type in the given script. Will
|
||||
/// throw an exception, if there is no such script or variable or the type does not match.
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
129
apps/openmw/mwbase/soundmanager.hpp
Normal file
129
apps/openmw/mwbase/soundmanager.hpp
Normal file
|
@ -0,0 +1,129 @@
|
|||
#ifndef GAME_MWBASE_SOUNDMANAGER_H
|
||||
#define GAME_MWBASE_SOUNDMANAGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class Vector3;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class CellStore;
|
||||
}
|
||||
|
||||
namespace MWSound
|
||||
{
|
||||
class Sound;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
typedef boost::shared_ptr<MWSound::Sound> SoundPtr;
|
||||
|
||||
/// \brief Interface for sound manager (implemented in MWSound)
|
||||
class SoundManager
|
||||
{
|
||||
public:
|
||||
|
||||
enum PlayMode {
|
||||
Play_Normal = 0, /* tracked, non-looping, multi-instance, environment */
|
||||
Play_Loop = 1<<0, /* Sound will continually loop until explicitly stopped */
|
||||
Play_NoEnv = 1<<1, /* Do not apply environment effects (eg, underwater filters) */
|
||||
Play_NoTrack = 1<<2, /* (3D only) Play the sound at the given object's position
|
||||
* but do not keep it updated (the sound will not move with
|
||||
* the object and will not stop when the object is deleted. */
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
SoundManager (const SoundManager&);
|
||||
///< not implemented
|
||||
|
||||
SoundManager& operator= (const SoundManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
SoundManager() {}
|
||||
|
||||
virtual ~SoundManager() {}
|
||||
|
||||
virtual void processChangedSettings(const Settings::CategorySettingVector& settings) = 0;
|
||||
|
||||
virtual void stopMusic() = 0;
|
||||
///< Stops music if it's playing
|
||||
|
||||
virtual void streamMusic(const std::string& filename) = 0;
|
||||
///< Play a soundifle
|
||||
/// \param filename name of a sound file in "Music/" in the data directory.
|
||||
|
||||
virtual void startRandomTitle() = 0;
|
||||
///< Starts a random track from the current playlist
|
||||
|
||||
virtual bool isMusicPlaying() = 0;
|
||||
///< Returns true if music is playing
|
||||
|
||||
virtual void playPlaylist(const std::string &playlist) = 0;
|
||||
///< Start playing music from the selected folder
|
||||
/// \param name of the folder that contains the playlist
|
||||
|
||||
virtual void say(MWWorld::Ptr reference, const std::string& filename) = 0;
|
||||
///< Make an actor say some text.
|
||||
/// \param filename name of a sound file in "Sound/" in the data directory.
|
||||
|
||||
virtual void say(const std::string& filename) = 0;
|
||||
///< Say some text, without an actor ref
|
||||
/// \param filename name of a sound file in "Sound/" in the data directory.
|
||||
|
||||
virtual bool sayDone(MWWorld::Ptr reference=MWWorld::Ptr()) const = 0;
|
||||
///< Is actor not speaking?
|
||||
|
||||
virtual void stopSay(MWWorld::Ptr reference=MWWorld::Ptr()) = 0;
|
||||
///< Stop an actor speaking
|
||||
|
||||
virtual SoundPtr playSound(const std::string& soundId, float volume, float pitch,
|
||||
int mode=Play_Normal) = 0;
|
||||
///< Play a sound, independently of 3D-position
|
||||
|
||||
virtual SoundPtr playSound3D(MWWorld::Ptr reference, const std::string& soundId,
|
||||
float volume, float pitch, int mode=Play_Normal) = 0;
|
||||
///< Play a sound from an object
|
||||
|
||||
virtual void stopSound3D(MWWorld::Ptr reference, const std::string& soundId) = 0;
|
||||
///< Stop the given object from playing the given sound,
|
||||
|
||||
virtual void stopSound3D(MWWorld::Ptr reference) = 0;
|
||||
///< Stop the given object from playing all sounds.
|
||||
|
||||
virtual void stopSound(const MWWorld::CellStore *cell) = 0;
|
||||
///< Stop all sounds for the given cell.
|
||||
|
||||
virtual void stopSound(const std::string& soundId) = 0;
|
||||
///< Stop a non-3d looping sound
|
||||
|
||||
virtual bool getSoundPlaying(MWWorld::Ptr reference, const std::string& soundId) const = 0;
|
||||
///< Is the given sound currently playing on the given object?
|
||||
|
||||
virtual void updateObject(MWWorld::Ptr reference) = 0;
|
||||
///< Update the position of all sounds connected to the given object.
|
||||
|
||||
virtual void update(float duration) = 0;
|
||||
|
||||
virtual void setListenerPosDir(const Ogre::Vector3 &pos, const Ogre::Vector3 &dir) = 0;
|
||||
};
|
||||
|
||||
inline int operator|(SoundManager::PlayMode a, SoundManager::PlayMode b)
|
||||
{ return static_cast<int> (a) | static_cast<int> (b); }
|
||||
inline int operator&(SoundManager::PlayMode a, SoundManager::PlayMode b)
|
||||
{ return static_cast<int> (a) & static_cast<int> (b); }
|
||||
}
|
||||
|
||||
#endif
|
210
apps/openmw/mwbase/windowmanager.hpp
Normal file
210
apps/openmw/mwbase/windowmanager.hpp
Normal file
|
@ -0,0 +1,210 @@
|
|||
#ifndef GAME_MWBASE_WINDOWMANAGER_H
|
||||
#define GAME_MWBASE_WINDOWMANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
|
||||
#include "../mwgui/mode.hpp"
|
||||
|
||||
namespace MyGUI
|
||||
{
|
||||
class Gui;
|
||||
class Widget;
|
||||
class UString;
|
||||
}
|
||||
|
||||
namespace OEngine
|
||||
{
|
||||
namespace GUI
|
||||
{
|
||||
class Layout;
|
||||
}
|
||||
}
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
struct Class;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class CellStore;
|
||||
class Ptr;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class Console;
|
||||
class SpellWindow;
|
||||
class TradeWindow;
|
||||
class ConfirmationDialog;
|
||||
class CountDialog;
|
||||
class ScrollWindow;
|
||||
class BookWindow;
|
||||
class InventoryWindow;
|
||||
class ContainerWindow;
|
||||
class DialogueWindow;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for widnow manager (implemented in MWGui)
|
||||
class WindowManager
|
||||
{
|
||||
WindowManager (const WindowManager&);
|
||||
///< not implemented
|
||||
|
||||
WindowManager& operator= (const WindowManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
WindowManager() {}
|
||||
|
||||
virtual ~WindowManager() {}
|
||||
|
||||
/**
|
||||
* Should be called each frame to update windows/gui elements.
|
||||
* This could mean updating sizes of gui elements or opening
|
||||
* new dialogs.
|
||||
*/
|
||||
virtual void update() = 0;
|
||||
|
||||
virtual void pushGuiMode (MWGui::GuiMode mode) = 0;
|
||||
virtual void popGuiMode() = 0;
|
||||
|
||||
virtual void removeGuiMode (MWGui::GuiMode mode) = 0;
|
||||
///< can be anywhere in the stack
|
||||
|
||||
virtual MWGui::GuiMode getMode() const = 0;
|
||||
|
||||
virtual bool isGuiMode() const = 0;
|
||||
|
||||
virtual void toggleVisible (MWGui::GuiWindow wnd) = 0;
|
||||
|
||||
/// Disallow all inventory mode windows
|
||||
virtual void disallowAll() = 0;
|
||||
|
||||
/// Allow one or more windows
|
||||
virtual void allow (MWGui::GuiWindow wnd) = 0;
|
||||
|
||||
virtual bool isAllowed (MWGui::GuiWindow wnd) const = 0;
|
||||
|
||||
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world
|
||||
virtual MWGui::DialogueWindow* getDialogueWindow() = 0;
|
||||
virtual MWGui::ContainerWindow* getContainerWindow() = 0;
|
||||
virtual MWGui::InventoryWindow* getInventoryWindow() = 0;
|
||||
virtual MWGui::BookWindow* getBookWindow() = 0;
|
||||
virtual MWGui::ScrollWindow* getScrollWindow() = 0;
|
||||
virtual MWGui::CountDialog* getCountDialog() = 0;
|
||||
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
||||
virtual MWGui::TradeWindow* getTradeWindow() = 0;
|
||||
virtual MWGui::SpellWindow* getSpellWindow() = 0;
|
||||
virtual MWGui::Console* getConsole() = 0;
|
||||
|
||||
virtual MyGUI::Gui* getGui() const = 0;
|
||||
|
||||
virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount) = 0;
|
||||
|
||||
/// Set value for the given ID.
|
||||
virtual void setValue (const std::string& id, const MWMechanics::Stat<int>& value) = 0;
|
||||
virtual void setValue (int parSkill, const MWMechanics::Stat<float>& value) = 0;
|
||||
virtual void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value) = 0;
|
||||
virtual void setValue (const std::string& id, const std::string& value) = 0;
|
||||
virtual void setValue (const std::string& id, int value) = 0;
|
||||
|
||||
virtual void setPlayerClass (const ESM::Class &class_) = 0;
|
||||
///< set current class of player
|
||||
|
||||
virtual void configureSkills (const SkillList& major, const SkillList& minor) = 0;
|
||||
///< configure skill groups, each set contains the skill ID for that group.
|
||||
|
||||
virtual void setReputation (int reputation) = 0;
|
||||
///< set the current reputation value
|
||||
|
||||
virtual void setBounty (int bounty) = 0;
|
||||
///< set the current bounty value
|
||||
|
||||
virtual void updateSkillArea() = 0;
|
||||
///< update display of skills, factions, birth sign, reputation and bounty
|
||||
|
||||
virtual void changeCell(MWWorld::CellStore* cell) = 0;
|
||||
///< change the active cell
|
||||
|
||||
virtual void setPlayerPos(const float x, const float y) = 0;
|
||||
///< set player position in map space
|
||||
|
||||
virtual void setPlayerDir(const float x, const float y) = 0;
|
||||
///< set player view direction in map space
|
||||
|
||||
virtual void setFocusObject(const MWWorld::Ptr& focus) = 0;
|
||||
virtual void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y) = 0;
|
||||
|
||||
virtual void setMouseVisible(bool visible) = 0;
|
||||
virtual void getMousePosition(int &x, int &y) = 0;
|
||||
virtual void getMousePosition(float &x, float &y) = 0;
|
||||
virtual void setDragDrop(bool dragDrop) = 0;
|
||||
virtual bool getWorldMouseOver() = 0;
|
||||
|
||||
virtual void toggleFogOfWar() = 0;
|
||||
|
||||
virtual void toggleFullHelp() = 0;
|
||||
///< show extra info in item tooltips (owner, script)
|
||||
|
||||
virtual bool getFullHelp() const = 0;
|
||||
|
||||
virtual void setInteriorMapTexture(const int x, const int y) = 0;
|
||||
///< set the index of the map texture that should be used (for interiors)
|
||||
|
||||
/// sets the visibility of the hud health/magicka/stamina bars
|
||||
virtual void setHMSVisibility(bool visible) = 0;
|
||||
|
||||
/// sets the visibility of the hud minimap
|
||||
virtual void setMinimapVisibility(bool visible) = 0;
|
||||
virtual void setWeaponVisibility(bool visible) = 0;
|
||||
virtual void setSpellVisibility(bool visible) = 0;
|
||||
|
||||
virtual void setSelectedSpell(const std::string& spellId, int successChancePercent) = 0;
|
||||
virtual void setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent) = 0;
|
||||
virtual void setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent) = 0;
|
||||
virtual void unsetSelectedSpell() = 0;
|
||||
virtual void unsetSelectedWeapon() = 0;
|
||||
|
||||
virtual void removeDialog(OEngine::GUI::Layout* dialog) = 0;
|
||||
///< Hides dialog and schedules dialog to be deleted.
|
||||
|
||||
virtual void messageBox (const std::string& message, const std::vector<std::string>& buttons) = 0;
|
||||
virtual int readPressedButton() = 0;
|
||||
///< returns the index of the pressed button or -1 if no button was pressed (->MessageBoxmanager->InteractiveMessageBox)
|
||||
|
||||
virtual void onFrame (float frameDuration) = 0;
|
||||
|
||||
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.
|
||||
virtual std::map<int, MWMechanics::Stat<float> > getPlayerSkillValues() = 0;
|
||||
virtual std::map<int, MWMechanics::Stat<int> > getPlayerAttributeValues() = 0;
|
||||
virtual SkillList getPlayerMinorSkills() = 0;
|
||||
virtual SkillList getPlayerMajorSkills() = 0;
|
||||
|
||||
/**
|
||||
* Fetches a GMST string from the store, if there is no setting with the given
|
||||
* ID or it is not a string the default string is returned.
|
||||
*
|
||||
* @param id Identifier for the GMST setting, e.g. "aName"
|
||||
* @param default Default value if the GMST setting cannot be used.
|
||||
*/
|
||||
virtual const std::string &getGameSettingString(const std::string &id, const std::string &default_) = 0;
|
||||
|
||||
virtual void processChangedSettings(const Settings::CategorySettingVector& changed) = 0;
|
||||
|
||||
virtual void executeInConsole (const std::string& path) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
254
apps/openmw/mwbase/world.hpp
Normal file
254
apps/openmw/mwbase/world.hpp
Normal file
|
@ -0,0 +1,254 @@
|
|||
#ifndef GAME_MWBASE_WORLD_H
|
||||
#define GAME_MWBASE_WORLD_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwworld/globals.hpp"
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class Vector2;
|
||||
class Vector3;
|
||||
}
|
||||
|
||||
namespace OEngine
|
||||
{
|
||||
namespace Render
|
||||
{
|
||||
class Fader;
|
||||
}
|
||||
}
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
class ESMReader;
|
||||
struct Position;
|
||||
struct Cell;
|
||||
struct Class;
|
||||
struct Potion;
|
||||
}
|
||||
|
||||
namespace ESMS
|
||||
{
|
||||
struct ESMStore;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class CellStore;
|
||||
class Player;
|
||||
class LocalScripts;
|
||||
class Ptr;
|
||||
class TimeStamp;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for the World (implemented in MWWorld)
|
||||
class World
|
||||
{
|
||||
World (const World&);
|
||||
///< not implemented
|
||||
|
||||
World& operator= (const World&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
enum RenderMode
|
||||
{
|
||||
Render_CollisionDebug,
|
||||
Render_Wireframe,
|
||||
Render_Pathgrid,
|
||||
Render_Compositors
|
||||
};
|
||||
|
||||
World() {}
|
||||
|
||||
virtual ~World() {}
|
||||
|
||||
virtual OEngine::Render::Fader* getFader() = 0;
|
||||
///< \ŧodo remove this function. Rendering details should not be exposed.
|
||||
|
||||
virtual MWWorld::CellStore *getExterior (int x, int y) = 0;
|
||||
|
||||
virtual MWWorld::CellStore *getInterior (const std::string& name) = 0;
|
||||
|
||||
virtual void setWaterHeight(const float height) = 0;
|
||||
|
||||
virtual void toggleWater() = 0;
|
||||
|
||||
virtual void adjustSky() = 0;
|
||||
|
||||
virtual void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches) = 0;
|
||||
|
||||
virtual void setFallbackValues (const std::map<std::string, std::string>& fallbackMap) = 0;
|
||||
|
||||
virtual std::string getFallback (const std::string& key) const = 0;
|
||||
|
||||
virtual std::string getFallback (const std::string& key, const std::string& def) const = 0;
|
||||
|
||||
virtual MWWorld::Player& getPlayer() = 0;
|
||||
|
||||
virtual const ESMS::ESMStore& getStore() const = 0;
|
||||
|
||||
virtual ESM::ESMReader& getEsmReader() = 0;
|
||||
|
||||
virtual MWWorld::LocalScripts& getLocalScripts() = 0;
|
||||
|
||||
virtual bool hasCellChanged() const = 0;
|
||||
///< Has the player moved to a different cell, since the last frame?
|
||||
|
||||
virtual bool isCellExterior() const = 0;
|
||||
|
||||
virtual bool isCellQuasiExterior() const = 0;
|
||||
|
||||
virtual Ogre::Vector2 getNorthVector (MWWorld::CellStore* cell) = 0;
|
||||
///< get north vector (OGRE coordinates) for given interior cell
|
||||
|
||||
virtual MWWorld::Globals::Data& getGlobalVariable (const std::string& name) = 0;
|
||||
|
||||
virtual MWWorld::Globals::Data getGlobalVariable (const std::string& name) const = 0;
|
||||
|
||||
virtual char getGlobalVariableType (const std::string& name) const = 0;
|
||||
///< Return ' ', if there is no global variable with this name.
|
||||
|
||||
virtual MWWorld::Ptr getPtr (const std::string& name, bool activeOnly) = 0;
|
||||
///< Return a pointer to a liveCellRef with the given name.
|
||||
/// \param activeOnly do non search inactive cells.
|
||||
|
||||
virtual MWWorld::Ptr getPtrViaHandle (const std::string& handle) = 0;
|
||||
///< Return a pointer to a liveCellRef with the given Ogre handle.
|
||||
|
||||
/// \todo enable reference in the OGRE scene
|
||||
virtual void enable (const MWWorld::Ptr& ptr) = 0;
|
||||
|
||||
/// \todo disable reference in the OGRE scene
|
||||
virtual void disable (const MWWorld::Ptr& ptr) = 0;
|
||||
|
||||
virtual void advanceTime (double hours) = 0;
|
||||
///< Advance in-game time.
|
||||
|
||||
virtual void setHour (double hour) = 0;
|
||||
///< Set in-game time hour.
|
||||
|
||||
virtual void setMonth (int month) = 0;
|
||||
///< Set in-game time month.
|
||||
|
||||
virtual void setDay (int day) = 0;
|
||||
///< Set in-game time day.
|
||||
|
||||
virtual MWWorld::TimeStamp getTimeStamp() const = 0;
|
||||
///< Return current in-game time stamp.
|
||||
|
||||
virtual bool toggleSky() = 0;
|
||||
///< \return Resulting mode
|
||||
|
||||
virtual void changeWeather(const std::string& region, unsigned int id) = 0;
|
||||
|
||||
virtual int getCurrentWeather() const = 0;
|
||||
|
||||
virtual int getMasserPhase() const = 0;
|
||||
|
||||
virtual int getSecundaPhase() const = 0;
|
||||
|
||||
virtual void setMoonColour (bool red) = 0;
|
||||
|
||||
virtual float getTimeScaleFactor() const = 0;
|
||||
|
||||
virtual void changeToInteriorCell (const std::string& cellName,
|
||||
const ESM::Position& position) = 0;
|
||||
///< Move to interior cell.
|
||||
|
||||
virtual void changeToExteriorCell (const ESM::Position& position) = 0;
|
||||
///< Move to exterior cell.
|
||||
|
||||
virtual const ESM::Cell *getExterior (const std::string& cellName) const = 0;
|
||||
///< Return a cell matching the given name or a 0-pointer, if there is no such cell.
|
||||
|
||||
virtual void markCellAsUnchanged() = 0;
|
||||
|
||||
virtual std::string getFacedHandle() = 0;
|
||||
///< Return handle of the object the player is looking at
|
||||
|
||||
virtual void deleteObject (const MWWorld::Ptr& ptr) = 0;
|
||||
|
||||
virtual void moveObject (const MWWorld::Ptr& ptr, float x, float y, float z) = 0;
|
||||
|
||||
virtual void
|
||||
moveObject(const MWWorld::Ptr &ptr, MWWorld::CellStore &newCell, float x, float y, float z) = 0;
|
||||
|
||||
virtual void scaleObject (const MWWorld::Ptr& ptr, float scale) = 0;
|
||||
|
||||
virtual void rotateObject(const MWWorld::Ptr& ptr,float x,float y,float z, bool adjust = false) = 0;
|
||||
|
||||
virtual void indexToPosition (int cellX, int cellY, float &x, float &y, bool centre = false)
|
||||
const = 0;
|
||||
///< Convert cell numbers to position.
|
||||
|
||||
virtual void positionToIndex (float x, float y, int &cellX, int &cellY) const = 0;
|
||||
///< Convert position to cell numbers
|
||||
|
||||
virtual void doPhysics (const std::vector<std::pair<std::string, Ogre::Vector3> >& actors,
|
||||
float duration) = 0;
|
||||
///< Run physics simulation and modify \a world accordingly.
|
||||
|
||||
virtual bool toggleCollisionMode() = 0;
|
||||
///< Toggle collision mode for player. If disabled player object should ignore
|
||||
/// collisions and gravity.
|
||||
///< \return Resulting mode
|
||||
|
||||
virtual bool toggleRenderMode (RenderMode mode) = 0;
|
||||
///< Toggle a render mode.
|
||||
///< \return Resulting mode
|
||||
|
||||
virtual std::pair<std::string, const ESM::Potion *> createRecord (const ESM::Potion& record)
|
||||
= 0;
|
||||
///< Create a new recrod (of type potion) in the ESM store.
|
||||
/// \return ID, pointer to created record
|
||||
|
||||
virtual std::pair<std::string, const ESM::Class *> createRecord (const ESM::Class& record)
|
||||
= 0;
|
||||
///< Create a new recrod (of type class) in the ESM store.
|
||||
/// \return ID, pointer to created record
|
||||
|
||||
virtual const ESM::Cell *createRecord (const ESM::Cell& record) = 0;
|
||||
///< Create a new recrod (of type cell) in the ESM store.
|
||||
/// \return ID, pointer to created record
|
||||
|
||||
virtual void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName,
|
||||
int mode, int number = 1) = 0;
|
||||
///< Run animation for a MW-reference. Calls to this function for references that are
|
||||
/// currently not in the rendered scene should be ignored.
|
||||
///
|
||||
/// \param mode: 0 normal, 1 immediate start, 2 immediate loop
|
||||
/// \param number How offen the animation should be run
|
||||
|
||||
virtual void skipAnimation (const MWWorld::Ptr& ptr) = 0;
|
||||
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
|
||||
/// references that are currently not in the rendered scene should be ignored.
|
||||
|
||||
virtual void update (float duration) = 0;
|
||||
|
||||
virtual bool placeObject(const MWWorld::Ptr& object, float cursorX, float cursorY) = 0;
|
||||
///< place an object into the gameworld at the specified cursor position
|
||||
/// @param object
|
||||
/// @param cursor X (relative 0-1)
|
||||
/// @param cursor Y (relative 0-1)
|
||||
/// @return true if the object was placed, or false if it was rejected because the position is too far away
|
||||
|
||||
virtual void dropObjectOnGround (const MWWorld::Ptr& object) = 0;
|
||||
|
||||
virtual bool canPlaceObject (float cursorX, float cursorY) = 0;
|
||||
///< @return true if it is possible to place on object at specified cursor location
|
||||
|
||||
virtual void processChangedSettings (const Settings::CategorySettingVector& settings) = 0;
|
||||
|
||||
virtual bool isSwimming(const MWWorld::Ptr &object) = 0;
|
||||
virtual bool isUnderwater(const ESM::Cell &cell, const Ogre::Vector3 &pos) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -3,48 +3,54 @@
|
|||
|
||||
#include <components/esm/loadacti.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld//cellstore.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Activator::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Activator::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Activator::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Activator::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -52,7 +58,7 @@ namespace MWClass
|
|||
|
||||
std::string Activator::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -67,7 +73,7 @@ namespace MWClass
|
|||
|
||||
bool Activator::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -75,7 +81,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -88,4 +94,13 @@ namespace MWClass
|
|||
|
||||
return info;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Activator::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
return MWWorld::Ptr(&cell.activators.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,10 @@ namespace MWClass
|
|||
{
|
||||
class Activator : public MWWorld::Class
|
||||
{
|
||||
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
|
@ -28,6 +32,8 @@ namespace MWClass
|
|||
///< Return name of the script attached to ptr
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,57 +3,58 @@
|
|||
|
||||
#include <components/esm/loadappa.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/actionalchemy.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Apparatus::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Apparatus::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Apparatus::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -62,7 +63,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
@ -70,7 +71,7 @@ namespace MWClass
|
|||
|
||||
std::string Apparatus::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -78,7 +79,7 @@ namespace MWClass
|
|||
|
||||
int Apparatus::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -103,7 +104,7 @@ namespace MWClass
|
|||
|
||||
std::string Apparatus::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -111,7 +112,7 @@ namespace MWClass
|
|||
|
||||
bool Apparatus::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -119,7 +120,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Apparatus::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -147,4 +148,13 @@ namespace MWClass
|
|||
{
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionAlchemy());
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Apparatus::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return MWWorld::Ptr(&cell.appas.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,10 @@ namespace MWClass
|
|||
{
|
||||
class Apparatus : public MWWorld::Class
|
||||
{
|
||||
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
|
@ -48,6 +52,8 @@ namespace MWClass
|
|||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -5,56 +5,59 @@
|
|||
#include <components/esm/loadskil.hpp>
|
||||
#include <components/esm/loadgmst.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Armor::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Armor::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Armor::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -63,7 +66,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
@ -76,7 +79,7 @@ namespace MWClass
|
|||
|
||||
int Armor::getItemMaxHealth (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->data.health;
|
||||
|
@ -84,7 +87,7 @@ namespace MWClass
|
|||
|
||||
std::string Armor::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -92,7 +95,7 @@ namespace MWClass
|
|||
|
||||
std::pair<std::vector<int>, bool> Armor::getEquipmentSlots (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
std::vector<int> slots;
|
||||
|
@ -126,7 +129,7 @@ namespace MWClass
|
|||
|
||||
int Armor::getEquipmentSkill (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
std::string typeGmst;
|
||||
|
@ -164,7 +167,7 @@ namespace MWClass
|
|||
|
||||
int Armor::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -201,7 +204,7 @@ namespace MWClass
|
|||
|
||||
std::string Armor::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -209,7 +212,7 @@ namespace MWClass
|
|||
|
||||
bool Armor::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -217,7 +220,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Armor::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -260,7 +263,7 @@ namespace MWClass
|
|||
|
||||
std::string Armor::getEnchantment (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->enchant;
|
||||
|
@ -272,4 +275,13 @@ namespace MWClass
|
|||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Armor::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return MWWorld::Ptr(&cell.armors.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ namespace MWClass
|
|||
{
|
||||
class Armor : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
|
@ -66,6 +69,7 @@ namespace MWClass
|
|||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,55 +3,57 @@
|
|||
|
||||
#include <components/esm/loadbook.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actionread.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Book::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Book::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Book::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Book::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -66,7 +68,7 @@ namespace MWClass
|
|||
|
||||
std::string Book::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -74,7 +76,7 @@ namespace MWClass
|
|||
|
||||
int Book::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -99,7 +101,7 @@ namespace MWClass
|
|||
|
||||
std::string Book::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -107,7 +109,7 @@ namespace MWClass
|
|||
|
||||
bool Book::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -115,7 +117,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Book::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -143,7 +145,7 @@ namespace MWClass
|
|||
|
||||
std::string Book::getEnchantment (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return ref->base->enchant;
|
||||
|
@ -154,4 +156,12 @@ namespace MWClass
|
|||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionRead(ptr));
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Book::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return MWWorld::Ptr(&cell.books.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ namespace MWClass
|
|||
{
|
||||
class Book : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
|
@ -50,6 +53,8 @@ namespace MWClass
|
|||
|
||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,58 +3,59 @@
|
|||
|
||||
#include <components/esm/loadclot.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Clothing::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Clothing::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Clothing::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -63,7 +64,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
@ -71,7 +72,7 @@ namespace MWClass
|
|||
|
||||
std::string Clothing::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -79,7 +80,7 @@ namespace MWClass
|
|||
|
||||
std::pair<std::vector<int>, bool> Clothing::getEquipmentSlots (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
std::vector<int> slots;
|
||||
|
@ -119,7 +120,7 @@ namespace MWClass
|
|||
|
||||
int Clothing::getEquipmentSkill (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
if (ref->base->data.type==ESM::Clothing::Shoes)
|
||||
|
@ -130,7 +131,7 @@ namespace MWClass
|
|||
|
||||
int Clothing::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -145,7 +146,7 @@ namespace MWClass
|
|||
|
||||
std::string Clothing::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
if (ref->base->data.type == 8)
|
||||
|
@ -157,7 +158,7 @@ namespace MWClass
|
|||
|
||||
std::string Clothing::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
if (ref->base->data.type == 8)
|
||||
|
@ -169,7 +170,7 @@ namespace MWClass
|
|||
|
||||
std::string Clothing::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -177,7 +178,7 @@ namespace MWClass
|
|||
|
||||
bool Clothing::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -185,7 +186,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Clothing::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -213,7 +214,7 @@ namespace MWClass
|
|||
|
||||
std::string Clothing::getEnchantment (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return ref->base->enchant;
|
||||
|
@ -225,4 +226,13 @@ namespace MWClass
|
|||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Clothing::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return MWWorld::Ptr(&cell.clothes.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ namespace MWClass
|
|||
{
|
||||
class Clothing : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
|
@ -59,6 +62,8 @@ namespace MWClass
|
|||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,23 +3,23 @@
|
|||
|
||||
#include <components/esm/loadcont.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/customdata.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/actionopen.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwworld/actionopen.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -53,32 +53,33 @@ namespace MWClass
|
|||
|
||||
void Container::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Container::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Container::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -117,7 +118,7 @@ namespace MWClass
|
|||
|
||||
std::string Container::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -133,7 +134,7 @@ namespace MWClass
|
|||
|
||||
std::string Container::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -148,7 +149,7 @@ namespace MWClass
|
|||
|
||||
bool Container::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -156,7 +157,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -182,7 +183,7 @@ namespace MWClass
|
|||
|
||||
float Container::getCapacity (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
return ref->base->weight;
|
||||
|
@ -205,4 +206,13 @@ namespace MWClass
|
|||
{
|
||||
ptr.getCellRef().lockLevel = 0;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Container::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
return MWWorld::Ptr(&cell.containers.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,10 @@ namespace MWClass
|
|||
{
|
||||
void ensureCustomData (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
|
@ -51,6 +55,8 @@ namespace MWClass
|
|||
///< Unlock object
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -4,17 +4,21 @@
|
|||
#include <components/esm/loadcrea.hpp>
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwmechanics/magiceffects.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
#include "../mwworld/customdata.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -40,27 +44,27 @@ namespace MWClass
|
|||
{
|
||||
std::auto_ptr<CustomData> data (new CustomData);
|
||||
|
||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref = ptr.get<ESM::Creature>();
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||
|
||||
// creature stats
|
||||
data->mCreatureStats.mAttributes[0].set (ref->base->data.strength);
|
||||
data->mCreatureStats.mAttributes[1].set (ref->base->data.intelligence);
|
||||
data->mCreatureStats.mAttributes[2].set (ref->base->data.willpower);
|
||||
data->mCreatureStats.mAttributes[3].set (ref->base->data.agility);
|
||||
data->mCreatureStats.mAttributes[4].set (ref->base->data.speed);
|
||||
data->mCreatureStats.mAttributes[5].set (ref->base->data.endurance);
|
||||
data->mCreatureStats.mAttributes[6].set (ref->base->data.personality);
|
||||
data->mCreatureStats.mAttributes[7].set (ref->base->data.luck);
|
||||
data->mCreatureStats.mDynamic[0].set (ref->base->data.health);
|
||||
data->mCreatureStats.mDynamic[1].set (ref->base->data.mana);
|
||||
data->mCreatureStats.mDynamic[2].set (ref->base->data.fatigue);
|
||||
data->mCreatureStats.getAttribute(0).set (ref->base->data.strength);
|
||||
data->mCreatureStats.getAttribute(1).set (ref->base->data.intelligence);
|
||||
data->mCreatureStats.getAttribute(2).set (ref->base->data.willpower);
|
||||
data->mCreatureStats.getAttribute(3).set (ref->base->data.agility);
|
||||
data->mCreatureStats.getAttribute(4).set (ref->base->data.speed);
|
||||
data->mCreatureStats.getAttribute(5).set (ref->base->data.endurance);
|
||||
data->mCreatureStats.getAttribute(6).set (ref->base->data.personality);
|
||||
data->mCreatureStats.getAttribute(7).set (ref->base->data.luck);
|
||||
data->mCreatureStats.getHealth().set (ref->base->data.health);
|
||||
data->mCreatureStats.getMagicka().set (ref->base->data.mana);
|
||||
data->mCreatureStats.getFatigue().set (ref->base->data.fatigue);
|
||||
|
||||
data->mCreatureStats.mLevel = ref->base->data.level;
|
||||
data->mCreatureStats.setLevel(ref->base->data.level);
|
||||
|
||||
data->mCreatureStats.mHello = ref->base->AI.hello;
|
||||
data->mCreatureStats.mFight = ref->base->AI.fight;
|
||||
data->mCreatureStats.mFlee = ref->base->AI.flee;
|
||||
data->mCreatureStats.mAlarm = ref->base->AI.alarm;
|
||||
data->mCreatureStats.setHello(ref->base->AI.hello);
|
||||
data->mCreatureStats.setFight(ref->base->AI.fight);
|
||||
data->mCreatureStats.setFlee(ref->base->AI.flee);
|
||||
data->mCreatureStats.setAlarm(ref->base->AI.alarm);
|
||||
|
||||
// store
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
|
@ -69,7 +73,7 @@ namespace MWClass
|
|||
|
||||
std::string Creature::getId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return ref->base->mId;
|
||||
|
@ -83,21 +87,29 @@ namespace MWClass
|
|||
|
||||
void Creature::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()){
|
||||
physics.insertActorPhysics(ptr, model);
|
||||
}
|
||||
MWBase::Environment::get().getMechanicsManager()->addActor (ptr);
|
||||
}
|
||||
|
||||
std::string Creature::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
assert (ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertActorPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->addActor (ptr);
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Creature::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -126,7 +138,7 @@ namespace MWClass
|
|||
|
||||
std::string Creature::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -148,7 +160,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Creature::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -165,7 +177,7 @@ namespace MWClass
|
|||
float Creature::getCapacity (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||
return stats.mAttributes[0].getModified()*5;
|
||||
return stats.getAttribute(0).getModified()*5;
|
||||
}
|
||||
|
||||
float Creature::getEncumbrance (const MWWorld::Ptr& ptr) const
|
||||
|
@ -174,13 +186,22 @@ namespace MWClass
|
|||
|
||||
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||
|
||||
weight -= stats.mMagicEffects.get (MWMechanics::EffectKey (8)).mMagnitude; // feather
|
||||
weight -= stats.getMagicEffects().get (MWMechanics::EffectKey (8)).mMagnitude; // feather
|
||||
|
||||
weight += stats.mMagicEffects.get (MWMechanics::EffectKey (7)).mMagnitude; // burden
|
||||
weight += stats.getMagicEffects().get (MWMechanics::EffectKey (7)).mMagnitude; // burden
|
||||
|
||||
if (weight<0)
|
||||
weight = 0;
|
||||
|
||||
return weight;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Creature::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return MWWorld::Ptr(&cell.creatures.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef GAME_MWCLASS_CREATURE_H
|
||||
#define GAME_MWCLASS_CREATURE_H
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
#include "../mwrender/actors.hpp"
|
||||
|
||||
|
@ -12,6 +11,9 @@ namespace MWClass
|
|||
{
|
||||
void ensureCustomData (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
@ -55,6 +57,13 @@ namespace MWClass
|
|||
/// effects). Throws an exception, if the object can't hold other objects.
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool
|
||||
isActor() const {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,56 +3,59 @@
|
|||
|
||||
#include <components/esm/loaddoor.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
#include "../mwworld/actionteleport.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Door::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Door::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Door::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Door::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
if (ref->ref.teleport && !ref->ref.destCell.empty()) // TODO doors that lead to exteriors
|
||||
|
@ -64,7 +67,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
const std::string &openSound = ref->base->openSound;
|
||||
|
@ -93,18 +96,18 @@ namespace MWClass
|
|||
if (ref->ref.teleport)
|
||||
{
|
||||
// teleport door
|
||||
/// \todo remove this if clause once ActionTeleport can also support other actors
|
||||
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()==actor)
|
||||
{
|
||||
// the player is using the door
|
||||
// The reason this is not 3D is that it would get interrupted when you teleport
|
||||
MWBase::Environment::get().getSoundManager()->playSound(openSound, 1.0, 1.0);
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTeleportPlayer (ref->ref.destCell, ref->ref.doorDest));
|
||||
new MWWorld::ActionTeleport (ref->ref.destCell, ref->ref.doorDest));
|
||||
}
|
||||
else
|
||||
{
|
||||
// another NPC or a creature is using the door
|
||||
// TODO return action for teleporting other NPC/creature
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||
}
|
||||
}
|
||||
|
@ -134,7 +137,7 @@ namespace MWClass
|
|||
|
||||
std::string Door::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -149,7 +152,7 @@ namespace MWClass
|
|||
|
||||
bool Door::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -157,7 +160,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Door::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -205,4 +208,13 @@ namespace MWClass
|
|||
|
||||
return info;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Door::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
return MWWorld::Ptr(&cell.doors.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ namespace MWClass
|
|||
{
|
||||
class Door : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
|
@ -38,6 +41,8 @@ namespace MWClass
|
|||
///< Return name of the script attached to ptr
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,54 +3,57 @@
|
|||
|
||||
#include <components/esm/loadingr.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Ingredient::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Ingredient::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Ingredient::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -59,7 +62,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
@ -67,7 +70,7 @@ namespace MWClass
|
|||
|
||||
std::string Ingredient::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -75,7 +78,7 @@ namespace MWClass
|
|||
|
||||
int Ingredient::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -100,7 +103,7 @@ namespace MWClass
|
|||
|
||||
std::string Ingredient::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -108,7 +111,7 @@ namespace MWClass
|
|||
|
||||
bool Ingredient::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -116,7 +119,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Ingredient::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -152,4 +155,13 @@ namespace MWClass
|
|||
|
||||
return info;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Ingredient::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return MWWorld::Ptr(&cell.ingreds.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ namespace MWClass
|
|||
{
|
||||
class Ingredient : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
|
@ -44,6 +47,8 @@ namespace MWClass
|
|||
|
||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of inventory icon.
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,32 +3,32 @@
|
|||
|
||||
#include <components/esm/loadligh.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
#include "../mwworld/nullaction.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Light::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
|
@ -47,25 +47,36 @@ namespace MWClass
|
|||
|
||||
void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if(!model.empty()){
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
|
||||
if (!ref->base->sound.empty())
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, ref->base->sound, 1.0, 1.0, MWSound::Play_Loop);
|
||||
if (!ref->base->sound.empty()) {
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->base->sound, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Light::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
assert (ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Light::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
if (ref->base->model.empty())
|
||||
|
@ -77,13 +88,13 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
if (!(ref->base->data.flags & ESM::Light::Carry))
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
@ -91,7 +102,7 @@ namespace MWClass
|
|||
|
||||
std::string Light::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -99,7 +110,7 @@ namespace MWClass
|
|||
|
||||
std::pair<std::vector<int>, bool> Light::getEquipmentSlots (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
std::vector<int> slots;
|
||||
|
@ -112,7 +123,7 @@ namespace MWClass
|
|||
|
||||
int Light::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -138,7 +149,7 @@ namespace MWClass
|
|||
|
||||
std::string Light::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -146,7 +157,7 @@ namespace MWClass
|
|||
|
||||
bool Light::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -154,7 +165,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -184,4 +195,13 @@ namespace MWClass
|
|||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Light::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
return MWWorld::Ptr(&cell.lights.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ namespace MWClass
|
|||
{
|
||||
class Light : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
|
@ -52,6 +55,8 @@ namespace MWClass
|
|||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,58 +3,59 @@
|
|||
|
||||
#include <components/esm/loadlocks.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Lockpick::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -63,7 +64,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
@ -71,7 +72,7 @@ namespace MWClass
|
|||
|
||||
std::string Lockpick::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -88,7 +89,7 @@ namespace MWClass
|
|||
|
||||
int Lockpick::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -113,7 +114,7 @@ namespace MWClass
|
|||
|
||||
std::string Lockpick::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -121,7 +122,7 @@ namespace MWClass
|
|||
|
||||
bool Lockpick::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -129,7 +130,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -163,4 +164,13 @@ namespace MWClass
|
|||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Lockpick::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return MWWorld::Ptr(&cell.lockpicks.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ namespace MWClass
|
|||
{
|
||||
class Lockpick : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
|
@ -52,6 +55,8 @@ namespace MWClass
|
|||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -5,20 +5,21 @@
|
|||
|
||||
#include <components/esm/loadmisc.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
|
@ -26,37 +27,38 @@ namespace MWClass
|
|||
{
|
||||
void Miscellaneous::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Miscellaneous::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Miscellaneous::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Miscellaneous::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -65,7 +67,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
@ -73,7 +75,7 @@ namespace MWClass
|
|||
|
||||
std::string Miscellaneous::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -81,7 +83,7 @@ namespace MWClass
|
|||
|
||||
int Miscellaneous::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -96,7 +98,7 @@ namespace MWClass
|
|||
|
||||
std::string Miscellaneous::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str)
|
||||
|
@ -108,7 +110,7 @@ namespace MWClass
|
|||
|
||||
std::string Miscellaneous::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str)
|
||||
|
@ -120,7 +122,7 @@ namespace MWClass
|
|||
|
||||
std::string Miscellaneous::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -128,7 +130,7 @@ namespace MWClass
|
|||
|
||||
bool Miscellaneous::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -136,7 +138,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Miscellaneous::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -181,4 +183,39 @@ namespace MWClass
|
|||
|
||||
return info;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Miscellaneous::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::Ptr newPtr;
|
||||
|
||||
const ESMS::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
if (MWWorld::Class::get(ptr).getName(ptr) == store.gameSettings.search("sGold")->str) {
|
||||
int goldAmount = ptr.getRefData().getCount();
|
||||
|
||||
std::string base = "Gold_001";
|
||||
if (goldAmount >= 100)
|
||||
base = "Gold_100";
|
||||
else if (goldAmount >= 25)
|
||||
base = "Gold_025";
|
||||
else if (goldAmount >= 10)
|
||||
base = "Gold_010";
|
||||
else if (goldAmount >= 5)
|
||||
base = "Gold_005";
|
||||
|
||||
// Really, I have no idea why moving ref out of conditional
|
||||
// scope causes list::push_back throwing std::bad_alloc
|
||||
MWWorld::ManualRef newRef(store, base);
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
newRef.getPtr().get<ESM::Miscellaneous>();
|
||||
newPtr = MWWorld::Ptr(&cell.miscItems.insert(*ref), &cell);
|
||||
} else {
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
newPtr = MWWorld::Ptr(&cell.miscItems.insert(*ref), &cell);
|
||||
}
|
||||
return newPtr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,12 @@ namespace MWClass
|
|||
{
|
||||
class Miscellaneous : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
|
@ -44,6 +47,8 @@ namespace MWClass
|
|||
|
||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of inventory icon.
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,20 +9,25 @@
|
|||
|
||||
#include <components/esm/loadnpc.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/movement.hpp"
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/customdata.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwrender/actors.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -53,7 +58,7 @@ namespace MWClass
|
|||
{
|
||||
std::auto_ptr<CustomData> data (new CustomData);
|
||||
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref = ptr.get<ESM::NPC>();
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
|
||||
|
||||
// NPC stats
|
||||
if (!ref->base->faction.empty())
|
||||
|
@ -62,11 +67,11 @@ namespace MWClass
|
|||
boost::algorithm::to_lower(faction);
|
||||
if(ref->base->npdt52.gold != -10)
|
||||
{
|
||||
data->mNpcStats.mFactionRank[faction] = (int)ref->base->npdt52.rank;
|
||||
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->npdt52.rank;
|
||||
}
|
||||
else
|
||||
{
|
||||
data->mNpcStats.mFactionRank[faction] = (int)ref->base->npdt12.rank;
|
||||
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->npdt12.rank;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,31 +79,31 @@ namespace MWClass
|
|||
if(ref->base->npdt52.gold != -10)
|
||||
{
|
||||
for (int i=0; i<27; ++i)
|
||||
data->mNpcStats.mSkill[i].setBase (ref->base->npdt52.skills[i]);
|
||||
data->mNpcStats.getSkill (i).setBase (ref->base->npdt52.skills[i]);
|
||||
|
||||
data->mCreatureStats.mAttributes[0].set (ref->base->npdt52.strength);
|
||||
data->mCreatureStats.mAttributes[1].set (ref->base->npdt52.intelligence);
|
||||
data->mCreatureStats.mAttributes[2].set (ref->base->npdt52.willpower);
|
||||
data->mCreatureStats.mAttributes[3].set (ref->base->npdt52.agility);
|
||||
data->mCreatureStats.mAttributes[4].set (ref->base->npdt52.speed);
|
||||
data->mCreatureStats.mAttributes[5].set (ref->base->npdt52.endurance);
|
||||
data->mCreatureStats.mAttributes[6].set (ref->base->npdt52.personality);
|
||||
data->mCreatureStats.mAttributes[7].set (ref->base->npdt52.luck);
|
||||
data->mCreatureStats.mDynamic[0].set (ref->base->npdt52.health);
|
||||
data->mCreatureStats.mDynamic[1].set (ref->base->npdt52.mana);
|
||||
data->mCreatureStats.mDynamic[2].set (ref->base->npdt52.fatigue);
|
||||
data->mCreatureStats.getAttribute(0).set (ref->base->npdt52.strength);
|
||||
data->mCreatureStats.getAttribute(1).set (ref->base->npdt52.intelligence);
|
||||
data->mCreatureStats.getAttribute(2).set (ref->base->npdt52.willpower);
|
||||
data->mCreatureStats.getAttribute(3).set (ref->base->npdt52.agility);
|
||||
data->mCreatureStats.getAttribute(4).set (ref->base->npdt52.speed);
|
||||
data->mCreatureStats.getAttribute(5).set (ref->base->npdt52.endurance);
|
||||
data->mCreatureStats.getAttribute(6).set (ref->base->npdt52.personality);
|
||||
data->mCreatureStats.getAttribute(7).set (ref->base->npdt52.luck);
|
||||
data->mCreatureStats.getHealth().set (ref->base->npdt52.health);
|
||||
data->mCreatureStats.getMagicka().set (ref->base->npdt52.mana);
|
||||
data->mCreatureStats.getFatigue().set (ref->base->npdt52.fatigue);
|
||||
|
||||
data->mCreatureStats.mLevel = ref->base->npdt52.level;
|
||||
data->mCreatureStats.setLevel(ref->base->npdt52.level);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// \todo do something with npdt12 maybe:p
|
||||
}
|
||||
|
||||
data->mCreatureStats.mHello = ref->base->AI.hello;
|
||||
data->mCreatureStats.mFight = ref->base->AI.fight;
|
||||
data->mCreatureStats.mFlee = ref->base->AI.flee;
|
||||
data->mCreatureStats.mAlarm = ref->base->AI.alarm;
|
||||
data->mCreatureStats.setHello(ref->base->AI.hello);
|
||||
data->mCreatureStats.setFight(ref->base->AI.fight);
|
||||
data->mCreatureStats.setFlee(ref->base->AI.flee);
|
||||
data->mCreatureStats.setAlarm(ref->base->AI.alarm);
|
||||
|
||||
// store
|
||||
ptr.getRefData().setCustomData (data.release());
|
||||
|
@ -107,7 +112,7 @@ namespace MWClass
|
|||
|
||||
std::string Npc::getId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
return ref->base->mId;
|
||||
|
@ -120,25 +125,34 @@ namespace MWClass
|
|||
|
||||
void Npc::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||
physics.insertActorPhysics(ptr, getModel(ptr));
|
||||
MWBase::Environment::get().getMechanicsManager()->addActor(ptr);
|
||||
}
|
||||
|
||||
std::string Npc::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
assert (ref->base != NULL);
|
||||
std::string headID = ref->base->head;
|
||||
std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);
|
||||
bool beast = bodyRaceID == "b_n_khajiit_m_" || bodyRaceID == "b_n_khajiit_f_" || bodyRaceID == "b_n_argonian_m_" || bodyRaceID == "b_n_argonian_f_";
|
||||
int end = headID.find_last_of("head_") - 4;
|
||||
std::string bodyRaceID = headID.substr(0, end);
|
||||
|
||||
std::string smodel = "meshes\\base_anim.nif";
|
||||
if(beast)
|
||||
smodel = "meshes\\base_animkna.nif";
|
||||
physics.insertActorPhysics(ptr, smodel);
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->addActor (ptr);
|
||||
std::string model = "meshes\\base_anim.nif";
|
||||
if (bodyRaceID == "b_n_khajiit_m_" ||
|
||||
bodyRaceID == "b_n_khajiit_f_" ||
|
||||
bodyRaceID == "b_n_argonian_m_" ||
|
||||
bodyRaceID == "b_n_argonian_f_")
|
||||
{
|
||||
model = "meshes\\base_animkna.nif";
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
std::string Npc::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -182,7 +196,7 @@ namespace MWClass
|
|||
|
||||
std::string Npc::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -196,12 +210,12 @@ namespace MWClass
|
|||
{
|
||||
case Run:
|
||||
|
||||
stats.mForceRun = force;
|
||||
stats.setMovementFlag (MWMechanics::NpcStats::Flag_ForceRun, force);
|
||||
break;
|
||||
|
||||
case Sneak:
|
||||
|
||||
stats.mForceSneak = force;
|
||||
stats.setMovementFlag (MWMechanics::NpcStats::Flag_ForceSneak, force);
|
||||
break;
|
||||
|
||||
case Combat:
|
||||
|
@ -218,17 +232,18 @@ namespace MWClass
|
|||
{
|
||||
case Run:
|
||||
|
||||
stats.mRun = set;
|
||||
stats.setMovementFlag (MWMechanics::NpcStats::Flag_Run, set);
|
||||
break;
|
||||
|
||||
case Sneak:
|
||||
|
||||
stats.mSneak = set;
|
||||
stats.setMovementFlag (MWMechanics::NpcStats::Flag_Sneak, set);
|
||||
break;
|
||||
|
||||
case Combat:
|
||||
|
||||
stats.mCombat = set;
|
||||
// Combat stance ignored for now; need to be determined based on draw state instead of
|
||||
// being maunally set.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -241,21 +256,21 @@ namespace MWClass
|
|||
{
|
||||
case Run:
|
||||
|
||||
if (!ignoreForce && stats.mForceRun)
|
||||
if (!ignoreForce && stats.getMovementFlag (MWMechanics::NpcStats::Flag_ForceRun))
|
||||
return true;
|
||||
|
||||
return stats.mRun;
|
||||
return stats.getMovementFlag (MWMechanics::NpcStats::Flag_Run);
|
||||
|
||||
case Sneak:
|
||||
|
||||
if (!ignoreForce && stats.mForceSneak)
|
||||
if (!ignoreForce && stats.getMovementFlag (MWMechanics::NpcStats::Flag_ForceSneak))
|
||||
return true;
|
||||
|
||||
return stats.mSneak;
|
||||
return stats.getMovementFlag (MWMechanics::NpcStats::Flag_Sneak);
|
||||
|
||||
case Combat:
|
||||
|
||||
return stats.mCombat;
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -302,7 +317,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Npc::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -319,7 +334,7 @@ namespace MWClass
|
|||
float Npc::getCapacity (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||
return stats.mAttributes[0].getModified()*5;
|
||||
return stats.getAttribute(0).getModified()*5;
|
||||
}
|
||||
|
||||
float Npc::getEncumbrance (const MWWorld::Ptr& ptr) const
|
||||
|
@ -328,13 +343,50 @@ namespace MWClass
|
|||
|
||||
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||
|
||||
weight -= stats.mMagicEffects.get (MWMechanics::EffectKey (8)).mMagnitude; // feather
|
||||
weight -= stats.getMagicEffects().get (MWMechanics::EffectKey (8)).mMagnitude; // feather
|
||||
|
||||
weight += stats.mMagicEffects.get (MWMechanics::EffectKey (7)).mMagnitude; // burden
|
||||
weight += stats.getMagicEffects().get (MWMechanics::EffectKey (7)).mMagnitude; // burden
|
||||
|
||||
if (weight<0)
|
||||
weight = 0;
|
||||
|
||||
return weight;
|
||||
}
|
||||
|
||||
bool Npc::apply (const MWWorld::Ptr& ptr, const std::string& id,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||
|
||||
/// \todo consider instant effects
|
||||
|
||||
return stats.getActiveSpells().addSpell (id);
|
||||
}
|
||||
|
||||
void Npc::skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType) const
|
||||
{
|
||||
MWMechanics::NpcStats& stats = getNpcStats (ptr);
|
||||
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
|
||||
|
||||
const ESM::Class *class_ = MWBase::Environment::get().getWorld()->getStore().classes.find (
|
||||
ref->base->cls);
|
||||
|
||||
stats.useSkill (skill, *class_, usageType);
|
||||
}
|
||||
|
||||
void Npc::adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const
|
||||
{
|
||||
y = 0;
|
||||
x = 0;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Npc::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
return MWWorld::Ptr(&cell.npcs.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@ namespace MWClass
|
|||
{
|
||||
void ensureCustomData (const MWWorld::Ptr& ptr) const;
|
||||
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||
|
@ -48,7 +51,7 @@ namespace MWClass
|
|||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of the script attached to ptr
|
||||
|
||||
virtual void setForceStance (const MWWorld::Ptr& ptr, Stance stance, bool force) const;
|
||||
virtual void setForceStance (const MWWorld::Ptr& ptr, Stance stance, bool force) const;
|
||||
///< Force or unforce a stance.
|
||||
|
||||
virtual void setStance (const MWWorld::Ptr& ptr, Stance stance, bool set) const;
|
||||
|
@ -76,7 +79,25 @@ namespace MWClass
|
|||
///< Returns total weight of objects inside this object (including modifications from magic
|
||||
/// effects). Throws an exception, if the object can't hold other objects.
|
||||
|
||||
virtual bool apply (const MWWorld::Ptr& ptr, const std::string& id,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
///< Apply \a id on \a ptr.
|
||||
/// \param actor Actor that is resposible for the ID being applied to \a ptr.
|
||||
/// \return Any effect?
|
||||
|
||||
virtual void skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType) const;
|
||||
///< Inform actor \a ptr that a skill use has succeeded.
|
||||
|
||||
virtual void adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const;
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
|
||||
virtual bool
|
||||
isActor() const {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,56 +3,59 @@
|
|||
|
||||
#include <components/esm/loadalch.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/actionapply.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Potion::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Potion::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Potion::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -61,7 +64,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
@ -69,7 +72,7 @@ namespace MWClass
|
|||
|
||||
std::string Potion::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -77,7 +80,7 @@ namespace MWClass
|
|||
|
||||
int Potion::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -102,7 +105,7 @@ namespace MWClass
|
|||
|
||||
std::string Potion::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -110,7 +113,7 @@ namespace MWClass
|
|||
|
||||
bool Potion::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -118,7 +121,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Potion::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -143,4 +146,30 @@ namespace MWClass
|
|||
|
||||
return info;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Potion::use (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
ptr.getRefData().setCount (ptr.getRefData().getCount()-1);
|
||||
|
||||
MWWorld::Ptr actor = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action (
|
||||
new MWWorld::ActionApply (actor, ref->base->mId));
|
||||
|
||||
action->setSound ("Drink");
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Potion::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return MWWorld::Ptr(&cell.potions.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,12 @@ namespace MWClass
|
|||
{
|
||||
class Potion : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
|
@ -34,6 +37,9 @@ namespace MWClass
|
|||
virtual int getValue (const MWWorld::Ptr& ptr) const;
|
||||
///< Return trade value of the object. Throws an exception, if the object can't be traded.
|
||||
|
||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||
|
@ -44,6 +50,8 @@ namespace MWClass
|
|||
|
||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of inventory icon.
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,58 +3,59 @@
|
|||
|
||||
#include <components/esm/loadlocks.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Probe::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
std::string Probe::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Probe::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -62,7 +63,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
@ -70,7 +71,7 @@ namespace MWClass
|
|||
|
||||
std::string Probe::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -87,7 +88,7 @@ namespace MWClass
|
|||
|
||||
int Probe::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -112,7 +113,7 @@ namespace MWClass
|
|||
|
||||
std::string Probe::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -120,7 +121,7 @@ namespace MWClass
|
|||
|
||||
bool Probe::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -128,7 +129,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Probe::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -162,4 +163,13 @@ namespace MWClass
|
|||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Probe::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return MWWorld::Ptr(&cell.probes.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,12 @@ namespace MWClass
|
|||
{
|
||||
class Probe : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
|
@ -52,6 +55,8 @@ namespace MWClass
|
|||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
|
||||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,55 +3,57 @@
|
|||
|
||||
#include <components/esm/loadlocks.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Repair::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Repair::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Repair::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -60,7 +62,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
@ -68,7 +70,7 @@ namespace MWClass
|
|||
|
||||
std::string Repair::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -76,7 +78,7 @@ namespace MWClass
|
|||
|
||||
int Repair::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -101,7 +103,7 @@ namespace MWClass
|
|||
|
||||
std::string Repair::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -109,7 +111,7 @@ namespace MWClass
|
|||
|
||||
bool Repair::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -117,7 +119,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Repair::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -143,4 +145,13 @@ namespace MWClass
|
|||
|
||||
return info;
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Repair::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return MWWorld::Ptr(&cell.repairs.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,12 @@ namespace MWClass
|
|||
{
|
||||
class Repair : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
|
@ -44,6 +47,8 @@ namespace MWClass
|
|||
|
||||
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of inventory icon.
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -4,39 +4,43 @@
|
|||
#include <components/esm/loadstat.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Static, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Static>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), true);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Static::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Static, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Static>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Static::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Static> *ref =
|
||||
ptr.get<ESM::Static>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Static::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
|
@ -49,4 +53,13 @@ namespace MWClass
|
|||
|
||||
registerClass (typeid (ESM::Static).name(), instance);
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Static::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Static> *ref =
|
||||
ptr.get<ESM::Static>();
|
||||
|
||||
return MWWorld::Ptr(&cell.statics.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,12 @@ namespace MWClass
|
|||
{
|
||||
class Static : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual void insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const;
|
||||
|
@ -19,6 +22,8 @@ namespace MWClass
|
|||
/// can return an empty string.
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,58 +3,59 @@
|
|||
|
||||
#include <components/esm/loadweap.hpp>
|
||||
|
||||
#include <components/esm_store/cell_store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/actionequip.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/tooltips.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwrender/renderinginterface.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
assert (ref->base != NULL);
|
||||
const std::string &model = ref->base->model;
|
||||
|
||||
if (!model.empty())
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if (!model.empty()) {
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
objects.insertMesh(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
void Weapon::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
}
|
||||
|
||||
std::string Weapon::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
assert(ref->base != NULL);
|
||||
|
||||
const std::string &model = ref->base->model;
|
||||
assert (ref->base != NULL);
|
||||
if(!model.empty()){
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string Weapon::getName (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->name;
|
||||
|
@ -63,7 +64,7 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
|
@ -76,7 +77,7 @@ namespace MWClass
|
|||
|
||||
int Weapon::getItemMaxHealth (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->data.health;
|
||||
|
@ -84,7 +85,7 @@ namespace MWClass
|
|||
|
||||
std::string Weapon::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->script;
|
||||
|
@ -92,7 +93,7 @@ namespace MWClass
|
|||
|
||||
std::pair<std::vector<int>, bool> Weapon::getEquipmentSlots (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
std::vector<int> slots;
|
||||
|
@ -116,7 +117,7 @@ namespace MWClass
|
|||
|
||||
int Weapon::getEquipmentSkill (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
const int size = 12;
|
||||
|
@ -146,7 +147,7 @@ namespace MWClass
|
|||
|
||||
int Weapon::getValue (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->data.value;
|
||||
|
@ -161,7 +162,7 @@ namespace MWClass
|
|||
|
||||
std::string Weapon::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
int type = ref->base->data.type;
|
||||
|
@ -207,7 +208,7 @@ namespace MWClass
|
|||
|
||||
std::string Weapon::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
int type = ref->base->data.type;
|
||||
|
@ -253,7 +254,7 @@ namespace MWClass
|
|||
|
||||
std::string Weapon::getInventoryIcon (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->icon;
|
||||
|
@ -261,7 +262,7 @@ namespace MWClass
|
|||
|
||||
bool Weapon::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return (ref->base->name != "");
|
||||
|
@ -269,7 +270,7 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo Weapon::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
@ -351,7 +352,7 @@ namespace MWClass
|
|||
|
||||
std::string Weapon::getEnchantment (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->enchant;
|
||||
|
@ -363,4 +364,13 @@ namespace MWClass
|
|||
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionEquip(ptr));
|
||||
}
|
||||
|
||||
MWWorld::Ptr
|
||||
Weapon::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return MWWorld::Ptr(&cell.weapons.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ namespace MWClass
|
|||
{
|
||||
class Weapon : public MWWorld::Class
|
||||
{
|
||||
virtual MWWorld::Ptr
|
||||
copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const;
|
||||
|
||||
public:
|
||||
|
||||
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const;
|
||||
|
@ -66,6 +69,7 @@ namespace MWClass
|
|||
const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#include "dialoguemanager.hpp"
|
||||
#include "dialoguemanagerimp.hpp"
|
||||
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
|
@ -10,34 +10,31 @@
|
|||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/scriptmanager.hpp"
|
||||
#include "../mwbase/journal.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/refdata.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
#include "../mwgui/dialogue.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include "journal.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "../mwscript/extensions.hpp"
|
||||
#include "../mwscript/scriptmanager.hpp"
|
||||
|
||||
#include <components/compiler/exception.hpp>
|
||||
#include <components/compiler/errorhandler.hpp>
|
||||
#include <components/compiler/scanner.hpp>
|
||||
#include <components/compiler/locals.hpp>
|
||||
#include <components/compiler/output.hpp>
|
||||
#include <components/compiler/scriptparser.hpp>
|
||||
#include <components/interpreter/interpreter.hpp>
|
||||
|
||||
#include "../mwscript/compilercontext.hpp"
|
||||
#include "../mwscript/interpretercontext.hpp"
|
||||
#include <components/compiler/scriptparser.hpp>
|
||||
#include "../mwscript/extensions.hpp"
|
||||
|
||||
#include "../mwclass/npc.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
@ -121,24 +118,24 @@ namespace
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
bool checkGlobal (char comp, const std::string& name, T value, MWWorld::World& world)
|
||||
bool checkGlobal (char comp, const std::string& name, T value)
|
||||
{
|
||||
switch (world.getGlobalVariableType (name))
|
||||
switch (MWBase::Environment::get().getWorld()->getGlobalVariableType (name))
|
||||
{
|
||||
case 's':
|
||||
return selectCompare (comp, world.getGlobalVariable (name).mShort, value);
|
||||
return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mShort, value);
|
||||
|
||||
case 'l':
|
||||
|
||||
return selectCompare (comp, world.getGlobalVariable (name).mLong, value);
|
||||
return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mLong, value);
|
||||
|
||||
case 'f':
|
||||
|
||||
return selectCompare (comp, world.getGlobalVariable (name).mFloat, value);
|
||||
return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mFloat, value);
|
||||
|
||||
case ' ':
|
||||
|
||||
world.getGlobalVariable (name); // trigger exception
|
||||
MWBase::Environment::get().getWorld()->getGlobalVariable (name); // trigger exception
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -203,10 +200,10 @@ namespace MWDialogue
|
|||
MWMechanics::NpcStats PCstats = MWWorld::Class::get(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()).getNpcStats(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
MWMechanics::NpcStats NPCstats = MWWorld::Class::get(actor).getNpcStats(actor);
|
||||
int sameFaction = 0;
|
||||
if(!NPCstats.mFactionRank.empty())
|
||||
if(!NPCstats.getFactionRanks().empty())
|
||||
{
|
||||
std::string NPCFaction = NPCstats.mFactionRank.begin()->first;
|
||||
if(PCstats.mFactionRank.find(toLower(NPCFaction)) != PCstats.mFactionRank.end()) sameFaction = 1;
|
||||
std::string NPCFaction = NPCstats.getFactionRanks().begin()->first;
|
||||
if(PCstats.getFactionRanks().find(toLower(NPCFaction)) != PCstats.getFactionRanks().end()) sameFaction = 1;
|
||||
}
|
||||
if(!selectCompare<int,int>(comp,sameFaction,select.i)) return false;
|
||||
}
|
||||
|
@ -309,12 +306,12 @@ namespace MWDialogue
|
|||
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
|
||||
select.type==ESM::VT_Long)
|
||||
{
|
||||
if (!checkGlobal (comp, toLower (name), select.i, *MWBase::Environment::get().getWorld()))
|
||||
if (!checkGlobal (comp, toLower (name), select.i))
|
||||
return false;
|
||||
}
|
||||
else if (select.type==ESM::VT_Float)
|
||||
{
|
||||
if (!checkGlobal (comp, toLower (name), select.f, *MWBase::Environment::get().getWorld()))
|
||||
if (!checkGlobal (comp, toLower (name), select.f))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
@ -392,7 +389,7 @@ namespace MWDialogue
|
|||
|
||||
if(select.type==ESM::VT_Int)
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
|
||||
int isFaction = int(toLower(npc->base->faction) == toLower(name));
|
||||
if(selectCompare<int,int>(comp,!isFaction,select.i))
|
||||
return false;
|
||||
|
@ -409,7 +406,7 @@ namespace MWDialogue
|
|||
|
||||
if(select.type==ESM::VT_Int)
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
|
||||
int isClass = int(toLower(npc->base->cls) == toLower(name));
|
||||
if(selectCompare<int,int>(comp,!isClass,select.i))
|
||||
return false;
|
||||
|
@ -426,7 +423,7 @@ namespace MWDialogue
|
|||
|
||||
if(select.type==ESM::VT_Int)
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
|
||||
int isRace = int(toLower(npc->base->race) == toLower(name));
|
||||
if(selectCompare<int,int>(comp,!isRace,select.i))
|
||||
return false;
|
||||
|
@ -493,7 +490,7 @@ namespace MWDialogue
|
|||
if (isCreature)
|
||||
return false;
|
||||
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *cellRef = actor.get<ESM::NPC>();
|
||||
MWWorld::LiveCellRef<ESM::NPC> *cellRef = actor.get<ESM::NPC>();
|
||||
|
||||
if (!cellRef)
|
||||
return false;
|
||||
|
@ -508,7 +505,7 @@ namespace MWDialogue
|
|||
if (isCreature)
|
||||
return false;
|
||||
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *cellRef = actor.get<ESM::NPC>();
|
||||
MWWorld::LiveCellRef<ESM::NPC> *cellRef = actor.get<ESM::NPC>();
|
||||
|
||||
if (!cellRef)
|
||||
return false;
|
||||
|
@ -525,8 +522,8 @@ namespace MWDialogue
|
|||
|
||||
//MWWorld::Class npcClass = MWWorld::Class::get(actor);
|
||||
MWMechanics::NpcStats stats = MWWorld::Class::get(actor).getNpcStats(actor);
|
||||
std::map<std::string,int>::iterator it = stats.mFactionRank.find(toLower(info.npcFaction));
|
||||
if(it!=stats.mFactionRank.end())
|
||||
std::map<std::string,int>::iterator it = stats.getFactionRanks().find(toLower(info.npcFaction));
|
||||
if(it!=stats.getFactionRanks().end())
|
||||
{
|
||||
//check rank
|
||||
if(it->second < (int)info.data.rank) return false;
|
||||
|
@ -542,8 +539,8 @@ namespace MWDialogue
|
|||
if(!info.pcFaction.empty())
|
||||
{
|
||||
MWMechanics::NpcStats stats = MWWorld::Class::get(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()).getNpcStats(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
std::map<std::string,int>::iterator it = stats.mFactionRank.find(toLower(info.pcFaction));
|
||||
if(it!=stats.mFactionRank.end())
|
||||
std::map<std::string,int>::iterator it = stats.getFactionRanks().find(toLower(info.pcFaction));
|
||||
if(it!=stats.getFactionRanks().end())
|
||||
{
|
||||
//check rank
|
||||
if(it->second < (int)info.data.PCrank) return false;
|
||||
|
@ -558,7 +555,7 @@ namespace MWDialogue
|
|||
//check gender
|
||||
if (!isCreature)
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
|
||||
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
|
||||
if(npc->base->flags&npc->base->Female)
|
||||
{
|
||||
if(static_cast<int> (info.data.gender)==0) return false;
|
||||
|
@ -591,7 +588,7 @@ namespace MWDialogue
|
|||
mIsInChoice = false;
|
||||
mCompilerContext.setExtensions (&extensions);
|
||||
mDialogueMap.clear();
|
||||
actorKnownTopics.clear();
|
||||
mActorKnownTopics.clear();
|
||||
ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
|
||||
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
||||
{
|
||||
|
@ -599,26 +596,26 @@ namespace MWDialogue
|
|||
}
|
||||
}
|
||||
|
||||
void DialogueManager::addTopic(std::string topic)
|
||||
void DialogueManager::addTopic (const std::string& topic)
|
||||
{
|
||||
knownTopics[toLower(topic)] = true;
|
||||
mKnownTopics[toLower(topic)] = true;
|
||||
}
|
||||
|
||||
void DialogueManager::parseText(std::string text)
|
||||
void DialogueManager::parseText (std::string text)
|
||||
{
|
||||
std::list<std::string>::iterator it;
|
||||
for(it = actorKnownTopics.begin();it != actorKnownTopics.end();++it)
|
||||
for(it = mActorKnownTopics.begin();it != mActorKnownTopics.end();++it)
|
||||
{
|
||||
size_t pos = find_str_ci(text,*it,0);
|
||||
if(pos !=std::string::npos)
|
||||
{
|
||||
if(pos==0)
|
||||
{
|
||||
knownTopics[*it] = true;
|
||||
mKnownTopics[*it] = true;
|
||||
}
|
||||
else if(text.substr(pos -1,1) == " ")
|
||||
{
|
||||
knownTopics[*it] = true;
|
||||
mKnownTopics[*it] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -632,7 +629,7 @@ namespace MWDialogue
|
|||
|
||||
mActor = actor;
|
||||
|
||||
actorKnownTopics.clear();
|
||||
mActorKnownTopics.clear();
|
||||
|
||||
//initialise the GUI
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Dialogue);
|
||||
|
@ -706,7 +703,7 @@ namespace MWDialogue
|
|||
}
|
||||
return false;
|
||||
}
|
||||
catch (const Compiler::SourceException& error)
|
||||
catch (const Compiler::SourceException& /* error */)
|
||||
{
|
||||
// error has already been reported via error handler
|
||||
}
|
||||
|
@ -742,7 +739,7 @@ namespace MWDialogue
|
|||
std::list<std::string> keywordList;
|
||||
int choice = mChoice;
|
||||
mChoice = -1;
|
||||
actorKnownTopics.clear();
|
||||
mActorKnownTopics.clear();
|
||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||
ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
|
||||
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
||||
|
@ -755,9 +752,9 @@ namespace MWDialogue
|
|||
{
|
||||
if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true))
|
||||
{
|
||||
actorKnownTopics.push_back(toLower(it->first));
|
||||
mActorKnownTopics.push_back(toLower(it->first));
|
||||
//does the player know the topic?
|
||||
if(knownTopics.find(toLower(it->first)) != knownTopics.end())
|
||||
if(mKnownTopics.find(toLower(it->first)) != mKnownTopics.end())
|
||||
{
|
||||
keywordList.push_back(it->first);
|
||||
break;
|
||||
|
@ -771,13 +768,13 @@ namespace MWDialogue
|
|||
int services = 0;
|
||||
if (mActor.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* ref = mActor.get<ESM::NPC>();
|
||||
MWWorld::LiveCellRef<ESM::NPC>* ref = mActor.get<ESM::NPC>();
|
||||
if (ref->base->hasAI)
|
||||
services = ref->base->AI.services;
|
||||
}
|
||||
else if (mActor.getTypeName() == typeid(ESM::Creature).name())
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData>* ref = mActor.get<ESM::Creature>();
|
||||
MWWorld::LiveCellRef<ESM::Creature>* ref = mActor.get<ESM::Creature>();
|
||||
if (ref->base->hasAI)
|
||||
services = ref->base->AI.services;
|
||||
}
|
||||
|
@ -804,7 +801,7 @@ namespace MWDialogue
|
|||
mChoice = choice;
|
||||
}
|
||||
|
||||
void DialogueManager::keywordSelected(std::string keyword)
|
||||
void DialogueManager::keywordSelected (const std::string& keyword)
|
||||
{
|
||||
if(!mIsInChoice)
|
||||
{
|
||||
|
@ -846,11 +843,11 @@ namespace MWDialogue
|
|||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);
|
||||
}
|
||||
|
||||
void DialogueManager::questionAnswered(std::string answere)
|
||||
void DialogueManager::questionAnswered (const std::string& answer)
|
||||
{
|
||||
if(mChoiceMap.find(answere) != mChoiceMap.end())
|
||||
if(mChoiceMap.find(answer) != mChoiceMap.end())
|
||||
{
|
||||
mChoice = mChoiceMap[answere];
|
||||
mChoice = mChoiceMap[answer];
|
||||
|
||||
std::vector<ESM::DialInfo>::const_iterator iter;
|
||||
if(mDialogueMap.find(mLastTopic) != mDialogueMap.end())
|
||||
|
@ -882,13 +879,13 @@ namespace MWDialogue
|
|||
}
|
||||
}
|
||||
|
||||
void DialogueManager::printError(std::string error)
|
||||
void DialogueManager::printError (std::string error)
|
||||
{
|
||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||
win->addText(error);
|
||||
}
|
||||
|
||||
void DialogueManager::askQuestion(std::string question, int choice)
|
||||
void DialogueManager::askQuestion (const std::string& question, int choice)
|
||||
{
|
||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||
win->askQuestion(question);
|
||||
|
@ -896,20 +893,20 @@ namespace MWDialogue
|
|||
mIsInChoice = true;
|
||||
}
|
||||
|
||||
std::string DialogueManager::getFaction()
|
||||
std::string DialogueManager::getFaction() const
|
||||
{
|
||||
if (mActor.getTypeName() != typeid(ESM::NPC).name())
|
||||
return "";
|
||||
|
||||
std::string factionID("");
|
||||
MWMechanics::NpcStats stats = MWWorld::Class::get(mActor).getNpcStats(mActor);
|
||||
if(stats.mFactionRank.empty())
|
||||
if(stats.getFactionRanks().empty())
|
||||
{
|
||||
std::cout << "No faction for this actor!";
|
||||
}
|
||||
else
|
||||
{
|
||||
factionID = stats.mFactionRank.begin()->first;
|
||||
factionID = stats.getFactionRanks().begin()->first;
|
||||
}
|
||||
return factionID;
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
#ifndef GAME_MMDIALOG_DIALOGUEMANAGER_H
|
||||
#define GAME_MWDIALOG_DIALOGUEMANAGER_H
|
||||
#ifndef GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
||||
#define GAME_MWDIALOG_DIALOGUEMANAGERIMP_H
|
||||
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
|
||||
#include <components/esm/loadinfo.hpp>
|
||||
|
||||
|
@ -9,11 +11,12 @@
|
|||
#include <components/compiler/output.hpp>
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
class DialogueManager
|
||||
class DialogueManager : public MWBase::DialogueManager
|
||||
{
|
||||
bool isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo::SelectStruct& select) const;
|
||||
|
||||
|
@ -26,8 +29,8 @@ namespace MWDialogue
|
|||
void updateTopics();
|
||||
|
||||
std::map<std::string,ESM::Dialogue> mDialogueMap;
|
||||
std::map<std::string,bool> knownTopics;// Those are the topics the player knows.
|
||||
std::list<std::string> actorKnownTopics;
|
||||
std::map<std::string,bool> mKnownTopics;// Those are the topics the player knows.
|
||||
std::list<std::string> mActorKnownTopics;
|
||||
|
||||
MWScript::CompilerContext mCompilerContext;
|
||||
std::ostream mErrorStream;
|
||||
|
@ -50,21 +53,21 @@ namespace MWDialogue
|
|||
|
||||
DialogueManager (const Compiler::Extensions& extensions);
|
||||
|
||||
void startDialogue (const MWWorld::Ptr& actor);
|
||||
virtual void startDialogue (const MWWorld::Ptr& actor);
|
||||
|
||||
void addTopic(std::string topic);
|
||||
virtual void addTopic (const std::string& topic);
|
||||
|
||||
void askQuestion(std::string question,int choice);
|
||||
virtual void askQuestion (const std::string& question,int choice);
|
||||
|
||||
void goodbye();
|
||||
virtual void goodbye();
|
||||
|
||||
///get the faction of the actor you are talking with
|
||||
std::string getFaction();
|
||||
virtual std::string getFaction() const;
|
||||
|
||||
//calbacks for the GUI
|
||||
void keywordSelected(std::string keyword);
|
||||
void goodbyeSelected();
|
||||
void questionAnswered(std::string answere);
|
||||
virtual void keywordSelected (const std::string& keyword);
|
||||
virtual void goodbyeSelected();
|
||||
virtual void questionAnswered (const std::string& answer);
|
||||
|
||||
};
|
||||
}
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
|
@ -27,16 +28,14 @@ namespace MWDialogue
|
|||
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
|
||||
}
|
||||
|
||||
JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index,
|
||||
const MWWorld::World& world)
|
||||
JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index)
|
||||
{
|
||||
return JournalEntry (topic, idFromIndex (topic, index, world));
|
||||
return JournalEntry (topic, idFromIndex (topic, index));
|
||||
}
|
||||
|
||||
std::string JournalEntry::idFromIndex (const std::string& topic, int index,
|
||||
const MWWorld::World& world)
|
||||
std::string JournalEntry::idFromIndex (const std::string& topic, int index)
|
||||
{
|
||||
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (topic);
|
||||
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (topic);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
|
@ -57,13 +56,12 @@ namespace MWDialogue
|
|||
: JournalEntry (topic, infoId), mDay (day), mMonth (month), mDayOfMonth (dayOfMonth)
|
||||
{}
|
||||
|
||||
StampedJournalEntry StampedJournalEntry::makeFromQuest (const std::string& topic, int index,
|
||||
const MWWorld::World& world)
|
||||
StampedJournalEntry StampedJournalEntry::makeFromQuest (const std::string& topic, int index)
|
||||
{
|
||||
int day = world.getGlobalVariable ("dayspassed").mLong;
|
||||
int month = world.getGlobalVariable ("day").mLong;
|
||||
int dayOfMonth = world.getGlobalVariable ("month").mLong;
|
||||
int day = MWBase::Environment::get().getWorld()->getGlobalVariable ("dayspassed").mLong;
|
||||
int month = MWBase::Environment::get().getWorld()->getGlobalVariable ("day").mLong;
|
||||
int dayOfMonth = MWBase::Environment::get().getWorld()->getGlobalVariable ("month").mLong;
|
||||
|
||||
return StampedJournalEntry (topic, idFromIndex (topic, index, world), day, month, dayOfMonth);
|
||||
return StampedJournalEntry (topic, idFromIndex (topic, index), day, month, dayOfMonth);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef GAME_MMDIALOGUE_JOURNALENTRY_H
|
||||
#define GAME_MMDIALOGUE_JOURNALENTRY_H
|
||||
#ifndef GAME_MWDIALOGUE_JOURNALENTRY_H
|
||||
#define GAME_MWDIALOGUE_JOURNALENTRY_H
|
||||
|
||||
#include <string>
|
||||
|
||||
|
@ -8,11 +8,6 @@ namespace ESMS
|
|||
struct ESMStore;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class World;
|
||||
}
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
/// \brief A quest or dialogue entry
|
||||
|
@ -27,11 +22,9 @@ namespace MWDialogue
|
|||
|
||||
std::string getText (const ESMS::ESMStore& store) const;
|
||||
|
||||
static JournalEntry makeFromQuest (const std::string& topic, int index,
|
||||
const MWWorld::World& world);
|
||||
static JournalEntry makeFromQuest (const std::string& topic, int index);
|
||||
|
||||
static std::string idFromIndex (const std::string& topic, int index,
|
||||
const MWWorld::World& world);
|
||||
static std::string idFromIndex (const std::string& topic, int index);
|
||||
};
|
||||
|
||||
/// \biref A quest entry with a timestamp.
|
||||
|
@ -46,8 +39,7 @@ namespace MWDialogue
|
|||
StampedJournalEntry (const std::string& topic, const std::string& infoId,
|
||||
int day, int month, int dayOfMonth);
|
||||
|
||||
static StampedJournalEntry makeFromQuest (const std::string& topic, int index,
|
||||
const MWWorld::World& world);
|
||||
static StampedJournalEntry makeFromQuest (const std::string& topic, int index);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
|
||||
#include "journal.hpp"
|
||||
#include "journalimp.hpp"
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
#include "../mwgui/messagebox.hpp"
|
||||
|
||||
#include "../mwworld/world.hpp"
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
Quest& Journal::getQuest (const std::string& id)
|
||||
|
@ -30,14 +31,13 @@ namespace MWDialogue
|
|||
|
||||
void Journal::addEntry (const std::string& id, int index)
|
||||
{
|
||||
StampedJournalEntry entry =
|
||||
StampedJournalEntry::makeFromQuest (id, index, *MWBase::Environment::get().getWorld());
|
||||
StampedJournalEntry entry = StampedJournalEntry::makeFromQuest (id, index);
|
||||
|
||||
mJournal.push_back (entry);
|
||||
|
||||
Quest& quest = getQuest (id);
|
||||
|
||||
quest.addEntry (entry, *MWBase::Environment::get().getWorld()); // we are doing slicing on purpose here
|
||||
quest.addEntry (entry); // we are doing slicing on purpose here
|
||||
|
||||
std::vector<std::string> empty;
|
||||
std::string notification = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sJournalEntry")->str;
|
||||
|
@ -48,7 +48,7 @@ namespace MWDialogue
|
|||
{
|
||||
Quest& quest = getQuest (id);
|
||||
|
||||
quest.setIndex (index, *MWBase::Environment::get().getWorld());
|
||||
quest.setIndex (index);
|
||||
}
|
||||
|
||||
void Journal::addTopic (const std::string& topicId, const std::string& infoId)
|
||||
|
@ -63,7 +63,7 @@ namespace MWDialogue
|
|||
iter = result.first;
|
||||
}
|
||||
|
||||
iter->second.addEntry (JournalEntry (topicId, infoId), *MWBase::Environment::get().getWorld());
|
||||
iter->second.addEntry (JournalEntry (topicId, infoId));
|
||||
}
|
||||
|
||||
int Journal::getJournalIndex (const std::string& id) const
|
|
@ -1,9 +1,7 @@
|
|||
#ifndef GAME_MMDIALOG_JOURNAL_H
|
||||
#ifndef GAME_MWDIALOG_JOURNAL_H
|
||||
#define GAME_MWDIALOG_JOURNAL_H
|
||||
|
||||
#include <string>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include "../mwbase/journal.hpp"
|
||||
|
||||
#include "journalentry.hpp"
|
||||
#include "quest.hpp"
|
||||
|
@ -11,19 +9,8 @@
|
|||
namespace MWDialogue
|
||||
{
|
||||
/// \brief The player's journal
|
||||
class Journal
|
||||
class Journal : public MWBase::Journal
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::deque<StampedJournalEntry> TEntryContainer;
|
||||
typedef TEntryContainer::const_iterator TEntryIter;
|
||||
typedef std::map<std::string, Quest> TQuestContainer; // topc, quest
|
||||
typedef TQuestContainer::const_iterator TQuestIter;
|
||||
typedef std::map<std::string, Topic> TTopicContainer; // topic-id, topic-content
|
||||
typedef TTopicContainer::const_iterator TTopicIter;
|
||||
|
||||
private:
|
||||
|
||||
TEntryContainer mJournal;
|
||||
TQuestContainer mQuests;
|
||||
TTopicContainer mTopics;
|
||||
|
@ -34,37 +21,37 @@ namespace MWDialogue
|
|||
|
||||
Journal();
|
||||
|
||||
void addEntry (const std::string& id, int index);
|
||||
virtual void addEntry (const std::string& id, int index);
|
||||
///< Add a journal entry.
|
||||
|
||||
void setJournalIndex (const std::string& id, int index);
|
||||
virtual void setJournalIndex (const std::string& id, int index);
|
||||
///< Set the journal index without adding an entry.
|
||||
|
||||
int getJournalIndex (const std::string& id) const;
|
||||
virtual int getJournalIndex (const std::string& id) const;
|
||||
///< Get the journal index.
|
||||
|
||||
void addTopic (const std::string& topicId, const std::string& infoId);
|
||||
virtual void addTopic (const std::string& topicId, const std::string& infoId);
|
||||
|
||||
TEntryIter begin() const;
|
||||
virtual TEntryIter begin() const;
|
||||
///< Iterator pointing to the begin of the main journal.
|
||||
///
|
||||
/// \note Iterators to main journal entries will never become invalid.
|
||||
|
||||
TEntryIter end() const;
|
||||
virtual TEntryIter end() const;
|
||||
///< Iterator pointing past the end of the main journal.
|
||||
|
||||
TQuestIter questBegin() const;
|
||||
virtual TQuestIter questBegin() const;
|
||||
///< Iterator pointing to the first quest (sorted by topic ID)
|
||||
|
||||
TQuestIter questEnd() const;
|
||||
virtual TQuestIter questEnd() const;
|
||||
///< Iterator pointing past the last quest.
|
||||
|
||||
TTopicIter topicBegin() const;
|
||||
virtual TTopicIter topicBegin() const;
|
||||
///< Iterator pointing to the first topic (sorted by topic ID)
|
||||
///
|
||||
/// \note The topic ID is identical with the user-visible topic string.
|
||||
|
||||
TTopicIter topicEnd() const;
|
||||
virtual TTopicIter topicEnd() const;
|
||||
///< Iterator pointing past the last topic.
|
||||
};
|
||||
}
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
|
@ -15,9 +16,9 @@ namespace MWDialogue
|
|||
: Topic (topic), mIndex (0), mFinished (false)
|
||||
{}
|
||||
|
||||
const std::string Quest::getName (const MWWorld::World& world) const
|
||||
const std::string Quest::getName() const
|
||||
{
|
||||
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (mTopic);
|
||||
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
|
@ -32,9 +33,9 @@ namespace MWDialogue
|
|||
return mIndex;
|
||||
}
|
||||
|
||||
void Quest::setIndex (int index, const MWWorld::World& world)
|
||||
void Quest::setIndex (int index)
|
||||
{
|
||||
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (mTopic);
|
||||
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
|
@ -58,11 +59,11 @@ namespace MWDialogue
|
|||
return mFinished;
|
||||
}
|
||||
|
||||
void Quest::addEntry (const JournalEntry& entry, const MWWorld::World& world)
|
||||
void Quest::addEntry (const JournalEntry& entry)
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (entry.mTopic);
|
||||
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (entry.mTopic);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
|
@ -75,7 +76,7 @@ namespace MWDialogue
|
|||
if (index==-1)
|
||||
throw std::runtime_error ("unknown journal entry for topic " + mTopic);
|
||||
|
||||
setIndex (index, world);
|
||||
setIndex (index);
|
||||
|
||||
for (TEntryIter iter (mEntries.begin()); iter!=mEntries.end(); ++iter)
|
||||
if (*iter==entry.mInfoId)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef GAME_MMDIALOG_QUEST_H
|
||||
#ifndef GAME_MWDIALOG_QUEST_H
|
||||
#define GAME_MWDIALOG_QUEST_H
|
||||
|
||||
#include "topic.hpp"
|
||||
|
@ -17,17 +17,17 @@ namespace MWDialogue
|
|||
|
||||
Quest (const std::string& topic);
|
||||
|
||||
const std::string getName (const MWWorld::World& world) const;
|
||||
const std::string getName() const;
|
||||
///< May be an empty string
|
||||
|
||||
int getIndex() const;
|
||||
|
||||
void setIndex (int index, const MWWorld::World& world);
|
||||
void setIndex (int index);
|
||||
///< Calling this function with a non-existant index while throw an exception.
|
||||
|
||||
bool isFinished() const;
|
||||
|
||||
virtual void addEntry (const JournalEntry& entry, const MWWorld::World& world);
|
||||
virtual void addEntry (const JournalEntry& entry);
|
||||
///< Add entry and adjust index accordingly.
|
||||
///
|
||||
/// \note Redundant entries are ignored, but the index is still adjusted.
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwworld/world.hpp"
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
Topic::Topic()
|
||||
|
@ -17,7 +15,7 @@ namespace MWDialogue
|
|||
Topic::~Topic()
|
||||
{}
|
||||
|
||||
void Topic::addEntry (const JournalEntry& entry, const MWWorld::World& world)
|
||||
void Topic::addEntry (const JournalEntry& entry)
|
||||
{
|
||||
if (entry.mTopic!=mTopic)
|
||||
throw std::runtime_error ("topic does not match: " + mTopic);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef GAME_MMDIALOG_TOPIC_H
|
||||
#ifndef GAME_MWDIALOG_TOPIC_H
|
||||
#define GAME_MWDIALOG_TOPIC_H
|
||||
|
||||
#include <string>
|
||||
|
@ -6,11 +6,6 @@
|
|||
|
||||
#include "journalentry.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class World;
|
||||
}
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
/// \brief Collection of seen responses for a topic
|
||||
|
@ -34,7 +29,7 @@ namespace MWDialogue
|
|||
|
||||
virtual ~Topic();
|
||||
|
||||
virtual void addEntry (const JournalEntry& entry, const MWWorld::World& world);
|
||||
virtual void addEntry (const JournalEntry& entry);
|
||||
///< Add entry
|
||||
///
|
||||
/// \note Redundant entries are ignored.
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -26,8 +26,8 @@ namespace
|
|||
|
||||
namespace MWGui
|
||||
{
|
||||
AlchemyWindow::AlchemyWindow(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_alchemy_window_layout.xml", parWindowManager)
|
||||
AlchemyWindow::AlchemyWindow(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_alchemy_window.layout", parWindowManager)
|
||||
, ContainerBase(0)
|
||||
{
|
||||
getWidget(mCreateButton, "CreateButton");
|
||||
|
@ -275,7 +275,7 @@ namespace MWGui
|
|||
for (MWWorld::ContainerStoreIterator it(store.begin(MWWorld::ContainerStore::Type_Apparatus));
|
||||
it != store.end(); ++it)
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData>* ref = it->get<ESM::Apparatus>();
|
||||
MWWorld::LiveCellRef<ESM::Apparatus>* ref = it->get<ESM::Apparatus>();
|
||||
if (ref->base->data.type == ESM::Apparatus::Albemic
|
||||
&& (bestAlbemic.isEmpty() || ref->base->data.quality > bestAlbemic.get<ESM::Apparatus>()->base->data.quality))
|
||||
bestAlbemic = *it;
|
||||
|
@ -420,7 +420,7 @@ namespace MWGui
|
|||
continue;
|
||||
|
||||
// add the effects of this ingredient to list of effects
|
||||
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData>* ref = ingredient->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>();
|
||||
MWWorld::LiveCellRef<ESM::Ingredient>* ref = ingredient->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>();
|
||||
for (int i=0; i<4; ++i)
|
||||
{
|
||||
if (ref->base->data.effectID[i] < 0)
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
|
||||
#include "window_base.hpp"
|
||||
#include "container.hpp"
|
||||
#include "widgets.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class AlchemyWindow : public WindowBase, public ContainerBase
|
||||
{
|
||||
public:
|
||||
AlchemyWindow(WindowManager& parWindowManager);
|
||||
AlchemyWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
virtual void open();
|
||||
|
||||
|
|
|
@ -1,29 +1,34 @@
|
|||
#include "birth.hpp"
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
using namespace Widgets;
|
||||
|
||||
BirthDialog::BirthDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_birth_layout.xml", parWindowManager)
|
||||
BirthDialog::BirthDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_birth.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
||||
getWidget(spellArea, "SpellArea");
|
||||
getWidget(mSpellArea, "SpellArea");
|
||||
|
||||
getWidget(birthImage, "BirthsignImage");
|
||||
getWidget(mBirthImage, "BirthsignImage");
|
||||
|
||||
getWidget(birthList, "BirthsignList");
|
||||
birthList->setScrollVisible(true);
|
||||
birthList->eventListSelectAccept += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
|
||||
birthList->eventListMouseItemActivate += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
|
||||
birthList->eventListChangePosition += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
|
||||
getWidget(mBirthList, "BirthsignList");
|
||||
mBirthList->setScrollVisible(true);
|
||||
mBirthList->eventListSelectAccept += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
|
||||
mBirthList->eventListMouseItemActivate += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
|
||||
mBirthList->eventListChangePosition += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
|
||||
|
||||
MyGUI::ButtonPtr backButton;
|
||||
getWidget(backButton, "BackButton");
|
||||
|
@ -68,14 +73,14 @@ void BirthDialog::open()
|
|||
|
||||
void BirthDialog::setBirthId(const std::string &birthId)
|
||||
{
|
||||
currentBirthId = birthId;
|
||||
birthList->setIndexSelected(MyGUI::ITEM_NONE);
|
||||
size_t count = birthList->getItemCount();
|
||||
mCurrentBirthId = birthId;
|
||||
mBirthList->setIndexSelected(MyGUI::ITEM_NONE);
|
||||
size_t count = mBirthList->getItemCount();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
if (boost::iequals(*birthList->getItemDataAt<std::string>(i), birthId))
|
||||
if (boost::iequals(*mBirthList->getItemDataAt<std::string>(i), birthId))
|
||||
{
|
||||
birthList->setIndexSelected(i);
|
||||
mBirthList->setIndexSelected(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -100,11 +105,11 @@ void BirthDialog::onSelectBirth(MyGUI::ListBox* _sender, size_t _index)
|
|||
if (_index == MyGUI::ITEM_NONE)
|
||||
return;
|
||||
|
||||
const std::string *birthId = birthList->getItemDataAt<std::string>(_index);
|
||||
if (boost::iequals(currentBirthId, *birthId))
|
||||
const std::string *birthId = mBirthList->getItemDataAt<std::string>(_index);
|
||||
if (boost::iequals(mCurrentBirthId, *birthId))
|
||||
return;
|
||||
|
||||
currentBirthId = *birthId;
|
||||
mCurrentBirthId = *birthId;
|
||||
updateSpells();
|
||||
}
|
||||
|
||||
|
@ -112,9 +117,9 @@ void BirthDialog::onSelectBirth(MyGUI::ListBox* _sender, size_t _index)
|
|||
|
||||
void BirthDialog::updateBirths()
|
||||
{
|
||||
birthList->removeAllItems();
|
||||
mBirthList->removeAllItems();
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator it = store.birthSigns.list.begin();
|
||||
ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator end = store.birthSigns.list.end();
|
||||
|
@ -122,34 +127,34 @@ void BirthDialog::updateBirths()
|
|||
for (; it != end; ++it)
|
||||
{
|
||||
const ESM::BirthSign &birth = it->second;
|
||||
birthList->addItem(birth.name, it->first);
|
||||
if (boost::iequals(it->first, currentBirthId))
|
||||
birthList->setIndexSelected(index);
|
||||
mBirthList->addItem(birth.name, it->first);
|
||||
if (boost::iequals(it->first, mCurrentBirthId))
|
||||
mBirthList->setIndexSelected(index);
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
void BirthDialog::updateSpells()
|
||||
{
|
||||
for (std::vector<MyGUI::WidgetPtr>::iterator it = spellItems.begin(); it != spellItems.end(); ++it)
|
||||
for (std::vector<MyGUI::WidgetPtr>::iterator it = mSpellItems.begin(); it != mSpellItems.end(); ++it)
|
||||
{
|
||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||
}
|
||||
spellItems.clear();
|
||||
mSpellItems.clear();
|
||||
|
||||
if (currentBirthId.empty())
|
||||
if (mCurrentBirthId.empty())
|
||||
return;
|
||||
|
||||
MWSpellPtr spellWidget;
|
||||
const int lineHeight = 18;
|
||||
MyGUI::IntCoord coord(0, 0, spellArea->getWidth(), 18);
|
||||
MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), 18);
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESM::BirthSign *birth = store.birthSigns.find(currentBirthId);
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::BirthSign *birth = store.birthSigns.find(mCurrentBirthId);
|
||||
|
||||
std::string texturePath = std::string("textures\\") + birth->texture;
|
||||
fixTexturePath(texturePath);
|
||||
birthImage->setImageTexture(texturePath);
|
||||
mBirthImage->setImageTexture(texturePath);
|
||||
|
||||
std::vector<std::string> abilities, powers, spells;
|
||||
|
||||
|
@ -183,25 +188,25 @@ void BirthDialog::updateSpells()
|
|||
{
|
||||
if (!categories[category].spells.empty())
|
||||
{
|
||||
MyGUI::TextBox* label = spellArea->createWidget<MyGUI::TextBox>("SandBrightText", coord, MyGUI::Align::Default, std::string("Label"));
|
||||
MyGUI::TextBox* label = mSpellArea->createWidget<MyGUI::TextBox>("SandBrightText", coord, MyGUI::Align::Default, std::string("Label"));
|
||||
label->setCaption(mWindowManager.getGameSettingString(categories[category].label, ""));
|
||||
spellItems.push_back(label);
|
||||
mSpellItems.push_back(label);
|
||||
coord.top += lineHeight;
|
||||
|
||||
std::vector<std::string>::const_iterator end = categories[category].spells.end();
|
||||
for (std::vector<std::string>::const_iterator it = categories[category].spells.begin(); it != end; ++it)
|
||||
{
|
||||
const std::string &spellId = *it;
|
||||
spellWidget = spellArea->createWidget<MWSpell>("MW_StatName", coord, MyGUI::Align::Default, std::string("Spell") + boost::lexical_cast<std::string>(i));
|
||||
spellWidget = mSpellArea->createWidget<MWSpell>("MW_StatName", coord, MyGUI::Align::Default, std::string("Spell") + boost::lexical_cast<std::string>(i));
|
||||
spellWidget->setWindowManager(&mWindowManager);
|
||||
spellWidget->setSpellId(spellId);
|
||||
|
||||
spellItems.push_back(spellWidget);
|
||||
mSpellItems.push_back(spellWidget);
|
||||
coord.top += lineHeight;
|
||||
|
||||
MyGUI::IntCoord spellCoord = coord;
|
||||
spellCoord.height = 24; // TODO: This should be fetched from the skin somehow, or perhaps a widget in the layout as a template?
|
||||
spellWidget->createEffectWidgets(spellItems, spellArea, spellCoord, (category == 0) ? MWEffectList::EF_Constant : 0);
|
||||
spellWidget->createEffectWidgets(mSpellItems, mSpellArea, spellCoord, (category == 0) ? MWEffectList::EF_Constant : 0);
|
||||
coord.top = spellCoord.top;
|
||||
|
||||
++i;
|
||||
|
|
|
@ -5,19 +5,18 @@
|
|||
|
||||
/*
|
||||
This file contains the dialog for choosing a birth sign.
|
||||
Layout is defined by resources/mygui/openmw_chargen_race_layout.xml.
|
||||
Layout is defined by resources/mygui/openmw_chargen_race.layout.
|
||||
*/
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
/// \todo remove
|
||||
using namespace MyGUI;
|
||||
|
||||
class WindowManager;
|
||||
|
||||
class BirthDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
BirthDialog(WindowManager& parWindowManager);
|
||||
BirthDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
enum Gender
|
||||
{
|
||||
|
@ -25,7 +24,7 @@ namespace MWGui
|
|||
GM_Female
|
||||
};
|
||||
|
||||
const std::string &getBirthId() const { return currentBirthId; }
|
||||
const std::string &getBirthId() const { return mCurrentBirthId; }
|
||||
void setBirthId(const std::string &raceId);
|
||||
|
||||
void setNextButtonShow(bool shown);
|
||||
|
@ -49,12 +48,12 @@ namespace MWGui
|
|||
void updateBirths();
|
||||
void updateSpells();
|
||||
|
||||
MyGUI::ListBox* birthList;
|
||||
MyGUI::WidgetPtr spellArea;
|
||||
MyGUI::ImageBox* birthImage;
|
||||
std::vector<MyGUI::WidgetPtr> spellItems;
|
||||
MyGUI::ListBox* mBirthList;
|
||||
MyGUI::WidgetPtr mSpellArea;
|
||||
MyGUI::ImageBox* mBirthImage;
|
||||
std::vector<MyGUI::WidgetPtr> mSpellItems;
|
||||
|
||||
std::string currentBirthId;
|
||||
std::string mCurrentBirthId;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -3,17 +3,19 @@
|
|||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "formatting.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
BookWindow::BookWindow (WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_book_layout.xml", parWindowManager)
|
||||
BookWindow::BookWindow (MWBase::WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_book.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mCloseButton, "CloseButton");
|
||||
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BookWindow::onCloseButtonClicked);
|
||||
|
@ -55,8 +57,7 @@ void BookWindow::open (MWWorld::Ptr book)
|
|||
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0);
|
||||
|
||||
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
|
||||
mBook.get<ESM::Book>();
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>();
|
||||
|
||||
BookTextParser parser;
|
||||
std::vector<std::string> results = parser.split(ref->base->text, mLeftPage->getSize().width, mLeftPage->getSize().height);
|
||||
|
@ -97,10 +98,10 @@ void BookWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
|
|||
|
||||
void BookWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Book Up", 1.0, 1.0, MWSound::Play_NoTrack);
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Book Up", 1.0, 1.0, MWBase::SoundManager::Play_NoTrack);
|
||||
|
||||
MWWorld::ActionTake take(mBook);
|
||||
take.execute();
|
||||
take.execute (MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||
|
||||
mWindowManager.removeGuiMode(GM_Book);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace MWGui
|
|||
class BookWindow : public WindowBase
|
||||
{
|
||||
public:
|
||||
BookWindow(WindowManager& parWindowManager);
|
||||
BookWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
void open(MWWorld::Ptr book);
|
||||
void setTakeButtonShow(bool show);
|
||||
|
@ -43,4 +43,3 @@ namespace MWGui
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
#include "mode.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -103,11 +104,19 @@ namespace
|
|||
{ESM::Class::Combat, ESM::Class::Magic, ESM::Class::Stealth}
|
||||
}
|
||||
} };
|
||||
|
||||
struct ClassPoint
|
||||
{
|
||||
const char *id;
|
||||
// Specialization points to match, in order: Stealth, Combat, Magic
|
||||
// Note: Order is taken from http://www.uesp.net/wiki/Morrowind:Class_Quiz
|
||||
unsigned int points[3];
|
||||
};
|
||||
}
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
CharacterCreation::CharacterCreation(WindowManager* _wm)
|
||||
CharacterCreation::CharacterCreation(MWBase::WindowManager* _wm)
|
||||
: mNameDialog(0)
|
||||
, mRaceDialog(0)
|
||||
, mClassChoiceDialog(0)
|
||||
|
@ -178,8 +187,8 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
switch (id)
|
||||
{
|
||||
case GM_Name:
|
||||
if(mNameDialog)
|
||||
mWM->removeDialog(mNameDialog);
|
||||
mWM->removeDialog(mNameDialog);
|
||||
mNameDialog = 0;
|
||||
mNameDialog = new TextInputDialog(*mWM);
|
||||
mNameDialog->setTextLabel(mWM->getGameSettingString("sName", "Name"));
|
||||
mNameDialog->setTextInput(mPlayerName);
|
||||
|
@ -189,8 +198,8 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_Race:
|
||||
if (mRaceDialog)
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
mRaceDialog = new RaceDialog(*mWM);
|
||||
mRaceDialog->setNextButtonShow(mCreationStage >= CSE_RaceChosen);
|
||||
mRaceDialog->setRaceId(mPlayerRaceId);
|
||||
|
@ -200,16 +209,16 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_Class:
|
||||
if (mClassChoiceDialog)
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
mClassChoiceDialog = 0;
|
||||
mClassChoiceDialog = new ClassChoiceDialog(*mWM);
|
||||
mClassChoiceDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassChoice);
|
||||
mClassChoiceDialog->open();
|
||||
break;
|
||||
|
||||
case GM_ClassPick:
|
||||
if (mPickClassDialog)
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
mPickClassDialog = new PickClassDialog(*mWM);
|
||||
mPickClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
||||
mPickClassDialog->setClassId(mPlayerClass.name);
|
||||
|
@ -219,8 +228,8 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_Birth:
|
||||
if (mBirthSignDialog)
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
mBirthSignDialog = new BirthDialog(*mWM);
|
||||
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
|
||||
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
|
||||
|
@ -229,8 +238,8 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
break;
|
||||
|
||||
case GM_ClassCreate:
|
||||
if (mCreateClassDialog)
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
mCreateClassDialog = new CreateClassDialog(*mWM);
|
||||
mCreateClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
|
||||
mCreateClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogDone);
|
||||
|
@ -246,8 +255,8 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
showClassQuestionDialog();
|
||||
break;
|
||||
case GM_Review:
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
mReviewDialog = new ReviewDialog(*mWM);
|
||||
mReviewDialog->setPlayerName(mPlayerName);
|
||||
mReviewDialog->setRace(mPlayerRaceId);
|
||||
|
@ -259,20 +268,20 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
mReviewDialog->setFatigue(mPlayerFatigue);
|
||||
|
||||
{
|
||||
std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> > attributes = mWM->getPlayerAttributeValues();
|
||||
for (std::map<ESM::Attribute::AttributeID, MWMechanics::Stat<int> >::iterator it = attributes.begin();
|
||||
std::map<int, MWMechanics::Stat<int> > attributes = mWM->getPlayerAttributeValues();
|
||||
for (std::map<int, MWMechanics::Stat<int> >::iterator it = attributes.begin();
|
||||
it != attributes.end(); ++it)
|
||||
{
|
||||
mReviewDialog->setAttribute(it->first, it->second);
|
||||
mReviewDialog->setAttribute(static_cast<ESM::Attribute::AttributeID> (it->first), it->second);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> > skills = mWM->getPlayerSkillValues();
|
||||
for (std::map<ESM::Skill::SkillEnum, MWMechanics::Stat<float> >::iterator it = skills.begin();
|
||||
std::map<int, MWMechanics::Stat<float> > skills = mWM->getPlayerSkillValues();
|
||||
for (std::map<int, MWMechanics::Stat<float> >::iterator it = skills.begin();
|
||||
it != skills.end(); ++it)
|
||||
{
|
||||
mReviewDialog->setSkillValue(it->first, it->second);
|
||||
mReviewDialog->setSkillValue(static_cast<ESM::Skill::SkillEnum> (it->first), it->second);
|
||||
}
|
||||
mReviewDialog->configureSkills(mWM->getPlayerMajorSkills(), mWM->getPlayerMinorSkills());
|
||||
}
|
||||
|
@ -302,24 +311,24 @@ void CharacterCreation::setPlayerFatigue (const MWMechanics::DynamicStat<int>& v
|
|||
|
||||
void CharacterCreation::onReviewDialogDone(WindowBase* parWindow)
|
||||
{
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
}
|
||||
|
||||
void CharacterCreation::onReviewDialogBack()
|
||||
{
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
|
||||
mWM->pushGuiMode(GM_Birth);
|
||||
}
|
||||
|
||||
void CharacterCreation::onReviewActivateDialog(int parDialog)
|
||||
{
|
||||
if (mReviewDialog)
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mWM->removeDialog(mReviewDialog);
|
||||
mReviewDialog = 0;
|
||||
mCreationStage = CSE_ReviewNext;
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -354,6 +363,7 @@ void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow)
|
|||
mWM->setPlayerClass(mPlayerClass);
|
||||
}
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
}
|
||||
|
||||
//TODO This bit gets repeated a few times; wrap it in a function
|
||||
|
@ -382,6 +392,7 @@ void CharacterCreation::onPickClassDialogBack()
|
|||
if (!classId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
|
||||
mWM->removeDialog(mPickClassDialog);
|
||||
mPickClassDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -390,10 +401,8 @@ void CharacterCreation::onPickClassDialogBack()
|
|||
|
||||
void CharacterCreation::onClassChoice(int _index)
|
||||
{
|
||||
if (mClassChoiceDialog)
|
||||
{
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
}
|
||||
mWM->removeDialog(mClassChoiceDialog);
|
||||
mClassChoiceDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
||||
|
@ -423,6 +432,7 @@ void CharacterCreation::onNameDialogDone(WindowBase* parWindow)
|
|||
mWM->setValue("name", mPlayerName);
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerName(mPlayerName);
|
||||
mWM->removeDialog(mNameDialog);
|
||||
mNameDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
|
@ -450,6 +460,7 @@ void CharacterCreation::onRaceDialogBack()
|
|||
if (!mPlayerRaceId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -465,6 +476,7 @@ void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
|
|||
if (!mPlayerRaceId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
|
@ -492,6 +504,7 @@ void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
|
|||
if (!mPlayerBirthSignId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mPlayerBirthSignId);
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage >= CSE_BirthSignChosen)
|
||||
|
@ -512,6 +525,7 @@ void CharacterCreation::onBirthSignDialogBack()
|
|||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mBirthSignDialog->getBirthId());
|
||||
mWM->removeDialog(mBirthSignDialog);
|
||||
mBirthSignDialog = 0;
|
||||
}
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -547,6 +561,7 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
|||
mWM->setPlayerClass(klass);
|
||||
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
}
|
||||
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
|
@ -568,8 +583,8 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
|||
|
||||
void CharacterCreation::onCreateClassDialogBack()
|
||||
{
|
||||
if (mCreateClassDialog)
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mWM->removeDialog(mCreateClassDialog);
|
||||
mCreateClassDialog = 0;
|
||||
|
||||
mWM->popGuiMode();
|
||||
mWM->pushGuiMode(GM_Class);
|
||||
|
@ -579,8 +594,9 @@ void CharacterCreation::onClassQuestionChosen(int _index)
|
|||
{
|
||||
MWBase::Environment::get().getSoundManager()->stopSay();
|
||||
|
||||
if (mGenerateClassQuestionDialog)
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mGenerateClassQuestionDialog = 0;
|
||||
|
||||
if (_index < 0 || _index >= 3)
|
||||
{
|
||||
mWM->popGuiMode();
|
||||
|
@ -657,8 +673,9 @@ void CharacterCreation::showClassQuestionDialog()
|
|||
}
|
||||
}
|
||||
|
||||
if (mGenerateClassResultDialog)
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mGenerateClassResultDialog = 0;
|
||||
|
||||
mGenerateClassResultDialog = new GenerateClassResultDialog(*mWM);
|
||||
mGenerateClassResultDialog->setClassId(mGenerateClass);
|
||||
mGenerateClassResultDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onGenerateClassBack);
|
||||
|
@ -674,8 +691,9 @@ void CharacterCreation::showClassQuestionDialog()
|
|||
return;
|
||||
}
|
||||
|
||||
if (mGenerateClassQuestionDialog)
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mWM->removeDialog(mGenerateClassQuestionDialog);
|
||||
mGenerateClassQuestionDialog = 0;
|
||||
|
||||
mGenerateClassQuestionDialog = new InfoBoxDialog(*mWM);
|
||||
|
||||
InfoBoxDialog::ButtonList buttons;
|
||||
|
@ -695,8 +713,9 @@ void CharacterCreation::onGenerateClassBack()
|
|||
if(mCreationStage < CSE_ClassChosen)
|
||||
mCreationStage = CSE_ClassChosen;
|
||||
|
||||
if (mGenerateClassResultDialog)
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mGenerateClassResultDialog = 0;
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
||||
|
||||
mWM->popGuiMode();
|
||||
|
@ -705,8 +724,9 @@ void CharacterCreation::onGenerateClassBack()
|
|||
|
||||
void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
|
||||
{
|
||||
if (mGenerateClassResultDialog)
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mWM->removeDialog(mGenerateClassResultDialog);
|
||||
mGenerateClassResultDialog = 0;
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
||||
const ESM::Class *klass = MWBase::Environment::get().getWorld()->getStore().classes.find(mGenerateClass);
|
||||
mPlayerClass = *klass;
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
#ifndef CHARACTER_CREATION_HPP
|
||||
#define CHARACTER_CREATION_HPP
|
||||
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class WindowManager;
|
||||
class WindowBase;
|
||||
|
||||
class TextInputDialog;
|
||||
|
@ -30,7 +29,7 @@ namespace MWGui
|
|||
public:
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
CharacterCreation(WindowManager* _wm);
|
||||
CharacterCreation(MWBase::WindowManager* _wm);
|
||||
~CharacterCreation();
|
||||
|
||||
//Show a dialog
|
||||
|
@ -59,7 +58,7 @@ namespace MWGui
|
|||
BirthDialog* mBirthSignDialog;
|
||||
ReviewDialog* mReviewDialog;
|
||||
|
||||
WindowManager* mWM;
|
||||
MWBase::WindowManager* mWM;
|
||||
|
||||
//Player data
|
||||
std::string mPlayerName;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "class.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
#include <iterator>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
@ -8,7 +7,10 @@
|
|||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "tooltips.hpp"
|
||||
|
||||
#undef min
|
||||
|
@ -18,16 +20,16 @@ using namespace MWGui;
|
|||
|
||||
/* GenerateClassResultDialog */
|
||||
|
||||
GenerateClassResultDialog::GenerateClassResultDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_generate_class_result_layout.xml", parWindowManager)
|
||||
GenerateClassResultDialog::GenerateClassResultDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_generate_class_result.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
||||
setText("ReflectT", mWindowManager.getGameSettingString("sMessageQuestionAnswer1", ""));
|
||||
|
||||
getWidget(classImage, "ClassImage");
|
||||
getWidget(className, "ClassName");
|
||||
getWidget(mClassImage, "ClassImage");
|
||||
getWidget(mClassName, "ClassName");
|
||||
|
||||
MyGUI::ButtonPtr backButton;
|
||||
getWidget(backButton, "BackButton");
|
||||
|
@ -51,15 +53,14 @@ void GenerateClassResultDialog::open()
|
|||
|
||||
std::string GenerateClassResultDialog::getClassId() const
|
||||
{
|
||||
return className->getCaption();
|
||||
return mClassName->getCaption();
|
||||
}
|
||||
|
||||
void GenerateClassResultDialog::setClassId(const std::string &classId)
|
||||
{
|
||||
currentClassId = classId;
|
||||
classImage->setImageTexture(std::string("textures\\levelup\\") + currentClassId + ".dds");
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
className->setCaption(store.classes.find(currentClassId)->name);
|
||||
mCurrentClassId = classId;
|
||||
mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds");
|
||||
mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().classes.find(mCurrentClassId)->name);
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
@ -76,35 +77,35 @@ void GenerateClassResultDialog::onBackClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* PickClassDialog */
|
||||
|
||||
PickClassDialog::PickClassDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_class_layout.xml", parWindowManager)
|
||||
PickClassDialog::PickClassDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_class.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
||||
getWidget(specializationName, "SpecializationName");
|
||||
getWidget(mSpecializationName, "SpecializationName");
|
||||
|
||||
getWidget(favoriteAttribute[0], "FavoriteAttribute0");
|
||||
getWidget(favoriteAttribute[1], "FavoriteAttribute1");
|
||||
favoriteAttribute[0]->setWindowManager(&mWindowManager);
|
||||
favoriteAttribute[1]->setWindowManager(&mWindowManager);
|
||||
getWidget(mFavoriteAttribute[0], "FavoriteAttribute0");
|
||||
getWidget(mFavoriteAttribute[1], "FavoriteAttribute1");
|
||||
mFavoriteAttribute[0]->setWindowManager(&mWindowManager);
|
||||
mFavoriteAttribute[1]->setWindowManager(&mWindowManager);
|
||||
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
char theIndex = '0'+i;
|
||||
getWidget(majorSkill[i], std::string("MajorSkill").append(1, theIndex));
|
||||
getWidget(minorSkill[i], std::string("MinorSkill").append(1, theIndex));
|
||||
majorSkill[i]->setWindowManager(&mWindowManager);
|
||||
minorSkill[i]->setWindowManager(&mWindowManager);
|
||||
getWidget(mMajorSkill[i], std::string("MajorSkill").append(1, theIndex));
|
||||
getWidget(mMinorSkill[i], std::string("MinorSkill").append(1, theIndex));
|
||||
mMajorSkill[i]->setWindowManager(&mWindowManager);
|
||||
mMinorSkill[i]->setWindowManager(&mWindowManager);
|
||||
}
|
||||
|
||||
getWidget(classList, "ClassList");
|
||||
classList->setScrollVisible(true);
|
||||
classList->eventListSelectAccept += MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);
|
||||
classList->eventListMouseItemActivate += MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);
|
||||
classList->eventListChangePosition += MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);
|
||||
getWidget(mClassList, "ClassList");
|
||||
mClassList->setScrollVisible(true);
|
||||
mClassList->eventListSelectAccept += MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);
|
||||
mClassList->eventListMouseItemActivate += MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);
|
||||
mClassList->eventListChangePosition += MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);
|
||||
|
||||
getWidget(classImage, "ClassImage");
|
||||
getWidget(mClassImage, "ClassImage");
|
||||
|
||||
MyGUI::ButtonPtr backButton;
|
||||
getWidget(backButton, "BackButton");
|
||||
|
@ -148,14 +149,14 @@ void PickClassDialog::open()
|
|||
|
||||
void PickClassDialog::setClassId(const std::string &classId)
|
||||
{
|
||||
currentClassId = classId;
|
||||
classList->setIndexSelected(MyGUI::ITEM_NONE);
|
||||
size_t count = classList->getItemCount();
|
||||
mCurrentClassId = classId;
|
||||
mClassList->setIndexSelected(MyGUI::ITEM_NONE);
|
||||
size_t count = mClassList->getItemCount();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
if (boost::iequals(*classList->getItemDataAt<std::string>(i), classId))
|
||||
if (boost::iequals(*mClassList->getItemDataAt<std::string>(i), classId))
|
||||
{
|
||||
classList->setIndexSelected(i);
|
||||
mClassList->setIndexSelected(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -180,11 +181,11 @@ void PickClassDialog::onSelectClass(MyGUI::ListBox* _sender, size_t _index)
|
|||
if (_index == MyGUI::ITEM_NONE)
|
||||
return;
|
||||
|
||||
const std::string *classId = classList->getItemDataAt<std::string>(_index);
|
||||
if (boost::iequals(currentClassId, *classId))
|
||||
const std::string *classId = mClassList->getItemDataAt<std::string>(_index);
|
||||
if (boost::iequals(mCurrentClassId, *classId))
|
||||
return;
|
||||
|
||||
currentClassId = *classId;
|
||||
mCurrentClassId = *classId;
|
||||
updateStats();
|
||||
}
|
||||
|
||||
|
@ -192,9 +193,9 @@ void PickClassDialog::onSelectClass(MyGUI::ListBox* _sender, size_t _index)
|
|||
|
||||
void PickClassDialog::updateClasses()
|
||||
{
|
||||
classList->removeAllItems();
|
||||
mClassList->removeAllItems();
|
||||
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
ESMS::RecListT<ESM::Class>::MapType::const_iterator it = store.classes.list.begin();
|
||||
ESMS::RecListT<ESM::Class>::MapType::const_iterator end = store.classes.list.end();
|
||||
|
@ -207,19 +208,19 @@ void PickClassDialog::updateClasses()
|
|||
continue;
|
||||
|
||||
const std::string &id = it->first;
|
||||
classList->addItem(klass.name, id);
|
||||
if (boost::iequals(id, currentClassId))
|
||||
classList->setIndexSelected(index);
|
||||
mClassList->addItem(klass.name, id);
|
||||
if (boost::iequals(id, mCurrentClassId))
|
||||
mClassList->setIndexSelected(index);
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
void PickClassDialog::updateStats()
|
||||
{
|
||||
if (currentClassId.empty())
|
||||
if (mCurrentClassId.empty())
|
||||
return;
|
||||
const ESMS::ESMStore &store = mWindowManager.getStore();
|
||||
const ESM::Class *klass = store.classes.search(currentClassId);
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Class *klass = store.classes.search(mCurrentClassId);
|
||||
if (!klass)
|
||||
return;
|
||||
|
||||
|
@ -231,23 +232,23 @@ void PickClassDialog::updateStats()
|
|||
"sSpecializationStealth"
|
||||
};
|
||||
std::string specName = mWindowManager.getGameSettingString(specIds[specialization], specIds[specialization]);
|
||||
specializationName->setCaption(specName);
|
||||
ToolTips::createSpecializationToolTip(specializationName, specName, specialization);
|
||||
mSpecializationName->setCaption(specName);
|
||||
ToolTips::createSpecializationToolTip(mSpecializationName, specName, specialization);
|
||||
|
||||
favoriteAttribute[0]->setAttributeId(klass->data.attribute[0]);
|
||||
favoriteAttribute[1]->setAttributeId(klass->data.attribute[1]);
|
||||
ToolTips::createAttributeToolTip(favoriteAttribute[0], favoriteAttribute[0]->getAttributeId());
|
||||
ToolTips::createAttributeToolTip(favoriteAttribute[1], favoriteAttribute[1]->getAttributeId());
|
||||
mFavoriteAttribute[0]->setAttributeId(klass->data.attribute[0]);
|
||||
mFavoriteAttribute[1]->setAttributeId(klass->data.attribute[1]);
|
||||
ToolTips::createAttributeToolTip(mFavoriteAttribute[0], mFavoriteAttribute[0]->getAttributeId());
|
||||
ToolTips::createAttributeToolTip(mFavoriteAttribute[1], mFavoriteAttribute[1]->getAttributeId());
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
minorSkill[i]->setSkillNumber(klass->data.skills[i][0]);
|
||||
majorSkill[i]->setSkillNumber(klass->data.skills[i][1]);
|
||||
ToolTips::createSkillToolTip(minorSkill[i], klass->data.skills[i][0]);
|
||||
ToolTips::createSkillToolTip(majorSkill[i], klass->data.skills[i][1]);
|
||||
mMinorSkill[i]->setSkillNumber(klass->data.skills[i][0]);
|
||||
mMajorSkill[i]->setSkillNumber(klass->data.skills[i][1]);
|
||||
ToolTips::createSkillToolTip(mMinorSkill[i], klass->data.skills[i][0]);
|
||||
ToolTips::createSkillToolTip(mMajorSkill[i], klass->data.skills[i][1]);
|
||||
}
|
||||
|
||||
classImage->setImageTexture(std::string("textures\\levelup\\") + currentClassId + ".dds");
|
||||
mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds");
|
||||
}
|
||||
|
||||
/* InfoBoxDialog */
|
||||
|
@ -282,61 +283,61 @@ void InfoBoxDialog::layoutVertically(MyGUI::WidgetPtr widget, int margin)
|
|||
widget->setSize(width, pos);
|
||||
}
|
||||
|
||||
InfoBoxDialog::InfoBoxDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_infobox_layout.xml", parWindowManager)
|
||||
, currentButton(-1)
|
||||
InfoBoxDialog::InfoBoxDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_infobox.layout", parWindowManager)
|
||||
, mCurrentButton(-1)
|
||||
{
|
||||
getWidget(textBox, "TextBox");
|
||||
getWidget(text, "Text");
|
||||
text->getSubWidgetText()->setWordWrap(true);
|
||||
getWidget(buttonBar, "ButtonBar");
|
||||
getWidget(mTextBox, "TextBox");
|
||||
getWidget(mText, "Text");
|
||||
mText->getSubWidgetText()->setWordWrap(true);
|
||||
getWidget(mButtonBar, "ButtonBar");
|
||||
|
||||
center();
|
||||
}
|
||||
|
||||
void InfoBoxDialog::setText(const std::string &str)
|
||||
{
|
||||
text->setCaption(str);
|
||||
textBox->setVisible(!str.empty());
|
||||
fitToText(text);
|
||||
mText->setCaption(str);
|
||||
mTextBox->setVisible(!str.empty());
|
||||
fitToText(mText);
|
||||
}
|
||||
|
||||
std::string InfoBoxDialog::getText() const
|
||||
{
|
||||
return text->getCaption();
|
||||
return mText->getCaption();
|
||||
}
|
||||
|
||||
void InfoBoxDialog::setButtons(ButtonList &buttons)
|
||||
{
|
||||
for (std::vector<MyGUI::ButtonPtr>::iterator it = this->buttons.begin(); it != this->buttons.end(); ++it)
|
||||
for (std::vector<MyGUI::ButtonPtr>::iterator it = this->mButtons.begin(); it != this->mButtons.end(); ++it)
|
||||
{
|
||||
MyGUI::Gui::getInstance().destroyWidget(*it);
|
||||
}
|
||||
this->buttons.clear();
|
||||
currentButton = -1;
|
||||
this->mButtons.clear();
|
||||
mCurrentButton = -1;
|
||||
|
||||
// TODO: The buttons should be generated from a template in the layout file, ie. cloning an existing widget
|
||||
MyGUI::ButtonPtr button;
|
||||
MyGUI::IntCoord coord = MyGUI::IntCoord(0, 0, buttonBar->getWidth(), 10);
|
||||
MyGUI::IntCoord coord = MyGUI::IntCoord(0, 0, mButtonBar->getWidth(), 10);
|
||||
ButtonList::const_iterator end = buttons.end();
|
||||
for (ButtonList::const_iterator it = buttons.begin(); it != end; ++it)
|
||||
{
|
||||
const std::string &text = *it;
|
||||
button = buttonBar->createWidget<MyGUI::Button>("MW_Button", coord, MyGUI::Align::Top | MyGUI::Align::HCenter, "");
|
||||
button = mButtonBar->createWidget<MyGUI::Button>("MW_Button", coord, MyGUI::Align::Top | MyGUI::Align::HCenter, "");
|
||||
button->getSubWidgetText()->setWordWrap(true);
|
||||
button->setCaption(text);
|
||||
fitToText(button);
|
||||
button->eventMouseButtonClick += MyGUI::newDelegate(this, &InfoBoxDialog::onButtonClicked);
|
||||
coord.top += button->getHeight();
|
||||
this->buttons.push_back(button);
|
||||
this->mButtons.push_back(button);
|
||||
}
|
||||
}
|
||||
|
||||
void InfoBoxDialog::open()
|
||||
{
|
||||
// Fix layout
|
||||
layoutVertically(textBox, 4);
|
||||
layoutVertically(buttonBar, 6);
|
||||
layoutVertically(mTextBox, 4);
|
||||
layoutVertically(mButtonBar, 6);
|
||||
layoutVertically(mMainWidget, 4 + 6);
|
||||
|
||||
center();
|
||||
|
@ -345,18 +346,18 @@ void InfoBoxDialog::open()
|
|||
|
||||
int InfoBoxDialog::getChosenButton() const
|
||||
{
|
||||
return currentButton;
|
||||
return mCurrentButton;
|
||||
}
|
||||
|
||||
void InfoBoxDialog::onButtonClicked(MyGUI::WidgetPtr _sender)
|
||||
{
|
||||
std::vector<MyGUI::ButtonPtr>::const_iterator end = buttons.end();
|
||||
std::vector<MyGUI::ButtonPtr>::const_iterator end = mButtons.end();
|
||||
int i = 0;
|
||||
for (std::vector<MyGUI::ButtonPtr>::const_iterator it = buttons.begin(); it != end; ++it)
|
||||
for (std::vector<MyGUI::ButtonPtr>::const_iterator it = mButtons.begin(); it != end; ++it)
|
||||
{
|
||||
if (*it == _sender)
|
||||
{
|
||||
currentButton = i;
|
||||
mCurrentButton = i;
|
||||
eventButtonSelected(i);
|
||||
return;
|
||||
}
|
||||
|
@ -366,7 +367,7 @@ void InfoBoxDialog::onButtonClicked(MyGUI::WidgetPtr _sender)
|
|||
|
||||
/* ClassChoiceDialog */
|
||||
|
||||
ClassChoiceDialog::ClassChoiceDialog(WindowManager& parWindowManager)
|
||||
ClassChoiceDialog::ClassChoiceDialog(MWBase::WindowManager& parWindowManager)
|
||||
: InfoBoxDialog(parWindowManager)
|
||||
{
|
||||
setText("");
|
||||
|
@ -380,51 +381,51 @@ ClassChoiceDialog::ClassChoiceDialog(WindowManager& parWindowManager)
|
|||
|
||||
/* CreateClassDialog */
|
||||
|
||||
CreateClassDialog::CreateClassDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_create_class_layout.xml", parWindowManager)
|
||||
, specDialog(nullptr)
|
||||
, attribDialog(nullptr)
|
||||
, skillDialog(nullptr)
|
||||
, descDialog(nullptr)
|
||||
CreateClassDialog::CreateClassDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_create_class.layout", parWindowManager)
|
||||
, mSpecDialog(nullptr)
|
||||
, mAttribDialog(nullptr)
|
||||
, mSkillDialog(nullptr)
|
||||
, mDescDialog(nullptr)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
||||
setText("SpecializationT", mWindowManager.getGameSettingString("sChooseClassMenu1", "Specialization"));
|
||||
getWidget(specializationName, "SpecializationName");
|
||||
specializationName->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationClicked);
|
||||
getWidget(mSpecializationName, "SpecializationName");
|
||||
mSpecializationName->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationClicked);
|
||||
|
||||
setText("FavoriteAttributesT", mWindowManager.getGameSettingString("sChooseClassMenu2", "Favorite Attributes:"));
|
||||
getWidget(favoriteAttribute0, "FavoriteAttribute0");
|
||||
getWidget(favoriteAttribute1, "FavoriteAttribute1");
|
||||
favoriteAttribute0->setWindowManager(&mWindowManager);
|
||||
favoriteAttribute1->setWindowManager(&mWindowManager);
|
||||
favoriteAttribute0->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeClicked);
|
||||
favoriteAttribute1->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeClicked);
|
||||
getWidget(mFavoriteAttribute0, "FavoriteAttribute0");
|
||||
getWidget(mFavoriteAttribute1, "FavoriteAttribute1");
|
||||
mFavoriteAttribute0->setWindowManager(&mWindowManager);
|
||||
mFavoriteAttribute1->setWindowManager(&mWindowManager);
|
||||
mFavoriteAttribute0->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeClicked);
|
||||
mFavoriteAttribute1->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeClicked);
|
||||
|
||||
setText("MajorSkillT", mWindowManager.getGameSettingString("sSkillClassMajor", ""));
|
||||
setText("MinorSkillT", mWindowManager.getGameSettingString("sSkillClassMinor", ""));
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
char theIndex = '0'+i;
|
||||
getWidget(majorSkill[i], std::string("MajorSkill").append(1, theIndex));
|
||||
getWidget(minorSkill[i], std::string("MinorSkill").append(1, theIndex));
|
||||
skills.push_back(majorSkill[i]);
|
||||
skills.push_back(minorSkill[i]);
|
||||
getWidget(mMajorSkill[i], std::string("MajorSkill").append(1, theIndex));
|
||||
getWidget(mMinorSkill[i], std::string("MinorSkill").append(1, theIndex));
|
||||
mSkills.push_back(mMajorSkill[i]);
|
||||
mSkills.push_back(mMinorSkill[i]);
|
||||
}
|
||||
|
||||
std::vector<Widgets::MWSkillPtr>::const_iterator end = skills.end();
|
||||
for (std::vector<Widgets::MWSkillPtr>::const_iterator it = skills.begin(); it != end; ++it)
|
||||
std::vector<Widgets::MWSkillPtr>::const_iterator end = mSkills.end();
|
||||
for (std::vector<Widgets::MWSkillPtr>::const_iterator it = mSkills.begin(); it != end; ++it)
|
||||
{
|
||||
(*it)->setWindowManager(&mWindowManager);
|
||||
(*it)->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onSkillClicked);
|
||||
}
|
||||
|
||||
setText("LabelT", mWindowManager.getGameSettingString("sName", ""));
|
||||
getWidget(editName, "EditName");
|
||||
getWidget(mEditName, "EditName");
|
||||
|
||||
// Make sure the edit box has focus
|
||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(editName);
|
||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(mEditName);
|
||||
|
||||
MyGUI::ButtonPtr descriptionButton;
|
||||
getWidget(descriptionButton, "DescriptionButton");
|
||||
|
@ -441,20 +442,20 @@ CreateClassDialog::CreateClassDialog(WindowManager& parWindowManager)
|
|||
|
||||
// Set default skills, attributes
|
||||
|
||||
favoriteAttribute0->setAttributeId(ESM::Attribute::Strength);
|
||||
favoriteAttribute1->setAttributeId(ESM::Attribute::Agility);
|
||||
mFavoriteAttribute0->setAttributeId(ESM::Attribute::Strength);
|
||||
mFavoriteAttribute1->setAttributeId(ESM::Attribute::Agility);
|
||||
|
||||
majorSkill[0]->setSkillId(ESM::Skill::Block);
|
||||
majorSkill[1]->setSkillId(ESM::Skill::Armorer);
|
||||
majorSkill[2]->setSkillId(ESM::Skill::MediumArmor);
|
||||
majorSkill[3]->setSkillId(ESM::Skill::HeavyArmor);
|
||||
majorSkill[4]->setSkillId(ESM::Skill::BluntWeapon);
|
||||
mMajorSkill[0]->setSkillId(ESM::Skill::Block);
|
||||
mMajorSkill[1]->setSkillId(ESM::Skill::Armorer);
|
||||
mMajorSkill[2]->setSkillId(ESM::Skill::MediumArmor);
|
||||
mMajorSkill[3]->setSkillId(ESM::Skill::HeavyArmor);
|
||||
mMajorSkill[4]->setSkillId(ESM::Skill::BluntWeapon);
|
||||
|
||||
minorSkill[0]->setSkillId(ESM::Skill::LongBlade);
|
||||
minorSkill[1]->setSkillId(ESM::Skill::Axe);
|
||||
minorSkill[2]->setSkillId(ESM::Skill::Spear);
|
||||
minorSkill[3]->setSkillId(ESM::Skill::Athletics);
|
||||
minorSkill[4]->setSkillId(ESM::Skill::Enchant);
|
||||
mMinorSkill[0]->setSkillId(ESM::Skill::LongBlade);
|
||||
mMinorSkill[1]->setSkillId(ESM::Skill::Axe);
|
||||
mMinorSkill[2]->setSkillId(ESM::Skill::Spear);
|
||||
mMinorSkill[3]->setSkillId(ESM::Skill::Athletics);
|
||||
mMinorSkill[4]->setSkillId(ESM::Skill::Enchant);
|
||||
|
||||
setSpecialization(0);
|
||||
update();
|
||||
|
@ -462,44 +463,44 @@ CreateClassDialog::CreateClassDialog(WindowManager& parWindowManager)
|
|||
|
||||
CreateClassDialog::~CreateClassDialog()
|
||||
{
|
||||
delete specDialog;
|
||||
delete attribDialog;
|
||||
delete skillDialog;
|
||||
delete descDialog;
|
||||
delete mSpecDialog;
|
||||
delete mAttribDialog;
|
||||
delete mSkillDialog;
|
||||
delete mDescDialog;
|
||||
}
|
||||
|
||||
void CreateClassDialog::update()
|
||||
{
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
ToolTips::createSkillToolTip(majorSkill[i], majorSkill[i]->getSkillId());
|
||||
ToolTips::createSkillToolTip(minorSkill[i], minorSkill[i]->getSkillId());
|
||||
ToolTips::createSkillToolTip(mMajorSkill[i], mMajorSkill[i]->getSkillId());
|
||||
ToolTips::createSkillToolTip(mMinorSkill[i], mMinorSkill[i]->getSkillId());
|
||||
}
|
||||
|
||||
ToolTips::createAttributeToolTip(favoriteAttribute0, favoriteAttribute0->getAttributeId());
|
||||
ToolTips::createAttributeToolTip(favoriteAttribute1, favoriteAttribute1->getAttributeId());
|
||||
ToolTips::createAttributeToolTip(mFavoriteAttribute0, mFavoriteAttribute0->getAttributeId());
|
||||
ToolTips::createAttributeToolTip(mFavoriteAttribute1, mFavoriteAttribute1->getAttributeId());
|
||||
}
|
||||
|
||||
std::string CreateClassDialog::getName() const
|
||||
{
|
||||
return editName->getOnlyText();
|
||||
return mEditName->getOnlyText();
|
||||
}
|
||||
|
||||
std::string CreateClassDialog::getDescription() const
|
||||
{
|
||||
return description;
|
||||
return mDescription;
|
||||
}
|
||||
|
||||
ESM::Class::Specialization CreateClassDialog::getSpecializationId() const
|
||||
{
|
||||
return specializationId;
|
||||
return mSpecializationId;
|
||||
}
|
||||
|
||||
std::vector<int> CreateClassDialog::getFavoriteAttributes() const
|
||||
{
|
||||
std::vector<int> v;
|
||||
v.push_back(favoriteAttribute0->getAttributeId());
|
||||
v.push_back(favoriteAttribute1->getAttributeId());
|
||||
v.push_back(mFavoriteAttribute0->getAttributeId());
|
||||
v.push_back(mFavoriteAttribute1->getAttributeId());
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -508,7 +509,7 @@ std::vector<ESM::Skill::SkillEnum> CreateClassDialog::getMajorSkills() const
|
|||
std::vector<ESM::Skill::SkillEnum> v;
|
||||
for(int i = 0; i < 5; i++)
|
||||
{
|
||||
v.push_back(majorSkill[i]->getSkillId());
|
||||
v.push_back(mMajorSkill[i]->getSkillId());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
@ -518,7 +519,7 @@ std::vector<ESM::Skill::SkillEnum> CreateClassDialog::getMinorSkills() const
|
|||
std::vector<ESM::Skill::SkillEnum> v;
|
||||
for(int i=0; i < 5; i++)
|
||||
{
|
||||
v.push_back(minorSkill[i]->getSkillId());
|
||||
v.push_back(mMinorSkill[i]->getSkillId());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
@ -557,108 +558,99 @@ void CreateClassDialog::open()
|
|||
|
||||
void CreateClassDialog::onDialogCancel()
|
||||
{
|
||||
if (specDialog)
|
||||
{
|
||||
mWindowManager.removeDialog(specDialog);
|
||||
specDialog = 0;
|
||||
}
|
||||
if (attribDialog)
|
||||
{
|
||||
mWindowManager.removeDialog(attribDialog);
|
||||
attribDialog = 0;
|
||||
}
|
||||
if (skillDialog)
|
||||
{
|
||||
mWindowManager.removeDialog(skillDialog);
|
||||
skillDialog = 0;
|
||||
}
|
||||
if (descDialog)
|
||||
{
|
||||
mWindowManager.removeDialog(descDialog);
|
||||
descDialog = 0;
|
||||
}
|
||||
mWindowManager.removeDialog(mSpecDialog);
|
||||
mSpecDialog = 0;
|
||||
|
||||
mWindowManager.removeDialog(mAttribDialog);
|
||||
mAttribDialog = 0;
|
||||
|
||||
mWindowManager.removeDialog(mSkillDialog);
|
||||
mSkillDialog = 0;
|
||||
|
||||
mWindowManager.removeDialog(mDescDialog);
|
||||
mDescDialog = 0;
|
||||
}
|
||||
|
||||
void CreateClassDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender)
|
||||
{
|
||||
delete specDialog;
|
||||
specDialog = new SelectSpecializationDialog(mWindowManager);
|
||||
specDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||
specDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationSelected);
|
||||
specDialog->setVisible(true);
|
||||
delete mSpecDialog;
|
||||
mSpecDialog = new SelectSpecializationDialog(mWindowManager);
|
||||
mSpecDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||
mSpecDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationSelected);
|
||||
mSpecDialog->setVisible(true);
|
||||
}
|
||||
|
||||
void CreateClassDialog::onSpecializationSelected()
|
||||
{
|
||||
specializationId = specDialog->getSpecializationId();
|
||||
setSpecialization(specializationId);
|
||||
mSpecializationId = mSpecDialog->getSpecializationId();
|
||||
setSpecialization(mSpecializationId);
|
||||
|
||||
mWindowManager.removeDialog(specDialog);
|
||||
specDialog = 0;
|
||||
mWindowManager.removeDialog(mSpecDialog);
|
||||
mSpecDialog = 0;
|
||||
}
|
||||
|
||||
void CreateClassDialog::setSpecialization(int id)
|
||||
{
|
||||
specializationId = (ESM::Class::Specialization) id;
|
||||
mSpecializationId = (ESM::Class::Specialization) id;
|
||||
static const char *specIds[3] = {
|
||||
"sSpecializationCombat",
|
||||
"sSpecializationMagic",
|
||||
"sSpecializationStealth"
|
||||
};
|
||||
std::string specName = mWindowManager.getGameSettingString(specIds[specializationId], specIds[specializationId]);
|
||||
specializationName->setCaption(specName);
|
||||
ToolTips::createSpecializationToolTip(specializationName, specName, specializationId);
|
||||
std::string specName = mWindowManager.getGameSettingString(specIds[mSpecializationId], specIds[mSpecializationId]);
|
||||
mSpecializationName->setCaption(specName);
|
||||
ToolTips::createSpecializationToolTip(mSpecializationName, specName, mSpecializationId);
|
||||
}
|
||||
|
||||
void CreateClassDialog::onAttributeClicked(Widgets::MWAttributePtr _sender)
|
||||
{
|
||||
delete attribDialog;
|
||||
attribDialog = new SelectAttributeDialog(mWindowManager);
|
||||
attribDialog->setAffectedWidget(_sender);
|
||||
attribDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||
attribDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeSelected);
|
||||
attribDialog->setVisible(true);
|
||||
delete mAttribDialog;
|
||||
mAttribDialog = new SelectAttributeDialog(mWindowManager);
|
||||
mAttribDialog->setAffectedWidget(_sender);
|
||||
mAttribDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||
mAttribDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeSelected);
|
||||
mAttribDialog->setVisible(true);
|
||||
}
|
||||
|
||||
void CreateClassDialog::onAttributeSelected()
|
||||
{
|
||||
ESM::Attribute::AttributeID id = attribDialog->getAttributeId();
|
||||
Widgets::MWAttributePtr attribute = attribDialog->getAffectedWidget();
|
||||
if (attribute == favoriteAttribute0)
|
||||
ESM::Attribute::AttributeID id = mAttribDialog->getAttributeId();
|
||||
Widgets::MWAttributePtr attribute = mAttribDialog->getAffectedWidget();
|
||||
if (attribute == mFavoriteAttribute0)
|
||||
{
|
||||
if (favoriteAttribute1->getAttributeId() == id)
|
||||
favoriteAttribute1->setAttributeId(favoriteAttribute0->getAttributeId());
|
||||
if (mFavoriteAttribute1->getAttributeId() == id)
|
||||
mFavoriteAttribute1->setAttributeId(mFavoriteAttribute0->getAttributeId());
|
||||
}
|
||||
else if (attribute == favoriteAttribute1)
|
||||
else if (attribute == mFavoriteAttribute1)
|
||||
{
|
||||
if (favoriteAttribute0->getAttributeId() == id)
|
||||
favoriteAttribute0->setAttributeId(favoriteAttribute1->getAttributeId());
|
||||
if (mFavoriteAttribute0->getAttributeId() == id)
|
||||
mFavoriteAttribute0->setAttributeId(mFavoriteAttribute1->getAttributeId());
|
||||
}
|
||||
attribute->setAttributeId(id);
|
||||
mWindowManager.removeDialog(attribDialog);
|
||||
attribDialog = 0;
|
||||
mWindowManager.removeDialog(mAttribDialog);
|
||||
mAttribDialog = 0;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void CreateClassDialog::onSkillClicked(Widgets::MWSkillPtr _sender)
|
||||
{
|
||||
delete skillDialog;
|
||||
skillDialog = new SelectSkillDialog(mWindowManager);
|
||||
skillDialog->setAffectedWidget(_sender);
|
||||
skillDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||
skillDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSkillSelected);
|
||||
skillDialog->setVisible(true);
|
||||
delete mSkillDialog;
|
||||
mSkillDialog = new SelectSkillDialog(mWindowManager);
|
||||
mSkillDialog->setAffectedWidget(_sender);
|
||||
mSkillDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
||||
mSkillDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSkillSelected);
|
||||
mSkillDialog->setVisible(true);
|
||||
}
|
||||
|
||||
void CreateClassDialog::onSkillSelected()
|
||||
{
|
||||
ESM::Skill::SkillEnum id = skillDialog->getSkillId();
|
||||
Widgets::MWSkillPtr skill = skillDialog->getAffectedWidget();
|
||||
ESM::Skill::SkillEnum id = mSkillDialog->getSkillId();
|
||||
Widgets::MWSkillPtr skill = mSkillDialog->getAffectedWidget();
|
||||
|
||||
// Avoid duplicate skills by swapping any skill field that matches the selected one
|
||||
std::vector<Widgets::MWSkillPtr>::const_iterator end = skills.end();
|
||||
for (std::vector<Widgets::MWSkillPtr>::const_iterator it = skills.begin(); it != end; ++it)
|
||||
std::vector<Widgets::MWSkillPtr>::const_iterator end = mSkills.end();
|
||||
for (std::vector<Widgets::MWSkillPtr>::const_iterator it = mSkills.begin(); it != end; ++it)
|
||||
{
|
||||
if (*it == skill)
|
||||
continue;
|
||||
|
@ -669,25 +661,25 @@ void CreateClassDialog::onSkillSelected()
|
|||
}
|
||||
}
|
||||
|
||||
skill->setSkillId(skillDialog->getSkillId());
|
||||
mWindowManager.removeDialog(skillDialog);
|
||||
skillDialog = 0;
|
||||
skill->setSkillId(mSkillDialog->getSkillId());
|
||||
mWindowManager.removeDialog(mSkillDialog);
|
||||
mSkillDialog = 0;
|
||||
update();
|
||||
}
|
||||
|
||||
void CreateClassDialog::onDescriptionClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
descDialog = new DescriptionDialog(mWindowManager);
|
||||
descDialog->setTextInput(description);
|
||||
descDialog->eventDone += MyGUI::newDelegate(this, &CreateClassDialog::onDescriptionEntered);
|
||||
descDialog->setVisible(true);
|
||||
mDescDialog = new DescriptionDialog(mWindowManager);
|
||||
mDescDialog->setTextInput(mDescription);
|
||||
mDescDialog->eventDone += MyGUI::newDelegate(this, &CreateClassDialog::onDescriptionEntered);
|
||||
mDescDialog->setVisible(true);
|
||||
}
|
||||
|
||||
void CreateClassDialog::onDescriptionEntered(WindowBase* parWindow)
|
||||
{
|
||||
description = descDialog->getTextInput();
|
||||
mWindowManager.removeDialog(descDialog);
|
||||
descDialog = 0;
|
||||
mDescription = mDescDialog->getTextInput();
|
||||
mWindowManager.removeDialog(mDescDialog);
|
||||
mDescDialog = 0;
|
||||
}
|
||||
|
||||
void CreateClassDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||
|
@ -702,32 +694,32 @@ void CreateClassDialog::onBackClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectSpecializationDialog */
|
||||
|
||||
SelectSpecializationDialog::SelectSpecializationDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_specialization_layout.xml", parWindowManager)
|
||||
SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_specialization.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
||||
setText("LabelT", mWindowManager.getGameSettingString("sSpecializationMenu1", ""));
|
||||
|
||||
getWidget(specialization0, "Specialization0");
|
||||
getWidget(specialization1, "Specialization1");
|
||||
getWidget(specialization2, "Specialization2");
|
||||
getWidget(mSpecialization0, "Specialization0");
|
||||
getWidget(mSpecialization1, "Specialization1");
|
||||
getWidget(mSpecialization2, "Specialization2");
|
||||
std::string combat = mWindowManager.getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Combat], "");
|
||||
std::string magic = mWindowManager.getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Magic], "");
|
||||
std::string stealth = mWindowManager.getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Stealth], "");
|
||||
|
||||
specialization0->setCaption(combat);
|
||||
specialization0->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
|
||||
specialization1->setCaption(magic);
|
||||
specialization1->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
|
||||
specialization2->setCaption(stealth);
|
||||
specialization2->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
|
||||
specializationId = ESM::Class::Combat;
|
||||
mSpecialization0->setCaption(combat);
|
||||
mSpecialization0->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
|
||||
mSpecialization1->setCaption(magic);
|
||||
mSpecialization1->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
|
||||
mSpecialization2->setCaption(stealth);
|
||||
mSpecialization2->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
|
||||
mSpecializationId = ESM::Class::Combat;
|
||||
|
||||
ToolTips::createSpecializationToolTip(specialization0, combat, ESM::Class::Combat);
|
||||
ToolTips::createSpecializationToolTip(specialization1, magic, ESM::Class::Magic);
|
||||
ToolTips::createSpecializationToolTip(specialization2, stealth, ESM::Class::Stealth);
|
||||
ToolTips::createSpecializationToolTip(mSpecialization0, combat, ESM::Class::Combat);
|
||||
ToolTips::createSpecializationToolTip(mSpecialization1, magic, ESM::Class::Magic);
|
||||
ToolTips::createSpecializationToolTip(mSpecialization2, stealth, ESM::Class::Stealth);
|
||||
|
||||
MyGUI::ButtonPtr cancelButton;
|
||||
getWidget(cancelButton, "CancelButton");
|
||||
|
@ -748,12 +740,12 @@ SelectSpecializationDialog::~SelectSpecializationDialog()
|
|||
|
||||
void SelectSpecializationDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender)
|
||||
{
|
||||
if (_sender == specialization0)
|
||||
specializationId = ESM::Class::Combat;
|
||||
else if (_sender == specialization1)
|
||||
specializationId = ESM::Class::Magic;
|
||||
else if (_sender == specialization2)
|
||||
specializationId = ESM::Class::Stealth;
|
||||
if (_sender == mSpecialization0)
|
||||
mSpecializationId = ESM::Class::Combat;
|
||||
else if (_sender == mSpecialization1)
|
||||
mSpecializationId = ESM::Class::Magic;
|
||||
else if (_sender == mSpecialization2)
|
||||
mSpecializationId = ESM::Class::Stealth;
|
||||
else
|
||||
return;
|
||||
|
||||
|
@ -767,8 +759,8 @@ void SelectSpecializationDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectAttributeDialog */
|
||||
|
||||
SelectAttributeDialog::SelectAttributeDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_attribute_layout.xml", parWindowManager)
|
||||
SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_attribute.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
@ -807,7 +799,7 @@ SelectAttributeDialog::~SelectAttributeDialog()
|
|||
void SelectAttributeDialog::onAttributeClicked(Widgets::MWAttributePtr _sender)
|
||||
{
|
||||
// TODO: Change MWAttribute to set and get AttributeID enum instead of int
|
||||
attributeId = static_cast<ESM::Attribute::AttributeID>(_sender->getAttributeId());
|
||||
mAttributeId = static_cast<ESM::Attribute::AttributeID>(_sender->getAttributeId());
|
||||
eventItemSelected();
|
||||
}
|
||||
|
||||
|
@ -819,8 +811,8 @@ void SelectAttributeDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* SelectSkillDialog */
|
||||
|
||||
SelectSkillDialog::SelectSkillDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_skill_layout.xml", parWindowManager)
|
||||
SelectSkillDialog::SelectSkillDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_select_skill.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
@ -833,44 +825,44 @@ SelectSkillDialog::SelectSkillDialog(WindowManager& parWindowManager)
|
|||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
char theIndex = '0'+i;
|
||||
getWidget(combatSkill[i], std::string("CombatSkill").append(1, theIndex));
|
||||
getWidget(magicSkill[i], std::string("MagicSkill").append(1, theIndex));
|
||||
getWidget(stealthSkill[i], std::string("StealthSkill").append(1, theIndex));
|
||||
getWidget(mCombatSkill[i], std::string("CombatSkill").append(1, theIndex));
|
||||
getWidget(mMagicSkill[i], std::string("MagicSkill").append(1, theIndex));
|
||||
getWidget(mStealthSkill[i], std::string("StealthSkill").append(1, theIndex));
|
||||
}
|
||||
|
||||
struct {Widgets::MWSkillPtr widget; ESM::Skill::SkillEnum skillId;} skills[3][9] = {
|
||||
struct {Widgets::MWSkillPtr widget; ESM::Skill::SkillEnum skillId;} mSkills[3][9] = {
|
||||
{
|
||||
{combatSkill[0], ESM::Skill::Block},
|
||||
{combatSkill[1], ESM::Skill::Armorer},
|
||||
{combatSkill[2], ESM::Skill::MediumArmor},
|
||||
{combatSkill[3], ESM::Skill::HeavyArmor},
|
||||
{combatSkill[4], ESM::Skill::BluntWeapon},
|
||||
{combatSkill[5], ESM::Skill::LongBlade},
|
||||
{combatSkill[6], ESM::Skill::Axe},
|
||||
{combatSkill[7], ESM::Skill::Spear},
|
||||
{combatSkill[8], ESM::Skill::Athletics}
|
||||
{mCombatSkill[0], ESM::Skill::Block},
|
||||
{mCombatSkill[1], ESM::Skill::Armorer},
|
||||
{mCombatSkill[2], ESM::Skill::MediumArmor},
|
||||
{mCombatSkill[3], ESM::Skill::HeavyArmor},
|
||||
{mCombatSkill[4], ESM::Skill::BluntWeapon},
|
||||
{mCombatSkill[5], ESM::Skill::LongBlade},
|
||||
{mCombatSkill[6], ESM::Skill::Axe},
|
||||
{mCombatSkill[7], ESM::Skill::Spear},
|
||||
{mCombatSkill[8], ESM::Skill::Athletics}
|
||||
},
|
||||
{
|
||||
{magicSkill[0], ESM::Skill::Enchant},
|
||||
{magicSkill[1], ESM::Skill::Destruction},
|
||||
{magicSkill[2], ESM::Skill::Alteration},
|
||||
{magicSkill[3], ESM::Skill::Illusion},
|
||||
{magicSkill[4], ESM::Skill::Conjuration},
|
||||
{magicSkill[5], ESM::Skill::Mysticism},
|
||||
{magicSkill[6], ESM::Skill::Restoration},
|
||||
{magicSkill[7], ESM::Skill::Alchemy},
|
||||
{magicSkill[8], ESM::Skill::Unarmored}
|
||||
{mMagicSkill[0], ESM::Skill::Enchant},
|
||||
{mMagicSkill[1], ESM::Skill::Destruction},
|
||||
{mMagicSkill[2], ESM::Skill::Alteration},
|
||||
{mMagicSkill[3], ESM::Skill::Illusion},
|
||||
{mMagicSkill[4], ESM::Skill::Conjuration},
|
||||
{mMagicSkill[5], ESM::Skill::Mysticism},
|
||||
{mMagicSkill[6], ESM::Skill::Restoration},
|
||||
{mMagicSkill[7], ESM::Skill::Alchemy},
|
||||
{mMagicSkill[8], ESM::Skill::Unarmored}
|
||||
},
|
||||
{
|
||||
{stealthSkill[0], ESM::Skill::Security},
|
||||
{stealthSkill[1], ESM::Skill::Sneak},
|
||||
{stealthSkill[2], ESM::Skill::Acrobatics},
|
||||
{stealthSkill[3], ESM::Skill::LightArmor},
|
||||
{stealthSkill[4], ESM::Skill::ShortBlade},
|
||||
{stealthSkill[5] ,ESM::Skill::Marksman},
|
||||
{stealthSkill[6] ,ESM::Skill::Mercantile},
|
||||
{stealthSkill[7] ,ESM::Skill::Speechcraft},
|
||||
{stealthSkill[8] ,ESM::Skill::HandToHand}
|
||||
{mStealthSkill[0], ESM::Skill::Security},
|
||||
{mStealthSkill[1], ESM::Skill::Sneak},
|
||||
{mStealthSkill[2], ESM::Skill::Acrobatics},
|
||||
{mStealthSkill[3], ESM::Skill::LightArmor},
|
||||
{mStealthSkill[4], ESM::Skill::ShortBlade},
|
||||
{mStealthSkill[5] ,ESM::Skill::Marksman},
|
||||
{mStealthSkill[6] ,ESM::Skill::Mercantile},
|
||||
{mStealthSkill[7] ,ESM::Skill::Speechcraft},
|
||||
{mStealthSkill[8] ,ESM::Skill::HandToHand}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -878,10 +870,10 @@ SelectSkillDialog::SelectSkillDialog(WindowManager& parWindowManager)
|
|||
{
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
skills[spec][i].widget->setWindowManager(&mWindowManager);
|
||||
skills[spec][i].widget->setSkillId(skills[spec][i].skillId);
|
||||
skills[spec][i].widget->eventClicked += MyGUI::newDelegate(this, &SelectSkillDialog::onSkillClicked);
|
||||
ToolTips::createSkillToolTip(skills[spec][i].widget, skills[spec][i].widget->getSkillId());
|
||||
mSkills[spec][i].widget->setWindowManager(&mWindowManager);
|
||||
mSkills[spec][i].widget->setSkillId(mSkills[spec][i].skillId);
|
||||
mSkills[spec][i].widget->eventClicked += MyGUI::newDelegate(this, &SelectSkillDialog::onSkillClicked);
|
||||
ToolTips::createSkillToolTip(mSkills[spec][i].widget, mSkills[spec][i].widget->getSkillId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -904,7 +896,7 @@ SelectSkillDialog::~SelectSkillDialog()
|
|||
|
||||
void SelectSkillDialog::onSkillClicked(Widgets::MWSkillPtr _sender)
|
||||
{
|
||||
skillId = _sender->getSkillId();
|
||||
mSkillId = _sender->getSkillId();
|
||||
eventItemSelected();
|
||||
}
|
||||
|
||||
|
@ -915,13 +907,13 @@ void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
|
||||
/* DescriptionDialog */
|
||||
|
||||
DescriptionDialog::DescriptionDialog(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_class_description_layout.xml", parWindowManager)
|
||||
DescriptionDialog::DescriptionDialog(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_chargen_class_description.layout", parWindowManager)
|
||||
{
|
||||
// Centre dialog
|
||||
center();
|
||||
|
||||
getWidget(textEdit, "TextEdit");
|
||||
getWidget(mTextEdit, "TextEdit");
|
||||
|
||||
MyGUI::ButtonPtr okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
|
@ -931,7 +923,7 @@ DescriptionDialog::DescriptionDialog(WindowManager& parWindowManager)
|
|||
okButton->setCoord(234 - buttonWidth, 214, buttonWidth, 24);
|
||||
|
||||
// Make sure the edit box has focus
|
||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(textEdit);
|
||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(mTextEdit);
|
||||
|
||||
MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget);
|
||||
}
|
||||
|
|
|
@ -7,19 +7,18 @@
|
|||
|
||||
/*
|
||||
This file contains the dialogs for choosing a class.
|
||||
Layout is defined by resources/mygui/openmw_chargen_class_layout.xml.
|
||||
Layout is defined by resources/mygui/openmw_chargen_class.layout.
|
||||
*/
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
/// \todo remove!
|
||||
using namespace MyGUI;
|
||||
|
||||
class WindowManager;
|
||||
|
||||
class InfoBoxDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
InfoBoxDialog(WindowManager& parWindowManager);
|
||||
InfoBoxDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
typedef std::vector<std::string> ButtonList;
|
||||
|
||||
|
@ -45,11 +44,11 @@ namespace MWGui
|
|||
|
||||
void fitToText(MyGUI::TextBox* widget);
|
||||
void layoutVertically(MyGUI::WidgetPtr widget, int margin);
|
||||
int currentButton;
|
||||
MyGUI::WidgetPtr textBox;
|
||||
MyGUI::TextBox* text;
|
||||
MyGUI::WidgetPtr buttonBar;
|
||||
std::vector<MyGUI::ButtonPtr> buttons;
|
||||
int mCurrentButton;
|
||||
MyGUI::WidgetPtr mTextBox;
|
||||
MyGUI::TextBox* mText;
|
||||
MyGUI::WidgetPtr mButtonBar;
|
||||
std::vector<MyGUI::ButtonPtr> mButtons;
|
||||
};
|
||||
|
||||
// Lets the player choose between 3 ways of creating a class
|
||||
|
@ -64,13 +63,13 @@ namespace MWGui
|
|||
Class_Create = 2,
|
||||
Class_Back = 3
|
||||
};
|
||||
ClassChoiceDialog(WindowManager& parWindowManager);
|
||||
ClassChoiceDialog(MWBase::WindowManager& parWindowManager);
|
||||
};
|
||||
|
||||
class GenerateClassResultDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
GenerateClassResultDialog(WindowManager& parWindowManager);
|
||||
GenerateClassResultDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
std::string getClassId() const;
|
||||
void setClassId(const std::string &classId);
|
||||
|
@ -90,18 +89,18 @@ namespace MWGui
|
|||
void onBackClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
MyGUI::ImageBox* classImage;
|
||||
MyGUI::TextBox* className;
|
||||
MyGUI::ImageBox* mClassImage;
|
||||
MyGUI::TextBox* mClassName;
|
||||
|
||||
std::string currentClassId;
|
||||
std::string mCurrentClassId;
|
||||
};
|
||||
|
||||
class PickClassDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
PickClassDialog(WindowManager& parWindowManager);
|
||||
PickClassDialog(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
const std::string &getClassId() const { return currentClassId; }
|
||||
const std::string &getClassId() const { return mCurrentClassId; }
|
||||
void setClassId(const std::string &classId);
|
||||
|
||||
void setNextButtonShow(bool shown);
|
||||
|
@ -125,23 +124,23 @@ namespace MWGui
|
|||
void updateClasses();
|
||||
void updateStats();
|
||||
|
||||
MyGUI::ImageBox* classImage;
|
||||
MyGUI::ListBox* classList;
|
||||
MyGUI::TextBox* specializationName;
|
||||
Widgets::MWAttributePtr favoriteAttribute[2];
|
||||
Widgets::MWSkillPtr majorSkill[5];
|
||||
Widgets::MWSkillPtr minorSkill[5];
|
||||
MyGUI::ImageBox* mClassImage;
|
||||
MyGUI::ListBox* mClassList;
|
||||
MyGUI::TextBox* mSpecializationName;
|
||||
Widgets::MWAttributePtr mFavoriteAttribute[2];
|
||||
Widgets::MWSkillPtr mMajorSkill[5];
|
||||
Widgets::MWSkillPtr mMinorSkill[5];
|
||||
|
||||
std::string currentClassId;
|
||||
std::string mCurrentClassId;
|
||||
};
|
||||
|
||||
class SelectSpecializationDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
SelectSpecializationDialog(WindowManager& parWindowManager);
|
||||
SelectSpecializationDialog(MWBase::WindowManager& parWindowManager);
|
||||
~SelectSpecializationDialog();
|
||||
|
||||
ESM::Class::Specialization getSpecializationId() const { return specializationId; }
|
||||
ESM::Class::Specialization getSpecializationId() const { return mSpecializationId; }
|
||||
|
||||
// Events
|
||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
@ -161,20 +160,20 @@ namespace MWGui
|
|||
void onCancelClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
MyGUI::TextBox *specialization0, *specialization1, *specialization2;
|
||||
MyGUI::TextBox *mSpecialization0, *mSpecialization1, *mSpecialization2;
|
||||
|
||||
ESM::Class::Specialization specializationId;
|
||||
ESM::Class::Specialization mSpecializationId;
|
||||
};
|
||||
|
||||
class SelectAttributeDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
SelectAttributeDialog(WindowManager& parWindowManager);
|
||||
SelectAttributeDialog(MWBase::WindowManager& parWindowManager);
|
||||
~SelectAttributeDialog();
|
||||
|
||||
ESM::Attribute::AttributeID getAttributeId() const { return attributeId; }
|
||||
Widgets::MWAttributePtr getAffectedWidget() const { return affectedWidget; }
|
||||
void setAffectedWidget(Widgets::MWAttributePtr widget) { affectedWidget = widget; }
|
||||
ESM::Attribute::AttributeID getAttributeId() const { return mAttributeId; }
|
||||
Widgets::MWAttributePtr getAffectedWidget() const { return mAffectedWidget; }
|
||||
void setAffectedWidget(Widgets::MWAttributePtr widget) { mAffectedWidget = widget; }
|
||||
|
||||
// Events
|
||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
@ -194,20 +193,20 @@ namespace MWGui
|
|||
void onCancelClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
Widgets::MWAttributePtr affectedWidget;
|
||||
Widgets::MWAttributePtr mAffectedWidget;
|
||||
|
||||
ESM::Attribute::AttributeID attributeId;
|
||||
ESM::Attribute::AttributeID mAttributeId;
|
||||
};
|
||||
|
||||
class SelectSkillDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
SelectSkillDialog(WindowManager& parWindowManager);
|
||||
SelectSkillDialog(MWBase::WindowManager& parWindowManager);
|
||||
~SelectSkillDialog();
|
||||
|
||||
ESM::Skill::SkillEnum getSkillId() const { return skillId; }
|
||||
Widgets::MWSkillPtr getAffectedWidget() const { return affectedWidget; }
|
||||
void setAffectedWidget(Widgets::MWSkillPtr widget) { affectedWidget = widget; }
|
||||
ESM::Skill::SkillEnum getSkillId() const { return mSkillId; }
|
||||
Widgets::MWSkillPtr getAffectedWidget() const { return mAffectedWidget; }
|
||||
void setAffectedWidget(Widgets::MWSkillPtr widget) { mAffectedWidget = widget; }
|
||||
|
||||
// Events
|
||||
typedef delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
@ -227,34 +226,34 @@ namespace MWGui
|
|||
void onCancelClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
Widgets::MWSkillPtr combatSkill[9];
|
||||
Widgets::MWSkillPtr magicSkill[9];
|
||||
Widgets::MWSkillPtr stealthSkill[9];
|
||||
Widgets::MWSkillPtr affectedWidget;
|
||||
Widgets::MWSkillPtr mCombatSkill[9];
|
||||
Widgets::MWSkillPtr mMagicSkill[9];
|
||||
Widgets::MWSkillPtr mStealthSkill[9];
|
||||
Widgets::MWSkillPtr mAffectedWidget;
|
||||
|
||||
ESM::Skill::SkillEnum skillId;
|
||||
ESM::Skill::SkillEnum mSkillId;
|
||||
};
|
||||
|
||||
class DescriptionDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
DescriptionDialog(WindowManager& parWindowManager);
|
||||
DescriptionDialog(MWBase::WindowManager& parWindowManager);
|
||||
~DescriptionDialog();
|
||||
|
||||
std::string getTextInput() const { return textEdit ? textEdit->getOnlyText() : ""; }
|
||||
void setTextInput(const std::string &text) { if (textEdit) textEdit->setOnlyText(text); }
|
||||
std::string getTextInput() const { return mTextEdit ? mTextEdit->getOnlyText() : ""; }
|
||||
void setTextInput(const std::string &text) { if (mTextEdit) mTextEdit->setOnlyText(text); }
|
||||
|
||||
protected:
|
||||
void onOkClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
MyGUI::EditPtr textEdit;
|
||||
MyGUI::EditPtr mTextEdit;
|
||||
};
|
||||
|
||||
class CreateClassDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
CreateClassDialog(WindowManager& parWindowManager);
|
||||
CreateClassDialog(MWBase::WindowManager& parWindowManager);
|
||||
virtual ~CreateClassDialog();
|
||||
|
||||
std::string getName() const;
|
||||
|
@ -294,20 +293,20 @@ namespace MWGui
|
|||
void update();
|
||||
|
||||
private:
|
||||
MyGUI::EditPtr editName;
|
||||
MyGUI::TextBox* specializationName;
|
||||
Widgets::MWAttributePtr favoriteAttribute0, favoriteAttribute1;
|
||||
Widgets::MWSkillPtr majorSkill[5];
|
||||
Widgets::MWSkillPtr minorSkill[5];
|
||||
std::vector<Widgets::MWSkillPtr> skills;
|
||||
std::string description;
|
||||
MyGUI::EditPtr mEditName;
|
||||
MyGUI::TextBox* mSpecializationName;
|
||||
Widgets::MWAttributePtr mFavoriteAttribute0, mFavoriteAttribute1;
|
||||
Widgets::MWSkillPtr mMajorSkill[5];
|
||||
Widgets::MWSkillPtr mMinorSkill[5];
|
||||
std::vector<Widgets::MWSkillPtr> mSkills;
|
||||
std::string mDescription;
|
||||
|
||||
SelectSpecializationDialog *specDialog;
|
||||
SelectAttributeDialog *attribDialog;
|
||||
SelectSkillDialog *skillDialog;
|
||||
DescriptionDialog *descDialog;
|
||||
SelectSpecializationDialog *mSpecDialog;
|
||||
SelectAttributeDialog *mAttribDialog;
|
||||
SelectSkillDialog *mSkillDialog;
|
||||
DescriptionDialog *mDescDialog;
|
||||
|
||||
ESM::Class::Specialization specializationId;
|
||||
ESM::Class::Specialization mSpecializationId;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
ConfirmationDialog::ConfirmationDialog(WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_confirmation_dialog_layout.xml", parWindowManager)
|
||||
ConfirmationDialog::ConfirmationDialog(MWBase::WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_confirmation_dialog.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mMessage, "Message");
|
||||
getWidget(mOkButton, "OkButton");
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace MWGui
|
|||
class ConfirmationDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
ConfirmationDialog(WindowManager& parWindowManager);
|
||||
ConfirmationDialog(MWBase::WindowManager& parWindowManager);
|
||||
void open(const std::string& message);
|
||||
|
||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
#include "console.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
|
||||
#include <components/esm_store/reclists.hpp>
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include <components/compiler/exception.hpp>
|
||||
|
||||
|
@ -102,9 +106,10 @@ namespace MWGui
|
|||
}
|
||||
}
|
||||
|
||||
Console::Console(int w, int h, const Compiler::Extensions& extensions)
|
||||
: Layout("openmw_console_layout.xml"),
|
||||
mCompilerContext (MWScript::CompilerContext::Type_Console)
|
||||
Console::Console(int w, int h, bool consoleOnlyScripts)
|
||||
: Layout("openmw_console.layout"),
|
||||
mCompilerContext (MWScript::CompilerContext::Type_Console),
|
||||
mConsoleOnlyScripts (consoleOnlyScripts)
|
||||
{
|
||||
setCoord(10,10, w-10, h/2);
|
||||
|
||||
|
@ -123,7 +128,8 @@ namespace MWGui
|
|||
history->setVisibleVScroll(true);
|
||||
|
||||
// compiler
|
||||
mCompilerContext.setExtensions (&extensions);
|
||||
MWScript::registerExtensions (mExtensions, mConsoleOnlyScripts);
|
||||
mCompilerContext.setExtensions (&mExtensions);
|
||||
}
|
||||
|
||||
void Console::enable()
|
||||
|
@ -170,6 +176,47 @@ namespace MWGui
|
|||
print("#FF2222" + msg + "\n");
|
||||
}
|
||||
|
||||
void Console::execute (const std::string& command)
|
||||
{
|
||||
// Log the command
|
||||
print("#FFFFFF> " + command + "\n");
|
||||
|
||||
Compiler::Locals locals;
|
||||
Compiler::Output output (locals);
|
||||
|
||||
if (compile (command + "\n", output))
|
||||
{
|
||||
try
|
||||
{
|
||||
ConsoleInterpreterContext interpreterContext (*this, mPtr);
|
||||
Interpreter::Interpreter interpreter;
|
||||
MWScript::installOpcodes (interpreter, mConsoleOnlyScripts);
|
||||
std::vector<Interpreter::Type_Code> code;
|
||||
output.getCode (code);
|
||||
interpreter.run (&code[0], code.size(), interpreterContext);
|
||||
}
|
||||
catch (const std::exception& error)
|
||||
{
|
||||
printError (std::string ("An exception has been thrown: ") + error.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Console::executeFile (const std::string& path)
|
||||
{
|
||||
std::ifstream stream (path.c_str());
|
||||
|
||||
if (!stream.is_open())
|
||||
printError ("failed to open file: " + path);
|
||||
else
|
||||
{
|
||||
std::string line;
|
||||
|
||||
while (std::getline (stream, line))
|
||||
execute (line);
|
||||
}
|
||||
}
|
||||
|
||||
void Console::keyPress(MyGUI::WidgetPtr _sender,
|
||||
MyGUI::KeyCode key,
|
||||
MyGUI::Char _char)
|
||||
|
@ -231,28 +278,7 @@ namespace MWGui
|
|||
current = command_history.end();
|
||||
editString.clear();
|
||||
|
||||
// Log the command
|
||||
print("#FFFFFF> " + cm + "\n");
|
||||
|
||||
Compiler::Locals locals;
|
||||
Compiler::Output output (locals);
|
||||
|
||||
if (compile (cm + "\n", output))
|
||||
{
|
||||
try
|
||||
{
|
||||
ConsoleInterpreterContext interpreterContext (*this, mPtr);
|
||||
Interpreter::Interpreter interpreter;
|
||||
MWScript::installOpcodes (interpreter);
|
||||
std::vector<Interpreter::Type_Code> code;
|
||||
output.getCode (code);
|
||||
interpreter.run (&code[0], code.size(), interpreterContext);
|
||||
}
|
||||
catch (const std::exception& error)
|
||||
{
|
||||
printError (std::string ("An exception has been thrown: ") + error.what());
|
||||
}
|
||||
}
|
||||
execute (cm);
|
||||
|
||||
command->setCaption("");
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <components/compiler/scanner.hpp>
|
||||
#include <components/compiler/locals.hpp>
|
||||
#include <components/compiler/output.hpp>
|
||||
#include <components/compiler/extensions.hpp>
|
||||
#include <components/interpreter/interpreter.hpp>
|
||||
|
||||
#include "../mwscript/compilercontext.hpp"
|
||||
|
@ -24,8 +25,10 @@ namespace MWGui
|
|||
{
|
||||
private:
|
||||
|
||||
Compiler::Extensions mExtensions;
|
||||
MWScript::CompilerContext mCompilerContext;
|
||||
std::vector<std::string> mNames;
|
||||
bool mConsoleOnlyScripts;
|
||||
|
||||
bool compile (const std::string& cmd, Compiler::Output& output);
|
||||
|
||||
|
@ -62,7 +65,7 @@ namespace MWGui
|
|||
StringList::iterator current;
|
||||
std::string editString;
|
||||
|
||||
Console(int w, int h, const Compiler::Extensions& extensions);
|
||||
Console(int w, int h, bool consoleOnlyScripts);
|
||||
|
||||
void enable();
|
||||
|
||||
|
@ -86,6 +89,10 @@ namespace MWGui
|
|||
/// Error message
|
||||
void printError(const std::string &msg);
|
||||
|
||||
void execute (const std::string& command);
|
||||
|
||||
void executeFile (const std::string& command);
|
||||
|
||||
private:
|
||||
|
||||
void keyPress(MyGUI::WidgetPtr _sender,
|
||||
|
|
|
@ -3,22 +3,23 @@
|
|||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/manualref.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwclass/container.hpp"
|
||||
#include "../mwinput/inputmanager.hpp"
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
#include "window_manager.hpp"
|
||||
#include "../mwclass/container.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
#include "countdialog.hpp"
|
||||
#include "tradewindow.hpp"
|
||||
|
@ -273,7 +274,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
|
|||
// check the container's Organic flag (if this is a container). container with Organic flag doesn't allow putting items inside
|
||||
if (mPtr.getTypeName() == typeid(ESM::Container).name())
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData>* ref = mPtr.get<ESM::Container>();
|
||||
MWWorld::LiveCellRef<ESM::Container>* ref = mPtr.get<ESM::Container>();
|
||||
if (ref->base->flags & ESM::Container::Organic)
|
||||
{
|
||||
// user notification
|
||||
|
@ -556,7 +557,7 @@ void ContainerBase::addItem(MWWorld::Ptr item, int count)
|
|||
{
|
||||
MWWorld::ContainerStore& containerStore = MWWorld::Class::get(mPtr).getContainerStore(mPtr);
|
||||
|
||||
int origCount = item.getRefData().getCount();
|
||||
int origCount = item.getRefData().getCount();
|
||||
|
||||
item.getRefData().setCount(count);
|
||||
MWWorld::ContainerStoreIterator it = containerStore.add(item);
|
||||
|
@ -590,9 +591,9 @@ MWWorld::ContainerStore& ContainerBase::getContainerStore()
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
ContainerWindow::ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop)
|
||||
ContainerWindow::ContainerWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop)
|
||||
: ContainerBase(dragAndDrop)
|
||||
, WindowBase("openmw_container_window_layout.xml", parWindowManager)
|
||||
, WindowBase("openmw_container_window.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mTakeButton, "TakeButton");
|
||||
getWidget(mCloseButton, "CloseButton");
|
||||
|
@ -612,12 +613,9 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dr
|
|||
mCloseButton->setCoord(600-20-closeButtonWidth, mCloseButton->getCoord().top, closeButtonWidth, mCloseButton->getCoord().height);
|
||||
mTakeButton->setCoord(600-20-closeButtonWidth-takeButtonWidth-8, mTakeButton->getCoord().top, takeButtonWidth, mTakeButton->getCoord().height);
|
||||
|
||||
int w = MyGUI::RenderManager::getInstance().getViewSize().width;
|
||||
//int h = MyGUI::RenderManager::getInstance().getViewSize().height;
|
||||
|
||||
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &ContainerWindow::onWindowResize);
|
||||
|
||||
setCoord(w-600,0,600,300);
|
||||
setCoord(200,0,600,300);
|
||||
}
|
||||
|
||||
ContainerWindow::~ContainerWindow()
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace MWGui
|
|||
class ContainerWindow : public ContainerBase, public WindowBase
|
||||
{
|
||||
public:
|
||||
ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop);
|
||||
ContainerWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop);
|
||||
|
||||
virtual ~ContainerWindow();
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
CountDialog::CountDialog(WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_count_window_layout.xml", parWindowManager)
|
||||
CountDialog::CountDialog(MWBase::WindowManager& parWindowManager) :
|
||||
WindowBase("openmw_count_window.layout", parWindowManager)
|
||||
{
|
||||
getWidget(mSlider, "CountSlider");
|
||||
getWidget(mItemEdit, "ItemEdit");
|
||||
|
@ -77,7 +77,7 @@ namespace MWGui
|
|||
{
|
||||
if (_sender->getCaption() == "")
|
||||
return;
|
||||
|
||||
|
||||
unsigned int count;
|
||||
try
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace MWGui
|
|||
class CountDialog : public WindowBase
|
||||
{
|
||||
public:
|
||||
CountDialog(WindowManager& parWindowManager);
|
||||
CountDialog(MWBase::WindowManager& parWindowManager);
|
||||
void open(const std::string& item, const std::string& message, const int maxCount);
|
||||
|
||||
typedef MyGUI::delegates::CMultiDelegate2<MyGUI::Widget*, int> EventHandle_WidgetInt;
|
||||
|
|
|
@ -16,4 +16,5 @@ CursorReplace::CursorReplace()
|
|||
OEngine::Render::ImageRotate::rotate("textures\\tx_cursormove.dds", "mwpointer_dresize2.png", 45);
|
||||
|
||||
OEngine::Render::Atlas::createFromFile("atlas1.cfg", "mwgui1", "textures\\");
|
||||
OEngine::Render::Atlas::createFromFile("mainmenu.cfg", "mwgui2", "textures\\");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "dialogue.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
|
@ -10,10 +9,11 @@
|
|||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwdialogue/dialoguemanager.hpp"
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "dialogue_history.hpp"
|
||||
#include "window_manager.hpp"
|
||||
#include "widgets.hpp"
|
||||
#include "list.hpp"
|
||||
#include "tradewindow.hpp"
|
||||
|
@ -42,8 +42,8 @@ std::string::size_type find_str_ci(const std::string& str, const std::string& su
|
|||
}
|
||||
|
||||
|
||||
DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_dialogue_window_layout.xml", parWindowManager)
|
||||
DialogueWindow::DialogueWindow(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_dialogue_window.layout", parWindowManager)
|
||||
, mEnabled(true)
|
||||
, mShowTrade(false)
|
||||
{
|
||||
|
@ -51,9 +51,9 @@ DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
|
|||
center();
|
||||
|
||||
//History view
|
||||
getWidget(history, "History");
|
||||
history->setOverflowToTheLeft(true);
|
||||
history->setMaxTextLength(1000000);
|
||||
getWidget(mHistory, "History");
|
||||
mHistory->setOverflowToTheLeft(true);
|
||||
mHistory->setMaxTextLength(1000000);
|
||||
Widget* eventbox;
|
||||
|
||||
//An EditBox cannot receive mouse click events, so we use an
|
||||
|
@ -63,36 +63,36 @@ DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
|
|||
eventbox->eventMouseWheel += MyGUI::newDelegate(this, &DialogueWindow::onMouseWheel);
|
||||
|
||||
//Topics list
|
||||
getWidget(topicsList, "TopicsList");
|
||||
topicsList->eventItemSelected += MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
||||
getWidget(mTopicsList, "TopicsList");
|
||||
mTopicsList->eventItemSelected += MyGUI::newDelegate(this, &DialogueWindow::onSelectTopic);
|
||||
|
||||
MyGUI::ButtonPtr byeButton;
|
||||
getWidget(byeButton, "ByeButton");
|
||||
byeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DialogueWindow::onByeClicked);
|
||||
|
||||
getWidget(pDispositionBar, "Disposition");
|
||||
getWidget(pDispositionText,"DispositionText");
|
||||
getWidget(mDispositionBar, "Disposition");
|
||||
getWidget(mDispositionText,"DispositionText");
|
||||
|
||||
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);
|
||||
}
|
||||
|
||||
void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
ISubWidgetText* t = history->getClient()->getSubWidgetText();
|
||||
ISubWidgetText* t = mHistory->getClient()->getSubWidgetText();
|
||||
if(t == nullptr)
|
||||
return;
|
||||
|
||||
const IntPoint& lastPressed = InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left);
|
||||
|
||||
size_t cursorPosition = t->getCursorPosition(lastPressed);
|
||||
MyGUI::UString color = history->getColorAtPos(cursorPosition);
|
||||
MyGUI::UString color = mHistory->getColorAtPos(cursorPosition);
|
||||
|
||||
if (!mEnabled && color == "#572D21")
|
||||
MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
|
||||
|
||||
if(color != "#B29154")
|
||||
{
|
||||
UString key = history->getColorTextAt(cursorPosition);
|
||||
UString key = mHistory->getColorTextAt(cursorPosition);
|
||||
if(color == "#686EBA") MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(key));
|
||||
|
||||
if(color == "#572D21") MWBase::Environment::get().getDialogueManager()->questionAnswered(lower_string(key));
|
||||
|
@ -101,15 +101,15 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
|||
|
||||
void DialogueWindow::onWindowResize(MyGUI::Window* _sender)
|
||||
{
|
||||
topicsList->adjustSize();
|
||||
mTopicsList->adjustSize();
|
||||
}
|
||||
|
||||
void DialogueWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||
{
|
||||
if (history->getVScrollPosition() - _rel*0.3 < 0)
|
||||
history->setVScrollPosition(0);
|
||||
if (mHistory->getVScrollPosition() - _rel*0.3 < 0)
|
||||
mHistory->setVScrollPosition(0);
|
||||
else
|
||||
history->setVScrollPosition(history->getVScrollPosition() - _rel*0.3);
|
||||
mHistory->setVScrollPosition(mHistory->getVScrollPosition() - _rel*0.3);
|
||||
}
|
||||
|
||||
void DialogueWindow::onByeClicked(MyGUI::Widget* _sender)
|
||||
|
@ -136,40 +136,40 @@ void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName)
|
|||
{
|
||||
mEnabled = true;
|
||||
mPtr = actor;
|
||||
topicsList->setEnabled(true);
|
||||
mTopicsList->setEnabled(true);
|
||||
setTitle(npcName);
|
||||
|
||||
topicsList->clear();
|
||||
history->eraseText(0,history->getTextLength());
|
||||
mTopicsList->clear();
|
||||
mHistory->eraseText(0,mHistory->getTextLength());
|
||||
updateOptions();
|
||||
}
|
||||
|
||||
void DialogueWindow::setKeywords(std::list<std::string> keyWords)
|
||||
{
|
||||
topicsList->clear();
|
||||
mTopicsList->clear();
|
||||
|
||||
bool anyService = mShowTrade;
|
||||
|
||||
if (mShowTrade)
|
||||
topicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->str);
|
||||
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->str);
|
||||
|
||||
if (anyService)
|
||||
topicsList->addSeparator();
|
||||
mTopicsList->addSeparator();
|
||||
|
||||
for(std::list<std::string>::iterator it = keyWords.begin(); it != keyWords.end(); ++it)
|
||||
{
|
||||
topicsList->addItem(*it);
|
||||
mTopicsList->addItem(*it);
|
||||
}
|
||||
topicsList->adjustSize();
|
||||
mTopicsList->adjustSize();
|
||||
}
|
||||
|
||||
void DialogueWindow::removeKeyword(std::string keyWord)
|
||||
{
|
||||
if(topicsList->hasItem(keyWord))
|
||||
if(mTopicsList->hasItem(keyWord))
|
||||
{
|
||||
topicsList->removeItem(keyWord);
|
||||
mTopicsList->removeItem(keyWord);
|
||||
}
|
||||
topicsList->adjustSize();
|
||||
mTopicsList->adjustSize();
|
||||
}
|
||||
|
||||
void addColorInString(std::string& str, const std::string& keyword,std::string color1, std::string color2)
|
||||
|
@ -206,9 +206,9 @@ void addColorInString(std::string& str, const std::string& keyword,std::string c
|
|||
std::string DialogueWindow::parseText(std::string text)
|
||||
{
|
||||
bool separatorReached = false; // only parse topics that are below the separator (this prevents actions like "Barter" that are not topics from getting blue-colored)
|
||||
for(unsigned int i = 0;i<topicsList->getItemCount();i++)
|
||||
for(unsigned int i = 0;i<mTopicsList->getItemCount();i++)
|
||||
{
|
||||
std::string keyWord = topicsList->getItemNameAt(i);
|
||||
std::string keyWord = mTopicsList->getItemNameAt(i);
|
||||
if (separatorReached && keyWord != "")
|
||||
addColorInString(text,keyWord,"#686EBA","#B29154");
|
||||
else
|
||||
|
@ -219,7 +219,7 @@ std::string DialogueWindow::parseText(std::string text)
|
|||
|
||||
void DialogueWindow::addText(std::string text)
|
||||
{
|
||||
history->addDialogText("#B29154"+parseText(text)+"#B29154");
|
||||
mHistory->addDialogText("#B29154"+parseText(text)+"#B29154");
|
||||
}
|
||||
|
||||
void DialogueWindow::addTitle(std::string text)
|
||||
|
@ -227,37 +227,37 @@ void DialogueWindow::addTitle(std::string text)
|
|||
// This is called from the dialogue manager, so text is
|
||||
// case-smashed - thus we have to retrieve the correct case
|
||||
// of the text through the topic list.
|
||||
for (size_t i=0; i<topicsList->getItemCount(); ++i)
|
||||
for (size_t i=0; i<mTopicsList->getItemCount(); ++i)
|
||||
{
|
||||
std::string item = topicsList->getItemNameAt(i);
|
||||
std::string item = mTopicsList->getItemNameAt(i);
|
||||
if (lower_string(item) == text)
|
||||
text = item;
|
||||
}
|
||||
|
||||
history->addDialogHeading(text);
|
||||
mHistory->addDialogHeading(text);
|
||||
}
|
||||
|
||||
void DialogueWindow::askQuestion(std::string question)
|
||||
{
|
||||
history->addDialogText("#572D21"+question+"#B29154"+" ");
|
||||
mHistory->addDialogText("#572D21"+question+"#B29154"+" ");
|
||||
}
|
||||
|
||||
void DialogueWindow::updateOptions()
|
||||
{
|
||||
//Clear the list of topics
|
||||
topicsList->clear();
|
||||
history->eraseText(0,history->getTextLength());
|
||||
mTopicsList->clear();
|
||||
mHistory->eraseText(0, mHistory->getTextLength());
|
||||
|
||||
pDispositionBar->setProgressRange(100);
|
||||
pDispositionBar->setProgressPosition(40);
|
||||
pDispositionText->eraseText(0,pDispositionText->getTextLength());
|
||||
pDispositionText->addText("#B29154"+std::string("40/100")+"#B29154");
|
||||
mDispositionBar->setProgressRange(100);
|
||||
mDispositionBar->setProgressPosition(40);
|
||||
mDispositionText->eraseText(0, mDispositionText->getTextLength());
|
||||
mDispositionText->addText("#B29154"+std::string("40/100")+"#B29154");
|
||||
}
|
||||
|
||||
void DialogueWindow::goodbye()
|
||||
{
|
||||
history->addDialogText("\n#572D21" + MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGoodbye")->str);
|
||||
topicsList->setEnabled(false);
|
||||
mHistory->addDialogText("\n#572D21" + MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGoodbye")->str);
|
||||
mTopicsList->setEnabled(false);
|
||||
mEnabled = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace MWGui
|
|||
|
||||
/*
|
||||
This file contains the dialouge window
|
||||
Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml.
|
||||
Layout is defined by resources/mygui/openmw_dialogue_window.layout.
|
||||
*/
|
||||
|
||||
namespace MWGui
|
||||
|
@ -29,7 +29,7 @@ namespace MWGui
|
|||
class DialogueWindow: public WindowBase, public ReferenceInterface
|
||||
{
|
||||
public:
|
||||
DialogueWindow(WindowManager& parWindowManager);
|
||||
DialogueWindow(MWBase::WindowManager& parWindowManager);
|
||||
|
||||
// Events
|
||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||
|
@ -73,10 +73,10 @@ namespace MWGui
|
|||
|
||||
bool mEnabled;
|
||||
|
||||
DialogueHistory* history;
|
||||
Widgets::MWList* topicsList;
|
||||
MyGUI::ProgressPtr pDispositionBar;
|
||||
MyGUI::EditPtr pDispositionText;
|
||||
DialogueHistory* mHistory;
|
||||
Widgets::MWList* mTopicsList;
|
||||
MyGUI::ProgressPtr mDispositionBar;
|
||||
MyGUI::EditPtr mDispositionText;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#include "dialogue_history.hpp"
|
||||
#include "window_manager.hpp"
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
|
@ -72,4 +73,3 @@ void DialogueHistory::addDialogText(const UString& parText)
|
|||
addText(parText);
|
||||
addText("\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -7,41 +7,44 @@
|
|||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/world.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "../mwgui/widgets.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
#include "window_manager.hpp"
|
||||
#include "container.hpp"
|
||||
#include "console.hpp"
|
||||
|
||||
using namespace MWGui;
|
||||
|
||||
HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
||||
: Layout("openmw_hud_layout.xml")
|
||||
: Layout("openmw_hud.layout")
|
||||
, health(NULL)
|
||||
, magicka(NULL)
|
||||
, stamina(NULL)
|
||||
, weapImage(NULL)
|
||||
, spellImage(NULL)
|
||||
, weapStatus(NULL)
|
||||
, spellStatus(NULL)
|
||||
, effectBox(NULL)
|
||||
, effect1(NULL)
|
||||
, minimap(NULL)
|
||||
, compass(NULL)
|
||||
, crosshair(NULL)
|
||||
, mWeapImage(NULL)
|
||||
, mSpellImage(NULL)
|
||||
, mWeapStatus(NULL)
|
||||
, mSpellStatus(NULL)
|
||||
, mEffectBox(NULL)
|
||||
, mEffect1(NULL)
|
||||
, mMinimap(NULL)
|
||||
, mCompass(NULL)
|
||||
, mCrosshair(NULL)
|
||||
, fpsbox(NULL)
|
||||
, fpscounter(NULL)
|
||||
, trianglecounter(NULL)
|
||||
, batchcounter(NULL)
|
||||
, hmsBaseLeft(0)
|
||||
, weapBoxBaseLeft(0)
|
||||
, spellBoxBaseLeft(0)
|
||||
, effectBoxBaseRight(0)
|
||||
, minimapBoxBaseRight(0)
|
||||
, mHealthManaStaminaBaseLeft(0)
|
||||
, mWeapBoxBaseLeft(0)
|
||||
, mSpellBoxBaseLeft(0)
|
||||
, mEffectBoxBaseRight(0)
|
||||
, mMinimapBoxBaseRight(0)
|
||||
, mDragAndDrop(dragAndDrop)
|
||||
, mCellNameTimer(0.0f)
|
||||
, mCellNameBox(NULL)
|
||||
|
@ -58,7 +61,7 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
|||
getWidget(magicka, "Magicka");
|
||||
getWidget(stamina, "Stamina");
|
||||
|
||||
hmsBaseLeft = mHealthFrame->getLeft();
|
||||
mHealthManaStaminaBaseLeft = mHealthFrame->getLeft();
|
||||
|
||||
MyGUI::Widget *healthFrame, *magickaFrame, *fatigueFrame;
|
||||
getWidget(healthFrame, "HealthFrame");
|
||||
|
@ -71,33 +74,33 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
|||
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
|
||||
// Item and spell images and status bars
|
||||
getWidget(weapBox, "WeapBox");
|
||||
getWidget(weapImage, "WeapImage");
|
||||
getWidget(weapStatus, "WeapStatus");
|
||||
weapBoxBaseLeft = weapBox->getLeft();
|
||||
weapBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWeaponClicked);
|
||||
getWidget(mWeapBox, "WeapBox");
|
||||
getWidget(mWeapImage, "WeapImage");
|
||||
getWidget(mWeapStatus, "WeapStatus");
|
||||
mWeapBoxBaseLeft = mWeapBox->getLeft();
|
||||
mWeapBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWeaponClicked);
|
||||
|
||||
getWidget(spellBox, "SpellBox");
|
||||
getWidget(spellImage, "SpellImage");
|
||||
getWidget(spellStatus, "SpellStatus");
|
||||
spellBoxBaseLeft = spellBox->getLeft();
|
||||
spellBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
||||
getWidget(mSpellBox, "SpellBox");
|
||||
getWidget(mSpellImage, "SpellImage");
|
||||
getWidget(mSpellStatus, "SpellStatus");
|
||||
mSpellBoxBaseLeft = mSpellBox->getLeft();
|
||||
mSpellBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
||||
|
||||
getWidget(effectBox, "EffectBox");
|
||||
getWidget(effect1, "Effect1");
|
||||
effectBoxBaseRight = viewSize.width - effectBox->getRight();
|
||||
effectBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
||||
getWidget(mEffectBox, "EffectBox");
|
||||
getWidget(mEffect1, "Effect1");
|
||||
mEffectBoxBaseRight = viewSize.width - mEffectBox->getRight();
|
||||
mEffectBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);
|
||||
|
||||
getWidget(minimapBox, "MiniMapBox");
|
||||
minimapBoxBaseRight = viewSize.width - minimapBox->getRight();
|
||||
minimapBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMapClicked);
|
||||
getWidget(minimap, "MiniMap");
|
||||
getWidget(compass, "Compass");
|
||||
getWidget(mMinimapBox, "MiniMapBox");
|
||||
mMinimapBoxBaseRight = viewSize.width - mMinimapBox->getRight();
|
||||
mMinimapBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMapClicked);
|
||||
getWidget(mMinimap, "MiniMap");
|
||||
getWidget(mCompass, "Compass");
|
||||
|
||||
getWidget(mCellNameBox, "CellName");
|
||||
getWidget(mWeaponSpellBox, "WeaponSpellName");
|
||||
|
||||
getWidget(crosshair, "Crosshair");
|
||||
getWidget(mCrosshair, "Crosshair");
|
||||
|
||||
setFpsLevel(fpsLevel);
|
||||
|
||||
|
@ -106,7 +109,7 @@ HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
|
|||
|
||||
setEffect("icons\\s\\tx_s_chameleon.dds");
|
||||
|
||||
LocalMapBase::init(minimap, compass, this);
|
||||
LocalMapBase::init(mMinimap, mCompass, this);
|
||||
|
||||
mMainWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWorldClicked);
|
||||
mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver);
|
||||
|
@ -143,19 +146,19 @@ void HUD::setFPS(float fps)
|
|||
fpscounter->setCaption(boost::lexical_cast<std::string>((int)fps));
|
||||
}
|
||||
|
||||
void HUD::setTriangleCount(size_t count)
|
||||
void HUD::setTriangleCount(unsigned int count)
|
||||
{
|
||||
trianglecounter->setCaption(boost::lexical_cast<std::string>(count));
|
||||
}
|
||||
|
||||
void HUD::setBatchCount(size_t count)
|
||||
void HUD::setBatchCount(unsigned int count)
|
||||
{
|
||||
batchcounter->setCaption(boost::lexical_cast<std::string>(count));
|
||||
}
|
||||
|
||||
void HUD::setEffect(const char *img)
|
||||
{
|
||||
effect1->setImageTexture(img);
|
||||
mEffect1->setImageTexture(img);
|
||||
}
|
||||
|
||||
void HUD::setValue(const std::string& id, const MWMechanics::DynamicStat<int>& value)
|
||||
|
@ -198,10 +201,10 @@ void HUD::setBottomLeftVisibility(bool hmsVisible, bool weapVisible, bool spellV
|
|||
{
|
||||
int weapDx = 0, spellDx = 0;
|
||||
if (!hmsVisible)
|
||||
spellDx = weapDx = weapBoxBaseLeft - hmsBaseLeft;
|
||||
spellDx = weapDx = mWeapBoxBaseLeft - mHealthManaStaminaBaseLeft;
|
||||
|
||||
if (!weapVisible)
|
||||
spellDx += spellBoxBaseLeft - weapBoxBaseLeft;
|
||||
spellDx += mSpellBoxBaseLeft - mWeapBoxBaseLeft;
|
||||
|
||||
mWeaponVisible = weapVisible;
|
||||
mSpellVisible = spellVisible;
|
||||
|
@ -211,10 +214,10 @@ void HUD::setBottomLeftVisibility(bool hmsVisible, bool weapVisible, bool spellV
|
|||
health->setVisible(hmsVisible);
|
||||
stamina->setVisible(hmsVisible);
|
||||
magicka->setVisible(hmsVisible);
|
||||
weapBox->setPosition(weapBoxBaseLeft - weapDx, weapBox->getTop());
|
||||
weapBox->setVisible(weapVisible);
|
||||
spellBox->setPosition(spellBoxBaseLeft - spellDx, spellBox->getTop());
|
||||
spellBox->setVisible(spellVisible);
|
||||
mWeapBox->setPosition(mWeapBoxBaseLeft - weapDx, mWeapBox->getTop());
|
||||
mWeapBox->setVisible(weapVisible);
|
||||
mSpellBox->setPosition(mSpellBoxBaseLeft - spellDx, mSpellBox->getTop());
|
||||
mSpellBox->setVisible(spellVisible);
|
||||
}
|
||||
|
||||
void HUD::setBottomRightVisibility(bool effectBoxVisible, bool minimapBoxVisible)
|
||||
|
@ -224,12 +227,12 @@ void HUD::setBottomRightVisibility(bool effectBoxVisible, bool minimapBoxVisible
|
|||
// effect box can have variable width -> variable left coordinate
|
||||
int effectsDx = 0;
|
||||
if (!minimapBoxVisible)
|
||||
effectsDx = (viewSize.width - minimapBoxBaseRight) - (viewSize.width - effectBoxBaseRight);
|
||||
effectsDx = (viewSize.width - mMinimapBoxBaseRight) - (viewSize.width - mEffectBoxBaseRight);
|
||||
|
||||
mMapVisible = minimapBoxVisible;
|
||||
minimapBox->setVisible(minimapBoxVisible);
|
||||
effectBox->setPosition((viewSize.width - effectBoxBaseRight) - effectBox->getWidth() + effectsDx, effectBox->getTop());
|
||||
effectBox->setVisible(effectBoxVisible);
|
||||
mMinimapBox->setVisible(minimapBoxVisible);
|
||||
mEffectBox->setPosition((viewSize.width - mEffectBoxBaseRight) - mEffectBox->getWidth() + effectsDx, mEffectBox->getTop());
|
||||
mEffectBox->setVisible(effectBoxVisible);
|
||||
}
|
||||
|
||||
void HUD::onWorldClicked(MyGUI::Widget* _sender)
|
||||
|
@ -239,7 +242,7 @@ void HUD::onWorldClicked(MyGUI::Widget* _sender)
|
|||
// drop item into the gameworld
|
||||
MWWorld::Ptr object = *mDragAndDrop->mDraggedWidget->getUserData<MWWorld::Ptr>();
|
||||
|
||||
MWWorld::World* world = MWBase::Environment::get().getWorld();
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
|
||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
MyGUI::IntPoint cursorPosition = MyGUI::InputManager::getInstance().getMousePosition();
|
||||
|
@ -282,7 +285,7 @@ void HUD::onWorldClicked(MyGUI::Widget* _sender)
|
|||
{
|
||||
object = MWBase::Environment::get().getWorld()->getPtrViaHandle(handle);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
catch (std::exception& /* e */)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -308,7 +311,7 @@ void HUD::onWorldMouseOver(MyGUI::Widget* _sender, int x, int y)
|
|||
float mouseX = cursorPosition.left / float(viewSize.width);
|
||||
float mouseY = cursorPosition.top / float(viewSize.height);
|
||||
|
||||
MWWorld::World* world = MWBase::Environment::get().getWorld();
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
|
||||
// if we can't drop the object at the wanted position, show the "drop on ground" cursor.
|
||||
bool canDrop = world->canPlaceObject(mouseX, mouseY);
|
||||
|
@ -391,14 +394,14 @@ void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
|
|||
mWeaponSpellBox->setVisible(true);
|
||||
}
|
||||
|
||||
spellStatus->setProgressRange(100);
|
||||
spellStatus->setProgressPosition(successChancePercent);
|
||||
mSpellStatus->setProgressRange(100);
|
||||
mSpellStatus->setProgressPosition(successChancePercent);
|
||||
|
||||
if (spellImage->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(spellImage->getChildAt(0));
|
||||
if (mSpellImage->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(mSpellImage->getChildAt(0));
|
||||
|
||||
spellBox->setUserString("ToolTipType", "Spell");
|
||||
spellBox->setUserString("Spell", spellId);
|
||||
mSpellBox->setUserString("ToolTipType", "Spell");
|
||||
mSpellBox->setUserString("Spell", spellId);
|
||||
|
||||
// use the icon of the first effect
|
||||
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->effects.list.front().effectID);
|
||||
|
@ -407,7 +410,7 @@ void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
|
|||
icon.insert(slashPos+1, "b_");
|
||||
icon = std::string("icons\\") + icon;
|
||||
Widgets::fixTexturePath(icon);
|
||||
spellImage->setImageTexture(icon);
|
||||
mSpellImage->setImageTexture(icon);
|
||||
}
|
||||
|
||||
void HUD::setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent)
|
||||
|
@ -421,17 +424,17 @@ void HUD::setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent)
|
|||
mWeaponSpellBox->setVisible(true);
|
||||
}
|
||||
|
||||
spellStatus->setProgressRange(100);
|
||||
spellStatus->setProgressPosition(chargePercent);
|
||||
mSpellStatus->setProgressRange(100);
|
||||
mSpellStatus->setProgressPosition(chargePercent);
|
||||
|
||||
if (spellImage->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(spellImage->getChildAt(0));
|
||||
if (mSpellImage->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(mSpellImage->getChildAt(0));
|
||||
|
||||
spellBox->setUserString("ToolTipType", "ItemPtr");
|
||||
spellBox->setUserData(item);
|
||||
mSpellBox->setUserString("ToolTipType", "ItemPtr");
|
||||
mSpellBox->setUserData(item);
|
||||
|
||||
spellImage->setImageTexture("textures\\menu_icon_magic_mini.dds");
|
||||
MyGUI::ImageBox* itemBox = spellImage->createWidgetReal<MyGUI::ImageBox>("ImageBox", MyGUI::FloatCoord(0,0,1,1)
|
||||
mSpellImage->setImageTexture("textures\\menu_icon_magic_mini.dds");
|
||||
MyGUI::ImageBox* itemBox = mSpellImage->createWidgetReal<MyGUI::ImageBox>("ImageBox", MyGUI::FloatCoord(0,0,1,1)
|
||||
, MyGUI::Align::Stretch);
|
||||
|
||||
std::string path = std::string("icons\\");
|
||||
|
@ -452,14 +455,14 @@ void HUD::setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent)
|
|||
mWeaponSpellBox->setVisible(true);
|
||||
}
|
||||
|
||||
weapBox->setUserString("ToolTipType", "ItemPtr");
|
||||
weapBox->setUserData(item);
|
||||
mWeapBox->setUserString("ToolTipType", "ItemPtr");
|
||||
mWeapBox->setUserData(item);
|
||||
|
||||
weapStatus->setProgressRange(100);
|
||||
weapStatus->setProgressPosition(durabilityPercent);
|
||||
mWeapStatus->setProgressRange(100);
|
||||
mWeapStatus->setProgressPosition(durabilityPercent);
|
||||
|
||||
if (weapImage->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(weapImage->getChildAt(0));
|
||||
if (mWeapImage->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(mWeapImage->getChildAt(0));
|
||||
|
||||
std::string path = std::string("icons\\");
|
||||
path+=MWWorld::Class::get(item).getInventoryIcon(item);
|
||||
|
@ -467,14 +470,14 @@ void HUD::setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent)
|
|||
|
||||
if (MWWorld::Class::get(item).getEnchantment(item) != "")
|
||||
{
|
||||
weapImage->setImageTexture("textures\\menu_icon_magic_mini.dds");
|
||||
MyGUI::ImageBox* itemBox = weapImage->createWidgetReal<MyGUI::ImageBox>("ImageBox", MyGUI::FloatCoord(0,0,1,1)
|
||||
mWeapImage->setImageTexture("textures\\menu_icon_magic_mini.dds");
|
||||
MyGUI::ImageBox* itemBox = mWeapImage->createWidgetReal<MyGUI::ImageBox>("ImageBox", MyGUI::FloatCoord(0,0,1,1)
|
||||
, MyGUI::Align::Stretch);
|
||||
itemBox->setImageTexture(path);
|
||||
itemBox->setNeedMouseFocus(false);
|
||||
}
|
||||
else
|
||||
weapImage->setImageTexture(path);
|
||||
mWeapImage->setImageTexture(path);
|
||||
}
|
||||
|
||||
void HUD::unsetSelectedSpell()
|
||||
|
@ -488,12 +491,12 @@ void HUD::unsetSelectedSpell()
|
|||
mWeaponSpellBox->setVisible(true);
|
||||
}
|
||||
|
||||
if (spellImage->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(spellImage->getChildAt(0));
|
||||
spellStatus->setProgressRange(100);
|
||||
spellStatus->setProgressPosition(0);
|
||||
spellImage->setImageTexture("");
|
||||
spellBox->clearUserStrings();
|
||||
if (mSpellImage->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(mSpellImage->getChildAt(0));
|
||||
mSpellStatus->setProgressRange(100);
|
||||
mSpellStatus->setProgressPosition(0);
|
||||
mSpellImage->setImageTexture("");
|
||||
mSpellBox->clearUserStrings();
|
||||
}
|
||||
|
||||
void HUD::unsetSelectedWeapon()
|
||||
|
@ -507,10 +510,10 @@ void HUD::unsetSelectedWeapon()
|
|||
mWeaponSpellBox->setVisible(true);
|
||||
}
|
||||
|
||||
if (weapImage->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(weapImage->getChildAt(0));
|
||||
weapStatus->setProgressRange(100);
|
||||
weapStatus->setProgressPosition(0);
|
||||
weapImage->setImageTexture("icons\\k\\stealth_handtohand.dds");
|
||||
weapBox->clearUserStrings();
|
||||
if (mWeapImage->getChildCount())
|
||||
MyGUI::Gui::getInstance().destroyWidget(mWeapImage->getChildAt(0));
|
||||
mWeapStatus->setProgressRange(100);
|
||||
mWeapStatus->setProgressPosition(0);
|
||||
mWeapImage->setImageTexture("icons\\k\\stealth_handtohand.dds");
|
||||
mWeapBox->clearUserStrings();
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue