aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/client.cpp22
-rw-r--r--src/client/client.h8
-rw-r--r--src/client/clientlauncher.cpp1
-rw-r--r--src/client/clientmap.cpp24
-rw-r--r--src/client/clientmap.h6
-rw-r--r--src/client/game.cpp44
-rw-r--r--src/client/localplayer.cpp23
-rw-r--r--src/client/localplayer.h1
8 files changed, 44 insertions, 85 deletions
diff --git a/src/client/client.cpp b/src/client/client.cpp
index 5e31387ab..7337229fb 100644
--- a/src/client/client.cpp
+++ b/src/client/client.cpp
@@ -101,7 +101,8 @@ Client::Client(
MtEventManager *event,
RenderingEngine *rendering_engine,
bool ipv6,
- GameUI *game_ui
+ GameUI *game_ui,
+ ELoginRegister allow_login_or_register
):
m_mesh_update_thread(this),
m_tsrc(tsrc),
@@ -125,7 +126,8 @@ Client::Client(
m_media_downloader(new ClientMediaDownloader()),
m_state(LC_Created),
m_game_ui(game_ui),
- m_modchannel_mgr(new ModChannelMgr())
+ m_modchannel_mgr(new ModChannelMgr()),
+ m_allow_login_or_register(allow_login_or_register)
{
// Add local player
m_env.setLocalPlayer(new LocalPlayer(this, playername));
@@ -399,10 +401,6 @@ void Client::step(float dtime)
initial_step = false;
}
else if(m_state == LC_Created) {
- if (m_is_registration_confirmation_state) {
- // Waiting confirmation
- return;
- }
float &counter = m_connection_reinit_timer;
counter -= dtime;
if(counter <= 0.0) {
@@ -1081,18 +1079,6 @@ void Client::sendInit(const std::string &playerName)
Send(&pkt);
}
-void Client::promptConfirmRegistration(AuthMechanism chosen_auth_mechanism)
-{
- m_chosen_auth_mech = chosen_auth_mechanism;
- m_is_registration_confirmation_state = true;
-}
-
-void Client::confirmRegistration()
-{
- m_is_registration_confirmation_state = false;
- startAuth(m_chosen_auth_mech);
-}
-
void Client::startAuth(AuthMechanism chosen_auth_mechanism)
{
m_chosen_auth_mech = chosen_auth_mechanism;
diff --git a/src/client/client.h b/src/client/client.h
index d49f2f9ad..c1b8cfbaa 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mesh_generator_thread.h"
#include "network/address.h"
#include "network/peerhandler.h"
+#include "gameparams.h"
#include <fstream>
#define CLIENT_CHAT_MESSAGE_LIMIT_PER_10S 10.0f
@@ -126,7 +127,8 @@ public:
MtEventManager *event,
RenderingEngine *rendering_engine,
bool ipv6,
- GameUI *game_ui
+ GameUI *game_ui,
+ ELoginRegister allow_login_or_register
);
~Client();
@@ -348,8 +350,7 @@ public:
u16 getProtoVersion()
{ return m_proto_ver; }
- void confirmRegistration();
- bool m_is_registration_confirmation_state = false;
+ ELoginRegister m_allow_login_or_register = ELoginRegister::Any;
bool m_simple_singleplayer_mode;
float mediaReceiveProgress();
@@ -467,7 +468,6 @@ private:
static AuthMechanism choseAuthMech(const u32 mechs);
void sendInit(const std::string &playerName);
- void promptConfirmRegistration(AuthMechanism chosen_auth_mechanism);
void startAuth(AuthMechanism chosen_auth_mechanism);
void sendDeletedBlocks(std::vector<v3s16> &blocks);
void sendGotBlocks(const std::vector<v3s16> &blocks);
diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp
index 54c561d11..60c9525f3 100644
--- a/src/client/clientlauncher.cpp
+++ b/src/client/clientlauncher.cpp
@@ -451,6 +451,7 @@ bool ClientLauncher::launch_game(std::string &error_message,
start_data.name = menudata.name;
start_data.password = menudata.password;
start_data.address = std::move(menudata.address);
+ start_data.allow_login_or_register = menudata.allow_login_or_register;
server_name = menudata.servername;
server_description = menudata.serverdescription;
diff --git a/src/client/clientmap.cpp b/src/client/clientmap.cpp
index 85b765709..3a89b8803 100644
--- a/src/client/clientmap.cpp
+++ b/src/client/clientmap.cpp
@@ -219,13 +219,11 @@ void ClientMap::updateDrawList()
// Number of blocks occlusion culled
u32 blocks_occlusion_culled = 0;
- // No occlusion culling when free_move is on and camera is
- // inside ground
+ // No occlusion culling when free_move is on and camera is inside ground
bool occlusion_culling_enabled = true;
- if ((g_settings->getBool("free_move") && g_settings->getBool("noclip")) || g_settings->getBool("freecam")) {
+ if (m_control.allow_noclip || g_settings->getBool("freecam")) {
MapNode n = getNode(cam_pos_nodes);
- if (n.getContent() == CONTENT_IGNORE ||
- m_nodedef->get(n).solidness == 2)
+ if (n.getContent() == CONTENT_IGNORE || m_nodedef->get(n).solidness == 2)
occlusion_culling_enabled = false;
}
@@ -678,19 +676,17 @@ void ClientMap::renderPostFx(CameraMode cam_mode)
MapNode n = getNode(floatToInt(m_camera_position, BS));
- // - If the player is in a solid node, make everything black.
- // - If the player is in liquid, draw a semi-transparent overlay.
- // - Do not if player is in third person mode
const ContentFeatures& features = m_nodedef->get(n);
video::SColor post_effect_color = features.post_effect_color;
- if(features.solidness == 2 && !((g_settings->getBool("noclip") || g_settings->getBool("freecam")) &&
- (m_client->checkLocalPrivilege("noclip") || g_settings->getBool("freecam"))) &&
- cam_mode == CAMERA_MODE_FIRST)
- {
+
+ // If the camera is in a solid node, make everything black.
+ // (first person mode only)
+ if (features.solidness == 2 && cam_mode == CAMERA_MODE_FIRST &&
+ !(m_control.allow_noclip || g_settings->getBool("freecam"))) {
post_effect_color = video::SColor(255, 0, 0, 0);
}
- if (post_effect_color.getAlpha() != 0)
- {
+
+ if (post_effect_color.getAlpha() != 0) {
// Draw a full-screen rectangle
video::IVideoDriver* driver = SceneManager->getVideoDriver();
v2u32 ss = driver->getScreenSize();
diff --git a/src/client/clientmap.h b/src/client/clientmap.h
index 823870c68..8c45b5382 100644
--- a/src/client/clientmap.h
+++ b/src/client/clientmap.h
@@ -27,10 +27,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
struct MapDrawControl
{
- // Overrides limits by drawing everything
- bool range_all = false;
// Wanted drawing range
float wanted_range = 0.0f;
+ // Overrides limits by drawing everything
+ bool range_all = false;
+ // Allow rendering out of bounds
+ bool allow_noclip = false;
// show a wire frame for debugging
bool show_wireframe = false;
};
diff --git a/src/client/game.cpp b/src/client/game.cpp
index e439d0e32..888191f4a 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -43,7 +43,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gameparams.h"
#include "gettext.h"
#include "gui/guiChatConsole.h"
-#include "gui/guiConfirmRegistration.h"
#include "gui/guiFormSpecMenu.h"
#include "gui/guiKeyChangeMenu.h"
#include "gui/guiPasswordChange.h"
@@ -675,7 +674,8 @@ bool Game::connectToServer(const GameStartData &start_data,
start_data.password, start_data.address,
*draw_control, texture_src, shader_src,
itemdef_manager, nodedef_manager, sound, eventmgr,
- m_rendering_engine, connect_address.isIPv6(), m_game_ui.get());
+ m_rendering_engine, connect_address.isIPv6(), m_game_ui.get(),
+ start_data.allow_login_or_register);
client->migrateModStorage();
} catch (const BaseException &e) {
*error_message = fmtgettext("Error creating client: %s", e.what());
@@ -738,28 +738,16 @@ bool Game::connectToServer(const GameStartData &start_data,
break;
}
- if (client->m_is_registration_confirmation_state) {
- if (registration_confirmation_shown) {
- // Keep drawing the GUI
- m_rendering_engine->draw_menu_scene(guienv, dtime, true);
- } else {
- registration_confirmation_shown = true;
- (new GUIConfirmRegistration(guienv, guienv->getRootGUIElement(), -1,
- &g_menumgr, client, start_data.name, start_data.password,
- connection_aborted, texture_src))->drop();
- }
- } else {
- wait_time += dtime;
- // Only time out if we aren't waiting for the server we started
- if (!start_data.address.empty() && wait_time > 10) {
- *error_message = gettext("Connection timed out.");
- errorstream << *error_message << std::endl;
- break;
- }
-
- // Update status
- showOverlayMessage(N_("Connecting to server..."), dtime, 20);
+ wait_time += dtime;
+ // Only time out if we aren't waiting for the server we started
+ if (!start_data.address.empty() && wait_time > 10) {
+ *error_message = gettext("Connection timed out.");
+ errorstream << *error_message << std::endl;
+ break;
}
+
+ // Update status
+ showOverlayMessage(N_("Connecting to server..."), dtime, 20);
}
} catch (con::PeerNotFoundException &e) {
// TODO: Should something be done here? At least an info/error
@@ -938,6 +926,8 @@ void Game::processQueues()
void Game::updateDebugState()
{
LocalPlayer *player = client->getEnv().getLocalPlayer();
+
+ // debug UI and wireframe
bool has_debug = client->checkPrivilege("debug");
bool has_basic_debug = has_debug || (player->hud_flags & HUD_FLAG_BASIC_DEBUG);
@@ -952,6 +942,9 @@ void Game::updateDebugState()
hud->disableBlockBounds();
if (!has_debug)
draw_control->show_wireframe = false;
+
+ // noclip
+ draw_control->allow_noclip = m_cache_enable_noclip && client->checkPrivilege("noclip");
}
void Game::updateProfilers(const RunStats &stats, const FpsControl &draw_times,
@@ -3047,7 +3040,10 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
float direct_brightness;
bool sunlight_seen;
- if ((m_cache_enable_noclip && m_cache_enable_free_move) || g_settings->getBool("freecam")) {
+ // When in noclip mode force same sky brightness as above ground so you
+ // can see properly
+ if ((draw_control->allow_noclip && m_cache_enable_free_move &&
+ client->checkPrivilege("fly")) || g_settings->getBool("freecam")) {
direct_brightness = time_brightness;
sunlight_seen = true;
} else {
diff --git a/src/client/localplayer.cpp b/src/client/localplayer.cpp
index c4d9b9845..aeccc5c7d 100644
--- a/src/client/localplayer.cpp
+++ b/src/client/localplayer.cpp
@@ -450,16 +450,6 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
camera_impact = getSpeed().Y * -1;
}
- {
- camera_barely_in_ceiling = false;
- v3s16 camera_np = floatToInt(getEyePosition(), BS);
- MapNode n = map->getNode(camera_np);
- if (n.getContent() != CONTENT_IGNORE) {
- if (nodemgr->get(n).walkable && nodemgr->get(n).solidness == 2)
- camera_barely_in_ceiling = true;
- }
- }
-
/*
Check properties of the node on which the player is standing
*/
@@ -730,8 +720,7 @@ v3f LocalPlayer::getSendSpeed()
v3f LocalPlayer::getEyeOffset() const
{
- float eye_height = camera_barely_in_ceiling ? m_eye_height - 0.125f : m_eye_height;
- return v3f(0.0f, BS * eye_height, 0.0f);
+ return v3f(0.0f, BS * m_eye_height, 0.0f);
}
ClientActiveObject *LocalPlayer::getParent() const
@@ -1071,16 +1060,6 @@ void LocalPlayer::old_move(f32 dtime, Environment *env, f32 pos_max_d,
camera_impact = getSpeed().Y * -1.0f;
}
- {
- camera_barely_in_ceiling = false;
- v3s16 camera_np = floatToInt(getEyePosition(), BS);
- MapNode n = map->getNode(camera_np);
- if (n.getContent() != CONTENT_IGNORE) {
- if (nodemgr->get(n).walkable && nodemgr->get(n).solidness == 2)
- camera_barely_in_ceiling = true;
- }
- }
-
/*
Update the node last under the player
*/
diff --git a/src/client/localplayer.h b/src/client/localplayer.h
index ebc67c4f8..271589c59 100644
--- a/src/client/localplayer.h
+++ b/src/client/localplayer.h
@@ -237,7 +237,6 @@ private:
u16 m_breath = PLAYER_MAX_BREATH_DEFAULT;
f32 m_yaw = 0.0f;
f32 m_pitch = 0.0f;
- bool camera_barely_in_ceiling = false;
aabb3f m_collisionbox = aabb3f(-BS * 0.30f, 0.0f, -BS * 0.30f, BS * 0.30f,
BS * 1.75f, BS * 0.30f);
float m_eye_height = 1.625f;