]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Merge branch 'master' of https://github.com/minetest/minetest
authorElias Fleckenstein <eliasfleckenstein@web.de>
Thu, 7 Jan 2021 11:35:04 +0000 (12:35 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Thu, 7 Jan 2021 11:35:04 +0000 (12:35 +0100)
27 files changed:
1  2 
CMakeLists.txt
builtin/common/misc_helpers.lua
builtin/mainmenu/dlg_contentstore.lua
builtin/mainmenu/init.lua
builtin/mainmenu/tab_credits.lua
builtin/settingtypes.txt
doc/lua_api.txt
src/client/camera.cpp
src/client/clientenvironment.cpp
src/client/clientmap.cpp
src/client/content_cao.cpp
src/client/game.cpp
src/client/game.h
src/client/inputhandler.h
src/client/mapblock_mesh.cpp
src/client/minimap.cpp
src/defaultsettings.cpp
src/gui/CMakeLists.txt
src/map.cpp
src/map.h
src/network/networkprotocol.h
src/nodedef.cpp
src/script/cpp_api/s_security.cpp
src/script/lua_api/l_env.cpp
src/script/lua_api/l_env.h
src/script/lua_api/l_mainmenu.cpp
src/script/lua_api/l_util.cpp

diff --cc CMakeLists.txt
index 80fba3603b999ccee4be924c712a248298501066,1d53fcffd20071b3dbb13df43780460ed763c552..65ad4710225d6548071790921bcc7ced88669ee3
@@@ -7,9 -2,8 +2,8 @@@ cmake_minimum_required(VERSION 3.5
  
  # This can be read from ${PROJECT_NAME} after project() is called
  project(minetest)
 -set(PROJECT_NAME_CAPITALIZED "Minetest")
 +set(PROJECT_NAME_CAPITALIZED "Dragonfire")
  
- # Works only for cmake 3.1 and greater
  set(CMAKE_CXX_STANDARD 11)
  set(GCC_MINIMUM_VERSION "4.8")
  set(CLANG_MINIMUM_VERSION "3.4")
Simple merge
Simple merge
Simple merge
Simple merge
index 9849d88bcb20f380f0ace2348ee5289c4715330a,7e23b5641f8ab88d6a2bc67bb36da68758433d72..39a6f72317e0a1109b6b54296448a1af14e40c88
@@@ -2200,111 -2205,5 +2217,112 @@@ contentdb_url (ContentDB URL) string ht
  contentdb_flag_blacklist (ContentDB Flag Blacklist) string nonfree, desktop_default
  
  #    Maximum number of concurrent downloads. Downloads exceeding this limit will be queued.
+ #    This should be lower than curl_parallel_limit.
  contentdb_max_concurrent_downloads (ContentDB Max Concurrent Downloads) int 3
 +
 +[Cheat Menu]
 +
 +#   Font to use for cheat menu
 +cheat_menu_font (MenuFont) enum FM_Mono FM_Standard,FM_Mono,FM_Fallback,FM_Simple,FM_SimpleMono,FM_MaxMode,FM_Unspecified
 +
 +#   (RGB value)
 +cheat_menu_bg_color (Cell background color) v3f 255, 145, 88
 +
 +cheat_menu_bg_color_alpha (Cell background color alpha) int 192
 +
 +#   (RGB value)
 +cheat_menu_active_bg_color (Active cell background color) v3f 255, 87, 53
 +
 +cheat_menu_active_bg_color_alpha (Active cell background color alpha) int 192
 +
 +#   (RGB value)
 +cheat_menu_font_color (Font color) v3f 0, 0, 0
 +
 +cheat_menu_font_color_alpha (Font color alpha) int 255 
 +
 +#   (RGB value)
 +cheat_menu_selected_font_color (Selected font color) v3f 255, 252, 88
 +
 +cheat_menu_selected_font_color_alpha (Selected font color alpha) int 255
 +
 +cheat_menu_head_height (Head height) int 50
 +
 +cheat_menu_entry_height (Entry height) int 40
 +
 +cheat_menu_entry_width (Entry width) int 200
 +
 +[Cheats]
 +
 +fullbright (Fullbright) bool false
 +
 +xray (XRay) bool false
 +
 +xray_nodes (XRay Nodes) string default:stone,mcl_core:stone
 +
 +priv_bypass (PrivBypass) bool true
 +
 +fastdig (FastDig) bool false
 +
 +fastplace (FastPlace) bool false
 +
 +autodig (AutoDig) bool false
 +
 +autoplace (AutoPlace) bool false
 +
 +prevent_natural_damage (NoFallDamage) bool true
 +
 +freecam (Freecam) bool false
 +
 +no_hurt_cam (NoHurtCam) bool false
 +
 +hud_flags_bypass (HUDBypass) bool true
 +
 +antiknockback (AntiKnockback) bool false
 +
 +entity_speed (EntitySpeed) bool false
 +
 +jesus (Jesus) bool false
 +
 +instant_break (InstantBreak) bool false
 +
 +no_night (BrightNight) bool false
 +
 +coords (Coords) bool false
 +
 +point_liquids (PointLiquids) bool false
 +
 +spamclick (FastHit) bool false
 +
 +no_force_rotate (NoForceRotate) bool false
 +
 +no_slow (NoSlow) bool false
 +
 +cheat_hud (CheatHUD) bool true
 +
 +node_esp_nodes (NodeESP Nodes) string
 +
 +jetpack (JetPack) bool false
 +
 +autohit (AutoHit) bool false
 +
 +antislip (AntiSlip) bool false
 +
 +enable_entity_tracers (EntityTracers) bool false
 +
 +enable_entity_esp (EntityESP) bool false
 +
 +enable_player_tracers (PlayerTracers) bool false
 +
 +enable_player_esp (PlayerESP) bool false
 +
 +enable_node_esp (NodeESP) bool false
 +
 +enable_node_tracers (NodeTracers) bool false
 +
 +entity_esp_color (EntityESP Color) v3f 255, 255, 255
 +
 +player_esp_color (PlayerESP Color) v3f 0, 255, 0
 +
 +tool_range (Additional Tool Range) int 2
 +
 +reach (Reach) bool false
diff --cc doc/lua_api.txt
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 816f8f307f077c656a8da77c871b12c4b60535af,9e942f47a33c558450443842080b4cd4acd45b4e..10c3a7ceb30317d8b4f64c281c340b941d9f1c28
@@@ -108,17 -948,7 +108,17 @@@ Game::Game() 
                &settingChangedCallback, this);
        g_settings->registerChangedCallback("camera_smoothing",
                &settingChangedCallback, this);
-               
 +      g_settings->registerChangedCallback("freecam",
 +              &freecamChangedCallback, this);
 +      g_settings->registerChangedCallback("xray",
 +              &updateAllMapBlocksCallback, this);
 +      g_settings->registerChangedCallback("xray_nodes",
 +              &updateAllMapBlocksCallback, this);
 +      g_settings->registerChangedCallback("fullbright",
 +              &updateAllMapBlocksCallback, this);
 +      g_settings->registerChangedCallback("node_esp_nodes",
 +              &updateAllMapBlocksCallback, this);
        readSettings();
  
  #ifdef __ANDROID__
@@@ -242,9 -1062,11 +242,9 @@@ void Game::run(
  {
        ProfilerGraph graph;
        RunStats stats              = { 0 };
 -      CameraOrientation cam_view_target  = { 0 };
 -      CameraOrientation cam_view  = { 0 };
        FpsControl draw_times       = { 0 };
        f32 dtime; // in seconds
-       
        /* Clear the profiler */
        Profiler::GraphValues dummyvalues;
        g_profiler->graphGet(dummyvalues);
@@@ -613,20 -1414,6 +595,20 @@@ bool Game::initGui(
        gui_chat_console = new GUIChatConsole(guienv, guienv->getRootGUIElement(),
                        -1, chat_backend, client, &g_menumgr);
  
-       
 +      if (!gui_chat_console) {
 +              *error_message = "Could not allocate memory for chat console";
 +              errorstream << *error_message << std::endl;
 +              return false;
 +      }
++
 +      m_cheat_menu = new CheatMenu(client);
 +
 +      if (!m_cheat_menu) {
 +              *error_message = "Could not allocate memory for cheat menu";
 +              errorstream << *error_message << std::endl;
 +              return false;
 +      }
 +
  #ifdef HAVE_TOUCHSCREENGUI
  
        if (g_touchscreengui)
@@@ -1068,18 -1852,6 +1047,18 @@@ void Game::processUserInput(f32 dtime
  
  void Game::processKeyInput()
  {
-       
 +      if (wasKeyDown(KeyType::SELECT_UP)) {
 +              m_cheat_menu->selectUp();
 +      } else if (wasKeyDown(KeyType::SELECT_DOWN)) {
 +              m_cheat_menu->selectDown();
 +      } else if (wasKeyDown(KeyType::SELECT_LEFT)) {
 +              m_cheat_menu->selectLeft();
 +      } else if (wasKeyDown(KeyType::SELECT_RIGHT)) {
 +              m_cheat_menu->selectRight();
 +      } else if (wasKeyDown(KeyType::SELECT_CONFIRM)) {
 +              m_cheat_menu->selectConfirm();
 +      }
++
        if (wasKeyDown(KeyType::DROP)) {
                dropSelectedItem(isKeyDown(KeyType::SNEAK));
        } else if (wasKeyDown(KeyType::AUTOFORWARD)) {
@@@ -1875,21 -2587,13 +1854,21 @@@ void Game::handleClientEvent_ShowFormSp
  }
  
  void Game::handleClientEvent_ShowLocalFormSpec(ClientEvent *event, CameraOrientation *cam)
- {     
+ {
 -      FormspecFormSource *fs_src = new FormspecFormSource(*event->show_formspec.formspec);
 -      LocalFormspecHandler *txt_dst =
 -              new LocalFormspecHandler(*event->show_formspec.formname, client);
 -      GUIFormSpecMenu::create(m_game_ui->getFormspecGUI(), client, &input->joystick,
 +      if (event->show_formspec.formspec->empty()) {
 +              auto formspec = m_game_ui->getFormspecGUI();
 +              if (formspec && (event->show_formspec.formname->empty()
 +                              || *(event->show_formspec.formname) == m_game_ui->getFormspecName())) {
 +                      formspec->quitMenu();
 +              }
 +      } else {
 +              FormspecFormSource *fs_src = new FormspecFormSource(*event->show_formspec.formspec);
 +              LocalFormspecHandler *txt_dst =
 +                      new LocalFormspecHandler(*event->show_formspec.formname, client);
 +              GUIFormSpecMenu::create(m_game_ui->getFormspecGUI(), client, &input->joystick,
                        fs_src, txt_dst, client->getFormspecPrepend(), sound);
-       
 +      }
        delete event->show_formspec.formspec;
        delete event->show_formspec.formname;
  }
@@@ -2221,17 -2934,6 +2200,17 @@@ void Game::updateCamera(u32 busy_time, 
        }
  }
  
-       playercao->setChildrenVisible(is_visible);      
 +void Game::updatePlayerCAOVisibility()
 +{
 +      // Make the player visible depending on camera mode.
 +      LocalPlayer *player = client->getEnv().getLocalPlayer();
 +      GenericCAO *playercao = player->getCAO();
 +      if (!playercao)
 +              return;
 +      playercao->updateMeshCulling();
 +      bool is_visible = camera->getCameraMode() > CAMERA_MODE_FIRST || g_settings->getBool("freecam");
++      playercao->setChildrenVisible(is_visible);
 +}
  
  void Game::updateSound(f32 dtime)
  {
@@@ -2287,11 -2989,7 +2266,11 @@@ void Game::processPlayerInteraction(f3
  
        const ItemDefinition &selected_def = selected_item.getDefinition(itemdef_manager);
        f32 d = getToolRange(selected_def, hand_item.getDefinition(itemdef_manager));
-       
-       
++
 +      if (g_settings->getBool("reach"))
 +              d += g_settings->getU16("tool_range");
 +
        core::line3d<f32> shootline;
  
        switch (camera->getCameraMode()) {
@@@ -2862,11 -3560,7 +2841,11 @@@ void Game::handleDigging(const PointedT
                                        player, nodepos, n, features);
                }
        }
-       
 +      if(g_settings->getBool("instant_break")) {
 +              runData.dig_time_complete = 0;
 +              runData.dig_instantly = true;
 +      }
        if (!runData.digging) {
                infostream << "Started digging" << std::endl;
                runData.dig_instantly = runData.dig_time_complete == 0;
@@@ -3603,9 -4240,7 +3582,9 @@@ void the_game(bool *kill
                bool *reconnect_requested) // Used for local game
  {
        Game game;
-       
 +      g_game = &game;
 +
        /* Make a copy of the server address because if a local singleplayer server
         * is created then this is updated and we don't want to change the value
         * passed to us by the calling function
index 3e80b15e7bb21a3e36bc384c15649e5b05a6483b,d041532717640a8c1f4109377ca5ee0f297b9d82..fd93ef82d03711303f19a6cd3ed77cdacfb11471
@@@ -94,841 -42,6 +94,836 @@@ struct CameraOrientation 
        f32 camera_pitch;  // "up/down"
  };
  
-               if (m_client && m_client->modsLoaded())
 +/*
 +      Text input system
 +*/
 +
 +struct TextDestNodeMetadata : public TextDest
 +{
 +      TextDestNodeMetadata(v3s16 p, Client *client)
 +      {
 +              m_p = p;
 +              m_client = client;
 +      }
 +      // This is deprecated I guess? -celeron55
 +      void gotText(const std::wstring &text)
 +      {
 +              std::string ntext = wide_to_utf8(text);
 +              infostream << "Submitting 'text' field of node at (" << m_p.X << ","
 +                         << m_p.Y << "," << m_p.Z << "): " << ntext << std::endl;
 +              StringMap fields;
 +              fields["text"] = ntext;
 +              m_client->sendNodemetaFields(m_p, "", fields);
 +      }
 +      void gotText(const StringMap &fields)
 +      {
 +              m_client->sendNodemetaFields(m_p, "", fields);
 +      }
 +
 +      v3s16 m_p;
 +      Client *m_client;
 +};
 +
 +struct TextDestPlayerInventory : public TextDest
 +{
 +      TextDestPlayerInventory(Client *client)
 +      {
 +              m_client = client;
 +              m_formname = "";
 +      }
 +      TextDestPlayerInventory(Client *client, const std::string &formname)
 +      {
 +              m_client = client;
 +              m_formname = formname;
 +      }
 +      void gotText(const StringMap &fields)
 +      {
 +              m_client->sendInventoryFields(m_formname, fields);
 +      }
 +
 +      Client *m_client;
 +};
 +
 +struct LocalFormspecHandler : public TextDest
 +{
 +      LocalFormspecHandler(const std::string &formname)
 +      {
 +              m_formname = formname;
 +      }
 +
 +      LocalFormspecHandler(const std::string &formname, Client *client):
 +              m_client(client)
 +      {
 +              m_formname = formname;
 +      }
 +
 +      void gotText(const StringMap &fields)
 +      {
 +              if (m_formname == "MT_PAUSE_MENU") {
 +                      if (fields.find("btn_sound") != fields.end()) {
 +                              g_gamecallback->changeVolume();
 +                              return;
 +                      }
 +
 +                      if (fields.find("btn_key_config") != fields.end()) {
 +                              g_gamecallback->keyConfig();
 +                              return;
 +                      }
 +
 +                      if (fields.find("btn_exit_menu") != fields.end()) {
 +                              g_gamecallback->disconnect();
 +                              return;
 +                      }
 +
 +                      if (fields.find("btn_exit_os") != fields.end()) {
 +                              g_gamecallback->exitToOS();
 +#ifndef __ANDROID__
 +                              RenderingEngine::get_raw_device()->closeDevice();
 +#endif
 +                              return;
 +                      }
 +
 +                      if (fields.find("btn_change_password") != fields.end()) {
 +                              g_gamecallback->changePassword();
 +                              return;
 +                      }
 +
 +                      if (fields.find("quit") != fields.end()) {
 +                              return;
 +                      }
 +
 +                      if (fields.find("btn_continue") != fields.end()) {
 +                              return;
 +                      }
 +              }
 +
 +              if (m_formname == "MT_DEATH_SCREEN") {
 +                      assert(m_client != 0);
 +                      m_client->sendRespawn();
 +                      return;
 +              }
 +
-       virtual void onSetConstants(video::IMaterialRendererServices *services,
-                       bool is_highlevel)
++              if (m_client->modsLoaded())
 +                      m_client->getScript()->on_formspec_input(m_formname, fields);
 +      }
 +
 +      Client *m_client = nullptr;
 +};
 +
 +/* Form update callback */
 +
 +class NodeMetadataFormSource: public IFormSource
 +{
 +public:
 +      NodeMetadataFormSource(ClientMap *map, v3s16 p):
 +              m_map(map),
 +              m_p(p)
 +      {
 +      }
 +      const std::string &getForm() const
 +      {
 +              static const std::string empty_string = "";
 +              NodeMetadata *meta = m_map->getNodeMetadata(m_p);
 +
 +              if (!meta)
 +                      return empty_string;
 +
 +              return meta->getString("formspec");
 +      }
 +
 +      virtual std::string resolveText(const std::string &str)
 +      {
 +              NodeMetadata *meta = m_map->getNodeMetadata(m_p);
 +
 +              if (!meta)
 +                      return str;
 +
 +              return meta->resolveString(str);
 +      }
 +
 +      ClientMap *m_map;
 +      v3s16 m_p;
 +};
 +
 +class PlayerInventoryFormSource: public IFormSource
 +{
 +public:
 +      PlayerInventoryFormSource(Client *client):
 +              m_client(client)
 +      {
 +      }
 +
 +      const std::string &getForm() const
 +      {
 +              LocalPlayer *player = m_client->getEnv().getLocalPlayer();
 +              return player->inventory_formspec;
 +      }
 +
 +      Client *m_client;
 +};
 +
 +class NodeDugEvent: public MtEvent
 +{
 +public:
 +      v3s16 p;
 +      MapNode n;
 +
 +      NodeDugEvent(v3s16 p, MapNode n):
 +              p(p),
 +              n(n)
 +      {}
 +      MtEvent::Type getType() const
 +      {
 +              return MtEvent::NODE_DUG;
 +      }
 +};
 +
 +class SoundMaker
 +{
 +      ISoundManager *m_sound;
 +      const NodeDefManager *m_ndef;
 +public:
 +      bool makes_footstep_sound;
 +      float m_player_step_timer;
 +      float m_player_jump_timer;
 +
 +      SimpleSoundSpec m_player_step_sound;
 +      SimpleSoundSpec m_player_leftpunch_sound;
 +      SimpleSoundSpec m_player_rightpunch_sound;
 +
 +      SoundMaker(ISoundManager *sound, const NodeDefManager *ndef):
 +              m_sound(sound),
 +              m_ndef(ndef),
 +              makes_footstep_sound(true),
 +              m_player_step_timer(0.0f),
 +              m_player_jump_timer(0.0f)
 +      {
 +      }
 +
 +      void playPlayerStep()
 +      {
 +              if (m_player_step_timer <= 0 && m_player_step_sound.exists()) {
 +                      m_player_step_timer = 0.03;
 +                      if (makes_footstep_sound)
 +                              m_sound->playSound(m_player_step_sound, false);
 +              }
 +      }
 +
 +      void playPlayerJump()
 +      {
 +              if (m_player_jump_timer <= 0.0f) {
 +                      m_player_jump_timer = 0.2f;
 +                      m_sound->playSound(SimpleSoundSpec("player_jump", 0.5f), false);
 +              }
 +      }
 +
 +      static void viewBobbingStep(MtEvent *e, void *data)
 +      {
 +              SoundMaker *sm = (SoundMaker *)data;
 +              sm->playPlayerStep();
 +      }
 +
 +      static void playerRegainGround(MtEvent *e, void *data)
 +      {
 +              SoundMaker *sm = (SoundMaker *)data;
 +              sm->playPlayerStep();
 +      }
 +
 +      static void playerJump(MtEvent *e, void *data)
 +      {
 +              SoundMaker *sm = (SoundMaker *)data;
 +              sm->playPlayerJump();
 +      }
 +
 +      static void cameraPunchLeft(MtEvent *e, void *data)
 +      {
 +              SoundMaker *sm = (SoundMaker *)data;
 +              sm->m_sound->playSound(sm->m_player_leftpunch_sound, false);
 +      }
 +
 +      static void cameraPunchRight(MtEvent *e, void *data)
 +      {
 +              SoundMaker *sm = (SoundMaker *)data;
 +              sm->m_sound->playSound(sm->m_player_rightpunch_sound, false);
 +      }
 +
 +      static void nodeDug(MtEvent *e, void *data)
 +      {
 +              SoundMaker *sm = (SoundMaker *)data;
 +              NodeDugEvent *nde = (NodeDugEvent *)e;
 +              sm->m_sound->playSound(sm->m_ndef->get(nde->n).sound_dug, false);
 +      }
 +
 +      static void playerDamage(MtEvent *e, void *data)
 +      {
 +              SoundMaker *sm = (SoundMaker *)data;
 +              sm->m_sound->playSound(SimpleSoundSpec("player_damage", 0.5), false);
 +      }
 +
 +      static void playerFallingDamage(MtEvent *e, void *data)
 +      {
 +              SoundMaker *sm = (SoundMaker *)data;
 +              sm->m_sound->playSound(SimpleSoundSpec("player_falling_damage", 0.5), false);
 +      }
 +
 +      void registerReceiver(MtEventManager *mgr)
 +      {
 +              mgr->reg(MtEvent::VIEW_BOBBING_STEP, SoundMaker::viewBobbingStep, this);
 +              mgr->reg(MtEvent::PLAYER_REGAIN_GROUND, SoundMaker::playerRegainGround, this);
 +              mgr->reg(MtEvent::PLAYER_JUMP, SoundMaker::playerJump, this);
 +              mgr->reg(MtEvent::CAMERA_PUNCH_LEFT, SoundMaker::cameraPunchLeft, this);
 +              mgr->reg(MtEvent::CAMERA_PUNCH_RIGHT, SoundMaker::cameraPunchRight, this);
 +              mgr->reg(MtEvent::NODE_DUG, SoundMaker::nodeDug, this);
 +              mgr->reg(MtEvent::PLAYER_DAMAGE, SoundMaker::playerDamage, this);
 +              mgr->reg(MtEvent::PLAYER_FALLING_DAMAGE, SoundMaker::playerFallingDamage, this);
 +      }
 +
 +      void step(float dtime)
 +      {
 +              m_player_step_timer -= dtime;
 +              m_player_jump_timer -= dtime;
 +      }
 +};
 +
 +// Locally stored sounds don't need to be preloaded because of this
 +class GameOnDemandSoundFetcher: public OnDemandSoundFetcher
 +{
 +      std::set<std::string> m_fetched;
 +private:
 +      void paths_insert(std::set<std::string> &dst_paths,
 +              const std::string &base,
 +              const std::string &name)
 +      {
 +              dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".ogg");
 +              dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".0.ogg");
 +              dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".1.ogg");
 +              dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".2.ogg");
 +              dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".3.ogg");
 +              dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".4.ogg");
 +              dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".5.ogg");
 +              dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".6.ogg");
 +              dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".7.ogg");
 +              dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".8.ogg");
 +              dst_paths.insert(base + DIR_DELIM + "sounds" + DIR_DELIM + name + ".9.ogg");
 +      }
 +public:
 +      void fetchSounds(const std::string &name,
 +              std::set<std::string> &dst_paths,
 +              std::set<std::string> &dst_datas)
 +      {
 +              if (m_fetched.count(name))
 +                      return;
 +
 +              m_fetched.insert(name);
 +
 +              paths_insert(dst_paths, porting::path_share, name);
 +              paths_insert(dst_paths, porting::path_user,  name);
 +      }
 +};
 +
 +
 +// before 1.8 there isn't a "integer interface", only float
 +#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8)
 +typedef f32 SamplerLayer_t;
 +#else
 +typedef s32 SamplerLayer_t;
 +#endif
 +
 +
 +class GameGlobalShaderConstantSetter : public IShaderConstantSetter
 +{
 +      Sky *m_sky;
 +      bool *m_force_fog_off;
 +      f32 *m_fog_range;
 +      bool m_fog_enabled;
 +      CachedPixelShaderSetting<float, 4> m_sky_bg_color;
 +      CachedPixelShaderSetting<float> m_fog_distance;
 +      CachedVertexShaderSetting<float> m_animation_timer_vertex;
 +      CachedPixelShaderSetting<float> m_animation_timer_pixel;
 +      CachedPixelShaderSetting<float, 3> m_day_light;
 +      CachedPixelShaderSetting<float, 4> m_star_color;
 +      CachedPixelShaderSetting<float, 3> m_eye_position_pixel;
 +      CachedVertexShaderSetting<float, 3> m_eye_position_vertex;
 +      CachedPixelShaderSetting<float, 3> m_minimap_yaw;
 +      CachedPixelShaderSetting<float, 3> m_camera_offset_pixel;
 +      CachedPixelShaderSetting<float, 3> m_camera_offset_vertex;
 +      CachedPixelShaderSetting<SamplerLayer_t> m_base_texture;
 +      Client *m_client;
 +
 +public:
 +      void onSettingsChange(const std::string &name)
 +      {
 +              if (name == "enable_fog")
 +                      m_fog_enabled = g_settings->getBool("enable_fog");
 +      }
 +
 +      static void settingsCallback(const std::string &name, void *userdata)
 +      {
 +              reinterpret_cast<GameGlobalShaderConstantSetter*>(userdata)->onSettingsChange(name);
 +      }
 +
 +      void setSky(Sky *sky) { m_sky = sky; }
 +
 +      GameGlobalShaderConstantSetter(Sky *sky, bool *force_fog_off,
 +                      f32 *fog_range, Client *client) :
 +              m_sky(sky),
 +              m_force_fog_off(force_fog_off),
 +              m_fog_range(fog_range),
 +              m_sky_bg_color("skyBgColor"),
 +              m_fog_distance("fogDistance"),
 +              m_animation_timer_vertex("animationTimer"),
 +              m_animation_timer_pixel("animationTimer"),
 +              m_day_light("dayLight"),
 +              m_star_color("starColor"),
 +              m_eye_position_pixel("eyePosition"),
 +              m_eye_position_vertex("eyePosition"),
 +              m_minimap_yaw("yawVec"),
 +              m_camera_offset_pixel("cameraOffset"),
 +              m_camera_offset_vertex("cameraOffset"),
 +              m_base_texture("baseTexture"),
 +              m_client(client)
 +      {
 +              g_settings->registerChangedCallback("enable_fog", settingsCallback, this);
 +              m_fog_enabled = g_settings->getBool("enable_fog");
 +      }
 +
 +      ~GameGlobalShaderConstantSetter()
 +      {
 +              g_settings->deregisterChangedCallback("enable_fog", settingsCallback, this);
 +      }
 +
-               if (!is_highlevel)
-                       return;
++      void onSetConstants(video::IMaterialRendererServices *services) override
 +      {
-               GameGlobalShaderConstantSetter *scs = new GameGlobalShaderConstantSetter(
 +              // Background color
 +              video::SColor bgcolor = m_sky->getBgColor();
 +              video::SColorf bgcolorf(bgcolor);
 +              float bgcolorfa[4] = {
 +                      bgcolorf.r,
 +                      bgcolorf.g,
 +                      bgcolorf.b,
 +                      bgcolorf.a,
 +              };
 +              m_sky_bg_color.set(bgcolorfa, services);
 +
 +              // Fog distance
 +              float fog_distance = 10000 * BS;
 +
 +              if (m_fog_enabled && !*m_force_fog_off)
 +                      fog_distance = *m_fog_range;
 +
 +              m_fog_distance.set(&fog_distance, services);
 +
 +              u32 daynight_ratio = (float)m_client->getEnv().getDayNightRatio();
 +              video::SColorf sunlight;
 +              get_sunlight_color(&sunlight, daynight_ratio);
 +              float dnc[3] = {
 +                      sunlight.r,
 +                      sunlight.g,
 +                      sunlight.b };
 +              m_day_light.set(dnc, services);
 +
 +              video::SColorf star_color = m_sky->getCurrentStarColor();
 +              float clr[4] = {star_color.r, star_color.g, star_color.b, star_color.a};
 +              m_star_color.set(clr, services);
 +
 +              u32 animation_timer = porting::getTimeMs() % 1000000;
 +              float animation_timer_f = (float)animation_timer / 100000.f;
 +              m_animation_timer_vertex.set(&animation_timer_f, services);
 +              m_animation_timer_pixel.set(&animation_timer_f, services);
 +
 +              float eye_position_array[3];
 +              v3f epos = m_client->getEnv().getLocalPlayer()->getEyePosition();
 +#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8)
 +              eye_position_array[0] = epos.X;
 +              eye_position_array[1] = epos.Y;
 +              eye_position_array[2] = epos.Z;
 +#else
 +              epos.getAs3Values(eye_position_array);
 +#endif
 +              m_eye_position_pixel.set(eye_position_array, services);
 +              m_eye_position_vertex.set(eye_position_array, services);
 +
 +              if (m_client->getMinimap()) {
 +                      float minimap_yaw_array[3];
 +                      v3f minimap_yaw = m_client->getMinimap()->getYawVec();
 +#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8)
 +                      minimap_yaw_array[0] = minimap_yaw.X;
 +                      minimap_yaw_array[1] = minimap_yaw.Y;
 +                      minimap_yaw_array[2] = minimap_yaw.Z;
 +#else
 +                      minimap_yaw.getAs3Values(minimap_yaw_array);
 +#endif
 +                      m_minimap_yaw.set(minimap_yaw_array, services);
 +              }
 +
 +              float camera_offset_array[3];
 +              v3f offset = intToFloat(m_client->getCamera()->getOffset(), BS);
 +#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8)
 +              camera_offset_array[0] = offset.X;
 +              camera_offset_array[1] = offset.Y;
 +              camera_offset_array[2] = offset.Z;
 +#else
 +              offset.getAs3Values(camera_offset_array);
 +#endif
 +              m_camera_offset_pixel.set(camera_offset_array, services);
 +              m_camera_offset_vertex.set(camera_offset_array, services);
 +
 +              SamplerLayer_t base_tex = 0;
 +              m_base_texture.set(&base_tex, services);
 +      }
 +};
 +
 +
 +class GameGlobalShaderConstantSetterFactory : public IShaderConstantSetterFactory
 +{
 +      Sky *m_sky;
 +      bool *m_force_fog_off;
 +      f32 *m_fog_range;
 +      Client *m_client;
 +      std::vector<GameGlobalShaderConstantSetter *> created_nosky;
 +public:
 +      GameGlobalShaderConstantSetterFactory(bool *force_fog_off,
 +                      f32 *fog_range, Client *client) :
 +              m_sky(NULL),
 +              m_force_fog_off(force_fog_off),
 +              m_fog_range(fog_range),
 +              m_client(client)
 +      {}
 +
 +      void setSky(Sky *sky) {
 +              m_sky = sky;
 +              for (GameGlobalShaderConstantSetter *ggscs : created_nosky) {
 +                      ggscs->setSky(m_sky);
 +              }
 +              created_nosky.clear();
 +      }
 +
 +      virtual IShaderConstantSetter* create()
 +      {
-       bool left_punch;
++              auto *scs = new GameGlobalShaderConstantSetter(
 +                              m_sky, m_force_fog_off, m_fog_range, m_client);
 +              if (!m_sky)
 +                      created_nosky.push_back(scs);
 +              return scs;
 +      }
 +};
 +
 +#ifdef __ANDROID__
 +#define SIZE_TAG "size[11,5.5]"
 +#else
 +#define SIZE_TAG "size[11,5.5,true]" // Fixed size on desktop
 +#endif
 +
 +/****************************************************************************
 + ****************************************************************************/
 +
 +const float object_hit_delay = 0.2;
 +
 +struct FpsControl {
 +      u32 last_time, busy_time, sleep_time;
 +};
 +
 +
 +/* The reason the following structs are not anonymous structs within the
 + * class is that they are not used by the majority of member functions and
 + * many functions that do require objects of thse types do not modify them
 + * (so they can be passed as a const qualified parameter)
 + */
 +
 +struct GameRunData {
 +      u16 dig_index;
 +      u16 new_playeritem;
 +      PointedThing pointed_old;
 +      bool digging;
 +      bool punching;
 +      bool btn_down_for_dig;
 +      bool dig_instantly;
 +      bool digging_blocked;
-       
 +      bool reset_jump_timer;
 +      float nodig_delay_timer;
 +      float dig_time;
 +      float dig_time_complete;
 +      float repeat_place_timer;
 +      float object_hit_delay_timer;
 +      float time_from_last_punch;
 +      ClientActiveObject *selected_object;
 +
 +      float jump_timer;
 +      float damage_flash;
 +      float update_draw_list_timer;
 +
 +      f32 fog_range;
 +
 +      v3f update_draw_list_last_cam_dir;
 +
 +      float time_of_day_smooth;
 +};
 +
 +class Game;
 +
 +struct ClientEventHandler
 +{
 +      void (Game::*handler)(ClientEvent *, CameraOrientation *);
 +};
 +
 +class Game {
 +public:
 +      Game();
 +      ~Game();
 +
 +      bool startup(bool *kill,
 +                      InputHandler *input,
 +                      const GameStartData &game_params,
 +                      std::string &error_message,
 +                      bool *reconnect,
 +                      ChatBackend *chat_backend);
 +
 +
 +      void run();
 +      void shutdown();
 +
 +      void extendedResourceCleanup();
 +
 +      // Basic initialisation
 +      bool init(const std::string &map_dir, const std::string &address,
 +                      u16 port, const SubgameSpec &gamespec);
 +      bool initSound();
 +      bool createSingleplayerServer(const std::string &map_dir,
 +                      const SubgameSpec &gamespec, u16 port);
 +
 +      // Client creation
 +      bool createClient(const GameStartData &start_data);
 +      bool initGui();
 +
 +      // Client connection
 +      bool connectToServer(const GameStartData &start_data,
 +                      bool *connect_ok, bool *aborted);
 +      bool getServerContent(bool *aborted);
 +
 +      // Main loop
 +
 +      void updateInteractTimers(f32 dtime);
 +      bool checkConnection();
 +      bool handleCallbacks();
 +      void processQueues();
 +      void updateProfilers(const RunStats &stats, const FpsControl &draw_times, f32 dtime);
 +      void updateStats(RunStats *stats, const FpsControl &draw_times, f32 dtime);
 +      void updateProfilerGraphs(ProfilerGraph *graph);
 +
 +      // Input related
 +      void processUserInput(f32 dtime);
 +      void processKeyInput();
 +      void processItemSelection(u16 *new_playeritem);
 +
 +      void dropSelectedItem(bool single_item = false);
 +      void openInventory();
 +      void openEnderchest();
 +      void openConsole(float scale, const wchar_t *line=NULL);
 +      void toggleFreeMove();
 +      void toggleFreeMoveAlt();
 +      void togglePitchMove();
 +      void toggleFast();
 +      void toggleNoClip();
 +      void toggleKillaura();
 +      void toggleFreecam();
 +      void toggleScaffold();
 +      void toggleNextItem();
 +      void toggleCinematic();
 +      void toggleAutoforward();
 +
 +      void toggleMinimap(bool shift_pressed);
 +      void toggleFog();
 +      void toggleDebug();
 +      void toggleUpdateCamera();
 +      void updatePlayerCAOVisibility();
 +
 +      void increaseViewRange();
 +      void decreaseViewRange();
 +      void toggleFullViewRange();
 +      void checkZoomEnabled();
 +
 +      void updateCameraDirection(CameraOrientation *cam, float dtime);
 +      void updateCameraOrientation(CameraOrientation *cam, float dtime);
 +      void updatePlayerControl(const CameraOrientation &cam);
 +      void step(f32 *dtime);
 +      void processClientEvents(CameraOrientation *cam);
 +      void updateCamera(u32 busy_time, f32 dtime);
 +      void updateSound(f32 dtime);
 +      void processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug);
 +      /*!
 +       * Returns the object or node the player is pointing at.
 +       * Also updates the selected thing in the Hud.
 +       *
 +       * @param[in]  shootline         the shootline, starting from
 +       * the camera position. This also gives the maximal distance
 +       * of the search.
 +       * @param[in]  liquids_pointable if false, liquids are ignored
 +       * @param[in]  look_for_object   if false, objects are ignored
 +       * @param[in]  camera_offset     offset of the camera
 +       * @param[out] selected_object   the selected object or
 +       * NULL if not found
 +       */
 +      PointedThing updatePointedThing(
 +                      const core::line3d<f32> &shootline, bool liquids_pointable,
 +                      bool look_for_object, const v3s16 &camera_offset);
 +      void handlePointingAtNothing(const ItemStack &playerItem);
 +      void handlePointingAtNode(const PointedThing &pointed,
 +                      const ItemStack &selected_item, const ItemStack &hand_item, f32 dtime);
 +      void handlePointingAtObject(const PointedThing &pointed, const ItemStack &playeritem,
 +                      const v3f &player_position, bool show_debug);
 +      void handleDigging(const PointedThing &pointed, const v3s16 &nodepos,
 +                      const ItemStack &selected_item, const ItemStack &hand_item, f32 dtime);
 +      void updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
 +                      const CameraOrientation &cam);
 +
 +      // Misc
 +      void limitFps(FpsControl *fps_timings, f32 *dtime);
 +
 +      void showOverlayMessage(const char *msg, float dtime, int percent,
 +                      bool draw_clouds = true);
 +
 +      static void freecamChangedCallback(const std::string &setting_name, void *data);
 +      static void settingChangedCallback(const std::string &setting_name, void *data);
 +      static void updateAllMapBlocksCallback(const std::string &setting_name, void *data);
 +      void readSettings();
 +
 +      bool isKeyDown(GameKeyType k);
 +      bool wasKeyDown(GameKeyType k);
 +      bool wasKeyPressed(GameKeyType k);
 +      bool wasKeyReleased(GameKeyType k);
 +
 +#ifdef __ANDROID__
 +      void handleAndroidChatInput();
 +#endif
 +
 +      struct Flags {
 +              bool force_fog_off = false;
 +              bool disable_camera_update = false;
 +      };
 +
 +      void showDeathFormspec();
 +      void showPauseMenu();
 +
 +      // ClientEvent handlers
 +      void handleClientEvent_None(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_PlayerDamage(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_PlayerForceMove(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_Deathscreen(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_ShowFormSpec(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_ShowLocalFormSpec(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_HandleParticleEvent(ClientEvent *event,
 +              CameraOrientation *cam);
 +      void handleClientEvent_HudAdd(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_HudRemove(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_HudChange(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_SetSky(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_SetSun(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_SetMoon(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_SetStars(ClientEvent *event, CameraOrientation *cam);
 +      void handleClientEvent_OverrideDayNigthRatio(ClientEvent *event,
 +              CameraOrientation *cam);
 +      void handleClientEvent_CloudParams(ClientEvent *event, CameraOrientation *cam);
 +
 +      void updateChat(f32 dtime, const v2u32 &screensize);
 +
 +      bool nodePlacement(const ItemDefinition &selected_def, const ItemStack &selected_item,
 +              const v3s16 &nodepos, const v3s16 &neighbourpos, const PointedThing &pointed,
 +              const NodeMetadata *meta);
 +      static const ClientEventHandler clientEventHandler[CLIENTEVENT_MAX];
 +
 +      InputHandler *input = nullptr;
 +
 +      Client *client = nullptr;
 +      Server *server = nullptr;
 +
 +      IWritableTextureSource *texture_src = nullptr;
 +      IWritableShaderSource *shader_src = nullptr;
 +
 +      // When created, these will be filled with data received from the server
 +      IWritableItemDefManager *itemdef_manager = nullptr;
 +      NodeDefManager *nodedef_manager = nullptr;
 +
 +      GameOnDemandSoundFetcher soundfetcher; // useful when testing
 +      ISoundManager *sound = nullptr;
 +      bool sound_is_dummy = false;
 +      SoundMaker *soundmaker = nullptr;
-       
++
 +      ChatBackend *chat_backend = nullptr;
 +      LogOutputBuffer m_chat_log_buf;
++
 +      EventManager *eventmgr = nullptr;
 +      QuicktuneShortcutter *quicktune = nullptr;
 +      bool registration_confirmation_shown = false;
 +
 +      std::unique_ptr<GameUI> m_game_ui;
 +      GUIChatConsole *gui_chat_console = nullptr; // Free using ->Drop()
 +      CheatMenu *m_cheat_menu = nullptr;
 +      MapDrawControl *draw_control = nullptr;
 +      Camera *camera = nullptr;
 +      Clouds *clouds = nullptr;                         // Free using ->Drop()
 +      Sky *sky = nullptr;                         // Free using ->Drop()
 +      Hud *hud = nullptr;
 +      Minimap *mapper = nullptr;
 +
 +      GameRunData runData;
 +      Flags m_flags;
 +
 +      /* 'cache'
 +         This class does take ownership/responsibily for cleaning up etc of any of
 +         these items (e.g. device)
 +      */
 +      IrrlichtDevice *device;
 +      video::IVideoDriver *driver;
 +      scene::ISceneManager *smgr;
 +      bool *kill;
 +      std::string *error_message;
 +      bool *reconnect_requested;
 +      scene::ISceneNode *skybox;
 +
 +      bool simple_singleplayer_mode;
 +      /* End 'cache' */
 +
 +      /* Pre-calculated values
 +       */
 +      int crack_animation_length;
 +
 +      IntervalLimiter profiler_interval;
 +
 +      /*
 +       * TODO: Local caching of settings is not optimal and should at some stage
 +       *       be updated to use a global settings object for getting thse values
 +       *       (as opposed to the this local caching). This can be addressed in
 +       *       a later release.
 +       */
 +      bool m_cache_doubletap_jump;
 +      bool m_cache_enable_clouds;
 +      bool m_cache_enable_joysticks;
 +      bool m_cache_enable_particles;
 +      bool m_cache_enable_fog;
 +      bool m_cache_enable_noclip;
 +      bool m_cache_enable_free_move;
 +      f32  m_cache_mouse_sensitivity;
 +      f32  m_cache_joystick_frustum_sensitivity;
 +      f32  m_repeat_place_time;
 +      f32  m_cache_cam_smoothing;
 +      f32  m_cache_fog_start;
 +
 +      bool m_invert_mouse = false;
 +      bool m_first_loop_after_window_activation = false;
 +      bool m_camera_offset_changed = false;
 +
 +      bool m_does_lost_focus_pause_game = false;
 +
 +      CameraOrientation cam_view_target  = { 0 };
 +      CameraOrientation cam_view  = { 0 };
 +
 +      int m_reset_HW_buffer_counter = 0;
 +#ifdef __ANDROID__
 +      bool m_cache_hold_aux1;
 +      bool m_android_chat_open;
 +#endif
 +};
 +extern Game *g_game;
  
  void the_game(bool *kill,
                InputHandler *input,
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc src/map.cpp
Simple merge
diff --cc src/map.h
Simple merge
Simple merge
diff --cc src/nodedef.cpp
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 4595dc1c1a20dbf6eb47b0a9590e6ebb78bb60a3,6490eb578ba578eb700c99460b1688ecab19dfa3..e2730c6d9a2152d1c68bca50f978f0e1777597c9
@@@ -538,9 -525,6 +527,9 @@@ void ModApiUtil::InitializeClient(lua_S
  
        API_FCT(get_version);
        API_FCT(sha1);
-       
++
 +      LuaSettings::create(L, g_settings, g_settings_path);
 +      lua_setfield(L, top, "settings");
  }
  
  void ModApiUtil::InitializeAsync(lua_State *L, int top)