diff --git a/apps/esmtool/esmtool.cpp b/apps/esmtool/esmtool.cpp index d682cf88b9..8e0900ba08 100644 --- a/apps/esmtool/esmtool.cpp +++ b/apps/esmtool/esmtool.cpp @@ -51,6 +51,7 @@ struct Arguments unsigned int raw_given; unsigned int quiet_given; unsigned int loadcells_given; + bool plain_given; std::string mode; std::string encoding; @@ -77,6 +78,9 @@ bool parseOptions (int argc, char** argv, Arguments &info) ("type,t", bpo::value< std::vector >(), "Show only records of this type (four character record code). May " "be specified multiple times. Only affects dump mode.") + ("plain,p", "Print contents of dialogs, books and scripts. " + "(skipped by default)" + "Only affects dump mode.") ("quiet,q", "Supress all record information. Useful for speed tests.") ("loadcells,C", "Browse through contents of all cells.") @@ -161,6 +165,7 @@ bool parseOptions (int argc, char** argv, Arguments &info) info.raw_given = variables.count ("raw"); info.quiet_given = variables.count ("quiet"); info.loadcells_given = variables.count ("loadcells"); + info.plain_given = (variables.count("plain") > 0); // Font encoding settings info.encoding = variables["encoding"].as(); @@ -343,6 +348,7 @@ int load(Arguments& info) } record->setId(id); record->setFlags((int) flags); + record->setPrintPlain(info.plain_given); record->load(esm); if (!quiet && interested) record->print(); diff --git a/apps/esmtool/record.cpp b/apps/esmtool/record.cpp index b7cbbc4eaf..c959908d5d 100644 --- a/apps/esmtool/record.cpp +++ b/apps/esmtool/record.cpp @@ -464,12 +464,17 @@ void Record::print() std::cout << " IsScroll: " << mData.mData.mIsScroll << std::endl; std::cout << " SkillID: " << mData.mData.mSkillID << std::endl; std::cout << " Enchantment Points: " << mData.mData.mEnchant << std::endl; - std::cout << " Text: [skipped]" << std::endl; - // Skip until multi-line fields is controllable by a command line option. - // Mildly problematic because there are no parameter to print() currently. - // std::cout << "-------------------------------------------" << std::endl; - // std::cout << mData.mText << std::endl; - // std::cout << "-------------------------------------------" << std::endl; + if (mPrintPlain) + { + std::cout << " Text:" << std::endl; + std::cout << "START--------------------------------------" << std::endl; + std::cout << mData.mText << std::endl; + std::cout << "END----------------------------------------" << std::endl; + } + else + { + std::cout << " Text: [skipped]" << std::endl; + } } template<> @@ -755,12 +760,17 @@ void Record::print() if (mData.mResultScript != "") { - std::cout << " Result Script: [skipped]" << std::endl; - // Skip until multi-line fields is controllable by a command line option. - // Mildly problematic because there are no parameter to print() currently. - // std::cout << "-------------------------------------------" << std::endl; - // std::cout << mData.mResultScript << std::endl; - // std::cout << "-------------------------------------------" << std::endl; + if (mPrintPlain) + { + std::cout << " Result Script:" << std::endl; + std::cout << "START--------------------------------------" << std::endl; + std::cout << mData.mResultScript << std::endl; + std::cout << "END----------------------------------------" << std::endl; + } + else + { + std::cout << " Result Script: [skipped]" << std::endl; + } } std::cout << " Quest Status: " << questStatusLabel(mData.mQuestStatus) @@ -1171,12 +1181,18 @@ void Record::print() std::cout << " Script Data Size: " << mData.mData.mScriptDataSize << std::endl; std::cout << " Table Size: " << mData.mData.mStringTableSize << std::endl; - std::cout << " Script: [skipped]" << std::endl; - // Skip until multi-line fields is controllable by a command line option. - // Mildly problematic because there are no parameter to print() currently. - // std::cout << "-------------------------------------------" << std::endl; - // std::cout << s->scriptText << std::endl; - // std::cout << "-------------------------------------------" << std::endl; + if (mPrintPlain) + { + std::cout << " Script:" << std::endl; + std::cout << "START--------------------------------------" << std::endl; + std::cout << mData.mScriptText << std::endl; + std::cout << "END----------------------------------------" << std::endl; + } + else + { + std::cout << " Script: [skipped]" << std::endl; + } + std::vector::iterator vit; for (vit = mData.mVarNames.begin(); vit != mData.mVarNames.end(); vit++) std::cout << " Variable: " << *vit << std::endl; diff --git a/apps/esmtool/record.hpp b/apps/esmtool/record.hpp index e0dd988a65..78cf5d436e 100644 --- a/apps/esmtool/record.hpp +++ b/apps/esmtool/record.hpp @@ -21,9 +21,10 @@ namespace EsmTool std::string mId; int mFlags; ESM::NAME mType; + bool mPrintPlain; public: - RecordBase () {} + RecordBase () { mPrintPlain = false; } virtual ~RecordBase() {} const std::string &getId() const { @@ -46,6 +47,14 @@ namespace EsmTool return mType; } + bool getPrintPlain() const { + return mPrintPlain; + } + + void setPrintPlain(bool plain) { + mPrintPlain = plain; + } + virtual void load(ESM::ESMReader &esm) = 0; virtual void save(ESM::ESMWriter &esm) = 0; virtual void print() = 0;