Skip to content

Commit 0fbd793

Browse files
committed
refactor menubar, fix render, add more view options
1 parent cd754a8 commit 0fbd793

19 files changed

Lines changed: 318 additions & 177 deletions

data/menubar.xml

Lines changed: 75 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,7 @@
5858
<item name="Undo" hotkey="Ctrl+Z" action="UNDO" help="Undo last action."/>
5959
<item name="Redo" hotkey="Ctrl+Shift+Z" action="REDO" help="Redo last undid action."/>
6060
<separator/>
61-
<item name="Find Item..." hotkey="Ctrl+F" action="FIND_ITEM" help="Find all instances of an item type the map."/>
6261
<item name="Replace Items..." hotkey="Ctrl+Shift+F" action="REPLACE_ITEMS" help="Replaces all occurrences of one item with another."/>
63-
<menu name="Find on Map">
64-
<item name="Find Everything" action="SEARCH_ON_MAP_EVERYTHING" help="Find all unique/action/text/container items."/>
65-
<separator/>
66-
<item name="Find Unique" action="SEARCH_ON_MAP_UNIQUE" help="Find all items with an unique ID on map."/>
67-
<item name="Find Action" action="SEARCH_ON_MAP_ACTION" help="Find all items with an action ID on map."/>
68-
<item name="Find Container" action="SEARCH_ON_MAP_CONTAINER" help="Find all containers on map."/>
69-
<item name="Find Writeable" action="SEARCH_ON_MAP_WRITEABLE" help="Find all writeable items on map."/>
70-
</menu>
7162
<separator/>
7263
<menu name="Border Options">
7364
<item name="Border Automagic" hotkey="A" action="AUTOMAGIC" help="Turns on all automatic border functions."/>
@@ -85,25 +76,43 @@
8576
<item name="Clear Modified State" action="CLEAR_MODIFIED_STATE" help="Clears the modified state from all tiles."/>
8677
</menu>
8778
<separator/>
88-
<item name="Go to Previous Position" hotkey="P" action="GOTO_PREVIOUS_POSITION" help="Go to the previous screen center position."/>
89-
<item name="Go to Position..." hotkey="Ctrl+G" action="GOTO_POSITION" help="Go to a specific XYZ position."/>
90-
<item name="Jump to Brush..." hotkey="J" action="JUMP_TO_BRUSH" help="Jump to a brush."/>
91-
<item name="Jump to Item..." hotkey="Ctrl+J" action="JUMP_TO_ITEM_BRUSH" help="Jump to an item brush (RAW palette)."/>
92-
<separator/>
9379
<item name="Cut" hotkey="Ctrl+X" action="CUT" help="Cut a part of the map."/>
9480
<item name="Copy" hotkey="Ctrl+C" action="COPY" help="Copy a part of the map."/>
9581
<item name="Paste" hotkey="Ctrl+V" action="PASTE" help="Paste a part of the map."/>
9682
</menu>
83+
<menu name="Editor">
84+
<item name="New View" hotkey="Ctrl+Shift+N" action="NEW_VIEW" help="Creates a new view of the current map."/>
85+
<item name="Enter Fullscreen" hotkey="F11" action="TOGGLE_FULLSCREEN" help="Changes between fullscreen mode and windowed mode."/>
86+
<item name="Take Screenshot" hotkey="F10" action="TAKE_SCREENSHOT" help="Saves the current view to the disk."/>
87+
<separator/>
88+
<menu name="Zoom">
89+
<item name="Zoom In" hotkey="Ctrl++" action="ZOOM_IN" help="Increase the zoom."/>
90+
<item name="Zoom Out" hotkey="Ctrl+-" action="ZOOM_OUT" help="Decrease the zoom."/>
91+
<item name="Zoom Normal" hotkey="Ctrl+0" action="ZOOM_NORMAL" help="Normal zoom(100%)."/>
92+
</menu>
93+
</menu>
94+
<menu name="Search">
95+
<item name="Find Item..." hotkey="Ctrl+F" action="FIND_ITEM" help="Find all instances of an item type the map."/>
96+
<separator/>
97+
<item name="Find Unique" action="SEARCH_ON_MAP_UNIQUE" help="Find all items with an unique ID on map."/>
98+
<item name="Find Action" action="SEARCH_ON_MAP_ACTION" help="Find all items with an action ID on map."/>
99+
<item name="Find Container" action="SEARCH_ON_MAP_CONTAINER" help="Find all containers on map."/>
100+
<item name="Find Writeable" action="SEARCH_ON_MAP_WRITEABLE" help="Find all writeable items on map."/>
101+
<separator/>
102+
<item name="Find Everything" action="SEARCH_ON_MAP_EVERYTHING" help="Find all unique/action/text/container items."/>
103+
</menu>
97104
<menu name="Map">
98105
<item name="Edit Towns" hotkey="Ctrl+T" action="EDIT_TOWNS" help="Edit towns."/>
106+
<!-- these were never implemented
99107
<item name="Edit Items" hotkey="Ctrl+I" action="EDIT_ITEMS" help="Edit items."/>
100108
<item name="Edit Monsters" action="EDIT_MONSTERS" help="Edit monsters."/>
109+
-->
101110
<separator/>
102111
<item name="Cleanup..." action="MAP_CLEANUP" help="Removes all items that do not exist in the OTB file (red tiles the server can't load)."/>
103112
<item name="Properties..." hotkey="Ctrl+P" action="MAP_PROPERTIES" help="Show and change the map properties."/>
104113
<item name="Statistics" hotkey="F8" action="MAP_STATISTICS" help="Show map statistics."/>
105114
</menu>
106-
<menu name="Select">
115+
<menu name="Selection">
107116
<item name="Replace Items on Selection" action="REPLACE_ON_SELECTION_ITEMS" help="Replace items on selected area."/>
108117
<item name="Find Item on Selection" action="SEARCH_ON_SELECTION_ITEM" help="Find items on selected area."/>
109118
<item name="Remove Item on Selection" action="REMOVE_ON_SELECTION_ITEM" help="Remove item on selected area."/>
@@ -128,59 +137,79 @@
128137
<item name="Borderize Selection" action="BORDERIZE_SELECTION" help="Creates automatic borders in the entire selected area."/>
129138
<item name="Randomize Selection" action="RANDOMIZE_SELECTION" help="Randomizes the ground tiles of the selected area."/>
130139
</menu>
131-
<menu name="View">
132-
<item name="New View" hotkey="Ctrl+Shift+N" action="NEW_VIEW" help="Creates a new view of the current map."/>
133-
<item name="Enter Fullscreen" hotkey="F11" action="TOGGLE_FULLSCREEN" help="Changes between fullscreen mode and windowed mode."/>
134-
<item name="Take Screenshot" hotkey="F10" action="TAKE_SCREENSHOT" help="Saves the current view to the disk."/>
140+
<menu name="View">
141+
<!-- mapeditor view options -->
142+
<item name="Show all Floors" hotkey="Ctrl+W" action="SHOW_ALL_FLOORS" help="If not checked other floors are hidden."/>
143+
<item name="Show as Minimap" hotkey="Shift+E" action="SHOW_AS_MINIMAP" help="Show only the tile minimap colors."/>
144+
<item name="Only show Colors" hotkey="Ctrl+E" action="SHOW_ONLY_COLORS" help="Show only the special tiles on the map."/>
145+
<item name="Only show Modified" hotkey="Ctrl+M" action="SHOW_ONLY_MODIFIED" help="Show only the tiles that have been modified since the map was opened."/>
146+
<item name="Always show zones" hotkey="" action="ALWAYS_SHOW_ZONES" help="Zones will be visible even on empty tiles."/>
135147
<separator/>
148+
<item name="Show tooltips" hotkey="Y" action="SHOW_TOOLTIPS" help="Show tooltips."/>
149+
<item name="Show grid" hotkey="Shift+G" action="SHOW_GRID" help="Shows a grid over all items."/>
150+
<item name="Show client box" hotkey="Shift+I" action="SHOW_INGAME_BOX" help="Shadows out areas not visible ingame (from the center of the screen)."/>
151+
<separator/>
152+
<item name="Ghost loose items" hotkey="G" action="GHOST_ITEMS" help="Ghost items (except ground)."/>
153+
<item name="Ghost higher floors" hotkey="Ctrl+L" action="GHOST_HIGHER_FLOORS" help="Ghost floors."/>
154+
<item name="Show shade" hotkey="Q" action="SHOW_SHADE" help="Shade lower floors."/>
155+
</menu>
156+
<menu name="Show">
157+
<!-- item/zone filters -->
136158
<item name="Show Animation" hotkey="L" action="SHOW_PREVIEW" help="Show item animations."/>
137159
<item name="Show Light" hotkey="Shift+L" action="SHOW_LIGHTS" help="Show lights."/>
138160
<item name="Show Light Strength" hotkey="Shift+K" action="SHOW_LIGHT_STR" help="Show indicators of light strength."/>
139161
<item name="Show Technical Items" hotkey="Shift+T" action="SHOW_TECHNICAL_ITEMS" help="Shows some of special items that are not visible in game."/>
140162
<separator/>
141-
<item name="Show shade" hotkey="Q" action="SHOW_SHADE" help="Shade lower floors."/>
142-
<item name="Ghost loose items" hotkey="G" action="GHOST_ITEMS" help="Ghost items (except ground)."/>
143-
<item name="Ghost higher floors" hotkey="Ctrl+L" action="GHOST_HIGHER_FLOORS" help="Ghost floors."/>
144-
<separator/>
145163
<item name="Show creatures" hotkey="F" action="SHOW_CREATURES" help="Show creatures on the map."/>
146164
<item name="Show spawns" hotkey="S" action="SHOW_SPAWNS" help="Show spawns on the map."/>
147165
<item name="Show special" hotkey="E" action="SHOW_SPECIAL" help="Show special tiles on the map, like PZ."/>
148166
<item name="Show houses" hotkey="Ctrl+H" action="SHOW_HOUSES" help="Show houses on the map."/>
149167
<item name="Show pathing" hotkey="O" action="SHOW_PATHING" help="Show blocking tiles."/>
150-
<separator/>
151-
<item name="Show tooltips" hotkey="Y" action="SHOW_TOOLTIPS" help="Show tooltips."/>
168+
<item name="Show towns" hotkey="" action="SHOW_TOWNS" help="Show temple positions."/>
152169
<item name="Show waypoints" hotkey="Shift+W" action="SHOW_WAYPOINTS" help="Show waypoints."/>
153-
<item name="Show grid" hotkey="Shift+G" action="SHOW_GRID" help="Shows a grid over all items."/>
154-
<item name="Show client box" hotkey="Shift+I" action="SHOW_INGAME_BOX" help="Shadows out areas not visible ingame (from the center of the screen)."/>
155170
<separator/>
156171
<item name="Highlight Items" hotkey="V" action="HIGHLIGHT_ITEMS" help="Highlight tiles with items on them."/>
157172
<item name="Highlight Locked Doors" hotkey="X" action="HIGHLIGHT_LOCKED_DOORS" help="Highlight doors that require key to open."/>
158173
<item name="Show Wall Hooks" hotkey="K" action="SHOW_WALL_HOOKS" help="Show indicators for wall hooks."/>
174+
</menu>
175+
<menu name="Navigate">
176+
<item name="Go to Previous Position" hotkey="P" action="GOTO_PREVIOUS_POSITION" help="Go to the previous screen center position."/>
177+
<item name="Go to Position..." hotkey="Ctrl+G" action="GOTO_POSITION" help="Go to a specific XYZ position."/>
178+
<item name="Jump to Brush..." hotkey="J" action="JUMP_TO_BRUSH" help="Jump to a brush."/>
179+
<item name="Jump to Item..." hotkey="Ctrl+J" action="JUMP_TO_ITEM_BRUSH" help="Jump to an item brush (RAW palette)."/>
159180
<separator/>
160-
<item name="Show all Floors" hotkey="Ctrl+W" action="SHOW_ALL_FLOORS" help="If not checked other floors are hidden."/>
161-
<item name="Show as Minimap" hotkey="Shift+E" action="SHOW_AS_MINIMAP" help="Show only the tile minimap colors."/>
162-
<item name="Only show Colors" hotkey="Ctrl+E" action="SHOW_ONLY_COLORS" help="Show only the special tiles on the map."/>
163-
<item name="Only show Modified" hotkey="Ctrl+M" action="SHOW_ONLY_MODIFIED" help="Show only the tiles that have been modified since the map was opened."/>
164-
<separator/>
165-
<menu name="Zoom">
166-
<item name="Zoom In" hotkey="Ctrl++" action="ZOOM_IN" help="Increase the zoom."/>
167-
<item name="Zoom Out" hotkey="Ctrl+-" action="ZOOM_OUT" help="Decrease the zoom."/>
168-
<item name="Zoom Normal" hotkey="Ctrl+0" action="ZOOM_NORMAL" help="Normal zoom(100%)."/>
181+
<menu name="Floor">
182+
<item name="Floor 0" action="FLOOR_0" help=""/>
183+
<item name="Floor 1" action="FLOOR_1" help=""/>
184+
<item name="Floor 2" action="FLOOR_2" help=""/>
185+
<item name="Floor 3" action="FLOOR_3" help=""/>
186+
<item name="Floor 4" action="FLOOR_4" help=""/>
187+
<item name="Floor 5" action="FLOOR_5" help=""/>
188+
<item name="Floor 6" action="FLOOR_6" help=""/>
189+
<item name="Floor 7" action="FLOOR_7" help=""/>
190+
<item name="Floor 8" action="FLOOR_8" help=""/>
191+
<item name="Floor 9" action="FLOOR_9" help=""/>
192+
<item name="Floor 10" action="FLOOR_10" help=""/>
193+
<item name="Floor 11" action="FLOOR_11" help=""/>
194+
<item name="Floor 12" action="FLOOR_12" help=""/>
195+
<item name="Floor 13" action="FLOOR_13" help=""/>
196+
<item name="Floor 14" action="FLOOR_14" help=""/>
197+
<item name="Floor 15" action="FLOOR_15" help=""/>
169198
</menu>
170199
</menu>
171200
<menu name="Window">
172201
<item name="Minimap" hotkey="M" action="WIN_MINIMAP" help="Displays the minimap window."/>
173202
<item name="New Palette" action="NEW_PALETTE" help="Creates a new palette."/>
174-
<separator/>
175-
<item name="Terrain Palette" hotkey="T" action="SELECT_TERRAIN" help="Select the Terrain palette."/>
176-
<item name="Doodad Palette" hotkey="D" action="SELECT_DOODAD" help="Select the Doodad palette."/>
177-
<item name="Item Palette" hotkey="I" action="SELECT_ITEM" help="Select the Item palette."/>
178-
<item name="Collection Palette" hotkey="N" action="SELECT_COLLECTION" help="Select the Collection palette."/>
179-
<item name="House Palette" hotkey="H" action="SELECT_HOUSE" help="Select the House palette."/>
180-
<item name="Creature Palette" hotkey="C" action="SELECT_CREATURE" help="Select the Creature palette."/>
181-
<item name="Waypoint Palette" hotkey="W" action="SELECT_WAYPOINT" help="Select the Waypoint palette."/>
182-
<item name="RAW Palette" hotkey="R" action="SELECT_RAW" help="Select the RAW palette."/>
183-
<separator/>
203+
<menu name="Palette">
204+
<item name="Terrain" hotkey="T" action="SELECT_TERRAIN" help="Select the Terrain palette."/>
205+
<item name="Doodad" hotkey="D" action="SELECT_DOODAD" help="Select the Doodad palette."/>
206+
<item name="Item" hotkey="I" action="SELECT_ITEM" help="Select the Item palette."/>
207+
<item name="Collection" hotkey="N" action="SELECT_COLLECTION" help="Select the Collection palette."/>
208+
<item name="House" hotkey="H" action="SELECT_HOUSE" help="Select the House palette."/>
209+
<item name="Creature" hotkey="C" action="SELECT_CREATURE" help="Select the Creature palette."/>
210+
<item name="Waypoint" hotkey="W" action="SELECT_WAYPOINT" help="Select the Waypoint palette."/>
211+
<item name="RAW" hotkey="R" action="SELECT_RAW" help="Select the RAW palette."/>
212+
</menu>
184213
<menu name="Toolbars">
185214
<item name="Brushes" action="VIEW_TOOLBARS_BRUSHES" help="Show or hide the Brushes toolbar."/>
186215
<item name="Position" action="VIEW_TOOLBARS_POSITION" help="Show or hide the Position toolbar."/>
@@ -200,24 +229,6 @@
200229
<item name="Debug .dat" action="DEBUG_VIEW_DAT" help="View all item sprites available."/>
201230
</menu>
202231
-->
203-
<menu name="Floor">
204-
<item name="Floor 0" action="FLOOR_0" help=""/>
205-
<item name="Floor 1" action="FLOOR_1" help=""/>
206-
<item name="Floor 2" action="FLOOR_2" help=""/>
207-
<item name="Floor 3" action="FLOOR_3" help=""/>
208-
<item name="Floor 4" action="FLOOR_4" help=""/>
209-
<item name="Floor 5" action="FLOOR_5" help=""/>
210-
<item name="Floor 6" action="FLOOR_6" help=""/>
211-
<item name="Floor 7" action="FLOOR_7" help=""/>
212-
<item name="Floor 8" action="FLOOR_8" help=""/>
213-
<item name="Floor 9" action="FLOOR_9" help=""/>
214-
<item name="Floor 10" action="FLOOR_10" help=""/>
215-
<item name="Floor 11" action="FLOOR_11" help=""/>
216-
<item name="Floor 12" action="FLOOR_12" help=""/>
217-
<item name="Floor 13" action="FLOOR_13" help=""/>
218-
<item name="Floor 14" action="FLOOR_14" help=""/>
219-
<item name="Floor 15" action="FLOOR_15" help=""/>
220-
</menu>
221232
<menu name="Experimental">
222233
<item name="Fog in light view" hotkey="" action="EXPERIMENTAL_FOG" help="Apply fog filter to light effect."/>
223234
</menu>

