Added support for "white ambient" flag in DKCR to fix black world geometry

This commit is contained in:
parax0 2016-02-17 03:43:15 -07:00
parent 63bdc1def7
commit 1727a337c6
4 changed files with 8 additions and 7 deletions

View File

@ -36,7 +36,8 @@ public:
eIndStage = 0x400,
eLightmap = 0x800,
eShortTexCoord = 0x2000,
eAllSettings = 0x2FF8
eDrawWhiteAmbient = 0x80000, // this flag is possibly incorrect! attempted fix for black world models in DKCR
eAllSettings = 0x82FF8
};
DECLARE_FLAGS(EMaterialOption, FMaterialOptions)

View File

@ -261,8 +261,9 @@ CMaterial* CMaterialLoader::ReadCorruptionMaterial()
pMat->mOptions |= CMaterial::eTransparent;
}
if (Flags & 0x10) pMat->mOptions |= CMaterial::ePunchthrough;
if (Flags & 0x100) pMat->mOptions |= CMaterial::eOccluder;
if (Flags & 0x10) pMat->mOptions |= CMaterial::ePunchthrough;
if (Flags & 0x100) pMat->mOptions |= CMaterial::eOccluder;
if (Flags & 0x80000) pMat->mOptions |= CMaterial::eDrawWhiteAmbient;
mHas0x400 = ((Flags & 0x400) != 0);
mpFile->Seek(0x8, SEEK_CUR); // Don't know what any of this is

View File

@ -26,8 +26,6 @@ class CScriptLoader
CScriptObject* LoadObjectMP2(IInputStream& SCLY);
CScriptLayer* LoadLayerMP2(IInputStream& SCLY);
void SetupAttribs();
public:
static CScriptLayer* LoadLayer(IInputStream& SCLY, CGameArea *pArea, EGame version);
};

View File

@ -58,11 +58,12 @@ void CStaticNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewIn
if (!mpModel) return;
bool IsLightingEnabled = CGraphics::sLightMode == CGraphics::eWorldLighting || ViewInfo.GameMode;
bool UseWhiteAmbient = (mpModel->GetMaterial()->Options() & CMaterial::eDrawWhiteAmbient) != 0;
if (IsLightingEnabled)
{
CGraphics::sNumLights = 0;
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skBlack;
CGraphics::sVertexBlock.COLOR0_Amb = UseWhiteAmbient ? CColor::skWhite : CColor::skBlack;
CGraphics::sPixelBlock.LightmapMultiplier = 1.0f;
CGraphics::UpdateLightBlock();
}
@ -70,7 +71,7 @@ void CStaticNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewIn
else
{
LoadLights(ViewInfo);
if (CGraphics::sLightMode == CGraphics::eNoLighting)
if (CGraphics::sLightMode == CGraphics::eNoLighting || UseWhiteAmbient)
CGraphics::sVertexBlock.COLOR0_Amb = CColor::skWhite;
}