1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-07-04 02:21:34 +00:00

Resolved conflicts and build fixes.

This commit is contained in:
cc9cii 2018-10-05 21:54:29 +10:00
parent f456174af8
commit 4cd4cf8479
14 changed files with 1048 additions and 893 deletions

View file

@ -378,7 +378,7 @@ public:
bool isDeleted = false; bool isDeleted = false;
faction.load(esm, isDeleted); faction.load(esm, isDeleted);
std::string id = Misc::StringUtils::toLower(faction.mId); std::string id = Misc::StringUtils::lowerCase(faction.mId);
for (std::map<std::string, int>::const_iterator it = faction.mReactions.begin(); it != faction.mReactions.end(); ++it) for (std::map<std::string, int>::const_iterator it = faction.mReactions.begin(); it != faction.mReactions.end(); ++it)
{ {

View file

@ -18,11 +18,8 @@ namespace MWClass
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const void Static::insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const
{ {
MWWorld::LiveCellRef<ESM::Static> *ref =
ptr.get<ESM::Static>();
if (!model.empty()) { if (!model.empty()) {
renderingInterface.getObjects().insertModel(ptr, model, !ref->mBase->mPersistent); renderingInterface.getObjects().insertModel(ptr, model);
} }
} }

View file

@ -27,7 +27,7 @@
#include "creaturestats.hpp" #include "creaturestats.hpp"
#include "security.hpp" #include "security.hpp"
#include <openengine/misc/rng.hpp> #include <components/misc/rng.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
@ -222,7 +222,7 @@ std::string CharacterController::chooseRandomGroup (const std::string& prefix, i
while (mAnimation->hasAnimation(prefix + Ogre::StringConverter::toString(numAnims+1))) while (mAnimation->hasAnimation(prefix + Ogre::StringConverter::toString(numAnims+1)))
++numAnims; ++numAnims;
int roll = OEngine::Misc::Rng::rollDice(numAnims) + 1; // [1, numAnims] int roll = Misc::Rng::rollDice(numAnims) + 1; // [1, numAnims]
if (num) if (num)
*num = roll; *num = roll;
return prefix + Ogre::StringConverter::toString(roll); return prefix + Ogre::StringConverter::toString(roll);
@ -831,7 +831,7 @@ bool CharacterController::updateCreatureState()
} }
if (weapType != WeapType_Spell || !mAnimation->hasAnimation("spellcast")) // Not all creatures have a dedicated spellcast animation if (weapType != WeapType_Spell || !mAnimation->hasAnimation("spellcast")) // Not all creatures have a dedicated spellcast animation
{ {
int roll = OEngine::Misc::Rng::rollDice(3); // [0, 2] int roll = Misc::Rng::rollDice(3); // [0, 2]
if (roll == 0) if (roll == 0)
mCurrentWeapon = "attack1"; mCurrentWeapon = "attack1";
else if (roll == 1) else if (roll == 1)
@ -1127,7 +1127,7 @@ bool CharacterController::updateWeaponState()
// most creatures don't actually have an attack wind-up animation, so use a uniform random value // most creatures don't actually have an attack wind-up animation, so use a uniform random value
// (even some creatures that can use weapons don't have a wind-up animation either, e.g. Rieklings) // (even some creatures that can use weapons don't have a wind-up animation either, e.g. Rieklings)
// Note: vanilla MW uses a random value for *all* non-player actors, but we probably don't need to go that far. // Note: vanilla MW uses a random value for *all* non-player actors, but we probably don't need to go that far.
attackStrength = std::min(1.f, 0.1f + OEngine::Misc::Rng::rollClosedProbability()); attackStrength = std::min(1.f, 0.1f + Misc::Rng::rollClosedProbability());
} }
if(mWeaponType != WeapType_Crossbow && mWeaponType != WeapType_BowAndArrow) if(mWeaponType != WeapType_Crossbow && mWeaponType != WeapType_BowAndArrow)

View file

@ -249,7 +249,7 @@ void Animation::addAnimSource(const std::string &model)
return; return;
std::string kfname = model; std::string kfname = model;
Misc::StringUtils::toLower(kfname); Misc::StringUtils::lowerCaseInPlace(kfname);
if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0) if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0)
kfname.replace(kfname.size()-4, 4, ".kf"); kfname.replace(kfname.size()-4, 4, ".kf");
@ -430,8 +430,12 @@ NifOgre::TextKeyMap::const_iterator Animation::findGroupStart(const NifOgre::Tex
NifOgre::TextKeyMap::const_iterator iter(keys.begin()); NifOgre::TextKeyMap::const_iterator iter(keys.begin());
for(;iter != keys.end();++iter) for(;iter != keys.end();++iter)
{ {
std::string kfname = model; if(iter->second.compare(0, groupname.size(), groupname) == 0 &&
Misc::StringUtils::lowerCaseInPlace(kfname); iter->second.compare(groupname.size(), 2, ": ") == 0)
break;
}
return iter;
}
bool Animation::hasAnimation(const std::string &anim) bool Animation::hasAnimation(const std::string &anim)

View file

@ -466,8 +466,8 @@ void SkyManager::updateRain(float dt)
// TODO: handle rain settings from Morrowind.ini // TODO: handle rain settings from Morrowind.ini
const float rangeRandom = 100; const float rangeRandom = 100;
float xOffs = OEngine::Misc::Rng::rollProbability() * rangeRandom - (rangeRandom / 2); float xOffs = Misc::Rng::rollProbability() * rangeRandom - (rangeRandom / 2);
float yOffs = OEngine::Misc::Rng::rollProbability() * rangeRandom - (rangeRandom / 2); float yOffs = Misc::Rng::rollProbability() * rangeRandom - (rangeRandom / 2);
// Create a separate node to control the offset, since a node with setInheritOrientation(false) will still // Create a separate node to control the offset, since a node with setInheritOrientation(false) will still
// consider the orientation of the parent node for its position, just not for its orientation // consider the orientation of the parent node for its position, just not for its orientation

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -243,11 +243,14 @@ namespace Gui
std::string textureName = name; std::string textureName = name;
Ogre::Image image; Ogre::Image image;
image.loadDynamicImage(&textureData[0], width, height, Ogre::PF_BYTE_RGBA); image.loadDynamicImage(&textureData[0], width, height, Ogre::PF_BYTE_RGBA);
Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual(textureName, if (!Ogre::TextureManager::getSingleton().resourceExists(textureName))
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, {
Ogre::TEX_TYPE_2D, Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual(textureName,
width, height, 0, Ogre::PF_BYTE_RGBA); Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
texture->loadImage(image); Ogre::TEX_TYPE_2D,
width, height, 0, Ogre::PF_BYTE_RGBA);
texture->loadImage(image);
}
if (exportToFile) if (exportToFile)
image.save(resourceName + ".png"); image.save(resourceName + ".png");

View file

@ -73,7 +73,6 @@ public:
static void lowerCaseInPlace(std::string &inout) { static void lowerCaseInPlace(std::string &inout) {
for (unsigned int i=0; i<inout.size(); ++i) for (unsigned int i=0; i<inout.size(); ++i)
inout[i] = tolower(inout[i]); inout[i] = tolower(inout[i]);
return inout;
} }
/// Returns lower case copy of input string /// Returns lower case copy of input string

View file

@ -135,7 +135,7 @@ void ManualBulletShapeLoader::loadResource(Ogre::Resource *resource)
// FIXME: the .kf has to be loaded both for rendering and physics, ideally it should be opened once and then reused // FIXME: the .kf has to be loaded both for rendering and physics, ideally it should be opened once and then reused
mControlledNodes.clear(); mControlledNodes.clear();
std::string kfname = mResourceName.substr(0, mResourceName.length()-7); std::string kfname = mResourceName.substr(0, mResourceName.length()-7);
Misc::StringUtils::toLower(kfname); Misc::StringUtils::lowerCaseInPlace(kfname);
if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0) if(kfname.size() > 4 && kfname.compare(kfname.size()-4, 4, ".nif") == 0)
kfname.replace(kfname.size()-4, 4, ".kf"); kfname.replace(kfname.size()-4, 4, ".kf");
if (Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(kfname)) if (Ogre::ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(kfname))

