Merge and Fix

master
Maksim Gamarnik 2015-12-11 11:18:54 +02:00
parent ba2e36fd37
commit a31fbaa334
13 changed files with 250 additions and 65 deletions

View File

@ -95,7 +95,7 @@ OPENSSL_TIMESTAMP = $(OPENSSL_DIR)timestamp
OPENSSL_TIMESTAMP_INT = $(ROOT)/deps/openssl_timestamp
OPENSSL_URL = http://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz
CURL_VERSION = 7.45.0
CURL_VERSION = 7.46.0
CURL_DIR = $(ROOT)/deps/curl-$(CURL_VERSION)
CURL_LIB = $(CURL_DIR)/lib/.libs/libcurl.a
CURL_TIMESTAMP = $(CURL_DIR)/timestamp

View File

@ -349,6 +349,7 @@ LOCAL_SRC_FILES += deps/sqlite/sqlite3.c
# Threading
LOCAL_SRC_FILES += \
jni/src/threading/event.cpp \
jni/src/threading/mutex.cpp \
jni/src/threading/semaphore.cpp \
jni/src/threading/thread.cpp

View File

@ -401,13 +401,13 @@ pause_fps_max (FPS in pause menu) int 20
viewing_range_nodes_max (Viewing range maximum) int 160
# The allowed adjustment range for the automatic rendering range adjustment.
# Set this to be equal to viewing range minimum to disable the auto-adjustment algorithm.
# Set this to be equal to viewing range maximum to disable the auto-adjustment algorithm.
viewing_range_nodes_min (Viewing range minimum) int 35
# Vertical initial window size.
# Width component of the initial window size.
screenW (Screen width) int 800
# Horizontal initial window size.
# Height component of the initial window size.
screenH (Screen height) int 600
# Fullscreen mode.

View File

@ -47,15 +47,29 @@ vec4 get_normal_map(vec2 uv)
float find_intersection(vec2 dp, vec2 ds)
{
const float depth_step = 1.0 / 24.0;
float depth = 1.0;
for (int i = 0 ; i < 24 ; i++) {
float best_depth = 0.0;
float size = 0.0625;
for (int i = 0; i < 15; i++) {
depth -= size;
float h = texture2D(normalTexture, dp + ds * depth).a;
if (h >= depth)
if (depth <= h) {
best_depth = depth;
break;
depth -= depth_step;
}
}
return depth;
depth = best_depth;
for (int i = 0; i < 4; i++) {
size *= 0.5;
float h = texture2D(normalTexture,dp + ds * depth).a;
if (depth <= h) {
best_depth = depth;
depth += size;
} else {
depth -= size;
}
}
return best_depth;
}
float find_intersectionRGB(vec2 dp, vec2 ds)

View File

@ -459,15 +459,15 @@
# viewing_range_nodes_max = 160
# The allowed adjustment range for the automatic rendering range adjustment.
# Set this to be equal to viewing range minimum to disable the auto-adjustment algorithm.
# Set this to be equal to viewing range maximum to disable the auto-adjustment algorithm.
# type: int
# viewing_range_nodes_min = 35
# Vertical initial window size.
# Width component of the initial window size.
# type: int
# screenW = 800
# Horizontal initial window size.
# Height component of the initial window size.
# type: int
# screenH = 600
@ -1187,6 +1187,127 @@
# type: noise_params
# mgv7_np_cave2 = 0, 12, (100, 100, 100), 10325, 4, 0.5, 2.0
#### Mapgen flat
# Map generation attributes specific to Mapgen flat.
# Occasional lakes and hills added to the flat world.
# Flags that are not specified in the flag string are not modified from the default.
# Flags starting with "no" are used to explicitly disable them.
# type: flags possible values: lakes, hills, nolakes, nohills
# mgflat_spflags = nolakes,nohills
# Y of flat ground.
# type: int
# mgflat_ground_level = 8
# Y of upper limit of large pseudorandom caves.
# type: int
# mgflat_large_cave_depth = -33
# Terrain noise threshold for lakes.
# Controls proportion of world area covered by lakes.
# Adjust towards 0.0 for a larger proportion.
# type: float
# mgflat_lake_threshold = -0.45
# Controls steepness/depth of lake depressions.
# type: float
# mgflat_lake_steepness = 48.0
# Terrain noise threshold for hills.
# Controls proportion of world area covered by hills.
# Adjust towards 0.0 for a larger proportion.
# type: float
# mgflat_hill_threshold = 0.45
# Controls steepness/height of hills.
# type: float
# mgflat_hill_steepness = 64.0
# Determines terrain shape.
# The 3 numbers in brackets control the scale of the
# terrain, the 3 numbers should be identical.
# type: noise_params
# mgflat_np_terrain = 0, 1, (600, 600, 600), 7244, 5, 0.6, 2.0
# type: noise_params
# mgflat_np_filler_depth = 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0
# type: noise_params
# mgflat_np_cave1 = 0, 12, (128, 128, 128), 52534, 4, 0.5, 2.0
# type: noise_params
# mgflat_np_cave2 = 0, 12, (128, 128, 128), 10325, 4, 0.5, 2.0
#### Mapgen fractal
# Choice of 8 4-dimensional fractals.
# 1 = "Roundy" mandelbrot set.
# 2 = "Roundy" julia set.
# 3 = "Squarry" mandelbrot set.
# 4 = "Squarry" julia set.
# 5 = "Mandy Cousin" mandelbrot set.
# 6 = "Mandy Cousin" julia set.
# 7 = "Variation" mandelbrot set.
# 8 = "Variation" julia set.
# type: int min: 1 max: 8
# mgfractal_formula = 1
# Iterations of the recursive function.
# Controls scale of finest detail.
# type: int
# mgfractal_iterations = 11
# Approximate (X,Y,Z) scale of fractal in nodes.
# type: v3f
# mgfractal_scale = (4096.0, 1024.0, 4096.0)
# (X,Y,Z) offset of fractal from world centre.
# Used to move a suitable spawn area of low land close to (0, 0).
# The default is suitable for mandelbrot sets, it needs to be edited for julia sets,
# do this by greatly reducing 'scale' and setting 'offset' initially to (0, 0, 0).
# Range roughly -2 to 2. Multiply by 'scale' for offset in nodes.
# type: v3f
# mgfractal_offset = (1.79, 0.0, 0.0)
# W co-ordinate of the generated 3D slice of the 4D shape.
# Alters the generated 3D shape.
# Range roughly -2 to 2.
# type: float
# mgfractal_slice_w = 0.0
# Julia set only: X value determining the 4D shape.
# Range roughly -2 to 2.
# type: float
# mgfractal_julia_x = 0.33
# Julia set only: Y value determining the 4D shape.
# Range roughly -2 to 2.
# type: float
# mgfractal_julia_y = 0.33
# Julia set only: Z value determining the 4D shape.
# Range roughly -2 to 2.
# type: float
# mgfractal_julia_z = 0.33
# Julia set only: W value determining the 4D shape.
# Range roughly -2 to 2.
# type: float
# mgfractal_julia_w = 0.33
# type: noise_params
# mgfractal_np_seabed = -14, 9, (600, 600, 600), 41900, 5, 0.6, 2.0
# type: noise_params
# mgfractal_np_filler_depth = 0, 1.2, (150, 150, 150), 261, 3, 0.7, 2.0
# type: noise_params
# mgfractal_np_cave1 = 0, 12, (128, 128, 128), 52534, 4, 0.5, 2.0
# type: noise_params
# mgfractal_np_cave2 = 0, 12, (128, 128, 128), 10325, 4, 0.5, 2.0
## Security
# Prevent mods from doing insecure things like running shell commands.

View File

@ -13,8 +13,8 @@
#if defined USE_CMAKE_CONFIG_H
#include "cmake_config.h"
#elif defined (__ANDROID__) || defined (ANDROID)
#define PROJECT_NAME "SnowCraft"
#define PROJECT_NAME_C "SnowCraft"
#define PROJECT_NAME "MultiCraft"
#define PROJECT_NAME_C "MultiCraft"
#define STATIC_SHAREDIR ""
#include "android_version.h"
#ifdef NDEBUG

View File

@ -308,8 +308,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("liquid_update", "1.0");
//mapgen stuff
settings->setDefault("mg_name", "v7");
//settings->setDefault("mg_name", "v6");
settings->setDefault("mg_name", "v6");
settings->setDefault("water_level", "1");
settings->setDefault("chunksize", "5");
settings->setDefault("mg_flags", "dungeons");
@ -337,9 +336,8 @@ void set_default_settings(Settings *settings)
settings->setDefault("fullscreen", "true");
settings->setDefault("enable_particles", "false");
settings->setDefault("video_driver", "ogles1");
//settings->setDefault("touchtarget", "false");
settings->setDefault("touchtarget", "true");
settings->setDefault("TMPFolder","/sdcard/" PROJECT_NAME_C "/tmp/");
settings->setDefault("TMPFolder","/sdcard/Android/data/net.MultiCraft.Official/tmp/");
settings->setDefault("touchscreen_threshold","20");
settings->setDefault("smooth_lighting", "false");
settings->setDefault("emergequeue_limit_diskonly", "8");

View File

@ -431,12 +431,12 @@ void draw_scene(video::IVideoDriver *driver, scene::ISceneManager *smgr,
bool draw_crosshair = ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) &&
(camera.getCameraMode() != CAMERA_MODE_THIRD_FRONT));
//#ifdef HAVE_TOUCHSCREENGUI
// try {
// draw_crosshair = !g_settings->getBool("touchtarget");
// }
// catch(SettingNotFoundException) {}
//#endif
#ifdef HAVE_TOUCHSCREENGUI
try {
draw_crosshair = !g_settings->getBool("touchtarget");
}
catch(SettingNotFoundException) {}
#endif
std::string draw_mode = g_settings->get("3d_mode");

View File

@ -1141,11 +1141,11 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
<< strgettext("Sound Volume") << "]";
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_key_config;"
<< strgettext("Change Keys") << "]";
#endif
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_menu;"
<< strgettext("Exit to Menu") << "]";
#endif
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
<< strgettext("Exit") << "]"
<< strgettext("Close game") << "]"
#ifndef __ANDROID__
<< "textarea[7.5,0.25;3.9,6.25;;" << control_text << ";]"
<< "textarea[0.4,0.25;3.5,6;;" << PROJECT_NAME_C "\n"

View File

@ -216,6 +216,45 @@ static std::string getAndroidPath(jclass cls, jobject obj, jclass cls_File,
return javaStringToUTF8(js_path);
}
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);
}
void initializePathsAndroid()
{
// Get Environment class
@ -230,8 +269,8 @@ void initializePathsAndroid()
cls_File, mt_getAbsPath, "getCacheDir");
path_storage = getAndroidPath(cls_Env, NULL, cls_File, mt_getAbsPath,
"getExternalStorageDirectory");
path_user = path_storage + DIR_DELIM + PROJECT_NAME_C;
path_share = path_storage + DIR_DELIM + PROJECT_NAME_C;
path_user = path_storage + DIR_DELIM + "Android/data/net.MultiCraft.Official/Files";
path_share = path_storage + DIR_DELIM + "Android/data/net.MultiCraft.Official/Files";
migrateCachePath();
}

View File

