aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/titanic/module.mk2
-rw-r--r--engines/titanic/star_control/base_star.cpp4
-rw-r--r--engines/titanic/star_control/base_star.h4
-rw-r--r--engines/titanic/star_control/frange.cpp (renamed from engines/titanic/star_control/star_control_sub4.cpp)8
-rw-r--r--engines/titanic/star_control/frange.h (renamed from engines/titanic/star_control/star_control_sub4.h)20
5 files changed, 22 insertions, 16 deletions
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index 325263d7f2..cdb3a64b3c 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -436,10 +436,10 @@ MODULE_OBJS := \
star_control/dvector.o \
star_control/fmatrix.o \
star_control/fpoint.o \
+ star_control/frange.o \
star_control/frect.o \
star_control/fvector.o \
star_control/star_control_sub2.o \
- star_control/star_control_sub4.o \
star_control/star_control_sub5.o \
star_control/star_control_sub6.o \
star_control/star_control_sub7.o \
diff --git a/engines/titanic/star_control/base_star.cpp b/engines/titanic/star_control/base_star.cpp
index 97ed683bbd..ffe5fd05b4 100644
--- a/engines/titanic/star_control/base_star.cpp
+++ b/engines/titanic/star_control/base_star.cpp
@@ -67,11 +67,11 @@ void CBaseStar::clear() {
void CBaseStar::initialize() {
_minVal = 9.9999998e10;
_maxVal = -9.9999998e10;
- _sub4.initialize();
+ _minMax.reset();
for (uint idx = 0; idx < _data.size(); ++idx) {
const CBaseStarEntry *entry = getDataPtr(idx);
- _sub4.checkEntry(entry->_position);
+ _minMax.expand(entry->_position);
if (entry->_value < _minVal)
_minVal = entry->_value;
diff --git a/engines/titanic/star_control/base_star.h b/engines/titanic/star_control/base_star.h
index 57be804652..1c75efd26b 100644
--- a/engines/titanic/star_control/base_star.h
+++ b/engines/titanic/star_control/base_star.h
@@ -24,7 +24,7 @@
#define TITANIC_STAR_CONTROL_SUB3_H
#include "titanic/support/simple_file.h"
-#include "titanic/star_control/star_control_sub4.h"
+#include "titanic/star_control/frange.h"
#include "titanic/star_control/star_control_sub5.h"
#include "titanic/star_control/surface_area.h"
@@ -68,7 +68,7 @@ private:
void draw4(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5);
protected:
Common::Array<CBaseStarEntry> _data;
- CStarControlSub4 _sub4;
+ FRange _minMax;
double _minVal;
double _maxVal;
double _range;
diff --git a/engines/titanic/star_control/star_control_sub4.cpp b/engines/titanic/star_control/frange.cpp
index 6ce0795c25..e70976d6cd 100644
--- a/engines/titanic/star_control/star_control_sub4.cpp
+++ b/engines/titanic/star_control/frange.cpp
@@ -21,19 +21,19 @@
*/
#include "common/algorithm.h"
-#include "titanic/star_control/star_control_sub4.h"
+#include "titanic/star_control/frange.h"
namespace Titanic {
-CStarControlSub4::CStarControlSub4() {
+FRange::FRange() {
}
-void CStarControlSub4::initialize() {
+void FRange::reset() {
_min._x = _min._y = _min._z = 9.9999994e27;
_max._x = _max._y = _max._z = -9.9999994e27;
}
-void CStarControlSub4::checkEntry(const FVector &v) {
+void FRange::expand(const FVector &v) {
_min._x = MIN(_min._x, v._x);
_min._y = MIN(_min._y, v._y);
_min._z = MIN(_min._z, v._z);
diff --git a/engines/titanic/star_control/star_control_sub4.h b/engines/titanic/star_control/frange.h
index 43c8ab5f79..f36aa2c538 100644
--- a/engines/titanic/star_control/star_control_sub4.h
+++ b/engines/titanic/star_control/frange.h
@@ -20,25 +20,31 @@
*
*/
-#ifndef TITANIC_STAR_CONTROL_SUB4_H
-#define TITANIC_STAR_CONTROL_SUB4_H
+#ifndef TITANIC_FRANGE_H
+#define TITANIC_FRANGE_H
#include "titanic/star_control/fvector.h"
namespace Titanic {
-class CStarControlSub4 {
+class FRange {
private:
FVector _min;
FVector _max;
public:
- CStarControlSub4();
+ FRange();
- void initialize();
+ /**
+ * Resets the minimum & maximum vector values
+ */
+ void reset();
- void checkEntry(const FVector &v);
+ /**
+ * Expands the minimum & maximum as necessary to encompass the passed vector/
+ */
+ void expand(const FVector &v);
};
} // End of namespace Titanic
-#endif /* TITANIC_STAR_CONTROL_SUB4_H */
+#endif /* TITANIC_FRANGE_H */