• R/O
  • SSH
  • HTTPS

marathon: コミット


コミットメタ情報

リビジョン369 (tree)
日時2007-07-08 19:20:42
作者hogepiyo

ログメッセージ

*** empty log message ***

変更サマリ

差分

--- marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 368)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 369)
@@ -327,6 +327,21 @@
327327 isFirstOfLineToAdd = true;
328328 }
329329
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+
330345 //char->wx
331346 wxString getString(const char* format, ...)
332347 {
--- marathon/trunk/MapEditorWX/src/LinePropDialog.cpp (revision 368)
+++ marathon/trunk/MapEditorWX/src/LinePropDialog.cpp (revision 369)
@@ -107,27 +107,6 @@
107107 setupDialog();
108108 return result;
109109 }
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-}
131110 int LinePropDialog::getLineIndex()
132111 {
133112 return this->lineIndex;
@@ -167,6 +146,9 @@
167146
168147 int index = getLineIndex();
169148 line_data* line = get_line_data(index);
149+#ifdef __WXDEBUG__
150+ wxASSERT(line);
151+#endif
170152
171153 text_ctrl_42->SetValue(getString("%d", line->endpoint_indexes[0]));
172154 text_ctrl_43->SetValue(getString("%d", line->endpoint_indexes[1]));
@@ -203,123 +185,92 @@
203185 //値代入
204186 setupDialog();
205187 }
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+}
206193
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+
207208 void LinePropDialog::OnElevation(wxCommandEvent &event)
208209 {
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());
211212 }
212213
213214
214215 void LinePropDialog::OnVariableElev(wxCommandEvent &event)
215216 {
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());
218219 }
219220
220221
221222 void LinePropDialog::OnHasTransSide(wxCommandEvent &event)
222223 {
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());
225226 }
226227
227228
228229 void LinePropDialog::OnRadioSel(wxCommandEvent &event)
229230 {
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
232233 }
233234
234235
235236 void LinePropDialog::OnFloor(wxCommandEvent &event)
236237 {
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
239240 }
240241
241242
242243 void LinePropDialog::OnCeiling(wxCommandEvent &event)
243244 {
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
246247 }
247248
248249
249250 void LinePropDialog::OnClockwiseSide(wxCommandEvent &event)
250251 {
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
253254 }
254255
255256
256257 void LinePropDialog::OnCClockwiseSide(wxCommandEvent &event)
257258 {
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
260261 }
261262
262263
263264 void LinePropDialog::OnClockwisePoly(wxCommandEvent &event)
264265 {
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
267268 }
268269
269270
270271 void LinePropDialog::OnCClockwisePoly(wxCommandEvent &event)
271272 {
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
274275 }
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());
289276
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-}
--- marathon/trunk/MapEditorWX/src/LinePropDialog.h (revision 368)
+++ marathon/trunk/MapEditorWX/src/LinePropDialog.h (revision 369)
@@ -51,11 +51,10 @@
5151 void OnClockwisePoly(wxCommandEvent &event); // wxGlade: <event_handler>
5252 void OnCClockwisePoly(wxCommandEvent &event); // wxGlade: <event_handler>
5353
54- void setupDialog();
5554 int getLineIndex();
5655 public:
56+ void setupDialog();
5757 void setLineIndex(int index);
58- void setupDialog();
5958 };
6059
6160 #endif
--- marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 368)
+++ marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 369)
@@ -30,9 +30,9 @@
3030 ?Q?F?z?u
3131 ?R?F?Ăяo???????L?q
3232 ?S?F?f?[?^???o?͋L?q
33-?T?F?f?o?b?O????
33+?T?F?f?o?b?O?????i???j
3434
35-Annotation :?f?o?b?O?????i?I?????[?h?͖????j
35+Annotation :???i?I?????[?h?͖????j
3636 CeilingHeightPaletteDialog
3737 :wx
3838 ColorCustomize :???o??
@@ -45,17 +45,17 @@
4545 Placement :???o??
4646 Platform :?z?u
4747 PointProp :?z?u
48-PolygonNum :???o??
49-PolygonProp :?z?u
48+PolygonNum :??
49+PolygonProp :????
5050 PolygonType :?z?u
5151 SideProp :
52-Terminal :???o??
52+Terminal :????
5353 Texture :?z?u
5454 Tool :???o??
5555 Visual :
5656
5757 XXXX JumpLevel
58-SelectLevel :?z?u
58+SelectLevel :??
5959 MediaPalette :?z?u
6060 LightPalette :?z?u
6161 SoundPalette :?z?u
@@ -68,8 +68,8 @@
6868 ?ς݁E?P??I??
6969 ?E?e?L?X?g?I?????A?m?e?[?V?????_?C?A???O???o??
7070 Fill
71- ?E?h???|???S???T????????
72- Hand
71+ ?ς݁E?h???|???S???T????????
72+ ?ς? Hand
7373 Line
7474 ?E?_?̓Ɨ??lj?
7575 ?E???͂??łɂ???_???w?肵?Ă̒lj??ɂ???
@@ -210,4 +210,5 @@
210210 ?_?C?A???O?̕Ԃ??L????wxID_OK?ɓ???B
211211 wxOK?̓X?^?C???ݒ?p?B
212212
213-TODO Shapes?f?[?^?ǂݍ???
\ No newline at end of file
213+TODO Shapes?f?[?^?ǂݍ???
214+TODO ?ǁi?????????Е??̃|???S?????????݂??Ȃ????j?E?????????????E???????قȂ???ł͕`?悪?قȂ?
--- marathon/trunk/HPLLib/HPLShapesManager.cpp (revision 368)
+++ marathon/trunk/HPLLib/HPLShapesManager.cpp (revision 369)
@@ -1,6 +1,6 @@
11 #include "HPLShapesManager.h"
22 #include "HPLError.h"
3-
3+#include "HPLSurfaceModifier.h"
44 hpl::shapes::HPLShapesManager::HPLShapesManager()
55 {
66 this->isLoadedShapesFile_ = false;
@@ -12,12 +12,17 @@
1212 {
1313 return this->isLoadedShapesFile_;
1414 }
15+void hpl::shapes::HPLShapesManager::setLoadedShapesFile(bool loaded)
16+{
17+ this->isLoadedShapesFile_ = loaded;
18+}
19+
1520 /**
1621 Shapesファイルを読み込みます
1722 <en> load Shapes file
1823 @param path Shapesファイルパス <en> Shapes file's path
1924 */
20-void hpl::shapes::HPLShapesManager::loadShapesFile(const char* path)
25+void hpl::shapes::loadShapesFile(const char* path)
2126 {
2227 initialize_shape_handler();
2328
@@ -25,7 +30,6 @@
2530 if(!ShapesFile.Exists()){
2631 hpl::error::caution("no shapes file");
2732 }else{
28- isLoadedShapesFile_ = true;
2933 open_shapes_file(ShapesFile);
3034 for(int i = 0; i < NUMBER_OF_COLLECTIONS; i ++){
3135 mark_collection_for_loading(i);
@@ -37,8 +41,52 @@
3741 指定したShapesデータを取得します。
3842 @return 失敗時にNULL
3943 */
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)
4146 {
4247 //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;
4492 }
--- marathon/trunk/HPLLib/HPLShapesManager.h (revision 368)
+++ marathon/trunk/HPLLib/HPLShapesManager.h (revision 369)
@@ -18,6 +18,21 @@
1818
1919 namespace hpl{
2020 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+ */
2136 class HPLShapesManager{
2237 //Shapesファイルを読み込めていたら真 <en> true when Shapes file loaded
2338 bool isLoadedShapesFile_;
@@ -28,18 +43,7 @@
2843
2944 public:
3045 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);
4347 };
4448 };
4549 };
旧リポジトリブラウザで表示