mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 07:53:51 +00:00
Avoid working with AMBI subrecord in tools unnecessarily (bug #5269)
This commit is contained in:
parent
d07cec9a38
commit
216a5d27c6
5 changed files with 48 additions and 5 deletions
|
@ -195,6 +195,7 @@
|
||||||
Bug #5249: Wandering NPCs start walking too soon after they hello
|
Bug #5249: Wandering NPCs start walking too soon after they hello
|
||||||
Bug #5250: Creatures display shield ground mesh instead of shield body part
|
Bug #5250: Creatures display shield ground mesh instead of shield body part
|
||||||
Bug #5255: "GetTarget, player" doesn't return 1 during NPC hello
|
Bug #5255: "GetTarget, player" doesn't return 1 during NPC hello
|
||||||
|
Bug #5269: Editor: Cell lighting in resaved cleaned content files is corrupted
|
||||||
Feature #1774: Handle AvoidNode
|
Feature #1774: Handle AvoidNode
|
||||||
Feature #2229: Improve pathfinding AI
|
Feature #2229: Improve pathfinding AI
|
||||||
Feature #3025: Analogue gamepad movement controls
|
Feature #3025: Analogue gamepad movement controls
|
||||||
|
|
|
@ -534,10 +534,18 @@ void Record<ESM::Cell>::print()
|
||||||
if (mData.mData.mFlags & ESM::Cell::Interior &&
|
if (mData.mData.mFlags & ESM::Cell::Interior &&
|
||||||
!(mData.mData.mFlags & ESM::Cell::QuasiEx))
|
!(mData.mData.mFlags & ESM::Cell::QuasiEx))
|
||||||
{
|
{
|
||||||
|
if (mData.hasAmbient())
|
||||||
|
{
|
||||||
|
// TODO: see if we can change the integer representation to something more sensible
|
||||||
std::cout << " Ambient Light Color: " << mData.mAmbi.mAmbient << std::endl;
|
std::cout << " Ambient Light Color: " << mData.mAmbi.mAmbient << std::endl;
|
||||||
std::cout << " Sunlight Color: " << mData.mAmbi.mSunlight << std::endl;
|
std::cout << " Sunlight Color: " << mData.mAmbi.mSunlight << std::endl;
|
||||||
std::cout << " Fog Color: " << mData.mAmbi.mFog << std::endl;
|
std::cout << " Fog Color: " << mData.mAmbi.mFog << std::endl;
|
||||||
std::cout << " Fog Density: " << mData.mAmbi.mFogDensity << std::endl;
|
std::cout << " Fog Density: " << mData.mAmbi.mFogDensity << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << " No Ambient Information" << std::endl;
|
||||||
|
}
|
||||||
std::cout << " Water Level: " << mData.mWater << std::endl;
|
std::cout << " Water Level: " << mData.mWater << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -867,6 +867,8 @@ namespace CSMWorld
|
||||||
switch (subColIndex)
|
switch (subColIndex)
|
||||||
{
|
{
|
||||||
case 0: return isInterior;
|
case 0: return isInterior;
|
||||||
|
// While the ambient information is not necessarily valid if the subrecord wasn't loaded,
|
||||||
|
// the user should still be allowed to edit it
|
||||||
case 1: return (isInterior && !behaveLikeExterior) ?
|
case 1: return (isInterior && !behaveLikeExterior) ?
|
||||||
cell.mAmbi.mAmbient : QVariant(QVariant::UserType);
|
cell.mAmbi.mAmbient : QVariant(QVariant::UserType);
|
||||||
case 2: return (isInterior && !behaveLikeExterior) ?
|
case 2: return (isInterior && !behaveLikeExterior) ?
|
||||||
|
@ -912,7 +914,10 @@ namespace CSMWorld
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
if (isInterior && !behaveLikeExterior)
|
if (isInterior && !behaveLikeExterior)
|
||||||
|
{
|
||||||
cell.mAmbi.mAmbient = static_cast<int32_t>(value.toInt());
|
cell.mAmbi.mAmbient = static_cast<int32_t>(value.toInt());
|
||||||
|
cell.setHasAmbient(true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return; // return without saving
|
return; // return without saving
|
||||||
break;
|
break;
|
||||||
|
@ -920,7 +925,10 @@ namespace CSMWorld
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
if (isInterior && !behaveLikeExterior)
|
if (isInterior && !behaveLikeExterior)
|
||||||
|
{
|
||||||
cell.mAmbi.mSunlight = static_cast<int32_t>(value.toInt());
|
cell.mAmbi.mSunlight = static_cast<int32_t>(value.toInt());
|
||||||
|
cell.setHasAmbient(true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return; // return without saving
|
return; // return without saving
|
||||||
break;
|
break;
|
||||||
|
@ -928,7 +936,10 @@ namespace CSMWorld
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
if (isInterior && !behaveLikeExterior)
|
if (isInterior && !behaveLikeExterior)
|
||||||
|
{
|
||||||
cell.mAmbi.mFog = static_cast<int32_t>(value.toInt());
|
cell.mAmbi.mFog = static_cast<int32_t>(value.toInt());
|
||||||
|
cell.setHasAmbient(true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return; // return without saving
|
return; // return without saving
|
||||||
break;
|
break;
|
||||||
|
@ -936,7 +947,10 @@ namespace CSMWorld
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
if (isInterior && !behaveLikeExterior)
|
if (isInterior && !behaveLikeExterior)
|
||||||
|
{
|
||||||
cell.mAmbi.mFogDensity = value.toFloat();
|
cell.mAmbi.mFogDensity = value.toFloat();
|
||||||
|
cell.setHasAmbient(true);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return; // return without saving
|
return; // return without saving
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -110,6 +110,7 @@ namespace ESM
|
||||||
void Cell::loadCell(ESMReader &esm, bool saveContext)
|
void Cell::loadCell(ESMReader &esm, bool saveContext)
|
||||||
{
|
{
|
||||||
bool isLoaded = false;
|
bool isLoaded = false;
|
||||||
|
mHasAmbi = false;
|
||||||
while (!isLoaded && esm.hasMoreSubs())
|
while (!isLoaded && esm.hasMoreSubs())
|
||||||
{
|
{
|
||||||
esm.getSubName();
|
esm.getSubName();
|
||||||
|
@ -127,6 +128,7 @@ namespace ESM
|
||||||
break;
|
break;
|
||||||
case ESM::FourCC<'A','M','B','I'>::value:
|
case ESM::FourCC<'A','M','B','I'>::value:
|
||||||
esm.getHT(mAmbi);
|
esm.getHT(mAmbi);
|
||||||
|
mHasAmbi = true;
|
||||||
break;
|
break;
|
||||||
case ESM::FourCC<'R','G','N','N'>::value:
|
case ESM::FourCC<'R','G','N','N'>::value:
|
||||||
mRegion = esm.getHString();
|
mRegion = esm.getHString();
|
||||||
|
@ -182,8 +184,13 @@ namespace ESM
|
||||||
if (mData.mFlags & QuasiEx)
|
if (mData.mFlags & QuasiEx)
|
||||||
esm.writeHNOCString("RGNN", mRegion);
|
esm.writeHNOCString("RGNN", mRegion);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// Try to avoid saving ambient lighting information when it's unnecessary.
|
||||||
|
// This is to fix black lighting in resaved cell records that lack this information.
|
||||||
|
if (mHasAmbi)
|
||||||
esm.writeHNT("AMBI", mAmbi, 16);
|
esm.writeHNT("AMBI", mAmbi, 16);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
esm.writeHNOCString("RGNN", mRegion);
|
esm.writeHNOCString("RGNN", mRegion);
|
||||||
|
@ -272,6 +279,7 @@ namespace ESM
|
||||||
mData.mX = 0;
|
mData.mX = 0;
|
||||||
mData.mY = 0;
|
mData.mY = 0;
|
||||||
|
|
||||||
|
mHasAmbi = true;
|
||||||
mAmbi.mAmbient = 0;
|
mAmbi.mAmbient = 0;
|
||||||
mAmbi.mSunlight = 0;
|
mAmbi.mSunlight = 0;
|
||||||
mAmbi.mFog = 0;
|
mAmbi.mFog = 0;
|
||||||
|
|
|
@ -90,6 +90,7 @@ struct Cell
|
||||||
|
|
||||||
Cell() : mName(""),
|
Cell() : mName(""),
|
||||||
mRegion(""),
|
mRegion(""),
|
||||||
|
mHasAmbi(true),
|
||||||
mWater(0),
|
mWater(0),
|
||||||
mWaterInt(false),
|
mWaterInt(false),
|
||||||
mMapColor(0),
|
mMapColor(0),
|
||||||
|
@ -108,6 +109,7 @@ struct Cell
|
||||||
CellId mCellId;
|
CellId mCellId;
|
||||||
|
|
||||||
AMBIstruct mAmbi;
|
AMBIstruct mAmbi;
|
||||||
|
bool mHasAmbi;
|
||||||
|
|
||||||
float mWater; // Water level
|
float mWater; // Water level
|
||||||
bool mWaterInt;
|
bool mWaterInt;
|
||||||
|
@ -152,6 +154,16 @@ struct Cell
|
||||||
return ((mData.mFlags&HasWater) != 0) || isExterior();
|
return ((mData.mFlags&HasWater) != 0) || isExterior();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasAmbient() const
|
||||||
|
{
|
||||||
|
return mHasAmbi;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setHasAmbient(bool hasAmbi)
|
||||||
|
{
|
||||||
|
mHasAmbi = hasAmbi;
|
||||||
|
}
|
||||||
|
|
||||||
// Restore the given reader to the stored position. Will try to open
|
// Restore the given reader to the stored position. Will try to open
|
||||||
// the file matching the stored file name. If you want to read from
|
// the file matching the stored file name. If you want to read from
|
||||||
// somewhere other than the file system, you need to pre-open the
|
// somewhere other than the file system, you need to pre-open the
|
||||||
|
|
Loading…
Reference in a new issue