aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/defaultsettings.cpp1
-rw-r--r--src/game.cpp35
-rw-r--r--src/guiPauseMenu.h4
-rw-r--r--src/guiVolumeChange.h2
-rw-r--r--src/mainmenumanager.h11
-rw-r--r--src/modalMenu.h1
6 files changed, 38 insertions, 16 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 5a1dabebf..a7187faea 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -77,6 +77,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("wanted_fps", "30");
settings->setDefault("fps_max", "60");
+ settings->setDefault("pause_fps_max", "20");
// A bit more than the server will send around the player, to make fog blend well
settings->setDefault("viewing_range_nodes_max", "240");
settings->setDefault("viewing_range_nodes_min", "35");
diff --git a/src/game.cpp b/src/game.cpp
index c768440d3..b751a2b62 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1513,7 +1513,9 @@ void the_game(
*/
{
- float fps_max = g_settings->getFloat("fps_max");
+ float fps_max = g_menumgr.pausesGame() ?
+ g_settings->getFloat("pause_fps_max") :
+ g_settings->getFloat("fps_max");
u32 frametime_min = 1000./fps_max;
if(busytime_u32 < frametime_min)
@@ -2192,25 +2194,28 @@ void the_game(
LocalPlayer* player = client.getEnv().getLocalPlayer();
player->keyPressed=keyPressed;
}
-
+
/*
- Run server
+ Run server, client (and process environments)
*/
-
- if(server != NULL)
+ bool can_be_and_is_paused =
+ (simple_singleplayer_mode && g_menumgr.pausesGame());
+ if(can_be_and_is_paused)
{
- //TimeTaker timer("server->step(dtime)");
- server->step(dtime);
+ // No time passes
+ dtime = 0;
}
-
- /*
- Process environment
- */
-
+ else
{
- //TimeTaker timer("client.step(dtime)");
- client.step(dtime);
- //client.step(dtime_avg1);
+ if(server != NULL)
+ {
+ //TimeTaker timer("server->step(dtime)");
+ server->step(dtime);
+ }
+ {
+ //TimeTaker timer("client.step(dtime)");
+ client.step(dtime);
+ }
}
{
diff --git a/src/guiPauseMenu.h b/src/guiPauseMenu.h
index 25011a34a..2808c93b1 100644
--- a/src/guiPauseMenu.h
+++ b/src/guiPauseMenu.h
@@ -51,7 +51,9 @@ public:
void drawMenu();
bool OnEvent(const SEvent& event);
-
+
+ bool pausesGame(){ return true; }
+
private:
IGameCallback *m_gamecallback;
bool m_simple_singleplayer_mode;
diff --git a/src/guiVolumeChange.h b/src/guiVolumeChange.h
index 1dcc7fbde..5258ee107 100644
--- a/src/guiVolumeChange.h
+++ b/src/guiVolumeChange.h
@@ -44,6 +44,8 @@ public:
bool OnEvent(const SEvent& event);
+ bool pausesGame(){ return true; }
+
private:
Client* m_client;
diff --git a/src/mainmenumanager.h b/src/mainmenumanager.h
index d151cf48d..ecfb89fd3 100644
--- a/src/mainmenumanager.h
+++ b/src/mainmenumanager.h
@@ -91,6 +91,17 @@ public:
return m_stack.size();
}
+ bool pausesGame()
+ {
+ for(std::list<GUIModalMenu*>::iterator
+ i = m_stack.begin(); i != m_stack.end(); ++i)
+ {
+ if((*i)->pausesGame())
+ return true;
+ }
+ return false;
+ }
+
std::list<GUIModalMenu*> m_stack;
};
diff --git a/src/modalMenu.h b/src/modalMenu.h
index c8b45a247..251b7aa3b 100644
--- a/src/modalMenu.h
+++ b/src/modalMenu.h
@@ -124,6 +124,7 @@ public:
virtual void drawMenu() = 0;
virtual bool preprocessEvent(const SEvent& event) { return false; };
virtual bool OnEvent(const SEvent& event) { return false; };
+ virtual bool pausesGame(){ return false; } // Used for pause menu
protected:
//bool m_force_regenerate_gui;