diff --git a/builtin/client/cheats.lua b/builtin/client/cheats.lua index 43d79d498..06b4cb745 100644 --- a/builtin/client/cheats.lua +++ b/builtin/client/cheats.lua @@ -22,6 +22,7 @@ core.cheats = { ["BrightNight"] = "no_night", ["Coords"] = "coords", ["Tracers"] = "enable_tracers", + ["ESP"] = "enable_esp", }, ["World"] = { ["FastDig"] = "fastdig", diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt index 8452850fa..a4991cb94 100644 --- a/builtin/settingtypes.txt +++ b/builtin/settingtypes.txt @@ -2271,4 +2271,6 @@ no_force_rotate (NoForceRotate) bool false enable_tracers (Tracers) bool false +enable_esp (ESP) bool false + no_slow (NoSlow) bool false diff --git a/src/client/clientobject.h b/src/client/clientobject.h index 19f8e3b72..ecd8059ef 100644 --- a/src/client/clientobject.h +++ b/src/client/clientobject.h @@ -44,7 +44,6 @@ public: virtual void updateLight(u32 day_night_ratio) {} - virtual bool isItem() const { return false; } virtual bool getCollisionBox(aabb3f *toset) const { return false; } virtual bool getSelectionBox(aabb3f *toset) const { return false; } virtual bool collideWithObjects() const { return false; } diff --git a/src/client/content_cao.h b/src/client/content_cao.h index 51b58b030..88aa4870c 100644 --- a/src/client/content_cao.h +++ b/src/client/content_cao.h @@ -215,8 +215,6 @@ public: m_is_visible = toset; } - bool isItem() const { return m_prop.visual == "wielditem" || m_prop.visual == "item"; } - void setChildrenVisible(bool toset); void setAttachment(int parent_id, const std::string &bone, v3f position, v3f rotation); void getAttachment(int *parent_id, std::string *bone, v3f *position, diff --git a/src/client/game.cpp b/src/client/game.cpp index c1f1ea4a1..f229363c8 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -228,7 +228,7 @@ bool Game::startup(bool *kill, if (!createClient(start_data)) return false; - RenderingEngine::initialize(client, hud, m_tracers); + RenderingEngine::initialize(client, hud); return true; } @@ -348,9 +348,6 @@ void Game::shutdown() if (m_cheat_menu) delete m_cheat_menu; - - if (m_tracers) - delete m_tracers; if (sky) sky->drop(); @@ -626,14 +623,6 @@ bool Game::initGui() errorstream << *error_message << std::endl; return false; } - - m_tracers = new Tracers(); - - if (!m_tracers) { - *error_message = "Could not allocate memory for tracers"; - errorstream << *error_message << std::endl; - return false; - } #ifdef HAVE_TOUCHSCREENGUI @@ -3196,7 +3185,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime, } #endif RenderingEngine::draw_scene(skycolor, m_game_ui->m_flags.show_hud, - m_game_ui->m_flags.show_minimap, draw_wield_tool, draw_crosshair, g_settings->getBool("enable_tracers")); + m_game_ui->m_flags.show_minimap, draw_wield_tool, draw_crosshair, g_settings->getBool("enable_tracers"), g_settings->getBool("enable_esp")); /* Profiler graph diff --git a/src/client/game.h b/src/client/game.h index e5557ee18..a2a1e7c2d 100644 --- a/src/client/game.h +++ b/src/client/game.h @@ -50,7 +50,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "gui/guiVolumeChange.h" #include "gui/mainmenumanager.h" #include "gui/profilergraph.h" -#include "gui/tracers.h" #include "mapblock.h" #include "minimap.h" #include "nodedef.h" // Needed for determining pointing to nodes @@ -869,7 +868,6 @@ public: std::unique_ptr m_game_ui; GUIChatConsole *gui_chat_console = nullptr; // Free using ->Drop() CheatMenu *m_cheat_menu = nullptr; - Tracers *m_tracers = nullptr; MapDrawControl *draw_control = nullptr; Camera *camera = nullptr; Clouds *clouds = nullptr; // Free using ->Drop() diff --git a/src/client/localplayer.cpp b/src/client/localplayer.cpp index 9c1e896af..00195cd02 100644 --- a/src/client/localplayer.cpp +++ b/src/client/localplayer.cpp @@ -301,7 +301,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d, collisionMoveResult result = collisionMoveSimple(env, m_client, pos_max_d, m_collisionbox, player_stepheight, dtime, - &position, &m_speed, accel_f); + &position, &m_speed, accel_f, NULL, true, true); bool could_sneak = control.sneak && !free_move && !in_liquid && !is_climbing && physics_override_sneak; @@ -923,7 +923,7 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d, collisionMoveResult result = collisionMoveSimple(env, m_client, pos_max_d, m_collisionbox, player_stepheight, dtime, - &position, &m_speed, accel_f); + &position, &m_speed, accel_f, NULL, true, true); // Positition was slightly changed; update standing node pos if (touching_ground) @@ -1175,7 +1175,7 @@ void LocalPlayer::handleAutojump(f32 dtime, Environment *env, // try at peak of jump, zero step height collisionMoveResult jump_result = collisionMoveSimple(env, m_client, pos_max_d, - m_collisionbox, 0.0f, dtime, &jump_pos, &jump_speed, v3f(0.0f)); + m_collisionbox, 0.0f, dtime, &jump_pos, &jump_speed, v3f(0.0f), NULL, true, true); // see if we can get a little bit farther horizontally if we had // jumped diff --git a/src/client/render/core.cpp b/src/client/render/core.cpp index 44aef6408..45fc0d8ec 100644 --- a/src/client/render/core.cpp +++ b/src/client/render/core.cpp @@ -18,18 +18,19 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include #include "core.h" #include "client/camera.h" #include "client/client.h" #include "client/clientmap.h" #include "client/hud.h" #include "client/minimap.h" -#include "gui/tracers.h" +#include "client/content_cao.h" -RenderingCore::RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers) +RenderingCore::RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud) : device(_device), driver(device->getVideoDriver()), smgr(device->getSceneManager()), guienv(device->getGUIEnvironment()), client(_client), camera(client->getCamera()), - mapper(client->getMinimap()), hud(_hud), tracers(_tracers) + mapper(client->getMinimap()), hud(_hud) { screensize = driver->getScreenSize(); virtual_size = screensize; @@ -54,7 +55,7 @@ void RenderingCore::updateScreenSize() } void RenderingCore::draw(video::SColor _skycolor, bool _show_hud, bool _show_minimap, - bool _draw_wield_tool, bool _draw_crosshair, bool _draw_tracers) + bool _draw_wield_tool, bool _draw_crosshair, bool _draw_tracers, bool _draw_esp) { v2u32 ss = driver->getScreenSize(); if (screensize != ss) { @@ -67,23 +68,63 @@ void RenderingCore::draw(video::SColor _skycolor, bool _show_hud, bool _show_min draw_wield_tool = _draw_wield_tool; draw_crosshair = _draw_crosshair; draw_tracers = _draw_tracers; + draw_esp = _draw_esp; beforeDraw(); drawAll(); } +void RenderingCore::drawTracersAndESP() +{ + ClientEnvironment &env = client->getEnv(); + Camera *camera = client->getCamera(); + + v3f camera_offset = intToFloat(camera->getOffset(), BS); + + v3f eye_pos = (camera->getPosition() + camera->getDirection() - camera_offset); + + video::SMaterial material, oldmaterial; + oldmaterial = driver->getMaterial2D(); + material.setFlag(video::EMF_LIGHTING, false); + material.setFlag(video::EMF_BILINEAR_FILTER, false); + material.setFlag(video::EMF_ZBUFFER, false); + material.setFlag(video::EMF_ZWRITE_ENABLE, false); + driver->setMaterial(material); + + auto allObjects = env.getAllActiveObjects(); + for (auto &it : allObjects) { + ClientActiveObject *cao = it.second; + if (cao->isLocalPlayer() || cao->getParent()) + continue; + GenericCAO *obj = dynamic_cast(cao); + if (! obj) + continue; + aabb3f box; + if (! obj->getSelectionBox(&box)) + continue; + v3f pos = obj->getPosition(); + pos -= camera_offset; + box.MinEdge += pos; + box.MaxEdge += pos; + pos = box.getCenter(); + if (draw_esp) + driver->draw3DBox(box, video::SColor(255, 255, 255, 255)); + if (draw_tracers) + driver->draw3DLine(eye_pos, pos, video::SColor(255, 255, 255, 255)); + } + + driver->setMaterial(oldmaterial); +} + void RenderingCore::draw3D() { - smgr->drawAll(); driver->setTransform(video::ETS_WORLD, core::IdentityMatrix); if (!show_hud) return; hud->drawSelectionMesh(); - if (draw_tracers) { - driver->setTransform(video::ETS_WORLD, core::IdentityMatrix); - tracers->draw(driver, client); - } + if (draw_tracers || draw_esp) + drawTracersAndESP(); if (draw_wield_tool) camera->drawWieldedTool(); } diff --git a/src/client/render/core.h b/src/client/render/core.h index 89c6a8511..609892416 100644 --- a/src/client/render/core.h +++ b/src/client/render/core.h @@ -25,7 +25,6 @@ class Camera; class Client; class Hud; class Minimap; -class Tracers; class RenderingCore { @@ -38,6 +37,7 @@ protected: bool draw_wield_tool; bool draw_crosshair; bool draw_tracers; + bool draw_esp; IrrlichtDevice *device; video::IVideoDriver *driver; @@ -48,8 +48,7 @@ protected: Camera *camera; Minimap *mapper; Hud *hud; - Tracers *tracers; - + void updateScreenSize(); virtual void initTextures() {} virtual void clearTextures() {} @@ -57,12 +56,13 @@ protected: virtual void beforeDraw() {} virtual void drawAll() = 0; + void drawTracersAndESP(); void draw3D(); void drawHUD(); void drawPostFx(); public: - RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers); + RenderingCore(IrrlichtDevice *_device, Client *_client, Hud *_hud); RenderingCore(const RenderingCore &) = delete; RenderingCore(RenderingCore &&) = delete; virtual ~RenderingCore(); @@ -72,7 +72,7 @@ public: void initialize(); void draw(video::SColor _skycolor, bool _show_hud, bool _show_minimap, - bool _draw_wield_tool, bool _draw_crosshair, bool _draw_tracers); + bool _draw_wield_tool, bool _draw_crosshair, bool _draw_tracers, bool _draw_esp); inline v2u32 getVirtualSize() const { return virtual_size; } }; diff --git a/src/client/render/factory.cpp b/src/client/render/factory.cpp index 06376742d..30f9480fc 100644 --- a/src/client/render/factory.cpp +++ b/src/client/render/factory.cpp @@ -27,23 +27,23 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "sidebyside.h" RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevice *device, - Client *client, Hud *hud, Tracers *tracers) + Client *client, Hud *hud) { if (stereo_mode == "none") - return new RenderingCorePlain(device, client, hud, tracers); + return new RenderingCorePlain(device, client, hud); if (stereo_mode == "anaglyph") - return new RenderingCoreAnaglyph(device, client, hud, tracers); + return new RenderingCoreAnaglyph(device, client, hud); if (stereo_mode == "interlaced") - return new RenderingCoreInterlaced(device, client, hud, tracers); + return new RenderingCoreInterlaced(device, client, hud); #ifdef STEREO_PAGEFLIP_SUPPORTED if (stereo_mode == "pageflip") - return new RenderingCorePageflip(device, client, hud, tracers); + return new RenderingCorePageflip(device, client, hud); #endif if (stereo_mode == "sidebyside") - return new RenderingCoreSideBySide(device, client, hud, tracers); + return new RenderingCoreSideBySide(device, client, hud); if (stereo_mode == "topbottom") - return new RenderingCoreSideBySide(device, client, hud, tracers, true); + return new RenderingCoreSideBySide(device, client, hud, true); if (stereo_mode == "crossview") - return new RenderingCoreSideBySide(device, client, hud, tracers, false, true); + return new RenderingCoreSideBySide(device, client, hud, false, true); throw std::invalid_argument("Invalid rendering mode: " + stereo_mode); } diff --git a/src/client/render/factory.h b/src/client/render/factory.h index cd1845bd2..e3339a836 100644 --- a/src/client/render/factory.h +++ b/src/client/render/factory.h @@ -24,4 +24,4 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "core.h" RenderingCore *createRenderingCore(const std::string &stereo_mode, IrrlichtDevice *device, - Client *client, Hud *hud, Tracers *tracers); + Client *client, Hud *hud); diff --git a/src/client/render/interlaced.cpp b/src/client/render/interlaced.cpp index ae9d0d358..2aadadc17 100644 --- a/src/client/render/interlaced.cpp +++ b/src/client/render/interlaced.cpp @@ -24,8 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client/tile.h" RenderingCoreInterlaced::RenderingCoreInterlaced( - IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers) - : RenderingCoreStereo(_device, _client, _hud, _tracers) + IrrlichtDevice *_device, Client *_client, Hud *_hud) + : RenderingCoreStereo(_device, _client, _hud) { initMaterial(); } diff --git a/src/client/render/interlaced.h b/src/client/render/interlaced.h index 94ccc61f8..71815fd70 100644 --- a/src/client/render/interlaced.h +++ b/src/client/render/interlaced.h @@ -38,6 +38,6 @@ protected: void merge(); public: - RenderingCoreInterlaced(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers); + RenderingCoreInterlaced(IrrlichtDevice *_device, Client *_client, Hud *_hud); void drawAll() override; }; diff --git a/src/client/render/plain.cpp b/src/client/render/plain.cpp index f1966a4b2..a130a14eb 100644 --- a/src/client/render/plain.cpp +++ b/src/client/render/plain.cpp @@ -27,8 +27,8 @@ inline u32 scaledown(u32 coef, u32 size) } RenderingCorePlain::RenderingCorePlain( - IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers) - : RenderingCore(_device, _client, _hud, _tracers) + IrrlichtDevice *_device, Client *_client, Hud *_hud) + : RenderingCore(_device, _client, _hud) { scale = g_settings->getU16("undersampling"); } diff --git a/src/client/render/plain.h b/src/client/render/plain.h index afac62dee..80c17ed9f 100644 --- a/src/client/render/plain.h +++ b/src/client/render/plain.h @@ -33,6 +33,6 @@ protected: void upscale(); public: - RenderingCorePlain(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers); + RenderingCorePlain(IrrlichtDevice *_device, Client *_client, Hud *_hud); void drawAll() override; }; diff --git a/src/client/render/sidebyside.cpp b/src/client/render/sidebyside.cpp index 1b86fff3e..ed08810db 100644 --- a/src/client/render/sidebyside.cpp +++ b/src/client/render/sidebyside.cpp @@ -23,8 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "client/hud.h" RenderingCoreSideBySide::RenderingCoreSideBySide( - IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers, bool _horizontal, bool _flipped) - : RenderingCoreStereo(_device, _client, _hud, _tracers), horizontal(_horizontal), flipped(_flipped) + IrrlichtDevice *_device, Client *_client, Hud *_hud, bool _horizontal, bool _flipped) + : RenderingCoreStereo(_device, _client, _hud), horizontal(_horizontal), flipped(_flipped) { } diff --git a/src/client/render/sidebyside.h b/src/client/render/sidebyside.h index 10c3919d1..f8ed256b3 100644 --- a/src/client/render/sidebyside.h +++ b/src/client/render/sidebyside.h @@ -37,7 +37,7 @@ protected: void resetEye() override; public: - RenderingCoreSideBySide(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers, + RenderingCoreSideBySide(IrrlichtDevice *_device, Client *_client, Hud *_hud, bool _horizontal = false, bool _flipped = false); void drawAll() override; }; diff --git a/src/client/render/stereo.cpp b/src/client/render/stereo.cpp index d826eca59..967b5a78f 100644 --- a/src/client/render/stereo.cpp +++ b/src/client/render/stereo.cpp @@ -24,8 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" RenderingCoreStereo::RenderingCoreStereo( - IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers) - : RenderingCore(_device, _client, _hud, _tracers) + IrrlichtDevice *_device, Client *_client, Hud *_hud) + : RenderingCore(_device, _client, _hud) { eye_offset = BS * g_settings->getFloat("3d_paralax_strength"); } diff --git a/src/client/render/stereo.h b/src/client/render/stereo.h index 3494f2512..c8b07e146 100644 --- a/src/client/render/stereo.h +++ b/src/client/render/stereo.h @@ -34,5 +34,5 @@ protected: void renderBothImages(); public: - RenderingCoreStereo(IrrlichtDevice *_device, Client *_client, Hud *_hud, Tracers *_tracers); + RenderingCoreStereo(IrrlichtDevice *_device, Client *_client, Hud *_hud); }; diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index 9572d260c..1534289d4 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -591,10 +591,10 @@ std::vector RenderingEngine::getSupportedVideoDrivers return drivers; } -void RenderingEngine::_initialize(Client *client, Hud *hud, Tracers *tracers) +void RenderingEngine::_initialize(Client *client, Hud *hud) { const std::string &draw_mode = g_settings->get("3d_mode"); - core.reset(createRenderingCore(draw_mode, m_device, client, hud, tracers)); + core.reset(createRenderingCore(draw_mode, m_device, client, hud)); core->initialize(); } @@ -604,9 +604,9 @@ void RenderingEngine::_finalize() } void RenderingEngine::_draw_scene(video::SColor skycolor, bool show_hud, - bool show_minimap, bool draw_wield_tool, bool draw_crosshair, bool draw_tracers) + bool show_minimap, bool draw_wield_tool, bool draw_crosshair, bool draw_tracers, bool draw_esp) { - core->draw(skycolor, show_hud, show_minimap, draw_wield_tool, draw_crosshair, draw_tracers); + core->draw(skycolor, show_hud, show_minimap, draw_wield_tool, draw_crosshair, draw_tracers, draw_esp); } const char *RenderingEngine::getVideoDriverName(irr::video::E_DRIVER_TYPE type) diff --git a/src/client/renderingengine.h b/src/client/renderingengine.h index 84ff4328d..c5fa8918b 100644 --- a/src/client/renderingengine.h +++ b/src/client/renderingengine.h @@ -118,15 +118,15 @@ public: } inline static void draw_scene(video::SColor skycolor, bool show_hud, - bool show_minimap, bool draw_wield_tool, bool draw_crosshair, bool draw_tracers) + bool show_minimap, bool draw_wield_tool, bool draw_crosshair, bool draw_tracers, bool draw_esp) { s_singleton->_draw_scene(skycolor, show_hud, show_minimap, - draw_wield_tool, draw_crosshair, draw_tracers); + draw_wield_tool, draw_crosshair, draw_tracers, draw_esp); } - inline static void initialize(Client *client, Hud *hud, Tracers *tracers) + inline static void initialize(Client *client, Hud *hud) { - s_singleton->_initialize(client, hud, tracers); + s_singleton->_initialize(client, hud); } inline static void finalize() { s_singleton->_finalize(); } @@ -149,9 +149,9 @@ private: bool clouds = true); void _draw_scene(video::SColor skycolor, bool show_hud, bool show_minimap, - bool draw_wield_tool, bool draw_crosshair, bool draw_tracers); + bool draw_wield_tool, bool draw_crosshair, bool draw_tracers, bool draw_esp); - void _initialize(Client *client, Hud *hud, Tracers *tracers); + void _initialize(Client *client, Hud *hud); void _finalize(); diff --git a/src/collision.cpp b/src/collision.cpp index 124e64a22..2e788956d 100644 --- a/src/collision.cpp +++ b/src/collision.cpp @@ -227,7 +227,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef, f32 stepheight, f32 dtime, v3f *pos_f, v3f *speed_f, v3f accel_f, ActiveObject *self, - bool collideWithObjects) + bool collideWithObjects, bool jesus) { static bool time_notification_done = false; Map *map = &env->getMap(); @@ -285,6 +285,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef, v3s16 max = floatToInt(maxpos_f + box_0.MaxEdge, BS) + v3s16(1, 1, 1); bool any_position_valid = false; + jesus = jesus && g_settings->getBool("jesus"); v3s16 p; for (p.X = min.X; p.X <= max.X; p.X++) @@ -300,7 +301,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef, const NodeDefManager *nodedef = gamedef->getNodeDefManager(); const ContentFeatures &f = nodedef->get(n); - if (!(f.walkable || (g_settings->getBool("jesus") && f.isLiquid()))) + if (!(f.walkable || (jesus && f.isLiquid()))) continue; int n_bouncy_value = itemgroup_get(f.groups, "bouncy"); diff --git a/src/collision.h b/src/collision.h index 87a502828..998598f1e 100644 --- a/src/collision.h +++ b/src/collision.h @@ -70,7 +70,7 @@ collisionMoveResult collisionMoveSimple(Environment *env,IGameDef *gamedef, f32 stepheight, f32 dtime, v3f *pos_f, v3f *speed_f, v3f accel_f, ActiveObject *self=NULL, - bool collideWithObjects=true); + bool collideWithObjects=true, bool jesus=false); // Helper function: // Checks for collision of a moving aabbox with a static aabbox diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index abe15c453..bb54dc950 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -92,6 +92,7 @@ void set_default_settings(Settings *settings) settings->setDefault("spamclick", "false"); settings->setDefault("no_force_rotate", "false"); settings->setDefault("enable_tracers", "false"); + settings->setDefault("enable_esp", "false"); settings->setDefault("no_slow", "false"); // Keymap diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 794522e6e..7befba37c 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -25,6 +25,5 @@ set(gui_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/intlGUIEditBox.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modalMenu.cpp ${CMAKE_CURRENT_SOURCE_DIR}/profilergraph.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/tracers.cpp PARENT_SCOPE ) diff --git a/src/gui/tracers.cpp b/src/gui/tracers.cpp deleted file mode 100644 index ee41d0fb0..000000000 --- a/src/gui/tracers.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* -Dragonfire -Copyright (C) 2020 Elias Fleckenstein - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#include -#include "client/client.h" -#include "client/camera.h" -#include "tracers.h" -#include "constants.h" - -void Tracers::draw(video::IVideoDriver* driver, Client *client) -{ - ClientEnvironment &env = client->getEnv(); - Camera *camera = client->getCamera(); - v3f head_pos = camera->getPosition() + camera->getDirection(); - auto allObjects = env.getAllActiveObjects(); - for (auto &it : allObjects) { - ClientActiveObject *obj = it.second; - if (obj->isLocalPlayer() || obj->getParent() || obj->isItem()) - continue; - v3f pos = obj->getPosition(); - aabb3f box; - if (obj->getSelectionBox(&box)) - pos += box.getCenter(); - driver->draw3DLine(head_pos, pos, video::SColor(255, 255, 255, 255)); - } -} diff --git a/src/gui/tracers.h b/src/gui/tracers.h deleted file mode 100644 index 0ad17ad79..000000000 --- a/src/gui/tracers.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -Dragonfire -Copyright (C) 2020 Elias Fleckenstein - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation; either version 2.1 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#pragma once - -#include "irrlichttypes_extrabloated.h" - -class Tracers -{ -public: - void draw(video::IVideoDriver* driver, Client *client); -};