Merged revision(s) 493-500 from trunk:
Include <sys/stat.h> for mkdir() declaration. ........ Include <string.h> for memcpy() declaration. ........ Fixed compile errors caused by mismatched ints and doubles. ........ Include <string.h> for memset() declaration. ........ Made templates standard compliant. Unqualified name lookup does not look into dependent base classes. ........ Added new matrices.[cpp|h] and vectors.[cpp|h] sourcefiles to build. ........ Avoid shadowing of the template parameters with local variables. ........ Updated lists of resource files to install. ........ git-svn-id: https://svn.code.sf.net/p/extremetuxracer/code/branches/SFML2@502 0420edf4-82e4-42fc-9478-35b55e6d67a3master
parent
d8a1ec6b68
commit
49969b7924
|
@ -132,5 +132,6 @@ AC_CONFIG_FILES([
|
|||
data/translations/Makefile
|
||||
doc/Makefile
|
||||
resources/Makefile
|
||||
resources/gui/Makefile
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -3,10 +3,10 @@ pkgdatadir = $(datadir)/$(PACKAGE)/textures
|
|||
|
||||
pkgdata_DATA = \
|
||||
textures.lst \
|
||||
splash_small.png \
|
||||
snowstart.png \
|
||||
snowtrack.png \
|
||||
snowstop.png \
|
||||
splash_1.png \
|
||||
menu_title.png \
|
||||
menu_title_small.png \
|
||||
listbox_arrows.png \
|
||||
|
@ -21,7 +21,6 @@ pkgdata_DATA = \
|
|||
tuxbonus.png \
|
||||
mouse_cursor.png \
|
||||
snowparticles.png \
|
||||
envmap.png \
|
||||
energymask2.png \
|
||||
mask_outline2.png \
|
||||
ziff032.png \
|
||||
|
@ -29,13 +28,9 @@ pkgdata_DATA = \
|
|||
random_butt.png \
|
||||
herringicon3.png \
|
||||
timeicon.png \
|
||||
stars.png \
|
||||
speedknob2.png \
|
||||
cupicon.png \
|
||||
checkbox.png \
|
||||
checkmark_small.png \
|
||||
checkmark.png \
|
||||
widgets.png \
|
||||
snow1.png \
|
||||
snow2.png \
|
||||
snow3.png \
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
SUBDIRS = gui
|
||||
|
||||
desktopfiledir = $(prefix)/share/applications
|
||||
icondir = $(prefix)/share/pixmaps
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
pkgdatadir = $(datadir)/$(PACKAGE)/resources/gui
|
||||
|
||||
pkgdata_DATA = \
|
||||
checkmark.png \
|
||||
checkmarks.png \
|
||||
cupicon.png \
|
||||
energymask.png \
|
||||
herringicon2.png \
|
||||
splash.png \
|
||||
stars.png
|
||||
|
||||
EXTRA_DIST = $(pkgdata_DATA)
|
|
@ -24,6 +24,7 @@ etr_SOURCES = \
|
|||
loading.cpp \
|
||||
main.cpp \
|
||||
mathlib.cpp \
|
||||
matrices.cpp \
|
||||
newplayer.cpp \
|
||||
ogl.cpp \
|
||||
ogl_test.cpp \
|
||||
|
@ -46,6 +47,7 @@ etr_SOURCES = \
|
|||
track_marks.cpp \
|
||||
translation.cpp \
|
||||
tux.cpp \
|
||||
vectors.cpp \
|
||||
view.cpp \
|
||||
winsys.cpp
|
||||
|
||||
|
@ -74,6 +76,7 @@ noinst_HEADERS = \
|
|||
keyframe.h \
|
||||
loading.h \
|
||||
mathlib.h \
|
||||
matrices.h \
|
||||
newplayer.h \
|
||||
ogl.h \
|
||||
ogl_test.h \
|
||||
|
@ -96,6 +99,7 @@ noinst_HEADERS = \
|
|||
track_marks.h \
|
||||
translation.h \
|
||||
tux.h \
|
||||
vectors.h \
|
||||
version.h \
|
||||
view.h \
|
||||
winsys.h
|
||||
|
|
|
@ -39,6 +39,10 @@ Then edit the below functions:
|
|||
#include <etr_config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include "game_config.h"
|
||||
#include "spx.h"
|
||||
#include "translation.h"
|
||||
|
@ -268,7 +272,7 @@ void InitConfig() {
|
|||
param.config_dir = "config";
|
||||
param.data_dir = "data";
|
||||
param.configfile = param.config_dir + SEP "options.txt";
|
||||
#else
|
||||
#else /* WIN32 */
|
||||
|
||||
#if 0
|
||||
char buff[256];
|
||||
|
@ -284,7 +288,7 @@ void InitConfig() {
|
|||
}
|
||||
|
||||
param.prog_dir = buff;
|
||||
#endif
|
||||
#endif /* 0 */
|
||||
|
||||
struct passwd *pwent = getpwuid(getuid());
|
||||
param.config_dir = pwent->pw_dir;
|
||||
|
@ -298,7 +302,7 @@ void InitConfig() {
|
|||
param.data_dir += "etr";
|
||||
// param.data_dir = param.prog_dir + SEP "data";
|
||||
param.configfile = param.config_dir + SEP "options";
|
||||
#endif
|
||||
#endif /* WIN32 */
|
||||
|
||||
param.screenshot_dir = param.data_dir + SEP "screenshots";
|
||||
param.obj_dir = param.data_dir + SEP "objects";
|
||||
|
|
|
@ -25,6 +25,7 @@ GNU General Public License for more details.
|
|||
#include "tux.h"
|
||||
#include "game_ctrl.h"
|
||||
#include "physics.h"
|
||||
#include <cstring>
|
||||
|
||||
static const int numJoints = 19;
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ GNU General Public License for more details.
|
|||
#include <algorithm>
|
||||
|
||||
|
||||
template<int x, int y>
|
||||
const TMatrix<x, y>& TMatrix<x, y>::getIdentity() {
|
||||
template<int ix, int iy>
|
||||
const TMatrix<ix, iy>& TMatrix<ix, iy>::getIdentity() {
|
||||
static bool b = false;
|
||||
static TMatrix<x, y> mat;
|
||||
static TMatrix<ix, iy> mat;
|
||||
if (!b) {
|
||||
mat.SetIdentity();
|
||||
b = true;
|
||||
|
@ -36,10 +36,10 @@ const TMatrix<x, y>& TMatrix<x, y>::getIdentity() {
|
|||
template const TMatrix<3, 3>& TMatrix<3, 3>::getIdentity();
|
||||
template const TMatrix<4, 4>& TMatrix<4, 4>::getIdentity();
|
||||
|
||||
template<int x, int y>
|
||||
void TMatrix<x, y>::SetIdentity() {
|
||||
for (int i = 0; i < x; i++)
|
||||
for (int j = 0; j < y; j++)
|
||||
template<int ix, int iy>
|
||||
void TMatrix<ix, iy>::SetIdentity() {
|
||||
for (int i = 0; i < ix; i++)
|
||||
for (int j = 0; j < iy; j++)
|
||||
_data[i][j] = (i == j);
|
||||
}
|
||||
template void TMatrix<3, 3>::SetIdentity();
|
||||
|
@ -47,8 +47,8 @@ template void TMatrix<4, 4>::SetIdentity();
|
|||
|
||||
|
||||
|
||||
template<int x, int y>
|
||||
void TMatrix<x, y>::SetRotationMatrix(double angle, char axis) {
|
||||
template<int ix, int iy>
|
||||
void TMatrix<ix, iy>::SetRotationMatrix(double angle, char axis) {
|
||||
double sinv, cosv;
|
||||
sinv = sin(ANGLES_TO_RADIANS(angle));
|
||||
cosv = cos(ANGLES_TO_RADIANS(angle));
|
||||
|
@ -81,8 +81,8 @@ void TMatrix<x, y>::SetRotationMatrix(double angle, char axis) {
|
|||
template void TMatrix<3, 3>::SetRotationMatrix(double angle, char axis);
|
||||
template void TMatrix<4, 4>::SetRotationMatrix(double angle, char axis);
|
||||
|
||||
template<int x, int y>
|
||||
void TMatrix<x, y>::SetTranslationMatrix(double x, double y, double z) {
|
||||
template<int ix, int iy>
|
||||
void TMatrix<ix, iy>::SetTranslationMatrix(double x, double y, double z) {
|
||||
SetIdentity();
|
||||
_data[3][0] = x;
|
||||
_data[3][1] = y;
|
||||
|
@ -90,8 +90,8 @@ void TMatrix<x, y>::SetTranslationMatrix(double x, double y, double z) {
|
|||
}
|
||||
template void TMatrix<4, 4>::SetTranslationMatrix(double x, double y, double z);
|
||||
|
||||
template<int x, int y>
|
||||
void TMatrix<x, y>::SetScalingMatrix(double x, double y, double z) {
|
||||
template<int ix, int iy>
|
||||
void TMatrix<ix, iy>::SetScalingMatrix(double x, double y, double z) {
|
||||
SetIdentity();
|
||||
_data[0][0] = x;
|
||||
_data[1][1] = y;
|
||||
|
@ -100,8 +100,8 @@ void TMatrix<x, y>::SetScalingMatrix(double x, double y, double z) {
|
|||
template void TMatrix<3, 3>::SetScalingMatrix(double x, double y, double z);
|
||||
template void TMatrix<4, 4>::SetScalingMatrix(double x, double y, double z);
|
||||
|
||||
template<int x, int y>
|
||||
TMatrix<x, y>::TMatrix(const TVector3d& w1, const TVector3d& w2, const TVector3d& w3) {
|
||||
template<int ix, int iy>
|
||||
TMatrix<ix, iy>::TMatrix(const TVector3d& w1, const TVector3d& w2, const TVector3d& w3) {
|
||||
SetIdentity();
|
||||
_data[0][0] = w1.x;
|
||||
_data[0][1] = w1.y;
|
||||
|
@ -116,12 +116,12 @@ TMatrix<x, y>::TMatrix(const TVector3d& w1, const TVector3d& w2, const TVector3d
|
|||
template TMatrix<3, 3>::TMatrix(const TVector3d& w1, const TVector3d& w2, const TVector3d& w3);
|
||||
template TMatrix<4, 4>::TMatrix(const TVector3d& w1, const TVector3d& w2, const TVector3d& w3);
|
||||
|
||||
template<int x, int y>
|
||||
TMatrix<x, y> TMatrix<x, y>::GetTransposed() const {
|
||||
TMatrix<x, y> r;
|
||||
template<int ix, int iy>
|
||||
TMatrix<ix, iy> TMatrix<ix, iy>::GetTransposed() const {
|
||||
TMatrix<ix, iy> r;
|
||||
|
||||
for (int i = 0; i < x; i++)
|
||||
for (int j = 0; j < y; j++)
|
||||
for (int i = 0; i < ix; i++)
|
||||
for (int j = 0; j < iy; j++)
|
||||
r._data[j][i] = _data[i][j];
|
||||
|
||||
return r;
|
||||
|
@ -153,4 +153,4 @@ TMatrix<4, 4> operator*<4, 4>(const TMatrix<4, 4>& l, const TMatrix<4, 4>& r) {
|
|||
l[3][i] * r[j][3];
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ GNU General Public License for more details.
|
|||
|
||||
#include "vectors.h"
|
||||
|
||||
template<int x, int y>
|
||||
template<int ix, int iy>
|
||||
class TMatrix {
|
||||
double _data[x][y];
|
||||
double _data[ix][iy];
|
||||
public:
|
||||
TMatrix() {}
|
||||
TMatrix(const TVector3d& w1, const TVector3d& w2, const TVector3d& w3);
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
|
||||
TMatrix GetTransposed() const;
|
||||
|
||||
static const TMatrix<x, y>& getIdentity();
|
||||
static const TMatrix<ix, iy>& getIdentity();
|
||||
};
|
||||
|
||||
template<int x, int y>
|
||||
|
|
|
@ -44,7 +44,7 @@ GNU General Public License for more details.
|
|||
#define PUSH_DECAY_TIME_CONSTANT 0.2
|
||||
#define PUSH_DIST_DECAY 100
|
||||
#define PUSH_FACTOR 0.5
|
||||
#define MAX_PUSH_FORCE 5
|
||||
#define MAX_PUSH_FORCE 5.0
|
||||
#define AIR_DRAG 0.4
|
||||
#define TUX_WIDTH 0.45
|
||||
|
||||
|
@ -213,10 +213,10 @@ void push_ui_snow(const TVector2i& pos) {
|
|||
#define BRAKE_PARTICLES 2000
|
||||
#define MAX_ROLL_PARTICLES 3000
|
||||
#define PARTICLE_SPEED_FACTOR 40
|
||||
#define MAX_PARTICLE_ANGLE 80
|
||||
#define MAX_PARTICLE_ANGLE 80.0
|
||||
#define MAX_PARTICLE_ANGLE_SPEED 50
|
||||
#define PARTICLE_SPEED_MULTIPLIER 0.3
|
||||
#define MAX_PARTICLE_SPEED 2
|
||||
#define MAX_PARTICLE_SPEED 2.0
|
||||
|
||||
|
||||
struct Particle {
|
||||
|
|
|
@ -285,8 +285,8 @@ TVector3d CControl::CalcAirForce() {
|
|||
TVector3d CControl::CalcSpringForce() {
|
||||
double springvel = DotProduct(ff.vel, ff.rollnml);
|
||||
double springfact = min(ff.compression, 0.05) * 1500;
|
||||
springfact += clamp(0, ff.compression - 0.05, 0.12) * 3000;
|
||||
springfact += max(0, ff.compression - 0.12 - 0.05) * 10000;
|
||||
springfact += clamp(0.0, ff.compression - 0.05, 0.12) * 3000;
|
||||
springfact += max(0.0, ff.compression - 0.12 - 0.05) * 10000;
|
||||
springfact -= springvel * (ff.compression <= 0.05 ? 1500 : 500);
|
||||
springfact = clamp(0.0, springfact, 3000.0);
|
||||
return springfact * ff.rollnml;
|
||||
|
|
|
@ -38,7 +38,7 @@ GNU General Public License for more details.
|
|||
#define WIND_FACTOR 1.5
|
||||
|
||||
#define MIN_FRICT_SPEED 2.8
|
||||
#define MAX_FRICT_FORCE 800
|
||||
#define MAX_FRICT_FORCE 800.0
|
||||
#define MAX_TURN_ANGLE 45
|
||||
#define MAX_TURN_PERP 400
|
||||
#define MAX_TURN_PEN 0.15
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "ogl.h"
|
||||
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
|
||||
#define TERRAIN_ERROR_SCALE 0.1
|
||||
#define VERTEX_FORCE_THRESHOLD 100
|
||||
|
|
|
@ -230,7 +230,7 @@ int SlideVolume(CControl *ctrl, double speed, int typ) {
|
|||
if (typ == 1) { // only at paddling or braking
|
||||
return (int)(min((((pow(ctrl->turn_fact, 2) * 128)) +
|
||||
(ctrl->is_braking ? 128:0) +
|
||||
(ctrl->jumping ? 128:0) + 20) * (speed / 10), 128));
|
||||
(ctrl->jumping ? 128:0) + 20) * (speed / 10), 128.0));
|
||||
} else { // always
|
||||
return (int)(128 * pow((speed/2),2));
|
||||
}
|
||||
|
|
|
@ -583,12 +583,11 @@ void CCharShape::AdjustJoints(double turnFact, bool isBraking,
|
|||
RotateNode("right_hip", 3, -20 - turn_leg_angle + force_angle);
|
||||
|
||||
RotateNode("left_knee", 3,
|
||||
-10 + turn_leg_angle - min(35, speed) + kick_paddling_angle + force_angle);
|
||||
-10 + turn_leg_angle - min(35.0, speed) + kick_paddling_angle + force_angle);
|
||||
RotateNode("right_knee", 3,
|
||||
-10 - turn_leg_angle - min(35, speed) - kick_paddling_angle + force_angle);
|
||||
|
||||
RotateNode("left_ankle", 3, -20 + min(50, speed));
|
||||
RotateNode("right_ankle", 3, -20 + min(50, speed));
|
||||
-10 - turn_leg_angle - min(35.0, speed) - kick_paddling_angle + force_angle);
|
||||
RotateNode("left_ankle", 3, -20 + min(50.0, speed));
|
||||
RotateNode("right_ankle", 3, -20 + min(50.0, speed));
|
||||
RotateNode("tail", 3, turnFact * 20);
|
||||
RotateNode("neck", 3, -50);
|
||||
RotateNode("head", 3, -30);
|
||||
|
|
|
@ -52,27 +52,28 @@ template<typename T>
|
|||
struct TVector3 : public TVector2<T> {
|
||||
T z;
|
||||
explicit TVector3(T _x = 0.0, T _y = 0.0, T _z = 0.0)
|
||||
: TVector2(_x, _y), z(_z)
|
||||
: TVector2<T>(_x, _y), z(_z)
|
||||
{}
|
||||
double Length() const {
|
||||
return sqrt(static_cast<double>(x*x + y*y + z*z));
|
||||
return sqrt(static_cast<double>(TVector2<T>::x*TVector2<T>::x +
|
||||
TVector2<T>::y*TVector2<T>::y + z*z));
|
||||
}
|
||||
double Norm();
|
||||
TVector3<T>& operator*=(T f) {
|
||||
x *= f;
|
||||
y *= f;
|
||||
TVector2<T>::x *= f;
|
||||
TVector2<T>::y *= f;
|
||||
z *= f;
|
||||
return *this;
|
||||
}
|
||||
TVector3<T>& operator+=(const TVector3<T>& v) {
|
||||
x += v.x;
|
||||
y += v.y;
|
||||
TVector2<T>::x += v.x;
|
||||
TVector2<T>::y += v.y;
|
||||
z += v.z;
|
||||
return *this;
|
||||
}
|
||||
TVector3<T>& operator-=(const TVector3<T>& v) {
|
||||
x -= v.x;
|
||||
y -= v.y;
|
||||
TVector2<T>::x -= v.x;
|
||||
TVector2<T>::y -= v.y;
|
||||
z -= v.z;
|
||||
return *this;
|
||||
}
|
||||
|
@ -82,30 +83,32 @@ template<typename T>
|
|||
struct TVector4 : public TVector3<T> {
|
||||
T w;
|
||||
explicit TVector4(T _x = 0.0, T _y = 0.0, T _z = 0.0, T _w = 0.0)
|
||||
: TVector3(_x, _y, _z), w(_w)
|
||||
: TVector3<T>(_x, _y, _z), w(_w)
|
||||
{}
|
||||
double Length() const {
|
||||
return sqrt(static_cast<double>(x*x + y*y + z*z + w*w));
|
||||
return sqrt(static_cast<double>(TVector2<T>::x*TVector2<T>::x +
|
||||
TVector2<T>::y*TVector2<T>::y +
|
||||
TVector3<T>::z*TVector3<T>::z + w*w));
|
||||
}
|
||||
double Norm();
|
||||
TVector4<T>& operator*=(T f) {
|
||||
x *= f;
|
||||
y *= f;
|
||||
z *= f;
|
||||
TVector2<T>::x *= f;
|
||||
TVector2<T>::y *= f;
|
||||
TVector3<T>::z *= f;
|
||||
w *= f;
|
||||
return *this;
|
||||
}
|
||||
TVector4<T>& operator+=(const TVector4<T>& v) {
|
||||
x += v.x;
|
||||
y += v.y;
|
||||
z += v.z;
|
||||
TVector2<T>::x += v.x;
|
||||
TVector2<T>::y += v.y;
|
||||
TVector3<T>::z += v.z;
|
||||
w += v.w;
|
||||
return *this;
|
||||
}
|
||||
TVector4<T>& operator-=(const TVector4<T>& v) {
|
||||
x -= v.x;
|
||||
y -= v.y;
|
||||
z -= v.z;
|
||||
TVector2<T>::x -= v.x;
|
||||
TVector2<T>::y -= v.y;
|
||||
TVector3<T>::z -= v.z;
|
||||
w -= v.w;
|
||||
return *this;
|
||||
}
|
||||
|
@ -121,41 +124,41 @@ typedef TVector4d TQuaternion;
|
|||
|
||||
template<typename T>
|
||||
TVector2<T> operator*(T f, const TVector2<T>& v) {
|
||||
return TVector2<typename T>(v.x*f, v.y*f);
|
||||
return TVector2<T>(v.x*f, v.y*f);
|
||||
}
|
||||
template<typename T>
|
||||
TVector3<T> operator*(T f, const TVector3<T>& v) {
|
||||
return TVector3<typename T>(v.x*f, v.y*f, v.z*f);
|
||||
return TVector3<T>(v.x*f, v.y*f, v.z*f);
|
||||
}
|
||||
template<typename T>
|
||||
TVector4<T> operator*(T f, const TVector4<T>& v) {
|
||||
return TVector4<typename T>(v.x*f, v.y*f, v.z*f, v.w*f);
|
||||
return TVector4<T>(v.x*f, v.y*f, v.z*f, v.w*f);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
TVector2<T> operator+(const TVector2<T>& l, const TVector2<T>& r) {
|
||||
return TVector2<typename T>(l.x + r.x, l.y + r.y);
|
||||
return TVector2<T>(l.x + r.x, l.y + r.y);
|
||||
}
|
||||
template<typename T>
|
||||
TVector3<T> operator+(const TVector3<T>& l, const TVector3<T>& r) {
|
||||
return TVector3<typename T>(l.x + r.x, l.y + r.y, l.z + r.z);
|
||||
return TVector3<T>(l.x + r.x, l.y + r.y, l.z + r.z);
|
||||
}
|
||||
template<typename T>
|
||||
TVector4<T> operator+(const TVector4<T>& l, const TVector4<T>& r) {
|
||||
return TVector4<typename T>(l.x + r.x, l.y + r.y, l.z + r.z, l.w + r.w);
|
||||
return TVector4<T>(l.x + r.x, l.y + r.y, l.z + r.z, l.w + r.w);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
TVector2<T> operator-(const TVector2<T>& l, const TVector2<T>& r) {
|
||||
return TVector2<typename T>(l.x - r.x, l.y - r.y);
|
||||
return TVector2<T>(l.x - r.x, l.y - r.y);
|
||||
}
|
||||
template<typename T>
|
||||
TVector3<T> operator-(const TVector3<T>& l, const TVector3<T>& r) {
|
||||
return TVector3<typename T>(l.x - r.x, l.y - r.y, l.z - r.z);
|
||||
return TVector3<T>(l.x - r.x, l.y - r.y, l.z - r.z);
|
||||
}
|
||||
template<typename T>
|
||||
TVector4<T> operator-(const TVector4<T>& l, const TVector4<T>& r) {
|
||||
return TVector4<typename T>(l.x - r.x, l.y - r.y, l.z - r.z, l.w - r.w);
|
||||
return TVector4<T>(l.x - r.x, l.y - r.y, l.z - r.z, l.w - r.w);
|
||||
}
|
||||
|
||||
double DotProduct(const TVector3d& v1, const TVector3d& v2);
|
||||
|
|
Loading…
Reference in New Issue