forked from mirror/openmw-tes3mp
Merge branch 'tables'
Conflicts: apps/opencs/CMakeLists.txt apps/opencs/model/world/data.cpp apps/opencs/model/world/data.hpp
This commit is contained in:
commit
21b16f8425
28 changed files with 943 additions and 17 deletions
|
@ -26,11 +26,12 @@ opencs_units (model/world
|
|||
|
||||
opencs_units_noqt (model/world
|
||||
universalid record commands columnbase scriptcontext cell refidcollection
|
||||
refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection tablemimedata cellcoordinates cellselection resources resourcesmanager scope landtexture land
|
||||
refidadapter refiddata refidadapterimp ref collectionbase refcollection columns infocollection tablemimedata cellcoordinates cellselection resources resourcesmanager scope
|
||||
pathgrid landtexture land
|
||||
)
|
||||
|
||||
opencs_hdrs_noqt (model/world
|
||||
columnimp idcollection collection info
|
||||
columnimp idcollection collection info subcellcollection
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -2023,6 +2023,7 @@ void CSMDoc::Document::addOptionalGmsts()
|
|||
{
|
||||
ESM::GameSetting gmst;
|
||||
gmst.mId = sFloats[i];
|
||||
gmst.blank();
|
||||
gmst.mValue.setType (ESM::VT_Float);
|
||||
addOptionalGmst (gmst);
|
||||
}
|
||||
|
@ -2031,6 +2032,7 @@ void CSMDoc::Document::addOptionalGmsts()
|
|||
{
|
||||
ESM::GameSetting gmst;
|
||||
gmst.mId = sIntegers[i];
|
||||
gmst.blank();
|
||||
gmst.mValue.setType (ESM::VT_Int);
|
||||
addOptionalGmst (gmst);
|
||||
}
|
||||
|
@ -2039,6 +2041,7 @@ void CSMDoc::Document::addOptionalGmsts()
|
|||
{
|
||||
ESM::GameSetting gmst;
|
||||
gmst.mId = sStrings[i];
|
||||
gmst.blank();
|
||||
gmst.mValue.setType (ESM::VT_String);
|
||||
gmst.mValue.setString ("<no text>");
|
||||
addOptionalGmst (gmst);
|
||||
|
@ -2059,6 +2062,7 @@ void CSMDoc::Document::addOptionalGlobals()
|
|||
{
|
||||
ESM::Global global;
|
||||
global.mId = sGlobals[i];
|
||||
global.blank();
|
||||
global.mValue.setType (ESM::VT_Long);
|
||||
|
||||
if (i==0)
|
||||
|
@ -2068,6 +2072,19 @@ void CSMDoc::Document::addOptionalGlobals()
|
|||
}
|
||||
}
|
||||
|
||||
void CSMDoc::Document::addOptionalMagicEffects()
|
||||
{
|
||||
for (int i=ESM::MagicEffect::SummonFabricant; i<=ESM::MagicEffect::SummonCreature05; ++i)
|
||||
{
|
||||
ESM::MagicEffect effect;
|
||||
effect.mIndex = i;
|
||||
effect.mId = ESM::MagicEffect::indexToId (i);
|
||||
effect.blank();
|
||||
|
||||
addOptionalMagicEffect (effect);
|
||||
}
|
||||
}
|
||||
|
||||
void CSMDoc::Document::addOptionalGmst (const ESM::GameSetting& gmst)
|
||||
{
|
||||
if (getData().getGmsts().searchId (gmst.mId)==-1)
|
||||
|
@ -2090,6 +2107,17 @@ void CSMDoc::Document::addOptionalGlobal (const ESM::Global& global)
|
|||
}
|
||||
}
|
||||
|
||||
void CSMDoc::Document::addOptionalMagicEffect (const ESM::MagicEffect& magicEffect)
|
||||
{
|
||||
if (getData().getMagicEffects().searchId (magicEffect.mId)==-1)
|
||||
{
|
||||
CSMWorld::Record<ESM::MagicEffect> record;
|
||||
record.mBase = magicEffect;
|
||||
record.mState = CSMWorld::RecordBase::State_BaseOnly;
|
||||
getData().getMagicEffects().appendRecord (record);
|
||||
}
|
||||
}
|
||||
|
||||
void CSMDoc::Document::createBase()
|
||||
{
|
||||
static const char *sGlobals[] =
|
||||
|
@ -2201,6 +2229,18 @@ void CSMDoc::Document::createBase()
|
|||
|
||||
getData().getTopics().add (record);
|
||||
}
|
||||
|
||||
for (int i=0; i<ESM::MagicEffect::Length; ++i)
|
||||
{
|
||||
ESM::MagicEffect record;
|
||||
|
||||
record.mIndex = i;
|
||||
record.mId = ESM::MagicEffect::indexToId (i);
|
||||
|
||||
record.blank();
|
||||
|
||||
getData().getMagicEffects().add (record);
|
||||
}
|
||||
}
|
||||
|
||||
CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
||||
|
@ -2248,6 +2288,7 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
|||
|
||||
addOptionalGmsts();
|
||||
addOptionalGlobals();
|
||||
addOptionalMagicEffects();
|
||||
|
||||
connect (&mUndoStack, SIGNAL (cleanChanged (bool)), this, SLOT (modificationStateChanged (bool)));
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace ESM
|
|||
{
|
||||
struct GameSetting;
|
||||
struct Global;
|
||||
struct MagicEffect;
|
||||
}
|
||||
|
||||
namespace Files
|
||||
|
@ -73,10 +74,14 @@ namespace CSMDoc
|
|||
|
||||
void addOptionalGlobals();
|
||||
|
||||
void addOptionalMagicEffects();
|
||||
|
||||
void addOptionalGmst (const ESM::GameSetting& gmst);
|
||||
|
||||
void addOptionalGlobal (const ESM::Global& global);
|
||||
|
||||
void addOptionalMagicEffect (const ESM::MagicEffect& effect);
|
||||
|
||||
public:
|
||||
|
||||
Document (const Files::ConfigurationManager& configuration,
|
||||
|
|
|
@ -72,6 +72,12 @@ CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& proje
|
|||
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::BodyPart> >
|
||||
(mDocument.getData().getBodyParts(), mState));
|
||||
|
||||
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::SoundGenerator> >
|
||||
(mDocument.getData().getSoundGens(), mState));
|
||||
|
||||
appendStage (new WriteCollectionStage<CSMWorld::IdCollection<ESM::MagicEffect> >
|
||||
(mDocument.getData().getMagicEffects(), mState));
|
||||
|
||||
appendStage (new WriteDialogueCollectionStage (mDocument, mState, false));
|
||||
|
||||
appendStage (new WriteDialogueCollectionStage (mDocument, mState, true));
|
||||
|
@ -82,6 +88,8 @@ CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& proje
|
|||
|
||||
appendStage (new WriteCellCollectionStage (mDocument, mState));
|
||||
|
||||
appendStage (new WritePathgridCollectionStage (mDocument, mState));
|
||||
|
||||
// close file and clean up
|
||||
appendStage (new CloseSaveStage (mState));
|
||||
|
||||
|
|
|
@ -311,6 +311,48 @@ void CSMDoc::WriteCellCollectionStage::perform (int stage, Messages& messages)
|
|||
}
|
||||
|
||||
|
||||
CSMDoc::WritePathgridCollectionStage::WritePathgridCollectionStage (Document& document,
|
||||
SavingState& state)
|
||||
: mDocument (document), mState (state)
|
||||
{}
|
||||
|
||||
int CSMDoc::WritePathgridCollectionStage::setup()
|
||||
{
|
||||
return mDocument.getData().getPathgrids().getSize();
|
||||
}
|
||||
|
||||
void CSMDoc::WritePathgridCollectionStage::perform (int stage, Messages& messages)
|
||||
{
|
||||
const CSMWorld::Record<CSMWorld::Pathgrid>& pathgrid =
|
||||
mDocument.getData().getPathgrids().getRecord (stage);
|
||||
|
||||
if (pathgrid.mState==CSMWorld::RecordBase::State_Modified ||
|
||||
pathgrid.mState==CSMWorld::RecordBase::State_ModifiedOnly)
|
||||
{
|
||||
CSMWorld::Pathgrid record = pathgrid.get();
|
||||
|
||||
if (record.mId.substr (0, 1)=="#")
|
||||
{
|
||||
std::istringstream stream (record.mId.c_str());
|
||||
char ignore;
|
||||
stream >> ignore >> record.mData.mX >> record.mData.mY;
|
||||
}
|
||||
else
|
||||
record.mCell = record.mId;
|
||||
|
||||
mState.getWriter().startRecord (record.sRecordId);
|
||||
|
||||
record.save (mState.getWriter());
|
||||
|
||||
mState.getWriter().endRecord (record.sRecordId);
|
||||
}
|
||||
else if (pathgrid.mState==CSMWorld::RecordBase::State_Deleted)
|
||||
{
|
||||
/// \todo write record with delete flag
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CSMDoc::CloseSaveStage::CloseSaveStage (SavingState& state)
|
||||
: mState (state)
|
||||
{}
|
||||
|
|
|
@ -183,6 +183,23 @@ namespace CSMDoc
|
|||
///< Messages resulting from this stage will be appended to \a messages.
|
||||
};
|
||||
|
||||
|
||||
class WritePathgridCollectionStage : public Stage
|
||||
{
|
||||
Document& mDocument;
|
||||
SavingState& mState;
|
||||
|
||||
public:
|
||||
|
||||
WritePathgridCollectionStage (Document& document, SavingState& state);
|
||||
|
||||
virtual int setup();
|
||||
///< \return number of steps
|
||||
|
||||
virtual void perform (int stage, Messages& messages);
|
||||
///< Messages resulting from this stage will be appended to \a messages.
|
||||
};
|
||||
|
||||
class CloseSaveStage : public Stage
|
||||
{
|
||||
SavingState& mState;
|
||||
|
|
|
@ -101,7 +101,9 @@ namespace CSMWorld
|
|||
Display_Texture,
|
||||
Display_Video,
|
||||
Display_Colour,
|
||||
Display_ScriptLines // console context
|
||||
Display_ScriptLines, // console context
|
||||
Display_SoundGeneratorType,
|
||||
Display_School
|
||||
};
|
||||
|
||||
int mColumnId;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#ifndef CSM_WOLRD_COLUMNIMP_H
|
||||
#define CSM_WOLRD_COLUMNIMP_H
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
|
@ -1982,6 +1984,287 @@ namespace CSMWorld
|
|||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct SoundColumn : public Column<ESXRecordT>
|
||||
{
|
||||
SoundColumn()
|
||||
: Column<ESXRecordT> (Columns::ColumnId_Sound, ColumnBase::Display_Sound)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return QString::fromUtf8 (record.get().mSound.c_str());
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mSound = data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct CreatureColumn : public Column<ESXRecordT>
|
||||
{
|
||||
CreatureColumn()
|
||||
: Column<ESXRecordT> (Columns::ColumnId_Creature, ColumnBase::Display_Creature)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return QString::fromUtf8 (record.get().mCreature.c_str());
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mCreature = data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct SoundGeneratorTypeColumn : public Column<ESXRecordT>
|
||||
{
|
||||
SoundGeneratorTypeColumn()
|
||||
: Column<ESXRecordT> (Columns::ColumnId_SoundGeneratorType, ColumnBase::Display_SoundGeneratorType)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return static_cast<int> (record.get().mType);
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mType = data.toInt();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct BaseCostColumn : public Column<ESXRecordT>
|
||||
{
|
||||
BaseCostColumn() : Column<ESXRecordT> (Columns::ColumnId_BaseCost, ColumnBase::Display_Float) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return record.get().mData.mBaseCost;
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
record2.mData.mBaseCost = data.toFloat();
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct SchoolColumn : public Column<ESXRecordT>
|
||||
{
|
||||
SchoolColumn()
|
||||
: Column<ESXRecordT> (Columns::ColumnId_School, ColumnBase::Display_School)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return record.get().mData.mSchool;
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mData.mSchool = data.toInt();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct EffectTextureColumn : public Column<ESXRecordT>
|
||||
{
|
||||
EffectTextureColumn (Columns::ColumnId columnId)
|
||||
: Column<ESXRecordT> (columnId, ColumnBase::Display_Texture)
|
||||
{
|
||||
assert (this->mColumnId==Columns::ColumnId_Icon ||
|
||||
this->mColumnId==Columns::ColumnId_Particle);
|
||||
}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
return QString::fromUtf8 (
|
||||
(this->mColumnId==Columns::ColumnId_Icon ?
|
||||
record.get().mIcon : record.get().mParticle).c_str());
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
(this->mColumnId==Columns::ColumnId_Icon ?
|
||||
record2.mIcon : record2.mParticle)
|
||||
= data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct EffectObjectColumn : public Column<ESXRecordT>
|
||||
{
|
||||
EffectObjectColumn (Columns::ColumnId columnId)
|
||||
: Column<ESXRecordT> (columnId, columnId==Columns::ColumnId_BoltObject ? ColumnBase::Display_Weapon : ColumnBase::Display_Static)
|
||||
{
|
||||
assert (this->mColumnId==Columns::ColumnId_CastingObject ||
|
||||
this->mColumnId==Columns::ColumnId_HitObject ||
|
||||
this->mColumnId==Columns::ColumnId_AreaObject ||
|
||||
this->mColumnId==Columns::ColumnId_BoltObject);
|
||||
}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
const std::string *string = 0;
|
||||
|
||||
switch (this->mColumnId)
|
||||
{
|
||||
case Columns::ColumnId_CastingObject: string = &record.get().mCasting; break;
|
||||
case Columns::ColumnId_HitObject: string = &record.get().mHit; break;
|
||||
case Columns::ColumnId_AreaObject: string = &record.get().mArea; break;
|
||||
case Columns::ColumnId_BoltObject: string = &record.get().mBolt; break;
|
||||
}
|
||||
|
||||
if (!string)
|
||||
throw std::logic_error ("Unsupported column ID");
|
||||
|
||||
return QString::fromUtf8 (string->c_str());
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
std::string *string = 0;
|
||||
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
switch (this->mColumnId)
|
||||
{
|
||||
case Columns::ColumnId_CastingObject: string = &record2.mCasting; break;
|
||||
case Columns::ColumnId_HitObject: string = &record2.mHit; break;
|
||||
case Columns::ColumnId_AreaObject: string = &record2.mArea; break;
|
||||
case Columns::ColumnId_BoltObject: string = &record2.mBolt; break;
|
||||
}
|
||||
|
||||
if (!string)
|
||||
throw std::logic_error ("Unsupported column ID");
|
||||
|
||||
*string = data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct EffectSoundColumn : public Column<ESXRecordT>
|
||||
{
|
||||
EffectSoundColumn (Columns::ColumnId columnId)
|
||||
: Column<ESXRecordT> (columnId, ColumnBase::Display_Sound)
|
||||
{
|
||||
assert (this->mColumnId==Columns::ColumnId_CastingSound ||
|
||||
this->mColumnId==Columns::ColumnId_HitSound ||
|
||||
this->mColumnId==Columns::ColumnId_AreaSound ||
|
||||
this->mColumnId==Columns::ColumnId_BoltSound);
|
||||
}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
const std::string *string = 0;
|
||||
|
||||
switch (this->mColumnId)
|
||||
{
|
||||
case Columns::ColumnId_CastingSound: string = &record.get().mCastSound; break;
|
||||
case Columns::ColumnId_HitSound: string = &record.get().mHitSound; break;
|
||||
case Columns::ColumnId_AreaSound: string = &record.get().mAreaSound; break;
|
||||
case Columns::ColumnId_BoltSound: string = &record.get().mBoltSound; break;
|
||||
}
|
||||
|
||||
if (!string)
|
||||
throw std::logic_error ("Unsupported column ID");
|
||||
|
||||
return QString::fromUtf8 (string->c_str());
|
||||
}
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
std::string *string = 0;
|
||||
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
switch (this->mColumnId)
|
||||
{
|
||||
case Columns::ColumnId_CastingSound: string = &record2.mCastSound; break;
|
||||
case Columns::ColumnId_HitSound: string = &record2.mHitSound; break;
|
||||
case Columns::ColumnId_AreaSound: string = &record2.mAreaSound; break;
|
||||
case Columns::ColumnId_BoltSound: string = &record2.mBoltSound; break;
|
||||
}
|
||||
|
||||
if (!string)
|
||||
throw std::logic_error ("Unsupported column ID");
|
||||
|
||||
*string = data.toString().toUtf8().constData();
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
||||
virtual bool isEditable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -186,6 +186,21 @@ namespace CSMWorld
|
|||
{ ColumnId_GlobalProfile, "Global Profile" },
|
||||
{ ColumnId_RefNumCounter, "RefNum Counter" },
|
||||
{ ColumnId_RefNum, "RefNum" },
|
||||
{ ColumnId_Creature, "Creature" },
|
||||
{ ColumnId_SoundGeneratorType, "Sound Generator Type" },
|
||||
{ ColumnId_AllowSpellmaking, "Allow Spellmaking" },
|
||||
{ ColumnId_AllowEnchanting, "Allow Enchanting" },
|
||||
{ ColumnId_BaseCost, "Base Cost" },
|
||||
{ ColumnId_School, "School" },
|
||||
{ ColumnId_Particle, "Particle" },
|
||||
{ ColumnId_CastingObject, "Casting Object" },
|
||||
{ ColumnId_HitObject, "Hit Object" },
|
||||
{ ColumnId_AreaObject, "Area Object" },
|
||||
{ ColumnId_BoltObject, "Bolt Object" },
|
||||
{ ColumnId_CastingSound, "Casting Sound" },
|
||||
{ ColumnId_HitSound, "Hit Sound" },
|
||||
{ ColumnId_AreaSound, "Area Sound" },
|
||||
{ ColumnId_BoltSound, "Bolt Sound" },
|
||||
|
||||
{ ColumnId_UseValue1, "Use value 1" },
|
||||
{ ColumnId_UseValue2, "Use value 2" },
|
||||
|
@ -327,6 +342,17 @@ namespace
|
|||
"Skin", "Clothing", "Armour", 0
|
||||
};
|
||||
|
||||
static const char *sSoundGeneratorType[] =
|
||||
{
|
||||
"Left Foot", "Right Foot", "Swim Left", "Swim Right", "Moan", "Roar", "Scream",
|
||||
"Land", 0
|
||||
};
|
||||
|
||||
static const char *sSchools[] =
|
||||
{
|
||||
"Alteration", "Conjuration", "Destruction", "Illusion", "Mysticism", "Restoration", 0
|
||||
};
|
||||
|
||||
const char **getEnumNames (CSMWorld::Columns::ColumnId column)
|
||||
{
|
||||
switch (column)
|
||||
|
@ -347,6 +373,8 @@ namespace
|
|||
case CSMWorld::Columns::ColumnId_EnchantmentType: return sEnchantmentTypes;
|
||||
case CSMWorld::Columns::ColumnId_BodyPartType: return sBodyPartTypes;
|
||||
case CSMWorld::Columns::ColumnId_MeshType: return sMeshTypes;
|
||||
case CSMWorld::Columns::ColumnId_SoundGeneratorType: return sSoundGeneratorType;
|
||||
case CSMWorld::Columns::ColumnId_School: return sSchools;
|
||||
|
||||
default: return 0;
|
||||
}
|
||||
|
|
|
@ -179,7 +179,21 @@ namespace CSMWorld
|
|||
ColumnId_GlobalProfile = 167,
|
||||
ColumnId_RefNumCounter = 168,
|
||||
ColumnId_RefNum = 169,
|
||||
|
||||
ColumnId_Creature = 170,
|
||||
ColumnId_SoundGeneratorType = 171,
|
||||
ColumnId_AllowSpellmaking = 172,
|
||||
ColumnId_AllowEnchanting = 173,
|
||||
ColumnId_BaseCost = 174,
|
||||
ColumnId_School = 175,
|
||||
ColumnId_Particle = 176,
|
||||
ColumnId_CastingObject = 177,
|
||||
ColumnId_HitObject = 178,
|
||||
ColumnId_AreaObject = 179,
|
||||
ColumnId_BoltObject = 180,
|
||||
ColumnId_CastingSound = 177,
|
||||
ColumnId_HitSound = 178,
|
||||
ColumnId_AreaSound = 179,
|
||||
ColumnId_BoltSound = 180,
|
||||
// Allocated to a separate value range, so we don't get a collision should we ever need
|
||||
// to extend the number of use values.
|
||||
ColumnId_UseValue1 = 0x10000,
|
||||
|
|
|
@ -59,8 +59,8 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec
|
|||
}
|
||||
|
||||
CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager)
|
||||
: mEncoder (encoding), mRefs (mCells), mResourcesManager (resourcesManager), mReader (0),
|
||||
mDialogue (0)
|
||||
: mEncoder (encoding), mPathgrids (mCells), mRefs (mCells),
|
||||
mResourcesManager (resourcesManager), mReader (0), mDialogue (0)
|
||||
{
|
||||
mGlobals.addColumn (new StringIdColumn<ESM::Global>);
|
||||
mGlobals.addColumn (new RecordStateColumn<ESM::Global>);
|
||||
|
@ -71,7 +71,6 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
|||
mGmsts.addColumn (new StringIdColumn<ESM::GameSetting>);
|
||||
mGmsts.addColumn (new RecordStateColumn<ESM::GameSetting>);
|
||||
mGmsts.addColumn (new FixedRecordTypeColumn<ESM::GameSetting> (UniversalId::Type_Gmst));
|
||||
mGmsts.addColumn (new FixedRecordTypeColumn<ESM::GameSetting> (UniversalId::Type_Gmst));
|
||||
mGmsts.addColumn (new VarTypeColumn<ESM::GameSetting> (ColumnBase::Display_GmstVarType));
|
||||
mGmsts.addColumn (new VarValueColumn<ESM::GameSetting>);
|
||||
|
||||
|
@ -221,6 +220,40 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
|||
mBodyParts.addColumn (new ModelColumn<ESM::BodyPart>);
|
||||
mBodyParts.addColumn (new RaceColumn<ESM::BodyPart>);
|
||||
|
||||
mSoundGens.addColumn (new StringIdColumn<ESM::SoundGenerator>);
|
||||
mSoundGens.addColumn (new RecordStateColumn<ESM::SoundGenerator>);
|
||||
mSoundGens.addColumn (new FixedRecordTypeColumn<ESM::SoundGenerator> (UniversalId::Type_SoundGen));
|
||||
mSoundGens.addColumn (new CreatureColumn<ESM::SoundGenerator>);
|
||||
mSoundGens.addColumn (new SoundColumn<ESM::SoundGenerator>);
|
||||
mSoundGens.addColumn (new SoundGeneratorTypeColumn<ESM::SoundGenerator>);
|
||||
|
||||
mMagicEffects.addColumn (new StringIdColumn<ESM::MagicEffect>);
|
||||
mMagicEffects.addColumn (new RecordStateColumn<ESM::MagicEffect>);
|
||||
mMagicEffects.addColumn (new FixedRecordTypeColumn<ESM::MagicEffect> (UniversalId::Type_MagicEffect));
|
||||
mMagicEffects.addColumn (new SchoolColumn<ESM::MagicEffect>);
|
||||
mMagicEffects.addColumn (new BaseCostColumn<ESM::MagicEffect>);
|
||||
mMagicEffects.addColumn (new EffectTextureColumn<ESM::MagicEffect> (Columns::ColumnId_Icon));
|
||||
mMagicEffects.addColumn (new EffectTextureColumn<ESM::MagicEffect> (Columns::ColumnId_Particle));
|
||||
mMagicEffects.addColumn (new EffectObjectColumn<ESM::MagicEffect> (Columns::ColumnId_CastingObject));
|
||||
mMagicEffects.addColumn (new EffectObjectColumn<ESM::MagicEffect> (Columns::ColumnId_HitObject));
|
||||
mMagicEffects.addColumn (new EffectObjectColumn<ESM::MagicEffect> (Columns::ColumnId_AreaObject));
|
||||
mMagicEffects.addColumn (new EffectObjectColumn<ESM::MagicEffect> (Columns::ColumnId_BoltObject));
|
||||
mMagicEffects.addColumn (new EffectSoundColumn<ESM::MagicEffect> (Columns::ColumnId_CastingSound));
|
||||
mMagicEffects.addColumn (new EffectSoundColumn<ESM::MagicEffect> (Columns::ColumnId_HitSound));
|
||||
mMagicEffects.addColumn (new EffectSoundColumn<ESM::MagicEffect> (Columns::ColumnId_AreaSound));
|
||||
mMagicEffects.addColumn (new EffectSoundColumn<ESM::MagicEffect> (Columns::ColumnId_BoltSound));
|
||||
mMagicEffects.addColumn (new FlagColumn<ESM::MagicEffect> (
|
||||
Columns::ColumnId_AllowSpellmaking, ESM::MagicEffect::AllowSpellmaking));
|
||||
mMagicEffects.addColumn (new FlagColumn<ESM::MagicEffect> (
|
||||
Columns::ColumnId_AllowEnchanting, ESM::MagicEffect::AllowEnchanting));
|
||||
mMagicEffects.addColumn (new FlagColumn<ESM::MagicEffect> (
|
||||
Columns::ColumnId_NegativeLight, ESM::MagicEffect::NegativeLight));
|
||||
mMagicEffects.addColumn (new DescriptionColumn<ESM::MagicEffect>);
|
||||
|
||||
mPathgrids.addColumn (new StringIdColumn<Pathgrid>);
|
||||
mPathgrids.addColumn (new RecordStateColumn<Pathgrid>);
|
||||
mPathgrids.addColumn (new FixedRecordTypeColumn<Pathgrid> (UniversalId::Type_Pathgrid));
|
||||
|
||||
mRefs.addColumn (new StringIdColumn<CellRef> (true));
|
||||
mRefs.addColumn (new RecordStateColumn<CellRef>);
|
||||
mRefs.addColumn (new FixedRecordTypeColumn<CellRef> (UniversalId::Type_Reference));
|
||||
|
@ -291,6 +324,9 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
|
|||
addModel (new IdTable (&mCells, IdTable::Feature_ViewId), UniversalId::Type_Cell);
|
||||
addModel (new IdTable (&mEnchantments), UniversalId::Type_Enchantment);
|
||||
addModel (new IdTable (&mBodyParts), UniversalId::Type_BodyPart);
|
||||
addModel (new IdTable (&mSoundGens), UniversalId::Type_SoundGen);
|
||||
addModel (new IdTable (&mMagicEffects), UniversalId::Type_MagicEffect);
|
||||
addModel (new IdTable (&mPathgrids), UniversalId::Type_Pathgrid);
|
||||
addModel (new IdTable (&mReferenceables, IdTable::Feature_Preview),
|
||||
UniversalId::Type_Referenceable);
|
||||
addModel (new IdTable (&mRefs, IdTable::Feature_ViewCell | IdTable::Feature_Preview), UniversalId::Type_Reference);
|
||||
|
@ -549,6 +585,36 @@ const CSMWorld::IdCollection<CSMWorld::LandTexture>& CSMWorld::Data::getLandText
|
|||
return mLandTextures;
|
||||
}
|
||||
|
||||
const CSMWorld::IdCollection<ESM::SoundGenerator>& CSMWorld::Data::getSoundGens() const
|
||||
{
|
||||
return mSoundGens;
|
||||
}
|
||||
|
||||
CSMWorld::IdCollection<ESM::SoundGenerator>& CSMWorld::Data::getSoundGens()
|
||||
{
|
||||
return mSoundGens;
|
||||
}
|
||||
|
||||
const CSMWorld::IdCollection<ESM::MagicEffect>& CSMWorld::Data::getMagicEffects() const
|
||||
{
|
||||
return mMagicEffects;
|
||||
}
|
||||
|
||||
CSMWorld::IdCollection<ESM::MagicEffect>& CSMWorld::Data::getMagicEffects()
|
||||
{
|
||||
return mMagicEffects;
|
||||
}
|
||||
|
||||
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& CSMWorld::Data::getPathgrids() const
|
||||
{
|
||||
return mPathgrids;
|
||||
}
|
||||
|
||||
CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& CSMWorld::Data::getPathgrids()
|
||||
{
|
||||
return mPathgrids;
|
||||
}
|
||||
|
||||
const CSMWorld::Resources& CSMWorld::Data::getResources (const UniversalId& id) const
|
||||
{
|
||||
return mResourcesManager.get (id.getType());
|
||||
|
@ -641,6 +707,9 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Stage::Messages& messages)
|
|||
case ESM::REC_SPEL: mSpells.load (*mReader, mBase); break;
|
||||
case ESM::REC_ENCH: mEnchantments.load (*mReader, mBase); break;
|
||||
case ESM::REC_BODY: mBodyParts.load (*mReader, mBase); break;
|
||||
case ESM::REC_SNDG: mSoundGens.load (*mReader, mBase); break;
|
||||
case ESM::REC_MGEF: mMagicEffects.load (*mReader, mBase); break;
|
||||
case ESM::REC_PGRD: mPathgrids.load (*mReader, mBase); break;
|
||||
|
||||
case ESM::REC_LTEX: mLandTextures.load (*mReader, mBase); break;
|
||||
case ESM::REC_LAND: mLand.load(*mReader, mBase); break;
|
||||
|
@ -794,9 +863,9 @@ bool CSMWorld::Data::hasId (const std::string& id) const
|
|||
getCells().searchId (id)!=-1 ||
|
||||
getEnchantments().searchId (id)!=-1 ||
|
||||
getBodyParts().searchId (id)!=-1 ||
|
||||
getReferenceables().searchId (id)!=-1 ||
|
||||
getLand().searchId (id) != -1 ||
|
||||
getLandTextures().searchId (id) != -1;
|
||||
getSoundGens().searchId (id)!=-1 ||
|
||||
getMagicEffects().searchId (id)!=-1 ||
|
||||
getReferenceables().searchId (id)!=-1;
|
||||
}
|
||||
|
||||
int CSMWorld::Data::count (RecordBase::State state) const
|
||||
|
@ -816,9 +885,12 @@ int CSMWorld::Data::count (RecordBase::State state) const
|
|||
count (state, mCells) +
|
||||
count (state, mEnchantments) +
|
||||
count (state, mBodyParts) +
|
||||
count (state, mReferenceables) +
|
||||
count (state, mLand) +
|
||||
count (state, mLandTextures);
|
||||
count (state, mLandTextures) +
|
||||
count (state, mSoundGens) +
|
||||
count (state, mMagicEffects) +
|
||||
count (state, mReferenceables) +
|
||||
count (state, mPathgrids);
|
||||
}
|
||||
|
||||
void CSMWorld::Data::setDescription (const std::string& description)
|
||||
|
@ -860,9 +932,9 @@ std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
|
|||
appendIds (ids, mCells, listDeleted);
|
||||
appendIds (ids, mEnchantments, listDeleted);
|
||||
appendIds (ids, mBodyParts, listDeleted);
|
||||
appendIds (ids, mSoundGens, listDeleted);
|
||||
appendIds (ids, mMagicEffects, listDeleted);
|
||||
appendIds (ids, mReferenceables, listDeleted);
|
||||
appendIds (ids, mLand, listDeleted);
|
||||
appendIds (ids, mLandTextures, listDeleted);
|
||||
|
||||
std::sort (ids.begin(), ids.end());
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <components/esm/loaddial.hpp>
|
||||
#include <components/esm/loadench.hpp>
|
||||
#include <components/esm/loadbody.hpp>
|
||||
#include <components/esm/loadsndg.hpp>
|
||||
#include <components/esm/loadmgef.hpp>
|
||||
#include <components/esm/debugprofile.hpp>
|
||||
#include <components/esm/filter.hpp>
|
||||
|
||||
|
@ -38,6 +40,8 @@
|
|||
#include "refidcollection.hpp"
|
||||
#include "refcollection.hpp"
|
||||
#include "infocollection.hpp"
|
||||
#include "pathgrid.hpp"
|
||||
#include "subcellcollection.hpp"
|
||||
|
||||
class QAbstractItemModel;
|
||||
|
||||
|
@ -72,7 +76,10 @@ namespace CSMWorld
|
|||
IdCollection<ESM::Dialogue> mJournals;
|
||||
IdCollection<ESM::Enchantment> mEnchantments;
|
||||
IdCollection<ESM::BodyPart> mBodyParts;
|
||||
IdCollection<ESM::MagicEffect> mMagicEffects;
|
||||
SubCellCollection<Pathgrid> mPathgrids;
|
||||
IdCollection<ESM::DebugProfile> mDebugProfiles;
|
||||
IdCollection<ESM::SoundGenerator> mSoundGens;
|
||||
InfoCollection mTopicInfos;
|
||||
InfoCollection mJournalInfos;
|
||||
IdCollection<Cell> mCells;
|
||||
|
@ -205,6 +212,18 @@ namespace CSMWorld
|
|||
|
||||
const IdCollection<CSMWorld::LandTexture>& getLandTextures() const;
|
||||
|
||||
const IdCollection<ESM::SoundGenerator>& getSoundGens() const;
|
||||
|
||||
IdCollection<ESM::SoundGenerator>& getSoundGens();
|
||||
|
||||
const IdCollection<ESM::MagicEffect>& getMagicEffects() const;
|
||||
|
||||
IdCollection<ESM::MagicEffect>& getMagicEffects();
|
||||
|
||||
const SubCellCollection<Pathgrid>& getPathgrids() const;
|
||||
|
||||
SubCellCollection<Pathgrid>& getPathgrids();
|
||||
|
||||
/// Throws an exception, if \a id does not match a resources list.
|
||||
const Resources& getResources (const UniversalId& id) const;
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ namespace CSMWorld
|
|||
template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT> >
|
||||
class IdCollection : public Collection<ESXRecordT, IdAccessorT>
|
||||
{
|
||||
virtual void loadRecord (ESXRecordT& record, ESM::ESMReader& reader);
|
||||
|
||||
public:
|
||||
|
||||
void load (ESM::ESMReader& reader, bool base);
|
||||
|
@ -26,6 +28,13 @@ namespace CSMWorld
|
|||
/// \return Has the ID been deleted?
|
||||
};
|
||||
|
||||
template<typename ESXRecordT, typename IdAccessorT>
|
||||
void IdCollection<ESXRecordT, IdAccessorT>::loadRecord (ESXRecordT& record,
|
||||
ESM::ESMReader& reader)
|
||||
{
|
||||
record.load (reader);
|
||||
}
|
||||
|
||||
template<typename ESXRecordT, typename IdAccessorT>
|
||||
void IdCollection<ESXRecordT, IdAccessorT>::load (ESM::ESMReader& reader, bool base)
|
||||
{
|
||||
|
@ -69,7 +78,7 @@ namespace CSMWorld
|
|||
record = this->getRecord (index).get();
|
||||
}
|
||||
|
||||
record.load (reader);
|
||||
loadRecord (record, reader);
|
||||
|
||||
if (index==-1)
|
||||
{
|
||||
|
|
35
apps/opencs/model/world/pathgrid.cpp
Normal file
35
apps/opencs/model/world/pathgrid.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
#include "pathgrid.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
void CSMWorld::Pathgrid::load (ESM::ESMReader &esm, const IdCollection<Cell>& cells)
|
||||
{
|
||||
load (esm);
|
||||
|
||||
// correct ID
|
||||
if (!mId.empty() && mId[0]!='#' && cells.searchId (mId)==-1)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
|
||||
stream << "#" << mData.mX << " " << mData.mY;
|
||||
|
||||
mId = stream.str();
|
||||
}
|
||||
}
|
||||
|
||||
void CSMWorld::Pathgrid::load (ESM::ESMReader &esm)
|
||||
{
|
||||
ESM::Pathgrid::load (esm);
|
||||
|
||||
if (mCell.empty())
|
||||
{
|
||||
std::ostringstream stream;
|
||||
|
||||
stream << "#" << mData.mX << " " << mData.mY;
|
||||
|
||||
mId = stream.str();
|
||||
}
|
||||
else
|
||||
mId = mCell;
|
||||
}
|
28
apps/opencs/model/world/pathgrid.hpp
Normal file
28
apps/opencs/model/world/pathgrid.hpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef CSM_WOLRD_PATHGRID_H
|
||||
#define CSM_WOLRD_PATHGRID_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <components/esm/loadpgrd.hpp>
|
||||
|
||||
#include "idcollection.hpp"
|
||||
#include "cell.hpp"
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
/// \brief Wrapper for Pathgrid record
|
||||
///
|
||||
/// \attention The mData.mX and mData.mY fields of the ESM::Pathgrid struct are not used.
|
||||
/// Exterior cell coordinates are encoded in the pathgrid ID.
|
||||
struct Pathgrid : public ESM::Pathgrid
|
||||
{
|
||||
std::string mId;
|
||||
|
||||
void load (ESM::ESMReader &esm, const IdCollection<Cell>& cells);
|
||||
|
||||
void load (ESM::ESMReader &esm);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
38
apps/opencs/model/world/subcellcollection.hpp
Normal file
38
apps/opencs/model/world/subcellcollection.hpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
#ifndef CSM_WOLRD_SUBCOLLECTION_H
|
||||
#define CSM_WOLRD_SUBCOLLECTION_H
|
||||
|
||||
#include "idcollection.hpp"
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
/// \brief Single type collection of top level records that are associated with cells
|
||||
template<typename ESXRecordT, typename IdAccessorT = IdAccessor<ESXRecordT> >
|
||||
class SubCellCollection : public IdCollection<ESXRecordT, IdAccessorT>
|
||||
{
|
||||
const IdCollection<Cell>& mCells;
|
||||
|
||||
virtual void loadRecord (ESXRecordT& record, ESM::ESMReader& reader);
|
||||
|
||||
public:
|
||||
|
||||
SubCellCollection (const IdCollection<Cell>& cells);
|
||||
|
||||
|
||||
};
|
||||
|
||||
template<typename ESXRecordT, typename IdAccessorT>
|
||||
void SubCellCollection<ESXRecordT, IdAccessorT>::loadRecord (ESXRecordT& record,
|
||||
ESM::ESMReader& reader)
|
||||
{
|
||||
record.load (reader, mCells);
|
||||
}
|
||||
|
||||
template<typename ESXRecordT, typename IdAccessorT>
|
||||
SubCellCollection<ESXRecordT, IdAccessorT>::SubCellCollection (
|
||||
const IdCollection<Cell>& cells)
|
||||
: mCells (cells)
|
||||
{}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -52,6 +52,9 @@ namespace
|
|||
{ CSMWorld::UniversalId::Class_ResourceList, CSMWorld::UniversalId::Type_Videos, "Videos", 0 },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_DebugProfiles, "Debug Profiles", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Transient, CSMWorld::UniversalId::Type_RunLog, "Run Log", 0 },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_SoundGens, "Sound Generators", 0 },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_MagicEffects, "Magic Effects", 0 },
|
||||
{ CSMWorld::UniversalId::Class_RecordList, CSMWorld::UniversalId::Type_Pathgrids, "Pathgrids", 0 },
|
||||
|
||||
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker
|
||||
};
|
||||
|
@ -112,6 +115,9 @@ namespace
|
|||
{ CSMWorld::UniversalId::Class_Resource, CSMWorld::UniversalId::Type_Texture, "Texture", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Resource, CSMWorld::UniversalId::Type_Video, "Video", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_DebugProfile, "Debug Profile", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_SoundGen, "Sound Generator", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_MagicEffect, "Magic Effect", 0 },
|
||||
{ CSMWorld::UniversalId::Class_Record, CSMWorld::UniversalId::Type_Pathgrid, "Pathgrid", 0 },
|
||||
|
||||
{ CSMWorld::UniversalId::Class_None, CSMWorld::UniversalId::Type_None, 0, 0 } // end marker
|
||||
};
|
||||
|
|
|
@ -122,10 +122,16 @@ namespace CSMWorld
|
|||
Type_Video,
|
||||
Type_DebugProfiles,
|
||||
Type_DebugProfile,
|
||||
Type_SoundGens,
|
||||
Type_SoundGen,
|
||||
Type_MagicEffects,
|
||||
Type_MagicEffect,
|
||||
Type_Pathgrids,
|
||||
Type_Pathgrid,
|
||||
Type_RunLog
|
||||
};
|
||||
|
||||
enum { NumberOfTypes = Type_DebugProfile+1 };
|
||||
enum { NumberOfTypes = Type_RunLog+1 };
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -135,6 +135,10 @@ void CSVDoc::View::setupWorldMenu()
|
|||
connect (references, SIGNAL (triggered()), this, SLOT (addReferencesSubView()));
|
||||
world->addAction (references);
|
||||
|
||||
QAction *grid = new QAction (tr ("Pathgrid"), this);
|
||||
connect (grid, SIGNAL (triggered()), this, SLOT (addPathgridSubView()));
|
||||
world->addAction (grid);
|
||||
|
||||
world->addSeparator(); // items that don't represent single record lists follow here
|
||||
|
||||
QAction *regionMap = new QAction (tr ("Region Map"), this);
|
||||
|
@ -165,6 +169,10 @@ void CSVDoc::View::setupMechanicsMenu()
|
|||
QAction *enchantments = new QAction (tr ("Enchantments"), this);
|
||||
connect (enchantments, SIGNAL (triggered()), this, SLOT (addEnchantmentsSubView()));
|
||||
mechanics->addAction (enchantments);
|
||||
|
||||
QAction *effects = new QAction (tr ("Magic Effects"), this);
|
||||
connect (effects, SIGNAL (triggered()), this, SLOT (addMagicEffectsSubView()));
|
||||
mechanics->addAction (effects);
|
||||
}
|
||||
|
||||
void CSVDoc::View::setupCharacterMenu()
|
||||
|
@ -220,6 +228,10 @@ void CSVDoc::View::setupAssetsMenu()
|
|||
connect (sounds, SIGNAL (triggered()), this, SLOT (addSoundsSubView()));
|
||||
assets->addAction (sounds);
|
||||
|
||||
QAction *soundGens = new QAction (tr ("Sound Generators"), this);
|
||||
connect (soundGens, SIGNAL (triggered()), this, SLOT (addSoundGensSubView()));
|
||||
assets->addAction (soundGens);
|
||||
|
||||
assets->addSeparator(); // resources follow here
|
||||
|
||||
QAction *meshes = new QAction (tr ("Meshes"), this);
|
||||
|
@ -634,6 +646,11 @@ void CSVDoc::View::addBodyPartsSubView()
|
|||
addSubView (CSMWorld::UniversalId::Type_BodyParts);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addSoundGensSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_SoundGens);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addMeshesSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_Meshes);
|
||||
|
@ -654,6 +671,11 @@ void CSVDoc::View::addSoundsResSubView()
|
|||
addSubView (CSMWorld::UniversalId::Type_SoundsRes);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addMagicEffectsSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_MagicEffects);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addTexturesSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_Textures);
|
||||
|
@ -674,6 +696,11 @@ void CSVDoc::View::addRunLogSubView()
|
|||
addSubView (CSMWorld::UniversalId::Type_RunLog);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addPathgridSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_Pathgrids);
|
||||
}
|
||||
|
||||
void CSVDoc::View::abortOperation (int type)
|
||||
{
|
||||
mDocument->abortOperation (type);
|
||||
|
|
|
@ -193,6 +193,10 @@ namespace CSVDoc
|
|||
|
||||
void addBodyPartsSubView();
|
||||
|
||||
void addSoundGensSubView();
|
||||
|
||||
void addMagicEffectsSubView();
|
||||
|
||||
void addMeshesSubView();
|
||||
|
||||
void addIconsSubView();
|
||||
|
@ -209,6 +213,8 @@ namespace CSVDoc
|
|||
|
||||
void addRunLogSubView();
|
||||
|
||||
void addPathgridSubView();
|
||||
|
||||
void toggleShowStatusBar (bool show);
|
||||
|
||||
void loadErrorLog();
|
||||
|
|
|
@ -82,7 +82,9 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager)
|
|||
{ CSMWorld::ColumnBase::Display_EnchantmentType, CSMWorld::Columns::ColumnId_EnchantmentType, false },
|
||||
{ CSMWorld::ColumnBase::Display_BodyPartType, CSMWorld::Columns::ColumnId_BodyPartType, false },
|
||||
{ CSMWorld::ColumnBase::Display_MeshType, CSMWorld::Columns::ColumnId_MeshType, false },
|
||||
{ CSMWorld::ColumnBase::Display_Gender, CSMWorld::Columns::ColumnId_Gender, true }
|
||||
{ CSMWorld::ColumnBase::Display_Gender, CSMWorld::Columns::ColumnId_Gender, true },
|
||||
{ CSMWorld::ColumnBase::Display_SoundGeneratorType, CSMWorld::Columns::ColumnId_SoundGeneratorType, false },
|
||||
{ CSMWorld::ColumnBase::Display_School, CSMWorld::Columns::ColumnId_School, true }
|
||||
};
|
||||
|
||||
for (std::size_t i=0; i<sizeof (sMapping)/sizeof (Mapping); ++i)
|
||||
|
|
|
@ -26,6 +26,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
|||
manager.add (CSMWorld::UniversalId::Type_Skills,
|
||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, NullCreatorFactory>);
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_MagicEffects,
|
||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, NullCreatorFactory>);
|
||||
|
||||
static const CSMWorld::UniversalId::Type sTableTypes[] =
|
||||
{
|
||||
CSMWorld::UniversalId::Type_Globals,
|
||||
|
@ -38,6 +41,8 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
|||
CSMWorld::UniversalId::Type_Spells,
|
||||
CSMWorld::UniversalId::Type_Enchantments,
|
||||
CSMWorld::UniversalId::Type_BodyParts,
|
||||
CSMWorld::UniversalId::Type_SoundGens,
|
||||
CSMWorld::UniversalId::Type_Pathgrids,
|
||||
|
||||
CSMWorld::UniversalId::Type_None // end marker
|
||||
};
|
||||
|
@ -116,6 +121,8 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
|||
CSMWorld::UniversalId::Type_Faction,
|
||||
CSMWorld::UniversalId::Type_Enchantment,
|
||||
CSMWorld::UniversalId::Type_BodyPart,
|
||||
CSMWorld::UniversalId::Type_SoundGen,
|
||||
CSMWorld::UniversalId::Type_Pathgrid,
|
||||
|
||||
CSMWorld::UniversalId::Type_None // end marker
|
||||
};
|
||||
|
@ -128,6 +135,9 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
|||
manager.add (CSMWorld::UniversalId::Type_Skill,
|
||||
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, NullCreatorFactory > (false));
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_MagicEffect,
|
||||
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, NullCreatorFactory > (false));
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_Gmst,
|
||||
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, NullCreatorFactory > (false));
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "loadmgef.hpp"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
|
@ -10,6 +11,157 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
static const char *sIds[ESM::MagicEffect::Length] =
|
||||
{
|
||||
"WaterBreathing",
|
||||
"SwiftSwim",
|
||||
"WaterWalking",
|
||||
"Shield",
|
||||
"FireShield",
|
||||
"LightningShield",
|
||||
"FrostShield",
|
||||
"Burden",
|
||||
"Feather",
|
||||
"Jump",
|
||||
"Levitate",
|
||||
"SlowFall",
|
||||
"Lock",
|
||||
"Open",
|
||||
"FireDamage",
|
||||
"ShockDamage",
|
||||
"FrostDamage",
|
||||
"DrainAttribute",
|
||||
"DrainHealth",
|
||||
"DrainMagicka",
|
||||
"DrainFatigue",
|
||||
"DrainSkill",
|
||||
"DamageAttribute",
|
||||
"DamageHealth",
|
||||
"DamageMagicka",
|
||||
"DamageFatigue",
|
||||
"DamageSkill",
|
||||
"Poison",
|
||||
"WeaknessToFire",
|
||||
"WeaknessToFrost",
|
||||
"WeaknessToShock",
|
||||
"WeaknessToMagicka",
|
||||
"WeaknessToCommonDisease",
|
||||
"WeaknessToBlightDisease",
|
||||
"WeaknessToCorprusDisease",
|
||||
"WeaknessToPoison",
|
||||
"WeaknessToNormalWeapons",
|
||||
"DisintegrateWeapon",
|
||||
"DisintegrateArmor",
|
||||
"Invisibility",
|
||||
"Chameleon",
|
||||
"Light",
|
||||
"Sanctuary",
|
||||
"NightEye",
|
||||
"Charm",
|
||||
"Paralyze",
|
||||
"Silence",
|
||||
"Blind",
|
||||
"Sound",
|
||||
"CalmHumanoid",
|
||||
"CalmCreature",
|
||||
"FrenzyHumanoid",
|
||||
"FrenzyCreature",
|
||||
"DemoralizeHumanoid",
|
||||
"DemoralizeCreature",
|
||||
"RallyHumanoid",
|
||||
"RallyCreature",
|
||||
"Dispel",
|
||||
"Soultrap",
|
||||
"Telekinesis",
|
||||
"Mark",
|
||||
"Recall",
|
||||
"DivineIntervention",
|
||||
"AlmsiviIntervention",
|
||||
"DetectAnimal",
|
||||
"DetectEnchantment",
|
||||
"DetectKey",
|
||||
"SpellAbsorption",
|
||||
"Reflect",
|
||||
"CureCommonDisease",
|
||||
"CureBlightDisease",
|
||||
"CureCorprusDisease",
|
||||
"CurePoison",
|
||||
"CureParalyzation",
|
||||
"RestoreAttribute",
|
||||
"RestoreHealth",
|
||||
"RestoreMagicka",
|
||||
"RestoreFatigue",
|
||||
"RestoreSkill",
|
||||
"FortifyAttribute",
|
||||
"FortifyHealth",
|
||||
"FortifyMagicka",
|
||||
"FortifyFatigue",
|
||||
"FortifySkill",
|
||||
"FortifyMaximumMagicka",
|
||||
"AbsorbAttribute",
|
||||
"AbsorbHealth",
|
||||
"AbsorbMagicka",
|
||||
"AbsorbFatigue",
|
||||
"AbsorbSkill",
|
||||
"ResistFire",
|
||||
"ResistFrost",
|
||||
"ResistShock",
|
||||
"ResistMagicka",
|
||||
"ResistCommonDisease",
|
||||
"ResistBlightDisease",
|
||||
"ResistCorprusDisease",
|
||||
"ResistPoison",
|
||||
"ResistNormalWeapons",
|
||||
"ResistParalysis",
|
||||
"RemoveCurse",
|
||||
"TurnUndead",
|
||||
"SummonScamp",
|
||||
"SummonClannfear",
|
||||
"SummonDaedroth",
|
||||
"SummonDremora",
|
||||
"SummonAncestralGhost",
|
||||
"SummonSkeletalMinion",
|
||||
"SummonBonewalker",
|
||||
"SummonGreaterBonewalker",
|
||||
"SummonBonelord",
|
||||
"SummonWingedTwilight",
|
||||
"SummonHunger",
|
||||
"SummonGoldenSaint",
|
||||
"SummonFlameAtronach",
|
||||
"SummonFrostAtronach",
|
||||
"SummonStormAtronach",
|
||||
"FortifyAttack",
|
||||
"CommandCreature",
|
||||
"CommandHumanoid",
|
||||
"BoundDagger",
|
||||
"BoundLongsword",
|
||||
"BoundMace",
|
||||
"BoundBattleAxe",
|
||||
"BoundSpear",
|
||||
"BoundLongbow",
|
||||
"ExtraSpell",
|
||||
"BoundCuirass",
|
||||
"BoundHelm",
|
||||
"BoundBoots",
|
||||
"BoundShield",
|
||||
"BoundGloves",
|
||||
"Corprus",
|
||||
"Vampirism",
|
||||
"SummonCenturionSphere",
|
||||
"SunDamage",
|
||||
"StuntedMagicka",
|
||||
|
||||
// Tribunal only
|
||||
"SummonFabricant",
|
||||
|
||||
// Bloodmoon only
|
||||
"SummonWolf",
|
||||
"SummonBear",
|
||||
"SummonBonewolf",
|
||||
"SummonCreature04",
|
||||
"SummonCreature05"
|
||||
};
|
||||
|
||||
const int NumberOfHardcodedFlags = 143;
|
||||
const int HardcodedFlags[NumberOfHardcodedFlags] = {
|
||||
0x11c8, 0x11c0, 0x11c8, 0x11e0, 0x11e0, 0x11e0, 0x11e0, 0x11d0,
|
||||
|
@ -41,6 +193,8 @@ void MagicEffect::load(ESMReader &esm)
|
|||
{
|
||||
esm.getHNT(mIndex, "INDX");
|
||||
|
||||
mId = indexToId (mIndex);
|
||||
|
||||
esm.getHNT(mData, "MEDT", 36);
|
||||
if (esm.getFormat() == 0)
|
||||
{
|
||||
|
@ -388,4 +542,51 @@ MagicEffect::MagnitudeDisplayType MagicEffect::getMagnitudeDisplayType() const {
|
|||
return MDT_Points;
|
||||
}
|
||||
|
||||
void MagicEffect::blank()
|
||||
{
|
||||
mData.mSchool = 0;
|
||||
mData.mBaseCost = 0;
|
||||
mData.mFlags = 0;
|
||||
mData.mRed = 0;
|
||||
mData.mGreen = 0;
|
||||
mData.mBlue = 0;
|
||||
mData.mSpeed = 0;
|
||||
|
||||
mIcon.clear();
|
||||
mParticle.clear();
|
||||
mCasting.clear();
|
||||
mHit.clear();
|
||||
mArea.clear();
|
||||
mBolt.clear();
|
||||
mCastSound.clear();
|
||||
mBoltSound.clear();
|
||||
mHitSound.clear();
|
||||
mAreaSound.clear();
|
||||
mDescription.clear();
|
||||
}
|
||||
|
||||
std::string MagicEffect::indexToId (int index)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
|
||||
if (index!=-1)
|
||||
{
|
||||
stream << "#";
|
||||
|
||||
if (index<100)
|
||||
{
|
||||
stream << "0";
|
||||
|
||||
if (index<10)
|
||||
stream << "0";
|
||||
}
|
||||
|
||||
stream << index;
|
||||
|
||||
if (index>=0 && index<Length)
|
||||
stream << sIds[index];
|
||||
}
|
||||
|
||||
return stream.str();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ struct MagicEffect
|
|||
{
|
||||
static unsigned int sRecordId;
|
||||
|
||||
std::string mId;
|
||||
|
||||
enum Flags
|
||||
{
|
||||
// Originally fixed flags (HardcodedFlags array consists of just these)
|
||||
|
@ -95,6 +97,8 @@ struct MagicEffect
|
|||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm) const;
|
||||
|
||||
/// Set record to default state (does not touch the ID/index).
|
||||
void blank();
|
||||
|
||||
enum Effects
|
||||
{
|
||||
|
@ -248,6 +252,8 @@ struct MagicEffect
|
|||
|
||||
Length
|
||||
};
|
||||
|
||||
static std::string indexToId (int index);
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -115,4 +115,14 @@ void Pathgrid::save(ESMWriter &esm) const
|
|||
}
|
||||
}
|
||||
|
||||
void Pathgrid::blank()
|
||||
{
|
||||
mCell.clear();
|
||||
mData.mX = 0;
|
||||
mData.mY = 0;
|
||||
mData.mS1 = 0;
|
||||
mData.mS2 = 0;
|
||||
mPoints.clear();
|
||||
mEdges.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@ struct Pathgrid
|
|||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm) const;
|
||||
|
||||
void blank();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -22,4 +22,10 @@ void SoundGenerator::save(ESMWriter &esm) const
|
|||
esm.writeHNOCString("SNAM", mSound);
|
||||
}
|
||||
|
||||
void SoundGenerator::blank()
|
||||
{
|
||||
mType = LeftFoot;
|
||||
mCreature.clear();
|
||||
mSound.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ struct SoundGenerator
|
|||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm) const;
|
||||
|
||||
void blank();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue