Merge branch 'sdl_android' of github.com:pelya/commandergenius into sdl_android
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -59,3 +59,6 @@
|
||||
[submodule "project/jni/application/xserver-debian/xserver"]
|
||||
path = project/jni/application/xserver-debian/xserver
|
||||
url = git@github.com:pelya/xserver.git
|
||||
[submodule "project/jni/application/uae4all2"]
|
||||
path = project/jni/application/uae4all2
|
||||
url = git@github.com:lubomyr/uae4all2.git
|
||||
|
||||
7
bugs.txt
7
bugs.txt
@@ -16,9 +16,6 @@ Requested features, might never get implemented, see todo.txt for features that
|
||||
|
||||
- Show/hide screen controls with longpress on Text Edit button.
|
||||
|
||||
- Floating on-screen joystick - initially invisible, it appears when you touch the screen,
|
||||
centered on your finger, then it slides with your finger if you bump the joystick edge.
|
||||
|
||||
- Export phone vibrator to SDL - interface is available in SDL 1.3.
|
||||
|
||||
- Control screen brightness with SDL_SetGamma().
|
||||
@@ -28,6 +25,10 @@ Requested features, might never get implemented, see todo.txt for features that
|
||||
- Support of libjnigraphics (it will disable on-screen keyboard, only SW SDL screen surface supported).
|
||||
This is not relevant already, as every device around is fast enough with GL.
|
||||
|
||||
- Resize default on-screen buttons for different screen sizes.
|
||||
|
||||
- Cloud save support.
|
||||
|
||||
- OpenArena: chat text input should be faster.
|
||||
|
||||
- OpenArena: Shift and Ctrl keys on USB keyboard do not work for text input.
|
||||
|
||||
@@ -229,13 +229,18 @@ echo >> AndroidAppSettings.cfg
|
||||
echo "# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n)" >> AndroidAppSettings.cfg
|
||||
echo ForceRelativeMouseMode=$ForceRelativeMouseMode >> AndroidAppSettings.cfg
|
||||
echo >> AndroidAppSettings.cfg
|
||||
echo "# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n)" >> AndroidAppSettings.cfg
|
||||
echo "# Show on-screen dpad/joystick, that will act as arrow keys (y) or (n)" >> AndroidAppSettings.cfg
|
||||
echo AppNeedsArrowKeys=$AppNeedsArrowKeys >> AndroidAppSettings.cfg
|
||||
echo >> AndroidAppSettings.cfg
|
||||
echo "# On-screen dpad/joystick will appear under finger when it touches the screen (y) or (n)" >> AndroidAppSettings.cfg
|
||||
echo "# Joystick always follows finger, so moving mouse requires touching the screen with other finger" >> AndroidAppSettings.cfg
|
||||
echo FloatingScreenJoystick=$FloatingScreenJoystick >> AndroidAppSettings.cfg
|
||||
echo >> AndroidAppSettings.cfg
|
||||
echo "# Application needs text input (y) or (n), enables button for text input on screen" >> AndroidAppSettings.cfg
|
||||
echo AppNeedsTextInput=$AppNeedsTextInput >> AndroidAppSettings.cfg
|
||||
echo >> AndroidAppSettings.cfg
|
||||
echo "# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1" >> AndroidAppSettings.cfg
|
||||
echo "# This will disable AppNeedsArrowKeys option" >> AndroidAppSettings.cfg
|
||||
echo AppUsesJoystick=$AppUsesJoystick >> AndroidAppSettings.cfg
|
||||
echo >> AndroidAppSettings.cfg
|
||||
echo "# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)" >> AndroidAppSettings.cfg
|
||||
@@ -532,6 +537,12 @@ else
|
||||
AppNeedsArrowKeys=false
|
||||
fi
|
||||
|
||||
if [ "$FloatingScreenJoystick" = "y" ] ; then
|
||||
FloatingScreenJoystick=true
|
||||
else
|
||||
FloatingScreenJoystick=false
|
||||
fi
|
||||
|
||||
if [ "$AppNeedsTextInput" = "y" ] ; then
|
||||
AppNeedsTextInput=true
|
||||
else
|
||||
@@ -767,6 +778,7 @@ $SEDI "s/public static boolean ForceRelativeMouseMode = .*;/public static boolea
|
||||
$SEDI "s/public static boolean ShowMouseCursor = .*;/public static boolean ShowMouseCursor = $ShowMouseCursor;/" project/src/Globals.java
|
||||
$SEDI "s/public static boolean GenerateSubframeTouchEvents = .*;/public static boolean GenerateSubframeTouchEvents = $GenerateSubframeTouchEvents;/" project/src/Globals.java
|
||||
$SEDI "s/public static boolean AppNeedsArrowKeys = .*;/public static boolean AppNeedsArrowKeys = $AppNeedsArrowKeys;/" project/src/Globals.java
|
||||
$SEDI "s/public static boolean FloatingScreenJoystick = .*;/public static boolean FloatingScreenJoystick = $FloatingScreenJoystick;/" project/src/Globals.java
|
||||
$SEDI "s/public static boolean AppNeedsTextInput = .*;/public static boolean AppNeedsTextInput = $AppNeedsTextInput;/" project/src/Globals.java
|
||||
$SEDI "s/public static boolean AppUsesJoystick = .*;/public static boolean AppUsesJoystick = $AppUsesJoystick;/" project/src/Globals.java
|
||||
$SEDI "s/public static boolean AppUsesSecondJoystick = .*;/public static boolean AppUsesSecondJoystick = $AppUsesSecondJoystick;/" project/src/Globals.java
|
||||
|
||||
@@ -3,12 +3,18 @@
|
||||
APPNAME=`grep AppName AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' | tr " '/" '---'`
|
||||
APPVER=`grep AppVersionName AndroidAppSettings.cfg | sed 's/.*=//' | tr -d '"' | tr " '/" '---'`
|
||||
|
||||
ARCHIVER=gzip
|
||||
EXT=gz
|
||||
which xz > /dev/null && ARCHIVER="xz -z" && EXT=xz
|
||||
which pxz > /dev/null && ARCHIVER=pxz && EXT=xz
|
||||
|
||||
# TODO: Boost, Python and ffmpeg are stored in repository as precompiled binaries, the proper way to fix that is to build them using scripts, and remove that binaries
|
||||
# --exclude="*.a" --exclude="*.so"
|
||||
tar -c -z --exclude-vcs --exclude="*.o" --exclude="*.d" --exclude="*.dep" \
|
||||
-f $APPNAME-$APPVER-src.tar.gz \
|
||||
tar -c --exclude-vcs --exclude="*.o" --exclude="*.d" --exclude="*.dep" \
|
||||
`git ls-files --exclude-standard | grep -v '^project/jni/application/.*'` \
|
||||
`find project/jni/application -maxdepth 1 -type f -o -type l` \
|
||||
project/jni/application/src \
|
||||
project/jni/application/`readlink project/jni/application/src` \
|
||||
project/AndroidManifest.xml project/src "$@"
|
||||
project/AndroidManifest.xml project/src \
|
||||
project/obj/local/armeabi-v7a/*.so project/obj/local/x86/*.so \
|
||||
"$@" | $ARCHIVER > $APPNAME-$APPVER-src.tar.$EXT
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
@@ -89,6 +89,7 @@ class Globals
|
||||
public static int TouchscreenKeyboardDrawSize = 1;
|
||||
public static int TouchscreenKeyboardTheme = 2;
|
||||
public static int TouchscreenKeyboardTransparency = 2;
|
||||
public static boolean FloatingScreenJoystick = false;
|
||||
public static int AccelerometerSensitivity = 2;
|
||||
public static int AccelerometerCenterPos = 2;
|
||||
public static int TrackballDampening = 0;
|
||||
@@ -130,7 +131,6 @@ class Globals
|
||||
public static String DataDir = new String("");
|
||||
public static boolean VideoLinearFilter = true;
|
||||
public static boolean MultiThreadedVideo = false;
|
||||
public static boolean BrokenLibCMessageShown = false;
|
||||
|
||||
public static boolean OuyaEmulation = false; // For debugging
|
||||
public static boolean RedirectStdout = false; // For debugging
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
@@ -159,7 +159,7 @@ class Settings
|
||||
out.writeInt(Globals.OptionalDataDownload.length);
|
||||
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
|
||||
out.writeBoolean(Globals.OptionalDataDownload[i]);
|
||||
out.writeBoolean(Globals.BrokenLibCMessageShown);
|
||||
out.writeBoolean(false); // Unused
|
||||
out.writeInt(Globals.TouchscreenKeyboardDrawSize);
|
||||
out.writeInt(p.getApplicationVersion());
|
||||
out.writeFloat(AccelerometerReader.gyro.x1);
|
||||
@@ -177,6 +177,7 @@ class Settings
|
||||
out.writeBoolean(Globals.MoveMouseWithGyroscope);
|
||||
out.writeInt(Globals.MoveMouseWithGyroscopeSpeed);
|
||||
out.writeBoolean(Globals.FingerHover);
|
||||
out.writeBoolean(Globals.FloatingScreenJoystick);
|
||||
|
||||
out.close();
|
||||
settingsLoaded = true;
|
||||
@@ -346,7 +347,7 @@ class Settings
|
||||
Globals.OptionalDataDownload = new boolean[settingsFile.readInt()];
|
||||
for(int i = 0; i < Globals.OptionalDataDownload.length; i++)
|
||||
Globals.OptionalDataDownload[i] = settingsFile.readBoolean();
|
||||
Globals.BrokenLibCMessageShown = settingsFile.readBoolean();
|
||||
settingsFile.readBoolean(); // Unused
|
||||
Globals.TouchscreenKeyboardDrawSize = settingsFile.readInt();
|
||||
int cfgVersion = settingsFile.readInt();
|
||||
AccelerometerReader.gyro.x1 = settingsFile.readFloat();
|
||||
@@ -364,6 +365,7 @@ class Settings
|
||||
Globals.MoveMouseWithGyroscope = settingsFile.readBoolean();
|
||||
Globals.MoveMouseWithGyroscopeSpeed = settingsFile.readInt();
|
||||
Globals.FingerHover = settingsFile.readBoolean();
|
||||
Globals.FloatingScreenJoystick = settingsFile.readBoolean();
|
||||
|
||||
settingsLoaded = true;
|
||||
|
||||
@@ -409,7 +411,7 @@ class Settings
|
||||
Globals.DownloadToSdcard = false;
|
||||
}
|
||||
Globals.DataDir = Globals.DownloadToSdcard ?
|
||||
SdcardAppPath.getPath(p) :
|
||||
SdcardAppPath.getBestPath(p) :
|
||||
p.getFilesDir().getAbsolutePath();
|
||||
if( Globals.DownloadToSdcard )
|
||||
{
|
||||
@@ -419,6 +421,12 @@ class Settings
|
||||
for( String s: fileList )
|
||||
if( s.toUpperCase().startsWith(DataDownloader.DOWNLOAD_FLAG_FILENAME.toUpperCase()) )
|
||||
Globals.DataDir = SdcardAppPath.deprecatedPath(p);
|
||||
// Also check for pre-Kitkat files location
|
||||
fileList = new File(SdcardAppPath.getPath(p)).list();
|
||||
if( fileList != null )
|
||||
for( String s: fileList )
|
||||
if( s.toUpperCase().startsWith(DataDownloader.DOWNLOAD_FLAG_FILENAME.toUpperCase()) )
|
||||
Globals.DataDir = SdcardAppPath.getPath(p);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,7 +562,8 @@ class Settings
|
||||
nativeSetupScreenKeyboard( Globals.TouchscreenKeyboardSize,
|
||||
Globals.TouchscreenKeyboardDrawSize,
|
||||
Globals.TouchscreenKeyboardTheme,
|
||||
Globals.TouchscreenKeyboardTransparency );
|
||||
Globals.TouchscreenKeyboardTransparency,
|
||||
Globals.FloatingScreenJoystick ? 1 : 0 );
|
||||
SetupTouchscreenKeyboardGraphics(p);
|
||||
for( int i = 0; i < Globals.RemapScreenKbKeycode.length; i++ )
|
||||
nativeSetKeymapKeyScreenKb(i, SDL_Keys.values[Globals.RemapScreenKbKeycode[i]]);
|
||||
@@ -680,12 +689,18 @@ class Settings
|
||||
{
|
||||
private static SdcardAppPath get()
|
||||
{
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO)
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT)
|
||||
return Kitkat.Holder.sInstance;
|
||||
else if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.FROYO)
|
||||
return Froyo.Holder.sInstance;
|
||||
else
|
||||
return Dummy.Holder.sInstance;
|
||||
}
|
||||
public abstract String path(final Context p);
|
||||
public String bestPath(final Context p)
|
||||
{
|
||||
return path(p);
|
||||
};
|
||||
public static String deprecatedPath(final Context p)
|
||||
{
|
||||
return Environment.getExternalStorageDirectory().getAbsolutePath() + "/app-data/" + p.getPackageName();
|
||||
@@ -697,6 +712,13 @@ class Settings
|
||||
} catch(Exception e) { }
|
||||
return Dummy.Holder.sInstance.path(p);
|
||||
}
|
||||
public static String getBestPath(final Context p)
|
||||
{
|
||||
try {
|
||||
return get().bestPath(p);
|
||||
} catch(Exception e) { }
|
||||
return Dummy.Holder.sInstance.path(p);
|
||||
}
|
||||
|
||||
private static class Froyo extends SdcardAppPath
|
||||
{
|
||||
@@ -709,6 +731,32 @@ class Settings
|
||||
return p.getExternalFilesDir(null).getAbsolutePath();
|
||||
}
|
||||
}
|
||||
private static class Kitkat extends Froyo
|
||||
{
|
||||
private static class Holder
|
||||
{
|
||||
private static final Kitkat sInstance = new Kitkat();
|
||||
}
|
||||
public String bestPath(final Context p)
|
||||
{
|
||||
File[] paths = p.getExternalFilesDirs(null);
|
||||
String ret = path(p);
|
||||
long maxSize = -1;
|
||||
for( File path: paths )
|
||||
{
|
||||
if( path == null )
|
||||
continue;
|
||||
StatFs stat = new StatFs(path.getPath());
|
||||
long size = (long)stat.getAvailableBlocks() * stat.getBlockSize() / 1024 / 1024;
|
||||
if( size > maxSize )
|
||||
{
|
||||
maxSize = size;
|
||||
ret = path.getPath();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
private static class Dummy extends SdcardAppPath
|
||||
{
|
||||
private static class Holder
|
||||
@@ -799,7 +847,7 @@ class Settings
|
||||
private static native void nativeSetCompatibilityHacks();
|
||||
private static native void nativeSetVideoMultithreaded();
|
||||
private static native void nativeSetVideoForceSoftwareMode();
|
||||
private static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int transparency);
|
||||
private static native void nativeSetupScreenKeyboard(int size, int drawsize, int theme, int transparency, int floatingScreenJoystick);
|
||||
private static native void nativeSetupScreenKeyboardButtons(byte[] img);
|
||||
private static native void nativeInitKeymap();
|
||||
private static native int nativeGetKeymapKey(int key);
|
||||
@@ -816,4 +864,3 @@ class Settings
|
||||
public static native int nativeChmod(final String name, int mode);
|
||||
public static native void nativeChdir(final String dir);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Java source code (C) 2009-2012 Sergii Pylypenko
|
||||
|
||||
Java source code (C) 2009-2014 Sergii Pylypenko
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
@@ -9,7 +9,7 @@ arising from the use of this software.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
|
||||
@@ -9,10 +9,10 @@ APP_PIE := false # This feature makes executables incompatible to Android API 15
|
||||
|
||||
# Global compiler flags
|
||||
ifneq ($(filter armeabi-v7a-hard, $(APP_ABI)),)
|
||||
# Link-time optimization enabled for optimization junkies. -O9001 etc
|
||||
APP_CFLAGS := -flto
|
||||
APP_CXXFLAGS := -flto
|
||||
APP_LDFLAGS := -flto
|
||||
# Link-time optimization enabled for optimization junkies. -O999 etc
|
||||
#APP_CFLAGS := -flto
|
||||
#APP_CXXFLAGS := -flto
|
||||
#APP_LDFLAGS := -flto
|
||||
# Latest GCC got better LTO support
|
||||
NDK_TOOLCHAIN_VERSION := 4.8
|
||||
#NDK_TOOLCHAIN_VERSION := 4.8
|
||||
endif
|
||||
|
||||
@@ -1,47 +1,259 @@
|
||||
# The application settings for Android libSDL port
|
||||
AppSettingVersion=17
|
||||
LibSdlVersion=1.3
|
||||
|
||||
# Specify application name (e.x. My Application)
|
||||
AppName="Alien Blaster"
|
||||
|
||||
# Specify reversed site name of application (e.x. com.mysite.myapp)
|
||||
AppFullName=de.schwardtnet.alienblaster
|
||||
ScreenOrientation=h
|
||||
InhibitSuspend=n
|
||||
AppDataDownloadUrl="!Game data|alienblaster110_data1.zip^!Game data|alienblaster110_data2.zip^!Game data|alienblaster110_data3.zip"
|
||||
VideoDepthBpp=16
|
||||
NeedDepthBuffer=n
|
||||
NeedStencilBuffer=n
|
||||
NeedGles2=n
|
||||
SwVideoMode=n
|
||||
SdlVideoResize=y
|
||||
SdlVideoResizeKeepAspect=n
|
||||
CompatibilityHacks=
|
||||
CompatibilityHacksStaticInit=n
|
||||
CompatibilityHacksTextInputEmulatesHwKeyboard=n
|
||||
AppUsesMouse=n
|
||||
AppNeedsTwoButtonMouse=n
|
||||
ShowMouseCursor=n
|
||||
ForceRelativeMouseMode=n
|
||||
AppNeedsArrowKeys=y
|
||||
AppNeedsTextInput=y
|
||||
AppUsesJoystick=n
|
||||
AppHandlesJoystickSensitivity=n
|
||||
AppUsesMultitouch=n
|
||||
NonBlockingSwapBuffers=n
|
||||
RedefinedKeys="RETURN LCTRL NO_REMAP NO_REMAP LCTRL"
|
||||
AppTouchscreenKeyboardKeysAmount=4
|
||||
AppTouchscreenKeyboardKeysAmountAutoFire=1
|
||||
RedefinedKeysScreenKb="RETURN LCTRL PAGEUP PAGEDOWN LCTRL"
|
||||
StartupMenuButtonTimeout=3000
|
||||
HiddenMenuOptions='OptionalDownloadConfig'
|
||||
FirstStartMenuOptions=''
|
||||
MultiABI=n
|
||||
|
||||
# Application version code (integer)
|
||||
AppVersionCode=110014
|
||||
|
||||
# Application user-visible version name (string)
|
||||
AppVersionName="1.1.0.14"
|
||||
|
||||
# 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
|
||||
AppDataDownloadUrl="!Game data|alienblaster110_data1.zip^!Game data|alienblaster110_data2.zip^!Game data|alienblaster110_data3.zip"
|
||||
|
||||
# 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="%"
|
||||
CompiledLibraries="sdl_mixer sdl_image"
|
||||
CustomBuildScript=n
|
||||
AppCflags='-O3'
|
||||
AppLdflags=''
|
||||
AppSubdirsBuild=''
|
||||
AppCmdline=''
|
||||
|
||||
# Here you may type readme text, which will be shown during startup. Format is:
|
||||
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
|
||||
ReadmeText='^You can press "Home" now - the data will be downloaded in background^In game press "Menu" for secondary fire, "Volume Up/Down" to cycle weapons'
|
||||
|
||||
# libSDL version to use (1.2/1.3/2.0)
|
||||
LibSdlVersion=1.3
|
||||
|
||||
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
|
||||
ScreenOrientation=h
|
||||
|
||||
# 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=16
|
||||
|
||||
# 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=n
|
||||
|
||||
# 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
|
||||
|
||||
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
|
||||
InhibitSuspend=n
|
||||
|
||||
# Create Android service, so the app is less likely to be killed while in background
|
||||
CreateService=
|
||||
|
||||
# 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)
|
||||
CompatibilityHacksForceScreenUpdate=
|
||||
|
||||
# Application does not call SDL_Flip() or SDL_UpdateRects() after mouse click (ScummVM and all Amiga emulators do that) -
|
||||
# force screen update by moving mouse cursor a little after each click (y) or (n)
|
||||
CompatibilityHacksForceScreenUpdateMouseClick=y
|
||||
|
||||
# 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=
|
||||
|
||||
# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n)
|
||||
CompatibilityHacksAppIgnoresAudioBufferSize=
|
||||
|
||||
# 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=
|
||||
|
||||
# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL
|
||||
CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=
|
||||
|
||||
# Application uses SDL_UpdateRects() properly, and does not draw in any region outside those rects.
|
||||
# This improves drawing speed, but I know only one application that does that, and it's written by me (y)/(n)
|
||||
CompatibilityHacksProperUsageOfSDL_UpdateRects=
|
||||
|
||||
# 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
|
||||
|
||||
# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n)
|
||||
# If you disable it, swiping with two fingers will send mouse wheel events
|
||||
RightMouseButtonLongPress=
|
||||
|
||||
# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)
|
||||
ShowMouseCursor=n
|
||||
|
||||
# Generate more touch events, by default SDL generates one event per one video frame, this is useful for drawing apps (y) or (n)
|
||||
GenerateSubframeTouchEvents=
|
||||
|
||||
# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n)
|
||||
ForceRelativeMouseMode=n
|
||||
|
||||
# Show on-screen dpad/joystick, that will act as arrow keys (y) or (n)
|
||||
AppNeedsArrowKeys=y
|
||||
|
||||
# On-screen dpad/joystick will appear under finger when it touches the screen (y) or (n)
|
||||
# Joystick always follows finger, so moving mouse requires touching the screen with other finger
|
||||
FloatingScreenJoystick=y
|
||||
|
||||
# Application needs text input (y) or (n), enables button for text input on screen
|
||||
AppNeedsTextInput=y
|
||||
|
||||
# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1
|
||||
# This will disable AppNeedsArrowKeys option
|
||||
AppUsesJoystick=n
|
||||
|
||||
# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)
|
||||
AppUsesSecondJoystick=n
|
||||
|
||||
# Application uses third on-screen joystick, as SDL joystick 0 axes 20-21 (y)/(n)
|
||||
AppUsesThirdJoystick=
|
||||
|
||||
# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7
|
||||
AppUsesAccelerometer=
|
||||
|
||||
# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4
|
||||
AppUsesGyroscope=
|
||||
|
||||
# Use gyroscope to move mouse cursor (y) or (n), it eats battery, and can be disabled in settings, do not use with AppUsesGyroscope setting
|
||||
MoveMouseWithGyroscope=
|
||||
|
||||
# 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=
|
||||
|
||||
# Application needs to access SD card. If your data files are bigger than 5 Mb, enable it. (y) / (n)
|
||||
AccessSdCard=
|
||||
|
||||
# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)
|
||||
AccessInternet=
|
||||
|
||||
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
|
||||
ImmersiveMode=
|
||||
|
||||
# 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 LCTRL NO_REMAP NO_REMAP LCTRL"
|
||||
|
||||
# Number of virtual keyboard keys (currently 6 is maximum)
|
||||
AppTouchscreenKeyboardKeysAmount=4
|
||||
|
||||
# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right)
|
||||
RedefinedKeysScreenKb="RETURN LCTRL PAGEUP PAGEDOWN LCTRL"
|
||||
|
||||
# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu
|
||||
RedefinedKeysScreenKbNames=""
|
||||
|
||||
# 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=""
|
||||
|
||||
# How long to show startup menu button, in msec, 0 to disable startup menu
|
||||
StartupMenuButtonTimeout=3000
|
||||
|
||||
# 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='OptionalDownloadConfig'
|
||||
|
||||
# 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=''
|
||||
|
||||
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
|
||||
# Available architectures: armeabi armeabi-v7a armeabi-v7a-hard x86 mips
|
||||
MultiABI='n'
|
||||
|
||||
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
|
||||
AppMinimumRAM=
|
||||
|
||||
# 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_mixer sdl_image"
|
||||
|
||||
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
|
||||
CustomBuildScript=n
|
||||
|
||||
# Aditional CFLAGS for application
|
||||
AppCflags='-O3'
|
||||
|
||||
# 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=
|
||||
|
||||
# Build only following subdirs (empty will build all dirs, ignored with custom script)
|
||||
AppSubdirsBuild=''
|
||||
|
||||
# Exclude these files from build
|
||||
AppBuildExclude=''
|
||||
|
||||
# Application command line parameters, including app name as 0-th param
|
||||
AppCmdline=''
|
||||
|
||||
# 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=
|
||||
|
||||
# Your AdMob Publisher ID, (n) if you don't want advertisements
|
||||
AdmobPublisherId=
|
||||
|
||||
# Your AdMob test device ID, to receive a test ad
|
||||
AdmobTestDeviceId=
|
||||
|
||||
# Your AdMob banner size (BANNER/FULL_BANNER/LEADERBOARD/MEDIUM_RECTANGLE/SMART_BANNER/WIDE_SKYSCRAPER/FULL_WIDTH:Height/Width:AUTO_HEIGHT/Width:Height)
|
||||
AdmobBannerSize=
|
||||
|
||||
|
||||
@@ -119,13 +119,18 @@ GenerateSubframeTouchEvents=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)
|
||||
# Show on-screen dpad/joystick, that will act as arrow keys (y) or (n)
|
||||
AppNeedsArrowKeys=y
|
||||
|
||||
# On-screen dpad/joystick will appear under finger when it touches the screen (y) or (n)
|
||||
# Joystick always follows finger, so moving mouse requires touching the screen with other finger
|
||||
FloatingScreenJoystick=y
|
||||
|
||||
# Application needs text input (y) or (n), enables button for text input on screen
|
||||
AppNeedsTextInput=y
|
||||
|
||||
# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1
|
||||
# This will disable AppNeedsArrowKeys option
|
||||
AppUsesJoystick=y
|
||||
|
||||
# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)
|
||||
@@ -208,7 +213,7 @@ FirstStartMenuOptions='SettingsMenu.DummyMenu'
|
||||
|
||||
# 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-hard x86 mips armeabi'
|
||||
MultiABI='armeabi-v7a'
|
||||
|
||||
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
|
||||
AppMinimumRAM=0
|
||||
|
||||
@@ -36,9 +36,6 @@ LibSdlVersion=1.2
|
||||
# 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
|
||||
|
||||
# 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=16
|
||||
@@ -63,9 +60,19 @@ SdlVideoResize=y
|
||||
# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)
|
||||
SdlVideoResizeKeepAspect=n
|
||||
|
||||
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
|
||||
InhibitSuspend=n
|
||||
|
||||
# Create Android service, so the app is less likely to be killed while in background
|
||||
CreateService=
|
||||
|
||||
# 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
|
||||
CompatibilityHacksForceScreenUpdate=n
|
||||
|
||||
# Application does not call SDL_Flip() or SDL_UpdateRects() after mouse click (ScummVM and all Amiga emulators do that) -
|
||||
# force screen update by moving mouse cursor a little after each click (y) or (n)
|
||||
CompatibilityHacksForceScreenUpdateMouseClick=y
|
||||
|
||||
# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n)
|
||||
CompatibilityHacksStaticInit=n
|
||||
@@ -99,6 +106,10 @@ AppUsesMouse=n
|
||||
# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n)
|
||||
AppNeedsTwoButtonMouse=n
|
||||
|
||||
# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n)
|
||||
# If you disable it, swiping with two fingers will send mouse wheel events
|
||||
RightMouseButtonLongPress=
|
||||
|
||||
# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)
|
||||
ShowMouseCursor=n
|
||||
|
||||
@@ -108,24 +119,35 @@ GenerateSubframeTouchEvents=
|
||||
# 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)
|
||||
# Show on-screen dpad/joystick, that will act as arrow keys (y) or (n)
|
||||
AppNeedsArrowKeys=y
|
||||
|
||||
# On-screen dpad/joystick will appear under finger when it touches the screen (y) or (n)
|
||||
# Joystick always follows finger, so moving mouse requires touching the screen with other finger
|
||||
FloatingScreenJoystick=y
|
||||
|
||||
# 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
|
||||
# This will disable AppNeedsArrowKeys option
|
||||
AppUsesJoystick=n
|
||||
|
||||
# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)
|
||||
AppUsesSecondJoystick=n
|
||||
|
||||
# Application uses third on-screen joystick, as SDL joystick 0 axes 20-21 (y)/(n)
|
||||
AppUsesThirdJoystick=
|
||||
|
||||
# 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
|
||||
|
||||
# Use gyroscope to move mouse cursor (y) or (n), it eats battery, and can be disabled in settings, do not use with AppUsesGyroscope setting
|
||||
MoveMouseWithGyroscope=
|
||||
|
||||
# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0
|
||||
AppUsesMultitouch=n
|
||||
|
||||
@@ -137,6 +159,9 @@ AppRecordsAudio=n
|
||||
# Application needs to access SD card. If your data files are bigger than 5 Mb, enable it. (y) / (n)
|
||||
AccessSdCard=
|
||||
|
||||
# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)
|
||||
AccessInternet=
|
||||
|
||||
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
|
||||
ImmersiveMode=
|
||||
|
||||
@@ -156,9 +181,6 @@ RedefinedKeys="SPACE SPACE NO_REMAP NO_REMAP SPACE ESCAPE"
|
||||
# Number of virtual keyboard keys (currently 6 is maximum)
|
||||
AppTouchscreenKeyboardKeysAmount=1
|
||||
|
||||
# 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="SPACE"
|
||||
|
||||
@@ -189,9 +211,9 @@ HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig'
|
||||
# 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=all
|
||||
# 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'
|
||||
|
||||
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
|
||||
AppMinimumRAM=0
|
||||
@@ -205,7 +227,7 @@ CompiledLibraries="sdl_image sdl_mixer"
|
||||
CustomBuildScript=n
|
||||
|
||||
# Aditional CFLAGS for application
|
||||
AppCflags='-O3 -DDSI_DATA_DIR=\\"data\\" -DDSI_DIR=\\".\\" -DDSI_SCORE_DIR=\\".\\" -DDSI_PIXMAP_DIR=\\".\\" -include ../../android_debug.h'
|
||||
AppCflags='-O3 -DDSI_DATA_DIR=\"data\" -DDSI_DIR=\".\" -DDSI_SCORE_DIR=\".\" -DDSI_PIXMAP_DIR=\".\" -include ../../android_debug.h'
|
||||
|
||||
# Additional LDFLAGS for application
|
||||
AppLdflags=''
|
||||
@@ -232,6 +254,6 @@ 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)
|
||||
# Your AdMob banner size (BANNER/FULL_BANNER/LEADERBOARD/MEDIUM_RECTANGLE/SMART_BANNER/WIDE_SKYSCRAPER/FULL_WIDTH:Height/Width:AUTO_HEIGHT/Width:Height)
|
||||
AdmobBannerSize=
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ if [ -e dspaceinvadors ] ; then
|
||||
else
|
||||
echo "Downloading sources..."
|
||||
svn checkout svn://svn.code.sf.net/p/dspaceinvadors/code/ dspaceinvadors || exit 1
|
||||
echo "Patching..."
|
||||
patch -p0 -d dspaceinvadors < android.diff || exit 1
|
||||
fi
|
||||
|
||||
if [ -e dspaceinvadors/config.h ] ; then
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
Index: dsi/hi_score.c
|
||||
===================================================================
|
||||
--- dsi/hi_score.c (revision 218)
|
||||
+++ dsi/hi_score.c (working copy)
|
||||
@@ -193,7 +193,7 @@
|
||||
key = SDL_GetKeyState(NULL);
|
||||
if (key[SDLK_b] == SDL_PRESSED)
|
||||
leave_state = RUN_INTRO;
|
||||
- else if (key[SDLK_s] == SDL_PRESSED)
|
||||
+ else if (key[SDLK_SPACE] == SDL_PRESSED)
|
||||
leave_state = RUN_GAME;
|
||||
WaitFrame();
|
||||
}
|
||||
Index: dsi/main.c
|
||||
===================================================================
|
||||
--- dsi/main.c (revision 218)
|
||||
+++ dsi/main.c (working copy)
|
||||
@@ -186,7 +186,7 @@
|
||||
}
|
||||
|
||||
//Open the audio device
|
||||
- if ( Mix_OpenAudio(11025, AUDIO_U8, 1, 512) < 0 )
|
||||
+ if ( Mix_OpenAudio(11025, AUDIO_S16, 1, 1024) < 0 )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Warning: Couldn't set 11025 Hz 8-bit audio\n- Reason: %s\n",
|
||||
Index: dsi/intro.c
|
||||
===================================================================
|
||||
--- dsi/intro.c (revision 218)
|
||||
+++ dsi/intro.c (working copy)
|
||||
@@ -75,7 +75,7 @@
|
||||
leave_state = RUN_QUIT;
|
||||
}
|
||||
key = SDL_GetKeyState(NULL);
|
||||
- if (key[SDLK_s] == SDL_PRESSED)
|
||||
+ if (key[SDLK_SPACE] == SDL_PRESSED)
|
||||
leave_state = RUN_GAME;
|
||||
else if (key[SDLK_v] == SDL_PRESSED)
|
||||
leave_state = RUN_SCORE;
|
||||
Index: dsi/sprite.c
|
||||
===================================================================
|
||||
--- dsi/sprite.c (revision 218)
|
||||
+++ dsi/sprite.c (working copy)
|
||||
@@ -119,4 +119,5 @@
|
||||
SDL_Delay(next_tick-this_tick);
|
||||
}
|
||||
next_tick = this_tick + (1000/FRAMES_PER_SEC);
|
||||
+ UpdateScreen(); // If we don't update screen on Android, we will not receive any input events
|
||||
}
|
||||
Submodule project/jni/application/hid-pc-keyboard/src updated: e8e2feb338...1eb04e5013
@@ -7,10 +7,10 @@ AppName="OpenTTD lowmem"
|
||||
AppFullName=org.openttd.sdl.lowmem
|
||||
|
||||
# Application version code (integer)
|
||||
AppVersionCode=14029
|
||||
AppVersionCode=14130
|
||||
|
||||
# Application user-visible version name (string)
|
||||
AppVersionName="1.4.0.29"
|
||||
AppVersionName="1.4.1.30"
|
||||
|
||||
# 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
|
||||
@@ -18,13 +18,13 @@ AppVersionName="1.4.0.29"
|
||||
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
|
||||
# these files are put inside .apk package by build system
|
||||
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
|
||||
AppDataDownloadUrl="!!Data files - 20 Mb|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.4.0-1.zip/download^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.27.cfg"
|
||||
AppDataDownloadUrl="!!Data files - 20 Mb|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.4.1.zip/download^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg"
|
||||
|
||||
# Reset SDL config when updating application to the new version (y) / (n)
|
||||
ResetSdlConfigForThisVersion=y
|
||||
|
||||
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
|
||||
DeleteFilesOnUpgrade="baseset .openttd/windows.cfg .openttd/hotkeys.cfg .openttd/openttd.cfg"
|
||||
DeleteFilesOnUpgrade=""
|
||||
|
||||
# Here you may type readme text, which will be shown during startup. Format is:
|
||||
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
|
||||
|
||||
@@ -19,5 +19,5 @@ min_step_size = 40
|
||||
[gui]
|
||||
left_mouse_btn_scrolling = true
|
||||
osk_activation = disabled
|
||||
auto_scrolling = 2
|
||||
|
||||
auto_scrolling = 0
|
||||
reverse_scroll = true
|
||||
@@ -7,10 +7,10 @@ AppName="OpenTTD"
|
||||
AppFullName=org.openttd.sdl
|
||||
|
||||
# Application version code (integer)
|
||||
AppVersionCode=14030
|
||||
AppVersionCode=14132
|
||||
|
||||
# Application user-visible version name (string)
|
||||
AppVersionName="1.4.0.30"
|
||||
AppVersionName="1.4.1.32"
|
||||
|
||||
# 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
|
||||
@@ -18,7 +18,7 @@ AppVersionName="1.4.0.30"
|
||||
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
|
||||
# these files are put inside .apk package by build system
|
||||
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
|
||||
AppDataDownloadUrl="!!Data files - 20 Mb|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.4.0-2.zip/download^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg^!MIDI music support (18 Mb)|timidity.zip|http://sourceforge.net/projects/libsdl-android/files/timidity.zip^!!Internationalization files|http://sourceforge.net/projects/libsdl-android/files/icudt52l.zip/download"
|
||||
AppDataDownloadUrl="!!Data files - 20 Mb|http://sourceforge.net/projects/libsdl-android/files/OpenTTD/openttd-data-1.4.1.zip/download^!!Config file|:.openttd/openttd.cfg:openttd-1.4.0.30.cfg^!MIDI music support (18 Mb)|timidity.zip|http://sourceforge.net/projects/libsdl-android/files/timidity.zip^!!Internationalization files|http://sourceforge.net/projects/libsdl-android/files/icudt52l.zip/download"
|
||||
|
||||
# Reset SDL config when updating application to the new version (y) / (n)
|
||||
ResetSdlConfigForThisVersion=y
|
||||
@@ -201,7 +201,7 @@ 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=armeabi-v7a
|
||||
MultiABI=all
|
||||
|
||||
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
|
||||
AppMinimumRAM=0
|
||||
|
||||
@@ -17,4 +17,7 @@ export ARCH=$1
|
||||
../setEnvironment-$1.sh sh -c "cd openttd-$VER-$1 && env ../src/configure --host=$2 --with-sdl --with-freetype=sdl-config --with-png --with-zlib --with-icu --with-libtimidity=$LOCAL_PATH/../../../obj/local/$ARCH/libtimidity.so --with-lzo2=$LOCAL_PATH/../../../obj/local/$ARCH/liblzo2.so --prefix-dir='.' --data-dir='' --without-allegro --with-fontconfig --with-lzma --endian=LE || echo 'Run: sudo apt-get install liblzma-dev - it is needed only for configure script'"
|
||||
} || exit 1
|
||||
|
||||
../setEnvironment-$1.sh sh -c "cd openttd-$VER-$1 && make -j4 VERBOSE=1 STRIP='' LIBS='-lsdl-1.2 -llzo2 -lpng -ltimidity -lfreetype -lfontconfig -lexpat -licui18n -liculx -licule -licuuc -licudata -lgcc -lz -lc -lgnustl_static -lsupc++'" && cp -f openttd-$VER-$1/objs/release/openttd libapplication-$1.so || exit 1
|
||||
NCPU=4
|
||||
uname -s | grep -i "linux" > /dev/null && NCPU=`cat /proc/cpuinfo | grep -c -i processor`
|
||||
|
||||
../setEnvironment-$1.sh sh -c "cd openttd-$VER-$1 && make -j$NCPU VERBOSE=1 STRIP='' LIBS='-lsdl-1.2 -llzo2 -lpng -ltimidity -lfreetype -lfontconfig -lexpat -licui18n -liculx -licule -licuuc -licudata -lgcc -lz -lc -lgnustl_static -lsupc++'" && cp -f openttd-$VER-$1/objs/release/openttd libapplication-$1.so || exit 1
|
||||
|
||||
@@ -19,3 +19,4 @@ min_step_size = 40
|
||||
left_mouse_btn_scrolling = true
|
||||
osk_activation = disabled
|
||||
auto_scrolling = 0
|
||||
reverse_scroll = true
|
||||
|
||||
Submodule project/jni/application/openttd/src updated: 318ff9d373...4627d6c939
@@ -1,21 +1,16 @@
|
||||
# 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="OpenTyrian"
|
||||
|
||||
# Specify reversed site name of application (e.x. com.mysite.myapp)
|
||||
AppFullName=com.googlecode.opentyrian
|
||||
|
||||
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
|
||||
ScreenOrientation=h
|
||||
# Application version code (integer)
|
||||
AppVersionCode=2125
|
||||
|
||||
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
|
||||
InhibitSuspend=n
|
||||
# Application user-visible version name (string)
|
||||
AppVersionName="2.1.25"
|
||||
|
||||
# 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
|
||||
@@ -23,7 +18,23 @@ InhibitSuspend=n
|
||||
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
|
||||
# these files are put inside .apk package by build system
|
||||
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
|
||||
AppDataDownloadUrl="Data files size is 11 Mb|tyrian21-data.zip|http://sourceforge.net/projects/libsdl-android/files/OpenTyrian/tyrian21-data.zip/download|http://sites.google.com/site/xpelyax/Home/tyrian21-data.zip?attredirects=0&d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/tyrian21-data.zip"
|
||||
AppDataDownloadUrl="!!Data files size is 11 Mb|tyrian21-data.zip^!!Tutorial|tutorial.zip"
|
||||
|
||||
# Reset SDL config when updating application to the new version (y) / (n)
|
||||
ResetSdlConfigForThisVersion=y
|
||||
|
||||
# Delete application data files when upgrading (specify file/dir paths separated by spaces)
|
||||
DeleteFilesOnUpgrade="%"
|
||||
|
||||
# Here you may type readme text, which will be shown during startup. Format is:
|
||||
# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/
|
||||
ReadmeText='^You may press "Home" now - the data will be downloaded in background'
|
||||
|
||||
# libSDL version to use (1.2/1.3/2.0)
|
||||
LibSdlVersion=1.2
|
||||
|
||||
# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape
|
||||
ScreenOrientation=h
|
||||
|
||||
# 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)
|
||||
@@ -49,9 +60,19 @@ SdlVideoResize=y
|
||||
# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n)
|
||||
SdlVideoResizeKeepAspect=n
|
||||
|
||||
# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer
|
||||
InhibitSuspend=n
|
||||
|
||||
# Create Android service, so the app is less likely to be killed while in background
|
||||
CreateService=
|
||||
|
||||
# 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
|
||||
CompatibilityHacksForceScreenUpdate=n
|
||||
|
||||
# Application does not call SDL_Flip() or SDL_UpdateRects() after mouse click (ScummVM and all Amiga emulators do that) -
|
||||
# force screen update by moving mouse cursor a little after each click (y) or (n)
|
||||
CompatibilityHacksForceScreenUpdateMouseClick=y
|
||||
|
||||
# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n)
|
||||
CompatibilityHacksStaticInit=n
|
||||
@@ -85,6 +106,10 @@ AppUsesMouse=y
|
||||
# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n)
|
||||
AppNeedsTwoButtonMouse=n
|
||||
|
||||
# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n)
|
||||
# If you disable it, swiping with two fingers will send mouse wheel events
|
||||
RightMouseButtonLongPress=n
|
||||
|
||||
# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n)
|
||||
ShowMouseCursor=n
|
||||
|
||||
@@ -95,7 +120,7 @@ GenerateSubframeTouchEvents=
|
||||
ForceRelativeMouseMode=n
|
||||
|
||||
# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n)
|
||||
AppNeedsArrowKeys=n
|
||||
AppNeedsArrowKeys=y
|
||||
|
||||
# Application needs text input (y) or (n), enables button for text input on screen
|
||||
AppNeedsTextInput=y
|
||||
@@ -106,12 +131,18 @@ AppUsesJoystick=n
|
||||
# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n)
|
||||
AppUsesSecondJoystick=n
|
||||
|
||||
# Application uses third on-screen joystick, as SDL joystick 0 axes 20-21 (y)/(n)
|
||||
AppUsesThirdJoystick=
|
||||
|
||||
# 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
|
||||
|
||||
# Use gyroscope to move mouse cursor (y) or (n), it eats battery, and can be disabled in settings, do not use with AppUsesGyroscope setting
|
||||
MoveMouseWithGyroscope=
|
||||
|
||||
# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0
|
||||
AppUsesMultitouch=n
|
||||
|
||||
@@ -120,6 +151,15 @@ 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)
|
||||
AccessSdCard=
|
||||
|
||||
# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n)
|
||||
AccessInternet=
|
||||
|
||||
# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n)
|
||||
ImmersiveMode=
|
||||
|
||||
# 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)
|
||||
@@ -136,9 +176,6 @@ RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP SPACE"
|
||||
# Number of virtual keyboard keys (currently 6 is maximum)
|
||||
AppTouchscreenKeyboardKeysAmount=4
|
||||
|
||||
# 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="SPACE RETURN LALT LCTRL"
|
||||
|
||||
@@ -169,35 +206,23 @@ HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMouse.Dis
|
||||
# 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=all
|
||||
# Specify architectures to compile, 'all' or 'y' to compile for all architectures.
|
||||
# Available architectures: armeabi armeabi-v7a armeabi-v7a-hard x86 mips
|
||||
MultiABI='all'
|
||||
|
||||
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
|
||||
AppMinimumRAM=32
|
||||
|
||||
# Application version code (integer)
|
||||
AppVersionCode=2123
|
||||
|
||||
# Application user-visible version name (string)
|
||||
AppVersionName="2.1.23"
|
||||
|
||||
# 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="%"
|
||||
AppMinimumRAM=0
|
||||
|
||||
# Optional shared libraries to compile - removing some of them will save space
|
||||
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
|
||||
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
|
||||
CompiledLibraries="sdl_net"
|
||||
CompiledLibraries="sdl_net sdl_image"
|
||||
|
||||
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
|
||||
CustomBuildScript=n
|
||||
|
||||
# Aditional CFLAGS for application
|
||||
AppCflags='-O3'
|
||||
AppCflags='-std=c99 -O3 -DTARGET_UNIX -DWITH_NETWORK -Wall -Wextra -Wno-missing-field-initializers'
|
||||
|
||||
# Additional LDFLAGS for application
|
||||
AppLdflags=''
|
||||
@@ -214,10 +239,6 @@ AppBuildExclude=''
|
||||
# Application command line parameters, including app name as 0-th param
|
||||
AppCmdline=''
|
||||
|
||||
# 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='^You may press "Home" now - the data will be downloaded in background'
|
||||
|
||||
# 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=s
|
||||
@@ -228,6 +249,6 @@ 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)
|
||||
# Your AdMob banner size (BANNER/FULL_BANNER/LEADERBOARD/MEDIUM_RECTANGLE/SMART_BANNER/WIDE_SKYSCRAPER/FULL_WIDTH:Height/Width:AUTO_HEIGHT/Width:Height)
|
||||
AdmobBannerSize=
|
||||
|
||||
|
||||
BIN
project/jni/application/opentyrian/AndroidData/tutorial.zip
Normal file
BIN
project/jni/application/opentyrian/AndroidData/tutorial.zip
Normal file
Binary file not shown.
BIN
project/jni/application/opentyrian/AndroidData/tyrian21-data.zip
Normal file
BIN
project/jni/application/opentyrian/AndroidData/tyrian21-data.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,8 +1,8 @@
|
||||
OpenTyrian Classic Development Team
|
||||
The OpenTyrian Development Team
|
||||
================================================================================
|
||||
|
||||
Carl W. Reinke <mindless2112\100gmail\056com> (Mindless)
|
||||
Yuri K. Schlesner <yuriks.br@gmail.com> (yuriks)
|
||||
Yuri K. Schlesner <yuriks@yuriks.net> (yuriks)
|
||||
Casey A. McCann <syntaxglitch@gmail.com> (syntaxglitch)
|
||||
|
||||
== Contributors ================================================================
|
||||
@@ -24,8 +24,9 @@ Jan "heftig" Steffens clean-up patches
|
||||
Jason Emery
|
||||
* Tyrian source code
|
||||
|
||||
MAME and DOSBox
|
||||
* FM emulator code
|
||||
DOSBox
|
||||
* FM Sythesis emulator code
|
||||
|
||||
AdPlug
|
||||
* Loudness player
|
||||
* Loudness player code
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
OpenTyrian Classic
|
||||
OpenTyrian
|
||||
================================================================================
|
||||
|
||||
OpenTyrian is an open-source port of the DOS game Tyrian.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -334,7 +334,7 @@ int JE_playRunSkipDump( Uint8 *incomingBuffer, unsigned int IncomingBufferLength
|
||||
#define ANI_STOP 0x0000
|
||||
|
||||
SZ_Init(pBuffer_IN, incomingBuffer, IncomingBufferLength);
|
||||
SZ_Init(pBuffer_OUT, (Uint8 *)VGAScreen->pixels, VGAScreen->h * VGAScreen->pitch);
|
||||
SZ_Init(pBuffer_OUT, VGAScreen->pixels, VGAScreen->h * VGAScreen->pitch);
|
||||
|
||||
|
||||
/* 320x200 is the only supported format.
|
||||
@@ -428,4 +428,3 @@ int JE_playRunSkipDump( Uint8 *incomingBuffer, unsigned int IncomingBufferLength
|
||||
return(0);
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -25,4 +25,3 @@ void JE_playAnim( const char *animfile, JE_byte startingframe, JE_byte speed );
|
||||
|
||||
#endif /* ANIMLIB_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "backgrnd.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "mtrand.h"
|
||||
#include "varz.h"
|
||||
#include "video.h"
|
||||
|
||||
@@ -44,7 +45,7 @@ JE_byte smoothie_data[9]; /* [1..9] */
|
||||
|
||||
void JE_darkenBackground( JE_word neat ) /* wild detail level */
|
||||
{
|
||||
Uint8 *s = (Uint8 *)VGAScreen->pixels; /* screen pointer, 8-bit specific */
|
||||
Uint8 *s = VGAScreen->pixels; /* screen pointer, 8-bit specific */
|
||||
int x, y;
|
||||
|
||||
s += 24;
|
||||
@@ -278,7 +279,7 @@ void JE_filterScreen( JE_shortint col, JE_shortint int_)
|
||||
|
||||
if (col != -99 && filtrationAvail)
|
||||
{
|
||||
s = (Uint8 *)VGAScreen->pixels;
|
||||
s = VGAScreen->pixels;
|
||||
s += 24;
|
||||
|
||||
col <<= 4;
|
||||
@@ -296,7 +297,7 @@ void JE_filterScreen( JE_shortint col, JE_shortint int_)
|
||||
|
||||
if (int_ != -99 && explosionTransparent)
|
||||
{
|
||||
s = (Uint8 *)VGAScreen->pixels;
|
||||
s = VGAScreen->pixels;
|
||||
s += 24;
|
||||
|
||||
for (y = 184; y; y--)
|
||||
@@ -417,8 +418,8 @@ void iced_blur_filter( SDL_Surface *dst, SDL_Surface *src )
|
||||
{
|
||||
assert(src->format->BitsPerPixel == 8 && dst->format->BitsPerPixel == 8);
|
||||
|
||||
Uint8 *dst_pixel = (Uint8 *)dst->pixels;
|
||||
const Uint8 *src_pixel = (Uint8 *)src->pixels;
|
||||
Uint8 *dst_pixel = dst->pixels;
|
||||
const Uint8 *src_pixel = src->pixels;
|
||||
|
||||
for (int y = 0; y < 184; ++y)
|
||||
{
|
||||
@@ -443,8 +444,8 @@ void blur_filter( SDL_Surface *dst, SDL_Surface *src )
|
||||
{
|
||||
assert(src->format->BitsPerPixel == 8 && dst->format->BitsPerPixel == 8);
|
||||
|
||||
Uint8 *dst_pixel = (Uint8 *)dst->pixels;
|
||||
const Uint8 *src_pixel = (Uint8 *)src->pixels;
|
||||
Uint8 *dst_pixel = dst->pixels;
|
||||
const Uint8 *src_pixel = src->pixels;
|
||||
|
||||
for (int y = 0; y < 184; ++y)
|
||||
{
|
||||
@@ -465,4 +466,62 @@ void blur_filter( SDL_Surface *dst, SDL_Surface *src )
|
||||
}
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
/* Background Starfield */
|
||||
typedef struct
|
||||
{
|
||||
Uint8 color;
|
||||
JE_word position; // relies on overflow wrap-around
|
||||
int speed;
|
||||
} StarfieldStar;
|
||||
|
||||
#define MAX_STARS 100
|
||||
#define STARFIELD_HUE 0x90
|
||||
static StarfieldStar starfield_stars[MAX_STARS];
|
||||
int starfield_speed;
|
||||
|
||||
void initialize_starfield( void )
|
||||
{
|
||||
for (int i = MAX_STARS-1; i >= 0; --i)
|
||||
{
|
||||
starfield_stars[i].position = mt_rand() % 320 + mt_rand() % 200 * VGAScreen->pitch;
|
||||
starfield_stars[i].speed = mt_rand() % 3 + 2;
|
||||
starfield_stars[i].color = mt_rand() % 16 + STARFIELD_HUE;
|
||||
}
|
||||
}
|
||||
|
||||
void update_and_draw_starfield( SDL_Surface* surface, int move_speed )
|
||||
{
|
||||
Uint8* p = (Uint8*)surface->pixels;
|
||||
|
||||
for (int i = MAX_STARS-1; i >= 0; --i)
|
||||
{
|
||||
StarfieldStar* star = &starfield_stars[i];
|
||||
|
||||
star->position += (star->speed + move_speed) * surface->pitch;
|
||||
|
||||
if (star->position < 177 * surface->pitch)
|
||||
{
|
||||
if (p[star->position] == 0)
|
||||
{
|
||||
p[star->position] = star->color;
|
||||
}
|
||||
|
||||
// If star is bright enough, draw surrounding pixels
|
||||
if (star->color - 4 >= STARFIELD_HUE)
|
||||
{
|
||||
if (p[star->position + 1] == 0)
|
||||
p[star->position + 1] = star->color - 4;
|
||||
|
||||
if (star->position > 0 && p[star->position - 1] == 0)
|
||||
p[star->position - 1] = star->color - 4;
|
||||
|
||||
if (p[star->position + surface->pitch] == 0)
|
||||
p[star->position + surface->pitch] = star->color - 4;
|
||||
|
||||
if (star->position >= surface->pitch && p[star->position - surface->pitch] == 0)
|
||||
p[star->position - surface->pitch] = star->color - 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -34,6 +34,8 @@ extern JE_byte map1YDelay, map1YDelayMax, map2YDelay, map2YDelayMax;
|
||||
extern JE_boolean anySmoothies; // if yes, I want one :D
|
||||
extern JE_byte smoothie_data[9];
|
||||
|
||||
extern int starfield_speed;
|
||||
|
||||
void JE_darkenBackground( JE_word neat );
|
||||
|
||||
void blit_background_row( SDL_Surface *surface, int x, int y, Uint8 **map );
|
||||
@@ -54,6 +56,8 @@ void blur_filter( SDL_Surface *dst, SDL_Surface *src );
|
||||
/*smoothies #5 is used for 3*/
|
||||
/*smoothies #9 is a vertical flip*/
|
||||
|
||||
void initialize_starfield( void );
|
||||
void update_and_draw_starfield( SDL_Surface* surface, int move_speed );
|
||||
|
||||
#endif /* BACKGRND_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -138,14 +138,8 @@ const JE_EditorItemAvailType initialItemAvail =
|
||||
JE_boolean smoothies[9] = /* [1..9] */
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
|
||||
JE_byte starShowVGASpecialCode;
|
||||
|
||||
/* Stars */
|
||||
StarDatType starDat[MAX_STARS]; /* [1..Maxstars] */
|
||||
JE_word starY;
|
||||
|
||||
|
||||
/* CubeData */
|
||||
JE_word lastCubeMax, cubeMax;
|
||||
JE_word cubeList[4]; /* [1..4] */
|
||||
@@ -218,8 +212,7 @@ JE_SaveFilesType saveFiles; /*array[1..saveLevelnum] of savefiletype;*/
|
||||
JE_SaveGameTemp saveTemp;
|
||||
|
||||
JE_word editorLevel; /*Initial value 800*/
|
||||
AutoFireMode_t autoFireMode = AUTOFIRE_TOUCHSCREEN;
|
||||
TouchscreenMode_t touchscreenMode = TOUCHSCREEN_SHIP_ABOVE_FINGER;
|
||||
TouchscreenControlMode_t touchscreenControlMode = TOUCHSCREEN_CONTROL_FINGER;
|
||||
|
||||
cJSON *load_json( const char *filename )
|
||||
{
|
||||
@@ -280,11 +273,8 @@ bool load_opentyrian_config( void )
|
||||
if ((setting = cJSON_GetObjectItem(section, "scaler")))
|
||||
set_scaler_by_name(setting->valuestring);
|
||||
|
||||
if ((setting = cJSON_GetObjectItem(section, "autofire")))
|
||||
autoFireMode = (AutoFireMode_t)setting->valueint;
|
||||
|
||||
if ((setting = cJSON_GetObjectItem(section, "touchscreen")))
|
||||
touchscreenMode = (TouchscreenMode_t)setting->valueint;
|
||||
if ((setting = cJSON_GetObjectItem(section, "touchscreenmode")))
|
||||
touchscreenControlMode = setting->valueint;
|
||||
}
|
||||
|
||||
cJSON_Delete(root);
|
||||
@@ -312,11 +302,8 @@ bool save_opentyrian_config( void )
|
||||
setting = cJSON_CreateOrGetObjectItem(section, "scaler");
|
||||
cJSON_SetString(setting, scalers[scaler].name);
|
||||
|
||||
setting = cJSON_CreateOrGetObjectItem(section, "autofire");
|
||||
cJSON_SetNumber(setting, autoFireMode);
|
||||
|
||||
setting = cJSON_CreateOrGetObjectItem(section, "touchscreen");
|
||||
cJSON_SetNumber(setting, touchscreenMode);
|
||||
setting = cJSON_CreateOrGetObjectItem(section, "touchscreenmode");
|
||||
cJSON_SetNumber(setting, touchscreenControlMode);
|
||||
}
|
||||
|
||||
save_json(root, "opentyrian.conf");
|
||||
@@ -326,19 +313,6 @@ bool save_opentyrian_config( void )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void JE_setupStars( void )
|
||||
{
|
||||
int z;
|
||||
|
||||
for (z = MAX_STARS; z--; )
|
||||
{
|
||||
starDat[z].sLoc = (mt_rand() % 320) + (mt_rand() % 200) * VGAScreen->pitch;
|
||||
starDat[z].sMov = ((mt_rand() % 3) + 2) * VGAScreen->pitch;
|
||||
starDat[z].sC = (mt_rand() % 16) + (9 * 16);
|
||||
}
|
||||
}
|
||||
|
||||
static void playeritems_to_pitems( JE_PItemsType pItems, PlayerItems *items, JE_byte initial_episode_num )
|
||||
{
|
||||
pItems[0] = items->weapon[FRONT_WEAPON].id;
|
||||
@@ -403,7 +377,7 @@ void JE_saveGame( JE_byte slot, const char *name )
|
||||
temp = episodeNum - 1;
|
||||
if (temp < 1)
|
||||
{
|
||||
temp = 4; /* JE: {Episodemax is 4 for completion purposes} */
|
||||
temp = EPISODE_AVAILABLE; /* JE: {Episodemax is 4 for completion purposes} */
|
||||
}
|
||||
saveFiles[slot-1].episode = temp;
|
||||
}
|
||||
@@ -430,8 +404,6 @@ void JE_saveGame( JE_byte slot, const char *name )
|
||||
|
||||
void JE_loadGame( JE_byte slot )
|
||||
{
|
||||
JE_byte temp5;
|
||||
|
||||
superTyrian = false;
|
||||
onePlayerAction = false;
|
||||
twoPlayerMode = false;
|
||||
@@ -489,22 +461,22 @@ void JE_loadGame( JE_byte slot )
|
||||
player[twoPlayerMode ? port : 0].items.weapon[port].power = saveFiles[slot-1].power[port];
|
||||
}
|
||||
|
||||
temp5 = saveFiles[slot-1].episode;
|
||||
int episode = saveFiles[slot-1].episode;
|
||||
|
||||
memcpy(&levelName, &saveFiles[slot-1].levelName, sizeof(levelName));
|
||||
|
||||
if (strcmp(levelName, "Completed") == 0)
|
||||
{
|
||||
if (temp5 == 4)
|
||||
if (episode == EPISODE_AVAILABLE)
|
||||
{
|
||||
temp5 = 1;
|
||||
} else if (temp5 < 4) {
|
||||
temp5++;
|
||||
episode = 1;
|
||||
} else if (episode < EPISODE_AVAILABLE) {
|
||||
episode++;
|
||||
}
|
||||
/* Increment 1-3 to 2-4. Episode 4 goes to 1. Episode 5 stands still. */
|
||||
/* Increment episode. Episode EPISODE_AVAILABLE goes to 1. */
|
||||
}
|
||||
|
||||
JE_initEpisode(temp5);
|
||||
JE_initEpisode(episode);
|
||||
saveLevel = mainLevel;
|
||||
memcpy(&lastLevelName, &levelName, sizeof(levelName));
|
||||
}
|
||||
@@ -1050,4 +1022,3 @@ void JE_saveConfiguration( void )
|
||||
#endif
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -28,8 +28,6 @@
|
||||
|
||||
#define SAVE_FILES_NUM (11 * 2)
|
||||
|
||||
#define MAX_STARS 100
|
||||
|
||||
/* These are necessary because the size of the structure has changed from the original, but we
|
||||
need to know the original sizes in order to find things in TYRIAN.SAV */
|
||||
#define SAVE_FILES_SIZE 2398
|
||||
@@ -74,13 +72,6 @@ typedef struct
|
||||
typedef JE_SaveFileType JE_SaveFilesType[SAVE_FILES_NUM]; /* [1..savefilesnum] */
|
||||
typedef JE_byte JE_SaveGameTemp[SAVE_FILES_SIZE + 4 + 100]; /* [1..sizeof(savefilestype) + 4 + 100] */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
JE_byte sC;
|
||||
JE_word sLoc;
|
||||
JE_word sMov;
|
||||
} StarDatType;
|
||||
|
||||
extern const JE_byte cryptKey[10];
|
||||
extern const JE_KeySettingType defaultKeySettings;
|
||||
extern const char defaultHighScoreNames[34][23];
|
||||
@@ -88,8 +79,6 @@ extern const char defaultTeamNames[22][25];
|
||||
extern const JE_EditorItemAvailType initialItemAvail;
|
||||
extern JE_boolean smoothies[9];
|
||||
extern JE_byte starShowVGASpecialCode;
|
||||
extern StarDatType starDat[MAX_STARS];
|
||||
extern JE_word starY;
|
||||
extern JE_word lastCubeMax, cubeMax;
|
||||
extern JE_word cubeList[4];
|
||||
extern JE_boolean gameHasRepeated;
|
||||
@@ -140,17 +129,8 @@ extern JE_byte processorType;
|
||||
extern JE_SaveFilesType saveFiles;
|
||||
extern JE_SaveGameTemp saveTemp;
|
||||
extern JE_word editorLevel;
|
||||
enum AutoFireMode_t { AUTOFIRE_TOUCHSCREEN, AUTOFIRE_BUTTON, AUTOFIRE_BUTTON_TOUCH, AUTOFIRE_NONE, AUTOFIRE_LAST };
|
||||
extern AutoFireMode_t autoFireMode;
|
||||
enum TouchscreenMode_t {
|
||||
TOUCHSCREEN_SHIP_ABOVE_FINGER,
|
||||
TOUCHSCREEN_SHIP_TO_THE_LEFT,
|
||||
TOUCHSCREEN_SHIP_BELOW_FINGER,
|
||||
TOUCHSCREEN_FIRE_ONLY,
|
||||
TOUCHSCREEN_NONE,
|
||||
TOUCHSCREEN_LAST };
|
||||
extern TouchscreenMode_t touchscreenMode;
|
||||
|
||||
typedef enum { TOUCHSCREEN_CONTROL_FINGER, TOUCHSCREEN_CONTROL_JOYSTICK, TOUCHSCREEN_CONTROL_BOTH, TOUCHSCREEN_CONTROL_LAST } TouchscreenControlMode_t;
|
||||
extern TouchscreenControlMode_t touchscreenControlMode;
|
||||
|
||||
void JE_initProcessorType( void );
|
||||
void JE_setNewGameSpeed( void );
|
||||
@@ -158,8 +138,6 @@ const char *get_user_directory( void );
|
||||
void JE_loadConfiguration( void );
|
||||
void JE_saveConfiguration( void );
|
||||
|
||||
void JE_setupStars( void );
|
||||
|
||||
void JE_saveGame( JE_byte slot, const char *name );
|
||||
void JE_loadGame( JE_byte slot );
|
||||
|
||||
@@ -171,4 +149,3 @@ void save_json( cJSON *root, const char *filename );
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -25,4 +25,3 @@ void JE_destructGame( void );
|
||||
|
||||
#endif /* DESTRUCT_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -89,4 +89,3 @@ void JE_loadExtraShapes( void )
|
||||
}
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -34,4 +34,3 @@ void JE_loadExtraShapes( void );
|
||||
|
||||
#endif /* EDITSHIP_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/* MAIN Weapons Data */
|
||||
JE_WeaponPortType weaponPort;
|
||||
JE_WeaponType weapons;
|
||||
JE_WeaponType weapons[WEAP_NUM + 1]; /* [0..weapnum] */
|
||||
|
||||
/* Items */
|
||||
JE_PowerType powerSys;
|
||||
@@ -96,6 +96,12 @@ void JE_loadItemDat( void )
|
||||
efread(&weapons[i].shipblastfilter, sizeof(JE_byte), 1, f);
|
||||
}
|
||||
|
||||
#ifdef TYRIAN2000
|
||||
if (episodeNum <= 3) fseek(f, 0x252A4, SEEK_SET);
|
||||
if (episodeNum == 4) fseek(f, 0xC1F5E, SEEK_SET);
|
||||
if (episodeNum == 5) fseek(f, 0x5C5B8, SEEK_SET);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < PORT_NUM + 1; ++i)
|
||||
{
|
||||
fseek(f, 1, SEEK_CUR); /* skip string length */
|
||||
@@ -111,7 +117,15 @@ void JE_loadItemDat( void )
|
||||
efread(&weaponPort[i].poweruse, sizeof(JE_word), 1, f);
|
||||
}
|
||||
|
||||
for (int i = 0; i < SPECIAL_NUM + 1; ++i)
|
||||
int specials_count = SPECIAL_NUM;
|
||||
#ifdef TYRIAN2000
|
||||
if (episodeNum <= 3) fseek(f, 0x2662E, SEEK_SET);
|
||||
if (episodeNum == 4) fseek(f, 0xC32E8, SEEK_SET);
|
||||
if (episodeNum == 5) fseek(f, 0x5D942, SEEK_SET);
|
||||
if (episodeNum >= 4) specials_count = SPECIAL_NUM + 8; /*this ugly hack will need a fix*/
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < specials_count + 1; ++i)
|
||||
{
|
||||
fseek(f, 1, SEEK_CUR); /* skip string length */
|
||||
efread(&special[i].name, 1, 30, f);
|
||||
@@ -121,7 +135,13 @@ void JE_loadItemDat( void )
|
||||
efread(&special[i].stype, sizeof(JE_byte), 1, f);
|
||||
efread(&special[i].wpn, sizeof(JE_word), 1, f);
|
||||
}
|
||||
|
||||
|
||||
#ifdef TYRIAN2000
|
||||
if (episodeNum <= 3) fseek(f, 0x26E21, SEEK_SET);
|
||||
if (episodeNum == 4) fseek(f, 0xC3ADB, SEEK_SET);
|
||||
if (episodeNum == 5) fseek(f, 0x5E135, SEEK_SET);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < POWER_NUM + 1; ++i)
|
||||
{
|
||||
fseek(f, 1, SEEK_CUR); /* skip string length */
|
||||
@@ -132,6 +152,12 @@ void JE_loadItemDat( void )
|
||||
efread(&powerSys[i].speed, sizeof(JE_byte), 1, f);
|
||||
efread(&powerSys[i].cost, sizeof(JE_word), 1, f);
|
||||
}
|
||||
|
||||
#ifdef TYRIAN2000
|
||||
if (episodeNum <= 3) fseek(f, 0x26F24, SEEK_SET);
|
||||
if (episodeNum == 4) fseek(f, 0xC3BDE, SEEK_SET);
|
||||
if (episodeNum == 5) fseek(f, 0x5E238, SEEK_SET);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < SHIP_NUM + 1; ++i)
|
||||
{
|
||||
@@ -146,6 +172,12 @@ void JE_loadItemDat( void )
|
||||
efread(&ships[i].cost, sizeof(JE_word), 1, f);
|
||||
efread(&ships[i].bigshipgraphic, sizeof(JE_byte), 1, f);
|
||||
}
|
||||
|
||||
#ifdef TYRIAN2000
|
||||
if (episodeNum <= 3) fseek(f, 0x2722F, SEEK_SET);
|
||||
if (episodeNum == 4) fseek(f, 0xC3EE9, SEEK_SET);
|
||||
if (episodeNum == 5) fseek(f, 0x5E543, SEEK_SET);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < OPTION_NUM + 1; ++i)
|
||||
{
|
||||
@@ -166,7 +198,13 @@ void JE_loadItemDat( void )
|
||||
efread(&options[i].stop, 1, 1, f); /* override sizeof(JE_boolean) */
|
||||
efread(&options[i].icongr, sizeof(JE_byte), 1, f);
|
||||
}
|
||||
|
||||
|
||||
#ifdef TYRIAN2000
|
||||
if (episodeNum <= 3) fseek(f, 0x27EF3, SEEK_SET);
|
||||
if (episodeNum == 4) fseek(f, 0xC4BAD, SEEK_SET);
|
||||
if (episodeNum == 5) fseek(f, 0x5F207, SEEK_SET);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < SHIELD_NUM + 1; ++i)
|
||||
{
|
||||
fseek(f, 1, SEEK_CUR); /* skip string length */
|
||||
@@ -264,4 +302,3 @@ unsigned int JE_findNextEpisode( void )
|
||||
return newEpisode;
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -28,6 +28,11 @@
|
||||
|
||||
#define FIRST_LEVEL 1
|
||||
#define EPISODE_MAX 5
|
||||
#ifdef TYRIAN2000
|
||||
#define EPISODE_AVAILABLE 5
|
||||
#else
|
||||
#define EPISODE_AVAILABLE 4
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -46,7 +51,7 @@ typedef struct
|
||||
JE_byte sound;
|
||||
JE_byte trail;
|
||||
JE_byte shipblastfilter;
|
||||
} JE_WeaponType[WEAP_NUM + 1]; /* [0..weapnum] */
|
||||
} JE_WeaponType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -146,18 +151,18 @@ typedef struct
|
||||
JE_word eenemydie;
|
||||
} JE_EnemyDatType[ENEMY_NUM + 1]; /* [0..enemynum] */
|
||||
|
||||
extern "C" JE_WeaponPortType weaponPort;
|
||||
extern "C" JE_WeaponType weapons;
|
||||
extern "C" JE_PowerType powerSys;
|
||||
extern "C" JE_ShipType ships;
|
||||
extern "C" JE_OptionType options[OPTION_NUM + 1]; /* [0..optionnum] */
|
||||
extern "C" JE_ShieldType shields;
|
||||
extern "C" JE_SpecialType special;
|
||||
extern "C" JE_EnemyDatType enemyDat;
|
||||
extern "C" JE_byte initial_episode_num, episodeNum;
|
||||
extern "C" JE_boolean episodeAvail[EPISODE_MAX];
|
||||
extern JE_WeaponPortType weaponPort;
|
||||
extern JE_WeaponType weapons[WEAP_NUM + 1]; /* [0..weapnum] */
|
||||
extern JE_PowerType powerSys;
|
||||
extern JE_ShipType ships;
|
||||
extern JE_OptionType options[OPTION_NUM + 1]; /* [0..optionnum] */
|
||||
extern JE_ShieldType shields;
|
||||
extern JE_SpecialType special;
|
||||
extern JE_EnemyDatType enemyDat;
|
||||
extern JE_byte initial_episode_num, episodeNum;
|
||||
extern JE_boolean episodeAvail[EPISODE_MAX];
|
||||
|
||||
extern "C" char episode_file[13], cube_file[13];
|
||||
extern char episode_file[13], cube_file[13];
|
||||
|
||||
extern JE_longint episode1DataLoc;
|
||||
extern JE_boolean bonusLevel;
|
||||
@@ -170,4 +175,3 @@ void JE_scanForEpisodes( void );
|
||||
|
||||
#endif /* EPISODES_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "SDL.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
const char *custom_data_dir = ".";
|
||||
|
||||
@@ -63,7 +65,7 @@ const char *data_dir( void )
|
||||
// prepend directory and fopen
|
||||
FILE *dir_fopen( const char *dir, const char *file, const char *mode )
|
||||
{
|
||||
char *path = (char *)malloc(strlen(dir) + 1 + strlen(file) + 1);
|
||||
char *path = malloc(strlen(dir) + 1 + strlen(file) + 1);
|
||||
sprintf(path, "%s/%s", dir, file);
|
||||
|
||||
FILE *f = fopen(path, mode);
|
||||
@@ -76,11 +78,9 @@ FILE *dir_fopen( const char *dir, const char *file, const char *mode )
|
||||
// warn when dir_fopen fails
|
||||
FILE *dir_fopen_warn( const char *dir, const char *file, const char *mode )
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
FILE *f = dir_fopen(dir, file, mode);
|
||||
|
||||
if (!f)
|
||||
if (f == NULL)
|
||||
fprintf(stderr, "warning: failed to open '%s': %s\n", file, strerror(errno));
|
||||
|
||||
return f;
|
||||
@@ -89,14 +89,12 @@ FILE *dir_fopen_warn( const char *dir, const char *file, const char *mode )
|
||||
// die when dir_fopen fails
|
||||
FILE *dir_fopen_die( const char *dir, const char *file, const char *mode )
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
FILE *f = dir_fopen(dir, file, mode);
|
||||
|
||||
if (f == NULL)
|
||||
{
|
||||
fprintf(stderr, "error: failed to open '%s': %s\n", file, strerror(errno));
|
||||
fprintf(stderr, "error: One or more of the required Tyrian 2.1 data files could not be found.\n"
|
||||
fprintf(stderr, "error: One or more of the required Tyrian " TYRIAN_VERSION " data files could not be found.\n"
|
||||
" Please read the README file.\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -188,5 +186,3 @@ size_t efwrite( void *buffer, size_t size, size_t num, FILE *stream )
|
||||
return f;
|
||||
}
|
||||
#endif
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -50,4 +50,3 @@ size_t efwrite( void *buffer, size_t size, size_t num, FILE *stream );
|
||||
|
||||
#endif // FILE_H
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "fmopl.h"
|
||||
#include "fm_synth.h"
|
||||
#include "loudness.h"
|
||||
#include "opentyr.h"
|
||||
|
||||
const unsigned char op_table[9] = {0x00, 0x01, 0x02, 0x08, 0x09, 0x0a, 0x10, 0x11, 0x12};
|
||||
|
||||
#define opl 0
|
||||
|
||||
void opl_update( OPLSAMPLE *buf, int samples )
|
||||
{
|
||||
YM3812UpdateOne(opl, buf, samples);
|
||||
}
|
||||
|
||||
void opl_init( void )
|
||||
{
|
||||
YM3812Init(1, 3579545, 11025 * OUTPUT_QUALITY);
|
||||
}
|
||||
|
||||
void opl_deinit( void )
|
||||
{
|
||||
YM3812Shutdown();
|
||||
}
|
||||
|
||||
void opl_reset( void )
|
||||
{
|
||||
YM3812ResetChip(opl);
|
||||
}
|
||||
|
||||
void opl_write(int reg, int val)
|
||||
{
|
||||
YM3812Write(opl, 0, reg);
|
||||
YM3812Write(opl, 1, val);
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef FM_SYNTH_H
|
||||
#define FM_SYNTH_H
|
||||
|
||||
#include "fmopl.h"
|
||||
#include "opentyr.h"
|
||||
|
||||
extern const unsigned char op_table[9]; /* the 9 operators as expected by the OPL2 */
|
||||
|
||||
void opl_update( OPLSAMPLE *buf, int samples );
|
||||
void opl_init( void );
|
||||
void opl_deinit( void );
|
||||
void opl_reset( void );
|
||||
void opl_write( int, int );
|
||||
|
||||
#endif /* FM_SYNTH_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,253 +0,0 @@
|
||||
#ifndef __FMOPL_H_
|
||||
#define __FMOPL_H_
|
||||
|
||||
/* --- select emulation chips --- */
|
||||
#define BUILD_YM3812 1 /* (HAS_YM3812) */
|
||||
#define BUILD_YM3526 (HAS_YM3526)
|
||||
#define BUILD_Y8950 (HAS_Y8950)
|
||||
|
||||
/* select output bits size of output : 8 or 16 */
|
||||
#define OPL_SAMPLE_BITS 16
|
||||
|
||||
/* compiler dependence */
|
||||
#ifndef OSD_CPU_H
|
||||
#define OSD_CPU_H
|
||||
typedef unsigned char UINT8; /* unsigned 8bit */
|
||||
typedef unsigned short UINT16; /* unsigned 16bit */
|
||||
typedef unsigned int UINT32; /* unsigned 32bit */
|
||||
typedef signed char INT8; /* signed 8bit */
|
||||
typedef signed short INT16; /* signed 16bit */
|
||||
typedef signed int INT32; /* signed 32bit */
|
||||
#endif
|
||||
|
||||
#if (OPL_SAMPLE_BITS==16)
|
||||
typedef INT16 OPLSAMPLE;
|
||||
#endif
|
||||
#if (OPL_SAMPLE_BITS==8)
|
||||
typedef INT8 OPLSAMPLE;
|
||||
#endif
|
||||
|
||||
|
||||
typedef void (*OPL_TIMERHANDLER)(int channel,double interval_Sec);
|
||||
typedef void (*OPL_IRQHANDLER)(int param,int irq);
|
||||
typedef void (*OPL_UPDATEHANDLER)(int param,int min_interval_us);
|
||||
typedef void (*OPL_PORTHANDLER_W)(int param,unsigned char data);
|
||||
typedef unsigned char (*OPL_PORTHANDLER_R)(int param);
|
||||
|
||||
|
||||
|
||||
typedef struct{
|
||||
UINT32 ar; /* attack rate: AR<<2 */
|
||||
UINT32 dr; /* decay rate: DR<<2 */
|
||||
UINT32 rr; /* release rate:RR<<2 */
|
||||
UINT8 KSR; /* key scale rate */
|
||||
UINT8 ksl; /* keyscale level */
|
||||
UINT8 ksr; /* key scale rate: kcode>>KSR */
|
||||
UINT8 mul; /* multiple: mul_tab[ML] */
|
||||
|
||||
/* Phase Generator */
|
||||
UINT32 Cnt; /* frequency counter */
|
||||
UINT32 Incr; /* frequency counter step */
|
||||
UINT8 FB; /* feedback shift value */
|
||||
INT32 *connect1; /* slot1 output pointer */
|
||||
INT32 op1_out[2]; /* slot1 output for feedback */
|
||||
UINT8 CON; /* connection (algorithm) type */
|
||||
|
||||
/* Envelope Generator */
|
||||
UINT8 eg_type; /* percussive/non-percussive mode */
|
||||
UINT8 state; /* phase type */
|
||||
UINT32 TL; /* total level: TL << 2 */
|
||||
INT32 TLL; /* adjusted now TL */
|
||||
INT32 volume; /* envelope counter */
|
||||
UINT32 sl; /* sustain level: sl_tab[SL] */
|
||||
UINT8 eg_sh_ar; /* (attack state) */
|
||||
UINT8 eg_sel_ar; /* (attack state) */
|
||||
UINT8 eg_sh_dr; /* (decay state) */
|
||||
UINT8 eg_sel_dr; /* (decay state) */
|
||||
UINT8 eg_sh_rr; /* (release state) */
|
||||
UINT8 eg_sel_rr; /* (release state) */
|
||||
UINT32 key; /* 0 = KEY OFF, >0 = KEY ON */
|
||||
|
||||
/* LFO */
|
||||
UINT32 AMmask; /* LFO Amplitude Modulation enable mask */
|
||||
UINT8 vib; /* LFO Phase Modulation enable flag (active high)*/
|
||||
|
||||
/* waveform select */
|
||||
unsigned int wavetable;
|
||||
} OPL_SLOT;
|
||||
|
||||
typedef struct{
|
||||
OPL_SLOT SLOT[2];
|
||||
/* phase generator state */
|
||||
UINT32 block_fnum; /* block+fnum */
|
||||
UINT32 fc; /* Freq. Increment base */
|
||||
UINT32 ksl_base; /* KeyScaleLevel Base step */
|
||||
UINT8 kcode; /* key code (for key scaling) */
|
||||
} OPL_CH;
|
||||
|
||||
/* OPL state */
|
||||
typedef struct fm_opl_f {
|
||||
/* FM channel slots */
|
||||
OPL_CH P_CH[9]; /* OPL/OPL2 chips have 9 channels*/
|
||||
|
||||
UINT32 eg_cnt; /* global envelope generator counter */
|
||||
UINT32 eg_timer; /* global envelope generator counter works at frequency = chipclock/72 */
|
||||
UINT32 eg_timer_add; /* step of eg_timer */
|
||||
UINT32 eg_timer_overflow; /* envelope generator timer overlfows every 1 sample (on real chip) */
|
||||
|
||||
UINT8 rhythm; /* Rhythm mode */
|
||||
|
||||
UINT32 fn_tab[1024]; /* fnumber->increment counter */
|
||||
|
||||
/* LFO */
|
||||
UINT8 lfo_am_depth;
|
||||
UINT8 lfo_pm_depth_range;
|
||||
UINT32 lfo_am_cnt;
|
||||
UINT32 lfo_am_inc;
|
||||
UINT32 lfo_pm_cnt;
|
||||
UINT32 lfo_pm_inc;
|
||||
|
||||
UINT32 noise_rng; /* 23 bit noise shift register */
|
||||
UINT32 noise_p; /* current noise 'phase' */
|
||||
UINT32 noise_f; /* current noise period */
|
||||
|
||||
UINT8 wavesel; /* waveform select enable flag */
|
||||
|
||||
int T[2]; /* timer counters */
|
||||
int TC[2];
|
||||
UINT8 st[2]; /* timer enable */
|
||||
|
||||
#if BUILD_Y8950
|
||||
/* Delta-T ADPCM unit (Y8950) */
|
||||
|
||||
YM_DELTAT *deltat;
|
||||
|
||||
/* Keyboard and I/O ports interface */
|
||||
UINT8 portDirection;
|
||||
UINT8 portLatch;
|
||||
OPL_PORTHANDLER_R porthandler_r;
|
||||
OPL_PORTHANDLER_W porthandler_w;
|
||||
int port_param;
|
||||
OPL_PORTHANDLER_R keyboardhandler_r;
|
||||
OPL_PORTHANDLER_W keyboardhandler_w;
|
||||
int keyboard_param;
|
||||
#endif
|
||||
|
||||
/* external event callback handlers */
|
||||
OPL_TIMERHANDLER TimerHandler; /* TIMER handler */
|
||||
int TimerParam; /* TIMER parameter */
|
||||
OPL_IRQHANDLER IRQHandler; /* IRQ handler */
|
||||
int IRQParam; /* IRQ parameter */
|
||||
OPL_UPDATEHANDLER UpdateHandler;/* stream update handler */
|
||||
int UpdateParam; /* stream update parameter */
|
||||
|
||||
UINT8 type; /* chip type */
|
||||
UINT8 address; /* address register */
|
||||
UINT8 status; /* status flag */
|
||||
UINT8 statusmask; /* status mask */
|
||||
UINT8 mode; /* Reg.08 : CSM,notesel,etc. */
|
||||
|
||||
int clock; /* master clock (Hz) */
|
||||
int rate; /* sampling rate (Hz) */
|
||||
double freqbase; /* frequency base */
|
||||
double TimerBase; /* Timer base time (==sampling time)*/
|
||||
} FM_OPL;
|
||||
|
||||
|
||||
|
||||
#if BUILD_YM3812
|
||||
|
||||
int YM3812Init(int num, int clock, int rate);
|
||||
void YM3812Shutdown(void);
|
||||
void YM3812ResetChip(int which);
|
||||
int YM3812Write(int which, int a, int v);
|
||||
unsigned char YM3812Read(int which, int a);
|
||||
int YM3812TimerOver(int which, int c);
|
||||
void YM3812UpdateOne(int which, OPLSAMPLE *buffer, int length);
|
||||
|
||||
void YM3812SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
|
||||
void YM3812SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
|
||||
void YM3812SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if BUILD_YM3526
|
||||
|
||||
/*
|
||||
** Initialize YM3526 emulator(s).
|
||||
**
|
||||
** 'num' is the number of virtual YM3526's to allocate
|
||||
** 'clock' is the chip clock in Hz
|
||||
** 'rate' is sampling rate
|
||||
*/
|
||||
int YM3526Init(int num, int clock, int rate);
|
||||
/* shutdown the YM3526 emulators*/
|
||||
void YM3526Shutdown(void);
|
||||
void YM3526ResetChip(int which);
|
||||
int YM3526Write(int which, int a, int v);
|
||||
unsigned char YM3526Read(int which, int a);
|
||||
int YM3526TimerOver(int which, int c);
|
||||
/*
|
||||
** Generate samples for one of the YM3526's
|
||||
**
|
||||
** 'which' is the virtual YM3526 number
|
||||
** '*buffer' is the output buffer pointer
|
||||
** 'length' is the number of samples that should be generated
|
||||
*/
|
||||
void YM3526UpdateOne(int which, INT16 *buffer, int length);
|
||||
|
||||
void YM3526SetTimerHandler(int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
|
||||
void YM3526SetIRQHandler(int which, OPL_IRQHANDLER IRQHandler, int param);
|
||||
void YM3526SetUpdateHandler(int which, OPL_UPDATEHANDLER UpdateHandler, int param);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if BUILD_Y8950
|
||||
|
||||
#include "ymdeltat.h"
|
||||
|
||||
/* Y8950 port handlers */
|
||||
void Y8950SetPortHandler(int which, OPL_PORTHANDLER_W PortHandler_w, OPL_PORTHANDLER_R PortHandler_r, int param);
|
||||
void Y8950SetKeyboardHandler(int which, OPL_PORTHANDLER_W KeyboardHandler_w, OPL_PORTHANDLER_R KeyboardHandler_r, int param);
|
||||
void Y8950SetDeltaTMemory(int which, void * deltat_mem_ptr, int deltat_mem_size );
|
||||
|
||||
int Y8950Init (int num, int clock, int rate);
|
||||
void Y8950Shutdown (void);
|
||||
void Y8950ResetChip (int which);
|
||||
int Y8950Write (int which, int a, int v);
|
||||
unsigned char Y8950Read (int which, int a);
|
||||
int Y8950TimerOver (int which, int c);
|
||||
void Y8950UpdateOne (int which, INT16 *buffer, int length);
|
||||
|
||||
void Y8950SetTimerHandler (int which, OPL_TIMERHANDLER TimerHandler, int channelOffset);
|
||||
void Y8950SetIRQHandler (int which, OPL_IRQHANDLER IRQHandler, int param);
|
||||
void Y8950SetUpdateHandler (int which, OPL_UPDATEHANDLER UpdateHandler, int param);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
int limit( int val, int max, int min );
|
||||
void OPL_STATUS_SET(FM_OPL *OPL,int flag);
|
||||
void OPL_STATUS_RESET(FM_OPL *OPL,int flag);
|
||||
void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag);
|
||||
void advance_lfo(FM_OPL *OPL);
|
||||
void advance(FM_OPL *OPL);
|
||||
signed int op_calc(UINT32 phase, unsigned int env, signed int pm, unsigned int wave_tab);
|
||||
signed int op_calc1(UINT32 phase, unsigned int env, signed int pm, unsigned int wave_tab);
|
||||
void OPL_CALC_CH( OPL_CH *CH );
|
||||
void OPL_CALC_RH( OPL_CH *CH, unsigned int noise );
|
||||
void FM_KEYON(OPL_SLOT *SLOT, UINT32 key_set);
|
||||
void FM_KEYOFF(OPL_SLOT *SLOT, UINT32 key_clr);
|
||||
void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT);
|
||||
void set_mul(FM_OPL *OPL,int slot,int v);
|
||||
void set_ksl_tl(FM_OPL *OPL,int slot,int v);
|
||||
void set_ar_dr(FM_OPL *OPL,int slot,int v);
|
||||
void set_sl_rr(FM_OPL *OPL,int slot,int v);
|
||||
void CSMKeyControll(OPL_CH *CH);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
274
project/jni/application/opentyrian/src/font.c
Normal file
274
project/jni/application/opentyrian/src/font.c
Normal file
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "font.h"
|
||||
#include "fonthand.h"
|
||||
#include "sprite.h"
|
||||
|
||||
/**
|
||||
* \file font.c
|
||||
* \brief Text drawing routines.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Draws text in a color specified by hue and value and with a drop
|
||||
* shadow.
|
||||
*
|
||||
* A '~' in the text is not drawn but instead toggles highlighting which
|
||||
* increases \c value by 4.
|
||||
*
|
||||
* \li like JE_dString() if (black == false && shadow_dist == 2 && hue == 15)
|
||||
* \li like JE_textShade() with PART_SHADE if (black == true && shadow_dist == 1)
|
||||
* \li like JE_outTextAndDarken() if (black == false && shadow_dist == 1)
|
||||
* \li like JE_outTextAdjust() with shadow if (black == false && shadow_dist == 2)
|
||||
*
|
||||
* @param surface destination surface
|
||||
* @param x initial x-position in pixels; which direction(s) the text is drawn
|
||||
* from this position depends on the alignment
|
||||
* @param y initial upper y-position in pixels
|
||||
* @param text text to be drawn
|
||||
* @param font style/size of text
|
||||
* @param alignment left_aligned, centered, or right_aligned
|
||||
* @param hue hue component of text color
|
||||
* @param value value component of text color
|
||||
* @param black if true the shadow is drawn as solid black, if false the shadow
|
||||
* is drawn by darkening the pixels of the destination surface
|
||||
* @param shadow_dist distance in pixels that the shadow will be drawn away from
|
||||
* the text. (This is added to both the x and y positions, so a value of
|
||||
* 1 causes the shadow to be drawn 1 pixel right and 1 pixel lower than
|
||||
* the text.)
|
||||
*/
|
||||
void draw_font_hv_shadow( SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value, bool black, int shadow_dist )
|
||||
{
|
||||
draw_font_dark(surface, x + shadow_dist, y + shadow_dist, text, font, alignment, black);
|
||||
|
||||
draw_font_hv(surface, x, y, text, font, alignment, hue, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Draws text in a color specified by hue and value and with a
|
||||
* surrounding shadow.
|
||||
*
|
||||
* A '~' in the text is not drawn but instead toggles highlighting which
|
||||
* increases \c value by 4.
|
||||
*
|
||||
* \li like JE_textShade() with FULL_SHADE if (black == true && shadow_dist == 1)
|
||||
*
|
||||
* @param surface destination surface
|
||||
* @param x initial x-position in pixels; which direction(s) the text is drawn
|
||||
* from this position depends on the alignment
|
||||
* @param y initial upper y-position in pixels
|
||||
* @param text text to be drawn
|
||||
* @param font style/size of text
|
||||
* @param alignment left_aligned, centered, or right_aligned
|
||||
* @param hue hue component of text color
|
||||
* @param value value component of text color
|
||||
* @param black if true the shadow is drawn as solid black, if false the shadow
|
||||
* is drawn by darkening the pixels of the destination surface
|
||||
* @param shadow_dist distance in pixels that the shadows will be drawn away
|
||||
* from the text. (This distance is separately added to and subtracted
|
||||
* from the x position and y position, resulting in four shadows -- one
|
||||
* in each cardinal direction. If this shadow distance is small enough,
|
||||
* this produces a shadow that outlines the text.)
|
||||
*/
|
||||
void draw_font_hv_full_shadow( SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value, bool black, int shadow_dist )
|
||||
{
|
||||
draw_font_dark(surface, x, y - shadow_dist, text, font, alignment, black);
|
||||
draw_font_dark(surface, x + shadow_dist, y, text, font, alignment, black);
|
||||
draw_font_dark(surface, x, y + shadow_dist, text, font, alignment, black);
|
||||
draw_font_dark(surface, x - shadow_dist, y, text, font, alignment, black);
|
||||
|
||||
draw_font_hv(surface, x, y, text, font, alignment, hue, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Draws text in a color specified by hue and value.
|
||||
*
|
||||
* A '~' in the text is not drawn but instead toggles highlighting which
|
||||
* increases \c value by 4.
|
||||
*
|
||||
* \li like JE_outText() with (brightness >= 0)
|
||||
* \li like JE_outTextAdjust() without shadow
|
||||
*
|
||||
* @param surface destination surface
|
||||
* @param x initial x-position in pixels; which direction(s) the text is drawn
|
||||
* from this position depends on the alignment
|
||||
* @param y initial upper y-position in pixels
|
||||
* @param text text to be drawn
|
||||
* @param font style/size of text
|
||||
* @param alignment left_aligned, centered, or right_aligned
|
||||
* @param hue hue component of text color
|
||||
* @param value value component of text color
|
||||
*/
|
||||
void draw_font_hv( SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value )
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case left_aligned:
|
||||
break;
|
||||
case centered:
|
||||
x -= JE_textWidth(text, font) / 2;
|
||||
break;
|
||||
case right_aligned:
|
||||
x -= JE_textWidth(text, font);
|
||||
break;
|
||||
}
|
||||
|
||||
bool highlight = false;
|
||||
|
||||
for (; *text != '\0'; ++text)
|
||||
{
|
||||
int sprite_id = font_ascii[(unsigned char)*text];
|
||||
|
||||
switch (*text)
|
||||
{
|
||||
case ' ':
|
||||
x += 6;
|
||||
break;
|
||||
|
||||
case '~':
|
||||
highlight = !highlight;
|
||||
if (highlight)
|
||||
value += 4;
|
||||
else
|
||||
value -= 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (sprite_id != -1 && sprite_exists(font, sprite_id))
|
||||
{
|
||||
blit_sprite_hv(surface, x, y, font, sprite_id, hue, value);
|
||||
|
||||
x += sprite(font, sprite_id)->width + 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Draws blended text in a color specified by hue and value.
|
||||
*
|
||||
* Corresponds to blit_sprite_hv_blend()
|
||||
*
|
||||
* \li like JE_outTextModify()
|
||||
*
|
||||
* @param surface destination surface
|
||||
* @param x initial x-position in pixels; which direction(s) the text is drawn
|
||||
* from this position depends on the alignment
|
||||
* @param y initial upper y-position in pixels
|
||||
* @param text text to be drawn
|
||||
* @param font style/size of text
|
||||
* @param alignment left_aligned, centered, or right_aligned
|
||||
* @param hue hue component of text color
|
||||
* @param value value component of text color
|
||||
*/
|
||||
void draw_font_hv_blend( SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value )
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case left_aligned:
|
||||
break;
|
||||
case centered:
|
||||
x -= JE_textWidth(text, font) / 2;
|
||||
break;
|
||||
case right_aligned:
|
||||
x -= JE_textWidth(text, font);
|
||||
break;
|
||||
}
|
||||
|
||||
for (; *text != '\0'; ++text)
|
||||
{
|
||||
int sprite_id = font_ascii[(unsigned char)*text];
|
||||
|
||||
switch (*text)
|
||||
{
|
||||
case ' ':
|
||||
x += 6;
|
||||
break;
|
||||
|
||||
case '~':
|
||||
break;
|
||||
|
||||
default:
|
||||
if (sprite_id != -1 && sprite_exists(font, sprite_id))
|
||||
{
|
||||
blit_sprite_hv_blend(surface, x, y, font, sprite_id, hue, value);
|
||||
|
||||
x += sprite(font, sprite_id)->width + 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Draws darkened text.
|
||||
*
|
||||
* Corresponds to blit_sprite_dark()
|
||||
*
|
||||
* \li like JE_outText() with (brightness < 0) if (black == true)
|
||||
*
|
||||
* @param surface destination surface
|
||||
* @param x initial x-position in pixels; which direction(s) the text is drawn
|
||||
* from this position depends on the alignment
|
||||
* @param y initial upper y-position in pixels
|
||||
* @param text text to be drawn
|
||||
* @param font style/size of text
|
||||
* @param alignment left_aligned, centered, or right_aligned
|
||||
* @param black if true text is drawn as solid black, if false text is drawn by
|
||||
* darkening the pixels of the destination surface
|
||||
*/
|
||||
void draw_font_dark( SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, bool black )
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case left_aligned:
|
||||
break;
|
||||
case centered:
|
||||
x -= JE_textWidth(text, font) / 2;
|
||||
break;
|
||||
case right_aligned:
|
||||
x -= JE_textWidth(text, font);
|
||||
break;
|
||||
}
|
||||
|
||||
for (; *text != '\0'; ++text)
|
||||
{
|
||||
int sprite_id = font_ascii[(unsigned char)*text];
|
||||
|
||||
switch (*text)
|
||||
{
|
||||
case ' ':
|
||||
x += 6;
|
||||
break;
|
||||
|
||||
case '~':
|
||||
break;
|
||||
|
||||
default:
|
||||
if (sprite_id != -1 && sprite_exists(font, sprite_id))
|
||||
{
|
||||
blit_sprite_dark(surface, x, y, font, sprite_id, black);
|
||||
|
||||
x += sprite(font, sprite_id)->width + 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "font.h"
|
||||
#include "fonthand.h"
|
||||
#include "sprite.h"
|
||||
|
||||
// like JE_dString() if (black == false && shadow_dist == 2 && hue == 15)
|
||||
// like JE_textShade() with PART_SHADE if (black == true && shadow_dist == 1)
|
||||
// like JE_outTextAndDarken() if (black == false && shadow_dist == 1)
|
||||
// like JE_outTextAdjust() with shadow if (black == false && shadow_dist == 2)
|
||||
void draw_font_hv_shadow( SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value, bool black, int shadow_dist )
|
||||
{
|
||||
draw_font_dark(surface, x + shadow_dist, y + shadow_dist, text, font, alignment, black);
|
||||
|
||||
draw_font_hv(surface, x, y, text, font, alignment, hue, value);
|
||||
}
|
||||
|
||||
// like JE_textShade() with FULL_SHADE if (black == true && shadow_dist == 1)
|
||||
void draw_font_hv_full_shadow( SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value, bool black, int shadow_dist )
|
||||
{
|
||||
draw_font_dark(surface, x, y - shadow_dist, text, font, alignment, black);
|
||||
draw_font_dark(surface, x + shadow_dist, y, text, font, alignment, black);
|
||||
draw_font_dark(surface, x, y + shadow_dist, text, font, alignment, black);
|
||||
draw_font_dark(surface, x - shadow_dist, y, text, font, alignment, black);
|
||||
|
||||
draw_font_hv(surface, x, y, text, font, alignment, hue, value);
|
||||
}
|
||||
|
||||
// like JE_outText() with (brightness >= 0)
|
||||
// like JE_outTextAdjust() without shadow
|
||||
void draw_font_hv( SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value )
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case left_aligned:
|
||||
break;
|
||||
case centered:
|
||||
x -= JE_textWidth(text, font) / 2;
|
||||
break;
|
||||
case right_aligned:
|
||||
x -= JE_textWidth(text, font);
|
||||
break;
|
||||
}
|
||||
|
||||
bool highlight = false;
|
||||
|
||||
for (; *text != '\0'; ++text)
|
||||
{
|
||||
int sprite_id = font_ascii[(unsigned char)*text];
|
||||
|
||||
switch (*text)
|
||||
{
|
||||
case ' ':
|
||||
x += 6;
|
||||
break;
|
||||
|
||||
case '~':
|
||||
highlight = !highlight;
|
||||
if (highlight)
|
||||
value += 4;
|
||||
else
|
||||
value -= 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (sprite_id != -1 && sprite_exists(font, sprite_id))
|
||||
{
|
||||
blit_sprite_hv(surface, x, y, font, sprite_id, hue, value);
|
||||
|
||||
x += sprite(font, sprite_id)->width + 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// like JE_outTextModify()
|
||||
void draw_font_hv_blend( SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, Uint8 hue, Sint8 value )
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case left_aligned:
|
||||
break;
|
||||
case centered:
|
||||
x -= JE_textWidth(text, font) / 2;
|
||||
break;
|
||||
case right_aligned:
|
||||
x -= JE_textWidth(text, font);
|
||||
break;
|
||||
}
|
||||
|
||||
for (; *text != '\0'; ++text)
|
||||
{
|
||||
int sprite_id = font_ascii[(unsigned char)*text];
|
||||
|
||||
switch (*text)
|
||||
{
|
||||
case ' ':
|
||||
x += 6;
|
||||
break;
|
||||
|
||||
case '~':
|
||||
break;
|
||||
|
||||
default:
|
||||
if (sprite_id != -1 && sprite_exists(font, sprite_id))
|
||||
{
|
||||
blit_sprite_hv_blend(surface, x, y, font, sprite_id, hue, value);
|
||||
|
||||
x += sprite(font, sprite_id)->width + 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// like JE_outText() with (brightness < 0) if (black == true)
|
||||
void draw_font_dark( SDL_Surface *surface, int x, int y, const char *text, Font font, FontAlignment alignment, bool black )
|
||||
{
|
||||
switch (alignment)
|
||||
{
|
||||
case left_aligned:
|
||||
break;
|
||||
case centered:
|
||||
x -= JE_textWidth(text, font) / 2;
|
||||
break;
|
||||
case right_aligned:
|
||||
x -= JE_textWidth(text, font);
|
||||
break;
|
||||
}
|
||||
|
||||
for (; *text != '\0'; ++text)
|
||||
{
|
||||
int sprite_id = font_ascii[(unsigned char)*text];
|
||||
|
||||
switch (*text)
|
||||
{
|
||||
case ' ':
|
||||
x += 6;
|
||||
break;
|
||||
|
||||
case '~':
|
||||
break;
|
||||
|
||||
default:
|
||||
if (sprite_id != -1 && sprite_exists(font, sprite_id))
|
||||
{
|
||||
blit_sprite_dark(surface, x, y, font, sprite_id, black);
|
||||
|
||||
x += sprite(font, sprite_id)->width + 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -330,4 +330,3 @@ void JE_outTextGlow( SDL_Surface * screen, int x, int y, const char *s )
|
||||
textGlowBrightness = 6;
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -57,4 +57,3 @@ void JE_outTextGlow( SDL_Surface * screen, int x, int y, const char *s );
|
||||
|
||||
#endif /* FONTHAND_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -16,6 +16,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "backgrnd.h"
|
||||
#include "config.h"
|
||||
#include "file.h"
|
||||
#include "fonthand.h"
|
||||
@@ -33,6 +34,7 @@
|
||||
#include "pcxmast.h"
|
||||
#include "picload.h"
|
||||
#include "player.h"
|
||||
#include "shots.h"
|
||||
#include "sprite.h"
|
||||
#include "tyrian2.h"
|
||||
#include "varz.h"
|
||||
@@ -66,7 +68,7 @@ static JE_MenuChoiceType menuChoices;
|
||||
static JE_integer col, colC;
|
||||
static JE_byte lastCurSel;
|
||||
static JE_integer curMenu;
|
||||
static JE_byte curSel[MAX_MENU]; /* [1..maxmenu] */
|
||||
static JE_byte curSel[MENU_MAX]; /* [1..maxmenu] */
|
||||
static JE_byte curItemType, curItem, cursor;
|
||||
static JE_boolean leftPower, rightPower, rightPowerAfford;
|
||||
static JE_byte currentCube;
|
||||
@@ -83,7 +85,7 @@ static PlayerItems old_items[2]; // TODO: should not be global if possible
|
||||
static struct cube_struct cube[4];
|
||||
|
||||
static const JE_MenuChoiceType menuChoicesDefault = { 7, 9, 8, 0, 0, 13, (SAVE_FILES_NUM / 2) + 2, 0, 0, 6, 4, 6, 7, 5 };
|
||||
static const JE_byte menuEsc[MAX_MENU] = { 0, 1, 1, 1, 2, 3, 3, 1, 8, 0, 0, 11, 3, 0 };
|
||||
static const JE_byte menuEsc[MENU_MAX] = { 0, 1, 1, 1, 2, 3, 3, 1, 8, 0, 0, 11, 3, 0 };
|
||||
static const JE_byte itemAvailMap[7] = { 1, 2, 3, 9, 4, 6, 7 };
|
||||
static const JE_word planetX[21] = { 200, 150, 240, 300, 270, 280, 320, 260, 220, 150, 160, 210, 80, 240, 220, 180, 310, 330, 150, 240, 200 };
|
||||
static const JE_word planetY[21] = { 40, 90, 90, 80, 170, 30, 50, 130, 120, 150, 220, 200, 80, 50, 160, 10, 55, 55, 90, 90, 40 };
|
||||
@@ -171,10 +173,8 @@ void JE_itemScreen( void )
|
||||
cursor = 1;
|
||||
curItem = 0;
|
||||
|
||||
for (int x = 0; x < MAX_MENU; x++)
|
||||
{
|
||||
curSel[x] = 2;
|
||||
}
|
||||
for (unsigned int i = 0; i < COUNTOF(curSel); ++i)
|
||||
curSel[i] = 2;
|
||||
|
||||
curMenu = 0;
|
||||
|
||||
@@ -324,7 +324,7 @@ void JE_itemScreen( void )
|
||||
else
|
||||
{
|
||||
min = 2;
|
||||
max = 13;
|
||||
max = 12;
|
||||
}
|
||||
|
||||
for (int x = min; x <= max; x++)
|
||||
@@ -380,7 +380,7 @@ void JE_itemScreen( void )
|
||||
/* keyboard settings menu */
|
||||
if (curMenu == 5)
|
||||
{
|
||||
for (int x = 2; x <= 13; x++)
|
||||
for (int x = 2; x <= 12; x++)
|
||||
{
|
||||
if (x == curSel[curMenu])
|
||||
{
|
||||
@@ -395,15 +395,9 @@ void JE_itemScreen( void )
|
||||
|
||||
if( x == 12 )
|
||||
{
|
||||
char *AutoFireNames[] = { "Touchscreen", "Fire button", "Touch and Button", "None" };
|
||||
JE_textShade(VGAScreen, 166, 38 + (x - 2)*12, "Auto-Fire", temp2 / 16, temp2 % 16 - 8, DARKEN);
|
||||
JE_textShade(VGAScreen, 230, 38 + (x - 2)*12, AutoFireNames[autoFireMode], temp2 / 16, temp2 % 16 - 8, DARKEN);
|
||||
}
|
||||
else if( x == 13 )
|
||||
{
|
||||
char *TouchscreenNames[] = { "Ship above finger", "Ship to the left", "Ship below finger", "Fire only", "None" };
|
||||
JE_textShade(VGAScreen, 166, 38 + (x - 2)*12, "Touchscreen", temp2 / 16, temp2 % 16 - 8, DARKEN);
|
||||
JE_textShade(VGAScreen, 230, 38 + (x - 2)*12, TouchscreenNames[touchscreenMode], temp2 / 16, temp2 % 16 - 8, DARKEN);
|
||||
char *touchscreenControlNames[] = { "Ship follows touch", "Joystick + buttons", "Both" };
|
||||
JE_textShade(VGAScreen, 166, 38 + (x - 2)*12, "Touch mode", temp2 / 16, temp2 % 16 - 8, DARKEN);
|
||||
JE_textShade(VGAScreen, 230, 38 + (x - 2)*12, touchscreenControlNames[touchscreenControlMode], temp2 / 16, temp2 % 16 - 8, DARKEN);
|
||||
}
|
||||
else
|
||||
JE_textShade(VGAScreen, 166, 38 + (x - 2)*12, menuInt[curMenu + 1][x-1], temp2 / 16, temp2 % 16 - 8, DARKEN);
|
||||
@@ -415,7 +409,7 @@ void JE_itemScreen( void )
|
||||
}
|
||||
}
|
||||
|
||||
menuChoices[5] = 13;
|
||||
menuChoices[5] = 12;
|
||||
}
|
||||
|
||||
/* Joystick settings menu */
|
||||
@@ -546,7 +540,7 @@ void JE_itemScreen( void )
|
||||
temp_cost = 0;
|
||||
}
|
||||
|
||||
temp4 = (temp_cost > player[0].cash) ? 4 : 0; // can player afford current weapon at all
|
||||
int afford_shade = (temp_cost > player[0].cash) ? 4 : 0; // can player afford current weapon at all
|
||||
|
||||
temp = itemAvail[itemAvailMap[curSel[1]-2]-1][tempW-1]; /* Item ID */
|
||||
switch (curSel[1]-1)
|
||||
@@ -599,7 +593,7 @@ void JE_itemScreen( void )
|
||||
{
|
||||
strcpy(tempStr, miscText[13]);
|
||||
}
|
||||
JE_textShade(VGAScreen, 185, tempY, tempStr, temp2 / 16, temp2 % 16 -8-temp4, DARKEN);
|
||||
JE_textShade(VGAScreen, 185, tempY, tempStr, temp2 / 16, temp2 % 16 - 8 - afford_shade, DARKEN);
|
||||
|
||||
/* Draw icon if not DONE. NOTE: None is a normal item with a blank icon. */
|
||||
if (tempW < menuChoices[curMenu]-1)
|
||||
@@ -616,7 +610,7 @@ void JE_itemScreen( void )
|
||||
char buf[20];
|
||||
|
||||
snprintf(buf, sizeof buf, "Cost: %d", temp_cost);
|
||||
JE_textShade(VGAScreen, 187, tempY+10, buf, temp2 / 16, temp2 % 16 - 8 - temp4, DARKEN);
|
||||
JE_textShade(VGAScreen, 187, tempY+10, buf, temp2 / 16, temp2 % 16 - 8 - afford_shade, DARKEN);
|
||||
}
|
||||
}
|
||||
} /* /weapon upgrade */
|
||||
@@ -673,8 +667,8 @@ void JE_itemScreen( void )
|
||||
/* Changing the volume? */
|
||||
if ((curMenu == 2) || (curMenu == 11))
|
||||
{
|
||||
JE_barDrawShadow(VGAScreen, 225, 70, 1, 16, tyrMusicVolume / 12, 3, 13);
|
||||
JE_barDrawShadow(VGAScreen, 225, 86, 1, 16, fxVolume / 12, 3, 13);
|
||||
JE_barDrawShadow(VGAScreen, 225, 70, 1, music_disabled ? 12 : 16, tyrMusicVolume / 12, 3, 13);
|
||||
JE_barDrawShadow(VGAScreen, 225, 86, 1, samples_disabled ? 12 : 16, fxVolume / 12, 3, 13);
|
||||
}
|
||||
|
||||
/* 7 is data cubes menu, 8 is reading a data cube, "firstmenu9" refers to menu 8 because of reindexing */
|
||||
@@ -1132,34 +1126,34 @@ void JE_itemScreen( void )
|
||||
|
||||
if ((mouseY > 20) && (mouseX > 170) && (mouseX < 308) && (curMenu != 8))
|
||||
{
|
||||
const JE_byte mouseSelectionY[MAX_MENU] = { 16, 16, 16, 16, 26, 12, 11, 28, 0, 16, 16, 16, 8, 16 };
|
||||
const JE_byte mouseSelectionY[MENU_MAX] = { 16, 16, 16, 16, 26, 12, 11, 28, 0, 16, 16, 16, 8, 16 };
|
||||
|
||||
tempI = (mouseY - 38) / mouseSelectionY[curMenu]+2;
|
||||
int selection = (mouseY - 38) / mouseSelectionY[curMenu]+2;
|
||||
|
||||
if (curMenu == 9)
|
||||
{
|
||||
if (tempI > 5)
|
||||
tempI--;
|
||||
if (tempI > 3)
|
||||
tempI--;
|
||||
if (selection > 5)
|
||||
selection--;
|
||||
if (selection > 3)
|
||||
selection--;
|
||||
}
|
||||
|
||||
if (curMenu == 0)
|
||||
{
|
||||
if (tempI > 7)
|
||||
tempI = 7;
|
||||
if (selection > 7)
|
||||
selection = 7;
|
||||
}
|
||||
|
||||
// is play next level screen?
|
||||
if (curMenu == 3)
|
||||
{
|
||||
if (tempI == menuChoices[curMenu] + 1)
|
||||
tempI = menuChoices[curMenu];
|
||||
if (selection == menuChoices[curMenu] + 1)
|
||||
selection = menuChoices[curMenu];
|
||||
}
|
||||
|
||||
if (tempI <= menuChoices[curMenu])
|
||||
if (selection <= menuChoices[curMenu])
|
||||
{
|
||||
if ((curMenu == 4) && (tempI == menuChoices[4]))
|
||||
if ((curMenu == 4) && (selection == menuChoices[4]))
|
||||
{
|
||||
player[0].cash = JE_cashLeft();
|
||||
curMenu = 1;
|
||||
@@ -1168,13 +1162,13 @@ void JE_itemScreen( void )
|
||||
else
|
||||
{
|
||||
JE_playSampleNum(S_CLICK);
|
||||
if (curSel[curMenu] == tempI)
|
||||
if (curSel[curMenu] == selection)
|
||||
{
|
||||
JE_menuFunction(curSel[curMenu]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((curMenu == 5) && (JE_getCost(curSel[1], itemAvail[itemAvailMap[curSel[2]-1]][tempI-1]) > player[0].cash))
|
||||
if ((curMenu == 4) && (JE_getCost(curSel[1], itemAvail[itemAvailMap[curSel[2]-1]][selection-2]) > player[0].cash))
|
||||
{
|
||||
JE_playSampleNum(S_CLINK);
|
||||
}
|
||||
@@ -1183,7 +1177,7 @@ void JE_itemScreen( void )
|
||||
if (curSel[1] == 4)
|
||||
player[0].weapon_mode = 1;
|
||||
|
||||
curSel[curMenu] = tempI;
|
||||
curSel[curMenu] = selection;
|
||||
}
|
||||
|
||||
// in front or rear weapon upgrade screen?
|
||||
@@ -1584,6 +1578,7 @@ void JE_itemScreen( void )
|
||||
|
||||
} while (!(quit || gameLoaded || jumpSection));
|
||||
|
||||
#ifdef WITH_NETWORK
|
||||
if (!quit && isNetworkGame)
|
||||
{
|
||||
JE_barShade(VGAScreen, 3, 3, 316, 196);
|
||||
@@ -1624,6 +1619,7 @@ void JE_itemScreen( void )
|
||||
SDL_Delay(16);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (gameLoaded)
|
||||
fade_black(10);
|
||||
@@ -1940,7 +1936,7 @@ void JE_drawMenuChoices( void )
|
||||
tempY -= 16;
|
||||
}
|
||||
|
||||
str = (char *)malloc(strlen(menuInt[curMenu + 1][x-1])+2);
|
||||
str = malloc(strlen(menuInt[curMenu + 1][x-1])+2);
|
||||
if (curSel[curMenu] == x)
|
||||
{
|
||||
str[0] = '~';
|
||||
@@ -2200,7 +2196,7 @@ void JE_scaleBitmap( SDL_Surface *dst_bitmap, const SDL_Surface *src_bitmap, in
|
||||
|
||||
|
||||
//Okay, it's time to loop through and add bits of A to a rectangle in B
|
||||
Uint8 *dst = (Uint8 *)dst_bitmap->pixels; /* 8-bit specific */
|
||||
Uint8 *dst = dst_bitmap->pixels; /* 8-bit specific */
|
||||
const Uint8 *src, *src_w; /* 8-bit specific */
|
||||
|
||||
dst += y1 * dst_bitmap->pitch + x1;
|
||||
@@ -2250,7 +2246,7 @@ void JE_initWeaponView( void )
|
||||
memset(shotRepeat, 1, sizeof(shotRepeat));
|
||||
memset(shotMultiPos, 0, sizeof(shotMultiPos));
|
||||
|
||||
JE_setupStars();
|
||||
initialize_starfield();
|
||||
}
|
||||
|
||||
void JE_computeDots( void )
|
||||
@@ -2329,26 +2325,28 @@ void JE_drawMainMenuHelpText( void )
|
||||
{
|
||||
int help[16] = { 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 24, 11 };
|
||||
memcpy(tempStr, mainMenuHelp[help[curSel[curMenu] - 2]], sizeof(tempStr));
|
||||
} else if (curMenu < 3 || curMenu == 9 || curMenu > 10) {
|
||||
memcpy(tempStr, mainMenuHelp[(menuHelp[curMenu][temp])-1], sizeof(tempStr));
|
||||
} else {
|
||||
if (curMenu == 5 && curSel[5] == 10)
|
||||
{
|
||||
memcpy(tempStr, mainMenuHelp[25-1], sizeof(tempStr));
|
||||
}
|
||||
else if (leftPower || rightPower)
|
||||
{
|
||||
memcpy(tempStr, mainMenuHelp[24-1], sizeof(tempStr));
|
||||
}
|
||||
else if ( (temp == menuChoices[curMenu] - 1) || ( (curMenu == 7) && (cubeMax == 0) ) )
|
||||
{
|
||||
memcpy(tempStr, mainMenuHelp[12-1], sizeof(tempStr));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(tempStr, mainMenuHelp[17 + curMenu - 3], sizeof(tempStr));
|
||||
}
|
||||
}
|
||||
else if (curMenu < 3 || curMenu == 9 || curMenu > 10)
|
||||
{
|
||||
memcpy(tempStr, mainMenuHelp[(menuHelp[curMenu][temp])-1], sizeof(tempStr));
|
||||
}
|
||||
else if (curMenu == 5 && curSel[5] == 10)
|
||||
{
|
||||
memcpy(tempStr, mainMenuHelp[25-1], sizeof(tempStr));
|
||||
}
|
||||
else if (leftPower || rightPower)
|
||||
{
|
||||
memcpy(tempStr, mainMenuHelp[24-1], sizeof(tempStr));
|
||||
}
|
||||
else if ( (temp == menuChoices[curMenu] - 1) || ( (curMenu == 7) && (cubeMax == 0) ) )
|
||||
{
|
||||
memcpy(tempStr, mainMenuHelp[12-1], sizeof(tempStr));
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(tempStr, mainMenuHelp[17 + curMenu - 3], sizeof(tempStr));
|
||||
}
|
||||
|
||||
JE_textShade(VGAScreen, 10, 187, tempStr, 14, 1, DARKEN);
|
||||
}
|
||||
|
||||
@@ -2453,6 +2451,7 @@ JE_boolean JE_quitRequest( void )
|
||||
|
||||
JE_playSampleNum(quit_selected ? S_SPRING : S_CLICK);
|
||||
|
||||
#ifdef WITH_NETWORK
|
||||
if (isNetworkGame && quit_selected)
|
||||
{
|
||||
network_prepare(PACKET_QUIT);
|
||||
@@ -2460,6 +2459,7 @@ JE_boolean JE_quitRequest( void )
|
||||
|
||||
network_tyrian_halt(0, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
return quit_selected;
|
||||
}
|
||||
@@ -2659,18 +2659,11 @@ void JE_menuFunction( JE_byte select )
|
||||
break;
|
||||
|
||||
case 5: /* keyboard settings */
|
||||
if (curSelect == 12) /* Auto-Fire mode */
|
||||
if (curSelect == 12) /* Touchscreen mode */
|
||||
{
|
||||
autoFireMode = (AutoFireMode_t)(autoFireMode + 1);
|
||||
if(autoFireMode >= AUTOFIRE_LAST)
|
||||
autoFireMode = AUTOFIRE_TOUCHSCREEN;
|
||||
JE_saveConfiguration();
|
||||
}
|
||||
else if (curSelect == 13) /* Touchscreen mode */
|
||||
{
|
||||
touchscreenMode = (TouchscreenMode_t)(touchscreenMode + 1);
|
||||
if(touchscreenMode >= TOUCHSCREEN_LAST)
|
||||
touchscreenMode = TOUCHSCREEN_SHIP_ABOVE_FINGER;
|
||||
touchscreenControlMode = touchscreenControlMode + 1;
|
||||
if(touchscreenControlMode >= TOUCHSCREEN_CONTROL_LAST)
|
||||
touchscreenControlMode = TOUCHSCREEN_CONTROL_FINGER;
|
||||
JE_saveConfiguration();
|
||||
}
|
||||
else if (curSelect == 10) /* reset to defaults */
|
||||
@@ -2730,8 +2723,6 @@ void JE_menuFunction( JE_byte select )
|
||||
|
||||
if (lastkey_sym != SDLK_ESCAPE && // reserved for menu
|
||||
lastkey_sym != SDLK_F11 && // reserved for gamma
|
||||
lastkey_sym != SDLK_s && // reserved for sample mute
|
||||
lastkey_sym != SDLK_m && // reserved for music mute
|
||||
lastkey_sym != SDLK_p) // reserved for pause
|
||||
{
|
||||
JE_playSampleNum(S_CLICK);
|
||||
@@ -2804,7 +2795,7 @@ void JE_menuFunction( JE_byte select )
|
||||
case 3:
|
||||
case 4:
|
||||
JE_playSampleNum(S_CURSOR);
|
||||
{
|
||||
|
||||
int temp = curSel[curMenu] - 3;
|
||||
do {
|
||||
if (joysticks == 0)
|
||||
@@ -2818,7 +2809,6 @@ void JE_menuFunction( JE_byte select )
|
||||
inputDevice[temp]++;
|
||||
}
|
||||
} while (inputDevice[temp] == inputDevice[temp == 0 ? 1 : 0]);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
curMenu = 2;
|
||||
@@ -3059,8 +3049,8 @@ void JE_drawShipSpecs( SDL_Surface * screen, SDL_Surface * temp_screen )
|
||||
* We can't work in place. In fact we'll need to overlay the result
|
||||
* To avoid our temp screen dependence this has been rewritten to
|
||||
* only write one line at a time.*/
|
||||
dst = (Uint8 *)screen->pixels;
|
||||
src = (Uint8 *)temp_screen->pixels;
|
||||
dst = screen->pixels;
|
||||
src = temp_screen->pixels;
|
||||
for (int y = 0; y < screen->h; y++)
|
||||
{
|
||||
for (int x = 0; x < screen->pitch; x++)
|
||||
@@ -3151,40 +3141,12 @@ void JE_weaponSimUpdate( void )
|
||||
|
||||
void JE_weaponViewFrame( void )
|
||||
{
|
||||
Uint8 *s; /* screen pointer, 8-bit specific */
|
||||
int i;
|
||||
|
||||
fill_rectangle_xy(VGAScreen, 8, 8, 143, 182, 0);
|
||||
|
||||
/* JE: (* Port Configuration Display *)
|
||||
(* drawportconfigbuttons;*/
|
||||
|
||||
/*===========================STARS==========================*/
|
||||
/*DRAWSTARS*/
|
||||
|
||||
for (i = MAX_STARS; i--;)
|
||||
{
|
||||
s = (Uint8 *)VGAScreen->pixels;
|
||||
|
||||
starDat[i].sLoc += starDat[i].sMov + VGAScreen->pitch;
|
||||
|
||||
if (starDat[i].sLoc < 177 * VGAScreen->pitch)
|
||||
{
|
||||
if (*(s + starDat[i].sLoc) == 0)
|
||||
*(s + starDat[i].sLoc) = starDat[i].sC;
|
||||
if (starDat[i].sC - 4 >= 9 * 16)
|
||||
{
|
||||
if (*(s + starDat[i].sLoc + 1) == 0)
|
||||
*(s + starDat[i].sLoc + 1) = starDat[i].sC - 4;
|
||||
if (starDat[i].sLoc > 0 && *(s + starDat[i].sLoc - 1) == 0)
|
||||
*(s + starDat[i].sLoc - 1) = starDat[i].sC - 4;
|
||||
if (*(s + starDat[i].sLoc + VGAScreen->pitch) == 0)
|
||||
*(s + starDat[i].sLoc + VGAScreen->pitch) = starDat[i].sC - 4;
|
||||
if (starDat[i].sLoc >= VGAScreen->pitch && *(s + starDat[i].sLoc - VGAScreen->pitch) == 0)
|
||||
*(s + starDat[i].sLoc - VGAScreen->pitch) = starDat[i].sC - 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
update_and_draw_starfield(VGAScreen, 1);
|
||||
|
||||
mouseX = player[0].x;
|
||||
mouseY = player[0].y;
|
||||
@@ -3202,7 +3164,7 @@ void JE_weaponViewFrame( void )
|
||||
item_power = player[0].items.weapon[i].power - 1,
|
||||
item_mode = (i == REAR_WEAPON) ? player[0].weapon_mode - 1 : 0;
|
||||
|
||||
JE_initPlayerShot(item, i, player[0].x, player[0].y, mouseX, mouseY, weaponPort[item].op[item_mode][item_power], 1);
|
||||
b = player_shot_create(item, i, player[0].x, player[0].y, mouseX, mouseY, weaponPort[item].op[item_mode][item_power], 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3218,7 +3180,7 @@ void JE_weaponViewFrame( void )
|
||||
const int x = player[0].sidekick[LEFT_SIDEKICK].x,
|
||||
y = player[0].sidekick[LEFT_SIDEKICK].y;
|
||||
|
||||
JE_initPlayerShot(options[item].wport, SHOT_LEFT_SIDEKICK, x, y, mouseX, mouseY, options[item].wpnum, 1);
|
||||
b = player_shot_create(options[item].wport, SHOT_LEFT_SIDEKICK, x, y, mouseX, mouseY, options[item].wpnum, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3245,87 +3207,11 @@ void JE_weaponViewFrame( void )
|
||||
const int x = player[0].sidekick[RIGHT_SIDEKICK].x,
|
||||
y = player[0].sidekick[RIGHT_SIDEKICK].y;
|
||||
|
||||
JE_initPlayerShot(options[item].wport, SHOT_RIGHT_SIDEKICK, x, y, mouseX, mouseY, options[item].wpnum, 1);
|
||||
b = player_shot_create(options[item].wport, SHOT_RIGHT_SIDEKICK, x, y, mouseX, mouseY, options[item].wpnum, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Player Shot Images */
|
||||
for (int z = 0; z < MAX_PWEAPON; z++)
|
||||
{
|
||||
if (shotAvail[z] != 0)
|
||||
{
|
||||
shotAvail[z]--;
|
||||
if (z != MAX_PWEAPON - 1)
|
||||
{
|
||||
playerShotData[z].shotXM += playerShotData[z].shotXC;
|
||||
|
||||
if (playerShotData[z].shotXM <= 100)
|
||||
playerShotData[z].shotX += playerShotData[z].shotXM;
|
||||
|
||||
playerShotData[z].shotYM += playerShotData[z].shotYC;
|
||||
playerShotData[z].shotY += playerShotData[z].shotYM;
|
||||
|
||||
if (playerShotData[z].shotYM > 100)
|
||||
{
|
||||
playerShotData[z].shotY -= 120;
|
||||
playerShotData[z].shotY += player[0].delta_y_shot_move;
|
||||
}
|
||||
|
||||
if (playerShotData[z].shotComplicated != 0)
|
||||
{
|
||||
playerShotData[z].shotDevX += playerShotData[z].shotDirX;
|
||||
playerShotData[z].shotX += playerShotData[z].shotDevX;
|
||||
|
||||
if (abs(playerShotData[z].shotDevX) == playerShotData[z].shotCirSizeX)
|
||||
playerShotData[z].shotDirX = -playerShotData[z].shotDirX;
|
||||
|
||||
playerShotData[z].shotDevY += playerShotData[z].shotDirY;
|
||||
playerShotData[z].shotY += playerShotData[z].shotDevY;
|
||||
|
||||
if (abs(playerShotData[z].shotDevY) == playerShotData[z].shotCirSizeY)
|
||||
playerShotData[z].shotDirY = -playerShotData[z].shotDirY;
|
||||
/*Double Speed Circle Shots - add a second copy of above loop*/
|
||||
}
|
||||
|
||||
int tempShotX = playerShotData[z].shotX;
|
||||
int tempShotY = playerShotData[z].shotY;
|
||||
|
||||
if (playerShotData[z].shotX < 0 || playerShotData[z].shotX > 140 ||
|
||||
playerShotData[z].shotY < 0 || playerShotData[z].shotY > 170)
|
||||
{
|
||||
shotAvail[z] = 0;
|
||||
goto draw_player_shot_loop_end;
|
||||
}
|
||||
|
||||
/* if (playerShotData[z].shotTrail != 255)
|
||||
{
|
||||
if (playerShotData[z].shotTrail == 98)
|
||||
{
|
||||
JE_setupExplosion(playerShotData[z].shotX - playerShotData[z].shotXM, playerShotData[z].shotY - playerShotData[z].shotYM, playerShotData[z].shotTrail);
|
||||
} else {
|
||||
JE_setupExplosion(playerShotData[z].shotX, playerShotData[z].shotY, playerShotData[z].shotTrail);
|
||||
}
|
||||
}*/
|
||||
|
||||
tempW = playerShotData[z].shotGr + playerShotData[z].shotAni;
|
||||
if (++playerShotData[z].shotAni == playerShotData[z].shotAniMax)
|
||||
playerShotData[z].shotAni = 0;
|
||||
|
||||
if (tempW < 6000)
|
||||
{
|
||||
if (tempW > 1000)
|
||||
tempW = tempW % 1000;
|
||||
if (tempW > 500)
|
||||
blit_sprite2(VGAScreen, tempShotX+1, tempShotY, shapesW2, tempW - 500);
|
||||
else
|
||||
blit_sprite2(VGAScreen, tempShotX+1, tempShotY, shapesC1, tempW);
|
||||
}
|
||||
}
|
||||
|
||||
draw_player_shot_loop_end:
|
||||
;
|
||||
}
|
||||
}
|
||||
simulate_player_shots();
|
||||
|
||||
blit_sprite(VGAScreenSeg, 0, 0, OPTION_SHAPES, 12); // upgrade interface
|
||||
|
||||
@@ -3372,4 +3258,3 @@ draw_player_shot_loop_end:
|
||||
//JE_waitFrameCount(); TODO: didn't do anything?
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "helptext.h"
|
||||
#include "opentyr.h"
|
||||
|
||||
typedef JE_byte JE_MenuChoiceType[MAX_MENU];
|
||||
typedef JE_byte JE_MenuChoiceType[MENU_MAX];
|
||||
|
||||
JE_longint JE_cashLeft( void );
|
||||
void JE_itemScreen( void );
|
||||
@@ -56,4 +56,3 @@ void JE_weaponViewFrame( void );
|
||||
|
||||
#endif // GAME_MENU_H
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <string.h>
|
||||
|
||||
|
||||
const JE_byte menuHelp[MAX_MENU][11] = /* [1..maxmenu, 1..11] */
|
||||
const JE_byte menuHelp[MENU_MAX][11] = /* [1..maxmenu, 1..11] */
|
||||
{
|
||||
{ 1, 34, 2, 3, 4, 5, 0, 0, 0, 0, 0 },
|
||||
{ 6, 7, 8, 9, 10, 11, 11, 12, 0, 0, 0 },
|
||||
@@ -52,29 +52,29 @@ JE_byte helpBoxColor = 12;
|
||||
JE_byte helpBoxBrightness = 1;
|
||||
JE_byte helpBoxShadeType = FULL_SHADE;
|
||||
|
||||
char helpTxt[MAX_HELP_MESSAGE][231]; /* [1..maxhelpmessage] of string [230]; */
|
||||
char pName[21][16]; /* [1..21] of string [15] */
|
||||
char miscText[68][42]; /* [1..68] of string [41] */
|
||||
char miscTextB[5][11]; /* [1..5] of string [10] */
|
||||
char keyName[8][18]; /* [1..8] of string [17] */
|
||||
char menuText[7][21]; /* [1..7] of string [20] */
|
||||
char outputs[9][31]; /* [1..9] of string [30] */
|
||||
char topicName[6][21]; /* [1..6] of string [20] */
|
||||
char mainMenuHelp[34][66];
|
||||
char inGameText[6][21]; /* [1..6] of string [20] */
|
||||
char detailLevel[6][13]; /* [1..6] of string [12] */
|
||||
char gameSpeedText[5][13]; /* [1..5] of string [12] */
|
||||
char inputDevices[3][13]; /* [1..3] of string [12] */
|
||||
char networkText[4][22]; /* [1..4] of string [20] */
|
||||
char difficultyNameB[11][21]; /* [0..9] of string [20] */
|
||||
char joyButtonNames[5][21]; /* [1..5] of string [20] */
|
||||
char superShips[11][26]; /* [0..10] of string [25] */
|
||||
char specialName[9][10]; /* [1..9] of string [9] */
|
||||
char destructHelp[25][22];
|
||||
char weaponNames[17][17]; /* [1..17] of string [16] */
|
||||
char destructModeName[DESTRUCT_MODES][13]; /* [1..destructmodes] of string [12] */
|
||||
char shipInfo[13][2][256];
|
||||
char menuInt[MAX_MENU + 1][11][18]; /* [0..maxmenu, 1..11] of string [17] */
|
||||
char helpTxt[39][231]; /* [1..39] of string [230] */
|
||||
char pName[21][16]; /* [1..21] of string [15] */
|
||||
char miscText[HELPTEXT_MISCTEXT_COUNT][42]; /* [1..68] of string [41] */
|
||||
char miscTextB[HELPTEXT_MISCTEXTB_COUNT][HELPTEXT_MISCTEXTB_SIZE]; /* [1..5] of string [10] */
|
||||
char keyName[8][18]; /* [1..8] of string [17] */
|
||||
char menuText[7][HELPTEXT_MENUTEXT_SIZE]; /* [1..7] of string [20] */
|
||||
char outputs[9][31]; /* [1..9] of string [30] */
|
||||
char topicName[6][21]; /* [1..6] of string [20] */
|
||||
char mainMenuHelp[HELPTEXT_MAINMENUHELP_COUNT][66]; /* [1..34] of string [65] */
|
||||
char inGameText[6][21]; /* [1..6] of string [20] */
|
||||
char detailLevel[6][13]; /* [1..6] of string [12] */
|
||||
char gameSpeedText[5][13]; /* [1..5] of string [12] */
|
||||
char inputDevices[3][13]; /* [1..3] of string [12] */
|
||||
char networkText[HELPTEXT_NETWORKTEXT_COUNT][HELPTEXT_NETWORKTEXT_SIZE]; /* [1..4] of string [20] */
|
||||
char difficultyNameB[11][21]; /* [0..9] of string [20] */
|
||||
char joyButtonNames[5][21]; /* [1..5] of string [20] */
|
||||
char superShips[HELPTEXT_SUPERSHIPS_COUNT][26]; /* [0..10] of string [25] */
|
||||
char specialName[HELPTEXT_SPECIALNAME_COUNT][10]; /* [1..9] of string [9] */
|
||||
char destructHelp[25][22]; /* [1..25] of string [21] */
|
||||
char weaponNames[17][17]; /* [1..17] of string [16] */
|
||||
char destructModeName[DESTRUCT_MODES][13]; /* [1..destructmodes] of string [12] */
|
||||
char shipInfo[HELPTEXT_SHIPINFO_COUNT][2][256]; /* [1..13, 1..2] of string */
|
||||
char menuInt[MENU_MAX+1][11][18]; /* [0..14, 1..11] of string [17] */
|
||||
|
||||
|
||||
void decrypt_pascal_string( char *s, int len )
|
||||
@@ -174,210 +174,217 @@ void JE_HBox( SDL_Surface *screen, int x, int y, unsigned int messagenum, unsig
|
||||
|
||||
void JE_loadHelpText( void )
|
||||
{
|
||||
#ifdef TYRIAN2000
|
||||
const unsigned int menuInt_entries[MENU_MAX + 1] = { -1, 7, 9, 9, -1, -1, 11, -1, -1, -1, 7, 4, 6, 7, 5 };
|
||||
#else
|
||||
const unsigned int menuInt_entries[MENU_MAX + 1] = { -1, 7, 9, 8, -1, -1, 11, -1, -1, -1, 6, 4, 6, 7, 5 };
|
||||
#endif
|
||||
|
||||
FILE *f = dir_fopen_die(data_dir(), "tyrian.hdt", "rb");
|
||||
efread(&episode1DataLoc, sizeof(JE_longint), 1, f);
|
||||
|
||||
/*Online Help*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < MAX_HELP_MESSAGE; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(helpTxt); ++i)
|
||||
read_encrypted_pascal_string(helpTxt[i], sizeof(helpTxt[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Planet names*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 21; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(pName); ++i)
|
||||
read_encrypted_pascal_string(pName[i], sizeof(pName[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Miscellaneous text*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 68; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(miscText); ++i)
|
||||
read_encrypted_pascal_string(miscText[i], sizeof(miscText[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Little Miscellaneous text*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(miscTextB); ++i)
|
||||
read_encrypted_pascal_string(miscTextB[i], sizeof(miscTextB[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Key names*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 11; ++i)
|
||||
for (unsigned int i = 0; i < menuInt_entries[6]; ++i)
|
||||
read_encrypted_pascal_string(menuInt[6][i], sizeof(menuInt[6][i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Main Menu*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 7; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(menuText); ++i)
|
||||
read_encrypted_pascal_string(menuText[i], sizeof(menuText[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Event text*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 9; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(outputs); ++i)
|
||||
read_encrypted_pascal_string(outputs[i], sizeof(outputs[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Help topics*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(topicName); ++i)
|
||||
read_encrypted_pascal_string(topicName[i], sizeof(topicName[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Main Menu Help*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 34; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(mainMenuHelp); ++i)
|
||||
read_encrypted_pascal_string(mainMenuHelp[i], sizeof(mainMenuHelp[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Menu 1 - Main*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 7; ++i)
|
||||
for (unsigned int i = 0; i < menuInt_entries[1]; ++i)
|
||||
read_encrypted_pascal_string(menuInt[1][i], sizeof(menuInt[1][i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Menu 2 - Items*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 9; ++i)
|
||||
for (unsigned int i = 0; i < menuInt_entries[2]; ++i)
|
||||
read_encrypted_pascal_string(menuInt[2][i], sizeof(menuInt[2][i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Menu 3 - Options*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 8; ++i)
|
||||
for (unsigned int i = 0; i < menuInt_entries[3]; ++i)
|
||||
read_encrypted_pascal_string(menuInt[3][i], sizeof(menuInt[3][i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*InGame Menu*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(inGameText); ++i)
|
||||
read_encrypted_pascal_string(inGameText[i], sizeof(inGameText[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Detail Level*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(detailLevel); ++i)
|
||||
read_encrypted_pascal_string(detailLevel[i], sizeof(detailLevel[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Game speed text*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(gameSpeedText); ++i)
|
||||
read_encrypted_pascal_string(gameSpeedText[i], sizeof(gameSpeedText[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
// episode names
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i <= 5; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(episode_name); ++i)
|
||||
read_encrypted_pascal_string(episode_name[i], sizeof(episode_name[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
// difficulty names
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i <= 6; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(difficulty_name); ++i)
|
||||
read_encrypted_pascal_string(difficulty_name[i], sizeof(difficulty_name[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
// gameplay mode names
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i <= 4; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(gameplay_name); ++i)
|
||||
read_encrypted_pascal_string(gameplay_name[i], sizeof(gameplay_name[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Menu 10 - 2Player Main*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
for (unsigned int i = 0; i < menuInt_entries[10]; ++i)
|
||||
read_encrypted_pascal_string(menuInt[10][i], sizeof(menuInt[10][i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Input Devices*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(inputDevices); ++i)
|
||||
read_encrypted_pascal_string(inputDevices[i], sizeof(inputDevices[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Network text*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(networkText); ++i)
|
||||
read_encrypted_pascal_string(networkText[i], sizeof(networkText[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Menu 11 - 2Player Network*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
for (unsigned int i = 0; i < menuInt_entries[11]; ++i)
|
||||
read_encrypted_pascal_string(menuInt[11][i], sizeof(menuInt[11][i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*HighScore Difficulty Names*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i <= 10; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(difficultyNameB); ++i)
|
||||
read_encrypted_pascal_string(difficultyNameB[i], sizeof(difficultyNameB[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Menu 12 - Network Options*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 6; ++i)
|
||||
for (unsigned int i = 0; i < menuInt_entries[12]; ++i)
|
||||
read_encrypted_pascal_string(menuInt[12][i], sizeof(menuInt[12][i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Menu 13 - Joystick*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 7; ++i)
|
||||
for (unsigned int i = 0; i < menuInt_entries[13]; ++i)
|
||||
read_encrypted_pascal_string(menuInt[13][i], sizeof(menuInt[13][i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Joystick Button Assignments*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(joyButtonNames); ++i)
|
||||
read_encrypted_pascal_string(joyButtonNames[i], sizeof(joyButtonNames[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*SuperShips - For Super Arcade Mode*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i <= 10; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(superShips); ++i)
|
||||
read_encrypted_pascal_string(superShips[i], sizeof(superShips[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*SuperShips - For Super Arcade Mode*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 9; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(specialName); ++i)
|
||||
read_encrypted_pascal_string(specialName[i], sizeof(specialName[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Secret DESTRUCT game*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 25; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(destructHelp); ++i)
|
||||
read_encrypted_pascal_string(destructHelp[i], sizeof(destructHelp[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Secret DESTRUCT weapons*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 17; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(weaponNames); ++i)
|
||||
read_encrypted_pascal_string(weaponNames[i], sizeof(weaponNames[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*Secret DESTRUCT modes*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < DESTRUCT_MODES; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(destructModeName); ++i)
|
||||
read_encrypted_pascal_string(destructModeName[i], sizeof(destructModeName[i]), f);
|
||||
skip_pascal_string(f);
|
||||
|
||||
/*NEW: Ship Info*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 13; ++i)
|
||||
for (unsigned int i = 0; i < COUNTOF(shipInfo); ++i)
|
||||
{
|
||||
read_encrypted_pascal_string(shipInfo[i][0], sizeof(shipInfo[i][0]), f);
|
||||
read_encrypted_pascal_string(shipInfo[i][1], sizeof(shipInfo[i][1]), f);
|
||||
}
|
||||
skip_pascal_string(f);
|
||||
|
||||
|
||||
#ifndef TYRIAN2000
|
||||
/*Menu 12 - Network Options*/
|
||||
skip_pascal_string(f);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
for (unsigned int i = 0; i < menuInt_entries[14]; ++i)
|
||||
read_encrypted_pascal_string(menuInt[14][i], sizeof(menuInt[14][i]), f);
|
||||
|
||||
#endif
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -21,38 +21,66 @@
|
||||
|
||||
#include "opentyr.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_HELP_MESSAGE 39
|
||||
#define MAX_MENU 14
|
||||
#define MENU_MAX 14
|
||||
|
||||
#define DESTRUCT_MODES 5
|
||||
|
||||
extern const JE_byte menuHelp[MENU_MAX][11]; /* [1..14, 1..11] */
|
||||
|
||||
extern JE_byte verticalHeight;
|
||||
extern JE_byte helpBoxColor, helpBoxBrightness, helpBoxShadeType;
|
||||
extern char helpTxt[MAX_HELP_MESSAGE][231];
|
||||
extern char pName[21][16]; /* [1..21] of string [15] */
|
||||
extern char miscText[68][42]; /* [1..68] of string [41] */
|
||||
extern char miscTextB[5][11]; /* [1..5] of string [10] */
|
||||
extern char keyName[8][18]; /* [1..8] of string [17] */
|
||||
extern char menuText[7][21]; /* [1..7] of string [20] */
|
||||
extern char outputs[9][31]; /* [1..9] of string [30] */
|
||||
extern char topicName[6][21]; /* [1..6] of string [20] */
|
||||
extern char mainMenuHelp[34][66];
|
||||
extern char inGameText[6][21]; /* [1..6] of string [20] */
|
||||
extern char detailLevel[6][13]; /* [1..6] of string [12] */
|
||||
extern char gameSpeedText[5][13]; /* [1..5] of string [12] */
|
||||
extern char inputDevices[3][13]; /* [1..3] of string [12] */
|
||||
extern char networkText[4][22]; /* [1..4] of string [20] */
|
||||
extern char difficultyNameB[11][21]; /* [0..9] of string [20] */
|
||||
extern char joyButtonNames[5][21]; /* [1..5] of string [20] */
|
||||
extern char superShips[11][26]; /* [0..10] of string [25] */
|
||||
extern char specialName[9][10]; /* [1..9] of string [9] */
|
||||
|
||||
#ifdef TYRIAN2000
|
||||
#define HELPTEXT_MISCTEXT_COUNT 72
|
||||
#define HELPTEXT_MISCTEXTB_COUNT 8
|
||||
#define HELPTEXT_MISCTEXTB_SIZE 12
|
||||
#define HELPTEXT_MENUTEXT_SIZE 29
|
||||
#define HELPTEXT_MAINMENUHELP_COUNT 37
|
||||
#define HELPTEXT_NETWORKTEXT_COUNT 5
|
||||
#define HELPTEXT_NETWORKTEXT_SIZE 33
|
||||
#define HELPTEXT_SUPERSHIPS_COUNT 13
|
||||
#define HELPTEXT_SPECIALNAME_COUNT 11
|
||||
#define HELPTEXT_SHIPINFO_COUNT 20
|
||||
#define HELPTEXT_MENUINT3_COUNT 9
|
||||
#define HELPTEXT_MENUINT12_COUNT 7
|
||||
#else
|
||||
#define HELPTEXT_MISCTEXT_COUNT 68
|
||||
#define HELPTEXT_MISCTEXTB_COUNT 5
|
||||
#define HELPTEXT_MISCTEXTB_SIZE 11
|
||||
#define HELPTEXT_MENUTEXT_SIZE 21
|
||||
#define HELPTEXT_MAINMENUHELP_COUNT 34
|
||||
#define HELPTEXT_NETWORKTEXT_COUNT 4
|
||||
#define HELPTEXT_NETWORKTEXT_SIZE 22
|
||||
#define HELPTEXT_SUPERSHIPS_COUNT 11
|
||||
#define HELPTEXT_SPECIALNAME_COUNT 9
|
||||
#define HELPTEXT_SHIPINFO_COUNT 13
|
||||
#endif
|
||||
|
||||
extern char helpTxt[39][231];
|
||||
extern char pName[21][16];
|
||||
extern char miscText[HELPTEXT_MISCTEXT_COUNT][42];
|
||||
extern char miscTextB[HELPTEXT_MISCTEXTB_COUNT][HELPTEXT_MISCTEXTB_SIZE];
|
||||
extern char keyName[8][18];
|
||||
extern char menuText[7][HELPTEXT_MENUTEXT_SIZE];
|
||||
extern char outputs[9][31];
|
||||
extern char topicName[6][21];
|
||||
extern char mainMenuHelp[HELPTEXT_MAINMENUHELP_COUNT][66];
|
||||
extern char inGameText[6][21];
|
||||
extern char detailLevel[6][13];
|
||||
extern char gameSpeedText[5][13];
|
||||
extern char inputDevices[3][13];
|
||||
extern char networkText[HELPTEXT_NETWORKTEXT_COUNT][HELPTEXT_NETWORKTEXT_SIZE];
|
||||
extern char difficultyNameB[11][21];
|
||||
extern char joyButtonNames[5][21];
|
||||
extern char superShips[HELPTEXT_SUPERSHIPS_COUNT][26];
|
||||
extern char specialName[HELPTEXT_SPECIALNAME_COUNT][10];
|
||||
extern char destructHelp[25][22];
|
||||
extern char weaponNames[17][17]; /* [1..17] of string [16] */
|
||||
extern char destructModeName[DESTRUCT_MODES][13]; /* [1..destructmodes] of string [12] */
|
||||
extern char shipInfo[13][2][256];
|
||||
extern char menuInt[MAX_MENU+1][11][18]; /* [0..maxmenu, 1..11] of string [17] */
|
||||
extern const JE_byte menuHelp[MAX_MENU][11]; /* [1..maxmenu, 1..11] */
|
||||
extern char weaponNames[17][17];
|
||||
extern char destructModeName[DESTRUCT_MODES][13];
|
||||
extern char shipInfo[HELPTEXT_SHIPINFO_COUNT][2][256];
|
||||
extern char menuInt[MENU_MAX+1][11][18];
|
||||
|
||||
void read_encrypted_pascal_string( char *s, int size, FILE *f );
|
||||
void skip_pascal_string( FILE *f );
|
||||
@@ -63,4 +91,3 @@ void JE_loadHelpText( void );
|
||||
|
||||
#endif /* HELPTEXT_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define HG_REVISION_H
|
||||
|
||||
#ifndef HG_REV
|
||||
#define HG_REV "8e4c1be1b53f default"
|
||||
#define HG_REV "0a06d5af473c default"
|
||||
#endif
|
||||
|
||||
#endif // HG_REVISION_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -28,6 +28,8 @@
|
||||
#include "video.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
int joystick_axis_threshold( int j, int value );
|
||||
int check_assigned( SDL_Joystick *joystick_handle, const Joystick_assignment assignment[2] );
|
||||
@@ -272,7 +274,7 @@ void init_joysticks( void )
|
||||
SDL_JoystickEventState(SDL_IGNORE);
|
||||
|
||||
joysticks = SDL_NumJoysticks();
|
||||
joystick = (Joystick *)malloc(joysticks * sizeof(*joystick));
|
||||
joystick = malloc(joysticks * sizeof(*joystick));
|
||||
|
||||
for (int j = 0; j < joysticks; j++)
|
||||
{
|
||||
@@ -539,17 +541,17 @@ bool detect_joystick_assignment( int j, Joystick_assignment *assignment )
|
||||
// get initial joystick state to compare against to see if anything was pressed
|
||||
|
||||
const int axes = SDL_JoystickNumAxes(joystick[j].handle);
|
||||
Sint16 *axis = (Sint16 *)malloc(axes * sizeof(*axis));
|
||||
Sint16 *axis = malloc(axes * sizeof(*axis));
|
||||
for (int i = 0; i < axes; i++)
|
||||
axis[i] = SDL_JoystickGetAxis(joystick[j].handle, i);
|
||||
|
||||
const int buttons = SDL_JoystickNumButtons(joystick[j].handle);
|
||||
Uint8 *button = (Uint8 *)malloc(buttons * sizeof(*button));
|
||||
Uint8 *button = malloc(buttons * sizeof(*button));
|
||||
for (int i = 0; i < buttons; i++)
|
||||
button[i] = SDL_JoystickGetButton(joystick[j].handle, i);
|
||||
|
||||
const int hats = SDL_JoystickNumHats(joystick[j].handle);
|
||||
Uint8 *hat = (Uint8 *)malloc(hats * sizeof(*hat));
|
||||
Uint8 *hat = malloc(hats * sizeof(*hat));
|
||||
for (int i = 0; i < hats; i++)
|
||||
hat[i] = SDL_JoystickGetHat(joystick[j].handle, i);
|
||||
|
||||
@@ -656,4 +658,3 @@ bool joystick_assignment_cmp( const Joystick_assignment *a, const Joystick_assig
|
||||
return false;
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -95,4 +95,3 @@ bool joystick_assignment_cmp( const Joystick_assignment *, const Joystick_assign
|
||||
|
||||
#endif /* JOYSTICK_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "vga_palette.h"
|
||||
#include "video.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void jukebox( void )
|
||||
{
|
||||
bool trigger_quit = false, // true when user wants to quit
|
||||
@@ -217,4 +219,3 @@ void jukebox( void )
|
||||
set_volume(tyrMusicVolume, fxVolume);
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -25,4 +25,3 @@ void jukebox( void );
|
||||
|
||||
#endif /* JUKEBOX_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "video_scale.h"
|
||||
|
||||
#include "SDL.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
JE_boolean ESCPressed;
|
||||
@@ -38,15 +39,13 @@ Uint16 lastmouse_x, lastmouse_y;
|
||||
JE_boolean mouse_pressed[3] = {false, false, false};
|
||||
Uint16 mouse_x, mouse_y;
|
||||
|
||||
int numkeys;
|
||||
Uint8 *keysactive;
|
||||
Uint8 keysactive[SDLK_LAST];
|
||||
|
||||
#ifdef NDEBUG
|
||||
bool input_grab_enabled = true,
|
||||
bool input_grab_enabled = true;
|
||||
#else
|
||||
bool input_grab_enabled = false,
|
||||
bool input_grab_enabled = false;
|
||||
#endif
|
||||
input_grabbed = false;
|
||||
|
||||
|
||||
void flush_events_buffer( void )
|
||||
@@ -61,12 +60,15 @@ void wait_input( JE_boolean keyboard, JE_boolean mouse, JE_boolean joystick )
|
||||
service_SDL_events(false);
|
||||
while (!((keyboard && keydown) || (mouse && mousedown) || (joystick && joydown)))
|
||||
{
|
||||
JE_showVGA(); // Must update screen on Android to get new mouse events
|
||||
SDL_Delay(SDL_POLL_INTERVAL);
|
||||
push_joysticks_as_keyboard();
|
||||
service_SDL_events(false);
|
||||
|
||||
#ifdef WITH_NETWORK
|
||||
if (isNetworkGame)
|
||||
network_check();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,18 +77,20 @@ void wait_noinput( JE_boolean keyboard, JE_boolean mouse, JE_boolean joystick )
|
||||
service_SDL_events(false);
|
||||
while ((keyboard && keydown) || (mouse && mousedown) || (joystick && joydown))
|
||||
{
|
||||
JE_showVGA(); // Must update screen on Android to get new mouse events
|
||||
SDL_Delay(SDL_POLL_INTERVAL);
|
||||
poll_joysticks();
|
||||
service_SDL_events(false);
|
||||
|
||||
#ifdef WITH_NETWORK
|
||||
if (isNetworkGame)
|
||||
network_check();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void init_keyboard( void )
|
||||
{
|
||||
keysactive = SDL_GetKeyState(&numkeys);
|
||||
#ifndef ANDROID
|
||||
SDL_EnableKeyRepeat(500, 60);
|
||||
#endif
|
||||
@@ -97,17 +101,17 @@ void init_keyboard( void )
|
||||
SDL_EnableUNICODE(1);
|
||||
}
|
||||
|
||||
void input_grab( void )
|
||||
void input_grab( bool enable )
|
||||
{
|
||||
#if defined(TARGET_GP2X) || defined(TARGET_DINGUX) || defined(ANDROID)
|
||||
input_grabbed = true;
|
||||
#else
|
||||
input_grabbed = input_grab_enabled || fullscreen_enabled;
|
||||
enable = true;
|
||||
#endif
|
||||
|
||||
SDL_ShowCursor(input_grabbed ? SDL_DISABLE : SDL_ENABLE);
|
||||
input_grab_enabled = enable || fullscreen_enabled;
|
||||
|
||||
SDL_ShowCursor(input_grab_enabled ? SDL_DISABLE : SDL_ENABLE);
|
||||
#ifdef NDEBUG
|
||||
SDL_WM_GrabInput(input_grabbed ? SDL_GRAB_ON : SDL_GRAB_OFF);
|
||||
SDL_WM_GrabInput(input_grab_enabled ? SDL_GRAB_ON : SDL_GRAB_OFF);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -121,7 +125,7 @@ JE_word JE_mousePosition( JE_word *mouseX, JE_word *mouseY )
|
||||
|
||||
void set_mouse_position( int x, int y )
|
||||
{
|
||||
if (input_grabbed)
|
||||
if (input_grab_enabled)
|
||||
{
|
||||
SDL_WarpMouse(x * scalers[scaler].width / vga_width, y * scalers[scaler].height / vga_height);
|
||||
mouse_x = x;
|
||||
@@ -144,6 +148,11 @@ void service_SDL_events( JE_boolean clear_new )
|
||||
{
|
||||
switch (ev.type)
|
||||
{
|
||||
case SDL_ACTIVEEVENT:
|
||||
if (ev.active.state == SDL_APPINPUTFOCUS && !ev.active.gain)
|
||||
input_grab(false);
|
||||
break;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
mouse_x = ev.motion.x * vga_width / scalers[scaler].width;
|
||||
mouse_y = ev.motion.y * vga_height / scalers[scaler].height;
|
||||
@@ -170,8 +179,7 @@ void service_SDL_events( JE_boolean clear_new )
|
||||
/* <ctrl><f10> toggle input grab */
|
||||
if (ev.key.keysym.sym == SDLK_F10)
|
||||
{
|
||||
input_grab_enabled = !input_grab_enabled;
|
||||
input_grab();
|
||||
input_grab(!input_grab_enabled);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -193,18 +201,19 @@ void service_SDL_events( JE_boolean clear_new )
|
||||
/* <alt><tab> disable input grab and fullscreen */
|
||||
if (ev.key.keysym.sym == SDLK_TAB)
|
||||
{
|
||||
input_grab_enabled = false;
|
||||
input_grab();
|
||||
|
||||
if (!init_scaler(scaler, false) && // try windowed
|
||||
!init_any_scaler(false) && // try any scaler windowed
|
||||
!init_scaler(scaler, fullscreen_enabled)) // revert on fail
|
||||
{
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
input_grab(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
keysactive[ev.key.keysym.sym] = 1;
|
||||
|
||||
newkey = true;
|
||||
lastkey_sym = ev.key.keysym.sym;
|
||||
@@ -213,15 +222,16 @@ void service_SDL_events( JE_boolean clear_new )
|
||||
keydown = true;
|
||||
return;
|
||||
case SDL_KEYUP:
|
||||
keysactive[ev.key.keysym.sym] = 0;
|
||||
keydown = false;
|
||||
return;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
if (!input_grabbed)
|
||||
if (!input_grab_enabled)
|
||||
{
|
||||
input_grab_enabled = !input_grab_enabled;
|
||||
input_grab();
|
||||
input_grab(true);
|
||||
break;
|
||||
}
|
||||
// intentional fall-though
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
if (ev.type == SDL_MOUSEBUTTONDOWN)
|
||||
{
|
||||
@@ -258,4 +268,3 @@ void JE_clearKeyboard( void )
|
||||
// /!\ Doesn't seems important. I think. D:
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -35,16 +35,15 @@ extern Uint8 lastmouse_but;
|
||||
extern Uint16 lastmouse_x, lastmouse_y;
|
||||
extern JE_boolean mouse_pressed[3];
|
||||
extern Uint16 mouse_x, mouse_y;
|
||||
extern int numkeys;
|
||||
extern Uint8 *keysactive;
|
||||
extern Uint8 keysactive[SDLK_LAST];
|
||||
|
||||
extern bool input_grab_enabled, input_grabbed;
|
||||
extern bool input_grab_enabled;
|
||||
|
||||
void flush_events_buffer( void );
|
||||
void wait_input( JE_boolean keyboard, JE_boolean mouse, JE_boolean joystick );
|
||||
void wait_noinput( JE_boolean keyboard, JE_boolean mouse, JE_boolean joystick );
|
||||
void init_keyboard( void );
|
||||
void input_grab( void );
|
||||
void input_grab( bool enable );
|
||||
JE_word JE_mousePosition( JE_word *mouseX, JE_word *mouseY );
|
||||
void set_mouse_position( int x, int y );
|
||||
|
||||
@@ -66,4 +65,3 @@ void JE_clearKeyboard( void );
|
||||
|
||||
#endif /* KEYBOARD_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -17,13 +17,14 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "file.h"
|
||||
#include "fm_synth.h"
|
||||
#include "lds_play.h"
|
||||
#include "loudness.h"
|
||||
#include "opentyr.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
const unsigned char op_table[9] = {0x00, 0x01, 0x02, 0x08, 0x09, 0x0a, 0x10, 0x11, 0x12};
|
||||
|
||||
/* A substantial amount of this code has been copied and adapted from adplug.
|
||||
Thanks, guys! Adplug is awesome! :D */
|
||||
|
||||
@@ -105,7 +106,7 @@ bool lds_load( FILE *f, unsigned int music_offset, unsigned int music_size )
|
||||
efread(&numpatch, 2, 1, f);
|
||||
|
||||
free(soundbank);
|
||||
soundbank = (SoundBank *)malloc(sizeof(SoundBank) * numpatch);
|
||||
soundbank = malloc(sizeof(SoundBank) * numpatch);
|
||||
|
||||
for (unsigned int i = 0; i < numpatch; i++)
|
||||
{
|
||||
@@ -149,7 +150,7 @@ bool lds_load( FILE *f, unsigned int music_offset, unsigned int music_size )
|
||||
efread(&numposi, 2, 1, f);
|
||||
|
||||
free(positions);
|
||||
positions = (Position *)malloc(sizeof(Position) * 9 * numposi);
|
||||
positions = malloc(sizeof(Position) * 9 * numposi);
|
||||
|
||||
for (unsigned int i = 0; i < numposi; i++)
|
||||
{
|
||||
@@ -173,7 +174,7 @@ bool lds_load( FILE *f, unsigned int music_offset, unsigned int music_size )
|
||||
unsigned int remaining = music_size - (ftell(f) - music_offset);
|
||||
|
||||
free(patterns);
|
||||
patterns = (Uint16 *)malloc(sizeof(Uint16) * (remaining / 2));
|
||||
patterns = malloc(sizeof(Uint16) * (remaining / 2));
|
||||
|
||||
for (unsigned int i = 0; i < remaining / 2; i++)
|
||||
efread(&patterns[i], 2, 1, f);
|
||||
@@ -207,7 +208,7 @@ void lds_rewind( void )
|
||||
memset(fmchip, 0, sizeof(fmchip));
|
||||
|
||||
/* OPL2 init */
|
||||
opl_reset(); /* Reset OPL chip */
|
||||
opl_init(); /* Reset OPL chip */
|
||||
opl_write(1, 0x20);
|
||||
opl_write(8, 0);
|
||||
opl_write(0xbd, regbd);
|
||||
@@ -765,4 +766,3 @@ void lds_playsound(int inst_number, int channel_number, int tunehigh)
|
||||
c->nextvol = c->glideto = c->finetune = c->vibcount = c->arp_pos = c->arp_count = 0;
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "opentyr.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
extern bool playing, songlooped;
|
||||
|
||||
int lds_update( void );
|
||||
@@ -70,4 +72,3 @@ void lds_setregs_adv(unsigned char reg, unsigned char mask, unsigned char val);
|
||||
|
||||
#endif /* LDS_PLAY_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -17,7 +17,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
#include "file.h"
|
||||
#include "fm_synth.h"
|
||||
#include "lds_play.h"
|
||||
#include "loudness.h"
|
||||
#include "nortsong.h"
|
||||
@@ -61,7 +60,7 @@ bool init_audio( void )
|
||||
ask.freq = freq;
|
||||
ask.format = (BYTES_PER_SAMPLE == 2) ? AUDIO_S16SYS : AUDIO_S8;
|
||||
ask.channels = 1;
|
||||
ask.samples = 512;
|
||||
ask.samples = 2048;
|
||||
ask.callback = audio_cb;
|
||||
|
||||
printf("\trequested %d Hz, %d channels, %d samples\n", ask.freq, ask.channels, ask.samples);
|
||||
@@ -186,8 +185,6 @@ void deinit_audio( void )
|
||||
channel_len[i] = 0;
|
||||
}
|
||||
|
||||
opl_deinit();
|
||||
|
||||
lds_free();
|
||||
}
|
||||
|
||||
@@ -200,7 +197,7 @@ void load_music( void )
|
||||
|
||||
efread(&song_count, sizeof(song_count), 1, music_file);
|
||||
|
||||
song_offset = (Uint32*)malloc((song_count + 1) * sizeof(song_offset));
|
||||
song_offset = malloc((song_count + 1) * sizeof(*song_offset));
|
||||
|
||||
efread(song_offset, 4, song_count, music_file);
|
||||
song_offset[song_count] = ftell_eof(music_file);
|
||||
@@ -252,7 +249,7 @@ void stop_song( void )
|
||||
|
||||
void fade_song( void )
|
||||
{
|
||||
printf("TODO: %s\n", __FUNCTION__);
|
||||
/* STUB: we have no implementation of this to port */
|
||||
}
|
||||
|
||||
void set_volume( unsigned int music, unsigned int sample )
|
||||
@@ -271,7 +268,7 @@ void JE_multiSamplePlay(JE_byte *buffer, JE_word size, JE_byte chan, JE_byte vol
|
||||
free(channel_buffer[chan]);
|
||||
|
||||
channel_len[chan] = size * BYTES_PER_SAMPLE * SAMPLE_SCALING;
|
||||
channel_buffer[chan] = (OPLSAMPLE*)malloc(channel_len[chan]);
|
||||
channel_buffer[chan] = malloc(channel_len[chan]);
|
||||
channel_pos[chan] = channel_buffer[chan];
|
||||
channel_vol[chan] = vol + 1;
|
||||
|
||||
@@ -290,4 +287,3 @@ void JE_multiSamplePlay(JE_byte *buffer, JE_word size, JE_byte chan, JE_byte vol
|
||||
SDL_UnlockAudio();
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -19,8 +19,8 @@
|
||||
#ifndef LOUDNESS_H
|
||||
#define LOUDNESS_H
|
||||
|
||||
#include "fmopl.h"
|
||||
#include "opentyr.h"
|
||||
#include "opl.h"
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
#endif
|
||||
|
||||
#define SAMPLE_SCALING OUTPUT_QUALITY
|
||||
#define SAMPLE_TYPE OPLSAMPLE
|
||||
#define BYTES_PER_SAMPLE (OPL_SAMPLE_BITS / 8)
|
||||
#define SAMPLE_TYPE Bit16s
|
||||
#define BYTES_PER_SAMPLE 2
|
||||
|
||||
extern float music_volume, sample_volume;
|
||||
|
||||
@@ -57,4 +57,3 @@ void JE_multiSamplePlay(JE_byte *buffer, JE_word size, JE_byte chan, JE_byte vol
|
||||
|
||||
#endif /* LOUDNESS_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -39,4 +39,3 @@ void JE_analyzeLevel( void )
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -32,4 +32,3 @@ void JE_analyzeLevel( void );
|
||||
|
||||
#endif /* LVLLIB_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -171,4 +171,3 @@ TYPE 5: Shape Files
|
||||
M 1 2 3 4 episode
|
||||
*/
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -21,9 +21,19 @@
|
||||
|
||||
#include "opentyr.h"
|
||||
|
||||
|
||||
#define EVENT_MAXIMUM 2500
|
||||
|
||||
#ifdef TYRIAN2000
|
||||
#define WEAP_NUM 818
|
||||
#define PORT_NUM 60
|
||||
#define ARMOR_NUM 4
|
||||
#define POWER_NUM 6
|
||||
#define ENGINE_NUM 6
|
||||
#define OPTION_NUM 37
|
||||
#define SHIP_NUM 18
|
||||
#define SHIELD_NUM 11
|
||||
#define SPECIAL_NUM 46
|
||||
#else
|
||||
#define WEAP_NUM 780
|
||||
#define PORT_NUM 42
|
||||
#define ARMOR_NUM 4
|
||||
@@ -33,6 +43,7 @@
|
||||
#define SHIP_NUM 13
|
||||
#define SHIELD_NUM 10
|
||||
#define SPECIAL_NUM 46
|
||||
#endif
|
||||
|
||||
#define ENEMY_NUM 850
|
||||
|
||||
@@ -46,4 +57,3 @@ extern const JE_char shapeFile[34]; /* [1..34] */
|
||||
|
||||
#endif /* LVLMAST_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* vim: set noet:
|
||||
*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
/*
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2008 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -91,4 +91,3 @@ void JE_playerCollide( Player *this_player, JE_byte playerNum );
|
||||
|
||||
#endif /* MAININT_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -16,6 +16,12 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <SDL_video.h>
|
||||
#include <SDL_image.h>
|
||||
#include <SDL_screenkeyboard.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "episodes.h"
|
||||
#include "fonthand.h"
|
||||
@@ -29,10 +35,13 @@
|
||||
#include "sprite.h"
|
||||
#include "video.h"
|
||||
|
||||
char episode_name[6][31], difficulty_name[7][21], gameplay_name[5][26];
|
||||
char episode_name[6][31], difficulty_name[7][21], gameplay_name[GAMEPLAY_NAME_COUNT][26];
|
||||
|
||||
SDL_Rect screen_button_pos_destruct[SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM];
|
||||
bool screen_button_pos_destruct_initialized;
|
||||
|
||||
bool
|
||||
select_menuitem_by_touch(JE_byte menu_top, JE_byte menu_spacing, JE_shortint menu_item_count, JE_shortint *current_item)
|
||||
select_menuitem_by_touch(int menu_top, int menu_spacing, int menu_item_count, int *current_item)
|
||||
{
|
||||
if (!mousedown)
|
||||
return false;
|
||||
@@ -51,21 +60,156 @@ select_menuitem_by_touch(JE_byte menu_top, JE_byte menu_spacing, JE_shortint men
|
||||
return true;
|
||||
}
|
||||
|
||||
void android_setup_screen_keys( void )
|
||||
{
|
||||
if (touchscreenControlMode == TOUCHSCREEN_CONTROL_FINGER)
|
||||
{
|
||||
int W = SDL_ListModes(NULL, 0)[0]->w;
|
||||
int H = SDL_ListModes(NULL, 0)[0]->h;
|
||||
SDL_Rect r;
|
||||
|
||||
// Rear gun mode button
|
||||
r.x = 558 * W / 640;
|
||||
r.y = 46 * H / 400;
|
||||
r.w = 82 * W / 640;
|
||||
r.h = 58 * H / 400;
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &r);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonImagePos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &r);
|
||||
|
||||
// Left sidekick button
|
||||
r.x = 558 * W / 640;
|
||||
r.y = 104 * H / 400;
|
||||
r.w = 82 * W / 640;
|
||||
r.h = 58 * H / 400;
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &r);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonImagePos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &r);
|
||||
|
||||
// Right sidekick button
|
||||
r.x = 558 * W / 640;
|
||||
r.y = 162 * H / 400;
|
||||
r.w = 82 * W / 640;
|
||||
r.h = 58 * H / 400;
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &r);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonImagePos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &r);
|
||||
|
||||
SDL_ANDROID_SetScreenKeyboardTransparency(SDL_ALPHA_TRANSPARENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Setup joystick with buttons */
|
||||
android_setup_screen_keys_destruct();
|
||||
}
|
||||
}
|
||||
|
||||
void android_cleanup_screen_keys( void )
|
||||
{
|
||||
if (!screen_button_pos_destruct_initialized)
|
||||
{
|
||||
screen_button_pos_destruct_initialized = true;
|
||||
for (int i = 0; i < SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM; i++)
|
||||
{
|
||||
SDL_ANDROID_GetScreenKeyboardButtonPos(i, &screen_button_pos_destruct[i]);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Rect r = {0, 0, 0, 0}; // Hide all buttons
|
||||
for (int i = 0; i < SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM; i++)
|
||||
{
|
||||
if (i != SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT)
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(i, &r);
|
||||
}
|
||||
|
||||
SDL_ANDROID_SetScreenKeyboardTransparency(192); // Text input button should not be totally transparent
|
||||
}
|
||||
|
||||
void android_setup_screen_keys_destruct( void )
|
||||
{
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_0, &screen_button_pos_destruct[SDL_ANDROID_SCREENKEYBOARD_BUTTON_0]);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_1, &screen_button_pos_destruct[SDL_ANDROID_SCREENKEYBOARD_BUTTON_1]);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_2, &screen_button_pos_destruct[SDL_ANDROID_SCREENKEYBOARD_BUTTON_2]);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_3, &screen_button_pos_destruct[SDL_ANDROID_SCREENKEYBOARD_BUTTON_3]);
|
||||
SDL_ANDROID_SetScreenKeyboardButtonPos(SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD, &screen_button_pos_destruct[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD]);
|
||||
|
||||
SDL_ANDROID_SetScreenKeyboardTransparency(192);
|
||||
}
|
||||
|
||||
void android_show_tutorial( void )
|
||||
{
|
||||
static const char *tutorial_flag_file = "tutorial-shown.flag";
|
||||
FILE *shown = fopen(tutorial_flag_file, "r");
|
||||
__android_log_print(ANDROID_LOG_INFO, "Tyrian", "android_show_tutorial: %s: %s", tutorial_flag_file, shown ? "already shown" : "not shown");
|
||||
|
||||
if (shown)
|
||||
{
|
||||
fclose(shown);
|
||||
return;
|
||||
}
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "Tyrian", "android_show_tutorial: creating %s", tutorial_flag_file);
|
||||
shown = fopen(tutorial_flag_file, "w");
|
||||
if (!shown)
|
||||
return;
|
||||
fprintf(shown, "Tutorial was shown - remove this file to show it again\n");
|
||||
fclose(shown);
|
||||
|
||||
static const char *tutorial_files[] = { "tutorial1.png", "tutorial2.png" };
|
||||
for (int f = 0; f < 2; f++)
|
||||
{
|
||||
SDL_Surface *img = IMG_Load(tutorial_files[f]);
|
||||
__android_log_print(ANDROID_LOG_INFO, "Tyrian", "android_show_tutorial: %s: %p", tutorial_files[f], img);
|
||||
if (!img)
|
||||
return;
|
||||
|
||||
SDL_Surface *img2 = SDL_ConvertSurface(img, SDL_GetVideoSurface()->format, SDL_SWSURFACE);
|
||||
SDL_FreeSurface(img);
|
||||
img = img2;
|
||||
|
||||
for (int i = 7; i <= 255; i += 8)
|
||||
{
|
||||
SDL_FillRect(SDL_GetVideoSurface(), NULL, SDL_MapRGB(SDL_GetVideoSurface()->format, 0, 0, 0));
|
||||
SDL_SetAlpha(img, SDL_SRCALPHA, i);
|
||||
SDL_BlitSurface(img, NULL, SDL_GetVideoSurface(), NULL);
|
||||
__android_log_print(ANDROID_LOG_INFO, "Tyrian", "android_show_tutorial: blitting with alpha %d", i);
|
||||
SDL_Flip(SDL_GetVideoSurface());
|
||||
SDL_Delay(60);
|
||||
service_SDL_events(false);
|
||||
}
|
||||
while (!mousedown)
|
||||
{
|
||||
service_SDL_events(false);
|
||||
SDL_Flip(SDL_GetVideoSurface());
|
||||
SDL_Delay(40);
|
||||
}
|
||||
for (int i = 255; i > 8; i -= 8)
|
||||
{
|
||||
SDL_FillRect(SDL_GetVideoSurface(), NULL, 0);
|
||||
SDL_SetAlpha(img, SDL_SRCALPHA, i);
|
||||
SDL_BlitSurface(img, NULL, SDL_GetVideoSurface(), NULL);
|
||||
__android_log_print(ANDROID_LOG_INFO, "Tyrian", "android_show_tutorial: blitting with alpha %d", i);
|
||||
SDL_Flip(SDL_GetVideoSurface());
|
||||
SDL_Delay(60);
|
||||
service_SDL_events(false);
|
||||
}
|
||||
SDL_FreeSurface(img);
|
||||
}
|
||||
}
|
||||
|
||||
bool select_gameplay( void )
|
||||
{
|
||||
JE_loadPic(VGAScreen, 2, false);
|
||||
JE_dString(VGAScreen, JE_fontCenter(gameplay_name[0], FONT_SHAPES), 20, gameplay_name[0], FONT_SHAPES);
|
||||
|
||||
const JE_byte menu_top = 30, menu_spacing = 24;
|
||||
JE_shortint gameplay = 1,
|
||||
gameplay_max = 4;
|
||||
int menu_top = 30, menu_spacing = 24;
|
||||
int gameplay = 1,
|
||||
gameplay_max = GAMEPLAY_NAME_COUNT - 1;
|
||||
|
||||
wait_noinput(true, true, false);
|
||||
bool fade_in = true;
|
||||
for (; ; )
|
||||
{
|
||||
for (int i = 1; i <= gameplay_max; i++)
|
||||
{
|
||||
JE_outTextAdjust(VGAScreen, JE_fontCenter(gameplay_name[i], SMALL_FONT_SHAPES), i * menu_spacing + menu_top, gameplay_name[i], 15, - 4 + (i == gameplay ? 2 : 0) - (i == 4 ? 4 : 0), SMALL_FONT_SHAPES, true);
|
||||
JE_outTextAdjust(VGAScreen, JE_fontCenter(gameplay_name[i], SMALL_FONT_SHAPES), i * menu_spacing + menu_top, gameplay_name[i], 15, -4 + (i == gameplay ? 2 : 0) - (i == (GAMEPLAY_NAME_COUNT - 1) ? 4 : 0), SMALL_FONT_SHAPES, true);
|
||||
}
|
||||
JE_showVGA();
|
||||
|
||||
@@ -87,8 +231,7 @@ bool select_gameplay( void )
|
||||
{
|
||||
case SDLK_UP:
|
||||
case SDLK_LCTRL:
|
||||
gameplay--;
|
||||
if (gameplay < 1)
|
||||
if (--gameplay < 1)
|
||||
{
|
||||
gameplay = gameplay_max;
|
||||
}
|
||||
@@ -96,8 +239,7 @@ bool select_gameplay( void )
|
||||
break;
|
||||
case SDLK_DOWN:
|
||||
case SDLK_LALT:
|
||||
gameplay++;
|
||||
if (gameplay > gameplay_max)
|
||||
if (++gameplay > gameplay_max)
|
||||
{
|
||||
gameplay = 1;
|
||||
}
|
||||
@@ -106,7 +248,7 @@ bool select_gameplay( void )
|
||||
|
||||
case SDLK_RETURN:
|
||||
case SDLK_SPACE:
|
||||
if (gameplay == 4)
|
||||
if (gameplay == GAMEPLAY_NAME_COUNT - 1)
|
||||
{
|
||||
JE_playSampleNum(S_SPRING);
|
||||
/* TODO: NETWORK */
|
||||
@@ -117,7 +259,7 @@ bool select_gameplay( void )
|
||||
fade_black(10);
|
||||
|
||||
onePlayerAction = (gameplay == 2);
|
||||
twoPlayerMode = (gameplay == 3);
|
||||
twoPlayerMode = (gameplay == GAMEPLAY_NAME_COUNT - 2);
|
||||
return true;
|
||||
|
||||
case SDLK_ESCAPE:
|
||||
@@ -139,10 +281,10 @@ bool select_episode( void )
|
||||
JE_loadPic(VGAScreen, 2, false);
|
||||
JE_dString(VGAScreen, JE_fontCenter(episode_name[0], FONT_SHAPES), 20, episode_name[0], FONT_SHAPES);
|
||||
|
||||
const JE_byte menu_top = 20, menu_spacing = 30;
|
||||
JE_shortint episode = 1,
|
||||
episode_max = EPISODE_MAX - 1;
|
||||
const int menu_top = 20, menu_spacing = 30;
|
||||
int episode = 1, episode_max = EPISODE_AVAILABLE;
|
||||
|
||||
wait_noinput(true, true, false);
|
||||
bool fade_in = true;
|
||||
for (; ; )
|
||||
{
|
||||
@@ -220,10 +362,11 @@ bool select_difficulty( void )
|
||||
JE_loadPic(VGAScreen, 2, false);
|
||||
JE_dString(VGAScreen, JE_fontCenter(difficulty_name[0], FONT_SHAPES), 20, difficulty_name[0], FONT_SHAPES);
|
||||
|
||||
const JE_byte menu_top = 30, menu_spacing = 24;
|
||||
const int menu_top = 30, menu_spacing = 24;
|
||||
difficultyLevel = 2;
|
||||
JE_shortint difficulty_max = 3;
|
||||
int difficulty_max = 3;
|
||||
|
||||
wait_noinput(true, true, false);
|
||||
bool fade_in = true;
|
||||
for (; ; )
|
||||
{
|
||||
@@ -242,8 +385,12 @@ bool select_difficulty( void )
|
||||
JE_word temp = 0;
|
||||
JE_textMenuWait(&temp, false);
|
||||
|
||||
if (select_menuitem_by_touch(menu_top, menu_spacing, difficulty_max, &difficultyLevel))
|
||||
int difficultyLevel_ = difficultyLevel; // Need to pass an int, difficultyLevel is short int
|
||||
if (select_menuitem_by_touch(menu_top, menu_spacing, difficulty_max, &difficultyLevel_))
|
||||
{
|
||||
difficultyLevel = difficultyLevel_;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SDL_GetModState() & KMOD_SHIFT)
|
||||
{
|
||||
@@ -306,5 +453,3 @@ bool select_difficulty( void )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -21,13 +21,22 @@
|
||||
|
||||
#include "opentyr.h"
|
||||
|
||||
extern char episode_name[6][31], difficulty_name[7][21], gameplay_name[5][26];
|
||||
#ifdef TYRIAN2000
|
||||
#define GAMEPLAY_NAME_COUNT 6
|
||||
#else
|
||||
#define GAMEPLAY_NAME_COUNT 5
|
||||
#endif
|
||||
extern char episode_name[6][31], difficulty_name[7][21], gameplay_name[GAMEPLAY_NAME_COUNT][26];
|
||||
|
||||
bool select_gameplay( void );
|
||||
bool select_episode( void );
|
||||
bool select_difficulty( void );
|
||||
bool select_menuitem_by_touch(JE_byte menu_top, JE_byte menu_spacing, JE_shortint menu_item_count, JE_shortint *current_item);
|
||||
bool select_menuitem_by_touch(int menu_top, int menu_spacing, int menu_item_count, int *current_item);
|
||||
|
||||
void android_setup_screen_keys( void );
|
||||
void android_cleanup_screen_keys( void );
|
||||
void android_setup_screen_keys_destruct( void );
|
||||
void android_show_tutorial( void );
|
||||
|
||||
#endif /* MENUS_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -115,4 +115,3 @@ void JE_mouseReplace( void )
|
||||
JE_drawShapeTypeOne(lastMouseX, lastMouseY, mouseGrabShape);
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -41,4 +41,3 @@ void JE_mouseReplace( void );
|
||||
|
||||
#endif /* MOUSE_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -105,4 +105,3 @@ float mt_rand_lt1( void )
|
||||
return ((float)mt_rand() / ((float)MT_RAND_MAX + 1.0f));
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -28,4 +28,3 @@ float mt_rand_lt1( void );
|
||||
|
||||
#endif /* MTRAND_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -114,4 +114,3 @@ const char musicTitle[MUSIC_NUM][48] =
|
||||
|
||||
JE_boolean musicFade;
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -39,4 +39,3 @@ extern JE_boolean musicFade;
|
||||
|
||||
#endif /* MUSMAST_H */
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* OpenTyrian Classic: A modern cross-platform port of Tyrian
|
||||
* OpenTyrian: A modern cross-platform port of Tyrian
|
||||
* Copyright (C) 2007-2009 The OpenTyrian Development Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -30,9 +30,6 @@
|
||||
#include "varz.h"
|
||||
#include "video.h"
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_net.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/* HERE BE DRAGONS!
|
||||
@@ -66,27 +63,29 @@ static char empty_string[] = "";
|
||||
char *network_player_name = empty_string,
|
||||
*network_opponent_name = empty_string;
|
||||
|
||||
UDPsocket socket;
|
||||
IPaddress ip;
|
||||
#ifdef WITH_NETWORK
|
||||
static UDPsocket socket;
|
||||
static IPaddress ip;
|
||||
|
||||
UDPpacket *packet_out_temp, *packet_temp;
|
||||
UDPpacket *packet_out_temp;
|
||||
static UDPpacket *packet_temp;
|
||||
|
||||
UDPpacket *packet_in[NET_PACKET_QUEUE] = { NULL },
|
||||
*packet_out[NET_PACKET_QUEUE] = { NULL };
|
||||
|
||||
Uint16 last_out_sync = 0, queue_in_sync = 0, queue_out_sync = 0, last_ack_sync = 0;
|
||||
Uint32 last_in_tick = 0, last_out_tick = 0;
|
||||
static Uint16 last_out_sync = 0, queue_in_sync = 0, queue_out_sync = 0, last_ack_sync = 0;
|
||||
static Uint32 last_in_tick = 0, last_out_tick = 0;
|
||||
|
||||
UDPpacket *packet_state_in[NET_PACKET_QUEUE] = { NULL },
|
||||
*packet_state_in_xor[NET_PACKET_QUEUE] = { NULL },
|
||||
*packet_state_out[NET_PACKET_QUEUE] = { NULL };
|
||||
UDPpacket *packet_state_in[NET_PACKET_QUEUE] = { NULL };
|
||||
static UDPpacket *packet_state_in_xor[NET_PACKET_QUEUE] = { NULL };
|
||||
UDPpacket *packet_state_out[NET_PACKET_QUEUE] = { NULL };
|
||||
|
||||
Uint16 last_state_in_sync = 0, last_state_out_sync = 0;
|
||||
Uint32 last_state_in_tick = 0;
|
||||
static Uint16 last_state_in_sync = 0, last_state_out_sync = 0;
|
||||
static Uint32 last_state_in_tick = 0;
|
||||
|
||||
bool net_initialized = false;
|
||||
static bool net_initialized = false;
|
||||
static bool connected = false, quit = false;
|
||||
|
||||
#endif
|
||||
|
||||
uint thisPlayerNum = 0; /* Player number on this PC (1 or 2) */
|
||||
|
||||
@@ -98,6 +97,41 @@ JE_boolean moveOk;
|
||||
JE_boolean pauseRequest, skipLevelRequest, helpRequest, nortShipRequest;
|
||||
JE_boolean yourInGameMenuRequest, inGameMenuRequest;
|
||||
|
||||
#ifdef WITH_NETWORK
|
||||
static void packet_copy( UDPpacket *dst, UDPpacket *src )
|
||||
{
|
||||
void *temp = dst->data;
|
||||
memcpy(dst, src, sizeof(*dst));
|
||||
dst->data = temp;
|
||||
memcpy(dst->data, src->data, src->len);
|
||||
}
|
||||
|
||||
static void packets_shift_up( UDPpacket **packet, int max_packets )
|
||||
{
|
||||
if (packet[0])
|
||||
{
|
||||
SDLNet_FreePacket(packet[0]);
|
||||
}
|
||||
for (int i = 0; i < max_packets - 1; i++)
|
||||
{
|
||||
packet[i] = packet[i + 1];
|
||||
}
|
||||
packet[max_packets - 1] = NULL;
|
||||
}
|
||||
|
||||
static void packets_shift_down( UDPpacket **packet, int max_packets )
|
||||
{
|
||||
if (packet[max_packets - 1])
|
||||
{
|
||||
SDLNet_FreePacket(packet[max_packets - 1]);
|
||||
}
|
||||
for (int i = max_packets - 1; i > 0; i--)
|
||||
{
|
||||
packet[i] = packet[i - 1];
|
||||
}
|
||||
packet[0] = NULL;
|
||||
}
|
||||
|
||||
// prepare new packet for sending
|
||||
void network_prepare( Uint16 type )
|
||||
{
|
||||
@@ -105,6 +139,20 @@ void network_prepare( Uint16 type )
|
||||
SDLNet_Write16(last_out_sync, &packet_out_temp->data[2]);
|
||||
}
|
||||
|
||||
// send packet but don't expect acknoledgment of delivery
|
||||
static bool network_send_no_ack( int len )
|
||||
{
|
||||
packet_out_temp->len = len;
|
||||
|
||||
if (!SDLNet_UDP_Send(socket, 0, packet_out_temp))
|
||||
{
|
||||
printf("SDLNet_UDP_Send: %s\n", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// send packet and place it in queue to be acknowledged
|
||||
bool network_send( int len )
|
||||
{
|
||||
@@ -129,18 +177,20 @@ bool network_send( int len )
|
||||
return temp;
|
||||
}
|
||||
|
||||
// send packet but don't expect acknoledgment of delivery
|
||||
bool network_send_no_ack( int len )
|
||||
// send acknowledgement packet
|
||||
static int network_acknowledge( Uint16 sync )
|
||||
{
|
||||
packet_out_temp->len = len;
|
||||
SDLNet_Write16(PACKET_ACKNOWLEDGE, &packet_out_temp->data[0]);
|
||||
SDLNet_Write16(sync, &packet_out_temp->data[2]);
|
||||
network_send_no_ack(4);
|
||||
|
||||
if (!SDLNet_UDP_Send(socket, 0, packet_out_temp))
|
||||
{
|
||||
printf("SDLNet_UDP_Send: %s\n", SDL_GetError());
|
||||
return false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
// activity lately?
|
||||
static bool network_is_alive( void )
|
||||
{
|
||||
return (SDL_GetTicks() - last_in_tick < NET_TIME_OUT || SDL_GetTicks() - last_state_in_tick < NET_TIME_OUT);
|
||||
}
|
||||
|
||||
// poll for new packets received, check that connection is alive, resend queued packets if necessary
|
||||
@@ -337,16 +387,6 @@ int network_check( void )
|
||||
return 0;
|
||||
}
|
||||
|
||||
// send acknowledgement packet
|
||||
int network_acknowledge( Uint16 sync )
|
||||
{
|
||||
SDLNet_Write16(PACKET_ACKNOWLEDGE, &packet_out_temp->data[0]);
|
||||
SDLNet_Write16(sync, &packet_out_temp->data[2]);
|
||||
network_send_no_ack(4);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// discard working packet, now processing next packet in queue
|
||||
bool network_update( void )
|
||||
{
|
||||
@@ -368,12 +408,6 @@ bool network_is_sync( void )
|
||||
return (queue_out_sync - last_ack_sync == 1);
|
||||
}
|
||||
|
||||
// activity lately?
|
||||
bool network_is_alive( void )
|
||||
{
|
||||
return (SDL_GetTicks() - last_in_tick < NET_TIME_OUT || SDL_GetTicks() - last_state_in_tick < NET_TIME_OUT);
|
||||
}
|
||||
|
||||
|
||||
// prepare new state for sending
|
||||
void network_state_prepare( void )
|
||||
@@ -614,7 +648,7 @@ connect_again:
|
||||
episodes >>= 1;
|
||||
}
|
||||
|
||||
network_opponent_name = (char *)malloc(packet_in[0]->len - 12 + 1);
|
||||
network_opponent_name = malloc(packet_in[0]->len - 12 + 1);
|
||||
strcpy(network_opponent_name, (char *)&packet_in[0]->data[12]);
|
||||
|
||||
network_update();
|
||||
@@ -741,40 +775,7 @@ int network_init( void )
|
||||
return 0;
|
||||
}
|
||||
|
||||
void packet_copy( UDPpacket *dst, UDPpacket *src )
|
||||
{
|
||||
void *temp = dst->data;
|
||||
memcpy(dst, src, sizeof(*dst));
|
||||
dst->data = (Uint8*)temp;
|
||||
memcpy(dst->data, src->data, src->len);
|
||||
}
|
||||
|
||||
void packets_shift_up( UDPpacket **packet, int max_packets )
|
||||
{
|
||||
if (packet[0])
|
||||
{
|
||||
SDLNet_FreePacket(packet[0]);
|
||||
}
|
||||
for (int i = 0; i < max_packets - 1; i++)
|
||||
{
|
||||
packet[i] = packet[i + 1];
|
||||
}
|
||||
packet[max_packets - 1] = NULL;
|
||||
}
|
||||
|
||||
void packets_shift_down( UDPpacket **packet, int max_packets )
|
||||
{
|
||||
if (packet[max_packets - 1])
|
||||
{
|
||||
SDLNet_FreePacket(packet[max_packets - 1]);
|
||||
}
|
||||
for (int i = max_packets - 1; i > 0; i--)
|
||||
{
|
||||
packet[i] = packet[i - 1];
|
||||
}
|
||||
packet[0] = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void JE_clearSpecialRequests( void )
|
||||
{
|
||||
@@ -785,4 +786,3 @@ void JE_clearSpecialRequests( void )
|
||||
nortShipRequest = false;
|
||||
}
|
||||
|
||||
// kate: tab-width 4; vim: set noet:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user