mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-01 15:09:47 +00:00
TITANIC: Beginnings of matrix and vector classes
This commit is contained in:
parent
7553b81d86
commit
e1695101bc
@ -417,10 +417,15 @@ MODULE_OBJS := \
|
||||
sound/water_lapping_sounds.o \
|
||||
sound/wave_file.o \
|
||||
star_control/star_control.o \
|
||||
star_control/base_star.o \
|
||||
star_control/dmatrix.o \
|
||||
star_control/dvector.o \
|
||||
star_control/fmatrix.o \
|
||||
star_control/fpoint.o \
|
||||
star_control/fvector.o \
|
||||
star_control/star_array.o \
|
||||
star_control/star_control_sub1.o \
|
||||
star_control/star_control_sub2.o \
|
||||
star_control/base_star.o \
|
||||
star_control/star_array.o \
|
||||
star_control/star_control_sub4.o \
|
||||
star_control/star_control_sub5.o \
|
||||
star_control/star_control_sub6.o \
|
||||
@ -430,8 +435,6 @@ MODULE_OBJS := \
|
||||
star_control/star_view.o \
|
||||
star_control/star_control_sub12.o \
|
||||
star_control/star_control_sub13.o \
|
||||
star_control/star_control_sub14.o \
|
||||
star_control/star_control_sub15.o \
|
||||
star_control/star_control_sub20.o \
|
||||
star_control/star_control_sub21.o \
|
||||
star_control/star_control_sub22.o \
|
||||
|
@ -20,17 +20,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "titanic/star_control/star_control_sub15.h"
|
||||
#include "titanic/star_control/dmatrix.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
CStarControlSub15::CStarControlSub15() :
|
||||
_field0(1.875), _field8(0), _fieldC(0),
|
||||
_field10(0), _field14(0), _field18(0.0), _field1C(0),
|
||||
_field20(1.875), _field28(0), _field2C(0),
|
||||
_field30(0), _field38(0), _field3C(0),
|
||||
_field40(1.875), _field48(0), _field4C(0),
|
||||
_field50(0), _field54(0), _field58(0), _field5C(0) {
|
||||
DMatrix::DMatrix() :
|
||||
_row1(1.0, 0.0, 0.0), _row2(0.0, 1.0, 0.0), _row3(0.0, 0.0, 1.0),
|
||||
_row4(0.0, 0.0, 0.0) {
|
||||
}
|
||||
|
||||
|
||||
} // End of namespace Titanic
|
@ -20,38 +20,23 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TITANIC_STAR_CONTROL_SUB15_H
|
||||
#define TITANIC_STAR_CONTROL_SUB15_H
|
||||
#ifndef TITANIC_DMATRIX_H
|
||||
#define TITANIC_DMATRIX_H
|
||||
|
||||
#include "titanic/star_control/dvector.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CStarControlSub15 {
|
||||
class DMatrix {
|
||||
private:
|
||||
double _field0;
|
||||
int _field8;
|
||||
int _fieldC;
|
||||
int _field10;
|
||||
int _field14;
|
||||
double _field18;
|
||||
int _field1C;
|
||||
double _field20;
|
||||
int _field24;
|
||||
int _field28;
|
||||
int _field2C;
|
||||
double _field30;
|
||||
int _field38;
|
||||
int _field3C;
|
||||
double _field40;
|
||||
int _field48;
|
||||
int _field4C;
|
||||
int _field50;
|
||||
int _field54;
|
||||
int _field58;
|
||||
int _field5C;
|
||||
DVector _row1;
|
||||
DVector _row2;
|
||||
DVector _row3;
|
||||
DVector _row4;
|
||||
public:
|
||||
CStarControlSub15();
|
||||
DMatrix();
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
#endif /* TITANIC_STAR_CONTROL_SUB15_H */
|
||||
#endif /* TITANIC_DMATRIX_H */
|
28
engines/titanic/star_control/dvector.cpp
Normal file
28
engines/titanic/star_control/dvector.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
/* 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/dvector.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
|
||||
} // End of namespace Titanic
|
@ -20,31 +20,19 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "titanic/star_control/star_control_sub14.h"
|
||||
#ifndef TITANIC_DVECTOR_H
|
||||
#define TITANIC_DVECTOR_H
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
CStarControlSub14::CStarControlSub14() :
|
||||
_field0(0x3F800000), _field4(0), _field8(0), _fieldC(0),
|
||||
_field10(0x3F800000), _field14(0), _field18(0), _field1C(0),
|
||||
_field20(0x3F800000) {
|
||||
}
|
||||
|
||||
void CStarControlSub14::load(SimpleFile *file, int param) {
|
||||
_field0 = file->readFloat();
|
||||
_field4 = file->readFloat();
|
||||
_field8 = file->readFloat();
|
||||
_fieldC = file->readFloat();
|
||||
_field10 = file->readFloat();
|
||||
_field14 = file->readFloat();
|
||||
_field18 = file->readFloat();
|
||||
_field1C = file->readFloat();
|
||||
_field20 = file->readFloat();
|
||||
}
|
||||
|
||||
void CStarControlSub14::save(SimpleFile *file, int indent) {
|
||||
|
||||
}
|
||||
|
||||
class DVector {
|
||||
public:
|
||||
double _x, _y, _z;
|
||||
public:
|
||||
DVector() : _x(0), _y(0), _z(0) {}
|
||||
DVector(double x, double y, double z) : _x(x), _y(y), _z(z) {}
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
#endif /* TITANIC_DVECTOR_H */
|
75
engines/titanic/star_control/fmatrix.cpp
Normal file
75
engines/titanic/star_control/fmatrix.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
/* 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/fmatrix.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
FMatrix::FMatrix() :
|
||||
_row1(1.0, 0.0, 0.0), _row2(0.0, 1.0, 0.0), _row3(0.0, 0.0, 1.0) {
|
||||
}
|
||||
|
||||
FMatrix::FMatrix(DMatrix *src) {
|
||||
copyFrom(src);
|
||||
}
|
||||
|
||||
void FMatrix::copyFrom(const DMatrix *src) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void FMatrix::load(SimpleFile *file, int param) {
|
||||
_row1._x = file->readFloat();
|
||||
_row1._y = file->readFloat();
|
||||
_row1._z = file->readFloat();
|
||||
_row2._x = file->readFloat();
|
||||
_row2._y = file->readFloat();
|
||||
_row2._z = file->readFloat();
|
||||
_row3._x = file->readFloat();
|
||||
_row3._y = file->readFloat();
|
||||
_row3._z = file->readFloat();
|
||||
}
|
||||
|
||||
void FMatrix::save(SimpleFile *file, int indent) {
|
||||
file->writeFloatLine(_row1._x, indent);
|
||||
file->writeFloatLine(_row1._y, indent);
|
||||
file->writeFloatLine(_row1._z, indent);
|
||||
file->writeFloatLine(_row2._x, indent);
|
||||
file->writeFloatLine(_row2._y, indent);
|
||||
file->writeFloatLine(_row2._z, indent);
|
||||
file->writeFloatLine(_row3._x, indent);
|
||||
file->writeFloatLine(_row3._y, indent);
|
||||
file->writeFloatLine(_row3._z, indent);
|
||||
}
|
||||
|
||||
void FMatrix::clear() {
|
||||
_row1 = FVector(1.0, 0.0, 0.0);
|
||||
_row2 = FVector(0.0, 1.0, 0.0);
|
||||
_row3 = FVector(0.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
void FMatrix::set(FVector *row1, FVector *row2, FVector *row3) {
|
||||
_row1 = *row1;
|
||||
_row2 = *row2;
|
||||
_row3 = *row3;
|
||||
}
|
||||
|
||||
} // End of namespace Titanic
|
@ -20,26 +20,29 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TITANIC_STAR_CONTROL_SUB14_H
|
||||
#define TITANIC_STAR_CONTROL_SUB14_H
|
||||
#ifndef TITANIC_FMATRIX_H
|
||||
#define TITANIC_FMATRIX_H
|
||||
|
||||
#include "titanic/support/simple_file.h"
|
||||
#include "titanic/star_control/fvector.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CStarControlSub14 {
|
||||
class DMatrix;
|
||||
|
||||
class FMatrix {
|
||||
private:
|
||||
double _field0;
|
||||
double _field4;
|
||||
double _field8;
|
||||
double _fieldC;
|
||||
double _field10;
|
||||
double _field14;
|
||||
double _field18;
|
||||
double _field1C;
|
||||
double _field20;
|
||||
FVector _row1;
|
||||
FVector _row2;
|
||||
FVector _row3;
|
||||
private:
|
||||
/**
|
||||
* Copys data from a given source
|
||||
*/
|
||||
void copyFrom(const DMatrix *src);
|
||||
public:
|
||||
CStarControlSub14();
|
||||
FMatrix();
|
||||
FMatrix(DMatrix *src);
|
||||
|
||||
/**
|
||||
* Load the data for the class from file
|
||||
@ -51,8 +54,17 @@ public:
|
||||
*/
|
||||
void save(SimpleFile *file, int indent);
|
||||
|
||||
/**
|
||||
* Clears the matrix
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Sets the data for the matrix
|
||||
*/
|
||||
void set(FVector *row1, FVector *row2, FVector *row3);
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
#endif /* TITANIC_STAR_CONTROL_SUB13_H */
|
||||
#endif /* TITANIC_MATRIX3_H */
|
28
engines/titanic/star_control/fpoint.cpp
Normal file
28
engines/titanic/star_control/fpoint.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
/* 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/fpoint.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
|
||||
} // End of namespace Titanic
|
38
engines/titanic/star_control/fpoint.h
Normal file
38
engines/titanic/star_control/fpoint.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* 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_FPOINT_H
|
||||
#define TITANIC_FPOINT_H
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class FVector {
|
||||
public:
|
||||
double _x, _y;
|
||||
public:
|
||||
FVector() : _x(0), _y(0) {}
|
||||
FVector(double x, double y) : _x(x), _y(y) {}
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
#endif /* TITANIC_FPOINT_H */
|
28
engines/titanic/star_control/fvector.cpp
Normal file
28
engines/titanic/star_control/fvector.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
/* 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/fvector.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
|
||||
} // End of namespace Titanic
|
38
engines/titanic/star_control/fvector.h
Normal file
38
engines/titanic/star_control/fvector.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* 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_FVECTOR_H
|
||||
#define TITANIC_FVECTOR_H
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class FVector {
|
||||
public:
|
||||
double _x, _y, _z;
|
||||
public:
|
||||
FVector() : _x(0), _y(0), _z(0) {}
|
||||
FVector(double x, double y, double z) : _x(x), _y(y), _z(z) {}
|
||||
};
|
||||
|
||||
} // End of namespace Titanic
|
||||
|
||||
#endif /* TITANIC_FVECTOR_H */
|
@ -63,12 +63,12 @@ void CStarControlSub13::load(SimpleFile *file, int param) {
|
||||
for (int idx = 0; idx < 5; ++idx)
|
||||
_valArray[idx] = file->readFloat();
|
||||
|
||||
_sub14.load(file, param);
|
||||
_matrix.load(file, param);
|
||||
_fieldD4 = 0;
|
||||
}
|
||||
|
||||
void CStarControlSub13::save(SimpleFile *file, int indent) {
|
||||
_sub14.save(file, indent);
|
||||
_matrix.save(file, indent);
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "titanic/support/simple_file.h"
|
||||
#include "titanic/star_control/star_control_sub6.h"
|
||||
#include "titanic/star_control/star_control_sub14.h"
|
||||
#include "titanic/star_control/fmatrix.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
@ -43,7 +43,7 @@ private:
|
||||
int _field22;
|
||||
int _field24;
|
||||
double _valArray[5];
|
||||
CStarControlSub14 _sub14;
|
||||
FMatrix _matrix;
|
||||
CStarControlSub6 _sub1;
|
||||
CStarControlSub6 _sub2;
|
||||
int _fieldC0;
|
||||
|
@ -23,17 +23,17 @@
|
||||
#ifndef TITANIC_STAR_CONTROL_SUB25_H
|
||||
#define TITANIC_STAR_CONTROL_SUB25_H
|
||||
|
||||
#include "titanic/star_control/star_control_sub14.h"
|
||||
#include "titanic/star_control/fmatrix.h"
|
||||
#include "titanic/star_control/star_control_sub26.h"
|
||||
|
||||
namespace Titanic {
|
||||
|
||||
class CStarControlSub25 {
|
||||
public:
|
||||
CStarControlSub14 _sub1;
|
||||
CStarControlSub14 _sub2;
|
||||
CStarControlSub26 _sub3;
|
||||
CStarControlSub26 _sub4;
|
||||
FMatrix _matrix1;
|
||||
FMatrix _matrix2;
|
||||
CStarControlSub26 _sub1;
|
||||
CStarControlSub26 _sub2;
|
||||
public:
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user