forked from teamnwah/openmw-tes3coop
Merge branch 'master' into editor2
This commit is contained in:
commit
1dd63e9fb6
12 changed files with 154 additions and 128 deletions
|
@ -1329,13 +1329,4 @@ void Record<ESM::Weapon>::print()
|
||||||
<< (int)mData.mData.mThrust[1] << std::endl;
|
<< (int)mData.mData.mThrust[1] << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
|
||||||
void Record<ESM::CellRef>::print()
|
|
||||||
{
|
|
||||||
std::cout << " Refnum: " << mData.mRefnum << std::endl;
|
|
||||||
std::cout << " ID: '" << mData.mRefID << "'\n";
|
|
||||||
std::cout << " Owner: '" << mData.mOwner << "'\n";
|
|
||||||
std::cout << " INTV: " << mData.mIntv << " NAM9: " << mData.mIntv << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|
|
@ -110,14 +110,7 @@ namespace MWDialogue
|
||||||
size_t pos = find_str_ci(text,*it,0);
|
size_t pos = find_str_ci(text,*it,0);
|
||||||
if(pos !=std::string::npos)
|
if(pos !=std::string::npos)
|
||||||
{
|
{
|
||||||
if(pos==0)
|
mKnownTopics[*it] = true;
|
||||||
{
|
|
||||||
mKnownTopics[*it] = true;
|
|
||||||
}
|
|
||||||
else if(text.substr(pos -1,1) == " ")
|
|
||||||
{
|
|
||||||
mKnownTopics[*it] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateTopics();
|
updateTopics();
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,6 +48,11 @@ std::string::size_type find_str_ci(const std::string& str, const std::string& su
|
||||||
return lower_string(str).find(lower_string(substr),pos);
|
return lower_string(str).find(lower_string(substr),pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool sortByLength (const std::string& left, const std::string& right)
|
||||||
|
{
|
||||||
|
return left.size() > right.size();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -287,7 +292,7 @@ void DialogueWindow::setKeywords(std::list<std::string> keyWords)
|
||||||
if (mServices & Service_Training)
|
if (mServices & Service_Training)
|
||||||
mTopicsList->addItem(gmst.find("sServiceTrainingTitle")->getString());
|
mTopicsList->addItem(gmst.find("sServiceTrainingTitle")->getString());
|
||||||
|
|
||||||
if (anyService)
|
if (anyService || mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||||
mTopicsList->addSeparator();
|
mTopicsList->addSeparator();
|
||||||
|
|
||||||
for(std::list<std::string>::iterator it = keyWords.begin(); it != keyWords.end(); ++it)
|
for(std::list<std::string>::iterator it = keyWords.begin(); it != keyWords.end(); ++it)
|
||||||
|
@ -311,43 +316,36 @@ void addColorInString(std::string& str, const std::string& keyword,std::string c
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
while((pos = find_str_ci(str,keyword, pos)) != std::string::npos)
|
while((pos = find_str_ci(str,keyword, pos)) != std::string::npos)
|
||||||
{
|
{
|
||||||
if(pos==0)
|
str.insert(pos,color1);
|
||||||
{
|
pos += color1.length();
|
||||||
str.insert(pos,color1);
|
pos += keyword.length();
|
||||||
pos += color1.length();
|
str.insert(pos,color2);
|
||||||
pos += keyword.length();
|
pos+= color2.length();
|
||||||
str.insert(pos,color2);
|
|
||||||
pos+= color2.length();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(str.substr(pos -1,1) == " ")
|
|
||||||
{
|
|
||||||
str.insert(pos,color1);
|
|
||||||
pos += color1.length();
|
|
||||||
pos += keyword.length();
|
|
||||||
str.insert(pos,color2);
|
|
||||||
pos+= color2.length();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pos += keyword.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DialogueWindow::parseText(std::string text)
|
std::string DialogueWindow::parseText(std::string text)
|
||||||
{
|
{
|
||||||
bool separatorReached = false; // only parse topics that are below the separator (this prevents actions like "Barter" that are not topics from getting blue-colored)
|
bool separatorReached = false; // only parse topics that are below the separator (this prevents actions like "Barter" that are not topics from getting blue-colored)
|
||||||
|
|
||||||
|
std::vector<std::string> topics;
|
||||||
|
|
||||||
for(unsigned int i = 0;i<mTopicsList->getItemCount();i++)
|
for(unsigned int i = 0;i<mTopicsList->getItemCount();i++)
|
||||||
{
|
{
|
||||||
std::string keyWord = mTopicsList->getItemNameAt(i);
|
std::string keyWord = mTopicsList->getItemNameAt(i);
|
||||||
if (separatorReached && keyWord != "")
|
if (separatorReached)
|
||||||
addColorInString(text,keyWord,"#686EBA","#B29154");
|
topics.push_back(keyWord);
|
||||||
else
|
else if (keyWord == "")
|
||||||
separatorReached = true;
|
separatorReached = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort by length to make sure longer topics are replaced first
|
||||||
|
std::sort(topics.begin(), topics.end(), sortByLength);
|
||||||
|
|
||||||
|
for(std::vector<std::string>::const_iterator it = topics.begin(); it != topics.end(); ++it)
|
||||||
|
{
|
||||||
|
addColorInString(text,*it,"#686EBA","#B29154");
|
||||||
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,8 @@ void StatsWindow::onFrame ()
|
||||||
MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
|
MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
|
||||||
|
|
||||||
setBirthSign(signId);
|
setBirthSign(signId);
|
||||||
|
setReputation (PCstats.getReputation ());
|
||||||
|
setBounty (PCstats.getBounty ());
|
||||||
|
|
||||||
if (mChanged)
|
if (mChanged)
|
||||||
updateSkillArea();
|
updateSkillArea();
|
||||||
|
|
|
@ -38,8 +38,8 @@ namespace MWGui
|
||||||
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
|
void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
|
||||||
|
|
||||||
void configureSkills (const SkillList& major, const SkillList& minor);
|
void configureSkills (const SkillList& major, const SkillList& minor);
|
||||||
void setReputation (int reputation) { this->mReputation = reputation; }
|
void setReputation (int reputation) { if (reputation != mReputation) mChanged = true; this->mReputation = reputation; }
|
||||||
void setBounty (int bounty) { this->mBounty = bounty; }
|
void setBounty (int bounty) { if (bounty != mBounty) mChanged = true; this->mBounty = bounty; }
|
||||||
void updateSkillArea();
|
void updateSkillArea();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
#include "../mwbase/dialoguemanager.hpp"
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
#include "../mwbase/journal.hpp"
|
#include "../mwbase/journal.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/class.hpp"
|
||||||
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
#include "ref.hpp"
|
#include "ref.hpp"
|
||||||
|
|
||||||
|
@ -126,6 +129,37 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<class R>
|
||||||
|
class OpModReputation : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||||
|
runtime.pop();
|
||||||
|
|
||||||
|
MWWorld::Class::get(ptr).getNpcStats (ptr).setReputation (MWWorld::Class::get(ptr).getNpcStats (ptr).getReputation () + value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class R>
|
||||||
|
class OpSetReputation : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||||
|
runtime.pop();
|
||||||
|
|
||||||
|
MWWorld::Class::get(ptr).getNpcStats (ptr).setReputation (value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
const int opcodeJournal = 0x2000133;
|
const int opcodeJournal = 0x2000133;
|
||||||
const int opcodeSetJournalIndex = 0x2000134;
|
const int opcodeSetJournalIndex = 0x2000134;
|
||||||
const int opcodeGetJournalIndex = 0x2000135;
|
const int opcodeGetJournalIndex = 0x2000135;
|
||||||
|
@ -134,6 +168,10 @@ namespace MWScript
|
||||||
const int opcodeForceGreeting = 0x200014f;
|
const int opcodeForceGreeting = 0x200014f;
|
||||||
const int opcodeForceGreetingExplicit = 0x2000150;
|
const int opcodeForceGreetingExplicit = 0x2000150;
|
||||||
const int opcodeGoodbye = 0x2000152;
|
const int opcodeGoodbye = 0x2000152;
|
||||||
|
const int opcodeSetReputation = 0x20001ad;
|
||||||
|
const int opcodeModReputation = 0x20001ae;
|
||||||
|
const int opcodeSetReputationExplicit = 0x20001af;
|
||||||
|
const int opcodeModReputationExplicit = 0x20001b0;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
|
@ -146,6 +184,10 @@ namespace MWScript
|
||||||
extensions.registerInstruction("forcegreeting","",opcodeForceGreeting,
|
extensions.registerInstruction("forcegreeting","",opcodeForceGreeting,
|
||||||
opcodeForceGreetingExplicit);
|
opcodeForceGreetingExplicit);
|
||||||
extensions.registerInstruction("goodbye", "", opcodeGoodbye);
|
extensions.registerInstruction("goodbye", "", opcodeGoodbye);
|
||||||
|
extensions.registerInstruction("setreputation", "l", opcodeSetReputation,
|
||||||
|
opcodeSetReputationExplicit);
|
||||||
|
extensions.registerInstruction("modreputation", "l", opcodeModReputation,
|
||||||
|
opcodeModReputationExplicit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -158,6 +200,10 @@ namespace MWScript
|
||||||
interpreter.installSegment5 (opcodeForceGreeting, new OpForceGreeting<ImplicitRef>);
|
interpreter.installSegment5 (opcodeForceGreeting, new OpForceGreeting<ImplicitRef>);
|
||||||
interpreter.installSegment5 (opcodeForceGreetingExplicit, new OpForceGreeting<ExplicitRef>);
|
interpreter.installSegment5 (opcodeForceGreetingExplicit, new OpForceGreeting<ExplicitRef>);
|
||||||
interpreter.installSegment5 (opcodeGoodbye, new OpGoodbye);
|
interpreter.installSegment5 (opcodeGoodbye, new OpGoodbye);
|
||||||
|
interpreter.installSegment5 (opcodeSetReputation, new OpSetReputation<ImplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeModReputation, new OpModReputation<ImplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeSetReputationExplicit, new OpSetReputation<ExplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeModReputationExplicit, new OpModReputation<ExplicitRef>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -222,5 +222,9 @@ op 0x20001a9: CommonDisease, explicit reference
|
||||||
op 0x20001aa: BlightDisease
|
op 0x20001aa: BlightDisease
|
||||||
op 0x20001ab: BlightDisease, explicit reference
|
op 0x20001ab: BlightDisease, explicit reference
|
||||||
op 0x20001ac: ToggleCollisionBoxes
|
op 0x20001ac: ToggleCollisionBoxes
|
||||||
opcodes 0x20001ac-0x3ffffff unused
|
op 0x20001ad: SetReputation
|
||||||
|
op 0x20001ae: ModReputation
|
||||||
|
op 0x20001af: SetReputation, explicit
|
||||||
|
op 0x20001b0: ModReputation, explicit
|
||||||
|
opcodes 0x20001b1-0x3ffffff unused
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace MWWorld
|
||||||
|
|
||||||
void FailedAction::executeImp (const Ptr& actor)
|
void FailedAction::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
if ( actor.getRefData().getHandle()=="player" and !(message.empty()))
|
if ( actor.getRefData().getHandle()=="player" && !(message.empty()))
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getWindowManager() ->messageBox(message, std::vector<std::string>());
|
MWBase::Environment::get().getWindowManager() ->messageBox(message, std::vector<std::string>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
#include "store.hpp"
|
|
||||||
|
|
||||||
namespace MWWorld
|
|
||||||
{
|
|
||||||
template <>
|
|
||||||
void Store<ESM::Dialogue>::load(ESM::ESMReader &esm, const std::string &id) {
|
|
||||||
mStatic.push_back(ESM::Dialogue());
|
|
||||||
mStatic.back().mId = id;
|
|
||||||
mStatic.back().load(esm);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
void Store<ESM::Script>::load(ESM::ESMReader &esm, const std::string &id) {
|
|
||||||
mStatic.push_back(ESM::Script());
|
|
||||||
mStatic.back().load(esm);
|
|
||||||
StringUtils::toLower(mStatic.back().mId);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -203,10 +203,18 @@ namespace MWWorld
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void Store<ESM::Dialogue>::load(ESM::ESMReader &esm, const std::string &id);
|
inline void Store<ESM::Dialogue>::load(ESM::ESMReader &esm, const std::string &id) {
|
||||||
|
mStatic.push_back(ESM::Dialogue());
|
||||||
|
mStatic.back().mId = id;
|
||||||
|
mStatic.back().load(esm);
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void Store<ESM::Script>::load(ESM::ESMReader &esm, const std::string &id);
|
inline void Store<ESM::Script>::load(ESM::ESMReader &esm, const std::string &id) {
|
||||||
|
mStatic.push_back(ESM::Script());
|
||||||
|
mStatic.back().load(esm);
|
||||||
|
StringUtils::toLower(mStatic.back().mId);
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class Store<ESM::LandTexture> : public StoreBase
|
class Store<ESM::LandTexture> : public StoreBase
|
||||||
|
|
|
@ -193,11 +193,12 @@ public:
|
||||||
|
|
||||||
std::string getString(size_t length)
|
std::string getString(size_t length)
|
||||||
{
|
{
|
||||||
std::string str;
|
std::vector<char> str (length+1, 0);
|
||||||
str.resize(length);
|
|
||||||
if(inp->read(&str[0], length) != length)
|
if(inp->read(&str[0], length) != length)
|
||||||
return std::string();
|
throw std::runtime_error ("string length in NIF file does not match");
|
||||||
return str.substr(0, str.find('\0'));
|
|
||||||
|
return &str[0];
|
||||||
}
|
}
|
||||||
std::string getString()
|
std::string getString()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue