Rename lpDDraw to pDraw

Günther Brammer 2011-10-03 16:30:18 +02:00
parent ad89e12a2c
commit 2b6f4432de
61 changed files with 457 additions and 459 deletions

View File

@ -556,7 +556,7 @@ void C4Application::Clear()
SoundSystem.Clear(); SoundSystem.Clear();
RestoreVideoMode(); RestoreVideoMode();
// Clear direct draw (late, because it's needed for e.g. Log) // Clear direct draw (late, because it's needed for e.g. Log)
if (lpDDraw) { delete lpDDraw; lpDDraw=NULL; } if (pDraw) { delete pDraw; pDraw=NULL; }
// Close window // Close window
FullScreen.Clear(); FullScreen.Clear();
Console.Clear(); Console.Clear();
@ -688,10 +688,10 @@ void C4Application::SetGameTickDelay(int iDelay)
void C4Application::OnResolutionChanged(unsigned int iXRes, unsigned int iYRes) void C4Application::OnResolutionChanged(unsigned int iXRes, unsigned int iYRes)
{ {
// notify game // notify game
if (lpDDraw) if (pDraw)
{ {
Game.OnResolutionChanged(iXRes, iYRes); Game.OnResolutionChanged(iXRes, iYRes);
lpDDraw->OnResolutionChanged(iXRes, iYRes); pDraw->OnResolutionChanged(iXRes, iYRes);
} }
if (pWindow && pWindow->pSurface) if (pWindow && pWindow->pSurface)
pWindow->pSurface->UpdateSize(iXRes, iYRes); pWindow->pSurface->UpdateSize(iXRes, iYRes);

View File

@ -56,12 +56,12 @@ LRESULT APIENTRY FullScreenWinProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
// fall through to next case // fall through to next case
case WM_ACTIVATEAPP: case WM_ACTIVATEAPP:
Application.Active = wParam != 0; Application.Active = wParam != 0;
if (lpDDraw) if (pDraw)
{ {
if (Application.Active) if (Application.Active)
lpDDraw->TaskIn(); pDraw->TaskIn();
else else
lpDDraw->TaskOut(); pDraw->TaskOut();
} }
// redraw background // redraw background
::GraphicsSystem.InvalidateBg(); ::GraphicsSystem.InvalidateBg();
@ -253,11 +253,11 @@ void C4FullScreen::HandleMessage (XEvent &e)
break; break;
case FocusIn: case FocusIn:
Application.Active = true; Application.Active = true;
if (lpDDraw) lpDDraw->TaskIn(); if (pDraw) pDraw->TaskIn();
break; break;
case FocusOut: case UnmapNotify: case FocusOut: case UnmapNotify:
Application.Active = false; Application.Active = false;
if (lpDDraw) lpDDraw->TaskOut(); if (pDraw) pDraw->TaskOut();
break; break;
} }
} }
@ -351,8 +351,8 @@ void C4FullScreen::HandleMessage (SDL_Event &e)
{ {
Config.Graphics.Windowed = !Config.Graphics.Windowed; Config.Graphics.Windowed = !Config.Graphics.Windowed;
Application.SetVideoMode(Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.BitDepth, Config.Graphics.RefreshRate, Config.Graphics.Monitor, !Config.Graphics.Windowed); Application.SetVideoMode(Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.BitDepth, Config.Graphics.RefreshRate, Config.Graphics.Monitor, !Config.Graphics.Windowed);
lpDDraw->InvalidateDeviceObjects(); pDraw->InvalidateDeviceObjects();
lpDDraw->RestoreDeviceObjects(); pDraw->RestoreDeviceObjects();
break; break;
} }

View File

@ -308,7 +308,7 @@ bool C4Game::PreInit()
// Timer flags // Timer flags
GameGo=false; GameGo=false;
// set gamma // set gamma
lpDDraw->SetGamma(Config.Graphics.Gamma1, Config.Graphics.Gamma2, Config.Graphics.Gamma3, C4GRI_USER); pDraw->SetGamma(Config.Graphics.Gamma1, Config.Graphics.Gamma2, Config.Graphics.Gamma3, C4GRI_USER);
// init message input (default commands) // init message input (default commands)
MessageInput.Init(); MessageInput.Init();
Game.SetInitProgress(31.0f); Game.SetInitProgress(31.0f);
@ -488,7 +488,7 @@ bool C4Game::Init()
SetInitProgress(99); SetInitProgress(99);
// Gamma // Gamma
lpDDraw->ApplyGamma(); pDraw->ApplyGamma();
// Message board and upper board // Message board and upper board
if (!Application.isEditor) if (!Application.isEditor)
@ -1559,7 +1559,7 @@ void C4Game::DrawCursors(C4TargetFacet &cgo, int32_t iPlayer)
} }
else str = cursor->GetName(); else str = cursor->GetName();
lpDDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface, pDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,
cgo.X + cox + fctCursor.Wdt / 2, cgo.X + cox + fctCursor.Wdt / 2,
cgo.Y + coy - 2 - texthgt, cgo.Y + coy - 2 - texthgt,
0xffff0000, ACenter); 0xffff0000, ACenter);
@ -1720,7 +1720,7 @@ bool C4Game::SaveGameTitle(C4Group &hGroup)
if (!(sfcPic = new C4Surface(iSfcWdt,iSfcHgt))) return false; if (!(sfcPic = new C4Surface(iSfcWdt,iSfcHgt))) return false;
// Fullscreen // Fullscreen
lpDDraw->Blit(FullScreen.pSurface, pDraw->Blit(FullScreen.pSurface,
0.0f,0.0f,float(C4GUI::GetScreenWdt()),float(C4GUI::GetScreenHgt()-::GraphicsResource.FontRegular.iLineHgt), 0.0f,0.0f,float(C4GUI::GetScreenWdt()),float(C4GUI::GetScreenHgt()-::GraphicsResource.FontRegular.iLineHgt),
sfcPic,0,0,iSfcWdt,iSfcHgt); sfcPic,0,0,iSfcWdt,iSfcHgt);

View File

@ -87,8 +87,8 @@ void C4GraphicsSystem::Clear()
bool C4GraphicsSystem::StartDrawing() bool C4GraphicsSystem::StartDrawing()
{ {
// only if ddraw is ready // only if ddraw is ready
if (!lpDDraw) return false; if (!pDraw) return false;
if (!lpDDraw->Active) return false; if (!pDraw->Active) return false;
// only if application is active or windowed (if config allows) // only if application is active or windowed (if config allows)
if (!Application.Active && (!Application.isEditor || !Config.Graphics.RenderInactiveEM)) return false; if (!Application.Active && (!Application.isEditor || !Config.Graphics.RenderInactiveEM)) return false;
@ -165,7 +165,7 @@ void C4GraphicsSystem::Execute()
} }
// gamma update // gamma update
lpDDraw->ApplyGamma(); pDraw->ApplyGamma();
// Video record & status (fullsrceen) // Video record & status (fullsrceen)
if (!Application.isEditor) if (!Application.isEditor)
@ -196,7 +196,7 @@ void C4GraphicsSystem::Default()
void C4GraphicsSystem::ClearFullscreenBackground() void C4GraphicsSystem::ClearFullscreenBackground()
{ {
lpDDraw->FillBG(0); pDraw->FillBG(0);
--iRedrawBackground; --iRedrawBackground;
} }
@ -209,7 +209,7 @@ bool C4GraphicsSystem::InitLoaderScreen(const char *szLoaderSpec, bool fDrawBlac
if (pLoaderScreen) delete pLoaderScreen; if (pLoaderScreen) delete pLoaderScreen;
pLoaderScreen = pNewLoader; pLoaderScreen = pNewLoader;
// apply user gamma for loader // apply user gamma for loader
lpDDraw->ApplyGamma(); pDraw->ApplyGamma();
// done, success // done, success
return true; return true;
} }
@ -285,7 +285,7 @@ bool C4GraphicsSystem::DoSaveScreenshot(bool fSaveAll, const char *szFilename)
// transfer each pixel - slooow... // transfer each pixel - slooow...
for (int32_t iY2=0; iY2<bkHgt2; ++iY2) for (int32_t iY2=0; iY2<bkHgt2; ++iY2)
for (int32_t iX2=0; iX2<bkWdt2; ++iX2) for (int32_t iX2=0; iX2<bkWdt2; ++iX2)
png.SetPix(iX+iX2, iY+iY2, lpDDraw->ApplyGammaTo(FullScreen.pSurface->GetPixDw(iX2, iY2, false))); png.SetPix(iX+iX2, iY+iY2, pDraw->ApplyGammaTo(FullScreen.pSurface->GetPixDw(iX2, iY2, false)));
// done; unlock // done; unlock
FullScreen.pSurface->Unlock(); FullScreen.pSurface->Unlock();
} }
@ -317,7 +317,7 @@ void C4GraphicsSystem::DrawHoldMessages()
{ {
if (!Application.isEditor && Game.HaltCount) if (!Application.isEditor && Game.HaltCount)
{ {
lpDDraw->TextOut("Pause", ::GraphicsResource.FontRegular,1.0, pDraw->TextOut("Pause", ::GraphicsResource.FontRegular,1.0,
FullScreen.pSurface, C4GUI::GetScreenWdt()/2, FullScreen.pSurface, C4GUI::GetScreenWdt()/2,
C4GUI::GetScreenHgt()/2 - ::GraphicsResource.FontRegular.iLineHgt*2, C4GUI::GetScreenHgt()/2 - ::GraphicsResource.FontRegular.iLineHgt*2,
CStdDDraw::DEFAULT_MESSAGE_COLOR, ACenter); CStdDDraw::DEFAULT_MESSAGE_COLOR, ACenter);
@ -355,7 +355,7 @@ void C4GraphicsSystem::DrawFlashMessage()
{ {
if (!FlashMessageTime) return; if (!FlashMessageTime) return;
if (Application.isEditor) return; if (Application.isEditor) return;
lpDDraw->TextOut(FlashMessageText, ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface, pDraw->TextOut(FlashMessageText, ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface,
(FlashMessageX==-1) ? C4GUI::GetScreenWdt()/2 : FlashMessageX, (FlashMessageX==-1) ? C4GUI::GetScreenWdt()/2 : FlashMessageX,
(FlashMessageY==-1) ? C4GUI::GetScreenHgt()/2 : FlashMessageY, (FlashMessageY==-1) ? C4GUI::GetScreenHgt()/2 : FlashMessageY,
CStdDDraw::DEFAULT_MESSAGE_COLOR, CStdDDraw::DEFAULT_MESSAGE_COLOR,
@ -391,7 +391,7 @@ void C4GraphicsSystem::DrawHelp()
strText.AppendFormat("\n<c ffff00>%s</c> - %s\n", GetKeyboardInputName("Screenshot").getData(), LoadResStr("IDS_CTL_SCREENSHOT")); 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")); strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("ScreenshotEx").getData(), LoadResStr("IDS_CTL_SCREENSHOTEX"));
lpDDraw->TextOut(strText.getData(), ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface, pDraw->TextOut(strText.getData(), ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface,
iX + 128, iY + 64, CStdDDraw::DEFAULT_MESSAGE_COLOR, ALeft); iX + 128, iY + 64, CStdDDraw::DEFAULT_MESSAGE_COLOR, ALeft);
// right coloumn // right coloumn
@ -405,7 +405,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("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("DbgShowActionToggle").getData(), "Actions/Commands/Pathfinder");
strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("DbgShowSolidMaskToggle").getData(), "SolidMasks"); strText.AppendFormat("<c ffff00>%s</c> - %s\n", GetKeyboardInputName("DbgShowSolidMaskToggle").getData(), "SolidMasks");
lpDDraw->TextOut(strText.getData(), ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface, pDraw->TextOut(strText.getData(), ::GraphicsResource.FontRegular, 1.0, FullScreen.pSurface,
iX + iWdt/2 + 64, iY + 64, CStdDDraw::DEFAULT_MESSAGE_COLOR, ALeft); iX + iWdt/2 + 64, iY + 64, CStdDDraw::DEFAULT_MESSAGE_COLOR, ALeft);
} }

View File

@ -1333,7 +1333,7 @@ void C4ToolsDlg::State::UpdatePreview()
#else #else
if (GTK_WIDGET_SENSITIVE(preview)) if (GTK_WIDGET_SENSITIVE(preview))
#endif #endif
lpDDraw->DrawPatternedCircle( sfcPreview, pDraw->DrawPatternedCircle( sfcPreview,
iPrvWdt/2,iPrvHgt/2, iPrvWdt/2,iPrvHgt/2,
dlg->Grade, dlg->Grade,
bCol, Pattern, *::Landscape.GetPal()); bCol, Pattern, *::Landscape.GetPal());

View File

@ -972,8 +972,8 @@ bool C4ConsoleGUI::ToolsDlgOpen(C4ToolsDlg *dlg)
dlg->state->LoadBitmaps(Application.GetInstance()); dlg->state->LoadBitmaps(Application.GetInstance());
// create target ctx for OpenGL rendering // create target ctx for OpenGL rendering
#ifdef USE_GL #ifdef USE_GL
if (lpDDraw && !dlg->state->pGLCtx) if (pDraw && !dlg->state->pGLCtx)
dlg->state->pGLCtx = lpDDraw->CreateContext(GetDlgItem(dlg->state->hDialog,IDC_PREVIEW), &Application); dlg->state->pGLCtx = pDraw->CreateContext(GetDlgItem(dlg->state->hDialog,IDC_PREVIEW), &Application);
#endif #endif
// Show window // Show window
RestoreWindowPosition(dlg->state->hDialog, "Property", Config.GetSubkeyPath("Console")); RestoreWindowPosition(dlg->state->hDialog, "Property", Config.GetSubkeyPath("Console"));
@ -1066,7 +1066,7 @@ void C4ToolsDlg::NeedPreviewUpdate()
if (!(sfcPreview=new C4Surface(iPrvWdt,iPrvHgt))) return; if (!(sfcPreview=new C4Surface(iPrvWdt,iPrvHgt))) return;
// fill bg // fill bg
lpDDraw->DrawBoxDw(sfcPreview,0,0,iPrvWdt-1,iPrvHgt-1,C4RGB(0x80,0x80,0x80)); pDraw->DrawBoxDw(sfcPreview,0,0,iPrvWdt-1,iPrvHgt-1,C4RGB(0x80,0x80,0x80));
BYTE bCol = 0; BYTE bCol = 0;
C4Pattern Pattern; C4Pattern Pattern;
// Sky material: sky as pattern only // Sky material: sky as pattern only
@ -1093,7 +1093,7 @@ void C4ToolsDlg::NeedPreviewUpdate()
} }
} }
if (IsWindowEnabled(GetDlgItem(state->hDialog,IDC_PREVIEW))) if (IsWindowEnabled(GetDlgItem(state->hDialog,IDC_PREVIEW)))
lpDDraw->DrawPatternedCircle( sfcPreview, pDraw->DrawPatternedCircle( sfcPreview,
iPrvWdt/2,iPrvHgt/2, iPrvWdt/2,iPrvHgt/2,
Grade, Grade,
bCol, Pattern, *::Landscape.GetPal()); bCol, Pattern, *::Landscape.GetPal());

View File

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

View File

@ -273,16 +273,16 @@ void C4Landscape::ScanSideOpen()
void C4Landscape::Draw(C4TargetFacet &cgo, int32_t iPlayer) void C4Landscape::Draw(C4TargetFacet &cgo, int32_t iPlayer)
{ {
if (Modulation) lpDDraw->ActivateBlitModulation(Modulation); if (Modulation) pDraw->ActivateBlitModulation(Modulation);
// blit landscape // blit landscape
if (::GraphicsSystem.ShowSolidMask) if (::GraphicsSystem.ShowSolidMask)
lpDDraw->Blit8Fast(Surface8, cgo.TargetX, cgo.TargetY, cgo.Surface, cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt); pDraw->Blit8Fast(Surface8, cgo.TargetX, cgo.TargetY, cgo.Surface, cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt);
else if(pLandscapeRender) else if(pLandscapeRender)
{ {
DoRelights(); DoRelights();
pLandscapeRender->Draw(cgo); pLandscapeRender->Draw(cgo);
} }
if (Modulation) lpDDraw->DeactivateBlitModulation(); if (Modulation) pDraw->DeactivateBlitModulation();
} }
bool C4Landscape::DoRelights() bool C4Landscape::DoRelights()
@ -1845,7 +1845,7 @@ bool C4Landscape::MapToSurface(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY,
// assign clipper // assign clipper
Surface8->Clip(iToX,iToY,iToX+iToWdt-1,iToY+iToHgt-1); Surface8->Clip(iToX,iToY,iToX+iToWdt-1,iToY+iToHgt-1);
lpDDraw->NoPrimaryClipper(); pDraw->NoPrimaryClipper();
// Enlarge map segment for chunky rim // Enlarge map segment for chunky rim
iMapX-=2+MaterialMap.max_shape_width/MapZoom; iMapX-=2+MaterialMap.max_shape_width/MapZoom;
@ -2866,7 +2866,7 @@ bool C4Landscape::DrawChunks(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, i
// assign clipper // assign clipper
Surface8->Clip(BoundingBox.x,BoundingBox.y,BoundingBox.x+BoundingBox.Wdt,BoundingBox.y+BoundingBox.Hgt); Surface8->Clip(BoundingBox.x,BoundingBox.y,BoundingBox.x+BoundingBox.Wdt,BoundingBox.y+BoundingBox.Hgt);
lpDDraw->NoPrimaryClipper(); pDraw->NoPrimaryClipper();
// draw all chunks // draw all chunks
int32_t x, y; int32_t x, y;

View File

@ -22,7 +22,7 @@ bool C4LandscapeRenderClassic::Init(int32_t iWidth, int32_t iHeight, C4TextureMa
// Create surface // Create surface
Surface32 = new C4Surface(); Surface32 = new C4Surface();
// without shaders, the FoW is only as detailed as the landscape has tiles. // without shaders, the FoW is only as detailed as the landscape has tiles.
if(!Surface32->Create(iWidth, iHeight,false,false,lpDDraw->IsShaderific() ? 0 : 64)) if(!Surface32->Create(iWidth, iHeight,false,false,pDraw->IsShaderific() ? 0 : 64))
return false; return false;
// Safe back info // Safe back info
this->iWidth = iWidth; this->iWidth = iWidth;
@ -116,6 +116,6 @@ void C4LandscapeRenderClassic::Update(C4Rect To, C4Landscape *pSource)
void C4LandscapeRenderClassic::Draw(const C4TargetFacet &cgo) void C4LandscapeRenderClassic::Draw(const C4TargetFacet &cgo)
{ {
lpDDraw->BlitLandscape(Surface32, cgo.TargetX, cgo.TargetY, cgo.Surface, pDraw->BlitLandscape(Surface32, cgo.TargetX, cgo.TargetY, cgo.Surface,
cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt, 0); cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt, 0);
} }

View File

@ -273,14 +273,14 @@ void C4PXSSystem::Draw(C4TargetFacet &cgo)
// lines for stuff that goes whooosh! // lines for stuff that goes whooosh!
int len = fixtoi(Abs(pxp->xdir) + Abs(pxp->ydir)); int len = fixtoi(Abs(pxp->xdir) + Abs(pxp->ydir));
dwMatClr = uint32_t(Max<int>(dwMatClr >> 24, 195 - (195 - (dwMatClr >> 24)) / len)) << 24 | (dwMatClr & 0xffffff); dwMatClr = uint32_t(Max<int>(dwMatClr >> 24, 195 - (195 - (dwMatClr >> 24)) / len)) << 24 | (dwMatClr & 0xffffff);
lpDDraw->DrawLineDw(cgo.Surface, pDraw->DrawLineDw(cgo.Surface,
fixtof(pxp->x - pxp->xdir) + cgox, fixtof(pxp->y - pxp->ydir) + cgoy, fixtof(pxp->x - pxp->xdir) + cgox, fixtof(pxp->y - pxp->ydir) + cgoy,
fixtof(pxp->x) + cgox, fixtof(pxp->y) + cgoy, fixtof(pxp->x) + cgox, fixtof(pxp->y) + cgoy,
dwMatClr); dwMatClr);
} }
else else
// single pixels for slow stuff // single pixels for slow stuff
lpDDraw->DrawPix(cgo.Surface, fixtof(pxp->x) + cgox, fixtof(pxp->y) + cgoy, dwMatClr); pDraw->DrawPix(cgo.Surface, fixtof(pxp->x) + cgox, fixtof(pxp->y) + cgoy, dwMatClr);
} }
} }

View File

@ -646,18 +646,18 @@ void fxSmokeDraw(C4Particle *particle, C4TargetFacet &cgo, C4Object *target)
int32_t px = i/4; int32_t px = i/4;
int32_t py = i%4; int32_t py = i%4;
// draw at pos // draw at pos
lpDDraw->ActivateBlitModulation(particle->b); pDraw->ActivateBlitModulation(particle->b);
float fx = float(def->Gfx.X + def->Gfx.Wdt * px); float fx = float(def->Gfx.X + def->Gfx.Wdt * px);
float fy = float(def->Gfx.Y + def->Gfx.Hgt * py); float fy = float(def->Gfx.Y + def->Gfx.Hgt * py);
float fwdt = float(def->Gfx.Wdt); float fwdt = float(def->Gfx.Wdt);
float fhgt = float(def->Gfx.Hgt); float fhgt = float(def->Gfx.Hgt);
lpDDraw->Blit(def->Gfx.Surface,fx,fy,fwdt,fhgt, pDraw->Blit(def->Gfx.Surface,fx,fy,fwdt,fhgt,
cgo.Surface, cx - particle->a, cy - particle->a, particle->a * 2, particle->a * 2, cgo.Surface, cx - particle->a, cy - particle->a, particle->a * 2, particle->a * 2,
true); true);
lpDDraw->DeactivateBlitModulation(); pDraw->DeactivateBlitModulation();
} }
bool fxStdInit(C4Particle *particle, C4Object *target) bool fxStdInit(C4Particle *particle, C4Object *target)
@ -864,11 +864,11 @@ void fxStdDraw(C4Particle *particle, C4TargetFacet &cgo, C4Object *target)
if (def->RByV == 3) // random rotation - currently a pseudo random rotation by x/y position 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; r = (((int32_t)(particle->x * 23 + particle->y * 12)) % 360) * 100;
// draw at pos // draw at pos
lpDDraw->ActivateBlitModulation(particle->b); pDraw->ActivateBlitModulation(particle->b);
lpDDraw->StorePrimaryClipper(); pDraw->StorePrimaryClipper();
lpDDraw->SubPrimaryClipper(cgox, cgoy+def->YOff, 100000, 100000); pDraw->SubPrimaryClipper(cgox, cgoy+def->YOff, 100000, 100000);
if (def->Additive) if (def->Additive)
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE); pDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
// draw // draw
float draw_width = particle->a; float draw_width = particle->a;
@ -890,20 +890,20 @@ void fxStdDraw(C4Particle *particle, C4TargetFacet &cgo, C4Object *target)
{ {
C4BltTransform rot; C4BltTransform rot;
rot.SetRotate(r, (float) (tx+tx+twdt)/2, (float) (ty+ty+thgt)/2); rot.SetRotate(r, (float) (tx+tx+twdt)/2, (float) (ty+ty+thgt)/2);
lpDDraw->Blit(def->Gfx.Surface,fx,fy,fwdt,fhgt, pDraw->Blit(def->Gfx.Surface,fx,fy,fwdt,fhgt,
cgo.Surface,tx,ty,twdt,thgt, cgo.Surface,tx,ty,twdt,thgt,
true,&rot); true,&rot);
} }
else else
{ {
lpDDraw->Blit(def->Gfx.Surface,fx,fy,fwdt,fhgt, pDraw->Blit(def->Gfx.Surface,fx,fy,fwdt,fhgt,
cgo.Surface,tx,ty,twdt,thgt, cgo.Surface,tx,ty,twdt,thgt,
true); true);
} }
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
lpDDraw->RestorePrimaryClipper(); pDraw->RestorePrimaryClipper();
lpDDraw->DeactivateBlitModulation(); pDraw->DeactivateBlitModulation();
} }
C4ParticleProcRec C4ParticleProcMap[] = C4ParticleProcRec C4ParticleProcMap[] =

View File

@ -255,27 +255,27 @@ void C4PathFinderRay::Draw(C4TargetFacet &cgo)
if (Status==C4PF_Ray_Crawl) if (Status==C4PF_Ray_Crawl)
{ {
int32_t iX=0,iY=0; CrawlToAttach(iX,iY,CrawlAttach); int32_t iX=0,iY=0; CrawlToAttach(iX,iY,CrawlAttach);
lpDDraw->DrawLineDw(cgo.Surface, pDraw->DrawLineDw(cgo.Surface,
cgo.X+X2-cgo.TargetX,cgo.Y+Y2-cgo.TargetY, cgo.X+X2-cgo.TargetX,cgo.Y+Y2-cgo.TargetY,
cgo.X+X2-cgo.TargetX+7*iX,cgo.Y+Y2-cgo.TargetY+7*iY, cgo.X+X2-cgo.TargetX+7*iX,cgo.Y+Y2-cgo.TargetY+7*iY,
C4RGB(0xff, 0, 0)); C4RGB(0xff, 0, 0));
//sprintf(OSTR,"%d",Depth); lpDDraw->TextOut(OSTR,cgo.Surface,cgo.X+X2-cgo.TargetX,cgo.Y+Y2-cgo.TargetY+20,CGray4); //sprintf(OSTR,"%d",Depth); pDraw->TextOut(OSTR,cgo.Surface,cgo.X+X2-cgo.TargetX,cgo.Y+Y2-cgo.TargetY+20,CGray4);
} }
// Ray line // Ray line
lpDDraw->DrawLineDw(cgo.Surface, pDraw->DrawLineDw(cgo.Surface,
cgo.X+X-cgo.TargetX,cgo.Y+Y-cgo.TargetY, cgo.X+X-cgo.TargetX,cgo.Y+Y-cgo.TargetY,
cgo.X+X2-cgo.TargetX,cgo.Y+Y2-cgo.TargetY, cgo.X+X2-cgo.TargetX,cgo.Y+Y2-cgo.TargetY,
Color); Color);
// Crawler point // Crawler point
lpDDraw->DrawFrameDw(cgo.Surface, pDraw->DrawFrameDw(cgo.Surface,
cgo.X+X2-cgo.TargetX-1,cgo.Y+Y2-cgo.TargetY-1, cgo.X+X2-cgo.TargetX-1,cgo.Y+Y2-cgo.TargetY-1,
cgo.X+X2-cgo.TargetX+1,cgo.Y+Y2-cgo.TargetY+1, cgo.X+X2-cgo.TargetX+1,cgo.Y+Y2-cgo.TargetY+1,
(Status==C4PF_Ray_Crawl) ? ((Direction==C4PF_Direction_Left) ? C4RGB(0, 0xff, 0) : C4RGB(0, 0, 0xff)) : Color); (Status==C4PF_Ray_Crawl) ? ((Direction==C4PF_Direction_Left) ? C4RGB(0, 0xff, 0) : C4RGB(0, 0, 0xff)) : Color);
// Search target point // Search target point
lpDDraw->DrawFrameDw(cgo.Surface, pDraw->DrawFrameDw(cgo.Surface,
cgo.X+TargetX-cgo.TargetX-2,cgo.Y+TargetY-cgo.TargetY-2, cgo.X+TargetX-cgo.TargetX-2,cgo.Y+TargetY-cgo.TargetY-2,
cgo.X+TargetX-cgo.TargetX+2,cgo.Y+TargetY-cgo.TargetY+2, cgo.X+TargetX-cgo.TargetX+2,cgo.Y+TargetY-cgo.TargetY+2,
C4RGB(0xff, 0xff, 0)); C4RGB(0xff, 0xff, 0));
@ -345,7 +345,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; d=2*dx-dy; aincr=2*(dx-dy); bincr=2*dx; x=rX; y=rY;
for (y=rY; y!=iToY; y+=yincr) for (y=rY; y!=iToY; y+=yincr)
{ {
lpDDraw->SetPixel(sfcSurface,x,y,byCol); pDraw->SetPixel(sfcSurface,x,y,byCol);
if (d>=0) { x+=xincr; d+=aincr; } else d+=bincr; if (d>=0) { x+=xincr; d+=aincr; } else d+=bincr;
} }
} }
@ -358,7 +358,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; d=2*dy-dx; aincr=2*(dy-dx); bincr=2*dy; x=rX; y=rY;
for (x=rX; x!=iToX; x+=xincr) for (x=rX; x!=iToX; x+=xincr)
{ {
lpDDraw->SetPixel(sfcSurface,x,y,byCol); pDraw->SetPixel(sfcSurface,x,y,byCol);
if (d>=0) { y+=yincr; d+=aincr; } else d+=bincr; if (d>=0) { y+=yincr; d+=aincr; } else d+=bincr;
} }
} }

View File

@ -43,16 +43,16 @@ static bool SurfaceEnsureSize(C4Surface **ppSfc, int iMinWdt, int iMinHgt)
while (iDstWdt<iMinWdt) iDstWdt+=iWdt; while (iDstWdt<iMinWdt) iDstWdt+=iWdt;
while (iDstHgt<iMinHgt) iDstHgt+=iHgt; while (iDstHgt<iMinHgt) iDstHgt+=iHgt;
// Without shaders, the textures need to be small for the FoW. // Without shaders, the textures need to be small for the FoW.
if (iDstWdt==iWdt && iDstHgt==iHgt && lpDDraw->IsShaderific()) return true; if (iDstWdt==iWdt && iDstHgt==iHgt && pDraw->IsShaderific()) return true;
// create new surface // create new surface
C4Surface *pNewSfc=new C4Surface(); C4Surface *pNewSfc=new C4Surface();
if (!pNewSfc->Create(iDstWdt, iDstHgt, false, false, lpDDraw->IsShaderific() ? 0 : 64)) if (!pNewSfc->Create(iDstWdt, iDstHgt, false, false, pDraw->IsShaderific() ? 0 : 64))
{ {
delete pNewSfc; delete pNewSfc;
return false; return false;
} }
// blit tiled into dest surface // blit tiled into dest surface
lpDDraw->BlitSurfaceTile2(*ppSfc, pNewSfc, 0, 0, iDstWdt, iDstHgt, 0, 0, false); pDraw->BlitSurfaceTile2(*ppSfc, pNewSfc, 0, 0, iDstWdt, iDstHgt, 0, 0, false);
// destroy old surface, assign new // destroy old surface, assign new
delete *ppSfc; *ppSfc=pNewSfc; delete *ppSfc; *ppSfc=pNewSfc;
// success // success
@ -200,9 +200,9 @@ void C4Sky::Execute()
void C4Sky::Draw(C4TargetFacet &cgo) void C4Sky::Draw(C4TargetFacet &cgo)
{ {
// background color? // background color?
if (BackClrEnabled) lpDDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y, cgo.X+cgo.Wdt, cgo.Y+cgo.Hgt, BackClr); if (BackClrEnabled) pDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y, cgo.X+cgo.Wdt, cgo.Y+cgo.Hgt, BackClr);
// sky surface? // sky surface?
if (Modulation != 0xffffffff) lpDDraw->ActivateBlitModulation(Modulation); if (Modulation != 0xffffffff) pDraw->ActivateBlitModulation(Modulation);
if (Surface) if (Surface)
{ {
// blit parallax sky // blit parallax sky
@ -224,16 +224,16 @@ void C4Sky::Draw(C4TargetFacet &cgo)
ZoomDataStackItem zdsi(resultzoom); ZoomDataStackItem zdsi(resultzoom);
lpDDraw->BlitSurfaceTile2(Surface, cgo.Surface, cgo.X, cgo.Y, cgo.Wdt * zoom / resultzoom, cgo.Hgt * zoom / resultzoom, -resultx, -resulty, false); pDraw->BlitSurfaceTile2(Surface, cgo.Surface, cgo.X, cgo.Y, cgo.Wdt * zoom / resultzoom, cgo.Hgt * zoom / resultzoom, -resultx, -resulty, false);
} }
else else
{ {
// no sky surface: blit sky fade // no sky surface: blit sky fade
DWORD dwClr1=GetSkyFadeClr(cgo.TargetY); DWORD dwClr1=GetSkyFadeClr(cgo.TargetY);
DWORD dwClr2=GetSkyFadeClr(cgo.TargetY+cgo.Hgt); DWORD dwClr2=GetSkyFadeClr(cgo.TargetY+cgo.Hgt);
lpDDraw->DrawBoxFade(cgo.Surface, cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt, dwClr1, dwClr1, dwClr2, dwClr2, cgo.TargetX, cgo.TargetY); pDraw->DrawBoxFade(cgo.Surface, cgo.X, cgo.Y, cgo.Wdt, cgo.Hgt, dwClr1, dwClr1, dwClr2, dwClr2, cgo.TargetX, cgo.TargetY);
} }
if (Modulation != 0xffffffff) lpDDraw->DeactivateBlitModulation(); if (Modulation != 0xffffffff) pDraw->DeactivateBlitModulation();
// done // done
} }

View File

@ -186,7 +186,7 @@ void C4Weather::SetSeasonGamma()
dwClr[i] |= BoundBy<int32_t>(iChanVal,0,255)<<iChan; dwClr[i] |= BoundBy<int32_t>(iChanVal,0,255)<<iChan;
} }
// apply gamma ramp // apply gamma ramp
lpDDraw->SetGamma(dwClr[0], dwClr[1], dwClr[2], C4GRI_SEASON); pDraw->SetGamma(dwClr[0], dwClr[1], dwClr[2], C4GRI_SEASON);
} }
void C4Weather::CompileFunc(StdCompiler *pComp) void C4Weather::CompileFunc(StdCompiler *pComp)
@ -207,7 +207,7 @@ void C4Weather::CompileFunc(StdCompiler *pComp)
dwGammaDefaults[i*3+1] = 0x808080; dwGammaDefaults[i*3+1] = 0x808080;
dwGammaDefaults[i*3+2] = 0xffffff; dwGammaDefaults[i*3+2] = 0xffffff;
} }
pComp->Value(mkNamingAdapt(mkArrayAdaptM(lpDDraw->dwGamma), "Gamma", dwGammaDefaults)); pComp->Value(mkNamingAdapt(mkArrayAdaptM(pDraw->dwGamma), "Gamma", dwGammaDefaults));
} }
C4Weather Weather; C4Weather Weather;

View File

@ -548,7 +548,7 @@ void C4Def::Draw(C4Facet &cgo, bool fSelected, DWORD iColor, C4Object *pObj, int
if (pObj) if (pObj->PictureRect.Wdt) fctPicRect = pObj->PictureRect; if (pObj) if (pObj->PictureRect.Wdt) fctPicRect = pObj->PictureRect;
if (fSelected) if (fSelected)
lpDDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y, cgo.X + cgo.Wdt - 1, cgo.Y + cgo.Hgt - 1, C4RGB(0xca, 0, 0)); pDraw->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; C4DefGraphics* graphics = pObj ? pObj->GetGraphics() : &Graphics;
@ -581,12 +581,12 @@ void C4Def::Draw(C4Facet &cgo, bool fSelected, DWORD iColor, C4Object *pObj, int
StdMeshMatrix matrix; StdMeshMatrix matrix;
if (C4ValueToMatrix(value, &matrix)) if (C4ValueToMatrix(value, &matrix))
lpDDraw->SetMeshTransform(&matrix); pDraw->SetMeshTransform(&matrix);
lpDDraw->SetPerspective(true); pDraw->SetPerspective(true);
lpDDraw->RenderMesh(*instance, cgo.Surface, cgo.X,cgo.Y, cgo.Wdt, cgo.Hgt, pObj ? pObj->Color : iColor, trans); pDraw->RenderMesh(*instance, cgo.Surface, cgo.X,cgo.Y, cgo.Wdt, cgo.Hgt, pObj ? pObj->Color : iColor, trans);
lpDDraw->SetPerspective(false); pDraw->SetPerspective(false);
lpDDraw->SetMeshTransform(NULL); pDraw->SetMeshTransform(NULL);
break; break;
} }

View File

@ -865,8 +865,8 @@ void C4GraphicsOverlay::Draw(C4TargetFacet &cgo, C4Object *pForObj, int32_t iByP
(OverlayObj ? static_cast<C4Object*>(OverlayObj) : pForObj)->PrepareDrawing(); (OverlayObj ? static_cast<C4Object*>(OverlayObj) : pForObj)->PrepareDrawing();
else else
{ {
lpDDraw->SetBlitMode(dwBlitMode); pDraw->SetBlitMode(dwBlitMode);
if (dwClrModulation != 0xffffff) lpDDraw->ActivateBlitModulation(dwClrModulation); if (dwClrModulation != 0xffffff) pDraw->ActivateBlitModulation(dwClrModulation);
if (pMeshInstance) if (pMeshInstance)
pMeshInstance->SetFaceOrderingForClrModulation(dwClrModulation); pMeshInstance->SetFaceOrderingForClrModulation(dwClrModulation);
@ -953,10 +953,10 @@ void C4GraphicsOverlay::Draw(C4TargetFacet &cgo, C4Object *pForObj, int32_t iByP
pDef->GetProperty(P_MeshTransformation, &value); pDef->GetProperty(P_MeshTransformation, &value);
StdMeshMatrix matrix; StdMeshMatrix matrix;
if (C4ValueToMatrix(value, &matrix)) if (C4ValueToMatrix(value, &matrix))
lpDDraw->SetMeshTransform(&matrix); pDraw->SetMeshTransform(&matrix);
lpDDraw->RenderMesh(*pMeshInstance, cgo.Surface, offX - pDef->Shape.Wdt/2.0, offY - pDef->Shape.Hgt/2.0, pDef->Shape.Wdt, pDef->Shape.Hgt, pForObj->Color, &trf); pDraw->RenderMesh(*pMeshInstance, cgo.Surface, offX - pDef->Shape.Wdt/2.0, offY - pDef->Shape.Hgt/2.0, pDef->Shape.Wdt, pDef->Shape.Hgt, pForObj->Color, &trf);
lpDDraw->SetMeshTransform(NULL); pDraw->SetMeshTransform(NULL);
} }
else else
{ {
@ -978,13 +978,13 @@ void C4GraphicsOverlay::Draw(C4TargetFacet &cgo, C4Object *pForObj, int32_t iByP
pDef->GetProperty(P_PictureTransformation, &value); pDef->GetProperty(P_PictureTransformation, &value);
StdMeshMatrix matrix; StdMeshMatrix matrix;
if (C4ValueToMatrix(value, &matrix)) if (C4ValueToMatrix(value, &matrix))
lpDDraw->SetMeshTransform(&matrix); pDraw->SetMeshTransform(&matrix);
C4DrawTransform trf(Transform, offX, offY); C4DrawTransform trf(Transform, offX, offY);
lpDDraw->SetPerspective(true); pDraw->SetPerspective(true);
lpDDraw->RenderMesh(*pMeshInstance, cgo.Surface, offX - twdt/2, offY - thgt/2, twdt, thgt, pForObj->Color, &trf); pDraw->RenderMesh(*pMeshInstance, cgo.Surface, offX - twdt/2, offY - thgt/2, twdt, thgt, pForObj->Color, &trf);
lpDDraw->SetPerspective(false); pDraw->SetPerspective(false);
lpDDraw->SetMeshTransform(NULL); pDraw->SetMeshTransform(NULL);
} }
} }
@ -993,8 +993,8 @@ void C4GraphicsOverlay::Draw(C4TargetFacet &cgo, C4Object *pForObj, int32_t iByP
(OverlayObj ? static_cast<C4Object*>(OverlayObj) : pForObj)->FinishedDrawing(); (OverlayObj ? static_cast<C4Object*>(OverlayObj) : pForObj)->FinishedDrawing();
else else
{ {
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
lpDDraw->DeactivateBlitModulation(); pDraw->DeactivateBlitModulation();
} }
} }
@ -1031,8 +1031,8 @@ void C4GraphicsOverlay::DrawPicture(C4Facet &cgo, C4Object *pForObj, C4DrawTrans
} }
else else
{ {
lpDDraw->SetBlitMode(dwBlitMode); pDraw->SetBlitMode(dwBlitMode);
if (dwClrModulation != 0xffffff) lpDDraw->ActivateBlitModulation(dwClrModulation); if (dwClrModulation != 0xffffff) pDraw->ActivateBlitModulation(dwClrModulation);
if (pMeshInstance) if (pMeshInstance)
pMeshInstance->SetFaceOrderingForClrModulation(dwClrModulation); pMeshInstance->SetFaceOrderingForClrModulation(dwClrModulation);
@ -1056,7 +1056,7 @@ void C4GraphicsOverlay::DrawPicture(C4Facet &cgo, C4Object *pForObj, C4DrawTrans
pDef->GetProperty(P_PictureTransformation, &value); pDef->GetProperty(P_PictureTransformation, &value);
StdMeshMatrix matrix; StdMeshMatrix matrix;
if (C4ValueToMatrix(value, &matrix)) if (C4ValueToMatrix(value, &matrix))
lpDDraw->SetMeshTransform(&matrix); pDraw->SetMeshTransform(&matrix);
// the picture we are rendering is the one with trans applied, and the overlay transformation // the picture we are rendering is the one with trans applied, and the overlay transformation
// is applied to the picture we are rendering, so apply it afterwards. Note that // is applied to the picture we are rendering, so apply it afterwards. Note that
@ -1064,10 +1064,10 @@ void C4GraphicsOverlay::DrawPicture(C4Facet &cgo, C4Object *pForObj, C4DrawTrans
C4DrawTransform trf(Transform, cgo.X+float(pForObj->Shape.Wdt)/2, cgo.Y+float(pForObj->Shape.Hgt)/2); C4DrawTransform trf(Transform, cgo.X+float(pForObj->Shape.Wdt)/2, cgo.Y+float(pForObj->Shape.Hgt)/2);
if(trans) trf *= *trans; if(trans) trf *= *trans;
lpDDraw->SetPerspective(true); pDraw->SetPerspective(true);
lpDDraw->RenderMesh(*pMeshInstance, cgo.Surface, cgo.X, cgo.Y, pForObj->Shape.Wdt, pForObj->Shape.Hgt, pForObj->Color, &trf); pDraw->RenderMesh(*pMeshInstance, cgo.Surface, cgo.X, cgo.Y, pForObj->Shape.Wdt, pForObj->Shape.Hgt, pForObj->Color, &trf);
lpDDraw->SetPerspective(false); pDraw->SetPerspective(false);
lpDDraw->SetMeshTransform(NULL); pDraw->SetMeshTransform(NULL);
} }
// cleanup // cleanup
if (dwBlitMode == C4GFXBLIT_PARENT) if (dwBlitMode == C4GFXBLIT_PARENT)
@ -1076,8 +1076,8 @@ void C4GraphicsOverlay::DrawPicture(C4Facet &cgo, C4Object *pForObj, C4DrawTrans
} }
else else
{ {
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
lpDDraw->DeactivateBlitModulation(); pDraw->DeactivateBlitModulation();
} }
} }

View File

@ -411,7 +411,7 @@ void C4IDList::Draw(C4Facet &cgo, int32_t iSelection,
cgo2 = cgo.TruncateSection(iAlign); cgo2 = cgo.TruncateSection(iAlign);
rDefs.Draw(c_id,cgo2,(firstid+cnt==iSelection),0); rDefs.Draw(c_id,cgo2,(firstid+cnt==iSelection),0);
sprintf(buf,"%dx",idcount); sprintf(buf,"%dx",idcount);
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); if (fCounts) pDraw->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

