]> git.lizzy.rs Git - minetest.git/commitdiff
Remove dead code behind Irrlicht version checks
authorsfan5 <sfan5@live.de>
Fri, 17 Feb 2023 23:29:34 +0000 (00:29 +0100)
committersfan5 <sfan5@live.de>
Sat, 18 Feb 2023 15:46:51 +0000 (16:46 +0100)
src/client/game.cpp
src/client/mapblock_mesh.cpp
src/client/sky.cpp
src/gui/guiButton.cpp
src/gui/guiButton.h
src/gui/guiChatConsole.cpp
src/gui/guiEditBox.cpp
src/irrlicht_changes/CGUITTFont.h
src/irrlicht_changes/static_text.cpp
src/irrlicht_changes/static_text.h
src/irrlichttypes.h

index 122e25d8c2042ca121ee6bdbc0ab6e522e2863d9..94a09537adf3205373a2a09e3793e018300082be 100644 (file)
@@ -1008,10 +1008,6 @@ class Game {
        // this happens in pause menu in singleplayer
        bool m_is_paused = false;
 
-#if IRRLICHT_VERSION_MT_REVISION < 5
-       int m_reset_HW_buffer_counter = 0;
-#endif
-
 #ifdef HAVE_TOUCHSCREENGUI
        bool m_cache_hold_aux1;
        bool m_touch_use_crosshair;
@@ -4153,29 +4149,6 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
        /*
                ==================== End scene ====================
        */
-#if IRRLICHT_VERSION_MT_REVISION < 5
-       if (++m_reset_HW_buffer_counter > 500) {
-               /*
-                 Periodically remove all mesh HW buffers.
-
-                 Work around for a quirk in Irrlicht where a HW buffer is only
-                 released after 20000 iterations (triggered from endScene()).
-
-                 Without this, all loaded but unused meshes will retain their HW
-                 buffers for at least 5 minutes, at which point looking up the HW buffers
-                 becomes a bottleneck and the framerate drops (as much as 30%).
-
-                 Tests showed that numbers between 50 and 1000 are good, so picked 500.
-                 There are no other public Irrlicht APIs that allow interacting with the
-                 HW buffers without tracking the status of every individual mesh.
-
-                 The HW buffers for _visible_ meshes will be reinitialized in the next frame.
-               */
-               infostream << "Game::updateFrame(): Removing all HW buffers." << std::endl;
-               driver->removeAllHardwareBuffers();
-               m_reset_HW_buffer_counter = 0;
-       }
-#endif
 
        driver->endScene();
 
index e6ccb764f4dcace2a23ab6d7d2b5e71ce3a291a4..dd663d59e1399fab7acdb4789a65b37b56dc0bef 100644 (file)
@@ -1395,14 +1395,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
 MapBlockMesh::~MapBlockMesh()
 {
        for (scene::IMesh *m : m_mesh) {
-#if IRRLICHT_VERSION_MT_REVISION < 5
-               if (m_enable_vbo) {
-                       for (u32 i = 0; i < m->getMeshBufferCount(); i++) {
-                               scene::IMeshBuffer *buf = m->getMeshBuffer(i);
-                               RenderingEngine::get_video_driver()->removeHardwareBuffer(buf);
-                       }
-               }
-#endif
                m->drop();
        }
        for (MinimapMapblock *block : m_minimap_mapblocks)
index 0ab7398f2a12acea0b6bc64ecba15051b41e75e9..aacc47250eaf66798745dd8409d965cd94525733 100644 (file)
@@ -39,13 +39,8 @@ static video::SMaterial baseMaterial()
 {
        video::SMaterial mat;
        mat.Lighting = false;
-#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
        mat.ZBuffer = video::ECFN_DISABLED;
        mat.ZWriteEnable = video::EZW_OFF;
-#else
-       mat.ZWriteEnable = false;
-       mat.ZBuffer = video::ECFN_NEVER;
-#endif
        mat.AntiAliasing = 0;
        mat.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
        mat.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;
index be7e0c4391ec3ecf89f6b85d5d9b07e61888565b..3a2ddde1cf7bbdc82644dbbee715210a35e949ba 100644 (file)
@@ -499,12 +499,10 @@ video::SColor GUIButton::getOverrideColor() const
        return OverrideColor;\r
 }\r
 \r
-#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8\r
 video::SColor GUIButton::getActiveColor() const\r
 {\r
        return video::SColor(0,0,0,0); // unused?\r
 }\r
-#endif\r
 \r
 void GUIButton::enableOverrideColor(bool enable)\r
 {\r
index ee9bb6f2196412fcef5a09f51bee845d3488f2ec..5e379b28f05e220b778209472c545a582791cd1f 100644 (file)
 \r
 using namespace irr;\r
 \r
-#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 8)\r
-       namespace irr { namespace gui {\r
-\r
-               //! State of buttons used for drawing texture images.\r
-               //! Note that only a single state is active at a time\r
-               //! Also when no image is defined for a state it will use images from another state\r
-               //! and if that state is not set from the replacement for that,etc.\r
-               //! So in many cases setting EGBIS_IMAGE_UP and EGBIS_IMAGE_DOWN is sufficient.\r
-               enum EGUI_BUTTON_IMAGE_STATE {\r
-                       //! When no other states have images they will all use this one.\r
-                                       EGBIS_IMAGE_UP,\r
-                       //! When not set EGBIS_IMAGE_UP is used.\r
-                                       EGBIS_IMAGE_UP_MOUSEOVER,\r
-                       //! When not set EGBIS_IMAGE_UP_MOUSEOVER is used.\r
-                                       EGBIS_IMAGE_UP_FOCUSED,\r
-                       //! When not set EGBIS_IMAGE_UP_FOCUSED is used.\r
-                                       EGBIS_IMAGE_UP_FOCUSED_MOUSEOVER,\r
-                       //! When not set EGBIS_IMAGE_UP is used.\r
-                                       EGBIS_IMAGE_DOWN,\r
-                       //! When not set EGBIS_IMAGE_DOWN is used.\r
-                                       EGBIS_IMAGE_DOWN_MOUSEOVER,\r
-                       //! When not set EGBIS_IMAGE_DOWN_MOUSEOVER is used.\r
-                                       EGBIS_IMAGE_DOWN_FOCUSED,\r
-                       //! When not set EGBIS_IMAGE_DOWN_FOCUSED is used.\r
-                                       EGBIS_IMAGE_DOWN_FOCUSED_MOUSEOVER,\r
-                       //! When not set EGBIS_IMAGE_UP or EGBIS_IMAGE_DOWN are used (depending on button state).\r
-                                       EGBIS_IMAGE_DISABLED,\r
-                       //! not used, counts the number of enumerated items\r
-                                       EGBIS_COUNT\r
-               };\r
-\r
-               //! Names for gui button image states\r
-               const c8 *const GUIButtonImageStateNames[EGBIS_COUNT + 1] =\r
-                               {\r
-                                               "Image",    // not "ImageUp" as it otherwise breaks serialization of old files\r
-                                               "ImageUpOver",\r
-                                               "ImageUpFocused",\r
-                                               "ImageUpFocusedOver",\r
-                                               "PressedImage",    // not "ImageDown" as it otherwise breaks serialization of old files\r
-                                               "ImageDownOver",\r
-                                               "ImageDownFocused",\r
-                                               "ImageDownFocusedOver",\r
-                                               "ImageDisabled",\r
-                                               0    // count\r
-                               };\r
-\r
-       }}\r
-\r
-#endif\r
-\r
 class ISimpleTextureSource;\r
 \r
-#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 8)\r
-#define OVERRIDE_19\r
-#else\r
-#define OVERRIDE_19 override\r
-#endif\r
-\r
 class GUIButton : public gui::IGUIButton\r
 {\r
 public:\r
@@ -103,27 +47,25 @@ class GUIButton : public gui::IGUIButton
        virtual gui::IGUIFont* getActiveFont() const override;\r
 \r
        //! Sets another color for the button text.\r
-       virtual void setOverrideColor(video::SColor color) OVERRIDE_19;\r
+       virtual void setOverrideColor(video::SColor color) override;\r
 \r
        //! Gets the override color\r
-       virtual video::SColor getOverrideColor(void) const OVERRIDE_19;\r
+       virtual video::SColor getOverrideColor() const override;\r
 \r
-       #if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8\r
        //! Gets the currently used text color\r
        virtual video::SColor getActiveColor() const override;\r
-       #endif\r
 \r
        //! Sets if the button text should use the override color or the color in the gui skin.\r
-       virtual void enableOverrideColor(bool enable) OVERRIDE_19;\r
+       virtual void enableOverrideColor(bool enable) override;\r
 \r
        //! Checks if an override color is enabled\r
-       virtual bool isOverrideColorEnabled(void) const OVERRIDE_19;\r
+       virtual bool isOverrideColorEnabled(void) const override;\r
 \r
        // PATCH\r
        //! Sets an image which should be displayed on the button when it is in the given state.\r
        virtual void setImage(gui::EGUI_BUTTON_IMAGE_STATE state,\r
                        video::ITexture* image=nullptr,\r
-                       const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)) OVERRIDE_19;\r
+                       const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)) override;\r
 \r
        //! Sets an image which should be displayed on the button when it is in normal state.\r
        virtual void setImage(video::ITexture* image=nullptr) override;\r
@@ -152,25 +94,19 @@ class GUIButton : public gui::IGUIButton
        */\r
        virtual void setSprite(gui::EGUI_BUTTON_STATE state, s32 index,\r
                                                   video::SColor color=video::SColor(255,255,255,255),\r
-                                                  bool loop=false, bool scale=false) OVERRIDE_19;\r
-\r
-#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 8)\r
-       void setSprite(gui::EGUI_BUTTON_STATE state, s32 index, video::SColor color, bool loop) override {\r
-               setSprite(state, index, color, loop, false);\r
-       }\r
-#endif\r
+                                                  bool loop=false, bool scale=false) override;\r
 \r
        //! Get the sprite-index for the given state or -1 when no sprite is set\r
