*** empty log message ***
@@ -327,6 +327,21 @@ | ||
327 | 327 | isFirstOfLineToAdd = true; |
328 | 328 | } |
329 | 329 | |
330 | +void MapEditorWX::getShapesImage(wxImage* img, int collection, int clut, int index) | |
331 | +{ | |
332 | + //サーフェイス取得 | |
333 | + SDL_Surface* surface = hpl::surface::getSurface(collection, clut, index); | |
334 | + img->Create(surface->w, surface->h); | |
335 | + SDL_LockSurface(surface); | |
336 | + for(int x = 0; x < surface->w; x ++){ | |
337 | + for(int y = 0; y < surface->h; y ++){ | |
338 | + | |
339 | + } | |
340 | + } | |
341 | + SDL_UnlockSurface(surface); | |
342 | + SDL_FreeSurface(surface); | |
343 | +} | |
344 | + | |
330 | 345 | //char->wx |
331 | 346 | wxString getString(const char* format, ...) |
332 | 347 | { |
@@ -107,27 +107,6 @@ | ||
107 | 107 | setupDialog(); |
108 | 108 | return result; |
109 | 109 | } |
110 | -void LinePropDialog::OnEndpoint1Edit(wxCommandEvent &event) | |
111 | -{ | |
112 | - event.Skip(); | |
113 | -} | |
114 | - | |
115 | - | |
116 | -void LinePropDialog::OnEndpoint2Edit(wxCommandEvent &event) | |
117 | -{ | |
118 | - event.Skip(); | |
119 | -} | |
120 | - | |
121 | - | |
122 | -void LinePropDialog::OnLandscape(wxCommandEvent &event) | |
123 | -{ | |
124 | - if(this->getLineIndex() != NONE){ | |
125 | - line_data* line = get_line_data(lineIndex); | |
126 | - assert(line); | |
127 | - //TODO | |
128 | - //line->flags | |
129 | - } | |
130 | -} | |
131 | 110 | int LinePropDialog::getLineIndex() |
132 | 111 | { |
133 | 112 | return this->lineIndex; |
@@ -167,6 +146,9 @@ | ||
167 | 146 | |
168 | 147 | int index = getLineIndex(); |
169 | 148 | line_data* line = get_line_data(index); |
149 | +#ifdef __WXDEBUG__ | |
150 | + wxASSERT(line); | |
151 | +#endif | |
170 | 152 | |
171 | 153 | text_ctrl_42->SetValue(getString("%d", line->endpoint_indexes[0])); |
172 | 154 | text_ctrl_43->SetValue(getString("%d", line->endpoint_indexes[1])); |
@@ -203,123 +185,92 @@ | ||
203 | 185 | //値代入 |
204 | 186 | setupDialog(); |
205 | 187 | } |
188 | +void LinePropDialog::OnEndpoint1Edit(wxCommandEvent &event) | |
189 | +{ | |
190 | + if(getLineIndex() == NONE)return; | |
191 | + get_line_data(getLineIndex())->endpoint_indexes[0] = atoi(wxConvertWX2MB(event.GetString())); | |
192 | +} | |
206 | 193 | |
194 | + | |
195 | +void LinePropDialog::OnEndpoint2Edit(wxCommandEvent &event) | |
196 | +{ | |
197 | + if(getLineIndex() == NONE)return; | |
198 | + get_line_data(getLineIndex())->endpoint_indexes[1] = atoi(wxConvertWX2MB(event.GetString())); | |
199 | +} | |
200 | + | |
201 | + | |
202 | +void LinePropDialog::OnLandscape(wxCommandEvent &event) | |
203 | +{ | |
204 | + if(getLineIndex() == NONE)return; | |
205 | + SET_LINE_LANDSCAPE_STATUS(get_line_data(getLineIndex()), event.IsChecked()); | |
206 | +} | |
207 | + | |
207 | 208 | void LinePropDialog::OnElevation(wxCommandEvent &event) |
208 | 209 | { |
209 | - event.Skip(); | |
210 | - std::cout<<"Event handler (LinePropDialog::OnElevation) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet | |
210 | + if(getLineIndex() == NONE)return; | |
211 | + SET_LINE_ELEVATION(get_line_data(getLineIndex()), event.IsChecked()); | |
211 | 212 | } |
212 | 213 | |
213 | 214 | |
214 | 215 | void LinePropDialog::OnVariableElev(wxCommandEvent &event) |
215 | 216 | { |
216 | - event.Skip(); | |
217 | - std::cout<<"Event handler (LinePropDialog::OnVariableElev) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet | |
217 | + if(getLineIndex() == NONE)return; | |
218 | + SET_LINE_ELEVATION(get_line_data(getLineIndex()), event.IsChecked()); | |
218 | 219 | } |
219 | 220 | |
220 | 221 | |
221 | 222 | void LinePropDialog::OnHasTransSide(wxCommandEvent &event) |
222 | 223 | { |
223 | - event.Skip(); | |
224 | - std::cout<<"Event handler (LinePropDialog::OnHasTransSide) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet | |
224 | + if(getLineIndex() == NONE)return; | |
225 | + SET_LINE_HAS_TRANSPARENT_SIDE(get_line_data(getLineIndex()), event.IsChecked()); | |
225 | 226 | } |
226 | 227 | |
227 | 228 | |
228 | 229 | void LinePropDialog::OnRadioSel(wxCommandEvent &event) |
229 | 230 | { |
230 | - event.Skip(); | |
231 | - std::cout<<"Event handler (LinePropDialog::OnRadioSel) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet | |
231 | + if(getLineIndex() == NONE)return; | |
232 | + //TODO | |
232 | 233 | } |
233 | 234 | |
234 | 235 | |
235 | 236 | void LinePropDialog::OnFloor(wxCommandEvent &event) |
236 | 237 | { |
237 | - event.Skip(); | |
238 | - std::cout<<"Event handler (LinePropDialog::OnFloor) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet | |
238 | + if(getLineIndex() == NONE)return; | |
239 | + //TODO | |
239 | 240 | } |
240 | 241 | |
241 | 242 | |
242 | 243 | void LinePropDialog::OnCeiling(wxCommandEvent &event) |
243 | 244 | { |
244 | - event.Skip(); | |
245 | - std::cout<<"Event handler (LinePropDialog::OnCeiling) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet | |
245 | + if(getLineIndex() == NONE)return; | |
246 | + //TODO | |
246 | 247 | } |
247 | 248 | |
248 | 249 | |
249 | 250 | void LinePropDialog::OnClockwiseSide(wxCommandEvent &event) |
250 | 251 | { |
251 | - event.Skip(); | |
252 | - std::cout<<"Event handler (LinePropDialog::OnClockwiseSide) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet | |
252 | + if(getLineIndex() == NONE)return; | |
253 | + //TODO | |
253 | 254 | } |
254 | 255 | |
255 | 256 | |
256 | 257 | void LinePropDialog::OnCClockwiseSide(wxCommandEvent &event) |
257 | 258 | { |
258 | - event.Skip(); | |
259 | - std::cout<<"Event handler (LinePropDialog::OnCClockwiseSide) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet | |
259 | + if(getLineIndex() == NONE)return; | |
260 | + //TODO | |
260 | 261 | } |
261 | 262 | |
262 | 263 | |
263 | 264 | void LinePropDialog::OnClockwisePoly(wxCommandEvent &event) |
264 | 265 | { |
265 | - event.Skip(); | |
266 | - std::cout<<"Event handler (LinePropDialog::OnClockwisePoly) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet | |
266 | + if(getLineIndex() == NONE)return; | |
267 | + //TODO | |
267 | 268 | } |
268 | 269 | |
269 | 270 | |
270 | 271 | void LinePropDialog::OnCClockwisePoly(wxCommandEvent &event) |
271 | 272 | { |
272 | - event.Skip(); | |
273 | - std::cout<<"Event handler (LinePropDialog::OnCClockwisePoly) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet | |
273 | + if(getLineIndex() == NONE)return; | |
274 | + //TODO | |
274 | 275 | } |
275 | -static void setupChoice(wxChoice* choice, int max){ | |
276 | - for(int i = 0; i < max; i ++){ | |
277 | - choice->Insert(getString("%d", i), i); | |
278 | - } | |
279 | - choice->Insert(_T("NONE"), max); | |
280 | -} | |
281 | -void LinePropDialog::setupDialog() | |
282 | -{ | |
283 | - //Side Choiceのセットアップ | |
284 | - setupChoice(this->choice_24, (int)SideList.size()); | |
285 | - setupChoice(this->choice_25, (int)SideList.size()); | |
286 | - //Polygon Choice | |
287 | - setupChoice(this->choice_26, (int)PolygonList.size()); | |
288 | - setupChoice(this->choice_27, (int)PolygonList.size()); | |
289 | 276 | |
290 | - int index = getLineIndex(); | |
291 | - if(index == NONE){ | |
292 | - return; | |
293 | - } | |
294 | - | |
295 | - line_data* line = get_line_data(index); | |
296 | -#ifdef __WXDEBUG__ | |
297 | - wxASSERT(line); | |
298 | -#endif | |
299 | - this->text_ctrl_42->SetValue(getString("%d", line->endpoint_indexes[0])); | |
300 | - this->text_ctrl_43->SetValue(getString("%d", line->endpoint_indexes[1])); | |
301 | - | |
302 | - this->checkbox_45->SetValue(LINE_IS_LANDSCAPED(line) != 0); | |
303 | - this->checkbox_52->SetValue(LINE_IS_ELEVATION(line) != 0); | |
304 | - this->checkbox_53->SetValue(LINE_IS_VARIABLE_ELEVATION(line) != 0); | |
305 | - this->checkbox_54->SetValue(LINE_HAS_TRANSPARENT_SIDE(line) != 0); | |
306 | - | |
307 | - this->radio_box_1->SetValue(LINE_IS_SOLID(line)?0:1); | |
308 | - | |
309 | - this->text_ctrl_45->SetValue(getString("%d", line->length)); | |
310 | - this->text_ctrl_46->SetValue(getString("%d", line->length)); | |
311 | - this->text_ctrl_47->SetValue(getString("%d", line->length)); | |
312 | - | |
313 | - int n = line->clockwise_polygon_side_index; | |
314 | - if(n == NONE) n = (int)SideList.size(); | |
315 | - this->choice_24->SetSelection(n); | |
316 | - n = line->counterclockwise_polygon_side_index; | |
317 | - if(n == NONE) n = (int)SideList.size(); | |
318 | - this->choice_25->SetSelection(n); | |
319 | - n = line->clockwise_polygon_owner; | |
320 | - if(n == NONE) n = (int)PolygonList.size(); | |
321 | - this->choice_26->SetSelection(n); | |
322 | - n = line->counterclockwise_polygon_owner; | |
323 | - if(n == NONE) n = (int)PolygonList.size(); | |
324 | - this->choice_27->SetSelection(n); | |
325 | -} |
@@ -51,11 +51,10 @@ | ||
51 | 51 | void OnClockwisePoly(wxCommandEvent &event); // wxGlade: <event_handler> |
52 | 52 | void OnCClockwisePoly(wxCommandEvent &event); // wxGlade: <event_handler> |
53 | 53 | |
54 | - void setupDialog(); | |
55 | 54 | int getLineIndex(); |
56 | 55 | public: |
56 | + void setupDialog(); | |
57 | 57 | void setLineIndex(int index); |
58 | - void setupDialog(); | |
59 | 58 | }; |
60 | 59 | |
61 | 60 | #endif |
@@ -30,9 +30,9 @@ | ||
30 | 30 | ?Q?F?z?u |
31 | 31 | ?R?F?Ăяo???????L?q |
32 | 32 | ?S?F?f?[?^???o?͋L?q |
33 | -?T?F?f?o?b?O???? | |
33 | +?T?F?f?o?b?O?????i???j | |
34 | 34 | |
35 | -Annotation :?f?o?b?O?????i?I?????[?h?͖????j | |
35 | +Annotation :???i?I?????[?h?͖????j | |
36 | 36 | CeilingHeightPaletteDialog |
37 | 37 | :wx |
38 | 38 | ColorCustomize :???o?? |
@@ -45,17 +45,17 @@ | ||
45 | 45 | Placement :???o?? |
46 | 46 | Platform :?z?u |
47 | 47 | PointProp :?z?u |
48 | -PolygonNum :???o?? | |
49 | -PolygonProp :?z?u | |
48 | +PolygonNum :?? | |
49 | +PolygonProp :???? | |
50 | 50 | PolygonType :?z?u |
51 | 51 | SideProp : |
52 | -Terminal :???o?? | |
52 | +Terminal :???? | |
53 | 53 | Texture :?z?u |
54 | 54 | Tool :???o?? |
55 | 55 | Visual : |
56 | 56 | |
57 | 57 | XXXX JumpLevel |
58 | -SelectLevel :?z?u | |
58 | +SelectLevel :?? | |
59 | 59 | MediaPalette :?z?u |
60 | 60 | LightPalette :?z?u |
61 | 61 | SoundPalette :?z?u |
@@ -68,8 +68,8 @@ | ||
68 | 68 | ?ς݁E?P??I?? |
69 | 69 | ?E?e?L?X?g?I?????A?m?e?[?V?????_?C?A???O???o?? |
70 | 70 | Fill |
71 | - ?E?h???|???S???T???????? | |
72 | - Hand | |
71 | + ?ς݁E?h???|???S???T???????? | |
72 | + ?ς? Hand | |
73 | 73 | Line |
74 | 74 | ?E?_?̓Ɨ??lj? |
75 | 75 | ?E???͂??łɂ???_???w?肵?Ă̒lj??ɂ??? |
@@ -210,4 +210,5 @@ | ||
210 | 210 | ?_?C?A???O?̕Ԃ??L????wxID_OK?ɓ???B |
211 | 211 | wxOK?̓X?^?C???ݒ?p?B |
212 | 212 | |
213 | -TODO Shapes?f?[?^?ǂݍ??? | |
\ No newline at end of file | ||
213 | +TODO Shapes?f?[?^?ǂݍ??? | |
214 | +TODO ?ǁi?????????Е??̃|???S?????????݂??Ȃ????j?E?????????????E???????قȂ???ł͕`?悪?قȂ? |
@@ -1,6 +1,6 @@ | ||
1 | 1 | #include "HPLShapesManager.h" |
2 | 2 | #include "HPLError.h" |
3 | - | |
3 | +#include "HPLSurfaceModifier.h" | |
4 | 4 | hpl::shapes::HPLShapesManager::HPLShapesManager() |
5 | 5 | { |
6 | 6 | this->isLoadedShapesFile_ = false; |
@@ -12,12 +12,17 @@ | ||
12 | 12 | { |
13 | 13 | return this->isLoadedShapesFile_; |
14 | 14 | } |
15 | +void hpl::shapes::HPLShapesManager::setLoadedShapesFile(bool loaded) | |
16 | +{ | |
17 | + this->isLoadedShapesFile_ = loaded; | |
18 | +} | |
19 | + | |
15 | 20 | /** |
16 | 21 | Shapesファイルを読み込みます |
17 | 22 | <en> load Shapes file |
18 | 23 | @param path Shapesファイルパス <en> Shapes file's path |
19 | 24 | */ |
20 | -void hpl::shapes::HPLShapesManager::loadShapesFile(const char* path) | |
25 | +void hpl::shapes::loadShapesFile(const char* path) | |
21 | 26 | { |
22 | 27 | initialize_shape_handler(); |
23 | 28 |
@@ -25,7 +30,6 @@ | ||
25 | 30 | if(!ShapesFile.Exists()){ |
26 | 31 | hpl::error::caution("no shapes file"); |
27 | 32 | }else{ |
28 | - isLoadedShapesFile_ = true; | |
29 | 33 | open_shapes_file(ShapesFile); |
30 | 34 | for(int i = 0; i < NUMBER_OF_COLLECTIONS; i ++){ |
31 | 35 | mark_collection_for_loading(i); |
@@ -37,8 +41,52 @@ | ||
37 | 41 | 指定したShapesデータを取得します。 |
38 | 42 | @return 失敗時にNULL |
39 | 43 | */ |
40 | -SDL_Surface* hpl::shapes::HPLShapesManager::getSurface(int collection, int clut, int index) | |
44 | +SDL_Surface* hpl::shapes::getSurface(int collection, int clut, int index, | |
45 | + double illumination) | |
41 | 46 | { |
42 | 47 | //TODO |
43 | - return NULL; | |
48 | + SDL_Color palette[256]; | |
49 | + | |
50 | + //コレクションを別指定。指定する必要がないのでNONE | |
51 | + int excol = NONE; | |
52 | + byte **outp = (byte**)malloc(siezof(byte*)); | |
53 | + int col = BUILD_COLLECTION(collection, clut); | |
54 | + int shape = BUILD_DESCRIPTOR(col, index); | |
55 | + SDL_Surface* surface = get_shape_surface(shape, excol, outp, | |
56 | + illumination, false, palette); | |
57 | +#ifdef __WXDEBUG__ | |
58 | + wxASSERT(surface); | |
59 | +#endif | |
60 | + Uint32 rmask, gmask, bmask, amask; | |
61 | + //空のサーフェイスデータの作成 | |
62 | +#if SDL_BYTEORDER == SDL_BIG_ENDIAN | |
63 | + rmask = 0xff000000; | |
64 | + gmask = 0x00ff0000; | |
65 | + bmask = 0x0000ff00; | |
66 | + amask = 0x000000ff; | |
67 | +#else | |
68 | + rmask = 0x000000ff; | |
69 | + gmask = 0x0000ff00; | |
70 | + bmask = 0x00ff0000; | |
71 | + amask = 0xff000000; | |
72 | +#endif | |
73 | + SDL_Surface* newSurface = SDL_CreateSurface(surface->flags, | |
74 | + surface->w, surface->h, surface->format->BitsPerPixel, | |
75 | + rmask, gmask, bmask, amask); | |
76 | +#ifdef __WXDEBUG__ | |
77 | + wxASSERT(newSurface); | |
78 | +#endif | |
79 | + SDL_LockSurface(surface); | |
80 | + SDL_LockSurface(newSurface); | |
81 | + for(int x = 0; x < surface->w; x ++){ | |
82 | + for(int y = 0; y < surface->h; y ++){ | |
83 | + Uint32 pixel = hpl::surface::getpixel(surface, x, y); | |
84 | + hpl::surface::setpixel(newSurface, x, y, | |
85 | + SDL_MapRGB(newSurface->format, palette[pixel].r, | |
86 | + palette[pixel].g, palette[pixel].b); | |
87 | + } | |
88 | + } | |
89 | + SDL_UnlockSurface(newSurface); | |
90 | + SDL_UnlockSurface(surface); | |
91 | + return newSurface; | |
44 | 92 | } |
@@ -18,6 +18,21 @@ | ||
18 | 18 | |
19 | 19 | namespace hpl{ |
20 | 20 | namespace shapes{ |
21 | + /** | |
22 | + 指定したShapesデータを取得します。 | |
23 | + @return 失敗時にNULL | |
24 | + */ | |
25 | + SDL_Surface* getSurface(int collection, int clut, int index, double illumination); | |
26 | + /** | |
27 | + Shapesファイルを読み込みます | |
28 | + <en> load Shapes file | |
29 | + @param path Shapesファイルパス <en> Shapes file's path | |
30 | + */ | |
31 | + void loadShapesFile(const char* path); | |
32 | + | |
33 | + /** | |
34 | + 読み込み管理 | |
35 | + */ | |
21 | 36 | class HPLShapesManager{ |
22 | 37 | //Shapesファイルを読み込めていたら真 <en> true when Shapes file loaded |
23 | 38 | bool isLoadedShapesFile_; |
@@ -28,18 +43,7 @@ | ||
28 | 43 | |
29 | 44 | public: |
30 | 45 | bool isLoadedShapesFile(); |
31 | - /** | |
32 | - Shapesファイルを読み込みます | |
33 | - <en> load Shapes file | |
34 | - @param path Shapesファイルパス <en> Shapes file's path | |
35 | - */ | |
36 | - void loadShapesFile(const char* path); | |
37 | - | |
38 | - /** | |
39 | - 指定したShapesデータを取得します。 | |
40 | - @return 失敗時にNULL | |
41 | - */ | |
42 | - SDL_Surface* getSurface(int collection, int clut, int index); | |
46 | + void setLoadedShapesFile(bool loaded); | |
43 | 47 | }; |
44 | 48 | }; |
45 | 49 | }; |