mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-05 19:31:04 +00:00
Remove unused pos_max_d
This commit is contained in:
parent
9a44d835d6
commit
c00129360e
11 changed files with 29 additions and 79 deletions
|
@ -96,7 +96,6 @@ void ClientEnvironment::step(float dtime)
|
|||
/*
|
||||
Maximum position increment
|
||||
*/
|
||||
//f32 position_max_increment = 0.05*BS;
|
||||
f32 position_max_increment = 0.1*BS;
|
||||
|
||||
// Maximum time increment (for collision detection etc)
|
||||
|
@ -176,12 +175,11 @@ void ClientEnvironment::step(float dtime)
|
|||
}
|
||||
|
||||
/*
|
||||
Move the lplayer.
|
||||
Move the local player.
|
||||
This also does collision detection.
|
||||
*/
|
||||
|
||||
lplayer->move(dtime_part, this, position_max_increment,
|
||||
&player_collisions);
|
||||
lplayer->move(dtime_part, this, &player_collisions);
|
||||
}
|
||||
|
||||
bool player_immortal = false;
|
||||
|
|
|
@ -1143,11 +1143,10 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
|
|||
box.MinEdge *= BS;
|
||||
box.MaxEdge *= BS;
|
||||
collisionMoveResult moveresult;
|
||||
f32 pos_max_d = BS*0.125; // Distance per iteration
|
||||
v3f p_pos = m_position;
|
||||
v3f p_velocity = m_velocity;
|
||||
moveresult = collisionMoveSimple(env,env->getGameDef(),
|
||||
pos_max_d, box, m_prop.stepheight, dtime,
|
||||
box, m_prop.stepheight, dtime,
|
||||
&p_pos, &p_velocity, m_acceleration,
|
||||
this, m_prop.collideWithObjects);
|
||||
// Apply results
|
||||
|
|
|
@ -209,7 +209,7 @@ bool LocalPlayer::updateSneakNode(Map *map, const v3f &position,
|
|||
return true;
|
||||
}
|
||||
|
||||
void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
void LocalPlayer::move(f32 dtime, Environment *env,
|
||||
std::vector<CollisionInfo> *collision_info)
|
||||
{
|
||||
// Node at feet position, update each ClientEnvironment::step()
|
||||
|
@ -218,7 +218,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||
|
||||
// Temporary option for old move code
|
||||
if (!physics_override.new_move) {
|
||||
old_move(dtime, env, pos_max_d, collision_info);
|
||||
old_move(dtime, env, collision_info);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -320,17 +320,6 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||
nodemgr->get(node2.getContent()).climbable) && !free_move;
|
||||
}
|
||||
|
||||
/*
|
||||
Collision uncertainty radius
|
||||
Make it a bit larger than the maximum distance of movement
|
||||
*/
|
||||
//f32 d = pos_max_d * 1.1;
|
||||
// A fairly large value in here makes moving smoother
|
||||
f32 d = 0.15f * BS;
|
||||
|
||||
// This should always apply, otherwise there are glitches
|
||||
sanity_check(d > pos_max_d);
|
||||
|
||||
// Player object property step height is multiplied by BS in
|
||||
// /src/script/common/c_content.cpp and /src/content_sao.cpp
|
||||
float player_stepheight = (m_cao == nullptr) ? 0.0f :
|
||||
|
@ -341,7 +330,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||
const v3f initial_speed = m_speed;
|
||||
|
||||
collisionMoveResult result = collisionMoveSimple(env, m_client,
|
||||
pos_max_d, m_collisionbox, player_stepheight, dtime,
|
||||
m_collisionbox, player_stepheight, dtime,
|
||||
&position, &m_speed, accel_f, m_cao);
|
||||
|
||||
bool could_sneak = control.sneak && !free_move && !in_liquid &&
|
||||
|
@ -528,12 +517,12 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||
m_can_jump = m_can_jump && jumpspeed != 0.0f;
|
||||
|
||||
// Autojump
|
||||
handleAutojump(dtime, env, result, initial_position, initial_speed, pos_max_d);
|
||||
handleAutojump(dtime, env, result, initial_position, initial_speed);
|
||||
}
|
||||
|
||||
void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d)
|
||||
void LocalPlayer::move(f32 dtime, Environment *env)
|
||||
{
|
||||
move(dtime, env, pos_max_d, NULL);
|
||||
move(dtime, env, nullptr);
|
||||
}
|
||||
|
||||
void LocalPlayer::applyControl(float dtime, Environment *env)
|
||||
|
@ -827,7 +816,7 @@ void LocalPlayer::accelerate(const v3f &target_speed, const f32 max_increase_H,
|
|||
}
|
||||
|
||||
// Temporary option for old move code
|
||||
void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
void LocalPlayer::old_move(f32 dtime, Environment *env,
|
||||
std::vector<CollisionInfo> *collision_info)
|
||||
{
|
||||
Map *map = &env->getMap();
|
||||
|
@ -924,15 +913,6 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||
is_climbing = (nodemgr->get(node.getContent()).climbable ||
|
||||
nodemgr->get(node2.getContent()).climbable) && !free_move;
|
||||
|
||||
/*
|
||||
Collision uncertainty radius
|
||||
Make it a bit larger than the maximum distance of movement
|
||||
*/
|
||||
//f32 d = pos_max_d * 1.1;
|
||||
// A fairly large value in here makes moving smoother
|
||||
f32 d = 0.15f * BS;
|
||||
// This should always apply, otherwise there are glitches
|
||||
sanity_check(d > pos_max_d);
|
||||
// Maximum distance over border for sneaking
|
||||
f32 sneak_max = BS * 0.4f;
|
||||
|
||||
|
@ -971,7 +951,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||
const v3f initial_speed = m_speed;
|
||||
|
||||
collisionMoveResult result = collisionMoveSimple(env, m_client,
|
||||
pos_max_d, m_collisionbox, player_stepheight, dtime,
|
||||
m_collisionbox, player_stepheight, dtime,
|
||||
&position, &m_speed, accel_f, m_cao);
|
||||
|
||||
// Position was slightly changed; update standing node pos
|
||||
|
@ -1155,7 +1135,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
|
|||
}
|
||||
|
||||
// Autojump
|
||||
handleAutojump(dtime, env, result, initial_position, initial_speed, pos_max_d);
|
||||
handleAutojump(dtime, env, result, initial_position, initial_speed);
|
||||
}
|
||||
|
||||
float LocalPlayer::getSlipFactor(Environment *env, const v3f &speedH)
|
||||
|
@ -1178,8 +1158,7 @@ float LocalPlayer::getSlipFactor(Environment *env, const v3f &speedH)
|
|||
}
|
||||
|
||||
void LocalPlayer::handleAutojump(f32 dtime, Environment *env,
|
||||
const collisionMoveResult &result, const v3f &initial_position,
|
||||
const v3f &initial_speed, f32 pos_max_d)
|
||||
const collisionMoveResult &result, v3f initial_position, v3f initial_speed)
|
||||
{
|
||||
PlayerSettings &player_settings = getPlayerSettings();
|
||||
if (!player_settings.autojump)
|
||||
|
@ -1235,7 +1214,7 @@ void LocalPlayer::handleAutojump(f32 dtime, Environment *env,
|
|||
v3f jump_speed = initial_speed;
|
||||
|
||||
// try at peak of jump, zero step height
|
||||
collisionMoveResult jump_result = collisionMoveSimple(env, m_client, pos_max_d,
|
||||
collisionMoveResult jump_result = collisionMoveSimple(env, m_client,
|
||||
m_collisionbox, 0.0f, dtime, &jump_pos, &jump_speed, v3f(0.0f), m_cao);
|
||||
|
||||
// see if we can get a little bit farther horizontally if we had
|
||||
|
|
|
@ -16,6 +16,7 @@ class GenericCAO;
|
|||
class ClientActiveObject;
|
||||
class ClientEnvironment;
|
||||
class IGameDef;
|
||||
struct CollisionInfo;
|
||||
struct collisionMoveResult;
|
||||
|
||||
enum class LocalPlayerAnimation
|
||||
|
@ -68,11 +69,8 @@ public:
|
|||
|
||||
f32 gravity = 0; // total downwards acceleration
|
||||
|
||||
void move(f32 dtime, Environment *env, f32 pos_max_d);
|
||||
void move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
std::vector<CollisionInfo> *collision_info);
|
||||
// Temporary option for old move code
|
||||
void old_move(f32 dtime, Environment *env, f32 pos_max_d,
|
||||
void move(f32 dtime, Environment *env);
|
||||
void move(f32 dtime, Environment *env,
|
||||
std::vector<CollisionInfo> *collision_info);
|
||||
|
||||
void applyControl(float dtime, Environment *env);
|
||||
|
@ -174,10 +172,11 @@ private:
|
|||
const f32 max_increase_V, const bool use_pitch);
|
||||
bool updateSneakNode(Map *map, const v3f &position, const v3f &sneak_max);
|
||||
float getSlipFactor(Environment *env, const v3f &speedH);
|
||||
void old_move(f32 dtime, Environment *env,
|
||||
std::vector<CollisionInfo> *collision_info);
|
||||
void handleAutojump(f32 dtime, Environment *env,
|
||||
const collisionMoveResult &result,
|
||||
const v3f &position_before_move, const v3f &speed_before_move,
|
||||
f32 pos_max_d);
|
||||
v3f position_before_move, v3f speed_before_move);
|
||||
|
||||
v3f m_position;
|
||||
v3s16 m_standing_node;
|
||||
|
|
|
@ -89,7 +89,7 @@ void Particle::step(float dtime, ClientEnvironment *env)
|
|||
aabb3f box(v3f(-m_p.size / 2.0f), v3f(m_p.size / 2.0f));
|
||||
v3f p_pos = m_pos * BS;
|
||||
v3f p_velocity = m_velocity * BS;
|
||||
collisionMoveResult r = collisionMoveSimple(env, env->getGameDef(), BS * 0.5f,
|
||||
collisionMoveResult r = collisionMoveSimple(env, env->getGameDef(),
|
||||
box, 0.0f, dtime, &p_pos, &p_velocity, m_acceleration * BS, nullptr,
|
||||
m_p.object_collision);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue