From 46f4047a1d290202b797cdf2a1090e64adb21a61 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 7 Jun 2017 22:00:22 -0400 Subject: TITANIC: Renamings for camera mover classes --- engines/titanic/module.mk | 4 +- .../titanic/star_control/marked_camera_mover.cpp | 60 +++++++++++++++++ engines/titanic/star_control/marked_camera_mover.h | 49 ++++++++++++++ engines/titanic/star_control/star_camera.cpp | 8 +-- .../titanic/star_control/star_control_sub21.cpp | 76 ---------------------- engines/titanic/star_control/star_control_sub21.h | 53 --------------- .../titanic/star_control/star_control_sub22.cpp | 60 ----------------- engines/titanic/star_control/star_control_sub22.h | 49 -------------- .../titanic/star_control/unmarked_camera_mover.cpp | 76 ++++++++++++++++++++++ .../titanic/star_control/unmarked_camera_mover.h | 53 +++++++++++++++ 10 files changed, 244 insertions(+), 244 deletions(-) create mode 100644 engines/titanic/star_control/marked_camera_mover.cpp create mode 100644 engines/titanic/star_control/marked_camera_mover.h delete mode 100644 engines/titanic/star_control/star_control_sub21.cpp delete mode 100644 engines/titanic/star_control/star_control_sub21.h delete mode 100644 engines/titanic/star_control/star_control_sub22.cpp delete mode 100644 engines/titanic/star_control/star_control_sub22.h create mode 100644 engines/titanic/star_control/unmarked_camera_mover.cpp create mode 100644 engines/titanic/star_control/unmarked_camera_mover.h diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk index d6c8396588..e3f4392d42 100644 --- a/engines/titanic/module.mk +++ b/engines/titanic/module.mk @@ -443,13 +443,12 @@ MODULE_OBJS := \ star_control/frect.o \ star_control/fvector.o \ star_control/marked_auto_mover.o \ + star_control/marked_camera_mover.o \ star_control/matrix_transform.o \ star_control/orientation_changer.o \ star_control/star_camera.o \ star_control/star_closeup.o \ star_control/star_control_sub2.o \ - star_control/star_control_sub21.o \ - star_control/star_control_sub22.o \ star_control/star_crosshairs.o \ star_control/star_field.o \ star_control/star_markers.o \ @@ -460,6 +459,7 @@ MODULE_OBJS := \ star_control/surface_area.o \ star_control/surface_fader.o \ star_control/unmarked_auto_mover.o \ + star_control/unmarked_camera_mover.o \ star_control/viewport.o \ support/avi_surface.o \ support/direct_draw.o \ diff --git a/engines/titanic/star_control/marked_camera_mover.cpp b/engines/titanic/star_control/marked_camera_mover.cpp new file mode 100644 index 0000000000..2e3fa8f448 --- /dev/null +++ b/engines/titanic/star_control/marked_camera_mover.cpp @@ -0,0 +1,60 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/star_control/marked_camera_mover.h" +#include "common/textconsole.h" + +namespace Titanic { + +CMarkedCameraMover::CMarkedCameraMover(const CNavigationInfo *src) : + CCameraMover(src) { +} + +void CMarkedCameraMover::proc8(const FVector &oldPos, const FVector &newPos, + const FMatrix &oldOrientation, const FMatrix &newOrientation) { + if (isLocked()) + decLockCount(); + + _autoMover.proc2(oldPos, newPos, oldOrientation, newOrientation); + incLockCount(); +} + +void CMarkedCameraMover::updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) { + if (_autoMover.isActive()) { + decLockCount(); + int val = _autoMover.proc5(errorCode, pos, orientation); + if (val == 1) + incLockCount(); + if (val == 2) { + stop(); + if (_starVector) + _starVector->apply(); + } + } else if (_speed != 0.0) { + pos._x += orientation._row3._x * _speed; + pos._y += orientation._row3._y * _speed; + pos._z += orientation._row3._z * _speed; + errorCode.set(); + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/marked_camera_mover.h b/engines/titanic/star_control/marked_camera_mover.h new file mode 100644 index 0000000000..7706db1098 --- /dev/null +++ b/engines/titanic/star_control/marked_camera_mover.h @@ -0,0 +1,49 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_MARKED_CAMERA_MOVER_H +#define TITANIC_MARKED_CAMERA_MOVER_H + +#include "titanic/star_control/camera_mover.h" +#include "titanic/star_control/marked_auto_mover.h" + +namespace Titanic { + +class CMarkedCameraMover : public CCameraMover { +private: + CMarkedAutoMover _autoMover; +public: + CMarkedCameraMover(const CNavigationInfo *src); + virtual ~CMarkedCameraMover() {} + + virtual void proc8(const FVector &oldPos, const FVector &newPos, + const FMatrix &oldOrientation, const FMatrix &newOrientation); + + /** + * Update the passed position and orientation matrix + */ + virtual void updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_MARKED_CAMERA_MOVER_H */ diff --git a/engines/titanic/star_control/star_camera.cpp b/engines/titanic/star_control/star_camera.cpp index 93aee9e1cc..c715daf356 100644 --- a/engines/titanic/star_control/star_camera.cpp +++ b/engines/titanic/star_control/star_camera.cpp @@ -21,8 +21,8 @@ */ #include "titanic/star_control/star_camera.h" -#include "titanic/star_control/star_control_sub21.h" -#include "titanic/star_control/star_control_sub22.h" +#include "titanic/star_control/unmarked_camera_mover.h" +#include "titanic/star_control/marked_camera_mover.h" #include "titanic/star_control/dmatrix.h" #include "titanic/star_control/fmatrix.h" #include "titanic/titanic.h" @@ -389,13 +389,13 @@ bool CStarCamera::setupHandler(const CNavigationInfo *src) { switch (_matrixRow) { case -1: - mover = new CStarControlSub21(src); + mover = new CUnmarkedCameraMover(src); break; case 0: case 1: case 2: - mover = new CStarControlSub22(src); + mover = new CMarkedCameraMover(src); break; default: diff --git a/engines/titanic/star_control/star_control_sub21.cpp b/engines/titanic/star_control/star_control_sub21.cpp deleted file mode 100644 index 4b7a6c396b..0000000000 --- a/engines/titanic/star_control/star_control_sub21.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "titanic/star_control/star_control_sub21.h" -#include "titanic/star_control/dmatrix.h" -#include "titanic/star_control/dvector.h" -#include "titanic/titanic.h" -#include "common/textconsole.h" - -namespace Titanic { - -CStarControlSub21::CStarControlSub21(const CNavigationInfo *src) : - CCameraMover(src) { -} - -void CStarControlSub21::moveTo(const FVector &srcV, const FVector &destV, const FMatrix &orientation) { - if (isLocked()) - decLockCount(); - - debugC(DEBUG_BASIC, kDebugStarfield, "Starfield move %s to %s", srcV.toString().c_str(), - destV.toString().c_str()); - _autoMover.setPath(srcV, destV, orientation); -} - -void CStarControlSub21::proc10(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m) { - if (isLocked()) - decLockCount(); - - DVector vector1 = v1; - DVector vector2 = v2; - DMatrix matrix1 = vector2.fn4(vector1); - DMatrix matrix2 = matrix1.fn4(m); - - _autoMover.proc3(m, matrix2); - incLockCount(); -} - -void CStarControlSub21::updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) { - if (_autoMover.isActive()) { - decLockCount(); - int val = _autoMover.proc5(errorCode, pos, orientation); - if (val == 1) - incLockCount(); - if (val == 2) { - stop(); - if (_starVector) - _starVector->apply(); - } - } else if (_speed != 0.0) { - pos._x += orientation._row3._x * _speed; - pos._y += orientation._row3._y * _speed; - pos._z += orientation._row3._z * _speed; - errorCode.set(); - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub21.h b/engines/titanic/star_control/star_control_sub21.h deleted file mode 100644 index bd876e5631..0000000000 --- a/engines/titanic/star_control/star_control_sub21.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef TITANIC_STAR_CONTROL_SUB21_H -#define TITANIC_STAR_CONTROL_SUB21_H - -#include "titanic/star_control/camera_mover.h" -#include "titanic/star_control/unmarked_auto_mover.h" - -namespace Titanic { - -class CStarControlSub21 : public CCameraMover { -private: - CUnmarkedAutoMover _autoMover; -public: - CStarControlSub21(const CNavigationInfo *src); - virtual ~CStarControlSub21() {} - - /** - * Start a movement to a given specified destination - */ - virtual void moveTo(const FVector &srcV, const FVector &destV, const FMatrix &orientation); - - virtual void proc10(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m); - - /** - * Update the passed position and orientation matrix - */ - virtual void updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB21_H */ diff --git a/engines/titanic/star_control/star_control_sub22.cpp b/engines/titanic/star_control/star_control_sub22.cpp deleted file mode 100644 index f26fbb59a8..0000000000 --- a/engines/titanic/star_control/star_control_sub22.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "titanic/star_control/star_control_sub22.h" -#include "common/textconsole.h" - -namespace Titanic { - -CStarControlSub22::CStarControlSub22(const CNavigationInfo *src) : - CCameraMover(src) { -} - -void CStarControlSub22::proc8(const FVector &oldPos, const FVector &newPos, - const FMatrix &oldOrientation, const FMatrix &newOrientation) { - if (isLocked()) - decLockCount(); - - _autoMover.proc2(oldPos, newPos, oldOrientation, newOrientation); - incLockCount(); -} - -void CStarControlSub22::updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) { - if (_autoMover.isActive()) { - decLockCount(); - int val = _autoMover.proc5(errorCode, pos, orientation); - if (val == 1) - incLockCount(); - if (val == 2) { - stop(); - if (_starVector) - _starVector->apply(); - } - } else if (_speed != 0.0) { - pos._x += orientation._row3._x * _speed; - pos._y += orientation._row3._y * _speed; - pos._z += orientation._row3._z * _speed; - errorCode.set(); - } -} - -} // End of namespace Titanic diff --git a/engines/titanic/star_control/star_control_sub22.h b/engines/titanic/star_control/star_control_sub22.h deleted file mode 100644 index 91b9c4052b..0000000000 --- a/engines/titanic/star_control/star_control_sub22.h +++ /dev/null @@ -1,49 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef TITANIC_STAR_CONTROL_SUB22_H -#define TITANIC_STAR_CONTROL_SUB22_H - -#include "titanic/star_control/camera_mover.h" -#include "titanic/star_control/marked_auto_mover.h" - -namespace Titanic { - -class CStarControlSub22 : public CCameraMover { -private: - CMarkedAutoMover _autoMover; -public: - CStarControlSub22(const CNavigationInfo *src); - virtual ~CStarControlSub22() {} - - virtual void proc8(const FVector &oldPos, const FVector &newPos, - const FMatrix &oldOrientation, const FMatrix &newOrientation); - - /** - * Update the passed position and orientation matrix - */ - virtual void updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation); -}; - -} // End of namespace Titanic - -#endif /* TITANIC_STAR_CONTROL_SUB22_H */ diff --git a/engines/titanic/star_control/unmarked_camera_mover.cpp b/engines/titanic/star_control/unmarked_camera_mover.cpp new file mode 100644 index 0000000000..bafab7b6a8 --- /dev/null +++ b/engines/titanic/star_control/unmarked_camera_mover.cpp @@ -0,0 +1,76 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "titanic/star_control/unmarked_camera_mover.h" +#include "titanic/star_control/dmatrix.h" +#include "titanic/star_control/dvector.h" +#include "titanic/titanic.h" +#include "common/textconsole.h" + +namespace Titanic { + +CUnmarkedCameraMover::CUnmarkedCameraMover(const CNavigationInfo *src) : + CCameraMover(src) { +} + +void CUnmarkedCameraMover::moveTo(const FVector &srcV, const FVector &destV, const FMatrix &orientation) { + if (isLocked()) + decLockCount(); + + debugC(DEBUG_BASIC, kDebugStarfield, "Starfield move %s to %s", srcV.toString().c_str(), + destV.toString().c_str()); + _autoMover.setPath(srcV, destV, orientation); +} + +void CUnmarkedCameraMover::proc10(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m) { + if (isLocked()) + decLockCount(); + + DVector vector1 = v1; + DVector vector2 = v2; + DMatrix matrix1 = vector2.fn4(vector1); + DMatrix matrix2 = matrix1.fn4(m); + + _autoMover.proc3(m, matrix2); + incLockCount(); +} + +void CUnmarkedCameraMover::updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation) { + if (_autoMover.isActive()) { + decLockCount(); + int val = _autoMover.proc5(errorCode, pos, orientation); + if (val == 1) + incLockCount(); + if (val == 2) { + stop(); + if (_starVector) + _starVector->apply(); + } + } else if (_speed != 0.0) { + pos._x += orientation._row3._x * _speed; + pos._y += orientation._row3._y * _speed; + pos._z += orientation._row3._z * _speed; + errorCode.set(); + } +} + +} // End of namespace Titanic diff --git a/engines/titanic/star_control/unmarked_camera_mover.h b/engines/titanic/star_control/unmarked_camera_mover.h new file mode 100644 index 0000000000..bcf904684f --- /dev/null +++ b/engines/titanic/star_control/unmarked_camera_mover.h @@ -0,0 +1,53 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef TITANIC_UNMARKED_CAMERA_MOVER_H +#define TITANIC_UNMARKED_CAMERA_MOVER_H + +#include "titanic/star_control/camera_mover.h" +#include "titanic/star_control/unmarked_auto_mover.h" + +namespace Titanic { + +class CUnmarkedCameraMover : public CCameraMover { +private: + CUnmarkedAutoMover _autoMover; +public: + CUnmarkedCameraMover(const CNavigationInfo *src); + virtual ~CUnmarkedCameraMover() {} + + /** + * Start a movement to a given specified destination + */ + virtual void moveTo(const FVector &srcV, const FVector &destV, const FMatrix &orientation); + + virtual void proc10(const FVector &v1, const FVector &v2, const FVector &v3, const FMatrix &m); + + /** + * Update the passed position and orientation matrix + */ + virtual void updatePosition(CErrorCode &errorCode, FVector &pos, FMatrix &orientation); +}; + +} // End of namespace Titanic + +#endif /* TITANIC_UNMARKED_CAMERA_MOVER_H */ -- cgit v1.2.3