• R/O
  • SSH
  • HTTPS

marathon: コミット


コミットメタ情報

リビジョン361 (tree)
日時2007-07-03 23:30:30
作者hogepiyo

ログメッセージ

*** empty log message ***

変更サマリ

差分

--- marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 360)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 361)
@@ -144,11 +144,13 @@
144144 char CURSOR_BASE_DIR[] = "data/img/";
145145 char *cursorSkull = "cursor2.bmp";
146146 char *cursorPolygon = "cur00004.bmp";
147+ char *cursorLine = "LineCursor1.bmp";
148+
147149 int cursorId[] ={
148150 wxCURSOR_ARROW,
149151 wxCURSOR_PAINT_BRUSH,
150152 wxCURSOR_HAND,
151- wxCURSOR_PENCIL,
153+ -1,
152154 wxCURSOR_MAGNIFIER,
153155 -1,
154156 wxCURSOR_IBEAM,
@@ -166,6 +168,8 @@
166168 fname = cursorSkull;
167169 }else if(i == ToolType::TI_POLYGON){
168170 fname = cursorPolygon;
171+ }else if(i == ToolType::TI_LINE){
172+ fname = cursorLine;
169173 }
170174 wxString path = wxConvCurrent->cMB2WX(CURSOR_BASE_DIR);
171175 wxString pathF = wxConvCurrent->cMB2WX(fname);
@@ -188,6 +192,19 @@
188192 img.LoadFile(wxString(wxConvCurrent->cMB2WX("data/img/onPoint.bmp")));
189193 img.SetMaskColour(255,255,255);
190194 this->onPointCursor = wxCursor(img);
195+ //追加中
196+ img = wxImage();
197+ img.LoadFile(wxString(wxConvCurrent->cMB2WX("data/img/onPoint2.bmp")));
198+ img.SetMaskColour(255,255,255);
199+ this->onPointCursorAdding = wxCursor(img);
200+ img = wxImage();
201+ img.LoadFile(wxString(wxConvCurrent->cMB2WX("data/img/onLine2.bmp")));
202+ img.SetMaskColour(255,255,255);
203+ this->onLineCursorAdding = wxCursor(img);
204+ img = wxImage();
205+ img.LoadFile(wxString(wxConvCurrent->cMB2WX("data/img/LineCursor2.bmp")));
206+ img.SetMaskColour(255,255,255);
207+ this->lineToolCursorAdding = wxCursor(img);
191208 }
192209
193210 //対象外の線を表示するかどうか
@@ -255,12 +272,28 @@
255272 int editMode = this->getEventManager()->getEditModeType();
256273 int toolType = this->getEventManager()->getToolType();
257274 if(editMode == EditModeType::EM_DRAW){
258- if(toolType == ToolType::TI_LINE && this->isNowOnTheLine){
259- //線の上にいえる
260- wxSetCursor(this->onLineCursor);
261- }else if(toolType == ToolType::TI_LINE && this->isNowOnThePoint){
262- //点の上にいえる
263- wxSetCursor(this->onPointCursor);
275+ if(toolType == ToolType::TI_LINE){
276+ if(this->isNowOnTheLine){
277+ if(this->isFirstOfLineToAdd){
278+ //線の上にいる
279+ wxSetCursor(this->onLineCursor);
280+ }else{
281+ wxSetCursor(this->onLineCursorAdding);
282+ }
283+ }else if(toolType == ToolType::TI_LINE && this->isNowOnThePoint){
284+ if(this->isFirstOfLineToAdd){
285+ //点の上にいる
286+ wxSetCursor(this->onPointCursor);
287+ }else{
288+ wxSetCursor(this->onPointCursorAdding);
289+ }
290+ }else{
291+ if(this->isFirstOfLineToAdd){
292+ wxSetCursor(cursors[toolType]);
293+ }else{
294+ wxSetCursor(this->lineToolCursorAdding);
295+ }
296+ }
264297 }else{
265298 //TODO カーソル
266299 ::wxSetCursor(cursors[toolType]);
--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 360)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 361)
@@ -289,6 +289,7 @@
289289 //ポリゴン選択ネットブラシ
290290 wxImage bmp;
291291 wxGetApp().loadBitmap(POLYGON_SELECT_STLIPPLE_BITMAP_FILE_PATH, &bmp);
292+ bmp.SetMaskColour(255,255,255);
292293 this->polySelNetBrush = wxBrush(bmp);
293294
294295 //ダメポリゴンブラシ
--- marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 360)
+++ marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 361)
@@ -202,6 +202,7 @@
202202 //TODO 高さを求める方法
203203 int ceilHeight = polygon->ceiling_height;//get_endpoint_data(polygon->endpoint_indexes[0])->lowest_adjacent_ceiling_height;
204204 int floorHeight = polygon->floor_height;//get_endpoint_data(polygon->endpoint_indexes[0])->highest_adjacent_floor_height;
205+// hpl::error::caution("%d,%d",floorHeight,ceilHeight);
205206 if(!vmgr->isValidHeight(floorHeight, ceilHeight)){
206207 continue;
207208 }
--- marathon/trunk/MapEditorWX/src/ObjectPropDialog.cpp (revision 360)
+++ marathon/trunk/MapEditorWX/src/ObjectPropDialog.cpp (revision 361)
@@ -28,6 +28,7 @@
2828 EVT_TEXT(ID_X, ObjectPropDialog::OnXEdit)
2929 EVT_TEXT(ID_Y, ObjectPropDialog::OnYEdit)
3030 EVT_TEXT(ID_Z, ObjectPropDialog::OnZEdit)
31+ EVT_PAINT(ObjectPropDialog::OnPaint)
3132 END_EVENT_TABLE()
3233 ObjectPropDialog::ObjectPropDialog()
3334 {
@@ -104,7 +105,7 @@
104105 grid_sizer_19->Add(label_58, 0, 0, 0);
105106 grid_sizer_19->Add(text_ctrl_38, 0, 0, 0);
106107 grid_sizer_18->Add(grid_sizer_19, 1, wxEXPAND, 0);
107- grid_sizer_18->Add(panel_16, 1, 0, 0);
108+ grid_sizer_18->Add(panel_16, 1, wxEXPAND, 0);
108109 grid_sizer_15->Add(grid_sizer_18, 1, wxEXPAND, 0);
109110 grid_sizer_20->Add(label_60, 0, 0, 0);
110111 grid_sizer_20->Add(choice_23, 0, 0, 0);
@@ -122,6 +123,13 @@
122123 grid_sizer_15->Fit(this);
123124 Layout();
124125
126+ //type
127+ for(int i = 0; i < NUMBER_OF_MAP_OBJECT_TYPES; i ++){
128+ this->choice_21->Insert(wxConvertMB2WX(
129+ wxGetApp().objectTypeInfo[i].jname.c_str()),
130+ i);
131+ }
132+
125133 this->objIndex = NONE;
126134 return result;
127135 }
@@ -134,88 +142,183 @@
134142 {
135143 return this->objIndex;
136144 }
145+void ObjectPropDialog::setObject(map_object& obj){
146+ int oldSel = choice_21->GetSelection();
147+ this->text_ctrl_27->SetValue(getString("%d", obj.type));
148+ this->choice_21->SetSelection(obj.type);
149+
150+ this->text_ctrl_32->SetValue(getString("%d", obj.index));
151+ if(oldSel != obj.type){
152+ this->choice_22->Clear();
153+ switch(obj.type){
154+ case _saved_monster:
155+ for(int i = 0; i < NUMBER_OF_MONSTER_TYPES; i ++){
156+ this->choice_22->Insert(wxConvertMB2WX(
157+ wxGetApp().monsterTypeInfo[i].jname.c_str()),
158+ i);
159+ }
160+ break;
161+ case _saved_player:
162+ this->choice_22->Insert(_T("Uh-huh?"), 0);
163+ break;
164+ case _saved_item:
165+ for(int i = 0; i < NUMBER_OF_DEFINED_ITEMS; i ++){
166+ this->choice_22->Insert(wxConvertMB2WX(
167+ wxGetApp().itemTypeInfo[i].jname.c_str()),
168+ i);
169+ }
170+ break;
171+ case _saved_goal:
172+ this->choice_22->Insert(_T("Anything go here"),0 );
173+ break;
174+ case _saved_object:
175+ for(int i = 0; i < NUMBER_OF_SCENERY_DEFINITIONS; i ++){
176+ this->choice_22->Insert(wxConvertMB2WX(
177+ wxGetApp().sceneryTypeInfo[i].jname.c_str()),
178+ i);
179+ }
180+ break;
181+ case _saved_sound_source:
182+ for(int i = 0; i < NUMBER_OF_SOUND_DEFINITIONS; i ++){
183+ this->choice_22->Insert(wxConvertMB2WX(
184+ wxGetApp().monsterTypeInfo[i].jname.c_str()),
185+ i);
186+ }
187+ break;
188+ }
189+ }
190+ this->choice_22->SetSelection(obj.index);
191+
192+ //flags
193+ this->checkbox_46->SetValue((obj.flags & _map_object_is_invisible) != 0);
194+ this->checkbox_47->SetValue((obj.flags & _map_object_hanging_from_ceiling) != 0);
195+ this->checkbox_48->SetValue((obj.flags & _map_object_is_blind) != 0);
196+ this->checkbox_49->SetValue((obj.flags & _map_object_is_deaf) != 0);
197+ this->checkbox_50->SetValue((obj.flags & _map_object_floats) != 0);
198+ this->checkbox_51->SetValue((obj.flags & _map_object_is_network_only) != 0);
199+
200+ this->text_ctrl_37->SetValue(getString("%d", obj.polygon_index));
201+
202+ this->text_ctrl_38->SetValue(getString("%d", obj.facing));
203+
204+ this->text_ctrl_39->SetValue(getString("%d", obj.location.x));
205+ this->text_ctrl_41->SetValue(getString("%d", obj.location.y));
206+ this->text_ctrl_40->SetValue(getString("%d", obj.location.z));
207+
208+}
137209 void ObjectPropDialog::setupDialog()
138210 {
211+ if(this->objIndex == NONE){
212+ map_object obj;
213+ memset(&obj, 0, sizeof(map_object));
214+ this->setObject(obj);
215+ }else{
216+#ifdef __WXDEBUG__
217+ wxASSERT(this->objIndex >= 0 && this->objIndex < SavedObjectList.size());
218+#endif
219+ map_object* obj = &SavedObjectList[this->objIndex];
220+ this->setObject(*obj);
221+ }
139222 }
223+static bool isValidIndex(int *index)
224+{
225+ if(*index == NONE){
226+ return false;
227+ }
228+ if(*index < 0 || *index >= SavedObjectList.size()){
229+ hpl::error::caution("target object not found.");
230+ *index = NONE;
231+ return false;
232+ }
233+ return true;
234+}
235+
140236 void ObjectPropDialog::OnTypeChoice(wxCommandEvent &event)
141237 {
142- event.Skip();
143- std::cout<<"Event handler (ObjectPropDialog::OnTypeChoice) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
238+ if(!isValidIndex(&this->objIndex))return;
239+ map_object* obj = &SavedObjectList[this->objIndex];
240+ obj->type = event.GetSelection();
241+
144242 }
145243
146244
147245 void ObjectPropDialog::OnIndexChoice(wxCommandEvent &event)
148246 {
149- event.Skip();
150- std::cout<<"Event handler (ObjectPropDialog::OnIndexChoice) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
247+ if(!isValidIndex(&this->objIndex))return;
151248 }
152249
153250
154251 void ObjectPropDialog::OnHiddenCheck(wxCommandEvent &event)
155252 {
156- event.Skip();
157- std::cout<<"Event handler (ObjectPropDialog::OnHiddenCheck) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
253+ if(!isValidIndex(&this->objIndex))return;
158254 }
159255
160256
161257 void ObjectPropDialog::OnCeilingCheck(wxCommandEvent &event)
162258 {
163- event.Skip();
164- std::cout<<"Event handler (ObjectPropDialog::OnCeilingCheck) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
259+ if(!isValidIndex(&this->objIndex))return;
165260 }
166261
167262
168263 void ObjectPropDialog::OnSeeCheck(wxCommandEvent &event)
169264 {
170- event.Skip();
171- std::cout<<"Event handler (ObjectPropDialog::OnSeeCheck) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
265+ if(!isValidIndex(&this->objIndex))return;
172266 }
173267
174268
175269 void ObjectPropDialog::OnHearCheck(wxCommandEvent &event)
176270 {
177- event.Skip();
178- std::cout<<"Event handler (ObjectPropDialog::OnHearCheck) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
271+ if(!isValidIndex(&this->objIndex))return;
179272 }
180273
181274
182275 void ObjectPropDialog::OnAerialCheck(wxCommandEvent &event)
183276 {
184- event.Skip();
185- std::cout<<"Event handler (ObjectPropDialog::OnAerialCheck) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
277+ if(!isValidIndex(&this->objIndex))return;
186278 }
187279
188280
189281 void ObjectPropDialog::OnNetCheck(wxCommandEvent &event)
190282 {
191- event.Skip();
192- std::cout<<"Event handler (ObjectPropDialog::OnNetCheck) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
283+ if(!isValidIndex(&this->objIndex))return;
193284 }
194285
195286
196287 void ObjectPropDialog::OnLaunchChoice(wxCommandEvent &event)
197288 {
198- event.Skip();
199- std::cout<<"Event handler (ObjectPropDialog::OnLaunchChoice) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
289+ if(!isValidIndex(&this->objIndex))return;
200290 }
201291
202292
203293 void ObjectPropDialog::OnXEdit(wxCommandEvent &event)
204294 {
205- event.Skip();
206- std::cout<<"Event handler (ObjectPropDialog::OnXEdit) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
295+ if(!isValidIndex(&this->objIndex))return;
207296 }
208297
209298
210299 void ObjectPropDialog::OnYEdit(wxCommandEvent &event)
211300 {
212- event.Skip();
213- std::cout<<"Event handler (ObjectPropDialog::OnYEdit) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
301+ if(!isValidIndex(&this->objIndex))return;
214302 }
215303
216304
217305 void ObjectPropDialog::OnZEdit(wxCommandEvent &event)
218306 {
219- event.Skip();
220- std::cout<<"Event handler (ObjectPropDialog::OnZEdit) not implemented yet"<<std::endl; //notify the user that he hasn't implemented the event handler yet
307+ if(!isValidIndex(&this->objIndex))return;
221308 }
309+map_object ObjectPropDialog::getObject()
310+{
311+ map_object obj;
312+ obj.type = choice_21->GetSelection();
313+ obj.index = choice_22->GetSelection();
314+ //TODO obj.flags
315+ return obj;
316+}
317+
318+void ObjectPropDialog::OnPaint(wxPaintEvent &event)
319+{
320+ wxDialog::OnPaint(event);
321+
322+ //panel_16にfacing方向を描く
323+ //TODO
324+}
--- marathon/trunk/MapEditorWX/src/MainFrameLeftDown.cpp (revision 360)
+++ marathon/trunk/MapEditorWX/src/MainFrameLeftDown.cpp (revision 361)
@@ -518,6 +518,8 @@
518518 }
519519 wxGetApp().prevPointIndex = newPointIndex;
520520 }
521+ wxGetApp().isFirstOfLineToAdd = false;
522+
521523 }else{
522524 //新規追加
523525 endpoint_data ep;
@@ -561,9 +563,25 @@
561563 int mx = ev.m_x;
562564 int my = ev.m_y;
563565 world_point2d wpoint = wxGetApp().getWorldPointFromViewPoint(mx, my);
564- //点の中に入るポリゴンを取得します
565- //std::vector<int> polyIndexes = hpl::aleph::map::getPolygonIndexesIncludePoint(wpoint);
566- //TODO
566+
567+ hpl::aleph::HPLStockManager* smgr = wxGetApp().getStockManager();
568+
569+ for(int i = 0; i < (int)PolygonList.size(); i ++){
570+ if(smgr->delPolygons[i]){
571+ continue;
572+ }
573+ polygon_data* poly = get_polygon_data(i);
574+ if(hpl::aleph::map::isPointInPolygon(wpoint, i)){
575+ //点が含まれる
576+ //このポリゴン上に置く
577+ //TODO
578+ /*int flags = 0;
579+ map_object objv = this->objPropDialog.getObject();
580+ int type = this->objPropDialog.getObject();
581+ hpl::aleph::map::createObject(wpoint, i, &obj, flags, type, index);
582+ int newIndex = hpl::aleph::map::addMapSavedObject(obj);*/
583+ }
584+ }
567585 #endif
568586 }
569587 void MapEditorMainFrame::doLButtonOnTextTool(wxMouseEvent& ev)
--- marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 360)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 361)
@@ -214,7 +214,14 @@
214214 wxCursor onLineCursor;
215215 //オンポイントカーソル
216216 wxCursor onPointCursor;
217+ //通常ラインカーソル
218+ //wxCursor lineToolCursor;
217219
220+ //追加中カーソル
221+ wxCursor onLineCursorAdding;
222+ wxCursor onPointCursorAdding;
223+ wxCursor lineToolCursorAdding;
224+
218225 //ウインドウフレーム
219226 MapEditorMainFrame *frame;
220227 public:
--- marathon/trunk/MapEditorWX/src/MainFrameMenuEvent.cpp (revision 360)
+++ marathon/trunk/MapEditorWX/src/MainFrameMenuEvent.cpp (revision 361)
@@ -447,13 +447,13 @@
447447 {
448448 //TODO
449449 this->sidePropDialog.setIndex(get_line_data(wxGetApp().popupLineIndex)->clockwise_polygon_side_index);
450- this->sidePropDialog->Show(true);
450+ this->sidePropDialog.Show(true);
451451 }
452452 void MapEditorMainFrame::OnCounterclockwiseSide(wxCommandEvent& ev)
453453 {
454454 //TODO
455455 this->sidePropDialog.setIndex(get_line_data(wxGetApp().popupLineIndex)->counterclockwise_polygon_side_index);
456- this->sidePropDialog->Show(true);
456+ this->sidePropDialog.Show(true);
457457 }
458458 void MapEditorMainFrame::OnPointProp(wxCommandEvent& ev)
459459 {
--- marathon/trunk/MapEditorWX/src/ObjectPropDialog.h (revision 360)
+++ marathon/trunk/MapEditorWX/src/ObjectPropDialog.h (revision 361)
@@ -39,6 +39,8 @@
3939
4040 void setObjIndex(int index);
4141 int getObjIndex();
42+ map_object getObject();
43+ void setObject(map_object& obj);
4244 private:
4345 void setupDialog();
4446 //イベントテーブル作成<en>declare
@@ -55,6 +57,8 @@
5557 void OnXEdit(wxCommandEvent &event); // wxGlade: <event_handler>
5658 void OnYEdit(wxCommandEvent &event); // wxGlade: <event_handler>
5759 void OnZEdit(wxCommandEvent &event); // wxGlade: <event_handler>
60+
61+ void OnPaint(wxPaintEvent &event);
5862 };
5963
6064 #endif
--- marathon/trunk/MapEditorWX/setting.ini (revision 360)
+++ marathon/trunk/MapEditorWX/setting.ini (revision 361)
@@ -1,9 +1,9 @@
11 GRID_SIZE_INDEX=0
2-COLOR_PRESET=0
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
2+COLOR_PRESET=1
3+BACKGROUND=0,0,0
4+GRID=50,50,50
5+LINES=50,255,0
6+POLYGONS=0,50,0
7+STRINGS=100,255,0
8+POINTS=255,255,0
99 FLAGS=1,1,1,1,1,1,1,1,1,1,1,1,
\ No newline at end of file
--- marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 360)
+++ marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 361)
@@ -186,4 +186,10 @@
186186 ?lj??E?폜?????ꍇ?A????܂łɕێ????Ă???line_data*?Ȃǂ̃|?C???^?͎g??Ȃ????ƁI
187187
188188 ?ς? quickSort?̌???
189-TODO ???lj????ƒlj??I???i?J?n?O?j?ƂŃJ?[?\???̌`??ς???
189+?ς? TODO ???lj????ƒlj??I???i?J?n?O?j?ƂŃJ?[?\???̌`??ς???
190+TODO ?e?N?X?`???ǂݍ???
191+TODO ?????EMedia?ELight
192+
193+TODO ???lj??F????????????N???b?N?Ŏ??̃N???b?N?ɂ‚Ȃ???Ȃ?
194+TODO ???ɂ???Ƃ???Ƀ|???S????lj????悤?Ƃ???ƕςɂȂ?i?`?悳??Ȃ??̂ɐG???j
195+LevelInfo??I?ԂƑS????????o?O
--- marathon/trunk/HPLLib/HPLMapToolModifier.cpp (revision 360)
+++ marathon/trunk/HPLLib/HPLMapToolModifier.cpp (revision 361)
@@ -76,7 +76,8 @@
7676 wxASSERT(lineIndexInPolygon != NONE);
7777 #else
7878 if(lineIndexInPolygon == NONE){
79- hpl::error::halt("line[%d] doesn't exist in polygon[%d]'s line_index", side->line_index, side->polygon_index);
79+ hpl::error::halt("line[%d] doesn't exist in polygon[%d]'s line_index", newSide->line_index,
80+ newSide->polygon_index);
8081 }
8182 #endif
8283 poly->side_indexes[lineIndexInPolygon] = index;
--- marathon/trunk/HPLLib/HPLMapTool.cpp (revision 360)
+++ marathon/trunk/HPLLib/HPLMapTool.cpp (revision 361)
@@ -696,7 +696,7 @@
696696 @param polyIndex 載せるポリゴンのインデックス
697697 */
698698 void hpl::aleph::map::createObject(world_point2d& wpoint, int polyIndex, map_object* obj,
699- int flags)
699+ int flags, int type, int index)
700700 {
701701 //TODO
702702 obj->polygon_index = polyIndex;
@@ -779,6 +779,7 @@
779779 poly->area = 0;
780780 //TODO 点のうち一番高い高度
781781 poly->ceiling_height = WORLD_ONE;
782+ poly->floor_height = 0;
782783 poly->ceiling_lightsource_index = NONE;
783784 //TODO ?
784785 poly->ceiling_origin.x = 0;
--- marathon/trunk/HPLLib/HPLMapTool.h (revision 360)
+++ marathon/trunk/HPLLib/HPLMapTool.h (revision 361)
@@ -359,7 +359,7 @@
359359 @param polyIndex 載せるポリゴンのインデックス
360360 */
361361 void createObject(world_point2d& wpoint, int polyIndex, map_object* obj,
362- int flags);
362+ int flags, int type, int index);
363363
364364 /**
365365 既存の点を用いて線やポリゴンを作成します
旧リポジトリブラウザで表示