OpenClonk
C4Landscape::P Struct Reference
Collaboration diagram for C4Landscape::P:
[legend]

Public Member Functions

void ClearMatCount ()
 
void ExecuteScan (C4Landscape *)
 
int32_t DoScan (C4Landscape *, int32_t x, int32_t y, int32_t mat, int32_t dir)
 
uint32_t ChunkyRandom (uint32_t &iOffset, uint32_t iRange) const
 
void DrawChunk (C4Landscape *, int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, uint8_t mcol, uint8_t mcolBkg, C4MaterialCoreShape Shape, uint32_t cro)
 
void DrawSmoothOChunk (C4Landscape *, int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, uint8_t mcol, uint8_t mcolBkg, int flip, uint32_t cro)
 
void ChunkOZoom (C4Landscape *, const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, uint8_t iTexture, int32_t iOffX=0, int32_t iOffY=0)
 
bool TexOZoom (C4Landscape *, const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, DWORD *dwpTextureUsage, int32_t iToX=0, int32_t iToY=0)
 
bool MapToSurface (C4Landscape *, const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iToX, int32_t iToY, int32_t iToWdt, int32_t iToHgt, int32_t iOffX, int32_t iOffY)
 
bool MapToLandscape (C4Landscape *d, const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iOffsX=0, int32_t iOffsY=0, bool noClear=false)
 
bool InitBorderPix ()
 
bool GetMapColorIndex (const char *szMaterial, const char *szTexture, BYTE &rbyCol) const
 
bool CreateMap (CSurface8 *&sfcMap, CSurface8 *&sfcMapBkg)
 
bool CreateMapS2 (C4Group &ScenFile, CSurface8 *&sfcMap, CSurface8 *&sfcMapBkg)
 
bool Mat2Pal ()
 
void UpdatePixCnt (const C4Landscape *, const C4Rect &Rect, bool fCheck=false)
 
void UpdateMatCnt (const C4Landscape *, C4Rect Rect, bool fPlus)
 
void PrepareChange (const C4Landscape *d, const C4Rect &BoundingBox)
 
void FinishChange (C4Landscape *d, C4Rect BoundingBox)
 
bool DrawLineLandscape (int32_t iX, int32_t iY, int32_t iGrade, uint8_t line_color, uint8_t line_color_bkg)
 
bool DrawLineMap (int32_t iX, int32_t iY, int32_t iRadius, uint8_t line_color, uint8_t line_color_bkg)
 
uint8_t * GetBridgeMatConversion (const C4Landscape *d, int32_t for_material_col) const
 
bool SaveInternal (const C4Landscape *d, C4Group &hGroup) const
 
bool SaveDiffInternal (const C4Landscape *d, C4Group &hGroup, bool fSyncSave) const
 
int32_t ForPolygon (C4Landscape *d, int *vtcs, int length, const std::function< bool(int32_t, int32_t)> &callback, C4MaterialList *mats_count=nullptr, uint8_t col=0, uint8_t colBkg=0, uint8_t *conversion_table=nullptr)
 
std::unique_ptr< CSurface8CreateDefaultBkgSurface (CSurface8 &sfcFg, bool msbAsIft) const
 
void DigMaterial2Objects (int32_t tx, int32_t ty, C4MaterialList *mat_list, C4Object *pCollect=nullptr)
 
void BlastMaterial2Objects (int32_t tx, int32_t ty, C4MaterialList *mat_list, int32_t caused_by, int32_t str, C4ValueArray *out_objects)
 
bool DigFreePix (C4Landscape *d, int32_t tx, int32_t ty)
 
bool DigFreePixNoInstability (C4Landscape *d, int32_t tx, int32_t ty)
 
bool BlastFreePix (C4Landscape *d, int32_t tx, int32_t ty)
 
bool ShakeFreePix (C4Landscape *d, int32_t tx, int32_t ty)
 
C4ValueArrayPrepareFreeShape (C4Rect &BoundingBox, C4Object *by_object)
 
void PostFreeShape (C4ValueArray *dig_objects, C4Object *by_object)
 
BYTE DefaultBkgMat (BYTE fg) const
 

Public Attributes

std::unique_ptr< CSurface8Surface8
 
std::unique_ptr< CSurface8Surface8Bkg
 
std::unique_ptr< CSurface8Map
 
std::unique_ptr< CSurface8MapBkg
 
std::unique_ptr< C4LandscapeRenderpLandscapeRender
 
std::vector< uint8_t > TopRowPix
 
std::vector< uint8_t > BottomRowPix
 
std::vector< uint8_t > LeftColPix
 
std::vector< uint8_t > RightColPix
 
int32_t Pix2Mat [C4M_MaxTexIndex]
 
int32_t Pix2Dens [C4M_MaxTexIndex]
 
int32_t Pix2Place [C4M_MaxTexIndex]
 
bool Pix2Light [C4M_MaxTexIndex]
 
int32_t PixCntPitch = 0
 
std::vector< uint8_t > PixCnt
 
std::array< C4Rect, C4LS_MaxRelightsRelights
 
std::array< std::unique_ptr< uint8_t[]>, C4M_MaxTexIndexBridgeMatConversion
 
LandscapeMode mode = LandscapeMode::Undefined
 
int32_t Width = 0
 
int32_t Height = 0
 
int32_t MapWidth = 0
 
int32_t MapHeight = 0
 
int32_t MapZoom = 0
 
std::array< DWORD, C4MaxMaterialMatCount {}
 
std::array< DWORD, C4MaxMaterialEffectiveMatCount {}
 
bool NoScan = false
 
int32_t ScanX = 0
 
int32_t ScanSpeed = 2
 
C4Real Gravity = DefaultGravAccel
 
uint32_t Modulation = 0
 
int32_t MapSeed = 0
 
C4Sky Sky
 
std::unique_ptr< C4MapCreatorS2pMapCreator
 
bool fMapChanged = false
 
std::unique_ptr< BYTE[]> pInitial
 
std::unique_ptr< BYTE[]> pInitialBkg
 
std::unique_ptr< C4FoWpFoW
 

Detailed Description

Definition at line 52 of file C4Landscape.cpp.

Member Function Documentation

◆ BlastFreePix()

bool C4Landscape::P::BlastFreePix ( C4Landscape d,
int32_t  tx,
int32_t  ty 
)

Definition at line 733 of file C4Landscape.cpp.

References C4MaterialCore::BlastFree, C4Material::BlastShiftTo, C4Landscape::CheckInstabilityRange(), C4Landscape::ClearPix(), C4Landscape::GetMat(), C4MaterialMap::Map, MaterialMap, MatTex2PixCol(), MatValid(), C4Landscape::SetPix2(), and C4Landscape::Transparent.

734 {
735  int32_t mat = d->GetMat(tx, ty);
736  if (MatValid(mat))
737  {
738  // for blast, either shift to different material or blast free
739  if (::MaterialMap.Map[mat].BlastFree)
740  {
741  d->ClearPix(tx, ty);
742  // check for instable materials to start moving by the cleared space
743  d->CheckInstabilityRange(tx, ty);
744  return true;
745  }
746  else
747  if (::MaterialMap.Map[mat].BlastShiftTo)
749  }
750  return false;
751 }
int32_t BlastShiftTo
Definition: C4Material.h:151
C4Material * Map
Definition: C4Material.h:169
int32_t BlastFree
Definition: C4Material.h:95
void CheckInstabilityRange(int32_t tx, int32_t ty)
int32_t GetMat(int32_t x, int32_t y) const
bool SetPix2(int32_t x, int32_t y, BYTE fgPix, BYTE bgPix)
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
bool ClearPix(int32_t tx, int32_t ty)
BYTE MatTex2PixCol(int32_t tex)
Definition: C4Material.h:230
static const uint8_t Transparent
Definition: C4Landscape.h:50
bool MatValid(int32_t mat)
Definition: C4Material.h:210
Here is the call graph for this function:

◆ BlastMaterial2Objects()

void C4Landscape::P::BlastMaterial2Objects ( int32_t  tx,
int32_t  ty,
C4MaterialList mat_list,
int32_t  caused_by,
int32_t  str,
C4ValueArray out_objects 
)

Definition at line 637 of file C4Landscape.cpp.

References C4MaterialList::Amount, C4MaterialCore::Blast2Object, C4MaterialCore::Blast2ObjectRatio, C4MaterialCore::Blast2PXSRatio, C4PXSSystem::Cast(), C4Game::CastObjects(), Game, C4MaterialMap::Map, MaterialMap, NO_OWNER, C4ID::None, C4MaterialMap::Num, and PXS.

638 {
639  for (int32_t mat = 0; mat < ::MaterialMap.Num; mat++)
640  {
641  if (mat_list->Amount[mat])
642  {
643  int32_t cast_strength = str;
644  int32_t pxsamount = 0, blastamount = 0;
645 
646  if (::MaterialMap.Map[mat].Blast2PXSRatio != 0)
647  {
648  pxsamount = mat_list->Amount[mat] / ::MaterialMap.Map[mat].Blast2PXSRatio;
649  ::PXS.Cast(mat, pxsamount, tx, ty, cast_strength * 2);
650  }
651 
652  if (::MaterialMap.Map[mat].Blast2Object != C4ID::None)
653  {
654  if (::MaterialMap.Map[mat].Blast2ObjectRatio != 0)
655  {
656  blastamount = mat_list->Amount[mat] / ::MaterialMap.Map[mat].Blast2ObjectRatio;
657  Game.CastObjects(::MaterialMap.Map[mat].Blast2Object, nullptr, blastamount, cast_strength, tx, ty, NO_OWNER, caused_by, out_objects);
658  }
659  }
660 
661  mat_list->Amount[mat] -= std::max(blastamount * ::MaterialMap.Map[mat].Blast2ObjectRatio,
662  pxsamount * ::MaterialMap.Map[mat].Blast2PXSRatio);
663  }
664  }
665 }
void Cast(int32_t mat, int32_t num, int32_t tx, int32_t ty, int32_t level)
Definition: C4PXS.cpp:309
C4Game Game
Definition: C4Globals.cpp:52
C4Material * Map
Definition: C4Material.h:169
void CastObjects(C4ID id, C4Object *pCreator, int32_t num, int32_t level, int32_t tx, int32_t ty, int32_t iOwner=NO_OWNER, int32_t iController=NO_OWNER, C4ValueArray *out_objects=nullptr)
Definition: C4Game.cpp:1411
static const C4ID None
Definition: C4Id.h:39
int32_t Blast2PXSRatio
Definition: C4Material.h:101
int32_t Blast2ObjectRatio
Definition: C4Material.h:100
const int NO_OWNER
Definition: C4Constants.h:137
C4PXSSystem PXS
Definition: C4PXS.cpp:423
int32_t Num
Definition: C4Material.h:168
C4ID Blast2Object
Definition: C4Material.h:99
int32_t Amount[C4MaxMaterial]
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
Here is the call graph for this function:

◆ ChunkOZoom()

void C4Landscape::P::ChunkOZoom ( C4Landscape d,
const CSurface8 sfcMap,
const CSurface8 sfcMapBkg,
int32_t  iMapX,
int32_t  iMapY,
int32_t  iMapWdt,
int32_t  iMapHgt,
uint8_t  iTexture,
int32_t  iOffX = 0,
int32_t  iOffY = 0 
)

Definition at line 2183 of file C4Landscape.cpp.

References CSurface8::_GetPix(), C4M_Flat, C4M_Octagon, C4M_Smooth, C4M_Smoother, C4Game::C4S, C4TextureShape::Draw(), C4SLandscape::FlatChunkShapes, Game, C4TextureMap::GetEntry(), C4TexMapEntry::GetMaterial(), C4Texture::GetMaterialShape(), CSurface8::GetPix(), CSurface8::GetSurfaceSize(), C4TextureMap::GetTexture(), C4TexMapEntry::GetTextureName(), C4Scenario::Landscape, C4ScriptGuiWindowPropertyName::left, C4MaterialCore::MapChunkType, C4MaterialCore::MinShapeOverlap, C4ScriptGuiWindowPropertyName::right, and TextureMap.

2184 {
2185  const C4TexMapEntry *entry = ::TextureMap.GetEntry(iTexture);
2186  C4Material *pMaterial = entry->GetMaterial();
2187  if (!pMaterial) return;
2188  const char *texture_name = entry->GetTextureName();
2189  C4Texture *texture = ::TextureMap.GetTexture(texture_name);
2190  C4TextureShape *shape = texture ? texture->GetMaterialShape() : nullptr;
2191  // Chunk type by material
2193  // Get map & landscape size
2194  int iMapWidth, iMapHeight;
2195  sfcMap.GetSurfaceSize(iMapWidth, iMapHeight);
2196  // Clip desired map segment to map size
2197  iMapX = Clamp<int32_t>(iMapX, 0, iMapWidth - 1);
2198  iMapY = Clamp<int32_t>(iMapY, 0, iMapHeight - 1);
2199  iMapWdt = Clamp<int32_t>(iMapWdt, 0, iMapWidth - iMapX);
2200  iMapHgt = Clamp<int32_t>(iMapHgt, 0, iMapHeight - iMapY);
2201  // get chunk size
2202  int iChunkWidth = MapZoom, iChunkHeight = MapZoom;
2203  // Scan map lines
2204  for (int iY = iMapY; iY < iMapY + iMapHgt; iY++)
2205  {
2206  // Landscape target coordinate vertical
2207  int iToY = iY * iChunkHeight + iOffY;
2208  // Scan map line
2209  for (int iX = iMapX; iX < iMapX + iMapWdt; iX++)
2210  {
2211  // Map scan line start
2212  uint8_t MapPixel = sfcMap._GetPix(iX, iY);
2213  uint8_t MapPixelBkg = sfcMapBkg._GetPix(iX, iY);
2214  // Landscape target coordinate horizontal
2215  int iToX = iX * iChunkWidth + iOffX;
2216  // Here's a chunk of the texture-material to zoom
2217  if (MapPixel == iTexture)
2218  {
2219  // Draw chunk
2220  DrawChunk(d, iToX, iToY, iChunkWidth, iChunkHeight, MapPixel, MapPixelBkg, iChunkType, (iX << 16) + iY);
2221  }
2222  // Other chunk, check for slope smoothers
2223  else if (iChunkType == C4M_Smooth || iChunkType == C4M_Smoother || iChunkType == C4M_Octagon)
2224  {
2225  // Map scan line pixel below
2226  uint8_t below = sfcMap.GetPix(iX, iY + 1);
2227  uint8_t above = sfcMap.GetPix(iX, iY - 1);
2228  uint8_t left = sfcMap.GetPix(iX - 1, iY);
2229  uint8_t right = sfcMap.GetPix(iX + 1, iY);
2230  uint8_t leftBkg = sfcMapBkg.GetPix(iX - 1, iY);
2231  uint8_t rightBkg = sfcMapBkg.GetPix(iX + 1, iY);
2232  // do not fill a tiny hole
2233  if (below == iTexture && above == iTexture && left == iTexture && right == iTexture)
2234  continue;
2235  int flat = iChunkType == C4M_Octagon ? 4 : 0;
2236  // Smooth chunk & same texture-material below
2237  if (iY < iMapHeight - 1 && below == iTexture)
2238  {
2239  // Same texture-material on left
2240  if (iX > 0 && left == iTexture)
2241  {
2242  // Draw smoother
2243  DrawSmoothOChunk(d, iToX, iToY, iChunkWidth, iChunkHeight, left, leftBkg, 3 + flat, (iX << 16) + iY);
2244  }
2245  // Same texture-material on right
2246  if (iX < iMapWidth - 1 && right == iTexture)
2247  {
2248  // Draw smoother
2249  DrawSmoothOChunk(d, iToX, iToY, iChunkWidth, iChunkHeight, right, rightBkg, 0 + flat, (iX << 16) + iY);
2250  }
2251  }
2252  // Smooth chunk & same texture-material above
2253  if (iY > 0 && above == iTexture)
2254  {
2255  // Same texture-material on left
2256  if (iX > 0 && left == iTexture)
2257  {
2258  // Draw smoother
2259  DrawSmoothOChunk(d, iToX, iToY, iChunkWidth, iChunkHeight, left, leftBkg, 2 + flat, (iX << 16) + iY);
2260  }
2261  // Same texture-material on right
2262  if (iX < iMapWidth - 1 && right == iTexture)
2263  {
2264  // Draw smoother
2265  DrawSmoothOChunk(d, iToX, iToY, iChunkWidth, iChunkHeight, right, rightBkg, 1 + flat, (iX << 16) + iY);
2266  }
2267  }
2268  }
2269  }
2270  }
2271  // Draw custom shapes on top of regular materials
2272  if (shape && !::Game.C4S.Landscape.FlatChunkShapes) shape->Draw(sfcMap, sfcMapBkg, iMapX, iMapY, iMapWdt, iMapHgt, iTexture, iOffX, iOffY, MapZoom, pMaterial->MinShapeOverlap);
2273 }
class C4TextureShape * GetMaterialShape() const
Definition: C4Texture.h:40
C4Game Game
Definition: C4Globals.cpp:52
void Draw(const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, uint8_t iTexture, int32_t iOffX, int32_t iOffY, int32_t MapZoom, int32_t min_overlap_ratio)
C4Material * GetMaterial() const
Definition: C4Texture.h:63
C4Scenario C4S
Definition: C4Game.h:74
C4SLandscape Landscape
Definition: C4Scenario.h:236
C4MaterialCoreShape
Definition: C4Material.h:71
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
int32_t MinShapeOverlap
Definition: C4Material.h:137
Definition: C4Texture.h:48
const C4TexMapEntry * GetEntry(int32_t iIndex) const
Definition: C4Texture.h:85
const char * GetTextureName() const
Definition: C4Texture.h:61
BYTE GetPix(int iX, int iY) const
Definition: CSurface8.h:49
void DrawChunk(C4Landscape *, int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, uint8_t mcol, uint8_t mcolBkg, C4MaterialCoreShape Shape, uint32_t cro)
bool FlatChunkShapes
Definition: C4Scenario.h:188
const char * GetTexture(int32_t iIndex)
Definition: C4Texture.cpp:494
C4MaterialCoreShape MapChunkType
Definition: C4Material.h:91
BYTE _GetPix(int x, int y) const
Definition: CSurface8.h:54
void DrawSmoothOChunk(C4Landscape *, int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, uint8_t mcol, uint8_t mcolBkg, int flip, uint32_t cro)
void GetSurfaceSize(int &irX, int &irY) const
Definition: CSurface8.cpp:195
Here is the call graph for this function:

◆ ChunkyRandom()

uint32_t C4Landscape::P::ChunkyRandom ( uint32_t &  iOffset,
uint32_t  iRange 
) const

Definition at line 2113 of file C4Landscape.cpp.

2114 {
2115  if (!iRange) return 0;
2116  iOffset = (iOffset * 16807) % 2147483647;
2117  return (iOffset ^ MapSeed) % iRange;
2118 }

◆ ClearMatCount()

void C4Landscape::P::ClearMatCount ( )

Definition at line 1927 of file C4Landscape.cpp.

1928 {
1929  std::fill(MatCount.begin(), MatCount.end(), 0);
1930  std::fill(EffectiveMatCount.begin(), EffectiveMatCount.end(), 0);
1931 }
std::array< DWORD, C4MaxMaterial > MatCount
Definition: C4Landscape.cpp:71
std::array< DWORD, C4MaxMaterial > EffectiveMatCount
Definition: C4Landscape.cpp:72

◆ CreateDefaultBkgSurface()

std::unique_ptr< CSurface8 > C4Landscape::P::CreateDefaultBkgSurface ( CSurface8 sfcFg,
bool  msbAsIft 
) const

Definition at line 1097 of file C4Landscape.cpp.

References CSurface8::_GetPix(), CSurface8::_SetPix(), CSurface8::Hgt, and CSurface8::Wdt.

1098 {
1099  auto sfcBg = std::make_unique<CSurface8>();
1100  if (!sfcBg->Create(sfcFg.Wdt, sfcFg.Hgt))
1101  {
1102  return nullptr;
1103  }
1104 
1105  for (int32_t y = 0; y < sfcFg.Hgt; ++y)
1106  {
1107  for (int32_t x = 0; x < sfcFg.Wdt; ++x)
1108  {
1109  BYTE fgPix = sfcFg._GetPix(x, y);
1110  BYTE bgPix;
1111 
1112  // If we treat the most significant bit as the IFT flag
1113  // (compatibility option for pre-7.0 maps), then set
1114  // the background pixel to 0 if the foreground does not
1115  // have IFT set, and remove the IFT flag from the
1116  // foreground pixel.
1117  if (msbAsIft)
1118  {
1119  if (fgPix & 0x80)
1120  {
1121  fgPix &= ~0x80;
1122  sfcFg._SetPix(x, y, fgPix);
1123  bgPix = DefaultBkgMat(fgPix);
1124  }
1125  else
1126  {
1127  bgPix = 0;
1128  }
1129  }
1130  else
1131  {
1132  bgPix = DefaultBkgMat(fgPix);
1133  }
1134 
1135  sfcBg->_SetPix(x, y, bgPix);
1136  }
1137  }
1138 
1139  return sfcBg;
1140 }
int Hgt
Definition: CSurface8.h:28
uint8_t BYTE
BYTE DefaultBkgMat(BYTE fg) const
void _SetPix(int iX, int iY, BYTE byCol)
Definition: CSurface8.h:44
int Wdt
Definition: CSurface8.h:28
BYTE _GetPix(int x, int y) const
Definition: CSurface8.h:54
Here is the call graph for this function:

◆ CreateMap()

bool C4Landscape::P::CreateMap ( CSurface8 *&  sfcMap,
CSurface8 *&  sfcMapBkg 
)

Definition at line 2400 of file C4Landscape.cpp.

References C4Game::C4S, C4MapCreator::Create(), Game, C4SLandscape::GetMapSize(), C4Scenario::Landscape, C4Game::StartupPlayerCount, and TextureMap.

