forked from Mirrors/openclonk
Landscape: Hardcode sky transparency directly (#317)
Since "Remove a lot of old obsolete palette code", the landscape palette does not have a transparent color at position 0 anymore. Instead of restoring that invariant, stop getting the sky color from the palette. Since every other color was taken from a texture already, stop using the palette altogether for ingame landscape display.
parent
6f1cbe27ef
commit
3266d56175
|
@ -2629,7 +2629,7 @@ bool C4Landscape::ApplyLighting(C4Rect To)
|
|||
// Sky
|
||||
if (!pix)
|
||||
{
|
||||
Surface32->SetPixDw(iX, iY, GetClrByTex(iX, iY));
|
||||
Surface32->SetPixDw(iX, iY, 0x00ffffff);
|
||||
continue;
|
||||
}
|
||||
// get density
|
||||
|
@ -2638,8 +2638,12 @@ bool C4Landscape::ApplyLighting(C4Rect To)
|
|||
iOwnDens *= 2;
|
||||
iOwnDens += GetPlacement(iX + 1, iY) + GetPlacement(iX - 1, iY);
|
||||
iOwnDens /= 4;
|
||||
// Normal color
|
||||
DWORD dwBackClr = GetClrByTex(iX, iY);
|
||||
// get texture map entry for pixel
|
||||
const C4TexMapEntry *pTex = ::TextureMap.GetEntry(PixCol2Tex(pix));
|
||||
assert(pTex);
|
||||
// get texture contents
|
||||
DWORD dwBackClr;
|
||||
if (pTex) dwBackClr = pTex->GetPattern().PatternClr(iX, iY);
|
||||
// get density of surrounding materials
|
||||
int iCompareDens = AboveDensity / 8;
|
||||
if (iOwnDens > iCompareDens)
|
||||
|
@ -2664,20 +2668,6 @@ bool C4Landscape::ApplyLighting(C4Rect To)
|
|||
return true;
|
||||
}
|
||||
|
||||
DWORD C4Landscape::GetClrByTex(int32_t iX, int32_t iY)
|
||||
{
|
||||
// Get pixel and default color
|
||||
BYTE pix = _GetPix(iX, iY);
|
||||
// get texture map entry for pixel
|
||||
const C4TexMapEntry *pTex;
|
||||
if (pix && (pTex = ::TextureMap.GetEntry(PixCol2Tex(pix))))
|
||||
{
|
||||
// pattern color
|
||||
return pTex->GetPattern().PatternClr(iX, iY);
|
||||
}
|
||||
return Surface8->pPal->GetClr(pix);
|
||||
}
|
||||
|
||||
bool C4Landscape::DrawMap(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, const char *szMapDef)
|
||||
{
|
||||
// safety
|
||||
|
|
|
@ -230,7 +230,6 @@ protected:
|
|||
CSurface8 * CreateMapS2(C4Group &ScenFile); // create map by def file
|
||||
bool Relight(C4Rect To);
|
||||
bool ApplyLighting(C4Rect To);
|
||||
DWORD GetClrByTex(int32_t iX, int32_t iY);
|
||||
bool Mat2Pal(); // assign material colors to landscape palette
|
||||
void DigFreeSinglePix(int32_t x, int32_t y, int32_t dx, int32_t dy)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue