/* mainmenumanager.h
*/
-gui::IGUIEnvironment *guienv = NULL;
-gui::IGUIStaticText *guiroot = NULL;
+gui::IGUIEnvironment *guienv = nullptr;
+gui::IGUIStaticText *guiroot = nullptr;
MainMenuManager g_menumgr;
bool isMenuActive()
}
// Passed to menus to allow disconnecting and exiting
-MainGameCallback *g_gamecallback = NULL;
+MainGameCallback *g_gamecallback = nullptr;
ClientLauncher::~ClientLauncher()
class ClientLauncher
{
public:
- ClientLauncher() :
- list_video_modes(false),
- skip_main_menu(false),
- use_freetype(false),
- random_input(false),
- address(""),
- playername(""),
- password(""),
- device(NULL),
- input(NULL),
- receiver(NULL),
- skin(NULL),
- font(NULL),
- simple_singleplayer_mode(false),
- current_playername("inv£lid"),
- current_password(""),
- current_address("does-not-exist"),
- current_port(0)
- {}
+ ClientLauncher() {}
~ClientLauncher();
void speed_tests();
bool print_video_modes();
- bool list_video_modes;
- bool skip_main_menu;
- bool use_freetype;
- bool random_input;
- std::string address;
- std::string playername;
- std::string password;
- IrrlichtDevice *device;
- InputHandler *input;
- MyEventReceiver *receiver;
- gui::IGUISkin *skin;
- gui::IGUIFont *font;
- scene::ISceneManager *smgr;
+ bool list_video_modes = false;
+ bool skip_main_menu = false;
+ bool use_freetype = false;
+ bool random_input = false;
+ std::string address = "";
+ std::string playername = "";
+ std::string password = "";
+ IrrlichtDevice *device = nullptr;
+ InputHandler *input = nullptr;
+ MyEventReceiver *receiver = nullptr;
+ gui::IGUISkin *skin = nullptr;
+ gui::IGUIFont *font = nullptr;
+ scene::ISceneManager *smgr = nullptr;
SubgameSpec gamespec;
WorldSpec worldspec;
bool simple_singleplayer_mode;
// These are set up based on the menu and other things
// TODO: Are these required since there's already playername, password, etc
- std::string current_playername;
- std::string current_password;
- std::string current_address;
- int current_port;
+ std::string current_playername = "inv£lid";
+ std::string current_password = "";
+ std::string current_address = "does-not-exist";
+ int current_port = 0;
};
#endif
MyEventReceiver()
{
- clearInput();
#ifdef HAVE_TOUCHSCREENGUI
m_touchscreengui = NULL;
#endif
}
- bool leftclicked;
- bool rightclicked;
- bool leftreleased;
- bool rightreleased;
+ bool leftclicked = false;
+ bool rightclicked = false;
+ bool leftreleased = false;
+ bool rightreleased = false;
- bool left_active;
- bool middle_active;
- bool right_active;
+ bool left_active = false;
+ bool middle_active = false;
+ bool right_active = false;
- s32 mouse_wheel;
+ s32 mouse_wheel = 0;
- JoystickController *joystick;
+ JoystickController *joystick = nullptr;
#ifdef HAVE_TOUCHSCREENGUI
TouchScreenGUI *m_touchscreengui;
{
public:
RealInputHandler(IrrlichtDevice *device, MyEventReceiver *receiver)
- : m_device(device), m_receiver(receiver), m_mousepos(0, 0)
+ : m_device(device), m_receiver(receiver)
{
m_receiver->joystick = &joystick;
}
}
private:
- IrrlichtDevice *m_device;
- MyEventReceiver *m_receiver;
+ IrrlichtDevice *m_device = nullptr;
+ MyEventReceiver *m_receiver = nullptr;
v2s32 m_mousepos;
};
class RandomInputHandler : public InputHandler
{
public:
- RandomInputHandler()
- {
- leftdown = false;
- rightdown = false;
- leftclicked = false;
- rightclicked = false;
- leftreleased = false;
- rightreleased = false;
- keydown.clear();
- }
+ RandomInputHandler() {}
virtual bool isKeyDown(const KeyPress &keyCode) { return keydown[keyCode]; }
virtual bool wasKeyDown(const KeyPress &keyCode) { return false; }
virtual v2s32 getMousePos() { return mousepos; }
KeyList keydown;
v2s32 mousepos;
v2s32 mousespeed;
- bool leftdown;
- bool rightdown;
- bool leftclicked;
- bool rightclicked;
- bool leftreleased;
- bool rightreleased;
+ bool leftdown = false;
+ bool rightdown = false;
+ bool leftclicked = false;
+ bool rightclicked = false;
+ bool leftreleased = false;
+ bool rightreleased = false;
};
#endif
return jlo;
}
-JoystickController::JoystickController()
+JoystickController::JoystickController() :
+ doubling_dtime(g_settings->getFloat("repeat_joystick_button_time"))
{
- m_joystick_id = 0;
-
- doubling_dtime = g_settings->getFloat("repeat_joystick_button_time");
-
for (size_t i = 0; i < KeyType::INTERNAL_ENUM_COUNT; i++) {
m_past_pressed_time[i] = 0;
}
s16 m_axes_vals[JA_COUNT];
- u8 m_joystick_id;
+ u8 m_joystick_id = 0;
std::bitset<KeyType::INTERNAL_ENUM_COUNT> m_pressed_keys;
namespace irr {namespace scene {class IMesh;}}
struct TextureFromMeshParams
{
- scene::IMesh *mesh;
+ scene::IMesh *mesh = nullptr;
core::dimension2d<u32> dim;
std::string rtt_texture_name;
bool delete_texture_on_shutdown;
ISimpleTextureSource(){}
virtual ~ISimpleTextureSource(){}
virtual video::ITexture* getTexture(
- const std::string &name, u32 *id = NULL) = 0;
+ const std::string &name, u32 *id = nullptr) = 0;
};
class ITextureSource : public ISimpleTextureSource
virtual std::string getTextureName(u32 id)=0;
virtual video::ITexture* getTexture(u32 id)=0;
virtual video::ITexture* getTexture(
- const std::string &name, u32 *id = NULL)=0;
+ const std::string &name, u32 *id = nullptr)=0;
virtual video::ITexture* getTextureForMesh(
- const std::string &name, u32 *id = NULL) = 0;
+ const std::string &name, u32 *id = nullptr) = 0;
/*!
* Returns a palette from the given texture name.
* The pointer is valid until the texture source is
virtual std::string getTextureName(u32 id)=0;
virtual video::ITexture* getTexture(u32 id)=0;
virtual video::ITexture* getTexture(
- const std::string &name, u32 *id = NULL)=0;
+ const std::string &name, u32 *id = nullptr)=0;
virtual IrrlichtDevice* getDevice()=0;
virtual bool isKnownSourceImage(const std::string &name)=0;
virtual video::ITexture* generateTextureFromMesh(
*/
struct FrameSpec
{
- FrameSpec():
- texture_id(0),
- texture(NULL),
- normal_texture(NULL),
- flags_texture(NULL)
- {
- }
- u32 texture_id;
- video::ITexture *texture;
- video::ITexture *normal_texture;
- video::ITexture *flags_texture;
+ FrameSpec() {}
+ u32 texture_id = 0;
+ video::ITexture *texture = nullptr;
+ video::ITexture *normal_texture = nullptr;
+ video::ITexture *flags_texture = nullptr;
};
#define MAX_TILE_LAYERS 2
//! Defines a layer of a tile.
struct TileLayer
{
- TileLayer():
- texture(NULL),
- normal_texture(NULL),
- flags_texture(NULL),
- shader_id(0),
- texture_id(0),
- animation_frame_length_ms(0),
- animation_frame_count(1),
- material_type(TILE_MATERIAL_BASIC),
- material_flags(
- //0 // <- DEBUG, Use the one below
- MATERIAL_FLAG_BACKFACE_CULLING |
- MATERIAL_FLAG_TILEABLE_HORIZONTAL|
- MATERIAL_FLAG_TILEABLE_VERTICAL
- ),
- has_color(false),
- color()
- {
- }
+ TileLayer() {}
/*!
* Two layers are equal if they can be merged.
// Ordered for size, please do not reorder
- video::ITexture *texture;
- video::ITexture *normal_texture;
- video::ITexture *flags_texture;
+ video::ITexture *texture = nullptr;
+ video::ITexture *normal_texture = nullptr;
+ video::ITexture *flags_texture = nullptr;
- u32 shader_id;
+ u32 shader_id = 0;
- u32 texture_id;
+ u32 texture_id = 0;
- u16 animation_frame_length_ms;
- u8 animation_frame_count;
+ u16 animation_frame_length_ms = 0;
+ u8 animation_frame_count = 1;
- u8 material_type;
- u8 material_flags;
+ u8 material_type = TILE_MATERIAL_BASIC;
+ u8 material_flags =
+ //0 // <- DEBUG, Use the one below
+ MATERIAL_FLAG_BACKFACE_CULLING |
+ MATERIAL_FLAG_TILEABLE_HORIZONTAL|
+ MATERIAL_FLAG_TILEABLE_VERTICAL;
//! If true, the tile has its own color.
- bool has_color;
+ bool has_color = false;
std::vector<FrameSpec> frames;
*/
struct TileSpec
{
- TileSpec():
- rotation(0),
- emissive_light(0)
- {
+ TileSpec() {
for (int layer = 0; layer < MAX_TILE_LAYERS; layer++)
layers[layer] = TileLayer();
}
&& emissive_light == other.emissive_light;
}
- u8 rotation;
+ u8 rotation = 0;
//! This much light does the tile emit.
- u8 emissive_light;
+ u8 emissive_light = 0;
//! The first is base texture, the second is overlay.
TileLayer layers[MAX_TILE_LAYERS];
};