mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 09:15:38 +00:00
Support dump for ESM3 CSTA record in esmtool
This commit is contained in:
parent
959de6f4c1
commit
8a62a4fe4d
2 changed files with 73 additions and 1 deletions
|
@ -4,6 +4,8 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <components/esm3/cellstate.hpp>
|
||||
#include <components/esm3/esmreader.hpp>
|
||||
#include <components/misc/strings/format.hpp>
|
||||
|
||||
namespace
|
||||
|
@ -213,11 +215,19 @@ namespace
|
|||
std::cout << " Destination Cell: " << dest.mCellName << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace EsmTool
|
||||
{
|
||||
void CellState::load(ESM::ESMReader& reader, bool& deleted)
|
||||
{
|
||||
mCellState.mId.load(reader);
|
||||
mCellState.load(reader);
|
||||
if (mCellState.mHasFogOfWar)
|
||||
mFogState.load(reader);
|
||||
deleted = false;
|
||||
reader.skipRecord();
|
||||
}
|
||||
|
||||
std::unique_ptr<RecordBase> RecordBase::create(const ESM::NAME type)
|
||||
{
|
||||
|
@ -435,6 +445,11 @@ namespace EsmTool
|
|||
record = std::make_unique<EsmTool::Record<ESM::StartScript>>();
|
||||
break;
|
||||
}
|
||||
case ESM::REC_CSTA:
|
||||
{
|
||||
record = std::make_unique<EsmTool::Record<CellState>>();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1339,6 +1354,38 @@ namespace EsmTool
|
|||
std::cout << " Deleted: " << mIsDeleted << std::endl;
|
||||
}
|
||||
|
||||
template <>
|
||||
void Record<CellState>::print()
|
||||
{
|
||||
std::cout << " Id:" << std::endl;
|
||||
std::cout << " Worldspace: " << mData.mCellState.mId.mWorldspace << std::endl;
|
||||
std::cout << " Index:" << std::endl;
|
||||
std::cout << " X: " << mData.mCellState.mId.mIndex.mX << std::endl;
|
||||
std::cout << " Y: " << mData.mCellState.mId.mIndex.mY << std::endl;
|
||||
std::cout << " Paged: " << mData.mCellState.mId.mPaged << std::endl;
|
||||
std::cout << " WaterLevel: " << mData.mCellState.mWaterLevel << std::endl;
|
||||
std::cout << " HasFogOfWar: " << mData.mCellState.mHasFogOfWar << std::endl;
|
||||
std::cout << " LastRespawn:" << std::endl;
|
||||
std::cout << " Day:" << mData.mCellState.mLastRespawn.mDay << std::endl;
|
||||
std::cout << " Hour:" << mData.mCellState.mLastRespawn.mHour << std::endl;
|
||||
if (mData.mCellState.mHasFogOfWar)
|
||||
{
|
||||
std::cout << " NorthMarkerAngle: " << mData.mFogState.mNorthMarkerAngle << std::endl;
|
||||
std::cout << " Bounds:" << std::endl;
|
||||
std::cout << " MinX: " << mData.mFogState.mBounds.mMinX << std::endl;
|
||||
std::cout << " MinY: " << mData.mFogState.mBounds.mMinY << std::endl;
|
||||
std::cout << " MaxX: " << mData.mFogState.mBounds.mMaxX << std::endl;
|
||||
std::cout << " MaxY: " << mData.mFogState.mBounds.mMaxY << std::endl;
|
||||
for (const ESM::FogTexture& fogTexture : mData.mFogState.mFogTextures)
|
||||
{
|
||||
std::cout << " FogTexture:" << std::endl;
|
||||
std::cout << " X: " << fogTexture.mX << std::endl;
|
||||
std::cout << " Y: " << fogTexture.mY << std::endl;
|
||||
std::cout << " ImageData: (" << fogTexture.mImageData.size() << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string Record<ESM::Cell>::getId() const
|
||||
{
|
||||
|
@ -1369,4 +1416,13 @@ namespace EsmTool
|
|||
return std::string(); // No ID for Skill record
|
||||
}
|
||||
|
||||
template <>
|
||||
std::string Record<CellState>::getId() const
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << mData.mCellState.mId.mWorldspace << " " << mData.mCellState.mId.mIndex.mX << " "
|
||||
<< mData.mCellState.mId.mIndex.mY << " " << mData.mCellState.mId.mPaged;
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include <string>
|
||||
|
||||
#include <components/esm/records.hpp>
|
||||
#include <components/esm3/cellstate.hpp>
|
||||
#include <components/esm3/fogstate.hpp>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
@ -58,6 +60,16 @@ namespace EsmTool
|
|||
}
|
||||
};
|
||||
|
||||
struct CellState
|
||||
{
|
||||
ESM::CellState mCellState;
|
||||
ESM::FogState mFogState;
|
||||
|
||||
void load(ESM::ESMReader& reader, bool& deleted);
|
||||
|
||||
void save(ESM::ESMWriter& /*writer*/, bool /*deleted*/) {}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class Record : public RecordBase
|
||||
{
|
||||
|
@ -91,6 +103,8 @@ namespace EsmTool
|
|||
std::string Record<ESM::Pathgrid>::getId() const;
|
||||
template <>
|
||||
std::string Record<ESM::Skill>::getId() const;
|
||||
template <>
|
||||
std::string Record<CellState>::getId() const;
|
||||
|
||||
template <>
|
||||
void Record<ESM::Activator>::print();
|
||||
|
@ -176,6 +190,8 @@ namespace EsmTool
|
|||
void Record<ESM::Static>::print();
|
||||
template <>
|
||||
void Record<ESM::Weapon>::print();
|
||||
template <>
|
||||
void Record<CellState>::print();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue