• R/O
  • SSH
  • HTTPS

marathon: コミット


コミットメタ情報

リビジョン371 (tree)
日時2007-07-09 21:19:15
作者hogepiyo

ログメッセージ

*** empty log message ***

変更サマリ

差分

--- marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 370)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 371)
@@ -330,7 +330,7 @@
330330 void MapEditorWX::getShapesImage(wxImage* img, int collection, int clut, int index, double illumination)
331331 {
332332 //サーフェイス取得
333- SDL_Surface* surface = hpl::shapes::getSurface(collection, clut, index, illumination);
333+ SDL_Surface* surface = this->getShapesManager()->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 ++){
--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 370)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 371)
@@ -131,19 +131,21 @@
131131 wxGetApp().isChanged = false;
132132 this->initLevel();
133133
134- hpl::shapes::initScreen();
134+ hpl::shapes::HPLShapesManager* shpmgr = wxGetApp().getShapesManager();
135+ shpmgr->initScreen();
135136
136137 //Shapesファイル読み込み
137- wxGetApp().getShapesManager()->setLoadedShapesFile(false);
138138 const char* SHAPES_FILE_PATH = "Shapes.shpA";
139- hpl::shapes::loadShapesFile(SHAPES_FILE_PATH);
139+ bool result = shpmgr->loadShapesFile(SHAPES_FILE_PATH);
140+ if(result){
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);
147+ }
140148
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);
147149 //セットアップ
148150 wxGetApp().getStockManager()->updateDeletes();
149151 }
@@ -236,7 +238,7 @@
236238 menuBar->Append(menuEdit, _T("&Edit"));
237239 menuBar->Append(menuShow, _T("&Show"));
238240 menuBar->Append(menuMode, _T("&Mode"));
239- menuBar->Append(menuSpecial, _T("&Special! (^o^)/"));
241+ menuBar->Append(menuSpecial, _T("&Special! 8)"));
240242 menuBar->Append(menuHelp, _T("&Help"));
241243
242244 SetMenuBar(menuBar);
--- marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 370)
+++ marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 371)
@@ -103,9 +103,11 @@
103103 }
104104 }
105105
106- //Shapesファイルから読み込みテスト
107- wxBitmap bmp = wxBitmap(this->texture);
108- dc.DrawBitmap(bmp,0,0,true);
106+ if(wxGetApp().getShapesManager()->isLoadedShapesFile()){
107+ //Shapesファイルから読み込みテスト
108+ wxBitmap bmp = wxBitmap(this->texture);
109+ dc.DrawBitmap(bmp,0,0,true);
110+ }
109111
110112 //バッファから画面へコピー
111113 dc.Blit(wxPoint(0,0), size,
--- marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 370)
+++ marathon/trunk/MapEditorWX/WXTODOリスト.txt (revision 371)
@@ -224,4 +224,7 @@
224224 ??SameHeightLines
225225 ?E?قȂ鍂????
226226 ??StairLines
227-
\ No newline at end of file
227+
228+TODO ?????ʕ\??
229+TODO ?e?N?X?`???Ń|???S???\??
230+TODO ?R?s?y
\ No newline at end of file
--- marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.cpp (revision 370)
+++ marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.cpp (revision 371)
@@ -114,7 +114,7 @@
114114 fprintf(fp, "%s=%d\n", GRID_SIZE_INDEX_TAG, gridSizeIndex);
115115 fprintf(fp, "%s=%d\n", COLOR_SETTING_COLOR_PRESET_TAG, colorSetting.type);
116116 for(int i = 0; i < ColorType::NUMBER_OF_COLOR_TYPES; i ++){
117- fprintf(fp, "%s=", i);
117+ fprintf(fp, "%s=", COLOR_SETTING_TAGS[i]);
118118 outputColor(fp, this->colorSetting.colors[i], COL_NUM);
119119 }
120120 fprintf(fp, "\n%s=", EDITOR_FLAGS_TAG);
--- marathon/trunk/HPLLib/HPLShapesManager.cpp (revision 370)
+++ marathon/trunk/HPLLib/HPLShapesManager.cpp (revision 371)
@@ -3,9 +3,13 @@
33 #include "HPLSurfaceModifier.h"
44 #include "shapes_sdl.h"
55
6+const int SCREEN_BPP = 32;
7+const int NEW_SURFACE_BPP = SCREEN_BPP;
8+
69 hpl::shapes::HPLShapesManager::HPLShapesManager()
710 {
811 this->isLoadedShapesFile_ = false;
12+ isInitialized = false;
913 }
1014 hpl::shapes::HPLShapesManager::~HPLShapesManager()
1115 {
@@ -40,10 +44,10 @@
4044 return surface;
4145 }
4246
43-void hpl::shapes::initScreen()
47+void hpl::shapes::HPLShapesManager::initScreen()
4448 {
45- screenSurface = createSurface(SDL_SWSURFACE,
46- 640, 480, 8);
49+ screenSurface = createSurface(SDL_HWSURFACE,
50+ 640, 480, SCREEN_BPP);
4751
4852 struct screen_mode_data scr;
4953 scr.acceleration = 0;
@@ -54,6 +58,8 @@
5458 scr.high_resolution = 1;
5559 scr.size = 2;
5660 initialize_screen(&scr, false);
61+
62+ isInitialized = true;
5763 }
5864
5965 /**
@@ -61,14 +67,17 @@
6167 <en> load Shapes file
6268 @param path Shapesファイルパス <en> Shapes file's path
6369 */
64-void hpl::shapes::loadShapesFile(const char* path)
70+bool hpl::shapes::HPLShapesManager::loadShapesFile(const char* path)
6571 {
66-
72+ if(!isInitialized){
73+ hpl::error::caution("Shapes Manager is not initialized yet");
74+ return false;
75+ }
6776 initialize_shape_handler();
6877
6978 FileSpecifier ShapesFile(path);
7079 if(!ShapesFile.Exists()){
71- hpl::error::caution("no shapes file");
80+ hpl::error::halt("cannot load shapes file[%s]", path);
7281 }else{
7382 open_shapes_file(ShapesFile);
7483
@@ -76,15 +85,23 @@
7685 mark_collection_for_loading(i);
7786 }
7887 load_collections(false, false);
88+ this->setLoadedShapesFile(true);
7989 }
90+ return true;
8091 }
8192 /**
8293 指定したShapesデータを取得します。
8394 @return 失敗時にNULL
8495 */
85-SDL_Surface* hpl::shapes::getSurface(int collection, int clut, int index,
96+SDL_Surface* hpl::shapes::HPLShapesManager::getSurface(int collection, int clut, int index,
8697 double illumination)
8798 {
99+ if(!isInitialized){
100+ hpl::error::halt("Shapes Manager is not initialized yet");
101+ }
102+ if(!this->isLoadedShapesFile()){
103+ hpl::error::halt("Shapes Manager doesn't load Shapes file yet");
104+ }
88105 //TODO
89106 SDL_Color palette[256];
90107
@@ -93,13 +110,16 @@
93110 byte **outp = (byte**)malloc(sizeof(byte*));
94111 int col = BUILD_COLLECTION(collection, clut);
95112 int shape = BUILD_DESCRIPTOR(col, index);
113+ if(screenSurface->format->BitsPerPixel == 8 && illumination >= 0){
114+ illumination = -1.0;
115+ }
96116 SDL_Surface* surface = get_shape_surface(shape, excol, outp,
97117 illumination, false, palette);
98118 #ifdef __WXDEBUG__
99119 wxASSERT(surface);
100120 #endif
101- SDL_Surface* newSurface = createSurface(surface->flags,
102- surface->w, surface->h, 8);
121+ SDL_Surface* newSurface = createSurface(screenSurface->flags,
122+ surface->w, surface->h, NEW_SURFACE_BPP);
103123 #ifdef __WXDEBUG__
104124 wxASSERT(newSurface);
105125 #endif
@@ -109,8 +129,12 @@
109129 for(int x = 0; x < surface->w; x ++){
110130 Uint32 pixel = hpl::surface::getpixel(surface, x, y);
111131 hpl::surface::setpixel(newSurface, x, y,
112- SDL_MapRGB(newSurface->format, palette[pixel].r,
113- palette[pixel].g, palette[pixel].b));
132+ SDL_MapRGB(screenSurface->format,
133+/* surface->format->palette->colors[pixel].r,
134+ surface->format->palette->colors[pixel].g,
135+ surface->format->palette->colors[pixel].b));
136+ */
137+ palette[pixel].r, palette[pixel].g, palette[pixel].b));
114138 }
115139 }
116140 SDL_UnlockSurface(newSurface);
--- marathon/trunk/HPLLib/HPLShapesManager.h (revision 370)
+++ marathon/trunk/HPLLib/HPLShapesManager.h (revision 371)
@@ -23,20 +23,6 @@
2323
2424 namespace hpl{
2525 namespace shapes{
26- /**
27- 指定したShapesデータを取得します。
28- @return 失敗時にNULL
29- */
30- SDL_Surface* getSurface(int collection, int clut, int index, double illumination);
31- /**
32- Shapesファイルを読み込みます
33- <en> load Shapes file
34- @param path Shapesファイルパス <en> Shapes file's path
35- */
36- void loadShapesFile(const char* path);
37-
38- void initScreen();
39-
4026 /**
4127 読み込み管理
4228 */
@@ -44,13 +30,29 @@
4430 //Shapesファイルを読み込めていたら真 <en> true when Shapes file loaded
4531 bool isLoadedShapesFile_;
4632
33+ bool isInitialized;
4734 public:
4835 HPLShapesManager();
4936 ~HPLShapesManager();
5037
38+ private:
39+ void setLoadedShapesFile(bool loaded);
5140 public:
5241 bool isLoadedShapesFile();
53- void setLoadedShapesFile(bool loaded);
42+ /**
43+ 指定したShapesデータを取得します。
44+ @return 失敗時にNULL
45+ */
46+ SDL_Surface* getSurface(int collection, int clut, int index, double illumination);
47+ /**
48+ Shapesファイルを読み込みます
49+ <en> load Shapes file
50+ @param path Shapesファイルパス <en> Shapes file's path
51+ */
52+ bool loadShapesFile(const char* path);
53+
54+ void initScreen();
55+
5456 };
5557 };
5658 };
旧リポジトリブラウザで表示