aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-03-18 16:05:43 -0400
committerPaul Gilbert2017-03-18 16:05:43 -0400
commit24f67bb1b05595e8568b78e2eea9d6843718adcb (patch)
treeec4d08067773f2d985ea63cbca2946731a0c52fb
parent6e33c2d5561dce43bff085cdd9416d2bcfd6d49f (diff)
downloadscummvm-rg350-24f67bb1b05595e8568b78e2eea9d6843718adcb.tar.gz
scummvm-rg350-24f67bb1b05595e8568b78e2eea9d6843718adcb.tar.bz2
scummvm-rg350-24f67bb1b05595e8568b78e2eea9d6843718adcb.zip
TITANIC: Finished CStarControlSub7 class
-rw-r--r--engines/titanic/star_control/star_control_sub7.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/engines/titanic/star_control/star_control_sub7.cpp b/engines/titanic/star_control/star_control_sub7.cpp
index c2c9030700..8386e7305f 100644
--- a/engines/titanic/star_control/star_control_sub7.cpp
+++ b/engines/titanic/star_control/star_control_sub7.cpp
@@ -21,11 +21,55 @@
*/
#include "titanic/star_control/star_control_sub7.h"
+#include "titanic/star_control/star_control_sub12.h"
namespace Titanic {
void CStarControlSub7::draw(CSurfaceArea *surfaceArea, CStarControlSub12 *sub12, CStarControlSub5 *sub5) {
- // TODO
+ if (_data.empty())
+ return;
+
+ CStarControlSub6 sub6 = sub12->proc23();
+ double threshold = sub12->proc25();
+ FPoint center((double)surfaceArea->_width * 0.5,
+ surfaceArea->_height * 0.5);
+ FVector newV;
+
+ uint savedPixel = surfaceArea->_pixel;
+ surfaceArea->_pixel = 0xffff;
+ surfaceArea->setColorFromPixel();
+
+ for (uint idx = 0; idx < _data.size(); ++idx) {
+ const CBaseStarEntry &star = _data[idx];
+
+ newV._x = sub6._row1._x * star._position._x + sub6._row3._x * star._position._z
+ + sub6._row2._x * star._position._y + sub6._vector._x;
+ newV._y = sub6._row1._y * star._position._x + sub6._row3._y * star._position._z
+ + sub6._row2._y * star._position._x + sub6._vector._y;
+ newV._z = sub6._row1._z * star._position._x + sub6._row3._z * star._position._z
+ + sub6._row2._z * star._position._y + sub6._vector._z;
+
+ if (newV._z > threshold) {
+ FVector vTemp;
+ sub12->proc28(2, newV, vTemp);
+
+ FRect r1(center._x + vTemp._x, center._y + vTemp._y,
+ center._x + vTemp._x + 4.0, center._y + vTemp._y + 4.0);
+ surfaceArea->fn1(r1);
+
+ FRect r2(r1.right, r1.bottom, r1.right + 4.0, r1.top);
+ surfaceArea->fn1(r2);
+
+ FRect r3(r2.right, r1.top, r1.right, r1.top - 4.0);
+ surfaceArea->fn1(r3);
+
+ FRect r4(r1.right, r1.top - 4.0, r1.left, r1.top);
+ surfaceArea->fn1(r4);
+ }
+ }
+
+ surfaceArea->_pixel = savedPixel;
+ surfaceArea->setColorFromPixel();
}
bool CStarControlSub7::addStar(const CBaseStarEntry *entry) {