]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/game.cpp
Tune smooth lighting a bit
[dragonfireclient.git] / src / game.cpp
index d6c9910be0432c7688696fbd933b62adc0bae447..7d049edf089428dab43efc1d6170d5d336f612d3 100644 (file)
@@ -887,15 +887,16 @@ class GameOnDemandSoundFetcher: public OnDemandSoundFetcher
                m_fetched.insert(name);
                std::string base = porting::path_share + DIR_DELIM + "testsounds";
                dst_paths.insert(base + DIR_DELIM + name + ".ogg");
-               dst_paths.insert(base + DIR_DELIM + name + "1.ogg");
-               dst_paths.insert(base + DIR_DELIM + name + "2.ogg");
-               dst_paths.insert(base + DIR_DELIM + name + "3.ogg");
-               dst_paths.insert(base + DIR_DELIM + name + "4.ogg");
-               dst_paths.insert(base + DIR_DELIM + name + "5.ogg");
-               dst_paths.insert(base + DIR_DELIM + name + "6.ogg");
-               dst_paths.insert(base + DIR_DELIM + name + "7.ogg");
-               dst_paths.insert(base + DIR_DELIM + name + "8.ogg");
-               dst_paths.insert(base + DIR_DELIM + name + "9.ogg");
+               dst_paths.insert(base + DIR_DELIM + name + ".0.ogg");
+               dst_paths.insert(base + DIR_DELIM + name + ".1.ogg");
+               dst_paths.insert(base + DIR_DELIM + name + ".2.ogg");
+               dst_paths.insert(base + DIR_DELIM + name + ".3.ogg");
+               dst_paths.insert(base + DIR_DELIM + name + ".4.ogg");
+               dst_paths.insert(base + DIR_DELIM + name + ".5.ogg");
+               dst_paths.insert(base + DIR_DELIM + name + ".6.ogg");
+               dst_paths.insert(base + DIR_DELIM + name + ".7.ogg");
+               dst_paths.insert(base + DIR_DELIM + name + ".8.ogg");
+               dst_paths.insert(base + DIR_DELIM + name + ".9.ogg");
        }
 };
 
@@ -954,10 +955,14 @@ void the_game(
        ISoundManager *sound = NULL;
        bool sound_is_dummy = false;
 #if USE_SOUND
-       infostream<<"Attempting to use OpenAL audio"<<std::endl;
-       sound = createOpenALSoundManager(&soundfetcher);
-       if(!sound)
-               infostream<<"Failed to initialize OpenAL audio"<<std::endl;
+       if(g_settings->getBool("enable_sound")){
+               infostream<<"Attempting to use OpenAL audio"<<std::endl;
+               sound = createOpenALSoundManager(&soundfetcher);
+               if(!sound)
+                       infostream<<"Failed to initialize OpenAL audio"<<std::endl;
+       } else {
+               infostream<<"Sound disabled."<<std::endl;
+       }
 #endif
        if(!sound){
                infostream<<"Using dummy audio."<<std::endl;
@@ -991,6 +996,7 @@ void the_game(
                server->start(port);
        }
 
+       try{
        do{ // Client scope (breakable do-while(0))
        
        /*
@@ -1634,6 +1640,8 @@ void the_game(
                                g_settings->set("free_move","true");
                                statustext = L"free_move enabled";
                                statustext_time = 0;
+                               if(!client.checkPrivilege("fly"))
+                                       statustext += L" (note: no 'fly' privilege)";
                        }
                }
                else if(input->wasKeyDown(getKeySetting("keymap_fastmove")))
@@ -1649,6 +1657,8 @@ void the_game(
                                g_settings->set("fast_move","true");
                                statustext = L"fast_move enabled";
                                statustext_time = 0;
+                               if(!client.checkPrivilege("fast"))
+                                       statustext += L" (note: no 'fast' privilege)";
                        }
                }
                else if(input->wasKeyDown(getKeySetting("keymap_screenshot")))
@@ -2074,8 +2084,9 @@ void the_game(
                // Update sound listener
                sound->updateListener(camera.getCameraNode()->getPosition(),
                                v3f(0,0,0), // velocity
-                               camera.getCameraNode()->getTarget(),
+                               camera.getDirection(),
                                camera.getCameraNode()->getUpVector());
+               sound->setListenerGain(g_settings->getFloat("sound_volume"));
 
                /*
                        Update sound maker
@@ -2594,11 +2605,12 @@ void the_game(
                        char temptext[300];
                        snprintf(temptext, 300,
                                        "(% .1f, % .1f, % .1f)"
-                                       " (yaw = %.1f)",
+                                       " (yaw = %.1f) (seed = %lli)",
                                        player_position.X/BS,
                                        player_position.Y/BS,
                                        player_position.Z/BS,
-                                       wrapDegrees_0_360(camera_yaw));
+                                       wrapDegrees_0_360(camera_yaw),
+                                       client.getMapSeed());
 
                        guitext2->setText(narrow_to_wide(temptext).c_str());
                        guitext2->setVisible(true);
@@ -2911,6 +2923,14 @@ void the_game(
 
        // Client scope (client is destructed before destructing *def and tsrc)
        }while(0);
+       } // try-catch
+       catch(SerializationError &e)
+       {
+               error_message = L"A serialization error occurred:\n"
+                               + narrow_to_wide(e.what()) + L"\n\nThe server is probably "
+                               L" running a different version of Minetest.";
+               errorstream<<wide_to_narrow(error_message)<<std::endl;
+       }
        
        if(!sound_is_dummy)
                delete sound;