From ab28f8714353ab5043d86375572815ebc75fe7ed Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 5 Feb 2016 23:39:27 -0500 Subject: TITANIC: Beginnings of Image class --- engines/titanic/image.cpp | 90 ++++++++++++++++++++++++++++++++++++ engines/titanic/image.h | 79 +++++++++++++++++++++++++++++++ engines/titanic/main_game_window.cpp | 6 +++ engines/titanic/main_game_window.h | 3 +- engines/titanic/module.mk | 1 + 5 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 engines/titanic/image.cpp create mode 100644 engines/titanic/image.h diff --git a/engines/titanic/image.cpp b/engines/titanic/image.cpp new file mode 100644 index 0000000000..d49f2eca2d --- /dev/null +++ b/engines/titanic/image.cpp @@ -0,0 +1,90 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/image.h" + +namespace Titanic { + +BITMAPINFOHEADER::BITMAPINFOHEADER() { + _biSize = 0; + _biWidth = 0; + _biHeight = 0; + _biPlanes = 0; + _biBitCount = 0; + _biCompression = 0; + _biSizeImage = 0; + _biXPelsPerMeter = 0; + _biYPelsPerMeter = 0; + _biCirUsed = 0; + _biClrImportant = 0; +} + +/*------------------------------------------------------------------------*/ + +RGBQuad::RGBQuad() : _rgbRed(0), _rgbGreen(0), _rgbBlue(0), _rgbReserved(0) {} + +/*------------------------------------------------------------------------*/ + +Image::Image() { + _bitmapInfo = nullptr; + _bits = nullptr; + _flag = true; + + set(16, 16); +} + +void Image::proc6() { + +} + +void Image::set(int width, int height) { + delete _bitmapInfo; + if (_flag && _bitmapInfo) + delete[] _bits; + + _bitmapInfo = new tagBITMAPINFO; + _bits = new byte[(width + 3) & 0xFFFC * height]; + + tagBITMAPINFO &bi = *_bitmapInfo; + bi._bmiHeader._biWidth = width; + bi._bmiHeader._biHeight = height; + bi._bmiHeader._biPlanes = 1; + bi._bmiHeader._biBitCount = 8; +} + +void Image::proc8() { + +} + +bool Image::loadResource(const Common::String &name) { + return true; +} + +void Image::proc10() { + +} + +void Image::draw() { + +} + +} // End of namespace Titanic diff --git a/engines/titanic/image.h b/engines/titanic/image.h new file mode 100644 index 0000000000..625c78b01b --- /dev/null +++ b/engines/titanic/image.h @@ -0,0 +1,79 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_IMAGE_H +#define TITANIC_IMAGE_H + +#include "common/scummsys.h" +#include "common/array.h" + +namespace Titanic { + +struct BITMAPINFOHEADER { + int _biSize; + int _biWidth; + int _biHeight; + int _biPlanes; + int _biBitCount; + bool _biCompression; + int _biSizeImage; + int _biXPelsPerMeter; + int _biYPelsPerMeter; + int _biCirUsed; + int _biClrImportant; + + BITMAPINFOHEADER(); +}; + +struct RGBQuad { + byte _rgbRed; + byte _rgbGreen; + byte _rgbBlue; + byte _rgbReserved; + + RGBQuad(); +}; + +struct tagBITMAPINFO { + BITMAPINFOHEADER _bmiHeader; + RGBQuad _bmiColors[256]; +}; + +class Image { +public: + tagBITMAPINFO *_bitmapInfo; + byte *_bits; + bool _flag; +public: + Image(); + + virtual void proc6(); + virtual void set(int width, int height); + virtual void proc8(); + virtual bool loadResource(const Common::String &name); + virtual void proc10(); + virtual void draw(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_IMAGE_H */ diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 774cde6de1..54fb6c23a4 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -20,6 +20,7 @@ * */ +#include "titanic/titanic.h" #include "titanic/main_game_window.h" namespace Titanic { @@ -31,6 +32,11 @@ CMainGameWindow::CMainGameWindow(TitanicEngine *vm): _vm(vm) { _field50 = 0; _image = nullptr; _cursor = nullptr; + + Image image; + bool result = image.loadResource("TITANIC"); + if (!result) + return; } } // End of namespace Titanic diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h index ae303470ae..91e68600e0 100644 --- a/engines/titanic/main_game_window.h +++ b/engines/titanic/main_game_window.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/array.h" +#include "titanic/image.h" namespace Titanic { @@ -38,7 +39,7 @@ public: void *_gameManager; void *_project; int _field50; - void *_image; + Image *_image; void *_cursor; public: CMainGameWindow(TitanicEngine *vm); diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 6f26bd441f..18cde154ab 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -3,6 +3,7 @@ MODULE := engines/titanic MODULE_OBJS := \ detection.o \ font.o \ + image.o \ main_game_window.o \ screen_manager.o \ titanic.o -- cgit v1.2.3