Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions Core/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2663,12 +2663,16 @@ void TerrainLogic::flattenTerrain(Object *obj)
iMin.y = REAL_TO_INT_FLOOR(minY/MAP_XY_FACTOR);
iMax.x = REAL_TO_INT_FLOOR(maxX/MAP_XY_FACTOR);
iMax.y = REAL_TO_INT_FLOOR(maxY/MAP_XY_FACTOR);
#if RETAIL_COMPATIBLE_CRC
// TheSuperHackers @info bobtista 29/09/2026 Retail scans from row 0, so rows below the map edge stay untouched.
iMin.y = std::max(0, iMin.y);
#endif

Int i, j;
Real totalHeight = 0;
Int numSamples = 0;
for (i=iMin.x; i<=iMax.x; i++) {
for (j=0; j<=iMax.y; j++) {
for (j=iMin.y; j<=iMax.y; ++j) {
Vector3 testPt(i*MAP_XY_FACTOR, j*MAP_XY_FACTOR, 0);
Bool match = false;
unsigned char flags;
Expand All @@ -2694,7 +2698,7 @@ void TerrainLogic::flattenTerrain(Object *obj)
if (rawDataHeight>centerHeight) rawDataHeight = centerHeight;

for (i=iMin.x; i<=iMax.x; i++) {
for (j=0; j<=iMax.y; j++) {
for (j=iMin.y; j<=iMax.y; ++j) {
Vector3 testPt(i*MAP_XY_FACTOR, j*MAP_XY_FACTOR, 0);
Bool match = false;
unsigned char flags;
Expand Down Expand Up @@ -2754,12 +2758,16 @@ void TerrainLogic::flattenTerrain(Object *obj)
iMin.y = REAL_TO_INT_FLOOR((pos->y-radius)/MAP_XY_FACTOR);
iMax.x = REAL_TO_INT_FLOOR((pos->x+radius)/MAP_XY_FACTOR);
iMax.y = REAL_TO_INT_FLOOR((pos->y+radius)/MAP_XY_FACTOR);
#if RETAIL_COMPATIBLE_CRC
// TheSuperHackers @info bobtista 29/09/2026 Retail scans from row 0, so rows below the map edge stay untouched.
iMin.y = std::max(0, iMin.y);
#endif

Int i, j;
Real totalHeight = 0;
Int numSamples = 0;
for (i=iMin.x; i<=iMax.x; i++) {
for (j=0; j<=iMax.y; j++) {
for (j=iMin.y; j<=iMax.y; ++j) {
Vector3 testPt(i*MAP_XY_FACTOR, j*MAP_XY_FACTOR, 0);
Bool match = false;
Real dx = testPt.X - pos->x;
Expand All @@ -2777,7 +2785,7 @@ void TerrainLogic::flattenTerrain(Object *obj)
Real avgHeight = totalHeight/numSamples;
Int rawDataHeight = REAL_TO_INT_FLOOR(0.5f + avgHeight/MAP_HEIGHT_SCALE);
for (i=iMin.x; i<=iMax.x; i++) {
for (j=0; j<=iMax.y; j++) {
for (j=iMin.y; j<=iMax.y; ++j) {
Vector3 testPt(i*MAP_XY_FACTOR, j*MAP_XY_FACTOR, 0);
Bool match = false;
Real dx = testPt.X - pos->x;
Expand Down Expand Up @@ -2847,12 +2855,16 @@ void TerrainLogic::createCraterInTerrain(Object *obj)
iMin.y = REAL_TO_INT_FLOOR( ( pos->y - radius ) / MAP_XY_FACTOR );
iMax.x = REAL_TO_INT_FLOOR( ( pos->x + radius ) / MAP_XY_FACTOR );
iMax.y = REAL_TO_INT_FLOOR( ( pos->y + radius ) / MAP_XY_FACTOR );
#if RETAIL_COMPATIBLE_CRC
// TheSuperHackers @info bobtista 29/09/2026 Retail scans from row 0, so rows below the map edge stay untouched.
iMin.y = std::max( 0, iMin.y );
#endif

Real deltaX, deltaY;

for (Int i = iMin.x; i <= iMax.x; i++ )
{
for ( Int j=0; j <= iMax.y; j++ )
for ( Int j=iMin.y; j <= iMax.y; ++j )
Comment thread
xezon marked this conversation as resolved.
{
deltaX = ( i * MAP_XY_FACTOR ) - pos->x;
deltaY = ( j * MAP_XY_FACTOR ) - pos->y;
Expand Down
Loading