Remove dead code behind Irrlicht version checks

This commit is contained in:
sfan5 2023-02-18 00:29:34 +01:00
parent 2dafce6206
commit 3bafbaac49
11 changed files with 14 additions and 133 deletions

@ -1008,10 +1008,6 @@ private:
// this happens in pause menu in singleplayer // this happens in pause menu in singleplayer
bool m_is_paused = false; bool m_is_paused = false;
#if IRRLICHT_VERSION_MT_REVISION < 5
int m_reset_HW_buffer_counter = 0;
#endif
#ifdef HAVE_TOUCHSCREENGUI #ifdef HAVE_TOUCHSCREENGUI
bool m_cache_hold_aux1; bool m_cache_hold_aux1;
bool m_touch_use_crosshair; bool m_touch_use_crosshair;
@ -4153,29 +4149,6 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
/* /*
==================== End scene ==================== ==================== 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(); driver->endScene();

@ -1395,14 +1395,6 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset):
MapBlockMesh::~MapBlockMesh() MapBlockMesh::~MapBlockMesh()
{ {
for (scene::IMesh *m : m_mesh) { 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(); m->drop();
} }
for (MinimapMapblock *block : m_minimap_mapblocks) for (MinimapMapblock *block : m_minimap_mapblocks)

@ -39,13 +39,8 @@ static video::SMaterial baseMaterial()
{ {
video::SMaterial mat; video::SMaterial mat;
mat.Lighting = false; mat.Lighting = false;
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
mat.ZBuffer = video::ECFN_DISABLED; mat.ZBuffer = video::ECFN_DISABLED;
mat.ZWriteEnable = video::EZW_OFF; mat.ZWriteEnable = video::EZW_OFF;
#else
mat.ZWriteEnable = false;
mat.ZBuffer = video::ECFN_NEVER;
#endif
mat.AntiAliasing = 0; mat.AntiAliasing = 0;
mat.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE; mat.TextureLayer[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE;
mat.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; mat.TextureLayer[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE;

@ -499,12 +499,10 @@ video::SColor GUIButton::getOverrideColor() const
return OverrideColor; return OverrideColor;
} }
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
video::SColor GUIButton::getActiveColor() const video::SColor GUIButton::getActiveColor() const
{ {
return video::SColor(0,0,0,0); // unused? return video::SColor(0,0,0,0); // unused?
} }
#endif
void GUIButton::enableOverrideColor(bool enable) void GUIButton::enableOverrideColor(bool enable)
{ {

@ -17,64 +17,8 @@
using namespace irr; using namespace irr;
#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 8)
namespace irr { namespace gui {
//! State of buttons used for drawing texture images.
//! Note that only a single state is active at a time
//! Also when no image is defined for a state it will use images from another state
//! and if that state is not set from the replacement for that,etc.
//! So in many cases setting EGBIS_IMAGE_UP and EGBIS_IMAGE_DOWN is sufficient.
enum EGUI_BUTTON_IMAGE_STATE {
//! When no other states have images they will all use this one.
EGBIS_IMAGE_UP,
//! When not set EGBIS_IMAGE_UP is used.
EGBIS_IMAGE_UP_MOUSEOVER,
//! When not set EGBIS_IMAGE_UP_MOUSEOVER is used.
EGBIS_IMAGE_UP_FOCUSED,
//! When not set EGBIS_IMAGE_UP_FOCUSED is used.
EGBIS_IMAGE_UP_FOCUSED_MOUSEOVER,
//! When not set EGBIS_IMAGE_UP is used.
EGBIS_IMAGE_DOWN,
//! When not set EGBIS_IMAGE_DOWN is used.
EGBIS_IMAGE_DOWN_MOUSEOVER,
//! When not set EGBIS_IMAGE_DOWN_MOUSEOVER is used.
EGBIS_IMAGE_DOWN_FOCUSED,
//! When not set EGBIS_IMAGE_DOWN_FOCUSED is used.
EGBIS_IMAGE_DOWN_FOCUSED_MOUSEOVER,
//! When not set EGBIS_IMAGE_UP or EGBIS_IMAGE_DOWN are used (depending on button state).
EGBIS_IMAGE_DISABLED,
//! not used, counts the number of enumerated items
EGBIS_COUNT
};
//! Names for gui button image states
const c8 *const GUIButtonImageStateNames[EGBIS_COUNT + 1] =
{
"Image", // not "ImageUp" as it otherwise breaks serialization of old files
"ImageUpOver",
"ImageUpFocused",
"ImageUpFocusedOver",
"PressedImage", // not "ImageDown" as it otherwise breaks serialization of old files
"ImageDownOver",
"ImageDownFocused",
"ImageDownFocusedOver",
"ImageDisabled",
0 // count
};
}}
#endif
class ISimpleTextureSource; class ISimpleTextureSource;
#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 8)
#define OVERRIDE_19
#else
#define OVERRIDE_19 override
#endif
class GUIButton : public gui::IGUIButton class GUIButton : public gui::IGUIButton
{ {
public: public:
@ -103,27 +47,25 @@ public:
virtual gui::IGUIFont* getActiveFont() const override; virtual gui::IGUIFont* getActiveFont() const override;
//! Sets another color for the button text. //! Sets another color for the button text.
virtual void setOverrideColor(video::SColor color) OVERRIDE_19; virtual void setOverrideColor(video::SColor color) override;
//! Gets the override color //! Gets the override color
virtual video::SColor getOverrideColor(void) const OVERRIDE_19; virtual video::SColor getOverrideColor() const override;
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
//! Gets the currently used text color //! Gets the currently used text color
virtual video::SColor getActiveColor() const override; virtual video::SColor getActiveColor() const override;
#endif
//! Sets if the button text should use the override color or the color in the gui skin. //! Sets if the button text should use the override color or the color in the gui skin.
virtual void enableOverrideColor(bool enable) OVERRIDE_19; virtual void enableOverrideColor(bool enable) override;
//! Checks if an override color is enabled //! Checks if an override color is enabled
virtual bool isOverrideColorEnabled(void) const OVERRIDE_19; virtual bool isOverrideColorEnabled(void) const override;
// PATCH // PATCH
//! Sets an image which should be displayed on the button when it is in the given state. //! Sets an image which should be displayed on the button when it is in the given state.
virtual void setImage(gui::EGUI_BUTTON_IMAGE_STATE state, virtual void setImage(gui::EGUI_BUTTON_IMAGE_STATE state,
video::ITexture* image=nullptr, video::ITexture* image=nullptr,
const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)) OVERRIDE_19; const core::rect<s32>& sourceRect=core::rect<s32>(0,0,0,0)) override;
//! Sets an image which should be displayed on the button when it is in normal state. //! Sets an image which should be displayed on the button when it is in normal state.
virtual void setImage(video::ITexture* image=nullptr) override; virtual void setImage(video::ITexture* image=nullptr) override;
@ -152,25 +94,19 @@ public:
*/ */
virtual void setSprite(gui::EGUI_BUTTON_STATE state, s32 index, virtual void setSprite(gui::EGUI_BUTTON_STATE state, s32 index,
video::SColor color=video::SColor(255,255,255,255), video::SColor color=video::SColor(255,255,255,255),
bool loop=false, bool scale=false) OVERRIDE_19; bool loop=false, bool scale=false) override;
#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR <= 8)
void setSprite(gui::EGUI_BUTTON_STATE state, s32 index, video::SColor color, bool loop) override {
setSprite(state, index, color, loop, false);
}
#endif
//! Get the sprite-index for the given state or -1 when no sprite is set //! Get the sprite-index for the given state or -1 when no sprite is set
virtual s32 getSpriteIndex(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19; virtual s32 getSpriteIndex(gui::EGUI_BUTTON_STATE state) const override;
//! Get the sprite color for the given state. Color is only used when a sprite is set. //! Get the sprite color for the given state. Color is only used when a sprite is set.
virtual video::SColor getSpriteColor(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19; virtual video::SColor getSpriteColor(gui::EGUI_BUTTON_STATE state) const override;
//! Returns if the sprite in the given state does loop //! Returns if the sprite in the given state does loop
virtual bool getSpriteLoop(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19; virtual bool getSpriteLoop(gui::EGUI_BUTTON_STATE state) const override;
//! Returns if the sprite in the given state is scaled //! Returns if the sprite in the given state is scaled
virtual bool getSpriteScale(gui::EGUI_BUTTON_STATE state) const OVERRIDE_19; virtual bool getSpriteScale(gui::EGUI_BUTTON_STATE state) const override;
//! Sets if the button should behave like a push button. Which means it //! Sets if the button should behave like a push button. Which means it
//! can be in two states: Normal or Pressed. With a click on the button, //! can be in two states: Normal or Pressed. With a click on the button,
@ -210,13 +146,13 @@ public:
virtual bool isScalingImage() const override; virtual bool isScalingImage() const override;
//! Get if the shift key was pressed in last EGET_BUTTON_CLICKED event //! Get if the shift key was pressed in last EGET_BUTTON_CLICKED event
virtual bool getClickShiftState() const OVERRIDE_19 virtual bool getClickShiftState() const override
{ {
return ClickShiftState; return ClickShiftState;
} }
//! Get if the control key was pressed in last EGET_BUTTON_CLICKED event //! Get if the control key was pressed in last EGET_BUTTON_CLICKED event
virtual bool getClickControlState() const OVERRIDE_19 virtual bool getClickControlState() const override
{ {
return ClickControlState; return ClickControlState;
} }

@ -673,13 +673,11 @@ bool GUIChatConsole::OnEvent(const SEvent& event)
} }
} }
} }
#if (IRRLICHT_VERSION_MT_REVISION >= 2)
else if(event.EventType == EET_STRING_INPUT_EVENT) else if(event.EventType == EET_STRING_INPUT_EVENT)
{ {
prompt.input(std::wstring(event.StringInput.Str->c_str())); prompt.input(std::wstring(event.StringInput.Str->c_str()));
return true; return true;
} }
#endif
return Parent ? Parent->OnEvent(event) : false; return Parent ? Parent->OnEvent(event) : false;
} }