-       virtual s32 getSpriteIndex(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19;\r
+       virtual s32 getSpriteIndex(gui::EGUI_BUTTON_STATE state) const override;\r
 \r
        //! Get the sprite color for the given state. Color is only used when a sprite is set.\r
-       virtual video::SColor getSpriteColor(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19;\r
+       virtual video::SColor getSpriteColor(gui::EGUI_BUTTON_STATE state) const override;\r
 \r
        //! Returns if the sprite in the given state does loop\r
-       virtual bool getSpriteLoop(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19;\r
+       virtual bool getSpriteLoop(gui::EGUI_BUTTON_STATE state) const override;\r
 \r
        //! Returns if the sprite in the given state is scaled\r
-       virtual bool getSpriteScale(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19;\r
+       virtual bool getSpriteScale(gui::EGUI_BUTTON_STATE state) const override;\r
 \r
        //! Sets if the button should behave like a push button. Which means it\r
        //! can be in two states: Normal or Pressed. With a click on the button,\r
@@ -210,13 +146,13 @@ class GUIButton : public gui::IGUIButton
        virtual bool isScalingImage() const override;\r
 \r
        //! Get if the shift key was pressed in last EGET_BUTTON_CLICKED event\r
-       virtual bool getClickShiftState() const OVERRIDE_19\r
+       virtual bool getClickShiftState() const override\r
        {\r
                return ClickShiftState;\r
        }\r
 \r
        //! Get if the control key was pressed in last EGET_BUTTON_CLICKED event\r
-       virtual bool getClickControlState() const OVERRIDE_19\r
+       virtual bool getClickControlState() const override\r
        {\r
                return ClickControlState;\r
        }\r
index 787afed7e140291a3e8fcfe4b7798e4ee588b185..df4fd466b92f17873c2ce0646cb957d06ad1c3bb 100644 (file)
@@ -673,13 +673,11 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
                        }
                }
        }
-#if (IRRLICHT_VERSION_MT_REVISION >= 2)
        else if(event.EventType == EET_STRING_INPUT_EVENT)
        {
                prompt.input(std::wstring(event.StringInput.Str->c_str()));
                return true;
        }
-#endif
 
        return Parent ? Parent->OnEvent(event) : false;
 }
