]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/main.cpp
Two more instances of unhardcoding the project name
[dragonfireclient.git] / src / main.cpp
index e582569c521548dcc3431d10e91036eaf49c3d37..0001d33ecb71caa8855dcd4f39848c4684638d97 100644 (file)
@@ -27,6 +27,33 @@ NOTE: Global locale is now set at initialization
 NOTE: If VBO (EHM_STATIC) is used, remember to explicitly free the\r
       hardware buffer (it is not freed automatically)\r
 \r
+NOTE: A random to-do list saved here as documentation:\r
+A list of "active blocks" in which stuff happens. (+=done)\r
+       + Add a never-resetted game timer to the server\r
+       + Add a timestamp value to blocks\r
+       + The simple rule: All blocks near some player are "active"\r
+       - Do stuff in real time in active blocks\r
+               + Handle objects\r
+               - Grow grass, delete leaves without a tree\r
+               - Spawn some mobs based on some rules\r
+               - Transform cobble to mossy cobble near water\r
+               - Run a custom script\r
+               - ...And all kinds of other dynamic stuff\r
+       + Keep track of when a block becomes active and becomes inactive\r
+       + When a block goes inactive:\r
+               + Store objects statically to block\r
+               + Store timer value as the timestamp\r
+       + When a block goes active:\r
+               + Create active objects out of static objects\r
+               - Simulate the results of what would have happened if it would have\r
+                 been active for all the time\r
+                       - Grow a lot of grass and so on\r
+       + Initially it is fine to send information about every active object\r
+         to every player. Eventually it should be modified to only send info\r
+         about the nearest ones.\r
+               + This was left to be done by the old system and it sends only the\r
+                 nearest ones.\r
+\r
 Old, wild and random suggestions that probably won't be done:\r
 -------------------------------------------------------------\r
 \r
@@ -73,9 +100,6 @@ SUGG: Make the amount of blocks sending to client and the total
 SUGG: Meshes of blocks could be split into 6 meshes facing into\r
       different directions and then only those drawn that need to be\r
 \r
-SUGG: Calculate lighting per vertex to get a lighting effect like in\r
-      bartwe's game\r
-\r
 SUGG: Background music based on cellular automata?\r
       http://www.earslap.com/projectslab/otomata\r
 \r
@@ -89,6 +113,29 @@ SUGG: Make a system for pregenerating quick information for mapblocks, so
          that the client can show them as cubes before they are actually sent\r
          or even generated.\r
 \r
+SUGG: Erosion simulation at map generation time\r
+    - This might be plausible if larger areas of map were pregenerated\r
+         without lighting (which is slow)\r
+       - Simulate water flows, which would carve out dirt fast and\r
+         then turn stone into gravel and sand and relocate it.\r
+       - How about relocating minerals, too? Coal and gold in\r
+         downstream sand and gravel would be kind of cool\r
+         - This would need a better way of handling minerals, mainly\r
+               to have mineral content as a separate field. the first\r
+               parameter field is free for this.\r
+       - Simulate rock falling from cliffs when water has removed\r
+         enough solid rock from the bottom\r
+\r
+SUGG: For non-mapgen FarMesh: Add a per-sector database to store surface\r
+      stuff as simple flags/values\r
+      - Light?\r
+         - A building?\r
+         And at some point make the server send this data to the client too,\r
+         instead of referring to the noise functions\r
+         - Ground height\r
+         - Surface ground type\r
+         - Trees?\r
+\r
 Gaming ideas:\r
 -------------\r
 \r
@@ -162,17 +209,32 @@ SUGG: Make fetching sector's blocks more efficient when rendering
       sectors that have very large amounts of blocks (on client)\r
          - Is this necessary at all?\r
 \r
-TODO: Flowing water animation\r
-\r
 SUGG: Draw cubes in inventory directly with 3D drawing commands, so that\r
       animating them is easier.\r
 \r
 SUGG: Option for enabling proper alpha channel for textures\r
+\r
+TODO: Flowing water animation\r
+\r
 TODO: A setting for enabling bilinear filtering for textures\r
 \r
 TODO: Better control of draw_control.wanted_max_blocks\r
 \r
