forked from mirror/openmw-tes3mp
Merge remote-tracking branch 'scrawl/master'
This commit is contained in:
commit
e63b4964b2
63 changed files with 346 additions and 191 deletions
|
@ -263,7 +263,7 @@ namespace
|
|||
|
||||
static const char *sCreatureTypes[] =
|
||||
{
|
||||
"Creature", "Deadra", "Undead", "Humanoid", 0
|
||||
"Creature", "Daedra", "Undead", "Humanoid", 0
|
||||
};
|
||||
|
||||
static const char *sWeaponTypes[] =
|
||||
|
@ -342,4 +342,4 @@ std::vector<std::string> CSMWorld::Columns::getEnums (ColumnId column)
|
|||
}
|
||||
|
||||
return enums;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,12 +309,16 @@ std::string OMW::Engine::loadSettings (Settings::Manager & settings)
|
|||
|
||||
// load nif overrides
|
||||
NifOverrides::Overrides nifOverrides;
|
||||
if (boost::filesystem::exists(mCfgMgr.getLocalPath().string() + "/transparency-overrides.cfg"))
|
||||
nifOverrides.loadTransparencyOverrides(mCfgMgr.getLocalPath().string() + "/transparency-overrides.cfg");
|
||||
else if (boost::filesystem::exists(mCfgMgr.getGlobalPath().string() + "/transparency-overrides.cfg"))
|
||||
nifOverrides.loadTransparencyOverrides(mCfgMgr.getGlobalPath().string() + "/transparency-overrides.cfg");
|
||||
|
||||
settings.setBool("hardware cursors", "GUI", true);
|
||||
std::string transparencyOverrides = "/transparency-overrides.cfg";
|
||||
std::string materialOverrides = "/material-overrides.cfg";
|
||||
if (boost::filesystem::exists(mCfgMgr.getLocalPath().string() + transparencyOverrides))
|
||||
nifOverrides.loadTransparencyOverrides(mCfgMgr.getLocalPath().string() + transparencyOverrides);
|
||||
else if (boost::filesystem::exists(mCfgMgr.getGlobalPath().string() + transparencyOverrides))
|
||||
nifOverrides.loadTransparencyOverrides(mCfgMgr.getGlobalPath().string() + transparencyOverrides);
|
||||
if (boost::filesystem::exists(mCfgMgr.getLocalPath().string() + materialOverrides))
|
||||
nifOverrides.loadMaterialOverrides(mCfgMgr.getLocalPath().string() + materialOverrides);
|
||||
else if (boost::filesystem::exists(mCfgMgr.getGlobalPath().string() + materialOverrides))
|
||||
nifOverrides.loadMaterialOverrides(mCfgMgr.getGlobalPath().string() + materialOverrides);
|
||||
|
||||
return settingspath;
|
||||
}
|
||||
|
|
|
@ -84,10 +84,10 @@ namespace MWClass
|
|||
|
||||
data->mCreatureStats.getAiSequence().fill(ref->mBase->mAiPackage);
|
||||
|
||||
data->mCreatureStats.setAiSetting (0, ref->mBase->mAiData.mHello);
|
||||
data->mCreatureStats.setAiSetting (1, ref->mBase->mAiData.mFight);
|
||||
data->mCreatureStats.setAiSetting (2, ref->mBase->mAiData.mFlee);
|
||||
data->mCreatureStats.setAiSetting (3, ref->mBase->mAiData.mAlarm);
|
||||
data->mCreatureStats.setAiSetting (MWMechanics::CreatureStats::AI_Hello, ref->mBase->mAiData.mHello);
|
||||
data->mCreatureStats.setAiSetting (MWMechanics::CreatureStats::AI_Fight, ref->mBase->mAiData.mFight);
|
||||
data->mCreatureStats.setAiSetting (MWMechanics::CreatureStats::AI_Flee, ref->mBase->mAiData.mFlee);
|
||||
data->mCreatureStats.setAiSetting (MWMechanics::CreatureStats::AI_Alarm, ref->mBase->mAiData.mAlarm);
|
||||
|
||||
// spells
|
||||
for (std::vector<std::string>::const_iterator iter (ref->mBase->mSpells.mList.begin());
|
||||
|
@ -413,6 +413,14 @@ namespace MWClass
|
|||
return MWWorld::Ptr(&cell.mCreatures.insert(*ref), &cell);
|
||||
}
|
||||
|
||||
bool Creature::isFlying(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return ref->mBase->mFlags & ESM::Creature::Flies;
|
||||
}
|
||||
|
||||
int Creature::getSndGenTypeFromName(const MWWorld::Ptr &ptr, const std::string &name)
|
||||
{
|
||||
if(name == "left")
|
||||
|
|
|
@ -99,6 +99,8 @@ namespace MWClass
|
|||
isActor() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool isFlying (const MWWorld::Ptr &ptr) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -309,10 +309,10 @@ namespace MWClass
|
|||
|
||||
data->mNpcStats.getAiSequence().fill(ref->mBase->mAiPackage);
|
||||
|
||||
data->mNpcStats.setAiSetting (0, ref->mBase->mAiData.mHello);
|
||||
data->mNpcStats.setAiSetting (1, ref->mBase->mAiData.mFight);
|
||||
data->mNpcStats.setAiSetting (2, ref->mBase->mAiData.mFlee);
|
||||
data->mNpcStats.setAiSetting (3, ref->mBase->mAiData.mAlarm);
|
||||
data->mNpcStats.setAiSetting (MWMechanics::CreatureStats::AI_Hello, ref->mBase->mAiData.mHello);
|
||||
data->mNpcStats.setAiSetting (MWMechanics::CreatureStats::AI_Fight, ref->mBase->mAiData.mFight);
|
||||
data->mNpcStats.setAiSetting (MWMechanics::CreatureStats::AI_Flee, ref->mBase->mAiData.mFlee);
|
||||
data->mNpcStats.setAiSetting (MWMechanics::CreatureStats::AI_Alarm, ref->mBase->mAiData.mAlarm);
|
||||
|
||||
// spells
|
||||
for (std::vector<std::string>::const_iterator iter (ref->mBase->mSpells.mList.begin());
|
||||
|
@ -613,7 +613,7 @@ namespace MWClass
|
|||
// 'ptr' is losing health. Play a 'hit' voiced dialog entry if not already saying
|
||||
// something, alert the character controller, scripts, etc.
|
||||
|
||||
MWBase::Environment::get().getDialogueManager()->say(ptr, "hit");
|
||||
MWBase::Environment::get().getDialogueManager()->say(ptr, "thief");
|
||||
|
||||
if(object.isEmpty())
|
||||
{
|
||||
|
|
|
@ -279,7 +279,8 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
|
|||
|
||||
case SelectWrapper::Function_AiSetting:
|
||||
|
||||
return MWWorld::Class::get (mActor).getCreatureStats (mActor).getAiSetting (select.getArgument());
|
||||
return MWWorld::Class::get (mActor).getCreatureStats (mActor).getAiSetting (
|
||||
(MWMechanics::CreatureStats::AiSetting)select.getArgument()).getModified();
|
||||
|
||||
case SelectWrapper::Function_PcAttribute:
|
||||
|
||||
|
@ -514,7 +515,8 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
|
|||
|
||||
case SelectWrapper::Function_PcVampire:
|
||||
|
||||
return MWWorld::Class::get (player).getNpcStats (player).isVampire();
|
||||
return MWWorld::Class::get (player).getCreatureStats(player).getMagicEffects().
|
||||
get(ESM::MagicEffect::Vampirism).mMagnitude > 0;
|
||||
|
||||
case SelectWrapper::Function_TalkedToPc:
|
||||
|
||||
|
|
|
@ -76,10 +76,7 @@ void ContainerItemModel::copyItem (const ItemStack& item, size_t count)
|
|||
const MWWorld::Ptr& source = mItemSources[mItemSources.size()-1];
|
||||
if (item.mBase.getContainerStore() == &source.getClass().getContainerStore(source))
|
||||
throw std::runtime_error("Item to copy needs to be from a different container!");
|
||||
int origCount = item.mBase.getRefData().getCount();
|
||||
item.mBase.getRefData().setCount(count);
|
||||
source.getClass().getContainerStore(source).add(item.mBase, source);
|
||||
item.mBase.getRefData().setCount(origCount);
|
||||
source.getClass().getContainerStore(source).add(item.mBase, count, source);
|
||||
}
|
||||
|
||||
void ContainerItemModel::removeItem (const ItemStack& item, size_t count)
|
||||
|
|
|
@ -42,10 +42,7 @@ void InventoryItemModel::copyItem (const ItemStack& item, size_t count)
|
|||
{
|
||||
if (item.mBase.getContainerStore() == &mActor.getClass().getContainerStore(mActor))
|
||||
throw std::runtime_error("Item to copy needs to be from a different container!");
|
||||
int origCount = item.mBase.getRefData().getCount();
|
||||
item.mBase.getRefData().setCount(count);
|
||||
mActor.getClass().getContainerStore(mActor).add(item.mBase, mActor);
|
||||
item.mBase.getRefData().setCount(origCount);
|
||||
mActor.getClass().getContainerStore(mActor).add(item.mBase, count, mActor);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -364,10 +364,7 @@ namespace MWGui
|
|||
MWWorld::ContainerStore& invStore = MWWorld::Class::get(mPtr).getContainerStore(mPtr);
|
||||
MWWorld::ContainerStoreIterator it = invStore.begin();
|
||||
|
||||
int origCount = ptr.getRefData().getCount();
|
||||
ptr.getRefData().setCount(mDragAndDrop->mDraggedCount);
|
||||
it = invStore.add(ptr, mPtr);
|
||||
ptr.getRefData().setCount(origCount);
|
||||
it = invStore.add(ptr, mDragAndDrop->mDraggedCount, mPtr);
|
||||
|
||||
mDragAndDrop->mSourceModel->removeItem(mDragAndDrop->mItem, mDragAndDrop->mDraggedCount);
|
||||
ptr = *it;
|
||||
|
@ -521,7 +518,7 @@ namespace MWGui
|
|||
// add to player inventory
|
||||
// can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWWorld::Ptr newObject = *MWWorld::Class::get (player).getContainerStore (player).add (object, player);
|
||||
MWWorld::Ptr newObject = *player.getClass().getContainerStore (player).add (object, object.getRefData().getCount(), player);
|
||||
// remove from world
|
||||
MWBase::Environment::get().getWorld()->deleteObject (object);
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ namespace MWGui
|
|||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
|
||||
if (spells.getSelectedSpell() == mSpellToDelete)
|
||||
if (MWBase::Environment::get().getWindowManager()->getSelectedSpell() == mSpellToDelete)
|
||||
MWBase::Environment::get().getWindowManager()->unsetSelectedSpell();
|
||||
|
||||
spells.remove(mSpellToDelete);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _MWINPUT_MWINPUTMANAGERIMP_H
|
||||
#define _MWINPUT_MWINPUTMANAGERIMP_H
|
||||
#ifndef MWINPUT_MWINPUTMANAGERIMP_H
|
||||
#define MWINPUT_MWINPUTMANAGERIMP_H
|
||||
|
||||
#include "../mwgui/mode.hpp"
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace MWMechanics
|
|||
float d = sqrt((actorpos.pos[0] - playerpos.pos[0])*(actorpos.pos[0] - playerpos.pos[0])
|
||||
+(actorpos.pos[1] - playerpos.pos[1])*(actorpos.pos[1] - playerpos.pos[1])
|
||||
+(actorpos.pos[2] - playerpos.pos[2])*(actorpos.pos[2] - playerpos.pos[2]));
|
||||
float fight = ptr.getClass().getCreatureStats(ptr).getAiSetting(1);
|
||||
float fight = ptr.getClass().getCreatureStats(ptr).getAiSetting(CreatureStats::AI_Fight).getModified();
|
||||
float disp = 100; //creatures don't have disposition, so set it to 100 by default
|
||||
if(ptr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ namespace MWMechanics
|
|||
|
||||
now += creatureStats.getActiveSpells().getMagicEffects();
|
||||
|
||||
MagicEffects diff = MagicEffects::diff (creatureStats.getMagicEffects(), now);
|
||||
//MagicEffects diff = MagicEffects::diff (creatureStats.getMagicEffects(), now);
|
||||
|
||||
creatureStats.setMagicEffects(now);
|
||||
|
||||
|
@ -341,6 +341,30 @@ namespace MWMechanics
|
|||
creatureStats.setDynamic(i, stat);
|
||||
}
|
||||
|
||||
// AI setting modifiers
|
||||
int creature = !ptr.getClass().isNpc();
|
||||
if (creature && ptr.get<ESM::Creature>()->mBase->mData.mType == ESM::Creature::Humanoid)
|
||||
creature = false;
|
||||
// Note: the Creature variants only work on normal creatures, not on daedra or undead creatures.
|
||||
if (!creature || ptr.get<ESM::Creature>()->mBase->mData.mType == ESM::Creature::Creatures)
|
||||
{
|
||||
Stat<int> stat = creatureStats.getAiSetting(CreatureStats::AI_Fight);
|
||||
stat.setModifier(creatureStats.getMagicEffects().get(ESM::MagicEffect::FrenzyHumanoid+creature).mMagnitude
|
||||
- creatureStats.getMagicEffects().get(ESM::MagicEffect::CalmHumanoid+creature).mMagnitude);
|
||||
creatureStats.setAiSetting(CreatureStats::AI_Fight, stat);
|
||||
|
||||
stat = creatureStats.getAiSetting(CreatureStats::AI_Flee);
|
||||
stat.setModifier(creatureStats.getMagicEffects().get(ESM::MagicEffect::DemoralizeHumanoid+creature).mMagnitude
|
||||
- creatureStats.getMagicEffects().get(ESM::MagicEffect::RallyHumanoid+creature).mMagnitude);
|
||||
creatureStats.setAiSetting(CreatureStats::AI_Flee, stat);
|
||||
}
|
||||
if (creature && ptr.get<ESM::Creature>()->mBase->mData.mType == ESM::Creature::Undead)
|
||||
{
|
||||
Stat<int> stat = creatureStats.getAiSetting(CreatureStats::AI_Flee);
|
||||
stat.setModifier(creatureStats.getMagicEffects().get(ESM::MagicEffect::TurnUndead).mMagnitude);
|
||||
creatureStats.setAiSetting(CreatureStats::AI_Flee, stat);
|
||||
}
|
||||
|
||||
// Apply disintegration (reduces item health)
|
||||
float disintegrateWeapon = effects.get(ESM::MagicEffect::DisintegrateWeapon).mMagnitude;
|
||||
if (disintegrateWeapon > 0)
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace MWMechanics
|
|||
return mLevel;
|
||||
}
|
||||
|
||||
int CreatureStats::getAiSetting (int index) const
|
||||
Stat<int> CreatureStats::getAiSetting (AiSetting index) const
|
||||
{
|
||||
assert (index>=0 && index<4);
|
||||
return mAiSettings[index];
|
||||
|
@ -240,12 +240,18 @@ namespace MWMechanics
|
|||
mAttackingOrSpell = attackingOrSpell;
|
||||
}
|
||||
|
||||
void CreatureStats::setAiSetting (int index, int value)
|
||||
void CreatureStats::setAiSetting (AiSetting index, Stat<int> value)
|
||||
{
|
||||
assert (index>=0 && index<4);
|
||||
mAiSettings[index] = value;
|
||||
}
|
||||
|
||||
void CreatureStats::setAiSetting (AiSetting index, int base)
|
||||
{
|
||||
Stat<int> stat(base);
|
||||
setAiSetting(index, stat);
|
||||
}
|
||||
|
||||
bool CreatureStats::isDead() const
|
||||
{
|
||||
return mDead;
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace MWMechanics
|
|||
Spells mSpells;
|
||||
ActiveSpells mActiveSpells;
|
||||
MagicEffects mMagicEffects;
|
||||
int mAiSettings[4];
|
||||
Stat<int> mAiSettings[4];
|
||||
AiSequence mAiSequence;
|
||||
float mLevelHealthBonus;
|
||||
bool mDead;
|
||||
|
@ -85,9 +85,6 @@ namespace MWMechanics
|
|||
|
||||
int getLevel() const;
|
||||
|
||||
int getAiSetting (int index) const;
|
||||
///< 0: hello, 1 fight, 2 flee, 3 alarm
|
||||
|
||||
Spells & getSpells();
|
||||
|
||||
ActiveSpells & getActiveSpells();
|
||||
|
@ -125,8 +122,16 @@ namespace MWMechanics
|
|||
|
||||
void setLevel(int level);
|
||||
|
||||
void setAiSetting (int index, int value);
|
||||
///< 0: hello, 1 fight, 2 flee, 3 alarm
|
||||
enum AiSetting
|
||||
{
|
||||
AI_Hello,
|
||||
AI_Fight,
|
||||
AI_Flee,
|
||||
AI_Alarm
|
||||
};
|
||||
void setAiSetting (AiSetting index, Stat<int> value);
|
||||
void setAiSetting (AiSetting index, int base);
|
||||
Stat<int> getAiSetting (AiSetting index) const;
|
||||
|
||||
const AiSequence& getAiSequence() const;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace MWMechanics
|
|||
|
||||
// Add the new item to player inventory and remove the old one
|
||||
store.remove(mOldItemPtr, 1, player);
|
||||
store.add(newItemPtr, player);
|
||||
store.add(newItemPtr, 1, player);
|
||||
|
||||
if(!mSelfEnchanting)
|
||||
payForEnchantment();
|
||||
|
|
|
@ -481,6 +481,8 @@ namespace MWMechanics
|
|||
if (playerStats.getDrawState() == MWMechanics::DrawState_Weapon)
|
||||
x += MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fDispWeaponDrawn")->getFloat();
|
||||
|
||||
x += ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Charm).mMagnitude;
|
||||
|
||||
int effective_disposition = std::max(0,std::min(int(x),100));//, normally clamped to [0..100] when used
|
||||
return effective_disposition;
|
||||
}
|
||||
|
@ -605,8 +607,12 @@ namespace MWMechanics
|
|||
{
|
||||
float s = int(r * fPerDieRollMult * fPerTempMult);
|
||||
|
||||
npcStats.setAiSetting (2, std::max(0, std::min(100, npcStats.getAiSetting (2) + int(std::max(iPerMinChange, s)))));
|
||||
npcStats.setAiSetting (1, std::max(0, std::min(100, npcStats.getAiSetting (1) + int(std::min(-iPerMinChange, -s)))));
|
||||
int flee = npcStats.getAiSetting(MWMechanics::CreatureStats::AI_Flee).getBase();
|
||||
int fight = npcStats.getAiSetting(MWMechanics::CreatureStats::AI_Fight).getBase();
|
||||
npcStats.setAiSetting (MWMechanics::CreatureStats::AI_Flee,
|
||||
std::max(0, std::min(100, flee + int(std::max(iPerMinChange, s)))));
|
||||
npcStats.setAiSetting (MWMechanics::CreatureStats::AI_Fight,
|
||||
std::max(0, std::min(100, fight + int(std::min(-iPerMinChange, -s)))));
|
||||
}
|
||||
|
||||
float c = -std::abs(int(r * fPerDieRollMult));
|
||||
|
@ -640,8 +646,12 @@ namespace MWMechanics
|
|||
{
|
||||
float s = c * fPerDieRollMult * fPerTempMult;
|
||||
|
||||
npcStats.setAiSetting (2, std::max(0, std::min(100, npcStats.getAiSetting (2) + std::min(-int(iPerMinChange), int(-s)))));
|
||||
npcStats.setAiSetting (1, std::max(0, std::min(100, npcStats.getAiSetting (1) + std::max(int(iPerMinChange), int(s)))));
|
||||
int flee = npcStats.getAiSetting (CreatureStats::AI_Flee).getBase();
|
||||
int fight = npcStats.getAiSetting (CreatureStats::AI_Fight).getBase();
|
||||
npcStats.setAiSetting (CreatureStats::AI_Flee,
|
||||
std::max(0, std::min(100, flee + std::min(-int(iPerMinChange), int(-s)))));
|
||||
npcStats.setAiSetting (CreatureStats::AI_Fight,
|
||||
std::max(0, std::min(100, fight + std::max(int(iPerMinChange), int(s)))));
|
||||
}
|
||||
x = int(-c * fPerDieRollMult);
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ MWMechanics::NpcStats::NpcStats()
|
|||
, mBounty (0)
|
||||
, mLevelProgress(0)
|
||||
, mDisposition(0)
|
||||
, mVampire (0)
|
||||
, mReputation(0)
|
||||
, mWerewolfKills (0)
|
||||
, mProfit(0)
|
||||
|
@ -318,16 +317,6 @@ void MWMechanics::NpcStats::setFactionReputation (const std::string& faction, in
|
|||
mFactionReputation[faction] = value;
|
||||
}
|
||||
|
||||
bool MWMechanics::NpcStats::isVampire() const
|
||||
{
|
||||
return mVampire;
|
||||
}
|
||||
|
||||
void MWMechanics::NpcStats::setVampire (bool set)
|
||||
{
|
||||
mVampire = set;
|
||||
}
|
||||
|
||||
int MWMechanics::NpcStats::getReputation() const
|
||||
{
|
||||
return mReputation;
|
||||
|
|
|
@ -50,7 +50,6 @@ namespace MWMechanics
|
|||
int mBounty;
|
||||
std::set<std::string> mExpelled;
|
||||
std::map<std::string, int> mFactionReputation;
|
||||
bool mVampire;
|
||||
int mReputation;
|
||||
int mWerewolfKills;
|
||||
int mProfit;
|
||||
|
@ -135,10 +134,6 @@ namespace MWMechanics
|
|||
|
||||
void setFactionReputation (const std::string& faction, int value);
|
||||
|
||||
bool isVampire() const;
|
||||
|
||||
void setVampire (bool set);
|
||||
|
||||
bool hasSkillsForRank (const std::string& factionId, int rank) const;
|
||||
|
||||
bool isWerewolf() const;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_RENDER_ACTIVATORANIMATION_H
|
||||
#define _GAME_RENDER_ACTIVATORANIMATION_H
|
||||
#ifndef GAME_RENDER_ACTIVATORANIMATION_H
|
||||
#define GAME_RENDER_ACTIVATORANIMATION_H
|
||||
|
||||
#include "animation.hpp"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_RENDER_ACTORS_H
|
||||
#define _GAME_RENDER_ACTORS_H
|
||||
#ifndef GAME_RENDER_ACTORS_H
|
||||
#define GAME_RENDER_ACTORS_H
|
||||
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
|
||||
|
|
|
@ -185,6 +185,7 @@ public:
|
|||
for(unsigned int i = 0;i < numsubs;++i)
|
||||
{
|
||||
Ogre::SubEntity* subEnt = entity->getSubEntity(i);
|
||||
sh::Factory::getInstance()._ensureMaterial(subEnt->getMaterial()->getName(), "Default");
|
||||
subEnt->setRenderQueueGroup(subEnt->getMaterial()->isTransparent() ? mTransQueue : mSolidQueue);
|
||||
}
|
||||
}
|
||||
|
@ -1188,6 +1189,7 @@ public:
|
|||
unsigned int numsubs = ent->getNumSubEntities();
|
||||
for(unsigned int i = 0;i < numsubs;++i)
|
||||
{
|
||||
sh::Factory::getInstance()._ensureMaterial(ent->getSubEntity(i)->getMaterial()->getName(), "Default");
|
||||
if(ent->getSubEntity(i)->getMaterial()->isTransparent())
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_RENDER_ANIMATION_H
|
||||
#define _GAME_RENDER_ANIMATION_H
|
||||
#ifndef GAME_RENDER_ANIMATION_H
|
||||
#define GAME_RENDER_ANIMATION_H
|
||||
|
||||
#include <OgreController.h>
|
||||
#include <OgreVector3.h>
|
||||
|
|
|
@ -140,8 +140,7 @@ namespace MWRender
|
|||
|
||||
void InventoryPreview::update(int sizeX, int sizeY)
|
||||
{
|
||||
// TODO: can we avoid this. Vampire state needs to be updated.
|
||||
mAnimation->rebuild();
|
||||
mAnimation->updateParts();
|
||||
|
||||
MWWorld::InventoryStore &inv = MWWorld::Class::get(mCharacter).getInventoryStore(mCharacter);
|
||||
MWWorld::ContainerStoreIterator iter = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||
|
@ -177,12 +176,8 @@ namespace MWRender
|
|||
groupname = "inventoryhandtohand";
|
||||
}
|
||||
|
||||
// TODO see above
|
||||
//if(groupname != mCurrentAnimGroup)
|
||||
//{
|
||||
mCurrentAnimGroup = groupname;
|
||||
mAnimation->play(mCurrentAnimGroup, 1, Animation::Group_All, false, 1.0f, "start", "stop", 0.0f, 0);
|
||||
//}
|
||||
mCurrentAnimGroup = groupname;
|
||||
mAnimation->play(mCurrentAnimGroup, 1, Animation::Group_All, false, 1.0f, "start", "stop", 0.0f, 0);
|
||||
|
||||
MWWorld::ContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
|
||||
if(torch != inv.end() && torch->getTypeName() == typeid(ESM::Light).name())
|
||||
|
@ -194,7 +189,6 @@ namespace MWRender
|
|||
else if(mAnimation->getInfo("torch"))
|
||||
mAnimation->disable("torch");
|
||||
|
||||
mAnimation->updateParts();
|
||||
mAnimation->runAnimation(0.0f);
|
||||
|
||||
mViewport->setDimensions (0, 0, std::min(1.f, float(sizeX) / float(512)), std::min(1.f, float(sizeY) / float(1024)));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_RENDER_CREATUREANIMATION_H
|
||||
#define _GAME_RENDER_CREATUREANIMATION_H
|
||||
#ifndef GAME_RENDER_CREATUREANIMATION_H
|
||||
#define GAME_RENDER_CREATUREANIMATION_H
|
||||
|
||||
#include "animation.hpp"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_RENDER_MWSCENE_H
|
||||
#define _GAME_RENDER_MWSCENE_H
|
||||
#ifndef GAME_RENDER_MWSCENE_H
|
||||
#define GAME_RENDER_MWSCENE_H
|
||||
|
||||
#include <utility>
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_RENDER_GLOBALMAP_H
|
||||
#define _GAME_RENDER_GLOBALMAP_H
|
||||
#ifndef GAME_RENDER_GLOBALMAP_H
|
||||
#define GAME_RENDER_GLOBALMAP_H
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_RENDER_LOCALMAP_H
|
||||
#define _GAME_RENDER_LOCALMAP_H
|
||||
#ifndef GAME_RENDER_LOCALMAP_H
|
||||
#define GAME_RENDER_LOCALMAP_H
|
||||
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
|
||||
|
|
|
@ -119,7 +119,8 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, int v
|
|||
mShowWeapons(false),
|
||||
mShowCarriedLeft(true),
|
||||
mFirstPersonOffset(0.f, 0.f, 0.f),
|
||||
mAlpha(1.f)
|
||||
mAlpha(1.f),
|
||||
mNpcType(Type_Normal)
|
||||
{
|
||||
mNpc = mPtr.get<ESM::NPC>()->mBase;
|
||||
|
||||
|
@ -157,8 +158,8 @@ void NpcAnimation::updateNpcBase()
|
|||
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Race *race = store.get<ESM::Race>().find(mNpc->mRace);
|
||||
bool isWerewolf = mPtr.getClass().getNpcStats(mPtr).isWerewolf();
|
||||
bool vampire = mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Vampirism).mMagnitude;
|
||||
bool isWerewolf = (mNpcType == Type_Werewolf);
|
||||
bool isVampire = (mNpcType == Type_Vampire);
|
||||
|
||||
if (isWerewolf)
|
||||
{
|
||||
|
@ -167,7 +168,7 @@ void NpcAnimation::updateNpcBase()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (vampire)
|
||||
if (isVampire)
|
||||
mHeadModel = getVampireHead(mNpc->mRace, mNpc->mFlags & ESM::NPC::Female);
|
||||
else
|
||||
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHead)->mModel;
|
||||
|
@ -221,11 +222,24 @@ void NpcAnimation::updateNpcBase()
|
|||
}
|
||||
|
||||
void NpcAnimation::updateParts()
|
||||
{
|
||||
{
|
||||
mAlpha = 1.f;
|
||||
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
|
||||
MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr);
|
||||
|
||||
NpcType curType = Type_Normal;
|
||||
if (cls.getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Vampirism).mMagnitude > 0)
|
||||
curType = Type_Vampire;
|
||||
if (cls.getNpcStats(mPtr).isWerewolf())
|
||||
curType = Type_Werewolf;
|
||||
|
||||
if (curType != mNpcType)
|
||||
{
|
||||
mNpcType = curType;
|
||||
rebuild();
|
||||
return;
|
||||
}
|
||||
|
||||
static const struct {
|
||||
int mSlot;
|
||||
int mBasePriority;
|
||||
|
@ -329,7 +343,7 @@ void NpcAnimation::updateParts()
|
|||
static const int Flag_Female = 1<<0;
|
||||
static const int Flag_FirstPerson = 1<<1;
|
||||
|
||||
bool isWerewolf = cls.getNpcStats(mPtr).isWerewolf();
|
||||
bool isWerewolf = (mNpcType == Type_Werewolf);
|
||||
int flags = (isWerewolf ? -1 : 0);
|
||||
if(!mNpc->isMale())
|
||||
flags |= Flag_Female;
|
||||
|
@ -736,6 +750,7 @@ void NpcAnimation::preRender(Ogre::Camera *camera)
|
|||
|
||||
void NpcAnimation::applyAlpha(float alpha, Ogre::Entity *ent, NifOgre::ObjectScenePtr scene)
|
||||
{
|
||||
sh::Factory::getInstance()._ensureMaterial(ent->getSubEntity(0)->getMaterial()->getName(), "Default");
|
||||
ent->getSubEntity(0)->setRenderQueueGroup(alpha != 1.f || ent->getSubEntity(0)->getMaterial()->isTransparent()
|
||||
? RQG_Alpha : RQG_Main);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_RENDER_NPCANIMATION_H
|
||||
#define _GAME_RENDER_NPCANIMATION_H
|
||||
#ifndef GAME_RENDER_NPCANIMATION_H
|
||||
#define GAME_RENDER_NPCANIMATION_H
|
||||
|
||||
#include "animation.hpp"
|
||||
|
||||
|
@ -55,6 +55,14 @@ private:
|
|||
bool mShowWeapons;
|
||||
bool mShowCarriedLeft;
|
||||
|
||||
enum NpcType
|
||||
{
|
||||
Type_Normal,
|
||||
Type_Werewolf,
|
||||
Type_Vampire
|
||||
};
|
||||
NpcType mNpcType;
|
||||
|
||||
int mVisibilityFlags;
|
||||
|
||||
int mPartslots[ESM::PRT_Count]; //Each part slot is taken by clothing, armor, or is empty
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_RENDER_OBJECTS_H
|
||||
#define _GAME_RENDER_OBJECTS_H
|
||||
#ifndef GAME_RENDER_OBJECTS_H
|
||||
#define GAME_RENDER_OBJECTS_H
|
||||
|
||||
#include <OgreColourValue.h>
|
||||
#include <OgreAxisAlignedBox.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_OCCLUSION_QUERY_H
|
||||
#define _GAME_OCCLUSION_QUERY_H
|
||||
#ifndef GAME_OCCLUSION_QUERY_H
|
||||
#define GAME_OCCLUSION_QUERY_H
|
||||
|
||||
#include <OgreRenderObjectListener.h>
|
||||
#include <OgreRenderQueueListener.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_RENDERING_INTERFACE_H
|
||||
#define _GAME_RENDERING_INTERFACE_H
|
||||
#ifndef GAME_RENDERING_INTERFACE_H
|
||||
#define GAME_RENDERING_INTERFACE_H
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _GAME_RENDERING_MANAGER_H
|
||||
#define _GAME_RENDERING_MANAGER_H
|
||||
#ifndef GAME_RENDERING_MANAGER_H
|
||||
#define GAME_RENDERING_MANAGER_H
|
||||
|
||||
#include "sky.hpp"
|
||||
#include "debugging.hpp"
|
||||
|
|
|
@ -225,7 +225,8 @@ namespace MWScript
|
|||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
runtime.push(MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSetting (mIndex));
|
||||
runtime.push(MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSetting (
|
||||
(MWMechanics::CreatureStats::AiSetting)mIndex).getModified());
|
||||
}
|
||||
};
|
||||
template<class R>
|
||||
|
@ -241,8 +242,11 @@ namespace MWScript
|
|||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).setAiSetting (mIndex,
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSetting (mIndex) + value);
|
||||
MWMechanics::CreatureStats::AiSetting setting
|
||||
= MWMechanics::CreatureStats::AiSetting(mIndex);
|
||||
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).setAiSetting (setting,
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSetting (setting).getBase() + value);
|
||||
}
|
||||
};
|
||||
template<class R>
|
||||
|
@ -258,8 +262,11 @@ namespace MWScript
|
|||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWWorld::Class::get (ptr).getCreatureStats (ptr).setAiSetting (mIndex,
|
||||
value);
|
||||
MWMechanics::CreatureStats::AiSetting setting = (MWMechanics::CreatureStats::AiSetting)mIndex;
|
||||
|
||||
MWMechanics::Stat<int> stat = ptr.getClass().getCreatureStats(ptr).getAiSetting(setting);
|
||||
stat.setModified(value, 0);
|
||||
ptr.getClass().getCreatureStats(ptr).setAiSetting(setting, stat);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -370,4 +370,5 @@ op 0x200022f: Resurrect
|
|||
op 0x2000230: Resurrect, explicit
|
||||
op 0x2000231: GetSpellReadied
|
||||
op 0x2000232: GetSpellReadied, explicit
|
||||
opcodes 0x2000233-0x3ffffff unused
|
||||
op 0x2000233: GetPcJumping
|
||||
opcodes 0x2000234-0x3ffffff unused
|
||||
|
|
|
@ -58,6 +58,18 @@ namespace MWScript
|
|||
}
|
||||
};
|
||||
|
||||
class OpGetPcJumping : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
runtime.push (!world->isOnGround(player) && !world->isFlying(player));
|
||||
}
|
||||
};
|
||||
|
||||
class OpWakeUpPc : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
@ -771,6 +783,7 @@ namespace MWScript
|
|||
interpreter.installSegment5 (Compiler::Misc::opcodeDontSaveObject, new OpDontSaveObject);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeToggleVanityMode, new OpToggleVanityMode);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeGetPcSleep, new OpGetPcSleep);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeGetPcJumping, new OpGetPcJumping);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeWakeUpPc, new OpWakeUpPc);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodePlayBink, new OpPlayBink);
|
||||
interpreter.installSegment5 (Compiler::Misc::opcodeGetLocked, new OpGetLocked<ImplicitRef>);
|
||||
|
|
|
@ -14,10 +14,7 @@ namespace MWWorld
|
|||
|
||||
void ActionTake::executeImp (const Ptr& actor)
|
||||
{
|
||||
// insert into player's inventory
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPtr ("player", true);
|
||||
|
||||
MWWorld::Class::get (player).getContainerStore (player).add (getTarget(), player);
|
||||
actor.getClass().getContainerStore (actor).add (getTarget(), getTarget().getRefData().getCount(), actor);
|
||||
|
||||
MWBase::Environment::get().getWorld()->deleteObject (getTarget());
|
||||
}
|
||||
|
|
|
@ -372,4 +372,10 @@ namespace MWWorld
|
|||
|
||||
return newPtr;
|
||||
}
|
||||
|
||||
bool Class::isFlying(const Ptr &ptr) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -306,6 +306,8 @@ namespace MWWorld
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual bool isFlying(const MWWorld::Ptr& ptr) const;
|
||||
|
||||
static const Class& get (const std::string& key);
|
||||
///< If there is no class for this \a key, an exception is thrown.
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ void MWWorld::ContainerStore::unstack(const Ptr &ptr, const Ptr& container)
|
|||
{
|
||||
if (ptr.getRefData().getCount() <= 1)
|
||||
return;
|
||||
addNewStack(ptr)->getRefData().setCount(ptr.getRefData().getCount()-1);
|
||||
addNewStack(ptr, ptr.getRefData().getCount()-1);
|
||||
remove(ptr, ptr.getRefData().getCount()-1, container);
|
||||
}
|
||||
|
||||
|
@ -123,12 +123,12 @@ bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
|
|||
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add(const std::string &id, int count, const Ptr &actorPtr)
|
||||
{
|
||||
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), id, count);
|
||||
return add(ref.getPtr(), actorPtr);
|
||||
return add(ref.getPtr(), count, actorPtr);
|
||||
}
|
||||
|
||||
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr, const Ptr& actorPtr)
|
||||
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr, int count, const Ptr& actorPtr)
|
||||
{
|
||||
MWWorld::ContainerStoreIterator it = addImp(itemPtr);
|
||||
MWWorld::ContainerStoreIterator it = addImp(itemPtr, count);
|
||||
MWWorld::Ptr item = *it;
|
||||
|
||||
// we may have copied an item from the world, so reset a few things first
|
||||
|
@ -165,7 +165,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr
|
|||
return it;
|
||||
}
|
||||
|
||||
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr)
|
||||
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr, int count)
|
||||
{
|
||||
int type = getType(ptr);
|
||||
|
||||
|
@ -180,20 +180,20 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr)
|
|||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_025")
|
||||
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_100"))
|
||||
{
|
||||
int count = MWWorld::Class::get(ptr).getValue(ptr) * ptr.getRefData().getCount();
|
||||
int realCount = MWWorld::Class::get(ptr).getValue(ptr) * ptr.getRefData().getCount();
|
||||
|
||||
for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
|
||||
{
|
||||
if (Misc::StringUtils::ciEqual((*iter).get<ESM::Miscellaneous>()->mRef.mRefID, "gold_001"))
|
||||
{
|
||||
iter->getRefData().setCount(iter->getRefData().getCount() + count);
|
||||
iter->getRefData().setCount(iter->getRefData().getCount() + realCount);
|
||||
flagAsModified();
|
||||
return iter;
|
||||
}
|
||||
}
|
||||
|
||||
MWWorld::ManualRef ref(esmStore, "Gold_001", count);
|
||||
return addNewStack(ref.getPtr());
|
||||
return addNewStack(ref.getPtr(), count);
|
||||
}
|
||||
|
||||
// determine whether to stack or not
|
||||
|
@ -202,17 +202,17 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr)
|
|||
if (stacks(*iter, ptr))
|
||||
{
|
||||
// stack
|
||||
iter->getRefData().setCount( iter->getRefData().getCount() + ptr.getRefData().getCount() );
|
||||
iter->getRefData().setCount( iter->getRefData().getCount() + count );
|
||||
|
||||
flagAsModified();
|
||||
return iter;
|
||||
}
|
||||
}
|
||||
// if we got here, this means no stacking
|
||||
return addNewStack(ptr);
|
||||
return addNewStack(ptr, count);
|
||||
}
|
||||
|
||||
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addNewStack (const Ptr& ptr)
|
||||
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addNewStack (const Ptr& ptr, int count)
|
||||
{
|
||||
ContainerStoreIterator it = begin();
|
||||
|
||||
|
@ -232,6 +232,8 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addNewStack (const Ptr&
|
|||
case Type_Weapon: weapons.mList.push_back (*ptr.get<ESM::Weapon>()); it = ContainerStoreIterator(this, --weapons.mList.end()); break;
|
||||
}
|
||||
|
||||
it->getRefData().setCount(count);
|
||||
|
||||
flagAsModified();
|
||||
return it;
|
||||
}
|
||||
|
@ -343,7 +345,7 @@ void MWWorld::ContainerStore::addInitialItem (const std::string& id, const std::
|
|||
else
|
||||
{
|
||||
ref.getPtr().getCellRef().mOwner = owner;
|
||||
addImp (ref.getPtr());
|
||||
addImp (ref.getPtr(), count);
|
||||
}
|
||||
}
|
||||
catch (std::logic_error& e)
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace MWWorld
|
|||
MWWorld::CellRefList<ESM::Weapon> weapons;
|
||||
mutable float mCachedWeight;
|
||||
mutable bool mWeightUpToDate;
|
||||
ContainerStoreIterator addImp (const Ptr& ptr);
|
||||
ContainerStoreIterator addImp (const Ptr& ptr, int count);
|
||||
void addInitialItem (const std::string& id, const std::string& owner, int count, unsigned char failChance=0, bool topLevel=true);
|
||||
|
||||
public:
|
||||
|
@ -64,7 +64,7 @@ namespace MWWorld
|
|||
|
||||
ContainerStoreIterator end();
|
||||
|
||||
virtual ContainerStoreIterator add (const Ptr& itemPtr, const Ptr& actorPtr);
|
||||
virtual ContainerStoreIterator add (const Ptr& itemPtr, int count, const Ptr& actorPtr);
|
||||
///< Add the item pointed to by \a ptr to this container. (Stacks automatically if needed)
|
||||
///
|
||||
/// \note The item pointed to is not required to exist beyond this function call.
|
||||
|
@ -91,7 +91,7 @@ namespace MWWorld
|
|||
///< Unstack an item in this container. The item's count will be set to 1, then a new stack will be added with (origCount-1).
|
||||
|
||||
protected:
|
||||
ContainerStoreIterator addNewStack (const Ptr& ptr);
|
||||
ContainerStoreIterator addNewStack (const Ptr& ptr, int count);
|
||||
///< Add the item to this container (do not try to stack it onto existing items)
|
||||
|
||||
virtual void flagAsModified();
|
||||
|
|
|
@ -75,9 +75,9 @@ MWWorld::InventoryStore& MWWorld::InventoryStore::operator= (const InventoryStor
|
|||
return *this;
|
||||
}
|
||||
|
||||
MWWorld::ContainerStoreIterator MWWorld::InventoryStore::add(const Ptr& itemPtr, const Ptr& actorPtr)
|
||||
MWWorld::ContainerStoreIterator MWWorld::InventoryStore::add(const Ptr& itemPtr, int count, const Ptr& actorPtr)
|
||||
{
|
||||
const MWWorld::ContainerStoreIterator& retVal = MWWorld::ContainerStore::add(itemPtr, actorPtr);
|
||||
const MWWorld::ContainerStoreIterator& retVal = MWWorld::ContainerStore::add(itemPtr, count, actorPtr);
|
||||
|
||||
// Auto-equip items if an armor/clothing item is added, but not for the player nor werewolves
|
||||
if ((actorPtr.getRefData().getHandle() != "player")
|
||||
|
@ -118,11 +118,7 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
|
|||
// unstack item pointed to by iterator if required
|
||||
if (iterator!=end() && !slots_.second && iterator->getRefData().getCount() > 1) // if slots.second is true, item can stay stacked when equipped
|
||||
{
|
||||
// add the item again with a count of count-1, then set the count of the original (that will be equipped) to 1
|
||||
int count = iterator->getRefData().getCount();
|
||||
iterator->getRefData().setCount(count-1);
|
||||
addNewStack(*iterator);
|
||||
iterator->getRefData().setCount(1);
|
||||
unstack(*iterator, actor);
|
||||
}
|
||||
|
||||
mSlots[slot] = iterator;
|
||||
|
@ -139,8 +135,13 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
|
|||
|
||||
void MWWorld::InventoryStore::unequipAll(const MWWorld::Ptr& actor)
|
||||
{
|
||||
// Only *one* change event should be fired
|
||||
mUpdatesEnabled = false;
|
||||
for (int slot=0; slot < MWWorld::InventoryStore::Slots; ++slot)
|
||||
unequipSlot(slot, actor);
|
||||
mUpdatesEnabled = true;
|
||||
fireEquipmentChangedEvent();
|
||||
updateMagicEffects(actor);
|
||||
}
|
||||
|
||||
MWWorld::ContainerStoreIterator MWWorld::InventoryStore::getSlot (int slot)
|
||||
|
@ -269,11 +270,7 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
|
|||
// unstack item pointed to by iterator if required
|
||||
if (iter->getRefData().getCount() > 1)
|
||||
{
|
||||
// add the item again with a count of count-1, then set the count of the original (that will be equipped) to 1
|
||||
int count = iter->getRefData().getCount();
|
||||
iter->getRefData().setCount(count-1);
|
||||
addNewStack(*iter);
|
||||
iter->getRefData().setCount(1);
|
||||
unstack(*iter, actor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ namespace MWWorld
|
|||
|
||||
InventoryStore& operator= (const InventoryStore& store);
|
||||
|
||||
virtual ContainerStoreIterator add (const Ptr& itemPtr, const Ptr& actorPtr);
|
||||
virtual ContainerStoreIterator add (const Ptr& itemPtr, int count, const Ptr& actorPtr);
|
||||
///< Add the item pointed to by \a ptr to this container. (Stacks automatically if needed)
|
||||
/// Auto-equip items if specific conditions are fulfilled (see the implementation).
|
||||
///
|
||||
|
|
|
@ -350,6 +350,7 @@ namespace MWWorld
|
|||
|
||||
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position)
|
||||
{
|
||||
Nif::NIFFile::CacheLock lock;
|
||||
MWBase::Environment::get().getWorld ()->getFader ()->fadeOut(0.5);
|
||||
|
||||
mRendering.enableTerrain(false);
|
||||
|
|
|
@ -1605,13 +1605,17 @@ namespace MWWorld
|
|||
if(!ptr.getClass().isActor())
|
||||
return false;
|
||||
|
||||
if (ptr.getClass().getCreatureStats(ptr).isDead())
|
||||
return false;
|
||||
|
||||
if (ptr.getClass().isFlying(ptr))
|
||||
return true;
|
||||
|
||||
const MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
|
||||
if(stats.getMagicEffects().get(ESM::MagicEffect::Levitate).mMagnitude > 0
|
||||
&& isLevitationEnabled())
|
||||
return true;
|
||||
|
||||
// TODO: Check if flying creature
|
||||
|
||||
const OEngine::Physic::PhysicActor *actor = mPhysEngine->getCharacter(ptr.getRefData().getHandle());
|
||||
if(!actor || !actor->getCollisionMode())
|
||||
return true;
|
||||
|
@ -1960,6 +1964,10 @@ namespace MWWorld
|
|||
|
||||
npcStats.setWerewolf(werewolf);
|
||||
|
||||
// This is a bit dangerous. Equipped items other than WerewolfRobe may reference
|
||||
// bones that do not even exist with the werewolf object root.
|
||||
// Therefore, make sure to unequip everything at once, and only fire the change event
|
||||
// (which will rebuild the animation parts) afterwards. unequipAll will do this for us.
|
||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(actor).getInventoryStore(actor);
|
||||
invStore.unequipAll(actor);
|
||||
|
||||
|
@ -1974,6 +1982,10 @@ namespace MWWorld
|
|||
actor.getClass().getContainerStore(actor).remove("werewolfrobe", 1, actor);
|
||||
}
|
||||
|
||||
// NpcAnimation::updateParts will already rebuild the animation when it detects change of Npc type.
|
||||
// the following is just for reattaching the camera properly.
|
||||
mRendering->rebuildPtr(actor);
|
||||
|
||||
if(actor.getRefData().getHandle() == "player")
|
||||
{
|
||||
// Update the GUI only when called on the player
|
||||
|
@ -1991,8 +2003,6 @@ namespace MWWorld
|
|||
windowManager->unsetForceHide(MWGui::GW_Magic);
|
||||
}
|
||||
}
|
||||
|
||||
mRendering->rebuildPtr(actor);
|
||||
}
|
||||
|
||||
void World::applyWerewolfAcrobatics(const Ptr &actor)
|
||||
|
|
|
@ -241,6 +241,7 @@ namespace Compiler
|
|||
extensions.registerInstruction ("togglevanitymode", "", opcodeToggleVanityMode);
|
||||
extensions.registerInstruction ("tvm", "", opcodeToggleVanityMode);
|
||||
extensions.registerFunction ("getpcsleep", 'l', "", opcodeGetPcSleep);
|
||||
extensions.registerFunction ("getpcjumping", 'l', "", opcodeGetPcJumping);
|
||||
extensions.registerInstruction ("wakeuppc", "", opcodeWakeUpPc);
|
||||
extensions.registerInstruction ("playbink", "Sl", opcodePlayBink);
|
||||
extensions.registerFunction ("getlocked", 'l', "", opcodeGetLocked, opcodeGetLockedExplicit);
|
||||
|
|
|
@ -188,6 +188,7 @@ namespace Compiler
|
|||
const int opcodeDontSaveObject = 0x2000153;
|
||||
const int opcodeToggleVanityMode = 0x2000174;
|
||||
const int opcodeGetPcSleep = 0x200019f;
|
||||
const int opcodeGetPcJumping = 0x2000233;
|
||||
const int opcodeWakeUpPc = 0x20001a2;
|
||||
const int opcodeGetLocked = 0x20001c7;
|
||||
const int opcodeGetLockedExplicit = 0x20001c8;
|
||||
|
|
|
@ -40,7 +40,7 @@ struct Creature
|
|||
enum Type
|
||||
{
|
||||
Creatures = 0,
|
||||
Deadra = 1,
|
||||
Daedra = 1,
|
||||
Undead = 2,
|
||||
Humanoid = 3
|
||||
};
|
||||
|
|
|
@ -157,7 +157,6 @@ Ogre::String NIFMaterialLoader::getMaterial(const Nif::ShapeData *shapedata,
|
|||
ctrls = ctrls->next;
|
||||
}
|
||||
}
|
||||
needTangents = !texName[Nif::NiTexturingProperty::BumpTexture].empty();
|
||||
|
||||
// Alpha modifiers
|
||||
if(alphaprop)
|
||||
|
@ -407,6 +406,12 @@ Ogre::String NIFMaterialLoader::getMaterial(const Nif::ShapeData *shapedata,
|
|||
instance->setProperty("depth_write", sh::makeProperty(new sh::StringValue(((depthFlags>>1)&1) ? "on" : "off")));
|
||||
// depth_func???
|
||||
|
||||
if (!texName[0].empty())
|
||||
NifOverrides::Overrides::getMaterialOverrides(texName[0], instance);
|
||||
|
||||
// Don't use texName, as it may be overridden
|
||||
needTangents = !sh::retrieveValue<sh::StringValue>(instance->getProperty("normalMap"), instance).get().empty();
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,14 +4,51 @@
|
|||
|
||||
#include <../components/misc/stringops.hpp>
|
||||
|
||||
#include "../extern/shiny/Main/MaterialInstance.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
using namespace NifOverrides;
|
||||
|
||||
Ogre::ConfigFile Overrides::mTransparencyOverrides = Ogre::ConfigFile();
|
||||
Overrides::TransparencyOverrideMap Overrides::mTransparencyOverrides = Overrides::TransparencyOverrideMap();
|
||||
Overrides::MaterialOverrideMap Overrides::mMaterialOverrides = Overrides::MaterialOverrideMap();
|
||||
|
||||
void Overrides::loadTransparencyOverrides (const std::string& file)
|
||||
{
|
||||
mTransparencyOverrides.load(file);
|
||||
Ogre::ConfigFile cf;
|
||||
cf.load(file);
|
||||
|
||||
Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
|
||||
while (seci.hasMoreElements())
|
||||
{
|
||||
Ogre::String sectionName = seci.peekNextKey();
|
||||
mTransparencyOverrides[sectionName] =
|
||||
Ogre::StringConverter::parseInt(cf.getSetting("alphaRejectValue", sectionName));
|
||||
seci.getNext();
|
||||
}
|
||||
}
|
||||
|
||||
void Overrides::loadMaterialOverrides(const std::string &file)
|
||||
{
|
||||
Ogre::ConfigFile cf;
|
||||
cf.load(file);
|
||||
|
||||
Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
|
||||
while (seci.hasMoreElements())
|
||||
{
|
||||
Ogre::String sectionName = seci.peekNextKey();
|
||||
|
||||
Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
|
||||
Ogre::ConfigFile::SettingsMultiMap::iterator i;
|
||||
std::map<std::string, std::string> overrides;
|
||||
for (i = settings->begin(); i != settings->end(); ++i)
|
||||
{
|
||||
overrides[i->first] = i->second;
|
||||
}
|
||||
mMaterialOverrides[sectionName] = overrides;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TransparencyResult Overrides::getTransparencyOverride(const std::string& texture)
|
||||
|
@ -19,20 +56,25 @@ TransparencyResult Overrides::getTransparencyOverride(const std::string& texture
|
|||
TransparencyResult result;
|
||||
result.first = false;
|
||||
|
||||
std::string tex = texture;
|
||||
Misc::StringUtils::toLower(tex);
|
||||
|
||||
Ogre::ConfigFile::SectionIterator seci = mTransparencyOverrides.getSectionIterator();
|
||||
while (seci.hasMoreElements())
|
||||
TransparencyOverrideMap::iterator it = mTransparencyOverrides.find(Misc::StringUtils::lowerCase(texture));
|
||||
if (it != mTransparencyOverrides.end())
|
||||
{
|
||||
Ogre::String sectionName = seci.peekNextKey();
|
||||
if (sectionName == tex)
|
||||
{
|
||||
result.first = true;
|
||||
result.second = Ogre::StringConverter::parseInt(mTransparencyOverrides.getSetting("alphaRejectValue", sectionName));
|
||||
break;
|
||||
}
|
||||
seci.getNext();
|
||||
result.first = true;
|
||||
result.second = it->second;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void Overrides::getMaterialOverrides(const std::string &texture, sh::MaterialInstance* material)
|
||||
{
|
||||
MaterialOverrideMap::iterator it = mMaterialOverrides.find(Misc::StringUtils::lowerCase(texture));
|
||||
if (it != mMaterialOverrides.end())
|
||||
{
|
||||
const std::map<std::string, std::string>& overrides = it->second;
|
||||
for (std::map<std::string, std::string>::const_iterator it = overrides.begin(); it != overrides.end(); ++it)
|
||||
{
|
||||
material->setProperty(it->first, sh::makeProperty(it->second));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,19 +3,34 @@
|
|||
|
||||
#include <OgreConfigFile.h>
|
||||
|
||||
namespace sh
|
||||
{
|
||||
class MaterialInstance;
|
||||
}
|
||||
|
||||
namespace NifOverrides
|
||||
{
|
||||
|
||||
typedef std::pair<bool, int> TransparencyResult;
|
||||
|
||||
/// \brief provide overrides for some model / texture properties that bethesda has chosen poorly
|
||||
/// Allows to provide overrides for some material properties in NIF files.
|
||||
/// NIFs are a bit limited in that they don't allow specifying a material externally, which is
|
||||
/// painful for texture modding.
|
||||
/// We also use this to patch up transparency settings in certain NIFs that bethesda has chosen poorly.
|
||||
class Overrides
|
||||
{
|
||||
public:
|
||||
static Ogre::ConfigFile mTransparencyOverrides;
|
||||
typedef std::map<std::string, int> TransparencyOverrideMap;
|
||||
static TransparencyOverrideMap mTransparencyOverrides;
|
||||
|
||||
typedef std::map<std::string, std::map<std::string, std::string> > MaterialOverrideMap;
|
||||
static MaterialOverrideMap mMaterialOverrides;
|
||||
|
||||
void loadTransparencyOverrides (const std::string& file);
|
||||
void loadMaterialOverrides (const std::string& file);
|
||||
|
||||
static TransparencyResult getTransparencyOverride(const std::string& texture);
|
||||
static void getMaterialOverrides (const std::string& texture, sh::MaterialInstance* instance);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _COMPONENTS_SETTINGS_H
|
||||
#define _COMPONENTS_SETTINGS_H
|
||||
#ifndef COMPONENTS_SETTINGS_H
|
||||
#define COMPONENTS_SETTINGS_H
|
||||
|
||||
#include <OgreConfigFile.h>
|
||||
|
||||
|
|
6
extern/oics/ICSChannel.h
vendored
6
extern/oics/ICSChannel.h
vendored
|
@ -24,8 +24,8 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
------------------------------------------------------- */
|
||||
|
||||
#ifndef _Channel_H_
|
||||
#define _Channel_H_
|
||||
#ifndef OICS_Channel_H_
|
||||
#define OICS_Channel_H_
|
||||
|
||||
#include "ICSPrerequisites.h"
|
||||
|
||||
|
@ -119,4 +119,4 @@ namespace ICS
|
|||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
4
extern/oics/ICSControl.h
vendored
4
extern/oics/ICSControl.h
vendored
|
@ -24,8 +24,8 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
------------------------------------------------------- */
|
||||
|
||||
#ifndef _Control_H_
|
||||
#define _Control_H_
|
||||
#ifndef OICS_Control_H_
|
||||
#define OICS_Control_H_
|
||||
|
||||
#include "ICSPrerequisites.h"
|
||||
|
||||
|
|
4
extern/oics/ICSInputControlSystem.h
vendored
4
extern/oics/ICSInputControlSystem.h
vendored
|
@ -24,8 +24,8 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
------------------------------------------------------- */
|
||||
|
||||
#ifndef _InputControlSystem_H_
|
||||
#define _InputControlSystem_H_
|
||||
#ifndef OICS_InputControlSystem_H_
|
||||
#define OICS_InputControlSystem_H_
|
||||
|
||||
#include "ICSPrerequisites.h"
|
||||
|
||||
|
|
4
extern/sdl4ogre/OISCompat.h
vendored
4
extern/sdl4ogre/OISCompat.h
vendored
|
@ -1,5 +1,5 @@
|
|||
#ifndef _OIS_SDL_COMPAT_H
|
||||
#define _OIS_SDL_COMPAT_H
|
||||
#ifndef OIS_SDL_COMPAT_H
|
||||
#define OIS_SDL_COMPAT_H
|
||||
|
||||
#include <SDL_events.h>
|
||||
#include <SDL_types.h>
|
||||
|
|
4
extern/sdl4ogre/cursormanager.hpp
vendored
4
extern/sdl4ogre/cursormanager.hpp
vendored
|
@ -1,5 +1,5 @@
|
|||
#ifndef _SDL4OGRE_CURSOR_MANAGER_H
|
||||
#define _SDL4OGRE_CURSOR_MANAGER_H
|
||||
#ifndef SDL4OGRE_CURSOR_MANAGER_H
|
||||
#define SDL4OGRE_CURSOR_MANAGER_H
|
||||
|
||||
#include <SDL_types.h>
|
||||
#include <string>
|
||||
|
|
4
extern/sdl4ogre/sdlcursormanager.hpp
vendored
4
extern/sdl4ogre/sdlcursormanager.hpp
vendored
|
@ -1,5 +1,5 @@
|
|||
#ifndef _SDL4OGRE_CURSORMANAGER_H
|
||||
#define _SDL4OGRE_CURSORMANAGER_H
|
||||
#ifndef SDL4OGRE_CURSORMANAGER_H
|
||||
#define SDL4OGRE_CURSORMANAGER_H
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
|
|
4
extern/sdl4ogre/sdlinputwrapper.hpp
vendored
4
extern/sdl4ogre/sdlinputwrapper.hpp
vendored
|
@ -1,5 +1,5 @@
|
|||
#ifndef _SDL4OGRE_SDLINPUTWRAPPER_H
|
||||
#define _SDL4OGRE_SDLINPUTWRAPPER_H
|
||||
#ifndef SDL4OGRE_SDLINPUTWRAPPER_H
|
||||
#define SDL4OGRE_SDLINPUTWRAPPER_H
|
||||
|
||||
#include <SDL_events.h>
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
* =====================================================================================
|
||||
*/
|
||||
|
||||
#ifndef _BtOgreShapes_H_
|
||||
#define _BtOgreShapes_H_
|
||||
#ifndef BtOgreShapes_H_
|
||||
#define BtOgreShapes_H_
|
||||
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
#include "OgreSimpleRenderable.h"
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
* =====================================================================================
|
||||
*/
|
||||
|
||||
#ifndef _BtOgrePG_H_
|
||||
#define _BtOgrePG_H_
|
||||
#ifndef BtOgrePG_H_
|
||||
#define BtOgrePG_H_
|
||||
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
#include "BtOgreExtras.h"
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
* =====================================================================================
|
||||
*/
|
||||
|
||||
#ifndef _BtOgreGP_H_
|
||||
#define _BtOgreGP_H_
|
||||
#ifndef BtOgreGP_H_
|
||||
#define BtOgreGP_H_
|
||||
|
||||
#include "btBulletDynamicsCommon.h"
|
||||
#include "OgreSceneNode.h"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _BULLET_SHAPE_LOADER_H_
|
||||
#define _BULLET_SHAPE_LOADER_H_
|
||||
#ifndef OPENMW_BULLET_SHAPE_LOADER_H_
|
||||
#define OPENMW_BULLET_SHAPE_LOADER_H_
|
||||
|
||||
#include <OgreResource.h>
|
||||
#include <OgreResourceManager.h>
|
||||
|
|
Loading…
Reference in a new issue