[Scummvm-cvs-logs] CVS: scummex image.cpp,1.6,1.7 image.h,1.5,1.6 resource.cpp,1.12,1.13 scummex.cpp,1.13,1.14 scummex.h,1.6,1.7 wxwindows.cpp,1.11,1.12 wxwindows.h,1.3,1.4
Adrien Mercier
yoshizf at users.sourceforge.net
Mon Sep 22 08:25:17 CEST 2003
Update of /cvsroot/scummvm/scummex
In directory sc8-pr-cvs1:/tmp/cvs-serv13641
Modified Files:
image.cpp image.h resource.cpp scummex.cpp scummex.h
wxwindows.cpp wxwindows.h
Log Message:
Added a walkboxes viewer
Index: image.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- image.cpp 21 Sep 2003 23:50:28 -0000 1.6
+++ image.cpp 22 Sep 2003 15:23:56 -0000 1.7
@@ -74,6 +74,81 @@
return 0;
}
+void Image::drawLine(int xStart, int yStart, int xEnd, int yEnd, int red, int green, int blue) {
+
+ int i, len, xlen, ylen;
+ double x, xinc, y, yinc;
+
+ if (xStart == xEnd && yStart == yEnd) {
+ _gui->PutPixel(xEnd, yEnd, red, green, blue);
+ return;
+ }
+
+ xlen = xEnd - xStart;
+ ylen = yEnd - yStart;
+
+ if (abs(xlen) > abs(ylen)) {
+ len = abs(xlen);
+ } else {
+ len = abs(ylen);
+ }
+
+ xinc = xlen / (double) len;
+ yinc = ylen / (double) len;
+ x = xStart + 0.5;
+ y = yStart + 0.5;
+
+ for (i=0; i<=len; ++i) {
+ _gui->PutPixel((int)x, (int)y, red, green, blue);
+ x += xinc;
+ y += yinc;
+ }
+
+}
+
+int Image::drawBoxes(BlockTable *_blockTable, int id, File& _input, int newWindow) {
+ int nBox, RMHDindex, width, height;
+
+ RMHDindex = _resource->findBlock(0, _blockTable, _input, id, "RMHD", "-1");
+ width = _blockTable[RMHDindex].width;
+ height = _blockTable[RMHDindex].height;
+
+ _input.seek(_blockTable[id].offset + 10, SEEK_SET);
+
+ nBox = _blockTable[id].numFiles;
+
+ for (int i=0; i<nBox; i++) {
+ _points[i][0].x = _input.readUint16LE();
+ _points[i][0].y = _input.readUint16LE();
+ _points[i][1].x = _input.readUint16LE();
+ _points[i][1].y = _input.readUint16LE();
+ _points[i][2].x = _input.readUint16LE();
+ _points[i][2].y = _input.readUint16LE();
+ _points[i][3].x = _input.readUint16LE();
+ _points[i][3].y = _input.readUint16LE();
+ _input.readUint16LE();
+ _input.readUint16LE();
+ }
+
+ if (newWindow == 1) {
+ _gui->DisplayImage("Boxes", width, height);
+ }
+
+ for (int i=0; i<nBox; i++) {
+ for (int j=0; j<3; j++) {
+ drawLine(_points[i][j].x, _points[i][j].y, _points[i][j+1].x, _points[i][j+1].y, 255, 255, 255);
+ }
+ drawLine(_points[i][3].x, _points[i][3].y, _points[i][0].x, _points[i][0].y, 255, 255, 255);
+ }
+
+ if (newWindow == 1) {
+ _gui->DrawImage();
+ } else {
+ _gui->UpdateImage();
+ }
+ return 0;
+}
+
int Image::drawSmushFrame(BlockTable *_blockTable, int id, File& _input) {
int index;
int x = 0, y = 0;
Index: image.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/image.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- image.h 21 Sep 2003 23:50:28 -0000 1.5
+++ image.h 22 Sep 2003 15:23:56 -0000 1.6
@@ -34,9 +34,15 @@
int blue;
};
+struct points {
+ int x;
+ int y;
+};
+
class Image {
private:
struct rgbtable _rgbTable[256];
+ struct points _points[40][4];
uint32 _palette[256];
int _transp;
uint32 *_offsets;
@@ -47,6 +53,8 @@
Codec37Decoder _codec37;
Codec47Decoder _codec47;
+ void drawLine(int xStart, int yStart, int xEnd, int yEnd, int red, int green, int blue);
+
public:
Image();
~Image();
@@ -54,6 +62,7 @@
int drawBG(File& _input, BlockTable *_blockTable, int id, char* filename);
int drawObject(File& _input, BlockTable *_blockTable, int id);
int drawSmushFrame(BlockTable *_blockTable, int id, File& _input);
+ int drawBoxes(BlockTable *_blockTable, int id, File& _input, int newWindow = 1);
void decode_uncompressed(uint16 height, File& _input);
void decode_horiz(uint16 height, uint8 compr, File& _input);
void decode_vert(uint16 height, uint8 compr, File& _input);
Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/resource.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- resource.cpp 22 Sep 2003 08:31:59 -0000 1.12
+++ resource.cpp 22 Sep 2003 15:23:56 -0000 1.13
@@ -824,6 +824,14 @@
index++;
break;
+ case BOXD:
+ _blockTable[index].blockSize = _input.readUint32BE();
+ _blockTable[index].numFiles = _input.readUint16LE(); // Number of walkboxes
+ _input.seek(_blockTable[index].offset + _blockTable[index].blockSize, SEEK_SET);
+ _gui->add_tree_elements(_blockTable[index].blockName, index, level, _blockTable[index].blockTypeID);
+ index++;
+ break;
+
default:
_blockTable[index].blockSize = _input.readUint32BE();
_input.seek(_blockTable[index].offset + _blockTable[index].blockSize, SEEK_SET);
Index: scummex.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/scummex.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- scummex.cpp 21 Sep 2003 23:50:28 -0000 1.13
+++ scummex.cpp 22 Sep 2003 15:23:57 -0000 1.14
@@ -285,6 +285,12 @@
_image->drawObject(_input, _blockTable, _blockId);
}
+void ScummEX::boxesDraw()
+{
+ _image = new Image();
+ _image->drawBoxes(_blockTable, _blockId, _input);
+}
+
void ScummEX::FileInfo() {
int fsize;
fsize = _input.size();
@@ -389,6 +395,11 @@
_gui->updateLabel("SpecLabel1", "Frame Width", _blockTable[blockid].width);
_gui->updateLabel("SpecLabel2", "Frame Height", _blockTable[blockid].height);
_gui->updateLabel("SpecLabel3", "Codec", _blockTable[blockid].variables);
+ _gui->SetButton(_blockTable[blockid].blockTypeID);
+ break;
+
+ case BOXD:
+ _gui->updateLabel("SpecLabel1", "No. of Boxes", _blockTable[blockid].numFiles);
_gui->SetButton(_blockTable[blockid].blockTypeID);
break;
}
Index: scummex.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/scummex.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- scummex.h 21 Sep 2003 23:50:28 -0000 1.6
+++ scummex.h 22 Sep 2003 15:23:57 -0000 1.7
@@ -42,7 +42,6 @@
File _output;
uint32 _blockId;
int _scummVersion;
-
ScummEX();
void fileView();
@@ -63,6 +62,7 @@
void bgDraw();
void SmushFrameDraw();
void objectDraw();
+ void boxesDraw();
};
#endif
Index: wxwindows.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummex/wxwindows.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- wxwindows.cpp 21 Sep 2003 23:50:28 -0000 1.11
+++ wxwindows.cpp 22 Sep 2003 15:23:57 -0000 1.12
@@ -227,6 +227,12 @@
imageFrame->DrawImage();
}
+void GUI_wxWindows::UpdateImage() {
+ wxBitmap bitmap = wxBitmap(image);
+ imageFrame->_sbmp->SetBitmap(bitmap);
+ imageFrame->Refresh();
+}
+
ImageWindow::ImageWindow(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame(frame,ID_ImageWindow,title,pos,size, wxDEFAULT_FRAME_STYLE & (wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION))
{
@@ -251,9 +257,9 @@
wxBoxSizer *vertSizer = new wxBoxSizer( wxVERTICAL );
- wxStaticBitmap *sbmp = new wxStaticBitmap(this, -1, bitmap);
+ _sbmp = new wxStaticBitmap(this, -1, bitmap);
- vertSizer->Add(sbmp, 0, wxALL, 0 );
+ vertSizer->Add(_sbmp, 0, wxALL, 0 );
Show(TRUE);
}
@@ -392,6 +398,12 @@
(wxObjectEventFunction) &ScummEX::Descumm );
break;
+ case BOXD:
+ SpecButton1->SetLabel("View Boxes...");
+ SpecButton1->Show(TRUE);
+ SpecButton1->Connect( ID_SpecButton1, wxEVT_COMMAND_BUTTON_CLICKED,
+ (wxObjectEventFunction) &ScummEX::boxesDraw );
+ break;
}
}
Index: wxwindows.h
===================================================================
RCS file: /cvsroot/scummvm/scummex/wxwindows.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- wxwindows.h 19 Sep 2003 19:57:07 -0000 1.3
+++ wxwindows.h 22 Sep 2003 15:23:57 -0000 1.4
@@ -60,6 +60,8 @@
class ImageWindow : public wxFrame {
public:
+ wxStaticBitmap *_sbmp;
+
void DrawImage();
void OnQuit(wxCommandEvent& event);
ImageWindow(const wxString& title, const wxPoint& pos, const wxSize& size);
@@ -84,6 +86,7 @@
void AppendText(char *text);
void FileInfoDialog(int size, int encbyte);
void DrawImage();
+ void UpdateImage();
void DisplayHelp();
void SetTitle(char *title);
void SaveImage();
More information about the Scummvm-git-logs
mailing list