Skip to content
Permalink
Browse files

TITANIC: Implementing CStarView methods

  • Loading branch information
dreammaster committed Mar 3, 2017
1 parent 51f2420 commit 64b970ef64992231f7cccf12b9c5e162c39b2d5f
@@ -30,6 +30,8 @@

namespace Titanic {

enum StarMode { MODE_STARFIELD = 0, MODE_PHOTO = 1 };

class CStarControlSub12;

struct CBaseStarEntry {
@@ -253,7 +253,7 @@ void CStarControl::doAction(StarControlAction action) {
break;

case STAR_19:
_view.petDestinationSet();
_view.starDestinationSet();
break;
}
}
@@ -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) {
@@ -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 @@ class CStarControlSub12 {
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);
@@ -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 {
@@ -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 @@ class CStarControlSub13 {

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();
@@ -32,8 +32,6 @@

namespace Titanic {

enum StarMode { MODE_STARFIELD = 0, MODE_PHOTO = 1 };

class CStarField : public CStarControlSub2 {
private:
CStarControlSub7 _sub7;
@@ -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,56 +234,84 @@ 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() {
// TODO
}

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)
@@ -47,16 +47,18 @@ class CStarView {
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 @@ class CStarView {
* Resets back to the origin position
*/
void resetPosition();
void petDestinationSet();

void fn2();
void fn3(bool fadeIn);

0 comments on commit 64b970e

Please sign in to comment.
You can’t perform that action at this time.