tinkering around
authorPerttu Ahola <celeron55@gmail.com>
Tue, 14 Dec 2010 11:14:43 +0000 (13:14 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Tue, 14 Dec 2010 11:14:43 +0000 (13:14 +0200)
12 files changed:
makepackage_binary.sh
minetest.vcproj
src/client.cpp
src/client.h
src/clientserver.h
src/constants.h
src/main.cpp
src/map.cpp
src/map.h
src/mapblock.cpp
src/server.cpp
src/tile.cpp

index 1eef35616e472221e231a572c0d4181fc587729d..ad3ff33d7003b650a20d778c7a7e157e232a307b 100755 (executable)
@@ -40,6 +40,10 @@ cp -r data/torch_on_ceiling.png $PACKAGEPATH/data/
 cp -r data/skybox1.png $PACKAGEPATH/data/
 cp -r data/skybox2.png $PACKAGEPATH/data/
 cp -r data/skybox3.png $PACKAGEPATH/data/
+cp -r data/tree_top.png $PACKAGEPATH/data/
+cp -r data/mud_with_grass.png $PACKAGEPATH/data/
+
+cp -r data/pauseMenu.gui $PACKAGEPATH/data/
 
 cp -r doc/README.txt $PACKAGEPATH/doc/README.txt
 
index 774987a7aa1d0072a3a78e5b929b052dbadfa5c1..632feffffc54ac1a43b85118254e4189bb039f68 100644 (file)
                                RelativePath=".\src\filesys.cpp"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath=".\src\guiPauseMenu.cpp"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath=".\src\heightmap.cpp"\r
                                >\r
index bfec8b730891326449096e1d1e2c89ef405e852c..ed3a437597f95f547a6876690a3e53eb089fdab4 100644 (file)
@@ -1401,11 +1401,11 @@ void Client::addNodeFromInventory(v3s16 nodepos, u16 i)
 }
 #endif
 