2401 {
2402  int32_t iWidth = 0, iHeight = 0;
2403 
2404  // Create map surface
2405  Game.C4S.Landscape.GetMapSize(iWidth, iHeight, Game.StartupPlayerCount);
2406  auto fg_map = std::make_unique<CSurface8>(iWidth, iHeight);
2407 
2408  // Fill sfcMap
2409  C4MapCreator MapCreator;
2410  MapCreator.Create(fg_map.get(),
2413 
2414  auto bg_map = CreateDefaultBkgSurface(*fg_map, false);
2415  if (!bg_map)
2416  return false;
2417 
2418  sfcMap = fg_map.release();
2419  sfcMapBkg = bg_map.release();
2420  return true;
2421 }
C4Game Game
Definition: C4Globals.cpp:52
C4Scenario C4S
Definition: C4Game.h:74
void GetMapSize(int32_t &rWdt, int32_t &rHgt, int32_t iPlayerNum)
Definition: C4Scenario.cpp:319
C4SLandscape Landscape
Definition: C4Scenario.h:236
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
std::unique_ptr< CSurface8 > CreateDefaultBkgSurface(CSurface8 &sfcFg, bool msbAsIft) const
void Create(CSurface8 *sfcMap, C4SLandscape &rLScape, C4TextureMap &rTexMap, int32_t iPlayerNum=1)
Definition: C4Map.cpp:78
int32_t StartupPlayerCount
Definition: C4Game.h:109
Here is the call graph for this function:

◆ CreateMapS2()

bool C4Landscape::P::CreateMapS2 ( C4Group ScenFile,
CSurface8 *&  sfcMap,
CSurface8 *&  sfcMapBkg 
)

Definition at line 2423 of file C4Landscape.cpp.

References C4Group::AccessEntry(), C4CFN_DynLandscape, C4Game::C4S, Game, C4Scenario::Landscape, MaterialMap, C4Game::StartupPlayerCount, and TextureMap.

2424 {
2425  // file present?
2426  if (!ScenFile.AccessEntry(C4CFN_DynLandscape)) return false;
2427 
2428  // create map creator
2429  if (!pMapCreator)
2430  pMapCreator = std::make_unique<C4MapCreatorS2>(&Game.C4S.Landscape, &::TextureMap, &::MaterialMap, Game.StartupPlayerCount);
2431 
2432  // read file
2433  pMapCreator->ReadFile(C4CFN_DynLandscape, &ScenFile);
2434  // render landscape
2435  if (!pMapCreator->Render(nullptr, sfcMap, sfcMapBkg))
2436  return false;
2437 
2438  // keep map creator until script callbacks have been done
2439  return true;
2440 }
C4Game Game
Definition: C4Globals.cpp:52
bool AccessEntry(const char *szWildCard, size_t *iSize=nullptr, char *sFileName=nullptr, bool NeedsToBeAGroup=false)
Definition: C4Group.cpp:1695
C4Scenario C4S
Definition: C4Game.h:74
#define C4CFN_DynLandscape
Definition: C4Components.h:115
C4SLandscape Landscape
Definition: C4Scenario.h:236
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
int32_t StartupPlayerCount
Definition: C4Game.h:109
std::unique_ptr< C4MapCreatorS2 > pMapCreator
Definition: C4Landscape.cpp:80
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
Here is the call graph for this function:

◆ DefaultBkgMat()

BYTE C4Landscape::P::DefaultBkgMat ( BYTE  fg) const

Definition at line 1092 of file C4Landscape.cpp.

References C4TextureMap::DefaultBkgMatTex(), and TextureMap.

1093 {
1095 }
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
BYTE DefaultBkgMatTex(BYTE fg) const
Definition: C4Texture.cpp:504
Here is the call graph for this function:

◆ DigFreePix()

bool C4Landscape::P::DigFreePix ( C4Landscape d,
int32_t  tx,
int32_t  ty 
)

Definition at line 719 of file C4Landscape.cpp.

References C4Landscape::CheckInstabilityRange(), C4Landscape::ClearPix(), C4MaterialCore::DigFree, C4Landscape::GetMat(), C4MaterialMap::Map, MaterialMap, and MatValid().

720 {
721  int32_t mat = d->GetMat(tx, ty);
722  if (MatValid(mat))
723  if (::MaterialMap.Map[mat].DigFree)
724  {
725  d->ClearPix(tx, ty);
726  // check for instable materials to start moving by the cleared space
727  d->CheckInstabilityRange(tx, ty);
728  return true;
729  }
730  return false;
731 }
C4Material * Map
Definition: C4Material.h:169
void CheckInstabilityRange(int32_t tx, int32_t ty)
int32_t GetMat(int32_t x, int32_t y) const
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
bool ClearPix(int32_t tx, int32_t ty)
bool MatValid(int32_t mat)
Definition: C4Material.h:210
int32_t DigFree
Definition: C4Material.h:94
Here is the call graph for this function:

◆ DigFreePixNoInstability()

bool C4Landscape::P::DigFreePixNoInstability ( C4Landscape d,
int32_t  tx,
int32_t  ty 
)

Definition at line 707 of file C4Landscape.cpp.

References C4Landscape::ClearPix(), C4MaterialCore::DigFree, C4Landscape::GetMat(), C4MaterialMap::Map, MaterialMap, and MatValid().

708 {
709  int32_t mat = d->GetMat(tx, ty);
710  if (MatValid(mat))
711  if (::MaterialMap.Map[mat].DigFree)
712  {
713  d->ClearPix(tx, ty);
714  return true;
715  }
716  return false;
717 }
C4Material * Map
Definition: C4Material.h:169
int32_t GetMat(int32_t x, int32_t y) const
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
bool ClearPix(int32_t tx, int32_t ty)
bool MatValid(int32_t mat)
Definition: C4Material.h:210
int32_t DigFree
Definition: C4Material.h:94
Here is the call graph for this function:

◆ DigMaterial2Objects()

void C4Landscape::P::DigMaterial2Objects ( int32_t  tx,
int32_t  ty,
C4MaterialList mat_list,
C4Object pCollect = nullptr 
)

Definition at line 667 of file C4Landscape.cpp.

References C4MaterialList::Amount, C4Object::AssignRemoval(), C4VObj(), C4PropList::Call(), C4Object::Collect(), C4Object::Contained, C4Object::Controller, C4Game::CreateObject(), C4MaterialCore::Dig2Object, C4MaterialCore::Dig2ObjectCollect, C4MaterialCore::Dig2ObjectRatio, Game, C4MaterialMap::Map, MaterialMap, NO_OWNER, C4ID::None, C4MaterialMap::Num, PSF_DigOutObject, PSF_OnDugOut, and C4PropList::Status.

668 {
669  C4AulParSet pars(pCollect);
670  for (int32_t mat = 0; mat < ::MaterialMap.Num; mat++)
671  {
672  if (mat_list->Amount[mat])
673  {
674  if (::MaterialMap.Map[mat].Dig2Object != C4ID::None)
675  if (::MaterialMap.Map[mat].Dig2ObjectRatio != 0)
676  while (mat_list->Amount[mat] >= ::MaterialMap.Map[mat].Dig2ObjectRatio)
677  {
678  mat_list->Amount[mat] -= ::MaterialMap.Map[mat].Dig2ObjectRatio;
679  C4Object *pObj = Game.CreateObject(::MaterialMap.Map[mat].Dig2Object, nullptr, NO_OWNER, tx, ty);
680  if (!pObj || !pObj->Status) continue;
681  // Set controller to the controller of the object responsible for digging out
682  if (pCollect && pCollect->Status)
683  pObj->Controller = pCollect->Controller;
684  // Do callbacks to dug object and digger
685  pObj->Call(PSF_OnDugOut, &pars);
686  if (!pObj->Status || !pCollect || !pCollect->Status || pObj->Contained) continue;
687  C4AulParSet pars(C4VObj(pObj));
688  pCollect->Call(PSF_DigOutObject, &pars);
689  if (!pObj->Status || !pCollect->Status || pObj->Contained) continue;
690  // Try to collect object
691  if (::MaterialMap.Map[mat].Dig2ObjectCollect)
692  if (pCollect && pCollect->Status && pObj && pObj->Status)
693  if (!pCollect->Collect(pObj))
694  // Collection forced? Don't generate objects
695  if (::MaterialMap.Map[mat].Dig2ObjectCollect == 2)
696  {
697  pObj->AssignRemoval();
698  // Cap so we never have more than one object worth of material in the store
699  mat_list->Amount[mat] = ::MaterialMap.Map[mat].Dig2ObjectRatio;
700  break;
701  }
702  }
703  }
704  }
705 }
C4Game Game
Definition: C4Globals.cpp:52
C4Material * Map
Definition: C4Material.h:169
C4Value C4VObj(C4Object *pObj)
Definition: C4Value.cpp:88
int32_t Dig2ObjectCollect
Definition: C4Material.h:98
static const C4ID None
Definition: C4Id.h:39
void AssignRemoval(bool fExitContents=false)
Definition: C4Object.cpp:255
const int NO_OWNER
Definition: C4Constants.h:137
int32_t Num
Definition: C4Material.h:168
int32_t Status
Definition: C4PropList.h:168
bool Collect(C4Object *pObj)
Definition: C4Object.cpp:4174
int32_t Dig2ObjectRatio
Definition: C4Material.h:97
int32_t Amount[C4MaxMaterial]
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
C4ObjectPtr Contained
Definition: C4Object.h:144
int32_t Controller
Definition: C4Object.h:111
#define PSF_OnDugOut
Definition: C4GameScript.h:100
#define PSF_DigOutObject
Definition: C4GameScript.h:99
C4Object * CreateObject(C4PropList *type, C4Object *pCreator, int32_t owner=NO_OWNER, int32_t x=50, int32_t y=50, int32_t r=0, bool grow_from_center=false, C4Real xdir=Fix0, C4Real ydir=Fix0, C4Real rdir=Fix0, int32_t iController=NO_OWNER)
Definition: C4Game.cpp:1072
C4Value Call(C4PropertyName k, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
Definition: C4PropList.h:110
Here is the call graph for this function:

◆ DoScan()

int32_t C4Landscape::P::DoScan ( C4Landscape d,
int32_t  x,
int32_t  y,
int32_t  mat,
int32_t  dir 
)

Definition at line 270 of file C4Landscape.cpp.

References C4Landscape::_GetMat(), C4Landscape::_GetPix(), C4MaterialCore::AboveTempConvert, C4MaterialCore::AboveTempConvertDir, C4Material::AboveTempConvertTo, Abs(), AddDbgRec(), C4MaterialCore::BelowTempConvert, C4MaterialCore::BelowTempConvertDir, C4Material::BelowTempConvertTo, C4Landscape::CheckInstabilityRange(), Config, C4ConfigGeneral::DebugRec, DEBUGREC_MATSCAN, C4MaterialCore::Density, DensitySolid(), C4Config::General, C4TextureMap::GetEntry(), C4Landscape::GetHeight(), C4TexMapEntry::GetMaterialIndex(), C4Weather::GetTemperature(), C4Landscape::GetWidth(), Landscape, C4MaterialMap::Map, MaterialMap, MatTex2PixCol(), PixCol2Mat(), RCT_MatScanDo, C4Landscape::SetPix2(), C4MaterialCore::TempConvStrength, TextureMap, C4Landscape::Transparent, and Weather.

271 {
272  int32_t conv_to_tex = 0;
273  int32_t iTemperature = ::Weather.GetTemperature();
274  // Check below conv
275  if (::MaterialMap.Map[mat].BelowTempConvertDir == dir)
277  if (iTemperature< ::MaterialMap.Map[mat].BelowTempConvert)
278  conv_to_tex = ::MaterialMap.Map[mat].BelowTempConvertTo;
279  // Check above conv
280  if (::MaterialMap.Map[mat].AboveTempConvertDir == dir)
282  if (iTemperature>::MaterialMap.Map[mat].AboveTempConvert)
283  conv_to_tex = ::MaterialMap.Map[mat].AboveTempConvertTo;
284  // nothing to do?
285  if (!conv_to_tex) return 0;
286  // find material
287  int32_t conv_to = ::TextureMap.GetEntry(conv_to_tex)->GetMaterialIndex();
288  // find mat top
289  int32_t mconv = ::MaterialMap.Map[mat].TempConvStrength,
290  mconvs = mconv;
292  {
293  C4RCMatScan rc = { cx, cy, mat, conv_to, dir, mconvs };
294  AddDbgRec(RCT_MatScanDo, &rc, sizeof(C4RCMatScan));
295  }
296  int32_t ydir = (dir == 0 ? +1 : -1), cy2;
297 #ifdef PRETTY_TEMP_CONV
298  // get left pixel
299  int32_t lmat = (cx > 0 ? d->_GetMat(cx - 1, cy) : -1);
300  // left pixel not converted? do nothing
301  if (lmat == mat) return 0;
302  // left pixel converted? suppose it was done by a prior scan and skip check
303  if (lmat != conv_to)
304  {
305  int32_t iSearchRange = std::max<int32_t>(5, mconvs);
306  // search upper/lower bound
307  int32_t cys = cy, cxs = cx;
308  while (cxs < ::Landscape.GetWidth() - 1)
309  {
310  // one step right
311  cxs++;
312  if (d->_GetMat(cxs, cys) == mat)
313  {
314  // search surface
315  cys -= ydir;
316  while (Inside<int32_t>(cys, 0, ::Landscape.GetHeight() - 1) && d->_GetMat(cxs, cys) == mat)
317  {
318  cys -= ydir;
319  if ((mconvs = std::min(mconv - Abs(cys - cy), mconvs)) < 0)
320  return 0;
321  }
322  // out of bounds?
323  if (!Inside<int32_t>(cys, 0, ::Landscape.GetHeight() - 1)) break;
324  // back one step
325  cys += ydir;
326  }
327  else
328  {
329  // search surface
330  cys += ydir;
331  while (Inside<int32_t>(cys, 0, ::Landscape.GetHeight() - 1) && d->_GetMat(cxs, cys) != mat)
332  {
333  cys += ydir;
334  if (Abs(cys - cy) > iSearchRange)
335  break;
336  }
337  // out of bounds?
338  if (!Inside<int32_t>(cys, 0, ::Landscape.GetHeight() - 1)) break;
339  if (Abs(cys - cy) > iSearchRange) break;
340  }
341  }
342  }
343 #endif
344  // Conversion
345  bool conv_to_is_solid = (conv_to > -1) && DensitySolid(::MaterialMap.Map[conv_to].Density);
346  for (cy2 = cy; mconvs >= 0 && Inside<int32_t>(cy2, 0, ::Landscape.GetHeight() - 1); cy2 += ydir, mconvs--)
347  {
348  // material changed?
349  int32_t pix = d->_GetPix(cx, cy2);
350  if (PixCol2Mat(pix) != mat) break;
351 #ifdef PRETTY_TEMP_CONV
352  // get left pixel
353  int32_t lmat = (cx > 0 ? d->_GetMat(cx - 1, cy2) : -1);
354  // left pixel not converted? break
355  if (lmat == mat) break;
356 #endif
357  // set mat (and keep background material)
358  d->SetPix2(cx, cy2, MatTex2PixCol(conv_to_tex), Transparent);
359  if (!conv_to_is_solid) d->CheckInstabilityRange(cx, cy2);
360  }
361  // return pixel converted
362  return Abs(cy2 - cy);
363 }
constexpr bool DEBUGREC_MATSCAN
Definition: C4Include.h:33
C4Config Config
Definition: C4Config.cpp:833
C4ConfigGeneral General
Definition: C4Config.h:251
C4Material * Map
Definition: C4Material.h:169
int32_t PixCol2Mat(BYTE pixc)
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
const C4TexMapEntry * GetEntry(int32_t iIndex) const
Definition: C4Texture.h:85
int32_t AboveTempConvert
Definition: C4Material.h:126
C4Landscape Landscape
void CheckInstabilityRange(int32_t tx, int32_t ty)
int32_t AboveTempConvertDir
Definition: C4Material.h:127
int32_t GetTemperature()
Definition: C4Weather.cpp:100
int32_t AboveTempConvertTo
Definition: C4Material.h:154
void AddDbgRec(C4RecordChunkType eType, const void *pData, int iSize)
Definition: C4Record.cpp:32
C4Weather Weather
Definition: C4Weather.cpp:206
bool SetPix2(int32_t x, int32_t y, BYTE fgPix, BYTE bgPix)
int32_t Density
Definition: C4Material.h:92
int32_t GetHeight() const
int32_t BelowTempConvertTo
Definition: C4Material.h:153
int32_t BelowTempConvert
Definition: C4Material.h:123
int32_t GetWidth() const
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
BYTE _GetPix(int32_t x, int32_t y) const
int32_t DebugRec
Definition: C4Config.h:60
int32_t TempConvStrength
Definition: C4Material.h:129
T Abs(T val)
Definition: Standard.h:42
int32_t _GetMat(int32_t x, int32_t y) const
BYTE MatTex2PixCol(int32_t tex)
Definition: C4Material.h:230
static const uint8_t Transparent
Definition: C4Landscape.h:50
bool DensitySolid(int32_t dens)
Definition: C4Landscape.h:196
int32_t GetMaterialIndex() const
Definition: C4Texture.h:62
int32_t BelowTempConvertDir
Definition: C4Material.h:124
Here is the call graph for this function:

◆ DrawChunk()

void C4Landscape::P::DrawChunk ( C4Landscape d,
int32_t  tx,
int32_t  ty,
int32_t  wdt,
int32_t  hgt,
uint8_t  mcol,
uint8_t  mcolBkg,
C4MaterialCoreShape  Shape,
uint32_t  cro 
)

Definition at line 2120 of file C4Landscape.cpp.

References C4M_Flat, C4M_Octagon, C4M_Rough, C4M_Smooth, C4M_Smoother, C4M_TopFlat, and C4Landscape::Transparent.

2121 {
2122  unsigned int top_rough = 0, side_rough = 0, bottom_rough = 0;
2123  // what to do?
2124  switch (Shape)
2125  {
2126  case C4M_Flat: case C4M_Octagon:
2127  if (mcol != Transparent) Surface8->Box(tx, ty, tx + wdt, ty + hgt, mcol);
2128  if (mcolBkg != Transparent) Surface8Bkg->Box(tx, ty, tx + wdt, ty + hgt, mcolBkg);
2129  return;
2130  case C4M_TopFlat:
2131  top_rough = 0; side_rough = 2; bottom_rough = 4;
2132  break;
2133  case C4M_Smooth:
2134  top_rough = 2; side_rough = 2; bottom_rough = 2;
2135  break;
2136  case C4M_Rough:
2137  top_rough = 4; side_rough = 4; bottom_rough = 4;
2138  break;
2139  case C4M_Smoother:
2140  top_rough = 1; side_rough = 1; bottom_rough = 1;
2141  break;
2142  }
2143  int vtcs[16];
2144  unsigned int rx = std::max(wdt / 2, 1);
2145 
2146  vtcs[0] = tx - ChunkyRandom(cro, rx * side_rough / 4); vtcs[1] = ty - ChunkyRandom(cro, rx * top_rough / 4);
2147  vtcs[2] = tx - ChunkyRandom(cro, rx * side_rough / 2); vtcs[3] = ty + hgt / 2;
2148  vtcs[4] = tx - ChunkyRandom(cro, rx * side_rough / 4); vtcs[5] = ty + hgt + ChunkyRandom(cro, rx * bottom_rough / 4);
2149  vtcs[6] = tx + wdt / 2; vtcs[7] = ty + hgt + ChunkyRandom(cro, rx * bottom_rough / 2);
2150  vtcs[8] = tx + wdt + ChunkyRandom(cro, rx * side_rough / 4); vtcs[9] = ty + hgt + ChunkyRandom(cro, rx * bottom_rough / 4);
2151  vtcs[10] = tx + wdt + ChunkyRandom(cro, rx * side_rough / 2); vtcs[11] = ty + hgt / 2;
2152  vtcs[12] = tx + wdt + ChunkyRandom(cro, rx * side_rough / 4); vtcs[13] = ty - ChunkyRandom(cro, rx * top_rough / 4);
2153  vtcs[14] = tx + wdt / 2; vtcs[15] = ty - ChunkyRandom(cro, rx * top_rough / 2);
2154 
2155  ForPolygon(d, vtcs, 8, nullptr, nullptr, mcol, mcolBkg);
2156 }
std::unique_ptr< CSurface8 > Surface8
Definition: C4Landscape.cpp:54
int32_t ForPolygon(C4Landscape *d, int *vtcs, int length, const std::function< bool(int32_t, int32_t)> &callback, C4MaterialList *mats_count=nullptr, uint8_t col=0, uint8_t colBkg=0, uint8_t *conversion_table=nullptr)
std::unique_ptr< CSurface8 > Surface8Bkg
Definition: C4Landscape.cpp:55
static const uint8_t Transparent
Definition: C4Landscape.h:50
uint32_t ChunkyRandom(uint32_t &iOffset, uint32_t iRange) const

◆ DrawLineLandscape()

bool C4Landscape::P::DrawLineLandscape ( int32_t  iX,
int32_t  iY,
int32_t  iGrade,
uint8_t  line_color,
uint8_t  line_color_bkg 
)

Definition at line 3465 of file C4Landscape.cpp.

3466 {
3467  Surface8->Circle(iX, iY, iGrade, line_color);
3468  Surface8Bkg->Circle(iX, iY, iGrade, line_color_bkg);
3469  return true;
3470 }
std::unique_ptr< CSurface8 > Surface8
Definition: C4Landscape.cpp:54
std::unique_ptr< CSurface8 > Surface8Bkg
Definition: C4Landscape.cpp:55

◆ DrawLineMap()

bool C4Landscape::P::DrawLineMap ( int32_t  iX,
int32_t  iY,
int32_t  iRadius,
uint8_t  line_color,
uint8_t  line_color_bkg 
)

Definition at line 3472 of file C4Landscape.cpp.

3473 {
3474  if (!Map) return false;
3475  if (iRadius == 1)
3476  {
3477  Map->SetPix(iX, iY, line_color); MapBkg->SetPix(iX, iY, line_color_bkg);
3478  }
3479  else
3480  {
3481  Map->Circle(iX, iY, iRadius, line_color); MapBkg->Circle(iX, iY, iRadius, line_color_bkg);
3482  }
3483  return true;
3484 }
std::unique_ptr< CSurface8 > Map
Definition: C4Landscape.cpp:56
std::unique_ptr< CSurface8 > MapBkg
Definition: C4Landscape.cpp:57

◆ DrawSmoothOChunk()

void C4Landscape::P::DrawSmoothOChunk ( C4Landscape d,
int32_t  tx,
int32_t  ty,
int32_t  wdt,
int32_t  hgt,
uint8_t  mcol,
uint8_t  mcolBkg,
int  flip,
uint32_t  cro 
)

Definition at line 2158 of file C4Landscape.cpp.

2159 {
2160  int vtcs[8];
2161  unsigned int rx = std::max(wdt / 2, 1);
2162 
2163  vtcs[0] = tx; vtcs[1] = ty;
2164  vtcs[2] = tx; vtcs[3] = ty + hgt;
2165  vtcs[4] = tx + wdt; vtcs[5] = ty + hgt;
2166  vtcs[6] = tx + wdt; vtcs[7] = ty;
2167 
2168  switch (flip)
2169  {
2170  case 0: vtcs[0] = tx + wdt / 2; vtcs[1] += hgt / 3; vtcs[7] -= ChunkyRandom(cro, rx / 2); break;
2171  case 1: vtcs[2] = tx + wdt / 2; vtcs[3] -= hgt / 3; vtcs[5] += ChunkyRandom(cro, rx / 2); break;
2172  case 2: vtcs[4] = tx + wdt / 2; vtcs[5] -= hgt / 3; vtcs[3] += ChunkyRandom(cro, rx / 2); break;
2173  case 3: vtcs[6] = tx + wdt / 2; vtcs[7] += hgt / 3; vtcs[1] -= ChunkyRandom(cro, rx / 2); break;
2174  case 4: vtcs[0] = tx + wdt / 2; vtcs[1] += hgt / 2; break;
2175  case 5: vtcs[2] = tx + wdt / 2; vtcs[3] -= hgt / 2; break;
2176  case 6: vtcs[4] = tx + wdt / 2; vtcs[5] -= hgt / 2; break;
2177  case 7: vtcs[6] = tx + wdt / 2; vtcs[7] += hgt / 2; break;
2178  }
2179 
2180  ForPolygon(d, vtcs, 4, nullptr, nullptr, mcol, mcolBkg);
2181 }
int32_t ForPolygon(C4Landscape *d, int *vtcs, int length, const std::function< bool(int32_t, int32_t)> &callback, C4MaterialList *mats_count=nullptr, uint8_t col=0, uint8_t colBkg=0, uint8_t *conversion_table=nullptr)
uint32_t ChunkyRandom(uint32_t &iOffset, uint32_t iRange) const

◆ ExecuteScan()

void C4Landscape::P::ExecuteScan ( C4Landscape d)

Definition at line 216 of file C4Landscape.cpp.

References C4Landscape::_GetMat(), C4MaterialCore::AboveTempConvert, C4Material::AboveTempConvertTo, AddDbgRec(), C4MaterialCore::BelowTempConvert, C4Material::BelowTempConvertTo, Config, C4ConfigGeneral::DebugRec, DEBUGREC_MATSCAN, C4Config::General, C4Weather::GetTemperature(), C4MaterialMap::Map, MaterialMap, C4MaterialMap::Num, RCT_MatScan, and Weather.

217 {
218  int32_t cy, mat;
219 
220  // Check: Scan needed?
221  const int32_t iTemperature = ::Weather.GetTemperature();
222  for (mat = 0; mat < ::MaterialMap.Num; mat++)
223  if (MatCount[mat])
224  {
225  if (::MaterialMap.Map[mat].BelowTempConvertTo &&
226  iTemperature < ::MaterialMap.Map[mat].BelowTempConvert)
227  break;
228  else if (::MaterialMap.Map[mat].AboveTempConvertTo &&
229  iTemperature > ::MaterialMap.Map[mat].AboveTempConvert)
230  break;
231  }
232  if (mat >= ::MaterialMap.Num)
233  return;
234 
236  AddDbgRec(RCT_MatScan, &ScanX, sizeof(ScanX));
237 
238  for (int32_t cnt = 0; cnt < ScanSpeed; cnt++)
239  {
240 
241  // Scan landscape column: sectors down
242  int32_t last_mat = -1;
243  for (cy = 0; cy < Height; cy++)
244  {
245  mat = d->_GetMat(ScanX, cy);
246  // material change?
247  if (last_mat != mat)
248  {
249  // upwards
250  if (last_mat != -1)
251  DoScan(d, ScanX, cy - 1, last_mat, 1);
252  // downwards
253  if (mat != -1)
254  cy += DoScan(d, ScanX, cy, mat, 0);
255  }
256  last_mat = mat;
257  }
258 
259  // Scan advance & rewind
260  ScanX++;
261  if (ScanX >= Width)
262  ScanX = 0;
263 
264  }
265 
266 }
std::array< DWORD, C4MaxMaterial > MatCount
Definition: C4Landscape.cpp:71
constexpr bool DEBUGREC_MATSCAN
Definition: C4Include.h:33
int32_t DoScan(C4Landscape *, int32_t x, int32_t y, int32_t mat, int32_t dir)
C4Config Config
Definition: C4Config.cpp:833
C4ConfigGeneral General
Definition: C4Config.h:251
C4Material * Map
Definition: C4Material.h:169
int32_t AboveTempConvert
Definition: C4Material.h:126
int32_t GetTemperature()
Definition: C4Weather.cpp:100
int32_t AboveTempConvertTo
Definition: C4Material.h:154
void AddDbgRec(C4RecordChunkType eType, const void *pData, int iSize)
Definition: C4Record.cpp:32
C4Weather Weather
Definition: C4Weather.cpp:206
int32_t Num
Definition: C4Material.h:168
int32_t BelowTempConvertTo
Definition: C4Material.h:153
int32_t BelowTempConvert
Definition: C4Material.h:123
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
int32_t DebugRec
Definition: C4Config.h:60
int32_t _GetMat(int32_t x, int32_t y) const
int32_t ScanSpeed
Definition: C4Landscape.cpp:75
Here is the call graph for this function:

◆ FinishChange()

void C4Landscape::P::FinishChange ( C4Landscape d,
C4Rect  BoundingBox 
)

Definition at line 3921 of file C4Landscape.cpp.

References C4SolidMask::CheckConsistency(), C4SolidMask::First, C4Rect::Hgt, C4Rect::Intersect(), C4SolidMask::Next, and C4Rect::Wdt.

3922 {
3923  // Intersect bounding box with landscape
3924  BoundingBox.Intersect(C4Rect(0, 0, Width, Height));
3925  if (!BoundingBox.Wdt || !BoundingBox.Hgt) return;
3926  // update render
3927  if (pLandscapeRender)
3928  pLandscapeRender->Update(BoundingBox, d);
3929  UpdateMatCnt(d, BoundingBox, true);
3930  // Restore Solidmasks
3931  C4Rect SolidMaskRect = BoundingBox;
3932  if (pLandscapeRender)
3933  SolidMaskRect = pLandscapeRender->GetAffectedRect(pLandscapeRender->GetAffectedRect(SolidMaskRect));
3934  for (C4SolidMask * pSolid = C4SolidMask::First; pSolid; pSolid = pSolid->Next)
3935  {
3936  pSolid->Repair(SolidMaskRect);
3937  }
3939  UpdatePixCnt(d, BoundingBox);
3940  // update FoW
3941  if (pFoW)
3942  {
3943  pFoW->Invalidate(BoundingBox);
3944  pFoW->Ambient.UpdateFromLandscape(*d, BoundingBox);
3945  }
3946 }
static bool CheckConsistency()
std::unique_ptr< C4FoW > pFoW
Definition: C4Landscape.cpp:84
Definition: C4Rect.h:27
void UpdateMatCnt(const C4Landscape *, C4Rect Rect, bool fPlus)
void Intersect(const C4Rect &r2)
Definition: C4Rect.cpp:100
int32_t Wdt
Definition: C4Rect.h:30
static C4SolidMask * First
Definition: C4SolidMask.h:72
std::unique_ptr< C4LandscapeRender > pLandscapeRender
Definition: C4Landscape.cpp:58
int32_t Hgt
Definition: C4Rect.h:30
void UpdatePixCnt(const C4Landscape *, const C4Rect &Rect, bool fCheck=false)
C4SolidMask * Next
Definition: C4SolidMask.h:75
Here is the call graph for this function:

◆ ForPolygon()

int32_t C4Landscape::P::ForPolygon ( C4Landscape d,
int *  vtcs,
int  length,
const std::function< bool(int32_t, int32_t)> &  callback,
C4MaterialList mats_count = nullptr,
uint8_t  col = 0,
uint8_t  colBkg = 0,
uint8_t *  conversion_table = nullptr 
)

Definition at line 1212 of file C4Landscape.cpp.

References C4ScriptGuiWindowPropertyName::bottom, QuickPolyBuf, C4ScriptGuiWindowPropertyName::top, and CPolyEdge::y.

1214 {
1215  // Variables for polygon drawer
1216  int c, x1, x2, y;
1217  int top = INT_MAX;
1218  int bottom = INT_MIN;
1219  int *i1, *i2;
1220  CPolyEdge *edge, *next_edge, *edgebuf;
1221  CPolyEdge *active_edges = nullptr;
1222  CPolyEdge *inactive_edges = nullptr;
1223  bool use_qpb = false;
1224 
1225  // Return value
1226  int32_t amount = 0;
1227  // Poly Buf
1228  if (length <= QuickPolyBufSize)
1229  {
1230  edgebuf = QuickPolyBuf; use_qpb = true;
1231  }
1232  else if (!(edgebuf = new CPolyEdge[length])) { return 0; }
1233 
1234  // Fill the edge table
1235  edge = edgebuf;
1236  i1 = vtcs;
1237  i2 = vtcs + (length - 1) * 2;
1238  for (c = 0; c < length; c++)
1239  {
1240  if (i1[1] != i2[1])
1241  {
1242  fill_edge_structure(edge, i1, i2);
1243  if (edge->bottom >= edge->y)
1244  {
1245  if (edge->y < top) top = edge->y;
1246  if (edge->bottom > bottom) bottom = edge->bottom;
1247  inactive_edges = add_edge(inactive_edges, edge, false);
1248  edge++;
1249  }
1250  }
1251  i2 = i1; i1 += 2;
1252  }
1253 
1254  // For each scanline in the polygon...
1255  for (c = top; c <= bottom; c++)
1256  {
1257  // Check for newly active edges
1258  edge = inactive_edges;
1259  while ((edge) && (edge->y == c))
1260  {
1261  next_edge = edge->next;
1262  inactive_edges = remove_edge(inactive_edges, edge);
1263  active_edges = add_edge(active_edges, edge, true);
1264  edge = next_edge;
1265  }
1266 
1267  // Draw horizontal line segments
1268  edge = active_edges;
1269  while ((edge) && (edge->next))
1270  {
1271  x1 = edge->x >> POLYGON_FIX_SHIFT;
1272  x2 = (edge->next->x + edge->next->w) >> POLYGON_FIX_SHIFT;
1273  y = c;
1274  // Fix coordinates
1275  if (x1 > x2) std::swap(x1, x2);
1276  // Set line
1277  if (callback)
1278  {
1279  for (int xcnt = x2 - x1 - 1; xcnt >= 0; xcnt--)
1280  {
1281  uint8_t pix = d->GetPix(x1 + xcnt, y);
1282  if (!conversion_table || conversion_table[pix])
1283  {
1284  int32_t mat = d->GetPixMat(pix);
1285  if (callback(x1 + xcnt, y))
1286  if (mats_count)
1287  {
1288  mats_count->Add(mat, 1);
1289  amount++;
1290  }
1291  }
1292  }
1293  }
1294  else if (conversion_table)
1295  for (int xcnt = x2 - x1 - 1; xcnt >= 0; xcnt--)
1296  {
1297  const uint8_t pix = conversion_table[uint8_t(d->GetPix(x1 + xcnt, y))];
1298  Surface8->SetPix(x1 + xcnt, y, pix);
1299  if (colBkg != Transparent) Surface8Bkg->SetPix(x1 + xcnt, y, colBkg);
1300  }
1301  else
1302  for (int xcnt = x2 - x1 - 1; xcnt >= 0; xcnt--)
1303  {
1304  if (col != Transparent) Surface8->SetPix(x1 + xcnt, y, col);
1305  if (colBkg != Transparent) Surface8Bkg->SetPix(x1 + xcnt, y, colBkg);
1306  }
1307  edge = edge->next->next;
1308  }
1309 
1310  // Update edges, sorting and removing dead ones
1311  edge = active_edges;
1312  while (edge)
1313  {
1314  next_edge = edge->next;
1315  if (c >= edge->bottom)
1316  {
1317  active_edges = remove_edge(active_edges, edge);
1318  }
1319  else
1320  {
1321  edge->x += edge->dx;
1322  while ((edge->prev) && (edge->x + edge->w / 2 < edge->prev->x + edge->prev->w / 2))
1323  {
1324  if (edge->next) edge->next->prev = edge->prev;
1325  edge->prev->next = edge->next;
1326  edge->next = edge->prev;
1327  edge->prev = edge->prev->prev;
1328  edge->next->prev = edge;
1329  if (edge->prev) edge->prev->next = edge;
1330  else active_edges = edge;
1331  }
1332  }
1333  edge = next_edge;
1334  }
1335  }
1336 
1337  // Clear scratch memory
1338  if (!use_qpb) delete[] edgebuf;
1339 
1340  return amount;
1341 }
std::unique_ptr< CSurface8 > Surface8
Definition: C4Landscape.cpp:54
struct CPolyEdge * prev
CPolyEdge QuickPolyBuf[QuickPolyBufSize]
struct CPolyEdge * next
std::unique_ptr< CSurface8 > Surface8Bkg
Definition: C4Landscape.cpp:55
int32_t GetPixMat(BYTE byPix) const
BYTE GetPix(int32_t x, int32_t y) const
const int QuickPolyBufSize
#define POLYGON_FIX_SHIFT
static const uint8_t Transparent
Definition: C4Landscape.h:50
void Add(int32_t iMaterial, int32_t iAmount)

◆ GetBridgeMatConversion()

uint8_t * C4Landscape::P::GetBridgeMatConversion ( const C4Landscape d,
int32_t  for_material_col 
) const

Definition at line 3858 of file C4Landscape.cpp.

References C4M_MaxTexIndex, C4Landscape::GetPixDensity(), C4Landscape::GetPixMat(), MatDensity(), MaterialMap, and C4MaterialMap::Num.

3859 {
3860  // safety
3861  int32_t for_material = d->GetPixMat(for_material_col);
3862  if (for_material < 0 || for_material >= MaterialMap.Num) return nullptr;
3863  // query map. create if not done yet
3864  if (!BridgeMatConversion[for_material_col])
3865  {
3866  auto conv_map = std::make_unique<uint8_t[]>(C4M_MaxTexIndex);
3867  for (int32_t i = 0; i < C4M_MaxTexIndex; ++i)
3868  {
3869  if ((MatDensity(for_material) >= d->GetPixDensity(i)))
3870  {
3871  // bridge pixel OK here. change pixel.
3872  conv_map[i] = for_material_col;
3873  }
3874  else
3875  {
3876  // bridge pixel not OK - keep current pixel
3877  conv_map[i] = i;
3878  }
3879  }
3880  BridgeMatConversion[for_material_col] = std::move(conv_map);
3881  }
3882  return BridgeMatConversion[for_material_col].get();
3883 }
int32_t GetPixDensity(BYTE byPix) const
int32_t MatDensity(int32_t mat)
Definition: C4Material.h:240
const int C4M_MaxTexIndex
Definition: C4Constants.h:51
int32_t Num
Definition: C4Material.h:168
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
int32_t GetPixMat(BYTE byPix) const
std::array< std::unique_ptr< uint8_t[]>, C4M_MaxTexIndex > BridgeMatConversion
Definition: C4Landscape.cpp:66
Here is the call graph for this function:

◆ GetMapColorIndex()

bool C4Landscape::P::GetMapColorIndex ( const char *  szMaterial,
const char *  szTexture,
BYTE rbyCol 
) const

Definition at line 3394 of file C4Landscape.cpp.

References C4TLS_MatSky, C4TextureMap::GetIndex(), SEqual(), and TextureMap.

3395 {
3396  // Sky
3397  if (SEqual(szMaterial, C4TLS_MatSky))
3398  rbyCol = 0;
3399  // Material-Texture
3400  else
3401  {
3402  rbyCol = ::TextureMap.GetIndex(szMaterial, szTexture);
3403  if (!rbyCol) return false;
3404  }
3405  // Found
3406  return true;
3407 }
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
bool SEqual(const char *szStr1, const char *szStr2)
Definition: Standard.h:93
int32_t GetIndex(const char *szMaterial, const char *szTexture, bool fAddIfNotExist=true, const char *szErrorIfFailed=nullptr)
Definition: C4Texture.cpp:414
#define C4TLS_MatSky
Definition: C4ToolsDlg.h:39
Here is the call graph for this function:

◆ InitBorderPix()

bool C4Landscape::P::InitBorderPix ( )

Definition at line 2020 of file C4Landscape.cpp.

References C4SLandscape::AutoScanSideOpen, C4SLandscape::BottomOpen, C4Game::C4S, Game, C4Scenario::Landscape, C4SLandscape::LeftOpen, MCVehic, C4SLandscape::RightOpen, C4SLandscape::TopOpen, CPolyEdge::x, and CPolyEdge::y.

2021 {
2022  assert(Width > 0);
2023  // Init Top-/BottomRowPix array, which determines if out-of-landscape pixels on top/bottom side of the map are solid or not
2024  // In case of Top-/BottomOpen=2, unit by map and not landscape to avoid runtime join sync losses
2025  if (!Width) return true;
2026  TopRowPix.clear();
2027  BottomRowPix.clear();
2028  LeftColPix.clear();
2029  RightColPix.clear();
2030  // must access Game.C4S here because Landscape.TopOpen / Landscape.BottomOpen may not be initialized yet
2031  // why is there a local copy of that static variable anyway?
2032  int32_t top_open_flag = Game.C4S.Landscape.TopOpen;
2033  int32_t bottom_open_flag = Game.C4S.Landscape.BottomOpen;
2034  if (top_open_flag == 2 && !Map) top_open_flag = 1;
2035  if (bottom_open_flag == 2 && !Map) bottom_open_flag = 1;
2036 
2037  // Init TopRowPix
2038  switch (top_open_flag)
2039  {
2040  // TopOpen=0: Top is closed
2041  case 0: TopRowPix.assign(Width, MCVehic); break;
2042  // TopOpen=2: Top is open when pixel below has sky background
2043  case 2:
2044  TopRowPix.resize(Width);
2045  for (int32_t x = 0; x < Width; ++x)
2046  {
2047  uint8_t map_pix = MapBkg->GetPix(x / MapZoom, 0);
2048  TopRowPix[x] = ((map_pix != 0) ? MCVehic : 0);
2049  }
2050  break;
2051  // TopOpen=1: Top is open
2052  default: TopRowPix.assign(Width, 0); break;
2053  }
2054 
2055  // Init BottomRowPix
2056  switch (bottom_open_flag)
2057  {
2058  // BottomOpen=0: Bottom is closed
2059  case 0: BottomRowPix.assign(Width, MCVehic); break;
2060  // BottomOpen=2: Bottom is open when pixel above has sky background
2061  case 2:
2062  BottomRowPix.resize(Width);
2063  for (int32_t x = 0; x < Width; ++x)
2064  {
2065  uint8_t map_pix = MapBkg->GetPix(x / MapZoom, Map->Hgt - 1);
2066  BottomRowPix[x] = ((map_pix != 0) ? MCVehic : 0);
2067  }
2068  break;
2069  // BottomOpen=1: Bottom is open
2070  default: BottomRowPix.assign(Width, 0); break;
2071  }
2072 
2074  {
2075  // Compatibility: check both foreground and background material per
2076  // default, Top/BottomOpen=2-like behavior with AutoScanSideOpen=2.
2077  bool only_bg = Game.C4S.Landscape.AutoScanSideOpen == 2;
2078  LeftColPix.resize(Height);
2079  RightColPix.resize(Height);
2080  uint8_t map_pix;
2081  for (int32_t y = 0; y < Height; ++y)
2082  {
2083  map_pix = MapBkg->GetPix(0, y / MapZoom);
2084  if (!only_bg) map_pix += Map->GetPix(0, y / MapZoom);
2085  LeftColPix[y] = ((map_pix != 0) ? MCVehic : 0);
2086  map_pix = MapBkg->GetPix(Map->Wdt - 1, y / MapZoom);
2087  if (!only_bg) map_pix += Map->GetPix(Map->Wdt - 1, y / MapZoom);
2088  RightColPix[y] = ((map_pix != 0) ? MCVehic : 0);
2089  }
2090  }
2091  else
2092  {
2093  int32_t LeftOpen = std::min(Height, Game.C4S.Landscape.LeftOpen);
2094  int32_t RightOpen = std::min(Height, Game.C4S.Landscape.RightOpen);
2095  LeftColPix.assign(Height, MCVehic);
2096  RightColPix.assign(Height, MCVehic);
2097  for (int32_t cy = 0; cy < LeftOpen; cy++)
2098  LeftColPix[cy] = 0;
2099  for (int32_t cy = 0; cy < RightOpen; cy++)
2100  RightColPix[cy] = 0;
2101  }
2102 
2103  return true;
2104 }
C4Game Game
Definition: C4Globals.cpp:52
C4Scenario C4S
Definition: C4Game.h:74
std::vector< uint8_t > RightColPix
Definition: C4Landscape.cpp:60
C4SLandscape Landscape
Definition: C4Scenario.h:236
std::unique_ptr< CSurface8 > Map
Definition: C4Landscape.cpp:56
int32_t TopOpen
Definition: C4Scenario.h:170
int32_t AutoScanSideOpen
Definition: C4Scenario.h:172
BYTE MCVehic
Definition: C4Material.cpp:37
int32_t BottomOpen
Definition: C4Scenario.h:170
std::vector< uint8_t > TopRowPix
Definition: C4Landscape.cpp:60
int32_t LeftOpen
Definition: C4Scenario.h:171
std::vector< uint8_t > LeftColPix
Definition: C4Landscape.cpp:60
int32_t RightOpen
Definition: C4Scenario.h:171
std::vector< uint8_t > BottomRowPix
Definition: C4Landscape.cpp:60
std::unique_ptr< CSurface8 > MapBkg
Definition: C4Landscape.cpp:57

◆ MapToLandscape()

bool C4Landscape::P::MapToLandscape ( C4Landscape d,
const CSurface8 sfcMap,
const CSurface8 sfcMapBkg,
int32_t  iMapX,
int32_t  iMapY,
int32_t  iMapWdt,
int32_t  iMapHgt,
int32_t  iOffsX = 0,
int32_t  iOffsY = 0,
bool  noClear = false 
)

Definition at line 2365 of file C4Landscape.cpp.

References CSurface8::GetSurfaceSize(), C4Rect::Hgt, C4Rect::Wdt, C4Rect::x, and C4Rect::y.

2366 {
2367  assert(Surface8 && Surface8Bkg);
2368  // Clip to map/landscape segment
2369  int iMapWidth, iMapHeight, iLandscapeWidth, iLandscapeHeight;
2370  // Get map & landscape size
2371  sfcMap.GetSurfaceSize(iMapWidth, iMapHeight);
2372  Surface8->GetSurfaceSize(iLandscapeWidth, iLandscapeHeight);
2373  // Clip map segment to map size
2374  iMapX = Clamp<int32_t>(iMapX, 0, iMapWidth - 1); iMapY = Clamp<int32_t>(iMapY, 0, iMapHeight - 1);
2375  iMapWdt = Clamp<int32_t>(iMapWdt, 0, iMapWidth - iMapX); iMapHgt = Clamp<int32_t>(iMapHgt, 0, iMapHeight - iMapY);
2376  // No segment
2377  if (!iMapWdt || !iMapHgt) return true;
2378 
2379  // Get affected landscape rect
2380  C4Rect To;
2381  To.x = iMapX*MapZoom + iOffsX;
2382  To.y = iMapY*MapZoom + iOffsY;
2383  To.Wdt = iMapWdt*MapZoom;
2384  To.Hgt = iMapHgt*MapZoom;
2385 
2386  PrepareChange(d, To);
2387 
2388  // clear the old landscape if not supressed
2389  if (!noClear)
2390  {
2391  Surface8->ClearBox8Only(To.x, To.y, To.Wdt, To.Hgt);
2392  Surface8Bkg->ClearBox8Only(To.x, To.y, To.Wdt, To.Hgt);
2393  }
2394 
2395  MapToSurface(d, sfcMap, sfcMapBkg, iMapX, iMapY, iMapWdt, iMapHgt, To.x, To.y, To.Wdt, To.Hgt, iOffsX, iOffsY);
2396  FinishChange(d, To);
2397  return true;
2398 }
std::unique_ptr< CSurface8 > Surface8
Definition: C4Landscape.cpp:54
bool MapToSurface(C4Landscape *, const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iToX, int32_t iToY, int32_t iToWdt, int32_t iToHgt, int32_t iOffX, int32_t iOffY)
Definition: C4Rect.h:27
int32_t Wdt
Definition: C4Rect.h:30
void PrepareChange(const C4Landscape *d, const C4Rect &BoundingBox)
int32_t y
Definition: C4Rect.h:30
int32_t x
Definition: C4Rect.h:30
std::unique_ptr< CSurface8 > Surface8Bkg
Definition: C4Landscape.cpp:55
int32_t Hgt
Definition: C4Rect.h:30
void FinishChange(C4Landscape *d, C4Rect BoundingBox)
void GetSurfaceSize(int &irX, int &irY) const
Definition: CSurface8.cpp:195
Here is the call graph for this function:

◆ MapToSurface()

bool C4Landscape::P::MapToSurface ( C4Landscape d,
const CSurface8 sfcMap,
const CSurface8 sfcMapBkg,
int32_t  iMapX,
int32_t  iMapY,
int32_t  iMapWdt,
int32_t  iMapHgt,
int32_t  iToX,
int32_t  iToY,
int32_t  iToWdt,
int32_t  iToHgt,
int32_t  iOffX,
int32_t  iOffY 
)

Definition at line 2337 of file C4Landscape.cpp.

References C4M_MaxTexIndex, MaterialMap, C4MaterialMap::max_shape_height, C4MaterialMap::max_shape_width, C4Draw::NoPrimaryClipper(), and pDraw.

2338 {
2339 
2340  // assign clipper
2341  Surface8->Clip(iToX, iToY, iToX + iToWdt - 1, iToY + iToHgt - 1);
2342  Surface8Bkg->Clip(iToX, iToY, iToX + iToWdt - 1, iToY + iToHgt - 1);
2344 
2345  // Enlarge map segment for chunky rim
2346  iMapX -= 2 + MaterialMap.max_shape_width / MapZoom;
2347  iMapY -= 2 + MaterialMap.max_shape_height / MapZoom;
2348  iMapWdt += 4 + MaterialMap.max_shape_width / MapZoom * 2;
2349  iMapHgt += 4 + MaterialMap.max_shape_height / MapZoom * 2;
2350 
2351  // Determine texture usage in map segment
2352  DWORD dwTexUsage[C4M_MaxTexIndex];
2353  if (!GetTexUsage(sfcMap, sfcMapBkg, iMapX, iMapY, iMapWdt, iMapHgt, dwTexUsage)) return false;
2354  // Texture zoom map to landscape
2355  if (!TexOZoom(d, sfcMap, sfcMapBkg, iMapX, iMapY, iMapWdt, iMapHgt, dwTexUsage, iOffX, iOffY)) return false;
2356 
2357  // remove clipper
2358  Surface8->NoClip();
2359  Surface8Bkg->NoClip();
2360 
2361  // success
2362  return true;
2363 }
std::unique_ptr< CSurface8 > Surface8
Definition: C4Landscape.cpp:54
int32_t max_shape_height
Definition: C4Material.h:171
bool TexOZoom(C4Landscape *, const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, DWORD *dwpTextureUsage, int32_t iToX=0, int32_t iToY=0)
const int C4M_MaxTexIndex
Definition: C4Constants.h:51
C4Draw * pDraw
Definition: C4Draw.cpp:42
std::unique_ptr< CSurface8 > Surface8Bkg
Definition: C4Landscape.cpp:55
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
int32_t max_shape_width
Definition: C4Material.h:171
bool NoPrimaryClipper()
Definition: C4Draw.cpp:237
uint32_t DWORD
Here is the call graph for this function:

◆ Mat2Pal()

bool C4Landscape::P::Mat2Pal ( )

Definition at line 4232 of file C4Landscape.cpp.

References C4M_MaxTexIndex, C4TextureMap::GetEntry(), C4TexMapEntry::GetPattern(), C4TexMapEntry::isNull(), MatTex2PixCol(), C4Pattern::PatternClr(), and TextureMap.

4233 {
4234  if (!Surface8 || !Surface8Bkg) return false;
4235  // set landscape pal
4236  int32_t tex;
4237  for (tex = 0; tex < C4M_MaxTexIndex; tex++)
4238  {
4239  const C4TexMapEntry *pTex = ::TextureMap.GetEntry(tex);
4240  if (!pTex || pTex->isNull())
4241  continue;
4242  // colors
4243  DWORD dwPix = pTex->GetPattern().PatternClr(0, 0);
4244  Surface8->pPal->Colors[MatTex2PixCol(tex)] = dwPix;
4245  Surface8Bkg->pPal->Colors[MatTex2PixCol(tex)] = dwPix;
4246  }
4247  // success
4248  return true;
4249 }
std::unique_ptr< CSurface8 > Surface8
Definition: C4Landscape.cpp:54
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
Definition: C4Texture.h:48
const C4TexMapEntry * GetEntry(int32_t iIndex) const
Definition: C4Texture.h:85
const int C4M_MaxTexIndex
Definition: C4Constants.h:51
DWORD PatternClr(unsigned int iX, unsigned int iY) const
Definition: C4Draw.cpp:159
std::unique_ptr< CSurface8 > Surface8Bkg
Definition: C4Landscape.cpp:55
bool isNull() const
Definition: C4Texture.h:59
const C4Pattern & GetPattern() const
Definition: C4Texture.h:64
BYTE MatTex2PixCol(int32_t tex)
Definition: C4Material.h:230
uint32_t DWORD
Here is the call graph for this function:

◆ PostFreeShape()

void C4Landscape::P::PostFreeShape ( C4ValueArray dig_objects,
C4Object by_object 
)

Definition at line 526 of file C4Landscape.cpp.

References C4PropList::Call(), C4Object::Contained, GBackSolid(), C4ValueArray::GetItem(), C4Value::getObj(), C4ValueArray::GetSize(), C4Object::GetX(), C4Object::GetY(), PSF_DigOutObject, PSF_OnDugOut, and C4PropList::Status.

527 {
528  // Do callbacks to digger and dug out objects for objects that are now dug free
529  if (by_object)
530  {
531  for (int32_t i = 0; i < dig_objects->GetSize(); ++i)
532  {
533  C4Object *dig_object = dig_objects->GetItem(i).getObj();
534  if (dig_object && !GBackSolid(dig_object->GetX(), dig_object->GetY()))
535  if (dig_object != by_object)
536  if (!dig_object->Contained && dig_object->Status)
537  {
538  C4AulParSet pars(by_object);
539  dig_object->Call(PSF_OnDugOut, &pars);
540  if (dig_object->Status && by_object->Status)
541  {
542  C4AulParSet pars(dig_object);
543  by_object->Call(PSF_DigOutObject, &pars);
544  }
545  }
546  }
547  }
548 }
C4Object * getObj() const
Definition: C4Value.cpp:68
int32_t GetX() const
Definition: C4Object.h:287
const C4Value & GetItem(int32_t iElem) const
Definition: C4ValueArray.h:38
int32_t Status
Definition: C4PropList.h:168
int32_t GetSize() const
Definition: C4ValueArray.h:36
int32_t GetY() const
Definition: C4Object.h:288
C4ObjectPtr Contained
Definition: C4Object.h:144
#define PSF_OnDugOut
Definition: C4GameScript.h:100
#define PSF_DigOutObject
Definition: C4GameScript.h:99
bool GBackSolid(int32_t x, int32_t y)
Definition: C4Landscape.h:229
C4Value Call(C4PropertyName k, C4AulParSet *pPars=nullptr, bool fPassErrors=false)
Definition: C4PropList.h:110
Here is the call graph for this function:

◆ PrepareChange()

void C4Landscape::P::PrepareChange ( const C4Landscape d,
const C4Rect BoundingBox 
)

Definition at line 3908 of file C4Landscape.cpp.

References C4SolidMask::Last, and C4SolidMask::Prev.

3909 {
3910  // move solidmasks out of the way
3911  C4Rect SolidMaskRect = BoundingBox;
3912  if (pLandscapeRender)
3913  SolidMaskRect = pLandscapeRender->GetAffectedRect(pLandscapeRender->GetAffectedRect(SolidMaskRect));
3914  for (C4SolidMask * pSolid = C4SolidMask::Last; pSolid; pSolid = pSolid->Prev)
3915  {
3916  pSolid->RemoveTemporary(SolidMaskRect);
3917  }
3918  UpdateMatCnt(d, BoundingBox, false);
3919 }
Definition: C4Rect.h:27
void UpdateMatCnt(const C4Landscape *, C4Rect Rect, bool fPlus)
std::unique_ptr< C4LandscapeRender > pLandscapeRender
Definition: C4Landscape.cpp:58
C4SolidMask * Prev
Definition: C4SolidMask.h:74
static C4SolidMask * Last
Definition: C4SolidMask.h:73

◆ PrepareFreeShape()

C4ValueArray * C4Landscape::P::PrepareFreeShape ( C4Rect BoundingBox,
C4Object by_object 
)

Definition at line 515 of file C4Landscape.cpp.

References C4FindObject::FindMany(), C4Object::Layer, Objects, OCF_InSolid, and C4GameObjects::Sectors.

516 {
517  // Remember any in-earth objects in area
518  C4FindObjectInRect fo_inrect(BoundingBox);
519  C4FindObjectOCF fo_insolid(OCF_InSolid);
520  C4FindObjectLayer fo_layer(by_object ? by_object->Layer : nullptr);
521  C4FindObject *fo_list[] = { &fo_inrect, &fo_insolid, &fo_layer };
522  C4FindObjectAndStatic fo_srch(3, fo_list);
523  return fo_srch.FindMany(::Objects, ::Objects.Sectors);
524 }
const uint32_t OCF_InSolid
Definition: C4Constants.h:99
C4ObjectPtr Layer
Definition: C4Object.h:136
C4LSectors Sectors
Definition: C4GameObjects.h:42
C4GameObjects Objects
Definition: C4Globals.cpp:48
Here is the call graph for this function:

◆ SaveDiffInternal()

bool C4Landscape::P::SaveDiffInternal ( const C4Landscape d,
C4Group hGroup,
bool  fSyncSave 
) const

Definition at line 1738 of file C4Landscape.cpp.

References C4Config::AtTempPath(), C4CFN_DiffLandscape, C4CFN_DiffLandscapeBkg, C4CFN_TempLandscape, C4CFN_TempLandscapeBkg, C4M_MaxTexIndex, Config, C4Group::Move(), C4Landscape::SaveMap(), and C4Landscape::SaveTextures().

1739 {
1740  assert(pInitial && pInitialBkg);
1741  if (!pInitial || !pInitialBkg) return false;
1742 
1743  // If it shouldn't be sync-save: Clear all bytes that have not changed, i.e.
1744  // set them to C4M_MaxTexIndex
1745  bool fChanged = false, fChangedBkg = false;;
1746  if (!fSyncSave)
1747  for (int y = 0; y < Height; y++)
1748  for (int x = 0; x < Width; x++)
1749  {
1750  if (pInitial[y * Width + x] == Surface8->_GetPix(x, y))
1751  Surface8->SetPix(x, y, C4M_MaxTexIndex);
1752  else
1753  fChanged = true;
1754 
1755  if (pInitialBkg[y * Width + x] == Surface8Bkg->_GetPix(x, y))
1756  Surface8Bkg->SetPix(x, y, C4M_MaxTexIndex);
1757  else
1758  fChangedBkg = true;
1759  }
1760 
1761  if (fSyncSave || fChanged)
1762  {
1763  // Save landscape surface
1765  return false;
1766 
1767  // Move temp file to group
1770  return false;
1771  }
1772 
1773  if (fSyncSave || fChangedBkg)
1774  {
1775  // Save landscape surface
1777  return false;
1778 
1779  // Move temp file to group
1782  return false;
1783  }
1784 
1785  // Restore landscape pixels
1786  if (!fSyncSave)
1787  for (int y = 0; y < Height; y++)
1788  for (int x = 0; x < Width; x++)
1789  {
1790  if (Surface8->_GetPix(x, y) == C4M_MaxTexIndex)
1791  Surface8->SetPix(x, y, pInitial[y * Width + x]);
1792  if (Surface8Bkg->_GetPix(x, y) == C4M_MaxTexIndex)
1793  Surface8Bkg->SetPix(x, y, pInitialBkg[y * Width + x]);
1794  }
1795 
1796  // Save changed map, too
1797  if (fMapChanged && Map)
1798  if (!d->SaveMap(hGroup)) return false;
1799 
1800  // and textures (if changed)
1801  if (!d->SaveTextures(hGroup)) return false;
1802 
1803  return true;
1804 }
#define C4CFN_DiffLandscapeBkg
Definition: C4Components.h:64
C4Config Config
Definition: C4Config.cpp:833
std::unique_ptr< CSurface8 > Surface8
Definition: C4Landscape.cpp:54
#define C4CFN_DiffLandscape
Definition: C4Components.h:63
std::unique_ptr< CSurface8 > Map
Definition: C4Landscape.cpp:56
std::unique_ptr< BYTE[]> pInitialBkg
Definition: C4Landscape.cpp:83
const int C4M_MaxTexIndex
Definition: C4Constants.h:51
bool Move(const char *szFile, const char *szAddAs)
Definition: C4Group.cpp:1325
#define C4CFN_TempLandscapeBkg
Definition: C4Components.h:157
std::unique_ptr< BYTE[]> pInitial
Definition: C4Landscape.cpp:82
bool SaveMap(C4Group &hGroup) const
std::unique_ptr< CSurface8 > Surface8Bkg
Definition: C4Landscape.cpp:55
const char * AtTempPath(const char *szFilename)
Definition: C4Config.cpp:540
bool SaveTextures(C4Group &hGroup) const
#define C4CFN_TempLandscape
Definition: C4Components.h:156
Here is the call graph for this function:

◆ SaveInternal()

bool C4Landscape::P::SaveInternal ( const C4Landscape d,
C4Group hGroup 
) const

Definition at line 1697 of file C4Landscape.cpp.

References _MAX_PATH, C4Config::AtTempPath(), C4CFN_LandscapeBg, C4CFN_LandscapeFg, C4CFN_TempLandscape, C4CFN_TempLandscapeBkg, Config, MakeTempFilename(), C4Group::Move(), C4Landscape::SaveMap(), C4Landscape::SaveTextures(), and SCopy().

1698 {
1699  // Save landscape surface
1700  char szTempLandscape[_MAX_PATH + 1];
1701  SCopy(Config.AtTempPath(C4CFN_TempLandscape), szTempLandscape);
1702  MakeTempFilename(szTempLandscape);
1703  if (!Surface8->Save(szTempLandscape))
1704  return false;
1705 
1706  // Move temp file to group
1707  if (!hGroup.Move(szTempLandscape, C4CFN_LandscapeFg))
1708  return false;
1709 
1710  // Same for background surface
1711  SCopy(Config.AtTempPath(C4CFN_TempLandscapeBkg), szTempLandscape);
1712  MakeTempFilename(szTempLandscape);
1713  if (!Surface8Bkg->Save(szTempLandscape))
1714  return false;
1715  if (!hGroup.Move(szTempLandscape, C4CFN_LandscapeBg))
1716  return false;
1717 
1718  // Save map
1719  if (fMapChanged && Map)
1720  if (!d->SaveMap(hGroup))
1721  return false;
1722 
1723  // save textures (if changed)
1724  if (!d->SaveTextures(hGroup))
1725  return false;
1726 
1727  return true;
1728 }
C4Config Config
Definition: C4Config.cpp:833
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
Definition: Standard.cpp:152
std::unique_ptr< CSurface8 > Surface8
Definition: C4Landscape.cpp:54
#define _MAX_PATH
std::unique_ptr< CSurface8 > Map
Definition: C4Landscape.cpp:56
bool Move(const char *szFile, const char *szAddAs)
Definition: C4Group.cpp:1325
#define C4CFN_TempLandscapeBkg
Definition: C4Components.h:157
#define C4CFN_LandscapeFg
Definition: C4Components.h:61
bool SaveMap(C4Group &hGroup) const
std::unique_ptr< CSurface8 > Surface8Bkg
Definition: C4Landscape.cpp:55
const char * AtTempPath(const char *szFilename)
Definition: C4Config.cpp:540
void MakeTempFilename(char *szFilename)
Definition: StdFile.cpp:323
bool SaveTextures(C4Group &hGroup) const
#define C4CFN_LandscapeBg
Definition: C4Components.h:62
#define C4CFN_TempLandscape
Definition: C4Components.h:156
Here is the call graph for this function:

◆ ShakeFreePix()

bool C4Landscape::P::ShakeFreePix ( C4Landscape d,
int32_t  tx,
int32_t  ty 
)

Definition at line 753 of file C4Landscape.cpp.

References C4Landscape::CheckInstabilityRange(), C4Landscape::ClearPix(), C4PXSSystem::Create(), C4MaterialCore::DigFree, C4Landscape::GetMat(), itofix(), C4MaterialMap::Map, MaterialMap, MatValid(), and PXS.

754 {
755  int32_t mat = d->GetMat(tx, ty);
756  if (MatValid(mat))
757  {
758  if (::MaterialMap.Map[mat].DigFree)
759  {
760  d->ClearPix(tx, ty);
761  ::PXS.Create(mat, itofix(tx), itofix(ty));
762  // check for instable materials to start moving by the cleared space
763  d->CheckInstabilityRange(tx, ty);
764  return true;
765  }
766  }
767  return false;
768 }
C4Material * Map
Definition: C4Material.h:169
bool Create(int32_t mat, C4Real ix, C4Real iy, C4Real ixdir=Fix0, C4Real iydir=Fix0)
Definition: C4PXS.cpp:175
void CheckInstabilityRange(int32_t tx, int32_t ty)
C4Fixed itofix(int32_t x)
Definition: C4Real.h:261
C4PXSSystem PXS
Definition: C4PXS.cpp:423
int32_t GetMat(int32_t x, int32_t y) const
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
bool ClearPix(int32_t tx, int32_t ty)
bool MatValid(int32_t mat)
Definition: C4Material.h:210
int32_t DigFree
Definition: C4Material.h:94
Here is the call graph for this function:

◆ TexOZoom()

bool C4Landscape::P::TexOZoom ( C4Landscape d,
const CSurface8 sfcMap,
const CSurface8 sfcMapBkg,
int32_t  iMapX,
int32_t  iMapY,
int32_t  iMapWdt,
int32_t  iMapHgt,
DWORD dwpTextureUsage,
int32_t  iToX = 0,
int32_t  iToY = 0 
)

Definition at line 2321 of file C4Landscape.cpp.

References C4TextureMap::Order, and TextureMap.

2322 {
2323  // ChunkOZoom all used textures
2324  for (auto iIndex : ::TextureMap.Order)
2325  {
2326  if (dwpTextureUsage[iIndex] > 0)
2327  {
2328  // ChunkOZoom map to landscape
2329  ChunkOZoom(d, sfcMap, sfcMapBkg, iMapX, iMapY, iMapWdt, iMapHgt, iIndex, iToX, iToY);
2330  }
2331  }
2332 
2333  // Done
2334  return true;
2335 }
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
std::vector< int32_t > Order
Definition: C4Texture.h:77
void ChunkOZoom(C4Landscape *, const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, uint8_t iTexture, int32_t iOffX=0, int32_t iOffY=0)

◆ UpdateMatCnt()

void C4Landscape::P::UpdateMatCnt ( const C4Landscape d,
C4Rect  Rect,
bool  fPlus 
)

Definition at line 4269 of file C4Landscape.cpp.

References C4Landscape::_GetMat(), C4Landscape::GetMatHeight(), C4Rect::Hgt, C4Rect::Intersect(), C4MaterialMap::Map, MaterialMap, C4MaterialCore::MinHeightCount, C4Rect::Wdt, C4Rect::x, C4Rect::y, and CPolyEdge::y.

4270 {
4271  Rect.Intersect(C4Rect(0, 0, Width, Height));
4272  if (!Rect.Hgt || !Rect.Wdt) return;
4273  // Multiplicator for changes
4274  const int32_t iMul = fPlus ? +1 : -1;
4275  // Count pixels
4276  for (int32_t x = 0; x < Rect.Wdt; x++)
4277  {
4278  int iHgt = 0;
4279  int32_t y;
4280  for (y = 1; y < Rect.Hgt; y++)
4281  {
4282  int32_t iMat = d->_GetMat(Rect.x + x, Rect.y + y - 1);
4283  // Same material? Count it.
4284  if (iMat == d->_GetMat(Rect.x + x, Rect.y + y))
4285  iHgt++;
4286  else
4287  {
4288  if (iMat >= 0)
4289  {
4290  // Normal material counting
4291  MatCount[iMat] += iMul * (iHgt + 1);
4292  // Effective material counting enabled?
4293  if (int32_t iMinHgt = ::MaterialMap.Map[iMat].MinHeightCount)
4294  {
4295  // First chunk? Add any material above when checking chunk height
4296  int iAddedHeight = 0;
4297  if (Rect.y && iHgt + 1 == y)
4298  iAddedHeight = d->GetMatHeight(Rect.x + x, Rect.y - 1, -1, iMat, iMinHgt);
4299  // Check the chunk height
4300  if (iHgt + 1 + iAddedHeight >= iMinHgt)
4301  {
4302  EffectiveMatCount[iMat] += iMul * (iHgt + 1);
4303  if (iAddedHeight < iMinHgt)
4304  EffectiveMatCount[iMat] += iMul * iAddedHeight;
4305  }
4306  }
4307  }
4308  // Next chunk of material
4309  iHgt = 0;
4310  }
4311  }
4312  // Check last pixel
4313  int32_t iMat = d->_GetMat(Rect.x + x, Rect.y + Rect.Hgt - 1);
4314  if (iMat >= 0)
4315  {
4316  // Normal material counting
4317  MatCount[iMat] += iMul * (iHgt + 1);
4318  // Minimum height counting?
4319  if (int32_t iMinHgt = ::MaterialMap.Map[iMat].MinHeightCount)
4320  {
4321  int iAddedHeight1 = 0, iAddedHeight2 = 0;
4322  // Add any material above for chunk size check
4323  if (Rect.y && iHgt + 1 == Rect.Hgt)
4324  iAddedHeight1 = d->GetMatHeight(Rect.x + x, Rect.y - 1, -1, iMat, iMinHgt);
4325  // Add any material below for chunk size check
4326  if (Rect.y + y < Height)
4327  iAddedHeight2 = d->GetMatHeight(Rect.x + x, Rect.y + Rect.Hgt, 1, iMat, iMinHgt);
4328  // Chunk tall enough?
4329  if (iHgt + 1 + iAddedHeight1 + iAddedHeight2 >= ::MaterialMap.Map[iMat].MinHeightCount)
4330  {
4331  EffectiveMatCount[iMat] += iMul * (iHgt + 1);
4332  if (iAddedHeight1 < iMinHgt)
4333  EffectiveMatCount[iMat] += iMul * iAddedHeight1;
4334  if (iAddedHeight2 < iMinHgt)
4335  EffectiveMatCount[iMat] += iMul * iAddedHeight2;
4336  }
4337  }
4338  }
4339  }
4340 }
std::array< DWORD, C4MaxMaterial > MatCount
Definition: C4Landscape.cpp:71
int32_t GetMatHeight(int32_t x, int32_t y, int32_t iYDir, int32_t iMat, int32_t iMax) const
C4Material * Map
Definition: C4Material.h:169
Definition: C4Rect.h:27
void Intersect(const C4Rect &r2)
Definition: C4Rect.cpp:100
int32_t Wdt
Definition: C4Rect.h:30
int32_t y
Definition: C4Rect.h:30
std::array< DWORD, C4MaxMaterial > EffectiveMatCount
Definition: C4Landscape.cpp:72
int32_t MinHeightCount
Definition: C4Material.h:130
int32_t x
Definition: C4Rect.h:30
C4MaterialMap MaterialMap
Definition: C4Material.cpp:974
int32_t Hgt
Definition: C4Rect.h:30
int32_t _GetMat(int32_t x, int32_t y) const
Here is the call graph for this function:

◆ UpdatePixCnt()

void C4Landscape::P::UpdatePixCnt ( const C4Landscape d,
const C4Rect Rect,
bool  fCheck = false 
)

Definition at line 4252 of file C4Landscape.cpp.

References C4Landscape::_GetDensity(), C4Rect::Hgt, iCnt, C4Rect::Wdt, C4Rect::x, C4Rect::y, and CPolyEdge::y.

4253 {
4254  int32_t PixCntWidth = (Width + 16) / 17;
4255  for (int32_t y = std::max<int32_t>(0, Rect.y / 15); y < std::min<int32_t>(PixCntPitch, (Rect.y + Rect.Hgt + 14) / 15); y++)
4256  for (int32_t x = std::max<int32_t>(0, Rect.x / 17); x < std::min<int32_t>(PixCntWidth, (Rect.x + Rect.Wdt + 16) / 17); x++)
4257  {
4258  int iCnt = 0;
4259  for (int32_t x2 = x * 17; x2 < std::min<int32_t>(x * 17 + 17, Width); x2++)
4260  for (int32_t y2 = y * 15; y2 < std::min<int32_t>(y * 15 + 15, Height); y2++)
4261  if (d->_GetDensity(x2, y2))
4262  iCnt++;
4263  if (fCheck)
4264  assert(iCnt == PixCnt[x * PixCntPitch + y]);
4265  PixCnt[x * PixCntPitch + y] = iCnt;
4266  }
4267 }
std::vector< uint8_t > PixCnt
Definition: C4Landscape.cpp:64
int32_t Wdt
Definition: C4Rect.h:30
int32_t y
Definition: C4Rect.h:30
int iCnt
Definition: TstC4NetIO.cpp:32
int32_t PixCntPitch
Definition: C4Landscape.cpp:63
int32_t x
Definition: C4Rect.h:30
int32_t _GetDensity(int32_t x, int32_t y) const
int32_t Hgt
Definition: C4Rect.h:30
Here is the call graph for this function:

Member Data Documentation

◆ BottomRowPix

std::vector<uint8_t> C4Landscape::P::BottomRowPix

Definition at line 60 of file C4Landscape.cpp.

◆ BridgeMatConversion

std::array< std::unique_ptr< uint8_t[]>, C4M_MaxTexIndex > C4Landscape::P::BridgeMatConversion
mutable

Definition at line 66 of file C4Landscape.cpp.

◆ EffectiveMatCount

std::array<DWORD, C4MaxMaterial> C4Landscape::P::EffectiveMatCount {}

Definition at line 72 of file C4Landscape.cpp.

◆ fMapChanged

bool C4Landscape::P::fMapChanged = false

Definition at line 81 of file C4Landscape.cpp.

◆ Gravity

C4Real C4Landscape::P::Gravity = DefaultGravAccel

Definition at line 76 of file C4Landscape.cpp.

◆ Height

int32_t C4Landscape::P::Height = 0

Definition at line 69 of file C4Landscape.cpp.

◆ LeftColPix

std::vector<uint8_t> C4Landscape::P::LeftColPix

Definition at line 60 of file C4Landscape.cpp.

◆ Map

std::unique_ptr<CSurface8> C4Landscape::P::Map

Definition at line 56 of file C4Landscape.cpp.

◆ MapBkg

std::unique_ptr<CSurface8> C4Landscape::P::MapBkg

Definition at line 57 of file C4Landscape.cpp.

◆ MapHeight

int32_t C4Landscape::P::MapHeight = 0

Definition at line 70 of file C4Landscape.cpp.

◆ MapSeed

int32_t C4Landscape::P::MapSeed = 0

Definition at line 78 of file C4Landscape.cpp.

◆ MapWidth

int32_t C4Landscape::P::MapWidth = 0

Definition at line 70 of file C4Landscape.cpp.

◆ MapZoom

int32_t C4Landscape::P::MapZoom = 0

Definition at line 70 of file C4Landscape.cpp.

◆ MatCount

std::array<DWORD, C4MaxMaterial> C4Landscape::P::MatCount {}

Definition at line 71 of file C4Landscape.cpp.

◆ mode

LandscapeMode C4Landscape::P::mode = LandscapeMode::Undefined

Definition at line 68 of file C4Landscape.cpp.

◆ Modulation

uint32_t C4Landscape::P::Modulation = 0

Definition at line 77 of file C4Landscape.cpp.

◆ NoScan

bool C4Landscape::P::NoScan = false

Definition at line 74 of file C4Landscape.cpp.

◆ pFoW

std::unique_ptr<C4FoW> C4Landscape::P::pFoW

Definition at line 84 of file C4Landscape.cpp.

◆ pInitial

std::unique_ptr<BYTE[]> C4Landscape::P::pInitial

Definition at line 82 of file C4Landscape.cpp.

◆ pInitialBkg

std::unique_ptr<BYTE[]> C4Landscape::P::pInitialBkg

Definition at line 83 of file C4Landscape.cpp.

◆ Pix2Dens

int32_t C4Landscape::P::Pix2Dens

Definition at line 61 of file C4Landscape.cpp.

◆ Pix2Light

bool C4Landscape::P::Pix2Light

Definition at line 62 of file C4Landscape.cpp.

◆ Pix2Mat

int32_t C4Landscape::P::Pix2Mat

Definition at line 61 of file C4Landscape.cpp.

◆ Pix2Place

int32_t C4Landscape::P::Pix2Place

Definition at line 61 of file C4Landscape.cpp.

◆ PixCnt

std::vector<uint8_t> C4Landscape::P::PixCnt

Definition at line 64 of file C4Landscape.cpp.

◆ PixCntPitch

int32_t C4Landscape::P::PixCntPitch = 0

Definition at line 63 of file C4Landscape.cpp.

◆ pLandscapeRender

std::unique_ptr<C4LandscapeRender> C4Landscape::P::pLandscapeRender

Definition at line 58 of file C4Landscape.cpp.

◆ pMapCreator

std::unique_ptr<C4MapCreatorS2> C4Landscape::P::pMapCreator

Definition at line 80 of file C4Landscape.cpp.

◆ Relights

std::array<C4Rect, C4LS_MaxRelights> C4Landscape::P::Relights

Definition at line 65 of file C4Landscape.cpp.

◆ RightColPix

std::vector<uint8_t> C4Landscape::P::RightColPix

Definition at line 60 of file C4Landscape.cpp.

◆ ScanSpeed

int32_t C4Landscape::P::ScanSpeed = 2

Definition at line 75 of file C4Landscape.cpp.

◆ ScanX

int32_t C4Landscape::P::ScanX = 0

Definition at line 75 of file C4Landscape.cpp.

◆ Sky

C4Sky C4Landscape::P::Sky

Definition at line 79 of file C4Landscape.cpp.

◆ Surface8

std::unique_ptr< CSurface8 > C4Landscape::P::Surface8

Definition at line 54 of file C4Landscape.cpp.

◆ Surface8Bkg

std::unique_ptr<CSurface8> C4Landscape::P::Surface8Bkg

Definition at line 55 of file C4Landscape.cpp.

◆ TopRowPix

std::vector<uint8_t> C4Landscape::P::TopRowPix

Definition at line 60 of file C4Landscape.cpp.

◆ Width

int32_t C4Landscape::P::Width = 0

Definition at line 69 of file C4Landscape.cpp.


The documentation for this struct was generated from the following files: