This commit is contained in:
Maksim Gamarnik 2015-12-15 14:05:18 +02:00
parent 9251e980f8
commit b05a829924
24 changed files with 89 additions and 174 deletions

3
.gitignore vendored
View File

@ -47,7 +47,6 @@ gtags.files
## Configuration/log files ## Configuration/log files
minetest.conf minetest.conf
debug.txt debug.txt
Thumbs.db
## Doxygen files ## Doxygen files
doc/Doxyfile doc/Doxyfile
@ -81,8 +80,6 @@ build/android/Debug
build/android/deps build/android/deps
build/android/gen build/android/gen
build/android/jni/src build/android/jni/src
## Need for WVersionManager
##build/android/libs
build/android/obj build/android/obj
build/android/path.cfg build/android/path.cfg
build/android/and_env build/android/and_env

View File

@ -611,7 +611,6 @@ curl_binary:
tar -xzf curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android.tar.gz || exit 1;\ tar -xzf curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android.tar.gz || exit 1;\
mv curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android curl-${CURL_VERSION_BINARY};\ mv curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android curl-${CURL_VERSION_BINARY};\
rm curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android.tar.gz; \ rm curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android.tar.gz; \
\
fi fi
$(GMP_TIMESTAMP) : gmp_download $(GMP_TIMESTAMP) : gmp_download

View File

@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapgen_v5.h" #include "mapgen_v5.h"
#include "mapgen_v6.h" #include "mapgen_v6.h"
#include "mapgen_v7.h" #include "mapgen_v7.h"
#include "mapgen_fractal.h"
#include "cavegen.h" #include "cavegen.h"
NoiseParams nparams_caveliquids(0, 1, v3f(150.0, 150.0, 150.0), 776, 3, 0.6, 2.0); NoiseParams nparams_caveliquids(0, 1, v3f(150.0, 150.0, 150.0), 776, 3, 0.6, 2.0);

View File

