Skip to content
Permalink
Browse files

TITANIC: Added starfield button down code

  • Loading branch information
dreammaster committed Mar 2, 2017
1 parent 4921897 commit e229e3c4a45e0b3a64e522d1dae18cfeee790f93
@@ -92,10 +92,15 @@ class CBaseStar {
virtual void draw(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5);

virtual bool loadYale(int v1) { return true; }
virtual bool proc4(int v1, int v2, int v3, int v4, int v5) { return false; }

/**
* Selects a star
*/
virtual bool selectStar(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12,
int flags, const Common::Point &pt) { return false; }

virtual bool proc5(int v1) { return false; }
virtual bool loadStar() { return false; }
virtual bool proc7(int v1, int v2) { return true; }

/**
* Load the item's data
@@ -30,7 +30,8 @@ bool CStarControlSub2::loadYale(int v1) {
return true;
}

bool CStarControlSub2::proc4(int v1, int v2, int v3, int v4, int v5) {
bool CStarControlSub2::selectStar(CSurfaceArea *surfaceArea,
CStarControlSub12 *sub12, int flags, const Common::Point &pt) {
// TODO
return true;
}
@@ -40,11 +41,6 @@ bool CStarControlSub2::loadStar() {
return true;
}

bool CStarControlSub2::proc7(int v1, int v2) {
// TODO
return true;
}

bool CStarControlSub2::setup() {
// TODO
return true;
@@ -32,9 +32,14 @@ class CStarControlSub2: public CBaseStar {
virtual ~CStarControlSub2() {}

virtual bool loadYale(int v1);
virtual bool proc4(int v1, int v2, int v3, int v4, int v5);

/**
* Selects a star
*/
virtual bool selectStar(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12,
int flags, const Common::Point &pt);

virtual bool loadStar();
virtual bool proc7(int v1, int v2);

/**
* Setup the control
@@ -21,6 +21,8 @@
*/

#include "titanic/star_control/star_control_sub8.h"
#include "titanic/star_control/star_control_sub7.h"
#include "titanic/star_control/star_field.h"

namespace Titanic {

@@ -30,4 +32,20 @@ CStarControlSub8::CStarControlSub8() : _field8(-1) {
#endif
}

bool MouseButtonDown(const Common::Point &pt) {
// TODO
return true;
}

int CStarControlSub8::findStar(const Common::Point &pt) {
// TODO
return -1;
}

void CStarControlSub8::selectStar(int index, CVideoSurface *surface,
CStarField *starField, CStarControlSub7 *sub7) {
// TODO
}


} // End of namespace Titanic
@@ -24,9 +24,13 @@
#define TITANIC_STAR_CONTROL_SUB8_H

#include "titanic/support/simple_file.h"
#include "titanic/support/video_surface.h"

namespace Titanic {

class CStarField;
class CStarControlSub7;

class CStarControlSub8 {
struct StructEntry {
int _field0;
@@ -55,6 +59,11 @@ class CStarControlSub8 {
* Save the data for the class to file
*/
void save(SimpleFile *file, int indent) {}

int findStar(const Common::Point &pt);

void selectStar(int starNum, CVideoSurface *surface, CStarField *starField,
CStarControlSub7 *sub7);
};

} // End of namespace Titanic
@@ -131,4 +131,20 @@ void CStarField::fn1(CErrorCode *errorCode) {
_sub5.proc3(errorCode);
}

bool CStarField::mouseButtonDown(CVideoSurface *surface, CStarControlSub12 *sub12,
int flags, const Common::Point &pt) {
if (!_val3) {
CSurfaceArea surfaceArea(surface);
return selectStar(&surfaceArea, sub12, 0, pt);
} else {
int starNum = _sub8.findStar(pt);
if (starNum >= 0) {
_sub8.selectStar(starNum, surface, this, &_sub7);
return true;
}

return false;
}
}

} // End of namespace Titanic
@@ -93,6 +93,12 @@ class CStarField : public CStarControlSub2 {
}

void fn1(CErrorCode *errorCode);

/**
* Called when the starfield is clicked
*/
bool mouseButtonDown(CVideoSurface *surface, CStarControlSub12 *sub12,
int flags, const Common::Point &pt);
};

} // End of namespace Titanic
@@ -105,8 +105,14 @@ void CStarView::draw(CScreenManager *screenManager) {
}
}

void CStarView::MouseButtonDownMsg(int unused, const Point &pt) {
// TODO
bool CStarView::MouseButtonDownMsg(int flags, const Point &pt) {
if (_starField) {
return _starField->mouseButtonDown(
_showingPhoto ? _videoSurface2 : _videoSurface,
&_sub12, flags, pt);
}

return false;
}

bool CStarView::MouseMoveMsg(int unused, const Point &pt) {
@@ -81,7 +81,7 @@ class CStarView {
/**
* Handles mouse down messages
*/
void MouseButtonDownMsg(int unused, const Point &pt);
bool MouseButtonDownMsg(int unused, const Point &pt);

/**
* Handles mouse move messages

0 comments on commit e229e3c

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