Applied patch by Mattias Ugelvik:

- Use different coloring in HUD in event mode to indicate how well the player does
- Added missing std:: prefixes for min() and max() functions

Define NOMINMAX in VS solution to get rid of the WinAPI definition of min() and max() as macros.

git-svn-id: https://svn.code.sf.net/p/extremetuxracer/code/trunk@601 0420edf4-82e4-42fc-9478-35b55e6d67a3
master
pkeus 2016-01-19 13:27:21 +00:00
parent 7420115fbe
commit ee35f1a467
18 changed files with 105 additions and 70 deletions

View File

@ -90,7 +90,7 @@
<CompileAsWinRT>false</CompileAsWinRT>
<WarningLevel>Level4</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;NOMINMAX;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ForcedIncludeFiles>windows.h;bh.h</ForcedIncludeFiles>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>bh.h</PrecompiledHeaderFile>
@ -109,7 +109,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;NOMINMAX;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ForcedIncludeFiles>windows.h;bh.h</ForcedIncludeFiles>
<CompileAsWinRT>false</CompileAsWinRT>
<WarningLevel>Level4</WarningLevel>
@ -139,7 +139,7 @@
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<StringPooling>true</StringPooling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ForcedIncludeFiles>windows.h;bh.h</ForcedIncludeFiles>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>bh.h</PrecompiledHeaderFile>
@ -162,7 +162,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<ForcedIncludeFiles>windows.h;bh.h</ForcedIncludeFiles>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAsWinRT>false</CompileAsWinRT>
<WarningLevel>Level4</WarningLevel>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>

View File

@ -51,6 +51,11 @@ const sf::Color colTBackr = TColor(0.4, 0.6, 0.8, 0.0);
const sf::Color colMess = TColor(0.3, 0.3, 0.7, 1.0);
const sf::Color colSky = TColor(0.82, 0.86, 0.88, 1.0);
const sf::Color colBronze = sf::Color(205, 127, 50, 255);
const sf::Color colSilver = sf::Color(192, 192, 192, 255);
const sf::Color colGold = sf::Color(255, 215, 0, 255);
const sf::Color colGreen = sf::Color(0, 128, 0, 255);
// --------------------------------------------------------------------
// print utils
// --------------------------------------------------------------------

View File

@ -22,7 +22,7 @@ GNU General Public License for more details.
#include "matrices.h"
#define clamp(minimum, x, maximum) (max(min(x, maximum), minimum))
#define clamp(minimum, x, maximum) (std::max(std::min(x, maximum), minimum))
#ifndef ROUND_TO_NEAREST
# define ROUND_TO_NEAREST(x) ((int) ((x)+0.5))
@ -71,6 +71,11 @@ extern const sf::Color colMBackgr;
extern const sf::Color colLBackgr;
extern const sf::Color colMess;
extern const sf::Color colSky;
extern const sf::Color colBronze;
extern const sf::Color colSilver;
extern const sf::Color colGold;
extern const sf::Color colGreen;
// --------------------------------------------------------------------
// print utils

View File

