mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-09 12:22:51 +00:00
TITANIC: Fix some calculation errors when locking markers
This commit is contained in:
parent
03ba3e41f9
commit
10ada8b23b
@ -262,7 +262,7 @@ bool CStarControl::isSolved() const {
|
||||
|
||||
void CStarControl::forceSolved() {
|
||||
while (!_starField.isSolved())
|
||||
_starField.fn7();
|
||||
_starField.incMatches();
|
||||
}
|
||||
|
||||
bool CStarControl::canSetStarDestination() const {
|
||||
|
@ -203,11 +203,13 @@ double CStarField::fn5(CSurfaceArea *surfaceArea, CStarCamera *camera,
|
||||
double incr = (v1._x - pt._x) * (v1._x - pt._x);
|
||||
if (incr > 3600.0)
|
||||
return -1.0;
|
||||
if ((v1._y - pt._y) * (v1._y - pt._y) + incr > 3600.0)
|
||||
|
||||
incr += (v1._y - pt._y) * (v1._y - pt._y);
|
||||
if (incr > 3600.0)
|
||||
return -1.0;
|
||||
|
||||
_closeToMarker = true;
|
||||
return v1._y - pt._y;
|
||||
return incr;
|
||||
}
|
||||
|
||||
void CStarField::fn6(CVideoSurface *surface, CStarCamera *camera) {
|
||||
@ -215,7 +217,7 @@ void CStarField::fn6(CVideoSurface *surface, CStarCamera *camera) {
|
||||
_crosshairs.fn1(this, &surfaceArea, camera);
|
||||
}
|
||||
|
||||
void CStarField::fn7() {
|
||||
void CStarField::incMatches() {
|
||||
_crosshairs.incMatches();
|
||||
setSolved();
|
||||
}
|
||||
|
@ -130,7 +130,12 @@ public:
|
||||
double fn5(CSurfaceArea *surfaceArea, CStarCamera *camera,
|
||||
FVector &v1, FVector &v2, FVector &v3);
|
||||
void fn6(CVideoSurface *surface, CStarCamera *camera);
|
||||
void fn7();
|
||||
|
||||
/**
|
||||
* Increments the number of matched markers
|
||||
*/
|
||||
void incMatches();
|
||||
|
||||
void fn8(CVideoSurface *surface);
|
||||
void fn9() { _starCloseup.fn1(); }
|
||||
|
||||
|
@ -382,26 +382,26 @@ void CStarView::lockStar() {
|
||||
double val = _starField->fn5(&surfaceArea, &_camera, v1, v2, v3);
|
||||
|
||||
if (val > -1.0) {
|
||||
v1 += surfaceArea._centroid;
|
||||
v3 += surfaceArea._centroid;
|
||||
v1 -= surfaceArea._centroid;
|
||||
v3 -= surfaceArea._centroid;
|
||||
|
||||
switch (_starField->getMatchedIndex()) {
|
||||
case -1:
|
||||
// First star match
|
||||
_camera.fn2(v1, v2, v3);
|
||||
_starField->fn7();
|
||||
_starField->incMatches();
|
||||
break;
|
||||
|
||||
case 0:
|
||||
// Second star match
|
||||
_camera.fn3(&_photoViewport, v2);
|
||||
_starField->fn7();
|
||||
_starField->incMatches();
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// Third star match
|
||||
_camera.fn1(&_photoViewport, v2);
|
||||
_starField->fn7();
|
||||
_starField->incMatches();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user