diff --git a/engine/inc/C4Def.h b/engine/inc/C4Def.h index 33e2f35e1..45b47dc85 100644 --- a/engine/inc/C4Def.h +++ b/engine/inc/C4Def.h @@ -204,7 +204,6 @@ class C4Def: public C4PropList int32_t NoComponentMass; int32_t NoStabilize; 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 SilentCommands; // if set, no command failure messages are printed 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; } protected: bool LoadPortraits(C4Group &hGroup); - BOOL ColorizeByMaterial(class C4MaterialMap &rMats, BYTE bGBM); BOOL LoadActMap(C4Group &hGroup); void CrossMapActMap(); private: @@ -346,7 +344,6 @@ class C4DefList int32_t GetDefCount(DWORD dwCategory = C4D_All); int32_t GetIndex(C4ID id); 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 CheckRequireDef(); void Draw(C4ID id, C4Facet &cgo, BOOL fSelected, int32_t iColor); diff --git a/engine/inc/C4DefGraphics.h b/engine/inc/C4DefGraphics.h index 8536c095f..dd4db9f4a 100644 --- a/engine/inc/C4DefGraphics.h +++ b/engine/inc/C4DefGraphics.h @@ -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 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 void Clear(); // clear fields; delete additional graphics bool IsColorByOwner() // returns whether ColorByOwner-surfaces have been created diff --git a/engine/inc/C4Material.h b/engine/inc/C4Material.h index 91289e74f..12cf29d9a 100644 --- a/engine/inc/C4Material.h +++ b/engine/inc/C4Material.h @@ -32,7 +32,6 @@ #define C4MatOv_Exact 1 #define C4MatOv_None 2 #define C4MatOv_HugeZoom 4 -#define C4MatOv_Monochrome 8 enum MaterialInteractionEvent { @@ -81,8 +80,6 @@ class C4MaterialCore std::vector CustomReactionList; public: char Name[C4M_MaxName+1]; - uint32_t Color[C4M_ColsPerMat*3]; - uint32_t Alpha[C4M_ColsPerMat*2]; int32_t MapChunkType; int32_t Density; int32_t Friction; @@ -128,7 +125,6 @@ class C4MaterialCore void Clear(); void Default(); BOOL Load(C4Group &hGroup, const char *szEntryName); - DWORD GetDWordColor(int32_t iIndex); // get indexed material color as DWord void CompileFunc(StdCompiler *pComp); }; diff --git a/engine/inc/C4Texture.h b/engine/inc/C4Texture.h index d62f3b2f4..91122898f 100644 --- a/engine/inc/C4Texture.h +++ b/engine/inc/C4Texture.h @@ -53,7 +53,7 @@ class C4TexMapEntry const char *GetTextureName() const { return Texture.getData(); } int32_t GetMaterialIndex() const { return iMaterialIndex; } C4Material *GetMaterial() const { return pMaterial; } - const CPattern &getPattern() const { return MatPattern; } + const CPattern &GetPattern() const { return MatPattern; } void Clear(); bool Create(const char *szMaterial, const char *szTexture); bool Init(); diff --git a/engine/src/C4Def.cpp b/engine/src/C4Def.cpp index f3b1c57a6..d6cb4a1f0 100644 --- a/engine/src/C4Def.cpp +++ b/engine/src/C4Def.cpp @@ -85,7 +85,6 @@ void C4Def::DefaultDefCore() BuildTurnTo=C4ID_None; STimerCall[0]=0; Timer=35; - ColorByMaterial[0]=0; GrowthType=0; Basement=0; CanBeBase=0; @@ -345,7 +344,6 @@ void C4Def::CompileFunc(StdCompiler *pComp) pComp->Value(mkNamingAdapt(Float, "Float", 0 )); pComp->Value(mkNamingAdapt(ContainBlast, "ContainBlast", 0 )); pComp->Value(mkNamingAdapt(ColorByOwner, "ColorByOwner", 0 )); - pComp->Value(mkNamingAdapt(toC4CStr(ColorByMaterial), "ColorByMaterial", "" )); pComp->Value(mkNamingAdapt(NoHorizontalMove, "HorizontalFix", 0 )); pComp->Value(mkNamingAdapt(BorderBound, "BorderBound", 0 )); pComp->Value(mkNamingAdapt(LiftTop, "LiftTop", 0 )); @@ -699,18 +697,6 @@ BOOL C4Def::Load(C4Group &hGroup, 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) { @@ -1196,16 +1182,6 @@ int32_t C4DefList::CheckRequireDef() 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) { C4Def *cdef = ID2Def(id); diff --git a/engine/src/C4DefGraphics.cpp b/engine/src/C4DefGraphics.cpp index 8bbf55a03..5eb1fe15a 100644 --- a/engine/src/C4DefGraphics.cpp +++ b/engine/src/C4DefGraphics.cpp @@ -227,20 +227,6 @@ bool C4DefGraphics::LoadBitmaps(C4Group &hGroup, bool fColorByOwner) 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; iSurfaceAllowColor(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) { // no group or empty string: base graphics diff --git a/engine/src/C4Game.cpp b/engine/src/C4Game.cpp index 0d9cb8cf6..a419af6d1 100644 --- a/engine/src/C4Game.cpp +++ b/engine/src/C4Game.cpp @@ -2272,19 +2272,15 @@ BOOL C4Game::InitGame(C4Group &hGroup, bool fLoadSection, bool fLoadSky) // After defs to get overloading priority if (!LoadScenarioScripts()) { LogFatal(LoadResStr("IDS_PRC_FAIL")); return FALSE; } - SetInitProgress(56); + SetInitProgress(57); // Link scripts if (!LinkScriptEngine()) return FALSE; - SetInitProgress(57); + SetInitProgress(58); // Materials if (!InitMaterialTexture()) { LogFatal(LoadResStr("IDS_PRC_MATERROR")); return FALSE; } - SetInitProgress(58); - - // Colorize defs by material - ::Definitions.ColorizeByMaterial(::MaterialMap,GBM); SetInitProgress(59); // Videos diff --git a/engine/src/C4Landscape.cpp b/engine/src/C4Landscape.cpp index 105c5e0cb..09c4aa098 100644 --- a/engine/src/C4Landscape.cpp +++ b/engine/src/C4Landscape.cpp @@ -307,7 +307,7 @@ void C4Landscape::Draw(C4TargetFacet &cgo, int32_t iPlayer) const CSurface * Surfaces[C4M_MaxTexIndex]; if (Config.Graphics.HighResLandscape) 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, cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt, Config.Graphics.HighResLandscape ? Surfaces : 0); @@ -2558,15 +2558,14 @@ DWORD C4Landscape::GetClrByTex(int32_t iX, int32_t iY) { // Get pixel and default color BYTE pix = _GetPix(iX, iY); - DWORD dwPix = Surface8->pPal->GetClr(pix); // get texture map entry for pixel const C4TexMapEntry *pTex; if(pix && (pTex = ::TextureMap.GetEntry(PixCol2Tex(pix)))) { // 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) @@ -2769,13 +2768,14 @@ bool C4Landscape::Mat2Pal() if(!pTex || pTex->isNull()) continue; // colors + DWORD dwPix = pTex->GetPattern().PatternClr(0, 0); for (rgb=0; rgb<3; rgb++) Surface8->pPal->Colors[MatTex2PixCol(tex)*3+rgb] = Surface8->pPal->Colors[(MatTex2PixCol(tex)+IFT)*3+rgb] - = pTex->GetMaterial()->Color[rgb]; + = dwPix >> ((2-rgb) * 8); // alpha - Surface8->pPal->Alpha[MatTex2PixCol(tex)] = pTex->GetMaterial()->Alpha[0]; - Surface8->pPal->Alpha[MatTex2PixCol(tex)+IFT] = pTex->GetMaterial()->Alpha[C4M_ColsPerMat]; + Surface8->pPal->Alpha[MatTex2PixCol(tex)] = 0; + Surface8->pPal->Alpha[MatTex2PixCol(tex)+IFT] = 0; } // success return true; diff --git a/engine/src/C4Material.cpp b/engine/src/C4Material.cpp index d2be4f5b0..9c289c80d 100644 --- a/engine/src/C4Material.cpp +++ b/engine/src/C4Material.cpp @@ -110,9 +110,6 @@ void C4MaterialCore::Clear() sBelowTempConvertTo.Clear(); sAboveTempConvertTo.Clear(); *Name='\0'; - int32_t i; - for (i=0; iisCompiler()) Clear(); pComp->Name("Material"); 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(MapChunkType, "Shape", 0 )); pComp->Value(mkNamingAdapt(Density, "Density", 0 )); diff --git a/engine/src/C4Texture.cpp b/engine/src/C4Texture.cpp index 7dff80875..0a5158e2b 100644 --- a/engine/src/C4Texture.cpp +++ b/engine/src/C4Texture.cpp @@ -91,13 +91,11 @@ bool C4TexMapEntry::Init() } // Get overlay properties int32_t iOverlayType=pMaterial->OverlayType; - bool fMono = !!(iOverlayType & C4MatOv_Monochrome); int32_t iZoom=0; if (iOverlayType & C4MatOv_Exact) iZoom=1; if (iOverlayType & C4MatOv_HugeZoom) iZoom=4; // Create pattern - MatPattern.Set(sfcTexture->Surface32, iZoom, fMono); - MatPattern.SetColors(pMaterial->Color, pMaterial->Alpha); + MatPattern.Set(sfcTexture->Surface32, iZoom); return true; } @@ -405,17 +403,14 @@ void C4TextureMap::StoreMapPalette(BYTE *bypPalette, C4MaterialMap &rMaterial) for(i = 0; i < C4M_MaxTexIndex; i++) { // Find material - C4Material *pMat = Entry[i].GetMaterial(); - if (pMat) - { - bypPalette[3*i+0]=pMat->Color[6]; - bypPalette[3*i+1]=pMat->Color[7]; - bypPalette[3*i+2]=pMat->Color[8]; - bypPalette[3*(i+IFT)+0]=pMat->Color[3]; - bypPalette[3*(i+IFT)+1]=pMat->Color[4]; - bypPalette[3*(i+IFT)+2]=pMat->Color[5]; - fSet[i] = fSet[i + IFT] = true; - } + DWORD dwPix = Entry[i].GetPattern().PatternClr(0, 0); + bypPalette[3*i+0]=dwPix >> 16; + bypPalette[3*i+1]=dwPix >> 8; + bypPalette[3*i+2]=dwPix; + bypPalette[3*(i+IFT)+0]=dwPix >> 16; + bypPalette[3*(i+IFT)+1]=dwPix >> 8; + bypPalette[3*(i+IFT)+2]=dwPix | 0x0F; // IFT arbitrarily gets more blue + fSet[i] = fSet[i + IFT] = true; } // Crosscheck colors, change equal palette entries for(i = 0; i < 256; i++) if(fSet[i]) diff --git a/engine/src/C4ToolsDlg.cpp b/engine/src/C4ToolsDlg.cpp index 2de47af24..87f2ff904 100644 --- a/engine/src/C4ToolsDlg.cpp +++ b/engine/src/C4ToolsDlg.cpp @@ -671,8 +671,7 @@ void C4ToolsDlg::UpdatePreview() // Sky material: sky as pattern only if (SEqual(Material,C4TLS_MatSky)) { - Pattern.SetColors(0, 0); - Pattern.Set(::Landscape.Sky.Surface, 0, false); + Pattern.Set(::Landscape.Sky.Surface, 0); } // Material-Texture else @@ -688,7 +687,7 @@ void C4ToolsDlg::UpdatePreview() if(pTex) { // Set drawing pattern - Pattern = pTex->getPattern(); + Pattern = pTex->GetPattern(); } } } diff --git a/planet/Material.c4g/Acid.c4m b/planet/Material.c4g/Acid.c4m index 7b8dc6faa..d89c11a2c 100644 --- a/planet/Material.c4g/Acid.c4m +++ b/planet/Material.c4g/Acid.c4m @@ -1,6 +1,5 @@ [Material] Name=Acid -Color=128,128,128,128,128,128,128,128,128 ColorAnimation=1 Density=25 Instable=1 diff --git a/planet/Material.c4g/Coal.c4m b/planet/Material.c4g/Coal.c4m index 888137974..1eaee31b9 100644 --- a/planet/Material.c4g/Coal.c4m +++ b/planet/Material.c4g/Coal.c4m @@ -1,6 +1,5 @@ [Material] Name=Coal -Color=128,128,128,128,128,128,128,128,128 Shape=3 Density=50 Friction=75 diff --git a/planet/Material.c4g/DuroLava.c4m b/planet/Material.c4g/DuroLava.c4m index 60db5ef6f..7bba90222 100644 --- a/planet/Material.c4g/DuroLava.c4m +++ b/planet/Material.c4g/DuroLava.c4m @@ -1,6 +1,5 @@ [Material] Name=DuroLava -Color=245,200,15,251,240,15,248,220,18 ColorAnimation=1 Density=25 Instable=1 diff --git a/planet/Material.c4g/Earth.c4m b/planet/Material.c4g/Earth.c4m index 2335e3b95..19cdee9fe 100644 --- a/planet/Material.c4g/Earth.c4m +++ b/planet/Material.c4g/Earth.c4m @@ -1,6 +1,5 @@ [Material] Name=Earth -Color=128,128,128,128,128,128,128,128,128 Shape=2 Density=50 Friction=80 diff --git a/planet/Material.c4g/Gold.c4m b/planet/Material.c4g/Gold.c4m index 8c34d5ec0..cea1794e1 100644 --- a/planet/Material.c4g/Gold.c4m +++ b/planet/Material.c4g/Gold.c4m @@ -1,6 +1,5 @@ [Material] Name=Gold -Color=128,128,128,128,128,128,128,128,128 Shape=3 Density=50 Friction=100 diff --git a/planet/Material.c4g/Granite.c4m b/planet/Material.c4g/Granite.c4m index 1ae146079..f2c723af2 100644 --- a/planet/Material.c4g/Granite.c4m +++ b/planet/Material.c4g/Granite.c4m @@ -1,6 +1,5 @@ [Material] Name=Granite -Color=128,128,128,128,128,128,128,128,128 Shape=3 Density=50 Friction=100 diff --git a/planet/Material.c4g/Ice.c4m b/planet/Material.c4g/Ice.c4m index ffae10412..c95bc16e0 100644 --- a/planet/Material.c4g/Ice.c4m +++ b/planet/Material.c4g/Ice.c4m @@ -1,6 +1,5 @@ [Material] Name=Ice -Color=128,128,128,128,128,128,128,128,128 Shape=1 Density=50 Friction=15 diff --git a/planet/Material.c4g/Lava.c4m b/planet/Material.c4g/Lava.c4m index 9a19e22f4..1ce130ec0 100644 --- a/planet/Material.c4g/Lava.c4m +++ b/planet/Material.c4g/Lava.c4m @@ -1,6 +1,5 @@ [Material] Name=Lava -Color=128,128,128,128,128,128,128,128,128 ColorAnimation=1 Density=25 Instable=1 diff --git a/planet/Material.c4g/ORE.c4m b/planet/Material.c4g/ORE.c4m index 7d118c3fc..1f26c654f 100644 --- a/planet/Material.c4g/ORE.c4m +++ b/planet/Material.c4g/ORE.c4m @@ -1,6 +1,5 @@ [Material] Name=Ore -Color=128,128,128,128,128,128,128,128,128 Shape=3 Density=50 Friction=100 diff --git a/planet/Material.c4g/Rock.c4m b/planet/Material.c4g/Rock.c4m index 0b15679de..606fc0a2a 100644 --- a/planet/Material.c4g/Rock.c4m +++ b/planet/Material.c4g/Rock.c4m @@ -1,6 +1,5 @@ [Material] Name=Rock -Color=128,128,128,128,128,128,128,128,128 Shape=3 Density=50 Friction=100 diff --git a/planet/Material.c4g/Sand.c4m b/planet/Material.c4g/Sand.c4m index 5a25af6b7..e001951d1 100644 --- a/planet/Material.c4g/Sand.c4m +++ b/planet/Material.c4g/Sand.c4m @@ -1,6 +1,5 @@ [Material] Name=Sand -Color=128,128,128,128,128,128,128,128,128 Shape=2 Density=50 Friction=80 diff --git a/planet/Material.c4g/Snow.c4m b/planet/Material.c4g/Snow.c4m index aa4900045..f11103713 100644 --- a/planet/Material.c4g/Snow.c4m +++ b/planet/Material.c4g/Snow.c4m @@ -1,6 +1,5 @@ [Material] Name=Snow -Color=128,128,128,128,128,128,128,128,128 Shape=2 Density=50 Friction=40 diff --git a/planet/Material.c4g/Sulphur.c4m b/planet/Material.c4g/Sulphur.c4m index b8fbfdd8f..9b8c6b4ee 100644 --- a/planet/Material.c4g/Sulphur.c4m +++ b/planet/Material.c4g/Sulphur.c4m @@ -1,6 +1,5 @@ [Material] Name=Sulphur -Color=128,128,128,128,128,128,128,128,128 Shape=3 Density=50 Friction=75 diff --git a/planet/Material.c4g/Tunnel.c4m b/planet/Material.c4g/Tunnel.c4m index 9b6c46d47..f9b95c8e2 100644 --- a/planet/Material.c4g/Tunnel.c4m +++ b/planet/Material.c4g/Tunnel.c4m @@ -1,6 +1,5 @@ [Material] Name=Tunnel -Color=128,128,128,128,128,128,128,128,128 Shape=2 Placement=5 TextureOverlay=tunnel diff --git a/planet/Material.c4g/Vehicle.c4m b/planet/Material.c4g/Vehicle.c4m index a4cdac352..1ee6fa16a 100644 --- a/planet/Material.c4g/Vehicle.c4m +++ b/planet/Material.c4g/Vehicle.c4m @@ -1,6 +1,5 @@ [Material] Name=Vehicle -Color=120,100,70,120,100,70,120,100,70 Density=100 Friction=100 - \ No newline at end of file + diff --git a/planet/Material.c4g/Water.c4m b/planet/Material.c4g/Water.c4m index f958482ca..00b58bbd6 100644 --- a/planet/Material.c4g/Water.c4m +++ b/planet/Material.c4g/Water.c4m @@ -1,7 +1,5 @@ [Material] Name=Water -Color=128,128,128,128,128,128,128,128,128 -Alpha=0,0,0,0,0,0 ColorAnimation=1 Density=25 Instable=1 diff --git a/standard/inc/StdDDraw2.h b/standard/inc/StdDDraw2.h index e845bf288..afd2c567d 100644 --- a/standard/inc/StdDDraw2.h +++ b/standard/inc/StdDDraw2.h @@ -131,20 +131,11 @@ class CPattern uint32_t * CachedPattern; int Wdt; int Hgt; // pattern zoom factor; 0 means no 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: CPattern& operator=(const CPattern&); const CSurface *getSurface() const { return sfcPattern32; } - bool PatternClr(int iX, int iY, BYTE &byClr, DWORD &dwClr, CStdPalette &rPal) const; // apply pattern to color - bool IsNewStyle() { if (sfcPattern32) return true; } - 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 + DWORD PatternClr(unsigned int iX, unsigned int iY) const; // apply pattern to color + bool Set(class CSurface *sfcSource, int iZoom=0); // set and enable pattern void SetZoom(int iZoom) { Zoom = iZoom; } void Clear(); // clear pattern CPattern(); // ctor diff --git a/standard/src/StdDDraw2.cpp b/standard/src/StdDDraw2.cpp index 4ae3eb9ac..105c5dbab 100644 --- a/standard/src/StdDDraw2.cpp +++ b/standard/src/StdDDraw2.cpp @@ -101,8 +101,6 @@ void CBltTransform::TransformPoint(float &rX, float &rY) CPattern& CPattern::operator=(const CPattern& nPattern) { - pClrs = nPattern.pClrs; - pAlpha = nPattern.pAlpha; sfcPattern32 = nPattern.sfcPattern32; if (sfcPattern32) sfcPattern32->Lock(); delete [] CachedPattern; @@ -118,11 +116,10 @@ CPattern& CPattern::operator=(const CPattern& nPattern) Wdt = nPattern.Wdt; Hgt = nPattern.Hgt; Zoom = nPattern.Zoom; - Monochrome = nPattern.Monochrome; return *this; } -bool CPattern::Set(SURFACE sfcSource, int iZoom, bool fMonochrome) +bool CPattern::Set(SURFACE sfcSource, int iZoom) { // Safety if (!sfcSource) return false; @@ -136,7 +133,6 @@ bool CPattern::Set(SURFACE sfcSource, int iZoom, bool fMonochrome) // set zoom Zoom=iZoom; // set flags - Monochrome=fMonochrome; CachedPattern = new uint32_t[Wdt * Hgt]; if (!CachedPattern) return false; for (int y = 0; y < Hgt; ++y) @@ -153,8 +149,6 @@ CPattern::CPattern() sfcPattern32=NULL; CachedPattern = 0; Zoom=0; - Monochrome=false; - pClrs=NULL; pAlpha=NULL; } void CPattern::Clear() @@ -170,25 +164,12 @@ void CPattern::Clear() 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; - // position zoomed? - if (Zoom) { iX/=Zoom; iY/=Zoom; } - // modulate position - ((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; + if (!CachedPattern) return 0; + // wrap position + iX %= Wdt; iY %= Hgt; + return CachedPattern[iY * Wdt + iX]; } 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 for (int xcnt = x - lwdt; xcnt < x + lwdt; ++xcnt) { - // apply both patterns - DWORD dwClr=rPal.GetClr(col); - Pattern.PatternClr(xcnt, y + ycnt, col, dwClr, rPal); - sfcDest->SetPixDw(xcnt, y + ycnt, dwClr); + sfcDest->SetPixDw(xcnt, y + ycnt, Pattern.PatternClr(xcnt, y + ycnt)); } } sfcDest->Unlock();