source/application.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ bool Application::OnInit()
189189

190190
// Goto RME website?
191191
if(g_settings.getInteger(Config::GOTO_WEBSITE_ON_BOOT) == 1) {
192-
::wxLaunchDefaultBrowser("http://www.remeresmapeditor.com/", wxBROWSER_NEW_WINDOW);
192+
::wxLaunchDefaultBrowser(__SITE_URL__, wxBROWSER_NEW_WINDOW);
193193
g_settings.setInteger(Config::GOTO_WEBSITE_ON_BOOT, 0);
194194
}
195195

source/basemap.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ TileLocation* BaseMap::getTileL(int x, int y, int z)
7171
if(floor)
7272
return &floor->locs[(x & 3)*4 + (y & 3)];
7373
}
74-
return nullptr;
74+
75+
// tile does not exist, create
76+
return createTileL(x, y, z);
7577
}
7678

7779
const TileLocation* BaseMap::getTileL(int x, int y, int z) const

source/common_windows.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,11 +1456,17 @@ void EditTownsDialog::UpdateSelection(int new_selection)
14561456
}
14571457

14581458
if(old_town) {
1459-
Position templepos = temple_position->GetPosition();
1459+
TileLocation* townTile = editor.map.getTileL(old_town->getTemplePosition());
1460+
townTile->decreaseTownCount();
1461+
1462+
Position templePos = temple_position->GetPosition();
1463+
1464+
townTile = editor.map.getTileL(templePos);
1465+
townTile->increaseTownCount();
14601466

14611467
//printf("Changed town %d:%s\n", old_town_id, old_town->getName().c_str());
14621468
//printf("New values %d:%s:%d:%d:%d\n", town_id, town_name.c_str(), templepos.x, templepos.y, templepos.z);
1463-
old_town->setTemplePosition(templepos);
1469+
old_town->setTemplePosition(templePos);
14641470

14651471
wxString new_name = name_field->GetValue();
14661472
wxString old_name = wxstr(old_town->getName());
@@ -1520,6 +1526,9 @@ void EditTownsDialog::OnClickAdd(wxCommandEvent& WXUNUSED(event))
15201526
new_town->setTemplePosition(Position(0,0,0));
15211527
town_list.push_back(new_town);
15221528

1529+
TileLocation* townTile = editor.map.getTileL(Position(0, 0, 0));
1530+
townTile->increaseTownCount();
1531+
15231532
BuildListBox(false);
15241533
UpdateSelection(town_list.size()-1);
15251534
town_listbox->SetSelection(town_list.size()-1);
@@ -1581,11 +1590,17 @@ void EditTownsDialog::OnClickOK(wxCommandEvent& WXUNUSED(event))
15811590
}
15821591

