summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-09 11:49:46 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-09 11:49:46 +0300
commit6e052536a2dfb7f877a356477bc86c904aae1e71 (patch)
treecfe31d967d591a99609eea758bb2823769ab9edb
parentacb8d0c088c2d4368b73b3c1c1d7eb13bad49aa0 (diff)
downloadplus-6e052536a2dfb7f877a356477bc86c904aae1e71.tar.gz
plus-6e052536a2dfb7f877a356477bc86c904aae1e71.tar.bz2
plus-6e052536a2dfb7f877a356477bc86c904aae1e71.tar.xz
plus-6e052536a2dfb7f877a356477bc86c904aae1e71.zip
Add empty map mode without collisions.
Mode can be switched from yellow bar. Also renamed map draw type related variables and methods.
-rw-r--r--src/actionmanager.cpp2
-rw-r--r--src/being/localplayer.cpp18
-rw-r--r--src/being/localplayer.h2
-rw-r--r--src/gui/popups/statuspopup.cpp2
-rw-r--r--src/gui/viewport.cpp25
-rw-r--r--src/gui/viewport.h12
-rw-r--r--src/gui/windows/statuswindow.cpp2
-rw-r--r--src/resources/map/map.cpp18
-rw-r--r--src/resources/map/map.h10
-rw-r--r--src/resources/map/maplayer.cpp36
-rw-r--r--src/resources/map/maplayer.h8
-rw-r--r--src/resources/map/maptype.h3
12 files changed, 77 insertions, 61 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 47b3503e1..1896e333d 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -884,7 +884,7 @@ impHandler0(updaterWindowShow)
impHandler0(changeMapMode)
{
if (viewport)
- viewport->toggleDebugPath();
+ viewport->toggleMapDrawType();
UpdateStatusListener::distributeEvent();
if (Game::instance())
{
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 52bf2d75d..c069a6e4e 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -1520,7 +1520,7 @@ std::string LocalPlayer::getPickUpTypeString()
mPickUpType, pickUpTypeSize));
}
-const unsigned debugPathSize = 5;
+const unsigned debugPathSize = 7;
static const char *const debugPathStrings[] =
{
@@ -1533,15 +1533,19 @@ static const char *const debugPathStrings[] =
// TRANSLATORS: map view type in status bar
N_("(U) ultra map view 2"),
// TRANSLATORS: map view type in status bar
- N_("(e) empty map view"),
+ N_("(e) empty map view with collision"),
// TRANSLATORS: map view type in status bar
- N_("(b) black & white map view")
+ N_("(E) empty map view"),
+ // TRANSLATORS: map view type in status bar
+ N_("(b) black & white map view"),
+ // TRANSLATORS: pickup size in status bar
+ N_("(?) map view")
};
-std::string LocalPlayer::getDebugPathString()
+std::string LocalPlayer::getMapDrawTypeString()
{
return gettext(getVarItem(&debugPathStrings[0],
- viewport->getDebugPath(), debugPathSize));
+ viewport->getMapDrawType(), debugPathSize));
}
const unsigned magicAttackSize = 5;
@@ -3733,12 +3737,12 @@ void LocalPlayer::resetYellowBar()
mPickUpType = config.resetIntValue("pickUpType");
if (viewport)
{
- viewport->setDebugPath(0);
+ viewport->setMapDrawType(0);
if (viewport->getCameraMode())
viewport->toggleCameraMode();
}
if (mMap)
- mMap->setDebugFlags(0);
+ mMap->setDrawLayersFlags(0);
mImitationMode = config.resetIntValue("imitationMode");
mDisableGameModifiers = config.resetBoolValue("disableGameModifiers");
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 2eb236918..8e72bf5d6 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -468,7 +468,7 @@ class LocalPlayer final : public Being,
std::string getPickUpTypeString();
- static std::string getDebugPathString();
+ static std::string getMapDrawTypeString();
std::string getMagicAttackString();
diff --git a/src/gui/popups/statuspopup.cpp b/src/gui/popups/statuspopup.cpp
index a1e0b502c..f2f934d1b 100644
--- a/src/gui/popups/statuspopup.cpp
+++ b/src/gui/popups/statuspopup.cpp
@@ -154,7 +154,7 @@ void StatusPopup::updateLabels() const
InputAction::SWITCH_QUICK_DROP);
setLabelText(7, player_node->getPickUpTypeString(),
InputAction::CHANGE_PICKUP_TYPE);
- setLabelText(8, LocalPlayer::getDebugPathString(),
+ setLabelText(8, LocalPlayer::getMapDrawTypeString(),
InputAction::PATHFIND);
setLabelText(9, player_node->getMagicAttackString(),
InputAction::SWITCH_MAGIC_ATTACK);
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 225b88f30..1c0694ca3 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -79,7 +79,7 @@ Viewport::Viewport() :
mMousePressY(0),
mPixelViewX(0),
mPixelViewY(0),
- mShowDebugPath(MapType::NORMAL),
+ mMapDrawType(MapType::NORMAL),
mCameraMode(0),
mLocalWalkTime(-1),
mCameraRelativeX(0),
@@ -122,7 +122,7 @@ Viewport::~Viewport()
void Viewport::setMap(Map *const map)
{
if (mMap && map)
- map->setDebugFlags(mMap->getDebugFlags());
+ map->setDrawLayersFlags(mMap->getDrawLayersFlags());
mMap = map;
}
@@ -237,11 +237,14 @@ void Viewport::draw(Graphics *graphics)
// Draw tiles and sprites
mMap->draw(graphics, mPixelViewX, mPixelViewY);
- if (mShowDebugPath)
+ if (mMapDrawType != MapType::NORMAL)
{
- mMap->drawCollision(graphics, mPixelViewX,
- mPixelViewY, mShowDebugPath);
- if (mShowDebugPath == MapType::DEBUG)
+ if (mMapDrawType != MapType::SPECIAL4)
+ {
+ mMap->drawCollision(graphics, mPixelViewX,
+ mPixelViewY, mMapDrawType);
+ }
+ if (mMapDrawType == MapType::DEBUG)
drawDebugPath(graphics);
}
@@ -990,13 +993,13 @@ void Viewport::mouseMoved(MouseEvent &event A_UNUSED)
}
}
-void Viewport::toggleDebugPath()
+void Viewport::toggleMapDrawType()
{
- mShowDebugPath++;
- if (mShowDebugPath > MapType::BLACKWHITE)
- mShowDebugPath = MapType::NORMAL;
+ mMapDrawType++;
+ if (mMapDrawType > MapType::BLACKWHITE)
+ mMapDrawType = MapType::NORMAL;
if (mMap)
- mMap->setDebugFlags(mShowDebugPath);
+ mMap->setDrawLayersFlags(mMapDrawType);
}
void Viewport::toggleCameraMode()
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index d401a3af4..4a7abea93 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -96,7 +96,7 @@ class Viewport final : public WindowContainer,
* debug with all images and grid, debug with out big images
* and with out grid.
*/
- void toggleDebugPath();
+ void toggleMapDrawType();
void toggleCameraMode();
@@ -242,11 +242,11 @@ class Viewport final : public WindowContainer,
void scrollBy(const int x, const int y)
{ mPixelViewX += x; mPixelViewY += y; }
- int getDebugPath() const A_WARN_UNUSED
- { return mShowDebugPath; }
+ int getMapDrawType() const A_WARN_UNUSED
+ { return mMapDrawType; }
- void setDebugPath(const int n)
- { mShowDebugPath = n; }
+ void setMapDrawType(const int n)
+ { mMapDrawType = n; }
int getCameraMode() const A_WARN_UNUSED
{ return mCameraMode; }
@@ -344,7 +344,7 @@ class Viewport final : public WindowContainer,
int mMousePressY;
int mPixelViewX; /**< Current viewpoint in pixels. */
int mPixelViewY; /**< Current viewpoint in pixels. */
- int mShowDebugPath; /**< Show a path from player to pointer. */
+ int mMapDrawType; /**< Show a path from player to pointer. */
int mCameraMode; /**< Camera mode. */
int mLocalWalkTime; /**< Timestamp before the next walk can be sent. */
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index 4a4c82cf6..bf2e92e0b 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -654,7 +654,7 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar,
player_node->getQuickDropCounterString()))
.append(translateLetter2(player_node->getPickUpTypeString()))
.append(" ").append(translateLetter2(
- LocalPlayer::getDebugPathString()))
+ LocalPlayer::getMapDrawTypeString()))
.append(" ").append(translateLetter2(
player_node->getImitationModeString()))
.append(translateLetter2(LocalPlayer::getCameraModeString()))
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 3d13ba2e5..e588d12bc 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -89,7 +89,7 @@ Map::Map(const int width, const int height,
mTilesets(),
mActors(),
mHasWarps(false),
- mDebugFlags(MapType::NORMAL),
+ mDrawLayersFlags(MapType::NORMAL),
mOnClosedList(1),
mOnOpenList(2),
mBackgrounds(),
@@ -340,7 +340,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
// Draw backgrounds
drawAmbientLayers(graphics, BACKGROUND_LAYERS, mOverlayDetail);
- if (mDebugFlags == MapType::BLACKWHITE && userPalette)
+ if (mDrawLayersFlags == MapType::BLACKWHITE && userPalette)
{
graphics->setColor(userPalette->getColorWithAlpha(
UserPalette::WALKABLE_HIGHLIGHT));
@@ -378,14 +378,16 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
}
#endif
- if (mDebugFlags == MapType::SPECIAL3 || mDebugFlags == MapType::BLACKWHITE)
+ if (mDrawLayersFlags == MapType::SPECIAL3
+ || mDrawLayersFlags == MapType::SPECIAL4
+ || mDrawLayersFlags == MapType::BLACKWHITE)
{
if (mFringeLayer)
{
mFringeLayer->setSpecialLayer(mSpecialLayer);
mFringeLayer->setTempLayer(mTempLayer);
mFringeLayer->drawFringe(graphics, startX, startY, endX, endY,
- scrollX, scrollY, &mActors, mDebugFlags, mActorFixY);
+ scrollX, scrollY, &mActors, mDrawLayersFlags, mActorFixY);
}
}
else
@@ -403,11 +405,11 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
{
layer->setSpecialLayer(mSpecialLayer);
layer->setTempLayer(mTempLayer);
- if (mDebugFlags == MapType::SPECIAL2)
+ if (mDrawLayersFlags == MapType::SPECIAL2)
overFringe = true;
layer->drawFringe(graphics, startX, startY, endX, endY,
- scrollX, scrollY, &mActors, mDebugFlags, mActorFixY);
+ scrollX, scrollY, &mActors, mDrawLayersFlags, mActorFixY);
}
else
{
@@ -419,7 +421,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
if (updateFlag)
{
layer->updateOGL(graphics, startX, startY,
- endX, endY, scrollX, scrollY, mDebugFlags);
+ endX, endY, scrollX, scrollY, mDrawLayersFlags);
}
layer->drawOGL(graphics);
@@ -428,7 +430,7 @@ void Map::draw(Graphics *const graphics, int scrollX, int scrollY)
#endif
{
layer->draw(graphics, startX, startY, endX, endY,
- scrollX, scrollY, mDebugFlags);
+ scrollX, scrollY, mDrawLayersFlags);
}
}
}
diff --git a/src/resources/map/map.h b/src/resources/map/map.h
index e8be23ca4..cf2d0c1e9 100644
--- a/src/resources/map/map.h
+++ b/src/resources/map/map.h
@@ -217,11 +217,11 @@ class Map final : public Properties, public ConfigListener
void addAnimation(const int gid, TileAnimation *const animation)
{ mTileAnimations[gid] = animation; }
- void setDebugFlags(const int n)
- { mDebugFlags = n; }
+ void setDrawLayersFlags(const int n)
+ { mDrawLayersFlags = n; }
- int getDebugFlags() const A_WARN_UNUSED
- { return mDebugFlags; }
+ int getDrawLayersFlags() const A_WARN_UNUSED
+ { return mDrawLayersFlags; }
void addExtraLayer();
@@ -380,7 +380,7 @@ class Map final : public Properties, public ConfigListener
bool mHasWarps;
// debug flags
- int mDebugFlags;
+ int mDrawLayersFlags;
// Pathfinding members
unsigned int mOnClosedList;
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp
index 2b8d4b514..308e27c86 100644
--- a/src/resources/map/maplayer.cpp
+++ b/src/resources/map/maplayer.cpp
@@ -92,7 +92,7 @@ void MapLayer::setTile(const int x, const int y, Image *const img)
void MapLayer::draw(Graphics *const graphics,
int startX, int startY, int endX, int endY,
const int scrollX, const int scrollY,
- const int debugFlags) const
+ const int layerDrawFlags) const
{
if (!player_node)
return;
@@ -114,8 +114,9 @@ void MapLayer::draw(Graphics *const graphics,
const int dx = (mX * mapTileSize) - scrollX;
const int dy = (mY * mapTileSize) - scrollY + mapTileSize;
- const bool flag = (debugFlags != MapType::SPECIAL
- && debugFlags != MapType::SPECIAL2);
+ const bool flag = (layerDrawFlags != MapType::SPECIAL
+ && layerDrawFlags != MapType::SPECIAL2
+ && layerDrawFlags != MapType::SPECIAL4);
for (int y = startY; y < endY; y++)
{
@@ -185,7 +186,7 @@ void MapLayer::updateSDL(const Graphics *const graphics,
int startX, int startY,
int endX, int endY,
const int scrollX, const int scrollY,
- const int debugFlags)
+ const int layerDrawFlags)
{
BLOCK_START("MapLayer::updateSDL")
delete_all(mTempRows);
@@ -207,8 +208,9 @@ void MapLayer::updateSDL(const Graphics *const graphics,
const int dx = (mX * mapTileSize) - scrollX;
const int dy = (mY * mapTileSize) - scrollY + mapTileSize;
- const bool flag = (debugFlags != MapType::SPECIAL
- && debugFlags != MapType::SPECIAL2);
+ const bool flag = (layerDrawFlags != MapType::SPECIAL
+ && layerDrawFlags != MapType::SPECIAL2
+ && layerDrawFlags != MapType::SPECIAL4);
for (int y = startY; y < endY; y++)
{
@@ -250,7 +252,7 @@ void MapLayer::updateOGL(Graphics *const graphics,
int startX, int startY,
int endX, int endY,
const int scrollX, const int scrollY,
- const int debugFlags)
+ const int layerDrawFlags)
{
BLOCK_START("MapLayer::updateOGL")
delete_all(mTempRows);
@@ -272,8 +274,9 @@ void MapLayer::updateOGL(Graphics *const graphics,
const int dx = (mX * mapTileSize) - scrollX;
const int dy = (mY * mapTileSize) - scrollY + mapTileSize;
- const bool flag = (debugFlags != MapType::SPECIAL
- && debugFlags != MapType::SPECIAL2);
+ const bool flag = (layerDrawFlags != MapType::SPECIAL
+ && layerDrawFlags != MapType::SPECIAL2
+ && layerDrawFlags != MapType::SPECIAL4);
MapRowVertexes *const row = new MapRowVertexes();
mTempRows.push_back(row);
@@ -365,7 +368,7 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
int endX, int endY,
const int scrollX, const int scrollY,
const Actors *const actors,
- const int debugFlags, const int yFix) const
+ const int layerDrawFlags, const int yFix) const
{
BLOCK_START("MapLayer::drawFringe")
if (!player_node || !mSpecialLayer || !mTempLayer)
@@ -413,8 +416,9 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
}
BLOCK_END("MapLayer::drawFringe drawmobs")
- if (debugFlags == MapType::SPECIAL3
- || debugFlags == MapType::BLACKWHITE)
+ if (layerDrawFlags == MapType::SPECIAL3
+ || layerDrawFlags == MapType::SPECIAL4
+ || layerDrawFlags == MapType::BLACKWHITE)
{
if (y < specialHeight)
{
@@ -463,8 +467,9 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
{
const int px = x32 + dx;
const int py = py0 - img->mBounds.h;
- if ((debugFlags != MapType::SPECIAL
- && debugFlags != MapType::SPECIAL2)
+ if ((layerDrawFlags != MapType::SPECIAL
+ && layerDrawFlags != MapType::SPECIAL2
+ && layerDrawFlags != MapType::SPECIAL4)
|| img->mBounds.h <= mapTileSize)
{
int width = 0;
@@ -522,7 +527,8 @@ void MapLayer::drawFringe(Graphics *const graphics, int startX, int startY,
}
// Draw any remaining actors
- if (debugFlags != MapType::SPECIAL3)
+ if (layerDrawFlags != MapType::SPECIAL3
+ && layerDrawFlags != MapType::SPECIAL4)
{
BLOCK_START("MapLayer::drawFringe drawmobs")
while (ai != ai_end)
diff --git a/src/resources/map/maplayer.h b/src/resources/map/maplayer.h
index e82aa5870..f91134c77 100644
--- a/src/resources/map/maplayer.h
+++ b/src/resources/map/maplayer.h
@@ -89,7 +89,7 @@ class MapLayer final: public ConfigListener
void draw(Graphics *const graphics,
int startX, int startY, int endX, int endY,
const int scrollX, const int scrollY,
- const int mDebugFlags) const;
+ const int layerDrawFlags) const;
void drawSDL(Graphics *const graphics);
@@ -100,21 +100,21 @@ class MapLayer final: public ConfigListener
int startX, int startY,
int endX, int endY,
const int scrollX, const int scrollY,
- const int mDebugFlags);
+ const int layerDrawFlags);
#endif
void updateSDL(const Graphics *const graphics,
int startX, int startY,
int endX, int endY,
const int scrollX, const int scrollY,
- const int mDebugFlags);
+ const int layerDrawFlags);
void drawFringe(Graphics *const graphics,
int startX, int startY,
int endX, int endY,
const int scrollX, const int scrollY,
const Actors *const actors,
- const int mDebugFlags, const int yFix) const;
+ const int layerDrawFlags, const int yFix) const;
bool isFringeLayer() const A_WARN_UNUSED
{ return mIsFringeLayer; }
diff --git a/src/resources/map/maptype.h b/src/resources/map/maptype.h
index 9580cdd1f..9894fe631 100644
--- a/src/resources/map/maptype.h
+++ b/src/resources/map/maptype.h
@@ -32,7 +32,8 @@ namespace MapType
SPECIAL = 2,
SPECIAL2 = 3,
SPECIAL3 = 4,
- BLACKWHITE = 5
+ SPECIAL4 = 5,
+ BLACKWHITE = 6
};
}