• R/O
  • SSH
  • HTTPS

marathon: コミット


コミットメタ情報

リビジョン375 (tree)
日時2007-07-10 23:30:35
作者hogepiyo

ログメッセージ

*** empty log message ***

変更サマリ

差分

--- marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 374)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.cpp (revision 375)
@@ -332,17 +332,7 @@
332332 //サーフェイス取得
333333
334334 SDL_Surface* surface = this->getShapesManager()->getSurface(collection, clut, index, illumination);
335- img->Create(surface->w, surface->h);
336- SDL_LockSurface(surface);
337- for(int x = 0; x < surface->w; x ++){
338- for(int y = 0; y < surface->h; y ++){
339- Uint32 pixel = hpl::surface::getpixel(surface, x, y);
340- unsigned char r, g, b;
341- SDL_GetRGB(pixel, surface->format, &r, &g, &b);
342- img->SetRGB(x, y, r, g, b);
343- }
344- }
345- SDL_UnlockSurface(surface);
335+ this->getShapesImageFromSurface(img, surface);
346336 SDL_FreeSurface(surface);
347337
348338 /*
@@ -360,6 +350,20 @@
360350 SDL_FreeSurface(surface);
361351 free(outp);*/
362352 }
353+void MapEditorWX::getShapesImageFromSurface(wxImage* img, SDL_Surface* surface)
354+{
355+ img->Create(surface->w, surface->h);
356+ SDL_LockSurface(surface);
357+ for(int x = 0; x < surface->w; x ++){
358+ for(int y = 0; y < surface->h; y ++){
359+ Uint32 pixel = hpl::surface::getpixel(surface, x, y);
360+ unsigned char r, g, b;
361+ SDL_GetRGB(pixel, surface->format, &r, &g, &b);
362+ img->SetRGB(x, y, r, g, b);
363+ }
364+ }
365+ SDL_UnlockSurface(surface);
366+}
363367
364368 //char->wx
365369 wxString getString(const char* format, ...)
--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 374)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.cpp (revision 375)
@@ -143,7 +143,45 @@
143143 int clut = 0;
144144 int index = 0;
145145 double illumination = 1.0;
146- wxGetApp().getShapesImage(&texture, collection, clut, index, illumination);
146+ //wxGetApp().getShapesImage(&texture, collection, clut, index, illumination);
147+
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+ }
179+
180+ surface = wxGetApp().getShapesManager()->getSurface(collection, clut, index,
181+ illumination);
182+ //色数の取得
183+ wxGetApp().getShapesImageFromSurface(&texture, surface);
184+ SDL_FreeSurface(surface);
147185 }
148186
149187 //セットアップ
--- marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 374)
+++ marathon/trunk/MapEditorWX/src/MainFrameDraw.cpp (revision 375)
@@ -107,6 +107,10 @@
107107 //Shapesファイルから読み込みテスト
108108 wxBitmap bmp = wxBitmap(this->texture);
109109 dc.DrawBitmap(bmp,0,0,true);
110+
111+ bmp = wxBitmap(paletteImg);
112+ dc.DrawBitmap(bmp, 100, 0, true);
113+
110114 }
111115
112116 //バッファから画面へコピー
--- marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 374)
+++ marathon/trunk/MapEditorWX/src/MapEditorWX.h (revision 375)
@@ -285,6 +285,7 @@
285285 void resetLineEditInfo();
286286
287287 void getShapesImage(wxImage* img, int collection, int clut, int index, double illumination);
288+ void getShapesImageFromSurface(wxImage* img, SDL_Surface* surface);
288289 private:
289290
290291 };
--- marathon/trunk/MapEditorWX/src/MapEditorMainFrame.h (revision 374)
+++ marathon/trunk/MapEditorWX/src/MapEditorMainFrame.h (revision 375)
@@ -198,6 +198,7 @@
198198 wxPen selectingPen;
199199
200200 wxImage texture;
201+ wxImage paletteImg;
201202 public:
202203 MapEditorMainFrame(const wxString& title,
203204 const wxPoint& pos = wxDefaultPosition,
--- marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.h (revision 374)
+++ marathon/trunk/MapEditorCommonSrc/MapEditorOneSetting.h (revision 375)
@@ -17,6 +17,9 @@
1717 #include "platforms.h"
1818 #include "scenery_definitions.h"
1919 #include "weapons.h"
20+#include "collection_definition.h"
21+#include "shape_definitions.h"
22+#include "shapes_sdl.h"
2023
2124 //#include "MapEditorSDI.h"
2225 const int NUMBER_OF_POLYGON_TYPE = 24;
--- marathon/trunk/HPLLib/HPLShapesManager.cpp (revision 374)
+++ marathon/trunk/HPLLib/HPLShapesManager.cpp (revision 375)
@@ -1,7 +1,6 @@
11 #include "HPLShapesManager.h"
22 #include "HPLError.h"
33 #include "HPLSurfaceModifier.h"
4-#include "shapes_sdl.h"
54
65 const int SCREEN_BPP = 32;
76 const int NEW_SURFACE_BPP = SCREEN_BPP;
@@ -48,6 +47,7 @@
4847 {
4948 screenSurface = createSurface(SDL_SWSURFACE,
5049 640, 480, SCREEN_BPP);
50+ bit_depth = SCREEN_BPP;
5151
5252 struct screen_mode_data scr;
5353 scr.acceleration = 0;
@@ -139,6 +139,10 @@
139139 #endif
140140 SDL_LockSurface(surface);
141141 SDL_LockSurface(newSurface);
142+ struct collection_header* header = get_collection_header(collection);
143+ int numColors = 0;
144+ struct rgb_color_value* palette1 = get_collection_colors(collection, clut, numColors);
145+// int colorPaletteOffset = header->collection->color_table_offset;
142146 for(int y = 0; y < surface->h; y ++){
143147 for(int x = 0; x < surface->w; x ++){
144148 Uint32 pixel = hpl::surface::getpixel(surface, x, y);
@@ -148,7 +152,9 @@
148152 surface->format->palette->colors[pixel].g,
149153 surface->format->palette->colors[pixel].b));
150154 */
151- palette[pixel].b, palette[pixel].g, palette[pixel].r));
155+ palette1[pixel].red,
156+ palette1[pixel].green,
157+ palette1[pixel].blue));
152158 }
153159 }
154160 SDL_UnlockSurface(newSurface);
--- marathon/trunk/HPLLib/HPLShapesManager.h (revision 374)
+++ marathon/trunk/HPLLib/HPLShapesManager.h (revision 375)
@@ -20,6 +20,9 @@
2020 #include "editor.h"
2121 #include "lightsource.h"
2222 #include "media.h"
23+#include "collection_definition.h"
24+#include "shape_definitions.h"
25+#include "shapes_sdl.h"
2326
2427 namespace hpl{
2528 namespace shapes{
旧リポジトリブラウザで表示