aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure10
-rw-r--r--dists/androidsdl/scummvm/AndroidAppSettings.cfg2
-rw-r--r--dists/androidsdl/scummvm/AndroidAppSettings.cfg.in2
-rwxr-xr-xdists/androidsdl/scummvm/AndroidBuild.sh2
-rw-r--r--engines/director/director.cpp6
-rw-r--r--engines/director/events.cpp3
-rw-r--r--engines/director/lingo/lingo-builtins.cpp2
-rw-r--r--engines/director/lingo/lingo.cpp7
-rw-r--r--engines/director/score.cpp3
-rw-r--r--engines/director/score.h3
-rw-r--r--engines/titanic/module.mk1
-rw-r--r--engines/titanic/star_control/base_star.cpp15
-rw-r--r--engines/titanic/star_control/base_star.h23
-rw-r--r--engines/titanic/star_control/star_control_sub2.cpp2
-rw-r--r--engines/titanic/star_control/star_control_sub2.h2
-rw-r--r--engines/titanic/star_control/star_control_sub7.cpp2
-rw-r--r--engines/titanic/star_control/star_control_sub8.cpp78
-rw-r--r--engines/titanic/star_control/star_control_sub8.h38
-rw-r--r--engines/titanic/star_control/star_field.cpp2
-rw-r--r--engines/titanic/star_control/star_ref.cpp62
-rw-r--r--engines/titanic/star_control/star_ref.h78
21 files changed, 298 insertions, 45 deletions
diff --git a/configure b/configure
index 8021a82003..d958c0e411 100755
--- a/configure
+++ b/configure
@@ -2663,8 +2663,16 @@ case $_host_os in
append_var CXXFLAGS "-Wl,-q -I$VITASDK/arm-vita-eabi/include"
append_var CXXFLAGS "-march=armv7-a -mtune=cortex-a9 -mfpu=neon -mfloat-abi=hard"
append_var LDFLAGS "-Wl,-q -L$VITASDK/arm-vita-eabi/lib"
+ #the next line fixes a crash when starting scumm-7-8 games (The Dig etc.)
+ #when either -O2, -O3 or -Os optimizations are enabled
+ append_var CXXFLAGS "-fno-optimize-sibling-calls"
+ #the next line fixes "branch out of range" error in gob engine when -Os is used
+ append_var CXXFLAGS "-mlong-calls"
if test "$_debug_build" = no; then
- _optimization_level=-O1
+ #optimize for smallest file size. This is necessary to prevent a crash on startup
+ #due to the large executable file size when many engines are enabled
+ #for example when --enable-all-engines is used to enable all the unstable engines
+ _optimization_level=-Os
fi
if test "$_debug_build" = yes; then
_optimization_level=-O0
diff --git a/dists/androidsdl/scummvm/AndroidAppSettings.cfg b/dists/androidsdl/scummvm/AndroidAppSettings.cfg
index 55300e6edd..d636201863 100644
--- a/dists/androidsdl/scummvm/AndroidAppSettings.cfg
+++ b/dists/androidsdl/scummvm/AndroidAppSettings.cfg
@@ -185,7 +185,7 @@ DeleteFilesOnUpgrade="%"
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
-CompiledLibraries="mad vorbis flac ogg jpeg png theora freetype faad"
+CompiledLibraries="mad vorbis flac ogg jpeg png theora freetype faad curl sdl_net"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=y
diff --git a/dists/androidsdl/scummvm/AndroidAppSettings.cfg.in b/dists/androidsdl/scummvm/AndroidAppSettings.cfg.in
index 897389a36f..7837a9e196 100644
--- a/dists/androidsdl/scummvm/AndroidAppSettings.cfg.in
+++ b/dists/androidsdl/scummvm/AndroidAppSettings.cfg.in
@@ -185,7 +185,7 @@ DeleteFilesOnUpgrade="%"
# Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
-CompiledLibraries="mad vorbis flac ogg jpeg png theora freetype faad"
+CompiledLibraries="mad vorbis flac ogg jpeg png theora freetype faad curl sdl_net"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=y
diff --git a/dists/androidsdl/scummvm/AndroidBuild.sh b/dists/androidsdl/scummvm/AndroidBuild.sh
index beeb7a3845..a0f587de1f 100755
--- a/dists/androidsdl/scummvm/AndroidBuild.sh
+++ b/dists/androidsdl/scummvm/AndroidBuild.sh
@@ -13,6 +13,6 @@ ln -sf libglshim.a $LOCAL_PATH/../../../obj/local/$1/libGL.a
mkdir -p scummvm/bin-$1
if [ \! -f scummvm/bin-$1/config.mk ] ; then
- ../setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --disable-sdlnet --disable-libcurl --enable-vkeybd --enable-release --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. "
+ ../setEnvironment-$1.sh sh -c "cd scummvm/bin-$1 && env LIBS='-lflac -lvorbis -logg -lmad -lz -lgcc -ltheora -lpng -lfreetype -lfaad -lgnustl_static' ../configure --host=androidsdl-$1 --enable-zlib --enable-vorbis --enable-mad --enable-flac --enable-png --enable-theoradec --enable-sdlnet --enable-libcurl --enable-vkeybd --enable-release --enable-mt32emu --disable-readline --disable-nasm --disable-timidity --disable-fluidsynth --datadir=. "
fi
../setEnvironment-$1.sh make -C scummvm/bin-$1 && cp -f scummvm/bin-$1/scummvm libapplication-$1.so
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index edea7ea591..c6459ead46 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -176,8 +176,12 @@ Common::Error DirectorEngine::run() {
_nextMovie.frameI = -1;
}
+ debugC(1, kDebugEvents, "Starting playback of score '%s'", _currentScore->getMacName().c_str());
+
_currentScore->startLoop();
+ debugC(1, kDebugEvents, "Finished playback of score '%s'", _currentScore->getMacName().c_str());
+
// If a loop was requested, do it
if (!_nextMovie.movie.empty()) {
_lingo->restartLingo();
@@ -193,7 +197,7 @@ Common::Error DirectorEngine::run() {
}
_currentScore = new Score(this, mov);
- debug(0, "Score name %s", _currentScore->getMacName().c_str());
+ debug(0, "Switching to score '%s'", _currentScore->getMacName().c_str());
_nextMovie.movie.clear();
loop = true;
diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index 613e83c352..a4e3f58a59 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -111,8 +111,7 @@ void DirectorEngine::processEvents() {
warning("Keycode: %d", _keyCode);
}
- // TODO: is movie script correct? Can this be elsewhere?
- _lingo->processEvent(kEventKeyDown, kMovieScript, 0);
+ _lingo->processEvent(kEventKeyDown, kGlobalScript, 0);
}
}
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index f554f43cd8..85af1865b3 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -379,7 +379,7 @@ void Lingo::printSTUBWithArglist(const char *funcname, int nargs, const char *pr
s += ")";
- warning("%s: %s", prefix, s.c_str());
+ warning("%s %s", prefix, s.c_str());
}
void Lingo::convertVOIDtoString(int arg, int nargs) {
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 706f76777d..2a089ddcc5 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -318,6 +318,13 @@ void Lingo::processEvent(LEvent event, ScriptType st, int entityId) {
void Lingo::restartLingo() {
warning("STUB: restartLingo()");
+ for (int i = 0; i <= kMaxScriptType; i++) {
+ for (ScriptHash::iterator it = _scripts[i].begin(); it != _scripts[i].end(); ++it)
+ delete it->_value;
+
+ _scripts[i].clear();
+ }
+
// TODO
//
// reset the following:
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 1ba0ab4683..ea3ce9be8c 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -621,6 +621,9 @@ void Score::dumpScript(const char *script, ScriptType type, uint16 id) {
case kCastScript:
typeName = "cast";
break;
+ case kGlobalScript:
+ typeName = "global";
+ break;
}
sprintf(buf, "./dumps/%s-%s-%d.txt", _macName.c_str(), typeName.c_str(), id);
diff --git a/engines/director/score.h b/engines/director/score.h
index 3e7aa62c4f..346a84ce63 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -48,8 +48,9 @@ enum ScriptType {
kSpriteScript = 1,
kFrameScript = 2,
kCastScript = 3,
+ kGlobalScript = 4,
kNoneScript = -1,
- kMaxScriptType = 3
+ kMaxScriptType = 4
};
const char *scriptType2str(ScriptType scr);
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index aaa2a99671..325263d7f2 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -457,6 +457,7 @@ MODULE_OBJS := \
star_control/star_field.o \
star_control/star_points1.o \
star_control/star_points2.o \
+ star_control/star_ref.o \
star_control/star_view.o \
star_control/surface_area.o \
star_control/surface_fader_base.o \
diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp
index a32263a926..bce8d7ca14 100644
--- a/engines/titanic/star_control/base_star.cpp
+++ b/engines/titanic/star_control/base_star.cpp
@@ -22,6 +22,7 @@
#include "titanic/star_control/base_star.h"
#include "titanic/star_control/star_control_sub12.h"
+#include "titanic/star_control/star_ref.h"
#include "titanic/titanic.h"
namespace Titanic {
@@ -44,6 +45,15 @@ void CBaseStarEntry::load(Common::SeekableReadStream &s) {
_data[idx] = s.readUint32LE();
}
+bool CBaseStarEntry::operator==(const CBaseStarEntry &s) const {
+ return _field0 == s._field0 && _field1 == s._field1
+ && _field2 == s._field2 && _field3 == s._field3
+ && _value == s._value && _position == s._position
+ && _data[0] == s._data[0] && _data[1] == s._data[1]
+ && _data[2] == s._data[2] && _data[3] == s._data[3]
+ && _data[4] == s._data[4];
+}
+
/*------------------------------------------------------------------------*/
CBaseStar::CBaseStar() : _minVal(0.0), _maxVal(1.0), _range(0.0),
@@ -191,8 +201,9 @@ void CBaseStar::draw4(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStar
// TODO
}
-void CBaseStar::baseFn1(int v1, int v2, int v3, int v4) {
- // TODO
+void CBaseStar::baseFn1(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12,
+ const Common::Point &pt) {
+ CStarRef1 ref(this, pt);
}
int CBaseStar::baseFn2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12) {
diff --git a/engines/titanic/star_control/base_star.h b/engines/titanic/star_control/base_star.h
index 1450b25bb3..1335980c20 100644
--- a/engines/titanic/star_control/base_star.h
+++ b/engines/titanic/star_control/base_star.h
@@ -44,7 +44,20 @@ struct CBaseStarEntry {
uint _data[5];
CBaseStarEntry();
+
+ /**
+ * Loads the data for a star
+ */
void load(Common::SeekableReadStream &s);
+
+ bool operator==(const CBaseStarEntry &s) const;
+};
+
+struct CStarPosition {
+ Common::Point _position;
+ int _index1;
+ int _index2;
+ CStarPosition() : _index1(0), _index2(0) {}
};
class CBaseStar {
@@ -76,9 +89,6 @@ protected:
* Reset the data for an entry
*/
void resetEntry(CBaseStarEntry &entry);
-
- void baseFn1(int v1, int v2, int v3, int v4);
- int baseFn2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12);
public:
CBaseStar();
virtual ~CBaseStar() {}
@@ -94,7 +104,7 @@ public:
* Selects a star
*/
virtual bool selectStar(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12,
- int flags, const Common::Point &pt) { return false; }
+ const Common::Point &pt, int flags = 0) { return false; }
/**
* Adds a new star, or removes one if already present at the given co-ordinates
@@ -126,6 +136,11 @@ public:
* Get a pointer to a data entry
*/
const CBaseStarEntry *getDataPtr(int index) const;
+
+ void baseFn1(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12,
+ const Common::Point &pt);
+
+ int baseFn2(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12);
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_control_sub2.cpp b/engines/titanic/star_control/star_control_sub2.cpp
index cf7190fb34..16830c2dc2 100644
--- a/engines/titanic/star_control/star_control_sub2.cpp
+++ b/engines/titanic/star_control/star_control_sub2.cpp
@@ -31,7 +31,7 @@ bool CStarControlSub2::loadYale(int v1) {
}
bool CStarControlSub2::selectStar(CSurfaceArea *surfaceArea,
- CStarControlSub12 *sub12, int flags, const Common::Point &pt) {
+ CStarControlSub12 *sub12, const Common::Point &pt, int flags) {
// TODO
return true;
}
diff --git a/engines/titanic/star_control/star_control_sub2.h b/engines/titanic/star_control/star_control_sub2.h
index 9de2da4583..d4d343c4c4 100644
--- a/engines/titanic/star_control/star_control_sub2.h
+++ b/engines/titanic/star_control/star_control_sub2.h
@@ -37,7 +37,7 @@ public:
* Selects a star
*/
virtual bool selectStar(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12,
- int flags, const Common::Point &pt);
+ const Common::Point &pt, int flags = 0);
virtual bool loadStar();
diff --git a/engines/titanic/star_control/star_control_sub7.cpp b/engines/titanic/star_control/star_control_sub7.cpp
index 4b694810ad..c2c9030700 100644
--- a/engines/titanic/star_control/star_control_sub7.cpp
+++ b/engines/titanic/star_control/star_control_sub7.cpp
@@ -32,7 +32,7 @@ bool CStarControlSub7::addStar(const CBaseStarEntry *entry) {
// iterate through the existing stars
for (uint idx = 0; idx < _data.size(); ++idx) {
CBaseStarEntry &star = _data[idx];
- if (star._position == entry->_position) {
+ if (star == *entry) {
// Found a matching star at the exact same position, so remove it instead
_data.remove_at(idx);
return true;
diff --git a/engines/titanic/star_control/star_control_sub8.cpp b/engines/titanic/star_control/star_control_sub8.cpp
index 50c90d2bc1..e82ae1d141 100644
--- a/engines/titanic/star_control/star_control_sub8.cpp
+++ b/engines/titanic/star_control/star_control_sub8.cpp
@@ -24,18 +24,11 @@
#include "titanic/star_control/star_control_sub7.h"
#include "titanic/star_control/star_control_sub12.h"
#include "titanic/star_control/star_field.h"
+#include "titanic/star_control/star_ref.h"
namespace Titanic {
-CStarControlSub8::CStarControlSub8() : _field8(-1), _fieldC(-1) {
-#if 0
- _field4(0), _field8(-1)
-#endif
-}
-
-bool MouseButtonDown(const Common::Point &pt) {
- // TODO
- return true;
+CStarControlSub8::CStarControlSub8() : _field8(-1), _entryIndex(-1) {
}
int CStarControlSub8::findStar(const Common::Point &pt) {
@@ -48,8 +41,21 @@ void CStarControlSub8::selectStar(int index, CVideoSurface *surface,
// TODO
}
-void CStarControlSub8::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarControlSub12 *sub12) {
+bool CStarControlSub8::fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarControlSub12 *sub12) {
+ int count = starField->baseFn2(surfaceArea, sub12);
+
+ if (count > 0) {
+ allocate(count);
+ CStarRef2 starRef(starField, &_positions);
+ starRef.process(surfaceArea, sub12);
+ return true;
+ } else {
+ clear();
+ return false;
+ }
+
// TODO
+ return true;
}
void CStarControlSub8::fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) {
@@ -62,14 +68,62 @@ void CStarControlSub8::fn3() {
}
FPoint CStarControlSub8::getPosition() const {
- return (_fieldC >= 0 && _fieldC <= 2) ? _data[_fieldC]._position : FPoint();
+ return (_entryIndex >= 0 && _entryIndex <= 2) ?
+ FPoint(_entries[_entryIndex].left, _entries[_entryIndex].top) : FPoint();
}
void CStarControlSub8::draw(CSurfaceArea *surfaceArea) {
- // TODO
+ if (!_positions.empty()) {
+ uint oldPixel = surfaceArea->_pixel;
+ surfaceArea->_pixel = 0xFF;
+ surfaceArea->setColorFromPixel();
+ SurfaceAreaMode oldMode = surfaceArea->setMode(SA_NONE);
+
+ // TODO: Loop
+ /*
+ for (int idx = 0; idx < _entryIndex; ++idx) {
+ Common::Rect &r = _entries[idx];
+
+ }
+ */
+
+ surfaceArea->_pixel = oldPixel;
+ surfaceArea->setMode(oldMode);
+ }
+}
+
+void CStarControlSub8::allocate(int count) {
+ if (!_positions.empty()) {
+ if ((int)_positions.size() == count)
+ return;
+
+ clear();
+ }
+
+ _positions.resize(count);
}
void CStarControlSub8::clear() {
+ _positions.clear();
+ _field8 = _entryIndex = -1;
+}
+
+int CStarControlSub8::indexOf(const Common::Point &pt) const {
+ Common::Rect r(pt.x - 2, pt.y - 2, pt.x + 2, pt.y + 2);
+
+ for (int idx = 0; idx < (int)_positions.size(); ++idx) {
+ if (r.contains(_positions[idx]._position))
+ return idx;
+ }
+
+ return -1;
+}
+
+void CStarControlSub8::fn4(int index, CSurfaceArea *surfaceArea) {
+ // TODO
+}
+
+void CStarControlSub8::fn5(int index, CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7) {
// TODO
}
diff --git a/engines/titanic/star_control/star_control_sub8.h b/engines/titanic/star_control/star_control_sub8.h
index f7f8ba4fb5..1c0731f824 100644
--- a/engines/titanic/star_control/star_control_sub8.h
+++ b/engines/titanic/star_control/star_control_sub8.h
@@ -23,6 +23,9 @@
#ifndef TITANIC_STAR_CONTROL_SUB8_H
#define TITANIC_STAR_CONTROL_SUB8_H
+#include "common/array.h"
+#include "common/rect.h"
+#include "titanic/star_control/base_star.h"
#include "titanic/star_control/surface_area.h"
#include "titanic/star_control/fpoint.h"
#include "titanic/support/simple_file.h"
@@ -35,19 +38,20 @@ class CStarControlSub7;
class CStarControlSub12;
class CStarControlSub8 {
- struct StructEntry {
- FPoint _position;
- int _field8;
- int _fieldC;
-
- StructEntry() : _field8(0), _fieldC(0) {}
- };
private:
-#if 0
- int _field0;
- int _field4;
-#endif
- StructEntry _data[3];
+ Common::Array<CStarPosition> _positions;
+ int _entryIndex;
+ Common::Rect _entries[3];
+private:
+ /**
+ * Allocates space in the _rects array
+ */
+ void allocate(int count);
+
+ /**
+ * Clears any current data
+ */
+ void clear();
public:
int _field8;
int _fieldC;
@@ -72,12 +76,18 @@ public:
void draw(CSurfaceArea *surfaceArea);
- void fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarControlSub12 *sub12);
+ bool fn1(CStarField *starField, CSurfaceArea *surfaceArea, CStarControlSub12 *sub12);
void fn2(CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7);
void fn3();
+ void fn4(int index, CSurfaceArea *surfaceArea);
+ void fn5(int index, CVideoSurface *surface, CStarField *starField, CStarControlSub7 *sub7);
+
FPoint getPosition() const;
- void clear();
+ /**
+ * Returns the index of an entry in the rects list a given point falls within
+ */
+ int indexOf(const Common::Point &pt) const;
};
} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_field.cpp b/engines/titanic/star_control/star_field.cpp
index 3a09be3e8a..07c5ff4a73 100644
--- a/engines/titanic/star_control/star_field.cpp
+++ b/engines/titanic/star_control/star_field.cpp
@@ -230,7 +230,7 @@ bool CStarField::mouseButtonDown(CVideoSurface *surface, CStarControlSub12 *sub1
int flags, const Common::Point &pt) {
if (_mode == MODE_STARFIELD) {
CSurfaceArea surfaceArea(surface);
- return selectStar(&surfaceArea, sub12, 0, pt);
+ return selectStar(&surfaceArea, sub12, pt);
} else {
int starNum = _sub8.findStar(pt);
if (starNum >= 0) {
diff --git a/engines/titanic/star_control/star_ref.cpp b/engines/titanic/star_control/star_ref.cpp
new file mode 100644
index 0000000000..f583d72840
--- /dev/null
+++ b/engines/titanic/star_control/star_ref.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_ref.h"
+
+namespace Titanic {
+
+void CBaseStarRef::process(CSurfaceArea *surface, CStarControlSub12 *sub12) {
+ // TODO
+}
+
+/*------------------------------------------------------------------------*/
+
+bool CStarRef1::check(const Common::Point &pt, int index) {
+ Common::Rect r(pt.x - 2, pt.y - 2, pt.x + 2, pt.y + 2);
+ if (r.contains(_position)) {
+ _index = index;
+ return false;
+ } else {
+ return true;
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+bool CStarRef2::check(const Common::Point &pt, int index) {
+ if (_index >= (int)_positions->size())
+ return false;
+
+ CStarPosition &sp = (*_positions)[index];
+ sp._position = pt;
+ sp._index1 = sp._index2 = index;
+ return true;
+}
+
+/*------------------------------------------------------------------------*/
+
+bool CStarRef3::check(const Common::Point &pt, int index) {
+ ++_counter;
+ return true;
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/star_control/star_ref.h b/engines/titanic/star_control/star_ref.h
new file mode 100644
index 0000000000..48d8b32fa4
--- /dev/null
+++ b/engines/titanic/star_control/star_ref.h
@@ -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 "common/rect.h"
+#include "titanic/star_control/base_star.h"
+#include "titanic/star_control/star_control_sub12.h"
+#include "titanic/star_control/surface_area.h"
+
+#ifndef TITANIC_STAR_REF_H
+#define TITANIC_STAR_REF_H
+
+namespace Titanic {
+
+class CBaseStarRef {
+protected:
+ CBaseStar *_star;
+public:
+ CBaseStarRef(CBaseStar *star) : _star(star) {}
+ CBaseStarRef() : _star(nullptr) {}
+
+ void process(CSurfaceArea *surface, CStarControlSub12 *sub12);
+
+ virtual bool check(const Common::Point &pt, int index) { return false; }
+};
+
+class CStarRef1 : public CBaseStarRef {
+private:
+ Common::Point _position;
+ int _index;
+public:
+ CStarRef1(CBaseStar *star, const Common::Point &pt) :
+ CBaseStarRef(star), _index(-1) {}
+
+ virtual bool check(const Common::Point &pt, int index);
+};
+
+class CStarRef2 : public CBaseStarRef {
+private:
+ Common::Array<CStarPosition> *_positions;
+ int _index;
+public:
+ CStarRef2(CBaseStar *star, Common::Array<CStarPosition> *positions) :
+ CBaseStarRef(star), _positions(positions), _index(0) {}
+
+ virtual bool check(const Common::Point &pt, int index);
+};
+
+class CStarRef3 : public CBaseStarRef {
+private:
+ int _counter;
+public:
+ CStarRef3(CBaseStar *star) :CBaseStarRef(star), _counter(0) {}
+
+ virtual bool check(const Common::Point &pt, int index);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_STAR_REF_H */