diff --git a/project/jni/application/opentyrian/AndroidAppSettings.cfg b/project/jni/application/opentyrian/AndroidAppSettings.cfg index c32f88c9a..af61f84b1 100644 --- a/project/jni/application/opentyrian/AndroidAppSettings.cfg +++ b/project/jni/application/opentyrian/AndroidAppSettings.cfg @@ -18,7 +18,7 @@ AppVersionName="2.1.24" # If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - # these files are put inside .apk package by build system # Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS -AppDataDownloadUrl="Data files size is 11 Mb|tyrian21-data.zip|http://sourceforge.net/projects/libsdl-android/files/OpenTyrian/tyrian21-data.zip/download|http://sites.google.com/site/xpelyax/Home/tyrian21-data.zip?attredirects=0&d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/tyrian21-data.zip" +AppDataDownloadUrl="!!Data files size is 11 Mb|tyrian21-data.zip^!!Tutorial|tutorial.zip" # Reset SDL config when updating application to the new version (y) / (n) ResetSdlConfigForThisVersion=y @@ -144,7 +144,7 @@ AppUsesGyroscope=n MoveMouseWithGyroscope= # Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 -AppUsesMultitouch=y +AppUsesMultitouch=n # Application records audio (it will use any available source, such a s microphone) # API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); @@ -208,7 +208,7 @@ FirstStartMenuOptions='' # Specify architectures to compile, 'all' or 'y' to compile for all architectures. # Available architectures: armeabi armeabi-v7a armeabi-v7a-hard x86 mips -MultiABI='armeabi-v7a' +MultiABI='all' # Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower AppMinimumRAM=0 @@ -216,7 +216,7 @@ AppMinimumRAM=0 # Optional shared libraries to compile - removing some of them will save space # MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed # Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 -CompiledLibraries="sdl_net" +CompiledLibraries="sdl_net sdl_image" # Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) CustomBuildScript=n diff --git a/project/jni/application/opentyrian/AndroidData/tutorial.zip b/project/jni/application/opentyrian/AndroidData/tutorial.zip new file mode 100644 index 000000000..d8741da09 Binary files /dev/null and b/project/jni/application/opentyrian/AndroidData/tutorial.zip differ diff --git a/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip b/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip new file mode 100644 index 000000000..f7c5ab19a Binary files /dev/null and b/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip differ diff --git a/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip00 b/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip00 deleted file mode 100644 index 5cf225102..000000000 Binary files a/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip00 and /dev/null differ diff --git a/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip01 b/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip01 deleted file mode 100644 index 516c43405..000000000 Binary files a/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip01 and /dev/null differ diff --git a/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip02 b/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip02 deleted file mode 100644 index 11e22a924..000000000 Binary files a/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip02 and /dev/null differ diff --git a/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip03 b/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip03 deleted file mode 100644 index 6a38fb2f8..000000000 Binary files a/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip03 and /dev/null differ diff --git a/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip04 b/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip04 deleted file mode 100644 index 77639f9d6..000000000 Binary files a/project/jni/application/opentyrian/AndroidData/tyrian21-data.zip04 and /dev/null differ diff --git a/project/jni/application/opentyrian/src/menus.c b/project/jni/application/opentyrian/src/menus.c index 36a6e4b79..b05548485 100644 --- a/project/jni/application/opentyrian/src/menus.c +++ b/project/jni/application/opentyrian/src/menus.c @@ -16,7 +16,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include +#include #include +#include + #include "config.h" #include "episodes.h" #include "fonthand.h" @@ -55,7 +60,7 @@ select_menuitem_by_touch(int menu_top, int menu_spacing, int menu_item_count, in return true; } -void android_setup_screen_keys() +void android_setup_screen_keys( void ) { int W = SDL_ListModes(NULL, 0)[0]->w; int H = SDL_ListModes(NULL, 0)[0]->h; @@ -88,7 +93,7 @@ void android_setup_screen_keys() SDL_ANDROID_SetScreenKeyboardTransparency(SDL_ALPHA_TRANSPARENT); } -void android_cleanup_screen_keys() +void android_cleanup_screen_keys( void ) { if (!screen_button_pos_destruct_initialized) { @@ -109,7 +114,7 @@ void android_cleanup_screen_keys() SDL_ANDROID_SetScreenKeyboardTransparency(192); // Text input button should not be totally transparent } -void android_setup_screen_keys_destruct() +void android_setup_screen_keys_destruct( void ) { SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &screen_button_pos_destruct[SDL_ANDROID_SCREENKEYBOARD_BUTTON_0]); SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &screen_button_pos_destruct[SDL_ANDROID_SCREENKEYBOARD_BUTTON_1]); @@ -120,6 +125,67 @@ void android_setup_screen_keys_destruct() SDL_ANDROID_SetScreenKeyboardTransparency(192); // Text input button should not be totally transparent } +void android_show_tutorial( void ) +{ + static const char *tutorial_flag_file = "tutorial-shown.flag"; + FILE *shown = fopen(tutorial_flag_file, "r"); + __android_log_print(ANDROID_LOG_INFO, "Tyrian", "android_show_tutorial: %s: %s", tutorial_flag_file, shown ? "already shown" : "not shown"); + + if (shown) + { + fclose(shown); + return; + } + + __android_log_print(ANDROID_LOG_INFO, "Tyrian", "android_show_tutorial: creating %s", tutorial_flag_file); + shown = fopen(tutorial_flag_file, "w"); + if (!shown) + return; + fprintf(shown, "Tutorial was shown - remove this file to show it again\n"); + fclose(shown); + + static const char *tutorial_files[] = { "tutorial1.png", "tutorial2.png" }; + for (int f = 0; f < 2; f++) + { + SDL_Surface *img = IMG_Load(tutorial_files[f]); + __android_log_print(ANDROID_LOG_INFO, "Tyrian", "android_show_tutorial: %s: %p", tutorial_files[f], img); + if (!img) + return; + + SDL_Surface *img2 = SDL_ConvertSurface(img, SDL_GetVideoSurface()->format, SDL_SWSURFACE); + SDL_FreeSurface(img); + img = img2; + + for (int i = 7; i <= 255; i += 8) + { + SDL_FillRect(SDL_GetVideoSurface(), NULL, SDL_MapRGB(SDL_GetVideoSurface()->format, 0, 0, 0)); + SDL_SetAlpha(img, SDL_SRCALPHA, i); + SDL_BlitSurface(img, NULL, SDL_GetVideoSurface(), NULL); + __android_log_print(ANDROID_LOG_INFO, "Tyrian", "android_show_tutorial: blitting with alpha %d", i); + SDL_Flip(SDL_GetVideoSurface()); + SDL_Delay(60); + service_SDL_events(false); + } + while (!mousedown) + { + service_SDL_events(false); + SDL_Flip(SDL_GetVideoSurface()); + SDL_Delay(40); + } + for (int i = 255; i > 8; i -= 8) + { + SDL_FillRect(SDL_GetVideoSurface(), NULL, 0); + SDL_SetAlpha(img, SDL_SRCALPHA, i); + SDL_BlitSurface(img, NULL, SDL_GetVideoSurface(), NULL); + __android_log_print(ANDROID_LOG_INFO, "Tyrian", "android_show_tutorial: blitting with alpha %d", i); + SDL_Flip(SDL_GetVideoSurface()); + SDL_Delay(60); + service_SDL_events(false); + } + SDL_FreeSurface(img); + } +} + bool select_gameplay( void ) { JE_loadPic(VGAScreen, 2, false); diff --git a/project/jni/application/opentyrian/src/menus.h b/project/jni/application/opentyrian/src/menus.h index 21218b40e..9004f11d9 100644 --- a/project/jni/application/opentyrian/src/menus.h +++ b/project/jni/application/opentyrian/src/menus.h @@ -33,9 +33,10 @@ bool select_episode( void ); bool select_difficulty( void ); bool select_menuitem_by_touch(int menu_top, int menu_spacing, int menu_item_count, int *current_item); -void android_setup_screen_keys(); -void android_cleanup_screen_keys(); -void android_setup_screen_keys_destruct(); +void android_setup_screen_keys( void ); +void android_cleanup_screen_keys( void ); +void android_setup_screen_keys_destruct( void ); +void android_show_tutorial( void ); #endif /* MENUS_H */ diff --git a/project/jni/application/opentyrian/src/tyrian2.c b/project/jni/application/opentyrian/src/tyrian2.c index e167ec127..d80f97a9e 100644 --- a/project/jni/application/opentyrian/src/tyrian2.c +++ b/project/jni/application/opentyrian/src/tyrian2.c @@ -734,6 +734,8 @@ start_level_first: android_setup_screen_keys(); + android_show_tutorial(); + fade_song(); for (uint i = 0; i < COUNTOF(player); ++i) @@ -3442,7 +3444,6 @@ bool JE_titleScreen( JE_boolean animate ) arcade_code_i[i]++; else if(lastkey_char != '\0') arcade_code_i[i] = 0; - //__android_log_print(ANDROID_LOG_INFO, "Tyrian", "Got key: %d = '%c' = '%c', code[%d] = '%s', matched %d", (int)lastkey_char, lastkey_char, toupper(lastkey_char), i, specialName[i], arcade_code_i[i]); if (arcade_code_i[i] > 0 && arcade_code_i[i] == strlen(specialName[i])) {