mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
Merge branch 'master' into NonTableFields
Conflicts: apps/opencs/model/tools/tools.cpp apps/opencs/model/world/columnbase.cpp apps/opencs/model/world/commands.cpp apps/opencs/model/world/commands.hpp apps/opencs/model/world/idtable.hpp apps/opencs/model/world/refidadapter.cpp apps/opencs/model/world/refidadapter.hpp apps/opencs/view/world/dialoguesubview.hpp
This commit is contained in:
commit
5eefcd862f
359 changed files with 2231 additions and 1682 deletions
|
@ -39,6 +39,7 @@ Programmers
|
||||||
Eli2
|
Eli2
|
||||||
Emanuel Guével (potatoesmaster)
|
Emanuel Guével (potatoesmaster)
|
||||||
eroen
|
eroen
|
||||||
|
escondida
|
||||||
Evgeniy Mineev (sandstranger)
|
Evgeniy Mineev (sandstranger)
|
||||||
Fil Krynicki (filkry)
|
Fil Krynicki (filkry)
|
||||||
Gašper Sedej
|
Gašper Sedej
|
||||||
|
|
39
CHANGELOG.md
39
CHANGELOG.md
|
@ -1,3 +1,42 @@
|
||||||
|
0.35.1
|
||||||
|
------
|
||||||
|
|
||||||
|
Bug #781: incorrect trajectory of the sun
|
||||||
|
Bug #1079: Wrong starting position in "Character Stuff Wonderland"
|
||||||
|
Bug #1443: Repetitive taking of a stolen object is repetitively considered as a crime
|
||||||
|
Bug #1533: Divine Intervention goes to the wrong place.
|
||||||
|
Bug #1714: No visual indicator for time passed during training
|
||||||
|
Bug #1916: Telekinesis does not allow safe opening of traps
|
||||||
|
Bug #2227: Editor: addon file name inconsistency
|
||||||
|
Bug #2271: Player can melee enemies from water with impunity
|
||||||
|
Bug #2275: Objects with bigger scale move further using Move script
|
||||||
|
Bug #2285: Aryon's Dominator enchantment does not work properly
|
||||||
|
Bug #2290: No punishment for stealing gold from owned containers
|
||||||
|
Bug #2328: Launcher does not respond to Ctrl+C
|
||||||
|
Bug #2334: Drag-and-drop on a content file in the launcher creates duplicate items
|
||||||
|
Bug #2338: Arrows reclaimed from corpses do not stack sometimes
|
||||||
|
Bug #2344: Launcher - Settings importer running correctly?
|
||||||
|
Bug #2346: Launcher - Importing plugins into content list screws up the load order
|
||||||
|
Bug #2348: Mod: H.E.L.L.U.V.A. Handy Holdables does not appear in the content list
|
||||||
|
Bug #2353: Detect Animal detects dead creatures
|
||||||
|
Bug #2354: Cmake does not respect LIB_SUFFIX
|
||||||
|
Bug #2356: Active magic set inactive when switching magic items
|
||||||
|
Bug #2361: ERROR: ESM Error: Previous record contains unread bytes
|
||||||
|
Bug #2382: Switching spells with "next spell" or "previous spell" while holding shift promps delete spell dialog
|
||||||
|
Bug #2388: Regression: Can't toggle map on/off
|
||||||
|
Bug #2392: MOD Shrines - Restore Health and Cancel Options adds 100 health points
|
||||||
|
Bug #2394: List of Data Files tab in openmw-laucher needs to show all content files.
|
||||||
|
Bug #2402: Editor: skills saved incorrectly
|
||||||
|
Bug #2408: Equipping a constant effect Restore Health/Magicka/Fatigue item will permanently boost the stat it's restoring
|
||||||
|
Bug #2415: It is now possible to fall off the prison ship into the water when starting a new game
|
||||||
|
Bug #2419: MOD MCA crash to desktop
|
||||||
|
Bug #2420: Game crashes when character enters a certain area
|
||||||
|
Bug #2421: infinite loop when using cycle weapon without having a weapon
|
||||||
|
Feature #2221: Cannot dress dead NPCs
|
||||||
|
Feature #2349: Check CMake sets correct MSVC compiler settings for release build.
|
||||||
|
Feature #2397: Set default values for global mandatory records.
|
||||||
|
Feature #2412: Basic joystick support
|
||||||
|
|
||||||
0.35.0
|
0.35.0
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ message(STATUS "Configuring OpenMW...")
|
||||||
|
|
||||||
set(OPENMW_VERSION_MAJOR 0)
|
set(OPENMW_VERSION_MAJOR 0)
|
||||||
set(OPENMW_VERSION_MINOR 35)
|
set(OPENMW_VERSION_MINOR 35)
|
||||||
set(OPENMW_VERSION_RELEASE 0)
|
set(OPENMW_VERSION_RELEASE 1)
|
||||||
|
|
||||||
set(OPENMW_VERSION_COMMITHASH "")
|
set(OPENMW_VERSION_COMMITHASH "")
|
||||||
set(OPENMW_VERSION_TAGHASH "")
|
set(OPENMW_VERSION_TAGHASH "")
|
||||||
|
@ -97,43 +97,6 @@ endif()
|
||||||
# We probably support older versions than this.
|
# We probably support older versions than this.
|
||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
|
||||||
# source directory: libs
|
|
||||||
|
|
||||||
set(LIBS_DIR ${CMAKE_SOURCE_DIR}/libs)
|
|
||||||
|
|
||||||
set(OENGINE_OGRE
|
|
||||||
${LIBS_DIR}/openengine/ogre/renderer.cpp
|
|
||||||
${LIBS_DIR}/openengine/ogre/lights.cpp
|
|
||||||
${LIBS_DIR}/openengine/ogre/selectionbuffer.cpp
|
|
||||||
${LIBS_DIR}/openengine/ogre/imagerotate.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
set(OENGINE_GUI
|
|
||||||
${LIBS_DIR}/openengine/gui/loglistener.cpp
|
|
||||||
${LIBS_DIR}/openengine/gui/manager.cpp
|
|
||||||
${LIBS_DIR}/openengine/gui/layout.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
set(OENGINE_BULLET
|
|
||||||
${LIBS_DIR}/openengine/bullet/BtOgre.cpp
|
|
||||||
${LIBS_DIR}/openengine/bullet/BtOgreExtras.h
|
|
||||||
${LIBS_DIR}/openengine/bullet/BtOgreGP.h
|
|
||||||
${LIBS_DIR}/openengine/bullet/BtOgrePG.h
|
|
||||||
${LIBS_DIR}/openengine/bullet/physic.cpp
|
|
||||||
${LIBS_DIR}/openengine/bullet/physic.hpp
|
|
||||||
${LIBS_DIR}/openengine/bullet/BulletShapeLoader.cpp
|
|
||||||
${LIBS_DIR}/openengine/bullet/BulletShapeLoader.h
|
|
||||||
${LIBS_DIR}/openengine/bullet/trace.cpp
|
|
||||||
${LIBS_DIR}/openengine/bullet/trace.h
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
set(OENGINE_ALL ${OENGINE_OGRE} ${OENGINE_GUI} ${OENGINE_BULLET})
|
|
||||||
source_group(libs\\openengine FILES ${OENGINE_ALL})
|
|
||||||
|
|
||||||
set(OPENMW_LIBS ${OENGINE_ALL})
|
|
||||||
set(OPENMW_LIBS_HEADER)
|
|
||||||
|
|
||||||
# Sound setup
|
# Sound setup
|
||||||
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE SWRESAMPLE AVRESAMPLE)
|
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE SWRESAMPLE AVRESAMPLE)
|
||||||
unset(FFMPEG_LIBRARIES CACHE)
|
unset(FFMPEG_LIBRARIES CACHE)
|
||||||
|
@ -266,7 +229,8 @@ endif ()
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
endif(OGRE_STATIC)
|
endif(OGRE_STATIC)
|
||||||
|
|
||||||
include_directories("."
|
include_directories("." ${LIBS_DIR}
|
||||||
|
SYSTEM
|
||||||
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre ${OGRE_INCLUDE_DIR}/OGRE ${OGRE_INCLUDE_DIRS} ${OGRE_PLUGIN_INCLUDE_DIRS}
|
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre ${OGRE_INCLUDE_DIR}/OGRE ${OGRE_INCLUDE_DIRS} ${OGRE_PLUGIN_INCLUDE_DIRS}
|
||||||
${OGRE_INCLUDE_DIR}/Overlay ${OGRE_Overlay_INCLUDE_DIR}
|
${OGRE_INCLUDE_DIR}/Overlay ${OGRE_Overlay_INCLUDE_DIR}
|
||||||
${SDL2_INCLUDE_DIR}
|
${SDL2_INCLUDE_DIR}
|
||||||
|
@ -275,7 +239,7 @@ include_directories("."
|
||||||
${MYGUI_INCLUDE_DIRS}
|
${MYGUI_INCLUDE_DIRS}
|
||||||
${MYGUI_PLATFORM_INCLUDE_DIRS}
|
${MYGUI_PLATFORM_INCLUDE_DIRS}
|
||||||
${OPENAL_INCLUDE_DIR}
|
${OPENAL_INCLUDE_DIR}
|
||||||
${LIBS_DIR}
|
${BULLET_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR} ${MYGUI_LIB_DIR})
|
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR} ${MYGUI_LIB_DIR})
|
||||||
|
@ -385,22 +349,22 @@ if (NOT WIN32 AND NOT APPLE)
|
||||||
"${OpenMW_BINARY_DIR}/openmw-cs.desktop")
|
"${OpenMW_BINARY_DIR}/openmw-cs.desktop")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Compiler settings
|
# CXX Compiler settings
|
||||||
if (CMAKE_COMPILER_IS_GNUCC)
|
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||||
set_property(GLOBAL APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-reorder -std=c++98 -pedantic -Wno-long-long")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -Wno-reorder -std=c++98 -pedantic -Wno-long-long")
|
||||||
|
|
||||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
||||||
OUTPUT_VARIABLE GCC_VERSION)
|
OUTPUT_VARIABLE GCC_VERSION)
|
||||||
if ("${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU AND "${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
||||||
set_property(GLOBAL APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-unused-but-set-parameter")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-parameter")
|
||||||
endif("${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU AND "${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
||||||
elseif (MSVC)
|
elseif (MSVC)
|
||||||
# Enable link-time code generation globally for all linking
|
# Enable link-time code generation globally for all linking
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
|
||||||
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG")
|
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG")
|
||||||
endif (CMAKE_COMPILER_IS_GNUCC)
|
endif (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||||
|
|
||||||
IF(NOT WIN32 AND NOT APPLE)
|
IF(NOT WIN32 AND NOT APPLE)
|
||||||
# Linux building
|
# Linux building
|
||||||
|
@ -572,6 +536,10 @@ if(WIN32)
|
||||||
include(CPack)
|
include(CPack)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
|
# Libs
|
||||||
|
include_directories(libs)
|
||||||
|
add_subdirectory(libs/openengine)
|
||||||
|
|
||||||
# Extern
|
# Extern
|
||||||
add_subdirectory (extern/shiny)
|
add_subdirectory (extern/shiny)
|
||||||
add_subdirectory (extern/ogre-ffmpeg-videoplayer)
|
add_subdirectory (extern/ogre-ffmpeg-videoplayer)
|
||||||
|
@ -705,7 +673,7 @@ if (WIN32)
|
||||||
set(WARNINGS "${WARNINGS} /wd${d}")
|
set(WARNINGS "${WARNINGS} /wd${d}")
|
||||||
endforeach(d)
|
endforeach(d)
|
||||||
|
|
||||||
set_property(GLOBAL APPEND_STRING PROPERTY COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS} ${MT_BUILD}")
|
||||||
|
|
||||||
# boost::wave has a few issues with signed / unsigned conversions, so we suppress those here
|
# boost::wave has a few issues with signed / unsigned conversions, so we suppress those here
|
||||||
set(SHINY_WARNINGS "${WARNINGS} /wd4245")
|
set(SHINY_WARNINGS "${WARNINGS} /wd4245")
|
||||||
|
|
|
@ -6,7 +6,7 @@ OpenMW
|
||||||
OpenMW is an attempt at recreating the engine for the popular role-playing game
|
OpenMW is an attempt at recreating the engine for the popular role-playing game
|
||||||
Morrowind by Bethesda Softworks. You need to own and install the original game for OpenMW to work.
|
Morrowind by Bethesda Softworks. You need to own and install the original game for OpenMW to work.
|
||||||
|
|
||||||
* Version: 0.35.0
|
* Version: 0.35.1
|
||||||
* License: GPL (see docs/license/GPL3.txt for more information)
|
* License: GPL (see docs/license/GPL3.txt for more information)
|
||||||
* Website: http://www.openmw.org
|
* Website: http://www.openmw.org
|
||||||
* IRC: #openmw on irc.freenode.net
|
* IRC: #openmw on irc.freenode.net
|
||||||
|
@ -23,7 +23,7 @@ Getting Started
|
||||||
* [Testing the game](https://wiki.openmw.org/index.php?title=Testing)
|
* [Testing the game](https://wiki.openmw.org/index.php?title=Testing)
|
||||||
* [How to contribute](https://wiki.openmw.org/index.php?title=Contribution_Wanted)
|
* [How to contribute](https://wiki.openmw.org/index.php?title=Contribution_Wanted)
|
||||||
* [Report a bug](http://bugs.openmw.org/projects/openmw) - read the [guidelines](https://wiki.openmw.org/index.php?title=Bug_Reporting_Guidelines) before submitting your first bug!
|
* [Report a bug](http://bugs.openmw.org/projects/openmw) - read the [guidelines](https://wiki.openmw.org/index.php?title=Bug_Reporting_Guidelines) before submitting your first bug!
|
||||||
* [Known issues] (http://bugs.openmw.org/projects/openmw/issues?utf8=%E2%9C%93&set_filter=1&f%5B%5D=status_id&op%5Bstatus_id%5D=%3D&v%5Bstatus_id%5D%5B%5D=7&f%5B%5D=tracker_id&op%5Btracker_id%5D=%3D&v%5Btracker_id%5D%5B%5D=1&f%5B%5D=&c%5B%5D=project&c%5B%5D=tracker&c%5B%5D=status&c%5B%5D=priority&c%5B%5D=subject&c%5B%5D=assigned_to&c%5B%5D=updated_on&group_by=tracker)
|
* [Known issues](http://bugs.openmw.org/projects/openmw/issues?utf8=%E2%9C%93&set_filter=1&f%5B%5D=status_id&op%5Bstatus_id%5D=%3D&v%5Bstatus_id%5D%5B%5D=7&f%5B%5D=tracker_id&op%5Btracker_id%5D=%3D&v%5Btracker_id%5D%5B%5D=1&f%5B%5D=&c%5B%5D=project&c%5B%5D=tracker&c%5B%5D=status&c%5B%5D=priority&c%5B%5D=subject&c%5B%5D=assigned_to&c%5B%5D=updated_on&group_by=tracker)
|
||||||
|
|
||||||
The data path
|
The data path
|
||||||
-------------
|
-------------
|
||||||
|
|
|
@ -460,7 +460,7 @@ int clone(Arguments& info)
|
||||||
for (Stats::iterator it = stats.begin(); it != stats.end(); ++it)
|
for (Stats::iterator it = stats.begin(); it != stats.end(); ++it)
|
||||||
{
|
{
|
||||||
name.val = it->first;
|
name.val = it->first;
|
||||||
float amount = it->second;
|
int amount = it->second;
|
||||||
std::cout << std::setw(digitCount) << amount << " " << name.toString() << " ";
|
std::cout << std::setw(digitCount) << amount << " " << name.toString() << " ";
|
||||||
|
|
||||||
if (++i % 3 == 0)
|
if (++i % 3 == 0)
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
void printAIPackage(ESM::AIPackage p)
|
void printAIPackage(ESM::AIPackage p)
|
||||||
{
|
{
|
||||||
std::cout << " AI Type: " << aiTypeLabel(p.mType)
|
std::cout << " AI Type: " << aiTypeLabel(p.mType)
|
||||||
|
@ -16,7 +19,7 @@ void printAIPackage(ESM::AIPackage p)
|
||||||
std::cout << " Duration: " << p.mWander.mDuration << std::endl;
|
std::cout << " Duration: " << p.mWander.mDuration << std::endl;
|
||||||
std::cout << " Time of Day: " << (int)p.mWander.mTimeOfDay << std::endl;
|
std::cout << " Time of Day: " << (int)p.mWander.mTimeOfDay << std::endl;
|
||||||
if (p.mWander.mShouldRepeat != 1)
|
if (p.mWander.mShouldRepeat != 1)
|
||||||
std::cout << " Should repeat: " << (bool)p.mWander.mShouldRepeat << std::endl;
|
std::cout << " Should repeat: " << (bool)(p.mWander.mShouldRepeat != 0) << std::endl;
|
||||||
|
|
||||||
std::cout << " Idle: ";
|
std::cout << " Idle: ";
|
||||||
for (int i = 0; i != 8; i++)
|
for (int i = 0; i != 8; i++)
|
||||||
|
@ -149,6 +152,26 @@ void printEffectList(ESM::EffectList effects)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printTransport(const std::vector<ESM::Transport::Dest>& transport)
|
||||||
|
{
|
||||||
|
std::vector<ESM::Transport::Dest>::const_iterator dit;
|
||||||
|
for (dit = transport.begin(); dit != transport.end(); ++dit)
|
||||||
|
{
|
||||||
|
std::cout << " Destination Position: "
|
||||||
|
<< boost::format("%12.3f") % dit->mPos.pos[0] << ","
|
||||||
|
<< boost::format("%12.3f") % dit->mPos.pos[1] << ","
|
||||||
|
<< boost::format("%12.3f") % dit->mPos.pos[2] << ")" << std::endl;
|
||||||
|
std::cout << " Destination Rotation: "
|
||||||
|
<< boost::format("%9.6f") % dit->mPos.rot[0] << ","
|
||||||
|
<< boost::format("%9.6f") % dit->mPos.rot[1] << ","
|
||||||
|
<< boost::format("%9.6f") % dit->mPos.rot[2] << ")" << std::endl;
|
||||||
|
if (dit->mCellName != "")
|
||||||
|
std::cout << " Destination Cell: " << dit->mCellName << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
namespace EsmTool {
|
namespace EsmTool {
|
||||||
|
|
||||||
RecordBase *
|
RecordBase *
|
||||||
|
@ -631,6 +654,8 @@ void Record<ESM::Creature>::print()
|
||||||
for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit)
|
for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit)
|
||||||
std::cout << " Spell: " << *sit << std::endl;
|
std::cout << " Spell: " << *sit << std::endl;
|
||||||
|
|
||||||
|
printTransport(mData.getTransport());
|
||||||
|
|
||||||
std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl;
|
std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl;
|
||||||
std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl;
|
std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl;
|
||||||
std::cout << " AI Fight:" << (int)mData.mAiData.mFight << std::endl;
|
std::cout << " AI Fight:" << (int)mData.mAiData.mFight << std::endl;
|
||||||
|
@ -1042,20 +1067,7 @@ void Record<ESM::NPC>::print()
|
||||||
for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit)
|
for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit)
|
||||||
std::cout << " Spell: " << *sit << std::endl;
|
std::cout << " Spell: " << *sit << std::endl;
|
||||||
|
|
||||||
std::vector<ESM::NPC::Dest>::iterator dit;
|
printTransport(mData.getTransport());
|
||||||
for (dit = mData.mTransport.begin(); dit != mData.mTransport.end(); ++dit)
|
|
||||||
{
|
|
||||||
std::cout << " Destination Position: "
|
|
||||||
<< boost::format("%12.3f") % dit->mPos.pos[0] << ","
|
|
||||||
<< boost::format("%12.3f") % dit->mPos.pos[1] << ","
|
|
||||||
<< boost::format("%12.3f") % dit->mPos.pos[2] << ")" << std::endl;
|
|
||||||
std::cout << " Destination Rotation: "
|
|
||||||
<< boost::format("%9.6f") % dit->mPos.rot[0] << ","
|
|
||||||
<< boost::format("%9.6f") % dit->mPos.rot[1] << ","
|
|
||||||
<< boost::format("%9.6f") % dit->mPos.rot[2] << ")" << std::endl;
|
|
||||||
if (dit->mCellName != "")
|
|
||||||
std::cout << " Destination Cell: " << dit->mCellName << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl;
|
std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl;
|
||||||
std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl;
|
std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl;
|
||||||
|
|
|
@ -23,18 +23,18 @@ namespace ESSImport
|
||||||
}
|
}
|
||||||
for (int i=0; i<8; ++i)
|
for (int i=0; i<8; ++i)
|
||||||
{
|
{
|
||||||
cStats.mAttributes[i].mBase = acdt.mAttributes[i][1];
|
cStats.mAttributes[i].mBase = static_cast<int>(acdt.mAttributes[i][1]);
|
||||||
cStats.mAttributes[i].mMod = acdt.mAttributes[i][0];
|
cStats.mAttributes[i].mMod = static_cast<int>(acdt.mAttributes[i][0]);
|
||||||
cStats.mAttributes[i].mCurrent = acdt.mAttributes[i][0];
|
cStats.mAttributes[i].mCurrent = static_cast<int>(acdt.mAttributes[i][0]);
|
||||||
}
|
}
|
||||||
cStats.mGoldPool = acdt.mGoldPool;
|
cStats.mGoldPool = acdt.mGoldPool;
|
||||||
cStats.mTalkedTo = acdt.mFlags & TalkedToPlayer;
|
cStats.mTalkedTo = (acdt.mFlags & TalkedToPlayer) != 0;
|
||||||
cStats.mAttacked = acdt.mFlags & Attacked;
|
cStats.mAttacked = (acdt.mFlags & Attacked) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertACSC (const ACSC& acsc, ESM::CreatureStats& cStats)
|
void convertACSC (const ACSC& acsc, ESM::CreatureStats& cStats)
|
||||||
{
|
{
|
||||||
cStats.mDead = acsc.mFlags & Dead;
|
cStats.mDead = (acsc.mFlags & Dead) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertNpcData (const ActorData& actorData, ESM::NpcStats& npcStats)
|
void convertNpcData (const ActorData& actorData, ESM::NpcStats& npcStats)
|
||||||
|
|
|
@ -553,7 +553,7 @@ public:
|
||||||
ESM::WeatherState weather;
|
ESM::WeatherState weather;
|
||||||
weather.mCurrentWeather = toString(mGame.mGMDT.mCurrentWeather);
|
weather.mCurrentWeather = toString(mGame.mGMDT.mCurrentWeather);
|
||||||
weather.mNextWeather = toString(mGame.mGMDT.mNextWeather);
|
weather.mNextWeather = toString(mGame.mGMDT.mNextWeather);
|
||||||
weather.mRemainingTransitionTime = mGame.mGMDT.mWeatherTransition/100.f*(0.015*24*3600);
|
weather.mRemainingTransitionTime = mGame.mGMDT.mWeatherTransition/100.f*(0.015f*24*3600);
|
||||||
weather.mHour = mContext->mHour;
|
weather.mHour = mContext->mHour;
|
||||||
weather.mWindSpeed = 0.f;
|
weather.mWindSpeed = 0.f;
|
||||||
weather.mTimePassed = 0.0;
|
weather.mTimePassed = 0.0;
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace ESSImport
|
||||||
{
|
{
|
||||||
unsigned int deleted;
|
unsigned int deleted;
|
||||||
esm.getHT(deleted);
|
esm.getHT(deleted);
|
||||||
mDeleted = (deleted >> 24) & 0x2; // the other 3 bytes seem to be uninitialized garbage
|
mDeleted = ((deleted >> 24) & 0x2) != 0; // the other 3 bytes seem to be uninitialized garbage
|
||||||
}
|
}
|
||||||
|
|
||||||
if (esm.isNextSub("MVRF"))
|
if (esm.isNextSub("MVRF"))
|
||||||
|
|
|
@ -110,7 +110,7 @@ int wmain(int argc, wchar_t *wargv[]) {
|
||||||
std::cerr << "cfg file does not exist" << std::endl;
|
std::cerr << "cfg file does not exist" << std::endl;
|
||||||
|
|
||||||
MwIniImporter importer;
|
MwIniImporter importer;
|
||||||
importer.setVerbose(vm.count("verbose"));
|
importer.setVerbose(vm.count("verbose") != 0);
|
||||||
|
|
||||||
// Font encoding settings
|
// Font encoding settings
|
||||||
std::string encoding(vm["encoding"].as<std::string>());
|
std::string encoding(vm["encoding"].as<std::string>());
|
||||||
|
|
|
@ -5,7 +5,7 @@ set (OPENCS_SRC main.cpp
|
||||||
opencs_units (. editor)
|
opencs_units (. editor)
|
||||||
|
|
||||||
opencs_units (model/doc
|
opencs_units (model/doc
|
||||||
document operation saving documentmanager loader runner
|
document operation saving documentmanager loader runner operationholder
|
||||||
)
|
)
|
||||||
|
|
||||||
opencs_units_noqt (model/doc
|
opencs_units_noqt (model/doc
|
||||||
|
@ -166,7 +166,8 @@ qt4_wrap_ui(OPENCS_UI_HDR ${OPENCS_UI})
|
||||||
qt4_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR_QT})
|
qt4_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR_QT})
|
||||||
qt4_add_resources(OPENCS_RES_SRC ${OPENCS_RES})
|
qt4_add_resources(OPENCS_RES_SRC ${OPENCS_RES})
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${BULLET_INCLUDE_DIRS})
|
# for compiled .ui files
|
||||||
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set (OPENCS_MAC_ICON ${CMAKE_SOURCE_DIR}/files/mac/openmw-cs.icns)
|
set (OPENCS_MAC_ICON ${CMAKE_SOURCE_DIR}/files/mac/openmw-cs.icns)
|
||||||
|
@ -176,7 +177,6 @@ endif(APPLE)
|
||||||
|
|
||||||
add_executable(openmw-cs
|
add_executable(openmw-cs
|
||||||
MACOSX_BUNDLE
|
MACOSX_BUNDLE
|
||||||
${OENGINE_BULLET}
|
|
||||||
${OPENCS_SRC}
|
${OPENCS_SRC}
|
||||||
${OPENCS_UI_HDR}
|
${OPENCS_UI_HDR}
|
||||||
${OPENCS_MOC_SRC}
|
${OPENCS_MOC_SRC}
|
||||||
|
@ -200,6 +200,7 @@ if(APPLE)
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
target_link_libraries(openmw-cs
|
target_link_libraries(openmw-cs
|
||||||
|
${OENGINE_LIBRARY}
|
||||||
${OGRE_LIBRARIES}
|
${OGRE_LIBRARIES}
|
||||||
${OGRE_Overlay_LIBRARIES}
|
${OGRE_Overlay_LIBRARIES}
|
||||||
${OGRE_STATIC_PLUGINS}
|
${OGRE_STATIC_PLUGINS}
|
||||||
|
|
|
@ -2254,7 +2254,8 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
||||||
mTools (*this), mResDir(resDir),
|
mTools (*this), mResDir(resDir),
|
||||||
mProjectPath ((configuration.getUserDataPath() / "projects") /
|
mProjectPath ((configuration.getUserDataPath() / "projects") /
|
||||||
(savePath.filename().string() + ".project")),
|
(savePath.filename().string() + ".project")),
|
||||||
mSaving (*this, mProjectPath, encoding),
|
mSavingOperation (*this, mProjectPath, encoding),
|
||||||
|
mSaving (&mSavingOperation),
|
||||||
mRunner (mProjectPath), mPhysics(boost::shared_ptr<CSVWorld::PhysicsSystem>())
|
mRunner (mProjectPath), mPhysics(boost::shared_ptr<CSVWorld::PhysicsSystem>())
|
||||||
{
|
{
|
||||||
if (mContentFiles.empty())
|
if (mContentFiles.empty())
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "saving.hpp"
|
#include "saving.hpp"
|
||||||
#include "blacklist.hpp"
|
#include "blacklist.hpp"
|
||||||
#include "runner.hpp"
|
#include "runner.hpp"
|
||||||
|
#include "operationholder.hpp"
|
||||||
|
|
||||||
class QAbstractItemModel;
|
class QAbstractItemModel;
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ namespace ESM
|
||||||
|
|
||||||
namespace Files
|
namespace Files
|
||||||
{
|
{
|
||||||
class ConfigurationManager;
|
struct ConfigurationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
|
@ -59,7 +60,8 @@ namespace CSMDoc
|
||||||
CSMWorld::Data mData;
|
CSMWorld::Data mData;
|
||||||
CSMTools::Tools mTools;
|
CSMTools::Tools mTools;
|
||||||
boost::filesystem::path mProjectPath;
|
boost::filesystem::path mProjectPath;
|
||||||
Saving mSaving;
|
Saving mSavingOperation;
|
||||||
|
OperationHolder mSaving;
|
||||||
boost::filesystem::path mResDir;
|
boost::filesystem::path mResDir;
|
||||||
Blacklist mBlacklist;
|
Blacklist mBlacklist;
|
||||||
Runner mRunner;
|
Runner mRunner;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
namespace Files
|
namespace Files
|
||||||
{
|
{
|
||||||
class ConfigurationManager;
|
struct ConfigurationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CSMDoc
|
namespace CSMDoc
|
||||||
|
@ -50,7 +50,7 @@ namespace CSMDoc
|
||||||
///< \param new_ Do not load the last content file in \a files and instead create in an
|
///< \param new_ Do not load the last content file in \a files and instead create in an
|
||||||
/// appropriate way.
|
/// appropriate way.
|
||||||
|
|
||||||
void setResourceDir (const boost::filesystem::path& parResDir);
|
void setResourceDir (const boost::filesystem::path& parResDir);
|
||||||
|
|
||||||
void setEncoding (ToUTF8::FromType encoding);
|
void setEncoding (ToUTF8::FromType encoding);
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ namespace CSMDoc
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
boost::filesystem::path mResDir;
|
boost::filesystem::path mResDir;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@ void CSMDoc::Operation::prepareStages()
|
||||||
CSMDoc::Operation::Operation (int type, bool ordered, bool finalAlways)
|
CSMDoc::Operation::Operation (int type, bool ordered, bool finalAlways)
|
||||||
: mType (type), mStages(std::vector<std::pair<Stage *, int> >()), mCurrentStage(mStages.begin()),
|
: mType (type), mStages(std::vector<std::pair<Stage *, int> >()), mCurrentStage(mStages.begin()),
|
||||||
mCurrentStep(0), mCurrentStepTotal(0), mTotalSteps(0), mOrdered (ordered),
|
mCurrentStep(0), mCurrentStepTotal(0), mTotalSteps(0), mOrdered (ordered),
|
||||||
mFinalAlways (finalAlways), mError(false)
|
mFinalAlways (finalAlways), mError(false), mConnected (false)
|
||||||
{
|
{
|
||||||
connect (this, SIGNAL (finished()), this, SLOT (operationDone()));
|
mTimer = new QTimer (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMDoc::Operation::~Operation()
|
CSMDoc::Operation::~Operation()
|
||||||
|
@ -42,15 +42,17 @@ CSMDoc::Operation::~Operation()
|
||||||
|
|
||||||
void CSMDoc::Operation::run()
|
void CSMDoc::Operation::run()
|
||||||
{
|
{
|
||||||
|
mTimer->stop();
|
||||||
|
|
||||||
|
if (!mConnected)
|
||||||
|
{
|
||||||
|
connect (mTimer, SIGNAL (timeout()), this, SLOT (executeStage()));
|
||||||
|
mConnected = true;
|
||||||
|
}
|
||||||
|
|
||||||
prepareStages();
|
prepareStages();
|
||||||
|
|
||||||
QTimer timer;
|
mTimer->start (0);
|
||||||
|
|
||||||
timer.connect (&timer, SIGNAL (timeout()), this, SLOT (executeStage()));
|
|
||||||
|
|
||||||
timer.start (0);
|
|
||||||
|
|
||||||
exec();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMDoc::Operation::appendStage (Stage *stage)
|
void CSMDoc::Operation::appendStage (Stage *stage)
|
||||||
|
@ -65,7 +67,7 @@ bool CSMDoc::Operation::hasError() const
|
||||||
|
|
||||||
void CSMDoc::Operation::abort()
|
void CSMDoc::Operation::abort()
|
||||||
{
|
{
|
||||||
if (!isRunning())
|
if (!mTimer->isActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mError = true;
|
mError = true;
|
||||||
|
@ -116,10 +118,11 @@ void CSMDoc::Operation::executeStage()
|
||||||
emit reportMessage (iter->mId, iter->mMessage, iter->mHint, mType);
|
emit reportMessage (iter->mId, iter->mMessage, iter->mHint, mType);
|
||||||
|
|
||||||
if (mCurrentStage==mStages.end())
|
if (mCurrentStage==mStages.end())
|
||||||
exit();
|
operationDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMDoc::Operation::operationDone()
|
void CSMDoc::Operation::operationDone()
|
||||||
{
|
{
|
||||||
|
mTimer->stop();
|
||||||
emit done (mType, mError);
|
emit done (mType, mError);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <QThread>
|
#include <QObject>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
|
@ -14,7 +15,7 @@ namespace CSMDoc
|
||||||
{
|
{
|
||||||
class Stage;
|
class Stage;
|
||||||
|
|
||||||
class Operation : public QThread
|
class Operation : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -27,6 +28,8 @@ namespace CSMDoc
|
||||||
int mOrdered;
|
int mOrdered;
|
||||||
bool mFinalAlways;
|
bool mFinalAlways;
|
||||||
bool mError;
|
bool mError;
|
||||||
|
bool mConnected;
|
||||||
|
QTimer *mTimer;
|
||||||
|
|
||||||
void prepareStages();
|
void prepareStages();
|
||||||
|
|
||||||
|
@ -38,8 +41,6 @@ namespace CSMDoc
|
||||||
|
|
||||||
virtual ~Operation();
|
virtual ~Operation();
|
||||||
|
|
||||||
virtual void run();
|
|
||||||
|
|
||||||
void appendStage (Stage *stage);
|
void appendStage (Stage *stage);
|
||||||
///< The ownership of \a stage is transferred to *this.
|
///< The ownership of \a stage is transferred to *this.
|
||||||
///
|
///
|
||||||
|
@ -60,6 +61,8 @@ namespace CSMDoc
|
||||||
|
|
||||||
void abort();
|
void abort();
|
||||||
|
|
||||||
|
void run();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void executeStage();
|
void executeStage();
|
||||||
|
|
65
apps/opencs/model/doc/operationholder.cpp
Normal file
65
apps/opencs/model/doc/operationholder.cpp
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
|
||||||
|
#include "operationholder.hpp"
|
||||||
|
|
||||||
|
#include "operation.hpp"
|
||||||
|
|
||||||
|
CSMDoc::OperationHolder::OperationHolder (Operation *operation) : mRunning (false)
|
||||||
|
{
|
||||||
|
if (operation)
|
||||||
|
setOperation (operation);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::OperationHolder::setOperation (Operation *operation)
|
||||||
|
{
|
||||||
|
mOperation = operation;
|
||||||
|
mOperation->moveToThread (&mThread);
|
||||||
|
|
||||||
|
connect (
|
||||||
|
mOperation, SIGNAL (progress (int, int, int)),
|
||||||
|
this, SIGNAL (progress (int, int, int)));
|
||||||
|
|
||||||
|
connect (
|
||||||
|
mOperation, SIGNAL (reportMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)),
|
||||||
|
this, SIGNAL (reportMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)));
|
||||||
|
|
||||||
|
connect (
|
||||||
|
mOperation, SIGNAL (done (int, bool)),
|
||||||
|
this, SLOT (doneSlot (int, bool)));
|
||||||
|
|
||||||
|
connect (this, SIGNAL (abortSignal()), mOperation, SLOT (abort()));
|
||||||
|
|
||||||
|
connect (&mThread, SIGNAL (started()), mOperation, SLOT (run()));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CSMDoc::OperationHolder::isRunning() const
|
||||||
|
{
|
||||||
|
return mRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::OperationHolder::start()
|
||||||
|
{
|
||||||
|
mRunning = true;
|
||||||
|
mThread.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::OperationHolder::abort()
|
||||||
|
{
|
||||||
|
mRunning = false;
|
||||||
|
emit abortSignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::OperationHolder::abortAndWait()
|
||||||
|
{
|
||||||
|
if (mRunning)
|
||||||
|
{
|
||||||
|
mThread.quit();
|
||||||
|
mThread.wait();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::OperationHolder::doneSlot (int type, bool failed)
|
||||||
|
{
|
||||||
|
mRunning = false;
|
||||||
|
mThread.quit();
|
||||||
|
emit done (type, failed);
|
||||||
|
}
|
56
apps/opencs/model/doc/operationholder.hpp
Normal file
56
apps/opencs/model/doc/operationholder.hpp
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#ifndef CSM_DOC_OPERATIONHOLDER_H
|
||||||
|
#define CSM_DOC_OPERATIONHOLDER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
|
namespace CSMWorld
|
||||||
|
{
|
||||||
|
class UniversalId;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace CSMDoc
|
||||||
|
{
|
||||||
|
class Operation;
|
||||||
|
|
||||||
|
class OperationHolder : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
QThread mThread;
|
||||||
|
Operation *mOperation;
|
||||||
|
bool mRunning;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
OperationHolder (Operation *operation = 0);
|
||||||
|
|
||||||
|
void setOperation (Operation *operation);
|
||||||
|
|
||||||
|
bool isRunning() const;
|
||||||
|
|
||||||
|
void start();
|
||||||
|
|
||||||
|
void abort();
|
||||||
|
|
||||||
|
// Abort and wait until thread has finished.
|
||||||
|
void abortAndWait();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void doneSlot (int type, bool failed);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void progress (int current, int max, int type);
|
||||||
|
|
||||||
|
void reportMessage (const CSMWorld::UniversalId& id, const std::string& message,
|
||||||
|
const std::string& hint, int type);
|
||||||
|
|
||||||
|
void done (int type, bool failed);
|
||||||
|
|
||||||
|
void abortSignal();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -6,7 +6,7 @@
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
#include "operation.hpp"
|
#include "operationholder.hpp"
|
||||||
|
|
||||||
CSMDoc::Runner::Runner (const boost::filesystem::path& projectPath)
|
CSMDoc::Runner::Runner (const boost::filesystem::path& projectPath)
|
||||||
: mRunning (false), mStartup (0), mProjectPath (projectPath)
|
: mRunning (false), mStartup (0), mProjectPath (projectPath)
|
||||||
|
@ -145,7 +145,7 @@ void CSMDoc::Runner::readyReadStandardOutput()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CSMDoc::SaveWatcher::SaveWatcher (Runner *runner, Operation *operation)
|
CSMDoc::SaveWatcher::SaveWatcher (Runner *runner, OperationHolder *operation)
|
||||||
: QObject (runner), mRunner (runner)
|
: QObject (runner), mRunner (runner)
|
||||||
{
|
{
|
||||||
connect (operation, SIGNAL (done (int, bool)), this, SLOT (saveDone (int, bool)));
|
connect (operation, SIGNAL (done (int, bool)), this, SLOT (saveDone (int, bool)));
|
||||||
|
|
|
@ -16,6 +16,8 @@ class QTemporaryFile;
|
||||||
|
|
||||||
namespace CSMDoc
|
namespace CSMDoc
|
||||||
{
|
{
|
||||||
|
class OperationHolder;
|
||||||
|
|
||||||
class Runner : public QObject
|
class Runner : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -74,7 +76,7 @@ namespace CSMDoc
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// *this attaches itself to runner
|
/// *this attaches itself to runner
|
||||||
SaveWatcher (Runner *runner, Operation *operation);
|
SaveWatcher (Runner *runner, OperationHolder *operation);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,10 @@ CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& proje
|
||||||
|
|
||||||
appendStage (new WritePathgridCollectionStage (mDocument, mState));
|
appendStage (new WritePathgridCollectionStage (mDocument, mState));
|
||||||
|
|
||||||
|
appendStage (new WriteLandCollectionStage (mDocument, mState));
|
||||||
|
|
||||||
|
appendStage (new WriteLandTextureCollectionStage (mDocument, mState));
|
||||||
|
|
||||||
// close file and clean up
|
// close file and clean up
|
||||||
appendStage (new CloseSaveStage (mState));
|
appendStage (new CloseSaveStage (mState));
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ void CSMDoc::WriteHeaderStage::perform (int stage, Messages& messages)
|
||||||
|
|
||||||
CSMDoc::WriteDialogueCollectionStage::WriteDialogueCollectionStage (Document& document,
|
CSMDoc::WriteDialogueCollectionStage::WriteDialogueCollectionStage (Document& document,
|
||||||
SavingState& state, bool journal)
|
SavingState& state, bool journal)
|
||||||
: mDocument (document), mState (state),
|
: mState (state),
|
||||||
mTopics (journal ? document.getData().getJournals() : document.getData().getTopics()),
|
mTopics (journal ? document.getData().getJournals() : document.getData().getTopics()),
|
||||||
mInfos (journal ? document.getData().getJournalInfos() : document.getData().getTopicInfos())
|
mInfos (journal ? document.getData().getJournalInfos() : document.getData().getTopicInfos())
|
||||||
{}
|
{}
|
||||||
|
@ -353,6 +353,74 @@ void CSMDoc::WritePathgridCollectionStage::perform (int stage, Messages& message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CSMDoc::WriteLandCollectionStage::WriteLandCollectionStage (Document& document,
|
||||||
|
SavingState& state)
|
||||||
|
: mDocument (document), mState (state)
|
||||||
|
{}
|
||||||
|
|
||||||
|
int CSMDoc::WriteLandCollectionStage::setup()
|
||||||
|
{
|
||||||
|
return mDocument.getData().getLand().getSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::WriteLandCollectionStage::perform (int stage, Messages& messages)
|
||||||
|
{
|
||||||
|
const CSMWorld::Record<CSMWorld::Land>& land =
|
||||||
|
mDocument.getData().getLand().getRecord (stage);
|
||||||
|
|
||||||
|
if (land.mState==CSMWorld::RecordBase::State_Modified ||
|
||||||
|
land.mState==CSMWorld::RecordBase::State_ModifiedOnly)
|
||||||
|
{
|
||||||
|
CSMWorld::Land record = land.get();
|
||||||
|
|
||||||
|
mState.getWriter().startRecord (record.mLand->sRecordId);
|
||||||
|
|
||||||
|
record.mLand->save (mState.getWriter());
|
||||||
|
if(record.mLand->mLandData)
|
||||||
|
record.mLand->mLandData->save (mState.getWriter());
|
||||||
|
|
||||||
|
mState.getWriter().endRecord (record.mLand->sRecordId);
|
||||||
|
}
|
||||||
|
else if (land.mState==CSMWorld::RecordBase::State_Deleted)
|
||||||
|
{
|
||||||
|
/// \todo write record with delete flag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CSMDoc::WriteLandTextureCollectionStage::WriteLandTextureCollectionStage (Document& document,
|
||||||
|
SavingState& state)
|
||||||
|
: mDocument (document), mState (state)
|
||||||
|
{}
|
||||||
|
|
||||||
|
int CSMDoc::WriteLandTextureCollectionStage::setup()
|
||||||
|
{
|
||||||
|
return mDocument.getData().getLandTextures().getSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSMDoc::WriteLandTextureCollectionStage::perform (int stage, Messages& messages)
|
||||||
|
{
|
||||||
|
const CSMWorld::Record<CSMWorld::LandTexture>& landTexture =
|
||||||
|
mDocument.getData().getLandTextures().getRecord (stage);
|
||||||
|
|
||||||
|
if (landTexture.mState==CSMWorld::RecordBase::State_Modified ||
|
||||||
|
landTexture.mState==CSMWorld::RecordBase::State_ModifiedOnly)
|
||||||
|
{
|
||||||
|
CSMWorld::LandTexture record = landTexture.get();
|
||||||
|
|
||||||
|
mState.getWriter().startRecord (record.sRecordId);
|
||||||
|
|
||||||
|
record.save (mState.getWriter());
|
||||||
|
|
||||||
|
mState.getWriter().endRecord (record.sRecordId);
|
||||||
|
}
|
||||||
|
else if (landTexture.mState==CSMWorld::RecordBase::State_Deleted)
|
||||||
|
{
|
||||||
|
/// \todo write record with delete flag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CSMDoc::CloseSaveStage::CloseSaveStage (SavingState& state)
|
CSMDoc::CloseSaveStage::CloseSaveStage (SavingState& state)
|
||||||
: mState (state)
|
: mState (state)
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -126,7 +126,6 @@ namespace CSMDoc
|
||||||
|
|
||||||
class WriteDialogueCollectionStage : public Stage
|
class WriteDialogueCollectionStage : public Stage
|
||||||
{
|
{
|
||||||
Document& mDocument;
|
|
||||||
SavingState& mState;
|
SavingState& mState;
|
||||||
const CSMWorld::IdCollection<ESM::Dialogue>& mTopics;
|
const CSMWorld::IdCollection<ESM::Dialogue>& mTopics;
|
||||||
CSMWorld::InfoCollection& mInfos;
|
CSMWorld::InfoCollection& mInfos;
|
||||||
|
@ -209,6 +208,40 @@ namespace CSMDoc
|
||||||
///< Messages resulting from this stage will be appended to \a messages.
|
///< Messages resulting from this stage will be appended to \a messages.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class WriteLandCollectionStage : public Stage
|
||||||
|
{
|
||||||
|
Document& mDocument;
|
||||||
|
SavingState& mState;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
WriteLandCollectionStage (Document& document, SavingState& state);
|
||||||
|
|
||||||
|
virtual int setup();
|
||||||
|
///< \return number of steps
|
||||||
|
|
||||||
|
virtual void perform (int stage, Messages& messages);
|
||||||
|
///< Messages resulting from this stage will be appended to \a messages.
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class WriteLandTextureCollectionStage : public Stage
|
||||||
|
{
|
||||||
|
Document& mDocument;
|
||||||
|
SavingState& mState;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
WriteLandTextureCollectionStage (Document& document, SavingState& state);
|
||||||
|
|
||||||
|
virtual int setup();
|
||||||
|
///< \return number of steps
|
||||||
|
|
||||||
|
virtual void perform (int stage, Messages& messages);
|
||||||
|
///< Messages resulting from this stage will be appended to \a messages.
|
||||||
|
};
|
||||||
|
|
||||||
class CloseSaveStage : public Stage
|
class CloseSaveStage : public Stage
|
||||||
{
|
{
|
||||||
SavingState& mState;
|
SavingState& mState;
|
||||||
|
|
|
@ -26,30 +26,30 @@
|
||||||
#include "referencecheck.hpp"
|
#include "referencecheck.hpp"
|
||||||
#include "startscriptcheck.hpp"
|
#include "startscriptcheck.hpp"
|
||||||
|
|
||||||
CSMDoc::Operation *CSMTools::Tools::get (int type)
|
CSMDoc::OperationHolder *CSMTools::Tools::get (int type)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case CSMDoc::State_Verifying: return mVerifier;
|
case CSMDoc::State_Verifying: return &mVerifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CSMDoc::Operation *CSMTools::Tools::get (int type) const
|
const CSMDoc::OperationHolder *CSMTools::Tools::get (int type) const
|
||||||
{
|
{
|
||||||
return const_cast<Tools *> (this)->get (type);
|
return const_cast<Tools *> (this)->get (type);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMDoc::Operation *CSMTools::Tools::getVerifier()
|
CSMDoc::OperationHolder *CSMTools::Tools::getVerifier()
|
||||||
{
|
{
|
||||||
if (!mVerifier)
|
if (!mVerifierOperation)
|
||||||
{
|
{
|
||||||
mVerifier = new CSMDoc::Operation (CSMDoc::State_Verifying, false);
|
mVerifierOperation = new CSMDoc::Operation (CSMDoc::State_Verifying, false);
|
||||||
|
|
||||||
connect (mVerifier, SIGNAL (progress (int, int, int)), this, SIGNAL (progress (int, int, int)));
|
connect (&mVerifier, SIGNAL (progress (int, int, int)), this, SIGNAL (progress (int, int, int)));
|
||||||
connect (mVerifier, SIGNAL (done (int, bool)), this, SIGNAL (done (int, bool)));
|
connect (&mVerifier, SIGNAL (done (int, bool)), this, SIGNAL (done (int, bool)));
|
||||||
connect (mVerifier,
|
connect (&mVerifier,
|
||||||
SIGNAL (reportMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)),
|
SIGNAL (reportMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)),
|
||||||
this, SLOT (verifierMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)));
|
this, SLOT (verifierMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)));
|
||||||
|
|
||||||
|
@ -60,46 +60,48 @@ CSMDoc::Operation *CSMTools::Tools::getVerifier()
|
||||||
mandatoryIds.push_back ("Month");
|
mandatoryIds.push_back ("Month");
|
||||||
mandatoryIds.push_back ("PCRace");
|
mandatoryIds.push_back ("PCRace");
|
||||||
|
|
||||||
mVerifier->appendStage (new MandatoryIdStage (mData.getGlobals(),
|
mVerifierOperation->appendStage (new MandatoryIdStage (mData.getGlobals(),
|
||||||
CSMWorld::UniversalId (CSMWorld::UniversalId::Type_Globals), mandatoryIds));
|
CSMWorld::UniversalId (CSMWorld::UniversalId::Type_Globals), mandatoryIds));
|
||||||
|
|
||||||
mVerifier->appendStage (new SkillCheckStage (mData.getSkills()));
|
mVerifierOperation->appendStage (new SkillCheckStage (mData.getSkills()));
|
||||||
|
|
||||||
mVerifier->appendStage (new ClassCheckStage (mData.getClasses()));
|
mVerifierOperation->appendStage (new ClassCheckStage (mData.getClasses()));
|
||||||
|
|
||||||
mVerifier->appendStage (new FactionCheckStage (mData.getFactions()));
|
mVerifierOperation->appendStage (new FactionCheckStage (mData.getFactions()));
|
||||||
|
|
||||||
mVerifier->appendStage (new RaceCheckStage (mData.getRaces()));
|
mVerifierOperation->appendStage (new RaceCheckStage (mData.getRaces()));
|
||||||
|
|
||||||
mVerifier->appendStage (new SoundCheckStage (mData.getSounds()));
|
mVerifierOperation->appendStage (new SoundCheckStage (mData.getSounds()));
|
||||||
|
|
||||||
mVerifier->appendStage (new RegionCheckStage (mData.getRegions()));
|
mVerifierOperation->appendStage (new RegionCheckStage (mData.getRegions()));
|
||||||
|
|
||||||
mVerifier->appendStage (new BirthsignCheckStage (mData.getBirthsigns()));
|
mVerifierOperation->appendStage (new BirthsignCheckStage (mData.getBirthsigns()));
|
||||||
|
|
||||||
mVerifier->appendStage (new SpellCheckStage (mData.getSpells()));
|
mVerifierOperation->appendStage (new SpellCheckStage (mData.getSpells()));
|
||||||
|
|
||||||
mVerifier->appendStage (new ReferenceableCheckStage (mData.getReferenceables().getDataSet(), mData.getRaces(), mData.getClasses(), mData.getFactions()));
|
mVerifierOperation->appendStage (new ReferenceableCheckStage (mData.getReferenceables().getDataSet(), mData.getRaces(), mData.getClasses(), mData.getFactions()));
|
||||||
|
|
||||||
mVerifier->appendStage (new ReferenceCheckStage(mData.getReferences(), mData.getReferenceables(), mData.getCells(), mData.getFactions()));
|
mVerifierOperation->appendStage (new ReferenceCheckStage(mData.getReferences(), mData.getReferenceables(), mData.getCells(), mData.getFactions()));
|
||||||
|
|
||||||
mVerifier->appendStage (new ScriptCheckStage (mDocument));
|
mVerifierOperation->appendStage (new ScriptCheckStage (mDocument));
|
||||||
|
|
||||||
mVerifier->appendStage (new StartScriptCheckStage (mData.getStartScripts(), mData.getScripts()));
|
mVerifierOperation->appendStage (new StartScriptCheckStage (mData.getStartScripts(), mData.getScripts()));
|
||||||
|
|
||||||
mVerifier->appendStage(
|
mVerifierOperation->appendStage(
|
||||||
new BodyPartCheckStage(
|
new BodyPartCheckStage(
|
||||||
mData.getBodyParts(),
|
mData.getBodyParts(),
|
||||||
mData.getResources(
|
mData.getResources(
|
||||||
CSMWorld::UniversalId( CSMWorld::UniversalId::Type_Meshes )),
|
CSMWorld::UniversalId( CSMWorld::UniversalId::Type_Meshes )),
|
||||||
mData.getRaces() ));
|
mData.getRaces() ));
|
||||||
|
|
||||||
|
mVerifier.setOperation (mVerifierOperation);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mVerifier;
|
return &mVerifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSMTools::Tools::Tools (CSMDoc::Document& document)
|
CSMTools::Tools::Tools (CSMDoc::Document& document)
|
||||||
: mDocument (document), mData (document.getData()), mVerifier (0), mNextReportNumber (0)
|
: mDocument (document), mData (document.getData()), mVerifierOperation (0), mNextReportNumber (0)
|
||||||
{
|
{
|
||||||
// index 0: load error log
|
// index 0: load error log
|
||||||
mReports.insert (std::make_pair (mNextReportNumber++, new ReportModel));
|
mReports.insert (std::make_pair (mNextReportNumber++, new ReportModel));
|
||||||
|
@ -108,7 +110,11 @@ CSMTools::Tools::Tools (CSMDoc::Document& document)
|
||||||
|
|
||||||
CSMTools::Tools::~Tools()
|
CSMTools::Tools::~Tools()
|
||||||
{
|
{
|
||||||
delete mVerifier;
|
if (mVerifierOperation)
|
||||||
|
{
|
||||||
|
mVerifier.abortAndWait();
|
||||||
|
delete mVerifierOperation;
|
||||||
|
}
|
||||||
|
|
||||||
for (std::map<int, ReportModel *>::iterator iter (mReports.begin()); iter!=mReports.end(); ++iter)
|
for (std::map<int, ReportModel *>::iterator iter (mReports.begin()); iter!=mReports.end(); ++iter)
|
||||||
delete iter->second;
|
delete iter->second;
|
||||||
|
@ -126,7 +132,7 @@ CSMWorld::UniversalId CSMTools::Tools::runVerifier()
|
||||||
|
|
||||||
void CSMTools::Tools::abortOperation (int type)
|
void CSMTools::Tools::abortOperation (int type)
|
||||||
{
|
{
|
||||||
if (CSMDoc::Operation *operation = get (type))
|
if (CSMDoc::OperationHolder *operation = get (type))
|
||||||
operation->abort();
|
operation->abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +147,7 @@ int CSMTools::Tools::getRunningOperations() const
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
for (int i=0; sOperations[i]!=-1; ++i)
|
for (int i=0; sOperations[i]!=-1; ++i)
|
||||||
if (const CSMDoc::Operation *operation = get (sOperations[i]))
|
if (const CSMDoc::OperationHolder *operation = get (sOperations[i]))
|
||||||
if (operation->isRunning())
|
if (operation->isRunning())
|
||||||
result |= sOperations[i];
|
result |= sOperations[i];
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
#include "../doc/operationholder.hpp"
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
class Data;
|
class Data;
|
||||||
|
@ -27,7 +29,8 @@ namespace CSMTools
|
||||||
|
|
||||||
CSMDoc::Document& mDocument;
|
CSMDoc::Document& mDocument;
|
||||||
CSMWorld::Data& mData;
|
CSMWorld::Data& mData;
|
||||||
CSMDoc::Operation *mVerifier;
|
CSMDoc::Operation *mVerifierOperation;
|
||||||
|
CSMDoc::OperationHolder mVerifier;
|
||||||
std::map<int, ReportModel *> mReports;
|
std::map<int, ReportModel *> mReports;
|
||||||
int mNextReportNumber;
|
int mNextReportNumber;
|
||||||
std::map<int, int> mActiveReports; // type, report number
|
std::map<int, int> mActiveReports; // type, report number
|
||||||
|
@ -36,12 +39,12 @@ namespace CSMTools
|
||||||
Tools (const Tools&);
|
Tools (const Tools&);
|
||||||
Tools& operator= (const Tools&);
|
Tools& operator= (const Tools&);
|
||||||
|
|
||||||
CSMDoc::Operation *getVerifier();
|
CSMDoc::OperationHolder *getVerifier();
|
||||||
|
|
||||||
CSMDoc::Operation *get (int type);
|
CSMDoc::OperationHolder *get (int type);
|
||||||
///< Returns a 0-pointer, if operation hasn't been used yet.
|
///< Returns a 0-pointer, if operation hasn't been used yet.
|
||||||
|
|
||||||
const CSMDoc::Operation *get (int type) const;
|
const CSMDoc::OperationHolder *get (int type) const;
|
||||||
///< Returns a 0-pointer, if operation hasn't been used yet.
|
///< Returns a 0-pointer, if operation hasn't been used yet.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace CSMWorld
|
||||||
{
|
{
|
||||||
class IdTable;
|
class IdTable;
|
||||||
class IdTable;
|
class IdTable;
|
||||||
class RecordBase;
|
struct RecordBase;
|
||||||
class NestedTableWrapperBase;
|
class NestedTableWrapperBase;
|
||||||
|
|
||||||
class ModifyCommand : public QUndoCommand
|
class ModifyCommand : public QUndoCommand
|
||||||
|
|
|
@ -745,7 +745,7 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages)
|
||||||
if (index!=-1 && !mBase)
|
if (index!=-1 && !mBase)
|
||||||
mLand.getRecord (index).mModified.mLand->loadData (
|
mLand.getRecord (index).mModified.mLand->loadData (
|
||||||
ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML | ESM::Land::DATA_VCLR |
|
ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML | ESM::Land::DATA_VCLR |
|
||||||
ESM::Land::DATA_VTEX);
|
ESM::Land::DATA_VTEX | ESM::Land::DATA_WNAM);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
/*! \brief
|
/*! \brief
|
||||||
* Clas for holding the model. Uses typical qt table abstraction/interface for granting access to the individiual fields of the records,
|
* Clas for holding the model. Uses typical qt table abstraction/interface for granting access to the individiual fields of the records,
|
||||||
* Some records are holding nested data (for instance inventory list of the npc). In casses like this, table model offers interface
|
* Some records are holding nested data (for instance inventory list of the npc). In casses like this, table model offers interface
|
||||||
* to access nested data in the qt way – that is specify parent. Since some of those nested data require multiple columns to
|
* to access nested data in the qt way – that is specify parent. Since some of those nested data require multiple columns to
|
||||||
* represent informations, single int (default way to index model in the qmodelindex) is not sufficiant. Therefore tablemodelindex class
|
* represent informations, single int (default way to index model in the qmodelindex) is not sufficiant. Therefore tablemodelindex class
|
||||||
* can hold two ints for the sake of indexing two dimensions of the table. This model does not support multiple levels of the nested
|
* can hold two ints for the sake of indexing two dimensions of the table. This model does not support multiple levels of the nested
|
||||||
* data. Vast majority of methods makes sense only for the top level data.
|
* data. Vast majority of methods makes sense only for the top level data.
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
class CollectionBase;
|
class CollectionBase;
|
||||||
class RecordBase;
|
struct RecordBase;
|
||||||
class NestedTableWrapperBase;
|
class NestedTableWrapperBase;
|
||||||
|
|
||||||
class IdTable : public IdTableBase
|
class IdTable : public IdTableBase
|
||||||
|
|
|
@ -26,7 +26,7 @@ void CSMWorld::InfoCollection::load (const Info& record, bool base)
|
||||||
|
|
||||||
if (!record2.get().mPrev.empty())
|
if (!record2.get().mPrev.empty())
|
||||||
{
|
{
|
||||||
index = getIndex (record2.get().mPrev, topic);
|
index = getInfoIndex (record2.get().mPrev, topic);
|
||||||
|
|
||||||
if (index!=-1)
|
if (index!=-1)
|
||||||
++index;
|
++index;
|
||||||
|
@ -34,7 +34,7 @@ void CSMWorld::InfoCollection::load (const Info& record, bool base)
|
||||||
|
|
||||||
if (index==-1 && !record2.get().mNext.empty())
|
if (index==-1 && !record2.get().mNext.empty())
|
||||||
{
|
{
|
||||||
index = getIndex (record2.get().mNext, topic);
|
index = getInfoIndex (record2.get().mNext, topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index==-1)
|
if (index==-1)
|
||||||
|
@ -60,7 +60,7 @@ void CSMWorld::InfoCollection::load (const Info& record, bool base)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSMWorld::InfoCollection::getIndex (const std::string& id, const std::string& topic) const
|
int CSMWorld::InfoCollection::getInfoIndex (const std::string& id, const std::string& topic) const
|
||||||
{
|
{
|
||||||
std::string fullId = Misc::StringUtils::lowerCase (topic) + "#" + id;
|
std::string fullId = Misc::StringUtils::lowerCase (topic) + "#" + id;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
class Dialogue;
|
struct Dialogue;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
|
@ -22,7 +22,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
void load (const Info& record, bool base);
|
void load (const Info& record, bool base);
|
||||||
|
|
||||||
int getIndex (const std::string& id, const std::string& topic) const;
|
int getInfoIndex (const std::string& id, const std::string& topic) const;
|
||||||
///< Return index for record \a id or -1 (if not present; deleted records are considered)
|
///< Return index for record \a id or -1 (if not present; deleted records are considered)
|
||||||
///
|
///
|
||||||
/// \param id info ID without topic prefix
|
/// \param id info ID without topic prefix
|
||||||
|
|
|
@ -22,6 +22,8 @@ namespace CSMWorld
|
||||||
|
|
||||||
virtual RecordBase *clone() const = 0;
|
virtual RecordBase *clone() const = 0;
|
||||||
|
|
||||||
|
virtual RecordBase *modifiedCopy() const = 0;
|
||||||
|
|
||||||
virtual void assign (const RecordBase& record) = 0;
|
virtual void assign (const RecordBase& record) = 0;
|
||||||
///< Will throw an exception if the types don't match.
|
///< Will throw an exception if the types don't match.
|
||||||
|
|
||||||
|
@ -38,8 +40,15 @@ namespace CSMWorld
|
||||||
ESXRecordT mBase;
|
ESXRecordT mBase;
|
||||||
ESXRecordT mModified;
|
ESXRecordT mModified;
|
||||||
|
|
||||||
|
Record();
|
||||||
|
|
||||||
|
Record(State state,
|
||||||
|
const ESXRecordT *base = 0, const ESXRecordT *modified = 0);
|
||||||
|
|
||||||
virtual RecordBase *clone() const;
|
virtual RecordBase *clone() const;
|
||||||
|
|
||||||
|
virtual RecordBase *modifiedCopy() const;
|
||||||
|
|
||||||
virtual void assign (const RecordBase& record);
|
virtual void assign (const RecordBase& record);
|
||||||
|
|
||||||
const ESXRecordT& get() const;
|
const ESXRecordT& get() const;
|
||||||
|
@ -58,6 +67,29 @@ namespace CSMWorld
|
||||||
///< Merge modified into base.
|
///< Merge modified into base.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename ESXRecordT>
|
||||||
|
Record<ESXRecordT>::Record()
|
||||||
|
: mBase(), mModified()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
template <typename ESXRecordT>
|
||||||
|
Record<ESXRecordT>::Record(State state, const ESXRecordT *base, const ESXRecordT *modified)
|
||||||
|
{
|
||||||
|
if(base)
|
||||||
|
mBase = *base;
|
||||||
|
|
||||||
|
if(modified)
|
||||||
|
mModified = *modified;
|
||||||
|
|
||||||
|
this->mState = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename ESXRecordT>
|
||||||
|
RecordBase *Record<ESXRecordT>::modifiedCopy() const
|
||||||
|
{
|
||||||
|
return new Record<ESXRecordT> (State_ModifiedOnly, 0, &(this->get()));
|
||||||
|
}
|
||||||
|
|
||||||
template <typename ESXRecordT>
|
template <typename ESXRecordT>
|
||||||
RecordBase *Record<ESXRecordT>::clone() const
|
RecordBase *Record<ESXRecordT>::clone() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
class Cell;
|
|
||||||
|
|
||||||
/// \brief Wrapper for CellRef sub record
|
/// \brief Wrapper for CellRef sub record
|
||||||
struct CellRef : public ESM::CellRef
|
struct CellRef : public ESM::CellRef
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
struct Cell;
|
struct Cell;
|
||||||
struct UniversalId;
|
class UniversalId;
|
||||||
|
|
||||||
/// \brief References in cells
|
/// \brief References in cells
|
||||||
class RefCollection : public Collection<CellRef>
|
class RefCollection : public Collection<CellRef>
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace CSMWorld
|
||||||
{
|
{
|
||||||
class RefIdColumn;
|
class RefIdColumn;
|
||||||
class RefIdData;
|
class RefIdData;
|
||||||
class RecordBase;
|
struct RecordBase;
|
||||||
class NestedTableWrapperBase;
|
class NestedTableWrapperBase;
|
||||||
class HelperBase;
|
class HelperBase;
|
||||||
|
|
||||||
|
|
|
@ -160,10 +160,16 @@ namespace CSMWorld
|
||||||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||||
|
|
||||||
|
RecordT record2 = record.get();
|
||||||
if (column==mModel.mModel)
|
if (column==mModel.mModel)
|
||||||
record.get().mModel = value.toString().toUtf8().constData();
|
record2.mModel = value.toString().toUtf8().constData();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
BaseRefIdAdapter<RecordT>::setData (column, data, index, value);
|
BaseRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
record.setModified(record2);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct NameColumns : public ModelColumns
|
struct NameColumns : public ModelColumns
|
||||||
|
@ -220,12 +226,18 @@ namespace CSMWorld
|
||||||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||||
|
|
||||||
|
RecordT record2 = record.get();
|
||||||
if (column==mName.mName)
|
if (column==mName.mName)
|
||||||
record.get().mName = value.toString().toUtf8().constData();
|
record2.mName = value.toString().toUtf8().constData();
|
||||||
else if (column==mName.mScript)
|
else if (column==mName.mScript)
|
||||||
record.get().mScript = value.toString().toUtf8().constData();
|
record2.mScript = value.toString().toUtf8().constData();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ModelRefIdAdapter<RecordT>::setData (column, data, index, value);
|
ModelRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
record.setModified(record2);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct InventoryColumns : public NameColumns
|
struct InventoryColumns : public NameColumns
|
||||||
|
@ -287,14 +299,20 @@ namespace CSMWorld
|
||||||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||||
|
|
||||||
|
RecordT record2 = record.get();
|
||||||
if (column==mInventory.mIcon)
|
if (column==mInventory.mIcon)
|
||||||
record.get().mIcon = value.toString().toUtf8().constData();
|
record2.mIcon = value.toString().toUtf8().constData();
|
||||||
else if (column==mInventory.mWeight)
|
else if (column==mInventory.mWeight)
|
||||||
record.get().mData.mWeight = value.toFloat();
|
record2.mData.mWeight = value.toFloat();
|
||||||
else if (column==mInventory.mValue)
|
else if (column==mInventory.mValue)
|
||||||
record.get().mData.mValue = value.toInt();
|
record2.mData.mValue = value.toInt();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
NameRefIdAdapter<RecordT>::setData (column, data, index, value);
|
NameRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
record.setModified(record2);
|
||||||
}
|
}
|
||||||
|
|
||||||
class PotionRefIdAdapter : public InventoryRefIdAdapter<ESM::Potion>
|
class PotionRefIdAdapter : public InventoryRefIdAdapter<ESM::Potion>
|
||||||
|
@ -368,12 +386,18 @@ namespace CSMWorld
|
||||||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||||
|
|
||||||
|
RecordT record2 = record.get();
|
||||||
if (column==mEnchantable.mEnchantment)
|
if (column==mEnchantable.mEnchantment)
|
||||||
record.get().mEnchant = value.toString().toUtf8().constData();
|
record2.mEnchant = value.toString().toUtf8().constData();
|
||||||
else if (column==mEnchantable.mEnchantmentPoints)
|
else if (column==mEnchantable.mEnchantmentPoints)
|
||||||
record.get().mData.mEnchant = value.toInt();
|
record2.mData.mEnchant = value.toInt();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
InventoryRefIdAdapter<RecordT>::setData (column, data, index, value);
|
InventoryRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
record.setModified(record2);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ToolColumns : public InventoryColumns
|
struct ToolColumns : public InventoryColumns
|
||||||
|
@ -430,12 +454,18 @@ namespace CSMWorld
|
||||||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||||
|
|
||||||
|
RecordT record2 = record.get();
|
||||||
if (column==mTools.mQuality)
|
if (column==mTools.mQuality)
|
||||||
record.get().mData.mQuality = value.toFloat();
|
record2.mData.mQuality = value.toFloat();
|
||||||
else if (column==mTools.mUses)
|
else if (column==mTools.mUses)
|
||||||
record.get().mData.mUses = value.toInt();
|
record2.mData.mUses = value.toInt();
|
||||||
else
|
else
|
||||||
|
{
|
||||||
InventoryRefIdAdapter<RecordT>::setData (column, data, index, value);
|
InventoryRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
record.setModified(record2);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ActorColumns : public NameColumns
|
struct ActorColumns : public NameColumns
|
||||||
|
@ -527,16 +557,17 @@ namespace CSMWorld
|
||||||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||||
|
|
||||||
|
RecordT record2 = record.get();
|
||||||
if (column==mActors.mHasAi)
|
if (column==mActors.mHasAi)
|
||||||
record.get().mHasAI = value.toInt();
|
record2.mHasAI = value.toInt();
|
||||||
else if (column==mActors.mHello)
|
else if (column==mActors.mHello)
|
||||||
record.get().mAiData.mHello = value.toInt();
|
record2.mAiData.mHello = value.toInt();
|
||||||
else if (column==mActors.mFlee)
|
else if (column==mActors.mFlee)
|
||||||
record.get().mAiData.mFlee = value.toInt();
|
record2.mAiData.mFlee = value.toInt();
|
||||||
else if (column==mActors.mFight)
|
else if (column==mActors.mFight)
|
||||||
record.get().mAiData.mFight = value.toInt();
|
record2.mAiData.mFight = value.toInt();
|
||||||
else if (column==mActors.mAlarm)
|
else if (column==mActors.mAlarm)
|
||||||
record.get().mAiData.mAlarm = value.toInt();
|
record2.mAiData.mAlarm = value.toInt();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
typename std::map<const RefIdColumn *, unsigned int>::const_iterator iter =
|
typename std::map<const RefIdColumn *, unsigned int>::const_iterator iter =
|
||||||
|
@ -544,13 +575,18 @@ namespace CSMWorld
|
||||||
if (iter!=mActors.mServices.end())
|
if (iter!=mActors.mServices.end())
|
||||||
{
|
{
|
||||||
if (value.toInt()!=0)
|
if (value.toInt()!=0)
|
||||||
record.get().mAiData.mServices |= iter->second;
|
record2.mAiData.mServices |= iter->second;
|
||||||
else
|
else
|
||||||
record.get().mAiData.mServices &= ~iter->second;
|
record2.mAiData.mServices &= ~iter->second;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
NameRefIdAdapter<RecordT>::setData (column, data, index, value);
|
NameRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
record.setModified(record2);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ApparatusRefIdAdapter : public InventoryRefIdAdapter<ESM::Apparatus>
|
class ApparatusRefIdAdapter : public InventoryRefIdAdapter<ESM::Apparatus>
|
||||||
|
|
|
@ -522,8 +522,7 @@ void CSMWorld::RefIdCollection::cloneRecord(const std::string& origin,
|
||||||
const std::string& destination,
|
const std::string& destination,
|
||||||
const CSMWorld::UniversalId::Type type)
|
const CSMWorld::UniversalId::Type type)
|
||||||
{
|
{
|
||||||
std::auto_ptr<RecordBase> newRecord(mData.getRecord(mData.searchId(origin)).clone());
|
std::auto_ptr<RecordBase> newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy());
|
||||||
newRecord->mState = RecordBase::State_ModifiedOnly;
|
|
||||||
mAdapters.find(type)->second->setId(*newRecord, destination);
|
mAdapters.find(type)->second->setId(*newRecord, destination);
|
||||||
mData.insertRecord(*newRecord, type, destination);
|
mData.insertRecord(*newRecord, type, destination);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace Ogre
|
||||||
namespace CSMWorld
|
namespace CSMWorld
|
||||||
{
|
{
|
||||||
class Data;
|
class Data;
|
||||||
class CellRef;
|
struct CellRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CSVWorld
|
namespace CSVWorld
|
||||||
|
|
|
@ -30,7 +30,7 @@ void CSVTools::ReportTable::contextMenuEvent (QContextMenuEvent *event)
|
||||||
void CSVTools::ReportTable::mouseMoveEvent (QMouseEvent *event)
|
void CSVTools::ReportTable::mouseMoveEvent (QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->buttons() & Qt::LeftButton)
|
if (event->buttons() & Qt::LeftButton)
|
||||||
startDrag (*this);
|
startDragFromTable (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVTools::ReportTable::mouseDoubleClickEvent (QMouseEvent *event)
|
void CSVTools::ReportTable::mouseDoubleClickEvent (QMouseEvent *event)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -42,8 +43,12 @@ QAbstractItemDelegate(parent),
|
||||||
mTable(table)
|
mTable(table)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void CSVWorld::NotEditableSubDelegate::setEditorData (QLabel* editor, const QModelIndex& index) const
|
void CSVWorld::NotEditableSubDelegate::setEditorData (QWidget* editor, const QModelIndex& index) const
|
||||||
{
|
{
|
||||||
|
QLabel* label = qobject_cast<QLabel*>(editor);
|
||||||
|
if(!label)
|
||||||
|
return;
|
||||||
|
|
||||||
QVariant v = index.data(Qt::EditRole);
|
QVariant v = index.data(Qt::EditRole);
|
||||||
if (!v.isValid())
|
if (!v.isValid())
|
||||||
{
|
{
|
||||||
|
@ -56,16 +61,17 @@ void CSVWorld::NotEditableSubDelegate::setEditorData (QLabel* editor, const QMod
|
||||||
|
|
||||||
if (QVariant::String == v.type())
|
if (QVariant::String == v.type())
|
||||||
{
|
{
|
||||||
editor->setText(v.toString());
|
label->setText(v.toString());
|
||||||
} else //else we are facing enums
|
}
|
||||||
|
else //else we are facing enums
|
||||||
{
|
{
|
||||||
int data = v.toInt();
|
int data = v.toInt();
|
||||||
std::vector<std::string> enumNames (CSMWorld::Columns::getEnums (static_cast<CSMWorld::Columns::ColumnId> (mTable->getColumnId (index.column()))));
|
std::vector<std::string> enumNames (CSMWorld::Columns::getEnums (static_cast<CSMWorld::Columns::ColumnId> (mTable->getColumnId (index.column()))));
|
||||||
editor->setText(QString::fromUtf8(enumNames.at(data).c_str()));
|
label->setText(QString::fromUtf8(enumNames.at(data).c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::NotEditableSubDelegate::setModelData (QWidget* editor, QAbstractItemModel* model, const QModelIndex& index, CSMWorld::ColumnBase::Display display) const
|
void CSVWorld::NotEditableSubDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
|
||||||
{
|
{
|
||||||
//not editable widgets will not save model data
|
//not editable widgets will not save model data
|
||||||
}
|
}
|
||||||
|
@ -82,8 +88,7 @@ QSize CSVWorld::NotEditableSubDelegate::sizeHint (const QStyleOptionViewItem& op
|
||||||
|
|
||||||
QWidget* CSVWorld::NotEditableSubDelegate::createEditor (QWidget *parent,
|
QWidget* CSVWorld::NotEditableSubDelegate::createEditor (QWidget *parent,
|
||||||
const QStyleOptionViewItem& option,
|
const QStyleOptionViewItem& option,
|
||||||
const QModelIndex& index,
|
const QModelIndex& index) const
|
||||||
CSMWorld::ColumnBase::Display display) const
|
|
||||||
{
|
{
|
||||||
return new QLabel(parent);
|
return new QLabel(parent);
|
||||||
}
|
}
|
||||||
|
@ -226,6 +231,11 @@ void CSVWorld::DialogueDelegateDispatcher::setEditorData (QWidget* editor, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::DialogueDelegateDispatcher::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
setModelData(editor, model, index, CSMWorld::ColumnBase::Display_None);
|
||||||
|
}
|
||||||
|
|
||||||
void CSVWorld::DialogueDelegateDispatcher::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index, CSMWorld::ColumnBase::Display display) const
|
void CSVWorld::DialogueDelegateDispatcher::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index, CSMWorld::ColumnBase::Display display) const
|
||||||
{
|
{
|
||||||
std::map<int, CommandDelegate*>::const_iterator delegateIt(mDelegates.find(display));
|
std::map<int, CommandDelegate*>::const_iterator delegateIt(mDelegates.find(display));
|
||||||
|
@ -260,7 +270,7 @@ QWidget* CSVWorld::DialogueDelegateDispatcher::makeEditor(CSMWorld::ColumnBase::
|
||||||
QWidget* editor = NULL;
|
QWidget* editor = NULL;
|
||||||
if (! (mTable->flags (index) & Qt::ItemIsEditable))
|
if (! (mTable->flags (index) & Qt::ItemIsEditable))
|
||||||
{
|
{
|
||||||
return mNotEditableDelegate.createEditor(qobject_cast<QWidget*>(mParent), QStyleOptionViewItem(), index, display);
|
return mNotEditableDelegate.createEditor(qobject_cast<QWidget*>(mParent), QStyleOptionViewItem(), index);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<int, CommandDelegate*>::iterator delegateIt(mDelegates.find(display));
|
std::map<int, CommandDelegate*>::iterator delegateIt(mDelegates.find(display));
|
||||||
|
@ -271,6 +281,8 @@ QWidget* CSVWorld::DialogueDelegateDispatcher::makeEditor(CSMWorld::ColumnBase::
|
||||||
|
|
||||||
DialogueDelegateDispatcherProxy* proxy = new DialogueDelegateDispatcherProxy(editor, display);
|
DialogueDelegateDispatcherProxy* proxy = new DialogueDelegateDispatcherProxy(editor, display);
|
||||||
|
|
||||||
|
// NOTE: For each entry in CSVWorld::CommandDelegate::createEditor() a corresponding entry
|
||||||
|
// is required here
|
||||||
if (qobject_cast<DropLineEdit*>(editor))
|
if (qobject_cast<DropLineEdit*>(editor))
|
||||||
{
|
{
|
||||||
connect(editor, SIGNAL(editingFinished()), proxy, SLOT(editorDataCommited()));
|
connect(editor, SIGNAL(editingFinished()), proxy, SLOT(editorDataCommited()));
|
||||||
|
@ -295,10 +307,12 @@ QWidget* CSVWorld::DialogueDelegateDispatcher::makeEditor(CSMWorld::ColumnBase::
|
||||||
{
|
{
|
||||||
connect(editor, SIGNAL(currentIndexChanged (int)), proxy, SLOT(editorDataCommited()));
|
connect(editor, SIGNAL(currentIndexChanged (int)), proxy, SLOT(editorDataCommited()));
|
||||||
}
|
}
|
||||||
else if (qobject_cast<QAbstractSpinBox*>(editor))
|
else if (qobject_cast<QAbstractSpinBox*>(editor) || qobject_cast<QLineEdit*>(editor))
|
||||||
{
|
{
|
||||||
connect(editor, SIGNAL(editingFinished()), proxy, SLOT(editorDataCommited()));
|
connect(editor, SIGNAL(editingFinished()), proxy, SLOT(editorDataCommited()));
|
||||||
}
|
}
|
||||||
|
else // throw an exception because this is a coding error
|
||||||
|
throw std::logic_error ("Dialogue editor type missing");
|
||||||
|
|
||||||
connect(proxy, SIGNAL(editorDataCommited(QWidget*, const QModelIndex&, CSMWorld::ColumnBase::Display)),
|
connect(proxy, SIGNAL(editorDataCommited(QWidget*, const QModelIndex&, CSMWorld::ColumnBase::Display)),
|
||||||
this, SLOT(editorDataCommited(QWidget*, const QModelIndex&, CSMWorld::ColumnBase::Display)));
|
this, SLOT(editorDataCommited(QWidget*, const QModelIndex&, CSMWorld::ColumnBase::Display)));
|
||||||
|
|
|
@ -42,12 +42,9 @@ namespace CSVWorld
|
||||||
NotEditableSubDelegate(const CSMWorld::IdTable* table,
|
NotEditableSubDelegate(const CSMWorld::IdTable* table,
|
||||||
QObject * parent = 0);
|
QObject * parent = 0);
|
||||||
|
|
||||||
virtual void setEditorData (QLabel* editor,
|
virtual void setEditorData (QWidget* editor, const QModelIndex& index) const;
|
||||||
const QModelIndex& index) const;
|
|
||||||
|
|
||||||
virtual void setModelData (QWidget* editor, QAbstractItemModel* model,
|
virtual void setModelData (QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
|
||||||
const QModelIndex& index,
|
|
||||||
CSMWorld::ColumnBase::Display display) const;
|
|
||||||
|
|
||||||
virtual void paint (QPainter* painter,
|
virtual void paint (QPainter* painter,
|
||||||
const QStyleOptionViewItem& option,
|
const QStyleOptionViewItem& option,
|
||||||
|
@ -60,8 +57,7 @@ namespace CSVWorld
|
||||||
|
|
||||||
virtual QWidget *createEditor (QWidget *parent,
|
virtual QWidget *createEditor (QWidget *parent,
|
||||||
const QStyleOptionViewItem& option,
|
const QStyleOptionViewItem& option,
|
||||||
const QModelIndex& index,
|
const QModelIndex& index) const;
|
||||||
CSMWorld::ColumnBase::Display display = CSMWorld::ColumnBase::Display_None) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//this can't be nested into the DialogueDelegateDispatcher, because it needs to emit signals
|
//this can't be nested into the DialogueDelegateDispatcher, because it needs to emit signals
|
||||||
|
@ -136,10 +132,9 @@ namespace CSVWorld
|
||||||
virtual void setEditorData (QWidget* editor,
|
virtual void setEditorData (QWidget* editor,
|
||||||
const QModelIndex& index) const;
|
const QModelIndex& index) const;
|
||||||
|
|
||||||
virtual void setModelData (QWidget* editor,
|
virtual void setModelData (QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
|
||||||
QAbstractItemModel* model,
|
|
||||||
const QModelIndex& index,
|
virtual void setModelData (QWidget* editor, QAbstractItemModel* model, const QModelIndex& index, CSMWorld::ColumnBase::Display display) const;
|
||||||
CSMWorld::ColumnBase::Display display) const;
|
|
||||||
|
|
||||||
virtual void paint (QPainter* painter,
|
virtual void paint (QPainter* painter,
|
||||||
const QStyleOptionViewItem& option,
|
const QStyleOptionViewItem& option,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "../../model/world/tablemimedata.hpp"
|
#include "../../model/world/tablemimedata.hpp"
|
||||||
#include "dragrecordtable.hpp"
|
#include "dragrecordtable.hpp"
|
||||||
|
|
||||||
void CSVWorld::DragRecordTable::startDrag (const CSVWorld::DragRecordTable& table)
|
void CSVWorld::DragRecordTable::startDragFromTable (const CSVWorld::DragRecordTable& table)
|
||||||
{
|
{
|
||||||
CSMWorld::TableMimeData* mime = new CSMWorld::TableMimeData (table.getDraggedRecords(), mDocument);
|
CSMWorld::TableMimeData* mime = new CSMWorld::TableMimeData (table.getDraggedRecords(), mDocument);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace CSVWorld
|
||||||
void setEditLock(bool locked);
|
void setEditLock(bool locked);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void startDrag(const DragRecordTable& table);
|
void startDragFromTable(const DragRecordTable& table);
|
||||||
|
|
||||||
void dragEnterEvent(QDragEnterEvent *event);
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,6 @@ QWidget *CSVWorld::EnumDelegate::createEditor(QWidget *parent,
|
||||||
const QModelIndex& index) const
|
const QModelIndex& index) const
|
||||||
{
|
{
|
||||||
return createEditor(parent, option, index, CSMWorld::ColumnBase::Display_None);
|
return createEditor(parent, option, index, CSMWorld::ColumnBase::Display_None);
|
||||||
//overloading virtual functions is HARD
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *CSVWorld::EnumDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem& option,
|
QWidget *CSVWorld::EnumDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem& option,
|
||||||
|
|
|
@ -345,7 +345,7 @@ void CSVWorld::RegionMap::viewInTable()
|
||||||
|
|
||||||
void CSVWorld::RegionMap::mouseMoveEvent (QMouseEvent* event)
|
void CSVWorld::RegionMap::mouseMoveEvent (QMouseEvent* event)
|
||||||
{
|
{
|
||||||
startDrag(*this);
|
startDragFromTable(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDraggedRecords() const
|
std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDraggedRecords() const
|
||||||
|
|
|
@ -635,7 +635,7 @@ void CSVWorld::Table::mouseMoveEvent (QMouseEvent* event)
|
||||||
{
|
{
|
||||||
if (event->buttons() & Qt::LeftButton)
|
if (event->buttons() & Qt::LeftButton)
|
||||||
{
|
{
|
||||||
startDrag(*this);
|
startDragFromTable(*this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,12 @@ void CSVWorld::CommandDelegate::setModelData (QWidget *editor, QAbstractItemMode
|
||||||
///< \todo provide some kind of feedback to the user, indicating that editing is currently not possible.
|
///< \todo provide some kind of feedback to the user, indicating that editing is currently not possible.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleOptionViewItem& option,
|
||||||
|
const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
return createEditor (parent, option, index, CSMWorld::ColumnBase::Display_None);
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleOptionViewItem& option,
|
QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleOptionViewItem& option,
|
||||||
const QModelIndex& index, CSMWorld::ColumnBase::Display display) const
|
const QModelIndex& index, CSMWorld::ColumnBase::Display display) const
|
||||||
{
|
{
|
||||||
|
@ -152,6 +158,8 @@ QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: for each editor type (e.g. QLineEdit) there needs to be a corresponding
|
||||||
|
// entry in CSVWorld::DialogueDelegateDispatcher::makeEditor()
|
||||||
switch (display)
|
switch (display)
|
||||||
{
|
{
|
||||||
case CSMWorld::ColumnBase::Display_Colour:
|
case CSMWorld::ColumnBase::Display_Colour:
|
||||||
|
@ -228,6 +236,11 @@ bool CSVWorld::CommandDelegate::isEditLocked() const
|
||||||
return mEditLock;
|
return mEditLock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelIndex& index) const
|
||||||
|
{
|
||||||
|
setEditorData (editor, index, false);
|
||||||
|
}
|
||||||
|
|
||||||
void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay) const
|
void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay) const
|
||||||
{
|
{
|
||||||
QVariant v = index.data(Qt::EditRole);
|
QVariant v = index.data(Qt::EditRole);
|
||||||
|
|
|
@ -130,10 +130,14 @@ namespace CSVWorld
|
||||||
virtual void setModelData (QWidget *editor, QAbstractItemModel *model,
|
virtual void setModelData (QWidget *editor, QAbstractItemModel *model,
|
||||||
const QModelIndex& index) const;
|
const QModelIndex& index) const;
|
||||||
|
|
||||||
|
virtual QWidget *createEditor (QWidget *parent,
|
||||||
|
const QStyleOptionViewItem& option,
|
||||||
|
const QModelIndex& index) const;
|
||||||
|
|
||||||
virtual QWidget *createEditor (QWidget *parent,
|
virtual QWidget *createEditor (QWidget *parent,
|
||||||
const QStyleOptionViewItem& option,
|
const QStyleOptionViewItem& option,
|
||||||
const QModelIndex& index,
|
const QModelIndex& index,
|
||||||
CSMWorld::ColumnBase::Display display = CSMWorld::ColumnBase::Display_None) const;
|
CSMWorld::ColumnBase::Display display) const;
|
||||||
|
|
||||||
void setEditLock (bool locked);
|
void setEditLock (bool locked);
|
||||||
|
|
||||||
|
@ -141,8 +145,9 @@ namespace CSVWorld
|
||||||
|
|
||||||
///< \return Does column require update?
|
///< \return Does column require update?
|
||||||
|
|
||||||
virtual void setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay = false) const;
|
virtual void setEditorData (QWidget *editor, const QModelIndex& index) const;
|
||||||
|
|
||||||
|
virtual void setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ set(GAME
|
||||||
)
|
)
|
||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
|
set(GAME ${GAME} android_commandLine.cpp)
|
||||||
set(GAME ${GAME} android_main.c)
|
set(GAME ${GAME} android_main.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -104,7 +105,6 @@ find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
|
|
||||||
if (NOT ANDROID)
|
if (NOT ANDROID)
|
||||||
add_executable(openmw
|
add_executable(openmw
|
||||||
${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
|
|
||||||
${OPENMW_FILES}
|
${OPENMW_FILES}
|
||||||
${GAME} ${GAME_HEADER}
|
${GAME} ${GAME_HEADER}
|
||||||
${APPLE_BUNDLE_RESOURCES}
|
${APPLE_BUNDLE_RESOURCES}
|
||||||
|
@ -112,7 +112,6 @@ if (NOT ANDROID)
|
||||||
else ()
|
else ()
|
||||||
add_library(openmw
|
add_library(openmw
|
||||||
SHARED
|
SHARED
|
||||||
${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
|
|
||||||
${OPENMW_FILES}
|
${OPENMW_FILES}
|
||||||
${GAME} ${GAME_HEADER}
|
${GAME} ${GAME_HEADER}
|
||||||
)
|
)
|
||||||
|
@ -120,9 +119,10 @@ endif ()
|
||||||
|
|
||||||
# Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING
|
# Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING
|
||||||
# when we change the backend.
|
# when we change the backend.
|
||||||
include_directories(${SOUND_INPUT_INCLUDES} ${BULLET_INCLUDE_DIRS})
|
include_directories(${SOUND_INPUT_INCLUDES})
|
||||||
|
|
||||||
target_link_libraries(openmw
|
target_link_libraries(openmw
|
||||||
|
${OENGINE_LIBRARY}
|
||||||
${OGRE_LIBRARIES}
|
${OGRE_LIBRARIES}
|
||||||
${OGRE_STATIC_PLUGINS}
|
${OGRE_STATIC_PLUGINS}
|
||||||
${SHINY_LIBRARIES}
|
${SHINY_LIBRARIES}
|
||||||
|
|
18
apps/openmw/android_commandLine.cpp
Normal file
18
apps/openmw/android_commandLine.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#include "android_commandLine.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
const char *argvData[15];
|
||||||
|
int argcData;
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_ui_activity_GameActivity_commandLine(JNIEnv *env,
|
||||||
|
jobject obj, jint argc, jobjectArray stringArray) {
|
||||||
|
jboolean iscopy;
|
||||||
|
argcData = (int) argc;
|
||||||
|
argvData[0]="openmw";
|
||||||
|
for (int i = 0; i < argcData; i++) {
|
||||||
|
jstring string = (jstring) (*env).GetObjectArrayElement(stringArray, i);
|
||||||
|
argvData[i+1] = (env)->GetStringUTFChars(string, &iscopy);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
16
apps/openmw/android_commandLine.h
Normal file
16
apps/openmw/android_commandLine.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
|
||||||
|
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||||
|
#include <jni.h>
|
||||||
|
#ifndef _Included_ui_activity_GameActivity_commandLine
|
||||||
|
#define _Included_ui_activity_GameActivity_commandLine
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
JNIEXPORT void JNICALL Java_ui_activity_GameActivity_commandLine(JNIEnv *env, jobject obj,jint argcData, jobjectArray stringArray);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -1,42 +1,36 @@
|
||||||
|
|
||||||
#include "../../SDL_internal.h"
|
#include "../../SDL_internal.h"
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#include "SDL_main.h"
|
#include "SDL_main.h"
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
Functions called by JNI
|
Functions called by JNI
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
/* Called before to initialize JNI bindings */
|
/* Called before to initialize JNI bindings */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
|
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
|
||||||
|
extern int argcData;
|
||||||
|
extern const char *argvData[15];
|
||||||
|
|
||||||
|
int Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls,
|
||||||
|
jobject obj) {
|
||||||
|
|
||||||
int Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
|
SDL_Android_Init(env, cls);
|
||||||
{
|
|
||||||
|
|
||||||
SDL_Android_Init(env, cls);
|
SDL_SetMainReady();
|
||||||
|
|
||||||
SDL_SetMainReady();
|
/* Run the application code! */
|
||||||
|
|
||||||
|
int status;
|
||||||
|
|
||||||
/* Run the application code! */
|
status = main(argcData+1, argvData);
|
||||||
|
|
||||||
int status;
|
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
|
||||||
char *argv[2];
|
/* exit(status); */
|
||||||
argv[0] = SDL_strdup("openmw");
|
|
||||||
argv[1] = NULL;
|
|
||||||
status = main(1, argv);
|
|
||||||
|
|
||||||
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
|
return status;
|
||||||
/* exit(status); */
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __ANDROID__ */
|
#endif /* __ANDROID__ */
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
#include <openengine/misc/rng.hpp>
|
||||||
|
|
||||||
#include <components/compiler/extensions0.hpp>
|
#include <components/compiler/extensions0.hpp>
|
||||||
|
|
||||||
#include <components/bsa/resources.hpp>
|
#include <components/bsa/resources.hpp>
|
||||||
|
@ -191,15 +193,13 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
||||||
, mExportFonts(false)
|
, mExportFonts(false)
|
||||||
, mNewGame (false)
|
, mNewGame (false)
|
||||||
{
|
{
|
||||||
std::srand ( std::time(NULL) );
|
OEngine::Misc::Rng::init();
|
||||||
|
std::srand ( static_cast<unsigned int>(std::time(NULL)) );
|
||||||
MWClass::registerClasses();
|
MWClass::registerClasses();
|
||||||
|
|
||||||
Uint32 flags = SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE|SDL_INIT_GAMECONTROLLER|SDL_INIT_JOYSTICK;
|
Uint32 flags = SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE|SDL_INIT_GAMECONTROLLER|SDL_INIT_JOYSTICK;
|
||||||
if(SDL_WasInit(flags) == 0)
|
if(SDL_WasInit(flags) == 0)
|
||||||
{
|
{
|
||||||
//kindly ask SDL not to trash our OGL context
|
|
||||||
//might this be related to http://bugzilla.libsdl.org/show_bug.cgi?id=748 ?
|
|
||||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
|
|
||||||
SDL_SetMainReady();
|
SDL_SetMainReady();
|
||||||
if(SDL_Init(flags) != 0)
|
if(SDL_Init(flags) != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -290,7 +290,7 @@ public:
|
||||||
std::streamsize write(const char *str, std::streamsize size)
|
std::streamsize write(const char *str, std::streamsize size)
|
||||||
{
|
{
|
||||||
// Make a copy for null termination
|
// Make a copy for null termination
|
||||||
std::string tmp (str, size);
|
std::string tmp (str, static_cast<unsigned int>(size));
|
||||||
// Write string to Visual Studio Debug output
|
// Write string to Visual Studio Debug output
|
||||||
OutputDebugString (tmp.c_str ());
|
OutputDebugString (tmp.c_str ());
|
||||||
return size;
|
return size;
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace MWWorld
|
||||||
namespace MWSound
|
namespace MWSound
|
||||||
{
|
{
|
||||||
class Sound;
|
class Sound;
|
||||||
class Sound_Decoder;
|
struct Sound_Decoder;
|
||||||
typedef boost::shared_ptr<Sound_Decoder> DecoderPtr;
|
typedef boost::shared_ptr<Sound_Decoder> DecoderPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,17 +149,14 @@ namespace MWBase
|
||||||
|
|
||||||
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world
|
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world
|
||||||
virtual MWGui::DialogueWindow* getDialogueWindow() = 0;
|
virtual MWGui::DialogueWindow* getDialogueWindow() = 0;
|
||||||
virtual MWGui::ContainerWindow* getContainerWindow() = 0;
|
|
||||||
virtual MWGui::InventoryWindow* getInventoryWindow() = 0;
|
virtual MWGui::InventoryWindow* getInventoryWindow() = 0;
|
||||||
virtual MWGui::BookWindow* getBookWindow() = 0;
|
|
||||||
virtual MWGui::ScrollWindow* getScrollWindow() = 0;
|
|
||||||
virtual MWGui::CountDialog* getCountDialog() = 0;
|
virtual MWGui::CountDialog* getCountDialog() = 0;
|
||||||
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
||||||
virtual MWGui::TradeWindow* getTradeWindow() = 0;
|
virtual MWGui::TradeWindow* getTradeWindow() = 0;
|
||||||
virtual MWGui::SpellBuyingWindow* getSpellBuyingWindow() = 0;
|
|
||||||
virtual MWGui::TravelWindow* getTravelWindow() = 0;
|
virtual void updateSpellWindow() = 0;
|
||||||
virtual MWGui::SpellWindow* getSpellWindow() = 0;
|
|
||||||
virtual MWGui::Console* getConsole() = 0;
|
virtual void setConsoleSelectedObject(const MWWorld::Ptr& object) = 0;
|
||||||
|
|
||||||
virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount) = 0;
|
virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount) = 0;
|
||||||
|
|
||||||
|
@ -181,12 +178,6 @@ namespace MWBase
|
||||||
virtual void configureSkills (const SkillList& major, const SkillList& minor) = 0;
|
virtual void configureSkills (const SkillList& major, const SkillList& minor) = 0;
|
||||||
///< configure skill groups, each set contains the skill ID for that group.
|
///< 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;
|
virtual void updateSkillArea() = 0;
|
||||||
///< update display of skills, factions, birth sign, reputation and bounty
|
///< update display of skills, factions, birth sign, reputation and bounty
|
||||||
|
|
||||||
|
@ -303,6 +294,12 @@ namespace MWBase
|
||||||
virtual void startTraining(MWWorld::Ptr actor) = 0;
|
virtual void startTraining(MWWorld::Ptr actor) = 0;
|
||||||
virtual void startRepair(MWWorld::Ptr actor) = 0;
|
virtual void startRepair(MWWorld::Ptr actor) = 0;
|
||||||
virtual void startRepairItem(MWWorld::Ptr item) = 0;
|
virtual void startRepairItem(MWWorld::Ptr item) = 0;
|
||||||
|
virtual void startTravel(const MWWorld::Ptr& actor) = 0;
|
||||||
|
virtual void startSpellBuying(const MWWorld::Ptr& actor) = 0;
|
||||||
|
virtual void startTrade(const MWWorld::Ptr& actor) = 0;
|
||||||
|
virtual void openContainer(const MWWorld::Ptr& container, bool loot) = 0;
|
||||||
|
virtual void showBook(const MWWorld::Ptr& item, bool showTakeButton) = 0;
|
||||||
|
virtual void showScroll(const MWWorld::Ptr& item, bool showTakeButton) = 0;
|
||||||
|
|
||||||
virtual void showSoulgemDialog (MWWorld::Ptr item) = 0;
|
virtual void showSoulgemDialog (MWWorld::Ptr item) = 0;
|
||||||
|
|
||||||
|
@ -332,9 +329,8 @@ namespace MWBase
|
||||||
/// Does the current stack of GUI-windows permit saving?
|
/// Does the current stack of GUI-windows permit saving?
|
||||||
virtual bool isSavingAllowed() const = 0;
|
virtual bool isSavingAllowed() const = 0;
|
||||||
|
|
||||||
/// Returns the current Modal
|
/// Send exit command to active Modal window
|
||||||
/** Used to send exit command to active Modal when Esc is pressed **/
|
virtual void exitCurrentModal() = 0;
|
||||||
virtual MWGui::WindowModal* getCurrentModal() const = 0;
|
|
||||||
|
|
||||||
/// Sets the current Modal
|
/// Sets the current Modal
|
||||||
/** Used to send exit command to active Modal when Esc is pressed **/
|
/** Used to send exit command to active Modal when Esc is pressed **/
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace MWRender
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
class Movement;
|
struct Movement;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
|
@ -205,10 +205,8 @@ namespace MWBase
|
||||||
///< Return a pointer to a liveCellRef which contains \a ptr.
|
///< Return a pointer to a liveCellRef which contains \a ptr.
|
||||||
/// \note Search is limited to the active cells.
|
/// \note Search is limited to the active cells.
|
||||||
|
|
||||||
/// \todo enable reference in the OGRE scene
|
|
||||||
virtual void enable (const MWWorld::Ptr& ptr) = 0;
|
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 disable (const MWWorld::Ptr& ptr) = 0;
|
||||||
|
|
||||||
virtual void advanceTime (double hours) = 0;
|
virtual void advanceTime (double hours) = 0;
|
||||||
|
|
|
@ -155,7 +155,7 @@ namespace MWClass
|
||||||
|
|
||||||
bool Apparatus::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Apparatus::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
{
|
{
|
||||||
return npcServices & ESM::NPC::Apparatus;
|
return (npcServices & ESM::NPC::Apparatus) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Apparatus::getWeight(const MWWorld::Ptr &ptr) const
|
float Apparatus::getWeight(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -154,9 +154,9 @@ namespace MWClass
|
||||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
float iWeight = gmst.find (typeGmst)->getInt();
|
float iWeight = floor(gmst.find(typeGmst)->getFloat());
|
||||||
|
|
||||||
float epsilon = 5e-4;
|
float epsilon = 0.0005f;
|
||||||
|
|
||||||
if (ref->mBase->mData.mWeight == 0)
|
if (ref->mBase->mData.mWeight == 0)
|
||||||
return ESM::Skill::Unarmored;
|
return ESM::Skill::Unarmored;
|
||||||
|
@ -262,7 +262,7 @@ namespace MWClass
|
||||||
|
|
||||||
info.enchant = ref->mBase->mEnchant;
|
info.enchant = ref->mBase->mEnchant;
|
||||||
if (!info.enchant.empty())
|
if (!info.enchant.empty())
|
||||||
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
|
info.remainingEnchantCharge = static_cast<int>(ptr.getCellRef().getEnchantmentCharge());
|
||||||
|
|
||||||
info.text = text;
|
info.text = text;
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ namespace MWClass
|
||||||
|
|
||||||
info.enchant = ref->mBase->mEnchant;
|
info.enchant = ref->mBase->mEnchant;
|
||||||
if (!info.enchant.empty())
|
if (!info.enchant.empty())
|
||||||
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
|
info.remainingEnchantCharge = static_cast<int>(ptr.getCellRef().getEnchantmentCharge());
|
||||||
|
|
||||||
info.text = text;
|
info.text = text;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
#include "creature.hpp"
|
#include "creature.hpp"
|
||||||
|
|
||||||
|
#include <openengine/misc/rng.hpp>
|
||||||
|
|
||||||
#include <components/esm/loadcrea.hpp>
|
#include <components/esm/loadcrea.hpp>
|
||||||
#include <components/esm/creaturestate.hpp>
|
#include <components/esm/creaturestate.hpp>
|
||||||
|
|
||||||
|
@ -103,9 +105,9 @@ namespace MWClass
|
||||||
data->mCreatureStats.setAttribute(ESM::Attribute::Endurance, ref->mBase->mData.mEndurance);
|
data->mCreatureStats.setAttribute(ESM::Attribute::Endurance, ref->mBase->mData.mEndurance);
|
||||||
data->mCreatureStats.setAttribute(ESM::Attribute::Personality, ref->mBase->mData.mPersonality);
|
data->mCreatureStats.setAttribute(ESM::Attribute::Personality, ref->mBase->mData.mPersonality);
|
||||||
data->mCreatureStats.setAttribute(ESM::Attribute::Luck, ref->mBase->mData.mLuck);
|
data->mCreatureStats.setAttribute(ESM::Attribute::Luck, ref->mBase->mData.mLuck);
|
||||||
data->mCreatureStats.setHealth (ref->mBase->mData.mHealth);
|
data->mCreatureStats.setHealth(static_cast<float>(ref->mBase->mData.mHealth));
|
||||||
data->mCreatureStats.setMagicka (ref->mBase->mData.mMana);
|
data->mCreatureStats.setMagicka(static_cast<float>(ref->mBase->mData.mMana));
|
||||||
data->mCreatureStats.setFatigue (ref->mBase->mData.mFatigue);
|
data->mCreatureStats.setFatigue(static_cast<float>(ref->mBase->mData.mFatigue));
|
||||||
|
|
||||||
data->mCreatureStats.setLevel(ref->mBase->mData.mLevel);
|
data->mCreatureStats.setLevel(ref->mBase->mData.mLevel);
|
||||||
|
|
||||||
|
@ -164,7 +166,7 @@ namespace MWClass
|
||||||
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||||
|
|
||||||
MWRender::Actors& actors = renderingInterface.getActors();
|
MWRender::Actors& actors = renderingInterface.getActors();
|
||||||
actors.insertCreature(ptr, model, ref->mBase->mFlags & ESM::Creature::Weapon);
|
actors.insertCreature(ptr, model, (ref->mBase->mFlags & ESM::Creature::Weapon) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
void Creature::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||||
|
@ -249,7 +251,7 @@ namespace MWClass
|
||||||
|
|
||||||
float hitchance = MWMechanics::getHitChance(ptr, victim, ref->mBase->mData.mCombat);
|
float hitchance = MWMechanics::getHitChance(ptr, victim, ref->mBase->mData.mCombat);
|
||||||
|
|
||||||
if((::rand()/(RAND_MAX+1.0)) > hitchance/100.0f)
|
if(OEngine::Misc::Rng::rollProbability() >= hitchance/100.0f)
|
||||||
{
|
{
|
||||||
victim.getClass().onHit(victim, 0.0f, false, MWWorld::Ptr(), ptr, false);
|
victim.getClass().onHit(victim, 0.0f, false, MWWorld::Ptr(), ptr, false);
|
||||||
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
|
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
|
||||||
|
@ -288,9 +290,7 @@ namespace MWClass
|
||||||
if(attack)
|
if(attack)
|
||||||
{
|
{
|
||||||
damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength());
|
damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength());
|
||||||
damage *= gmst.find("fDamageStrengthBase")->getFloat() +
|
MWMechanics::adjustWeaponDamage(damage, weapon, ptr);
|
||||||
(stats.getAttribute(ESM::Attribute::Strength).getModified() * gmst.find("fDamageStrengthMult")->getFloat() * 0.1);
|
|
||||||
MWMechanics::adjustWeaponDamage(damage, weapon);
|
|
||||||
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
|
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ namespace MWClass
|
||||||
if(!object.isEmpty())
|
if(!object.isEmpty())
|
||||||
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
|
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
|
||||||
|
|
||||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
|
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
{
|
{
|
||||||
const std::string &script = ptr.get<ESM::Creature>()->mBase->mScript;
|
const std::string &script = ptr.get<ESM::Creature>()->mBase->mScript;
|
||||||
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
|
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
|
||||||
|
@ -376,9 +376,8 @@ namespace MWClass
|
||||||
// Check for knockdown
|
// Check for knockdown
|
||||||
float agilityTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified() * getGmst().fKnockDownMult->getFloat();
|
float agilityTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified() * getGmst().fKnockDownMult->getFloat();
|
||||||
float knockdownTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified()
|
float knockdownTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified()
|
||||||
* getGmst().iKnockDownOddsMult->getInt() * 0.01 + getGmst().iKnockDownOddsBase->getInt();
|
* getGmst().iKnockDownOddsMult->getInt() * 0.01f + getGmst().iKnockDownOddsBase->getInt();
|
||||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
if (ishealth && agilityTerm <= damage && knockdownTerm <= OEngine::Misc::Rng::roll0to99())
|
||||||
if (ishealth && agilityTerm <= damage && knockdownTerm <= roll)
|
|
||||||
{
|
{
|
||||||
getCreatureStats(ptr).setKnockedDown(true);
|
getCreatureStats(ptr).setKnockedDown(true);
|
||||||
|
|
||||||
|
@ -493,7 +492,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||||
|
|
||||||
return (ref->mBase->mFlags & ESM::Creature::Weapon);
|
return (ref->mBase->mFlags & ESM::Creature::Weapon) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Creature::getScript (const MWWorld::Ptr& ptr) const
|
std::string Creature::getScript (const MWWorld::Ptr& ptr) const
|
||||||
|
@ -508,7 +507,7 @@ namespace MWClass
|
||||||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||||
ptr.get<ESM::Creature>();
|
ptr.get<ESM::Creature>();
|
||||||
|
|
||||||
return ref->mBase->mFlags & ESM::Creature::Essential;
|
return (ref->mBase->mFlags & ESM::Creature::Essential) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::registerSelf()
|
void Creature::registerSelf()
|
||||||
|
@ -528,7 +527,7 @@ namespace MWClass
|
||||||
MWMechanics::CreatureStats& stats = getCreatureStats(ptr);
|
MWMechanics::CreatureStats& stats = getCreatureStats(ptr);
|
||||||
const GMST& gmst = getGmst();
|
const GMST& gmst = getGmst();
|
||||||
|
|
||||||
float walkSpeed = gmst.fMinWalkSpeedCreature->getFloat() + 0.01 * stats.getAttribute(ESM::Attribute::Speed).getModified()
|
float walkSpeed = gmst.fMinWalkSpeedCreature->getFloat() + 0.01f * stats.getAttribute(ESM::Attribute::Speed).getModified()
|
||||||
* (gmst.fMaxWalkSpeedCreature->getFloat() - gmst.fMinWalkSpeedCreature->getFloat());
|
* (gmst.fMaxWalkSpeedCreature->getFloat() - gmst.fMinWalkSpeedCreature->getFloat());
|
||||||
|
|
||||||
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
@ -626,7 +625,7 @@ namespace MWClass
|
||||||
float Creature::getCapacity (const MWWorld::Ptr& ptr) const
|
float Creature::getCapacity (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||||
return stats.getAttribute(0).getModified()*5;
|
return static_cast<float>(stats.getAttribute(0).getModified() * 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
float Creature::getEncumbrance (const MWWorld::Ptr& ptr) const
|
float Creature::getEncumbrance (const MWWorld::Ptr& ptr) const
|
||||||
|
@ -682,7 +681,7 @@ namespace MWClass
|
||||||
++sound;
|
++sound;
|
||||||
}
|
}
|
||||||
if(!sounds.empty())
|
if(!sounds.empty())
|
||||||
return sounds[(int)(rand()/(RAND_MAX+1.0)*sounds.size())]->mSound;
|
return sounds[OEngine::Misc::Rng::rollDice(sounds.size())]->mSound;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == ESM::SoundGenerator::Land)
|
if (type == ESM::SoundGenerator::Land)
|
||||||
|
@ -713,7 +712,7 @@ namespace MWClass
|
||||||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||||
ptr.get<ESM::Creature>();
|
ptr.get<ESM::Creature>();
|
||||||
|
|
||||||
return ref->mBase->mFlags & ESM::Creature::Flies;
|
return (ref->mBase->mFlags & ESM::Creature::Flies) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Creature::canSwim(const MWWorld::Ptr &ptr) const
|
bool Creature::canSwim(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -167,19 +167,19 @@ namespace MWClass
|
||||||
if (opening)
|
if (opening)
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getSoundManager()->fadeOutSound3D(ptr,
|
MWBase::Environment::get().getSoundManager()->fadeOutSound3D(ptr,
|
||||||
closeSound, 0.5);
|
closeSound, 0.5f);
|
||||||
float offset = ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265 * 2.0;
|
float offset = ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265f * 2.0f;
|
||||||
action->setSoundOffset(offset);
|
action->setSoundOffset(offset);
|
||||||
action->setSound(openSound);
|
action->setSound(openSound);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getSoundManager()->fadeOutSound3D(ptr,
|
MWBase::Environment::get().getSoundManager()->fadeOutSound3D(ptr,
|
||||||
openSound, 0.5);
|
openSound, 0.5f);
|
||||||
float offset = 1.0 - ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265 * 2.0;
|
float offset = 1.0f - ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265f * 2.0f;
|
||||||
//most if not all door have closing bang somewhere in the middle of the sound,
|
//most if not all door have closing bang somewhere in the middle of the sound,
|
||||||
//so we divide offset by two
|
//so we divide offset by two
|
||||||
action->setSoundOffset(offset * 0.5);
|
action->setSoundOffset(offset * 0.5f);
|
||||||
action->setSound(closeSound);
|
action->setSound(closeSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ namespace MWClass
|
||||||
|
|
||||||
bool Ingredient::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Ingredient::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
{
|
{
|
||||||
return npcServices & ESM::NPC::Ingredients;
|
return (npcServices & ESM::NPC::Ingredients) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace MWClass
|
||||||
assert (ref->mBase != NULL);
|
assert (ref->mBase != NULL);
|
||||||
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr, model, ref->mBase->mData.mFlags & ESM::Light::Carry);
|
physics.addObject(ptr, model, (ref->mBase->mData.mFlags & ESM::Light::Carry) != 0);
|
||||||
|
|
||||||
if (!ref->mBase->mSound.empty() && !(ref->mBase->mData.mFlags & ESM::Light::OffDefault))
|
if (!ref->mBase->mSound.empty() && !(ref->mBase->mData.mFlags & ESM::Light::OffDefault))
|
||||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0,
|
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0,
|
||||||
|
@ -205,7 +205,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
|
MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
|
||||||
if (ptr.getCellRef().getCharge() == -1)
|
if (ptr.getCellRef().getCharge() == -1)
|
||||||
return ref->mBase->mData.mTime;
|
return static_cast<float>(ref->mBase->mData.mTime);
|
||||||
else
|
else
|
||||||
return ptr.getCellRef().getChargeFloat();
|
return ptr.getCellRef().getChargeFloat();
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ namespace MWClass
|
||||||
|
|
||||||
bool Light::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Light::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
{
|
{
|
||||||
return npcServices & ESM::NPC::Lights;
|
return (npcServices & ESM::NPC::Lights) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Light::getWeight(const MWWorld::Ptr &ptr) const
|
float Light::getWeight(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -173,7 +173,7 @@ namespace MWClass
|
||||||
|
|
||||||
bool Lockpick::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Lockpick::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
{
|
{
|
||||||
return npcServices & ESM::NPC::Picks;
|
return (npcServices & ESM::NPC::Picks) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Lockpick::getItemMaxHealth (const MWWorld::Ptr& ptr) const
|
int Lockpick::getItemMaxHealth (const MWWorld::Ptr& ptr) const
|
||||||
|
|
|
@ -259,7 +259,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||||
ptr.get<ESM::Miscellaneous>();
|
ptr.get<ESM::Miscellaneous>();
|
||||||
return ref->mBase->mData.mIsKey;
|
return ref->mBase->mData.mIsKey != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include <OgreSceneNode.h>
|
#include <OgreSceneNode.h>
|
||||||
|
|
||||||
|
#include <openengine/misc/rng.hpp>
|
||||||
|
|
||||||
#include <components/esm/loadmgef.hpp>
|
#include <components/esm/loadmgef.hpp>
|
||||||
#include <components/esm/loadnpc.hpp>
|
#include <components/esm/loadnpc.hpp>
|
||||||
#include <components/esm/npcstate.hpp>
|
#include <components/esm/npcstate.hpp>
|
||||||
|
@ -66,12 +68,12 @@ namespace
|
||||||
double i = floor(d);
|
double i = floor(d);
|
||||||
d -= i;
|
d -= i;
|
||||||
if(d < 0.5)
|
if(d < 0.5)
|
||||||
return i;
|
return static_cast<int>(i);
|
||||||
if(d > 0.5)
|
if(d > 0.5)
|
||||||
return i + 1.0;
|
return static_cast<int>(i) + 1;
|
||||||
if(is_even(i))
|
if(is_even(i))
|
||||||
return i;
|
return static_cast<int>(i);
|
||||||
return i + 1.0;
|
return static_cast<int>(i) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void autoCalculateAttributes (const ESM::NPC* npc, MWMechanics::CreatureStats& creatureStats)
|
void autoCalculateAttributes (const ESM::NPC* npc, MWMechanics::CreatureStats& creatureStats)
|
||||||
|
@ -116,7 +118,7 @@ namespace
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// is this a minor or major skill?
|
// is this a minor or major skill?
|
||||||
float add=0.2;
|
float add=0.2f;
|
||||||
for (int k=0; k<5; ++k)
|
for (int k=0; k<5; ++k)
|
||||||
{
|
{
|
||||||
if (class_->mData.mSkills[k][0] == j)
|
if (class_->mData.mSkills[k][0] == j)
|
||||||
|
@ -149,7 +151,7 @@ namespace
|
||||||
|| class_->mData.mAttribute[1] == ESM::Attribute::Endurance)
|
|| class_->mData.mAttribute[1] == ESM::Attribute::Endurance)
|
||||||
multiplier += 1;
|
multiplier += 1;
|
||||||
|
|
||||||
creatureStats.setHealth(static_cast<int> (0.5 * (strength + endurance)) + multiplier * (creatureStats.getLevel() - 1));
|
creatureStats.setHealth(floor(0.5f * (strength + endurance)) + multiplier * (creatureStats.getLevel() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -279,8 +281,6 @@ namespace MWClass
|
||||||
gmst.fKnockDownMult = store.find("fKnockDownMult");
|
gmst.fKnockDownMult = store.find("fKnockDownMult");
|
||||||
gmst.iKnockDownOddsMult = store.find("iKnockDownOddsMult");
|
gmst.iKnockDownOddsMult = store.find("iKnockDownOddsMult");
|
||||||
gmst.iKnockDownOddsBase = store.find("iKnockDownOddsBase");
|
gmst.iKnockDownOddsBase = store.find("iKnockDownOddsBase");
|
||||||
gmst.fDamageStrengthBase = store.find("fDamageStrengthBase");
|
|
||||||
gmst.fDamageStrengthMult = store.find("fDamageStrengthMult");
|
|
||||||
gmst.fCombatArmorMinMult = store.find("fCombatArmorMinMult");
|
gmst.fCombatArmorMinMult = store.find("fCombatArmorMinMult");
|
||||||
|
|
||||||
inited = true;
|
inited = true;
|
||||||
|
@ -475,7 +475,6 @@ namespace MWClass
|
||||||
void Npc::hit(const MWWorld::Ptr& ptr, int type) const
|
void Npc::hit(const MWWorld::Ptr& ptr, int type) const
|
||||||
{
|
{
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
const GMST& gmst = getGmst();
|
|
||||||
|
|
||||||
const MWWorld::Store<ESM::GameSetting> &store = world->getStore().get<ESM::GameSetting>();
|
const MWWorld::Store<ESM::GameSetting> &store = world->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
|
@ -507,7 +506,7 @@ namespace MWClass
|
||||||
if(otherstats.isDead()) // Can't hit dead actors
|
if(otherstats.isDead()) // Can't hit dead actors
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(ptr.getRefData().getHandle() == "player")
|
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
|
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
|
||||||
|
|
||||||
int weapskill = ESM::Skill::HandToHand;
|
int weapskill = ESM::Skill::HandToHand;
|
||||||
|
@ -516,7 +515,7 @@ namespace MWClass
|
||||||
|
|
||||||
float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill));
|
float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill));
|
||||||
|
|
||||||
if((::rand()/(RAND_MAX+1.0)) > hitchance/100.0f)
|
if (OEngine::Misc::Rng::rollProbability() >= hitchance / 100.0f)
|
||||||
{
|
{
|
||||||
othercls.onHit(victim, 0.0f, false, weapon, ptr, false);
|
othercls.onHit(victim, 0.0f, false, weapon, ptr, false);
|
||||||
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
|
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
|
||||||
|
@ -538,10 +537,8 @@ namespace MWClass
|
||||||
if(attack)
|
if(attack)
|
||||||
{
|
{
|
||||||
damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength());
|
damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength());
|
||||||
damage *= gmst.fDamageStrengthBase->getFloat() +
|
|
||||||
(stats.getAttribute(ESM::Attribute::Strength).getModified() * gmst.fDamageStrengthMult->getFloat() * 0.1);
|
|
||||||
}
|
}
|
||||||
MWMechanics::adjustWeaponDamage(damage, weapon);
|
MWMechanics::adjustWeaponDamage(damage, weapon, ptr);
|
||||||
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
|
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
|
||||||
healthdmg = true;
|
healthdmg = true;
|
||||||
}
|
}
|
||||||
|
@ -549,7 +546,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
MWMechanics::getHandToHandDamage(ptr, victim, damage, healthdmg);
|
MWMechanics::getHandToHandDamage(ptr, victim, damage, healthdmg);
|
||||||
}
|
}
|
||||||
if(ptr.getRefData().getHandle() == "player")
|
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
{
|
{
|
||||||
skillUsageSucceeded(ptr, weapskill, 0);
|
skillUsageSucceeded(ptr, weapskill, 0);
|
||||||
|
|
||||||
|
@ -625,7 +622,7 @@ namespace MWClass
|
||||||
if(!object.isEmpty())
|
if(!object.isEmpty())
|
||||||
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
|
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
|
||||||
|
|
||||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
|
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
{
|
{
|
||||||
const std::string &script = ptr.getClass().getScript(ptr);
|
const std::string &script = ptr.getClass().getScript(ptr);
|
||||||
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
|
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
|
||||||
|
@ -648,8 +645,7 @@ namespace MWClass
|
||||||
const GMST& gmst = getGmst();
|
const GMST& gmst = getGmst();
|
||||||
|
|
||||||
int chance = store.get<ESM::GameSetting>().find("iVoiceHitOdds")->getInt();
|
int chance = store.get<ESM::GameSetting>().find("iVoiceHitOdds")->getInt();
|
||||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
if (OEngine::Misc::Rng::roll0to99() < chance)
|
||||||
if (roll < chance)
|
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getDialogueManager()->say(ptr, "hit");
|
MWBase::Environment::get().getDialogueManager()->say(ptr, "hit");
|
||||||
}
|
}
|
||||||
|
@ -657,9 +653,8 @@ namespace MWClass
|
||||||
// Check for knockdown
|
// Check for knockdown
|
||||||
float agilityTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified() * gmst.fKnockDownMult->getFloat();
|
float agilityTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified() * gmst.fKnockDownMult->getFloat();
|
||||||
float knockdownTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified()
|
float knockdownTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified()
|
||||||
* gmst.iKnockDownOddsMult->getInt() * 0.01 + gmst.iKnockDownOddsBase->getInt();
|
* gmst.iKnockDownOddsMult->getInt() * 0.01f + gmst.iKnockDownOddsBase->getInt();
|
||||||
roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
if (ishealth && agilityTerm <= damage && knockdownTerm <= OEngine::Misc::Rng::roll0to99())
|
||||||
if (ishealth && agilityTerm <= damage && knockdownTerm <= roll)
|
|
||||||
{
|
{
|
||||||
getCreatureStats(ptr).setKnockedDown(true);
|
getCreatureStats(ptr).setKnockedDown(true);
|
||||||
|
|
||||||
|
@ -685,12 +680,12 @@ namespace MWClass
|
||||||
MWWorld::InventoryStore::Slot_RightPauldron, MWWorld::InventoryStore::Slot_RightPauldron,
|
MWWorld::InventoryStore::Slot_RightPauldron, MWWorld::InventoryStore::Slot_RightPauldron,
|
||||||
MWWorld::InventoryStore::Slot_LeftGauntlet, MWWorld::InventoryStore::Slot_RightGauntlet
|
MWWorld::InventoryStore::Slot_LeftGauntlet, MWWorld::InventoryStore::Slot_RightGauntlet
|
||||||
};
|
};
|
||||||
int hitslot = hitslots[(int)(::rand()/(RAND_MAX+1.0)*20.0)];
|
int hitslot = hitslots[OEngine::Misc::Rng::rollDice(20)];
|
||||||
|
|
||||||
float unmitigatedDamage = damage;
|
float unmitigatedDamage = damage;
|
||||||
float x = damage / (damage + getArmorRating(ptr));
|
float x = damage / (damage + getArmorRating(ptr));
|
||||||
damage *= std::max(gmst.fCombatArmorMinMult->getFloat(), x);
|
damage *= std::max(gmst.fCombatArmorMinMult->getFloat(), x);
|
||||||
int damageDiff = unmitigatedDamage - damage;
|
int damageDiff = static_cast<int>(unmitigatedDamage - damage);
|
||||||
if (damage < 1)
|
if (damage < 1)
|
||||||
damage = 1;
|
damage = 1;
|
||||||
|
|
||||||
|
@ -708,7 +703,7 @@ namespace MWClass
|
||||||
if (armorhealth == 0)
|
if (armorhealth == 0)
|
||||||
armor = *inv.unequipItem(armor, ptr);
|
armor = *inv.unequipItem(armor, ptr);
|
||||||
|
|
||||||
if (ptr.getRefData().getHandle() == "player")
|
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
skillUsageSucceeded(ptr, armor.getClass().getEquipmentSkill(armor), 0);
|
skillUsageSucceeded(ptr, armor.getClass().getEquipmentSkill(armor), 0);
|
||||||
|
|
||||||
switch(armor.getClass().getEquipmentSkill(armor))
|
switch(armor.getClass().getEquipmentSkill(armor))
|
||||||
|
@ -724,7 +719,7 @@ namespace MWClass
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ptr.getRefData().getHandle() == "player")
|
else if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
skillUsageSucceeded(ptr, ESM::Skill::Unarmored, 0);
|
skillUsageSucceeded(ptr, ESM::Skill::Unarmored, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -737,7 +732,7 @@ namespace MWClass
|
||||||
if(damage > 0.0f)
|
if(damage > 0.0f)
|
||||||
{
|
{
|
||||||
sndMgr->playSound3D(ptr, "Health Damage", 1.0f, 1.0f);
|
sndMgr->playSound3D(ptr, "Health Damage", 1.0f, 1.0f);
|
||||||
if (ptr.getRefData().getHandle() == "player")
|
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
MWBase::Environment::get().getWindowManager()->activateHitOverlay();
|
MWBase::Environment::get().getWindowManager()->activateHitOverlay();
|
||||||
}
|
}
|
||||||
float health = getCreatureStats(ptr).getHealth().getCurrent() - damage;
|
float health = getCreatureStats(ptr).getHealth().getCurrent() - damage;
|
||||||
|
@ -815,7 +810,7 @@ namespace MWClass
|
||||||
const MWWorld::Ptr& actor) const
|
const MWWorld::Ptr& actor) const
|
||||||
{
|
{
|
||||||
// player got activated by another NPC
|
// player got activated by another NPC
|
||||||
if(ptr.getRefData().getHandle() == "player")
|
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor));
|
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor));
|
||||||
|
|
||||||
// Werewolfs can't activate NPCs
|
// Werewolfs can't activate NPCs
|
||||||
|
@ -938,7 +933,7 @@ namespace MWClass
|
||||||
gmst.fJumpEncumbranceMultiplier->getFloat() *
|
gmst.fJumpEncumbranceMultiplier->getFloat() *
|
||||||
(1.0f - Npc::getEncumbrance(ptr)/Npc::getCapacity(ptr));
|
(1.0f - Npc::getEncumbrance(ptr)/Npc::getCapacity(ptr));
|
||||||
|
|
||||||
float a = npcdata->mNpcStats.getSkill(ESM::Skill::Acrobatics).getModified();
|
float a = static_cast<float>(npcdata->mNpcStats.getSkill(ESM::Skill::Acrobatics).getModified());
|
||||||
float b = 0.0f;
|
float b = 0.0f;
|
||||||
if(a > 50.0f)
|
if(a > 50.0f)
|
||||||
{
|
{
|
||||||
|
@ -993,7 +988,7 @@ namespace MWClass
|
||||||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||||
ptr.get<ESM::NPC>();
|
ptr.get<ESM::NPC>();
|
||||||
|
|
||||||
return ref->mBase->mFlags & ESM::NPC::Essential;
|
return (ref->mBase->mFlags & ESM::NPC::Essential) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Npc::registerSelf()
|
void Npc::registerSelf()
|
||||||
|
@ -1097,7 +1092,7 @@ namespace MWClass
|
||||||
if (it == invStore.end() || it->getTypeName() != typeid(ESM::Armor).name())
|
if (it == invStore.end() || it->getTypeName() != typeid(ESM::Armor).name())
|
||||||
{
|
{
|
||||||
// unarmored
|
// unarmored
|
||||||
ratings[i] = (fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill);
|
ratings[i] = static_cast<int>((fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
class GameSetting;
|
struct GameSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
|
@ -38,8 +38,6 @@ namespace MWClass
|
||||||
const ESM::GameSetting *fKnockDownMult;
|
const ESM::GameSetting *fKnockDownMult;
|
||||||
const ESM::GameSetting *iKnockDownOddsMult;
|
const ESM::GameSetting *iKnockDownOddsMult;
|
||||||
const ESM::GameSetting *iKnockDownOddsBase;
|
const ESM::GameSetting *iKnockDownOddsBase;
|
||||||
const ESM::GameSetting *fDamageStrengthBase;
|
|
||||||
const ESM::GameSetting *fDamageStrengthMult;
|
|
||||||
const ESM::GameSetting *fCombatArmorMinMult;
|
const ESM::GameSetting *fCombatArmorMinMult;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ namespace MWClass
|
||||||
|
|
||||||
bool Potion::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Potion::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
{
|
{
|
||||||
return npcServices & ESM::NPC::Potions;
|
return (npcServices & ESM::NPC::Potions) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Potion::getWeight(const MWWorld::Ptr &ptr) const
|
float Potion::getWeight(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -172,7 +172,7 @@ namespace MWClass
|
||||||
|
|
||||||
bool Probe::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Probe::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
{
|
{
|
||||||
return npcServices & ESM::NPC::Probes;
|
return (npcServices & ESM::NPC::Probes) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Probe::getItemMaxHealth (const MWWorld::Ptr& ptr) const
|
int Probe::getItemMaxHealth (const MWWorld::Ptr& ptr) const
|
||||||
|
|
|
@ -172,7 +172,7 @@ namespace MWClass
|
||||||
|
|
||||||
bool Repair::canSell (const MWWorld::Ptr& item, int npcServices) const
|
bool Repair::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||||
{
|
{
|
||||||
return npcServices & ESM::NPC::RepairItem;
|
return (npcServices & ESM::NPC::RepairItem) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Repair::getWeight(const MWWorld::Ptr &ptr) const
|
float Repair::getWeight(const MWWorld::Ptr &ptr) const
|
||||||
|
|
|
@ -345,7 +345,7 @@ namespace MWClass
|
||||||
info.enchant = ref->mBase->mEnchant;
|
info.enchant = ref->mBase->mEnchant;
|
||||||
|
|
||||||
if (!info.enchant.empty())
|
if (!info.enchant.empty())
|
||||||
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
|
info.remainingEnchantCharge = static_cast<int>(ptr.getCellRef().getEnchantmentCharge());
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||||
text += MWGui::ToolTips::getCellRefString(ptr.getCellRef());
|
text += MWGui::ToolTips::getCellRefString(ptr.getCellRef());
|
||||||
|
|
|
@ -179,10 +179,7 @@ namespace MWDialogue
|
||||||
bool isCompanion = !mActor.getClass().getScript(mActor).empty()
|
bool isCompanion = !mActor.getClass().getScript(mActor).empty()
|
||||||
&& mActor.getRefData().getLocals().getIntVar(mActor.getClass().getScript(mActor), "companion");
|
&& mActor.getRefData().getLocals().getIntVar(mActor.getClass().getScript(mActor), "companion");
|
||||||
if (isCompanion)
|
if (isCompanion)
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Companion);
|
|
||||||
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mActor);
|
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mActor);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DialogueManager::compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code)
|
bool DialogueManager::compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code)
|
||||||
|
@ -383,7 +380,8 @@ namespace MWDialogue
|
||||||
|| services & ESM::NPC::Misc)
|
|| services & ESM::NPC::Misc)
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Trade;
|
windowServices |= MWGui::DialogueWindow::Service_Trade;
|
||||||
|
|
||||||
if(mActor.getTypeName() == typeid(ESM::NPC).name() && !mActor.get<ESM::NPC>()->mBase->mTransport.empty())
|
if((mActor.getTypeName() == typeid(ESM::NPC).name() && !mActor.get<ESM::NPC>()->mBase->getTransport().empty())
|
||||||
|
|| (mActor.getTypeName() == typeid(ESM::Creature).name() && !mActor.get<ESM::Creature>()->mBase->getTransport().empty()))
|
||||||
windowServices |= MWGui::DialogueWindow::Service_Travel;
|
windowServices |= MWGui::DialogueWindow::Service_Travel;
|
||||||
|
|
||||||
if (services & ESM::NPC::Spells)
|
if (services & ESM::NPC::Spells)
|
||||||
|
@ -444,7 +442,7 @@ namespace MWDialogue
|
||||||
if (mActor.getClass().isNpc())
|
if (mActor.getClass().isNpc())
|
||||||
{
|
{
|
||||||
MWMechanics::NpcStats& npcStats = mActor.getClass().getNpcStats(mActor);
|
MWMechanics::NpcStats& npcStats = mActor.getClass().getNpcStats(mActor);
|
||||||
npcStats.setBaseDisposition(npcStats.getBaseDisposition() + mPermanentDispositionChange);
|
npcStats.setBaseDisposition(static_cast<int>(npcStats.getBaseDisposition() + mPermanentDispositionChange));
|
||||||
}
|
}
|
||||||
mPermanentDispositionChange = 0;
|
mPermanentDispositionChange = 0;
|
||||||
mTemporaryDispositionChange = 0;
|
mTemporaryDispositionChange = 0;
|
||||||
|
@ -521,7 +519,7 @@ namespace MWDialogue
|
||||||
mPermanentDispositionChange += perm;
|
mPermanentDispositionChange += perm;
|
||||||
|
|
||||||
// change temp disposition so that final disposition is between 0...100
|
// change temp disposition so that final disposition is between 0...100
|
||||||
int curDisp = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor);
|
float curDisp = static_cast<float>(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor));
|
||||||
if (curDisp + mTemporaryDispositionChange < 0)
|
if (curDisp + mTemporaryDispositionChange < 0)
|
||||||
mTemporaryDispositionChange = -curDisp;
|
mTemporaryDispositionChange = -curDisp;
|
||||||
else if (curDisp + mTemporaryDispositionChange > 100)
|
else if (curDisp + mTemporaryDispositionChange > 100)
|
||||||
|
@ -564,7 +562,7 @@ namespace MWDialogue
|
||||||
|
|
||||||
int DialogueManager::getTemporaryDispositionChange() const
|
int DialogueManager::getTemporaryDispositionChange() const
|
||||||
{
|
{
|
||||||
return mTemporaryDispositionChange;
|
return static_cast<int>(mTemporaryDispositionChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueManager::applyDispositionChange(int delta)
|
void DialogueManager::applyDispositionChange(int delta)
|
||||||
|
|
|
@ -41,8 +41,8 @@ void BackgroundImage::adjustSize()
|
||||||
|
|
||||||
MyGUI::IntSize screenSize = getSize();
|
MyGUI::IntSize screenSize = getSize();
|
||||||
|
|
||||||
int leftPadding = std::max(0.0, (screenSize.width - screenSize.height * mAspect) / 2);
|
int leftPadding = std::max(0, static_cast<int>(screenSize.width - screenSize.height * mAspect) / 2);
|
||||||
int topPadding = std::max(0.0, (screenSize.height - screenSize.width / mAspect) / 2);
|
int topPadding = std::max(0, static_cast<int>(screenSize.height - screenSize.width / mAspect) / 2);
|
||||||
|
|
||||||
mChild->setCoord(leftPadding, topPadding, screenSize.width - leftPadding*2, screenSize.height - topPadding*2);
|
mChild->setCoord(leftPadding, topPadding, screenSize.width - leftPadding*2, screenSize.height - topPadding*2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
struct TypesetBookImpl;
|
struct TypesetBookImpl;
|
||||||
struct PageDisplay;
|
class PageDisplay;
|
||||||
struct BookPageImpl;
|
class BookPageImpl;
|
||||||
|
|
||||||
static bool ucsSpace (int codePoint);
|
static bool ucsSpace (int codePoint);
|
||||||
static bool ucsLineBreak (int codePoint);
|
static bool ucsLineBreak (int codePoint);
|
||||||
|
@ -326,7 +326,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
||||||
mLine = NULL;
|
mLine = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sectionBreak (float margin)
|
void sectionBreak (int margin)
|
||||||
{
|
{
|
||||||
add_partial_text();
|
add_partial_text();
|
||||||
|
|
||||||
|
@ -465,7 +465,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
||||||
{
|
{
|
||||||
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
|
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
|
||||||
if (gi)
|
if (gi)
|
||||||
space_width += gi->advance + gi->bearingX;
|
space_width += static_cast<int>(gi->advance + gi->bearingX);
|
||||||
stream.consume ();
|
stream.consume ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
||||||
{
|
{
|
||||||
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
|
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
|
||||||
if (gi)
|
if (gi)
|
||||||
word_width += gi->advance + gi->bearingX;
|
word_width += static_cast<int>(gi->advance + gi->bearingX);
|
||||||
stream.consume ();
|
stream.consume ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,15 +623,15 @@ namespace
|
||||||
|
|
||||||
RenderXform (MyGUI::ICroppedRectangle* croppedParent, MyGUI::RenderTargetInfo const & renderTargetInfo)
|
RenderXform (MyGUI::ICroppedRectangle* croppedParent, MyGUI::RenderTargetInfo const & renderTargetInfo)
|
||||||
{
|
{
|
||||||
clipTop = croppedParent->_getMarginTop ();
|
clipTop = static_cast<float>(croppedParent->_getMarginTop());
|
||||||
clipLeft = croppedParent->_getMarginLeft ();
|
clipLeft = static_cast<float>(croppedParent->_getMarginLeft ());
|
||||||
clipRight = croppedParent->getWidth () - croppedParent->_getMarginRight ();
|
clipRight = static_cast<float>(croppedParent->getWidth () - croppedParent->_getMarginRight ());
|
||||||
clipBottom = croppedParent->getHeight () - croppedParent->_getMarginBottom ();
|
clipBottom = static_cast<float>(croppedParent->getHeight() - croppedParent->_getMarginBottom());
|
||||||
|
|
||||||
absoluteLeft = croppedParent->getAbsoluteLeft();
|
absoluteLeft = static_cast<float>(croppedParent->getAbsoluteLeft());
|
||||||
absoluteTop = croppedParent->getAbsoluteTop();
|
absoluteTop = static_cast<float>(croppedParent->getAbsoluteTop());
|
||||||
leftOffset = renderTargetInfo.leftOffset;
|
leftOffset = static_cast<float>(renderTargetInfo.leftOffset);
|
||||||
topOffset = renderTargetInfo.topOffset;
|
topOffset = static_cast<float>(renderTargetInfo.topOffset);
|
||||||
|
|
||||||
pixScaleX = renderTargetInfo.pixScaleX;
|
pixScaleX = renderTargetInfo.pixScaleX;
|
||||||
pixScaleY = renderTargetInfo.pixScaleY;
|
pixScaleY = renderTargetInfo.pixScaleY;
|
||||||
|
@ -1136,7 +1136,7 @@ public:
|
||||||
|
|
||||||
MyGUI::Colour colour = isActive ? (this_->mItemActive ? run.mStyle->mActiveColour: run.mStyle->mHotColour) : run.mStyle->mNormalColour;
|
MyGUI::Colour colour = isActive ? (this_->mItemActive ? run.mStyle->mActiveColour: run.mStyle->mHotColour) : run.mStyle->mNormalColour;
|
||||||
|
|
||||||
glyphStream.reset (section.mRect.left + line.mRect.left + run.mLeft, line.mRect.top, colour);
|
glyphStream.reset(static_cast<float>(section.mRect.left + line.mRect.left + run.mLeft), static_cast<float>(line.mRect.top), colour);
|
||||||
|
|
||||||
Utf8Stream stream (run.mRange);
|
Utf8Stream stream (run.mRange);
|
||||||
|
|
||||||
|
@ -1164,7 +1164,7 @@ public:
|
||||||
|
|
||||||
RenderXform renderXform (mCroppedParent, textFormat.mRenderItem->getRenderTarget()->getInfo());
|
RenderXform renderXform (mCroppedParent, textFormat.mRenderItem->getRenderTarget()->getInfo());
|
||||||
|
|
||||||
GlyphStream glyphStream (textFormat.mFont, mCoord.left, mCoord.top-mViewTop,
|
GlyphStream glyphStream(textFormat.mFont, static_cast<float>(mCoord.left), static_cast<float>(mCoord.top - mViewTop),
|
||||||
-1 /*mNode->getNodeDepth()*/, vertices, renderXform);
|
-1 /*mNode->getNodeDepth()*/, vertices, renderXform);
|
||||||
|
|
||||||
int visit_top = (std::max) (mViewTop, mViewTop + int (renderXform.clipTop ));
|
int visit_top = (std::max) (mViewTop, mViewTop + int (renderXform.clipTop ));
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace MWGui
|
||||||
/// to begin when additional text is inserted. Pagination attempts to keep
|
/// to begin when additional text is inserted. Pagination attempts to keep
|
||||||
/// sections together on a single page. The margin parameter adds additional space
|
/// sections together on a single page. The margin parameter adds additional space
|
||||||
/// before the next line of text.
|
/// before the next line of text.
|
||||||
virtual void sectionBreak (float margin = 0) = 0;
|
virtual void sectionBreak (int margin = 0) = 0;
|
||||||
|
|
||||||
/// Changes the alignment for the current section of text.
|
/// Changes the alignment for the current section of text.
|
||||||
virtual void setSectionAlignment (Alignment sectionAlignment) = 0;
|
virtual void setSectionAlignment (Alignment sectionAlignment) = 0;
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace MWGui
|
||||||
mPages.clear();
|
mPages.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookWindow::open (MWWorld::Ptr book)
|
void BookWindow::open (MWWorld::Ptr book, bool showTakeButton)
|
||||||
{
|
{
|
||||||
mBook = book;
|
mBook = book;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ namespace MWGui
|
||||||
|
|
||||||
updatePages();
|
updatePages();
|
||||||
|
|
||||||
setTakeButtonShow(true);
|
setTakeButtonShow(showTakeButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookWindow::exit()
|
void BookWindow::exit()
|
||||||
|
|
|
@ -16,10 +16,7 @@ namespace MWGui
|
||||||
|
|
||||||
virtual void exit();
|
virtual void exit();
|
||||||
|
|
||||||
void open(MWWorld::Ptr book);
|
void open(MWWorld::Ptr book, bool showTakeButton);
|
||||||
void setTakeButtonShow(bool show);
|
|
||||||
void nextPage();
|
|
||||||
void prevPage();
|
|
||||||
void setInventoryAllowed(bool allowed);
|
void setInventoryAllowed(bool allowed);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -28,6 +25,10 @@ namespace MWGui
|
||||||
void onCloseButtonClicked (MyGUI::Widget* sender);
|
void onCloseButtonClicked (MyGUI::Widget* sender);
|
||||||
void onTakeButtonClicked (MyGUI::Widget* sender);
|
void onTakeButtonClicked (MyGUI::Widget* sender);
|
||||||
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||||
|
void setTakeButtonShow(bool show);
|
||||||
|
|
||||||
|
void nextPage();
|
||||||
|
void prevPage();
|
||||||
|
|
||||||
void updatePages();
|
void updatePages();
|
||||||
void clearPages();
|
void clearPages();
|
||||||
|
|
|
@ -330,20 +330,7 @@ namespace MWGui
|
||||||
|
|
||||||
updatePlayerHealth();
|
updatePlayerHealth();
|
||||||
|
|
||||||
//TODO This bit gets repeated a few times; wrap it in a function
|
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
|
||||||
if (mCreationStage == CSE_ReviewNext)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
|
||||||
}
|
|
||||||
else if (mCreationStage >= CSE_ClassChosen)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mCreationStage = CSE_ClassChosen;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onPickClassDialogBack()
|
void CharacterCreation::onPickClassDialogBack()
|
||||||
|
@ -397,19 +384,7 @@ namespace MWGui
|
||||||
mNameDialog = 0;
|
mNameDialog = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
handleDialogDone(CSE_NameChosen, GM_Race);
|
||||||
if (mCreationStage == CSE_ReviewNext)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
|
||||||
}
|
|
||||||
else if (mCreationStage >= CSE_NameChosen)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Race);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mCreationStage = CSE_NameChosen;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onRaceDialogBack()
|
void CharacterCreation::onRaceDialogBack()
|
||||||
|
@ -456,19 +431,7 @@ namespace MWGui
|
||||||
|
|
||||||
updatePlayerHealth();
|
updatePlayerHealth();
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
handleDialogDone(CSE_RaceChosen, GM_Class);
|
||||||
if (mCreationStage == CSE_ReviewNext)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
|
||||||
}
|
|
||||||
else if (mCreationStage >= CSE_RaceChosen)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mCreationStage = CSE_RaceChosen;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
|
void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
|
||||||
|
@ -484,15 +447,7 @@ namespace MWGui
|
||||||
|
|
||||||
updatePlayerHealth();
|
updatePlayerHealth();
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
handleDialogDone(CSE_BirthSignChosen, GM_Review);
|
||||||
if (mCreationStage >= CSE_BirthSignChosen)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mCreationStage = CSE_BirthSignChosen;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onBirthSignDialogBack()
|
void CharacterCreation::onBirthSignDialogBack()
|
||||||
|
@ -543,19 +498,7 @@ namespace MWGui
|
||||||
|
|
||||||
updatePlayerHealth();
|
updatePlayerHealth();
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
||||||
if (mCreationStage == CSE_ReviewNext)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
|
||||||
}
|
|
||||||
else if (mCreationStage >= CSE_ClassChosen)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mCreationStage = CSE_ClassChosen;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterCreation::onCreateClassDialogBack()
|
void CharacterCreation::onCreateClassDialogBack()
|
||||||
|
@ -711,19 +654,7 @@ namespace MWGui
|
||||||
|
|
||||||
updatePlayerHealth();
|
updatePlayerHealth();
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
||||||
if (mCreationStage == CSE_ReviewNext)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
|
||||||
}
|
|
||||||
else if (mCreationStage >= CSE_ClassChosen)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mCreationStage = CSE_ClassChosen;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterCreation::~CharacterCreation()
|
CharacterCreation::~CharacterCreation()
|
||||||
|
@ -739,4 +670,20 @@ namespace MWGui
|
||||||
delete mReviewDialog;
|
delete mReviewDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CharacterCreation::handleDialogDone(CSE currentStage, int nextMode)
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||||
|
if (mCreationStage == CSE_ReviewNext)
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||||
|
}
|
||||||
|
else if (mCreationStage >= currentStage)
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->pushGuiMode((GuiMode)nextMode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCreationStage = currentStage;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,8 @@ namespace MWGui
|
||||||
};
|
};
|
||||||
|
|
||||||
CSE mCreationStage; // Which state the character creating is in, controls back/next/ok buttons
|
CSE mCreationStage; // Which state the character creating is in, controls back/next/ok buttons
|
||||||
|
|
||||||
|
void handleDialogDone(CSE currentStage, int nextMode);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ void CompanionWindow::updateEncumbranceBar()
|
||||||
return;
|
return;
|
||||||
float capacity = mPtr.getClass().getCapacity(mPtr);
|
float capacity = mPtr.getClass().getCapacity(mPtr);
|
||||||
float encumbrance = mPtr.getClass().getEncumbrance(mPtr);
|
float encumbrance = mPtr.getClass().getEncumbrance(mPtr);
|
||||||
mEncumbranceBar->setValue(encumbrance, capacity);
|
mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity));
|
||||||
|
|
||||||
if (mModel && mModel->hasProfit(mPtr))
|
if (mModel && mModel->hasProfit(mPtr))
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,8 +9,8 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
ControllerRepeatEvent::ControllerRepeatEvent() :
|
ControllerRepeatEvent::ControllerRepeatEvent() :
|
||||||
mInit(0.5),
|
mInit(0.5f),
|
||||||
mStep(0.1),
|
mStep(0.1f),
|
||||||
mEnabled(true),
|
mEnabled(true),
|
||||||
mTimeLeft(0)
|
mTimeLeft(0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,12 +7,14 @@
|
||||||
#include <MyGUI_ProgressBar.h>
|
#include <MyGUI_ProgressBar.h>
|
||||||
|
|
||||||
#include <components/widgets/list.hpp>
|
#include <components/widgets/list.hpp>
|
||||||
|
#include <components/translation/translation.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
|
||||||
|
@ -20,12 +22,7 @@
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
#include "../mwdialogue/dialoguemanagerimp.hpp"
|
|
||||||
|
|
||||||
#include "widgets.hpp"
|
#include "widgets.hpp"
|
||||||
#include "tradewindow.hpp"
|
|
||||||
#include "spellbuyingwindow.hpp"
|
|
||||||
#include "travelwindow.hpp"
|
|
||||||
#include "bookpage.hpp"
|
#include "bookpage.hpp"
|
||||||
|
|
||||||
#include "journalbooks.hpp" // to_utf8_span
|
#include "journalbooks.hpp" // to_utf8_span
|
||||||
|
@ -337,51 +334,25 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
if (topic == gmst.find("sPersuasion")->getString())
|
if (topic == gmst.find("sPersuasion")->getString())
|
||||||
{
|
|
||||||
mPersuasionDialog.setVisible(true);
|
mPersuasionDialog.setVisible(true);
|
||||||
}
|
|
||||||
else if (topic == gmst.find("sCompanionShare")->getString())
|
else if (topic == gmst.find("sCompanionShare")->getString())
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Companion);
|
|
||||||
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mPtr);
|
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mPtr);
|
||||||
}
|
|
||||||
else if (!MWBase::Environment::get().getDialogueManager()->checkServiceRefused())
|
else if (!MWBase::Environment::get().getDialogueManager()->checkServiceRefused())
|
||||||
{
|
{
|
||||||
if (topic == gmst.find("sBarter")->getString())
|
if (topic == gmst.find("sBarter")->getString())
|
||||||
{
|
MWBase::Environment::get().getWindowManager()->startTrade(mPtr);
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Barter);
|
|
||||||
MWBase::Environment::get().getWindowManager()->getTradeWindow()->startTrade(mPtr);
|
|
||||||
}
|
|
||||||
else if (topic == gmst.find("sSpells")->getString())
|
else if (topic == gmst.find("sSpells")->getString())
|
||||||
{
|
MWBase::Environment::get().getWindowManager()->startSpellBuying(mPtr);
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellBuying);
|
|
||||||
MWBase::Environment::get().getWindowManager()->getSpellBuyingWindow()->startSpellBuying(mPtr);
|
|
||||||
}
|
|
||||||
else if (topic == gmst.find("sTravel")->getString())
|
else if (topic == gmst.find("sTravel")->getString())
|
||||||
{
|
MWBase::Environment::get().getWindowManager()->startTravel(mPtr);
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Travel);
|
|
||||||
MWBase::Environment::get().getWindowManager()->getTravelWindow()->startTravel(mPtr);
|
|
||||||
}
|
|
||||||
else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
|
else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellCreation);
|
|
||||||
MWBase::Environment::get().getWindowManager()->startSpellMaking (mPtr);
|
MWBase::Environment::get().getWindowManager()->startSpellMaking (mPtr);
|
||||||
}
|
|
||||||
else if (topic == gmst.find("sEnchanting")->getString())
|
else if (topic == gmst.find("sEnchanting")->getString())
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting);
|
|
||||||
MWBase::Environment::get().getWindowManager()->startEnchanting (mPtr);
|
MWBase::Environment::get().getWindowManager()->startEnchanting (mPtr);
|
||||||
}
|
|
||||||
else if (topic == gmst.find("sServiceTrainingTitle")->getString())
|
else if (topic == gmst.find("sServiceTrainingTitle")->getString())
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Training);
|
|
||||||
MWBase::Environment::get().getWindowManager()->startTraining (mPtr);
|
MWBase::Environment::get().getWindowManager()->startTraining (mPtr);
|
||||||
}
|
|
||||||
else if (topic == gmst.find("sRepair")->getString())
|
else if (topic == gmst.find("sRepair")->getString())
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_MerchantRepair);
|
|
||||||
MWBase::Environment::get().getWindowManager()->startRepair (mPtr);
|
MWBase::Environment::get().getWindowManager()->startRepair (mPtr);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -440,8 +411,6 @@ namespace MWGui
|
||||||
bool isCompanion = !mPtr.getClass().getScript(mPtr).empty()
|
bool isCompanion = !mPtr.getClass().getScript(mPtr).empty()
|
||||||
&& mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion");
|
&& mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion");
|
||||||
|
|
||||||
bool anyService = mServices > 0 || isCompanion || mPtr.getTypeName() == typeid(ESM::NPC).name();
|
|
||||||
|
|
||||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
|
@ -472,7 +441,7 @@ namespace MWGui
|
||||||
if (isCompanion)
|
if (isCompanion)
|
||||||
mTopicsList->addItem(gmst.find("sCompanionShare")->getString());
|
mTopicsList->addItem(gmst.find("sCompanionShare")->getString());
|
||||||
|
|
||||||
if (anyService)
|
if (mTopicsList->getItemCount() > 0)
|
||||||
mTopicsList->addSeparator();
|
mTopicsList->addSeparator();
|
||||||
|
|
||||||
|
|
||||||
|
@ -549,7 +518,7 @@ namespace MWGui
|
||||||
size_t range = book->getSize().second - viewHeight;
|
size_t range = book->getSize().second - viewHeight;
|
||||||
mScrollBar->setScrollRange(range);
|
mScrollBar->setScrollRange(range);
|
||||||
mScrollBar->setScrollPosition(range-1);
|
mScrollBar->setScrollPosition(range-1);
|
||||||
mScrollBar->setTrackSize(viewHeight / static_cast<float>(book->getSize().second) * mScrollBar->getLineSize());
|
mScrollBar->setTrackSize(static_cast<int>(viewHeight / static_cast<float>(book->getSize().second) * mScrollBar->getLineSize()));
|
||||||
onScrollbarMoved(mScrollBar, range-1);
|
onScrollbarMoved(mScrollBar, range-1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -637,14 +606,14 @@ namespace MWGui
|
||||||
if (dispositionVisible && !dispositionWasVisible)
|
if (dispositionVisible && !dispositionWasVisible)
|
||||||
{
|
{
|
||||||
mDispositionBar->setVisible(true);
|
mDispositionBar->setVisible(true);
|
||||||
float offset = mDispositionBar->getHeight()+5;
|
int offset = mDispositionBar->getHeight()+5;
|
||||||
mTopicsList->setCoord(mTopicsList->getCoord() + MyGUI::IntCoord(0,offset,0,-offset));
|
mTopicsList->setCoord(mTopicsList->getCoord() + MyGUI::IntCoord(0,offset,0,-offset));
|
||||||
mTopicsList->adjustSize();
|
mTopicsList->adjustSize();
|
||||||
}
|
}
|
||||||
else if (!dispositionVisible && dispositionWasVisible)
|
else if (!dispositionVisible && dispositionWasVisible)
|
||||||
{
|
{
|
||||||
mDispositionBar->setVisible(false);
|
mDispositionBar->setVisible(false);
|
||||||
float offset = mDispositionBar->getHeight()+5;
|
int offset = mDispositionBar->getHeight()+5;
|
||||||
mTopicsList->setCoord(mTopicsList->getCoord() - MyGUI::IntCoord(0,offset,0,-offset));
|
mTopicsList->setCoord(mTopicsList->getCoord() - MyGUI::IntCoord(0,offset,0,-offset));
|
||||||
mTopicsList->adjustSize();
|
mTopicsList->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
|
||||||
#include "inventorywindow.hpp"
|
#include "inventorywindow.hpp"
|
||||||
#include "console.hpp"
|
|
||||||
#include "spellicons.hpp"
|
#include "spellicons.hpp"
|
||||||
#include "itemmodel.hpp"
|
#include "itemmodel.hpp"
|
||||||
#include "draganddrop.hpp"
|
#include "draganddrop.hpp"
|
||||||
|
@ -262,7 +261,7 @@ namespace MWGui
|
||||||
|
|
||||||
void HUD::setDrowningTimeLeft(float time, float maxTime)
|
void HUD::setDrowningTimeLeft(float time, float maxTime)
|
||||||
{
|
{
|
||||||
size_t progress = time/maxTime*200.0;
|
size_t progress = static_cast<size_t>(time / maxTime * 200);
|
||||||
mDrowning->setProgressPosition(progress);
|
mDrowning->setProgressPosition(progress);
|
||||||
|
|
||||||
bool isDrowning = (progress == 0);
|
bool isDrowning = (progress == 0);
|
||||||
|
@ -309,7 +308,7 @@ namespace MWGui
|
||||||
MWWorld::Ptr object = MWBase::Environment::get().getWorld()->getFacedObject();
|
MWWorld::Ptr object = MWBase::Environment::get().getWorld()->getFacedObject();
|
||||||
|
|
||||||
if (mode == GM_Console)
|
if (mode == GM_Console)
|
||||||
MWBase::Environment::get().getWindowManager()->getConsole()->setSelectedObject(object);
|
MWBase::Environment::get().getWindowManager()->setConsoleSelectedObject(object);
|
||||||
else if ((mode == GM_Container) || (mode == GM_Inventory))
|
else if ((mode == GM_Container) || (mode == GM_Inventory))
|
||||||
{
|
{
|
||||||
// pick up object
|
// pick up object
|
||||||
|
@ -631,7 +630,7 @@ namespace MWGui
|
||||||
mEnemyHealth->setProgressRange(100);
|
mEnemyHealth->setProgressRange(100);
|
||||||
// Health is usually cast to int before displaying. Actors die whenever they are < 1 health.
|
// Health is usually cast to int before displaying. Actors die whenever they are < 1 health.
|
||||||
// Therefore any value < 1 should show as an empty health bar. We do the same in statswindow :)
|
// Therefore any value < 1 should show as an empty health bar. We do the same in statswindow :)
|
||||||
mEnemyHealth->setProgressPosition(int(stats.getHealth().getCurrent()) / stats.getHealth().getModified() * 100);
|
mEnemyHealth->setProgressPosition(static_cast<size_t>(stats.getHealth().getCurrent() / stats.getHealth().getModified() * 100));
|
||||||
|
|
||||||
static const float fNPCHealthBarFade = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fNPCHealthBarFade")->getFloat();
|
static const float fNPCHealthBarFade = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fNPCHealthBarFade")->getFloat();
|
||||||
if (fNPCHealthBarFade > 0.f)
|
if (fNPCHealthBarFade > 0.f)
|
||||||
|
|
|
@ -23,9 +23,6 @@
|
||||||
#include "../mwbase/scriptmanager.hpp"
|
#include "../mwbase/scriptmanager.hpp"
|
||||||
#include "../mwrender/characterpreview.hpp"
|
#include "../mwrender/characterpreview.hpp"
|
||||||
|
|
||||||
#include "bookwindow.hpp"
|
|
||||||
#include "scrollwindow.hpp"
|
|
||||||
#include "spellwindow.hpp"
|
|
||||||
#include "itemview.hpp"
|
#include "itemview.hpp"
|
||||||
#include "inventoryitemmodel.hpp"
|
#include "inventoryitemmodel.hpp"
|
||||||
#include "sortfilteritemmodel.hpp"
|
#include "sortfilteritemmodel.hpp"
|
||||||
|
@ -101,7 +98,7 @@ namespace MWGui
|
||||||
void InventoryWindow::adjustPanes()
|
void InventoryWindow::adjustPanes()
|
||||||
{
|
{
|
||||||
const float aspect = 0.5; // fixed aspect ratio for the avatar image
|
const float aspect = 0.5; // fixed aspect ratio for the avatar image
|
||||||
float leftPaneWidth = (mMainWidget->getSize().height-44-mArmorRating->getHeight()) * aspect;
|
int leftPaneWidth = static_cast<int>((mMainWidget->getSize().height - 44 - mArmorRating->getHeight()) * aspect);
|
||||||
mLeftPane->setSize( leftPaneWidth, mMainWidget->getSize().height-44 );
|
mLeftPane->setSize( leftPaneWidth, mMainWidget->getSize().height-44 );
|
||||||
mRightPane->setCoord( mLeftPane->getPosition().left + leftPaneWidth + 4,
|
mRightPane->setCoord( mLeftPane->getPosition().left + leftPaneWidth + 4,
|
||||||
mRightPane->getPosition().top,
|
mRightPane->getPosition().top,
|
||||||
|
@ -153,10 +150,10 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
MyGUI::IntPoint pos (Settings::Manager::getFloat(setting + " x", "Windows") * viewSize.width,
|
MyGUI::IntPoint pos(static_cast<int>(Settings::Manager::getFloat(setting + " x", "Windows") * viewSize.width),
|
||||||
Settings::Manager::getFloat(setting + " y", "Windows") * viewSize.height);
|
static_cast<int>(Settings::Manager::getFloat(setting + " y", "Windows") * viewSize.height));
|
||||||
MyGUI::IntSize size (Settings::Manager::getFloat(setting + " w", "Windows") * viewSize.width,
|
MyGUI::IntSize size(static_cast<int>(Settings::Manager::getFloat(setting + " w", "Windows") * viewSize.width),
|
||||||
Settings::Manager::getFloat(setting + " h", "Windows") * viewSize.height);
|
static_cast<int>(Settings::Manager::getFloat(setting + " h", "Windows") * viewSize.height));
|
||||||
|
|
||||||
if (size.width != mMainWidget->getWidth() || size.height != mMainWidget->getHeight())
|
if (size.width != mMainWidget->getWidth() || size.height != mMainWidget->getHeight())
|
||||||
mPreviewResize = true;
|
mPreviewResize = true;
|
||||||
|
@ -317,8 +314,7 @@ namespace MWGui
|
||||||
|
|
||||||
void InventoryWindow::updateItemView()
|
void InventoryWindow::updateItemView()
|
||||||
{
|
{
|
||||||
if (MWBase::Environment::get().getWindowManager()->getSpellWindow())
|
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
|
||||||
MWBase::Environment::get().getWindowManager()->getSpellWindow()->updateSpells();
|
|
||||||
|
|
||||||
mItemView->update();
|
mItemView->update();
|
||||||
mPreviewDirty = true;
|
mPreviewDirty = true;
|
||||||
|
@ -432,13 +428,6 @@ namespace MWGui
|
||||||
|
|
||||||
action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||||
|
|
||||||
// this is necessary for books/scrolls: if they are already in the player's inventory,
|
|
||||||
// the "Take" button should not be visible.
|
|
||||||
// NOTE: the take button is "reset" when the window opens, so we can safely do the following
|
|
||||||
// without screwing up future book windows
|
|
||||||
MWBase::Environment::get().getWindowManager()->getBookWindow()->setTakeButtonShow(false);
|
|
||||||
MWBase::Environment::get().getWindowManager()->getScrollWindow()->setTakeButtonShow(false);
|
|
||||||
|
|
||||||
mSkippedToEquip = MWWorld::Ptr();
|
mSkippedToEquip = MWWorld::Ptr();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -519,7 +508,7 @@ namespace MWGui
|
||||||
float capacity = player.getClass().getCapacity(player);
|
float capacity = player.getClass().getCapacity(player);
|
||||||
float encumbrance = player.getClass().getEncumbrance(player);
|
float encumbrance = player.getClass().getEncumbrance(player);
|
||||||
mTradeModel->adjustEncumbrance(encumbrance);
|
mTradeModel->adjustEncumbrance(encumbrance);
|
||||||
mEncumbranceBar->setValue(encumbrance, capacity);
|
mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InventoryWindow::onFrame()
|
void InventoryWindow::onFrame()
|
||||||
|
@ -568,8 +557,7 @@ namespace MWGui
|
||||||
void InventoryWindow::notifyContentChanged()
|
void InventoryWindow::notifyContentChanged()
|
||||||
{
|
{
|
||||||
// update the spell window just in case new enchanted items were added to inventory
|
// update the spell window just in case new enchanted items were added to inventory
|
||||||
if (MWBase::Environment::get().getWindowManager()->getSpellWindow())
|
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
|
||||||
MWBase::Environment::get().getWindowManager()->getSpellWindow()->updateSpells();
|
|
||||||
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->updateMagicEffects(
|
MWBase::Environment::get().getMechanicsManager()->updateMagicEffects(
|
||||||
MWBase::Environment::get().getWorld()->getPlayerPtr());
|
MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||||
|
@ -626,8 +614,7 @@ namespace MWGui
|
||||||
|
|
||||||
MWBase::Environment::get().getMechanicsManager()->itemTaken(player, newObject, MWWorld::Ptr(), count);
|
MWBase::Environment::get().getMechanicsManager()->itemTaken(player, newObject, MWWorld::Ptr(), count);
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getSpellWindow())
|
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
|
||||||
MWBase::Environment::get().getWindowManager()->getSpellWindow()->updateSpells();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InventoryWindow::cycle(bool next)
|
void InventoryWindow::cycle(bool next)
|
||||||
|
|
|
@ -141,10 +141,10 @@ void ItemView::onSelectedBackground(MyGUI::Widget *sender)
|
||||||
|
|
||||||
void ItemView::onMouseWheel(MyGUI::Widget *_sender, int _rel)
|
void ItemView::onMouseWheel(MyGUI::Widget *_sender, int _rel)
|
||||||
{
|
{
|
||||||
if (mScrollView->getViewOffset().left + _rel*0.3 > 0)
|
if (mScrollView->getViewOffset().left + _rel*0.3f > 0)
|
||||||
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
|
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||||
else
|
else
|
||||||
mScrollView->setViewOffset(MyGUI::IntPoint(mScrollView->getViewOffset().left + _rel*0.3, 0));
|
mScrollView->setViewOffset(MyGUI::IntPoint(static_cast<int>(mScrollView->getViewOffset().left + _rel*0.3f), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemView::setSize(const MyGUI::IntSize &_value)
|
void ItemView::setSize(const MyGUI::IntSize &_value)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include <MyGUI_ScrollBar.h>
|
#include <MyGUI_ScrollBar.h>
|
||||||
|
|
||||||
|
#include <openengine/misc/rng.hpp>
|
||||||
|
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
@ -17,7 +19,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
JailScreen::JailScreen()
|
JailScreen::JailScreen()
|
||||||
: WindowBase("openmw_jail_screen.layout"),
|
: WindowBase("openmw_jail_screen.layout"),
|
||||||
mTimeAdvancer(0.01),
|
mTimeAdvancer(0.01f),
|
||||||
mDays(1),
|
mDays(1),
|
||||||
mFadeTimeRemaining(0)
|
mFadeTimeRemaining(0)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +68,7 @@ namespace MWGui
|
||||||
void JailScreen::onJailProgressChanged(int cur, int /*total*/)
|
void JailScreen::onJailProgressChanged(int cur, int /*total*/)
|
||||||
{
|
{
|
||||||
mProgressBar->setScrollPosition(0);
|
mProgressBar->setScrollPosition(0);
|
||||||
mProgressBar->setTrackSize(cur / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize());
|
mProgressBar->setTrackSize(static_cast<int>(cur / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void JailScreen::onJailFinished()
|
void JailScreen::onJailFinished()
|
||||||
|
@ -83,7 +85,7 @@ namespace MWGui
|
||||||
std::set<int> skills;
|
std::set<int> skills;
|
||||||
for (int day=0; day<mDays; ++day)
|
for (int day=0; day<mDays; ++day)
|
||||||
{
|
{
|
||||||
int skill = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * ESM::Skill::Length;
|
int skill = OEngine::Misc::Rng::rollDice(ESM::Skill::Length);
|
||||||
skills.insert(skill);
|
skills.insert(skill);
|
||||||
|
|
||||||
MWMechanics::SkillValue& value = player.getClass().getNpcStats(player).getSkill(skill);
|
MWMechanics::SkillValue& value = player.getClass().getNpcStats(player).getSkill(skill);
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include <MyGUI_Gui.h>
|
#include <MyGUI_Gui.h>
|
||||||
#include <MyGUI_TextBox.h>
|
#include <MyGUI_TextBox.h>
|
||||||
|
|
||||||
|
#include <openengine/misc/rng.hpp>
|
||||||
|
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
@ -33,8 +35,8 @@ namespace MWGui
|
||||||
: mSceneMgr(sceneMgr)
|
: mSceneMgr(sceneMgr)
|
||||||
, mWindow(rw)
|
, mWindow(rw)
|
||||||
, WindowBase("openmw_loading_screen.layout")
|
, WindowBase("openmw_loading_screen.layout")
|
||||||
, mLastRenderTime(0.f)
|
, mLastRenderTime(0)
|
||||||
, mLastWallpaperChangeTime(0.f)
|
, mLastWallpaperChangeTime(0)
|
||||||
, mProgress(0)
|
, mProgress(0)
|
||||||
, mVSyncWasEnabled(false)
|
, mVSyncWasEnabled(false)
|
||||||
{
|
{
|
||||||
|
@ -146,7 +148,7 @@ namespace MWGui
|
||||||
|
|
||||||
if (!mResources.empty())
|
if (!mResources.empty())
|
||||||
{
|
{
|
||||||
std::string const & randomSplash = mResources.at (rand() % mResources.size());
|
std::string const & randomSplash = mResources.at(OEngine::Misc::Rng::rollDice(mResources.size()));
|
||||||
|
|
||||||
Ogre::TextureManager::getSingleton ().load (randomSplash, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
|
Ogre::TextureManager::getSingleton ().load (randomSplash, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
|
||||||
|
|
||||||
|
@ -173,7 +175,7 @@ namespace MWGui
|
||||||
return;
|
return;
|
||||||
mProgress = value;
|
mProgress = value;
|
||||||
mProgressBar->setScrollPosition(0);
|
mProgressBar->setScrollPosition(0);
|
||||||
mProgressBar->setTrackSize(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize());
|
mProgressBar->setTrackSize(static_cast<int>(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize()));
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +184,7 @@ namespace MWGui
|
||||||
mProgressBar->setScrollPosition(0);
|
mProgressBar->setScrollPosition(0);
|
||||||
size_t value = mProgress + increase;
|
size_t value = mProgress + increase;
|
||||||
mProgress = value;
|
mProgress = value;
|
||||||
mProgressBar->setTrackSize(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize());
|
mProgressBar->setTrackSize(static_cast<int>(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize()));
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +195,7 @@ namespace MWGui
|
||||||
time = (time-2)*-1;
|
time = (time-2)*-1;
|
||||||
|
|
||||||
mProgressBar->setTrackSize(50);
|
mProgressBar->setTrackSize(50);
|
||||||
mProgressBar->setScrollPosition(time * (mProgressBar->getScrollRange()-1));
|
mProgressBar->setScrollPosition(static_cast<size_t>(time * (mProgressBar->getScrollRange() - 1)));
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -244,14 +244,14 @@ namespace MWGui
|
||||||
// Image space is -Y up, cells are Y up
|
// Image space is -Y up, cells are Y up
|
||||||
nY = 1 - (worldY - cellSize * cellY) / cellSize;
|
nY = 1 - (worldY - cellSize * cellY) / cellSize;
|
||||||
|
|
||||||
float cellDx = cellX - mCurX;
|
float cellDx = static_cast<float>(cellX - mCurX);
|
||||||
float cellDy = cellY - mCurY;
|
float cellDy = static_cast<float>(cellY - mCurY);
|
||||||
|
|
||||||
markerPos.cellX = cellX;
|
markerPos.cellX = cellX;
|
||||||
markerPos.cellY = cellY;
|
markerPos.cellY = cellY;
|
||||||
|
|
||||||
widgetPos = MyGUI::IntPoint(nX * mMapWidgetSize + (1+cellDx) * mMapWidgetSize,
|
widgetPos = MyGUI::IntPoint(static_cast<int>(nX * mMapWidgetSize + (1 + cellDx) * mMapWidgetSize),
|
||||||
nY * mMapWidgetSize - (cellDy-1) * mMapWidgetSize);
|
static_cast<int>(nY * mMapWidgetSize - (cellDy-1) * mMapWidgetSize));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -263,8 +263,8 @@ namespace MWGui
|
||||||
markerPos.cellY = cellY;
|
markerPos.cellY = cellY;
|
||||||
|
|
||||||
// Image space is -Y up, cells are Y up
|
// Image space is -Y up, cells are Y up
|
||||||
widgetPos = MyGUI::IntPoint(nX * mMapWidgetSize + (1+(cellX-mCurX)) * mMapWidgetSize,
|
widgetPos = MyGUI::IntPoint(static_cast<int>(nX * mMapWidgetSize + (1 + (cellX - mCurX)) * mMapWidgetSize),
|
||||||
nY * mMapWidgetSize + (1-(cellY-mCurY)) * mMapWidgetSize);
|
static_cast<int>(nY * mMapWidgetSize + (1-(cellY-mCurY)) * mMapWidgetSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
markerPos.nX = nX;
|
markerPos.nX = nX;
|
||||||
|
@ -309,8 +309,8 @@ namespace MWGui
|
||||||
markerWidget->setUserString("ToolTipType", "Layout");
|
markerWidget->setUserString("ToolTipType", "Layout");
|
||||||
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
||||||
markerWidget->setUserString("Caption_TextOneLine", MyGUI::TextIterator::toTagsString(marker.mNote));
|
markerWidget->setUserString("Caption_TextOneLine", MyGUI::TextIterator::toTagsString(marker.mNote));
|
||||||
markerWidget->setNormalColour(MyGUI::Colour(1.0,0.3,0.3));
|
markerWidget->setNormalColour(MyGUI::Colour(1.0f, 0.3f, 0.3f));
|
||||||
markerWidget->setHoverColour(MyGUI::Colour(1.0,0.5,0.5));
|
markerWidget->setHoverColour(MyGUI::Colour(1.0f, 0.5f, 0.5f));
|
||||||
markerWidget->setUserData(marker);
|
markerWidget->setUserData(marker);
|
||||||
markerWidget->setNeedMouseFocus(true);
|
markerWidget->setNeedMouseFocus(true);
|
||||||
customMarkerCreated(markerWidget);
|
customMarkerCreated(markerWidget);
|
||||||
|
@ -424,7 +424,7 @@ namespace MWGui
|
||||||
|
|
||||||
void LocalMapBase::setPlayerPos(int cellX, int cellY, const float nx, const float ny)
|
void LocalMapBase::setPlayerPos(int cellX, int cellY, const float nx, const float ny)
|
||||||
{
|
{
|
||||||
MyGUI::IntPoint pos(mMapWidgetSize+nx*mMapWidgetSize-16, mMapWidgetSize+ny*mMapWidgetSize-16);
|
MyGUI::IntPoint pos(static_cast<int>(mMapWidgetSize + nx*mMapWidgetSize - 16), static_cast<int>(mMapWidgetSize + ny*mMapWidgetSize - 16));
|
||||||
pos.left += (cellX - mCurX) * mMapWidgetSize;
|
pos.left += (cellX - mCurX) * mMapWidgetSize;
|
||||||
pos.top -= (cellY - mCurY) * mMapWidgetSize;
|
pos.top -= (cellY - mCurY) * mMapWidgetSize;
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ namespace MWGui
|
||||||
mCompass->setPosition(pos);
|
mCompass->setPosition(pos);
|
||||||
MyGUI::IntPoint middle (pos.left+16, pos.top+16);
|
MyGUI::IntPoint middle (pos.left+16, pos.top+16);
|
||||||
MyGUI::IntCoord viewsize = mLocalMap->getCoord();
|
MyGUI::IntCoord viewsize = mLocalMap->getCoord();
|
||||||
MyGUI::IntPoint viewOffset(0.5*viewsize.width - middle.left, 0.5*viewsize.height - middle.top);
|
MyGUI::IntPoint viewOffset((viewsize.width / 2) - middle.left, (viewsize.height / 2) - middle.top);
|
||||||
mLocalMap->setViewOffset(viewOffset);
|
mLocalMap->setViewOffset(viewOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -668,7 +668,7 @@ namespace MWGui
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
worldPos.x = (x + nX) * cellSize;
|
worldPos.x = (x + nX) * cellSize;
|
||||||
worldPos.y = (y + (1.0-nY)) * cellSize;
|
worldPos.y = (y + (1.0f-nY)) * cellSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
mEditingMarker.mWorldX = worldPos.x;
|
mEditingMarker.mWorldX = worldPos.x;
|
||||||
|
@ -737,8 +737,8 @@ namespace MWGui
|
||||||
int markerSize = 12;
|
int markerSize = 12;
|
||||||
int offset = mGlobalMapRender->getCellSize()/2 - markerSize/2;
|
int offset = mGlobalMapRender->getCellSize()/2 - markerSize/2;
|
||||||
MyGUI::IntCoord widgetCoord(
|
MyGUI::IntCoord widgetCoord(
|
||||||
worldX * mGlobalMapRender->getWidth()+offset,
|
static_cast<int>(worldX * mGlobalMapRender->getWidth()+offset),
|
||||||
worldY * mGlobalMapRender->getHeight()+offset,
|
static_cast<int>(worldY * mGlobalMapRender->getHeight() + offset),
|
||||||
markerSize, markerSize);
|
markerSize, markerSize);
|
||||||
|
|
||||||
MyGUI::Widget* markerWidget = mGlobalMap->createWidget<MyGUI::Widget>("MarkerButton",
|
MyGUI::Widget* markerWidget = mGlobalMap->createWidget<MyGUI::Widget>("MarkerButton",
|
||||||
|
@ -827,18 +827,7 @@ namespace MWGui
|
||||||
if (MWBase::Environment::get().getWorld ()->isCellExterior ())
|
if (MWBase::Environment::get().getWorld ()->isCellExterior ())
|
||||||
{
|
{
|
||||||
Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedPosition ();
|
Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedPosition ();
|
||||||
|
setGlobalMapPlayerPosition(pos.x, pos.y);
|
||||||
float worldX, worldY;
|
|
||||||
mGlobalMapRender->worldPosToImageSpace (pos.x, pos.y, worldX, worldY);
|
|
||||||
worldX *= mGlobalMapRender->getWidth();
|
|
||||||
worldY *= mGlobalMapRender->getHeight();
|
|
||||||
|
|
||||||
mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(worldX - 16, worldY - 16));
|
|
||||||
|
|
||||||
// set the view offset so that player is in the center
|
|
||||||
MyGUI::IntSize viewsize = mGlobalMap->getSize();
|
|
||||||
MyGUI::IntPoint viewoffs(0.5*viewsize.width - worldX, 0.5*viewsize.height - worldY);
|
|
||||||
mGlobalMap->setViewOffset(viewoffs);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -854,11 +843,11 @@ namespace MWGui
|
||||||
x *= mGlobalMapRender->getWidth();
|
x *= mGlobalMapRender->getWidth();
|
||||||
y *= mGlobalMapRender->getHeight();
|
y *= mGlobalMapRender->getHeight();
|
||||||
|
|
||||||
mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(x - 16, y - 16));
|
mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(static_cast<int>(x - 16), static_cast<int>(y - 16)));
|
||||||
|
|
||||||
// set the view offset so that player is in the center
|
// set the view offset so that player is in the center
|
||||||
MyGUI::IntSize viewsize = mGlobalMap->getSize();
|
MyGUI::IntSize viewsize = mGlobalMap->getSize();
|
||||||
MyGUI::IntPoint viewoffs(0.5*viewsize.width - x, 0.5*viewsize.height - y);
|
MyGUI::IntPoint viewoffs(static_cast<int>(viewsize.width * 0.5f - x), static_cast<int>(viewsize.height *0.5 - y));
|
||||||
mGlobalMap->setViewOffset(viewoffs);
|
mGlobalMap->setViewOffset(viewoffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,11 +59,11 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
||||||
float fRepairMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
float fRepairMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
||||||
.find("fRepairMult")->getFloat();
|
.find("fRepairMult")->getFloat();
|
||||||
|
|
||||||
float p = std::max(1, basePrice);
|
float p = static_cast<float>(std::max(1, basePrice));
|
||||||
float r = std::max(1, static_cast<int>(maxDurability / p));
|
float r = static_cast<float>(std::max(1, static_cast<int>(maxDurability / p)));
|
||||||
|
|
||||||
int x = ((maxDurability - durability) / r);
|
int x = static_cast<int>((maxDurability - durability) / r);
|
||||||
x = (fRepairMult * x);
|
x = static_cast<int>(fRepairMult * x);
|
||||||
|
|
||||||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mActor, x, true);
|
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mActor, x, true);
|
||||||
|
|
||||||
|
@ -105,10 +105,10 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
||||||
|
|
||||||
void MerchantRepair::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
void MerchantRepair::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||||
{
|
{
|
||||||
if (mList->getViewOffset().top + _rel*0.3 > 0)
|
if (mList->getViewOffset().top + _rel*0.3f > 0)
|
||||||
mList->setViewOffset(MyGUI::IntPoint(0, 0));
|
mList->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||||
else
|
else
|
||||||
mList->setViewOffset(MyGUI::IntPoint(0, mList->getViewOffset().top + _rel*0.3));
|
mList->setViewOffset(MyGUI::IntPoint(0, static_cast<int>(mList->getViewOffset().top + _rel*0.3f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MerchantRepair::open()
|
void MerchantRepair::open()
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace MWGui
|
||||||
it = mMessageBoxes.begin();
|
it = mMessageBoxes.begin();
|
||||||
while(it != mMessageBoxes.end())
|
while(it != mMessageBoxes.end())
|
||||||
{
|
{
|
||||||
(*it)->update(height);
|
(*it)->update(static_cast<int>(height));
|
||||||
height += (*it)->getHeight();
|
height += (*it)->getHeight();
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "pickpocketitemmodel.hpp"
|
#include "pickpocketitemmodel.hpp"
|
||||||
|
|
||||||
|
#include <openengine/misc/rng.hpp>
|
||||||
|
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
|
@ -12,11 +14,13 @@ namespace MWGui
|
||||||
int chance = thief.getClass().getSkill(thief, ESM::Skill::Sneak);
|
int chance = thief.getClass().getSkill(thief, ESM::Skill::Sneak);
|
||||||
|
|
||||||
mSourceModel->update();
|
mSourceModel->update();
|
||||||
|
|
||||||
|
// build list of items that player is unable to find when attempts to pickpocket.
|
||||||
if (hideItems)
|
if (hideItems)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i<mSourceModel->getItemCount(); ++i)
|
for (size_t i = 0; i<mSourceModel->getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
if (std::rand() / static_cast<float>(RAND_MAX) * 100 > chance)
|
if (chance <= OEngine::Misc::Rng::roll0to99())
|
||||||
mHiddenItems.push_back(mSourceModel->getItem(i));
|
mHiddenItems.push_back(mSourceModel->getItem(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,12 +94,24 @@ namespace MWGui
|
||||||
while (key->getChildCount()) // Destroy number label
|
while (key->getChildCount()) // Destroy number label
|
||||||
MyGUI::Gui::getInstance().destroyWidget(key->getChildAt(0));
|
MyGUI::Gui::getInstance().destroyWidget(key->getChildAt(0));
|
||||||
|
|
||||||
mAssigned[index] = Type_Unassigned;
|
if (index == 9)
|
||||||
|
{
|
||||||
|
mAssigned[index] = Type_HandToHand;
|
||||||
|
|
||||||
MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);
|
MyGUI::ImageBox* image = key->createWidget<MyGUI::ImageBox>("ImageBox",
|
||||||
textBox->setTextAlign (MyGUI::Align::Center);
|
MyGUI::IntCoord(14, 13, 32, 32), MyGUI::Align::Default);
|
||||||
textBox->setCaption (MyGUI::utility::toString(index+1));
|
image->setImageTexture("icons\\k\\stealth_handtohand.dds");
|
||||||
textBox->setNeedMouseFocus (false);
|
image->setNeedMouseFocus(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mAssigned[index] = Type_Unassigned;
|
||||||
|
|
||||||
|
MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);
|
||||||
|
textBox->setTextAlign (MyGUI::Align::Center);
|
||||||
|
textBox->setCaption (MyGUI::utility::toString(index+1));
|
||||||
|
textBox->setNeedMouseFocus (false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickKeysMenu::onQuickKeyButtonClicked(MyGUI::Widget* sender)
|
void QuickKeysMenu::onQuickKeyButtonClicked(MyGUI::Widget* sender)
|
||||||
|
@ -338,6 +350,11 @@ namespace MWGui
|
||||||
store.setSelectedEnchantItem(it);
|
store.setSelectedEnchantItem(it);
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Spell);
|
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Spell);
|
||||||
}
|
}
|
||||||
|
else if (type == Type_HandToHand)
|
||||||
|
{
|
||||||
|
store.unequipSlot(MWWorld::InventoryStore::Slot_CarriedRight, player);
|
||||||
|
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Weapon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------------
|
||||||
|
@ -409,6 +426,7 @@ namespace MWGui
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case Type_Unassigned:
|
case Type_Unassigned:
|
||||||
|
case Type_HandToHand:
|
||||||
break;
|
break;
|
||||||
case Type_Item:
|
case Type_Item:
|
||||||
case Type_MagicItem:
|
case Type_MagicItem:
|
||||||
|
@ -489,6 +507,7 @@ namespace MWGui
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Type_Unassigned:
|
case Type_Unassigned:
|
||||||
|
case Type_HandToHand:
|
||||||
unassign(button, i);
|
unassign(button, i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,15 +37,16 @@ namespace MWGui
|
||||||
|
|
||||||
void activateQuickKey(int index);
|
void activateQuickKey(int index);
|
||||||
|
|
||||||
|
/// @note This enum is serialized, so don't move the items around!
|
||||||
enum QuickKeyType
|
enum QuickKeyType
|
||||||
{
|
{
|
||||||
Type_Item,
|
Type_Item,
|
||||||
Type_Magic,
|
Type_Magic,
|
||||||
Type_MagicItem,
|
Type_MagicItem,
|
||||||
Type_Unassigned
|
Type_Unassigned,
|
||||||
|
Type_HandToHand
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void write (ESM::ESMWriter& writer);
|
void write (ESM::ESMWriter& writer);
|
||||||
void readRecord (ESM::ESMReader& reader, uint32_t type);
|
void readRecord (ESM::ESMReader& reader, uint32_t type);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
|
@ -203,7 +203,7 @@ namespace MWGui
|
||||||
|
|
||||||
void RaceDialog::onHeadRotate(MyGUI::ScrollBar* scroll, size_t _position)
|
void RaceDialog::onHeadRotate(MyGUI::ScrollBar* scroll, size_t _position)
|
||||||
{
|
{
|
||||||
float angle = (float(_position) / (scroll->getScrollRange()-1) - 0.5) * 3.14 * 2;
|
float angle = (float(_position) / (scroll->getScrollRange()-1) - 0.5f) * 3.14f * 2;
|
||||||
mPreview->update (angle);
|
mPreview->update (angle);
|
||||||
mPreviewDirty = true;
|
mPreviewDirty = true;
|
||||||
mCurrentAngle = angle;
|
mCurrentAngle = angle;
|
||||||
|
@ -404,7 +404,7 @@ namespace MWGui
|
||||||
skillWidget = mSkillList->createWidget<Widgets::MWSkill>("MW_StatNameValue", coord1, MyGUI::Align::Default,
|
skillWidget = mSkillList->createWidget<Widgets::MWSkill>("MW_StatNameValue", coord1, MyGUI::Align::Default,
|
||||||
std::string("Skill") + MyGUI::utility::toString(i));
|
std::string("Skill") + MyGUI::utility::toString(i));
|
||||||
skillWidget->setSkillNumber(skillId);
|
skillWidget->setSkillNumber(skillId);
|
||||||
skillWidget->setSkillValue(Widgets::MWSkill::SkillValue(race->mData.mBonus[i].mBonus));
|
skillWidget->setSkillValue(Widgets::MWSkill::SkillValue(static_cast<float>(race->mData.mBonus[i].mBonus)));
|
||||||
ToolTips::createSkillToolTip(skillWidget, skillId);
|
ToolTips::createSkillToolTip(skillWidget, skillId);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include <MyGUI_ScrollView.h>
|
#include <MyGUI_ScrollView.h>
|
||||||
#include <MyGUI_Gui.h>
|
#include <MyGUI_Gui.h>
|
||||||
|
|
||||||
|
#include <openengine/misc/rng.hpp>
|
||||||
|
|
||||||
#include <components/esm/records.hpp>
|
#include <components/esm/records.hpp>
|
||||||
|
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
@ -119,7 +121,7 @@ void Recharge::updateView()
|
||||||
|
|
||||||
Widgets::MWDynamicStatPtr chargeWidget = mView->createWidget<Widgets::MWDynamicStat>
|
Widgets::MWDynamicStatPtr chargeWidget = mView->createWidget<Widgets::MWDynamicStat>
|
||||||
("MW_ChargeBar", MyGUI::IntCoord(72, currentY+2, 199, 20), MyGUI::Align::Default);
|
("MW_ChargeBar", MyGUI::IntCoord(72, currentY+2, 199, 20), MyGUI::Align::Default);
|
||||||
chargeWidget->setValue(iter->getCellRef().getEnchantmentCharge(), enchantment->mData.mCharge);
|
chargeWidget->setValue(static_cast<int>(iter->getCellRef().getEnchantmentCharge()), enchantment->mData.mCharge);
|
||||||
chargeWidget->setNeedMouseFocus(false);
|
chargeWidget->setNeedMouseFocus(false);
|
||||||
|
|
||||||
currentY += 32 + 4;
|
currentY += 32 + 4;
|
||||||
|
@ -149,11 +151,11 @@ void Recharge::onItemClicked(MyGUI::Widget *sender)
|
||||||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||||
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player);
|
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player);
|
||||||
|
|
||||||
float luckTerm = 0.1 * stats.getAttribute(ESM::Attribute::Luck).getModified();
|
float luckTerm = 0.1f * stats.getAttribute(ESM::Attribute::Luck).getModified();
|
||||||
if (luckTerm < 1|| luckTerm > 10)
|
if (luckTerm < 1|| luckTerm > 10)
|
||||||
luckTerm = 1;
|
luckTerm = 1;
|
||||||
|
|
||||||
float intelligenceTerm = 0.2 * stats.getAttribute(ESM::Attribute::Intelligence).getModified();
|
float intelligenceTerm = 0.2f * stats.getAttribute(ESM::Attribute::Intelligence).getModified();
|
||||||
|
|
||||||
if (intelligenceTerm > 20)
|
if (intelligenceTerm > 20)
|
||||||
intelligenceTerm = 20;
|
intelligenceTerm = 20;
|
||||||
|
@ -161,7 +163,7 @@ void Recharge::onItemClicked(MyGUI::Widget *sender)
|
||||||
intelligenceTerm = 1;
|
intelligenceTerm = 1;
|
||||||
|
|
||||||
float x = (npcStats.getSkill(ESM::Skill::Enchant).getModified() + intelligenceTerm + luckTerm) * stats.getFatigueTerm();
|
float x = (npcStats.getSkill(ESM::Skill::Enchant).getModified() + intelligenceTerm + luckTerm) * stats.getFatigueTerm();
|
||||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
int roll = OEngine::Misc::Rng::roll0to99();
|
||||||
if (roll < x)
|
if (roll < x)
|
||||||
{
|
{
|
||||||
std::string soul = gem.getCellRef().getSoul();
|
std::string soul = gem.getCellRef().getSoul();
|
||||||
|
@ -197,10 +199,10 @@ void Recharge::onItemClicked(MyGUI::Widget *sender)
|
||||||
|
|
||||||
void Recharge::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
void Recharge::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||||
{
|
{
|
||||||
if (mView->getViewOffset().top + _rel*0.3 > 0)
|
if (mView->getViewOffset().top + _rel*0.3f > 0)
|
||||||
mView->setViewOffset(MyGUI::IntPoint(0, 0));
|
mView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||||
else
|
else
|
||||||
mView->setViewOffset(MyGUI::IntPoint(0, mView->getViewOffset().top + _rel*0.3));
|
mView->setViewOffset(MyGUI::IntPoint(0, static_cast<int>(mView->getViewOffset().top + _rel*0.3f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,10 +150,10 @@ void Repair::onRepairItem(MyGUI::Widget *sender)
|
||||||
|
|
||||||
void Repair::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
void Repair::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||||
{
|
{
|
||||||
if (mRepairView->getViewOffset().top + _rel*0.3 > 0)
|
if (mRepairView->getViewOffset().top + _rel*0.3f > 0)
|
||||||
mRepairView->setViewOffset(MyGUI::IntPoint(0, 0));
|
mRepairView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||||
else
|
else
|
||||||
mRepairView->setViewOffset(MyGUI::IntPoint(0, mRepairView->getViewOffset().top + _rel*0.3));
|
mRepairView->setViewOffset(MyGUI::IntPoint(0, static_cast<int>(mRepairView->getViewOffset().top + _rel*0.3f)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,21 +146,21 @@ namespace MWGui
|
||||||
|
|
||||||
void ReviewDialog::setHealth(const MWMechanics::DynamicStat<float>& value)
|
void ReviewDialog::setHealth(const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
mHealth->setValue(value.getCurrent(), value.getModified());
|
mHealth->setValue(static_cast<int>(value.getCurrent()), static_cast<int>(value.getModified()));
|
||||||
std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
|
std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
|
||||||
mHealth->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
|
mHealth->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReviewDialog::setMagicka(const MWMechanics::DynamicStat<float>& value)
|
void ReviewDialog::setMagicka(const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
mMagicka->setValue(value.getCurrent(), value.getModified());
|
mMagicka->setValue(static_cast<int>(value.getCurrent()), static_cast<int>(value.getModified()));
|
||||||
std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
|
std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
|
||||||
mMagicka->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
|
mMagicka->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReviewDialog::setFatigue(const MWMechanics::DynamicStat<float>& value)
|
void ReviewDialog::setFatigue(const MWMechanics::DynamicStat<float>& value)
|
||||||
{
|
{
|
||||||
mFatigue->setValue(value.getCurrent(), value.getModified());
|
mFatigue->setValue(static_cast<int>(value.getCurrent()), static_cast<int>(value.getModified()));
|
||||||
std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
|
std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
|
||||||
mFatigue->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
|
mFatigue->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ namespace MWGui
|
||||||
MyGUI::TextBox* widget = mSkillWidgetMap[skillId];
|
MyGUI::TextBox* widget = mSkillWidgetMap[skillId];
|
||||||
if (widget)
|
if (widget)
|
||||||
{
|
{
|
||||||
float modified = value.getModified(), base = value.getBase();
|
float modified = static_cast<float>(value.getModified()), base = static_cast<float>(value.getBase());
|
||||||
std::string text = MyGUI::utility::toString(std::floor(modified));
|
std::string text = MyGUI::utility::toString(std::floor(modified));
|
||||||
std::string state = "normal";
|
std::string state = "normal";
|
||||||
if (modified > base)
|
if (modified > base)
|
||||||
|
@ -376,7 +376,7 @@ namespace MWGui
|
||||||
if (mSkillView->getViewOffset().top + _rel*0.3 > 0)
|
if (mSkillView->getViewOffset().top + _rel*0.3 > 0)
|
||||||
mSkillView->setViewOffset(MyGUI::IntPoint(0, 0));
|
mSkillView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||||
else
|
else
|
||||||
mSkillView->setViewOffset(MyGUI::IntPoint(0, mSkillView->getViewOffset().top + _rel*0.3));
|
mSkillView->setViewOffset(MyGUI::IntPoint(0, static_cast<int>(mSkillView->getViewOffset().top + _rel*0.3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
namespace MWState
|
namespace MWState
|
||||||
{
|
{
|
||||||
class Character;
|
class Character;
|
||||||
class Slot;
|
struct Slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace MWGui
|
||||||
center();
|
center();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollWindow::open (MWWorld::Ptr scroll)
|
void ScrollWindow::open (MWWorld::Ptr scroll, bool showTakeButton)
|
||||||
{
|
{
|
||||||
// no 3d sounds because the object could be in a container.
|
// no 3d sounds because the object could be in a container.
|
||||||
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0);
|
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0);
|
||||||
|
@ -71,7 +71,7 @@ namespace MWGui
|
||||||
|
|
||||||
mTextView->setViewOffset(MyGUI::IntPoint(0,0));
|
mTextView->setViewOffset(MyGUI::IntPoint(0,0));
|
||||||
|
|
||||||
setTakeButtonShow(true);
|
setTakeButtonShow(showTakeButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollWindow::exit()
|
void ScrollWindow::exit()
|
||||||
|
|
|
@ -17,14 +17,14 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
ScrollWindow ();
|
ScrollWindow ();
|
||||||
|
|
||||||
void open (MWWorld::Ptr scroll);
|
void open (MWWorld::Ptr scroll, bool showTakeButton);
|
||||||
virtual void exit();
|
virtual void exit();
|
||||||
void setTakeButtonShow(bool show);
|
|
||||||
void setInventoryAllowed(bool allowed);
|
void setInventoryAllowed(bool allowed);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onCloseButtonClicked (MyGUI::Widget* _sender);
|
void onCloseButtonClicked (MyGUI::Widget* _sender);
|
||||||
void onTakeButtonClicked (MyGUI::Widget* _sender);
|
void onTakeButtonClicked (MyGUI::Widget* _sender);
|
||||||
|
void setTakeButtonShow(bool show);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Gui::ImageButton* mCloseButton;
|
Gui::ImageButton* mCloseButton;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue