mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 11:53:51 +00:00
Merge remote-tracking branch 'zini/master' into nifogre
This commit is contained in:
commit
4122b0b55f
6 changed files with 111 additions and 19 deletions
|
@ -49,6 +49,67 @@ namespace
|
|||
{
|
||||
return new CustomData (*this);
|
||||
}
|
||||
|
||||
void autoCalculateAttributes (const ESM::NPC* npc, MWMechanics::CreatureStats& creatureStats)
|
||||
{
|
||||
// race bonus
|
||||
const ESM::Race *race =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npc->mRace);
|
||||
|
||||
bool male = (npc->mFlags & ESM::NPC::Female) == 0;
|
||||
|
||||
int level = creatureStats.getLevel();
|
||||
|
||||
for (int i=0; i<ESM::Attribute::Length; ++i)
|
||||
{
|
||||
const ESM::Race::MaleFemale& attribute = race->mData.mAttributeValues[i];
|
||||
creatureStats.getAttribute(i).setBase (male ? attribute.mMale : attribute.mFemale);
|
||||
}
|
||||
|
||||
// class bonus
|
||||
const ESM::Class *class_ =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(npc->mClass);
|
||||
|
||||
for (int i=0; i<2; ++i)
|
||||
{
|
||||
int attribute = class_->mData.mAttribute[i];
|
||||
if (attribute>=0 && attribute<8)
|
||||
{
|
||||
creatureStats.getAttribute(attribute).setBase (
|
||||
creatureStats.getAttribute(attribute).getBase() + 10);
|
||||
}
|
||||
}
|
||||
|
||||
// skill bonus
|
||||
for (int attribute=0; attribute<ESM::Attribute::Length; ++attribute)
|
||||
{
|
||||
float modifierSum = 0;
|
||||
|
||||
for (int j=0; j<ESM::Skill::Length; ++j)
|
||||
{
|
||||
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>().find(j);
|
||||
|
||||
if (skill->mData.mAttribute != attribute)
|
||||
continue;
|
||||
|
||||
// is this a minor or major skill?
|
||||
float add=0.2;
|
||||
for (int k=0; k<5; ++k)
|
||||
{
|
||||
if (class_->mData.mSkills[k][0] == j)
|
||||
add=0.5;
|
||||
}
|
||||
for (int k=0; k<5; ++k)
|
||||
{
|
||||
if (class_->mData.mSkills[k][1] == j)
|
||||
add=1.0;
|
||||
}
|
||||
modifierSum += add;
|
||||
}
|
||||
creatureStats.getAttribute(attribute).setBase ( std::min(creatureStats.getAttribute(attribute).getBase()
|
||||
+ static_cast<int>((level-1) * modifierSum+0.5), 100) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWClass
|
||||
|
@ -126,15 +187,14 @@ namespace MWClass
|
|||
}
|
||||
else
|
||||
{
|
||||
for (int i=0; i<8; ++i)
|
||||
data->mCreatureStats.getAttribute (i).set (10);
|
||||
|
||||
for (int i=0; i<3; ++i)
|
||||
data->mCreatureStats.setDynamic (i, 10);
|
||||
|
||||
data->mCreatureStats.setLevel(ref->mBase->mNpdt12.mLevel);
|
||||
data->mNpcStats.setBaseDisposition(ref->mBase->mNpdt12.mDisposition);
|
||||
data->mNpcStats.setReputation(ref->mBase->mNpdt12.mReputation);
|
||||
|
||||
autoCalculateAttributes(ref->mBase, data->mCreatureStats);
|
||||
}
|
||||
|
||||
data->mCreatureStats.setAiSetting (0, ref->mBase->mAiData.mHello);
|
||||
|
|
|
@ -426,6 +426,7 @@ namespace MWDialogue
|
|||
|
||||
void DialogueManager::questionAnswered (const std::string& answer)
|
||||
{
|
||||
|
||||
if (mChoiceMap.find(answer) != mChoiceMap.end())
|
||||
{
|
||||
mChoice = mChoiceMap[answer];
|
||||
|
@ -442,6 +443,10 @@ namespace MWDialogue
|
|||
std::string text = info->mResponse;
|
||||
parseText (text);
|
||||
|
||||
mChoiceMap.clear();
|
||||
mChoice = -1;
|
||||
mIsInChoice = false;
|
||||
|
||||
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
||||
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addText (Interpreter::fixDefinesDialog(text, interpreterContext));
|
||||
MWBase::Environment::get().getJournal()->addTopic (mLastTopic, info->mId);
|
||||
|
@ -449,9 +454,6 @@ namespace MWDialogue
|
|||
mLastDialogue = *info;
|
||||
}
|
||||
}
|
||||
mChoiceMap.clear();
|
||||
mChoice = -1;
|
||||
mIsInChoice = false;
|
||||
}
|
||||
|
||||
updateTopics();
|
||||
|
|
|
@ -21,13 +21,15 @@ namespace MWRender
|
|||
|
||||
CharacterPreview::CharacterPreview(MWWorld::Ptr character, int sizeX, int sizeY, const std::string& name,
|
||||
Ogre::Vector3 position, Ogre::Vector3 lookAt)
|
||||
: mSizeX(sizeX)
|
||||
, mSizeY(sizeY)
|
||||
, mName(name)
|
||||
|
||||
: mSceneMgr (0)
|
||||
, mPosition(position)
|
||||
, mLookAt(lookAt)
|
||||
, mCharacter(character)
|
||||
, mAnimation(NULL)
|
||||
, mName(name)
|
||||
, mSizeX(sizeX)
|
||||
, mSizeY(sizeY)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -88,16 +90,20 @@ namespace MWRender
|
|||
|
||||
CharacterPreview::~CharacterPreview ()
|
||||
{
|
||||
//Ogre::TextureManager::getSingleton().remove(mName);
|
||||
mSceneMgr->destroyCamera (mName);
|
||||
delete mAnimation;
|
||||
Ogre::Root::getSingleton().destroySceneManager(mSceneMgr);
|
||||
if (mSceneMgr)
|
||||
{
|
||||
//Ogre::TextureManager::getSingleton().remove(mName);
|
||||
mSceneMgr->destroyAllCameras();
|
||||
delete mAnimation;
|
||||
Ogre::Root::getSingleton().destroySceneManager(mSceneMgr);
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterPreview::rebuild()
|
||||
{
|
||||
assert(mAnimation);
|
||||
delete mAnimation;
|
||||
mAnimation = 0;
|
||||
|
||||
mAnimation = new NpcAnimation(mCharacter, mNode, MWWorld::Class::get(mCharacter).getInventoryStore(mCharacter),
|
||||
0, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal));
|
||||
|
|
|
@ -559,6 +559,8 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
|
|||
assert(mgr);
|
||||
|
||||
mSceneMgr = mgr;
|
||||
mShaderRenderManager = NULL;
|
||||
mRenderManager = NULL;
|
||||
|
||||
using namespace MyGUI;
|
||||
|
||||
|
@ -574,7 +576,10 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
|
|||
|
||||
// Set up OGRE platform (bypassing OgrePlatform). We might make this more generic later.
|
||||
mLogManager = new LogManager();
|
||||
mRenderManager = new MyGUI::ShaderBasedRenderManager();
|
||||
if (!Ogre::Root::getSingleton().getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_FIXED_FUNCTION))
|
||||
mShaderRenderManager = new MyGUI::ShaderBasedRenderManager();
|
||||
else
|
||||
mRenderManager = new MyGUI::OgreRenderManager();
|
||||
mDataManager = new MyGUI::FixedOgreDataManager();
|
||||
|
||||
LogManager::getInstance().setSTDOutputEnabled(logging);
|
||||
|
@ -582,7 +587,10 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
|
|||
if (!theLogFile.empty())
|
||||
LogManager::getInstance().createDefaultSource(theLogFile);
|
||||
|
||||
mRenderManager->initialise(wnd, mgr);
|
||||
if (mShaderRenderManager)
|
||||
mShaderRenderManager->initialise(wnd, mgr);
|
||||
else
|
||||
mRenderManager->initialise(wnd, mgr);
|
||||
mDataManager->initialise("General");
|
||||
|
||||
// Create GUI
|
||||
|
@ -592,8 +600,16 @@ void MyGUIManager::setup(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool
|
|||
|
||||
void MyGUIManager::updateWindow (Ogre::RenderWindow *wnd)
|
||||
{
|
||||
mRenderManager->setRenderWindow (wnd);
|
||||
mRenderManager->setActiveViewport(0);
|
||||
if (mShaderRenderManager)
|
||||
{
|
||||
mShaderRenderManager->setRenderWindow (wnd);
|
||||
mShaderRenderManager->setActiveViewport(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
mRenderManager->setRenderWindow (wnd);
|
||||
mRenderManager->setActiveViewport(0);
|
||||
}
|
||||
}
|
||||
|
||||
void MyGUIManager::shutdown()
|
||||
|
@ -606,6 +622,12 @@ void MyGUIManager::shutdown()
|
|||
delete mRenderManager;
|
||||
mRenderManager = NULL;
|
||||
}
|
||||
if(mShaderRenderManager)
|
||||
{
|
||||
mShaderRenderManager->shutdown();
|
||||
delete mShaderRenderManager;
|
||||
mShaderRenderManager = NULL;
|
||||
}
|
||||
if(mDataManager)
|
||||
{
|
||||
mDataManager->shutdown();
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace MyGUI
|
|||
class Gui;
|
||||
class LogManager;
|
||||
class OgreDataManager;
|
||||
class OgreRenderManager;
|
||||
class ShaderBasedRenderManager;
|
||||
}
|
||||
|
||||
|
@ -25,12 +26,12 @@ namespace GUI
|
|||
MyGUI::Gui *mGui;
|
||||
MyGUI::LogManager* mLogManager;
|
||||
MyGUI::OgreDataManager* mDataManager;
|
||||
MyGUI::ShaderBasedRenderManager* mRenderManager;
|
||||
MyGUI::OgreRenderManager* mRenderManager;
|
||||
MyGUI::ShaderBasedRenderManager* mShaderRenderManager;
|
||||
Ogre::SceneManager* mSceneMgr;
|
||||
|
||||
|
||||
public:
|
||||
MyGUIManager() : mLogManager(NULL), mDataManager(NULL), mRenderManager(NULL), mGui(NULL) {}
|
||||
MyGUIManager(Ogre::RenderWindow *wnd, Ogre::SceneManager *mgr, bool logging=false, const std::string& logDir = std::string(""))
|
||||
{
|
||||
setup(wnd,mgr,logging, logDir);
|
||||
|
|
|
@ -136,6 +136,7 @@ Bug #700: "On the rocks" mod does not load its UV coordinates correctly.
|
|||
Bug #702: Some race mods don't work
|
||||
Bug #711: Crash during character creation
|
||||
Bug #715: Growing Tauryon
|
||||
Bug #725: Auto calculate stats
|
||||
Feature #55/657: Item Repairing
|
||||
Feature #62/87: Enchanting
|
||||
Feature #99: Pathfinding
|
||||
|
|
Loading…
Reference in a new issue