forked from Mirrorlandia_minetest/minetest
add_stuff
This commit is contained in:
parent
ff473180db
commit
a3c1115277
@ -83,6 +83,22 @@
|
|||||||
# modified by the "average user" should be in (sub-)categories called "Advanced".
|
# modified by the "average user" should be in (sub-)categories called "Advanced".
|
||||||
|
|
||||||
|
|
||||||
|
[Enhancements]
|
||||||
|
[*Rendering]
|
||||||
|
# Enable minimap everywhere
|
||||||
|
# Disable if you think this is cheating
|
||||||
|
force_minimap (Force minimap) bool false
|
||||||
|
|
||||||
|
# Enable full brightness for great visibility in the dark
|
||||||
|
# Disable if you think this is cheating
|
||||||
|
full_brightness (Full brightness) bool false
|
||||||
|
|
||||||
|
[*Scripting]
|
||||||
|
# Enable client-side mods without restrictions
|
||||||
|
# Disable if you think this is cheating
|
||||||
|
force_csm (Force client-side mods) bool false
|
||||||
|
|
||||||
|
|
||||||
[Controls]
|
[Controls]
|
||||||
|
|
||||||
[*General]
|
[*General]
|
||||||
@ -256,9 +272,6 @@ connected_glass (Connect glass) bool false
|
|||||||
# Disable for speed or for different looks.
|
# Disable for speed or for different looks.
|
||||||
smooth_lighting (Smooth lighting) bool true
|
smooth_lighting (Smooth lighting) bool true
|
||||||
|
|
||||||
# Enable full brightness for great visibility in the dark
|
|
||||||
# Disable if you think this is cheating
|
|
||||||
full_brightness (Full brightness) bool false
|
|
||||||
|
|
||||||
# Enables tradeoffs that reduce CPU load or increase rendering performance
|
# Enables tradeoffs that reduce CPU load or increase rendering performance
|
||||||
# at the expense of minor visual glitches that do not impact game playability.
|
# at the expense of minor visual glitches that do not impact game playability.
|
||||||
|
@ -12,6 +12,28 @@
|
|||||||
# Further documentation:
|
# Further documentation:
|
||||||
# https://wiki.minetest.net/
|
# https://wiki.minetest.net/
|
||||||
|
|
||||||
|
#
|
||||||
|
# Enhancements
|
||||||
|
#
|
||||||
|
|
||||||
|
## Rendering
|
||||||
|
|
||||||
|
# Enable full brightness for great visibility in the dark
|
||||||
|
# Disable if you think this is cheating
|
||||||
|
# type: bool
|
||||||
|
# full_brightness (Full brightness) bool false
|
||||||
|
|
||||||
|
# Enable minimap everywhere
|
||||||
|
# Disable if you think this is cheating
|
||||||
|
# type: bool
|
||||||
|
# force_minimap (Force minimap) bool false
|
||||||
|
|
||||||
|
## Scripting
|
||||||
|
# Enable client-side mods without restrictions
|
||||||
|
# Disable if you think this is cheating
|
||||||
|
#force_csm (Force client-side mods) bool false
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Controls
|
# Controls
|
||||||
#
|
#
|
||||||
@ -187,11 +209,6 @@
|
|||||||
# type: bool
|
# type: bool
|
||||||
# smooth_lighting = true
|
# smooth_lighting = true
|
||||||
|
|
||||||
# Enable full brightness for great visibility in the dark
|
|
||||||
# Disable if you think this is cheating
|
|
||||||
# type: bool
|
|
||||||
full_brightness (Full brightness) bool false
|
|
||||||
|
|
||||||
# Enables tradeoffs that reduce CPU load or increase rendering performance
|
# Enables tradeoffs that reduce CPU load or increase rendering performance
|
||||||
# at the expense of minor visual glitches that do not impact game playability.
|
# at the expense of minor visual glitches that do not impact game playability.
|
||||||
# type: bool
|
# type: bool
|
||||||
|
@ -2404,22 +2404,22 @@ void Game::toggleMinimap(bool shift_pressed)
|
|||||||
m_game_ui->m_flags.show_minimap = false;
|
m_game_ui->m_flags.show_minimap = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// If radar is disabled, try to find a non radar mode or fall back to 0
|
// If radar is disabled, try to find a non radar mode or fall back to 0
|
||||||
if (!(hud_flags & HUD_FLAG_MINIMAP_RADAR_VISIBLE))
|
if (!(hud_flags & HUD_FLAG_MINIMAP_RADAR_VISIBLE))
|
||||||
while (mapper->getModeIndex() &&
|
while (mapper->getModeIndex() &&
|
||||||
mapper->getModeDef().type == MINIMAP_TYPE_RADAR)
|
mapper->getModeDef().type == MINIMAP_TYPE_RADAR)
|
||||||
mapper->nextMode();
|
mapper->nextMode();
|
||||||
|
|
||||||
m_game_ui->m_flags.show_minimap = mapper->getModeDef().type !=
|
m_game_ui->m_flags.show_minimap = mapper->getModeDef().type != MINIMAP_TYPE_OFF;
|
||||||
MINIMAP_TYPE_OFF;
|
// <--
|
||||||
|
// End of 'not so satifying code'
|
||||||
|
if ((hud_flags & HUD_FLAG_MINIMAP_VISIBLE) ||
|
||||||
|
(hud && hud->hasElementOfType(HUD_ELEM_MINIMAP)))
|
||||||
|
m_game_ui->showStatusText(utf8_to_wide(mapper->getModeDef().label));
|
||||||
|
else
|
||||||
|
m_game_ui->showTranslatedStatusText(
|
||||||
|
"Minimap currently disabled by game or mod");
|
||||||
}
|
}
|
||||||
// <--
|
|
||||||
// End of 'not so satifying code'
|
|
||||||
if ((hud_flags & HUD_FLAG_MINIMAP_VISIBLE) ||
|
|
||||||
(hud && hud->hasElementOfType(HUD_ELEM_MINIMAP)))
|
|
||||||
m_game_ui->showStatusText(utf8_to_wide(mapper->getModeDef().label));
|
|
||||||
else
|
|
||||||
m_game_ui->showTranslatedStatusText("Minimap currently disabled by game or mod");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::toggleFog()
|
void Game::toggleFog()
|
||||||
|
@ -198,6 +198,8 @@ void set_default_settings()
|
|||||||
settings->setDefault("connected_glass", "false");
|
settings->setDefault("connected_glass", "false");
|
||||||
settings->setDefault("smooth_lighting", "true");
|
settings->setDefault("smooth_lighting", "true");
|
||||||
settings->setDefault("full_brightness", "false");
|
settings->setDefault("full_brightness", "false");
|
||||||
|
settings->setDefault("force_minimap", "false");
|
||||||
|
settings->setDefault("force_csm", "false");
|
||||||
settings->setDefault("performance_tradeoffs", "false");
|
settings->setDefault("performance_tradeoffs", "false");
|
||||||
settings->setDefault("lighting_alpha", "0.0");
|
settings->setDefault("lighting_alpha", "0.0");
|
||||||
settings->setDefault("lighting_beta", "1.5");
|
settings->setDefault("lighting_beta", "1.5");
|
||||||
|
@ -3,19 +3,19 @@ Minetest
|
|||||||
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
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
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Lesser General Public License for more details.
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License along
|
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.,
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "light.h"
|
#include "light.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#ifndef SERVER
|
#ifndef SERVER
|
||||||
|
|
||||||
static u8 light_LUT[LIGHT_SUN + 1];
|
static u8 light_LUT[LIGHT_SUN + 1];
|
||||||
|
|
||||||
// The const ref to light_LUT is what is actually used in the code
|
// The const ref to light_LUT is what is actually used in the code
|
||||||
const u8 *light_decode_table = light_LUT;
|
const u8 *light_decode_table = light_LUT;
|
||||||
@ -43,15 +43,12 @@ static LightingParams params;
|
|||||||
|
|
||||||
float decode_light_f(float x)
|
float decode_light_f(float x)
|
||||||
{
|
{
|
||||||
if (params.full_brightness){
|
|
||||||
return 1.0f;
|
|
||||||
}
|
|
||||||
if (x >= 1.0f) // x is often 1.0f
|
if (x >= 1.0f) // x is often 1.0f
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
x = std::fmax(x, 0.0f);
|
x = std::fmax(x, 0.0f);
|
||||||
float brightness = ((params.a * x + params.b) * x + params.c) * x;
|
float brightness = ((params.a * x + params.b) * x + params.c) * x;
|
||||||
brightness += params.boost *
|
brightness += params.boost *
|
||||||
std::exp(-0.5f * sqr((x - params.center) / params.sigma));
|
std::exp(-0.5f * sqr((x - params.center) / params.sigma));
|
||||||
if (brightness <= 0.0f) // May happen if parameters are extreme
|
if (brightness <= 0.0f) // May happen if parameters are extreme
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
if (brightness >= 1.0f)
|
if (brightness >= 1.0f)
|
||||||
@ -63,23 +60,28 @@ float decode_light_f(float x)
|
|||||||
// Initialize or update the light value tables using the specified gamma
|
// Initialize or update the light value tables using the specified gamma
|
||||||
void set_light_table(float gamma)
|
void set_light_table(float gamma)
|
||||||
{
|
{
|
||||||
// Lighting curve bounding gradients
|
const bool full_brightness = g_settings->getBool("full_brightness");
|
||||||
|
if (full_brightness) {
|
||||||
|
for (size_t i = 0; i <= LIGHT_SUN; i++) {
|
||||||
|
light_LUT[i] = 255;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Lighting curve bounding gradients
|
||||||
const float alpha = rangelim(g_settings->getFloat("lighting_alpha"), 0.0f, 3.0f);
|
const float alpha = rangelim(g_settings->getFloat("lighting_alpha"), 0.0f, 3.0f);
|
||||||
const float beta = rangelim(g_settings->getFloat("lighting_beta"), 0.0f, 3.0f);
|
const float beta = rangelim(g_settings->getFloat("lighting_beta"), 0.0f, 3.0f);
|
||||||
const bool full_brightness = g_settings->getBool("full_brightness");
|
// Lighting curve polynomial coefficients
|
||||||
params.full_brightness = full_brightness;
|
|
||||||
// Lighting curve polynomial coefficients
|
|
||||||
params.a = alpha + beta - 2.0f;
|
params.a = alpha + beta - 2.0f;
|
||||||
params.b = 3.0f - 2.0f * alpha - beta;
|
params.b = 3.0f - 2.0f * alpha - beta;
|
||||||
params.c = alpha;
|
params.c = alpha;
|
||||||
// Lighting curve parametric boost
|
// Lighting curve parametric boost
|
||||||
params.boost = rangelim(g_settings->getFloat("lighting_boost"), 0.0f, 0.4f);
|
params.boost = rangelim(g_settings->getFloat("lighting_boost"), 0.0f, 0.4f);
|
||||||
params.center = rangelim(g_settings->getFloat("lighting_boost_center"), 0.0f, 1.0f);
|
params.center = rangelim(g_settings->getFloat("lighting_boost_center"), 0.0f, 1.0f);
|
||||||
params.sigma = rangelim(g_settings->getFloat("lighting_boost_spread"), 0.0f, 0.4f);
|
params.sigma = rangelim(g_settings->getFloat("lighting_boost_spread"), 0.0f, 0.4f);
|
||||||
// Lighting curve gamma correction
|
// Lighting curve gamma correction
|
||||||
params.gamma = rangelim(gamma, 0.33f, 3.0f);
|
params.gamma = rangelim(gamma, 0.33f, 3.0f);
|
||||||
|
|
||||||
// Boundary values should be fixed
|
// Boundary values should be fixed
|
||||||
light_LUT[0] = 0;
|
light_LUT[0] = 0;
|
||||||
light_LUT[LIGHT_SUN] = 255;
|
light_LUT[LIGHT_SUN] = 255;
|
||||||
|
|
||||||
@ -96,4 +98,4 @@ void set_light_table(float gamma)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1270,24 +1270,31 @@ void Client::handleCommand_HudSetFlags(NetworkPacket* pkt)
|
|||||||
player->hud_flags &= ~mask;
|
player->hud_flags &= ~mask;
|
||||||
player->hud_flags |= flags;
|
player->hud_flags |= flags;
|
||||||
|
|
||||||
m_minimap_disabled_by_server = !(player->hud_flags & HUD_FLAG_MINIMAP_VISIBLE);
|
const bool force_minimap = g_settings->getBool("force_minimap");
|
||||||
bool m_minimap_radar_disabled_by_server = !(player->hud_flags & HUD_FLAG_MINIMAP_RADAR_VISIBLE);
|
if (force_minimap){
|
||||||
|
player->hud_flags = player->hud_flags | HUD_FLAG_MINIMAP_VISIBLE | HUD_FLAG_MINIMAP_RADAR_VISIBLE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_minimap_disabled_by_server = !(player->hud_flags & HUD_FLAG_MINIMAP_VISIBLE);
|
||||||
|
bool m_minimap_radar_disabled_by_server =
|
||||||
|
!(player->hud_flags & HUD_FLAG_MINIMAP_RADAR_VISIBLE);
|
||||||
|
|
||||||
// Not so satisying code to keep compatibility with old fixed mode system
|
// Not so satisying code to keep compatibility with old fixed mode system
|
||||||
// -->
|
// -->
|
||||||
|
|
||||||
// Hide minimap if it has been disabled by the server
|
// Hide minimap if it has been disabled by the server
|
||||||
if (m_minimap && m_minimap_disabled_by_server && was_minimap_visible)
|
if (m_minimap && m_minimap_disabled_by_server && was_minimap_visible)
|
||||||
// defers a minimap update, therefore only call it if really
|
// defers a minimap update, therefore only call it if really
|
||||||
// needed, by checking that minimap was visible before
|
// needed, by checking that minimap was visible before
|
||||||
m_minimap->setModeIndex(0);
|
m_minimap->setModeIndex(0);
|
||||||
|
|
||||||
// If radar has been disabled, try to find a non radar mode or fall back to 0
|
// If radar has been disabled, try to find a non radar mode or fall back to 0
|
||||||
if (m_minimap && m_minimap_radar_disabled_by_server
|
if (m_minimap && m_minimap_radar_disabled_by_server &&
|
||||||
&& was_minimap_radar_visible) {
|
was_minimap_radar_visible) {
|
||||||
while (m_minimap->getModeIndex() > 0 &&
|
while (m_minimap->getModeIndex() > 0 &&
|
||||||
m_minimap->getModeDef().type == MINIMAP_TYPE_RADAR)
|
m_minimap->getModeDef().type == MINIMAP_TYPE_RADAR)
|
||||||
m_minimap->nextMode();
|
m_minimap->nextMode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// <--
|
// <--
|
||||||
// End of 'not so satifying code'
|
// End of 'not so satifying code'
|
||||||
@ -1591,8 +1598,14 @@ void Client::handleCommand_FormspecPrepend(NetworkPacket *pkt)
|
|||||||
|
|
||||||
void Client::handleCommand_CSMRestrictionFlags(NetworkPacket *pkt)
|
void Client::handleCommand_CSMRestrictionFlags(NetworkPacket *pkt)
|
||||||
{
|
{
|
||||||
*pkt >> m_csm_restriction_flags >> m_csm_restriction_noderange;
|
const bool force_csm = g_settings->getBool("force_csm");
|
||||||
|
if(force_csm) {
|
||||||
|
m_csm_restriction_flags = 0;
|
||||||
|
m_csm_restriction_noderange = 4294967295;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*pkt >> m_csm_restriction_flags >> m_csm_restriction_noderange;
|
||||||
|
}
|
||||||
// Restrictions were received -> load mods if it's enabled
|
// Restrictions were received -> load mods if it's enabled
|
||||||
// Note: this should be moved after mods receptions from server instead
|
// Note: this should be moved after mods receptions from server instead
|
||||||
loadMods();
|
loadMods();
|
||||||
|
Loading…
Reference in New Issue
Block a user