View file

@ -711,7 +711,7 @@ private:
std::string fullname = name+"@index="+Ogre::StringConverter::toString(shape->recIndex); std::string fullname = name+"@index="+Ogre::StringConverter::toString(shape->recIndex);
if(shape->name.length() > 0) if(shape->name.length() > 0)
fullname += "@shape="+shape->name; fullname += "@shape="+shape->name;
Misc::StringUtils::toLower(fullname); Misc::StringUtils::lowerCaseInPlace(fullname);
Ogre::MeshManager &meshMgr = Ogre::MeshManager::getSingleton(); Ogre::MeshManager &meshMgr = Ogre::MeshManager::getSingleton();
if(meshMgr.getByName(fullname).isNull()) if(meshMgr.getByName(fullname).isNull())
@ -944,7 +944,7 @@ private:
std::string fullname = name+"@index="+Ogre::StringConverter::toString(partnode->recIndex); std::string fullname = name+"@index="+Ogre::StringConverter::toString(partnode->recIndex);
if(partnode->name.length() > 0) if(partnode->name.length() > 0)
fullname += "@type="+partnode->name; fullname += "@type="+partnode->name;
Misc::StringUtils::toLower(fullname); Misc::StringUtils::lowerCaseInPlace(fullname);
Ogre::ParticleSystem *partsys = sceneNode->getCreator()->createParticleSystem(); Ogre::ParticleSystem *partsys = sceneNode->getCreator()->createParticleSystem();
@ -1172,7 +1172,7 @@ private:
nextpos = std::distance(str.begin(), ++last); nextpos = std::distance(str.begin(), ++last);
} }
std::string result = str.substr(pos, nextpos-pos); std::string result = str.substr(pos, nextpos-pos);
textkeys.insert(std::make_pair(tk->list[i].time, Misc::StringUtils::toLower(result))); textkeys.insert(std::make_pair(tk->list[i].time, Misc::StringUtils::lowerCase(result)));
pos = nextpos; pos = nextpos;
} }
@ -1377,7 +1377,7 @@ ObjectScenePtr Loader::createObjects(Ogre::SceneNode *parentNode, std::string na
{ {
ObjectScenePtr scene = ObjectScenePtr (new ObjectScene(parentNode->getCreator())); ObjectScenePtr scene = ObjectScenePtr (new ObjectScene(parentNode->getCreator()));
Misc::StringUtils::toLower(name); Misc::StringUtils::lowerCaseInPlace(name);
NIFObjectLoader::load(parentNode, scene, name, group); NIFObjectLoader::load(parentNode, scene, name, group);
for(size_t i = 0;i < scene->mEntities.size();i++) for(size_t i = 0;i < scene->mEntities.size();i++)
@ -1399,7 +1399,7 @@ ObjectScenePtr Loader::createObjects(Ogre::Entity *parent, const std::string &bo
{ {
ObjectScenePtr scene = ObjectScenePtr (new ObjectScene(parentNode->getCreator())); ObjectScenePtr scene = ObjectScenePtr (new ObjectScene(parentNode->getCreator()));
Misc::StringUtils::toLower(name); Misc::StringUtils::lowerCaseInPlace(name);
NIFObjectLoader::load(parentNode, scene, name, group); NIFObjectLoader::load(parentNode, scene, name, group);
bool isskinned = false; bool isskinned = false;
@ -1422,8 +1422,8 @@ ObjectScenePtr Loader::createObjects(Ogre::Entity *parent, const std::string &bo
// accepts anything named "filter*" or "tri filter*" // accepts anything named "filter*" or "tri filter*"
std::string filter = "@shape=tri "+bonefilter; std::string filter = "@shape=tri "+bonefilter;
std::string filter2 = "@shape="+bonefilter; std::string filter2 = "@shape="+bonefilter;
Misc::StringUtils::toLower(filter); Misc::StringUtils::lowerCaseInPlace(filter);
Misc::StringUtils::toLower(filter2); Misc::StringUtils::lowerCaseInPlace(filter2);
for(size_t i = 0;i < scene->mEntities.size();i++) for(size_t i = 0;i < scene->mEntities.size();i++)
{ {
Ogre::Entity *entity = scene->mEntities[i]; Ogre::Entity *entity = scene->mEntities[i];
@ -1465,7 +1465,7 @@ ObjectScenePtr Loader::createObjectBase(Ogre::SceneNode *parentNode, std::string
{ {
ObjectScenePtr scene = ObjectScenePtr (new ObjectScene(parentNode->getCreator())); ObjectScenePtr scene = ObjectScenePtr (new ObjectScene(parentNode->getCreator()));
Misc::StringUtils::toLower(name); Misc::StringUtils::lowerCaseInPlace(name);
NIFObjectLoader::load(parentNode, scene, name, group, 0xC0000000); NIFObjectLoader::load(parentNode, scene, name, group, 0xC0000000);
if(scene->mSkelBase) if(scene->mSkelBase)

View file

@ -12,7 +12,7 @@
#include <OgreSceneNode.h> #include <OgreSceneNode.h>
#include <OgreSceneManager.h> #include <OgreSceneManager.h>
#include <openengine/misc/rng.hpp> #include <components/misc/rng.hpp>
/* FIXME: "Nif" isn't really an appropriate emitter name. */ /* FIXME: "Nif" isn't really an appropriate emitter name. */
class NifEmitter : public Ogre::ParticleEmitter class NifEmitter : public Ogre::ParticleEmitter
@ -173,7 +173,7 @@ public:
Ogre::Real& timeToLive = particle->timeToLive; Ogre::Real& timeToLive = particle->timeToLive;
#endif #endif
Ogre::Node* emitterBone = mEmitterBones.at(OEngine::Misc::Rng::rollDice(mEmitterBones.size())); Ogre::Node* emitterBone = mEmitterBones.at(Misc::Rng::rollDice(mEmitterBones.size()));
position = xOff + yOff + zOff + position = xOff + yOff + zOff +
mParticleBone->_getDerivedOrientation().Inverse() * (emitterBone->_getDerivedPosition() mParticleBone->_getDerivedOrientation().Inverse() * (emitterBone->_getDerivedPosition()

View file

@ -23,7 +23,7 @@ set(OENGINE_BULLET
bullet/trace.h bullet/trace.h
) )
set(OENGINE_ALL ${OENGINE_GUI} ${OENGINE_BULLET}) set(OENGINE_ALL ${OENGINE_OGRE} ${OENGINE_GUI} ${OENGINE_BULLET})
set(OENGINE_LIBRARY "oengine") set(OENGINE_LIBRARY "oengine")
set(OENGINE_LIBRARY ${OENGINE_LIBRARY} PARENT_SCOPE) set(OENGINE_LIBRARY ${OENGINE_LIBRARY} PARENT_SCOPE)

View file

@ -10,7 +10,7 @@
#include <stdexcept> #include <stdexcept>
#include <openengine/misc/rng.hpp> #include <components/misc/rng.hpp>
#include <extern/shiny/Main/Factory.hpp> #include <extern/shiny/Main/Factory.hpp>
@ -147,7 +147,7 @@ namespace Render
void SelectionBuffer::getNextColour () void SelectionBuffer::getNextColour ()
{ {
Ogre::ARGB color = static_cast<Ogre::ARGB>(OEngine::Misc::Rng::rollClosedProbability() * std::numeric_limits<Ogre::uint32>::max()); Ogre::ARGB color = static_cast<Ogre::ARGB>(Misc::Rng::rollClosedProbability() * std::numeric_limits<Ogre::uint32>::max());
if (mCurrentColour.getAsARGB () == color) if (mCurrentColour.getAsARGB () == color)
{ {