@@ -1065,9 +1065,6 @@ struct GameRunData {
1065
1065
1066
1066
v3f update_draw_list_last_cam_dir;
1067
1067
1068
- u32 profiler_current_page;
1069
- u32 profiler_max_page; // Number of pages
1070
-
1071
1068
float time_of_day_smooth;
1072
1069
};
1073
1070
@@ -1158,13 +1155,10 @@ class Game {
1158
1155
void toggleCinematic ();
1159
1156
void toggleAutoforward ();
1160
1157
1161
- void toggleChat ();
1162
- void toggleHud ();
1163
1158
void toggleMinimap (bool shift_pressed);
1164
1159
void toggleFog ();
1165
1160
void toggleDebug ();
1166
1161
void toggleUpdateCamera ();
1167
- void toggleProfiler ();
1168
1162
1169
1163
void increaseViewRange ();
1170
1164
void decreaseViewRange ();
@@ -1256,6 +1250,11 @@ class Game {
1256
1250
#endif
1257
1251
1258
1252
private:
1253
+ struct Flags {
1254
+ bool force_fog_off = false ;
1255
+ bool disable_camera_update = false ;
1256
+ };
1257
+
1259
1258
void showPauseMenu ();
1260
1259
1261
1260
// ClientEvent handlers
@@ -1315,6 +1314,7 @@ class Game {
1315
1314
Minimap *mapper = nullptr ;
1316
1315
1317
1316
GameRunData runData;
1317
+ Flags m_flags;
1318
1318
1319
1319
/* 'cache'
1320
1320
This class does take ownership/responsibily for cleaning up etc of any of
@@ -1496,7 +1496,6 @@ bool Game::startup(bool *kill,
1496
1496
1497
1497
memset (&runData, 0 , sizeof (runData));
1498
1498
runData.time_from_last_punch = 10.0 ;
1499
- runData.profiler_max_page = 3 ;
1500
1499
runData.update_wielded_item_trigger = true ;
1501
1500
1502
1501
m_game_ui->initFlags ();
@@ -1790,7 +1789,7 @@ bool Game::createClient(const std::string &playername,
1790
1789
}
1791
1790
1792
1791
GameGlobalShaderConstantSetterFactory *scsf = new GameGlobalShaderConstantSetterFactory (
1793
- &m_game_ui-> m_flags .force_fog_off , &runData.fog_range , client);
1792
+ &m_flags.force_fog_off , &runData.fog_range , client);
1794
1793
shader_src->addShaderConstantSetterFactory (scsf);
1795
1794
1796
1795
// Update cached textures, meshes and materials
@@ -2201,9 +2200,7 @@ void Game::updateProfilers(const RunStats &stats, const FpsControl &draw_times,
2201
2200
g_profiler->print (infostream);
2202
2201
}
2203
2202
2204
- m_game_ui->updateProfiler (runData.profiler_current_page ,
2205
- runData.profiler_max_page );
2206
-
2203
+ m_game_ui->updateProfiler ();
2207
2204
g_profiler->clear ();
2208
2205
}
2209
2206
@@ -2377,19 +2374,19 @@ void Game::processKeyInput()
2377
2374
} else if (wasKeyDown (KeyType::SCREENSHOT)) {
2378
2375
client->makeScreenshot ();
2379
2376
} else if (wasKeyDown (KeyType::TOGGLE_HUD)) {
2380
- toggleHud ();
2377
+ m_game_ui-> toggleHud ();
2381
2378
} else if (wasKeyDown (KeyType::MINIMAP)) {
2382
2379
toggleMinimap (isKeyDown (KeyType::SNEAK));
2383
2380
} else if (wasKeyDown (KeyType::TOGGLE_CHAT)) {
2384
- toggleChat ();
2381
+ m_game_ui-> toggleChat ();
2385
2382
} else if (wasKeyDown (KeyType::TOGGLE_FORCE_FOG_OFF)) {
2386
2383
toggleFog ();
2387
2384
} else if (wasKeyDown (KeyType::TOGGLE_UPDATE_CAMERA)) {
2388
2385
toggleUpdateCamera ();
2389
2386
} else if (wasKeyDown (KeyType::TOGGLE_DEBUG)) {
2390
2387
toggleDebug ();
2391
2388
} else if (wasKeyDown (KeyType::TOGGLE_PROFILER)) {
2392
- toggleProfiler ();
2389
+ m_game_ui-> toggleProfiler ();
2393
2390
} else if (wasKeyDown (KeyType::INCREASE_VIEWING_RANGE)) {
2394
2391
increaseViewRange ();
2395
2392
} else if (wasKeyDown (KeyType::DECREASE_VIEWING_RANGE)) {
@@ -2615,25 +2612,6 @@ void Game::toggleAutoforward()
2615
2612
m_game_ui->showTranslatedStatusText (" Automatic forwards disabled" );
2616
2613
}
2617
2614
2618
- void Game::toggleChat ()
2619
- {
2620
- m_game_ui->m_flags .show_chat = !m_game_ui->m_flags .show_chat ;
2621
- if (m_game_ui->m_flags .show_chat )
2622
- m_game_ui->showTranslatedStatusText (" Chat shown" );
2623
- else
2624
- m_game_ui->showTranslatedStatusText (" Chat hidden" );
2625
- }
2626
-
2627
-
2628
- void Game::toggleHud ()
2629
- {
2630
- m_game_ui->m_flags .show_hud = !m_game_ui->m_flags .show_hud ;
2631
- if (m_game_ui->m_flags .show_hud )
2632
- m_game_ui->showTranslatedStatusText (" HUD shown" );
2633
- else
2634
- m_game_ui->showTranslatedStatusText (" HUD hidden" );
2635
- }
2636
-
2637
2615
void Game::toggleMinimap (bool shift_pressed)
2638
2616
{
2639
2617
if (!mapper || !m_game_ui->m_flags .show_hud || !g_settings->getBool (" enable_minimap" ))
@@ -2689,8 +2667,8 @@ void Game::toggleMinimap(bool shift_pressed)
2689
2667
2690
2668
void Game::toggleFog ()
2691
2669
{
2692
- m_game_ui-> m_flags .force_fog_off = !m_game_ui-> m_flags .force_fog_off ;
2693
- if (m_game_ui-> m_flags .force_fog_off )
2670
+ m_flags.force_fog_off = !m_flags.force_fog_off ;
2671
+ if (m_flags.force_fog_off )
2694
2672
m_game_ui->showTranslatedStatusText (" Fog disabled" );
2695
2673
else
2696
2674
m_game_ui->showTranslatedStatusText (" Fog enabled" );
@@ -2730,24 +2708,14 @@ void Game::toggleDebug()
2730
2708
2731
2709
void Game::toggleUpdateCamera ()
2732
2710
{
2733
- m_game_ui-> m_flags .disable_camera_update = !m_game_ui-> m_flags .disable_camera_update ;
2734
- if (m_game_ui-> m_flags .disable_camera_update )
2711
+ m_flags.disable_camera_update = !m_flags.disable_camera_update ;
2712
+ if (m_flags.disable_camera_update )
2735
2713
m_game_ui->showTranslatedStatusText (" Camera update disabled" );
2736
2714
else
2737
2715
m_game_ui->showTranslatedStatusText (" Camera update enabled" );
2738
2716
}
2739
2717
2740
2718
2741
- void Game::toggleProfiler ()
2742
- {
2743
- runData.profiler_current_page =
2744
- (runData.profiler_current_page + 1 ) % (runData.profiler_max_page + 1 );
2745
-
2746
- // FIXME: This updates the profiler with incomplete values
2747
- m_game_ui->updateProfiler (runData.profiler_current_page , runData.profiler_max_page );
2748
- }
2749
-
2750
-
2751
2719
void Game::increaseViewRange ()
2752
2720
{
2753
2721
s16 range = g_settings->getS16 (" viewing_range" );
@@ -2944,12 +2912,10 @@ inline void Game::step(f32 *dtime)
2944
2912
if (can_be_and_is_paused) { // This is for a singleplayer server
2945
2913
*dtime = 0 ; // No time passes
2946
2914
} else {
2947
- if (server != NULL ) {
2948
- // TimeTaker timer("server->step(dtime)");
2915
+ if (server) {
2949
2916
server->step (*dtime);
2950
2917
}
2951
2918
2952
- // TimeTaker timer("client.step(dtime)");
2953
2919
client->step (*dtime);
2954
2920
}
2955
2921
}
@@ -3276,7 +3242,7 @@ void Game::updateChat(f32 dtime, const v2u32 &screensize)
3276
3242
3277
3243
// Display all messages in a static text element
3278
3244
m_game_ui->setChatText (chat_backend->getRecentChat (),
3279
- chat_backend->getRecentBuffer ().getLineCount (), runData. profiler_current_page );
3245
+ chat_backend->getRecentBuffer ().getLineCount ());
3280
3246
}
3281
3247
3282
3248
void Game::updateCamera (u32 busy_time, f32 dtime)
@@ -3336,7 +3302,7 @@ void Game::updateCamera(u32 busy_time, f32 dtime)
3336
3302
3337
3303
m_camera_offset_changed = (camera_offset != old_camera_offset);
3338
3304
3339
- if (!m_game_ui-> m_flags .disable_camera_update ) {
3305
+ if (!m_flags.disable_camera_update ) {
3340
3306
client->getEnv ().getClientMap ().updateCamera (camera_position,
3341
3307
camera_direction, camera_fov, camera_offset);
3342
3308
@@ -4033,7 +3999,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
4033
3999
clouds->update (camera_node_position,
4034
4000
sky->getCloudColor ());
4035
4001
if (clouds->isCameraInsideCloud () && m_cache_enable_fog &&
4036
- !m_game_ui-> m_flags .force_fog_off ) {
4002
+ !m_flags.force_fog_off ) {
4037
4003
// if inside clouds, and fog enabled, use that as sky
4038
4004
// color(s)
4039
4005
video::SColor clouds_dark = clouds->getColor ()
@@ -4058,7 +4024,7 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
4058
4024
Fog
4059
4025
*/
4060
4026
4061
- if (m_cache_enable_fog && !m_game_ui-> m_flags .force_fog_off ) {
4027
+ if (m_cache_enable_fog && !m_flags.force_fog_off ) {
4062
4028
driver->setFog (
4063
4029
sky->getBgColor (),
4064
4030
video::EFT_FOG_LINEAR,
0 commit comments