Remove old liquid animation

stable-5.2
Günther Brammer 2009-05-28 01:31:31 +02:00
parent 806cd10f7b
commit b2a16b8e1a
8 changed files with 17 additions and 74 deletions

View File

@ -54,7 +54,6 @@ class C4GraphicsResource
int32_t iNumRanks;
C4FacetID fctFire;
C4FacetID fctBackground;
C4Surface sfcLiquidAnimation; int32_t idSfcLiquidAnimation;
C4FacetID fctCaptain;
C4FacetID fctMouseCursor;
bool fOldStyleCursor; // if set, offsets need to be applied to some cursor facets

View File

@ -68,7 +68,6 @@ class C4Landscape
BYTE *pInitial; // Initial landscape after creation - used for diff
protected:
CSurface * Surface32;
CSurface * AnimationSurface;
CSurface8 * Surface8;
int32_t Pix2Mat[256], Pix2Dens[256], Pix2Place[256];
int32_t PixCntPitch;

View File

@ -54,7 +54,6 @@ void C4GraphicsResource::Default()
fctRank.Default();
fctFire.Default();
fctBackground.Default();
sfcLiquidAnimation.Default(); idSfcLiquidAnimation = 0;
fctCaptain.Default();
fctMouseCursor.Default();
fctSelectMark.Default();
@ -115,7 +114,6 @@ void C4GraphicsResource::Clear()
fctRank.Clear();
fctFire.Clear();
fctBackground.Clear();
sfcLiquidAnimation.Clear();
fctCaptain.Clear();
fctMouseCursor.Clear();
fctSelectMark.Clear();
@ -229,7 +227,6 @@ BOOL C4GraphicsResource::Init(bool fInitGUI)
if (!LoadFile(fctGamepad, "Gamepad", Files, 80)) return FALSE;
if (!LoadFile(fctBuild, "Build", Files)) return FALSE;
if (!LoadFile(fctEnergyBars, "EnergyBars", Files)) return FALSE;
if (!LoadFile(sfcLiquidAnimation, "Liquid", Files, idSfcLiquidAnimation)) return FALSE;
// life bar facets
if (fctEnergyBars.Surface)
{

View File

@ -273,7 +273,6 @@ void C4Landscape::Clear(bool fClearMapCreator, bool fClearSky)
if (fClearSky) Sky.Clear();
// clear surfaces, if assigned
delete Surface32; Surface32=NULL;
delete AnimationSurface; AnimationSurface=0;
delete Surface8; Surface8=NULL;
delete Map; Map=NULL;
// clear initial landscape
@ -299,7 +298,7 @@ void C4Landscape::Draw(C4TargetFacet &cgo, int32_t iPlayer)
const CSurface * Surfaces[C4M_MaxTexIndex];
for (int i = 0; i < C4M_MaxTexIndex; ++i)
Surfaces[i] = Game.TextureMap.GetEntry(i)->getPattern().getSurface();
Application.DDraw->BlitLandscape(Surface32, AnimationSurface, &Game.GraphicsResource.sfcLiquidAnimation, cgo.TargetX, cgo.TargetY, cgo.Surface, cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt,Surfaces);
Application.DDraw->BlitLandscape(Surface32, cgo.TargetX, cgo.TargetY, cgo.Surface, cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt, DDrawCfg.Shader ? Surfaces : 0);
}
if (Modulation) Application.DDraw->DeactivateBlitModulation();
}
@ -381,7 +380,6 @@ void C4Landscape::ChunkOZoom(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, i
// get chunk size
iChunkWidth=MapZoom; iChunkHeight=MapZoom;
Surface32->Lock();
if (AnimationSurface) AnimationSurface->Lock();
// Scan map lines
for (iY=iMapY; iY<iMapY+iMapHgt; iY++)
{
@ -429,7 +427,6 @@ void C4Landscape::ChunkOZoom(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, i
}
}
Surface32->Unlock();
if (AnimationSurface) AnimationSurface->Unlock();
}
BOOL C4Landscape::GetTexUsage(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, DWORD *dwpTextureUsage)
@ -488,7 +485,6 @@ BOOL C4Landscape::MapToSurface(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY,
// assign clipper
Surface8->Clip(iToX,iToY,iToX+iToWdt-1,iToY+iToHgt-1);
Surface32->Clip(iToX,iToY,iToX+iToWdt-1,iToY+iToHgt-1);
if (AnimationSurface) AnimationSurface->Clip(iToX,iToY,iToX+iToWdt-1,iToY+iToHgt-1);
Application.DDraw->NoPrimaryClipper();
// Enlarge map segment for chunky rim
@ -503,7 +499,6 @@ BOOL C4Landscape::MapToSurface(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY,
// remove clipper
Surface8->NoClip();
Surface32->NoClip();
if (AnimationSurface) AnimationSurface->NoClip();
// success
return TRUE;
@ -531,12 +526,10 @@ BOOL C4Landscape::MapToLandscape(CSurface8 * sfcMap, int32_t iMapX, int32_t iMap
To.Hgt = iMapHgt*MapZoom;
Surface32->Lock();
if (AnimationSurface) AnimationSurface->Lock();
PrepareChange(To);
MapToSurface(sfcMap, iMapX, iMapY, iMapWdt, iMapHgt, To.x, To.y, To.Wdt, To.Hgt, iOffsX, iOffsY);
FinishChange(To);
Surface32->Unlock();
if (AnimationSurface) AnimationSurface->Unlock();
return TRUE;
}
@ -720,15 +713,12 @@ BOOL C4Landscape::Init(C4Group &hGroup, bool fOverloadCurrent, bool fLoadSky, bo
// Create landscape surface
Surface32 = new CSurface();
Surface8 = new CSurface8();
if (Config.Graphics.ColorAnimation && DDrawCfg.Shader)
AnimationSurface = new CSurface(Width, Height);
if (!Surface32->Create(Width, Height, true, false, lpDDraw->IsShaderific() ? 0 : 64)
|| !Surface8->Create(Width, Height, true)
|| (AnimationSurface && !AnimationSurface->Create(Width, Height))
|| !Mat2Pal())
{
delete Surface8; delete Surface32; delete AnimationSurface;
Surface8 = 0; Surface32 = 0; AnimationSurface = 0;
delete Surface8; delete Surface32;
Surface8 = 0; Surface32 = 0;
return FALSE;
}
@ -1552,8 +1542,6 @@ BOOL C4Landscape::Load(C4Group &hGroup, bool fLoadSky, bool fSavegame)
Surface8->GetSurfaceSize(iWidth,iHeight);
Width = iWidth; Height = iHeight;
Surface32 = new CSurface(Width, Height);
if (Config.Graphics.ColorAnimation && DDrawCfg.Shader)
AnimationSurface = new CSurface(Width, Height);
// adjust pal
if (!Mat2Pal()) return FALSE;
// load the 32bit-surface, too
@ -1651,7 +1639,6 @@ void C4Landscape::Default()
Mode=C4LSC_Undefined;
Surface8=NULL;
Surface32=NULL;
AnimationSurface=0;
Map=NULL;
Width=Height=0;
MapWidth=MapHeight=MapZoom=0;
@ -2490,11 +2477,6 @@ bool C4Landscape::ApplyLighting(C4Rect To)
if (To.Wdt<=0 || To.Hgt<=0) return true;
if (!Surface32->Lock()) return false;
Surface32->ClearBoxDw(To.x, To.y, To.Wdt, To.Hgt);
if (AnimationSurface)
{
AnimationSurface->Lock();
AnimationSurface->ClearBoxDw(To.x, To.y, To.Wdt, To.Hgt);
}
// do lightning
for (int32_t iX=To.x; iX<To.x+To.Wdt; ++iX)
{
@ -2547,11 +2529,9 @@ bool C4Landscape::ApplyLighting(C4Rect To)
DarkenClrBy(dwBackClr, Min(30, 2 * (iOwnDens - iCompareDens)));
}
Surface32->SetPixDw(iX, iY, dwBackClr);
if (AnimationSurface) AnimationSurface->SetPixDw(iX, iY, DensityLiquid(Pix2Dens[pix]) ? 255 << 24 : 0);
}
}
Surface32->Unlock();
if (AnimationSurface) AnimationSurface->Unlock();
// done
return true;
}

View File

@ -286,7 +286,7 @@ class CStdDDraw
void PrimaryUnlocked() { PrimaryLocked=false; }
virtual bool PrepareRendering(SURFACE sfcToSurface) = 0; // check if/make rendering possible to given surface
// Blit
virtual void BlitLandscape(SURFACE sfcSource, SURFACE sfcSource2, SURFACE sfcLiquidAnimation, float fx, float fy,
virtual void BlitLandscape(SURFACE sfcSource, float fx, float fy,
SURFACE sfcTarget, float tx, float ty, float wdt, float hgt, const SURFACE textures[]);
void Blit8Fast(CSurface8 * sfcSource, int fx, int fy,
SURFACE sfcTarget, int tx, int ty, int wdt, int hgt);

View File

@ -116,8 +116,8 @@ class CStdGL : public CStdDDraw
#endif
// Blit
void PerformBlt(CBltData &rBltData, CTexRef *pTex, DWORD dwModClr, bool fMod2, bool fExact);
virtual void BlitLandscape(SURFACE sfcSource, SURFACE sfcSource2, SURFACE sfcLiquidAnimation, float fx, float fy,
SURFACE sfcTarget, float tx, float ty, float wdt, float hgt, const SURFACE textures[]);
virtual void BlitLandscape(SURFACE sfcSource, float fx, float fy,
SURFACE sfcTarget, float tx, float ty, float wdt, float hgt, const SURFACE textures[]);
void FillBG(DWORD dwClr=0);
// Drawing
void DrawQuadDw(SURFACE sfcTarget, float *ipVtx, DWORD dwClr1, DWORD dwClr2, DWORD dwClr3, DWORD dwClr4);

View File

@ -828,8 +828,8 @@ bool CStdDDraw::ClipPoly(CBltData &rBltData)
return true;
}
void CStdDDraw::BlitLandscape(SURFACE sfcSource, SURFACE sfcSource2, SURFACE sfcSource3, float fx, float fy,
SURFACE sfcTarget, float tx, float ty, float wdt, float hgt, const SURFACE textures[])
void CStdDDraw::BlitLandscape(SURFACE sfcSource, float fx, float fy,
SURFACE sfcTarget, float tx, float ty, float wdt, float hgt, const SURFACE textures[])
{
Blit(sfcSource, fx, fy, wdt, hgt, sfcTarget, tx, ty, wdt, hgt, FALSE);
}

