Remove profiler.h include where it's not needed. Remove some unreachable and very old code
This commit is contained in:
parent
5ebb4237e2
commit
fa7fe510d9
|
@ -162,55 +162,37 @@ void Camera::step(f32 dtime)
|
|||
{
|
||||
//f32 offset = dtime * m_view_bobbing_speed * 0.035;
|
||||
f32 offset = dtime * m_view_bobbing_speed * 0.030;
|
||||
if (m_view_bobbing_state == 2)
|
||||
{
|
||||
#if 0
|
||||
if (m_view_bobbing_state == 2) {
|
||||
// Animation is getting turned off
|
||||
if (m_view_bobbing_anim < 0.5)
|
||||
if (m_view_bobbing_anim < 0.25) {
|
||||
m_view_bobbing_anim -= offset;
|
||||
else
|
||||
m_view_bobbing_anim += offset;
|
||||
if (m_view_bobbing_anim <= 0 || m_view_bobbing_anim >= 1)
|
||||
{
|
||||
m_view_bobbing_anim = 0;
|
||||
m_view_bobbing_state = 0;
|
||||
}
|
||||
#endif
|
||||
#if 1
|
||||
// Animation is getting turned off
|
||||
if(m_view_bobbing_anim < 0.25)
|
||||
{
|
||||
m_view_bobbing_anim -= offset;
|
||||
} else if(m_view_bobbing_anim > 0.75) {
|
||||
} else if (m_view_bobbing_anim > 0.75) {
|
||||
m_view_bobbing_anim += offset;
|
||||
}
|
||||
if(m_view_bobbing_anim < 0.5)
|
||||
{
|
||||
|
||||
if (m_view_bobbing_anim < 0.5) {
|
||||
m_view_bobbing_anim += offset;
|
||||
if(m_view_bobbing_anim > 0.5)
|
||||
if (m_view_bobbing_anim > 0.5)
|
||||
m_view_bobbing_anim = 0.5;
|
||||
} else {
|
||||
m_view_bobbing_anim -= offset;
|
||||
if(m_view_bobbing_anim < 0.5)
|
||||
if (m_view_bobbing_anim < 0.5)
|
||||
m_view_bobbing_anim = 0.5;
|
||||
}
|
||||
if(m_view_bobbing_anim <= 0 || m_view_bobbing_anim >= 1 ||
|
||||
fabs(m_view_bobbing_anim - 0.5) < 0.01)
|
||||
{
|
||||
|
||||
if (m_view_bobbing_anim <= 0 || m_view_bobbing_anim >= 1 ||
|
||||
fabs(m_view_bobbing_anim - 0.5) < 0.01) {
|
||||
m_view_bobbing_anim = 0;
|
||||
m_view_bobbing_state = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
float was = m_view_bobbing_anim;
|
||||
m_view_bobbing_anim = my_modf(m_view_bobbing_anim + offset);
|
||||
bool step = (was == 0 ||
|
||||
(was < 0.5f && m_view_bobbing_anim >= 0.5f) ||
|
||||
(was > 0.5f && m_view_bobbing_anim <= 0.5f));
|
||||
if(step)
|
||||
{
|
||||
if(step) {
|
||||
MtEvent *e = new SimpleTriggerEvent("ViewBobbingStep");
|
||||
m_gamedef->event()->put(e);
|
||||
}
|
||||
|
|
|
@ -458,7 +458,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
|||
pos_f += speed_f * nearest_dtime;
|
||||
dtime -= nearest_dtime;
|
||||
}
|
||||
|
||||
|
||||
bool is_collision = true;
|
||||
if(is_unloaded[nearest_boxindex])
|
||||
is_collision = false;
|
||||
|
@ -561,76 +561,3 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// This doesn't seem to work and isn't used
|
||||
collisionMoveResult collisionMovePrecise(Map *map, IGameDef *gamedef,
|
||||
f32 pos_max_d, const aabb3f &box_0,
|
||||
f32 stepheight, f32 dtime,
|
||||
v3f &pos_f, v3f &speed_f, v3f &accel_f)
|
||||
{
|
||||
//TimeTaker tt("collisionMovePrecise");
|
||||
ScopeProfiler sp(g_profiler, "collisionMovePrecise avg", SPT_AVG);
|
||||
|
||||
collisionMoveResult final_result;
|
||||
|
||||
// If there is no speed, there are no collisions
|
||||
if(speed_f.getLength() == 0)
|
||||
return final_result;
|
||||
|
||||
// Don't allow overly huge dtime
|
||||
if(dtime > 2.0)
|
||||
dtime = 2.0;
|
||||
|
||||
f32 dtime_downcount = dtime;
|
||||
|
||||
u32 loopcount = 0;
|
||||
do
|
||||
{
|
||||
loopcount++;
|
||||
|
||||
// Maximum time increment (for collision detection etc)
|
||||
// time = distance / speed
|
||||
f32 dtime_max_increment = 1.0;
|
||||
if(speed_f.getLength() != 0)
|
||||
dtime_max_increment = pos_max_d / speed_f.getLength();
|
||||
|
||||
// Maximum time increment is 10ms or lower
|
||||
if(dtime_max_increment > 0.01)
|
||||
dtime_max_increment = 0.01;
|
||||
|
||||
f32 dtime_part;
|
||||
if(dtime_downcount > dtime_max_increment)
|
||||
{
|
||||
dtime_part = dtime_max_increment;
|
||||
dtime_downcount -= dtime_part;
|
||||
}
|
||||
else
|
||||
{
|
||||
dtime_part = dtime_downcount;
|
||||
/*
|
||||
Setting this to 0 (no -=dtime_part) disables an infinite loop
|
||||
when dtime_part is so small that dtime_downcount -= dtime_part
|
||||
does nothing
|
||||
*/
|
||||
dtime_downcount = 0;
|
||||
}
|
||||
|
||||
collisionMoveResult result = collisionMoveSimple(map, gamedef,
|
||||
pos_max_d, box_0, stepheight, dtime_part,
|
||||
pos_f, speed_f, accel_f);
|
||||
|
||||
if(result.touching_ground)
|
||||
final_result.touching_ground = true;
|
||||
if(result.collides)
|
||||
final_result.collides = true;
|
||||
if(result.collides_xz)
|
||||
final_result.collides_xz = true;
|
||||
if(result.standing_on_unloaded)
|
||||
final_result.standing_on_unloaded = true;
|
||||
}
|
||||
while(dtime_downcount > 0.001);
|
||||
|
||||
return final_result;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -75,15 +75,6 @@ collisionMoveResult collisionMoveSimple(Environment *env,IGameDef *gamedef,
|
|||
v3f &accel_f,ActiveObject* self=0,
|
||||
bool collideWithObjects=true);
|
||||
|
||||
#if 0
|
||||
// This doesn't seem to work and isn't used
|
||||
// Moves using as many iterations as needed
|
||||
collisionMoveResult collisionMovePrecise(Map *map, IGameDef *gamedef,
|
||||
f32 pos_max_d, const aabb3f &box_0,
|
||||
f32 stepheight, f32 dtime,
|
||||
v3f &pos_f, v3f &speed_f, v3f &accel_f);
|
||||
#endif
|
||||
|
||||
// Helper function:
|
||||
// Checks for collision of a moving aabbox with a static aabbox
|
||||
// Returns -1 if no collision, 0 if X collision, 1 if Y collision, 2 if Z collision
|
||||
|
|
|
@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "collision.h"
|
||||
#include "environment.h"
|
||||
#include "settings.h"
|
||||
#include "profiler.h"
|
||||
#include "serialization.h" // For compressZlib
|
||||
#include "tool.h" // For ToolCapabilities
|
||||
#include "gamedef.h"
|
||||
|
|
|
@ -40,7 +40,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "game.h"
|
||||
#include "defaultsettings.h"
|
||||
#include "gettext.h"
|
||||
#include "profiler.h"
|
||||
#include "log.h"
|
||||
#include "quicktune.h"
|
||||
#include "httpfetch.h"
|
||||
|
|
|
@ -24,7 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "map.h"
|
||||
#include "nodedef.h"
|
||||
#include "voxelalgorithms.h"
|
||||
#include "profiler.h"
|
||||
#include "emerge.h"
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "content_sao.h"
|
||||
#include "nodedef.h"
|
||||
#include "voxelalgorithms.h"
|
||||
#include "profiler.h"
|
||||
#include "settings.h" // For g_settings
|
||||
#include "emerge.h"
|
||||
#include "dungeongen.h"
|
||||
|
|
|
@ -28,7 +28,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "nodedef.h"
|
||||
#include "content_mapnode.h" // For content_mapnode_get_new_name
|
||||
#include "voxelalgorithms.h"
|
||||
#include "profiler.h"
|
||||
#include "settings.h" // For g_settings
|
||||
#include "emerge.h"
|
||||
#include "dungeongen.h"
|
||||
|
|
|
@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "content_sao.h"
|
||||
#include "nodedef.h"
|
||||
#include "voxelalgorithms.h"
|
||||
#include "profiler.h"
|
||||
#include "settings.h" // For g_settings
|
||||
#include "emerge.h"
|
||||
#include "dungeongen.h"
|
||||
|
|
|
@ -119,31 +119,12 @@ void Player::accelerateHorizontal(v3f target_speed, f32 max_increase)
|
|||
f32 dl = d_wanted.getLength();
|
||||
if(dl > max_increase)
|
||||
dl = max_increase;
|
||||
|
||||
|
||||
v3f d = d_wanted.normalize() * dl;
|
||||
|
||||
m_speed.X += d.X;
|
||||
m_speed.Z += d.Z;
|
||||
|
||||
#if 0 // old code
|
||||
if(m_speed.X < target_speed.X - max_increase)
|
||||
m_speed.X += max_increase;
|
||||
else if(m_speed.X > target_speed.X + max_increase)
|
||||
m_speed.X -= max_increase;
|
||||
else if(m_speed.X < target_speed.X)
|
||||
m_speed.X = target_speed.X;
|
||||
else if(m_speed.X > target_speed.X)
|
||||
m_speed.X = target_speed.X;
|
||||
|
||||
if(m_speed.Z < target_speed.Z - max_increase)
|
||||
m_speed.Z += max_increase;
|
||||
else if(m_speed.Z > target_speed.Z + max_increase)
|
||||
m_speed.Z -= max_increase;
|
||||
else if(m_speed.Z < target_speed.Z)
|
||||
m_speed.Z = target_speed.Z;
|
||||
else if(m_speed.Z > target_speed.Z)
|
||||
m_speed.Z = target_speed.Z;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Vertical acceleration (Y), X and Z directions are ignored
|
||||
|
@ -160,16 +141,6 @@ void Player::accelerateVertical(v3f target_speed, f32 max_increase)
|
|||
|
||||
m_speed.Y += d_wanted;
|
||||
|
||||
#if 0 // old code
|
||||
if(m_speed.Y < target_speed.Y - max_increase)
|
||||
m_speed.Y += max_increase;
|
||||
else if(m_speed.Y > target_speed.Y + max_increase)
|
||||
m_speed.Y -= max_increase;
|
||||
else if(m_speed.Y < target_speed.Y)
|
||||
m_speed.Y = target_speed.Y;
|
||||
else if(m_speed.Y > target_speed.Y)
|
||||
m_speed.Y = target_speed.Y;
|
||||
#endif
|
||||
}
|
||||
|
||||
v3s16 Player::getLightPosition() const
|
||||
|
|
Loading…
Reference in New Issue