aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/star_control
diff options
context:
space:
mode:
authorPaul Gilbert2017-03-02 23:04:02 -0500
committerPaul Gilbert2017-03-02 23:04:02 -0500
commit64b970ef64992231f7cccf12b9c5e162c39b2d5f (patch)
tree2e594a81775d11dd24d9f9c28f6d5f4938d90907 /engines/titanic/star_control
parent51f2420001a1dd29c36c259dc608eb961b9275cb (diff)
downloadscummvm-rg350-64b970ef64992231f7cccf12b9c5e162c39b2d5f.tar.gz
scummvm-rg350-64b970ef64992231f7cccf12b9c5e162c39b2d5f.tar.bz2
scummvm-rg350-64b970ef64992231f7cccf12b9c5e162c39b2d5f.zip
TITANIC: Implementing CStarView methods
Diffstat (limited to 'engines/titanic/star_control')
-rw-r--r--engines/titanic/star_control/base_star.h2
-rw-r--r--engines/titanic/star_control/star_control.cpp2
-rw-r--r--engines/titanic/star_control/star_control_sub12.cpp4
-rw-r--r--engines/titanic/star_control/star_control_sub12.h3
-rw-r--r--engines/titanic/star_control/star_control_sub13.cpp4
-rw-r--r--engines/titanic/star_control/star_control_sub13.h3
-rw-r--r--engines/titanic/star_control/star_field.h2
-rw-r--r--engines/titanic/star_control/star_view.cpp99
-rw-r--r--engines/titanic/star_control/star_view.h9
9 files changed, 89 insertions, 39 deletions
diff --git a/engines/titanic/star_control/base_star.h b/engines/titanic/star_control/base_star.h
index c3e489976a..80f219c9ea 100644
--- a/engines/titanic/star_control/base_star.h
+++ b/engines/titanic/star_control/base_star.h
@@ -30,6 +30,8 @@
namespace Titanic {
+enum StarMode { MODE_STARFIELD = 0, MODE_PHOTO = 1 };
+
class CStarControlSub12;
struct CBaseStarEntry {
diff --git a/engines/titanic/star_control/star_control.cpp b/engines/titanic/star_control/star_control.cpp
index 66bb9fe833..6e27223f72 100644
--- a/engines/titanic/star_control/star_control.cpp
+++ b/engines/titanic/star_control/star_control.cpp
@@ -253,7 +253,7 @@ void CStarControl::doAction(StarControlAction action) {
break;
case STAR_19:
- _view.petDestinationSet();
+ _view.starDestinationSet();
break;
}
}
diff --git a/engines/titanic/star_control/star_control_sub12.cpp b/engines/titanic/star_control/star_control_sub12.cpp
index 34aed56a87..cd7400c577 100644
--- a/engines/titanic/star_control/star_control_sub12.cpp
+++ b/engines/titanic/star_control/star_control_sub12.cpp
@@ -105,9 +105,9 @@ void CStarControlSub12::proc11() {
_sub13.fn12();
}
-void CStarControlSub12::proc12(double v1, double v2) {
+void CStarControlSub12::proc12(StarMode mode, double v2) {
if (!isLocked())
- _sub13.fn13(v1, v2);
+ _sub13.fn13(mode, v2);
}
void CStarControlSub12::proc13(CStarControlSub13 *dest) {
diff --git a/engines/titanic/star_control/star_control_sub12.h b/engines/titanic/star_control/star_control_sub12.h
index 8f0a59da7f..2e53f10087 100644
--- a/engines/titanic/star_control/star_control_sub12.h
+++ b/engines/titanic/star_control/star_control_sub12.h
@@ -26,6 +26,7 @@
#include "titanic/support/simple_file.h"
#include "titanic/star_control/fmatrix.h"
#include "titanic/star_control/fpoint.h"
+#include "titanic/star_control/base_star.h"
#include "titanic/star_control/star_control_sub13.h"
#include "titanic/star_control/star_control_sub20.h"
#include "titanic/star_control/error_code.h"
@@ -75,7 +76,7 @@ public:
virtual void proc9(int v);
virtual void proc10(int v);
virtual void proc11();
- virtual void proc12(double v1, double v2);
+ virtual void proc12(StarMode mode, double v2);
virtual void proc13(CStarControlSub13 *dest);
virtual void proc14(int v);
virtual void proc15(CErrorCode *errorCode);
diff --git a/engines/titanic/star_control/star_control_sub13.cpp b/engines/titanic/star_control/star_control_sub13.cpp
index 7534c2c289..298425ee55 100644
--- a/engines/titanic/star_control/star_control_sub13.cpp
+++ b/engines/titanic/star_control/star_control_sub13.cpp
@@ -172,8 +172,8 @@ void CStarControlSub13::fn12() {
error("TODO: CStarControlSub13::fn12");
}
-void CStarControlSub13::fn13(double v1, double v2) {
- if (v1 == 0.0) {
+void CStarControlSub13::fn13(StarMode mode, double v2) {
+ if (mode == MODE_STARFIELD) {
_valArray[0] = v2;
_valArray[1] = -v2;
} else {
diff --git a/engines/titanic/star_control/star_control_sub13.h b/engines/titanic/star_control/star_control_sub13.h
index 2f0b479cec..75ae03b977 100644
--- a/engines/titanic/star_control/star_control_sub13.h
+++ b/engines/titanic/star_control/star_control_sub13.h
@@ -24,6 +24,7 @@
#define TITANIC_STAR_CONTROL_SUB13_H
#include "titanic/support/simple_file.h"
+#include "titanic/star_control/base_star.h"
#include "titanic/star_control/star_control_sub6.h"
#include "titanic/star_control/fmatrix.h"
@@ -88,7 +89,7 @@ public:
void fn11(const FVector &v);
void fn12();
- void fn13(double v1, double v2);
+ void fn13(StarMode mode, double v2);
void fn14(double v);
void fn15(FMatrix &matrix);
CStarControlSub6 getSub1();
diff --git a/engines/titanic/star_control/star_field.h b/engines/titanic/star_control/star_field.h
index dc82a88c43..2c7e562304 100644
--- a/engines/titanic/star_control/star_field.h
+++ b/engines/titanic/star_control/star_field.h
@@ -32,8 +32,6 @@
namespace Titanic {
-enum StarMode { MODE_STARFIELD = 0, MODE_PHOTO = 1 };
-
class CStarField : public CStarControlSub2 {
private:
CStarControlSub7 _sub7;
diff --git a/engines/titanic/star_control/star_view.cpp b/engines/titanic/star_control/star_view.cpp
index 855bca5837..d5026324f3 100644
--- a/engines/titanic/star_control/star_view.cpp
+++ b/engines/titanic/star_control/star_view.cpp
@@ -33,7 +33,7 @@ namespace Titanic {
CStarView::CStarView() : _sub12(nullptr, nullptr), _sub13((void *)nullptr),
_owner(nullptr), _starField(nullptr), _videoSurface(nullptr), _field118(0),
_videoSurface2(nullptr), _homePhotoMask(nullptr),
- _field218(0), _showingPhoto(false) {
+ _field218(false), _showingPhoto(false) {
CStar20Data data = { 0, 0, 100000.0, 0, 20.0, 1.0, 1.0, 1.0 };
_sub12.proc3(&data);
@@ -234,44 +234,65 @@ bool CStarView::KeyCharMsg(int key, CErrorCode *errorCode) {
}
bool CStarView::canSetStarDestination() const {
- // TODO
- return false;
+ return _sub12.is108();
}
void CStarView::starDestinationSet() {
- // TODO
-}
-
-void CStarView::petDestinationSet() {
- // TODO
+ _sub12.reset108();
}
void CStarView::resetPosition() {
// TODO
}
-void CStarView::fn1() {
- // TODO
+bool CStarView::fn1() {
+ if (_videoSurface) {
+ CErrorCode errorCode;
+ _sub12.proc15(&errorCode);
+
+ if (_fader._index < 0 || _fader._index >= _fader._count)
+ _starField->fn1(&errorCode);
+ else
+ errorCode.set();
+
+ return errorCode.get();
+ }
+
+ return false;
}
void CStarView::fn2() {
- // TODO
+ if (!_videoSurface) {
+ CScreenManager *scrManager = CScreenManager::setCurrent();
+ if (scrManager)
+ resizeSurface(scrManager, 600, 340, &_videoSurface);
+
+ if (_videoSurface) {
+ fn13();
+ fn19(200);
+ draw(scrManager);
+ }
+ }
}
void CStarView::fn3(bool fadeIn) {
- // TODO
+ _fader.reset();
+ _fader.setFadeIn(fadeIn);
}
void CStarView::fn4() {
- // TODO
+ FVector v1, v2;
+ randomizeVectors2(&v1, &v2);
+ _sub12.setPosition(v1);
+ _sub12.proc5(v2);
}
void CStarView::fn5() {
- // TODO
+ _starField->set1(!_starField->get1());
}
void CStarView::fn6() {
- // TODO
+ _starField->set2(!_starField->get2());
}
void CStarView::fn7() {
@@ -279,11 +300,18 @@ void CStarView::fn7() {
}
void CStarView::fn8() {
- // TODO
+ _sub12.proc18();
}
void CStarView::fn9() {
- // TODO
+ _field218 = !_field218;
+ if (_field218) {
+ _sub12.proc12(MODE_PHOTO, 30.0);
+ _sub12.proc12(MODE_STARFIELD, 28000.0);
+ } else {
+ _sub12.proc12(MODE_PHOTO, 0.0);
+ _sub12.proc12(MODE_STARFIELD, 0.0);
+ }
}
void CStarView::toggleMode() {
@@ -301,25 +329,29 @@ void CStarView::fn12() {
}
void CStarView::fn13() {
- // TODO
+ _field218 = true;
+ _sub12.proc12(MODE_PHOTO, 30.0);
+ _sub12.proc12(MODE_STARFIELD, 28000.0);
}
void CStarView::fn14() {
- // TODO
+ _field218 = false;
+ _sub12.proc12(MODE_PHOTO, 0.0);
+ _sub12.proc12(MODE_STARFIELD, 0.0);
}
void CStarView::setHasReference() {
FVector v1, v2;
- randomizeVectors(&v1, &v2);
+ randomizeVectors1(&v1, &v2);
_sub13.setPosition(v1);
_sub13.fn11(v2);
- _field218 = 0;
- _sub13.fn13(1, 0);
- _sub13.fn13(0, 0);
- _field118 = 1;
+ _field218 = false;
+ _sub13.fn13(MODE_PHOTO, 0.0);
+ _sub13.fn13(MODE_STARFIELD, 0.0);
+ _field118 = true;
reset();
- _field218 = 1;
+ _field218 = true;
}
void CStarView::fn16() {
@@ -353,7 +385,11 @@ void CStarView::fn18(CStarControlSub12 *sub12) {
}
}
-void CStarView::randomizeVectors(FVector *v1, FVector *v2) {
+void CStarView::fn19(int v) {
+ // TODO
+}
+
+void CStarView::randomizeVectors1(FVector *v1, FVector *v2) {
v1->_x = g_vm->getRandomFloat() * -4096.0 - 3072.0;
v1->_y = g_vm->getRandomFloat() * -4096.0 - 3072.0;
v1->_z = g_vm->getRandomFloat() * -4096.0 - 3072.0;
@@ -369,6 +405,17 @@ void CStarView::randomizeVectors(FVector *v1, FVector *v2) {
v2->fn3();
}
+void CStarView::randomizeVectors2(FVector *v1, FVector *v2) {
+ v1->_x = 3072.0 - g_vm->getRandomFloat() * -4096.0;
+ v1->_y = 3072.0 - g_vm->getRandomFloat() * -4096.0;
+ v1->_z = 3072.0 - g_vm->getRandomFloat() * -4096.0;
+
+ v2->_x = -v1->_x;
+ v2->_y = -v1->_y;
+ v2->_z = -v1->_z;
+ v2->fn3();
+}
+
void CStarView::resizeSurface(CScreenManager *scrManager, int width, int height,
CVideoSurface **surface) {
if (!surface)
diff --git a/engines/titanic/star_control/star_view.h b/engines/titanic/star_control/star_view.h
index ee78ca764a..bb3310d009 100644
--- a/engines/titanic/star_control/star_view.h
+++ b/engines/titanic/star_control/star_view.h
@@ -47,16 +47,18 @@ private:
CSurfaceFader _fader;
CVideoSurface *_videoSurface2;
CGameObject *_homePhotoMask;
- int _field218;
+ bool _field218;
bool _showingPhoto;
#if 0
int _field210;
#endif
private:
- void fn1();
+ bool fn1();
void fn18(CStarControlSub12 *sub12);
+ void fn19(int v);
- void randomizeVectors(FVector *v1, FVector *v2);
+ void randomizeVectors1(FVector *v1, FVector *v2);
+ void randomizeVectors2(FVector *v1, FVector *v2);
/**
* Handles resizing the surface
@@ -117,7 +119,6 @@ public:
* Resets back to the origin position
*/
void resetPosition();
- void petDestinationSet();
void fn2();
void fn3(bool fadeIn);