mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Merge remote-tracking branch 'upstream/master' into Visuals-Vol-2
This commit is contained in:
commit
00ef9b14d0
1043 changed files with 44800 additions and 28934 deletions
|
@ -1,26 +1,11 @@
|
|||
/*
|
||||
Minetest
|
||||
Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
// Luanti
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
// Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||
|
||||
#include "game.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <cmath>
|
||||
#include "IAttributes.h"
|
||||
#include "client/renderingengine.h"
|
||||
#include "camera.h"
|
||||
#include "client.h"
|
||||
|
@ -44,7 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "itemdef.h"
|
||||
#include "log.h"
|
||||
#include "log_internal.h"
|
||||
#include "filesys.h"
|
||||
#include "gameparams.h"
|
||||
#include "gettext.h"
|
||||
#include "gui/guiChatConsole.h"
|
||||
|
@ -55,7 +39,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "gui/guiVolumeChange.h"
|
||||
#include "gui/mainmenumanager.h"
|
||||
#include "gui/profilergraph.h"
|
||||
#include "mapblock.h"
|
||||
#include "minimap.h"
|
||||
#include "nodedef.h" // Needed for determining pointing to nodes
|
||||
#include "nodemetadata.h"
|
||||
|
@ -73,7 +56,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "util/directiontables.h"
|
||||
#include "util/pointedthing.h"
|
||||
#include "util/quicktune_shortcutter.h"
|
||||
#include "irrlicht_changes/static_text.h"
|
||||
#include "irr_ptr.h"
|
||||
#include "version.h"
|
||||
#include "script/scripting_client.h"
|
||||
|
@ -472,8 +454,7 @@ public:
|
|||
|
||||
~GameGlobalShaderConstantSetter()
|
||||
{
|
||||
for (auto &name : SETTING_CALLBACKS)
|
||||
g_settings->deregisterChangedCallback(name, settingsCallback, this);
|
||||
g_settings->deregisterAllChangedCallbacks(this);
|
||||
}
|
||||
|
||||
void onSetConstants(video::IMaterialRendererServices *services) override
|
||||
|
@ -947,7 +928,7 @@ private:
|
|||
SoundMaker *soundmaker = nullptr;
|
||||
|
||||
ChatBackend *chat_backend = nullptr;
|
||||
LogOutputBuffer m_chat_log_buf;
|
||||
CaptureLogOutput m_chat_log_buf;
|
||||
|
||||
EventManager *eventmgr = nullptr;
|
||||
QuicktuneShortcutter *quicktune = nullptr;
|
||||
|
@ -995,6 +976,7 @@ private:
|
|||
* (as opposed to the this local caching). This can be addressed in
|
||||
* a later release.
|
||||
*/
|
||||
bool m_cache_disable_escape_sequences;
|
||||
bool m_cache_doubletap_jump;
|
||||
bool m_cache_enable_clouds;
|
||||
bool m_cache_enable_joysticks;
|
||||
|
@ -1038,6 +1020,10 @@ Game::Game() :
|
|||
m_chat_log_buf(g_logger),
|
||||
m_game_ui(new GameUI())
|
||||
{
|
||||
g_settings->registerChangedCallback("chat_log_level",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->registerChangedCallback("disable_escape_sequences",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->registerChangedCallback("doubletap_jump",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->registerChangedCallback("enable_clouds",
|
||||
|
@ -1106,44 +1092,8 @@ Game::~Game()
|
|||
|
||||
clearTextureNameCache();
|
||||
|
||||
g_settings->deregisterChangedCallback("doubletap_jump",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("enable_clouds",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("enable_joysticks",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("enable_particles",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("enable_fog",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("mouse_sensitivity",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("joystick_frustum_sensitivity",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("repeat_place_time",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("repeat_dig_time",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("noclip",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("free_move",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("fog_start",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("cinematic",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("cinematic_camera_smoothing",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("camera_smoothing",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("invert_mouse",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("enable_hotbar_mouse_wheel",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("invert_hotbar_mouse_wheel",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterChangedCallback("pause_on_lost_focus",
|
||||
&settingChangedCallback, this);
|
||||
g_settings->deregisterAllChangedCallbacks(this);
|
||||
|
||||
if (m_rendering_engine)
|
||||
m_rendering_engine->finalize();
|
||||
}
|
||||
|
@ -1334,15 +1284,13 @@ void Game::shutdown()
|
|||
|
||||
/* cleanup menus */
|
||||
while (g_menumgr.menuCount() > 0) {
|
||||
g_menumgr.m_stack.front()->setVisible(false);
|
||||
g_menumgr.deletingMenu(g_menumgr.m_stack.front());
|
||||
g_menumgr.deleteFront();
|
||||
}
|
||||
|
||||
m_game_ui->deleteFormspec();
|
||||
|
||||
chat_backend->addMessage(L"", L"# Disconnected.");
|
||||
chat_backend->addMessage(L"", L"");
|
||||
m_chat_log_buf.clear();
|
||||
|
||||
if (client) {
|
||||
client->Stop();
|
||||
|
@ -1633,6 +1581,9 @@ bool Game::createClient(const GameStartData &start_data)
|
|||
|
||||
bool Game::shouldShowTouchControls()
|
||||
{
|
||||
if (!device->supportsTouchEvents())
|
||||
return false;
|
||||
|
||||
const std::string &touch_controls = g_settings->get("touch_controls");
|
||||
if (touch_controls == "auto")
|
||||
return RenderingEngine::getLastPointerType() == PointerType::Touch;
|
||||
|
@ -2910,7 +2861,7 @@ static void pauseNodeAnimation(PausedNodesList &paused, scene::ISceneNode *node)
|
|||
float speed = animated_node->getAnimationSpeed();
|
||||
if (!speed)
|
||||
return;
|
||||
paused.push_back({grab(animated_node), speed});
|
||||
paused.emplace_back(grab(animated_node), speed);
|
||||
animated_node->setAnimationSpeed(0.0f);
|
||||
}
|
||||
|
||||
|
@ -3273,9 +3224,27 @@ void Game::processClientEvents(CameraOrientation *cam)
|
|||
|
||||
void Game::updateChat(f32 dtime)
|
||||
{
|
||||
auto color_for = [](LogLevel level) -> const char* {
|
||||
switch (level) {
|
||||
case LL_ERROR : return "\x1b(c@#F00)"; // red
|
||||
case LL_WARNING: return "\x1b(c@#EE0)"; // yellow
|
||||
case LL_INFO : return "\x1b(c@#BBB)"; // grey
|
||||
case LL_VERBOSE: return "\x1b(c@#888)"; // dark grey
|
||||
case LL_TRACE : return "\x1b(c@#888)"; // dark grey
|
||||
default : return "";
|
||||
}
|
||||
};
|
||||
|
||||
// Get new messages from error log buffer
|
||||
while (!m_chat_log_buf.empty())
|
||||
chat_backend->addMessage(L"", utf8_to_wide(m_chat_log_buf.get()));
|
||||
std::vector<LogEntry> entries = m_chat_log_buf.take();
|
||||
for (const auto& entry : entries) {
|
||||
std::string line;
|
||||
if (!m_cache_disable_escape_sequences) {
|
||||
line.append(color_for(entry.level));
|
||||
}
|
||||
line.append(entry.combined);
|
||||
chat_backend->addMessage(L"", utf8_to_wide(line));
|
||||
}
|
||||
|
||||
// Get new messages from client
|
||||
std::wstring message;
|
||||
|
@ -3584,7 +3553,7 @@ PointedThing Game::updatePointedThing(
|
|||
if (show_entity_selectionbox && runData.selected_object->doShowSelectionBox() &&
|
||||
runData.selected_object->getSelectionBox(&selection_box)) {
|
||||
v3f pos = runData.selected_object->getPosition();
|
||||
selectionboxes->push_back(aabb3f(selection_box));
|
||||
selectionboxes->push_back(selection_box);
|
||||
hud->setSelectionPos(pos, camera_offset);
|
||||
GenericCAO* gcao = dynamic_cast<GenericCAO*>(runData.selected_object);
|
||||
if (gcao != nullptr && gcao->getProperties().rotate_selectionbox)
|
||||
|
@ -4498,6 +4467,14 @@ void Game::settingChangedCallback(const std::string &setting_name, void *data)
|
|||
|
||||
void Game::readSettings()
|
||||
{
|
||||
LogLevel chat_log_level = Logger::stringToLevel(g_settings->get("chat_log_level"));
|
||||
if (chat_log_level == LL_MAX) {
|
||||
warningstream << "Supplied unrecognized chat_log_level; showing none." << std::endl;
|
||||
chat_log_level = LL_NONE;
|
||||
}
|
||||
m_chat_log_buf.setLogLevel(chat_log_level);
|
||||
|
||||
m_cache_disable_escape_sequences = g_settings->getBool("disable_escape_sequences");
|
||||
m_cache_doubletap_jump = g_settings->getBool("doubletap_jump");
|
||||
m_cache_enable_clouds = g_settings->getBool("enable_clouds");
|
||||
m_cache_enable_joysticks = g_settings->getBool("enable_joysticks");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue