Move tool stuff to tool.{h,cpp}
[oweals/minetest.git] / src / main.cpp
index 6739a77590e01a503bbd8e2495c524937806e284..6b0cc1f83ff9ab02c18d12b51329b3c15db3cfc6 100644 (file)
@@ -365,11 +365,6 @@ SUGG: Restart irrlicht completely when coming back to main menu from game.
 
 TODO: Merge bahamada's audio stuff (clean patch available)
 
-TODO: Move content_features to mapnode_content_features.{h,cpp} or so
-
-TODO: Fix item use() stuff; dropping a stack of cooked rats and eating
-      it gives 3 hearts and consumes all the rats.
-
 Making it more portable:
 ------------------------
  
@@ -439,6 +434,8 @@ Doing currently:
 #include "settings.h"
 #include "profiler.h"
 #include "log.h"
+#include "mapnode_contentfeatures.h" // For init_contentfeatures
+#include "content_mapnode.h" // For content_mapnode_init
 
 // This makes textures
 ITextureSource *g_texturesource = NULL;
@@ -1278,8 +1275,10 @@ int main(int argc, char *argv[])
                These are needed for unit tests at least.
        */
        
-       // Initial call with g_texturesource not set.
-       init_mapnode();
+       // Initialize content feature table
+       init_contentfeatures();
+       // Initialize mapnode content without textures (with g_texturesource=NULL)
+       content_mapnode_init();
        // Must be called before g_texturesource is created
        // (for texture atlas making)
        init_mineral();
@@ -1407,6 +1406,21 @@ int main(int argc, char *argv[])
        if (device == 0)
                return 1; // could not create selected driver.
        
+       /*
+               Continue initialization
+       */
+
+       video::IVideoDriver* driver = device->getVideoDriver();
+
+       // Disable mipmaps (because some of them look ugly)
+       driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false);
+
+       /*
+               This changes the minimum allowed number of vertices in a VBO.
+               Default is 500.
+       */
+       //driver->setMinHardwareBufferVertexCount(50);
+
        // Set the window caption
        device->setWindowCaption(L"Minetest [Main Menu]");
        
@@ -1439,18 +1453,6 @@ int main(int argc, char *argv[])
        else
                input = new RealInputHandler(device, &receiver);
        
-       /*
-               Continue initialization
-       */
-
-       //video::IVideoDriver* driver = device->getVideoDriver();
-
-       /*
-               This changes the minimum allowed number of vertices in a VBO.
-               Default is 500.
-       */
-       //driver->setMinHardwareBufferVertexCount(50);
-
        scene::ISceneManager* smgr = device->getSceneManager();
 
        guienv = device->getGUIEnvironment();
@@ -1479,7 +1481,8 @@ int main(int argc, char *argv[])
                Preload some textures and stuff
        */
 
-       init_mapnode(); // Second call with g_texturesource set
+       // Initialize mapnode content with textures (with g_texturesource!=NULL)
+       content_mapnode_init();
 
        /*
                GUI stuff
@@ -1544,6 +1547,7 @@ int main(int argc, char *argv[])
                                menudata.fancy_trees = g_settings->getBool("new_style_leaves");
                                menudata.smooth_lighting = g_settings->getBool("smooth_lighting");
                                menudata.clouds_3d = g_settings->getBool("enable_3d_clouds");
+                               menudata.opaque_water = g_settings->getBool("opaque_water");
                                menudata.creative_mode = g_settings->getBool("creative_mode");
                                menudata.enable_damage = g_settings->getBool("enable_damage");
 
@@ -1617,6 +1621,7 @@ int main(int argc, char *argv[])
                                g_settings->set("new_style_leaves", itos(menudata.fancy_trees));
                                g_settings->set("smooth_lighting", itos(menudata.smooth_lighting));
                                g_settings->set("enable_3d_clouds", itos(menudata.clouds_3d));
+                               g_settings->set("opaque_water", itos(menudata.opaque_water));
                                g_settings->set("creative_mode", itos(menudata.creative_mode));
                                g_settings->set("enable_damage", itos(menudata.enable_damage));
                                
@@ -1653,7 +1658,10 @@ int main(int argc, char *argv[])
                                break;
                        
                        // Initialize mapnode again to enable changed graphics settings
-                       init_mapnode();
+                       // Initialize content feature table
+                       init_contentfeatures();
+                       // Initialize mapnode content with textures (with g_texturesource!=NULL)
+                       content_mapnode_init();
 
                        /*
                                Run game