TITANIC: Added starfield button down code

This commit is contained in:
Paul Gilbert 2017-03-01 23:07:08 -05:00
parent 4921897013
commit e229e3c4a4
9 changed files with 74 additions and 13 deletions

View File

@ -92,10 +92,15 @@ public:
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

View File

@ -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;

View File

@ -32,9 +32,14 @@ public:
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

View File

@ -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

View File

@ -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 @@ public:
* 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

View File

@ -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

View File

@ -93,6 +93,12 @@ public:
}
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

View File

@ -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) {

View File

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