mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2026-01-31 19:28:27 +00:00
[General] Cell record water level information
This commit is contained in:
parent
6a4968e6e0
commit
3111f7e988
5 changed files with 71 additions and 0 deletions
|
|
@ -1530,6 +1530,41 @@ void RecordsDynamicFunctions::SetRecordFog(unsigned int red, unsigned int green,
|
|||
tempOverrides.hasFog = true;
|
||||
}
|
||||
|
||||
void RecordsDynamicFunctions::SetRecordHasWater(bool hasWater) noexcept
|
||||
{
|
||||
unsigned short writeRecordsType = WorldstateFunctions::writeWorldstate.recordsType;
|
||||
|
||||
if (writeRecordsType == mwmp::RECORD_TYPE::CELL) {
|
||||
if(hasWater)
|
||||
tempCell.data.mData.mFlags |= ESM::Cell::Flags::HasWater;
|
||||
else
|
||||
tempCell.data.mData.mFlags &= ~ESM::Cell::Flags::HasWater;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_ERROR, "Tried to set ambient color for record type %i which lacks that property", writeRecordsType);
|
||||
return;
|
||||
}
|
||||
|
||||
tempOverrides.hasHasWater = true;
|
||||
}
|
||||
|
||||
void RecordsDynamicFunctions::SetRecordWaterLevel(double waterLevel) noexcept
|
||||
{
|
||||
unsigned short writeRecordsType = WorldstateFunctions::writeWorldstate.recordsType;
|
||||
|
||||
if (writeRecordsType == mwmp::RECORD_TYPE::CELL) {
|
||||
tempCell.data.mWater = waterLevel;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_MESSAGE_SIMPLE(TimedLog::LOG_ERROR, "Tried to set ambient color for record type %i which lacks that property", writeRecordsType);
|
||||
return;
|
||||
}
|
||||
|
||||
tempOverrides.hasWaterLevel = true;
|
||||
}
|
||||
|
||||
void RecordsDynamicFunctions::SetRecordIdByIndex(unsigned int index, const char* id) noexcept
|
||||
{
|
||||
unsigned short writeRecordsType = WorldstateFunctions::writeWorldstate.recordsType;
|
||||
|
|
|
|||
|
|
@ -108,6 +108,8 @@
|
|||
{"SetRecordAmbientColor", RecordsDynamicFunctions::SetRecordAmbientColor},\
|
||||
{"SetRecordSunlightColor", RecordsDynamicFunctions::SetRecordSunlightColor},\
|
||||
{"SetRecordFog", RecordsDynamicFunctions::SetRecordFog},\
|
||||
{"SetRecordHasWater", RecordsDynamicFunctions::SetRecordHasWater},\
|
||||
{"SetRecordWaterLevel", RecordsDynamicFunctions::SetRecordWaterLevel},\
|
||||
\
|
||||
{"SetRecordIdByIndex", RecordsDynamicFunctions::SetRecordIdByIndex},\
|
||||
{"SetRecordEnchantmentIdByIndex", RecordsDynamicFunctions::SetRecordEnchantmentIdByIndex},\
|
||||
|
|
@ -918,6 +920,24 @@ public:
|
|||
*/
|
||||
static void SetRecordFog(unsigned int red, unsigned int green, unsigned int blue, double density) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Set the has water of the temporary record stored on the server for the
|
||||
* currently specified record type.
|
||||
*
|
||||
* \param hasWater Has water of the record
|
||||
* \return void
|
||||
*/
|
||||
static void SetRecordHasWater(bool hasWater) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Set the water level of the temporary record stored on the server for the
|
||||
* currently specified record type.
|
||||
*
|
||||
* \param waterLevel waterLevel of the record
|
||||
* \return void
|
||||
*/
|
||||
static void SetRecordWaterLevel(double waterLevel) noexcept;
|
||||
|
||||
/**
|
||||
* \brief Set the id of the record at a certain index in the records stored on the server.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -361,10 +361,21 @@ void RecordHelper::overrideRecord(const mwmp::CellRecord& record)
|
|||
finalData.mAmbi.mFog = recordData.mAmbi.mFog;
|
||||
finalData.mAmbi.mFogDensity = recordData.mAmbi.mFogDensity;
|
||||
}
|
||||
if (record.baseOverrides.hasHasWater) {
|
||||
bool hasWater = recordData.mData.mFlags & ESM::Cell::Flags::HasWater;
|
||||
if (hasWater)
|
||||
finalData.mData.mFlags |= ESM::Cell::Flags::HasWater;
|
||||
else
|
||||
finalData.mData.mFlags &= ~ESM::Cell::Flags::HasWater;
|
||||
}
|
||||
if (record.baseOverrides.hasWaterLevel) {
|
||||
finalData.mWater = recordData.mWater;
|
||||
}
|
||||
|
||||
world->unloadCell(finalData);
|
||||
world->clearCellStore(finalData);
|
||||
world->getModifiableStore().overrideRecord(finalData);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -143,6 +143,9 @@ namespace mwmp
|
|||
bool hasAmbientColor = false;
|
||||
bool hasSunlightColor = false;
|
||||
bool hasFog = false;
|
||||
bool hasHasWater = false;
|
||||
bool hasWaterLevel = false;
|
||||
|
||||
};
|
||||
|
||||
struct ActivatorRecord
|
||||
|
|
|
|||
|
|
@ -510,6 +510,8 @@ void PacketRecordDynamic::Packet(RakNet::BitStream *newBitstream, bool send)
|
|||
RW(overrides.hasAmbientColor, send);
|
||||
RW(overrides.hasSunlightColor, send);
|
||||
RW(overrides.hasFog, send);
|
||||
RW(overrides.hasHasWater, send);
|
||||
RW(overrides.hasWaterLevel, send);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue