1
0

Merge MultiCraft Legacy changes

This commit is contained in:
MoNTE48 2021-07-15 22:01:11 +02:00
parent b1fa8f8e2b
commit 0534d696f7
16 changed files with 129 additions and 126 deletions

View File

@ -1,14 +1,14 @@
MultiCraft Open Source 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) [![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 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). 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 Table of Contents
------------------ ------------------

0
build/macOS/Podfile Executable file → Normal file
View File

View File

@ -390,7 +390,11 @@ core.register_entity(":__builtin:falling_node", {
-- Drop node if does not fall within 5 seconds -- Drop node if does not fall within 5 seconds
self.timer = self.timer + dtime self.timer = self.timer + dtime
if self.timer > 5 then 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() self.object:remove()
return return
end end

View File

@ -633,6 +633,11 @@ end
function core.item_eat(hp_change, replace_with_item, poison) function core.item_eat(hp_change, replace_with_item, poison)
return function(itemstack, user, pointed_thing) -- closure return function(itemstack, user, pointed_thing) -- closure
if user then 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) return core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing, poison)
end end
end end

View File

@ -31,6 +31,10 @@ end
-- returns error message, or nil -- returns error message, or nil
local function parse_setting_line(settings, line, read_all, base_level, allow_secure) local function parse_setting_line(settings, line, read_all, base_level, allow_secure)
-- strip carriage returns (CR, /r)
line = line:gsub("\r", "")
-- comment -- comment
local comment = line:match("^#" .. CHAR_CLASSES.SPACE .. "*(.*)$") local comment = line:match("^#" .. CHAR_CLASSES.SPACE .. "*(.*)$")
if comment then if comment then

View File

@ -22,9 +22,10 @@ local multicraft_developers = {
"Bektur Mambetov (ubulem) <berkut87@gmail.com>", "Bektur Mambetov (ubulem) <berkut87@gmail.com>",
"Alexander Zavrin (Ransom.00)", "Alexander Zavrin (Ransom.00)",
"luk3yx", "luk3yx",
"An0n3m0us", "Nathan Salapat (NathanS21) <nathan@nathansalapat.com>",
"Jean-Patrick Guerrero (kilbith) <jeanpatrick.guerrero@gmail.com>",
"Vitaliy Lobachevskiy (numberZero) <numzer0@yandex.ru>", "Vitaliy Lobachevskiy (numberZero) <numzer0@yandex.ru>",
"Jean-Patrick Guerrero (kilbith) <jeanpatrick.guerrero@gmail.com>",
"An0n3m0us",
"sfan5 <sfan5@live.de>", "sfan5 <sfan5@live.de>",
"Stuart Jones (stujones11) <stujones111@gmail.com>", "Stuart Jones (stujones11) <stujones111@gmail.com>",
"And other people who helped make the world better!" "And other people who helped make the world better!"

View File

@ -1898,6 +1898,11 @@ void Game::processKeyInput()
showPauseMenu(); showPauseMenu();
} }
} else if (wasKeyDown(KeyType::CHAT)) { } else if (wasKeyDown(KeyType::CHAT)) {
#if defined(__ANDROID__) || defined(__IOS__)
if (isKeyDown(KeyType::SNEAK))
m_game_ui->toggleChat();
else
#endif
openConsole(0.2, L""); openConsole(0.2, L"");
} else if (wasKeyDown(KeyType::CMD)) { } else if (wasKeyDown(KeyType::CMD)) {
openConsole(0.2, L"/"); openConsole(0.2, L"/");
@ -1911,6 +1916,11 @@ void Game::processKeyInput()
} else if (wasKeyDown(KeyType::FREEMOVE)) { } else if (wasKeyDown(KeyType::FREEMOVE)) {
toggleFreeMove(); toggleFreeMove();
} else if (wasKeyDown(KeyType::JUMP)) { } else if (wasKeyDown(KeyType::JUMP)) {
#if defined(__ANDROID__) || defined(__IOS__)
if (isKeyDown(KeyType::SNEAK) && client->checkPrivilege("fly"))
toggleFast();
else
#endif
toggleFreeMoveAlt(); toggleFreeMoveAlt();
} else if (wasKeyDown(KeyType::PITCHMOVE)) { } else if (wasKeyDown(KeyType::PITCHMOVE)) {
togglePitchMove(); togglePitchMove();
@ -2548,7 +2558,11 @@ inline void Game::step(f32 *dtime)
#if defined(__ANDROID__) || defined(__IOS__) #if defined(__ANDROID__) || defined(__IOS__)
if (g_menumgr.pausesGame()) { if (g_menumgr.pausesGame()) {
runData.pause_game_timer += *dtime; 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(); g_gamecallback->disconnect();
return; return;
} }
@ -4423,7 +4437,7 @@ void the_game(bool *kill,
} }
#if defined(__ANDROID__) || defined(__IOS__) #if defined(__ANDROID__) || defined(__IOS__)
void external_pause_game() extern "C" void external_pause_game()
{ {
if (!g_game) if (!g_game)
return; return;
@ -4432,7 +4446,7 @@ void external_pause_game()
#endif #endif
#ifdef __IOS__ #ifdef __IOS__
void external_statustext(const char *text, float duration) extern "C" void external_statustext(const char *text, float duration)
{ {
if (!g_game) if (!g_game)
return; return;

View File

@ -31,8 +31,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "porting_ios.h" #include "porting_ios.h"
#endif #endif
#if defined(__ANDROID__) || defined(__IOS__) #if defined(__IOS__)
extern void external_pause_game(); extern "C" void external_pause_game();
#endif #endif
void KeyCache::populate_nonchanging() void KeyCache::populate_nonchanging()
@ -118,7 +118,7 @@ bool MyEventReceiver::OnEvent(const SEvent &event)
if (isMenuActive()) { if (isMenuActive()) {
#ifdef HAVE_TOUCHSCREENGUI #ifdef HAVE_TOUCHSCREENGUI
if (m_touchscreengui) { if (m_touchscreengui) {
m_touchscreengui->Toggle(false); m_touchscreengui->hide();
} }
#endif #endif
return g_menumgr.preprocessEvent(event); return g_menumgr.preprocessEvent(event);
@ -154,16 +154,9 @@ bool MyEventReceiver::OnEvent(const SEvent &event)
#ifdef __IOS__ #ifdef __IOS__
} else if (event.EventType == irr::EET_APPLICATION_EVENT) { } else if (event.EventType == irr::EET_APPLICATION_EVENT) {
int AppEvent = event.ApplicationEvent.EventType; int AppEvent = event.ApplicationEvent.EventType;
if (AppEvent == irr::EAET_DID_PAUSE) { ioswrap_events(AppEvent);
if (AppEvent == irr::EAET_WILL_PAUSE)
external_pause_game(); 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; return true;
#endif #endif

View File

@ -56,6 +56,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "filesys.h" #include "filesys.h"
#endif #endif
#ifdef __ANDROID__
#include "defaultsettings.h"
#endif
RenderingEngine *RenderingEngine::s_singleton = nullptr; RenderingEngine *RenderingEngine::s_singleton = nullptr;
@ -85,16 +89,15 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
{ {
sanity_check(!s_singleton); 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 // Resolution selection
bool fullscreen = g_settings->getBool("fullscreen"); 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_w = g_settings->getU16("screen_w");
u16 screen_h = g_settings->getU16("screen_h"); u16 screen_h = g_settings->getU16("screen_h");
#endif
// bpp, fsaa, vsync // bpp, fsaa, vsync
bool vsync = g_settings->getBool("vsync"); bool vsync = g_settings->getBool("vsync");
@ -155,13 +158,17 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
m_device->getGUIEnvironment()->setSkin(skin); m_device->getGUIEnvironment()->setSkin(skin);
skin->drop(); skin->drop();
#ifdef __IOS__ #ifdef __ANDROID__
if (device) { // Apply settings according to screen size
CIrrDeviceiOS* dev = (CIrrDeviceiOS*) device; // We can get real screen size only after device initialization finished
porting::setViewController(dev->getViewController()); if (m_device)
#ifdef ADS set_default_settings();
ads_startup(dev->getViewController());
#endif #endif
#ifdef __IOS__
if (m_device) {
CIrrDeviceiOS* dev = (CIrrDeviceiOS*) m_device;
porting::setViewController(dev->getViewController());
} }
#endif #endif
} }
@ -815,6 +822,9 @@ float RenderingEngine::getDisplayDensity()
v2u32 RenderingEngine::getDisplaySize() 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__ #endif // __ANDROID__/__IOS__

View File

@ -23,10 +23,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "filesys.h" #include "filesys.h"
#include "config.h" #include "config.h"
#include "constants.h" #include "constants.h"
#include "porting.h"
#include "mapgen/mapgen.h" // Mapgen::setDefaultSettings #include "mapgen/mapgen.h" // Mapgen::setDefaultSettings
#include "util/string.h" #include "util/string.h"
#ifdef __ANDROID__
#include "client/renderingengine.h"
#endif
#ifdef __APPLE__ #ifdef __APPLE__
#ifdef __IOS__ #ifdef __IOS__
#import "SDVersion.h" #import "SDVersion.h"
@ -37,7 +40,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
void set_default_settings() 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 // Client and server
settings->setDefault("language", ""); settings->setDefault("language", "");
@ -242,7 +247,7 @@ void set_default_settings()
settings->setDefault("show_entity_selectionbox", "false"); settings->setDefault("show_entity_selectionbox", "false");
settings->setDefault("texture_clean_transparent", "false"); settings->setDefault("texture_clean_transparent", "false");
settings->setDefault("texture_min_size", "0"); settings->setDefault("texture_min_size", "0");
settings->setDefault("ambient_occlusion_gamma", "1.8"); settings->setDefault("ambient_occlusion_gamma", "2.2");
#if ENABLE_GLES #if ENABLE_GLES
settings->setDefault("enable_shaders", "false"); settings->setDefault("enable_shaders", "false");
#else #else
@ -250,7 +255,7 @@ void set_default_settings()
#endif #endif
settings->setDefault("enable_particles", "true"); settings->setDefault("enable_particles", "true");
settings->setDefault("arm_inertia", "false"); settings->setDefault("arm_inertia", "false");
settings->setDefault("show_nametag_backgrounds", "true"); settings->setDefault("show_nametag_backgrounds", "false");
settings->setDefault("enable_minimap", "true"); settings->setDefault("enable_minimap", "true");
settings->setDefault("minimap_shape_round", "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("kick_msg_crash", "This server has experienced an internal error. You will now be disconnected.");
settings->setDefault("ask_reconnect_on_crash", "false"); 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("profiler_print_interval", "0");
settings->setDefault("active_object_send_range_blocks", "8"); settings->setDefault("active_object_send_range_blocks", "8");
settings->setDefault("active_block_range", "4"); settings->setDefault("active_block_range", "4");
@ -485,7 +490,6 @@ void set_default_settings()
// Altered settings for macOS // Altered settings for macOS
#if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__) #if defined(__MACH__) && defined(__APPLE__) && !defined(__IOS__)
settings->setDefault("keymap_sneak", "KEY_SHIFT"); settings->setDefault("keymap_sneak", "KEY_SHIFT");
settings->setDefault("keymap_toggle_debug", "KEY_KEY_V");
settings->setDefault("keymap_camera_mode", "KEY_KEY_C"); settings->setDefault("keymap_camera_mode", "KEY_KEY_C");
settings->setDefault("vsync", "true"); settings->setDefault("vsync", "true");
@ -502,8 +506,6 @@ void set_default_settings()
// Mobile Platform // Mobile Platform
#if defined(__ANDROID__) || defined(__IOS__) #if defined(__ANDROID__) || defined(__IOS__)
settings->setDefault("screen_w", "0");
settings->setDefault("screen_h", "0");
settings->setDefault("fullscreen", "true"); settings->setDefault("fullscreen", "true");
settings->setDefault("touchtarget", "true"); settings->setDefault("touchtarget", "true");
settings->setDefault("TMPFolder", porting::path_cache); settings->setDefault("TMPFolder", porting::path_cache);
@ -531,10 +533,8 @@ void set_default_settings()
if (memoryMax < 2) { if (memoryMax < 2) {
// minimal settings for less than 2GB RAM // minimal settings for less than 2GB RAM
#elif __IOS__ #elif __IOS__
if (iOS_ver < 11.0) { if (false) {
// minimal settings for legacy 32-bit devices // obsolete
settings->setDefault("enable_minimap", "false");
settings->setDefault("enable_clouds", "false");
#endif #endif
settings->setDefault("client_unload_unused_data_timeout", "60"); settings->setDefault("client_unload_unused_data_timeout", "60");
settings->setDefault("client_mapblock_limit", "50"); settings->setDefault("client_mapblock_limit", "50");
@ -593,10 +593,7 @@ void set_default_settings()
settings->setDefault("viewing_range", "80"); settings->setDefault("viewing_range", "80");
settings->setDefault("max_block_generate_distance", "5"); settings->setDefault("max_block_generate_distance", "5");
#ifdef __ANDROID__ #ifdef __IOS__
settings->setDefault("video_driver", "ogles2");
settings->setDefault("enable_shaders", "true");
#elif __IOS__
if (@available(iOS 13, *)) { if (@available(iOS 13, *)) {
#endif #endif
// enable visual shader effects // enable visual shader effects
@ -608,44 +605,50 @@ void set_default_settings()
#endif #endif
} }
std::string font_small = std::to_string(TTF_DEFAULT_FONT_SIZE - 1);
// Android Settings // Android Settings
#ifdef __ANDROID__ #ifdef __ANDROID__
settings->setDefault("video_driver", "ogles1"); // Switch to olges2 with shaders on powerful Android devices
settings->setDefault("enable_shaders", "false"); 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"); settings->setDefault("debug_log_level", "error");
// Apply settings according to screen size v2u32 window_size = RenderingEngine::getDisplaySize();
float x_inches = (float) porting::getDisplaySize().X / if (window_size.X > 0) {
(160.f * porting::getDisplayDensity()); float x_inches = window_size.X / (160.f * porting::getDisplayDensity());
if (x_inches <= 3.7) {
std::string font_size_str_small = std::to_string(TTF_DEFAULT_FONT_SIZE - 1); // small 4" phones
g_settings->setDefault("hud_scaling", "0.55");
if (x_inches <= 3.7) { g_settings->setDefault("font_size", font_small);
// small 4" phones g_settings->setDefault("mouse_sensitivity", "0.3");
settings->setDefault("hud_scaling", "0.55"); } else if (x_inches > 3.7 && x_inches <= 4.5) {
settings->setDefault("font_size", font_size_str_small); // medium phones
settings->setDefault("mouse_sensitivity", "0.3"); g_settings->setDefault("hud_scaling", "0.6");
} else if (x_inches > 3.7 && x_inches <= 4.5) { g_settings->setDefault("font_size", font_small);
// medium phones g_settings->setDefault("selectionbox_width", "6");
settings->setDefault("hud_scaling", "0.6"); } else if (x_inches > 4.5 && x_inches <= 5.5) {
settings->setDefault("font_size", font_size_str_small); // large 6" phones
settings->setDefault("selectionbox_width", "6"); g_settings->setDefault("hud_scaling", "0.7");
} else if (x_inches > 4.5 && x_inches <= 5.5) { g_settings->setDefault("mouse_sensitivity", "0.15");
// large 6" phones g_settings->setDefault("selectionbox_width", "6");
settings->setDefault("hud_scaling", "0.7"); } else if (x_inches > 5.5 && x_inches <= 6.5) {
settings->setDefault("mouse_sensitivity", "0.15"); // 7" tablets
settings->setDefault("selectionbox_width", "6"); g_settings->setDefault("hud_scaling", "0.9");
} else if (x_inches > 5.5 && x_inches <= 6.5) { g_settings->setDefault("selectionbox_width", "6");
// 7" tablets }
settings->setDefault("hud_scaling", "0.9");
settings->setDefault("selectionbox_width", "6");
} }
#endif // Android #endif // Android
// iOS Settings // iOS Settings
#ifdef __IOS__ #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, *)) { if (@available(iOS 13, *)) {
settings->setDefault("video_driver", "ogles2"); settings->setDefault("video_driver", "ogles2");
settings->setDefault("enable_shaders", "true"); settings->setDefault("enable_shaders", "true");
@ -662,14 +665,17 @@ void set_default_settings()
// 4" iPhone and iPod Touch // 4" iPhone and iPod Touch
settings->setDefault("hud_scaling", "0.55"); settings->setDefault("hud_scaling", "0.55");
settings->setDefault("mouse_sensitivity", "0.33"); settings->setDefault("mouse_sensitivity", "0.33");
settings->setDefault("font_size", font_small);
} else if SDVersion4and7Inch { } else if SDVersion4and7Inch {
// 4.7" iPhone // 4.7" iPhone
settings->setDefault("hud_scaling", "0.65"); settings->setDefault("hud_scaling", "0.6");
settings->setDefault("mouse_sensitivity", "0.27"); settings->setDefault("mouse_sensitivity", "0.27");
settings->setDefault("font_size", font_small);
} else if SDVersion5and5Inch { } else if SDVersion5and5Inch {
// 5.5" iPhone Plus // 5.5" iPhone Plus
settings->setDefault("hud_scaling", "0.7"); settings->setDefault("hud_scaling", "0.65");
settings->setDefault("mouse_sensitivity", "0.3"); settings->setDefault("mouse_sensitivity", "0.3");
settings->setDefault("font_size", font_small);
} else if (SDVersion5and8Inch || SDVersion6and1Inch || SDVersion6and5Inch) { } else if (SDVersion5and8Inch || SDVersion6and1Inch || SDVersion6and5Inch) {
// 5.8+" iPhones // 5.8+" iPhones
settings->setDefault("hud_scaling", "0.85"); settings->setDefault("hud_scaling", "0.85");
@ -687,18 +693,14 @@ void set_default_settings()
} }
// Settings for the Rounded Screen and Home Bar // Settings for the Rounded Screen and Home Bar
if (@available(iOS 11, *)) { UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
UIWindow *window = UIApplication.sharedApplication.windows.firstObject;
int bottomPadding = (int) window.safeAreaInsets.bottom;
if (bottomPadding > 0) { if (window.safeAreaInsets.bottom > 0) {
settings->setDefault("hud_move_upwards", "20"); settings->setDefault("hud_move_upwards", "20");
if (SDVersioniPhone12Series) if (SDVersioniPhone12Series)
settings->setDefault("round_screen", "75"); settings->setDefault("round_screen", "75");
else else
settings->setDefault("round_screen", "35"); settings->setDefault("round_screen", "35");
}
}
#endif // iOS #endif // iOS
#endif #endif
} }

View File

@ -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_DARK_SHADOW] = video::SColor(101,50,50,50);
Colors[EGDC_3D_SHADOW] = video::SColor(101,130,130,130); 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_HIGH_LIGHT] = video::SColor(101,255,255,255);
Colors[EGDC_3D_LIGHT] = video::SColor(101,210,210,210); Colors[EGDC_3D_LIGHT] = video::SColor(101,210,210,210);
Colors[EGDC_ACTIVE_BORDER] = video::SColor(101,16,14,115); Colors[EGDC_ACTIVE_BORDER] = video::SColor(101,16,14,115);

View File

@ -1249,7 +1249,7 @@ void TouchScreenGUI::Toggle(bool visible)
button.guibutton->setVisible(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); m_joystick_btn_off->guibutton->setVisible(visible);
// clear all active buttons // clear all active buttons

View File

@ -38,7 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#endif #endif
extern int main(int argc, char *argv[]); extern int main(int argc, char *argv[]);
extern void external_pause_game(); extern "C" void external_pause_game();
void android_main(android_app *app) void android_main(android_app *app)
{ {
@ -310,7 +310,7 @@ void notifyExitGame()
"notifyExitGame", "()V"); "notifyExitGame", "()V");
FATAL_ERROR_IF(notifyExit == nullptr, 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); jnienv->CallVoidMethod(app_global->activity->clazz, notifyExit);
} }
@ -333,34 +333,5 @@ float getDisplayDensity()
} }
return value; 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 #endif // ndef SERVER
} }

View File

@ -90,6 +90,5 @@ std::string getInputDialogValue();
#ifndef SERVER #ifndef SERVER
float getDisplayDensity(); float getDisplayDensity();
v2u32 getDisplaySize();
#endif #endif
} }

View File

@ -81,10 +81,10 @@ void sendAnnounce(AnnounceAction action,
server["mapgen"] = mg_name; server["mapgen"] = mg_name;
server["privs"] = g_settings->get("default_privs"); server["privs"] = g_settings->get("default_privs");
server["can_see_far_names"] = g_settings->getS16("player_transfer_distance") <= 0; 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) { for (const ModSpec &mod : mods) {
server["mods"].append(mod.name); server["mods"].append(mod.name);
} }*/
} else if (action == AA_UPDATE) { } else if (action == AA_UPDATE) {
if (lag) if (lag)
server["lag"] = lag; server["lag"] = lag;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB