forked from teamnwah/openmw-tes3coop
Merge branch 'master' into c++11
Conflicts: apps/openmw/mwworld/store.hpp
This commit is contained in:
commit
c5ae95aedd
38 changed files with 1746 additions and 1236 deletions
|
@ -10,9 +10,10 @@ fi
|
||||||
|
|
||||||
echo "yes" | sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
|
echo "yes" | sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
|
||||||
echo "yes" | sudo apt-add-repository ppa:openmw/openmw
|
echo "yes" | sudo apt-add-repository ppa:openmw/openmw
|
||||||
|
echo "yes" | sudo apt-add-repository ppa:boost-latest/ppa
|
||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
sudo apt-get install -qq libgtest-dev google-mock
|
sudo apt-get install -qq libgtest-dev google-mock
|
||||||
sudo apt-get install -qq libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev
|
sudo apt-get install -qq libboost-filesystem1.55-dev libboost-program-options1.55-dev libboost-system1.55-dev libboost-thread1.55-dev
|
||||||
sudo apt-get install -qq libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavresample-dev
|
sudo apt-get install -qq libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavresample-dev
|
||||||
sudo apt-get install -qq libbullet-dev libopenscenegraph-dev libmygui-dev libsdl2-dev libunshield-dev libtinyxml-dev libopenal-dev libqt4-dev
|
sudo apt-get install -qq libbullet-dev libopenscenegraph-dev libmygui-dev libsdl2-dev libunshield-dev libtinyxml-dev libopenal-dev libqt4-dev
|
||||||
sudo apt-get install -qq cmake-data #workaround for broken osgqt cmake script in ubuntu 12.04
|
sudo apt-get install -qq cmake-data #workaround for broken osgqt cmake script in ubuntu 12.04
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "convertplayer.hpp"
|
#include "convertplayer.hpp"
|
||||||
|
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
namespace ESSImport
|
namespace ESSImport
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -276,11 +276,11 @@ void CSVWorld::ScriptEdit::lineNumberAreaPaintEvent(QPaintEvent *event)
|
||||||
if(textCursor().hasSelection())
|
if(textCursor().hasSelection())
|
||||||
{
|
{
|
||||||
QString str = textCursor().selection().toPlainText();
|
QString str = textCursor().selection().toPlainText();
|
||||||
int selectedLines = str.count("\n")+1;
|
int offset = str.count("\n");
|
||||||
if(textCursor().position() < textCursor().anchor())
|
if(textCursor().position() < textCursor().anchor())
|
||||||
endBlock += selectedLines;
|
endBlock += offset;
|
||||||
else
|
else
|
||||||
startBlock -= selectedLines;
|
startBlock -= offset;
|
||||||
}
|
}
|
||||||
painter.setBackgroundMode(Qt::OpaqueMode);
|
painter.setBackgroundMode(Qt::OpaqueMode);
|
||||||
QFont font = painter.font();
|
QFont font = painter.font();
|
||||||
|
|
|
@ -14,7 +14,9 @@
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// For OutputDebugString
|
// For OutputDebugString
|
||||||
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
// makes __argc and __argv available on windows
|
// makes __argc and __argv available on windows
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include <components/esm/loaddial.hpp>
|
#include <components/esm/loaddial.hpp>
|
||||||
#include <components/esm/loadinfo.hpp>
|
#include <components/esm/loadinfo.hpp>
|
||||||
#include <components/esm/dialoguestate.hpp>
|
#include <components/esm/dialoguestate.hpp>
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
|
|
||||||
#include <components/compiler/exception.hpp>
|
#include <components/compiler/exception.hpp>
|
||||||
#include <components/compiler/errorhandler.hpp>
|
#include <components/compiler/errorhandler.hpp>
|
||||||
|
|
|
@ -10,10 +10,14 @@
|
||||||
|
|
||||||
#include <osg/Texture2D>
|
#include <osg/Texture2D>
|
||||||
|
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
#include <components/myguiplatform/myguitexture.hpp>
|
#include <components/myguiplatform/myguitexture.hpp>
|
||||||
|
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <MyGUI_FactoryManager.h>
|
#include <MyGUI_FactoryManager.h>
|
||||||
|
|
||||||
#include <components/esm/globalmap.hpp>
|
#include <components/esm/globalmap.hpp>
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
#include <components/myguiplatform/myguitexture.hpp>
|
#include <components/myguiplatform/myguitexture.hpp>
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <MyGUI_Gui.h>
|
#include <MyGUI_Gui.h>
|
||||||
#include <MyGUI_ImageBox.h>
|
#include <MyGUI_ImageBox.h>
|
||||||
|
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
#include <components/esm/quickkeys.hpp>
|
#include <components/esm/quickkeys.hpp>
|
||||||
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
|
|
||||||
#include <components/sdlutil/sdlcursormanager.hpp>
|
#include <components/sdlutil/sdlcursormanager.hpp>
|
||||||
|
|
||||||
|
#include <components/esm/esmreader.hpp>
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
|
|
||||||
#include <components/fontloader/fontloader.hpp>
|
#include <components/fontloader/fontloader.hpp>
|
||||||
|
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
|
|
||||||
#include <osg/PositionAttitudeTransform>
|
#include <osg/PositionAttitudeTransform>
|
||||||
|
|
||||||
|
#include <components/esm/esmreader.hpp>
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
#include <components/esm/loadnpc.hpp>
|
#include <components/esm/loadnpc.hpp>
|
||||||
|
#include <components/esm/esmreader.hpp>
|
||||||
|
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#include "aiwander.hpp"
|
#include "aiwander.hpp"
|
||||||
|
|
||||||
|
#include <cfloat>
|
||||||
|
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
|
|
||||||
#include <components/esm/aisequence.hpp>
|
#include <components/esm/aisequence.hpp>
|
||||||
|
@ -28,6 +30,12 @@ namespace MWMechanics
|
||||||
static const int GREETING_SHOULD_START = 4; //how many reaction intervals should pass before NPC can greet player
|
static const int GREETING_SHOULD_START = 4; //how many reaction intervals should pass before NPC can greet player
|
||||||
static const int GREETING_SHOULD_END = 10;
|
static const int GREETING_SHOULD_END = 10;
|
||||||
|
|
||||||
|
// to prevent overcrowding
|
||||||
|
static const int DESTINATION_TOLERANCE = 64;
|
||||||
|
|
||||||
|
// distance must be long enough that NPC will need to move to get there.
|
||||||
|
static const int MINIMUM_WANDER_DISTANCE = DESTINATION_TOLERANCE * 2;
|
||||||
|
|
||||||
const std::string AiWander::sIdleSelectToGroupName[GroupIndex_MaxIdle - GroupIndex_MinIdle + 1] =
|
const std::string AiWander::sIdleSelectToGroupName[GroupIndex_MaxIdle - GroupIndex_MinIdle + 1] =
|
||||||
{
|
{
|
||||||
std::string("idle2"),
|
std::string("idle2"),
|
||||||
|
@ -214,7 +222,7 @@ namespace MWMechanics
|
||||||
// Are we there yet?
|
// Are we there yet?
|
||||||
bool& chooseAction = storage.mChooseAction;
|
bool& chooseAction = storage.mChooseAction;
|
||||||
if(walking &&
|
if(walking &&
|
||||||
storage.mPathFinder.checkPathCompleted(pos.pos[0], pos.pos[1], 64.f))
|
storage.mPathFinder.checkPathCompleted(pos.pos[0], pos.pos[1], DESTINATION_TOLERANCE))
|
||||||
{
|
{
|
||||||
stopWalking(actor, storage);
|
stopWalking(actor, storage);
|
||||||
moveNow = false;
|
moveNow = false;
|
||||||
|
@ -498,14 +506,8 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
assert(mAllowedNodes.size());
|
assert(mAllowedNodes.size());
|
||||||
unsigned int randNode = Misc::Rng::rollDice(mAllowedNodes.size());
|
unsigned int randNode = Misc::Rng::rollDice(mAllowedNodes.size());
|
||||||
// NOTE: initially constructed with local (i.e. cell) co-ordinates
|
|
||||||
// convert dest to use world co-ordinates
|
|
||||||
ESM::Pathgrid::Point dest(mAllowedNodes[randNode]);
|
ESM::Pathgrid::Point dest(mAllowedNodes[randNode]);
|
||||||
if (currentCell->getCell()->isExterior())
|
ToWorldCoordinates(dest, currentCell->getCell());
|
||||||
{
|
|
||||||
dest.mX += currentCell->getCell()->mData.mX * ESM::Land::REAL_SIZE;
|
|
||||||
dest.mY += currentCell->getCell()->mData.mY * ESM::Land::REAL_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// actor position is already in world co-ordinates
|
// actor position is already in world co-ordinates
|
||||||
ESM::Pathgrid::Point start(PathFinder::MakePathgridPoint(pos));
|
ESM::Pathgrid::Point start(PathFinder::MakePathgridPoint(pos));
|
||||||
|
@ -537,6 +539,15 @@ namespace MWMechanics
|
||||||
return false; // AiWander package not yet completed
|
return false; // AiWander package not yet completed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AiWander::ToWorldCoordinates(ESM::Pathgrid::Point& point, const ESM::Cell * cell)
|
||||||
|
{
|
||||||
|
if (cell->isExterior())
|
||||||
|
{
|
||||||
|
point.mX += cell->mData.mX * ESM::Land::REAL_SIZE;
|
||||||
|
point.mY += cell->mData.mY * ESM::Land::REAL_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AiWander::trimAllowedNodes(std::vector<ESM::Pathgrid::Point>& nodes,
|
void AiWander::trimAllowedNodes(std::vector<ESM::Pathgrid::Point>& nodes,
|
||||||
const PathFinder& pathfinder)
|
const PathFinder& pathfinder)
|
||||||
{
|
{
|
||||||
|
@ -640,15 +651,9 @@ namespace MWMechanics
|
||||||
int index = Misc::Rng::rollDice(mAllowedNodes.size());
|
int index = Misc::Rng::rollDice(mAllowedNodes.size());
|
||||||
ESM::Pathgrid::Point dest = mAllowedNodes[index];
|
ESM::Pathgrid::Point dest = mAllowedNodes[index];
|
||||||
|
|
||||||
// apply a slight offset to prevent overcrowding
|
dest.mX += OffsetToPreventOvercrowding();
|
||||||
dest.mX += static_cast<int>(Misc::Rng::rollProbability() * 128 - 64);
|
dest.mY += OffsetToPreventOvercrowding();
|
||||||
dest.mY += static_cast<int>(Misc::Rng::rollProbability() * 128 - 64);
|
ToWorldCoordinates(dest, actor.getCell()->getCell());
|
||||||
|
|
||||||
if (actor.getCell()->isExterior())
|
|
||||||
{
|
|
||||||
dest.mX += actor.getCell()->getCell()->mData.mX * ESM::Land::REAL_SIZE;
|
|
||||||
dest.mY += actor.getCell()->getCell()->mData.mY * ESM::Land::REAL_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->moveObject(actor, static_cast<float>(dest.mX),
|
MWBase::Environment::get().getWorld()->moveObject(actor, static_cast<float>(dest.mX),
|
||||||
static_cast<float>(dest.mY), static_cast<float>(dest.mZ));
|
static_cast<float>(dest.mY), static_cast<float>(dest.mZ));
|
||||||
|
@ -658,6 +663,11 @@ namespace MWMechanics
|
||||||
mStoredAvailableNodes = false;
|
mStoredAvailableNodes = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AiWander::OffsetToPreventOvercrowding()
|
||||||
|
{
|
||||||
|
return static_cast<int>(DESTINATION_TOLERANCE * (Misc::Rng::rollProbability() * 2.0f - 1.0f));
|
||||||
|
}
|
||||||
|
|
||||||
void AiWander::getAllowedNodes(const MWWorld::Ptr& actor, const ESM::Cell* cell)
|
void AiWander::getAllowedNodes(const MWWorld::Ptr& actor, const ESM::Cell* cell)
|
||||||
{
|
{
|
||||||
if (!mStoredInitialActorPosition)
|
if (!mStoredInitialActorPosition)
|
||||||
|
@ -684,46 +694,87 @@ namespace MWMechanics
|
||||||
// ... pathgrids don't usually include water, so swimmers ignore them
|
// ... pathgrids don't usually include water, so swimmers ignore them
|
||||||
if (mDistance && !actor.getClass().isPureWaterCreature(actor))
|
if (mDistance && !actor.getClass().isPureWaterCreature(actor))
|
||||||
{
|
{
|
||||||
float cellXOffset = 0;
|
// get NPC's position in local (i.e. cell) co-ordinates
|
||||||
float cellYOffset = 0;
|
osg::Vec3f npcPos(mInitialActorPosition);
|
||||||
if(cell->isExterior())
|
if(cell->isExterior())
|
||||||
{
|
{
|
||||||
cellXOffset = static_cast<float>(cell->mData.mX * ESM::Land::REAL_SIZE);
|
npcPos[0] = npcPos[0] - static_cast<float>(cell->mData.mX * ESM::Land::REAL_SIZE);
|
||||||
cellYOffset = static_cast<float>(cell->mData.mY * ESM::Land::REAL_SIZE);
|
npcPos[1] = npcPos[1] - static_cast<float>(cell->mData.mY * ESM::Land::REAL_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert npcPos to local (i.e. cell) co-ordinates
|
|
||||||
osg::Vec3f npcPos(mInitialActorPosition);
|
|
||||||
npcPos[0] = npcPos[0] - cellXOffset;
|
|
||||||
npcPos[1] = npcPos[1] - cellYOffset;
|
|
||||||
|
|
||||||
// mAllowedNodes for this actor with pathgrid point indexes based on mDistance
|
// mAllowedNodes for this actor with pathgrid point indexes based on mDistance
|
||||||
// NOTE: mPoints and mAllowedNodes are in local co-ordinates
|
// NOTE: mPoints and mAllowedNodes are in local co-ordinates
|
||||||
|
int pointIndex = 0;
|
||||||
for(unsigned int counter = 0; counter < pathgrid->mPoints.size(); counter++)
|
for(unsigned int counter = 0; counter < pathgrid->mPoints.size(); counter++)
|
||||||
{
|
{
|
||||||
osg::Vec3f nodePos(PathFinder::MakeOsgVec3(pathgrid->mPoints[counter]));
|
osg::Vec3f nodePos(PathFinder::MakeOsgVec3(pathgrid->mPoints[counter]));
|
||||||
if((npcPos - nodePos).length2() <= mDistance * mDistance)
|
if((npcPos - nodePos).length2() <= mDistance * mDistance)
|
||||||
|
{
|
||||||
mAllowedNodes.push_back(pathgrid->mPoints[counter]);
|
mAllowedNodes.push_back(pathgrid->mPoints[counter]);
|
||||||
|
pointIndex = counter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mAllowedNodes.size() == 1)
|
||||||
|
{
|
||||||
|
AddNonPathGridAllowedPoints(npcPos, pathgrid, pointIndex);
|
||||||
}
|
}
|
||||||
if(!mAllowedNodes.empty())
|
if(!mAllowedNodes.empty())
|
||||||
{
|
{
|
||||||
osg::Vec3f firstNodePos(PathFinder::MakeOsgVec3(mAllowedNodes[0]));
|
SetCurrentNodeToClosestAllowedNode(npcPos);
|
||||||
float closestNode = (npcPos - firstNodePos).length2();
|
|
||||||
unsigned int index = 0;
|
|
||||||
for(unsigned int counterThree = 1; counterThree < mAllowedNodes.size(); counterThree++)
|
|
||||||
{
|
|
||||||
osg::Vec3f nodePos(PathFinder::MakeOsgVec3(mAllowedNodes[counterThree]));
|
|
||||||
float tempDist = (npcPos - nodePos).length2();
|
|
||||||
if(tempDist < closestNode)
|
|
||||||
index = counterThree;
|
|
||||||
}
|
|
||||||
mCurrentNode = mAllowedNodes[index];
|
|
||||||
mAllowedNodes.erase(mAllowedNodes.begin() + index);
|
|
||||||
}
|
}
|
||||||
mStoredAvailableNodes = true; // set only if successful in finding allowed nodes
|
mStoredAvailableNodes = true; // set only if successful in finding allowed nodes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When only one path grid point in wander distance,
|
||||||
|
// additional points for NPC to wander to are:
|
||||||
|
// 1. NPC's initial location
|
||||||
|
// 2. Partway along the path between the point and its connected points.
|
||||||
|
void AiWander::AddNonPathGridAllowedPoints(osg::Vec3f npcPos, const ESM::Pathgrid * pathGrid, int pointIndex)
|
||||||
|
{
|
||||||
|
mAllowedNodes.push_back(PathFinder::MakePathgridPoint(npcPos));
|
||||||
|
for (std::vector<ESM::Pathgrid::Edge>::const_iterator it = pathGrid->mEdges.begin(); it != pathGrid->mEdges.end(); ++it)
|
||||||
|
{
|
||||||
|
if (it->mV0 == pointIndex)
|
||||||
|
{
|
||||||
|
AddPointBetweenPathGridPoints(pathGrid->mPoints[it->mV0], pathGrid->mPoints[it->mV1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AiWander::AddPointBetweenPathGridPoints(const ESM::Pathgrid::Point& start, const ESM::Pathgrid::Point& end)
|
||||||
|
{
|
||||||
|
osg::Vec3f vectorStart = PathFinder::MakeOsgVec3(start);
|
||||||
|
osg::Vec3f delta = PathFinder::MakeOsgVec3(end) - vectorStart;
|
||||||
|
float length = delta.length();
|
||||||
|
delta.normalize();
|
||||||
|
|
||||||
|
int distance = std::max(mDistance / 2, MINIMUM_WANDER_DISTANCE);
|
||||||
|
|
||||||
|
// must not travel longer than distance between waypoints or NPC goes past waypoint
|
||||||
|
distance = std::min(distance, static_cast<int>(length));
|
||||||
|
delta *= distance;
|
||||||
|
mAllowedNodes.push_back(PathFinder::MakePathgridPoint(vectorStart + delta));
|
||||||
|
}
|
||||||
|
|
||||||
|
void AiWander::SetCurrentNodeToClosestAllowedNode(osg::Vec3f npcPos)
|
||||||
|
{
|
||||||
|
float distanceToClosestNode = FLT_MAX;
|
||||||
|
unsigned int index = 0;
|
||||||
|
for (unsigned int counterThree = 0; counterThree < mAllowedNodes.size(); counterThree++)
|
||||||
|
{
|
||||||
|
osg::Vec3f nodePos(PathFinder::MakeOsgVec3(mAllowedNodes[counterThree]));
|
||||||
|
float tempDist = (npcPos - nodePos).length2();
|
||||||
|
if (tempDist < distanceToClosestNode)
|
||||||
|
{
|
||||||
|
index = counterThree;
|
||||||
|
distanceToClosestNode = tempDist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mCurrentNode = mAllowedNodes[index];
|
||||||
|
mAllowedNodes.erase(mAllowedNodes.begin() + index);
|
||||||
|
}
|
||||||
|
|
||||||
void AiWander::writeState(ESM::AiSequence::AiSequence &sequence) const
|
void AiWander::writeState(ESM::AiSequence::AiSequence &sequence) const
|
||||||
{
|
{
|
||||||
std::unique_ptr<ESM::AiSequence::AiWander> wander(new ESM::AiSequence::AiWander());
|
std::unique_ptr<ESM::AiSequence::AiWander> wander(new ESM::AiSequence::AiWander());
|
||||||
|
|
|
@ -118,8 +118,19 @@ namespace MWMechanics
|
||||||
GroupIndex_MaxIdle = 9
|
GroupIndex_MaxIdle = 9
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// convert point from local (i.e. cell) to world co-ordinates
|
||||||
|
void ToWorldCoordinates(ESM::Pathgrid::Point& point, const ESM::Cell * cell);
|
||||||
|
|
||||||
|
void SetCurrentNodeToClosestAllowedNode(osg::Vec3f npcPos);
|
||||||
|
|
||||||
|
void AddNonPathGridAllowedPoints(osg::Vec3f npcPos, const ESM::Pathgrid * pathGrid, int pointIndex);
|
||||||
|
|
||||||
|
void AddPointBetweenPathGridPoints(const ESM::Pathgrid::Point& start, const ESM::Pathgrid::Point& end);
|
||||||
|
|
||||||
/// lookup table for converting idleSelect value to groupName
|
/// lookup table for converting idleSelect value to groupName
|
||||||
static const std::string sIdleSelectToGroupName[GroupIndex_MaxIdle - GroupIndex_MinIdle + 1];
|
static const std::string sIdleSelectToGroupName[GroupIndex_MaxIdle - GroupIndex_MinIdle + 1];
|
||||||
|
|
||||||
|
static int OffsetToPreventOvercrowding();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <components/esm/creaturestats.hpp>
|
#include <components/esm/creaturestats.hpp>
|
||||||
|
#include <components/esm/esmreader.hpp>
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
|
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
|
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
#include <components/esm/stolenitems.hpp>
|
#include <components/esm/stolenitems.hpp>
|
||||||
|
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
|
@ -19,6 +19,8 @@ namespace MWMechanics
|
||||||
public:
|
public:
|
||||||
PathFinder();
|
PathFinder();
|
||||||
|
|
||||||
|
static const int PathTolerance = 32;
|
||||||
|
|
||||||
static float sgn(float val)
|
static float sgn(float val)
|
||||||
{
|
{
|
||||||
if(val > 0)
|
if(val > 0)
|
||||||
|
@ -35,7 +37,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
void clearPath();
|
void clearPath();
|
||||||
|
|
||||||
bool checkPathCompleted(float x, float y, float tolerance=32.f);
|
bool checkPathCompleted(float x, float y, float tolerance = PathTolerance);
|
||||||
///< \Returns true if we are within \a tolerance units of the last path point.
|
///< \Returns true if we are within \a tolerance units of the last path point.
|
||||||
|
|
||||||
/// In degrees
|
/// In degrees
|
||||||
|
|
|
@ -313,27 +313,27 @@ namespace MWMechanics
|
||||||
return path; // for some reason couldn't build a path
|
return path; // for some reason couldn't build a path
|
||||||
|
|
||||||
// reconstruct path to return, using world co-ordinates
|
// reconstruct path to return, using world co-ordinates
|
||||||
float xCell = 0;
|
int xCell = 0;
|
||||||
float yCell = 0;
|
int yCell = 0;
|
||||||
if (mIsExterior)
|
if (mIsExterior)
|
||||||
{
|
{
|
||||||
xCell = static_cast<float>(mPathgrid->mData.mX * ESM::Land::REAL_SIZE);
|
xCell = mPathgrid->mData.mX * ESM::Land::REAL_SIZE;
|
||||||
yCell = static_cast<float>(mPathgrid->mData.mY * ESM::Land::REAL_SIZE);
|
yCell = mPathgrid->mData.mY * ESM::Land::REAL_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(graphParent[current] != -1)
|
while(graphParent[current] != -1)
|
||||||
{
|
{
|
||||||
ESM::Pathgrid::Point pt = mPathgrid->mPoints[current];
|
ESM::Pathgrid::Point pt = mPathgrid->mPoints[current];
|
||||||
pt.mX += static_cast<int>(xCell);
|
pt.mX += xCell;
|
||||||
pt.mY += static_cast<int>(yCell);
|
pt.mY += yCell;
|
||||||
path.push_front(pt);
|
path.push_front(pt);
|
||||||
current = graphParent[current];
|
current = graphParent[current];
|
||||||
}
|
}
|
||||||
|
|
||||||
// add first node to path explicitly
|
// add first node to path explicitly
|
||||||
ESM::Pathgrid::Point pt = mPathgrid->mPoints[start];
|
ESM::Pathgrid::Point pt = mPathgrid->mPoints[start];
|
||||||
pt.mX += static_cast<int>(xCell);
|
pt.mX += xCell;
|
||||||
pt.mY += static_cast<int>(yCell);
|
pt.mY += yCell;
|
||||||
path.push_front(pt);
|
path.push_front(pt);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <components/esm/loadspel.hpp>
|
#include <components/esm/loadspel.hpp>
|
||||||
#include <components/esm/spellstate.hpp>
|
#include <components/esm/spellstate.hpp>
|
||||||
|
#include <components/misc/rng.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
|
|
@ -1,28 +1,276 @@
|
||||||
|
|
||||||
#include "stat.hpp"
|
#include "stat.hpp"
|
||||||
|
|
||||||
void MWMechanics::AttributeValue::writeState (ESM::StatState<int>& state) const
|
#include <components/esm/statstate.hpp>
|
||||||
|
|
||||||
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
state.mBase = mBase;
|
template<typename T>
|
||||||
state.mMod = mModifier;
|
Stat<T>::Stat() : mBase (0), mModified (0) {}
|
||||||
state.mDamage = mDamage;
|
template<typename T>
|
||||||
|
Stat<T>::Stat(T base) : mBase (base), mModified (base) {}
|
||||||
|
template<typename T>
|
||||||
|
Stat<T>::Stat(T base, T modified) : mBase (base), mModified (modified) {}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
const T& Stat<T>::getBase() const
|
||||||
|
{
|
||||||
|
return mBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T Stat<T>::getModified() const
|
||||||
|
{
|
||||||
|
return std::max(static_cast<T>(0), mModified);
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
T Stat<T>::getModifier() const
|
||||||
|
{
|
||||||
|
return mModified-mBase;
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void Stat<T>::set (const T& value)
|
||||||
|
{
|
||||||
|
mBase = mModified = value;
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void Stat<T>::modify(const T& diff)
|
||||||
|
{
|
||||||
|
mBase += diff;
|
||||||
|
if(mBase >= static_cast<T>(0))
|
||||||
|
mModified += diff;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mModified += diff - mBase;
|
||||||
|
mBase = static_cast<T>(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void Stat<T>::setBase (const T& value)
|
||||||
|
{
|
||||||
|
T diff = value - mBase;
|
||||||
|
mBase = value;
|
||||||
|
mModified += diff;
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void Stat<T>::setModified (T value, const T& min, const T& max)
|
||||||
|
{
|
||||||
|
T diff = value - mModified;
|
||||||
|
|
||||||
|
if (mBase+diff<min)
|
||||||
|
{
|
||||||
|
value = min + (mModified - mBase);
|
||||||
|
diff = value - mModified;
|
||||||
|
}
|
||||||
|
else if (mBase+diff>max)
|
||||||
|
{
|
||||||
|
value = max + (mModified - mBase);
|
||||||
|
diff = value - mModified;
|
||||||
|
}
|
||||||
|
|
||||||
|
mModified = value;
|
||||||
|
mBase += diff;
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void Stat<T>::setModifier (const T& modifier)
|
||||||
|
{
|
||||||
|
mModified = mBase + modifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void Stat<T>::writeState (ESM::StatState<T>& state) const
|
||||||
|
{
|
||||||
|
state.mBase = mBase;
|
||||||
|
state.mMod = mModified;
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void Stat<T>::readState (const ESM::StatState<T>& state)
|
||||||
|
{
|
||||||
|
mBase = state.mBase;
|
||||||
|
mModified = state.mMod;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
DynamicStat<T>::DynamicStat() : mStatic (0), mCurrent (0) {}
|
||||||
|
template<typename T>
|
||||||
|
DynamicStat<T>::DynamicStat(T base) : mStatic (base), mCurrent (base) {}
|
||||||
|
template<typename T>
|
||||||
|
DynamicStat<T>::DynamicStat(T base, T modified, T current) : mStatic(base, modified), mCurrent (current) {}
|
||||||
|
template<typename T>
|
||||||
|
DynamicStat<T>::DynamicStat(const Stat<T> &stat, T current) : mStatic(stat), mCurrent (current) {}
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
const T& DynamicStat<T>::getBase() const
|
||||||
|
{
|
||||||
|
return mStatic.getBase();
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
T DynamicStat<T>::getModified() const
|
||||||
|
{
|
||||||
|
return mStatic.getModified();
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
const T& DynamicStat<T>::getCurrent() const
|
||||||
|
{
|
||||||
|
return mCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void DynamicStat<T>::set (const T& value)
|
||||||
|
{
|
||||||
|
mStatic.set (value);
|
||||||
|
mCurrent = value;
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void DynamicStat<T>::setBase (const T& value)
|
||||||
|
{
|
||||||
|
mStatic.setBase (value);
|
||||||
|
|
||||||
|
if (mCurrent>getModified())
|
||||||
|
mCurrent = getModified();
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void DynamicStat<T>::setModified (T value, const T& min, const T& max)
|
||||||
|
{
|
||||||
|
mStatic.setModified (value, min, max);
|
||||||
|
|
||||||
|
if (mCurrent>getModified())
|
||||||
|
mCurrent = getModified();
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void DynamicStat<T>::modify (const T& diff, bool allowCurrentDecreaseBelowZero)
|
||||||
|
{
|
||||||
|
mStatic.modify (diff);
|
||||||
|
setCurrent (getCurrent()+diff, allowCurrentDecreaseBelowZero);
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void DynamicStat<T>::setCurrent (const T& value, bool allowDecreaseBelowZero)
|
||||||
|
{
|
||||||
|
if (value > mCurrent)
|
||||||
|
{
|
||||||
|
// increase
|
||||||
|
mCurrent = value;
|
||||||
|
|
||||||
|
if (mCurrent > getModified())
|
||||||
|
mCurrent = getModified();
|
||||||
|
}
|
||||||
|
else if (value > 0 || allowDecreaseBelowZero)
|
||||||
|
{
|
||||||
|
// allowed decrease
|
||||||
|
mCurrent = value;
|
||||||
|
}
|
||||||
|
else if (mCurrent > 0)
|
||||||
|
{
|
||||||
|
// capped decrease
|
||||||
|
mCurrent = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void DynamicStat<T>::setModifier (const T& modifier, bool allowCurrentDecreaseBelowZero)
|
||||||
|
{
|
||||||
|
T diff = modifier - mStatic.getModifier();
|
||||||
|
mStatic.setModifier (modifier);
|
||||||
|
setCurrent (getCurrent()+diff, allowCurrentDecreaseBelowZero);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void DynamicStat<T>::writeState (ESM::StatState<T>& state) const
|
||||||
|
{
|
||||||
|
mStatic.writeState (state);
|
||||||
|
state.mCurrent = mCurrent;
|
||||||
|
}
|
||||||
|
template<typename T>
|
||||||
|
void DynamicStat<T>::readState (const ESM::StatState<T>& state)
|
||||||
|
{
|
||||||
|
mStatic.readState (state);
|
||||||
|
mCurrent = state.mCurrent;
|
||||||
|
}
|
||||||
|
|
||||||
|
AttributeValue::AttributeValue() :
|
||||||
|
mBase(0), mModifier(0), mDamage(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int AttributeValue::getModified() const
|
||||||
|
{
|
||||||
|
return std::max(0, mBase - (int) mDamage + mModifier);
|
||||||
|
}
|
||||||
|
int AttributeValue::getBase() const
|
||||||
|
{
|
||||||
|
return mBase;
|
||||||
|
}
|
||||||
|
int AttributeValue::getModifier() const
|
||||||
|
{
|
||||||
|
return mModifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AttributeValue::setBase(int base)
|
||||||
|
{
|
||||||
|
mBase = std::max(0, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AttributeValue::setModifier(int mod)
|
||||||
|
{
|
||||||
|
mModifier = mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AttributeValue::damage(float damage)
|
||||||
|
{
|
||||||
|
mDamage += std::min(damage, (float)getModified());
|
||||||
|
}
|
||||||
|
void AttributeValue::restore(float amount)
|
||||||
|
{
|
||||||
|
mDamage -= std::min(mDamage, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
float AttributeValue::getDamage() const
|
||||||
|
{
|
||||||
|
return mDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AttributeValue::writeState (ESM::StatState<int>& state) const
|
||||||
|
{
|
||||||
|
state.mBase = mBase;
|
||||||
|
state.mMod = mModifier;
|
||||||
|
state.mDamage = mDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AttributeValue::readState (const ESM::StatState<int>& state)
|
||||||
|
{
|
||||||
|
mBase = state.mBase;
|
||||||
|
mModifier = state.mMod;
|
||||||
|
mDamage = state.mDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
SkillValue::SkillValue() :
|
||||||
|
mProgress(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
float SkillValue::getProgress() const
|
||||||
|
{
|
||||||
|
return mProgress;
|
||||||
|
}
|
||||||
|
void SkillValue::setProgress(float progress)
|
||||||
|
{
|
||||||
|
mProgress = progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SkillValue::writeState (ESM::StatState<int>& state) const
|
||||||
|
{
|
||||||
|
AttributeValue::writeState (state);
|
||||||
|
state.mProgress = mProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SkillValue::readState (const ESM::StatState<int>& state)
|
||||||
|
{
|
||||||
|
AttributeValue::readState (state);
|
||||||
|
mProgress = state.mProgress;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWMechanics::AttributeValue::readState (const ESM::StatState<int>& state)
|
template class MWMechanics::Stat<int>;
|
||||||
{
|
template class MWMechanics::Stat<float>;
|
||||||
mBase = state.mBase;
|
template class MWMechanics::DynamicStat<int>;
|
||||||
mModifier = state.mMod;
|
template class MWMechanics::DynamicStat<float>;
|
||||||
mDamage = state.mDamage;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MWMechanics::SkillValue::writeState (ESM::StatState<int>& state) const
|
|
||||||
{
|
|
||||||
AttributeValue::writeState (state);
|
|
||||||
state.mProgress = mProgress;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MWMechanics::SkillValue::readState (const ESM::StatState<int>& state)
|
|
||||||
{
|
|
||||||
AttributeValue::readState (state);
|
|
||||||
mProgress = state.mProgress;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
#ifndef GAME_MWMECHANICS_STAT_H
|
#ifndef GAME_MWMECHANICS_STAT_H
|
||||||
#define GAME_MWMECHANICS_STAT_H
|
#define GAME_MWMECHANICS_STAT_H
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include <components/esm/statstate.hpp>
|
namespace ESM
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct StatState;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
|
@ -16,87 +21,28 @@ namespace MWMechanics
|
||||||
public:
|
public:
|
||||||
typedef T Type;
|
typedef T Type;
|
||||||
|
|
||||||
Stat() : mBase (0), mModified (0) {}
|
Stat();
|
||||||
Stat(T base) : mBase (base), mModified (base) {}
|
Stat(T base);
|
||||||
Stat(T base, T modified) : mBase (base), mModified (modified) {}
|
Stat(T base, T modified);
|
||||||
|
|
||||||
const T& getBase() const
|
const T& getBase() const;
|
||||||
{
|
|
||||||
return mBase;
|
|
||||||
}
|
|
||||||
|
|
||||||
T getModified() const
|
T getModified() const;
|
||||||
{
|
T getModifier() const;
|
||||||
return std::max(static_cast<T>(0), mModified);
|
|
||||||
}
|
|
||||||
|
|
||||||
T getModifier() const
|
|
||||||
{
|
|
||||||
return mModified-mBase;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set base and modified to \a value.
|
/// Set base and modified to \a value.
|
||||||
void set (const T& value)
|
void set (const T& value);
|
||||||
{
|
void modify(const T& diff);
|
||||||
mBase = mModified = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void modify(const T& diff)
|
|
||||||
{
|
|
||||||
mBase += diff;
|
|
||||||
if(mBase >= static_cast<T>(0))
|
|
||||||
mModified += diff;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mModified += diff - mBase;
|
|
||||||
mBase = static_cast<T>(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set base and adjust modified accordingly.
|
/// Set base and adjust modified accordingly.
|
||||||
void setBase (const T& value)
|
void setBase (const T& value);
|
||||||
{
|
|
||||||
T diff = value - mBase;
|
|
||||||
mBase = value;
|
|
||||||
mModified += diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set modified value an adjust base accordingly.
|
/// Set modified value an adjust base accordingly.
|
||||||
void setModified (T value, const T& min, const T& max = std::numeric_limits<T>::max())
|
void setModified (T value, const T& min, const T& max = std::numeric_limits<T>::max());
|
||||||
{
|
void setModifier (const T& modifier);
|
||||||
T diff = value - mModified;
|
|
||||||
|
|
||||||
if (mBase+diff<min)
|
void writeState (ESM::StatState<T>& state) const;
|
||||||
{
|
void readState (const ESM::StatState<T>& state);
|
||||||
value = min + (mModified - mBase);
|
|
||||||
diff = value - mModified;
|
|
||||||
}
|
|
||||||
else if (mBase+diff>max)
|
|
||||||
{
|
|
||||||
value = max + (mModified - mBase);
|
|
||||||
diff = value - mModified;
|
|
||||||
}
|
|
||||||
|
|
||||||
mModified = value;
|
|
||||||
mBase += diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setModifier (const T& modifier)
|
|
||||||
{
|
|
||||||
mModified = mBase + modifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeState (ESM::StatState<T>& state) const
|
|
||||||
{
|
|
||||||
state.mBase = mBase;
|
|
||||||
state.mMod = mModified;
|
|
||||||
}
|
|
||||||
|
|
||||||
void readState (const ESM::StatState<T>& state)
|
|
||||||
{
|
|
||||||
mBase = state.mBase;
|
|
||||||
mModified = state.mMod;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -121,98 +67,32 @@ namespace MWMechanics
|
||||||
public:
|
public:
|
||||||
typedef T Type;
|
typedef T Type;
|
||||||
|
|
||||||
DynamicStat() : mStatic (0), mCurrent (0) {}
|
DynamicStat();
|
||||||
DynamicStat(T base) : mStatic (base), mCurrent (base) {}
|
DynamicStat(T base);
|
||||||
DynamicStat(T base, T modified, T current) : mStatic(base, modified), mCurrent (current) {}
|
DynamicStat(T base, T modified, T current);
|
||||||
DynamicStat(const Stat<T> &stat, T current) : mStatic(stat), mCurrent (current) {}
|
DynamicStat(const Stat<T> &stat, T current);
|
||||||
|
|
||||||
const T& getBase() const
|
const T& getBase() const;
|
||||||
{
|
T getModified() const;
|
||||||
return mStatic.getBase();
|
const T& getCurrent() const;
|
||||||
}
|
|
||||||
|
|
||||||
T getModified() const
|
|
||||||
{
|
|
||||||
return mStatic.getModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
const T& getCurrent() const
|
|
||||||
{
|
|
||||||
return mCurrent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set base, modified and current to \a value.
|
/// Set base, modified and current to \a value.
|
||||||
void set (const T& value)
|
void set (const T& value);
|
||||||
{
|
|
||||||
mStatic.set (value);
|
|
||||||
mCurrent = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set base and adjust modified accordingly.
|
/// Set base and adjust modified accordingly.
|
||||||
void setBase (const T& value)
|
void setBase (const T& value);
|
||||||
{
|
|
||||||
mStatic.setBase (value);
|
|
||||||
|
|
||||||
if (mCurrent>getModified())
|
|
||||||
mCurrent = getModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Set modified value an adjust base accordingly.
|
/// Set modified value an adjust base accordingly.
|
||||||
void setModified (T value, const T& min, const T& max = std::numeric_limits<T>::max())
|
void setModified (T value, const T& min, const T& max = std::numeric_limits<T>::max());
|
||||||
{
|
|
||||||
mStatic.setModified (value, min, max);
|
|
||||||
|
|
||||||
if (mCurrent>getModified())
|
|
||||||
mCurrent = getModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Change modified relatively.
|
/// Change modified relatively.
|
||||||
void modify (const T& diff, bool allowCurrentDecreaseBelowZero=false)
|
void modify (const T& diff, bool allowCurrentDecreaseBelowZero=false);
|
||||||
{
|
|
||||||
mStatic.modify (diff);
|
|
||||||
setCurrent (getCurrent()+diff, allowCurrentDecreaseBelowZero);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setCurrent (const T& value, bool allowDecreaseBelowZero = false)
|
void setCurrent (const T& value, bool allowDecreaseBelowZero = false);
|
||||||
{
|
void setModifier (const T& modifier, bool allowCurrentDecreaseBelowZero=false);
|
||||||
if (value > mCurrent)
|
|
||||||
{
|
|
||||||
// increase
|
|
||||||
mCurrent = value;
|
|
||||||
|
|
||||||
if (mCurrent > getModified())
|
void writeState (ESM::StatState<T>& state) const;
|
||||||
mCurrent = getModified();
|
void readState (const ESM::StatState<T>& state);
|
||||||
}
|
|
||||||
else if (value > 0 || allowDecreaseBelowZero)
|
|
||||||
{
|
|
||||||
// allowed decrease
|
|
||||||
mCurrent = value;
|
|
||||||
}
|
|
||||||
else if (mCurrent > 0)
|
|
||||||
{
|
|
||||||
// capped decrease
|
|
||||||
mCurrent = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setModifier (const T& modifier, bool allowCurrentDecreaseBelowZero=false)
|
|
||||||
{
|
|
||||||
T diff = modifier - mStatic.getModifier();
|
|
||||||
mStatic.setModifier (modifier);
|
|
||||||
setCurrent (getCurrent()+diff, allowCurrentDecreaseBelowZero);
|
|
||||||
}
|
|
||||||
|
|
||||||
void writeState (ESM::StatState<T>& state) const
|
|
||||||
{
|
|
||||||
mStatic.writeState (state);
|
|
||||||
state.mCurrent = mCurrent;
|
|
||||||
}
|
|
||||||
|
|
||||||
void readState (const ESM::StatState<T>& state)
|
|
||||||
{
|
|
||||||
mStatic.readState (state);
|
|
||||||
mCurrent = state.mCurrent;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -236,26 +116,25 @@ namespace MWMechanics
|
||||||
float mDamage; // needs to be float to allow continuous damage
|
float mDamage; // needs to be float to allow continuous damage
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AttributeValue() : mBase(0), mModifier(0), mDamage(0) {}
|
AttributeValue();
|
||||||
|
|
||||||
int getModified() const { return std::max(0, mBase - (int) mDamage + mModifier); }
|
int getModified() const;
|
||||||
int getBase() const { return mBase; }
|
int getBase() const;
|
||||||
int getModifier() const { return mModifier; }
|
int getModifier() const;
|
||||||
|
|
||||||
void setBase(int base) { mBase = std::max(0, base); }
|
void setBase(int base);
|
||||||
|
|
||||||
void setModifier(int mod) { mModifier = mod; }
|
void setModifier(int mod);
|
||||||
|
|
||||||
// Maximum attribute damage is limited to the modified value.
|
// Maximum attribute damage is limited to the modified value.
|
||||||
// Note: I think MW applies damage directly to mModified, since you can also
|
// Note: I think MW applies damage directly to mModified, since you can also
|
||||||
// "restore" drained attributes. We need to rewrite the magic effect system to support this.
|
// "restore" drained attributes. We need to rewrite the magic effect system to support this.
|
||||||
void damage(float damage) { mDamage += std::min(damage, (float)getModified()); }
|
void damage(float damage);
|
||||||
void restore(float amount) { mDamage -= std::min(mDamage, amount); }
|
void restore(float amount);
|
||||||
|
|
||||||
float getDamage() const { return mDamage; }
|
float getDamage() const;
|
||||||
|
|
||||||
void writeState (ESM::StatState<int>& state) const;
|
void writeState (ESM::StatState<int>& state) const;
|
||||||
|
|
||||||
void readState (const ESM::StatState<int>& state);
|
void readState (const ESM::StatState<int>& state);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -263,12 +142,11 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
float mProgress;
|
float mProgress;
|
||||||
public:
|
public:
|
||||||
SkillValue() : mProgress(0) {}
|
SkillValue();
|
||||||
float getProgress() const { return mProgress; }
|
float getProgress() const;
|
||||||
void setProgress(float progress) { mProgress = progress; }
|
void setProgress(float progress);
|
||||||
|
|
||||||
void writeState (ESM::StatState<int>& state) const;
|
void writeState (ESM::StatState<int>& state) const;
|
||||||
|
|
||||||
void readState (const ESM::StatState<int>& state);
|
void readState (const ESM::StatState<int>& state);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
#include <components/esm/globalscript.hpp>
|
#include <components/esm/globalscript.hpp>
|
||||||
|
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include <components/esm/cellid.hpp>
|
#include <components/esm/cellid.hpp>
|
||||||
#include <components/esm/loadcell.hpp>
|
#include <components/esm/loadcell.hpp>
|
||||||
|
|
||||||
|
#include <components/loadinglistener/loadinglistener.hpp>
|
||||||
|
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
|
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <components/esm/esmwriter.hpp>
|
#include <components/esm/esmwriter.hpp>
|
||||||
#include <components/esm/defs.hpp>
|
#include <components/esm/defs.hpp>
|
||||||
#include <components/esm/cellstate.hpp>
|
#include <components/esm/cellstate.hpp>
|
||||||
|
#include <components/loadinglistener/loadinglistener.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <components/esm/cellstate.hpp>
|
#include <components/esm/cellstate.hpp>
|
||||||
#include <components/esm/cellid.hpp>
|
#include <components/esm/cellid.hpp>
|
||||||
|
#include <components/esm/esmreader.hpp>
|
||||||
#include <components/esm/esmwriter.hpp>
|
#include <components/esm/esmwriter.hpp>
|
||||||
#include <components/esm/objectstate.hpp>
|
#include <components/esm/objectstate.hpp>
|
||||||
#include <components/esm/containerstate.hpp>
|
#include <components/esm/containerstate.hpp>
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <components/loadinglistener/loadinglistener.hpp>
|
#include <components/loadinglistener/loadinglistener.hpp>
|
||||||
|
|
||||||
#include <components/esm/esmreader.hpp>
|
#include <components/esm/esmreader.hpp>
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_MWWORLD_ESMSTORE_H
|
#ifndef OPENMW_MWWORLD_ESMSTORE_H
|
||||||
#define OPENMW_MWWORLD_ESMSTORE_H
|
#define OPENMW_MWWORLD_ESMSTORE_H
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include <components/esm/records.hpp>
|
#include <components/esm/records.hpp>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <components/esm/loadench.hpp>
|
#include <components/esm/loadench.hpp>
|
||||||
#include <components/esm/inventorystate.hpp>
|
#include <components/esm/inventorystate.hpp>
|
||||||
|
#include <components/misc/rng.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <osg/PositionAttitudeTransform>
|
#include <osg/PositionAttitudeTransform>
|
||||||
|
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
#include <components/esm/projectilestate.hpp>
|
#include <components/esm/projectilestate.hpp>
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
#include <components/resource/scenemanager.hpp>
|
#include <components/resource/scenemanager.hpp>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include <components/nif/niffile.hpp>
|
#include <components/nif/niffile.hpp>
|
||||||
|
#include <components/loadinglistener/loadinglistener.hpp>
|
||||||
#include <components/misc/resourcehelpers.hpp>
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
|
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
#include <components/esm/weatherstate.hpp>
|
#include <components/esm/weatherstate.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
@ -66,6 +67,10 @@ void WeatherManager::setFallbackWeather(Weather& weather,const std::string& name
|
||||||
weather.mGlareView = mFallback->getFallbackFloat("Weather_"+upper+"_Glare_View");
|
weather.mGlareView = mFallback->getFallbackFloat("Weather_"+upper+"_Glare_View");
|
||||||
weather.mCloudTexture = mFallback->getFallbackString("Weather_"+upper+"_Cloud_Texture");
|
weather.mCloudTexture = mFallback->getFallbackString("Weather_"+upper+"_Cloud_Texture");
|
||||||
|
|
||||||
|
static const float fStromWindSpeed = mStore->get<ESM::GameSetting>().find("fStromWindSpeed")->getFloat();
|
||||||
|
|
||||||
|
weather.mIsStorm = weather.mWindSpeed > fStromWindSpeed;
|
||||||
|
|
||||||
bool usesPrecip = mFallback->getFallbackBool("Weather_"+upper+"_Using_Precip");
|
bool usesPrecip = mFallback->getFallbackBool("Weather_"+upper+"_Using_Precip");
|
||||||
if (usesPrecip)
|
if (usesPrecip)
|
||||||
weather.mRainEffect = "meshes\\raindrop.nif";
|
weather.mRainEffect = "meshes\\raindrop.nif";
|
||||||
|
@ -79,7 +84,6 @@ Rain Height Max=700 ?
|
||||||
Rain Threshold=0.6 ?
|
Rain Threshold=0.6 ?
|
||||||
Max Raindrops=650 ?
|
Max Raindrops=650 ?
|
||||||
*/
|
*/
|
||||||
weather.mIsStorm = (name == "ashstorm" || name == "blight");
|
|
||||||
|
|
||||||
mWeatherSettings[name] = weather;
|
mWeatherSettings[name] = weather;
|
||||||
}
|
}
|
||||||
|
@ -112,8 +116,8 @@ float WeatherManager::calculateAngleFade (const std::string& moonName, float ang
|
||||||
return 1.f;
|
return 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
WeatherManager::WeatherManager(MWRender::RenderingManager* rendering,MWWorld::Fallback* fallback) :
|
WeatherManager::WeatherManager(MWRender::RenderingManager* rendering, MWWorld::Fallback* fallback, MWWorld::ESMStore* store) :
|
||||||
mHour(14), mWindSpeed(0.f), mIsStorm(false), mStormDirection(0,1,0), mFallback(fallback),
|
mHour(14), mWindSpeed(0.f), mIsStorm(false), mStormDirection(0,1,0), mFallback(fallback), mStore(store),
|
||||||
mRendering(rendering), mCurrentWeather("clear"), mNextWeather(""), mFirstUpdate(true),
|
mRendering(rendering), mCurrentWeather("clear"), mNextWeather(""), mFirstUpdate(true),
|
||||||
mRemainingTransitionTime(0), mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50),
|
mRemainingTransitionTime(0), mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50),
|
||||||
mTimePassed(0), mWeatherUpdateTime(0), mThunderSoundDelay(0)
|
mTimePassed(0), mWeatherUpdateTime(0), mThunderSoundDelay(0)
|
||||||
|
|
|
@ -156,7 +156,8 @@ namespace MWWorld
|
||||||
class WeatherManager
|
class WeatherManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WeatherManager(MWRender::RenderingManager*,MWWorld::Fallback* fallback);
|
// Have to pass fallback and Store, can't use singleton since World isn't fully constructed yet at the time
|
||||||
|
WeatherManager(MWRender::RenderingManager*, MWWorld::Fallback* fallback, MWWorld::ESMStore* store);
|
||||||
~WeatherManager();
|
~WeatherManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -210,6 +211,7 @@ namespace MWWorld
|
||||||
std::string mPlayingSoundID;
|
std::string mPlayingSoundID;
|
||||||
|
|
||||||
MWWorld::Fallback* mFallback;
|
MWWorld::Fallback* mFallback;
|
||||||
|
MWWorld::ESMStore* mStore;
|
||||||
void setFallbackWeather(Weather& weather,const std::string& name);
|
void setFallbackWeather(Weather& weather,const std::string& name);
|
||||||
MWRender::RenderingManager* mRendering;
|
MWRender::RenderingManager* mRendering;
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,15 @@
|
||||||
#include <osg/ComputeBoundsVisitor>
|
#include <osg/ComputeBoundsVisitor>
|
||||||
#include <osg/PositionAttitudeTransform>
|
#include <osg/PositionAttitudeTransform>
|
||||||
|
|
||||||
|
#include <components/esm/esmreader.hpp>
|
||||||
|
#include <components/esm/esmwriter.hpp>
|
||||||
|
|
||||||
#include <components/misc/rng.hpp>
|
#include <components/misc/rng.hpp>
|
||||||
|
|
||||||
#include <components/files/collections.hpp>
|
#include <components/files/collections.hpp>
|
||||||
#include <components/compiler/locals.hpp>
|
#include <components/compiler/locals.hpp>
|
||||||
#include <components/esm/cellid.hpp>
|
#include <components/esm/cellid.hpp>
|
||||||
|
#include <components/esm/esmreader.hpp>
|
||||||
#include <components/misc/resourcehelpers.hpp>
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
|
|
||||||
|
@ -163,8 +167,6 @@ namespace MWWorld
|
||||||
mProjectileManager.reset(new ProjectileManager(rootNode, resourceSystem, mPhysics));
|
mProjectileManager.reset(new ProjectileManager(rootNode, resourceSystem, mPhysics));
|
||||||
mRendering = new MWRender::RenderingManager(viewer, rootNode, resourceSystem, &mFallback);
|
mRendering = new MWRender::RenderingManager(viewer, rootNode, resourceSystem, &mFallback);
|
||||||
|
|
||||||
mWeatherManager = new MWWorld::WeatherManager(mRendering,&mFallback);
|
|
||||||
|
|
||||||
mEsm.resize(contentFiles.size());
|
mEsm.resize(contentFiles.size());
|
||||||
Loading::Listener* listener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
Loading::Listener* listener = MWBase::Environment::get().getWindowManager()->getLoadingScreen();
|
||||||
listener->loadingOn();
|
listener->loadingOn();
|
||||||
|
@ -193,6 +195,8 @@ namespace MWWorld
|
||||||
|
|
||||||
mGlobalVariables.fill (mStore);
|
mGlobalVariables.fill (mStore);
|
||||||
|
|
||||||
|
mWeatherManager = new MWWorld::WeatherManager(mRendering,&mFallback,&mStore);
|
||||||
|
|
||||||
mWorldScene = new Scene(*mRendering, mPhysics);
|
mWorldScene = new Scene(*mRendering, mPhysics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +269,7 @@ namespace MWWorld
|
||||||
// we don't want old weather to persist on a new game
|
// we don't want old weather to persist on a new game
|
||||||
delete mWeatherManager;
|
delete mWeatherManager;
|
||||||
mWeatherManager = 0;
|
mWeatherManager = 0;
|
||||||
mWeatherManager = new MWWorld::WeatherManager(mRendering,&mFallback);
|
mWeatherManager = new MWWorld::WeatherManager(mRendering,&mFallback,&mStore);
|
||||||
|
|
||||||
if (!mStartupScript.empty())
|
if (!mStartupScript.empty())
|
||||||
MWBase::Environment::get().getWindowManager()->executeInConsole(mStartupScript);
|
MWBase::Environment::get().getWindowManager()->executeInConsole(mStartupScript);
|
||||||
|
|
|
@ -52,6 +52,11 @@ namespace MWRender
|
||||||
class Camera;
|
class Camera;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace ToUTF8
|
||||||
|
{
|
||||||
|
class Utf8Encoder;
|
||||||
|
}
|
||||||
|
|
||||||
struct ContentLoader;
|
struct ContentLoader;
|
||||||
|
|
||||||
namespace MWWorld
|
namespace MWWorld
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#include "creaturestats.hpp"
|
#include "creaturestats.hpp"
|
||||||
|
#include "esmreader.hpp"
|
||||||
|
#include "esmwriter.hpp"
|
||||||
|
|
||||||
void ESM::CreatureStats::load (ESMReader &esm)
|
void ESM::CreatureStats::load (ESMReader &esm)
|
||||||
{
|
{
|
||||||
|
|
52
components/esm/statstate.cpp
Normal file
52
components/esm/statstate.cpp
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
#include "statstate.hpp"
|
||||||
|
|
||||||
|
#include "esmreader.hpp"
|
||||||
|
#include "esmwriter.hpp"
|
||||||
|
|
||||||
|
namespace ESM
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
StatState<T>::StatState() : mBase(0), mMod(0), mCurrent(0), mDamage(0), mProgress(0) {}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void StatState<T>::load(ESMReader &esm)
|
||||||
|
{
|
||||||
|
esm.getHNT(mBase, "STBA");
|
||||||
|
|
||||||
|
mMod = 0;
|
||||||
|
esm.getHNOT(mMod, "STMO");
|
||||||
|
mCurrent = 0;
|
||||||
|
esm.getHNOT(mCurrent, "STCU");
|
||||||
|
|
||||||
|
// mDamage was changed to a float; ensure backwards compatibility
|
||||||
|
T oldDamage = 0;
|
||||||
|
esm.getHNOT(oldDamage, "STDA");
|
||||||
|
mDamage = static_cast<float>(oldDamage);
|
||||||
|
|
||||||
|
esm.getHNOT(mDamage, "STDF");
|
||||||
|
|
||||||
|
mProgress = 0;
|
||||||
|
esm.getHNOT(mProgress, "STPR");
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void StatState<T>::save(ESMWriter &esm) const
|
||||||
|
{
|
||||||
|
esm.writeHNT("STBA", mBase);
|
||||||
|
|
||||||
|
if (mMod != 0)
|
||||||
|
esm.writeHNT("STMO", mMod);
|
||||||
|
|
||||||
|
if (mCurrent)
|
||||||
|
esm.writeHNT("STCU", mCurrent);
|
||||||
|
|
||||||
|
if (mDamage)
|
||||||
|
esm.writeHNT("STDF", mDamage);
|
||||||
|
|
||||||
|
if (mProgress)
|
||||||
|
esm.writeHNT("STPR", mProgress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template struct ESM::StatState<int>;
|
||||||
|
template struct ESM::StatState<float>;
|
|
@ -1,11 +1,11 @@
|
||||||
#ifndef OPENMW_ESM_STATSTATE_H
|
#ifndef OPENMW_ESM_STATSTATE_H
|
||||||
#define OPENMW_ESM_STATSTATE_H
|
#define OPENMW_ESM_STATSTATE_H
|
||||||
|
|
||||||
#include "esmreader.hpp"
|
|
||||||
#include "esmwriter.hpp"
|
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
|
class ESMReader;
|
||||||
|
class ESMWriter;
|
||||||
|
|
||||||
// format 0, saved games only
|
// format 0, saved games only
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -23,48 +23,6 @@ namespace ESM
|
||||||
void load (ESMReader &esm);
|
void load (ESMReader &esm);
|
||||||
void save (ESMWriter &esm) const;
|
void save (ESMWriter &esm) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
StatState<T>::StatState() : mBase (0), mMod (0), mCurrent (0), mDamage (0), mProgress (0) {}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void StatState<T>::load (ESMReader &esm)
|
|
||||||
{
|
|
||||||
esm.getHNT (mBase, "STBA");
|
|
||||||
|
|
||||||
mMod = 0;
|
|
||||||
esm.getHNOT (mMod, "STMO");
|
|
||||||
mCurrent = 0;
|
|
||||||
esm.getHNOT (mCurrent, "STCU");
|
|
||||||
|
|
||||||
// mDamage was changed to a float; ensure backwards compatibility
|
|
||||||
T oldDamage = 0;
|
|
||||||
esm.getHNOT(oldDamage, "STDA");
|
|
||||||
mDamage = static_cast<float>(oldDamage);
|
|
||||||
|
|
||||||
esm.getHNOT (mDamage, "STDF");
|
|
||||||
|
|
||||||
mProgress = 0;
|
|
||||||
esm.getHNOT (mProgress, "STPR");
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
void StatState<T>::save (ESMWriter &esm) const
|
|
||||||
{
|
|
||||||
esm.writeHNT ("STBA", mBase);
|
|
||||||
|
|
||||||
if (mMod != 0)
|
|
||||||
esm.writeHNT ("STMO", mMod);
|
|
||||||
|
|
||||||
if (mCurrent)
|
|
||||||
esm.writeHNT ("STCU", mCurrent);
|
|
||||||
|
|
||||||
if (mDamage)
|
|
||||||
esm.writeHNT ("STDF", mDamage);
|
|
||||||
|
|
||||||
if (mProgress)
|
|
||||||
esm.writeHNT ("STPR", mProgress);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -523,12 +523,8 @@ void RenderManager::destroyAllResources()
|
||||||
|
|
||||||
bool RenderManager::checkTexture(MyGUI::ITexture* _texture)
|
bool RenderManager::checkTexture(MyGUI::ITexture* _texture)
|
||||||
{
|
{
|
||||||
for (MapTexture::const_iterator item = mTextures.begin(); item != mTextures.end(); ++item)
|
// We support external textures that aren't registered via this manager, so can't implement this method sensibly.
|
||||||
{
|
return true;
|
||||||
if (item->second == _texture)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue