Replace Application.DDraw with lpDDraw everywhere

There's no need for two globals always storing the same value.
floating-point
Günther Brammer 2010-09-28 20:35:26 +02:00
parent a7e4dd9a9c
commit 8e2ae2f543
28 changed files with 133 additions and 134 deletions

View File

@ -54,7 +54,7 @@ C4Application::C4Application():
NoSplash(false),
restartAtEnd(false),
pGamePadControl(NULL),
DDraw(NULL), AppState(C4AS_None)
AppState(C4AS_None)
{
}
@ -176,8 +176,8 @@ bool C4Application::DoInit()
LogF("Version: %s %s (%s)", C4VERSION, C4_OS, Revision.getData());
// Initialize D3D/OpenGL
DDraw = DDrawInit(this, isEditor, false, Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.BitDepth, Config.Graphics.Engine, Config.Graphics.Monitor);
if (!DDraw) { LogFatal(LoadResStr("IDS_ERR_DDRAW")); Clear(); return false; }
bool success = DDrawInit(this, isEditor, false, Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.BitDepth, Config.Graphics.Engine, Config.Graphics.Monitor);
if (!success) { LogFatal(LoadResStr("IDS_ERR_DDRAW")); Clear(); return false; }
if (!isEditor)
{
@ -302,7 +302,7 @@ void C4Application::Clear()
SoundSystem.Clear();
RestoreVideoMode();
// Clear direct draw (late, because it's needed for e.g. Log)
if (DDraw) { delete DDraw; DDraw=NULL; }
if (lpDDraw) { delete lpDDraw; lpDDraw=NULL; }
// Close window
FullScreen.Clear();
Console.Clear();
@ -441,10 +441,10 @@ void C4Application::SetGameTickDelay(int iDelay)
void C4Application::OnResolutionChanged(unsigned int iXRes, unsigned int iYRes)
{
// notify game
if (DDraw)
if (lpDDraw)
{
Game.OnResolutionChanged(iXRes, iYRes);
DDraw->OnResolutionChanged(iXRes, iYRes);
lpDDraw->OnResolutionChanged(iXRes, iYRes);
}
if (pWindow && pWindow->pSurface)
pWindow->pSurface->UpdateSize(iXRes, iYRes);

View File

@ -71,7 +71,6 @@ public:
// IRC client for global chat
C4Network2IRCClient IRCClient;
// Tick timing
class CStdDDraw *DDraw;
void Clear();
void GameTick();
void Draw();

View File

@ -1657,7 +1657,7 @@ void C4Game::DrawCursors(C4TargetFacet &cgo, int32_t iPlayer)
}
else str = cursor->GetName();
Application.DDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,
lpDDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,
cgo.X + cox + fctCursor.Wdt / 2,
cgo.Y + coy - 2 - texthgt,
0xffff0000, ACenter);
@ -1853,7 +1853,7 @@ bool C4Game::SaveGameTitle(C4Group &hGroup)
if (!(sfcPic = new CSurface(iSfcWdt,iSfcHgt))) return false;
// Fullscreen
Application.DDraw->Blit(FullScreen.pSurface,
lpDDraw->Blit(FullScreen.pSurface,
0.0f,0.0f,float(C4GUI::GetScreenWdt()),float(C4GUI::GetScreenHgt()-::GraphicsResource.FontRegular.iLineHgt),
sfcPic,0,0,iSfcWdt,iSfcHgt);

View File

@ -129,8 +129,8 @@ int32_t ScreenTick=0, ScreenRate=1;
bool C4GraphicsSystem::StartDrawing()
{
// only if ddraw is ready
if (!Application.DDraw) return false;
if (!Application.DDraw->Active) return false;
if (!lpDDraw) return false;
if (!lpDDraw->Active) return false;
// only if application is active or windowed (if config allows)
if (!Application.Active && (!Application.isEditor || !Config.Graphics.RenderInactiveEM)) return false;
@ -338,14 +338,14 @@ void C4GraphicsSystem::DrawFullscreenBackground()
for (int i=0, iNum=BackgroundAreas.GetCount(); i<iNum; ++i)
{
const C4Rect &rc = BackgroundAreas.Get(i);
Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,FullScreen.pSurface,rc.x,rc.y,rc.Wdt,rc.Hgt,-rc.x,-rc.y);
lpDDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,FullScreen.pSurface,rc.x,rc.y,rc.Wdt,rc.Hgt,-rc.x,-rc.y);
}
--iRedrawBackground;
}
void C4GraphicsSystem::ClearFullscreenBackground()
{
Application.DDraw->FillBG(0);
lpDDraw->FillBG(0);
--iRedrawBackground;
}
@ -637,7 +637,7 @@ bool C4GraphicsSystem::DoSaveScreenshot(bool fSaveAll, const char *szFilename)
// transfer each pixel - slooow...
for (int32_t iY2=0; iY2<bkHgt2; ++iY2)
for (int32_t iX2=0; iX2<bkWdt2; ++iX2)
png.SetPix(iX+iX2, iY+iY2, Application.DDraw->ApplyGammaTo(FullScreen.pSurface->GetPixDw(iX2, iY2, false)));
png.SetPix(iX+iX2, iY+iY2, lpDDraw->ApplyGammaTo(FullScreen.pSurface->GetPixDw(iX2, iY2, false)));
// done; unlock
FullScreen.pSurface->Unlock();
}
@ -669,7 +669,7 @@ void C4GraphicsSystem::DrawHoldMessages()
{
if (!Application.isEditor && Game.HaltCount)
{
Application.DDraw->TextOut("Pause", ::GraphicsResource.FontRegular,1.0,
lpDDraw->TextOut("Pause", ::GraphicsResource.FontRegular,1.0,
FullScreen.pSurface, C4GUI::GetScreenWdt()/2,
C4GUI::GetScreenHgt()/2 - ::GraphicsResource.FontRegular.iLineHgt*2,
CStdDDraw::DEFAULT_MESSAGE_COLOR, ACenter);
@ -707,7 +707,7 @@ void C4GraphicsSystem::DrawFlashMessage()
{
if (!FlashMessageTime) return;
if (Application.isEditor) return;
Application.DDraw->TextOut(FlashMessageText, ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface,
lpDDraw->TextOut(FlashMessageText, ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface,
(FlashMessageX==-1) ? C4GUI::GetScreenWdt()/2 : FlashMessageX,
(FlashMessageY==-1) ? C4GUI::GetScreenHgt()/2 : FlashMessageY,
CStdDDraw::DEFAULT_MESSAGE_COLOR,
@ -743,7 +743,7 @@ void C4GraphicsSystem::DrawHelp()
strText.AppendFormat("\n<c ffff00>%s</c> - %s\n", GetKeyboardInputName("Screenshot").getData(), LoadResStr("IDS_CTL_SCREENSHOT"));
strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("ScreenshotEx").getData(), LoadResStr("IDS_CTL_SCREENSHOTEX"));
Application.DDraw->TextOut(strText.getData(), ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface,
lpDDraw->TextOut(strText.getData(), ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface,
iX + 128, iY + 64, CStdDDraw::DEFAULT_MESSAGE_COLOR, ALeft);
// right coloumn
@ -757,7 +757,7 @@ void C4GraphicsSystem::DrawHelp()
strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("DbgShowVtxToggle").getData(), "Entrance+Vertices");
strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("DbgShowActionToggle").getData(), "Actions/Commands/Pathfinder");
strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("DbgShowSolidMaskToggle").getData(), "SolidMasks");
Application.DDraw->TextOut(strText.getData(), ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface,
lpDDraw->TextOut(strText.getData(), ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface,
iX + iWdt/2 + 64, iY + 64, CStdDDraw::DEFAULT_MESSAGE_COLOR, ALeft);
}
@ -814,7 +814,7 @@ void C4GraphicsSystem::ApplyGamma()
Gamma[iCurve]=C4RGB(BoundBy<int32_t>(DefChanVal[iCurve]+ChanOff[0], 0, 255), BoundBy<int32_t>(DefChanVal[iCurve]+ChanOff[1], 0, 255), BoundBy<int32_t>(DefChanVal[iCurve]+ChanOff[2], 0, 255));
}
// set gamma
Application.DDraw->SetGamma(Gamma[0], Gamma[1], Gamma[2]);
lpDDraw->SetGamma(Gamma[0], Gamma[1], Gamma[2]);
}
bool C4GraphicsSystem::ToggleShowNetStatus()

View File

@ -444,12 +444,12 @@ void C4EditCursor::Draw(C4TargetFacet &cgo)
}
// Draw drag frame
if (DragFrame)
Application.DDraw->DrawFrameDw(cgo.Surface,
lpDDraw->DrawFrameDw(cgo.Surface,
Min(X, X2) + cgo.X - cgo.TargetX, Min(Y, Y2) + cgo.Y - cgo.TargetY,
Max(X, X2) + cgo.X - cgo.TargetX, Max(Y, Y2) + cgo.Y - cgo.TargetY, 0xffffffff);
// Draw drag line
if (DragLine)
Application.DDraw->DrawLineDw(cgo.Surface,
lpDDraw->DrawLineDw(cgo.Surface,
X + cgo.X - cgo.TargetX, Y + cgo.Y - cgo.TargetY,
X2 + cgo.X - cgo.TargetX, Y2 + cgo.Y - cgo.TargetY, 0xffffffff);
// Draw drop target
@ -466,21 +466,21 @@ void C4EditCursor::DrawSelectMark(C4Facet &cgo, FLOAT_RECT frame)
if (!cgo.Surface) return;
Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.top,0xFFFFFFFF);
Application.DDraw->DrawPix(cgo.Surface,frame.left+1,frame.top,0xFFFFFFFF);
Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.top+1,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.left,frame.top,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.left+1,frame.top,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.left,frame.top+1,0xFFFFFFFF);
Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.bottom-1,0xFFFFFFFF);
Application.DDraw->DrawPix(cgo.Surface,frame.left+1,frame.bottom-1,0xFFFFFFFF);
Application.DDraw->DrawPix(cgo.Surface,frame.left,frame.bottom-2,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.left,frame.bottom-1,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.left+1,frame.bottom-1,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.left,frame.bottom-2,0xFFFFFFFF);
Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.top,0xFFFFFFFF);
Application.DDraw->DrawPix(cgo.Surface,frame.right-2,frame.top,0xFFFFFFFF);
Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.top+1,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.right-1,frame.top,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.right-2,frame.top,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.right-1,frame.top+1,0xFFFFFFFF);
Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.bottom-1,0xFFFFFFFF);
Application.DDraw->DrawPix(cgo.Surface,frame.right-2,frame.bottom-1,0xFFFFFFFF);
Application.DDraw->DrawPix(cgo.Surface,frame.right-1,frame.bottom-2,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.right-1,frame.bottom-1,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.right-2,frame.bottom-1,0xFFFFFFFF);
lpDDraw->DrawPix(cgo.Surface,frame.right-1,frame.bottom-2,0xFFFFFFFF);
}

View File

@ -661,7 +661,7 @@ void C4ToolsDlg::UpdatePreview()
// fill bg
#ifdef _WIN32
Application.DDraw->DrawBoxDw(sfcPreview,0,0,iPrvWdt-1,iPrvHgt-1,C4RGB(0x80,0x80,0x80));
lpDDraw->DrawBoxDw(sfcPreview,0,0,iPrvWdt-1,iPrvHgt-1,C4RGB(0x80,0x80,0x80));
#endif
BYTE bCol = 0;
CPattern Pattern;
@ -699,7 +699,7 @@ void C4ToolsDlg::UpdatePreview()
#endif
#endif
#endif
Application.DDraw->DrawPatternedCircle( sfcPreview,
lpDDraw->DrawPatternedCircle( sfcPreview,
iPrvWdt/2,iPrvHgt/2,
Grade,
bCol, Pattern, *::Landscape.GetPal());

View File

@ -302,23 +302,23 @@ void C4Landscape::Clear(bool fClearMapCreator, bool fClearSky)
void C4Landscape::Draw(C4TargetFacet &cgo, int32_t iPlayer)
{
if (Modulation) Application.DDraw->ActivateBlitModulation(Modulation);
if (Modulation) lpDDraw->ActivateBlitModulation(Modulation);
// do relights
DoRelights();
// blit landscape
if (::GraphicsSystem.ShowSolidMask)
Application.DDraw->Blit8Fast(Surface8, cgo.TargetX, cgo.TargetY, cgo.Surface, cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt);
lpDDraw->Blit8Fast(Surface8, cgo.TargetX, cgo.TargetY, cgo.Surface, cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt);
else
{
const CSurface * Surfaces[C4M_MaxTexIndex];
if (Config.Graphics.HighResLandscape)
for (int i = 0; i < C4M_MaxTexIndex; ++i)
Surfaces[i] = ::TextureMap.GetEntry(i)->GetPattern().getSurface();
Application.DDraw->BlitLandscape(Surface32, cgo.TargetX, cgo.TargetY, cgo.Surface,
lpDDraw->BlitLandscape(Surface32, cgo.TargetX, cgo.TargetY, cgo.Surface,
cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt,
Config.Graphics.HighResLandscape ? Surfaces : 0);
}
if (Modulation) Application.DDraw->DeactivateBlitModulation();
if (Modulation) lpDDraw->DeactivateBlitModulation();
}
int32_t C4Landscape::ChunkyRandom(int32_t &iOffset, int32_t iRange)
@ -503,7 +503,7 @@ 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);
Application.DDraw->NoPrimaryClipper();
lpDDraw->NoPrimaryClipper();
// Enlarge map segment for chunky rim
iMapX-=2; iMapY-=2; iMapWdt+=4; iMapHgt+=4;
@ -2445,7 +2445,7 @@ bool C4Landscape::DrawChunks(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, i
// assign clipper
Surface8->Clip(BoundingBox.x,BoundingBox.y,BoundingBox.x+BoundingBox.Wdt,BoundingBox.y+BoundingBox.Hgt);
Application.DDraw->NoPrimaryClipper();
lpDDraw->NoPrimaryClipper();
// draw all chunks
int32_t x, y;

View File

@ -270,14 +270,14 @@ void C4PXSSystem::Draw(C4TargetFacet &cgo)
// lines for stuff that goes whooosh!
int len = fixtoi(Abs(pxp->xdir)+Abs(pxp->ydir));
dwMatClr = uint32_t(Max<int>(dwMatClr>>24, 195 - (195 - (dwMatClr >> 24)) / len)) << 24 | (dwMatClr&0xffffff);
Application.DDraw->DrawLineDw(cgo.Surface,
lpDDraw->DrawLineDw(cgo.Surface,
fixtof(pxp->x - pxp->xdir) + cgox, fixtof(pxp->y - pxp->ydir) + cgoy,
fixtof(pxp->x) + cgox, fixtof(pxp->y) + cgoy,
dwMatClr);
}
else
// single pixels for slow stuff
Application.DDraw->DrawPix(cgo.Surface, fixtof(pxp->x)+cgox, fixtof(pxp->y)+cgoy, dwMatClr);
lpDDraw->DrawPix(cgo.Surface, fixtof(pxp->x)+cgox, fixtof(pxp->y)+cgoy, dwMatClr);
}
}
@ -310,9 +310,9 @@ void C4PXSSystem::Draw(C4TargetFacet &cgo)
int32_t z=1 + ((cnt2/Max<int32_t>(pnx*pny, 1))^341) % pMat->PXSGfxSize;
pny=(cnt2/pnx)%pny; pnx=cnt2%pnx;
// draw
Application.DDraw->ActivateBlitModulation(Min((fcWdtH-z)*16, 255)<<24 | 0xffffff);
lpDDraw->ActivateBlitModulation(Min((fcWdtH-z)*16, 255)<<24 | 0xffffff);
pMat->PXSFace.DrawX(cgo.Surface, fixtoi(pxp->x)+cgox+z*pMat->PXSGfxRt.tx/fcWdt, fixtoi(pxp->y)+cgoy+z*pMat->PXSGfxRt.ty/fcWdt, z, z*pMat->PXSFace.Hgt/fcWdt, pnx, pny);
Application.DDraw->DeactivateBlitModulation();
lpDDraw->DeactivateBlitModulation();
}
}

View File

@ -644,7 +644,7 @@ void fxSmokeDraw(C4Particle *particle, C4TargetFacet &cgo, C4Object *target)
int32_t px = i/4;
int32_t py = i%4;
// draw at pos
Application.DDraw->ActivateBlitModulation(particle->b);
lpDDraw->ActivateBlitModulation(particle->b);
float fx = float(def->Gfx.X + def->Gfx.Wdt * px);
float fy = float(def->Gfx.Y + def->Gfx.Hgt * py);
@ -655,7 +655,7 @@ void fxSmokeDraw(C4Particle *particle, C4TargetFacet &cgo, C4Object *target)
cgo.Surface, cx - particle->a, cy - particle->a, particle->a * 2, particle->a * 2,
true);
Application.DDraw->DeactivateBlitModulation();
lpDDraw->DeactivateBlitModulation();
}
bool fxStdInit(C4Particle *particle, C4Object *target)
@ -862,9 +862,9 @@ void fxStdDraw(C4Particle *particle, C4TargetFacet &cgo, C4Object *target)
if (def->RByV == 3) // random rotation - currently a pseudo random rotation by x/y position
r = (((int32_t)(particle->x * 23 + particle->y * 12)) % 360) * 100;
// draw at pos
Application.DDraw->ActivateBlitModulation(particle->b);
Application.DDraw->StorePrimaryClipper();
Application.DDraw->SubPrimaryClipper(cgox, cgoy+def->YOff, 100000, 100000);
lpDDraw->ActivateBlitModulation(particle->b);
lpDDraw->StorePrimaryClipper();
lpDDraw->SubPrimaryClipper(cgox, cgoy+def->YOff, 100000, 100000);
if (def->Additive)
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
@ -899,9 +899,9 @@ void fxStdDraw(C4Particle *particle, C4TargetFacet &cgo, C4Object *target)
true);
}
Application.DDraw->ResetBlitMode();
Application.DDraw->RestorePrimaryClipper();
Application.DDraw->DeactivateBlitModulation();
lpDDraw->ResetBlitMode();
lpDDraw->RestorePrimaryClipper();
lpDDraw->DeactivateBlitModulation();
}
C4ParticleProcRec C4ParticleProcMap[] =

View File

@ -348,7 +348,7 @@ bool C4PathFinderRay::PathFree(int32_t &rX, int32_t &rY, int32_t iToX, int32_t i
d=2*dx-dy; aincr=2*(dx-dy); bincr=2*dx; x=rX; y=rY;
for (y=rY; y!=iToY; y+=yincr)
{
Application.DDraw->SetPixel(sfcSurface,x,y,byCol);
lpDDraw->SetPixel(sfcSurface,x,y,byCol);
if (d>=0) { x+=xincr; d+=aincr; } else d+=bincr;
}
}
@ -361,7 +361,7 @@ bool C4PathFinderRay::PathFree(int32_t &rX, int32_t &rY, int32_t iToX, int32_t i
d=2*dy-dx; aincr=2*(dy-dx); bincr=2*dy; x=rX; y=rY;
for (x=rX; x!=iToX; x+=xincr)
{
Application.DDraw->SetPixel(sfcSurface,x,y,byCol);
lpDDraw->SetPixel(sfcSurface,x,y,byCol);
if (d>=0) { y+=yincr; d+=aincr; } else d+=bincr;
}
}

View File

@ -216,9 +216,9 @@ void C4Sky::Execute()
void C4Sky::Draw(C4TargetFacet &cgo)
{
// background color?
if (BackClrEnabled) Application.DDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y, cgo.X+cgo.Wdt, cgo.Y+cgo.Hgt, BackClr);
if (BackClrEnabled) lpDDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y, cgo.X+cgo.Wdt, cgo.Y+cgo.Hgt, BackClr);
// sky surface?
if (Modulation != 0xffffffff) Application.DDraw->ActivateBlitModulation(Modulation);
if (Modulation != 0xffffffff) lpDDraw->ActivateBlitModulation(Modulation);
if (Surface)
{
// blit parallax sky
@ -240,16 +240,16 @@ void C4Sky::Draw(C4TargetFacet &cgo)
ZoomDataStackItem zdsi(resultzoom);
Application.DDraw->BlitSurfaceTile2(Surface, cgo.Surface, cgo.X, cgo.Y, cgo.Wdt * zoom / resultzoom, cgo.Hgt * zoom / resultzoom, -resultx, -resulty, false);
lpDDraw->BlitSurfaceTile2(Surface, cgo.Surface, cgo.X, cgo.Y, cgo.Wdt * zoom / resultzoom, cgo.Hgt * zoom / resultzoom, -resultx, -resulty, false);
}
else
{
// no sky surface: blit sky fade
DWORD dwClr1=GetSkyFadeClr(cgo.TargetY);
DWORD dwClr2=GetSkyFadeClr(cgo.TargetY+cgo.Hgt);
Application.DDraw->DrawBoxFade(cgo.Surface, cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt, dwClr1, dwClr1, dwClr2, dwClr2, cgo.TargetX, cgo.TargetY);
lpDDraw->DrawBoxFade(cgo.Surface, cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt, dwClr1, dwClr1, dwClr2, dwClr2, cgo.TargetX, cgo.TargetY);
}
if (Modulation != 0xffffffff) Application.DDraw->DeactivateBlitModulation();
if (Modulation != 0xffffffff) lpDDraw->DeactivateBlitModulation();
// done
}

View File

@ -651,7 +651,7 @@ void C4Def::Draw(C4Facet &cgo, bool fSelected, DWORD iColor, C4Object *pObj, int
if (pObj) if (pObj->PictureRect.Wdt) fctPicRect = pObj->PictureRect;
if (fSelected)
Application.DDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y, cgo.X + cgo.Wdt - 1, cgo.Y + cgo.Hgt - 1, C4RGB(0xca, 0, 0));
lpDDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y, cgo.X + cgo.Wdt - 1, cgo.Y + cgo.Hgt - 1, C4RGB(0xca, 0, 0));
C4DefGraphics* graphics = pObj ? pObj->GetGraphics() : &Graphics;

View File

@ -998,8 +998,8 @@ void C4GraphicsOverlay::Draw(C4TargetFacet &cgo, C4Object *pForObj, int32_t iByP
(OverlayObj ? static_cast<C4Object*>(OverlayObj) : pForObj)->PrepareDrawing();
else
{
Application.DDraw->SetBlitMode(dwBlitMode);
if (dwClrModulation != 0xffffff) Application.DDraw->ActivateBlitModulation(dwClrModulation);
lpDDraw->SetBlitMode(dwBlitMode);
if (dwClrModulation != 0xffffff) lpDDraw->ActivateBlitModulation(dwClrModulation);
if (pMeshInstance)
pMeshInstance->SetFaceOrderingForClrModulation(dwClrModulation);
@ -1126,8 +1126,8 @@ void C4GraphicsOverlay::Draw(C4TargetFacet &cgo, C4Object *pForObj, int32_t iByP
(OverlayObj ? static_cast<C4Object*>(OverlayObj) : pForObj)->FinishedDrawing();
else
{
Application.DDraw->ResetBlitMode();
Application.DDraw->DeactivateBlitModulation();
lpDDraw->ResetBlitMode();
lpDDraw->DeactivateBlitModulation();
}
}
@ -1164,8 +1164,8 @@ void C4GraphicsOverlay::DrawPicture(C4Facet &cgo, C4Object *pForObj, C4DrawTrans
}
else
{
Application.DDraw->SetBlitMode(dwBlitMode);
if (dwClrModulation != 0xffffff) Application.DDraw->ActivateBlitModulation(dwClrModulation);
lpDDraw->SetBlitMode(dwBlitMode);
if (dwClrModulation != 0xffffff) lpDDraw->ActivateBlitModulation(dwClrModulation);
if (pMeshInstance)
pMeshInstance->SetFaceOrderingForClrModulation(dwClrModulation);
@ -1209,8 +1209,8 @@ void C4GraphicsOverlay::DrawPicture(C4Facet &cgo, C4Object *pForObj, C4DrawTrans
}
else
{
Application.DDraw->ResetBlitMode();
Application.DDraw->DeactivateBlitModulation();
lpDDraw->ResetBlitMode();
lpDDraw->DeactivateBlitModulation();
}
}

View File

@ -485,7 +485,7 @@ void C4IDList::Draw(C4Facet &cgo, int32_t iSelection,
cgo2 = cgo.TruncateSection(iAlign);
rDefs.Draw(c_id,cgo2,(firstid+cnt==iSelection),0);
sprintf(buf,"%dx",idcount);
if (fCounts) Application.DDraw->TextOut(buf, ::GraphicsResource.FontRegular, 1.0, cgo2.Surface,cgo2.X+cgo2.Wdt-1, cgo2.Y + cgo2.Hgt - 1 - ::GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight);
if (fCounts) lpDDraw->TextOut(buf, ::GraphicsResource.FontRegular, 1.0, cgo2.Surface,cgo2.X+cgo2.Wdt-1, cgo2.Y + cgo2.Hgt - 1 - ::GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight);
}
}

View File

@ -126,9 +126,9 @@ static void DrawVertex(C4Facet &cgo, int32_t tx, int32_t ty, int32_t col, int32_
{
if (Inside<int32_t>(tx,cgo.X,cgo.X+cgo.Wdt) && Inside<int32_t>(ty,cgo.Y,cgo.Y+cgo.Hgt))
{
Application.DDraw->DrawLineDw(cgo.Surface, tx - 1, ty, tx + 1, ty, col);
Application.DDraw->DrawLineDw(cgo.Surface, tx, ty - 1, tx, ty + 1, col);
if (contact) Application.DDraw->DrawFrameDw(cgo.Surface,tx-2,ty-2,tx+2,ty+2,C4RGB(0xff, 0xff, 0xff));
lpDDraw->DrawLineDw(cgo.Surface, tx - 1, ty, tx + 1, ty, col);
lpDDraw->DrawLineDw(cgo.Surface, tx, ty - 1, tx, ty + 1, col);
if (contact) lpDDraw->DrawFrameDw(cgo.Surface,tx-2,ty-2,tx+2,ty+2,C4RGB(0xff, 0xff, 0xff));
}
}
@ -2361,8 +2361,8 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
GetDrawPosition(cgo, pCom->Tx._getInt(), pCom->Ty, cgo.Zoom, offX2, offY2, newzoom))
{
ZoomDataStackItem zdsi(newzoom);
Application.DDraw->DrawLineDw(cgo.Surface,offX1,offY1,offX2,offY2,C4RGB(0xca,0,0));
Application.DDraw->DrawFrameDw(cgo.Surface,offX2-1,offY2-1,offX2+1,offY2+1,C4RGB(0xca,0,0));
lpDDraw->DrawLineDw(cgo.Surface,offX1,offY1,offX2,offY2,C4RGB(0xca,0,0));
lpDDraw->DrawFrameDw(cgo.Surface,offX2-1,offY2-1,offX2+1,offY2+1,C4RGB(0xca,0,0));
}
ccx=pCom->Tx._getInt(); ccy=pCom->Ty;
@ -2395,8 +2395,8 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
GetDrawPosition(cgo, pCom->Tx._getInt(), pCom->Ty, cgo.Zoom, offX2, offY2, newzoom))
{
ZoomDataStackItem zdsi(newzoom);
Application.DDraw->DrawLineDw(cgo.Surface,offX1,offY1,offX2,offY2,C4RGB(0,0xca,0));
Application.DDraw->DrawFrameDw(cgo.Surface,offX2-1,offY2-1,offX2+1,offY2+1,C4RGB(0,0xca,0));
lpDDraw->DrawLineDw(cgo.Surface,offX1,offY1,offX2,offY2,C4RGB(0,0xca,0));
lpDDraw->DrawFrameDw(cgo.Surface,offX2-1,offY2-1,offX2+1,offY2+1,C4RGB(0,0xca,0));
}
ccx=pCom->Tx._getInt(); ccy=pCom->Ty;
@ -2423,7 +2423,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
if (iMoveTos) { Cmds.AppendChar('|'); Cmds.AppendFormat("%dx MoveTo",iMoveTos); iMoveTos=0; }
// Draw message
int32_t cmwdt,cmhgt; ::GraphicsResource.FontRegular.GetTextExtent(Cmds.getData(),cmwdt,cmhgt,true);
Application.DDraw->TextOut(Cmds.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,offX,offY+Shape.GetY()-10-cmhgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter);
lpDDraw->TextOut(Cmds.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,offX,offY+Shape.GetY()-10-cmhgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter);
}
// Debug Display ///////////////////////////////////////////////////////////////////////////////
@ -2539,13 +2539,13 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
if (::GraphicsSystem.ShowEntrance) if (eDrawMode!=ODM_BaseOnly)
{
if (OCF & OCF_Entrance)
Application.DDraw->DrawFrameDw(cgo.Surface,offX+Def->Entrance.x,
lpDDraw->DrawFrameDw(cgo.Surface,offX+Def->Entrance.x,
offY+Def->Entrance.y,
offX+Def->Entrance.x+Def->Entrance.Wdt-1,
offY+Def->Entrance.y+Def->Entrance.Hgt-1,
C4RGB(0, 0, 0xff));
if (OCF & OCF_Collection)
Application.DDraw->DrawFrameDw(cgo.Surface,offX+Def->Collection.x,
lpDDraw->DrawFrameDw(cgo.Surface,offX+Def->Collection.x,
offY+Def->Collection.y,
offX+Def->Collection.x+Def->Collection.Wdt-1,
offY+Def->Collection.y+Def->Collection.Hgt-1,
@ -2559,7 +2559,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
StdStrBuf str;
str.Format("%s (%d)",pActionDef->GetName(),Action.Phase);
int32_t cmwdt,cmhgt; ::GraphicsResource.FontRegular.GetTextExtent(str.getData(),cmwdt,cmhgt,true);
Application.DDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular,
lpDDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular,
1.0, cgo.Surface, offX, offY + Shape.GetY() - cmhgt,
InLiquid ? 0xfa0000FF : CStdDDraw::DEFAULT_MESSAGE_COLOR, ACenter);
}
@ -2617,7 +2617,7 @@ void C4Object::DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDraw
iTX = BoundBy<int>(offX, cgo.X + iTWdt / 2, cgo.X + cgo.Wdt - iTWdt / 2);
iTY = BoundBy<int>(offY - Def->Shape.Hgt / 2 - 20 - iTHgt, cgo.Y, cgo.Y + cgo.Hgt - iTHgt);
// Draw
Application.DDraw->TextOut(szText, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, iTX, iTY,
lpDDraw->TextOut(szText, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, iTX, iTY,
pOwner->ColorDw|0x7f000000,ACenter);
}
}
@ -4930,17 +4930,17 @@ void C4Object::SetRotation(int32_t nr)
void C4Object::PrepareDrawing()
{
// color modulation
if (ColorMod != 0xffffffff || (BlitMode & (C4GFXBLIT_MOD2 | C4GFXBLIT_CLRSFC_MOD2))) Application.DDraw->ActivateBlitModulation(ColorMod);
if (ColorMod != 0xffffffff || (BlitMode & (C4GFXBLIT_MOD2 | C4GFXBLIT_CLRSFC_MOD2))) lpDDraw->ActivateBlitModulation(ColorMod);
// other blit modes
Application.DDraw->SetBlitMode(BlitMode);
lpDDraw->SetBlitMode(BlitMode);
}
void C4Object::FinishedDrawing()
{
// color modulation
Application.DDraw->DeactivateBlitModulation();
lpDDraw->DeactivateBlitModulation();
// extra blitting flags
Application.DDraw->ResetBlitMode();
lpDDraw->ResetBlitMode();
}
void C4Object::DrawSolidMask(C4TargetFacet &cgo)

View File

@ -376,7 +376,7 @@ void C4ObjectList::DrawIDList(C4Facet &cgo, int iSelection,
// Draw count
sprintf(szCount,"%dx",iCount);
if ((iCount!=1) || fDrawOneCounts)
Application.DDraw->TextOut(szCount, ::GraphicsResource.FontRegular, 1.0, cgo2.Surface,cgo2.X+cgo2.Wdt-1,cgo2.Y+cgo2.Hgt-1-::GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight);
lpDDraw->TextOut(szCount, ::GraphicsResource.FontRegular, 1.0, cgo2.Surface,cgo2.X+cgo2.Wdt-1,cgo2.Y+cgo2.Hgt-1-::GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight);
// Region
if (pRegions) pRegions->Add(cgo2.X,cgo2.Y,cgo2.Wdt,cgo2.Hgt,pFirstObj->GetName(),iRegionCom,pFirstObj,COM_None,COM_None,pFirstObj->Number);
// Next section
@ -397,7 +397,7 @@ void C4ObjectList::DrawIDList(C4Facet &cgo, int iSelection,
// Draw count
sprintf(szCount,"%dx",iCount);
if ((iCount!=1) || fDrawOneCounts)
Application.DDraw->TextOut(szCount,cgo2.Surface,cgo2.X+cgo2.Wdt-1,cgo2.Y+cgo2.Hgt-1-Application.DDraw->TextHeight(),FWhite,ARight);
lpDDraw->TextOut(szCount,cgo2.Surface,cgo2.X+cgo2.Wdt-1,cgo2.Y+cgo2.Hgt-1-lpDDraw->TextHeight(),FWhite,ARight);
// Region
if (pRegions) pRegions->Add(cgo2.X,cgo2.Y,cgo2.Wdt,cgo2.Hgt,pFirstObj->GetName(),iRegionCom,pFirstObj,COM_None,COM_None,pFirstObj->id);
// Next section

View File

@ -172,7 +172,7 @@ void C4GameMessage::Draw(C4TargetFacet &cgo, int32_t iPlayer)
C4Facet facet(cgo.Surface, iDrawX, iDrawY, PortraitWidth, PortraitWidth);
fctPortrait.Draw(facet);
// draw message
Application.DDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX+PortraitWidth+PortraitIndent,iDrawY,ColorDw,ALeft);
lpDDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX+PortraitWidth+PortraitIndent,iDrawY,ColorDw,ALeft);
}
else
{
@ -180,7 +180,7 @@ void C4GameMessage::Draw(C4TargetFacet &cgo, int32_t iPlayer)
iDrawX += cgo.Wdt/2;
iDrawY += 2 * cgo.Hgt / 3 + 50;
if (!(dwFlags & C4GM_Bottom)) iDrawY += DrawMessageOffset;
Application.DDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX,iDrawY,ColorDw,ACenter);
lpDDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX,iDrawY,ColorDw,ACenter);
}
}
// Positioned
@ -223,7 +223,7 @@ void C4GameMessage::Draw(C4TargetFacet &cgo, int32_t iPlayer)
iTX = BoundBy<float>((iMsgX - cgo.X) * newzoom, iTWdt/2, cgo.Wdt * cgo.Zoom - iTWdt / 2) + 0.5f;
iTY = BoundBy<float>((iMsgY - cgo.Y) * newzoom - iTHgt, 0, cgo.Hgt * cgo.Zoom - iTHgt) + 0.5f;
// Draw
Application.DDraw->TextOut(sText.getData(), ::GraphicsResource.FontRegular, 1.0,
lpDDraw->TextOut(sText.getData(), ::GraphicsResource.FontRegular, 1.0,
cgo.Surface,
cgo.X + iTX,
cgo.Y + iTY,

View File

@ -159,13 +159,13 @@ void C4LoaderScreen::Draw(C4Facet &cgo, int iProgress, C4LogBuffer *pLog, int Pr
// Background (loader)
fctBackground.DrawFullScreen(cgo);
// draw scenario title
Application.DDraw->StringOut(Game.ScenarioTitle.getData(), TitleFont, 1.0f, cgo.Surface, cgo.Wdt-iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-iProgressBarHgt-iVMargin-TitleFont.iLineHgt, 0xdddddddd, ARight, false);
lpDDraw->StringOut(Game.ScenarioTitle.getData(), TitleFont, 1.0f, cgo.Surface, cgo.Wdt-iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-iProgressBarHgt-iVMargin-TitleFont.iLineHgt, 0xdddddddd, ARight, false);
// draw info
/*if (szInfo)
Application.DDraw->TextOutDw(szInfo, cgo.Surface, cgo.Wdt/2, cgo.Hgt/2+20);*/
lpDDraw->TextOutDw(szInfo, cgo.Surface, cgo.Wdt/2, cgo.Hgt/2+20);*/
//
// draw progress bar
Application.DDraw->DrawBoxDw(cgo.Surface, iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-iProgressBarHgt, cgo.Wdt-iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin, 0xb0000000);
lpDDraw->DrawBoxDw(cgo.Surface, iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-iProgressBarHgt, cgo.Wdt-iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin, 0xb0000000);
int iProgressBarWdt=cgo.Wdt-iHIndent*2-2;
if (::GraphicsResource.fctProgressBar.Surface)
{
@ -173,15 +173,15 @@ void C4LoaderScreen::Draw(C4Facet &cgo, int iProgress, C4LogBuffer *pLog, int Pr
}
else
{
Application.DDraw->DrawBoxDw(cgo.Surface, iHIndent+1, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-iProgressBarHgt+1, iHIndent+1+iProgressBarWdt*iProgress/100, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-1, 0xb0ff0000);
lpDDraw->DrawBoxDw(cgo.Surface, iHIndent+1, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-iProgressBarHgt+1, iHIndent+1+iProgressBarWdt*iProgress/100, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-1, 0xb0ff0000);
}
Application.DDraw->StringOut(FormatString("%i%%", iProgress).getData(), rProgressBarFont, 1.0f, cgo.Surface,
lpDDraw->StringOut(FormatString("%i%%", iProgress).getData(), rProgressBarFont, 1.0f, cgo.Surface,
cgo.Wdt/2, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-rProgressBarFont.iLineHgt/2-iProgressBarHgt/2, 0xffffffff,
ACenter, true);
// draw log box
if (pLog)
{
Application.DDraw->DrawBoxDw(cgo.Surface, iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt, cgo.Wdt-iHIndent, cgo.Hgt-iVIndent, 0x7f000000);
lpDDraw->DrawBoxDw(cgo.Surface, iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt, cgo.Wdt-iHIndent, cgo.Hgt-iVIndent, 0x7f000000);
int iLineHgt=int(fLogBoxFontZoom*LogFont.iLineHgt); if (!iLineHgt) iLineHgt=5;
int iLinesVisible = (iLogBoxHgt-2*iLogBoxMargin)/iLineHgt;
int iX = iHIndent+iLogBoxMargin;

View File

@ -169,7 +169,7 @@ void C4MenuItem::DrawElement(C4TargetFacet &cgo)
// Select mark
if (iStyle!=C4MN_Style_Info)
if (fSelected && TextDisplayProgress)
Application.DDraw->DrawBoxDw(cgo.Surface, cgoOut.X, cgoOut.Y, cgoOut.X + cgoOut.Wdt - 1, cgoOut.Y + cgoOut.Hgt - 1, C4RGB(0xca, 0, 0));
lpDDraw->DrawBoxDw(cgo.Surface, cgoOut.X, cgoOut.Y, cgoOut.X + cgoOut.Wdt - 1, cgoOut.Y + cgoOut.Hgt - 1, C4RGB(0xca, 0, 0));
// Symbol/text areas
C4Facet cgoItemSymbol,cgoItemText;
cgoItemSymbol=cgoItemText=cgoOut;
@ -183,17 +183,17 @@ void C4MenuItem::DrawElement(C4TargetFacet &cgo)
// Draw if there is no text progression at all (TextDisplayProgress==-1, or if it's progressed far enough already (TextDisplayProgress>0)
if (Symbol.Surface && TextDisplayProgress) Symbol.DrawClr(cgoItemSymbol, true, dwSymbolClr);
// Draw item text
Application.DDraw->StorePrimaryClipper(); Application.DDraw->SubPrimaryClipper(cgoItemText.X, cgoItemText.Y, cgoItemText.X+cgoItemText.Wdt-1, cgoItemText.Y+cgoItemText.Hgt-1);
lpDDraw->StorePrimaryClipper(); lpDDraw->SubPrimaryClipper(cgoItemText.X, cgoItemText.Y, cgoItemText.X+cgoItemText.Wdt-1, cgoItemText.Y+cgoItemText.Hgt-1);
switch (iStyle)
{
case C4MN_Style_Context:
Application.DDraw->TextOut(Caption,::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y,CStdDDraw::DEFAULT_MESSAGE_COLOR,ALeft);
lpDDraw->TextOut(Caption,::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y,CStdDDraw::DEFAULT_MESSAGE_COLOR,ALeft);
break;
case C4MN_Style_Info:
{
StdStrBuf sText;
::GraphicsResource.FontRegular.BreakMessage(InfoCaption, cgoItemText.Wdt, &sText, true);
Application.DDraw->TextOut(sText.getData(), ::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y);
lpDDraw->TextOut(sText.getData(), ::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y);
break;
}
case C4MN_Style_Dialog:
@ -209,19 +209,19 @@ void C4MenuItem::DrawElement(C4TargetFacet &cgo)
// display broken text
StdStrBuf sText;
::GraphicsResource.FontRegular.BreakMessage(Caption, cgoItemText.Wdt, &sText, true);
Application.DDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y);
lpDDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y);
// restore complete text
if (cXChg) Caption[iStopPos] = cXChg;
break;
}
}
Application.DDraw->RestorePrimaryClipper();
lpDDraw->RestorePrimaryClipper();
// Draw count
if (Count!=C4MN_Item_NoCount)
{
char szCount[10+1];
sprintf(szCount,"%ix",Count);
Application.DDraw->TextOut(szCount,::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X+cgoItemText.Wdt-1,cgoItemText.Y+cgoItemText.Hgt-1-::GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight);
lpDDraw->TextOut(szCount,::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X+cgoItemText.Wdt-1,cgoItemText.Y+cgoItemText.Hgt-1-::GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight);
}
}
@ -869,8 +869,8 @@ void C4Menu::DrawElement(C4TargetFacet &cgo)
// Store and clear global clipper
// int32_t iX1,iY1,iX2,iY2;
// Application.DDraw->GetPrimaryClipper(iX1,iY1,iX2,iY2);
// Application.DDraw->SubPrimaryClipper(rcBounds.x, rcBounds.y, rcBounds.x+rcBounds.Wdt-1, rcBounds.y+rcBounds.Hgt-1);
// lpDDraw->GetPrimaryClipper(iX1,iY1,iX2,iY2);
// lpDDraw->SubPrimaryClipper(rcBounds.x, rcBounds.y, rcBounds.x+rcBounds.Wdt-1, rcBounds.y+rcBounds.Hgt-1);
C4Facet cgoExtra(cgo.Surface, cgo.TargetX+rcBounds.x+1, cgo.TargetY+rcBounds.y+rcBounds.Hgt-C4MN_SymbolSize-1, rcBounds.Wdt-2, C4MN_SymbolSize);
@ -929,7 +929,7 @@ void C4Menu::DrawElement(C4TargetFacet &cgo)
}
// Restore global clipper
//Application.DDraw->SetPrimaryClipper(iX1,iY1,iX2,iY2);
//lpDDraw->SetPrimaryClipper(iX1,iY1,iX2,iY2);
}
void C4Menu::DrawFrame(SURFACE sfcSurface, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt)

View File

@ -155,7 +155,7 @@ void C4MessageBoard::Draw(C4Facet &cgo)
::GraphicsSystem.pLoaderScreen->Draw(cgo, Game.InitProgress, &LogBuffer);
else
// loader not yet loaded: black BG
Application.DDraw->DrawBoxDw(cgo.Surface, 0,0, cgo.Wdt, cgo.Hgt, 0x00000000);
lpDDraw->DrawBoxDw(cgo.Surface, 0,0, cgo.Wdt, cgo.Hgt, 0x00000000);
return;
}
@ -199,7 +199,7 @@ void C4MessageBoard::Draw(C4Facet &cgo)
// dwFade = 0xff000000;
dwColor |= dwFade;
// Draw
Application.DDraw->StringOut(Message,::GraphicsResource.FontRegular,1.0,cgo.Surface,cgo.X,iMsgY,dwColor);
lpDDraw->StringOut(Message,::GraphicsResource.FontRegular,1.0,cgo.Surface,cgo.X,iMsgY,dwColor);
}
}

View File

@ -492,7 +492,7 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
//------------------------------------------------------------------------------------------
case C4MC_Drag_Selecting:
// Draw frame
Application.DDraw->DrawFrameDw(cgo.Surface,
lpDDraw->DrawFrameDw(cgo.Surface,
int32_t(cgo.X + GuiX),
int32_t(cgo.Y + GuiY),
int32_t(cgo.X + (DownX - cgo.TargetX) * GameZoom.Zoom / GuiZoom.Zoom),
@ -516,7 +516,7 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
// Otherwise red mouse control style
int32_t iWdt,iHgt;
::GraphicsResource.FontRegular.GetTextExtent(Caption.getData(), iWdt, iHgt, true);
Application.DDraw->TextOut(Caption.getData(), ::GraphicsResource.FontRegular, 1.0,
lpDDraw->TextOut(Caption.getData(), ::GraphicsResource.FontRegular, 1.0,
cgo.Surface,
float(cgo.X)+BoundBy<float>(GuiX,float(iWdt)/2+1,float(cgo.Wdt)-iWdt/2-1),
float(cgo.Y)+Min<float>( CaptionBottomY ? float(CaptionBottomY-iHgt-1) : GuiY+13, float(cgo.Hgt-iHgt)),

View File

@ -304,7 +304,7 @@ void C4PlayerInfoListBox::PlayerListItem::UpdateIcon(C4PlayerInfo *pInfo, C4Play
fctDraw.X = 2;
// shadow
DWORD dwPrevMod; bool fPrevMod = lpDDraw->GetBlitModulation(dwPrevMod);
Application.DDraw->ActivateBlitModulation(1);
lpDDraw->ActivateBlitModulation(1);
::GraphicsResource.fctCrewClr.DrawClr(fctDraw, true, dwJoinedInfoClr);
if (fPrevMod) lpDDraw->ActivateBlitModulation(dwPrevMod); else lpDDraw->DeactivateBlitModulation();
fctDraw.X = 0;

View File

@ -56,7 +56,7 @@ void C4UpperBoard::Draw(C4Facet &cgo)
{
if (!cgo.Surface) return;
// Background
Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctUpperBoard.Surface,Output.Surface,0,0,Output.Wdt,Output.Hgt);
lpDDraw->BlitSurfaceTile(::GraphicsResource.fctUpperBoard.Surface,Output.Surface,0,0,Output.Wdt,Output.Hgt);
// Logo
C4Facet cgo2;
float fLogoZoom = 1.0f;
@ -66,18 +66,18 @@ void C4UpperBoard::Draw(C4Facet &cgo)
// Right text sections
int32_t iRightOff = 1;
// Playing time
Application.DDraw->TextOut(cTimeString, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 10, TextYPosition, 0xFFFFFFFF);
lpDDraw->TextOut(cTimeString, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 10, TextYPosition, 0xFFFFFFFF);
// Clock
if (Config.Graphics.ShowClock)
Application.DDraw->TextOut(cTimeString2, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF);
lpDDraw->TextOut(cTimeString2, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF);
// FPS
if (Config.General.FPS)
{
sprintf(cTimeString, "%d FPS", Game.FPS);
Application.DDraw->TextOut(cTimeString, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF);
lpDDraw->TextOut(cTimeString, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF);
}
// Scenario title
Application.DDraw->TextOut(Game.ScenarioTitle.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface, 10, cgo.Hgt / 2 - ::GraphicsResource.FontRegular.GetLineHeight() / 2, 0xFFFFFFFF);
lpDDraw->TextOut(Game.ScenarioTitle.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface, 10, cgo.Hgt / 2 - ::GraphicsResource.FontRegular.GetLineHeight() / 2, 0xFFFFFFFF);
}
void C4UpperBoard::Init(C4Facet &cgo)

View File

@ -916,7 +916,7 @@ void C4Viewport::DrawMenu(C4TargetFacet &cgo)
// Player eliminated
if (pPlr && pPlr->Eliminated)
{
Application.DDraw->TextOut(FormatString(LoadResStr(pPlr->Surrendered ? "IDS_PLR_SURRENDERED" : "IDS_PLR_ELIMINATED"),pPlr->GetName()).getData(),
lpDDraw->TextOut(FormatString(LoadResStr(pPlr->Surrendered ? "IDS_PLR_SURRENDERED" : "IDS_PLR_ELIMINATED"),pPlr->GetName()).getData(),
::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X+cgo.Wdt/2,cgo.Y+2*cgo.Hgt/3,0xfaFF0000,ACenter);
return;
}
@ -981,10 +981,10 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
if (fDrawOverlay)
{
// Draw landscape borders. Only if overlay, so complete map screenshots don't get messed up
if (BorderLeft) Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX,DrawY,BorderLeft,ViewHgt,-DrawX,-DrawY);
if (BorderTop) Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+BorderLeft,DrawY,ViewWdt-BorderLeft-BorderRight,BorderTop,-DrawX-BorderLeft,-DrawY);
if (BorderRight) Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+ViewWdt-BorderRight,DrawY,BorderRight,ViewHgt,-DrawX-ViewWdt+BorderRight,-DrawY);
if (BorderBottom)Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+BorderLeft,DrawY+ViewHgt-BorderBottom,ViewWdt-BorderLeft-BorderRight,BorderBottom,-DrawX-BorderLeft,-DrawY-ViewHgt+BorderBottom);
if (BorderLeft) lpDDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX,DrawY,BorderLeft,ViewHgt,-DrawX,-DrawY);
if (BorderTop) lpDDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+BorderLeft,DrawY,ViewWdt-BorderLeft-BorderRight,BorderTop,-DrawX-BorderLeft,-DrawY);
if (BorderRight) lpDDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+ViewWdt-BorderRight,DrawY,BorderRight,ViewHgt,-DrawX-ViewWdt+BorderRight,-DrawY);
if (BorderBottom)lpDDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+BorderLeft,DrawY+ViewHgt-BorderBottom,ViewWdt-BorderLeft-BorderRight,BorderBottom,-DrawX-BorderLeft,-DrawY-ViewHgt+BorderBottom);
// Set clippers
cgo.X += BorderLeft; cgo.Y += BorderTop; cgo.Wdt -= int(float(BorderLeft+BorderRight)/cgo.Zoom); cgo.Hgt -= int(float(BorderTop+BorderBottom)/cgo.Zoom);
@ -992,7 +992,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
cgo.TargetX += BorderLeft/Zoom; cgo.TargetY += BorderTop/Zoom;
// Apply Zoom
lpDDraw->SetZoom(GameZoom);
Application.DDraw->SetPrimaryClipper(cgo.X,cgo.Y,DrawX+ViewWdt-1-BorderRight,DrawY+ViewHgt-1-BorderBottom);
lpDDraw->SetPrimaryClipper(cgo.X,cgo.Y,DrawX+ViewWdt-1-BorderRight,DrawY+ViewHgt-1-BorderBottom);
}
last_game_draw_cgo = cgo;
@ -1048,7 +1048,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
float fGUIZoom = C4GUI::GetZoom();
// now restore complete cgo range for overlay drawing
lpDDraw->SetZoom(DrawX,DrawY, fGUIZoom);
Application.DDraw->SetPrimaryClipper(DrawX,DrawY,DrawX+(ViewWdt-1),DrawY+(ViewHgt-1));
lpDDraw->SetPrimaryClipper(DrawX,DrawY,DrawX+(ViewWdt-1),DrawY+(ViewHgt-1));
C4TargetFacet gui_cgo;
gui_cgo.Set(cgo0);
@ -1081,7 +1081,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
// Remove zoom n clippers
lpDDraw->SetZoom(0, 0, 1.0);
Application.DDraw->NoPrimaryClipper();
lpDDraw->NoPrimaryClipper();
}
}
@ -1420,7 +1420,7 @@ void C4Viewport::DrawPlayerStartup(C4TargetFacet &cgo)
}
// Name
Application.DDraw->TextOut(pPlr->GetName(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,
lpDDraw->TextOut(pPlr->GetName(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,
cgo.X+cgo.Wdt/2,cgo.Y+cgo.Hgt*2/3+iNameHgtOff + DrawMessageOffset,
pPlr->ColorDw | 0xff000000, ACenter);
}

View File

@ -1023,7 +1023,7 @@ void C4Network2::DrawStatus(C4TargetFacet &cgo)
Stat.Append("| - none -");
// draw
Application.DDraw->TextOut(Stat.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X + 20,cgo.Y + 50);
lpDDraw->TextOut(Stat.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X + 20,cgo.Y + 50);
}
bool C4Network2::InitNetIO(bool fNoClientID, bool fHost)

View File

@ -196,14 +196,14 @@ void C4Video::Draw(C4TargetFacet &cgo)
// No show
if (!ShowFlash) return;
// Draw frame
Application.DDraw->DrawFrameDw(cgo.Surface, X+cgo.X,Y+cgo.Y,
lpDDraw->DrawFrameDw(cgo.Surface, X+cgo.X,Y+cgo.Y,
X+cgo.X+Width-1,Y+cgo.Y+Height-1,
Recording ? C4RGB(0xca, 0, 0) : C4RGB(0xff, 0xff, 0xff));
// Draw status
StdStrBuf str;
if (Recording) str.Format("%dx%d Frame %d",Width,Height,AviFrame);
else str.Format("%dx%d",Width,Height);
Application.DDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular, 1.0,cgo.Surface,cgo.X+X+4,cgo.Y+Y+3,Recording ? 0xfaFF0000 : 0xfaFFFFFF);
lpDDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular, 1.0,cgo.Surface,cgo.X+X+4,cgo.Y+Y+3,Recording ? 0xfaFF0000 : 0xfaFFFFFF);
}
bool C4Video::AdjustPosition()

