forked from Mirrors/openclonk
Material: Remove color field, use textures as is
This also removes ColorByMaterial, which was alread unused in CE and CR.stable-5.2
parent
1889d79478
commit
fc5c384681
|
@ -204,7 +204,6 @@ class C4Def: public C4PropList
|
||||||
int32_t NoComponentMass;
|
int32_t NoComponentMass;
|
||||||
int32_t NoStabilize;
|
int32_t NoStabilize;
|
||||||
char STimerCall[C4D_MaxIDLen];
|
char STimerCall[C4D_MaxIDLen];
|
||||||
char ColorByMaterial[C4M_MaxName+1];
|
|
||||||
int32_t ClosedContainer; // if set, contained objects are not damaged by lava/acid etc. 1: Contained objects can't view out; 2: They can
|
int32_t ClosedContainer; // if set, contained objects are not damaged by lava/acid etc. 1: Contained objects can't view out; 2: They can
|
||||||
int32_t SilentCommands; // if set, no command failure messages are printed
|
int32_t SilentCommands; // if set, no command failure messages are printed
|
||||||
int32_t NoBurnDamage; // if set, the object won't take damage when burning
|
int32_t NoBurnDamage; // if set, the object won't take damage when burning
|
||||||
|
@ -292,7 +291,6 @@ class C4Def: public C4PropList
|
||||||
virtual C4Def* GetDef() { return this; }
|
virtual C4Def* GetDef() { return this; }
|
||||||
protected:
|
protected:
|
||||||
bool LoadPortraits(C4Group &hGroup);
|
bool LoadPortraits(C4Group &hGroup);
|
||||||
BOOL ColorizeByMaterial(class C4MaterialMap &rMats, BYTE bGBM);
|
|
||||||
BOOL LoadActMap(C4Group &hGroup);
|
BOOL LoadActMap(C4Group &hGroup);
|
||||||
void CrossMapActMap();
|
void CrossMapActMap();
|
||||||
private:
|
private:
|
||||||
|
@ -346,7 +344,6 @@ class C4DefList
|
||||||
int32_t GetDefCount(DWORD dwCategory = C4D_All);
|
int32_t GetDefCount(DWORD dwCategory = C4D_All);
|
||||||
int32_t GetIndex(C4ID id);
|
int32_t GetIndex(C4ID id);
|
||||||
int32_t RemoveTemporary();
|
int32_t RemoveTemporary();
|
||||||
int32_t ColorizeByMaterial(C4MaterialMap &rMats, BYTE bGBM);
|
|
||||||
int32_t CheckEngineVersion(int32_t ver1, int32_t ver2, int32_t ver3, int32_t ver4);
|
int32_t CheckEngineVersion(int32_t ver1, int32_t ver2, int32_t ver3, int32_t ver4);
|
||||||
int32_t CheckRequireDef();
|
int32_t CheckRequireDef();
|
||||||
void Draw(C4ID id, C4Facet &cgo, BOOL fSelected, int32_t iColor);
|
void Draw(C4ID id, C4Facet &cgo, BOOL fSelected, int32_t iColor);
|
||||||
|
|
|
@ -54,7 +54,6 @@ class C4DefGraphics
|
||||||
|
|
||||||
bool LoadBitmap(C4Group &hGroup, const char *szFilename, const char *szFilenamePNG, const char *szOverlayPNG, bool fColorByOwner); // load specified graphics from group
|
bool LoadBitmap(C4Group &hGroup, const char *szFilename, const char *szFilenamePNG, const char *szOverlayPNG, bool fColorByOwner); // load specified graphics from group
|
||||||
bool LoadBitmaps(C4Group &hGroup, bool fColorByOwner); // load graphics from group
|
bool LoadBitmaps(C4Group &hGroup, bool fColorByOwner); // load graphics from group
|
||||||
bool ColorizeByMaterial(int32_t iMat, C4MaterialMap &rMats, BYTE bGBM); // colorize all graphics by material
|
|
||||||
C4DefGraphics *Get(const char *szGrpName); // get graphics by name
|
C4DefGraphics *Get(const char *szGrpName); // get graphics by name
|
||||||
void Clear(); // clear fields; delete additional graphics
|
void Clear(); // clear fields; delete additional graphics
|
||||||
bool IsColorByOwner() // returns whether ColorByOwner-surfaces have been created
|
bool IsColorByOwner() // returns whether ColorByOwner-surfaces have been created
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#define C4MatOv_Exact 1
|
#define C4MatOv_Exact 1
|
||||||
#define C4MatOv_None 2
|
#define C4MatOv_None 2
|
||||||
#define C4MatOv_HugeZoom 4
|
#define C4MatOv_HugeZoom 4
|
||||||
#define C4MatOv_Monochrome 8
|
|
||||||
|
|
||||||
enum MaterialInteractionEvent
|
enum MaterialInteractionEvent
|
||||||
{
|
{
|
||||||
|
@ -81,8 +80,6 @@ class C4MaterialCore
|
||||||
std::vector<C4MaterialReaction> CustomReactionList;
|
std::vector<C4MaterialReaction> CustomReactionList;
|
||||||
public:
|
public:
|
||||||
char Name[C4M_MaxName+1];
|
char Name[C4M_MaxName+1];
|
||||||
uint32_t Color[C4M_ColsPerMat*3];
|
|
||||||
uint32_t Alpha[C4M_ColsPerMat*2];
|
|
||||||
int32_t MapChunkType;
|
int32_t MapChunkType;
|
||||||
int32_t Density;
|
int32_t Density;
|
||||||
int32_t Friction;
|
int32_t Friction;
|
||||||
|
@ -128,7 +125,6 @@ class C4MaterialCore
|
||||||
void Clear();
|
void Clear();
|
||||||
void Default();
|
void Default();
|
||||||
BOOL Load(C4Group &hGroup, const char *szEntryName);
|
BOOL Load(C4Group &hGroup, const char *szEntryName);
|
||||||
DWORD GetDWordColor(int32_t iIndex); // get indexed material color as DWord
|
|
||||||
void CompileFunc(StdCompiler *pComp);
|
void CompileFunc(StdCompiler *pComp);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class C4TexMapEntry
|
||||||
const char *GetTextureName() const { return Texture.getData(); }
|
const char *GetTextureName() const { return Texture.getData(); }
|
||||||
int32_t GetMaterialIndex() const { return iMaterialIndex; }
|
int32_t GetMaterialIndex() const { return iMaterialIndex; }
|
||||||
C4Material *GetMaterial() const { return pMaterial; }
|
C4Material *GetMaterial() const { return pMaterial; }
|
||||||
const CPattern &getPattern() const { return MatPattern; }
|
const CPattern &GetPattern() const { return MatPattern; }
|
||||||
void Clear();
|
void Clear();
|
||||||
bool Create(const char *szMaterial, const char *szTexture);
|
bool Create(const char *szMaterial, const char *szTexture);
|
||||||
bool Init();
|
bool Init();
|
||||||
|
|
|
@ -85,7 +85,6 @@ void C4Def::DefaultDefCore()
|
||||||
BuildTurnTo=C4ID_None;
|
BuildTurnTo=C4ID_None;
|
||||||
STimerCall[0]=0;
|
STimerCall[0]=0;
|
||||||
Timer=35;
|
Timer=35;
|
||||||
ColorByMaterial[0]=0;
|
|
||||||
GrowthType=0;
|
GrowthType=0;
|
||||||
Basement=0;
|
Basement=0;
|
||||||
CanBeBase=0;
|
CanBeBase=0;
|
||||||
|
@ -345,7 +344,6 @@ void C4Def::CompileFunc(StdCompiler *pComp)
|
||||||
pComp->Value(mkNamingAdapt(Float, "Float", 0 ));
|
pComp->Value(mkNamingAdapt(Float, "Float", 0 ));
|
||||||
pComp->Value(mkNamingAdapt(ContainBlast, "ContainBlast", 0 ));
|
pComp->Value(mkNamingAdapt(ContainBlast, "ContainBlast", 0 ));
|
||||||
pComp->Value(mkNamingAdapt(ColorByOwner, "ColorByOwner", 0 ));
|
pComp->Value(mkNamingAdapt(ColorByOwner, "ColorByOwner", 0 ));
|
||||||
pComp->Value(mkNamingAdapt(toC4CStr(ColorByMaterial), "ColorByMaterial", "" ));
|
|
||||||
pComp->Value(mkNamingAdapt(NoHorizontalMove, "HorizontalFix", 0 ));
|
pComp->Value(mkNamingAdapt(NoHorizontalMove, "HorizontalFix", 0 ));
|
||||||
pComp->Value(mkNamingAdapt(BorderBound, "BorderBound", 0 ));
|
pComp->Value(mkNamingAdapt(BorderBound, "BorderBound", 0 ));
|
||||||
pComp->Value(mkNamingAdapt(LiftTop, "LiftTop", 0 ));
|
pComp->Value(mkNamingAdapt(LiftTop, "LiftTop", 0 ));
|
||||||
|
@ -699,18 +697,6 @@ BOOL C4Def::Load(C4Group &hGroup,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL C4Def::ColorizeByMaterial(C4MaterialMap &rMats, BYTE bGBM)
|
|
||||||
{
|
|
||||||
if (ColorByMaterial[0])
|
|
||||||
{
|
|
||||||
int32_t mat=rMats.Get(ColorByMaterial);
|
|
||||||
if (mat==MNone) { LogF("C4Def::ColorizeByMaterial: mat %s not defined", ColorByMaterial); return FALSE; }
|
|
||||||
if (!Graphics.ColorizeByMaterial(mat, rMats, bGBM)) return FALSE;
|
|
||||||
}
|
|
||||||
// success
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void C4Def::Draw(C4Facet &cgo, BOOL fSelected, DWORD iColor, C4Object *pObj, int32_t iPhaseX, int32_t iPhaseY)
|
void C4Def::Draw(C4Facet &cgo, BOOL fSelected, DWORD iColor, C4Object *pObj, int32_t iPhaseX, int32_t iPhaseY)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1196,16 +1182,6 @@ int32_t C4DefList::CheckRequireDef()
|
||||||
return rcount;
|
return rcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t C4DefList::ColorizeByMaterial(C4MaterialMap &rMats, BYTE bGBM)
|
|
||||||
{
|
|
||||||
C4Def *cdef;
|
|
||||||
int32_t rval=0;
|
|
||||||
for (cdef=FirstDef; cdef; cdef=cdef->Next)
|
|
||||||
if (cdef->ColorizeByMaterial(rMats,bGBM))
|
|
||||||
rval++;
|
|
||||||
return rval;
|
|
||||||
}
|
|
||||||
|
|
||||||
void C4DefList::Draw(C4ID id, C4Facet &cgo, BOOL fSelected, int32_t iColor)
|
void C4DefList::Draw(C4ID id, C4Facet &cgo, BOOL fSelected, int32_t iColor)
|
||||||
{
|
{
|
||||||
C4Def *cdef = ID2Def(id);
|
C4Def *cdef = ID2Def(id);
|
||||||
|
|
|
@ -227,20 +227,6 @@ bool C4DefGraphics::LoadBitmaps(C4Group &hGroup, bool fColorByOwner)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4DefGraphics::ColorizeByMaterial(int32_t iMat, C4MaterialMap &rMats, BYTE bGBM)
|
|
||||||
{
|
|
||||||
SURFACE sfcBitmap = GetBitmap(); // first bitmap only
|
|
||||||
if (sfcBitmap)
|
|
||||||
{
|
|
||||||
DWORD dwMatColors[C4M_ColsPerMat];
|
|
||||||
for (int32_t i=0; i<C4M_ColsPerMat; ++i)
|
|
||||||
dwMatColors[i] = rMats.Map[iMat].GetDWordColor(i);
|
|
||||||
Application.DDraw->SurfaceAllowColor(sfcBitmap,dwMatColors,C4M_ColsPerMat,TRUE);
|
|
||||||
}
|
|
||||||
// colorize other graphics
|
|
||||||
if (pNext) return pNext->ColorizeByMaterial(iMat, rMats, bGBM); else return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
C4DefGraphics *C4DefGraphics::Get(const char *szGrpName)
|
C4DefGraphics *C4DefGraphics::Get(const char *szGrpName)
|
||||||
{
|
{
|
||||||
// no group or empty string: base graphics
|
// no group or empty string: base graphics
|
||||||
|
|
|
@ -2272,19 +2272,15 @@ BOOL C4Game::InitGame(C4Group &hGroup, bool fLoadSection, bool fLoadSky)
|
||||||
// After defs to get overloading priority
|
// After defs to get overloading priority
|
||||||
if (!LoadScenarioScripts())
|
if (!LoadScenarioScripts())
|
||||||
{ LogFatal(LoadResStr("IDS_PRC_FAIL")); return FALSE; }
|
{ LogFatal(LoadResStr("IDS_PRC_FAIL")); return FALSE; }
|
||||||
SetInitProgress(56);
|
SetInitProgress(57);
|
||||||
|
|
||||||
// Link scripts
|
// Link scripts
|
||||||
if (!LinkScriptEngine()) return FALSE;
|
if (!LinkScriptEngine()) return FALSE;
|
||||||
SetInitProgress(57);
|
SetInitProgress(58);
|
||||||
|
|
||||||
// Materials
|
// Materials
|
||||||
if (!InitMaterialTexture())
|
if (!InitMaterialTexture())
|
||||||
{ LogFatal(LoadResStr("IDS_PRC_MATERROR")); return FALSE; }
|
{ LogFatal(LoadResStr("IDS_PRC_MATERROR")); return FALSE; }
|
||||||
SetInitProgress(58);
|
|
||||||
|
|
||||||
// Colorize defs by material
|
|
||||||
::Definitions.ColorizeByMaterial(::MaterialMap,GBM);
|
|
||||||
SetInitProgress(59);
|
SetInitProgress(59);
|
||||||
|
|
||||||
// Videos
|
// Videos
|
||||||
|
|
|
@ -307,7 +307,7 @@ void C4Landscape::Draw(C4TargetFacet &cgo, int32_t iPlayer)
|
||||||
const CSurface * Surfaces[C4M_MaxTexIndex];
|
const CSurface * Surfaces[C4M_MaxTexIndex];
|
||||||
if (Config.Graphics.HighResLandscape)
|
if (Config.Graphics.HighResLandscape)
|
||||||
for (int i = 0; i < C4M_MaxTexIndex; ++i)
|
for (int i = 0; i < C4M_MaxTexIndex; ++i)
|
||||||
Surfaces[i] = ::TextureMap.GetEntry(i)->getPattern().getSurface();
|
Surfaces[i] = ::TextureMap.GetEntry(i)->GetPattern().getSurface();
|
||||||
Application.DDraw->BlitLandscape(Surface32, cgo.TargetX, cgo.TargetY, cgo.Surface,
|
Application.DDraw->BlitLandscape(Surface32, cgo.TargetX, cgo.TargetY, cgo.Surface,
|
||||||
cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt,
|
cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt,
|
||||||
Config.Graphics.HighResLandscape ? Surfaces : 0);
|
Config.Graphics.HighResLandscape ? Surfaces : 0);
|
||||||
|
@ -2558,15 +2558,14 @@ DWORD C4Landscape::GetClrByTex(int32_t iX, int32_t iY)
|
||||||
{
|
{
|
||||||
// Get pixel and default color
|
// Get pixel and default color
|
||||||
BYTE pix = _GetPix(iX, iY);
|
BYTE pix = _GetPix(iX, iY);
|
||||||
DWORD dwPix = Surface8->pPal->GetClr(pix);
|
|
||||||
// get texture map entry for pixel
|
// get texture map entry for pixel
|
||||||
const C4TexMapEntry *pTex;
|
const C4TexMapEntry *pTex;
|
||||||
if(pix && (pTex = ::TextureMap.GetEntry(PixCol2Tex(pix))))
|
if(pix && (pTex = ::TextureMap.GetEntry(PixCol2Tex(pix))))
|
||||||
{
|
{
|
||||||
// pattern color
|
// pattern color
|
||||||
pTex->getPattern().PatternClr(iX, iY, pix, dwPix, Application.DDraw->Pal);
|
return pTex->GetPattern().PatternClr(iX, iY);
|
||||||
}
|
}
|
||||||
return dwPix;
|
return Surface8->pPal->GetClr(pix);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL C4Landscape::DrawMap(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, const char *szMapDef)
|
BOOL C4Landscape::DrawMap(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, const char *szMapDef)
|
||||||
|
@ -2769,13 +2768,14 @@ bool C4Landscape::Mat2Pal()
|
||||||
if(!pTex || pTex->isNull())
|
if(!pTex || pTex->isNull())
|
||||||
continue;
|
continue;
|
||||||
// colors
|
// colors
|
||||||
|
DWORD dwPix = pTex->GetPattern().PatternClr(0, 0);
|
||||||
for (rgb=0; rgb<3; rgb++)
|
for (rgb=0; rgb<3; rgb++)
|
||||||
Surface8->pPal->Colors[MatTex2PixCol(tex)*3+rgb]
|
Surface8->pPal->Colors[MatTex2PixCol(tex)*3+rgb]
|
||||||
= Surface8->pPal->Colors[(MatTex2PixCol(tex)+IFT)*3+rgb]
|
= Surface8->pPal->Colors[(MatTex2PixCol(tex)+IFT)*3+rgb]
|
||||||
= pTex->GetMaterial()->Color[rgb];
|
= dwPix >> ((2-rgb) * 8);
|
||||||
// alpha
|
// alpha
|
||||||
Surface8->pPal->Alpha[MatTex2PixCol(tex)] = pTex->GetMaterial()->Alpha[0];
|
Surface8->pPal->Alpha[MatTex2PixCol(tex)] = 0;
|
||||||
Surface8->pPal->Alpha[MatTex2PixCol(tex)+IFT] = pTex->GetMaterial()->Alpha[C4M_ColsPerMat];
|
Surface8->pPal->Alpha[MatTex2PixCol(tex)+IFT] = 0;
|
||||||
}
|
}
|
||||||
// success
|
// success
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -110,9 +110,6 @@ void C4MaterialCore::Clear()
|
||||||
sBelowTempConvertTo.Clear();
|
sBelowTempConvertTo.Clear();
|
||||||
sAboveTempConvertTo.Clear();
|
sAboveTempConvertTo.Clear();
|
||||||
*Name='\0';
|
*Name='\0';
|
||||||
int32_t i;
|
|
||||||
for (i=0; i<C4M_ColsPerMat*3; ++i) Color[i]=0;
|
|
||||||
for (i=0; i<C4M_ColsPerMat*2; ++i) Alpha[i]=0;
|
|
||||||
MapChunkType = 0;
|
MapChunkType = 0;
|
||||||
Density = 0;
|
Density = 0;
|
||||||
Friction = 0;
|
Friction = 0;
|
||||||
|
@ -180,22 +177,11 @@ BOOL C4MaterialCore::Load(C4Group &hGroup,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD C4MaterialCore::GetDWordColor(int32_t iIndex)
|
|
||||||
{
|
|
||||||
if (iIndex<0) return 0;
|
|
||||||
iIndex %= (C4M_ColsPerMat*2);
|
|
||||||
int32_t iClrIndex = iIndex % C4M_ColsPerMat;
|
|
||||||
return RGB(Color[iClrIndex*3+2],Color[iClrIndex*3+1],Color[iClrIndex*3]) | (Alpha[iIndex]<<24);
|
|
||||||
}
|
|
||||||
|
|
||||||
void C4MaterialCore::CompileFunc(StdCompiler *pComp)
|
void C4MaterialCore::CompileFunc(StdCompiler *pComp)
|
||||||
{
|
{
|
||||||
if (pComp->isCompiler()) Clear();
|
if (pComp->isCompiler()) Clear();
|
||||||
pComp->Name("Material");
|
pComp->Name("Material");
|
||||||
pComp->Value(mkNamingAdapt(toC4CStr(Name), "Name", "" ));
|
pComp->Value(mkNamingAdapt(toC4CStr(Name), "Name", "" ));
|
||||||
pComp->Value(mkNamingAdapt(toC4CArrU(Color), "Color" ));
|
|
||||||
pComp->Value(mkNamingAdapt(toC4CArrU(Color), "ColorX", Color ));
|
|
||||||
pComp->Value(mkNamingAdapt(toC4CArrU(Alpha), "Alpha" ));
|
|
||||||
pComp->Value(mkNamingAdapt(ColorAnimation, "ColorAnimation", 0 ));
|
pComp->Value(mkNamingAdapt(ColorAnimation, "ColorAnimation", 0 ));
|
||||||
pComp->Value(mkNamingAdapt(MapChunkType, "Shape", 0 ));
|
pComp->Value(mkNamingAdapt(MapChunkType, "Shape", 0 ));
|
||||||
pComp->Value(mkNamingAdapt(Density, "Density", 0 ));
|
pComp->Value(mkNamingAdapt(Density, "Density", 0 ));
|
||||||
|
|
|
@ -91,13 +91,11 @@ bool C4TexMapEntry::Init()
|
||||||
}
|
}
|
||||||
// Get overlay properties
|
// Get overlay properties
|
||||||
int32_t iOverlayType=pMaterial->OverlayType;
|
int32_t iOverlayType=pMaterial->OverlayType;
|
||||||
bool fMono = !!(iOverlayType & C4MatOv_Monochrome);
|
|
||||||
int32_t iZoom=0;
|
int32_t iZoom=0;
|
||||||
if (iOverlayType & C4MatOv_Exact) iZoom=1;
|
if (iOverlayType & C4MatOv_Exact) iZoom=1;
|
||||||
if (iOverlayType & C4MatOv_HugeZoom) iZoom=4;
|
if (iOverlayType & C4MatOv_HugeZoom) iZoom=4;
|
||||||
// Create pattern
|
// Create pattern
|
||||||
MatPattern.Set(sfcTexture->Surface32, iZoom, fMono);
|
MatPattern.Set(sfcTexture->Surface32, iZoom);
|
||||||
MatPattern.SetColors(pMaterial->Color, pMaterial->Alpha);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,17 +403,14 @@ void C4TextureMap::StoreMapPalette(BYTE *bypPalette, C4MaterialMap &rMaterial)
|
||||||
for(i = 0; i < C4M_MaxTexIndex; i++)
|
for(i = 0; i < C4M_MaxTexIndex; i++)
|
||||||
{
|
{
|
||||||
// Find material
|
// Find material
|
||||||
C4Material *pMat = Entry[i].GetMaterial();
|
DWORD dwPix = Entry[i].GetPattern().PatternClr(0, 0);
|
||||||
if (pMat)
|
bypPalette[3*i+0]=dwPix >> 16;
|
||||||
{
|
bypPalette[3*i+1]=dwPix >> 8;
|
||||||
bypPalette[3*i+0]=pMat->Color[6];
|
bypPalette[3*i+2]=dwPix;
|
||||||
bypPalette[3*i+1]=pMat->Color[7];
|
bypPalette[3*(i+IFT)+0]=dwPix >> 16;
|
||||||
bypPalette[3*i+2]=pMat->Color[8];
|
bypPalette[3*(i+IFT)+1]=dwPix >> 8;
|
||||||
bypPalette[3*(i+IFT)+0]=pMat->Color[3];
|
bypPalette[3*(i+IFT)+2]=dwPix | 0x0F; // IFT arbitrarily gets more blue
|
||||||
bypPalette[3*(i+IFT)+1]=pMat->Color[4];
|
fSet[i] = fSet[i + IFT] = true;
|
||||||
bypPalette[3*(i+IFT)+2]=pMat->Color[5];
|
|
||||||
fSet[i] = fSet[i + IFT] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Crosscheck colors, change equal palette entries
|
// Crosscheck colors, change equal palette entries
|
||||||
for(i = 0; i < 256; i++) if(fSet[i])
|
for(i = 0; i < 256; i++) if(fSet[i])
|
||||||
|
|
|
@ -671,8 +671,7 @@ void C4ToolsDlg::UpdatePreview()
|
||||||
// Sky material: sky as pattern only
|
// Sky material: sky as pattern only
|
||||||
if (SEqual(Material,C4TLS_MatSky))
|
if (SEqual(Material,C4TLS_MatSky))
|
||||||
{
|
{
|
||||||
Pattern.SetColors(0, 0);
|
Pattern.Set(::Landscape.Sky.Surface, 0);
|
||||||
Pattern.Set(::Landscape.Sky.Surface, 0, false);
|
|
||||||
}
|
}
|
||||||
// Material-Texture
|
// Material-Texture
|
||||||
else
|
else
|
||||||
|
@ -688,7 +687,7 @@ void C4ToolsDlg::UpdatePreview()
|
||||||
if(pTex)
|
if(pTex)
|
||||||
{
|
{
|
||||||
// Set drawing pattern
|
// Set drawing pattern
|
||||||
Pattern = pTex->getPattern();
|
Pattern = pTex->GetPattern();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Acid
|
Name=Acid
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
ColorAnimation=1
|
ColorAnimation=1
|
||||||
Density=25
|
Density=25
|
||||||
Instable=1
|
Instable=1
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Coal
|
Name=Coal
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Shape=3
|
Shape=3
|
||||||
Density=50
|
Density=50
|
||||||
Friction=75
|
Friction=75
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=DuroLava
|
Name=DuroLava
|
||||||
Color=245,200,15,251,240,15,248,220,18
|
|
||||||
ColorAnimation=1
|
ColorAnimation=1
|
||||||
Density=25
|
Density=25
|
||||||
Instable=1
|
Instable=1
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Earth
|
Name=Earth
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Shape=2
|
Shape=2
|
||||||
Density=50
|
Density=50
|
||||||
Friction=80
|
Friction=80
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Gold
|
Name=Gold
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Shape=3
|
Shape=3
|
||||||
Density=50
|
Density=50
|
||||||
Friction=100
|
Friction=100
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Granite
|
Name=Granite
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Shape=3
|
Shape=3
|
||||||
Density=50
|
Density=50
|
||||||
Friction=100
|
Friction=100
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Ice
|
Name=Ice
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Shape=1
|
Shape=1
|
||||||
Density=50
|
Density=50
|
||||||
Friction=15
|
Friction=15
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Lava
|
Name=Lava
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
ColorAnimation=1
|
ColorAnimation=1
|
||||||
Density=25
|
Density=25
|
||||||
Instable=1
|
Instable=1
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Ore
|
Name=Ore
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Shape=3
|
Shape=3
|
||||||
Density=50
|
Density=50
|
||||||
Friction=100
|
Friction=100
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Rock
|
Name=Rock
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Shape=3
|
Shape=3
|
||||||
Density=50
|
Density=50
|
||||||
Friction=100
|
Friction=100
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Sand
|
Name=Sand
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Shape=2
|
Shape=2
|
||||||
Density=50
|
Density=50
|
||||||
Friction=80
|
Friction=80
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Snow
|
Name=Snow
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Shape=2
|
Shape=2
|
||||||
Density=50
|
Density=50
|
||||||
Friction=40
|
Friction=40
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Sulphur
|
Name=Sulphur
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Shape=3
|
Shape=3
|
||||||
Density=50
|
Density=50
|
||||||
Friction=75
|
Friction=75
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Tunnel
|
Name=Tunnel
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Shape=2
|
Shape=2
|
||||||
Placement=5
|
Placement=5
|
||||||
TextureOverlay=tunnel
|
TextureOverlay=tunnel
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Vehicle
|
Name=Vehicle
|
||||||
Color=120,100,70,120,100,70,120,100,70
|
|
||||||
Density=100
|
Density=100
|
||||||
Friction=100
|
Friction=100
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
[Material]
|
[Material]
|
||||||
Name=Water
|
Name=Water
|
||||||
Color=128,128,128,128,128,128,128,128,128
|
|
||||||
Alpha=0,0,0,0,0,0
|
|
||||||
ColorAnimation=1
|
ColorAnimation=1
|
||||||
Density=25
|
Density=25
|
||||||
Instable=1
|
Instable=1
|
||||||
|
|
|
@ -131,20 +131,11 @@ class CPattern
|
||||||
uint32_t * CachedPattern; int Wdt; int Hgt;
|
uint32_t * CachedPattern; int Wdt; int Hgt;
|
||||||
// pattern zoom factor; 0 means no zoom
|
// pattern zoom factor; 0 means no zoom
|
||||||
int Zoom;
|
int Zoom;
|
||||||
// pattern is to be applied monochromatic
|
|
||||||
bool Monochrome;
|
|
||||||
// color array for old-style patterns
|
|
||||||
uint32_t *pClrs;
|
|
||||||
// alpha array for old-style patterns
|
|
||||||
uint32_t *pAlpha;
|
|
||||||
public:
|
public:
|
||||||
CPattern& operator=(const CPattern&);
|
CPattern& operator=(const CPattern&);
|
||||||
const CSurface *getSurface() const { return sfcPattern32; }
|
const CSurface *getSurface() const { return sfcPattern32; }
|
||||||
bool PatternClr(int iX, int iY, BYTE &byClr, DWORD &dwClr, CStdPalette &rPal) const; // apply pattern to color
|
DWORD PatternClr(unsigned int iX, unsigned int iY) const; // apply pattern to color
|
||||||
bool IsNewStyle() { if (sfcPattern32) return true; }
|
bool Set(class CSurface *sfcSource, int iZoom=0); // set and enable pattern
|
||||||
bool Set(class CSurface *sfcSource, int iZoom=0, bool fMonochrome=false); // set and enable pattern
|
|
||||||
bool Set(class CSurface8 *sfcSource, int iZoom=0, bool fMonochrome=false); // set and enable pattern
|
|
||||||
void SetColors(uint32_t *pClrs, uint32_t *pAlpha) { this->pClrs=pClrs; this->pAlpha=pAlpha; } // set color triplet for old-style textures
|
|
||||||
void SetZoom(int iZoom) { Zoom = iZoom; }
|
void SetZoom(int iZoom) { Zoom = iZoom; }
|
||||||
void Clear(); // clear pattern
|
void Clear(); // clear pattern
|
||||||
CPattern(); // ctor
|
CPattern(); // ctor
|
||||||
|
|
|
@ -101,8 +101,6 @@ void CBltTransform::TransformPoint(float &rX, float &rY)
|
||||||
|
|
||||||
CPattern& CPattern::operator=(const CPattern& nPattern)
|
CPattern& CPattern::operator=(const CPattern& nPattern)
|
||||||
{
|
{
|
||||||
pClrs = nPattern.pClrs;
|
|
||||||
pAlpha = nPattern.pAlpha;
|
|
||||||
sfcPattern32 = nPattern.sfcPattern32;
|
sfcPattern32 = nPattern.sfcPattern32;
|
||||||
if (sfcPattern32) sfcPattern32->Lock();
|
if (sfcPattern32) sfcPattern32->Lock();
|
||||||
delete [] CachedPattern;
|
delete [] CachedPattern;
|
||||||
|
@ -118,11 +116,10 @@ CPattern& CPattern::operator=(const CPattern& nPattern)
|
||||||
Wdt = nPattern.Wdt;
|
Wdt = nPattern.Wdt;
|
||||||
Hgt = nPattern.Hgt;
|
Hgt = nPattern.Hgt;
|
||||||
Zoom = nPattern.Zoom;
|
Zoom = nPattern.Zoom;
|
||||||
Monochrome = nPattern.Monochrome;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPattern::Set(SURFACE sfcSource, int iZoom, bool fMonochrome)
|
bool CPattern::Set(SURFACE sfcSource, int iZoom)
|
||||||
{
|
{
|
||||||
// Safety
|
// Safety
|
||||||
if (!sfcSource) return false;
|
if (!sfcSource) return false;
|
||||||
|
@ -136,7 +133,6 @@ bool CPattern::Set(SURFACE sfcSource, int iZoom, bool fMonochrome)
|
||||||
// set zoom
|
// set zoom
|
||||||
Zoom=iZoom;
|
Zoom=iZoom;
|
||||||
// set flags
|
// set flags
|
||||||
Monochrome=fMonochrome;
|
|
||||||
CachedPattern = new uint32_t[Wdt * Hgt];
|
CachedPattern = new uint32_t[Wdt * Hgt];
|
||||||
if (!CachedPattern) return false;
|
if (!CachedPattern) return false;
|
||||||
for (int y = 0; y < Hgt; ++y)
|
for (int y = 0; y < Hgt; ++y)
|
||||||
|
@ -153,8 +149,6 @@ CPattern::CPattern()
|
||||||
sfcPattern32=NULL;
|
sfcPattern32=NULL;
|
||||||
CachedPattern = 0;
|
CachedPattern = 0;
|
||||||
Zoom=0;
|
Zoom=0;
|
||||||
Monochrome=false;
|
|
||||||
pClrs=NULL; pAlpha=NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPattern::Clear()
|
void CPattern::Clear()
|
||||||
|
@ -170,25 +164,12 @@ void CPattern::Clear()
|
||||||
delete[] CachedPattern; CachedPattern = 0;
|
delete[] CachedPattern; CachedPattern = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPattern::PatternClr(int iX, int iY, BYTE &byClr, DWORD &dwClr, CStdPalette &rPal) const
|
DWORD CPattern::PatternClr(unsigned int iX, unsigned int iY) const
|
||||||
{
|
{
|
||||||
if (!CachedPattern) return false;
|
if (!CachedPattern) return 0;
|
||||||
// position zoomed?
|
// wrap position
|
||||||
if (Zoom) { iX/=Zoom; iY/=Zoom; }
|
iX %= Wdt; iY %= Hgt;
|
||||||
// modulate position
|
return CachedPattern[iY * Wdt + iX];
|
||||||
((unsigned int &)iX) %= Wdt; ((unsigned int &)iY) %= Hgt;
|
|
||||||
// modulate clr
|
|
||||||
DWORD dwPix = CachedPattern[iY * Wdt + iX];
|
|
||||||
if (byClr)
|
|
||||||
{
|
|
||||||
if (Monochrome)
|
|
||||||
ModulateClrMonoA(dwClr, BYTE(dwPix), BYTE(dwPix>>24));
|
|
||||||
else
|
|
||||||
ModulateClrA(dwClr, dwPix);
|
|
||||||
LightenClr(dwClr);
|
|
||||||
}
|
|
||||||
else dwClr=dwPix;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGammaControl::SetClrChannel(WORD *pBuf, BYTE c1, BYTE c2, int c3)
|
void CGammaControl::SetClrChannel(WORD *pBuf, BYTE c1, BYTE c2, int c3)
|
||||||
|
@ -1541,10 +1522,7 @@ void CStdDDraw::DrawPatternedCircle(SURFACE sfcDest, int x, int y, int r, BYTE c
|
||||||
// Set line
|
// Set line
|
||||||
for (int xcnt = x - lwdt; xcnt < x + lwdt; ++xcnt)
|
for (int xcnt = x - lwdt; xcnt < x + lwdt; ++xcnt)
|
||||||
{
|
{
|
||||||
// apply both patterns
|
sfcDest->SetPixDw(xcnt, y + ycnt, Pattern.PatternClr(xcnt, y + ycnt));
|
||||||
DWORD dwClr=rPal.GetClr(col);
|
|
||||||
Pattern.PatternClr(xcnt, y + ycnt, col, dwClr, rPal);
|
|
||||||
sfcDest->SetPixDw(xcnt, y + ycnt, dwClr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sfcDest->Unlock();
|
sfcDest->Unlock();
|
||||||
|
|
Loading…
Reference in New Issue