@ -169,7 +169,7 @@ void CGameConfig::Enter() {
columnAnchor = 0;
for (int i = 0; i < 5; i++) {
descriptions[i] = AddLabel(Trans.Text(32 + i), area.left, area.top + dd*(i + 1), colWhite);
columnAnchor = max(columnAnchor, (int)descriptions[i]->GetSize().x);
columnAnchor = std::max(columnAnchor, (int)descriptions[i]->GetSize().x);
}
columnAnchor += area.left + 20*Winsys.scale;

View File

@ -964,8 +964,8 @@ TVector3d CCourse::FindCourseNormal(double x, double z) const {
TVector3d tri_nml = CrossProduct(p1 - p0, p2 - p0);
tri_nml.Norm();
double min_bary = min(u, min(v, 1. - u - v));
double interp_factor = min(min_bary / NORM_INTERPOL, 1.0);
double min_bary = std::min(u, std::min(v, 1. - u - v));
double interp_factor = std::min(min_bary / NORM_INTERPOL, 1.0);
TVector3d interp_nml = interp_factor * tri_nml + (1.-interp_factor) * smooth_nml;
interp_nml.Norm();

View File

@ -28,6 +28,8 @@ GNU General Public License for more details.
#include "course.h"
#include "physics.h"
#include "winsys.h"
#include "game_ctrl.h"
#include <algorithm>
#define GAUGE_IMG_SIZE 128
@ -52,11 +54,11 @@ static const GLubyte energy_foreground_color[] = { 138, 150, 255, 128 };
static const GLubyte speedbar_background_color[] = { 51, 51, 51, 0 };
static const GLubyte hud_white[] = { 255, 255, 255, 255 };
static void draw_time() {
static void draw_time(double time, sf::Color color) {
Tex.Draw(T_TIME, 10, 10, 1);
int min, sec, hundr;
GetTimeComponents(g_game.time, &min, &sec, &hundr);
GetTimeComponents(time, &min, &sec, &hundr);
std::string timestr = Int_StrN(min, 2);
std::string secstr = Int_StrN(sec, 2);
std::string hundrstr = Int_StrN(hundr, 2);
@ -65,11 +67,11 @@ static void draw_time() {
timestr += secstr;
if (param.use_papercut_font < 2) {
Tex.DrawNumStr(timestr, 50, 12, 1, colWhite);
Tex.DrawNumStr(hundrstr, 170, 12, 0.7f, colWhite);
Tex.DrawNumStr(timestr, 50, 12, 1, color);
Tex.DrawNumStr(hundrstr, 170, 12, 0.7f, color);
} else {
Winsys.beginSFML();
FT.SetColor(colDYell);
FT.SetColor(color);
FT.SetSize(30);
FT.DrawString(138, 3, hundrstr);
FT.SetSize(42);
@ -78,15 +80,15 @@ static void draw_time() {
}
}
static void draw_herring_count(int herring_count) {
static void draw_herring_count(int herring_count, sf::Color color) {
Tex.Draw(HERRING_ICON, Winsys.resolution.width - 59, 12, 1);
std::string hcountstr = Int_StrN(herring_count, 3);
if (param.use_papercut_font < 2) {
Tex.DrawNumStr(hcountstr, Winsys.resolution.width - 130, 12, 1, colWhite);
Tex.DrawNumStr(hcountstr, Winsys.resolution.width - 130, 12, 1, color);
} else {
Winsys.beginSFML();
FT.SetColor(colDYell);
FT.SetColor(color);
FT.DrawString(Winsys.resolution.width - 125, 3, hcountstr);
Winsys.endSFML();
}
@ -193,7 +195,7 @@ void draw_gauge(double speed, double energy) {
Tex.BindTex(GAUGE_SPEED);
draw_partial_tri_fan(1.0);
glColor4ubv(hud_white);
draw_partial_tri_fan(min(1.0, speedbar_frac));
draw_partial_tri_fan(std::min(1.0, speedbar_frac));
glColor4ubv(hud_white);
Tex.BindTex(GAUGE_OUTLINE);
@ -369,8 +371,30 @@ void DrawHud(const CControl *ctrl) {
draw_gauge(speed * 3.6, ctrl->jump_amt);
ScopedRenderMode rm(TEXFONT);
draw_time();
draw_herring_count(g_game.herring);
if (g_game.game_type == CUPRACING) {
if (g_game.time < g_game.race->time.z)
draw_time(g_game.race->time.z - g_game.time, colGold);
else if (g_game.time < g_game.race->time.y)
draw_time(g_game.race->time.y - g_game.time, colSilver);
else if (g_game.time < g_game.race->time.x)
draw_time(g_game.race->time.x - g_game.time, colBronze);
else
draw_time(g_game.time, colDRed);
if (g_game.herring < g_game.race->herrings.x)
draw_herring_count(g_game.race->herrings.x - g_game.herring, colBronze);
else if (g_game.herring < g_game.race->herrings.y)
draw_herring_count(g_game.race->herrings.y - g_game.herring, colSilver);
else if (g_game.herring < g_game.race->herrings.z)
draw_herring_count(g_game.race->herrings.z - g_game.herring, colGold);
else
draw_herring_count(g_game.herring, colGreen);
} else {
draw_time(g_game.time, param.use_papercut_font < 2 ? colWhite : colDYell);
draw_herring_count(g_game.herring, param.use_papercut_font < 2 ? colWhite : colDYell);
}
DrawSpeed(speed * 3.6);
DrawFps();
DrawCoursePosition(ctrl);

View File

@ -410,7 +410,7 @@ std::size_t CKeyframe::DeleteFrame(std::size_t idx) {
std::vector<TKeyframe>::iterator i = frames.begin();
std::advance(i, idx);
frames.erase(i);
return max(idx, frames.size() - 2);
return std::max(idx, frames.size() - 2);
}
void CKeyframe::InsertFrame(std::size_t idx) {

View File

@ -399,38 +399,38 @@ void generate_particles(const CControl *ctrl, double dtime, const TVector3d& pos
double brake_particles = dtime *
BRAKE_PARTICLES * (ctrl->is_braking ? 1.0 : 0.0)
* min(speed / PARTICLE_SPEED_FACTOR, 1.0);
* std::min(speed / PARTICLE_SPEED_FACTOR, 1.0);
double turn_particles = dtime * MAX_TURN_PARTICLES
* min(speed / PARTICLE_SPEED_FACTOR, 1.0);
* std::min(speed / PARTICLE_SPEED_FACTOR, 1.0);
double roll_particles = dtime * MAX_ROLL_PARTICLES
* min(speed / PARTICLE_SPEED_FACTOR, 1.0);
* std::min(speed / PARTICLE_SPEED_FACTOR, 1.0);
double left_particles = turn_particles *
fabs(min(ctrl->turn_fact, 0.)) +
fabs(std::min(ctrl->turn_fact, 0.)) +
brake_particles +
roll_particles * fabs(min(ctrl->turn_animation, 0.));
roll_particles * fabs(std::min(ctrl->turn_animation, 0.));
double right_particles = turn_particles *
fabs(max(ctrl->turn_fact, 0.)) +
fabs(std::max(ctrl->turn_fact, 0.)) +
brake_particles +
roll_particles * fabs(max(ctrl->turn_animation, 0.));
roll_particles * fabs(std::max(ctrl->turn_animation, 0.));
left_particles = adjust_particle_count(left_particles);
right_particles = adjust_particle_count(right_particles);
TMatrix<4, 4> rot_mat = RotateAboutVectorMatrix(
ctrl->cdirection,
max(-MAX_PARTICLE_ANGLE,
-MAX_PARTICLE_ANGLE * speed / MAX_PARTICLE_ANGLE_SPEED));
std::max(-MAX_PARTICLE_ANGLE,
-MAX_PARTICLE_ANGLE * speed / MAX_PARTICLE_ANGLE_SPEED));
TVector3d left_part_vel = TransformVector(rot_mat, ctrl->plane_nml);
left_part_vel *= min(MAX_PARTICLE_SPEED, speed * PARTICLE_SPEED_MULTIPLIER);
left_part_vel *= std::min(MAX_PARTICLE_SPEED, speed * PARTICLE_SPEED_MULTIPLIER);
rot_mat = RotateAboutVectorMatrix(
ctrl->cdirection,
min(MAX_PARTICLE_ANGLE,
MAX_PARTICLE_ANGLE * speed / MAX_PARTICLE_ANGLE_SPEED));
std::min(MAX_PARTICLE_ANGLE,
MAX_PARTICLE_ANGLE * speed / MAX_PARTICLE_ANGLE_SPEED));
TVector3d right_part_vel = TransformVector(rot_mat, ctrl->plane_nml);
right_part_vel *= min(MAX_PARTICLE_SPEED, speed * PARTICLE_SPEED_MULTIPLIER);
right_part_vel *= std::min(MAX_PARTICLE_SPEED, speed * PARTICLE_SPEED_MULTIPLIER);
create_new_particles(left_part_pt, left_part_vel,

View File

@ -171,7 +171,7 @@ void CControl::AdjustTreeCollision(const TVector3d& pos, TVector3d *vel) {
*vel += (-factor * costheta) * treeNml;
vel->Norm();
}
speed = max(speed, minSpeed);
speed = std::max(speed, minSpeed);
*vel *= speed;
}
}
@ -203,7 +203,7 @@ void CControl::CheckItemCollection(const TVector3d& pos) {
void CControl::AdjustVelocity() {
double speed = cvel.Norm();
speed = max(minSpeed, speed);
speed = std::max(minSpeed, speed);
cvel *= speed;
if (g_game.finish == true) {
@ -257,8 +257,8 @@ TVector3d CControl::CalcRollNormal(double speed) {
if (is_braking) roll_angle = BRAKING_ROLL_ANGLE;
double angle = turn_fact * roll_angle *
min(1.0, max(0.0, ff.frict_coeff) / IDEAL_ROLL_FRIC) *
min(1.0, max(0.0, speed - minSpeed) / (IDEAL_ROLL_SPEED - minSpeed));
std::min(1.0, std::max(0.0, ff.frict_coeff) / IDEAL_ROLL_FRIC) *
std::min(1.0, std::max(0.0, speed - minSpeed) / (IDEAL_ROLL_SPEED - minSpeed));
TMatrix<4, 4> rot_mat = RotateAboutVectorMatrix(vel, angle);
return TransformVector(rot_mat, ff.surfnml);
@ -283,9 +283,9 @@ TVector3d CControl::CalcAirForce() {
TVector3d CControl::CalcSpringForce() {
double springvel = DotProduct(ff.vel, ff.rollnml);
double springfact = min(ff.compression, 0.05) * 1500;
double springfact = std::min(ff.compression, 0.05) * 1500;
springfact += clamp(0.0, ff.compression - 0.05, 0.12) * 3000;
springfact += max(0.0, ff.compression - 0.12 - 0.05) * 10000;
springfact += std::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;
@ -321,7 +321,7 @@ TVector3d CControl::CalcJumpForce() {
TVector3d CControl::CalcFrictionForce(double speed, const TVector3d& nmlforce) {
if ((cairborne == false && speed > minFrictspeed) || g_game.finish) {
double fric_f_mag = nmlforce.Length() * ff.frict_coeff;
fric_f_mag = min(MAX_FRICT_FORCE, fric_f_mag);
fric_f_mag = std::min(MAX_FRICT_FORCE, fric_f_mag);
TVector3d frictforce = fric_f_mag * ff.frictdir;
double steer_angle = turn_fact * MAX_TURN_ANGLE;
@ -368,9 +368,9 @@ TVector3d CControl::CalcPaddleForce(double speed) {
paddleforce.z = -TUX_MASS * EARTH_GRAV / 4.0;
paddleforce = RotateVector(corientation, paddleforce);
} else {
double factor = -min(MAX_PADD_FORCE, MAX_PADD_FORCE
* (MAX_PADDLING_SPEED - speed) / MAX_PADDLING_SPEED
* min(1.0, ff.frict_coeff / IDEAL_PADD_FRIC));
double factor = -std::min(MAX_PADD_FORCE, MAX_PADD_FORCE
* (MAX_PADDLING_SPEED - speed) / MAX_PADDLING_SPEED
* std::min(1.0, ff.frict_coeff / IDEAL_PADD_FRIC));
paddleforce = factor * ff.frictdir;
}
} else return paddleforce;
@ -433,7 +433,7 @@ TVector3d CControl::CalcNetForce(const TVector3d& pos, const TVector3d& vel) {
double CControl::AdjustTimeStep(double h, const TVector3d& vel) {
double speed = vel.Length();
h = clamp(MIN_TIME_STEP, h, MAX_STEP_DIST / speed);
h = min(h, MAX_TIME_STEP);
h = std::min(h, MAX_TIME_STEP);
return h;
}
@ -548,7 +548,7 @@ void CControl::SolveOdeSystem(double timestep) {
done = false;
if (!failed) {
failed = true;
h *= max(0.5, 0.8 * pow(tol/err, solver.TimestepExponent()));
h *= std::max(0.5, 0.8 * pow(tol/err, solver.TimestepExponent()));
} else h *= 0.5;
h = AdjustTimeStep(h, saved_vel);

View File

@ -571,7 +571,7 @@ bool quadsquare::VertexTest(int x, float y, int z, float error,
float dx = fabs(x - Viewer[0]) * fabs(ScaleX);
float dy = fabs(y - Viewer[1]);
float dz = fabs(z - Viewer[2]) * fabs(ScaleZ);
float d = max(dx, max(dy, dz));
float d = std::max(dx, std::max(dy, dz));
if (vertex_loc == South && ForceSouthVert && d < VERTEX_FORCE_THRESHOLD) {
return true;
@ -591,7 +591,7 @@ bool quadsquare::BoxTest(int x, int z, float size, float miny, float maxy, float
float dx = (fabs(x + half - Viewer[0]) - half) * fabs(ScaleX);
float dy = fabs((miny + maxy) * 0.5f - Viewer[1]) - (maxy - miny) * 0.5f;
float dz = (fabs(z + half - Viewer[2]) - half) * fabs(ScaleZ);
float d = max(dx, max(dy , dz));
float d = std::max(dx, std::max(dy , dz));
if (d < ERROR_MAGNIFICATION_THRESHOLD) {
error *= ERROR_MAGNIFICATION_AMOUNT;
@ -1084,7 +1084,7 @@ static int get_root_level(int nx, int nz) {
int xlev = (int)(log(static_cast<double>(nx)) / log(2.0));
int zlev = (int)(log(static_cast<double>(nz)) / log(2.0));
return max(xlev, zlev);
return std::max(xlev, zlev);
}

View File

@ -171,7 +171,7 @@ static void CalcJumpEnergy(float time_step) {
CControl *ctrl = g_game.player->ctrl;
if (ctrl->jump_charging) {
ctrl->jump_amt = min(MAX_JUMP_AMT, g_game.time - charge_start_time);
ctrl->jump_amt = std::min(MAX_JUMP_AMT, g_game.time - charge_start_time);
} else if (ctrl->jumping) {
ctrl->jump_amt *= (1.0 - (g_game.time - ctrl->jump_start_time) /
JUMP_FORCE_DURATION);
@ -181,7 +181,7 @@ static void CalcJumpEnergy(float time_step) {
}
static int CalcSoundVol(float fact) {
return min(param.sound_volume * fact, 100.f);
return std::min(param.sound_volume * fact, 100.f);
}
static void SetSoundVolumes() {
@ -239,7 +239,7 @@ void CRacing::Enter() {
// this function is not used yet.
/*static 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)) +
return (int)(std::min((((pow(ctrl->turn_fact, 2) * 128)) +
(ctrl->is_braking ? 128:0) +
(ctrl->jumping ? 128:0) + 20) * (speed / 10), 128.0));
} else { // always

View File

@ -80,10 +80,10 @@ void CReset::Loop(float time_step) {
if (best_loc == -1) { // Fallback in case there are no reset points
ctrl->cpos.x = Course.GetDimensions().x/2.0;
ctrl->cpos.z = min(ctrl->cpos.z + 10, -1.0);
ctrl->cpos.z = std::min(ctrl->cpos.z + 10, -1.0);
} else if (Course.NocollArr[best_loc].pt.z <= ctrl->cpos.z) {
ctrl->cpos.x = Course.GetDimensions().x/2.0;
ctrl->cpos.z = min(ctrl->cpos.z + 10, -1.0);
ctrl->cpos.z = std::min(ctrl->cpos.z + 10, -1.0);
} else {
ctrl->cpos.x = Course.NocollArr[best_loc].pt.x;
ctrl->cpos.z = Course.NocollArr[best_loc].pt.z;

View File

@ -275,7 +275,7 @@ void CScore::Loop(float timestep) {
FT.SetColor(colWhite);
FT.AutoSizeN(3);
if (list != nullptr && list->numScores > 0) {
for (int i=0; i<min(MAX_SCORES, list->numScores); i++) {
for (int i=0; i<std::min(MAX_SCORES, list->numScores); i++) {
int y = listtop + i*linedist;
FT.DrawString(area.left, y, ordinals[i]);
FT.DrawString(area.left + dd1, y, Int_StrN(list->scores[i].points));

View File

@ -118,7 +118,7 @@ void State::Manager::PollEvent() {
void State::Manager::CallLoopFunction() {
check_gl_error();
g_game.time_step = max(0.0001f, timer.getElapsedTime().asSeconds());
g_game.time_step = std::max(0.0001f, timer.getElapsedTime().asSeconds());
timer.restart();
current->Loop(g_game.time_step);
}

View File

@ -182,7 +182,7 @@ bool CTexture::LoadTextureList() {
if (list.Load(param.tex_dir, "textures.lst")) {
for (CSPList::const_iterator line = list.cbegin(); line != list.cend(); ++line) {
int id = SPIntN(*line, "id", -1);
CommonTex.resize(max(CommonTex.size(), (std::size_t)id+1));
CommonTex.resize(std::max(CommonTex.size(), (std::size_t)id+1));
std::string texfile = SPStrN(*line, "file");
bool rep = SPBoolN(*line, "repeat", false);
if (id >= 0) {

View File

@ -189,8 +189,8 @@ void break_track_marks() {
q->t4 = TVector2d(1.0, 1.0);
std::list<track_quad_t>::iterator qprev = decrementRingIterator(q);
if (qprev != track_marks.quads.end()) {
qprev->t3.y = max(qprev->t3.y+0.5, qprev->t1.y+1.0);
qprev->t4.y = max(qprev->t3.y+0.5, qprev->t1.y+1.0);
qprev->t3.y = std::max(qprev->t3.y+0.5, qprev->t1.y+1.0);
qprev->t4.y = std::max(qprev->t3.y+0.5, qprev->t1.y+1.0);
}
}
continuing_track = false;
@ -285,7 +285,7 @@ void add_track_mark(const CControl *ctrl, int *id) {
if (qprev->track_type == TRACK_TAIL)
qprev->track_type = TRACK_MARK;
}
q->alpha = min(static_cast<int>((2*comp_depth-dist_from_surface)/(4*comp_depth)*255), 255);
q->alpha = std::min(static_cast<int>((2*comp_depth-dist_from_surface)/(4*comp_depth)*255), 255);
continuing_track = true;
}

View File

@ -529,7 +529,7 @@ void CCharShape::AdjustOrientation(CControl *ctrl, double dtime,
ctrl->corientation = InterpolateQuaternions(
ctrl->corientation, new_orient,
min(dtime / time_constant, 1.0));
std::min(dtime / time_constant, 1.0));
ctrl->plane_nml = RotateVector(ctrl->corientation, minus_z_vec);
ctrl->cdirection = RotateVector(ctrl->corientation, y_vec);
@ -564,8 +564,8 @@ void CCharShape::AdjustJoints(double turnFact, bool isBraking,
ext_paddling_angle = MAX_EXT_PADDLING_ANGLE2 * sin(paddling_factor * M_PI);
kick_paddling_angle = MAX_KICK_PADDLING_ANGLE2 * sin(paddling_factor * M_PI * 2.0);
turning_angle[0] = max(-turnFact,0.0) * MAX_ARM_ANGLE2;
turning_angle[1] = max(turnFact,0.0) * MAX_ARM_ANGLE2;
turning_angle[0] = std::max(-turnFact,0.0) * MAX_ARM_ANGLE2;
turning_angle[1] = std::max(turnFact,0.0) * MAX_ARM_ANGLE2;
flap_angle = MAX_ARM_ANGLE2 * (0.5 + 0.5 * sin(M_PI * flap_factor * 6 - M_PI / 2));
force_angle = clamp(-20.0, -net_force.z / 300.0, 20.0);
turn_leg_angle = turnFact * 10;
@ -573,9 +573,9 @@ void CCharShape::AdjustJoints(double turnFact, bool isBraking,
ResetJoints();
RotateNode("left_shldr", 3,
min(braking_angle + paddling_angle + turning_angle[0], MAX_ARM_ANGLE2) + flap_angle);
std::min(braking_angle + paddling_angle + turning_angle[0], MAX_ARM_ANGLE2) + flap_angle);
RotateNode("right_shldr", 3,
min(braking_angle + paddling_angle + turning_angle[1], MAX_ARM_ANGLE2) + flap_angle);
std::min(braking_angle + paddling_angle + turning_angle[1], MAX_ARM_ANGLE2) + flap_angle);
RotateNode("left_shldr", 2, -ext_paddling_angle);
RotateNode("right_shldr", 2, ext_paddling_angle);
@ -583,11 +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.0, speed) + kick_paddling_angle + force_angle);
-10 + turn_leg_angle - std::min(35.0, speed) + kick_paddling_angle + force_angle);
RotateNode("right_knee", 3,
-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));
-10 - turn_leg_angle - std::min(35.0, speed) - kick_paddling_angle + force_angle);
RotateNode("left_ankle", 3, -20 + std::min(50.0, speed));
RotateNode("right_ankle", 3, -20 + std::min(50.0, speed));
RotateNode("tail", 3, turnFact * 20);
RotateNode("neck", 3, -50);
RotateNode("head", 3, -30);

View File

@ -24,6 +24,7 @@ GNU General Public License for more details.
#include "ogl.h"
#include "physics.h"
#include "winsys.h"
#include <algorithm>
#define MIN_CAMERA_HEIGHT 1.5
#define ABSOLUTE_MIN_CAMERA_HEIGHT 0.3
@ -77,7 +78,7 @@ TVector3d interpolate_view_pos(const TVector3d& ctrl_pos1, const TVector3d& ctrl
TQuaternion q1 = MakeRotationQuaternion(y_vec, vec1);
TQuaternion q2 = MakeRotationQuaternion(y_vec, vec2);
double alpha = min(MAX_INTERPOLATION_VALUE, 1.f - exp(-dt / time_constant));
double alpha = std::min(MAX_INTERPOLATION_VALUE, 1.f - exp(-dt / time_constant));
q2 = InterpolateQuaternions(q1, q2, alpha);
vec2 = RotateVector(q2, y_vec);
@ -110,7 +111,7 @@ void interpolate_view_frame(const TVector3d& up1, const TVector3d& dir1,
TMatrix<4, 4> cob_mat2(x2, y2, z2);
TQuaternion q2 = MakeQuaternionFromMatrix(cob_mat2);
double alpha = min(MAX_INTERPOLATION_VALUE, 1.0 - exp(-dt / time_constant));
double alpha = std::min(MAX_INTERPOLATION_VALUE, 1.f - exp(-dt / (float)time_constant));
q2 = InterpolateQuaternions(q1, q2, alpha);
cob_mat2 = MakeMatrixFromQuaternion(q2);