• R/O
  • SSH
  • HTTPS

marathon: コミット


コミットメタ情報

リビジョン376 (tree)
日時2007-07-11 03:54:40
作者hogepiyo

ログメッセージ

*** empty log message ***

変更サマリ

差分

--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 375)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 376)
@@ -145,43 +145,80 @@
145145 double illumination = 1.0;
146146 //wxGetApp().getShapesImage(&texture, collection, clut, index, illumination);
147147
148- //256x80
149- int palSizeW = 10;
150- int palSizeH = 10;
151- int pitch = 50;
152- int lineNum = 8;
153- this->paletteImg.Create(palSizeW * pitch, palSizeH * lineNum);
154- SDL_Color palette[256];
155- byte** outp = (byte**)malloc(sizeof(byte*));
156- SDL_Surface* surface = wxGetApp().getShapesManager()->getRawSurface(collection, clut, index,
157- illumination, palette, outp);
158- SDL_FreeSurface(surface);
159- free(outp);
160- //パレットに配置していく
161- //collection情報
162- struct collection_header* header = get_collection_header(collection);
163- int clutNum = header->collection->clut_count;
164- int colorNum = header->collection->color_count;
165- int color_table_offset = header->collection->color_table_offset;
166- int numColors = 0;
167- struct rgb_color_value* palette1 = get_collection_colors(collection, clut, numColors);
168- for(int i = 0; i < numColors; i ++){
169- int x = (i % pitch) * palSizeW;
170- int y = (i / pitch) * palSizeH;
171- int w = palSizeW;
172- int h = palSizeH;
173- wxRect rect(x, y, w, h);
174- paletteImg.SetRGB(rect,
175- palette1[i].red,
176- palette1[i].green,
177- palette1[i].blue);
178- }
148+ {
149+ //256x80
150+ int palSizeW = 10;
151+ int palSizeH = 10;
152+ int pitch = 50;
153+ int lineNum = 8;
154+ this->paletteImg.Create(palSizeW * pitch, palSizeH * lineNum);
155+ SDL_Color palette[256];
156+ byte** outp = (byte**)malloc(sizeof(byte*));
157+ SDL_Surface* surface = wxGetApp().getShapesManager()->getRawSurface(collection, clut, index,
158+ illumination, palette, outp);
159+ SDL_FreeSurface(surface);
160+ free(outp);
161+ //パレットに配置していく
162+ //collection情報
163+ struct collection_header* header = get_collection_header(collection);
164+ int clutNum = header->collection->clut_count;
165+ int colorNum = header->collection->color_count;
166+ int color_table_offset = header->collection->color_table_offset;
167+ int numColors = 0;
168+ struct rgb_color_value* palette1 = get_collection_colors(collection, clut, numColors);
169+ for(int i = 0; i < numColors; i ++){
170+ int x = (i % pitch) * palSizeW;
171+ int y = (i / pitch) * palSizeH;
172+ int w = palSizeW;
173+ int h = palSizeH;
174+ wxRect rect(x, y, w, h);
175+ paletteImg.SetRGB(rect,
176+ palette1[i].red,
177+ palette1[i].green,
178+ palette1[i].blue);
179+ }
179180
180- surface = wxGetApp().getShapesManager()->getSurface(collection, clut, index,
181- illumination);
182- //色数の取得
183- wxGetApp().getShapesImageFromSurface(&texture, surface);
184- SDL_FreeSurface(surface);
181+ surface = wxGetApp().getShapesManager()->getSurface(collection, clut, index,
182+ illumination);
183+ //色数の取得
184+ wxGetApp().getShapesImageFromSurface(&texture, surface);
185+ SDL_FreeSurface(surface);
186+ }
187+ //all texture loading
188+ for(int i = 0; i < MAXIMUM_COLLECTIONS; i ++){
189+ collection_definition* collectionDef = get_collection_definition(i);
190+ if(collectionDef == NULL){
191+ continue;
192+ }
193+ if(collectionDef->type != _wall_collection){
194+ continue;
195+ }
196+ collection_header* header = get_collection_header(i);
197+ if(header == NULL || header->collection == NULL){
198+ continue;
199+ }
200+ if(header->collection->type != _wall_collection){
201+ continue;
202+ }
203+
204+ int clutNum = header->collection->clut_count;
205+ int bmpNum = header->collection->bitmap_count;
206+ bool invalid = false;
207+ if(bmpNum < 10){
208+ invalid = true;
209+ }
210+ for(int clut = 0; clut < clutNum; clut ++){
211+ for(int index = 0; index < bmpNum; index ++){
212+ wxImage img;
213+ if(invalid){
214+ img.Create(1,1);
215+ }else{
216+ wxGetApp().getShapesImage(&img, i, clut, index, illumination);
217+ }
218+ textureMap[i][clut][index] = img;
219+ }
220+ }
221+ }
185222 }
186223
187224 //セットアップ
--- marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 375)
+++ marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 376)
@@ -106,11 +106,33 @@
106106 if(wxGetApp().getShapesManager()->isLoadedShapesFile()){
107107 //Shapesファイルから読み込みテスト
108108 wxBitmap bmp = wxBitmap(this->texture);
109- dc.DrawBitmap(bmp,0,0,true);
109+ dc.DrawBitmap(bmp,voffset[0],voffset[1],true);
110110
111111 bmp = wxBitmap(paletteImg);
112- dc.DrawBitmap(bmp, 100, 0, true);
112+ dc.DrawBitmap(bmp, 100 + voffset[0], voffset[1], true);
113113
114+ int W = 100, H = 100, PITCH = 5;
115+ int W_SPACE = 10, H_SPACE = 10, LINES = 10;
116+ //draw walls
117+ std::map<int, std::map<int, std::map<int, wxImage> > >::iterator it;
118+ int counter = 0;
119+ for(it = textureMap.begin(); it != textureMap.end(); it ++){
120+ int collection = it->first;
121+ std::map<int, std::map<int, wxImage> >::iterator it1;
122+ for(it1 = it->second.begin(); it1 != it->second.end(); it1 ++){
123+ int clut = it1->first;
124+ std::map<int, wxImage>::iterator it2;
125+ for(it2 = it1->second.begin(); it2 != it1->second.end(); it2 ++){
126+ int index = it2->first;
127+ wxImage* img = &it2->second;
128+ int x = 10 + (index % PITCH ) * (W + W_SPACE);
129+ int y = 200 + (index / PITCH) * (H + H_SPACE) + counter * LINES * (H + H_SPACE);
130+ wxBitmap bmpImg = wxBitmap(*img);
131+ dc.DrawBitmap(bmpImg, x+voffset[0], y+voffset[1]);
132+ }
133+ }
134+ counter ++;
135+ }
114136 }
115137
116138 //バッファから画面へコピー
--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.h (revision 375)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.h (revision 376)
@@ -199,6 +199,12 @@
199199
200200 wxImage texture;
201201 wxImage paletteImg;
202+
203+ /**
204+ stocked textures
205+ [collection][clut][index]
206+ */
207+ std::map<int, std::map<int, std::map<int, wxImage> > > textureMap;
202208 public:
203209 MapEditorMainFrame(const wxString& title,
204210 const wxPoint& pos = wxDefaultPosition,
旧リポジトリブラウザで表示