summaryrefslogtreecommitdiff
path: root/src/resources/map/maplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/map/maplayer.cpp')
-rw-r--r--src/resources/map/maplayer.cpp101
1 files changed, 16 insertions, 85 deletions
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index c17b93fe6..2082961fa 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -127,25 +127,6 @@ void MapLayer::draw(Graphics *const graphics,
const int dx = mPixelX - scrollX;
const int dy = mPixelY - scrollY;
-/*
- logger->log("draw layer: %s", mName.c_str());
-
- if (mName == "walllayer")
- {
- for (int y = startY; y < endY; y++)
- {
- for (int x = startX; x < endX; x++)
- {
- TileInfo *tilePtr = &mTiles[CAST_SIZE(y * mWidth + x)];
- if (tilePtr->isEnabled == true && y == 11)
- {
- logger->log("visible %d,%d", x, y);
- }
- }
- }
- }
-*/
-
for (int y = startY; y < endY; y++)
{
const int y32 = y * mapTileSize;
@@ -155,49 +136,36 @@ void MapLayer::draw(Graphics *const graphics,
int x0 = startX;
TileInfo *tilePtr = &mTiles[CAST_SIZE(x0 + yWidth)];
-// if (mName == "walllayer")
-// logger->log("test %d,%d", x0, y);
if (tilePtr->isEnabled == false)
{
-// if (mName == "walllayer")
-// logger->log("hidden 1");
if (x0 + tilePtr->nextTile >= endX)
{
-// if (mName == "walllayer")
-// logger->log("skip 1");
continue;
}
-// if (mName == "walllayer")
-// logger->log("hidden 2");
x0 += tilePtr->nextTile + 1;
tilePtr = &mTiles[CAST_SIZE(x0 + yWidth)];
-// if (mName == "walllayer")
-// logger->log("hidden jump to %d,%d", x0, y);
if (mTiles[x0 + yWidth].isEnabled == false)
{
-// if (mName == "walllayer")
-// logger->log("skip 2");
continue;
}
-// if (mName == "walllayer")
-// logger->log("hidden 3");
}
-// if (mName == "walllayer")
-// logger->log("for x in %d to %d", x0, endX);
for (int x = x0; x < endX; x++, tilePtr++)
{
if (!tilePtr->isEnabled)
{
if (x + tilePtr->count + 1 >= endX)
break;
- logger->log("error tiles: %s (%d,%d) to %d, +%d, %d", mName.c_str(), x, y, endX, tilePtr->count, tilePtr->nextTile);
+ logger->log("error tiles: %s (%d,%d) to %d, +%d, %d",
+ mName.c_str(),
+ x, y,
+ endX,
+ tilePtr->count,
+ tilePtr->nextTile);
const int c = tilePtr->count;
x += c;
tilePtr += c;
continue;
}
-// if (mName == "walllayer")
-// logger->log("ok tiles: %s (%d,%d) to %d, +%d, %d", mName.c_str(), x, y, endX, tilePtr->count, tilePtr->nextTile);
const int x32 = x * mapTileSize;
int c = 0;
@@ -213,8 +181,6 @@ void MapLayer::draw(Graphics *const graphics,
if (c == 0)
{
graphics->drawImage(img, px, py);
-// if (mName == "walllayer")
-// logger->log("draw image %d,%d", x, y);
}
else
{
@@ -223,8 +189,6 @@ void MapLayer::draw(Graphics *const graphics,
py,
tilePtr->width,
img->mBounds.h);
-// if (mName == "walllayer")
-// logger->log("draw pattern %d,%d, width=%d", x, y, tilePtr->width);
}
}
@@ -395,8 +359,6 @@ void MapLayer::updateOGL(Graphics *const graphics,
}
}
lastImage = img;
-// if (imgVert->image->mGLImage != lastImage->mGLImage)
-// logger->log("wrong image draw");
graphics->calcTileVertexes(imgVert, lastImage, px, py);
}
}
@@ -413,7 +375,6 @@ void MapLayer::drawOGL(Graphics *const graphics) const restrict2
BLOCK_START("MapLayer::drawOGL")
MapRows::const_iterator rit = mTempRows.begin();
const MapRows::const_iterator rit_end = mTempRows.end();
-// int k = 0;
while (rit != rit_end)
{
const MapRowImages *const images = &(*rit)->images;
@@ -423,12 +384,10 @@ void MapLayer::drawOGL(Graphics *const graphics) const restrict2
{
graphics->drawTileVertexes(*iit);
++ iit;
-// k ++;
}
++ rit;
}
BLOCK_END("MapLayer::drawOGL")
-// logger->log("draws: %d", k);
}
#endif // USE_OPENGL
@@ -642,13 +601,16 @@ void MapLayer::drawFringe(Graphics *const graphics,
img->mBounds.h);
}
}
-// logger->log("ok tiles3: (%d,%d) to %d, +%d, %d", x, y, endX, tilePtr->count, tilePtr->nextTile);
}
else
{
if (x + tilePtr->count + 1 >= endX)
break;
- logger->log("error tiles1: (%d,%d) to %d, +%d, %d", x, y, endX, tilePtr->count, tilePtr->nextTile);
+ logger->log("error tiles1: (%d,%d) to %d, +%d, %d",
+ x, y,
+ endX,
+ tilePtr->count,
+ tilePtr->nextTile);
c = tilePtr->count;
x += c;
tilePtr += c;
@@ -706,13 +668,16 @@ void MapLayer::drawFringe(Graphics *const graphics,
{
if (x + tilePtr->count + 1 >= endX)
break;
- logger->log("error tiles2: (%d,%d) to %d, +%d, %d", x, y, endX, tilePtr->count, tilePtr->nextTile);
+ logger->log("error tiles2: (%d,%d) to %d, +%d, %d",
+ x, y,
+ endX,
+ tilePtr->count,
+ tilePtr->nextTile);
const int c = tilePtr->count;
x += c;
tilePtr += c;
continue;
}
-// logger->log("ok tiles4: (%d,%d) to %d, +%d, %d", x, y, endX, tilePtr->count, tilePtr->nextTile);
const int x32 = x * mapTileSize;
const Image *const img = tilePtr->image;
const int px = x32 + dx;
@@ -864,8 +829,6 @@ void MapLayer::updateConditionTiles(const MetaTile *const metaTiles,
{
const int width1 = width < mWidth ? width : mWidth;
const int height1 = height < mHeight ? height : mHeight;
-// if (mName == "walllayer")
-// logger->log("MapLayer::updateConditionTiles start: %s, %d", mName.c_str(), mTileCondition);
for (int y = mY; y < height1; y ++)
{
@@ -879,28 +842,13 @@ void MapLayer::updateConditionTiles(const MetaTile *const metaTiles,
mTileCondition == BlockMask::GROUND)))
{
tilePtr->isEnabled = true;
-// if (mName == "walllayer")
-// logger->log("update1: %d,%d (%p,%d) %d", x, y, (void*)tilePtr->image, metaPtr->blockmask, tilePtr->isEnabled ? 1 : 0);
}
else
{
tilePtr->isEnabled = false;
-// if (mName == "walllayer")
-// logger->log("update2: %d,%d (%p,%d) %d", x, y, (void*)tilePtr->image, metaPtr->blockmask, tilePtr->isEnabled ? 1 : 0);
- }
-/*
- if (mName == "walllayer")
- {
- if (x == 18 && y == 11)
- {
-// logger->log("update: %d,%d (%p,%d) %d", x, y, (void*)tilePtr->image, metaPtr->blockmask, tilePtr->isEnabled ? 1 : 0);
- }
}
-*/
}
}
-// if (mName == "walllayer")
-// logger->log("MapLayer::updateConditionTiles end: %s", mName.c_str());
}
void MapLayer::updateCache(const int width,
@@ -909,8 +857,6 @@ void MapLayer::updateCache(const int width,
const int width1 = width < mWidth ? width : mWidth;
const int height1 = height < mHeight ? height : mHeight;
-// if (mName == "walllayer")
-// logger->log("MapLayer::updateCache start: %s", mName.c_str());
for (int y = mY; y < height1; y ++)
{
for (int x = mX; x < width1; x ++)
@@ -924,8 +870,6 @@ void MapLayer::updateCache(const int width,
width1 - x,
nextTile);
tilePtr->width = 0;
-// if (mName == "walllayer")
-// logger->log("set1 count/next to %d,%d = %d and %d", x, y, tilePtr->count, nextTile);
}
else
{
@@ -935,23 +879,10 @@ void MapLayer::updateCache(const int width,
tileWidth,
nextTile);
tilePtr->width = tileWidth;
-// if (mName == "walllayer")
-// logger->log("set2 count/next to %d,%d = %d and %d", x, y, tilePtr->count, nextTile);
}
tilePtr->nextTile = nextTile;
-/*
- if (mName == "walllayer")
- {
- if (x == 18 && y == 11)
- {
-// logger->log("set count/next to %d,%d = %d and %d", x, y, tilePtr->count, tilePtr->nextTile);
- }
- }
-*/
}
}
-// if (mName == "walllayer")
-// logger->log("MapLayer::updateCache end: %s", mName.c_str());
}
int MapLayer::calcMemoryLocal() const