diff --git a/engine/inc/C4Game.h b/engine/inc/C4Game.h index 9e1cea290..0bc8c68cb 100644 --- a/engine/inc/C4Game.h +++ b/engine/inc/C4Game.h @@ -102,7 +102,6 @@ class C4Game C4GameObjects Objects; C4ObjectList BackObjects; // objects in background (C4D_Background) C4ObjectList ForeObjects; // objects in foreground (C4D_Foreground) - C4Landscape Landscape; C4Scenario C4S; C4ComponentHost Info; C4ComponentHost Title; diff --git a/engine/inc/C4Landscape.h b/engine/inc/C4Landscape.h index 9a74760cf..62c009500 100644 --- a/engine/inc/C4Landscape.h +++ b/engine/inc/C4Landscape.h @@ -236,6 +236,8 @@ class C4Landscape bool DebugSave(const char *szFilename); }; +extern C4Landscape Landscape; + /* Some global landscape functions */ BOOL AboveSolid(int32_t &rx, int32_t &ry); diff --git a/engine/inc/C4Physics.h b/engine/inc/C4Physics.h index e88b7b14d..45486a3f3 100644 --- a/engine/inc/C4Physics.h +++ b/engine/inc/C4Physics.h @@ -27,7 +27,7 @@ const int StableRange=10; const int AttachRange=5; const int CornerRange=AttachRange+2; -#define GravAccel (Game.Landscape.Gravity) +#define GravAccel (::Landscape.Gravity) extern const FIXED FloatAccel; extern const FIXED HitSpeed1,HitSpeed2,HitSpeed3,HitSpeed4; diff --git a/engine/inc/C4Wrappers.h b/engine/inc/C4Wrappers.h index 5ef9354da..2497c9be7 100644 --- a/engine/inc/C4Wrappers.h +++ b/engine/inc/C4Wrappers.h @@ -106,14 +106,14 @@ inline bool DensityLiquid(int32_t dens) extern int32_t MVehic,MTunnel,MWater,MSnow,MEarth,MGranite,MFlyAshes; // presearched materials extern BYTE MCVehic; // precalculated material color -#define GBackWdt Game.Landscape.Width -#define GBackHgt Game.Landscape.Height -#define GBackPix Game.Landscape.GetPix -#define SBackPix Game.Landscape.SetPix -#define ClearBackPix Game.Landscape.ClearPix -#define _GBackPix Game.Landscape._GetPix -#define _SBackPix Game.Landscape._SetPix -#define _SBackPixIfMask Game.Landscape._SetPixIfMask +#define GBackWdt ::Landscape.Width +#define GBackHgt ::Landscape.Height +#define GBackPix ::Landscape.GetPix +#define SBackPix ::Landscape.SetPix +#define ClearBackPix ::Landscape.ClearPix +#define _GBackPix ::Landscape._GetPix +#define _SBackPix ::Landscape._SetPix +#define _SBackPixIfMask ::Landscape._SetPixIfMask int32_t PixCol2MatOld(BYTE pixc); int32_t PixCol2MatOld2(BYTE pixc); @@ -184,12 +184,12 @@ inline BYTE GBackIFT(int32_t x, int32_t y) inline int32_t GBackMat(int32_t x, int32_t y) { - return Game.Landscape.GetMat(x, y); + return ::Landscape.GetMat(x, y); } inline int32_t GBackDensity(int32_t x, int32_t y) { - return Game.Landscape.GetDensity(x, y); + return ::Landscape.GetDensity(x, y); } inline bool GBackSolid(int32_t x, int32_t y) diff --git a/engine/src/C4Console.cpp b/engine/src/C4Console.cpp index cb9559cd6..a0dc44b0d 100644 --- a/engine/src/C4Console.cpp +++ b/engine/src/C4Console.cpp @@ -778,7 +778,7 @@ BOOL C4Console::SaveGame(BOOL fSaveGame) if (fSaveGame) pGameSave = new C4GameSaveSavegame(); else - pGameSave = new C4GameSaveScenario(!Console.Active || Game.Landscape.Mode==C4LSC_Exact, false); + pGameSave = new C4GameSaveScenario(!Console.Active || ::Landscape.Mode==C4LSC_Exact, false); if (!pGameSave->Save(Game.ScenarioFile, false)) { Out("Game::Save failed"); fOkay=FALSE; } delete pGameSave; diff --git a/engine/src/C4Control.cpp b/engine/src/C4Control.cpp index f64c72e23..13244659e 100644 --- a/engine/src/C4Control.cpp +++ b/engine/src/C4Control.cpp @@ -975,8 +975,8 @@ void C4ControlEMDrawTool::Execute() const return; } // check current mode - assert(Game.Landscape.Mode == iMode); - if (Game.Landscape.Mode != iMode) return; + assert(::Landscape.Mode == iMode); + if (::Landscape.Mode != iMode) return; // assert validity of parameters if (!Material.getSize()) return; const char *szMaterial = Material.getData(), @@ -986,22 +986,22 @@ void C4ControlEMDrawTool::Execute() const { case EMDT_Brush: // brush tool if (!Texture.getSize()) break; - Game.Landscape.DrawBrush(iX, iY, iGrade, szMaterial, szTexture, fIFT); + ::Landscape.DrawBrush(iX, iY, iGrade, szMaterial, szTexture, fIFT); break; case EMDT_Line: // line tool if (!Texture.getSize()) break; - Game.Landscape.DrawLine(iX,iY,iX2,iY2, iGrade, szMaterial, szTexture, fIFT); + ::Landscape.DrawLine(iX,iY,iX2,iY2, iGrade, szMaterial, szTexture, fIFT); break; case EMDT_Rect: // rect tool if (!Texture.getSize()) break; - Game.Landscape.DrawBox(iX,iY,iX2,iY2, iGrade, szMaterial, szTexture, fIFT); + ::Landscape.DrawBox(iX,iY,iX2,iY2, iGrade, szMaterial, szTexture, fIFT); break; case EMDT_Fill: // fill tool { int iMat = Game.Material.Get(szMaterial); if (!MatValid(iMat)) return; for (int cnt=0; cntGrade, !!pTools->ModeIFT, pTools->Material,pTools->Texture)); + EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Brush, ::Landscape.Mode, X,Y,0,0, pTools->Grade, !!pTools->ModeIFT, pTools->Material,pTools->Texture)); } void C4EditCursor::ApplyToolLine() @@ -575,7 +575,7 @@ void C4EditCursor::ApplyToolLine() if (!EditingOK()) return; C4ToolsDlg *pTools=&Console.ToolsDlg; // execute/send control - EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Line, Game.Landscape.Mode, X,Y,X2,Y2, pTools->Grade, !!pTools->ModeIFT, pTools->Material,pTools->Texture)); + EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Line, ::Landscape.Mode, X,Y,X2,Y2, pTools->Grade, !!pTools->ModeIFT, pTools->Material,pTools->Texture)); } void C4EditCursor::ApplyToolRect() @@ -583,7 +583,7 @@ void C4EditCursor::ApplyToolRect() if (!EditingOK()) return; C4ToolsDlg *pTools=&Console.ToolsDlg; // execute/send control - EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Rect, Game.Landscape.Mode, X,Y,X2,Y2, pTools->Grade, !!pTools->ModeIFT, pTools->Material,pTools->Texture)); + EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Rect, ::Landscape.Mode, X,Y,X2,Y2, pTools->Grade, !!pTools->ModeIFT, pTools->Material,pTools->Texture)); } void C4EditCursor::ApplyToolFill() @@ -591,7 +591,7 @@ void C4EditCursor::ApplyToolFill() if (!EditingOK()) return; C4ToolsDlg *pTools=&Console.ToolsDlg; // execute/send control - EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Fill, Game.Landscape.Mode, X,Y,0,Y2, pTools->Grade, false, pTools->Material)); + EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Fill, ::Landscape.Mode, X,Y,0,Y2, pTools->Grade, false, pTools->Material)); } BOOL C4EditCursor::DoContextMenu() @@ -706,11 +706,11 @@ void C4EditCursor::ApplyToolPicker() { int32_t iMaterial; BYTE byIndex; - switch (Game.Landscape.Mode) + switch (::Landscape.Mode) { case C4LSC_Static: // Material-texture from map - if (byIndex=Game.Landscape.GetMapIndex(X/Game.Landscape.MapZoom,Y/Game.Landscape.MapZoom)) + if (byIndex=::Landscape.GetMapIndex(X/::Landscape.MapZoom,Y/::Landscape.MapZoom)) { const C4TexMapEntry *pTex = ::TextureMap.GetEntry(byIndex & (IFT-1)); if(pTex) diff --git a/engine/src/C4Effect.cpp b/engine/src/C4Effect.cpp index d408305c1..e720d0b66 100644 --- a/engine/src/C4Effect.cpp +++ b/engine/src/C4Effect.cpp @@ -798,7 +798,7 @@ void Splash(int32_t tx, int32_t ty, int32_t amt, C4Object *pByObj) { BubbleOut(tx+Random(16)-8,ty+Random(16)-6); if (GBackLiquid(tx,ty) && !GBackSemiSolid(tx, sy)) - ::PXS.Create(Game.Landscape.ExtractMaterial(tx,ty), + ::PXS.Create(::Landscape.ExtractMaterial(tx,ty), itofix(tx),itofix(sy), FIXED100(Random(151)-75), FIXED100(-Random(200))); @@ -863,10 +863,10 @@ void Explosion(int32_t tx, int32_t ty, int32_t level, C4Object *inobj, int32_t i if (!container) { // Incinerate landscape - if (!Game.Landscape.Incinerate(tx,ty)) - if (!Game.Landscape.Incinerate(tx,ty-10)) - if (!Game.Landscape.Incinerate(tx-5,ty-5)) - Game.Landscape.Incinerate(tx+5,ty-5); + if (!::Landscape.Incinerate(tx,ty)) + if (!::Landscape.Incinerate(tx,ty-10)) + if (!::Landscape.Incinerate(tx-5,ty-5)) + ::Landscape.Incinerate(tx+5,ty-5); // Create blast object or particle C4Object *pBlast; C4ParticleDef *pPrtDef = Game.Particles.pBlast; @@ -894,7 +894,7 @@ void Explosion(int32_t tx, int32_t ty, int32_t level, C4Object *inobj, int32_t i if (!container) { // Blast free landscape. After blasting objects so newly mined materials don't get flinged - Game.Landscape.BlastFree(tx,ty,level,grade, iCausedBy); + ::Landscape.BlastFree(tx,ty,level,grade, iCausedBy); } } diff --git a/engine/src/C4Game.cpp b/engine/src/C4Game.cpp index c5626a5da..11951e5f6 100644 --- a/engine/src/C4Game.cpp +++ b/engine/src/C4Game.cpp @@ -676,7 +676,7 @@ BOOL C4Game::GameOverCheck() if (MatValid(mat=Game.Material.Get(C4S.Game.ClearMaterial.Name[cnt]))) { condition_valid=TRUE; - if (Game.Landscape.EffectiveMatCount[mat]>(DWORD)C4S.Game.ClearMaterial.Count[cnt]) + if (::Landscape.EffectiveMatCount[mat]>(DWORD)C4S.Game.ClearMaterial.Count[cnt]) condition_true = FALSE; } if (condition_valid) diff --git a/engine/src/C4GameObjects.cpp b/engine/src/C4GameObjects.cpp index b1a9ac850..93b45c6af 100644 --- a/engine/src/C4GameObjects.cpp +++ b/engine/src/C4GameObjects.cpp @@ -300,7 +300,7 @@ C4ObjectList &C4GameObjects::ObjectsInt() { // some time ago, only objects in the topleft corner used to be recognized // this is an unnecessary restriction though... - //return Game.Landscape.Sectors.First()->Objects; + //return ::Landscape.Sectors.First()->Objects; return *this; } diff --git a/engine/src/C4GameSave.cpp b/engine/src/C4GameSave.cpp index a1aca5b7e..c71ea0008 100644 --- a/engine/src/C4GameSave.cpp +++ b/engine/src/C4GameSave.cpp @@ -150,16 +150,16 @@ bool C4GameSave::SaveScenarioSections() bool C4GameSave::SaveLandscape() { // exact? - if (Game.Landscape.Mode == C4LSC_Exact || GetForceExactLandscape()) + if (::Landscape.Mode == C4LSC_Exact || GetForceExactLandscape()) { C4DebugRecOff DBGRECOFF; // Landscape Game.Objects.RemoveSolidMasks(); bool fSuccess; - if(Game.Landscape.Mode == C4LSC_Exact) - fSuccess = !!Game.Landscape.Save(*pSaveGroup); + if(::Landscape.Mode == C4LSC_Exact) + fSuccess = !!::Landscape.Save(*pSaveGroup); else - fSuccess = !!Game.Landscape.SaveDiff(*pSaveGroup, !IsSynced()); + fSuccess = !!::Landscape.SaveDiff(*pSaveGroup, !IsSynced()); Game.Objects.PutSolidMasks(); if (!fSuccess) return false; DBGRECOFF.Clear(); @@ -173,7 +173,7 @@ bool C4GameSave::SaveLandscape() if (!Game.Material.SaveEnumeration(*pSaveGroup)) return false; } // static / dynamic - if (Game.Landscape.Mode == C4LSC_Static) + if (::Landscape.Mode == C4LSC_Static) { // static map // remove old-style landscape.bmp @@ -182,12 +182,12 @@ bool C4GameSave::SaveLandscape() if(!GetForceExactLandscape()) { // save map - if (!Game.Landscape.SaveMap(*pSaveGroup)) return FALSE; + if (!::Landscape.SaveMap(*pSaveGroup)) return FALSE; // save textures (if changed) - if (!Game.Landscape.SaveTextures(*pSaveGroup)) return FALSE; + if (!::Landscape.SaveTextures(*pSaveGroup)) return FALSE; } } - else if (Game.Landscape.Mode != C4LSC_Exact) + else if (::Landscape.Mode != C4LSC_Exact) { // dynamic map by landscape.txt or scenario core: nothing to save // in fact, it doesn't even make much sense to save the Objects.txt diff --git a/engine/src/C4GraphicsSystem.cpp b/engine/src/C4GraphicsSystem.cpp index d5fff0188..1cea6d981 100644 --- a/engine/src/C4GraphicsSystem.cpp +++ b/engine/src/C4GraphicsSystem.cpp @@ -636,8 +636,8 @@ BOOL C4GraphicsSystem::DoSaveScreenshot(bool fSaveAll, const char *szFilename) // mark background to be redrawn InvalidateBg(); // backup and clear sky parallaxity - int32_t iParX=Game.Landscape.Sky.ParX; Game.Landscape.Sky.ParX=10; - int32_t iParY=Game.Landscape.Sky.ParY; Game.Landscape.Sky.ParY=10; + int32_t iParX=::Landscape.Sky.ParX; ::Landscape.Sky.ParX=10; + int32_t iParY=::Landscape.Sky.ParY; ::Landscape.Sky.ParY=10; // temporarily change viewport player int32_t iVpPlr=pVP->Player; pVP->Player=NO_OWNER; // blit all tiles needed @@ -667,8 +667,8 @@ BOOL C4GraphicsSystem::DoSaveScreenshot(bool fSaveAll, const char *szFilename) // restore viewport player pVP->Player=iVpPlr; // restore parallaxity - Game.Landscape.Sky.ParX=iParX; - Game.Landscape.Sky.ParY=iParY; + ::Landscape.Sky.ParX=iParX; + ::Landscape.Sky.ParY=iParY; // save! return png.Save(szFilename); } diff --git a/engine/src/C4Landscape.cpp b/engine/src/C4Landscape.cpp index 48087058d..8e925d419 100644 --- a/engine/src/C4Landscape.cpp +++ b/engine/src/C4Landscape.cpp @@ -1989,7 +1989,7 @@ BOOL PathFree(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t *ix, int32 bool PathFreeIgnoreVehiclePix(int32_t x, int32_t y, int32_t par) { BYTE byPix=GBackPix(x,y); - return !byPix || !DensitySolid(Game.Landscape.GetPixMat(byPix)) || Game.Landscape.GetPixMat(byPix) == MVehic; + return !byPix || !DensitySolid(::Landscape.GetPixMat(byPix)) || ::Landscape.GetPixMat(byPix) == MVehic; } BOOL PathFreeIgnoreVehicle(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t *ix, int32_t *iy) @@ -2091,12 +2091,12 @@ BOOL ConstructionCheck(C4ID id, int32_t iX, int32_t iY, C4Object *pByObj) int32_t rtx,rty,wdt,hgt; wdt=ndef->Shape.Wdt; hgt=ndef->Shape.Hgt-ndef->ConSizeOff; rtx=iX-wdt/2; rty=iY-hgt; - if (Game.Landscape.AreaSolidCount(rtx,rty,wdt,hgt)>(wdt*hgt/20)) + if (::Landscape.AreaSolidCount(rtx,rty,wdt,hgt)>(wdt*hgt/20)) { if (pByObj) GameMsgObject(LoadResStr("IDS_OBJ_NOROOM"),pByObj,FRed); return FALSE; } - if (Game.Landscape.AreaSolidCount(rtx,rty+hgt,wdt,5)<(wdt*2)) + if (::Landscape.AreaSolidCount(rtx,rty+hgt,wdt,5)<(wdt*2)) { if (pByObj) GameMsgObject(LoadResStr("IDS_OBJ_NOLEVEL"),pByObj,FRed); return FALSE; @@ -2276,14 +2276,14 @@ BYTE DrawLineCol; bool C4Landscape::DrawLineLandscape(int32_t iX, int32_t iY, int32_t iGrade) { - Game.Landscape.Surface8->Circle(iX,iY,iGrade, DrawLineCol); + ::Landscape.Surface8->Circle(iX,iY,iGrade, DrawLineCol); return TRUE; } bool DrawLineMap(int32_t iX, int32_t iY, int32_t iRadius) { - if (iRadius==1) { if (Game.Landscape.Map) Game.Landscape.Map->SetPix(iX,iY,DrawLineCol); } - else Game.Landscape.Map->Circle(iX,iY,iRadius,DrawLineCol); + if (iRadius==1) { if (::Landscape.Map) ::Landscape.Map->SetPix(iX,iY,DrawLineCol); } + else ::Landscape.Map->Circle(iX,iY,iRadius,DrawLineCol); return TRUE; } @@ -2945,3 +2945,5 @@ bool C4Landscape::DebugSave(const char *szFilename) } return fSuccess; } + +C4Landscape Landscape; diff --git a/engine/src/C4MassMover.cpp b/engine/src/C4MassMover.cpp index 1c92d6bfd..e7f5990ee 100644 --- a/engine/src/C4MassMover.cpp +++ b/engine/src/C4MassMover.cpp @@ -137,13 +137,13 @@ BOOL C4MassMover::Execute() // Check for transfer target space C4Material *pMat = Game.Material.Map+Mat; tx=x; ty=y; - if (!Game.Landscape.FindMatPath(tx,ty,+1,pMat->Density,pMat->MaxSlide)) + if (!::Landscape.FindMatPath(tx,ty,+1,pMat->Density,pMat->MaxSlide)) { // Contact material reaction check: corrosion/evaporation/inflammation/etc. if (Corrosion(+0,+1) || Corrosion(-1,+0) || Corrosion(+1,+0)) { // material has been used up - Game.Landscape.ExtractMaterial(x,y); + ::Landscape.ExtractMaterial(x,y); return TRUE; } @@ -155,7 +155,7 @@ BOOL C4MassMover::Execute() /* if (Corrosion(0,0)) { // material has been used up by conversion - Game.Landscape.ExtractMaterial(x,y); + ::Landscape.ExtractMaterial(x,y); return TRUE; }*/ @@ -166,13 +166,13 @@ BOOL C4MassMover::Execute() // Transfer mass if(Random(10)) - SBackPix(tx,ty,Mat2PixColDefault(Game.Landscape.ExtractMaterial(x,y))+GBackIFT(tx,ty)); + SBackPix(tx,ty,Mat2PixColDefault(::Landscape.ExtractMaterial(x,y))+GBackIFT(tx,ty)); else - Game.Landscape.InsertMaterial(Game.Landscape.ExtractMaterial(x,y), tx, ty, 0, 1); + ::Landscape.InsertMaterial(::Landscape.ExtractMaterial(x,y), tx, ty, 0, 1); // Reinsert material (thrusted aside) if(Game.C4S.Game.Realism.LandscapeInsertThrust && MatValid(omat) && Game.Material.Map[omat].Density > 0) - Game.Landscape.InsertMaterial(omat, tx, ty + 1); + ::Landscape.InsertMaterial(omat, tx, ty + 1); // Create new mover at target Game.MassMover.Create(tx,ty,!Rnd3()); diff --git a/engine/src/C4Material.cpp b/engine/src/C4Material.cpp index bf80b4408..750ba7d79 100644 --- a/engine/src/C4Material.cpp +++ b/engine/src/C4Material.cpp @@ -637,7 +637,7 @@ bool mrfInsertCheck(int32_t &iX, int32_t &iY, FIXED &fXDir, FIXED &fYDir, int32_ // Move by mat path/slide int32_t iSlideX = iX, iSlideY = iY; - if (Game.Landscape.FindMatSlide(iSlideX,iSlideY,Sign(GravAccel),Game.Material.Map[iPxsMat].Density,Game.Material.Map[iPxsMat].MaxSlide)) + if (::Landscape.FindMatSlide(iSlideX,iSlideY,Sign(GravAccel),Game.Material.Map[iPxsMat].Density,Game.Material.Map[iPxsMat].MaxSlide)) { if(iPxsMat == iLsMat) { iX = iSlideX; iY = iSlideY; fXDir = 0; return false; } @@ -713,7 +713,7 @@ bool C4MaterialMap::mrfPoof(C4MaterialReaction *pReaction, int32_t &iX, int32_t { case meeMassMove: // MassMover-movement case meePXSPos: // PXS check before movement: Kill both landscape and PXS mat - Game.Landscape.ExtractMaterial(iLSPosX,iLSPosY); + ::Landscape.ExtractMaterial(iLSPosX,iLSPosY); if (!Rnd3()) Smoke(iX,iY,3); if (!Rnd3()) StartSoundEffectAt("Pshshsh", iX, iY); return true; @@ -725,7 +725,7 @@ bool C4MaterialMap::mrfPoof(C4MaterialReaction *pReaction, int32_t &iX, int32_t // either splash or slide prevented interaction return false; // Always kill both landscape and PXS mat - Game.Landscape.ExtractMaterial(iLSPosX,iLSPosY); + ::Landscape.ExtractMaterial(iLSPosX,iLSPosY); if (!Rnd3()) Smoke(iX,iY,3); if (!Rnd3()) StartSoundEffectAt("Pshshsh", iX, iY); return true; @@ -753,7 +753,7 @@ bool C4MaterialMap::mrfCorrode(C4MaterialReaction *pReaction, int32_t &iX, int32 if (fDoCorrode) { ClearBackPix(iLSPosX,iLSPosY); - //Game.Landscape.CheckInstabilityRange(iLSPosX,iLSPosY); - more correct, but makes acid too effective as well + //::Landscape.CheckInstabilityRange(iLSPosX,iLSPosY); - more correct, but makes acid too effective as well if (!Random(5)) Smoke(iX,iY,3+Random(3)); if (!Random(20)) StartSoundEffectAt("Corrode", iX, iY); return true; @@ -777,13 +777,13 @@ bool C4MaterialMap::mrfCorrode(C4MaterialReaction *pReaction, int32_t &iX, int32 if (fDoCorrode) { ClearBackPix(iLSPosX,iLSPosY); - Game.Landscape.CheckInstabilityRange(iLSPosX,iLSPosY); + ::Landscape.CheckInstabilityRange(iLSPosX,iLSPosY); if (!Random(5)) Smoke(iX,iY,3+Random(3)); if (!Random(20)) StartSoundEffectAt("Corrode", iX, iY); return true; } // Else: dead. Insert material here - Game.Landscape.InsertMaterial(iPxsMat,iX,iY); + ::Landscape.InsertMaterial(iPxsMat,iX,iY); return true; } } @@ -799,7 +799,7 @@ bool C4MaterialMap::mrfIncinerate(C4MaterialReaction *pReaction, int32_t &iX, in { case meeMassMove: // MassMover-movement case meePXSPos: // PXS check before movement - if (Game.Landscape.Incinerate(iX, iY)) return true; + if (::Landscape.Incinerate(iX, iY)) return true; break; case meePXSMove: // PXS movement @@ -808,9 +808,9 @@ bool C4MaterialMap::mrfIncinerate(C4MaterialReaction *pReaction, int32_t &iX, in // either splash or slide prevented interaction return false; // evaluate inflammation (should always succeed) - if (Game.Landscape.Incinerate(iX, iY)) return true; + if (::Landscape.Incinerate(iX, iY)) return true; // Else: dead. Insert material here - Game.Landscape.InsertMaterial(iPxsMat,iX,iY); + ::Landscape.InsertMaterial(iPxsMat,iX,iY); return true; } // not handled @@ -833,7 +833,7 @@ bool C4MaterialMap::mrfInsert(C4MaterialReaction *pReaction, int32_t &iX, int32_ // continue existing return false; // Else: dead. Insert material here - Game.Landscape.InsertMaterial(iPxsMat,iX,iY); + ::Landscape.InsertMaterial(iPxsMat,iX,iY); return true; } diff --git a/engine/src/C4Movement.cpp b/engine/src/C4Movement.cpp index b9879f65a..5339631ca 100644 --- a/engine/src/C4Movement.cpp +++ b/engine/src/C4Movement.cpp @@ -214,7 +214,7 @@ void C4Object::DoMovement() if (Def->ActMap[Action.Act].DigFree==1) { ctcox=fixtoi(fix_x+xdir); ctcoy=fixtoi(fix_y+ydir); - Game.Landscape.DigFreeRect(ctcox+Shape.GetX(),ctcoy+Shape.GetY(),Shape.Wdt,Shape.Hgt,Action.Data,this); + ::Landscape.DigFreeRect(ctcox+Shape.GetX(),ctcoy+Shape.GetY(),Shape.Wdt,Shape.Hgt,Action.Data,this); } // Free size round (variable size) else @@ -222,7 +222,7 @@ void C4Object::DoMovement() ctcox=fixtoi(fix_x+xdir); ctcoy=fixtoi(fix_y+ydir); int32_t rad = Def->ActMap[Action.Act].DigFree; if (ConMovePosition(cx-clk->GetX(), cy-clk->GetY()); return true; diff --git a/engine/src/C4PXS.cpp b/engine/src/C4PXS.cpp index 21ded953e..b3b49ca6c 100644 --- a/engine/src/C4PXS.cpp +++ b/engine/src/C4PXS.cpp @@ -83,7 +83,7 @@ void C4PXS::Execute() // In bounds? if(Inside(iToX, 0, GBackWdt-1) && Inside(iToY, 0, GBackHgt-1)) // Check path - if(Game.Landscape._PathFree(iX, iY, iToX, iToY)) + if(::Landscape._PathFree(iX, iY, iToX, iToY)) { x=ctcox; y=ctcoy; return; @@ -260,7 +260,7 @@ void C4PXSSystem::Draw(C4TargetFacet &cgo) if (pMat->PXSFace.Surface && Config.Graphics.PXSGfx) continue; // old-style: unicolored pixels or lines - DWORD dwMatClr = Game.Landscape.GetPal()->GetClr((BYTE) (Mat2PixColDefault(pxp->Mat))); + DWORD dwMatClr = ::Landscape.GetPal()->GetClr((BYTE) (Mat2PixColDefault(pxp->Mat))); if (fixtoi(pxp->xdir) || fixtoi(pxp->ydir)) { // lines for stuff that goes whooosh! diff --git a/engine/src/C4Player.cpp b/engine/src/C4Player.cpp index 5b1c9f925..763c1c484 100644 --- a/engine/src/C4Player.cpp +++ b/engine/src/C4Player.cpp @@ -198,8 +198,8 @@ void C4Player::Execute() { // player has selected a team that has a valid start position assigned // set view to this position! - ViewX = Game.C4S.PlrStart[iPlrStartIndex-1].Position[0] * Game.Landscape.MapZoom; - ViewY = Game.C4S.PlrStart[iPlrStartIndex-1].Position[1] * Game.Landscape.MapZoom; + ViewX = Game.C4S.PlrStart[iPlrStartIndex-1].Position[0] * ::Landscape.MapZoom; + ViewY = Game.C4S.PlrStart[iPlrStartIndex-1].Position[1] * ::Landscape.MapZoom; } } } diff --git a/engine/src/C4Script.cpp b/engine/src/C4Script.cpp index 0176a62d4..4525d0e91 100644 --- a/engine/src/C4Script.cpp +++ b/engine/src/C4Script.cpp @@ -245,7 +245,7 @@ static C4Value FnIncinerateLandscape(C4AulContext *cthr, C4Value *pPars) { PAR(int, iX); PAR(int, iY); if (cthr->Obj) { iX += cthr->Obj->GetX(); iY += cthr->Obj->GetY(); } - return C4VBool(!!Game.Landscape.Incinerate(iX, iY)); + return C4VBool(!!::Landscape.Incinerate(iX, iY)); } static C4Value FnExtinguish(C4AulContext *cthr, C4Value *pPars) @@ -270,13 +270,13 @@ static C4Value FnSetGravity(C4AulContext *cthr, C4Value *pPars) { PAR(int, iGravity); - Game.Landscape.Gravity = itofix(BoundBy(iGravity,-300,300)) / 500; + ::Landscape.Gravity = itofix(BoundBy(iGravity,-300,300)) / 500; return C4VTrue; } static C4Value FnGetGravity(C4AulContext *cthr, C4Value *pPars) { - return C4VInt(fixtoi(Game.Landscape.Gravity * 500)); + return C4VInt(fixtoi(::Landscape.Gravity * 500)); } static C4Value FnDeathAnnounce(C4AulContext *cthr, C4Value *pPars) @@ -2242,7 +2242,7 @@ static bool FnFlameConsumeMaterial(C4AulContext *cthr, long x, long y) long mat=GBackMat(x,y); if (!MatValid(mat)) return false; if (!Game.Material.Map[mat].Inflammable) return false; - if (Game.Landscape.ExtractMaterial(x,y)==MNone) return false; + if (::Landscape.ExtractMaterial(x,y)==MNone) return false; return true; } @@ -2264,22 +2264,22 @@ static long FnExtractLiquid(C4AulContext *cthr, long x, long y) { if (cthr->Obj) { x+=cthr->Obj->GetX(); y+=cthr->Obj->GetY(); } if (!GBackLiquid(x,y)) return MNone; - return Game.Landscape.ExtractMaterial(x,y); + return ::Landscape.ExtractMaterial(x,y); } static bool FnInsertMaterial(C4AulContext *cthr, long mat, long x, long y, long vx, long vy) { if (cthr->Obj) { x+=cthr->Obj->GetX(); y+=cthr->Obj->GetY(); } - return !!Game.Landscape.InsertMaterial(mat,x,y,vx,vy); + return !!::Landscape.InsertMaterial(mat,x,y,vx,vy); } static long FnGetMaterialCount(C4AulContext *cthr, long iMaterial, bool fReal) { if(!MatValid(iMaterial)) return -1; if(fReal || !Game.Material.Map[iMaterial].MinHeightCount) - return Game.Landscape.MatCount[iMaterial]; + return ::Landscape.MatCount[iMaterial]; else - return Game.Landscape.EffectiveMatCount[iMaterial]; + return ::Landscape.EffectiveMatCount[iMaterial]; } static long FnGetMaterial(C4AulContext *cthr, long x, long y) @@ -2330,7 +2330,7 @@ static long FnExtractMaterialAmount(C4AulContext *cthr, long x, long y, long mat long extracted=0; for (;extractedObj->GetY(); } int grade = BoundBy((iLevel/10)-1,1,3); - Game.Landscape.BlastFree(iX, iY, iLevel, grade, iCausedBy); + ::Landscape.BlastFree(iX, iY, iLevel, grade, iCausedBy); return true; } @@ -3126,8 +3126,8 @@ static long FnGetClimate(C4AulContext *cthr) static bool FnSetSkyFade(C4AulContext *cthr, long iFromRed, long iFromGreen, long iFromBlue, long iToRed, long iToGreen, long iToBlue) { // newgfx: set modulation - DWORD dwBack,dwMod=GetClrModulation(Game.Landscape.Sky.FadeClr1, C4RGB(iFromRed, iFromGreen, iFromBlue), dwBack); - Game.Landscape.Sky.SetModulation(dwMod,dwBack); + DWORD dwBack,dwMod=GetClrModulation(::Landscape.Sky.FadeClr1, C4RGB(iFromRed, iFromGreen, iFromBlue), dwBack); + ::Landscape.Sky.SetModulation(dwMod,dwBack); return TRUE; } @@ -3136,8 +3136,8 @@ static bool FnSetSkyColor(C4AulContext *cthr, long iIndex, long iRed, long iGree // set first index only if (iIndex) return TRUE; // get color difference - DWORD dwBack,dwMod=GetClrModulation(Game.Landscape.Sky.FadeClr1, C4RGB(iRed, iGreen, iBlue), dwBack); - Game.Landscape.Sky.SetModulation(dwMod,dwBack); + DWORD dwBack,dwMod=GetClrModulation(::Landscape.Sky.FadeClr1, C4RGB(iRed, iGreen, iBlue), dwBack); + ::Landscape.Sky.SetModulation(dwMod,dwBack); // success return TRUE; } @@ -3146,8 +3146,8 @@ static long FnGetSkyColor(C4AulContext *cthr, long iIndex, long iRGB) { // relict from OldGfx if (iIndex || !Inside(iRGB,0,2)) return 0; - DWORD dwClr=Game.Landscape.Sky.FadeClr1; - BltAlpha(dwClr, Game.Landscape.Sky.FadeClr2 | ((iIndex*0xff/19)<<24)); + DWORD dwClr=::Landscape.Sky.FadeClr1; + BltAlpha(dwClr, ::Landscape.Sky.FadeClr2 | ((iIndex*0xff/19)<<24)); switch (iRGB) { case 0: return (dwClr>>16)&0xff; @@ -3188,7 +3188,7 @@ static bool FnLaunchEarthquake(C4AulContext *cthr, long x, long y) static bool FnShakeFree(C4AulContext *cthr, long x, long y, long rad) { - Game.Landscape.ShakeFree(x,y,rad); + ::Landscape.ShakeFree(x,y,rad); return 1; } @@ -3200,22 +3200,22 @@ static bool FnShakeObjects(C4AulContext *cthr, long x, long y, long rad) static bool FnDigFree(C4AulContext *cthr, long x, long y, long rad, bool fRequest) { - Game.Landscape.DigFree(x,y,rad,fRequest,cthr->Obj); + ::Landscape.DigFree(x,y,rad,fRequest,cthr->Obj); return 1; } static bool FnDigFreeRect(C4AulContext *cthr, long iX, long iY, long iWdt, long iHgt, bool fRequest) { - Game.Landscape.DigFreeRect(iX,iY,iWdt,iHgt,fRequest,cthr->Obj); + ::Landscape.DigFreeRect(iX,iY,iWdt,iHgt,fRequest,cthr->Obj); return TRUE; } static bool FnFreeRect(C4AulContext *cthr, long iX, long iY, long iWdt, long iHgt, long iFreeDensity) { if (iFreeDensity) - Game.Landscape.ClearRectDensity(iX,iY,iWdt,iHgt,iFreeDensity); + ::Landscape.ClearRectDensity(iX,iY,iWdt,iHgt,iFreeDensity); else - Game.Landscape.ClearRect(iX,iY,iWdt,iHgt); + ::Landscape.ClearRect(iX,iY,iWdt,iHgt); return TRUE; } @@ -4596,7 +4596,7 @@ static bool FnSetMaterialColor(C4AulContext* cthr, long iMat, long iClr1R, long dwMod&=0xffffff; if (!dwMod) dwMod=1; if (dwMod==0xffffff) dwMod=0; - Game.Landscape.SetModulation(dwMod); + ::Landscape.SetModulation(dwMod); // done return TRUE; } @@ -4762,7 +4762,7 @@ static C4Value FnGlobalN(C4AulContext* cthr, C4Value* strName_C4V) static bool FnSetSkyAdjust(C4AulContext* cthr, long dwAdjust, long dwBackClr) { // set adjust - Game.Landscape.Sky.SetModulation(dwAdjust, dwBackClr); + ::Landscape.Sky.SetModulation(dwAdjust, dwBackClr); // success return TRUE; } @@ -4770,7 +4770,7 @@ static bool FnSetSkyAdjust(C4AulContext* cthr, long dwAdjust, long dwBackClr) static bool FnSetMatAdjust(C4AulContext* cthr, long dwAdjust) { // set adjust - Game.Landscape.SetModulation(dwAdjust); + ::Landscape.SetModulation(dwAdjust); // success return TRUE; } @@ -4778,13 +4778,13 @@ static bool FnSetMatAdjust(C4AulContext* cthr, long dwAdjust) static long FnGetSkyAdjust(C4AulContext* cthr, bool fBackColor) { // get adjust - return Game.Landscape.Sky.GetModulation(!!fBackColor); + return ::Landscape.Sky.GetModulation(!!fBackColor); } static long FnGetMatAdjust(C4AulContext* cthr) { // get adjust - return Game.Landscape.GetModulation(); + return ::Landscape.GetModulation(); } static long FnAnyContainer(C4AulContext*) { return ANY_CONTAINER; } @@ -4915,7 +4915,7 @@ static C4Value FnGetCrewExtraData(C4AulContext *cthr, C4Value *pCrew_C4V, C4Valu static long FnDrawMatChunks(C4AulContext *cctx, long tx, long ty, long twdt, long thgt, long icntx, long icnty, C4String *strMaterial, C4String *strTexture, bool bIFT) { - return Game.Landscape.DrawChunks(tx, ty, twdt, thgt, icntx, icnty, FnStringPar(strMaterial), FnStringPar(strTexture), bIFT != 0); + return ::Landscape.DrawChunks(tx, ty, twdt, thgt, icntx, icnty, FnStringPar(strMaterial), FnStringPar(strTexture), bIFT != 0); } static bool FnGetCrewEnabled(C4AulContext *cctx, C4Object *pObj) @@ -4965,13 +4965,13 @@ static bool FnUnselectCrew(C4AulContext *cctx, long iPlayer) static long FnDrawMap(C4AulContext *cctx, long iX, long iY, long iWdt, long iHgt, C4String *szMapDef) { // draw it! - return Game.Landscape.DrawMap(iX, iY, iWdt, iHgt, FnStringPar(szMapDef)); + return ::Landscape.DrawMap(iX, iY, iWdt, iHgt, FnStringPar(szMapDef)); } static long FnDrawDefMap(C4AulContext *cctx, long iX, long iY, long iWdt, long iHgt, C4String *szMapDef) { // draw it! - return Game.Landscape.DrawDefMap(iX, iY, iWdt, iHgt, FnStringPar(szMapDef)); + return ::Landscape.DrawDefMap(iX, iY, iWdt, iHgt, FnStringPar(szMapDef)); } struct C4ModLandscapeMatRec @@ -5002,7 +5002,7 @@ static bool FnDrawModLandscape(C4AulContext *cctx, long iX, long iY, long iWdt, // ClipRect wants int& instead of long& int32_t i_x = iX, i_y = iY, i_w = iWdt, i_h = iHgt; - if (!Game.Landscape.ClipRect(i_x, i_y, i_w, i_h)) return FALSE; + if (!::Landscape.ClipRect(i_x, i_y, i_w, i_h)) return FALSE; iX = i_x; iY = i_y; iWdt = i_w; iHgt = i_h; long iX2=iX+iWdt; long iY2=iY+iHgt; @@ -5102,7 +5102,7 @@ static bool FnDrawModLandscape(C4AulContext *cctx, long iX, long iY, long iWdt, if (dwPix>>24) { // apply it! - DWORD dwPixUnder = Game.Landscape._GetPixDw(x,y, false); + DWORD dwPixUnder = ::Landscape._GetPixDw(x,y, false); BltAlpha(dwPixUnder, dwPix); dwPix=dwPixUnder; } break; @@ -5113,7 +5113,7 @@ static bool FnDrawModLandscape(C4AulContext *cctx, long iX, long iY, long iWdt, if (fDrawPix) { //dwPix=Application.DDraw->PatternedClr(x,y,dwPix); - // TODO: Game.Landscape.SetPixDw(x,y,dwPix); + // TODO: ::Landscape.SetPixDw(x,y,dwPix); } } ++pZ; @@ -5218,13 +5218,13 @@ static bool FnSetSkyParallax(C4AulContext* ctx, long iMode, long iParX, long iPa { // set all parameters that aren't SkyPar_KEEP if (iMode != SkyPar_KEEP) - if (Inside(iMode, 0, 1)) Game.Landscape.Sky.ParallaxMode = iMode; - if (iParX != SkyPar_KEEP && iParX) Game.Landscape.Sky.ParX = iParX; - if (iParY != SkyPar_KEEP && iParY) Game.Landscape.Sky.ParY = iParY; - if (iXDir != SkyPar_KEEP) Game.Landscape.Sky.xdir = itofix(iXDir); - if (iYDir != SkyPar_KEEP) Game.Landscape.Sky.ydir = itofix(iYDir); - if (iX != SkyPar_KEEP) Game.Landscape.Sky.x = itofix(iX); - if (iY != SkyPar_KEEP) Game.Landscape.Sky.y = itofix(iY); + if (Inside(iMode, 0, 1)) ::Landscape.Sky.ParallaxMode = iMode; + if (iParX != SkyPar_KEEP && iParX) ::Landscape.Sky.ParX = iParX; + if (iParY != SkyPar_KEEP && iParY) ::Landscape.Sky.ParY = iParY; + if (iXDir != SkyPar_KEEP) ::Landscape.Sky.xdir = itofix(iXDir); + if (iYDir != SkyPar_KEEP) ::Landscape.Sky.ydir = itofix(iYDir); + if (iX != SkyPar_KEEP) ::Landscape.Sky.x = itofix(iX); + if (iY != SkyPar_KEEP) ::Landscape.Sky.y = itofix(iY); // success return TRUE; } @@ -5308,12 +5308,12 @@ static long FnGetPathLength(C4AulContext* ctx, long iFromX, long iFromY, long iT static long FnSetTextureIndex(C4AulContext *ctx, C4String *psMatTex, long iNewIndex, bool fInsert) { if(!Inside(iNewIndex, 0l, 255l)) return FALSE; - return Game.Landscape.SetTextureIndex(FnStringPar(psMatTex), BYTE(iNewIndex), !!fInsert); + return ::Landscape.SetTextureIndex(FnStringPar(psMatTex), BYTE(iNewIndex), !!fInsert); } static long FnRemoveUnusedTexMapEntries(C4AulContext *ctx) { - Game.Landscape.RemoveUnusedTexMapEntries(); + ::Landscape.RemoveUnusedTexMapEntries(); return TRUE; } @@ -5322,7 +5322,7 @@ static bool FnSetLandscapePixel(C4AulContext* ctx, long iX, long iY, long dwValu // local call if (ctx->Obj) { iX+=ctx->Obj->GetX(); iY+=ctx->Obj->GetY(); } // set pixel in 32bit-sfc only - // TODO: Game.Landscape.SetPixDw(iX, iY, dwValue); + // TODO: ::Landscape.SetPixDw(iX, iY, dwValue); // success return TRUE; } @@ -5349,7 +5349,7 @@ static bool FnSetObjectOrder(C4AulContext* ctx, C4Object *pObjBeforeOrAfter, C4O static bool FnDrawMaterialQuad(C4AulContext* ctx, C4String *szMaterial, long iX1, long iY1, long iX2, long iY2, long iX3, long iY3, long iX4, long iY4, bool fSub) { const char *szMat = FnStringPar(szMaterial); - return !! Game.Landscape.DrawQuad(iX1, iY1, iX2, iY2, iX3, iY3, iX4, iY4, szMat, fSub); + return !! ::Landscape.DrawQuad(iX1, iY1, iX2, iY2, iX3, iY3, iX4, iY4, szMat, fSub); } static bool FnFightWith(C4AulContext *ctx, C4Object *pTarget, C4Object *pClonk) diff --git a/engine/src/C4SolidMask.cpp b/engine/src/C4SolidMask.cpp index 1d2521408..87fc6ddc0 100644 --- a/engine/src/C4SolidMask.cpp +++ b/engine/src/C4SolidMask.cpp @@ -254,7 +254,7 @@ void C4SolidMask::Remove(bool fCauseInstability, bool fBackupAttachment) _SBackPixIfMask(iTx,iTy,*pPix,MCVehic); // Instability if (fCauseInstability) - Game.Landscape.CheckInstabilityRange(iTx,iTy); + ::Landscape.CheckInstabilityRange(iTx,iTy); } } // Mask not put flag @@ -456,7 +456,7 @@ bool C4SolidMask::CheckConsistency() { pSolid->RemoveTemporary(SolidMaskRect); } - assert(!Game.Landscape.MatCount[MVehic]); + assert(!::Landscape.MatCount[MVehic]); // Restore Solidmasks for (pSolid = C4SolidMask::First; pSolid; pSolid = pSolid->Next) { diff --git a/engine/src/C4Texture.cpp b/engine/src/C4Texture.cpp index ec17b1143..3ded996e9 100644 --- a/engine/src/C4Texture.cpp +++ b/engine/src/C4Texture.cpp @@ -132,7 +132,7 @@ BOOL C4TextureMap::AddEntry(BYTE byIndex, const char *szMaterial, const char *sz } #ifdef C4ENGINE // Landscape must be notified (new valid pixel clr) - Game.Landscape.HandleTexMapUpdate(); + ::Landscape.HandleTexMapUpdate(); #endif } return TRUE; diff --git a/engine/src/C4ToolsDlg.cpp b/engine/src/C4ToolsDlg.cpp index 8aff8d6dc..b2e2c6ce0 100644 --- a/engine/src/C4ToolsDlg.cpp +++ b/engine/src/C4ToolsDlg.cpp @@ -536,7 +536,7 @@ void C4ToolsDlg::UpdateTextures() #endif // bottom-most: any invalid textures bool fAnyEntry = false; int32_t cnt; const char *szTexture; - if (Game.Landscape.Mode!=C4LSC_Exact) + if (::Landscape.Mode!=C4LSC_Exact) for (cnt=0; (szTexture=::TextureMap.GetTexture(cnt)); cnt++) { if (!::TextureMap.GetIndex(Material, szTexture, FALSE)) @@ -567,7 +567,7 @@ void C4ToolsDlg::UpdateTextures() for (cnt=0; (szTexture=::TextureMap.GetTexture(cnt)); cnt++) { // Current material-texture valid? Always valid for exact mode - if (::TextureMap.GetIndex(Material,szTexture,FALSE) || Game.Landscape.Mode==C4LSC_Exact) + if (::TextureMap.GetIndex(Material,szTexture,FALSE) || ::Landscape.Mode==C4LSC_Exact) { #ifdef _WIN32 SendDlgItemMessage(hDialog,IDC_COMBOTEXTURE,CB_INSERTSTRING,0,(LPARAM)szTexture); @@ -595,7 +595,7 @@ void C4ToolsDlg::SetMaterial(const char *szMaterial) SCopy(szMaterial,Material,C4M_MaxName); AssertValidTexture(); EnableControls(); - if (Game.Landscape.Mode==C4LSC_Static) UpdateTextures(); + if (::Landscape.Mode==C4LSC_Static) UpdateTextures(); UpdatePreview(); } @@ -672,7 +672,7 @@ void C4ToolsDlg::UpdatePreview() if (SEqual(Material,C4TLS_MatSky)) { Pattern.SetColors(0, 0); - Pattern.Set(Game.Landscape.Sky.Surface, 0, false); + Pattern.Set(::Landscape.Sky.Surface, 0, false); } // Material-Texture else @@ -702,7 +702,7 @@ void C4ToolsDlg::UpdatePreview() Application.DDraw->DrawPatternedCircle( sfcPreview, iPrvWdt/2,iPrvHgt/2, Grade, - bCol, Pattern, *Game.Landscape.GetPal()); + bCol, Pattern, *::Landscape.GetPal()); Application.DDraw->AttachPrimaryPalette(sfcPreview); @@ -844,7 +844,7 @@ void C4ToolsDlg::UpdateIFTControls() void C4ToolsDlg::UpdateLandscapeModeCtrls() { - int32_t iMode = Game.Landscape.Mode; + int32_t iMode = ::Landscape.Mode; #ifdef _WIN32 // Dynamic: enable only if dynamic anyway SendDlgItemMessage(hDialog,IDC_BUTTONMODEDYNAMIC,BM_SETSTATE,(iMode==C4LSC_Dynamic),0); @@ -852,7 +852,7 @@ void C4ToolsDlg::UpdateLandscapeModeCtrls() UpdateWindow(GetDlgItem(hDialog,IDC_BUTTONMODEDYNAMIC)); // Static: enable only if map available SendDlgItemMessage(hDialog,IDC_BUTTONMODESTATIC,BM_SETSTATE,(iMode==C4LSC_Static),0); - EnableWindow(GetDlgItem(hDialog,IDC_BUTTONMODESTATIC),(Game.Landscape.Map!=NULL)); + EnableWindow(GetDlgItem(hDialog,IDC_BUTTONMODESTATIC),(::Landscape.Map!=NULL)); UpdateWindow(GetDlgItem(hDialog,IDC_BUTTONMODESTATIC)); // Exact: enable always SendDlgItemMessage(hDialog,IDC_BUTTONMODEEXACT,BM_SETSTATE,(iMode==C4LSC_Exact),0); @@ -869,7 +869,7 @@ void C4ToolsDlg::UpdateLandscapeModeCtrls() gtk_widget_set_sensitive(landscape_dynamic, iMode==C4LSC_Dynamic); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(landscape_static), iMode==C4LSC_Static); - gtk_widget_set_sensitive(landscape_static, Game.Landscape.Map!=NULL); + gtk_widget_set_sensitive(landscape_static, ::Landscape.Map!=NULL); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(landscape_exact), iMode==C4LSC_Exact); @@ -884,7 +884,7 @@ void C4ToolsDlg::UpdateLandscapeModeCtrls() BOOL C4ToolsDlg::SetLandscapeMode(int32_t iMode, bool fThroughControl) { - int32_t iLastMode=Game.Landscape.Mode; + int32_t iLastMode=::Landscape.Mode; // Exact to static: confirm data loss warning if (iLastMode==C4LSC_Exact) if (iMode==C4LSC_Static) @@ -898,11 +898,11 @@ BOOL C4ToolsDlg::SetLandscapeMode(int32_t iMode, bool fThroughControl) return TRUE; } // Set landscape mode - Game.Landscape.SetMode(iMode); + ::Landscape.SetMode(iMode); // Exact to static: redraw landscape from map if (iLastMode==C4LSC_Exact) if (iMode==C4LSC_Static) - Game.Landscape.MapToLandscape(); + ::Landscape.MapToLandscape(); // Assert valid tool if (iMode!=C4LSC_Exact) if (SelectedTool==C4TLS_Fill) @@ -917,7 +917,7 @@ BOOL C4ToolsDlg::SetLandscapeMode(int32_t iMode, bool fThroughControl) void C4ToolsDlg::EnableControls() { - int32_t iLandscapeMode=Game.Landscape.Mode; + int32_t iLandscapeMode=::Landscape.Mode; #ifdef _WIN32 // Set bitmap buttons SendDlgItemMessage(hDialog,IDC_BUTTONBRUSH,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? hbmBrush : hbmBrush2)); @@ -986,7 +986,7 @@ void C4ToolsDlg::LoadBitmaps() void C4ToolsDlg::AssertValidTexture() { // Static map mode only - if (Game.Landscape.Mode!=C4LSC_Static) return; + if (::Landscape.Mode!=C4LSC_Static) return; // Ignore if sky if (SEqual(Material,C4TLS_MatSky)) return; // Current material-texture valid diff --git a/engine/src/C4Viewport.cpp b/engine/src/C4Viewport.cpp index 4fe58c77f..03a83fcb5 100644 --- a/engine/src/C4Viewport.cpp +++ b/engine/src/C4Viewport.cpp @@ -1065,13 +1065,13 @@ void C4Viewport::Draw(C4TargetFacet &cgo, bool fDrawOverlay) lpDDraw->SetClrModMapEnabled(false); C4ST_STARTNEW(SkyStat, "C4Viewport::Draw: Sky") - Game.Landscape.Sky.Draw(cgo); + ::Landscape.Sky.Draw(cgo); C4ST_STOP(SkyStat) Game.BackObjects.DrawAll(cgo, Player); // Draw Landscape C4ST_STARTNEW(LandStat, "C4Viewport::Draw: Landscape") - Game.Landscape.Draw(cgo,Player); + ::Landscape.Draw(cgo,Player); C4ST_STOP(LandStat) // draw PXS (unclipped!) diff --git a/engine/src/C4Weather.cpp b/engine/src/C4Weather.cpp index dd1310a7f..0abcc4ee8 100644 --- a/engine/src/C4Weather.cpp +++ b/engine/src/C4Weather.cpp @@ -118,9 +118,9 @@ void C4Weather::Execute() // In cave landscapes, meteors must be created a bit lower so they don't hit the ceiling // (who activates meteors in cave landscapes anyway?) meto=Game.CreateObject(C4ID_Meteor, NULL, NO_OWNER, - Random(GBackWdt),Game.Landscape.TopOpen ? -20 : 5,0, + Random(GBackWdt),::Landscape.TopOpen ? -20 : 5,0, itofix(Random(100+1)-50)/10, - Game.Landscape.TopOpen ? Fix0 : itofix(2), itofix(1)/5); + ::Landscape.TopOpen ? Fix0 : itofix(2), itofix(1)/5); } // Lightning if (!Random(35))