Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh Zone Tool #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Binary file added brushes/refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added brushes/refresh_small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 129 additions & 0 deletions icons/refresh.xpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/* XPM */
static const char *refresh_xpm[] = {
/* columns rows colors chars-per-pixel */
"16 16 107 2 ",
" c None",
". c #321D16",
"X c #5E507A",
"o c #87581D",
"O c #8F5F21",
"+ c #9A6A2B",
"@ c #9C6B2C",
"# c #886534",
"$ c #976E35",
"% c #A4722E",
"& c #AC7935",
"* c #AC7B38",
"= c #B07E3A",
"- c #A03C5D",
"; c #A13062",
": c #874774",
"> c #BB8436",
", c #B1803C",
"< c #BE8C45",
"1 c #C08C42",
"2 c #C79246",
"3 c #CA974D",
"4 c #D49E53",
"5 c #D6A256",
"6 c #DBAF6E",
"7 c #DFB77D",
"8 c #3630A6",
"9 c #3835A0",
"0 c #3831A6",
"q c #3931A6",
"w c #3E34A5",
"e c #4A38A5",
"r c #523CA3",
"t c #4533B1",
"y c #4533B2",
"u c #4435B3",
"i c #52498D",
"p c #4A4699",
"a c #524794",
"s c #614486",
"d c #6D4285",
"f c #6A4788",
"g c #6D4B8C",
"h c #634C98",
"j c #5E5EB7",
"k c #7E63A7",
"l c #6B5FCD",
"z c #6F63CE",
"x c #7768C5",
"c c #7064CF",
"v c #7166CF",
"b c #7368CF",
"n c #776ACD",
"m c #766AD0",
"M c #786CD1",
"N c #786DD1",
"B c #923B94",
"V c #BC78B1",
"C c #9170C7",
"Z c #938DAB",
"A c #AEACB3",
"S c #E2BC86",
"D c #C0B4A0",
"F c #E4C18F",
"G c #8283C2",
"H c #998ECF",
"J c #8C80D6",
"K c #8F84D8",
"L c #9186D9",
"P c #9C90DB",
"I c #9F95DE",
"U c #A59DC9",
"Y c #A097DE",
"T c #A298DF",
"R c #A399DF",
"E c #A59BDE",
"W c #A59BDF",
"Q c #BA9EDC",
"! c #A6A0D3",
"~ c #A99EE0",
"^ c #ACA1E0",
"/ c #ADA3E0",
"( c #ACA2E1",
") c #AEA3E0",
"_ c #B1A7E3",
"` c #B2A8E3",
"' c #B5AAE3",
"] c #B6ABE3",
"[ c #B6AEE4",
"{ c #B9B0E6",
"} c #BDB2E6",
"| c #BEB4E6",
" . c #BEB4E7",
".. c #C998D7",
"X. c #C1B6E7",
"o. c #C0B7E7",
"O. c #C2B8E7",
"+. c #C1B9E9",
"@. c #C4BAE8",
"#. c #C7BDE9",
"$. c #C9BFE9",
"%. c #CCC1EB",
"&. c #CCC3EB",
"*. c #CFC5EC",
"=. c #CFC6EC",
"-. c #D2C9ED",
";. c #FBF7EF",
/* pixels */
" ",
" X i h f + o o ",
" 9 j %.[ N i ;.> o ",
" : w q q 8 G &.-. .+.A S % ",
" g #.X.X.%.&.' @.R Q $ F O ",
" a ^ v z K I { | R H & 6 o ",
" p ( v m K ~ o.` I U 1 7 o ",
"- ! P m M K ~ &.| { Z 5 2 o ",
"; ] c l J ` | / x C A 5 = o ",
"B ~ ! ( ] n u k ..V . 4 + ",
"d r u t e s @ 5 o ",
" o , 5 o ",
" o 3 5 o ",
" o 5 < o ",
" o 5 * ",
" o o o "
};
3 changes: 3 additions & 0 deletions source/artprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "../icons/position_go.xpm"
#include "../icons/protected_zone.xpm"
#include "../icons/pvp_zone.xpm"
#include "../icons/refresh.xpm"
#include "../icons/rectangular_1.xpm"
#include "../icons/rectangular_2.xpm"
#include "../icons/rectangular_3.xpm"
Expand Down Expand Up @@ -66,6 +67,8 @@ wxBitmap ArtProvider::CreateBitmap(const wxArtID& id, const wxArtClient& client,
return wxBitmap(nologout_zone_xpm);
} else if (id == ART_NOPVP_BRUSH) {
return wxBitmap(nopvp_zone_xpm);
} else if (id == ART_REFRESH_BRUSH) {
return wxBitmap(refresh_xpm);
} else if (id == ART_POSITION_GO) {
return wxBitmap(position_go_xpm);
} else if (id == ART_PVP_BRUSH) {
Expand Down
1 change: 1 addition & 0 deletions source/artprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#define ART_CIRCULAR_7 wxART_MAKE_ART_ID(ART_CIRCULAR_7)
#define ART_NOLOOUT_BRUSH wxART_MAKE_ART_ID(ART_NOLOOUT_BRUSH)
#define ART_NOPVP_BRUSH wxART_MAKE_ART_ID(ART_NOPVP_BRUSH)
#define ART_REFRESH_BRUSH wxART_MAKE_ART_ID(ART_REFRESH_BRUSH)
#define ART_POSITION_GO wxART_MAKE_ART_ID(ART_POSITION_GO)
#define ART_PVP_BRUSH wxART_MAKE_ART_ID(ART_PVP_BRUSH)
#define ART_PZ_BRUSH wxART_MAKE_ART_ID(ART_PZ_BRUSH)
Expand Down
1 change: 1 addition & 0 deletions source/browse_tile_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ BrowseTileWindow::BrowseTileWindow(wxWindow* parent, Tile* tile, wxPoint positio
infoSizer->Add(newd wxStaticText(this, wxID_ANY, "No PvP: " + b2yn(tile->getMapFlags() & TILESTATE_NOPVP)), wxSizerFlags(0).Left());
infoSizer->Add(newd wxStaticText(this, wxID_ANY, "No logout: " + b2yn(tile->getMapFlags() & TILESTATE_NOLOGOUT)), wxSizerFlags(0).Left());
infoSizer->Add(newd wxStaticText(this, wxID_ANY, "PvP zone: " + b2yn(tile->getMapFlags() & TILESTATE_PVPZONE)), wxSizerFlags(0).Left());
infoSizer->Add(newd wxStaticText(this, wxID_ANY, "Refresh zone: " + b2yn(tile->getMapFlags() & TILESTATE_REFRESH)), wxSizerFlags(0).Left());
infoSizer->Add(newd wxStaticText(this, wxID_ANY, "House: " + b2yn(tile->isHouseTile())), wxSizerFlags(0).Left());

sizer->Add(infoSizer, wxSizerFlags(0).Left().DoubleBorder());
Expand Down
5 changes: 5 additions & 0 deletions source/brush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ void Brushes::init() {
addBrush(g_gui.rook_brush = newd FlagBrush(TILESTATE_NOPVP));
addBrush(g_gui.nolog_brush = newd FlagBrush(TILESTATE_NOLOGOUT));
addBrush(g_gui.pvp_brush = newd FlagBrush(TILESTATE_PVPZONE));
addBrush(g_gui.refresh_brush = newd FlagBrush(TILESTATE_REFRESH));

GroundBrush::init();
WallBrush::init();
Expand Down Expand Up @@ -256,6 +257,8 @@ std::string FlagBrush::getName() const {
return "No logout zone brush (0x08)";
case TILESTATE_PVPZONE:
return "PVP Zone brush (0x10)";
case TILESTATE_REFRESH:
return "Refresh Zone brush (0x20)";
}
return "Unknown flag brush";
}
Expand All @@ -270,6 +273,8 @@ int FlagBrush::getLookID() const {
return EDITOR_SPRITE_NOLOG_TOOL;
case TILESTATE_PVPZONE:
return EDITOR_SPRITE_PVPZ_TOOL;
case TILESTATE_REFRESH:
return EDITOR_SPRITE_REFRESH_TOOL;
}
return 0;
}
Expand Down
5 changes: 5 additions & 0 deletions source/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,11 @@ bool GraphicManager::loadEditorSprites() {
loadPNGFile(no_pvp_png)
);

sprite_space[EDITOR_SPRITE_REFRESH_TOOL] = newd EditorSprite(
loadPNGFile(refresh_small_png),
loadPNGFile(refresh_png)
);

sprite_space[EDITOR_SPRITE_DOOR_NORMAL] = newd EditorSprite(
newd wxBitmap(door_normal_small_xpm),
newd wxBitmap(door_normal_xpm)
Expand Down
1 change: 1 addition & 0 deletions source/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ class GUI {
FlagBrush* rook_brush;
FlagBrush* nolog_brush;
FlagBrush* pvp_brush;
FlagBrush* refresh_brush;

protected:
//=========================================================================
Expand Down
1 change: 1 addition & 0 deletions source/gui_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ enum EditorActionID {
PALETTE_TERRAIN_NOPVP_TOOL,
PALETTE_TERRAIN_NOLOGOUT_TOOL,
PALETTE_TERRAIN_PVPZONE_TOOL,
PALETTE_TERRAIN_REFRESH_TOOL,

PALETTE_CREATURE_TILESET_CHOICE,
PALETTE_CREATURE_LISTBOX,
Expand Down
8 changes: 8 additions & 0 deletions source/main_toolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ MainToolBar::MainToolBar(wxWindow* parent, wxAuiManager* manager) {
wxBitmap nopvp_bitmap = wxArtProvider::GetBitmap(ART_NOPVP_BRUSH, wxART_TOOLBAR, icon_size);
wxBitmap nologout_bitmap = wxArtProvider::GetBitmap(ART_NOLOOUT_BRUSH, wxART_TOOLBAR, icon_size);
wxBitmap pvp_bitmap = wxArtProvider::GetBitmap(ART_PVP_BRUSH, wxART_TOOLBAR, icon_size);
wxBitmap refresh_bitmap = wxArtProvider::GetBitmap(ART_REFRESH_BRUSH, wxART_TOOLBAR, icon_size);
wxBitmap normal_bitmap = wxArtProvider::GetBitmap(ART_DOOR_NORMAL_SMALL, wxART_TOOLBAR, icon_size);
wxBitmap locked_bitmap = wxArtProvider::GetBitmap(ART_DOOR_LOCKED_SMALL, wxART_TOOLBAR, icon_size);
wxBitmap magic_bitmap = wxArtProvider::GetBitmap(ART_DOOR_MAGIC_SMALL, wxART_TOOLBAR, icon_size);
Expand All @@ -93,6 +94,7 @@ MainToolBar::MainToolBar(wxWindow* parent, wxAuiManager* manager) {
brushes_toolbar->AddTool(PALETTE_TERRAIN_NOPVP_TOOL, wxEmptyString, nopvp_bitmap, wxNullBitmap, wxITEM_CHECK, "No PvP Zone", wxEmptyString, NULL);
brushes_toolbar->AddTool(PALETTE_TERRAIN_NOLOGOUT_TOOL, wxEmptyString, nologout_bitmap, wxNullBitmap, wxITEM_CHECK, "No Logout Zone", wxEmptyString, NULL);
brushes_toolbar->AddTool(PALETTE_TERRAIN_PVPZONE_TOOL, wxEmptyString, pvp_bitmap, wxNullBitmap, wxITEM_CHECK, "PvP Zone", wxEmptyString, NULL);
brushes_toolbar->AddTool(PALETTE_TERRAIN_REFRESH_TOOL, wxEmptyString, refresh_bitmap, wxNullBitmap, wxITEM_CHECK, "Refresh Zone", wxEmptyString, NULL);
brushes_toolbar->AddSeparator();

brushes_toolbar->AddTool(PALETTE_TERRAIN_NORMAL_DOOR, wxEmptyString, normal_bitmap, wxNullBitmap, wxITEM_CHECK, "Normal Door", wxEmptyString, NULL);
Expand Down Expand Up @@ -209,6 +211,7 @@ void MainToolBar::UpdateButtons() {
brushes_toolbar->EnableTool(PALETTE_TERRAIN_NOPVP_TOOL, has_map);
brushes_toolbar->EnableTool(PALETTE_TERRAIN_NOLOGOUT_TOOL, has_map);
brushes_toolbar->EnableTool(PALETTE_TERRAIN_PVPZONE_TOOL, has_map);
brushes_toolbar->EnableTool(PALETTE_TERRAIN_REFRESH_TOOL, has_map);
brushes_toolbar->EnableTool(PALETTE_TERRAIN_NORMAL_DOOR, has_map);
brushes_toolbar->EnableTool(PALETTE_TERRAIN_LOCKED_DOOR, has_map);
brushes_toolbar->EnableTool(PALETTE_TERRAIN_MAGIC_DOOR, has_map);
Expand Down Expand Up @@ -248,6 +251,7 @@ void MainToolBar::UpdateBrushButtons() {
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_NOPVP_TOOL, brush == g_gui.rook_brush);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_NOLOGOUT_TOOL, brush == g_gui.nolog_brush);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_PVPZONE_TOOL, brush == g_gui.pvp_brush);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_REFRESH_TOOL, brush == g_gui.refresh_brush);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_NORMAL_DOOR, brush == g_gui.normal_door_brush);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_LOCKED_DOOR, brush == g_gui.locked_door_brush);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_MAGIC_DOOR, brush == g_gui.magic_door_brush);
Expand All @@ -263,6 +267,7 @@ void MainToolBar::UpdateBrushButtons() {
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_NOPVP_TOOL, false);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_NOLOGOUT_TOOL, false);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_PVPZONE_TOOL, false);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_REFRESH_TOOL, false);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_NORMAL_DOOR, false);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_LOCKED_DOOR, false);
brushes_toolbar->ToggleTool(PALETTE_TERRAIN_MAGIC_DOOR, false);
Expand Down Expand Up @@ -476,6 +481,9 @@ void MainToolBar::OnBrushesButtonClick(wxCommandEvent& event) {
case PALETTE_TERRAIN_PVPZONE_TOOL:
g_gui.SelectBrush(g_gui.pvp_brush);
break;
case PALETTE_TERRAIN_REFRESH_TOOL:
g_gui.SelectBrush(g_gui.refresh_brush);
break;
case PALETTE_TERRAIN_NORMAL_DOOR:
g_gui.SelectBrush(g_gui.normal_door_brush);
break;
Expand Down
9 changes: 9 additions & 0 deletions source/map_drawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ void MapDrawer::DrawMap() {
if (options.show_special_tiles && tile->getMapFlags() & TILESTATE_NOPVP) {
g /= 2;
}
if (options.show_special_tiles && tile->getMapFlags() & TILESTATE_REFRESH) {
g /= 2;
r /= 2;
}
BlitItem(draw_x, draw_y, tile, tile->ground, true, r, g, b, 160);
}

Expand Down Expand Up @@ -1558,6 +1562,11 @@ void MapDrawer::DrawTile(TileLocation* location) {
if (showspecial && tile->getMapFlags() & TILESTATE_NOPVP) {
g /= 2;
}

if (showspecial && tile->getMapFlags() & TILESTATE_REFRESH) {
g /= 2;
r /= 2;
}
}

if (only_colors) {
Expand Down
27 changes: 26 additions & 1 deletion source/palette_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ EVT_TOGGLEBUTTON(PALETTE_TERRAIN_PZ_TOOL, BrushToolPanel::OnClickPZBrushButton)
EVT_TOGGLEBUTTON(PALETTE_TERRAIN_NOPVP_TOOL, BrushToolPanel::OnClickNOPVPBrushButton)
EVT_TOGGLEBUTTON(PALETTE_TERRAIN_NOLOGOUT_TOOL, BrushToolPanel::OnClickNoLogoutBrushButton)
EVT_TOGGLEBUTTON(PALETTE_TERRAIN_PVPZONE_TOOL, BrushToolPanel::OnClickPVPZoneBrushButton)
EVT_TOGGLEBUTTON(PALETTE_TERRAIN_REFRESH_TOOL, BrushToolPanel::OnClickRefreshBrushButton)

EVT_CHECKBOX(PALETTE_TERRAIN_LOCK_DOOR, BrushToolPanel::OnClickLockDoorCheckbox)
END_EVENT_TABLE()
Expand All @@ -422,7 +423,8 @@ BrushToolPanel::BrushToolPanel(wxWindow* parent) :
pzBrushButton(nullptr),
nopvpBrushButton(nullptr),
nologBrushButton(nullptr),
pvpzoneBrushButton(nullptr) {
pvpzoneBrushButton(nullptr),
refreshBrushButton(nullptr) {
////
}

Expand Down Expand Up @@ -494,6 +496,14 @@ void BrushToolPanel::LoadAllContents() {
size_sizer->Add(sub_sizer);
sub_sizer = newd wxBoxSizer(wxHORIZONTAL);

ASSERT(g_gui.refresh_brush);
sub_sizer->Add(refreshBrushButton = newd BrushButton(this, g_gui.refresh_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_REFRESH_TOOL));
refreshBrushButton->SetToolTip("Refresh Zone Tool");

// New row
size_sizer->Add(sub_sizer);
sub_sizer = newd wxBoxSizer(wxHORIZONTAL);

ASSERT(g_gui.normal_door_brush);
sub_sizer->Add(normalDoorButton = newd BrushButton(this, g_gui.normal_door_brush, RENDER_SIZE_32x32, PALETTE_TERRAIN_NORMAL_DOOR));
normalDoorButton->SetToolTip("Normal Door Tool");
Expand Down Expand Up @@ -593,6 +603,10 @@ void BrushToolPanel::LoadAllContents() {
ASSERT(g_gui.pvp_brush);
sub_sizer->Add(pvpzoneBrushButton = newd BrushButton(this, g_gui.pvp_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_PVPZONE_TOOL));
pvpzoneBrushButton->SetToolTip("PVP Zone Tool");

ASSERT(g_gui.refresh_brush);
sub_sizer->Add(refreshBrushButton = newd BrushButton(this, g_gui.refresh_brush, RENDER_SIZE_16x16, PALETTE_TERRAIN_REFRESH_TOOL));
refreshBrushButton->SetToolTip("Refresh Zone Tool");
}

sub_sizer->AddSpacer(large_icons ? 42 : 24);
Expand Down Expand Up @@ -639,6 +653,7 @@ void BrushToolPanel::DeselectAll() {
nopvpBrushButton->SetValue(false);
nologBrushButton->SetValue(false);
pvpzoneBrushButton->SetValue(false);
refreshBrushButton->SetValue(false);
}
}

Expand Down Expand Up @@ -685,6 +700,9 @@ Brush* BrushToolPanel::GetSelectedBrush() const {
if (pvpzoneBrushButton->GetValue()) {
return g_gui.pvp_brush;
}
if (refreshBrushButton->GetValue()) {
return g_gui.refresh_brush;
}
return nullptr;
}

Expand Down Expand Up @@ -718,6 +736,8 @@ bool BrushToolPanel::SelectBrush(const Brush* whatbrush) {
button = nologBrushButton;
} else if (whatbrush == g_gui.pvp_brush) {
button = pvpzoneBrushButton;
} else if (whatbrush == g_gui.refresh_brush) {
button = refreshBrushButton;
}

DeselectAll();
Expand Down Expand Up @@ -827,6 +847,11 @@ void BrushToolPanel::OnClickPVPZoneBrushButton(wxCommandEvent& event) {
g_gui.SelectBrush(g_gui.pvp_brush);
}

void BrushToolPanel::OnClickRefreshBrushButton(wxCommandEvent& event) {
g_gui.ActivatePalette(GetParentPalette());
g_gui.SelectBrush(g_gui.refresh_brush);
}

void BrushToolPanel::OnClickLockDoorCheckbox(wxCommandEvent& event) {
g_gui.ActivatePalette(GetParentPalette());

Expand Down
2 changes: 2 additions & 0 deletions source/palette_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class BrushToolPanel : public PalettePanel {
void OnClickNOPVPBrushButton(wxCommandEvent& event);
void OnClickNoLogoutBrushButton(wxCommandEvent& event);
void OnClickPVPZoneBrushButton(wxCommandEvent& event);
void OnClickRefreshBrushButton(wxCommandEvent& event);
// ----
void OnClickLockDoorCheckbox(wxCommandEvent& event);

Expand All @@ -232,6 +233,7 @@ class BrushToolPanel : public PalettePanel {
BrushButton* nopvpBrushButton;
BrushButton* nologBrushButton;
BrushButton* pvpzoneBrushButton;
BrushButton* refreshBrushButton;

wxCheckBox* lockDoorCheckbox;

Expand Down
Loading