15831592
if(old_town) {
1584-
Position templepos = temple_position->GetPosition();
1593+
TileLocation* townTile = editor.map.getTileL(old_town->getTemplePosition());
1594+
townTile->decreaseTownCount();
1595+
1596+
Position templePos = temple_position->GetPosition();
1597+
1598+
townTile = editor.map.getTileL(templePos);
1599+
townTile->increaseTownCount();
15851600

15861601
//printf("Changed town %d:%s\n", old_town_id, old_town->getName().c_str());
15871602
//printf("New values %d:%s:%d:%d:%d\n", town_id, town_name.c_str(), templepos.x, templepos.y, templepos.z);
1588-
old_town->setTemplePosition(templepos);
1603+
old_town->setTemplePosition(templePos);
15891604

15901605
wxString new_name = name_field->GetValue();
15911606
wxString old_name = wxstr(old_town->getName());

source/definitions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define RME_DEFINITIONS_H_
2020

2121
#define __W_RME_APPLICATION_NAME__ wxString("OTAcademy Map Editor")
22+
#define __RME_APPLICATION_NAME__ std::string("OTAcademy Map Editor")
2223

2324
// Version info
2425
// xxyyzzt (major, minor, subversion)
@@ -38,6 +39,8 @@
3839
__RME_VERSION_MINOR__, \
3940
__RME_SUBVERSION__)
4041