-void Client::clickGround(u8 button, v3s16 nodepos_undersurface,
+void Client::pressGround(u8 button, v3s16 nodepos_undersurface,
                v3s16 nodepos_oversurface, u16 item)
 {
        if(connectedAndInitialized() == false){
-               dout_client<<DTIME<<"Client::clickGround() "
+               dout_client<<DTIME<<"Client::pressGround() "
                                "cancelled (not connected)"
                                <<std::endl;
                return;
@@ -1421,7 +1421,7 @@ void Client::clickGround(u8 button, v3s16 nodepos_undersurface,
        */
        u8 datasize = 2 + 1 + 6 + 6 + 2;
        SharedBuffer<u8> data(datasize);
-       writeU16(&data[0], TOSERVER_CLICK_GROUND);
+       writeU16(&data[0], TOSERVER_PRESS_GROUND);
        writeU8(&data[2], button);
        writeV3S16(&data[3], nodepos_undersurface);
        writeV3S16(&data[9], nodepos_oversurface);
index 3789f4cbe7e37b4ada7d94b1cd7ddb4fb452f9c1..95bff0ff5ae2b7c86a934005e4728efaf991238a 100644 (file)
@@ -193,7 +193,7 @@ public:
 
        /*void removeNode(v3s16 nodepos);
        void addNodeFromInventory(v3s16 nodepos, u16 i);*/
-       void clickGround(u8 button, v3s16 nodepos_undersurface,
+       void pressGround(u8 button, v3s16 nodepos_undersurface,
                        v3s16 nodepos_oversurface, u16 item);
        void clickObject(u8 button, v3s16 blockpos, s16 id, u16 item);
        void release(u8 button);
index ce595b6d4934924b7baf13e62b8eb380cde66ad2..9d3545907b2b53b248019321a0879dc87daa852b 100644 (file)
@@ -159,7 +159,7 @@ enum ToServerCommand
                [11] u16 item
        */
 
-       TOSERVER_CLICK_GROUND = 0x28,
+       TOSERVER_PRESS_GROUND = 0x28,
        /*
                length: 17
                [0] u16 command
index bbd9fa8236a5b320a68238c5fdde70be143f276f..83a070217f1e547e0ffe5c8f62e2572ca1968384 100644 (file)
@@ -45,6 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #define SERVER_MAP_SAVE_INTERVAL (10)*/
 
 #define FOV_ANGLE (PI/2.5)
+//#define FOV_ANGLE (PI/2.25)
 
 // The absolute working limit is (2^15 - viewing_range).
 #define MAP_GENERATION_LIMIT (31000)
index 31901ae7001758295b953c5de01649362071e282..7814da999c27420ce3391bec6144c55cc2db475b 100644 (file)
@@ -280,6 +280,7 @@ JMutex g_range_mutex;
 \r
 // Blocks are viewed in this range from the player\r
 s16 g_viewing_range_nodes = 60;\r
+//s16 g_viewing_range_nodes = 0;\r
 \r
 // This is updated by the client's fetchBlocks routine\r
 //s16 g_actual_viewing_range_nodes = VIEWING_RANGE_NODES_DEFAULT;\r
@@ -311,7 +312,7 @@ void set_default_settings()
        g_settings.set("wanted_fps", "30");\r
        g_settings.set("fps_max", "60");\r
        g_settings.set("viewing_range_nodes_max", "300");\r
-       g_settings.set("viewing_range_nodes_min", "50");\r
+       g_settings.set("viewing_range_nodes_min", "35");\r
        g_settings.set("screenW", "");\r
        g_settings.set("screenH", "");\r
        g_settings.set("host_game", "");\r
@@ -796,7 +797,8 @@ void updateViewingRange(f32 frametime, Client *client)
        static bool fraction_is_good = false;\r
        \r
        float fraction_good_threshold = 0.1;\r
-       float fraction_bad_threshold = 0.25;\r
+       //float fraction_bad_threshold = 0.25;\r
+       float fraction_bad_threshold = 0.1;\r
        float fraction_limit;\r
        // Use high limit if fraction is good AND the fraction would\r
        // lower the range. We want to keep the range fairly high.\r
@@ -1294,48 +1296,6 @@ int main(int argc, char *argv[])
        guienv->drawAll();\r
        driver->endScene();\r
 \r
-       /*\r
-               Initialize material array\r
-       */\r
-\r
-       /*//video::SMaterial g_materials[MATERIALS_COUNT];\r
-       for(u16 i=0; i<MATERIALS_COUNT; i++)\r
-       {\r
-               g_materials[i].Lighting = false;\r
-               g_materials[i].BackfaceCulling = false;\r
-\r
-               const char *filename = g_content_filenames[i];\r
-               if(filename != NULL){\r
-                       video::ITexture *t = driver->getTexture(filename);\r
-                       if(t == NULL){\r
-                               std::cout<<DTIME<<"Texture could not be loaded: \""\r
-                                               <<filename<<"\""<<std::endl;\r
-                               return 1;\r
-                       }\r
-                       g_materials[i].setTexture(0, driver->getTexture(filename));\r
-               }\r
-               //g_materials[i].setFlag(video::EMF_TEXTURE_WRAP, video::ETC_REPEAT);\r
-               g_materials[i].setFlag(video::EMF_BILINEAR_FILTER, false);\r
-               //g_materials[i].setFlag(video::EMF_ANISOTROPIC_FILTER, false);\r
-               //g_materials[i].setFlag(video::EMF_FOG_ENABLE, true);\r
-       }\r
-\r
-       g_materials[CONTENT_WATER].MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;\r
-       //g_materials[CONTENT_WATER].MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;\r
-       g_materials[CONTENT_OCEAN].MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;\r
-       */\r
-\r
-       /*g_mesh_materials[0].setTexture(0, driver->getTexture("../data/water.png"));\r
-       g_mesh_materials[1].setTexture(0, driver->getTexture("../data/grass.png"));\r
-       g_mesh_materials[2].setTexture(0, driver->getTexture("../data/stone.png"));\r
-       for(u32 i=0; i<3; i++)\r
-       {\r
-               g_mesh_materials[i].Lighting = false;\r
-               g_mesh_materials[i].BackfaceCulling = false;\r
-               g_mesh_materials[i].setFlag(video::EMF_BILINEAR_FILTER, false);\r
-               g_mesh_materials[i].setFlag(video::EMF_FOG_ENABLE, true);\r
-       }*/\r
-\r
        /*\r
                Preload some random textures that are used in threads\r
        */\r
@@ -1463,9 +1423,15 @@ int main(int argc, char *argv[])
        \r
        f32 camera_yaw = 0; // "right/left"\r
        f32 camera_pitch = 0; // "up/down"\r
+\r
+       /*\r
+               Move into game\r
+       */\r
        \r
        gui_loadingtext->remove();\r
 \r
+       pauseMenu.setVisible(true);\r
+\r
        /*\r
                Add some gui stuff\r
        */\r
@@ -1473,12 +1439,12 @@ int main(int argc, char *argv[])
        // First line of debug text\r
        gui::IGUIStaticText *guitext = guienv->addStaticText(\r
                        L"Minetest-c55",\r
-                       core::rect<s32>(5, 5, 5+600, 5+textsize.Y),\r
+                       core::rect<s32>(5, 5, 795, 5+textsize.Y),\r
                        false, false);\r
        // Second line of debug text\r
        gui::IGUIStaticText *guitext2 = guienv->addStaticText(\r
                        L"",\r
-                       core::rect<s32>(5, 5+(textsize.Y+5)*1, 5+600, (5+textsize.Y)*2),\r
+                       core::rect<s32>(5, 5+(textsize.Y+5)*1, 795, (5+textsize.Y)*2),\r
                        false, false);\r
        \r
        // At the middle of the screen\r
@@ -1498,6 +1464,7 @@ int main(int argc, char *argv[])
                Some statistics are collected in these\r
        */\r
        u32 drawtime = 0;\r
+       u32 beginscenetime = 0;\r
        u32 scenetime = 0;\r
        u32 endscenetime = 0;\r
 \r
@@ -2063,14 +2030,14 @@ int main(int argc, char *argv[])
                                //std::cout<<DTIME<<"Removing node"<<std::endl;\r
                                //client.removeNode(nodepos);\r
                                std::cout<<DTIME<<"Ground left-clicked"<<std::endl;\r
-                               client.clickGround(0, nodepos, neighbourpos, g_selected_item);\r
+                               client.pressGround(0, nodepos, neighbourpos, g_selected_item);\r
                        }\r
                        if(g_input->getRightClicked())\r
                        {\r
                                //std::cout<<DTIME<<"Placing node"<<std::endl;\r
                                //client.addNodeFromInventory(neighbourpos, g_selected_item);\r
                                std::cout<<DTIME<<"Ground right-clicked"<<std::endl;\r
-                               client.clickGround(1, nodepos, neighbourpos, g_selected_item);\r
+                               client.pressGround(1, nodepos, neighbourpos, g_selected_item);\r
                        }\r
                }\r
                else{\r
@@ -2089,6 +2056,21 @@ int main(int argc, char *argv[])
 \r
                camera->setAspectRatio((f32)screensize.X / (f32)screensize.Y);\r
 \r
+               /*f32 range = g_viewing_range_nodes * BS;\r
+               if(g_viewing_range_all)\r
+                       range = 100000*BS;\r
+\r
+               driver->setFog(\r
+                       skycolor,\r
+                       video::EFT_FOG_LINEAR,\r
+                       range*0.6,\r
+                       range,\r
+                       0.01,\r
+                       false, // pixel fog\r
+                       false // range fog\r
+                       );*/\r
+\r
+\r
                /*\r
                        Update gui stuff (0ms)\r
                */\r
@@ -2096,23 +2078,26 @@ int main(int argc, char *argv[])
                //TimeTaker guiupdatetimer("Gui updating", device);\r
                \r
                {\r
-                       wchar_t temptext[100];\r
+                       wchar_t temptext[150];\r
 \r
                        static float drawtime_avg = 0;\r
                        drawtime_avg = drawtime_avg * 0.98 + (float)drawtime*0.02;\r
+                       static float beginscenetime_avg = 0;\r
+                       beginscenetime_avg = beginscenetime_avg * 0.98 + (float)beginscenetime*0.02;\r
                        static float scenetime_avg = 0;\r
                        scenetime_avg = scenetime_avg * 0.98 + (float)scenetime*0.02;\r
                        static float endscenetime_avg = 0;\r
                        endscenetime_avg = endscenetime_avg * 0.98 + (float)endscenetime*0.02;\r
                        \r
-                       swprintf(temptext, 100, L"Minetest-c55 ("\r
+                       swprintf(temptext, 150, L"Minetest-c55 ("\r
                                        L"F: item=%i"\r
                                        L", R: range_all=%i"\r
                                        L")"\r
-                                       L" drawtime=%.0f, scenetime=%.0f, endscenetime=%.0f",\r
+                                       L" drawtime=%.0f, beginscenetime=%.0f, scenetime=%.0f, endscenetime=%.0f",\r
                                        g_selected_item,\r
                                        g_viewing_range_all,\r
                                        drawtime_avg,\r
+                                       beginscenetime_avg,\r
                                        scenetime_avg,\r
                                        endscenetime_avg\r
                                        );\r
@@ -2121,19 +2106,8 @@ int main(int argc, char *argv[])
                }\r
                \r
                {\r
-                       wchar_t temptext[100];\r
-                       /*swprintf(temptext, 100,\r
-                                       L"("\r
-                                       L"% .3f < btime_jitter < % .3f"\r
-                                       L", dtime_jitter = % .1f %%"\r
-                                       //L", ftime_ratio = % .3f"\r
-                                       L")",\r
-                                       busytime_jitter1_min_sample,\r
-                                       busytime_jitter1_max_sample,\r
-                                       dtime_jitter1_max_fraction * 100.0\r
-                                       //g_freetime_ratio\r
-                                       );*/\r
-                       swprintf(temptext, 100,\r
+                       wchar_t temptext[150];\r
+                       swprintf(temptext, 150,\r
                                        L"(% .1f, % .1f, % .1f)"\r
                                        L" (% .3f < btime_jitter < % .3f"\r
                                        L", dtime_jitter = % .1f %%)",\r
@@ -2232,8 +2206,11 @@ int main(int argc, char *argv[])
                //video::SColor bgcolor = video::SColor(255,90,140,200);\r
                video::SColor bgcolor = skycolor;\r
                \r
-               // 0ms\r
+               {\r
+               TimeTaker timer("beginScene", device);\r
                driver->beginScene(true, true, bgcolor);\r
+               beginscenetime = timer.stop(true);\r
+               }\r
 \r
                //timer3.stop();\r
                \r
index b1e7da29ab55ed511d8e45b052119fdcba4da37d..caebb516182441b02244f7ce54a33fc5728d02e4 100644 (file)
@@ -2835,6 +2835,17 @@ void ClientMap::deSerializeSector(v2s16 p2d, std::istream &is)
        sector->deSerialize(is);
 }
 
+void ClientMap::OnRegisterSceneNode()
+{
+       if(IsVisible)
+       {
+               SceneManager->registerNodeForRendering(this, scene::ESNRP_SOLID);
+               SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT);
+       }
+
+       ISceneNode::OnRegisterSceneNode();
+}
+
 void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
 {
        //m_dout<<DTIME<<"Rendering map..."<<std::endl;
@@ -2971,6 +2982,8 @@ void ClientMap::renderMap(video::IVideoDriver* driver, s32 pass)
                        {
                                // If block is far away, don't draw it
                                if(d > viewing_range_nodes * BS)
+                               // This is nicer when fog is used
+                               //if((dforward+d)/2 > viewing_range_nodes * BS)
                                        continue;
                        }
                        
index d36e2ddadadb669c79af1e1dfb9e0ee751170812..9ab77b25f5300435a1f9ac6c3044387cc4c61e70 100644 (file)
--- a/src/map.h
+++ b/src/map.h
@@ -545,17 +545,7 @@ public:
                ISceneNode methods
        */
 
-       virtual void OnRegisterSceneNode()
-       {
-               if(IsVisible)
-               {
-                       //SceneManager->registerNodeForRendering(this, scene::ESNRP_SKY_BOX);
-                       SceneManager->registerNodeForRendering(this, scene::ESNRP_SOLID);
-                       SceneManager->registerNodeForRendering(this, scene::ESNRP_TRANSPARENT);
-               }
-
-               ISceneNode::OnRegisterSceneNode();
-       }
+       virtual void OnRegisterSceneNode();
 
        virtual void render()
        {
index e2e36c8e37cd38afa79255ebff85e62e16b91d5a..86bd9c98c5a5e6ecb3d795380e85f3323cb271f8 100644 (file)
@@ -118,9 +118,6 @@ FastFace * MapBlock::makeFastFace(u16 tile, u8 light, v3f p,
 
        u8 alpha = 255;
 
-       //if(material == CONTENT_WATER || material == CONTENT_OCEAN)
-       //TODO: Umm?
-       //if(tile == CONTENT_WATER || tile == CONTENT_OCEAN)
        if(tile == TILE_WATER)
        {
                alpha = 128;
@@ -139,7 +136,7 @@ FastFace * MapBlock::makeFastFace(u16 tile, u8 light, v3f p,
 
        f->tile = tile;
        //DEBUG
-       //f->tile = TILE_GRASS;
+       //f->tile = TILE_STONE;
 
        return f;
 }
index 487ce2a98656ab518737bbdf22ecc2a0c72266eb..88a8492c1080f882cdf018edd0ee1185bcfe74b7 100644 (file)
@@ -1466,7 +1466,7 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
                        block->removeObject(id);
                }
        }
-       else if(command == TOSERVER_CLICK_GROUND)
+       else if(command == TOSERVER_PRESS_GROUND)
        {
                if(datasize < 17)
                        return;
index 580d2a8a399b2c4b798397f8bffe0e9ec9e05a08..32db69672427a4734f078b9d976948487076fb51 100644 (file)
@@ -53,9 +53,17 @@ void tile_materials_preload(TextureCache &cache)
                g_tile_materials[i].Lighting = false;
                g_tile_materials[i].BackfaceCulling = false;
                g_tile_materials[i].setFlag(video::EMF_BILINEAR_FILTER, false);
+               g_tile_materials[i].setFlag(video::EMF_ANTI_ALIASING, video::EAAM_OFF);
+               //if(i != TILE_WATER)
+               //g_tile_materials[i].setFlag(video::EMF_FOG_ENABLE, true);
+               
+               //g_tile_materials[i].setFlag(video::EMF_TEXTURE_WRAP, video::ETC_REPEAT);
+               //g_tile_materials[i].setFlag(video::EMF_ANISOTROPIC_FILTER, false);
+
                g_tile_materials[i].setTexture(0, t);
        }
        
        g_tile_materials[TILE_WATER].MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
+       //g_tile_materials[TILE_WATER].MaterialType = video::EMT_TRANSPARENT_ADD_COLOR;
 }