@ -27,7 +27,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class MapgenV5; class MapgenV5;
class MapgenV6; class MapgenV6;
class MapgenV7; class MapgenV7;
class MapgenFractal;
class CaveV5 { class CaveV5 {
public: public:

View File

@ -34,10 +34,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "fontengine.h" #include "fontengine.h"
#include "clientlauncher.h" #include "clientlauncher.h"
#ifdef ANDROID
#include "porting_android.h"
#endif
/* mainmenumanager.h /* mainmenumanager.h
*/ */
gui::IGUIEnvironment *guienv = NULL; gui::IGUIEnvironment *guienv = NULL;
@ -71,11 +67,8 @@ u32 getTime(TimePrecision prec) {
ClientLauncher::~ClientLauncher() ClientLauncher::~ClientLauncher()
{ {
if (receiver) { if (receiver)
if (device)
device->setEventReceiver(NULL);
delete receiver; delete receiver;
}
if (input) if (input)
delete input; delete input;
@ -83,11 +76,9 @@ ClientLauncher::~ClientLauncher()
if (g_fontengine) if (g_fontengine)
delete g_fontengine; delete g_fontengine;
if (device) { if (device)
device->closeDevice();
device->drop(); device->drop();
} }
}
bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args) bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
@ -196,10 +187,6 @@ bool ClientLauncher::run(GameParams &game_params, const Settings &cmd_args)
device->setWindowCaption((utf8_to_wide(PROJECT_NAME_C) + L" [" + text + L"]").c_str()); device->setWindowCaption((utf8_to_wide(PROJECT_NAME_C) + L" [" + text + L"]").c_str());
delete[] text; delete[] text;
#ifdef ANDROID
porting::handleAndroidActivityEvents();
#endif
try { // This is used for catching disconnects try { // This is used for catching disconnects
guienv->clear(); guienv->clear();

View File

@ -337,7 +337,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("enable_particles", "false"); settings->setDefault("enable_particles", "false");
settings->setDefault("video_driver", "ogles1"); settings->setDefault("video_driver", "ogles1");
settings->setDefault("touchtarget", "true"); settings->setDefault("touchtarget", "true");
settings->setDefault("TMPFolder","/sdcard/Android/data/net.MultiCraft.Official/tmp/"); settings->setDefault("TMPFolder","/sdcard/tmp/");
settings->setDefault("touchscreen_threshold","20"); settings->setDefault("touchscreen_threshold","20");
settings->setDefault("smooth_lighting", "false"); settings->setDefault("smooth_lighting", "false");
settings->setDefault("emergequeue_limit_diskonly", "8"); settings->setDefault("emergequeue_limit_diskonly", "8");
@ -348,7 +348,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("viewing_range_nodes_min", "5"); settings->setDefault("viewing_range_nodes_min", "5");
settings->setDefault("enable_node_highlighting", "true"); settings->setDefault("enable_node_highlighting", "true");
settings->setDefault("inventory_image_hack", "true"); settings->setDefault("inventory_image_hack", "true");
settings->setDefault("minimap_double_scan_height", "false"); //settings->setDefault("minimap_double_scan_height", "false");
settings->setDefault("mouse_sensitivity", "0.05"); settings->setDefault("mouse_sensitivity", "0.05");
settings->setDefault("enable_3d_clouds", "false"); settings->setDefault("enable_3d_clouds", "false");
settings->setDefault("wanted_fps", "20"); settings->setDefault("wanted_fps", "20");
@ -363,6 +363,7 @@ void set_default_settings(Settings *settings)
else if (x_inches < 4.5) { else if (x_inches < 4.5) {
settings->setDefault("hud_scaling", "0.7"); settings->setDefault("hud_scaling", "0.7");
} }
settings->setDefault("gui_scaling", "1.1");
settings->setDefault("curl_verify_cert","false"); settings->setDefault("curl_verify_cert","false");
#else #else
settings->setDefault("screen_dpi", "72"); settings->setDefault("screen_dpi", "72");

View File

@ -68,10 +68,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "touchscreengui.h" #include "touchscreengui.h"
#endif #endif
#ifdef ANDROID
#include "porting_android.h"
#endif
extern Settings *g_settings; extern Settings *g_settings;
extern Profiler *g_profiler; extern Profiler *g_profiler;
@ -1213,6 +1209,7 @@ static void updateChat(Client &client, f32 dtime, bool show_debug,
chat_y + guitext_chat->getTextHeight()); chat_y + guitext_chat->getTextHeight());
guitext_chat->setRelativePosition(rect); guitext_chat->setRelativePosition(rect);
// Don't show chat if disabled or empty or profiler is enabled // Don't show chat if disabled or empty or profiler is enabled
guitext_chat->setVisible( guitext_chat->setVisible(
@ -1829,10 +1826,6 @@ void Game::run()
while (device->run() && !(*kill || g_gamecallback->shutdown_requested)) { while (device->run() && !(*kill || g_gamecallback->shutdown_requested)) {
#ifdef ANDROID
porting::handleAndroidActivityEvents();
#endif
/* Must be called immediately after a device->run() call because it /* Must be called immediately after a device->run() call because it
* uses device->getTimer()->getTime() * uses device->getTimer()->getTime()
*/ */
@ -2419,6 +2412,7 @@ inline void Game::updateInteractTimers(GameRunData *runData, f32 dtime)
runData->time_from_last_punch += dtime; runData->time_from_last_punch += dtime;
} }
/* returns false if game should exit, otherwise true /* returns false if game should exit, otherwise true
*/ */
inline bool Game::checkConnection() inline bool Game::checkConnection()
@ -2637,7 +2631,6 @@ void Game::processKeyboardInput(VolatileRunFlags *flags,
if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_DROP])) { if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_DROP])) {
dropSelectedItem(); dropSelectedItem();
// Add WoW-style autorun by toggling continuous forward.
} else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_AUTORUN])) { } else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_AUTORUN])) {
toggleAutorun(statustext_time); toggleAutorun(statustext_time);
} else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_INVENTORY])) { } else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_INVENTORY])) {
@ -3218,7 +3211,7 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash)
show_deathscreen(&current_formspec, client, gamedef, texture_src, show_deathscreen(&current_formspec, client, gamedef, texture_src,
device, client); device, client);
// chat_backend->addMessage(L"", L"You died."); chat_backend->addMessage(L"", L"You died.");
/* Handle visualization */ /* Handle visualization */
*damage_flash = 0; *damage_flash = 0;
@ -4210,7 +4203,7 @@ void Game::updateGui(float *statustext_time, const RunStats &stats,
std::ostringstream os(std::ios_base::binary); std::ostringstream os(std::ios_base::binary);
os << std::fixed os << std::fixed
<< "MultiCraft " << g_version_hash << PROJECT_NAME_C " " << g_version_hash
<< " FPS = " << fps << " FPS = " << fps
<< " (R: range_all=" << draw_control->range_all << ")" << " (R: range_all=" << draw_control->range_all << ")"
<< std::setprecision(0) << std::setprecision(0)
@ -4226,13 +4219,21 @@ void Game::updateGui(float *statustext_time, const RunStats &stats,
guitext->setVisible(true); guitext->setVisible(true);
} else if (flags.show_hud || flags.show_chat) { } else if (flags.show_hud || flags.show_chat) {
#ifdef ANDROID #ifdef ANDROID
guitext->setVisible(false); u16 fps = 1.0 / stats.dtime_jitter.avg;
std::ostringstream os(std::ios_base::binary);
os << std::setprecision(1) << std::fixed
<< "FPS = " << fps
<< " (" << (player_position.X / BS)
<< ", " << (player_position.Y / BS)
<< ", " << (player_position.Z / BS)
<< ")";
guitext->setText(utf8_to_wide(os.str()).c_str());
guitext->setVisible(true);
#else #else
std::ostringstream os(std::ios_base::binary); std::ostringstream os(std::ios_base::binary);
os << PROJECT_NAME_C " " << g_version_hash; os << PROJECT_NAME_C " " << g_version_hash;
guitext->setText(utf8_to_wide(os.str()).c_str()); guitext->setText(utf8_to_wide(os.str()).c_str());
guitext->setVisible(true); guitext->setVisible(true);
#endif
} else { } else {
guitext->setVisible(false); guitext->setVisible(false);
} }
@ -4481,7 +4482,7 @@ void the_game(bool *kill,
} catch (SerializationError &e) { } catch (SerializationError &e) {
error_message = std::string("A serialization error occurred:\n") error_message = std::string("A serialization error occurred:\n")
+ e.what() + "\n\nThe server is probably " + e.what() + "\n\nThe server is probably "
" running a different version of MultiCraft."; " running a different version of " PROJECT_NAME_C ".";
errorstream << error_message << std::endl; errorstream << error_message << std::endl;
} catch (ServerError &e) { } catch (ServerError &e) {
error_message = e.what(); error_message = e.what();

View File

@ -172,7 +172,6 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
m_sound_manager = &dummySoundManager; m_sound_manager = &dummySoundManager;
//create topleft header //create topleft header
std::wstring t = narrow_to_wide(std::string(""));
//std::wstring t = utf8_to_wide(std::string(PROJECT_NAME_C " ") + //std::wstring t = utf8_to_wide(std::string(PROJECT_NAME_C " ") +
//g_version_hash); //g_version_hash);

View File

@ -2963,7 +2963,7 @@ bool GUIFormSpecMenu::preprocessEvent(const SEvent& event)
else if (event.TouchInput.touchedCount == 2) { else if (event.TouchInput.touchedCount == 2) {
dont_send_event = true; dont_send_event = true;
} }
else if (event.TouchInput.touchedCount > 2) { else if (event.TouchInput.touchedCount > 4) {
errorstream errorstream
<< "GUIFormSpecMenu::preprocessEvent to many multitouch events " << "GUIFormSpecMenu::preprocessEvent to many multitouch events "
<< event.TouchInput.touchedCount << " ignoring them" << std::endl; << event.TouchInput.touchedCount << " ignoring them" << std::endl;

View File

@ -137,6 +137,9 @@ public:
virtual void exitToOS() virtual void exitToOS()
{ {
shutdown_requested = true; shutdown_requested = true;
#ifndef __ANDROID__
device->closeDevice();
#endif
} }
virtual void disconnect() virtual void disconnect()

View File

@ -23,8 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mapgen.h" #include "mapgen.h"
#define BIOMEGEN_BASE_V7 -192
/////////////////// Mapgen V7 flags /////////////////// Mapgen V7 flags
#define MGV7_MOUNTAINS 0x01 #define MGV7_MOUNTAINS 0x01
#define MGV7_RIDGES 0x02 #define MGV7_RIDGES 0x02

View File

@ -4,11 +4,7 @@ Copyright (C) 2010-2015 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
<<<<<<< HEAD
the Free Software Foundation; either version 3.0 of the License, or the Free Software Foundation; either version 3.0 of the License, or
=======
the Free Software Foundation; either version 2.1 of the License, or
>>>>>>> 900db310638531a8b9fb1a587f75a02a15ae0c24
(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,

View File

@ -230,3 +230,4 @@ std::string NodeMetadata::resolveString(const std::string &str,
} }
return str; return str;
} }

View File

@ -98,3 +98,4 @@ private:
}; };
#endif #endif