42+
#define __SITE_URL__ "https://github.com/OTAcademy/RME"
43+
4144
//#define __PRERELEASE__ 1
4245

4346
#ifdef __EXPERIMENTAL__

source/editor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@ bool Editor::importMap(FileName filename, int import_x_offset, int import_y_offs
507507
Position newexit = oldexit + offset;
508508
if(newexit.isValid()) {
509509
imported_town->setTemplePosition(newexit);
510+
TileLocation* townTile = map.getTileL(newexit);
511+
townTile->increaseTownCount();
510512
}
511513

512514
switch(house_import_type) {

source/iomap_otbm.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,8 @@ bool IOMapOTBM::loadMap(Map& map, NodeFileReadHandle& f)
999999
pos.y = y;
10001000
pos.z = z;
10011001
town->setTemplePosition(pos);
1002+
TileLocation* townTile = map.getTileL(pos);
1003+
townTile->increaseTownCount();
10021004
}
10031005
} else if(node_type == OTBM_WAYPOINTS) {
10041006
for(BinaryNode* waypointNode = mapNode->getChild(); waypointNode != nullptr; waypointNode = waypointNode->advance()) {
@@ -1451,7 +1453,7 @@ bool IOMapOTBM::saveMap(Map& map, NodeFileWriteHandle& f)
14511453
{
14521454
f.addByte(OTBM_ATTR_DESCRIPTION);
14531455
// Neither SimOne's nor OpenTibia cares for additional description tags
1454-
f.addString("Saved with Remere's Map Editor " + __RME_VERSION__);
1456+
f.addString("Saved with " + __RME_APPLICATION_NAME__ + " " + __RME_VERSION__);
14551457

14561458
f.addU8(OTBM_ATTR_DESCRIPTION);
14571459
f.addString(map.description);

0 commit comments

Comments
 (0)