diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index c1d1f59..4ddabab 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -109,6 +109,7 @@ void set_default_settings(Settings *settings) settings->setDefault("enable_3d_clouds", "true"); settings->setDefault("opaque_water", "false"); settings->setDefault("enable_particles", "true"); + settings->setDefault("enable_animated_textures", "true"); settings->setDefault("mip_map", "true"); settings->setDefault("anisotropic_filter", "true"); settings->setDefault("bilinear_filter", "false"); diff --git a/src/guiSettingsMenu.cpp b/src/guiSettingsMenu.cpp index 354be71..b0668fc 100644 --- a/src/guiSettingsMenu.cpp +++ b/src/guiSettingsMenu.cpp @@ -66,6 +66,7 @@ GUISettingsMenu::GUISettingsMenu( m_data.hotbar = g_settings->getBool("old_hotbar"); m_data.wield_index = g_settings->getBool("enable_wieldindex"); m_data.volume = g_settings->getFloat("sound_volume"); + m_data.texture_animation = g_settings->getBool("enable_animated_textures"); keynames[VLKC_FORWARD] = wgettext("Forward"); keynames[VLKC_BACKWARD] = wgettext("Backward"); @@ -127,6 +128,7 @@ void GUISettingsMenu::save() g_settings->set("light_detail", itos(m_data.light_detail)); g_settings->set("old_hotbar", itos(m_data.hotbar)); g_settings->set("enable_wieldindex", itos(m_data.wield_index)); + g_settings->set("enable_animated_textures", itos(m_data.texture_animation)); // video g_settings->set("mip_map", itos(m_data.mip_map)); g_settings->set("anisotropic_filter", itos(m_data.anisotropic_filter)); @@ -152,6 +154,7 @@ void GUISettingsMenu::regenerateGui(v2u32 screensize) bool anisotropic; bool hotbar; bool wield_index; + bool texture_animation; f32 volume; m_screensize = screensize; @@ -261,6 +264,13 @@ void GUISettingsMenu::regenerateGui(v2u32 screensize) else anisotropic = m_data.anisotropic_filter; } + { + gui::IGUIElement *e = getElementFromId(GUI_ID_TEXTUREANIM_CB); + if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) + texture_animation = ((gui::IGUICheckBox*)e)->isChecked(); + else + texture_animation = m_data.texture_animation; + } { gui::IGUIElement *e = getElementFromId(GUI_ID_HOTBAR_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) @@ -504,9 +514,14 @@ void GUISettingsMenu::regenerateGui(v2u32 screensize) rect += topleft_content + v2s32(80, 210); Environment->addCheckBox(anisotropic, rect, this, GUI_ID_ANISOTROPIC_CB, wgettext("Anisotropic Filtering")); } + { + core::rect rect(0, 0, 200, 30); + rect += topleft_content + v2s32(80, 240); + Environment->addCheckBox(texture_animation, rect, this, GUI_ID_TEXTUREANIM_CB, wgettext("Enable Texture Animation")); + } if (m_is_ingame) { core::rect rect(0, 0, 550, 20); - rect += topleft_content + v2s32(0, 250); + rect += topleft_content + v2s32(0, 280); gui::IGUIStaticText *t = Environment->addStaticText(wgettext("Some settings cannot be changed in-game."), rect, false, true, this, -1); t->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_UPPERLEFT); } @@ -659,6 +674,11 @@ bool GUISettingsMenu::acceptInput() if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) m_data.anisotropic_filter = ((gui::IGUICheckBox*)e)->isChecked(); } + { + gui::IGUIElement *e = getElementFromId(GUI_ID_TEXTUREANIM_CB); + if (e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) + m_data.texture_animation = ((gui::IGUICheckBox*)e)->isChecked(); + } { gui::IGUIElement *e = getElementFromId(GUI_ID_HOTBAR_CB); if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX) diff --git a/src/guiSettingsMenu.h b/src/guiSettingsMenu.h index e9e3e0d..7405565 100644 --- a/src/guiSettingsMenu.h +++ b/src/guiSettingsMenu.h @@ -55,6 +55,7 @@ enum GUI_ID_LIGHT_DETAIL_HIGH, GUI_ID_HOTBAR_CB, GUI_ID_WIELDINDEX_CB, + GUI_ID_TEXTUREANIM_CB, // video GUI_ID_MIPMAP_CB, GUI_ID_BILINEAR_CB, @@ -94,7 +95,8 @@ struct SettingsMenuData wield_index(false), volume(0.0f), particles(true), - fullscreen(false) + fullscreen(false), + texture_animation(true) {} // These are in the native format of the gui elements @@ -115,6 +117,7 @@ struct SettingsMenuData //int enable_shaders; bool particles; bool fullscreen; + bool texture_animation; }; class GUISettingsMenu: public GUIModalMenu diff --git a/src/map.cpp b/src/map.cpp index 3a452ec..b2f7552 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -3090,6 +3090,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) // Blocks from which stuff was actually drawn u32 blocks_without_stuff = 0; + bool anim_textures = g_settings->getBool("enable_animated_textures"); float anim_time = m_client->getAnimationTime(); /* @@ -3275,7 +3276,7 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass) continue; // Animate textures in block mesh - if (block->mesh->isAnimated()) { + if (anim_textures && block->mesh->isAnimated()) { //JMutexAutoLock lock(block->mesh_mutex); //needed? block->mesh->animate(anim_time); } diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index 5abd9c0..2eb2b6c 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -677,7 +677,7 @@ void MapBlockMesh::generate(MeshMakeData *data, v3s16 camera_offset, JMutex *mut // Add to MapBlockMesh in order to animate these tiles AnimationData anim_data; anim_data.tile = d.tile; - anim_data.frame = 0; + anim_data.frame = -1; m_animation_data[i] = anim_data; } @@ -725,7 +725,7 @@ void MapBlockMesh::generate(MeshMakeData *data, v3s16 camera_offset, JMutex *mut m_meshdata.swap(data->m_meshdata); m_fardata.swap(data->m_fardata); refresh(data->m_daynight_ratio); - animate(0.0);// get first frame of animation + animate(0.0); // get first frame of animation m_mesh->recalculateBoundingBox(); if (mutex != NULL) diff --git a/voxelands.conf.example b/voxelands.conf.example index cb3639d..1340d87 100644 --- a/voxelands.conf.example +++ b/voxelands.conf.example @@ -77,6 +77,8 @@ # Enable smooth lighting with simple ambient occlusion; # disable for speed or for different looks. #smooth_lighting = true +# Enable Texture Animations +#enable_animated_textures = true # Whether to draw a frametime graph (for debugging frametime) #frametime_graph = false # Enable combining mainly used textures to a bigger one for improved speed @@ -251,4 +253,3 @@ #enable_experimental = false # a slow delete for objects, stops them being loaded from disk #onload_ignore_objects = false -