From 468791d2124b962cc709f330be2c35f83c2f10b7 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Wed, 20 Sep 2017 20:26:59 +0300 Subject: [PATCH] uqm-hd: updated build script and Android patch --- .../uqm-hd/AndroidAppSettings-ouya.cfg | 231 -- .../application/uqm-hd/AndroidAppSettings.cfg | 33 +- .../jni/application/uqm-hd/AndroidPreBuild.sh | 6 +- project/jni/application/uqm-hd/android.diff | 3329 ++++++++--------- 4 files changed, 1693 insertions(+), 1906 deletions(-) delete mode 100644 project/jni/application/uqm-hd/AndroidAppSettings-ouya.cfg diff --git a/project/jni/application/uqm-hd/AndroidAppSettings-ouya.cfg b/project/jni/application/uqm-hd/AndroidAppSettings-ouya.cfg deleted file mode 100644 index 3e5e12fbd..000000000 --- a/project/jni/application/uqm-hd/AndroidAppSettings-ouya.cfg +++ /dev/null @@ -1,231 +0,0 @@ -# The application settings for Android libSDL port - -AppSettingVersion=19 - -# libSDL version to use (1.2 or 1.3, specify 1.3 for SDL2) -LibSdlVersion=1.2 - -# Specify application name (e.x. My Application) -AppName="Ur-Quan Masters HD" - -# Specify reversed site name of application (e.x. com.mysite.myapp) -AppFullName=com.googlecode.uqm.hd - -# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape -ScreenOrientation=h - -# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer -InhibitSuspend=n - -# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' -# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu -# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped -# 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 - - -# Downloads for OUYA, thay all are packed inside .apk -# Also, don't forget to set INIT_CONFIG_OPTION( resolutionFactor, 2 ) inside uqm.c -AppDataDownloadUrl="!English voice pack (150 Mb)|:addons/uqm-0.7.0-voice.uqm:uqm-hd-voice_0.2.uqm^Japanese voice pack (130 Mb)|:addons/uqm-0.7.0-voice.uqm:uqm-hd-voice-jp_0.2.uqm^Russian translation|:addons/lang/shadow-content/lang.zip:russian2.zip^Deutsch translation|:addons/lang/shadow-content/lang.zip:deutsch.zip^Spanish translation|:addons/lang/shadow-content/lang.zip:spanish.zip^Slovak translation|:addons/lang/shadow-content/lang.zip:slovak.zip^Finnish translation|:addons/lang/shadow-content/lang.zip:finnish.zip^!!Game data|data.zip^!!Game data|:packages/uqm-content.uqm:uqm-hd-content_0.2.uqm^!!640x480 graphics (160 Mb)|:packages/hires2x.uqm:uqm-hd-hires2x_0.2.uqm^!!1280x960 graphics (360 Mb)|:packages/hires4x.uqm:uqm-hd-hires4x_0.2.uqm^!!UQM music remix pack (240 Mb)|:addons/uqm-remix.uqm:uqm-remix.uqm" - - -# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only -# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) -VideoDepthBpp=24 - -# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) -NeedDepthBuffer=n - -# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) -NeedStencilBuffer=n - -# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device -# you need this option only if you're developing 3-d app (y) or (n) -NeedGles2=n - -# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, -# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) -SwVideoMode=y - -# Application video output will be resized to fit into native device screen (y)/(n) -SdlVideoResize=y - -# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) -SdlVideoResizeKeepAspect=n - -# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - -# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) -CompatibilityHacks=n - -# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) -CompatibilityHacksStaticInit=n - -# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) -CompatibilityHacksTextInputEmulatesHwKeyboard=n - -# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) -CompatibilityHacksPreventAudioChopping=n - -# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) -CompatibilityHacksAppIgnoresAudioBufferSize=n - -# Hack for VCMI: preload additional shared libraries before aplication start -CompatibilityHacksAdditionalPreloadedSharedLibraries="" - -# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - -# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) -CompatibilityHacksSlowCompatibleEventQueue=n - -# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL -CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState= - -# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user -AppUsesMouse=n - -# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) -AppNeedsTwoButtonMouse=n - -# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) -ShowMouseCursor=n - -# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) -ForceRelativeMouseMode=n - -# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) -AppNeedsArrowKeys=n - -# Application needs text input (y) or (n), enables button for text input on screen -AppNeedsTextInput=n - -# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 -AppUsesJoystick=y - -# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) -AppUsesSecondJoystick=y - -# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 -AppUsesAccelerometer=n - -# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 -AppUsesGyroscope=n - -# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 -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); -# This option will add additional permission to Android manifest (y)/(n) -AppRecordsAudio=n - -# Application implements Android-specific routines to put to background, and will not draw anything to screen -# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them -# rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) -# This option is reported to be buggy, sometimes failing to restore video state -NonBlockingSwapBuffers=n - -# Redefine common hardware keys to SDL keysyms -# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent -# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices -# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) -# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA -RedefinedKeys="RETURN RSHIFT NO_REMAP NO_REMAP RCTRL F10" - -# Number of virtual keyboard keys (currently 6 is maximum) -AppTouchscreenKeyboardKeysAmount=6 - -# Number of virtual keyboard keys that support autofire (currently 2 is maximum) -AppTouchscreenKeyboardKeysAmountAutoFire=0 - -# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) -RedefinedKeysScreenKb="RCTRL RSHIFT END PAGEUP PAGEDOWN W UNKNOWN UNKNOWN UNKNOWN UNKNOWN" - -# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu -RedefinedKeysScreenKbNames="Fire Secondary_weapon Thrust Player_2_fire Player_2_secondary_weapon Player_2_thrust" - -# On-screen keys theme -# 0 = Ultimate Droid by Sean Stieber (green, with gamepad joystick) -# 1 = Simple Theme by Beholder (white, with gamepad joystick) -# 2 = Sun by Sirea (yellow, with round joystick) -# 3 = Keen by Gerstrong (multicolor, with round joystick) -TouchscreenKeysTheme=2 - -# Redefine gamepad keys to SDL keysyms, button order is: -# A B X Y L1 R1 L2 R2 LThumb RThumb -RedefinedKeysGamepad="RCTRL RSHIFT END ESCAPE RCTRL PAGEUP RSHIFT PAGEDOWN END W" - -# How long to show startup menu button, in msec, 0 to disable startup menu -StartupMenuButtonTimeout=0 - -# Menu items to hide from startup menu, available menu items: -# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout -HiddenMenuOptions='' - -# Menu items to show at startup - this is Java code snippet, leave empty for default -# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration() -# Available menu items: -# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout -FirstStartMenuOptions='' - -# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, -# but .apk size is 2x bigger (y) / (n) / (x86) / (all) -MultiABI=y - -# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower -AppMinimumRAM=0 - -# Application version code (integer) -AppVersionCode=07003 - -# Application user-visible version name (string) -AppVersionName="0.7.0.03" - -# Reset SDL config when updating application to the new version (y) / (n) -ResetSdlConfigForThisVersion=n - -# Delete application data files when upgrading (specify file/dir paths separated by spaces) -DeleteFilesOnUpgrade="%" - -# 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_image tremor ogg" - -# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) -CustomBuildScript=n - -# Aditional CFLAGS for application -AppCflags='-O3 -DGFXMODULE_SDL -DOVCODEC_TREMOR -DNETPLAY=NETPLAY_FULL -DHAVE_JOYSTICK -DHAVE_ZIP=1 -DTHREADLIB_SDL -DUSE_INTERNAL_MIKMOD' - -# Additional LDFLAGS for application -AppLdflags='' - -# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable -AppOverlapsSystemHeaders=y - -# Build only following subdirs (empty will build all dirs, ignored with custom script) -AppSubdirsBuild='src src/libs/* src/uqm/*' - -# Exclude these files from build -AppBuildExclude='src/libs/uio/hashtable.c src/libs/uio/memdebug.c src/libs/network/socket/socket_win.c src/libs/network/network_win.c src/libs/network/netmanager/netmanager_win.c src/libs/cdp/cdpapi.c src/libs/cdp/cdp.c src/libs/cdp/windl.c' - -# Application command line parameters, including app name as 0-th param -AppCmdline='uqm -x -f --addon android --addon lang' - -# Here you may type readme text, which will be shown during startup. Format is: -# Text in English, use \\\\n to separate lines^de:Text in Deutsch^ru:Text in Russian, and so on (that's four backslashes, nice isn't it?) -ReadmeText='\\\\nDo not select multiple translations, only one will work.\\\\nIf the game runs slowly - set 640x480 video mode from Setup menu.' - -# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens -# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge -MinimumScreenSize=m - -# Your AdMob Publisher ID, (n) if you don't want advertisements -AdmobPublisherId=n - -# Your AdMob test device ID, to receive a test ad -AdmobTestDeviceId= - -# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) -AdmobBannerSize= - diff --git a/project/jni/application/uqm-hd/AndroidAppSettings.cfg b/project/jni/application/uqm-hd/AndroidAppSettings.cfg index d507c9788..8b00aba6c 100644 --- a/project/jni/application/uqm-hd/AndroidAppSettings.cfg +++ b/project/jni/application/uqm-hd/AndroidAppSettings.cfg @@ -46,12 +46,16 @@ NeedDepthBuffer=n # Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) NeedStencilBuffer=n -# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device +# Use GLES 2.x context # you need this option only if you're developing 3-d app (y) or (n) NeedGles2=n -# Use glshim library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n) -UseGlshim= +# Use GLES 3.x context +# you need this option only if you're developing 3-d app (y) or (n) +NeedGles3=n + +# Use gl4es library for provide OpenGL 1.x functionality to OpenGL ES accelerated cards (y) or (n) +UseGl4es= # Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, # this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) @@ -173,7 +177,7 @@ AppUsesMultitouch=n # This option will add additional permission to Android manifest (y)/(n) AppRecordsAudio=n -# Application needs to access SD card. If your data files are bigger than 5 Mb, enable it. (y) / (n) +# Application needs to access SD card. Always disable it, unless you want to access user photos and downloads. (y) / (n) AccessSdCard= # Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n) @@ -182,6 +186,9 @@ AccessInternet= # Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n) ImmersiveMode= +# Hide Android system mouse cursor image when USB mouse is attached (y) or (n) - the app must draw it's own mouse cursor +HideSystemMousePointer= + # Application implements Android-specific routines to put to background, and will not draw anything to screen # between SDL_ACTIVEEVENT lost / gained notifications - you should check for them # rigth after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) @@ -237,12 +244,18 @@ FirstStartMenuOptions='' # Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower AppMinimumRAM=0 -# GCC version, 4.6 (default) or 4.8, CLANG is not supported yet +# GCC version, or 'clang' for CLANG NDK_TOOLCHAIN_VERSION= +# Android platform version. +# android-9 = Android 2.3, the earliest supported version. +# android-18 = Android 4.3, the first version supporting GLES3. +# android-21 = Android 5.1, the first version with SO_REUSEPORT defined. +APP_PLATFORM= + # 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 x86' +# Available architectures: armeabi armeabi-v7a x86 mips arm64-v8a +MultiABI='armeabi-v7a x86 arm64-v8a' # 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 @@ -255,6 +268,9 @@ CustomBuildScript=n # Aditional CFLAGS for application AppCflags='-O3 -DGFXMODULE_SDL -DNETPLAY=NETPLAY_FULL -DHAVE_JOYSTICK -DHAVE_ZIP=1 -DTHREADLIB_SDL -DUSE_INTERNAL_MIKMOD' +# Aditional C++-specific compiler flags for application, added after AppCflags +AppCppflags='' + # Additional LDFLAGS for application AppLdflags='' @@ -286,3 +302,6 @@ AdmobBannerSize= # Google Play Game Services application ID, required for cloud saves to work GooglePlayGameServicesId= +# The app will open files with following extension, file path will be added to commandline params +AppOpenFileExtension='' + diff --git a/project/jni/application/uqm-hd/AndroidPreBuild.sh b/project/jni/application/uqm-hd/AndroidPreBuild.sh index 0c2925a0b..4b51db239 100755 --- a/project/jni/application/uqm-hd/AndroidPreBuild.sh +++ b/project/jni/application/uqm-hd/AndroidPreBuild.sh @@ -6,5 +6,9 @@ LOCAL_PATH=`cd $LOCAL_PATH && pwd` if [ -e src/patched.successfully ]; then exit 0 else - svn co http://uqm-hd.googlecode.com/svn/trunk/src && patch -p0 -d src < android.diff && svn add src/config_unix.h && touch src/patched.successfully || exit 1 + [ -e uqm-hd ] || git clone --depth=1 https://git.code.sf.net/p/urquanmastershd/git-new uqm-hd || exit 1 + ln -s uqm-hd/src src + patch -p1 < android.diff || exit 1 + git -C src add config_unix.h + touch src/patched.successfully fi diff --git a/project/jni/application/uqm-hd/android.diff b/project/jni/application/uqm-hd/android.diff index e9e02f5a3..d96d7de2d 100644 --- a/project/jni/application/uqm-hd/android.diff +++ b/project/jni/application/uqm-hd/android.diff @@ -1,340 +1,86 @@ -Index: libs/input/input_common.h -=================================================================== ---- libs/input/input_common.h (revision 1353) -+++ libs/input/input_common.h (working copy) -@@ -31,7 +31,7 @@ - extern int TFB_InitInput (int driver, int flags); - extern void TFB_UninitInput (void); - --#define MAX_FLIGHT_ALTERNATES 2 -+#define MAX_FLIGHT_ALTERNATES 3 - - extern void TFB_SetInputVectors (volatile int menu[], int num_menu, - volatile int flight[], int num_templ, int num_flight); -Index: libs/input/sdl/input.c -=================================================================== ---- libs/input/sdl/input.c (revision 1353) -+++ libs/input/sdl/input.c (working copy) -@@ -88,6 +88,7 @@ - "weapon", - "special", - "escape", -+ "thrust", - NULL - }; - -@@ -188,7 +189,7 @@ - directory. */ - LoadResourceIndex (contentDir, "uqm.key", "keys."); - } -- -+ - register_flight_controls (); - - return; -Index: libs/input/sdl/vcontrol.c -=================================================================== ---- libs/input/sdl/vcontrol.c (revision 1353) -+++ libs/input/sdl/vcontrol.c (working copy) -@@ -46,6 +46,7 @@ - typedef struct vcontrol_joystick_axis { - keybinding *neg, *pos; - int polarity; -+ int value; - } axis_type; - - typedef struct vcontrol_joystick_hat { -@@ -66,7 +67,7 @@ - - #endif /* HAVE_JOYSTICK */ - --static unsigned int joycount; -+static unsigned int joycount = 0; - static unsigned int num_sdl_keys = 0; - static keybinding **bindings = NULL; - -@@ -141,6 +142,7 @@ - for (j = 0; j < axes; j++) - { - x->axes[j].neg = x->axes[j].pos = NULL; -+ x->axes[j].polarity = x->axes[j].value = 0; - } - for (j = 0; j < hats; j++) - { -@@ -818,6 +820,7 @@ - int t; - if (!joysticks[port].stick) - return; -+ joysticks[port].axes[axis].value = value; - t = joysticks[port].threshold; - if (value > t) - { -@@ -830,6 +833,13 @@ - joysticks[port].axes[axis].polarity = 1; - activate (joysticks[port].axes[axis].pos); - } -+#ifdef __ANDROID__ -+ if( port == 2 ) -+ { -+ // Gamepad used - hide on-screen keys -+ TFB_SetOnScreenKeyboard_HiddenPermanently (); -+ } -+#endif - } - else if (value < -t) - { -@@ -894,6 +904,25 @@ - #endif /* HAVE_JOYSTICK */ - } - -+int -+VControl_GetJoyAxis(int port, int axis) -+{ -+#ifdef HAVE_JOYSTICK -+ if( joycount <= port ) -+ return 0; -+ if (!joysticks[port].stick || joysticks[port].numaxes <= axis ) -+ return 0; -+ return joysticks[port].axes[axis].value; -+#else -+ return 0; -+#endif /* HAVE_JOYSTICK */ -+}; +diff --git a/src/config_unix.h b/src/config_unix.h +new file mode 100644 +index 0000000..8f246a8 +--- /dev/null ++++ b/src/config_unix.h +@@ -0,0 +1,63 @@ ++/* This file contains some compile-time configuration options for *nix ++ * systems. ++ * config_unix.h is generated from config_unix.h.in by build.sh ++ * When building on MS Windows using build.sh (MinGW, Cygwin), ++ * config_win.h is generated from src/config_win.h.in. ++ * When using MSVC on MS Windows, you'll have to edit src/config_vc6.h ++ * manually if you want anything else than the defaults. ++ */ + -+int VControl_GetJoysticksAmount() -+{ -+ return joycount; -+}; ++#ifndef _CONFIG_UNIX_H ++#define _CONFIG_UNIX_H + - void - VControl_ResetInput (void) - { -Index: libs/input/sdl/vcontrol.h -=================================================================== ---- libs/input/sdl/vcontrol.h (revision 1353) -+++ libs/input/sdl/vcontrol.h (working copy) -@@ -76,6 +76,9 @@ - void VControl_ProcessJoyAxis (int port, int axis, int value); - void VControl_ProcessJoyHat (int port, int which, Uint8 value); - -+int VControl_GetJoyAxis(int port, int axis); -+int VControl_GetJoysticksAmount(); ++/* Directory where the UQM game data is located */ ++#define CONTENTDIR "" + - /* Force the input into the blank state. For preventing "sticky" keys. */ - void VControl_ResetInput (void); - -Index: libs/log/msgbox_stub.c -=================================================================== ---- libs/log/msgbox_stub.c (revision 1353) -+++ libs/log/msgbox_stub.c (working copy) -@@ -16,6 +16,9 @@ - - #include "msgbox.h" - #include "loginternal.h" -+#ifdef ANDROID -+#include -+#endif - - void - log_displayBox (const /*UTF-8*/char *title, int isError, -@@ -26,6 +29,9 @@ - // So just inform the user of our predicament - fprintf (streamOut, "Do not know how to display %s box\n", - isError ? "an error" : "a"); -+#ifdef ANDROID -+ __android_log_print( isError ? ANDROID_LOG_FATAL : ANDROID_LOG_INFO, "Ur-Quan Masters", "%s: %s", title, msg ); -+#endif - - // Suppress the compiler warnings in any case. - (void)title; -Index: libs/log/uqmlog.c -=================================================================== ---- libs/log/uqmlog.c (revision 1353) -+++ libs/log/uqmlog.c (working copy) -@@ -23,6 +23,9 @@ - #include - #include - #include -+#ifdef ANDROID -+#include -+#endif - #include "libs/threadlib.h" - - #ifndef MAX_LOG_ENTRY_SIZE -@@ -190,6 +193,9 @@ - if ((int)level <= maxStreamLevel) - { - fprintf (streamOut, "%s\n", full_msg); -+#ifdef ANDROID -+ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); -+#endif - } - - if ((int)level <= maxLevel) -@@ -226,6 +232,9 @@ - if ((int)level <= maxStreamLevel) - { - fprintf (streamOut, "%s\n", full_msg); -+#ifdef ANDROID -+ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); -+#endif - } - - if ((int)level <= maxLevel) -Index: libs/log/msgbox_win.c -=================================================================== ---- libs/log/msgbox_win.c (revision 1353) -+++ libs/log/msgbox_win.c (working copy) -@@ -14,6 +14,7 @@ - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -+#ifndef ANDROID - #include "msgbox.h" - #define WIN32_LEAN_AND_MEAN - #include -@@ -64,4 +65,4 @@ - free (swTitle); - free (swMsg); - } -- -+#endif -Index: libs/uio/io.c -=================================================================== ---- libs/uio/io.c (revision 1353) -+++ libs/uio/io.c (working copy) -@@ -35,6 +35,7 @@ - #include "mem.h" - #include "uioutils.h" - #include "uioport.h" -+#include "../log.h" - #ifdef uio_MEM_DEBUG - # include "memdebug.h" - #endif -@@ -193,6 +194,7 @@ - errno = EINVAL; - return NULL; - } -+ log_add (log_Info, "uio_open %s", sourcePath); - handle = uio_open(sourceDir, sourcePath, - ((flags & uio_MOUNT_RDONLY) == uio_MOUNT_RDONLY ? - O_RDONLY : O_RDWR) -@@ -201,12 +203,14 @@ - #endif - , 0); - if (handle == NULL) { -+ log_add (log_Info, "uio_open failed for %s", sourcePath); - // errno is set - return NULL; - } - } - - handler = uio_getFileSystemHandler(fsType); -+ log_add (log_Info, "uio_getFileSystemHandler %p", handler); - if (handler == NULL) { - if (handle) - uio_close(handle); -@@ -703,6 +707,7 @@ - &readMountInfo, &readPDirHandle, NULL, - &writeMountInfo, &writePDirHandle, NULL, &name) == -1) { - // errno is set -+ log_add (log_Info, "uio_open: uio_getPhysicalAccess failed for '%s'", path); - return NULL; - } - -@@ -729,6 +734,7 @@ - uio_PDirHandle_unref(readPDirHandle); - uio_PDirHandle_unref(writePDirHandle); - errno = EEXIST; -+ log_add (log_Info, "uio_open: O_CREAT | O_EXCL: file already exists '%s'", name); - return NULL; - } - if ((flags & O_TRUNC) == O_TRUNC) { -@@ -745,6 +751,7 @@ - uio_PDirHandle_unref(readPDirHandle); - uio_PDirHandle_unref(writePDirHandle); - errno = savedErrno; -+ log_add (log_Info, "uio_open: uio_copyFilePhysical failed '%s'", name); - return NULL; - } - } -@@ -766,6 +773,7 @@ - handle = (pDirHandle->pRoot->handler->open)(pDirHandle, name, flags, mode); - // Also adds a new entry to the physical dir if appropriate. - if (handle == NULL) { -+ log_add (log_Info, "uio_open: open file failed '%s'", name); - int savedErrno = errno; - uio_free(name); - uio_PDirHandle_unref(pDirHandle); -Index: libs/uio/zip/zip.c -=================================================================== ---- libs/uio/zip/zip.c (revision 1353) -+++ libs/uio/zip/zip.c (working copy) -@@ -1366,6 +1366,10 @@ - gPFileData->gid = (uid_t) makeUInt16(buf[12], buf[13]); - break; - } -+ case 0x7875: // 'Unix string UID/GID' -+ // Just skip it -+ break; ++/* Directory where game data will be stored */ ++#define USERDIR "config/" + - default: - #ifdef DEBUG - fprintf(stderr, "Debug: Extra field 0x%04x unsupported, " -Index: libs/md5/md5.c -=================================================================== ---- libs/md5/md5.c (revision 1353) -+++ libs/md5/md5.c (working copy) -@@ -21,7 +21,7 @@ ++/* Directory where config files will be stored */ ++#define CONFIGDIR USERDIR ++ ++/* Directory where supermelee teams will be stored */ ++#define MELEEDIR "teams/" ++ ++/* Directory where save games will be stored */ ++#define SAVEDIR "save/" ++ ++/* Defined if words are stored with the most significant byte first */ ++#undef WORDS_BIGENDIAN ++ ++/* Defined if your system has readdir_r of its own */ ++#define HAVE_READDIR_R ++ ++/* Defined if your system has setenv of its own */ ++#define HAVE_SETENV ++ ++/* Defined if your system has strupr of its own */ ++#undef HAVE_STRUPR ++ ++/* Defined if your system has strcasecmp of its own */ ++#define HAVE_STRCASECMP_UQM ++ // Not using "HAVE_STRCASECMP" as that conflicts with SDL. ++ ++/* Defined if your system has stricmp of its own */ ++#undef HAVE_STRICMP ++ ++/* Defined if your system has getopt_long */ ++#define HAVE_GETOPT_LONG ++ ++/* Defined if your system has iswgraph of its own*/ ++#define HAVE_ISWGRAPH ++ ++/* Defined if your system has wchar_t of its own */ ++#define HAVE_WCHAR_T ++ ++/* Defined if your system has wint_t of its own */ ++#define HAVE_WINT_T ++ ++/* Defined if your system has _Bool of its own */ ++#define HAVE__BOOL ++ ++#endif /* _CONFIG_UNIX_H */ ++ +diff --git a/src/libs/graphics/gfx_common.h b/src/libs/graphics/gfx_common.h +index db0b8be..338a8fe 100644 +--- a/src/libs/graphics/gfx_common.h ++++ b/src/libs/graphics/gfx_common.h +@@ -67,7 +67,7 @@ extern int GfxFlags; - /* Written by Ulrich Drepper , 1995. */ - --#include -+#include "config.h" - - #include "md5.h" - -Index: libs/resource/filecntl.c -=================================================================== ---- libs/resource/filecntl.c (revision 1353) -+++ libs/resource/filecntl.c (working copy) -@@ -26,6 +26,7 @@ - #include "port.h" - #include "resintrn.h" - #include "libs/uio.h" -+#include "libs/log.h" - - uio_Stream * - res_OpenResFile (uio_DirHandle *dir, const char *filename, const char *mode) -@@ -34,7 +35,10 @@ - struct stat sb; - - if (uio_stat (dir, filename, &sb) == 0 && S_ISDIR(sb.st_mode)) -+ { -+ log_add (log_Debug, "res_OpenResFile('%s', '%s') - cannot open dir as file", filename, mode); - return ((uio_Stream *) ~0); -+ } - - fp = uio_fopen (dir, filename, mode); - -Index: libs/sound/decoders/oggaud.c -=================================================================== ---- libs/sound/decoders/oggaud.c (revision 1353) -+++ libs/sound/decoders/oggaud.c (working copy) -@@ -270,7 +270,7 @@ - // this is the closest to a frame there is in ogg vorbis stream - // doesn't seem to be a func to retrive it - #ifdef OVCODEC_TREMOR -- return ova->vf.os->pageno; -+ return ova->vf.os.pageno; - #else - return ova->vf.os.pageno; - #endif /* OVCODEC_TREMOR */ -Index: libs/graphics/gfx_common.h -=================================================================== ---- libs/graphics/gfx_common.h (revision 1353) -+++ libs/graphics/gfx_common.h (working copy) -@@ -119,4 +119,11 @@ + // The following functions are driver-defined + void TFB_PreInit (void); +-int TFB_InitGraphics (int driver, int flags, int width, int height, unsigned int resolutionFactor, BOOLEAN forceAspectRatio); // JMS_GFX: Added resolutionFactor ++int TFB_InitGraphics (int driver, int flags, int width, int height, unsigned int *resolutionFactor, BOOLEAN forceAspectRatio); // JMS_GFX: Added resolutionFactor + int TFB_ReInitGraphics (int driver, int flags, int width, int height, unsigned int resolutionFactor, BOOLEAN forceAspectRatio); // JMS_GFX: Added resolutionFactor + void TFB_UninitGraphics (void); + void TFB_ProcessEvents (void); +@@ -119,4 +119,11 @@ extern int ScreenHeightActual; extern int ScreenColorDepth; extern int GraphicsDriver; @@ -346,23 +92,58 @@ Index: libs/graphics/gfx_common.h +void TFB_SetOnScreenKeyboard_TwoPlayersMelee (void); + #endif -Index: libs/graphics/sdl/sdl_common.c -=================================================================== ---- libs/graphics/sdl/sdl_common.c (revision 1353) -+++ libs/graphics/sdl/sdl_common.c (working copy) -@@ -34,7 +34,11 @@ +diff --git a/src/libs/graphics/sdl/pure.c b/src/libs/graphics/sdl/pure.c +index 5707df4..803ef0f 100644 +--- a/src/libs/graphics/sdl/pure.c ++++ b/src/libs/graphics/sdl/pure.c +@@ -128,6 +128,7 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int toggl + { + int i, videomode_flags; + SDL_PixelFormat conv_fmt; ++ int BPP = 32; + + GraphicsDriver = driver; + +@@ -169,6 +170,14 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int toggl + } + } + ++#ifdef ANDROID ++ videomode_flags = SDL_SWSURFACE; ++ //ScreenWidthActual = 1280; ++ //ScreenHeightActual = 960; ++ graphics_backend = &pure_unscaled_backend; ++ BPP = 24; ++#endif ++ + videomode_flags |= SDL_ANYFORMAT; + if (flags & TFB_GFXFLAGS_FULLSCREEN) + videomode_flags |= SDL_FULLSCREEN; +@@ -176,7 +185,7 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int toggl + /* We'll ask for a 32bpp frame, but it doesn't really matter, because we've set + SDL_ANYFORMAT */ + SDL_Video = SDL_SetVideoMode (ScreenWidthActual, ScreenHeightActual, +- 32, videomode_flags); ++ BPP, videomode_flags); + + if (SDL_Video == NULL) + { +diff --git a/src/libs/graphics/sdl/sdl_common.c b/src/libs/graphics/sdl/sdl_common.c +index c60b41a..7b4a072 100644 +--- a/src/libs/graphics/sdl/sdl_common.c ++++ b/src/libs/graphics/sdl/sdl_common.c +@@ -34,6 +34,10 @@ #include "libs/memlib.h" #include "libs/vidlib.h" #include SDL_INCLUDE(SDL_thread.h) +#ifdef ANDROID +#include +#endif - + + SDL_Surface *SDL_Video; SDL_Surface *SDL_Screen; - SDL_Surface *TransitionScreen; -@@ -199,6 +203,8 @@ +@@ -216,6 +220,8 @@ TFB_InitGraphics (int driver, int flags, int width, int height, unsigned int *re atexit (TFB_UninitGraphics); @@ -371,7 +152,7 @@ Index: libs/graphics/sdl/sdl_common.c return 0; } -@@ -635,3 +641,166 @@ +@@ -652,3 +658,166 @@ TFB_SetGamma (float gamma) } } @@ -538,58 +319,272 @@ Index: libs/graphics/sdl/sdl_common.c +} + +#endif -Index: libs/graphics/sdl/sdl_common.h -=================================================================== ---- libs/graphics/sdl/sdl_common.h (revision 1353) -+++ libs/graphics/sdl/sdl_common.h (working copy) -@@ -50,4 +50,6 @@ +diff --git a/src/libs/graphics/sdl/sdl_common.h b/src/libs/graphics/sdl/sdl_common.h +index 1c533d1..e9e13c9 100644 +--- a/src/libs/graphics/sdl/sdl_common.h ++++ b/src/libs/graphics/sdl/sdl_common.h +@@ -50,4 +50,6 @@ extern const SDL_VideoInfo *SDL_screen_info; // JMS_GFX SDL_Surface* TFB_DisplayFormatAlpha (SDL_Surface *surface); +void TFB_InitOnScreenKeyboard (void); + #endif -Index: libs/graphics/sdl/pure.c -=================================================================== ---- libs/graphics/sdl/pure.c (revision 1353) -+++ libs/graphics/sdl/pure.c (working copy) -@@ -128,6 +128,7 @@ - { - int i, videomode_flags; - SDL_PixelFormat conv_fmt; -+ int BPP = 32; - - GraphicsDriver = driver; +diff --git a/src/libs/input/input_common.h b/src/libs/input/input_common.h +index 5979320..57bcccd 100644 +--- a/src/libs/input/input_common.h ++++ b/src/libs/input/input_common.h +@@ -31,7 +31,7 @@ enum + extern int TFB_InitInput (int driver, int flags); + extern void TFB_UninitInput (void); -@@ -169,6 +170,14 @@ +-#define MAX_FLIGHT_ALTERNATES 2 ++#define MAX_FLIGHT_ALTERNATES 3 + + extern void TFB_SetInputVectors (volatile int menu[], int num_menu, + volatile int flight[], int num_templ, int num_flight); +diff --git a/src/libs/input/sdl/input.c b/src/libs/input/sdl/input.c +index c143d34..f4ef099 100644 +--- a/src/libs/input/sdl/input.c ++++ b/src/libs/input/sdl/input.c +@@ -88,6 +88,7 @@ static const char *flight_res_names[] = { + "weapon", + "special", + "escape", ++ "thrust", + NULL + }; + +@@ -188,7 +189,7 @@ initKeyConfig (void) + directory. */ + LoadResourceIndex (contentDir, "uqm.key", "keys."); + } +- ++ + register_flight_controls (); + + return; +diff --git a/src/libs/input/sdl/vcontrol.c b/src/libs/input/sdl/vcontrol.c +index 6c2bc8e..00d0f65 100644 +--- a/src/libs/input/sdl/vcontrol.c ++++ b/src/libs/input/sdl/vcontrol.c +@@ -46,6 +46,7 @@ typedef struct vcontrol_keypool { + typedef struct vcontrol_joystick_axis { + keybinding *neg, *pos; + int polarity; ++ int value; + } axis_type; + + typedef struct vcontrol_joystick_hat { +@@ -66,7 +67,7 @@ static joystick *joysticks; + + #endif /* HAVE_JOYSTICK */ + +-static unsigned int joycount; ++static unsigned int joycount = 0; + static unsigned int num_sdl_keys = 0; + static keybinding **bindings = NULL; + +@@ -141,6 +142,7 @@ create_joystick (int index) + for (j = 0; j < axes; j++) + { + x->axes[j].neg = x->axes[j].pos = NULL; ++ x->axes[j].polarity = x->axes[j].value = 0; } + for (j = 0; j < hats; j++) + { +@@ -818,6 +820,7 @@ VControl_ProcessJoyAxis (int port, int axis, int value) + int t; + if (!joysticks[port].stick) + return; ++ joysticks[port].axes[axis].value = value; + t = joysticks[port].threshold; + if (value > t) + { +@@ -830,6 +833,13 @@ VControl_ProcessJoyAxis (int port, int axis, int value) + joysticks[port].axes[axis].polarity = 1; + activate (joysticks[port].axes[axis].pos); + } ++#ifdef __ANDROID__ ++ if( port == 2 ) ++ { ++ // Gamepad used - hide on-screen keys ++ TFB_SetOnScreenKeyboard_HiddenPermanently (); ++ } ++#endif + } + else if (value < -t) + { +@@ -894,6 +904,25 @@ VControl_ProcessJoyHat (int port, int which, Uint8 value) + #endif /* HAVE_JOYSTICK */ + } + ++int ++VControl_GetJoyAxis(int port, int axis) ++{ ++#ifdef HAVE_JOYSTICK ++ if( joycount <= port ) ++ return 0; ++ if (!joysticks[port].stick || joysticks[port].numaxes <= axis ) ++ return 0; ++ return joysticks[port].axes[axis].value; ++#else ++ return 0; ++#endif /* HAVE_JOYSTICK */ ++}; ++ ++int VControl_GetJoysticksAmount() ++{ ++ return joycount; ++}; ++ + void + VControl_ResetInput (void) + { +diff --git a/src/libs/input/sdl/vcontrol.h b/src/libs/input/sdl/vcontrol.h +index bff70a2..8f093e7 100644 +--- a/src/libs/input/sdl/vcontrol.h ++++ b/src/libs/input/sdl/vcontrol.h +@@ -76,6 +76,9 @@ void VControl_ProcessJoyButtonUp (int port, int button); + void VControl_ProcessJoyAxis (int port, int axis, int value); + void VControl_ProcessJoyHat (int port, int which, Uint8 value); + ++int VControl_GetJoyAxis(int port, int axis); ++int VControl_GetJoysticksAmount(); ++ + /* Force the input into the blank state. For preventing "sticky" keys. */ + void VControl_ResetInput (void); + +diff --git a/src/libs/log/msgbox_stub.c b/src/libs/log/msgbox_stub.c +index 8e0b6b6..78d02ba 100644 +--- a/src/libs/log/msgbox_stub.c ++++ b/src/libs/log/msgbox_stub.c +@@ -16,6 +16,9 @@ + + #include "msgbox.h" + #include "loginternal.h" ++#ifdef ANDROID ++#include ++#endif + + void + log_displayBox (const /*UTF-8*/char *title, int isError, +@@ -26,6 +29,9 @@ log_displayBox (const /*UTF-8*/char *title, int isError, + // So just inform the user of our predicament + fprintf (streamOut, "Do not know how to display %s box\n", + isError ? "an error" : "a"); ++#ifdef ANDROID ++ __android_log_print( isError ? ANDROID_LOG_FATAL : ANDROID_LOG_INFO, "Ur-Quan Masters", "%s: %s", title, msg ); ++#endif + + // Suppress the compiler warnings in any case. + (void)title; +diff --git a/src/libs/log/msgbox_win.c b/src/libs/log/msgbox_win.c +index c4e0021..cfd1429 100644 +--- a/src/libs/log/msgbox_win.c ++++ b/src/libs/log/msgbox_win.c +@@ -14,6 +14,7 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + ++#ifndef ANDROID + #include "msgbox.h" + #define WIN32_LEAN_AND_MEAN + #include +@@ -64,4 +65,4 @@ log_displayBox (const /*UTF-8*/char *title, int isError, + free (swTitle); + free (swMsg); + } +- ++#endif +diff --git a/src/libs/log/uqmlog.c b/src/libs/log/uqmlog.c +index 5e9cc3d..859305d 100644 +--- a/src/libs/log/uqmlog.c ++++ b/src/libs/log/uqmlog.c +@@ -23,6 +23,9 @@ + #include + #include + #include ++#ifdef ANDROID ++#include ++#endif + #include "libs/threadlib.h" + + #ifndef MAX_LOG_ENTRY_SIZE +@@ -190,6 +193,9 @@ log_addV (log_Level level, const char *fmt, va_list list) + if ((int)level <= maxStreamLevel) + { + fprintf (streamOut, "%s\n", full_msg); ++#ifdef ANDROID ++ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); ++#endif } -+#ifdef ANDROID -+ videomode_flags = SDL_SWSURFACE; -+ //ScreenWidthActual = 1280; -+ //ScreenHeightActual = 960; -+ graphics_backend = &pure_unscaled_backend; -+ BPP = 24; -+#endif -+ - videomode_flags |= SDL_ANYFORMAT; - if (flags & TFB_GFXFLAGS_FULLSCREEN) - videomode_flags |= SDL_FULLSCREEN; -@@ -176,7 +185,7 @@ - /* We'll ask for a 32bpp frame, but it doesn't really matter, because we've set - SDL_ANYFORMAT */ - SDL_Video = SDL_SetVideoMode (ScreenWidthActual, ScreenHeightActual, -- 32, videomode_flags); -+ BPP, videomode_flags); - - if (SDL_Video == NULL) + if ((int)level <= maxLevel) +@@ -226,6 +232,9 @@ log_add_nothreadV (log_Level level, const char *fmt, va_list list) + if ((int)level <= maxStreamLevel) { -Index: libs/strings/unicode.c -=================================================================== ---- libs/strings/unicode.c (revision 1353) -+++ libs/strings/unicode.c (working copy) -@@ -41,7 +41,8 @@ + fprintf (streamOut, "%s\n", full_msg); ++#ifdef ANDROID ++ __android_log_print( ANDROID_LOG_INFO, "Ur-Quan Masters", "%s", full_msg ); ++#endif + } + + if ((int)level <= maxLevel) +diff --git a/src/libs/md5/md5.c b/src/libs/md5/md5.c +index d57b3df..64b5ca1 100644 +--- a/src/libs/md5/md5.c ++++ b/src/libs/md5/md5.c +@@ -21,7 +21,7 @@ + + /* Written by Ulrich Drepper , 1995. */ + +-#include ++#include "config.h" + + #include "md5.h" + +diff --git a/src/libs/resource/filecntl.c b/src/libs/resource/filecntl.c +index e2a81d9..941d7e0 100644 +--- a/src/libs/resource/filecntl.c ++++ b/src/libs/resource/filecntl.c +@@ -26,6 +26,7 @@ + #include "port.h" + #include "resintrn.h" + #include "libs/uio.h" ++#include "libs/log.h" + + uio_Stream * + res_OpenResFile (uio_DirHandle *dir, const char *filename, const char *mode) +@@ -34,7 +35,10 @@ res_OpenResFile (uio_DirHandle *dir, const char *filename, const char *mode) + struct stat sb; + + if (uio_stat (dir, filename, &sb) == 0 && S_ISDIR(sb.st_mode)) ++ { ++ log_add (log_Debug, "res_OpenResFile('%s', '%s') - cannot open dir as file", filename, mode); + return ((uio_Stream *) ~0); ++ } + + fp = uio_fopen (dir, filename, mode); + +diff --git a/src/libs/sound/decoders/oggaud.c b/src/libs/sound/decoders/oggaud.c +index 6227120..f1b4e9c 100644 +--- a/src/libs/sound/decoders/oggaud.c ++++ b/src/libs/sound/decoders/oggaud.c +@@ -270,7 +270,7 @@ ova_GetFrame (THIS_PTR) + // this is the closest to a frame there is in ogg vorbis stream + // doesn't seem to be a func to retrive it + #ifdef OVCODEC_TREMOR +- return ova->vf.os->pageno; ++ return ova->vf.os.pageno; + #else + return ova->vf.os.pageno; + #endif /* OVCODEC_TREMOR */ +diff --git a/src/libs/strings/unicode.c b/src/libs/strings/unicode.c +index 1750507..b6d8b30 100644 +--- a/src/libs/strings/unicode.c ++++ b/src/libs/strings/unicode.c +@@ -41,7 +41,8 @@ resyncUTF8(const unsigned char **ptr) { // function. UniChar getCharFromString(const unsigned char **ptr) { @@ -599,7 +594,7 @@ Index: libs/strings/unicode.c if (**ptr < 0x80) { // 0xxxxxxx, regular ASCII -@@ -121,7 +122,14 @@ +@@ -121,7 +122,14 @@ getCharFromString(const unsigned char **ptr) { } err: @@ -615,512 +610,740 @@ Index: libs/strings/unicode.c // Resynchronise (skip everything starting with 0x10xxxxxx): resyncUTF8(ptr); -Index: config_unix.h -=================================================================== ---- config_unix.h (revision 0) -+++ config_unix.h (working copy) -@@ -0,0 +1,63 @@ -+/* This file contains some compile-time configuration options for *nix -+ * systems. -+ * config_unix.h is generated from config_unix.h.in by build.sh -+ * When building on MS Windows using build.sh (MinGW, Cygwin), -+ * config_win.h is generated from src/config_win.h.in. -+ * When using MSVC on MS Windows, you'll have to edit src/config_vc6.h -+ * manually if you want anything else than the defaults. -+ */ -+ -+#ifndef _CONFIG_UNIX_H -+#define _CONFIG_UNIX_H -+ -+/* Directory where the UQM game data is located */ -+#define CONTENTDIR "" -+ -+/* Directory where game data will be stored */ -+#define USERDIR "config/" -+ -+/* Directory where config files will be stored */ -+#define CONFIGDIR USERDIR -+ -+/* Directory where supermelee teams will be stored */ -+#define MELEEDIR "teams/" -+ -+/* Directory where save games will be stored */ -+#define SAVEDIR "save/" -+ -+/* Defined if words are stored with the most significant byte first */ -+#undef WORDS_BIGENDIAN -+ -+/* Defined if your system has readdir_r of its own */ -+#define HAVE_READDIR_R -+ -+/* Defined if your system has setenv of its own */ -+#define HAVE_SETENV -+ -+/* Defined if your system has strupr of its own */ -+#undef HAVE_STRUPR -+ -+/* Defined if your system has strcasecmp of its own */ -+#define HAVE_STRCASECMP_UQM -+ // Not using "HAVE_STRCASECMP" as that conflicts with SDL. -+ -+/* Defined if your system has stricmp of its own */ -+#undef HAVE_STRICMP -+ -+/* Defined if your system has getopt_long */ -+#define HAVE_GETOPT_LONG -+ -+/* Defined if your system has iswgraph of its own*/ -+#define HAVE_ISWGRAPH -+ -+/* Defined if your system has wchar_t of its own */ -+#define HAVE_WCHAR_T -+ -+/* Defined if your system has wint_t of its own */ -+#define HAVE_WINT_T -+ -+/* Defined if your system has _Bool of its own */ -+#define HAVE__BOOL -+ -+#endif /* _CONFIG_UNIX_H */ -+ -Index: uqm/supermelee/melee.c -=================================================================== ---- uqm/supermelee/melee.c (revision 1353) -+++ uqm/supermelee/melee.c (working copy) -@@ -2124,7 +2124,7 @@ - PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING; - Melee_LocalChange_team (&MenuState, 0, - MenuState.load.preBuiltList[0]); -- PlayerControl[1] = COMPUTER_CONTROL | STANDARD_RATING; -+ PlayerControl[1] = HUMAN_CONTROL | STANDARD_RATING; // COMPUTER_CONTROL | STANDARD_RATING; - Melee_LocalChange_team (&MenuState, 1, - MenuState.load.preBuiltList[1]); +diff --git a/src/libs/uio/io.c b/src/libs/uio/io.c +index a7c721e..c834369 100644 +--- a/src/libs/uio/io.c ++++ b/src/libs/uio/io.c +@@ -35,6 +35,7 @@ + #include "mem.h" + #include "uioutils.h" + #include "uioport.h" ++#include "../log.h" + #ifdef uio_MEM_DEBUG + # include "memdebug.h" + #endif +@@ -193,6 +194,7 @@ uio_mountDir(uio_Repository *destRep, const char *mountPoint, + errno = EINVAL; + return NULL; } -Index: uqm/units.h -=================================================================== ---- uqm/units.h (revision 1353) -+++ uqm/units.h (working copy) -@@ -67,6 +67,7 @@ - #define RADAR_WIDTH (STATUS_WIDTH - RES_STAT_SCALE(8)) // JMS_GFX - #define RADAR_HEIGHT RES_STAT_SCALE(53) // JMS_GFX - #define RADAR_Y (SIS_ORG_Y + SIS_SCREEN_HEIGHT - (53 << RESOLUTION_FACTOR)) // JMS_GFX -+#define RADAR_Y_LIFTED_UP (RADAR_Y - (40 << RESOLUTION_FACTOR)) ++ log_add (log_Info, "uio_open %s", sourcePath); + handle = uio_open(sourceDir, sourcePath, + ((flags & uio_MOUNT_RDONLY) == uio_MOUNT_RDONLY ? + O_RDONLY : O_RDWR) +@@ -201,12 +203,14 @@ uio_mountDir(uio_Repository *destRep, const char *mountPoint, + #endif + , 0); + if (handle == NULL) { ++ log_add (log_Info, "uio_open failed for %s", sourcePath); + // errno is set + return NULL; + } + } - /* Blue boxes which display messages and the green date box. */ - #define SIS_TITLE_BOX_WIDTH (57 << RESOLUTION_FACTOR) // JMS_GFX -Index: uqm/menu.c -=================================================================== ---- uqm/menu.c (revision 1353) -+++ uqm/menu.c (working copy) -@@ -508,7 +508,7 @@ - s.origin.x = RADAR_X - r.corner.x; - s.origin.y = RADAR_Y - r.corner.y; - r.corner.x = s.origin.x - 1; -- r.corner.y = s.origin.y - (11 << RESOLUTION_FACTOR); // JMS_GFX -+ r.corner.y = s.origin.y - (40 << RESOLUTION_FACTOR); // JMS_GFX - r.extent.width = RADAR_WIDTH + 2; - BatchGraphics (); - SetContextForeGroundColor ( -Index: uqm/planets/lander.c -=================================================================== ---- uqm/planets/lander.c (revision 1353) -+++ uqm/planets/lander.c (working copy) -@@ -1852,15 +1852,15 @@ - if (crew_left) - { - SIZE index = GetFrameIndex (LanderFrame[0]); -+ BATTLE_INPUT_STATE InputState = GetDirectionalJoystickInput(index, 0); - if (turn_wait) - --turn_wait; -- else if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT] || -- CurrentInputState.key[PlayerControls[0]][KEY_RIGHT]) -+ else if ((InputState & BATTLE_LEFT) || (InputState & BATTLE_RIGHT)) - { - COUNT landerSpeedNumer; - COUNT angle; - -- if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT]) -+ if (InputState & BATTLE_LEFT) - --index; - else - ++index; -@@ -1884,7 +1884,7 @@ - turn_wait = SHUTTLE_TURN_WAIT; + handler = uio_getFileSystemHandler(fsType); ++ log_add (log_Info, "uio_getFileSystemHandler %p", handler); + if (handler == NULL) { + if (handle) + uio_close(handle); +@@ -703,6 +707,7 @@ uio_open(uio_DirHandle *dir, const char *path, int flags, mode_t mode) { + &readMountInfo, &readPDirHandle, NULL, + &writeMountInfo, &writePDirHandle, NULL, &name) == -1) { + // errno is set ++ log_add (log_Info, "uio_open: uio_getPhysicalAccess failed for '%s'", path); + return NULL; + } + +@@ -729,6 +734,7 @@ uio_open(uio_DirHandle *dir, const char *path, int flags, mode_t mode) { + uio_PDirHandle_unref(readPDirHandle); + uio_PDirHandle_unref(writePDirHandle); + errno = EEXIST; ++ log_add (log_Info, "uio_open: O_CREAT | O_EXCL: file already exists '%s'", name); + return NULL; } + if ((flags & O_TRUNC) == O_TRUNC) { +@@ -745,6 +751,7 @@ uio_open(uio_DirHandle *dir, const char *path, int flags, mode_t mode) { + uio_PDirHandle_unref(readPDirHandle); + uio_PDirHandle_unref(writePDirHandle); + errno = savedErrno; ++ log_add (log_Info, "uio_open: uio_copyFilePhysical failed '%s'", name); + return NULL; + } + } +@@ -766,6 +773,7 @@ uio_open(uio_DirHandle *dir, const char *path, int flags, mode_t mode) { + handle = (pDirHandle->pRoot->handler->open)(pDirHandle, name, flags, mode); + // Also adds a new entry to the physical dir if appropriate. + if (handle == NULL) { ++ log_add (log_Info, "uio_open: open file failed '%s'", name); + int savedErrno = errno; + uio_free(name); + uio_PDirHandle_unref(pDirHandle); +diff --git a/src/libs/uio/zip/zip.c b/src/libs/uio/zip/zip.c +index 6da462b..cece03c 100644 +--- a/src/libs/uio/zip/zip.c ++++ b/src/libs/uio/zip/zip.c +@@ -1366,6 +1366,10 @@ zip_fillDirStructureProcessExtraFields(uio_FileBlock *fileBlock, + gPFileData->gid = (uid_t) makeUInt16(buf[12], buf[13]); + break; + } ++ case 0x7875: // 'Unix string UID/GID' ++ // Just skip it ++ break; ++ + default: + #ifdef DEBUG + fprintf(stderr, "Debug: Extra field 0x%04x unsupported, " +diff --git a/src/options.c b/src/options.c +index 7558f60..83b73db 100644 +--- a/src/options.c ++++ b/src/options.c +@@ -67,6 +67,7 @@ BOOLEAN optNebulae; + BOOLEAN optRotatingIpPlanets; + BOOLEAN optTexturedIpPlanets; + BOOLEAN optCheatMode; ++BOOLEAN optDirectionalJoystick; -- if (!CurrentInputState.key[PlayerControls[0]][KEY_UP]) -+ if (!(InputState & BATTLE_THRUST)) - { - dx = 0; - dy = 0; -@@ -2212,7 +2212,9 @@ - landerInputState.Initialized = FALSE; - landerInputState.InputFunc = DoPlanetSide; - SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); -+ TFB_SetOnScreenKeyboard_Melee (); - DoInput (&landerInputState, FALSE); -+ TFB_SetOnScreenKeyboard_Menu (); - - if (!(GLOBAL (CurrentActivity) & CHECK_ABORT)) - { -Index: uqm/planets/solarsys.c -=================================================================== ---- uqm/planets/solarsys.c (revision 1353) -+++ uqm/planets/solarsys.c (working copy) -@@ -1245,18 +1245,19 @@ - static void - ProcessShipControls (void) - { -- COUNT index; -+ COUNT index = GetFrameIndex (GLOBAL (ShipStamp.frame));; - SIZE delta_x, delta_y; -+ BATTLE_INPUT_STATE InputState = GetDirectionalJoystickInput(index, 0); - -- if (CurrentInputState.key[PlayerControls[0]][KEY_UP]) -+ if (InputState & BATTLE_THRUST) - delta_y = -1; - else - delta_y = 0; - - delta_x = 0; -- if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT]) -+ if (InputState & BATTLE_LEFT) - delta_x -= 1; -- if (CurrentInputState.key[PlayerControls[0]][KEY_RIGHT]) -+ if (InputState & BATTLE_RIGHT) - delta_x += 1; + BOOLEAN opt3doMusic; + BOOLEAN optRemixMusic; +@@ -482,6 +483,7 @@ mountDirZips (uio_DirHandle *dirHandle, const char *mountPoint, - if (delta_x || delta_y < 0) -@@ -1269,7 +1270,6 @@ - else - delta_y = 0; - -- index = GetFrameIndex (GLOBAL (ShipStamp.frame)); - if (pSolarSysState->turn_counter) - --pSolarSysState->turn_counter; - else if (delta_x) -@@ -2473,7 +2473,9 @@ - InitSolarSys (); - SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); - SolarSysState.InputFunc = DoIpFlight; -+ TFB_SetOnScreenKeyboard_Melee (); - DoInput (&SolarSysState, FALSE); -+ TFB_SetOnScreenKeyboard_Menu (); - UninitSolarSys (); - pSolarSysState = 0; - } -@@ -2751,13 +2753,17 @@ - - if (pSS->InOrbit) - { // CheckShipLocation() or InitSolarSys() sent us to orbital -+ TFB_SetOnScreenKeyboard_Menu (); - EnterPlanetOrbit (); -+ TFB_SetOnScreenKeyboard_Melee (); - SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); - pSS->InOrbit = FALSE; - } - else if (cancel || LastActivity == CHECK_LOAD) - { -+ TFB_SetOnScreenKeyboard_Menu (); - SolarSysMenu (); -+ TFB_SetOnScreenKeyboard_Melee (); - SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); - } - else -Index: uqm/planets/pstarmap.c -=================================================================== ---- uqm/planets/pstarmap.c (revision 1353) -+++ uqm/planets/pstarmap.c (working copy) -@@ -2005,7 +2005,9 @@ - SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); - SetMenuRepeatDelay (MIN_ACCEL_DELAY, MAX_ACCEL_DELAY, STEP_ACCEL_DELAY, - TRUE); -+ TFB_SetOnScreenKeyboard_Starmap (); - DoInput (&MenuState, FALSE); -+ TFB_SetOnScreenKeyboard_Menu (); - SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); - SetDefaultMenuRepeatDelay (); - -Index: uqm/shipstat.c -=================================================================== ---- uqm/shipstat.c (revision 1353) -+++ uqm/shipstat.c (working copy) -@@ -144,6 +144,45 @@ - DrawFilledRectangle (&r); - } - -+static void -+DrawCrewEnergyBoxOutline (RECT *box) -+{ -+ RECT r; -+ -+ SetContextForeGroundColor ( -+ BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19)); -+ r.corner.x = box->corner.x; -+ r.corner.y = box->corner.y + box->extent.height - 1; -+ r.extent.width = box->extent.width; -+ r.extent.height = 1; -+ DrawFilledRectangle (&r); -+ r.corner.x = box->corner.x + box->extent.width - 1; -+ r.corner.y = box->corner.y; -+ r.extent.width = 1; -+ r.extent.height = box->extent.height; -+ DrawFilledRectangle (&r); -+ -+ SetContextForeGroundColor ( -+ BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F)); -+ r.corner.x = box->corner.x; -+ r.corner.y = box->corner.y; -+ r.extent.width = box->extent.width; -+ r.extent.height = 1; -+ DrawFilledRectangle (&r); -+ r.corner.x = box->corner.x; -+ r.corner.y = box->corner.y; -+ r.extent.width = 1; -+ r.extent.height = box->extent.height; -+ DrawFilledRectangle (&r); -+ -+ SetContextForeGroundColor (BLACK_COLOR); -+ r.corner.x = box->corner.x + 1; -+ r.corner.y = box->corner.y + 1; -+ r.extent.width = box->extent.width - 2; -+ r.extent.height = box->extent.height - 2; -+ DrawFilledRectangle (&r); -+} -+ - void - InitShipStatus (SHIP_INFO *SIPtr, STARSHIP *StarShipPtr, RECT *pClipRect, BOOLEAN inMeleeMenu) - { -@@ -256,6 +295,28 @@ - r.extent.height = energy_height; - r.corner.y = y - r.extent.height + GAUGE_YOFFS + 1; - DrawFilledRectangle (&r); -+ -+ // TODO: replace the above ugly code with DrawCrewEnergyBoxOutline(), but I don't want to touch that as long as it works -+ r.corner.x = RESOLUTION_FACTOR == 2 ? 3 : RESOLUTION_FACTOR; -+ r.corner.y = BAD_GUY_HORIZ_CREW_YOFFS; -+ if (StarShipPtr && StarShipPtr->playerNr == RPG_PLAYER_NUM) -+ r.corner.y = GOOD_GUY_HORIZ_CREW_YOFFS; -+ r.corner.y += RESOLUTION_FACTOR == 2 ? 3 : RESOLUTION_FACTOR; -+ r.extent.width = 1000; -+ r.extent.height = STAT_WIDTH + (2 << RESOLUTION_FACTOR); -+ SetContextForeGroundColor (BLACK_COLOR); -+ DrawFilledRectangle (&r); -+ r.extent.width = crew_height + (2 << RESOLUTION_FACTOR); -+ DrawCrewEnergyBoxOutline (&r); -+ r.corner.y = BAD_GUY_HORIZ_ENERGY_YOFFS; -+ if (StarShipPtr && StarShipPtr->playerNr == RPG_PLAYER_NUM) -+ r.corner.y = GOOD_GUY_HORIZ_ENERGY_YOFFS; -+ r.corner.y += RESOLUTION_FACTOR == 2 ? 3 : RESOLUTION_FACTOR; -+ r.extent.width = 1000; -+ SetContextForeGroundColor (BLACK_COLOR); -+ DrawFilledRectangle (&r); -+ r.extent.width = energy_height + (2 << RESOLUTION_FACTOR); -+ DrawCrewEnergyBoxOutline (&r); - } - - if (!StarShipPtr || StarShipPtr->captains_name_index) -@@ -315,7 +376,7 @@ - // DeltaStatistics() below will add specified values to these - SIPtr->crew_level = 0; - SIPtr->energy_level = 0; -- DeltaStatistics (SIPtr, y, crew_delta, energy_delta); -+ DeltaStatistics (SIPtr, y, crew_delta, energy_delta, StarShipPtr ? StarShipPtr->playerNr : NPC_PLAYER_NUM); - } - - UnbatchGraphics (); -@@ -333,10 +394,11 @@ - // crew_delta <= ShipInfoPtr->max_crew - ShipInfoPtr->crew_level - void - DeltaStatistics (SHIP_INFO *ShipInfoPtr, COORD y_offs, -- SIZE crew_delta, SIZE energy_delta) -+ SIZE crew_delta, SIZE energy_delta, SIZE player_num) - { -- COORD x, y; -- RECT r; -+ COORD x, y, y2; -+ RECT r, r2; -+ SIZE max_crew_size, max_energy_size; - - if (crew_delta == 0 && energy_delta == 0) - return; -@@ -346,13 +408,15 @@ - - r.extent.width = UNIT_WIDTH; - r.extent.height = UNIT_HEIGHT; -+#define MIN(a, b) (((a) <= (b)) ? (a) : (b)) -+ max_crew_size = MIN(ShipInfoPtr->max_crew, MAX_CREW_SIZE); -+ max_energy_size = ShipInfoPtr->max_energy; - - if (crew_delta != 0) - { - COUNT oldNumBlocks, newNumBlocks, blockI; - COUNT newCrewLevel; - --#define MIN(a, b) (((a) <= (b)) ? (a) : (b)) - oldNumBlocks = MIN(ShipInfoPtr->crew_level, MAX_CREW_SIZE); - newCrewLevel = ShipInfoPtr->crew_level + crew_delta; - newNumBlocks = MIN(newCrewLevel, MAX_CREW_SIZE); -@@ -419,10 +483,33 @@ - // Always print a number for the SIS in the full game. - DrawBattleCrewAmount (ShipInfoPtr, y_offs); - } -+ -+ y2 = BAD_GUY_HORIZ_CREW_YOFFS; -+ if (player_num == RPG_PLAYER_NUM) -+ y2 = GOOD_GUY_HORIZ_CREW_YOFFS; -+ -+ r2.extent.height = UNIT_WIDTH; -+ r2.extent.width = UNIT_HEIGHT; -+ -+ for (blockI = 0; blockI < max_crew_size; blockI++) -+ { -+ SetContextForeGroundColor ( -+ (ShipInfoPtr->ship_flags & CREW_IMMUNE) ? -+ ROBOT_UNIT_COLOR : CREW_UNIT_COLOR); -+ if (blockI >= newNumBlocks) -+ SetContextForeGroundColor (BLACK_COLOR); -+ -+ r2.corner.x = HORIZ_CREW_XOFFS + (blockI >> 1) * (UNIT_HEIGHT + 1); -+ r2.corner.y = y2 + HORIZ_CREW_XOFFS; -+ if (blockI & 1) -+ r2.corner.y += UNIT_WIDTH + 1; -+ DrawFilledRectangle (&r2); -+ } - } - - if (energy_delta != 0) - { -+ COUNT blockI; - if (energy_delta > 0) + for (i = 0; i < dirList->numNames; i++) { - #define FUEL_UNIT_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04) -@@ -458,6 +545,26 @@ - --ShipInfoPtr->energy_level; - } while (++energy_delta); - } -+ -+ y2 = BAD_GUY_HORIZ_ENERGY_YOFFS; -+ if (player_num == RPG_PLAYER_NUM) -+ y2 = GOOD_GUY_HORIZ_ENERGY_YOFFS; -+ -+ r2.extent.height = UNIT_WIDTH; -+ r2.extent.width = UNIT_HEIGHT; -+ -+ for (blockI = 0; blockI < max_energy_size; blockI++) -+ { -+ SetContextForeGroundColor (FUEL_UNIT_COLOR); -+ if (blockI >= ShipInfoPtr->energy_level) -+ SetContextForeGroundColor (BLACK_COLOR); -+ -+ r2.corner.x = HORIZ_CREW_XOFFS + (blockI >> 1) * (UNIT_HEIGHT + 1); -+ r2.corner.y = y2 + HORIZ_CREW_XOFFS; -+ if (blockI & 1) -+ r2.corner.y += UNIT_WIDTH + 1; -+ DrawFilledRectangle (&r2); -+ } - } - } ++ log_add (log_Info, "Mounting ZIP '%s'", dirList->names[i]); + if (uio_mountDir (repository, mountPoint, uio_FSTYPE_ZIP, + dirHandle, dirList->names[i], "/", autoMount, + relativeFlags | uio_MOUNT_RDONLY, +diff --git a/src/options.h b/src/options.h +index 77343e2..0d6fae2 100644 +--- a/src/options.h ++++ b/src/options.h +@@ -54,6 +54,7 @@ extern BOOLEAN optNebulae; + extern BOOLEAN optRotatingIpPlanets; + extern BOOLEAN optTexturedIpPlanets; + extern BOOLEAN optCheatMode; ++extern BOOLEAN optDirectionalJoystick; -Index: uqm/setupmenu.c -=================================================================== ---- uqm/setupmenu.c (revision 1353) -+++ uqm/setupmenu.c (working copy) -@@ -83,7 +83,7 @@ + extern BOOLEAN opt3doMusic; + extern BOOLEAN optRemixMusic; +diff --git a/src/uqm.c b/src/uqm.c +index 55df02b..df6ddae 100644 +--- a/src/uqm.c ++++ b/src/uqm.c +@@ -63,6 +63,20 @@ + // Including this is actually necessary on OSX. #endif - #define MENU_COUNT 8 --#define CHOICE_COUNT 29 // JMS: New options added. -+#define CHOICE_COUNT 30 // JMS: New options added. - #define SLIDER_COUNT 3 - #define BUTTON_COUNT 10 - #define LABEL_COUNT 4 -@@ -106,7 +106,7 @@ - static int choice_widths[CHOICE_COUNT] = { - 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 3, 3, 2, 3, 3, -- 3, 2, 3, 2, 2, 2, 2, 2, 2 }; -+ 3, 2, 3, 2, 2, 2, 2, 2, 2, 2 }; ++#if defined (__ANDROID__) ++# include ++static void AndroidAppPutToBackgroundCallback (void) ++{ ++ SDL_ANDROID_PauseAudioPlayback (); ++ GameActive = FALSE; ++} ++static void SDLCALL AndroidAppRestoredCallback (void) ++{ ++ SDL_ANDROID_ResumeAudioPlayback (); ++ GameActive = TRUE; ++} ++#endif ++ + struct bool_option + { + bool value; +@@ -138,6 +152,7 @@ struct options_struct + DECL_CONFIG_OPTION(bool, rotatingIpPlanets); // JMS + DECL_CONFIG_OPTION(bool, texturedIpPlanets); // JMS + DECL_CONFIG_OPTION(bool, cheatMode); // JMS ++ DECL_CONFIG_OPTION(bool, directionalJoystick); - static HANDLER button_handlers[BUTTON_COUNT] = { - quit_main_menu, quit_sub_menu, do_graphics, do_engine, -@@ -117,7 +117,7 @@ - // JMS: The first 8 was 7 (sound options.) Added mainmenumusic on/off. - // JMS: The HAVE_OPENGL options were 5 and 4. Added cheatMode, mineralSubmenu, nebulae and planet options. - static int menu_sizes[MENU_COUNT] = { -- 7, 6, 8, 8, 2, 5, -+ 7, 6, 8, 8, 2, 6, - #ifdef HAVE_OPENGL - 10, - #else -@@ -185,6 +185,7 @@ - static WIDGET *keyconfig_widgets[] = { - (WIDGET *)(&choices[18]), - (WIDGET *)(&choices[19]), -+ (WIDGET *)(&choices[29]), // Directional joystick - (WIDGET *)(&labels[1]), - (WIDGET *)(&buttons[8]), - (WIDGET *)(&buttons[1]) }; -@@ -293,6 +294,8 @@ - if (event == WIDGET_EVENT_SELECT) - { - next = (WIDGET *)(&menus[5]); -+ if (getenv("OUYA")) -+ next = (WIDGET *)(&menus[4]); - (*next->receiveFocus) (next, WIDGET_EVENT_DOWN); - return TRUE; + #define INIT_CONFIG_OPTION(name, val) \ + { val, false } +@@ -257,8 +272,8 @@ main (int argc, char *argv[]) + INIT_CONFIG_OPTION( gamma, 0.0f ), + INIT_CONFIG_OPTION( soundDriver, audio_DRIVER_MIXSDL ), + INIT_CONFIG_OPTION( soundQuality, audio_QUALITY_HIGH ), +- INIT_CONFIG_OPTION( use3doMusic, true ), +- INIT_CONFIG_OPTION( useRemixMusic, false ), ++ INIT_CONFIG_OPTION( use3doMusic, false ), ++ INIT_CONFIG_OPTION( useRemixMusic, true ), + INIT_CONFIG_OPTION( whichCoarseScan, OPT_3DO ), + INIT_CONFIG_OPTION( whichMenu, OPT_3DO ), + INIT_CONFIG_OPTION( whichFonts, OPT_PC ), +@@ -272,15 +287,16 @@ main (int argc, char *argv[]) + INIT_CONFIG_OPTION( sfxVolumeScale, 0.8f ), + INIT_CONFIG_OPTION( speechVolumeScale, 0.9f ), + INIT_CONFIG_OPTION( safeMode, false ), +- INIT_CONFIG_OPTION( resolutionFactor, 2 ), ++ INIT_CONFIG_OPTION( resolutionFactor, 1 ), + INIT_CONFIG_OPTION( forceAspectRatio, false ), + INIT_CONFIG_OPTION( loresBlowupScale, 0 ), + INIT_CONFIG_OPTION( mainmenuMusic, true ), +- INIT_CONFIG_OPTION( mineralSubmenu, true ), ++ INIT_CONFIG_OPTION( mineralSubmenu, false ), + INIT_CONFIG_OPTION( nebulae, true ), + INIT_CONFIG_OPTION( rotatingIpPlanets, true), + INIT_CONFIG_OPTION( texturedIpPlanets, true), + INIT_CONFIG_OPTION( cheatMode, false ), ++ INIT_CONFIG_OPTION( directionalJoystick, true ), + }; + struct options_struct defaults = options; + int optionsResult; +@@ -351,6 +367,14 @@ main (int argc, char *argv[]) + return optionsResult; } -@@ -414,6 +417,7 @@ - choices[26].selected = opts.rotatingIpPlanets; // JMS - choices[27].selected = opts.texturedIpPlanets || opts.rotatingIpPlanets; // JMS - choices[28].selected = opts.cheatMode; // JMS -+ choices[29].selected = opts.directionalJoystick; - - sliders[0].value = opts.musicvol; - sliders[1].value = opts.sfxvol; -@@ -452,6 +456,7 @@ - opts.rotatingIpPlanets = choices[26].selected; // JMS - opts.texturedIpPlanets = choices[27].selected || opts.rotatingIpPlanets; // JMS - opts.cheatMode = choices[28].selected; // JMS -+ opts.directionalJoystick = choices[29].selected; - - opts.musicvol = sliders[0].value; - opts.sfxvol = sliders[1].value; -@@ -1164,6 +1169,7 @@ - opts->rotatingIpPlanets = optRotatingIpPlanets ? OPTVAL_ENABLED : OPTVAL_DISABLED; - opts->texturedIpPlanets = (optTexturedIpPlanets ? OPTVAL_ENABLED : OPTVAL_DISABLED) || opts->rotatingIpPlanets; - opts->cheatMode = optCheatMode ? OPTVAL_ENABLED : OPTVAL_DISABLED; -+ opts->directionalJoystick = optDirectionalJoystick ? OPTVAL_ENABLED : OPTVAL_DISABLED; - - /* Work out resolution. On the way, try to guess a good default - * for config.alwaysgl, then overwrite it if it was set previously. */ -@@ -1376,6 +1382,9 @@ - res_PutBoolean ("config.cheatMode", opts->cheatMode == OPTVAL_ENABLED); - optCheatMode = opts->cheatMode == OPTVAL_ENABLED; - -+ res_PutBoolean ("config.directionaljoystick", opts->directionalJoystick == OPTVAL_ENABLED); -+ optDirectionalJoystick = (opts->directionalJoystick == OPTVAL_ENABLED) ? TRUE : FALSE; -+ - if (NewWidth == 320 && NewHeight == 240) - { - switch (opts->scaler) -Index: uqm/setupmenu.h -=================================================================== ---- uqm/setupmenu.h (revision 1353) -+++ uqm/setupmenu.h (working copy) -@@ -86,7 +86,7 @@ - OPT_CONSOLETYPE menu, text, cscan, scroll, intro, meleezoom, shield; - CONTROL_TEMPLATE player1, player2; - int speechvol, musicvol, sfxvol; -- BOOLEAN mainmenuMusic, mineralSubmenu, nebulae, rotatingIpPlanets, texturedIpPlanets, cheatMode; // JMS -+ BOOLEAN mainmenuMusic, mineralSubmenu, nebulae, rotatingIpPlanets, texturedIpPlanets, cheatMode, directionalJoystick; // JMS - } GLOBALOPTS; - void SetupMenu (void); -Index: uqm/gameinp.c -=================================================================== ---- uqm/gameinp.c (revision 1353) -+++ uqm/gameinp.c (working copy) ++#if defined (ANDROID) ++ SDL_ANDROID_SetApplicationPutToBackgroundCallback (AndroidAppPutToBackgroundCallback, AndroidAppRestoredCallback); ++ if( !fileExists("config/save") ) { ++ // Copy savegames from UQM non-HD, I'm too lazy to do that properly. ++ system("SAVEDIR=`pwd`/config/save ; mkdir -p $SAVEDIR ; cd ../../../../app-data/com.sourceforge.sc2/config/save || exit 1 ; for f in * ; do cat $f > $SAVEDIR/$f ; done"); ++ } ++#endif ++ + TFB_PreInit (); + mem_init (); + InitThreadSystem (); +@@ -418,6 +442,7 @@ main (int argc, char *argv[]) + optRotatingIpPlanets = options.rotatingIpPlanets.value; // JMS + optTexturedIpPlanets = options.texturedIpPlanets.value || optRotatingIpPlanets; // JMS + optCheatMode = options.cheatMode.value; // JMS ++ optDirectionalJoystick = options.directionalJoystick.value; + + prepareContentDir (options.contentDir, options.addonDir, argv[0]); + prepareMeleeDir (); +@@ -701,6 +726,7 @@ getUserConfigOptions (struct options_struct *options) + getBoolConfigValue (&options->rotatingIpPlanets, "config.rotatingIpPlanets"); + getBoolConfigValue (&options->texturedIpPlanets, "config.texturedIpPlanets"); + getBoolConfigValue (&options->cheatMode, "config.cheatMode"); ++ getBoolConfigValue (&options->directionalJoystick, "config.directionaljoystick"); + + if (res_IsInteger ("config.player1control")) + { +diff --git a/src/uqm/battle.c b/src/uqm/battle.c +index 7774aaa..2ada2e7 100644 +--- a/src/uqm/battle.c ++++ b/src/uqm/battle.c +@@ -16,6 +16,10 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + ++#ifdef ANDROID ++#include ++#endif ++ + #include "battle.h" + + #include "battlecontrols.h" +@@ -43,6 +47,8 @@ + #include "libs/graphics/gfx_common.h" + #include "libs/log.h" + #include "libs/mathlib.h" ++#include "globdata.h" ++#include "libs/input/sdl/vcontrol.h" + + + BYTE battle_counter[NUM_SIDES]; +@@ -137,7 +143,8 @@ BATTLE_INPUT_STATE + frameInputHuman (HumanInputContext *context, STARSHIP *StarShipPtr) + { + (void) StarShipPtr; +- return CurrentInputToBattleInput (context->playerNr); ++ ++ return CurrentInputToBattleInput (context->playerNr, StarShipPtr ? StarShipPtr->ShipFacing : -1); + } + + static void +@@ -207,8 +214,11 @@ ProcessInput (void) + StarShipPtr->ship_input_state |= SPECIAL; + + if (CanRunAway && cur_player == 0 && +- (InputState & BATTLE_ESCAPE)) ++ ((InputState & BATTLE_ESCAPE) || EmergencyEscapeWarpUnitActivatedFromMenu)) ++ { ++ EmergencyEscapeWarpUnitActivatedFromMenu = FALSE; + DoRunAway (StarShipPtr); ++ } + } + } + +@@ -399,6 +409,11 @@ Battle (BattleFrameCallback *callback) + + LockMutex (GraphicsLock); + ++ TFB_SetOnScreenKeyboard_Melee (); ++ if (PlayerControl[1] & HUMAN_CONTROL) { ++ TFB_SetOnScreenKeyboard_TwoPlayersMelee (); ++ } ++ + #if !(DEMO_MODE || CREATE_JOURNAL) + if (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE) { + // In Supermelee, the RNG is already initialised. +@@ -512,6 +527,8 @@ AbortBattle: + UninitShips (); + FreeBattleSong (); + ++ TFB_SetOnScreenKeyboard_Menu (); ++ + UnlockMutex (GraphicsLock); + + return (BOOLEAN) (num_ships < 0); +diff --git a/src/uqm/comm/arilou/arilouc.c b/src/uqm/comm/arilou/arilouc.c +index 0893517..76a9d20 100644 +--- a/src/uqm/comm/arilou/arilouc.c ++++ b/src/uqm/comm/arilou/arilouc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../arilou/strings.h" + + #include "uqm/gameev.h" + +diff --git a/src/uqm/comm/blackur/blackurc.c b/src/uqm/comm/blackur/blackurc.c +index a500455..edc3350 100644 +--- a/src/uqm/comm/blackur/blackurc.c ++++ b/src/uqm/comm/blackur/blackurc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../blackur/strings.h" + + static LOCDATA blackurq_desc = + { +diff --git a/src/uqm/comm/chmmr/chmmrc.c b/src/uqm/comm/chmmr/chmmrc.c +index 8c9f677..b5251df 100644 +--- a/src/uqm/comm/chmmr/chmmrc.c ++++ b/src/uqm/comm/chmmr/chmmrc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../chmmr/strings.h" + + #include "uqm/build.h" + #include "uqm/hyper.h" +diff --git a/src/uqm/comm/comandr/comandr.c b/src/uqm/comm/comandr/comandr.c +index 840b132..4079649 100644 +--- a/src/uqm/comm/comandr/comandr.c ++++ b/src/uqm/comm/comandr/comandr.c +@@ -20,7 +20,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../comandr/strings.h" + + #include "uqm/setup.h" + #include "uqm/sis.h" +diff --git a/src/uqm/comm/druuge/druugec.c b/src/uqm/comm/druuge/druugec.c +index 63e57f4..d6e28e4 100644 +--- a/src/uqm/comm/druuge/druugec.c ++++ b/src/uqm/comm/druuge/druugec.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../druuge/strings.h" + + #include "uqm/build.h" + #include "uqm/setup.h" +diff --git a/src/uqm/comm/ilwrath/ilwrathc.c b/src/uqm/comm/ilwrath/ilwrathc.c +index a8b5634..9f679e0 100644 +--- a/src/uqm/comm/ilwrath/ilwrathc.c ++++ b/src/uqm/comm/ilwrath/ilwrathc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../ilwrath/strings.h" + + #include "uqm/gameev.h" + +diff --git a/src/uqm/comm/melnorm/melnorm.c b/src/uqm/comm/melnorm/melnorm.c +index 039dd92..f566b71 100644 +--- a/src/uqm/comm/melnorm/melnorm.c ++++ b/src/uqm/comm/melnorm/melnorm.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../melnorm/strings.h" + + #include "uqm/gameev.h" + #include "uqm/setup.h" +diff --git a/src/uqm/comm/mycon/myconc.c b/src/uqm/comm/mycon/myconc.c +index 141c5f5..f719e36 100644 +--- a/src/uqm/comm/mycon/myconc.c ++++ b/src/uqm/comm/mycon/myconc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../mycon/strings.h" + + #include "uqm/gameev.h" + #include "libs/mathlib.h" +diff --git a/src/uqm/comm/orz/orzc.c b/src/uqm/comm/orz/orzc.c +index 2e27f04..cd89f7c 100644 +--- a/src/uqm/comm/orz/orzc.c ++++ b/src/uqm/comm/orz/orzc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../orz/strings.h" + + #include "uqm/build.h" + +diff --git a/src/uqm/comm/pkunk/pkunkc.c b/src/uqm/comm/pkunk/pkunkc.c +index 31a42b4..892dff1 100644 +--- a/src/uqm/comm/pkunk/pkunkc.c ++++ b/src/uqm/comm/pkunk/pkunkc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../pkunk/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +diff --git a/src/uqm/comm/rebel/rebel.c b/src/uqm/comm/rebel/rebel.c +index d3b315d..f6ec6fe 100644 +--- a/src/uqm/comm/rebel/rebel.c ++++ b/src/uqm/comm/rebel/rebel.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "../yehat/resinst.h" +-#include "strings.h" ++#include "../rebel/strings.h" + + #include "uqm/build.h" + +diff --git a/src/uqm/comm/shofixt/shofixt.c b/src/uqm/comm/shofixt/shofixt.c +index 3bbe863..742afdf 100644 +--- a/src/uqm/comm/shofixt/shofixt.c ++++ b/src/uqm/comm/shofixt/shofixt.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../shofixt/strings.h" + + #include "uqm/gameev.h" + +diff --git a/src/uqm/comm/slyhome/slyhome.c b/src/uqm/comm/slyhome/slyhome.c +index e52b6b2..e5f6145 100644 +--- a/src/uqm/comm/slyhome/slyhome.c ++++ b/src/uqm/comm/slyhome/slyhome.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../slyhome/strings.h" + + #include "uqm/gameev.h" + +diff --git a/src/uqm/comm/slyland/slyland.c b/src/uqm/comm/slyland/slyland.c +index 89ee639..7202fbb 100644 +--- a/src/uqm/comm/slyland/slyland.c ++++ b/src/uqm/comm/slyland/slyland.c +@@ -16,10 +16,10 @@ + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +-#include "../commall.h" ++#include "../slyland/strings.h" + #include ++#include "../commall.h" + #include "resinst.h" +-#include "strings.h" + + #include "options.h" + #include "uqm/battle.h" +diff --git a/src/uqm/comm/spahome/spahome.c b/src/uqm/comm/spahome/spahome.c +index 126b02b..0b54d24 100644 +--- a/src/uqm/comm/spahome/spahome.c ++++ b/src/uqm/comm/spahome/spahome.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "../spathi/resinst.h" +-#include "strings.h" ++#include "../spahome/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +diff --git a/src/uqm/comm/spathi/spathic.c b/src/uqm/comm/spathi/spathic.c +index 2b7fbc0..54ab3c8 100644 +--- a/src/uqm/comm/spathi/spathic.c ++++ b/src/uqm/comm/spathi/spathic.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../spathi/strings.h" + + #include "uqm/build.h" + +diff --git a/src/uqm/comm/starbas/starbas.c b/src/uqm/comm/starbas/starbas.c +index 4120bf7..323515e 100644 +--- a/src/uqm/comm/starbas/starbas.c ++++ b/src/uqm/comm/starbas/starbas.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "../comandr/resinst.h" +-#include "strings.h" ++#include "../starbas/strings.h" + + #include "uqm/build.h" + #include "uqm/setup.h" +diff --git a/src/uqm/comm/supox/supoxc.c b/src/uqm/comm/supox/supoxc.c +index d0cbef0..c697663 100644 +--- a/src/uqm/comm/supox/supoxc.c ++++ b/src/uqm/comm/supox/supoxc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../supox/strings.h" + + #include "uqm/build.h" + +diff --git a/src/uqm/comm/syreen/syreenc.c b/src/uqm/comm/syreen/syreenc.c +index 9bda01b..6b02c84 100644 +--- a/src/uqm/comm/syreen/syreenc.c ++++ b/src/uqm/comm/syreen/syreenc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../syreen/strings.h" + + #include "libs/sound/sound.h" + #include "uqm/build.h" +diff --git a/src/uqm/comm/talkpet/talkpet.c b/src/uqm/comm/talkpet/talkpet.c +index f03a945..d9e7eb4 100644 +--- a/src/uqm/comm/talkpet/talkpet.c ++++ b/src/uqm/comm/talkpet/talkpet.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../talkpet/strings.h" + + #include "uqm/build.h" + +diff --git a/src/uqm/comm/thradd/thraddc.c b/src/uqm/comm/thradd/thraddc.c +index d3d3116..ea5c66e 100644 +--- a/src/uqm/comm/thradd/thraddc.c ++++ b/src/uqm/comm/thradd/thraddc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../thradd/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +diff --git a/src/uqm/comm/umgah/umgahc.c b/src/uqm/comm/umgah/umgahc.c +index 495260c..aaba2a5 100644 +--- a/src/uqm/comm/umgah/umgahc.c ++++ b/src/uqm/comm/umgah/umgahc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../umgah/strings.h" + + #include "uqm/build.h" + +diff --git a/src/uqm/comm/urquan/urquanc.c b/src/uqm/comm/urquan/urquanc.c +index c14029c..0f08db9 100644 +--- a/src/uqm/comm/urquan/urquanc.c ++++ b/src/uqm/comm/urquan/urquanc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../urquan/strings.h" + + static LOCDATA urquan_desc = + { +diff --git a/src/uqm/comm/utwig/utwigc.c b/src/uqm/comm/utwig/utwigc.c +index 42949af..c5af5b2 100644 +--- a/src/uqm/comm/utwig/utwigc.c ++++ b/src/uqm/comm/utwig/utwigc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../utwig/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +diff --git a/src/uqm/comm/vux/vuxc.c b/src/uqm/comm/vux/vuxc.c +index 1345c6f..9b0019a 100644 +--- a/src/uqm/comm/vux/vuxc.c ++++ b/src/uqm/comm/vux/vuxc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../vux/strings.h" + + static LOCDATA vux_desc_1x = + { +diff --git a/src/uqm/comm/yehat/yehatc.c b/src/uqm/comm/yehat/yehatc.c +index c67ea27..f025d68 100644 +--- a/src/uqm/comm/yehat/yehatc.c ++++ b/src/uqm/comm/yehat/yehatc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../yehat/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +diff --git a/src/uqm/comm/zoqfot/zoqfotc.c b/src/uqm/comm/zoqfot/zoqfotc.c +index e2f8265..8c5984e 100644 +--- a/src/uqm/comm/zoqfot/zoqfotc.c ++++ b/src/uqm/comm/zoqfot/zoqfotc.c +@@ -18,7 +18,7 @@ + + #include "../commall.h" + #include "resinst.h" +-#include "strings.h" ++#include "../zoqfot/strings.h" + + #include "uqm/build.h" + #include "uqm/gameev.h" +diff --git a/src/uqm/confirm.c b/src/uqm/confirm.c +index b7c386c..f66ff60 100644 +--- a/src/uqm/confirm.c ++++ b/src/uqm/confirm.c +@@ -34,9 +34,11 @@ + #include + + +-#define CONFIRM_WIN_WIDTH (80 << RESOLUTION_FACTOR) // JMS_GFX ++#define CONFIRM_WIN_WIDTH (160 << RESOLUTION_FACTOR) // JMS_GFX + #define CONFIRM_WIN_HEIGHT (22 << RESOLUTION_FACTOR) // JMS_GFX + ++BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu = FALSE; ++ + static void + DrawConfirmationWindow (BOOLEAN answer) + { +@@ -67,6 +69,8 @@ DrawConfirmationWindow (BOOLEAN answer) + font_DrawText (&t); + t.baseline.x += (r.extent.width >> 1); + t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 2); // "No" ++ if (GLOBAL (CurrentActivity) & IN_BATTLE) ++ t.pStr = "Escape unit"; // GAME_STRING (QUITMENU_STRING_BASE + 3); // TODO: modify gamestrings.txt + SetContextForeGroundColor (answer ? MENU_TEXT_COLOR : MENU_HIGHLIGHT_COLOR); + font_DrawText (&t); + +@@ -111,8 +115,16 @@ DoConfirmExit (void) + + FlushInput (); + done = FALSE; ++ ++ #ifdef ANDROID ++ if ( !(GLOBAL (CurrentActivity) & IN_BATTLE) ) { ++ /* Abort immediately */ ++ response = TRUE; ++ done = TRUE; ++ } ++ #endif + +- do { ++ while (!done) { + // Forbid recursive calls or pausing here! + ExitRequested = FALSE; + GamePaused = FALSE; +@@ -139,7 +151,7 @@ DoConfirmExit (void) + PlayMenuSound (MENU_SOUND_MOVE); + } + SleepThread (ONE_SECOND / 30); +- } while (!done); ++ } + + // Restore the screen under the confirmation window + DrawStamp (&s); +@@ -152,6 +164,8 @@ DoConfirmExit (void) + } + else + { ++ if (GLOBAL (CurrentActivity) & IN_BATTLE) ++ EmergencyEscapeWarpUnitActivatedFromMenu = TRUE; + result = FALSE; + } + ExitRequested = FALSE; +diff --git a/src/uqm/controls.h b/src/uqm/controls.h +index 594d8a6..dae3975 100644 +--- a/src/uqm/controls.h ++++ b/src/uqm/controls.h +@@ -32,6 +32,7 @@ enum { + KEY_WEAPON, + KEY_SPECIAL, + KEY_ESCAPE, ++ KEY_THRUST, + NUM_KEYS + }; + enum { +@@ -90,13 +91,14 @@ typedef UBYTE BATTLE_INPUT_STATE; + #define BATTLE_ESCAPE ((BATTLE_INPUT_STATE)(1 << 5)) + #define BATTLE_DOWN ((BATTLE_INPUT_STATE)(1 << 6)) + +-BATTLE_INPUT_STATE CurrentInputToBattleInput (COUNT player); ++BATTLE_INPUT_STATE CurrentInputToBattleInput (COUNT player, int direction /* = -1 for no directional input */); + BATTLE_INPUT_STATE PulsedInputToBattleInput (COUNT player); + + extern CONTROLLER_INPUT_STATE CurrentInputState; + extern CONTROLLER_INPUT_STATE PulsedInputState; + extern volatile CONTROLLER_INPUT_STATE ImmediateInputState; + extern CONTROL_TEMPLATE PlayerControls[]; ++extern BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu; + + void UpdateInputState (void); + extern void FlushInput (void); +@@ -116,6 +118,8 @@ BOOLEAN WaitForAnyButtonUntil (BOOLEAN newButton, TimeCount timeOut, + BOOLEAN WaitForNoInput (TimePeriod duration, BOOLEAN resetInput); + BOOLEAN WaitForNoInputUntil (TimeCount timeOut, BOOLEAN resetInput); + ++extern BATTLE_INPUT_STATE GetDirectionalJoystickInput(int direction, int player); ++ + void DoPopupWindow(const char *msg); + + typedef void (InputFrameCallback) (void); +diff --git a/src/uqm/gameinp.c b/src/uqm/gameinp.c +index 86a6c6c..0662e66 100644 +--- a/src/uqm/gameinp.c ++++ b/src/uqm/gameinp.c @@ -16,6 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ @@ -1129,24 +1352,21 @@ Index: uqm/gameinp.c #include "controls.h" #include "battlecontrols.h" #include "init.h" -@@ -32,11 +33,14 @@ - #include "libs/timelib.h" +@@ -33,8 +34,13 @@ #include "libs/threadlib.h" -- + // MB: Updated menu delay values so it no longer takes an age to (a) fill up your fuel tanks (b) fill up your crew (c) search through your saved games. +#ifdef ANDROID +#define ACCELERATION_INCREMENT (ONE_SECOND) +#define MENU_REPEAT_DELAY (ONE_SECOND) +#else - #define ACCELERATION_INCREMENT (ONE_SECOND / 12) - #define MENU_REPEAT_DELAY (ONE_SECOND / 2) + #define ACCELERATION_INCREMENT (ONE_SECOND / 28) + #define MENU_REPEAT_DELAY (ONE_SECOND / 3) +#endif -- + typedef struct - { - BOOLEAN (*InputFunc) (void *pInputState); -@@ -66,6 +70,7 @@ +@@ -66,6 +72,7 @@ volatile CONTROLLER_INPUT_STATE ImmediateInputState; volatile BOOLEAN ExitRequested; volatile BOOLEAN GamePaused; @@ -1154,7 +1374,7 @@ Index: uqm/gameinp.c static InputFrameCallback *inputCallback; -@@ -422,16 +427,10 @@ +@@ -422,16 +429,10 @@ GetMenuSounds (MENU_SOUND_FLAGS *s0, MENU_SOUND_FLAGS *s1) } static BATTLE_INPUT_STATE @@ -1172,7 +1392,7 @@ Index: uqm/gameinp.c if (keyState[KEY_WEAPON]) InputState |= BATTLE_WEAPON; if (keyState[KEY_SPECIAL]) -@@ -441,21 +440,35 @@ +@@ -441,21 +442,35 @@ ControlInputToBattleInput (const int *keyState) if (keyState[KEY_DOWN]) InputState |= BATTLE_DOWN; @@ -1211,7 +1431,7 @@ Index: uqm/gameinp.c } BOOLEAN -@@ -500,3 +513,144 @@ +@@ -500,3 +515,144 @@ ConfirmExit (void) return result; } @@ -1356,366 +1576,59 @@ Index: uqm/gameinp.c + } + return InputState; +} -Index: uqm/comm/supox/supoxc.c -=================================================================== ---- uqm/comm/supox/supoxc.c (revision 1353) -+++ uqm/comm/supox/supoxc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" +diff --git a/src/uqm/getchar.c b/src/uqm/getchar.c +index e2cc134..229914f 100644 +--- a/src/uqm/getchar.c ++++ b/src/uqm/getchar.c +@@ -27,6 +27,10 @@ #include "resinst.h" --#include "strings.h" -+#include "../supox/strings.h" + #include "nameref.h" - #include "uqm/build.h" ++#ifdef __ANDROID__ ++#include ++#endif ++ -Index: uqm/comm/vux/vuxc.c -=================================================================== ---- uqm/comm/vux/vuxc.c (revision 1353) -+++ uqm/comm/vux/vuxc.c (working copy) -@@ -18,7 +18,7 @@ + // TODO: This may be better done with UniChar at the cost of a tiny bit + // of overhead to convert UniChar back to UTF8 string. This overhead +@@ -141,6 +145,11 @@ DoTextEntry (TEXTENTRY_STATE *pTES) + { // init basic vars + int lwlen; - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../vux/strings.h" - - static LOCDATA vux_desc_1x = - { -Index: uqm/comm/zoqfot/zoqfotc.c -=================================================================== ---- uqm/comm/zoqfot/zoqfotc.c (revision 1353) -+++ uqm/comm/zoqfot/zoqfotc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../zoqfot/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/shofixt/shofixt.c -=================================================================== ---- uqm/comm/shofixt/shofixt.c (revision 1353) -+++ uqm/comm/shofixt/shofixt.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../shofixt/strings.h" - - #include "uqm/gameev.h" - -Index: uqm/comm/pkunk/pkunkc.c -=================================================================== ---- uqm/comm/pkunk/pkunkc.c (revision 1353) -+++ uqm/comm/pkunk/pkunkc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../pkunk/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/rebel/rebel.c -=================================================================== ---- uqm/comm/rebel/rebel.c (revision 1353) -+++ uqm/comm/rebel/rebel.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "../yehat/resinst.h" --#include "strings.h" -+#include "../rebel/strings.h" - - #include "uqm/build.h" - -Index: uqm/comm/arilou/arilouc.c -=================================================================== ---- uqm/comm/arilou/arilouc.c (revision 1353) -+++ uqm/comm/arilou/arilouc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../arilou/strings.h" - - #include "uqm/gameev.h" - -Index: uqm/comm/spahome/spahome.c -=================================================================== ---- uqm/comm/spahome/spahome.c (revision 1353) -+++ uqm/comm/spahome/spahome.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "../spathi/resinst.h" --#include "strings.h" -+#include "../spahome/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/starbas/starbas.c -=================================================================== ---- uqm/comm/starbas/starbas.c (revision 1353) -+++ uqm/comm/starbas/starbas.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "../comandr/resinst.h" --#include "strings.h" -+#include "../starbas/strings.h" - - #include "uqm/build.h" - #include "uqm/setup.h" -Index: uqm/comm/utwig/utwigc.c -=================================================================== ---- uqm/comm/utwig/utwigc.c (revision 1353) -+++ uqm/comm/utwig/utwigc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../utwig/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/umgah/umgahc.c -=================================================================== ---- uqm/comm/umgah/umgahc.c (revision 1353) -+++ uqm/comm/umgah/umgahc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../umgah/strings.h" - - #include "uqm/build.h" - -Index: uqm/comm/talkpet/talkpet.c -=================================================================== ---- uqm/comm/talkpet/talkpet.c (revision 1353) -+++ uqm/comm/talkpet/talkpet.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../talkpet/strings.h" - - #include "uqm/build.h" - -Index: uqm/comm/thradd/thraddc.c -=================================================================== ---- uqm/comm/thradd/thraddc.c (revision 1353) -+++ uqm/comm/thradd/thraddc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../thradd/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/melnorm/melnorm.c -=================================================================== ---- uqm/comm/melnorm/melnorm.c (revision 1353) -+++ uqm/comm/melnorm/melnorm.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../melnorm/strings.h" - - #include "uqm/gameev.h" - #include "uqm/setup.h" -Index: uqm/comm/yehat/yehatc.c -=================================================================== ---- uqm/comm/yehat/yehatc.c (revision 1353) -+++ uqm/comm/yehat/yehatc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../yehat/strings.h" - - #include "uqm/build.h" - #include "uqm/gameev.h" -Index: uqm/comm/orz/orzc.c -=================================================================== ---- uqm/comm/orz/orzc.c (revision 1353) -+++ uqm/comm/orz/orzc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../orz/strings.h" - - #include "uqm/build.h" - -Index: uqm/comm/urquan/urquanc.c -=================================================================== ---- uqm/comm/urquan/urquanc.c (revision 1353) -+++ uqm/comm/urquan/urquanc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../urquan/strings.h" - - static LOCDATA urquan_desc = - { -Index: uqm/comm/slyhome/slyhome.c -=================================================================== ---- uqm/comm/slyhome/slyhome.c (revision 1353) -+++ uqm/comm/slyhome/slyhome.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../slyhome/strings.h" - - #include "uqm/gameev.h" - -Index: uqm/comm/comandr/comandr.c -=================================================================== ---- uqm/comm/comandr/comandr.c (revision 1353) -+++ uqm/comm/comandr/comandr.c (working copy) -@@ -20,7 +20,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../comandr/strings.h" - - #include "uqm/setup.h" - #include "uqm/sis.h" -Index: uqm/comm/blackur/blackurc.c -=================================================================== ---- uqm/comm/blackur/blackurc.c (revision 1353) -+++ uqm/comm/blackur/blackurc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../blackur/strings.h" - - static LOCDATA blackurq_desc = - { -Index: uqm/comm/mycon/myconc.c -=================================================================== ---- uqm/comm/mycon/myconc.c (revision 1353) -+++ uqm/comm/mycon/myconc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../mycon/strings.h" - - #include "uqm/gameev.h" - #include "libs/mathlib.h" -Index: uqm/comm/spathi/spathic.c -=================================================================== ---- uqm/comm/spathi/spathic.c (revision 1353) -+++ uqm/comm/spathi/spathic.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../spathi/strings.h" - - #include "uqm/build.h" - -Index: uqm/comm/druuge/druugec.c -=================================================================== ---- uqm/comm/druuge/druugec.c (revision 1353) -+++ uqm/comm/druuge/druugec.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../druuge/strings.h" - - #include "uqm/build.h" - #include "uqm/setup.h" -Index: uqm/comm/syreen/syreenc.c -=================================================================== ---- uqm/comm/syreen/syreenc.c (revision 1353) -+++ uqm/comm/syreen/syreenc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../syreen/strings.h" - - #include "libs/sound/sound.h" - #include "uqm/build.h" -Index: uqm/comm/chmmr/chmmrc.c -=================================================================== ---- uqm/comm/chmmr/chmmrc.c (revision 1353) -+++ uqm/comm/chmmr/chmmrc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../chmmr/strings.h" - - #include "uqm/build.h" - #include "uqm/hyper.h" -Index: uqm/comm/slyland/slyland.c -=================================================================== ---- uqm/comm/slyland/slyland.c (revision 1353) -+++ uqm/comm/slyland/slyland.c (working copy) -@@ -16,10 +16,10 @@ - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -+#include "../slyland/strings.h" -+#include - #include "../commall.h" --#include - #include "resinst.h" --#include "strings.h" - - #include "options.h" - #include "uqm/battle.h" -Index: uqm/comm/ilwrath/ilwrathc.c -=================================================================== ---- uqm/comm/ilwrath/ilwrathc.c (revision 1353) -+++ uqm/comm/ilwrath/ilwrathc.c (working copy) -@@ -18,7 +18,7 @@ - - #include "../commall.h" - #include "resinst.h" --#include "strings.h" -+#include "../ilwrath/strings.h" - - #include "uqm/gameev.h" - -Index: uqm/hyper.c -=================================================================== ---- uqm/hyper.c (revision 1353) -+++ uqm/hyper.c (working copy) -@@ -1930,7 +1930,6 @@ ++#ifdef __ANDROID__ ++ SDL_ANDROID_ToggleScreenKeyboardTextInput (pTES->BaseStr); ++ pTES->BaseStr[0] = 0; ++#endif ++ + pTES->InputFunc = DoTextEntry; + pTES->Success = FALSE; + pTES->Initialized = TRUE; +@@ -198,7 +207,6 @@ DoTextEntry (TEXTENTRY_STATE *pTES) + CacheInsPt = pTES->InsPt; + CacheCursorPos = pTES->CursorPos; + memcpy (pTES->CacheStr, pTES->BaseStr, pTES->MaxSize); +- + // process the pending character buffer + ch = GetNextCharacter (); + if (!ch && PulsedInputState.menu[KEY_MENU_ANY]) +diff --git a/src/uqm/globdata.c b/src/uqm/globdata.c +index 0646d88..7bee0e0 100644 +--- a/src/uqm/globdata.c ++++ b/src/uqm/globdata.c +@@ -130,7 +130,7 @@ CreateRadar (void) + OldContext = SetContext (RadarContext); + SetContextFGFrame (Screen); + r.corner.x = RADAR_X; +- r.corner.y = RADAR_Y; ++ r.corner.y = RADAR_Y_LIFTED_UP; + r.extent.width = RADAR_WIDTH; + r.extent.height = RADAR_HEIGHT; + SetContextClipRect (&r); +diff --git a/src/uqm/hyper.c b/src/uqm/hyper.c +index 2e1f60d..4348ef7 100644 +--- a/src/uqm/hyper.c ++++ b/src/uqm/hyper.c +@@ -1962,7 +1962,6 @@ HyperspaceMenu (void) Color OldColor; CONTEXT OldContext; MENU_STATE MenuState; @@ -1723,10 +1636,27 @@ Index: uqm/hyper.c UnbatchGraphics (); OldContext = SetContext (SpaceContext); -Index: uqm/intro.c -=================================================================== ---- uqm/intro.c (revision 1353) -+++ uqm/intro.c (working copy) +diff --git a/src/uqm/intel.c b/src/uqm/intel.c +index eb58736..f1f5608 100644 +--- a/src/uqm/intel.c ++++ b/src/uqm/intel.c +@@ -45,10 +45,10 @@ computer_intelligence (ComputerInputContext *context, STARSHIP *StarShipPtr) + // Allow a player to warp-escape in cyborg mode + if (StarShipPtr->playerNr == RPG_PLAYER_NUM) + InputState |= CurrentInputToBattleInput ( +- context->playerNr) & BATTLE_ESCAPE; ++ context->playerNr, -1) & BATTLE_ESCAPE; + } + else +- InputState = CurrentInputToBattleInput (context->playerNr); ++ InputState = CurrentInputToBattleInput (context->playerNr, -1); + } + else if (!(PlayerControl[context->playerNr] & PSYTRON_CONTROL)) + InputState = 0; +diff --git a/src/uqm/intro.c b/src/uqm/intro.c +index 2e92f12..6e5a153 100644 +--- a/src/uqm/intro.c ++++ b/src/uqm/intro.c @@ -35,7 +35,7 @@ #include @@ -1736,7 +1666,7 @@ Index: uqm/intro.c typedef struct { -@@ -52,6 +52,7 @@ +@@ -52,6 +52,7 @@ typedef struct FONT Fonts[MAX_FONTS]; FRAME Frame; MUSIC_REF MusicRef; @@ -1744,7 +1674,7 @@ Index: uqm/intro.c BOOLEAN Batched; FRAME SisFrame; FRAME RotatedFrame; -@@ -285,10 +286,10 @@ +@@ -285,10 +286,10 @@ Present_DrawMovieFrame (PRESENTATION_INPUT_STATE* pPIS) } static BOOLEAN @@ -1757,7 +1687,7 @@ Index: uqm/intro.c DestroyStringTable (ReleaseStringTable (pres)); return result; } -@@ -518,14 +519,17 @@ +@@ -518,14 +519,17 @@ DoPresentation (void *pIS) } else if (strcmp (Opcode, "MUSIC") == 0) { /* set music */ @@ -1781,7 +1711,7 @@ Index: uqm/intro.c } else if (strcmp (Opcode, "WAIT") == 0) { /* wait */ -@@ -817,7 +821,7 @@ +@@ -817,7 +821,7 @@ DoPresentation (void *pIS) Present_UnbatchGraphics (pPIS, TRUE); utf8StringCopy (pPIS->Buffer, sizeof (pPIS->Buffer), pStr); @@ -1790,7 +1720,7 @@ Index: uqm/intro.c } else if (strcmp (Opcode, "LINE") == 0) { -@@ -880,12 +884,13 @@ +@@ -880,12 +884,13 @@ DoPresentation (void *pIS) } static BOOLEAN @@ -1805,7 +1735,7 @@ Index: uqm/intro.c int i; memset (&pis, 0, sizeof(pis)); -@@ -901,6 +906,24 @@ +@@ -901,6 +906,24 @@ ShowSlidePresentation (STRING PresStr) OldFont = SetContextFont (NULL); SetContextBackGroundColor (BLACK_COLOR); UnlockMutex (GraphicsLock); @@ -1830,7 +1760,7 @@ Index: uqm/intro.c SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); pis.InputFunc = DoPresentation; -@@ -909,7 +932,9 @@ +@@ -909,7 +932,9 @@ ShowSlidePresentation (STRING PresStr) pis.MovieFrame = -1; pis.StartTime = GetTimeCounter (); pis.LastSyncTime = pis.StartTime; @@ -1840,7 +1770,7 @@ Index: uqm/intro.c SleepThreadUntil (FadeMusic (0, ONE_SECOND)); StopMusic (); -@@ -1001,7 +1026,9 @@ +@@ -1001,7 +1026,9 @@ ShowLegacyVideo (LEGACY_VIDEO vid) vis.InputFunc = DoVideoInput; vis.CurVideo = ref; SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); @@ -1850,7 +1780,7 @@ Index: uqm/intro.c StopLegacyVideo (ref); FadeClearScreen (); -@@ -1017,10 +1044,11 @@ +@@ -1017,10 +1044,11 @@ ShowPresentation (RESOURCE res) { return FALSE; } @@ -1863,24 +1793,433 @@ Index: uqm/intro.c DestroyStringTable (ReleaseStringTable (pres)); return result; } -Index: uqm/globdata.c -=================================================================== ---- uqm/globdata.c (revision 1353) -+++ uqm/globdata.c (working copy) -@@ -130,7 +130,7 @@ - OldContext = SetContext (RadarContext); - SetContextFGFrame (Screen); - r.corner.x = RADAR_X; -- r.corner.y = RADAR_Y; -+ r.corner.y = RADAR_Y_LIFTED_UP; - r.extent.width = RADAR_WIDTH; - r.extent.height = RADAR_HEIGHT; - SetContextClipRect (&r); -Index: uqm/shipyard.c -=================================================================== ---- uqm/shipyard.c (revision 1353) -+++ uqm/shipyard.c (working copy) -@@ -212,9 +212,9 @@ +diff --git a/src/uqm/menu.c b/src/uqm/menu.c +index 0ae6466..2d43f12 100644 +--- a/src/uqm/menu.c ++++ b/src/uqm/menu.c +@@ -508,7 +508,7 @@ DrawMenuStateStrings (BYTE beg_index, SWORD NewState) + s.origin.x = RADAR_X - r.corner.x; + s.origin.y = RADAR_Y - r.corner.y; + r.corner.x = s.origin.x - 1; +- r.corner.y = s.origin.y - (11 << RESOLUTION_FACTOR); // JMS_GFX ++ r.corner.y = s.origin.y - (40 << RESOLUTION_FACTOR); // JMS_GFX + r.extent.width = RADAR_WIDTH + 2; + BatchGraphics (); + SetContextForeGroundColor ( +diff --git a/src/uqm/outfit.c b/src/uqm/outfit.c +index 44c0d87..48b4740 100644 +--- a/src/uqm/outfit.c ++++ b/src/uqm/outfit.c +@@ -59,7 +59,7 @@ DrawModuleStrings (MENU_STATE *pMS, BYTE NewModule) + OldContext = SetContext (StatusContext); + GetContextClipRect (&r); + s.origin.x = RADAR_X - r.corner.x; +- s.origin.y = RADAR_Y - r.corner.y - 19 * RESOLUTION_FACTOR; // JMS_GFX; ++ s.origin.y = RADAR_Y_LIFTED_UP - r.corner.y + RES_CASE(10,6,12); // JMS_GFX; + r.corner.x = s.origin.x - 1; + r.corner.y = s.origin.y - 11; + r.extent.width = RADAR_WIDTH + 2; +diff --git a/src/uqm/planets/lander.c b/src/uqm/planets/lander.c +index 9ba5afd..7e4d1cb 100644 +--- a/src/uqm/planets/lander.c ++++ b/src/uqm/planets/lander.c +@@ -1852,15 +1852,15 @@ landerSpeedNumer = WORLD_TO_VELOCITY (48 << RESOLUTION_FACTOR); // JMS + if (crew_left) + { + SIZE index = GetFrameIndex (LanderFrame[0]); ++ BATTLE_INPUT_STATE InputState = GetDirectionalJoystickInput(index, 0); + if (turn_wait) + --turn_wait; +- else if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT] || +- CurrentInputState.key[PlayerControls[0]][KEY_RIGHT]) ++ else if ((InputState & BATTLE_LEFT) || (InputState & BATTLE_RIGHT)) + { + COUNT landerSpeedNumer; + COUNT angle; + +- if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT]) ++ if (InputState & BATTLE_LEFT) + --index; + else + ++index; +@@ -1884,7 +1884,7 @@ landerSpeedNumer = WORLD_TO_VELOCITY (48 << RESOLUTION_FACTOR); + turn_wait = SHUTTLE_TURN_WAIT; + } + +- if (!CurrentInputState.key[PlayerControls[0]][KEY_UP]) ++ if (!(InputState & BATTLE_THRUST)) + { + dx = 0; + dy = 0; +@@ -2212,7 +2212,9 @@ PlanetSide (POINT planetLoc) + landerInputState.Initialized = FALSE; + landerInputState.InputFunc = DoPlanetSide; + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); ++ TFB_SetOnScreenKeyboard_Melee (); + DoInput (&landerInputState, FALSE); ++ TFB_SetOnScreenKeyboard_Menu (); + + if (!(GLOBAL (CurrentActivity) & CHECK_ABORT)) + { +diff --git a/src/uqm/planets/pstarmap.c b/src/uqm/planets/pstarmap.c +index 2475000..61a40aa 100644 +--- a/src/uqm/planets/pstarmap.c ++++ b/src/uqm/planets/pstarmap.c +@@ -2006,7 +2006,9 @@ StarMap (void) + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + SetMenuRepeatDelay (MIN_ACCEL_DELAY, MAX_ACCEL_DELAY, STEP_ACCEL_DELAY, + TRUE); ++ TFB_SetOnScreenKeyboard_Starmap (); + DoInput (&MenuState, FALSE); ++ TFB_SetOnScreenKeyboard_Menu (); + SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT); + SetDefaultMenuRepeatDelay (); + +diff --git a/src/uqm/planets/solarsys.c b/src/uqm/planets/solarsys.c +index f63d087..bcc2d85 100644 +--- a/src/uqm/planets/solarsys.c ++++ b/src/uqm/planets/solarsys.c +@@ -1246,18 +1246,19 @@ flagship_inertial_thrust (COUNT CurrentAngle) + static void + ProcessShipControls (void) + { +- COUNT index; ++ COUNT index = GetFrameIndex (GLOBAL (ShipStamp.frame));; + SIZE delta_x, delta_y; ++ BATTLE_INPUT_STATE InputState = GetDirectionalJoystickInput(index, 0); + +- if (CurrentInputState.key[PlayerControls[0]][KEY_UP]) ++ if (InputState & BATTLE_THRUST) + delta_y = -1; + else + delta_y = 0; + + delta_x = 0; +- if (CurrentInputState.key[PlayerControls[0]][KEY_LEFT]) ++ if (InputState & BATTLE_LEFT) + delta_x -= 1; +- if (CurrentInputState.key[PlayerControls[0]][KEY_RIGHT]) ++ if (InputState & BATTLE_RIGHT) + delta_x += 1; + + if (delta_x || delta_y < 0) +@@ -1270,7 +1271,6 @@ ProcessShipControls (void) + else + delta_y = 0; + +- index = GetFrameIndex (GLOBAL (ShipStamp.frame)); + if (pSolarSysState->turn_counter) + --pSolarSysState->turn_counter; + else if (delta_x) +@@ -2482,7 +2482,9 @@ ExploreSolarSys (void) + InitSolarSys (); + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + SolarSysState.InputFunc = DoIpFlight; ++ TFB_SetOnScreenKeyboard_Melee (); + DoInput (&SolarSysState, FALSE); ++ TFB_SetOnScreenKeyboard_Menu (); + UninitSolarSys (); + pSolarSysState = 0; + } +@@ -2760,13 +2762,17 @@ DoIpFlight (SOLARSYS_STATE *pSS) + + if (pSS->InOrbit) + { // CheckShipLocation() or InitSolarSys() sent us to orbital ++ TFB_SetOnScreenKeyboard_Menu (); + EnterPlanetOrbit (); ++ TFB_SetOnScreenKeyboard_Melee (); + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + pSS->InOrbit = FALSE; + } + else if (cancel || LastActivity == CHECK_LOAD) + { ++ TFB_SetOnScreenKeyboard_Menu (); + SolarSysMenu (); ++ TFB_SetOnScreenKeyboard_Melee (); + SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); + } + else +diff --git a/src/uqm/setupmenu.c b/src/uqm/setupmenu.c +index 22da2eb..052d202 100644 +--- a/src/uqm/setupmenu.c ++++ b/src/uqm/setupmenu.c +@@ -83,7 +83,7 @@ static void clear_control (WIDGET_CONTROLENTRY *widget); + #endif + + #define MENU_COUNT 8 +-#define CHOICE_COUNT 29 // JMS: New options added. ++#define CHOICE_COUNT 30 // JMS: New options added. + #define SLIDER_COUNT 3 + #define BUTTON_COUNT 10 + #define LABEL_COUNT 4 +@@ -106,7 +106,7 @@ typedef int (*HANDLER)(WIDGET *, int); + static int choice_widths[CHOICE_COUNT] = { + 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 3, 3, 2, 3, 3, +- 3, 2, 3, 2, 2, 2, 2, 2, 2 }; ++ 3, 2, 3, 2, 2, 2, 2, 2, 2, 2 }; + + static HANDLER button_handlers[BUTTON_COUNT] = { + quit_main_menu, quit_sub_menu, do_graphics, do_engine, +@@ -117,7 +117,7 @@ static HANDLER button_handlers[BUTTON_COUNT] = { + // JMS: The first 8 was 7 (sound options.) Added mainmenumusic on/off. + // JMS: The HAVE_OPENGL options were 5 and 4. Added cheatMode, mineralSubmenu, nebulae and planet options. + static int menu_sizes[MENU_COUNT] = { +- 7, 6, 8, 8, 2, 5, ++ 7, 6, 8, 8, 2, 6, + #ifdef HAVE_OPENGL + 10, + #else +@@ -185,6 +185,7 @@ static WIDGET *advanced_widgets[] = { + static WIDGET *keyconfig_widgets[] = { + (WIDGET *)(&choices[18]), + (WIDGET *)(&choices[19]), ++ (WIDGET *)(&choices[29]), // Directional joystick + (WIDGET *)(&labels[1]), + (WIDGET *)(&buttons[8]), + (WIDGET *)(&buttons[1]) }; +@@ -293,6 +294,8 @@ do_keyconfig (WIDGET *self, int event) + if (event == WIDGET_EVENT_SELECT) + { + next = (WIDGET *)(&menus[5]); ++ if (getenv("OUYA")) ++ next = (WIDGET *)(&menus[4]); + (*next->receiveFocus) (next, WIDGET_EVENT_DOWN); + return TRUE; + } +@@ -414,6 +417,7 @@ SetDefaults (void) + choices[26].selected = opts.rotatingIpPlanets; // JMS + choices[27].selected = opts.texturedIpPlanets || opts.rotatingIpPlanets; // JMS + choices[28].selected = opts.cheatMode; // JMS ++ choices[29].selected = opts.directionalJoystick; + + sliders[0].value = opts.musicvol; + sliders[1].value = opts.sfxvol; +@@ -452,6 +456,7 @@ PropagateResults (void) + opts.rotatingIpPlanets = choices[26].selected; // JMS + opts.texturedIpPlanets = choices[27].selected || opts.rotatingIpPlanets; // JMS + opts.cheatMode = choices[28].selected; // JMS ++ opts.directionalJoystick = choices[29].selected; + + opts.musicvol = sliders[0].value; + opts.sfxvol = sliders[1].value; +@@ -1164,6 +1169,7 @@ GetGlobalOptions (GLOBALOPTS *opts) + opts->rotatingIpPlanets = optRotatingIpPlanets ? OPTVAL_ENABLED : OPTVAL_DISABLED; + opts->texturedIpPlanets = (optTexturedIpPlanets ? OPTVAL_ENABLED : OPTVAL_DISABLED) || opts->rotatingIpPlanets; + opts->cheatMode = optCheatMode ? OPTVAL_ENABLED : OPTVAL_DISABLED; ++ opts->directionalJoystick = optDirectionalJoystick ? OPTVAL_ENABLED : OPTVAL_DISABLED; + + /* Work out resolution. On the way, try to guess a good default + * for config.alwaysgl, then overwrite it if it was set previously. */ +@@ -1299,6 +1305,9 @@ SetGlobalOptions (GLOBALOPTS *opts) + break; + } + ++ res_PutBoolean ("config.directionaljoystick", opts->directionalJoystick == OPTVAL_ENABLED); ++ optDirectionalJoystick = (opts->directionalJoystick == OPTVAL_ENABLED) ? TRUE : FALSE; ++ + if (NewWidth == 320 && NewHeight == 240) + { + switch (opts->scaler) +diff --git a/src/uqm/setupmenu.h b/src/uqm/setupmenu.h +index a803f06..d62569a 100644 +--- a/src/uqm/setupmenu.h ++++ b/src/uqm/setupmenu.h +@@ -86,7 +86,7 @@ typedef struct globalopts_struct { + OPT_CONSOLETYPE menu, text, cscan, scroll, intro, meleezoom, shield; + CONTROL_TEMPLATE player1, player2; + int speechvol, musicvol, sfxvol; +- BOOLEAN mainmenuMusic, mineralSubmenu, nebulae, rotatingIpPlanets, texturedIpPlanets, cheatMode; // JMS ++ BOOLEAN mainmenuMusic, mineralSubmenu, nebulae, rotatingIpPlanets, texturedIpPlanets, cheatMode, directionalJoystick; // JMS + } GLOBALOPTS; + + void SetupMenu (void); +diff --git a/src/uqm/shipstat.c b/src/uqm/shipstat.c +index 9b3039b..7ab01ba 100644 +--- a/src/uqm/shipstat.c ++++ b/src/uqm/shipstat.c +@@ -144,6 +144,45 @@ OutlineShipStatus (COORD y, COORD w, BOOLEAN inMeleeMenu) + DrawFilledRectangle (&r); + } + ++static void ++DrawCrewEnergyBoxOutline (RECT *box) ++{ ++ RECT r; ++ ++ SetContextForeGroundColor ( ++ BUILD_COLOR (MAKE_RGB15 (0x10, 0x10, 0x10), 0x19)); ++ r.corner.x = box->corner.x; ++ r.corner.y = box->corner.y + box->extent.height - 1; ++ r.extent.width = box->extent.width; ++ r.extent.height = 1; ++ DrawFilledRectangle (&r); ++ r.corner.x = box->corner.x + box->extent.width - 1; ++ r.corner.y = box->corner.y; ++ r.extent.width = 1; ++ r.extent.height = box->extent.height; ++ DrawFilledRectangle (&r); ++ ++ SetContextForeGroundColor ( ++ BUILD_COLOR (MAKE_RGB15 (0x08, 0x08, 0x08), 0x1F)); ++ r.corner.x = box->corner.x; ++ r.corner.y = box->corner.y; ++ r.extent.width = box->extent.width; ++ r.extent.height = 1; ++ DrawFilledRectangle (&r); ++ r.corner.x = box->corner.x; ++ r.corner.y = box->corner.y; ++ r.extent.width = 1; ++ r.extent.height = box->extent.height; ++ DrawFilledRectangle (&r); ++ ++ SetContextForeGroundColor (BLACK_COLOR); ++ r.corner.x = box->corner.x + 1; ++ r.corner.y = box->corner.y + 1; ++ r.extent.width = box->extent.width - 2; ++ r.extent.height = box->extent.height - 2; ++ DrawFilledRectangle (&r); ++} ++ + void + InitShipStatus (SHIP_INFO *SIPtr, STARSHIP *StarShipPtr, RECT *pClipRect, BOOLEAN inMeleeMenu) + { +@@ -256,6 +295,28 @@ InitShipStatus (SHIP_INFO *SIPtr, STARSHIP *StarShipPtr, RECT *pClipRect, BOOLEA + r.extent.height = energy_height; + r.corner.y = y - r.extent.height + GAUGE_YOFFS + 1; + DrawFilledRectangle (&r); ++ ++ // TODO: replace the above ugly code with DrawCrewEnergyBoxOutline(), but I don't want to touch that as long as it works ++ r.corner.x = RESOLUTION_FACTOR == 2 ? 3 : RESOLUTION_FACTOR; ++ r.corner.y = BAD_GUY_HORIZ_CREW_YOFFS; ++ if (StarShipPtr && StarShipPtr->playerNr == RPG_PLAYER_NUM) ++ r.corner.y = GOOD_GUY_HORIZ_CREW_YOFFS; ++ r.corner.y += RESOLUTION_FACTOR == 2 ? 3 : RESOLUTION_FACTOR; ++ r.extent.width = 1000; ++ r.extent.height = STAT_WIDTH + (2 << RESOLUTION_FACTOR); ++ SetContextForeGroundColor (BLACK_COLOR); ++ DrawFilledRectangle (&r); ++ r.extent.width = crew_height + (2 << RESOLUTION_FACTOR); ++ DrawCrewEnergyBoxOutline (&r); ++ r.corner.y = BAD_GUY_HORIZ_ENERGY_YOFFS; ++ if (StarShipPtr && StarShipPtr->playerNr == RPG_PLAYER_NUM) ++ r.corner.y = GOOD_GUY_HORIZ_ENERGY_YOFFS; ++ r.corner.y += RESOLUTION_FACTOR == 2 ? 3 : RESOLUTION_FACTOR; ++ r.extent.width = 1000; ++ SetContextForeGroundColor (BLACK_COLOR); ++ DrawFilledRectangle (&r); ++ r.extent.width = energy_height + (2 << RESOLUTION_FACTOR); ++ DrawCrewEnergyBoxOutline (&r); + } + + if (!StarShipPtr || StarShipPtr->captains_name_index) +@@ -315,7 +376,7 @@ InitShipStatus (SHIP_INFO *SIPtr, STARSHIP *StarShipPtr, RECT *pClipRect, BOOLEA + // DeltaStatistics() below will add specified values to these + SIPtr->crew_level = 0; + SIPtr->energy_level = 0; +- DeltaStatistics (SIPtr, y, crew_delta, energy_delta); ++ DeltaStatistics (SIPtr, y, crew_delta, energy_delta, StarShipPtr ? StarShipPtr->playerNr : NPC_PLAYER_NUM); + } + + UnbatchGraphics (); +@@ -333,10 +394,11 @@ InitShipStatus (SHIP_INFO *SIPtr, STARSHIP *StarShipPtr, RECT *pClipRect, BOOLEA + // crew_delta <= ShipInfoPtr->max_crew - ShipInfoPtr->crew_level + void + DeltaStatistics (SHIP_INFO *ShipInfoPtr, COORD y_offs, +- SIZE crew_delta, SIZE energy_delta) ++ SIZE crew_delta, SIZE energy_delta, SIZE player_num) + { +- COORD x, y; +- RECT r; ++ COORD x, y, y2; ++ RECT r, r2; ++ SIZE max_crew_size, max_energy_size; + + if (crew_delta == 0 && energy_delta == 0) + return; +@@ -346,13 +408,15 @@ DeltaStatistics (SHIP_INFO *ShipInfoPtr, COORD y_offs, + + r.extent.width = UNIT_WIDTH; + r.extent.height = UNIT_HEIGHT; ++#define MIN(a, b) (((a) <= (b)) ? (a) : (b)) ++ max_crew_size = MIN(ShipInfoPtr->max_crew, MAX_CREW_SIZE); ++ max_energy_size = ShipInfoPtr->max_energy; + + if (crew_delta != 0) + { + COUNT oldNumBlocks, newNumBlocks, blockI; + COUNT newCrewLevel; + +-#define MIN(a, b) (((a) <= (b)) ? (a) : (b)) + oldNumBlocks = MIN(ShipInfoPtr->crew_level, MAX_CREW_SIZE); + newCrewLevel = ShipInfoPtr->crew_level + crew_delta; + newNumBlocks = MIN(newCrewLevel, MAX_CREW_SIZE); +@@ -419,10 +483,33 @@ DeltaStatistics (SHIP_INFO *ShipInfoPtr, COORD y_offs, + // Always print a number for the SIS in the full game. + DrawBattleCrewAmount (ShipInfoPtr, y_offs); + } ++ ++ y2 = BAD_GUY_HORIZ_CREW_YOFFS; ++ if (player_num == RPG_PLAYER_NUM) ++ y2 = GOOD_GUY_HORIZ_CREW_YOFFS; ++ ++ r2.extent.height = UNIT_WIDTH; ++ r2.extent.width = UNIT_HEIGHT; ++ ++ for (blockI = 0; blockI < max_crew_size; blockI++) ++ { ++ SetContextForeGroundColor ( ++ (ShipInfoPtr->ship_flags & CREW_IMMUNE) ? ++ ROBOT_UNIT_COLOR : CREW_UNIT_COLOR); ++ if (blockI >= newNumBlocks) ++ SetContextForeGroundColor (BLACK_COLOR); ++ ++ r2.corner.x = HORIZ_CREW_XOFFS + (blockI >> 1) * (UNIT_HEIGHT + 1); ++ r2.corner.y = y2 + HORIZ_CREW_XOFFS; ++ if (blockI & 1) ++ r2.corner.y += UNIT_WIDTH + 1; ++ DrawFilledRectangle (&r2); ++ } + } + + if (energy_delta != 0) + { ++ COUNT blockI; + if (energy_delta > 0) + { + #define FUEL_UNIT_COLOR BUILD_COLOR (MAKE_RGB15 (0x14, 0x00, 0x00), 0x04) +@@ -458,6 +545,26 @@ DeltaStatistics (SHIP_INFO *ShipInfoPtr, COORD y_offs, + --ShipInfoPtr->energy_level; + } while (++energy_delta); + } ++ ++ y2 = BAD_GUY_HORIZ_ENERGY_YOFFS; ++ if (player_num == RPG_PLAYER_NUM) ++ y2 = GOOD_GUY_HORIZ_ENERGY_YOFFS; ++ ++ r2.extent.height = UNIT_WIDTH; ++ r2.extent.width = UNIT_HEIGHT; ++ ++ for (blockI = 0; blockI < max_energy_size; blockI++) ++ { ++ SetContextForeGroundColor (FUEL_UNIT_COLOR); ++ if (blockI >= ShipInfoPtr->energy_level) ++ SetContextForeGroundColor (BLACK_COLOR); ++ ++ r2.corner.x = HORIZ_CREW_XOFFS + (blockI >> 1) * (UNIT_HEIGHT + 1); ++ r2.corner.y = y2 + HORIZ_CREW_XOFFS; ++ if (blockI & 1) ++ r2.corner.y += UNIT_WIDTH + 1; ++ DrawFilledRectangle (&r2); ++ } + } + } + +diff --git a/src/uqm/shipyard.c b/src/uqm/shipyard.c +index 2dc39aa..f4e6ef2 100644 +--- a/src/uqm/shipyard.c ++++ b/src/uqm/shipyard.c +@@ -211,9 +211,9 @@ DrawRaceStrings (MENU_STATE *pMS, BYTE NewRaceItem) OldContext = SetContext (StatusContext); GetContextClipRect (&r); s.origin.x = RADAR_X - r.corner.x; @@ -1892,7 +2231,7 @@ Index: uqm/shipyard.c r.extent.width = RADAR_WIDTH + 2; r.extent.height = RES_CASE(11,24,33); // JMS_GFX BatchGraphics (); -@@ -242,8 +242,6 @@ +@@ -241,8 +241,6 @@ DrawRaceStrings (MENU_STATE *pMS, BYTE NewRaceItem) hStarShip = GetAvailableRaceFromIndex (NewRaceItem); NewRaceItem = GetIndexFromStarShip (&GLOBAL (avail_race_q), hStarShip); @@ -1901,7 +2240,7 @@ Index: uqm/shipyard.c FleetPtr = LockFleetInfo (&GLOBAL (avail_race_q), hStarShip); s.frame = FleetPtr->melee_icon; UnlockFleetInfo (&GLOBAL (avail_race_q), hStarShip); -@@ -253,6 +251,12 @@ +@@ -252,6 +250,12 @@ DrawRaceStrings (MENU_STATE *pMS, BYTE NewRaceItem) s.origin.x += (RADAR_WIDTH >> 1); s.origin.y += (RADAR_HEIGHT >> 1); DrawStamp (&s); @@ -1914,73 +2253,11 @@ Index: uqm/shipyard.c t.align = ALIGN_RIGHT; t.CharCount = (COUNT)~0; t.pStr = buf; -Index: uqm/confirm.c -=================================================================== ---- uqm/confirm.c (revision 1353) -+++ uqm/confirm.c (working copy) -@@ -34,9 +34,11 @@ - #include - - --#define CONFIRM_WIN_WIDTH (80 << RESOLUTION_FACTOR) // JMS_GFX -+#define CONFIRM_WIN_WIDTH (160 << RESOLUTION_FACTOR) // JMS_GFX - #define CONFIRM_WIN_HEIGHT (22 << RESOLUTION_FACTOR) // JMS_GFX - -+BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu = FALSE; -+ - static void - DrawConfirmationWindow (BOOLEAN answer) - { -@@ -67,6 +69,8 @@ - font_DrawText (&t); - t.baseline.x += (r.extent.width >> 1); - t.pStr = GAME_STRING (QUITMENU_STRING_BASE + 2); // "No" -+ if (GLOBAL (CurrentActivity) & IN_BATTLE) -+ t.pStr = "Escape unit"; // GAME_STRING (QUITMENU_STRING_BASE + 3); // TODO: modify gamestrings.txt - SetContextForeGroundColor (answer ? MENU_TEXT_COLOR : MENU_HIGHLIGHT_COLOR); - font_DrawText (&t); - -@@ -111,8 +115,16 @@ - - FlushInput (); - done = FALSE; -+ -+ #ifdef ANDROID -+ if ( !(GLOBAL (CurrentActivity) & IN_BATTLE) ) { -+ /* Abort immediately */ -+ response = TRUE; -+ done = TRUE; -+ } -+ #endif - -- do { -+ while (!done) { - // Forbid recursive calls or pausing here! - ExitRequested = FALSE; - GamePaused = FALSE; -@@ -139,7 +151,7 @@ - PlayMenuSound (MENU_SOUND_MOVE); - } - SleepThread (ONE_SECOND / 30); -- } while (!done); -+ } - - // Restore the screen under the confirmation window - DrawStamp (&s); -@@ -152,6 +164,8 @@ - } - else - { -+ if (GLOBAL (CurrentActivity) & IN_BATTLE) -+ EmergencyEscapeWarpUnitActivatedFromMenu = TRUE; - result = FALSE; - } - ExitRequested = FALSE; -Index: uqm/sis.c -=================================================================== ---- uqm/sis.c (revision 1353) -+++ uqm/sis.c (working copy) -@@ -1810,7 +1810,7 @@ +diff --git a/src/uqm/sis.c b/src/uqm/sis.c +index e4f32c5..8e7307d 100644 +--- a/src/uqm/sis.c ++++ b/src/uqm/sis.c +@@ -1843,7 +1843,7 @@ SetFlashRect (RECT *pRect) GetContextClipRect (&clip_r); pRect = &temp_r; temp_r.corner.x = RADAR_X - clip_r.corner.x; @@ -1989,132 +2266,11 @@ Index: uqm/sis.c temp_r.extent.width = RADAR_WIDTH; temp_r.extent.height = RADAR_HEIGHT; SetContext (ScreenContext); -Index: uqm/intel.c -=================================================================== ---- uqm/intel.c (revision 1353) -+++ uqm/intel.c (working copy) -@@ -45,10 +45,10 @@ - // Allow a player to warp-escape in cyborg mode - if (StarShipPtr->playerNr == RPG_PLAYER_NUM) - InputState |= CurrentInputToBattleInput ( -- context->playerNr) & BATTLE_ESCAPE; -+ context->playerNr, -1) & BATTLE_ESCAPE; - } - else -- InputState = CurrentInputToBattleInput (context->playerNr); -+ InputState = CurrentInputToBattleInput (context->playerNr, -1); - } - else if (!(PlayerControl[context->playerNr] & PSYTRON_CONTROL)) - InputState = 0; -Index: uqm/battle.c -=================================================================== ---- uqm/battle.c (revision 1353) -+++ uqm/battle.c (working copy) -@@ -16,6 +16,10 @@ - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -+#ifdef ANDROID -+#include -+#endif -+ - #include "battle.h" - - #include "battlecontrols.h" -@@ -43,6 +47,8 @@ - #include "libs/graphics/gfx_common.h" - #include "libs/log.h" - #include "libs/mathlib.h" -+#include "globdata.h" -+#include "libs/input/sdl/vcontrol.h" - - - BYTE battle_counter[NUM_SIDES]; -@@ -137,7 +143,8 @@ - frameInputHuman (HumanInputContext *context, STARSHIP *StarShipPtr) - { - (void) StarShipPtr; -- return CurrentInputToBattleInput (context->playerNr); -+ -+ return CurrentInputToBattleInput (context->playerNr, StarShipPtr ? StarShipPtr->ShipFacing : -1); - } - - static void -@@ -207,8 +214,11 @@ - StarShipPtr->ship_input_state |= SPECIAL; - - if (CanRunAway && cur_player == 0 && -- (InputState & BATTLE_ESCAPE)) -+ ((InputState & BATTLE_ESCAPE) || EmergencyEscapeWarpUnitActivatedFromMenu)) -+ { -+ EmergencyEscapeWarpUnitActivatedFromMenu = FALSE; - DoRunAway (StarShipPtr); -+ } - } - } - -@@ -399,6 +409,11 @@ - - LockMutex (GraphicsLock); - -+ TFB_SetOnScreenKeyboard_Melee (); -+ if (PlayerControl[1] & HUMAN_CONTROL) { -+ TFB_SetOnScreenKeyboard_TwoPlayersMelee (); -+ } -+ - #if !(DEMO_MODE || CREATE_JOURNAL) - if (LOBYTE (GLOBAL (CurrentActivity)) != SUPER_MELEE) { - // In Supermelee, the RNG is already initialised. -@@ -512,6 +527,8 @@ - UninitShips (); - FreeBattleSong (); - -+ TFB_SetOnScreenKeyboard_Menu (); -+ - UnlockMutex (GraphicsLock); - - return (BOOLEAN) (num_ships < 0); -Index: uqm/getchar.c -=================================================================== ---- uqm/getchar.c (revision 1353) -+++ uqm/getchar.c (working copy) -@@ -27,7 +27,11 @@ - #include "resinst.h" - #include "nameref.h" - -+#ifdef __ANDROID__ -+#include -+#endif - -+ - // TODO: This may be better done with UniChar at the cost of a tiny bit - // of overhead to convert UniChar back to UTF8 string. This overhead - // will probably be offset by removal of looped string-compare overhead ;) -@@ -141,6 +145,11 @@ - { // init basic vars - int lwlen; - -+#ifdef __ANDROID__ -+ SDL_ANDROID_ToggleScreenKeyboardTextInput (pTES->BaseStr); -+ pTES->BaseStr[0] = 0; -+#endif -+ - pTES->InputFunc = DoTextEntry; - pTES->Success = FALSE; - pTES->Initialized = TRUE; -@@ -198,7 +207,6 @@ - CacheInsPt = pTES->InsPt; - CacheCursorPos = pTES->CursorPos; - memcpy (pTES->CacheStr, pTES->BaseStr, pTES->MaxSize); -- - // process the pending character buffer - ch = GetNextCharacter (); - if (!ch && PulsedInputState.menu[KEY_MENU_ANY]) -Index: uqm/starcon.c -=================================================================== ---- uqm/starcon.c (revision 1353) -+++ uqm/starcon.c (working copy) -@@ -240,6 +240,7 @@ +diff --git a/src/uqm/starcon.c b/src/uqm/starcon.c +index d472ce5..eee502b 100644 +--- a/src/uqm/starcon.c ++++ b/src/uqm/starcon.c +@@ -240,6 +240,7 @@ while (--ac > 0) if (LastActivity == (CHECK_LOAD | CHECK_RESTART)) AskNameForCaptainAndShip(); @@ -2122,24 +2278,11 @@ Index: uqm/starcon.c do { #ifdef DEBUG -Index: uqm/outfit.c -=================================================================== ---- uqm/outfit.c (revision 1353) -+++ uqm/outfit.c (working copy) -@@ -59,7 +59,7 @@ - OldContext = SetContext (StatusContext); - GetContextClipRect (&r); - s.origin.x = RADAR_X - r.corner.x; -- s.origin.y = RADAR_Y - r.corner.y - 19 * RESOLUTION_FACTOR; // JMS_GFX; -+ s.origin.y = RADAR_Y_LIFTED_UP - r.corner.y + RES_CASE(10,6,12); // JMS_GFX; - r.corner.x = s.origin.x - 1; - r.corner.y = s.origin.y - 11; - r.extent.width = RADAR_WIDTH + 2; -Index: uqm/status.c -=================================================================== ---- uqm/status.c (revision 1353) -+++ uqm/status.c (working copy) -@@ -328,7 +328,7 @@ +diff --git a/src/uqm/status.c b/src/uqm/status.c +index ba243b8..932181b 100644 +--- a/src/uqm/status.c ++++ b/src/uqm/status.c +@@ -328,7 +328,7 @@ DeltaEnergy (ELEMENT *ElementPtr, SIZE energy_delta) StarShipPtr->RaceDescPtr->characteristics.energy_wait; DeltaStatistics (ShipInfoPtr, status_y_offsets[StarShipPtr->playerNr], @@ -2148,7 +2291,7 @@ Index: uqm/status.c } return (retval); -@@ -370,7 +370,7 @@ +@@ -370,7 +370,7 @@ DeltaCrew (ELEMENT *ElementPtr, SIZE crew_delta) } DeltaStatistics (ShipInfoPtr, status_y_offsets[StarShipPtr->playerNr], @@ -2157,10 +2300,10 @@ Index: uqm/status.c return (retval); } -Index: uqm/status.h -=================================================================== ---- uqm/status.h (revision 1353) -+++ uqm/status.h (working copy) +diff --git a/src/uqm/status.h b/src/uqm/status.h +index 79a813b..afce3b6 100644 +--- a/src/uqm/status.h ++++ b/src/uqm/status.h @@ -36,9 +36,15 @@ #define CAPTAIN_HEIGHT RES_STAT_SCALE(30) // JMS_GFX #define CAPTAIN_XOFFS ((STATUS_WIDTH - CAPTAIN_WIDTH) >> 1) // JMS_GFX @@ -2180,7 +2323,7 @@ Index: uqm/status.h #define STARCON_TEXT_HEIGHT (7 << RESOLUTION_FACTOR) // JMS_GFX #define TINY_TEXT_HEIGHT (9 << RESOLUTION_FACTOR) // JMS_GFX #define BATTLE_CREW_X RES_STAT_SCALE(10) // JMS_GFX -@@ -54,7 +60,7 @@ +@@ -54,7 +60,7 @@ extern void OutlineShipStatus (COORD y, COORD w, BOOLEAN inMeleeMenu); // JMS: n extern void InitShipStatus (SHIP_INFO *ShipInfoPtr, STARSHIP *StarShipPtr, RECT *pClipRect, BOOLEAN inMeleeMenu); // StarShipPtr or pClipRect can be NULL extern void DeltaStatistics (SHIP_INFO *ShipInfoPtr, COORD y_offs, @@ -2189,176 +2332,28 @@ Index: uqm/status.h extern void DrawBattleCrewAmount (SHIP_INFO *ShipInfoPtr, COORD y_offs); extern void DrawCaptainsWindow (STARSHIP *StarShipPtr); -Index: uqm/controls.h -=================================================================== ---- uqm/controls.h (revision 1353) -+++ uqm/controls.h (working copy) -@@ -32,6 +32,7 @@ - KEY_WEAPON, - KEY_SPECIAL, - KEY_ESCAPE, -+ KEY_THRUST, - NUM_KEYS - }; - enum { -@@ -90,13 +91,14 @@ - #define BATTLE_ESCAPE ((BATTLE_INPUT_STATE)(1 << 5)) - #define BATTLE_DOWN ((BATTLE_INPUT_STATE)(1 << 6)) +diff --git a/src/uqm/supermelee/melee.c b/src/uqm/supermelee/melee.c +index fb143f4..78cb6a6 100644 +--- a/src/uqm/supermelee/melee.c ++++ b/src/uqm/supermelee/melee.c +@@ -2124,7 +2124,7 @@ Melee (void) + PlayerControl[0] = HUMAN_CONTROL | STANDARD_RATING; + Melee_LocalChange_team (&MenuState, 0, + MenuState.load.preBuiltList[0]); +- PlayerControl[1] = COMPUTER_CONTROL | STANDARD_RATING; ++ PlayerControl[1] = HUMAN_CONTROL | STANDARD_RATING; // COMPUTER_CONTROL | STANDARD_RATING; + Melee_LocalChange_team (&MenuState, 1, + MenuState.load.preBuiltList[1]); + } +diff --git a/src/uqm/units.h b/src/uqm/units.h +index c36ed10..8515c2f 100644 +--- a/src/uqm/units.h ++++ b/src/uqm/units.h +@@ -67,6 +67,7 @@ extern unsigned int resolutionFactor; // JMS_GFX + #define RADAR_WIDTH (STATUS_WIDTH - RES_STAT_SCALE(8)) // JMS_GFX + #define RADAR_HEIGHT RES_STAT_SCALE(53) // JMS_GFX + #define RADAR_Y (SIS_ORG_Y + SIS_SCREEN_HEIGHT - (53 << RESOLUTION_FACTOR)) // JMS_GFX ++#define RADAR_Y_LIFTED_UP (RADAR_Y - (40 << RESOLUTION_FACTOR)) --BATTLE_INPUT_STATE CurrentInputToBattleInput (COUNT player); -+BATTLE_INPUT_STATE CurrentInputToBattleInput (COUNT player, int direction /* = -1 for no directional input */); - BATTLE_INPUT_STATE PulsedInputToBattleInput (COUNT player); - - extern CONTROLLER_INPUT_STATE CurrentInputState; - extern CONTROLLER_INPUT_STATE PulsedInputState; - extern volatile CONTROLLER_INPUT_STATE ImmediateInputState; - extern CONTROL_TEMPLATE PlayerControls[]; -+extern BOOLEAN EmergencyEscapeWarpUnitActivatedFromMenu; - - void UpdateInputState (void); - extern void FlushInput (void); -@@ -116,6 +118,8 @@ - BOOLEAN WaitForNoInput (TimePeriod duration, BOOLEAN resetInput); - BOOLEAN WaitForNoInputUntil (TimeCount timeOut, BOOLEAN resetInput); - -+extern BATTLE_INPUT_STATE GetDirectionalJoystickInput(int direction, int player); -+ - void DoPopupWindow(const char *msg); - - typedef void (InputFrameCallback) (void); -Index: svnversion.h -=================================================================== ---- svnversion.h (revision 1353) -+++ svnversion.h (working copy) -@@ -1 +1 @@ --#define UQMHD_SVN_REVISION "1337M" -+#define UQMHD_SVN_REVISION "1351M" -Index: options.c -=================================================================== ---- options.c (revision 1353) -+++ options.c (working copy) -@@ -67,6 +67,7 @@ - BOOLEAN optRotatingIpPlanets; - BOOLEAN optTexturedIpPlanets; - BOOLEAN optCheatMode; -+BOOLEAN optDirectionalJoystick; - - BOOLEAN opt3doMusic; - BOOLEAN optRemixMusic; -@@ -480,6 +481,7 @@ - - for (i = 0; i < dirList->numNames; i++) - { -+ log_add (log_Info, "Mounting ZIP '%s'", dirList->names[i]); - if (uio_mountDir (repository, mountPoint, uio_FSTYPE_ZIP, - dirHandle, dirList->names[i], "/", autoMount, - relativeFlags | uio_MOUNT_RDONLY, -Index: options.h -=================================================================== ---- options.h (revision 1353) -+++ options.h (working copy) -@@ -54,6 +54,7 @@ - extern BOOLEAN optRotatingIpPlanets; - extern BOOLEAN optTexturedIpPlanets; - extern BOOLEAN optCheatMode; -+extern BOOLEAN optDirectionalJoystick; - - extern BOOLEAN opt3doMusic; - extern BOOLEAN optRemixMusic; -Index: uqm.c -=================================================================== ---- uqm.c (revision 1353) -+++ uqm.c (working copy) -@@ -63,6 +63,20 @@ - // Including this is actually necessary on OSX. - #endif - -+#if defined (__ANDROID__) -+# include -+static void AndroidAppPutToBackgroundCallback (void) -+{ -+ SDL_ANDROID_PauseAudioPlayback (); -+ GameActive = FALSE; -+} -+static void SDLCALL AndroidAppRestoredCallback (void) -+{ -+ SDL_ANDROID_ResumeAudioPlayback (); -+ GameActive = TRUE; -+} -+#endif -+ - struct bool_option - { - bool value; -@@ -138,6 +152,7 @@ - DECL_CONFIG_OPTION(bool, rotatingIpPlanets); // JMS - DECL_CONFIG_OPTION(bool, texturedIpPlanets); // JMS - DECL_CONFIG_OPTION(bool, cheatMode); // JMS -+ DECL_CONFIG_OPTION(bool, directionalJoystick); - - #define INIT_CONFIG_OPTION(name, val) \ - { val, false } -@@ -256,8 +271,8 @@ - INIT_CONFIG_OPTION( gamma, 0.0f ), - INIT_CONFIG_OPTION( soundDriver, audio_DRIVER_MIXSDL ), - INIT_CONFIG_OPTION( soundQuality, audio_QUALITY_MEDIUM ), -- INIT_CONFIG_OPTION( use3doMusic, true ), -- INIT_CONFIG_OPTION( useRemixMusic, false ), -+ INIT_CONFIG_OPTION( use3doMusic, false ), -+ INIT_CONFIG_OPTION( useRemixMusic, true ), - INIT_CONFIG_OPTION( whichCoarseScan, OPT_PC ), - INIT_CONFIG_OPTION( whichMenu, OPT_PC ), - INIT_CONFIG_OPTION( whichFonts, OPT_PC ), -@@ -269,17 +284,18 @@ - INIT_CONFIG_OPTION( stereoSFX, false ), - INIT_CONFIG_OPTION( musicVolumeScale, 1.0f ), - INIT_CONFIG_OPTION( sfxVolumeScale, 1.0f ), -- INIT_CONFIG_OPTION( speechVolumeScale, 0.3f ), -+ INIT_CONFIG_OPTION( speechVolumeScale, 0.7f ), - INIT_CONFIG_OPTION( safeMode, false ), -- INIT_CONFIG_OPTION( resolutionFactor, 2 ), -+ INIT_CONFIG_OPTION( resolutionFactor, 1 ), - INIT_CONFIG_OPTION( forceAspectRatio, false ), - INIT_CONFIG_OPTION( loresBlowupScale, 0 ), - INIT_CONFIG_OPTION( mainmenuMusic, true ), -- INIT_CONFIG_OPTION( mineralSubmenu, true ), -+ INIT_CONFIG_OPTION( mineralSubmenu, false ), - INIT_CONFIG_OPTION( nebulae, true ), - INIT_CONFIG_OPTION( rotatingIpPlanets, true), - INIT_CONFIG_OPTION( texturedIpPlanets, true), - INIT_CONFIG_OPTION( cheatMode, false ), -+ INIT_CONFIG_OPTION( directionalJoystick, true ), - }; - struct options_struct defaults = options; - int optionsResult; -@@ -346,6 +362,14 @@ - return optionsResult; - } - -+#if defined (ANDROID) -+ SDL_ANDROID_SetApplicationPutToBackgroundCallback (AndroidAppPutToBackgroundCallback, AndroidAppRestoredCallback); -+ if( !fileExists("config/save") ) { -+ // Copy savegames from UQM non-HD, I'm too lazy to do that properly. -+ system("SAVEDIR=`pwd`/config/save ; mkdir -p $SAVEDIR ; cd ../../../../app-data/com.sourceforge.sc2/config/save || exit 1 ; for f in * ; do cat $f > $SAVEDIR/$f ; done"); -+ } -+#endif -+ - TFB_PreInit (); - mem_init (); - InitThreadSystem (); -@@ -413,6 +437,7 @@ - optRotatingIpPlanets = options.rotatingIpPlanets.value; // JMS - optTexturedIpPlanets = options.texturedIpPlanets.value || optRotatingIpPlanets; // JMS - optCheatMode = options.cheatMode.value; // JMS -+ optDirectionalJoystick = options.directionalJoystick.value; - - prepareContentDir (options.contentDir, options.addonDir, argv[0]); - prepareMeleeDir (); -@@ -696,6 +721,7 @@ - getBoolConfigValue (&options->rotatingIpPlanets, "config.rotatingIpPlanets"); - getBoolConfigValue (&options->texturedIpPlanets, "config.texturedIpPlanets"); - getBoolConfigValue (&options->cheatMode, "config.cheatMode"); -+ getBoolConfigValue (&options->directionalJoystick, "config.directionaljoystick"); - - if (res_IsInteger ("config.player1control")) - { + /* Blue boxes which display messages and the green date box. */ + #define SIS_TITLE_BOX_WIDTH (57 << RESOLUTION_FACTOR) // JMS_GFX