diff --git a/engine/inc/C4Game.h b/engine/inc/C4Game.h index 35a326f6a..9d34b3131 100644 --- a/engine/inc/C4Game.h +++ b/engine/inc/C4Game.h @@ -90,7 +90,6 @@ class C4Game ~C4Game(); public: C4DefList Defs; - C4GraphicsResource GraphicsResource; C4Network2 Network; C4ClientList &Clients; // Shortcut C4GameParameters Parameters; diff --git a/engine/inc/C4GraphicsResource.h b/engine/inc/C4GraphicsResource.h index c68ea8218..d149c8e3c 100644 --- a/engine/inc/C4GraphicsResource.h +++ b/engine/inc/C4GraphicsResource.h @@ -119,4 +119,5 @@ class C4GraphicsResource friend class C4StartupGraphics; }; +extern C4GraphicsResource GraphicsResource; #endif diff --git a/engine/inc/C4Wrappers.h b/engine/inc/C4Wrappers.h index cd95a1850..5ef9354da 100644 --- a/engine/inc/C4Wrappers.h +++ b/engine/inc/C4Wrappers.h @@ -51,7 +51,7 @@ void SoundPan(const char *szSndName, C4Object *pObj, int32_t iPan); //=========================== Graphics Resource ========================================= -#define GfxR (&(Game.GraphicsResource)) +#define GfxR (&(::GraphicsResource)) //===================================== Ticks ========================================== diff --git a/engine/src/C4Application.cpp b/engine/src/C4Application.cpp index 5abd6fb15..c1f7c3234 100644 --- a/engine/src/C4Application.cpp +++ b/engine/src/C4Application.cpp @@ -427,14 +427,14 @@ bool C4Application::SetGameFont(const char *szFontFace, int32_t iFontSize) // first, check if the selected font can be created at all // check regular font only - there's no reason why the other fonts couldn't be created CStdFont TestFont; - if (!Game.FontLoader.InitFont(TestFont, szFontFace, C4FontLoader::C4FT_Main, iFontSize, &Game.GraphicsResource.Files)) + if (!Game.FontLoader.InitFont(TestFont, szFontFace, C4FontLoader::C4FT_Main, iFontSize, &::GraphicsResource.Files)) return false; // OK; reinit all fonts StdStrBuf sOldFont; sOldFont.Copy(Config.General.RXFontName); int32_t iOldFontSize = Config.General.RXFontSize; SCopy(szFontFace, Config.General.RXFontName); Config.General.RXFontSize = iFontSize; - if (!Game.GraphicsResource.InitFonts() || !C4Startup::Get()->Graphics.InitFonts()) + if (!::GraphicsResource.InitFonts() || !C4Startup::Get()->Graphics.InitFonts()) { // failed :o // shouldn't happen. Better restore config. diff --git a/engine/src/C4EditCursor.cpp b/engine/src/C4EditCursor.cpp index c231472cd..80de1a4b4 100644 --- a/engine/src/C4EditCursor.cpp +++ b/engine/src/C4EditCursor.cpp @@ -423,9 +423,9 @@ void C4EditCursor::Draw(C4TargetFacet &cgo, float Zoom) Application.DDraw->DrawLine(cgo.Surface,X*Zoom+cgo.X-cgo.TargetX*Zoom,Y*Zoom+cgo.Y-cgo.TargetY*Zoom,X2*Zoom+cgo.X-cgo.TargetX*Zoom,Y2*Zoom+cgo.Y-cgo.TargetY*Zoom,CWhite); // Draw drop target if (DropTarget) - Game.GraphicsResource.fctDropTarget.Draw(cgo.Surface, - DropTarget->GetX()*Zoom+cgo.X-cgo.TargetX*Zoom-Game.GraphicsResource.fctDropTarget.Wdt/2, - DropTarget->GetY()*Zoom+DropTarget->Shape.y+cgo.Y-cgo.TargetY*Zoom-Game.GraphicsResource.fctDropTarget.Hgt); + ::GraphicsResource.fctDropTarget.Draw(cgo.Surface, + DropTarget->GetX()*Zoom+cgo.X-cgo.TargetX*Zoom-::GraphicsResource.fctDropTarget.Wdt/2, + DropTarget->GetY()*Zoom+DropTarget->Shape.y+cgo.Y-cgo.TargetY*Zoom-::GraphicsResource.fctDropTarget.Hgt); } diff --git a/engine/src/C4Facet.cpp b/engine/src/C4Facet.cpp index 9e4dbd15a..d85b22293 100644 --- a/engine/src/C4Facet.cpp +++ b/engine/src/C4Facet.cpp @@ -288,14 +288,14 @@ void C4Facet::DrawValue(C4Facet &cgo, int32_t iValue, int32_t iSectionX, int32_t { case C4FCT_Center: Draw(cgo, TRUE, iSectionX, iSectionY); - lpDDraw->TextOut(ostr, Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, + lpDDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, cgo.X + cgo.Wdt - 1, cgo.Y + cgo.Hgt - 1, CStdDDraw::DEFAULT_MESSAGE_COLOR, ARight); break; case C4FCT_Right: { int32_t textwdt, texthgt; - Game.GraphicsResource.FontRegular.GetTextExtent(ostr, textwdt, texthgt, false); - lpDDraw->TextOut(ostr, Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, + ::GraphicsResource.FontRegular.GetTextExtent(ostr, textwdt, texthgt, false); + lpDDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, 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); Draw(cgo, TRUE, iSectionX, iSectionY); @@ -314,15 +314,15 @@ void C4Facet::DrawValue2(C4Facet &cgo, int32_t iValue1, int32_t iValue2, int32_t { case C4FCT_Center: Draw(cgo, TRUE, iSectionX, iSectionY); - lpDDraw->TextOut(ostr, Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, + lpDDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, cgo.X + cgo.Wdt - 1, cgo.Y + cgo.Hgt - 1, CStdDDraw::DEFAULT_MESSAGE_COLOR, ARight); break; case C4FCT_Right: { int32_t textwdt, texthgt; - Game.GraphicsResource.FontRegular.GetTextExtent(ostr, textwdt, texthgt, false); + ::GraphicsResource.FontRegular.GetTextExtent(ostr, textwdt, texthgt, false); textwdt += Wdt + 3; - lpDDraw->TextOut(ostr, Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, + lpDDraw->TextOut(ostr, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, 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); Draw(cgo, TRUE, iSectionX, iSectionY); diff --git a/engine/src/C4FileSelDlg.cpp b/engine/src/C4FileSelDlg.cpp index 9991038b6..0e417a38a 100644 --- a/engine/src/C4FileSelDlg.cpp +++ b/engine/src/C4FileSelDlg.cpp @@ -23,7 +23,7 @@ #include #ifndef BIG_C4INCLUDE -#include // only for single use of Game.GraphicsResource.fctOKCancel below... +#include // only for single use of ::GraphicsResource.fctOKCancel below... #endif #ifdef _WIN32 @@ -504,7 +504,7 @@ void C4PortraitSelDlg::ListItem::DrawElement(C4TargetFacet &cgo) C4Facet cgoPicture(cgo.Surface, cgo.TargetX+rcBounds.x, cgo.TargetY+rcBounds.y, ImagePreviewSize, ImagePreviewSize); if (fError || !sFilename) { - C4Facet &fctNoneImg = Game.GraphicsResource.fctOKCancel; + C4Facet &fctNoneImg = ::GraphicsResource.fctOKCancel; fctNoneImg.Draw(cgoPicture.Surface, cgoPicture.X+(cgoPicture.Wdt-fctNoneImg.Wdt)/2, cgoPicture.Y+(cgoPicture.Hgt-fctNoneImg.Hgt)/2, 1,0); } else diff --git a/engine/src/C4Game.cpp b/engine/src/C4Game.cpp index 25bd784bc..0b74534f2 100644 --- a/engine/src/C4Game.cpp +++ b/engine/src/C4Game.cpp @@ -806,8 +806,8 @@ void C4Game::InitFullscreenComponents(bool fRunning) { // running game: Message board upper board and viewports C4Facet cgo; - cgo.Set(Application.DDraw->lpBack, 0, C4GUI::GetScreenHgt() - Game.GraphicsResource.FontRegular.iLineHgt, - C4GUI::GetScreenWdt(), Game.GraphicsResource.FontRegular.iLineHgt); + cgo.Set(Application.DDraw->lpBack, 0, C4GUI::GetScreenHgt() - ::GraphicsResource.FontRegular.iLineHgt, + C4GUI::GetScreenWdt(), ::GraphicsResource.FontRegular.iLineHgt); GraphicsSystem.MessageBoard.Init(cgo,FALSE); C4Facet cgo2; cgo2.Set(Application.DDraw->lpBack, 0, 0, C4GUI::GetScreenWdt(), C4UpperBoardHeight); @@ -1766,7 +1766,7 @@ void C4Game::DrawCursors(C4TargetFacet &cgo, int32_t iPlayer) fctCursor.Draw(cgo.Surface,cgo.X+cox,cgo.Y+coy,cphase); if (cursor->Info) { - int32_t texthgt = Game.GraphicsResource.FontRegular.iLineHgt; + int32_t texthgt = ::GraphicsResource.FontRegular.iLineHgt; StdStrBuf str; if (cursor->Info->Rank>0) { @@ -1775,7 +1775,7 @@ void C4Game::DrawCursors(C4TargetFacet &cgo, int32_t iPlayer) } else str = cursor->GetName(); - Application.DDraw->TextOut(str.getData(), Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, + Application.DDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface, cgo.X + cox + fctCursor.Wdt / 2, cgo.Y + coy - 2 - texthgt, 0xffff0000, ACenter); @@ -1969,7 +1969,7 @@ BOOL C4Game::SaveGameTitle(C4Group &hGroup) // Fullscreen Application.DDraw->Blit(Application.DDraw->lpBack, - 0.0f,0.0f,float(C4GUI::GetScreenWdt()),float(C4GUI::GetScreenHgt()-Game.GraphicsResource.FontRegular.iLineHgt), + 0.0f,0.0f,float(C4GUI::GetScreenWdt()),float(C4GUI::GetScreenHgt()-::GraphicsResource.FontRegular.iLineHgt), sfcPic,0,0,iSfcWdt,iSfcHgt); BOOL fOkay=TRUE; @@ -3234,7 +3234,7 @@ bool C4Game::InitSystem() // But postponing initialization until then would mean a black screen for quite some time of the initialization progress. // Peter wouldn't like this... #ifndef USE_CONSOLE - if (!FontLoader.InitFont(Game.GraphicsResource.FontRegular, Config.General.RXFontName, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &GraphicsResource.Files)) + if (!FontLoader.InitFont(::GraphicsResource.FontRegular, Config.General.RXFontName, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &GraphicsResource.Files)) return false; #endif // init message input (default commands) diff --git a/engine/src/C4GameLobby.cpp b/engine/src/C4GameLobby.cpp index 9173e6c84..1e32dbc68 100644 --- a/engine/src/C4GameLobby.cpp +++ b/engine/src/C4GameLobby.cpp @@ -305,7 +305,7 @@ void MainDlg::OnTestBtn(C4GUI::Control *btn) { pPlayerList->SetMode(C4PlayerInfoListBox::PILBM_Evaluation); pPlayerList->SetTeamFilter(1); - //pPlayerList->SetCustomFont(&Game.GraphicsResource.FontTooltip, 0xff000000); + //pPlayerList->SetCustomFont(&::GraphicsResource.FontTooltip, 0xff000000); } void MainDlg::SetCountdownState(CountdownState eToState, int32_t iTimer) diff --git a/engine/src/C4GameMessage.cpp b/engine/src/C4GameMessage.cpp index 262146584..de798e7e8 100644 --- a/engine/src/C4GameMessage.cpp +++ b/engine/src/C4GameMessage.cpp @@ -123,7 +123,7 @@ void C4GameMessage::Draw(C4TargetFacet &cgo, int32_t iPlayer, float Zoom) if (PortraitDef) { if (!wdt) wdt = BoundBy(cgo.Wdt/2, 50, Min(500, cgo.Wdt-10)); - int32_t iUnbrokenTextWidth = Game.GraphicsResource.FontRegular.GetTextWidth(Text.getData(), true); + int32_t iUnbrokenTextWidth = ::GraphicsResource.FontRegular.GetTextWidth(Text.getData(), true); wdt = Min(wdt, iUnbrokenTextWidth+10); } else @@ -134,11 +134,11 @@ void C4GameMessage::Draw(C4TargetFacet &cgo, int32_t iPlayer, float Zoom) wdt = BoundBy(wdt, 10, cgo.Wdt-10); } iTextWdt = wdt; - iTextHgt = Game.GraphicsResource.FontRegular.BreakMessage(Text.getData(), iTextWdt, &sText, true); + iTextHgt = ::GraphicsResource.FontRegular.BreakMessage(Text.getData(), iTextWdt, &sText, true); } else { - Game.GraphicsResource.FontRegular.GetTextExtent(Text.getData(), iTextWdt, iTextHgt, true); + ::GraphicsResource.FontRegular.GetTextExtent(Text.getData(), iTextWdt, iTextHgt, true); sText.Ref(Text); } int32_t iDrawX = cgo.X+x; @@ -172,7 +172,7 @@ void C4GameMessage::Draw(C4TargetFacet &cgo, int32_t iPlayer, float Zoom) C4Facet facet(cgo.Surface, iDrawX, iDrawY, PortraitWidth, PortraitWidth); fctPortrait.Draw(facet); // draw message - Application.DDraw->TextOut(sText.getData(),Game.GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX+PortraitWidth+PortraitIndent,iDrawY,ColorDw,ALeft); + Application.DDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX+PortraitWidth+PortraitIndent,iDrawY,ColorDw,ALeft); } else { @@ -180,7 +180,7 @@ void C4GameMessage::Draw(C4TargetFacet &cgo, int32_t iPlayer, float Zoom) iDrawX += cgo.Wdt/2; iDrawY += 2 * cgo.Hgt / 3 + 50; if (!(dwFlags & C4GM_Bottom)) iDrawY += DrawMessageOffset; - Application.DDraw->TextOut(sText.getData(),Game.GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX,iDrawY,ColorDw,ACenter); + Application.DDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular,1.0,cgo.Surface,iDrawX,iDrawY,ColorDw,ACenter); } } // Positioned @@ -218,16 +218,16 @@ void C4GameMessage::Draw(C4TargetFacet &cgo, int32_t iPlayer, float Zoom) // Word wrap to cgo width StdStrBuf sText; if (~dwFlags & C4GM_NoBreak) - Game.GraphicsResource.FontRegular.BreakMessage(Text.getData(), BoundBy(cgo.Wdt, 50, 200), &sText, true); + ::GraphicsResource.FontRegular.BreakMessage(Text.getData(), BoundBy(cgo.Wdt, 50, 200), &sText, true); else sText.Ref(Text); // Adjust position by output boundaries int32_t iTX,iTY,iTWdt,iTHgt; - Game.GraphicsResource.FontRegular.GetTextExtent(sText.getData(),iTWdt,iTHgt,true); + ::GraphicsResource.FontRegular.GetTextExtent(sText.getData(),iTWdt,iTHgt,true); iTX = BoundBy((iMsgX - cgo.TargetX) * Zoom, iTWdt/2, cgo.Wdt - iTWdt / 2); iTY = BoundBy((iMsgY - cgo.TargetY) * Zoom - iTHgt, 0, cgo.Hgt - iTHgt); // Draw - Application.DDraw->TextOut(sText.getData(), Game.GraphicsResource.FontRegular, 1.0, + Application.DDraw->TextOut(sText.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface, cgo.X + iTX, cgo.Y + iTY, diff --git a/engine/src/C4GameOverDlg.cpp b/engine/src/C4GameOverDlg.cpp index 748a5ac32..ae6c53128 100644 --- a/engine/src/C4GameOverDlg.cpp +++ b/engine/src/C4GameOverDlg.cpp @@ -222,7 +222,7 @@ C4GameOverDlg::C4GameOverDlg() : C4GUI::Dialog( (C4GUI::GetScreenWdt() < 800) ? ppPlayerLists[i]->SetToolTip(FormatString(LoadResStr("IDS_DESC_TEAM"), Game.Teams.GetTeamByIndex(i)->GetName()).getData()); else ppPlayerLists[i]->SetToolTip(LoadResStr("IDS_DESC_LISTOFPLAYERSWHOPARTICIPA"));*/ - //ppPlayerLists[i]->SetCustomFont(&Game.GraphicsResource.FontTooltip, 0xff000000); - display black on white? + //ppPlayerLists[i]->SetCustomFont(&::GraphicsResource.FontTooltip, 0xff000000); - display black on white? ppPlayerLists[i]->SetSelectionDiabled(true); ppPlayerLists[i]->SetDecoration(false, NULL, true, false); AddElement(ppPlayerLists[i]); diff --git a/engine/src/C4GraphicsResource.cpp b/engine/src/C4GraphicsResource.cpp index 9d80d8a1a..1a98636e0 100644 --- a/engine/src/C4GraphicsResource.cpp +++ b/engine/src/C4GraphicsResource.cpp @@ -164,10 +164,10 @@ bool C4GraphicsResource::InitFonts() // assign def list as custom image source FontRegular.SetCustomImages(&Game.Defs); // load additional fonts - if (!Game.FontLoader.InitFont(FontTitle, szFont, C4FontLoader::C4FT_Title, Config.General.RXFontSize, &Game.GraphicsResource.Files)) return false; - if (!Game.FontLoader.InitFont(FontCaption, szFont, C4FontLoader::C4FT_Caption, Config.General.RXFontSize, &Game.GraphicsResource.Files)) return false; - if (!Game.FontLoader.InitFont(FontTiny, szFont, C4FontLoader::C4FT_Log, Config.General.RXFontSize, &Game.GraphicsResource.Files)) return false; - if (!Game.FontLoader.InitFont(FontTooltip, szFont, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &Game.GraphicsResource.Files, false)) return false; + if (!Game.FontLoader.InitFont(FontTitle, szFont, C4FontLoader::C4FT_Title, Config.General.RXFontSize, &::GraphicsResource.Files)) return false; + if (!Game.FontLoader.InitFont(FontCaption, szFont, C4FontLoader::C4FT_Caption, Config.General.RXFontSize, &::GraphicsResource.Files)) return false; + if (!Game.FontLoader.InitFont(FontTiny, szFont, C4FontLoader::C4FT_Log, Config.General.RXFontSize, &::GraphicsResource.Files)) return false; + if (!Game.FontLoader.InitFont(FontTooltip, szFont, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &::GraphicsResource.Files, false)) return false; #endif // done, success return true; @@ -497,3 +497,5 @@ bool C4GraphicsResource::ReloadResolutionDependantFiles() fctMouseCursor.idSourceGroup = 0; return LoadCursorGfx(); } + +C4GraphicsResource GraphicsResource; diff --git a/engine/src/C4GraphicsSystem.cpp b/engine/src/C4GraphicsSystem.cpp index aa1ea98ef..da55a95b6 100644 --- a/engine/src/C4GraphicsSystem.cpp +++ b/engine/src/C4GraphicsSystem.cpp @@ -116,7 +116,7 @@ void C4GraphicsSystem::Clear() BOOL C4GraphicsSystem::SetPalette() { // Set primary palette by game palette - if (!Application.DDraw->SetPrimaryPalette(Game.GraphicsResource.GamePalette, Game.GraphicsResource.AlphaPalette)) return FALSE; + if (!Application.DDraw->SetPrimaryPalette(::GraphicsResource.GamePalette, ::GraphicsResource.AlphaPalette)) return FALSE; return TRUE; } @@ -341,7 +341,7 @@ void C4GraphicsSystem::DrawFullscreenBackground() for (int i=0, iNum=BackgroundAreas.GetCount(); iBlitSurfaceTile(Game.GraphicsResource.fctBackground.Surface,Application.DDraw->lpBack,rc.x,rc.y,rc.Wdt,rc.Hgt,-rc.x,-rc.y); + Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,Application.DDraw->lpBack,rc.x,rc.y,rc.Wdt,rc.Hgt,-rc.x,-rc.y); } --iRedrawBackground; } @@ -691,9 +691,9 @@ void C4GraphicsSystem::DrawHoldMessages() { if (Application.isFullScreen && Game.HaltCount) { - Application.DDraw->TextOut("Pause", Game.GraphicsResource.FontRegular,1.0, + Application.DDraw->TextOut("Pause", ::GraphicsResource.FontRegular,1.0, Application.DDraw->lpBack, C4GUI::GetScreenWdt()/2, - C4GUI::GetScreenHgt()/2 - Game.GraphicsResource.FontRegular.iLineHgt*2, + C4GUI::GetScreenHgt()/2 - ::GraphicsResource.FontRegular.iLineHgt*2, CStdDDraw::DEFAULT_MESSAGE_COLOR, ACenter); ::GraphicsSystem.OverwriteBg(); } @@ -713,7 +713,7 @@ void C4GraphicsSystem::SetDarkColorTable() { const int32_t iDarkening=80; // Using GamePalette - BYTE *bypPalette = Game.GraphicsResource.GamePalette; + BYTE *bypPalette = ::GraphicsResource.GamePalette; for (int32_t iColor=0; iColor<256; iColor++) DarkColorTable[iColor]=FindPaletteColor(bypPalette,Max(bypPalette[iColor*3+0]-iDarkening,0),Max(bypPalette[iColor*3+1]-iDarkening,0),Max(bypPalette[iColor*3+2]-iDarkening,0)); } @@ -748,7 +748,7 @@ void C4GraphicsSystem::DrawFlashMessage() { if (!FlashMessageTime) return; if (!Application.isFullScreen) return; - Application.DDraw->TextOut(FlashMessageText, Game.GraphicsResource.FontRegular, 1.0, Application.DDraw->lpBack, + Application.DDraw->TextOut(FlashMessageText, ::GraphicsResource.FontRegular, 1.0, Application.DDraw->lpBack, (FlashMessageX==-1) ? C4GUI::GetScreenWdt()/2 : FlashMessageX, (FlashMessageY==-1) ? C4GUI::GetScreenHgt()/2 : FlashMessageY, CStdDDraw::DEFAULT_MESSAGE_COLOR, @@ -784,7 +784,7 @@ void C4GraphicsSystem::DrawHelp() strText.AppendFormat("\n%s - %s\n", GetKeyboardInputName("Screenshot").getData(), LoadResStr("IDS_CTL_SCREENSHOT")); strText.AppendFormat("%s - %s\n", GetKeyboardInputName("ScreenshotEx").getData(), LoadResStr("IDS_CTL_SCREENSHOTEX")); - Application.DDraw->TextOut(strText.getData(), Game.GraphicsResource.FontRegular, 1.0, Application.DDraw->lpBack, + Application.DDraw->TextOut(strText.getData(), ::GraphicsResource.FontRegular, 1.0, Application.DDraw->lpBack, iX + 128, iY + 64, CStdDDraw::DEFAULT_MESSAGE_COLOR, ALeft); // right coloumn @@ -798,7 +798,7 @@ void C4GraphicsSystem::DrawHelp() strText.AppendFormat("%s - %s\n", GetKeyboardInputName("DbgShowVtxToggle").getData(), "Entrance+Vertices"); strText.AppendFormat("%s - %s\n", GetKeyboardInputName("DbgShowActionToggle").getData(), "Actions/Commands/Pathfinder"); strText.AppendFormat("%s - %s\n", GetKeyboardInputName("DbgShowSolidMaskToggle").getData(), "SolidMasks"); - Application.DDraw->TextOut(strText.getData(), Game.GraphicsResource.FontRegular, 1.0, Application.DDraw->lpBack, + Application.DDraw->TextOut(strText.getData(), ::GraphicsResource.FontRegular, 1.0, Application.DDraw->lpBack, iX + iWdt/2 + 64, iY + 64, CStdDDraw::DEFAULT_MESSAGE_COLOR, ALeft); } diff --git a/engine/src/C4Gui.cpp b/engine/src/C4Gui.cpp index 4e43b0de0..112371194 100644 --- a/engine/src/C4Gui.cpp +++ b/engine/src/C4Gui.cpp @@ -1125,28 +1125,28 @@ C4Rect &ComponentAligner::GetGridCell(int32_t iSectX, int32_t iSectXMax, int32_t bool Resource::Load(C4GroupSet &rFromGroup) { - // load gfx - using helper funcs from Game.GraphicsResource here... - if (!Game.GraphicsResource.LoadFile(sfcCaption, "GUICaption", rFromGroup, idSfcCaption)) return false; + // load gfx - using helper funcs from ::GraphicsResource here... + if (!::GraphicsResource.LoadFile(sfcCaption, "GUICaption", rFromGroup, idSfcCaption)) return false; barCaption.SetHorizontal(sfcCaption, sfcCaption.Hgt, 32); - if (!Game.GraphicsResource.LoadFile(sfcButton, "GUIButton", rFromGroup, idSfcButton)) return false; + if (!::GraphicsResource.LoadFile(sfcButton, "GUIButton", rFromGroup, idSfcButton)) return false; barButton.SetHorizontal(sfcButton); - if (!Game.GraphicsResource.LoadFile(sfcButtonD, "GUIButtonDown", rFromGroup, idSfcButtonD)) return false; + if (!::GraphicsResource.LoadFile(sfcButtonD, "GUIButtonDown", rFromGroup, idSfcButtonD)) return false; barButtonD.SetHorizontal(sfcButtonD); - if (!Game.GraphicsResource.LoadFile(fctButtonHighlight, "GUIButtonHighlight", rFromGroup)) return false; - if (!Game.GraphicsResource.LoadFile(fctIcons, "GUIIcons", rFromGroup)) return false; + if (!::GraphicsResource.LoadFile(fctButtonHighlight, "GUIButtonHighlight", rFromGroup)) return false; + if (!::GraphicsResource.LoadFile(fctIcons, "GUIIcons", rFromGroup)) return false; fctIcons.Set(fctIcons.Surface,0,0,C4GUI_IconWdt,C4GUI_IconHgt); - if (!Game.GraphicsResource.LoadFile(fctIconsEx, "GUIIcons2", rFromGroup)) return false; + if (!::GraphicsResource.LoadFile(fctIconsEx, "GUIIcons2", rFromGroup)) return false; fctIconsEx.Set(fctIconsEx.Surface,0,0,C4GUI_IconExWdt,C4GUI_IconExHgt); - if (!Game.GraphicsResource.LoadFile(sfcScroll, "GUIScroll", rFromGroup, idSfcScroll)) return false; + if (!::GraphicsResource.LoadFile(sfcScroll, "GUIScroll", rFromGroup, idSfcScroll)) return false; sfctScroll.Set(C4Facet(&sfcScroll,0,0,32,32)); - if (!Game.GraphicsResource.LoadFile(sfcContext, "GUIContext", rFromGroup, idSfcContext)) return false; + if (!::GraphicsResource.LoadFile(sfcContext, "GUIContext", rFromGroup, idSfcContext)) return false; fctContext.Set(&sfcContext,0,0,16,16); - if (!Game.GraphicsResource.LoadFile(fctSubmenu, "GUISubmenu", rFromGroup)) return false; - if (!Game.GraphicsResource.LoadFile(fctCheckbox, "GUICheckbox", rFromGroup)) return false; + if (!::GraphicsResource.LoadFile(fctSubmenu, "GUISubmenu", rFromGroup)) return false; + if (!::GraphicsResource.LoadFile(fctCheckbox, "GUICheckbox", rFromGroup)) return false; fctCheckbox.Set(fctCheckbox.Surface, 0,0,fctCheckbox.Hgt,fctCheckbox.Hgt); - if (!Game.GraphicsResource.LoadFile(fctBigArrows, "GUIBigArrows", rFromGroup)) return false; + if (!::GraphicsResource.LoadFile(fctBigArrows, "GUIBigArrows", rFromGroup)) return false; fctBigArrows.Set(fctBigArrows.Surface, 0,0, fctBigArrows.Wdt/4, fctBigArrows.Hgt); - if (!Game.GraphicsResource.LoadFile(fctProgressBar, "GUIProgress", rFromGroup)) return false; + if (!::GraphicsResource.LoadFile(fctProgressBar, "GUIProgress", rFromGroup)) return false; fctProgressBar.Set(fctProgressBar.Surface, 1,0, fctProgressBar.Wdt-2, fctProgressBar.Hgt); // loaded sucessfully pRes = this; diff --git a/engine/src/C4GuiDialogs.cpp b/engine/src/C4GuiDialogs.cpp index 87952a1f2..2a5c1ade2 100644 --- a/engine/src/C4GuiDialogs.cpp +++ b/engine/src/C4GuiDialogs.cpp @@ -868,7 +868,7 @@ FullscreenDialog::FullscreenDialog(const char *szTitle, const char *szSubtitle) { // help button disabled; use meaningful captions instead //pBtnHelp = new CallbackButton(Ico_UnknownClient /* 2do: Help icon */, C4Rect(0,0,32,32), 'H' /* 2do */, &FullscreenDialog::OnHelpBtn, this); - //C4Facet fctHelp = Game.GraphicsResource.fctOKCancel; + //C4Facet fctHelp = ::GraphicsResource.fctOKCancel; //fctHelp.Y += fctHelp.Hgt; //pBtnHelp->SetFacet(fctHelp); //pBtnHelp->SetToolTip("[.!]Help button: Press this button and hover the element you want help for!"); @@ -898,7 +898,7 @@ void FullscreenDialog::DrawElement(C4TargetFacet &cgo) { // draw upper board if (HasUpperBoard()) - lpDDraw->BlitSurfaceTile(Game.GraphicsResource.fctUpperBoard.Surface,cgo.Surface,0,Min(iFade-Game.GraphicsResource.fctUpperBoard.Hgt, 0),cgo.Wdt,Game.GraphicsResource.fctUpperBoard.Hgt); + lpDDraw->BlitSurfaceTile(::GraphicsResource.fctUpperBoard.Surface,cgo.Surface,0,Min(iFade-::GraphicsResource.fctUpperBoard.Hgt, 0),cgo.Wdt,::GraphicsResource.fctUpperBoard.Hgt); } void FullscreenDialog::UpdateOwnPos() diff --git a/engine/src/C4IDList.cpp b/engine/src/C4IDList.cpp index 4578e3a59..927693090 100644 --- a/engine/src/C4IDList.cpp +++ b/engine/src/C4IDList.cpp @@ -539,7 +539,7 @@ void C4IDList::Draw(C4Facet &cgo, int32_t iSelection, cgo2 = cgo.TruncateSection(iAlign); rDefs.Draw(c_id,cgo2,(firstid+cnt==iSelection),0); sprintf(buf,"%dx",idcount); - if (fCounts) Application.DDraw->TextOut(buf, Game.GraphicsResource.FontRegular, 1.0, cgo2.Surface,cgo2.X+cgo2.Wdt-1, cgo2.Y + cgo2.Hgt - 1 - Game.GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight); + if (fCounts) Application.DDraw->TextOut(buf, ::GraphicsResource.FontRegular, 1.0, cgo2.Surface,cgo2.X+cgo2.Wdt-1, cgo2.Y + cgo2.Hgt - 1 - ::GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight); } #endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/engine/src/C4Landscape.cpp b/engine/src/C4Landscape.cpp index 40586e456..4cdea450b 100644 --- a/engine/src/C4Landscape.cpp +++ b/engine/src/C4Landscape.cpp @@ -299,7 +299,7 @@ void C4Landscape::Draw(C4TargetFacet &cgo, int32_t iPlayer) if (::GraphicsSystem.ShowSolidMask) Application.DDraw->Blit8Fast(Surface8, cgo.TargetX, cgo.TargetY, cgo.Surface, cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt); else - Application.DDraw->BlitLandscape(Surface32, AnimationSurface, &Game.GraphicsResource.sfcLiquidAnimation, cgo.TargetX, cgo.TargetY, cgo.Surface, cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt); + Application.DDraw->BlitLandscape(Surface32, AnimationSurface, &::GraphicsResource.sfcLiquidAnimation, cgo.TargetX, cgo.TargetY, cgo.Surface, cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt); if (Modulation) Application.DDraw->DeactivateBlitModulation(); } diff --git a/engine/src/C4LoaderScreen.cpp b/engine/src/C4LoaderScreen.cpp index e5cac0049..3293f66b7 100644 --- a/engine/src/C4LoaderScreen.cpp +++ b/engine/src/C4LoaderScreen.cpp @@ -30,7 +30,7 @@ #include #endif -C4LoaderScreen::C4LoaderScreen() : TitleFont(Game.GraphicsResource.FontTitle), LogFont(Game.GraphicsResource.FontTiny) +C4LoaderScreen::C4LoaderScreen() : TitleFont(::GraphicsResource.FontTitle), LogFont(::GraphicsResource.FontTiny) { // zero fields szInfo=NULL; @@ -119,7 +119,7 @@ bool C4LoaderScreen::Init(const char *szLoaderSpec) }*/ // init fonts - if (!Game.GraphicsResource.InitFonts()) + if (!::GraphicsResource.InitFonts()) return false; // initial draw @@ -173,7 +173,7 @@ void C4LoaderScreen::Draw(C4Facet &cgo, int iProgress, C4LogBuffer *pLog, int Pr int iLogBoxMargin=2; int iVMargin=5; int iProgressBarHgt=15; - CStdFont &rLogBoxFont=LogFont, &rProgressBarFont=Game.GraphicsResource.FontRegular; + CStdFont &rLogBoxFont=LogFont, &rProgressBarFont=::GraphicsResource.FontRegular; float fLogBoxFontZoom=1.0f; // Background (loader) fctBackground.DrawFullScreen(cgo); diff --git a/engine/src/C4MainMenu.cpp b/engine/src/C4MainMenu.cpp index 30ac14708..9231a36c9 100644 --- a/engine/src/C4MainMenu.cpp +++ b/engine/src/C4MainMenu.cpp @@ -213,7 +213,7 @@ bool C4MainMenu::DoRefillInternal(bool &rfRefilled) if (!fHasIcon) { if (pTeam && pTeam->GetPlayerCount()) - Game.GraphicsResource.fctCrewClr.DrawClr(fctSymbol, TRUE, pTeam->GetColor()); + ::GraphicsResource.fctCrewClr.DrawClr(fctSymbol, TRUE, pTeam->GetColor()); else C4GUI::Icon::GetIconFacet(C4GUI::Ico_Team).Draw(fctSymbol, TRUE); } @@ -251,7 +251,7 @@ bool C4MainMenu::DoRefillInternal(bool &rfRefilled) { // Symbol fctSymbol.Create(C4SymbolSize,C4SymbolSize); - Game.GraphicsResource.fctPlayerClr.DrawClr(fctSymbol, TRUE, pPlr->ColorDw); + ::GraphicsResource.fctPlayerClr.DrawClr(fctSymbol, TRUE, pPlr->ColorDw); // Message StdStrBuf sMsg; DWORD dwClr = pPlr->ColorDw; @@ -330,7 +330,7 @@ bool C4MainMenu::ActivateGoals(int32_t iPlayer, bool fDoActivate) InitRefSym(GfxR->fctMenu.GetPhase(4),LoadResStr("IDS_MENU_CPGOALS"),iPlayer); SetAlignment(C4MN_Align_Left | C4MN_Align_Bottom); SetPermanent(false); - fctGF.Set(NULL, C4SymbolSize-Game.GraphicsResource.fctCaptain.Wdt-2, 2, Game.GraphicsResource.fctCaptain.Wdt, Game.GraphicsResource.fctCaptain.Hgt); + fctGF.Set(NULL, C4SymbolSize-::GraphicsResource.fctCaptain.Wdt-2, 2, ::GraphicsResource.fctCaptain.Wdt, ::GraphicsResource.fctCaptain.Hgt); } // determine if the goals are fulfilled - do the calls even if the menu is not to be opened to ensure synchronization C4IDList GoalList, FulfilledGoalList; @@ -353,7 +353,7 @@ bool C4MainMenu::ActivateGoals(int32_t iPlayer, bool fDoActivate) if (FulfilledGoalList.GetIDCount(idGoal)) { fctGF.Surface=fctSymbol.Surface; - Game.GraphicsResource.fctCaptain.Draw(fctGF); + ::GraphicsResource.fctCaptain.Draw(fctGF); } StdStrBuf Command; Command.Format("Player:Goal:%s", C4IdText(idGoal)); Add(pDef->GetName(),fctSymbol,Command.getData(),C4MN_Item_NoCount,NULL,pDef->GetDesc()); diff --git a/engine/src/C4Menu.cpp b/engine/src/C4Menu.cpp index 596cc47d8..4cd84fcc8 100644 --- a/engine/src/C4Menu.cpp +++ b/engine/src/C4Menu.cpp @@ -65,19 +65,19 @@ void DrawMenuSymbol(int32_t iMenu, C4Facet &cgo, int32_t iOwner, C4Object *cObj) } break; case C4MN_Buy: - Game.GraphicsResource.fctFlagClr.DrawClr(ccgo = cgo.GetFraction(75, 75), TRUE, dwColor); - Game.GraphicsResource.fctWealth.Draw(ccgo = cgo.GetFraction(100, 50, C4FCT_Left, C4FCT_Bottom)); - Game.GraphicsResource.fctArrow.Draw(ccgo = cgo.GetFraction(70, 70, C4FCT_Right, C4FCT_Center), FALSE, 0); + ::GraphicsResource.fctFlagClr.DrawClr(ccgo = cgo.GetFraction(75, 75), TRUE, dwColor); + ::GraphicsResource.fctWealth.Draw(ccgo = cgo.GetFraction(100, 50, C4FCT_Left, C4FCT_Bottom)); + ::GraphicsResource.fctArrow.Draw(ccgo = cgo.GetFraction(70, 70, C4FCT_Right, C4FCT_Center), FALSE, 0); break; case C4MN_Sell: - Game.GraphicsResource.fctFlagClr.DrawClr(ccgo = cgo.GetFraction(75, 75), TRUE, dwColor); - Game.GraphicsResource.fctWealth.Draw(ccgo = cgo.GetFraction(100, 50, C4FCT_Left, C4FCT_Bottom)); - Game.GraphicsResource.fctArrow.Draw(ccgo = cgo.GetFraction(70, 70, C4FCT_Right, C4FCT_Center), FALSE, 1); + ::GraphicsResource.fctFlagClr.DrawClr(ccgo = cgo.GetFraction(75, 75), TRUE, dwColor); + ::GraphicsResource.fctWealth.Draw(ccgo = cgo.GetFraction(100, 50, C4FCT_Left, C4FCT_Bottom)); + ::GraphicsResource.fctArrow.Draw(ccgo = cgo.GetFraction(70, 70, C4FCT_Right, C4FCT_Center), FALSE, 1); break; /*case C4MN_Main: - Game.GraphicsResource.fctFlagClr.DrawClr(cgo,TRUE,dwColor); + ::GraphicsResource.fctFlagClr.DrawClr(cgo,TRUE,dwColor); ccgo.Set(cgo.Surface,cgo.X,cgo.Y+cgo.Hgt/2,cgo.Wdt,cgo.Hgt/2); - Game.GraphicsResource.fctCrewClr.DrawClr(ccgo,TRUE,dwColor); + ::GraphicsResource.fctCrewClr.DrawClr(ccgo,TRUE,dwColor); break;*/ } } @@ -183,13 +183,13 @@ void C4MenuItem::DrawElement(C4TargetFacet &cgo) switch (iStyle) { case C4MN_Style_Context: - Application.DDraw->TextOut(Caption,Game.GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y,CStdDDraw::DEFAULT_MESSAGE_COLOR,ALeft); + Application.DDraw->TextOut(Caption,::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y,CStdDDraw::DEFAULT_MESSAGE_COLOR,ALeft); break; case C4MN_Style_Info: { StdStrBuf sText; - Game.GraphicsResource.FontRegular.BreakMessage(InfoCaption, cgoItemText.Wdt, &sText, true); - Application.DDraw->TextOut(sText.getData(), Game.GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y); + ::GraphicsResource.FontRegular.BreakMessage(InfoCaption, cgoItemText.Wdt, &sText, true); + Application.DDraw->TextOut(sText.getData(), ::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y); break; } case C4MN_Style_Dialog: @@ -204,8 +204,8 @@ void C4MenuItem::DrawElement(C4TargetFacet &cgo) } // display broken text StdStrBuf sText; - Game.GraphicsResource.FontRegular.BreakMessage(Caption, cgoItemText.Wdt, &sText, true); - Application.DDraw->TextOut(sText.getData(),Game.GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y); + ::GraphicsResource.FontRegular.BreakMessage(Caption, cgoItemText.Wdt, &sText, true); + Application.DDraw->TextOut(sText.getData(),::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X,cgoItemText.Y); // restore complete text if (cXChg) Caption[iStopPos] = cXChg; break; @@ -217,7 +217,7 @@ void C4MenuItem::DrawElement(C4TargetFacet &cgo) { char szCount[10+1]; sprintf(szCount,"%ix",Count); - Application.DDraw->TextOut(szCount,Game.GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X+cgoItemText.Wdt-1,cgoItemText.Y+cgoItemText.Hgt-1-Game.GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight); + Application.DDraw->TextOut(szCount,::GraphicsResource.FontRegular, 1.0, cgoItemText.Surface,cgoItemText.X+cgoItemText.Wdt-1,cgoItemText.Y+cgoItemText.Hgt-1-::GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight); } } @@ -672,15 +672,15 @@ void C4Menu::InitLocation(C4Facet &cgoArea) break; case C4MN_Style_Context: { - ItemHeight = Max(C4MN_SymbolSize, Game.GraphicsResource.FontRegular.GetLineHeight()); + ItemHeight = Max(C4MN_SymbolSize, ::GraphicsResource.FontRegular.GetLineHeight()); int32_t iWdt, iHgt; - Game.GraphicsResource.FontRegular.GetTextExtent(Caption, ItemWidth, iHgt, true); + ::GraphicsResource.FontRegular.GetTextExtent(Caption, ItemWidth, iHgt, true); // FIXME: Blah. This stuff should be calculated correctly by pTitle. ItemWidth += ItemHeight + 16; C4MenuItem *pItem; for (int i = 0; pItem = GetItem(i); ++i) { - Game.GraphicsResource.FontRegular.GetTextExtent(pItem->Caption, iWdt, iHgt, true); + ::GraphicsResource.FontRegular.GetTextExtent(pItem->Caption, iWdt, iHgt, true); ItemWidth = Max(ItemWidth, iWdt + pItem->GetSymbolWidth(ItemHeight)); } ItemWidth += 3; // Add some extra space so text doesn't touch right border frame... @@ -690,7 +690,7 @@ void C4Menu::InitLocation(C4Facet &cgoArea) { // calculate size from a default size determined by a window width of C4MN_DefInfoWdt int32_t iWdt,iHgt,iLargestTextWdt; - Game.GraphicsResource.FontRegular.GetTextExtent(Caption,iWdt,iHgt, true); + ::GraphicsResource.FontRegular.GetTextExtent(Caption,iWdt,iHgt, true); iLargestTextWdt = iWdt + 2 * C4MN_SymbolSize + C4MN_FrameWidth; ItemWidth=Min(cgoArea.Wdt - 2*C4MN_FrameWidth, Max(iLargestTextWdt, C4MN_DefInfoWdt)); ItemHeight=0; @@ -698,8 +698,8 @@ void C4Menu::InitLocation(C4Facet &cgoArea) C4MenuItem *pItem; for (int32_t i=0; pItem=GetItem(i); ++i) { - Game.GraphicsResource.FontRegular.BreakMessage(pItem->InfoCaption, ItemWidth, &sText, true); - Game.GraphicsResource.FontRegular.GetTextExtent(sText.getData(),iWdt,iHgt, true); + ::GraphicsResource.FontRegular.BreakMessage(pItem->InfoCaption, ItemWidth, &sText, true); + ::GraphicsResource.FontRegular.GetTextExtent(sText.getData(),iWdt,iHgt, true); assert(iWdt <= ItemWidth); ItemWidth=Max(ItemWidth,iWdt); ItemHeight=Max(ItemHeight,iHgt); iLargestTextWdt = Max(iLargestTextWdt, iWdt); @@ -721,7 +721,7 @@ void C4Menu::InitLocation(C4Facet &cgoArea) // dialog window: Item width is whole dialog, portrait subtracted if any // Item height varies int32_t iWdt,iHgt; - Game.GraphicsResource.FontRegular.GetTextExtent(Caption,iWdt,iHgt, true); + ::GraphicsResource.FontRegular.GetTextExtent(Caption,iWdt,iHgt, true); ItemWidth=Min(cgoArea.Wdt - 2*C4MN_FrameWidth, Max(iWdt + 2 * C4MN_SymbolSize + C4MN_FrameWidth, C4MN_DlgWdt)); ItemHeight=iHgt; // Items may be multiline and higher if (HasPortrait()) @@ -930,7 +930,7 @@ void C4Menu::DrawElement(C4TargetFacet &cgo) break; case C4MN_Extra_Value: { - if (pDef) Game.GraphicsResource.fctWealth.DrawValue(cgoExtra,iValue,0,0,C4FCT_Right); + if (pDef) ::GraphicsResource.fctWealth.DrawValue(cgoExtra,iValue,0,0,C4FCT_Right); // Flag parent object's owner's wealth display C4Player *pParentPlr = Game.Players.Get(GetControllingPlayer()); if (pParentPlr) pParentPlr->ViewWealth = C4ViewDelay; @@ -940,7 +940,7 @@ void C4Menu::DrawElement(C4TargetFacet &cgo) case C4MN_Extra_LiveMagicValue: if (pDef) { - Game.GraphicsResource.fctMagic.DrawValue2(cgoExtra,iValue,iUseExtraData,0,0,C4FCT_Right); + ::GraphicsResource.fctMagic.DrawValue2(cgoExtra,iValue,iUseExtraData,0,0,C4FCT_Right); } break; case C4MN_Extra_ComponentsMagic: @@ -950,7 +950,7 @@ void C4Menu::DrawElement(C4TargetFacet &cgo) { // DrawValue2 kills the facet... int32_t iOriginalX = cgoExtra.X; - Game.GraphicsResource.fctMagic.DrawValue2(cgoExtra,iValue,iUseExtraData,0,0,C4FCT_Right); + ::GraphicsResource.fctMagic.DrawValue2(cgoExtra,iValue,iUseExtraData,0,0,C4FCT_Right); cgoExtra.Wdt = cgoExtra.X - iOriginalX - 5; cgoExtra.X = iOriginalX; pItem->Components.Draw(cgoExtra,-1,Game.Defs,C4D_All,TRUE,C4FCT_Right | C4FCT_Triple | C4FCT_Half); @@ -1192,14 +1192,14 @@ void C4Menu::UpdateElementPositions() if (!pPrev || (!pPrev->IsSelectable || !pCurr->IsSelectable)) yOff += C4MN_DlgLineMargin; else yOff += C4MN_DlgOptionLineMargin; // determine item height. StdStrBuf sText; - int32_t iAssumedItemHeight = Game.GraphicsResource.FontRegular.GetLineHeight(); + int32_t iAssumedItemHeight = ::GraphicsResource.FontRegular.GetLineHeight(); int32_t iWdt, iAvailWdt = ItemWidth, iSymWdt; for(;;) { iSymWdt = Min(pCurr->GetSymbolWidth(iAssumedItemHeight), iAvailWdt/2); iAvailWdt = ItemWidth - iSymWdt; - Game.GraphicsResource.FontRegular.BreakMessage(pCurr->Caption, iAvailWdt, &sText, true); - Game.GraphicsResource.FontRegular.GetTextExtent(sText.getData(),iWdt,rcNewBounds.Hgt, true); + ::GraphicsResource.FontRegular.BreakMessage(pCurr->Caption, iAvailWdt, &sText, true); + ::GraphicsResource.FontRegular.GetTextExtent(sText.getData(),iWdt,rcNewBounds.Hgt, true); if (!iSymWdt || rcNewBounds.Hgt <= iAssumedItemHeight) break; // If there is a symbol, the symbol grows as more lines become available // Thus, less space is available for the text, and it might become larger diff --git a/engine/src/C4MessageBoard.cpp b/engine/src/C4MessageBoard.cpp index 58f7a8fd9..4ae2f118e 100644 --- a/engine/src/C4MessageBoard.cpp +++ b/engine/src/C4MessageBoard.cpp @@ -235,7 +235,7 @@ void C4MessageBoard::Init(C4Facet &cgo, BOOL fStartup) Active=TRUE; Output=cgo; Startup=fStartup; - iLineHgt=Game.GraphicsResource.FontRegular.iLineHgt; + iLineHgt=::GraphicsResource.FontRegular.iLineHgt; LogBuffer.SetLBWidth(Output.Wdt); if(!Startup) @@ -268,7 +268,7 @@ void C4MessageBoard::Draw(C4Facet &cgo) // Game running: message fader // Background - Application.DDraw->BlitSurfaceTile(Game.GraphicsResource.fctBackground.Surface,cgo.Surface,cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt,-cgo.X,-cgo.Y); + Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,cgo.X,cgo.Y,cgo.Wdt,cgo.Hgt,-cgo.X,-cgo.Y); // draw messages if(iMode != 2 || C4ChatInputDialog::IsShown()) @@ -311,7 +311,7 @@ void C4MessageBoard::Draw(C4Facet &cgo) dwFade = 0xff000000; dwColor |= dwFade; // Draw - Application.DDraw->StringOut(Message,Game.GraphicsResource.FontRegular,1.0,cgo.Surface,cgo.X,iMsgY,dwColor); + Application.DDraw->StringOut(Message,::GraphicsResource.FontRegular,1.0,cgo.Surface,cgo.X,iMsgY,dwColor); } } } @@ -343,7 +343,7 @@ void C4MessageBoard::AddLog(const char *szMessage) // make sure new message will be drawn ++iBackScroll; // register message in standard messageboard font - LogBuffer.AppendLines(szMessage, &Game.GraphicsResource.FontRegular, 0, NULL); + LogBuffer.AppendLines(szMessage, &::GraphicsResource.FontRegular, 0, NULL); } void C4MessageBoard::ClearLog() diff --git a/engine/src/C4MouseControl.cpp b/engine/src/C4MouseControl.cpp index 31039431f..21d733667 100644 --- a/engine/src/C4MouseControl.cpp +++ b/engine/src/C4MouseControl.cpp @@ -468,8 +468,8 @@ void C4MouseControl::Draw(C4TargetFacet &cgo, const ZoomData &GameZoom) { // Otherwise red mouse control style int32_t iWdt,iHgt; - Game.GraphicsResource.FontRegular.GetTextExtent(Caption.getData(), iWdt, iHgt, true); - Application.DDraw->TextOut(Caption.getData(), Game.GraphicsResource.FontRegular, 1.0, + ::GraphicsResource.FontRegular.GetTextExtent(Caption.getData(), iWdt, iHgt, true); + Application.DDraw->TextOut(Caption.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface, float(cgo.X)+BoundBy(GuiX,float(iWdt)/2+1,float(cgo.Wdt)-iWdt/2-1), float(cgo.Y)+Min( CaptionBottomY ? float(CaptionBottomY-iHgt-1) : GuiY+13, float(cgo.Hgt-iHgt)), diff --git a/engine/src/C4Network2.cpp b/engine/src/C4Network2.cpp index 9901e6bb0..08bf82bf2 100644 --- a/engine/src/C4Network2.cpp +++ b/engine/src/C4Network2.cpp @@ -999,7 +999,7 @@ void C4Network2::DrawStatus(C4TargetFacet &cgo) Stat.Append("| - none -"); // draw - Application.DDraw->TextOut(Stat.getData(), Game.GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X + 20,cgo.Y + 50); + Application.DDraw->TextOut(Stat.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X + 20,cgo.Y + 50); } bool C4Network2::InitNetIO(bool fNoClientID, bool fHost) diff --git a/engine/src/C4Object.cpp b/engine/src/C4Object.cpp index d43e55889..3275edb48 100644 --- a/engine/src/C4Object.cpp +++ b/engine/src/C4Object.cpp @@ -2333,8 +2333,8 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode) // Open MoveTo stack if (iMoveTos) { Cmds.AppendChar('|'); Cmds.AppendFormat("%dx MoveTo",iMoveTos); iMoveTos=0; } // Draw message - int32_t cmwdt,cmhgt; Game.GraphicsResource.FontRegular.GetTextExtent(Cmds.getData(),cmwdt,cmhgt,true); - Application.DDraw->TextOut(Cmds.getData(), Game.GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X+cox-Shape.GetX(),cgo.Y+coy-10-cmhgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter); + int32_t cmwdt,cmhgt; ::GraphicsResource.FontRegular.GetTextExtent(Cmds.getData(),cmwdt,cmhgt,true); + Application.DDraw->TextOut(Cmds.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X+cox-Shape.GetX(),cgo.Y+coy-10-cmhgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter); } // Debug Display /////////////////////////////////////////////////////////////////////////////// @@ -2377,7 +2377,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode) offY + fr.y, fr.Wdt, fr.Hgt); } - Game.GraphicsResource.fctFire.Draw(fgo,FALSE,FirePhase); + ::GraphicsResource.fctFire.Draw(fgo,FALSE,FirePhase); } // color modulation (including construction sign...) @@ -2434,7 +2434,7 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode) // Energy shortage if (NeedEnergy) if (Tick35>12) if (eDrawMode!=ODM_BaseOnly) { - C4Facet &fctEnergy = Game.GraphicsResource.fctEnergy; + C4Facet &fctEnergy = ::GraphicsResource.fctEnergy; int32_t tx=cox+Shape.Wdt/2-fctEnergy.Wdt/2, ty=coy-fctEnergy.Hgt-5; fctEnergy.Draw(cgo.Surface,cgo.X+tx,cgo.Y+ty); } @@ -2477,8 +2477,8 @@ void C4Object::Draw(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDrawMode) { StdStrBuf str; str.Format("%s (%d)",Def->ActMap[Action.Act].Name,Action.Phase); - int32_t cmwdt,cmhgt; Game.GraphicsResource.FontRegular.GetTextExtent(str.getData(),cmwdt,cmhgt,true); - Application.DDraw->TextOut(str.getData(), Game.GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X+cox-Shape.GetX(),cgo.Y+coy-cmhgt,InLiquid ? 0xfa0000FF : CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter); + int32_t cmwdt,cmhgt; ::GraphicsResource.FontRegular.GetTextExtent(str.getData(),cmwdt,cmhgt,true); + Application.DDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X+cox-Shape.GetX(),cgo.Y+coy-cmhgt,InLiquid ? 0xfa0000FF : CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter); } } // Debug Display /////////////////////////////////////////////////////////////////////// @@ -2520,16 +2520,16 @@ void C4Object::DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDraw else SCopy(GetName(),szText); // Word wrap to cgo width - int32_t iCharWdt, dummy; Game.GraphicsResource.FontRegular.GetTextExtent("m", iCharWdt, dummy, false); + int32_t iCharWdt, dummy; ::GraphicsResource.FontRegular.GetTextExtent("m", iCharWdt, dummy, false); int32_t iMaxLine = Max( cgo.Wdt / iCharWdt, 20 ); SWordWrap(szText,' ','|',iMaxLine); // Adjust position by output boundaries int32_t iTX,iTY,iTWdt,iTHgt; - Game.GraphicsResource.FontRegular.GetTextExtent(szText,iTWdt,iTHgt, true); + ::GraphicsResource.FontRegular.GetTextExtent(szText,iTWdt,iTHgt, true); iTX = BoundBy( X-cotx, iTWdt/2, cgo.Wdt-iTWdt/2 ); iTY = BoundBy( Y-coty-iTHgt, 0, cgo.Hgt-iTHgt ); // Draw - Application.DDraw->TextOut(szText, Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, cgo.X + iTX, cgo.Y + iTY, + Application.DDraw->TextOut(szText, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, cgo.X + iTX, cgo.Y + iTY, pOwner->ColorDw|0x7f000000,ACenter); } } @@ -2551,7 +2551,7 @@ void C4Object::DrawTopFace(C4TargetFacet &cgo, int32_t iByPlayer, DrawMode eDraw // Construction sign if (OCF & OCF_Construct) if (r==0) if (eDrawMode!=ODM_BaseOnly) { - C4Facet &fctConSign = Game.GraphicsResource.fctConstruction; + C4Facet &fctConSign = ::GraphicsResource.fctConstruction; lpDDraw->Blit(fctConSign.Surface, fctConSign.X, fctConSign.Y, fctConSign.Wdt, fctConSign.Hgt, @@ -2639,20 +2639,20 @@ void C4Object::DrawLine(C4TargetFacet &cgo) void C4Object::DrawEnergy(C4Facet &cgo) { //cgo.DrawEnergyLevel(Energy,GetPhysical()->Energy); - cgo.DrawEnergyLevelEx(Energy,GetPhysical()->Energy, Game.GraphicsResource.fctEnergyBars, 0); + cgo.DrawEnergyLevelEx(Energy,GetPhysical()->Energy, ::GraphicsResource.fctEnergyBars, 0); } void C4Object::DrawMagicEnergy(C4Facet &cgo) { // draw in units of MagicPhysicalFactor, so you can get a full magic energy bar by script even if partial magic energy training is not fulfilled //cgo.DrawEnergyLevel(MagicEnergy/MagicPhysicalFactor,GetPhysical()->Magic/MagicPhysicalFactor,39); - cgo.DrawEnergyLevelEx(MagicEnergy/MagicPhysicalFactor,GetPhysical()->Magic/MagicPhysicalFactor, Game.GraphicsResource.fctEnergyBars, 1); + cgo.DrawEnergyLevelEx(MagicEnergy/MagicPhysicalFactor,GetPhysical()->Magic/MagicPhysicalFactor, ::GraphicsResource.fctEnergyBars, 1); } void C4Object::DrawBreath(C4Facet &cgo) { //cgo.DrawEnergyLevel(Breath,GetPhysical()->Breath,99); - cgo.DrawEnergyLevelEx(Breath,GetPhysical()->Breath, Game.GraphicsResource.fctEnergyBars, 2); + cgo.DrawEnergyLevelEx(Breath,GetPhysical()->Breath, ::GraphicsResource.fctEnergyBars, 2); } void C4Object::CompileFunc(StdCompiler *pComp) @@ -2915,7 +2915,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList * tObj->DrawCommand(cgoBottom,C4FCT_Right,NULL,com,pRegions,Owner, FormatString(LoadResStr("IDS_CON_BUILD"), tObj->GetName()).getData(),&ccgo); tObj->Def->Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Right, C4FCT_Top), FALSE, tObj->Color, tObj); - Game.GraphicsResource.fctBuild.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE); + ::GraphicsResource.fctBuild.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE); } // Grab target control (control flag) @@ -2937,7 +2937,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList * Action.Target->DrawCommand(cgoBottom, C4FCT_Right, NULL, ComOrder(cnt), pRegions, Owner, FormatString(LoadResStr("IDS_CON_UNGRAB"), Action.Target->GetName()).getData(), &ccgo); Action.Target->Def->Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Right, C4FCT_Top), FALSE, Action.Target->Color, Action.Target); - Game.GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 6); + ::GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 6); } else if (ComOrder(cnt) == COM_Throw) { @@ -2947,7 +2947,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList * Action.Target->DrawCommand(cgoBottom, C4FCT_Right, NULL, COM_Throw, pRegions, Owner, FormatString(LoadResStr("IDS_CON_PUT"), tObj->GetName(), Action.Target->GetName()).getData(), &ccgo); tObj->Def->Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Right, C4FCT_Top), FALSE, tObj->Color, tObj); - Game.GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 0); + ::GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 0); } // Get else if (Action.Target->Contents.ListIDCount(C4D_Get) && (Action.Target->Def->GrabPutGet & C4D_Grab_Get)) @@ -2955,7 +2955,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList * Action.Target->DrawCommand(cgoBottom,C4FCT_Right,NULL,COM_Throw,pRegions,Owner, FormatString(LoadResStr("IDS_CON_GET"),Action.Target->GetName()).getData(), &ccgo); Action.Target->Def->Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Right, C4FCT_Top), FALSE, Action.Target->Color, Action.Target); - Game.GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 1); + ::GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 1); } } } @@ -2978,7 +2978,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList * { DrawCommand(cgoBottom,C4FCT_Right,NULL,COM_Down,pRegions,Owner, LoadResStr("IDS_CON_EXIT"),&ccgo); - Game.GraphicsResource.fctExit.Draw(ccgo); + ::GraphicsResource.fctExit.Draw(ccgo); } // Contained base commands if (ValidPlr(Contained->Base)) @@ -3009,7 +3009,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList * Contained->DrawCommand(cgoBottom,C4FCT_Right,NULL,COM_Right,pRegions,Owner, FormatString(LoadResStr("IDS_CON_GET"),Contained->GetName()).getData(),&ccgo); Contained->Def->Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Right, C4FCT_Top), FALSE, Contained->Color, Contained); - Game.GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 1); + ::GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 1); } // carlo: Get ("Take") if (!fContainedLeftOverride) @@ -3017,7 +3017,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList * Contained->DrawCommand(cgoBottom,C4FCT_Right,NULL,COM_Left,pRegions,Owner, FormatString(LoadResStr("IDS_CON_ACTIVATEFROM"),Contained->GetName()).getData(),&ccgo); Contained->Def->Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Right, C4FCT_Top), FALSE, Contained->Color, Contained); - Game.GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 0); + ::GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 0); } } if (tObj=Contents.GetObject()) @@ -3026,7 +3026,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList * Contained->DrawCommand(cgoBottom,C4FCT_Right,NULL,COM_Throw,pRegions,Owner, FormatString(LoadResStr("IDS_CON_PUT"),tObj->GetName(),Contained->GetName()).getData(),&ccgo); tObj->Def->Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Right, C4FCT_Top), FALSE, tObj->Color, tObj); - Game.GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 0); + ::GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 0); } else if (nContents) { @@ -3034,7 +3034,7 @@ void C4Object::DrawCommands(C4Facet &cgoBottom, C4Facet &cgoSide, C4RegionList * Contained->DrawCommand(cgoBottom,C4FCT_Right,NULL,COM_Throw,pRegions,Owner, FormatString(LoadResStr("IDS_CON_ACTIVATEFROM"),Contained->GetName()).getData(),&ccgo); Contained->Def->Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Right, C4FCT_Top), FALSE, Contained->Color, Contained); - Game.GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 0); + ::GraphicsResource.fctHand.Draw(ccgo2 = ccgo.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom), TRUE, 0); } } diff --git a/engine/src/C4ObjectCom.cpp b/engine/src/C4ObjectCom.cpp index 62c4b6262..3c4e0dd4b 100644 --- a/engine/src/C4ObjectCom.cpp +++ b/engine/src/C4ObjectCom.cpp @@ -924,14 +924,14 @@ bool ComDirLike(int32_t iComDir, int32_t iSample) void DrawCommandKey(C4Facet &cgo, int32_t iCom, BOOL fPressed, const char *szText) { // Draw key - Game.GraphicsResource.fctKey.Draw(cgo,FALSE,fPressed); + ::GraphicsResource.fctKey.Draw(cgo,FALSE,fPressed); // Draw control symbol if (iCom == COM_PlayerMenu) - Game.GraphicsResource.fctOKCancel.Draw(cgo,TRUE,1,1); + ::GraphicsResource.fctOKCancel.Draw(cgo,TRUE,1,1); else - Game.GraphicsResource.fctCommand.Draw(cgo,TRUE,Com2Control(iCom),((iCom & COM_Double)!=0)); + ::GraphicsResource.fctCommand.Draw(cgo,TRUE,Com2Control(iCom),((iCom & COM_Double)!=0)); // Use smaller font on smaller buttons - CStdFont &rFont = (cgo.Hgt <= C4MN_SymbolSize) ? Game.GraphicsResource.FontTiny : Game.GraphicsResource.FontRegular; + CStdFont &rFont = (cgo.Hgt <= C4MN_SymbolSize) ? ::GraphicsResource.FontTiny : ::GraphicsResource.FontRegular; // Draw text if (szText && Config.Graphics.ShowCommandKeys) Application.DDraw->TextOut(szText, rFont, 1.0, cgo.Surface,cgo.X+cgo.Wdt/2,cgo.Y+cgo.Hgt-rFont.iLineHgt-2,CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter); @@ -940,11 +940,11 @@ void DrawCommandKey(C4Facet &cgo, int32_t iCom, BOOL fPressed, const char *szTex void DrawControlKey(C4Facet &cgo, int32_t iControl, BOOL fPressed, const char *szText) { // Draw key - Game.GraphicsResource.fctKey.Draw(cgo,FALSE,fPressed); + ::GraphicsResource.fctKey.Draw(cgo,FALSE,fPressed); // Draw control symbol - Game.GraphicsResource.fctCommand.Draw(cgo,TRUE,iControl); + ::GraphicsResource.fctCommand.Draw(cgo,TRUE,iControl); // Use smaller font on smaller buttons - CStdFont &rFont = (cgo.Hgt <= C4MN_SymbolSize) ? Game.GraphicsResource.FontRegular : Game.GraphicsResource.FontTiny; + CStdFont &rFont = (cgo.Hgt <= C4MN_SymbolSize) ? ::GraphicsResource.FontRegular : ::GraphicsResource.FontTiny; // Draw text if (szText) Application.DDraw->TextOut(szText, rFont, 1.0, cgo.Surface,cgo.X+cgo.Wdt/2,cgo.Y+cgo.Hgt-rFont.iLineHgt-2,CStdDDraw::DEFAULT_MESSAGE_COLOR,ACenter); diff --git a/engine/src/C4ObjectInfo.cpp b/engine/src/C4ObjectInfo.cpp index bb6fb4e3a..1fdff2570 100644 --- a/engine/src/C4ObjectInfo.cpp +++ b/engine/src/C4ObjectInfo.cpp @@ -332,14 +332,14 @@ void C4ObjectInfo::Draw(C4Facet &cgo, BOOL fShowPortrait, BOOL fCaptain, C4Objec // Captain symbol if (fCaptain) { - Game.GraphicsResource.fctCaptain.Draw(cgo.Surface,cgo.X+iX,cgo.Y,0,0); - iX+=Game.GraphicsResource.fctCaptain.Wdt; + ::GraphicsResource.fctCaptain.Draw(cgo.Surface,cgo.X+iX,cgo.Y,0,0); + iX+=::GraphicsResource.fctCaptain.Wdt; } // Rank symbol C4RankSystem *pRankSys = &::DefaultRanks; - C4Facet *pRankRes=&Game.GraphicsResource.fctRank; - int iRankCnt=Game.GraphicsResource.iNumRanks; + C4Facet *pRankRes=&::GraphicsResource.fctRank; + int iRankCnt=::GraphicsResource.iNumRanks; if (pOfObj) { C4Def *pDef=pOfObj->Def; @@ -354,12 +354,12 @@ void C4ObjectInfo::Draw(C4Facet &cgo, BOOL fShowPortrait, BOOL fCaptain, C4Objec } } pRankSys->DrawRankSymbol(NULL, Rank, pRankRes, iRankCnt, false, iX, &cgo); - iX+=Game.GraphicsResource.fctRank.Wdt; + iX+=::GraphicsResource.fctRank.Wdt; // Rank & Name StdStrBuf name; if (Rank>0) name.Format("%s|%s",sRankName.getData(),pOfObj->GetName ()); else name.Format("%s",pOfObj->GetName ()); - Application.DDraw->TextOut(name.getData(), Game.GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X+iX,cgo.Y,CStdDDraw::DEFAULT_MESSAGE_COLOR,ALeft); + Application.DDraw->TextOut(name.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X+iX,cgo.Y,CStdDDraw::DEFAULT_MESSAGE_COLOR,ALeft); #endif // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } diff --git a/engine/src/C4ObjectList.cpp b/engine/src/C4ObjectList.cpp index ebef94a28..e9fe1f9b4 100644 --- a/engine/src/C4ObjectList.cpp +++ b/engine/src/C4ObjectList.cpp @@ -375,7 +375,7 @@ void C4ObjectList::DrawIDList(C4Facet &cgo, int iSelection, // Draw count sprintf(szCount,"%dx",iCount); if ((iCount!=1) || fDrawOneCounts) - Application.DDraw->TextOut(szCount, Game.GraphicsResource.FontRegular, 1.0, cgo2.Surface,cgo2.X+cgo2.Wdt-1,cgo2.Y+cgo2.Hgt-1-Game.GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight); + Application.DDraw->TextOut(szCount, ::GraphicsResource.FontRegular, 1.0, cgo2.Surface,cgo2.X+cgo2.Wdt-1,cgo2.Y+cgo2.Hgt-1-::GraphicsResource.FontRegular.iLineHgt,CStdDDraw::DEFAULT_MESSAGE_COLOR,ARight); // Region if (pRegions) pRegions->Add(cgo2.X,cgo2.Y,cgo2.Wdt,cgo2.Hgt,pFirstObj->GetName(),iRegionCom,pFirstObj,COM_None,COM_None,pFirstObj->Number); // Next section diff --git a/engine/src/C4ObjectMenu.cpp b/engine/src/C4ObjectMenu.cpp index c43da8206..39cf88e08 100644 --- a/engine/src/C4ObjectMenu.cpp +++ b/engine/src/C4ObjectMenu.cpp @@ -327,7 +327,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled) fctTarget = fctSymbol.GetFraction(85, 85, C4FCT_Right, C4FCT_Top); Object->Contents.GetObject(0)->DrawPicture(fctTarget); fctTarget = fctSymbol.GetFraction(85, 85, C4FCT_Left, C4FCT_Bottom); - Game.GraphicsResource.fctHand.Draw(fctTarget, TRUE, 0); + ::GraphicsResource.fctHand.Draw(fctTarget, TRUE, 0); // Add menu item Add(LoadResStr("IDS_CON_PUT2"), fctSymbol, szCommand, C4MN_Item_NoCount, NULL, NULL, C4ID_None, szCommand2); // Preserve symbol @@ -405,7 +405,7 @@ bool C4ObjectMenu::DoRefillInternal(bool &rfRefilled) { sprintf(szCommand, "PlayerObjectCommand(GetOwner(), \"Exit\") && ExecuteCommand()"); // Exit all selected clonks... fctSymbol.Create(C4SymbolSize,C4SymbolSize); - Game.GraphicsResource.fctExit.Draw(fctSymbol); + ::GraphicsResource.fctExit.Draw(fctSymbol); Add(LoadResStr("IDS_COMM_EXIT"), fctSymbol, szCommand); fctSymbol.Default(); } diff --git a/engine/src/C4Particles.cpp b/engine/src/C4Particles.cpp index 3ace28d5b..621328a14 100644 --- a/engine/src/C4Particles.cpp +++ b/engine/src/C4Particles.cpp @@ -523,7 +523,7 @@ void C4ParticleSystem::SetDefParticles() // if fire is drawn w/o background fct: unload fire face if both fire particles are assigned // but this is not done here //if (IsFireParticleLoaded()) - // Game.GraphicsResource.fctFire.Clear(); + // ::GraphicsResource.fctFire.Clear(); } int32_t C4ParticleSystem::Push(C4ParticleDef *pOfDef, float dxdir, float dydir) diff --git a/engine/src/C4Player.cpp b/engine/src/C4Player.cpp index e65f541cb..36d786d5f 100644 --- a/engine/src/C4Player.cpp +++ b/engine/src/C4Player.cpp @@ -1162,11 +1162,11 @@ void C4Player::DrawHostility(C4Facet &cgo, int32_t iIndex) pPlr->BigIcon.Draw(cgo); // Standard player image else - Game.GraphicsResource.fctCrewClr.DrawClr(cgo, TRUE, pPlr->ColorDw); + ::GraphicsResource.fctCrewClr.DrawClr(cgo, TRUE, pPlr->ColorDw); // Other player and hostile if (pPlr != this) if (Hostility.GetIDCount(pPlr->Number+1)) - Game.GraphicsResource.fctMenu.GetPhase(7).Draw(cgo); + ::GraphicsResource.fctMenu.GetPhase(7).Draw(cgo); } } diff --git a/engine/src/C4PlayerInfoListBox.cpp b/engine/src/C4PlayerInfoListBox.cpp index 773fbe094..88d0a737f 100644 --- a/engine/src/C4PlayerInfoListBox.cpp +++ b/engine/src/C4PlayerInfoListBox.cpp @@ -281,7 +281,7 @@ void C4PlayerInfoListBox::PlayerListItem::UpdateIcon(C4PlayerInfo *pInfo, C4Play { // no custom icon: create default by player color pIcon->GetMFacet().Create(C4GUI_IconWdt,C4GUI_IconHgt); - Game.GraphicsResource.fctPlayerClr.DrawClr(pIcon->GetMFacet(), TRUE, dwPlayerClr); + ::GraphicsResource.fctPlayerClr.DrawClr(pIcon->GetMFacet(), TRUE, dwPlayerClr); } fIconSet = true; // unreg icon? Grayscale and stamp! @@ -319,11 +319,11 @@ void C4PlayerInfoListBox::PlayerListItem::UpdateIcon(C4PlayerInfo *pInfo, C4Play // shadow DWORD dwPrevMod; bool fPrevMod = lpDDraw->GetBlitModulation(dwPrevMod); Application.DDraw->ActivateBlitModulation(1); - Game.GraphicsResource.fctCrewClr.DrawClr(fctDraw, TRUE, dwJoinedInfoClr); + ::GraphicsResource.fctCrewClr.DrawClr(fctDraw, TRUE, dwJoinedInfoClr); if (fPrevMod) lpDDraw->ActivateBlitModulation(dwPrevMod); else lpDDraw->DeactivateBlitModulation(); fctDraw.X = 0; // gfx - Game.GraphicsResource.fctCrewClr.DrawClr(fctDraw, TRUE, dwJoinedInfoClr); + ::GraphicsResource.fctCrewClr.DrawClr(fctDraw, TRUE, dwJoinedInfoClr); } fJoinedInfoSet = fHasJoinedInfo; dwJoinClr = dwJoinedInfoClr; diff --git a/engine/src/C4RankSystem.cpp b/engine/src/C4RankSystem.cpp index e11dc4dbc..02704d1f3 100644 --- a/engine/src/C4RankSystem.cpp +++ b/engine/src/C4RankSystem.cpp @@ -294,7 +294,7 @@ bool C4RankSystem::DrawRankSymbol(C4FacetSurface *fctSymbol, int32_t iRank, C4Fa { // extended rank: draw // extension star defaults to captain star; but use extended symbols if they are in the gfx - C4Facet fctExtended = Game.GraphicsResource.fctCaptain; + C4Facet fctExtended = ::GraphicsResource.fctCaptain; if (iMaxRankSym > iRankSymbolCount) { int32_t iExtended = iRank / iRankSymbolCount - 1 + iRankSymbolCount; diff --git a/engine/src/C4Scoreboard.cpp b/engine/src/C4Scoreboard.cpp index 0c790cc71..c9be6d111 100644 --- a/engine/src/C4Scoreboard.cpp +++ b/engine/src/C4Scoreboard.cpp @@ -344,13 +344,13 @@ void C4ScoreboardDlg::Update() for (int32_t iRow = 0; iRow < iRowCount; ++iRow) { C4Scoreboard::Entry *pCell = pBrd->GetCell(iCol, iRow); - if ((iRow || iCol) && !pCell->Text.isNull()) piColWidths[iCol] = Max(piColWidths[iCol], Game.GraphicsResource.FontRegular.GetTextWidth(pCell->Text.getData()) + XIndent); + if ((iRow || iCol) && !pCell->Text.isNull()) piColWidths[iCol] = Max(piColWidths[iCol], ::GraphicsResource.FontRegular.GetTextWidth(pCell->Text.getData()) + XIndent); } iWdt += piColWidths[iCol]; } - iHgt += iRowCount * (Game.GraphicsResource.FontRegular.GetLineHeight() + YIndent); + iHgt += iRowCount * (::GraphicsResource.FontRegular.GetLineHeight() + YIndent); const char *szTitle = pBrd->GetCell(0,0)->Text.getData(); - if (szTitle) iWdt = Max(iWdt, Game.GraphicsResource.FontRegular.GetTextWidth(szTitle) + 40); + if (szTitle) iWdt = Max(iWdt, ::GraphicsResource.FontRegular.GetTextWidth(szTitle) + 40); if (!pTitle != !szTitle) SetTitle(szTitle); // needed for title margin... iWdt += GetMarginLeft() + GetMarginRight(); iHgt += GetMarginTop() + GetMarginBottom(); @@ -391,9 +391,9 @@ void C4ScoreboardDlg::DrawElement(C4TargetFacet &cgo) { const char *szText = pBrd->GetCell(iCol, iRow)->Text.getData(); if (szText && *szText && (iRow || iCol)) - lpDDraw->TextOut(szText, Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, iCol ? iX + piColWidths[iCol]/2 : iX, iY, 0xffffffff, iCol ? ACenter : ALeft); + lpDDraw->TextOut(szText, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, iCol ? iX + piColWidths[iCol]/2 : iX, iY, 0xffffffff, iCol ? ACenter : ALeft); iX += piColWidths[iCol]; } - iY += Game.GraphicsResource.FontRegular.GetLineHeight() + YIndent; + iY += ::GraphicsResource.FontRegular.GetLineHeight() + YIndent; } } diff --git a/engine/src/C4Script.cpp b/engine/src/C4Script.cpp index 9be4f3bd6..a48e1462d 100644 --- a/engine/src/C4Script.cpp +++ b/engine/src/C4Script.cpp @@ -1611,8 +1611,8 @@ static C4Value FnAddMenuItem(C4AulContext *cthr, C4Value *pPars) case C4MN_Add_ImgRank: { // symbol by rank - C4Facet *pfctRankSym = &Game.GraphicsResource.fctRank; - int32_t iRankSymNum = Game.GraphicsResource.iNumRanks; + C4Facet *pfctRankSym = &::GraphicsResource.fctRank; + int32_t iRankSymNum = ::GraphicsResource.iNumRanks; if (pDef && pDef->pRankSymbols) { pfctRankSym = pDef->pRankSymbols; @@ -1636,8 +1636,8 @@ static C4Value FnAddMenuItem(C4AulContext *cthr, C4Value *pPars) { // create graphics // get rank gfx - C4Facet *pRankRes=&Game.GraphicsResource.fctRank; - long iRankCnt=Game.GraphicsResource.iNumRanks; + C4Facet *pRankRes=&::GraphicsResource.fctRank; + long iRankCnt=::GraphicsResource.iNumRanks; C4Def *pDef=pGfxObj->Def; if (pDef->pRankSymbols) { diff --git a/engine/src/C4Sky.cpp b/engine/src/C4Sky.cpp index 1ab12bce2..2c7afdc5e 100644 --- a/engine/src/C4Sky.cpp +++ b/engine/src/C4Sky.cpp @@ -65,7 +65,7 @@ void C4Sky::SetFadePalette(int32_t *ipColors) // If colors all zero, use game palette default blue if (ipColors[0]+ipColors[1]+ipColors[2]+ipColors[3]+ipColors[4]+ipColors[5]==0) { - BYTE *pClr=Game.GraphicsResource.GamePalette+3*CSkyDef1; + BYTE *pClr=::GraphicsResource.GamePalette+3*CSkyDef1; FadeClr1=C4RGB(pClr[0], pClr[1], pClr[2]); FadeClr2=C4RGB(pClr[3*19+0], pClr[3*19+1], pClr[3*19+2]); } @@ -108,7 +108,7 @@ BOOL C4Sky::Init(bool fSavegame) loaded = !!Surface->LoadAny(Game.ScenarioFile,str,true,true); if (!loaded) { - loaded = !!Surface->LoadAny(Game.GraphicsResource.Files, str, true); + loaded = !!Surface->LoadAny(::GraphicsResource.Files, str, true); } } } diff --git a/engine/src/C4Startup.cpp b/engine/src/C4Startup.cpp index ce6de4a27..1b371cf9b 100644 --- a/engine/src/C4Startup.cpp +++ b/engine/src/C4Startup.cpp @@ -36,7 +36,7 @@ bool C4StartupGraphics::LoadFile(C4FacetID &rToFct, const char *szFilename) { - return Game.GraphicsResource.LoadFile(rToFct, szFilename, Game.GraphicsResource.Files); + return ::GraphicsResource.LoadFile(rToFct, szFilename, ::GraphicsResource.Files); } bool C4StartupGraphics::Init() @@ -105,16 +105,16 @@ bool C4StartupGraphics::Init() bool C4StartupGraphics::InitFonts() { const char *szFont = Config.General.RXFontName; - if (!Game.FontLoader.InitFont(BookFontCapt, szFont, C4FontLoader::C4FT_Caption, Config.General.RXFontSize, &Game.GraphicsResource.Files, false)) + if (!Game.FontLoader.InitFont(BookFontCapt, szFont, C4FontLoader::C4FT_Caption, Config.General.RXFontSize, &::GraphicsResource.Files, false)) { LogFatal("Font Error (1)"); return false; } Game.SetInitProgress(85); - if (!Game.FontLoader.InitFont(BookFont, szFont, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &Game.GraphicsResource.Files, false)) + if (!Game.FontLoader.InitFont(BookFont, szFont, C4FontLoader::C4FT_Main, Config.General.RXFontSize, &::GraphicsResource.Files, false)) { LogFatal("Font Error (2)"); return false; } Game.SetInitProgress(90); - if (!Game.FontLoader.InitFont(BookFontTitle, szFont, C4FontLoader::C4FT_Title, Config.General.RXFontSize, &Game.GraphicsResource.Files, false)) + if (!Game.FontLoader.InitFont(BookFontTitle, szFont, C4FontLoader::C4FT_Title, Config.General.RXFontSize, &::GraphicsResource.Files, false)) { LogFatal("Font Error (3)"); return false; } Game.SetInitProgress(95); - if (!Game.FontLoader.InitFont(BookSmallFont, szFont, C4FontLoader::C4FT_MainSmall, Config.General.RXFontSize, &Game.GraphicsResource.Files, false)) + if (!Game.FontLoader.InitFont(BookSmallFont, szFont, C4FontLoader::C4FT_MainSmall, Config.General.RXFontSize, &::GraphicsResource.Files, false)) { LogFatal("Font Error (4)"); return false; } return true; } diff --git a/engine/src/C4StartupMainDlg.cpp b/engine/src/C4StartupMainDlg.cpp index 1215157ba..e91a2bc8d 100644 --- a/engine/src/C4StartupMainDlg.cpp +++ b/engine/src/C4StartupMainDlg.cpp @@ -116,7 +116,7 @@ void C4StartupMainDlg::DrawElement(C4TargetFacet &cgo) typedef C4GUI::FullscreenDialog Base; Base::DrawElement(cgo); // draw logo - C4Facet &fctLogo = Game.GraphicsResource.fctLogo; + C4Facet &fctLogo = ::GraphicsResource.fctLogo; float fLogoZoom = 1.0f; fctLogo.DrawX(cgo.Surface, rcBounds.Wdt *1/21, rcBounds.Hgt/14 - 5, int32_t(fLogoZoom*fctLogo.Wdt), int32_t(fLogoZoom*fctLogo.Hgt)); // draw version info diff --git a/engine/src/C4StartupOptionsDlg.cpp b/engine/src/C4StartupOptionsDlg.cpp index 288dec803..e098048cd 100644 --- a/engine/src/C4StartupOptionsDlg.cpp +++ b/engine/src/C4StartupOptionsDlg.cpp @@ -206,7 +206,7 @@ void C4StartupOptionsDlg::KeySelButton::DrawElement(C4TargetFacet &cgo) { // draw key C4Facet cgoDraw(cgo.Surface, rcBounds.x+cgo.TargetX, rcBounds.y+cgo.TargetY, rcBounds.Wdt, rcBounds.Hgt); - Game.GraphicsResource.fctKey.Draw(cgoDraw, TRUE, fDown); + ::GraphicsResource.fctKey.Draw(cgoDraw, TRUE, fDown); int32_t iKeyIndent = cgoDraw.Wdt / 5; cgoDraw.X += iKeyIndent; cgoDraw.Wdt -= 2*iKeyIndent; cgoDraw.Y += iKeyIndent*3/4; cgoDraw.Hgt -= 2*iKeyIndent; @@ -220,7 +220,7 @@ void C4StartupOptionsDlg::KeySelButton::DrawElement(C4TargetFacet &cgo) ModulateClr(dwModClr, dwOldBlitModClr); lpDDraw->ActivateBlitModulation(dwModClr); } - Game.GraphicsResource.fctCommand.Draw(cgoDraw, TRUE, iKeyID, 0); + ::GraphicsResource.fctCommand.Draw(cgoDraw, TRUE, iKeyID, 0); if (!fDoHightlight) if (fHadBlitMod) lpDDraw->ActivateBlitModulation(dwOldBlitModClr); @@ -257,7 +257,7 @@ C4StartupOptionsDlg::ControlConfigArea::ControlConfigArea(const C4Rect &rcArea, iMaxControlSets = C4MaxKeyboardSet; ppKeyControlSetBtns = new C4GUI::IconButton *[iMaxControlSets]; // top line buttons to select keyboard set or gamepad - C4Facet fctCtrlPic = fGamepad ? Game.GraphicsResource.fctGamepad : Game.GraphicsResource.fctKeyboard; + C4Facet fctCtrlPic = fGamepad ? ::GraphicsResource.fctGamepad : ::GraphicsResource.fctKeyboard; int32_t iCtrlSetWdt = caArea.GetWidth() - caArea.GetHMargin()*2; int32_t iCtrlSetHMargin = 5, iCtrlSetVMargin = 5; int32_t iCtrlSetBtnWdt = BoundBy((iCtrlSetWdt - iMaxControlSets*iCtrlSetHMargin*2) / iMaxControlSets, 5, fctCtrlPic.Wdt); @@ -280,7 +280,7 @@ C4StartupOptionsDlg::ControlConfigArea::ControlConfigArea(const C4Rect &rcArea, caArea.ExpandTop(caArea.GetVMargin()); AddElement(new C4GUI::HorizontalLine(caArea.GetFromTop(2))); caArea.ExpandTop(caArea.GetVMargin()); - C4Facet &rfctKey = Game.GraphicsResource.fctKey; + C4Facet &rfctKey = ::GraphicsResource.fctKey; int32_t iKeyAreaMaxWdt = caArea.GetWidth()-2*caArea.GetHMargin(), iKeyAreaMaxHgt = caArea.GetHeight()-2*caArea.GetVMargin(); int32_t iKeyWdt = rfctKey.Wdt*3/2, iKeyHgt = rfctKey.Hgt*3/2; int32_t iKeyUseWdt = iKeyWdt + iKeyHgt*3; // add space for label diff --git a/engine/src/C4StartupPlrSelDlg.cpp b/engine/src/C4StartupPlrSelDlg.cpp index df846bb4d..a1d05ad8d 100644 --- a/engine/src/C4StartupPlrSelDlg.cpp +++ b/engine/src/C4StartupPlrSelDlg.cpp @@ -171,7 +171,7 @@ void C4StartupPlrSelDlg::ListItem::CreateColoredPortrait() void C4StartupPlrSelDlg::ListItem::SetDefaultPortrait() { - fctPortrait.Set(Game.GraphicsResource.fctPlayerClr); + fctPortrait.Set(::GraphicsResource.fctPlayerClr); } void C4StartupPlrSelDlg::ListItem::GrabPortrait(C4FacetSurface *pFromFacet) @@ -240,7 +240,7 @@ void C4StartupPlrSelDlg::PlayerListItem::Load(const StdStrBuf &rsFilename) { // no custom icon: create default by player color fctIcon.Create(iHeight,iHeight); - Game.GraphicsResource.fctPlayerClr.DrawClr(fctIcon, TRUE, Core.PrefColorDw); + ::GraphicsResource.fctPlayerClr.DrawClr(fctIcon, TRUE, Core.PrefColorDw); } GrabIcon(fctIcon); // load portrait @@ -290,7 +290,7 @@ void C4StartupPlrSelDlg::PlayerListItem::UpdateCore(C4PlayerInfoCore & NewCore) fHasCustomIcon = false; int32_t iHeight = GetBounds().Hgt; C4FacetSurface fctIcon; fctIcon.Create(iHeight,iHeight); - Game.GraphicsResource.fctPlayerClr.DrawClr(fctIcon, TRUE, Core.PrefColorDw); + ::GraphicsResource.fctPlayerClr.DrawClr(fctIcon, TRUE, Core.PrefColorDw); GrabIcon(fctIcon); } // update in selection @@ -373,7 +373,7 @@ void C4StartupPlrSelDlg::CrewListItem::Load(C4Group &rGrp, const StdStrBuf &rsFi else { // no custom icon: create default by rank system - if (C4RankSystem::DrawRankSymbol(&fctIcon, Core.Rank, &Game.GraphicsResource.fctRank, Game.GraphicsResource.iNumRanks, true)) + if (C4RankSystem::DrawRankSymbol(&fctIcon, Core.Rank, &::GraphicsResource.fctRank, ::GraphicsResource.iNumRanks, true)) GrabIcon(fctIcon); } // load portrait; empty by default @@ -1181,7 +1181,7 @@ C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(C4StartupPlrSelDlg::PlayerL szTip = LoadResStr("IDS_DLGTIP_PLAYERCOLORS"); AddElement(pBtn = new C4GUI::CallbackButton(C4GUI::ArrowButton::Left, caColorArea.GetFromLeft(C4GUI::ArrowButton::GetDefaultWidth()), &C4StartupPlrPropertiesDlg::OnClrChangeLeft)); pBtn->SetToolTip(szTip); - C4Facet &rfctClrPreviewPic = Game.GraphicsResource.fctFlagClr; //C4Startup::Get()->Graphics.fctCrewClr; //Game.GraphicsResource.fctCrewClr; + C4Facet &rfctClrPreviewPic = ::GraphicsResource.fctFlagClr; //C4Startup::Get()->Graphics.fctCrewClr; //::GraphicsResource.fctCrewClr; pClrPreview = new C4GUI::Picture(caColorArea.GetFromLeft(rfctClrPreviewPic.GetWidthByHeight(caColorArea.GetHeight())), true); pClrPreview->SetFacet(rfctClrPreviewPic); AddElement(pClrPreview); @@ -1217,7 +1217,7 @@ C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(C4StartupPlrSelDlg::PlayerL szTip = LoadResStr("IDS_DLGTIP_PLAYERCONTROL"); AddElement(pBtn = new C4GUI::CallbackButton(C4GUI::ArrowButton::Left, caControl.GetFromLeft(C4GUI::ArrowButton::GetDefaultWidth()), &C4StartupPlrPropertiesDlg::OnCtrlChangeLeft)); pBtn->SetToolTip(szTip); - C4Facet &rfctCtrlPic = Game.GraphicsResource.fctKeyboard; // UpdatePlayerControl() will alternatively set fctGamepad + C4Facet &rfctCtrlPic = ::GraphicsResource.fctKeyboard; // UpdatePlayerControl() will alternatively set fctGamepad AddElement(pCtrlImg = new C4GUI::Picture(caControl.GetFromLeft(rfctCtrlPic.GetWidthByHeight(caControl.GetHeight())), true)); pCtrlImg->SetToolTip(szTip); AddElement(pBtn = new C4GUI::CallbackButton(C4GUI::ArrowButton::Right, caControl.GetFromLeft(C4GUI::ArrowButton::GetDefaultWidth()), &C4StartupPlrPropertiesDlg::OnCtrlChangeRight)); @@ -1337,7 +1337,7 @@ void C4StartupPlrPropertiesDlg::OnClrSliderBChange(int32_t iNewVal) void C4StartupPlrPropertiesDlg::UpdatePlayerControl() { // update keyboard image of selected control - C4Facet &rfctCtrlPic = (C4P.PrefControl < C4P_Control_GamePad1) ? Game.GraphicsResource.fctKeyboard : Game.GraphicsResource.fctGamepad; + C4Facet &rfctCtrlPic = (C4P.PrefControl < C4P_Control_GamePad1) ? ::GraphicsResource.fctKeyboard : ::GraphicsResource.fctGamepad; pCtrlImg->SetFacet(rfctCtrlPic); pCtrlImg->GetMFacet().X += rfctCtrlPic.Wdt * (C4P.PrefControl - ((C4P.PrefControl < C4P_Control_GamePad1) ? 0 : C4P_Control_GamePad1)); // update mouse image @@ -1569,6 +1569,6 @@ void C4StartupPlrPropertiesDlg::UpdateBigIcon() // no icon: Set default if (!fHasIcon) { - pPictureBtn->SetFacet(Game.GraphicsResource.fctPlayerClr); + pPictureBtn->SetFacet(::GraphicsResource.fctPlayerClr); } } diff --git a/engine/src/C4UpperBoard.cpp b/engine/src/C4UpperBoard.cpp index bca5fcd38..9c03b6f78 100644 --- a/engine/src/C4UpperBoard.cpp +++ b/engine/src/C4UpperBoard.cpp @@ -57,41 +57,41 @@ void C4UpperBoard::Draw(C4Facet &cgo) { if(!cgo.Surface) return; // Background - Application.DDraw->BlitSurfaceTile(Game.GraphicsResource.fctUpperBoard.Surface,Output.Surface,0,0,Output.Wdt,Output.Hgt); + Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctUpperBoard.Surface,Output.Surface,0,0,Output.Wdt,Output.Hgt); // Logo C4Facet cgo2; float fLogoZoom = 0.75f; - cgo2.Set(cgo.Surface, (int32_t)(cgo.Wdt/2-(Game.GraphicsResource.fctLogo.Wdt/2)*fLogoZoom), 0, - (int32_t)(Game.GraphicsResource.fctLogo.Wdt*fLogoZoom), (int32_t)(Game.GraphicsResource.fctLogo.Hgt*fLogoZoom)); - Game.GraphicsResource.fctLogo.Draw(cgo2); + cgo2.Set(cgo.Surface, (int32_t)(cgo.Wdt/2-(::GraphicsResource.fctLogo.Wdt/2)*fLogoZoom), 0, + (int32_t)(::GraphicsResource.fctLogo.Wdt*fLogoZoom), (int32_t)(::GraphicsResource.fctLogo.Hgt*fLogoZoom)); + ::GraphicsResource.fctLogo.Draw(cgo2); // Right text sections int32_t iRightOff = 1; // Playing time - Application.DDraw->TextOut(cTimeString, Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 10, TextYPosition, 0xFFFFFFFF); + Application.DDraw->TextOut(cTimeString, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 10, TextYPosition, 0xFFFFFFFF); // Clock if (Config.Graphics.ShowClock) - Application.DDraw->TextOut(cTimeString2, Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF); + Application.DDraw->TextOut(cTimeString2, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF); // FPS if (Config.General.FPS) { sprintf(cTimeString, "%d FPS", Game.FPS); - Application.DDraw->TextOut(cTimeString, Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF); + Application.DDraw->TextOut(cTimeString, ::GraphicsResource.FontRegular, 1.0, cgo.Surface, C4GUI::GetScreenWdt() - (iRightOff++) * TextWidth - 30, TextYPosition, 0xFFFFFFFF); } // Scenario title - Application.DDraw->TextOut(Game.ScenarioTitle.getData(), Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, 10, cgo.Hgt / 2 - Game.GraphicsResource.FontRegular.GetLineHeight() / 2, 0xFFFFFFFF); + Application.DDraw->TextOut(Game.ScenarioTitle.getData(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface, 10, cgo.Hgt / 2 - ::GraphicsResource.FontRegular.GetLineHeight() / 2, 0xFFFFFFFF); } void C4UpperBoard::Init(C4Facet &cgo) { // Save facet Output = cgo; - if (!Game.GraphicsResource.fctUpperBoard.Surface) return; + if (!::GraphicsResource.fctUpperBoard.Surface) return; // in newgfx, the upperboard may be larger and overlap the scene - Output.Hgt = Max(Output.Hgt, Game.GraphicsResource.fctUpperBoard.Hgt); + Output.Hgt = Max(Output.Hgt, ::GraphicsResource.fctUpperBoard.Hgt); // surface should not be too small - Game.GraphicsResource.fctUpperBoard.EnsureSize(128, Output.Hgt); + ::GraphicsResource.fctUpperBoard.EnsureSize(128, Output.Hgt); // Generate textposition sprintf(cTimeString,"%02d:%02d:%02d", Game.Time/3600,(Game.Time%3600)/60,Game.Time%60); - TextWidth = Game.GraphicsResource.FontRegular.GetTextWidth(cTimeString); - TextYPosition = cgo.Hgt / 2 - Game.GraphicsResource.FontRegular.GetLineHeight() / 2; + TextWidth = ::GraphicsResource.FontRegular.GetTextWidth(cTimeString); + TextYPosition = cgo.Hgt / 2 - ::GraphicsResource.FontRegular.GetLineHeight() / 2; } diff --git a/engine/src/C4Video.cpp b/engine/src/C4Video.cpp index f5a812094..7dd92e570 100644 --- a/engine/src/C4Video.cpp +++ b/engine/src/C4Video.cpp @@ -170,9 +170,9 @@ bool C4Video::Start(const char *szFilename) if (Config.Graphics.BitDepth == 8) for (int cnt=0; cnt<256; cnt++) { - pInfo->bmiColors[cnt].rgbRed = Game.GraphicsResource.GamePalette[cnt*3+0]; - pInfo->bmiColors[cnt].rgbGreen = Game.GraphicsResource.GamePalette[cnt*3+1]; - pInfo->bmiColors[cnt].rgbBlue = Game.GraphicsResource.GamePalette[cnt*3+2]; + pInfo->bmiColors[cnt].rgbRed = ::GraphicsResource.GamePalette[cnt*3+0]; + pInfo->bmiColors[cnt].rgbGreen = ::GraphicsResource.GamePalette[cnt*3+1]; + pInfo->bmiColors[cnt].rgbBlue = ::GraphicsResource.GamePalette[cnt*3+2]; } // Recording flag Recording=true; @@ -208,7 +208,7 @@ void C4Video::Draw(C4TargetFacet &cgo) StdStrBuf str; if (Recording) str.Format("%dx%d Frame %d",Width,Height,AviFrame); else str.Format("%dx%d",Width,Height); - Application.DDraw->TextOut(str.getData(), Game.GraphicsResource.FontRegular, 1.0,cgo.Surface,cgo.X+X+4,cgo.Y+Y+3,Recording ? 0xfaFF0000 : 0xfaFFFFFF); + Application.DDraw->TextOut(str.getData(), ::GraphicsResource.FontRegular, 1.0,cgo.Surface,cgo.X+X+4,cgo.Y+Y+3,Recording ? 0xfaFF0000 : 0xfaFFFFFF); } bool C4Video::AdjustPosition() diff --git a/engine/src/C4Viewport.cpp b/engine/src/C4Viewport.cpp index 14e5c07ef..8972c001a 100644 --- a/engine/src/C4Viewport.cpp +++ b/engine/src/C4Viewport.cpp @@ -932,7 +932,7 @@ void C4Viewport::DrawCursorInfo(C4TargetFacet &cgo) { int32_t cx = C4SymbolBorder; C4ST_STARTNEW(EnStat, "C4Viewport::DrawCursorInfo: Energy") - int32_t bar_wdt = Game.GraphicsResource.fctEnergyBars.Wdt; + int32_t bar_wdt = ::GraphicsResource.fctEnergyBars.Wdt; int32_t iYOff = Config.Graphics.ShowPortraits ? 10 : 0; // Energy ccgo.Set(cgo.Surface,cgo.X+cx,cgo.Y+C4SymbolSize+2*C4SymbolBorder+iYOff,bar_wdt,cgo.Hgt-3*C4SymbolBorder-2*C4SymbolSize-iYOff); @@ -975,7 +975,7 @@ void C4Viewport::DrawMenu(C4TargetFacet &cgo) if (pPlr && pPlr->Eliminated) { Application.DDraw->TextOut(FormatString(LoadResStr(pPlr->Surrendered ? "IDS_PLR_SURRENDERED" : "IDS_PLR_ELIMINATED"),pPlr->GetName()).getData(), - Game.GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X+cgo.Wdt/2,cgo.Y+2*cgo.Hgt/3,0xfaFF0000,ACenter); + ::GraphicsResource.FontRegular, 1.0, cgo.Surface,cgo.X+cgo.Wdt/2,cgo.Y+2*cgo.Hgt/3,0xfaFF0000,ACenter); return; } @@ -1038,10 +1038,10 @@ void C4Viewport::Draw(C4TargetFacet &cgo, bool fDrawOverlay) if (fDrawOverlay) { // Draw landscape borders. Only if overlay, so complete map screenshots don't get messed up - if (BorderLeft) Application.DDraw->BlitSurfaceTile(Game.GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX,DrawY,BorderLeft,ViewHgt,-DrawX,-DrawY); - if (BorderTop) Application.DDraw->BlitSurfaceTile(Game.GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+BorderLeft,DrawY,ViewWdt-BorderLeft-BorderRight,BorderTop,-DrawX-BorderLeft,-DrawY); - if (BorderRight) Application.DDraw->BlitSurfaceTile(Game.GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+ViewWdt-BorderRight,DrawY,BorderRight,ViewHgt,-DrawX-ViewWdt+BorderRight,-DrawY); - if (BorderBottom)Application.DDraw->BlitSurfaceTile(Game.GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+BorderLeft,DrawY+ViewHgt-BorderBottom,ViewWdt-BorderLeft-BorderRight,BorderBottom,-DrawX-BorderLeft,-DrawY-ViewHgt+BorderBottom); + if (BorderLeft) Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX,DrawY,BorderLeft,ViewHgt,-DrawX,-DrawY); + if (BorderTop) Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+BorderLeft,DrawY,ViewWdt-BorderLeft-BorderRight,BorderTop,-DrawX-BorderLeft,-DrawY); + if (BorderRight) Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+ViewWdt-BorderRight,DrawY,BorderRight,ViewHgt,-DrawX-ViewWdt+BorderRight,-DrawY); + if (BorderBottom)Application.DDraw->BlitSurfaceTile(::GraphicsResource.fctBackground.Surface,cgo.Surface,DrawX+BorderLeft,DrawY+ViewHgt-BorderBottom,ViewWdt-BorderLeft-BorderRight,BorderBottom,-DrawX-BorderLeft,-DrawY-ViewHgt+BorderBottom); // Set clippers cgo.X += BorderLeft; cgo.Y += BorderTop; cgo.Wdt -= int(float(BorderLeft+BorderRight)/Zoom); cgo.Hgt -= int(float(BorderTop+BorderBottom)/Zoom); @@ -1333,7 +1333,7 @@ void C4Viewport::DrawPlayerInfo(C4TargetFacet &cgo) cgo.X+cgo.Wdt-wdt-C4SymbolBorder, cgo.Y+C4SymbolBorder, wdt,hgt); - Game.GraphicsResource.fctWealth.DrawValue(ccgo,Game.Players.Get(Player)->Wealth, 0, Config.Graphics.Currency); + ::GraphicsResource.fctWealth.DrawValue(ccgo,Game.Players.Get(Player)->Wealth, 0, Config.Graphics.Currency); } // Value gain @@ -1346,7 +1346,7 @@ void C4Viewport::DrawPlayerInfo(C4TargetFacet &cgo) cgo.X+cgo.Wdt-2*wdt-2*C4SymbolBorder, cgo.Y+C4SymbolBorder, wdt,hgt); - Game.GraphicsResource.fctScore.DrawValue(ccgo,Game.Players.Get(Player)->ValueGain); + ::GraphicsResource.fctScore.DrawValue(ccgo,Game.Players.Get(Player)->ValueGain); } // Crew @@ -1358,7 +1358,7 @@ void C4Viewport::DrawPlayerInfo(C4TargetFacet &cgo) cgo.X+cgo.Wdt-3*wdt-3*C4SymbolBorder, cgo.Y+C4SymbolBorder, wdt,hgt); - Game.GraphicsResource.fctCrewClr.DrawValue2Clr(ccgo,Game.Players.Get(Player)->SelectCount,Game.Players.Get(Player)->ActiveCrewCount(),Game.Players.Get(Player)->ColorDw); + ::GraphicsResource.fctCrewClr.DrawValue2Clr(ccgo,Game.Players.Get(Player)->SelectCount,Game.Players.Get(Player)->ActiveCrewCount(),Game.Players.Get(Player)->ColorDw); } // Controls @@ -1519,7 +1519,7 @@ void C4Viewport::DrawPlayerStartup(C4TargetFacet &cgo) } // Name - Application.DDraw->TextOut(pPlr->GetName(), Game.GraphicsResource.FontRegular, 1.0, cgo.Surface, + Application.DDraw->TextOut(pPlr->GetName(), ::GraphicsResource.FontRegular, 1.0, cgo.Surface, cgo.X+cgo.Wdt/2,cgo.Y+cgo.Hgt*2/3+iNameHgtOff + DrawMessageOffset, pPlr->ColorDw | 0xff000000, ACenter); } diff --git a/engine/src/C4Wrappers.cpp b/engine/src/C4Wrappers.cpp index 09d8f91aa..9fd6dfe2c 100644 --- a/engine/src/C4Wrappers.cpp +++ b/engine/src/C4Wrappers.cpp @@ -109,7 +109,7 @@ void SoundPan(const char *szSndName, C4Object *pObj, int32_t iPan) //=========================== Graphics Resource ========================================= -#define GfxR (&(Game.GraphicsResource)) +#define GfxR (&(::GraphicsResource)) //=============================== Messages =============================================