mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
Minor cleanup: game.cpp
* Sort includes * Remove unnecessary includes * Ensure the parameter name for GameRunData is consistent for class member functions
This commit is contained in:
parent
699d42efc6
commit
34c5a5b377
144
src/game.cpp
144
src/game.cpp
@ -18,64 +18,59 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
*/
|
||||
|
||||
#include "game.h"
|
||||
#include "irrlichttypes_extrabloated.h"
|
||||
#include <IGUICheckBox.h>
|
||||
#include <IGUIEditBox.h>
|
||||
#include <IGUIButton.h>
|
||||
#include <IGUIStaticText.h>
|
||||
#include <IGUIFont.h>
|
||||
#include <IMaterialRendererServices.h>
|
||||
#include "IMeshCache.h"
|
||||
#include "client.h"
|
||||
#include "server.h"
|
||||
#include "guiPasswordChange.h"
|
||||
#include "guiVolumeChange.h"
|
||||
#include "guiKeyChangeMenu.h"
|
||||
#include "guiFormSpecMenu.h"
|
||||
#include "tool.h"
|
||||
#include "guiChatConsole.h"
|
||||
#include "config.h"
|
||||
#include "version.h"
|
||||
#include "clouds.h"
|
||||
#include "particles.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include "camera.h"
|
||||
#include "mapblock.h"
|
||||
#include "settings.h"
|
||||
#include "profiler.h"
|
||||
#include "mainmenumanager.h"
|
||||
#include "gettext.h"
|
||||
#include "client.h"
|
||||
#include "client/tile.h" // For TextureSource
|
||||
#include "clientmap.h"
|
||||
#include "clouds.h"
|
||||
#include "config.h"
|
||||
#include "content_cao.h"
|
||||
#include "drawscene.h"
|
||||
#include "event_manager.h"
|
||||
#include "fontengine.h"
|
||||
#include "itemdef.h"
|
||||
#include "log.h"
|
||||
#include "filesys.h"
|
||||
// Needed for determining pointing to nodes
|
||||
#include "nodedef.h"
|
||||
#include "nodemetadata.h"
|
||||
#include "main.h" // For g_settings
|
||||
#include "itemdef.h"
|
||||
#include "client/tile.h" // For TextureSource
|
||||
#include "shader.h" // For ShaderSource
|
||||
#include "logoutputbuffer.h"
|
||||
#include "subgame.h"
|
||||
#include "quicktune_shortcutter.h"
|
||||
#include "clientmap.h"
|
||||
#include "gettext.h"
|
||||
#include "guiChatConsole.h"
|
||||
#include "guiFormSpecMenu.h"
|
||||
#include "guiKeyChangeMenu.h"
|
||||
#include "guiPasswordChange.h"
|
||||
#include "guiVolumeChange.h"
|
||||
#include "hud.h"
|
||||
#include "logoutputbuffer.h"
|
||||
#include "mainmenumanager.h"
|
||||
#include "mapblock.h"
|
||||
#include "nodedef.h" // Needed for determining pointing to nodes
|
||||
#include "nodemetadata.h"
|
||||
#include "particles.h"
|
||||
#include "profiler.h"
|
||||
#include "quicktune_shortcutter.h"
|
||||
#include "server.h"
|
||||
#include "settings.h"
|
||||
#include "shader.h" // For ShaderSource
|
||||
#include "sky.h"
|
||||
#include "subgame.h"
|
||||
#include "tool.h"
|
||||
#include "util/directiontables.h"
|
||||
#include "util/pointedthing.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "sound.h"
|
||||
|
||||
#if USE_SOUND
|
||||
#include "sound_openal.h"
|
||||
#endif
|
||||
#include "event_manager.h"
|
||||
#include <iomanip>
|
||||
#include <list>
|
||||
#include "util/directiontables.h"
|
||||
#include "util/pointedthing.h"
|
||||
#include "drawscene.h"
|
||||
#include "content_cao.h"
|
||||
#include "fontengine.h"
|
||||
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
#include "touchscreengui.h"
|
||||
#endif
|
||||
|
||||
extern Settings *g_settings;
|
||||
extern Profiler *g_profiler;
|
||||
|
||||
/*
|
||||
Text input system
|
||||
*/
|
||||
@ -565,16 +560,6 @@ public:
|
||||
s32 graphh = 50;
|
||||
s32 textx = x_left + m_log_max_size + 15;
|
||||
s32 textx2 = textx + 200 - 15;
|
||||
|
||||
// Draw background
|
||||
/*{
|
||||
u32 num_graphs = m_meta.size();
|
||||
core::rect<s32> rect(x_left, y_bottom - num_graphs*graphh,
|
||||
textx2, y_bottom);
|
||||
video::SColor bgcolor(120,0,0,0);
|
||||
driver->draw2DRectangle(bgcolor, rect, NULL);
|
||||
}*/
|
||||
|
||||
s32 meta_i = 0;
|
||||
|
||||
for (std::map<std::string, Meta>::const_iterator i = m_meta.begin();
|
||||
@ -1472,17 +1457,17 @@ protected:
|
||||
|
||||
// Main loop
|
||||
|
||||
void updateInteractTimers(GameRunData *args, f32 dtime);
|
||||
void updateInteractTimers(GameRunData *runData, f32 dtime);
|
||||
bool checkConnection();
|
||||
bool handleCallbacks();
|
||||
void processQueues();
|
||||
void updateProfilers(const GameRunData &run_data, const RunStats &stats,
|
||||
void updateProfilers(const GameRunData &runData, const RunStats &stats,
|
||||
const FpsControl &draw_times, f32 dtime);
|
||||
void addProfilerGraphs(const RunStats &stats, const FpsControl &draw_times,
|
||||
f32 dtime);
|
||||
void updateStats(RunStats *stats, const FpsControl &draw_times, f32 dtime);
|
||||
|
||||
void processUserInput(VolatileRunFlags *flags, GameRunData *interact_args,
|
||||
void processUserInput(VolatileRunFlags *flags, GameRunData *runData,
|
||||
f32 dtime);
|
||||
void processKeyboardInput(VolatileRunFlags *flags,
|
||||
float *statustext_time,
|
||||
@ -1862,10 +1847,11 @@ void Game::shutdown()
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/****************************************************************************
|
||||
Startup
|
||||
****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
bool Game::init(
|
||||
const std::string &map_dir,
|
||||
@ -2326,20 +2312,21 @@ bool Game::getServerContent(bool *aborted)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/****************************************************************************
|
||||
Run
|
||||
****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
inline void Game::updateInteractTimers(GameRunData *args, f32 dtime)
|
||||
inline void Game::updateInteractTimers(GameRunData *runData, f32 dtime)
|
||||
{
|
||||
if (args->nodig_delay_timer >= 0)
|
||||
args->nodig_delay_timer -= dtime;
|
||||
if (runData->nodig_delay_timer >= 0)
|
||||
runData->nodig_delay_timer -= dtime;
|
||||
|
||||
if (args->object_hit_delay_timer >= 0)
|
||||
args->object_hit_delay_timer -= dtime;
|
||||
if (runData->object_hit_delay_timer >= 0)
|
||||
runData->object_hit_delay_timer -= dtime;
|
||||
|
||||
args->time_from_last_punch += dtime;
|
||||
runData->time_from_last_punch += dtime;
|
||||
}
|
||||
|
||||
|
||||
@ -2402,7 +2389,7 @@ void Game::processQueues()
|
||||
}
|
||||
|
||||
|
||||
void Game::updateProfilers(const GameRunData &run_data, const RunStats &stats,
|
||||
void Game::updateProfilers(const GameRunData &runData, const RunStats &stats,
|
||||
const FpsControl &draw_times, f32 dtime)
|
||||
{
|
||||
float profiler_print_interval =
|
||||
@ -2421,7 +2408,7 @@ void Game::updateProfilers(const GameRunData &run_data, const RunStats &stats,
|
||||
}
|
||||
|
||||
update_profiler_gui(guitext_profiler, g_fontengine,
|
||||
run_data.profiler_current_page, run_data.profiler_max_page,
|
||||
runData.profiler_current_page, runData.profiler_max_page,
|
||||
driver->getScreenSize().Height);
|
||||
|
||||
g_profiler->clear();
|
||||
@ -2502,7 +2489,7 @@ void Game::updateStats(RunStats *stats, const FpsControl &draw_times,
|
||||
****************************************************************************/
|
||||
|
||||
void Game::processUserInput(VolatileRunFlags *flags,
|
||||
GameRunData *interact_args, f32 dtime)
|
||||
GameRunData *runData, f32 dtime)
|
||||
{
|
||||
// Reset input if window not active or some menu is active
|
||||
if (device->isWindowActive() == false
|
||||
@ -2533,18 +2520,18 @@ void Game::processUserInput(VolatileRunFlags *flags,
|
||||
#endif
|
||||
|
||||
// Increase timer for double tap of "keymap_jump"
|
||||
if (m_cache_doubletap_jump && interact_args->jump_timer <= 0.2)
|
||||
interact_args->jump_timer += dtime;
|
||||
if (m_cache_doubletap_jump && runData->jump_timer <= 0.2)
|
||||
runData->jump_timer += dtime;
|
||||
|
||||
processKeyboardInput(
|
||||
flags,
|
||||
&interact_args->statustext_time,
|
||||
&interact_args->jump_timer,
|
||||
&interact_args->reset_jump_timer,
|
||||
&interact_args->profiler_current_page,
|
||||
interact_args->profiler_max_page);
|
||||
&runData->statustext_time,
|
||||
&runData->jump_timer,
|
||||
&runData->reset_jump_timer,
|
||||
&runData->profiler_current_page,
|
||||
runData->profiler_max_page);
|
||||
|
||||
processItemSelection(&interact_args->new_playeritem);
|
||||
processItemSelection(&runData->new_playeritem);
|
||||
}
|
||||
|
||||
|
||||
@ -4186,9 +4173,11 @@ void Game::showOverlayMessage(const wchar_t *msg, float dtime,
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/****************************************************************************
|
||||
Shutdown / cleanup
|
||||
****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
void Game::extendedResourceCleanup()
|
||||
{
|
||||
@ -4212,10 +4201,11 @@ void Game::extendedResourceCleanup()
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/****************************************************************************
|
||||
extern function for launching the game
|
||||
****************************************************************************/
|
||||
/****************************************************************************/
|
||||
|
||||
void the_game(bool *kill,
|
||||
bool random_input,
|
||||
|
Loading…
Reference in New Issue
Block a user