index 4a0f5013dfb030f0d4e16bc97eb9f639f16281e4..e25c9ace39f9da61d13232f822ef545419e90e9d 100644 (file)
@@ -200,7 +200,6 @@ void GUIEditBox::sendGuiEvent(EGUI_EVENT_TYPE type)
 bool GUIEditBox::OnEvent(const SEvent &event)
 {
        if (isEnabled()) {
-
                switch (event.EventType) {
                case EET_GUI_EVENT:
                        if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST) {
@@ -218,11 +217,9 @@ bool GUIEditBox::OnEvent(const SEvent &event)
                        if (processMouse(event))
                                return true;
                        break;
-#if (IRRLICHT_VERSION_MT_REVISION >= 2)
                case EET_STRING_INPUT_EVENT:
                        inputString(*event.StringInput.Str);
                        return true;
-#endif
                default:
                        break;
                }
index 2721364f5890d5ab9d80a9f584d677553b285fbc..ebbdf4cf4e4c822e8f34b8a2dd97af93ac6d759f 100644 (file)
@@ -138,10 +138,8 @@ namespace gui
 
                                bool flgmip = driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
                                driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
-#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
                                bool flgcpy = driver->getTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY);
                                driver->setTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY, true);
-#endif
 
                                // Set the texture color format.
                                switch (pixel_mode)
@@ -157,9 +155,8 @@ namespace gui
 
                                // Restore our texture creation flags.
                                driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, flgmip);
-#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
                                driver->setTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY, flgcpy);
-#endif
+
                                return texture ? true : false;
                        }
 
index a4749bab13256c6bbb1b62b976a89ee7d666a7c7..4dc4523491152cea12a7021426907baa06046467 100644 (file)
@@ -239,12 +239,10 @@ video::SColor StaticText::getOverrideColor() const
        return ColoredText.getDefaultColor();
 }
 
-#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
 video::SColor StaticText::getActiveColor() const
 {
        return getOverrideColor();
 }
-#endif
 
 //! Sets if the static text should use the overide color or the
 //! color in the gui skin.
index fc58e3e906c171a8597a493f36cfafd72ed3ad67..93a2d86432ccf940773c6bcb08dec3cc25a72b92 100644 (file)
@@ -135,10 +135,8 @@ namespace gui
                //! Gets the override color
                virtual video::SColor getOverrideColor() const;
 
-               #if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
                //! Gets the currently used text color
                virtual video::SColor getActiveColor() const;
-               #endif
 
                //! Sets if the static text should use the overide color or the
                //! color in the gui skin.
index 93c2d105b923e856729a34ff0d4a72735886e90c..343eba1dcd0be4e9678d5206057623ad6cd31164 100644 (file)
@@ -31,7 +31,7 @@ using namespace irr;
 
 namespace irr {
 
-#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR >= 9)
+// Define missing constant for vector math with 16-bit numbers
 namespace core {
        template <typename T>
        inline T roundingError();
@@ -42,7 +42,6 @@ namespace core {
                return 0;
        }
 }
-#endif
 
 }