summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/windows/chatwindow.cpp12
-rw-r--r--src/gui/windows/chatwindow.h2
-rw-r--r--src/gui/windows/debugwindow.cpp18
-rw-r--r--src/gui/windows/debugwindow.h2
-rw-r--r--src/gui/windows/equipmentwindow.cpp2
-rw-r--r--src/gui/windows/minimap.cpp13
-rw-r--r--src/gui/windows/minimap.h4
-rw-r--r--src/gui/windows/outfitwindow.cpp56
-rw-r--r--src/gui/windows/outfitwindow.h2
9 files changed, 110 insertions, 1 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index f4641670d..824ba4882 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -2081,6 +2081,18 @@ void ChatWindow::draw(Graphics* graphics)
BLOCK_END("ChatWindow::draw")
}
+void ChatWindow::safeDraw(Graphics* graphics)
+{
+ BLOCK_START("ChatWindow::draw")
+ if (!mAutoHide || mHaveMouse)
+ {
+ GLDEBUG_START("ChatWindow::draw");
+ Window::safeDraw(graphics);
+ GLDEBUG_END();
+ }
+ BLOCK_END("ChatWindow::draw")
+}
+
void ChatWindow::updateVisibility()
{
if (!gui)
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index 3077b9e8b..e8d920897 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -282,6 +282,8 @@ class ChatWindow final : public Window,
void draw(Graphics* graphics) override final;
+ void safeDraw(Graphics* graphics) override final;
+
void updateVisibility();
void unHideWindow();
diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp
index e0d73249b..185e4adab 100644
--- a/src/gui/windows/debugwindow.cpp
+++ b/src/gui/windows/debugwindow.cpp
@@ -134,6 +134,24 @@ void DebugWindow::draw(Graphics *g)
BLOCK_END("DebugWindow::draw")
}
+void DebugWindow::safeDraw(Graphics *g)
+{
+ BLOCK_START("DebugWindow::draw")
+ Window::safeDraw(g);
+
+ if (localPlayer)
+ {
+ const Being *const target = localPlayer->getTarget();
+ if (target)
+ {
+ target->draw(g, -target->getPixelX() + mapTileSize / 2
+ + mDimension.width / 2, -target->getPixelY() + mapTileSize
+ + mDimension.height / 2);
+ }
+ }
+ BLOCK_END("DebugWindow::draw")
+}
+
void DebugWindow::widgetResized(const Event &event)
{
Window::widgetResized(event);
diff --git a/src/gui/windows/debugwindow.h b/src/gui/windows/debugwindow.h
index 9a0b2fe5c..5496852f6 100644
--- a/src/gui/windows/debugwindow.h
+++ b/src/gui/windows/debugwindow.h
@@ -56,6 +56,8 @@ class DebugWindow final : public Window
void draw(Graphics *g) override final;
+ void safeDraw(Graphics *g) override final;
+
void setPing(int pingTime);
void widgetResized(const Event &event) override final;
diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp
index c856433ba..d569c3cc2 100644
--- a/src/gui/windows/equipmentwindow.cpp
+++ b/src/gui/windows/equipmentwindow.cpp
@@ -267,7 +267,7 @@ void EquipmentWindow::safeDraw(Graphics *graphics)
{
BLOCK_START("EquipmentWindow::draw")
// Draw window graphics
- Window::draw(graphics);
+ Window::safeDraw(graphics);
int i = 0;
Font *const font = getFont();
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index bdf9c37be..6b2a8547a 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -237,8 +237,21 @@ void Minimap::toggle()
void Minimap::draw(Graphics *graphics)
{
BLOCK_START("Minimap::draw")
+
Window::draw(graphics);
+ draw2(graphics);
+}
+
+void Minimap::safeDraw(Graphics *graphics)
+{
+ BLOCK_START("Minimap::draw")
+
+ Window::safeDraw(graphics);
+ draw2(graphics);
+}
+void Minimap::draw2(Graphics *const graphics)
+{
if (!userPalette || !localPlayer || !viewport)
{
BLOCK_END("Minimap::draw")
diff --git a/src/gui/windows/minimap.h b/src/gui/windows/minimap.h
index 8d7ffc2a8..8c7150080 100644
--- a/src/gui/windows/minimap.h
+++ b/src/gui/windows/minimap.h
@@ -61,6 +61,10 @@ class Minimap final : public Window, public ConfigListener
*/
void draw(Graphics *graphics) override final;
+ void safeDraw(Graphics *graphics) override final;
+
+ void draw2(Graphics *const graphics);
+
void mouseMoved(MouseEvent &event) override final;
void mouseReleased(MouseEvent &event) override final;
diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp
index 896136bb3..e1f2c3b42 100644
--- a/src/gui/windows/outfitwindow.cpp
+++ b/src/gui/windows/outfitwindow.cpp
@@ -374,6 +374,62 @@ void OutfitWindow::draw(Graphics *graphics)
BLOCK_END("OutfitWindow::draw")
}
+void OutfitWindow::safeDraw(Graphics *graphics)
+{
+ BLOCK_START("OutfitWindow::draw")
+ Window::safeDraw(graphics);
+
+ if (mCurrentOutfit < 0 || mCurrentOutfit
+ >= static_cast<signed int>(OUTFITS_COUNT))
+ {
+ return;
+ }
+
+ for (unsigned int i = 0; i < OUTFIT_ITEM_COUNT; i++)
+ {
+ const int itemX = mPadding + ((i % mGridWidth) * mBoxWidth);
+ const int itemY = mPadding + mTitleBarHeight
+ + ((i / static_cast<unsigned int>(mGridWidth)) * mBoxHeight);
+
+ graphics->setColor(mBorderColor);
+ graphics->drawRectangle(Rect(itemX, itemY, 32, 32));
+ graphics->setColor(mBackgroundColor);
+ graphics->fillRectangle(Rect(itemX, itemY, 32, 32));
+
+ if (mItems[mCurrentOutfit][i] < 0)
+ continue;
+
+ bool foundItem = false;
+ const Inventory *const inv = PlayerInfo::getInventory();
+ if (inv)
+ {
+ const Item *const item = inv->findItem(mItems[mCurrentOutfit][i],
+ mItemColors[mCurrentOutfit][i]);
+ if (item)
+ {
+ // Draw item icon.
+ const Image *const image = item->getImage();
+ if (image)
+ {
+ graphics->drawImage(image, itemX, itemY);
+ foundItem = true;
+ }
+ }
+ }
+ if (!foundItem)
+ {
+ Image *const image = Item::getImage(mItems[mCurrentOutfit][i],
+ mItemColors[mCurrentOutfit][i]);
+ if (image)
+ {
+ graphics->drawImage(image, itemX, itemY);
+ image->decRef();
+ }
+ }
+ }
+ BLOCK_END("OutfitWindow::draw")
+}
+
void OutfitWindow::mouseDragged(MouseEvent &event)
{
if (event.getButton() == MouseButton::LEFT)
diff --git a/src/gui/windows/outfitwindow.h b/src/gui/windows/outfitwindow.h
index defaf4c4d..b27bd7d4a 100644
--- a/src/gui/windows/outfitwindow.h
+++ b/src/gui/windows/outfitwindow.h
@@ -54,6 +54,8 @@ class OutfitWindow final : public Window,
void draw(Graphics *graphics) override final;
+ void safeDraw(Graphics *graphics) override final;
+
void mousePressed(MouseEvent &event) override final;
void mouseDragged(MouseEvent &event) override final;