]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/main.cpp
+ paper, book, bookshelf
[dragonfireclient.git] / src / main.cpp
index 429b769f7b28081ffa1270e1753d237b1f3c0b2c..f67d53475ad234fbc5105dc07a7bca343c471849 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
 Minetest-c55\r
-Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>\r
+Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>\r
 \r
 This program is free software; you can redistribute it and/or modify\r
 it under the terms of the GNU General Public License as published by\r
@@ -27,10 +27,8 @@ 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
-Random suggeestions (AKA very old suggestions that haven't been done):\r
-----------------------------------------------------------------------\r
-\r
-SUGG: Fix address to be ipv6 compatible\r
+Old, wild and random suggestions that probably won't be done:\r
+-------------------------------------------------------------\r
 \r
 SUGG: If player is on ground, mainly fetch ground-level blocks\r
 \r
@@ -81,18 +79,26 @@ SUGG: Calculate lighting per vertex to get a lighting effect like in
 SUGG: Background music based on cellular automata?\r
       http://www.earslap.com/projectslab/otomata\r
 \r
+SUGG: Simple light color information to air\r
+\r
+SUGG: Server-side objects could be moved based on nodes to enable very\r
+      lightweight operation and simple AI\r
+       - Not practical; client would still need to show smooth movement.\r
+\r
+SUGG: Make a system for pregenerating quick information for mapblocks, so\r
+         that the client can show them as cubes before they are actually sent\r
+         or even generated.\r
 \r
 Gaming ideas:\r
 -------------\r
 \r
 - Aim for something like controlling a single dwarf in Dwarf Fortress\r
-\r
 - The player could go faster by a crafting a boat, or riding an animal\r
-\r
 - Random NPC traders. what else?\r
 \r
 Game content:\r
 -------------\r
+\r
 - When furnace is destroyed, move items to player's inventory\r
 - Add lots of stuff\r
 - Glass blocks\r
@@ -124,6 +130,10 @@ Game content:
 - A bomb\r
 - A spread-items-on-map routine for the bomb, and for dying players\r
 \r
+- Fighting:\r
+  - Proper sword swing simulation\r
+  - Player should get damage from colliding to a wall at high speed\r
+\r
 Documentation:\r
 --------------\r
 \r
@@ -133,12 +143,10 @@ Build system / running:
 Networking and serialization:\r
 -----------------------------\r
 \r
-TODO: Get rid of GotSplitPacketException\r
-\r
-GUI:\r
-----\r
+SUGG: Fix address to be ipv6 compatible\r
 \r
-TODO: Configuration menu, at least for keys\r
+User Interface:\r
+---------------\r
 \r
 Graphics:\r
 ---------\r
@@ -164,8 +172,7 @@ TODO: A setting for enabling bilinear filtering for textures
 \r
 TODO: Better control of draw_control.wanted_max_blocks\r
 \r
-TODO: Get player texture (and some others) from the specified texture\r
-      directory\r
+TODO: Block mesh generator to tile properly on smooth lighting\r
 \r
 Configuration:\r
 --------------\r
@@ -189,6 +196,8 @@ TODO: Don't update all meshes always on single node changes, but
 \r
 - Tool/weapon visualization\r
 \r
+FIXME: When disconnected to the menu, memory is not freed properly\r
+\r
 Server:\r
 -------\r
 \r
@@ -203,15 +212,53 @@ FIXME: Server sometimes goes into some infinite PeerNotFoundException loop
 * 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
+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
+\r
 Objects:\r
 --------\r
 \r
-TODO: Get rid of MapBlockObjects and use ActiveObjects\r
+TODO: Get rid of MapBlockObjects and use only ActiveObjects\r
+       - Skipping the MapBlockObject data is nasty - there is no "total\r
+         length" stored; have to make a SkipMBOs function which contains\r
+         enough of the current code to skip them properly.\r
 \r
 SUGG: MovingObject::move and Player::move are basically the same.\r
       combine them.\r
-         - NOTE: Player::move is more up-to-date.\r
-         - NOTE: There is a simple move implementation now in collision.{h,cpp}\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
 \r
 Map:\r
 ----\r
@@ -249,18 +296,22 @@ Mapgen v2:
 \r
 Misc. stuff:\r
 ------------\r
-* Make an "environment metafile" to store at least time of day\r
-* Move digging property stuff from material.{h,cpp} to mapnode.cpp...\r
-  - Or maybe move content_features to material.{h,cpp}?\r
-* Maybe:\r
-  Make a system for pregenerating quick information for mapblocks, so\r
-  that the client can show them as cubes before they are actually sent\r
-  or even generated.\r
+* Move digging property stuff from material.{h,cpp} to mapnode.cpp\r
+  - ...Or maybe move content_features to material.{h,cpp}?\r
 \r
 Making it more portable:\r
 ------------------------\r
-* Some MSVC: std::sto* are defined without a namespace and collide\r
-  with the ones in utility.h\r
\r
+Stuff to do before release:\r
+---------------------------\r
+- Player default privileges and default password\r
+- Chat privilege\r
+- Some simple block-based dynamic stuff in the world (finish the\r
+  ActiveBlockModifier stuff)\r
+- Protocol version field\r
+- Consider getting some textures from cisoun's texture pack\r
+- Add a long step function to objects that is called with the time\r
+  difference when block activates\r
 \r
 ======================================================================\r
 \r
@@ -312,6 +363,7 @@ Making it more portable:
 //#include "tile.h"\r
 #include "materials.h"\r
 #include "game.h"\r
+#include "keycode.h"\r
 \r
 // This makes textures\r
 ITextureSource *g_texturesource = NULL;\r
@@ -707,7 +759,8 @@ class RandomInputHandler : public InputHandler
                        if(counter1 < 0.0)\r
                        {\r
                                counter1 = 0.1*Rand(1, 40);\r
-                               keydown[irr::KEY_SPACE] = !keydown[irr::KEY_SPACE];\r
+                               keydown[getKeySetting("keymap_jump")] =\r
+                                               !keydown[getKeySetting("keymap_jump")];\r
                        }\r
                }\r
                {\r
@@ -716,7 +769,8 @@ class RandomInputHandler : public InputHandler
                        if(counter1 < 0.0)\r
                        {\r
                                counter1 = 0.1*Rand(1, 40);\r
-                               keydown[irr::KEY_KEY_E] = !keydown[irr::KEY_KEY_E];\r
+                               keydown[getKeySetting("keymap_special1")] =\r
+                                               !keydown[getKeySetting("keymap_special1")];\r
                        }\r
                }\r
                {\r
@@ -725,7 +779,8 @@ class RandomInputHandler : public InputHandler
                        if(counter1 < 0.0)\r
                        {\r
                                counter1 = 0.1*Rand(1, 40);\r
-                               keydown[irr::KEY_KEY_W] = !keydown[irr::KEY_KEY_W];\r
+                               keydown[getKeySetting("keymap_forward")] =\r
+                                               !keydown[getKeySetting("keymap_forward")];\r
                        }\r
                }\r
                {\r
@@ -734,7 +789,8 @@ class RandomInputHandler : public InputHandler
                        if(counter1 < 0.0)\r
                        {\r
                                counter1 = 0.1*Rand(1, 40);\r
-                               keydown[irr::KEY_KEY_A] = !keydown[irr::KEY_KEY_A];\r
+                               keydown[getKeySetting("keymap_left")] =\r
+                                               !keydown[getKeySetting("keymap_left")];\r
                        }\r
                }\r
                {\r
@@ -894,7 +950,7 @@ void drawMenuBackground(video::IVideoDriver* driver)
        core::dimension2d<u32> screensize = driver->getScreenSize();\r
                \r
        video::ITexture *bgtexture =\r
-                       driver->getTexture(porting::getDataPath("mud.png").c_str());\r
+                       driver->getTexture(getTexturePath("mud.png").c_str());\r
        if(bgtexture)\r
        {\r
                s32 texturesize = 128;\r
@@ -914,7 +970,7 @@ void drawMenuBackground(video::IVideoDriver* driver)
        }\r
        \r
        video::ITexture *logotexture =\r
-                       driver->getTexture(porting::getDataPath("menulogo.png").c_str());\r
+                       driver->getTexture(getTexturePath("menulogo.png").c_str());\r
        if(logotexture)\r
        {\r
                v2s32 logosize(logotexture->getOriginalSize().Width,\r
@@ -1153,6 +1209,7 @@ int main(int argc, char *argv[])
                return 0;\r
        }\r
 \r
+\r
        /*\r
                More parameters\r
        */\r
@@ -1268,7 +1325,7 @@ int main(int argc, char *argv[])
 \r
        guienv = device->getGUIEnvironment();\r
        gui::IGUISkin* skin = guienv->getSkin();\r
-       gui::IGUIFont* font = guienv->getFont(porting::getDataPath("fontlucida.png").c_str());\r
+       gui::IGUIFont* font = guienv->getFont(getTexturePath("fontlucida.png").c_str());\r
        if(font)\r
                skin->setFont(font);\r
        else\r
@@ -1307,11 +1364,15 @@ int main(int argc, char *argv[])
        */\r
        std::wstring error_message = L"";\r
 \r
+       // The password entered during the menu screen,\r
+       std::string password;\r
+\r
        /*\r
                Menu-game loop\r
        */\r
        while(device->run() && kill == false)\r
        {\r
+\r
                // This is used for catching disconnects\r
                try\r
                {\r
@@ -1352,6 +1413,8 @@ int main(int argc, char *argv[])
                                menudata.address = narrow_to_wide(address);\r
                                menudata.name = narrow_to_wide(playername);\r
                                menudata.port = narrow_to_wide(itos(port));\r
+                               menudata.fancy_trees = g_settings.getBool("new_style_leaves");\r
+                               menudata.smooth_lighting = g_settings.getBool("smooth_lighting");\r
                                menudata.creative_mode = g_settings.getBool("creative_mode");\r
                                menudata.enable_damage = g_settings.getBool("enable_damage");\r
 \r
@@ -1389,6 +1452,10 @@ int main(int argc, char *argv[])
                                        guienv->drawAll();\r
                                        \r
                                        driver->endScene();\r
+                                       \r
+                                       // On some computers framerate doesn't seem to be\r
+                                       // automatically limited\r
+                                       sleep_ms(25);\r
                                }\r
                                \r
                                // Break out of menu-game loop to shut down cleanly\r
@@ -1409,10 +1476,15 @@ int main(int argc, char *argv[])
                                }\r
 \r
                                playername = wide_to_narrow(menudata.name);\r
+\r
+                               password = translatePassword(playername, menudata.password);\r
+\r
                                address = wide_to_narrow(menudata.address);\r
                                int newport = stoi(wide_to_narrow(menudata.port));\r
                                if(newport != 0)\r
                                        port = newport;\r
+                               g_settings.set("new_style_leaves", itos(menudata.fancy_trees));\r
+                               g_settings.set("smooth_lighting", itos(menudata.smooth_lighting));\r
                                g_settings.set("creative_mode", itos(menudata.creative_mode));\r
                                g_settings.set("enable_damage", itos(menudata.enable_damage));\r
                                \r
@@ -1439,6 +1511,9 @@ int main(int argc, char *argv[])
                        if(device->run() == false)\r
                                break;\r
                        \r
+                       // Initialize mapnode again to enable changed graphics settings\r
+                       init_mapnode();\r
+\r
                        /*\r
                                Run game\r
                        */\r
@@ -1450,6 +1525,7 @@ int main(int argc, char *argv[])
                                font,\r
                                map_dir,\r
                                playername,\r
+                               password,\r
                                address,\r
                                port,\r
                                error_message\r