Skip to content

Commit

Permalink
More opos
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Aug 3, 2023
1 parent bea7d5b commit e48f643
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/client/localplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, opos_t pos_max_d,
bool free_move = player_settings.free_move && fly_allowed;

if (noclip && free_move) {
position += v3fToOpos(m_speed * dtime);
position += v3fToOpos(m_speed) * dtime;
setPosition(position);

touching_ground = false;
Expand Down Expand Up @@ -296,7 +296,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, opos_t pos_max_d,
*/
//f32 d = pos_max_d * 1.1;
// A fairly large value in here makes moving smoother
f32 d = 0.15f * BS;
opos_t d = 0.15f * BS;

// This should always apply, otherwise there are glitches
sanity_check(d > pos_max_d);
Expand Down Expand Up @@ -980,7 +980,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, opos_t pos_max_d,
for (s16 x= -1; x <= 1; x++)
for (s16 z= -1; z <= 1; z++) {
v3pos_t p = pos_i_bottom + v3pos_t(x, 0, z);
auto pf = intToFloat(p, BS);
v3opos_t pf = intToFloat(p, BS);
v2opos_t node_p2df(pf.X, pf.Z);
opos_t distance_f = player_p2df.getDistanceFrom(node_p2df);
opos_t max_axis_distance_f = MYMAX(
Expand Down Expand Up @@ -1016,7 +1016,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, opos_t pos_max_d,
m_sneak_node_exists = sneak_node_found;

if (sneak_node_found) {
f32 cb_max = 0.0f;
opos_t cb_max = 0.0f;
MapNode n = map->getNode(m_sneak_node);
std::vector<aabb3f> nodeboxes;
n.getCollisionBoxes(nodemgr, &nodeboxes);
Expand Down
7 changes: 4 additions & 3 deletions src/server/player_sao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/

#include "player_sao.h"
#include "irrlichttypes.h"
#include "nodedef.h"
#include "remoteplayer.h"
#include "scripting_server.h"
Expand Down Expand Up @@ -595,16 +596,16 @@ bool PlayerSAO::checkMovementCheat()
too, and much more lightweight.
*/

float override_max_H, override_max_V;
opos_t override_max_H, override_max_V;
if (m_max_speed_override_time > 0.0f) {
override_max_H = MYMAX(fabs(m_max_speed_override.X), fabs(m_max_speed_override.Z));
override_max_V = fabs(m_max_speed_override.Y);
} else {
override_max_H = override_max_V = 0.0f;
}

float player_max_walk = 0; // horizontal movement
float player_max_jump = 0; // vertical upwards movement
opos_t player_max_walk = 0; // horizontal movement
opos_t player_max_jump = 0; // vertical upwards movement

if (m_privs.count("fast") != 0)
player_max_walk = m_player->movement_speed_fast; // Fast speed
Expand Down

0 comments on commit e48f643

Please sign in to comment.