@ -200,7 +200,6 @@ void GUIEditBox::sendGuiEvent(EGUI_EVENT_TYPE type)
bool GUIEditBox::OnEvent(const SEvent &event) bool GUIEditBox::OnEvent(const SEvent &event)
{ {
if (isEnabled()) { if (isEnabled()) {
switch (event.EventType) { switch (event.EventType) {
case EET_GUI_EVENT: case EET_GUI_EVENT:
if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST) { if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST) {
@ -218,11 +217,9 @@ bool GUIEditBox::OnEvent(const SEvent &event)
if (processMouse(event)) if (processMouse(event))
return true; return true;
break; break;
#if (IRRLICHT_VERSION_MT_REVISION >= 2)
case EET_STRING_INPUT_EVENT: case EET_STRING_INPUT_EVENT:
inputString(*event.StringInput.Str); inputString(*event.StringInput.Str);
return true; return true;
#endif
default: default:
break; break;
} }

@ -138,10 +138,8 @@ namespace gui
bool flgmip = driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS); bool flgmip = driver->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS);
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false); 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); bool flgcpy = driver->getTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY);
driver->setTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY, true); driver->setTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY, true);
#endif
// Set the texture color format. // Set the texture color format.
switch (pixel_mode) switch (pixel_mode)
@ -157,9 +155,8 @@ namespace gui
// Restore our texture creation flags. // Restore our texture creation flags.
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, flgmip); 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); driver->setTextureCreationFlag(video::ETCF_ALLOW_MEMORY_COPY, flgcpy);
#endif
return texture ? true : false; return texture ? true : false;
} }

@ -239,12 +239,10 @@ video::SColor StaticText::getOverrideColor() const
return ColoredText.getDefaultColor(); return ColoredText.getDefaultColor();
} }
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
video::SColor StaticText::getActiveColor() const video::SColor StaticText::getActiveColor() const
{ {
return getOverrideColor(); return getOverrideColor();
} }
#endif
//! Sets if the static text should use the overide color or the //! Sets if the static text should use the overide color or the
//! color in the gui skin. //! color in the gui skin.

@ -135,10 +135,8 @@ namespace gui
//! Gets the override color //! Gets the override color
virtual video::SColor getOverrideColor() const; virtual video::SColor getOverrideColor() const;
#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR > 8
//! Gets the currently used text color //! Gets the currently used text color
virtual video::SColor getActiveColor() const; virtual video::SColor getActiveColor() const;
#endif
//! Sets if the static text should use the overide color or the //! Sets if the static text should use the overide color or the
//! color in the gui skin. //! color in the gui skin.

@ -31,7 +31,7 @@ using namespace irr;
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 { namespace core {
template <typename T> template <typename T>
inline T roundingError(); inline T roundingError();
@ -42,7 +42,6 @@ namespace core {
return 0; return 0;
} }
} }
#endif
} }