TITANIC: Renamings of orientation related variables and methods

This commit is contained in:
Paul Gilbert 2017-05-28 15:53:52 -04:00
parent 0be151d507
commit 38beceef7d
10 changed files with 62 additions and 43 deletions

View File

@ -93,7 +93,7 @@ void FMatrix::set(const DVector &row1, const DVector &row2, const DVector &row3)
_row3 = row3;
}
void FMatrix::fn1(const FVector &v) {
void FMatrix::set(const FVector &v) {
_row3 = v;
_row2 = _row3.fn1();

View File

@ -80,7 +80,11 @@ public:
*/
void set(const DVector &row1, const DVector &row2, const DVector &row3);
void fn1(const FVector &v);
/**
* Sets the data for the matrix from a vector
*/
void set(const FVector &v);
void fn2(const FMatrix &m);
void fn3(const FMatrix &m);

View File

@ -72,9 +72,9 @@ void CStarCamera::setPosition(const FVector &v) {
}
}
void CStarCamera::proc5(const FVector &v) {
void CStarCamera::setOrientation(const FVector &v) {
if (!isLocked())
_viewport.fn11(v);
_viewport.setOrientation(v);
}
void CStarCamera::proc6(int v) {

View File

@ -77,7 +77,11 @@ public:
*/
virtual void setPosition(const FVector &v);
virtual void proc5(const FVector &v);
/**
* Sets the camera orientation
*/
virtual void setOrientation(const FVector &v);
virtual void proc6(int v);
virtual void proc7(int v);
virtual void proc8(int v);

View File

@ -39,7 +39,7 @@ bool CStarControlSub2::loadYale(int v1) {
bool CStarControlSub2::selectStar(CSurfaceArea *surfaceArea,
CStarCamera *camera, const Common::Point &pt, void *handler) {
int index = findStar(surfaceArea, camera, pt);
int index = findStar(surfaceArea, camera, pt);
if (index == -1) {
return false;
} else if (!handler) {

View File

@ -64,7 +64,7 @@ void CStarControlSub24::setPath(const FVector &srcV, const FVector &destV, const
tempV1 = row3.addAndNormalize(tempV1);
FMatrix newOrient;
newOrient.fn1(tempV1);
newOrient.set(tempV1);
_orientationChanger.load(orientation, newOrient);
_transitionPercent = 0.0;
@ -114,7 +114,7 @@ int CStarControlSub24::proc5(CErrorCode &errorCode, FVector &pos, FMatrix &orien
v1 = v2.addAndNormalize(v1);
v1 = v2.addAndNormalize(v1);
orientation.fn1(v1);
orientation.set(v1);
v2 = v1;
}

View File

@ -45,7 +45,7 @@ void CStarView::load(SimpleFile *file, int param) {
_hasReference = file->readNumber();
if (_hasReference)
_sub13.load(file, 0);
_photoViewport.load(file, 0);
_field218 = file->readNumber();
_showingPhoto = file->readNumber();
@ -57,7 +57,7 @@ void CStarView::save(SimpleFile *file, int indent) {
file->writeNumberLine(_hasReference, indent);
if (_hasReference)
_sub13.save(file, indent);
_photoViewport.save(file, indent);
file->writeNumberLine(_field218, indent);
file->writeNumberLine(_showingPhoto, indent);
@ -70,7 +70,7 @@ void CStarView::setup(CScreenManager *screenManager, CStarField *starField, CSta
void CStarView::reset() {
if (_hasReference) {
CStarCamera camera(&_sub13);
CStarCamera camera(&_photoViewport);
fn18(&camera);
}
}
@ -284,7 +284,7 @@ void CStarView::fn4() {
FVector v1, v2;
randomizeVectors1(v1, v2);
_camera.setPosition(v1);
_camera.proc5(v2);
_camera.setOrientation(v2);
}
void CStarView::fn5() {
@ -298,22 +298,22 @@ void CStarView::fn6() {
void CStarView::fn7() {
const CBaseStarEntry *star = _starField->getRandomStar();
if (star) {
FVector v1, v2;
randomizeVectors1(v1, v2);
v2 += star->_position;
_camera.setPosition(v2);
_camera.proc5(v1);
FVector pos, orientation;
randomizeVectors1(pos, orientation);
pos += star->_position;
_camera.setPosition(pos);
_camera.setOrientation(orientation);
}
}
void CStarView::fn19(int index) {
const CBaseStarEntry *star = _starField->getStar(index);
if (star) {
FVector v1, v2;
randomizeVectors1(v1, v2);
v1 += star->_position;
_camera.setPosition(v1);
_camera.proc5(v2);
FVector pos, orientation;
randomizeVectors1(pos, orientation);
pos += star->_position;
_camera.setPosition(pos);
_camera.setOrientation(orientation);
}
}
@ -361,14 +361,14 @@ void CStarView::fn14() {
}
void CStarView::setHasReference() {
FVector v1, v2;
randomizeVectors2(v1, v2);
FVector pos, orientation;
randomizeVectors2(pos, orientation);
_sub13.setPosition(v1);
_sub13.fn11(v2);
_photoViewport.setPosition(pos);
_photoViewport.setOrientation(orientation);
_field218 = false;
_sub13.fn13(MODE_PHOTO, 0.0);
_sub13.fn13(MODE_STARFIELD, 0.0);
_photoViewport.fn13(MODE_PHOTO, 0.0);
_photoViewport.fn13(MODE_STARFIELD, 0.0);
_hasReference = true;
reset();
_field218 = true;
@ -391,12 +391,12 @@ void CStarView::fn16() {
break;
case 0:
_camera.fn3(&_sub13, v2);
_camera.fn3(&_photoViewport, v2);
_starField->fn7();
break;
case 1:
_camera.fn1(&_sub13, v2);
_camera.fn1(&_photoViewport, v2);
_starField->fn7();
break;
@ -438,7 +438,7 @@ void CStarView::fn18(CStarCamera *camera) {
}
}
void CStarView::randomizeVectors1(FVector &v1, FVector &v2) {
void CStarView::randomizeVectors1(FVector &pos, FVector &orientation) {
/* ***DEBUG***
v1._x = 3072.0 - g_vm->getRandomFloat() * -4096.0;
v1._y = 3072.0 - g_vm->getRandomFloat() * -4096.0;
@ -450,11 +450,11 @@ void CStarView::randomizeVectors1(FVector &v1, FVector &v2) {
v2.normalize();
*/
// Values temporarily hardcoded to match hacked values in original EXE
v1 = FVector((float)69481544.0, (float)69481544.0, (float)69481544.0);
v2 = FVector((float)-0.577350259, (float)-0.577350259, (float)-0.577350259);
pos = FVector((float)69481544.0, (float)69481544.0, (float)69481544.0);
orientation = FVector((float)-0.577350259, (float)-0.577350259, (float)-0.577350259);
}
void CStarView::randomizeVectors2(FVector &v1, FVector &v2) {
void CStarView::randomizeVectors2(FVector &pos, FVector &orientation) {
/* ****DEBUG***
v1._x = 3072.0 - g_vm->getRandomFloat() * -4096.0;
v1._y = 3072.0 - g_vm->getRandomFloat() * -4096.0;
@ -466,8 +466,8 @@ void CStarView::randomizeVectors2(FVector &v1, FVector &v2) {
v2.normalize();
*/
// Values temporarily hardcoded to match hacked values in original EXE
v1 = FVector((float)69481544.0, (float)69481544.0, (float)69481544.0);
v2 = FVector((float)0.624659300, (float)-0.468542814, (float)-0.624714553);
pos = FVector((float)69481544.0, (float)69481544.0, (float)69481544.0);
orientation = FVector((float)0.624659300, (float)-0.468542814, (float)-0.624714553);
}
void CStarView::resizeSurface(CScreenManager *scrManager, int width, int height,

View File

@ -43,7 +43,7 @@ private:
CVideoSurface *_videoSurface;
CStarCamera _camera;
bool _hasReference;
CViewport _sub13;
CViewport _photoViewport;
CSurfaceFader _fader;
CVideoSurface *_videoSurface2;
CGameObject *_homePhotoMask;
@ -54,8 +54,15 @@ private:
void fn18(CStarCamera *camera);
void fn19(int v);
void randomizeVectors1(FVector &v1, FVector &v2);
void randomizeVectors2(FVector &v1, FVector &v2);
/**
* Gets a random position and orientation
*/
void randomizeVectors1(FVector &pos, FVector &orientation);
/**
* Gets a random position and orientation
*/
void randomizeVectors2(FVector &pos, FVector &orientation);
/**
* Handles resizing the surface

View File

@ -116,8 +116,8 @@ void CViewport::setOrientation(const FMatrix &m) {
_flag = false;
}
void CViewport::fn11(const FVector &v) {
_orientation.fn1(v);
void CViewport::setOrientation(const FVector &v) {
_orientation.set(v);
_flag = false;
}

View File

@ -85,11 +85,15 @@ public:
void setPosition(const FPose &pose);
/**
* Sets the orientation
* Sets the orientation from a passed matrix
*/
void setOrientation(const FMatrix &m);
void fn11(const FVector &v);
/**
* Sets the orientation from a passed vector
*/
void setOrientation(const FVector &v);
void fn12();
void fn13(StarMode mode, double val);
void reposition(double factor);