View File

@ -1208,7 +1208,7 @@ void CStdDDraw::RemoveZoom(float & X, float & Y)
Y = (Y - ZoomY) / Zoom + ZoomY;
}
CStdDDraw *DDrawInit(CStdApp * pApp, bool Editor, bool fUsePageLock, unsigned int iXRes, unsigned int iYRes, int iBitDepth, int Engine, unsigned int iMonitor)
bool DDrawInit(CStdApp * pApp, bool Editor, bool fUsePageLock, unsigned int iXRes, unsigned int iYRes, int iBitDepth, int Engine, unsigned int iMonitor)
{
// create engine
switch (iGfxEngine = Engine)
@ -1223,15 +1223,15 @@ CStdDDraw *DDrawInit(CStdApp * pApp, bool Editor, bool fUsePageLock, unsigned in
#endif
case GFXENGN_NOGFX: lpDDraw = new CStdNoGfx(); break;
}
if (!lpDDraw) return NULL;
if (!lpDDraw) return false;
// init it
if (!lpDDraw->Init(pApp, Editor, fUsePageLock, iXRes, iYRes, iBitDepth, iMonitor))
{
delete lpDDraw;
return NULL;
return false;
}
// done, success
return lpDDraw;
return true;
}
bool CStdDDraw::Init(CStdApp * pApp, bool Editor, bool fUsePageLock, unsigned int iXRes, unsigned int iYRes, int iBitDepth, unsigned int iMonitor)

View File

@ -355,5 +355,5 @@ bool UnLockSurfaceGlobal(SURFACE sfcTarget);
bool DLineSPix(int32_t x, int32_t y, int32_t col);
bool DLineSPixDw(int32_t x, int32_t y, int32_t dwClr);
CStdDDraw *DDrawInit(CStdApp * pApp, bool Editor, bool fUsePageLock, unsigned int iXRes, unsigned int iYRes, int iBitDepth, int Engine, unsigned int iMonitor);
bool DDrawInit(CStdApp * pApp, bool Editor, bool fUsePageLock, unsigned int iXRes, unsigned int iYRes, int iBitDepth, int Engine, unsigned int iMonitor);
#endif // INC_STDDDRAW2