Compare commits
202 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7993a403f2 | ||
|
|
b0df67d9c0 | ||
|
|
45ff8569d7 | ||
|
|
82bfa2ee7b | ||
|
|
9ef2e5000f | ||
|
|
678546308e | ||
|
|
6f688c50ee | ||
|
|
bb603ff18e | ||
|
|
4208fdfd22 | ||
|
|
4875213168 | ||
|
|
f92540e8ad | ||
|
|
ec0bf899ed | ||
|
|
2b635a892c | ||
|
|
7f6fc148bd | ||
|
|
878e9f7594 | ||
|
|
c7249f5983 | ||
|
|
7f07858209 | ||
|
|
9e9688fc61 | ||
|
|
93e5ab367a | ||
|
|
60fa5807b9 | ||
|
|
9dbca41385 | ||
|
|
61588a43dd | ||
|
|
e62927ed71 | ||
|
|
15c037614f | ||
|
|
a0535d286b | ||
|
|
0904884ad4 | ||
|
|
1367e8ffff | ||
|
|
9e2a9b55e1 | ||
|
|
84c367bb46 | ||
|
|
8bbf106379 | ||
|
|
efeb372e95 | ||
|
|
bec5d3ab22 | ||
|
|
9a0dd47057 | ||
|
|
929e0b0ad8 | ||
|
|
5e075c3344 | ||
|
|
b56f1175a2 | ||
|
|
1b4aaa5f50 | ||
|
|
b4cdbc997f | ||
|
|
d902bd31c4 | ||
|
|
0118c111e8 | ||
|
|
43f102271d | ||
|
|
48fa893abd | ||
|
|
285655a878 | ||
|
|
38561023b4 | ||
|
|
4d15d63134 | ||
|
|
a8ec7876a6 | ||
|
|
ad690c46b1 | ||
|
|
80a7408e4d | ||
|
|
eeea454bff | ||
|
|
ca217d0416 | ||
|
|
47aca6f6d1 | ||
|
|
5b55deb1eb | ||
|
|
ed7c9c4cb8 | ||
|
|
2c4a5e1861 | ||
|
|
800d192702 | ||
|
|
f8bd1f3563 | ||
|
|
0ea843bbdb | ||
|
|
a555e2d9b0 | ||
|
|
aafbbcd537 | ||
|
|
a9f81b729b | ||
|
|
1702c34b64 | ||
|
|
70354ac20b | ||
|
|
408d9b72f0 | ||
|
|
a28055f8fd | ||
|
|
a6dd619938 | ||
|
|
5bcfe7ea6a | ||
|
|
db481e7232 | ||
|
|
60d745126f | ||
|
|
d4786d8d5d | ||
|
|
9b89f7aad7 | ||
|
|
38bd9e93a2 | ||
|
|
e36681101e | ||
|
|
976d0b2caa | ||
|
|
44e4f5ab6e | ||
|
|
6e9f287844 | ||
|
|
839c4a99cd | ||
|
|
7b17b9059e | ||
|
|
e80a044818 | ||
|
|
29514918f8 | ||
|
|
db3466dbe8 | ||
|
|
805c8e51e5 | ||
|
|
2f0a8f1c3e | ||
|
|
a39c136e69 | ||
|
|
2959d6b3da | ||
|
|
5481e38d0b | ||
|
|
e5b636712c | ||
|
|
46821f1156 | ||
|
|
5e58a95491 | ||
|
|
5aeeb219e3 | ||
|
|
9736548720 | ||
|
|
0330cec7ec | ||
|
|
77e20a0c21 | ||
|
|
c9669e90bb | ||
|
|
9f52149a11 | ||
|
|
eb6b6ff333 | ||
|
|
516f1bcd16 | ||
|
|
5cf911ffe1 | ||
|
|
148fffb0f2 | ||
|
|
bd0d786590 | ||
|
|
227e4807b4 | ||
|
|
e19dab2622 | ||
|
|
57f2fa57cd | ||
|
|
a4a6cc8eb1 | ||
|
|
0fd1ee0380 | ||
|
|
5d08ada224 | ||
|
|
c0066a75cd | ||
|
|
714a4f8507 | ||
|
|
b0efb8f3b2 | ||
|
|
c367f7301a | ||
|
|
a77c85fa6d | ||
|
|
c28a90dafb | ||
|
|
aed70cb0b6 | ||
|
|
2d9b311e7b | ||
|
|
25235a4324 | ||
|
|
b7c0e4b333 | ||
|
|
3b16103ca6 | ||
|
|
8089d89a51 | ||
|
|
30334b6b22 | ||
|
|
de3888ca09 | ||
|
|
3c8e372119 | ||
|
|
2ab97a7821 | ||
|
|
63867b1a37 | ||
|
|
e201620ee1 | ||
|
|
d576235409 | ||
|
|
7ad17a25f4 | ||
|
|
a3db918f78 | ||
|
|
d8cf64a202 | ||
|
|
56a89fd265 | ||
|
|
4a57ef12a1 | ||
|
|
50ce63b190 | ||
|
|
04d4a00393 | ||
|
|
2504da28af | ||
|
|
ef140eb7b0 | ||
|
|
2b8ed9e80c | ||
|
|
42f3515c0e | ||
|
|
0f1d33933d | ||
|
|
efdb9da619 | ||
|
|
083d19b3fc | ||
|
|
ef0a4e3614 | ||
|
|
beb6b3e593 | ||
|
|
2d849b0a19 | ||
|
|
7289d61e99 | ||
|
|
00bca11f59 | ||
|
|
3bdf3df223 | ||
|
|
091594e26e | ||
|
|
bdcf03ae36 | ||
|
|
a92c083011 | ||
|
|
cd4d213ae0 | ||
|
|
663e42ca3f | ||
|
|
21ee434832 | ||
|
|
bf5d6e670a | ||
|
|
64cdbae6df | ||
|
|
6fdb32361a | ||
|
|
8eb9cebdd0 | ||
|
|
ef8ed5d127 | ||
|
|
7233a1228e | ||
|
|
060ae29eaf | ||
|
|
3c3887bb19 | ||
|
|
d91559b8f0 | ||
|
|
800d912b6f | ||
|
|
0db73bd83e | ||
|
|
35149a10e3 | ||
|
|
aaec558f85 | ||
|
|
7452d5399b | ||
|
|
938a3f2976 | ||
|
|
a3d7203be5 | ||
|
|
3d29be24e0 | ||
|
|
2414580754 | ||
|
|
53bc56dc3c | ||
|
|
9b0d77a549 | ||
|
|
b589353d89 | ||
|
|
cfec470b51 | ||
|
|
c6df2bc42c | ||
|
|
f12118c38b | ||
|
|
0974337804 | ||
|
|
ca89e63b27 | ||
|
|
5e2753c712 | ||
|
|
ff3cfb746e | ||
|
|
a79a116ac8 | ||
|
|
62feade05d | ||
|
|
4150e533b3 | ||
|
|
101baf620c | ||
|
|
3993102e88 | ||
|
|
5038b9aaec | ||
|
|
9eb492229b | ||
|
|
cc3ab5efa5 | ||
|
|
3c637b4baf | ||
|
|
acb3519502 | ||
|
|
ab55da589c | ||
|
|
86cfbc21da | ||
|
|
91c00d29a5 | ||
|
|
863379a4c6 | ||
|
|
c5faa64405 | ||
|
|
570c2042b1 | ||
|
|
61dfa912f5 | ||
|
|
900fa26965 | ||
|
|
8c98f497d9 | ||
|
|
8334100fe1 | ||
|
|
ae2721f2c8 | ||
|
|
08d259cf41 | ||
|
|
b67f37f27e | ||
|
|
3ea5ed4ffe |
@@ -12,7 +12,7 @@ set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
|
||||
# Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
|
||||
set(VERSION_MAJOR 0)
|
||||
set(VERSION_MINOR 4)
|
||||
set(VERSION_PATCH 11)
|
||||
set(VERSION_PATCH 12)
|
||||
set(VERSION_PATCH_ORIG ${VERSION_PATCH})
|
||||
|
||||
if(VERSION_EXTRA)
|
||||
|
||||
34
README.txt
34
README.txt
@@ -103,18 +103,32 @@ Compiling on GNU/Linux:
|
||||
-----------------------
|
||||
|
||||
Install dependencies. Here's an example for Debian/Ubuntu:
|
||||
$ apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng12-dev libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev
|
||||
$ apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng12-dev libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libjsoncpp-dev
|
||||
|
||||
Download source, extract (this is the URL to the latest of source repository, which might not work at all times):
|
||||
$ wget https://github.com/minetest/minetest/tarball/master -O master.tar.gz
|
||||
$ tar xf master.tar.gz
|
||||
$ cd minetest-minetest-286edd4 (or similar)
|
||||
You can install git for easily keeping your copy up to date.
|
||||
If you dont want git, read below on how to get the source without git.
|
||||
This is an example for installing git on Debian/Ubuntu:
|
||||
$ apt-get install git-core
|
||||
|
||||
Download minetest_game (otherwise only the "Minimal development test" game is available)
|
||||
Download source (this is the URL to the latest of source repository, which might not work at all times) using git:
|
||||
$ git clone --depth 1 https://github.com/minetest/minetest.git
|
||||
$ cd minetest
|
||||
|
||||
Download minetest_game (otherwise only the "Minimal development test" game is available) using git:
|
||||
$ cd games/
|
||||
$ wget https://github.com/minetest/minetest_game/tarball/master -O minetest_game.tar.gz
|
||||
$ tar xf minetest_game.tar.gz
|
||||
$ mv minetest-minetest_game-* minetest_game
|
||||
$ git clone --depth 1 https://github.com/minetest/minetest_game.git
|
||||
$ cd ..
|
||||
|
||||
Download source, without using git:
|
||||
$ wget https://github.com/minetest/minetest/archive/master.tar.gz
|
||||
$ tar xf master.tar.gz
|
||||
$ cd minetest-master
|
||||
|
||||
Download minetest_game, without using git:
|
||||
$ cd games/
|
||||
$ wget https://github.com/minetest/minetest_game/archive/master.tar.gz
|
||||
$ tar xf master.tar.gz
|
||||
$ mv minetest_game-master minetest_game
|
||||
$ cd ..
|
||||
|
||||
Build a version that runs directly from the source directory:
|
||||
@@ -227,7 +241,7 @@ Compiling on Windows:
|
||||
http://gnuwin32.sourceforge.net/downlinks/gettext.php
|
||||
- This is used for other UI languages. Feel free to leave it out.
|
||||
* And, of course, Minetest:
|
||||
http://minetest.net/download.php
|
||||
http://minetest.net/download
|
||||
- Steps:
|
||||
- Select a directory called DIR hereafter in which you will operate.
|
||||
- Make sure you have CMake and a compiler installed.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<activity android:name=".MtNativeActivity"
|
||||
android:label="Minetest"
|
||||
android:launchMode="singleTask"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|navigation"
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:clearTaskOnLaunch="true">
|
||||
<intent-filter>
|
||||
|
||||
@@ -20,11 +20,13 @@ PATHCFGFILE = path.cfg
|
||||
|
||||
ROOT = $(shell pwd)
|
||||
|
||||
GAMES_TO_COPY = minetest_game
|
||||
|
||||
################################################################################
|
||||
# Android Version code
|
||||
# Increase for each build!
|
||||
################################################################################
|
||||
ANDROID_VERSION_CODE = 5
|
||||
ANDROID_VERSION_CODE = 6
|
||||
|
||||
################################################################################
|
||||
# toolchain config for arm old processors
|
||||
@@ -34,6 +36,7 @@ TARGET_ABI = armeabi
|
||||
TARGET_LIBDIR = armeabi
|
||||
TARGET_TOOLCHAIN = arm-linux-androideabi-
|
||||
TARGET_CFLAGS_ADDON = -mfloat-abi=softfp -mfpu=vfp
|
||||
TARGET_ARCH = arm
|
||||
CROSS_PREFIX = arm-linux-androideabi-
|
||||
COMPILER_VERSION = 4.8
|
||||
HAVE_LEVELDB = 1
|
||||
@@ -49,6 +52,7 @@ HAVE_LEVELDB = 1
|
||||
# -mfloat-abi=hard -march=armv7-a
|
||||
#TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON)
|
||||
#TARGET_LDFLAGS_ADDON = -Wl,--no-warn-mismatch -lm_hard
|
||||
#TARGET_ARCH = armv7
|
||||
#CROSS_PREFIX = arm-linux-androideabi-
|
||||
#COMPILER_VERSION = 4.8
|
||||
#HAVE_LEVELDB = 1
|
||||
@@ -60,6 +64,7 @@ HAVE_LEVELDB = 1
|
||||
#TARGET_ABI = mips
|
||||
#TARGET_LIBDIR = mips
|
||||
#TARGET_TOOLCHAIN = mipsel-linux-android-
|
||||
#TARGET_ARCH = mips32
|
||||
#CROSS_PREFIX = mipsel-linux-android-
|
||||
#COMPILER_VERSION = 4.8
|
||||
#HAVE_LEVELDB = 0
|
||||
@@ -72,6 +77,7 @@ HAVE_LEVELDB = 1
|
||||
#TARGET_LIBDIR = x86
|
||||
#TARGET_TOOLCHAIN = x86-
|
||||
#CROSS_PREFIX = i686-linux-android-
|
||||
#TARGET_ARCH = x86
|
||||
#COMPILER_VERSION = 4.8
|
||||
#HAVE_LEVELDB = 1
|
||||
|
||||
@@ -103,14 +109,15 @@ IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)timestamp
|
||||
IRRLICHT_TIMESTAMP_INT = $(ROOT)/deps/irrlicht_timestamp
|
||||
IRRLICHT_URL_SVN = http://svn.code.sf.net/p/irrlicht/code/branches/ogl-es/
|
||||
|
||||
OPENSSL_BASEDIR = openssl-android
|
||||
OPENSSL_VERSION = 1.0.1j
|
||||
OPENSSL_BASEDIR = openssl-$(OPENSSL_VERSION)
|
||||
OPENSSL_DIR = $(ROOT)/deps/$(OPENSSL_BASEDIR)/
|
||||
OPENSSL_LIB = $(OPENSSL_DIR)libs/$(TARGET_ABI)/libopenssl.so
|
||||
OPENSSL_LIB = $(OPENSSL_DIR)/libssl.so.1.0.0
|
||||
OPENSSL_TIMESTAMP = $(OPENSSL_DIR)timestamp
|
||||
OPENSSL_TIMESTAMP_INT = $(ROOT)/deps/openssl_timestamp
|
||||
OPENSSL_URL_GIT = https://github.com/wobbals/openssl-android
|
||||
OPENSSL_URL = http://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz
|
||||
|
||||
CURL_VERSION = 7.35.0
|
||||
CURL_VERSION = 7.40.0
|
||||
CURL_DIR = $(ROOT)/deps/curl-$(CURL_VERSION)
|
||||
CURL_LIB = $(CURL_DIR)/lib/.libs/libcurl.a
|
||||
CURL_TIMESTAMP = $(CURL_DIR)/timestamp
|
||||
@@ -118,11 +125,14 @@ CURL_TIMESTAMP_INT = $(ROOT)/deps/curl_timestamp
|
||||
CURL_URL_HTTP = http://curl.haxx.se/download/curl-${CURL_VERSION}.tar.bz2
|
||||
|
||||
FREETYPE_DIR = $(ROOT)/deps/freetype2-android/
|
||||
FREETYPE_LIB = $(FREETYPE_DIR)/Android/obj/local/$(TARGER_ABI)/libfreetype2-static.a
|
||||
FREETYPE_LIB = $(FREETYPE_DIR)/Android/obj/local/$(TARGET_ABI)/libfreetype2-static.a
|
||||
FREETYPE_TIMESTAMP = $(FREETYPE_DIR)timestamp
|
||||
FREETYPE_TIMESTAMP_INT = $(ROOT)/deps/freetype_timestamp
|
||||
FREETYPE_URL_GIT = https://github.com/cdave1/freetype2-android
|
||||
|
||||
SQLITE3_FOLDER = sqlite-amalgamation-3080704
|
||||
SQLITE3_URL = http://www.sqlite.org/2014/$(SQLITE3_FOLDER).zip
|
||||
|
||||
-include $(PATHCFGFILE)
|
||||
|
||||
#use interim target variable to switch leveldb on or off
|
||||
@@ -133,7 +143,7 @@ endif
|
||||
.PHONY : debug release reconfig delconfig \
|
||||
leveldb_download clean_leveldb leveldb\
|
||||
irrlicht_download clean_irrlicht irrlicht \
|
||||
clean_assets assets \
|
||||
clean_assets assets sqlite3_download \
|
||||
freetype_download clean_freetype freetype \
|
||||
apk clean_apk \
|
||||
clean_all clean prep_srcdir \
|
||||
@@ -283,7 +293,10 @@ openssl_download :
|
||||
echo "openssl sources missing, downloading..."; \
|
||||
mkdir -p ${ROOT}/deps; \
|
||||
cd ${ROOT}/deps ; \
|
||||
git clone ${OPENSSL_URL_GIT} || exit 1; \
|
||||
wget ${OPENSSL_URL} || exit 1; \
|
||||
tar -xzf ${OPENSSL_BASEDIR}.tar.gz; \
|
||||
cd ${OPENSSL_BASEDIR}; \
|
||||
patch -p1 < ../../openssl_arch.patch; \
|
||||
fi
|
||||
|
||||
openssl : $(OPENSSL_LIB)
|
||||
@@ -298,24 +311,27 @@ $(OPENSSL_LIB): $(OPENSSL_TIMESTAMP)
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
export PATH=$$PATH:${SDKFOLDER}/platform-tools:${ANDROID_NDK}; \
|
||||
echo "changed timestamp for openssl detected building..."; \
|
||||
cd ${OPENSSL_DIR}; \
|
||||
cat jni/Application.mk | grep -v NDK_TOOLCHAIN_VERSION >jni/Application.mk.new;\
|
||||
mv jni/Application.mk.new jni/Application.mk; \
|
||||
ndk-build NDEBUG=${NDEBUG} NDK_MODULE_PATH=${NDK_MODULE_PATH} \
|
||||
APP_ABI=${TARGET_ABI} APP_PLATFORM=${APP_PLATFORM} -j${PARALLEL} \
|
||||
TARGET_CFLAGS+="${TARGET_CFLAGS_ADDON}" \
|
||||
TARGET_LDFLAGS+="${TARGET_LDFLAGS_ADDON}" \
|
||||
TARGET_CXXFLAGS+="${TARGET_CXXFLAGS_ADDON}" || exit 1; \
|
||||
ln -s ${OPENSSL_DIR} ../openssl; \
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-openssl; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--install-dir=$${TOOLCHAIN} --system=linux-x86_64; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
CC=${CROSS_PREFIX}gcc ./Configure android-${TARGET_ARCH} no-idea no-seed -no-sha0 -DL_ENDIAN;\
|
||||
CC=${CROSS_PREFIX}gcc ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make build_libs; \
|
||||
touch ${OPENSSL_TIMESTAMP}; \
|
||||
touch ${OPENSSL_TIMESTAMP_INT}; \
|
||||
$(RM) -rf $${TOOLCHAIN}; \
|
||||
else \
|
||||
echo "nothing to be done for openssl"; \
|
||||
fi
|
||||
|
||||
clean_openssl :
|
||||
$(RM) -rf ${OPENSSL_DIR}
|
||||
$(RM) -rf ${OPENSSL_DIR}; \
|
||||
$(RM) -rf $(ROOT)/deps/${OPENSSL_BASEDIR}.tar.gz; \
|
||||
$(RM) -rf $(ROOT)/deps/openssl
|
||||
|
||||
$(LEVELDB_TIMESTAMP) : leveldb_download
|
||||
@LAST_MODIF=$$(find ${LEVELDB_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
@@ -346,7 +362,7 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
|
||||
echo "changed timestamp for leveldb detected building..."; \
|
||||
cd deps/leveldb; \
|
||||
export CROSS_PREFIX=${CROSS_PREFIX}; \
|
||||
export TOOLCHAIN=/tmp/ndk-arm; \
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-leveldb; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--install-dir=$${TOOLCHAIN} --system=linux-x86_64; \
|
||||
@@ -360,6 +376,7 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
|
||||
$(MAKE) -j${PARALLEL} -s || exit 1; \
|
||||
touch ${LEVELDB_TIMESTAMP}; \
|
||||
touch ${LEVELDB_TIMESTAMP_INT}; \
|
||||
$(RM) -rf $${TOOLCHAIN}; \
|
||||
else \
|
||||
echo "nothing to be done for leveldb"; \
|
||||
fi
|
||||
@@ -482,6 +499,7 @@ curl_download :
|
||||
wget ${CURL_URL_HTTP} || exit 1; \
|
||||
tar -xjf curl-${CURL_VERSION}.tar.bz2 || exit 1; \
|
||||
rm curl-${CURL_VERSION}.tar.bz2; \
|
||||
ln -s curl-${CURL_VERSION} curl; \
|
||||
fi
|
||||
|
||||
curl : $(CURL_LIB)
|
||||
@@ -503,7 +521,7 @@ $(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB)
|
||||
echo "changed timestamp for curl detected building..."; \
|
||||
cd deps/curl-${CURL_VERSION}; \
|
||||
export CROSS_PREFIX=${CROSS_PREFIX}; \
|
||||
export TOOLCHAIN=/tmp/ndk-arm; \
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-curl; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--install-dir=$${TOOLCHAIN} --system=linux-x86_64; \
|
||||
@@ -512,20 +530,21 @@ $(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB)
|
||||
export CXX=${CROSS_PREFIX}g++; \
|
||||
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
|
||||
export CPPFLAGS="$${CPPFLAGS} -I${OPENSSL_DIR}/include \
|
||||
-L${OPENSSL_DIR}/libs/${TARGET_ABI}/ ${TARGET_CFLAGS_ADDON}"; \
|
||||
-L${OPENSSL_DIR} ${TARGET_CFLAGS_ADDON}"; \
|
||||
export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \
|
||||
export LDFLAGS="$${LDFLAGS} -L${OPENSSL_DIR}/libs/${TARGET_ABI}/ \
|
||||
${TARGET_LDFLAGS_ADDON}"; \
|
||||
export LDFLAGS="$${LDFLAGS} -L${OPENSSL_DIR} ${TARGET_LDFLAGS_ADDON}"; \
|
||||
./configure --host=${TARGET_HOST} --disable-shared --enable-static --with-ssl; \
|
||||
$(MAKE) -j${PARALLEL} -s || exit 1; \
|
||||
touch ${CURL_TIMESTAMP}; \
|
||||
touch ${CURL_TIMESTAMP_INT}; \
|
||||
$(RM) -rf $${TOOLCHAIN}; \
|
||||
else \
|
||||
echo "nothing to be done for curl"; \
|
||||
fi
|
||||
|
||||
clean_curl :
|
||||
$(RM) -rf deps/curl-${CURL_VERSION}
|
||||
$(RM) -rf deps/curl-${CURL_VERSION} \
|
||||
$(RM) -f deps/curl
|
||||
|
||||
|
||||
curl_binary:
|
||||
@@ -539,6 +558,18 @@ curl_binary:
|
||||
rm curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android.tar.gz; \
|
||||
fi
|
||||
|
||||
sqlite3_download: deps/${SQLITE3_FOLDER}/sqlite3.c
|
||||
|
||||
deps/${SQLITE3_FOLDER}/sqlite3.c :
|
||||
cd deps; \
|
||||
wget ${SQLITE3_URL}; \
|
||||
unzip ${SQLITE3_FOLDER}.zip; \
|
||||
ln -s ${SQLITE3_FOLDER} sqlite
|
||||
|
||||
clean_sqlite3:
|
||||
cd deps && $(RM) -rf ${SQLITE3_FOLDER} && $(RM) -f ${SQLITE3_FOLDER}.zip && \
|
||||
$(RM) -f sqlite
|
||||
|
||||
$(ASSETS_TIMESTAMP) : $(IRRLICHT_LIB)
|
||||
@mkdir -p ${ROOT}/deps; \
|
||||
LAST_MODIF=$$(find ${ROOT}/../../builtin -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
@@ -619,16 +650,25 @@ assets : $(ASSETS_TIMESTAMP)
|
||||
cp -r ${ROOT}/../../client ${ROOT}/assets/Minetest; \
|
||||
cp -r ${ROOT}/../../doc ${ROOT}/assets/Minetest; \
|
||||
cp -r ${ROOT}/../../fonts ${ROOT}/assets/Minetest; \
|
||||
cp -r ${ROOT}/../../games ${ROOT}/assets/Minetest; \
|
||||
mkdir ${ROOT}/assets/Minetest/games; \
|
||||
for game in ${GAMES_TO_COPY}; \
|
||||
do \
|
||||
cp -r ${ROOT}/../../games/$$game ${ROOT}/assets/Minetest/games/; \
|
||||
done; \
|
||||
cp -r ${ROOT}/../../mods ${ROOT}/assets/Minetest; \
|
||||
cp -r ${ROOT}/../../po ${ROOT}/assets/Minetest; \
|
||||
cp -r ${ROOT}/../../textures ${ROOT}/assets/Minetest; \
|
||||
mkdir -p ${ROOT}/assets/Minetest/media; \
|
||||
cp -r ${IRRLICHT_DIR}/media/Shaders ${ROOT}/assets/Minetest/media; \
|
||||
cd ${ROOT}/assets; \
|
||||
cd ${ROOT}/assets || exit 1; \
|
||||
find . -name "timestamp" -exec rm {} \; ; \
|
||||
find . -name "*.blend" -exec rm {} \; ; \
|
||||
find . -name "*~" -exec rm {} \; ; \
|
||||
find . -type d -path "*.git" -exec rm -rf {} \; ; \
|
||||
find . -type d -path "*.svn" -exec rm -rf {} \; ; \
|
||||
find . -type f -path "*.gitignore" -exec rm -rf {} \; ; \
|
||||
ls -R | grep ":$$" | sed -e 's/:$$//' -e 's/\.//' -e 's/^\///' > "index.txt"; \
|
||||
find Minetest >"filelist.txt"; \
|
||||
cp ${ROOT}/${ASSETS_TIMESTAMP} ${ROOT}/${ASSETS_TIMESTAMP}.old; \
|
||||
else \
|
||||
echo "nothing to be done for assets"; \
|
||||
@@ -638,7 +678,8 @@ clean_assets :
|
||||
@$(RM) -r assets
|
||||
|
||||
apk: $(PATHCFGFILE) assets $(IRRLICHT_LIB) $(CURL_LIB) $(LEVELDB_TARGET) \
|
||||
$(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ROOT)/jni/src/android_version.h
|
||||
$(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ROOT)/jni/src/android_version.h \
|
||||
sqlite3_download
|
||||
@export NDEBUG=$$NDEBUG; $(MAKE) -j${PARALLEL} manifest; \
|
||||
export PATH=$$PATH:${SDKFOLDER}/platform-tools:${ANDROID_NDK}; \
|
||||
export ANDROID_HOME=${SDKFOLDER}; \
|
||||
|
||||
@@ -16,7 +16,7 @@ endif
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := curl
|
||||
LOCAL_SRC_FILES := deps/curl-7.35.0/lib/.libs/libcurl.a
|
||||
LOCAL_SRC_FILES := deps/curl/lib/.libs/libcurl.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
@@ -41,13 +41,13 @@ include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := ssl
|
||||
LOCAL_SRC_FILES := deps/openssl-android/libs/$(TARGET_LIBDIR)/libssl.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
LOCAL_SRC_FILES := deps/openssl/libssl.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := crypto
|
||||
LOCAL_SRC_FILES := deps/openssl-android/libs/$(TARGET_LIBDIR)/libcrypto.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
LOCAL_SRC_FILES := deps/openssl/libcrypto.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
@@ -94,10 +94,11 @@ LOCAL_C_INCLUDES := \
|
||||
jni/src/cguittfont \
|
||||
deps/irrlicht/include \
|
||||
deps/freetype2-android/include \
|
||||
deps/curl-7.35.0/include \
|
||||
deps/curl/include \
|
||||
deps/openal-soft/jni/OpenAL/include \
|
||||
deps/libvorbis-libogg-android/jni/include \
|
||||
deps/leveldb/include \
|
||||
deps/sqlite/
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
jni/src/ban.cpp \
|
||||
@@ -290,7 +291,7 @@ LOCAL_SRC_FILES += \
|
||||
jni/src/lua/src/print.c
|
||||
|
||||
# sqlite
|
||||
LOCAL_SRC_FILES += jni/src/sqlite/sqlite3.c
|
||||
LOCAL_SRC_FILES += deps/sqlite/sqlite3.c
|
||||
|
||||
# jthread
|
||||
LOCAL_SRC_FILES += \
|
||||
@@ -302,8 +303,8 @@ LOCAL_SRC_FILES += \
|
||||
# json
|
||||
LOCAL_SRC_FILES += jni/src/json/jsoncpp.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := openal ogg vorbis ssl crypto
|
||||
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl android_native_app_glue $(PROFILER_LIBS)
|
||||
LOCAL_SHARED_LIBRARIES := openal ogg vorbis
|
||||
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl ssl crypto android_native_app_glue $(PROFILER_LIBS)
|
||||
|
||||
ifeq ($(HAVE_LEVELDB), 1)
|
||||
LOCAL_STATIC_LIBRARIES += LevelDB
|
||||
|
||||
11
build/android/openssl_arch.patch
Normal file
11
build/android/openssl_arch.patch
Normal file
@@ -0,0 +1,11 @@
|
||||
--- openssl-1.0.1j/Configure.orig 2014-10-15 14:53:39.000000000 +0200
|
||||
+++ openssl-1.0.1j/Configure 2015-01-03 22:41:43.505749921 +0100
|
||||
@@ -407,6 +407,8 @@
|
||||
"android","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"android-x86","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:".eval{my $asm=${x86_elf_asm};$asm=~s/:elf/:android/;$asm}.":dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
"android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
+"android-arm","gcc:-march=armv4 -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
+"android-mips32","gcc:-march=mips32 -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
|
||||
#### *BSD [do see comment about ${BSDthreads} above!]
|
||||
"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
|
||||
@@ -8,6 +8,8 @@ import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Vector;
|
||||
import java.util.Iterator;
|
||||
import java.lang.Object;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
@@ -19,11 +21,15 @@ import android.util.Log;
|
||||
import android.view.Display;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Paint;
|
||||
import android.text.TextPaint;
|
||||
|
||||
public class MinetestAssetCopy extends Activity {
|
||||
|
||||
public class MinetestAssetCopy extends Activity
|
||||
{
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.assetcopy);
|
||||
@@ -35,8 +41,24 @@ public class MinetestAssetCopy extends Activity {
|
||||
m_ProgressBar.getLayoutParams().width = (int) (display.getWidth() * 0.8);
|
||||
m_ProgressBar.invalidate();
|
||||
|
||||
m_AssetCopy = new copyAssetTask();
|
||||
m_AssetCopy.execute();
|
||||
/* check if there's already a copy in progress and reuse in case it is*/
|
||||
MinetestAssetCopy prevActivity =
|
||||
(MinetestAssetCopy) getLastNonConfigurationInstance();
|
||||
if(prevActivity!= null) {
|
||||
m_AssetCopy = prevActivity.m_AssetCopy;
|
||||
}
|
||||
else {
|
||||
m_AssetCopy = new copyAssetTask();
|
||||
m_AssetCopy.execute();
|
||||
}
|
||||
}
|
||||
|
||||
/* preserve asset copy background task to prevent restart of copying */
|
||||
/* this way of doing it is not recommended for latest android version */
|
||||
/* but the recommended way isn't available on android 2.x */
|
||||
public Object onRetainNonConfigurationInstance()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
ProgressBar m_ProgressBar;
|
||||
@@ -44,109 +66,53 @@ public class MinetestAssetCopy extends Activity {
|
||||
|
||||
copyAssetTask m_AssetCopy;
|
||||
|
||||
private class copyAssetTask extends AsyncTask<String, Integer, String>{
|
||||
|
||||
private void copyElement(String name, String path) {
|
||||
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
String full_path;
|
||||
if (path != "") {
|
||||
full_path = path + "/" + name;
|
||||
}
|
||||
else {
|
||||
full_path = name;
|
||||
}
|
||||
//is a folder read asset list
|
||||
if (m_foldernames.contains(full_path)) {
|
||||
m_Foldername = full_path;
|
||||
publishProgress(0);
|
||||
File current_folder = new File(baseDir + "/" + full_path);
|
||||
if (!current_folder.exists()) {
|
||||
if (!current_folder.mkdirs()) {
|
||||
Log.w("MinetestAssetCopy","\t failed create folder: " + baseDir + "/" + full_path);
|
||||
}
|
||||
else {
|
||||
Log.w("MinetestAssetCopy","\t created folder: " + baseDir + "/" + full_path);
|
||||
}
|
||||
}
|
||||
try {
|
||||
String[] current_assets = getAssets().list(full_path);
|
||||
for(int i=0; i < current_assets.length; i++) {
|
||||
copyElement(current_assets[i],full_path);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.w("MinetestAssetCopy","\t failed to read contents of folder");
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//is a file just copy
|
||||
else {
|
||||
boolean refresh = true;
|
||||
|
||||
File testme = new File(baseDir + "/" + full_path);
|
||||
|
||||
long asset_filesize = -1;
|
||||
long stored_filesize = -1;
|
||||
|
||||
if (testme.exists()) {
|
||||
try {
|
||||
AssetFileDescriptor fd = getAssets().openFd(full_path);
|
||||
asset_filesize = fd.getLength();
|
||||
fd.close();
|
||||
} catch (IOException e) {
|
||||
refresh = true;
|
||||
m_asset_size_unknown.add(full_path);
|
||||
}
|
||||
|
||||
stored_filesize = testme.length();
|
||||
|
||||
if (asset_filesize == stored_filesize) {
|
||||
refresh = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (refresh) {
|
||||
m_tocopy.add(full_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private long getFullSize(String filename) {
|
||||
private class copyAssetTask extends AsyncTask<String, Integer, String>
|
||||
{
|
||||
private long getFullSize(String filename)
|
||||
{
|
||||
long size = 0;
|
||||
try {
|
||||
InputStream src = getAssets().open(filename);
|
||||
byte[] buf = new byte[1024];
|
||||
|
||||
int len = 0;
|
||||
while ((len = src.read(buf)) > 0) {
|
||||
size += len;
|
||||
InputStream src = getAssets().open(filename);
|
||||
byte[] buf = new byte[4096];
|
||||
|
||||
int len = 0;
|
||||
while ((len = src.read(buf)) > 0)
|
||||
{
|
||||
size += len;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(String... files) {
|
||||
|
||||
protected String doInBackground(String... files)
|
||||
{
|
||||
m_foldernames = new Vector<String>();
|
||||
m_filenames = new Vector<String>();
|
||||
m_tocopy = new Vector<String>();
|
||||
m_asset_size_unknown = new Vector<String>();
|
||||
String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/";
|
||||
String baseDir =
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath()
|
||||
+ "/";
|
||||
|
||||
|
||||
// prepare temp folder
|
||||
File TempFolder = new File(baseDir + "Minetest/tmp/");
|
||||
|
||||
if (!TempFolder.exists()) {
|
||||
if (!TempFolder.exists())
|
||||
{
|
||||
TempFolder.mkdir();
|
||||
}
|
||||
else {
|
||||
File[] todel = TempFolder.listFiles();
|
||||
|
||||
for(int i=0; i < todel.length; i++) {
|
||||
Log.w("MinetestAssetCopy","deleting: " + todel[i].getAbsolutePath());
|
||||
for(int i=0; i < todel.length; i++)
|
||||
{
|
||||
Log.v("MinetestAssetCopy","deleting: " + todel[i].getAbsolutePath());
|
||||
todel[i].delete();
|
||||
}
|
||||
}
|
||||
@@ -156,52 +122,49 @@ public class MinetestAssetCopy extends Activity {
|
||||
OutputStream dst = new FileOutputStream(baseDir + "Minetest/.nomedia");
|
||||
dst.close();
|
||||
} catch (IOException e) {
|
||||
Log.w("MinetestAssetCopy","Failed to create .nomedia file");
|
||||
Log.e("MinetestAssetCopy","Failed to create .nomedia file");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
InputStream is = getAssets().open("index.txt");
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
|
||||
String line = reader.readLine();
|
||||
while(line != null){
|
||||
m_foldernames.add(line);
|
||||
line = reader.readLine();
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
copyElement("Minetest","");
|
||||
// build lists from prepared data
|
||||
BuildFolderList();
|
||||
BuildFileList();
|
||||
|
||||
// scan filelist
|
||||
ProcessFileList();
|
||||
|
||||
// doing work
|
||||
m_copy_started = true;
|
||||
m_ProgressBar.setMax(m_tocopy.size());
|
||||
|
||||
for (int i = 0; i < m_tocopy.size(); i++) {
|
||||
try {
|
||||
for (int i = 0; i < m_tocopy.size(); i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
String filename = m_tocopy.get(i);
|
||||
publishProgress(i);
|
||||
|
||||
boolean asset_size_unknown = false;
|
||||
long filesize = -1;
|
||||
|
||||
if (m_asset_size_unknown.contains(filename)) {
|
||||
if (m_asset_size_unknown.contains(filename))
|
||||
{
|
||||
File testme = new File(baseDir + "/" + filename);
|
||||
|
||||
if(testme.exists()) {
|
||||
if(testme.exists())
|
||||
{
|
||||
filesize = testme.length();
|
||||
}
|
||||
asset_size_unknown = true;
|
||||
}
|
||||
|
||||
InputStream src;
|
||||
try {
|
||||
try
|
||||
{
|
||||
src = getAssets().open(filename);
|
||||
} catch (IOException e) {
|
||||
Log.w("MinetestAssetCopy","Copying file: " + filename + " FAILED (not in assets)");
|
||||
// TODO Auto-generated catch block
|
||||
Log.e("MinetestAssetCopy","Copying file: " + filename + " FAILED (not in assets)");
|
||||
e.printStackTrace();
|
||||
continue;
|
||||
}
|
||||
@@ -211,32 +174,38 @@ public class MinetestAssetCopy extends Activity {
|
||||
int len = src.read(buf, 0, 1024);
|
||||
|
||||
/* following handling is crazy but we need to deal with */
|
||||
/* compressed assets.Flash chips limited livetime sue to */
|
||||
/* compressed assets.Flash chips limited livetime due to */
|
||||
/* write operations, we can't allow large files to destroy */
|
||||
/* users flash. */
|
||||
if (asset_size_unknown) {
|
||||
if ( (len > 0) && (len < buf.length) && (len == filesize)) {
|
||||
if (asset_size_unknown)
|
||||
{
|
||||
if ( (len > 0) && (len < buf.length) && (len == filesize))
|
||||
{
|
||||
src.close();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (len == buf.length) {
|
||||
if (len == buf.length)
|
||||
{
|
||||
src.close();
|
||||
long size = getFullSize(filename);
|
||||
if ( size == filesize) {
|
||||
if ( size == filesize)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
src = getAssets().open(filename);
|
||||
len = src.read(buf, 0, 1024);
|
||||
}
|
||||
}
|
||||
if (len > 0) {
|
||||
if (len > 0)
|
||||
{
|
||||
int total_filesize = 0;
|
||||
OutputStream dst;
|
||||
try {
|
||||
try
|
||||
{
|
||||
dst = new FileOutputStream(baseDir + "/" + filename);
|
||||
} catch (IOException e) {
|
||||
Log.w("MinetestAssetCopy","Copying file: " + baseDir +
|
||||
Log.e("MinetestAssetCopy","Copying file: " + baseDir +
|
||||
"/" + filename + " FAILED (couldn't open output file)");
|
||||
e.printStackTrace();
|
||||
src.close();
|
||||
@@ -245,43 +214,242 @@ public class MinetestAssetCopy extends Activity {
|
||||
dst.write(buf, 0, len);
|
||||
total_filesize += len;
|
||||
|
||||
while ((len = src.read(buf)) > 0) {
|
||||
while ((len = src.read(buf)) > 0)
|
||||
{
|
||||
dst.write(buf, 0, len);
|
||||
total_filesize += len;
|
||||
}
|
||||
|
||||
dst.close();
|
||||
Log.w("MinetestAssetCopy","Copied file: " + m_tocopy.get(i) + " (" + total_filesize + " bytes)");
|
||||
Log.v("MinetestAssetCopy","Copied file: " +
|
||||
m_tocopy.get(i) + " (" + total_filesize +
|
||||
" bytes)");
|
||||
}
|
||||
else if (len < 0) {
|
||||
Log.w("MinetestAssetCopy","Copying file: " + m_tocopy.get(i) + " failed, size < 0");
|
||||
else if (len < 0)
|
||||
{
|
||||
Log.e("MinetestAssetCopy","Copying file: " +
|
||||
m_tocopy.get(i) + " failed, size < 0");
|
||||
}
|
||||
src.close();
|
||||
} catch (IOException e) {
|
||||
Log.w("MinetestAssetCopy","Copying file: " + m_tocopy.get(i) + " failed");
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Log.e("MinetestAssetCopy","Copying file: " +
|
||||
m_tocopy.get(i) + " failed");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
protected void onProgressUpdate(Integer... progress) {
|
||||
if (m_copy_started) {
|
||||
|
||||
/**
|
||||
* update progress bar
|
||||
*/
|
||||
protected void onProgressUpdate(Integer... progress)
|
||||
{
|
||||
|
||||
if (m_copy_started)
|
||||
{
|
||||
boolean shortened = false;
|
||||
String todisplay = m_tocopy.get(progress[0]);
|
||||
m_ProgressBar.setProgress(progress[0]);
|
||||
m_Filename.setText(m_tocopy.get(progress[0]));
|
||||
|
||||
// make sure our text doesn't exceed our layout width
|
||||
Rect bounds = new Rect();
|
||||
Paint textPaint = m_Filename.getPaint();
|
||||
textPaint.getTextBounds(todisplay, 0, todisplay.length(), bounds);
|
||||
|
||||
while (bounds.width() > getResources().getDisplayMetrics().widthPixels * 0.7) {
|
||||
if (todisplay.length() < 2) {
|
||||
break;
|
||||
}
|
||||
todisplay = todisplay.substring(1);
|
||||
textPaint.getTextBounds(todisplay, 0, todisplay.length(), bounds);
|
||||
shortened = true;
|
||||
}
|
||||
|
||||
if (! shortened) {
|
||||
m_Filename.setText(todisplay);
|
||||
}
|
||||
else {
|
||||
m_Filename.setText(".." + todisplay);
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_Filename.setText("scanning " + m_Foldername + " ...");
|
||||
else
|
||||
{
|
||||
boolean shortened = false;
|
||||
String todisplay = m_Foldername;
|
||||
String full_text = "scanning " + todisplay + " ...";
|
||||
// make sure our text doesn't exceed our layout width
|
||||
Rect bounds = new Rect();
|
||||
Paint textPaint = m_Filename.getPaint();
|
||||
textPaint.getTextBounds(full_text, 0, full_text.length(), bounds);
|
||||
|
||||
while (bounds.width() > getResources().getDisplayMetrics().widthPixels * 0.7) {
|
||||
if (todisplay.length() < 2) {
|
||||
break;
|
||||
}
|
||||
todisplay = todisplay.substring(1);
|
||||
full_text = "scanning " + todisplay + " ...";
|
||||
textPaint.getTextBounds(full_text, 0, full_text.length(), bounds);
|
||||
shortened = true;
|
||||
}
|
||||
|
||||
if (! shortened) {
|
||||
m_Filename.setText(full_text);
|
||||
}
|
||||
else {
|
||||
m_Filename.setText("scanning .." + todisplay + " ...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void onPostExecute (String result) {
|
||||
/**
|
||||
* check al files and folders in filelist
|
||||
*/
|
||||
protected void ProcessFileList()
|
||||
{
|
||||
String FlashBaseDir =
|
||||
Environment.getExternalStorageDirectory().getAbsolutePath();
|
||||
|
||||
Iterator itr = m_filenames.iterator();
|
||||
|
||||
while (itr.hasNext())
|
||||
{
|
||||
String current_path = (String) itr.next();
|
||||
String FlashPath = FlashBaseDir + "/" + current_path;
|
||||
|
||||
if (isAssetFolder(current_path))
|
||||
{
|
||||
/* store information and update gui */
|
||||
m_Foldername = current_path;
|
||||
publishProgress(0);
|
||||
|
||||
/* open file in order to check if it's a folder */
|
||||
File current_folder = new File(FlashPath);
|
||||
if (!current_folder.exists())
|
||||
{
|
||||
if (!current_folder.mkdirs())
|
||||
{
|
||||
Log.e("MinetestAssetCopy","\t failed create folder: " +
|
||||
FlashPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.v("MinetestAssetCopy","\t created folder: " +
|
||||
FlashPath);
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/* if it's not a folder it's most likely a file */
|
||||
boolean refresh = true;
|
||||
|
||||
File testme = new File(FlashPath);
|
||||
|
||||
long asset_filesize = -1;
|
||||
long stored_filesize = -1;
|
||||
|
||||
if (testme.exists())
|
||||
{
|
||||
try
|
||||
{
|
||||
AssetFileDescriptor fd = getAssets().openFd(current_path);
|
||||
asset_filesize = fd.getLength();
|
||||
fd.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
refresh = true;
|
||||
m_asset_size_unknown.add(current_path);
|
||||
Log.e("MinetestAssetCopy","Failed to open asset file \"" +
|
||||
FlashPath + "\" for size check");
|
||||
}
|
||||
|
||||
stored_filesize = testme.length();
|
||||
|
||||
if (asset_filesize == stored_filesize)
|
||||
{
|
||||
refresh = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (refresh)
|
||||
{
|
||||
m_tocopy.add(current_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* read list of folders prepared on package build
|
||||
*/
|
||||
protected void BuildFolderList()
|
||||
{
|
||||
try
|
||||
{
|
||||
InputStream is = getAssets().open("index.txt");
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
|
||||
String line = reader.readLine();
|
||||
while (line != null)
|
||||
{
|
||||
m_foldernames.add(line);
|
||||
line = reader.readLine();
|
||||
}
|
||||
is.close();
|
||||
} catch (IOException e1)
|
||||
{
|
||||
Log.e("MinetestAssetCopy","Error on processing index.txt");
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* read list of asset files prepared on package build
|
||||
*/
|
||||
protected void BuildFileList()
|
||||
{
|
||||
long entrycount = 0;
|
||||
try
|
||||
{
|
||||
InputStream is = getAssets().open("filelist.txt");
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
|
||||
String line = reader.readLine();
|
||||
while (line != null)
|
||||
{
|
||||
m_filenames.add(line);
|
||||
line = reader.readLine();
|
||||
entrycount ++;
|
||||
}
|
||||
is.close();
|
||||
}
|
||||
catch (IOException e1)
|
||||
{
|
||||
Log.e("MinetestAssetCopy","Error on processing filelist.txt");
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
protected void onPostExecute (String result)
|
||||
{
|
||||
finish();
|
||||
}
|
||||
|
||||
protected boolean isAssetFolder(String path)
|
||||
{
|
||||
return m_foldernames.contains(path);
|
||||
}
|
||||
|
||||
boolean m_copy_started = false;
|
||||
String m_Foldername = "media";
|
||||
Vector<String> m_foldernames;
|
||||
Vector<String> m_filenames;
|
||||
Vector<String> m_tocopy;
|
||||
Vector<String> m_asset_size_unknown;
|
||||
}
|
||||
|
||||
@@ -155,33 +155,33 @@ function dump(o, indent, nested, level)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function string.split(str, delim, include_empty, max_splits)
|
||||
-- Localize functions to avoid table lookups (better performance).
|
||||
local table_insert = table.insert
|
||||
local str_sub, str_find = string.sub, string.find
|
||||
function string.split(str, delim, include_empty, max_splits, sep_is_pattern)
|
||||
delim = delim or ","
|
||||
max_splits = max_splits or 0
|
||||
local fields = {}
|
||||
local num_splits = 0
|
||||
local last_pos = 0
|
||||
for part, pos in str:gmatch("(.-)[" .. delim .. "]()") do
|
||||
last_pos = pos
|
||||
if include_empty or part ~= "" then
|
||||
num_splits = num_splits + 1
|
||||
fields[num_splits] = part
|
||||
if max_splits > 0 and num_splits + 1 >= max_splits then
|
||||
break
|
||||
end
|
||||
max_splits = max_splits or -1
|
||||
local items = {}
|
||||
local pos, len, seplen = 1, #str, #delim
|
||||
local plain = not sep_is_pattern
|
||||
max_splits = max_splits + 1
|
||||
repeat
|
||||
local np, npe = str_find(str, delim, pos, plain)
|
||||
np, npe = (np or (len+1)), (npe or (len+1))
|
||||
if (not np) or (max_splits == 1) then
|
||||
np = len + 1
|
||||
npe = np
|
||||
end
|
||||
end
|
||||
-- Handle the last field
|
||||
if max_splits <= 0 or num_splits <= max_splits then
|
||||
local last_part = str:sub(last_pos)
|
||||
if include_empty or last_part ~= "" then
|
||||
fields[num_splits + 1] = last_part
|
||||
local s = str_sub(str, pos, np - 1)
|
||||
if include_empty or (s ~= "") then
|
||||
max_splits = max_splits - 1
|
||||
table_insert(items, s)
|
||||
end
|
||||
end
|
||||
return fields
|
||||
pos = npe + 1
|
||||
until (max_splits == 0) or (pos > (len + 1))
|
||||
return items
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function file_exists(filename)
|
||||
local f = io.open(filename, "r")
|
||||
@@ -498,22 +498,58 @@ function core.explode_scrollbar_event(evt)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function core.pos_to_string(pos)
|
||||
return "(" .. pos.x .. "," .. pos.y .. "," .. pos.z .. ")"
|
||||
function core.pos_to_string(pos, decimal_places)
|
||||
local x = pos.x
|
||||
local y = pos.y
|
||||
local z = pos.z
|
||||
if decimal_places ~= nil then
|
||||
x = string.format("%." .. decimal_places .. "f", x)
|
||||
y = string.format("%." .. decimal_places .. "f", y)
|
||||
z = string.format("%." .. decimal_places .. "f", z)
|
||||
end
|
||||
return "(" .. x .. "," .. y .. "," .. z .. ")"
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function core.string_to_pos(value)
|
||||
if value == nil then
|
||||
return nil
|
||||
end
|
||||
|
||||
local p = {}
|
||||
p.x, p.y, p.z = string.match(value, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
|
||||
if p.x and p.y and p.z then
|
||||
p.x = tonumber(p.x)
|
||||
p.y = tonumber(p.y)
|
||||
p.z = tonumber(p.z)
|
||||
return p
|
||||
end
|
||||
local p = {}
|
||||
p.x, p.y, p.z = string.match(value, "^%( *([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+) *%)$")
|
||||
if p.x and p.y and p.z then
|
||||
p.x = tonumber(p.x)
|
||||
p.y = tonumber(p.y)
|
||||
p.z = tonumber(p.z)
|
||||
return p
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
assert(core.string_to_pos("10.0, 5, -2").x == 10)
|
||||
assert(core.string_to_pos("( 10.0, 5, -2)").z == -2)
|
||||
assert(core.string_to_pos("asd, 5, -2)") == nil)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function table.copy(t, seen)
|
||||
local n = {}
|
||||
seen = seen or {}
|
||||
seen[t] = n
|
||||
for k, v in pairs(t) do
|
||||
n[type(k) ~= "table" and k or seen[k] or table.copy(k, seen)] =
|
||||
type(v) ~= "table" and v or seen[v] or table.copy(v, seen)
|
||||
n[(type(k) == "table" and (seen[k] or table.copy(k, seen))) or k] =
|
||||
(type(v) == "table" and (seen[v] or table.copy(v, seen))) or v
|
||||
end
|
||||
return n
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- mainmenu only functions
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -528,7 +564,7 @@ if INIT == "mainmenu" then
|
||||
return nil
|
||||
end
|
||||
|
||||
function fgettext(text, ...)
|
||||
function fgettext_ne(text, ...)
|
||||
text = core.gettext(text)
|
||||
local arg = {n=select('#', ...), ...}
|
||||
if arg.n >= 1 then
|
||||
@@ -550,7 +586,11 @@ if INIT == "mainmenu" then
|
||||
end
|
||||
text = result
|
||||
end
|
||||
return core.formspec_escape(text)
|
||||
return text
|
||||
end
|
||||
|
||||
function fgettext(text, ...)
|
||||
return core.formspec_escape(fgettext_ne(text, ...))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ function core.serialize(x)
|
||||
function dump_val(x)
|
||||
local tp = type(x)
|
||||
if x == nil then return "nil"
|
||||
elseif tp == "number" then return tostring(x)
|
||||
elseif tp == "number" then return string.format("%d", x)
|
||||
elseif tp == "string" then return string.format("%q", x)
|
||||
elseif tp == "boolean" then return x and "true" or "false"
|
||||
elseif tp == "function" then
|
||||
@@ -140,7 +140,7 @@ function core.serialize(x)
|
||||
end
|
||||
return "{"..table.concat(vals, ", ").."}"
|
||||
else
|
||||
error("Can't serialize data of type "..t)
|
||||
error("Can't serialize data of type "..tp)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ function meta:__newindex(name, value)
|
||||
info.currentline, name)
|
||||
if not warned[warn_key] and info.what ~= "main" and
|
||||
info.what ~= "C" then
|
||||
minetest.log("error", ("Assignment to undeclared "..
|
||||
warn(("Assignment to undeclared "..
|
||||
"global %q inside a function at %s.")
|
||||
:format(name, desc))
|
||||
warned[warn_key] = true
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
minetest.register_biome({
|
||||
name = "Grass",
|
||||
|
||||
heat_point = 50.0,
|
||||
humidity_point = 50.0,
|
||||
height_min = -31000,
|
||||
height_max = 31000,
|
||||
})
|
||||
|
||||
@@ -403,6 +403,44 @@ core.register_chatcommand("set", {
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("deleteblocks", {
|
||||
params = "[here] [<pos1> <pos2>]",
|
||||
description = "delete map blocks contained in area pos1 to pos2",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local p1 = {}
|
||||
local p2 = {}
|
||||
if param == "here" then
|
||||
local player = core.get_player_by_name(name)
|
||||
if player == nil then
|
||||
core.log("error", "player is nil")
|
||||
return false, "Unable to get current position; player is nil"
|
||||
end
|
||||
p1 = player:getpos()
|
||||
p2 = p1
|
||||
else
|
||||
local pos1, pos2 = unpack(param:split(") ("))
|
||||
if pos1 == nil or pos2 == nil then
|
||||
return false, "Incorrect area format. Expected: (x1,y1,z1) (x2,y2,z2)"
|
||||
end
|
||||
|
||||
p1 = core.string_to_pos(pos1 .. ")")
|
||||
p2 = core.string_to_pos("(" .. pos2)
|
||||
|
||||
if p1 == nil or p2 == nil then
|
||||
return false, "Incorrect area format. Expected: (x1,y1,z1) (x2,y2,z2)"
|
||||
end
|
||||
end
|
||||
|
||||
if core.delete_area(p1, p2) then
|
||||
return true, "Successfully cleared area ranging from " ..
|
||||
core.pos_to_string(p1, 1) .. " to " .. core.pos_to_string(p2, 1)
|
||||
else
|
||||
return false, "Failed to clear one or more blocks in area"
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
core.register_chatcommand("mods", {
|
||||
params = "",
|
||||
description = "List mods installed on the server",
|
||||
@@ -532,6 +570,9 @@ core.register_chatcommand("rollback_check", {
|
||||
.. " seconds=86400=24h, limit=5)",
|
||||
privs = {rollback=true},
|
||||
func = function(name, param)
|
||||
if not core.setting_getbool("enable_rollback_recording") then
|
||||
return false, "Rollback functions are disabled."
|
||||
end
|
||||
local range, seconds, limit =
|
||||
param:match("(%d+) *(%d*) *(%d*)")
|
||||
range = tonumber(range) or 0
|
||||
@@ -545,6 +586,10 @@ core.register_chatcommand("rollback_check", {
|
||||
local name = puncher:get_player_name()
|
||||
core.chat_send_player(name, "Checking " .. core.pos_to_string(pos) .. "...")
|
||||
local actions = core.rollback_get_node_actions(pos, range, seconds, limit)
|
||||
if not actions then
|
||||
core.chat_send_player(name, "Rollback functions are disabled")
|
||||
return
|
||||
end
|
||||
local num_actions = #actions
|
||||
if num_actions == 0 then
|
||||
core.chat_send_player(name, "Nobody has touched"
|
||||
@@ -576,6 +621,9 @@ core.register_chatcommand("rollback", {
|
||||
description = "revert actions of a player; default for <seconds> is 60",
|
||||
privs = {rollback=true},
|
||||
func = function(name, param)
|
||||
if not core.setting_getbool("enable_rollback_recording") then
|
||||
return false, "Rollback functions are disabled."
|
||||
end
|
||||
local target_name, seconds = string.match(param, ":([^ ]+) *(%d*)")
|
||||
if not target_name then
|
||||
local player_name = nil
|
||||
|
||||
@@ -25,5 +25,4 @@ dofile(gamepath.."features.lua")
|
||||
dofile(gamepath.."voxelarea.lua")
|
||||
dofile(gamepath.."forceloading.lua")
|
||||
dofile(gamepath.."statbars.lua")
|
||||
dofile(gamepath.."builtin_biome.lua")
|
||||
|
||||
|
||||
@@ -93,30 +93,6 @@ function core.get_node_group(name, group)
|
||||
return core.get_item_group(name, group)
|
||||
end
|
||||
|
||||
function core.string_to_pos(value)
|
||||
local p = {}
|
||||
p.x, p.y, p.z = string.match(value, "^([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+)$")
|
||||
if p.x and p.y and p.z then
|
||||
p.x = tonumber(p.x)
|
||||
p.y = tonumber(p.y)
|
||||
p.z = tonumber(p.z)
|
||||
return p
|
||||
end
|
||||
local p = {}
|
||||
p.x, p.y, p.z = string.match(value, "^%( *([%d.-]+)[, ] *([%d.-]+)[, ] *([%d.-]+) *%)$")
|
||||
if p.x and p.y and p.z then
|
||||
p.x = tonumber(p.x)
|
||||
p.y = tonumber(p.y)
|
||||
p.z = tonumber(p.z)
|
||||
return p
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
assert(core.string_to_pos("10.0, 5, -2").x == 10)
|
||||
assert(core.string_to_pos("( 10.0, 5, -2)").z == -2)
|
||||
assert(core.string_to_pos("asd, 5, -2)") == nil)
|
||||
|
||||
function core.setting_get_pos(name)
|
||||
local value = core.setting_get(name)
|
||||
if not value then
|
||||
|
||||
@@ -226,13 +226,6 @@ function core.register_alias(name, convert_to)
|
||||
end
|
||||
end
|
||||
|
||||
local register_biome_raw = core.register_biome
|
||||
core.registered_biomes = {}
|
||||
function core.register_biome(biome)
|
||||
core.registered_biomes[biome.name] = biome
|
||||
register_biome_raw(biome)
|
||||
end
|
||||
|
||||
function core.on_craft(itemstack, player, old_craft_list, craft_inv)
|
||||
for _, func in ipairs(core.registered_on_crafts) do
|
||||
itemstack = func(itemstack, player, old_craft_list, craft_inv) or itemstack
|
||||
@@ -387,10 +380,38 @@ local function make_registration_reverse()
|
||||
return t, registerfunc
|
||||
end
|
||||
|
||||
local function make_registration_wrap(reg_fn_name, clear_fn_name)
|
||||
local list = {}
|
||||
|
||||
local orig_reg_fn = core[reg_fn_name]
|
||||
core[reg_fn_name] = function(def)
|
||||
local retval = orig_reg_fn(def)
|
||||
if retval ~= nil then
|
||||
if def.name ~= nil then
|
||||
list[def.name] = def
|
||||
else
|
||||
list[retval] = def
|
||||
end
|
||||
end
|
||||
return retval
|
||||
end
|
||||
|
||||
local orig_clear_fn = core[clear_fn_name]
|
||||
core[clear_fn_name] = function()
|
||||
list = {}
|
||||
return orig_clear_fn()
|
||||
end
|
||||
|
||||
return list
|
||||
end
|
||||
|
||||
core.registered_biomes = make_registration_wrap("register_biome", "clear_registered_biomes")
|
||||
core.registered_ores = make_registration_wrap("register_ore", "clear_registered_ores")
|
||||
core.registered_decorations = make_registration_wrap("register_decoration", "clear_registered_decorations")
|
||||
|
||||
core.registered_on_chat_messages, core.register_on_chat_message = make_registration()
|
||||
core.registered_globalsteps, core.register_globalstep = make_registration()
|
||||
core.registered_playerevents, core.register_playerevent = make_registration()
|
||||
core.registered_on_mapgen_inits, core.register_on_mapgen_init = make_registration()
|
||||
core.registered_on_shutdown, core.register_on_shutdown = make_registration()
|
||||
core.registered_on_punchnodes, core.register_on_punchnode = make_registration()
|
||||
core.registered_on_placenodes, core.register_on_placenode = make_registration()
|
||||
@@ -409,3 +430,9 @@ core.registered_craft_predicts, core.register_craft_predict = make_registration(
|
||||
core.registered_on_protection_violation, core.register_on_protection_violation = make_registration()
|
||||
core.registered_on_item_eats, core.register_on_item_eat = make_registration()
|
||||
|
||||
--
|
||||
-- Compatibility for on_mapgen_init()
|
||||
--
|
||||
|
||||
core.register_on_mapgen_init = function(func) func(core.get_mapgen_params()) end
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ local health_bar_definition =
|
||||
number = 20,
|
||||
direction = 0,
|
||||
size = { x=24, y=24 },
|
||||
offset = { x=(-10*24)-25, y=-(48+24+10)},
|
||||
offset = { x=(-10*24)-25, y=-(48+24+16)},
|
||||
}
|
||||
|
||||
local breath_bar_definition =
|
||||
@@ -18,7 +18,7 @@ local breath_bar_definition =
|
||||
number = 20,
|
||||
direction = 0,
|
||||
size = { x=24, y=24 },
|
||||
offset = {x=25,y=-(48+24+10)},
|
||||
offset = {x=25,y=-(48+24+16)},
|
||||
}
|
||||
|
||||
local hud_ids = {}
|
||||
|
||||
@@ -16,9 +16,15 @@
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
--------------------------------------------------------------------------------
|
||||
-- Global menu data
|
||||
---------------------------------------------------------------------------------
|
||||
--------------------------------------------------------------------------------
|
||||
menudata = {}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Local cached values
|
||||
--------------------------------------------------------------------------------
|
||||
local min_supp_proto = core.get_min_supp_proto()
|
||||
local max_supp_proto = core.get_max_supp_proto()
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Menu helper functions
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -34,6 +40,33 @@ local function render_client_count(n)
|
||||
end
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function image_column(tooltip, flagname)
|
||||
return "image," ..
|
||||
"tooltip=" .. core.formspec_escape(tooltip) .. "," ..
|
||||
"0=" .. core.formspec_escape(defaulttexturedir .. "blank.png") .. "," ..
|
||||
"1=" .. core.formspec_escape(defaulttexturedir .. "server_flags_" .. flagname .. ".png")
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function order_favorite_list(list)
|
||||
local res = {}
|
||||
--orders the favorite list after support
|
||||
for i=1,#list,1 do
|
||||
local fav = list[i]
|
||||
if is_server_protocol_compat(fav.proto_min, fav.proto_max) then
|
||||
table.insert(res, fav)
|
||||
end
|
||||
end
|
||||
for i=1,#list,1 do
|
||||
local fav = list[i]
|
||||
if not is_server_protocol_compat(fav.proto_min, fav.proto_max) then
|
||||
table.insert(res, fav)
|
||||
end
|
||||
end
|
||||
return res
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function render_favorite(spec,render_details)
|
||||
local text = ""
|
||||
@@ -60,6 +93,7 @@ function render_favorite(spec,render_details)
|
||||
end
|
||||
|
||||
local details = ""
|
||||
local grey_out = not is_server_protocol_compat(spec.proto_max, spec.proto_min)
|
||||
|
||||
if spec.clients ~= nil and spec.clients_max ~= nil then
|
||||
local clients_color = ''
|
||||
@@ -79,11 +113,17 @@ function render_favorite(spec,render_details)
|
||||
clients_color = '#ffba97' -- 90-100%: orange
|
||||
end
|
||||
|
||||
if grey_out then
|
||||
clients_color = '#aaaaaa'
|
||||
end
|
||||
|
||||
details = details ..
|
||||
clients_color .. ',' ..
|
||||
render_client_count(spec.clients) .. ',' ..
|
||||
'/,' ..
|
||||
render_client_count(spec.clients_max) .. ','
|
||||
elseif grey_out then
|
||||
details = details .. '#aaaaaa,?,/,?,'
|
||||
else
|
||||
details = details .. ',?,/,?,'
|
||||
end
|
||||
@@ -106,7 +146,7 @@ function render_favorite(spec,render_details)
|
||||
details = details .. "0,"
|
||||
end
|
||||
|
||||
return details .. text
|
||||
return details .. (grey_out and '#aaaaaa,' or ',') .. text
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -186,8 +226,10 @@ function asyncOnlineFavourites()
|
||||
end,
|
||||
nil,
|
||||
function(result)
|
||||
menudata.favorites = result
|
||||
core.event_handler("Refresh")
|
||||
if core.setting_getbool("public_serverlist") then
|
||||
menudata.favorites = order_favorite_list(result)
|
||||
core.event_handler("Refresh")
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
@@ -215,3 +257,21 @@ function text2textlist(xpos,ypos,width,height,tl_name,textlen,text,transparency)
|
||||
|
||||
return retval
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
function is_server_protocol_compat(proto_min, proto_max)
|
||||
return not ((min_supp_proto > (proto_max or 24)) or (max_supp_proto < (proto_min or 13)))
|
||||
end
|
||||
--------------------------------------------------------------------------------
|
||||
function is_server_protocol_compat_or_error(proto_min, proto_max)
|
||||
if not is_server_protocol_compat(proto_min, proto_max) then
|
||||
gamedata.errormessage = fgettext_ne("Protocol version mismatch, server " ..
|
||||
((proto_min ~= proto_max) and "supports protocols between $1 and $2" or "enforces protocol version $1") ..
|
||||
", we " ..
|
||||
((min_supp_proto ~= max_supp_proto) and "support protocols between version $3 and $4." or "only support protocol version $3"),
|
||||
proto_min or 13, proto_max or 24, min_supp_proto, max_supp_proto)
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local function modname_valid(name)
|
||||
return not name:find("[^a-z0-9_]")
|
||||
end
|
||||
|
||||
local function get_formspec(data)
|
||||
|
||||
@@ -118,6 +121,7 @@ local function handle_buttons(this, fields)
|
||||
if fields["world_config_modlist"] ~= nil then
|
||||
local event = core.explode_textlist_event(fields["world_config_modlist"])
|
||||
this.data.selected_mod = event.index
|
||||
core.setting_set("world_config_selected_mod", event.index)
|
||||
|
||||
if event.type == "DCL" then
|
||||
enable_mod(this)
|
||||
@@ -151,21 +155,29 @@ local function handle_buttons(this, fields)
|
||||
if current == nil then
|
||||
current = {}
|
||||
end
|
||||
|
||||
if core.is_yes(fields["cb_hide_gamemods"]) then
|
||||
current.hide_game = true
|
||||
this.data.hide_gamemods = true
|
||||
else
|
||||
current.hide_game = false
|
||||
this.data.hide_gamemods = false
|
||||
end
|
||||
|
||||
if core.is_yes(fields["cb_hide_mpcontent"]) then
|
||||
current.hide_modpackcontents = true
|
||||
this.data.hide_modpackcontents = true
|
||||
else
|
||||
current.hide_modpackcontents = false
|
||||
this.data.hide_modpackcontents = false
|
||||
if fields["cb_hide_gamemods"] ~= nil then
|
||||
if core.is_yes(fields["cb_hide_gamemods"]) then
|
||||
current.hide_game = true
|
||||
this.data.hide_gamemods = true
|
||||
core.setting_set("world_config_hide_gamemods", "true")
|
||||
else
|
||||
current.hide_game = false
|
||||
this.data.hide_gamemods = false
|
||||
core.setting_set("world_config_hide_gamemods", "false")
|
||||
end
|
||||
end
|
||||
|
||||
if fields["cb_hide_mpcontent"] ~= nil then
|
||||
if core.is_yes(fields["cb_hide_mpcontent"]) then
|
||||
current.hide_modpackcontents = true
|
||||
this.data.hide_modpackcontents = true
|
||||
core.setting_set("world_config_hide_modpackcontents", "true")
|
||||
else
|
||||
current.hide_modpackcontents = false
|
||||
this.data.hide_modpackcontents = false
|
||||
core.setting_set("world_config_hide_modpackcontents", "false")
|
||||
end
|
||||
end
|
||||
|
||||
this.data.list:set_filtercriteria(current)
|
||||
@@ -186,10 +198,12 @@ local function handle_buttons(this, fields)
|
||||
for i,mod in ipairs(rawlist) do
|
||||
if not mod.is_modpack and
|
||||
mod.typ ~= "game_mod" then
|
||||
if mod.enabled then
|
||||
worldfile:set("load_mod_"..mod.name, "true")
|
||||
if modname_valid(mod.name) then
|
||||
worldfile:set("load_mod_"..mod.name, tostring(mod.enabled))
|
||||
else
|
||||
worldfile:set("load_mod_"..mod.name, "false")
|
||||
if mod.enabled then
|
||||
gamedata.errormessage = fgettext_ne("Failed to enable mod \"$1\" as it contains disallowed characters. Only chararacters [a-z0-9_] are allowed.", mod.name)
|
||||
end
|
||||
end
|
||||
mods["load_mod_"..mod.name] = nil
|
||||
end
|
||||
@@ -237,10 +251,12 @@ function create_configure_world_dlg(worldidx)
|
||||
handle_buttons,
|
||||
nil)
|
||||
|
||||
--TODO read from settings
|
||||
dlg.data.hide_gamemods = false
|
||||
dlg.data.hide_modpackcontents = false
|
||||
dlg.data.selected_mod = 0
|
||||
dlg.data.hide_gamemods = core.setting_getbool("world_config_hide_gamemods")
|
||||
dlg.data.hide_modpackcontents = core.setting_getbool("world_config_hide_modpackcontents")
|
||||
dlg.data.selected_mod = tonumber(core.setting_get("world_config_selected_mod"))
|
||||
if dlg.data.selected_mod == nil then
|
||||
dlg.data.selected_mod = 0
|
||||
end
|
||||
|
||||
dlg.data.worldspec = core.get_worlds()[worldidx]
|
||||
if dlg.data.worldspec == nil then dlg:delete() return nil end
|
||||
@@ -277,7 +293,12 @@ function create_configure_world_dlg(worldidx)
|
||||
{ worldpath= dlg.data.worldspec.path,
|
||||
gameid = dlg.data.worldspec.gameid }
|
||||
)
|
||||
|
||||
|
||||
|
||||
if dlg.data.selected_mod > dlg.data.list:size() then
|
||||
dlg.data.selected_mod = 0
|
||||
end
|
||||
|
||||
dlg.data.list:set_filtercriteria(
|
||||
{
|
||||
hide_game=dlg.data.hide_gamemods,
|
||||
@@ -285,6 +306,6 @@ function create_configure_world_dlg(worldidx)
|
||||
})
|
||||
dlg.data.list:add_sort_mechanism("alphabetic", sort_mod_list)
|
||||
dlg.data.list:set_sortmode("alphabetic")
|
||||
|
||||
|
||||
return dlg
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
local function create_world_formspec(dialogdata)
|
||||
local mapgens = {"v5", "v6", "v7", "singlenode"}
|
||||
local mapgens = core.get_mapgen_names()
|
||||
|
||||
local current_seed = core.setting_get("fixed_map_seed") or ""
|
||||
local current_mg = core.setting_get("mg_name")
|
||||
@@ -90,6 +90,8 @@ local function create_world_buttonhandler(this, fields)
|
||||
|
||||
local message = nil
|
||||
|
||||
core.setting_set("fixed_map_seed", fields["te_seed"])
|
||||
|
||||
if not menudata.worldlist:uid_exists_raw(worldname) then
|
||||
core.setting_set("mg_name",fields["dd_mapgen"])
|
||||
message = core.create_world(worldname,gameindex)
|
||||
@@ -97,8 +99,6 @@ local function create_world_buttonhandler(this, fields)
|
||||
message = fgettext("A world named \"$1\" already exists", worldname)
|
||||
end
|
||||
|
||||
core.setting_set("fixed_map_seed", fields["te_seed"])
|
||||
|
||||
if message ~= nil then
|
||||
gamedata.errormessage = message
|
||||
else
|
||||
|
||||
@@ -139,10 +139,13 @@ local function init_globals()
|
||||
tv_main:add(tab_credits)
|
||||
|
||||
tv_main:set_global_event_handler(main_event_handler)
|
||||
|
||||
if PLATFORM == "Android" then
|
||||
tv_main:set_fixed_size(false)
|
||||
if PLATFORM ~= "Android" then
|
||||
tv_main:set_fixed_size(true)
|
||||
else
|
||||
tv_main:set_fixed_size(false)
|
||||
end
|
||||
|
||||
if not (PLATFORM == "Android") then
|
||||
tv_main:set_tab(core.setting_get("maintab_LAST"))
|
||||
end
|
||||
ui.set_default("maintab")
|
||||
|
||||
4
builtin/mainmenu/init_simple.lua
Normal file
4
builtin/mainmenu/init_simple.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
-- helper file to be able to debug the simple menu on PC
|
||||
-- without messing around with actual menu code!
|
||||
PLATFORM="Android"
|
||||
dofile("builtin/mainmenu/init.lua")
|
||||
@@ -391,7 +391,7 @@ function modstore.getscreenshot(ypos,listentry)
|
||||
listentry.details.screenshot_url == "") then
|
||||
|
||||
if listentry.texturename == nil then
|
||||
listentry.texturename = modstore.basetexturedir .. "no_screenshot.png"
|
||||
listentry.texturename = defaulttexturedir .. "no_screenshot.png"
|
||||
end
|
||||
|
||||
return "image[0,".. ypos .. ";3,2;" ..
|
||||
|
||||
@@ -57,7 +57,7 @@ local function get_formspec(tabview, name, tabdata)
|
||||
end
|
||||
|
||||
if modscreenshot == nil then
|
||||
modscreenshot = modstore.basetexturedir .. "no_screenshot.png"
|
||||
modscreenshot = defaulttexturedir .. "no_screenshot.png"
|
||||
end
|
||||
|
||||
retval = retval
|
||||
@@ -96,7 +96,7 @@ local function get_formspec(tabview, name, tabdata)
|
||||
else
|
||||
--show dependencies
|
||||
|
||||
retval = retval .. ",Depends:,"
|
||||
retval = retval .. "," .. fgettext("Depends:") .. ","
|
||||
|
||||
local toadd = modmgr.get_dependencies(selected_mod.path)
|
||||
|
||||
|
||||
@@ -20,26 +20,27 @@ local function get_formspec(tabview, name, tabdata)
|
||||
local render_details = core.is_yes(core.setting_getbool("public_serverlist"))
|
||||
|
||||
local retval =
|
||||
"label[0,4.25;" .. fgettext("Address/Port") .. "]" ..
|
||||
"label[9,2.75;" .. fgettext("Name/Password") .. "]" ..
|
||||
"field[0.25,5.25;5.5,0.5;te_address;;" ..
|
||||
"label[7.75,-0.15;" .. fgettext("Address / Port :") .. "]" ..
|
||||
"label[7.75,1.05;" .. fgettext("Name / Password :") .. "]" ..
|
||||
"field[8,0.75;3.4,0.5;te_address;;" ..
|
||||
core.formspec_escape(core.setting_get("address")) .. "]" ..
|
||||
"field[5.75,5.25;2.25,0.5;te_port;;" ..
|
||||
"field[11.25,0.75;1.3,0.5;te_port;;" ..
|
||||
core.formspec_escape(core.setting_get("remote_port")) .. "]" ..
|
||||
"checkbox[0,3.6;cb_public_serverlist;" .. fgettext("Public Serverlist") .. ";" ..
|
||||
"checkbox[0,4.85;cb_public_serverlist;" .. fgettext("Public Serverlist") .. ";" ..
|
||||
dump(core.setting_getbool("public_serverlist")) .. "]"
|
||||
|
||||
if not core.setting_getbool("public_serverlist") then
|
||||
retval = retval ..
|
||||
"button[6.45,3.95;2.25,0.5;btn_delete_favorite;" .. fgettext("Delete") .. "]"
|
||||
"button[8,4.9;2,0.5;btn_delete_favorite;" .. fgettext("Delete") .. "]"
|
||||
end
|
||||
|
||||
retval = retval ..
|
||||
"button[9,4.95;2.5,0.5;btn_mp_connect;" .. fgettext("Connect") .. "]" ..
|
||||
"field[9.3,3.75;2.5,0.5;te_name;;" ..
|
||||
"button[10,4.9;2,0.5;btn_mp_connect;" .. fgettext("Connect") .. "]" ..
|
||||
"field[8,1.95;2.95,0.5;te_name;;" ..
|
||||
core.formspec_escape(core.setting_get("name")) .. "]" ..
|
||||
"pwdfield[9.3,4.5;2.5,0.5;te_pwd;]" ..
|
||||
"textarea[9.3,0;2.5,3.1;;"
|
||||
"pwdfield[10.78,1.95;1.77,0.5;te_pwd;]" ..
|
||||
"box[7.73,2.35;4.3,2.28;#999999]" ..
|
||||
"textarea[8.1,2.4;4.26,2.6;;"
|
||||
|
||||
if tabdata.fav_selected ~= nil and
|
||||
menudata.favorites[tabdata.fav_selected] ~= nil and
|
||||
@@ -52,27 +53,22 @@ local function get_formspec(tabview, name, tabdata)
|
||||
";]"
|
||||
|
||||
--favourites
|
||||
local function image_column(tooltip, flagname)
|
||||
return "image," ..
|
||||
"tooltip=" .. core.formspec_escape(tooltip) .. "," ..
|
||||
"0=" .. core.formspec_escape(defaulttexturedir .. "blank.png") .. "," ..
|
||||
"1=" .. core.formspec_escape(defaulttexturedir .. "server_flags_" .. flagname .. ".png")
|
||||
end
|
||||
if render_details then
|
||||
retval = retval .. "tablecolumns[" ..
|
||||
"color,span=3;" ..
|
||||
"text,align=right;" .. -- clients
|
||||
"text,align=center,padding=0.25;" .. -- "/"
|
||||
"text,align=right,padding=0.25;" .. -- clients_max
|
||||
image_column("Creative mode", "creative") .. ",padding=1;" ..
|
||||
image_column("Damage enabled", "damage") .. ",padding=0.25;" ..
|
||||
image_column("PvP enabled", "pvp") .. ",padding=0.25;" ..
|
||||
image_column(fgettext("Creative mode"), "creative") .. ",padding=1;" ..
|
||||
image_column(fgettext("Damage enabled"), "damage") .. ",padding=0.25;" ..
|
||||
image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" ..
|
||||
"color,span=1;" ..
|
||||
"text,padding=1]" -- name
|
||||
else
|
||||
retval = retval .. "tablecolumns[text]"
|
||||
end
|
||||
retval = retval ..
|
||||
"table[0,0;8.5,3.7;favourites;"
|
||||
"table[-0.15,-0.1;7.75,5;favourites;"
|
||||
|
||||
if #menudata.favorites > 0 then
|
||||
retval = retval .. render_favorite(menudata.favorites[1],render_details)
|
||||
@@ -93,7 +89,6 @@ end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
local function main_button_handler(tabview, fields, name, tabdata)
|
||||
|
||||
if fields["te_name"] ~= nil then
|
||||
gamedata.playername = fields["te_name"]
|
||||
core.setting_set("name", fields["te_name"])
|
||||
@@ -103,6 +98,10 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||
local event = core.explode_table_event(fields["favourites"])
|
||||
if event.type == "DCL" then
|
||||
if event.row <= #menudata.favorites then
|
||||
if not is_server_protocol_compat_or_error(menudata.favorites[event.row].proto_min,
|
||||
menudata.favorites[event.row].proto_max) then
|
||||
return true
|
||||
end
|
||||
gamedata.address = menudata.favorites[event.row].address
|
||||
gamedata.port = menudata.favorites[event.row].port
|
||||
gamedata.playername = fields["te_name"]
|
||||
@@ -194,7 +193,7 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||
local current_favourite = core.get_table_index("favourites")
|
||||
if current_favourite == nil then return end
|
||||
core.delete_favorite(current_favourite)
|
||||
menudata.favorites = core.get_favorites()
|
||||
menudata.favorites = order_favorite_list(core.get_favorites())
|
||||
tabdata.fav_selected = nil
|
||||
|
||||
core.setting_set("address","")
|
||||
@@ -219,6 +218,11 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||
|
||||
gamedata.servername = menudata.favorites[fav_idx].name
|
||||
gamedata.serverdescription = menudata.favorites[fav_idx].description
|
||||
|
||||
if not is_server_protocol_compat_or_error(menudata.favorites[fav_idx].proto_min,
|
||||
menudata.favorites[fav_idx].proto_max)then
|
||||
return true
|
||||
end
|
||||
else
|
||||
gamedata.servername = ""
|
||||
gamedata.serverdescription = ""
|
||||
|
||||
@@ -17,6 +17,60 @@
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local dd_filter_labels = {
|
||||
fgettext("No Filter"),
|
||||
fgettext("Bilinear Filter"),
|
||||
fgettext("Trilinear Filter")
|
||||
}
|
||||
|
||||
local filters = {
|
||||
{dd_filter_labels[1]..","..dd_filter_labels[2]..","..dd_filter_labels[3]},
|
||||
{"", "bilinear_filter", "trilinear_filter"},
|
||||
}
|
||||
|
||||
local dd_mipmap_labels = {
|
||||
fgettext("No Mipmap"),
|
||||
fgettext("Mipmap"),
|
||||
fgettext("Mipmap + Aniso. Filter")
|
||||
}
|
||||
|
||||
local mipmap = {
|
||||
{dd_mipmap_labels[1]..","..dd_mipmap_labels[2]..","..dd_mipmap_labels[3]},
|
||||
{"", "mip_map", "anisotropic_filter"},
|
||||
}
|
||||
|
||||
local function getFilterSettingIndex()
|
||||
if (core.setting_get(filters[2][3]) == "true") then
|
||||
return 3
|
||||
end
|
||||
if (core.setting_get(filters[2][3]) == "false" and core.setting_get(filters[2][2]) == "true") then
|
||||
return 2
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
local function getMipmapSettingIndex()
|
||||
if (core.setting_get(mipmap[2][3]) == "true") then
|
||||
return 3
|
||||
end
|
||||
if (core.setting_get(mipmap[2][3]) == "false" and core.setting_get(mipmap[2][2]) == "true") then
|
||||
return 2
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
local function video_driver_fname_to_name(selected_driver)
|
||||
local video_drivers = core.get_video_drivers()
|
||||
|
||||
for i=1, #video_drivers do
|
||||
if selected_driver == video_drivers[i].friendly_name then
|
||||
return video_drivers[i].name:lower()
|
||||
end
|
||||
end
|
||||
|
||||
return ""
|
||||
end
|
||||
|
||||
local function dlg_confirm_reset_formspec(data)
|
||||
local retval =
|
||||
"size[8,3]" ..
|
||||
@@ -76,17 +130,14 @@ local function showconfirm_reset(tabview)
|
||||
end
|
||||
|
||||
local function gui_scale_to_scrollbar()
|
||||
|
||||
local current_value = tonumber(core.setting_get("gui_scaling"))
|
||||
|
||||
if (current_value == nil) or current_value < 0.25 then
|
||||
return 0
|
||||
end
|
||||
|
||||
if current_value <= 1.25 then
|
||||
return ((current_value - 0.25)/ 1.0) * 700
|
||||
end
|
||||
|
||||
if current_value <= 6 then
|
||||
return ((current_value -1.25) * 100) + 700
|
||||
end
|
||||
@@ -95,13 +146,11 @@ local function gui_scale_to_scrollbar()
|
||||
end
|
||||
|
||||
local function scrollbar_to_gui_scale(value)
|
||||
|
||||
value = tonumber(value)
|
||||
|
||||
if (value <= 700) then
|
||||
return ((value / 700) * 1.0) + 0.25
|
||||
end
|
||||
|
||||
if (value <=1000) then
|
||||
return ((value - 700) / 100) + 1.25
|
||||
end
|
||||
@@ -111,26 +160,24 @@ end
|
||||
|
||||
local function formspec(tabview, name, tabdata)
|
||||
local video_drivers = core.get_video_drivers()
|
||||
|
||||
local video_driver_string = ""
|
||||
local current_video_driver_idx = 0
|
||||
local current_video_driver = core.setting_get("video_driver")
|
||||
for i=1, #video_drivers, 1 do
|
||||
|
||||
if i ~= 1 then
|
||||
video_driver_string = video_driver_string .. ","
|
||||
local current_video_driver = core.setting_get("video_driver"):lower()
|
||||
|
||||
local driver_formspec_string = ""
|
||||
local driver_current_idx = 0
|
||||
|
||||
for i=2, #video_drivers do
|
||||
driver_formspec_string = driver_formspec_string .. video_drivers[i].friendly_name
|
||||
if i ~= #video_drivers then
|
||||
driver_formspec_string = driver_formspec_string .. ","
|
||||
end
|
||||
video_driver_string = video_driver_string .. video_drivers[i]
|
||||
|
||||
local video_driver = string.gsub(video_drivers[i], " ", "")
|
||||
if current_video_driver:lower() == video_driver:lower() then
|
||||
current_video_driver_idx = i
|
||||
|
||||
if current_video_driver == video_drivers[i].name:lower() then
|
||||
driver_current_idx = i - 1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
local tab_string =
|
||||
"box[0,0;3.5,4;#999999]" ..
|
||||
"box[0,0;3.5,3.9;#999999]" ..
|
||||
"checkbox[0.25,0;cb_smooth_lighting;".. fgettext("Smooth Lighting")
|
||||
.. ";".. dump(core.setting_getbool("smooth_lighting")) .. "]"..
|
||||
"checkbox[0.25,0.5;cb_particles;".. fgettext("Enable Particles") .. ";"
|
||||
@@ -143,22 +190,23 @@ local function formspec(tabview, name, tabdata)
|
||||
.. dump(core.setting_getbool("opaque_water")) .. "]"..
|
||||
"checkbox[0.25,2.5;cb_connected_glass;".. fgettext("Connected Glass") .. ";"
|
||||
.. dump(core.setting_getbool("connected_glass")) .. "]"..
|
||||
"dropdown[0.25,3.25;3.25;dd_video_driver;"
|
||||
.. video_driver_string .. ";" .. current_video_driver_idx .. "]" ..
|
||||
"checkbox[0.25,3.0;cb_node_highlighting;".. fgettext("Node Highlighting") .. ";"
|
||||
.. dump(core.setting_getbool("enable_node_highlighting")) .. "]"..
|
||||
"box[3.75,0;3.75,3.45;#999999]" ..
|
||||
"label[3.85,0.1;".. fgettext("Texturing:") .. "]"..
|
||||
"dropdown[3.85,0.55;3.85;dd_filters;" .. filters[1][1] .. ";"
|
||||
.. getFilterSettingIndex() .. "]" ..
|
||||
"dropdown[3.85,1.35;3.85;dd_mipmap;" .. mipmap[1][1] .. ";"
|
||||
.. getMipmapSettingIndex() .. "]" ..
|
||||
"label[3.85,2.15;".. fgettext("Rendering:") .. "]"..
|
||||
"dropdown[3.85,2.6;3.85;dd_video_driver;"
|
||||
.. driver_formspec_string .. ";" .. driver_current_idx .. "]" ..
|
||||
"tooltip[dd_video_driver;" ..
|
||||
fgettext("Restart minetest for driver change to take effect") .. "]" ..
|
||||
"box[3.75,0;3.75,2.5;#999999]" ..
|
||||
"checkbox[4,0;cb_mipmapping;".. fgettext("Mip-Mapping") .. ";"
|
||||
.. dump(core.setting_getbool("mip_map")) .. "]"..
|
||||
"checkbox[4,0.5;cb_anisotrophic;".. fgettext("Anisotropic Filtering") .. ";"
|
||||
.. dump(core.setting_getbool("anisotropic_filter")) .. "]"..
|
||||
"checkbox[4,1.0;cb_bilinear;".. fgettext("Bi-Linear Filtering") .. ";"
|
||||
.. dump(core.setting_getbool("bilinear_filter")) .. "]"..
|
||||
"checkbox[4,1.5;cb_trilinear;".. fgettext("Tri-Linear Filtering") .. ";"
|
||||
.. dump(core.setting_getbool("trilinear_filter")) .. "]"..
|
||||
fgettext("Restart minetest for driver change to take effect") .. "]" ..
|
||||
"box[7.75,0;4,4;#999999]" ..
|
||||
"checkbox[8,0;cb_shaders;".. fgettext("Shaders") .. ";"
|
||||
.. dump(core.setting_getbool("enable_shaders")) .. "]"
|
||||
|
||||
if PLATFORM ~= "Android" then
|
||||
tab_string = tab_string ..
|
||||
"button[8,4.75;3.75,0.5;btn_change_keys;".. fgettext("Change keys") .. "]"
|
||||
@@ -167,7 +215,7 @@ local function formspec(tabview, name, tabdata)
|
||||
"button[8,4.75;3.75,0.5;btn_reset_singleplayer;".. fgettext("Reset singleplayer world") .. "]"
|
||||
end
|
||||
tab_string = tab_string ..
|
||||
"box[0,4.25;3.5,1.25;#999999]" ..
|
||||
"box[0,4.25;3.5,1.1;#999999]" ..
|
||||
"label[0.25,4.25;" .. fgettext("GUI scale factor") .. "]" ..
|
||||
"scrollbar[0.25,4.75;3,0.4;sb_gui_scaling;horizontal;" ..
|
||||
gui_scale_to_scrollbar() .. "]" ..
|
||||
@@ -177,15 +225,15 @@ local function formspec(tabview, name, tabdata)
|
||||
|
||||
if PLATFORM == "Android" then
|
||||
tab_string = tab_string ..
|
||||
"box[4.25,2.75;3.25,2.15;#999999]" ..
|
||||
"checkbox[4.5,2.75;cb_touchscreen_target;".. fgettext("Touch free target") .. ";"
|
||||
"box[3.75,3.55;3.75,1.8;#999999]" ..
|
||||
"checkbox[3.9,3.45;cb_touchscreen_target;".. fgettext("Touch free target") .. ";"
|
||||
.. dump(core.setting_getbool("touchtarget")) .. "]"
|
||||
end
|
||||
|
||||
if core.setting_get("touchscreen_threshold") ~= nil then
|
||||
tab_string = tab_string ..
|
||||
"label[4.5,3.5;" .. fgettext("Touchthreshold (px)") .. "]" ..
|
||||
"dropdown[4.5,4;3;dd_touchthreshold;0,10,20,30,40,50;" ..
|
||||
"label[4.3,4.1;" .. fgettext("Touchthreshold (px)") .. "]" ..
|
||||
"dropdown[3.85,4.55;3.85;dd_touchthreshold;0,10,20,30,40,50;" ..
|
||||
((tonumber(core.setting_get("touchscreen_threshold"))/10)+1) .. "]"
|
||||
end
|
||||
|
||||
@@ -233,22 +281,6 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
||||
core.setting_set("opaque_water", fields["cb_opaque_water"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_mipmapping"] then
|
||||
core.setting_set("mip_map", fields["cb_mipmapping"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_anisotrophic"] then
|
||||
core.setting_set("anisotropic_filter", fields["cb_anisotrophic"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_bilinear"] then
|
||||
core.setting_set("bilinear_filter", fields["cb_bilinear"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_trilinear"] then
|
||||
core.setting_set("trilinear_filter", fields["cb_trilinear"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_shaders"] then
|
||||
if (core.setting_get("video_driver") == "direct3d8" or core.setting_get("video_driver") == "direct3d9") then
|
||||
core.setting_set("enable_shaders", "false")
|
||||
@@ -262,6 +294,10 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
||||
core.setting_set("connected_glass", fields["cb_connected_glass"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_node_highlighting"] then
|
||||
core.setting_set("enable_node_highlighting", fields["cb_node_highlighting"])
|
||||
return true
|
||||
end
|
||||
if fields["cb_particles"] then
|
||||
core.setting_set("enable_particles", fields["cb_particles"])
|
||||
return true
|
||||
@@ -312,16 +348,48 @@ local function handle_settings_buttons(this, fields, tabname, tabdata)
|
||||
|
||||
--Note dropdowns have to be handled LAST!
|
||||
local ddhandled = false
|
||||
|
||||
if fields["dd_touchthreshold"] then
|
||||
core.setting_set("touchscreen_threshold",fields["dd_touchthreshold"])
|
||||
ddhandled = true
|
||||
end
|
||||
|
||||
if fields["dd_video_driver"] then
|
||||
local video_driver = string.gsub(fields["dd_video_driver"], " ", "")
|
||||
core.setting_set("video_driver",string.lower(video_driver))
|
||||
core.setting_set("video_driver",
|
||||
video_driver_fname_to_name(fields["dd_video_driver"]))
|
||||
ddhandled = true
|
||||
end
|
||||
|
||||
if fields["dd_filters"] == dd_filter_labels[1] then
|
||||
core.setting_set("bilinear_filter", "false")
|
||||
core.setting_set("trilinear_filter", "false")
|
||||
ddhandled = true
|
||||
end
|
||||
if fields["dd_filters"] == dd_filter_labels[2] then
|
||||
core.setting_set("bilinear_filter", "true")
|
||||
core.setting_set("trilinear_filter", "false")
|
||||
ddhandled = true
|
||||
end
|
||||
if fields["dd_filters"] == dd_filter_labels[3] then
|
||||
core.setting_set("bilinear_filter", "false")
|
||||
core.setting_set("trilinear_filter", "true")
|
||||
ddhandled = true
|
||||
end
|
||||
if fields["dd_mipmap"] == dd_mipmap_labels[1] then
|
||||
core.setting_set("mip_map", "false")
|
||||
core.setting_set("anisotropic_filter", "false")
|
||||
ddhandled = true
|
||||
end
|
||||
if fields["dd_mipmap"] == dd_mipmap_labels[2] then
|
||||
core.setting_set("mip_map", "true")
|
||||
core.setting_set("anisotropic_filter", "false")
|
||||
ddhandled = true
|
||||
end
|
||||
if fields["dd_mipmap"] == dd_mipmap_labels[3] then
|
||||
core.setting_set("mip_map", "true")
|
||||
core.setting_set("anisotropic_filter", "true")
|
||||
ddhandled = true
|
||||
end
|
||||
|
||||
return ddhandled
|
||||
end
|
||||
|
||||
@@ -330,4 +398,4 @@ tab_settings = {
|
||||
caption = fgettext("Settings"),
|
||||
cbf_formspec = formspec,
|
||||
cbf_button_handler = handle_settings_buttons
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,10 +35,23 @@ local function get_formspec(tabview, name, tabdata)
|
||||
"field[8.75,1.5;3.5,0.5;te_name;;" ..
|
||||
core.formspec_escape(core.setting_get("name")) .."]" ..
|
||||
"pwdfield[8.75,2.3;3.5,0.5;te_pwd;]"
|
||||
|
||||
--favourites
|
||||
|
||||
if render_details then
|
||||
retval = retval .. "tablecolumns[" ..
|
||||
"color,span=3;" ..
|
||||
"text,align=right;" .. -- clients
|
||||
"text,align=center,padding=0.25;" .. -- "/"
|
||||
"text,align=right,padding=0.25;" .. -- clients_max
|
||||
image_column(fgettext("Creative mode"), "creative") .. ",padding=1;" ..
|
||||
image_column(fgettext("Damage enabled"), "damage") .. ",padding=0.25;" ..
|
||||
image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" ..
|
||||
"color,span=1;" ..
|
||||
"text,padding=1]" -- name
|
||||
else
|
||||
retval = retval .. "tablecolumns[text]"
|
||||
end
|
||||
retval = retval ..
|
||||
"textlist[-0.05,0.0;7.55,2.75;favourites;"
|
||||
"table[-0.05,0;7.55,2.75;favourites;"
|
||||
|
||||
if #menudata.favorites > 0 then
|
||||
retval = retval .. render_favorite(menudata.favorites[1],render_details)
|
||||
@@ -75,7 +88,6 @@ local function get_formspec(tabview, name, tabdata)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local function main_button_handler(tabview, fields, name, tabdata)
|
||||
|
||||
if fields["btn_start_singleplayer"] then
|
||||
@@ -147,6 +159,11 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
||||
|
||||
gamedata.servername = menudata.favorites[fav_idx].name
|
||||
gamedata.serverdescription = menudata.favorites[fav_idx].description
|
||||
|
||||
if not is_server_protocol_compat_or_error(menudata.favorites[fav_idx].proto_min,
|
||||
menudata.favorites[fav_idx].proto_max) then
|
||||
return true
|
||||
end
|
||||
else
|
||||
gamedata.servername = ""
|
||||
gamedata.serverdescription = ""
|
||||
|
||||
@@ -87,7 +87,12 @@ vec4 base = texture2D(baseTexture, uv).rgba;
|
||||
vec3 E = normalize(eyeVec);
|
||||
float specular = pow(clamp(dot(reflect(L, bump.xyz), E), 0.0, 1.0),0.5);
|
||||
float diffuse = dot(E,bump.xyz);
|
||||
color = 0.05*base.rgb + diffuse*base.rgb + 0.2*specular*base.rgb;
|
||||
/* Mathematic optimization
|
||||
* Original: color = 0.05*base.rgb + diffuse*base.rgb + 0.2*specular*base.rgb;
|
||||
* This optimization save 2 multiplications (orig: 4 multiplications + 3 additions
|
||||
* end: 2 multiplications + 3 additions)
|
||||
*/
|
||||
color = (0.05 + diffuse + 0.2 * specular) * base.rgb;
|
||||
} else {
|
||||
color = base.rgb;
|
||||
}
|
||||
|
||||
@@ -35,22 +35,39 @@ void main(void)
|
||||
#if (MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE) && ENABLE_WAVING_WATER
|
||||
vec4 pos = gl_Vertex;
|
||||
pos.y -= 2.0;
|
||||
pos.y -= sin (pos.z/WATER_WAVE_LENGTH + animationTimer * WATER_WAVE_SPEED * WATER_WAVE_LENGTH) * WATER_WAVE_HEIGHT
|
||||
+ sin ((pos.z/WATER_WAVE_LENGTH + animationTimer * WATER_WAVE_SPEED * WATER_WAVE_LENGTH) / 7.0) * WATER_WAVE_HEIGHT;
|
||||
|
||||
float posYbuf = (pos.z / WATER_WAVE_LENGTH + animationTimer * WATER_WAVE_SPEED * WATER_WAVE_LENGTH);
|
||||
|
||||
pos.y -= sin(posYbuf) * WATER_WAVE_HEIGHT + sin(posYbuf / 7.0) * WATER_WAVE_HEIGHT;
|
||||
gl_Position = mWorldViewProj * pos;
|
||||
#elif MATERIAL_TYPE == TILE_MATERIAL_WAVING_LEAVES && ENABLE_WAVING_LEAVES
|
||||
vec4 pos = gl_Vertex;
|
||||
vec4 pos2 = mWorld * gl_Vertex;
|
||||
pos.x += (smoothTriangleWave(animationTimer*10.0 + pos2.x * 0.01 + pos2.z * 0.01) * 2.0 - 1.0) * 0.4;
|
||||
pos.y += (smoothTriangleWave(animationTimer*15.0 + pos2.x * -0.01 + pos2.z * -0.01) * 2.0 - 1.0) * 0.2;
|
||||
pos.z += (smoothTriangleWave(animationTimer*10.0 + pos2.x * -0.01 + pos2.z * -0.01) * 2.0 - 1.0) * 0.4;
|
||||
|
||||
/*
|
||||
* Mathematic optimization: pos2.x * A + pos2.z * A (2 multiplications + 1 addition)
|
||||
* replaced with: (pos2.x + pos2.z) * A (1 addition + 1 multiplication)
|
||||
* And bufferize calcul to a float
|
||||
*/
|
||||
float pos2XpZ = pos2.x + pos2.z;
|
||||
|
||||
pos.x += (smoothTriangleWave(animationTimer*10.0 + pos2XpZ * 0.01) * 2.0 - 1.0) * 0.4;
|
||||
pos.y += (smoothTriangleWave(animationTimer*15.0 + pos2XpZ * -0.01) * 2.0 - 1.0) * 0.2;
|
||||
pos.z += (smoothTriangleWave(animationTimer*10.0 + pos2XpZ * -0.01) * 2.0 - 1.0) * 0.4;
|
||||
gl_Position = mWorldViewProj * pos;
|
||||
#elif MATERIAL_TYPE == TILE_MATERIAL_WAVING_PLANTS && ENABLE_WAVING_PLANTS
|
||||
vec4 pos = gl_Vertex;
|
||||
vec4 pos2 = mWorld * gl_Vertex;
|
||||
if (gl_TexCoord[0].y < 0.05) {
|
||||
pos.x += (smoothTriangleWave(animationTimer * 20.0 + pos2.x * 0.1 + pos2.z * 0.1) * 2.0 - 1.0) * 0.8;
|
||||
pos.y -= (smoothTriangleWave(animationTimer * 10.0 + pos2.x * -0.5 + pos2.z * -0.5) * 2.0 - 1.0) * 0.4;
|
||||
/*
|
||||
* Mathematic optimization: pos2.x * A + pos2.z * A (2 multiplications + 1 addition)
|
||||
* replaced with: (pos2.x + pos2.z) * A (1 addition + 1 multiplication)
|
||||
* And bufferize calcul to a float
|
||||
*/
|
||||
float pos2XpZ = pos2.x + pos2.z;
|
||||
|
||||
pos.x += (smoothTriangleWave(animationTimer * 20.0 + pos2XpZ * 0.1) * 2.0 - 1.0) * 0.8;
|
||||
pos.y -= (smoothTriangleWave(animationTimer * 10.0 + pos2XpZ * -0.5) * 2.0 - 1.0) * 0.4;
|
||||
}
|
||||
gl_Position = mWorldViewProj * pos;
|
||||
#else
|
||||
|
||||
@@ -87,7 +87,12 @@ vec4 base = texture2D(baseTexture, uv).rgba;
|
||||
vec3 E = normalize(eyeVec);
|
||||
float specular = pow(clamp(dot(reflect(L, bump.xyz), E), 0.0, 1.0),0.5);
|
||||
float diffuse = dot(E,bump.xyz);
|
||||
color = 0.05*base.rgb + diffuse*base.rgb + 0.2*specular*base.rgb;
|
||||
/* Mathematic optimization
|
||||
* Original: color = 0.05*base.rgb + diffuse*base.rgb + 0.2*specular*base.rgb;
|
||||
* This optimization save 2 multiplications (orig: 4 multiplications + 3 additions
|
||||
* end: 2 multiplications + 3 additions)
|
||||
*/
|
||||
color = (0.05 + diffuse + 0.2 * specular) * base.rgb;
|
||||
} else {
|
||||
color = base.rgb;
|
||||
}
|
||||
|
||||
@@ -35,22 +35,36 @@ void main(void)
|
||||
#if (MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE) && ENABLE_WAVING_WATER
|
||||
vec4 pos = gl_Vertex;
|
||||
pos.y -= 2.0;
|
||||
pos.y -= sin (pos.z/WATER_WAVE_LENGTH + animationTimer * WATER_WAVE_SPEED * WATER_WAVE_LENGTH) * WATER_WAVE_HEIGHT
|
||||
+ sin ((pos.z/WATER_WAVE_LENGTH + animationTimer * WATER_WAVE_SPEED * WATER_WAVE_LENGTH) / 7.0) * WATER_WAVE_HEIGHT;
|
||||
|
||||
float posYbuf = (pos.z / WATER_WAVE_LENGTH + animationTimer * WATER_WAVE_SPEED * WATER_WAVE_LENGTH);
|
||||
|
||||
pos.y -= sin(posYbuf) * WATER_WAVE_HEIGHT + sin(posYbuf / 7.0) * WATER_WAVE_HEIGHT;
|
||||
gl_Position = mWorldViewProj * pos;
|
||||
#elif MATERIAL_TYPE == TILE_MATERIAL_WAVING_LEAVES && ENABLE_WAVING_LEAVES
|
||||
vec4 pos = gl_Vertex;
|
||||
vec4 pos2 = mWorld * gl_Vertex;
|
||||
pos.x += (smoothTriangleWave(animationTimer*10.0 + pos2.x * 0.01 + pos2.z * 0.01) * 2.0 - 1.0) * 0.4;
|
||||
pos.y += (smoothTriangleWave(animationTimer*15.0 + pos2.x * -0.01 + pos2.z * -0.01) * 2.0 - 1.0) * 0.2;
|
||||
pos.z += (smoothTriangleWave(animationTimer*10.0 + pos2.x * -0.01 + pos2.z * -0.01) * 2.0 - 1.0) * 0.4;
|
||||
/*
|
||||
* Mathematic optimization: pos2.x * A + pos2.z * A (2 multiplications + 1 addition)
|
||||
* replaced with: (pos2.x + pos2.z) * A (1 addition + 1 multiplication)
|
||||
* And bufferize calcul to a float
|
||||
*/
|
||||
float pos2XpZ = pos2.x + pos2.z;
|
||||
pos.x += (smoothTriangleWave(animationTimer*10.0 + pos2XpZ * 0.01) * 2.0 - 1.0) * 0.4;
|
||||
pos.y += (smoothTriangleWave(animationTimer*15.0 + pos2XpZ * -0.01) * 2.0 - 1.0) * 0.2;
|
||||
pos.z += (smoothTriangleWave(animationTimer*10.0 + pos2XpZ * -0.01) * 2.0 - 1.0) * 0.4;
|
||||
gl_Position = mWorldViewProj * pos;
|
||||
#elif MATERIAL_TYPE == TILE_MATERIAL_WAVING_PLANTS && ENABLE_WAVING_PLANTS
|
||||
vec4 pos = gl_Vertex;
|
||||
vec4 pos2 = mWorld * gl_Vertex;
|
||||
if (gl_TexCoord[0].y < 0.05) {
|
||||
pos.x += (smoothTriangleWave(animationTimer * 20.0 + pos2.x * 0.1 + pos2.z * 0.1) * 2.0 - 1.0) * 0.8;
|
||||
pos.y -= (smoothTriangleWave(animationTimer * 10.0 + pos2.x * -0.5 + pos2.z * -0.5) * 2.0 - 1.0) * 0.4;
|
||||
/*
|
||||
* Mathematic optimization: pos2.x * A + pos2.z * A (2 multiplications + 1 addition)
|
||||
* replaced with: (pos2.x + pos2.z) * A (1 addition + 1 multiplication)
|
||||
* And bufferize calcul to a float
|
||||
*/
|
||||
float pos2XpZ = pos2.x + pos2.z;
|
||||
pos.x += (smoothTriangleWave(animationTimer * 20.0 + pos2XpZ * 0.1) * 2.0 - 1.0) * 0.8;
|
||||
pos.y -= (smoothTriangleWave(animationTimer * 10.0 + pos2XpZ * -0.5) * 2.0 - 1.0) * 0.4;
|
||||
}
|
||||
gl_Position = mWorldViewProj * pos;
|
||||
#else
|
||||
@@ -88,7 +102,7 @@ void main(void)
|
||||
tangent = normalize(gl_NormalMatrix * vec3(-1.0, 0.0, 0.0));
|
||||
binormal = normalize(gl_NormalMatrix * vec3( 0.0, -1.0, 0.0));
|
||||
}
|
||||
mat3 tbnMatrix = mat3( tangent.x, binormal.x, normal.x,
|
||||
mat3 tbnMatrix = mat3(tangent.x, binormal.x, normal.x,
|
||||
tangent.y, binormal.y, normal.y,
|
||||
tangent.z, binormal.z, normal.z);
|
||||
|
||||
|
||||
@@ -2,12 +2,6 @@
|
||||
|
||||
set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)")
|
||||
|
||||
if( UNIX )
|
||||
# Unix
|
||||
else( UNIX )
|
||||
# Windows
|
||||
endif( UNIX )
|
||||
|
||||
# Find include directory
|
||||
|
||||
if(NOT IRRLICHT_SOURCE_DIR STREQUAL "")
|
||||
@@ -82,7 +76,7 @@ endif(WIN32)
|
||||
# handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(IRRLICHT DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Irrlicht DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)
|
||||
|
||||
IF(IRRLICHT_FOUND)
|
||||
SET(IRRLICHT_LIBRARIES ${IRRLICHT_LIBRARY})
|
||||
|
||||
9
cmake/Modules/FindSQLite3.cmake
Normal file
9
cmake/Modules/FindSQLite3.cmake
Normal file
@@ -0,0 +1,9 @@
|
||||
mark_as_advanced(SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR)
|
||||
|
||||
find_path(SQLITE3_INCLUDE_DIR sqlite3.h)
|
||||
|
||||
find_library(SQLITE3_LIBRARY NAMES sqlite3)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(SQLite3 DEFAULT_MSG SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR)
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# Look for sqlite3, use our own if not found
|
||||
|
||||
FIND_PATH(SQLITE3_INCLUDE_DIR sqlite3.h)
|
||||
|
||||
FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3)
|
||||
|
||||
IF(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR)
|
||||
SET( SQLITE3_FOUND TRUE )
|
||||
ENDIF(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR)
|
||||
|
||||
IF(SQLITE3_FOUND)
|
||||
MESSAGE(STATUS "Found system sqlite3 header file in ${SQLITE3_INCLUDE_DIR}")
|
||||
MESSAGE(STATUS "Found system sqlite3 library ${SQLITE3_LIBRARY}")
|
||||
ELSE(SQLITE3_FOUND)
|
||||
SET(SQLITE3_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/sqlite)
|
||||
SET(SQLITE3_LIBRARY sqlite3)
|
||||
MESSAGE(STATUS "Using project sqlite3 library")
|
||||
ENDIF(SQLITE3_FOUND)
|
||||
5074
doc/lua_api.txt
5074
doc/lua_api.txt
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
Minetest Lua Mainmenu API Reference 0.4.11
|
||||
Minetest Lua Mainmenu API Reference 0.4.12
|
||||
========================================
|
||||
|
||||
Introduction
|
||||
@@ -90,7 +90,9 @@ core.sound_play(spec, looped) -> handle
|
||||
core.sound_stop(handle)
|
||||
core.get_video_drivers()
|
||||
^ get list of video drivers supported by engine (not all modes are guaranteed to work)
|
||||
^ returns list of available video drivers e.g. { "OpenGL", "Software" }
|
||||
^ returns list of available video drivers' settings name and 'friendly' display name
|
||||
^ e.g. { {name="opengl", friendly_name="OpenGL"}, {name="software", friendly_name="Software Renderer"} }
|
||||
^ first element of returned list is guaranteed to be the NULL driver
|
||||
|
||||
Formspec:
|
||||
core.update_formspec(formspec)
|
||||
@@ -143,6 +145,8 @@ core.get_game(index)
|
||||
addon_mods_paths = {[1] = <path>,},
|
||||
}
|
||||
core.get_games() -> table of all games in upper format (possible in async calls)
|
||||
core.get_mapgen_names() -> table of all map generator algorithms registered in
|
||||
the core (possible in async calls)
|
||||
|
||||
Favorites:
|
||||
core.get_favorites(location) -> list of favorites (possible in async calls)
|
||||
@@ -193,9 +197,11 @@ core.delete_world(index)
|
||||
Helpers:
|
||||
core.gettext(string) -> string
|
||||
^ look up the translation of a string in the gettext message catalog
|
||||
fgettext(string, ...) -> string
|
||||
fgettext_ne(string, ...)
|
||||
^ call core.gettext(string), replace "$1"..."$9" with the given
|
||||
^ extra arguments, call core.formspec_escape and return the result
|
||||
^ extra arguments and return the result
|
||||
fgettext(string, ...) -> string
|
||||
^ same as fgettext_ne(), but calls core.formspec_escape before returning result
|
||||
core.parse_json(string[, nullvalue]) -> something (possible in async calls)
|
||||
^ see core.parse_json (lua_api.txt)
|
||||
dump(obj, dumped={})
|
||||
@@ -207,6 +213,12 @@ string:trim()
|
||||
core.is_yes(arg) (possible in async calls)
|
||||
^ returns whether arg can be interpreted as yes
|
||||
|
||||
Version compat:
|
||||
core.get_min_supp_proto()
|
||||
^ returns the minimum supported network protocol version
|
||||
core.get_max_supp_proto()
|
||||
^ returns the maximum supported network protocol version
|
||||
|
||||
Async:
|
||||
core.handle_async(async_job,parameters,finished)
|
||||
^ execute a function asynchronously
|
||||
|
||||
@@ -81,7 +81,7 @@ Set world path
|
||||
.TP
|
||||
\-\-migrate <value>
|
||||
Migrate from current map backend to another. Possible values are sqlite3
|
||||
and leveldb. Only works when using --server.
|
||||
and leveldb. Only works when using \-\-server.
|
||||
|
||||
.SH ENVIRONMENT VARIABLES
|
||||
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<font type="bitmap">
|
||||
|
||||
<Texture index="0" filename="liberation_sans_14_img.png" hasAlpha="true" />
|
||||
|
||||
<c c="!" r="0, 0, 6, 18" />
|
||||
<c c=""" r="6, 0, 15, 9" />
|
||||
<c c="#" r="15, 0, 30, 18" />
|
||||
<c c="$" r="30, 0, 43, 20" />
|
||||
<c c="%" r="43, 0, 62, 18" />
|
||||
<c c="&" r="62, 0, 78, 18" />
|
||||
<c c="'" r="78, 0, 84, 9" />
|
||||
<c c="(" r="84, 0, 93, 22" />
|
||||
<c c=")" r="93, 0, 103, 22" />
|
||||
<c c="*" r="103, 0, 114, 12" />
|
||||
<c c="+" r="114, 0, 127, 16" />
|
||||
<c c="," r="127, 0, 133, 20" />
|
||||
<c c="-" r="133, 0, 141, 13" />
|
||||
<c c="." r="141, 0, 147, 18" />
|
||||
<c c="/" r="147, 0, 156, 18" />
|
||||
<c c="0" r="156, 0, 169, 18" />
|
||||
<c c="1" r="169, 0, 181, 18" />
|
||||
<c c="2" r="181, 0, 195, 18" />
|
||||
<c c="3" r="195, 0, 208, 18" />
|
||||
<c c="4" r="208, 0, 222, 18" />
|
||||
<c c="5" r="222, 0, 235, 18" />
|
||||
<c c="6" r="235, 0, 248, 18" />
|
||||
<c c="7" r="248, 0, 261, 18" />
|
||||
<c c="8" r="261, 0, 274, 18" />
|
||||
<c c="9" r="274, 0, 287, 18" />
|
||||
<c c=":" r="287, 0, 293, 18" />
|
||||
<c c=";" r="293, 0, 299, 20" />
|
||||
<c c="<" r="299, 0, 312, 16" />
|
||||
<c c="=" r="312, 0, 325, 15" />
|
||||
<c c=">" r="325, 0, 338, 16" />
|
||||
<c c="?" r="338, 0, 351, 18" />
|
||||
<c c="@" r="351, 0, 370, 21" />
|
||||
<c c="A" r="370, 0, 386, 18" />
|
||||
<c c="B" r="386, 0, 400, 18" />
|
||||
<c c="C" r="400, 0, 415, 18" />
|
||||
<c c="D" r="415, 0, 430, 18" />
|
||||
<c c="E" r="430, 0, 444, 18" />
|
||||
<c c="F" r="444, 0, 457, 18" />
|
||||
<c c="G" r="457, 0, 473, 18" />
|
||||
<c c="H" r="473, 0, 487, 18" />
|
||||
<c c="I" r="487, 0, 493, 18" />
|
||||
<c c="J" r="493, 0, 506, 18" />
|
||||
<c c="K" r="0, 22, 15, 40" />
|
||||
<c c="L" r="15, 22, 27, 40" />
|
||||
<c c="M" r="27, 22, 43, 40" />
|
||||
<c c="N" r="43, 22, 57, 40" />
|
||||
<c c="O" r="57, 22, 73, 40" />
|
||||
<c c="P" r="73, 22, 87, 40" />
|
||||
<c c="Q" r="87, 22, 103, 44" />
|
||||
<c c="R" r="103, 22, 118, 40" />
|
||||
<c c="S" r="118, 22, 133, 40" />
|
||||
<c c="T" r="133, 22, 147, 40" />
|
||||
<c c="U" r="147, 22, 161, 40" />
|
||||
<c c="V" r="161, 22, 177, 40" />
|
||||
<c c="W" r="177, 22, 199, 40" />
|
||||
<c c="X" r="199, 22, 216, 40" />
|
||||
<c c="Y" r="216, 22, 232, 40" />
|
||||
<c c="Z" r="232, 22, 247, 40" />
|
||||
<c c="[" r="247, 22, 255, 44" />
|
||||
<c c="\" r="255, 22, 264, 40" />
|
||||
<c c="]" r="264, 22, 272, 44" />
|
||||
<c c="^" r="272, 22, 283, 34" />
|
||||
<c c="_" r="283, 22, 298, 44" />
|
||||
<c c="`" r="298, 22, 306, 29" />
|
||||
<c c="a" r="306, 22, 319, 40" />
|
||||
<c c="b" r="319, 22, 333, 40" />
|
||||
<c c="c" r="333, 22, 345, 40" />
|
||||
<c c="d" r="345, 22, 358, 40" />
|
||||
<c c="e" r="358, 22, 371, 40" />
|
||||
<c c="f" r="371, 22, 381, 40" />
|
||||
<c c="g" r="381, 22, 394, 44" />
|
||||
<c c="h" r="394, 22, 406, 40" />
|
||||
<c c="i" r="406, 22, 412, 40" />
|
||||
<c c="j" r="412, 22, 420, 44" />
|
||||
<c c="k" r="420, 22, 432, 40" />
|
||||
<c c="l" r="432, 22, 438, 40" />
|
||||
<c c="m" r="438, 22, 456, 40" />
|
||||
<c c="n" r="456, 22, 468, 40" />
|
||||
<c c="o" r="468, 22, 481, 40" />
|
||||
<c c="p" r="481, 22, 495, 44" />
|
||||
<c c="q" r="495, 22, 508, 44" />
|
||||
<c c="r" r="0, 44, 10, 62" />
|
||||
<c c="s" r="10, 44, 22, 62" />
|
||||
<c c="t" r="22, 44, 31, 62" />
|
||||
<c c="u" r="31, 44, 43, 62" />
|
||||
<c c="v" r="43, 44, 56, 62" />
|
||||
<c c="w" r="56, 44, 73, 62" />
|
||||
<c c="x" r="73, 44, 86, 62" />
|
||||
<c c="y" r="86, 44, 99, 66" />
|
||||
<c c="z" r="99, 44, 111, 62" />
|
||||
<c c="{" r="111, 44, 121, 66" />
|
||||
<c c="|" r="121, 44, 127, 66" />
|
||||
<c c="}" r="127, 44, 137, 66" />
|
||||
<c c="~" r="137, 44, 150, 57" />
|
||||
</font>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 27 KiB |
@@ -886,7 +886,6 @@ minetest.register_node("default:glass", {
|
||||
description = "Glass",
|
||||
drawtype = "glasslike",
|
||||
tiles ={"default_glass.png"},
|
||||
inventory_image = minetest.inventorycube("default_glass.png"),
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
|
||||
|
||||
@@ -71,29 +71,6 @@ minetest.register_ore({
|
||||
height_max = -17,
|
||||
})
|
||||
|
||||
-- for float islands and far scaled
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_coal",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 8*8*8,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = 200,
|
||||
height_max = 31000,
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "default:stone_with_iron",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 9*9*9,
|
||||
clust_num_ores = 5,
|
||||
clust_size = 3,
|
||||
height_min = 200,
|
||||
height_max = 31000,
|
||||
})
|
||||
|
||||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
-- Generate clay
|
||||
if maxp.y >= 2 and minp.y <= 0 then
|
||||
@@ -134,3 +111,16 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||
end
|
||||
end)
|
||||
|
||||
--
|
||||
-- Register biome for biome API
|
||||
--
|
||||
|
||||
minetest.register_biome({
|
||||
name = "Grassland",
|
||||
-- Will use defaults of omitted parameters
|
||||
y_min = -31000,
|
||||
y_max = 31000,
|
||||
heat_point = 50,
|
||||
humidity_point = 50,
|
||||
})
|
||||
|
||||
|
||||
@@ -114,7 +114,11 @@
|
||||
# Enable smooth lighting with simple ambient occlusion.
|
||||
# Disable for speed or for different looks.
|
||||
#smooth_lighting = true
|
||||
# Path to texture directory. All textures are first searched from here.
|
||||
# Adjust the gamma encoding for the light tables. Valid values are in the range
|
||||
# 1.1 to 3.0 (inclusive); lower numbers are brighter. This setting is for the
|
||||
# client only and is ignored by the server
|
||||
#display_gamma = 1.8
|
||||
# Path to texture directory. All textures are first searched from here.
|
||||
#texture_path =
|
||||
# Video back-end.
|
||||
# Possible values: null, software, burningsvideo, direct3d8, direct3d9, opengl.
|
||||
@@ -212,6 +216,11 @@
|
||||
# Set to true enables waving plants. Requires shaders enabled.
|
||||
#enable_waving_plants = false
|
||||
# Enables caching of facedir rotated meshes
|
||||
#ambient_occlusion_gamma = 2.2
|
||||
# The strength (darkness) of node ambient-occlusion shading.
|
||||
# Lower is darker, Higher is lighter. The valid range of values for this
|
||||
# setting is 0.25 to 4.0 inclusive. If the value is out of range it will be
|
||||
# set to the nearest valid value.
|
||||
#enable_mesh_cache = true
|
||||
# The time in seconds it takes between repeated
|
||||
# right clicks when holding the right mouse button.
|
||||
@@ -220,7 +229,7 @@
|
||||
#directional_colored_fog = true
|
||||
# Delay showing tooltips, stated in milliseconds
|
||||
#tooltip_show_delay = 400
|
||||
# Adjust dpi configuration to your screen (Desktop only) e.g. for 4k screens
|
||||
# Adjust dpi configuration to your screen (non X11/Android only) e.g. for 4k screens
|
||||
#screen_dpi = 72
|
||||
# Default timeout for cURL, stated in milliseconds.
|
||||
# Only has an effect if compiled with cURL.
|
||||
@@ -243,16 +252,16 @@
|
||||
#freetype = true
|
||||
# Path to TrueTypeFont or bitmap
|
||||
#font_path = fonts/liberationsans.ttf
|
||||
#font_size = 13
|
||||
#font_size = 15
|
||||
# Font shadow offset, if 0 then shadow will not be drawn
|
||||
#font_shadow = 1
|
||||
# Font shadow alpha (opaqueness, between 0 and 255)
|
||||
#font_shadow_alpha = 128
|
||||
#mono_font_path = fonts/liberationmono.ttf
|
||||
#mono_font_size = 13
|
||||
#mono_font_size = 15
|
||||
# This font will be used for certain languages
|
||||
#fallback_font_path = fonts/DroidSansFallbackFull.ttf
|
||||
#fallback_font_size = 13
|
||||
#fallback_font_size = 15
|
||||
#fallback_font_shadow = 1
|
||||
#fallback_font_shadow_alpha = 128
|
||||
# Override language. When no value is provided (default) system language is used.
|
||||
@@ -328,6 +337,7 @@
|
||||
# If true, disable cheat prevention in multiplayer
|
||||
#disable_anticheat = false
|
||||
# If true, actions are recorded for rollback
|
||||
# This option is only read when server starts
|
||||
#enable_rollback_recording = false
|
||||
# Handling for deprecated lua api calls:
|
||||
# "legacy" = (try to) mimic old behaviour (default for release).
|
||||
@@ -538,10 +548,11 @@
|
||||
#mgv7_np_filler_depth = 0, 1.2, (150, 150, 150), 261, 4, 0.7, 2.0
|
||||
#mgv7_np_mount_height = 100, 30, (500, 500, 500), 72449, 4, 0.6, 2.0
|
||||
#mgv7_np_ridge_uwater = 0, 1, (500, 500, 500), 85039, 4, 0.6, 2.0
|
||||
#mgv7_np_mountain = 0, 1, (250, 350, 250), 5333, 5, 0.68, 2.0
|
||||
#mgv7_np_mountain = -0.6, 1, (250, 350, 250), 5333, 5, 0.68, 2.0
|
||||
#mgv7_np_ridge = 0, 1, (100, 100, 100), 6467, 4, 0.75, 2.0
|
||||
#mgv7_np_cave1 = 0, 12, (100, 100, 100), 52534, 4, 0.5, 2.0
|
||||
#mgv7_np_cave2 = 0, 12, (100, 100, 100), 10325, 4, 0.5, 2.0
|
||||
|
||||
# Noise parameters for biome API temperature and humidity
|
||||
#mg_biome_np_heat = 50, 50, (500, 500, 500), 5349, 3, 0.5, 2.0
|
||||
#mg_biome_np_humidity = 50, 50, (500, 500, 500), 842, 3, 0.5, 2.0
|
||||
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
Name=Minetest
|
||||
GenericName=Minetest
|
||||
Comment=Multiplayer infinite-world block sandbox
|
||||
Comment[fr]=Jeu multijoueurs de type bac à sable avec des mondes infinis
|
||||
Comment[de]=Mehrspieler-Sandkastenspiel mit unendlichen Blockwelten
|
||||
Exec=minetest
|
||||
Icon=minetest-icon
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Game;
|
||||
StartupNotify=false
|
||||
Keywords=sandbox;world;mining;crafting;blocks;nodes;multiplayer;roleplaying;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -232,7 +232,7 @@ msgstr "Credits"
|
||||
|
||||
#: builtin/mainmenu/tab_credits.lua:29
|
||||
msgid "Core Developers"
|
||||
msgstr "Core Entwickler"
|
||||
msgstr "Kernentwickler"
|
||||
|
||||
#: builtin/mainmenu/tab_credits.lua:43
|
||||
msgid "Active Contributors"
|
||||
@@ -248,11 +248,11 @@ msgstr "Installierte Mods:"
|
||||
|
||||
#: builtin/mainmenu/tab_mods.lua:39
|
||||
msgid "Online mod repository"
|
||||
msgstr "Online Mod Speicher"
|
||||
msgstr "Online-Mod-Speicher"
|
||||
|
||||
#: builtin/mainmenu/tab_mods.lua:78
|
||||
msgid "No mod description available"
|
||||
msgstr "Keine Mod Beschreibung verfügbar"
|
||||
msgstr "Keine Modbeschreibung verfügbar"
|
||||
|
||||
#: builtin/mainmenu/tab_mods.lua:82
|
||||
msgid "Mod information:"
|
||||
@@ -346,7 +346,7 @@ msgstr "Port"
|
||||
|
||||
#: builtin/mainmenu/tab_server.lua:51
|
||||
msgid "Server Port"
|
||||
msgstr "Server Port"
|
||||
msgstr "Serverport"
|
||||
|
||||
#: builtin/mainmenu/tab_server.lua:174
|
||||
msgid "Server"
|
||||
@@ -490,7 +490,7 @@ msgstr "Einzelspieler"
|
||||
|
||||
#: builtin/mainmenu/tab_texturepacks.lua:49
|
||||
msgid "Select texture pack:"
|
||||
msgstr "Texturen Paket auswählen:"
|
||||
msgstr "Texturpaket auswählen:"
|
||||
|
||||
#: builtin/mainmenu/tab_texturepacks.lua:69
|
||||
msgid "No information available"
|
||||
@@ -498,7 +498,7 @@ msgstr "Keine Informationen vorhanden"
|
||||
|
||||
#: builtin/mainmenu/tab_texturepacks.lua:114
|
||||
msgid "Texturepacks"
|
||||
msgstr "Texturen Pakete"
|
||||
msgstr "Texturpakete"
|
||||
|
||||
#: src/client.cpp:2726
|
||||
msgid "Item textures..."
|
||||
@@ -514,11 +514,11 @@ msgstr "Wiederbeleben"
|
||||
|
||||
#: src/game.cpp:2250
|
||||
msgid "Item definitions..."
|
||||
msgstr "Item Definitionen..."
|
||||
msgstr "Item-Definitionen..."
|
||||
|
||||
#: src/game.cpp:2255
|
||||
msgid "Node definitions..."
|
||||
msgstr "Node Definitionen..."
|
||||
msgstr "Node-Definitionen..."
|
||||
|
||||
#: src/game.cpp:2262
|
||||
msgid "Media..."
|
||||
@@ -658,7 +658,7 @@ msgstr "Passwörter passen nicht zusammen!"
|
||||
|
||||
#: src/guiVolumeChange.cpp:106
|
||||
msgid "Sound Volume: "
|
||||
msgstr "Sound Lautstärke: "
|
||||
msgstr "Soundlautstärke: "
|
||||
|
||||
#: src/guiVolumeChange.cpp:120
|
||||
msgid "Exit"
|
||||
|
||||
@@ -8,15 +8,15 @@ msgstr ""
|
||||
"Project-Id-Version: minetest\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2014-12-13 15:24+0100\n"
|
||||
"PO-Revision-Date: 2014-12-13 18:22+0200\n"
|
||||
"Last-Translator: Diego Martínez <lkaezadl3@yahoo.com>\n"
|
||||
"PO-Revision-Date: 2015-01-19 09:56+0100\n"
|
||||
"Last-Translator: Diego de las Heras <diegodelasheras@gmail.com>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: es\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 1.7-dev\n"
|
||||
"X-Generator: Poedit 1.7.3\n"
|
||||
|
||||
#: builtin/fstk/ui.lua:67
|
||||
msgid "Ok"
|
||||
@@ -29,12 +29,12 @@ msgstr "Mundo:"
|
||||
#: builtin/mainmenu/dlg_config_world.lua:30
|
||||
#: builtin/mainmenu/dlg_config_world.lua:32
|
||||
msgid "Hide Game"
|
||||
msgstr "Ocultar Juego"
|
||||
msgstr "Ocultar juego"
|
||||
|
||||
#: builtin/mainmenu/dlg_config_world.lua:36
|
||||
#: builtin/mainmenu/dlg_config_world.lua:38
|
||||
msgid "Hide mp content"
|
||||
msgstr "Esconder contenido mp"
|
||||
msgstr "Ocultar contenido mp"
|
||||
|
||||
#: builtin/mainmenu/dlg_config_world.lua:46
|
||||
msgid "Mod:"
|
||||
@@ -82,7 +82,7 @@ msgstr "Semilla"
|
||||
|
||||
#: builtin/mainmenu/dlg_create_world.lua:56
|
||||
msgid "Mapgen"
|
||||
msgstr "Generador de Mapas"
|
||||
msgstr "Generador de mapas"
|
||||
|
||||
#: builtin/mainmenu/dlg_create_world.lua:59
|
||||
msgid "Game"
|
||||
@@ -103,8 +103,8 @@ msgstr "Descarga algunos desde minetest.net"
|
||||
#: builtin/mainmenu/dlg_create_world.lua:72
|
||||
msgid "Warning: The minimal development test is meant for developers."
|
||||
msgstr ""
|
||||
"Advertencia: El juego \"Minimal development test\" está diseñado "
|
||||
"para desarrolladores."
|
||||
"Advertencia: El juego \"Minimal development test\" está diseñado para "
|
||||
"desarrolladores."
|
||||
|
||||
#: builtin/mainmenu/dlg_create_world.lua:73
|
||||
msgid "Download a subgame, such as minetest_game, from minetest.net"
|
||||
@@ -112,11 +112,11 @@ msgstr "Descarga un sub-juego, como minetest_game, desde minetest.net"
|
||||
|
||||
#: builtin/mainmenu/dlg_create_world.lua:97
|
||||
msgid "A world named \"$1\" already exists"
|
||||
msgstr "Ya hay un mundo llamado \"$1\""
|
||||
msgstr "Ya existe un mundo llamado \"$1\""
|
||||
|
||||
#: builtin/mainmenu/dlg_create_world.lua:116
|
||||
msgid "No worldname given or no game selected"
|
||||
msgstr "No se a dado un nombre al mundo o no se ha seleccionado uno"
|
||||
msgstr "No se ha dado un nombre al mundo o no se ha seleccionado uno"
|
||||
|
||||
#: builtin/mainmenu/dlg_delete_mod.lua:26
|
||||
msgid "Are you sure you want to delete \"$1\"?"
|
||||
@@ -138,11 +138,11 @@ msgstr "Modmgr: Error al borrar \"$1\""
|
||||
|
||||
#: builtin/mainmenu/dlg_delete_mod.lua:45
|
||||
msgid "Modmgr: invalid modpath \"$1\""
|
||||
msgstr "Modmgr: Dirección de mod \"$1\" inválida"
|
||||
msgstr "Modmgr: Ruta del mod \"$1\" inválida"
|
||||
|
||||
#: builtin/mainmenu/dlg_delete_world.lua:24
|
||||
msgid "Delete World \"$1\"?"
|
||||
msgstr "Eliminar Mundo \"$1\"?"
|
||||
msgstr "¿Eliminar el mundo \"$1\"?"
|
||||
|
||||
#: builtin/mainmenu/dlg_delete_world.lua:26
|
||||
msgid "No"
|
||||
@@ -161,13 +161,12 @@ msgid "Install Mod: file: \"$1\""
|
||||
msgstr "Instalar mod: Archivo: \"$1\""
|
||||
|
||||
#: builtin/mainmenu/modmgr.lua:343
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
"\n"
|
||||
"Install Mod: unsupported filetype \"$1\" or broken archive"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"Instalar mod: Tipo de archivo sin soporte \"$1\" o corrupto"
|
||||
"Instalar mod: Formato de archivo \"$1\" no soportado o archivo corrupto"
|
||||
|
||||
#: builtin/mainmenu/modmgr.lua:363
|
||||
msgid "Failed to install $1 to $2"
|
||||
@@ -177,11 +176,11 @@ msgstr "Fallo al instalar $1 en $2"
|
||||
msgid "Install Mod: unable to find suitable foldername for modpack $1"
|
||||
msgstr ""
|
||||
"Instalar mod: Imposible encontrar un nombre de archivo adecuado para el "
|
||||
"Paquete de mod $1"
|
||||
"paquete de mod $1"
|
||||
|
||||
#: builtin/mainmenu/modmgr.lua:386
|
||||
msgid "Install Mod: unable to find real modname for: $1"
|
||||
msgstr "Instalar mod: imposible encontrar el nombre real del mod para: $1"
|
||||
msgstr "Instalar mod: Imposible encontrar el nombre real del mod para: $1"
|
||||
|
||||
#: builtin/mainmenu/store.lua:88
|
||||
msgid "Unsorted"
|
||||
@@ -192,9 +191,8 @@ msgid "Search"
|
||||
msgstr "Buscar"
|
||||
|
||||
#: builtin/mainmenu/store.lua:125
|
||||
#, fuzzy
|
||||
msgid "Downloading"
|
||||
msgstr "Descargar"
|
||||
msgstr "Descargando"
|
||||
|
||||
#: builtin/mainmenu/store.lua:127
|
||||
msgid "please wait..."
|
||||
@@ -202,12 +200,11 @@ msgstr "por favor espere..."
|
||||
|
||||
#: builtin/mainmenu/store.lua:159
|
||||
msgid "Successfully installed:"
|
||||
msgstr "Instalado exitosamente:"
|
||||
msgstr "Instalado con éxito:"
|
||||
|
||||
#: builtin/mainmenu/store.lua:163
|
||||
#, fuzzy
|
||||
msgid "Shortname:"
|
||||
msgstr "Nombre del mundo"
|
||||
msgstr "Nombre corto:"
|
||||
|
||||
#: builtin/mainmenu/store.lua:167 src/guiFormSpecMenu.cpp:2866
|
||||
msgid "ok"
|
||||
@@ -225,9 +222,10 @@ msgstr "Reinstalar"
|
||||
msgid "Install"
|
||||
msgstr "Instalar"
|
||||
|
||||
# En el menú principal de mods pone repositorio no tienda.
|
||||
#: builtin/mainmenu/store.lua:522
|
||||
msgid "Close store"
|
||||
msgstr "Cerrar tienda"
|
||||
msgstr "Cerrar repositorio"
|
||||
|
||||
#: builtin/mainmenu/store.lua:530
|
||||
msgid "Page $1 of $2"
|
||||
@@ -239,7 +237,7 @@ msgstr "Créditos"
|
||||
|
||||
#: builtin/mainmenu/tab_credits.lua:29
|
||||
msgid "Core Developers"
|
||||
msgstr "Núcleo de desarrolladores"
|
||||
msgstr "Desarrolladores principales"
|
||||
|
||||
#: builtin/mainmenu/tab_credits.lua:43
|
||||
msgid "Active Contributors"
|
||||
@@ -259,46 +257,46 @@ msgstr "Repositorio de mods en línea"
|
||||
|
||||
#: builtin/mainmenu/tab_mods.lua:78
|
||||
msgid "No mod description available"
|
||||
msgstr "No hay descripción del mod disponible"
|
||||
msgstr "La descripción del mod no está disponible"
|
||||
|
||||
#: builtin/mainmenu/tab_mods.lua:82
|
||||
msgid "Mod information:"
|
||||
msgstr "Informacion de mod:"
|
||||
msgstr "Información del mod:"
|
||||
|
||||
#: builtin/mainmenu/tab_mods.lua:93
|
||||
msgid "Rename"
|
||||
msgstr "Renombrar"
|
||||
|
||||
# El nombre completo no cabe.
|
||||
#: builtin/mainmenu/tab_mods.lua:95
|
||||
#, fuzzy
|
||||
msgid "Uninstall selected modpack"
|
||||
msgstr "Desinstalar paquete de mods"
|
||||
msgstr "Desinstalar el paquete selecc."
|
||||
|
||||
#: builtin/mainmenu/tab_mods.lua:106
|
||||
msgid "Uninstall selected mod"
|
||||
msgstr "Desinstalar mod seleccionado"
|
||||
msgstr "Desinstalar el mod seleccionado"
|
||||
|
||||
#: builtin/mainmenu/tab_mods.lua:121
|
||||
msgid "Select Mod File:"
|
||||
msgstr "Selecciona fichero mod:"
|
||||
msgstr "Selecciona el fichero del mod:"
|
||||
|
||||
#: builtin/mainmenu/tab_mods.lua:165
|
||||
msgid "Mods"
|
||||
msgstr "Mods"
|
||||
|
||||
#: builtin/mainmenu/tab_multiplayer.lua:23
|
||||
msgid "Address/Port"
|
||||
msgstr "Dirección/Puerto"
|
||||
msgid "Address / Port :"
|
||||
msgstr "Dirección / puerto:"
|
||||
|
||||
#: builtin/mainmenu/tab_multiplayer.lua:24 builtin/mainmenu/tab_server.lua:37
|
||||
#: builtin/mainmenu/tab_simple_main.lua:25
|
||||
msgid "Name/Password"
|
||||
msgstr "Nombre/Clave"
|
||||
msgid "Name / Password :"
|
||||
msgstr "Nombre / contraseña:"
|
||||
|
||||
#: builtin/mainmenu/tab_multiplayer.lua:29
|
||||
#: builtin/mainmenu/tab_simple_main.lua:30
|
||||
msgid "Public Serverlist"
|
||||
msgstr "Lista de Servidores Públicos"
|
||||
msgstr "Lista de servidores públicos"
|
||||
|
||||
#: builtin/mainmenu/tab_multiplayer.lua:34 builtin/mainmenu/tab_server.lua:26
|
||||
#: builtin/mainmenu/tab_singleplayer.lua:85 src/keycode.cpp:230
|
||||
@@ -324,7 +322,7 @@ msgstr "Configurar"
|
||||
|
||||
#: builtin/mainmenu/tab_server.lua:29
|
||||
msgid "Start Game"
|
||||
msgstr "Iniciar Juego"
|
||||
msgstr "Iniciar juego"
|
||||
|
||||
#: builtin/mainmenu/tab_server.lua:30 builtin/mainmenu/tab_singleplayer.lua:89
|
||||
msgid "Select World:"
|
||||
@@ -346,7 +344,7 @@ msgstr "Público"
|
||||
|
||||
#: builtin/mainmenu/tab_server.lua:45
|
||||
msgid "Bind Address"
|
||||
msgstr "Asociar Dirección"
|
||||
msgstr "Asociar dirección"
|
||||
|
||||
#: builtin/mainmenu/tab_server.lua:47
|
||||
msgid "Port"
|
||||
@@ -354,7 +352,7 @@ msgstr "Puerto"
|
||||
|
||||
#: builtin/mainmenu/tab_server.lua:51
|
||||
msgid "Server Port"
|
||||
msgstr "Puerto de Servidor"
|
||||
msgstr "Puerto del servidor:"
|
||||
|
||||
#: builtin/mainmenu/tab_server.lua:174
|
||||
msgid "Server"
|
||||
@@ -362,7 +360,7 @@ msgstr "Servidor"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:23
|
||||
msgid "Are you sure to reset your singleplayer world?"
|
||||
msgstr "¿Estás seguro de querer reiniciar el mundo de un solo jugador?"
|
||||
msgstr "¿Estás seguro de querer reiniciar el mundo de un jugador?"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:27
|
||||
msgid "No!!!"
|
||||
@@ -370,7 +368,7 @@ msgstr "¡¡¡No!!!"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:134
|
||||
msgid "Smooth Lighting"
|
||||
msgstr "Iluminación Suave"
|
||||
msgstr "Iluminación suave"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:136
|
||||
msgid "Enable Particles"
|
||||
@@ -386,15 +384,15 @@ msgstr "Árboles detallados"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:142
|
||||
msgid "Opaque Water"
|
||||
msgstr "Agua Opaca"
|
||||
msgstr "Agua opaca"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:145
|
||||
msgid "Connected Glass"
|
||||
msgstr "Vidrios Conectados"
|
||||
msgstr "Vidrios conectados"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:149
|
||||
msgid "Restart minetest for driver change to take effect"
|
||||
msgstr "Reinicia Minetest para que el cambio de controlador tenga efecto"
|
||||
msgstr "Reinicia minetest para que los cambios en el controlador tengan efecto"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:151
|
||||
msgid "Mip-Mapping"
|
||||
@@ -418,16 +416,15 @@ msgstr "Sombreadores"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:164
|
||||
msgid "Change keys"
|
||||
msgstr "Configurar Teclas"
|
||||
msgstr "Configurar teclas"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:167
|
||||
#, fuzzy
|
||||
msgid "Reset singleplayer world"
|
||||
msgstr "Un jugador"
|
||||
msgstr "Reiniciar mundo de un jugador"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:171
|
||||
msgid "GUI scale factor"
|
||||
msgstr "Factor de escala de la IGU"
|
||||
msgstr "Factor de escala (GUI)"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:175
|
||||
msgid "Scaling factor applied to menu elements: "
|
||||
@@ -449,7 +446,7 @@ msgstr "Mapeado de relieve"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:196 builtin/mainmenu/tab_settings.lua:209
|
||||
msgid "Generate Normalmaps"
|
||||
msgstr "Generar mapas de normales"
|
||||
msgstr "Generar mapas normales"
|
||||
|
||||
#: builtin/mainmenu/tab_settings.lua:198 builtin/mainmenu/tab_settings.lua:210
|
||||
msgid "Parallax Occlusion"
|
||||
@@ -501,16 +498,16 @@ msgstr "Un jugador"
|
||||
|
||||
#: builtin/mainmenu/tab_texturepacks.lua:49
|
||||
msgid "Select texture pack:"
|
||||
msgstr "Seleccione paquete de texturas:"
|
||||
msgstr "Seleccione un paquete de texturas:"
|
||||
|
||||
#: builtin/mainmenu/tab_texturepacks.lua:69
|
||||
msgid "No information available"
|
||||
msgstr "Sin informacion disponible"
|
||||
msgstr "Sin información disponible"
|
||||
|
||||
# No cabe "Paquetes de texturas".
|
||||
#: builtin/mainmenu/tab_texturepacks.lua:114
|
||||
#, fuzzy
|
||||
msgid "Texturepacks"
|
||||
msgstr "Paquete de texturas"
|
||||
msgstr "Texturas"
|
||||
|
||||
#: src/client.cpp:2726
|
||||
msgid "Item textures..."
|
||||
@@ -526,11 +523,11 @@ msgstr "Revivir"
|
||||
|
||||
#: src/game.cpp:2250
|
||||
msgid "Item definitions..."
|
||||
msgstr "Definición de objetos..."
|
||||
msgstr "Definiciones de objetos..."
|
||||
|
||||
#: src/game.cpp:2255
|
||||
msgid "Node definitions..."
|
||||
msgstr "Definiendo nodos..."
|
||||
msgstr "Definiciones de nodos..."
|
||||
|
||||
#: src/game.cpp:2262
|
||||
msgid "Media..."
|
||||
@@ -538,11 +535,11 @@ msgstr "Media..."
|
||||
|
||||
#: src/game.cpp:2267
|
||||
msgid " KB/s"
|
||||
msgstr ""
|
||||
msgstr " KB/s"
|
||||
|
||||
#: src/game.cpp:2271
|
||||
msgid " MB/s"
|
||||
msgstr ""
|
||||
msgstr " MB/s"
|
||||
|
||||
#: src/game.cpp:4220
|
||||
msgid ""
|
||||
@@ -563,25 +560,24 @@ msgstr "Ingresar "
|
||||
#: src/guiKeyChangeMenu.cpp:125
|
||||
msgid "Keybindings. (If this menu screws up, remove stuff from minetest.conf)"
|
||||
msgstr ""
|
||||
"Combinaciones de teclas.(Si este menú da error, cambiar configuración en "
|
||||
"minetest.conf)"
|
||||
"Combinaciones de teclas. (Si este menú da error, elimina líneas en minetest."
|
||||
"conf)"
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:165
|
||||
msgid "\"Use\" = climb down"
|
||||
msgstr "\"Usar\" = Descender"
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:180
|
||||
#, fuzzy
|
||||
msgid "Double tap \"jump\" to toggle fly"
|
||||
msgstr "Saltar dos veces para volar"
|
||||
msgstr "Pulsar dos veces \"saltar\" para volar"
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:296
|
||||
msgid "Key already in use"
|
||||
msgstr "La tecla se está utilizando"
|
||||
msgstr "La tecla ya se está utilizando"
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:371
|
||||
msgid "press key"
|
||||
msgstr "Pulsa una tecla"
|
||||
msgstr "pulsa una tecla"
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:397
|
||||
msgid "Forward"
|
||||
@@ -633,11 +629,11 @@ msgstr "Consola"
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:409
|
||||
msgid "Toggle fly"
|
||||
msgstr "Activar Volar"
|
||||
msgstr "Activar volar"
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:410
|
||||
msgid "Toggle fast"
|
||||
msgstr "Activar Rápido"
|
||||
msgstr "Activar rápido"
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:411
|
||||
msgid "Toggle noclip"
|
||||
@@ -649,7 +645,7 @@ msgstr "Seleccionar distancia"
|
||||
|
||||
#: src/guiKeyChangeMenu.cpp:413
|
||||
msgid "Print stacks"
|
||||
msgstr "Imprimir Pilas"
|
||||
msgstr "Imprimir pilas"
|
||||
|
||||
#: src/guiPasswordChange.cpp:106
|
||||
msgid "Old Password"
|
||||
@@ -657,7 +653,7 @@ msgstr "Contraseña anterior"
|
||||
|
||||
#: src/guiPasswordChange.cpp:122
|
||||
msgid "New Password"
|
||||
msgstr "Nueva contraseña"
|
||||
msgstr "Contraseña nueva"
|
||||
|
||||
#: src/guiPasswordChange.cpp:137
|
||||
msgid "Confirm Password"
|
||||
@@ -673,23 +669,24 @@ msgstr "¡Las contraseñas no coinciden!"
|
||||
|
||||
#: src/guiVolumeChange.cpp:106
|
||||
msgid "Sound Volume: "
|
||||
msgstr "Volúmen del Sonido: "
|
||||
msgstr "Volúmen del sonido: "
|
||||
|
||||
# Es en el menú de sonido. Salir suena muy fuerte.
|
||||
#: src/guiVolumeChange.cpp:120
|
||||
msgid "Exit"
|
||||
msgstr "Salir"
|
||||
msgstr "Cerrar"
|
||||
|
||||
#: src/keycode.cpp:224
|
||||
msgid "Left Button"
|
||||
msgstr "Click Izquierdo"
|
||||
msgstr "Botón izquierdo"
|
||||
|
||||
#: src/keycode.cpp:224
|
||||
msgid "Middle Button"
|
||||
msgstr "Click Centro"
|
||||
msgstr "Botón central"
|
||||
|
||||
#: src/keycode.cpp:224
|
||||
msgid "Right Button"
|
||||
msgstr "Click Derecho"
|
||||
msgstr "Botón derecho"
|
||||
|
||||
#: src/keycode.cpp:224
|
||||
msgid "X Button 1"
|
||||
@@ -697,7 +694,7 @@ msgstr "X Button 1"
|
||||
|
||||
#: src/keycode.cpp:225
|
||||
msgid "Back"
|
||||
msgstr "Atras"
|
||||
msgstr "Atrás"
|
||||
|
||||
#: src/keycode.cpp:225
|
||||
msgid "Clear"
|
||||
@@ -705,7 +702,7 @@ msgstr "Limpiar"
|
||||
|
||||
#: src/keycode.cpp:225
|
||||
msgid "Return"
|
||||
msgstr "Intro"
|
||||
msgstr "Retorno"
|
||||
|
||||
#: src/keycode.cpp:225
|
||||
msgid "Tab"
|
||||
@@ -717,7 +714,7 @@ msgstr "X Button 2"
|
||||
|
||||
#: src/keycode.cpp:226
|
||||
msgid "Capital"
|
||||
msgstr "Bloq mayús"
|
||||
msgstr "Bloq Mayús"
|
||||
|
||||
#: src/keycode.cpp:226
|
||||
msgid "Control"
|
||||
@@ -821,7 +818,7 @@ msgstr "Captura de pantalla"
|
||||
|
||||
#: src/keycode.cpp:233
|
||||
msgid "Left Windows"
|
||||
msgstr "Win Izquierdo"
|
||||
msgstr "Win izq."
|
||||
|
||||
#: src/keycode.cpp:234
|
||||
msgid "Apps"
|
||||
@@ -829,15 +826,15 @@ msgstr "Aplicaciones"
|
||||
|
||||
#: src/keycode.cpp:234
|
||||
msgid "Numpad 0"
|
||||
msgstr "Teclado numérico 0"
|
||||
msgstr "Numpad 0"
|
||||
|
||||
#: src/keycode.cpp:234
|
||||
msgid "Numpad 1"
|
||||
msgstr "Teclado Numérico 1"
|
||||
msgstr "Numpad 1"
|
||||
|
||||
#: src/keycode.cpp:234
|
||||
msgid "Right Windows"
|
||||
msgstr "Win Derecho"
|
||||
msgstr "Win der."
|
||||
|
||||
#: src/keycode.cpp:234
|
||||
msgid "Sleep"
|
||||
@@ -845,51 +842,51 @@ msgstr "Suspender"
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad 2"
|
||||
msgstr "Teclado numérico 2"
|
||||
msgstr "Numpad 2"
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad 3"
|
||||
msgstr "Teclado Numérico 3"
|
||||
msgstr "Numpad 3"
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad 4"
|
||||
msgstr "Teclado numérico 4"
|
||||
msgstr "Numpad 4"
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad 5"
|
||||
msgstr "Teclado Numérico 5"
|
||||
msgstr "Numpad 5"
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad 6"
|
||||
msgstr "Teclado Numérico 6"
|
||||
msgstr "Numpad 6"
|
||||
|
||||
#: src/keycode.cpp:235
|
||||
msgid "Numpad 7"
|
||||
msgstr "Teclado numérico 7"
|
||||
msgstr "Numpad 7"
|
||||
|
||||
#: src/keycode.cpp:236
|
||||
msgid "Numpad *"
|
||||
msgstr "Teclado numérico *"
|
||||
msgstr "Numpad *"
|
||||
|
||||
#: src/keycode.cpp:236
|
||||
msgid "Numpad +"
|
||||
msgstr "Teclado Numérico +"
|
||||
msgstr "Numpad +"
|
||||
|
||||
#: src/keycode.cpp:236
|
||||
msgid "Numpad -"
|
||||
msgstr "Teclado Numérico -"
|
||||
msgstr "Numpad -"
|
||||
|
||||
#: src/keycode.cpp:236
|
||||
msgid "Numpad /"
|
||||
msgstr "Teclado Numérico /"
|
||||
msgstr "Numpad /"
|
||||
|
||||
#: src/keycode.cpp:236
|
||||
msgid "Numpad 8"
|
||||
msgstr "Teclado Numérico 8"
|
||||
msgstr "Numpad 8"
|
||||
|
||||
#: src/keycode.cpp:236
|
||||
msgid "Numpad 9"
|
||||
msgstr "Teclado Numérico 9"
|
||||
msgstr "Numpad 9"
|
||||
|
||||
#: src/keycode.cpp:240
|
||||
msgid "Num Lock"
|
||||
@@ -901,27 +898,27 @@ msgstr "Bloq Despl"
|
||||
|
||||
#: src/keycode.cpp:241
|
||||
msgid "Left Shift"
|
||||
msgstr "Shift Izqda"
|
||||
msgstr "Shift izq."
|
||||
|
||||
#: src/keycode.cpp:241
|
||||
msgid "Right Shift"
|
||||
msgstr "Shift Dcha"
|
||||
msgstr "Shift der."
|
||||
|
||||
#: src/keycode.cpp:242
|
||||
msgid "Left Control"
|
||||
msgstr "Control Izqdo"
|
||||
msgstr "Control izq."
|
||||
|
||||
#: src/keycode.cpp:242
|
||||
msgid "Left Menu"
|
||||
msgstr "Menú Izquierdo"
|
||||
msgstr "Menú izq."
|
||||
|
||||
#: src/keycode.cpp:242
|
||||
msgid "Right Control"
|
||||
msgstr "Control Dcho"
|
||||
msgstr "Control der."
|
||||
|
||||
#: src/keycode.cpp:242
|
||||
msgid "Right Menu"
|
||||
msgstr "Menú Derecho"
|
||||
msgstr "Menú der."
|
||||
|
||||
#: src/keycode.cpp:244
|
||||
msgid "Comma"
|
||||
@@ -969,7 +966,7 @@ msgstr "Zoom"
|
||||
|
||||
#: src/main.cpp:1681
|
||||
msgid "Main Menu"
|
||||
msgstr "Menú Principal"
|
||||
msgstr "Menú principal"
|
||||
|
||||
#: src/main.cpp:1719
|
||||
msgid "Player name too long."
|
||||
@@ -982,7 +979,8 @@ msgstr "Error de conexión (¿tiempo agotado?)"
|
||||
#: src/main.cpp:1919
|
||||
msgid "No world selected and no address provided. Nothing to do."
|
||||
msgstr ""
|
||||
"No se seleccionó mundo y no se ha especificado una dirección. Nada que hacer."
|
||||
"No se seleccionó el mundo y no se ha especificado una dirección. Nada que "
|
||||
"hacer."
|
||||
|
||||
#: src/main.cpp:1926
|
||||
msgid "Provided world path doesn't exist: "
|
||||
@@ -1009,7 +1007,7 @@ msgid ""
|
||||
"- Mouse wheel: select item\n"
|
||||
"- T: chat\n"
|
||||
msgstr ""
|
||||
"Controles Pred.:\n"
|
||||
"Controles predeterminados:\n"
|
||||
"- WASD: moverse\n"
|
||||
"- Espacio: saltar/subir\n"
|
||||
"- Mayús.: puntillas/bajar\n"
|
||||
@@ -1018,8 +1016,8 @@ msgstr ""
|
||||
"- Ratón: girar/mirar\n"
|
||||
"- Ratón izq.: cavar/golpear\n"
|
||||
"- Ratón der.: colocar/usar\n"
|
||||
"- Rueda ratón: elegir objeto\n"
|
||||
"- T: conversar\n"
|
||||
"- Ratón rueda: elegir objeto\n"
|
||||
"- T: chat\n"
|
||||
|
||||
msgid "is required by:"
|
||||
msgstr "es requerido por:"
|
||||
@@ -1028,11 +1026,10 @@ msgid "Configuration saved. "
|
||||
msgstr "Configuración guardada. "
|
||||
|
||||
msgid "Warning: Configuration not consistent. "
|
||||
msgstr "Advertencia: La configuración no corresponde. "
|
||||
msgstr "Advertencia: La configuración no es coherente."
|
||||
|
||||
msgid "Cannot create world: Name contains invalid characters"
|
||||
msgstr ""
|
||||
"No se puede crear el mundo: El nombre contiene caracteres no válidos"
|
||||
msgstr "No se puede crear el mundo: El nombre contiene caracteres no válidos"
|
||||
|
||||
msgid "Multiplayer"
|
||||
msgstr "Multijugador"
|
||||
@@ -1041,22 +1038,19 @@ msgid "Advanced"
|
||||
msgstr "Avanzado"
|
||||
|
||||
msgid "Show Public"
|
||||
msgstr "Servidores Públicos"
|
||||
msgstr "Mostrar público"
|
||||
|
||||
msgid "Show Favorites"
|
||||
msgstr "Mostrar Favoritos"
|
||||
msgstr "Mostrar favoritos"
|
||||
|
||||
msgid "Leave address blank to start a local server."
|
||||
msgstr "Dejar la dirección en blanco para iniciar un servidor local."
|
||||
|
||||
#~ msgid "Create world"
|
||||
#~ msgstr "Crear Mundo"
|
||||
|
||||
msgid "Address required."
|
||||
msgstr "Requiere una dirección."
|
||||
|
||||
msgid "Cannot delete world: Nothing selected"
|
||||
msgstr "No se puede eliminar el mundo: ninguno ha sido seleccionado"
|
||||
msgstr "No se puede eliminar el mundo: Ninguno seleccionado"
|
||||
|
||||
msgid "Files to be deleted"
|
||||
msgstr "Archivos que se eliminarán"
|
||||
@@ -1070,43 +1064,18 @@ msgstr "No se puede configurar el mundo: Ninguno seleccionado"
|
||||
msgid "Failed to delete all world files"
|
||||
msgstr "No se pudo eliminar todos los archivos del mundo"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "Default Controls:\n"
|
||||
#~ "- WASD: Walk\n"
|
||||
#~ "- Mouse left: dig/hit\n"
|
||||
#~ "- Mouse right: place/use\n"
|
||||
#~ "- Mouse wheel: select item\n"
|
||||
#~ "- 0...9: select item\n"
|
||||
#~ "- Shift: sneak\n"
|
||||
#~ "- R: Toggle viewing all loaded chunks\n"
|
||||
#~ "- I: Inventory menu\n"
|
||||
#~ "- ESC: This menu\n"
|
||||
#~ "- T: Chat\n"
|
||||
#~ msgstr ""
|
||||
#~ "Controles predeterminados:\n"
|
||||
#~ "- WASD: Caminar \n"
|
||||
#~ "- Ratón, izquierdo: Cavar/Golpear\n"
|
||||
#~ "- Ratón, derecho: Poner bloque/Usar\n"
|
||||
#~ "- Ratón, rueda: seleccionar objecto\n"
|
||||
#~ "- 0... 9: Seleccionar objecto\n"
|
||||
#~ "- Mayúscula: caminar despacio\n"
|
||||
#~ "- R: Ajustar distancia de los pedazos cargados\n"
|
||||
#~ "- I: Inventario \n"
|
||||
#~ "- ESC: Este Menu\n"
|
||||
#~ "- T: Conversar\n"
|
||||
|
||||
msgid ""
|
||||
"Warning: Some configured mods are missing.\n"
|
||||
"Their setting will be removed when you save the configuration. "
|
||||
msgstr ""
|
||||
"ADVERTENCIA: Algunos mods configurados faltan.\n"
|
||||
"Su ajuste se quitará al guardar la configuración. "
|
||||
"Advertencia: Algunos mods configurados faltan.\n"
|
||||
"Sus ajustes se eliminarán al guardar la configuración. "
|
||||
|
||||
msgid ""
|
||||
"Warning: Some mods are not configured yet.\n"
|
||||
"They will be enabled by default when you save the configuration. "
|
||||
msgstr ""
|
||||
"ADVERTENCIA: Algunos mods no están aún configurados.\n"
|
||||
"Advertencia: Algunos mods todavía no están configurados.\n"
|
||||
"Se habilitarán de forma predeterminada al guardar la configuración. "
|
||||
|
||||
msgid "Exit to OS"
|
||||
@@ -1116,10 +1085,10 @@ msgid "Exit to Menu"
|
||||
msgstr "Salir al menú"
|
||||
|
||||
msgid "Sound Volume"
|
||||
msgstr "Volumen del Sonido"
|
||||
msgstr "Volumen del sonido"
|
||||
|
||||
msgid "Change Password"
|
||||
msgstr "Modificar contraseña"
|
||||
msgstr "Cambiar contraseña"
|
||||
|
||||
msgid "Continue"
|
||||
msgstr "Continuar"
|
||||
@@ -1127,8 +1096,8 @@ msgstr "Continuar"
|
||||
msgid "You died."
|
||||
msgstr "Has muerto."
|
||||
|
||||
msgid "Shutting down stuff..."
|
||||
msgstr "Apagando cosas..."
|
||||
msgid "Shutting down..."
|
||||
msgstr "Cerrando..."
|
||||
|
||||
msgid "Connecting to server..."
|
||||
msgstr "Conectando al servidor..."
|
||||
@@ -1161,13 +1130,13 @@ msgid "Favorites:"
|
||||
msgstr "Favoritos:"
|
||||
|
||||
msgid "<<-- Add mod"
|
||||
msgstr "Añadir modificación"
|
||||
msgstr "<<-- Añadir mod"
|
||||
|
||||
msgid "Remove selected mod"
|
||||
msgstr "Eliminar mod seleccionado"
|
||||
msgstr "Eliminar el mod seleccionado"
|
||||
|
||||
msgid "Mods:"
|
||||
msgstr "Modificaciones:"
|
||||
msgstr "Mods:"
|
||||
|
||||
msgid "Games"
|
||||
msgstr "Juegos"
|
||||
@@ -1176,4 +1145,28 @@ msgid "Gamemgr: Unable to copy mod \"$1\" to game \"$2\""
|
||||
msgstr "Gamemgr: Imposible copiar el mod \"$1\" al juego \"$2\""
|
||||
|
||||
msgid "Game Name"
|
||||
msgstr "Nombre del Juego"
|
||||
msgstr "Nombre del juego"
|
||||
|
||||
msgid "Change Keys"
|
||||
msgstr "Configurar teclas"
|
||||
|
||||
msgid "Name/Password"
|
||||
msgstr "Nombre / contraseña:"
|
||||
|
||||
msgid "Node Highlighting"
|
||||
msgstr "Resaltar nodos"
|
||||
|
||||
msgid "Texturing:"
|
||||
msgstr "Texturizado:"
|
||||
|
||||
msgid "Rendering:"
|
||||
msgstr "Renderizado:"
|
||||
|
||||
msgid "Rebuilding shaders..."
|
||||
msgstr "Reconstruyendo sombreadores..."
|
||||
|
||||
msgid "Initializing nodes..."
|
||||
msgstr "Inicializando nodos..."
|
||||
|
||||
msgid "Done!"
|
||||
msgstr "¡Completado!"
|
||||
|
||||
1051
po/ja/minetest.po
1051
po/ja/minetest.po
File diff suppressed because it is too large
Load Diff
@@ -4,10 +4,26 @@ cmake_minimum_required( VERSION 2.6 )
|
||||
INCLUDE(CheckCSourceRuns)
|
||||
INCLUDE(CheckIncludeFiles)
|
||||
|
||||
# Add custom SemiDebug build mode
|
||||
set(CMAKE_CXX_FLAGS_SEMIDEBUG "-O1 -g -Wall -Wabi" CACHE STRING
|
||||
"Flags used by the C++ compiler during semidebug builds."
|
||||
FORCE
|
||||
)
|
||||
set(CMAKE_C_FLAGS_SEMIDEBUG "-O1 -g -Wall -pedantic" CACHE STRING
|
||||
"Flags used by the C compiler during semidebug builds."
|
||||
FORCE
|
||||
)
|
||||
mark_as_advanced(
|
||||
CMAKE_CXX_FLAGS_SEMIDEBUG
|
||||
CMAKE_C_FLAGS_SEMIDEBUG
|
||||
)
|
||||
set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
|
||||
"Choose the type of build. Options are: None Debug SemiDebug RelWithDebInfo MinSizeRel."
|
||||
FORCE
|
||||
)
|
||||
|
||||
# Set some random things default to not being visible in the GUI
|
||||
mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
|
||||
mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARY)
|
||||
mark_as_advanced(JSON_INCLUDE_DIR JSON_LIBRARY)
|
||||
|
||||
option(ENABLE_CURL "Enable cURL support for fetching media" 1)
|
||||
|
||||
@@ -112,6 +128,7 @@ add_definitions ( -DUSE_CMAKE_CONFIG_H )
|
||||
if(WIN32)
|
||||
# Windows
|
||||
if(MSVC) # MSVC Specifics
|
||||
set(PLATFORM_LIBS dbghelp.lib ${PLATFORM_LIBS})
|
||||
# Surpress some useless warnings
|
||||
add_definitions ( /D "_CRT_SECURE_NO_DEPRECATE" /W1 )
|
||||
else() # Probably MinGW = GCC
|
||||
@@ -174,7 +191,7 @@ else()
|
||||
set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY})
|
||||
endif()
|
||||
|
||||
find_package(Sqlite3 REQUIRED)
|
||||
find_package(SQLite3 REQUIRED)
|
||||
find_package(Json REQUIRED)
|
||||
|
||||
option(ENABLE_GLES "Enable OpenGL ES support" 0)
|
||||
@@ -297,7 +314,7 @@ endif(ENABLE_LEVELDB)
|
||||
|
||||
set(USE_REDIS 0)
|
||||
|
||||
OPTION(ENABLE_REDIS "Enable redis backend" 1)
|
||||
OPTION(ENABLE_REDIS "Enable redis backend" 0)
|
||||
|
||||
if(ENABLE_REDIS)
|
||||
find_library(REDIS_LIBRARY hiredis)
|
||||
@@ -610,10 +627,12 @@ if(MSVC)
|
||||
# Visual Studio
|
||||
|
||||
# EHa enables SEH exceptions (used for catching segfaults)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /O2 /Ob2 /Oi /Ot /Oy /GL /FD /MT /GS- /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /Ox /Ob2 /Oi /Ot /Oy /GL /FD /MT /GS- /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP")
|
||||
#set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /NODEFAULTLIB:\"libcmtd.lib\" /NODEFAULTLIB:\"libcmt.lib\"")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_SEMIDEBUG "/MDd /Zi /Ob0 /O1 /RTC1")
|
||||
|
||||
# Debug build doesn't catch exceptions by itself
|
||||
# Add some optimizations because otherwise it's VERY slow
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1")
|
||||
@@ -638,18 +657,6 @@ else()
|
||||
set(RELEASE_WARNING_FLAGS "")
|
||||
endif()
|
||||
|
||||
if(NOT APPLE AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
CHECK_CXX_COMPILER_FLAG("-Wno-unused-but-set-variable" HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
|
||||
if(HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
|
||||
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-unused-but-set-variable")
|
||||
endif(HAS_UNUSED_BUT_SET_VARIABLE_WARNING)
|
||||
|
||||
CHECK_CXX_COMPILER_FLAG("-Wno-type-limits" HAS_TYPE_LIMITS_WARNING)
|
||||
if(HAS_TYPE_LIMITS_WARNING)
|
||||
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-type-limits")
|
||||
endif(HAS_TYPE_LIMITS_WARNING)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
# clang does not understand __extern_always_inline but libc headers use it
|
||||
set(OTHER_FLAGS "${OTHER_FLAGS} \"-D__extern_always_inline=extern __always_inline\"")
|
||||
@@ -665,7 +672,8 @@ else()
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fomit-frame-pointer")
|
||||
endif(APPLE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O1 -Wall ${WARNING_FLAGS} ${OTHER_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 -Wall -Wabi ${WARNING_FLAGS} ${OTHER_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wabi ${WARNING_FLAGS} ${OTHER_FLAGS}")
|
||||
|
||||
if(USE_GPROF)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg")
|
||||
@@ -711,6 +719,9 @@ if(WIN32)
|
||||
if(FREETYPE_DLL)
|
||||
install(FILES ${FREETYPE_DLL} DESTINATION ${BINDIR})
|
||||
endif()
|
||||
if(SQLITE3_DLL)
|
||||
install(FILES ${SQLITE3_DLL} DESTINATION ${BINDIR})
|
||||
endif()
|
||||
if(LEVELDB_DLL)
|
||||
install(FILES ${LEVELDB_DLL} DESTINATION ${BINDIR})
|
||||
endif()
|
||||
@@ -774,11 +785,6 @@ endif(USE_GETTEXT)
|
||||
|
||||
# Subdirectories
|
||||
|
||||
if (SQLITE3_FOUND)
|
||||
else (SQLITE3_FOUND)
|
||||
add_subdirectory(sqlite)
|
||||
endif (SQLITE3_FOUND)
|
||||
|
||||
if (BUILD_CLIENT AND USE_FREETYPE)
|
||||
add_subdirectory(cguittfont)
|
||||
endif (BUILD_CLIENT AND USE_FREETYPE)
|
||||
|
||||
@@ -270,7 +270,7 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime,
|
||||
{
|
||||
f32 oldy = old_player_position.Y;
|
||||
f32 newy = player_position.Y;
|
||||
f32 t = exp(-10*frametime);
|
||||
f32 t = exp(-23*frametime);
|
||||
player_position.Y = oldy * t + newy * (1-t);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ void CaveV6::makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height) {
|
||||
// Add generation notify end event
|
||||
abs_pos = v3s16(of.X + orp.X, of.Y + orp.Y, of.Z + orp.Z);
|
||||
notifytype = large_cave ?
|
||||
GENNOTIFY_LARGECAVE_BEGIN : GENNOTIFY_CAVE_BEGIN;
|
||||
GENNOTIFY_LARGECAVE_END : GENNOTIFY_CAVE_END;
|
||||
mg->gennotify.addEvent(notifytype, abs_pos);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class MapgenV7;
|
||||
class CaveV6 {
|
||||
public:
|
||||
MapgenV6 *mg;
|
||||
ManualMapVoxelManipulator *vm;
|
||||
MMVManip *vm;
|
||||
INodeDefManager *ndef;
|
||||
|
||||
s16 min_tunnel_diameter;
|
||||
@@ -44,22 +44,22 @@ class CaveV6 {
|
||||
s16 max_stone_y;
|
||||
v3s16 node_min;
|
||||
v3s16 node_max;
|
||||
|
||||
|
||||
v3f orp; // starting point, relative to caved space
|
||||
v3s16 of; // absolute coordinates of caved space
|
||||
v3s16 ar; // allowed route area
|
||||
s16 rs; // tunnel radius size
|
||||
v3f main_direction;
|
||||
|
||||
|
||||
s16 route_y_min;
|
||||
s16 route_y_max;
|
||||
|
||||
|
||||
PseudoRandom *ps;
|
||||
PseudoRandom *ps2;
|
||||
|
||||
|
||||
content_t c_water_source;
|
||||
content_t c_lava_source;
|
||||
|
||||
|
||||
int water_level;
|
||||
|
||||
CaveV6() {}
|
||||
@@ -72,7 +72,7 @@ class CaveV6 {
|
||||
class CaveV7 {
|
||||
public:
|
||||
MapgenV7 *mg;
|
||||
ManualMapVoxelManipulator *vm;
|
||||
MMVManip *vm;
|
||||
INodeDefManager *ndef;
|
||||
|
||||
NoiseParams *np_caveliquids;
|
||||
@@ -90,22 +90,22 @@ class CaveV7 {
|
||||
s16 max_stone_y;
|
||||
v3s16 node_min;
|
||||
v3s16 node_max;
|
||||
|
||||
|
||||
v3f orp; // starting point, relative to caved space
|
||||
v3s16 of; // absolute coordinates of caved space
|
||||
v3s16 ar; // allowed route area
|
||||
s16 rs; // tunnel radius size
|
||||
v3f main_direction;
|
||||
|
||||
|
||||
s16 route_y_min;
|
||||
s16 route_y_max;
|
||||
|
||||
|
||||
PseudoRandom *ps;
|
||||
|
||||
|
||||
content_t c_water_source;
|
||||
content_t c_lava_source;
|
||||
content_t c_ice;
|
||||
|
||||
|
||||
int water_level;
|
||||
|
||||
CaveV7() {}
|
||||
|
||||
@@ -87,10 +87,10 @@ video::IImage* SGUITTGlyph::createGlyphImage(const FT_Bitmap& bits, video::IVide
|
||||
const u32 image_pitch = image->getPitch() / sizeof(u16);
|
||||
u16* image_data = (u16*)image->lock();
|
||||
u8* glyph_data = bits.buffer;
|
||||
for (s32 y = 0; y < bits.rows; ++y)
|
||||
for (int y = 0; y < bits.rows; ++y)
|
||||
{
|
||||
u16* row = image_data;
|
||||
for (s32 x = 0; x < bits.width; ++x)
|
||||
for (int x = 0; x < bits.width; ++x)
|
||||
{
|
||||
// Monochrome bitmaps store 8 pixels per byte. The left-most pixel is the bit 0x80.
|
||||
// So, we go through the data each bit at a time.
|
||||
@@ -116,10 +116,10 @@ video::IImage* SGUITTGlyph::createGlyphImage(const FT_Bitmap& bits, video::IVide
|
||||
const u32 image_pitch = image->getPitch() / sizeof(u32);
|
||||
u32* image_data = (u32*)image->lock();
|
||||
u8* glyph_data = bits.buffer;
|
||||
for (s32 y = 0; y < bits.rows; ++y)
|
||||
for (int y = 0; y < bits.rows; ++y)
|
||||
{
|
||||
u8* row = glyph_data;
|
||||
for (s32 x = 0; x < bits.width; ++x)
|
||||
for (int x = 0; x < bits.width; ++x)
|
||||
{
|
||||
image_data[y * image_pitch + x] |= static_cast<u32>(255.0f * (static_cast<float>(*row++) / gray_count)) << 24;
|
||||
//data[y * image_pitch + x] |= ((u32)(*bitsdata++) << 24);
|
||||
|
||||
@@ -45,8 +45,10 @@
|
||||
#define __BYTE_ORDER 0
|
||||
#define __LITTLE_ENDIAN 0
|
||||
#define __BIG_ENDIAN 1
|
||||
#elif __MACH__
|
||||
#elif defined(__MACH__) && defined(__APPLE__)
|
||||
#include <machine/endian.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <sys/endian.h>
|
||||
#else
|
||||
#include <endian.h>
|
||||
#endif
|
||||
|
||||
@@ -774,5 +774,5 @@ void ChatBackend::scrollPageDown()
|
||||
|
||||
void ChatBackend::scrollPageUp()
|
||||
{
|
||||
m_console_buffer.scroll(-m_console_buffer.getRows());
|
||||
m_console_buffer.scroll(-(s32)m_console_buffer.getRows());
|
||||
}
|
||||
|
||||
231
src/client.cpp
231
src/client.cpp
@@ -79,7 +79,7 @@ QueuedMeshUpdate::~QueuedMeshUpdate()
|
||||
/*
|
||||
MeshUpdateQueue
|
||||
*/
|
||||
|
||||
|
||||
MeshUpdateQueue::MeshUpdateQueue()
|
||||
{
|
||||
}
|
||||
@@ -130,7 +130,7 @@ void MeshUpdateQueue::addBlock(v3s16 p, MeshMakeData *data, bool ack_block_to_se
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Add the block
|
||||
*/
|
||||
@@ -173,7 +173,7 @@ void * MeshUpdateThread::Thread()
|
||||
log_register_thread("MeshUpdateThread");
|
||||
|
||||
DSTACK(__FUNCTION_NAME);
|
||||
|
||||
|
||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||
|
||||
porting::setThreadName("MeshUpdateThread");
|
||||
@@ -219,7 +219,6 @@ Client::Client(
|
||||
IrrlichtDevice *device,
|
||||
const char *playername,
|
||||
std::string password,
|
||||
bool is_simple_singleplayer_game,
|
||||
MapDrawControl &control,
|
||||
IWritableTextureSource *tsrc,
|
||||
IWritableShaderSource *shsrc,
|
||||
@@ -248,6 +247,7 @@ Client::Client(
|
||||
device->getSceneManager(),
|
||||
tsrc, this, device
|
||||
),
|
||||
m_particle_manager(&m_env),
|
||||
m_con(PROTOCOL_ID, 512, CONNECTION_TIMEOUT, ipv6, this),
|
||||
m_device(device),
|
||||
m_server_ser_ver(SER_FMT_VER_INVALID),
|
||||
@@ -282,34 +282,6 @@ Client::Client(
|
||||
m_env.addPlayer(player);
|
||||
}
|
||||
|
||||
if (g_settings->getBool("enable_local_map_saving")
|
||||
&& !is_simple_singleplayer_game) {
|
||||
const std::string world_path = porting::path_user + DIR_DELIM + "worlds"
|
||||
+ DIR_DELIM + "server_" + g_settings->get("address")
|
||||
+ "_" + g_settings->get("remote_port");
|
||||
|
||||
SubgameSpec gamespec;
|
||||
if (!getWorldExists(world_path)) {
|
||||
gamespec = findSubgame(g_settings->get("default_game"));
|
||||
if (!gamespec.isValid())
|
||||
gamespec = findSubgame("minimal");
|
||||
} else {
|
||||
std::string world_gameid = getWorldGameId(world_path, false);
|
||||
gamespec = findWorldSubgame(world_path);
|
||||
}
|
||||
if (!gamespec.isValid()) {
|
||||
errorstream << "Couldn't find subgame for local map saving." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
localserver = new Server(world_path, gamespec, false, false);
|
||||
localdb = new Database_SQLite3(&(ServerMap&)localserver->getMap(), world_path);
|
||||
localdb->beginSave();
|
||||
actionstream << "Local map saving started, map will be saved at '" << world_path << "'" << std::endl;
|
||||
} else {
|
||||
localdb = NULL;
|
||||
}
|
||||
|
||||
m_cache_smooth_lighting = g_settings->getBool("smooth_lighting");
|
||||
}
|
||||
|
||||
@@ -320,6 +292,7 @@ void Client::Stop()
|
||||
if (localdb != NULL) {
|
||||
actionstream << "Local map saving ended" << std::endl;
|
||||
localdb->endSave();
|
||||
delete localserver;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,9 +335,14 @@ Client::~Client()
|
||||
}
|
||||
}
|
||||
|
||||
void Client::connect(Address address)
|
||||
void Client::connect(Address address,
|
||||
const std::string &address_name,
|
||||
bool is_local_server)
|
||||
{
|
||||
DSTACK(__FUNCTION_NAME);
|
||||
|
||||
initLocalMapSaving(address, address_name, is_local_server);
|
||||
|
||||
m_con.SetTimeoutMs(0);
|
||||
m_con.Connect(address);
|
||||
}
|
||||
@@ -381,7 +359,7 @@ void Client::step(float dtime)
|
||||
m_ignore_damage_timer -= dtime;
|
||||
else
|
||||
m_ignore_damage_timer = 0.0;
|
||||
|
||||
|
||||
m_animation_time += dtime;
|
||||
if(m_animation_time > 60.0)
|
||||
m_animation_time -= 60.0;
|
||||
@@ -399,7 +377,7 @@ void Client::step(float dtime)
|
||||
if(counter <= 0.0)
|
||||
{
|
||||
counter = 20.0;
|
||||
|
||||
|
||||
infostream << "Client packetcounter (" << m_packetcounter_timer
|
||||
<< "):"<<std::endl;
|
||||
m_packetcounter.print(infostream);
|
||||
@@ -415,7 +393,7 @@ void Client::step(float dtime)
|
||||
NOTE: This jams the game for a while because deleting sectors
|
||||
clear caches
|
||||
*/
|
||||
|
||||
|
||||
float &counter = m_delete_unused_sectors_timer;
|
||||
counter -= dtime;
|
||||
if(counter <= 0.0)
|
||||
@@ -430,12 +408,12 @@ void Client::step(float dtime)
|
||||
|
||||
float delete_unused_sectors_timeout =
|
||||
g_settings->getFloat("client_delete_unused_sectors_timeout");
|
||||
|
||||
|
||||
// Delete sector blocks
|
||||
/*u32 num = m_env.getMap().unloadUnusedData
|
||||
(delete_unused_sectors_timeout,
|
||||
true, &deleted_blocks);*/
|
||||
|
||||
|
||||
// Delete whole sectors
|
||||
m_env.getMap().unloadUnusedData
|
||||
(delete_unused_sectors_timeout,
|
||||
@@ -447,14 +425,14 @@ void Client::step(float dtime)
|
||||
<<" unused sectors"<<std::endl;*/
|
||||
/*infostream<<"Client: Deleted "<<num
|
||||
<<" unused sectors"<<std::endl;*/
|
||||
|
||||
|
||||
/*
|
||||
Send info to server
|
||||
*/
|
||||
|
||||
// Env is locked so con can be locked.
|
||||
//JMutexAutoLock lock(m_con_mutex); //bulk comment-out
|
||||
|
||||
|
||||
core::list<v3s16>::Iterator i = deleted_blocks.begin();
|
||||
core::list<v3s16> sendlist;
|
||||
for(;;)
|
||||
@@ -512,7 +490,7 @@ void Client::step(float dtime)
|
||||
counter = 2.0;
|
||||
|
||||
//JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
|
||||
|
||||
|
||||
Player *myplayer = m_env.getLocalPlayer();
|
||||
assert(myplayer != NULL);
|
||||
// Send TOSERVER_INIT
|
||||
@@ -534,7 +512,7 @@ void Client::step(float dtime)
|
||||
|
||||
memset((char*)&data[23], 0, PASSWORD_SIZE);
|
||||
snprintf((char*)&data[23], PASSWORD_SIZE, "%s", m_password.c_str());
|
||||
|
||||
|
||||
writeU16(&data[51], CLIENT_PROTOCOL_VERSION_MIN);
|
||||
writeU16(&data[53], CLIENT_PROTOCOL_VERSION_MAX);
|
||||
|
||||
@@ -549,7 +527,7 @@ void Client::step(float dtime)
|
||||
/*
|
||||
Do stuff if connected
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Run Map's timers and unload unused data
|
||||
*/
|
||||
@@ -561,11 +539,11 @@ void Client::step(float dtime)
|
||||
m_env.getMap().timerUpdate(map_timer_and_unload_dtime,
|
||||
g_settings->getFloat("client_unload_unused_data_timeout"),
|
||||
&deleted_blocks);
|
||||
|
||||
|
||||
/*if(deleted_blocks.size() > 0)
|
||||
infostream<<"Client: Unloaded "<<deleted_blocks.size()
|
||||
<<" unused blocks"<<std::endl;*/
|
||||
|
||||
|
||||
/*
|
||||
Send info to server
|
||||
NOTE: This loop is intentionally iterated the way it is.
|
||||
@@ -622,7 +600,7 @@ void Client::step(float dtime)
|
||||
|
||||
// Step environment
|
||||
m_env.step(dtime);
|
||||
|
||||
|
||||
/*
|
||||
Get events
|
||||
*/
|
||||
@@ -638,7 +616,7 @@ void Client::step(float dtime)
|
||||
if(m_ignore_damage_timer <= 0)
|
||||
{
|
||||
u8 damage = event.player_damage.amount;
|
||||
|
||||
|
||||
if(event.player_damage.send_to_server)
|
||||
sendDamage(damage);
|
||||
|
||||
@@ -788,7 +766,7 @@ void Client::step(float dtime)
|
||||
m_sound->updateSoundPosition(client_id, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Handle removed remotely initiated sounds
|
||||
*/
|
||||
@@ -835,7 +813,7 @@ bool Client::loadMedia(const std::string &data, const std::string &filename)
|
||||
{
|
||||
// Silly irrlicht's const-incorrectness
|
||||
Buffer<char> data_rw(data.c_str(), data.size());
|
||||
|
||||
|
||||
std::string name;
|
||||
|
||||
const char *image_ext[] = {
|
||||
@@ -963,6 +941,41 @@ void Client::received_media()
|
||||
<<std::endl;
|
||||
}
|
||||
|
||||
void Client::initLocalMapSaving(const Address &address,
|
||||
const std::string &hostname,
|
||||
bool is_local_server)
|
||||
{
|
||||
localdb = NULL;
|
||||
|
||||
if (!g_settings->getBool("enable_local_map_saving") || is_local_server)
|
||||
return;
|
||||
|
||||
const std::string world_path = porting::path_user
|
||||
+ DIR_DELIM + "worlds"
|
||||
+ DIR_DELIM + "server_"
|
||||
+ hostname + "_" + to_string(address.getPort());
|
||||
|
||||
SubgameSpec gamespec;
|
||||
|
||||
if (!getWorldExists(world_path)) {
|
||||
gamespec = findSubgame(g_settings->get("default_game"));
|
||||
if (!gamespec.isValid())
|
||||
gamespec = findSubgame("minimal");
|
||||
} else {
|
||||
gamespec = findWorldSubgame(world_path);
|
||||
}
|
||||
|
||||
if (!gamespec.isValid()) {
|
||||
errorstream << "Couldn't find subgame for local map saving." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
localserver = new Server(world_path, gamespec, false, false);
|
||||
localdb = new Database_SQLite3(&(ServerMap&)localserver->getMap(), world_path);
|
||||
localdb->beginSave();
|
||||
actionstream << "Local map saving started, map will be saved at '" << world_path << "'" << std::endl;
|
||||
}
|
||||
|
||||
void Client::ReceiveAll()
|
||||
{
|
||||
DSTACK(__FUNCTION_NAME);
|
||||
@@ -973,7 +986,7 @@ void Client::ReceiveAll()
|
||||
// process
|
||||
if(porting::getTimeMs() > start_ms + 100)
|
||||
break;
|
||||
|
||||
|
||||
try{
|
||||
Receive();
|
||||
g_profiler->graphAdd("client_received_packets", 1);
|
||||
@@ -1018,7 +1031,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
|
||||
//infostream<<"Client: received command="<<command<<std::endl;
|
||||
m_packetcounter.add((u16)command);
|
||||
|
||||
|
||||
/*
|
||||
If this check is removed, be sure to change the queue
|
||||
system to know the ids
|
||||
@@ -1049,7 +1062,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
<<"unsupported ser_fmt_ver"<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
m_server_ser_ver = deployed;
|
||||
|
||||
// Get player position
|
||||
@@ -1058,12 +1071,12 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
playerpos_s16 = readV3S16(&data[2+1]);
|
||||
v3f playerpos_f = intToFloat(playerpos_s16, BS) - v3f(0, BS/2, 0);
|
||||
|
||||
|
||||
|
||||
// Set player position
|
||||
Player *player = m_env.getLocalPlayer();
|
||||
assert(player != NULL);
|
||||
player->setPosition(playerpos_f);
|
||||
|
||||
|
||||
if(datasize >= 2+1+6+8)
|
||||
{
|
||||
// Get map seed
|
||||
@@ -1078,7 +1091,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
infostream<<"Client: received recommended send interval "
|
||||
<<m_recommended_send_interval<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
// Reply to server
|
||||
u32 replysize = 2;
|
||||
SharedBuffer<u8> reply(replysize);
|
||||
@@ -1114,7 +1127,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
" Skipping incoming command="<<command<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Handle runtime commands
|
||||
*/
|
||||
@@ -1145,13 +1158,13 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
|
||||
MapNode n;
|
||||
n.deSerialize(&data[8], ser_version);
|
||||
|
||||
|
||||
bool remove_metadata = true;
|
||||
u32 index = 8 + MapNode::serializedLength(ser_version);
|
||||
if ((datasize >= index+1) && data[index]){
|
||||
remove_metadata = false;
|
||||
}
|
||||
|
||||
|
||||
addNode(p, n, remove_metadata);
|
||||
}
|
||||
else if(command == TOCLIENT_BLOCKDATA)
|
||||
@@ -1159,23 +1172,23 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
// Ignore too small packet
|
||||
if(datasize < 8)
|
||||
return;
|
||||
|
||||
|
||||
v3s16 p;
|
||||
p.X = readS16(&data[2]);
|
||||
p.Y = readS16(&data[4]);
|
||||
p.Z = readS16(&data[6]);
|
||||
|
||||
|
||||
std::string datastring((char*)&data[8], datasize-8);
|
||||
std::istringstream istr(datastring, std::ios_base::binary);
|
||||
|
||||
|
||||
MapSector *sector;
|
||||
MapBlock *block;
|
||||
|
||||
|
||||
v2s16 p2d(p.X, p.Z);
|
||||
sector = m_env.getMap().emergeSector(p2d);
|
||||
|
||||
|
||||
assert(sector->getPos() == p2d);
|
||||
|
||||
|
||||
block = sector->getBlockNoCreateNoEx(p.Y);
|
||||
if(block)
|
||||
{
|
||||
@@ -1226,7 +1239,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
{
|
||||
if(datasize < 4)
|
||||
return;
|
||||
|
||||
|
||||
u16 time_of_day = readU16(&data[2]);
|
||||
time_of_day = time_of_day % 24000;
|
||||
float time_speed = 0;
|
||||
@@ -1256,7 +1269,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
<<" time_diff="<<time_diff<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update environment
|
||||
m_env.setTimeOfDay(time_of_day);
|
||||
m_env.setTimeOfDaySpeed(time_speed);
|
||||
@@ -1277,18 +1290,18 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
u8 buf[6];
|
||||
std::string datastring((char*)&data[2], datasize-2);
|
||||
std::istringstream is(datastring, std::ios_base::binary);
|
||||
|
||||
|
||||
// Read stuff
|
||||
is.read((char*) buf, 2);
|
||||
u16 len = readU16(buf);
|
||||
|
||||
|
||||
std::wstring message;
|
||||
for(unsigned int i=0; i<len; i++)
|
||||
{
|
||||
is.read((char*)buf, 2);
|
||||
message += (wchar_t)readU16(buf);
|
||||
}
|
||||
|
||||
|
||||
m_chat_queue.push_back(message);
|
||||
}
|
||||
else if(command == TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD)
|
||||
@@ -1457,10 +1470,10 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
{
|
||||
std::string datastring((char*)&data[2], datasize-2);
|
||||
std::istringstream is(datastring, std::ios_base::binary);
|
||||
|
||||
|
||||
bool set_camera_point_target = readU8(is);
|
||||
v3f camera_point_target = readV3F1000(is);
|
||||
|
||||
|
||||
ClientEvent event;
|
||||
event.type = CE_DEATHSCREEN;
|
||||
event.deathscreen.set_camera_point_target = set_camera_point_target;
|
||||
@@ -1475,7 +1488,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
std::istringstream is(datastring, std::ios_base::binary);
|
||||
|
||||
int num_files = readU16(is);
|
||||
|
||||
|
||||
infostream<<"Client: Received media announcement: packet size: "
|
||||
<<datasize<<std::endl;
|
||||
|
||||
@@ -1674,7 +1687,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
{
|
||||
std::string datastring((char*)&data[2], datasize-2);
|
||||
std::istringstream is(datastring, std::ios_base::binary);
|
||||
|
||||
|
||||
m_privileges.clear();
|
||||
infostream<<"Client: Privileges updated: ";
|
||||
u16 num_privileges = readU16(is);
|
||||
@@ -1699,7 +1712,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
std::istringstream is(datastring, std::ios_base::binary);
|
||||
|
||||
std::string name = deSerializeString(is);
|
||||
|
||||
|
||||
infostream<<"Client: Detached inventory update: \""<<name<<"\""<<std::endl;
|
||||
|
||||
Inventory *inv = NULL;
|
||||
@@ -1877,13 +1890,13 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
v3f v3fdata;
|
||||
u32 intdata = 0;
|
||||
v2s32 v2s32data;
|
||||
|
||||
|
||||
std::string datastring((char *)&data[2], datasize - 2);
|
||||
std::istringstream is(datastring, std::ios_base::binary);
|
||||
|
||||
u32 id = readU32(is);
|
||||
u8 stat = (HudElementStat)readU8(is);
|
||||
|
||||
|
||||
if (stat == HUD_STAT_POS || stat == HUD_STAT_SCALE ||
|
||||
stat == HUD_STAT_ALIGN || stat == HUD_STAT_OFFSET)
|
||||
v2fdata = readV2F1000(is);
|
||||
@@ -1895,7 +1908,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
v2s32data = readV2S32(is);
|
||||
else
|
||||
intdata = readU32(is);
|
||||
|
||||
|
||||
ClientEvent event;
|
||||
event.type = CE_HUDCHANGE;
|
||||
event.hudchange.id = id;
|
||||
@@ -1914,7 +1927,7 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
|
||||
|
||||
u32 flags = readU32(is);
|
||||
u32 mask = readU32(is);
|
||||
|
||||
|
||||
player->hud_flags &= ~mask;
|
||||
player->hud_flags |= flags;
|
||||
}
|
||||
@@ -2073,7 +2086,7 @@ void Client::sendNodemetaFields(v3s16 p, const std::string &formname,
|
||||
// Send as reliable
|
||||
Send(0, data, true);
|
||||
}
|
||||
|
||||
|
||||
void Client::sendInventoryFields(const std::string &formname,
|
||||
const std::map<std::string, std::string> &fields)
|
||||
{
|
||||
@@ -2103,13 +2116,13 @@ void Client::sendInventoryAction(InventoryAction *a)
|
||||
{
|
||||
std::ostringstream os(std::ios_base::binary);
|
||||
u8 buf[12];
|
||||
|
||||
|
||||
// Write command
|
||||
writeU16(buf, TOSERVER_INVENTORY_ACTION);
|
||||
os.write((char*)buf, 2);
|
||||
|
||||
a->serialize(os);
|
||||
|
||||
|
||||
// Make data buffer
|
||||
std::string s = os.str();
|
||||
SharedBuffer<u8> data((u8*)s.c_str(), s.size());
|
||||
@@ -2121,11 +2134,11 @@ void Client::sendChatMessage(const std::wstring &message)
|
||||
{
|
||||
std::ostringstream os(std::ios_base::binary);
|
||||
u8 buf[12];
|
||||
|
||||
|
||||
// Write command
|
||||
writeU16(buf, TOSERVER_CHAT_MESSAGE);
|
||||
os.write((char*)buf, 2);
|
||||
|
||||
|
||||
// Write length
|
||||
size_t messagesize = message.size();
|
||||
if (messagesize > 0xFFFF) {
|
||||
@@ -2133,7 +2146,7 @@ void Client::sendChatMessage(const std::wstring &message)
|
||||
}
|
||||
writeU16(buf, (u16) messagesize);
|
||||
os.write((char*)buf, 2);
|
||||
|
||||
|
||||
// Write string
|
||||
for(unsigned int i=0; i<message.size(); i++)
|
||||
{
|
||||
@@ -2141,7 +2154,7 @@ void Client::sendChatMessage(const std::wstring &message)
|
||||
writeU16(buf, w);
|
||||
os.write((char*)buf, 2);
|
||||
}
|
||||
|
||||
|
||||
// Make data buffer
|
||||
std::string s = os.str();
|
||||
SharedBuffer<u8> data((u8*)s.c_str(), s.size());
|
||||
@@ -2275,13 +2288,13 @@ void Client::sendPlayerPos()
|
||||
//JMutexAutoLock lock(m_con_mutex); //bulk comment-out
|
||||
our_peer_id = m_con.GetPeerID();
|
||||
}
|
||||
|
||||
|
||||
// Set peer id if not set already
|
||||
if(myplayer->peer_id == PEER_ID_INEXISTENT)
|
||||
myplayer->peer_id = our_peer_id;
|
||||
// Check that an existing peer_id is the same as the connection's
|
||||
assert(myplayer->peer_id == our_peer_id);
|
||||
|
||||
|
||||
v3f pf = myplayer->getPosition();
|
||||
v3f sf = myplayer->getSpeed();
|
||||
s32 pitch = myplayer->getPitch() * 100;
|
||||
@@ -2343,7 +2356,7 @@ void Client::removeNode(v3s16 p)
|
||||
catch(InvalidPositionException &e)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
for(std::map<v3s16, MapBlock * >::iterator
|
||||
i = modified_blocks.begin();
|
||||
i != modified_blocks.end(); ++i)
|
||||
@@ -2365,7 +2378,7 @@ void Client::addNode(v3s16 p, MapNode n, bool remove_metadata)
|
||||
}
|
||||
catch(InvalidPositionException &e)
|
||||
{}
|
||||
|
||||
|
||||
for(std::map<v3s16, MapBlock * >::iterator
|
||||
i = modified_blocks.begin();
|
||||
i != modified_blocks.end(); ++i)
|
||||
@@ -2373,7 +2386,7 @@ void Client::addNode(v3s16 p, MapNode n, bool remove_metadata)
|
||||
addUpdateMeshTaskWithEdge(i->first, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Client::setPlayerControl(PlayerControl &control)
|
||||
{
|
||||
LocalPlayer *player = m_env.getLocalPlayer();
|
||||
@@ -2472,7 +2485,7 @@ ClientActiveObject * Client::getSelectedActiveObject(
|
||||
std::vector<DistanceSortedActiveObject> objects;
|
||||
|
||||
m_env.getActiveObjects(from_pos_f_on_map, max_d, objects);
|
||||
|
||||
|
||||
// Sort them.
|
||||
// After this, the closest object is the first in the array.
|
||||
std::sort(objects.begin(), objects.end());
|
||||
@@ -2480,7 +2493,7 @@ ClientActiveObject * Client::getSelectedActiveObject(
|
||||
for(unsigned int i=0; i<objects.size(); i++)
|
||||
{
|
||||
ClientActiveObject *obj = objects[i].obj;
|
||||
|
||||
|
||||
core::aabbox3d<f32> *selection_box = obj->getSelectionBox();
|
||||
if(selection_box == NULL)
|
||||
continue;
|
||||
@@ -2702,18 +2715,30 @@ void Client::afterContentReceived(IrrlichtDevice *device, gui::IGUIFont* font)
|
||||
assert(m_itemdef_received);
|
||||
assert(m_nodedef_received);
|
||||
assert(mediaReceived());
|
||||
|
||||
|
||||
const wchar_t* text = wgettext("Loading textures...");
|
||||
|
||||
// Rebuild inherited images and recreate textures
|
||||
infostream<<"- Rebuilding images and textures"<<std::endl;
|
||||
draw_load_screen(text,device, guienv, 0, 70);
|
||||
m_tsrc->rebuildImagesAndTextures();
|
||||
delete[] text;
|
||||
|
||||
// Rebuild shaders
|
||||
infostream<<"- Rebuilding shaders"<<std::endl;
|
||||
text = wgettext("Rebuilding shaders...");
|
||||
draw_load_screen(text, device, guienv, 0, 75);
|
||||
m_shsrc->rebuildShaders();
|
||||
delete[] text;
|
||||
|
||||
// Update node aliases
|
||||
infostream<<"- Updating node aliases"<<std::endl;
|
||||
text = wgettext("Initializing nodes...");
|
||||
draw_load_screen(text, device, guienv, 0, 80);
|
||||
m_nodedef->updateAliases(m_itemdef);
|
||||
m_nodedef->setNodeRegistrationStatus(true);
|
||||
m_nodedef->runNodeResolverCallbacks();
|
||||
delete[] text;
|
||||
|
||||
// Update node textures and assign shaders to each tile
|
||||
infostream<<"- Updating node textures"<<std::endl;
|
||||
@@ -2723,21 +2748,21 @@ void Client::afterContentReceived(IrrlichtDevice *device, gui::IGUIFont* font)
|
||||
if(g_settings->getBool("preload_item_visuals"))
|
||||
{
|
||||
verbosestream<<"Updating item textures and meshes"<<std::endl;
|
||||
wchar_t* text = wgettext("Item textures...");
|
||||
text = wgettext("Item textures...");
|
||||
draw_load_screen(text, device, guienv, 0, 0);
|
||||
std::set<std::string> names = m_itemdef->getAll();
|
||||
size_t size = names.size();
|
||||
size_t count = 0;
|
||||
int percent = 0;
|
||||
for(std::set<std::string>::const_iterator
|
||||
i = names.begin(); i != names.end(); ++i){
|
||||
i = names.begin(); i != names.end(); ++i)
|
||||
{
|
||||
// Asking for these caches the result
|
||||
m_itemdef->getInventoryTexture(*i, this);
|
||||
m_itemdef->getWieldMesh(*i, this);
|
||||
count++;
|
||||
percent = count*100/size;
|
||||
if (count%50 == 0) // only update every 50 item
|
||||
draw_load_screen(text, device, guienv, 0, percent);
|
||||
percent = (count * 100 / size * 0.2) + 80;
|
||||
draw_load_screen(text, device, guienv, 0, percent);
|
||||
}
|
||||
delete[] text;
|
||||
}
|
||||
@@ -2745,10 +2770,13 @@ void Client::afterContentReceived(IrrlichtDevice *device, gui::IGUIFont* font)
|
||||
// Start mesh update thread after setting up content definitions
|
||||
infostream<<"- Starting mesh update thread"<<std::endl;
|
||||
m_mesh_update_thread.Start();
|
||||
|
||||
|
||||
m_state = LC_Ready;
|
||||
sendReady();
|
||||
text = wgettext("Done!");
|
||||
draw_load_screen(text, device, guienv, 0, 100);
|
||||
infostream<<"Client::afterContentReceived() done"<<std::endl;
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
float Client::getRTT(void)
|
||||
@@ -2839,6 +2867,11 @@ MtEventManager* Client::getEventManager()
|
||||
return m_event;
|
||||
}
|
||||
|
||||
ParticleManager* Client::getParticleManager()
|
||||
{
|
||||
return &m_particle_manager;
|
||||
}
|
||||
|
||||
scene::IAnimatedMesh* Client::getMesh(const std::string &filename)
|
||||
{
|
||||
std::map<std::string, std::string>::const_iterator i =
|
||||
|
||||
45
src/client.h
45
src/client.h
@@ -74,7 +74,7 @@ class MeshUpdateQueue
|
||||
MeshUpdateQueue();
|
||||
|
||||
~MeshUpdateQueue();
|
||||
|
||||
|
||||
/*
|
||||
peer_id=0 adds with nobody to send to
|
||||
*/
|
||||
@@ -90,7 +90,7 @@ class MeshUpdateQueue
|
||||
JMutexAutoLock lock(m_mutex);
|
||||
return m_queue.size();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::vector<QueuedMeshUpdate*> m_queue;
|
||||
std::set<v3s16> m_urgents;
|
||||
@@ -127,7 +127,7 @@ class MeshUpdateThread : public JThread
|
||||
MutexedQueue<MeshUpdateResult> m_queue_out;
|
||||
|
||||
IGameDef *m_gamedef;
|
||||
|
||||
|
||||
v3s16 m_camera_offset;
|
||||
};
|
||||
|
||||
@@ -152,8 +152,8 @@ struct ClientEvent
|
||||
{
|
||||
ClientEventType type;
|
||||
union{
|
||||
struct{
|
||||
} none;
|
||||
//struct{
|
||||
//} none;
|
||||
struct{
|
||||
u8 amount;
|
||||
} player_damage;
|
||||
@@ -171,8 +171,8 @@ struct ClientEvent
|
||||
std::string *formspec;
|
||||
std::string *formname;
|
||||
} show_formspec;
|
||||
struct{
|
||||
} textures_updated;
|
||||
//struct{
|
||||
//} textures_updated;
|
||||
struct{
|
||||
v3f *pos;
|
||||
v3f *vel;
|
||||
@@ -305,7 +305,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
|
||||
IrrlichtDevice *device,
|
||||
const char *playername,
|
||||
std::string password,
|
||||
bool is_simple_singleplayer_game,
|
||||
MapDrawControl &control,
|
||||
IWritableTextureSource *tsrc,
|
||||
IWritableShaderSource *shsrc,
|
||||
@@ -315,7 +314,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
|
||||
MtEventManager *event,
|
||||
bool ipv6
|
||||
);
|
||||
|
||||
|
||||
~Client();
|
||||
|
||||
/*
|
||||
@@ -325,11 +324,14 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
|
||||
|
||||
|
||||
bool isShutdown();
|
||||
|
||||
/*
|
||||
The name of the local player should already be set when
|
||||
calling this, as it is sent in the initialization.
|
||||
*/
|
||||
void connect(Address address);
|
||||
void connect(Address address,
|
||||
const std::string &address_name,
|
||||
bool is_local_server);
|
||||
|
||||
/*
|
||||
Stuff that references the environment is valid only as
|
||||
@@ -362,11 +364,11 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
|
||||
|
||||
ClientEnvironment& getEnv()
|
||||
{ return m_env; }
|
||||
|
||||
|
||||
// Causes urgent mesh updates (unlike Map::add/removeNodeWithEvent)
|
||||
void removeNode(v3s16 p);
|
||||
void addNode(v3s16 p, MapNode n, bool remove_metadata = true);
|
||||
|
||||
|
||||
void setPlayerControl(PlayerControl &control);
|
||||
|
||||
void selectPlayerItem(u16 item);
|
||||
@@ -378,7 +380,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
|
||||
bool getLocalInventoryUpdated();
|
||||
// Copies the inventory of the local player to parameter
|
||||
void getLocalInventory(Inventory &dst);
|
||||
|
||||
|
||||
/* InventoryManager interface */
|
||||
Inventory* getInventory(const InventoryLocation &loc);
|
||||
void inventoryAction(InventoryAction *a);
|
||||
@@ -416,13 +418,13 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
|
||||
// Including blocks at appropriate edges
|
||||
void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
|
||||
void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false);
|
||||
|
||||
|
||||
void updateCameraOffset(v3s16 camera_offset)
|
||||
{ m_mesh_update_thread.m_camera_offset = camera_offset; }
|
||||
|
||||
// Get event from queue. CE_NONE is returned if queue is empty.
|
||||
ClientEvent getClientEvent();
|
||||
|
||||
|
||||
bool accessDenied()
|
||||
{ return m_access_denied; }
|
||||
|
||||
@@ -454,6 +456,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
|
||||
virtual u16 allocateUnknownNodeId(const std::string &name);
|
||||
virtual ISoundManager* getSoundManager();
|
||||
virtual MtEventManager* getEventManager();
|
||||
virtual ParticleManager* getParticleManager();
|
||||
virtual bool checkLocalPrivilege(const std::string &priv)
|
||||
{ return checkPrivilege(priv); }
|
||||
virtual scene::IAnimatedMesh* getMesh(const std::string &filename);
|
||||
@@ -475,14 +478,18 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
|
||||
// Virtual methods from con::PeerHandler
|
||||
void peerAdded(con::Peer *peer);
|
||||
void deletingPeer(con::Peer *peer, bool timeout);
|
||||
|
||||
|
||||
void initLocalMapSaving(const Address &address,
|
||||
const std::string &hostname,
|
||||
bool is_local_server);
|
||||
|
||||
void ReceiveAll();
|
||||
void Receive();
|
||||
|
||||
|
||||
void sendPlayerPos();
|
||||
// Send the item number 'item' as player item to the server
|
||||
void sendPlayerItem(u16 item);
|
||||
|
||||
|
||||
float m_packetcounter_timer;
|
||||
float m_connection_reinit_timer;
|
||||
float m_avg_rtt_timer;
|
||||
@@ -497,8 +504,10 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
|
||||
ISoundManager *m_sound;
|
||||
MtEventManager *m_event;
|
||||
|
||||
|
||||
MeshUpdateThread m_mesh_update_thread;
|
||||
ClientEnvironment m_env;
|
||||
ParticleManager m_particle_manager;
|
||||
con::Connection m_con;
|
||||
IrrlichtDevice *m_device;
|
||||
// Server serialization version
|
||||
|
||||
@@ -179,7 +179,7 @@ void RemoteClient::GetNextBlocks(
|
||||
s32 nearest_emerged_d = -1;
|
||||
s32 nearest_emergefull_d = -1;
|
||||
s32 nearest_sent_d = -1;
|
||||
bool queue_is_full = false;
|
||||
//bool queue_is_full = false;
|
||||
|
||||
s16 d;
|
||||
for(d = d_start; d <= d_max; d++)
|
||||
@@ -214,7 +214,7 @@ void RemoteClient::GetNextBlocks(
|
||||
// Don't select too many blocks for sending
|
||||
if(num_blocks_selected >= max_simul_dynamic)
|
||||
{
|
||||
queue_is_full = true;
|
||||
//queue_is_full = true;
|
||||
goto queue_full_break;
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ void ClientMap::updateDrawList(video::IVideoDriver* driver)
|
||||
v3f camera_position = m_camera_position;
|
||||
v3f camera_direction = m_camera_direction;
|
||||
f32 camera_fov = m_camera_fov;
|
||||
v3s16 camera_offset = m_camera_offset;
|
||||
//v3s16 camera_offset = m_camera_offset;
|
||||
m_camera_mutex.Unlock();
|
||||
|
||||
// Use a higher fov to accomodate faster camera movements.
|
||||
@@ -854,7 +854,6 @@ int ClientMap::getBackgroundBrightness(float max_d, u32 daylight_factor,
|
||||
ret = decode_light(n.getLightBlend(daylight_factor, ndef));
|
||||
} else {
|
||||
ret = oldvalue;
|
||||
//ret = blend_light(255, 0, daylight_factor);
|
||||
}
|
||||
} else {
|
||||
/*float pre = (float)brightness_sum / (float)brightness_count;
|
||||
|
||||
@@ -372,7 +372,7 @@ void ReliablePacketBuffer::insert(BufferedPacket &p,u16 next_expected)
|
||||
fprintf(stderr, "Old: seqnum: %05d size: %04d, address: %s\n",
|
||||
readU16(&(i->data[BASE_HEADER_SIZE+1])),i->data.getSize(),
|
||||
i->address.serializeString().c_str());
|
||||
fprintf(stderr, "New: seqnum: %05d size: %04d, address: %s\n",
|
||||
fprintf(stderr, "New: seqnum: %05d size: %04u, address: %s\n",
|
||||
readU16(&(p.data[BASE_HEADER_SIZE+1])),p.data.getSize(),
|
||||
p.address.serializeString().c_str());
|
||||
throw IncomingDataCorruption("duplicated packet isn't same as original one");
|
||||
@@ -707,14 +707,14 @@ void Channel::UpdateTimers(float dtime,bool legacy_peer)
|
||||
|
||||
unsigned int packet_loss = 11; /* use a neutral value for initialization */
|
||||
unsigned int packets_successfull = 0;
|
||||
unsigned int packet_too_late = 0;
|
||||
//unsigned int packet_too_late = 0;
|
||||
|
||||
bool reasonable_amount_of_data_transmitted = false;
|
||||
|
||||
{
|
||||
JMutexAutoLock internal(m_internal_mutex);
|
||||
packet_loss = current_packet_loss;
|
||||
packet_too_late = current_packet_too_late;
|
||||
//packet_too_late = current_packet_too_late;
|
||||
packets_successfull = current_packet_successfull;
|
||||
|
||||
if (current_bytes_transfered > (unsigned int) (window_size*512/2))
|
||||
@@ -1236,10 +1236,9 @@ SharedBuffer<u8> UDPPeer::addSpiltPacket(u8 channel,
|
||||
/* Connection Threads */
|
||||
/******************************************************************************/
|
||||
|
||||
ConnectionSendThread::ConnectionSendThread(Connection* parent,
|
||||
unsigned int max_packet_size,
|
||||
ConnectionSendThread::ConnectionSendThread( unsigned int max_packet_size,
|
||||
float timeout) :
|
||||
m_connection(parent),
|
||||
m_connection(NULL),
|
||||
m_max_packet_size(max_packet_size),
|
||||
m_timeout(timeout),
|
||||
m_max_commands_per_iteration(1),
|
||||
@@ -1250,6 +1249,7 @@ ConnectionSendThread::ConnectionSendThread(Connection* parent,
|
||||
|
||||
void * ConnectionSendThread::Thread()
|
||||
{
|
||||
assert(m_connection != NULL);
|
||||
ThreadStarted();
|
||||
log_register_thread("ConnectionSend");
|
||||
|
||||
@@ -1995,14 +1995,14 @@ void ConnectionSendThread::sendAsPacket(u16 peer_id, u8 channelnum,
|
||||
m_outgoing_queue.push_back(packet);
|
||||
}
|
||||
|
||||
ConnectionReceiveThread::ConnectionReceiveThread(Connection* parent,
|
||||
unsigned int max_packet_size) :
|
||||
m_connection(parent)
|
||||
ConnectionReceiveThread::ConnectionReceiveThread(unsigned int max_packet_size) :
|
||||
m_connection(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void * ConnectionReceiveThread::Thread()
|
||||
{
|
||||
assert(m_connection != NULL);
|
||||
ThreadStarted();
|
||||
log_register_thread("ConnectionReceive");
|
||||
|
||||
@@ -2334,6 +2334,11 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
||||
|
||||
u8 type = readU8(&(packetdata[0]));
|
||||
|
||||
if (MAX_UDP_PEERS <= 65535 && peer_id >= MAX_UDP_PEERS) {
|
||||
errorstream << "Something is wrong with peer_id" << std::endl;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if(type == TYPE_CONTROL)
|
||||
{
|
||||
if(packetdata.getSize() < 2)
|
||||
@@ -2341,8 +2346,7 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
||||
|
||||
u8 controltype = readU8(&(packetdata[1]));
|
||||
|
||||
if( (controltype == CONTROLTYPE_ACK)
|
||||
&& (peer_id <= MAX_UDP_PEERS))
|
||||
if(controltype == CONTROLTYPE_ACK)
|
||||
{
|
||||
assert(channel != 0);
|
||||
if(packetdata.getSize() < 4)
|
||||
@@ -2399,8 +2403,7 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
||||
}
|
||||
throw ProcessedSilentlyException("Got an ACK");
|
||||
}
|
||||
else if((controltype == CONTROLTYPE_SET_PEER_ID)
|
||||
&& (peer_id <= MAX_UDP_PEERS))
|
||||
else if(controltype == CONTROLTYPE_SET_PEER_ID)
|
||||
{
|
||||
// Got a packet to set our peer id
|
||||
if(packetdata.getSize() < 4)
|
||||
@@ -2432,8 +2435,7 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
||||
|
||||
throw ProcessedSilentlyException("Got a SET_PEER_ID");
|
||||
}
|
||||
else if((controltype == CONTROLTYPE_PING)
|
||||
&& (peer_id <= MAX_UDP_PEERS))
|
||||
else if(controltype == CONTROLTYPE_PING)
|
||||
{
|
||||
// Just ignore it, the incoming data already reset
|
||||
// the timeout counter
|
||||
@@ -2455,8 +2457,7 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
||||
|
||||
throw ProcessedSilentlyException("Got a DISCO");
|
||||
}
|
||||
else if((controltype == CONTROLTYPE_ENABLE_BIG_SEND_WINDOW)
|
||||
&& (peer_id <= MAX_UDP_PEERS))
|
||||
else if(controltype == CONTROLTYPE_ENABLE_BIG_SEND_WINDOW)
|
||||
{
|
||||
dynamic_cast<UDPPeer*>(&peer)->setNonLegacyPeer();
|
||||
throw ProcessedSilentlyException("Got non legacy control");
|
||||
@@ -2514,7 +2515,7 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
|
||||
//TODO throw some error
|
||||
}
|
||||
}
|
||||
else if((peer_id <= MAX_UDP_PEERS) && (type == TYPE_RELIABLE))
|
||||
else if(type == TYPE_RELIABLE)
|
||||
{
|
||||
assert(channel != 0);
|
||||
// Recursive reliable packets not allowed
|
||||
@@ -2657,8 +2658,8 @@ Connection::Connection(u32 protocol_id, u32 max_packet_size, float timeout,
|
||||
m_event_queue(),
|
||||
m_peer_id(0),
|
||||
m_protocol_id(protocol_id),
|
||||
m_sendThread(this, max_packet_size, timeout),
|
||||
m_receiveThread(this, max_packet_size),
|
||||
m_sendThread(max_packet_size, timeout),
|
||||
m_receiveThread(max_packet_size),
|
||||
m_info_mutex(),
|
||||
m_bc_peerhandler(0),
|
||||
m_bc_receive_timeout(0),
|
||||
@@ -2667,6 +2668,9 @@ Connection::Connection(u32 protocol_id, u32 max_packet_size, float timeout,
|
||||
{
|
||||
m_udpSocket.setTimeoutMs(5);
|
||||
|
||||
m_sendThread.setParent(this);
|
||||
m_receiveThread.setParent(this);
|
||||
|
||||
m_sendThread.Start();
|
||||
m_receiveThread.Start();
|
||||
}
|
||||
@@ -2678,8 +2682,8 @@ Connection::Connection(u32 protocol_id, u32 max_packet_size, float timeout,
|
||||
m_event_queue(),
|
||||
m_peer_id(0),
|
||||
m_protocol_id(protocol_id),
|
||||
m_sendThread(this, max_packet_size, timeout),
|
||||
m_receiveThread(this, max_packet_size),
|
||||
m_sendThread(max_packet_size, timeout),
|
||||
m_receiveThread(max_packet_size),
|
||||
m_info_mutex(),
|
||||
m_bc_peerhandler(peerhandler),
|
||||
m_bc_receive_timeout(0),
|
||||
@@ -2689,6 +2693,9 @@ Connection::Connection(u32 protocol_id, u32 max_packet_size, float timeout,
|
||||
{
|
||||
m_udpSocket.setTimeoutMs(5);
|
||||
|
||||
m_sendThread.setParent(this);
|
||||
m_receiveThread.setParent(this);
|
||||
|
||||
m_sendThread.Start();
|
||||
m_receiveThread.Start();
|
||||
|
||||
|
||||
@@ -918,13 +918,17 @@ class ConnectionSendThread : public JThread {
|
||||
public:
|
||||
friend class UDPPeer;
|
||||
|
||||
ConnectionSendThread(Connection* parent,
|
||||
unsigned int max_packet_size, float timeout);
|
||||
ConnectionSendThread(unsigned int max_packet_size, float timeout);
|
||||
|
||||
void * Thread ();
|
||||
|
||||
void Trigger();
|
||||
|
||||
void setParent(Connection* parent) {
|
||||
assert(parent != NULL);
|
||||
m_connection = parent;
|
||||
}
|
||||
|
||||
void setPeerTimeout(float peer_timeout)
|
||||
{ m_timeout = peer_timeout; }
|
||||
|
||||
@@ -970,11 +974,15 @@ class ConnectionSendThread : public JThread {
|
||||
|
||||
class ConnectionReceiveThread : public JThread {
|
||||
public:
|
||||
ConnectionReceiveThread(Connection* parent,
|
||||
unsigned int max_packet_size);
|
||||
ConnectionReceiveThread(unsigned int max_packet_size);
|
||||
|
||||
void * Thread ();
|
||||
|
||||
void setParent(Connection* parent) {
|
||||
assert(parent != NULL);
|
||||
m_connection = parent;
|
||||
}
|
||||
|
||||
private:
|
||||
void receive ();
|
||||
|
||||
|
||||
@@ -89,17 +89,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
// Maximum hit points of a player
|
||||
#define PLAYER_MAX_HP 20
|
||||
|
||||
// Maximal breath of a player
|
||||
#define PLAYER_MAX_BREATH 11
|
||||
|
||||
// Number of different files to try to save a player to if the first fails
|
||||
// (because of a case-insensitive filesystem)
|
||||
// TODO: Use case-insensitive player names instead of this hack.
|
||||
#define PLAYER_FILE_ALTERNATE_TRIES 1000
|
||||
|
||||
/*
|
||||
* GUI related things
|
||||
*/
|
||||
#define LEGACY_SCALING (2./3.)
|
||||
#define TTF_DEFAULT_FONT_SIZE (12.0 / LEGACY_SCALING)
|
||||
#define DEFAULT_FONT_SIZE (14)
|
||||
GUI related things
|
||||
*/
|
||||
|
||||
// TODO: implement dpi-based scaling for windows and remove this hack
|
||||
#if defined(_WIN32)
|
||||
#define TTF_DEFAULT_FONT_SIZE (18)
|
||||
#else
|
||||
#define TTF_DEFAULT_FONT_SIZE (15)
|
||||
#endif
|
||||
#define DEFAULT_FONT_SIZE (10)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -945,8 +945,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
||||
m_wield_meshnode = new WieldMeshSceneNode(
|
||||
smgr->getRootSceneNode(), smgr, -1);
|
||||
m_wield_meshnode->setItem(item, m_gamedef);
|
||||
m_wield_meshnode->grab();
|
||||
|
||||
|
||||
m_wield_meshnode->setScale(v3f(m_prop.visual_size.X/2,
|
||||
m_prop.visual_size.Y/2,
|
||||
m_prop.visual_size.X/2));
|
||||
@@ -975,7 +974,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
|
||||
updateBonePosition();
|
||||
updateAttachments();
|
||||
}
|
||||
|
||||
|
||||
void GenericCAO::updateLight(u8 light_at_pos)
|
||||
{
|
||||
u8 li = decode_light(light_at_pos);
|
||||
|
||||
@@ -756,7 +756,8 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
||||
for(u32 j=0; j<6; j++)
|
||||
{
|
||||
// Check this neighbor
|
||||
v3s16 n2p = blockpos_nodes + p + g_6dirs[j];
|
||||
v3s16 dir = g_6dirs[j];
|
||||
v3s16 n2p = blockpos_nodes + p + dir;
|
||||
MapNode n2 = data->m_vmanip.getNodeNoEx(n2p);
|
||||
// Don't make face if neighbor is of same type
|
||||
if(n2.getContent() == n.getContent())
|
||||
@@ -764,10 +765,10 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
||||
|
||||
// The face at Z+
|
||||
video::S3DVertex vertices[4] = {
|
||||
video::S3DVertex(-BS/2,-BS/2,BS/2, 0,0,0, c, 1,1),
|
||||
video::S3DVertex(BS/2,-BS/2,BS/2, 0,0,0, c, 0,1),
|
||||
video::S3DVertex(BS/2,BS/2,BS/2, 0,0,0, c, 0,0),
|
||||
video::S3DVertex(-BS/2,BS/2,BS/2, 0,0,0, c, 1,0),
|
||||
video::S3DVertex(-BS/2,-BS/2,BS/2, dir.X,dir.Y,dir.Z, c, 1,1),
|
||||
video::S3DVertex(BS/2,-BS/2,BS/2, dir.X,dir.Y,dir.Z, c, 0,1),
|
||||
video::S3DVertex(BS/2,BS/2,BS/2, dir.X,dir.Y,dir.Z, c, 0,0),
|
||||
video::S3DVertex(-BS/2,BS/2,BS/2, dir.X,dir.Y,dir.Z, c, 1,0),
|
||||
};
|
||||
|
||||
// Rotations in the g_6dirs format
|
||||
|
||||
@@ -53,7 +53,7 @@ class DummyLoadSAO : public ServerActiveObject
|
||||
// And never save to disk
|
||||
bool isStaticAllowed() const
|
||||
{ return false; }
|
||||
|
||||
|
||||
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
|
||||
const std::string &data)
|
||||
{
|
||||
@@ -99,7 +99,7 @@ class TestSAO : public ServerActiveObject
|
||||
}
|
||||
u8 getType() const
|
||||
{ return ACTIVEOBJECT_TYPE_TEST; }
|
||||
|
||||
|
||||
static ServerActiveObject* create(ServerEnvironment *env, v3f pos,
|
||||
const std::string &data)
|
||||
{
|
||||
@@ -170,7 +170,7 @@ class ItemSAO : public ServerActiveObject
|
||||
public:
|
||||
u8 getType() const
|
||||
{ return ACTIVEOBJECT_TYPE_ITEM; }
|
||||
|
||||
|
||||
float getMinimumSavedMovement()
|
||||
{ return 0.1*BS; }
|
||||
|
||||
@@ -212,7 +212,7 @@ class ItemSAO : public ServerActiveObject
|
||||
if(m_move_interval.step(dtime, interval)==false)
|
||||
return;
|
||||
dtime = interval;
|
||||
|
||||
|
||||
core::aabbox3d<f32> box(-BS/3.,0.0,-BS/3., BS/3.,BS*2./3.,BS/3.);
|
||||
collisionMoveResult moveresult;
|
||||
// Apply gravity
|
||||
@@ -223,13 +223,12 @@ class ItemSAO : public ServerActiveObject
|
||||
if(m_speed_f.getLength()*dtime > pos_max_d)
|
||||
m_speed_f *= pos_max_d / (m_speed_f.getLength()*dtime);
|
||||
v3f pos_f = getBasePosition();
|
||||
v3f pos_f_old = pos_f;
|
||||
v3f accel_f = v3f(0,0,0);
|
||||
f32 stepheight = 0;
|
||||
moveresult = collisionMoveSimple(m_env,m_env->getGameDef(),
|
||||
pos_max_d, box, stepheight, dtime,
|
||||
pos_f, m_speed_f, accel_f);
|
||||
|
||||
|
||||
if(send_recommended == false)
|
||||
return;
|
||||
|
||||
@@ -327,7 +326,7 @@ class ItemSAO : public ServerActiveObject
|
||||
m_itemstring_changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -392,7 +391,7 @@ LuaEntitySAO::LuaEntitySAO(ServerEnvironment *env, v3f pos,
|
||||
ServerActiveObject::registerType(getType(), create);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Initialize something to armor groups
|
||||
m_armor_groups["fleshy"] = 100;
|
||||
}
|
||||
@@ -407,11 +406,11 @@ LuaEntitySAO::~LuaEntitySAO()
|
||||
void LuaEntitySAO::addedToEnvironment(u32 dtime_s)
|
||||
{
|
||||
ServerActiveObject::addedToEnvironment(dtime_s);
|
||||
|
||||
|
||||
// Create entity from name
|
||||
m_registered = m_env->getScriptIface()->
|
||||
luaentity_Add(m_id, m_init_name.c_str());
|
||||
|
||||
|
||||
if(m_registered){
|
||||
// Get properties
|
||||
m_env->getScriptIface()->
|
||||
@@ -671,10 +670,10 @@ int LuaEntitySAO::punch(v3f dir,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// It's best that attachments cannot be punched
|
||||
// It's best that attachments cannot be punched
|
||||
if(isAttached())
|
||||
return 0;
|
||||
|
||||
|
||||
ItemStack *punchitem = NULL;
|
||||
ItemStack punchitem_static;
|
||||
if(puncher){
|
||||
@@ -687,11 +686,11 @@ int LuaEntitySAO::punch(v3f dir,
|
||||
toolcap,
|
||||
punchitem,
|
||||
time_from_last_punch);
|
||||
|
||||
|
||||
if(result.did_punch)
|
||||
{
|
||||
setHP(getHP() - result.damage);
|
||||
|
||||
|
||||
|
||||
std::string punchername = "nil";
|
||||
|
||||
@@ -701,7 +700,7 @@ int LuaEntitySAO::punch(v3f dir,
|
||||
actionstream<<getDescription()<<" punched by "
|
||||
<<punchername<<", damage "<<result.damage
|
||||
<<" hp, health now "<<getHP()<<" hp"<<std::endl;
|
||||
|
||||
|
||||
{
|
||||
std::string str = gob_cmd_punched(result.damage, getHP());
|
||||
// create message and add to list
|
||||
@@ -887,7 +886,7 @@ void LuaEntitySAO::sendPosition(bool do_interpolate, bool is_movement_end)
|
||||
// If the object is attached client-side, don't waste bandwidth sending its position to clients
|
||||
if(isAttached())
|
||||
return;
|
||||
|
||||
|
||||
m_last_sent_move_precision = m_base_position.getDistanceFrom(
|
||||
m_last_sent_position);
|
||||
m_last_sent_position_timer = 0;
|
||||
@@ -1272,7 +1271,7 @@ int PlayerSAO::punch(v3f dir,
|
||||
ServerActiveObject *puncher,
|
||||
float time_from_last_punch)
|
||||
{
|
||||
// It's best that attachments cannot be punched
|
||||
// It's best that attachments cannot be punched
|
||||
if(isAttached())
|
||||
return 0;
|
||||
|
||||
@@ -1488,15 +1487,12 @@ bool PlayerSAO::checkMovementCheat()
|
||||
*/
|
||||
|
||||
float player_max_speed = 0;
|
||||
float player_max_speed_up = 0;
|
||||
if(m_privs.count("fast") != 0){
|
||||
// Fast speed
|
||||
player_max_speed = m_player->movement_speed_fast;
|
||||
player_max_speed_up = m_player->movement_speed_fast;
|
||||
} else {
|
||||
// Normal speed
|
||||
player_max_speed = m_player->movement_speed_walk;
|
||||
player_max_speed_up = m_player->movement_speed_walk;
|
||||
}
|
||||
// Tolerance. With the lag pool we shouldn't need it.
|
||||
//player_max_speed *= 2.5;
|
||||
|
||||
@@ -954,7 +954,9 @@ class CCraftDefManager: public IWritableCraftDefManager
|
||||
|
||||
try {
|
||||
tmpout = def->getOutput(input, gamedef);
|
||||
if(tmpout.item.substr(0,output.item.length()) == output.item)
|
||||
if((tmpout.item.substr(0,output.item.length()) == output.item) &&
|
||||
((tmpout.item[output.item.length()] == 0) ||
|
||||
(tmpout.item[output.item.length()] == ' ')))
|
||||
{
|
||||
// Get output, then decrement input (if requested)
|
||||
input = def->getInput(output, gamedef);
|
||||
|
||||
@@ -59,6 +59,12 @@ std::string Database_Dummy::loadBlock(v3s16 blockpos)
|
||||
return "";
|
||||
}
|
||||
|
||||
bool Database_Dummy::deleteBlock(v3s16 blockpos)
|
||||
{
|
||||
m_database.erase(getBlockAsInteger(blockpos));
|
||||
return true;
|
||||
}
|
||||
|
||||
void Database_Dummy::listAllLoadableBlocks(std::list<v3s16> &dst)
|
||||
{
|
||||
for(std::map<u64, std::string>::iterator x = m_database.begin(); x != m_database.end(); ++x)
|
||||
|
||||
@@ -35,6 +35,7 @@ class Database_Dummy : public Database
|
||||
virtual void endSave();
|
||||
virtual bool saveBlock(v3s16 blockpos, std::string &data);
|
||||
virtual std::string loadBlock(v3s16 blockpos);
|
||||
virtual bool deleteBlock(v3s16 blockpos);
|
||||
virtual void listAllLoadableBlocks(std::list<v3s16> &dst);
|
||||
virtual int Initialized(void);
|
||||
~Database_Dummy();
|
||||
|
||||
@@ -80,6 +80,19 @@ std::string Database_LevelDB::loadBlock(v3s16 blockpos)
|
||||
return "";
|
||||
}
|
||||
|
||||
bool Database_LevelDB::deleteBlock(v3s16 blockpos)
|
||||
{
|
||||
leveldb::Status status = m_database->Delete(leveldb::WriteOptions(),
|
||||
i64tos(getBlockAsInteger(blockpos)));
|
||||
if (!status.ok()) {
|
||||
errorstream << "WARNING: deleteBlock: LevelDB error deleting block "
|
||||
<< PP(blockpos) << ": " << status.ToString() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Database_LevelDB::listAllLoadableBlocks(std::list<v3s16> &dst)
|
||||
{
|
||||
leveldb::Iterator* it = m_database->NewIterator(leveldb::ReadOptions());
|
||||
|
||||
@@ -38,6 +38,7 @@ class Database_LevelDB : public Database
|
||||
virtual void endSave();
|
||||
virtual bool saveBlock(v3s16 blockpos, std::string &data);
|
||||
virtual std::string loadBlock(v3s16 blockpos);
|
||||
virtual bool deleteBlock(v3s16 blockpos);
|
||||
virtual void listAllLoadableBlocks(std::list<v3s16> &dst);
|
||||
virtual int Initialized(void);
|
||||
~Database_LevelDB();
|
||||
|
||||
@@ -123,6 +123,30 @@ std::string Database_Redis::loadBlock(v3s16 blockpos)
|
||||
return str;
|
||||
}
|
||||
|
||||
bool Database_Redis::deleteBlock(v3s16 blockpos)
|
||||
{
|
||||
std::string tmp = i64tos(getBlockAsInteger(blockpos));
|
||||
|
||||
redisReply *reply = (redisReply *)redisCommand(ctx, "HDEL %s %s",
|
||||
hash.c_str(), tmp.c_str());
|
||||
if (!reply) {
|
||||
errorstream << "WARNING: deleteBlock: redis command 'HDEL' failed on "
|
||||
"block " << PP(blockpos) << ": " << ctx->errstr << std::endl;
|
||||
freeReplyObject(reply);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (reply->type == REDIS_REPLY_ERROR) {
|
||||
errorstream << "WARNING: deleteBlock: deleting block " << PP(blockpos)
|
||||
<< "failed" << std::endl;
|
||||
freeReplyObject(reply);
|
||||
return false;
|
||||
}
|
||||
|
||||
freeReplyObject(reply);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Database_Redis::listAllLoadableBlocks(std::list<v3s16> &dst)
|
||||
{
|
||||
redisReply *reply;
|
||||
|
||||
@@ -38,6 +38,7 @@ class Database_Redis : public Database
|
||||
virtual void endSave();
|
||||
virtual bool saveBlock(v3s16 blockpos, std::string &data);
|
||||
virtual std::string loadBlock(v3s16 blockpos);
|
||||
virtual bool deleteBlock(v3s16 blockpos);
|
||||
virtual void listAllLoadableBlocks(std::list<v3s16> &dst);
|
||||
virtual int Initialized(void);
|
||||
~Database_Redis();
|
||||
|
||||
@@ -52,6 +52,7 @@ Database_SQLite3::Database_SQLite3(ServerMap *map, std::string savedir)
|
||||
m_database_read = NULL;
|
||||
m_database_write = NULL;
|
||||
m_database_list = NULL;
|
||||
m_database_delete = NULL;
|
||||
m_savedir = savedir;
|
||||
srvmap = map;
|
||||
}
|
||||
@@ -131,13 +132,11 @@ void Database_SQLite3::verifyDatabase() {
|
||||
throw FileNotGoodException("Cannot prepare write statement");
|
||||
}
|
||||
|
||||
#ifdef __ANDROID__
|
||||
d = sqlite3_prepare(m_database, "DELETE FROM `blocks` WHERE `pos`=?;", -1, &m_database_delete, NULL);
|
||||
if(d != SQLITE_OK) {
|
||||
infostream<<"WARNING: SQLite3 database delete statment failed to prepare: "<<sqlite3_errmsg(m_database)<<std::endl;
|
||||
throw FileNotGoodException("Cannot prepare delete statement");
|
||||
}
|
||||
#endif
|
||||
|
||||
d = sqlite3_prepare(m_database, "SELECT `pos` FROM `blocks`", -1, &m_database_list, NULL);
|
||||
if(d != SQLITE_OK) {
|
||||
@@ -148,22 +147,48 @@ void Database_SQLite3::verifyDatabase() {
|
||||
infostream<<"ServerMap: SQLite3 database opened"<<std::endl;
|
||||
}
|
||||
|
||||
bool Database_SQLite3::deleteBlock(v3s16 blockpos)
|
||||
{
|
||||
verifyDatabase();
|
||||
|
||||
if (sqlite3_bind_int64(m_database_delete, 1,
|
||||
getBlockAsInteger(blockpos)) != SQLITE_OK) {
|
||||
errorstream << "WARNING: Could not bind block position for delete: "
|
||||
<< sqlite3_errmsg(m_database) << std::endl;
|
||||
}
|
||||
|
||||
if (sqlite3_step(m_database_delete) != SQLITE_DONE) {
|
||||
errorstream << "WARNING: deleteBlock: Block failed to delete "
|
||||
<< PP(blockpos) << ": " << sqlite3_errmsg(m_database) << std::endl;
|
||||
sqlite3_reset(m_database_delete);
|
||||
return false;
|
||||
}
|
||||
|
||||
sqlite3_reset(m_database_delete);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database_SQLite3::saveBlock(v3s16 blockpos, std::string &data)
|
||||
{
|
||||
verifyDatabase();
|
||||
|
||||
s64 bkey = getBlockAsInteger(blockpos);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
/**
|
||||
* Note: For some unknown reason sqlite3 fails to REPLACE blocks on android,
|
||||
* deleting them and inserting first works.
|
||||
*/
|
||||
if (sqlite3_bind_int64(m_database_read, 1, getBlockAsInteger(blockpos)) != SQLITE_OK) {
|
||||
if (sqlite3_bind_int64(m_database_read, 1, bkey) != SQLITE_OK) {
|
||||
infostream << "WARNING: Could not bind block position for load: "
|
||||
<< sqlite3_errmsg(m_database)<<std::endl;
|
||||
}
|
||||
|
||||
if (sqlite3_step(m_database_read) == SQLITE_ROW) {
|
||||
if (sqlite3_bind_int64(m_database_delete, 1, getBlockAsInteger(blockpos)) != SQLITE_OK) {
|
||||
int step_result = sqlite3_step(m_database_read);
|
||||
sqlite3_reset(m_database_read);
|
||||
|
||||
if (step_result == SQLITE_ROW) {
|
||||
if (sqlite3_bind_int64(m_database_delete, 1, bkey) != SQLITE_OK) {
|
||||
infostream << "WARNING: Could not bind block position for delete: "
|
||||
<< sqlite3_errmsg(m_database)<<std::endl;
|
||||
}
|
||||
@@ -175,17 +200,17 @@ bool Database_SQLite3::saveBlock(v3s16 blockpos, std::string &data)
|
||||
}
|
||||
sqlite3_reset(m_database_delete);
|
||||
}
|
||||
sqlite3_reset(m_database_read);
|
||||
#endif
|
||||
|
||||
if (sqlite3_bind_int64(m_database_write, 1, getBlockAsInteger(blockpos)) != SQLITE_OK) {
|
||||
if (sqlite3_bind_int64(m_database_write, 1, bkey) != SQLITE_OK) {
|
||||
errorstream << "WARNING: saveBlock: Block position failed to bind: "
|
||||
<< PP(blockpos) << ": " << sqlite3_errmsg(m_database) << std::endl;
|
||||
sqlite3_reset(m_database_write);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sqlite3_bind_blob(m_database_write, 2, (void *) data.c_str(), data.size(), NULL) != SQLITE_OK) {
|
||||
if (sqlite3_bind_blob(m_database_write, 2, (void *)data.c_str(),
|
||||
data.size(), NULL) != SQLITE_OK) {
|
||||
errorstream << "WARNING: saveBlock: Block data failed to bind: "
|
||||
<< PP(blockpos) << ": " << sqlite3_errmsg(m_database) << std::endl;
|
||||
sqlite3_reset(m_database_write);
|
||||
@@ -277,6 +302,7 @@ Database_SQLite3::~Database_SQLite3()
|
||||
FINALIZE_STATEMENT(m_database_read)
|
||||
FINALIZE_STATEMENT(m_database_write)
|
||||
FINALIZE_STATEMENT(m_database_list)
|
||||
FINALIZE_STATEMENT(m_database_delete)
|
||||
|
||||
if(m_database)
|
||||
rc = sqlite3_close(m_database);
|
||||
|
||||
@@ -38,6 +38,7 @@ class Database_SQLite3 : public Database
|
||||
|
||||
virtual bool saveBlock(v3s16 blockpos, std::string &data);
|
||||
virtual std::string loadBlock(v3s16 blockpos);
|
||||
virtual bool deleteBlock(v3s16 blockpos);
|
||||
virtual void listAllLoadableBlocks(std::list<v3s16> &dst);
|
||||
virtual int Initialized(void);
|
||||
~Database_SQLite3();
|
||||
@@ -47,9 +48,7 @@ class Database_SQLite3 : public Database
|
||||
sqlite3 *m_database;
|
||||
sqlite3_stmt *m_database_read;
|
||||
sqlite3_stmt *m_database_write;
|
||||
#ifdef __ANDROID__
|
||||
sqlite3_stmt *m_database_delete;
|
||||
#endif
|
||||
sqlite3_stmt *m_database_list;
|
||||
|
||||
// Create the database structure
|
||||
|
||||
@@ -37,6 +37,7 @@ class Database
|
||||
|
||||
virtual bool saveBlock(v3s16 blockpos, std::string &data) = 0;
|
||||
virtual std::string loadBlock(v3s16 blockpos) = 0;
|
||||
virtual bool deleteBlock(v3s16 blockpos) = 0;
|
||||
s64 getBlockAsInteger(const v3s16 pos) const;
|
||||
v3s16 getIntegerAsBlock(s64 i) const;
|
||||
virtual void listAllLoadableBlocks(std::list<v3s16> &dst) = 0;
|
||||
|
||||
162
src/debug.cpp
162
src/debug.cpp
@@ -29,6 +29,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "jthread/jmutex.h"
|
||||
#include "jthread/jmutexautolock.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <dbghelp.h>
|
||||
#include "version.h"
|
||||
#include "filesys.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
Debug output
|
||||
*/
|
||||
@@ -57,7 +64,7 @@ void debugstreams_init(bool disable_stderr, const char *filename)
|
||||
|
||||
if(filename)
|
||||
g_debugstreams[1] = fopen(filename, "a");
|
||||
|
||||
|
||||
if(g_debugstreams[1])
|
||||
{
|
||||
fprintf(g_debugstreams[1], "\n\n-------------\n");
|
||||
@@ -91,7 +98,7 @@ class Debugbuf : public std::streambuf
|
||||
//TODO: Is this slow?
|
||||
fflush(g_debugstreams[i]);
|
||||
}
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
std::streamsize xsputn(const char *s, std::streamsize n)
|
||||
@@ -111,7 +118,7 @@ class Debugbuf : public std::streambuf
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
bool m_disable_stderr;
|
||||
};
|
||||
@@ -130,10 +137,10 @@ void assert_fail(const char *assertion, const char *file,
|
||||
unsigned int line, const char *function)
|
||||
{
|
||||
DEBUGPRINT("\nIn thread %lx:\n"
|
||||
"%s:%d: %s: Assertion '%s' failed.\n",
|
||||
"%s:%u: %s: Assertion '%s' failed.\n",
|
||||
(unsigned long)get_current_thread_id(),
|
||||
file, line, function, assertion);
|
||||
|
||||
|
||||
debug_stacks_print();
|
||||
|
||||
if(g_debugstreams[1])
|
||||
@@ -151,7 +158,7 @@ struct DebugStack
|
||||
DebugStack(threadid_t id);
|
||||
void print(FILE *file, bool everything);
|
||||
void print(std::ostream &os, bool everything);
|
||||
|
||||
|
||||
threadid_t threadid;
|
||||
char stack[DEBUG_STACK_SIZE][DEBUG_STACK_TEXT_SIZE];
|
||||
int stack_i; // Points to the lowest empty position
|
||||
@@ -285,10 +292,10 @@ DebugStacker::DebugStacker(const char *text)
|
||||
DebugStacker::~DebugStacker()
|
||||
{
|
||||
JMutexAutoLock lock(g_debug_stacks_mutex);
|
||||
|
||||
|
||||
if(m_overflowed == true)
|
||||
return;
|
||||
|
||||
|
||||
m_stack->stack_i--;
|
||||
|
||||
if(m_stack->stack_i == 0)
|
||||
@@ -301,35 +308,124 @@ DebugStacker::~DebugStacker()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if CATCH_UNHANDLED_EXCEPTIONS == 1
|
||||
void se_trans_func(unsigned int u, EXCEPTION_POINTERS* pExp)
|
||||
|
||||
const char *Win32ExceptionCodeToString(DWORD exception_code)
|
||||
{
|
||||
dstream<<"In trans_func.\n";
|
||||
if(u == EXCEPTION_ACCESS_VIOLATION)
|
||||
{
|
||||
PEXCEPTION_RECORD r = pExp->ExceptionRecord;
|
||||
dstream<<"Access violation at "<<r->ExceptionAddress
|
||||
<<" write?="<<r->ExceptionInformation[0]
|
||||
<<" address="<<r->ExceptionInformation[1]
|
||||
<<std::endl;
|
||||
throw FatalSystemException
|
||||
("Access violation");
|
||||
}
|
||||
if(u == EXCEPTION_STACK_OVERFLOW)
|
||||
{
|
||||
throw FatalSystemException
|
||||
("Stack overflow");
|
||||
}
|
||||
if(u == EXCEPTION_ILLEGAL_INSTRUCTION)
|
||||
{
|
||||
throw FatalSystemException
|
||||
("Illegal instruction");
|
||||
switch (exception_code) {
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
return "Access violation";
|
||||
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
||||
return "Misaligned data access";
|
||||
case EXCEPTION_BREAKPOINT:
|
||||
return "Breakpoint reached";
|
||||
case EXCEPTION_SINGLE_STEP:
|
||||
return "Single debug step";
|
||||
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
||||
return "Array access out of bounds";
|
||||
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
||||
return "Denormal floating point operand";
|
||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||
return "Floating point division by zero";
|
||||
case EXCEPTION_FLT_INEXACT_RESULT:
|
||||
return "Inaccurate floating point result";
|
||||
case EXCEPTION_FLT_INVALID_OPERATION:
|
||||
return "Invalid floating point operation";
|
||||
case EXCEPTION_FLT_OVERFLOW:
|
||||
return "Floating point exponent overflow";
|
||||
case EXCEPTION_FLT_STACK_CHECK:
|
||||
return "Floating point stack overflow or underflow";
|
||||
case EXCEPTION_FLT_UNDERFLOW:
|
||||
return "Floating point exponent underflow";
|
||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||
return "Integer division by zero";
|
||||
case EXCEPTION_INT_OVERFLOW:
|
||||
return "Integer overflow";
|
||||
case EXCEPTION_PRIV_INSTRUCTION:
|
||||
return "Privileged instruction executed";
|
||||
case EXCEPTION_IN_PAGE_ERROR:
|
||||
return "Could not access or load page";
|
||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||
return "Illegal instruction encountered";
|
||||
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
||||
return "Attempted to continue after fatal exception";
|
||||
case EXCEPTION_STACK_OVERFLOW:
|
||||
return "Stack overflow";
|
||||
case EXCEPTION_INVALID_DISPOSITION:
|
||||
return "Invalid disposition returned to the exception dispatcher";
|
||||
case EXCEPTION_GUARD_PAGE:
|
||||
return "Attempted guard page access";
|
||||
case EXCEPTION_INVALID_HANDLE:
|
||||
return "Invalid handle";
|
||||
}
|
||||
|
||||
return "Unknown exception";
|
||||
}
|
||||
#endif
|
||||
|
||||
long WINAPI Win32ExceptionHandler(struct _EXCEPTION_POINTERS *pExceptInfo)
|
||||
{
|
||||
char buf[512];
|
||||
MINIDUMP_EXCEPTION_INFORMATION mdei;
|
||||
MINIDUMP_USER_STREAM_INFORMATION mdusi;
|
||||
MINIDUMP_USER_STREAM mdus;
|
||||
bool minidump_created = false;
|
||||
std::string version_str("Minetest ");
|
||||
|
||||
std::string dumpfile = porting::path_user + DIR_DELIM "minetest.dmp";
|
||||
|
||||
HANDLE hFile = CreateFileA(dumpfile.c_str(), GENERIC_WRITE,
|
||||
FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
goto minidump_failed;
|
||||
|
||||
if (SetEndOfFile(hFile) == FALSE)
|
||||
goto minidump_failed;
|
||||
|
||||
mdei.ClientPointers = NULL;
|
||||
mdei.ExceptionPointers = pExceptInfo;
|
||||
mdei.ThreadId = GetCurrentThreadId();
|
||||
|
||||
version_str += minetest_version_hash;
|
||||
|
||||
mdus.Type = CommentStreamA;
|
||||
mdus.BufferSize = version_str.size();
|
||||
mdus.Buffer = (PVOID)version_str.c_str();
|
||||
|
||||
mdusi.UserStreamArray = &mdus;
|
||||
mdusi.UserStreamCount = 1;
|
||||
|
||||
if (MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile,
|
||||
MiniDumpNormal, &mdei, &mdusi, NULL) == FALSE)
|
||||
goto minidump_failed;
|
||||
|
||||
minidump_created = true;
|
||||
|
||||
minidump_failed:
|
||||
|
||||
CloseHandle(hFile);
|
||||
|
||||
DWORD excode = pExceptInfo->ExceptionRecord->ExceptionCode;
|
||||
_snprintf(buf, sizeof(buf),
|
||||
" >> === FATAL ERROR ===\n"
|
||||
" >> %s (Exception 0x%08X) at 0x%p\n",
|
||||
Win32ExceptionCodeToString(excode), excode,
|
||||
pExceptInfo->ExceptionRecord->ExceptionAddress);
|
||||
dstream << buf;
|
||||
|
||||
if (minidump_created)
|
||||
dstream << " >> Saved dump to " << dumpfile << std::endl;
|
||||
else
|
||||
dstream << " >> Failed to save dump" << std::endl;
|
||||
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void debug_set_exception_handler()
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
SetUnhandledExceptionFilter(Win32ExceptionHandler);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
44
src/debug.h
44
src/debug.h
@@ -95,6 +95,8 @@ __NORETURN extern void assert_fail(
|
||||
|
||||
#define assert(expr) ASSERT(expr)
|
||||
|
||||
void debug_set_exception_handler();
|
||||
|
||||
/*
|
||||
DebugStack
|
||||
*/
|
||||
@@ -118,13 +120,12 @@ class DebugStacker
|
||||
bool m_overflowed;
|
||||
};
|
||||
|
||||
#define DSTACK(msg)\
|
||||
#define DSTACK(msg) \
|
||||
DebugStacker __debug_stacker(msg);
|
||||
|
||||
#define DSTACKF(...)\
|
||||
char __buf[DEBUG_STACK_TEXT_SIZE];\
|
||||
snprintf(__buf,\
|
||||
DEBUG_STACK_TEXT_SIZE, __VA_ARGS__);\
|
||||
#define DSTACKF(...) \
|
||||
char __buf[DEBUG_STACK_TEXT_SIZE]; \
|
||||
snprintf(__buf, DEBUG_STACK_TEXT_SIZE, __VA_ARGS__); \
|
||||
DebugStacker __debug_stacker(__buf);
|
||||
|
||||
/*
|
||||
@@ -132,34 +133,13 @@ class DebugStacker
|
||||
*/
|
||||
|
||||
#if CATCH_UNHANDLED_EXCEPTIONS == 1
|
||||
#define BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER try{
|
||||
#define END_PORTABLE_DEBUG_EXCEPTION_HANDLER(logstream)\
|
||||
}catch(std::exception &e){\
|
||||
logstream<<"ERROR: An unhandled exception occurred: "\
|
||||
<<e.what()<<std::endl;\
|
||||
assert(0);\
|
||||
#define BEGIN_DEBUG_EXCEPTION_HANDLER try {
|
||||
#define END_DEBUG_EXCEPTION_HANDLER(logstream) \
|
||||
} catch (std::exception &e) { \
|
||||
logstream << "ERROR: An unhandled exception occurred: " \
|
||||
<< e.what() << std::endl; \
|
||||
assert(0); \
|
||||
}
|
||||
#ifdef _WIN32 // Windows
|
||||
#ifdef _MSC_VER // MSVC
|
||||
void se_trans_func(unsigned int, EXCEPTION_POINTERS*);
|
||||
#define BEGIN_DEBUG_EXCEPTION_HANDLER \
|
||||
BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER\
|
||||
_set_se_translator(se_trans_func);
|
||||
|
||||
#define END_DEBUG_EXCEPTION_HANDLER(logstream) \
|
||||
END_PORTABLE_DEBUG_EXCEPTION_HANDLER(logstream)
|
||||
#else // Probably mingw
|
||||
#define BEGIN_DEBUG_EXCEPTION_HANDLER\
|
||||
BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER
|
||||
#define END_DEBUG_EXCEPTION_HANDLER(logstream)\
|
||||
END_PORTABLE_DEBUG_EXCEPTION_HANDLER(logstream)
|
||||
#endif
|
||||
#else // Posix
|
||||
#define BEGIN_DEBUG_EXCEPTION_HANDLER\
|
||||
BEGIN_PORTABLE_DEBUG_EXCEPTION_HANDLER
|
||||
#define END_DEBUG_EXCEPTION_HANDLER(logstream)\
|
||||
END_PORTABLE_DEBUG_EXCEPTION_HANDLER(logstream)
|
||||
#endif
|
||||
#else
|
||||
// Dummy ones
|
||||
#define BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||
|
||||
@@ -108,6 +108,7 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("new_style_leaves", "true");
|
||||
settings->setDefault("connected_glass", "false");
|
||||
settings->setDefault("smooth_lighting", "true");
|
||||
settings->setDefault("display_gamma", "1.8");
|
||||
settings->setDefault("texture_path", "");
|
||||
settings->setDefault("shader_path", "");
|
||||
settings->setDefault("video_driver", "opengl");
|
||||
@@ -130,6 +131,7 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("enable_node_highlighting", "false");
|
||||
settings->setDefault("crosshair_color", "(255,255,255)");
|
||||
settings->setDefault("crosshair_alpha", "255");
|
||||
settings->setDefault("hud_scaling", "1.0");
|
||||
settings->setDefault("gui_scaling", "1.0");
|
||||
settings->setDefault("mouse_sensitivity", "0.2");
|
||||
settings->setDefault("enable_sound", "true");
|
||||
@@ -157,6 +159,7 @@ void set_default_settings(Settings *settings)
|
||||
settings->setDefault("water_wave_speed", "5.0");
|
||||
settings->setDefault("enable_waving_leaves", "false");
|
||||
settings->setDefault("enable_waving_plants", "false");
|
||||
settings->setDefault("ambient_occlusion_gamma", "2.2");
|
||||
settings->setDefault("enable_shaders", "true");
|
||||
settings->setDefault("repeat_rightclick_time", "0.25");
|
||||
settings->setDefault("enable_particles", "true");
|
||||
@@ -325,10 +328,10 @@ void set_default_settings(Settings *settings)
|
||||
float x_inches = ((double) porting::getDisplaySize().X /
|
||||
(160 * porting::getDisplayDensity()));
|
||||
if (x_inches < 3.5) {
|
||||
settings->setDefault("gui_scaling", "0.6");
|
||||
settings->setDefault("hud_scaling", "0.6");
|
||||
}
|
||||
else if (x_inches < 4.5) {
|
||||
settings->setDefault("gui_scaling", "0.7");
|
||||
settings->setDefault("hud_scaling", "0.7");
|
||||
}
|
||||
settings->setDefault("curl_verify_cert","false");
|
||||
#else
|
||||
@@ -344,4 +347,3 @@ void override_default_settings(Settings *settings, Settings *from)
|
||||
settings->setDefault(name, from->get(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ video::ITexture* draw_image(const v2u32& screensize,
|
||||
image = images[1];
|
||||
else
|
||||
image = images[0];
|
||||
|
||||
|
||||
driver->setRenderTarget(image, true, true,
|
||||
irr::video::SColor(255,
|
||||
skycolor.getRed(), skycolor.getGreen(), skycolor.getBlue()));
|
||||
@@ -421,79 +421,74 @@ void draw_scene(video::IVideoDriver* driver, scene::ISceneManager* smgr,
|
||||
gui::IGUIEnvironment* guienv, std::vector<aabb3f> hilightboxes,
|
||||
const v2u32& screensize, video::SColor skycolor, bool show_hud)
|
||||
{
|
||||
//TODO check if usefull
|
||||
u32 scenetime = 0;
|
||||
{
|
||||
TimeTaker timer("smgr");
|
||||
TimeTaker timer("smgr");
|
||||
|
||||
bool draw_wield_tool = (show_hud &&
|
||||
(player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE) &&
|
||||
camera.getCameraMode() < CAMERA_MODE_THIRD );
|
||||
bool draw_wield_tool = (show_hud &&
|
||||
(player->hud_flags & HUD_FLAG_WIELDITEM_VISIBLE) &&
|
||||
camera.getCameraMode() < CAMERA_MODE_THIRD );
|
||||
|
||||
bool draw_crosshair = ((player->hud_flags & HUD_FLAG_CROSSHAIR_VISIBLE) &&
|
||||
(camera.getCameraMode() != CAMERA_MODE_THIRD_FRONT));
|
||||
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) {}
|
||||
try {
|
||||
draw_crosshair = !g_settings->getBool("touchtarget");
|
||||
}
|
||||
catch(SettingNotFoundException) {}
|
||||
#endif
|
||||
|
||||
std::string draw_mode = g_settings->get("3d_mode");
|
||||
std::string draw_mode = g_settings->get("3d_mode");
|
||||
|
||||
smgr->drawAll();
|
||||
smgr->drawAll();
|
||||
|
||||
if (draw_mode == "anaglyph")
|
||||
{
|
||||
draw_anaglyph_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, draw_wield_tool, client, guienv);
|
||||
draw_crosshair = false;
|
||||
}
|
||||
else if (draw_mode == "interlaced")
|
||||
{
|
||||
draw_interlaced_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
draw_crosshair = false;
|
||||
}
|
||||
else if (draw_mode == "sidebyside")
|
||||
{
|
||||
draw_sidebyside_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
show_hud = false;
|
||||
}
|
||||
else if (draw_mode == "topbottom")
|
||||
{
|
||||
draw_top_bottom_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
show_hud = false;
|
||||
}
|
||||
else {
|
||||
draw_plain(camera, show_hud, hud, hilightboxes, driver,
|
||||
draw_wield_tool, client, guienv);
|
||||
}
|
||||
|
||||
/*
|
||||
Post effects
|
||||
*/
|
||||
{
|
||||
client.getEnv().getClientMap().renderPostFx(camera.getCameraMode());
|
||||
}
|
||||
|
||||
//TODO how to make those 3d too
|
||||
if (show_hud)
|
||||
{
|
||||
if (draw_crosshair)
|
||||
hud.drawCrosshair();
|
||||
hud.drawHotbar(client.getPlayerItem());
|
||||
hud.drawLuaElements(camera.getOffset());
|
||||
}
|
||||
|
||||
guienv->drawAll();
|
||||
|
||||
scenetime = timer.stop(true);
|
||||
if (draw_mode == "anaglyph")
|
||||
{
|
||||
draw_anaglyph_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, draw_wield_tool, client, guienv);
|
||||
draw_crosshair = false;
|
||||
}
|
||||
else if (draw_mode == "interlaced")
|
||||
{
|
||||
draw_interlaced_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
draw_crosshair = false;
|
||||
}
|
||||
else if (draw_mode == "sidebyside")
|
||||
{
|
||||
draw_sidebyside_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
show_hud = false;
|
||||
}
|
||||
else if (draw_mode == "topbottom")
|
||||
{
|
||||
draw_top_bottom_3d_mode(camera, show_hud, hud, hilightboxes, driver,
|
||||
smgr, screensize, draw_wield_tool, client, guienv, skycolor);
|
||||
show_hud = false;
|
||||
}
|
||||
else {
|
||||
draw_plain(camera, show_hud, hud, hilightboxes, driver,
|
||||
draw_wield_tool, client, guienv);
|
||||
}
|
||||
|
||||
/*
|
||||
Post effects
|
||||
*/
|
||||
{
|
||||
client.getEnv().getClientMap().renderPostFx(camera.getCameraMode());
|
||||
}
|
||||
|
||||
//TODO how to make those 3d too
|
||||
if (show_hud)
|
||||
{
|
||||
if (draw_crosshair)
|
||||
hud.drawCrosshair();
|
||||
hud.drawHotbar(client.getPlayerItem());
|
||||
hud.drawLuaElements(camera.getOffset());
|
||||
}
|
||||
|
||||
guienv->drawAll();
|
||||
|
||||
timer.stop(true);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -70,10 +70,7 @@ DungeonGen::DungeonGen(Mapgen *mapgen, DungeonParams *dparams) {
|
||||
|
||||
void DungeonGen::generate(u32 bseed, v3s16 nmin, v3s16 nmax) {
|
||||
//TimeTaker t("gen dungeons");
|
||||
int approx_groundlevel = 10 + mg->water_level;
|
||||
|
||||
if ((nmin.Y + nmax.Y) / 2 >= approx_groundlevel ||
|
||||
NoisePerlin3D(&dp.np_rarity, nmin.X, nmin.Y, nmin.Z, mg->seed) < 0.2)
|
||||
if (NoisePerlin3D(&dp.np_rarity, nmin.X, nmin.Y, nmin.Z, mg->seed) < 0.2)
|
||||
return;
|
||||
|
||||
this->blockseed = bseed;
|
||||
|
||||
@@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#define VMANIP_FLAG_DUNGEON_UNTOUCHABLE (\
|
||||
VMANIP_FLAG_DUNGEON_INSIDE|VMANIP_FLAG_DUNGEON_PRESERVE)
|
||||
|
||||
class ManualMapVoxelManipulator;
|
||||
class MMVManip;
|
||||
class INodeDefManager;
|
||||
|
||||
v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs);
|
||||
@@ -57,7 +57,7 @@ struct DungeonParams {
|
||||
|
||||
class DungeonGen {
|
||||
public:
|
||||
ManualMapVoxelManipulator *vm;
|
||||
MMVManip *vm;
|
||||
Mapgen *mg;
|
||||
u32 blockseed;
|
||||
PseudoRandom random;
|
||||
|
||||
169
src/emerge.cpp
169
src/emerge.cpp
@@ -48,6 +48,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "mapgen_v7.h"
|
||||
#include "mapgen_singlenode.h"
|
||||
|
||||
struct MapgenDesc {
|
||||
const char *name;
|
||||
MapgenFactory *factory;
|
||||
};
|
||||
|
||||
MapgenDesc reg_mapgens[] = {
|
||||
{"v5", new MapgenFactoryV5},
|
||||
{"v6", new MapgenFactoryV6},
|
||||
{"v7", new MapgenFactoryV7},
|
||||
{"singlenode", new MapgenFactorySinglenode},
|
||||
};
|
||||
|
||||
class EmergeThread : public JThread
|
||||
{
|
||||
@@ -82,13 +93,8 @@ class EmergeThread : public JThread
|
||||
|
||||
/////////////////////////////// Emerge Manager ////////////////////////////////
|
||||
|
||||
EmergeManager::EmergeManager(IGameDef *gamedef) {
|
||||
//register built-in mapgens
|
||||
registerMapgen("v5", new MapgenFactoryV5());
|
||||
registerMapgen("v6", new MapgenFactoryV6());
|
||||
registerMapgen("v7", new MapgenFactoryV7());
|
||||
registerMapgen("singlenode", new MapgenFactorySinglenode());
|
||||
|
||||
EmergeManager::EmergeManager(IGameDef *gamedef)
|
||||
{
|
||||
this->ndef = gamedef->getNodeDefManager();
|
||||
this->biomemgr = new BiomeManager(gamedef);
|
||||
this->oremgr = new OreManager(gamedef);
|
||||
@@ -132,8 +138,9 @@ EmergeManager::EmergeManager(IGameDef *gamedef) {
|
||||
}
|
||||
|
||||
|
||||
EmergeManager::~EmergeManager() {
|
||||
for (unsigned int i = 0; i != emergethread.size(); i++) {
|
||||
EmergeManager::~EmergeManager()
|
||||
{
|
||||
for (u32 i = 0; i != emergethread.size(); i++) {
|
||||
if (threads_active) {
|
||||
emergethread[i]->Stop();
|
||||
emergethread[i]->qevent.signal();
|
||||
@@ -145,11 +152,6 @@ EmergeManager::~EmergeManager() {
|
||||
emergethread.clear();
|
||||
mapgen.clear();
|
||||
|
||||
std::map<std::string, MapgenFactory *>::iterator it;
|
||||
for (it = mglist.begin(); it != mglist.end(); ++it)
|
||||
delete it->second;
|
||||
mglist.clear();
|
||||
|
||||
delete biomemgr;
|
||||
delete oremgr;
|
||||
delete decomgr;
|
||||
@@ -162,19 +164,14 @@ EmergeManager::~EmergeManager() {
|
||||
}
|
||||
|
||||
|
||||
void EmergeManager::loadMapgenParams() {
|
||||
void EmergeManager::loadMapgenParams()
|
||||
{
|
||||
loadParamsFromSettings(g_settings);
|
||||
|
||||
if (g_settings->get("fixed_map_seed").empty()) {
|
||||
params.seed = (((u64)(myrand() & 0xffff) << 0)
|
||||
| ((u64)(myrand() & 0xffff) << 16)
|
||||
| ((u64)(myrand() & 0xffff) << 32)
|
||||
| ((u64)(myrand() & 0xffff) << 48));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EmergeManager::initMapgens() {
|
||||
void EmergeManager::initMapgens()
|
||||
{
|
||||
if (mapgen.size())
|
||||
return;
|
||||
|
||||
@@ -189,7 +186,7 @@ void EmergeManager::initMapgens() {
|
||||
}
|
||||
|
||||
// Create the mapgens
|
||||
for (size_t i = 0; i != emergethread.size(); i++) {
|
||||
for (u32 i = 0; i != emergethread.size(); i++) {
|
||||
Mapgen *mg = createMapgen(params.mg_name, i, ¶ms);
|
||||
assert(mg);
|
||||
mapgen.push_back(mg);
|
||||
@@ -197,8 +194,9 @@ void EmergeManager::initMapgens() {
|
||||
}
|
||||
|
||||
|
||||
Mapgen *EmergeManager::getCurrentMapgen() {
|
||||
for (unsigned int i = 0; i != emergethread.size(); i++) {
|
||||
Mapgen *EmergeManager::getCurrentMapgen()
|
||||
{
|
||||
for (u32 i = 0; i != emergethread.size(); i++) {
|
||||
if (emergethread[i]->IsSameThread())
|
||||
return emergethread[i]->mapgen;
|
||||
}
|
||||
@@ -207,36 +205,39 @@ Mapgen *EmergeManager::getCurrentMapgen() {
|
||||
}
|
||||
|
||||
|
||||
void EmergeManager::startThreads() {
|
||||
void EmergeManager::startThreads()
|
||||
{
|
||||
if (threads_active)
|
||||
return;
|
||||
|
||||
for (unsigned int i = 0; i != emergethread.size(); i++)
|
||||
for (u32 i = 0; i != emergethread.size(); i++)
|
||||
emergethread[i]->Start();
|
||||
|
||||
threads_active = true;
|
||||
}
|
||||
|
||||
|
||||
void EmergeManager::stopThreads() {
|
||||
void EmergeManager::stopThreads()
|
||||
{
|
||||
if (!threads_active)
|
||||
return;
|
||||
|
||||
// Request thread stop in parallel
|
||||
for (unsigned int i = 0; i != emergethread.size(); i++) {
|
||||
for (u32 i = 0; i != emergethread.size(); i++) {
|
||||
emergethread[i]->Stop();
|
||||
emergethread[i]->qevent.signal();
|
||||
}
|
||||
|
||||
// Then do the waiting for each
|
||||
for (unsigned int i = 0; i != emergethread.size(); i++)
|
||||
for (u32 i = 0; i != emergethread.size(); i++)
|
||||
emergethread[i]->Wait();
|
||||
|
||||
threads_active = false;
|
||||
}
|
||||
|
||||
|
||||
bool EmergeManager::enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate) {
|
||||
bool EmergeManager::enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate)
|
||||
{
|
||||
std::map<v3s16, BlockEmergeData *>::const_iterator iter;
|
||||
BlockEmergeData *bedata;
|
||||
u16 count;
|
||||
@@ -274,7 +275,7 @@ bool EmergeManager::enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate
|
||||
|
||||
// insert into the EmergeThread queue with the least items
|
||||
int lowestitems = emergethread[0]->blockqueue.size();
|
||||
for (unsigned int i = 1; i != emergethread.size(); i++) {
|
||||
for (u32 i = 1; i != emergethread.size(); i++) {
|
||||
int nitems = emergethread[i]->blockqueue.size();
|
||||
if (nitems < lowestitems) {
|
||||
idx = i;
|
||||
@@ -290,7 +291,8 @@ bool EmergeManager::enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate
|
||||
}
|
||||
|
||||
|
||||
int EmergeManager::getGroundLevelAtPoint(v2s16 p) {
|
||||
int EmergeManager::getGroundLevelAtPoint(v2s16 p)
|
||||
{
|
||||
if (mapgen.size() == 0 || !mapgen[0]) {
|
||||
errorstream << "EmergeManager: getGroundLevelAtPoint() called"
|
||||
" before mapgen initialized" << std::endl;
|
||||
@@ -301,7 +303,8 @@ int EmergeManager::getGroundLevelAtPoint(v2s16 p) {
|
||||
}
|
||||
|
||||
|
||||
bool EmergeManager::isBlockUnderground(v3s16 blockpos) {
|
||||
bool EmergeManager::isBlockUnderground(v3s16 blockpos)
|
||||
{
|
||||
/*
|
||||
v2s16 p = v2s16((blockpos.X * MAP_BLOCKSIZE) + MAP_BLOCKSIZE / 2,
|
||||
(blockpos.Y * MAP_BLOCKSIZE) + MAP_BLOCKSIZE / 2);
|
||||
@@ -315,49 +318,61 @@ bool EmergeManager::isBlockUnderground(v3s16 blockpos) {
|
||||
}
|
||||
|
||||
|
||||
u32 EmergeManager::getBlockSeed(v3s16 p) {
|
||||
return (u32)(params.seed & 0xFFFFFFFF) +
|
||||
p.Z * 38134234 +
|
||||
p.Y * 42123 +
|
||||
p.X * 23;
|
||||
void EmergeManager::getMapgenNames(std::list<const char *> &mgnames)
|
||||
{
|
||||
for (u32 i = 0; i != ARRLEN(reg_mapgens); i++)
|
||||
mgnames.push_back(reg_mapgens[i].name);
|
||||
}
|
||||
|
||||
|
||||
Mapgen *EmergeManager::createMapgen(std::string mgname, int mgid,
|
||||
MapgenParams *mgparams) {
|
||||
std::map<std::string, MapgenFactory *>::const_iterator iter;
|
||||
iter = mglist.find(mgname);
|
||||
if (iter == mglist.end()) {
|
||||
Mapgen *EmergeManager::createMapgen(const std::string &mgname, int mgid,
|
||||
MapgenParams *mgparams)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i != ARRLEN(reg_mapgens) && mgname != reg_mapgens[i].name; i++);
|
||||
if (i == ARRLEN(reg_mapgens)) {
|
||||
errorstream << "EmergeManager; mapgen " << mgname <<
|
||||
" not registered" << std::endl;
|
||||
" not registered" << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MapgenFactory *mgfactory = iter->second;
|
||||
MapgenFactory *mgfactory = reg_mapgens[i].factory;
|
||||
return mgfactory->createMapgen(mgid, mgparams, this);
|
||||
}
|
||||
|
||||
|
||||
MapgenSpecificParams *EmergeManager::createMapgenParams(std::string mgname) {
|
||||
std::map<std::string, MapgenFactory *>::const_iterator iter;
|
||||
iter = mglist.find(mgname);
|
||||
if (iter == mglist.end()) {
|
||||
errorstream << "EmergeManager: mapgen " << mgname <<
|
||||
" not registered" << std::endl;
|
||||
MapgenSpecificParams *EmergeManager::createMapgenParams(const std::string &mgname)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i != ARRLEN(reg_mapgens) && mgname != reg_mapgens[i].name; i++);
|
||||
if (i == ARRLEN(reg_mapgens)) {
|
||||
errorstream << "EmergeManager; mapgen " << mgname <<
|
||||
" not registered" << std::endl;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MapgenFactory *mgfactory = iter->second;
|
||||
MapgenFactory *mgfactory = reg_mapgens[i].factory;
|
||||
return mgfactory->createMapgenParams();
|
||||
}
|
||||
|
||||
|
||||
void EmergeManager::loadParamsFromSettings(Settings *settings) {
|
||||
void EmergeManager::loadParamsFromSettings(Settings *settings)
|
||||
{
|
||||
std::string seed_str;
|
||||
const char *setname = (settings == g_settings) ? "fixed_map_seed" : "seed";
|
||||
|
||||
if (settings->getNoEx(setname, seed_str))
|
||||
if (!settings->getNoEx("seed", seed_str)) {
|
||||
g_settings->getNoEx(setname, seed_str);
|
||||
}
|
||||
if (!seed_str.empty()) {
|
||||
params.seed = read_seed(seed_str.c_str());
|
||||
} else {
|
||||
params.seed =
|
||||
((u64)(myrand() & 0xffff) << 0) |
|
||||
((u64)(myrand() & 0xffff) << 16) |
|
||||
((u64)(myrand() & 0xffff) << 32) |
|
||||
((u64)(myrand() & 0xffff) << 48);
|
||||
}
|
||||
|
||||
settings->getNoEx("mg_name", params.mg_name);
|
||||
settings->getS16NoEx("water_level", params.water_level);
|
||||
@@ -368,12 +383,16 @@ void EmergeManager::loadParamsFromSettings(Settings *settings) {
|
||||
|
||||
delete params.sparams;
|
||||
params.sparams = createMapgenParams(params.mg_name);
|
||||
if (params.sparams)
|
||||
|
||||
if (params.sparams) {
|
||||
params.sparams->readParams(g_settings);
|
||||
params.sparams->readParams(settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EmergeManager::saveParamsToSettings(Settings *settings) {
|
||||
void EmergeManager::saveParamsToSettings(Settings *settings)
|
||||
{
|
||||
settings->set("mg_name", params.mg_name);
|
||||
settings->setU64("seed", params.seed);
|
||||
settings->setS16("water_level", params.water_level);
|
||||
@@ -387,15 +406,10 @@ void EmergeManager::saveParamsToSettings(Settings *settings) {
|
||||
}
|
||||
|
||||
|
||||
void EmergeManager::registerMapgen(std::string mgname, MapgenFactory *mgfactory) {
|
||||
mglist.insert(std::make_pair(mgname, mgfactory));
|
||||
infostream << "EmergeManager: registered mapgen " << mgname << std::endl;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////// Emerge Thread //////////////////////////////////
|
||||
|
||||
bool EmergeThread::popBlockEmerge(v3s16 *pos, u8 *flags) {
|
||||
bool EmergeThread::popBlockEmerge(v3s16 *pos, u8 *flags)
|
||||
{
|
||||
std::map<v3s16, BlockEmergeData *>::iterator iter;
|
||||
JMutexAutoLock queuelock(emerge->queuemutex);
|
||||
|
||||
@@ -423,7 +437,8 @@ bool EmergeThread::popBlockEmerge(v3s16 *pos, u8 *flags) {
|
||||
|
||||
|
||||
bool EmergeThread::getBlockOrStartGen(v3s16 p, MapBlock **b,
|
||||
BlockMakeData *data, bool allow_gen) {
|
||||
BlockMakeData *data, bool allow_gen)
|
||||
{
|
||||
v2s16 p2d(p.X, p.Z);
|
||||
//envlock: usually takes <=1ms, sometimes 90ms or ~400ms to acquire
|
||||
JMutexAutoLock envlock(m_server->m_env_mutex);
|
||||
@@ -454,7 +469,8 @@ bool EmergeThread::getBlockOrStartGen(v3s16 p, MapBlock **b,
|
||||
}
|
||||
|
||||
|
||||
void *EmergeThread::Thread() {
|
||||
void *EmergeThread::Thread()
|
||||
{
|
||||
ThreadStarted();
|
||||
log_register_thread("EmergeThread" + itos(id));
|
||||
DSTACK(__FUNCTION_NAME);
|
||||
@@ -528,7 +544,7 @@ void *EmergeThread::Thread() {
|
||||
VoxelArea(minp, maxp));
|
||||
try { // takes about 90ms with -O1 on an e3-1230v2
|
||||
m_server->getScriptIface()->environment_OnGenerated(
|
||||
minp, maxp, emerge->getBlockSeed(minp));
|
||||
minp, maxp, mapgen->blockseed);
|
||||
} catch(LuaError &e) {
|
||||
m_server->setAsyncFatalError(e.what());
|
||||
}
|
||||
@@ -570,6 +586,23 @@ void *EmergeThread::Thread() {
|
||||
m_server->setAsyncFatalError(err.str());
|
||||
}
|
||||
|
||||
{
|
||||
JMutexAutoLock queuelock(emerge->queuemutex);
|
||||
while (!blockqueue.empty())
|
||||
{
|
||||
v3s16 p = blockqueue.front();
|
||||
blockqueue.pop();
|
||||
|
||||
std::map<v3s16, BlockEmergeData *>::iterator iter;
|
||||
iter = emerge->blocks_enqueued.find(p);
|
||||
if (iter == emerge->blocks_enqueued.end())
|
||||
continue; //uh oh, queue and map out of sync!!
|
||||
|
||||
BlockEmergeData *bedata = iter->second;
|
||||
delete bedata;
|
||||
}
|
||||
}
|
||||
|
||||
END_DEBUG_EXCEPTION_HANDLER(errorstream)
|
||||
log_deregister_thread();
|
||||
return NULL;
|
||||
|
||||
16
src/emerge.h
16
src/emerge.h
@@ -26,11 +26,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "mapgen.h" // for MapgenParams
|
||||
#include "map.h"
|
||||
|
||||
#define MGPARAMS_SET_MGNAME 1
|
||||
#define MGPARAMS_SET_SEED 2
|
||||
#define MGPARAMS_SET_WATER_LEVEL 4
|
||||
#define MGPARAMS_SET_FLAGS 8
|
||||
|
||||
#define BLOCK_EMERGE_ALLOWGEN (1<<0)
|
||||
|
||||
#define EMERGE_DBG_OUT(x) \
|
||||
@@ -49,7 +44,7 @@ class DecorationManager;
|
||||
class SchematicManager;
|
||||
|
||||
struct BlockMakeData {
|
||||
ManualMapVoxelManipulator *vmanip;
|
||||
MMVManip *vmanip;
|
||||
u64 seed;
|
||||
v3s16 blockpos_min;
|
||||
v3s16 blockpos_max;
|
||||
@@ -75,8 +70,6 @@ class EmergeManager {
|
||||
public:
|
||||
INodeDefManager *ndef;
|
||||
|
||||
std::map<std::string, MapgenFactory *> mglist;
|
||||
|
||||
std::vector<Mapgen *> mapgen;
|
||||
std::vector<EmergeThread *> emergethread;
|
||||
|
||||
@@ -110,14 +103,14 @@ class EmergeManager {
|
||||
void loadMapgenParams();
|
||||
void initMapgens();
|
||||
Mapgen *getCurrentMapgen();
|
||||
Mapgen *createMapgen(std::string mgname, int mgid,
|
||||
Mapgen *createMapgen(const std::string &mgname, int mgid,
|
||||
MapgenParams *mgparams);
|
||||
MapgenSpecificParams *createMapgenParams(std::string mgname);
|
||||
MapgenSpecificParams *createMapgenParams(const std::string &mgname);
|
||||
static void getMapgenNames(std::list<const char *> &mgnames);
|
||||
void startThreads();
|
||||
void stopThreads();
|
||||
bool enqueueBlockEmerge(u16 peer_id, v3s16 p, bool allow_generate);
|
||||
|
||||
void registerMapgen(std::string name, MapgenFactory *mgfactory);
|
||||
void loadParamsFromSettings(Settings *settings);
|
||||
void saveParamsToSettings(Settings *settings);
|
||||
|
||||
@@ -125,7 +118,6 @@ class EmergeManager {
|
||||
Biome *getBiomeAtPoint(v3s16 p);
|
||||
int getGroundLevelAtPoint(v2s16 p);
|
||||
bool isBlockUnderground(v3s16 blockpos);
|
||||
u32 getBlockSeed(v3s16 p);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2567,6 +2567,8 @@ void ClientEnvironment::damageLocalPlayer(u8 damage, bool handle_hp)
|
||||
assert(lplayer);
|
||||
|
||||
if(handle_hp){
|
||||
if (lplayer->hp == 0) // Don't damage a dead player
|
||||
return;
|
||||
if(lplayer->hp > damage)
|
||||
lplayer->hp -= damage;
|
||||
else
|
||||
|
||||
@@ -77,7 +77,7 @@ class Environment
|
||||
Player * getNearestConnectedPlayer(v3f pos);
|
||||
std::list<Player*> getPlayers();
|
||||
std::list<Player*> getPlayers(bool ignore_disconnected);
|
||||
|
||||
|
||||
u32 getDayNightRatio();
|
||||
|
||||
// 0-23999
|
||||
@@ -96,7 +96,7 @@ class Environment
|
||||
void stepTimeOfDay(float dtime);
|
||||
|
||||
void setTimeOfDaySpeed(float speed);
|
||||
|
||||
|
||||
float getTimeOfDaySpeed();
|
||||
|
||||
void setDayNightRatioOverride(bool enable, u32 value)
|
||||
@@ -132,7 +132,7 @@ class Environment
|
||||
* a later release.
|
||||
*/
|
||||
bool m_cache_enable_shaders;
|
||||
|
||||
|
||||
private:
|
||||
JMutex m_lock;
|
||||
|
||||
@@ -150,7 +150,7 @@ class ActiveBlockModifier
|
||||
public:
|
||||
ActiveBlockModifier(){};
|
||||
virtual ~ActiveBlockModifier(){};
|
||||
|
||||
|
||||
// Set of contents to trigger on
|
||||
virtual std::set<std::string> getTriggerContents()=0;
|
||||
// Set of required neighbors (trigger doesn't happen if none are found)
|
||||
@@ -255,7 +255,7 @@ class ServerEnvironment : public Environment
|
||||
Returns 0 if not added and thus deleted.
|
||||
*/
|
||||
u16 addActiveObject(ServerActiveObject *object);
|
||||
|
||||
|
||||
/*
|
||||
Add an active object as a static object to the corresponding
|
||||
MapBlock.
|
||||
@@ -264,7 +264,7 @@ class ServerEnvironment : public Environment
|
||||
(note: not used, pending removal from engine)
|
||||
*/
|
||||
//bool addActiveObjectAsStatic(ServerActiveObject *object);
|
||||
|
||||
|
||||
/*
|
||||
Find out what new objects have been added to
|
||||
inside a radius around a position
|
||||
@@ -282,7 +282,7 @@ class ServerEnvironment : public Environment
|
||||
s16 player_radius,
|
||||
std::set<u16> ¤t_objects,
|
||||
std::set<u16> &removed_objects);
|
||||
|
||||
|
||||
/*
|
||||
Get the next message emitted by some active object.
|
||||
Returns a message with id=0 if no messages are available.
|
||||
@@ -311,16 +311,16 @@ class ServerEnvironment : public Environment
|
||||
bool setNode(v3s16 p, const MapNode &n);
|
||||
bool removeNode(v3s16 p);
|
||||
bool swapNode(v3s16 p, const MapNode &n);
|
||||
|
||||
|
||||
// Find all active objects inside a radius around a point
|
||||
std::set<u16> getObjectsInsideRadius(v3f pos, float radius);
|
||||
|
||||
|
||||
// Clear all objects, loading and going through every MapBlock
|
||||
void clearAllObjects();
|
||||
|
||||
|
||||
// This makes stuff happen
|
||||
void step(f32 dtime);
|
||||
|
||||
|
||||
//check if there's a line of sight between two positions
|
||||
bool line_of_sight(v3f pos1, v3f pos2, float stepsize=1.0, v3s16 *p=NULL);
|
||||
|
||||
@@ -328,9 +328,9 @@ class ServerEnvironment : public Environment
|
||||
|
||||
void reportMaxLagEstimate(float f) { m_max_lag_estimate = f; }
|
||||
float getMaxLagEstimate() { return m_max_lag_estimate; }
|
||||
|
||||
|
||||
std::set<v3s16>* getForceloadedBlocks() { return &m_active_blocks.m_forceloaded_list; };
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/*
|
||||
@@ -349,17 +349,17 @@ class ServerEnvironment : public Environment
|
||||
Returns 0 if not added and thus deleted.
|
||||
*/
|
||||
u16 addActiveObjectRaw(ServerActiveObject *object, bool set_changed, u32 dtime_s);
|
||||
|
||||
|
||||
/*
|
||||
Remove all objects that satisfy (m_removed && m_known_by_count==0)
|
||||
*/
|
||||
void removeRemovedObjects();
|
||||
|
||||
|
||||
/*
|
||||
Convert stored objects from block to active
|
||||
*/
|
||||
void activateObjects(MapBlock *block, u32 dtime_s);
|
||||
|
||||
|
||||
/*
|
||||
Convert objects that are not in active blocks to static.
|
||||
|
||||
@@ -374,7 +374,7 @@ class ServerEnvironment : public Environment
|
||||
/*
|
||||
Member variables
|
||||
*/
|
||||
|
||||
|
||||
// The map
|
||||
ServerMap *m_map;
|
||||
// Lua state
|
||||
@@ -433,8 +433,8 @@ struct ClientEnvEvent
|
||||
{
|
||||
ClientEnvEventType type;
|
||||
union {
|
||||
struct{
|
||||
} none;
|
||||
//struct{
|
||||
//} none;
|
||||
struct{
|
||||
u8 amount;
|
||||
bool send_to_server;
|
||||
@@ -463,7 +463,7 @@ class ClientEnvironment : public Environment
|
||||
|
||||
virtual void addPlayer(Player *player);
|
||||
LocalPlayer * getLocalPlayer();
|
||||
|
||||
|
||||
/*
|
||||
ClientSimpleObjects
|
||||
*/
|
||||
@@ -473,7 +473,7 @@ class ClientEnvironment : public Environment
|
||||
/*
|
||||
ActiveObjects
|
||||
*/
|
||||
|
||||
|
||||
ClientActiveObject* getActiveObject(u16 id);
|
||||
|
||||
/*
|
||||
@@ -501,11 +501,11 @@ class ClientEnvironment : public Environment
|
||||
/*
|
||||
Client likes to call these
|
||||
*/
|
||||
|
||||
|
||||
// Get all nearby objects
|
||||
void getActiveObjects(v3f origin, f32 max_d,
|
||||
std::vector<DistanceSortedActiveObject> &dest);
|
||||
|
||||
|
||||
// Get event from queue. CEE_NONE is returned if queue is empty.
|
||||
ClientEnvEvent getClientEvent();
|
||||
|
||||
@@ -521,7 +521,7 @@ class ClientEnvironment : public Environment
|
||||
{ m_camera_offset = camera_offset; }
|
||||
v3s16 getCameraOffset()
|
||||
{ return m_camera_offset; }
|
||||
|
||||
|
||||
private:
|
||||
ClientMap *m_map;
|
||||
scene::ISceneManager *m_smgr;
|
||||
|
||||
@@ -110,12 +110,6 @@ class ServerError : public BaseException {
|
||||
ServerError(const std::string &s): BaseException(s) {}
|
||||
};
|
||||
|
||||
// Only used on Windows (SEH)
|
||||
class FatalSystemException : public BaseException {
|
||||
public:
|
||||
FatalSystemException(const std::string &s): BaseException(s) {}
|
||||
};
|
||||
|
||||
class ClientStateError : public BaseException {
|
||||
public:
|
||||
ClientStateError(std::string s): BaseException(s) {}
|
||||
|
||||
@@ -36,7 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
FontEngine* g_fontengine = NULL;
|
||||
|
||||
/** callback to be used on change of font size setting */
|
||||
static void font_setting_changed(const std::string) {
|
||||
static void font_setting_changed(const std::string, void *userdata) {
|
||||
g_fontengine->readSettings();
|
||||
}
|
||||
|
||||
@@ -91,22 +91,22 @@ FontEngine::FontEngine(Settings* main_settings, gui::IGUIEnvironment* env) :
|
||||
updateSkin();
|
||||
|
||||
if (m_currentMode == FM_Standard) {
|
||||
m_settings->registerChangedCallback("font_size", font_setting_changed);
|
||||
m_settings->registerChangedCallback("font_path", font_setting_changed);
|
||||
m_settings->registerChangedCallback("font_shadow", font_setting_changed);
|
||||
m_settings->registerChangedCallback("font_shadow_alpha", font_setting_changed);
|
||||
m_settings->registerChangedCallback("font_size", font_setting_changed, NULL);
|
||||
m_settings->registerChangedCallback("font_path", font_setting_changed, NULL);
|
||||
m_settings->registerChangedCallback("font_shadow", font_setting_changed, NULL);
|
||||
m_settings->registerChangedCallback("font_shadow_alpha", font_setting_changed, NULL);
|
||||
}
|
||||
else if (m_currentMode == FM_Fallback) {
|
||||
m_settings->registerChangedCallback("fallback_font_size", font_setting_changed);
|
||||
m_settings->registerChangedCallback("fallback_font_path", font_setting_changed);
|
||||
m_settings->registerChangedCallback("fallback_font_shadow", font_setting_changed);
|
||||
m_settings->registerChangedCallback("fallback_font_shadow_alpha", font_setting_changed);
|
||||
m_settings->registerChangedCallback("fallback_font_size", font_setting_changed, NULL);
|
||||
m_settings->registerChangedCallback("fallback_font_path", font_setting_changed, NULL);
|
||||
m_settings->registerChangedCallback("fallback_font_shadow", font_setting_changed, NULL);
|
||||
m_settings->registerChangedCallback("fallback_font_shadow_alpha", font_setting_changed, NULL);
|
||||
}
|
||||
|
||||
m_settings->registerChangedCallback("mono_font_path", font_setting_changed);
|
||||
m_settings->registerChangedCallback("mono_font_size", font_setting_changed);
|
||||
m_settings->registerChangedCallback("screen_dpi", font_setting_changed);
|
||||
m_settings->registerChangedCallback("gui_scaling", font_setting_changed);
|
||||
m_settings->registerChangedCallback("mono_font_path", font_setting_changed, NULL);
|
||||
m_settings->registerChangedCallback("mono_font_size", font_setting_changed, NULL);
|
||||
m_settings->registerChangedCallback("screen_dpi", font_setting_changed, NULL);
|
||||
m_settings->registerChangedCallback("gui_scaling", font_setting_changed, NULL);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
@@ -337,12 +337,6 @@ void FontEngine::initFont(unsigned int basesize, FontMode mode)
|
||||
|
||||
std::string font_path = g_settings->get(font_config_prefix + "font_path");
|
||||
|
||||
if (font_path.substr(font_path.length() -4) != ".ttf") {
|
||||
errorstream << "FontEngine: \"" << font_path
|
||||
<< "\" doesn't seem to be a ttf File." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
irr::gui::IGUIFont* font = gui::CGUITTFont::createTTFont(m_env,
|
||||
font_path.c_str(), size, true, true, font_shadow,
|
||||
font_shadow_alpha);
|
||||
@@ -378,7 +372,7 @@ void FontEngine::initSimpleFont(unsigned int basesize, FontMode mode)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((ending == ".xml") || ( ending == ".png")) {
|
||||
if ((ending == ".xml") || (ending == ".png")) {
|
||||
basename = font_path.substr(0,font_path.length()-4);
|
||||
}
|
||||
|
||||
|
||||
262
src/game.cpp
262
src/game.cpp
@@ -809,16 +809,35 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
|
||||
bool *m_force_fog_off;
|
||||
f32 *m_fog_range;
|
||||
Client *m_client;
|
||||
bool m_fogEnabled;
|
||||
|
||||
public:
|
||||
void onSettingsChange(const std::string &name)
|
||||
{
|
||||
if (name == "enable_fog")
|
||||
m_fogEnabled = g_settings->getBool("enable_fog");
|
||||
}
|
||||
|
||||
static void SettingsCallback(const std::string name, void *userdata)
|
||||
{
|
||||
reinterpret_cast<GameGlobalShaderConstantSetter*>(userdata)->onSettingsChange(name);
|
||||
}
|
||||
|
||||
GameGlobalShaderConstantSetter(Sky *sky, bool *force_fog_off,
|
||||
f32 *fog_range, Client *client) :
|
||||
m_sky(sky),
|
||||
m_force_fog_off(force_fog_off),
|
||||
m_fog_range(fog_range),
|
||||
m_client(client)
|
||||
{}
|
||||
~GameGlobalShaderConstantSetter() {}
|
||||
{
|
||||
g_settings->registerChangedCallback("enable_fog", SettingsCallback, this);
|
||||
m_fogEnabled = g_settings->getBool("enable_fog");
|
||||
}
|
||||
|
||||
~GameGlobalShaderConstantSetter()
|
||||
{
|
||||
g_settings->deregisterChangedCallback("enable_fog", SettingsCallback, this);
|
||||
}
|
||||
|
||||
virtual void onSetConstants(video::IMaterialRendererServices *services,
|
||||
bool is_highlevel)
|
||||
@@ -840,7 +859,7 @@ class GameGlobalShaderConstantSetter : public IShaderConstantSetter
|
||||
// Fog distance
|
||||
float fog_distance = 10000 * BS;
|
||||
|
||||
if (g_settings->getBool("enable_fog") && !*m_force_fog_off)
|
||||
if (m_fogEnabled && !*m_force_fog_off)
|
||||
fog_distance = *m_fog_range;
|
||||
|
||||
services->setPixelShaderConstant("fogDistance", &fog_distance, 1);
|
||||
@@ -1027,7 +1046,7 @@ static inline void create_formspec_menu(GUIFormSpecMenu **cur_formspec,
|
||||
#ifdef __ANDROID__
|
||||
#define SIZE_TAG "size[11,5.5]"
|
||||
#else
|
||||
#define SIZE_TAG "size[11,5.5,true]"
|
||||
#define SIZE_TAG "size[11,5.5,true]" // Fixed size on desktop
|
||||
#endif
|
||||
|
||||
static void show_chat_menu(GUIFormSpecMenu **cur_formspec,
|
||||
@@ -1059,7 +1078,7 @@ static void show_deathscreen(GUIFormSpecMenu **cur_formspec,
|
||||
std::string(FORMSPEC_VERSION_STRING) +
|
||||
SIZE_TAG
|
||||
"bgcolor[#320000b4;true]"
|
||||
"label[4.85,1.35;You died.]"
|
||||
"label[4.85,1.35;" + gettext("You died.") + "]"
|
||||
"button_exit[4,3;3,0.5;btn_respawn;" + gettext("Respawn") + "]"
|
||||
;
|
||||
|
||||
@@ -1118,11 +1137,13 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
|
||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_change_password;"
|
||||
<< wide_to_narrow(wstrgettext("Change Password")) << "]";
|
||||
}
|
||||
|
||||
|
||||
#ifndef __ANDROID__
|
||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_sound;"
|
||||
<< wide_to_narrow(wstrgettext("Sound Volume")) << "]";
|
||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_key_config;"
|
||||
<< wide_to_narrow(wstrgettext("Change Keys")) << "]";
|
||||
#endif
|
||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_menu;"
|
||||
<< wide_to_narrow(wstrgettext("Exit to Menu")) << "]";
|
||||
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
|
||||
@@ -1140,7 +1161,7 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
|
||||
LocalFormspecHandler *txt_dst = new LocalFormspecHandler("MT_PAUSE_MENU");
|
||||
|
||||
create_formspec_menu(cur_formspec, invmgr, gamedef, tsrc, device, fs_src, txt_dst, NULL);
|
||||
|
||||
(*cur_formspec)->setFocus(L"btn_continue");
|
||||
(*cur_formspec)->doPause = true;
|
||||
}
|
||||
|
||||
@@ -1325,7 +1346,6 @@ struct FpsControl {
|
||||
* many functions that do require objects of thse types do not modify them
|
||||
* (so they can be passed as a const qualified parameter)
|
||||
*/
|
||||
|
||||
struct CameraOrientation {
|
||||
f32 camera_yaw; // "right/left"
|
||||
f32 camera_pitch; // "up/down"
|
||||
@@ -1492,6 +1512,8 @@ class Game
|
||||
void toggleFullViewRange(float *statustext_time);
|
||||
|
||||
void updateCameraDirection(CameraOrientation *cam, VolatileRunFlags *flags);
|
||||
void updateCameraOrientation(CameraOrientation *cam,
|
||||
const VolatileRunFlags &flags);
|
||||
void updatePlayerControl(const CameraOrientation &cam);
|
||||
void step(f32 *dtime);
|
||||
void processClientEvents(CameraOrientation *cam, float *damage_flash);
|
||||
@@ -1521,7 +1543,7 @@ class Game
|
||||
// Misc
|
||||
void limitFps(FpsControl *fps_timings, f32 *dtime);
|
||||
|
||||
void showOverlayMessage(const char *msg, float dtime, int percent,
|
||||
void showOverlayMessage(const wchar_t *msg, float dtime, int percent,
|
||||
bool draw_clouds = true);
|
||||
|
||||
private:
|
||||
@@ -1640,6 +1662,8 @@ Game::Game() :
|
||||
m_cache_enable_fog = g_settings->getBool("enable_fog");
|
||||
m_cache_mouse_sensitivity = g_settings->getFloat("mouse_sensitivity");
|
||||
m_repeat_right_click_time = g_settings->getFloat("repeat_rightclick_time");
|
||||
|
||||
m_cache_mouse_sensitivity = rangelim(m_cache_mouse_sensitivity, 0.001, 100.0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1727,6 +1751,7 @@ void Game::run()
|
||||
flags.show_hud = true;
|
||||
flags.show_debug = g_settings->getBool("show_debug");
|
||||
flags.invert_mouse = g_settings->getBool("invert_mouse");
|
||||
flags.first_loop_after_window_activation = true;
|
||||
|
||||
/* Clear the profiler */
|
||||
Profiler::GraphValues dummyvalues;
|
||||
@@ -1742,6 +1767,8 @@ void Game::run()
|
||||
|
||||
std::vector<aabb3f> highlight_boxes;
|
||||
|
||||
set_light_table(g_settings->getFloat("display_gamma"));
|
||||
|
||||
while (device->run() && !(*kill || g_gamecallback->shutdown_requested)) {
|
||||
|
||||
/* Must be called immediately after a device->run() call because it
|
||||
@@ -1783,7 +1810,7 @@ void Game::run()
|
||||
|
||||
void Game::shutdown()
|
||||
{
|
||||
showOverlayMessage("Shutting down...", 0, 0, false);
|
||||
showOverlayMessage(wgettext("Shutting down..."), 0, 0, false);
|
||||
|
||||
if (clouds)
|
||||
clouds->drop();
|
||||
@@ -1794,8 +1821,6 @@ void Game::shutdown()
|
||||
if (sky)
|
||||
sky->drop();
|
||||
|
||||
clear_particles();
|
||||
|
||||
/* cleanup menus */
|
||||
while (g_menumgr.menuCount() > 0) {
|
||||
g_menumgr.m_stack.front()->setVisible(false);
|
||||
@@ -1834,7 +1859,7 @@ bool Game::init(
|
||||
u16 port,
|
||||
const SubgameSpec &gamespec)
|
||||
{
|
||||
showOverlayMessage("Loading...", 0, 0);
|
||||
showOverlayMessage(wgettext("Loading..."), 0, 0);
|
||||
|
||||
texture_src = createTextureSource(device);
|
||||
shader_src = createShaderSource(device);
|
||||
@@ -1891,7 +1916,7 @@ bool Game::initSound()
|
||||
bool Game::createSingleplayerServer(const std::string map_dir,
|
||||
const SubgameSpec &gamespec, u16 port, std::string *address)
|
||||
{
|
||||
showOverlayMessage("Creating server...", 0, 25);
|
||||
showOverlayMessage(wgettext("Creating server..."), 0, 5);
|
||||
|
||||
std::string bind_str = g_settings->get("bind_address");
|
||||
Address bind_addr(0, 0, 0, 0, port);
|
||||
@@ -1902,7 +1927,6 @@ bool Game::createSingleplayerServer(const std::string map_dir,
|
||||
|
||||
try {
|
||||
bind_addr.Resolve(bind_str.c_str());
|
||||
*address = bind_str;
|
||||
} catch (ResolveError &e) {
|
||||
infostream << "Resolving bind address \"" << bind_str
|
||||
<< "\" failed: " << e.what()
|
||||
@@ -1929,7 +1953,7 @@ bool Game::createClient(const std::string &playername,
|
||||
const std::string &password, std::string *address, u16 port,
|
||||
std::wstring *error_message)
|
||||
{
|
||||
showOverlayMessage("Creating client...", 0, 50);
|
||||
showOverlayMessage(wgettext("Creating client..."), 0, 10);
|
||||
|
||||
draw_control = new MapDrawControl;
|
||||
if (!draw_control)
|
||||
@@ -1982,7 +2006,7 @@ bool Game::createClient(const std::string &playername,
|
||||
|
||||
/* Skybox
|
||||
*/
|
||||
sky = new Sky(smgr->getRootSceneNode(), smgr, -1);
|
||||
sky = new Sky(smgr->getRootSceneNode(), smgr, -1, texture_src);
|
||||
skybox = NULL; // This is used/set later on in the main run loop
|
||||
|
||||
local_inventory = new Inventory(itemdef_manager);
|
||||
@@ -2098,7 +2122,11 @@ bool Game::connectToServer(const std::string &playername,
|
||||
const std::string &password, std::string *address, u16 port,
|
||||
bool *connect_ok, bool *aborted)
|
||||
{
|
||||
showOverlayMessage("Resolving address...", 0, 75);
|
||||
*connect_ok = false; // Let's not be overly optimistic
|
||||
*aborted = false;
|
||||
bool local_server_mode = false;
|
||||
|
||||
showOverlayMessage(wgettext("Resolving address..."), 0, 15);
|
||||
|
||||
Address connect_address(0, 0, 0, 0, port);
|
||||
|
||||
@@ -2114,6 +2142,7 @@ bool Game::connectToServer(const std::string &playername,
|
||||
} else {
|
||||
connect_address.setAddress(127, 0, 0, 1);
|
||||
}
|
||||
local_server_mode = true;
|
||||
}
|
||||
} catch (ResolveError &e) {
|
||||
*error_message = L"Couldn't resolve address: " + narrow_to_wide(e.what());
|
||||
@@ -2130,7 +2159,7 @@ bool Game::connectToServer(const std::string &playername,
|
||||
}
|
||||
|
||||
client = new Client(device,
|
||||
playername.c_str(), password, simple_singleplayer_mode,
|
||||
playername.c_str(), password,
|
||||
*draw_control, texture_src, shader_src,
|
||||
itemdef_manager, nodedef_manager, sound, eventmgr,
|
||||
connect_address.isIPv6());
|
||||
@@ -2140,13 +2169,12 @@ bool Game::connectToServer(const std::string &playername,
|
||||
|
||||
gamedef = client; // Client acts as our GameDef
|
||||
|
||||
|
||||
infostream << "Connecting to server at ";
|
||||
connect_address.print(&infostream);
|
||||
infostream << std::endl;
|
||||
|
||||
client->connect(connect_address);
|
||||
|
||||
client->connect(connect_address, *address,
|
||||
simple_singleplayer_mode || local_server_mode);
|
||||
|
||||
/*
|
||||
Wait for server to accept connection
|
||||
@@ -2189,7 +2217,7 @@ bool Game::connectToServer(const std::string &playername,
|
||||
}
|
||||
|
||||
// Update status
|
||||
showOverlayMessage("Connecting to server...", dtime, 100);
|
||||
showOverlayMessage(wgettext("Connecting to server..."), dtime, 20);
|
||||
}
|
||||
} catch (con::PeerNotFoundException &e) {
|
||||
// TODO: Should something be done here? At least an info/error
|
||||
@@ -2244,16 +2272,16 @@ bool Game::getServerContent(bool *aborted)
|
||||
}
|
||||
|
||||
// Display status
|
||||
int progress = 0;
|
||||
int progress = 25;
|
||||
|
||||
if (!client->itemdefReceived()) {
|
||||
wchar_t *text = wgettext("Item definitions...");
|
||||
progress = 0;
|
||||
const wchar_t *text = wgettext("Item definitions...");
|
||||
progress = 25;
|
||||
draw_load_screen(text, device, guienv, dtime, progress);
|
||||
delete[] text;
|
||||
} else if (!client->nodedefReceived()) {
|
||||
wchar_t *text = wgettext("Node definitions...");
|
||||
progress = 25;
|
||||
const wchar_t *text = wgettext("Node definitions...");
|
||||
progress = 30;
|
||||
draw_load_screen(text, device, guienv, dtime, progress);
|
||||
delete[] text;
|
||||
} else {
|
||||
@@ -2274,8 +2302,8 @@ bool Game::getServerContent(bool *aborted)
|
||||
message << " ( " << cur << cur_unit << " )";
|
||||
}
|
||||
|
||||
progress = 50 + client->mediaReceiveProgress() * 50 + 0.5;
|
||||
draw_load_screen(narrow_to_wide(message.str().c_str()), device,
|
||||
progress = 30 + client->mediaReceiveProgress() * 35 + 0.5;
|
||||
draw_load_screen(narrow_to_wide(message.str()), device,
|
||||
guienv, dtime, progress);
|
||||
}
|
||||
}
|
||||
@@ -2849,11 +2877,24 @@ void Game::toggleFullViewRange(float *statustext_time)
|
||||
void Game::updateCameraDirection(CameraOrientation *cam,
|
||||
VolatileRunFlags *flags)
|
||||
{
|
||||
// float turn_amount = 0; // Deprecated?
|
||||
if ((device->isWindowActive() && noMenuActive()) || random_input) {
|
||||
|
||||
if (!(device->isWindowActive() && noMenuActive()) || random_input) {
|
||||
#ifndef __ANDROID__
|
||||
if (!random_input) {
|
||||
// Mac OSX gets upset if this is set every frame
|
||||
if (device->getCursorControl()->isVisible())
|
||||
device->getCursorControl()->setVisible(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
// FIXME: Clean this up
|
||||
if (flags->first_loop_after_window_activation)
|
||||
flags->first_loop_after_window_activation = false;
|
||||
else
|
||||
updateCameraOrientation(cam, *flags);
|
||||
|
||||
input->setMousePos((driver->getScreenSize().Width / 2),
|
||||
(driver->getScreenSize().Height / 2));
|
||||
} else {
|
||||
|
||||
#ifndef ANDROID
|
||||
// Mac OSX gets upset if this is set every frame
|
||||
@@ -2861,63 +2902,38 @@ void Game::updateCameraDirection(CameraOrientation *cam,
|
||||
device->getCursorControl()->setVisible(true);
|
||||
#endif
|
||||
|
||||
//infostream<<"window inactive"<<std::endl;
|
||||
flags->first_loop_after_window_activation = true;
|
||||
return;
|
||||
}
|
||||
if (!flags->first_loop_after_window_activation)
|
||||
flags->first_loop_after_window_activation = true;
|
||||
|
||||
#ifndef __ANDROID__
|
||||
if (!random_input) {
|
||||
// Mac OSX gets upset if this is set every frame
|
||||
if (device->getCursorControl()->isVisible())
|
||||
device->getCursorControl()->setVisible(false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (flags->first_loop_after_window_activation) {
|
||||
//infostream<<"window active, first loop"<<std::endl;
|
||||
flags->first_loop_after_window_activation = false;
|
||||
|
||||
void Game::updateCameraOrientation(CameraOrientation *cam,
|
||||
const VolatileRunFlags &flags)
|
||||
{
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
if (g_touchscreengui) {
|
||||
cam->camera_yaw = g_touchscreengui->getYaw();
|
||||
cam->camera_pitch = g_touchscreengui->getPitch();
|
||||
} else {
|
||||
#endif
|
||||
s32 dx = input->getMousePos().X - (driver->getScreenSize().Width / 2);
|
||||
s32 dy = input->getMousePos().Y - (driver->getScreenSize().Height / 2);
|
||||
|
||||
if (flags.invert_mouse
|
||||
|| camera->getCameraMode() == CAMERA_MODE_THIRD_FRONT) {
|
||||
dy = -dy;
|
||||
}
|
||||
|
||||
cam->camera_yaw -= dx * m_cache_mouse_sensitivity;
|
||||
cam->camera_pitch += dy * m_cache_mouse_sensitivity;
|
||||
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
|
||||
if (g_touchscreengui) {
|
||||
cam->camera_yaw = g_touchscreengui->getYaw();
|
||||
cam->camera_pitch = g_touchscreengui->getPitch();
|
||||
} else {
|
||||
#endif
|
||||
s32 dx = input->getMousePos().X - (driver->getScreenSize().Width / 2);
|
||||
s32 dy = input->getMousePos().Y - (driver->getScreenSize().Height / 2);
|
||||
|
||||
if (flags->invert_mouse
|
||||
|| (camera->getCameraMode() == CAMERA_MODE_THIRD_FRONT)) {
|
||||
dy = -dy;
|
||||
}
|
||||
|
||||
//infostream<<"window active, pos difference "<<dx<<","<<dy<<std::endl;
|
||||
|
||||
float d = m_cache_mouse_sensitivity;
|
||||
d = rangelim(d, 0.01, 100.0);
|
||||
cam->camera_yaw -= dx * d;
|
||||
cam->camera_pitch += dy * d;
|
||||
// turn_amount = v2f(dx, dy).getLength() * d; // deprecated?
|
||||
|
||||
#ifdef HAVE_TOUCHSCREENGUI
|
||||
}
|
||||
#endif
|
||||
|
||||
if (cam->camera_pitch < -89.5)
|
||||
cam->camera_pitch = -89.5;
|
||||
else if (cam->camera_pitch > 89.5)
|
||||
cam->camera_pitch = 89.5;
|
||||
}
|
||||
#endif
|
||||
|
||||
input->setMousePos(driver->getScreenSize().Width / 2,
|
||||
driver->getScreenSize().Height / 2);
|
||||
|
||||
// Deprecated? Not used anywhere else
|
||||
// recent_turn_speed = recent_turn_speed * 0.9 + turn_amount * 0.1;
|
||||
// std::cerr<<"recent_turn_speed = "<<recent_turn_speed<<std::endl;
|
||||
cam->camera_pitch = rangelim(cam->camera_pitch, -89.5, 89.5);
|
||||
}
|
||||
|
||||
|
||||
@@ -3022,44 +3038,11 @@ void Game::processClientEvents(CameraOrientation *cam, float *damage_flash)
|
||||
|
||||
delete(event.show_formspec.formspec);
|
||||
delete(event.show_formspec.formname);
|
||||
} else if (event.type == CE_SPAWN_PARTICLE) {
|
||||
video::ITexture *texture =
|
||||
gamedef->tsrc()->getTexture(*(event.spawn_particle.texture));
|
||||
|
||||
new Particle(gamedef, smgr, player, client->getEnv(),
|
||||
*event.spawn_particle.pos,
|
||||
*event.spawn_particle.vel,
|
||||
*event.spawn_particle.acc,
|
||||
event.spawn_particle.expirationtime,
|
||||
event.spawn_particle.size,
|
||||
event.spawn_particle.collisiondetection,
|
||||
event.spawn_particle.vertical,
|
||||
texture,
|
||||
v2f(0.0, 0.0),
|
||||
v2f(1.0, 1.0));
|
||||
} else if (event.type == CE_ADD_PARTICLESPAWNER) {
|
||||
video::ITexture *texture =
|
||||
gamedef->tsrc()->getTexture(*(event.add_particlespawner.texture));
|
||||
|
||||
new ParticleSpawner(gamedef, smgr, player,
|
||||
event.add_particlespawner.amount,
|
||||
event.add_particlespawner.spawntime,
|
||||
*event.add_particlespawner.minpos,
|
||||
*event.add_particlespawner.maxpos,
|
||||
*event.add_particlespawner.minvel,
|
||||
*event.add_particlespawner.maxvel,
|
||||
*event.add_particlespawner.minacc,
|
||||
*event.add_particlespawner.maxacc,
|
||||
event.add_particlespawner.minexptime,
|
||||
event.add_particlespawner.maxexptime,
|
||||
event.add_particlespawner.minsize,
|
||||
event.add_particlespawner.maxsize,
|
||||
event.add_particlespawner.collisiondetection,
|
||||
event.add_particlespawner.vertical,
|
||||
texture,
|
||||
event.add_particlespawner.id);
|
||||
} else if (event.type == CE_DELETE_PARTICLESPAWNER) {
|
||||
delete_particlespawner(event.delete_particlespawner.id);
|
||||
} else if ((event.type == CE_SPAWN_PARTICLE) ||
|
||||
(event.type == CE_ADD_PARTICLESPAWNER) ||
|
||||
(event.type == CE_DELETE_PARTICLESPAWNER)) {
|
||||
client->getParticleManager()->handleParticleEvent(&event, gamedef,
|
||||
smgr, player);
|
||||
} else if (event.type == CE_HUDADD) {
|
||||
u32 id = event.hudadd.id;
|
||||
|
||||
@@ -3239,10 +3222,13 @@ void Game::updateCamera(VolatileRunFlags *flags, u32 busy_time,
|
||||
v3s16 old_camera_offset = camera->getOffset();
|
||||
|
||||
if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_CAMERA_MODE])) {
|
||||
camera->toggleCameraMode();
|
||||
GenericCAO *playercao = player->getCAO();
|
||||
|
||||
assert(playercao != NULL);
|
||||
// If playercao not loaded, don't change camera
|
||||
if (playercao == NULL)
|
||||
return;
|
||||
|
||||
camera->toggleCameraMode();
|
||||
|
||||
playercao->setVisible(camera->getCameraMode() > CAMERA_MODE_FIRST);
|
||||
}
|
||||
@@ -3621,8 +3607,8 @@ void Game::handleDigging(GameRunData *runData,
|
||||
if (m_cache_enable_particles) {
|
||||
const ContentFeatures &features =
|
||||
client->getNodeDefManager()->get(n);
|
||||
addPunchingParticles(gamedef, smgr, player,
|
||||
client->getEnv(), nodepos, features.tiles);
|
||||
client->getParticleManager()->addPunchingParticles(gamedef, smgr,
|
||||
player, nodepos, features.tiles);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3668,9 +3654,8 @@ void Game::handleDigging(GameRunData *runData,
|
||||
if (m_cache_enable_particles) {
|
||||
const ContentFeatures &features =
|
||||
client->getNodeDefManager()->get(wasnode);
|
||||
addDiggingParticles
|
||||
(gamedef, smgr, player, client->getEnv(),
|
||||
nodepos, features.tiles);
|
||||
client->getParticleManager()->addDiggingParticles(gamedef, smgr,
|
||||
player, nodepos, features.tiles);
|
||||
}
|
||||
|
||||
runData->dig_time = 0;
|
||||
@@ -3793,9 +3778,7 @@ void Game::updateFrame(std::vector<aabb3f> &highlight_boxes,
|
||||
/*
|
||||
Update particles
|
||||
*/
|
||||
|
||||
allparticles_step(dtime);
|
||||
allparticlespawners_step(dtime, client->getEnv());
|
||||
client->getParticleManager()->step(dtime);
|
||||
|
||||
/*
|
||||
Fog
|
||||
@@ -4050,10 +4033,13 @@ void Game::updateGui(float *statustext_time, const RunStats &stats,
|
||||
guitext_status->setVisible(!statustext.empty());
|
||||
|
||||
if (!statustext.empty()) {
|
||||
s32 status_y = screensize.Y - 130;
|
||||
s32 status_width = guitext_status->getTextWidth();
|
||||
s32 status_height = guitext_status->getTextHeight();
|
||||
s32 status_y = screensize.Y - 150;
|
||||
s32 status_x = (screensize.X - status_width) / 2;
|
||||
core::rect<s32> rect(
|
||||
10, status_y - guitext_status->getTextHeight(),
|
||||
10 + guitext_status->getTextWidth(), status_y
|
||||
status_x , status_y - status_height,
|
||||
status_x + status_width, status_y
|
||||
);
|
||||
guitext_status->setRelativePosition(rect);
|
||||
|
||||
@@ -4132,12 +4118,11 @@ inline void Game::limitFps(FpsControl *fps_timings, f32 *dtime)
|
||||
}
|
||||
|
||||
|
||||
void Game::showOverlayMessage(const char *msg, float dtime,
|
||||
void Game::showOverlayMessage(const wchar_t *msg, float dtime,
|
||||
int percent, bool draw_clouds)
|
||||
{
|
||||
wchar_t *text = wgettext(msg);
|
||||
draw_load_screen(text, device, guienv, dtime, percent, draw_clouds);
|
||||
delete[] text;
|
||||
draw_load_screen(msg, device, guienv, dtime, percent, draw_clouds);
|
||||
delete[] msg;
|
||||
}
|
||||
|
||||
|
||||
@@ -4217,6 +4202,7 @@ void the_game(bool *kill,
|
||||
errorstream << "ServerError: " << e.what() << std::endl;
|
||||
} catch (ModError &e) {
|
||||
errorstream << "ModError: " << e.what() << std::endl;
|
||||
error_message = narrow_to_wide(e.what()) + wgettext("\nCheck debug.txt for details.");
|
||||
error_message = narrow_to_wide(e.what()) + wstrgettext("\nCheck debug.txt for details.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,26 +23,27 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include <stdlib.h>
|
||||
#include "gettext.h"
|
||||
#include "util/string.h"
|
||||
#include "log.h"
|
||||
|
||||
#if USE_GETTEXT && defined(_MSC_VER)
|
||||
#include <WinNls.h>
|
||||
#include <windows.h>
|
||||
#include <map>
|
||||
#include <direct.h>
|
||||
#include "filesys.h"
|
||||
|
||||
#define setlocale(category,localename) \
|
||||
setlocale(category,MSVC_LocaleLookup(localename))
|
||||
#define setlocale(category, localename) \
|
||||
setlocale(category, MSVC_LocaleLookup(localename))
|
||||
|
||||
static std::map<std::wstring,std::wstring> glb_supported_locales;
|
||||
static std::map<std::wstring, std::wstring> glb_supported_locales;
|
||||
|
||||
/******************************************************************************/
|
||||
BOOL CALLBACK UpdateLocaleCallback(LPTSTR pStr)
|
||||
{
|
||||
char* endptr = 0;
|
||||
int LOCALEID = strtol(pStr,&endptr,16);
|
||||
int LOCALEID = strtol(pStr, &endptr,16);
|
||||
|
||||
wchar_t buffer[LOCALE_NAME_MAX_LENGTH];
|
||||
memset(buffer,0,sizeof(buffer));
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
if (GetLocaleInfoW(
|
||||
LOCALEID,
|
||||
LOCALE_SISO639LANGNAME,
|
||||
@@ -51,7 +52,7 @@ BOOL CALLBACK UpdateLocaleCallback(LPTSTR pStr)
|
||||
|
||||
std::wstring name = buffer;
|
||||
|
||||
memset(buffer,0,sizeof(buffer));
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
GetLocaleInfoW(
|
||||
LOCALEID,
|
||||
LOCALE_SISO3166CTRYNAME,
|
||||
@@ -60,7 +61,7 @@ BOOL CALLBACK UpdateLocaleCallback(LPTSTR pStr)
|
||||
|
||||
std::wstring country = buffer;
|
||||
|
||||
memset(buffer,0,sizeof(buffer));
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
GetLocaleInfoW(
|
||||
LOCALEID,
|
||||
LOCALE_SENGLISHLANGUAGENAME,
|
||||
@@ -95,7 +96,7 @@ const char* MSVC_LocaleLookup(const char* raw_shortname) {
|
||||
}
|
||||
|
||||
if (first_use) {
|
||||
EnumSystemLocalesA(UpdateLocaleCallback,LCID_SUPPORTED | LCID_ALTERNATE_SORTS);
|
||||
EnumSystemLocalesA(UpdateLocaleCallback, LCID_SUPPORTED | LCID_ALTERNATE_SORTS);
|
||||
first_use = false;
|
||||
}
|
||||
|
||||
@@ -116,9 +117,9 @@ const char* MSVC_LocaleLookup(const char* raw_shortname) {
|
||||
|
||||
/******************************************************************************/
|
||||
#ifdef _MSC_VER
|
||||
void init_gettext(const char *path,std::string configured_language,int argc, char** argv) {
|
||||
void init_gettext(const char *path, const std::string &configured_language, int argc, char** argv) {
|
||||
#else
|
||||
void init_gettext(const char *path,std::string configured_language) {
|
||||
void init_gettext(const char *path, const std::string &configured_language) {
|
||||
#endif
|
||||
#if USE_GETTEXT
|
||||
/** first try to set user override environment **/
|
||||
@@ -147,8 +148,8 @@ void init_gettext(const char *path,std::string configured_language) {
|
||||
if (current_language_var != configured_language) {
|
||||
STARTUPINFO startupinfo;
|
||||
PROCESS_INFORMATION processinfo;
|
||||
memset(&startupinfo,0,sizeof(startupinfo));
|
||||
memset(&processinfo,0,sizeof(processinfo));
|
||||
memset(&startupinfo, 0, sizeof(startupinfo));
|
||||
memset(&processinfo, 0, sizeof(processinfo));
|
||||
errorstream << "MSVC localization workaround active restating minetest in new environment!" << std::endl;
|
||||
|
||||
std::string parameters = "";
|
||||
@@ -168,20 +169,20 @@ void init_gettext(const char *path,std::string configured_language) {
|
||||
|
||||
/** users may start by short name in commandline without extention **/
|
||||
std::string appname = argv[0];
|
||||
if (appname.substr(appname.length() -4) != ".exe") {
|
||||
if (appname.substr(appname.length() - 4) != ".exe") {
|
||||
appname += ".exe";
|
||||
}
|
||||
|
||||
if (!CreateProcess(appname.c_str(),
|
||||
(char*) ptr_parameters,
|
||||
NULL,
|
||||
NULL,
|
||||
false,
|
||||
DETACHED_PROCESS | CREATE_UNICODE_ENVIRONMENT,
|
||||
NULL,
|
||||
NULL,
|
||||
&startupinfo,
|
||||
&processinfo)) {
|
||||
(char*) ptr_parameters,
|
||||
NULL,
|
||||
NULL,
|
||||
false,
|
||||
DETACHED_PROCESS | CREATE_UNICODE_ENVIRONMENT,
|
||||
NULL,
|
||||
NULL,
|
||||
&startupinfo,
|
||||
&processinfo)) {
|
||||
char buffer[1024];
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
@@ -259,11 +260,8 @@ void init_gettext(const char *path,std::string configured_language) {
|
||||
/* no matter what locale is used we need number format to be "C" */
|
||||
/* to ensure formspec parameters are evaluated correct! */
|
||||
|
||||
setlocale(LC_NUMERIC,"C");
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
infostream << "Message locale is now set to: "
|
||||
<< setlocale(LC_ALL,0) << std::endl;
|
||||
<< setlocale(LC_ALL, 0) << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#define GETTEXT_HEADER
|
||||
|
||||
#include "config.h" // for USE_GETTEXT
|
||||
#include "log.h"
|
||||
|
||||
#if USE_GETTEXT
|
||||
#include <libintl.h>
|
||||
@@ -33,64 +32,33 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#define gettext_noop(String) String
|
||||
#define N_(String) gettext_noop (String)
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
#endif // #if defined(_WIN32)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
void init_gettext(const char *path,std::string configured_language,int argc, char** argv);
|
||||
void init_gettext(const char *path, const std::string &configured_language, int argc, char** argv);
|
||||
#else
|
||||
void init_gettext(const char *path,std::string configured_language);
|
||||
void init_gettext(const char *path, const std::string &configured_language);
|
||||
#endif
|
||||
|
||||
extern std::wstring narrow_to_wide(const std::string& mbs);
|
||||
#include "util/numeric.h"
|
||||
extern const wchar_t *narrow_to_wide_c(const char *mbs);
|
||||
extern std::wstring narrow_to_wide(const std::string &mbs);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
inline wchar_t* chartowchar_t(const char *str)
|
||||
// You must free the returned string!
|
||||
inline const wchar_t *wgettext(const char *str)
|
||||
{
|
||||
wchar_t* nstr = 0;
|
||||
#if defined(_WIN32)
|
||||
int nResult = MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) str, -1, 0, 0 );
|
||||
if( nResult == 0 )
|
||||
{
|
||||
errorstream<<"gettext: MultiByteToWideChar returned null"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
nstr = new wchar_t[nResult];
|
||||
MultiByteToWideChar( CP_UTF8, 0, (LPCSTR) str, -1, (WCHAR *) nstr, nResult );
|
||||
}
|
||||
#else
|
||||
size_t l = strlen(str);
|
||||
nstr = new wchar_t[l+1];
|
||||
|
||||
std::wstring intermediate = narrow_to_wide(str);
|
||||
memset(nstr, 0, (l+1)*sizeof(wchar_t));
|
||||
memcpy(nstr, intermediate.c_str(), l*sizeof(wchar_t));
|
||||
#endif
|
||||
|
||||
return nstr;
|
||||
return narrow_to_wide_c(gettext(str));
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
inline wchar_t* wgettext(const char *str)
|
||||
// Gettext under MSVC needs this strange way. Just don't ask...
|
||||
inline std::wstring wstrgettext(const std::string &text)
|
||||
{
|
||||
return chartowchar_t(gettext(str));
|
||||
const wchar_t *tmp = wgettext(text.c_str());
|
||||
std::wstring retval = (std::wstring)tmp;
|
||||
delete[] tmp;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
inline std::wstring wstrgettext(std::string text) {
|
||||
wchar_t* wlabel = wgettext(text.c_str());
|
||||
std::wstring out = (std::wstring)wlabel;
|
||||
delete[] wlabel;
|
||||
return out;
|
||||
inline std::string strgettext(const std::string &text)
|
||||
{
|
||||
return gettext(text.c_str());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,9 +28,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "porting.h"
|
||||
#include "tile.h"
|
||||
#include "fontengine.h"
|
||||
#include <string>
|
||||
|
||||
#include "log.h"
|
||||
#include "gettext.h"
|
||||
#include <string>
|
||||
|
||||
#if USE_FREETYPE
|
||||
#include "xCGUITTFont.h"
|
||||
@@ -72,25 +72,22 @@ GUIChatConsole::GUIChatConsole(
|
||||
m_animate_time_old = getTimeMs();
|
||||
|
||||
// load background settings
|
||||
bool console_color_set = !g_settings->get("console_color").empty();
|
||||
s32 console_alpha = g_settings->getS32("console_alpha");
|
||||
m_background_color.setAlpha(clamp_u8(console_alpha));
|
||||
|
||||
// load the background texture depending on settings
|
||||
m_background_color.setAlpha(clamp_u8(console_alpha));
|
||||
if (console_color_set)
|
||||
{
|
||||
ITextureSource *tsrc = client->getTextureSource();
|
||||
if (tsrc->isKnownSourceImage("background_chat.jpg")) {
|
||||
m_background = tsrc->getTexture("background_chat.jpg");
|
||||
m_background_color.setRed(255);
|
||||
m_background_color.setGreen(255);
|
||||
m_background_color.setBlue(255);
|
||||
} else {
|
||||
v3f console_color = g_settings->getV3F("console_color");
|
||||
m_background_color.setRed(clamp_u8(myround(console_color.X)));
|
||||
m_background_color.setGreen(clamp_u8(myround(console_color.Y)));
|
||||
m_background_color.setBlue(clamp_u8(myround(console_color.Z)));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_background = env->getVideoDriver()->getTexture(getTexturePath("background_chat.jpg").c_str());
|
||||
m_background_color.setRed(255);
|
||||
m_background_color.setGreen(255);
|
||||
m_background_color.setBlue(255);
|
||||
}
|
||||
|
||||
m_font = g_fontengine->getFont(FONT_SIZE_UNSPECIFIED, FM_Mono);
|
||||
|
||||
@@ -102,7 +99,7 @@ GUIChatConsole::GUIChatConsole(
|
||||
{
|
||||
core::dimension2d<u32> dim = m_font->getDimension(L"M");
|
||||
m_fontsize = v2u32(dim.Width, dim.Height);
|
||||
dstream << "Font size: " << m_fontsize.X << " " << m_fontsize.Y << std::endl;
|
||||
m_font->grab();
|
||||
}
|
||||
m_fontsize.X = MYMAX(m_fontsize.X, 1);
|
||||
m_fontsize.Y = MYMAX(m_fontsize.Y, 1);
|
||||
@@ -112,7 +109,10 @@ GUIChatConsole::GUIChatConsole(
|
||||
}
|
||||
|
||||
GUIChatConsole::~GUIChatConsole()
|
||||
{}
|
||||
{
|
||||
if (m_font)
|
||||
m_font->drop();
|
||||
}
|
||||
|
||||
void GUIChatConsole::openConsole(f32 height)
|
||||
{
|
||||
|
||||
@@ -364,15 +364,14 @@ void GUIEngine::cloudPostProcess()
|
||||
{
|
||||
float fps_max = g_settings->getFloat("fps_max");
|
||||
// Time of frame without fps limit
|
||||
float busytime;
|
||||
u32 busytime_u32;
|
||||
|
||||
// not using getRealTime is necessary for wine
|
||||
u32 time = m_device->getTimer()->getTime();
|
||||
if(time > m_cloud.lasttime)
|
||||
busytime_u32 = time - m_cloud.lasttime;
|
||||
else
|
||||
busytime_u32 = 0;
|
||||
busytime = busytime_u32 / 1000.0;
|
||||
|
||||
// FPS limiter
|
||||
u32 frametime_min = 1000./fps_max;
|
||||
|
||||
@@ -74,55 +74,6 @@ static unsigned int font_line_height(gui::IGUIFont *font)
|
||||
return font->getDimension(L"Ay").Height + font->getKerningHeight();
|
||||
}
|
||||
|
||||
static gui::IGUIFont *select_font_by_line_height(double target_line_height)
|
||||
{
|
||||
return g_fontengine->getFont();
|
||||
|
||||
/* I have no idea what this is trying to achieve, but scaling the font according
|
||||
* to the size of a formspec/dialog does not seem to be a standard (G)UI
|
||||
* design and AFAIK no existing nor proposed GUI does this. Besides that it:
|
||||
* a) breaks most (current) formspec layouts
|
||||
* b) font sizes change depending on the size of the formspec/dialog (see above)
|
||||
* meaning that there is no UI consistency
|
||||
* c) the chosen fonts are, in general, probably too large
|
||||
*
|
||||
* Disabling for now.
|
||||
*
|
||||
* FIXME
|
||||
*/
|
||||
#if 0
|
||||
// We don't get to directly select a font according to its
|
||||
// baseline-to-baseline height. Rather, we select by em size.
|
||||
// The ratio between these varies between fonts. The font
|
||||
// engine also takes its size parameter not specified in pixels,
|
||||
// as we want, but scaled by display density and gui_scaling,
|
||||
// so invert that scaling here. Use a binary search among
|
||||
// requested sizes to find the right font. Our starting bounds
|
||||
// are an em height of 1 (being careful not to request size 0,
|
||||
// which crashes the freetype system) and an em height of the
|
||||
// target baseline-to-baseline height.
|
||||
unsigned int loreq = ceil(1 / porting::getDisplayDensity()
|
||||
/ g_settings->getFloat("gui_scaling"));
|
||||
unsigned int hireq = ceil(target_line_height
|
||||
/ porting::getDisplayDensity()
|
||||
/ g_settings->getFloat("gui_scaling"));
|
||||
unsigned int lohgt = font_line_height(g_fontengine->getFont(loreq));
|
||||
unsigned int hihgt = font_line_height(g_fontengine->getFont(hireq));
|
||||
while(hireq - loreq > 1 && lohgt != hihgt) {
|
||||
unsigned int nureq = (loreq + hireq) >> 1;
|
||||
unsigned int nuhgt = font_line_height(g_fontengine->getFont(nureq));
|
||||
if(nuhgt < target_line_height) {
|
||||
loreq = nureq;
|
||||
lohgt = nuhgt;
|
||||
} else {
|
||||
hireq = nureq;
|
||||
hihgt = nuhgt;
|
||||
}
|
||||
}
|
||||
return g_fontengine->getFont(target_line_height - lohgt < hihgt - target_line_height ? loreq : hireq);
|
||||
#endif
|
||||
}
|
||||
|
||||
GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
|
||||
gui::IGUIElement* parent, s32 id, IMenuManager *menumgr,
|
||||
InventoryManager *invmgr, IGameDef *gamedef,
|
||||
@@ -146,6 +97,7 @@ GUIFormSpecMenu::GUIFormSpecMenu(irr::IrrlichtDevice* dev,
|
||||
m_form_src(fsrc),
|
||||
m_text_dst(tdst),
|
||||
m_formspec_version(0),
|
||||
m_focused_element(L""),
|
||||
m_font(NULL)
|
||||
#ifdef __ANDROID__
|
||||
,m_JavaDialogFieldName(L"")
|
||||
@@ -401,7 +353,7 @@ void GUIFormSpecMenu::parseCheckbox(parserData* data,std::string element)
|
||||
{
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
|
||||
if (((parts.size() >= 3) || (parts.size() <= 4)) ||
|
||||
if (((parts.size() >= 3) && (parts.size() <= 4)) ||
|
||||
((parts.size() > 4) && (m_formspec_version > FORMSPEC_API_VERSION)))
|
||||
{
|
||||
std::vector<std::string> v_pos = split(parts[0],',');
|
||||
@@ -423,7 +375,7 @@ void GUIFormSpecMenu::parseCheckbox(parserData* data,std::string element)
|
||||
if (selected == "true")
|
||||
fselected = true;
|
||||
|
||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
||||
std::wstring wlabel = narrow_to_wide(label);
|
||||
|
||||
core::rect<s32> rect = core::rect<s32>(
|
||||
pos.X, pos.Y + ((imgsize.Y/2) - m_btn_height),
|
||||
@@ -431,7 +383,7 @@ void GUIFormSpecMenu::parseCheckbox(parserData* data,std::string element)
|
||||
pos.Y + ((imgsize.Y/2) + m_btn_height));
|
||||
|
||||
FieldSpec spec(
|
||||
narrow_to_wide(name.c_str()),
|
||||
narrow_to_wide(name),
|
||||
wlabel, //Needed for displaying text on MSVC
|
||||
wlabel,
|
||||
258+m_fields.size()
|
||||
@@ -483,7 +435,7 @@ void GUIFormSpecMenu::parseScrollBar(parserData* data, std::string element)
|
||||
core::rect<s32>(pos.X, pos.Y, pos.X + dim.X, pos.Y + dim.Y);
|
||||
|
||||
FieldSpec spec(
|
||||
narrow_to_wide(name.c_str()),
|
||||
narrow_to_wide(name),
|
||||
L"",
|
||||
L"",
|
||||
258+m_fields.size()
|
||||
@@ -621,10 +573,10 @@ void GUIFormSpecMenu::parseButton(parserData* data,std::string element,
|
||||
|
||||
label = unescape_string(label);
|
||||
|
||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
||||
std::wstring wlabel = narrow_to_wide(label);
|
||||
|
||||
FieldSpec spec(
|
||||
narrow_to_wide(name.c_str()),
|
||||
narrow_to_wide(name),
|
||||
wlabel,
|
||||
L"",
|
||||
258+m_fields.size()
|
||||
@@ -746,7 +698,7 @@ void GUIFormSpecMenu::parseTable(parserData* data,std::string element)
|
||||
|
||||
core::rect<s32> rect = core::rect<s32>(pos.X, pos.Y, pos.X+geom.X, pos.Y+geom.Y);
|
||||
|
||||
std::wstring fname_w = narrow_to_wide(name.c_str());
|
||||
std::wstring fname_w = narrow_to_wide(name);
|
||||
|
||||
FieldSpec spec(
|
||||
fname_w,
|
||||
@@ -820,7 +772,7 @@ void GUIFormSpecMenu::parseTextList(parserData* data,std::string element)
|
||||
|
||||
core::rect<s32> rect = core::rect<s32>(pos.X, pos.Y, pos.X+geom.X, pos.Y+geom.Y);
|
||||
|
||||
std::wstring fname_w = narrow_to_wide(name.c_str());
|
||||
std::wstring fname_w = narrow_to_wide(name);
|
||||
|
||||
FieldSpec spec(
|
||||
fname_w,
|
||||
@@ -885,7 +837,7 @@ void GUIFormSpecMenu::parseDropDown(parserData* data,std::string element)
|
||||
core::rect<s32> rect = core::rect<s32>(pos.X, pos.Y,
|
||||
pos.X + width, pos.Y + (m_btn_height * 2));
|
||||
|
||||
std::wstring fname_w = narrow_to_wide(name.c_str());
|
||||
std::wstring fname_w = narrow_to_wide(name);
|
||||
|
||||
FieldSpec spec(
|
||||
fname_w,
|
||||
@@ -948,10 +900,10 @@ void GUIFormSpecMenu::parsePwdField(parserData* data,std::string element)
|
||||
|
||||
label = unescape_string(label);
|
||||
|
||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
||||
std::wstring wlabel = narrow_to_wide(label);
|
||||
|
||||
FieldSpec spec(
|
||||
narrow_to_wide(name.c_str()),
|
||||
narrow_to_wide(name),
|
||||
wlabel,
|
||||
L"",
|
||||
258+m_fields.size()
|
||||
@@ -966,7 +918,7 @@ void GUIFormSpecMenu::parsePwdField(parserData* data,std::string element)
|
||||
|
||||
if (label.length() >= 1)
|
||||
{
|
||||
int font_height = font_line_height(m_font);
|
||||
int font_height = g_fontengine->getTextHeight();
|
||||
rect.UpperLeftCorner.Y -= font_height;
|
||||
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + font_height;
|
||||
Environment->addStaticText(spec.flabel.c_str(), rect, false, true, this, 0);
|
||||
@@ -1014,12 +966,12 @@ void GUIFormSpecMenu::parseSimpleField(parserData* data,
|
||||
default_val = unescape_string(default_val);
|
||||
label = unescape_string(label);
|
||||
|
||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
||||
std::wstring wlabel = narrow_to_wide(label);
|
||||
|
||||
FieldSpec spec(
|
||||
narrow_to_wide(name.c_str()),
|
||||
narrow_to_wide(name),
|
||||
wlabel,
|
||||
narrow_to_wide(default_val.c_str()),
|
||||
narrow_to_wide(default_val),
|
||||
258+m_fields.size()
|
||||
);
|
||||
|
||||
@@ -1049,7 +1001,7 @@ void GUIFormSpecMenu::parseSimpleField(parserData* data,
|
||||
|
||||
if (label.length() >= 1)
|
||||
{
|
||||
int font_height = font_line_height(m_font);
|
||||
int font_height = g_fontengine->getTextHeight();
|
||||
rect.UpperLeftCorner.Y -= font_height;
|
||||
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + font_height;
|
||||
Environment->addStaticText(spec.flabel.c_str(), rect, false, true, this, 0);
|
||||
@@ -1104,12 +1056,12 @@ void GUIFormSpecMenu::parseTextArea(parserData* data,
|
||||
default_val = unescape_string(default_val);
|
||||
label = unescape_string(label);
|
||||
|
||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
||||
std::wstring wlabel = narrow_to_wide(label);
|
||||
|
||||
FieldSpec spec(
|
||||
narrow_to_wide(name.c_str()),
|
||||
narrow_to_wide(name),
|
||||
wlabel,
|
||||
narrow_to_wide(default_val.c_str()),
|
||||
narrow_to_wide(default_val),
|
||||
258+m_fields.size()
|
||||
);
|
||||
|
||||
@@ -1146,7 +1098,7 @@ void GUIFormSpecMenu::parseTextArea(parserData* data,
|
||||
|
||||
if (label.length() >= 1)
|
||||
{
|
||||
int font_height = font_line_height(m_font);
|
||||
int font_height = g_fontengine->getTextHeight();
|
||||
rect.UpperLeftCorner.Y -= font_height;
|
||||
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + font_height;
|
||||
Environment->addStaticText(spec.flabel.c_str(), rect, false, true, this, 0);
|
||||
@@ -1193,8 +1145,6 @@ void GUIFormSpecMenu::parseLabel(parserData* data,std::string element)
|
||||
if(!data->explicit_size)
|
||||
errorstream<<"WARNING: invalid use of label without a size[] element"<<std::endl;
|
||||
|
||||
int font_height = font_line_height(m_font);
|
||||
|
||||
text = unescape_string(text);
|
||||
std::vector<std::string> lines = split(text, '\n');
|
||||
|
||||
@@ -1209,11 +1159,11 @@ void GUIFormSpecMenu::parseLabel(parserData* data,std::string element)
|
||||
// in the integer cases: 0.4 is not exactly
|
||||
// representable in binary floating point.
|
||||
s32 posy = pos.Y + ((float)i) * spacing.Y * 2.0 / 5.0;
|
||||
std::wstring wlabel = narrow_to_wide(lines[i].c_str());
|
||||
std::wstring wlabel = narrow_to_wide(lines[i]);
|
||||
core::rect<s32> rect = core::rect<s32>(
|
||||
pos.X, posy - font_height,
|
||||
pos.X, posy - m_btn_height,
|
||||
pos.X + m_font->getDimension(wlabel.c_str()).Width,
|
||||
posy + font_height);
|
||||
posy + m_btn_height);
|
||||
FieldSpec spec(
|
||||
L"",
|
||||
wlabel,
|
||||
@@ -1330,12 +1280,12 @@ void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,
|
||||
pressed_image_name = unescape_string(pressed_image_name);
|
||||
label = unescape_string(label);
|
||||
|
||||
std::wstring wlabel = narrow_to_wide(label.c_str());
|
||||
std::wstring wlabel = narrow_to_wide(label);
|
||||
|
||||
FieldSpec spec(
|
||||
narrow_to_wide(name.c_str()),
|
||||
narrow_to_wide(name),
|
||||
wlabel,
|
||||
narrow_to_wide(image_name.c_str()),
|
||||
narrow_to_wide(image_name),
|
||||
258+m_fields.size()
|
||||
);
|
||||
spec.ftype = f_Button;
|
||||
@@ -1395,7 +1345,7 @@ void GUIFormSpecMenu::parseTabHeader(parserData* data,std::string element)
|
||||
}
|
||||
|
||||
FieldSpec spec(
|
||||
narrow_to_wide(name.c_str()),
|
||||
narrow_to_wide(name),
|
||||
L"",
|
||||
L"",
|
||||
258+m_fields.size()
|
||||
@@ -1482,16 +1432,16 @@ void GUIFormSpecMenu::parseItemImageButton(parserData* data,std::string element)
|
||||
item.deSerialize(item_name, idef);
|
||||
video::ITexture *texture = idef->getInventoryTexture(item.getDefinition(idef).name, m_gamedef);
|
||||
|
||||
m_tooltips[narrow_to_wide(name.c_str())] =
|
||||
m_tooltips[narrow_to_wide(name)] =
|
||||
TooltipSpec (item.getDefinition(idef).description,
|
||||
m_default_tooltip_bgcolor,
|
||||
m_default_tooltip_color);
|
||||
|
||||
label = unescape_string(label);
|
||||
FieldSpec spec(
|
||||
narrow_to_wide(name.c_str()),
|
||||
narrow_to_wide(label.c_str()),
|
||||
narrow_to_wide(item_name.c_str()),
|
||||
narrow_to_wide(name),
|
||||
narrow_to_wide(label),
|
||||
narrow_to_wide(item_name),
|
||||
258+m_fields.size()
|
||||
);
|
||||
|
||||
@@ -1601,13 +1551,13 @@ void GUIFormSpecMenu::parseTooltip(parserData* data, std::string element)
|
||||
std::vector<std::string> parts = split(element,';');
|
||||
if (parts.size() == 2) {
|
||||
std::string name = parts[0];
|
||||
m_tooltips[narrow_to_wide(name.c_str())] = TooltipSpec (parts[1], m_default_tooltip_bgcolor, m_default_tooltip_color);
|
||||
m_tooltips[narrow_to_wide(name)] = TooltipSpec (parts[1], m_default_tooltip_bgcolor, m_default_tooltip_color);
|
||||
return;
|
||||
} else if (parts.size() == 4) {
|
||||
std::string name = parts[0];
|
||||
video::SColor tmp_color1, tmp_color2;
|
||||
if ( parseColorString(parts[2], tmp_color1, false) && parseColorString(parts[3], tmp_color2, false) ) {
|
||||
m_tooltips[narrow_to_wide(name.c_str())] = TooltipSpec (parts[1], tmp_color1, tmp_color2);
|
||||
m_tooltips[narrow_to_wide(name)] = TooltipSpec (parts[1], tmp_color1, tmp_color2);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1808,8 +1758,6 @@ void GUIFormSpecMenu::parseElement(parserData* data, std::string element)
|
||||
<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
/* useless to regenerate without a screensize */
|
||||
@@ -1826,6 +1774,10 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
||||
mydata.table_dyndata[tablename] = table->getDynamicData();
|
||||
}
|
||||
|
||||
//set focus
|
||||
if (!m_focused_element.empty())
|
||||
mydata.focused_fieldname = m_focused_element;
|
||||
|
||||
//preserve focus
|
||||
gui::IGUIElement *focused_element = Environment->getFocus();
|
||||
if (focused_element && focused_element->getParent() == this) {
|
||||
@@ -1951,7 +1903,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
||||
// wide, including border) just fit into the
|
||||
// default window (800 pixels wide) at 96 DPI
|
||||
// and default scaling (1.00).
|
||||
use_imgsize = 0.53 * screen_dpi * gui_scaling;
|
||||
use_imgsize = 0.5555 * screen_dpi * gui_scaling;
|
||||
} else {
|
||||
// In variable-size mode, we prefer to make the
|
||||
// inventory image size 1/15 of screen height,
|
||||
@@ -1990,10 +1942,9 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
||||
imgsize = v2s32(use_imgsize, use_imgsize);
|
||||
spacing = v2s32(use_imgsize*5.0/4, use_imgsize*15.0/13);
|
||||
padding = v2s32(use_imgsize*3.0/8, use_imgsize*3.0/8);
|
||||
double target_font_height = use_imgsize*15.0/13 * 0.4;
|
||||
m_btn_height = use_imgsize*15.0/13 * 0.35;
|
||||
|
||||
m_font = select_font_by_line_height(target_font_height);
|
||||
m_font = g_fontengine->getFont();
|
||||
|
||||
mydata.size = v2s32(
|
||||
padding.X*2+spacing.X*(mydata.invsize.X-1.0)+imgsize.X,
|
||||
@@ -2052,7 +2003,7 @@ void GUIFormSpecMenu::regenerateGui(v2u32 screensize)
|
||||
mydata.rect =
|
||||
core::rect<s32>(size.X/2-70, pos.Y,
|
||||
(size.X/2-70)+140, pos.Y + (m_btn_height*2));
|
||||
wchar_t* text = wgettext("Proceed");
|
||||
const wchar_t *text = wgettext("Proceed");
|
||||
Environment->addButton(mydata.rect, this, 257, text);
|
||||
delete[] text;
|
||||
}
|
||||
|
||||
@@ -246,13 +246,20 @@ class GUIFormSpecMenu : public GUIModalMenu
|
||||
m_allowclose = value;
|
||||
}
|
||||
|
||||
void lockSize(bool lock,v2u32 basescreensize=v2u32(0,0)) {
|
||||
void lockSize(bool lock,v2u32 basescreensize=v2u32(0,0))
|
||||
{
|
||||
m_lock = lock;
|
||||
m_lockscreensize = basescreensize;
|
||||
}
|
||||
|
||||
void removeChildren();
|
||||
void setInitialFocus();
|
||||
|
||||
void setFocus(std::wstring elementname)
|
||||
{
|
||||
m_focused_element = elementname;
|
||||
}
|
||||
|
||||
/*
|
||||
Remove and re-add (or reposition) stuff
|
||||
*/
|
||||
@@ -348,6 +355,7 @@ class GUIFormSpecMenu : public GUIModalMenu
|
||||
IFormSource *m_form_src;
|
||||
TextDest *m_text_dst;
|
||||
unsigned int m_formspec_version;
|
||||
std::wstring m_focused_element;
|
||||
|
||||
typedef struct {
|
||||
bool explicit_size;
|
||||
|
||||
@@ -122,7 +122,7 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||
core::rect < s32 > rect(0, 0, 600, 40);
|
||||
rect += topleft + v2s32(25, 3);
|
||||
//gui::IGUIStaticText *t =
|
||||
wchar_t* text = wgettext("Keybindings. (If this menu screws up, remove stuff from minetest.conf)");
|
||||
const wchar_t *text = wgettext("Keybindings. (If this menu screws up, remove stuff from minetest.conf)");
|
||||
Environment->addStaticText(text,
|
||||
rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
@@ -145,8 +145,8 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect < s32 > rect(0, 0, 100, 30);
|
||||
rect += topleft + v2s32(offset.X + 105, offset.Y - 5);
|
||||
wchar_t* text = wgettext(k->key.name());
|
||||
k->button = Environment->addButton(rect, this, k->id, text );
|
||||
const wchar_t *text = wgettext(k->key.name());
|
||||
k->button = Environment->addButton(rect, this, k->id, text);
|
||||
delete[] text;
|
||||
}
|
||||
if(i + 1 == KMaxButtonPerColumns)
|
||||
@@ -156,13 +156,13 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||
}
|
||||
|
||||
{
|
||||
s32 option_x = offset.X + 10;
|
||||
s32 option_y = offset.Y;
|
||||
s32 option_x = offset.X;
|
||||
s32 option_y = offset.Y + 5;
|
||||
u32 option_w = 180;
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w, 30);
|
||||
rect += topleft + v2s32(option_x, option_y);
|
||||
wchar_t* text = wgettext("\"Use\" = climb down");
|
||||
const wchar_t *text = wgettext("\"Use\" = climb down");
|
||||
Environment->addCheckBox(g_settings->getBool("aux1_descends"), rect, this,
|
||||
GUI_ID_CB_AUX1_DESCENDS, text);
|
||||
delete[] text;
|
||||
@@ -171,13 +171,13 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||
}
|
||||
|
||||
{
|
||||
s32 option_x = offset.X + 10;
|
||||
s32 option_y = offset.Y;
|
||||
u32 option_w = 220;
|
||||
s32 option_x = offset.X;
|
||||
s32 option_y = offset.Y + 5;
|
||||
u32 option_w = 280;
|
||||
{
|
||||
core::rect<s32> rect(0, 0, option_w, 30);
|
||||
rect += topleft + v2s32(option_x, option_y);
|
||||
wchar_t* text = wgettext("Double tap \"jump\" to toggle fly");
|
||||
const wchar_t *text = wgettext("Double tap \"jump\" to toggle fly");
|
||||
Environment->addCheckBox(g_settings->getBool("doubletap_jump"), rect, this,
|
||||
GUI_ID_CB_DOUBLETAP_JUMP, text);
|
||||
delete[] text;
|
||||
@@ -188,17 +188,17 @@ void GUIKeyChangeMenu::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect < s32 > rect(0, 0, 100, 30);
|
||||
rect += topleft + v2s32(size.X - 100 - 20, size.Y - 40);
|
||||
wchar_t* text = wgettext("Save");
|
||||
const wchar_t *text = wgettext("Save");
|
||||
Environment->addButton(rect, this, GUI_ID_BACK_BUTTON,
|
||||
text);
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
{
|
||||
core::rect < s32 > rect(0, 0, 100, 30);
|
||||
rect += topleft + v2s32(size.X - 100 - 20 - 100 - 20, size.Y - 40);
|
||||
wchar_t* text = wgettext("Cancel");
|
||||
const wchar_t *text = wgettext("Cancel");
|
||||
Environment->addButton(rect, this, GUI_ID_ABORT_BUTTON,
|
||||
text );
|
||||
text);
|
||||
delete[] text;
|
||||
}
|
||||
}
|
||||
@@ -255,7 +255,7 @@ bool GUIKeyChangeMenu::resetMenu()
|
||||
key_setting *k = key_settings.at(i);
|
||||
if(k->id == activeKey)
|
||||
{
|
||||
wchar_t* text = wgettext(k->key.name());
|
||||
const wchar_t *text = wgettext(k->key.name());
|
||||
k->button->setText(text);
|
||||
delete[] text;
|
||||
break;
|
||||
@@ -293,9 +293,9 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
||||
{
|
||||
core::rect < s32 > rect(0, 0, 600, 40);
|
||||
rect += v2s32(0, 0) + v2s32(25, 30);
|
||||
wchar_t* text = wgettext("Key already in use");
|
||||
const wchar_t *text = wgettext("Key already in use");
|
||||
this->key_used_text = Environment->addStaticText(text,
|
||||
rect, false, true, this, -1);
|
||||
rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
//infostream << "Key already in use" << std::endl;
|
||||
}
|
||||
@@ -313,7 +313,7 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
||||
}
|
||||
assert(k);
|
||||
k->key = kp;
|
||||
wchar_t* text = wgettext(k->key.name());
|
||||
const wchar_t *text = wgettext(k->key.name());
|
||||
k->button->setText(text);
|
||||
delete[] text;
|
||||
|
||||
@@ -368,7 +368,7 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
||||
resetMenu();
|
||||
shift_down = false;
|
||||
activeKey = event.GUIEvent.Caller->getID();
|
||||
wchar_t* text = wgettext("press key");
|
||||
const wchar_t *text = wgettext("press key");
|
||||
k->button->setText(text);
|
||||
delete[] text;
|
||||
this->key_used.erase(std::remove(this->key_used.begin(),
|
||||
@@ -381,7 +381,7 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
|
||||
return Parent ? Parent->OnEvent(event) : false;
|
||||
}
|
||||
|
||||
void GUIKeyChangeMenu::add_key(int id, wchar_t* button_name, std::string setting_name)
|
||||
void GUIKeyChangeMenu::add_key(int id, const wchar_t *button_name, const std::string &setting_name)
|
||||
{
|
||||
key_setting *k = new key_setting;
|
||||
k->id = id;
|
||||
@@ -412,3 +412,4 @@ void GUIKeyChangeMenu::init_keys()
|
||||
this->add_key(GUI_ID_KEY_RANGE_BUTTON, wgettext("Range select"), "keymap_rangeselect");
|
||||
this->add_key(GUI_ID_KEY_DUMP_BUTTON, wgettext("Print stacks"), "keymap_print_debug_stacks");
|
||||
}
|
||||
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
typedef struct {
|
||||
struct key_setting {
|
||||
int id;
|
||||
wchar_t *button_name;
|
||||
const wchar_t *button_name;
|
||||
KeyPress key;
|
||||
std::string setting_name;
|
||||
gui::IGUIButton *button;
|
||||
} key_setting;
|
||||
};
|
||||
|
||||
|
||||
class GUIKeyChangeMenu: public GUIModalMenu
|
||||
@@ -64,7 +64,7 @@ class GUIKeyChangeMenu: public GUIModalMenu
|
||||
|
||||
bool resetMenu();
|
||||
|
||||
void add_key(int id, wchar_t* button_name, std::string setting_name);
|
||||
void add_key(int id, const wchar_t *button_name, const std::string &setting_name);
|
||||
|
||||
bool shift_down;
|
||||
|
||||
|
||||
@@ -96,14 +96,16 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
||||
v2s32 size = rect.getSize();
|
||||
v2s32 topleft_client(40, 0);
|
||||
|
||||
const wchar_t *text;
|
||||
|
||||
/*
|
||||
Add stuff
|
||||
*/
|
||||
s32 ypos = 50;
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 110, 20);
|
||||
rect += topleft_client + v2s32(35, ypos+6);
|
||||
wchar_t* text = wgettext("Old Password");
|
||||
core::rect<s32> rect(0, 0, 150, 20);
|
||||
rect += topleft_client + v2s32(25, ypos+6);
|
||||
text = wgettext("Old Password");
|
||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
@@ -117,9 +119,9 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
||||
}
|
||||
ypos += 50;
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 110, 20);
|
||||
rect += topleft_client + v2s32(35, ypos+6);
|
||||
wchar_t* text = wgettext("New Password");
|
||||
core::rect<s32> rect(0, 0, 150, 20);
|
||||
rect += topleft_client + v2s32(25, ypos+6);
|
||||
text = wgettext("New Password");
|
||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
@@ -132,9 +134,9 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
||||
}
|
||||
ypos += 50;
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 110, 20);
|
||||
rect += topleft_client + v2s32(35, ypos+6);
|
||||
wchar_t* text = wgettext("Confirm Password");
|
||||
core::rect<s32> rect(0, 0, 150, 20);
|
||||
rect += topleft_client + v2s32(25, ypos+6);
|
||||
text = wgettext("Confirm Password");
|
||||
Environment->addStaticText(text, rect, false, true, this, -1);
|
||||
delete[] text;
|
||||
}
|
||||
@@ -150,7 +152,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 140, 30);
|
||||
rect = rect + v2s32(size.X/2-140/2, ypos);
|
||||
wchar_t* text = wgettext("Change");
|
||||
text = wgettext("Change");
|
||||
Environment->addButton(rect, this, ID_change, text);
|
||||
delete[] text;
|
||||
}
|
||||
@@ -159,7 +161,7 @@ void GUIPasswordChange::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 300, 20);
|
||||
rect += topleft_client + v2s32(35, ypos);
|
||||
wchar_t* text = wgettext("Passwords do not match!");
|
||||
text = wgettext("Passwords do not match!");
|
||||
IGUIElement *e =
|
||||
Environment->addStaticText(
|
||||
text,
|
||||
|
||||
@@ -638,10 +638,11 @@ void GUITable::draw()
|
||||
client_clip.UpperLeftCorner.Y += 1;
|
||||
client_clip.UpperLeftCorner.X += 1;
|
||||
client_clip.LowerRightCorner.Y -= 1;
|
||||
client_clip.LowerRightCorner.X -=
|
||||
m_scrollbar->isVisible() ?
|
||||
skin->getSize(gui::EGDS_SCROLLBAR_SIZE) :
|
||||
1;
|
||||
client_clip.LowerRightCorner.X -= 1;
|
||||
if (m_scrollbar->isVisible()) {
|
||||
client_clip.LowerRightCorner.X =
|
||||
m_scrollbar->getAbsolutePosition().UpperLeftCorner.X;
|
||||
}
|
||||
client_clip.clipAgainst(AbsoluteClippingRect);
|
||||
|
||||
// draw visible rows
|
||||
|
||||
@@ -103,7 +103,7 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 120, 20);
|
||||
rect = rect + v2s32(size.X/2-60, size.Y/2-35);
|
||||
wchar_t* text = wgettext("Sound Volume: ");
|
||||
const wchar_t *text = wgettext("Sound Volume: ");
|
||||
Environment->addStaticText(text, rect, false,
|
||||
true, this, ID_soundText1);
|
||||
delete[] text;
|
||||
@@ -117,7 +117,7 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
|
||||
{
|
||||
core::rect<s32> rect(0, 0, 80, 30);
|
||||
rect = rect + v2s32(size.X/2-80/2, size.Y/2+55);
|
||||
wchar_t* text = wgettext("Exit");
|
||||
const wchar_t *text = wgettext("Exit");
|
||||
Environment->addButton(rect, this, ID_soundExitButton,
|
||||
text);
|
||||
delete[] text;
|
||||
|
||||
64
src/hud.cpp
64
src/hud.cpp
@@ -51,29 +51,29 @@ Hud::Hud(video::IVideoDriver *driver, scene::ISceneManager* smgr,
|
||||
m_screensize = v2u32(0, 0);
|
||||
m_displaycenter = v2s32(0, 0);
|
||||
m_hotbar_imagesize = floor(HOTBAR_IMAGE_SIZE * porting::getDisplayDensity() + 0.5);
|
||||
m_hotbar_imagesize *= g_settings->getFloat("gui_scaling");
|
||||
m_hotbar_imagesize *= g_settings->getFloat("hud_scaling");
|
||||
m_padding = m_hotbar_imagesize / 12;
|
||||
|
||||
const video::SColor hbar_color(255, 255, 255, 255);
|
||||
for (unsigned int i=0; i < 4; i++ ){
|
||||
hbar_colors[i] = hbar_color;
|
||||
}
|
||||
|
||||
|
||||
tsrc = gamedef->getTextureSource();
|
||||
|
||||
|
||||
v3f crosshair_color = g_settings->getV3F("crosshair_color");
|
||||
u32 cross_r = rangelim(myround(crosshair_color.X), 0, 255);
|
||||
u32 cross_g = rangelim(myround(crosshair_color.Y), 0, 255);
|
||||
u32 cross_b = rangelim(myround(crosshair_color.Z), 0, 255);
|
||||
u32 cross_a = rangelim(g_settings->getS32("crosshair_alpha"), 0, 255);
|
||||
crosshair_argb = video::SColor(cross_a, cross_r, cross_g, cross_b);
|
||||
|
||||
|
||||
v3f selectionbox_color = g_settings->getV3F("selectionbox_color");
|
||||
u32 sbox_r = rangelim(myround(selectionbox_color.X), 0, 255);
|
||||
u32 sbox_g = rangelim(myround(selectionbox_color.Y), 0, 255);
|
||||
u32 sbox_b = rangelim(myround(selectionbox_color.Z), 0, 255);
|
||||
selectionbox_argb = video::SColor(255, sbox_r, sbox_g, sbox_b);
|
||||
|
||||
|
||||
use_crosshair_image = tsrc->isKnownSourceImage("crosshair.png");
|
||||
|
||||
hotbar_image = "";
|
||||
@@ -244,7 +244,7 @@ void Hud::drawLuaElements(v3s16 camera_offset) {
|
||||
HudElement *e = player->getHud(i);
|
||||
if (!e)
|
||||
continue;
|
||||
|
||||
|
||||
v2s32 pos(floor(e->pos.X * (float) m_screensize.X + 0.5),
|
||||
floor(e->pos.Y * (float) m_screensize.Y + 0.5));
|
||||
switch (e->type) {
|
||||
@@ -331,26 +331,22 @@ void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, std::string texture,
|
||||
{
|
||||
const video::SColor color(255, 255, 255, 255);
|
||||
const video::SColor colors[] = {color, color, color, color};
|
||||
|
||||
|
||||
video::ITexture *stat_texture = tsrc->getTexture(texture);
|
||||
if (!stat_texture)
|
||||
return;
|
||||
|
||||
|
||||
core::dimension2di srcd(stat_texture->getOriginalSize());
|
||||
core::dimension2di dstd;
|
||||
if (size == v2s32()) {
|
||||
dstd = srcd;
|
||||
} else {
|
||||
dstd.Height = size.Y * g_settings->getFloat("gui_scaling") *
|
||||
porting::getDisplayDensity();
|
||||
dstd.Width = size.X * g_settings->getFloat("gui_scaling") *
|
||||
porting::getDisplayDensity();
|
||||
|
||||
offset.X *= g_settings->getFloat("gui_scaling") *
|
||||
porting::getDisplayDensity();
|
||||
|
||||
offset.Y *= g_settings->getFloat("gui_scaling") *
|
||||
double size_factor = g_settings->getFloat("hud_scaling") *
|
||||
porting::getDisplayDensity();
|
||||
dstd.Height = size.Y * size_factor;
|
||||
dstd.Width = size.X * size_factor;
|
||||
offset.X *= size_factor;
|
||||
offset.Y *= size_factor;
|
||||
}
|
||||
|
||||
v2s32 p = pos;
|
||||
@@ -375,7 +371,7 @@ void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, std::string texture,
|
||||
}
|
||||
steppos.X *= dstd.Width;
|
||||
steppos.Y *= dstd.Height;
|
||||
|
||||
|
||||
for (s32 i = 0; i < count / 2; i++)
|
||||
{
|
||||
core::rect<s32> srcrect(0, 0, srcd.Width, srcd.Height);
|
||||
@@ -385,7 +381,7 @@ void Hud::drawStatbar(v2s32 pos, u16 corner, u16 drawdir, std::string texture,
|
||||
driver->draw2DImage(stat_texture, dstrect, srcrect, NULL, colors, true);
|
||||
p += steppos;
|
||||
}
|
||||
|
||||
|
||||
if (count % 2 == 1)
|
||||
{
|
||||
core::rect<s32> srcrect(0, 0, srcd.Width / 2, srcd.Height);
|
||||
@@ -406,7 +402,7 @@ void Hud::drawHotbar(u16 playeritem) {
|
||||
//silently ignore this we may not be initialized completely
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
s32 hotbar_itemcount = player->hud_hotbar_itemcount;
|
||||
s32 width = hotbar_itemcount * (m_hotbar_imagesize + m_padding * 2);
|
||||
v2s32 pos = centerlowerpos - v2s32(width / 2, m_hotbar_imagesize + m_padding * 3);
|
||||
@@ -432,24 +428,26 @@ void Hud::drawHotbar(u16 playeritem) {
|
||||
//////////////////////////// compatibility code to be removed //////////////
|
||||
// this is ugly as hell but there's no other way to keep compatibility to
|
||||
// old servers
|
||||
if ( player->hud_flags & HUD_FLAG_HEALTHBAR_VISIBLE)
|
||||
drawStatbar(v2s32(floor(0.5 * (float) m_screensize.X + 0.5),
|
||||
floor(1 * (float) m_screensize.Y + 0.5)),
|
||||
HUD_CORNER_UPPER, 0, "heart.png",
|
||||
player->hp, v2s32((-10*24)-25,-(48+24+10)), v2s32(24,24));
|
||||
if ((player->hud_flags & HUD_FLAG_HEALTHBAR_VISIBLE)) {
|
||||
drawStatbar(v2s32(floor(0.5 * (float)m_screensize.X + 0.5),
|
||||
floor(1 * (float) m_screensize.Y + 0.5)),
|
||||
HUD_CORNER_UPPER, 0, "heart.png",
|
||||
player->hp, v2s32((-10*24)-25,-(48+24+10)), v2s32(24,24));
|
||||
}
|
||||
|
||||
if ((player->hud_flags & HUD_FLAG_BREATHBAR_VISIBLE) &&
|
||||
(player->getBreath() < 11))
|
||||
drawStatbar(v2s32(floor(0.5 * (float) m_screensize.X + 0.5),
|
||||
floor(1 * (float) m_screensize.Y + 0.5)),
|
||||
HUD_CORNER_UPPER, 0, "heart.png",
|
||||
player->getBreath(), v2s32(25,-(48+24+10)), v2s32(24,24));
|
||||
(player->getBreath() < 11)) {
|
||||
drawStatbar(v2s32(floor(0.5 * (float)m_screensize.X + 0.5),
|
||||
floor(1 * (float) m_screensize.Y + 0.5)),
|
||||
HUD_CORNER_UPPER, 0, "bubble.png",
|
||||
player->getBreath(), v2s32(25,-(48+24+10)), v2s32(24,24));
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
|
||||
|
||||
void Hud::drawCrosshair() {
|
||||
|
||||
|
||||
if (use_crosshair_image) {
|
||||
video::ITexture *crosshair = tsrc->getTexture("crosshair.png");
|
||||
v2u32 size = crosshair->getOriginalSize();
|
||||
@@ -479,7 +477,7 @@ void Hud::drawSelectionBoxes(std::vector<aabb3f> &hilightboxes) {
|
||||
void Hud::resizeHotbar() {
|
||||
if (m_screensize != porting::getWindowSize()) {
|
||||
m_hotbar_imagesize = floor(HOTBAR_IMAGE_SIZE * porting::getDisplayDensity() + 0.5);
|
||||
m_hotbar_imagesize *= g_settings->getFloat("gui_scaling");
|
||||
m_hotbar_imagesize *= g_settings->getFloat("hud_scaling");
|
||||
m_padding = m_hotbar_imagesize / 12;
|
||||
m_screensize = porting::getWindowSize();
|
||||
m_displaycenter = v2s32(m_screensize.X/2,m_screensize.Y/2);
|
||||
@@ -495,7 +493,7 @@ void drawItemStack(video::IVideoDriver *driver,
|
||||
{
|
||||
if(item.empty())
|
||||
return;
|
||||
|
||||
|
||||
const ItemDefinition &def = item.getDefinition(gamedef->idef());
|
||||
video::ITexture *texture = gamedef->idef()->getInventoryTexture(def.name, gamedef);
|
||||
|
||||
|
||||
@@ -727,9 +727,9 @@ void ICraftAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGam
|
||||
ItemStack crafted;
|
||||
ItemStack craftresultitem;
|
||||
int count_remaining = count;
|
||||
bool found = getCraftingResult(inv_craft, crafted, false, gamedef);
|
||||
getCraftingResult(inv_craft, crafted, false, gamedef);
|
||||
PLAYER_TO_SA(player)->item_CraftPredict(crafted, player, list_craft, craft_inv);
|
||||
found = !crafted.empty();
|
||||
bool found = !crafted.empty();
|
||||
|
||||
while(found && list_craftresult->itemFits(0, crafted))
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#elif __MACH__
|
||||
#elif defined(__MACH__) && defined(__APPLE__)
|
||||
#include <mach/mach.h>
|
||||
#include <mach/task.h>
|
||||
#include <mach/semaphore.h>
|
||||
@@ -43,7 +43,7 @@
|
||||
class Event {
|
||||
#ifdef _WIN32
|
||||
HANDLE hEvent;
|
||||
#elif __MACH__
|
||||
#elif defined(__MACH__) && defined(__APPLE__)
|
||||
semaphore_t sem;
|
||||
#else
|
||||
sem_t sem;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user