From 79b4754b3318c21479dfccaf91dcf09fabf23fd4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 2 Jul 2016 16:11:19 -0400 Subject: TITANIC: Finish and better name fader classes --- .../titanic/star_control/star_control_sub15.cpp | 31 --------- engines/titanic/star_control/star_control_sub15.h | 43 ------------ .../titanic/star_control/star_control_sub16.cpp | 74 -------------------- engines/titanic/star_control/star_control_sub16.h | 57 ---------------- engines/titanic/star_control/star_view.h | 4 +- engines/titanic/star_control/surface_area.cpp | 50 ++++++++++++++ engines/titanic/star_control/surface_area.h | 65 ++++++++++++++++++ engines/titanic/star_control/surface_fader.cpp | 73 ++++++++++++++++++++ engines/titanic/star_control/surface_fader.h | 51 ++++++++++++++ .../titanic/star_control/surface_fader_base.cpp | 78 ++++++++++++++++++++++ engines/titanic/star_control/surface_fader_base.h | 62 +++++++++++++++++ engines/titanic/star_control/surface_obj.cpp | 50 -------------- engines/titanic/star_control/surface_obj.h | 65 ------------------ 13 files changed, 381 insertions(+), 322 deletions(-) delete mode 100644 engines/titanic/star_control/star_control_sub15.cpp delete mode 100644 engines/titanic/star_control/star_control_sub15.h delete mode 100644 engines/titanic/star_control/star_control_sub16.cpp delete mode 100644 engines/titanic/star_control/star_control_sub16.h create mode 100644 engines/titanic/star_control/surface_area.cpp create mode 100644 engines/titanic/star_control/surface_area.h create mode 100644 engines/titanic/star_control/surface_fader.cpp create mode 100644 engines/titanic/star_control/surface_fader.h create mode 100644 engines/titanic/star_control/surface_fader_base.cpp create mode 100644 engines/titanic/star_control/surface_fader_base.h delete mode 100644 engines/titanic/star_control/surface_obj.cpp delete mode 100644 engines/titanic/star_control/surface_obj.h (limited to 'engines/titanic/star_control') diff --git a/engines/titanic/star_control/star_control_sub15.cpp b/engines/titanic/star_control/star_control_sub15.cpp deleted file mode 100644 index 07ed80ccc5..0000000000 --- a/engines/titanic/star_control/star_control_sub15.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* 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/star_control/star_control_sub15.h" - -namespace Titanic { - -CStarControlSub15::CStarControlSub15() : _field4(-1), - _field8(32), _fieldC(0), _field10(0), _field14(0) { -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub15.h b/engines/titanic/star_control/star_control_sub15.h deleted file mode 100644 index 0e0d2e41c0..0000000000 --- a/engines/titanic/star_control/star_control_sub15.h +++ /dev/null @@ -1,43 +0,0 @@ -/* 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_STAR_CONTROL_SUB15_H -#define TITANIC_STAR_CONTROL_SUB15_H - -#include "titanic/support/simple_file.h" - -namespace Titanic { - -class CStarControlSub15 { -private: - double _field4; - double _field8; - double _fieldC; - double _field10; - double _field14; -public: - CStarControlSub15(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB15_H */ diff --git a/engines/titanic/star_control/star_control_sub16.cpp b/engines/titanic/star_control/star_control_sub16.cpp deleted file mode 100644 index 1465ac6a3e..0000000000 --- a/engines/titanic/star_control/star_control_sub16.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* 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/star_control/star_control_sub16.h" - -namespace Titanic { - -CStarControlSub16::CStarControlSub16() : _field4(-1), _field8(32), - _videoSurface(nullptr) { -} - -void CStarControlSub16::reset() { - _field4 = 0; -} - -bool CStarControlSub16::setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface) { - int width = srcSurface->getWidth(); - int height = srcSurface->getHeight(); - - if (_videoSurface) { - if (width == _videoSurface->getWidth() && _videoSurface->getHeight()) - // Allocated surface already matches new size - return true; - - // Different sizes, so delete old surface - delete _videoSurface; - } - - _videoSurface = screenManager->createSurface(width, height); - return true; -} - -CVideoSurface *CStarControlSub16::loadSurface(CScreenManager *screenManager, CVideoSurface *srcSurface) { - if (_field4 < 0 || _field4 >= _field8) - return srcSurface; - - if (!_field8 && !setupSurface(screenManager, srcSurface)) - return nullptr; - - srcSurface->lock(); - _videoSurface->lock(); - CSurfaceObj srcSurfaceObj(srcSurface); - CSurfaceObj destSurfaceObj(_videoSurface); - - proc4(srcSurfaceObj, destSurfaceObj); - - srcSurface->unlock(); - _videoSurface->unlock(); - - ++_field4; - return _videoSurface; -} - - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub16.h b/engines/titanic/star_control/star_control_sub16.h deleted file mode 100644 index 64e463ca5b..0000000000 --- a/engines/titanic/star_control/star_control_sub16.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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_STAR_CONTROL_SUB16_H -#define TITANIC_STAR_CONTROL_SUB16_H - -#include "titanic/support/video_surface.h" -#include "titanic/support/screen_manager.h" -#include "titanic/star_control/surface_obj.h" - -namespace Titanic { - -class CStarControlSub16 { -private: - /** - * Sets up an internal surface to match the size of the specified one - */ - bool setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface); -protected: - int _field4; - int _field8; - CVideoSurface *_videoSurface; -protected: - virtual void proc4(CSurfaceObj &srcSurface, CSurfaceObj &destSurface) = 0; -public: - CStarControlSub16(); - - virtual void reset(); - - /** - * Loads from a given source surface - */ - virtual CVideoSurface *loadSurface(CScreenManager *screenManager, CVideoSurface *srcSurface); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB16_H */ diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h index 47d138a0dc..d625d9bf0f 100644 --- a/engines/titanic/star_control/star_view.h +++ b/engines/titanic/star_control/star_view.h @@ -27,7 +27,7 @@ #include "titanic/support/video_surface.h" #include "titanic/star_control/star_control_sub12.h" #include "titanic/star_control/star_control_sub13.h" -#include "titanic/star_control/star_control_sub15.h" +#include "titanic/star_control/surface_fader.h" namespace Titanic { @@ -39,7 +39,7 @@ private: CStarControlSub12 _sub12; int _field118; CStarControlSub13 _sub13; - CStarControlSub15 _sub15; + CSurfaceFader _fader; int _field20C; int _field210; int _field214; diff --git a/engines/titanic/star_control/surface_area.cpp b/engines/titanic/star_control/surface_area.cpp new file mode 100644 index 0000000000..77f8222dad --- /dev/null +++ b/engines/titanic/star_control/surface_area.cpp @@ -0,0 +1,50 @@ +/* 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/star_control/surface_area.h" + +namespace Titanic { + +CSurfaceArea::CSurfaceArea(CVideoSurface *surface) { + _width = surface->getWidth(); + _height = surface->getHeight(); + _pitch = surface->getPitch(); + + // Original supported other pixel depths + _bpp = surface->getPixelDepth(); + assert(_bpp == 2); + _pixelsPtr = surface->getPixels(); + + initialize(); +} + +void CSurfaceArea::initialize() { + _bounds = Rect(0, 0, _width - 1, _height - 1); + _centroid = Point(_width / 2, _height / 2); + _field22 = _field21 = _field20 = 0xFF; + _field27 = _field26 = _field25 = 0; + _field24 = _field23 = 0; + _field28 = _field2C = 0; + _field38 = 0; +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/surface_area.h b/engines/titanic/star_control/surface_area.h new file mode 100644 index 0000000000..4d1913123c --- /dev/null +++ b/engines/titanic/star_control/surface_area.h @@ -0,0 +1,65 @@ +/* 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_SURFACE_OBJ_H +#define TITANIC_SURFACE_OBJ_H + +#include "titanic/support/rect.h" +#include "titanic/support/video_surface.h" + +namespace Titanic { + +class CSurfaceArea { +private: + /** + * Initialize data for the class + */ + void initialize(); +public: + int _field0; + int _width; + int _height; + int _pitch; + int _bpp; + uint16 *_pixelsPtr; + Point _centroid; + byte _field20; + byte _field21; + byte _field22; + byte _field23; + byte _field24; + byte _field25; + byte _field26; + byte _field27; + int _field28; + int _field2C; + int _field30; + int _field34; + int _field38; + Rect _bounds; +public: + CSurfaceArea(CVideoSurface *surface); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_CONTROL_SUB16_H */ diff --git a/engines/titanic/star_control/surface_fader.cpp b/engines/titanic/star_control/surface_fader.cpp new file mode 100644 index 0000000000..089ad51717 --- /dev/null +++ b/engines/titanic/star_control/surface_fader.cpp @@ -0,0 +1,73 @@ +/* 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/star_control/surface_fader.h" +#include "common/system.h" +#include "graphics/pixelformat.h" + +namespace Titanic { + +CSurfaceFader::CSurfaceFader() : CSurfaceFaderBase() { + _dataP = new byte[_count]; + + for (int idx = 0; idx < _count; ++idx) { + // TODO: Setup data bytes + } +} + +CSurfaceFader::~CSurfaceFader() { + delete[] _dataP; +} + +void CSurfaceFader::copySurface(CSurfaceArea &srcSurface, CSurfaceArea &destSurface) { + const uint16 *srcPixelP = srcSurface._pixelsPtr; + uint16 *destPixelP = destSurface._pixelsPtr; + + // Currently we only support 2 bytes per pixel surfaces + assert(srcSurface._bpp == 2); + + byte dataVal = _dataP[_index]; + double fraction = (double)dataVal / ((double)(_count - 1)); + if (!_fadeIn) + // For fade outs, reverse the percentage visibility + fraction = 1.0 - fraction; + + // Iterate through the pixels + byte r, g, b; + Graphics::PixelFormat format = g_system->getScreenFormat(); + + for (int yp = 0; yp < srcSurface._height; ++yp) { + for (int xp = 0; xp < srcSurface._width; ++xp, ++srcPixelP, ++destPixelP) { + format.colorToRGB(*srcPixelP, r, g, b); + r = (byte)((double)r * fraction); + g = (byte)((double)g * fraction); + b = (byte)((double)b * fraction); + *destPixelP = format.RGBToColor(r, g, b); + } + } +} + +void CSurfaceFader::setFadeIn(bool fadeIn) { + _fadeIn = fadeIn; +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/surface_fader.h b/engines/titanic/star_control/surface_fader.h new file mode 100644 index 0000000000..650cbbb19b --- /dev/null +++ b/engines/titanic/star_control/surface_fader.h @@ -0,0 +1,51 @@ +/* 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_SURFACE_FADER_H +#define TITANIC_SURFACE_FADER_H + +#include "titanic/star_control/surface_fader_base.h" + +namespace Titanic { + +class CSurfaceFader: public CSurfaceFaderBase { +private: + byte *_dataP; + bool _fadeIn; +protected: + /** + * Create a faded version of the source surface at the given dest + */ + virtual void copySurface(CSurfaceArea &srcSurface, CSurfaceArea &destSurface); +public: + CSurfaceFader(); + virtual ~CSurfaceFader(); + + /** + * Sets whether a fade in (versus a fade out) should be done + */ + void setFadeIn(bool fadeIn); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SURFACE_SHADER_H */ diff --git a/engines/titanic/star_control/surface_fader_base.cpp b/engines/titanic/star_control/surface_fader_base.cpp new file mode 100644 index 0000000000..dfd7c4ab1d --- /dev/null +++ b/engines/titanic/star_control/surface_fader_base.cpp @@ -0,0 +1,78 @@ +/* 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/star_control/surface_fader_base.h" + +namespace Titanic { + +CSurfaceFaderBase::CSurfaceFaderBase() : _index(-1), _count(32), + _videoSurface(nullptr) { +} + +CSurfaceFaderBase::~CSurfaceFaderBase() { + delete _videoSurface; +} + +void CSurfaceFaderBase::reset() { + _index = 0; +} + +bool CSurfaceFaderBase::setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface) { + int width = srcSurface->getWidth(); + int height = srcSurface->getHeight(); + + if (_videoSurface) { + if (width == _videoSurface->getWidth() && _videoSurface->getHeight()) + // Allocated surface already matches new size + return true; + + // Different sizes, so delete old surface + delete _videoSurface; + } + + _videoSurface = screenManager->createSurface(width, height); + return true; +} + +CVideoSurface *CSurfaceFaderBase::fade(CScreenManager *screenManager, CVideoSurface *srcSurface) { + if (_index == -1 || _index >= _count) + return srcSurface; + + if (!_count && !setupSurface(screenManager, srcSurface)) + return nullptr; + + srcSurface->lock(); + _videoSurface->lock(); + CSurfaceArea srCSurfaceArea(srcSurface); + CSurfaceArea destSurfaceObj(_videoSurface); + + // Copy the surface with fading + copySurface(srCSurfaceArea, destSurfaceObj); + + srcSurface->unlock(); + _videoSurface->unlock(); + + ++_index; + return _videoSurface; +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/surface_fader_base.h b/engines/titanic/star_control/surface_fader_base.h new file mode 100644 index 0000000000..ead4460521 --- /dev/null +++ b/engines/titanic/star_control/surface_fader_base.h @@ -0,0 +1,62 @@ +/* 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_SURFACE_FADER_BASE_H +#define TITANIC_SURFACE_FADER_BASE_H + +#include "titanic/support/video_surface.h" +#include "titanic/support/screen_manager.h" +#include "titanic/star_control/surface_area.h" + +namespace Titanic { + +class CSurfaceFaderBase { +private: + /** + * Sets up an internal surface to match the size of the specified one + */ + bool setupSurface(CScreenManager *screenManager, CVideoSurface *srcSurface); +protected: + int _index; + int _count; + CVideoSurface *_videoSurface; +protected: + /** + * Create a faded version of the source surface at the given dest + */ + virtual void copySurface(CSurfaceArea &srcSurface, CSurfaceArea &destSurface) = 0; +public: + CSurfaceFaderBase(); + virtual ~CSurfaceFaderBase(); + + virtual void reset(); + + /** + * Creates a faded version of the passed source surface, based on a percentage + * visibility specified by _index of _count + */ + virtual CVideoSurface *fade(CScreenManager *screenManager, CVideoSurface *srcSurface); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_SURFACE_FADER_BASE_H */ diff --git a/engines/titanic/star_control/surface_obj.cpp b/engines/titanic/star_control/surface_obj.cpp deleted file mode 100644 index 93f46e5ad4..0000000000 --- a/engines/titanic/star_control/surface_obj.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* 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/star_control/surface_obj.h" - -namespace Titanic { - -CSurfaceObj::CSurfaceObj(CVideoSurface *surface) { - _width = surface->getWidth(); - _height = surface->getHeight(); - _pitch = surface->getPitch(); - - // Original supported other pixel depths - _bpp = surface->getPixelDepth(); - assert(_bpp == 2); - _pixelsPtr = surface->getPixels(); - - initialize(); -} - -void CSurfaceObj::initialize() { - _bounds = Rect(0, 0, _width - 1, _height - 1); - _centroid = Point(_width / 2, _height / 2); - _field22 = _field21 = _field20 = 0xFF; - _field27 = _field26 = _field25 = 0; - _field24 = _field23 = 0; - _field28 = _field2C = 0; - _field38 = 0; -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/surface_obj.h b/engines/titanic/star_control/surface_obj.h deleted file mode 100644 index 518f85b502..0000000000 --- a/engines/titanic/star_control/surface_obj.h +++ /dev/null @@ -1,65 +0,0 @@ -/* 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_SURFACE_OBJ_H -#define TITANIC_SURFACE_OBJ_H - -#include "titanic/support/rect.h" -#include "titanic/support/video_surface.h" - -namespace Titanic { - -class CSurfaceObj { -private: - /** - * Initialize data for the class - */ - void initialize(); -public: - int _field0; - int _width; - int _height; - int _pitch; - int _bpp; - uint16 *_pixelsPtr; - Point _centroid; - byte _field20; - byte _field21; - byte _field22; - byte _field23; - byte _field24; - byte _field25; - byte _field26; - byte _field27; - int _field28; - int _field2C; - int _field30; - int _field34; - int _field38; - Rect _bounds; -public: - CSurfaceObj(CVideoSurface *surface); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB16_H */ -- cgit v1.2.3