Bugfixes:
- Fixed track marks when limit (10000) is reached - Remember selected course group in race selection menu Some small refactorizations git-svn-id: https://svn.code.sf.net/p/extremetuxracer/code/trunk@547 0420edf4-82e4-42fc-9478-35b55e6d67a3master
parent
1fd21eec7f
commit
1da426d3fe
|
@ -39,9 +39,6 @@ void setup_course_tex_gen() {
|
|||
glTexGenfv(GL_T, GL_OBJECT_PLANE, zplane);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// render course
|
||||
// --------------------------------------------------------------------
|
||||
void RenderCourse() {
|
||||
ScopedRenderMode rm(COURSE);
|
||||
setup_course_tex_gen();
|
||||
|
@ -52,9 +49,6 @@ void RenderCourse() {
|
|||
RenderQuadtree();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// DrawTrees
|
||||
// --------------------------------------------------------------------
|
||||
void DrawTrees() {
|
||||
size_t tree_type = -1;
|
||||
const CControl* ctrl = g_game.player->ctrl;
|
||||
|
@ -66,8 +60,7 @@ void DrawTrees() {
|
|||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
set_material(colWhite, colBlack, 1.0);
|
||||
|
||||
|
||||
// -------------- trees ------------------------
|
||||
// Trees
|
||||
for (size_t i = 0; i< Course.CollArr.size(); i++) {
|
||||
if (clip_course) {
|
||||
if (ctrl->viewpos.z - Course.CollArr[i].pt.z > fwd_clip_limit) continue;
|
||||
|
@ -122,7 +115,7 @@ void DrawTrees() {
|
|||
glPopMatrix();
|
||||
}
|
||||
|
||||
// items -----------------------------
|
||||
// Items
|
||||
const TObjectType* item_type = nullptr;
|
||||
|
||||
for (size_t i = 0; i< Course.NocollArr.size(); i++) {
|
||||
|
|
10
src/env.cpp
10
src/env.cpp
|
@ -30,11 +30,11 @@ GNU General Public License for more details.
|
|||
// defaults
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
static const float def_amb[] = {0.45, 0.53, 0.75, 1.0};
|
||||
static const float def_diff[] = {1.0, 0.9, 1.0, 1.0};
|
||||
static const float def_spec[] = {0.6, 0.6, 0.6, 1.0};
|
||||
static const float def_pos[] = {1, 2, 2, 0.0};
|
||||
static const float def_fogcol[] = {0.9, 0.9, 1.0, 0.0};
|
||||
static const float def_amb[] = {0.45f, 0.53f, 0.75f, 1.f};
|
||||
static const float def_diff[] = {1.f, 0.9f, 1.f, 1.f};
|
||||
static const float def_spec[] = {0.6f, 0.6f, 0.6f, 1.f};
|
||||
static const float def_pos[] = {1.f, 2.f, 2.f, 0.f};
|
||||
static const float def_fogcol[] = {0.9f, 0.9f, 1.f, 0.f};
|
||||
static const sf::Color def_partcol(0.8*255, 0.8*255, 0.9*255, 0);
|
||||
|
||||
void TLight::Enable(GLenum num) const {
|
||||
|
|
|
@ -199,13 +199,13 @@ void CKeyframe::InterpolateKeyframe(size_t idx, double frac, CCharShape *shape)
|
|||
shape->RotateNode("right_ankle", 3, vv);
|
||||
}
|
||||
|
||||
void CKeyframe::CalcKeyframe(size_t idx, CCharShape *shape, const TVector3d& refpos) {
|
||||
void CKeyframe::CalcKeyframe(size_t idx, CCharShape *shape, const TVector3d& refpos_) {
|
||||
double vv;
|
||||
TVector3d pos;
|
||||
|
||||
pos.x = frames[idx].val[1] + refpos.x;
|
||||
pos.z = frames[idx].val[3] + refpos.z;
|
||||
pos.y = refpos.y;
|
||||
pos.x = frames[idx].val[1] + refpos_.x;
|
||||
pos.z = frames[idx].val[3] + refpos_.z;
|
||||
pos.y = refpos_.y;
|
||||
|
||||
shape->ResetRoot();
|
||||
shape->ResetJoints();
|
||||
|
|
24
src/main.cpp
24
src/main.cpp
|
@ -30,6 +30,7 @@ GNU General Public License for more details.
|
|||
#include "winsys.h"
|
||||
#include <iostream>
|
||||
#include <ctime>
|
||||
#include <cstring>
|
||||
|
||||
TGameData g_game;
|
||||
|
||||
|
@ -37,12 +38,12 @@ void InitGame(int argc, char **argv) {
|
|||
g_game.toolmode = NONE;
|
||||
g_game.argument = 0;
|
||||
if (argc == 4) {
|
||||
string group_arg = argv[1];
|
||||
if (group_arg == "--char") g_game.argument = 4;
|
||||
if (std::strcmp("--char", argv[1]) == 0)
|
||||
g_game.argument = 4;
|
||||
Tools.SetParameter(argv[2], argv[3]);
|
||||
} else if (argc == 2) {
|
||||
string group_arg = argv[1];
|
||||
if (group_arg == "9") g_game.argument = 9;
|
||||
if (std::strcmp(argv[1], "9") == 0)
|
||||
g_game.argument = 9;
|
||||
}
|
||||
|
||||
g_game.player = nullptr;
|
||||
|
@ -60,24 +61,19 @@ void InitGame(int argc, char **argv) {
|
|||
g_game.treevar = 3;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// main
|
||||
// ====================================================================
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// ****************************************************************
|
||||
cout << "\n----------- Extreme Tux Racer " ETR_VERSION_STRING " ----------------";
|
||||
cout << "\n----------- (C) 2010-2014 Extreme Tuxracer Team --------\n\n";
|
||||
cout << "\n----------- (C) 2010-2016 Extreme Tuxracer Team --------\n\n";
|
||||
|
||||
srand(time(nullptr));
|
||||
InitConfig();
|
||||
InitGame(argc, argv);
|
||||
Winsys.Init();
|
||||
InitOpenglExtensions();
|
||||
// for checking the joystick and the OpgenGL version (the info is
|
||||
// written on the console):
|
||||
// Winsys.PrintJoystickInfo ();
|
||||
// PrintGLInfo ();
|
||||
|
||||
// For checking the joystick and the OpgenGL version (the info is written on the console):
|
||||
//Winsys.PrintJoystickInfo();
|
||||
//PrintGLInfo ();
|
||||
|
||||
// theses resources must or should be loaded before splashscreen starts
|
||||
if (!Tex.LoadTextureList()) {
|
||||
|
|
|
@ -47,21 +47,21 @@ static TIconButton* mirror;
|
|||
static TIconButton* random_btn;
|
||||
static TWidget* textbuttons[2];
|
||||
static string info;
|
||||
static int prevGroup = -1;
|
||||
static int prevGroup = 0;
|
||||
|
||||
static void UpdateInfo() {
|
||||
info = "";
|
||||
if (mirror->focus && mirror->GetValue() < 2) {
|
||||
if (mirror->focus && mirror->GetValue() < 2)
|
||||
info = Trans.Text(69 + mirror->GetValue());
|
||||
} else if (light->focus && light->GetValue() < 4) {
|
||||
else if (light->focus && light->GetValue() < 4)
|
||||
info = Trans.Text(71 + light->GetValue());
|
||||
} else if (snow->focus && snow->GetValue() < 4) {
|
||||
else if (snow->focus && snow->GetValue() < 4)
|
||||
info = Trans.Text(75 + snow->GetValue());
|
||||
} else if (wind->focus && wind->GetValue() < 4) {
|
||||
else if (wind->focus && wind->GetValue() < 4)
|
||||
info = Trans.Text(79 + wind->GetValue());
|
||||
} else if (random_btn->focus) {
|
||||
else if (random_btn->focus)
|
||||
info = Trans.Text(83);
|
||||
}
|
||||
else
|
||||
info = "";
|
||||
}
|
||||
|
||||
void SetRaceConditions() {
|
||||
|
@ -166,7 +166,7 @@ void CRaceSelect::Enter() {
|
|||
light = AddIconButton(iconleft, icontop, Tex.GetSFTexture(LIGHT_BUTT), iconsize, 3, (int)g_game.light_id);
|
||||
snow = AddIconButton(iconleft + iconspace, icontop, Tex.GetSFTexture(SNOW_BUTT), iconsize, 3, g_game.snow_id);
|
||||
wind = AddIconButton(iconleft + iconspace * 2, icontop, Tex.GetSFTexture(WIND_BUTT), iconsize, 3, g_game.wind_id);
|
||||
mirror = AddIconButton(iconleft + iconspace * 3, icontop, Tex.GetSFTexture(MIRROR_BUTT), iconsize, 1, (int) g_game.mirrorred);
|
||||
mirror = AddIconButton(iconleft + iconspace * 3, icontop, Tex.GetSFTexture(MIRROR_BUTT), iconsize, 1, (int)g_game.mirrorred);
|
||||
random_btn = AddIconButton(iconleft + iconspace * 4, icontop, Tex.GetSFTexture(RANDOM_BUTT), iconsize, 0, 0);
|
||||
int siz = FT.AutoSizeN(5);
|
||||
int len1 = FT.GetTextWidth(Trans.Text(13));
|
||||
|
@ -174,7 +174,7 @@ void CRaceSelect::Enter() {
|
|||
textbuttons[1] = AddTextButton(Trans.Text(8), area.left + 50, AutoYPosN(85), siz);
|
||||
FT.AutoSizeN(4);
|
||||
|
||||
courseGroup = AddUpDown(area.left + framewidth + 8, frametop, 0, (int)Course.CourseLists.size() - 1, 0);
|
||||
courseGroup = AddUpDown(area.left + framewidth + 8, frametop, 0, (int)Course.CourseLists.size() - 1, prevGroup);
|
||||
courseGroupName = AddFramedText(area.left, frametop, framewidth, frameheight, 3, colMBackgr, "", FT.GetSize(), true);
|
||||
course = AddUpDown(area.left + framewidth + 8, frametop + frameheight + 20, 0, (int)Course.currentCourseList->size() - 1, g_game.course ? (int)Course.GetCourseIdx(g_game.course) : 0);
|
||||
courseName = AddFramedText(area.left, frametop + frameheight + 20, framewidth, frameheight, 3, colMBackgr, "", FT.GetSize(), true);
|
||||
|
@ -194,6 +194,7 @@ void CRaceSelect::Loop(float timestep) {
|
|||
if (courseGroup->GetValue() != prevGroup) {
|
||||
prevGroup = courseGroup->GetValue();
|
||||
Course.currentCourseList = Course.getGroup((size_t)courseGroup->GetValue());
|
||||
g_game.course = nullptr;
|
||||
course->SetValue(0);
|
||||
course->SetMaximum((int)Course.currentCourseList->size()-1);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ GNU General Public License for more details.
|
|||
#include "physics.h"
|
||||
#include <list>
|
||||
|
||||
#define TRACK_WIDTH 0.7
|
||||
#define TRACK_WIDTH 0.7
|
||||
#define MAX_TRACK_MARKS 10000
|
||||
#define SPEED_TO_START_TRENCH 0.0
|
||||
#define TRACK_HEIGHT 0.08
|
||||
|
@ -76,7 +76,7 @@ template<typename T>
|
|||
static T incrementRingIterator(T q) {
|
||||
T ret = q;
|
||||
++ret;
|
||||
if (ret == track_marks.quads.end() || track_marks.quads.size() == MAX_TRACK_MARKS)
|
||||
if (ret == track_marks.quads.end())
|
||||
ret = track_marks.quads.begin();
|
||||
return ret;
|
||||
}
|
||||
|
@ -84,18 +84,12 @@ static T incrementRingIterator(T q) {
|
|||
template<typename T>
|
||||
static T decrementRingIterator(T q) {
|
||||
T ret = q;
|
||||
if (ret == track_marks.quads.begin() && track_marks.quads.size() == MAX_TRACK_MARKS)
|
||||
ret = track_marks.quads.end();
|
||||
else if (ret == track_marks.quads.begin())
|
||||
if (ret == track_marks.quads.begin())
|
||||
return track_marks.quads.end();
|
||||
--ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// draw_track_marks
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
void DrawTrackmarks() {
|
||||
if (param.perf_level < 3 || track_marks.quads.empty())
|
||||
return;
|
||||
|
@ -202,9 +196,6 @@ void break_track_marks() {
|
|||
continuing_track = false;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// add_track_mark
|
||||
// --------------------------------------------------------------------
|
||||
void add_track_mark(const CControl *ctrl, int *id) {
|
||||
if (param.perf_level < 3)
|
||||
return;
|
||||
|
|
|
@ -24,7 +24,7 @@ GNU General Public License for more details.
|
|||
template<typename T>
|
||||
struct TVector2 {
|
||||
T x, y;
|
||||
explicit TVector2(T _x = 0.0, T _y = 0.0)
|
||||
explicit TVector2(T _x = (T)0, T _y = (T)0)
|
||||
: x(_x), y(_y)
|
||||
{}
|
||||
double Length() const {
|
||||
|
@ -51,7 +51,7 @@ struct TVector2 {
|
|||
template<typename T>
|
||||
struct TVector3 {
|
||||
T x, y, z;
|
||||
explicit TVector3(T _x = 0.0, T _y = 0.0, T _z = 0.0)
|
||||
explicit TVector3(T _x = (T)0, T _y = (T)0, T _z = (T)0)
|
||||
: x(_x), y(_y), z(_z)
|
||||
{}
|
||||
double Length() const {
|
||||
|
@ -81,7 +81,7 @@ struct TVector3 {
|
|||
template<typename T>
|
||||
struct TVector4 {
|
||||
T x, y, z, w;
|
||||
explicit TVector4(T _x = 0.0, T _y = 0.0, T _z = 0.0, T _w = 0.0)
|
||||
explicit TVector4(T _x = (T)0, T _y = (T)0, T _z = (T)0, T _w = (T)0)
|
||||
: x(_x), y(_y), z(_z), w(_w)
|
||||
{}
|
||||
double Length() const {
|
||||
|
|
Loading…
Reference in New Issue