mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 03:15:32 +00:00
[General] Add placeholder for Variant records in RecordDynamic packet
Fix spacing and sorting for Sound custom records.
This commit is contained in:
parent
7f435ceeac
commit
a43ba35790
2 changed files with 50 additions and 26 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <components/esm/loadstat.hpp>
|
||||
#include <components/esm/loadweap.hpp>
|
||||
#include <components/esm/loadsoun.hpp>
|
||||
#include <components/esm/variant.hpp>
|
||||
|
||||
#include <components/openmw-mp/Base/BaseStructs.hpp>
|
||||
|
||||
|
@ -56,10 +57,11 @@ namespace mwmp
|
|||
PROBE,
|
||||
REPAIR,
|
||||
SCRIPT,
|
||||
SOUND,
|
||||
SPELL,
|
||||
STATIC,
|
||||
WEAPON,
|
||||
SOUND
|
||||
VARIANT,
|
||||
WEAPON
|
||||
};
|
||||
|
||||
// When using an existing record as a base, this struct tracks which changes
|
||||
|
@ -292,6 +294,13 @@ namespace mwmp
|
|||
BaseOverrides baseOverrides;
|
||||
};
|
||||
|
||||
struct SoundRecord
|
||||
{
|
||||
ESM::Sound data;
|
||||
std::string baseId;
|
||||
BaseOverrides baseOverrides;
|
||||
};
|
||||
|
||||
struct SpellRecord
|
||||
{
|
||||
ESM::Spell data;
|
||||
|
@ -306,17 +315,17 @@ namespace mwmp
|
|||
BaseOverrides baseOverrides;
|
||||
};
|
||||
|
||||
struct WeaponRecord
|
||||
struct VariantRecord
|
||||
{
|
||||
ESM::Weapon data;
|
||||
unsigned int quantity = 1;
|
||||
ESM::Variant data;
|
||||
std::string baseId;
|
||||
BaseOverrides baseOverrides;
|
||||
};
|
||||
|
||||
struct SoundRecord
|
||||
struct WeaponRecord
|
||||
{
|
||||
ESM::Sound data;
|
||||
ESM::Weapon data;
|
||||
unsigned int quantity = 1;
|
||||
std::string baseId;
|
||||
BaseOverrides baseOverrides;
|
||||
};
|
||||
|
@ -410,6 +419,7 @@ namespace mwmp
|
|||
std::vector<SoundRecord> soundRecords;
|
||||
std::vector<SpellRecord> spellRecords;
|
||||
std::vector<StaticRecord> staticRecords;
|
||||
std::vector<VariantRecord> variantRecords;
|
||||
std::vector<WeaponRecord> weaponRecords;
|
||||
|
||||
std::vector<ESM::Cell> cellsToReset;
|
||||
|
|
|
@ -70,6 +70,8 @@ void PacketRecordDynamic::Packet(RakNet::BitStream *newBitstream, bool send)
|
|||
worldstate->recordsCount = Utils::getVectorSize(worldstate->staticRecords);
|
||||
else if (worldstate->recordsType == mwmp::RECORD_TYPE::SOUND)
|
||||
worldstate->recordsCount = Utils::getVectorSize(worldstate->soundRecords);
|
||||
else if (worldstate->recordsType == mwmp::RECORD_TYPE::VARIANT)
|
||||
worldstate->recordsCount = Utils::getVectorSize(worldstate->variantRecords);
|
||||
else
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_ERROR, "Processed invalid ID_RECORD_DYNAMIC packet about unimplemented recordsType %i",
|
||||
|
@ -134,10 +136,12 @@ void PacketRecordDynamic::Packet(RakNet::BitStream *newBitstream, bool send)
|
|||
Utils::resetVector(worldstate->repairRecords, worldstate->recordsCount);
|
||||
else if (worldstate->recordsType == mwmp::RECORD_TYPE::SCRIPT)
|
||||
Utils::resetVector(worldstate->scriptRecords, worldstate->recordsCount);
|
||||
else if (worldstate->recordsType == mwmp::RECORD_TYPE::STATIC)
|
||||
Utils::resetVector(worldstate->staticRecords, worldstate->recordsCount);
|
||||
else if (worldstate->recordsType == mwmp::RECORD_TYPE::SOUND)
|
||||
Utils::resetVector(worldstate->soundRecords, worldstate->recordsCount);
|
||||
else if (worldstate->recordsType == mwmp::RECORD_TYPE::STATIC)
|
||||
Utils::resetVector(worldstate->staticRecords, worldstate->recordsCount);
|
||||
else if (worldstate->recordsType == mwmp::RECORD_TYPE::VARIANT)
|
||||
Utils::resetVector(worldstate->variantRecords, worldstate->recordsCount);
|
||||
}
|
||||
|
||||
if (worldstate->recordsType == mwmp::RECORD_TYPE::SPELL)
|
||||
|
@ -854,26 +858,36 @@ void PacketRecordDynamic::Packet(RakNet::BitStream *newBitstream, bool send)
|
|||
}
|
||||
else if (worldstate->recordsType == mwmp::RECORD_TYPE::SOUND)
|
||||
{
|
||||
for (auto&& record : worldstate->soundRecords)
|
||||
{
|
||||
auto& recordData = record.data;
|
||||
|
||||
RW(record.baseId, send, true);
|
||||
RW(recordData.mId, send, true);
|
||||
RW(recordData.mSound, send, true);
|
||||
RW(recordData.mData.mVolume, send);
|
||||
RW(recordData.mData.mMinRange, send);
|
||||
RW(recordData.mData.mMaxRange, send);
|
||||
|
||||
if (!record.baseId.empty())
|
||||
for (auto&& record : worldstate->soundRecords)
|
||||
{
|
||||
auto&& overrides = record.baseOverrides;
|
||||
RW(overrides.hasSound, send);
|
||||
RW(overrides.hasVolume, send);
|
||||
RW(overrides.hasMinRange, send);
|
||||
RW(overrides.hasMaxRange, send);
|
||||
auto& recordData = record.data;
|
||||
|
||||
RW(record.baseId, send, true);
|
||||
RW(recordData.mId, send, true);
|
||||
RW(recordData.mSound, send, true);
|
||||
RW(recordData.mData.mVolume, send);
|
||||
RW(recordData.mData.mMinRange, send);
|
||||
RW(recordData.mData.mMaxRange, send);
|
||||
|
||||
if (!record.baseId.empty())
|
||||
{
|
||||
auto&& overrides = record.baseOverrides;
|
||||
RW(overrides.hasSound, send);
|
||||
RW(overrides.hasVolume, send);
|
||||
RW(overrides.hasMinRange, send);
|
||||
RW(overrides.hasMaxRange, send);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Placeholder
|
||||
else if (worldstate->recordsType == mwmp::RECORD_TYPE::VARIANT)
|
||||
{
|
||||
for (auto&& record : worldstate->variantRecords)
|
||||
{
|
||||
auto& recordData = record.data;
|
||||
|
||||
RW(record.baseId, send, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue