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,10 +76,8 @@ ClientLauncher::~ClientLauncher()
if (g_fontengine) if (g_fontengine)
delete g_fontengine; delete g_fontengine;
if (device) { if (device)
device->closeDevice();
device->drop(); device->drop();
}
} }
@ -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;
@ -282,11 +278,11 @@ public:
Check if a node is pointable Check if a node is pointable
*/ */
inline bool isPointableNode(const MapNode &n, inline bool isPointableNode(const MapNode &n,
Client *client, bool liquids_pointable) Client *client, bool liquids_pointable)
{ {
const ContentFeatures &features = client->getNodeDefManager()->get(n); const ContentFeatures &features = client->getNodeDefManager()->get(n);
return features.pointable || return features.pointable ||
(liquids_pointable && features.isLiquid()); (liquids_pointable && features.isLiquid());
} }
/* /*
@ -321,8 +317,8 @@ PointedThing getPointedThing(Client *client, v3f player_position,
v3f pos = selected_object->getPosition(); v3f pos = selected_object->getPosition();
hilightboxes.push_back(aabb3f( hilightboxes.push_back(aabb3f(
selection_box->MinEdge + pos - intToFloat(camera_offset, BS), selection_box->MinEdge + pos - intToFloat(camera_offset, BS),
selection_box->MaxEdge + pos - intToFloat(camera_offset, BS))); selection_box->MaxEdge + pos - intToFloat(camera_offset, BS)));
} }
mindistance = (selected_object->getPosition() - camera_position).getLength(); mindistance = (selected_object->getPosition() - camera_position).getLength();
@ -905,8 +901,8 @@ bool nodePlacementPrediction(Client &client,
if (prediction != "" && !nodedef->get(node).rightclickable) { if (prediction != "" && !nodedef->get(node).rightclickable) {
verbosestream << "Node placement prediction for " verbosestream << "Node placement prediction for "
<< playeritem_def.name << " is " << playeritem_def.name << " is "
<< prediction << std::endl; << prediction << std::endl;
v3s16 p = neighbourpos; v3s16 p = neighbourpos;
// Place inside node itself if buildable_to // Place inside node itself if buildable_to
@ -928,9 +924,9 @@ bool nodePlacementPrediction(Client &client,
if (!found) { if (!found) {
errorstream << "Node placement prediction failed for " errorstream << "Node placement prediction failed for "
<< playeritem_def.name << " (places " << playeritem_def.name << " (places "
<< prediction << prediction
<< ") - Name not known" << std::endl; << ") - Name not known" << std::endl;
return false; return false;
} }
@ -1003,9 +999,9 @@ bool nodePlacementPrediction(Client &client,
} }
} catch (InvalidPositionException &e) { } catch (InvalidPositionException &e) {
errorstream << "Node placement prediction failed for " errorstream << "Node placement prediction failed for "
<< playeritem_def.name << " (places " << playeritem_def.name << " (places "
<< prediction << prediction
<< ") - Position not loaded" << std::endl; << ") - Position not loaded" << std::endl;
} }
} }
@ -1020,7 +1016,7 @@ static inline void create_formspec_menu(GUIFormSpecMenu **cur_formspec,
if (*cur_formspec == 0) { if (*cur_formspec == 0) {
*cur_formspec = new GUIFormSpecMenu(device, guiroot, -1, &g_menumgr, *cur_formspec = new GUIFormSpecMenu(device, guiroot, -1, &g_menumgr,
invmgr, gamedef, tsrc, fs_src, txt_dest, client); invmgr, gamedef, tsrc, fs_src, txt_dest, client);
(*cur_formspec)->doPause = false; (*cur_formspec)->doPause = false;
/* /*
@ -1204,13 +1200,14 @@ static void updateChat(Client &client, f32 dtime, bool show_debug,
// first pass to calculate height of text to be set // first pass to calculate height of text to be set
s32 width = std::min(g_fontengine->getTextWidth(recent_chat) + 10, s32 width = std::min(g_fontengine->getTextWidth(recent_chat) + 10,
porting::getWindowSize().X - 20); porting::getWindowSize().X - 20);
core::rect<s32> rect(10, chat_y, width, chat_y + porting::getWindowSize().Y); core::rect<s32> rect(10, chat_y, width, chat_y + porting::getWindowSize().Y);
guitext_chat->setRelativePosition(rect); guitext_chat->setRelativePosition(rect);
//now use real height of text and adjust rect according to this size //now use real height of text and adjust rect according to this size
rect = core::rect<s32>(10, chat_y, width, rect = core::rect<s32>(10, chat_y, width,
chat_y + guitext_chat->getTextHeight()); chat_y + guitext_chat->getTextHeight());
guitext_chat->setRelativePosition(rect); guitext_chat->setRelativePosition(rect);
@ -1591,7 +1588,7 @@ private:
GUIChatConsole *gui_chat_console; // Free using ->Drop() GUIChatConsole *gui_chat_console; // Free using ->Drop()
MapDrawControl *draw_control; MapDrawControl *draw_control;
Camera *camera; Camera *camera;
Clouds *clouds; // Free using ->Drop() Clouds *clouds; // Free using ->Drop()
Sky *sky; // Free using ->Drop() Sky *sky; // Free using ->Drop()
Inventory *local_inventory; Inventory *local_inventory;
Hud *hud; Hud *hud;
@ -1624,7 +1621,7 @@ private:
gui::IGUIStaticText *guitext2; // Second line of debug text gui::IGUIStaticText *guitext2; // Second line of debug text
gui::IGUIStaticText *guitext_info; // At the middle of the screen gui::IGUIStaticText *guitext_info; // At the middle of the screen
gui::IGUIStaticText *guitext_status; gui::IGUIStaticText *guitext_status;
gui::IGUIStaticText *guitext_chat; // Chat text gui::IGUIStaticText *guitext_chat; // Chat text
gui::IGUIStaticText *guitext_profiler; // Profiler text gui::IGUIStaticText *guitext_profiler; // Profiler text
std::wstring infotext; std::wstring infotext;
@ -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()
*/ */
@ -2018,7 +2011,7 @@ bool Game::createSingleplayerServer(const std::string map_dir,
} }
server = new Server(map_dir, gamespec, simple_singleplayer_mode, server = new Server(map_dir, gamespec, simple_singleplayer_mode,
bind_addr.isIPv6()); bind_addr.isIPv6());
server->start(bind_addr); server->start(bind_addr);
@ -2081,7 +2074,7 @@ bool Game::createClient(const std::string &playername,
/* Skybox /* Skybox
*/ */
sky = new Sky(smgr->getRootSceneNode(), smgr, -1, texture_src); sky = new Sky(smgr->getRootSceneNode(), smgr, -1, texture_src);
skybox = NULL; // This is used/set later on in the main run loop skybox = NULL; // This is used/set later on in the main run loop
local_inventory = new Inventory(itemdef_manager); local_inventory = new Inventory(itemdef_manager);
@ -2199,7 +2192,7 @@ bool Game::connectToServer(const std::string &playername,
const std::string &password, std::string *address, u16 port, const std::string &password, std::string *address, u16 port,
bool *connect_ok, bool *aborted) bool *connect_ok, bool *aborted)
{ {
*connect_ok = false; // Let's not be overly optimistic *connect_ok = false; // Let's not be overly optimistic
*aborted = false; *aborted = false;
bool local_server_mode = false; bool local_server_mode = false;
@ -2244,7 +2237,7 @@ bool Game::connectToServer(const std::string &playername,
if (!client) if (!client)
return false; return false;
gamedef = client; // Client acts as our GameDef gamedef = client; // Client acts as our GameDef
infostream << "Connecting to server at "; infostream << "Connecting to server at ";
connect_address.print(&infostream); connect_address.print(&infostream);
@ -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()
@ -2452,13 +2446,13 @@ inline bool Game::handleCallbacks()
if (g_gamecallback->changevolume_requested) { if (g_gamecallback->changevolume_requested) {
(new GUIVolumeChange(guienv, guiroot, -1, (new GUIVolumeChange(guienv, guiroot, -1,
&g_menumgr, client))->drop(); &g_menumgr, client))->drop();
g_gamecallback->changevolume_requested = false; g_gamecallback->changevolume_requested = false;
} }
if (g_gamecallback->keyconfig_requested) { if (g_gamecallback->keyconfig_requested) {
(new GUIKeyChangeMenu(guienv, guiroot, -1, (new GUIKeyChangeMenu(guienv, guiroot, -1,
&g_menumgr))->drop(); &g_menumgr))->drop();
g_gamecallback->keyconfig_requested = false; g_gamecallback->keyconfig_requested = false;
} }
@ -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])) {
@ -2701,7 +2694,7 @@ void Game::processKeyboardInput(VolatileRunFlags *flags,
<< std::endl; << std::endl;
dstream << "Printing debug stacks:" << std::endl; dstream << "Printing debug stacks:" << std::endl;
dstream << "-----------------------------------------" dstream << "-----------------------------------------"
<< std::endl; << std::endl;
debug_stacks_print(); debug_stacks_print();
} }
@ -2730,7 +2723,7 @@ void Game::processItemSelection(u16 *new_playeritem)
s32 wheel = input->getMouseWheel(); s32 wheel = input->getMouseWheel();
u16 max_item = MYMIN(PLAYER_INVENTORY_SIZE - 1, u16 max_item = MYMIN(PLAYER_INVENTORY_SIZE - 1,
player->hud_hotbar_itemcount - 1); player->hud_hotbar_itemcount - 1);
if (wheel < 0) if (wheel < 0)
*new_playeritem = *new_playeritem < max_item ? *new_playeritem + 1 : 0; *new_playeritem = *new_playeritem < max_item ? *new_playeritem + 1 : 0;
@ -3008,7 +3001,7 @@ void Game::toggleProfiler(float *statustext_time, u32 *profiler_current_page,
if (*profiler_current_page != 0) { if (*profiler_current_page != 0) {
std::wstringstream sstr; std::wstringstream sstr;
sstr << "Profiler shown (page " << *profiler_current_page sstr << "Profiler shown (page " << *profiler_current_page
<< " of " << profiler_max_page << ")"; << " of " << profiler_max_page << ")";
statustext = sstr.str(); statustext = sstr.str();
} else { } else {
statustext = L"Profiler hidden"; statustext = L"Profiler hidden";
@ -3175,7 +3168,7 @@ inline void Game::step(f32 *dtime)
bool can_be_and_is_paused = bool can_be_and_is_paused =
(simple_singleplayer_mode && g_menumgr.pausesGame()); (simple_singleplayer_mode && g_menumgr.pausesGame());
if (can_be_and_is_paused) { // This is for a singleplayer server if (can_be_and_is_paused) { // This is for a singleplayer server
*dtime = 0; // No time passes *dtime = 0; // No time passes
} else { } else {
if (server != NULL) { if (server != NULL) {
@ -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;
@ -3232,7 +3225,7 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash)
new TextDestPlayerInventory(client, *(event.show_formspec.formname)); new TextDestPlayerInventory(client, *(event.show_formspec.formname));
create_formspec_menu(&current_formspec, client, gamedef, create_formspec_menu(&current_formspec, client, gamedef,
texture_src, device, fs_src, txt_dst, client); texture_src, device, fs_src, txt_dst, client);
delete(event.show_formspec.formspec); delete(event.show_formspec.formspec);
delete(event.show_formspec.formname); delete(event.show_formspec.formname);
@ -3437,7 +3430,7 @@ void Game::updateCamera(VolatileRunFlags *flags, u32 busy_time,
tool_reload_ratio = MYMIN(tool_reload_ratio, 1.0); tool_reload_ratio = MYMIN(tool_reload_ratio, 1.0);
camera->update(player, dtime, busy_time / 1000.0f, tool_reload_ratio, camera->update(player, dtime, busy_time / 1000.0f, tool_reload_ratio,
client->getEnv()); client->getEnv());
camera->step(dtime); camera->step(dtime);
v3f camera_position = camera->getPosition(); v3f camera_position = camera->getPosition();
@ -3467,13 +3460,13 @@ void Game::updateSound(f32 dtime)
// Update sound listener // Update sound listener
v3s16 camera_offset = camera->getOffset(); v3s16 camera_offset = camera->getOffset();
sound->updateListener(camera->getCameraNode()->getPosition() + intToFloat(camera_offset, BS), sound->updateListener(camera->getCameraNode()->getPosition() + intToFloat(camera_offset, BS),
v3f(0, 0, 0), // velocity v3f(0, 0, 0), // velocity
camera->getDirection(), camera->getDirection(),
camera->getCameraNode()->getUpVector()); camera->getCameraNode()->getUpVector());
sound->setListenerGain(g_settings->getFloat("sound_volume")); sound->setListenerGain(g_settings->getFloat("sound_volume"));
// Update sound maker // Update sound maker
soundmaker->step(dtime); soundmaker->step(dtime);
LocalPlayer *player = client->getEnv().getLocalPlayer(); LocalPlayer *player = client->getEnv().getLocalPlayer();
@ -3526,7 +3519,7 @@ void Game::processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
camera_position + camera_direction * BS * (d + 1)); camera_position + camera_direction * BS * (d + 1));
} else { } else {
// prevent player pointing anything in front-view // prevent player pointing anything in front-view
if (camera->getCameraMode() == CAMERA_MODE_THIRD_FRONT) if (camera->getCameraMode() == CAMERA_MODE_THIRD_FRONT)
shootline = core::line3d<f32>(0, 0, 0, 0, 0, 0); shootline = core::line3d<f32>(0, 0, 0, 0, 0, 0);
} }
@ -3572,7 +3565,7 @@ void Game::processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
if (runData->digging) { if (runData->digging) {
if (input->getLeftReleased()) { if (input->getLeftReleased()) {
infostream << "Left button released" infostream << "Left button released"
<< " (stopped digging)" << std::endl; << " (stopped digging)" << std::endl;
runData->digging = false; runData->digging = false;
} else if (pointed != runData->pointed_old) { } else if (pointed != runData->pointed_old) {
if (pointed.type == POINTEDTHING_NODE if (pointed.type == POINTEDTHING_NODE
@ -3583,7 +3576,7 @@ void Game::processPlayerInteraction(std::vector<aabb3f> &highlight_boxes,
// Don't reset. // Don't reset.
} else { } else {
infostream << "Pointing away from node" infostream << "Pointing away from node"
<< " (stopped digging)" << std::endl; << " (stopped digging)" << std::endl;
runData->digging = false; runData->digging = false;
} }
} }
@ -3710,7 +3703,7 @@ void Game::handlePointingAtNode(GameRunData *runData,
TextDest *txt_dst = new TextDestNodeMetadata(nodepos, client); TextDest *txt_dst = new TextDestNodeMetadata(nodepos, client);
create_formspec_menu(&current_formspec, client, gamedef, create_formspec_menu(&current_formspec, client, gamedef,
texture_src, device, fs_src, txt_dst, client); texture_src, device, fs_src, txt_dst, client);
current_formspec->setFormSpec(meta->getString("formspec"), inventoryloc); current_formspec->setFormSpec(meta->getString("formspec"), inventoryloc);
} else { } else {
@ -3959,7 +3952,7 @@ void Game::updateFrame(std::vector<aabb3f> &highlight_boxes,
direct_brightness = client->getEnv().getClientMap() direct_brightness = client->getEnv().getClientMap()
.getBackgroundBrightness(MYMIN(runData->fog_range * 1.2, 60 * BS), .getBackgroundBrightness(MYMIN(runData->fog_range * 1.2, 60 * BS),
daynight_ratio, (int)(old_brightness * 255.5), &sunlight_seen) daynight_ratio, (int)(old_brightness * 255.5), &sunlight_seen)
/ 255.0; / 255.0;
} }
float time_of_day = runData->time_of_day; float time_of_day = runData->time_of_day;
@ -3998,7 +3991,7 @@ void Game::updateFrame(std::vector<aabb3f> &highlight_boxes,
clouds->setVisible(true); clouds->setVisible(true);
clouds->step(dtime); clouds->step(dtime);
clouds->update(v2f(player_position.X, player_position.Z), clouds->update(v2f(player_position.X, player_position.Z),
sky->getCloudColor()); sky->getCloudColor());
} else { } else {
clouds->setVisible(false); clouds->setVisible(false);
} }
@ -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);
} }
@ -4420,20 +4421,20 @@ void Game::extendedResourceCleanup()
// Extended resource accounting // Extended resource accounting
infostream << "Irrlicht resources after cleanup:" << std::endl; infostream << "Irrlicht resources after cleanup:" << std::endl;
infostream << "\tRemaining meshes : " infostream << "\tRemaining meshes : "
<< device->getSceneManager()->getMeshCache()->getMeshCount() << std::endl; << device->getSceneManager()->getMeshCache()->getMeshCount() << std::endl;
infostream << "\tRemaining textures : " infostream << "\tRemaining textures : "
<< driver->getTextureCount() << std::endl; << driver->getTextureCount() << std::endl;
for (unsigned int i = 0; i < driver->getTextureCount(); i++) { for (unsigned int i = 0; i < driver->getTextureCount(); i++) {
irr::video::ITexture *texture = driver->getTextureByIndex(i); irr::video::ITexture *texture = driver->getTextureByIndex(i);
infostream << "\t\t" << i << ":" << texture->getName().getPath().c_str() infostream << "\t\t" << i << ":" << texture->getName().getPath().c_str()
<< std::endl; << std::endl;
} }
clearTextureNameCache(); clearTextureNameCache();
infostream << "\tRemaining materials: " infostream << "\tRemaining materials: "
<< driver-> getMaterialRendererCount() << driver-> getMaterialRendererCount()
<< " (note: irrlicht doesn't support removing renderers)" << std::endl; << " (note: irrlicht doesn't support removing renderers)" << std::endl;
} }
@ -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 */