View File

@ -302,8 +302,8 @@ void CStdGL::PerformBlt(CBltData &rBltData, CTexRef *pTex, DWORD dwModClr, bool
}
}
void CStdGL::BlitLandscape(SURFACE sfcSource, SURFACE sfcSource2, SURFACE sfcLiquidAnimation, float fx, float fy,
SURFACE sfcTarget, float tx, float ty, float wdt, float hgt, const SURFACE mattextures[])
void CStdGL::BlitLandscape(SURFACE sfcSource, float fx, float fy,
SURFACE sfcTarget, float tx, float ty, float wdt, float hgt, const SURFACE mattextures[])
{
//Blit(sfcSource, fx, fy, wdt, hgt, sfcTarget, tx, ty, wdt, hgt);return;
// safety
@ -373,20 +373,17 @@ void CStdGL::BlitLandscape(SURFACE sfcSource, SURFACE sfcSource2, SURFACE sfcLiq
int iTexY2=Min((int)(fy+hgt-1)/iTexSize +1, sfcSource->iTexY);
// blit from all these textures
SetTexture();
if (sfcSource2)
if (mattextures)
{
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE2);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, (*sfcLiquidAnimation->ppTex)->texName);
glActiveTexture(GL_TEXTURE0);
}
DWORD dwModMask = 0;
if (shaders[0])
{
glEnable(GL_FRAGMENT_PROGRAM_ARB);
GLuint s = sfcSource2 ? 2 : 0;
GLuint s = mattextures ? 2 : 0;
if (Saturation < 255)
{
s += 3;
@ -408,19 +405,6 @@ void CStdGL::BlitLandscape(SURFACE sfcSource, SURFACE sfcSource2, SURFACE sfcLiq
GLfloat bla[4] = { Saturation / 255.0f, Saturation / 255.0f, Saturation / 255.0f, 1.0f };
glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0, bla);
}
if (sfcSource2)
{
static GLfloat bla[4] = { -0.6f/3, 0.0f, 0.6f/3, 0.0f };
bla[0] += 0.05f; bla[1] += 0.05f; bla[2] += 0.05f;
GLfloat mod[4];
for (int i = 0; i < 3; ++i)
{
if (bla[i] > 0.9f) bla[i] = -0.3f;
mod[i] = (bla[i] > 0.3f ? 0.6f - bla[i] : bla[i]) / 3.0f;
}
mod[3] = 0;
glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 1, mod);
}
dwModMask = 0;
}
// texture environment
@ -462,26 +446,12 @@ void CStdGL::BlitLandscape(SURFACE sfcSource, SURFACE sfcSource2, SURFACE sfcLiq
// blit
DWORD dwModClr = BlitModulated ? BlitModulateClr : 0xffffff;
if (sfcSource2)
if (mattextures)
glActiveTexture(GL_TEXTURE0);
CTexRef *pTex = *(sfcSource->ppTex + iY * sfcSource->iTexX + iX);
glBindTexture(GL_TEXTURE_2D, pTex->texName);
if (Zoom != 1.0);// && !DDrawCfg.PointFiltering)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
if (sfcSource2)
{
CTexRef *pTex = *(sfcSource2->ppTex + iY * sfcSource2->iTexX + iX);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, pTex->texName);
if (Zoom != 1.0 && !DDrawCfg.PointFiltering)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
// get current blitting offset in texture (beforing any last-tex-size-changes)
int iBlitX=iTexSize*iX;
@ -541,7 +511,7 @@ void CStdGL::BlitLandscape(SURFACE sfcSource, SURFACE sfcSource2, SURFACE sfcLiq
Vtx[i].fty += DDrawCfg.fBlitOff;
Vtx[i].ftz = 0;
}
if(DDrawCfg.Shader)
if(mattextures)
{
GLfloat shaderparam[4];
for (int cnt=1;cnt<127;cnt++)
@ -579,12 +549,10 @@ void CStdGL::BlitLandscape(SURFACE sfcSource, SURFACE sfcSource2, SURFACE sfcLiq
{
glDisable(GL_FRAGMENT_PROGRAM_ARB);
}
if (sfcSource2)
if (mattextures)
{
glActiveTexture(GL_TEXTURE1);
glDisable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE2);
glDisable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
}
// reset texture