• R/O
  • SSH
  • HTTPS

marathon: コミット


コミットメタ情報

リビジョン370 (tree)
日時2007-07-09 00:27:41
作者hogepiyo

ログメッセージ

*** empty log message ***

変更サマリ

差分

--- marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 369)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 370)
@@ -327,15 +327,18 @@
327327 isFirstOfLineToAdd = true;
328328 }
329329
330-void MapEditorWX::getShapesImage(wxImage* img, int collection, int clut, int index)
330+void MapEditorWX::getShapesImage(wxImage* img, int collection, int clut, int index, double illumination)
331331 {
332332 //サーフェイス取得
333- SDL_Surface* surface = hpl::surface::getSurface(collection, clut, index);
333+ SDL_Surface* surface = hpl::shapes::getSurface(collection, clut, index, illumination);
334334 img->Create(surface->w, surface->h);
335335 SDL_LockSurface(surface);
336336 for(int x = 0; x < surface->w; x ++){
337337 for(int y = 0; y < surface->h; y ++){
338-
338+ Uint32 pixel = hpl::surface::getpixel(surface, x, y);
339+ unsigned char r, g, b;
340+ SDL_GetRGB(pixel, surface->format, &r, &g, &b);
341+ img->SetRGB(x, y, r, g, b);
339342 }
340343 }
341344 SDL_UnlockSurface(surface);
--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 369)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 370)
@@ -130,6 +130,20 @@
130130 //初期化
131131 wxGetApp().isChanged = false;
132132 this->initLevel();
133+
134+ hpl::shapes::initScreen();
135+
136+ //Shapesファイル読み込み
137+ wxGetApp().getShapesManager()->setLoadedShapesFile(false);
138+ const char* SHAPES_FILE_PATH = "Shapes.shpA";
139+ hpl::shapes::loadShapesFile(SHAPES_FILE_PATH);
140+
141+ //
142+ int collection = 5;
143+ int clut = 0;
144+ int index = 0;
145+ double illumination = -1.0;
146+ wxGetApp().getShapesImage(&texture, collection, clut, index, illumination);
133147 //セットアップ
134148 wxGetApp().getStockManager()->updateDeletes();
135149 }
@@ -267,16 +281,16 @@
267281 void MapEditorMainFrame::setupPenAndBrush(ColorSettings* setting)
268282 {
269283 //背景色
270- wxColor col = wxColor(wxGetApp().setting.getColorSetting()->background[0],
271- wxGetApp().setting.getColorSetting()->background[1],
272- wxGetApp().setting.getColorSetting()->background[2]);
284+ wxColor col = wxColor(wxGetApp().setting.getColorSetting()->colors[ColorType::Background][0],
285+ wxGetApp().setting.getColorSetting()->colors[ColorType::Background][1],
286+ wxGetApp().setting.getColorSetting()->colors[ColorType::Background][2]);
273287 this->backgroundPen = wxPen(col);
274288 this->backgroundBrush = wxBrush(col);
275289
276290 //グリッド色
277- wxColor edgeCol(wxGetApp().setting.getColorSetting()->gridLine[0],
278- wxGetApp().setting.getColorSetting()->gridLine[1],
279- wxGetApp().setting.getColorSetting()->gridLine[2]);
291+ wxColor edgeCol(wxGetApp().setting.getColorSetting()->colors[ColorType::GridLine][0],
292+ wxGetApp().setting.getColorSetting()->colors[ColorType::GridLine][1],
293+ wxGetApp().setting.getColorSetting()->colors[ColorType::GridLine][2]);
280294 this->gridPen = wxPen(edgeCol);
281295 this->gridLargePen = wxPen(edgeCol, LARGE_PEN_SIZE);
282296
@@ -303,23 +317,34 @@
303317
304318 //線
305319 this->linePen.SetColour(
306- wxGetApp().setting.getColorSetting()->lines[0],
307- wxGetApp().setting.getColorSetting()->lines[1],
308- wxGetApp().setting.getColorSetting()->lines[2]);
320+ wxGetApp().setting.getColorSetting()->colors[ColorType::Lines][0],
321+ wxGetApp().setting.getColorSetting()->colors[ColorType::Lines][1],
322+ wxGetApp().setting.getColorSetting()->colors[ColorType::Lines][2]);
309323
310324 //点
311325 wxColor pcol(
312- wxGetApp().setting.getColorSetting()->points[0],
313- wxGetApp().setting.getColorSetting()->points[1],
314- wxGetApp().setting.getColorSetting()->points[2]);
326+ wxGetApp().setting.getColorSetting()->colors[ColorType::Points][0],
327+ wxGetApp().setting.getColorSetting()->colors[ColorType::Points][1],
328+ wxGetApp().setting.getColorSetting()->colors[ColorType::Points][2]);
315329 this->pointPen.SetColour(pcol);
316330 this->pointBrush.SetColour(pcol);
317331
332+ //同じ高さ線の色
333+ sameHeightLinePen.SetColour(
334+ wxGetApp().setting.getColorSetting()->colors[ColorType::SameHeightLines][0],
335+ wxGetApp().setting.getColorSetting()->colors[ColorType::SameHeightLines][1],
336+ wxGetApp().setting.getColorSetting()->colors[ColorType::SameHeightLines][2]);
337+ //段差のある線の色
338+ stairLinePen.SetColour(
339+ wxGetApp().setting.getColorSetting()->colors[ColorType::StairLines][0],
340+ wxGetApp().setting.getColorSetting()->colors[ColorType::StairLines][1],
341+ wxGetApp().setting.getColorSetting()->colors[ColorType::StairLines][2]);
342+
318343 //ポリゴン
319344 this->polyBrush.SetColour(
320- wxGetApp().setting.getColorSetting()->polygons[0],
321- wxGetApp().setting.getColorSetting()->polygons[1],
322- wxGetApp().setting.getColorSetting()->polygons[2]);
345+ wxGetApp().setting.getColorSetting()->colors[ColorType::Polygons][0],
346+ wxGetApp().setting.getColorSetting()->colors[ColorType::Polygons][1],
347+ wxGetApp().setting.getColorSetting()->colors[ColorType::Polygons][2]);
323348
324349 //オブジェクトカラー
325350 //プレイヤーペン(yellow)
--- marathon/trunk/MapEditorWX/src/ColorCustomizeDialog.h (revision 369)
+++ marathon/trunk/MapEditorWX/src/ColorCustomizeDialog.h (revision 370)
@@ -23,6 +23,12 @@
2323 wxStaticText* label_18;
2424 wxButton* button_12;
2525 wxPanel* panel_6;
26+ wxStaticText* label_a;
27+ wxButton* button_a;
28+ wxPanel* panel_a;
29+ wxStaticText* label_b;
30+ wxButton* button_b;
31+ wxPanel* panel_b;
2632 wxButton* button_5;
2733 wxButton* button_6;
2834 ColorSettings colorSetting;
@@ -42,6 +48,8 @@
4248 void OnPolygons(wxCommandEvent &event); // wxGlade: <event_handler>
4349 void OnStrings(wxCommandEvent &event); // wxGlade: <event_handler>
4450 void OnPoints(wxCommandEvent &event); // wxGlade: <event_handler>
51+ void OnSameHeightLines(wxCommandEvent &event); // wxGlade: <event_handler>
52+ void OnStairLines(wxCommandEvent &event); // wxGlade: <event_handler>
4553 void OnPaint(wxPaintEvent &event);
4654
4755 //イベントテーブル作成<en>declare
--- marathon/trunk/MapEditorWX/src/PlatformDialog.h (revision 369)
+++ marathon/trunk/MapEditorWX/src/PlatformDialog.h (revision 370)
@@ -65,6 +65,7 @@
6565 wxButton* button_2;
6666
6767 int polyIndex;
68+ int platformIndex;
6869 public:
6970 PlatformDialog();
7071 bool Create(wxWindow* parent, wxWindowID id, int pindex);
--- marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 369)
+++ marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 370)
@@ -103,6 +103,10 @@
103103 }
104104 }
105105
106+ //Shapesファイルから読み込みテスト
107+ wxBitmap bmp = wxBitmap(this->texture);
108+ dc.DrawBitmap(bmp,0,0,true);
109+
106110 //バッファから画面へコピー
107111 dc.Blit(wxPoint(0,0), size,
108112 drawDC,
@@ -322,8 +326,30 @@
322326 if(select){
323327 dc->SetPen(this->selectedLinePen);
324328 }else{
329+ wxPen* lPen = &this->linePen;
330+
331+ if(LINE_IS_TRANSPARENT(line) != 0){
332+ if(line->clockwise_polygon_owner == NONE ||
333+ line->counterclockwise_polygon_owner == NONE)
334+ {
335+ //nope
336+ }else{
337+ polygon_data* right = get_polygon_data(line->clockwise_polygon_owner);
338+ polygon_data* left = get_polygon_data(line->counterclockwise_polygon_owner);
339+#ifdef __WXDEBUG__
340+ wxASSERT( right && left);
341+#endif
342+ if(right->floor_height == left->floor_height &&
343+ right->ceiling_height == left->ceiling_height)
344+ {
345+ lPen = &this->sameHeightLinePen;
346+ }else{
347+ lPen = &this->stairLinePen;
348+ }
349+ }
350+ }
325351 //通常ペン
326- dc->SetPen(this->linePen);
352+ dc->SetPen(*lPen);
327353 }
328354
329355 }
@@ -556,9 +582,9 @@
556582 return;
557583 }
558584 wxColor oldCol = dc->GetTextForeground();
559- wxColor col(wxGetApp().setting.getColorSetting()->strings[0],
560- wxGetApp().setting.getColorSetting()->strings[1],
561- wxGetApp().setting.getColorSetting()->strings[2]);
585+ wxColor col(wxGetApp().setting.getColorSetting()->colors[ColorType::Strings][0],
586+ wxGetApp().setting.getColorSetting()->colors[ColorType::Strings][1],
587+ wxGetApp().setting.getColorSetting()->colors[ColorType::Strings][2]);
562588 dc->SetTextForeground(col);
563589 dc->SetPen(*wxRED_PEN);
564590 dc->SetBrush(*wxTRANSPARENT_BRUSH);
--- marathon/trunk/MapEditorWX/src/ColorCustomizeDialog.cpp (revision 369)
+++ marathon/trunk/MapEditorWX/src/ColorCustomizeDialog.cpp (revision 370)
@@ -7,6 +7,8 @@
77 ID_POLYGONS,
88 ID_STRINGS,
99 ID_POINTS,
10+ ID_SAME_HEIGHT_LINES,
11+ ID_STAIR_LINES,
1012 };
1113 BEGIN_EVENT_TABLE(ColorCustomizeDialog, wxDialog)
1214 EVT_BUTTON(ID_BACKGROUND, ColorCustomizeDialog::OnBackground)
@@ -15,6 +17,8 @@
1517 EVT_BUTTON(ID_POLYGONS, ColorCustomizeDialog::OnPolygons)
1618 EVT_BUTTON(ID_STRINGS, ColorCustomizeDialog::OnStrings)
1719 EVT_BUTTON(ID_POINTS, ColorCustomizeDialog::OnPoints)
20+ EVT_BUTTON(ID_SAME_HEIGHT_LINES, ColorCustomizeDialog::OnSameHeightLines)
21+ EVT_BUTTON(ID_STAIR_LINES, ColorCustomizeDialog::OnStairLines)
1822 EVT_BUTTON(wxID_OK, ColorCustomizeDialog::OnOk)
1923 EVT_BUTTON(wxID_CANCEL, ColorCustomizeDialog::OnCancel)
2024 // EVT_PAINT(ColorCustomizeDialog::OnPaint)
@@ -47,6 +51,12 @@
4751 label_18 = new wxStaticText(this, wxID_ANY, wxT("Points"));
4852 button_12 = new wxButton(this, ID_POINTS, wxT("Choose color"));
4953 panel_6 = new wxPanel(this, wxID_ANY);
54+ label_a = new wxStaticText(this, wxID_ANY, wxT("Same Height Lines"));
55+ button_a = new wxButton(this, ID_SAME_HEIGHT_LINES, wxT("Choose color"));
56+ panel_a = new wxPanel(this, wxID_ANY);
57+ label_b = new wxStaticText(this, wxID_ANY, wxT("Stair Lines"));
58+ button_b = new wxButton(this, ID_STAIR_LINES, wxT("Choose color"));
59+ panel_b = new wxPanel(this, wxID_ANY);
5060 button_5 = new wxButton(this, wxID_OK, wxT("OK"));
5161 button_6 = new wxButton(this, wxID_CANCEL, wxT("Cancel"));
5262
@@ -53,7 +63,7 @@
5363 //setup
5464
5565 //layout
56- wxFlexGridSizer* sizer_37 = new wxFlexGridSizer(7, 1, 0, 0);
66+ wxFlexGridSizer* sizer_37 = new wxFlexGridSizer(9, 1, 0, 0);
5767 wxBoxSizer* sizer_44 = new wxBoxSizer(wxHORIZONTAL);
5868 wxGridSizer* sizer_43 = new wxGridSizer(1, 3, 0, 0);
5969 wxGridSizer* sizer_42 = new wxGridSizer(1, 3, 0, 0);
@@ -61,6 +71,8 @@
6171 wxGridSizer* sizer_40 = new wxGridSizer(1, 3, 0, 0);
6272 wxGridSizer* sizer_39 = new wxGridSizer(1, 3, 0, 0);
6373 wxGridSizer* sizer_38 = new wxGridSizer(1, 3, 0, 0);
74+ wxGridSizer* sizer_a = new wxGridSizer(1, 3, 0, 0);
75+ wxGridSizer* sizer_b = new wxGridSizer(1, 3, 0, 0);
6476 sizer_38->Add(label_13, 0, 0, 0);
6577 sizer_38->Add(button_7, 0, 0, 0);
6678 sizer_38->Add(panel_1, 1, wxEXPAND, 0);
@@ -85,6 +97,16 @@
8597 sizer_43->Add(button_12, 0, 0, 0);
8698 sizer_43->Add(panel_6, 1, wxEXPAND, 0);
8799 sizer_37->Add(sizer_43, 1, wxEXPAND, 0);
100+
101+ sizer_a->Add(label_a, 0, 0, 0);
102+ sizer_a->Add(button_a, 0, 0, 0);
103+ sizer_a->Add(panel_a, 1, wxEXPAND, 0);
104+ sizer_37->Add(sizer_a, 1, wxEXPAND, 0);
105+ sizer_b->Add(label_b, 0, 0, 0);
106+ sizer_b->Add(button_b, 0, 0, 0);
107+ sizer_b->Add(panel_b, 1, wxEXPAND, 0);
108+ sizer_37->Add(sizer_b, 1, wxEXPAND, 0);
109+
88110 sizer_44->Add(button_5, 0, 0, 0);
89111 sizer_44->Add(button_6, 0, 0, 0);
90112 sizer_37->Add(sizer_44, 1, wxEXPAND, 0);
@@ -102,39 +124,13 @@
102124 {
103125 int col[COL_NUM];
104126
105- switch(type){
106- case ColorType::Background:
107- for(int i = 0; i < COL_NUM; i ++){
108- col[i] = this->colorSetting.background[i];
127+ for(int tag = 0; tag < ColorType::NUMBER_OF_COLOR_TYPES; tag ++){
128+ if(type == tag){
129+ for(int i = 0; i < COL_NUM; i ++){
130+ col[i] = this->colorSetting.colors[type][i];
131+ }
132+ break;
109133 }
110- break;
111- case ColorType::GridLine:
112- for(int i = 0; i < COL_NUM; i ++){
113- col[i] = this->colorSetting.gridLine[i];
114- }
115- break;
116- case ColorType::Lines:
117- for(int i = 0; i < COL_NUM; i ++){
118- col[i] = this->colorSetting.lines[i];
119- }
120- break;
121- case ColorType::Polygons:
122- for(int i = 0; i < COL_NUM; i ++){
123- col[i] = this->colorSetting.polygons[i];
124- }
125- break;
126- case ColorType::Strings:
127- for(int i = 0; i < COL_NUM; i ++){
128- col[i] = this->colorSetting.strings[i];
129- }
130- break;
131- case ColorType::Points:
132- for(int i = 0; i < COL_NUM; i ++){
133- col[i] = this->colorSetting.points[i];
134- }
135- break;
136- default:
137- break;
138134 }
139135 wxColor color(col[0], col[1], col[2]);
140136 return color;
@@ -172,52 +168,49 @@
172168
173169 void ColorCustomizeDialog::OnBackground(wxCommandEvent &event)
174170 {
175- setColor(colorSetting.background);
171+ setColor(colorSetting.colors[ColorType::Background]);
176172 }
177173
178174
179175 void ColorCustomizeDialog::OnGrid(wxCommandEvent &event)
180176 {
181- setColor(colorSetting.gridLine);
177+ setColor(colorSetting.colors[ColorType::GridLine]);
182178 }
183179
184180
185181 void ColorCustomizeDialog::OnLines(wxCommandEvent &event)
186182 {
187- setColor(colorSetting.lines);
183+ setColor(colorSetting.colors[ColorType::Lines]);
188184 }
189185
190186
191187 void ColorCustomizeDialog::OnPolygons(wxCommandEvent &event)
192188 {
193- setColor(colorSetting.polygons);
189+ setColor(colorSetting.colors[ColorType::Polygons]);
194190 }
195191
196192
197193 void ColorCustomizeDialog::OnStrings(wxCommandEvent &event)
198194 {
199- setColor(colorSetting.strings);
195+ setColor(colorSetting.colors[ColorType::Strings]);
200196 }
201197
202198
203199 void ColorCustomizeDialog::OnPoints(wxCommandEvent &event)
204200 {
205- setColor(colorSetting.points);
201+ setColor(colorSetting.colors[ColorType::Points]);
206202 }
203+void ColorCustomizeDialog::OnSameHeightLines(wxCommandEvent &event)
204+{
205+ setColor(colorSetting.colors[ColorType::SameHeightLines]);
206+}
207+void ColorCustomizeDialog::OnStairLines(wxCommandEvent &event)
208+{
209+ setColor(colorSetting.colors[ColorType::StairLines]);
210+}
207211
208212 void ColorCustomizeDialog::OnPaint(wxPaintEvent &event)
209213 {
210-/* wxSize size = GetSize();
211- if(!wxWindow::IsExposed(0,0,size.GetWidth(), size.GetHeight())){
212- return;
213- }
214- //設定した色で塗る
215- this->drawPanel(this->panel_1, ColorType::Background);
216- this->drawPanel(this->panel_2, ColorType::GridLine);
217- this->drawPanel(this->panel_3, ColorType::Lines);
218- this->drawPanel(this->panel_4, ColorType::Polygons);
219- this->drawPanel(this->panel_5, ColorType::Strings);
220- this->drawPanel(this->panel_6, ColorType::Points);*/
221214 }
222215 /**
223216 @param type MapEditorOneSetting.hをみよう
--- marathon/trunk/MapEditorWX/src/PlatformDialog.cpp (revision 369)
+++ marathon/trunk/MapEditorWX/src/PlatformDialog.cpp (revision 370)
@@ -1,5 +1,6 @@
11 #include "PlatformDialog.h"
22 #include "MapEditorWX.h"
3+
34 BEGIN_EVENT_TABLE(PlatformDialog, wxDialog)
45 EVT_BUTTON(wxID_OK, PlatformDialog::OnOk)
56 EVT_BUTTON(wxID_CANCEL, PlatformDialog::OnCancel)
@@ -214,7 +215,21 @@
214215 Layout();
215216
216217 polyIndex = pindex;
218+ //polygon_data* poly = get_polygon_data(polyIndex);
217219
220+ //search polygon's platform
221+ platformIndex = NONE;
222+ for(int i = 0; i < (int)PlatformList.size(); i ++){
223+ platform_data* temp = &PlatformList[i];
224+ if(temp->polygon_index == polyIndex){
225+ platformIndex = i;
226+ break;
227+ }
228+ }
229+#ifdef __WXDEBUG__
230+ wxASSERT(platformIndex == NONE);
231+#endif
232+
218233 platform_data *platform = &PlatformList[platformIndex];
219234
220235 //チョイスの初期化
--- marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 369)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 370)
@@ -153,9 +153,6 @@
153153 //編集設定
154154 MapEditorOneSetting setting;
155155
156- //Shapesモードか?
157- bool isLoadedShapesFile;
158-
159156 //プリセットで追加するポリゴンの頂点数
160157 int nPolygonPoints;
161158
@@ -287,7 +284,7 @@
287284 */
288285 void resetLineEditInfo();
289286
290- void getShapesImage(wxImage* img, int collection, int clut, int index);
287+ void getShapesImage(wxImage* img, int collection, int clut, int index, double illumination);
291288 private:
292289
293290 };
--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.h (revision 369)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.h (revision 370)
@@ -161,6 +161,11 @@
161161 //通常ポリゴン
162162 wxBrush polyBrush;
163163
164+ //同じ高さの線色
165+ wxPen sameHeightLinePen;
166+ //段差のある線色
167+ wxPen stairLinePen;
168+
164169 //アイテムビットマップ
165170 wxImage itemBitmaps[NUMBER_OF_DEFINED_ITEMS];
166171 //ハイライト版
@@ -192,6 +197,7 @@
192197 //範囲選択表示
193198 wxPen selectingPen;
194199
200+ wxImage texture;
195201 public:
196202 MapEditorMainFrame(const wxString& title,
197203 const wxPoint& pos = wxDefaultPosition,
--- marathon/trunk/MapEditorWX/src/EditorPreferencesDialog.cpp (revision 369)
+++ marathon/trunk/MapEditorWX/src/EditorPreferencesDialog.cpp (revision 370)
@@ -57,7 +57,7 @@
5757 sizer_46->Add(label_19, 0, 0, 0);
5858 sizer_46->Add(choice_9, 0, 0, 0);
5959 sizer_45->Add(sizer_46, 1, wxEXPAND, 0);
60- for(int i = 0; i < NUMBER_OF_EDITOR_FLAGS; i ++){
60+ for(int i = 0; i <= IS_VISUAL_MODE_CROSSFAIR; i ++){
6161 sizer_49->Add(checkbox[i], 0, 0, 0);
6262 }
6363 sizer_47->Add(sizer_49, 1, wxEXPAND, 0);
@@ -65,6 +65,10 @@
6565 sizer_51->Add(choice_10, 0, 0, 0);
6666 sizer_50->Add(sizer_51, 1, wxEXPAND, 0);
6767 sizer_50->Add(button_15, 0, 0, 0);
68+ //checkbox 残り <en> remains
69+ for(int i = IS_VISUAL_MODE_CROSSFAIR + 1; i < NUMBER_OF_EDITOR_FLAGS; i ++){
70+ sizer_50->Add(checkbox[i], 0, 0, 0);
71+ }
6872 sizer_47->Add(sizer_50, 1, wxEXPAND, 0);
6973 sizer_45->Add(sizer_47, 1, wxEXPAND, 0);
7074 sizer_48->Add(button_13, 0, 0, 0);
--- marathon/trunk/MapEditorWX/setting.ini (revision 369)
+++ marathon/trunk/MapEditorWX/setting.ini (revision 370)
@@ -6,4 +6,6 @@
66 POLYGONS=64,128,128
77 STRINGS=0,0,64
88 POINTS=0,255,64
9-FLAGS=1,1,1,1,1,1,1,1,1,1,1,1,
\ No newline at end of file
9+FLAGS=1,1,1,1,1,1,1,1,1,1,1,1,
10+SAME_HEIGHT_LINES=0,0,25
11+STAIR_LINES=0,100,155
--- marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 369)
+++ marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 370)
@@ -212,3 +212,16 @@
212212
213213 TODO Shapes?f?[?^?ǂݍ???
214214 TODO ?ǁi?????????Е??̃|???S?????????݂??Ȃ????j?E?????????????E???????قȂ???ł͕`?悪?قȂ?
215+?E?????Ƀ|???S?????Ȃ?
216+ ??Lines
217+?E?Е??Ƀ|???S?????Ȃ?
218+ ??Lines
219+?E????????
220+ ?ESOLID??
221+ ??Lines
222+ ?ETRANSPARENT??
223+ ?E?????̃|???S??????????????
224+ ??SameHeightLines
225+ ?E?قȂ鍂????
226+ ??StairLines
227+
\ No newline at end of file
--- marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.cpp (revision 369)
+++ marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.cpp (revision 370)
@@ -15,15 +15,31 @@
1515 }
1616
1717 static char *GRID_SIZE_INDEX_TAG = "GRID_SIZE_INDEX";
18-static char *COLOR_SETTING_COLOR_PRESET_TAG = "COLOR_PRESET";
19-static char *COLOR_SETTING_BACKGROUND_TAG = "BACKGROUND";
20-static char *COLOR_SETTING_GRID_TAG = "GRID";
21-static char *COLOR_SETTING_LINES_TAG = "LINES";
22-static char *COLOR_SETTING_POLYGONS_TAG = "POLYGONS";
23-static char *COLOR_SETTING_STRINGS_TAG = "STRINGS";
24-static char *COLOR_SETTING_POINTS_TAG = "POINTS";
2518 static char *EDITOR_FLAGS_TAG = "FLAGS";
19+static char* COLOR_SETTING_COLOR_PRESET_TAG = "COLOR_PRESET";
20+static char* COLOR_SETTING_TAGS[100] ={
21+ "BACKGROUND",
22+ "GRID",
23+ "LINES",
24+ "POLYGONS",
25+ "STRINGS",
26+ "POINTS",
27+ "SAME_HEIGHT_LINES",
28+ "STAIR_LINES"
29+};
2630
31+void ColorSettings::setColor(int type, int r, int g, int b)
32+{
33+ colors[type][0] = r;
34+ colors[type][1] = g;
35+ colors[type][2] = b;
36+}
37+
38+static void tagFault(const char* str)
39+{
40+ hpl::error::halt("Illegal setting tag:[%s]", str);
41+}
42+
2743 /**
2844 try to load file.
2945 @return false : failure
@@ -60,51 +76,29 @@
6076 }else if(splitted[0].compare(COLOR_SETTING_COLOR_PRESET_TAG) == 0){
6177 colorSetting.type = atoi(splitted[1].c_str());
6278 checksum ++;
63- }else if(splitted[0].compare(COLOR_SETTING_BACKGROUND_TAG) == 0){
64- for(int i = 0; i < COL_NUM; i ++){
65- colorSetting.background[i] = atoi(colors[i].c_str());
66- }
67- checksum ++;
68- }else if(splitted[0].compare(COLOR_SETTING_GRID_TAG) == 0){
69- for(int i = 0; i < COL_NUM; i ++){
70- colorSetting.gridLine[i] = atoi(colors[i].c_str());
71- }
72- checksum ++;
73- }else if(splitted[0].compare(COLOR_SETTING_LINES_TAG) == 0){
74- for(int i = 0; i < COL_NUM; i ++){
75- colorSetting.lines[i] = atoi(colors[i].c_str());
76- }
77- checksum ++;
78- }else if(splitted[0].compare(COLOR_SETTING_POLYGONS_TAG) == 0){
79- for(int i = 0; i < COL_NUM; i ++){
80- colorSetting.polygons[i] = atoi(colors[i].c_str());
81- }
82- checksum ++;
83- }else if(splitted[0].compare(COLOR_SETTING_STRINGS_TAG) == 0){
84- for(int i = 0; i < COL_NUM; i ++){
85- colorSetting.strings[i] = atoi(colors[i].c_str());
86- }
87- checksum ++;
88- }else if(splitted[0].compare(COLOR_SETTING_POINTS_TAG) == 0){
89- for(int i = 0; i < COL_NUM; i ++){
90- colorSetting.points[i] = atoi(colors[i].c_str());
91- }
92- checksum ++;
9379 }else if(splitted[0].compare(EDITOR_FLAGS_TAG) == 0){
9480 for(int i = 0; i < NUMBER_OF_EDITOR_FLAGS; i ++){
9581 flags[i] = (atoi(colors[i].c_str()) != 0)? true: false;
9682 }
9783 checksum ++;
98- }else {
99- std::string str = splitted[0];
100- hpl::error::halt("Illegal setting tag:[%s]", str.c_str());
84+ }else{
85+ bool found = false;
86+ for(int tag = 0; tag < ColorType::NUMBER_OF_COLOR_TYPES; tag ++){
87+ if(splitted[0].compare(COLOR_SETTING_TAGS[tag]) == 0){
88+ for(int i = 0; i < COL_NUM; i ++){
89+ colorSetting.colors[tag][i] = atoi(colors[i].c_str());
90+ }
91+ found = true;
92+ checksum++;
93+ break;
94+ }
95+ }
96+ if(!found){
97+ tagFault(splitted[0].c_str());
98+ }
10199 }
102100 }
103101 ifs.close();
104- /*if(checksum < CORRECT_CHECKSUM){
105- AfxMessageBox("invalid setting data");
106- return false;
107- }*/
108102 }
109103 return true;
110104 }
@@ -119,18 +113,10 @@
119113 }else{
120114 fprintf(fp, "%s=%d\n", GRID_SIZE_INDEX_TAG, gridSizeIndex);
121115 fprintf(fp, "%s=%d\n", COLOR_SETTING_COLOR_PRESET_TAG, colorSetting.type);
122- fprintf(fp, "%s=", COLOR_SETTING_BACKGROUND_TAG);
123- outputColor(fp, this->colorSetting.background, COL_NUM);
124- fprintf(fp, "\n%s=", COLOR_SETTING_GRID_TAG);
125- outputColor(fp, this->colorSetting.gridLine, COL_NUM);
126- fprintf(fp, "\n%s=", COLOR_SETTING_LINES_TAG);
127- outputColor(fp, this->colorSetting.lines, COL_NUM);
128- fprintf(fp, "\n%s=", COLOR_SETTING_POLYGONS_TAG);
129- outputColor(fp, this->colorSetting.polygons, COL_NUM);
130- fprintf(fp, "\n%s=", COLOR_SETTING_STRINGS_TAG);
131- outputColor(fp, this->colorSetting.strings, COL_NUM);
132- fprintf(fp, "\n%s=", COLOR_SETTING_POINTS_TAG);
133- outputColor(fp, this->colorSetting.points, COL_NUM);
116+ for(int i = 0; i < ColorType::NUMBER_OF_COLOR_TYPES; i ++){
117+ fprintf(fp, "%s=", i);
118+ outputColor(fp, this->colorSetting.colors[i], COL_NUM);
119+ }
134120 fprintf(fp, "\n%s=", EDITOR_FLAGS_TAG);
135121 for(int i = 0; i < NUMBER_OF_EDITOR_FLAGS; i ++){
136122 fprintf(fp, "%d,", flags[i]? 1: 0);
@@ -190,45 +176,25 @@
190176 setting->type = type;
191177 switch(type){
192178 case COL_FORGE:
193- setting->background[0] = 255;
194- setting->background[1] = 255;
195- setting->background[2] = 255;
196- setting->gridLine[0] = 100;
197- setting->gridLine[1] = 100;
198- setting->gridLine[2] = 100;
199- setting->lines[0] = 0;
200- setting->lines[1] = 0;
201- setting->lines[2] = 0;
202- setting->polygons[0] = 200;
203- setting->polygons[1] = 200;
204- setting->polygons[2] = 200;
205- setting->strings[0] = 0;
206- setting->strings[1] = 0;
207- setting->strings[2] = 0;
208- setting->points[0] = 0;
209- setting->points[1] = 0;
210- setting->points[2] = 255;
179+ setting->setColor(ColorType::Background, 255, 255, 255);
180+ setting->setColor(1, 100, 100, 100);
181+ setting->setColor(2, 0, 0, 0);
182+ setting->setColor(3, 200, 200, 200);
183+ setting->setColor(4, 0, 0, 0);
184+ setting->setColor(5, 0, 0, 255);
185+ setting->setColor(ColorType::SameHeightLines, 200, 100, 200);
186+ setting->setColor(ColorType::StairLines, 150, 100, 150);
211187 case COL_CUSTOM:
212188 break;
213189 case COL_MARATHON:
214- setting->background[0] = 0;
215- setting->background[1] = 0;
216- setting->background[2] = 0;
217- setting->gridLine[0] = 50;
218- setting->gridLine[1] = 50;
219- setting->gridLine[2] = 50;
220- setting->lines[0] = 50;
221- setting->lines[1] = 255;
222- setting->lines[2] = 0;
223- setting->polygons[0] = 0;
224- setting->polygons[1] = 50;
225- setting->polygons[2] = 0;
226- setting->strings[0] = 100;
227- setting->strings[1] = 255;
228- setting->strings[2] = 0;
229- setting->points[0] = 255;
230- setting->points[1] = 255;
231- setting->points[2] = 0;
190+ setting->setColor(ColorType::Background, 0, 0, 0);
191+ setting->setColor(1, 50, 50, 50);
192+ setting->setColor(2, 50, 255, 0);
193+ setting->setColor(3, 0, 50, 0);
194+ setting->setColor(4, 100, 255, 0);
195+ setting->setColor(5, 255, 255, 0);
196+ setting->setColor(ColorType::SameHeightLines, 50, 100, 50);
197+ setting->setColor(ColorType::StairLines, 150, 200, 150);
232198 break;
233199 default:
234200 hpl::error::halt("Invalid color preset type:[%d]", type);
@@ -250,6 +216,9 @@
250216 return initialSettingFileName;
251217 }
252218
219+/**
220+ デフォルト設定を取得します
221+*/
253222 MapEditorOneSetting MapEditorOneSetting::getDefaultSetting()
254223 {
255224 MapEditorOneSetting setting;
@@ -257,15 +226,35 @@
257226 return setting;
258227 }
259228
229+/**
230+ col1とcol2が一致するかどうか確かめます
231+*/
232+static bool equalsColorSetting(ColorSettings& col1, ColorSettings& col2)
233+{
234+ for(int i = 0; i < ColorType::NUMBER_OF_COLOR_TYPES; i ++){
235+ if(col1.colors[i][0] != col2.colors[i][0] ||
236+ col1.colors[i][1] != col2.colors[i][1] ||
237+ col1.colors[i][2] != col2.colors[i][2])
238+ {
239+ return false;
240+ }
241+
242+ }
243+ return true;
244+}
245+
246+/**
247+ カラータイプを探り当てます
248+*/
260249 int MapEditorOneSetting::checkColorType(ColorSettings *col)
261250 {
262251 ColorSettings temp;
263252 MapEditorOneSetting::setColorSetting(COL_FORGE, &temp);
264- if(memcmp(col, &temp, sizeof(ColorSettings)) == 0){
253+ if(equalsColorSetting(*col, temp)){
265254 return COL_FORGE;
266255 }
267256 MapEditorOneSetting::setColorSetting(COL_MARATHON, &temp);
268- if(memcmp(col, &temp, sizeof(ColorSettings)) == 0){
257+ if(equalsColorSetting(*col, temp)){
269258 return COL_MARATHON;
270259 }
271260
--- marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.h (revision 369)
+++ marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.h (revision 370)
@@ -2,20 +2,21 @@
22 #define _MAP_EDITOR_ONE_SETTING_
33
44 //#include "stdafx.h"
5-#include "header.h"
5+#include "computer_interface.h"
6+#include "editor.h"
67 #include "extensions.h"
78 #include "FileHandler.h"
8-#include "map.h"
99 #include "game_wad.h"
10-#include "weapons.h"
10+#include "header.h"
1111 #include "items.h"
12+#include "lightsource.h"
13+#include "map.h"
14+#include "media.h"
1215 #include "monsters.h"
16+#include "mysound.h"
17+#include "platforms.h"
1318 #include "scenery_definitions.h"
14-#include "mysound.h"
15-#include "computer_interface.h"
16-#include "editor.h"
17-#include "lightsource.h"
18-#include "media.h"
19+#include "weapons.h"
1920
2021 //#include "MapEditorSDI.h"
2122 const int NUMBER_OF_POLYGON_TYPE = 24;
@@ -106,20 +107,18 @@
106107 Lines,
107108 Polygons,
108109 Strings,
109- Points,
110+ Points, //5
111+ SameHeightLines,
112+ StairLines,
110113 NUMBER_OF_COLOR_TYPES
111114 };
112115 };
113-typedef struct ColorSettings_tag{
116+class ColorSettings{
117+public:
114118 int type;
115- int background[COL_NUM];
116- int gridLine[COL_NUM];
117- int lines[COL_NUM];
118- int polygons[COL_NUM];
119- int strings[COL_NUM];
120- int points[COL_NUM];
121- //int colors[ColorType::NUMBER_OF_COLOR_TYPES][COL_NUM];
122-}ColorSettings;
119+ int colors[ColorType::NUMBER_OF_COLOR_TYPES][COL_NUM];
120+ void setColor(int type, int r, int g, int b);
121+};
123122
124123 enum{
125124 IS_SHOW_GRID,
--- marathon/trunk/HPLLib/HPLError.h (revision 369)
+++ marathon/trunk/HPLLib/HPLError.h (revision 370)
@@ -1,6 +1,22 @@
11 #ifndef _HPL_ERROR_
22 #define _HPL_ERROR_
3+#ifdef WX
4+#include <wx/wx.h>
5+#endif
36
7+#ifdef __WXDEBUG__
8+
9+#include <wx/defs.h>
10+#include <wx/debug.h>
11+
12+#endif
13+#ifdef WIN32
14+
15+#include <windows.h>
16+
17+#endif
18+
19+
420 namespace hpl{
521 namespace error{
622 /**
--- marathon/trunk/HPLLib/HPLSurfaceModifier.cpp (revision 369)
+++ marathon/trunk/HPLLib/HPLSurfaceModifier.cpp (revision 370)
@@ -41,7 +41,7 @@
4141 }
4242 }
4343
44-void hpl::surface::putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
44+void hpl::surface::setpixel(SDL_Surface *surface, int x, int y, Uint32 pixel)
4545 {
4646 int bpp = surface->format->BytesPerPixel;
4747 /* この p は取得したいピクセルを指すアドレス */
--- marathon/trunk/HPLLib/HPLSurfaceModifier.h (revision 369)
+++ marathon/trunk/HPLLib/HPLSurfaceModifier.h (revision 370)
@@ -12,7 +12,7 @@
1212 /**
1313 サーフェイスに指定したピクセルを打ちます
1414 */
15- void putpixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
15+ void setpixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
1616 };
1717 };
1818 #endif
--- marathon/trunk/HPLLib/HPLShapesManager.cpp (revision 369)
+++ marathon/trunk/HPLLib/HPLShapesManager.cpp (revision 370)
@@ -1,6 +1,8 @@
11 #include "HPLShapesManager.h"
22 #include "HPLError.h"
33 #include "HPLSurfaceModifier.h"
4+#include "shapes_sdl.h"
5+
46 hpl::shapes::HPLShapesManager::HPLShapesManager()
57 {
68 this->isLoadedShapesFile_ = false;
@@ -17,6 +19,43 @@
1719 this->isLoadedShapesFile_ = loaded;
1820 }
1921
22+static SDL_Surface* createSurface(int flags, int w, int h, int bpp)
23+{
24+ Uint32 rmask, gmask, bmask, amask;
25+ //空のサーフェイスデータの作成
26+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
27+ rmask = 0xff000000;
28+ gmask = 0x00ff0000;
29+ bmask = 0x0000ff00;
30+ amask = 0x000000ff;
31+#else
32+ rmask = 0x000000ff;
33+ gmask = 0x0000ff00;
34+ bmask = 0x00ff0000;
35+ amask = 0xff000000;
36+#endif
37+ SDL_Surface* surface = SDL_CreateRGBSurface(flags,
38+ w, h, bpp,
39+ rmask, gmask, bmask, amask);
40+ return surface;
41+}
42+
43+void hpl::shapes::initScreen()
44+{
45+ screenSurface = createSurface(SDL_SWSURFACE,
46+ 640, 480, 8);
47+
48+ struct screen_mode_data scr;
49+ scr.acceleration = 0;
50+ scr.bit_depth = screenSurface->format->BitsPerPixel;
51+ scr.draw_every_other_line = 0;
52+ scr.fullscreen = 0;
53+ scr.gamma_level = 0;
54+ scr.high_resolution = 1;
55+ scr.size = 2;
56+ initialize_screen(&scr, false);
57+}
58+
2059 /**
2160 Shapesファイルを読み込みます
2261 <en> load Shapes file
@@ -24,13 +63,15 @@
2463 */
2564 void hpl::shapes::loadShapesFile(const char* path)
2665 {
27- initialize_shape_handler();
2866
67+ initialize_shape_handler();
68+
2969 FileSpecifier ShapesFile(path);
3070 if(!ShapesFile.Exists()){
3171 hpl::error::caution("no shapes file");
3272 }else{
3373 open_shapes_file(ShapesFile);
74+
3475 for(int i = 0; i < NUMBER_OF_COLLECTIONS; i ++){
3576 mark_collection_for_loading(i);
3677 }
@@ -49,7 +90,7 @@
4990
5091 //コレクションを別指定。指定する必要がないのでNONE
5192 int excol = NONE;
52- byte **outp = (byte**)malloc(siezof(byte*));
93+ byte **outp = (byte**)malloc(sizeof(byte*));
5394 int col = BUILD_COLLECTION(collection, clut);
5495 int shape = BUILD_DESCRIPTOR(col, index);
5596 SDL_Surface* surface = get_shape_surface(shape, excol, outp,
@@ -57,36 +98,24 @@
5798 #ifdef __WXDEBUG__
5899 wxASSERT(surface);
59100 #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);
101+ SDL_Surface* newSurface = createSurface(surface->flags,
102+ surface->w, surface->h, 8);
76103 #ifdef __WXDEBUG__
77104 wxASSERT(newSurface);
78105 #endif
79106 SDL_LockSurface(surface);
80107 SDL_LockSurface(newSurface);
81- for(int x = 0; x < surface->w; x ++){
82- for(int y = 0; y < surface->h; y ++){
108+ for(int y = 0; y < surface->h; y ++){
109+ for(int x = 0; x < surface->w; x ++){
83110 Uint32 pixel = hpl::surface::getpixel(surface, x, y);
84111 hpl::surface::setpixel(newSurface, x, y,
85112 SDL_MapRGB(newSurface->format, palette[pixel].r,
86- palette[pixel].g, palette[pixel].b);
113+ palette[pixel].g, palette[pixel].b));
87114 }
88115 }
89116 SDL_UnlockSurface(newSurface);
90117 SDL_UnlockSurface(surface);
118+ free(outp);
119+
91120 return newSurface;
92121 }
--- marathon/trunk/HPLLib/HPLShapesManager.h (revision 369)
+++ marathon/trunk/HPLLib/HPLShapesManager.h (revision 370)
@@ -1,3 +1,8 @@
1+/**
2+ Shapesファイルを用いる関数と管理マネージャー
3+ Shapes<->SDL_Surface間の操作のみ行い、
4+ SDL_Surface<->SDL_Surface, SDL_Surface<->wxImage等の操作は別で行うこと
5+*/
16 #ifndef _HPL_SHAPES_MANAGER_
27 #define _HPL_SHAPES_MANAGER_
38
@@ -30,6 +35,8 @@
3035 */
3136 void loadShapesFile(const char* path);
3237
38+ void initScreen();
39+
3340 /**
3441 読み込み管理
3542 */
--- marathon/trunk/HPLLib/HPLError.cpp (revision 369)
+++ marathon/trunk/HPLLib/HPLError.cpp (revision 370)
@@ -5,22 +5,6 @@
55
66 const int BUF_MAX = 1024;
77
8-#ifdef WX
9-#include <wx/wx.h>
10-#endif
11-
12-#ifdef __WXDEBUG__
13-
14-#include <wx/defs.h>
15-#include <wx/debug.h>
16-
17-#endif
18-#ifdef WIN32
19-
20-#include <windows.h>
21-
22-#endif
23-
248 /**
259 メッセージを表示します
2610 */
旧リポジトリブラウザで表示