@ -185,11 +185,11 @@ fake_function() {
gettext("Viewing range maximum");
gettext("The allowed adjustment range for the automatic rendering range adjustment.\nSet this to be equal to viewing range minimum to disable the auto-adjustment algorithm.");
gettext("Viewing range minimum");
gettext("The allowed adjustment range for the automatic rendering range adjustment.\nSet this to be equal to viewing range minimum to disable the auto-adjustment algorithm.");
gettext("The allowed adjustment range for the automatic rendering range adjustment.\nSet this to be equal to viewing range maximum to disable the auto-adjustment algorithm.");
gettext("Screen width");
gettext("Vertical initial window size.");
gettext("Width component of the initial window size.");
gettext("Screen height");
gettext("Horizontal initial window size.");
gettext("Height component of the initial window size.");
gettext("Full screen");
gettext("Fullscreen mode.");
gettext("Full screen BPP");
@ -424,7 +424,7 @@ fake_function() {
gettext("Map generation limit");
gettext("Where the map generator stops.\nPlease note:\n- Limited to 31000 (setting above has no effect)\n- The map generator works in groups of 80x80x80 nodes (5x5x5 MapBlocks).\n- Those groups have an offset of -32, -32 nodes from the origin.\n- Only groups which are within the map_generation_limit are generated");
gettext("Mapgen flags");
gettext("Global map generation attributes.\nFlags that are not specified in the flag string are not modified from the default.\nFlags starting with \"no\" are used to explicitly disable them.\n'trees' and 'flat' flags only have effect in mgv6.");
gettext("Global map generation attributes.\nIn Mapgen v6 the 'decorations' flag controls all decorations except trees\nand junglegrass, in all other mapgens this flag controls all decorations.\nFlags that are not specified in the flag string are not modified from the default.\nFlags starting with \"no\" are used to explicitly disable them.");
gettext("Advanced");
gettext("Chunk size");
gettext("Size of chunks to be generated at once by mapgen, stated in mapblocks (16 nodes).");
@ -480,33 +480,45 @@ fake_function() {
gettext("Mapgen v7 ridge noise parameters");
gettext("Mapgen v7 cave1 noise parameters");
gettext("Mapgen v7 cave2 noise parameters");
gettext("Mapgen flat");
gettext("Mapgen flat flags");
gettext("Map generation attributes specific to Mapgen flat.\nOccasional lakes and hills added to the flat world.\nFlags that are not specified in the flag string are not modified from the default.\nFlags starting with \"no\" are used to explicitly disable them.");
gettext("Mapgen flat ground level");
gettext("Y of flat ground.");
gettext("Mapgen flat large cave depth");
gettext("Y of upper limit of large pseudorandom caves.");
gettext("Mapgen flat lake threshold");
gettext("Terrain noise threshold for lakes.\nControls proportion of world area covered by lakes.\nAdjust towards 0.0 for a larger proportion.");
gettext("Mapgen flat lake steepness");
gettext("Controls steepness/depth of lake depressions.");
gettext("Mapgen flat hill threshold");
gettext("Terrain noise threshold for hills.\nControls proportion of world area covered by hills.\nAdjust towards 0.0 for a larger proportion.");
gettext("Mapgen flat hill steepness");
gettext("Controls steepness/height of hills.");
gettext("Mapgen flat terrain noise parameters");
gettext("Determines terrain shape.\nThe 3 numbers in brackets control the scale of the\nterrain, the 3 numbers should be identical.");
gettext("Mapgen flat filler depth noise parameters");
gettext("Mapgen flat cave1 noise parameters");
gettext("Mapgen flat cave2 noise parameters");
gettext("Mapgen fractal");
gettext("Mapgen fractal flags");
gettext("Map generation attributes specific to Mapgen fractal.\n'julia' selects a julia set to be generated instead of a mandelbrot set.\nFlags that are not specified in the flag string are not modified from the default.\nFlags starting with \"no\" are used to explicitly disable them.");
gettext("Mapgen fractal mandelbrot iterations");
gettext("Mandelbrot set: Iterations of the recursive function.\nControls scale of finest detail.");
gettext("Mapgen fractal mandelbrot scale");
gettext("Mandelbrot set: Approximate (X,Y,Z) scales in nodes.");
gettext("Mapgen fractal mandelbrot offset");
gettext("Mandelbrot set: (X,Y,Z) offsets from world centre.\nRange roughly -2 to 2, multiply by m_scale for offsets in nodes.");
gettext("Mapgen fractal mandelbrot slice w");
gettext("Mandelbrot set: W co-ordinate of the generated 3D slice of the 4D shape.\nRange roughly -2 to 2.");
gettext("Mapgen fractal julia iterations");
gettext("Julia set: Iterations of the recursive function.\nControls scale of finest detail.");
gettext("Mapgen fractal julia scale");
gettext("Julia set: Approximate (X,Y,Z) scales in nodes.");
gettext("Mapgen fractal julia offset");
gettext("Julia set: (X,Y,Z) offsets from world centre.\nRange roughly -2 to 2, multiply by j_scale for offsets in nodes.");
gettext("Mapgen fractal julia slice w");
gettext("Julia set: W co-ordinate of the generated 3D slice of the 4D shape.\nRange roughly -2 to 2.");
gettext("Mapgen fractal formula");
gettext("Choice of 8 4-dimensional fractals.\n1 = \"Roundy\" mandelbrot set.\n2 = \"Roundy\" julia set.\n3 = \"Squarry\" mandelbrot set.\n4 = \"Squarry\" julia set.\n5 = \"Mandy Cousin\" mandelbrot set.\n6 = \"Mandy Cousin\" julia set.\n7 = \"Variation\" mandelbrot set.\n8 = \"Variation\" julia set.");
gettext("Mapgen fractal iterations");
gettext("Iterations of the recursive function.\nControls scale of finest detail.");
gettext("Mapgen fractal scale");
gettext("Approximate (X,Y,Z) scale of fractal in nodes.");
gettext("Mapgen fractal offset");
gettext("(X,Y,Z) offset of fractal from world centre.\nUsed to move a suitable spawn area of low land close to (0, 0).\nThe default is suitable for mandelbrot sets, it needs to be edited for julia sets,\ndo this by greatly reducing 'scale' and setting 'offset' initially to (0, 0, 0).\nRange roughly -2 to 2. Multiply by 'scale' for offset in nodes.");
gettext("Mapgen fractal slice w");
gettext("W co-ordinate of the generated 3D slice of the 4D shape.\nAlters the generated 3D shape.\nRange roughly -2 to 2.");
gettext("Mapgen fractal julia x");
gettext("Julia set: X value determining the 4D shape.\nRange roughly -2 to 2.");
gettext("Julia set only: X value determining the 4D shape.\nRange roughly -2 to 2.");
gettext("Mapgen fractal julia y");
gettext("Julia set: Y value determining the 4D shape.\nRange roughly -2 to 2.");
gettext("Julia set only: Y value determining the 4D shape.\nRange roughly -2 to 2.");
gettext("Mapgen fractal julia z");
gettext("Julia set: Z value determining the 4D shape.\nRange roughly -2 to 2.");
gettext("Julia set only: Z value determining the 4D shape.\nRange roughly -2 to 2.");
gettext("Mapgen fractal julia w");
gettext("Julia set: W value determining the 4D shape.\nRange roughly -2 to 2.");
gettext("Julia set only: W value determining the 4D shape.\nRange roughly -2 to 2.");
gettext("Mapgen fractal seabed noise parameters");
gettext("Mapgen fractal filler depth noise parameters");
gettext("Mapgen fractal cave1 noise parameters");

View File

@ -52,11 +52,11 @@ const char *touchgui_button_imagenames[] = {
"fly_btn.png",
"noclip_btn.png",
#endif
// "minimap_btn.png",
"minimap_btn.png",
"debug_btn.png",
"chat_btn.png",
// "camera_btn.png",
// "rangeview_btn.png"
"rangeview_btn.png"
};
static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
@ -98,9 +98,9 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
key = "fast";
break;
#endif
/* case minimap_id:
case minimap_id:
key = "minimap";
break;*/
break;
case debug_id:
key = "toggle_debug";
break;
@ -110,9 +110,9 @@ static irr::EKEY_CODE id2keycode(touch_gui_button_id id)
/* case camera_id:
key = "camera_mode";
break;*/
/* case range_id:
case range_id:
key = "rangeselect";
break;*/
break;
}
assert(key != "");
return keyname_to_keycode(g_settings->get("keymap_" + key).c_str());
@ -299,12 +299,12 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
L"fast", false, SLOW_BUTTON_REPEAT);
#endif
/* init minimap button */
/* initButton(minimap_id,
initButton(minimap_id,
rect<s32>(m_screensize.X - (0.75*button_size),
m_screensize.Y - (4*button_size),
m_screensize.X,
m_screensize.Y - (button_size*3.25)),
L"minimap", false, SLOW_BUTTON_REPEAT);*/
L"minimap", false, SLOW_BUTTON_REPEAT);
#ifndef NDEBUG
/* init debug button */
initButton(debug_id,
@ -326,12 +326,12 @@ void TouchScreenGUI::init(ISimpleTextureSource* tsrc, float density)
L"cam", false, SLOW_BUTTON_REPEAT);*/
/* init rangeselect button */
/* initButton(range_id,
initButton(range_id,
rect<s32>(0, 0,
0.75*button_size, 0.75*button_size),*/
/*rect<s32>(0.78 * button_size, 0,
1.5 * button_size, 0.75*button_size+0.03),*/
/*L"far", false, SLOW_BUTTON_REPEAT);*/
L"far", false, SLOW_BUTTON_REPEAT);
}
touch_gui_button_id TouchScreenGUI::getButtonID(s32 x, s32 y)

View File

@ -49,7 +49,7 @@ typedef enum {
noclip_id,
fast_id,
#endif
// minimap_id,
minimap_id,
debug_id,
chat_id,
// camera_id,