diff --git a/data/menubar.xml b/data/menubar.xml index 1b6c50a9..75bcbbc3 100644 --- a/data/menubar.xml +++ b/data/menubar.xml @@ -152,6 +152,7 @@ + diff --git a/icons/avoidable.png b/icons/avoidable.png new file mode 100644 index 00000000..719249c1 Binary files /dev/null and b/icons/avoidable.png differ diff --git a/icons/avoidable.xpm b/icons/avoidable.xpm new file mode 100644 index 00000000..9a9d2d8d --- /dev/null +++ b/icons/avoidable.xpm @@ -0,0 +1,42 @@ +/* XPM */ +static const char *avoidable_xpm[] = { +/* columns rows colors chars-per-pixel */ +"32 32 4 1 ", +" c black", +". c #ED1C24", +"X c magenta", +"o c white", +/* pixels */ +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", +"XXXX XXXXXXXXXXXX XXXX", +"XXX oooo XXXXXXXXXX oooo XXX", +"XX oooooo XXXXXXXX oooooo XX", +"X ooo ooo XXXXXX ooo ooo X", +"X ooo XX ooo XXXXXX ooo XX ooo X", +"X oo XXXX oo XXXXXX oo XXXX oo X", +"X oo XXXX oo XXXXXX oo XXXX oo X", +"X oo XXXX oo XXXXXX oo XXXX oo X", +"X ooo XX ooo XXXXXX ooo XX ooo X", +"X oo XX oo XXXXXX oo XX oo X", +"XX ooo ooo XXXXXXXX ooo ooo XX", +"XX oooooo XXXXXXXX oooooo XX", +"XXX oooo XXXXXXXXXX oooo XXX", +"XXXX oo XXXXXXXXXXXX oo XXXX", +"XXXXX XX XXXX XX XXXXX", +"XXXXXXXXXX ... XX ... XXXXXXXXXX", +"XXXXXXXXXX ... XX ... XXXXXXXXXX", +"XXXXX .... .... XXXXX", +"XXXXX ooooo ...... ooooo XXXXX", +"XXXXX ooooooo .... ooooooo XXXXX", +"XXXXX oooo .... oooo XXXXX", +"XXXXXXXX ...... XXXXXXXX", +"XXXXXXXXXX .... .... XXXXXXXXXX", +"XXXXXXXXXX ... X ... XXXXXXXXXX", +"XXXXXXXXXX ... XX ... XXXXXXXXXX", +"XXXXXXXXXXX XXXX XXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", +"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" +}; diff --git a/source/artprovider.cpp b/source/artprovider.cpp index 498d2729..e679c8c3 100644 --- a/source/artprovider.cpp +++ b/source/artprovider.cpp @@ -18,6 +18,7 @@ #include "main.h" #include "artprovider.h" +#include "../icons/avoidable.xpm" #include "../icons/circular_1.xpm" #include "../icons/circular_2.xpm" #include "../icons/circular_3.xpm" @@ -158,6 +159,8 @@ wxBitmap ArtProvider::CreateBitmap(const wxArtID &id, const wxArtClient &client, return wxBitmap(moveable_xpm); } else if (id == ART_PICKUPABLE_MOVEABLE) { return wxBitmap(pickupable_moveable_xpm); + } else if (id == ART_AVOIDABLE) { + return wxBitmap(avoidable_xpm); } } diff --git a/source/artprovider.h b/source/artprovider.h index 39c9baa9..e7722cd5 100644 --- a/source/artprovider.h +++ b/source/artprovider.h @@ -52,6 +52,7 @@ #define ART_PICKUPABLE wxART_MAKE_ART_ID(ART_PICKUPABLE) #define ART_MOVEABLE wxART_MAKE_ART_ID(ART_MOVEABLE) #define ART_PICKUPABLE_MOVEABLE wxART_MAKE_ART_ID(ART_PICKUPABLE_MOVEABLE) +#define ART_AVOIDABLE wxART_MAKE_ART_ID(ART_AVOIDABLE) #define ART_MOVE wxART_MAKE_ART_ID(ART_MOVE) #define ART_REMOTE wxART_MAKE_ART_ID(ART_REMOTE) diff --git a/source/graphics.cpp b/source/graphics.cpp index f02cfd67..b99a8e9e 100644 --- a/source/graphics.cpp +++ b/source/graphics.cpp @@ -412,6 +412,7 @@ bool GraphicManager::loadEditorSprites() { sprite_space[EDITOR_SPRITE_PICKUPABLE_ITEM] = GameSprite::createFromBitmap(ART_PICKUPABLE); sprite_space[EDITOR_SPRITE_MOVEABLE_ITEM] = GameSprite::createFromBitmap(ART_MOVEABLE); sprite_space[EDITOR_SPRITE_PICKUPABLE_MOVEABLE_ITEM] = GameSprite::createFromBitmap(ART_PICKUPABLE_MOVEABLE); + sprite_space[EDITOR_SPRITE_AVOIDABLE_ITEM] = GameSprite::createFromBitmap(ART_AVOIDABLE); return true; } diff --git a/source/gui_ids.h b/source/gui_ids.h index ed7eed70..87f75c8c 100644 --- a/source/gui_ids.h +++ b/source/gui_ids.h @@ -195,7 +195,8 @@ enum EditorActionID { TOOLBAR_SIZES_7, TOOLBAR_HOOKS, TOOLBAR_PICKUPABLES, - TOOLBAR_MOVEABLES + TOOLBAR_MOVEABLES, + TOOLBAR_AVOIDABLES }; enum ToolBarID { diff --git a/source/item.h b/source/item.h index 104f4752..7da08537 100644 --- a/source/item.h +++ b/source/item.h @@ -223,6 +223,9 @@ class Item : public ItemAttributes { // Item types bool hasProperty(enum ITEMPROPERTY prop) const; + bool isAvoidable() const { + return getItemType().blockPathfinder; + } bool isBlocking() const { return getItemType().unpassable; } diff --git a/source/main_menubar.cpp b/source/main_menubar.cpp index 571666eb..a0a44930 100644 --- a/source/main_menubar.cpp +++ b/source/main_menubar.cpp @@ -161,6 +161,7 @@ MainMenuBar::MainMenuBar(MainFrame* frame) : MAKE_ACTION(SHOW_WALL_HOOKS, wxITEM_CHECK, OnChangeViewSettings); MAKE_ACTION(SHOW_PICKUPABLES, wxITEM_CHECK, OnChangeViewSettings); MAKE_ACTION(SHOW_MOVEABLES, wxITEM_CHECK, OnChangeViewSettings); + MAKE_ACTION(SHOW_AVOIDABLES, wxITEM_CHECK, OnChangeViewSettings); MAKE_ACTION(WIN_MINIMAP, wxITEM_NORMAL, OnMinimapWindow); MAKE_ACTION(WIN_ACTIONS_HISTORY, wxITEM_NORMAL, OnActionsHistoryWindow); @@ -491,6 +492,7 @@ void MainMenuBar::LoadValues() { CheckItem(SHOW_WALL_HOOKS, g_settings.getBoolean(Config::SHOW_WALL_HOOKS)); CheckItem(SHOW_PICKUPABLES, g_settings.getBoolean(Config::SHOW_PICKUPABLES)); CheckItem(SHOW_MOVEABLES, g_settings.getBoolean(Config::SHOW_MOVEABLES)); + CheckItem(SHOW_AVOIDABLES, g_settings.getBoolean(Config::SHOW_AVOIDABLES)); } void MainMenuBar::LoadRecentFiles() { @@ -537,6 +539,7 @@ void MainMenuBar::UpdateIndicatorsMenu() { CheckItem(SHOW_WALL_HOOKS, g_settings.getBoolean(Config::SHOW_WALL_HOOKS)); CheckItem(SHOW_PICKUPABLES, g_settings.getBoolean(Config::SHOW_PICKUPABLES)); CheckItem(SHOW_MOVEABLES, g_settings.getBoolean(Config::SHOW_MOVEABLES)); + CheckItem(SHOW_AVOIDABLES, g_settings.getBoolean(Config::SHOW_AVOIDABLES)); } bool MainMenuBar::Load(const FileName &path, wxArrayString &warnings, wxString &error) { @@ -2102,6 +2105,7 @@ void MainMenuBar::OnChangeViewSettings(wxCommandEvent &event) { g_settings.setInteger(Config::SHOW_WALL_HOOKS, IsItemChecked(MenuBar::SHOW_WALL_HOOKS)); g_settings.setInteger(Config::SHOW_PICKUPABLES, IsItemChecked(MenuBar::SHOW_PICKUPABLES)); g_settings.setInteger(Config::SHOW_MOVEABLES, IsItemChecked(MenuBar::SHOW_MOVEABLES)); + g_settings.setInteger(Config::SHOW_AVOIDABLES, IsItemChecked(MenuBar::SHOW_AVOIDABLES)); g_gui.RefreshView(); g_gui.root->GetAuiToolBar()->UpdateIndicators(); diff --git a/source/main_menubar.h b/source/main_menubar.h index 0719f90a..c245d995 100644 --- a/source/main_menubar.h +++ b/source/main_menubar.h @@ -123,6 +123,7 @@ namespace MenuBar { SHOW_WALL_HOOKS, SHOW_PICKUPABLES, SHOW_MOVEABLES, + SHOW_AVOIDABLES, WIN_MINIMAP, WIN_ACTIONS_HISTORY, NEW_PALETTE, diff --git a/source/main_toolbar.cpp b/source/main_toolbar.cpp index 02a74d1b..a358d4eb 100644 --- a/source/main_toolbar.cpp +++ b/source/main_toolbar.cpp @@ -156,6 +156,7 @@ MainToolBar::MainToolBar(wxWindow* parent, wxAuiManager* manager) { indicators_toolbar->ToggleTool(TOOLBAR_HOOKS, g_settings.getBoolean(Config::SHOW_WALL_HOOKS)); indicators_toolbar->ToggleTool(TOOLBAR_PICKUPABLES, g_settings.getBoolean(Config::SHOW_PICKUPABLES)); indicators_toolbar->ToggleTool(TOOLBAR_MOVEABLES, g_settings.getBoolean(Config::SHOW_MOVEABLES)); + indicators_toolbar->ToggleTool(TOOLBAR_AVOIDABLES, g_settings.getBoolean(Config::SHOW_AVOIDABLES)); manager->AddPane(standard_toolbar, wxAuiPaneInfo().Name(STANDARD_BAR_NAME).ToolbarPane().Top().Row(1).Position(1).Floatable(false)); manager->AddPane(brushes_toolbar, wxAuiPaneInfo().Name(BRUSHES_BAR_NAME).ToolbarPane().Top().Row(1).Position(2).Floatable(false)); @@ -285,6 +286,7 @@ void MainToolBar::UpdateIndicators() { indicators_toolbar->ToggleTool(TOOLBAR_HOOKS, g_settings.getBoolean(Config::SHOW_WALL_HOOKS)); indicators_toolbar->ToggleTool(TOOLBAR_PICKUPABLES, g_settings.getBoolean(Config::SHOW_PICKUPABLES)); indicators_toolbar->ToggleTool(TOOLBAR_MOVEABLES, g_settings.getBoolean(Config::SHOW_MOVEABLES)); + indicators_toolbar->ToggleTool(TOOLBAR_AVOIDABLES, g_settings.getBoolean(Config::SHOW_AVOIDABLES)); g_gui.GetAuiManager()->Update(); } @@ -628,6 +630,11 @@ void MainToolBar::OnIndicatorsButtonClick(wxCommandEvent &event) { g_gui.root->UpdateIndicatorsMenu(); g_gui.RefreshView(); break; + case TOOLBAR_AVOIDABLES: + g_settings.setInteger(Config::SHOW_AVOIDABLES, toggled); + g_gui.root->UpdateIndicatorsMenu(); + g_gui.RefreshView(); + break; default: break; } diff --git a/source/map_display.cpp b/source/map_display.cpp index 1bbbf863..d4fb8652 100644 --- a/source/map_display.cpp +++ b/source/map_display.cpp @@ -222,6 +222,7 @@ void MapCanvas::OnPaint(wxPaintEvent &event) { options.show_hooks = g_settings.getBoolean(Config::SHOW_WALL_HOOKS); options.show_pickupables = g_settings.getBoolean(Config::SHOW_PICKUPABLES); options.show_moveables = g_settings.getBoolean(Config::SHOW_MOVEABLES); + options.show_avoidables = g_settings.getBoolean(Config::SHOW_AVOIDABLES); options.hide_items_when_zoomed = g_settings.getBoolean(Config::HIDE_ITEMS_WHEN_ZOOMED); } diff --git a/source/map_drawer.cpp b/source/map_drawer.cpp index e04e5b34..d05b8370 100644 --- a/source/map_drawer.cpp +++ b/source/map_drawer.cpp @@ -79,6 +79,7 @@ void DrawingOptions::SetDefault() { show_hooks = false; show_pickupables = false; show_moveables = false; + show_avoidables = false; hide_items_when_zoomed = true; } @@ -112,6 +113,7 @@ void DrawingOptions::SetIngame() { show_hooks = false; show_pickupables = false; show_moveables = false; + show_avoidables = false; hide_items_when_zoomed = false; } @@ -1736,12 +1738,13 @@ void MapDrawer::DrawTileIndicators(TileLocation* location) { int x, y; getDrawPosition(location->getPosition(), x, y); - if (zoom < 10.0 && (options.show_pickupables || options.show_moveables)) { + if (zoom < 10.0 && (options.show_pickupables || options.show_moveables || options.show_avoidables)) { uint8_t red = 0xFF, green = 0xFF, blue = 0xFF; if (tile->isHouseTile()) { green = 0x00; blue = 0x00; } + for (const Item* item : tile->items) { const ItemType &type = g_items.getItemType(item->getID()); if ((type.pickupable && options.show_pickupables) || (type.moveable && options.show_moveables)) { @@ -1753,9 +1756,17 @@ void MapDrawer::DrawTileIndicators(TileLocation* location) { DrawIndicator(x, y, EDITOR_SPRITE_MOVEABLE_ITEM, red, green, blue); } } + + if (type.blockPathfinder && options.show_avoidables) { + DrawIndicator(x, y, EDITOR_SPRITE_AVOIDABLE_ITEM, red, green, blue); + } } } + if (options.show_avoidables && tile->ground && tile->ground->isAvoidable()) { + DrawIndicator(x, y, EDITOR_SPRITE_AVOIDABLE_ITEM); + } + if (options.show_houses && tile->isHouseExit()) { if (tile->hasHouseExit(current_house_id)) { DrawIndicator(x, y, EDITOR_SPRITE_HOUSE_EXIT); diff --git a/source/map_drawer.h b/source/map_drawer.h index 183c3471..9912ced4 100644 --- a/source/map_drawer.h +++ b/source/map_drawer.h @@ -84,6 +84,7 @@ struct DrawingOptions { bool show_hooks; bool show_pickupables; bool show_moveables; + bool show_avoidables; bool hide_items_when_zoomed; }; diff --git a/source/settings.h b/source/settings.h index f4d18753..3df62478 100644 --- a/source/settings.h +++ b/source/settings.h @@ -62,6 +62,7 @@ namespace Config { SHOW_WALL_HOOKS, SHOW_PICKUPABLES, SHOW_MOVEABLES, + SHOW_AVOIDABLES, SHOW_AS_MINIMAP, SHOW_ONLY_TILEFLAGS, SHOW_ONLY_MODIFIED_TILES, diff --git a/source/sprites.h b/source/sprites.h index 38579c80..edc4b3e1 100644 --- a/source/sprites.h +++ b/source/sprites.h @@ -63,6 +63,7 @@ enum { EDITOR_SPRITE_PICKUPABLE_ITEM, EDITOR_SPRITE_MOVEABLE_ITEM, EDITOR_SPRITE_PICKUPABLE_MOVEABLE_ITEM, + EDITOR_SPRITE_AVOIDABLE_ITEM, EDITOR_SPRITE_LAST };