@ -131,9 +131,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)) if (Inside<int32_t>(tx,cgo.X,cgo.X+cgo.Wdt) && Inside<int32_t>(ty,cgo.Y,cgo.Y+cgo.Hgt))
{ {
lpDDraw->DrawLineDw(cgo.Surface, tx - 1, ty, tx + 1, ty, col); pDraw->DrawLineDw(cgo.Surface, tx - 1, ty, tx + 1, ty, col);
lpDDraw->DrawLineDw(cgo.Surface, tx, ty - 1, tx, ty + 1, col); pDraw->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)); if (contact) pDraw->DrawFrameDw(cgo.Surface,tx-2,ty-2,tx+2,ty+2,C4RGB(0xff, 0xff, 0xff));
} }
} }
@ -544,7 +544,7 @@ void C4Object::DrawFaceImpl(C4TargetFacet &cgo, bool action, float fx, float fy,
case C4DefGraphics::TYPE_Bitmap: case C4DefGraphics::TYPE_Bitmap:
sfc = action ? Action.Facet.Surface : GetGraphics()->GetBitmap(Color); sfc = action ? Action.Facet.Surface : GetGraphics()->GetBitmap(Color);
lpDDraw->Blit(sfc, pDraw->Blit(sfc,
fx, fy, fwdt, fhgt, fx, fy, fwdt, fhgt,
cgo.Surface, tx, ty, twdt, thgt, cgo.Surface, tx, ty, twdt, thgt,
true, transform); true, transform);
@ -564,10 +564,10 @@ void C4Object::DrawFaceImpl(C4TargetFacet &cgo, bool action, float fx, float fy,
matrix = StdMeshMatrix::Scale(twdt/fwdt,thgt/fhgt,std::sqrt(twdt*thgt/(fwdt*fhgt))) * matrix; matrix = StdMeshMatrix::Scale(twdt/fwdt,thgt/fhgt,std::sqrt(twdt*thgt/(fwdt*fhgt))) * matrix;
} }
lpDDraw->SetMeshTransform(&matrix); pDraw->SetMeshTransform(&matrix);
lpDDraw->RenderMesh(*pMeshInstance, cgo.Surface, tx, ty, twdt, thgt, Color, transform); pDraw->RenderMesh(*pMeshInstance, cgo.Surface, tx, ty, twdt, thgt, Color, transform);
lpDDraw->SetMeshTransform(NULL); pDraw->SetMeshTransform(NULL);
break; break;
} }
} }
@ -602,7 +602,7 @@ void C4Object::DrawFace(C4TargetFacet &cgo, float offX, float offY, int32_t iPha
if ((!Def->Rotateable || (r==0)) && !pDrawTransform) if ((!Def->Rotateable || (r==0)) && !pDrawTransform)
{ {
DrawFaceImpl(cgo, false, fx, fy, fwdt, fhgt, tx, ty, twdt, thgt, NULL); DrawFaceImpl(cgo, false, fx, fy, fwdt, fhgt, tx, ty, twdt, thgt, NULL);
/* lpDDraw->Blit(GetGraphics()->GetBitmap(Color), /* pDraw->Blit(GetGraphics()->GetBitmap(Color),
fx, fy, fwdt, fhgt, fx, fy, fwdt, fhgt,
cgo.Surface, tx, ty, twdt, thgt, cgo.Surface, tx, ty, twdt, thgt,
true, NULL);*/ true, NULL);*/
@ -621,7 +621,7 @@ void C4Object::DrawFace(C4TargetFacet &cgo, float offX, float offY, int32_t iPha
rot.SetRotate(r * 100, offX, offY); rot.SetRotate(r * 100, offX, offY);
} }
DrawFaceImpl(cgo, false, fx, fy, fwdt, fhgt, tx, ty, twdt, thgt, &rot); DrawFaceImpl(cgo, false, fx, fy, fwdt, fhgt, tx, ty, twdt, thgt, &rot);
/* lpDDraw->Blit(GetGraphics()->GetBitmap(Color), /* pDraw->Blit(GetGraphics()->GetBitmap(Color),
fx, fy, fwdt, fhgt, fx, fy, fwdt, fhgt,
cgo.Surface, tx, ty, twdt, thgt, cgo.Surface, tx, ty, twdt, thgt,
true, &rot);*/ true, &rot);*/
@ -675,7 +675,7 @@ void C4Object::DrawActionFace(C4TargetFacet &cgo, float offX, float offY)
if ((!Def->Rotateable || (r==0)) && !pDrawTransform) if ((!Def->Rotateable || (r==0)) && !pDrawTransform)
{ {
DrawFaceImpl(cgo, true, fx, fy, fwdt, fhgt, tx, ty, twdt, thgt, NULL); DrawFaceImpl(cgo, true, fx, fy, fwdt, fhgt, tx, ty, twdt, thgt, NULL);
/*lpDDraw->Blit(Action.Facet.Surface, /*pDraw->Blit(Action.Facet.Surface,
fx, fy, fwdt, fhgt, fx, fy, fwdt, fhgt,
cgo.Surface, tx, ty, twdt, thgt, cgo.Surface, tx, ty, twdt, thgt,
true, NULL);*/ true, NULL);*/
@ -696,7 +696,7 @@ void C4Object::DrawActionFace(C4TargetFacet &cgo, float offX, float offY)
rot.SetRotate(r * 100, offX, offY); rot.SetRotate(r * 100, offX, offY);
} }
DrawFaceImpl(cgo, true, fx, fy, fwdt, fhgt, tx, ty, twdt, thgt, &rot); DrawFaceImpl(cgo, true, fx, fy, fwdt, fhgt, tx, ty, twdt, thgt, &rot);
/* lpDDraw->Blit(Action.Facet.Surface, /* pDraw->Blit(Action.Facet.Surface,
fx, fy, fwdt, fhgt, fx, fy, fwdt, fhgt,
cgo.Surface, tx, ty, twdt, thgt, cgo.Surface, tx, ty, twdt, thgt,
true, &rot);*/ true, &rot);*/
@ -1976,8 +1976,8 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
GetDrawPosition(cgo, pCom->Tx._getInt(), pCom->Ty, cgo.Zoom, offX2, offY2, newzoom)) GetDrawPosition(cgo, pCom->Tx._getInt(), pCom->Ty, cgo.Zoom, offX2, offY2, newzoom))
{ {
ZoomDataStackItem zdsi(newzoom); ZoomDataStackItem zdsi(newzoom);
lpDDraw->DrawLineDw(cgo.Surface,offX1,offY1,offX2,offY2,C4RGB(0xca,0,0)); pDraw->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)); pDraw->DrawFrameDw(cgo.Surface,offX2-1,offY2-1,offX2+1,offY2+1,C4RGB(0xca,0,0));
} }
ccx=pCom->Tx._getInt(); ccy=pCom->Ty; ccx=pCom->Tx._getInt(); ccy=pCom->Ty;
@ -2006,8 +2006,8 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
GetDrawPosition(cgo, pCom->Tx._getInt(), pCom->Ty, cgo.Zoom, offX2, offY2, newzoom)) GetDrawPosition(cgo, pCom->Tx._getInt(), pCom->Ty, cgo.Zoom, offX2, offY2, newzoom))
{ {
ZoomDataStackItem zdsi(newzoom); ZoomDataStackItem zdsi(newzoom);
lpDDraw->DrawLineDw(cgo.Surface,offX1,offY1,offX2,offY2,C4RGB(0,0xca,0)); pDraw->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)); pDraw->DrawFrameDw(cgo.Surface,offX2-1,offY2-1,offX2+1,offY2+1,C4RGB(0,0xca,0));
} }
ccx=pCom->Tx._getInt(); ccy=pCom->Ty; ccx=pCom->Tx._getInt(); ccy=pCom->Ty;
@ -2034,7 +2034,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
if (iMoveTos) { Cmds.AppendChar('|'); Cmds.AppendFormat("%dx MoveTo",iMoveTos); iMoveTos=0; } if (iMoveTos) { Cmds.AppendChar('|'); Cmds.AppendFormat("%dx MoveTo",iMoveTos); iMoveTos=0; }
// Draw message // Draw message
int32_t cmwdt,cmhgt; ::GraphicsResource.FontRegular.GetTextExtent(Cmds.getData(),cmwdt,cmhgt,true); int32_t cmwdt,cmhgt; ::GraphicsResource.FontRegular.GetTextExtent(Cmds.getData(),cmwdt,cmhgt,true);
lpDDraw->TextOut(Cmds.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,offX,offY+Shape.GetY()-10-cmhgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter); pDraw->TextOut(Cmds.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,offX,offY+Shape.GetY()-10-cmhgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter);
} }
// Debug Display /////////////////////////////////////////////////////////////////////////////// // Debug Display ///////////////////////////////////////////////////////////////////////////////
@ -2053,8 +2053,8 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
bool fOldClrModEnabled = !!(Category & C4D_IgnoreFoW); bool fOldClrModEnabled = !!(Category & C4D_IgnoreFoW);
if (fOldClrModEnabled) if (fOldClrModEnabled)
{ {
fOldClrModEnabled = lpDDraw->GetClrModMapEnabled(); fOldClrModEnabled = pDraw->GetClrModMapEnabled();
lpDDraw->SetClrModMapEnabled(false); pDraw->SetClrModMapEnabled(false);
} }
// Fire facet - always draw, even if particles are drawn as well // Fire facet - always draw, even if particles are drawn as well
@ -2100,7 +2100,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
if (Action.Facet.Surface && pActionDef->GetPropertyInt(P_FacetTargetStretch)) if (Action.Facet.Surface && pActionDef->GetPropertyInt(P_FacetTargetStretch))
{ {
if (Action.Target) if (Action.Target)
lpDDraw->Blit(Action.Facet.Surface, pDraw->Blit(Action.Facet.Surface,
float(Action.Facet.X),float(Action.Facet.Y),float(Action.Facet.Wdt),float(Action.Facet.Hgt), float(Action.Facet.X),float(Action.Facet.Y),float(Action.Facet.Wdt),float(Action.Facet.Hgt),
cgo.Surface, cgo.Surface,
offX + Shape.GetX() + Action.FacetX, offY + Shape.GetY() + Action.FacetY,Action.Facet.Wdt, offX + Shape.GetX() + Action.FacetX, offY + Shape.GetY() + Action.FacetY,Action.Facet.Wdt,
@ -2141,13 +2141,13 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
if (::GraphicsSystem.ShowEntrance) if (eDrawMode!=ODM_BaseOnly) if (::GraphicsSystem.ShowEntrance) if (eDrawMode!=ODM_BaseOnly)
{ {
if (OCF & OCF_Entrance) if (OCF & OCF_Entrance)
lpDDraw->DrawFrameDw(cgo.Surface,offX+Def->Entrance.x, pDraw->DrawFrameDw(cgo.Surface,offX+Def->Entrance.x,
offY+Def->Entrance.y, offY+Def->Entrance.y,
offX+Def->Entrance.x+Def->Entrance.Wdt-1, offX+Def->Entrance.x+Def->Entrance.Wdt-1,
offY+Def->Entrance.y+Def->Entrance.Hgt-1, offY+Def->Entrance.y+Def->Entrance.Hgt-1,
C4RGB(0, 0, 0xff)); C4RGB(0, 0, 0xff));
if (OCF & OCF_Collection) if (OCF & OCF_Collection)
lpDDraw->DrawFrameDw(cgo.Surface,offX+Def->Collection.x, pDraw->DrawFrameDw(cgo.Surface,offX+Def->Collection.x,
offY+Def->Collection.y, offY+Def->Collection.y,
offX+Def->Collection.x+Def->Collection.Wdt-1, offX+Def->Collection.x+Def->Collection.Wdt-1,
offY+Def->Collection.y+Def->Collection.Hgt-1, offY+Def->Collection.y+Def->Collection.Hgt-1,
@ -2161,7 +2161,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
StdStrBuf str; StdStrBuf str;
str.Format("%s (%d)",pActionDef->GetName(),Action.Phase); str.Format("%s (%d)",pActionDef->GetName(),Action.Phase);
int32_t cmwdt,cmhgt; ::GraphicsResource.FontRegular.GetTextExtent(str.getData(),cmwdt,cmhgt,true); int32_t cmwdt,cmhgt; ::GraphicsResource.FontRegular.GetTextExtent(str.getData(),cmwdt,cmhgt,true);
lpDDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular, pDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular,
1.0, cgo.Surface, offX, offY + Shape.GetY() - cmhgt, 1.0, cgo.Surface, offX, offY + Shape.GetY() - cmhgt,
InLiquid ? 0xfa0000FF : CStdDDraw::DEFAULT_MESSAGE_COLOR, ACenter); InLiquid ? 0xfa0000FF : CStdDDraw::DEFAULT_MESSAGE_COLOR, ACenter);
} }
@ -2169,7 +2169,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode, f
// Debug Display /////////////////////////////////////////////////////////////////////// // Debug Display ///////////////////////////////////////////////////////////////////////
// Restore visibility inside FoW // Restore visibility inside FoW
if (fOldClrModEnabled) lpDDraw->SetClrModMapEnabled(fOldClrModEnabled); if (fOldClrModEnabled) pDraw->SetClrModMapEnabled(fOldClrModEnabled);
} }
@ -2219,7 +2219,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); 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); iTY = BoundBy<int>(offY - Def->Shape.Hgt / 2 - 20 - iTHgt, cgo.Y, cgo.Y + cgo.Hgt - iTHgt);
// Draw // Draw
lpDDraw->TextOut(szText, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, iTX, iTY, pDraw->TextOut(szText, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, iTX, iTY,
pOwner->ColorDw|0x7f000000,ACenter); pOwner->ColorDw|0x7f000000,ACenter);
} }
} }
@ -2238,7 +2238,7 @@ void C4Object::DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDraw
if (eDrawMode!=ODM_BaseOnly) if (eDrawMode!=ODM_BaseOnly)
{ {
C4Facet &fctConSign = ::GraphicsResource.fctConstruction; C4Facet &fctConSign = ::GraphicsResource.fctConstruction;
lpDDraw->Blit(fctConSign.Surface, pDraw->Blit(fctConSign.Surface,
fctConSign.X, fctConSign.Y, fctConSign.X, fctConSign.Y,
fctConSign.Wdt, fctConSign.Hgt, fctConSign.Wdt, fctConSign.Hgt,
cgo.Surface, cgo.Surface,
@ -2261,7 +2261,7 @@ void C4Object::DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDraw
// Draw top face bitmap // Draw top face bitmap
if (Con!=FullCon && Def->GrowthType) if (Con!=FullCon && Def->GrowthType)
// stretched // stretched
lpDDraw->Blit(TopFace.Surface, pDraw->Blit(TopFace.Surface,
TopFace.X, TopFace.Y, TopFace.Wdt, TopFace.Hgt, TopFace.X, TopFace.Y, TopFace.Wdt, TopFace.Hgt,
cgo.Surface, cgo.Surface,
offX + Shape.GetX() + float(Def->TopFace.tx * Con) / FullCon, offY + Shape.GetY() + float(Def->TopFace.ty * Con) / FullCon, offX + Shape.GetX() + float(Def->TopFace.tx * Con) / FullCon, offY + Shape.GetY() + float(Def->TopFace.ty * Con) / FullCon,
@ -2269,7 +2269,7 @@ void C4Object::DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDraw
true, pDrawTransform ? &C4DrawTransform(*pDrawTransform, offX, offY) : NULL); true, pDrawTransform ? &C4DrawTransform(*pDrawTransform, offX, offY) : NULL);
else else
// normal // normal
lpDDraw->Blit(TopFace.Surface, pDraw->Blit(TopFace.Surface,
TopFace.X,TopFace.Y, TopFace.X,TopFace.Y,
TopFace.Wdt,TopFace.Hgt, TopFace.Wdt,TopFace.Hgt,
cgo.Surface, cgo.Surface,
@ -4275,17 +4275,17 @@ void C4Object::SetRotation(int32_t nr)
void C4Object::PrepareDrawing() void C4Object::PrepareDrawing()
{ {
// color modulation // color modulation
if (ColorMod != 0xffffffff || (BlitMode & (C4GFXBLIT_MOD2 | C4GFXBLIT_CLRSFC_MOD2))) lpDDraw->ActivateBlitModulation(ColorMod); if (ColorMod != 0xffffffff || (BlitMode & (C4GFXBLIT_MOD2 | C4GFXBLIT_CLRSFC_MOD2))) pDraw->ActivateBlitModulation(ColorMod);
// other blit modes // other blit modes
lpDDraw->SetBlitMode(BlitMode); pDraw->SetBlitMode(BlitMode);
} }
void C4Object::FinishedDrawing() void C4Object::FinishedDrawing()
{ {
// color modulation // color modulation
lpDDraw->DeactivateBlitModulation(); pDraw->DeactivateBlitModulation();
// extra blitting flags // extra blitting flags
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
} }
void C4Object::DrawSolidMask(C4TargetFacet &cgo) void C4Object::DrawSolidMask(C4TargetFacet &cgo)

View File

@ -377,7 +377,7 @@ void C4ObjectList::DrawIDList(C4Facet &cgo, int iSelection,
// Draw count // Draw count
sprintf(szCount,"%dx",iCount); sprintf(szCount,"%dx",iCount);
if ((iCount!=1) || fDrawOneCounts) if ((iCount!=1) || fDrawOneCounts)
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); pDraw->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 // Region
if (pRegions) pRegions->Add(cgo2.X,cgo2.Y,cgo2.Wdt,cgo2.Hgt,pFirstObj->GetName(),iRegionCom,pFirstObj,COM_None,COM_None,pFirstObj->Number); if (pRegions) pRegions->Add(cgo2.X,cgo2.Y,cgo2.Wdt,cgo2.Hgt,pFirstObj->GetName(),iRegionCom,pFirstObj,COM_None,COM_None,pFirstObj->Number);
// Next section // Next section
@ -398,7 +398,7 @@ void C4ObjectList::DrawIDList(C4Facet &cgo, int iSelection,
// Draw count // Draw count
sprintf(szCount,"%dx",iCount); sprintf(szCount,"%dx",iCount);
if ((iCount!=1) || fDrawOneCounts) if ((iCount!=1) || fDrawOneCounts)
lpDDraw->TextOut(szCount,cgo2.Surface,cgo2.X+cgo2.Wdt-1,cgo2.Y+cgo2.Hgt-1-lpDDraw->TextHeight(),FWhite,ARight); pDraw->TextOut(szCount,cgo2.Surface,cgo2.X+cgo2.Wdt-1,cgo2.Y+cgo2.Hgt-1-pDraw->TextHeight(),FWhite,ARight);
// Region // Region
if (pRegions) pRegions->Add(cgo2.X,cgo2.Y,cgo2.Wdt,cgo2.Hgt,pFirstObj->GetName(),iRegionCom,pFirstObj,COM_None,COM_None,pFirstObj->id); if (pRegions) pRegions->Add(cgo2.X,cgo2.Y,cgo2.Wdt,cgo2.Hgt,pFirstObj->GetName(),iRegionCom,pFirstObj,COM_None,COM_None,pFirstObj->id);
// Next section // Next section

View File

@ -1777,13 +1777,13 @@ static long FnReloadParticle(C4AulContext* ctx, C4String *szParticleName)
static bool FnSetGamma(C4AulContext* ctx, long dwClr1, long dwClr2, long dwClr3, long iRampIndex) static bool FnSetGamma(C4AulContext* ctx, long dwClr1, long dwClr2, long dwClr3, long iRampIndex)
{ {
lpDDraw->SetGamma(dwClr1, dwClr2, dwClr3, iRampIndex); pDraw->SetGamma(dwClr1, dwClr2, dwClr3, iRampIndex);
return true; return true;
} }
static bool FnResetGamma(C4AulContext* ctx, long iRampIndex) static bool FnResetGamma(C4AulContext* ctx, long iRampIndex)
{ {
lpDDraw->SetGamma(0x000000, 0x808080, 0xffffff, iRampIndex); pDraw->SetGamma(0x000000, 0x808080, 0xffffff, iRampIndex);
return true; return true;
} }
@ -2288,7 +2288,7 @@ static bool FnCustomMessage(C4AulContext *ctx, C4String *pMsg, C4Object *pObj, N
/*static long FnSetSaturation(C4AulContext *ctx, long s) /*static long FnSetSaturation(C4AulContext *ctx, long s)
{ {
return lpDDraw->SetSaturation(BoundBy(s,0l,255l)); return pDraw->SetSaturation(BoundBy(s,0l,255l));
}*/ }*/
static bool FnPauseGame(C4AulContext *ctx, bool fToggle) static bool FnPauseGame(C4AulContext *ctx, bool fToggle)

View File

@ -140,7 +140,7 @@ void C4TransferZones::Draw(C4TargetFacet &cgo)
void C4TransferZone::Draw(C4TargetFacet &cgo, bool fHighlight) void C4TransferZone::Draw(C4TargetFacet &cgo, bool fHighlight)
{ {
if (Used) fHighlight=true; if (Used) fHighlight=true;
lpDDraw->DrawFrameDw(cgo.Surface, pDraw->DrawFrameDw(cgo.Surface,
int(cgo.X+X-cgo.TargetX),int(cgo.Y+Y-cgo.TargetY), int(cgo.X+X-cgo.TargetX),int(cgo.Y+Y-cgo.TargetY),
int(cgo.X+X-cgo.TargetX+Wdt-1),int(cgo.Y+Y-cgo.TargetY+Hgt-1), int(cgo.X+X-cgo.TargetX+Wdt-1),int(cgo.Y+Y-cgo.TargetY+Hgt-1),
fHighlight ? C4RGB(0, 0xca, 0) : C4RGB(0xca, 0, 0)); fHighlight ? C4RGB(0, 0xca, 0) : C4RGB(0xca, 0, 0));

View File

@ -515,7 +515,7 @@ void C4PortraitSelDlg::ListItem::DrawElement(C4TargetFacet &cgo)
if (!fctImage.Surface) if (!fctImage.Surface)
{ {
// not loaded yet // not loaded yet
lpDDraw->TextOut(LoadResStr("IDS_PRC_INITIALIZE"), ::GraphicsResource.MiniFont, 1.0f, cgo.Surface, cgoPicture.X+cgoPicture.Wdt/2, cgoPicture.Y+(cgoPicture.Hgt-::GraphicsResource.MiniFont.GetLineHeight())/2, C4GUI_StatusFontClr, ACenter, false); pDraw->TextOut(LoadResStr("IDS_PRC_INITIALIZE"), ::GraphicsResource.MiniFont, 1.0f, cgo.Surface, cgoPicture.X+cgoPicture.Wdt/2, cgoPicture.Y+(cgoPicture.Hgt-::GraphicsResource.MiniFont.GetLineHeight())/2, C4GUI_StatusFontClr, ACenter, false);
} }
else else
{ {
@ -523,7 +523,7 @@ void C4PortraitSelDlg::ListItem::DrawElement(C4TargetFacet &cgo)
} }
} }
// draw filename // draw filename
lpDDraw->TextOut(sFilenameLabelText.getData(), *pUseFont, 1.0f, cgo.Surface, cgoPicture.X+rcBounds.Wdt/2, cgoPicture.Y+cgoPicture.Hgt, C4GUI_MessageFontClr, ACenter, false); pDraw->TextOut(sFilenameLabelText.getData(), *pUseFont, 1.0f, cgo.Surface, cgoPicture.X+rcBounds.Wdt/2, cgoPicture.Y+cgoPicture.Hgt, C4GUI_MessageFontClr, ACenter, false);
} }

View File

@ -181,7 +181,7 @@ void C4GameMessage::Draw(C4TargetFacet &cgo, int32_t iPlayer)
PictureDef->GetDef()->Draw(facet); PictureDef->GetDef()->Draw(facet);
// draw message // draw message
lpDDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX+PictureWidth+PictureIndent,iDrawY,ColorDw,ALeft); pDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX+PictureWidth+PictureIndent,iDrawY,ColorDw,ALeft);
} }
else else
{ {
@ -189,7 +189,7 @@ void C4GameMessage::Draw(C4TargetFacet &cgo, int32_t iPlayer)
iDrawX += (cgo.Wdt/2) * cgo.Zoom; iDrawX += (cgo.Wdt/2) * cgo.Zoom;
iDrawY += (2 * cgo.Hgt / 3 + 50) * cgo.Zoom; iDrawY += (2 * cgo.Hgt / 3 + 50) * cgo.Zoom;
if (!(dwFlags & C4GM_Bottom)) iDrawY += DrawMessageOffset; if (!(dwFlags & C4GM_Bottom)) iDrawY += DrawMessageOffset;
lpDDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX,iDrawY,ColorDw,ACenter); pDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX,iDrawY,ColorDw,ACenter);
} }
} }
// Positioned // Positioned
@ -232,7 +232,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; 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; iTY = BoundBy<float>((iMsgY - cgo.Y) * newzoom - iTHgt, 0, cgo.Hgt * cgo.Zoom - iTHgt) + 0.5f;
// Draw // Draw
lpDDraw->TextOut(sText.getData(), ::GraphicsResource.FontRegular, 1.0, pDraw->TextOut(sText.getData(), ::GraphicsResource.FontRegular, 1.0,
cgo.Surface, cgo.Surface,
cgo.X + iTX, cgo.X + iTX,
cgo.Y + iTY, cgo.Y + iTY,

View File

@ -274,14 +274,14 @@ namespace C4GUI
y0 = cgo.TargetY + rcBounds.y + iTopOff, y0 = cgo.TargetY + rcBounds.y + iTopOff,
x1 = cgo.TargetX + rcBounds.x + rcBounds.Wdt - 1, x1 = cgo.TargetX + rcBounds.x + rcBounds.Wdt - 1,
y1 = cgo.TargetY + rcBounds.y + rcBounds.Hgt - 1; y1 = cgo.TargetY + rcBounds.y + rcBounds.Hgt - 1;
if (fDrawTop) lpDDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y0,(float)x1,(float)y0, C4GUI_BorderColor1 | dwAlpha); if (fDrawTop) pDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y0,(float)x1,(float)y0, C4GUI_BorderColor1 | dwAlpha);
if (fDrawLeft) lpDDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y0,(float)x0,(float)y1, C4GUI_BorderColor1 | dwAlpha); if (fDrawLeft) pDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y0,(float)x0,(float)y1, C4GUI_BorderColor1 | dwAlpha);
if (fDrawTop) lpDDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y0+1),(float)(x1-1),(float)(y0+1), C4GUI_BorderColor2 | dwAlpha); if (fDrawTop) pDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y0+1),(float)(x1-1),(float)(y0+1), C4GUI_BorderColor2 | dwAlpha);
if (fDrawLeft) lpDDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y0+1),(float)(x0+1),(float)(y1-1), C4GUI_BorderColor2 | dwAlpha); if (fDrawLeft) pDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y0+1),(float)(x0+1),(float)(y1-1), C4GUI_BorderColor2 | dwAlpha);
lpDDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y1,(float)x1,(float)y1, C4GUI_BorderColor3 | dwAlpha); pDraw->DrawLineDw(cgo.Surface, (float)x0,(float)y1,(float)x1,(float)y1, C4GUI_BorderColor3 | dwAlpha);
lpDDraw->DrawLineDw(cgo.Surface, (float)x1,(float)y0,(float)x1,(float)y1, C4GUI_BorderColor3 | dwAlpha); pDraw->DrawLineDw(cgo.Surface, (float)x1,(float)y0,(float)x1,(float)y1, C4GUI_BorderColor3 | dwAlpha);
lpDDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y1-1),(float)(x1-1),(float)(y1-1), C4GUI_BorderColor1 | dwAlpha); pDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y1-1),(float)(x1-1),(float)(y1-1), C4GUI_BorderColor1 | dwAlpha);
lpDDraw->DrawLineDw(cgo.Surface, (float)(x1-1),(float)(y0+1),(float)(x1-1),(float)(y1-1), C4GUI_BorderColor1 | dwAlpha); pDraw->DrawLineDw(cgo.Surface, (float)(x1-1),(float)(y0+1),(float)(x1-1),(float)(y1-1), C4GUI_BorderColor1 | dwAlpha);
} }
void Element::DrawBar(C4TargetFacet &cgo, DynBarFacet &rFacets) void Element::DrawBar(C4TargetFacet &cgo, DynBarFacet &rFacets)
@ -457,7 +457,7 @@ namespace C4GUI
// only if owned // only if owned
if (!fActive) return; if (!fActive) return;
// dbg: some cursor... // dbg: some cursor...
//lpDDraw->DrawFrame(lpDDraw->lpBack, x-5,y-5,x+5,y+5,2); //pDraw->DrawFrame(pDraw->lpBack, x-5,y-5,x+5,y+5,2);
int32_t iOffsetX = -GfxR->fctMouseCursor.Wdt/2; int32_t iOffsetX = -GfxR->fctMouseCursor.Wdt/2;
int32_t iOffsetY = -GfxR->fctMouseCursor.Hgt/2; int32_t iOffsetY = -GfxR->fctMouseCursor.Hgt/2;
@ -475,7 +475,7 @@ namespace C4GUI
} }
} }
// drag line // drag line
//if (LDown) lpDDraw->DrawLine(cgo.Surface, LDownX, LDownY, x,y, 4); //if (LDown) pDraw->DrawLine(cgo.Surface, LDownX, LDownY, x,y, 4);
} }
void CMouse::ReleaseElements() void CMouse::ReleaseElements()
@ -724,7 +724,7 @@ namespace C4GUI
::GraphicsSystem.pLoaderScreen->fctBackground.DrawFullScreen(cgo); ::GraphicsSystem.pLoaderScreen->fctBackground.DrawFullScreen(cgo);
else else
// loader not yet loaded: black BG // loader not yet loaded: black BG
lpDDraw->DrawBoxDw(cgo.Surface, 0,0, cgo.Wdt+1, cgo.Hgt+1, 0x00000000); pDraw->DrawBoxDw(cgo.Surface, 0,0, cgo.Wdt+1, cgo.Hgt+1, 0x00000000);
} }
} }
// draw contents (if GUI-gfx are loaded, which is assumed in GUI-drawing-functions) // draw contents (if GUI-gfx are loaded, which is assumed in GUI-drawing-functions)
@ -1017,10 +1017,10 @@ namespace C4GUI
if (y < cgo.Y+cgo.TargetY+tHgt+5) tY = Min<int32_t>(y+5, cgo.TargetY+cgo.Hgt-tHgt); else tY = y-tHgt-5; if (y < cgo.Y+cgo.TargetY+tHgt+5) tY = Min<int32_t>(y+5, cgo.TargetY+cgo.Hgt-tHgt); else tY = y-tHgt-5;
tX = BoundBy<int32_t>(x-tWdt/2, cgo.TargetX+cgo.X, cgo.TargetX+cgo.Wdt-tWdt); tX = BoundBy<int32_t>(x-tWdt/2, cgo.TargetX+cgo.X, cgo.TargetX+cgo.Wdt-tWdt);
// draw tooltip box // draw tooltip box
lpDDraw->DrawBoxDw(cgo.Surface, tX,tY,tX+tWdt-1,tY+tHgt-2, C4GUI_ToolTipBGColor); pDraw->DrawBoxDw(cgo.Surface, tX,tY,tX+tWdt-1,tY+tHgt-2, C4GUI_ToolTipBGColor);
lpDDraw->DrawFrameDw(cgo.Surface, tX,tY,tX+tWdt-1,tY+tHgt-1, C4GUI_ToolTipFrameColor); pDraw->DrawFrameDw(cgo.Surface, tX,tY,tX+tWdt-1,tY+tHgt-1, C4GUI_ToolTipFrameColor);
// draw tooltip // draw tooltip
lpDDraw->TextOut(sText.getData(), *pUseFont, 1.0f, cgo.Surface, tX+3,tY+1, C4GUI_ToolTipColor, ALeft); pDraw->TextOut(sText.getData(), *pUseFont, 1.0f, cgo.Surface, tX+3,tY+1, C4GUI_ToolTipColor, ALeft);
// while there's a tooltip, redraw the bg, because it might overlap // while there's a tooltip, redraw the bg, because it might overlap
::GraphicsSystem.InvalidateBg(); ::GraphicsSystem.InvalidateBg();
} }

View File

@ -2536,7 +2536,7 @@ namespace C4GUI
void Init(int32_t tx, int32_t ty, int32_t twdt, int32_t thgt); void Init(int32_t tx, int32_t ty, int32_t twdt, int32_t thgt);
void Clear(); void Clear();
void Render(bool fDoBG); // render to lpDDraw void Render(bool fDoBG); // render to pDraw
void RenderMouse(C4TargetFacet &cgo); // draw mouse only void RenderMouse(C4TargetFacet &cgo); // draw mouse only
bool Execute(); // handle messages; execute all dialogs bool Execute(); // handle messages; execute all dialogs

View File

@ -99,9 +99,9 @@ namespace C4GUI
// draw selection highlight // draw selection highlight
if (fEnabled) if (HasDrawFocus() || (fMouseOver && IsInActiveDlg(false))) if (fEnabled) if (HasDrawFocus() || (fMouseOver && IsInActiveDlg(false)))
{ {
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE); pDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
::GraphicsResource.fctButtonHighlight.DrawX(cgo.Surface, x0+5, y0+3, rcBounds.Wdt-10, rcBounds.Hgt-6); ::GraphicsResource.fctButtonHighlight.DrawX(cgo.Surface, x0+5, y0+3, rcBounds.Wdt-10, rcBounds.Hgt-6);
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
} }
// draw text // draw text
int32_t iTextHgt = rcBounds.Hgt-2; int32_t iTextHgt = rcBounds.Hgt-2;
@ -113,8 +113,8 @@ namespace C4GUI
::GraphicsResource.TitleFont); ::GraphicsResource.TitleFont);
iTextHgt = rUseFont.GetLineHeight(); iTextHgt = rUseFont.GetLineHeight();
//CStdFont &rShadowFont = GetRes()->MiniFont; //CStdFont &rShadowFont = GetRes()->MiniFont;
//lpDDraw->TextOut(Text, rShadowFont, (float) iTextHgt/rShadowFont.GetLineHeight(), cgo.Surface, (x0+x1)/2 + iTxtOff, (y0+y1-iTextHgt)/2 + iTxtOff, C4GUI_ButtonFontShadowClr, ACenter, true); //pDraw->TextOut(Text, rShadowFont, (float) iTextHgt/rShadowFont.GetLineHeight(), cgo.Surface, (x0+x1)/2 + iTxtOff, (y0+y1-iTextHgt)/2 + iTxtOff, C4GUI_ButtonFontShadowClr, ACenter, true);
lpDDraw->TextOut(sText.getData(), rUseFont, 1.0f, cgo.Surface, (x0+x1)/2 + iTxtOff, (y0+y1-iTextHgt)/2 + iTxtOff, C4GUI_ButtonFontClr, ACenter, true); pDraw->TextOut(sText.getData(), rUseFont, 1.0f, cgo.Surface, (x0+x1)/2 + iTxtOff, (y0+y1-iTextHgt)/2 + iTxtOff, C4GUI_ButtonFontClr, ACenter, true);
} }
bool Button::KeyButtonDown() bool Button::KeyButtonDown()
@ -220,9 +220,9 @@ namespace C4GUI
// draw selection highlight // draw selection highlight
if (fEnabled) if (fHighlight || HasDrawFocus() || (fMouseOver && IsInActiveDlg(false))) if (fEnabled) if (fHighlight || HasDrawFocus() || (fMouseOver && IsInActiveDlg(false)))
{ {
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE); pDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, x0, y0, rcBounds.Wdt, rcBounds.Hgt); ::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, x0, y0, rcBounds.Wdt, rcBounds.Hgt);
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
} }
// draw the icon // draw the icon
if (fHasClr && fctIcon.Surface) fctIcon.Surface->SetClr(dwClr); if (fHasClr && fctIcon.Surface) fctIcon.Surface->SetClr(dwClr);
@ -230,15 +230,15 @@ namespace C4GUI
// "button" down? // "button" down?
if (fEnabled) if (fDown || fHighlight) if (fEnabled) if (fDown || fHighlight)
{ {
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE); pDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, x0, y0, rcBounds.Wdt, rcBounds.Hgt); ::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, x0, y0, rcBounds.Wdt, rcBounds.Hgt);
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
} }
// some icon buttons have captions. draw caption below button // some icon buttons have captions. draw caption below button
if (sText.getLength()) if (sText.getLength())
{ {
CStdFont &rUseFont = pCustomFont ? *pCustomFont : ::GraphicsResource.TextFont; CStdFont &rUseFont = pCustomFont ? *pCustomFont : ::GraphicsResource.TextFont;
lpDDraw->TextOut(sText.getData(), rUseFont, 1.0f, cgo.Surface, x0+rcBounds.Wdt/2, y0+rcBounds.Hgt-rUseFont.GetLineHeight()*4/5, pCustomFont ? dwCustomFontClr : C4GUI_CaptionFontClr, ACenter); pDraw->TextOut(sText.getData(), rUseFont, 1.0f, cgo.Surface, x0+rcBounds.Wdt/2, y0+rcBounds.Hgt-rUseFont.GetLineHeight()*4/5, pCustomFont ? dwCustomFontClr : C4GUI_CaptionFontClr, ACenter);
} }
} }
@ -274,9 +274,9 @@ namespace C4GUI
// draw selection highlight // draw selection highlight
if (fEnabled) if (HasDrawFocus() || (fMouseOver && IsInActiveDlg(false))) if (fEnabled) if (HasDrawFocus() || (fMouseOver && IsInActiveDlg(false)))
{ {
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE); pDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, x0, y0, rcBounds.Wdt, rcBounds.Hgt); ::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, x0, y0, rcBounds.Wdt, rcBounds.Hgt);
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
} }
// draw the arrow - down if pressed // draw the arrow - down if pressed
int32_t iFctIdx = eDir; int32_t iFctIdx = eDir;
@ -330,14 +330,14 @@ namespace C4GUI
if (sText.getLength()>0) if (sText.getLength()>0)
{ {
CStdFont *pUseFont = pFont ? pFont : &(::GraphicsResource.GetFontByHeight(rcBounds.Hgt, &fFontZoom)); CStdFont *pUseFont = pFont ? pFont : &(::GraphicsResource.GetFontByHeight(rcBounds.Hgt, &fFontZoom));
lpDDraw->TextOut(sText.getData(), *pUseFont, fFontZoom, cgo.Surface, (int)(x0+iTxtOffX), (int)(y0+iTxtOffY), dwTextClr, byTxtAlign, true); pDraw->TextOut(sText.getData(), *pUseFont, fFontZoom, cgo.Surface, (int)(x0+iTxtOffX), (int)(y0+iTxtOffY), dwTextClr, byTxtAlign, true);
} }
/* /*
if (fEnabled) if (fMouseOver && IsInActiveDlg(false)) if (fEnabled) if (fMouseOver && IsInActiveDlg(false))
{ {
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE); pDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
GetRes()->fctButtonHighlight.DrawXFloat(cgo.Surface, x0, y0, rcfDrawBounds.right-rcfDrawBounds.left, rcfDrawBounds.bottom-rcfDrawBounds.top); GetRes()->fctButtonHighlight.DrawXFloat(cgo.Surface, x0, y0, rcfDrawBounds.right-rcfDrawBounds.left, rcfDrawBounds.bottom-rcfDrawBounds.top);
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
}*/ }*/
} }

View File

@ -130,13 +130,13 @@ namespace C4GUI
yOff = 0; yOff = 0;
fZoom = (float) rcBounds.Hgt / Max(pUseFont->GetLineHeight(), 1); fZoom = (float) rcBounds.Hgt / Max(pUseFont->GetLineHeight(), 1);
} }
lpDDraw->TextOut(sCaption.getData(), *pUseFont, fZoom, cgo.Surface, x0 + rcBounds.Hgt + C4GUI_CheckBoxLabelSpacing, y0 + yOff, fEnabled ? dwEnabledClr : dwDisabledClr, ALeft, true); pDraw->TextOut(sCaption.getData(), *pUseFont, fZoom, cgo.Surface, x0 + rcBounds.Hgt + C4GUI_CheckBoxLabelSpacing, y0 + yOff, fEnabled ? dwEnabledClr : dwDisabledClr, ALeft, true);
// selection marker // selection marker
if ((fMouseOn && IsInActiveDlg(false)) || HasDrawFocus()) if ((fMouseOn && IsInActiveDlg(false)) || HasDrawFocus())
{ {
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE); pDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, x0+rcBounds.Hgt*1/4, y0+rcBounds.Hgt*1/4, rcBounds.Hgt*1/2, rcBounds.Hgt*1/2); ::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, x0+rcBounds.Hgt*1/4, y0+rcBounds.Hgt*1/4, rcBounds.Hgt*1/2, rcBounds.Hgt*1/2);
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
} }
} }

View File

@ -155,13 +155,13 @@ namespace C4GUI
if (!fReadOnly && !fSimple) if (!fReadOnly && !fSimple)
{ {
// draw background // draw background
lpDDraw->DrawBoxDw(cgo.Surface, x0,y0,x0+rcBounds.Wdt-1,y0+rcBounds.Hgt-1,dwBGClr); pDraw->DrawBoxDw(cgo.Surface, x0,y0,x0+rcBounds.Wdt-1,y0+rcBounds.Hgt-1,dwBGClr);
// draw frame // draw frame
if (dwBorderClr) if (dwBorderClr)
{ {
int32_t x1=cgo.TargetX+rcBounds.x,y1=cgo.TargetY+rcBounds.y,x2=x1+rcBounds.Wdt,y2=y1+rcBounds.Hgt; int32_t x1=cgo.TargetX+rcBounds.x,y1=cgo.TargetY+rcBounds.y,x2=x1+rcBounds.Wdt,y2=y1+rcBounds.Hgt;
lpDDraw->DrawFrameDw(cgo.Surface, x1, y1, x2, y2-1, dwBorderClr); pDraw->DrawFrameDw(cgo.Surface, x1, y1, x2, y2-1, dwBorderClr);
lpDDraw->DrawFrameDw(cgo.Surface, x1+1, y1+1, x2-1, y2-2, dwBorderClr); pDraw->DrawFrameDw(cgo.Surface, x1+1, y1+1, x2-1, y2-2, dwBorderClr);
} }
else else
// default frame color // default frame color
@ -177,17 +177,17 @@ namespace C4GUI
// draw text // draw text
if (*Text) if (*Text)
{ {
lpDDraw->StorePrimaryClipper(); pDraw->StorePrimaryClipper();
lpDDraw->SubPrimaryClipper(x0,y0,iRightTextEnd-1,y0+rcBounds.Hgt-1); pDraw->SubPrimaryClipper(x0,y0,iRightTextEnd-1,y0+rcBounds.Hgt-1);
lpDDraw->TextOut(Text, *pUseFont, 1.0f, cgo.Surface, x0 + ::GraphicsResource.fctContext.Wdt + 2, y0 + (rcBounds.Hgt-pUseFont->GetLineHeight())/2, dwFontClr, ALeft); pDraw->TextOut(Text, *pUseFont, 1.0f, cgo.Surface, x0 + ::GraphicsResource.fctContext.Wdt + 2, y0 + (rcBounds.Hgt-pUseFont->GetLineHeight())/2, dwFontClr, ALeft);
lpDDraw->RestorePrimaryClipper(); pDraw->RestorePrimaryClipper();
} }
// draw selection highlight // draw selection highlight
if ((HasDrawFocus() || iOpenMenu || fMouseOver) && !fReadOnly) if ((HasDrawFocus() || iOpenMenu || fMouseOver) && !fReadOnly)
{ {
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE); pDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, x0, y0, rcBounds.Wdt, rcBounds.Hgt); ::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, x0, y0, rcBounds.Wdt, rcBounds.Hgt);
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
} }
} }

View File

@ -296,11 +296,11 @@ namespace C4GUI
C4Rect &rcClipArea = (IsComponentOutsideClientArea() ? GetBounds() : GetClientRect()); C4Rect &rcClipArea = (IsComponentOutsideClientArea() ? GetBounds() : GetClientRect());
// clip to window area // clip to window area
int clx1, cly1, clx2, cly2; int clx1, cly1, clx2, cly2;
lpDDraw->GetPrimaryClipper(clx1, cly1, clx2, cly2); pDraw->GetPrimaryClipper(clx1, cly1, clx2, cly2);
float nclx1 = cgo.TargetX+rcClipArea.x, ncly1 = cgo.TargetY+rcClipArea.y, nclx2 = cgo.TargetX+rcClipArea.x+rcClipArea.Wdt-1, ncly2 = cgo.TargetY+rcClipArea.y+rcClipArea.Hgt-1; float nclx1 = cgo.TargetX+rcClipArea.x, ncly1 = cgo.TargetY+rcClipArea.y, nclx2 = cgo.TargetX+rcClipArea.x+rcClipArea.Wdt-1, ncly2 = cgo.TargetY+rcClipArea.y+rcClipArea.Hgt-1;
lpDDraw->ApplyZoom(nclx1, ncly1); pDraw->ApplyZoom(nclx1, ncly1);
lpDDraw->ApplyZoom(nclx2, ncly2); pDraw->ApplyZoom(nclx2, ncly2);
lpDDraw->SubPrimaryClipper(nclx1, ncly1, nclx2, ncly2); pDraw->SubPrimaryClipper(nclx1, ncly1, nclx2, ncly2);
// update target area // update target area
cgo.TargetX += rcClientRect.x; cgo.TargetY += rcClientRect.y; cgo.TargetX += rcClientRect.x; cgo.TargetY += rcClientRect.y;
// draw contents // draw contents
@ -308,7 +308,7 @@ namespace C4GUI
// reset target area // reset target area
cgo.TargetX -= rcClientRect.x; cgo.TargetY -= rcClientRect.y; cgo.TargetX -= rcClientRect.x; cgo.TargetY -= rcClientRect.y;
// reset clipper // reset clipper
lpDDraw->SetPrimaryClipper(clx1, cly1, clx2, cly2); pDraw->SetPrimaryClipper(clx1, cly1, clx2, cly2);
} }
Window::Window() : Container() Window::Window() : Container()
@ -659,7 +659,7 @@ namespace C4GUI
// draw background // draw background
if (dwBackClr != 0xffffffff) if (dwBackClr != 0xffffffff)
{ {
lpDDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x, cgo.TargetY+rcBounds.y, cgo.TargetX+rcBounds.x+rcBounds.Wdt-1, cgo.TargetY+rcBounds.y+rcBounds.Hgt-1, dwBackClr); pDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x, cgo.TargetY+rcBounds.y, cgo.TargetX+rcBounds.x+rcBounds.Wdt-1, cgo.TargetY+rcBounds.y+rcBounds.Hgt-1, dwBackClr);
} }
// draw title label // draw title label
int32_t iBorderYOff = 0; int32_t iBorderYOff = 0;
@ -671,7 +671,7 @@ namespace C4GUI
iBorderYOff = pTitleFont->GetLineHeight()/2; iBorderYOff = pTitleFont->GetLineHeight()/2;
pTitleFont->GetTextExtent(sTitle.getData(), iTitleGapWdt, iTitleGapX, true); pTitleFont->GetTextExtent(sTitle.getData(), iTitleGapWdt, iTitleGapX, true);
iTitleGapX = 7; iTitleGapWdt += 4; iTitleGapX = 7; iTitleGapWdt += 4;
lpDDraw->TextOut(sTitle.getData(), *pTitleFont, 1.0f, cgo.Surface, cgo.TargetX+rcBounds.x+iTitleGapX+2, cgo.TargetY+rcBounds.y, dwTitleClr); pDraw->TextOut(sTitle.getData(), *pTitleFont, 1.0f, cgo.Surface, cgo.TargetX+rcBounds.x+iTitleGapX+2, cgo.TargetY+rcBounds.y, dwTitleClr);
} }
// draw frame // draw frame
if (dwFrameClr) if (dwFrameClr)
@ -681,17 +681,17 @@ namespace C4GUI
{ {
for (int i=0; i<2; ++i) for (int i=0; i<2; ++i)
{ {
lpDDraw->DrawLineDw(cgo.Surface, (float) x1+i, (float)y1, (float)(x1+i), (float)(y2-1), dwFrameClr); // left pDraw->DrawLineDw(cgo.Surface, (float) x1+i, (float)y1, (float)(x1+i), (float)(y2-1), dwFrameClr); // left
lpDDraw->DrawLineDw(cgo.Surface, (float) (x1+2), (float)(y1+i), (float)(x1+iTitleGapX), (float)(y1+i), dwFrameClr); // top - left side pDraw->DrawLineDw(cgo.Surface, (float) (x1+2), (float)(y1+i), (float)(x1+iTitleGapX), (float)(y1+i), dwFrameClr); // top - left side
lpDDraw->DrawLineDw(cgo.Surface, (float) (x1+iTitleGapX+iTitleGapWdt), (float)(y1+i), (float)(x2-3), (float)(y1+i), dwFrameClr); // top - right side pDraw->DrawLineDw(cgo.Surface, (float) (x1+iTitleGapX+iTitleGapWdt), (float)(y1+i), (float)(x2-3), (float)(y1+i), dwFrameClr); // top - right side
lpDDraw->DrawLineDw(cgo.Surface, (float) (x2-1-i), (float)y1, (float)(x2-1-i), (float)(y2-1), dwFrameClr); // right pDraw->DrawLineDw(cgo.Surface, (float) (x2-1-i), (float)y1, (float)(x2-1-i), (float)(y2-1), dwFrameClr); // right
lpDDraw->DrawLineDw(cgo.Surface, (float) (x1+2), (float)(y2-1-i), (float)(x2-3), (float)(y2-1-i), dwFrameClr); // bottom pDraw->DrawLineDw(cgo.Surface, (float) (x1+2), (float)(y2-1-i), (float)(x2-3), (float)(y2-1-i), dwFrameClr); // bottom
} }
} }
else else
{ {
lpDDraw->DrawFrameDw(cgo.Surface, x1, y1, x2, (y2-1), dwFrameClr); pDraw->DrawFrameDw(cgo.Surface, x1, y1, x2, (y2-1), dwFrameClr);
lpDDraw->DrawFrameDw(cgo.Surface, (x1+1), (y1+1), (x2-1), (y2-2), dwFrameClr); pDraw->DrawFrameDw(cgo.Surface, (x1+1), (y1+1), (x2-1), (y2-2), dwFrameClr);
} }
} }
else else

View File

@ -136,7 +136,7 @@ namespace C4GUI
{ {
// draw BG // draw BG
int ox = cgo.TargetX+rcBounds.x, oy = cgo.TargetY+rcBounds.y; int ox = cgo.TargetX+rcBounds.x, oy = cgo.TargetY+rcBounds.y;
lpDDraw->DrawBoxDw(cgo.Surface, ox,oy,ox+rcBounds.Wdt-1,oy+rcBounds.Hgt-1,dwBackClr); pDraw->DrawBoxDw(cgo.Surface, ox,oy,ox+rcBounds.Wdt-1,oy+rcBounds.Hgt-1,dwBackClr);
// draw borders // draw borders
int x,y,Q; int x,y,Q;
// top // top
@ -703,15 +703,15 @@ namespace C4GUI
if (iFade < 100) if (iFade < 100)
{ {
if (iFade <= 0) return; if (iFade <= 0) return;
lpDDraw->ActivateBlitModulation((iFade*255/100)<<24 | 0xffffff); pDraw->ActivateBlitModulation((iFade*255/100)<<24 | 0xffffff);
} }
// separate window: Clear background // separate window: Clear background
if (pWindow) if (pWindow)
lpDDraw->DrawBoxDw(cgo.Surface, rcBounds.x, rcBounds.y, rcBounds.Wdt-1, rcBounds.Hgt-1, (0xff << 24) | (C4GUI_StandardBGColor & 0xffffff) ); pDraw->DrawBoxDw(cgo.Surface, rcBounds.x, rcBounds.y, rcBounds.Wdt-1, rcBounds.Hgt-1, (0xff << 24) | (C4GUI_StandardBGColor & 0xffffff) );
// draw window + contents (evaluates IsVisible) // draw window + contents (evaluates IsVisible)
Window::Draw(cgo); Window::Draw(cgo);
// reset blit modulation // reset blit modulation
if (iFade<100) lpDDraw->DeactivateBlitModulation(); if (iFade<100) pDraw->DeactivateBlitModulation();
// blit output to own window // blit output to own window
if (pWindow) if (pWindow)
{ {
@ -731,7 +731,7 @@ namespace C4GUI
{ {
// standard border/bg then // standard border/bg then
// draw background // draw background
lpDDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x,cgo.TargetY+rcBounds.y,rcBounds.x+rcBounds.Wdt-1+cgo.TargetX,rcBounds.y+rcBounds.Hgt-1+cgo.TargetY,C4GUI_StandardBGColor); pDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x,cgo.TargetY+rcBounds.y,rcBounds.x+rcBounds.Wdt-1+cgo.TargetX,rcBounds.y+rcBounds.Hgt-1+cgo.TargetY,C4GUI_StandardBGColor);
// draw frame // draw frame
Draw3DFrame(cgo); Draw3DFrame(cgo);
} }
@ -1051,7 +1051,7 @@ namespace C4GUI
{ {
// draw upper board // draw upper board
if (HasUpperBoard()) if (HasUpperBoard())
lpDDraw->BlitSurfaceTile(::GraphicsResource.fctUpperBoard.Surface,cgo.Surface,0,Min<int32_t>(iFade-::GraphicsResource.fctUpperBoard.Hgt, 0),cgo.Wdt,::GraphicsResource.fctUpperBoard.Hgt); pDraw->BlitSurfaceTile(::GraphicsResource.fctUpperBoard.Surface,cgo.Surface,0,Min<int32_t>(iFade-::GraphicsResource.fctUpperBoard.Hgt, 0),cgo.Wdt,::GraphicsResource.fctUpperBoard.Hgt);
} }
void FullscreenDialog::UpdateOwnPos() void FullscreenDialog::UpdateOwnPos()

View File

@ -569,24 +569,24 @@ namespace C4GUI
void Edit::DrawElement(C4TargetFacet &cgo) void Edit::DrawElement(C4TargetFacet &cgo)
{ {
// draw background // draw background
lpDDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x,cgo.TargetY+rcBounds.y,rcBounds.x+rcBounds.Wdt+cgo.TargetX-1,rcClientRect.y+rcClientRect.Hgt+cgo.TargetY, dwBGClr); pDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x,cgo.TargetY+rcBounds.y,rcBounds.x+rcBounds.Wdt+cgo.TargetX-1,rcClientRect.y+rcClientRect.Hgt+cgo.TargetY, dwBGClr);
// draw frame // draw frame
if (dwBorderColor) if (dwBorderColor)
{ {
int32_t x1=cgo.TargetX+rcBounds.x,y1=cgo.TargetY+rcBounds.y,x2=x1+rcBounds.Wdt,y2=y1+rcBounds.Hgt; int32_t x1=cgo.TargetX+rcBounds.x,y1=cgo.TargetY+rcBounds.y,x2=x1+rcBounds.Wdt,y2=y1+rcBounds.Hgt;
lpDDraw->DrawFrameDw(cgo.Surface, x1, y1, x2, y2-1, dwBorderColor); pDraw->DrawFrameDw(cgo.Surface, x1, y1, x2, y2-1, dwBorderColor);
lpDDraw->DrawFrameDw(cgo.Surface, x1+1, y1+1, x2-1, y2-2, dwBorderColor); pDraw->DrawFrameDw(cgo.Surface, x1+1, y1+1, x2-1, y2-2, dwBorderColor);
} }
else else
// default frame color // default frame color
Draw3DFrame(cgo); Draw3DFrame(cgo);
// clipping // clipping
int cx0,cy0,cx1,cy1; bool fClip, fOwnClip; int cx0,cy0,cx1,cy1; bool fClip, fOwnClip;
fClip = lpDDraw->GetPrimaryClipper(cx0,cy0,cx1,cy1); fClip = pDraw->GetPrimaryClipper(cx0,cy0,cx1,cy1);
float nclx1 = rcClientRect.x+cgo.TargetX-2, ncly1 = rcClientRect.y+cgo.TargetY, nclx2 = rcClientRect.x+rcClientRect.Wdt+cgo.TargetX+1, ncly2 = rcClientRect.y+rcClientRect.Hgt+cgo.TargetY; float nclx1 = rcClientRect.x+cgo.TargetX-2, ncly1 = rcClientRect.y+cgo.TargetY, nclx2 = rcClientRect.x+rcClientRect.Wdt+cgo.TargetX+1, ncly2 = rcClientRect.y+rcClientRect.Hgt+cgo.TargetY;
lpDDraw->ApplyZoom(nclx1, ncly1); pDraw->ApplyZoom(nclx1, ncly1);
lpDDraw->ApplyZoom(nclx2, ncly2); pDraw->ApplyZoom(nclx2, ncly2);
fOwnClip = lpDDraw->SetPrimaryClipper(nclx1, ncly1, nclx2, ncly2); fOwnClip = pDraw->SetPrimaryClipper(nclx1, ncly1, nclx2, ncly2);
// get usable height of edit field // get usable height of edit field
int32_t iHgt = pFont->GetLineHeight(), iY0; int32_t iHgt = pFont->GetLineHeight(), iY0;
if (rcClientRect.Hgt <= iHgt) if (rcClientRect.Hgt <= iHgt)
@ -623,10 +623,10 @@ namespace C4GUI
c = pDrawText[iSelEnd]; pDrawText[iSelEnd]=0; pFont->GetTextExtent(pDrawText, iSelX2, h, false); pDrawText[iSelEnd]=c; c = pDrawText[iSelEnd]; pDrawText[iSelEnd]=0; pFont->GetTextExtent(pDrawText, iSelX2, h, false); pDrawText[iSelEnd]=c;
iSelX1 -= iXScroll; iSelX2 -= iXScroll; iSelX1 -= iXScroll; iSelX2 -= iXScroll;
// draw selection box around it // draw selection box around it
lpDDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcClientRect.x+iSelX1,cgo.TargetY+iY0,rcClientRect.x+iSelX2-1+cgo.TargetX,iY0+iHgt-1+cgo.TargetY,0x7f7f7f00); pDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcClientRect.x+iSelX1,cgo.TargetY+iY0,rcClientRect.x+iSelX2-1+cgo.TargetX,iY0+iHgt-1+cgo.TargetY,0x7f7f7f00);
} }
// draw edit text // draw edit text
lpDDraw->TextOut(pDrawText, *pFont, 1.0f, cgo.Surface, rcClientRect.x + cgo.TargetX - iXScroll, iY0 + cgo.TargetY - 1, dwFontClr, ALeft, false); pDraw->TextOut(pDrawText, *pFont, 1.0f, cgo.Surface, rcClientRect.x + cgo.TargetX - iXScroll, iY0 + cgo.TargetY - 1, dwFontClr, ALeft, false);
// draw cursor // draw cursor
if (HasDrawFocus() && !(((dwLastInputTime-GetTime())/500)%2)) if (HasDrawFocus() && !(((dwLastInputTime-GetTime())/500)%2))
{ {
@ -634,13 +634,13 @@ namespace C4GUI
pFont->GetTextExtent(pDrawText, w, h, false); pFont->GetTextExtent(pDrawText, w, h, false);
pDrawText[iCursorPos] = cAtCursor; pDrawText[iCursorPos] = cAtCursor;
pFont->GetTextExtent(CursorRepresentation, wc, h, false); wc/=2; pFont->GetTextExtent(CursorRepresentation, wc, h, false); wc/=2;
lpDDraw->TextOut(CursorRepresentation, *pFont, 1.5f, cgo.Surface, rcClientRect.x + cgo.TargetX + w - wc - iXScroll, iY0 + cgo.TargetY - h/3, dwFontClr, ALeft, false); pDraw->TextOut(CursorRepresentation, *pFont, 1.5f, cgo.Surface, rcClientRect.x + cgo.TargetX + w - wc - iXScroll, iY0 + cgo.TargetY - h/3, dwFontClr, ALeft, false);
} }
// unclip // unclip
if (fOwnClip) if (fOwnClip)
{ {
if (fClip) lpDDraw->SetPrimaryClipper(cx0,cy0,cx1,cy1); if (fClip) pDraw->SetPrimaryClipper(cx0,cy0,cx1,cy1);
else lpDDraw->NoPrimaryClipper(); else pDraw->NoPrimaryClipper();
} }
} }

View File

@ -37,7 +37,7 @@ namespace C4GUI
void Label::DrawElement(C4TargetFacet &cgo) void Label::DrawElement(C4TargetFacet &cgo)
{ {
// print out // print out
lpDDraw->TextOut(sText.getData(), *pFont, 1.0f, cgo.Surface, x0 + cgo.TargetX, rcBounds.y + cgo.TargetY, dwFgClr, iAlign, fMarkup); pDraw->TextOut(sText.getData(), *pFont, 1.0f, cgo.Surface, x0 + cgo.TargetX, rcBounds.y + cgo.TargetY, dwFgClr, iAlign, fMarkup);
} }
Label::Label(const char *szLblText, int32_t iX0, int32_t iTop, int32_t iAlign, DWORD dwFClr, CStdFont *pFont, bool fMakeReadableOnBlack, bool fMarkup) Label::Label(const char *szLblText, int32_t iX0, int32_t iTop, int32_t iAlign, DWORD dwFClr, CStdFont *pFont, bool fMakeReadableOnBlack, bool fMarkup)
@ -174,10 +174,10 @@ namespace C4GUI
iXOff -= iScrollPos; iXOff -= iScrollPos;
} }
// print out text; clipped // print out text; clipped
lpDDraw->StorePrimaryClipper(); pDraw->StorePrimaryClipper();
lpDDraw->SetPrimaryClipper(rcBounds.x + GetLeftIndent() + cgo.TargetX, rcBounds.y + cgo.TargetY, rcBounds.x+rcBounds.Wdt - GetRightIndent() + cgo.TargetX, rcBounds.y+rcBounds.Hgt + cgo.TargetY); pDraw->SetPrimaryClipper(rcBounds.x + GetLeftIndent() + cgo.TargetX, rcBounds.y + cgo.TargetY, rcBounds.x+rcBounds.Wdt - GetRightIndent() + cgo.TargetX, rcBounds.y+rcBounds.Hgt + cgo.TargetY);
lpDDraw->TextOut(sText.getData(), *pFont, 1.0f, cgo.Surface, x0 + cgo.TargetX + iXOff, rcBounds.y + cgo.TargetY + (rcBounds.Hgt-pFont->GetLineHeight())/2-1, dwFgClr, iAlign); pDraw->TextOut(sText.getData(), *pFont, 1.0f, cgo.Surface, x0 + cgo.TargetX + iXOff, rcBounds.y + cgo.TargetY + (rcBounds.Hgt-pFont->GetLineHeight())/2-1, dwFgClr, iAlign);
lpDDraw->RestorePrimaryClipper(); pDraw->RestorePrimaryClipper();
} }
int32_t WoodenLabel::GetDefaultHeight(CStdFont *pUseFont) int32_t WoodenLabel::GetDefaultHeight(CStdFont *pUseFont)
@ -215,7 +215,7 @@ namespace C4GUI
{ {
// get clipping // get clipping
int iClipX, iClipY, iClipX2, iClipY2; int iClipX, iClipY, iClipX2, iClipY2;
lpDDraw->GetPrimaryClipper(iClipX, iClipY, iClipX2, iClipY2); pDraw->GetPrimaryClipper(iClipX, iClipY, iClipX2, iClipY2);
// draw all lines // draw all lines
int32_t iIndex = 0; const char *szLine; int32_t iIndex = 0; const char *szLine;
int32_t iY = rcBounds.y + cgo.TargetY; int32_t iY = rcBounds.y + cgo.TargetY;
@ -230,7 +230,7 @@ namespace C4GUI
if (iY >= iClipY-iFontLineHeight) if (iY >= iClipY-iFontLineHeight)
{ {
// draw line // draw line
lpDDraw->TextOut(szLine, *pLineFont, 1.0f, cgo.Surface, rcBounds.x + cgo.TargetX, iY, dwLineClr, ALeft, fMarkup); pDraw->TextOut(szLine, *pLineFont, 1.0f, cgo.Surface, rcBounds.x + cgo.TargetX, iY, dwLineClr, ALeft, fMarkup);
} }
// advance line // advance line
iY += iFontLineHeight; iY += iFontLineHeight;
@ -292,8 +292,8 @@ namespace C4GUI
// draw horizontal line // draw horizontal line
int32_t iX1 = rcBounds.x + cgo.TargetX, iX2 = iX1 + rcBounds.Wdt, int32_t iX1 = rcBounds.x + cgo.TargetX, iX2 = iX1 + rcBounds.Wdt,
iY = rcBounds.y + cgo.TargetY; iY = rcBounds.y + cgo.TargetY;
lpDDraw->DrawLineDw(cgo.Surface, (float)(iX1+1), (float)(iY+1), (float)(iX2-1), (float)(iY+1), dwShadowClr); pDraw->DrawLineDw(cgo.Surface, (float)(iX1+1), (float)(iY+1), (float)(iX2-1), (float)(iY+1), dwShadowClr);
lpDDraw->DrawLineDw(cgo.Surface, (float)iX1, (float)iY, (float)(iX2-2), (float)iY, dwClr); pDraw->DrawLineDw(cgo.Surface, (float)iX1, (float)iY, (float)(iX2-2), (float)iY, dwClr);
} }
@ -310,12 +310,12 @@ namespace C4GUI
// calc progress width // calc progress width
int32_t iProgressWdt = (rcBounds.Wdt-4) * iProgress / iMax; int32_t iProgressWdt = (rcBounds.Wdt-4) * iProgress / iMax;
// draw progress // draw progress
//lpDDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x+2, cgo.TargetY+rcBounds.y+2, cgo.TargetX+rcBounds.x+iProgressWdt, cgo.TargetY+rcBounds.y+rcBounds.Hgt-2, C4GUI_ProgressBarColor); //pDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x+2, cgo.TargetY+rcBounds.y+2, cgo.TargetX+rcBounds.x+iProgressWdt, cgo.TargetY+rcBounds.y+rcBounds.Hgt-2, C4GUI_ProgressBarColor);
::GraphicsResource.fctProgressBar.DrawX(cgo.Surface, cgo.TargetX+rcBounds.x+2, cgo.TargetY+rcBounds.y+2, iProgressWdt, rcBounds.Hgt-2); ::GraphicsResource.fctProgressBar.DrawX(cgo.Surface, cgo.TargetX+rcBounds.x+2, cgo.TargetY+rcBounds.y+2, iProgressWdt, rcBounds.Hgt-2);
// print out progress text // print out progress text
char szPrg[32+1]; char szPrg[32+1];
sprintf(szPrg, "%i%%", 100 * iProgress / iMax); sprintf(szPrg, "%i%%", 100 * iProgress / iMax);
lpDDraw->TextOut(szPrg, rFont, 1.0f, cgo.Surface, cgo.TargetX+rcBounds.GetMiddleX(), rcBounds.y + cgo.TargetY + (rcBounds.Hgt-rFont.GetLineHeight())/2-1, C4GUI_ProgressBarFontClr, ACenter); pDraw->TextOut(szPrg, rFont, 1.0f, cgo.Surface, cgo.TargetX+rcBounds.GetMiddleX(), rcBounds.y + cgo.TargetY + (rcBounds.Hgt-rFont.GetLineHeight())/2-1, C4GUI_ProgressBarFontClr, ACenter);
} }
@ -529,7 +529,7 @@ namespace C4GUI
void TextWindow::DrawElement(C4TargetFacet &cgo) void TextWindow::DrawElement(C4TargetFacet &cgo)
{ {
// draw background // draw background
if (fDrawBackground) lpDDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x,cgo.TargetY+rcBounds.y,rcBounds.x+rcBounds.Wdt-1+cgo.TargetX,rcBounds.y+rcBounds.Hgt-1+cgo.TargetY,0x7f000000); if (fDrawBackground) pDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x,cgo.TargetY+rcBounds.y,rcBounds.x+rcBounds.Wdt-1+cgo.TargetX,rcBounds.y+rcBounds.Hgt-1+cgo.TargetY,0x7f000000);
// draw frame // draw frame
if (fDrawFrame) Draw3DFrame(cgo); if (fDrawFrame) Draw3DFrame(cgo);
} }

View File

@ -105,7 +105,7 @@ namespace C4GUI
void ListBox::DrawElement(C4TargetFacet &cgo) void ListBox::DrawElement(C4TargetFacet &cgo)
{ {
if (fDrawBackground) if (fDrawBackground)
lpDDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x, cgo.TargetY+rcBounds.y, cgo.TargetX+rcBounds.x+rcBounds.Wdt-1, cgo.TargetY+rcBounds.y+rcBounds.Hgt-1, 0x7f000000); pDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x, cgo.TargetY+rcBounds.y, cgo.TargetX+rcBounds.x+rcBounds.Wdt-1, cgo.TargetY+rcBounds.y+rcBounds.Hgt-1, 0x7f000000);
if (fDrawBorder) Draw3DFrame(cgo); if (fDrawBorder) Draw3DFrame(cgo);
// listbox bg: mark selected item // listbox bg: mark selected item
if (!pClientWindow) return; if (!pClientWindow) return;
@ -123,7 +123,7 @@ namespace C4GUI
rcSelArea.Hgt = Min(rcSelArea.Hgt, GetClientRect().y + GetClientRect().Hgt - rcSelArea.y); rcSelArea.Hgt = Min(rcSelArea.Hgt, GetClientRect().y + GetClientRect().Hgt - rcSelArea.y);
// draw // draw
if (rcSelArea.Hgt>=0) if (rcSelArea.Hgt>=0)
lpDDraw->DrawBoxDw(cgo.Surface, rcSelArea.x+cgo.TargetX, rcSelArea.y+cgo.TargetY, pDraw->DrawBoxDw(cgo.Surface, rcSelArea.x+cgo.TargetX, rcSelArea.y+cgo.TargetY,
rcSelArea.x+rcSelArea.Wdt+cgo.TargetX-1, rcSelArea.y+rcSelArea.Hgt+cgo.TargetY-1, rcSelArea.x+rcSelArea.Wdt+cgo.TargetX-1, rcSelArea.y+rcSelArea.Hgt+cgo.TargetY-1,
HasDrawFocus() ? C4GUI_ListBoxSelColor : C4GUI_ListBoxInactSelColor); HasDrawFocus() ? C4GUI_ListBoxSelColor : C4GUI_ListBoxInactSelColor);
} }
@ -140,7 +140,7 @@ namespace C4GUI
// clip // clip
if (iY < GetClientRect().y || iY >= GetClientRect().y+GetClientRect().Hgt) continue; if (iY < GetClientRect().y || iY >= GetClientRect().y+GetClientRect().Hgt) continue;
// draw // draw
lpDDraw->DrawLineDw(cgo.Surface, (float)(iX0+cgo.TargetX), (float)(iY+cgo.TargetY), (float)(iX1+cgo.TargetX), (float)(iY+cgo.TargetY), C4GUI_ListBoxBarColor); pDraw->DrawLineDw(cgo.Surface, (float)(iX0+cgo.TargetX), (float)(iY+cgo.TargetY), (float)(iX1+cgo.TargetX), (float)(iY+cgo.TargetY), C4GUI_ListBoxBarColor);
} }
} }

View File

@ -54,7 +54,7 @@ namespace C4GUI
} }
// print out label // print out label
if (!!sText) if (!!sText)
lpDDraw->TextOut(sText.getData(), ::GraphicsResource.TextFont, 1.0f, cgo.Surface, cgo.TargetX+rcBounds.x+GetIconIndent(), rcBounds.y + cgo.TargetY, C4GUI_ContextFontClr, ALeft); pDraw->TextOut(sText.getData(), ::GraphicsResource.TextFont, 1.0f, cgo.Surface, cgo.TargetX+rcBounds.x+GetIconIndent(), rcBounds.y + cgo.TargetY, C4GUI_ContextFontClr, ALeft);
// submenu arrow // submenu arrow
if (pSubmenuHandler) if (pSubmenuHandler)
{ {
@ -182,7 +182,7 @@ namespace C4GUI
void ContextMenu::DrawElement(C4TargetFacet &cgo) void ContextMenu::DrawElement(C4TargetFacet &cgo)
{ {
// draw context menu bg // draw context menu bg
lpDDraw->DrawBoxDw(cgo.Surface, rcBounds.x+cgo.TargetX, rcBounds.y+cgo.TargetY, pDraw->DrawBoxDw(cgo.Surface, rcBounds.x+cgo.TargetX, rcBounds.y+cgo.TargetY,
rcBounds.x+rcBounds.Wdt+cgo.TargetX-1, rcBounds.y+rcBounds.Hgt+cgo.TargetY-1, rcBounds.x+rcBounds.Wdt+cgo.TargetX-1, rcBounds.y+rcBounds.Hgt+cgo.TargetY-1,
C4GUI_ContextBGColor); C4GUI_ContextBGColor);
// context bg: mark selected item // context bg: mark selected item
@ -194,7 +194,7 @@ namespace C4GUI
rcSelArea.x += GetClientRect().x; rcSelArea.x += GetClientRect().x;
rcSelArea.y += GetClientRect().y; rcSelArea.y += GetClientRect().y;
// draw // draw
lpDDraw->DrawBoxDw(cgo.Surface, rcSelArea.x+cgo.TargetX, rcSelArea.y+cgo.TargetY, pDraw->DrawBoxDw(cgo.Surface, rcSelArea.x+cgo.TargetX, rcSelArea.y+cgo.TargetY,
rcSelArea.x+rcSelArea.Wdt+cgo.TargetX-1, rcSelArea.y+rcSelArea.Hgt+cgo.TargetY-1, rcSelArea.x+rcSelArea.Wdt+cgo.TargetX-1, rcSelArea.y+rcSelArea.Hgt+cgo.TargetY-1,
C4GUI_ContextSelColor); C4GUI_ContextSelColor);
} }
@ -628,9 +628,9 @@ namespace C4GUI
// draw selection highlight // draw selection highlight
if (HasDrawFocus() || (fMouseOver && IsInActiveDlg(false)) || iOpenMenu) if (HasDrawFocus() || (fMouseOver && IsInActiveDlg(false)) || iOpenMenu)
{ {
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE); pDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
::GraphicsResource.fctButtonHighlight.DrawX(cgo.Surface, x0, y0, rcBounds.Wdt, rcBounds.Hgt); ::GraphicsResource.fctButtonHighlight.DrawX(cgo.Surface, x0, y0, rcBounds.Wdt, rcBounds.Hgt);
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
} }
} }

View File

@ -68,14 +68,14 @@ namespace C4GUI
int32_t iLabelHgt = rUseFont.GetLineHeight(); int32_t iIconLabelSpacing = 2; int32_t iLabelHgt = rUseFont.GetLineHeight(); int32_t iIconLabelSpacing = 2;
int32_t yTop = yCenter - (pfctIcon->Hgt+iIconLabelSpacing+iLabelHgt)/2; int32_t yTop = yCenter - (pfctIcon->Hgt+iIconLabelSpacing+iLabelHgt)/2;
pfctIcon->Draw(cgo.Surface, xCenter-pfctIcon->Wdt/2, yTop, icoTitle); pfctIcon->Draw(cgo.Surface, xCenter-pfctIcon->Wdt/2, yTop, icoTitle);
lpDDraw->TextOut(sTitle.getData(), rUseFont, 1.0f, cgo.Surface, xCenter, yTop + pfctIcon->Hgt+iIconLabelSpacing, fActive ? C4GUI_GfxTabCaptActiveClr : C4GUI_GfxTabCaptInactiveClr , ACenter); pDraw->TextOut(sTitle.getData(), rUseFont, 1.0f, cgo.Surface, xCenter, yTop + pfctIcon->Hgt+iIconLabelSpacing, fActive ? C4GUI_GfxTabCaptActiveClr : C4GUI_GfxTabCaptInactiveClr , ACenter);
} }
// focus highlight // focus highlight
if (fFocus) if (fFocus)
{ {
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE); pDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, (fLarge ? x : x - iTxtWdt/2)+5, y+3, (fLarge ? iMaxWdt : iTxtWdt)-10, iTxtHgt-6); ::GraphicsResource.fctButtonHighlightRound.DrawX(cgo.Surface, (fLarge ? x : x - iTxtWdt/2)+5, y+3, (fLarge ? iMaxWdt : iTxtWdt)-10, iTxtHgt-6);
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
} }
if (!(pfctClip && pfctIcon)) if (!(pfctClip && pfctIcon))
{ {
@ -103,15 +103,15 @@ namespace C4GUI
if (!fLarge && fHasCloseButton) x -= iTxtHgt/2; if (!fLarge && fHasCloseButton) x -= iTxtHgt/2;
uint32_t dwClr = dwCaptionClr; uint32_t dwClr = dwCaptionClr;
if (!dwClr) dwClr = fActive ? C4GUI_CaptionFontClr : C4GUI_InactCaptionFontClr; if (!dwClr) dwClr = fActive ? C4GUI_CaptionFontClr : C4GUI_InactCaptionFontClr;
lpDDraw->TextOut(sTitle.getData(), rUseFont, fLarge ? 1.2f : 1.0f, cgo.Surface, x, y, dwClr, fLarge ? ALeft : ACenter, fTitleMarkup); pDraw->TextOut(sTitle.getData(), rUseFont, fLarge ? 1.2f : 1.0f, cgo.Surface, x, y, dwClr, fLarge ? ALeft : ACenter, fTitleMarkup);
// close button // close button
if (fHasCloseButton) if (fHasCloseButton)
{ {
xo += iTxtWdt / (2 - fLarge) - iTxtHgt + 1; xo += iTxtWdt / (2 - fLarge) - iTxtHgt + 1;
C4Facet cgoCloseBtn(cgo.Surface, xo, y+1, iTxtHgt-2, iTxtHgt-2); C4Facet cgoCloseBtn(cgo.Surface, xo, y+1, iTxtHgt-2, iTxtHgt-2);
if (!fCloseButtonHighlighted) lpDDraw->ActivateBlitModulation(0x7f7f7f); if (!fCloseButtonHighlighted) pDraw->ActivateBlitModulation(0x7f7f7f);
Icon::GetIconFacet(Ico_Close).Draw(cgoCloseBtn); Icon::GetIconFacet(Ico_Close).Draw(cgoCloseBtn);
if (!fCloseButtonHighlighted) lpDDraw->DeactivateBlitModulation(); if (!fCloseButtonHighlighted) pDraw->DeactivateBlitModulation();
} }
} }
} }
@ -386,7 +386,7 @@ namespace C4GUI
x1 = cgo.TargetX + rcBounds.x + rcBounds.Wdt - 1, x1 = cgo.TargetX + rcBounds.x + rcBounds.Wdt - 1,
y1 = cgo.TargetY + rcBounds.y + rcBounds.Hgt - 1; y1 = cgo.TargetY + rcBounds.y + rcBounds.Hgt - 1;
// main area BG // main area BG
if (!fGfx) lpDDraw->DrawBoxDw(cgo.Surface, x0,y0,x1,y1, C4GUI_StandardBGColor); if (!fGfx) pDraw->DrawBoxDw(cgo.Surface, x0,y0,x1,y1, C4GUI_StandardBGColor);
// no tabs? // no tabs?
if (!eTabPos) return; if (!eTabPos) return;
bool fLeft = (eTabPos == tbLeft); bool fLeft = (eTabPos == tbLeft);
@ -425,14 +425,14 @@ namespace C4GUI
vtx[6] = d+iTabWidth; vtx[7] = y0; vtx[6] = d+iTabWidth; vtx[7] = y0;
} }
DWORD dwClr = (pSheet == pActiveSheet) ? C4GUI_ActiveTabBGColor : C4GUI_StandardBGColor; DWORD dwClr = (pSheet == pActiveSheet) ? C4GUI_ActiveTabBGColor : C4GUI_StandardBGColor;
lpDDraw->DrawQuadDw(cgo.Surface, vtx, dwClr, dwClr, dwClr, dwClr); pDraw->DrawQuadDw(cgo.Surface, vtx, dwClr, dwClr, dwClr, dwClr);
// draw caption frame // draw caption frame
lpDDraw->DrawLineDw(cgo.Surface, (float)vtx[0]-1 , (float)vtx[1] , (float)vtx[2]-1 ,(float)vtx[3] , C4GUI_BorderColorA1); pDraw->DrawLineDw(cgo.Surface, (float)vtx[0]-1 , (float)vtx[1] , (float)vtx[2]-1 ,(float)vtx[3] , C4GUI_BorderColorA1);
lpDDraw->DrawLineDw(cgo.Surface, (float)vtx[2]-1 , (float)vtx[3] , (float)vtx[4]-fLeft,(float)vtx[5] , C4GUI_BorderColorA1); pDraw->DrawLineDw(cgo.Surface, (float)vtx[2]-1 , (float)vtx[3] , (float)vtx[4]-fLeft,(float)vtx[5] , C4GUI_BorderColorA1);
lpDDraw->DrawLineDw(cgo.Surface, (float)vtx[4] , (float)vtx[5] , (float)vtx[6] ,(float)vtx[7] , C4GUI_BorderColorA1); pDraw->DrawLineDw(cgo.Surface, (float)vtx[4] , (float)vtx[5] , (float)vtx[6] ,(float)vtx[7] , C4GUI_BorderColorA1);
lpDDraw->DrawLineDw(cgo.Surface, (float)vtx[0] , (float)vtx[1]+fLeft, (float)vtx[2] ,(float)vtx[3]+fLeft , C4GUI_BorderColorA2); pDraw->DrawLineDw(cgo.Surface, (float)vtx[0] , (float)vtx[1]+fLeft, (float)vtx[2] ,(float)vtx[3]+fLeft , C4GUI_BorderColorA2);
lpDDraw->DrawLineDw(cgo.Surface, (float)vtx[2]-!fLeft, (float)vtx[3]+1 , (float)vtx[4] ,(float)vtx[5]+!fLeft , C4GUI_BorderColorA2); pDraw->DrawLineDw(cgo.Surface, (float)vtx[2]-!fLeft, (float)vtx[3]+1 , (float)vtx[4] ,(float)vtx[5]+!fLeft , C4GUI_BorderColorA2);
lpDDraw->DrawLineDw(cgo.Surface, (float)vtx[4]+1 , (float)vtx[5]+fLeft, (float)vtx[6] ,(float)vtx[7]+fLeft , C4GUI_BorderColorA2); pDraw->DrawLineDw(cgo.Surface, (float)vtx[4]+1 , (float)vtx[5]+fLeft, (float)vtx[6] ,(float)vtx[7]+fLeft , C4GUI_BorderColorA2);
} }
// draw caption text // draw caption text
int32_t iCptTextX = fLeft ? (x0-GetLeftSize()+10) : (d+iTabWidth/2); int32_t iCptTextX = fLeft ? (x0-GetLeftSize()+10) : (d+iTabWidth/2);
@ -456,10 +456,10 @@ namespace C4GUI
// draw tab border line across everything but active tab // draw tab border line across everything but active tab
if (!fGfx) if (ad0||ad1) if (!fGfx) if (ad0||ad1)
{ {
lpDDraw->DrawLineDw(cgo.Surface, (float)x0 ,(float)y0 ,(float)(fLeft ? x0 : ad0), (float)(fLeft ? ad0 : y0), C4GUI_BorderColorA1); pDraw->DrawLineDw(cgo.Surface, (float)x0 ,(float)y0 ,(float)(fLeft ? x0 : ad0), (float)(fLeft ? ad0 : y0), C4GUI_BorderColorA1);
lpDDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y0+1),(float)((fLeft ? x0 : ad0)+1), (float)((fLeft ? ad0 : y0)+1) , C4GUI_BorderColorA2); pDraw->DrawLineDw(cgo.Surface, (float)(x0+1),(float)(y0+1),(float)((fLeft ? x0 : ad0)+1), (float)((fLeft ? ad0 : y0)+1) , C4GUI_BorderColorA2);
lpDDraw->DrawLineDw(cgo.Surface, (float)(fLeft ? x0 : ad1), (float)(fLeft ? ad1 : y0), (float)(fLeft ? x0 : x1), (float)(fLeft ? y1 : y0), C4GUI_BorderColorA1); pDraw->DrawLineDw(cgo.Surface, (float)(fLeft ? x0 : ad1), (float)(fLeft ? ad1 : y0), (float)(fLeft ? x0 : x1), (float)(fLeft ? y1 : y0), C4GUI_BorderColorA1);
lpDDraw->DrawLineDw(cgo.Surface, (float)((fLeft ? x0 : ad1)+1), (float)((fLeft ? ad1 : y0)+1), (float)((fLeft ? x0 : x1)+1), (float)((fLeft ? y1 : y0)+1), C4GUI_BorderColorA2); pDraw->DrawLineDw(cgo.Surface, (float)((fLeft ? x0 : ad1)+1), (float)((fLeft ? ad1 : y0)+1), (float)((fLeft ? x0 : x1)+1), (float)((fLeft ? y1 : y0)+1), C4GUI_BorderColorA2);
} }
// main area bg in gfx: Atop inactive tabs // main area bg in gfx: Atop inactive tabs
if (fGfx) if (fGfx)

View File

@ -142,7 +142,7 @@ void C4LoaderScreen::Draw(C4Facet &cgo, int iProgress, C4LogBuffer *pLog, int Pr
// simple black screen loader? // simple black screen loader?
if (fBlackScreen) if (fBlackScreen)
{ {
lpDDraw->FillBG(); pDraw->FillBG();
return; return;
} }
// cgo.X/Y is assumed 0 here... // cgo.X/Y is assumed 0 here...
@ -159,13 +159,13 @@ void C4LoaderScreen::Draw(C4Facet &cgo, int iProgress, C4LogBuffer *pLog, int Pr
// Background (loader) // Background (loader)
fctBackground.DrawFullScreen(cgo); fctBackground.DrawFullScreen(cgo);
// draw scenario title // draw scenario title
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); pDraw->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 // draw info
/*if (szInfo) /*if (szInfo)
lpDDraw->TextOutDw(szInfo, cgo.Surface, cgo.Wdt/2, cgo.Hgt/2+20);*/ pDraw->TextOutDw(szInfo, cgo.Surface, cgo.Wdt/2, cgo.Hgt/2+20);*/
// //
// draw progress bar // draw progress bar
lpDDraw->DrawBoxDw(cgo.Surface, iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-iProgressBarHgt, cgo.Wdt-iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin, 0xb0000000); pDraw->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; int iProgressBarWdt=cgo.Wdt-iHIndent*2-2;
if (::GraphicsResource.fctProgressBar.Surface) if (::GraphicsResource.fctProgressBar.Surface)
{ {
@ -173,15 +173,15 @@ void C4LoaderScreen::Draw(C4Facet &cgo, int iProgress, C4LogBuffer *pLog, int Pr
} }
else else
{ {
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); pDraw->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->StringOut(FormatString("%i%%", iProgress).getData(), rProgressBarFont, 1.0f, cgo.Surface, pDraw->StringOut(FormatString("%i%%", iProgress).getData(), rProgressBarFont, 1.0f, cgo.Surface,
cgo.Wdt/2, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-rProgressBarFont.iLineHgt/2-iProgressBarHgt/2, 0xffffffff, cgo.Wdt/2, cgo.Hgt-iVIndent-iLogBoxHgt-iVMargin-rProgressBarFont.iLineHgt/2-iProgressBarHgt/2, 0xffffffff,
ACenter, true); ACenter, true);
// draw log box // draw log box
if (pLog) if (pLog)
{ {
lpDDraw->DrawBoxDw(cgo.Surface, iHIndent, cgo.Hgt-iVIndent-iLogBoxHgt, cgo.Wdt-iHIndent, cgo.Hgt-iVIndent, 0x7f000000); pDraw->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 iLineHgt=int(fLogBoxFontZoom*LogFont.iLineHgt); if (!iLineHgt) iLineHgt=5;
int iLinesVisible = (iLogBoxHgt-2*iLogBoxMargin)/iLineHgt; int iLinesVisible = (iLogBoxHgt-2*iLogBoxMargin)/iLineHgt;
int iX = iHIndent+iLogBoxMargin; int iX = iHIndent+iLogBoxMargin;
@ -192,14 +192,14 @@ void C4LoaderScreen::Draw(C4Facet &cgo, int iProgress, C4LogBuffer *pLog, int Pr
const char *szLine = pLog->GetLine(i, NULL, NULL, NULL); const char *szLine = pLog->GetLine(i, NULL, NULL, NULL);
if (!szLine || !*szLine) continue; if (!szLine || !*szLine) continue;
LogFont.GetTextExtent(szLine, w,h, true); LogFont.GetTextExtent(szLine, w,h, true);
lpDDraw->TextOut(szLine,LogFont,fLogBoxFontZoom,cgo.Surface,iX,iY); pDraw->TextOut(szLine,LogFont,fLogBoxFontZoom,cgo.Surface,iX,iY);
iY += h; iY += h;
} }
// append process text // append process text
if (Process) if (Process)
{ {
iY -= h; iX += w; iY -= h; iX += w;
lpDDraw->TextOut(FormatString("%i%%", (int) Process).getData(),LogFont,fLogBoxFontZoom,cgo.Surface,iX,iY); pDraw->TextOut(FormatString("%i%%", (int) Process).getData(),LogFont,fLogBoxFontZoom,cgo.Surface,iX,iY);
} }
} }
} }

View File

@ -129,7 +129,7 @@ void C4MenuItem::DrawElement(C4TargetFacet &cgo)
// Select mark // Select mark
if (iStyle!=C4MN_Style_Info) if (iStyle!=C4MN_Style_Info)
if (fSelected && TextDisplayProgress) if (fSelected && TextDisplayProgress)
lpDDraw->DrawBoxDw(cgo.Surface, cgoOut.X, cgoOut.Y, cgoOut.X + cgoOut.Wdt - 1, cgoOut.Y + cgoOut.Hgt - 1, C4RGB(0xca, 0, 0)); pDraw->DrawBoxDw(cgo.Surface, cgoOut.X, cgoOut.Y, cgoOut.X + cgoOut.Wdt - 1, cgoOut.Y + cgoOut.Hgt - 1, C4RGB(0xca, 0, 0));
// Symbol/text areas // Symbol/text areas
C4Facet cgoItemSymbol,cgoItemText; C4Facet cgoItemSymbol,cgoItemText;
cgoItemSymbol=cgoItemText=cgoOut; cgoItemSymbol=cgoItemText=cgoOut;
@ -143,17 +143,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) // 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); if (Symbol.Surface && TextDisplayProgress) Symbol.DrawClr(cgoItemSymbol, true, dwSymbolClr);
// Draw item text // Draw item text
lpDDraw->StorePrimaryClipper(); lpDDraw->SubPrimaryClipper(cgoItemText.X, cgoItemText.Y, cgoItemText.X+cgoItemText.Wdt-1, cgoItemText.Y+cgoItemText.Hgt-1); pDraw->StorePrimaryClipper(); pDraw->SubPrimaryClipper(cgoItemText.X, cgoItemText.Y, cgoItemText.X+cgoItemText.Wdt-1, cgoItemText.Y+cgoItemText.Hgt-1);
switch (iStyle) switch (iStyle)
{ {
case C4MN_Style_Context: case C4MN_Style_Context:
lpDDraw->TextOut(Caption,::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y,CStdDDraw::DEFAULT_MESSAGE_COLOR,ALeft); pDraw->TextOut(Caption,::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y,CStdDDraw::DEFAULT_MESSAGE_COLOR,ALeft);
break; break;
case C4MN_Style_Info: case C4MN_Style_Info:
{ {
StdStrBuf sText; StdStrBuf sText;
::GraphicsResource.FontRegular.BreakMessage(InfoCaption, cgoItemText.Wdt, &sText, true); ::GraphicsResource.FontRegular.BreakMessage(InfoCaption, cgoItemText.Wdt, &sText, true);
lpDDraw->TextOut(sText.getData(), ::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y); pDraw->TextOut(sText.getData(), ::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y);
break; break;
} }
case C4MN_Style_Dialog: case C4MN_Style_Dialog:
@ -169,19 +169,19 @@ void C4MenuItem::DrawElement(C4TargetFacet &cgo)
// display broken text // display broken text
StdStrBuf sText; StdStrBuf sText;
::GraphicsResource.FontRegular.BreakMessage(Caption, cgoItemText.Wdt, &sText, true); ::GraphicsResource.FontRegular.BreakMessage(Caption, cgoItemText.Wdt, &sText, true);
lpDDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y); pDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y);
// restore complete text // restore complete text
if (cXChg) Caption[iStopPos] = cXChg; if (cXChg) Caption[iStopPos] = cXChg;
break; break;
} }
} }
lpDDraw->RestorePrimaryClipper(); pDraw->RestorePrimaryClipper();
// Draw count // Draw count
if (Count!=C4MN_Item_NoCount) if (Count!=C4MN_Item_NoCount)
{ {
char szCount[10+1]; char szCount[10+1];
sprintf(szCount,"%ix",Count); sprintf(szCount,"%ix",Count);
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); pDraw->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);
} }
} }
@ -828,8 +828,8 @@ void C4Menu::DrawElement(C4TargetFacet &cgo)
// Store and clear global clipper // Store and clear global clipper
// int32_t iX1,iY1,iX2,iY2; // int32_t iX1,iY1,iX2,iY2;
// lpDDraw->GetPrimaryClipper(iX1,iY1,iX2,iY2); // pDraw->GetPrimaryClipper(iX1,iY1,iX2,iY2);
// lpDDraw->SubPrimaryClipper(rcBounds.x, rcBounds.y, rcBounds.x+rcBounds.Wdt-1, rcBounds.y+rcBounds.Hgt-1); // pDraw->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); C4Facet cgoExtra(cgo.Surface, cgo.TargetX+rcBounds.x+1, cgo.TargetY+rcBounds.y+rcBounds.Hgt-C4MN_SymbolSize-1, rcBounds.Wdt-2, C4MN_SymbolSize);
@ -853,12 +853,12 @@ void C4Menu::DrawElement(C4TargetFacet &cgo)
} }
// Restore global clipper // Restore global clipper
//lpDDraw->SetPrimaryClipper(iX1,iY1,iX2,iY2); //pDraw->SetPrimaryClipper(iX1,iY1,iX2,iY2);
} }
void C4Menu::DrawFrame(C4Surface * sfcSurface, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt) void C4Menu::DrawFrame(C4Surface * sfcSurface, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt)
{ {
lpDDraw->DrawFrameDw(sfcSurface, iX+1, iY+1, iX+iWdt-1,iY+iHgt-1, C4RGB(0x44, 0, 0)); pDraw->DrawFrameDw(sfcSurface, iX+1, iY+1, iX+iWdt-1,iY+iHgt-1, C4RGB(0x44, 0, 0));
} }
void C4Menu::SetAlignment(int32_t iAlignment) void C4Menu::SetAlignment(int32_t iAlignment)

View File

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

View File

@ -393,7 +393,7 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
int32_t iOffsetX,iOffsetY; int32_t iOffsetX,iOffsetY;
ZoomData GuiZoom; ZoomData GuiZoom;
lpDDraw->GetZoom(&GuiZoom); pDraw->GetZoom(&GuiZoom);
// Hidden // Hidden
if (!Visible || !fMouseOwned) return; if (!Visible || !fMouseOwned) return;
@ -442,7 +442,7 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
float XDraw, YDraw, ZoomDraw; float XDraw, YDraw, ZoomDraw;
if (fIsGameZoom) if (fIsGameZoom)
{ {
lpDDraw->SetZoom(GameZoom); pDraw->SetZoom(GameZoom);
XDraw = GameX; YDraw = GameY; XDraw = GameX; YDraw = GameY;
ZoomDraw = 1.0f; ZoomDraw = 1.0f;
// for drag construct: draw rounded to game pixels, because construction site will be placed at rounded game pixel positions // for drag construct: draw rounded to game pixels, because construction site will be placed at rounded game pixel positions
@ -454,22 +454,22 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
XDraw = GuiX; YDraw = GuiY; XDraw = GuiX; YDraw = GuiY;
} }
// draw in special modulation mode // draw in special modulation mode
lpDDraw->SetBlitMode(C4GFXBLIT_MOD2); pDraw->SetBlitMode(C4GFXBLIT_MOD2);
// draw DragImage in red or green, according to the phase to be used // draw DragImage in red or green, according to the phase to be used
iOffsetX=int(ZoomDraw*DragImage.Wdt/2); iOffsetX=int(ZoomDraw*DragImage.Wdt/2);
if (Drag == C4MC_Drag_Construct) if (Drag == C4MC_Drag_Construct)
iOffsetY=int(ZoomDraw*DragImage.Hgt); iOffsetY=int(ZoomDraw*DragImage.Hgt);
else else
iOffsetY=int(ZoomDraw*DragImage.Hgt/2); iOffsetY=int(ZoomDraw*DragImage.Hgt/2);
lpDDraw->ActivateBlitModulation((Drag == C4MC_Drag_Script) ? 0x7fffffff : (DragImagePhase ? 0x8f7f0000 : 0x1f007f00)); pDraw->ActivateBlitModulation((Drag == C4MC_Drag_Script) ? 0x7fffffff : (DragImagePhase ? 0x8f7f0000 : 0x1f007f00));
lpDDraw->Blit(DragImage.Surface, pDraw->Blit(DragImage.Surface,
float(DragImage.X), float(DragImage.Y), float(DragImage.Wdt), float(DragImage.Hgt), float(DragImage.X), float(DragImage.Y), float(DragImage.Wdt), float(DragImage.Hgt),
cgo.Surface, cgo.Surface,
XDraw + cgo.X - iOffsetX, YDraw + cgo.Y - iOffsetY, float(DragImage.Wdt)*ZoomDraw, float(DragImage.Hgt)*ZoomDraw,true); XDraw + cgo.X - iOffsetX, YDraw + cgo.Y - iOffsetY, float(DragImage.Wdt)*ZoomDraw, float(DragImage.Hgt)*ZoomDraw,true);
// reset color // reset color
lpDDraw->DeactivateBlitModulation(); pDraw->DeactivateBlitModulation();
lpDDraw->SetBlitMode(0); pDraw->SetBlitMode(0);
if (fIsGameZoom) lpDDraw->SetZoom(GuiZoom); if (fIsGameZoom) pDraw->SetZoom(GuiZoom);
// reset cursor hotspot offset for script drawing // reset cursor hotspot offset for script drawing
iOffsetX = GfxR->fctMouseCursor.Wdt/2; iOffsetX = GfxR->fctMouseCursor.Wdt/2;
iOffsetY = GfxR->fctMouseCursor.Hgt/2; iOffsetY = GfxR->fctMouseCursor.Hgt/2;
@ -493,7 +493,7 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------
case C4MC_Drag_Selecting: case C4MC_Drag_Selecting:
// Draw frame // Draw frame
lpDDraw->DrawFrameDw(cgo.Surface, pDraw->DrawFrameDw(cgo.Surface,
int32_t(cgo.X + GuiX), int32_t(cgo.X + GuiX),
int32_t(cgo.Y + GuiY), int32_t(cgo.Y + GuiY),
int32_t(cgo.X + (DownX - cgo.TargetX) * GameZoom.Zoom / GuiZoom.Zoom), int32_t(cgo.X + (DownX - cgo.TargetX) * GameZoom.Zoom / GuiZoom.Zoom),
@ -517,7 +517,7 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom)
// Otherwise red mouse control style // Otherwise red mouse control style
int32_t iWdt,iHgt; int32_t iWdt,iHgt;
::GraphicsResource.FontRegular.GetTextExtent(Caption.getData(), iWdt, iHgt, true); ::GraphicsResource.FontRegular.GetTextExtent(Caption.getData(), iWdt, iHgt, true);
lpDDraw->TextOut(Caption.getData(), ::GraphicsResource.FontRegular, 1.0, pDraw->TextOut(Caption.getData(), ::GraphicsResource.FontRegular, 1.0,
cgo.Surface, cgo.Surface,
float(cgo.X)+BoundBy<float>(GuiX,float(iWdt)/2+1,float(cgo.Wdt)-iWdt/2-1), 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)), float(cgo.Y)+Min<float>( CaptionBottomY ? float(CaptionBottomY-iHgt-1) : GuiY+13, float(cgo.Hgt-iHgt)),

View File

@ -71,7 +71,7 @@ bool C4PlayerInfoListBox::ListItem::CanLocalChooseTeams(int32_t idPlayer) const
void C4PlayerInfoListBox::ListItem::DrawElement(C4TargetFacet &cgo) void C4PlayerInfoListBox::ListItem::DrawElement(C4TargetFacet &cgo)
{ {
if (dwBackground) lpDDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x, cgo.TargetY+rcBounds.y, cgo.TargetX+rcBounds.x+rcBounds.Wdt-1, cgo.TargetY+rcBounds.y+rcBounds.Hgt-1, dwBackground); if (dwBackground) pDraw->DrawBoxDw(cgo.Surface, cgo.TargetX+rcBounds.x, cgo.TargetY+rcBounds.y, cgo.TargetX+rcBounds.x+rcBounds.Wdt-1, cgo.TargetY+rcBounds.y+rcBounds.Hgt-1, dwBackground);
typedef C4GUI::Window BaseClass; typedef C4GUI::Window BaseClass;
BaseClass::DrawElement(cgo); BaseClass::DrawElement(cgo);
} }
@ -309,10 +309,10 @@ void C4PlayerInfoListBox::PlayerListItem::UpdateIcon(C4PlayerInfo *pInfo, C4Play
fctDraw.Wdt = iSizeMax/2; fctDraw.Wdt = iSizeMax/2;
fctDraw.X = 2; fctDraw.X = 2;
// shadow // shadow
DWORD dwPrevMod; bool fPrevMod = lpDDraw->GetBlitModulation(dwPrevMod); DWORD dwPrevMod; bool fPrevMod = pDraw->GetBlitModulation(dwPrevMod);
lpDDraw->ActivateBlitModulation(1); pDraw->ActivateBlitModulation(1);
::GraphicsResource.fctCrewClr.DrawClr(fctDraw, true, dwJoinedInfoClr); ::GraphicsResource.fctCrewClr.DrawClr(fctDraw, true, dwJoinedInfoClr);
if (fPrevMod) lpDDraw->ActivateBlitModulation(dwPrevMod); else lpDDraw->DeactivateBlitModulation(); if (fPrevMod) pDraw->ActivateBlitModulation(dwPrevMod); else pDraw->DeactivateBlitModulation();
fctDraw.X = 0; fctDraw.X = 0;
// gfx // gfx
::GraphicsResource.fctCrewClr.DrawClr(fctDraw, true, dwJoinedInfoClr); ::GraphicsResource.fctCrewClr.DrawClr(fctDraw, true, dwJoinedInfoClr);

View File

@ -421,7 +421,7 @@ void C4ScoreboardDlg::DrawElement(C4TargetFacet &cgo)
{ {
const char *szText = pBrd->GetCell(iCol, iRow)->Text.getData(); const char *szText = pBrd->GetCell(iCol, iRow)->Text.getData();
if (szText && *szText && (iRow || iCol)) if (szText && *szText && (iRow || iCol))
lpDDraw->TextOut(szText, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, iCol ? iX + piColWidths[iCol]/2 : iX, iY, 0xffffffff, iCol ? ACenter : ALeft); pDraw->TextOut(szText, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, iCol ? iX + piColWidths[iCol]/2 : iX, iY, 0xffffffff, iCol ? ACenter : ALeft);
iX += piColWidths[iCol]; iX += piColWidths[iCol];
} }
iY += ::GraphicsResource.FontRegular.GetLineHeight() + YIndent; iY += ::GraphicsResource.FontRegular.GetLineHeight() + YIndent;

View File

@ -90,7 +90,7 @@ void C4StartupAboutDlg::DrawElement(C4TargetFacet &cgo)
{ {
// draw background - do not use bg drawing proc, because it stretches // draw background - do not use bg drawing proc, because it stretches
// pre-clear background instead to prevent blinking borders // pre-clear background instead to prevent blinking borders
if (!IsFading()) lpDDraw->FillBG(); if (!IsFading()) pDraw->FillBG();
C4Startup::Get()->Graphics.fctAboutBG.Draw(cgo, false); C4Startup::Get()->Graphics.fctAboutBG.Draw(cgo, false);
} }

View File

@ -117,7 +117,7 @@ void C4StartupMainDlg::DrawElement(C4TargetFacet &cgo)
// draw version info // draw version info
StdStrBuf sVer; StdStrBuf sVer;
sVer.Format(LoadResStr("IDS_DLG_VERSION"), C4VERSION); sVer.Format(LoadResStr("IDS_DLG_VERSION"), C4VERSION);
lpDDraw->TextOut(sVer.getData(), ::GraphicsResource.TextFont, 1.0f, cgo.Surface, rcBounds.Wdt*1/40, rcBounds.Hgt*38/40, 0xffffffff, ALeft, true); pDraw->TextOut(sVer.getData(), ::GraphicsResource.TextFont, 1.0f, cgo.Surface, rcBounds.Wdt*1/40, rcBounds.Hgt*38/40, 0xffffffff, ALeft, true);
} }
C4GUI::ContextMenu *C4StartupMainDlg::OnPlayerSelContext(C4GUI::Element *pBtn, int32_t iX, int32_t iY) C4GUI::ContextMenu *C4StartupMainDlg::OnPlayerSelContext(C4GUI::Element *pBtn, int32_t iX, int32_t iY)

View File

@ -101,7 +101,7 @@ void C4StartupNetListEntry::DrawElement(C4TargetFacet &cgo)
{ {
int32_t x1 = cgo.X+cgo.TargetX+rcBounds.x; int32_t x1 = cgo.X+cgo.TargetX+rcBounds.x;
int32_t y1 = cgo.Y+cgo.TargetY+rcBounds.y; int32_t y1 = cgo.Y+cgo.TargetY+rcBounds.y;
lpDDraw->DrawBoxDw(cgo.Surface, x1,y1, x1+rcBounds.Wdt, y1+rcBounds.Hgt, C4GUI_ImportantBGColor); pDraw->DrawBoxDw(cgo.Surface, x1,y1, x1+rcBounds.Wdt, y1+rcBounds.Hgt, C4GUI_ImportantBGColor);
} }
// inherited // inherited
ParentClass::DrawElement(cgo); ParentClass::DrawElement(cgo);

View File

@ -56,21 +56,21 @@ void C4StartupOptionsDlg::SmallButton::DrawElement(C4TargetFacet &cgo)
float iDrawQuadLeft[8] = { x0,y0, x0+iIndent,y0, x0+iIndent,y1-iIndent, x0,y1 }; float iDrawQuadLeft[8] = { x0,y0, x0+iIndent,y0, x0+iIndent,y1-iIndent, x0,y1 };
float iDrawQuadRight[8] = { x1,y0, x1,y1, x1-iIndent,y1, x1-iIndent,y0+iIndent }; float iDrawQuadRight[8] = { x1,y0, x1,y1, x1-iIndent,y1, x1-iIndent,y0+iIndent };
float iDrawQuadBottom[8] = { x1,y1, x0,y1, x0+iIndent,y1-iIndent, x1,y1-iIndent }; float iDrawQuadBottom[8] = { x1,y1, x0,y1, x0+iIndent,y1-iIndent, x1,y1-iIndent };
lpDDraw->DrawQuadDw(cgo.Surface, iDrawQuadTop, dwClrHigh,dwClrHigh,dwClrHigh,dwClrHigh); pDraw->DrawQuadDw(cgo.Surface, iDrawQuadTop, dwClrHigh,dwClrHigh,dwClrHigh,dwClrHigh);
lpDDraw->DrawQuadDw(cgo.Surface, iDrawQuadLeft, dwClrHigh,dwClrHigh,dwClrHigh,dwClrHigh); pDraw->DrawQuadDw(cgo.Surface, iDrawQuadLeft, dwClrHigh,dwClrHigh,dwClrHigh,dwClrHigh);
lpDDraw->DrawQuadDw(cgo.Surface, iDrawQuadRight, dwClrLow,dwClrLow,dwClrLow,dwClrLow); pDraw->DrawQuadDw(cgo.Surface, iDrawQuadRight, dwClrLow,dwClrLow,dwClrLow,dwClrLow);
lpDDraw->DrawQuadDw(cgo.Surface, iDrawQuadBottom, dwClrLow,dwClrLow,dwClrLow,dwClrLow); pDraw->DrawQuadDw(cgo.Surface, iDrawQuadBottom, dwClrLow,dwClrLow,dwClrLow,dwClrLow);
//lpDDraw->DrawFrameDw(cgo.Surface, x0+1, y0+1, x1-1, y1-1, aC4StartupBtnBorderColor2); //pDraw->DrawFrameDw(cgo.Surface, x0+1, y0+1, x1-1, y1-1, aC4StartupBtnBorderColor2);
// draw selection highlight // draw selection highlight
int32_t iTxtOff = fDown ? iIndent : 0; int32_t iTxtOff = fDown ? iIndent : 0;
if (fEnabled) if (HasDrawFocus() || (fMouseOver && IsInActiveDlg(false))) if (fEnabled) if (HasDrawFocus() || (fMouseOver && IsInActiveDlg(false)))
{ {
lpDDraw->SetBlitMode(C4GFXBLIT_ADDITIVE); pDraw->SetBlitMode(C4GFXBLIT_ADDITIVE);
::GraphicsResource.fctButtonHighlight.DrawX(cgo.Surface, x0+5+iTxtOff, y0+3+iTxtOff, rcBounds.Wdt-10, rcBounds.Hgt-6); ::GraphicsResource.fctButtonHighlight.DrawX(cgo.Surface, x0+5+iTxtOff, y0+3+iTxtOff, rcBounds.Wdt-10, rcBounds.Hgt-6);
lpDDraw->ResetBlitMode(); pDraw->ResetBlitMode();
} }
// draw button text // draw button text
lpDDraw->TextOut(sText.getData(), rUseFont, 1.0f, cgo.Surface, (x0+x1)/2 + iTxtOff, (y0+y1-iTextHgt)/2 + iTxtOff, C4StartupBtnFontClr, ACenter, true); pDraw->TextOut(sText.getData(), rUseFont, 1.0f, cgo.Surface, (x0+x1)/2 + iTxtOff, (y0+y1-iTextHgt)/2 + iTxtOff, C4StartupBtnFontClr, ACenter, true);
} }
int32_t C4StartupOptionsDlg::SmallButton::GetDefaultButtonHeight() int32_t C4StartupOptionsDlg::SmallButton::GetDefaultButtonHeight()
@ -1170,7 +1170,7 @@ bool C4StartupOptionsDlg::OnGfxMSComboSelChange(C4GUI::ComboBox *pForCombo, int3
{ {
if(pTexMgr) pTexMgr->IntLock(); if(pTexMgr) pTexMgr->IntLock();
#ifdef USE_GL #ifdef USE_GL
lpDDraw->InvalidateDeviceObjects(); pDraw->InvalidateDeviceObjects();
// Note: This assumes there is only one GL context (the main context). This // Note: This assumes there is only one GL context (the main context). This
// is true in fullscreen mode, and since the startup dlg is only shown in // is true in fullscreen mode, and since the startup dlg is only shown in
// fullscreen mode we are safe this way. // fullscreen mode we are safe this way.
@ -1182,7 +1182,7 @@ bool C4StartupOptionsDlg::OnGfxMSComboSelChange(C4GUI::ComboBox *pForCombo, int3
// stops until the Window is being moved again (or tasked-out and back in // stops until the Window is being moved again (or tasked-out and back in
// in fullscreen mode). This does not happen when only reinitializing the // in fullscreen mode). This does not happen when only reinitializing the
// GL context instead of whole DDraw so that's why we do this currently. // GL context instead of whole DDraw so that's why we do this currently.
if(pD3D) lpDDraw->Clear(); if(pD3D) pDraw->Clear();
#endif #endif
int32_t PrevMultiSampling = Config.Graphics.MultiSampling; int32_t PrevMultiSampling = Config.Graphics.MultiSampling;
@ -1191,12 +1191,12 @@ bool C4StartupOptionsDlg::OnGfxMSComboSelChange(C4GUI::ComboBox *pForCombo, int3
#ifdef USE_GL #ifdef USE_GL
if(pGL) pGL->pMainCtx->Init(Application.pWindow, &Application); if(pGL) pGL->pMainCtx->Init(Application.pWindow, &Application);
lpDDraw->RestoreDeviceObjects(); pDraw->RestoreDeviceObjects();
#endif #endif
#ifdef USE_DIRECTX #ifdef USE_DIRECTX
// Note: Editor is hardcoded to false at this point... I guess that's OK // Note: Editor is hardcoded to false at this point... I guess that's OK
// because C4StartupOptionsDlg is never shown in editor mode anyway. // because C4StartupOptionsDlg is never shown in editor mode anyway.
if(pD3D) lpDDraw->Init(&Application, false, false, Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.BitDepth, Config.Graphics.Monitor); if(pD3D) pDraw->Init(&Application, false, false, Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.BitDepth, Config.Graphics.Monitor);
#endif #endif
if(pTexMgr) pTexMgr->IntUnlock(); if(pTexMgr) pTexMgr->IntUnlock();
@ -1537,9 +1537,9 @@ void C4StartupOptionsDlg::SaveGfxTroubleshoot()
// get config set to be used // get config set to be used
bool fUseGL = (Config.Graphics.Engine == GFXENGN_OPENGL); bool fUseGL = (Config.Graphics.Engine == GFXENGN_OPENGL);
// and apply them directly, if the engine is current // and apply them directly, if the engine is current
if (fUseGL == lpDDraw->IsOpenGL()) if (fUseGL == pDraw->IsOpenGL())
{ {
lpDDraw->RestoreDeviceObjects(); pDraw->RestoreDeviceObjects();
} }
} }

View File

@ -156,7 +156,7 @@ bool C4MapFolderData::Load(C4Group &hGroup, C4ScenarioListLoader::Folder *pScenL
C4FacetSurface fctDump; bool fSuccess=false; C4FacetSurface fctDump; bool fSuccess=false;
if (fctDump.Create(pScen->rcOverlayPos.Wdt, pScen->rcOverlayPos.Hgt, C4FCT_Full, C4FCT_Full)) if (fctDump.Create(pScen->rcOverlayPos.Wdt, pScen->rcOverlayPos.Hgt, C4FCT_Full, C4FCT_Full))
{ {
lpDDraw->Blit(fctBackgroundPicture.Surface, pDraw->Blit(fctBackgroundPicture.Surface,
(float) pScen->rcOverlayPos.x, (float) pScen->rcOverlayPos.y, (float) pScen->rcOverlayPos.x, (float) pScen->rcOverlayPos.y,
(float) pScen->rcOverlayPos.Wdt, (float) pScen->rcOverlayPos.Hgt, (float) pScen->rcOverlayPos.Wdt, (float) pScen->rcOverlayPos.Hgt,
fctDump.Surface, fctDump.Surface,

View File

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

View File

@ -174,12 +174,12 @@ void C4Viewport::DrawMenu(C4TargetFacet &cgo0)
cgo.Wdt = cgo0.Wdt * cgo0.Zoom; cgo.Hgt = cgo0.Hgt * cgo0.Zoom; cgo.Wdt = cgo0.Wdt * cgo0.Zoom; cgo.Hgt = cgo0.Hgt * cgo0.Zoom;
cgo.TargetX = float(cgo0.X); cgo.TargetY = float(cgo0.Y); cgo.TargetX = float(cgo0.X); cgo.TargetY = float(cgo0.Y);
cgo.Zoom = 1; cgo.Zoom = 1;
lpDDraw->SetZoom(cgo.X, cgo.Y, cgo.Zoom); pDraw->SetZoom(cgo.X, cgo.Y, cgo.Zoom);
// Player eliminated // Player eliminated
if (pPlr && pPlr->Eliminated) if (pPlr && pPlr->Eliminated)
{ {
lpDDraw->TextOut(FormatString(LoadResStr(pPlr->Surrendered ? "IDS_PLR_SURRENDERED" : "IDS_PLR_ELIMINATED"),pPlr->GetName()).getData(), pDraw->TextOut(FormatString(LoadResStr(pPlr->Surrendered ? "IDS_PLR_SURRENDERED" : "IDS_PLR_ELIMINATED"),pPlr->GetName()).getData(),
::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.TargetX+cgo.Wdt/2,cgo.TargetY+2*cgo.Hgt/3,0xfaFF0000,ACenter); ::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.TargetX+cgo.Wdt/2,cgo.TargetY+2*cgo.Hgt/3,0xfaFF0000,ACenter);
return; return;
} }
@ -193,12 +193,12 @@ void C4Viewport::DrawMenu(C4TargetFacet &cgo0)
if (::MouseControl.IsDragging() && ::MouseControl.IsViewport(this)) if (::MouseControl.IsDragging() && ::MouseControl.IsViewport(this))
{ {
fDragging = true; fDragging = true;
lpDDraw->ActivateBlitModulation(0x4fffffff); pDraw->ActivateBlitModulation(0x4fffffff);
} }
// draw menu // draw menu
pPlr->Cursor->Menu->Draw(cgo); pPlr->Cursor->Menu->Draw(cgo);
// reset modulation for dragging // reset modulation for dragging
if (fDragging) lpDDraw->DeactivateBlitModulation(); if (fDragging) pDraw->DeactivateBlitModulation();
} }
// Player menu // Player menu
if (pPlr && pPlr->Menu.IsActive()) if (pPlr && pPlr->Menu.IsActive())
@ -217,7 +217,7 @@ void C4Viewport::DrawMenu(C4TargetFacet &cgo0)
ResetMenuPositions=false; ResetMenuPositions=false;
// restore Zoom // restore Zoom
lpDDraw->SetZoom(cgo0.X, cgo0.Y, cgo0.Zoom); pDraw->SetZoom(cgo0.X, cgo0.Y, cgo0.Zoom);
} }
void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay) void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
@ -235,18 +235,18 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
if (fDrawOverlay) if (fDrawOverlay)
{ {
// Draw landscape borders. Only if overlay, so complete map screenshots don't get messed up // Draw landscape borders. Only if overlay, so complete map screenshots don't get messed up
if (BorderLeft) lpDDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX,DrawY,BorderLeft,ViewHgt,-DrawX,-DrawY); if (BorderLeft) pDraw->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 (BorderTop) pDraw->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 (BorderRight) pDraw->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); if (BorderBottom)pDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+BorderLeft,DrawY+ViewHgt-BorderBottom,ViewWdt-BorderLeft-BorderRight,BorderBottom,-DrawX-BorderLeft,-DrawY-ViewHgt+BorderBottom);
// Set clippers // Set clippers
cgo.X += BorderLeft; cgo.Y += BorderTop; cgo.Wdt -= int(float(BorderLeft+BorderRight)/cgo.Zoom); cgo.Hgt -= int(float(BorderTop+BorderBottom)/cgo.Zoom); cgo.X += BorderLeft; cgo.Y += BorderTop; cgo.Wdt -= int(float(BorderLeft+BorderRight)/cgo.Zoom); cgo.Hgt -= int(float(BorderTop+BorderBottom)/cgo.Zoom);
GameZoom.X = cgo.X; GameZoom.Y = cgo.Y; GameZoom.X = cgo.X; GameZoom.Y = cgo.Y;
cgo.TargetX += BorderLeft/Zoom; cgo.TargetY += BorderTop/Zoom; cgo.TargetX += BorderLeft/Zoom; cgo.TargetY += BorderTop/Zoom;
// Apply Zoom // Apply Zoom
lpDDraw->SetZoom(GameZoom); pDraw->SetZoom(GameZoom);
lpDDraw->SetPrimaryClipper(cgo.X,cgo.Y,DrawX+ViewWdt-1-BorderRight,DrawY+ViewHgt-1-BorderBottom); pDraw->SetPrimaryClipper(cgo.X,cgo.Y,DrawX+ViewWdt-1-BorderRight,DrawY+ViewHgt-1-BorderBottom);
} }
last_game_draw_cgo = cgo; last_game_draw_cgo = cgo;
@ -259,11 +259,11 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
{ {
ClrModMap.Reset(Game.C4S.Landscape.FoWRes, Game.C4S.Landscape.FoWRes, ViewWdt, ViewHgt, int(cgo.TargetX*Zoom), int(cgo.TargetY*Zoom), 0, cgo.X-BorderLeft, cgo.Y-BorderTop, Game.FoWColor, cgo.Surface); ClrModMap.Reset(Game.C4S.Landscape.FoWRes, Game.C4S.Landscape.FoWRes, ViewWdt, ViewHgt, int(cgo.TargetX*Zoom), int(cgo.TargetY*Zoom), 0, cgo.X-BorderLeft, cgo.Y-BorderTop, Game.FoWColor, cgo.Surface);
pPlr->FoW2Map(ClrModMap, int(float(cgo.X)/Zoom-cgo.TargetX), int(float(cgo.Y)/Zoom-cgo.TargetY)); pPlr->FoW2Map(ClrModMap, int(float(cgo.X)/Zoom-cgo.TargetX), int(float(cgo.Y)/Zoom-cgo.TargetY));
lpDDraw->SetClrModMap(&ClrModMap); pDraw->SetClrModMap(&ClrModMap);
lpDDraw->SetClrModMapEnabled(true); pDraw->SetClrModMapEnabled(true);
} }
else else
lpDDraw->SetClrModMapEnabled(false); pDraw->SetClrModMapEnabled(false);
*/ */
C4ST_STARTNEW(SkyStat, "C4Viewport::Draw: Sky") C4ST_STARTNEW(SkyStat, "C4Viewport::Draw: Sky")
@ -299,7 +299,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
/* Fog of war disabled, see above /* Fog of war disabled, see above
// FogOfWar-mod off // FogOfWar-mod off
lpDDraw->SetClrModMapEnabled(false); pDraw->SetClrModMapEnabled(false);
*/ */
@ -308,8 +308,8 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
// Determine zoom of overlay // Determine zoom of overlay
float fGUIZoom = GetGUIZoom(); float fGUIZoom = GetGUIZoom();
// now restore complete cgo range for overlay drawing // now restore complete cgo range for overlay drawing
lpDDraw->SetZoom(DrawX,DrawY, fGUIZoom); pDraw->SetZoom(DrawX,DrawY, fGUIZoom);
lpDDraw->SetPrimaryClipper(DrawX,DrawY,DrawX+(ViewWdt-1),DrawY+(ViewHgt-1)); pDraw->SetPrimaryClipper(DrawX,DrawY,DrawX+(ViewWdt-1),DrawY+(ViewHgt-1));
C4TargetFacet gui_cgo; C4TargetFacet gui_cgo;
gui_cgo.Set(cgo0); gui_cgo.Set(cgo0);
@ -331,7 +331,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
// Game messages // Game messages
C4ST_STARTNEW(MsgStat, "C4Viewport::DrawOverlay: Messages") C4ST_STARTNEW(MsgStat, "C4Viewport::DrawOverlay: Messages")
lpDDraw->SetZoom(0, 0, 1.0); pDraw->SetZoom(0, 0, 1.0);
::Messages.Draw(gui_cgo, cgo, Player); ::Messages.Draw(gui_cgo, cgo, Player);
C4ST_STOP(MsgStat) C4ST_STOP(MsgStat)
@ -342,8 +342,8 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
C4ST_STOP(OvrStat) C4ST_STOP(OvrStat)
// Remove zoom n clippers // Remove zoom n clippers
lpDDraw->SetZoom(0, 0, 1.0); pDraw->SetZoom(0, 0, 1.0);
lpDDraw->NoPrimaryClipper(); pDraw->NoPrimaryClipper();
} }
} }
@ -379,7 +379,7 @@ void C4Viewport::Execute()
C4Window * w = pWindow; C4Window * w = pWindow;
if (!w) w = &FullScreen; if (!w) w = &FullScreen;
cgo.Set(w->pSurface,DrawX,DrawY,int32_t(ceilf(float(ViewWdt)/Zoom)),int32_t(ceilf(float(ViewHgt)/Zoom)),ViewX,ViewY,Zoom); cgo.Set(w->pSurface,DrawX,DrawY,int32_t(ceilf(float(ViewWdt)/Zoom)),int32_t(ceilf(float(ViewHgt)/Zoom)),ViewX,ViewY,Zoom);
lpDDraw->PrepareRendering(w->pSurface); pDraw->PrepareRendering(w->pSurface);
// Draw // Draw
Draw(cgo, true); Draw(cgo, true);
// Video record & status (developer mode, first player viewport) // Video record & status (developer mode, first player viewport)
@ -699,7 +699,7 @@ void C4Viewport::DrawPlayerStartup(C4TargetFacet &cgo)
} }
// Name // Name
lpDDraw->TextOut(pPlr->GetName(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface, pDraw->TextOut(pPlr->GetName(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,
cgo.X+cgo.Wdt/2,cgo.Y+cgo.Hgt*2/3+iNameHgtOff + DrawMessageOffset, cgo.X+cgo.Wdt/2,cgo.Y+cgo.Hgt*2/3+iNameHgtOff + DrawMessageOffset,
pPlr->ColorDw | 0xff000000, ACenter); pPlr->ColorDw | 0xff000000, ACenter);
} }
@ -807,7 +807,7 @@ void C4ViewportList::DrawFullscreenBackground()
for (int i=0, iNum=BackgroundAreas.GetCount(); i<iNum; ++i) for (int i=0, iNum=BackgroundAreas.GetCount(); i<iNum; ++i)
{ {
const C4Rect &rc = BackgroundAreas.Get(i); const C4Rect &rc = BackgroundAreas.Get(i);
lpDDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,FullScreen.pSurface,rc.x,rc.y,rc.Wdt,rc.Hgt,-rc.x,-rc.y); pDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,FullScreen.pSurface,rc.x,rc.y,rc.Wdt,rc.Hgt,-rc.x,-rc.y);
} }
} }

View File

@ -1018,7 +1018,7 @@ void StdMeshMatManager::Parse(const char* mat_script, const char* filename, StdM
mat.Load(ctx); mat.Load(ctx);
// To Gfxspecific setup of the material; choose working techniques // To Gfxspecific setup of the material; choose working techniques
if (lpDDraw->PrepareMaterial(mat) && mat.BestTechniqueIndex != -1) if (pDraw->PrepareMaterial(mat) && mat.BestTechniqueIndex != -1)
Materials[material_name] = mat; Materials[material_name] = mat;
else else
ctx.Error(StdCopyStrBuf("No working technique for material '") + material_name + "'"); ctx.Error(StdCopyStrBuf("No working technique for material '") + material_name + "'");

View File

@ -70,9 +70,9 @@ C4Facet C4Facet::GetPhase(int iPhaseX, int iPhaseY)
void C4Facet::Draw(C4Surface * sfcTarget, float iX, float iY, int32_t iPhaseX, int32_t iPhaseY) void C4Facet::Draw(C4Surface * sfcTarget, float iX, float iY, int32_t iPhaseX, int32_t iPhaseY)
{ {
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return; if (!pDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return;
lpDDraw->Blit(Surface, pDraw->Blit(Surface,
float(X+Wdt*iPhaseX),float(Y+Hgt*iPhaseY),float(Wdt),float(Hgt), float(X+Wdt*iPhaseX),float(Y+Hgt*iPhaseY),float(Wdt),float(Hgt),
sfcTarget, sfcTarget,
iX,iY,Wdt,Hgt,true); iX,iY,Wdt,Hgt,true);
@ -80,9 +80,9 @@ void C4Facet::Draw(C4Surface * sfcTarget, float iX, float iY, int32_t iPhaseX, i
void C4Facet::DrawT(C4Surface * sfcTarget, float iX, float iY, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform) void C4Facet::DrawT(C4Surface * sfcTarget, float iX, float iY, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform)
{ {
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return; if (!pDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return;
lpDDraw->Blit(Surface, pDraw->Blit(Surface,
float(X+Wdt*iPhaseX),float(Y+Hgt*iPhaseY),float(Wdt),float(Hgt), float(X+Wdt*iPhaseX),float(Y+Hgt*iPhaseY),float(Wdt),float(Hgt),
sfcTarget, sfcTarget,
iX,iY,Wdt,Hgt,true,pTransform); iX,iY,Wdt,Hgt,true,pTransform);
@ -90,7 +90,7 @@ void C4Facet::DrawT(C4Surface * sfcTarget, float iX, float iY, int32_t iPhaseX,
void C4Facet::DrawT(C4Facet &cgo, bool fAspect, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform) void C4Facet::DrawT(C4Facet &cgo, bool fAspect, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform)
{ {
if (!lpDDraw || !Surface || !cgo.Surface || !Wdt || !Hgt) return; if (!pDraw || !Surface || !cgo.Surface || !Wdt || !Hgt) return;
// Drawing area // Drawing area
C4Facet ccgo = cgo; C4Facet ccgo = cgo;
@ -111,7 +111,7 @@ void C4Facet::DrawT(C4Facet &cgo, bool fAspect, int32_t iPhaseX, int32_t iPhaseY
} }
} }
lpDDraw->Blit(Surface, pDraw->Blit(Surface,
float(X+Wdt*iPhaseX),float(Y+Hgt*iPhaseY),float(Wdt),float(Hgt), float(X+Wdt*iPhaseX),float(Y+Hgt*iPhaseY),float(Wdt),float(Hgt),
ccgo.Surface,ccgo.X,ccgo.Y,ccgo.Wdt,ccgo.Hgt, ccgo.Surface,ccgo.X,ccgo.Y,ccgo.Wdt,ccgo.Hgt,
true,pTransform); true,pTransform);
@ -120,7 +120,7 @@ void C4Facet::DrawT(C4Facet &cgo, bool fAspect, int32_t iPhaseX, int32_t iPhaseY
void C4Facet::Draw(C4Facet &cgo, bool fAspect, int32_t iPhaseX, int32_t iPhaseY, bool fTransparent) void C4Facet::Draw(C4Facet &cgo, bool fAspect, int32_t iPhaseX, int32_t iPhaseY, bool fTransparent)
{ {
// Valid parameter check // Valid parameter check
if (!lpDDraw || !Surface || !cgo.Surface || !Wdt || !Hgt) return; if (!pDraw || !Surface || !cgo.Surface || !Wdt || !Hgt) return;
// Drawing area // Drawing area
C4Facet ccgo = cgo; C4Facet ccgo = cgo;
// Adjust for fixed aspect ratio // Adjust for fixed aspect ratio
@ -140,7 +140,7 @@ void C4Facet::Draw(C4Facet &cgo, bool fAspect, int32_t iPhaseX, int32_t iPhaseY,
} }
} }
// Blit // Blit
lpDDraw->Blit(Surface, pDraw->Blit(Surface,
float(X+Wdt*iPhaseX),float(Y+Hgt*iPhaseY),float(Wdt),float(Hgt), float(X+Wdt*iPhaseX),float(Y+Hgt*iPhaseY),float(Wdt),float(Hgt),
ccgo.Surface, ccgo.Surface,
ccgo.X,ccgo.Y,ccgo.Wdt,ccgo.Hgt, ccgo.X,ccgo.Y,ccgo.Wdt,ccgo.Hgt,
@ -152,8 +152,8 @@ void C4Facet::DrawFullScreen(C4Facet &cgo)
// stretched fullscreen blit: make sure right and lower side are cleared, because this may be missed due to stretching // stretched fullscreen blit: make sure right and lower side are cleared, because this may be missed due to stretching
if (cgo.Wdt > Wdt+2 || cgo.Hgt > Wdt+2) if (cgo.Wdt > Wdt+2 || cgo.Hgt > Wdt+2)
{ {
lpDDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y+cgo.Hgt-1, cgo.X+cgo.Wdt+2, cgo.Y+cgo.Hgt+2, 0xff000000); pDraw->DrawBoxDw(cgo.Surface, cgo.X, cgo.Y+cgo.Hgt-1, cgo.X+cgo.Wdt+2, cgo.Y+cgo.Hgt+2, 0xff000000);
lpDDraw->DrawBoxDw(cgo.Surface, cgo.X+cgo.Wdt-1, cgo.Y, cgo.X+cgo.Wdt+2, cgo.Y+cgo.Hgt+2, 0xff000000); pDraw->DrawBoxDw(cgo.Surface, cgo.X+cgo.Wdt-1, cgo.Y, cgo.X+cgo.Wdt+2, cgo.Y+cgo.Hgt+2, 0xff000000);
} }
// normal blit OK // normal blit OK
Draw(cgo, false); Draw(cgo, false);
@ -186,10 +186,10 @@ void C4Facet::DrawValue2Clr(C4Facet &cgo, int32_t iValue1, int32_t iValue2, DWOR
void C4Facet::DrawXR(C4Surface * sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iSectionX, int32_t iSectionY, int32_t r) void C4Facet::DrawXR(C4Surface * sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, int32_t iSectionX, int32_t iSectionY, int32_t r)
{ {
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return; if (!pDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return;
C4BltTransform rot; C4BltTransform rot;
rot.SetRotate(r, (float) (iX+iX+iWdt)/2, (float) (iY+iY+iHgt)/2); rot.SetRotate(r, (float) (iX+iX+iWdt)/2, (float) (iY+iY+iHgt)/2);
lpDDraw->Blit(Surface, pDraw->Blit(Surface,
float(X+Wdt*iSectionX),float(Y+Hgt*iSectionY),float(Wdt),float(Hgt), float(X+Wdt*iSectionX),float(Y+Hgt*iSectionY),float(Wdt),float(Hgt),
sfcTarget, sfcTarget,
iX,iY,iWdt,iHgt, iX,iY,iWdt,iHgt,
@ -256,20 +256,20 @@ C4Facet C4Facet::Truncate(int32_t iAlign, int32_t iSize)
void C4Facet::DrawValue(C4Facet &cgo, int32_t iValue, int32_t iSectionX, int32_t iSectionY, int32_t iAlign) void C4Facet::DrawValue(C4Facet &cgo, int32_t iValue, int32_t iSectionX, int32_t iSectionY, int32_t iAlign)
{ {
if (!lpDDraw) return; if (!pDraw) return;
char ostr[25]; sprintf(ostr,"%i",iValue); char ostr[25]; sprintf(ostr,"%i",iValue);
switch (iAlign) switch (iAlign)
{ {
case C4FCT_Center: case C4FCT_Center:
Draw(cgo, true, iSectionX, iSectionY); Draw(cgo, true, iSectionX, iSectionY);
lpDDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, pDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface,
cgo.X + cgo.Wdt - 1, cgo.Y + cgo.Hgt - 1, CStdDDraw::DEFAULT_MESSAGE_COLOR, ARight); cgo.X + cgo.Wdt - 1, cgo.Y + cgo.Hgt - 1, CStdDDraw::DEFAULT_MESSAGE_COLOR, ARight);
break; break;
case C4FCT_Right: case C4FCT_Right:
{ {
int32_t textwdt, texthgt; int32_t textwdt, texthgt;
::GraphicsResource.FontRegular.GetTextExtent(ostr, textwdt, texthgt, false); ::GraphicsResource.FontRegular.GetTextExtent(ostr, textwdt, texthgt, false);
lpDDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, pDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface,
cgo.X + cgo.Wdt - 1, cgo.Y, CStdDDraw::DEFAULT_MESSAGE_COLOR, ARight); cgo.X + cgo.Wdt - 1, cgo.Y, CStdDDraw::DEFAULT_MESSAGE_COLOR, ARight);
cgo.Set(cgo.Surface, cgo.X + cgo.Wdt - 1 - textwdt - 2 * cgo.Hgt, cgo.Y, 2 * cgo.Hgt, cgo.Hgt); cgo.Set(cgo.Surface, cgo.X + cgo.Wdt - 1 - textwdt - 2 * cgo.Hgt, cgo.Y, 2 * cgo.Hgt, cgo.Hgt);
Draw(cgo, true, iSectionX, iSectionY); Draw(cgo, true, iSectionX, iSectionY);
@ -280,13 +280,13 @@ void C4Facet::DrawValue(C4Facet &cgo, int32_t iValue, int32_t iSectionX, int32_t
void C4Facet::DrawValue2(C4Facet &cgo, int32_t iValue1, int32_t iValue2, int32_t iSectionX, int32_t iSectionY, int32_t iAlign, int32_t *piUsedWidth) void C4Facet::DrawValue2(C4Facet &cgo, int32_t iValue1, int32_t iValue2, int32_t iSectionX, int32_t iSectionY, int32_t iAlign, int32_t *piUsedWidth)
{ {
if (!lpDDraw) return; if (!pDraw) return;
char ostr[25]; sprintf(ostr,"%i/%i",iValue1,iValue2); char ostr[25]; sprintf(ostr,"%i/%i",iValue1,iValue2);
switch (iAlign) switch (iAlign)
{ {
case C4FCT_Center: case C4FCT_Center:
Draw(cgo, true, iSectionX, iSectionY); Draw(cgo, true, iSectionX, iSectionY);
lpDDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, pDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface,
cgo.X + cgo.Wdt - 1, cgo.Y + cgo.Hgt - 1, CStdDDraw::DEFAULT_MESSAGE_COLOR, ARight); cgo.X + cgo.Wdt - 1, cgo.Y + cgo.Hgt - 1, CStdDDraw::DEFAULT_MESSAGE_COLOR, ARight);
break; break;
case C4FCT_Right: case C4FCT_Right:
@ -294,7 +294,7 @@ void C4Facet::DrawValue2(C4Facet &cgo, int32_t iValue1, int32_t iValue2, int32_t
int32_t textwdt, texthgt; int32_t textwdt, texthgt;
::GraphicsResource.FontRegular.GetTextExtent(ostr, textwdt, texthgt, false); ::GraphicsResource.FontRegular.GetTextExtent(ostr, textwdt, texthgt, false);
textwdt += Wdt + 3; textwdt += Wdt + 3;
lpDDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, pDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface,
cgo.X + cgo.Wdt - 1, cgo.Y, CStdDDraw::DEFAULT_MESSAGE_COLOR, ARight); cgo.X + cgo.Wdt - 1, cgo.Y, CStdDDraw::DEFAULT_MESSAGE_COLOR, ARight);
cgo.Set(cgo.Surface, cgo.X + cgo.Wdt - textwdt, cgo.Y, 2 * cgo.Hgt, cgo.Hgt); cgo.Set(cgo.Surface, cgo.X + cgo.Wdt - textwdt, cgo.Y, 2 * cgo.Hgt, cgo.Hgt);
Draw(cgo, true, iSectionX, iSectionY); Draw(cgo, true, iSectionX, iSectionY);
@ -306,8 +306,8 @@ void C4Facet::DrawValue2(C4Facet &cgo, int32_t iValue1, int32_t iValue2, int32_t
void C4Facet::DrawX(C4Surface * sfcTarget, float iX, float iY, float iWdt, float iHgt, int32_t iSectionX, int32_t iSectionY) const void C4Facet::DrawX(C4Surface * sfcTarget, float iX, float iY, float iWdt, float iHgt, int32_t iSectionX, int32_t iSectionY) const
{ {
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return; if (!pDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return;
lpDDraw->Blit(Surface, pDraw->Blit(Surface,
float(X+Wdt*iSectionX),float(Y+Hgt*iSectionY),float(Wdt),float(Hgt), float(X+Wdt*iSectionX),float(Y+Hgt*iSectionY),float(Wdt),float(Hgt),
sfcTarget, sfcTarget,
iX,iY,iWdt,iHgt, iX,iY,iWdt,iHgt,
@ -316,14 +316,14 @@ void C4Facet::DrawX(C4Surface * sfcTarget, float iX, float iY, float iWdt, float
void C4Facet::DrawXFloat(C4Surface * sfcTarget, float fX, float fY, float fWdt, float fHgt) const void C4Facet::DrawXFloat(C4Surface * sfcTarget, float fX, float fY, float fWdt, float fHgt) const
{ {
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt || fWdt<=0 || fHgt<=0) return; if (!pDraw || !Surface || !sfcTarget || !Wdt || !Hgt || fWdt<=0 || fHgt<=0) return;
// Since only source coordinates are available as floats for blitting, go inwards into this facet to match blit // Since only source coordinates are available as floats for blitting, go inwards into this facet to match blit
// for closest integer target coordinates // for closest integer target coordinates
float zx = fWdt / float(Wdt), zy = fHgt / float(Hgt); float zx = fWdt / float(Wdt), zy = fHgt / float(Hgt);
int32_t iX = (int32_t) ceilf(fX), iY = (int32_t) ceilf(fY), iX2 = (int32_t) floorf(fX+fWdt), iY2 = (int32_t) floorf(fY+fHgt); int32_t iX = (int32_t) ceilf(fX), iY = (int32_t) ceilf(fY), iX2 = (int32_t) floorf(fX+fWdt), iY2 = (int32_t) floorf(fY+fHgt);
float ox = (-fX+iX)/zx, oy = (-fY+iY)/zy; float ox = (-fX+iX)/zx, oy = (-fY+iY)/zy;
float oxs = (+fX+fWdt-iX2)/zx, oys = (+fY+fHgt-iY2)/zy; float oxs = (+fX+fWdt-iX2)/zx, oys = (+fY+fHgt-iY2)/zy;
lpDDraw->Blit(Surface, pDraw->Blit(Surface,
float(X)+ox, float(Y)+oy, float(Wdt)-ox-oxs, float(Hgt)-oy-oys, float(X)+ox, float(Y)+oy, float(Wdt)-ox-oxs, float(Hgt)-oy-oys,
sfcTarget, sfcTarget,
iX,iY,iX2-iX,iY2-iY, iX,iY,iX2-iX,iY2-iY,
@ -331,7 +331,7 @@ void C4Facet::DrawXFloat(C4Surface * sfcTarget, float fX, float fY, float fWdt,
zx=(iX2-iX)/(float(Wdt)-ox-oxs); zx=(iX2-iX)/(float(Wdt)-ox-oxs);
zy=(iY2-iY)/(float(Hgt)-oy-oys); zy=(iY2-iY)/(float(Hgt)-oy-oys);
/* int32_t iX = floorf(fX+0.5)-1, iY = floorf(fY+0.5)-1, iX2 = floorf(fX+fWdt+0.5)-1, iY2 = floorf(fY+fHgt+0.5)-1; /* int32_t iX = floorf(fX+0.5)-1, iY = floorf(fY+0.5)-1, iX2 = floorf(fX+fWdt+0.5)-1, iY2 = floorf(fY+fHgt+0.5)-1;
lpDDraw->Blit(Surface, pDraw->Blit(Surface,
X, Y, Wdt, Hgt, X, Y, Wdt, Hgt,
sfcTarget, sfcTarget,
iX,iY,iX2-iX+1,iY2-iY+1, iX,iY,iX2-iX+1,iY2-iY+1,
@ -340,8 +340,8 @@ void C4Facet::DrawXFloat(C4Surface * sfcTarget, float fX, float fY, float fWdt,
void C4Facet::DrawXT(C4Surface * sfcTarget, float iX, float iY, int32_t iWdt, int32_t iHgt, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform) void C4Facet::DrawXT(C4Surface * sfcTarget, float iX, float iY, int32_t iWdt, int32_t iHgt, int32_t iPhaseX, int32_t iPhaseY, C4DrawTransform *pTransform)
{ {
if (!lpDDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return; if (!pDraw || !Surface || !sfcTarget || !Wdt || !Hgt) return;
lpDDraw->Blit(Surface, pDraw->Blit(Surface,
float(X+Wdt*iPhaseX),float(Y+Hgt*iPhaseY),float(Wdt),float(Hgt), float(X+Wdt*iPhaseX),float(Y+Hgt*iPhaseY),float(Wdt),float(Hgt),
sfcTarget, sfcTarget,
iX,iY,iWdt,iHgt, iX,iY,iWdt,iHgt,
@ -351,7 +351,7 @@ void C4Facet::DrawXT(C4Surface * sfcTarget, float iX, float iY, int32_t iWdt, in
void C4Facet::DrawEnergyLevelEx(int32_t iLevel, int32_t iRange, const C4Facet &gfx, int32_t bar_idx) void C4Facet::DrawEnergyLevelEx(int32_t iLevel, int32_t iRange, const C4Facet &gfx, int32_t bar_idx)
{ {
// draw energy level using graphics // draw energy level using graphics
if (!lpDDraw || !gfx.Surface) return; if (!pDraw || !gfx.Surface) return;
int32_t h=gfx.Hgt; int32_t h=gfx.Hgt;
int32_t yBar = Hgt - BoundBy<int32_t>(iLevel,0,iRange) * Hgt / Max<int32_t>(iRange,1); int32_t yBar = Hgt - BoundBy<int32_t>(iLevel,0,iRange) * Hgt / Max<int32_t>(iRange,1);
int32_t iY = 0, vidx=0; int32_t iY = 0, vidx=0;
@ -412,9 +412,9 @@ void C4Facet::Set(C4Surface &rSfc)
void C4Facet::DrawTile(C4Surface * sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt) void C4Facet::DrawTile(C4Surface * sfcTarget, int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt)
{ {
if (!lpDDraw || !Surface || !Wdt || !Hgt) return; if (!pDraw || !Surface || !Wdt || !Hgt) return;
// Blits whole source surface, not surface facet area // Blits whole source surface, not surface facet area
lpDDraw->BlitSurfaceTile(Surface,sfcTarget,iX,iY,iWdt,iHgt,0,0,true); pDraw->BlitSurfaceTile(Surface,sfcTarget,iX,iY,iWdt,iHgt,0,0,true);
} }
void C4Facet::Expand(int32_t iLeft, int32_t iRight, int32_t iTop, int32_t iBottom) void C4Facet::Expand(int32_t iLeft, int32_t iRight, int32_t iTop, int32_t iBottom)

View File

@ -46,13 +46,13 @@ void C4TargetFacet::SetRect(C4TargetRect &rSrc)
void C4TargetFacet::DrawLineDw(int iX1, int iY1, int iX2, int iY2, uint32_t col1, uint32_t col2) void C4TargetFacet::DrawLineDw(int iX1, int iY1, int iX2, int iY2, uint32_t col1, uint32_t col2)
{ {
if (!lpDDraw || !Surface || !Wdt || !Hgt) return; if (!pDraw || !Surface || !Wdt || !Hgt) return;
// Scroll position // Scroll position
iX1-=TargetX; iY1-=TargetY; iX2-=TargetX; iY2-=TargetY; iX1-=TargetX; iY1-=TargetY; iX2-=TargetX; iY2-=TargetY;
// No clipping is done here, because clipping will be done by gfx wrapper anyway // No clipping is done here, because clipping will be done by gfx wrapper anyway
// Draw line // Draw line
lpDDraw->DrawLineDw(Surface,X+iX1,Y+iY1,X+iX2,Y+iY2,col1); pDraw->DrawLineDw(Surface,X+iX1,Y+iY1,X+iX2,Y+iY2,col1);
lpDDraw->DrawPix(Surface,(float)(X+iX1),(float)(Y+iY1),col2); pDraw->DrawPix(Surface,(float)(X+iX1),(float)(Y+iY1),col2);
} }
// ------------------------ // ------------------------
@ -92,7 +92,7 @@ bool C4FacetSurface::EnsureSize(int iMinWdt, int iMinHgt)
// create temp surface // create temp surface
C4Surface *sfcDup=new C4Surface(iWdt,iHgt); C4Surface *sfcDup=new C4Surface(iWdt,iHgt);
if (!sfcDup) return false; if (!sfcDup) return false;
if (!lpDDraw->BlitSurface(&Face,sfcDup,0,0,false)) if (!pDraw->BlitSurface(&Face,sfcDup,0,0,false))
{ delete sfcDup; return false; } { delete sfcDup; return false; }
// calc needed size // calc needed size
int iDstWdt=Surface->Wdt,iDstHgt=iHgt; int iDstWdt=Surface->Wdt,iDstHgt=iHgt;
@ -101,7 +101,7 @@ bool C4FacetSurface::EnsureSize(int iMinWdt, int iMinHgt)
// recreate this one // recreate this one
if (!Face.Create(iDstWdt, iDstHgt)) { delete sfcDup; Clear(); return false; } if (!Face.Create(iDstWdt, iDstHgt)) { delete sfcDup; Clear(); return false; }
// blit tiled into it // blit tiled into it
bool fSuccess=lpDDraw->BlitSurfaceTile(sfcDup, &Face, 0, 0, iDstWdt, iDstHgt, 0, 0, false); bool fSuccess=pDraw->BlitSurfaceTile(sfcDup, &Face, 0, 0, iDstWdt, iDstHgt, 0, 0, false);
// del temp surface // del temp surface
delete sfcDup; delete sfcDup;
// done // done
@ -194,7 +194,7 @@ bool C4FacetSurface::CopyFromSfcMaxSize(C4Surface &srcSfc, int32_t iMaxSize, uin
} }
if (dwColor) srcSfc.SetClr(dwColor); if (dwColor) srcSfc.SetClr(dwColor);
Create(iTargetWdt, iTargetHgt); Create(iTargetWdt, iTargetHgt);
lpDDraw->Blit(&srcSfc, 0.0f,0.0f,float(fctSource.Wdt),float(fctSource.Hgt), pDraw->Blit(&srcSfc, 0.0f,0.0f,float(fctSource.Wdt),float(fctSource.Hgt),
&Face, 0,0,iTargetWdt,iTargetHgt); &Face, 0,0,iTargetWdt,iTargetHgt);
} }
Set(&Face, 0,0, Face.Wdt, Face.Hgt); Set(&Face, 0,0, Face.Wdt, Face.Hgt);
@ -203,8 +203,8 @@ bool C4FacetSurface::CopyFromSfcMaxSize(C4Surface &srcSfc, int32_t iMaxSize, uin
void C4FacetSurface::Grayscale(int32_t iOffset) void C4FacetSurface::Grayscale(int32_t iOffset)
{ {
if (!lpDDraw || !Surface || !Wdt || !Hgt) return; if (!pDraw || !Surface || !Wdt || !Hgt) return;
lpDDraw->Grayscale(Surface, iOffset); pDraw->Grayscale(Surface, iOffset);
} }
bool C4FacetSurface::EnsureOwnSurface() bool C4FacetSurface::EnsureOwnSurface()

View File

@ -369,7 +369,7 @@ bool C4Network2::DoLobby()
ChangeGameStatus(GS_Lobby, 0); ChangeGameStatus(GS_Lobby, 0);
// determine lobby type // determine lobby type
bool fFullscreenLobby = !Console.Active && (lpDDraw->GetEngine() != GFXENGN_NOGFX); bool fFullscreenLobby = !Console.Active && (pDraw->GetEngine() != GFXENGN_NOGFX);
if (!fFullscreenLobby) if (!fFullscreenLobby)
{ {
@ -1022,7 +1022,7 @@ void C4Network2::DrawStatus(C4TargetFacet &cgo)
Stat.Append("| - none -"); Stat.Append("| - none -");
// draw // draw
lpDDraw->TextOut(Stat.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X + 20,cgo.Y + 50); pDraw->TextOut(Stat.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X + 20,cgo.Y + 50);
} }
bool C4Network2::InitNetIO(bool fNoClientID, bool fHost) bool C4Network2::InitNetIO(bool fNoClientID, bool fHost)

View File

@ -797,19 +797,19 @@ void C4Chart::DrawElement(C4TargetFacet &cgo)
int iYLegendDraw = (th - iSeriesCount*Q)/2 + ty; int iYLegendDraw = (th - iSeriesCount*Q)/2 + ty;
while ((pSeries = pDisplayGraph->GetSeries(iSeries++))) while ((pSeries = pDisplayGraph->GetSeries(iSeries++)))
{ {
lpDDraw->TextOut(pSeries->GetTitle(), rFont, 1.0f, cgo.Surface, tx+tw, iYLegendDraw, pSeries->GetColorDw() | 0xff000000, ALeft, true); pDraw->TextOut(pSeries->GetTitle(), rFont, 1.0f, cgo.Surface, tx+tw, iYLegendDraw, pSeries->GetColorDw() | 0xff000000, ALeft, true);
iYLegendDraw += Q; iYLegendDraw += Q;
} }
} }
// safety: too small? // safety: too small?
if (tw < 10 || th < 10) return; if (tw < 10 || th < 10) return;
// draw axis // draw axis
lpDDraw->DrawLineDw(cgo.Surface, tx, ty+th, tx+tw-1, ty+th, C4RGB(0x91, 0x91, 0x91)); pDraw->DrawLineDw(cgo.Surface, tx, ty+th, tx+tw-1, ty+th, C4RGB(0x91, 0x91, 0x91));
lpDDraw->DrawLineDw(cgo.Surface, tx+tw-1, ty+th, tx+tw-1-AxisArrowLen, ty+th-AxisArrowThickness, C4RGB(0x91, 0x91, 0x91)); pDraw->DrawLineDw(cgo.Surface, tx+tw-1, ty+th, tx+tw-1-AxisArrowLen, ty+th-AxisArrowThickness, C4RGB(0x91, 0x91, 0x91));
lpDDraw->DrawLineDw(cgo.Surface, tx+tw-1, ty+th, tx+tw-1-AxisArrowLen, ty+th+AxisArrowThickness, C4RGB(0x91, 0x91, 0x91)); pDraw->DrawLineDw(cgo.Surface, tx+tw-1, ty+th, tx+tw-1-AxisArrowLen, ty+th+AxisArrowThickness, C4RGB(0x91, 0x91, 0x91));
lpDDraw->DrawLineDw(cgo.Surface, tx, ty, tx, ty+th, C4RGB(0x91, 0x91, 0x91)); pDraw->DrawLineDw(cgo.Surface, tx, ty, tx, ty+th, C4RGB(0x91, 0x91, 0x91));
lpDDraw->DrawLineDw(cgo.Surface, tx, ty, tx-AxisArrowThickness, ty+AxisArrowLen, C4RGB(0x91, 0x91, 0x91)); pDraw->DrawLineDw(cgo.Surface, tx, ty, tx-AxisArrowThickness, ty+AxisArrowLen, C4RGB(0x91, 0x91, 0x91));
lpDDraw->DrawLineDw(cgo.Surface, tx, ty, tx+AxisArrowThickness, ty+AxisArrowLen, C4RGB(0x91, 0x91, 0x91)); pDraw->DrawLineDw(cgo.Surface, tx, ty, tx+AxisArrowThickness, ty+AxisArrowLen, C4RGB(0x91, 0x91, 0x91));
tw -= AxisArrowLen + AxisArrowIndent; tw -= AxisArrowLen + AxisArrowIndent;
th -= AxisArrowLen + AxisArrowIndent; ty += AxisArrowLen + AxisArrowIndent; th -= AxisArrowLen + AxisArrowIndent; ty += AxisArrowLen + AxisArrowIndent;
// do axis numbering // do axis numbering
@ -821,17 +821,17 @@ void C4Chart::DrawElement(C4TargetFacet &cgo)
for (; iTime <= iMaxTime; iTime += iXAxisSteps) for (; iTime <= iMaxTime; iTime += iXAxisSteps)
{ {
iX = tx + tw * (iTime-iMinTime) / dt; iX = tx + tw * (iTime-iMinTime) / dt;
lpDDraw->DrawLineDw(cgo.Surface, iX, ty+th+1, iX, ty+th+AxisMarkerLen, C4RGB(0x91, 0x91, 0x91)); pDraw->DrawLineDw(cgo.Surface, iX, ty+th+1, iX, ty+th+AxisMarkerLen, C4RGB(0x91, 0x91, 0x91));
sbuf.Format("%d", (int) iTime); sbuf.Format("%d", (int) iTime);
lpDDraw->TextOut(sbuf.getData(), rFont, 1.0f, cgo.Surface, iX, ty+th+AxisMarkerLen, 0xff7f7f7f, ACenter, false); pDraw->TextOut(sbuf.getData(), rFont, 1.0f, cgo.Surface, iX, ty+th+AxisMarkerLen, 0xff7f7f7f, ACenter, false);
} }
iVal = int( ((iMinVal-(iMinVal>0))/iYAxisSteps+(iMinVal>0))*iYAxisSteps ); iVal = int( ((iMinVal-(iMinVal>0))/iYAxisSteps+(iMinVal>0))*iYAxisSteps );
for (; iVal <= iMaxVal; iVal += iYAxisSteps) for (; iVal <= iMaxVal; iVal += iYAxisSteps)
{ {
iY = ty+th - int((iVal-iMinVal) / dv * th); iY = ty+th - int((iVal-iMinVal) / dv * th);
lpDDraw->DrawLineDw(cgo.Surface, tx-AxisMarkerLen, iY, tx-1, iY, C4RGB(0x91, 0x91, 0x91)); pDraw->DrawLineDw(cgo.Surface, tx-AxisMarkerLen, iY, tx-1, iY, C4RGB(0x91, 0x91, 0x91));
sbuf.Format("%d", (int) iVal); sbuf.Format("%d", (int) iVal);
lpDDraw->TextOut(sbuf.getData(), rFont, 1.0f, cgo.Surface, tx-AxisMarkerLen, iY-rFont.GetLineHeight()/2, 0xff7f7f7f, ARight, false); pDraw->TextOut(sbuf.getData(), rFont, 1.0f, cgo.Surface, tx-AxisMarkerLen, iY-rFont.GetLineHeight()/2, 0xff7f7f7f, ARight, false);
} }
// draw graph series(es) // draw graph series(es)
int iSeries = 0; int iSeries = 0;
@ -845,7 +845,7 @@ void C4Chart::DrawElement(C4TargetFacet &cgo)
iTime = iMinTime + dt*iX/tw; iTime = iMinTime + dt*iX/tw;
if (!Inside(iTime, iThisMinTime, iThisMaxTime)) continue; if (!Inside(iTime, iThisMinTime, iThisMaxTime)) continue;
int iY2 = int((-pSeries->GetValue(iTime) + iMinVal) * th / dv) + ty+th; int iY2 = int((-pSeries->GetValue(iTime) + iMinVal) * th / dv) + ty+th;
if (fAnyVal) lpDDraw->DrawLineDw(cgo.Surface, (float) (tx+iX-1), (float) iY, (float) (tx+iX), (float) iY2, pSeries->GetColorDw()); if (fAnyVal) pDraw->DrawLineDw(cgo.Surface, (float) (tx+iX-1), (float) iY, (float) (tx+iX), (float) iY2, pSeries->GetColorDw());
iY = iY2; iY = iY2;
fAnyVal = true; fAnyVal = true;
} }

View File

@ -207,8 +207,8 @@ bool C4Surface::Create(int iWdt, int iHgt, bool, bool fIsRenderTarget, int MaxTe
if (!iWdt || !iHgt) return false; if (!iWdt || !iHgt) return false;
Wdt=iWdt; Hgt=iHgt; Wdt=iWdt; Hgt=iHgt;
// create texture: check gfx system // create texture: check gfx system
if (!lpDDraw) return false; if (!pDraw) return false;
if (!lpDDraw->DeviceReady()) return false; if (!pDraw->DeviceReady()) return false;
// store color format that will be used // store color format that will be used
#ifdef USE_DIRECTX #ifdef USE_DIRECTX
@ -222,7 +222,7 @@ bool C4Surface::Create(int iWdt, int iHgt, bool, bool fIsRenderTarget, int MaxTe
else else
#endif #endif
{/* nothing to do */} {/* nothing to do */}
byBytesPP=lpDDraw->byByteCnt; byBytesPP=pDraw->byByteCnt;
this->fIsRenderTarget = fIsRenderTarget; this->fIsRenderTarget = fIsRenderTarget;
// create textures // create textures
if (!CreateTextures(MaxTextureSize)) { Clear(); return false; } if (!CreateTextures(MaxTextureSize)) { Clear(); return false; }
@ -241,7 +241,7 @@ bool C4Surface::Copy(C4Surface &fromSfc)
// Create surface // Create surface
if (!Create(fromSfc.Wdt, fromSfc.Hgt)) return false; if (!Create(fromSfc.Wdt, fromSfc.Hgt)) return false;
// Blit copy // Blit copy
if (!lpDDraw->BlitSurface(&fromSfc, this, 0, 0, false)) if (!pDraw->BlitSurface(&fromSfc, this, 0, 0, false))
{ Clear(); return false; } { Clear(); return false; }
// Success // Success
return true; return true;
@ -270,7 +270,7 @@ bool C4Surface::CreateTextures(int MaxTextureSize)
{ {
// free previous // free previous
FreeTextures(); FreeTextures();
iTexSize=Min(GetNeedTexSize(Max(Wdt, Hgt)), lpDDraw->MaxTexSize); iTexSize=Min(GetNeedTexSize(Max(Wdt, Hgt)), pDraw->MaxTexSize);
if (MaxTextureSize) if (MaxTextureSize)
iTexSize=Min(iTexSize, MaxTextureSize); iTexSize=Min(iTexSize, MaxTextureSize);
// get the number of textures needed for this size // get the number of textures needed for this size
@ -522,7 +522,7 @@ bool C4Surface::PageFlip(C4Rect *pSrcRt, C4Rect *pDstRt)
if (!fPrimary) if (!fPrimary)
return false; return false;
// call from gfx thread only! // call from gfx thread only!
if (!lpDDraw->pApp || !lpDDraw->pApp->AssertMainThread()) return false; if (!pDraw->pApp || !pDraw->pApp->AssertMainThread()) return false;
#ifdef USE_GL #ifdef USE_GL
if (pGL) if (pGL)
return pCtx->PageFlip(); return pCtx->PageFlip();
@ -709,7 +709,7 @@ bool C4Surface::SavePNG(const char *szFilename, bool fSaveAlpha, bool fApplyGamm
for (int x=0; x<Wdt; ++x) for (int x=0; x<Wdt; ++x)
{ {
DWORD dwClr = GetPixDw(x, y, false); DWORD dwClr = GetPixDw(x, y, false);
if (fApplyGamma) dwClr = lpDDraw->Gamma.ApplyTo(dwClr); if (fApplyGamma) dwClr = pDraw->Gamma.ApplyTo(dwClr);
png.SetPix(x, y, dwClr); png.SetPix(x, y, dwClr);
} }
} }
@ -765,7 +765,7 @@ bool C4Surface::Lock()
// lock it // lock it
if (pSfc->LockRect(&lock, NULL, 0) != D3D_OK) if (pSfc->LockRect(&lock, NULL, 0) != D3D_OK)
return false; return false;
lpDDraw->LockingPrimary(); pDraw->LockingPrimary();
// store pitch and pointer // store pitch and pointer
PrimarySurfaceLockPitch=lock.Pitch; PrimarySurfaceLockPitch=lock.Pitch;
PrimarySurfaceLockBits=(BYTE*) lock.pBits; PrimarySurfaceLockBits=(BYTE*) lock.pBits;
@ -806,7 +806,7 @@ bool C4Surface::Unlock()
// unlocking primary? // unlocking primary?
if (pSfc->UnlockRect() != D3D_OK) if (pSfc->UnlockRect() != D3D_OK)
return false; return false;
lpDDraw->PrimaryUnlocked(); pDraw->PrimaryUnlocked();
} }
else else
#endif #endif
@ -972,12 +972,12 @@ DWORD C4Surface::GetPixDw(int iX, int iY, bool fApplyModulation)
// otherwise, it's a ColorByOwner-pixel: adjust the color // otherwise, it's a ColorByOwner-pixel: adjust the color
if (fApplyModulation) if (fApplyModulation)
{ {
if (lpDDraw->dwBlitMode & C4GFXBLIT_CLRSFC_MOD2) if (pDraw->dwBlitMode & C4GFXBLIT_CLRSFC_MOD2)
ModulateClrMOD2(dwPix, ClrByOwnerClr); ModulateClrMOD2(dwPix, ClrByOwnerClr);
else else
ModulateClr(dwPix, ClrByOwnerClr); ModulateClr(dwPix, ClrByOwnerClr);
if (lpDDraw->BlitModulated && !(lpDDraw->dwBlitMode & C4GFXBLIT_CLRSFC_OWNCLR)) if (pDraw->BlitModulated && !(pDraw->dwBlitMode & C4GFXBLIT_CLRSFC_OWNCLR))
ModulateClr(dwPix, lpDDraw->BlitModulateClr); ModulateClr(dwPix, pDraw->BlitModulateClr);
} }
else else
ModulateClr(dwPix, ClrByOwnerClr); ModulateClr(dwPix, ClrByOwnerClr);
@ -993,12 +993,12 @@ DWORD C4Surface::GetPixDw(int iX, int iY, bool fApplyModulation)
{ {
// single main surface // single main surface
// apply color modulation if desired // apply color modulation if desired
if (fApplyModulation && lpDDraw->BlitModulated) if (fApplyModulation && pDraw->BlitModulated)
{ {
if (lpDDraw->dwBlitMode & C4GFXBLIT_MOD2) if (pDraw->dwBlitMode & C4GFXBLIT_MOD2)
ModulateClrMOD2(dwPix, lpDDraw->BlitModulateClr); ModulateClrMOD2(dwPix, pDraw->BlitModulateClr);
else else
ModulateClr(dwPix, lpDDraw->BlitModulateClr); ModulateClr(dwPix, pDraw->BlitModulateClr);
} }
} }
// return pixel value // return pixel value
@ -1173,7 +1173,7 @@ bool C4Surface::BltPix(int iX, int iY, C4Surface *sfcSource, int iSrcX, int iSrc
} }
else else
{ {
if (lpDDraw->dwBlitMode & C4GFXBLIT_ADDITIVE) if (pDraw->dwBlitMode & C4GFXBLIT_ADDITIVE)
BltAlphaAdd(*pPix32, srcPix); BltAlphaAdd(*pPix32, srcPix);
else else
BltAlpha(*pPix32, srcPix); BltAlpha(*pPix32, srcPix);
@ -1194,7 +1194,7 @@ bool C4Surface::BltPix(int iX, int iY, C4Surface *sfcSource, int iSrcX, int iSrc
{ {
// merge in 32 bit // merge in 32 bit
DWORD dwDst=ClrW2Dw(*pPix16); DWORD dwDst=ClrW2Dw(*pPix16);
if (lpDDraw->dwBlitMode & C4GFXBLIT_ADDITIVE) if (pDraw->dwBlitMode & C4GFXBLIT_ADDITIVE)
BltAlphaAdd(dwDst, srcPix); BltAlphaAdd(dwDst, srcPix);
else else
BltAlpha(dwDst, srcPix); BltAlpha(dwDst, srcPix);
@ -1299,8 +1299,8 @@ C4TexRef::C4TexRef(int iSizeX, int iSizeY, bool fSingle)
if (!pTexMgr) pTexMgr = new C4TexMgr(); if (!pTexMgr) pTexMgr = new C4TexMgr();
pTexMgr->RegTex(this); pTexMgr->RegTex(this);
// create texture: check ddraw // create texture: check ddraw
if (!lpDDraw) return; if (!pDraw) return;
if (!lpDDraw->DeviceReady()) return; if (!pDraw->DeviceReady()) return;
// create it! // create it!
#ifdef USE_DIRECTX #ifdef USE_DIRECTX
if (pD3D) if (pD3D)
@ -1309,7 +1309,7 @@ C4TexRef::C4TexRef(int iSizeX, int iSizeY, bool fSingle)
bool fRenderTarget = fSingle && !Config.Graphics.NoOffscreenBlits; bool fRenderTarget = fSingle && !Config.Graphics.NoOffscreenBlits;
if (pD3D->lpDevice->CreateTexture(iSizeX, iSizeY, 1, fRenderTarget ? D3DUSAGE_RENDERTARGET : 0, pD3D->dwSurfaceType, fRenderTarget ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED, &pTex, NULL) != D3D_OK) if (pD3D->lpDevice->CreateTexture(iSizeX, iSizeY, 1, fRenderTarget ? D3DUSAGE_RENDERTARGET : 0, pD3D->dwSurfaceType, fRenderTarget ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED, &pTex, NULL) != D3D_OK)
{ {
lpDDraw->Error("Error creating surface"); pDraw->Error("Error creating surface");
return; return;
} }
// empty texture // empty texture
@ -1332,10 +1332,10 @@ C4TexRef::C4TexRef(int iSizeX, int iSizeY, bool fSingle)
} }
else else
#endif #endif
if (lpDDraw) if (pDraw)
{ {
texLock.pBits = new unsigned char[iSizeX*iSizeY*lpDDraw->byByteCnt]; texLock.pBits = new unsigned char[iSizeX*iSizeY*pDraw->byByteCnt];
texLock.Pitch = iSizeX*lpDDraw->byByteCnt; texLock.Pitch = iSizeX*pDraw->byByteCnt;
memset(texLock.pBits, 0x00, texLock.Pitch*iSizeY); memset(texLock.pBits, 0x00, texLock.Pitch*iSizeY);
// Always locked // Always locked
LockSize.x = LockSize.y = 0; LockSize.x = LockSize.y = 0;
@ -1360,7 +1360,7 @@ C4TexRef::~C4TexRef()
if (texName && pGL->pCurrCtx) glDeleteTextures(1, &texName); if (texName && pGL->pCurrCtx) glDeleteTextures(1, &texName);
} }
#endif #endif
if (lpDDraw) delete [] static_cast<unsigned char*>(texLock.pBits); texLock.pBits = 0; if (pDraw) delete [] static_cast<unsigned char*>(texLock.pBits); texLock.pBits = 0;
// remove from texture manager // remove from texture manager
pTexMgr->UnregTex(this); pTexMgr->UnregTex(this);
} }
@ -1445,7 +1445,7 @@ bool C4TexRef::Lock()
texLock.pBits = new unsigned char[iSizeX*iSizeY*pGL->byByteCnt]; texLock.pBits = new unsigned char[iSizeX*iSizeY*pGL->byByteCnt];
texLock.Pitch = iSizeX * pGL->byByteCnt; texLock.Pitch = iSizeX * pGL->byByteCnt;
glBindTexture(GL_TEXTURE_2D, texName); glBindTexture(GL_TEXTURE_2D, texName);
glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, lpDDraw->byByteCnt == 2 ? GL_UNSIGNED_SHORT_4_4_4_4_REV : GL_UNSIGNED_INT_8_8_8_8_REV, texLock.pBits); glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, pDraw->byByteCnt == 2 ? GL_UNSIGNED_SHORT_4_4_4_4_REV : GL_UNSIGNED_INT_8_8_8_8_REV, texLock.pBits);
return true; return true;
} }
} }
@ -1491,7 +1491,7 @@ void C4TexRef::Unlock()
// Default, changed in PerformBlt if necessary // Default, changed in PerformBlt if necessary
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 4, iSizeX, iSizeY, 0, GL_BGRA, lpDDraw->byByteCnt == 2 ? GL_UNSIGNED_SHORT_4_4_4_4_REV : GL_UNSIGNED_INT_8_8_8_8_REV, texLock.pBits); glTexImage2D(GL_TEXTURE_2D, 0, 4, iSizeX, iSizeY, 0, GL_BGRA, pDraw->byByteCnt == 2 ? GL_UNSIGNED_SHORT_4_4_4_4_REV : GL_UNSIGNED_INT_8_8_8_8_REV, texLock.pBits);
} }
else else
{ {
@ -1499,7 +1499,7 @@ void C4TexRef::Unlock()
glBindTexture(GL_TEXTURE_2D, texName); glBindTexture(GL_TEXTURE_2D, texName);
glTexSubImage2D(GL_TEXTURE_2D, 0, glTexSubImage2D(GL_TEXTURE_2D, 0,
LockSize.x, LockSize.y, LockSize.Wdt, LockSize.Hgt, LockSize.x, LockSize.y, LockSize.Wdt, LockSize.Hgt,
GL_BGRA, lpDDraw->byByteCnt == 2 ? GL_UNSIGNED_SHORT_4_4_4_4_REV : GL_UNSIGNED_INT_8_8_8_8_REV, texLock.pBits); GL_BGRA, pDraw->byByteCnt == 2 ? GL_UNSIGNED_SHORT_4_4_4_4_REV : GL_UNSIGNED_INT_8_8_8_8_REV, texLock.pBits);
} }
delete[] static_cast<unsigned char*>(texLock.pBits); texLock.pBits=NULL; delete[] static_cast<unsigned char*>(texLock.pBits); texLock.pBits=NULL;
// switch back to original context // switch back to original context
@ -1517,7 +1517,7 @@ bool C4TexRef::ClearRect(C4Rect &rtClear)
if (!LockForUpdate(rtClear)) return false; if (!LockForUpdate(rtClear)) return false;
// clear pixels // clear pixels
int y; int y;
switch (lpDDraw->byByteCnt) switch (pDraw->byByteCnt)
{ {
case 2: case 2:
for (y = rtClear.y; y < rtClear.y + rtClear.Hgt; ++y) for (y = rtClear.y; y < rtClear.y + rtClear.Hgt; ++y)
@ -1544,7 +1544,7 @@ bool C4TexRef::FillBlack()
if (!Lock()) return false; if (!Lock()) return false;
// clear pixels // clear pixels
int y; int y;
switch (lpDDraw->byByteCnt) switch (pDraw->byByteCnt)
{ {
case 2: case 2:
for (y=0; y<iSizeY; ++y) for (y=0; y<iSizeY; ++y)

View File

@ -71,8 +71,6 @@ class CStdGLCtx;
extern CStdGL *pGL; extern CStdGL *pGL;
#endif #endif
extern CStdDDraw *lpDDraw;
class C4Surface class C4Surface
{ {
private: private:

View File

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

View File

@ -129,7 +129,7 @@ bool C4VideoShowDialog::LoadVideo(C4VideoFile *pVideoFile)
{ {
#ifdef _WIN32 #ifdef _WIN32
// load video file // load video file
if (!AVIFile.OpenFile(pVideoFile->GetFilename(), FullScreen.hWindow, lpDDraw->GetByteCnt()*8)) return false; if (!AVIFile.OpenFile(pVideoFile->GetFilename(), FullScreen.hWindow, pDraw->GetByteCnt()*8)) return false;
// prepare surface for display // prepare surface for display
if (!fctBuffer.Create(AVIFile.GetWdt(), AVIFile.GetHgt(), C4FCT_Full, C4FCT_Full)) return false; if (!fctBuffer.Create(AVIFile.GetWdt(), AVIFile.GetHgt(), C4FCT_Full, C4FCT_Full)) return false;
iStartFrameTime = 0; // no frame shown yet iStartFrameTime = 0; // no frame shown yet

View File

@ -107,7 +107,7 @@ void CStdD3DShader::Discard()
bool CStdD3DShader::Error(const char *szMsg) bool CStdD3DShader::Error(const char *szMsg)
{ {
return lpDDraw->Error(FormatString("Direct3D Shader error: %s", szMsg).getData()); return pDraw->Error(FormatString("Direct3D Shader error: %s", szMsg).getData());
} }
bool CStdD3DShader::Compile(bool fMod2, bool fColoredFoW) bool CStdD3DShader::Compile(bool fMod2, bool fColoredFoW)

View File

@ -41,7 +41,7 @@
#include <limits.h> #include <limits.h>
// Global access pointer // Global access pointer
CStdDDraw *lpDDraw=NULL; CStdDDraw *pDraw=NULL;
int iGfxEngine=-1; int iGfxEngine=-1;
// Transformation matrix to convert meshes from Ogre to Clonk coordinate system // Transformation matrix to convert meshes from Ogre to Clonk coordinate system
@ -247,7 +247,7 @@ void C4FogOfWar::Reset(int ResX, int ResY, int WdtPx, int HgtPx, int OffX, int O
{ {
// then draw a background now and fade against transparent later // then draw a background now and fade against transparent later
// FIXME: don't do this if shaders are used // FIXME: don't do this if shaders are used
lpDDraw->DrawBoxDw(backsfc, x0,y0, x0+WdtPx-1, y0+HgtPx-1, dwBackClr); pDraw->DrawBoxDw(backsfc, x0,y0, x0+WdtPx-1, y0+HgtPx-1, dwBackClr);
FadeTransparent = true; FadeTransparent = true;
} }
else else
@ -277,8 +277,8 @@ void C4FogOfWar::ReduceModulation(int cx, int cy, int Radius, int (*VisProc)(int
// display coordinates: zx, zy, x, y // display coordinates: zx, zy, x, y
float zx = float(cx); float zx = float(cx);
float zy = float(cy); float zy = float(cy);
lpDDraw->ApplyZoom(zx, zy); pDraw->ApplyZoom(zx, zy);
Radius = int(lpDDraw->Zoom * Radius); Radius = int(pDraw->Zoom * Radius);
// reveal all within iRadius1; fade off squared until iRadius2 // reveal all within iRadius1; fade off squared until iRadius2
int x = OffX, y = OffY, xe = Wdt*ResolutionX+OffX; int x = OffX, y = OffY, xe = Wdt*ResolutionX+OffX;
int RadiusSq = Radius*Radius; int RadiusSq = Radius*Radius;
@ -288,7 +288,7 @@ void C4FogOfWar::ReduceModulation(int cx, int cy, int Radius, int (*VisProc)(int
{ {
float lx = float(x); float lx = float(x);
float ly = float(y); float ly = float(y);
lpDDraw->RemoveZoom(lx, ly); pDraw->RemoveZoom(lx, ly);
pMap[i] = Max<int>(pMap[i], VisProc(255, int(lx), int(ly), int(cx), int(cy))); pMap[i] = Max<int>(pMap[i], VisProc(255, int(lx), int(ly), int(cx), int(cy)));
} }
// next pos // next pos
@ -301,10 +301,10 @@ void C4FogOfWar::AddModulation(int cx, int cy, int Radius, uint8_t Transparency)
{ {
{ {
float x=float(cx); float y=float(cy); float x=float(cx); float y=float(cy);
lpDDraw->ApplyZoom(x,y); pDraw->ApplyZoom(x,y);
cx=int(x); cy=int(y); cx=int(x); cy=int(y);
} }
Radius = int(lpDDraw->Zoom * Radius); Radius = int(pDraw->Zoom * Radius);
// hide all within iRadius1; fade off squared until iRadius2 // hide all within iRadius1; fade off squared until iRadius2
int x = OffX, y = OffY, xe = Wdt*ResolutionX+OffX; int x = OffX, y = OffY, xe = Wdt*ResolutionX+OffX;
int RadiusSq = Radius*Radius; int RadiusSq = Radius*Radius;
@ -1254,19 +1254,19 @@ bool DDrawInit(C4AbstractApp * pApp, bool Editor, bool fUsePageLock, unsigned in
{ {
default: // Use the first engine possible if none selected default: // Use the first engine possible if none selected
#ifdef USE_DIRECTX #ifdef USE_DIRECTX
case GFXENGN_DIRECTX: lpDDraw = new CStdD3D(false); break; case GFXENGN_DIRECTX: pDraw = new CStdD3D(false); break;
case GFXENGN_DIRECTXS: lpDDraw = new CStdD3D(true); break; case GFXENGN_DIRECTXS: pDraw = new CStdD3D(true); break;
#endif #endif
#ifdef USE_GL #ifdef USE_GL
case GFXENGN_OPENGL: lpDDraw = new CStdGL(); break; case GFXENGN_OPENGL: pDraw = new CStdGL(); break;
#endif #endif
case GFXENGN_NOGFX: lpDDraw = new CStdNoGfx(); break; case GFXENGN_NOGFX: pDraw = new CStdNoGfx(); break;
} }
if (!lpDDraw) return false; if (!pDraw) return false;
// init it // init it
if (!lpDDraw->Init(pApp, Editor, fUsePageLock, iXRes, iYRes, iBitDepth, iMonitor)) if (!pDraw->Init(pApp, Editor, fUsePageLock, iXRes, iYRes, iBitDepth, iMonitor))
{ {
delete lpDDraw; delete pDraw;
return false; return false;
} }
// done, success // done, success

View File

@ -50,7 +50,7 @@ class StdMeshInstance;
#define GFXENGN_NOGFX 3 #define GFXENGN_NOGFX 3
// Global DDraw access pointer // Global DDraw access pointer
extern CStdDDraw *lpDDraw; extern CStdDDraw *pDraw;
extern int iGfxEngine; extern int iGfxEngine;
@ -192,7 +192,7 @@ public:
static const StdMeshMatrix OgreToClonk; static const StdMeshMatrix OgreToClonk;
CStdDDraw(): MaxTexSize(0), Saturation(255) { } CStdDDraw(): MaxTexSize(0), Saturation(255) { }
virtual ~CStdDDraw() { lpDDraw=NULL; } virtual ~CStdDDraw() { pDraw=NULL; }
public: public:
C4AbstractApp * pApp; // the application C4AbstractApp * pApp; // the application
bool Active; // set if device is ready to render, etc. bool Active; // set if device is ready to render, etc.
@ -348,9 +348,9 @@ protected:
struct ZoomDataStackItem: public ZoomData struct ZoomDataStackItem: public ZoomData
{ {
ZoomDataStackItem(float newzoom) { lpDDraw->GetZoom(this); lpDDraw->SetZoom(X, Y, newzoom); } ZoomDataStackItem(float newzoom) { pDraw->GetZoom(this); pDraw->SetZoom(X, Y, newzoom); }
ZoomDataStackItem(int X, int Y, float newzoom) { lpDDraw->GetZoom(this); lpDDraw->SetZoom(X, Y, newzoom); } ZoomDataStackItem(int X, int Y, float newzoom) { pDraw->GetZoom(this); pDraw->SetZoom(X, Y, newzoom); }
~ZoomDataStackItem() { lpDDraw->SetZoom(*this); } ~ZoomDataStackItem() { pDraw->SetZoom(*this); }
}; };
bool LockSurfaceGlobal(C4Surface * sfcTarget); bool LockSurfaceGlobal(C4Surface * sfcTarget);

View File

@ -825,7 +825,7 @@ void CStdFont::DrawText(C4Surface * sfcDest, float iX, float iY, DWORD dwColor,
C4BltTransform bt, *pbt=NULL; C4BltTransform bt, *pbt=NULL;
// set blit color // set blit color
DWORD dwOldModClr; DWORD dwOldModClr;
bool fWasModulated = lpDDraw->GetBlitModulation(dwOldModClr); bool fWasModulated = pDraw->GetBlitModulation(dwOldModClr);
if (fWasModulated) ModulateClr(dwColor, dwOldModClr); if (fWasModulated) ModulateClr(dwColor, dwOldModClr);
// get alpha fade percentage // get alpha fade percentage
DWORD dwAlphaMod = Min<uint32_t>(((dwColor>>0x18)*0xff)/0xaf, 255)<<0x18 | 0xffffff; DWORD dwAlphaMod = Min<uint32_t>(((dwColor>>0x18)*0xff)/0xaf, 255)<<0x18 | 0xffffff;
@ -902,9 +902,9 @@ void CStdFont::DrawText(C4Surface * sfcDest, float iX, float iY, DWORD dwColor,
} }
//normal: not modulated, unless done by transform or alpha fadeout //normal: not modulated, unless done by transform or alpha fadeout
if ((dwColor>>0x18) >= 0xaf) if ((dwColor>>0x18) >= 0xaf)
lpDDraw->DeactivateBlitModulation(); pDraw->DeactivateBlitModulation();
else else
lpDDraw->ActivateBlitModulation((dwColor&0xff000000) | 0xffffff); pDraw->ActivateBlitModulation((dwColor&0xff000000) | 0xffffff);
} }
else else
{ {
@ -912,7 +912,7 @@ void CStdFont::DrawText(C4Surface * sfcDest, float iX, float iY, DWORD dwColor,
// get texture coordinates // get texture coordinates
fctFromBlt = GetCharacterFacet(c); fctFromBlt = GetCharacterFacet(c);
w2=int(fctFromBlt.Wdt*fZoom); h2=int(fctFromBlt.Hgt*fZoom); w2=int(fctFromBlt.Wdt*fZoom); h2=int(fctFromBlt.Hgt*fZoom);
lpDDraw->ActivateBlitModulation(dwColor); pDraw->ActivateBlitModulation(dwColor);
} }
// do color/markup // do color/markup
if (pbt) if (pbt)
@ -923,7 +923,7 @@ void CStdFont::DrawText(C4Surface * sfcDest, float iX, float iY, DWORD dwColor,
// apply markup // apply markup
Markup.Apply(bt, dwBlitClr); Markup.Apply(bt, dwBlitClr);
if (dwBlitClr != dwColor) ModulateClrA(dwBlitClr, dwAlphaMod); if (dwBlitClr != dwColor) ModulateClrA(dwBlitClr, dwAlphaMod);
lpDDraw->ActivateBlitModulation(dwBlitClr); pDraw->ActivateBlitModulation(dwBlitClr);
// move transformation center to center of letter // move transformation center to center of letter
float fOffX=(float) w2/2 + iX; float fOffX=(float) w2/2 + iX;
float fOffY=(float) h2/2 + iY; float fOffY=(float) h2/2 + iY;
@ -931,7 +931,7 @@ void CStdFont::DrawText(C4Surface * sfcDest, float iX, float iY, DWORD dwColor,
bt.mat[5] += fOffY - fOffX*bt.mat[3] - fOffY*bt.mat[4]; bt.mat[5] += fOffY - fOffX*bt.mat[3] - fOffY*bt.mat[4];
} }
// blit character or image // blit character or image
lpDDraw->Blit(fctFromBlt.Surface, float(fctFromBlt.X), float(fctFromBlt.Y), float(fctFromBlt.Wdt),float(fctFromBlt.Hgt), pDraw->Blit(fctFromBlt.Surface, float(fctFromBlt.X), float(fctFromBlt.Y), float(fctFromBlt.Wdt),float(fctFromBlt.Hgt),
sfcDest, iX, iY, float(w2), float(h2), sfcDest, iX, iY, float(w2), float(h2),
true, pbt); true, pbt);
// advance pos and skip character indent // advance pos and skip character indent
@ -939,7 +939,7 @@ void CStdFont::DrawText(C4Surface * sfcDest, float iX, float iY, DWORD dwColor,
} }
// reset blit modulation // reset blit modulation
if (fWasModulated) if (fWasModulated)
lpDDraw->ActivateBlitModulation(dwOldModClr); pDraw->ActivateBlitModulation(dwOldModClr);
else else
lpDDraw->DeactivateBlitModulation(); pDraw->DeactivateBlitModulation();
} }