Merge branch 'master' of https://github.com/supertuxkart/stk-code
This commit is contained in:
commit
170e4be0ca
@ -40,6 +40,7 @@ export SOUND_SAMPLE_DEFAULT=32000
|
||||
export RUN_OPTIMIZE_SCRIPT_DEFAULT=0
|
||||
export DECREASE_QUALITY_DEFAULT=1
|
||||
export CONVERT_TO_JPG_DEFAULT=1
|
||||
export ONLY_ASSETS_DEFAULT=0
|
||||
|
||||
export ASSETS_PATHS="../data \
|
||||
../../stk-assets \
|
||||
@ -106,6 +107,10 @@ if [ -z "$CONVERT_TO_JPG" ]; then
|
||||
export CONVERT_TO_JPG="$CONVERT_TO_JPG_DEFAULT"
|
||||
fi
|
||||
|
||||
if [ -z "$ONLY_ASSETS" ]; then
|
||||
export ONLY_ASSETS=$ONLY_ASSETS_DEFAULT
|
||||
fi
|
||||
|
||||
# Find assets path
|
||||
for ASSETS_PATH in $ASSETS_PATHS; do
|
||||
if [ -d $ASSETS_PATH ] && [ `ls $ASSETS_PATH | grep -c tracks` -gt 0 ]; then
|
||||
@ -641,8 +646,10 @@ fi
|
||||
|
||||
|
||||
# Copy data directory
|
||||
echo "Copy data directory"
|
||||
cp -a ../data/* assets/data/
|
||||
if [ $ONLY_ASSETS -eq 0 ]; then
|
||||
echo "Copy data directory"
|
||||
cp -a ../data/* assets/data/
|
||||
fi
|
||||
|
||||
|
||||
# Remove unused files
|
||||
@ -664,6 +671,9 @@ find assets/* -type d | sort > assets/directories.txt
|
||||
sed -i s/'.\/assets\/'// assets/directories.txt
|
||||
sed -i s/'assets\/'// assets/directories.txt
|
||||
|
||||
# A file that can be used to check if apk has assets
|
||||
echo "has_assets" > assets/has_assets.txt
|
||||
|
||||
|
||||
# It will be probably ignored by ant, but create it anyway...
|
||||
touch assets/.nomedia
|
||||
|
@ -350,7 +350,7 @@ if [ ! -f "$DIRNAME/obj/harfbuzz.stamp" ]; then
|
||||
|
||||
cd "$DIRNAME/obj/harfbuzz"
|
||||
FREETYPE_CFLAGS="-I$DIRNAME/obj/freetype/include" \
|
||||
FREETYPE_LIBS="$DIRNAME/obj/freetype/objs/.libs/libfreetype.a $DIRNAME/obj/zlib/libz.a $DIRNAME/obj/libpng/libpng.a"\
|
||||
FREETYPE_LIBS="$DIRNAME/obj/freetype/objs/.libs/libfreetype.a $DIRNAME/obj/libpng/libpng.a $DIRNAME/obj/zlib/libz.a"\
|
||||
./configure --host=$HOST --enable-shared=no \
|
||||
--with-glib=no --with-gobject=no --with-cairo=no \
|
||||
--with-fontconfig=no --with-icu=no --with-graphite2=no &&
|
||||
|
357
data/po/ar.po
357
data/po/ar.po
File diff suppressed because it is too large
Load Diff
395
data/po/be.po
395
data/po/be.po
File diff suppressed because it is too large
Load Diff
361
data/po/bg.po
361
data/po/bg.po
File diff suppressed because it is too large
Load Diff
357
data/po/br.po
357
data/po/br.po
File diff suppressed because it is too large
Load Diff
359
data/po/bs.po
359
data/po/bs.po
File diff suppressed because it is too large
Load Diff
363
data/po/ca.po
363
data/po/ca.po
File diff suppressed because it is too large
Load Diff
359
data/po/cs.po
359
data/po/cs.po
File diff suppressed because it is too large
Load Diff
361
data/po/da.po
361
data/po/da.po
File diff suppressed because it is too large
Load Diff
361
data/po/de.po
361
data/po/de.po
File diff suppressed because it is too large
Load Diff
359
data/po/el.po
359
data/po/el.po
File diff suppressed because it is too large
Load Diff
361
data/po/en.po
361
data/po/en.po
File diff suppressed because it is too large
Load Diff
367
data/po/en_AU.po
367
data/po/en_AU.po
File diff suppressed because it is too large
Load Diff
367
data/po/en_GB.po
367
data/po/en_GB.po
File diff suppressed because it is too large
Load Diff
357
data/po/eo.po
357
data/po/eo.po
File diff suppressed because it is too large
Load Diff
363
data/po/es.po
363
data/po/es.po
File diff suppressed because it is too large
Load Diff
359
data/po/eu.po
359
data/po/eu.po
File diff suppressed because it is too large
Load Diff
367
data/po/fa.po
367
data/po/fa.po
File diff suppressed because it is too large
Load Diff
359
data/po/fi.po
359
data/po/fi.po
File diff suppressed because it is too large
Load Diff
371
data/po/fr.po
371
data/po/fr.po
File diff suppressed because it is too large
Load Diff
367
data/po/fr_CA.po
367
data/po/fr_CA.po
File diff suppressed because it is too large
Load Diff
353
data/po/ga.po
353
data/po/ga.po
File diff suppressed because it is too large
Load Diff
435
data/po/gd.po
435
data/po/gd.po
File diff suppressed because it is too large
Load Diff
357
data/po/gl.po
357
data/po/gl.po
File diff suppressed because it is too large
Load Diff
359
data/po/he.po
359
data/po/he.po
File diff suppressed because it is too large
Load Diff
369
data/po/hr.po
369
data/po/hr.po
File diff suppressed because it is too large
Load Diff
369
data/po/hu.po
369
data/po/hu.po
File diff suppressed because it is too large
Load Diff
367
data/po/ia.po
367
data/po/ia.po
File diff suppressed because it is too large
Load Diff
359
data/po/id.po
359
data/po/id.po
File diff suppressed because it is too large
Load Diff
367
data/po/is.po
367
data/po/is.po
File diff suppressed because it is too large
Load Diff
371
data/po/it.po
371
data/po/it.po
File diff suppressed because it is too large
Load Diff
359
data/po/ja.po
359
data/po/ja.po
File diff suppressed because it is too large
Load Diff
371
data/po/jbo.po
371
data/po/jbo.po
File diff suppressed because it is too large
Load Diff
367
data/po/ko.po
367
data/po/ko.po
File diff suppressed because it is too large
Load Diff
357
data/po/krl.po
357
data/po/krl.po
File diff suppressed because it is too large
Load Diff
357
data/po/kw.po
357
data/po/kw.po
File diff suppressed because it is too large
Load Diff
357
data/po/ky.po
357
data/po/ky.po
File diff suppressed because it is too large
Load Diff
357
data/po/la.po
357
data/po/la.po
File diff suppressed because it is too large
Load Diff
390
data/po/lt.po
390
data/po/lt.po
File diff suppressed because it is too large
Load Diff
357
data/po/lv.po
357
data/po/lv.po
File diff suppressed because it is too large
Load Diff
367
data/po/mn_MN.po
367
data/po/mn_MN.po
File diff suppressed because it is too large
Load Diff
357
data/po/nb.po
357
data/po/nb.po
File diff suppressed because it is too large
Load Diff
368
data/po/nl.po
368
data/po/nl.po
File diff suppressed because it is too large
Load Diff
359
data/po/nn.po
359
data/po/nn.po
File diff suppressed because it is too large
Load Diff
367
data/po/oc.po
367
data/po/oc.po
File diff suppressed because it is too large
Load Diff
367
data/po/os.po
367
data/po/os.po
File diff suppressed because it is too large
Load Diff
381
data/po/pl.po
381
data/po/pl.po
File diff suppressed because it is too large
Load Diff
367
data/po/pms.po
367
data/po/pms.po
File diff suppressed because it is too large
Load Diff
359
data/po/pt.po
359
data/po/pt.po
File diff suppressed because it is too large
Load Diff
363
data/po/pt_BR.po
363
data/po/pt_BR.po
File diff suppressed because it is too large
Load Diff
357
data/po/ro.po
357
data/po/ro.po
File diff suppressed because it is too large
Load Diff
357
data/po/ru.po
357
data/po/ru.po
File diff suppressed because it is too large
Load Diff
367
data/po/sc.po
367
data/po/sc.po
File diff suppressed because it is too large
Load Diff
367
data/po/sco.po
367
data/po/sco.po
File diff suppressed because it is too large
Load Diff
359
data/po/sk.po
359
data/po/sk.po
File diff suppressed because it is too large
Load Diff
357
data/po/sl.po
357
data/po/sl.po
File diff suppressed because it is too large
Load Diff
369
data/po/sq.po
369
data/po/sq.po
File diff suppressed because it is too large
Load Diff
359
data/po/sr.po
359
data/po/sr.po
File diff suppressed because it is too large
Load Diff
359
data/po/sv.po
359
data/po/sv.po
File diff suppressed because it is too large
Load Diff
359
data/po/sw.po
359
data/po/sw.po
File diff suppressed because it is too large
Load Diff
379
data/po/th.po
379
data/po/th.po
File diff suppressed because it is too large
Load Diff
361
data/po/tr.po
361
data/po/tr.po
File diff suppressed because it is too large
Load Diff
357
data/po/tt.po
357
data/po/tt.po
File diff suppressed because it is too large
Load Diff
359
data/po/uk.po
359
data/po/uk.po
File diff suppressed because it is too large
Load Diff
367
data/po/uz.po
367
data/po/uz.po
File diff suppressed because it is too large
Load Diff
357
data/po/vi.po
357
data/po/vi.po
File diff suppressed because it is too large
Load Diff
391
data/po/zh_CN.po
391
data/po/zh_CN.po
File diff suppressed because it is too large
Load Diff
359
data/po/zh_TW.po
359
data/po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@ -254,6 +254,8 @@ void MusicInformation::update(float dt)
|
||||
float fraction=m_time_since_faster/m_faster_time;
|
||||
m_normal_music->setVolume(1-fraction);
|
||||
m_fast_music->setVolume(fraction);
|
||||
m_normal_music->update();
|
||||
m_fast_music->update();
|
||||
break;
|
||||
}
|
||||
case SOUND_FASTER: {
|
||||
|
@ -235,14 +235,14 @@ bool MusicOggStream::pauseMusic()
|
||||
//-----------------------------------------------------------------------------
|
||||
bool MusicOggStream::resumeMusic()
|
||||
{
|
||||
m_playing.store(true);
|
||||
|
||||
if (m_fileName == "")
|
||||
{
|
||||
// nothing is loaded
|
||||
return true;
|
||||
}
|
||||
|
||||
m_playing.store(true);
|
||||
|
||||
alSourcePlay(m_soundSource);
|
||||
m_pausedMusic= false;
|
||||
return true;
|
||||
|
@ -231,17 +231,21 @@ void AssetsAndroid::init()
|
||||
{
|
||||
m_progress_bar = new ProgressBarAndroid();
|
||||
m_progress_bar->draw(0.01f);
|
||||
|
||||
if (hasAssets())
|
||||
{
|
||||
removeData();
|
||||
extractData();
|
||||
|
||||
removeData();
|
||||
extractData();
|
||||
if (!m_file_manager->fileExists(m_stk_dir + "/.extracted"))
|
||||
{
|
||||
Log::fatal("AssetsAndroid", "Fatal error: Assets were not "
|
||||
"extracted properly");
|
||||
}
|
||||
}
|
||||
|
||||
delete m_progress_bar;
|
||||
|
||||
if (!m_file_manager->fileExists(m_stk_dir + "/.extracted"))
|
||||
{
|
||||
Log::fatal("AssetsAndroid", "Fatal error: Assets were not "
|
||||
"extracted properly");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -513,11 +517,18 @@ void AssetsAndroid::removeData()
|
||||
|
||||
if (!data_path.empty())
|
||||
{
|
||||
const std::string child_path = data_path + "/files/libchildprocess.so";
|
||||
|
||||
if (m_file_manager->fileExists(child_path))
|
||||
const std::vector<std::string> child_paths =
|
||||
{
|
||||
Log::info("AssetsAndroid", "Deleting old libchildprocess: %s",
|
||||
data_path + "/files/libchildprocess.so",
|
||||
data_path + "/files/libchildprocess_ai.so"
|
||||
};
|
||||
|
||||
for (auto child_path : child_paths)
|
||||
{
|
||||
if (!m_file_manager->fileExists(child_path))
|
||||
continue;
|
||||
|
||||
Log::info("AssetsAndroid", "Deleting old childprocess: %s",
|
||||
child_path.c_str());
|
||||
m_file_manager->removeFile(child_path);
|
||||
}
|
||||
@ -525,6 +536,32 @@ void AssetsAndroid::removeData()
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** A function that checks if assets are included in the package
|
||||
* \return true if apk has assets
|
||||
*/
|
||||
bool AssetsAndroid::hasAssets()
|
||||
{
|
||||
#ifdef ANDROID
|
||||
AAssetManager* amgr = global_android_app->activity->assetManager;
|
||||
|
||||
AAsset* asset = AAssetManager_open(amgr, "has_assets.txt",
|
||||
AASSET_MODE_STREAMING);
|
||||
|
||||
if (asset == NULL)
|
||||
{
|
||||
Log::info("AssetsAndroid", "Package doesn't have assets");
|
||||
return false;
|
||||
}
|
||||
|
||||
Log::info("AssetsAndroid", "Package has assets");
|
||||
AAsset_close(asset);
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** A function that creates empty file
|
||||
* \param path A path to the file that should be created
|
||||
@ -622,15 +659,18 @@ std::string AssetsAndroid::getDataPath()
|
||||
{
|
||||
Log::warn("AssetsAndroid", "Cannot use standard data dir");
|
||||
|
||||
AndroidApplicationInfo application_info =
|
||||
CIrrDeviceAndroid::getApplicationInfo(global_android_app->activity);
|
||||
if (global_android_activity)
|
||||
{
|
||||
AndroidApplicationInfo application_info =
|
||||
CIrrDeviceAndroid::getApplicationInfo(global_android_activity);
|
||||
|
||||
data_path = application_info.data_dir;
|
||||
}
|
||||
|
||||
data_path = application_info.data_dir;
|
||||
}
|
||||
|
||||
if (access(data_path.c_str(), R_OK) != 0)
|
||||
{
|
||||
data_path = "";
|
||||
if (access(data_path.c_str(), R_OK) != 0)
|
||||
{
|
||||
data_path = "";
|
||||
}
|
||||
}
|
||||
|
||||
return data_path;
|
||||
@ -646,10 +686,15 @@ std::string AssetsAndroid::getDataPath()
|
||||
std::string AssetsAndroid::getLibPath()
|
||||
{
|
||||
#ifdef ANDROID
|
||||
AndroidApplicationInfo application_info =
|
||||
CIrrDeviceAndroid::getApplicationInfo(global_android_app->activity);
|
||||
|
||||
std::string lib_path = application_info.native_lib_dir;
|
||||
std::string lib_path;
|
||||
|
||||
if (global_android_activity)
|
||||
{
|
||||
AndroidApplicationInfo application_info =
|
||||
CIrrDeviceAndroid::getApplicationInfo(global_android_activity);
|
||||
|
||||
lib_path = application_info.native_lib_dir;
|
||||
}
|
||||
|
||||
if (access(lib_path.c_str(), R_OK) != 0)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ private:
|
||||
void extractData();
|
||||
bool extractDir(std::string dir_name);
|
||||
void removeData();
|
||||
bool hasAssets();
|
||||
void touchFile(std::string path);
|
||||
bool isWritable(std::string path);
|
||||
std::string getPreferredPath(const std::vector<std::string>& paths);
|
||||
|
@ -1362,6 +1362,8 @@ int handleCmdLine(bool has_server_config, bool has_parent_process)
|
||||
NetworkConfig::get()->setIsServer(false);
|
||||
if (CommandLine::has("--network-ai", &n))
|
||||
{
|
||||
// We need an existing current player
|
||||
PlayerManager::get()->enforceCurrentPlayer();
|
||||
NetworkConfig::get()->setNetworkAITester(true);
|
||||
PlayerManager::get()->createGuestPlayers(n);
|
||||
for (int i = 0; i < n; i++)
|
||||
@ -1898,6 +1900,7 @@ void askForInternetPermission()
|
||||
if (need_to_start_news_manager)
|
||||
NewsManager::get()->init(false);
|
||||
#endif
|
||||
user_config->saveConfig();
|
||||
GUIEngine::ModalDialog::dismiss();
|
||||
} // onConfirm
|
||||
// --------------------------------------------------------
|
||||
|
@ -27,7 +27,16 @@
|
||||
|
||||
extern int main(int argc, char *argv[]);
|
||||
|
||||
struct android_app* global_android_app;
|
||||
struct android_app* global_android_app = NULL;
|
||||
ANativeActivity* global_android_activity = NULL;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void set_global_android_activity(ANativeActivity* activity)
|
||||
{
|
||||
global_android_activity = activity;
|
||||
}
|
||||
}
|
||||
|
||||
void override_default_params_for_mobile()
|
||||
{
|
||||
@ -92,6 +101,7 @@ void android_main(struct android_app* app)
|
||||
Log::info("AndroidMain", "Loading application...");
|
||||
|
||||
global_android_app = app;
|
||||
global_android_activity = app->activity;
|
||||
|
||||
// Initialize global Android window state variables
|
||||
CIrrDeviceAndroid::onCreate();
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "../../../lib/irrlicht/source/Irrlicht/stk_android_native_app_glue.h"
|
||||
|
||||
extern struct android_app* global_android_app;
|
||||
|
||||
extern ANativeActivity* global_android_activity;
|
||||
#endif
|
||||
|
||||
#endif
|
@ -199,6 +199,14 @@ void World::init()
|
||||
// This also defines the static Track::getCurrentTrack function.
|
||||
track->loadTrackModel(race_manager->getReverseTrack());
|
||||
|
||||
// Shuffles the start transforms with playing 3-strikes or free for all battles.
|
||||
if ((race_manager->getMinorMode() == RaceManager::MINOR_MODE_3_STRIKES ||
|
||||
race_manager->getMinorMode() == RaceManager::MINOR_MODE_FREE_FOR_ALL) &&
|
||||
!NetworkConfig::get()->isNetworking())
|
||||
{
|
||||
track->shuffleStartTransforms();
|
||||
}
|
||||
|
||||
main_loop->renderGUI(6998);
|
||||
if (gk > 0)
|
||||
{
|
||||
|
@ -253,6 +253,7 @@ namespace Online
|
||||
m_online_state = OS_SIGNED_IN;
|
||||
if(rememberPassword())
|
||||
{
|
||||
setWasOnlineLastTime(true);
|
||||
saveSession(getOnlineId(), getToken());
|
||||
}
|
||||
|
||||
@ -427,7 +428,7 @@ namespace Online
|
||||
OnlineProfile::RelationInfo * relation_info =
|
||||
profile->getRelationInfo();
|
||||
|
||||
if (relation_info->isOnline())
|
||||
if (relation_info && relation_info->isOnline())
|
||||
{
|
||||
if (!now_online) // the friend went offline
|
||||
{
|
||||
@ -435,7 +436,7 @@ namespace Online
|
||||
went_offline = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (relation_info)
|
||||
{
|
||||
if (now_online) // friend came online
|
||||
{
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "states_screens/dialogs/kart_color_slider_dialog.hpp"
|
||||
|
||||
#include "config/player_manager.hpp"
|
||||
#include "config/player_profile.hpp"
|
||||
#include "config/user_config.hpp"
|
||||
#include "karts/kart_model.hpp"
|
||||
@ -71,6 +72,7 @@ KartColorSliderDialog::KartColorSliderDialog(PlayerProfile* pp)
|
||||
// ----------------------------------------------------------------------------
|
||||
KartColorSliderDialog::~KartColorSliderDialog()
|
||||
{
|
||||
PlayerManager::get()->save();
|
||||
} // ~KartColorSliderDialog
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
||||
@ -517,6 +518,13 @@ public:
|
||||
return m_start_transforms[index];
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Shuffles the start transformations
|
||||
*/
|
||||
void shuffleStartTransforms()
|
||||
{
|
||||
std::random_shuffle(m_start_transforms.begin(), m_start_transforms.end());
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Sets pointer to the aabb of this track. */
|
||||
void getAABB(const Vec3 **min, const Vec3 **max) const
|
||||
{ *min = &m_aabb_min; *max = &m_aabb_max; }
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <dlfcn.h>
|
||||
#include <fstream>
|
||||
|
||||
#include "main_android.hpp"
|
||||
#include "io/assets_android.hpp"
|
||||
#endif
|
||||
|
||||
@ -387,6 +388,21 @@ bool SeparateProcess::createChildProcess(const std::string& exe,
|
||||
m_child_handle = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef void (*set_activity_proc_t)(ANativeActivity*);
|
||||
set_activity_proc_t set_activity_proc =
|
||||
(set_activity_proc_t)dlsym(m_child_handle, "set_global_android_activity");
|
||||
|
||||
if (set_activity_proc == NULL)
|
||||
{
|
||||
Log::error("SeparateProcess", "Error: Cannot get handle to "
|
||||
"set_global_android_activity()");
|
||||
dlclose(m_child_handle);
|
||||
m_child_handle = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
set_activity_proc(global_android_activity);
|
||||
|
||||
const std::string exe_file = StringUtils::getBasename(exe);
|
||||
auto rest_argv = StringUtils::split(argument, ' ');
|
||||
|
@ -113,6 +113,44 @@ generate_assets()
|
||||
cd -
|
||||
}
|
||||
|
||||
generate_full_assets()
|
||||
{
|
||||
echo "Generate zip file with full assets"
|
||||
|
||||
if [ -f "./android-output/stk-assets.zip" ]; then
|
||||
echo "Full assets already found in ./android-output/stk-assets.zip"
|
||||
return
|
||||
fi
|
||||
|
||||
cp -a ./android/generate_assets.sh ./android-output/
|
||||
|
||||
cd ./android-output/
|
||||
|
||||
ONLY_ASSETS=1 \
|
||||
TRACKS="all" \
|
||||
TEXTURE_SIZE=512 \
|
||||
JPEG_QUALITY=95 \
|
||||
PNG_QUALITY=95 \
|
||||
PNGQUANT_QUALITY=95 \
|
||||
SOUND_QUALITY=112 \
|
||||
SOUND_MONO=0 \
|
||||
SOUND_SAMPLE=44100 \
|
||||
./generate_assets.sh
|
||||
|
||||
if [ ! -f "./assets/directories.txt" ]; then
|
||||
echo "Error: Couldn't generate assets"
|
||||
return
|
||||
fi
|
||||
|
||||
cd ./assets/data
|
||||
zip -r ../../stk-assets.zip ./*
|
||||
cd ../../
|
||||
|
||||
rm ./generate_assets.sh
|
||||
|
||||
cd ../
|
||||
}
|
||||
|
||||
build_package()
|
||||
{
|
||||
export ARCH1=$1
|
||||
@ -195,3 +233,6 @@ PROJECT_CODE=$(($PROJECT_CODE + 1))
|
||||
if [ -z "$1" ] || [ "$1" = "x86_64" ]; then
|
||||
build_package x86_64 x86_64
|
||||
fi
|
||||
|
||||
# Generate zip file with full assets
|
||||
generate_full_assets
|
||||
|
Loading…
x
Reference in New Issue
Block a user