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_OTMAPGEN_DIALOG_H_
19#define RME_OTMAPGEN_DIALOG_H_
20
21#include "main.h"
22#include "otmapgen.h"
23#include <wx/listctrl.h>
24
25class OTMapGenDialog : public wxDialog {
26public:
27 OTMapGenDialog(wxWindow* parent);
28 ~OTMapGenDialog();
29
30 // Event handlers
31 void OnGenerate(wxCommandEvent& event);
32 void OnCancel(wxCommandEvent& event);
33 void OnPreview(wxCommandEvent& event);
34 void OnSeedChange(wxCommandEvent& event);
35 void OnParameterChange(wxSpinEvent& event);
36 void OnParameterChangeText(wxCommandEvent& event);
37 void OnMountainTypeChange(wxCommandEvent& event);
38 void OnFloorUp(wxCommandEvent& event);
39 void OnFloorDown(wxCommandEvent& event);
40 void OnZoomIn(wxCommandEvent& event);
41 void OnZoomOut(wxCommandEvent& event);
42
43 // Terrain layer management events
44 void OnTerrainLayerSelect(wxListEvent& event);
45 void OnTerrainLayerAdd(wxCommandEvent& event);
46 void OnTerrainLayerRemove(wxCommandEvent& event);
47 void OnTerrainLayerMoveUp(wxCommandEvent& event);
48 void OnTerrainLayerMoveDown(wxCommandEvent& event);
49 void OnTerrainLayerEdit(wxCommandEvent& event);
50 void OnBrushChoice(wxCommandEvent& event);
51 void OnItemIdChange(wxCommandEvent& event);
52
53 // Helper functions
54 bool GenerateMap();
55 void UpdatePreview();
56 void UpdatePreviewFloor();
57 void UpdateFloorLabel();
58 void UpdateZoomLabel();
59 GenerationConfig BuildGenerationConfig();
60 void GetTilePreviewColor(uint16_t tileId, unsigned char& r, unsigned char& g, unsigned char& b);
61
62 // Terrain layer management helpers
63 void PopulateTerrainLayerList();
64 void PopulateBrushChoices();
65 void UpdateLayerControls();
66 TerrainLayer* GetSelectedLayer();
67 void SetSelectedLayer(const TerrainLayer& layer);
68
69protected:
70 // Dialog controls
71 wxNotebook* notebook;
72
73 // Basic settings
74 wxTextCtrl* seed_text_ctrl;
75 wxSpinCtrl* width_spin_ctrl;
76 wxSpinCtrl* height_spin_ctrl;
77 wxChoice* version_choice;
78 wxChoice* mountain_type_choice;
79 wxCheckBox* terrain_only_checkbox;
80 wxCheckBox* sand_biome_checkbox;
81 wxCheckBox* smooth_coastline_checkbox;
82 wxCheckBox* add_caves_checkbox;
83
84 // Advanced settings
85 wxTextCtrl* noise_increment_text;
86 wxTextCtrl* island_distance_text;
87 wxTextCtrl* cave_depth_text;
88 wxTextCtrl* cave_roughness_text;
89 wxTextCtrl* cave_chance_text;
90 wxTextCtrl* water_level_text;
91 wxTextCtrl* exponent_text;
92 wxTextCtrl* linear_text;
93
94 // Layout design controls (new advanced tab)
95 wxListCtrl* terrain_layer_list;
96 wxButton* add_layer_button;
97 wxButton* remove_layer_button;
98 wxButton* move_up_button;
99 wxButton* move_down_button;
100 wxButton* edit_layer_button;
101
102 // Layer properties panel
103 wxPanel* layer_properties_panel;
104 wxTextCtrl* layer_name_text;
105 wxChoice* layer_brush_choice;
106 wxSpinCtrl* layer_item_id_spin;
107 wxTextCtrl* height_min_text;
108 wxTextCtrl* height_max_text;
109 wxTextCtrl* moisture_min_text;
110 wxTextCtrl* moisture_max_text;
111 wxTextCtrl* noise_scale_text;
112 wxTextCtrl* coverage_text;
113 wxCheckBox* use_borders_checkbox;
114 wxCheckBox* layer_enabled_checkbox;
115 wxSpinCtrl* z_order_spin;
116
117 // Cave and water configuration
118 wxChoice* cave_brush_choice;
119 wxSpinCtrl* cave_item_id_spin;
120 wxChoice* water_brush_choice;
121 wxSpinCtrl* water_item_id_spin;
122
123 // Preview
124 wxStaticBitmap* preview_bitmap;
125 wxButton* preview_button;
126 wxButton* floor_up_button;
127 wxButton* floor_down_button;
128 wxStaticText* floor_label;
129 wxButton* zoom_in_button;
130 wxButton* zoom_out_button;
131 wxStaticText* zoom_label;
132
133 // Buttons
134 wxButton* generate_button;
135 wxButton* cancel_button;
136
137 // Preview state
138 wxBitmap* current_preview;
139 std::vector<std::vector<uint16_t>> current_layers;
140 int current_preview_floor;
141 double current_zoom;
142 int preview_offset_x;
143 int preview_offset_y;
144
145 // Terrain layer management
146 std::vector<TerrainLayer> working_terrain_layers;
147 std::vector<std::string> available_brushes;
148
149 DECLARE_EVENT_TABLE()
150};
151
152enum {
153 ID_GENERATE = 1000,
154 ID_PREVIEW,
155 ID_SEED_TEXT,
156 ID_WIDTH_SPIN,
157 ID_HEIGHT_SPIN,
158 ID_VERSION_CHOICE,
159 ID_MOUNTAIN_TYPE_CHOICE,
160 ID_NOISE_INCREMENT_TEXT,
161 ID_ISLAND_DISTANCE_TEXT,
162 ID_CAVE_DEPTH_TEXT,
163 ID_CAVE_ROUGHNESS_TEXT,
164 ID_CAVE_CHANCE_TEXT,
165 ID_WATER_LEVEL_TEXT,
166 ID_EXPONENT_TEXT,
167 ID_LINEAR_TEXT,
168 ID_FLOOR_UP,
169 ID_FLOOR_DOWN,
170 ID_ZOOM_IN,
171 ID_ZOOM_OUT,
172
173 // Terrain layer management IDs
174 ID_TERRAIN_LAYER_LIST,
175 ID_ADD_LAYER,
176 ID_REMOVE_LAYER,
177 ID_MOVE_UP_LAYER,
178 ID_MOVE_DOWN_LAYER,
179 ID_EDIT_LAYER,
180 ID_LAYER_BRUSH_CHOICE,
181 ID_LAYER_ITEM_ID_SPIN,
182 ID_CAVE_BRUSH_CHOICE,
183 ID_CAVE_ITEM_ID_SPIN,
184 ID_WATER_BRUSH_CHOICE,
185 ID_WATER_ITEM_ID_SPIN
186};
187
188#endif