From dee69e206906f59d6af5f6e6351d5b9d8770221f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Jul 2016 22:02:09 -0400 Subject: TITANIC: Renaming of star point classes --- engines/titanic/module.mk | 6 +-- engines/titanic/star_control/star_array.cpp | 62 ---------------------- engines/titanic/star_control/star_array.h | 57 -------------------- engines/titanic/star_control/star_control_sub1.cpp | 4 +- engines/titanic/star_control/star_control_sub1.h | 8 +-- engines/titanic/star_control/star_control_sub9.cpp | 57 -------------------- engines/titanic/star_control/star_control_sub9.h | 53 ------------------ engines/titanic/star_control/star_points1.cpp | 62 ++++++++++++++++++++++ engines/titanic/star_control/star_points1.h | 53 ++++++++++++++++++ engines/titanic/star_control/star_points2.cpp | 57 ++++++++++++++++++++ engines/titanic/star_control/star_points2.h | 53 ++++++++++++++++++ 11 files changed, 234 insertions(+), 238 deletions(-) delete mode 100644 engines/titanic/star_control/star_array.cpp delete mode 100644 engines/titanic/star_control/star_array.h delete mode 100644 engines/titanic/star_control/star_control_sub9.cpp delete mode 100644 engines/titanic/star_control/star_control_sub9.h create mode 100644 engines/titanic/star_control/star_points1.cpp create mode 100644 engines/titanic/star_control/star_points1.h create mode 100644 engines/titanic/star_control/star_points2.cpp create mode 100644 engines/titanic/star_control/star_points2.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index 9dfbc92986..96715f2c6d 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -423,7 +423,6 @@ MODULE_OBJS := \ star_control/fmatrix.o \ star_control/fpoint.o \ star_control/fvector.o \ - star_control/star_array.o \ star_control/star_control_sub1.o \ star_control/star_control_sub2.o \ star_control/star_control_sub4.o \ @@ -431,8 +430,6 @@ MODULE_OBJS := \ star_control/star_control_sub6.o \ star_control/star_control_sub7.o \ star_control/star_control_sub8.o \ - star_control/star_control_sub9.o \ - star_control/star_view.o \ star_control/star_control_sub12.o \ star_control/star_control_sub13.o \ star_control/star_control_sub20.o \ @@ -442,6 +439,9 @@ MODULE_OBJS := \ star_control/star_control_sub24.o \ star_control/star_control_sub25.o \ star_control/star_control_sub26.o \ + star_control/star_points1.o \ + star_control/star_points2.o \ + star_control/star_view.o \ star_control/surface_area.o \ star_control/surface_fader_base.o \ star_control/surface_fader.o \ diff --git a/engines/titanic/star_control/star_array.cpp b/engines/titanic/star_control/star_array.cpp deleted file mode 100644 index 2e4a928aa2..0000000000 --- a/engines/titanic/star_control/star_array.cpp +++ /dev/null @@ -1,62 +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_array.h" -#include "titanic/star_control/star_control_sub12.h" -#include "titanic/titanic.h" - -namespace Titanic { - -#define ARRAY_COUNT 876 -const double FACTOR = 3.1415927 * 0.0055555557; - -CStarArray::CStarArray() { -} - -void CStarArray::initialize() { - // Get a reference to the starfield points resource - Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS"); - assert(stream && stream->size() == (12 * ARRAY_COUNT)); - - _data.resize(ARRAY_COUNT); - for (int idx = 0; idx < ARRAY_COUNT; ++idx) { - CStarArrayEntry &entry = _data[idx]; - - // Get the next set of values - double v1 = stream->readUint32LE(); - double v2 = stream->readUint32LE(); - stream->readUint32LE(); - - v1 *= 0.0099999998 * FACTOR; - v2 *= 0.015 * FACTOR; - - entry._v1 = cos(v2) * 3000000.0 * cos(v1); - entry._v2 = sin(v2) * 3000000.0 * cos(v1); - entry._v3 = sin(v1) * 3000000.0; - } -} - -void CStarArray::draw(CSurfaceArea *surface, CStarControlSub12 *img) { - // TODO -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_array.h b/engines/titanic/star_control/star_array.h deleted file mode 100644 index 827af01739..0000000000 --- a/engines/titanic/star_control/star_array.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_ARRAY_H -#define TITANIC_STAR_ARRAY_H - -#include "common/array.h" -#include "titanic/star_control/surface_area.h" - -namespace Titanic { - -class CStarControlSub12; - -class CStarArray { - struct CStarArrayEntry { - double _v1; - double _v2; - double _v3; - }; -private: - Common::Array _data; -public: - CStarArray(); - - /** - * Initialize the array - */ - void initialize(); - - /** - * Draw the starfield points - */ - void draw(CSurfaceArea *surface, CStarControlSub12 *img); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_ARRAY_H */ diff --git a/engines/titanic/star_control/star_control_sub1.cpp b/engines/titanic/star_control/star_control_sub1.cpp index 75dc2303f1..c3a268eee3 100644 --- a/engines/titanic/star_control/star_control_sub1.cpp +++ b/engines/titanic/star_control/star_control_sub1.cpp @@ -43,8 +43,8 @@ void CStarControlSub1::load(SimpleFile *file, int param) { bool CStarControlSub1::initDocument() { warning("CStarControlSub1::initDocument"); - _starArray.initialize(); - _sub9.initialize(); + _points1.initialize(); + _points2.initialize(); return true; } diff --git a/engines/titanic/star_control/star_control_sub1.h b/engines/titanic/star_control/star_control_sub1.h index 0e99b4ef72..dd7ae5f20c 100644 --- a/engines/titanic/star_control/star_control_sub1.h +++ b/engines/titanic/star_control/star_control_sub1.h @@ -23,12 +23,12 @@ #ifndef TITANIC_STAR_CONTROL_SUB1_H #define TITANIC_STAR_CONTROL_SUB1_H -#include "titanic/star_control/star_array.h" #include "titanic/star_control/star_control_sub2.h" #include "titanic/star_control/star_control_sub5.h" #include "titanic/star_control/star_control_sub7.h" #include "titanic/star_control/star_control_sub8.h" -#include "titanic/star_control/star_control_sub9.h" +#include "titanic/star_control/star_points1.h" +#include "titanic/star_control/star_points2.h" namespace Titanic { @@ -36,8 +36,8 @@ class CStarControlSub1 : public CStarControlSub2 { private: CStarControlSub7 _sub7; CStarControlSub8 _sub8; - CStarControlSub9 _sub9; - CStarArray _starArray; + CStarPoints1 _points1; + CStarPoints2 _points2; CStarControlSub5 _sub5; int _field7DA8; int _field7DAC; diff --git a/engines/titanic/star_control/star_control_sub9.cpp b/engines/titanic/star_control/star_control_sub9.cpp deleted file mode 100644 index 292e9a87d0..0000000000 --- a/engines/titanic/star_control/star_control_sub9.cpp +++ /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. - * - */ - -#include "titanic/star_control/star_control_sub9.h" -#include "titanic/titanic.h" - -namespace Titanic { - -#define ARRAY_COUNT 80 -const double FACTOR = 3.1415927 * 0.0055555557; - -void CStarControlSub9::initialize() { - // Get a reference to the starfield points resource - Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS2"); - - _data.resize(ARRAY_COUNT); - for (int rootCtr = 0; rootCtr < ARRAY_COUNT; ++rootCtr) { - // Get the number of sub-entries for this entry - int count = stream->readUint32LE(); - double v1, v2; - - // Read in the sub-entries - RootEntry &rootEntry = _data[rootCtr]; - rootEntry.resize(count * 2); - for (int idx = 0; idx < count * 2; ++idx) { - DataEntry &entry = rootEntry[idx]; - v1 = stream->readSint32LE(); - v2 = stream->readSint32LE(); - v1 *= 0.015 * FACTOR; - v2 *= 0.0099999998 * FACTOR; - entry._v1 = cos(v1) * 3000000.0 * cos(v2); - entry._v2 = sin(v1) * 3000000.0 * cos(v2); - entry._v3 = sin(v2) * 3000000.0; - } - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub9.h b/engines/titanic/star_control/star_control_sub9.h deleted file mode 100644 index 5f334f48d1..0000000000 --- a/engines/titanic/star_control/star_control_sub9.h +++ /dev/null @@ -1,53 +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_SUB9_H -#define TITANIC_STAR_CONTROL_SUB9_H - -#include "common/array.h" - -namespace Titanic { - -class CStarControlSub9 { - struct DataEntry { - int _v1; - int _v2; - int _v3; - }; - - class RootEntry : public Common::Array { - public: - int _field0; - RootEntry() : _field0(0) {} - }; -private: - Common::Array _data; -public: - /** - * Initializes the data - */ - void initialize(); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB9_H */ diff --git a/engines/titanic/star_control/star_points1.cpp b/engines/titanic/star_control/star_points1.cpp new file mode 100644 index 0000000000..9e684f3c10 --- /dev/null +++ b/engines/titanic/star_control/star_points1.cpp @@ -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. + * + */ + +#include "titanic/star_control/star_points1.h" +#include "titanic/star_control/star_control_sub12.h" +#include "titanic/titanic.h" + +namespace Titanic { + +#define ARRAY_COUNT 876 +const double FACTOR = 3.1415927 * 0.0055555557; + +CStarPoints1::CStarPoints1() { +} + +void CStarPoints1::initialize() { + // Get a reference to the starfield points resource + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS"); + assert(stream && stream->size() == (12 * ARRAY_COUNT)); + + _data.resize(ARRAY_COUNT); + for (int idx = 0; idx < ARRAY_COUNT; ++idx) { + FVector &entry = _data[idx]; + + // Get the next set of values + double v1 = stream->readUint32LE(); + double v2 = stream->readUint32LE(); + stream->readUint32LE(); + + v1 *= 0.0099999998 * FACTOR; + v2 *= 0.015 * FACTOR; + + entry._x = cos(v2) * 3000000.0 * cos(v1); + entry._y = sin(v2) * 3000000.0 * cos(v1); + entry._z = sin(v1) * 3000000.0; + } +} + +void CStarPoints1::draw(CSurfaceArea *surface, CStarControlSub12 *img) { + // TODO +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_points1.h b/engines/titanic/star_control/star_points1.h new file mode 100644 index 0000000000..41fb6b488e --- /dev/null +++ b/engines/titanic/star_control/star_points1.h @@ -0,0 +1,53 @@ +/* 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_POINTS1_H +#define TITANIC_STAR_POINTS1_H + +#include "common/array.h" +#include "titanic/star_control/surface_area.h" +#include "titanic/star_control/fvector.h" + +namespace Titanic { + +class CStarControlSub12; + +class CStarPoints1 { +private: + Common::Array _data; +public: + CStarPoints1(); + + /** + * Initialize the array + */ + void initialize(); + + /** + * Draw the starfield points + */ + void draw(CSurfaceArea *surface, CStarControlSub12 *img); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_POINTS1_H */ diff --git a/engines/titanic/star_control/star_points2.cpp b/engines/titanic/star_control/star_points2.cpp new file mode 100644 index 0000000000..10d10e1836 --- /dev/null +++ b/engines/titanic/star_control/star_points2.cpp @@ -0,0 +1,57 @@ +/* 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_points2.h" +#include "titanic/titanic.h" + +namespace Titanic { + +#define ARRAY_COUNT 80 +const double FACTOR = 3.1415927 * 0.0055555557; + +void CStarPoints2::initialize() { + // Get a reference to the starfield points resource + Common::SeekableReadStream *stream = g_vm->_filesManager->getResource("STARFIELD/POINTS2"); + + _data.resize(ARRAY_COUNT); + for (int rootCtr = 0; rootCtr < ARRAY_COUNT; ++rootCtr) { + // Get the number of sub-entries for this entry + int count = stream->readUint32LE(); + double v1, v2; + + // Read in the sub-entries + RootEntry &rootEntry = _data[rootCtr]; + rootEntry.resize(count * 2); + for (int idx = 0; idx < count * 2; ++idx) { + DataEntry &entry = rootEntry[idx]; + v1 = stream->readSint32LE(); + v2 = stream->readSint32LE(); + v1 *= 0.015 * FACTOR; + v2 *= 0.0099999998 * FACTOR; + entry._v1 = cos(v1) * 3000000.0 * cos(v2); + entry._v2 = sin(v1) * 3000000.0 * cos(v2); + entry._v3 = sin(v2) * 3000000.0; + } + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_points2.h b/engines/titanic/star_control/star_points2.h new file mode 100644 index 0000000000..0ba5e0a655 --- /dev/null +++ b/engines/titanic/star_control/star_points2.h @@ -0,0 +1,53 @@ +/* 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_POINTS2_H +#define TITANIC_STAR_POINTS2_H + +#include "common/array.h" + +namespace Titanic { + +class CStarPoints2 { + struct DataEntry { + int _v1; + int _v2; + int _v3; + }; + + class RootEntry : public Common::Array { + public: + int _field0; + RootEntry() : _field0(0) {} + }; +private: + Common::Array _data; +public: + /** + * Initializes the data + */ + void initialize(); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_STAR_POINTS2_H */ -- cgit v1.2.3