diff --git a/image.cpp b/image.cpp index f109ec2..38d331d 100644 --- a/image.cpp +++ b/image.cpp @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: /Users/sev/projects/sc/s/scummvm/scummex/image.cpp,v 1.6 2003/09/21 23:50:28 yoshizf Exp $ + * $Header: /Users/sev/projects/sc/s/scummvm/scummex/image.cpp,v 1.7 2003/09/22 15:23:56 yoshizf Exp $ * */ @@ -74,6 +74,81 @@ int Image::drawPalette(BlockTable *_blockTable, int id, File& _input) 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; iDisplayImage("Boxes", width, height); + } + + for (int i=0; iDrawImage(); + } else { + _gui->UpdateImage(); + } + return 0; +} + int Image::drawSmushFrame(BlockTable *_blockTable, int id, File& _input) { int index; int x = 0, y = 0; diff --git a/image.h b/image.h index ada78af..8758649 100644 --- a/image.h +++ b/image.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: /Users/sev/projects/sc/s/scummvm/scummex/image.h,v 1.5 2003/09/21 23:50:28 yoshizf Exp $ + * $Header: /Users/sev/projects/sc/s/scummvm/scummex/image.h,v 1.6 2003/09/22 15:23:56 yoshizf Exp $ * */ @@ -34,9 +34,15 @@ struct rgbtable { 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 @@ private: 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 @@ public: 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); diff --git a/resource.cpp b/resource.cpp index 01243e8..4fd1972 100644 --- a/resource.cpp +++ b/resource.cpp @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: /Users/sev/projects/sc/s/scummvm/scummex/resource.cpp,v 1.12 2003/09/22 08:31:59 yoshizf Exp $ + * $Header: /Users/sev/projects/sc/s/scummvm/scummex/resource.cpp,v 1.13 2003/09/22 15:23:56 yoshizf Exp $ * */ @@ -824,6 +824,14 @@ int Resource::parseBlocks(char *blockName, BlockTable *_blockTable, File& _input 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); diff --git a/scummex.cpp b/scummex.cpp index 5c45106..9b90672 100644 --- a/scummex.cpp +++ b/scummex.cpp @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummex.cpp,v 1.13 2003/09/21 23:50:28 yoshizf Exp $ + * $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummex.cpp,v 1.14 2003/09/22 15:23:57 yoshizf Exp $ * */ @@ -285,6 +285,12 @@ void ScummEX::objectDraw() _image->drawObject(_input, _blockTable, _blockId); } +void ScummEX::boxesDraw() +{ + _image = new Image(); + _image->drawBoxes(_blockTable, _blockId, _input); +} + void ScummEX::FileInfo() { int fsize; fsize = _input.size(); @@ -391,6 +397,11 @@ void ScummEX::UpdateInfosFromTree(int blockid) { _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; } } diff --git a/scummex.h b/scummex.h index ed07ae8..36bd5b8 100644 --- a/scummex.h +++ b/scummex.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummex.h,v 1.6 2003/09/21 23:50:28 yoshizf Exp $ + * $Header: /Users/sev/projects/sc/s/scummvm/scummex/scummex.h,v 1.7 2003/09/22 15:23:57 yoshizf Exp $ * */ @@ -42,7 +42,6 @@ public: File _output; uint32 _blockId; int _scummVersion; - ScummEX(); void fileView(); @@ -63,6 +62,7 @@ public: void bgDraw(); void SmushFrameDraw(); void objectDraw(); + void boxesDraw(); }; #endif diff --git a/wxwindows.cpp b/wxwindows.cpp index 50b733b..c67bacd 100644 --- a/wxwindows.cpp +++ b/wxwindows.cpp @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: /Users/sev/projects/sc/s/scummvm/scummex/wxwindows.cpp,v 1.11 2003/09/21 23:50:28 yoshizf Exp $ + * $Header: /Users/sev/projects/sc/s/scummvm/scummex/wxwindows.cpp,v 1.12 2003/09/22 15:23:57 yoshizf Exp $ * */ @@ -227,6 +227,12 @@ void GUI_wxWindows::DrawImage() { 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 @@ void ImageWindow::DrawImage() { 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 @@ void GUI_wxWindows::SetButton(int blocktype) { (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; } } diff --git a/wxwindows.h b/wxwindows.h index 3ee37ff..9c8fab1 100644 --- a/wxwindows.h +++ b/wxwindows.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: /Users/sev/projects/sc/s/scummvm/scummex/wxwindows.h,v 1.3 2003/09/19 19:57:07 yoshizf Exp $ + * $Header: /Users/sev/projects/sc/s/scummvm/scummex/wxwindows.h,v 1.4 2003/09/22 15:23:57 yoshizf Exp $ * */ @@ -60,6 +60,8 @@ public: 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 @@ public: void AppendText(char *text); void FileInfoDialog(int size, int encbyte); void DrawImage(); + void UpdateImage(); void DisplayHelp(); void SetTitle(char *title); void SaveImage();