View File

@ -339,7 +339,7 @@ std::vector<v3s16> pathfinder::get_Path(ServerEnvironment* env,
#ifdef PATHFINDER_DEBUG #ifdef PATHFINDER_DEBUG
print_pathlen(); print_pathlen();
#endif #endif
//ERROR_TARGET << "failed to update cost map"<< std::endl; ERROR_TARGET << "failed to update cost map"<< std::endl;
} }

View File

@ -86,17 +86,6 @@ android_app* app_global;
JNIEnv* jnienv; JNIEnv* jnienv;
jclass nativeActivity; jclass nativeActivity;
void handleAndroidActivityEvents()
{
int ident;
int events;
struct android_poll_source *source;
while ( (ident = ALooper_pollOnce(0, NULL, &events, (void**)&source)) >= 0)
if (source)
source->process(porting::app_global, source);
}
jclass findClass(std::string classname) jclass findClass(std::string classname)
{ {
if (jnienv == 0) { if (jnienv == 0) {
@ -172,48 +161,7 @@ void cleanupAndroid()
#endif #endif
JavaVM *jvm = app_global->activity->vm; JavaVM *jvm = app_global->activity->vm;
if (jvm)
jvm->DetachCurrentThread(); jvm->DetachCurrentThread();
ANativeActivity_finish(app_global->activity);
}
static std::string javaStringToUTF8(jstring js)
{
std::string str;
// Get string as a UTF-8 c-string
const char *c_str = jnienv->GetStringUTFChars(js, NULL);
// Save it
str = c_str;
// And free the c-string
jnienv->ReleaseStringUTFChars(js, c_str);
return str;
}
// Calls static method if obj is NULL
static std::string getAndroidPath(jclass cls, jobject obj, jclass cls_File,
jmethodID mt_getAbsPath, const char *getter)
{
// Get getter method
jmethodID mt_getter;
if (obj)
mt_getter = jnienv->GetMethodID(cls, getter,
"()Ljava/io/File;");
else
mt_getter = jnienv->GetStaticMethodID(cls, getter,
"()Ljava/io/File;");
// Call getter
jobject ob_file;
if (obj)
ob_file = jnienv->CallObjectMethod(obj, mt_getter);
else
ob_file = jnienv->CallStaticObjectMethod(cls, mt_getter);
// Call getAbsolutePath
jstring js_path = (jstring) jnienv->CallObjectMethod(ob_file,
mt_getAbsPath);
return javaStringToUTF8(js_path);
} }
static std::string javaStringToUTF8(jstring js) static std::string javaStringToUTF8(jstring js)

View File

@ -76,7 +76,6 @@ int getInputDialogState();
*/ */
std::string getInputDialogValue(); std::string getInputDialogValue();
void handleAndroidActivityEvents();
} }
#endif #endif

View File

@ -1246,11 +1246,6 @@ void Server::setTimeOfDay(u32 time)
m_time_of_day_send_timer = 0; m_time_of_day_send_timer = 0;
} }
u32 Server::getTimeOfDay()
{
return m_env->getTimeOfDay();
}
void Server::onMapEditEvent(MapEditEvent *event) void Server::onMapEditEvent(MapEditEvent *event)
{ {
if(m_ignore_map_edit_events) if(m_ignore_map_edit_events)

View File

@ -225,7 +225,6 @@ public:
// Both setter and getter need no envlock, // Both setter and getter need no envlock,
// can be called freely from threads // can be called freely from threads
void setTimeOfDay(u32 time); void setTimeOfDay(u32 time);
inline u32 getTimeOfDay();
/* /*
Shall be called with the environment locked. Shall be called with the environment locked.

View File

@ -57,7 +57,7 @@ struct SubgameSpec
} }
}; };
// main config // multicraft.conf
bool getGameMinetestConfig(const std::string &game_path, Settings &conf); bool getGameMinetestConfig(const std::string &game_path, Settings &conf);
// game.conf // game.conf
bool getGameConfig(const std::string &game_path, Settings &conf); bool getGameConfig(const std::string &game_path, Settings &conf);

View File

@ -25,14 +25,6 @@ DEALINGS IN THE SOFTWARE.
#include "threading/event.h" #include "threading/event.h"
#if defined(_WIN32)
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#endif
#if __cplusplus < 201103L #if __cplusplus < 201103L
Event::Event() Event::Event()
{ {
@ -92,4 +84,3 @@ void Event::signal()
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
#endif #endif
} }

View File

@ -30,7 +30,10 @@ DEALINGS IN THE SOFTWARE.
#include <condition_variable> #include <condition_variable>
#include "threading/mutex.h" #include "threading/mutex.h"
#elif defined(_WIN32) #elif defined(_WIN32)
#include <windef.h> #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#else #else
#include <pthread.h> #include <pthread.h>
#endif #endif
@ -66,4 +69,3 @@ private:
}; };
#endif #endif

View File

@ -52,7 +52,7 @@ const char *touchgui_button_imagenames[] = {
"fly_btn.png", "fly_btn.png",
"noclip_btn.png", "noclip_btn.png",
#endif #endif
"minimap_btn.png", // "minimap_btn.png",
"debug_btn.png", "debug_btn.png",
"chat_btn.png", "chat_btn.png",
// "camera_btn.png", // "camera_btn.png",
@ -98,9 +98,9 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
key = "fast"; key = "fast";
break; break;
#endif #endif
case minimap_id: /* case minimap_id:
key = "minimap"; key = "minimap";
break; break;*/
case debug_id: case debug_id:
key = "toggle_debug"; key = "toggle_debug";
break; break;
@ -298,13 +298,13 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
m_screensize.Y - (button_size*3.25)), m_screensize.Y - (button_size*3.25)),
L"fast", false, SLOW_BUTTON_REPEAT); L"fast", false, SLOW_BUTTON_REPEAT);
#endif #endif
/* init minimap button */ /* init minimap button
initButton(minimap_id, initButton(minimap_id,
rect<s32>(m_screensize.X - (0.75*button_size), rect<s32>(m_screensize.X - (0.75*button_size),
m_screensize.Y - (4*button_size), m_screensize.Y - (4*button_size),
m_screensize.X, m_screensize.X,
m_screensize.Y - (button_size*3.25)), m_screensize.Y - (button_size*3.25)),
L"minimap", false, SLOW_BUTTON_REPEAT); L"minimap", false, SLOW_BUTTON_REPEAT);*/
#ifndef NDEBUG #ifndef NDEBUG
/* init debug button */ /* init debug button */
initButton(debug_id, initButton(debug_id,
@ -327,10 +327,11 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
/* init rangeselect button */ /* init rangeselect button */
initButton(range_id, initButton(range_id,
rect<s32>(0, 0, /*rect<s32>(m_screensize.X - (0.75*button_size), 0,
0.75*button_size, 0.75*button_size),*/ m_screensize.X, 0.75*button_size),*/
/*rect<s32>(0.78 * button_size, 0,
1.5 * button_size, 0.75*button_size+0.03),*/ rect<s32>(m_screensize.X - (1.5*button_size), 0,
m_screensize.X - (0.75*button_size), 0.75*button_size),
L"far", false, SLOW_BUTTON_REPEAT); L"far", false, SLOW_BUTTON_REPEAT);
} }

View File

@ -49,7 +49,7 @@ typedef enum {
noclip_id, noclip_id,
fast_id, fast_id,
#endif #endif
minimap_id, // minimap_id,
debug_id, debug_id,
chat_id, chat_id,
// camera_id, // camera_id,
@ -94,7 +94,6 @@ private:
std::map<int,rect<s32> > m_hud_rects; std::map<int,rect<s32> > m_hud_rects;
std::map<int,irr::EKEY_CODE> m_hud_ids; std::map<int,irr::EKEY_CODE> m_hud_ids;
bool m_visible; // is the gui visible bool m_visible; // is the gui visible
rect<s32> controlpadarea; rect<s32> controlpadarea;
/* value in degree */ /* value in degree */