• R/O
  • SSH
  • HTTPS

marathon: コミット


コミットメタ情報

リビジョン382 (tree)
日時2007-07-14 20:57:59
作者hogepiyo

ログメッセージ

*** empty log message ***

変更サマリ

差分

--- marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 382)
@@ -231,7 +231,13 @@
231231 {
232232 return &this->shapesManager;
233233 }
234+//ビジュアルモードマネージャを取得します
235+hpl::shapes::HPLVisualModeManager* MapEditorWX::getVisualModeManager()
236+{
237+ return &this->visualModeManager;
238+}
234239
240+
235241 //ビュー座標をワールド座標に直す操作の簡易版
236242 world_point2d MapEditorWX::getWorldPointFromViewPoint(int vx, int vy)
237243 {
@@ -364,6 +370,12 @@
364370 }
365371 SDL_UnlockSurface(surface);
366372 }
373+void MapEditorWX::getYXShapesImage(wxImage* img, int collection, int clut, int index, double illumination)
374+{
375+ SDL_Surface* surface = this->getShapesManager()->getYXSurface(collection, clut, index, illumination);
376+ this->getShapesImageFromSurface(img, surface);
377+ SDL_FreeSurface(surface);
378+}
367379
368380 //char->wx
369381 wxString getString(const char* format, ...)
@@ -375,3 +387,61 @@
375387 wxString str = wxConvertMB2WX(message);
376388 return str;
377389 }
390+
391+/**
392+ setup palette list control
393+*/
394+void MapEditorWX::setupPaletteListControl(int max, wxListCtrl* ctrl)
395+{
396+ wxString* strings = new wxString[max];
397+ wxColor* colors = new wxColor[max];
398+ for(int i = 0; i < max; i ++){
399+ strings[i] = getString("%d", i);
400+ int COL_INTERVAL = 12;
401+ int MULTIPLE = 20;
402+ colors[i] = wxColor(
403+ (i > COL_INTERVAL && i < COL_INTERVAL * 2)?((i-10) * MULTIPLE):0,
404+ (i < COL_INTERVAL) ? i * MULTIPLE:0,
405+ (i > COL_INTERVAL * 2 && i < COL_INTERVAL * 3)?((i-20) * MULTIPLE):0
406+ );
407+ }
408+ delete [] colors;
409+ delete [] strings;
410+}
411+void MapEditorWX::setupPaletteListControl(int max, wxListCtrl* ctrl, wxString strings[],
412+ wxColor colors[])
413+{
414+ const int COLUMN_NUM = 2;
415+
416+ ctrl->DeleteAllItems();
417+ for(int i = 0; i < max; i ++){
418+ for(int column = 0; column < COLUMN_NUM; column ++){
419+ wxListItem item;
420+ item.SetColumn(column);
421+ item.SetId(i);
422+ if(column == 0){
423+ item.SetText(strings[i]);
424+ ctrl->InsertItem(item);
425+ }else{
426+ item.SetBackgroundColour(colors[i]);
427+ //item.SetText(_T("######"));
428+ ctrl->SetItem(item);
429+ }
430+ }
431+ }
432+}
433+
434+wxColor MapEditorWX::getColorFromHeight(int height)
435+{
436+ wxColor color;
437+ if(height < 0){
438+ //負→黒赤
439+ int red = (int)(255.0 * (1.0 - (-(double)height / (double)MAXIMUM_FLOOR_HEIGHT)));
440+ color = wxColor(red, 0, 0);
441+ }else{
442+ //正→赤→白
443+ int notRed = (int)(255.0 * ((double)height / (double)MAXIMUM_FLOOR_HEIGHT));
444+ color = wxColor(255, notRed, notRed);
445+ }
446+ return color;
447+}
--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 382)
@@ -60,6 +60,8 @@
6060 EVT_MENU(ID_ClockwiseSideProp, MapEditorMainFrame::OnClockwiseSide)
6161 EVT_MENU(ID_CounterclockwiseSideProp, MapEditorMainFrame::OnCounterclockwiseSide)
6262 EVT_MENU(ID_PointProp, MapEditorMainFrame::OnPointProp)
63+ EVT_MENU(ID_PolygonProp, MapEditorMainFrame::OnPolygonProp)
64+ EVT_MENU(ID_SetVisualModePlayerStartPosition, MapEditorMainFrame::OnSetVisualModePlayerPosition)
6365
6466 EVT_PAINT(MapEditorMainFrame::OnPaint)
6567 EVT_LEFT_DOWN(MapEditorMainFrame::OnLeftDown)
@@ -210,9 +212,9 @@
210212 for(int index = 0; index < bmpNum; index ++){
211213 wxImage img;
212214 if(invalid){
213- img.Create(1,1);
215+ img.Create(100,100);
214216 }else{
215- wxGetApp().getShapesImage(&img, i, clut, index, illumination);
217+ wxGetApp().getYXShapesImage(&img, i, clut, index, illumination);
216218 }
217219 textureMap[i][clut][index] = img;
218220 }
@@ -324,6 +326,9 @@
324326 wxGetApp().linePopupMenu.Append(ID_CounterclockwiseSideProp, _T("Counterclockwise side prop..."));
325327 wxGetApp().pointPopupMenu.SetTitle(_T("point menu"));
326328 wxGetApp().pointPopupMenu.Append(ID_PointProp, _T("Properties..."));
329+ wxGetApp().polygonPopupMenu.SetTitle(_T("polygon menu"));
330+ wxGetApp().polygonPopupMenu.Append(ID_PolygonProp, _T("Properties..."));
331+ wxGetApp().polygonPopupMenu.Append(ID_SetVisualModePlayerStartPosition, _T("Set visual mode start position"));
327332 }
328333
329334
@@ -502,6 +507,8 @@
502507 }
503508 }
504509 }
510+ wxGetApp().loadImage(START_POINT_IMAGE_FILE_PATH, &this->visualModeStartPositionImage,
511+ 255,255,255);
505512 }
506513 /**
507514 編集モードメニューのチェックを全てはずします
@@ -538,6 +545,9 @@
538545 this->pointPropDialog.Show(false);
539546 this->polyPropDialog.Show(false);
540547 this->objPropDialog.Show(false);
548+
549+ //矢印ツールに戻す
550+ wxGetApp().getEventManager()->setToolType(ToolType::TI_ARROW);
541551 }
542552 if(mode != EditModeType::EM_FLOOR_TEXTURE &&
543553 mode != EditModeType::EM_CEILING_TEXTURE)
@@ -560,16 +570,18 @@
560570 if(mode != EditModeType::EM_CEILING_LIGHT &&
561571 mode != EditModeType::EM_FLOOR_LIGHT)
562572 {
563- //TODO ライトパレットを消す
573+ this->lightPaletteDialog.Show(false);
564574 }
565575 if(mode != EditModeType::EM_MEDIA)
566576 {
567- //TODO メディアパレットを消す
577+ this->mediaPaletteDialog.Show(false);
568578 }
569579 if(mode != EditModeType::EM_SOUND)
570580 {
571- //TODO サウンドパレットを消す
581+ this->soundPaletteDialog.Show(false);
572582 }
573583
584+ wxGetApp().getEventManager()->setEditModeType(mode);
585+
574586 Refresh();
575587 }
--- marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 382)
@@ -6,7 +6,6 @@
66 const double OBJECT_TRIANGLE_LENGTH = 10.0;
77 const double WING_DEG = 120.0;
88
9-
109 /**
1110 マップデータの表示
1211 */
@@ -103,6 +102,7 @@
103102 }
104103 }
105104
105+ /*
106106 if(wxGetApp().getShapesManager()->isLoadedShapesFile()){
107107 //Shapesファイルから読み込みテスト
108108 wxBitmap bmp = wxBitmap(this->texture);
@@ -134,7 +134,7 @@
134134 counter ++;
135135 }
136136 }
137-
137+*/
138138 //バッファから画面へコピー
139139 dc.Blit(wxPoint(0,0), size,
140140 drawDC,
@@ -199,6 +199,8 @@
199199 }
200200
201201 }
202+
203+
202204 /**
203205 ポリゴン描画
204206 */
@@ -258,18 +260,25 @@
258260 dc->SetBrush(this->polyTypeBrushes[polygon->type]);
259261 break;
260262 case EditModeType::EM_FLOOR_HEIGHT:
261- //床高さ
262- if(polygon->floor_height < 0){
263- //負→黒赤
264- int red = (int)(255 * (1.0 - (-(double)polygon->floor_height / MAXIMUM_FLOOR_HEIGHT)));
265- brush.SetColour(red, 0, 0);
266- }else{
267- //正→赤→白
268- int notRed = (int)(255 * (polygon->floor_height / MAXIMUM_FLOOR_HEIGHT));
269- brush.SetColour(255, notRed, notRed);
270- }
263+ brush.SetColour(wxGetApp().getColorFromHeight(polygon->floor_height));
271264 dc->SetBrush(brush);
272265 break;
266+ case EditModeType::EM_CEILING_HEIGHT:
267+ brush.SetColour(wxGetApp().getColorFromHeight(polygon->ceiling_height));
268+ dc->SetBrush(brush);
269+ break;
270+ case EditModeType::EM_FLOOR_TEXTURE:
271+ if(wxGetApp().getShapesManager()->isLoadedShapesFile()){
272+ wxBrush tbr = this->getTexturedBrush(polygon->floor_texture);
273+ dc->SetBrush(tbr);
274+ }
275+ break;
276+ case EditModeType::EM_CEILING_TEXTURE:
277+ if(wxGetApp().getShapesManager()->isLoadedShapesFile()){
278+ wxBrush tbr = this->getTexturedBrush(polygon->ceiling_texture);
279+ dc->SetBrush(tbr);
280+ }
281+ break;
273282 default:
274283 //デフォルト
275284 dc->SetBrush(this->polyBrush);
@@ -303,6 +312,16 @@
303312 dc->DrawPolygon(vertexCount, points);
304313 }
305314 }
315+wxBrush MapEditorMainFrame::getTexturedBrush(int shapesDescriptor)
316+{
317+ int collectionCLUT = GET_DESCRIPTOR_COLLECTION(shapesDescriptor);
318+ int collection = GET_COLLECTION(collectionCLUT);
319+ int clut = GET_COLLECTION_CLUT(collectionCLUT);
320+ int index = GET_DESCRIPTOR_SHAPE(shapesDescriptor);
321+ wxBrush tbr(this->textureMap[collection][clut][index]);
322+ return tbr;
323+}
324+
306325 /**
307326 線描画
308327 */
@@ -603,6 +622,21 @@
603622 transparent);
604623 }
605624 }
625+
626+ //ビジュアルモードのスタートポイントの表示
627+ {
628+ //座標変換
629+ int vpoint[2];
630+ world_point3d location = wxGetApp().getVisualModeManager()->getPlayerPosition();
631+ world_point2d wpoint = {location.x, location.y};
632+ wxGetApp().getViewPointFromWorldPoint(wpoint, vpoint);
633+ wxImage* img = &visualModeStartPositionImage;
634+ bool transparent = true;
635+ dc->DrawBitmap(*img, vpoint[0] - img->GetWidth() / 2, vpoint[1] - img->GetHeight() / 2,
636+ transparent );
637+
638+ }
639+
606640 }
607641 void MapEditorMainFrame::drawAnnotations(wxDC* dc)
608642 {
--- marathon/trunk/MapEditorWX/src/PolygonTypeDialog.h (revision 381)
+++ marathon/trunk/MapEditorWX/src/PolygonTypeDialog.h (revision 382)
@@ -5,6 +5,7 @@
55
66 class PolygonTypeDialog: public wxDialog{
77 wxListCtrl* list_ctrl_2;
8+ int polyType;
89 public:
910 PolygonTypeDialog();
1011 bool Create(wxWindow* parent, wxWindowID id);
@@ -13,6 +14,10 @@
1314 DECLARE_EVENT_TABLE()
1415 void OnSel(wxListEvent &event); // wxGlade: <event_handler>
1516
17+public:
18+ void setupDialog();
19+ void setType(int type);
20+ int getType();
1621 };
1722
1823 #endif
--- marathon/trunk/MapEditorWX/src/TextureDialog.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/TextureDialog.cpp (revision 382)
@@ -27,23 +27,27 @@
2727 //パレット表示
2828 const int MERGIN_X = 10;
2929 const int MERGIN_Y = 10;
30- const int ITEM_W = 100;
30+ const int ITEM_W = 40;
3131 const int ITEM_H = ITEM_W;
3232 const int ITEM_INTERVAL_X = 10;
3333 const int ITEM_INTERVAL_Y = 10;
3434 const int PITCH = (size.GetWidth() - MERGIN_X * 2) / (ITEM_W + ITEM_INTERVAL_X);
3535
36- std::map<int, wxImage>::iterator it;
37- int counter = 0;
38- for(it = imgMap->begin(); it != imgMap->end(); it ++){
39- int x = (counter % PITCH) * (ITEM_W + ITEM_INTERVAL_X) + MERGIN_X;
40- int y = (counter / PITCH) * (ITEM_H + ITEM_INTERVAL_Y) + MERGIN_Y;
41- wxImage scaledImg = it->second.Scale(ITEM_W, ITEM_H);//.Rotate(90);
42- wxBitmap bmp(scaledImg);
43- dc->DrawBitmap(bmp, x, y);
44- counter ++;
45- }
36+ if(wxGetApp().getShapesManager()->isLoadedShapesFile()){
4637
38+ std::map<int, wxImage>::iterator it;
39+ int counter = 0;
40+ double rad = hpl::math::getRadianFromDegree(90);
41+ for(it = imgMap->begin(); it != imgMap->end(); it ++){
42+ int x = (counter % PITCH) * (ITEM_W + ITEM_INTERVAL_X) + MERGIN_X;
43+ int y = (counter / PITCH) * (ITEM_H + ITEM_INTERVAL_Y) + MERGIN_Y;
44+ wxImage scaledImg = it->second.Scale(ITEM_W, ITEM_H);
45+
46+ wxBitmap bmp(scaledImg);
47+ dc->DrawBitmap(bmp, x, y);
48+ counter ++;
49+ }
50+ }
4751 }
4852
4953 BEGIN_EVENT_TABLE(TextureArea, wxScrolledWindow)
--- marathon/trunk/MapEditorWX/src/MediaPaletteDialog.h (revision 381)
+++ marathon/trunk/MapEditorWX/src/MediaPaletteDialog.h (revision 382)
@@ -16,6 +16,8 @@
1616 void OnAdd(wxCommandEvent &event); // wxGlade: <event_handler>
1717 void OnDelete(wxCommandEvent &event); // wxGlade: <event_handler>
1818 void OnEdit(wxListEvent &event); // wxGlade: <event_handler>
19+public:
20+ void setupDialog();
1921 };
2022
2123 #endif
--- marathon/trunk/MapEditorWX/src/ObjectPropDialog.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/ObjectPropDialog.cpp (revision 382)
@@ -377,11 +377,11 @@
377377 //wxWindowDC dc(panel);
378378 //circle
379379 wxBitmap circleBmp(this->directionCircle);
380- dc->DrawBitmap(circleBmp, 0,0);
380+ dc->DrawBitmap(circleBmp, 0,0, true);
381381
382382 //marker
383383 wxBitmap markerBmp(this->directionMarker);
384- dc->DrawBitmap(markerBmp, x - markerW / 2, y - markerH / 2);
384+ dc->DrawBitmap(markerBmp, x - markerW / 2, y - markerH / 2, true);
385385 }
386386
387387 void ObjectPropDialog::OnPaint(wxPaintEvent &event)
--- marathon/trunk/MapEditorWX/src/VisualDialog.h (revision 381)
+++ marathon/trunk/MapEditorWX/src/VisualDialog.h (revision 382)
@@ -10,6 +10,7 @@
1010 virtual ~VisualDialog();
1111
1212 void OnClose();
13+ void OnPaint(wxPaintEvent &ev);
1314 //イベントテーブル作成<en>declare
1415 DECLARE_EVENT_TABLE()
1516 };
--- marathon/trunk/MapEditorWX/src/PlacementDialog.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/PlacementDialog.cpp (revision 382)
@@ -1,6 +1,8 @@
11 #include "PlacementDialog.h"
22 #include "MapEditorWX.h"
33
4+static wxRegEx REG_NUM = _T("[0-9]*");
5+
46 enum{
57 ID_INITIAL,
68 ID_MINIMUM,
@@ -61,6 +63,26 @@
6163 }
6264 }
6365 }
66+static void setListItem(wxListCtrl* lstctrl, object_frequency_definition* placement, int id)
67+{
68+ assert(placement);
69+ wxString str[COLUMN_NUM];
70+ str[0] = _T("");
71+ str[1] = getString("%d", placement->minimum_count);
72+ str[2] = getString("%d", placement->maximum_count);
73+ str[3] = getString("%d", placement->initial_count);
74+ str[4] = getString("%d", placement->random_count);
75+ str[5] = getString("%d", placement->random_chance);
76+ str[6] = getString("%d", placement->flags);
77+
78+ for(int j = 1; j < COLUMN_NUM; j ++){
79+ wxListItem item;
80+ item.SetId(id);
81+ item.SetColumn(j);
82+ item.SetText(str[j]);
83+ lstctrl->SetItem(item);
84+ }
85+}
6486 bool PlacementDialog::Create(wxWindow* parent, wxWindowID id)
6587 {
6688 bool result = wxDialog::Create(parent, id, _T("Placement"));
@@ -134,6 +156,7 @@
134156 }
135157 return result;
136158 }
159+
137160 //OKボタン押した時
138161 void PlacementDialog::OnOk(wxCommandEvent& ev)
139162 {
@@ -142,7 +165,7 @@
142165 }
143166 void PlacementDialog::OnInf(wxCommandEvent &ev)
144167 {
145- //TODO
168+ //TODO
146169 }
147170 void PlacementDialog::OnAllInf(wxCommandEvent &ev)
148171 {
@@ -152,6 +175,17 @@
152175 {
153176 //TODO
154177 }
178+
179+static int getType(int sel)
180+{
181+ int type = (sel >= NUMBER_OF_DEFINED_ITEMS) ? _saved_monster: _saved_item;
182+ return type;
183+}
184+static int getIndex(int sel)
185+{
186+ int index = (sel >= NUMBER_OF_DEFINED_ITEMS) ? (sel - NUMBER_OF_DEFINED_ITEMS) :(sel ) ;
187+ return index;
188+}
155189 void PlacementDialog::OnEditInitial(wxCommandEvent &event)
156190 {
157191 event.Skip();
@@ -161,8 +195,16 @@
161195
162196 void PlacementDialog::OnEditMinimum(wxCommandEvent &event)
163197 {
164- event.Skip();
165- std::cout<<"Event handler (PlacementDialog::OnEditMinimum) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
198+
199+ int type = getType(this->listSelectIndex);
200+ int index = getIndex(this->listSelectIndex);
201+ object_frequency_definition* placement = hpl::aleph::map::getPlacementData(type, index);
202+ wxASSERT(placement);
203+ wxString str = event.GetString();
204+ if(REG_NUM.Matches(str)){
205+ placement->minimum_count = atoi(wxConvertWX2MB(str));
206+ setListItem(this->list_ctrl_1, placement, listSelectIndex);
207+ }
166208 }
167209
168210
@@ -187,7 +229,21 @@
187229 }
188230 void PlacementDialog::OnSel(wxListEvent &ev)
189231 {
190- int sel = ev.GetSelection();
232+ int sel = ev.GetIndex();
233+ if(sel >= 0 && list_ctrl_1->GetSelectedItemCount() == 1){
234+ listSelectIndex = sel;
235+ int type = (sel >= NUMBER_OF_DEFINED_ITEMS) ? _saved_monster: _saved_item;
236+ int index = (type == _saved_item) ? (sel ) : (sel - NUMBER_OF_DEFINED_ITEMS);
237+ object_frequency_definition* placement = hpl::aleph::map::getPlacementData(type, index);
238+
239+ this->text_ctrl_8->SetValue(getString("%d", placement->minimum_count));
240+ this->text_ctrl_9->SetValue(getString("%d", placement->maximum_count));
241+ this->text_ctrl_10->SetValue(getString("%d", placement->initial_count));
242+ this->text_ctrl_11->SetValue(getString("%d", placement->random_count));
243+ this->text_ctrl_12->SetValue(getString("%d", placement->random_chance));
244+ checkbox_39->SetValue(placement->flags != 0);
245+ Refresh();
246+ }
191247 }
192248 void PlacementDialog::OnRandomPlace(wxCommandEvent& ev)
193249 {
--- marathon/trunk/MapEditorWX/src/ColorCustomizeDialog.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/ColorCustomizeDialog.cpp (revision 382)
@@ -144,6 +144,8 @@
144144 panel_4->SetBackgroundColour(getColorFromSetting(ColorType::Polygons));
145145 panel_5->SetBackgroundColour(getColorFromSetting(ColorType::Strings));
146146 panel_6->SetBackgroundColour(getColorFromSetting(ColorType::Points));
147+ panel_a->SetBackgroundColour(getColorFromSetting(ColorType::SameHeightLines));
148+ panel_b->SetBackgroundColour(getColorFromSetting(ColorType::StairLines));
147149 Refresh();
148150 }
149151 void ColorCustomizeDialog::OnOk(wxCommandEvent& ev)
--- marathon/trunk/MapEditorWX/src/MainFrameEvent.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/MainFrameEvent.cpp (revision 382)
@@ -17,10 +17,12 @@
1717 hpl::aleph::view::HPLViewGridManager* vmgr = wxGetApp().getViewGridManager();
1818 vmgr->setNewMousePoint(mx, my);
1919
20+ //ストックマネージャー
21+ hpl::aleph::HPLStockManager* smgr = wxGetApp().getStockManager();
22+
2023 //ポップアップメニューを出す
2124 //TODO
2225 //マウス座標をワールド座標にする
23- world_point2d wmp = wxGetApp().getWorldPointFromViewPoint(mx, my);
2426 hpl::aleph::HPLEventManager* emgr = wxGetApp().getEventManager();
2527 int div = vmgr->getZoomDivision();
2628 int zMin = vmgr->getViewHeightMin();
@@ -28,26 +30,44 @@
2830
2931 int editMode = emgr->getEditModeType();
3032 int toolType = emgr->getToolType();
33+ int voffset[2];
34+ vmgr->getOffset(voffset);
35+
3136 if(editMode == EditModeType::EM_DRAW && toolType == ToolType::TI_ARROW){
3237 //点の上で右クリックしたか?
33- int epIndex = hpl::aleph::map::getSelectPointIndex(wmp,
34- POINT_DISTANCE_EPSILON, zMin, zMax, div, wxGetApp().getStockManager());
38+ int epIndex = hpl::aleph::map::getSelectPointIndex(mx ,my,
39+ POINT_DISTANCE_EPSILON, zMin, zMax,
40+ voffset[0], voffset[1], OFFSET_X_WORLD, OFFSET_Y_WORLD, div,
41+ smgr);
3542 wxGetApp().popupEndpointIndex = epIndex;
3643 if(epIndex != NONE){
3744 //点ポップアップ表示
3845 PopupMenu(&wxGetApp().pointPopupMenu);
39- }else{
40- //点は押されなかった
41- int lineIndex = hpl::aleph::map::getSelectLineIndex(
42- wmp, LINE_DISTANCE_EPSILON, zMin, zMax, div, wxGetApp().getStockManager());
43- wxGetApp().popupLineIndex = lineIndex;
44- if(lineIndex != NONE){
45- //線が押された
46- //→線プロパティをだす
47- PopupMenu(&wxGetApp().linePopupMenu);
48- }
49-
46+ return;
5047 }
48+ //点は押されなかった
49+ int lineIndex = hpl::aleph::map::getSelectLineIndex(mx ,my,
50+ LINE_DISTANCE_EPSILON, zMin, zMax,
51+ voffset[0], voffset[1], OFFSET_X_WORLD, OFFSET_Y_WORLD, div,
52+ smgr);
53+ wxGetApp().popupLineIndex = lineIndex;
54+ if(lineIndex != NONE){
55+ //線が押された
56+ //→線プロパティをだす
57+ PopupMenu(&wxGetApp().linePopupMenu);
58+ return;
59+ }
60+
61+ //ポリゴン上で右クリックしたか? TODO
62+ int polygonIndex = hpl::aleph::map::getSelectPolygonIndex(mx ,my,
63+ zMin, zMax,
64+ voffset[0], voffset[1], OFFSET_X_WORLD, OFFSET_Y_WORLD, div,
65+ smgr);
66+ wxGetApp().popupPolygonIndex = epIndex;
67+ if(polygonIndex != NONE){
68+ PopupMenu(&wxGetApp().polygonPopupMenu);
69+ return;
70+ }
5171 }
5272
5373 }
--- marathon/trunk/MapEditorWX/src/MainFrameLeftDown.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/MainFrameLeftDown.cpp (revision 382)
@@ -285,63 +285,45 @@
285285
286286 /////////////////////////
287287 //lines
288- for(int i = 0; i < (int)LineList.size(); i ++){
289- if(wxGetApp().getStockManager()->delLines[i]){
290- continue;
291- }
292- line_data* line = get_line_data(i);
293- endpoint_data* start = get_endpoint_data(line->endpoint_indexes[0]);
294- endpoint_data* end = get_endpoint_data(line->endpoint_indexes[1]);
288+ int lineIndex = hpl::aleph::map::getSelectLineIndex(mx ,my,
289+ LINE_DISTANCE_EPSILON, zMin, zMax,
290+ voffset[0], voffset[1], OFFSET_X_WORLD, OFFSET_Y_WORLD, div,
291+ wxGetApp().getStockManager());
292+ if(lineIndex != NONE){
293+ line_data* line = get_line_data(lineIndex);
294+ endpoint_data* start = get_endpoint_data(line->endpoint_indexes[0]);
295+ endpoint_data* end = get_endpoint_data(line->endpoint_indexes[1]);
295296
296- //高さチェック
297- int floor = line->highest_adjacent_floor;
298- int ceiling = line->lowest_adjacent_ceiling;
299- if(floor > zMax || ceiling < zMin){
300- continue;
301- }
297+ //選択
298+ int vstart[2];
299+ int vend[2];
300+ wxGetApp().getViewPointFromWorldPoint(start->vertex, vstart);
301+ wxGetApp().getViewPointFromWorldPoint(end->vertex, vend);
302302
303- if(hpl::aleph::map::isSelectLine(mx, my,
304- start->vertex.x, start->vertex.y, end->vertex.x, end->vertex.y,
305- voffset[0], voffset[1], OFFSET_X_WORLD, OFFSET_Y_WORLD, div, LINE_DISTANCE_EPSILON))
306- {
307- //選択
308- int vstart[2];
309- int vend[2];
310- wxGetApp().getViewPointFromWorldPoint(start->vertex, vstart);
311- wxGetApp().getViewPointFromWorldPoint(end->vertex, vend);
312-
313- int offset[2][2];
314- offset[0][0] = vstart[0] - mx;
315- offset[0][1] = vstart[1] - my;
316- offset[1][0] = vend[0] - mx;
317- offset[1][1] = vend[1] - my;
318- sel->addSelLine(i, offset);
319- return true;
320- }
303+ int offset[2][2];
304+ offset[0][0] = vstart[0] - mx;
305+ offset[0][1] = vstart[1] - my;
306+ offset[1][0] = vend[0] - mx;
307+ offset[1][1] = vend[1] - my;
308+ sel->addSelLine(lineIndex, offset);
309+ return true;
321310 }
322311
323312 //ポリゴン
324- //TODO 高さ順にソートする
325- int polyIndex = NONE;
326- for(int i = 0; i < (int)PolygonList.size(); i ++){
327- if(wxGetApp().getStockManager()->delPolygons[i]){
328- continue;
329- }
330- if(hpl::aleph::map::isPointInPolygon(mx, my,
331- i, OFFSET_X_WORLD, OFFSET_Y_WORLD, div,
332- voffset[0], voffset[1]))
333- {
334- polyIndex = i;
335- break;
336- }
337- }
338- if(polyIndex != NONE){
313+ //TODO 高さ順にソートする(まだやってない)
314+ int polyIndex = hpl::aleph::map::getSelectPolygonIndex(mx ,my,
315+ zMin, zMax,
316+ voffset[0], voffset[1], OFFSET_X_WORLD, OFFSET_Y_WORLD, div,
317+ wxGetApp().getStockManager());
318+ if(polyIndex != NONE){
339319 polygon_data* poly = get_polygon_data(polyIndex);
320+#ifdef __WXDEBUG__
321+ wxASSERT(poly);
322+#endif
340323 int n = poly->vertex_count;
341324 int offset[MAXIMUM_VERTICES_PER_POLYGON][2];
342325
343326 //ポリゴンプロパティ表示
344- //TODO
345327 this->polyPropDialog.setPolyIndex(polyIndex);
346328 this->polyPropDialog.Show(true);
347329
@@ -710,8 +692,41 @@
710692
711693 void MapEditorMainFrame::doLButtonOnPolygonMode(wxMouseEvent& ev)
712694 {
695+ //矢印ツール→選択・閲覧
696+ int tool = wxGetApp().getEventManager()->getToolType();
697+ int mx = ev.m_x;
698+ int my = ev.m_y;
699+ int voffset[2];
700+ hpl::aleph::view::HPLViewGridManager* vmgr = wxGetApp().getViewGridManager();
701+ vmgr->getOffset(voffset);
702+ int div = vmgr->getZoomDivision();
703+ hpl::aleph::HPLStockManager* smgr = wxGetApp().getStockManager();
704+ int zMin = vmgr->getViewHeightMin();
705+ int zMax = vmgr->getViewHeightMax();
706+
707+ int polyIndex = hpl::aleph::map::getSelectPolygonIndex(mx ,my,
708+ voffset[0], voffset[1], OFFSET_X_WORLD, OFFSET_Y_WORLD, zMin, zMax, div,
709+ smgr);
710+ polygon_data* poly = get_polygon_data(polyIndex);
711+ if(tool == ToolType::TI_ARROW){
712+ if(poly){
713+ //選択内容をリストコントロールに反映
714+ this->polyTypeDialog.setType(poly->type);
715+ }
716+ }
713717 #ifdef MAP_VIEWER
714718 #else
719+ //塗りつぶしツール→現在選択しているタイプで塗りつぶし
720+ if(tool == ToolType::TI_FILL){
721+ if(poly){
722+ int polyType = this->polyTypeDialog.getType();
723+ if(polyType >= 0){
724+ //タイプを変更
725+ poly->type = polyType;
726+ Refresh();
727+ }
728+ }
729+ }
715730 #endif
716731 }
717732 void MapEditorMainFrame::doLButtonOnFloorHeightMode(wxMouseEvent& ev)
--- marathon/trunk/MapEditorWX/src/LightPaletteDialog.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/LightPaletteDialog.cpp (revision 382)
@@ -1,5 +1,8 @@
11 #include "LightPaletteDialog.h"
22 #include "MapEditorWX.h"
3+
4+const int COLUMN_NUM = 2;
5+
36 enum{
47 ID_EDIT
58 };
@@ -35,7 +38,12 @@
3538 grid_sizer_40->Fit(this);
3639 Layout();
3740
38-
41+ //setup columns
42+ char *columnNames[100] = {"Index", "Color"};
43+ for(int i = 0; i < COLUMN_NUM; i ++){
44+ list_ctrl_5->InsertColumn(i, wxConvertMB2WX(columnNames[i]));
45+ }
46+
3947 return result;
4048 }
4149 void LightPaletteDialog::OnAdd(wxCommandEvent &event)
@@ -54,4 +62,7 @@
5462 void LightPaletteDialog::setFloor(bool fl)
5563 {
5664 this->isFloor_ = fl;
65+ //setup list
66+ wxGetApp().setupPaletteListControl((int)LightList.size(), list_ctrl_5);
67+
5768 }
--- marathon/trunk/MapEditorWX/src/HeightPaletteDialog.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/HeightPaletteDialog.cpp (revision 382)
@@ -33,6 +33,12 @@
3333 SetSizer(grid_sizer_28);
3434 grid_sizer_28->Fit(this);
3535 Layout();
36+ //setup columns
37+ char *columnNames[100] = {"Index", "Color"};
38+ const int COLUMN_NUM = 2;
39+ for(int i = 0; i < COLUMN_NUM; i ++){
40+ list_ctrl_3->InsertColumn(i, wxConvertMB2WX(columnNames[i]));
41+ }
3642 return result;
3743 }
3844 void HeightPaletteDialog::OnAdd(wxCommandEvent &event)
@@ -104,6 +110,33 @@
104110 void HeightPaletteDialog::setFloor(bool floor)
105111 {
106112 this->isFloor_ = floor;
113+ //TODO
114+ std::set<int> heightStock;
115+ for(int i = 0; i < (int)PolygonList.size(); i ++){
116+ polygon_data* poly = get_polygon_data(i);
117+ int height = poly->ceiling_height;
118+ if(this->isFloor()){
119+ height = poly->floor_height;
120+ }
121+ if(heightStock.find(height) == heightStock.end()){
122+ //new height stock
123+ heightStock.insert(height);
124+ }
125+ }
126+ int max = (int)heightStock.size();
127+ wxString* strings = new wxString[max];
128+ wxColor* colors = new wxColor[max];
129+ int counter = 0;
130+ for(std::set<int>::iterator it = heightStock.begin(); it != heightStock.end(); it ++){
131+ int val = (*it);
132+ strings[counter] = getString("%d", val);
133+ colors[counter] = wxGetApp().getColorFromHeight(val);
134+ counter ++;
135+ }
136+ wxGetApp().setupPaletteListControl(max, list_ctrl_3,
137+ strings, colors);
138+ delete [] colors;
139+ delete [] strings;
107140 }
108141 bool HeightPaletteDialog::isFloor(){
109142 return this->isFloor_;
--- marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 381)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 382)
@@ -27,6 +27,7 @@
2727 #include <wx/cursor.h>
2828 #include <wx/xrc/xmlres.h>
2929 #include <wx/filedlg.h>
30+#include <wx/listctrl.h>
3031
3132 #ifdef __BORLANDC__
3233 #pragma hdrstop
@@ -183,12 +184,16 @@
183184 bool isNowOnThePoint;
184185 bool isNowOnTheLine;
185186
187+ //線右クリックをしたときのメニュー
186188 wxMenu linePopupMenu;
187189 wxMenu pointPopupMenu;
190+ wxMenu polygonPopupMenu;
188191
189192 //popup用インデックス覚書
190193 int popupEndpointIndex;
191194 int popupLineIndex;
195+ int popupPolygonIndex;
196+
192197 //public メンバ変数 ここまで
193198 private:
194199
@@ -206,6 +211,9 @@
206211 //Shapesマネージャー
207212 hpl::shapes::HPLShapesManager shapesManager;
208213
214+ //ビジュアルモード管理 <en> manager for visual mode
215+ hpl::shapes::HPLVisualModeManager visualModeManager;
216+
209217 //ツールごとのカーソル
210218 wxCursor cursors[ToolType::NUMBER_OF_TOOLS];
211219
@@ -253,6 +261,9 @@
253261
254262 //ストックマネージャを取得します
255263 hpl::aleph::HPLStockManager* getStockManager();
264+
265+ //ビジュアルモードマネージャを取得します
266+ hpl::shapes::HPLVisualModeManager* getVisualModeManager();
256267
257268 //ビュー座標をワールド座標に直す操作の簡易版
258269 world_point2d getWorldPointFromViewPoint(int vx, int vy);
@@ -286,6 +297,19 @@
286297
287298 void getShapesImage(wxImage* img, int collection, int clut, int index, double illumination);
288299 void getShapesImageFromSurface(wxImage* img, SDL_Surface* surface);
300+ void getYXShapesImage(wxImage* img, int collection, int clut, int index, double illumination);
301+ /**
302+ setup palette list control
303+ */
304+ void setupPaletteListControl(int max, wxListCtrl* ctrl);
305+ void setupPaletteListControl(int max, wxListCtrl* ctrl, wxString strings[], wxColor colors[]);
306+
307+ /**
308+ 高さと色の対応を取得
309+ */
310+ wxColor getColorFromHeight(int height);
311+
312+
289313 private:
290314
291315 };
--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.h (revision 381)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.h (revision 382)
@@ -91,6 +91,8 @@
9191 ID_ClockwiseSideProp,
9292 ID_CounterclockwiseSideProp,
9393 ID_PointProp,
94+ ID_PolygonProp,
95+ ID_SetVisualModePlayerStartPosition,
9496 };
9597
9698 //リソースID
@@ -181,6 +183,9 @@
181183 //ハイライト版
182184 wxImage hilightedMapItemBitmaps[NUMBER_OF_MAP_ICONS];
183185
186+ //ビジュアルモードスタートポイント
187+ wxImage visualModeStartPositionImage;
188+
184189 //
185190 // wxBitmap
186191 //モンスターペン
@@ -264,6 +269,8 @@
264269 void OnClockwiseSide(wxCommandEvent& ev);
265270 void OnCounterclockwiseSide(wxCommandEvent& ev);
266271 void OnPointProp(wxCommandEvent& ev);
272+ void OnPolygonProp(wxCommandEvent& ev);
273+ void OnSetVisualModePlayerPosition(wxCommandEvent& ev);
267274
268275 void OnPaint(wxPaintEvent& ev);
269276
@@ -274,7 +281,7 @@
274281 void OnMotion(wxMouseEvent& ev);
275282 void OnMouseWheel(wxMouseEvent& ev);
276283 void OnLeftDoubleClick(wxMouseEvent& ev);
277-
284+
278285 //サイズ変更<en>change window size event
279286 void OnSize(wxSizeEvent& ev);
280287 //ダブルバッファリング時の背景削除停止用<en>to disable erasing backgroud for double buffering
@@ -418,5 +425,10 @@
418425 */
419426 bool askDestructMap();
420427
428+ /**
429+ the mothod to do when unselect
430+ */
421431 void unselect();
432+
433+ wxBrush getTexturedBrush(int shapesDescriptor);
422434 };
--- marathon/trunk/MapEditorWX/src/PolygonTypeDialog.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/PolygonTypeDialog.cpp (revision 382)
@@ -24,10 +24,44 @@
2424 SetSizer(sizer_53);
2525 sizer_53->Fit(this);
2626 Layout();
27+ //setup columns
28+ char *columnNames[100] = {"Index", "Color"};
29+ const int COLUMN_NUM = 2;
30+ for(int i = 0; i < COLUMN_NUM; i ++){
31+ list_ctrl_2->InsertColumn(i, wxConvertMB2WX(columnNames[i]));
32+ }
33+ wxString strings[NUMBER_OF_POLYGON_TYPE];
34+ wxColor colors[NUMBER_OF_POLYGON_TYPE];
35+ for(int i = 0; i < NUMBER_OF_POLYGON_TYPE; i ++){
36+ strings[i] = wxConvertMB2WX(wxGetApp().polygonTypeInfo[i].jname.c_str());
37+ colors[i] = wxColor(
38+ wxGetApp().polygonTypeColors[i][0],
39+ wxGetApp().polygonTypeColors[i][1],
40+ wxGetApp().polygonTypeColors[i][2]);
41+ }
42+ wxGetApp().setupPaletteListControl(NUMBER_OF_POLYGON_TYPE, list_ctrl_2,
43+ strings, colors);
44+
45+ setType(0);
2746 return result;
2847 }
2948 void PolygonTypeDialog::OnSel(wxListEvent &event)
3049 {
31- event.Skip();
32- std::cout<<"Event handler (PolygonTypeDialog::OnSel) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
50+ polyType = event.GetIndex();
3351 }
52+void PolygonTypeDialog::setupDialog()
53+{
54+}
55+void PolygonTypeDialog::setType(int type)
56+{
57+ this->polyType = type;
58+ //選択設定
59+ for(int i = 0; i < list_ctrl_2->GetItemCount(); i ++){
60+ list_ctrl_2->SetItemState(i, 0, 0);
61+ }
62+ list_ctrl_2->SetItemState(polyType, wxLIST_STATE_SELECTED, 0);
63+}
64+int PolygonTypeDialog::getType()
65+{
66+ return this->polyType;
67+}
--- marathon/trunk/MapEditorWX/src/MediaPaletteDialog.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/MediaPaletteDialog.cpp (revision 382)
@@ -34,7 +34,14 @@
3434 SetSizer(grid_sizer_30);
3535 grid_sizer_30->Fit(this);
3636 Layout();
37- return result;
37+
38+ //setup columns
39+ char *columnNames[100] = {"Index", "Color"};
40+ const int COLUMN_NUM = 2;
41+ for(int i = 0; i < COLUMN_NUM; i ++){
42+ list_ctrl_4->InsertColumn(i, wxConvertMB2WX(columnNames[i]));
43+ }
44+return result;
3845 }
3946 void MediaPaletteDialog::OnAdd(wxCommandEvent &event)
4047 {
@@ -55,3 +62,7 @@
5562 event.Skip();
5663 std::cout<<"Event handler (MediaPaletteDialog::OnEdit) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
5764 }
65+void MediaPaletteDialog::setupDialog()
66+{
67+ wxGetApp().setupPaletteListControl((int)MediaList.size(), list_ctrl_4);
68+}
--- marathon/trunk/MapEditorWX/src/VisualDialog.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/VisualDialog.cpp (revision 382)
@@ -1,6 +1,10 @@
11 #include "VisualDialog.h"
22 #include "MapEditorWX.h"
3+const int VISUAL_MODE_DIALOG_WIDTH = 640;
4+const int VISUAL_MODE_DIALOG_HEIGHT = 480;
5+
36 BEGIN_EVENT_TABLE(VisualDialog, wxDialog)
7+ EVT_PAINT(VisualDialog::OnPaint)
48 END_EVENT_TABLE()
59 VisualDialog::VisualDialog()
610 {
@@ -10,8 +14,9 @@
1014 }
1115 bool VisualDialog::Create(wxWindow* parent, wxWindowID id)
1216 {
13- bool result = wxDialog::Create(parent, id, _T("Visual"));
14-
17+ bool result = wxDialog::Create(parent, id, _T("Visual"), wxPoint(-1,-1),
18+ wxSize(VISUAL_MODE_DIALOG_WIDTH, VISUAL_MODE_DIALOG_HEIGHT));
19+
1520 return result;
1621 }
1722
@@ -18,3 +23,18 @@
1823 void VisualDialog::OnClose()
1924 {
2025 }
26+void VisualDialog::OnPaint(wxPaintEvent &ev)
27+{
28+ wxPaintDC dc(this);
29+
30+ wxSize clientSize = this->GetClientSize();
31+ dc.SetBrush(*wxWHITE_BRUSH);
32+ dc.DrawRectangle(clientSize);
33+
34+ if(wxGetApp().getShapesManager()->isLoadedShapesFile()){
35+ //プレイヤーの位置に設定
36+ render_screen(0);
37+ //スクリーンからコピー
38+
39+ }
40+}
--- marathon/trunk/MapEditorWX/src/DlgCommon.h (revision 381)
+++ marathon/trunk/MapEditorWX/src/DlgCommon.h (revision 382)
@@ -19,6 +19,7 @@
1919 #include <wx/scrolwin.h>
2020 #include <wx/event.h>
2121 #include <wx/dcbuffer.h>
22+#include <wx/regex.h>
2223
2324 #include "HPLLib/HPLEventManager.h"
2425 #include "MapEditorOneSetting.h"
--- marathon/trunk/MapEditorWX/src/MainFrameMenuEvent.cpp (revision 381)
+++ marathon/trunk/MapEditorWX/src/MainFrameMenuEvent.cpp (revision 382)
@@ -89,6 +89,17 @@
8989 }
9090 //セットアップ
9191 wxGetApp().getStockManager()->updateDeletes();
92+
93+ //プレイヤーポジションを設定
94+ //プレイヤーを捜す
95+ for(int i = 0 ; i < (int)SavedObjectList.size(); i ++){
96+ map_object* obj = &SavedObjectList[i];
97+ if(obj->type == _saved_player){
98+ //位置取得
99+ wxGetApp().getVisualModeManager()->setPlayerPosition(obj->location);
100+ break;
101+ }
102+ }
92103 }
93104 void MapEditorMainFrame::OnOpen(wxCommandEvent& WXUNUSED(ev))
94105 {
@@ -290,15 +301,12 @@
290301 //現在の状態を取得
291302 bool checked = ev.IsChecked();
292303
293- //前の段階
294- int editMode = wxGetApp().getEventManager()->getEditModeType();
304+ //モード変更
305+ this->changeEditMode(EditModeType::EM_DRAW);
295306
296307 //一旦全てチェックをはずします
297308 this->uncheckModesOnMenu();
298309
299- //ドローモードにします
300- wxGetApp().getEventManager()->setEditModeType(EditModeType::EM_DRAW);
301-
302310 //全部のダイアログを閉じます
303311 this->closeAllModelessDialogs();
304312 }
@@ -331,9 +339,10 @@
331339 this->changeEditMode(EditModeType::EM_POLYGON_TYPE);
332340
333341 //全部のダイアログを閉じます
334- this->closeAllModelessDialogs();
342+ //this->closeAllModelessDialogs();
335343
336344 //ポリゴンタイプダイアログ表示
345+ this->polyTypeDialog.setupDialog();
337346 this->polyTypeDialog.Show(true);
338347 }
339348 void MapEditorMainFrame::OnFloorHeightMode(wxCommandEvent& ev)
@@ -395,6 +404,7 @@
395404 this->closeAllModelessDialogs();
396405
397406 //メディアパレットダイアログ表示
407+ this->mediaPaletteDialog.setupDialog();
398408 this->mediaPaletteDialog.Show(true);
399409 }
400410 void MapEditorMainFrame::OnFloorTextureMode(wxCommandEvent& ev)
@@ -492,3 +502,23 @@
492502 this->pointPropDialog.setIndex(wxGetApp().popupEndpointIndex);
493503 this->pointPropDialog.Show(true);
494504 }
505+void MapEditorMainFrame::OnPolygonProp(wxCommandEvent& ev)
506+{
507+ this->polyPropDialog.setPolyIndex(wxGetApp().popupPolygonIndex);
508+ this->polyPropDialog.Show(true);
509+}
510+void MapEditorMainFrame::OnSetVisualModePlayerPosition(wxCommandEvent& ev)
511+{
512+ //wxASSERT(wxGetApp().popupPolygonIndex != NONE);
513+ //ポリゴンの床の高さを取得
514+ polygon_data* poly = get_polygon_data(wxGetApp().popupPolygonIndex);
515+#ifdef __WXDEBUG__
516+ hpl::error::halt("polygon index was invalid", wxGetApp().popupPolygonIndex);
517+#endif
518+ int height = poly->floor_height;
519+ int mpoint[2];
520+ wxGetApp().getViewGridManager()->getNewMousePoint(mpoint);
521+ //ワールド座標に変換
522+ world_point2d wpoint = wxGetApp().getWorldPointFromViewPoint(mpoint[0], mpoint[1]);
523+ wxGetApp().getVisualModeManager()->setPlayerPosition(wpoint.x, wpoint.y, height);
524+}
--- marathon/trunk/MapEditorWX/src/PlacementDialog.h (revision 381)
+++ marathon/trunk/MapEditorWX/src/PlacementDialog.h (revision 382)
@@ -21,6 +21,8 @@
2121 wxCheckBox* checkbox_39;
2222 wxListCtrl* list_ctrl_1;
2323 wxButton* button_16;
24+
25+ int listSelectIndex;
2426 public:
2527 PlacementDialog();
2628 virtual ~PlacementDialog();
--- marathon/trunk/MapEditorWX/setting.ini (revision 381)
+++ marathon/trunk/MapEditorWX/setting.ini (revision 382)
@@ -1,4 +1,12 @@
11 GRID_SIZE_INDEX=0
2-COLOR_PRESET=1
3-BACKGROUND=0,0,0GRID=50,50,50LINES=50,255,0POLYGONS=0,50,0STRINGS=100,255,0POINTS=255,255,0SAME_HEIGHT_LINES=50,100,50STAIR_LINES=150,200,150
4-FLAGS=1,1,1,1,1,1,1,1,1,1,1,1,
\ No newline at end of file
2+COLOR_PRESET=2
3+BACKGROUND=255,255,255
4+GRID=100,100,100
5+LINES=0,0,0
6+POLYGONS=200,200,200
7+STRINGS=0,0,0
8+POINTS=0,0,255
9+SAME_HEIGHT_LINES=200,100,200
10+STAIR_LINES=66,185,162
11+
12+FLAGS=1,1,1,1,1,1,1,1,1,1,1,1,
--- marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 381)
+++ marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 382)
@@ -231,6 +231,19 @@
231231
232232 TODO ?Z???N?g?????E?????Z???N?g?????ꍇ?Ƀ_?C?A???O?̐ݒ??NONE?ɂ??镔??
233233 ???????x???Ȃ肪???Ȃ̂ŁA?d?????????s??Ȃ??悤?ɒ???
234-TODO ObjPropDialog??Facing?`??B
234+done TODO ObjPropDialog??Facing?`??B
235235 ?A?N?V???????N???????ꍇ?݂̂ɕ`?悷??Ηǂ?
236-
\ No newline at end of file
236+
237+TODO setup lights/media/sounds/height dialog
238+TODO polygon type color
239+TODO color customizer
240+
241+?r?W???A?????[?h
242+render_screen
243+?v???C???[?̈ʒu
244+?E?????l?̓}?b?v??񂩂?B
245+?E?|???S???E?N???b?N?ŃT?u???j???[
246+ ?E?r?W???A?????[?h?X?^?[?g?|?C???g?̐ݒu??p??
247+ ?E?‚??łɃv???p?e?B???p??
248+?r?W???A?????[?h?X?^?[?g?|?C???g
249+Clear()????ƃJ?????܂ŏ??????
--- marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.cpp (revision 381)
+++ marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.cpp (revision 382)
@@ -121,6 +121,7 @@
121121 for(int i = 0; i < NUMBER_OF_EDITOR_FLAGS; i ++){
122122 fprintf(fp, "%d,", flags[i]? 1: 0);
123123 }
124+ fprintf(fp,"\n");
124125 fclose(fp);
125126 }
126127 return true;
@@ -134,6 +135,7 @@
134135 fprintf(fp, ",");
135136 }
136137 }
138+ fprintf(fp,"\n");
137139 }
138140
139141 void MapEditorOneSetting::setSettingToDefault()
@@ -164,10 +166,14 @@
164166 }else{
165167 memcpy(&colorSetting, setting, sizeof(ColorSettings));
166168 }
169+
170+ //save setting
171+ this->saveSetting();
167172 }
168173 void MapEditorOneSetting::setColorSetting(int type)
169174 {
170175 MapEditorOneSetting::setColorSetting(type, &colorSetting);
176+ this->saveSetting();
171177 }
172178
173179 //static
--- marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.h (revision 381)
+++ marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.h (revision 382)
@@ -76,6 +76,7 @@
7676 const int START_OF_TEXTURE = _collection_walls1;
7777 static char* TAG_NAME_FILE_PATH = "data/InnerSettingTagList.ini";
7878 static char* INNER_DATA_FILE_PATH = "data/InnerSetting.ini";
79+static char* START_POINT_IMAGE_FILE_PATH = "data/Map Icons/center X.bmp";
7980
8081 //point flags
8182 enum
--- marathon/trunk/HPLLib/HPLVisualModeManager.cpp (nonexistent)
+++ marathon/trunk/HPLLib/HPLVisualModeManager.cpp (revision 382)
@@ -0,0 +1,22 @@
1+#include "HPLVisualModeManager.h"
2+
3+hpl::shapes::HPLVisualModeManager::HPLVisualModeManager()
4+{
5+}
6+hpl::shapes::HPLVisualModeManager::~HPLVisualModeManager()
7+{
8+}
9+void hpl::shapes::HPLVisualModeManager::setPlayerPosition(world_point3d location)
10+{
11+ memcpy(&this->playerPosition, &location, sizeof(world_point3d));
12+}
13+void hpl::shapes::HPLVisualModeManager::setPlayerPosition(int x, int y, int z)
14+{
15+ this->playerPosition.x = x;
16+ this->playerPosition.y = y;
17+ this->playerPosition.z = z;
18+}
19+world_point3d hpl::shapes::HPLVisualModeManager::getPlayerPosition()
20+{
21+ return this->playerPosition;
22+}
--- marathon/trunk/HPLLib/HPLVisualModeManager.h (nonexistent)
+++ marathon/trunk/HPLLib/HPLVisualModeManager.h (revision 382)
@@ -0,0 +1,41 @@
1+#ifndef _HPL_VISUAL_MODE_MANAGER_
2+#define _HPL_VISUAL_MODE_MANAGER_
3+
4+#include "header.h"
5+#include "extensions.h"
6+#include "FileHandler.h"
7+#include "map.h"
8+#include "game_wad.h"
9+#include "weapons.h"
10+#include "items.h"
11+#include "monsters.h"
12+#include "scenery_definitions.h"
13+#include "mysound.h"
14+#include "computer_interface.h"
15+#include "editor.h"
16+#include "lightsource.h"
17+#include "media.h"
18+#include "collection_definition.h"
19+#include "shape_definitions.h"
20+#include "shapes_sdl.h"
21+
22+/**
23+ ビジュアルモードでの操作を全般的に管理します
24+ <en> managing operation in visual mode
25+*/
26+
27+namespace hpl{
28+namespace shapes{
29+ class HPLVisualModeManager{
30+ world_point3d playerPosition;
31+ public:
32+ HPLVisualModeManager();
33+ ~HPLVisualModeManager();
34+ void setPlayerPosition(world_point3d location);
35+ void setPlayerPosition(int x, int y, int z);
36+ world_point3d getPlayerPosition();
37+ };
38+};
39+};
40+
41+#endif
--- marathon/trunk/HPLLib/HPLMapTool.cpp (revision 381)
+++ marathon/trunk/HPLLib/HPLMapTool.cpp (revision 382)
@@ -229,6 +229,36 @@
229229 return index;
230230 }
231231
232+/**
233+ 指定した点がポリゴンを踏んでいる場合、そのポリゴンを返します
234+*/
235+int hpl::aleph::map::getSelectPolygonIndex(int viewX, int viewY, int zMin, int zMax,
236+ int voffsetX, int voffsetY, int offsetXW, int offsetYW, int div,
237+ hpl::aleph::HPLStockManager* smgr)
238+{
239+ for(int i = 0; i < (int)PolygonList.size(); i ++){
240+ polygon_data* poly = get_polygon_data(i);
241+ //削除チェック
242+ if(smgr->delPolygons[i]){
243+ continue;
244+ }
245+ //高さチェック
246+ if(!hpl::aleph::map::isValidHeight(poly->floor_height, poly->ceiling_height,
247+ zMin, zMax))
248+ {
249+ continue;
250+ }
251+ //選択出来ているか判定
252+ if(hpl::aleph::map::isPointInPolygon(viewX, viewY,
253+ i, offsetXW, offsetYW, div,
254+ voffsetX, voffsetY))
255+ {
256+ return i;
257+ }
258+ }
259+ return NONE;
260+}
261+
232262 /////////////////////// Lines ////////////////////////////////////////////
233263
234264 bool hpl::aleph::map::isSelectLine(int viewPX, int viewPY,
--- marathon/trunk/HPLLib/HPLShapesManager.cpp (revision 381)
+++ marathon/trunk/HPLLib/HPLShapesManager.cpp (revision 382)
@@ -77,7 +77,8 @@
7777
7878 FileSpecifier ShapesFile(path);
7979 if(!ShapesFile.Exists()){
80- hpl::error::halt("cannot load shapes file[%s]", path);
80+ hpl::error::caution("cannot load shapes file[%s]", path);
81+ return false;
8182 }else{
8283 open_shapes_file(ShapesFile);
8384
@@ -163,3 +164,28 @@
163164
164165 return newSurface;
165166 }
167+/**
168+ walls/landscapes are inversed between X and Y
169+ get surface inversed
170+*/
171+SDL_Surface* hpl::shapes::HPLShapesManager::getYXSurface(int collection, int clut, int index, double illumination)
172+{
173+ SDL_Surface* surface = getSurface(collection, clut, index, illumination);
174+
175+ SDL_Surface* newSurface = createSurface(screenSurface->flags,
176+ surface->h, surface->w, NEW_SURFACE_BPP);
177+ SDL_LockSurface(surface);
178+ SDL_LockSurface(newSurface);
179+// int colorPaletteOffset = header->collection->color_table_offset;
180+ for(int y = 0; y < surface->h; y ++){
181+ for(int x = 0; x < surface->w; x ++){
182+ Uint32 pixel = hpl::surface::getpixel(surface, x, y);
183+ hpl::surface::setpixel(newSurface, y, x, pixel);
184+ }
185+ }
186+ SDL_UnlockSurface(newSurface);
187+ SDL_UnlockSurface(surface);
188+
189+ SDL_FreeSurface(surface);
190+ return newSurface;
191+}
--- marathon/trunk/HPLLib/HPLMapTool.h (revision 381)
+++ marathon/trunk/HPLLib/HPLMapTool.h (revision 382)
@@ -153,7 +153,7 @@
153153 bool isValidHeight(int checkMin, int checkMax, int validMin, int validMax);
154154
155155 /**
156- 指定した点が線を踏んでいる場合、その点
156+ 指定した点が線を踏んでいる場合、その線番号を返します
157157 */
158158 int getSelectLineIndex(world_point2d& wpoint, int threshold, int zMin, int zMax, int div,
159159 hpl::aleph::HPLStockManager* smgr);
@@ -161,6 +161,12 @@
161161 int voffsetX, int voffsetY, int offsetXW, int offsetYW, int div,
162162 hpl::aleph::HPLStockManager* smgr);
163163
164+ /**
165+ 指定した点がポリゴンを踏んでいる場合、そのポリゴンを返します
166+ */
167+ int getSelectPolygonIndex(int viewX, int viewY, int zMin, int zMax,
168+ int voffsetX, int voffsetY, int offsetXW, int offsetYW, int div,
169+ hpl::aleph::HPLStockManager* smgr);
164170 /////////////////////// Lines ////////////////////////////////////////////
165171 /**
166172 指定した点を用いたときに線を選択できているかを判定
--- marathon/trunk/HPLLib/HPLShapesManager.h (revision 381)
+++ marathon/trunk/HPLLib/HPLShapesManager.h (revision 382)
@@ -58,6 +58,12 @@
5858 SDL_Surface* getSurface(int collection, int clut, int index, double illumination);
5959
6060 /**
61+ walls/landscapes are inversed between X and Y
62+ get surface inversed
63+ */
64+ SDL_Surface* getYXSurface(int collection, int clut, int index, double illumination);
65+
66+ /**
6167 Shapesファイルを読み込みます
6268 <en> load Shapes file
6369 @param path Shapesファイルパス <en> Shapes file's path
--- marathon/trunk/HPLLib/HPLAlephLib.h (revision 381)
+++ marathon/trunk/HPLLib/HPLAlephLib.h (revision 382)
@@ -9,6 +9,7 @@
99 #include "HPLEventManager.h"
1010 #include "HPLStockManager.h"
1111 #include "HPLShapesManager.h"
12+#include "HPLVisualModeManager.h"
1213
1314 //一般向け
1415 #include "HPLMath.h"
--- marathon/trunk/HPLLib/HPLError.cpp (revision 381)
+++ marathon/trunk/HPLLib/HPLError.cpp (revision 382)
@@ -16,7 +16,7 @@
1616 vsprintf(message, format, maker);
1717 // int len = strlen(message);
1818
19-#ifdef __WXDEBUG__
19+#ifdef WX
2020 wxMessageBox(wxConvCurrent->cMB2WX(message));
2121 #endif
2222 #ifdef WIN32
旧リポジトリブラウザで表示