Map Editor

RD Core / Commit #3

Commit Map Editor

Alex Alex committed 18/10/2026 23:40 main Patch
436 files +250,791 -0
A RD_Map_Editor/source/pngfiles.h +77-0 View file
@@ -0,0 +1,77 @@
1+//////////////////////////////////////////////////////////////////////
2+// This file is part of Remere's Map Editor
3+//////////////////////////////////////////////////////////////////////
4+// Remere's Map Editor is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// Remere's Map Editor is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+//////////////////////////////////////////////////////////////////////
17+
18+#ifndef RME_PNG_HEADER_FILE_H_
19+#define RME_PNG_HEADER_FILE_H_
20+
21+extern unsigned char circular_1_png[453];
22+extern unsigned char circular_1_small_png[253];
23+extern unsigned char circular_2_png[643];
24+extern unsigned char circular_2_small_png[318];
25+extern unsigned char circular_3_png[796];
26+extern unsigned char circular_3_small_png[398];
27+extern unsigned char circular_4_png[1076];
28+extern unsigned char circular_4_small_png[501];
29+extern unsigned char circular_5_png[1230];
30+extern unsigned char circular_5_small_png[600];
31+extern unsigned char circular_6_png[1467];
32+extern unsigned char circular_6_small_png[678];
33+extern unsigned char circular_7_png[1563];
34+extern unsigned char circular_7_small_png[740];
35+extern unsigned char door_locked_png[752];
36+extern unsigned char door_locked_small_png[552];
37+extern unsigned char door_magic_png[761];
38+extern unsigned char door_magic_small_png[552];
39+extern unsigned char door_normal_png[748];
40+extern unsigned char door_normal_small_png[552];
41+extern unsigned char door_quest_png[764];
42+extern unsigned char door_quest_small_png[552];
43+extern unsigned char eraser_png[878];
44+extern unsigned char eraser_small_png[667];
45+extern unsigned char gem_edit_png[697];
46+extern unsigned char gem_move_png[662];
47+extern unsigned char no_logout_png[782];
48+extern unsigned char no_logout_small_png[670];
49+extern unsigned char no_pvp_png[726];
50+extern unsigned char no_pvp_small_png[630];
51+extern unsigned char optional_border_png[768];
52+extern unsigned char optional_border_small_png[544];
53+extern unsigned char protection_zone_png[961];
54+extern unsigned char protection_zone_small_png[687];
55+extern unsigned char pvp_zone_png[677];
56+extern unsigned char pvp_zone_small_png[620];
57+extern unsigned char rectangular_1_png[353];
58+extern unsigned char rectangular_1_small_png[250];
59+extern unsigned char rectangular_2_png[393];
60+extern unsigned char rectangular_2_small_png[248];
61+extern unsigned char rectangular_3_png[424];
62+extern unsigned char rectangular_3_small_png[276];
63+extern unsigned char rectangular_4_png[483];
64+extern unsigned char rectangular_4_small_png[333];
65+extern unsigned char rectangular_5_png[535];
66+extern unsigned char rectangular_5_small_png[375];
67+extern unsigned char rectangular_6_png[600];
68+extern unsigned char rectangular_6_small_png[431];
69+extern unsigned char rectangular_7_png[697];
70+extern unsigned char rectangular_7_small_png[429];
71+extern unsigned char window_hatch_png[910];
72+extern unsigned char window_hatch_small_png[641];
73+extern unsigned char window_normal_png[947];
74+extern unsigned char window_normal_small_png[641];
75+extern unsigned char zone_brush_small_png[603];
76+extern unsigned char zone_brush_zone_png[832];
77+#endif //_RME_PNG_HEADER_FILE_H_
A RD_Map_Editor/source/position.h +151-0 View file
@@ -0,0 +1,151 @@
1+//////////////////////////////////////////////////////////////////////
2+// This file is part of Remere's Map Editor
3+//////////////////////////////////////////////////////////////////////
4+// Remere's Map Editor is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// Remere's Map Editor is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+//////////////////////////////////////////////////////////////////////
17+
18+#ifndef __POSITION_HPP__
19+#define __POSITION_HPP__
20+
21+#include <ostream>
22+#include <cstdint>
23+#include <vector>
24+#include <list>
25+
26+class SmallPosition;
27+
28+class Position {
29+public:
30+ // We use int since it's the native machine type and can be several times faster than
31+ // the other integer types in most cases, also, the position may be negative in some
32+ // cases
33+ int x, y, z;
34+
35+ Position() :
36+ x(0), y(0), z(0) { }
37+ Position(int _x, int _y, int _z) :
38+ x(_x), y(_y), z(_z) { }
39+
40+ bool operator<(const Position& p) const {
41+ if (z < p.z) {
42+ return true;
43+ }
44+ if (z > p.z) {
45+ return false;
46+ }
47+
48+ if (y < p.y) {
49+ return true;
50+ }
51+ if (y > p.y) {
52+ return false;
53+ }
54+
55+ if (x < p.x) {
56+ return true;
57+ }
58+ // if(x > p.x)
59+ // return false;
60+
61+ return false;
62+ }
63+
64+ bool operator>(const Position& p) const {
65+ return !(*this < p);
66+ }
67+
68+ Position operator-(const Position& p) const {
69+ Position newpos;
70+ newpos.x = x - p.x;
71+ newpos.y = y - p.y;
72+ newpos.z = z - p.z;
73+ return newpos;
74+ }
75+
76+ Position operator+(const Position& p) const {
77+ Position newpos;
78+ newpos.x = x + p.x;
79+ newpos.y = y + p.y;
80+ newpos.z = z + p.z;
81+ return newpos;
82+ }
83+
84+ Position& operator+=(const Position& p) {
85+ *this = *this + p;
86+ return *this;
87+ }
88+
89+ bool operator==(const Position& p) const {
90+ return p.x == x && p.y == y && p.z == z;
91+ }
92+
93+ bool operator!=(const Position& p) const {
94+ return !(*this == p);
95+ }
96+
97+ bool isValid() const;
98+};
99+
100+inline std::ostream& operator<<(std::ostream& os, const Position& pos) {
101+ os << pos.x << ':' << pos.y << ':' << pos.z;
102+ return os;
103+}
104+
105+inline std::istream& operator>>(std::istream& is, Position& pos) {
106+ char a, b;
107+ int x, y, z;
108+ is >> x;
109+ if (!is) {
110+ return is;
111+ }
112+ is >> a;
113+ if (!is || a != ':') {
114+ return is;
115+ }
116+ is >> y;
117+ if (!is) {
118+ return is;
119+ }
120+ is >> b;
121+ if (!is || b != ':') {
122+ return is;
123+ }
124+ is >> z;
125+ if (!is) {
126+ return is;
127+ }
128+
129+ pos.x = x;
130+ pos.y = y;
131+ pos.z = z;
132+
133+ return is;
134+}
135+
136+inline bool Position::isValid() const {
137+ return x >= 0 && x <= MAP_MAX_WIDTH && y >= 0 && y <= MAP_MAX_HEIGHT && z >= 0 && z <= MAP_MAX_LAYER;
138+}
139+
140+inline Position abs(const Position& position) {
141+ return Position(
142+ std::abs(position.x),
143+ std::abs(position.y),
144+ std::abs(position.z)
145+ );
146+}
147+
148+typedef std::vector<Position> PositionVector;
149+typedef std::list<Position> PositionList;
150+
151+#endif
A RD_Map_Editor/source/positionctrl.cpp +72-0 View file
@@ -0,0 +1,72 @@
1+//////////////////////////////////////////////////////////////////////
2+// This file is part of Remere's Map Editor
3+//////////////////////////////////////////////////////////////////////
4+// Remere's Map Editor is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// Remere's Map Editor is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+//////////////////////////////////////////////////////////////////////
17+
18+#include "main.h"
19+#include "positionctrl.h"
20+#include "numbertextctrl.h"
21+#include "position.h"
22+
23+PositionCtrl::PositionCtrl(wxWindow* parent, const wxString& label, int x, int y, int z, int maxx /*= MAP_MAX_WIDTH*/, int maxy /*= MAP_MAX_HEIGHT*/, int maxz /*= MAP_MAX_LAYER*/) :
24+ wxStaticBoxSizer(wxHORIZONTAL, parent, label) {
25+ x_field = newd NumberTextCtrl(parent, wxID_ANY, x, 0, maxx, wxTE_PROCESS_ENTER, "X", wxDefaultPosition, wxSize(60, 20));
26+ x_field->Bind(wxEVT_TEXT_PASTE, &PositionCtrl::OnClipboardText, this);
27+ Add(x_field, 2, wxEXPAND | wxLEFT | wxBOTTOM, 5);
28+
29+ y_field = newd NumberTextCtrl(parent, wxID_ANY, y, 0, maxy, wxTE_PROCESS_ENTER, "Y", wxDefaultPosition, wxSize(60, 20));
30+ y_field->Bind(wxEVT_TEXT_PASTE, &PositionCtrl::OnClipboardText, this);
31+ Add(y_field, 2, wxEXPAND | wxLEFT | wxBOTTOM, 5);
32+
33+ z_field = newd NumberTextCtrl(parent, wxID_ANY, z, 0, maxz, wxTE_PROCESS_ENTER, "Z", wxDefaultPosition, wxSize(35, 20));
34+ z_field->Bind(wxEVT_TEXT_PASTE, &PositionCtrl::OnClipboardText, this);
35+ Add(z_field, 1, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
36+
37+ maxWidth = maxx;
38+ maxHeight = maxy;
39+}
40+
41+PositionCtrl::~PositionCtrl() {
42+ ////
43+}
44+
45+Position PositionCtrl::GetPosition() const {
46+ Position pos;
47+ pos.x = x_field->GetIntValue();
48+ pos.y = y_field->GetIntValue();
49+ pos.z = z_field->GetIntValue();
50+ return pos;
51+}
52+
53+void PositionCtrl::SetPosition(Position pos) {
54+ x_field->SetIntValue(pos.x);
55+ y_field->SetIntValue(pos.y);
56+ z_field->SetIntValue(pos.z);
57+}
58+
59+bool PositionCtrl::Enable(bool enable) {
60+ return (x_field->Enable(enable) && y_field->Enable(enable) && z_field->Enable(enable));
61+}
62+
63+void PositionCtrl::OnClipboardText(wxClipboardTextEvent& evt) {
64+ Position position;
65+ if (posFromClipboard(position, maxWidth, maxHeight)) {
66+ x_field->SetIntValue(position.x);
67+ y_field->SetIntValue(position.y);
68+ z_field->SetIntValue(position.z);
69+ } else {
70+ evt.Skip();
71+ }
72+}
A RD_Map_Editor/source/positionctrl.h +63-0 View file
@@ -0,0 +1,63 @@
1+//////////////////////////////////////////////////////////////////////
2+// This file is part of Remere's Map Editor
3+//////////////////////////////////////////////////////////////////////
4+// Remere's Map Editor is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// Remere's Map Editor is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+//////////////////////////////////////////////////////////////////////
17+
18+#ifndef _RME_POSITION_CTRL_H_
19+#define _RME_POSITION_CTRL_H_
20+
21+#include "numbertextctrl.h"
22+
23+class PositionCtrl : public wxStaticBoxSizer {
24+public:
25+ PositionCtrl(wxWindow* parent, const wxString& label, int x, int y, int z, int maxx = MAP_MAX_WIDTH, int maxy = MAP_MAX_HEIGHT, int maxz = MAP_MAX_LAYER);
26+ ~PositionCtrl();
27+
28+ long GetX() const {
29+ return x_field->GetIntValue();
30+ }
31+ long GetY() const {
32+ return y_field->GetIntValue();
33+ }
34+ long GetZ() const {
35+ return z_field->GetIntValue();
36+ }
37+ Position GetPosition() const;
38+
39+ void SetX(long value) {
40+ x_field->SetIntValue(value);
41+ }
42+ void SetY(long value) {
43+ y_field->SetIntValue(value);
44+ }
45+ void SetZ(long value) {
46+ z_field->SetIntValue(value);
47+ }
48+ void SetPosition(Position pos);
49+
50+ bool Enable(bool enable = true);
51+
52+ void OnClipboardText(wxClipboardTextEvent&);
53+
54+protected:
55+ NumberTextCtrl* x_field;
56+ NumberTextCtrl* y_field;
57+ NumberTextCtrl* z_field;
58+
59+private:
60+ int maxWidth, maxHeight;
61+};
62+
63+#endif
A RD_Map_Editor/source/preferences.h +178-0 View file
@@ -0,0 +1,178 @@
1+//////////////////////////////////////////////////////////////////////
2+// This file is part of Remere's Map Editor
3+//////////////////////////////////////////////////////////////////////
4+// Remere's Map Editor is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// Remere's Map Editor is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+//////////////////////////////////////////////////////////////////////
17+
18+#ifndef RME_PREFERENCES_WINDOW_H_
19+#define RME_PREFERENCES_WINDOW_H_
20+
21+#include "main.h"
22+#include <wx/listbook.h>
23+#include <wx/collpane.h>
24+#include <wx/clrpicker.h>
25+#include "gui.h"
26+
27+class PreferencesWindow : public wxDialog {
28+public:
29+ explicit PreferencesWindow(wxWindow* parent) :
30+ PreferencesWindow(parent, false) {};
31+ PreferencesWindow(wxWindow* parent, bool clientVersionSelected);
32+ virtual ~PreferencesWindow();
33+
34+ void OnClickDefaults(wxCommandEvent&);
35+ void OnClickApply(wxCommandEvent&);
36+ void OnClickOK(wxCommandEvent&);
37+ void OnClickCancel(wxCommandEvent&);
38+
39+ void OnCollapsiblePane(wxCollapsiblePaneEvent&);
40+
41+ void UpdateClientOverride();
42+
43+protected:
44+ void SetDefaults();
45+ void Apply();
46+ void SaveValues();
47+
48+ wxBookCtrl* book;
49+
50+ // General
51+ wxCheckBox* always_make_backup_chkbox;
52+ wxCheckBox* create_on_startup_chkbox;
53+ wxCheckBox* update_check_on_startup_chkbox;
54+ wxCheckBox* only_one_instance_chkbox;
55+ wxCheckBox* show_welcome_dialog_chkbox;
56+ wxCheckBox* enable_tileset_editing_chkbox;
57+ wxSpinCtrl* undo_size_spin;
58+ wxSpinCtrl* undo_mem_size_spin;
59+ wxSpinCtrl* worker_threads_spin;
60+ wxSpinCtrl* replace_size_spin;
61+ wxRadioBox* position_format;
62+
63+ // Editor
64+ wxCheckBox* group_actions_chkbox;
65+ wxCheckBox* duplicate_id_warn_chkbox;
66+ wxCheckBox* house_remove_chkbox;
67+ wxCheckBox* auto_assign_doors_chkbox;
68+ wxCheckBox* eraser_leave_unique_chkbox;
69+ wxCheckBox* doodad_erase_same_chkbox;
70+ wxCheckBox* auto_create_spawn_chkbox;
71+ wxCheckBox* allow_multiple_orderitems_chkbox;
72+ wxCheckBox* merge_move_chkbox;
73+ wxCheckBox* merge_paste_chkbox;
74+
75+ // Graphics
76+ wxCheckBox* icon_selection_shadow_chkbox;
77+ wxChoice* icon_background_choice;
78+ wxCheckBox* use_memcached_chkbox;
79+ wxDirPickerCtrl* screenshot_directory_picker;
80+ wxChoice* screenshot_format_choice;
81+ wxCheckBox* hide_items_when_zoomed_chkbox;
82+ wxColourPickerCtrl* cursor_color_pick;
83+ wxColourPickerCtrl* cursor_alt_color_pick;
84+ wxCheckBox* dark_mode_chkbox;
85+ wxCheckBox* dark_mode_color_enabled_chkbox;
86+ wxColourPickerCtrl* dark_mode_color_pick;
87+ /*
88+ wxCheckBox* texture_managment_chkbox;
89+ wxSpinCtrl* clean_interval_spin;
90+ wxSpinCtrl* texture_longevity_spin;
91+ wxSpinCtrl* texture_threshold_spin;
92+ wxSpinCtrl* software_threshold_spin;
93+ wxSpinCtrl* software_clean_amount_spin;
94+ */
95+
96+ // Automagic
97+ wxCheckBox* automagic_enabled_chkbox;
98+ wxCheckBox* same_ground_type_chkbox;
99+ wxCheckBox* walls_repel_borders_chkbox;
100+ wxCheckBox* layer_carpets_chkbox;
101+ wxCheckBox* borderize_delete_chkbox;
102+ wxCheckBox* borderize_paste_chkbox;
103+ wxCheckBox* borderize_drag_chkbox;
104+ wxSpinCtrl* borderize_drag_threshold_spin;
105+ wxSpinCtrl* borderize_paste_threshold_spin;
106+
107+ wxCheckBox* custom_border_checkbox;
108+ wxStaticText* custom_border_id_label;
109+ wxSpinCtrl* custom_border_id_spin;
110+
111+ // Interface
112+ wxChoice* terrain_palette_style_choice;
113+ wxChoice* collection_palette_style_choice;
114+ wxChoice* doodad_palette_style_choice;
115+ wxChoice* item_palette_style_choice;
116+ wxChoice* raw_palette_style_choice;
117+
118+ wxCheckBox* large_terrain_tools_chkbox;
119+ wxCheckBox* large_collection_tools_chkbox;
120+ wxCheckBox* large_doodad_sizebar_chkbox;
121+ wxCheckBox* large_item_sizebar_chkbox;
122+ wxCheckBox* large_house_sizebar_chkbox;
123+ wxCheckBox* large_raw_sizebar_chkbox;
124+ wxCheckBox* large_container_icons_chkbox;
125+ wxCheckBox* large_pick_item_icons_chkbox;
126+
127+ wxCheckBox* switch_mousebtn_chkbox;
128+ wxCheckBox* doubleclick_properties_chkbox;
129+ wxCheckBox* inversed_scroll_chkbox;
130+ wxSlider* scroll_speed_slider;
131+ wxSlider* zoom_speed_slider;
132+
133+ // Client info
134+ wxChoice* default_version_choice;
135+ std::vector<wxDirPickerCtrl*> version_dir_pickers;
136+ wxCheckBox* check_sigs_chkbox;
137+
138+ // Create controls
139+ wxChoice* AddPaletteStyleChoice(wxWindow* parent, wxSizer* sizer, const wxString& short_description, const wxString& description, const std::string& setting);
140+ void SetPaletteStyleChoice(wxChoice* ctrl, int key);
141+
142+ // Create windows
143+ wxNotebookPage* CreateGeneralPage();
144+ wxNotebookPage* CreateGraphicsPage();
145+ wxNotebookPage* CreateUIPage();
146+ wxNotebookPage* CreateEditorPage();
147+ wxNotebookPage* CreateClientPage();
148+ wxNotebookPage* CreateLODPage();
149+ wxNotebookPage* CreateAutomagicPage();
150+
151+ // Helper method to update the UI state of dark mode controls
152+ void UpdateDarkModeUI();
153+
154+ // Add with other checkbox declarations
155+ wxCheckBox* auto_select_raw_chkbox;
156+ wxCheckBox* autosave_chkbox;
157+ wxSpinCtrl* autosave_interval_spin;
158+
159+ // LOD settings
160+ wxSpinCtrl* tooltip_max_zoom_spin;
161+ wxSpinCtrl* ground_only_threshold_spin;
162+ wxSpinCtrl* item_display_threshold_spin;
163+ wxSpinCtrl* special_features_threshold_spin;
164+ wxSpinCtrl* animation_threshold_spin;
165+ wxSpinCtrl* effects_threshold_spin;
166+ wxSpinCtrl* light_threshold_spin;
167+ wxSpinCtrl* shade_threshold_spin;
168+ wxSpinCtrl* town_zone_threshold_spin;
169+ wxSpinCtrl* grid_threshold_spin;
170+
171+ // Palette grid settings
172+ wxSpinCtrl* chunk_size_spin;
173+ wxSpinCtrl* visible_rows_margin_spin;
174+
175+ DECLARE_EVENT_TABLE()
176+};
177+
178+#endif
A RD_Map_Editor/source/process_com.cpp +78-0 View file
@@ -0,0 +1,78 @@
1+//////////////////////////////////////////////////////////////////////
2+// This file is part of Remere's Map Editor
3+//////////////////////////////////////////////////////////////////////
4+// Remere's Map Editor is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// Remere's Map Editor is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+//////////////////////////////////////////////////////////////////////
17+
18+#include "main.h"
19+
20+#ifdef _USE_PROCESS_COM
21+
22+ #include "gui.h"
23+ #include "process_com.h"
24+
25+// Server
26+
27+RMEProcessServer::RMEProcessServer() {
28+ ////
29+}
30+
31+RMEProcessServer::~RMEProcessServer() {
32+ ////
33+}
34+
35+wxConnectionBase* RMEProcessServer::OnAcceptConnection(const wxString& topic) {
36+ if (topic.Lower() == "rme_talk") {
37+ g_gui.root->Iconize(false); // Show application if minimized
38+ g_gui.root->Raise(); // Request the window manager to raise this application to the top of Z-order
39+ return newd RMEProcessConnection();
40+ }
41+ return nullptr;
42+}
43+
44+// Client
45+
46+RMEProcessClient::RMEProcessClient() :
47+ proc(nullptr) {
48+ ////
49+}
50+
51+RMEProcessClient::~RMEProcessClient() {
52+ delete proc;
53+}
54+
55+wxConnectionBase* RMEProcessClient::OnMakeConnection() {
56+ return proc = newd RMEProcessConnection();
57+}
58+
59+// Connection
60+
61+RMEProcessConnection::RMEProcessConnection() :
62+ wxConnection() {
63+ ////
64+}
65+
66+RMEProcessConnection::~RMEProcessConnection() {
67+ ////
68+}
69+
70+bool RMEProcessConnection::OnExec(const wxString& topic, const wxString& fileName) {
71+ if (topic.Lower() == "rme_talk" && fileName != wxEmptyString) {
72+ g_gui.LoadMap(FileName(fileName));
73+ return true;
74+ }
75+ return false;
76+}
77+
78+#endif
A RD_Map_Editor/source/process_com.h +53-0 View file
@@ -0,0 +1,53 @@
1+//////////////////////////////////////////////////////////////////////
2+// This file is part of Remere's Map Editor
3+//////////////////////////////////////////////////////////////////////
4+// Remere's Map Editor is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// Remere's Map Editor is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+//////////////////////////////////////////////////////////////////////
17+
18+#ifdef _USE_PROCESS_COM
19+
20+ #ifndef RME_PROCESS_COMMUNICATION_H_
21+ #define RME_PROCESS_COMMUNICATION_H_
22+
23+ #include "wx/ipc.h"
24+
25+class RMEProcessConnection : public wxConnection {
26+public:
27+ RMEProcessConnection();
28+ ~RMEProcessConnection();
29+
30+ bool OnExec(const wxString& topic, const wxString& fileName);
31+};
32+
33+class RMEProcessServer : public wxServer {
34+public:
35+ RMEProcessServer();
36+ ~RMEProcessServer();
37+
38+ wxConnectionBase* OnAcceptConnection(const wxString& topic);
39+};
40+
41+class RMEProcessClient : public wxClient {
42+ wxConnectionBase* proc;
43+
44+public:
45+ RMEProcessClient();
46+ ~RMEProcessClient();
47+
48+ wxConnectionBase* OnMakeConnection();
49+};
50+
51+ #endif
52+
53+#endif
A RD_Map_Editor/source/properties_window.cpp +330-0 View file
@@ -0,0 +1,330 @@
1+//////////////////////////////////////////////////////////////////////
2+// This file is part of Remere's Map Editor
3+//////////////////////////////////////////////////////////////////////
4+// Remere's Map Editor is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// Remere's Map Editor is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+//////////////////////////////////////////////////////////////////////
17+
18+#include "main.h"
19+
20+#include "properties_window.h"
21+
22+#include "gui_ids.h"
23+#include "complexitem.h"
24+#include "container_properties_window.h"
25+
26+#include <wx/grid.h>
27+
28+BEGIN_EVENT_TABLE(PropertiesWindow, wxDialog)
29+EVT_BUTTON(wxID_OK, PropertiesWindow::OnClickOK)
30+EVT_BUTTON(wxID_CANCEL, PropertiesWindow::OnClickCancel)
31+
32+EVT_BUTTON(ITEM_PROPERTIES_ADD_ATTRIBUTE, PropertiesWindow::OnClickAddAttribute)
33+EVT_BUTTON(ITEM_PROPERTIES_REMOVE_ATTRIBUTE, PropertiesWindow::OnClickRemoveAttribute)
34+
35+EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, PropertiesWindow::OnNotebookPageChanged)
36+
37+EVT_GRID_CELL_CHANGED(PropertiesWindow::OnGridValueChanged)
38+END_EVENT_TABLE()
39+
40+PropertiesWindow::PropertiesWindow(wxWindow* parent, const Map* map, const Tile* tile_parent, Item* item, wxPoint pos) :
41+ ObjectPropertiesWindowBase(parent, "Item Properties", map, tile_parent, item, pos),
42+ currentPanel(nullptr) {
43+ ASSERT(edit_item);
44+ notebook = newd wxNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(600, 300));
45+
46+ notebook->AddPage(createGeneralPanel(notebook), "Simple", true);
47+ if (dynamic_cast<Container*>(item)) {
48+ notebook->AddPage(createContainerPanel(notebook), "Contents");
49+ }
50+ notebook->AddPage(createAttributesPanel(notebook), "Advanced");
51+
52+ wxSizer* topSizer = newd wxBoxSizer(wxVERTICAL);
53+ topSizer->Add(notebook, wxSizerFlags(1).DoubleBorder());
54+
55+ wxSizer* optSizer = newd wxBoxSizer(wxHORIZONTAL);
56+ optSizer->Add(newd wxButton(this, wxID_OK, "OK"), wxSizerFlags(0).Center());
57+ optSizer->Add(newd wxButton(this, wxID_CANCEL, "Cancel"), wxSizerFlags(0).Center());
58+ topSizer->Add(optSizer, wxSizerFlags(0).Center().DoubleBorder());
59+
60+ SetSizerAndFit(topSizer);
61+ Centre(wxBOTH);
62+}
63+
64+PropertiesWindow::~PropertiesWindow() {
65+ ;
66+}
67+
68+void PropertiesWindow::Update() {
69+ Container* container = dynamic_cast<Container*>(edit_item);
70+ if (container) {
71+ for (uint32_t i = 0; i < container->getVolume(); ++i) {
72+ container_items[i]->setItem(container->getItem(i));
73+ }
74+ }
75+ wxDialog::Update();
76+}
77+
78+wxWindow* PropertiesWindow::createGeneralPanel(wxWindow* parent) {
79+ wxPanel* panel = newd wxPanel(parent, ITEM_PROPERTIES_GENERAL_TAB);
80+ wxFlexGridSizer* gridsizer = newd wxFlexGridSizer(2, 10, 10);
81+ gridsizer->AddGrowableCol(1);
82+
83+ gridsizer->Add(newd wxStaticText(panel, wxID_ANY, "ID " + i2ws(edit_item->getID())));
84+ gridsizer->Add(newd wxStaticText(panel, wxID_ANY, "\"" + wxstr(edit_item->getName()) + "\""));
85+
86+ gridsizer->Add(newd wxStaticText(panel, wxID_ANY, "Action ID"));
87+ wxSpinCtrl* action_id_field = newd wxSpinCtrl(panel, wxID_ANY, i2ws(edit_item->getActionID()), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 0xFFFF, edit_item->getActionID());
88+ gridsizer->Add(action_id_field, wxSizerFlags(1).Expand());
89+
90+ gridsizer->Add(newd wxStaticText(panel, wxID_ANY, "Unique ID"));
91+ wxSpinCtrl* unique_id_field = newd wxSpinCtrl(panel, wxID_ANY, i2ws(edit_item->getUniqueID()), wxDefaultPosition, wxSize(-1, 20), wxSP_ARROW_KEYS, 0, 0xFFFF, edit_item->getUniqueID());
92+ gridsizer->Add(unique_id_field, wxSizerFlags(1).Expand());
93+
94+ panel->SetSizerAndFit(gridsizer);
95+
96+ return panel;
97+}
98+
99+wxWindow* PropertiesWindow::createContainerPanel(wxWindow* parent) {
100+ Container* container = (Container*)edit_item;
101+ wxPanel* panel = newd wxPanel(parent, ITEM_PROPERTIES_CONTAINER_TAB);
102+ wxSizer* topSizer = newd wxBoxSizer(wxVERTICAL);
103+
104+ wxSizer* gridSizer = newd wxGridSizer(6, 5, 5);
105+
106+ bool use_large_sprites = g_settings.getBoolean(Config::USE_LARGE_CONTAINER_ICONS);
107+ for (uint32_t i = 0; i < container->getVolume(); ++i) {
108+ Item* item = container->getItem(i);
109+ ContainerItemButton* containerItemButton = newd ContainerItemButton(panel, use_large_sprites, i, edit_map, item);
110+
111+ container_items.push_back(containerItemButton);
112+ gridSizer->Add(containerItemButton, wxSizerFlags(0));
113+ }
114+
115+ topSizer->Add(gridSizer, wxSizerFlags(1).Expand());
116+
117+ /*
118+ wxSizer* optSizer = newd wxBoxSizer(wxHORIZONTAL);
119+ optSizer->Add(newd wxButton(panel, ITEM_PROPERTIES_ADD_ATTRIBUTE, "Add Item"), wxSizerFlags(0).Center());
120+ // optSizer->Add(newd wxButton(panel, ITEM_PROPERTIES_REMOVE_ATTRIBUTE, "Remove Attribute"), wxSizerFlags(0).Center());
121+ topSizer->Add(optSizer, wxSizerFlags(0).Center().DoubleBorder());
122+ */
123+
124+ panel->SetSizer(topSizer);
125+ return panel;
126+}
127+
128+wxWindow* PropertiesWindow::createAttributesPanel(wxWindow* parent) {
129+ wxPanel* panel = newd wxPanel(parent, wxID_ANY);
130+ wxSizer* topSizer = newd wxBoxSizer(wxVERTICAL);
131+
132+ attributesGrid = newd wxGrid(panel, ITEM_PROPERTIES_ADVANCED_TAB, wxDefaultPosition, wxSize(-1, 160));
133+ topSizer->Add(attributesGrid, wxSizerFlags(1).Expand());
134+
135+ wxFont time_font(*wxSWISS_FONT);
136+ attributesGrid->SetDefaultCellFont(time_font);
137+ attributesGrid->CreateGrid(0, 3);
138+ attributesGrid->DisableDragRowSize();
139+ attributesGrid->DisableDragColSize();
140+ attributesGrid->SetSelectionMode(wxGrid::wxGridSelectRows);
141+ attributesGrid->SetRowLabelSize(0);
142+ // log->SetColLabelSize(0);
143+ // log->EnableGridLines(false);
144+ attributesGrid->EnableEditing(true);
145+
146+ attributesGrid->SetColLabelValue(0, "Key");
147+ attributesGrid->SetColSize(0, 100);
148+ attributesGrid->SetColLabelValue(1, "Type");
149+ attributesGrid->SetColSize(1, 80);
150+ attributesGrid->SetColLabelValue(2, "Value");
151+ attributesGrid->SetColSize(2, 410);
152+
153+ // contents
154+ ItemAttributeMap attrs = edit_item->getAttributes();
155+ attributesGrid->AppendRows(attrs.size());
156+ int i = 0;
157+ for (ItemAttributeMap::iterator aiter = attrs.begin(); aiter != attrs.end(); ++aiter, ++i) {
158+ SetGridValue(attributesGrid, i, aiter->first, aiter->second);
159+ }
160+
161+ wxSizer* optSizer = newd wxBoxSizer(wxHORIZONTAL);
162+ optSizer->Add(newd wxButton(panel, ITEM_PROPERTIES_ADD_ATTRIBUTE, "Add Attribute"), wxSizerFlags(0).Center());
163+ optSizer->Add(newd wxButton(panel, ITEM_PROPERTIES_REMOVE_ATTRIBUTE, "Remove Attribute"), wxSizerFlags(0).Center());
164+ topSizer->Add(optSizer, wxSizerFlags(0).Center().DoubleBorder());
165+
166+ panel->SetSizer(topSizer);
167+
168+ return panel;
169+}
170+
171+void PropertiesWindow::SetGridValue(wxGrid* grid, int rowIndex, std::string label, const ItemAttribute& attr) {
172+ wxArrayString types;
173+ types.Add("Number");
174+ types.Add("Float");
175+ types.Add("Boolean");
176+ types.Add("String");
177+
178+ grid->SetCellValue(rowIndex, 0, label);
179+ switch (attr.type) {
180+ case ItemAttribute::STRING: {
181+ grid->SetCellValue(rowIndex, 1, "String");
182+ grid->SetCellValue(rowIndex, 2, wxstr(*attr.getString()));
183+ break;
184+ }
185+ case ItemAttribute::INTEGER: {
186+ grid->SetCellValue(rowIndex, 1, "Number");
187+ grid->SetCellValue(rowIndex, 2, i2ws(*attr.getInteger()));
188+ grid->SetCellEditor(rowIndex, 2, new wxGridCellNumberEditor);
189+ break;
190+ }
191+ case ItemAttribute::DOUBLE:
192+ case ItemAttribute::FLOAT: {
193+ grid->SetCellValue(rowIndex, 1, "Float");
194+ wxString f;
195+ f << *attr.getFloat();
196+ grid->SetCellValue(rowIndex, 2, f);
197+ grid->SetCellEditor(rowIndex, 2, new wxGridCellFloatEditor);
198+ break;
199+ }
200+ case ItemAttribute::BOOLEAN: {
201+ grid->SetCellValue(rowIndex, 1, "Boolean");
202+ grid->SetCellValue(rowIndex, 2, *attr.getBoolean() ? "1" : "");
203+ grid->SetCellRenderer(rowIndex, 2, new wxGridCellBoolRenderer);
204+ grid->SetCellEditor(rowIndex, 2, new wxGridCellBoolEditor);
205+ break;
206+ }
207+ default: {
208+ grid->SetCellValue(rowIndex, 1, "Unknown");
209+ grid->SetCellBackgroundColour(rowIndex, 1, *wxLIGHT_GREY);
210+ grid->SetCellBackgroundColour(rowIndex, 2, *wxLIGHT_GREY);
211+ grid->SetReadOnly(rowIndex, 1, true);
212+ grid->SetReadOnly(rowIndex, 2, true);
213+ break;
214+ }
215+ }
216+ grid->SetCellEditor(rowIndex, 1, new wxGridCellChoiceEditor(types));
217+}
218+
219+void PropertiesWindow::OnResize(wxSizeEvent& evt) {
220+ /*
221+ if(wxGrid* grid = (wxGrid*)currentPanel->FindWindowByName("AdvancedGrid")) {
222+ int tWidth = 0;
223+ for(int i = 0; i < 3; ++i)
224+ tWidth += grid->GetColumnWidth(i);
225+
226+ int wWidth = grid->GetParent()->GetSize().GetWidth();
227+
228+ grid->SetColumnWidth(2, wWidth - 100 - 80);
229+ }
230+ */
231+}
232+
233+void PropertiesWindow::OnNotebookPageChanged(wxNotebookEvent& evt) {
234+ wxWindow* page = notebook->GetCurrentPage();
235+
236+ // TODO: Save
237+
238+ switch (page->GetId()) {
239+ case ITEM_PROPERTIES_GENERAL_TAB: {
240+ // currentPanel = createGeneralPanel(page);
241+ break;
242+ }
243+ case ITEM_PROPERTIES_ADVANCED_TAB: {
244+ // currentPanel = createAttributesPanel(page);
245+ break;
246+ }
247+ default:
248+ break;
249+ }
250+}
251+
252+void PropertiesWindow::saveGeneralPanel() {
253+ ////
254+}
255+
256+void PropertiesWindow::saveContainerPanel() {
257+ ////
258+}
259+
260+void PropertiesWindow::saveAttributesPanel() {
261+ edit_item->clearAllAttributes();
262+ for (int32_t rowIndex = 0; rowIndex < attributesGrid->GetNumberRows(); ++rowIndex) {
263+ ItemAttribute attr;
264+ wxString type = attributesGrid->GetCellValue(rowIndex, 1);
265+ if (type == "String") {
266+ attr.set(nstr(attributesGrid->GetCellValue(rowIndex, 2)));
267+ } else if (type == "Float") {
268+ double value;
269+ if (attributesGrid->GetCellValue(rowIndex, 2).ToDouble(&value)) {
270+ attr.set(value);
271+ }
272+ } else if (type == "Number") {
273+ long value;
274+ if (attributesGrid->GetCellValue(rowIndex, 2).ToLong(&value)) {
275+ attr.set(static_cast<int32_t>(value));
276+ }
277+ } else if (type == "Boolean") {
278+ attr.set(attributesGrid->GetCellValue(rowIndex, 2) == "1");
279+ } else {
280+ continue;
281+ }
282+ edit_item->setAttribute(nstr(attributesGrid->GetCellValue(rowIndex, 0)), attr);
283+ }
284+}
285+
286+void PropertiesWindow::OnGridValueChanged(wxGridEvent& event) {
287+ if (event.GetCol() == 1) {
288+ wxString newType = attributesGrid->GetCellValue(event.GetRow(), 1);
289+ if (newType == event.GetString()) {
290+ return;
291+ }
292+
293+ ItemAttribute attr;
294+ if (newType == "String") {
295+ attr.set("");
296+ } else if (newType == "Float") {
297+ attr.set(0.0f);
298+ } else if (newType == "Number") {
299+ attr.set(0);
300+ } else if (newType == "Boolean") {
301+ attr.set(false);
302+ }
303+ SetGridValue(attributesGrid, event.GetRow(), nstr(attributesGrid->GetCellValue(event.GetRow(), 0)), attr);
304+ }
305+}
306+
307+void PropertiesWindow::OnClickOK(wxCommandEvent&) {
308+ saveAttributesPanel();
309+ EndModal(1);
310+}
311+
312+void PropertiesWindow::OnClickAddAttribute(wxCommandEvent&) {
313+ attributesGrid->AppendRows(1);
314+ ItemAttribute attr(0);
315+ SetGridValue(attributesGrid, attributesGrid->GetNumberRows() - 1, "", attr);
316+}
317+
318+void PropertiesWindow::OnClickRemoveAttribute(wxCommandEvent&) {
319+ wxArrayInt rowIndexes = attributesGrid->GetSelectedRows();
320+ if (rowIndexes.Count() != 1) {
321+ return;
322+ }
323+
324+ int rowIndex = rowIndexes[0];
325+ attributesGrid->DeleteRows(rowIndex, 1);
326+}
327+
328+void PropertiesWindow::OnClickCancel(wxCommandEvent&) {
329+ EndModal(0);
330+}
A RD_Map_Editor/source/properties_window.h +68-0 View file
@@ -0,0 +1,68 @@
1+//////////////////////////////////////////////////////////////////////
2+// This file is part of Remere's Map Editor
3+//////////////////////////////////////////////////////////////////////
4+// Remere's Map Editor is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// Remere's Map Editor is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+//////////////////////////////////////////////////////////////////////
17+
18+#ifndef RME_PROPERTIES_WINDOW_H_
19+#define RME_PROPERTIES_WINDOW_H_
20+
21+#include "main.h"
22+
23+#include "common_windows.h"
24+
25+class ContainerItemButton;
26+class ContainerItemPopupMenu;
27+class ItemAttribute;
28+
29+class PropertiesWindow : public ObjectPropertiesWindowBase {
30+public:
31+ PropertiesWindow(wxWindow* parent, const Map* map, const Tile* tile, Item* item, wxPoint position = wxDefaultPosition);
32+ ~PropertiesWindow();
33+
34+ void OnClickOK(wxCommandEvent&);
35+ void OnClickCancel(wxCommandEvent&);
36+ void OnClickAddAttribute(wxCommandEvent&);
37+ void OnClickRemoveAttribute(wxCommandEvent&);
38+
39+ void OnResize(wxSizeEvent&);
40+ void OnNotebookPageChanged(wxNotebookEvent&);
41+ void OnGridValueChanged(wxGridEvent&);
42+
43+ void Update();
44+
45+protected:
46+ // Simple pane
47+ wxWindow* createGeneralPanel(wxWindow* parent);
48+ void saveGeneralPanel();
49+
50+ // Container pane
51+ std::vector<ContainerItemButton*> container_items;
52+ wxWindow* createContainerPanel(wxWindow* parent);
53+ void saveContainerPanel();
54+
55+ // Advanced pane
56+ wxGrid* attributesGrid;
57+ wxWindow* createAttributesPanel(wxWindow* parent);
58+ void saveAttributesPanel();
59+ void SetGridValue(wxGrid* grid, int rowIndex, std::string name, const ItemAttribute& attr);
60+
61+protected:
62+ wxNotebook* notebook;
63+ wxWindow* currentPanel;
64+
65+ DECLARE_EVENT_TABLE()
66+};
67+
68+#endif
A RD_Map_Editor/source/raw_brush.cpp +108-0 View file
@@ -0,0 +1,108 @@
1+//////////////////////////////////////////////////////////////////////
2+// This file is part of Remere's Map Editor
3+//////////////////////////////////////////////////////////////////////
4+// Remere's Map Editor is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// Remere's Map Editor is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+//////////////////////////////////////////////////////////////////////
17+
18+#include "main.h"
19+#include "gui.h"
20+
21+#include "raw_brush.h"
22+#include "settings.h"
23+#include "items.h"
24+#include "basemap.h"
25+
26+//=============================================================================
27+// RAW brush
28+
29+RAWBrush::RAWBrush(uint16_t itemid) :
30+ Brush() {
31+ ItemType& it = g_items[itemid];
32+ if (it.id == 0) {
33+ itemtype = nullptr;
34+ } else {
35+ itemtype = &it;
36+ }
37+}
38+
39+RAWBrush::~RAWBrush() {
40+ ////
41+}
42+
43+int RAWBrush::getLookID() const {
44+ if (itemtype) {
45+ return itemtype->clientID;
46+ }
47+ return 0;
48+}
49+
50+uint16_t RAWBrush::getItemID() const {
51+ return itemtype->id;
52+}
53+
54+std::string RAWBrush::getName() const {
55+ if (!itemtype) {
56+ return "RAWBrush";
57+ }
58+
59+ if (itemtype->hookSouth) {
60+ return i2s(itemtype->id) + " - " + itemtype->name + " (Hook South)";
61+ } else if (itemtype->hookEast) {
62+ return i2s(itemtype->id) + " - " + itemtype->name + " (Hook East)";
63+ }
64+
65+ return i2s(itemtype->id) + " - " + itemtype->name + itemtype->editorsuffix;
66+}
67+
68+void RAWBrush::undraw(BaseMap* map, Tile* tile) {
69+ if (tile->ground && tile->ground->getID() == itemtype->id) {
70+ delete tile->ground;
71+ tile->ground = nullptr;
72+ }
73+ for (ItemVector::iterator iter = tile->items.begin(); iter != tile->items.end();) {
74+ Item* item = *iter;
75+ if (item->getID() == itemtype->id) {
76+ delete item;
77+ iter = tile->items.erase(iter);
78+ } else {
79+ ++iter;
80+ }
81+ }
82+}
83+
84+void RAWBrush::draw(BaseMap* map, Tile* tile, void* parameter) {
85+ if (!itemtype) {
86+ return;
87+ }
88+
89+ bool b = parameter ? *reinterpret_cast<bool*>(parameter) : false;
90+ if ((g_settings.getInteger(Config::RAW_LIKE_SIMONE) && !b) && itemtype->alwaysOnBottom && itemtype->alwaysOnTopOrder == 2) {
91+ for (ItemVector::iterator iter = tile->items.begin(); iter != tile->items.end();) {
92+ Item* item = *iter;
93+ if (item->getTopOrder() == itemtype->alwaysOnTopOrder) {
94+ delete item;
95+ iter = tile->items.erase(iter);
96+ } else {
97+ ++iter;
98+ }
99+ }
100+ }
101+ Item* new_item = Item::Create(itemtype->id);
102+ if (new_item) {
103+ if (g_gui.IsCurrentActionIDEnabled()) {
104+ new_item->setActionID(g_gui.GetCurrentActionID());
105+ }
106+ tile->addItem(new_item);
107+ }
108+}
A RD_Map_Editor/source/raw_brush.h +58-0 View file
@@ -0,0 +1,58 @@
1+//////////////////////////////////////////////////////////////////////
2+// This file is part of Remere's Map Editor
3+//////////////////////////////////////////////////////////////////////
4+// Remere's Map Editor is free software: you can redistribute it and/or modify
5+// it under the terms of the GNU General Public License as published by
6+// the Free Software Foundation, either version 3 of the License, or
7+// (at your option) any later version.
8+//
9+// Remere's Map Editor is distributed in the hope that it will be useful,
10+// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+// GNU General Public License for more details.
13+//
14+// You should have received a copy of the GNU General Public License
15+// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+//////////////////////////////////////////////////////////////////////
17+
18+#ifndef RME_RAW_BRUSH_H
19+#define RME_RAW_BRUSH_H
20+
21+#include "brush.h"
22+
23+//=============================================================================
24+// RAWBrush, draw items like SimOne's editor
25+
26+class RAWBrush : public Brush {
27+public:
28+ RAWBrush(uint16_t itemid); // Create a RAWBrush of the specified type
29+ virtual ~RAWBrush();
30+
31+ bool isRaw() const {
32+ return true;
33+ }
34+ RAWBrush* asRaw() {
35+ return static_cast<RAWBrush*>(this);
36+ }
37+
38+ virtual bool canDraw(BaseMap* map, const Position& position) const {
39+ return true;
40+ }
41+ virtual void draw(BaseMap* map, Tile* tile, void* parameter);
42+ virtual void undraw(BaseMap* map, Tile* tile);
43+
44+ virtual bool canDrag() const {
45+ return true;
46+ }
47+ virtual int getLookID() const;
48+ virtual std::string getName() const;
49+ ItemType* getItemType() const {
50+ return itemtype;
51+ }
52+ uint16_t getItemID() const;
53+
54+protected:
55+ ItemType* itemtype;
56+};
57+
58+#endif
Top