["PitchMove"] = "pitch_move",
["AutoJump"] = "autojump",
["Jesus"] = "jesus",
+ ["NoSlow"] = "no_slow",
+
},
["Render"] = {
["Xray"] = "xray",
["NoHurtCam"] = "no_hurt_cam",
["BrightNight"] = "no_night",
["Coords"] = "coords",
+ ["Tracers"] = "enable_tracers",
},
["World"] = {
["FastDig"] = "fastdig",
},
["Player"] = {
["NoFallDamage"] = "prevent_natural_damage",
+ ["NoForceRotate"] = "no_force_rotate",
},
}
coords (Coords) bool false
point_liquids (PointLiquids) bool false
+
+log_particles (ParticleExploit) bool false
+
+spamclick (FastHit) bool false
+
+no_force_rotate (NoForceRotate) bool false
+
+enable_tracers (Tracers) bool false
+
+no_slow (NoSlow) bool false
// Will fill up 12 + 12 + 4 + 4 + 4 bytes
void writePlayerPos(LocalPlayer *myplayer, ClientMap *clientMap, NetworkPacket *pkt)
-{
- v3f pf = myplayer->getPosition() * 100;
- v3f sf = myplayer->getSpeed() * 100;
+{
+ v3f pf = myplayer->getLegitPosition() * 100;
+ v3f sf = myplayer->getLegitSpeed() * 100;
s32 pitch = myplayer->getPitch() * 100;
s32 yaw = myplayer->getYaw() * 100;
u32 keyPressed = myplayer->keyPressed;
void GenericCAO::updateNametag()
{
- if (m_is_local_player) // No nametag for local player
+ if (m_is_local_player && ! g_settings->getBool("freecam")) // No nametag for local player
return;
if (m_prop.nametag.empty()) {
void GenericCAO::step(float dtime, ClientEnvironment *env)
{
// Handle model animations and update positions instantly to prevent lags
- if (m_is_local_player && ! g_settings->getBool("freecam")) {
+ if (m_is_local_player) {
LocalPlayer *player = m_env->getLocalPlayer();
- m_position = player->getPosition();
+ m_position = player->getLegitPosition();
pos_translator.val_current = m_position;
- m_rotation.Y = wrapDegrees_0_360(player->getYaw());
- rot_translator.val_current = m_rotation;
+ if (! g_settings->getBool("freecam")) {
+ m_rotation.Y = wrapDegrees_0_360(player->getYaw());
+ rot_translator.val_current = m_rotation;
+ }
if (m_is_visible) {
int old_anim = player->last_animation;
const PlayerControl &controls = player->getPlayerControl();
bool walking = false;
- if (controls.up || controls.down || controls.left || controls.right ||
+ if ((controls.up || controls.down || controls.left || controls.right ||
controls.forw_move_joystick_axis != 0.f ||
- controls.sidew_move_joystick_axis != 0.f)
+ controls.sidew_move_joystick_axis != 0.f) && ! g_settings->getBool("freecam"))
walking = true;
f32 new_speed = player->local_animation_speed;
m_client->checkLocalPrivilege("fly"))))
new_speed *= 1.5;
// slowdown speed if sneeking
- if (controls.sneak && walking)
+ if (controls.sneak && walking && ! g_settings->getBool("no_slow"))
new_speed /= 2;
if (walking && (controls.LMB || controls.RMB)) {
if (!createClient(start_data))
return false;
- RenderingEngine::initialize(client, hud);
+ RenderingEngine::initialize(client, hud, m_tracers);
return true;
}
}
#endif
RenderingEngine::draw_scene(skycolor, m_game_ui->m_flags.show_hud,
- m_game_ui->m_flags.show_minimap, draw_wield_tool, draw_crosshair);
+ m_game_ui->m_flags.show_minimap, draw_wield_tool, draw_crosshair, g_settings->getBool("enable_tracers"));
/*
Profiler graph
if (m_game_ui->m_flags.show_cheat_menu && ! gui_chat_console->isOpen())
m_cheat_menu->draw(driver, m_game_ui->m_flags.show_debug);
- /*
- Tracers
- */
-
- m_tracers->draw(driver);
-
/*
Damage flash
*/
if (player->hurt_tilt_timer > 0.0f) {
player->hurt_tilt_timer -= dtime * 6.0f;
- if (player->hurt_tilt_timer < 0.0f)
+ if (player->hurt_tilt_timer < 0.0f || g_settings->getBool("no_hurt_cam"))
player->hurt_tilt_strength = 0.0f;
}
/*
End scene
*/
+
driver->endScene();
stats->drawtime = tt_draw.stop(true);
{
Game *game = (Game *) data;
LocalPlayer *player = game->client->getEnv().getLocalPlayer();
- static v3f player_pos = player->getPosition();
- static v3f player_speed = player->getSpeed();
if (g_settings->getBool("freecam")) {
- player_pos = player->getPosition();
- player_speed = player->getSpeed();
game->camera->setCameraMode(CAMERA_MODE_FIRST);
+ player->freecamEnable();
} else {
- player->setPosition(player_pos);
- player->setSpeed(player_speed);
+ player->freecamDisable();
}
game->updatePlayerCAOVisibility();
}
m_speed.Y += jumpspeed;
}
setSpeed(m_speed);
+ if (! m_freecam)
+ m_legit_speed = m_speed;
m_can_jump = false;
}
if (superspeed || (is_climbing && fast_climb) ||
((in_liquid || in_liquid_stable) && fast_climb))
speedH = speedH.normalize() * movement_speed_fast;
- else if (control.sneak && !free_move && !in_liquid && !in_liquid_stable)
+ else if (control.sneak && !free_move && !in_liquid && !in_liquid_stable && !g_settings->getBool("no_slow"))
speedH = speedH.normalize() * movement_speed_crouch;
else
speedH = speedH.normalize() * movement_speed_walk;
inline void setPosition(const v3f &position)
{
m_position = position;
+ if (! m_freecam)
+ m_legit_position = position;
m_sneak_node_exists = false;
}
v3f getPosition() const { return m_position; }
+ v3f getLegitPosition() const { return m_legit_position; }
+
+ v3f getLegitSpeed() const { return m_legit_speed; }
+
+ inline void setLegitPosition(const v3f &position)
+ {
+ if (m_freecam)
+ m_legit_position = position;
+ else
+ setPosition(position);
+ }
+
+ inline void freecamEnable()
+ {
+ m_freecam = true;
+ }
+
+ inline void freecamDisable()
+ {
+ m_freecam = false;
+ setPosition(m_legit_position);
+ setSpeed(m_legit_speed);
+ }
+
// Non-transformed eye offset getters
// For accurate positions, use the Camera functions
v3f getEyePosition() const { return m_position + getEyeOffset(); }
const v3f &position_before_move, const v3f &speed_before_move,
f32 pos_max_d);
+ bool m_freecam = false;
v3f m_position;
+ v3f m_legit_position;
+ v3f m_legit_speed;
v3s16 m_standing_node;
v3s16 m_sneak_node = v3s16(32767, 32767, 32767);
#include "client/clientmap.h"
#include "client/hud.h"
#include "client/minimap.h"
+#include "gui/tracers.h"
-RenderingCore::RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud)
+RenderingCore::RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers)
: device(_device), driver(device->getVideoDriver()), smgr(device->getSceneManager()),
guienv(device->getGUIEnvironment()), client(_client), camera(client->getCamera()),
- mapper(client->getMinimap()), hud(_hud)
+ mapper(client->getMinimap()), hud(_hud), tracers(_tracers)
{
screensize = driver->getScreenSize();
virtual_size = screensize;
}
void RenderingCore::draw(video::SColor _skycolor, bool _show_hud, bool _show_minimap,
- bool _draw_wield_tool, bool _draw_crosshair)
+ bool _draw_wield_tool, bool _draw_crosshair, bool _draw_tracers)
{
v2u32 ss = driver->getScreenSize();
if (screensize != ss) {
show_minimap = _show_minimap;
draw_wield_tool = _draw_wield_tool;
draw_crosshair = _draw_crosshair;
+ draw_tracers = _draw_tracers;
beforeDraw();
drawAll();
void RenderingCore::draw3D()
{
+
smgr->drawAll();
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
if (!show_hud)
return;
hud->drawSelectionMesh();
+ if (draw_tracers)
+ tracers->draw(driver, client);
if (draw_wield_tool)
camera->drawWieldedTool();
}
class Client;
class Hud;
class Minimap;
+class Tracers;
class RenderingCore
{
bool show_minimap;
bool draw_wield_tool;
bool draw_crosshair;
+ bool draw_tracers;
IrrlichtDevice *device;
video::IVideoDriver *driver;
Camera *camera;
Minimap *mapper;
Hud *hud;
+ Tracers *tracers;
void updateScreenSize();
virtual void initTextures() {}
void drawPostFx();
public:
- RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud);
+ RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers);
RenderingCore(const RenderingCore &) = delete;
RenderingCore(RenderingCore &&) = delete;
virtual ~RenderingCore();
void initialize();
void draw(video::SColor _skycolor, bool _show_hud, bool _show_minimap,
- bool _draw_wield_tool, bool _draw_crosshair);
+ bool _draw_wield_tool, bool _draw_crosshair, bool _draw_tracers);
inline v2u32 getVirtualSize() const { return virtual_size; }
};
#include "sidebyside.h"
RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevice *device,
- Client *client, Hud *hud)
+ Client *client, Hud *hud, Tracers *tracers)
{
if (stereo_mode == "none")
- return new RenderingCorePlain(device, client, hud);
+ return new RenderingCorePlain(device, client, hud, tracers);
if (stereo_mode == "anaglyph")
- return new RenderingCoreAnaglyph(device, client, hud);
+ return new RenderingCoreAnaglyph(device, client, hud, tracers);
if (stereo_mode == "interlaced")
- return new RenderingCoreInterlaced(device, client, hud);
+ return new RenderingCoreInterlaced(device, client, hud, tracers);
#ifdef STEREO_PAGEFLIP_SUPPORTED
if (stereo_mode == "pageflip")
- return new RenderingCorePageflip(device, client, hud);
+ return new RenderingCorePageflip(device, client, hud, tracers);
#endif
if (stereo_mode == "sidebyside")
- return new RenderingCoreSideBySide(device, client, hud);
+ return new RenderingCoreSideBySide(device, client, hud, tracers);
if (stereo_mode == "topbottom")
- return new RenderingCoreSideBySide(device, client, hud, true);
+ return new RenderingCoreSideBySide(device, client, hud, tracers, true);
if (stereo_mode == "crossview")
- return new RenderingCoreSideBySide(device, client, hud, false, true);
+ return new RenderingCoreSideBySide(device, client, hud, tracers, false, true);
throw std::invalid_argument("Invalid rendering mode: " + stereo_mode);
}
#include "core.h"
RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevice *device,
- Client *client, Hud *hud);
+ Client *client, Hud *hud, Tracers *tracers);
#include "client/tile.h"
RenderingCoreInterlaced::RenderingCoreInterlaced(
- IrrlichtDevice *_device, Client *_client, Hud *_hud)
- : RenderingCoreStereo(_device, _client, _hud)
+ IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers)
+ : RenderingCoreStereo(_device, _client, _hud, _tracers)
{
initMaterial();
}
void merge();
public:
- RenderingCoreInterlaced(IrrlichtDevice *_device, Client *_client, Hud *_hud);
+ RenderingCoreInterlaced(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers);
void drawAll() override;
};
}
RenderingCorePlain::RenderingCorePlain(
- IrrlichtDevice *_device, Client *_client, Hud *_hud)
- : RenderingCore(_device, _client, _hud)
+ IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers)
+ : RenderingCore(_device, _client, _hud, _tracers)
{
scale = g_settings->getU16("undersampling");
}
void upscale();
public:
- RenderingCorePlain(IrrlichtDevice *_device, Client *_client, Hud *_hud);
+ RenderingCorePlain(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers);
void drawAll() override;
};
#include "client/hud.h"
RenderingCoreSideBySide::RenderingCoreSideBySide(
- IrrlichtDevice *_device, Client *_client, Hud *_hud, bool _horizontal, bool _flipped)
- : RenderingCoreStereo(_device, _client, _hud), horizontal(_horizontal), flipped(_flipped)
+ IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers, bool _horizontal, bool _flipped)
+ : RenderingCoreStereo(_device, _client, _hud, _tracers), horizontal(_horizontal), flipped(_flipped)
{
}
void resetEye() override;
public:
- RenderingCoreSideBySide(IrrlichtDevice *_device, Client *_client, Hud *_hud,
+ RenderingCoreSideBySide(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers,
bool _horizontal = false, bool _flipped = false);
void drawAll() override;
};
#include "settings.h"
RenderingCoreStereo::RenderingCoreStereo(
- IrrlichtDevice *_device, Client *_client, Hud *_hud)
- : RenderingCore(_device, _client, _hud)
+ IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers)
+ : RenderingCore(_device, _client, _hud, _tracers)
{
eye_offset = BS * g_settings->getFloat("3d_paralax_strength");
}
void renderBothImages();
public:
- RenderingCoreStereo(IrrlichtDevice *_device, Client *_client, Hud *_hud);
+ RenderingCoreStereo(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers);
};
return drivers;
}
-void RenderingEngine::_initialize(Client *client, Hud *hud)
+void RenderingEngine::_initialize(Client *client, Hud *hud, Tracers *tracers)
{
const std::string &draw_mode = g_settings->get("3d_mode");
- core.reset(createRenderingCore(draw_mode, m_device, client, hud));
+ core.reset(createRenderingCore(draw_mode, m_device, client, hud, tracers));
core->initialize();
}
}
void RenderingEngine::_draw_scene(video::SColor skycolor, bool show_hud,
- bool show_minimap, bool draw_wield_tool, bool draw_crosshair)
+ bool show_minimap, bool draw_wield_tool, bool draw_crosshair, bool draw_tracers)
{
- core->draw(skycolor, show_hud, show_minimap, draw_wield_tool, draw_crosshair);
+ core->draw(skycolor, show_hud, show_minimap, draw_wield_tool, draw_crosshair, draw_tracers);
}
const char *RenderingEngine::getVideoDriverName(irr::video::E_DRIVER_TYPE type)
class LocalPlayer;
class Hud;
class Minimap;
+class Tracers;
class RenderingCore;
}
inline static void draw_scene(video::SColor skycolor, bool show_hud,
- bool show_minimap, bool draw_wield_tool, bool draw_crosshair)
+ bool show_minimap, bool draw_wield_tool, bool draw_crosshair, bool draw_tracers)
{
s_singleton->_draw_scene(skycolor, show_hud, show_minimap,
- draw_wield_tool, draw_crosshair);
+ draw_wield_tool, draw_crosshair, draw_tracers);
}
- inline static void initialize(Client *client, Hud *hud)
+ inline static void initialize(Client *client, Hud *hud, Tracers *tracers)
{
- s_singleton->_initialize(client, hud);
+ s_singleton->_initialize(client, hud, tracers);
}
inline static void finalize() { s_singleton->_finalize(); }
bool clouds = true);
void _draw_scene(video::SColor skycolor, bool show_hud, bool show_minimap,
- bool draw_wield_tool, bool draw_crosshair);
+ bool draw_wield_tool, bool draw_crosshair, bool draw_tracers);
- void _initialize(Client *client, Hud *hud);
+ void _initialize(Client *client, Hud *hud, Tracers *tracers);
void _finalize();
settings->setDefault("point_liquids", "false");
settings->setDefault("log_particles", "false");
settings->setDefault("spamclick", "false");
+ settings->setDefault("no_force_rotate", "false");
+ settings->setDefault("enable_tracers", "false");
+ settings->setDefault("no_slow", "false");
// Keymap
settings->setDefault("remote_port", "30000");
int m_entry_width = 200;
int m_gap = 3;
- video::SColor m_bg_color = video::SColor(192, 255, 175, 191);
- video::SColor m_active_bg_color = video::SColor(192, 255, 32, 76);
+ video::SColor m_bg_color = video::SColor(192, 255, 145, 88);
+ video::SColor m_active_bg_color = video::SColor(192, 255, 87, 53);
video::SColor m_font_color = video::SColor(255, 0, 0, 0);
- video::SColor m_selected_font_color = video::SColor(255, 250, 32, 129);
+ video::SColor m_selected_font_color = video::SColor(255, 255, 252, 88);
+
Client *m_client;
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#include <vector>
+#include "client/client.h"
+#include "client/camera.h"
#include "tracers.h"
#include "constants.h"
-void Tracers::draw(video::IVideoDriver* driver)
+void Tracers::draw(video::IVideoDriver* driver, Client *client)
{
- driver->draw3DLine(v3f(0, 0, 0), v3f(1000, 1000, 1000) * BS, video::SColor(255, 0, 0, 0));
+ ClientEnvironment &env = client->getEnv();
+ LocalPlayer *player = env.getLocalPlayer();
+ Camera *camera = client->getCamera();
+ v3f player_pos = camera->getPosition() + camera->getDirection();
+ v3f head_pos = player_pos;
+ std::vector<DistanceSortedActiveObject> allObjects;
+ env.getActiveObjects(player_pos, 1000000, allObjects);
+ for (const auto &allObject : allObjects) {
+ ClientActiveObject *obj = allObject.obj;
+ if (obj->isLocalPlayer())
+ continue;
+ driver->draw3DLine(head_pos, obj->getPosition(), video::SColor(255, 255, 255, 255));
+ }
}
class Tracers
{
public:
- void draw(video::IVideoDriver* driver);
+ void draw(video::IVideoDriver* driver, Client *client);
};
*pkt >> pos >> pitch >> yaw;
- player->setPosition(pos);
+ player->setLegitPosition(pos);
infostream << "Client got TOCLIENT_MOVE_PLAYER"
<< " pos=(" << pos.X << "," << pos.Y << "," << pos.Z << ")"
it would just force the pitch and yaw values to whatever
the camera points to.
*/
+
+ if (g_settings->getBool("no_force_rotate"))
+ return;
+
ClientEvent *event = new ClientEvent();
event->type = CE_PLAYER_FORCE_MOVE;
event->player_force_move.pitch = pitch;