-TODO: Block mesh generator to tile properly on smooth lighting\r
+TODO: Further investigate the use of GPU lighting in addition to the\r
+      current one\r
+\r
+TODO: Artificial (night) light could be more yellow colored than sunlight.\r
+      - This is technically doable.\r
+         - Also the actual colors of the textures could be made less colorful\r
+           in the dark but it's a bit more difficult.\r
+\r
+SUGG: Somehow make the night less colorful\r
+\r
+TODO: Occlusion culling\r
+      - At the same time, move some of the renderMap() block choosing code\r
+        to the same place as where the new culling happens.\r
+      - Shoot some rays per frame and when ready, make a new list of\r
+           blocks for usage of renderMap and give it a new pointer to it.\r
 \r
 Configuration:\r
 --------------\r
@@ -198,6 +260,9 @@ TODO: Don't update all meshes always on single node changes, but
 \r
 FIXME: When disconnected to the menu, memory is not freed properly\r
 \r
+TODO: Investigate how much the mesh generator thread gets used when\r
+      transferring map data\r
+\r
 Server:\r
 -------\r
 \r
@@ -209,44 +274,20 @@ FIXME: Server sometimes goes into some infinite PeerNotFoundException loop
 * Fix the problem with the server constantly saving one or a few\r
   blocks? List the first saved block, maybe it explains.\r
   - It is probably caused by oscillating water\r
+  - TODO: Investigate if this still happens (this is a very old one)\r
 * Make a small history check to transformLiquids to detect and log\r
   continuous oscillations, in such detail that they can be fixed.\r
 \r
 FIXME: The new optimized map sending doesn't sometimes send enough blocks\r
        from big caves and such\r
-\r
-* Take player's walking direction into account in GetNextBlocks\r
+FIXME: Block send distance configuration does not take effect for some reason\r
 \r
 Environment:\r
 ------------\r
 \r
-TODO: A list of "active blocks" in which stuff happens.\r
-       + Add a never-resetted game timer to the server\r
-       + Add a timestamp value to blocks\r
-       + The simple rule: All blocks near some player are "active"\r
-       - Do stuff in real time in active blocks\r
-               + Handle objects\r
-               TODO: Make proper hooks in here\r
-               - Grow grass, delete leaves without a tree\r
-               - Spawn some mobs based on some rules\r
-               - Transform cobble to mossy cobble near water\r
-               - Run a custom script\r
-               - ...And all kinds of other dynamic stuff\r
-       + Keep track of when a block becomes active and becomes inactive\r
-       + When a block goes inactive:\r
-               + Store objects statically to block\r
-               + Store timer value as the timestamp\r
-       + When a block goes active:\r
-               + Create active objects out of static objects\r
-               TODO: Make proper hooks in here\r
-               - Simulate the results of what would have happened if it would have\r
-                 been active for all the time\r
-                       - Grow a lot of grass and so on\r
-       + Initially it is fine to send information about every active object\r
-         to every player. Eventually it should be modified to only send info\r
-         about the nearest ones.\r
-               + This was left to be done by the old system and it sends only the\r
-                 nearest ones.\r
+TODO: Add proper hooks to when adding and removing active blocks\r
+\r
+TODO: Finish the ActiveBlockModifier stuff and use it for something\r
 \r
 Objects:\r
 --------\r
@@ -258,6 +299,7 @@ TODO: Get rid of MapBlockObjects and use only ActiveObjects
 \r
 SUGG: MovingObject::move and Player::move are basically the same.\r
       combine them.\r
+       - NOTE: This is a bit tricky because player has the sneaking ability\r
        - NOTE: Player::move is more up-to-date.\r
        - NOTE: There is a simple move implementation now in collision.{h,cpp}\r
        - NOTE: MovingObject will be deleted (MapBlockObject)\r
@@ -271,38 +313,31 @@ TODO: Add a long step function to objects that is called with the time
 TODO: Mineral and ground material properties\r
       - This way mineral ground toughness can be calculated with just\r
            some formula, as well as tool strengths\r
+         - There are TODOs in appropriate files: material.h, content_mapnode.h\r
 \r
 TODO: Flowing water to actually contain flow direction information\r
       - There is a space for this - it just has to be implemented.\r
 \r
-SUGG: Erosion simulation at map generation time\r
-       - Simulate water flows, which would carve out dirt fast and\r
-         then turn stone into gravel and sand and relocate it.\r
-       - How about relocating minerals, too? Coal and gold in\r
-         downstream sand and gravel would be kind of cool\r
-         - This would need a better way of handling minerals, mainly\r
-               to have mineral content as a separate field. the first\r
-               parameter field is free for this.\r
-       - Simulate rock falling from cliffs when water has removed\r
-         enough solid rock from the bottom\r
-\r
-SUGG: Try out the notch way of generating maps, that is, make bunches\r
-      of low-res 3d noise and interpolate linearly.\r
-\r
-Mapgen v2:\r
-* Possibly add some kind of erosion and other stuff\r
-* Better water generation (spread it to underwater caverns but don't\r
-  fill dungeons that don't touch big water masses)\r
-* When generating a chunk and the neighboring chunk doesn't have mud\r
-  and stuff yet and the ground is fairly flat, the mud will flow to\r
-  the other chunk making nasty straight walls when the other chunk\r
-  is generated. Fix it. Maybe just a special case if the ground is\r
-  flat?\r
+TODO: Consider smoothening cave floors after generating them\r
 \r
 Misc. stuff:\r
 ------------\r
-* Move digging property stuff from material.{h,cpp} to mapnode.cpp\r
-  - ...Or maybe move content_features to material.{h,cpp}?\r
+TODO: Make sure server handles removing grass when a block is placed (etc)\r
+      - The client should not do it by itself\r
+         - NOTE: I think nobody does it currently...\r
+TODO: Block cube placement around player's head\r
+TODO: Protocol version field\r
+TODO: Think about using same bits for material for fences and doors, for\r
+         example\r
+TODO: Move mineral to param2, increment map serialization version, add\r
+      conversion\r
+\r
+TODO: Restart irrlicht completely when coming back to main menu from game.\r
+       - This gets rid of everything that is stored in irrlicht's caches.\r
+\r
+TODO: Merge bahamada's audio stuff (clean patch available)\r
+\r
+TODO: Merge key configuration menu (no clean patch available)\r
 \r
 Making it more portable:\r
 ------------------------\r
@@ -312,22 +347,12 @@ Stuff to do before release:
 \r
 Fixes to the current release:\r
 -----------------------------\r
-- Fix client password crash\r
-- Remember to release the fixes (some are already done)\r
 \r
 Stuff to do after release:\r
 ---------------------------\r
-- Make sure server handles removing grass when a block is placed (etc)\r
-    - The client should not do it by itself\r
-- Block cube placement around player's head\r
-- Protocol version field\r
-- Consider getting some textures from cisoun's texture pack\r
-       - Ask from Cisoun\r
-- Make sure the fence implementation and data format is good\r
-       - Think about using same bits for material for fences and doors, for\r
-       example\r
-- Finish the ActiveBlockModifier stuff and use it for something\r
-- Move mineral to param2, increment map serialization version, add conversion\r
+\r
+Doing currently:\r
+----------------\r
 \r
 ======================================================================\r
 \r
@@ -357,16 +382,12 @@ Stuff to do after release:
 \r
 #include <iostream>\r
 #include <fstream>\r
-//#include <jmutexautolock.h>\r
 #include <locale.h>\r
 #include "main.h"\r
 #include "common_irrlicht.h"\r
 #include "debug.h"\r
-//#include "map.h"\r
-//#include "player.h"\r
 #include "test.h"\r
 #include "server.h"\r
-//#include "client.h"\r
 #include "constants.h"\r
 #include "porting.h"\r
 #include "gettime.h"\r
@@ -375,11 +396,12 @@ Stuff to do after release:
 #include "config.h"\r
 #include "guiMainMenu.h"\r
 #include "mineral.h"\r
-//#include "noise.h"\r
-//#include "tile.h"\r
 #include "materials.h"\r
 #include "game.h"\r
 #include "keycode.h"\r
+#include "tile.h"\r
+\r
+#include "gettext.h"\r
 \r
 // This makes textures\r
 ITextureSource *g_texturesource = NULL;\r
@@ -1030,6 +1052,14 @@ void drawMenuBackground(video::IVideoDriver* driver)
 \r
 int main(int argc, char *argv[])\r
 {\r
+       /*\r
+               Initialization\r
+       */\r
+\r
+       // Set locale. This is for forcing '.' as the decimal point.\r
+       std::locale::global(std::locale("C"));\r
+       // This enables printing all characters in bitmap font\r
+       setlocale(LC_CTYPE, "en_US");\r
        /*\r
                Parse command line\r
        */\r
@@ -1093,28 +1123,37 @@ int main(int argc, char *argv[])
                disable_stderr = true;\r
 #endif\r
 \r
-       // Initialize debug streams\r
-       debugstreams_init(disable_stderr, DEBUGFILE);\r
-       // Initialize debug stacks\r
-       debug_stacks_init();\r
-\r
-       DSTACK(__FUNCTION_NAME);\r
-\r
        porting::signal_handler_init();\r
        bool &kill = *porting::signal_handler_killstatus();\r
        \r
+       // Initialize porting::path_data and porting::path_userdata\r
        porting::initializePaths();\r
+\r
        // Create user data directory\r
        fs::CreateDir(porting::path_userdata);\r
-       \r
-       // C-style stuff initialization\r
-       initializeMaterialProperties();\r
+\r
+       init_gettext((porting::path_userdata+"/locale").c_str());\r
+\r
+       // Initialize debug streams\r
+#ifdef RUN_IN_PLACE\r
+       std::string debugfile = DEBUGFILE;\r
+#else\r
+       std::string debugfile = porting::path_userdata+"/"+DEBUGFILE;\r
+#endif\r
+       debugstreams_init(disable_stderr, debugfile.c_str());\r
+       // Initialize debug stacks\r
+       debug_stacks_init();\r
+\r
+       DSTACK(__FUNCTION_NAME);\r
+\r
+       // Init material properties table\r
+       //initializeMaterialProperties();\r
 \r
        // Debug handler\r
        BEGIN_DEBUG_EXCEPTION_HANDLER\r
 \r
        // Print startup message\r
-       dstream<<DTIME<<"minetest-c55"\r
+       dstream<<DTIME<<PROJECT_NAME <<\r
                        " with SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST\r
                        <<", "<<BUILD_INFO\r
                        <<std::endl;\r
@@ -1126,19 +1165,10 @@ int main(int argc, char *argv[])
        // Initialize default settings\r
        set_default_settings();\r
        \r
-       // Set locale. This is for forcing '.' as the decimal point.\r
-       std::locale::global(std::locale("C"));\r
-       // This enables printing all characters in bitmap font\r
-       setlocale(LC_CTYPE, "en_US");\r
-\r
        // Initialize sockets\r
        sockets_init();\r
        atexit(sockets_cleanup);\r
        \r
-       /*\r
-               Initialization\r
-       */\r
-\r
        /*\r
                Read config file\r
        */\r
@@ -1318,6 +1348,9 @@ int main(int argc, char *argv[])
        \r
        // Set device in game parameters\r
        device = device;\r
+
+       // Set the window caption
+       device->setWindowCaption(L"Minetest [Main Menu]");
        \r
        // Create time getter\r
        g_timegetter = new IrrlichtTimeGetter(device);\r
@@ -1388,7 +1421,6 @@ int main(int argc, char *argv[])
                Preload some textures and stuff\r
        */\r
 \r
-       init_content_inventory_texture_paths();\r
        init_mapnode(); // Second call with g_texturesource set\r
        init_mineral();\r
 \r
@@ -1527,6 +1559,8 @@ int main(int argc, char *argv[])
                                g_settings.set("creative_mode", itos(menudata.creative_mode));\r
                                g_settings.set("enable_damage", itos(menudata.enable_damage));\r
                                \r
+                               // NOTE: These are now checked server side; no need to do it\r
+                               //       here, so let's not do it here.\r
                                /*// Check for valid parameters, restart menu if invalid.\r
                                if(playername == "")\r
                                {\r