Merge MultiCraft Legacy changes
This commit is contained in:
parent
b1fa8f8e2b
commit
0534d696f7
@ -1,14 +1,14 @@
|
||||
MultiCraft Open Source
|
||||
======================
|
||||
|
||||
![Build Status](https://github.com/MultiCraft/MultiCraft5.3/workflows/build/badge.svg)
|
||||
![Build Status](https://github.com/MultiCraft/MultiCraft2/workflows/build/badge.svg)
|
||||
[![License](https://img.shields.io/badge/license-LGPLv3.0%2B-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0.en.html)
|
||||
|
||||
MultiCraft Open Source is a free open-source voxel game engine with easy modding and game creation.
|
||||
|
||||
MultiCraft is based on the Minetest project, which is developed by a [number of contributors](https://github.com/minetest/minetest/graphs/contributors).
|
||||
|
||||
Copyright © 2014-2020 Maksim Gamarnik [MoNTE48] <MoNTE48@mail.ua> & MultiCraft Development Team.
|
||||
Copyright © 2014-2021 Maksim Gamarnik [MoNTE48] <MoNTE48@mail.ua> & MultiCraft Development Team.
|
||||
|
||||
Table of Contents
|
||||
------------------
|
||||
|
0
build/macOS/Podfile
Executable file → Normal file
0
build/macOS/Podfile
Executable file → Normal file
@ -390,7 +390,11 @@ core.register_entity(":__builtin:falling_node", {
|
||||
-- Drop node if does not fall within 5 seconds
|
||||
self.timer = self.timer + dtime
|
||||
if self.timer > 5 then
|
||||
core.add_item(pos, self.node)
|
||||
-- Add dropped items
|
||||
local drops = core.get_node_drops(self.node, "")
|
||||
for _, dropped_item in pairs(drops) do
|
||||
core.add_item(pos, dropped_item)
|
||||
end
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
|
@ -633,6 +633,11 @@ end
|
||||
function core.item_eat(hp_change, replace_with_item, poison)
|
||||
return function(itemstack, user, pointed_thing) -- closure
|
||||
if user then
|
||||
if user:is_player() and pointed_thing.type == "object" then
|
||||
pointed_thing.ref:right_click(user)
|
||||
return user:get_wielded_item()
|
||||
end
|
||||
|
||||
return core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing, poison)
|
||||
end
|
||||
end
|
||||
|
@ -31,6 +31,10 @@ end
|
||||
|
||||
-- returns error message, or nil
|
||||
local function parse_setting_line(settings, line, read_all, base_level, allow_secure)
|
||||
|
||||
-- strip carriage returns (CR, /r)
|
||||
line = line:gsub("\r", "")
|
||||
|
||||
-- comment
|
||||
local comment = line:match("^#" .. CHAR_CLASSES.SPACE .. "*(.*)$")
|
||||
if comment then
|
||||
|
@ -22,9 +22,10 @@ local multicraft_developers = {
|
||||
"Bektur Mambetov (ubulem) <berkut87@gmail.com>",
|
||||
"Alexander Zavrin (Ransom.00)",
|
||||
"luk3yx",
|
||||
"An0n3m0us",
|
||||
"Jean-Patrick Guerrero (kilbith) <jeanpatrick.guerrero@gmail.com>",
|
||||
"Nathan Salapat (NathanS21) <nathan@nathansalapat.com>",
|
||||
"Vitaliy Lobachevskiy (numberZero) <numzer0@yandex.ru>",
|
||||
"Jean-Patrick Guerrero (kilbith) <jeanpatrick.guerrero@gmail.com>",
|
||||
"An0n3m0us",
|
||||
"sfan5 <sfan5@live.de>",
|
||||
"Stuart Jones (stujones11) <stujones111@gmail.com>",
|
||||
"And other people who helped make the world better!"
|
||||
|
@ -1898,6 +1898,11 @@ void Game::processKeyInput()
|
||||
showPauseMenu();
|
||||
}
|
||||
} else if (wasKeyDown(KeyType::CHAT)) {
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
if (isKeyDown(KeyType::SNEAK))
|
||||
m_game_ui->toggleChat();
|
||||
else
|
||||
#endif
|
||||
openConsole(0.2, L"");
|
||||
} else if (wasKeyDown(KeyType::CMD)) {
|
||||
openConsole(0.2, L"/");
|
||||
@ -1911,6 +1916,11 @@ void Game::processKeyInput()
|
||||
} else if (wasKeyDown(KeyType::FREEMOVE)) {
|
||||
toggleFreeMove();
|
||||
} else if (wasKeyDown(KeyType::JUMP)) {
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
if (isKeyDown(KeyType::SNEAK) && client->checkPrivilege("fly"))
|
||||
toggleFast();
|
||||
else
|
||||
#endif
|
||||
toggleFreeMoveAlt();
|
||||
} else if (wasKeyDown(KeyType::PITCHMOVE)) {
|
||||
togglePitchMove();
|
||||
@ -2548,7 +2558,11 @@ inline void Game::step(f32 *dtime)
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
if (g_menumgr.pausesGame()) {
|
||||
runData.pause_game_timer += *dtime;
|
||||
if (runData.pause_game_timer > 120.f) {
|
||||
float disconnect_time = 180.0f;
|
||||
#ifdef __IOS__
|
||||
disconnect_time = simple_singleplayer_mode ? 60.0f : 120.0f;
|
||||
#endif
|
||||
if (runData.pause_game_timer > disconnect_time) {
|
||||
g_gamecallback->disconnect();
|
||||
return;
|
||||
}
|
||||
@ -4423,7 +4437,7 @@ void the_game(bool *kill,
|
||||
}
|
||||
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
void external_pause_game()
|
||||
extern "C" void external_pause_game()
|
||||
{
|
||||
if (!g_game)
|
||||
return;
|
||||
@ -4432,7 +4446,7 @@ void external_pause_game()
|
||||
#endif
|
||||
|
||||
#ifdef __IOS__
|
||||
void external_statustext(const char *text, float duration)
|
||||
extern "C" void external_statustext(const char *text, float duration)
|
||||
{
|
||||
if (!g_game)
|
||||
return;
|
||||
|
@ -31,8 +31,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "porting_ios.h"
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
extern void external_pause_game();
|
||||
#if defined(__IOS__)
|
||||
extern "C" void external_pause_game();
|
||||
#endif
|
||||
|
||||
void KeyCache::populate_nonchanging()
|
||||
@ -118,7 +118,7 @@ bool MyEventReceiver::OnEvent(const SEvent &event)
|
||||
if (isMenuActive()) {
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
if (m_touchscreengui) {
|
||||
m_touchscreengui->Toggle(false);
|
||||
m_touchscreengui->hide();
|
||||
}
|
||||
#endif
|
||||
return g_menumgr.preprocessEvent(event);
|
||||
@ -154,16 +154,9 @@ bool MyEventReceiver::OnEvent(const SEvent &event)
|
||||
#ifdef __IOS__
|
||||
} else if (event.EventType == irr::EET_APPLICATION_EVENT) {
|
||||
int AppEvent = event.ApplicationEvent.EventType;
|
||||
if (AppEvent == irr::EAET_DID_PAUSE) {
|
||||
ioswrap_events(AppEvent);
|
||||
if (AppEvent == irr::EAET_WILL_PAUSE)
|
||||
external_pause_game();
|
||||
#ifdef ADS
|
||||
ads_set_paused(true);
|
||||
#endif
|
||||
}
|
||||
#ifdef ADS
|
||||
if (AppEvent == irr::EAET_DID_RESUME)
|
||||
ads_set_paused(false);
|
||||
#endif
|
||||
return true;
|
||||
#endif
|
||||
|
||||
|
@ -56,6 +56,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "filesys.h"
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "defaultsettings.h"
|
||||
#endif
|
||||
|
||||
RenderingEngine *RenderingEngine::s_singleton = nullptr;
|
||||
|
||||
|
||||
@ -85,16 +89,15 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
|
||||
{
|
||||
sanity_check(!s_singleton);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
// Set correct resolution
|
||||
g_settings->setU16("screen_w", porting::getDisplaySize().X);
|
||||
g_settings->setU16("screen_h", porting::getDisplaySize().Y);
|
||||
#endif
|
||||
|
||||
// Resolution selection
|
||||
bool fullscreen = g_settings->getBool("fullscreen");
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
u16 screen_w = 0;
|
||||
u16 screen_h = 0;
|
||||
#else
|
||||
u16 screen_w = g_settings->getU16("screen_w");
|
||||
u16 screen_h = g_settings->getU16("screen_h");
|
||||
#endif
|
||||
|
||||
// bpp, fsaa, vsync
|
||||
bool vsync = g_settings->getBool("vsync");
|
||||
@ -155,13 +158,17 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
|
||||
m_device->getGUIEnvironment()->setSkin(skin);
|
||||
skin->drop();
|
||||
|
||||
#ifdef __IOS__
|
||||
if (device) {
|
||||
CIrrDeviceiOS* dev = (CIrrDeviceiOS*) device;
|
||||
porting::setViewController(dev->getViewController());
|
||||
#ifdef ADS
|
||||
ads_startup(dev->getViewController());
|
||||
#ifdef __ANDROID__
|
||||
// Apply settings according to screen size
|
||||
// We can get real screen size only after device initialization finished
|
||||
if (m_device)
|
||||
set_default_settings();
|
||||
#endif
|
||||
|
||||
#ifdef __IOS__
|
||||
if (m_device) {
|
||||
CIrrDeviceiOS* dev = (CIrrDeviceiOS*) m_device;
|
||||
porting::setViewController(dev->getViewController());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -815,6 +822,9 @@ float RenderingEngine::getDisplayDensity()
|
||||
|
||||
v2u32 RenderingEngine::getDisplaySize()
|
||||
{
|
||||
return porting::getDisplaySize();
|
||||
const RenderingEngine *engine = RenderingEngine::get_instance();
|
||||
if (engine == nullptr)
|
||||
return v2u32(0, 0);
|
||||
return engine->getWindowSize();
|
||||
}
|
||||
#endif // __ANDROID__/__IOS__
|
||||
|
@ -23,10 +23,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "filesys.h"
|
||||
#include "config.h"
|
||||
#include "constants.h"
|
||||
#include "porting.h"
|
||||
#include "mapgen/mapgen.h" // Mapgen::setDefaultSettings
|
||||
#include "util/string.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "client/renderingengine.h"
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#ifdef __IOS__
|
||||
#import "SDVersion.h"
|
||||
@ -37,7 +40,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
|
||||
void set_default_settings()
|
||||
{
|
||||
Settings *settings = Settings::createLayer(SL_DEFAULTS);
|
||||
Settings *settings = Settings::getLayer(SL_DEFAULTS);
|
||||
if (settings == nullptr)
|
||||
settings = Settings::createLayer(SL_DEFAULTS);
|
||||
|
||||
// Client and server
|
||||
settings->setDefault("language", "");
|
||||
@ -242,7 +247,7 @@ void set_default_settings()
|
||||
settings->setDefault("show_entity_selectionbox", "false");
|
||||
settings->setDefault("texture_clean_transparent", "false");
|
||||
settings->setDefault("texture_min_size", "0");
|
||||
settings->setDefault("ambient_occlusion_gamma", "1.8");
|
||||
settings->setDefault("ambient_occlusion_gamma", "2.2");
|
||||
#if ENABLE_GLES
|
||||
settings->setDefault("enable_shaders", "false");
|
||||
#else
|
||||
@ -250,7 +255,7 @@ void set_default_settings()
|
||||
#endif
|
||||
settings->setDefault("enable_particles", "true");
|
||||
settings->setDefault("arm_inertia", "false");
|
||||
settings->setDefault("show_nametag_backgrounds", "true");
|
||||
settings->setDefault("show_nametag_backgrounds", "false");
|
||||
|
||||
settings->setDefault("enable_minimap", "true");
|
||||
settings->setDefault("minimap_shape_round", "true");
|
||||
@ -398,7 +403,7 @@ void set_default_settings()
|
||||
settings->setDefault("kick_msg_crash", "This server has experienced an internal error. You will now be disconnected.");
|
||||
settings->setDefault("ask_reconnect_on_crash", "false");
|
||||
|
||||
settings->setDefault("chat_message_format", "<@name> @message");
|
||||
settings->setDefault("chat_message_format", "@name: @message");
|
||||
settings->setDefault("profiler_print_interval", "0");
|
||||
settings->setDefault("active_object_send_range_blocks", "8");
|
||||
settings->setDefault("active_block_range", "4");
|
||||
@ -485,7 +490,6 @@ void set_default_settings()
|
||||
// Altered settings for macOS
|
||||
#if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__)
|
||||
settings->setDefault("keymap_sneak", "KEY_SHIFT");
|
||||
settings->setDefault("keymap_toggle_debug", "KEY_KEY_V");
|
||||
settings->setDefault("keymap_camera_mode", "KEY_KEY_C");
|
||||
settings->setDefault("vsync", "true");
|
||||
|
||||
@ -502,8 +506,6 @@ void set_default_settings()
|
||||
|
||||
// Mobile Platform
|
||||
#if defined(__ANDROID__) || defined(__IOS__)
|
||||
settings->setDefault("screen_w", "0");
|
||||
settings->setDefault("screen_h", "0");
|
||||
settings->setDefault("fullscreen", "true");
|
||||
settings->setDefault("touchtarget", "true");
|
||||
settings->setDefault("TMPFolder", porting::path_cache);
|
||||
@ -531,10 +533,8 @@ void set_default_settings()
|
||||
if (memoryMax < 2) {
|
||||
// minimal settings for less than 2GB RAM
|
||||
#elif __IOS__
|
||||
if (iOS_ver < 11.0) {
|
||||
// minimal settings for legacy 32-bit devices
|
||||
settings->setDefault("enable_minimap", "false");
|
||||
settings->setDefault("enable_clouds", "false");
|
||||
if (false) {
|
||||
// obsolete
|
||||
#endif
|
||||
settings->setDefault("client_unload_unused_data_timeout", "60");
|
||||
settings->setDefault("client_mapblock_limit", "50");
|
||||
@ -593,10 +593,7 @@ void set_default_settings()
|
||||
settings->setDefault("viewing_range", "80");
|
||||
settings->setDefault("max_block_generate_distance", "5");
|
||||
|
||||
#ifdef __ANDROID__
|
||||
settings->setDefault("video_driver", "ogles2");
|
||||
settings->setDefault("enable_shaders", "true");
|
||||
#elif __IOS__
|
||||
#ifdef __IOS__
|
||||
if (@available(iOS 13, *)) {
|
||||
#endif
|
||||
// enable visual shader effects
|
||||
@ -608,44 +605,50 @@ void set_default_settings()
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string font_small = std::to_string(TTF_DEFAULT_FONT_SIZE - 1);
|
||||
|
||||
// Android Settings
|
||||
#ifdef __ANDROID__
|
||||
settings->setDefault("video_driver", "ogles1");
|
||||
settings->setDefault("enable_shaders", "false");
|
||||
// Switch to olges2 with shaders on powerful Android devices
|
||||
if (memoryMax >= 6) {
|
||||
settings->setDefault("video_driver", "ogles2");
|
||||
settings->setDefault("enable_shaders", "true");
|
||||
} else {
|
||||
settings->setDefault("video_driver", "ogles1");
|
||||
settings->setDefault("enable_shaders", "false");
|
||||
}
|
||||
|
||||
settings->setDefault("debug_log_level", "error");
|
||||
|
||||
// Apply settings according to screen size
|
||||
float x_inches = (float) porting::getDisplaySize().X /
|
||||
(160.f * porting::getDisplayDensity());
|
||||
|
||||
std::string font_size_str_small = std::to_string(TTF_DEFAULT_FONT_SIZE - 1);
|
||||
|
||||
if (x_inches <= 3.7) {
|
||||
// small 4" phones
|
||||
settings->setDefault("hud_scaling", "0.55");
|
||||
settings->setDefault("font_size", font_size_str_small);
|
||||
settings->setDefault("mouse_sensitivity", "0.3");
|
||||
} else if (x_inches > 3.7 && x_inches <= 4.5) {
|
||||
// medium phones
|
||||
settings->setDefault("hud_scaling", "0.6");
|
||||
settings->setDefault("font_size", font_size_str_small);
|
||||
settings->setDefault("selectionbox_width", "6");
|
||||
} else if (x_inches > 4.5 && x_inches <= 5.5) {
|
||||
// large 6" phones
|
||||
settings->setDefault("hud_scaling", "0.7");
|
||||
settings->setDefault("mouse_sensitivity", "0.15");
|
||||
settings->setDefault("selectionbox_width", "6");
|
||||
} else if (x_inches > 5.5 && x_inches <= 6.5) {
|
||||
// 7" tablets
|
||||
settings->setDefault("hud_scaling", "0.9");
|
||||
settings->setDefault("selectionbox_width", "6");
|
||||
v2u32 window_size = RenderingEngine::getDisplaySize();
|
||||
if (window_size.X > 0) {
|
||||
float x_inches = window_size.X / (160.f * porting::getDisplayDensity());
|
||||
if (x_inches <= 3.7) {
|
||||
// small 4" phones
|
||||
g_settings->setDefault("hud_scaling", "0.55");
|
||||
g_settings->setDefault("font_size", font_small);
|
||||
g_settings->setDefault("mouse_sensitivity", "0.3");
|
||||
} else if (x_inches > 3.7 && x_inches <= 4.5) {
|
||||
// medium phones
|
||||
g_settings->setDefault("hud_scaling", "0.6");
|
||||
g_settings->setDefault("font_size", font_small);
|
||||
g_settings->setDefault("selectionbox_width", "6");
|
||||
} else if (x_inches > 4.5 && x_inches <= 5.5) {
|
||||
// large 6" phones
|
||||
g_settings->setDefault("hud_scaling", "0.7");
|
||||
g_settings->setDefault("mouse_sensitivity", "0.15");
|
||||
g_settings->setDefault("selectionbox_width", "6");
|
||||
} else if (x_inches > 5.5 && x_inches <= 6.5) {
|
||||
// 7" tablets
|
||||
g_settings->setDefault("hud_scaling", "0.9");
|
||||
g_settings->setDefault("selectionbox_width", "6");
|
||||
}
|
||||
}
|
||||
#endif // Android
|
||||
|
||||
// iOS Settings
|
||||
#ifdef __IOS__
|
||||
// Switch to olges2 with shaders on the new iOS version
|
||||
// Switch to olges2 with shaders in new iOS versions
|
||||
if (@available(iOS 13, *)) {
|
||||
settings->setDefault("video_driver", "ogles2");
|
||||
settings->setDefault("enable_shaders", "true");
|
||||
@ -662,14 +665,17 @@ void set_default_settings()
|
||||
// 4" iPhone and iPod Touch
|
||||
settings->setDefault("hud_scaling", "0.55");
|
||||
settings->setDefault("mouse_sensitivity", "0.33");
|
||||
settings->setDefault("font_size", font_small);
|
||||
} else if SDVersion4and7Inch {
|
||||
// 4.7" iPhone
|
||||
settings->setDefault("hud_scaling", "0.65");
|
||||
settings->setDefault("hud_scaling", "0.6");
|
||||
settings->setDefault("mouse_sensitivity", "0.27");
|
||||
settings->setDefault("font_size", font_small);
|
||||
} else if SDVersion5and5Inch {
|
||||
// 5.5" iPhone Plus
|
||||
settings->setDefault("hud_scaling", "0.7");
|
||||
settings->setDefault("hud_scaling", "0.65");
|
||||
settings->setDefault("mouse_sensitivity", "0.3");
|
||||
settings->setDefault("font_size", font_small);
|
||||
} else if (SDVersion5and8Inch || SDVersion6and1Inch || SDVersion6and5Inch) {
|
||||
// 5.8+" iPhones
|
||||
settings->setDefault("hud_scaling", "0.85");
|
||||
@ -687,18 +693,14 @@ void set_default_settings()
|
||||
}
|
||||
|
||||
// Settings for the Rounded Screen and Home Bar
|
||||
if (@available(iOS 11, *)) {
|
||||
UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
|
||||
int bottomPadding = (int) window.safeAreaInsets.bottom;
|
||||
UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
|
||||
|
||||
if (bottomPadding > 0) {
|
||||
settings->setDefault("hud_move_upwards", "20");
|
||||
if (SDVersioniPhone12Series)
|
||||
settings->setDefault("round_screen", "75");
|
||||
else
|
||||
settings->setDefault("round_screen", "35");
|
||||
}
|
||||
}
|
||||
if (window.safeAreaInsets.bottom > 0) {
|
||||
settings->setDefault("hud_move_upwards", "20");
|
||||
if (SDVersioniPhone12Series)
|
||||
settings->setDefault("round_screen", "75");
|
||||
else
|
||||
settings->setDefault("round_screen", "35");
|
||||
#endif // iOS
|
||||
#endif
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ GUISkin::GUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
|
||||
{
|
||||
Colors[EGDC_3D_DARK_SHADOW] = video::SColor(101,50,50,50);
|
||||
Colors[EGDC_3D_SHADOW] = video::SColor(101,130,130,130);
|
||||
Colors[EGDC_3D_FACE] = video::SColor(220,100,100,100);
|
||||
Colors[EGDC_3D_FACE] = video::SColor(101,210,210,210);
|
||||
Colors[EGDC_3D_HIGH_LIGHT] = video::SColor(101,255,255,255);
|
||||
Colors[EGDC_3D_LIGHT] = video::SColor(101,210,210,210);
|
||||
Colors[EGDC_ACTIVE_BORDER] = video::SColor(101,16,14,115);
|
||||
|
@ -1249,7 +1249,7 @@ void TouchScreenGUI::Toggle(bool visible)
|
||||
button.guibutton->setVisible(visible);
|
||||
}
|
||||
|
||||
if (m_joystick_btn_off->guibutton)
|
||||
if (m_joystick_btn_off != nullptr && m_joystick_btn_off->guibutton)
|
||||
m_joystick_btn_off->guibutton->setVisible(visible);
|
||||
|
||||
// clear all active buttons
|
||||
|
@ -38,7 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#endif
|
||||
|
||||
extern int main(int argc, char *argv[]);
|
||||
extern void external_pause_game();
|
||||
extern "C" void external_pause_game();
|
||||
|
||||
void android_main(android_app *app)
|
||||
{
|
||||
@ -310,7 +310,7 @@ void notifyExitGame()
|
||||
"notifyExitGame", "()V");
|
||||
|
||||
FATAL_ERROR_IF(notifyExit == nullptr,
|
||||
"porting::notifyExit unable to find java getDensity method");
|
||||
"porting::notifyExit unable to find java notifyExit method");
|
||||
|
||||
jnienv->CallVoidMethod(app_global->activity->clazz, notifyExit);
|
||||
}
|
||||
@ -333,34 +333,5 @@ float getDisplayDensity()
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
v2u32 getDisplaySize()
|
||||
{
|
||||
static bool firstrun = true;
|
||||
static v2u32 retval;
|
||||
|
||||
if (firstrun) {
|
||||
jmethodID getDisplayWidth = jnienv->GetMethodID(nativeActivity,
|
||||
"getDisplayWidth", "()I");
|
||||
|
||||
FATAL_ERROR_IF(getDisplayWidth == nullptr,
|
||||
"porting::getDisplayWidth unable to find java getDisplayWidth method");
|
||||
|
||||
retval.X = jnienv->CallIntMethod(app_global->activity->clazz,
|
||||
getDisplayWidth);
|
||||
|
||||
jmethodID getDisplayHeight = jnienv->GetMethodID(nativeActivity,
|
||||
"getDisplayHeight", "()I");
|
||||
|
||||
FATAL_ERROR_IF(getDisplayHeight == nullptr,
|
||||
"porting::getDisplayHeight unable to find java getDisplayHeight method");
|
||||
|
||||
retval.Y = jnienv->CallIntMethod(app_global->activity->clazz,
|
||||
getDisplayHeight);
|
||||
|
||||
firstrun = false;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
#endif // ndef SERVER
|
||||
}
|
||||
|
@ -90,6 +90,5 @@ std::string getInputDialogValue();
|
||||
|
||||
#ifndef SERVER
|
||||
float getDisplayDensity();
|
||||
v2u32 getDisplaySize();
|
||||
#endif
|
||||
}
|
||||
|
@ -81,10 +81,10 @@ void sendAnnounce(AnnounceAction action,
|
||||
server["mapgen"] = mg_name;
|
||||
server["privs"] = g_settings->get("default_privs");
|
||||
server["can_see_far_names"] = g_settings->getS16("player_transfer_distance") <= 0;
|
||||
server["mods"] = Json::Value(Json::arrayValue);
|
||||
/*server["mods"] = Json::Value(Json::arrayValue);
|
||||
for (const ModSpec &mod : mods) {
|
||||
server["mods"].append(mod.name);
|
||||
}
|
||||
}*/
|
||||
} else if (action == AA_UPDATE) {
|
||||
if (lag)
|
||||
server["lag"] = lag;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 1.3 KiB |
Loading…
x
Reference in New Issue
Block a user