*/
#include "localplayer.h"
-
+#include <cmath>
#include "event.h"
#include "collision.h"
#include "nodedef.h"
v2f node_p2df(pf.X, pf.Z);
f32 distance_f = player_p2df.getDistanceFrom(node_p2df);
f32 max_axis_distance_f = MYMAX(
- fabs(player_p2df.X - node_p2df.X),
- fabs(player_p2df.Y - node_p2df.Y));
+ std::fabs(player_p2df.X - node_p2df.X),
+ std::fabs(player_p2df.Y - node_p2df.Y));
if (distance_f > min_distance_f ||
max_axis_distance_f > 0.5 * BS + sneak_max + 0.1 * BS)
*/
#include "minimap.h"
+#include <cmath>
#include "client.h"
#include "clientmap.h"
#include "settings.h"
{
if (data->minimap_shape_round) {
return v3f(
- cos(m_angle * core::DEGTORAD),
- sin(m_angle * core::DEGTORAD),
+ std::cos(m_angle * core::DEGTORAD),
+ std::sin(m_angle * core::DEGTORAD),
1.0);
}
core::rect<s32> img_rect(0, 0, imgsize.Width, imgsize.Height);
static const video::SColor col(255, 255, 255, 255);
static const video::SColor c[4] = {col, col, col, col};
- f32 sin_angle = sin(m_angle * core::DEGTORAD);
- f32 cos_angle = cos(m_angle * core::DEGTORAD);
+ f32 sin_angle = std::sin(m_angle * core::DEGTORAD);
+ f32 cos_angle = std::cos(m_angle * core::DEGTORAD);
s32 marker_size2 = 0.025 * (float)size;
for (std::list<v2f>::const_iterator
i = m_active_markers.begin();
float f = 1.0;
float g = 1.0;
for (int i = 0; i < octaves; i++) {
- a += g * fabs(noise2d_gradient(x * f, y * f, seed + i, eased));
+ a += g * std::fabs(noise2d_gradient(x * f, y * f, seed + i, eased));
f *= 2.0;
g *= persistence;
}
float f = 1.0;
float g = 1.0;
for (int i = 0; i < octaves; i++) {
- a += g * fabs(noise3d_gradient(x * f, y * f, z * f, seed + i, eased));
+ a += g * std::fabs(noise3d_gradient(x * f, y * f, z * f, seed + i, eased));
f *= 2.0;
g *= persistence;
}
float contour(float v)
{
- v = fabs(v);
+ v = std::fabs(v);
if (v >= 1.0)
return 0.0;
return (1.0 - v);
np->flags & (NOISE_FLAG_DEFAULTS | NOISE_FLAG_EASED));
if (np->flags & NOISE_FLAG_ABSVALUE)
- noiseval = fabs(noiseval);
+ noiseval = std::fabs(noiseval);
a += g * noiseval;
f *= np->lacunarity;
np->flags & NOISE_FLAG_EASED);
if (np->flags & NOISE_FLAG_ABSVALUE)
- noiseval = fabs(noiseval);
+ noiseval = std::fabs(noiseval);
a += g * noiseval;
f *= np->lacunarity;
// + 2 for the two initial endpoints
// + 1 for potentially crossing a boundary due to offset
- size_t nlx = (size_t)ceil(num_noise_points_x) + 3;
- size_t nly = (size_t)ceil(num_noise_points_y) + 3;
- size_t nlz = is3d ? (size_t)ceil(num_noise_points_z) + 3 : 1;
+ size_t nlx = (size_t)std::ceil(num_noise_points_x) + 3;
+ size_t nly = (size_t)std::ceil(num_noise_points_y) + 3;
+ size_t nlz = is3d ? (size_t)std::ceil(num_noise_points_z) + 3 : 1;
delete[] noise_buf;
try {
Interp2dFxn interpolate = eased ?
biLinearInterpolation : biLinearInterpolationNoEase;
- x0 = floor(x);
- y0 = floor(y);
+ x0 = std::floor(x);
+ y0 = std::floor(y);
u = x - (float)x0;
v = y - (float)y0;
orig_u = u;
Interp3dFxn interpolate = (np.flags & NOISE_FLAG_EASED) ?
triLinearInterpolation : triLinearInterpolationNoEase;
- x0 = floor(x);
- y0 = floor(y);
- z0 = floor(z);
+ x0 = std::floor(x);
+ y0 = std::floor(y);
+ z0 = std::floor(z);
u = x - (float)x0;
v = y - (float)y0;
w = z - (float)z0;
g *= np.persist;
}
- if (fabs(np.offset - 0.f) > 0.00001 || fabs(np.scale - 1.f) > 0.00001) {
+ if (std::fabs(np.offset - 0.f) > 0.00001 || std::fabs(np.scale - 1.f) > 0.00001) {
for (size_t i = 0; i != bufsize; i++)
result[i] = result[i] * np.scale + np.offset;
}
g *= np.persist;
}
- if (fabs(np.offset - 0.f) > 0.00001 || fabs(np.scale - 1.f) > 0.00001) {
+ if (std::fabs(np.offset - 0.f) > 0.00001 || std::fabs(np.scale - 1.f) > 0.00001) {
for (size_t i = 0; i != bufsize; i++)
result[i] = result[i] * np.scale + np.offset;
}
if (np.flags & NOISE_FLAG_ABSVALUE) {
if (persistence_map) {
for (size_t i = 0; i != bufsize; i++) {
- result[i] += gmap[i] * fabs(gradient_buf[i]);
+ result[i] += gmap[i] * std::fabs(gradient_buf[i]);
gmap[i] *= persistence_map[i];
}
} else {
for (size_t i = 0; i != bufsize; i++)
- result[i] += g * fabs(gradient_buf[i]);
+ result[i] += g * std::fabs(gradient_buf[i]);
}
} else {
if (persistence_map) {