Advertisement
Guest User

Untitled

a guest
Dec 1st, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.03 KB | None | 0 0
  1. diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
  2. index 333d98c..cc29e28 100644
  3. --- a/src/defaultsettings.cpp
  4. +++ b/src/defaultsettings.cpp
  5. @@ -114,6 +114,8 @@ void set_default_settings(Settings *settings)
  6.     settings->setDefault("bilinear_filter", "false");
  7.     settings->setDefault("trilinear_filter", "false");
  8.  
  9. +   settings->setDefault("enable_shaders", "0");
  10. +   settings->setDefault("on_demand_item_images", "false");
  11.     // Server stuff
  12.     // "map-dir" doesn't exist by default.
  13.     settings->setDefault("default_game", "minetest");
  14. diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp
  15. index 0bdb44e..abcf943 100644
  16. --- a/src/guiMainMenu.cpp
  17. +++ b/src/guiMainMenu.cpp
  18. @@ -102,6 +102,8 @@ enum
  19.     GUI_ID_ANISOTROPIC_CB,
  20.     GUI_ID_BILINEAR_CB,
  21.     GUI_ID_TRILINEAR_CB,
  22. +   GUI_ID_SHADERS_CB,
  23. +   GUI_ID_ON_DEMAND_ITEM_IMAGES_CB,
  24.     GUI_ID_DAMAGE_CB,
  25.     GUI_ID_CREATIVE_CB,
  26.     GUI_ID_JOIN_GAME_BUTTON,
  27. @@ -616,6 +618,21 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
  28.                        GUI_ID_TRILINEAR_CB, wgettext("Tri-Linear Filtering"));
  29.         }
  30.  
  31. +       // shader/on demand image loading settings
  32. +       {
  33. +           core::rect<s32> rect(0, 0, option_w+20, 30);
  34. +           rect += m_topleft_client + v2s32(option_x+175*2, option_y);
  35. +           Environment->addCheckBox(m_data->enable_shaders, rect, this,
  36. +                   GUI_ID_SHADERS_CB, wgettext("Shaders"));
  37. +       }
  38. +
  39. +       {
  40. +           core::rect<s32> rect(0, 0, option_w+20, 30);
  41. +           rect += m_topleft_client + v2s32(option_x+175*2, option_y+20);
  42. +           Environment->addCheckBox(m_data->on_demand_item_images, rect, this,
  43. +                   GUI_ID_ON_DEMAND_ITEM_IMAGES_CB, wgettext("On-demand item images"));
  44. +       }
  45. +
  46.         // Key change button
  47.         {
  48.             core::rect<s32> rect(0, 0, 120, 30);
  49. @@ -821,6 +838,18 @@ void GUIMainMenu::readInput(MainMenuData *dst)
  50.     }
  51.  
  52.     {
  53. +       gui::IGUIElement *e = getElementFromId(GUI_ID_BILINEAR_CB);
  54. +       if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
  55. +               dst->enable_shaders = ((gui::IGUICheckBox*)e)->isChecked() ? 2 : 0;
  56. +   }
  57. +
  58. +   {
  59. +       gui::IGUIElement *e = getElementFromId(GUI_ID_TRILINEAR_CB);
  60. +       if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
  61. +               dst->on_demand_item_images = ((gui::IGUICheckBox*)e)->isChecked();
  62. +   }
  63. +
  64. +   {
  65.         gui::IGUIElement *e = getElementFromId(GUI_ID_WORLD_LISTBOX);
  66.         if(e != NULL && e->getType() == gui::EGUIET_LIST_BOX)
  67.             dst->selected_world = ((gui::IGUIListBox*)e)->getSelected();
  68. diff --git a/src/guiMainMenu.h b/src/guiMainMenu.h
  69. index abfc6bd..41eaee8 100644
  70. --- a/src/guiMainMenu.h
  71. +++ b/src/guiMainMenu.h
  72. @@ -45,6 +45,8 @@ struct MainMenuData
  73.     bool anisotropic_filter;
  74.     bool bilinear_filter;
  75.     bool trilinear_filter;
  76. +   int enable_shaders;
  77. +   bool on_demand_item_images;
  78.     // Server options
  79.     bool creative_mode;
  80.     bool enable_damage;
  81. diff --git a/src/main.cpp b/src/main.cpp
  82. index dcc47cd..dce4025 100644
  83. --- a/src/main.cpp
  84. +++ b/src/main.cpp
  85. @@ -1440,6 +1440,8 @@ int main(int argc, char *argv[])
  86.                 menudata.anisotropic_filter = g_settings->getBool("anisotropic_filter");
  87.                 menudata.bilinear_filter = g_settings->getBool("bilinear_filter");
  88.                 menudata.trilinear_filter = g_settings->getBool("trilinear_filter");
  89. +               menudata.enable_shaders = g_settings->getS32("enable_shaders");
  90. +               menudata.on_demand_item_images = g_settings->getBool("on_demand_item_images");
  91.                 driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, menudata.mip_map);
  92.                 menudata.creative_mode = g_settings->getBool("creative_mode");
  93.                 menudata.enable_damage = g_settings->getBool("enable_damage");
  94. @@ -1560,6 +1562,9 @@ int main(int argc, char *argv[])
  95.                 g_settings->set("bilinear_filter", itos(menudata.bilinear_filter));
  96.                 g_settings->set("trilinear_filter", itos(menudata.trilinear_filter));
  97.  
  98. +               g_settings->setS32("enable_shaders", menudata.enable_shaders);
  99. +               g_settings->set("on_demand_item_images", itos(menudata.on_demand_item_images));
  100. +
  101.                 g_settings->set("creative_mode", itos(menudata.creative_mode));
  102.                 g_settings->set("enable_damage", itos(menudata.enable_damage));
  103.                 g_settings->set("name", playername);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement