• R/O
  • SSH
  • HTTPS

marathon: コミット


コミットメタ情報

リビジョン328 (tree)
日時2007-06-13 00:46:41
作者hogepiyo

ログメッセージ

*** empty log message ***

変更サマリ

差分

--- marathon/trunk/MapEditorWX/src/AnnotationDialog.h (revision 327)
+++ marathon/trunk/MapEditorWX/src/AnnotationDialog.h (revision 328)
@@ -42,12 +42,14 @@
4242 wxTextCtrl* viewX;
4343 wxTextCtrl* viewY;
4444
45+ //ポリゴン依存
46+ wxChoice* polyChoice;
4547 public:
4648 AnnotationDialog();
4749 /**
4850 @param annotation 選択したアノテーションデータ、あるいは新規作成の位置&ポリゴン番号
4951 */
50- bool Create(wxWindow* parent, wxWindowID id, const wxString& title,
52+ bool Create(wxWindow* parent, wxWindowID id,
5153 map_annotation& annotation);
5254
5355 virtual ~AnnotationDialog();
--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 327)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 328)
@@ -301,5 +301,24 @@
301301 wxGetApp().loadBitmap(POLYGON_SELECT_STLIPPLE_BITMAP_FILE_PATH, &bmp);
302302 this->polySelNetBrush = wxBrush(bmp);
303303
304+ //オブジェクトカラー
305+ //プレイヤーペン(yellow)
306+ this->playerPen.SetColour(wxColor(255,255,0));
307+ this->playerBrush.SetColour(wxColor(255,255,0));
308+ //選択プレイヤー
309+ this->selectedPlayerPen.SetColour(wxColor(255,0,255));
310+ this->selectedPlayerBrush.SetColour(wxColor(255,0,255));
311+ //味方
312+ this->allyPen.SetColour(wxColor(0,0,255));
313+ this->allyBrush.SetColour(wxColor(0,0,255));
314+ //選択味方
315+ this->selectedAllyPen.SetColour(wxColor(100,0,255));
316+ this->selectedAllyBrush.SetColour(wxColor(100,0,255));
317+ //モンスター
318+ this->monsterPen.SetColour(wxColor(255,0,0));
319+ this->monsterBrush.SetColour(wxColor(255,0,0));
320+ //選択モンスター
321+ this->selectedMonsterPen.SetColour(wxColor(0,255,0));
322+ this->selectedMonsterBrush.SetColour(wxColor(0,255,0));
304323 }
305324
--- marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 327)
+++ marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 328)
@@ -1,5 +1,8 @@
11 #include "MapEditorMainFrame.h"
22
3+const double ROUND_DEGREE = 360.0;
4+const double OBJECT_TRIANGLE_LENGTH = 10.0;
5+const double OBJECT_TRIANGLE_WING_DEGREE = 120.0;
36
47 /**
58 マップデータの表示
@@ -168,6 +171,106 @@
168171 }
169172 void MapEditorMainFrame::drawObjects(wxDC* dc)
170173 {
174+ wxPoint points[3];
175+ //高さ制限
176+ int zMin = wxGetApp().getViewGridManager()->getViewHeightMin();
177+ int zMax = wxGetApp().getViewGridManager()->getViewHeightMax();
178+
179+ for(int i = 0; i < (int)SavedObjectList.size(); i ++){
180+ map_object* obj = &(SavedObjectList[i]);
181+
182+ int type = obj->type;
183+ int index = obj->index;
184+
185+ int facing = obj->facing;
186+
187+ int x = obj->location.x;
188+ int y = obj->location.y;
189+ int z = obj->location.z;
190+
191+ //check height
192+ //高さ制限の範囲外なら表示しない
193+ if(z < zMin || z > zMax){
194+ continue;
195+ }
196+
197+ int vpoing[2];
198+ world_point2d wpoint = {x,y};
199+ wxGetApp().getViewPointFromWorldPoint(wpoint, vpoint);
200+
201+ //選択状態をチェック
202+ bool select = false;
203+ if(wxGetApp().selectData.isSelected() &&
204+ wxGetApp().selectData.containsObject(i)){
205+ select = true;
206+ }
207+ if(type == _saved_monster || type == _saved_player){
208+ //三角形を描く
209+ if(type == _saved_monster){
210+ //モンスター
211+ if(index >= _civilian_crew &&
212+ index <= _civilian_security ||
213+ index >= _civilian_fusion_crew &&
214+ index <= _civilian_fusion_security)
215+ {
216+ //ボブ
217+ if(select){
218+ dc->SetPen(this->selectedAllyPen);
219+ dc->SetBrush(this->selectedAllyBrush);
220+ }else{
221+ dc->SetPen(this->allyPen);
222+ dc->SetBrush(this->allyBrush);
223+ }
224+ }else{
225+ //moonster
226+ if(select){
227+ dc->SetPen(this->selectedMonsterPen);
228+ dc->SetBrush(this->selectedMonsterBrush);
229+ }else{
230+ dc->SetPen(this->monsterPen);
231+ dc->SetBrush(this->monsterBrush);
232+ }
233+ }
234+
235+ }else{
236+ //player
237+ if(select){
238+ dc->SetPen(this->selectedPlayerPen);
239+ dc->SetBrush(this->selectedPlayerBrush);
240+ }else{
241+ dc->SetPen(this->playerPen);
242+ dc->SetBrush(this->playerBrush);
243+ }
244+ }
245+
246+ double deg = (double)facing / (1<<ANGULAR_BITS) * ROUND_DEGREE;
247+ double rad = hpl::math::getRadianFromDegree(deg);
248+ double rad1 = hpl::math::getRadianFromDegree(deg + OBJECT_TRIANGLE_WING_DEGREE);
249+ double rad2 = hpl::math::getRadianFromDegree(deg - OBJECT_TRIANGLE_WING_DEGREE);
250+
251+ //三角形を描く
252+ points[0].x = vpoint[0] + (int)(OBJECT_TRIANGLE_LENGTH * cos(rad));
253+ points[0].y = vpoint[1] + (int)(OBJECT_TRIANGLE_LENGTH * sin(rad));
254+ points[1].x = vpoint[0] + (int)(OBJECT_TRIANGLE_LENGTH / 2.0 * cos(rad1));
255+ points[1].y = vpoint[1] + (int)(OBJECT_TRIANGLE_LENGTH / 2.0 * sin(rad1));
256+ points[2].x = vpoint[0] + (int)(OBJECT_TRIANGLE_LENGTH / 2.0 * cos(rad2));
257+ points[2].y = vpoint[1] + (int)(OBJECT_TRIANGLE_LENGTH / 2.0 * sin(rad2));
258+ dc->DrawPolygon(3. points);
259+
260+ }else{
261+ //
262+ //ビットマップ表示
263+ case _saved_item:
264+ break;
265+ case _saved_object:
266+ //scenery
267+ break;
268+ case _saved_goal:
269+ break;
270+ default:
271+ //sound
272+ }
273+ }
171274 }
172275 void MapEditorMainFrame::drawAnnotations(wxDC* dc)
173276 {
--- marathon/trunk/MapEditorWX/src/PolygonNumDialog.cpp (nonexistent)
+++ marathon/trunk/MapEditorWX/src/PolygonNumDialog.cpp (revision 328)
@@ -0,0 +1,16 @@
1+#include "PolygonNumDialog.h"
2+#include "MapEditorWX.h"
3+BEGIN_EVENT_TABLE(PolygonNumDialog, wxDialog)
4+END_EVENT_TABLE()
5+PolygonNumDialog::PolygonNumDialog()
6+{
7+}
8+PolygonNumDialog::~PolygonNumDialog()
9+{
10+}
11+bool PolygonNumDialog::Create(wxWindow* parent, wxWindowID id, const wxString& title)
12+{
13+ bool result = wxDialog::Create(parent, id, title);
14+
15+ return result;
16+}
--- marathon/trunk/MapEditorWX/src/AnnotationDialog.cpp (revision 327)
+++ marathon/trunk/MapEditorWX/src/AnnotationDialog.cpp (revision 328)
@@ -11,7 +11,7 @@
1111
1212 enum{
1313 ID_ANNOTATION_TEXT_AREA = 0,
14- ID_ANNOTATION_CHECK_BOX,
14+ ID_TYPE_CHOICE,
1515
1616 };
1717
@@ -22,9 +22,9 @@
2222 AnnotationDialog::~AnnotationDialog()
2323 {
2424 }
25-bool AnnotationDialog::Create(wxWindow* parent, wxWindowID id, const wxString& title)
25+bool AnnotationDialog::Create(wxWindow* parent, wxWindowID id, map_annotation& annotation)
2626 {
27- bool result = wxDialog::Create(parent, id, title);
27+ bool result = wxDialog::Create(parent, id, _T("Annotation"));
2828 //アイテム貼り付け
2929
3030 //縦置きサイザー
@@ -34,19 +34,38 @@
3434 //タイプ選択
3535 //横置きサイザー
3636 wxBoxSizer* typeBox = new wxBoxSizer(wxHORIZONTAL);
37+ boxSizer->Add(typeBox);
3738 //スタティックテキスト
3839 wxStaticText* typeSt = new wxStaticText(_T("Type"));
40+ typeBox->Add(typeSt);
3941 //チョイス
40-
42+ this->typeChoice = new wxChoice(this, ID_TYPE_CHOICE);
43+ typeBox->Add(this->typeChoice);
44+ //タイプ項目追加
45+ this->typeChoice->Insert(wxString(_T("Normal")));
46+
4147 //テキストボックス
4248 this->textArea = new wxTextCtrl(this, ID_ANNOTATION_TEXT_AREA);
4349 boxSizer->Add(textArea);
4450
4551 //依存ポリゴン指定
46- //最後にNONEを付加
52+ wxBoxSizer* polygonBox = new wxBoxSizer(wxHORIZONTAL);
53+ boxSizer->Add(polygonBox);
54+ wxStaticText* polySt = new wxStaticText(_T("Depend polygon"));
55+ polygonBox->Add(polySt);
56+ //ポリゴンチョイス
57+ this->polyChoice = new wxChoice();
58+ //現存するポリゴン番号を追加
59+ //最後にNONEを付加
60+ for(int i = 0; i < (int)PolygonList.size(); i ++){
61+ wxString str(i);
62+ this->polyChoice->Insert(str);
63+ }
64+ this->polyChoice->Insert(wxString(_T("NONE")));
65+ polygonBox->Add(polyChoice);
4766
4867 //OKボタン
49- boxSizer->Add(new wxButton(_T("OK")));
50- boxSizer->Add(new wxButton(_T("Cancel")));
68+ boxSizer->Add(new wxButton(_T("OK"), wxID_OK));
69+ boxSizer->Add(new wxButton(_T("Cancel", wxID_CANCEL)));
5170 return result;
5271 }
--- marathon/trunk/MapEditorWX/src/MainFrameEvent.cpp (revision 327)
+++ marathon/trunk/MapEditorWX/src/MainFrameEvent.cpp (revision 328)
@@ -1,4 +1,5 @@
11 #include "MapEditorMainFrame.h"
2+#include "AnnotationDialog.h"
23
34 ////////////////////////////////////////////////////////
45 ////////////////////////////////////////////////////////
@@ -50,9 +51,31 @@
5051 }
5152 void MapEditorMainFrame::doLButtonOnDrawMode(wxMouseEvent& ev)
5253 {
54+ int tool = wxGetApp().getEventManager()->getToolType();
55+ switch(tool){
56+ case ToolType::TI_ARROW:
57+ break;
58+ case ToolType::TI_FILL:
59+ break;
60+ case ToolType::TI_HAND:
61+ break;
62+ case ToolType::TI_LINE:
63+ break;
64+ case ToolType::TI_MAGNIFY:
65+ break;
66+ case ToolType::TI_SKULL:
67+ break;
68+ case ToolType::TI_TEXT:
69+ break;
70+ case ToolType::TI_POLYGON:
71+ break;
72+ default:
73+ hpl::error::halt("Invalid tool type");
74+ }
5375 }
5476 void MapEditorMainFrame::doLButtonOnArrowTool(wxMouseEvent& ev)
5577 {
78+ //選択
5679 }
5780 void MapEditorMainFrame::doLButtonOnFillTool(wxMouseEvent& ev)
5881 {
@@ -71,6 +94,30 @@
7194 }
7295 void MapEditorMainFrame::doLButtonOnTextTool(wxMouseEvent& ev)
7396 {
97+ //アノテーション追加
98+ //ダイアログ準備
99+ AnnotationDialog dlg;
100+ map_annotation sample;
101+ //初期化
102+ memset(&sample, 0, SIZEOF_map_annotation);
103+
104+ //マウス座標の位置に追加する
105+ int viewX = ev.m_x;
106+ int viewY = ev.m_y;
107+ world_point2d wpoint = wxGetApp().getWorldPointFromViewPoint(viewX, viewY);
108+ sample.location.x = wpoint.x;
109+ sample.location.y = wpoint.y;
110+ sample.polygon_index = NONE;
111+
112+ //ダイアログ表示
113+ dlg.Create(this, ID_ANNOTATION_DIALOG, annotation);
114+ if(dlg.ShowModal() == wxID_OK){
115+ //決定
116+ //アノテーションデータを取得
117+ map_annotation annotation = dlg.getAnnotation();
118+ //追加
119+ hpl::aleph::map::addAnnotation(annotation);
120+ }
74121 }
75122 void MapEditorMainFrame::doLButtonOnPolygonTool(wxMouseEvent& ev)
76123 {
--- marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 327)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 328)
@@ -43,6 +43,23 @@
4343
4444 //dialogues
4545 #include "ToolDialog.h"
46+#include "AnnotationDialog.h"
47+#include "ColorCustomizeDialog.h"
48+#include "EditorPreferencesDialog.h"
49+#include "HeightDialog.h"
50+#include "HeightPalletDialog.h"
51+#include "LevelInfoDialog.h"
52+#include "LinePropDialog.h"
53+#include "ObjectPropDialog.h"
54+#include "PlatformDialog.h"
55+#include "PointPropDialog.h"
56+#include "PolygonNumDialog.h"
57+#include "PolygonPropDialog.h"
58+#include "PolygonTypeDialog.h"
59+#include "SelectLevelDialog.h"
60+#include "SidePropDialog.h"
61+#include "TextureDialog.h"
62+#include "VisualDialog.h"
4663
4764 #include <vector>
4865 #include <string>
--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.h (revision 327)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.h (revision 328)
@@ -52,11 +52,21 @@
5252 ID_TerminalViewer,
5353 };
5454
55+//リソースID
56+enum{
57+ ID_ANNOTATION_DIALOG,
58+
59+};
60+
5561 /**
5662 editor's main frame
5763 */
5864 class MapEditorMainFrame: public wxFrame
5965 {
66+public:
67+ //ToolDialog・this(オブジェクト選択)が呼び出す
68+ ObjectPropDialog objectPropDialog;
69+
6070 private:
6171 //ダブルバッファリング用Bitmap
6272 wxBitmap doubleBufferingBitmap;
@@ -66,13 +76,12 @@
6676 /////////////////////
6777 //ダイアログ(モードレス)
6878 ToolDialog toolDialog;
69- //TODO ObjectPropDialog objectPropDialog
70- //TODO PolygonTypeDialog polyTypeDialog
71- //TODO HeightDialog heightDialog
72- //TODO PolyPropDialog polyPropDialog
73- //TODO PointPropDialog pointPropDialog
74- //TODO LinePropDialog linePropDialog
75- //TODO TextureDialog textureDialog
79+ PolygonTypeDialog polyTypeDialog
80+ HeightDialog heightDialog
81+ PolyPropDialog polyPropDialog
82+ PointPropDialog pointPropDialog
83+ LinePropDialog linePropDialog
84+ TextureDialog textureDialog
7685
7786 //TODO モーダルだが、Side選択ダイアログも作ろう
7887 //TODO JumpLevel, LevelInfo, Placements, TerminalViewer
@@ -179,6 +188,7 @@
179188 //ダブルバッファリング時の背景削除停止用<en>to disable erasing backgroud for double buffering
180189 void OnEraseBackground(wxEraseEvent& ev);
181190
191+ //
182192 //イベントテーブル作成<en>declare
183193 DECLARE_EVENT_TABLE()
184194
@@ -270,4 +280,5 @@
270280 @param setting カラー設定データ <en> setting data for color
271281 */
272282 void setupPenAndBrush(ColorSettings* setting);
283+
273284 };
--- marathon/trunk/MapEditorWX/src/PolygonNumDialog.h (nonexistent)
+++ marathon/trunk/MapEditorWX/src/PolygonNumDialog.h (revision 328)
@@ -0,0 +1,14 @@
1+#ifndef _POLYGON_NUM_DIALOG_
2+#define _POLYGON_NUM_DIALOG_
3+
4+#include <wx/dialog.h>
5+
6+class PolygonNumDialog: public wxDialog{
7+public:
8+ PolygonNumDialog();
9+ bool Create(wxWindow* parent, wxWindowID id, const wxString& title);
10+ virtual ~PolygonNumDialog();
11+ //イベントテーブル作成<en>declare
12+ DECLARE_EVENT_TABLE()
13+};
14+#endif
--- marathon/trunk/MapEditorWX/src/ToolDialog.cpp (revision 327)
+++ marathon/trunk/MapEditorWX/src/ToolDialog.cpp (revision 328)
@@ -99,11 +99,13 @@
9999 //オブジェクトツール
100100 //プロパティを表示する
101101 //TODO wxGetApp().objectPropDialog.Show();
102+
102103 }else if(i == ToolType::TI_POLYGON){
103104 //ポリゴンツール
104105 //規定のポリゴン追加ツール
105106 //TODO Preset polygons
106-
107+ PolygonNumDialog polyNumDialog;
108+
107109 }
108110 Refresh();
109111 //カーソル変化
旧リポジトリブラウザで表示