diff --git a/.travis.yml b/.travis.yml index a9f4ddfb4..8a137d9d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,6 +72,21 @@ matrix: compiler: gcc-7 env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3" #gcc-7 (Ubuntu 7.2.0-1ubuntu1~14.04) 7.2.0 20170802 + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - libsdl2-mixer-dev + - libpng-dev + - libgl1-mesa-dev + - libgme-dev + - p7zip-full + - gcc-8 + compiler: gcc-8 + env: WFLAGS="-Wno-tautological-compare -Wno-error=implicit-fallthrough -Wimplicit-fallthrough=3" + #gcc-8 (Ubuntu 7.2.0-1ubuntu1~14.04) 8.1.0 - os: linux compiler: clang #clang version 3.5.0 (tags/RELEASE_350/final) @@ -212,6 +227,7 @@ matrix: - compiler: clang-3.9 - compiler: clang-4.0 - compiler: clang-5.0 + - compiler: gcc-8 cache: apt: true diff --git a/README.md b/README.md index d16071454..7d92ab303 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,6 @@ - libupnp (Linux/OS X only) - libgme (Linux/OS X only) -Warning: 64-bit builds are not netgame compatible with 32-bit builds. Use at your own risk. - ## Compiling See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling) diff --git a/bin/Resources/libgme64.dll b/bin/Resources/libgme64.dll new file mode 100644 index 000000000..2ba99450f Binary files /dev/null and b/bin/Resources/libgme64.dll differ diff --git a/libs/SDL2/COPYING.txt b/libs/SDL2/COPYING.txt index a1c8bbe5a..694e58a09 100644 --- a/libs/SDL2/COPYING.txt +++ b/libs/SDL2/COPYING.txt @@ -1,6 +1,6 @@ Simple DirectMedia Layer -Copyright (C) 1997-2017 Sam Lantinga +Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/Makefile b/libs/SDL2/Makefile index a2e6bb9ba..9edfd003e 100644 --- a/libs/SDL2/Makefile +++ b/libs/SDL2/Makefile @@ -1,12 +1,12 @@ # # Makefile for installing the mingw32 version of the SDL library -CROSS_PATH := /usr/local/cross-tools +CROSS_PATH := /usr/local ARCHITECTURES := i686-w64-mingw32 x86_64-w64-mingw32 all install: @echo "Type \"make native\" to install 32-bit to /usr" - @echo "Type \"make cross\" to install 32-bit and 64-bit to CROSS_PATH ($(CROSS_PATH))" + @echo "Type \"make cross\" to install 32-bit and 64-bit to $(CROSS_PATH)" native: make install-package arch=i686-w64-mingw32 prefix=/usr @@ -22,6 +22,7 @@ install-package: sed "s|^prefix=.*|prefix=$(prefix)|" <$(arch)/bin/sdl2-config >$(prefix)/bin/sdl2-config; \ chmod 755 $(prefix)/bin/sdl2-config; \ sed "s|^libdir=.*|libdir=\'$(prefix)/lib\'|" <$(arch)/lib/libSDL2.la >$(prefix)/lib/libSDL2.la; \ + sed "s|^libdir=.*|libdir=\'$(prefix)/lib\'|" <$(arch)/lib/libSDL2main.la >$(prefix)/lib/libSDL2main.la; \ sed "s|^prefix=.*|prefix=$(prefix)|" <$(arch)/lib/pkgconfig/sdl2.pc >$(prefix)/lib/pkgconfig/sdl2.pc; \ else \ echo "*** ERROR: $(arch) or $(prefix) does not exist!"; \ diff --git a/libs/SDL2/SRB2NOTE.txt b/libs/SDL2/SRB2NOTE.txt new file mode 100644 index 000000000..b7da4c9ab --- /dev/null +++ b/libs/SDL2/SRB2NOTE.txt @@ -0,0 +1,15 @@ +# SDL Development Libaries + +Download both the VC and MinGW packages and extract them here. + +https://www.libsdl.org/download-2.0.php + +## VC Package + +* include +* lib + +## MinGW Package + +* i686-w64-mingw32 +* x86_64-w64-mingw32 diff --git a/libs/SDL2/WhatsNew.txt b/libs/SDL2/WhatsNew.txt index 9c8d53840..9074b12ba 100644 --- a/libs/SDL2/WhatsNew.txt +++ b/libs/SDL2/WhatsNew.txt @@ -1,6 +1,91 @@ This is a list of major changes in SDL's version history. +--------------------------------------------------------------------------- +2.0.9: +--------------------------------------------------------------------------- + +General: +* Added a new sensor API, initialized by passing SDL_INIT_SENSOR to SDL_Init(), and defined in SDL_sensor.h +* Added an event SDL_SENSORUPDATE which is sent when a sensor is updated +* Added SDL_GetDisplayOrientation() to return the current display orientation +* Added an event SDL_DISPLAYEVENT which is sent when the display orientation changes +* Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms. (Thanks to Valve for contributing the PS4 and Nintendo Switch Pro controller support) +* Added support for many other popular game controllers +* Added SDL_JoystickGetDevicePlayerIndex(), SDL_JoystickGetPlayerIndex(), and SDL_GameControllerGetPlayerIndex() to get the player index for a controller. For XInput controllers this returns the XInput index for the controller. +* Added SDL_GameControllerRumble() and SDL_JoystickRumble() which allow simple rumble without using the haptics API +* Added SDL_GameControllerMappingForDeviceIndex() to get the mapping for a controller before it's opened +* Added the hint SDL_HINT_MOUSE_DOUBLE_CLICK_TIME to control the mouse double-click time +* Added the hint SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS to control the mouse double-click radius, in pixels +* Added SDL_HasColorKey() to return whether a surface has a colorkey active +* Added SDL_HasAVX512F() to return whether the CPU has AVX-512F features +* Added SDL_IsTablet() to return whether the application is running on a tablet +* Added SDL_THREAD_PRIORITY_TIME_CRITICAL for threads that must run at the highest priority + +Mac OS X: +* Fixed black screen at start on Mac OS X Mojave + +Linux: +* Added SDL_LinuxSetThreadPriority() to allow adjusting the thread priority of native threads using RealtimeKit if available. + +iOS: +* Fixed Asian IME input + +Android: +* Updated required Android SDK to API 26, to match Google's new App Store requirements +* Added support for wired USB Xbox, PS4, and Nintendo Switch Pro controllers +* Added support for relative mouse mode on Android 7.0 and newer (except where it's broken, on Chromebooks and when in DeX mode with Samsung Experience 9.0) +* Added support for custom mouse cursors on Android 7.0 and newer +* Added the hint SDL_HINT_ANDROID_TRAP_BACK_BUTTON to control whether the back button will back out of the app (the default) or be passed to the application as SDL_SCANCODE_AC_BACK +* Added SDL_AndroidBackButton() to trigger the Android system back button behavior when handling the back button in the application +* Added SDL_IsChromebook() to return whether the app is running in the Chromebook Android runtime +* Added SDL_IsDeXMode() to return whether the app is running while docked in the Samsung DeX + + +--------------------------------------------------------------------------- +2.0.8: +--------------------------------------------------------------------------- + +General: +* Added SDL_fmod() and SDL_log10() +* Each of the SDL math functions now has the corresponding float version +* Added SDL_SetYUVConversionMode() and SDL_GetYUVConversionMode() to control the formula used when converting to and from YUV colorspace. The options are JPEG, BT.601, and BT.709 + +Windows: +* Implemented WASAPI support on Windows UWP and removed the deprecated XAudio2 implementation +* Added resampling support on WASAPI on Windows 7 and above + +Windows UWP: +* Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on + +Mac OS X: +* Added support for the Vulkan SDK for Mac: + https://www.lunarg.com/lunarg-releases-vulkan-sdk-1-0-69-0-for-mac/ +* Added support for OpenGL ES using ANGLE when it's available + +Mac OS X / iOS / tvOS: +* Added a Metal 2D render implementation +* Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() to insert your own drawing into SDL rendering when using the Metal implementation + +iOS: +* Added the hint SDL_HINT_IOS_HIDE_HOME_INDICATOR to control whether the home indicator bar on iPhone X should be hidden. This defaults to dimming the indicator for fullscreen applications and showing the indicator for windowed applications. + +iOS / Android: +* Added the hint SDL_HINT_RETURN_KEY_HIDES_IME to control whether the return key on the software keyboard should hide the keyboard or send a key event (the default) + +Android: +* SDL now supports building with Android Studio and Gradle by default, and the old Ant project is available in android-project-ant +* SDL now requires the API 19 SDK to build, but can still target devices down to API 14 (Android 4.0.1) +* Added SDL_IsAndroidTV() to tell whether the application is running on Android TV + +Android / tvOS: +* Added the hint SDL_HINT_TV_REMOTE_AS_JOYSTICK to control whether TV remotes should be listed as joystick devices (the default) or send keyboard events. + +Linux: +* Added the hint SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR to control whether the X server should skip the compositor for the SDL application. This defaults to "1" +* Added the hint SDL_HINT_VIDEO_DOUBLE_BUFFER to control whether the Raspberry Pi and KMSDRM video drivers should use double or triple buffering (the default) + + --------------------------------------------------------------------------- 2.0.7: --------------------------------------------------------------------------- diff --git a/libs/SDL2/docs/README-android.md b/libs/SDL2/docs/README-android.md index 62874f435..7f3263dc3 100644 --- a/libs/SDL2/docs/README-android.md +++ b/libs/SDL2/docs/README-android.md @@ -4,20 +4,24 @@ Android Matt Styles wrote a tutorial on building SDL for Android with Visual Studio: http://trederia.blogspot.de/2017/03/building-sdl2-for-android-with-visual.html -The rest of this README covers the old style build process. +The rest of this README covers the Android gradle style build process. + +If you are using the older ant build process, it is no longer officially +supported, but you can use the "android-project-ant" directory as a template. + ================================================================================ Requirements ================================================================================ -Android SDK (version 16 or later) +Android SDK (version 26 or later) https://developer.android.com/sdk/index.html -Android NDK r7 or later +Android NDK r15c or later https://developer.android.com/tools/sdk/ndk/index.html -Minimum API level supported by SDL: 10 (Android 2.3.3) -Joystick support is available for API level >= 12 devices. +Minimum API level supported by SDL: 14 (Android 4.0.1) + ================================================================================ How the port works @@ -31,15 +35,12 @@ Joystick support is available for API level >= 12 devices. - This eventually produces a standard Android .apk package The Android Java code implements an "Activity" and can be found in: -android-project/src/org/libsdl/app/SDLActivity.java +android-project/app/src/main/java/org/libsdl/app/SDLActivity.java The Java code loads your game code, the SDL shared library, and dispatches to native functions implemented in the SDL library: src/core/android/SDL_android.c -Your project must include some glue code that starts your main() routine: -src/main/android/SDL_android_main.c - ================================================================================ Building an app @@ -74,71 +75,30 @@ For more complex projects, follow these instructions: 1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project. -2. Move or symlink this SDL directory into the "/jni" directory -3. Edit "/jni/src/Android.mk" to include your source files -4. Run 'ndk-build' (a script provided by the NDK). This compiles the C source +2. Move or symlink this SDL directory into the "/app/jni" directory +3. Edit "/app/jni/src/Android.mk" to include your source files -If you want to use the Eclipse IDE, skip to the Eclipse section below. +4a. If you want to use Android Studio, simply open your directory and start building. -5. Create "/local.properties" and use that to point to the Android SDK directory, by writing a line with the following form: - - sdk.dir=PATH_TO_ANDROID_SDK - -6. Run 'ant debug' in android/project. This compiles the .java and eventually - creates a .apk with the native code embedded -7. 'ant debug install' will push the apk to the device or emulator (if connected) +4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device Here's an explanation of the files in the Android project, so you can customize them: - android-project/ - AndroidManifest.xml - package manifest. Among others, it contains the class name - of the main Activity and the package name of the application. - build.properties - empty - build.xml - build description file, used by ant. The actual application name - is specified here. - default.properties - holds the target ABI for the application, android-10 and up - project.properties - holds the target ABI for the application, android-10 and up - local.properties - holds the SDK path, you should change this to the path to your SDK + android-project/app + build.gradle - build info including the application version and SDK + src/main/AndroidManifest.xml - package manifest. Among others, it contains the class name of the main Activity and the package name of the application. jni/ - directory holding native code - jni/Android.mk - Android makefile that can call recursively the Android.mk files - in all subdirectories + jni/Application.mk - Application JNI settings, including target platform and STL library + jni/Android.mk - Android makefile that can call recursively the Android.mk files in all subdirectories jni/SDL/ - (symlink to) directory holding the SDL library files jni/SDL/Android.mk - Android makefile for creating the SDL shared library jni/src/ - directory holding your C/C++ source - jni/src/Android.mk - Android makefile that you should customize to include your - source code and any library references - res/ - directory holding resources for your application - res/drawable-* - directories holding icons for different phone hardware. Could be - one dir called "drawable". - res/layout/main.xml - Usually contains a file main.xml, which declares the screen layout. - We don't need it because we use the SDL video output. - res/values/strings.xml - strings used in your application, including the application name - shown on the phone. - src/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding - to SDL. Be very careful changing this, as the SDL library relies - on this implementation. - - -================================================================================ - Build an app with static linking of libSDL -================================================================================ - -This build uses the Android NDK module system. - -Instructions: -1. Copy the android-project directory wherever you want to keep your projects - and rename it to the name of your project. -2. Rename "/jni/src/Android_static.mk" to "/jni/src/Android.mk" - (overwrite the existing one) -3. Edit "/jni/src/Android.mk" to include your source files -4. create and export an environment variable named NDK_MODULE_PATH that points - to the parent directory of this SDL directory. e.g.: - - export NDK_MODULE_PATH="$PWD"/.. - -5. Edit "/src/org/libsdl/app/SDLActivity.java" and remove the call to - System.loadLibrary("SDL2"). -6. Run 'ndk-build' (a script provided by the NDK). This compiles the C source + jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references + src/main/assets/ - directory holding asset files for your application + src/main/res/ - directory holding resources for your application + src/main/res/mipmap-* - directories holding icons for different phone hardware + src/main/res/values/strings.xml - strings used in your application, including the application name + src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application. ================================================================================ @@ -171,25 +131,23 @@ Here's an example of a minimal class file: Then replace "SDLActivity" in AndroidManifest.xml with the name of your class, .e.g. "MyGame" + ================================================================================ Customizing your application icon ================================================================================ Conceptually changing your icon is just replacing the "ic_launcher.png" files in -the drawable directories under the res directory. There are four directories for -different screen sizes. These can be replaced with one dir called "drawable", -containing an icon file "ic_launcher.png" with dimensions 48x48 or 72x72. +the drawable directories under the res directory. There are several directories +for different screen sizes. -You may need to change the name of your icon in AndroidManifest.xml to match -this icon filename. ================================================================================ Loading assets ================================================================================ -Any files you put in the "assets" directory of your android-project directory -will get bundled into the application package and you can load them using the -standard functions in SDL_rwops.h. +Any files you put in the "app/src/main/assets" directory of your project +directory will get bundled into the application package and you can load +them using the standard functions in SDL_rwops.h. There are also a few Android specific functions that allow you to get other useful paths for saving and loading data: @@ -211,6 +169,7 @@ disable this behaviour, see for example: http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/ + ================================================================================ Pause / Resume behaviour ================================================================================ @@ -231,6 +190,7 @@ a specific message, (which is not yet implemented!) and restore your textures manually or quit the app (which is actually the kind of behaviour you'll see under iOS, if the OS can not restore your GL context it will just kill your app) + ================================================================================ Threads and the Java VM ================================================================================ @@ -246,6 +206,7 @@ Android_JNI_SetupThread() before doing anything else otherwise SDL will attach your thread automatically anyway (when you make an SDL call), but it'll never detach it. + ================================================================================ Using STL ================================================================================ @@ -253,34 +214,10 @@ detach it. You can use STL in your project by creating an Application.mk file in the jni folder and adding the following line: - APP_STL := stlport_static + APP_STL := c++_shared -For more information check out CPLUSPLUS-SUPPORT.html in the NDK documentation. - -================================================================================ - Additional documentation -================================================================================ - -The documentation in the NDK docs directory is very helpful in understanding the -build process and how to work with native code on the Android platform. - -The best place to start is with docs/OVERVIEW.TXT - - -================================================================================ - Using Eclipse -================================================================================ - -First make sure that you've installed Eclipse and the Android extensions as described here: - https://developer.android.com/tools/sdk/eclipse-adt.html - -Once you've copied the SDL android project and customized it, you can create an Eclipse project from it: - * File -> New -> Other - * Select the Android -> Android Project wizard and click Next - * Enter the name you'd like your project to have - * Select "Create project from existing source" and browse for your project directory - * Make sure the Build Target is set to Android 3.1 (API 12) - * Click Finish +For more information go here: + https://developer.android.com/ndk/guides/cpp-support ================================================================================ @@ -295,13 +232,11 @@ Especially useful is the info on setting up OpenGL ES 2.0 emulation. Notice that this software emulator is incredibly slow and needs a lot of disk space. Using a real device works better. + ================================================================================ Troubleshooting ================================================================================ -You can create and run an emulator from the Eclipse IDE: - * Window -> Android SDK and AVD Manager - You can see if adb can see any devices with the following command: adb devices @@ -338,7 +273,10 @@ You can see the complete command line that ndk-build is using by passing V=1 on ndk-build V=1 -If your application crashes in native code, you can use addr2line to convert the +If your application crashes in native code, you can use ndk-stack to get a symbolic stack trace: + https://developer.android.com/ndk/guides/ndk-stack + +If you want to go through the process manually, you can use addr2line to convert the addresses in the stack trace to lines in your code. For example, if your crash looks like this: @@ -426,36 +364,30 @@ When you're done instrumenting with valgrind, you can disable the wrapper: adb shell setprop wrap.org.libsdl.app "" + ================================================================================ Graphics debugging ================================================================================ If you are developing on a compatible Tegra-based tablet, NVidia provides -Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL +Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL and GLES libraries, you must follow their instructions for installing the -interposer library on a rooted device. The non-rooted instructions are not +interposer library on a rooted device. The non-rooted instructions are not compatible with applications that use SDL2 for video. The Tegra Graphics Debugger is available from NVidia here: https://developer.nvidia.com/tegra-graphics-debugger + ================================================================================ - Why is API level 10 the minimum required? + Why is API level 14 the minimum required? ================================================================================ -API level 10 is the minimum required level at runtime (that is, on the device) -because SDL requires some functionality for running not -available on older devices. Since the incorporation of joystick support into SDL, -the minimum SDK required to *build* SDL is version 12. Devices running API levels -10-11 are still supported, only with the joystick functionality disabled. - -Support for native OpenGL ES and ES2 applications was introduced in the NDK for -API level 4 and 8. EGL was made a stable API in the NDK for API level 9, which -has since then been obsoleted, with the recommendation to developers to bump the -required API level to 10. +The latest NDK toolchain doesn't support targeting earlier than API level 14. As of this writing, according to https://developer.android.com/about/dashboards/index.html -about 90% of the Android devices accessing Google Play support API level 10 or -higher (March 2013). +about 99% of the Android devices accessing Google Play support API level 14 or +higher (October 2017). + ================================================================================ A note regarding the use of the "dirty rectangles" rendering technique @@ -475,6 +407,7 @@ screen each frame. Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html + ================================================================================ Known issues ================================================================================ diff --git a/libs/SDL2/docs/README-dynapi.md b/libs/SDL2/docs/README-dynapi.md index bfaecb344..b9a58bce1 100644 --- a/libs/SDL2/docs/README-dynapi.md +++ b/libs/SDL2/docs/README-dynapi.md @@ -64,7 +64,7 @@ level of indirection, we can do things like this: export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0 ./MyGameThatIsStaticallyLinkedToSDL2 -And now, this game that is staticallly linked to SDL, can still be overridden +And now, this game that is statically linked to SDL, can still be overridden with a newer, or better, SDL. The statically linked one will only be used as far as calling into the jump table in this case. But in cases where no override is desired, the statically linked version will provide its own jump table, diff --git a/libs/SDL2/docs/README-raspberrypi.md b/libs/SDL2/docs/README-raspberrypi.md index d64e7cb36..2c95e0649 100644 --- a/libs/SDL2/docs/README-raspberrypi.md +++ b/libs/SDL2/docs/README-raspberrypi.md @@ -27,6 +27,16 @@ OpenGL ES 2.x, it usually comes pre-installed, but in any case: sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev + +================================================================================ + NEON +================================================================================ + +If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so +that SDL will select some otherwise-disabled highly-optimized code. The +original Pi units don't have NEON, the Pi2 probably does, and the Pi3 +definitely does. + ================================================================================ Cross compiling from x86 Linux ================================================================================ diff --git a/libs/SDL2/docs/README-winrt.md b/libs/SDL2/docs/README-winrt.md index 8e993b57a..35b7e6d87 100644 --- a/libs/SDL2/docs/README-winrt.md +++ b/libs/SDL2/docs/README-winrt.md @@ -23,7 +23,7 @@ Requirements typically do not include support for creating WinRT apps, to note. (The "Community" editions of Visual C++ do, however, support both desktop/Win32 and WinRT development). - - Visual Studio 2017 can be used, however it is recommented that you install + - Visual Studio 2017 can be used, however it is recommended that you install the Visual C++ 2015 build tools. These build tools can be installed using VS 2017's installer. Be sure to also install the workload for "Universal Windows Platform development", its optional component, the @@ -33,7 +33,7 @@ Requirements earlier versions of Windows, such as Windows 7, is not always supported by Visual Studio, and you may get error(s) when attempting to do so. - Visual C++ 2012 can only build apps that target versions 8.0 of Windows, - or Windows Phone. 8.0-targetted apps will run on devices running 8.1 + or Windows Phone. 8.0-targeted apps will run on devices running 8.1 editions of Windows, however they will not be able to take advantage of 8.1-specific features. - Visual C++ 2013 cannot create app projects that target Windows 8.0. @@ -54,7 +54,7 @@ Requirements Status ------ -Here is a rough list of what works, and what doens't: +Here is a rough list of what works, and what doesn't: * What works: * compilation via Visual C++ 2012 through 2015 @@ -70,7 +70,10 @@ Here is a rough list of what works, and what doens't: SDL_GetPerformanceFrequency(), etc.) * file I/O via SDL_RWops * mouse input (unsupported on Windows Phone) - * audio, via a modified version of SDL's XAudio2 backend + * audio, via SDL's WASAPI backend (if you want to record, your app must + have "Microphone" capabilities enabled in its manifest, and the user must + not have blocked access. Otherwise, capture devices will fail to work, + presenting as a device disconnect shortly after opening it.) * .DLL file loading. Libraries *MUST* be packaged inside applications. Loading anything outside of the app is not supported. * system path retrieval via SDL's filesystem APIs diff --git a/libs/SDL2/i686-w64-mingw32/bin/SDL2.dll b/libs/SDL2/i686-w64-mingw32/bin/SDL2.dll index c21f747c2..701779044 100755 Binary files a/libs/SDL2/i686-w64-mingw32/bin/SDL2.dll and b/libs/SDL2/i686-w64-mingw32/bin/SDL2.dll differ diff --git a/libs/SDL2/i686-w64-mingw32/bin/sdl2-config b/libs/SDL2/i686-w64-mingw32/bin/sdl2-config index 7fdb82515..e1060b3f2 100755 --- a/libs/SDL2/i686-w64-mingw32/bin/sdl2-config +++ b/libs/SDL2/i686-w64-mingw32/bin/sdl2-config @@ -1,6 +1,6 @@ #!/bin/sh -prefix=/usr/local/i686-w64-mingw32 +prefix=/opt/local/i686-w64-mingw32 exec_prefix=${prefix} exec_prefix_set=no libdir=${exec_prefix}/lib @@ -39,17 +39,17 @@ while test $# -gt 0; do echo $exec_prefix ;; --version) - echo 2.0.7 + echo 2.0.9 ;; --cflags) echo -I${prefix}/include/SDL2 -Dmain=SDL_main ;; --libs) - echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows + echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows ;; --static-libs) # --libs|--static-libs) - echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc + echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc ;; *) echo "${usage}" 1>&2 diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL.h index 366d50fa3..fc35a419e 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,6 +51,7 @@ #include "SDL_power.h" #include "SDL_render.h" #include "SDL_rwops.h" +#include "SDL_sensor.h" #include "SDL_shape.h" #include "SDL_system.h" #include "SDL_thread.h" @@ -80,10 +81,11 @@ extern "C" { #define SDL_INIT_HAPTIC 0x00001000u #define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ #define SDL_INIT_EVENTS 0x00004000u +#define SDL_INIT_SENSOR 0x00008000u #define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */ #define SDL_INIT_EVERYTHING ( \ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ - SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ + SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \ ) /* @} */ diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_assert.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_assert.h index 90abbe39b..b38f928ae 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_assert.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_atomic.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_atomic.h index 36e37f3b7..b2287748c 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_atomic.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -158,6 +158,9 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") +#elif defined(__GNUC__) && defined(__aarch64__) +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__GNUC__) && defined(__arm__) #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_audio.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_audio.h index f119c2b26..d3e1bface 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_audio.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -140,7 +140,8 @@ typedef Uint16 SDL_AudioFormat; #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 #define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 -#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) +#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008 +#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE) /* @} */ /* @} *//* Audio flags */ @@ -527,7 +528,7 @@ extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioForm * * \param stream The stream the audio data is being added to * \param buf A pointer to the audio data to add - * \param int The number of bytes to write to the stream + * \param len The number of bytes to write to the stream * \return 0 on success, or -1 on error. * * \sa SDL_NewAudioStream diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_bits.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_bits.h index bc2857290..eb8322f0d 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_bits.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_bits.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_blendmode.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_blendmode.h index 9abd0bd4c..36a5ea76f 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_blendmode.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_blendmode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_clipboard.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_clipboard.h index 341f4ba42..f28751ebb 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_clipboard.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_config.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_config.h index 1bbb83848..c58be8e72 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_config.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_config.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -82,6 +82,9 @@ typedef unsigned int uintptr_t; #define HAVE_DSOUND_H 1 #define HAVE_DXGI_H 1 #define HAVE_XINPUT_H 1 +#define HAVE_MMDEVICEAPI_H 1 +#define HAVE_AUDIOCLIENT_H 1 +#define HAVE_ENDPOINTVOLUME_H 1 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */ #ifdef HAVE_LIBC @@ -109,13 +112,15 @@ typedef unsigned int uintptr_t; #define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 #define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__ULTOA */ #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 #define HAVE_STRTOD 1 @@ -125,30 +130,45 @@ typedef unsigned int uintptr_t; #define HAVE_STRNCMP 1 #define HAVE__STRICMP 1 #define HAVE__STRNICMP 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 -#define HAVE_CEIL 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE__COPYSIGN 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEILF 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 #if defined(_MSC_VER) /* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 #define HAVE_STRTOLL 1 #define HAVE_VSSCANF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #endif /* This function is available with at least the VC++ 2008 C runtime library */ #if _MSC_VER >= 1400 @@ -166,7 +186,6 @@ typedef unsigned int uintptr_t; /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_WASAPI 1 #define SDL_AUDIO_DRIVER_DSOUND 1 -#define SDL_AUDIO_DRIVER_XAUDIO2 0 #define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 @@ -174,9 +193,13 @@ typedef unsigned int uintptr_t; /* Enable various input drivers */ #define SDL_JOYSTICK_DINPUT 1 #define SDL_JOYSTICK_XINPUT 1 +#define SDL_JOYSTICK_HIDAPI 1 #define SDL_HAPTIC_DINPUT 1 #define SDL_HAPTIC_XINPUT 1 +/* Enable the dummy sensor driver */ +#define SDL_SENSOR_DUMMY 1 + /* Enable various shared object loading systems */ #define SDL_LOADSO_WINDOWS 1 @@ -194,7 +217,7 @@ typedef unsigned int uintptr_t; #define SDL_VIDEO_RENDER_D3D 1 #endif #ifndef SDL_VIDEO_RENDER_D3D11 -#define SDL_VIDEO_RENDER_D3D11 0 +#define SDL_VIDEO_RENDER_D3D11 0 #endif /* Enable OpenGL support */ diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_cpuinfo.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_cpuinfo.h index 94b64b03b..ee3a47e84 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_cpuinfo.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,27 +51,35 @@ #include #else #ifdef __ALTIVEC__ -#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) +#if defined(HAVE_ALTIVEC_H) && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H) #include #undef pixel +#undef bool #endif #endif -#ifdef __MMX__ -#include +#if defined(__ARM_NEON__) && !defined(SDL_DISABLE_ARM_NEON_H) +#include #endif -#ifdef __3dNOW__ +#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) #include #endif -#ifdef __SSE__ +#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) +#include +#else +#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) +#include +#endif +#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H) #include #endif -#ifdef __SSE2__ +#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H) #include #endif -#ifdef __SSE3__ +#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H) #include #endif -#endif +#endif /* HAVE_IMMINTRIN_H */ +#endif /* compiler version */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -154,6 +162,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); +/** + * This function returns true if the CPU has AVX-512F (foundation) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void); + /** * This function returns true if the CPU has NEON (ARM SIMD) features. */ @@ -164,7 +177,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); */ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_egl.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_egl.h index e47fbe862..d65ed437c 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_egl.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_egl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ * * This is a simple file to encapsulate the EGL API headers. */ -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__ANDROID__) #include #include diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_endian.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_endian.h index 3eda7f287..ed0bf5ba8 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_endian.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_error.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_error.h index 49be9827e..c0e46298e 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_error.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_events.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_events.h index 0fc09bc37..af22eb646 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_events.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -85,6 +85,9 @@ typedef enum Called on Android in onResume() */ + /* Display events */ + SDL_DISPLAYEVENT = 0x150, /**< Display state change */ + /* Window events */ SDL_WINDOWEVENT = 0x200, /**< Window state change */ SDL_SYSWMEVENT, /**< System specific event */ @@ -144,6 +147,9 @@ typedef enum SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */ + /* Sensor events */ + SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */ + /* Render events */ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */ SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */ @@ -168,6 +174,21 @@ typedef struct SDL_CommonEvent Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_CommonEvent; +/** + * \brief Display state change event data (event.display.*) + */ +typedef struct SDL_DisplayEvent +{ + Uint32 type; /**< ::SDL_DISPLAYEVENT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 display; /**< The associated display index */ + Uint8 event; /**< ::SDL_DisplayEventID */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint32 data1; /**< event dependent data */ +} SDL_DisplayEvent; + /** * \brief Window state change event data (event.window.*) */ @@ -471,6 +492,17 @@ typedef struct SDL_DropEvent } SDL_DropEvent; +/** + * \brief Sensor event structure (event.sensor.*) + */ +typedef struct SDL_SensorEvent +{ + Uint32 type; /**< ::SDL_SENSORUPDATE */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Sint32 which; /**< The instance ID of the sensor */ + float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ +} SDL_SensorEvent; + /** * \brief The "quit requested" event */ @@ -526,6 +558,7 @@ typedef union SDL_Event { Uint32 type; /**< Event type, shared with all events */ SDL_CommonEvent common; /**< Common event data */ + SDL_DisplayEvent display; /**< Window event data */ SDL_WindowEvent window; /**< Window event data */ SDL_KeyboardEvent key; /**< Keyboard event data */ SDL_TextEditingEvent edit; /**< Text editing event data */ @@ -542,6 +575,7 @@ typedef union SDL_Event SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ SDL_AudioDeviceEvent adevice; /**< Audio device event data */ + SDL_SensorEvent sensor; /**< Sensor event data */ SDL_QuitEvent quit; /**< Quit request event data */ SDL_UserEvent user; /**< Custom event data */ SDL_SysWMEvent syswm; /**< System dependent window event data */ diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_filesystem.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_filesystem.h index a1c846ad0..fa6a1fa6e 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_filesystem.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_filesystem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_gamecontroller.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_gamecontroller.h index c9215132e..6ae9c9542 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_gamecontroller.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -175,6 +175,14 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); */ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); +/** + * Get the mapping of a game controller. + * This can be called before any controllers are opened. + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available + */ +extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index); + /** * Open a game controller for use. * The index passed as an argument refers to the N'th game controller on the system. @@ -196,6 +204,13 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL */ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); +/** + * Get the player index of an opened game controller, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); + /** * Get the USB vendor ID of an opened controller, if available. * If the vendor ID isn't available this function returns 0. @@ -345,6 +360,19 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); +/** + * Trigger a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param gamecontroller The controller to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + /** * Close a controller previously opened with SDL_GameControllerOpen(). */ diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_gesture.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_gesture.h index 2bba6a729..b223d80d4 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_gesture.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_haptic.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_haptic.h index 60daefaa7..2ea1bfc16 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_haptic.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -117,6 +117,17 @@ extern "C" { #endif /* __cplusplus */ +/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF). + * + * At the moment the magnitude variables are mixed between signed/unsigned, and + * it is also not made clear that ALL of those variables expect a max of 0x7FFF. + * + * Some platforms may have higher precision than that (Linux FF, Windows XInput) + * so we should fix the inconsistency in favor of higher possible precision, + * adjusting for platforms that use different scales. + * -flibit + */ + /** * \typedef SDL_Haptic * @@ -656,8 +667,8 @@ typedef struct SDL_HapticRamp * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. * * The Left/Right effect is used to explicitly control the large and small - * motors, commonly found in modern game controllers. One motor is high - * frequency, the other is low frequency. + * motors, commonly found in modern game controllers. The small (right) motor + * is high frequency, and the large (left) motor is low frequency. * * \sa SDL_HAPTIC_LEFTRIGHT * \sa SDL_HapticEffect @@ -668,7 +679,7 @@ typedef struct SDL_HapticLeftRight Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */ /* Replay */ - Uint32 length; /**< Duration of the effect. */ + Uint32 length; /**< Duration of the effect in milliseconds. */ /* Rumble */ Uint16 large_magnitude; /**< Control of the large controller motor. */ diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_hints.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_hints.h index 007a4bee0..4ee72e97d 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_hints.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -76,6 +76,7 @@ extern "C" { * "opengl" * "opengles2" * "opengles" + * "metal" * "software" * * The default varies by platform, but it's the first one in the list that @@ -210,6 +211,18 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" +/** + * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_BYPASS_COMPOSITOR + * "1" - Enable _NET_WM_BYPASS_COMPOSITOR + * + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR + * + */ +#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" + /** * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden * @@ -249,6 +262,16 @@ extern "C" { */ #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" +/** + * \brief A variable setting the double click time, in milliseconds. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME" + +/** + * \brief A variable setting the double click radius, in pixels. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS" + /** * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode */ @@ -316,7 +339,7 @@ extern "C" { #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" /** - * \brief A variable controlling which orientations are allowed on iOS. + * \brief A variable controlling which orientations are allowed on iOS/Android. * * In some circumstances it is necessary to be able to explicitly control * which UI orientations are allowed. @@ -355,16 +378,36 @@ extern "C" { #define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" /** - * \brief A variable controlling whether the Android / iOS built-in - * accelerometer should be listed as a joystick device, rather than listing - * actual joysticks only. + * \brief A variable controlling whether the home indicator bar on iPhone X + * should be hidden. * * This variable can be set to the following values: - * "0" - List only real joysticks and accept input from them - * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). + * "0" - The indicator bar is not hidden (default for windowed applications) + * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) + * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) + */ +#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR" + +/** + * \brief A variable controlling whether the Android / iOS built-in + * accelerometer should be listed as a joystick device. + * + * This variable can be set to the following values: + * "0" - The accelerometer is not listed as a joystick + * "1" - The accelerometer is available as a 3 axis joystick (the default). */ #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" +/** + * \brief A variable controlling whether the Android / tvOS remotes + * should be listed as joystick devices, instead of sending keyboard events. + * + * This variable can be set to the following values: + * "0" - Remotes send enter/escape/arrow key events + * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). + */ +#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" + /** * \brief A variable that lets you disable the detection and use of Xinput gamepad devices * @@ -432,6 +475,88 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" +/** + * \brief A variable controlling whether the HIDAPI joystick drivers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI drivers are not used + * "1" - HIDAPI drivers are used (the default) + * + * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below. + */ +#define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI" + +/** + * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4" + +/** + * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - extended reports are not enabled (the default) + * "1" - extended reports + * + * Extended input reports allow rumble on Bluetooth PS4 controllers, but + * break DirectInput handling for applications that don't use SDL. + * + * Once extended reports are enabled, they can not be disabled without + * power cycling the controller. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE" + +/** + * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM" + +/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH" + +/** + * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" + +/** + * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs + * + * The variable can be set to the following values: + * "0" - Do not scan for Steam Controllers + * "1" - Scan for Steam Controllers (the default) + * + * The default value is "1". This hint must be set before initializing the joystick subsystem. + */ +#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS" + + /** * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it. * This is a debugging aid for developers and not expected to be used by end users. The default is "1" @@ -494,6 +619,10 @@ extern "C" { * This is specially useful if you build SDL against a non glibc libc library (such as musl) which * provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). * Support for this hint is currently available only in the pthread, Windows, and PSP backend. +* +* Instead of this hint, in 2.0.9 and later, you can use +* SDL_CreateThreadWithStackSize(). This hint only works with the classic +* SDL_CreateThread(). */ #define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE" @@ -719,6 +848,35 @@ extern "C" { */ #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH" + /** + * \brief A variable to control whether we trap the Android back button to handle it manually. + * This is necessary for the right mouse button to work on some Android devices, or + * to be able to trap the back button for use in your code reliably. If set to true, + * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of + * SDL_SCANCODE_AC_BACK. + * + * The variable can be set to the following values: + * "0" - Back button will be handled as usual for system. (default) + * "1" - Back button will be trapped, allowing you to handle the key press + * manually. (This will also let right mouse click work on systems + * where the right mouse button functions as back.) + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" + + /** + * \brief A variable to control whether the return key on the soft keyboard + * should hide the soft keyboard on Android and iOS. + * + * The variable can be set to the following values: + * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - The return key will hide the keyboard. + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME" + /** * \brief override the binding element for keyboard inputs for Emscripten builds * @@ -752,7 +910,7 @@ extern "C" { * "0" - SDL will generate a window-close event when it sees Alt+F4. * "1" - SDL will only do normal key handling for Alt+F4. */ -#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" +#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" /** * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. @@ -797,6 +955,24 @@ extern "C" { */ #define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER" +/** + * \brief Tell the video driver that we only want a double buffer. + * + * By default, most lowlevel 2D APIs will use a triple buffer scheme that + * wastes no CPU time on waiting for vsync after issuing a flip, but + * introduces a frame of latency. On the other hand, using a double buffer + * scheme instead is recommended for cases where low latency is an important + * factor because we save a whole frame of latency. + * We do so by waiting for vsync immediately after issuing a flip, usually just + * after eglSwapBuffers call in the backend's *_SwapWindow function. + * + * Since it's driver-specific, it's only supported where possible and + * implemented. Currently supported the following drivers: + * - KMSDRM (kmsdrm) + * - Raspberry Pi (raspberrypi) + */ +#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER" + /** * \brief A variable controlling what driver to use for OpenGL ES contexts. * diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_joystick.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_joystick.h index f598dc828..6e05a9c20 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_joystick.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,10 +97,10 @@ typedef enum typedef enum { SDL_JOYSTICK_POWER_UNKNOWN = -1, - SDL_JOYSTICK_POWER_EMPTY, - SDL_JOYSTICK_POWER_LOW, - SDL_JOYSTICK_POWER_MEDIUM, - SDL_JOYSTICK_POWER_FULL, + SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */ + SDL_JOYSTICK_POWER_LOW, /* <= 20% */ + SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */ + SDL_JOYSTICK_POWER_FULL, /* <= 100% */ SDL_JOYSTICK_POWER_WIRED, SDL_JOYSTICK_POWER_MAX } SDL_JoystickPowerLevel; @@ -132,6 +132,12 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); */ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); +/** + * Get the player index of a joystick, or -1 if it's not available + * This can be called before any joysticks are opened. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index); + /** * Return the GUID for the joystick at this index * This can be called before any joysticks are opened. @@ -194,6 +200,13 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID */ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); +/** + * Get the player index of an opened joystick, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); + /** * Return the GUID for this opened joystick */ @@ -361,6 +374,19 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, int button); +/** + * Trigger a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param joystick The joystick to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + /** * Close a joystick previously opened with SDL_JoystickOpen(). */ diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_keyboard.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_keyboard.h index e78ca4690..874823171 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_keyboard.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_keycode.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_keycode.h index c41e45ff6..d7d5b1dbc 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_keycode.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_loadso.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_loadso.h index 6ea256c6a..da56fb452 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_loadso.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_log.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_log.h index 356d0e1cf..e12b65886 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_log.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_main.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_main.h index 2af32360f..98558217f 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_main.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -63,10 +63,13 @@ /* On Android SDL provides a Java class in SDLActivity.java that is the main activity entry point. - See README-android.md for more details on extending that class. + See docs/README-android.md for more details on extending that class. */ #define SDL_MAIN_NEEDED +/* We need to export SDL_main so it can be launched from Java */ +#define SDLMAIN_DECLSPEC DECLSPEC + #elif defined(__NACL__) /* On NACL we use ppapi_simple to set up the application helper code, then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before @@ -85,6 +88,10 @@ #define C_LINKAGE #endif /* __cplusplus */ +#ifndef SDLMAIN_DECLSPEC +#define SDLMAIN_DECLSPEC +#endif + /** * \file SDL_main.h * @@ -107,7 +114,7 @@ /** * The prototype for the application's main() function */ -extern C_LINKAGE DECLSPEC int SDL_main(int argc, char *argv[]); +extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); #include "begin_code.h" diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_messagebox.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_messagebox.h index c326d8f01..b7be59d88 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_messagebox.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_mouse.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_mouse.h index 6001bd46c..d3c9f6156 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_mouse.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_mutex.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_mutex.h index 0272379e5..ba4247ced 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_mutex.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_name.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_name.h index 8095ed3ff..ecd863f4c 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_name.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_name.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengl.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengl.h index 314dd57ed..253d9c93a 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengl.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengles.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengles.h index 800c59307..18dd984b3 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengles.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengles2.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengles2.h index 102f2f3fa..6ccecf216 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengles2.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_pixels.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_pixels.h index 04246689f..0b4364b18 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_pixels.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -287,7 +287,9 @@ enum SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */ SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'), SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */ - SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1') + SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'), + SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */ + SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ') }; typedef struct SDL_Color diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_platform.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_platform.h index 9dde385fa..7dea4ce94 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_platform.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -121,7 +121,12 @@ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) /* Try to find out if we're compiling for WinRT or non-WinRT */ #if defined(_MSC_VER) && defined(__has_include) -#define HAVE_WINAPIFAMILY_H __has_include() +#if __has_include() +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + /* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ #elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ #define HAVE_WINAPIFAMILY_H 1 diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_power.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_power.h index d48e8a379..a4fe8a935 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_power.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_quit.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_quit.h index 9283c3810..fea56a8d8 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_quit.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_rect.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_rect.h index c4f6d74b3..543bb6186 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_rect.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_render.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_render.h index ea6ef9ff6..d33619297 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_render.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -898,6 +898,27 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw */ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); +/** + * \brief Get the CAMetalLayer associated with the given Metal renderer + * + * \param renderer The renderer to query + * + * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalCommandEncoder() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer); + +/** + * \brief Get the Metal command encoder for the current frame + * + * \param renderer The renderer to query + * + * \return id on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalLayer() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_revision.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_revision.h index 9376093ee..92fbe67b1 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_revision.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_revision.h @@ -1,2 +1,2 @@ -#define SDL_REVISION "hg-11645:2088cd828335" -#define SDL_REVISION_NUMBER 11645 +#define SDL_REVISION "hg-12373:8feb5da6f2fb" +#define SDL_REVISION_NUMBER 12373 diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_rwops.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_rwops.h index 7f0cbdfd5..0960699d4 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_rwops.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_scancode.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_scancode.h index 1d5521204..63871aa3b 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_scancode.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_sensor.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_sensor.h new file mode 100644 index 000000000..ac163a8cd --- /dev/null +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_sensor.h @@ -0,0 +1,251 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + 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. + + 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 + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_sensor.h + * + * Include file for SDL sensor event handling + * + */ + +#ifndef _SDL_sensor_h +#define _SDL_sensor_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief SDL_sensor.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system + * for sensors, and load appropriate drivers. + */ + +struct _SDL_Sensor; +typedef struct _SDL_Sensor SDL_Sensor; + +/** + * This is a unique ID for a sensor for the time it is connected to the system, + * and is never reused for the lifetime of the application. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + */ +typedef Sint32 SDL_SensorID; + +/* The different sensors defined by SDL + * + * Additional sensors may be available, using platform dependent semantics. + * + * Hare are the additional Android sensors: + * https://developer.android.com/reference/android/hardware/SensorEvent.html#values + */ +typedef enum +{ + SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */ + SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */ + SDL_SENSOR_ACCEL, /**< Accelerometer */ + SDL_SENSOR_GYRO /**< Gyroscope */ +} SDL_SensorType; + +/** + * Accelerometer sensor + * + * The accelerometer returns the current acceleration in SI meters per + * second squared. This includes gravity, so a device at rest will have + * an acceleration of SDL_STANDARD_GRAVITY straight down. + * + * values[0]: Acceleration on the x axis + * values[1]: Acceleration on the y axis + * values[2]: Acceleration on the z axis + * + * For phones held in portrait mode, the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ +#define SDL_STANDARD_GRAVITY 9.80665f + +/** + * Gyroscope sensor + * + * The gyroscope returns the current rate of rotation in radians per second. + * The rotation is positive in the counter-clockwise direction. That is, + * an observer looking from a positive location on one of the axes would + * see positive rotation on that axis when it appeared to be rotating + * counter-clockwise. + * + * values[0]: Angular speed around the x axis + * values[1]: Angular speed around the y axis + * values[2]: Angular speed around the z axis + * + * For phones held in portrait mode, the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ + +/* Function prototypes */ + +/** + * \brief Count the number of sensors attached to the system right now + */ +extern DECLSPEC int SDLCALL SDL_NumSensors(void); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor name, or NULL if device_index is out of range. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if device_index is out of range. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if device_index is out of range. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index); + +/** + * \brief Open a sensor for use. + * + * The index passed as an argument refers to the N'th sensor on the system. + * + * \return A sensor identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index); + +/** + * Return the SDL_Sensor associated with an instance id. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * \return The sensor name, or NULL if the sensor is NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if the sensor is NULL. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor); + +/** + * Get the current state of an opened sensor. + * + * The number of values and interpretation of the data is sensor dependent. + * + * \param sensor The sensor to query + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * + * \return 0 or -1 if an error occurred. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values); + +/** + * Close a sensor previously opened with SDL_SensorOpen() + */ +extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor); + +/** + * Update the current state of the open sensors. + * + * This is called automatically by the event loop if sensor events are enabled. + * + * This needs to be called from the thread that initialized the sensor subsystem. + */ +extern DECLSPEC void SDLCALL SDL_SensorUpdate(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_sensor_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_shape.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_shape.h index 9e492d93a..40a6baaae 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_shape.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_stdinc.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_stdinc.h index 72402299f..e373bc380 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_stdinc.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -86,6 +86,28 @@ #ifdef HAVE_FLOAT_H # include #endif +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__BORLANDC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) +#pragma alloca +# elif defined(__MRC__) +void *alloca(unsigned); +# else +char *alloca(); +# endif +#endif /** * The number of elements in an array. @@ -328,28 +350,6 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); extern "C" { #endif -#if defined(HAVE_ALLOCA) && !defined(alloca) -# if defined(HAVE_ALLOCA_H) -# include -# elif defined(__GNUC__) -# define alloca __builtin_alloca -# elif defined(_MSC_VER) -# include -# define alloca _alloca -# elif defined(__WATCOMC__) -# include -# elif defined(__BORLANDC__) -# include -# elif defined(__DMC__) -# include -# elif defined(__AIX__) -#pragma alloca -# elif defined(__MRC__) -void *alloca(unsigned); -# else -char *alloca(); -# endif -#endif #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) @@ -445,12 +445,12 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) #endif } - extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); +extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); @@ -501,18 +501,35 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size #endif extern DECLSPEC double SDLCALL SDL_acos(double x); +extern DECLSPEC float SDLCALL SDL_acosf(float x); extern DECLSPEC double SDLCALL SDL_asin(double x); +extern DECLSPEC float SDLCALL SDL_asinf(float x); extern DECLSPEC double SDLCALL SDL_atan(double x); +extern DECLSPEC float SDLCALL SDL_atanf(float x); extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); +extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y); extern DECLSPEC double SDLCALL SDL_ceil(double x); +extern DECLSPEC float SDLCALL SDL_ceilf(float x); extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); +extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y); extern DECLSPEC double SDLCALL SDL_cos(double x); extern DECLSPEC float SDLCALL SDL_cosf(float x); +extern DECLSPEC double SDLCALL SDL_exp(double x); +extern DECLSPEC float SDLCALL SDL_expf(float x); extern DECLSPEC double SDLCALL SDL_fabs(double x); +extern DECLSPEC float SDLCALL SDL_fabsf(float x); extern DECLSPEC double SDLCALL SDL_floor(double x); +extern DECLSPEC float SDLCALL SDL_floorf(float x); +extern DECLSPEC double SDLCALL SDL_fmod(double x, double y); +extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y); extern DECLSPEC double SDLCALL SDL_log(double x); +extern DECLSPEC float SDLCALL SDL_logf(float x); +extern DECLSPEC double SDLCALL SDL_log10(double x); +extern DECLSPEC float SDLCALL SDL_log10f(float x); extern DECLSPEC double SDLCALL SDL_pow(double x, double y); +extern DECLSPEC float SDLCALL SDL_powf(float x, float y); extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); +extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n); extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC float SDLCALL SDL_sinf(float x); extern DECLSPEC double SDLCALL SDL_sqrt(double x); diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_surface.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_surface.h index 510690c9c..730d49fc8 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_surface.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,6 +97,17 @@ typedef struct SDL_Surface typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, struct SDL_Surface * dst, SDL_Rect * dstrect); +/** + * \brief The formula used for converting between YUV and RGB + */ +typedef enum +{ + SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */ + SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */ + SDL_YUV_CONVERSION_BT709, /**< BT.709 */ + SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */ +} SDL_YUV_CONVERSION_MODE; + /** * Allocate and free an RGB surface. * @@ -237,6 +248,13 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key); +/** + * \brief Returns whether the surface has a color key + * + * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface); + /** * \brief Gets the color key (transparent pixel) in a blittable surface. * @@ -509,6 +527,20 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled (SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); +/** + * \brief Set the YUV conversion mode + */ +extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode); + +/** + * \brief Get the YUV conversion mode + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void); + +/** + * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_system.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_system.h index eb069b33d..4dc372d6b 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_system.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -76,6 +76,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a #endif /* __WIN32__ */ +/* Platform specific functions for Linux */ +#ifdef __LINUX__ + +/** + \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available. + + \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority); + +#endif /* __LINUX__ */ + /* Platform specific functions for iOS */ #if defined(__IPHONEOS__) && __IPHONEOS__ @@ -108,6 +120,26 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void); */ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); +/** + \brief Return true if the application is running on Android TV + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); + +/** + \brief Return true if the application is running on a Chromebook + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void); + +/** + \brief Return true is the application is running on a Samsung DeX docking station + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void); + +/** + \brief Trigger the Android system back button behavior. + */ +extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void); + /** See the official Android developer guide for more information: http://developer.android.com/guide/topics/data/data-storage.html @@ -169,6 +201,25 @@ typedef enum } SDL_WinRT_Path; +/** + * \brief WinRT Device Family + */ +typedef enum +{ + /** \brief Unknown family */ + SDL_WINRT_DEVICEFAMILY_UNKNOWN, + + /** \brief Desktop family*/ + SDL_WINRT_DEVICEFAMILY_DESKTOP, + + /** \brief Mobile family (for example smartphone) */ + SDL_WINRT_DEVICEFAMILY_MOBILE, + + /** \brief XBox family */ + SDL_WINRT_DEVICEFAMILY_XBOX, +} SDL_WinRT_DeviceFamily; + + /** * \brief Retrieves a WinRT defined path on the local file system * @@ -203,8 +254,20 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path */ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); +/** + * \brief Detects the device family of WinRT plattform on runtime + * + * \return Device family + */ +extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); + #endif /* __WINRT__ */ +/** + \brief Return true if the current device is a tablet. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_syswm.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_syswm.h index 2d18afb6c..f1c4021cc 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_syswm.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,12 +33,6 @@ #include "SDL_video.h" #include "SDL_version.h" -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - /** * \file SDL_syswm.h * @@ -110,6 +104,12 @@ typedef void *EGLSurface; #include "SDL_egl.h" #endif +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /** * These are the various supported windowing subsystems */ diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test.h index f55afcb02..6cc373bf8 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_assert.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_assert.h index 11d836394..1788d7a20 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_assert.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_common.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_common.h index 24eeb32af..be2e6b2aa 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_common.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_compare.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_compare.h index 9f4c4587a..c22e447d8 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_compare.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_compare.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_crc32.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_crc32.h index add480c34..3d235d074 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_crc32.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_font.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_font.h index 58c9f9d5e..59cbdcad6 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_font.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_fuzzer.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_fuzzer.h index 6cf05747a..8fcb9ebbf 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_fuzzer.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_harness.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_harness.h index 68c4bcb7c..8641e0a7e 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_harness.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_images.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_images.h index 683d2f8a6..9c4dd5b82 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_images.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_images.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_log.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_log.h index 9f993fbbc..ebd44fb50 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_log.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_md5.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_md5.h index 67ca7d1de..0e4105768 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_md5.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_memory.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_memory.h index 43b67f521..4827ae6f2 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_memory.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_memory.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_random.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_random.h index 2b01922c3..0eb414ff2 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_random.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_thread.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_thread.h index d0f6575cd..554dd0b61 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_thread.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,12 +54,13 @@ typedef unsigned int SDL_TLSID; /** * The SDL thread priority. * - * \note On many systems you require special privileges to set high priority. + * \note On many systems you require special privileges to set high or time critical priority. */ typedef enum { SDL_THREAD_PRIORITY_LOW, SDL_THREAD_PRIORITY_NORMAL, - SDL_THREAD_PRIORITY_HIGH + SDL_THREAD_PRIORITY_HIGH, + SDL_THREAD_PRIORITY_TIME_CRITICAL } SDL_ThreadPriority; /** @@ -105,14 +106,24 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *), + const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); + + /** * Create a thread. */ #if defined(SDL_CreateThread) && SDL_DYNAMIC_API #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #endif #elif defined(__OS2__) @@ -132,15 +143,31 @@ extern DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); #if defined(SDL_CreateThread) && SDL_DYNAMIC_API #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) #endif #else +/** + * Create a thread with a default stack size. + * + * This is equivalent to calling: + * SDL_CreateThreadWithStackSize(fn, name, 0, data); + */ +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); + /** * Create a thread. * @@ -158,9 +185,17 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, * If a system imposes requirements, SDL will try to munge the string for * it (truncate, etc), but the original string contents will be available * from SDL_GetThreadName(). + * + * The size (in bytes) of the new stack can be specified. Zero means "use + * the system default" which might be wildly different between platforms + * (x86 Linux generally defaults to eight megabytes, an embedded device + * might be a few kilobytes instead). + * + * In SDL 2.1, stacksize will be folded into the original SDL_CreateThread + * function. */ extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data); #endif diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_timer.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_timer.h index 282625d3f..5600618ff 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_timer.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_touch.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_touch.h index db9e25ebd..f4075e79a 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_touch.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_types.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_types.h index 06ee80cb3..4ac248c8c 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_types.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_version.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_version.h index 5b4c40248..31443e149 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_version.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 7 +#define SDL_PATCHLEVEL 9 /** * \brief Macro to determine SDL version program was compiled against. diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_video.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_video.h index 6f6cda8b1..461f13805 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_video.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -110,7 +110,9 @@ typedef enum SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ - SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */ + SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported. + On macOS NSHighResolutionCapable must be set true in the + application's Info.plist for this to have any effect. */ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */ SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */ SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */ @@ -167,6 +169,24 @@ typedef enum SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */ } SDL_WindowEventID; +/** + * \brief Event subtype for display events + */ +typedef enum +{ + SDL_DISPLAYEVENT_NONE, /**< Never used */ + SDL_DISPLAYEVENT_ORIENTATION /**< Display orientation has changed to data1 */ +} SDL_DisplayEventID; + +typedef enum +{ + SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */ + SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */ + SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */ + SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */ + SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */ +} SDL_DisplayOrientation; + /** * \brief An opaque handle to an OpenGL context. */ @@ -314,18 +334,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex); */ extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); -/** - * \brief Get the dots/pixels-per-inch for a display - * - * \note Diagonal, horizontal and vertical DPI can all be optionally - * returned if the parameter is non-NULL. - * - * \return 0 on success, or -1 if no DPI information is available or the index is out of range. - * - * \sa SDL_GetNumVideoDisplays() - */ -extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi); - /** * \brief Get the usable desktop area represented by a display, with the * primary display located at 0,0 @@ -345,6 +353,27 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, fl */ extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect); +/** + * \brief Get the dots/pixels-per-inch for a display + * + * \note Diagonal, horizontal and vertical DPI can all be optionally + * returned if the parameter is non-NULL. + * + * \return 0 on success, or -1 if no DPI information is available or the index is out of range. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi); + +/** + * \brief Get the orientation of a display + * + * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int displayIndex); + /** * \brief Returns the number of available display modes. * @@ -470,7 +499,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); * If the window is created with any of the SDL_WINDOW_OPENGL or * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the - * corrensponding UnloadLibrary function is called by SDL_DestroyWindow(). + * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). * * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail. diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_vulkan.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_vulkan.h index 803b5feef..972cca4d7 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_vulkan.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/SDL_vulkan.h @@ -69,30 +69,43 @@ typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ * \brief Dynamically load a Vulkan loader library. * * \param [in] path The platform dependent Vulkan loader library name, or - * \c NULL to open the default Vulkan loader library. + * \c NULL. * * \return \c 0 on success, or \c -1 if the library couldn't be loaded. * - * This should be done after initializing the video driver, but before + * If \a path is NULL SDL will use the value of the environment variable + * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan + * loader library. + * + * This should be called after initializing the video driver, but before * creating any Vulkan windows. If no Vulkan loader library is loaded, the * default library will be loaded upon creation of the first Vulkan window. * - * \note If you specify a non-NULL \a path, you should retrieve all of the - * Vulkan functions used in your program from the dynamic library using + * \note It is fairly common for Vulkan applications to link with \a libvulkan + * instead of explicitly loading it at run time. This will work with + * SDL provided the application links to a dynamic library and both it + * and SDL use the same search path. + * + * \note If you specify a non-NULL \c path, an application should retrieve all + * of the Vulkan functions it uses from the dynamic library using * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee - * \a path points to the same vulkan loader library that you linked to. + * \c path points to the same vulkan loader library the application + * linked to. * * \note On Apple devices, if \a path is NULL, SDL will attempt to find * the vkGetInstanceProcAddr address within all the mach-o images of - * the current process. This is because the currently (v0.17.0) - * recommended MoltenVK (Vulkan on Metal) usage is as a static library. - * If it is not found then SDL will attempt to load \c libMoltenVK.dylib. - * Applications using the dylib alternative therefore do not need to do - * anything special when calling SDL. + * the current process. This is because it is fairly common for Vulkan + * applications to link with libvulkan (and historically MoltenVK was + * provided as a static library). If it is not found then, on macOS, SDL + * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, + * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order. + * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications + * using a dynamic framework or .dylib must ensure it is included in its + * application bundle. * - * \note On non-Apple devices, SDL requires you to either not link to the - * Vulkan loader or link to a dynamic library version. This limitation - * may be removed in a future version of SDL. + * \note On non-Apple devices, application linking with a static libvulkan is + * not supported. Either do not link to the Vulkan loader or link to a + * dynamic library version. * * \note This function will fail if there are no working Vulkan drivers * installed. @@ -122,11 +135,11 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * \brief Get the names of the Vulkan instance extensions needed to create * a surface with \c SDL_Vulkan_CreateSurface(). * - * \param [in] window Window for which the required Vulkan instance + * \param [in] \c NULL or window Window for which the required Vulkan instance * extensions should be retrieved - * \param [in,out] count pointer to an \c unsigned related to the number of + * \param [in,out] pCount pointer to an \c unsigned related to the number of * required Vulkan instance extensions - * \param [out] names \c NULL or a pointer to an array to be filled with the + * \param [out] pNames \c NULL or a pointer to an array to be filled with the * required Vulkan instance extensions * * \return \c SDL_TRUE on success, \c SDL_FALSE on error. @@ -140,6 +153,10 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * is smaller than the number of required extensions, \c SDL_FALSE will be * returned instead of \c SDL_TRUE, to indicate that not all the required * extensions were returned. + * + * \note If \c window is not NULL, it will be checked against its creation + * flags to ensure that the Vulkan flag is present. This parameter + * will be removed in a future major release. * * \note The returned list of extensions will contain \c VK_KHR_surface * and zero or more platform specific extensions @@ -147,12 +164,13 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * \note The extension names queried here must be enabled when calling * VkCreateInstance, otherwise surface creation will fail. * - * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag. + * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag + * or be \c NULL * * \code * unsigned int count; * // get count of required extensions - * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL)) + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL)) * handle_error(); * * static const char *const additionalExtensions[] = @@ -166,7 +184,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * handle_error(); * * // get names of required extensions - * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names)) + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names)) * handle_error(); * * // copy additional extensions after required extensions @@ -240,6 +258,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface( * platform with high-DPI support (Apple calls this "Retina"), and not disabled * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. * + * \note On macOS high-DPI support must be enabled for an application by + * setting NSHighResolutionCapable to true in its Info.plist. + * * \sa SDL_GetWindowSize() * \sa SDL_CreateWindow() */ diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/begin_code.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/begin_code.h index 5372d6f04..6c2106246 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/begin_code.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/include/SDL2/close_code.h b/libs/SDL2/i686-w64-mingw32/include/SDL2/close_code.h index 2a352dbb9..b3b70a4c8 100644 --- a/libs/SDL2/i686-w64-mingw32/include/SDL2/close_code.h +++ b/libs/SDL2/i686-w64-mingw32/include/SDL2/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/i686-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake b/libs/SDL2/i686-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake index 208b7c637..ee347fcb9 100644 --- a/libs/SDL2/i686-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake +++ b/libs/SDL2/i686-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake @@ -1,11 +1,11 @@ # sdl2 cmake project-config input for ./configure scripts -set(prefix "/usr/local/i686-w64-mingw32") +set(prefix "/opt/local/i686-w64-mingw32") set(exec_prefix "${prefix}") set(libdir "${exec_prefix}/lib") -set(SDL2_PREFIX "/usr/local/i686-w64-mingw32") -set(SDL2_EXEC_PREFIX "/usr/local/i686-w64-mingw32") +set(SDL2_PREFIX "/opt/local/i686-w64-mingw32") +set(SDL2_EXEC_PREFIX "/opt/local/i686-w64-mingw32") set(SDL2_LIBDIR "${exec_prefix}/lib") set(SDL2_INCLUDE_DIRS "${prefix}/include/SDL2") -set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -lSDL2 -mwindows") +set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -lSDL2 -mwindows") string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) diff --git a/libs/SDL2/i686-w64-mingw32/lib/libSDL2.a b/libs/SDL2/i686-w64-mingw32/lib/libSDL2.a index 771ee00bd..05489a95a 100644 Binary files a/libs/SDL2/i686-w64-mingw32/lib/libSDL2.a and b/libs/SDL2/i686-w64-mingw32/lib/libSDL2.a differ diff --git a/libs/SDL2/i686-w64-mingw32/lib/libSDL2.dll.a b/libs/SDL2/i686-w64-mingw32/lib/libSDL2.dll.a index 59d480738..b20371a13 100755 Binary files a/libs/SDL2/i686-w64-mingw32/lib/libSDL2.dll.a and b/libs/SDL2/i686-w64-mingw32/lib/libSDL2.dll.a differ diff --git a/libs/SDL2/i686-w64-mingw32/lib/libSDL2.la b/libs/SDL2/i686-w64-mingw32/lib/libSDL2.la new file mode 100644 index 000000000..3848c7db9 --- /dev/null +++ b/libs/SDL2/i686-w64-mingw32/lib/libSDL2.la @@ -0,0 +1,41 @@ +# libSDL2.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='../bin/SDL2.dll' + +# Names of this library. +library_names='libSDL2.dll.a' + +# The name of the static archive. +old_library='libSDL2.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libSDL2. +current=9 +age=9 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/valve/release/SDL/SDL2-2.0.9/i686-w64-mingw32/lib' diff --git a/libs/SDL2/i686-w64-mingw32/lib/libSDL2_test.a b/libs/SDL2/i686-w64-mingw32/lib/libSDL2_test.a index 5f2cfa28f..190f9e072 100644 Binary files a/libs/SDL2/i686-w64-mingw32/lib/libSDL2_test.a and b/libs/SDL2/i686-w64-mingw32/lib/libSDL2_test.a differ diff --git a/libs/SDL2/i686-w64-mingw32/lib/libSDL2_test.la b/libs/SDL2/i686-w64-mingw32/lib/libSDL2_test.la new file mode 100644 index 000000000..5f96235bd --- /dev/null +++ b/libs/SDL2/i686-w64-mingw32/lib/libSDL2_test.la @@ -0,0 +1,41 @@ +# libSDL2_test.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libSDL2_test.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libSDL2_test. +current=0 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/valve/release/SDL/SDL2-2.0.9/i686-w64-mingw32/lib' diff --git a/libs/SDL2/i686-w64-mingw32/lib/libSDL2main.a b/libs/SDL2/i686-w64-mingw32/lib/libSDL2main.a index 9dddabbfc..df7c95b95 100644 Binary files a/libs/SDL2/i686-w64-mingw32/lib/libSDL2main.a and b/libs/SDL2/i686-w64-mingw32/lib/libSDL2main.a differ diff --git a/libs/SDL2/i686-w64-mingw32/lib/libSDL2main.la b/libs/SDL2/i686-w64-mingw32/lib/libSDL2main.la new file mode 100644 index 000000000..d01b8a172 --- /dev/null +++ b/libs/SDL2/i686-w64-mingw32/lib/libSDL2main.la @@ -0,0 +1,41 @@ +# libSDL2main.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libSDL2main.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libSDL2main. +current=0 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/valve/release/SDL/SDL2-2.0.9/i686-w64-mingw32/lib' diff --git a/libs/SDL2/i686-w64-mingw32/lib/pkgconfig/sdl2.pc b/libs/SDL2/i686-w64-mingw32/lib/pkgconfig/sdl2.pc index 407c95c48..25fc5928e 100644 --- a/libs/SDL2/i686-w64-mingw32/lib/pkgconfig/sdl2.pc +++ b/libs/SDL2/i686-w64-mingw32/lib/pkgconfig/sdl2.pc @@ -1,15 +1,15 @@ # sdl pkg-config source file -prefix=/usr/local/i686-w64-mingw32 +prefix=/opt/local/i686-w64-mingw32 exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: sdl2 Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. -Version: 2.0.7 +Version: 2.0.9 Requires: Conflicts: -Libs: -L${libdir} -lmingw32 -lSDL2main -lSDL2 -mwindows -Libs.private: -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc +Libs: -L${libdir} -lmingw32 -lSDL2main -lSDL2 -mwindows +Libs.private: -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc Cflags: -I${includedir}/SDL2 -Dmain=SDL_main diff --git a/libs/SDL2/include/SDL.h b/libs/SDL2/include/SDL.h old mode 100755 new mode 100644 index 366d50fa3..fc35a419e --- a/libs/SDL2/include/SDL.h +++ b/libs/SDL2/include/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,6 +51,7 @@ #include "SDL_power.h" #include "SDL_render.h" #include "SDL_rwops.h" +#include "SDL_sensor.h" #include "SDL_shape.h" #include "SDL_system.h" #include "SDL_thread.h" @@ -80,10 +81,11 @@ extern "C" { #define SDL_INIT_HAPTIC 0x00001000u #define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ #define SDL_INIT_EVENTS 0x00004000u +#define SDL_INIT_SENSOR 0x00008000u #define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */ #define SDL_INIT_EVERYTHING ( \ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ - SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ + SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \ ) /* @} */ diff --git a/libs/SDL2/include/SDL_assert.h b/libs/SDL2/include/SDL_assert.h old mode 100755 new mode 100644 index 90abbe39b..b38f928ae --- a/libs/SDL2/include/SDL_assert.h +++ b/libs/SDL2/include/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_atomic.h b/libs/SDL2/include/SDL_atomic.h old mode 100755 new mode 100644 index 36e37f3b7..b2287748c --- a/libs/SDL2/include/SDL_atomic.h +++ b/libs/SDL2/include/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -158,6 +158,9 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") +#elif defined(__GNUC__) && defined(__aarch64__) +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__GNUC__) && defined(__arm__) #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") diff --git a/libs/SDL2/include/SDL_audio.h b/libs/SDL2/include/SDL_audio.h old mode 100755 new mode 100644 index f119c2b26..d3e1bface --- a/libs/SDL2/include/SDL_audio.h +++ b/libs/SDL2/include/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -140,7 +140,8 @@ typedef Uint16 SDL_AudioFormat; #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 #define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 -#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) +#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008 +#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE) /* @} */ /* @} *//* Audio flags */ @@ -527,7 +528,7 @@ extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioForm * * \param stream The stream the audio data is being added to * \param buf A pointer to the audio data to add - * \param int The number of bytes to write to the stream + * \param len The number of bytes to write to the stream * \return 0 on success, or -1 on error. * * \sa SDL_NewAudioStream diff --git a/libs/SDL2/include/SDL_bits.h b/libs/SDL2/include/SDL_bits.h old mode 100755 new mode 100644 index bc2857290..eb8322f0d --- a/libs/SDL2/include/SDL_bits.h +++ b/libs/SDL2/include/SDL_bits.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_blendmode.h b/libs/SDL2/include/SDL_blendmode.h old mode 100755 new mode 100644 index 9abd0bd4c..36a5ea76f --- a/libs/SDL2/include/SDL_blendmode.h +++ b/libs/SDL2/include/SDL_blendmode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_clipboard.h b/libs/SDL2/include/SDL_clipboard.h old mode 100755 new mode 100644 index 341f4ba42..f28751ebb --- a/libs/SDL2/include/SDL_clipboard.h +++ b/libs/SDL2/include/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_config.h b/libs/SDL2/include/SDL_config.h old mode 100755 new mode 100644 index 1bbb83848..c58be8e72 --- a/libs/SDL2/include/SDL_config.h +++ b/libs/SDL2/include/SDL_config.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -82,6 +82,9 @@ typedef unsigned int uintptr_t; #define HAVE_DSOUND_H 1 #define HAVE_DXGI_H 1 #define HAVE_XINPUT_H 1 +#define HAVE_MMDEVICEAPI_H 1 +#define HAVE_AUDIOCLIENT_H 1 +#define HAVE_ENDPOINTVOLUME_H 1 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */ #ifdef HAVE_LIBC @@ -109,13 +112,15 @@ typedef unsigned int uintptr_t; #define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 #define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__ULTOA */ #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 #define HAVE_STRTOD 1 @@ -125,30 +130,45 @@ typedef unsigned int uintptr_t; #define HAVE_STRNCMP 1 #define HAVE__STRICMP 1 #define HAVE__STRNICMP 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 -#define HAVE_CEIL 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE__COPYSIGN 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEILF 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 #if defined(_MSC_VER) /* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 #define HAVE_STRTOLL 1 #define HAVE_VSSCANF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #endif /* This function is available with at least the VC++ 2008 C runtime library */ #if _MSC_VER >= 1400 @@ -166,7 +186,6 @@ typedef unsigned int uintptr_t; /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_WASAPI 1 #define SDL_AUDIO_DRIVER_DSOUND 1 -#define SDL_AUDIO_DRIVER_XAUDIO2 0 #define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 @@ -174,9 +193,13 @@ typedef unsigned int uintptr_t; /* Enable various input drivers */ #define SDL_JOYSTICK_DINPUT 1 #define SDL_JOYSTICK_XINPUT 1 +#define SDL_JOYSTICK_HIDAPI 1 #define SDL_HAPTIC_DINPUT 1 #define SDL_HAPTIC_XINPUT 1 +/* Enable the dummy sensor driver */ +#define SDL_SENSOR_DUMMY 1 + /* Enable various shared object loading systems */ #define SDL_LOADSO_WINDOWS 1 @@ -194,7 +217,7 @@ typedef unsigned int uintptr_t; #define SDL_VIDEO_RENDER_D3D 1 #endif #ifndef SDL_VIDEO_RENDER_D3D11 -#define SDL_VIDEO_RENDER_D3D11 0 +#define SDL_VIDEO_RENDER_D3D11 0 #endif /* Enable OpenGL support */ diff --git a/libs/SDL2/include/SDL_config.h.cmake b/libs/SDL2/include/SDL_config.h.cmake old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_config.h.in b/libs/SDL2/include/SDL_config.h.in old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_config_android.h b/libs/SDL2/include/SDL_config_android.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_config_iphoneos.h b/libs/SDL2/include/SDL_config_iphoneos.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_config_macosx.h b/libs/SDL2/include/SDL_config_macosx.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_config_macosx.h.orig b/libs/SDL2/include/SDL_config_macosx.h.orig old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_config_minimal.h b/libs/SDL2/include/SDL_config_minimal.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_config_pandora.h b/libs/SDL2/include/SDL_config_pandora.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_config_psp.h b/libs/SDL2/include/SDL_config_psp.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_config_windows.h b/libs/SDL2/include/SDL_config_windows.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_config_winrt.h b/libs/SDL2/include/SDL_config_winrt.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_config_wiz.h b/libs/SDL2/include/SDL_config_wiz.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_copying.h b/libs/SDL2/include/SDL_copying.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_cpuinfo.h b/libs/SDL2/include/SDL_cpuinfo.h old mode 100755 new mode 100644 index 94b64b03b..ee3a47e84 --- a/libs/SDL2/include/SDL_cpuinfo.h +++ b/libs/SDL2/include/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,27 +51,35 @@ #include #else #ifdef __ALTIVEC__ -#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) +#if defined(HAVE_ALTIVEC_H) && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H) #include #undef pixel +#undef bool #endif #endif -#ifdef __MMX__ -#include +#if defined(__ARM_NEON__) && !defined(SDL_DISABLE_ARM_NEON_H) +#include #endif -#ifdef __3dNOW__ +#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) #include #endif -#ifdef __SSE__ +#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) +#include +#else +#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) +#include +#endif +#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H) #include #endif -#ifdef __SSE2__ +#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H) #include #endif -#ifdef __SSE3__ +#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H) #include #endif -#endif +#endif /* HAVE_IMMINTRIN_H */ +#endif /* compiler version */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -154,6 +162,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); +/** + * This function returns true if the CPU has AVX-512F (foundation) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void); + /** * This function returns true if the CPU has NEON (ARM SIMD) features. */ @@ -164,7 +177,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); */ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/libs/SDL2/include/SDL_egl.h b/libs/SDL2/include/SDL_egl.h old mode 100755 new mode 100644 index e47fbe862..d65ed437c --- a/libs/SDL2/include/SDL_egl.h +++ b/libs/SDL2/include/SDL_egl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ * * This is a simple file to encapsulate the EGL API headers. */ -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__ANDROID__) #include #include diff --git a/libs/SDL2/include/SDL_endian.h b/libs/SDL2/include/SDL_endian.h old mode 100755 new mode 100644 index 3eda7f287..ed0bf5ba8 --- a/libs/SDL2/include/SDL_endian.h +++ b/libs/SDL2/include/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_error.h b/libs/SDL2/include/SDL_error.h old mode 100755 new mode 100644 index 49be9827e..c0e46298e --- a/libs/SDL2/include/SDL_error.h +++ b/libs/SDL2/include/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_events.h b/libs/SDL2/include/SDL_events.h old mode 100755 new mode 100644 index 0fc09bc37..af22eb646 --- a/libs/SDL2/include/SDL_events.h +++ b/libs/SDL2/include/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -85,6 +85,9 @@ typedef enum Called on Android in onResume() */ + /* Display events */ + SDL_DISPLAYEVENT = 0x150, /**< Display state change */ + /* Window events */ SDL_WINDOWEVENT = 0x200, /**< Window state change */ SDL_SYSWMEVENT, /**< System specific event */ @@ -144,6 +147,9 @@ typedef enum SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */ + /* Sensor events */ + SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */ + /* Render events */ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */ SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */ @@ -168,6 +174,21 @@ typedef struct SDL_CommonEvent Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_CommonEvent; +/** + * \brief Display state change event data (event.display.*) + */ +typedef struct SDL_DisplayEvent +{ + Uint32 type; /**< ::SDL_DISPLAYEVENT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 display; /**< The associated display index */ + Uint8 event; /**< ::SDL_DisplayEventID */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint32 data1; /**< event dependent data */ +} SDL_DisplayEvent; + /** * \brief Window state change event data (event.window.*) */ @@ -471,6 +492,17 @@ typedef struct SDL_DropEvent } SDL_DropEvent; +/** + * \brief Sensor event structure (event.sensor.*) + */ +typedef struct SDL_SensorEvent +{ + Uint32 type; /**< ::SDL_SENSORUPDATE */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Sint32 which; /**< The instance ID of the sensor */ + float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ +} SDL_SensorEvent; + /** * \brief The "quit requested" event */ @@ -526,6 +558,7 @@ typedef union SDL_Event { Uint32 type; /**< Event type, shared with all events */ SDL_CommonEvent common; /**< Common event data */ + SDL_DisplayEvent display; /**< Window event data */ SDL_WindowEvent window; /**< Window event data */ SDL_KeyboardEvent key; /**< Keyboard event data */ SDL_TextEditingEvent edit; /**< Text editing event data */ @@ -542,6 +575,7 @@ typedef union SDL_Event SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ SDL_AudioDeviceEvent adevice; /**< Audio device event data */ + SDL_SensorEvent sensor; /**< Sensor event data */ SDL_QuitEvent quit; /**< Quit request event data */ SDL_UserEvent user; /**< Custom event data */ SDL_SysWMEvent syswm; /**< System dependent window event data */ diff --git a/libs/SDL2/include/SDL_filesystem.h b/libs/SDL2/include/SDL_filesystem.h old mode 100755 new mode 100644 index a1c846ad0..fa6a1fa6e --- a/libs/SDL2/include/SDL_filesystem.h +++ b/libs/SDL2/include/SDL_filesystem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_gamecontroller.h b/libs/SDL2/include/SDL_gamecontroller.h old mode 100755 new mode 100644 index c9215132e..6ae9c9542 --- a/libs/SDL2/include/SDL_gamecontroller.h +++ b/libs/SDL2/include/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -175,6 +175,14 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); */ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); +/** + * Get the mapping of a game controller. + * This can be called before any controllers are opened. + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available + */ +extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index); + /** * Open a game controller for use. * The index passed as an argument refers to the N'th game controller on the system. @@ -196,6 +204,13 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL */ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); +/** + * Get the player index of an opened game controller, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); + /** * Get the USB vendor ID of an opened controller, if available. * If the vendor ID isn't available this function returns 0. @@ -345,6 +360,19 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); +/** + * Trigger a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param gamecontroller The controller to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + /** * Close a controller previously opened with SDL_GameControllerOpen(). */ diff --git a/libs/SDL2/include/SDL_gesture.h b/libs/SDL2/include/SDL_gesture.h old mode 100755 new mode 100644 index 2bba6a729..b223d80d4 --- a/libs/SDL2/include/SDL_gesture.h +++ b/libs/SDL2/include/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_haptic.h b/libs/SDL2/include/SDL_haptic.h old mode 100755 new mode 100644 index 60daefaa7..2ea1bfc16 --- a/libs/SDL2/include/SDL_haptic.h +++ b/libs/SDL2/include/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -117,6 +117,17 @@ extern "C" { #endif /* __cplusplus */ +/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF). + * + * At the moment the magnitude variables are mixed between signed/unsigned, and + * it is also not made clear that ALL of those variables expect a max of 0x7FFF. + * + * Some platforms may have higher precision than that (Linux FF, Windows XInput) + * so we should fix the inconsistency in favor of higher possible precision, + * adjusting for platforms that use different scales. + * -flibit + */ + /** * \typedef SDL_Haptic * @@ -656,8 +667,8 @@ typedef struct SDL_HapticRamp * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. * * The Left/Right effect is used to explicitly control the large and small - * motors, commonly found in modern game controllers. One motor is high - * frequency, the other is low frequency. + * motors, commonly found in modern game controllers. The small (right) motor + * is high frequency, and the large (left) motor is low frequency. * * \sa SDL_HAPTIC_LEFTRIGHT * \sa SDL_HapticEffect @@ -668,7 +679,7 @@ typedef struct SDL_HapticLeftRight Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */ /* Replay */ - Uint32 length; /**< Duration of the effect. */ + Uint32 length; /**< Duration of the effect in milliseconds. */ /* Rumble */ Uint16 large_magnitude; /**< Control of the large controller motor. */ diff --git a/libs/SDL2/include/SDL_hints.h b/libs/SDL2/include/SDL_hints.h old mode 100755 new mode 100644 index 007a4bee0..4ee72e97d --- a/libs/SDL2/include/SDL_hints.h +++ b/libs/SDL2/include/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -76,6 +76,7 @@ extern "C" { * "opengl" * "opengles2" * "opengles" + * "metal" * "software" * * The default varies by platform, but it's the first one in the list that @@ -210,6 +211,18 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" +/** + * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_BYPASS_COMPOSITOR + * "1" - Enable _NET_WM_BYPASS_COMPOSITOR + * + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR + * + */ +#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" + /** * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden * @@ -249,6 +262,16 @@ extern "C" { */ #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" +/** + * \brief A variable setting the double click time, in milliseconds. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME" + +/** + * \brief A variable setting the double click radius, in pixels. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS" + /** * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode */ @@ -316,7 +339,7 @@ extern "C" { #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" /** - * \brief A variable controlling which orientations are allowed on iOS. + * \brief A variable controlling which orientations are allowed on iOS/Android. * * In some circumstances it is necessary to be able to explicitly control * which UI orientations are allowed. @@ -355,16 +378,36 @@ extern "C" { #define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" /** - * \brief A variable controlling whether the Android / iOS built-in - * accelerometer should be listed as a joystick device, rather than listing - * actual joysticks only. + * \brief A variable controlling whether the home indicator bar on iPhone X + * should be hidden. * * This variable can be set to the following values: - * "0" - List only real joysticks and accept input from them - * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). + * "0" - The indicator bar is not hidden (default for windowed applications) + * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) + * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) + */ +#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR" + +/** + * \brief A variable controlling whether the Android / iOS built-in + * accelerometer should be listed as a joystick device. + * + * This variable can be set to the following values: + * "0" - The accelerometer is not listed as a joystick + * "1" - The accelerometer is available as a 3 axis joystick (the default). */ #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" +/** + * \brief A variable controlling whether the Android / tvOS remotes + * should be listed as joystick devices, instead of sending keyboard events. + * + * This variable can be set to the following values: + * "0" - Remotes send enter/escape/arrow key events + * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). + */ +#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" + /** * \brief A variable that lets you disable the detection and use of Xinput gamepad devices * @@ -432,6 +475,88 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" +/** + * \brief A variable controlling whether the HIDAPI joystick drivers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI drivers are not used + * "1" - HIDAPI drivers are used (the default) + * + * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below. + */ +#define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI" + +/** + * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4" + +/** + * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - extended reports are not enabled (the default) + * "1" - extended reports + * + * Extended input reports allow rumble on Bluetooth PS4 controllers, but + * break DirectInput handling for applications that don't use SDL. + * + * Once extended reports are enabled, they can not be disabled without + * power cycling the controller. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE" + +/** + * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM" + +/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH" + +/** + * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" + +/** + * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs + * + * The variable can be set to the following values: + * "0" - Do not scan for Steam Controllers + * "1" - Scan for Steam Controllers (the default) + * + * The default value is "1". This hint must be set before initializing the joystick subsystem. + */ +#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS" + + /** * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it. * This is a debugging aid for developers and not expected to be used by end users. The default is "1" @@ -494,6 +619,10 @@ extern "C" { * This is specially useful if you build SDL against a non glibc libc library (such as musl) which * provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). * Support for this hint is currently available only in the pthread, Windows, and PSP backend. +* +* Instead of this hint, in 2.0.9 and later, you can use +* SDL_CreateThreadWithStackSize(). This hint only works with the classic +* SDL_CreateThread(). */ #define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE" @@ -719,6 +848,35 @@ extern "C" { */ #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH" + /** + * \brief A variable to control whether we trap the Android back button to handle it manually. + * This is necessary for the right mouse button to work on some Android devices, or + * to be able to trap the back button for use in your code reliably. If set to true, + * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of + * SDL_SCANCODE_AC_BACK. + * + * The variable can be set to the following values: + * "0" - Back button will be handled as usual for system. (default) + * "1" - Back button will be trapped, allowing you to handle the key press + * manually. (This will also let right mouse click work on systems + * where the right mouse button functions as back.) + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" + + /** + * \brief A variable to control whether the return key on the soft keyboard + * should hide the soft keyboard on Android and iOS. + * + * The variable can be set to the following values: + * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - The return key will hide the keyboard. + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME" + /** * \brief override the binding element for keyboard inputs for Emscripten builds * @@ -752,7 +910,7 @@ extern "C" { * "0" - SDL will generate a window-close event when it sees Alt+F4. * "1" - SDL will only do normal key handling for Alt+F4. */ -#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" +#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" /** * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. @@ -797,6 +955,24 @@ extern "C" { */ #define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER" +/** + * \brief Tell the video driver that we only want a double buffer. + * + * By default, most lowlevel 2D APIs will use a triple buffer scheme that + * wastes no CPU time on waiting for vsync after issuing a flip, but + * introduces a frame of latency. On the other hand, using a double buffer + * scheme instead is recommended for cases where low latency is an important + * factor because we save a whole frame of latency. + * We do so by waiting for vsync immediately after issuing a flip, usually just + * after eglSwapBuffers call in the backend's *_SwapWindow function. + * + * Since it's driver-specific, it's only supported where possible and + * implemented. Currently supported the following drivers: + * - KMSDRM (kmsdrm) + * - Raspberry Pi (raspberrypi) + */ +#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER" + /** * \brief A variable controlling what driver to use for OpenGL ES contexts. * diff --git a/libs/SDL2/include/SDL_joystick.h b/libs/SDL2/include/SDL_joystick.h old mode 100755 new mode 100644 index f598dc828..6e05a9c20 --- a/libs/SDL2/include/SDL_joystick.h +++ b/libs/SDL2/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,10 +97,10 @@ typedef enum typedef enum { SDL_JOYSTICK_POWER_UNKNOWN = -1, - SDL_JOYSTICK_POWER_EMPTY, - SDL_JOYSTICK_POWER_LOW, - SDL_JOYSTICK_POWER_MEDIUM, - SDL_JOYSTICK_POWER_FULL, + SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */ + SDL_JOYSTICK_POWER_LOW, /* <= 20% */ + SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */ + SDL_JOYSTICK_POWER_FULL, /* <= 100% */ SDL_JOYSTICK_POWER_WIRED, SDL_JOYSTICK_POWER_MAX } SDL_JoystickPowerLevel; @@ -132,6 +132,12 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); */ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); +/** + * Get the player index of a joystick, or -1 if it's not available + * This can be called before any joysticks are opened. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index); + /** * Return the GUID for the joystick at this index * This can be called before any joysticks are opened. @@ -194,6 +200,13 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID */ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); +/** + * Get the player index of an opened joystick, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); + /** * Return the GUID for this opened joystick */ @@ -361,6 +374,19 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, int button); +/** + * Trigger a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param joystick The joystick to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + /** * Close a joystick previously opened with SDL_JoystickOpen(). */ diff --git a/libs/SDL2/include/SDL_keyboard.h b/libs/SDL2/include/SDL_keyboard.h old mode 100755 new mode 100644 index e78ca4690..874823171 --- a/libs/SDL2/include/SDL_keyboard.h +++ b/libs/SDL2/include/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_keycode.h b/libs/SDL2/include/SDL_keycode.h old mode 100755 new mode 100644 index c41e45ff6..d7d5b1dbc --- a/libs/SDL2/include/SDL_keycode.h +++ b/libs/SDL2/include/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_loadso.h b/libs/SDL2/include/SDL_loadso.h old mode 100755 new mode 100644 index 6ea256c6a..da56fb452 --- a/libs/SDL2/include/SDL_loadso.h +++ b/libs/SDL2/include/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_log.h b/libs/SDL2/include/SDL_log.h old mode 100755 new mode 100644 index 356d0e1cf..e12b65886 --- a/libs/SDL2/include/SDL_log.h +++ b/libs/SDL2/include/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_main.h b/libs/SDL2/include/SDL_main.h old mode 100755 new mode 100644 index 2af32360f..98558217f --- a/libs/SDL2/include/SDL_main.h +++ b/libs/SDL2/include/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -63,10 +63,13 @@ /* On Android SDL provides a Java class in SDLActivity.java that is the main activity entry point. - See README-android.md for more details on extending that class. + See docs/README-android.md for more details on extending that class. */ #define SDL_MAIN_NEEDED +/* We need to export SDL_main so it can be launched from Java */ +#define SDLMAIN_DECLSPEC DECLSPEC + #elif defined(__NACL__) /* On NACL we use ppapi_simple to set up the application helper code, then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before @@ -85,6 +88,10 @@ #define C_LINKAGE #endif /* __cplusplus */ +#ifndef SDLMAIN_DECLSPEC +#define SDLMAIN_DECLSPEC +#endif + /** * \file SDL_main.h * @@ -107,7 +114,7 @@ /** * The prototype for the application's main() function */ -extern C_LINKAGE DECLSPEC int SDL_main(int argc, char *argv[]); +extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); #include "begin_code.h" diff --git a/libs/SDL2/include/SDL_messagebox.h b/libs/SDL2/include/SDL_messagebox.h old mode 100755 new mode 100644 index c326d8f01..b7be59d88 --- a/libs/SDL2/include/SDL_messagebox.h +++ b/libs/SDL2/include/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_mouse.h b/libs/SDL2/include/SDL_mouse.h old mode 100755 new mode 100644 index 6001bd46c..d3c9f6156 --- a/libs/SDL2/include/SDL_mouse.h +++ b/libs/SDL2/include/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_mutex.h b/libs/SDL2/include/SDL_mutex.h old mode 100755 new mode 100644 index 0272379e5..ba4247ced --- a/libs/SDL2/include/SDL_mutex.h +++ b/libs/SDL2/include/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_name.h b/libs/SDL2/include/SDL_name.h old mode 100755 new mode 100644 index 8095ed3ff..ecd863f4c --- a/libs/SDL2/include/SDL_name.h +++ b/libs/SDL2/include/SDL_name.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_opengl.h b/libs/SDL2/include/SDL_opengl.h old mode 100755 new mode 100644 index 314dd57ed..253d9c93a --- a/libs/SDL2/include/SDL_opengl.h +++ b/libs/SDL2/include/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_opengl_glext.h b/libs/SDL2/include/SDL_opengl_glext.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_opengles.h b/libs/SDL2/include/SDL_opengles.h old mode 100755 new mode 100644 index 800c59307..18dd984b3 --- a/libs/SDL2/include/SDL_opengles.h +++ b/libs/SDL2/include/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_opengles2.h b/libs/SDL2/include/SDL_opengles2.h old mode 100755 new mode 100644 index 102f2f3fa..6ccecf216 --- a/libs/SDL2/include/SDL_opengles2.h +++ b/libs/SDL2/include/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_opengles2_gl2.h b/libs/SDL2/include/SDL_opengles2_gl2.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_opengles2_gl2ext.h b/libs/SDL2/include/SDL_opengles2_gl2ext.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_opengles2_gl2platform.h b/libs/SDL2/include/SDL_opengles2_gl2platform.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_opengles2_khrplatform.h b/libs/SDL2/include/SDL_opengles2_khrplatform.h old mode 100755 new mode 100644 diff --git a/libs/SDL2/include/SDL_pixels.h b/libs/SDL2/include/SDL_pixels.h old mode 100755 new mode 100644 index 04246689f..0b4364b18 --- a/libs/SDL2/include/SDL_pixels.h +++ b/libs/SDL2/include/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -287,7 +287,9 @@ enum SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */ SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'), SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */ - SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1') + SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'), + SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */ + SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ') }; typedef struct SDL_Color diff --git a/libs/SDL2/include/SDL_platform.h b/libs/SDL2/include/SDL_platform.h old mode 100755 new mode 100644 index 9dde385fa..7dea4ce94 --- a/libs/SDL2/include/SDL_platform.h +++ b/libs/SDL2/include/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -121,7 +121,12 @@ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) /* Try to find out if we're compiling for WinRT or non-WinRT */ #if defined(_MSC_VER) && defined(__has_include) -#define HAVE_WINAPIFAMILY_H __has_include() +#if __has_include() +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + /* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ #elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ #define HAVE_WINAPIFAMILY_H 1 diff --git a/libs/SDL2/include/SDL_power.h b/libs/SDL2/include/SDL_power.h old mode 100755 new mode 100644 index d48e8a379..a4fe8a935 --- a/libs/SDL2/include/SDL_power.h +++ b/libs/SDL2/include/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_quit.h b/libs/SDL2/include/SDL_quit.h old mode 100755 new mode 100644 index 9283c3810..fea56a8d8 --- a/libs/SDL2/include/SDL_quit.h +++ b/libs/SDL2/include/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_rect.h b/libs/SDL2/include/SDL_rect.h old mode 100755 new mode 100644 index c4f6d74b3..543bb6186 --- a/libs/SDL2/include/SDL_rect.h +++ b/libs/SDL2/include/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_render.h b/libs/SDL2/include/SDL_render.h old mode 100755 new mode 100644 index ea6ef9ff6..d33619297 --- a/libs/SDL2/include/SDL_render.h +++ b/libs/SDL2/include/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -898,6 +898,27 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw */ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); +/** + * \brief Get the CAMetalLayer associated with the given Metal renderer + * + * \param renderer The renderer to query + * + * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalCommandEncoder() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer); + +/** + * \brief Get the Metal command encoder for the current frame + * + * \param renderer The renderer to query + * + * \return id on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalLayer() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/libs/SDL2/include/SDL_revision.h b/libs/SDL2/include/SDL_revision.h old mode 100755 new mode 100644 index 9376093ee..92fbe67b1 --- a/libs/SDL2/include/SDL_revision.h +++ b/libs/SDL2/include/SDL_revision.h @@ -1,2 +1,2 @@ -#define SDL_REVISION "hg-11645:2088cd828335" -#define SDL_REVISION_NUMBER 11645 +#define SDL_REVISION "hg-12373:8feb5da6f2fb" +#define SDL_REVISION_NUMBER 12373 diff --git a/libs/SDL2/include/SDL_rwops.h b/libs/SDL2/include/SDL_rwops.h old mode 100755 new mode 100644 index 7f0cbdfd5..0960699d4 --- a/libs/SDL2/include/SDL_rwops.h +++ b/libs/SDL2/include/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_scancode.h b/libs/SDL2/include/SDL_scancode.h old mode 100755 new mode 100644 index 1d5521204..63871aa3b --- a/libs/SDL2/include/SDL_scancode.h +++ b/libs/SDL2/include/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_sensor.h b/libs/SDL2/include/SDL_sensor.h new file mode 100644 index 000000000..ac163a8cd --- /dev/null +++ b/libs/SDL2/include/SDL_sensor.h @@ -0,0 +1,251 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + 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. + + 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 + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_sensor.h + * + * Include file for SDL sensor event handling + * + */ + +#ifndef _SDL_sensor_h +#define _SDL_sensor_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief SDL_sensor.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system + * for sensors, and load appropriate drivers. + */ + +struct _SDL_Sensor; +typedef struct _SDL_Sensor SDL_Sensor; + +/** + * This is a unique ID for a sensor for the time it is connected to the system, + * and is never reused for the lifetime of the application. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + */ +typedef Sint32 SDL_SensorID; + +/* The different sensors defined by SDL + * + * Additional sensors may be available, using platform dependent semantics. + * + * Hare are the additional Android sensors: + * https://developer.android.com/reference/android/hardware/SensorEvent.html#values + */ +typedef enum +{ + SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */ + SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */ + SDL_SENSOR_ACCEL, /**< Accelerometer */ + SDL_SENSOR_GYRO /**< Gyroscope */ +} SDL_SensorType; + +/** + * Accelerometer sensor + * + * The accelerometer returns the current acceleration in SI meters per + * second squared. This includes gravity, so a device at rest will have + * an acceleration of SDL_STANDARD_GRAVITY straight down. + * + * values[0]: Acceleration on the x axis + * values[1]: Acceleration on the y axis + * values[2]: Acceleration on the z axis + * + * For phones held in portrait mode, the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ +#define SDL_STANDARD_GRAVITY 9.80665f + +/** + * Gyroscope sensor + * + * The gyroscope returns the current rate of rotation in radians per second. + * The rotation is positive in the counter-clockwise direction. That is, + * an observer looking from a positive location on one of the axes would + * see positive rotation on that axis when it appeared to be rotating + * counter-clockwise. + * + * values[0]: Angular speed around the x axis + * values[1]: Angular speed around the y axis + * values[2]: Angular speed around the z axis + * + * For phones held in portrait mode, the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ + +/* Function prototypes */ + +/** + * \brief Count the number of sensors attached to the system right now + */ +extern DECLSPEC int SDLCALL SDL_NumSensors(void); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor name, or NULL if device_index is out of range. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if device_index is out of range. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if device_index is out of range. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index); + +/** + * \brief Open a sensor for use. + * + * The index passed as an argument refers to the N'th sensor on the system. + * + * \return A sensor identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index); + +/** + * Return the SDL_Sensor associated with an instance id. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * \return The sensor name, or NULL if the sensor is NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if the sensor is NULL. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor); + +/** + * Get the current state of an opened sensor. + * + * The number of values and interpretation of the data is sensor dependent. + * + * \param sensor The sensor to query + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * + * \return 0 or -1 if an error occurred. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values); + +/** + * Close a sensor previously opened with SDL_SensorOpen() + */ +extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor); + +/** + * Update the current state of the open sensors. + * + * This is called automatically by the event loop if sensor events are enabled. + * + * This needs to be called from the thread that initialized the sensor subsystem. + */ +extern DECLSPEC void SDLCALL SDL_SensorUpdate(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_sensor_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/include/SDL_shape.h b/libs/SDL2/include/SDL_shape.h old mode 100755 new mode 100644 index 9e492d93a..40a6baaae --- a/libs/SDL2/include/SDL_shape.h +++ b/libs/SDL2/include/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_stdinc.h b/libs/SDL2/include/SDL_stdinc.h old mode 100755 new mode 100644 index 72402299f..e373bc380 --- a/libs/SDL2/include/SDL_stdinc.h +++ b/libs/SDL2/include/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -86,6 +86,28 @@ #ifdef HAVE_FLOAT_H # include #endif +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__BORLANDC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) +#pragma alloca +# elif defined(__MRC__) +void *alloca(unsigned); +# else +char *alloca(); +# endif +#endif /** * The number of elements in an array. @@ -328,28 +350,6 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); extern "C" { #endif -#if defined(HAVE_ALLOCA) && !defined(alloca) -# if defined(HAVE_ALLOCA_H) -# include -# elif defined(__GNUC__) -# define alloca __builtin_alloca -# elif defined(_MSC_VER) -# include -# define alloca _alloca -# elif defined(__WATCOMC__) -# include -# elif defined(__BORLANDC__) -# include -# elif defined(__DMC__) -# include -# elif defined(__AIX__) -#pragma alloca -# elif defined(__MRC__) -void *alloca(unsigned); -# else -char *alloca(); -# endif -#endif #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) @@ -445,12 +445,12 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) #endif } - extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); +extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); @@ -501,18 +501,35 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size #endif extern DECLSPEC double SDLCALL SDL_acos(double x); +extern DECLSPEC float SDLCALL SDL_acosf(float x); extern DECLSPEC double SDLCALL SDL_asin(double x); +extern DECLSPEC float SDLCALL SDL_asinf(float x); extern DECLSPEC double SDLCALL SDL_atan(double x); +extern DECLSPEC float SDLCALL SDL_atanf(float x); extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); +extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y); extern DECLSPEC double SDLCALL SDL_ceil(double x); +extern DECLSPEC float SDLCALL SDL_ceilf(float x); extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); +extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y); extern DECLSPEC double SDLCALL SDL_cos(double x); extern DECLSPEC float SDLCALL SDL_cosf(float x); +extern DECLSPEC double SDLCALL SDL_exp(double x); +extern DECLSPEC float SDLCALL SDL_expf(float x); extern DECLSPEC double SDLCALL SDL_fabs(double x); +extern DECLSPEC float SDLCALL SDL_fabsf(float x); extern DECLSPEC double SDLCALL SDL_floor(double x); +extern DECLSPEC float SDLCALL SDL_floorf(float x); +extern DECLSPEC double SDLCALL SDL_fmod(double x, double y); +extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y); extern DECLSPEC double SDLCALL SDL_log(double x); +extern DECLSPEC float SDLCALL SDL_logf(float x); +extern DECLSPEC double SDLCALL SDL_log10(double x); +extern DECLSPEC float SDLCALL SDL_log10f(float x); extern DECLSPEC double SDLCALL SDL_pow(double x, double y); +extern DECLSPEC float SDLCALL SDL_powf(float x, float y); extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); +extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n); extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC float SDLCALL SDL_sinf(float x); extern DECLSPEC double SDLCALL SDL_sqrt(double x); diff --git a/libs/SDL2/include/SDL_surface.h b/libs/SDL2/include/SDL_surface.h old mode 100755 new mode 100644 index 510690c9c..730d49fc8 --- a/libs/SDL2/include/SDL_surface.h +++ b/libs/SDL2/include/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,6 +97,17 @@ typedef struct SDL_Surface typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, struct SDL_Surface * dst, SDL_Rect * dstrect); +/** + * \brief The formula used for converting between YUV and RGB + */ +typedef enum +{ + SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */ + SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */ + SDL_YUV_CONVERSION_BT709, /**< BT.709 */ + SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */ +} SDL_YUV_CONVERSION_MODE; + /** * Allocate and free an RGB surface. * @@ -237,6 +248,13 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key); +/** + * \brief Returns whether the surface has a color key + * + * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface); + /** * \brief Gets the color key (transparent pixel) in a blittable surface. * @@ -509,6 +527,20 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled (SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); +/** + * \brief Set the YUV conversion mode + */ +extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode); + +/** + * \brief Get the YUV conversion mode + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void); + +/** + * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/libs/SDL2/include/SDL_system.h b/libs/SDL2/include/SDL_system.h old mode 100755 new mode 100644 index eb069b33d..4dc372d6b --- a/libs/SDL2/include/SDL_system.h +++ b/libs/SDL2/include/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -76,6 +76,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a #endif /* __WIN32__ */ +/* Platform specific functions for Linux */ +#ifdef __LINUX__ + +/** + \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available. + + \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority); + +#endif /* __LINUX__ */ + /* Platform specific functions for iOS */ #if defined(__IPHONEOS__) && __IPHONEOS__ @@ -108,6 +120,26 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void); */ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); +/** + \brief Return true if the application is running on Android TV + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); + +/** + \brief Return true if the application is running on a Chromebook + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void); + +/** + \brief Return true is the application is running on a Samsung DeX docking station + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void); + +/** + \brief Trigger the Android system back button behavior. + */ +extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void); + /** See the official Android developer guide for more information: http://developer.android.com/guide/topics/data/data-storage.html @@ -169,6 +201,25 @@ typedef enum } SDL_WinRT_Path; +/** + * \brief WinRT Device Family + */ +typedef enum +{ + /** \brief Unknown family */ + SDL_WINRT_DEVICEFAMILY_UNKNOWN, + + /** \brief Desktop family*/ + SDL_WINRT_DEVICEFAMILY_DESKTOP, + + /** \brief Mobile family (for example smartphone) */ + SDL_WINRT_DEVICEFAMILY_MOBILE, + + /** \brief XBox family */ + SDL_WINRT_DEVICEFAMILY_XBOX, +} SDL_WinRT_DeviceFamily; + + /** * \brief Retrieves a WinRT defined path on the local file system * @@ -203,8 +254,20 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path */ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); +/** + * \brief Detects the device family of WinRT plattform on runtime + * + * \return Device family + */ +extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); + #endif /* __WINRT__ */ +/** + \brief Return true if the current device is a tablet. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/libs/SDL2/include/SDL_syswm.h b/libs/SDL2/include/SDL_syswm.h old mode 100755 new mode 100644 index 2d18afb6c..f1c4021cc --- a/libs/SDL2/include/SDL_syswm.h +++ b/libs/SDL2/include/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,12 +33,6 @@ #include "SDL_video.h" #include "SDL_version.h" -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - /** * \file SDL_syswm.h * @@ -110,6 +104,12 @@ typedef void *EGLSurface; #include "SDL_egl.h" #endif +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /** * These are the various supported windowing subsystems */ diff --git a/libs/SDL2/include/SDL_test.h b/libs/SDL2/include/SDL_test.h old mode 100755 new mode 100644 index f55afcb02..6cc373bf8 --- a/libs/SDL2/include/SDL_test.h +++ b/libs/SDL2/include/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_assert.h b/libs/SDL2/include/SDL_test_assert.h old mode 100755 new mode 100644 index 11d836394..1788d7a20 --- a/libs/SDL2/include/SDL_test_assert.h +++ b/libs/SDL2/include/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_common.h b/libs/SDL2/include/SDL_test_common.h old mode 100755 new mode 100644 index 24eeb32af..be2e6b2aa --- a/libs/SDL2/include/SDL_test_common.h +++ b/libs/SDL2/include/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_compare.h b/libs/SDL2/include/SDL_test_compare.h old mode 100755 new mode 100644 index 9f4c4587a..c22e447d8 --- a/libs/SDL2/include/SDL_test_compare.h +++ b/libs/SDL2/include/SDL_test_compare.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_crc32.h b/libs/SDL2/include/SDL_test_crc32.h old mode 100755 new mode 100644 index add480c34..3d235d074 --- a/libs/SDL2/include/SDL_test_crc32.h +++ b/libs/SDL2/include/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_font.h b/libs/SDL2/include/SDL_test_font.h old mode 100755 new mode 100644 index 58c9f9d5e..59cbdcad6 --- a/libs/SDL2/include/SDL_test_font.h +++ b/libs/SDL2/include/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_fuzzer.h b/libs/SDL2/include/SDL_test_fuzzer.h old mode 100755 new mode 100644 index 6cf05747a..8fcb9ebbf --- a/libs/SDL2/include/SDL_test_fuzzer.h +++ b/libs/SDL2/include/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_harness.h b/libs/SDL2/include/SDL_test_harness.h old mode 100755 new mode 100644 index 68c4bcb7c..8641e0a7e --- a/libs/SDL2/include/SDL_test_harness.h +++ b/libs/SDL2/include/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_images.h b/libs/SDL2/include/SDL_test_images.h old mode 100755 new mode 100644 index 683d2f8a6..9c4dd5b82 --- a/libs/SDL2/include/SDL_test_images.h +++ b/libs/SDL2/include/SDL_test_images.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_log.h b/libs/SDL2/include/SDL_test_log.h old mode 100755 new mode 100644 index 9f993fbbc..ebd44fb50 --- a/libs/SDL2/include/SDL_test_log.h +++ b/libs/SDL2/include/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_md5.h b/libs/SDL2/include/SDL_test_md5.h old mode 100755 new mode 100644 index 67ca7d1de..0e4105768 --- a/libs/SDL2/include/SDL_test_md5.h +++ b/libs/SDL2/include/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_memory.h b/libs/SDL2/include/SDL_test_memory.h old mode 100755 new mode 100644 index 43b67f521..4827ae6f2 --- a/libs/SDL2/include/SDL_test_memory.h +++ b/libs/SDL2/include/SDL_test_memory.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_test_random.h b/libs/SDL2/include/SDL_test_random.h old mode 100755 new mode 100644 index 2b01922c3..0eb414ff2 --- a/libs/SDL2/include/SDL_test_random.h +++ b/libs/SDL2/include/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_thread.h b/libs/SDL2/include/SDL_thread.h old mode 100755 new mode 100644 index d0f6575cd..554dd0b61 --- a/libs/SDL2/include/SDL_thread.h +++ b/libs/SDL2/include/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,12 +54,13 @@ typedef unsigned int SDL_TLSID; /** * The SDL thread priority. * - * \note On many systems you require special privileges to set high priority. + * \note On many systems you require special privileges to set high or time critical priority. */ typedef enum { SDL_THREAD_PRIORITY_LOW, SDL_THREAD_PRIORITY_NORMAL, - SDL_THREAD_PRIORITY_HIGH + SDL_THREAD_PRIORITY_HIGH, + SDL_THREAD_PRIORITY_TIME_CRITICAL } SDL_ThreadPriority; /** @@ -105,14 +106,24 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *), + const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); + + /** * Create a thread. */ #if defined(SDL_CreateThread) && SDL_DYNAMIC_API #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #endif #elif defined(__OS2__) @@ -132,15 +143,31 @@ extern DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); #if defined(SDL_CreateThread) && SDL_DYNAMIC_API #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) #endif #else +/** + * Create a thread with a default stack size. + * + * This is equivalent to calling: + * SDL_CreateThreadWithStackSize(fn, name, 0, data); + */ +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); + /** * Create a thread. * @@ -158,9 +185,17 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, * If a system imposes requirements, SDL will try to munge the string for * it (truncate, etc), but the original string contents will be available * from SDL_GetThreadName(). + * + * The size (in bytes) of the new stack can be specified. Zero means "use + * the system default" which might be wildly different between platforms + * (x86 Linux generally defaults to eight megabytes, an embedded device + * might be a few kilobytes instead). + * + * In SDL 2.1, stacksize will be folded into the original SDL_CreateThread + * function. */ extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data); #endif diff --git a/libs/SDL2/include/SDL_timer.h b/libs/SDL2/include/SDL_timer.h old mode 100755 new mode 100644 index 282625d3f..5600618ff --- a/libs/SDL2/include/SDL_timer.h +++ b/libs/SDL2/include/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_touch.h b/libs/SDL2/include/SDL_touch.h old mode 100755 new mode 100644 index db9e25ebd..f4075e79a --- a/libs/SDL2/include/SDL_touch.h +++ b/libs/SDL2/include/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_types.h b/libs/SDL2/include/SDL_types.h old mode 100755 new mode 100644 index 06ee80cb3..4ac248c8c --- a/libs/SDL2/include/SDL_types.h +++ b/libs/SDL2/include/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/SDL_version.h b/libs/SDL2/include/SDL_version.h old mode 100755 new mode 100644 index 5b4c40248..31443e149 --- a/libs/SDL2/include/SDL_version.h +++ b/libs/SDL2/include/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 7 +#define SDL_PATCHLEVEL 9 /** * \brief Macro to determine SDL version program was compiled against. diff --git a/libs/SDL2/include/SDL_video.h b/libs/SDL2/include/SDL_video.h old mode 100755 new mode 100644 index 6f6cda8b1..461f13805 --- a/libs/SDL2/include/SDL_video.h +++ b/libs/SDL2/include/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -110,7 +110,9 @@ typedef enum SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ - SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */ + SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported. + On macOS NSHighResolutionCapable must be set true in the + application's Info.plist for this to have any effect. */ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */ SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */ SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */ @@ -167,6 +169,24 @@ typedef enum SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */ } SDL_WindowEventID; +/** + * \brief Event subtype for display events + */ +typedef enum +{ + SDL_DISPLAYEVENT_NONE, /**< Never used */ + SDL_DISPLAYEVENT_ORIENTATION /**< Display orientation has changed to data1 */ +} SDL_DisplayEventID; + +typedef enum +{ + SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */ + SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */ + SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */ + SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */ + SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */ +} SDL_DisplayOrientation; + /** * \brief An opaque handle to an OpenGL context. */ @@ -314,18 +334,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex); */ extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); -/** - * \brief Get the dots/pixels-per-inch for a display - * - * \note Diagonal, horizontal and vertical DPI can all be optionally - * returned if the parameter is non-NULL. - * - * \return 0 on success, or -1 if no DPI information is available or the index is out of range. - * - * \sa SDL_GetNumVideoDisplays() - */ -extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi); - /** * \brief Get the usable desktop area represented by a display, with the * primary display located at 0,0 @@ -345,6 +353,27 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, fl */ extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect); +/** + * \brief Get the dots/pixels-per-inch for a display + * + * \note Diagonal, horizontal and vertical DPI can all be optionally + * returned if the parameter is non-NULL. + * + * \return 0 on success, or -1 if no DPI information is available or the index is out of range. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi); + +/** + * \brief Get the orientation of a display + * + * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int displayIndex); + /** * \brief Returns the number of available display modes. * @@ -470,7 +499,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); * If the window is created with any of the SDL_WINDOW_OPENGL or * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the - * corrensponding UnloadLibrary function is called by SDL_DestroyWindow(). + * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). * * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail. diff --git a/libs/SDL2/include/SDL_vulkan.h b/libs/SDL2/include/SDL_vulkan.h old mode 100755 new mode 100644 index 803b5feef..972cca4d7 --- a/libs/SDL2/include/SDL_vulkan.h +++ b/libs/SDL2/include/SDL_vulkan.h @@ -69,30 +69,43 @@ typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ * \brief Dynamically load a Vulkan loader library. * * \param [in] path The platform dependent Vulkan loader library name, or - * \c NULL to open the default Vulkan loader library. + * \c NULL. * * \return \c 0 on success, or \c -1 if the library couldn't be loaded. * - * This should be done after initializing the video driver, but before + * If \a path is NULL SDL will use the value of the environment variable + * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan + * loader library. + * + * This should be called after initializing the video driver, but before * creating any Vulkan windows. If no Vulkan loader library is loaded, the * default library will be loaded upon creation of the first Vulkan window. * - * \note If you specify a non-NULL \a path, you should retrieve all of the - * Vulkan functions used in your program from the dynamic library using + * \note It is fairly common for Vulkan applications to link with \a libvulkan + * instead of explicitly loading it at run time. This will work with + * SDL provided the application links to a dynamic library and both it + * and SDL use the same search path. + * + * \note If you specify a non-NULL \c path, an application should retrieve all + * of the Vulkan functions it uses from the dynamic library using * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee - * \a path points to the same vulkan loader library that you linked to. + * \c path points to the same vulkan loader library the application + * linked to. * * \note On Apple devices, if \a path is NULL, SDL will attempt to find * the vkGetInstanceProcAddr address within all the mach-o images of - * the current process. This is because the currently (v0.17.0) - * recommended MoltenVK (Vulkan on Metal) usage is as a static library. - * If it is not found then SDL will attempt to load \c libMoltenVK.dylib. - * Applications using the dylib alternative therefore do not need to do - * anything special when calling SDL. + * the current process. This is because it is fairly common for Vulkan + * applications to link with libvulkan (and historically MoltenVK was + * provided as a static library). If it is not found then, on macOS, SDL + * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, + * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order. + * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications + * using a dynamic framework or .dylib must ensure it is included in its + * application bundle. * - * \note On non-Apple devices, SDL requires you to either not link to the - * Vulkan loader or link to a dynamic library version. This limitation - * may be removed in a future version of SDL. + * \note On non-Apple devices, application linking with a static libvulkan is + * not supported. Either do not link to the Vulkan loader or link to a + * dynamic library version. * * \note This function will fail if there are no working Vulkan drivers * installed. @@ -122,11 +135,11 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * \brief Get the names of the Vulkan instance extensions needed to create * a surface with \c SDL_Vulkan_CreateSurface(). * - * \param [in] window Window for which the required Vulkan instance + * \param [in] \c NULL or window Window for which the required Vulkan instance * extensions should be retrieved - * \param [in,out] count pointer to an \c unsigned related to the number of + * \param [in,out] pCount pointer to an \c unsigned related to the number of * required Vulkan instance extensions - * \param [out] names \c NULL or a pointer to an array to be filled with the + * \param [out] pNames \c NULL or a pointer to an array to be filled with the * required Vulkan instance extensions * * \return \c SDL_TRUE on success, \c SDL_FALSE on error. @@ -140,6 +153,10 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * is smaller than the number of required extensions, \c SDL_FALSE will be * returned instead of \c SDL_TRUE, to indicate that not all the required * extensions were returned. + * + * \note If \c window is not NULL, it will be checked against its creation + * flags to ensure that the Vulkan flag is present. This parameter + * will be removed in a future major release. * * \note The returned list of extensions will contain \c VK_KHR_surface * and zero or more platform specific extensions @@ -147,12 +164,13 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * \note The extension names queried here must be enabled when calling * VkCreateInstance, otherwise surface creation will fail. * - * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag. + * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag + * or be \c NULL * * \code * unsigned int count; * // get count of required extensions - * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL)) + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL)) * handle_error(); * * static const char *const additionalExtensions[] = @@ -166,7 +184,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * handle_error(); * * // get names of required extensions - * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names)) + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names)) * handle_error(); * * // copy additional extensions after required extensions @@ -240,6 +258,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface( * platform with high-DPI support (Apple calls this "Retina"), and not disabled * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. * + * \note On macOS high-DPI support must be enabled for an application by + * setting NSHighResolutionCapable to true in its Info.plist. + * * \sa SDL_GetWindowSize() * \sa SDL_CreateWindow() */ diff --git a/libs/SDL2/include/begin_code.h b/libs/SDL2/include/begin_code.h old mode 100755 new mode 100644 index 5372d6f04..6c2106246 --- a/libs/SDL2/include/begin_code.h +++ b/libs/SDL2/include/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/include/close_code.h b/libs/SDL2/include/close_code.h old mode 100755 new mode 100644 index 2a352dbb9..b3b70a4c8 --- a/libs/SDL2/include/close_code.h +++ b/libs/SDL2/include/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/lib/x64/SDL2.dll b/libs/SDL2/lib/x64/SDL2.dll old mode 100755 new mode 100644 index 6776cdd89..934f8091c Binary files a/libs/SDL2/lib/x64/SDL2.dll and b/libs/SDL2/lib/x64/SDL2.dll differ diff --git a/libs/SDL2/lib/x64/SDL2.lib b/libs/SDL2/lib/x64/SDL2.lib old mode 100755 new mode 100644 index 42e5ee7d0..f4941ae0e Binary files a/libs/SDL2/lib/x64/SDL2.lib and b/libs/SDL2/lib/x64/SDL2.lib differ diff --git a/libs/SDL2/lib/x64/SDL2main.lib b/libs/SDL2/lib/x64/SDL2main.lib old mode 100755 new mode 100644 index 1f409a249..612994657 Binary files a/libs/SDL2/lib/x64/SDL2main.lib and b/libs/SDL2/lib/x64/SDL2main.lib differ diff --git a/libs/SDL2/lib/x64/SDL2test.lib b/libs/SDL2/lib/x64/SDL2test.lib old mode 100755 new mode 100644 index b54347ddc..5b0328280 Binary files a/libs/SDL2/lib/x64/SDL2test.lib and b/libs/SDL2/lib/x64/SDL2test.lib differ diff --git a/libs/SDL2/lib/x86/SDL2.dll b/libs/SDL2/lib/x86/SDL2.dll old mode 100755 new mode 100644 index c21f747c2..701779044 Binary files a/libs/SDL2/lib/x86/SDL2.dll and b/libs/SDL2/lib/x86/SDL2.dll differ diff --git a/libs/SDL2/lib/x86/SDL2.lib b/libs/SDL2/lib/x86/SDL2.lib old mode 100755 new mode 100644 index a36fab5a3..cef79017c Binary files a/libs/SDL2/lib/x86/SDL2.lib and b/libs/SDL2/lib/x86/SDL2.lib differ diff --git a/libs/SDL2/lib/x86/SDL2main.lib b/libs/SDL2/lib/x86/SDL2main.lib old mode 100755 new mode 100644 index 2080d5db5..55c40c7a0 Binary files a/libs/SDL2/lib/x86/SDL2main.lib and b/libs/SDL2/lib/x86/SDL2main.lib differ diff --git a/libs/SDL2/lib/x86/SDL2test.lib b/libs/SDL2/lib/x86/SDL2test.lib old mode 100755 new mode 100644 index c26c50f61..d7a395ff1 Binary files a/libs/SDL2/lib/x86/SDL2test.lib and b/libs/SDL2/lib/x86/SDL2test.lib differ diff --git a/libs/SDL2/test/CMakeLists.txt b/libs/SDL2/test/CMakeLists.txt new file mode 100644 index 000000000..3c25c5c7c --- /dev/null +++ b/libs/SDL2/test/CMakeLists.txt @@ -0,0 +1,122 @@ +cmake_minimum_required(VERSION 2.8.11) +project(SDL2 C) + +# Global settings for all of the test targets +# FIXME: is this wrong? +remove_definitions(-DUSING_GENERATED_CONFIG_H) +link_libraries(SDL2_test SDL2-static) + +# FIXME: Parent directory CMakeLists.txt only sets these for mingw/cygwin, +# but we need them for VS as well. +if(WINDOWS) + link_libraries(SDL2main) + add_definitions(-Dmain=SDL_main) +endif() + +add_executable(checkkeys checkkeys.c) +add_executable(loopwave loopwave.c) +add_executable(loopwavequeue loopwavequeue.c) +add_executable(testresample testresample.c) +add_executable(testaudioinfo testaudioinfo.c) + +file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c) +add_executable(testautomation ${TESTAUTOMATION_SOURCE_FILES}) + +add_executable(testmultiaudio testmultiaudio.c) +add_executable(testaudiohotplug testaudiohotplug.c) +add_executable(testaudiocapture testaudiocapture.c) +add_executable(testatomic testatomic.c) +add_executable(testintersections testintersections.c) +add_executable(testrelative testrelative.c) +add_executable(testhittesting testhittesting.c) +add_executable(testdraw2 testdraw2.c) +add_executable(testdrawchessboard testdrawchessboard.c) +add_executable(testdropfile testdropfile.c) +add_executable(testerror testerror.c) +add_executable(testfile testfile.c) +add_executable(testgamecontroller testgamecontroller.c) +add_executable(testgesture testgesture.c) +add_executable(testgl2 testgl2.c) +add_executable(testgles testgles.c) +add_executable(testgles2 testgles2.c) +add_executable(testhaptic testhaptic.c) +add_executable(testhotplug testhotplug.c) +add_executable(testrumble testrumble.c) +add_executable(testthread testthread.c) +add_executable(testiconv testiconv.c) +add_executable(testime testime.c) +add_executable(testjoystick testjoystick.c) +add_executable(testkeys testkeys.c) +add_executable(testloadso testloadso.c) +add_executable(testlock testlock.c) + +if(APPLE) + add_executable(testnative testnative.c + testnativecocoa.m + testnativex11.c) +elseif(WINDOWS) + add_executable(testnative testnative.c testnativew32.c) +elseif(UNIX) + add_executable(testnative testnative.c testnativex11.c) +endif() + +add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c) +add_executable(testplatform testplatform.c) +add_executable(testpower testpower.c) +add_executable(testfilesystem testfilesystem.c) +add_executable(testrendertarget testrendertarget.c) +add_executable(testscale testscale.c) +add_executable(testsem testsem.c) +add_executable(testshader testshader.c) +add_executable(testshape testshape.c) +add_executable(testsprite2 testsprite2.c) +add_executable(testspriteminimal testspriteminimal.c) +add_executable(teststreaming teststreaming.c) +add_executable(testtimer testtimer.c) +add_executable(testver testver.c) +add_executable(testviewport testviewport.c) +add_executable(testwm2 testwm2.c) +add_executable(testyuv testyuv.c testyuv_cvt.c) +add_executable(torturethread torturethread.c) +add_executable(testrendercopyex testrendercopyex.c) +add_executable(testmessage testmessage.c) +add_executable(testdisplayinfo testdisplayinfo.c) +add_executable(testqsort testqsort.c) +add_executable(testbounds testbounds.c) +add_executable(testcustomcursor testcustomcursor.c) +add_executable(controllermap controllermap.c) +add_executable(testvulkan testvulkan.c) + +# HACK: Dummy target to cause the resource files to be copied to the build directory. +# Need to make it an executable so we can use the TARGET_FILE_DIR generator expression. +# This is needed so they get copied to the correct Debug/Release subdirectory in Xcode. +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c "int main(int argc, const char **argv){ return 1; }\n") +add_executable(SDL2_test_resoureces ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c) + +file(GLOB RESOURCE_FILES *.bmp *.wav) +foreach(RESOURCE_FILE ${RESOURCE_FILES}) + add_custom_command(TARGET SDL2_test_resoureces POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $) +endforeach(RESOURCE_FILE) + +file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +# TODO: Might be easier to make all targets depend on the resources...? +add_dependencies(testscale SDL2_test_resoureces) +add_dependencies(testrendercopyex SDL2_test_resoureces) +add_dependencies(controllermap SDL2_test_resoureces) +add_dependencies(testyuv SDL2_test_resoureces) +add_dependencies(testgamecontroller SDL2_test_resoureces) +add_dependencies(testshape SDL2_test_resoureces) +add_dependencies(testshader SDL2_test_resoureces) +add_dependencies(testnative SDL2_test_resoureces) +add_dependencies(testspriteminimal SDL2_test_resoureces) +add_dependencies(testautomation SDL2_test_resoureces) +add_dependencies(testcustomcursor SDL2_test_resoureces) +add_dependencies(testrendertarget SDL2_test_resoureces) +add_dependencies(testsprite2 SDL2_test_resoureces) + +add_dependencies(loopwave SDL2_test_resoureces) +add_dependencies(loopwavequeue SDL2_test_resoureces) +add_dependencies(testresample SDL2_test_resoureces) +add_dependencies(testaudiohotplug SDL2_test_resoureces) +add_dependencies(testmultiaudio SDL2_test_resoureces) diff --git a/libs/SDL2/test/Makefile.in b/libs/SDL2/test/Makefile.in index 0ac70e923..9ddd6ffe7 100644 --- a/libs/SDL2/test/Makefile.in +++ b/libs/SDL2/test/Makefile.in @@ -9,19 +9,23 @@ LIBS = @LIBS@ TARGETS = \ checkkeys$(EXE) \ + controllermap$(EXE) \ loopwave$(EXE) \ loopwavequeue$(EXE) \ testatomic$(EXE) \ - testaudioinfo$(EXE) \ testaudiocapture$(EXE) \ + testaudiohotplug$(EXE) \ + testaudioinfo$(EXE) \ testautomation$(EXE) \ testbounds$(EXE) \ testcustomcursor$(EXE) \ + testdisplayinfo$(EXE) \ testdraw2$(EXE) \ testdrawchessboard$(EXE) \ testdropfile$(EXE) \ testerror$(EXE) \ testfile$(EXE) \ + testfilesystem$(EXE) \ testgamecontroller$(EXE) \ testgesture$(EXE) \ testgl2$(EXE) \ @@ -29,44 +33,42 @@ TARGETS = \ testgles2$(EXE) \ testhaptic$(EXE) \ testhittesting$(EXE) \ - testrumble$(EXE) \ testhotplug$(EXE) \ - testthread$(EXE) \ testiconv$(EXE) \ testime$(EXE) \ testintersections$(EXE) \ - testrelative$(EXE) \ testjoystick$(EXE) \ testkeys$(EXE) \ testloadso$(EXE) \ testlock$(EXE) \ + testmessage$(EXE) \ testmultiaudio$(EXE) \ - testaudiohotplug$(EXE) \ testnative$(EXE) \ testoverlay2$(EXE) \ testplatform$(EXE) \ testpower$(EXE) \ - testfilesystem$(EXE) \ + testqsort$(EXE) \ + testrelative$(EXE) \ + testrendercopyex$(EXE) \ testrendertarget$(EXE) \ testresample$(EXE) \ + testrumble$(EXE) \ testscale$(EXE) \ testsem$(EXE) \ + testsensor$(EXE) \ testshader$(EXE) \ testshape$(EXE) \ testsprite2$(EXE) \ testspriteminimal$(EXE) \ teststreaming$(EXE) \ + testthread$(EXE) \ testtimer$(EXE) \ testver$(EXE) \ testviewport$(EXE) \ - testwm2$(EXE) \ - torturethread$(EXE) \ - testrendercopyex$(EXE) \ - testmessage$(EXE) \ - testdisplayinfo$(EXE) \ - testqsort$(EXE) \ - controllermap$(EXE) \ testvulkan$(EXE) \ + testwm2$(EXE) \ + testyuv$(EXE) \ + torturethread$(EXE) \ all: Makefile $(TARGETS) copydatafiles @@ -218,7 +220,7 @@ endif endif endif -testoverlay2$(EXE): $(srcdir)/testoverlay2.c +testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testplatform$(EXE): $(srcdir)/testplatform.c @@ -239,6 +241,9 @@ testscale$(EXE): $(srcdir)/testscale.c testsem$(EXE): $(srcdir)/testsem.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testsensor$(EXE): $(srcdir)/testsensor.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + testshader$(EXE): $(srcdir)/testshader.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @GLLIB@ @MATHLIB@ @@ -266,6 +271,9 @@ testviewport$(EXE): $(srcdir)/testviewport.c testwm2$(EXE): $(srcdir)/testwm2.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testyuv$(EXE): $(srcdir)/testyuv.c $(srcdir)/testyuv_cvt.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + torturethread$(EXE): $(srcdir)/torturethread.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @@ -309,7 +317,10 @@ distclean: clean %.wav: $(srcdir)/%.wav cp $< $@ -copydatafiles: copybmpfiles copywavfiles +%.dat: $(srcdir)/%.dat + cp $< $@ + +copydatafiles: copybmpfiles copywavfiles copydatfiles .PHONY : copydatafiles copybmpfiles: $(foreach bmp,$(wildcard $(srcdir)/*.bmp),$(notdir $(bmp))) @@ -318,3 +329,6 @@ copybmpfiles: $(foreach bmp,$(wildcard $(srcdir)/*.bmp),$(notdir $(bmp))) copywavfiles: $(foreach wav,$(wildcard $(srcdir)/*.wav),$(notdir $(wav))) .PHONY : copywavfiles +copydatfiles: $(foreach dat,$(wildcard $(srcdir)/*.dat),$(notdir $(dat))) +.PHONY : copydatfiles + diff --git a/libs/SDL2/test/checkkeys.c b/libs/SDL2/test/checkkeys.c index 066c786d4..4452acaba 100644 --- a/libs/SDL2/test/checkkeys.c +++ b/libs/SDL2/test/checkkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/controllermap.c b/libs/SDL2/test/controllermap.c index c4fe5929c..2ca53518a 100644 --- a/libs/SDL2/test/controllermap.c +++ b/libs/SDL2/test/controllermap.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/loopwave.c b/libs/SDL2/test/loopwave.c index 63e199611..88d8fc871 100644 --- a/libs/SDL2/test/loopwave.c +++ b/libs/SDL2/test/loopwave.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/loopwavequeue.c b/libs/SDL2/test/loopwavequeue.c index 3dc7792f6..3f0a69e15 100644 --- a/libs/SDL2/test/loopwavequeue.c +++ b/libs/SDL2/test/loopwavequeue.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testatomic.c b/libs/SDL2/test/testatomic.c index f8dca9178..6af9d4bf6 100644 --- a/libs/SDL2/test/testatomic.c +++ b/libs/SDL2/test/testatomic.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testaudiocapture.c b/libs/SDL2/test/testaudiocapture.c index 3b7ea0b79..a418d123c 100644 --- a/libs/SDL2/test/testaudiocapture.c +++ b/libs/SDL2/test/testaudiocapture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testaudiohotplug.c b/libs/SDL2/test/testaudiohotplug.c index a72f91745..374cbb27b 100644 --- a/libs/SDL2/test/testaudiohotplug.c +++ b/libs/SDL2/test/testaudiohotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testaudioinfo.c b/libs/SDL2/test/testaudioinfo.c index c70b86b5e..adecce9b7 100644 --- a/libs/SDL2/test/testaudioinfo.c +++ b/libs/SDL2/test/testaudioinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testautomation.c b/libs/SDL2/test/testautomation.c index 9fd22be07..bb799ea43 100644 --- a/libs/SDL2/test/testautomation.c +++ b/libs/SDL2/test/testautomation.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testbounds.c b/libs/SDL2/test/testbounds.c index bc46cb823..764809446 100644 --- a/libs/SDL2/test/testbounds.c +++ b/libs/SDL2/test/testbounds.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testcustomcursor.c b/libs/SDL2/test/testcustomcursor.c index 59c6409db..469449818 100644 --- a/libs/SDL2/test/testcustomcursor.c +++ b/libs/SDL2/test/testcustomcursor.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,6 +73,24 @@ init_color_cursor(const char *file) SDL_Cursor *cursor = NULL; SDL_Surface *surface = SDL_LoadBMP(file); if (surface) { + if (surface->format->palette) { + SDL_SetColorKey(surface, 1, *(Uint8 *) surface->pixels); + } else { + switch (surface->format->BitsPerPixel) { + case 15: + SDL_SetColorKey(surface, 1, (*(Uint16 *)surface->pixels) & 0x00007FFF); + break; + case 16: + SDL_SetColorKey(surface, 1, *(Uint16 *)surface->pixels); + break; + case 24: + SDL_SetColorKey(surface, 1, (*(Uint32 *)surface->pixels) & 0x00FFFFFF); + break; + case 32: + SDL_SetColorKey(surface, 1, *(Uint32 *)surface->pixels); + break; + } + } cursor = SDL_CreateColorCursor(surface, 0, 0); SDL_FreeSurface(surface); } @@ -116,7 +134,9 @@ init_system_cursor(const char *image[]) static SDLTest_CommonState *state; int done; -SDL_Cursor *cursor = NULL; +static SDL_Cursor *cursors[1+SDL_NUM_SYSTEM_CURSORS]; +static int current_cursor; +static int show_cursor; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -134,6 +154,18 @@ loop() /* Check for events */ while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); + if (event.type == SDL_MOUSEBUTTONDOWN) { + if (event.button.button == SDL_BUTTON_LEFT) { + ++current_cursor; + if (current_cursor == SDL_arraysize(cursors)) { + current_cursor = 0; + } + SDL_SetCursor(cursors[current_cursor]); + } else { + show_cursor = !show_cursor; + SDL_ShowCursor(show_cursor); + } + } } for (i = 0; i < state->num_windows; ++i) { @@ -188,15 +220,22 @@ main(int argc, char *argv[]) } if (color_cursor) { - cursor = init_color_cursor(color_cursor); + cursors[0] = init_color_cursor(color_cursor); } else { - cursor = init_system_cursor(arrow); + cursors[0] = init_system_cursor(arrow); } - if (!cursor) { + if (!cursors[0]) { SDL_Log("Error, couldn't create cursor\n"); quit(2); } - SDL_SetCursor(cursor); + for (i = 0; i < SDL_NUM_SYSTEM_CURSORS; ++i) { + cursors[1+i] = SDL_CreateSystemCursor((SDL_SystemCursor)i); + if (!cursors[1+i]) { + SDL_Log("Error, couldn't create system cursor %d\n", i); + quit(2); + } + } + SDL_SetCursor(cursors[0]); /* Main render loop */ done = 0; @@ -208,9 +247,13 @@ main(int argc, char *argv[]) } #endif - SDL_FreeCursor(cursor); + for (i = 0; i < SDL_arraysize(cursors); ++i) { + SDL_FreeCursor(cursors[i]); + } quit(0); /* keep the compiler happy ... */ return(0); } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/test/testdisplayinfo.c b/libs/SDL2/test/testdisplayinfo.c index 51c19b010..0cc5fbdd7 100644 --- a/libs/SDL2/test/testdisplayinfo.c +++ b/libs/SDL2/test/testdisplayinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testdraw2.c b/libs/SDL2/test/testdraw2.c index 1472a3863..91ee7eea2 100644 --- a/libs/SDL2/test/testdraw2.c +++ b/libs/SDL2/test/testdraw2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testdrawchessboard.c b/libs/SDL2/test/testdrawchessboard.c index cef8621fc..3dd78e1ac 100644 --- a/libs/SDL2/test/testdrawchessboard.c +++ b/libs/SDL2/test/testdrawchessboard.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testdropfile.c b/libs/SDL2/test/testdropfile.c index b3cb17d9b..1c2a3f0e6 100644 --- a/libs/SDL2/test/testdropfile.c +++ b/libs/SDL2/test/testdropfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testerror.c b/libs/SDL2/test/testerror.c index 468f8a7fb..87fcab21b 100644 --- a/libs/SDL2/test/testerror.c +++ b/libs/SDL2/test/testerror.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testfile.c b/libs/SDL2/test/testfile.c index 23215ea27..e563d77be 100644 --- a/libs/SDL2/test/testfile.c +++ b/libs/SDL2/test/testfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testfilesystem.c b/libs/SDL2/test/testfilesystem.c index e8a3b3c36..ada4e864c 100644 --- a/libs/SDL2/test/testfilesystem.c +++ b/libs/SDL2/test/testfilesystem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testgamecontroller.c b/libs/SDL2/test/testgamecontroller.c index f586bfe22..c8616d7cd 100644 --- a/libs/SDL2/test/testgamecontroller.c +++ b/libs/SDL2/test/testgamecontroller.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -114,6 +114,11 @@ loop(void *arg) case SDL_CONTROLLERBUTTONDOWN: case SDL_CONTROLLERBUTTONUP: SDL_Log("Controller button %s %s\n", SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released"); + /* First button triggers a 0.5 second full strength rumble */ + if (event.type == SDL_CONTROLLERBUTTONDOWN && + event.cbutton.button == SDL_CONTROLLER_BUTTON_A) { + SDL_GameControllerRumble(gamecontroller, 0xFFFF, 0xFFFF, 500); + } break; case SDL_KEYDOWN: if (event.key.keysym.sym != SDLK_ESCAPE) { diff --git a/libs/SDL2/test/testgesture.c b/libs/SDL2/test/testgesture.c index f7db94fbe..f4b254a65 100644 --- a/libs/SDL2/test/testgesture.c +++ b/libs/SDL2/test/testgesture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testgl2.c b/libs/SDL2/test/testgl2.c index 114c14105..dd01d0e29 100644 --- a/libs/SDL2/test/testgl2.c +++ b/libs/SDL2/test/testgl2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testgles.c b/libs/SDL2/test/testgles.c index cb1da1407..96895da0f 100644 --- a/libs/SDL2/test/testgles.c +++ b/libs/SDL2/test/testgles.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testgles2.c b/libs/SDL2/test/testgles2.c index 282e0b611..c4578a5cc 100644 --- a/libs/SDL2/test/testgles2.c +++ b/libs/SDL2/test/testgles2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testhotplug.c b/libs/SDL2/test/testhotplug.c index 765ce2639..72c90e8d9 100644 --- a/libs/SDL2/test/testhotplug.c +++ b/libs/SDL2/test/testhotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testiconv.c b/libs/SDL2/test/testiconv.c index ff3b28c93..47e8c377a 100644 --- a/libs/SDL2/test/testiconv.c +++ b/libs/SDL2/test/testiconv.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testime.c b/libs/SDL2/test/testime.c index 32f80cd6b..77bb86962 100644 --- a/libs/SDL2/test/testime.c +++ b/libs/SDL2/test/testime.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testintersections.c b/libs/SDL2/test/testintersections.c index dcf1bc172..619df0640 100644 --- a/libs/SDL2/test/testintersections.c +++ b/libs/SDL2/test/testintersections.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testjoystick.c b/libs/SDL2/test/testjoystick.c index 50e5cc96e..bca749244 100644 --- a/libs/SDL2/test/testjoystick.c +++ b/libs/SDL2/test/testjoystick.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,6 +90,10 @@ loop(void *arg) case SDL_JOYBUTTONDOWN: SDL_Log("Joystick %d button %d down\n", event.jbutton.which, event.jbutton.button); + /* First button triggers a 0.5 second full strength rumble */ + if (event.jbutton.button == 0) { + SDL_JoystickRumble(joystick, 0xFFFF, 0xFFFF, 500); + } break; case SDL_JOYBUTTONUP: SDL_Log("Joystick %d button %d up\n", diff --git a/libs/SDL2/test/testkeys.c b/libs/SDL2/test/testkeys.c index 33649d229..73f880e13 100644 --- a/libs/SDL2/test/testkeys.c +++ b/libs/SDL2/test/testkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testloadso.c b/libs/SDL2/test/testloadso.c index 2dce11d6a..c6fa33106 100644 --- a/libs/SDL2/test/testloadso.c +++ b/libs/SDL2/test/testloadso.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testlock.c b/libs/SDL2/test/testlock.c index e79fcda96..8299a9a67 100644 --- a/libs/SDL2/test/testlock.c +++ b/libs/SDL2/test/testlock.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testmessage.c b/libs/SDL2/test/testmessage.c index 07d0b0309..8488d8eda 100644 --- a/libs/SDL2/test/testmessage.c +++ b/libs/SDL2/test/testmessage.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testmultiaudio.c b/libs/SDL2/test/testmultiaudio.c index 4bae3859c..52a4cac7d 100644 --- a/libs/SDL2/test/testmultiaudio.c +++ b/libs/SDL2/test/testmultiaudio.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testnative.c b/libs/SDL2/test/testnative.c index 83bc495df..674d9d3b4 100644 --- a/libs/SDL2/test/testnative.c +++ b/libs/SDL2/test/testnative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testnative.h b/libs/SDL2/test/testnative.h index b2ee5fa44..29d85fb32 100644 --- a/libs/SDL2/test/testnative.h +++ b/libs/SDL2/test/testnative.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testnativew32.c b/libs/SDL2/test/testnativew32.c index 7a27b127a..7e96bc697 100644 --- a/libs/SDL2/test/testnativew32.c +++ b/libs/SDL2/test/testnativew32.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testnativex11.c b/libs/SDL2/test/testnativex11.c index 8908d22ff..386c25e9e 100644 --- a/libs/SDL2/test/testnativex11.c +++ b/libs/SDL2/test/testnativex11.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testoverlay2.c b/libs/SDL2/test/testoverlay2.c index 2145c4d36..daf07d3e9 100644 --- a/libs/SDL2/test/testoverlay2.c +++ b/libs/SDL2/test/testoverlay2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -16,16 +16,14 @@ * * ********************************************************************************/ -#include -#include -#include - #ifdef __EMSCRIPTEN__ #include #endif #include "SDL.h" +#include "testyuv_cvt.h" + #define MOOSEPIC_W 64 #define MOOSEPIC_H 88 @@ -149,7 +147,6 @@ SDL_Renderer *renderer; int paused = 0; int i; SDL_bool done = SDL_FALSE; -Uint32 pixel_format = SDL_PIXELFORMAT_YV12; static int fpsdelay; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ @@ -160,91 +157,6 @@ quit(int rc) exit(rc); } -/* All RGB2YUV conversion code and some other parts of code has been taken from testoverlay.c */ - -/* NOTE: These RGB conversion functions are not intended for speed, - only as examples. -*/ - -void -RGBtoYUV(Uint8 * rgb, int *yuv, int monochrome, int luminance) -{ - if (monochrome) { -#if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); - yuv[1] = 128; - yuv[2] = 128; -#else - yuv[0] = (int)(0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; - yuv[1] = 128; - yuv[2] = 128; -#endif - } else { -#if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); - yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128); - yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128); -#else - yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; - yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]); - yuv[2] = 128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]); -#endif - } - - if (luminance != 100) { - yuv[0] = yuv[0] * luminance / 100; - if (yuv[0] > 255) - yuv[0] = 255; - } -} - -void -ConvertRGBtoYV12(Uint8 *rgb, Uint8 *out, int w, int h, - int monochrome, int luminance) -{ - int x, y; - int yuv[3]; - Uint8 *op[3]; - - op[0] = out; - op[1] = op[0] + w*h; - op[2] = op[1] + w*h/4; - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - RGBtoYUV(rgb, yuv, monochrome, luminance); - *(op[0]++) = yuv[0]; - if (x % 2 == 0 && y % 2 == 0) { - *(op[1]++) = yuv[2]; - *(op[2]++) = yuv[1]; - } - rgb += 3; - } - } -} - -void -ConvertRGBtoNV12(Uint8 *rgb, Uint8 *out, int w, int h, - int monochrome, int luminance) -{ - int x, y; - int yuv[3]; - Uint8 *op[2]; - - op[0] = out; - op[1] = op[0] + w*h; - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - RGBtoYUV(rgb, yuv, monochrome, luminance); - *(op[0]++) = yuv[0]; - if (x % 2 == 0 && y % 2 == 0) { - *(op[1]++) = yuv[1]; - *(op[1]++) = yuv[2]; - } - rgb += 3; - } - } -} - static void PrintUsage(char *argv0) { @@ -307,7 +219,7 @@ loop() if (!paused) { i = (i + 1) % MOOSEFRAMES_COUNT; - SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W*SDL_BYTESPERPIXEL(pixel_format)); + SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W); } SDL_RenderClear(renderer); SDL_RenderCopy(renderer, MooseTexture, NULL, &displayrect); @@ -329,11 +241,6 @@ main(int argc, char **argv) int j; int fps = 12; int nodelay = 0; -#ifdef TEST_NV12 - Uint32 pixel_format = SDL_PIXELFORMAT_NV12; -#else - Uint32 pixel_format = SDL_PIXELFORMAT_YV12; -#endif int scale = 5; /* Enable standard application logging */ @@ -347,7 +254,7 @@ main(int argc, char **argv) while (argc > 1) { if (strcmp(argv[1], "-fps") == 0) { if (argv[2]) { - fps = atoi(argv[2]); + fps = SDL_atoi(argv[2]); if (fps == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); @@ -371,7 +278,7 @@ main(int argc, char **argv) argc -= 1; } else if (strcmp(argv[1], "-scale") == 0) { if (argv[2]) { - scale = atoi(argv[2]); + scale = SDL_atoi(argv[2]); if (scale == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The -scale option requires an argument [from 1 to 50], default is 5.\n"); @@ -439,7 +346,7 @@ main(int argc, char **argv) quit(4); } - MooseTexture = SDL_CreateTexture(renderer, pixel_format, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); + MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); if (!MooseTexture) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); free(RawMooseData); @@ -461,17 +368,9 @@ main(int argc, char **argv) rgb[2] = MooseColors[frame[j]].b; rgb += 3; } - switch (pixel_format) { - case SDL_PIXELFORMAT_YV12: - ConvertRGBtoYV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100); - break; - case SDL_PIXELFORMAT_NV12: - ConvertRGBtoNV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100); - break; - default: - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unsupported pixel format\n"); - break; - } + ConvertRGBtoYUV(SDL_PIXELFORMAT_YV12, MooseFrameRGB, MOOSEPIC_W*3, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, + SDL_GetYUVConversionModeForResolution(MOOSEPIC_W, MOOSEPIC_H), + 0, 100); } free(RawMooseData); diff --git a/libs/SDL2/test/testplatform.c b/libs/SDL2/test/testplatform.c index 0cba8fe76..1c1d2dcd8 100644 --- a/libs/SDL2/test/testplatform.c +++ b/libs/SDL2/test/testplatform.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -380,6 +380,7 @@ TestCPUInfo(SDL_bool verbose) SDL_Log("SSE4.2 %s\n", SDL_HasSSE42()? "detected" : "not detected"); SDL_Log("AVX %s\n", SDL_HasAVX()? "detected" : "not detected"); SDL_Log("AVX2 %s\n", SDL_HasAVX2()? "detected" : "not detected"); + SDL_Log("AVX-512F %s\n", SDL_HasAVX512F()? "detected" : "not detected"); SDL_Log("NEON %s\n", SDL_HasNEON()? "detected" : "not detected"); SDL_Log("System RAM %d MB\n", SDL_GetSystemRAM()); } diff --git a/libs/SDL2/test/testpower.c b/libs/SDL2/test/testpower.c index 48d64f094..adb58832a 100644 --- a/libs/SDL2/test/testpower.c +++ b/libs/SDL2/test/testpower.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testqsort.c b/libs/SDL2/test/testqsort.c index 886753936..e83b0731e 100644 --- a/libs/SDL2/test/testqsort.c +++ b/libs/SDL2/test/testqsort.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testrelative.c b/libs/SDL2/test/testrelative.c index 5d2ab5d93..816329ff5 100644 --- a/libs/SDL2/test/testrelative.c +++ b/libs/SDL2/test/testrelative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testrendercopyex.c b/libs/SDL2/test/testrendercopyex.c index 72a54e649..209a35157 100644 --- a/libs/SDL2/test/testrendercopyex.c +++ b/libs/SDL2/test/testrendercopyex.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testrendertarget.c b/libs/SDL2/test/testrendertarget.c index ec21f2e43..7d24d8aea 100644 --- a/libs/SDL2/test/testrendertarget.c +++ b/libs/SDL2/test/testrendertarget.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testresample.c b/libs/SDL2/test/testresample.c index a54a47dcb..4234d9e45 100644 --- a/libs/SDL2/test/testresample.c +++ b/libs/SDL2/test/testresample.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -93,7 +93,7 @@ main(int argc, char **argv) SDL_WriteLE32(io, 0x45564157); /* WAVE */ SDL_WriteLE32(io, 0x20746D66); /* fmt */ SDL_WriteLE32(io, 16); /* chunk size */ - SDL_WriteLE16(io, 1); /* uncompressed */ + SDL_WriteLE16(io, SDL_AUDIO_ISFLOAT(spec.format) ? 3 : 1); /* uncompressed */ SDL_WriteLE16(io, cvtchans); /* channels */ SDL_WriteLE32(io, cvtfreq); /* sample rate */ SDL_WriteLE32(io, avgbytes); /* average bytes per second */ diff --git a/libs/SDL2/test/testrumble.c b/libs/SDL2/test/testrumble.c index a22c52ec2..908a6aafb 100644 --- a/libs/SDL2/test/testrumble.c +++ b/libs/SDL2/test/testrumble.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testscale.c b/libs/SDL2/test/testscale.c index 34451d6fc..e1b46fcc8 100644 --- a/libs/SDL2/test/testscale.c +++ b/libs/SDL2/test/testscale.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testsem.c b/libs/SDL2/test/testsem.c index 13438b1b6..884763e6a 100644 --- a/libs/SDL2/test/testsem.c +++ b/libs/SDL2/test/testsem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testsensor.c b/libs/SDL2/test/testsensor.c new file mode 100644 index 000000000..00bfd137d --- /dev/null +++ b/libs/SDL2/test/testsensor.c @@ -0,0 +1,117 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + 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. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +/* Simple test of the SDL sensor code */ + +#include "SDL.h" + +static const char *GetSensorTypeString(SDL_SensorType type) +{ + static char unknown_type[64]; + + switch (type) + { + case SDL_SENSOR_INVALID: + return "SDL_SENSOR_INVALID"; + case SDL_SENSOR_UNKNOWN: + return "SDL_SENSOR_UNKNOWN"; + case SDL_SENSOR_ACCEL: + return "SDL_SENSOR_ACCEL"; + case SDL_SENSOR_GYRO: + return "SDL_SENSOR_GYRO"; + default: + SDL_snprintf(unknown_type, sizeof(unknown_type), "UNKNOWN (%d)", type); + return unknown_type; + } +} + +static void HandleSensorEvent(SDL_SensorEvent *event) +{ + SDL_Sensor *sensor = SDL_SensorFromInstanceID(event->which); + if (!sensor) { + SDL_Log("Couldn't get sensor for sensor event\n"); + return; + } + + switch (SDL_SensorGetType(sensor)) { + case SDL_SENSOR_ACCEL: + SDL_Log("Accelerometer update: %.2f, %.2f, %.2f\n", event->data[0], event->data[1], event->data[2]); + break; + case SDL_SENSOR_GYRO: + SDL_Log("Gyro update: %.2f, %.2f, %.2f\n", event->data[0], event->data[1], event->data[2]); + break; + default: + SDL_Log("Sensor update for sensor type %s\n", GetSensorTypeString(SDL_SensorGetType(sensor))); + break; + } +} + +int +main(int argc, char **argv) +{ + int i; + int num_sensors, num_opened; + + /* Load the SDL library */ + if (SDL_Init(SDL_INIT_SENSOR) < 0) { + SDL_Log("Couldn't initialize SDL: %s\n", SDL_GetError()); + return (1); + } + + num_sensors = SDL_NumSensors(); + num_opened = 0; + + SDL_Log("There are %d sensors available\n", num_sensors); + for (i = 0; i < num_sensors; ++i) { + SDL_Log("Sensor %d: %s, type %s, platform type %d\n", + SDL_SensorGetDeviceInstanceID(i), + SDL_SensorGetDeviceName(i), + GetSensorTypeString(SDL_SensorGetDeviceType(i)), + SDL_SensorGetDeviceNonPortableType(i)); + + if (SDL_SensorGetDeviceType(i) != SDL_SENSOR_UNKNOWN) { + SDL_Sensor *sensor = SDL_SensorOpen(i); + if (sensor == NULL) { + SDL_Log("Couldn't open sensor %d: %s\n", SDL_SensorGetDeviceInstanceID(i), SDL_GetError()); + } else { + ++num_opened; + } + } + } + SDL_Log("Opened %d sensors\n", num_opened); + + if (num_opened > 0) { + SDL_bool done = SDL_FALSE; + SDL_Event event; + + SDL_CreateWindow("Sensor Test", 0, 0, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP); + while (!done) { + while (SDL_PollEvent(&event) > 0) { + switch (event.type) { + case SDL_SENSORUPDATE: + HandleSensorEvent(&event.sensor); + break; + case SDL_MOUSEBUTTONUP: + case SDL_KEYUP: + case SDL_QUIT: + done = SDL_TRUE; + break; + default: + break; + } + } + } + } + + SDL_Quit(); + return (0); +} diff --git a/libs/SDL2/test/testshader.c b/libs/SDL2/test/testshader.c index 1700da1cc..ee0ccdad2 100644 --- a/libs/SDL2/test/testshader.c +++ b/libs/SDL2/test/testshader.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testshape.c b/libs/SDL2/test/testshape.c index d54cc2265..7e451e667 100644 --- a/libs/SDL2/test/testshape.c +++ b/libs/SDL2/test/testshape.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testsprite2.c b/libs/SDL2/test/testsprite2.c index 14258f74c..b0348f85d 100644 --- a/libs/SDL2/test/testsprite2.c +++ b/libs/SDL2/test/testsprite2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testspriteminimal.c b/libs/SDL2/test/testspriteminimal.c index 478c58496..92560002a 100644 --- a/libs/SDL2/test/testspriteminimal.c +++ b/libs/SDL2/test/testspriteminimal.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/teststreaming.c b/libs/SDL2/test/teststreaming.c index 76a9fed18..7ec689106 100644 --- a/libs/SDL2/test/teststreaming.c +++ b/libs/SDL2/test/teststreaming.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testthread.c b/libs/SDL2/test/testthread.c index 6557b2fc7..4555a1e94 100644 --- a/libs/SDL2/test/testthread.c +++ b/libs/SDL2/test/testthread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ static SDL_TLSID tls; static int alive = 0; +static int testprio = 0; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -29,14 +30,37 @@ quit(int rc) exit(rc); } +static const char * +getprioritystr(SDL_ThreadPriority priority) +{ + switch(priority) + { + case SDL_THREAD_PRIORITY_LOW: return "SDL_THREAD_PRIORITY_LOW"; + case SDL_THREAD_PRIORITY_NORMAL: return "SDL_THREAD_PRIORITY_NORMAL"; + case SDL_THREAD_PRIORITY_HIGH: return "SDL_THREAD_PRIORITY_HIGH"; + case SDL_THREAD_PRIORITY_TIME_CRITICAL: return "SDL_THREAD_PRIORITY_TIME_CRITICAL"; + } + + return "???"; +} + int SDLCALL ThreadFunc(void *data) { + SDL_ThreadPriority prio = SDL_THREAD_PRIORITY_NORMAL; + SDL_TLSSet(tls, "baby thread", NULL); SDL_Log("Started thread %s: My thread id is %lu, thread data = %s\n", (char *) data, SDL_ThreadID(), (const char *)SDL_TLSGet(tls)); while (alive) { SDL_Log("Thread '%s' is alive!\n", (char *) data); + + if (testprio) { + SDL_Log("SDL_SetThreadPriority(%s):%d\n", getprioritystr(prio), SDL_SetThreadPriority(prio)); + if (++prio > SDL_THREAD_PRIORITY_TIME_CRITICAL) + prio = SDL_THREAD_PRIORITY_LOW; + } + SDL_Delay(1 * 1000); } SDL_Log("Thread '%s' exiting!\n", (char *) data); @@ -55,6 +79,7 @@ killed(int sig) int main(int argc, char *argv[]) { + int arg = 1; SDL_Thread *thread; /* Enable standard application logging */ @@ -66,6 +91,13 @@ main(int argc, char *argv[]) return (1); } + while (argv[arg] && *argv[arg] == '-') { + if (SDL_strcmp(argv[arg], "--prio") == 0) { + testprio = 1; + } + ++arg; + } + tls = SDL_TLSCreate(); SDL_assert(tls); SDL_TLSSet(tls, "main thread", NULL); diff --git a/libs/SDL2/test/testtimer.c b/libs/SDL2/test/testtimer.c index 261497be7..34764c1c9 100644 --- a/libs/SDL2/test/testtimer.c +++ b/libs/SDL2/test/testtimer.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testver.c b/libs/SDL2/test/testver.c index 04a7a9010..1ae008345 100644 --- a/libs/SDL2/test/testver.c +++ b/libs/SDL2/test/testver.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testviewport.c b/libs/SDL2/test/testviewport.c index f9d0bd5aa..4b8d20e76 100644 --- a/libs/SDL2/test/testviewport.c +++ b/libs/SDL2/test/testviewport.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/test/testvulkan.c b/libs/SDL2/test/testvulkan.c index 95cbec803..cd682af1f 100644 --- a/libs/SDL2/test/testvulkan.c +++ b/libs/SDL2/test/testvulkan.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -255,7 +255,7 @@ static void createInstance(void) appInfo.apiVersion = VK_API_VERSION_1_0; instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; instanceCreateInfo.pApplicationInfo = &appInfo; - if(!SDL_Vulkan_GetInstanceExtensions(state->windows[0], &extensionCount, NULL)) + if(!SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, NULL)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Vulkan_GetInstanceExtensions(): %s\n", @@ -268,7 +268,7 @@ static void createInstance(void) SDL_OutOfMemory(); quit(2); } - if(!SDL_Vulkan_GetInstanceExtensions(state->windows[0], &extensionCount, extensions)) + if(!SDL_Vulkan_GetInstanceExtensions(NULL, &extensionCount, extensions)) { SDL_free((void*)extensions); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, diff --git a/libs/SDL2/test/testwm2.c b/libs/SDL2/test/testwm2.c index ab3eea2f5..5da387309 100644 --- a/libs/SDL2/test/testwm2.c +++ b/libs/SDL2/test/testwm2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -146,6 +146,9 @@ main(int argc, char *argv[]) quit(2); } + SDL_EventState(SDL_DROPFILE, SDL_ENABLE); + SDL_EventState(SDL_DROPTEXT, SDL_ENABLE); + for (i = 0; i < state->num_windows; ++i) { SDL_Renderer *renderer = state->renderers[i]; SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); diff --git a/libs/SDL2/test/testyuv.bmp b/libs/SDL2/test/testyuv.bmp new file mode 100644 index 000000000..af32034b6 Binary files /dev/null and b/libs/SDL2/test/testyuv.bmp differ diff --git a/libs/SDL2/test/testyuv.c b/libs/SDL2/test/testyuv.c new file mode 100644 index 000000000..f52ab9f72 --- /dev/null +++ b/libs/SDL2/test/testyuv.c @@ -0,0 +1,455 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + 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. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +#include +#include +#include + +#include "SDL.h" +#include "SDL_test_font.h" +#include "testyuv_cvt.h" + + +/* 422 (YUY2, etc) formats are the largest */ +#define MAX_YUV_SURFACE_SIZE(W, H, P) (H*4*(W+P+1)/2) + + +/* Return true if the YUV format is packed pixels */ +static SDL_bool is_packed_yuv_format(Uint32 format) +{ + return (format == SDL_PIXELFORMAT_YUY2 || + format == SDL_PIXELFORMAT_UYVY || + format == SDL_PIXELFORMAT_YVYU); +} + +/* Create a surface with a good pattern for verifying YUV conversion */ +static SDL_Surface *generate_test_pattern(int pattern_size) +{ + SDL_Surface *pattern = SDL_CreateRGBSurfaceWithFormat(0, pattern_size, pattern_size, 0, SDL_PIXELFORMAT_RGB24); + + if (pattern) { + int i, x, y; + Uint8 *p, c; + const int thickness = 2; /* Important so 2x2 blocks of color are the same, to avoid Cr/Cb interpolation over pixels */ + + /* R, G, B in alternating horizontal bands */ + for (y = 0; y < pattern->h; y += thickness) { + for (i = 0; i < thickness; ++i) { + p = (Uint8 *)pattern->pixels + (y + i) * pattern->pitch + ((y/thickness) % 3); + for (x = 0; x < pattern->w; ++x) { + *p = 0xFF; + p += 3; + } + } + } + + /* Black and white in alternating vertical bands */ + c = 0xFF; + for (x = 1*thickness; x < pattern->w; x += 2*thickness) { + for (i = 0; i < thickness; ++i) { + p = (Uint8 *)pattern->pixels + (x + i)*3; + for (y = 0; y < pattern->h; ++y) { + SDL_memset(p, c, 3); + p += pattern->pitch; + } + } + if (c) { + c = 0x00; + } else { + c = 0xFF; + } + } + } + return pattern; +} + +static SDL_bool verify_yuv_data(Uint32 format, const Uint8 *yuv, int yuv_pitch, SDL_Surface *surface) +{ + const int tolerance = 20; + const int size = (surface->h * surface->pitch); + Uint8 *rgb; + SDL_bool result = SDL_FALSE; + + rgb = (Uint8 *)SDL_malloc(size); + if (!rgb) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory"); + return SDL_FALSE; + } + + if (SDL_ConvertPixels(surface->w, surface->h, format, yuv, yuv_pitch, surface->format->format, rgb, surface->pitch) == 0) { + int x, y; + result = SDL_TRUE; + for (y = 0; y < surface->h; ++y) { + const Uint8 *actual = rgb + y * surface->pitch; + const Uint8 *expected = (const Uint8 *)surface->pixels + y * surface->pitch; + for (x = 0; x < surface->w; ++x) { + int deltaR = (int)actual[0] - expected[0]; + int deltaG = (int)actual[1] - expected[1]; + int deltaB = (int)actual[2] - expected[2]; + int distance = (deltaR * deltaR + deltaG * deltaG + deltaB * deltaB); + if (distance > tolerance) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Pixel at %d,%d was 0x%.2x,0x%.2x,0x%.2x, expected 0x%.2x,0x%.2x,0x%.2x, distance = %d\n", x, y, actual[0], actual[1], actual[2], expected[0], expected[1], expected[2], distance); + result = SDL_FALSE; + } + actual += 3; + expected += 3; + } + } + } else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(format), SDL_GetPixelFormatName(surface->format->format), SDL_GetError()); + } + SDL_free(rgb); + + return result; +} + +static int run_automated_tests(int pattern_size, int extra_pitch) +{ + const Uint32 formats[] = { + SDL_PIXELFORMAT_YV12, + SDL_PIXELFORMAT_IYUV, + SDL_PIXELFORMAT_NV12, + SDL_PIXELFORMAT_NV21, + SDL_PIXELFORMAT_YUY2, + SDL_PIXELFORMAT_UYVY, + SDL_PIXELFORMAT_YVYU + }; + int i, j; + SDL_Surface *pattern = generate_test_pattern(pattern_size); + const int yuv_len = MAX_YUV_SURFACE_SIZE(pattern->w, pattern->h, extra_pitch); + Uint8 *yuv1 = (Uint8 *)SDL_malloc(yuv_len); + Uint8 *yuv2 = (Uint8 *)SDL_malloc(yuv_len); + int yuv1_pitch, yuv2_pitch; + int result = -1; + + if (!pattern || !yuv1 || !yuv2) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate test surfaces"); + goto done; + } + + /* Verify conversion from YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + if (!ConvertRGBtoYUV(formats[i], pattern->pixels, pattern->pitch, yuv1, pattern->w, pattern->h, SDL_GetYUVConversionModeForResolution(pattern->w, pattern->h), 0, 100)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ConvertRGBtoYUV() doesn't support converting to %s\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w); + if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to RGB\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + } + + /* Verify conversion to YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from RGB to %s\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + } + + /* Verify conversion between YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + for (j = 0; j < SDL_arraysize(formats); ++j) { + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv2, yuv2_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[j], yuv2, yuv2_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); + goto done; + } + } + } + + /* Verify conversion between YUV formats in-place */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + for (j = 0; j < SDL_arraysize(formats); ++j) { + if (is_packed_yuv_format(formats[i]) != is_packed_yuv_format(formats[j])) { + /* Can't change plane vs packed pixel layout in-place */ + continue; + } + + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv1, yuv2_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[j], yuv1, yuv2_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); + goto done; + } + } + } + + + result = 0; + +done: + SDL_free(yuv1); + SDL_free(yuv2); + SDL_FreeSurface(pattern); + return result; +} + +int +main(int argc, char **argv) +{ + struct { + SDL_bool enable_intrinsics; + int pattern_size; + int extra_pitch; + } automated_test_params[] = { + /* Test: even width and height */ + { SDL_FALSE, 2, 0 }, + { SDL_FALSE, 4, 0 }, + /* Test: odd width and height */ + { SDL_FALSE, 1, 0 }, + { SDL_FALSE, 3, 0 }, + /* Test: even width and height, extra pitch */ + { SDL_FALSE, 2, 3 }, + { SDL_FALSE, 4, 3 }, + /* Test: odd width and height, extra pitch */ + { SDL_FALSE, 1, 3 }, + { SDL_FALSE, 3, 3 }, + /* Test: even width and height with intrinsics */ + { SDL_TRUE, 32, 0 }, + /* Test: odd width and height with intrinsics */ + { SDL_TRUE, 33, 0 }, + { SDL_TRUE, 37, 0 }, + /* Test: even width and height with intrinsics, extra pitch */ + { SDL_TRUE, 32, 3 }, + /* Test: odd width and height with intrinsics, extra pitch */ + { SDL_TRUE, 33, 3 }, + { SDL_TRUE, 37, 3 }, + }; + int arg = 1; + const char *filename; + SDL_Surface *original; + SDL_Surface *converted; + SDL_Window *window; + SDL_Renderer *renderer; + SDL_Texture *output[3]; + const char *titles[3] = { "ORIGINAL", "SOFTWARE", "HARDWARE" }; + char title[128]; + const char *yuv_name; + const char *yuv_mode; + Uint32 rgb_format = SDL_PIXELFORMAT_RGBX8888; + Uint32 yuv_format = SDL_PIXELFORMAT_YV12; + int current = 0; + int pitch; + Uint8 *raw_yuv; + Uint32 then, now, i, iterations = 100; + SDL_bool should_run_automated_tests = SDL_FALSE; + + while (argv[arg] && *argv[arg] == '-') { + if (SDL_strcmp(argv[arg], "--jpeg") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_JPEG); + } else if (SDL_strcmp(argv[arg], "--bt601") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT601); + } else if (SDL_strcmp(argv[arg], "--bt709") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT709); + } else if (SDL_strcmp(argv[arg], "--auto") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_AUTOMATIC); + } else if (SDL_strcmp(argv[arg], "--yv12") == 0) { + yuv_format = SDL_PIXELFORMAT_YV12; + } else if (SDL_strcmp(argv[arg], "--iyuv") == 0) { + yuv_format = SDL_PIXELFORMAT_IYUV; + } else if (SDL_strcmp(argv[arg], "--yuy2") == 0) { + yuv_format = SDL_PIXELFORMAT_YUY2; + } else if (SDL_strcmp(argv[arg], "--uyvy") == 0) { + yuv_format = SDL_PIXELFORMAT_UYVY; + } else if (SDL_strcmp(argv[arg], "--yvyu") == 0) { + yuv_format = SDL_PIXELFORMAT_YVYU; + } else if (SDL_strcmp(argv[arg], "--nv12") == 0) { + yuv_format = SDL_PIXELFORMAT_NV12; + } else if (SDL_strcmp(argv[arg], "--nv21") == 0) { + yuv_format = SDL_PIXELFORMAT_NV21; + } else if (SDL_strcmp(argv[arg], "--rgb555") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB555; + } else if (SDL_strcmp(argv[arg], "--rgb565") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB565; + } else if (SDL_strcmp(argv[arg], "--rgb24") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB24; + } else if (SDL_strcmp(argv[arg], "--argb") == 0) { + rgb_format = SDL_PIXELFORMAT_ARGB8888; + } else if (SDL_strcmp(argv[arg], "--abgr") == 0) { + rgb_format = SDL_PIXELFORMAT_ABGR8888; + } else if (SDL_strcmp(argv[arg], "--rgba") == 0) { + rgb_format = SDL_PIXELFORMAT_RGBA8888; + } else if (SDL_strcmp(argv[arg], "--bgra") == 0) { + rgb_format = SDL_PIXELFORMAT_BGRA8888; + } else if (SDL_strcmp(argv[arg], "--automated") == 0) { + should_run_automated_tests = SDL_TRUE; + } else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Usage: %s [--jpeg|--bt601|-bt709|--auto] [--yv12|--iyuv|--yuy2|--uyvy|--yvyu|--nv12|--nv21] [--rgb555|--rgb565|--rgb24|--argb|--abgr|--rgba|--bgra] [image_filename]\n", argv[0]); + return 1; + } + ++arg; + } + + /* Run automated tests */ + if (should_run_automated_tests) { + for (i = 0; i < SDL_arraysize(automated_test_params); ++i) { + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Running automated test, pattern size %d, extra pitch %d, intrinsics %s\n", + automated_test_params[i].pattern_size, + automated_test_params[i].extra_pitch, + automated_test_params[i].enable_intrinsics ? "enabled" : "disabled"); + if (run_automated_tests(automated_test_params[i].pattern_size, automated_test_params[i].extra_pitch) < 0) { + return 2; + } + } + return 0; + } + + if (argv[arg]) { + filename = argv[arg]; + } else { + filename = "testyuv.bmp"; + } + original = SDL_ConvertSurfaceFormat(SDL_LoadBMP(filename), SDL_PIXELFORMAT_RGB24, 0); + if (!original) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); + return 3; + } + + raw_yuv = SDL_calloc(1, MAX_YUV_SURFACE_SIZE(original->w, original->h, 0)); + ConvertRGBtoYUV(yuv_format, original->pixels, original->pitch, raw_yuv, original->w, original->h, + SDL_GetYUVConversionModeForResolution(original->w, original->h), + 0, 100); + pitch = CalculateYUVPitch(yuv_format, original->w); + + converted = SDL_CreateRGBSurfaceWithFormat(0, original->w, original->h, 0, rgb_format); + if (!converted) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError()); + return 3; + } + + then = SDL_GetTicks(); + for ( i = 0; i < iterations; ++i ) { + SDL_ConvertPixels(original->w, original->h, yuv_format, raw_yuv, pitch, rgb_format, converted->pixels, converted->pitch); + } + now = SDL_GetTicks(); + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%d iterations in %d ms, %.2fms each\n", iterations, (now - then), (float)(now - then)/iterations); + + window = SDL_CreateWindow("YUV test", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + original->w, original->h, + 0); + if (!window) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); + return 4; + } + + renderer = SDL_CreateRenderer(window, -1, 0); + if (!renderer) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); + return 4; + } + + output[0] = SDL_CreateTextureFromSurface(renderer, original); + output[1] = SDL_CreateTextureFromSurface(renderer, converted); + output[2] = SDL_CreateTexture(renderer, yuv_format, SDL_TEXTUREACCESS_STREAMING, original->w, original->h); + if (!output[0] || !output[1] || !output[2]) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); + return 5; + } + SDL_UpdateTexture(output[2], NULL, raw_yuv, pitch); + + yuv_name = SDL_GetPixelFormatName(yuv_format); + if (SDL_strncmp(yuv_name, "SDL_PIXELFORMAT_", 16) == 0) { + yuv_name += 16; + } + + switch (SDL_GetYUVConversionModeForResolution(original->w, original->h)) { + case SDL_YUV_CONVERSION_JPEG: + yuv_mode = "JPEG"; + break; + case SDL_YUV_CONVERSION_BT601: + yuv_mode = "BT.601"; + break; + case SDL_YUV_CONVERSION_BT709: + yuv_mode = "BT.709"; + break; + default: + yuv_mode = "UNKNOWN"; + break; + } + + { int done = 0; + while ( !done ) + { + SDL_Event event; + while (SDL_PollEvent(&event) > 0) { + if (event.type == SDL_QUIT) { + done = 1; + } + if (event.type == SDL_KEYDOWN) { + if (event.key.keysym.sym == SDLK_ESCAPE) { + done = 1; + } else if (event.key.keysym.sym == SDLK_LEFT) { + --current; + } else if (event.key.keysym.sym == SDLK_RIGHT) { + ++current; + } + } + if (event.type == SDL_MOUSEBUTTONDOWN) { + if (event.button.x < (original->w/2)) { + --current; + } else { + ++current; + } + } + } + + /* Handle wrapping */ + if (current < 0) { + current += SDL_arraysize(output); + } + if (current >= SDL_arraysize(output)) { + current -= SDL_arraysize(output); + } + + SDL_RenderClear(renderer); + SDL_RenderCopy(renderer, output[current], NULL, NULL); + SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); + if (current == 0) { + SDLTest_DrawString(renderer, 4, 4, titles[current]); + } else { + SDL_snprintf(title, sizeof(title), "%s %s %s", titles[current], yuv_name, yuv_mode); + SDLTest_DrawString(renderer, 4, 4, title); + } + SDL_RenderPresent(renderer); + SDL_Delay(10); + } + } + SDL_Quit(); + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/test/testyuv_cvt.c b/libs/SDL2/test/testyuv_cvt.c new file mode 100644 index 000000000..553a3fa18 --- /dev/null +++ b/libs/SDL2/test/testyuv_cvt.c @@ -0,0 +1,300 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + 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. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include "SDL.h" + +#include "testyuv_cvt.h" + + +static float clip3(float x, float y, float z) +{ + return ((z < x) ? x : ((z > y) ? y : z)); +} + +static void RGBtoYUV(Uint8 * rgb, int *yuv, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + if (mode == SDL_YUV_CONVERSION_JPEG) { + /* Full range YUV */ + yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); + yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128); + yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128); + } else { + // This formula is from Microsoft's documentation: + // https://msdn.microsoft.com/en-us/library/windows/desktop/dd206750(v=vs.85).aspx + // L = Kr * R + Kb * B + (1 - Kr - Kb) * G + // Y = floor(2^(M-8) * (219*(L-Z)/S + 16) + 0.5); + // U = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(B-L) / ((1-Kb)*S) + 128) + 0.5)); + // V = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(R-L) / ((1-Kr)*S) + 128) + 0.5)); + float S, Z, R, G, B, L, Kr, Kb, Y, U, V; + + if (mode == SDL_YUV_CONVERSION_BT709) { + /* BT.709 */ + Kr = 0.2126f; + Kb = 0.0722f; + } else { + /* BT.601 */ + Kr = 0.299f; + Kb = 0.114f; + } + + S = 255.0f; + Z = 0.0f; + R = rgb[0]; + G = rgb[1]; + B = rgb[2]; + L = Kr * R + Kb * B + (1 - Kr - Kb) * G; + Y = (Uint8)SDL_floorf((219*(L-Z)/S + 16) + 0.5f); + U = (Uint8)clip3(0, 255, SDL_floorf((112.0f*(B-L) / ((1.0f-Kb)*S) + 128) + 0.5f)); + V = (Uint8)clip3(0, 255, SDL_floorf((112.0f*(R-L) / ((1.0f-Kr)*S) + 128) + 0.5f)); + + yuv[0] = (Uint8)Y; + yuv[1] = (Uint8)U; + yuv[2] = (Uint8)V; + } + + if (monochrome) { + yuv[1] = 128; + yuv[2] = 128; + } + + if (luminance != 100) { + yuv[0] = yuv[0] * luminance / 100; + if (yuv[0] > 255) + yuv[0] = 255; + } +} + +static void ConvertRGBtoPlanar2x2(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + int x, y; + int yuv[4][3]; + Uint8 *Y1, *Y2, *U, *V; + Uint8 *rgb1, *rgb2; + int rgb_row_advance = (pitch - w*3) + pitch; + int UV_advance; + + rgb1 = src; + rgb2 = src + pitch; + + Y1 = out; + Y2 = Y1 + w; + switch (format) { + case SDL_PIXELFORMAT_YV12: + V = (Y1 + h * w); + U = V + ((h + 1)/2)*((w + 1)/2); + UV_advance = 1; + break; + case SDL_PIXELFORMAT_IYUV: + U = (Y1 + h * w); + V = U + ((h + 1)/2)*((w + 1)/2); + UV_advance = 1; + break; + case SDL_PIXELFORMAT_NV12: + U = (Y1 + h * w); + V = U + 1; + UV_advance = 2; + break; + case SDL_PIXELFORMAT_NV21: + V = (Y1 + h * w); + U = V + 1; + UV_advance = 2; + break; + default: + SDL_assert(!"Unsupported planar YUV format"); + return; + } + + for (y = 0; y < (h - 1); y += 2) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb1, yuv[1], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[1][0]; + + RGBtoYUV(rgb2, yuv[2], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[2][0]; + + RGBtoYUV(rgb2, yuv[3], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[3][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1] + yuv[2][1] + yuv[3][1])/4.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2] + yuv[2][2] + yuv[3][2])/4.0f + 0.5f); + V += UV_advance; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb2, yuv[2], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[2][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[2][1])/2.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[2][2])/2.0f + 0.5f); + V += UV_advance; + } + Y1 += w; + Y2 += w; + rgb1 += rgb_row_advance; + rgb2 += rgb_row_advance; + } + /* Last row */ + if (y == (h - 1)) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb1, yuv[1], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[1][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1])/2.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2])/2.0f + 0.5f); + V += UV_advance; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + *Y1++ = (Uint8)yuv[0][0]; + + *U = (Uint8)yuv[0][1]; + U += UV_advance; + + *V = (Uint8)yuv[0][2]; + V += UV_advance; + } + } +} + +static void ConvertRGBtoPacked4(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + int x, y; + int yuv[2][3]; + Uint8 *Y1, *Y2, *U, *V; + Uint8 *rgb; + int rgb_row_advance = (pitch - w*3); + + rgb = src; + + switch (format) { + case SDL_PIXELFORMAT_YUY2: + Y1 = out; + U = out+1; + Y2 = out+2; + V = out+3; + break; + case SDL_PIXELFORMAT_UYVY: + U = out; + Y1 = out+1; + V = out+2; + Y2 = out+3; + break; + case SDL_PIXELFORMAT_YVYU: + Y1 = out; + V = out+1; + Y2 = out+2; + U = out+3; + break; + default: + SDL_assert(!"Unsupported packed YUV format"); + return; + } + + for (y = 0; y < h; ++y) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb, yuv[0], mode, monochrome, luminance); + rgb += 3; + *Y1 = (Uint8)yuv[0][0]; + Y1 += 4; + + RGBtoYUV(rgb, yuv[1], mode, monochrome, luminance); + rgb += 3; + *Y2 = (Uint8)yuv[1][0]; + Y2 += 4; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1])/2.0f + 0.5f); + U += 4; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2])/2.0f + 0.5f); + V += 4; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb, yuv[0], mode, monochrome, luminance); + rgb += 3; + *Y2 = *Y1 = (Uint8)yuv[0][0]; + Y1 += 4; + Y2 += 4; + + *U = (Uint8)yuv[0][1]; + U += 4; + + *V = (Uint8)yuv[0][2]; + V += 4; + } + rgb += rgb_row_advance; + } +} + +SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + switch (format) + { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + ConvertRGBtoPlanar2x2(format, src, pitch, out, w, h, mode, monochrome, luminance); + return SDL_TRUE; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + ConvertRGBtoPacked4(format, src, pitch, out, w, h, mode, monochrome, luminance); + return SDL_TRUE; + default: + return SDL_FALSE; + } +} + +int CalculateYUVPitch(Uint32 format, int width) +{ + switch (format) + { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + return width; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + return 4*((width + 1)/2); + default: + return 0; + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/test/testyuv_cvt.h b/libs/SDL2/test/testyuv_cvt.h new file mode 100644 index 000000000..bd845878f --- /dev/null +++ b/libs/SDL2/test/testyuv_cvt.h @@ -0,0 +1,16 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + 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. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +/* These functions are designed for testing correctness, not for speed */ + +extern SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance); +extern int CalculateYUVPitch(Uint32 format, int width); diff --git a/libs/SDL2/test/torturethread.c b/libs/SDL2/test/torturethread.c index 4c2679b8e..9b1a407ee 100644 --- a/libs/SDL2/test/torturethread.c +++ b/libs/SDL2/test/torturethread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/bin/SDL2.dll b/libs/SDL2/x86_64-w64-mingw32/bin/SDL2.dll index 6776cdd89..934f8091c 100755 Binary files a/libs/SDL2/x86_64-w64-mingw32/bin/SDL2.dll and b/libs/SDL2/x86_64-w64-mingw32/bin/SDL2.dll differ diff --git a/libs/SDL2/x86_64-w64-mingw32/bin/sdl2-config b/libs/SDL2/x86_64-w64-mingw32/bin/sdl2-config index 34d3cb877..9809f6002 100755 --- a/libs/SDL2/x86_64-w64-mingw32/bin/sdl2-config +++ b/libs/SDL2/x86_64-w64-mingw32/bin/sdl2-config @@ -1,6 +1,6 @@ #!/bin/sh -prefix=/usr/local/x86_64-w64-mingw32 +prefix=/opt/local/x86_64-w64-mingw32 exec_prefix=${prefix} exec_prefix_set=no libdir=${exec_prefix}/lib @@ -39,17 +39,17 @@ while test $# -gt 0; do echo $exec_prefix ;; --version) - echo 2.0.7 + echo 2.0.9 ;; --cflags) echo -I${prefix}/include/SDL2 -Dmain=SDL_main ;; --libs) - echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows + echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows ;; --static-libs) # --libs|--static-libs) - echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc + echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc ;; *) echo "${usage}" 1>&2 diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL.h index 366d50fa3..fc35a419e 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,6 +51,7 @@ #include "SDL_power.h" #include "SDL_render.h" #include "SDL_rwops.h" +#include "SDL_sensor.h" #include "SDL_shape.h" #include "SDL_system.h" #include "SDL_thread.h" @@ -80,10 +81,11 @@ extern "C" { #define SDL_INIT_HAPTIC 0x00001000u #define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ #define SDL_INIT_EVENTS 0x00004000u +#define SDL_INIT_SENSOR 0x00008000u #define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */ #define SDL_INIT_EVERYTHING ( \ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ - SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ + SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \ ) /* @} */ diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_assert.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_assert.h index 90abbe39b..b38f928ae 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_assert.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_atomic.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_atomic.h index 36e37f3b7..b2287748c 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_atomic.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -158,6 +158,9 @@ extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") +#elif defined(__GNUC__) && defined(__aarch64__) +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__GNUC__) && defined(__arm__) #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_audio.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_audio.h index f119c2b26..d3e1bface 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_audio.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -140,7 +140,8 @@ typedef Uint16 SDL_AudioFormat; #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 #define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 -#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) +#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008 +#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE) /* @} */ /* @} *//* Audio flags */ @@ -527,7 +528,7 @@ extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioForm * * \param stream The stream the audio data is being added to * \param buf A pointer to the audio data to add - * \param int The number of bytes to write to the stream + * \param len The number of bytes to write to the stream * \return 0 on success, or -1 on error. * * \sa SDL_NewAudioStream diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_bits.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_bits.h index bc2857290..eb8322f0d 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_bits.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_bits.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_blendmode.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_blendmode.h index 9abd0bd4c..36a5ea76f 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_blendmode.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_blendmode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_clipboard.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_clipboard.h index 341f4ba42..f28751ebb 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_clipboard.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_config.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_config.h index 1bbb83848..c58be8e72 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_config.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_config.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -82,6 +82,9 @@ typedef unsigned int uintptr_t; #define HAVE_DSOUND_H 1 #define HAVE_DXGI_H 1 #define HAVE_XINPUT_H 1 +#define HAVE_MMDEVICEAPI_H 1 +#define HAVE_AUDIOCLIENT_H 1 +#define HAVE_ENDPOINTVOLUME_H 1 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */ #ifdef HAVE_LIBC @@ -109,13 +112,15 @@ typedef unsigned int uintptr_t; #define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 #define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__ULTOA */ #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 #define HAVE_STRTOD 1 @@ -125,30 +130,45 @@ typedef unsigned int uintptr_t; #define HAVE_STRNCMP 1 #define HAVE__STRICMP 1 #define HAVE__STRNICMP 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 -#define HAVE_CEIL 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE__COPYSIGN 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEILF 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 #if defined(_MSC_VER) /* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 #define HAVE_STRTOLL 1 #define HAVE_VSSCANF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #endif /* This function is available with at least the VC++ 2008 C runtime library */ #if _MSC_VER >= 1400 @@ -166,7 +186,6 @@ typedef unsigned int uintptr_t; /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_WASAPI 1 #define SDL_AUDIO_DRIVER_DSOUND 1 -#define SDL_AUDIO_DRIVER_XAUDIO2 0 #define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 @@ -174,9 +193,13 @@ typedef unsigned int uintptr_t; /* Enable various input drivers */ #define SDL_JOYSTICK_DINPUT 1 #define SDL_JOYSTICK_XINPUT 1 +#define SDL_JOYSTICK_HIDAPI 1 #define SDL_HAPTIC_DINPUT 1 #define SDL_HAPTIC_XINPUT 1 +/* Enable the dummy sensor driver */ +#define SDL_SENSOR_DUMMY 1 + /* Enable various shared object loading systems */ #define SDL_LOADSO_WINDOWS 1 @@ -194,7 +217,7 @@ typedef unsigned int uintptr_t; #define SDL_VIDEO_RENDER_D3D 1 #endif #ifndef SDL_VIDEO_RENDER_D3D11 -#define SDL_VIDEO_RENDER_D3D11 0 +#define SDL_VIDEO_RENDER_D3D11 0 #endif /* Enable OpenGL support */ diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_cpuinfo.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_cpuinfo.h index 94b64b03b..ee3a47e84 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_cpuinfo.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,27 +51,35 @@ #include #else #ifdef __ALTIVEC__ -#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) +#if defined(HAVE_ALTIVEC_H) && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H) #include #undef pixel +#undef bool #endif #endif -#ifdef __MMX__ -#include +#if defined(__ARM_NEON__) && !defined(SDL_DISABLE_ARM_NEON_H) +#include #endif -#ifdef __3dNOW__ +#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) #include #endif -#ifdef __SSE__ +#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) +#include +#else +#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) +#include +#endif +#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H) #include #endif -#ifdef __SSE2__ +#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H) #include #endif -#ifdef __SSE3__ +#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H) #include #endif -#endif +#endif /* HAVE_IMMINTRIN_H */ +#endif /* compiler version */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -154,6 +162,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); +/** + * This function returns true if the CPU has AVX-512F (foundation) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void); + /** * This function returns true if the CPU has NEON (ARM SIMD) features. */ @@ -164,7 +177,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); */ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_egl.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_egl.h index e47fbe862..d65ed437c 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_egl.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_egl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ * * This is a simple file to encapsulate the EGL API headers. */ -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__ANDROID__) #include #include diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_endian.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_endian.h index 3eda7f287..ed0bf5ba8 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_endian.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_error.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_error.h index 49be9827e..c0e46298e 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_error.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_events.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_events.h index 0fc09bc37..af22eb646 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_events.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -85,6 +85,9 @@ typedef enum Called on Android in onResume() */ + /* Display events */ + SDL_DISPLAYEVENT = 0x150, /**< Display state change */ + /* Window events */ SDL_WINDOWEVENT = 0x200, /**< Window state change */ SDL_SYSWMEVENT, /**< System specific event */ @@ -144,6 +147,9 @@ typedef enum SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */ + /* Sensor events */ + SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */ + /* Render events */ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */ SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */ @@ -168,6 +174,21 @@ typedef struct SDL_CommonEvent Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_CommonEvent; +/** + * \brief Display state change event data (event.display.*) + */ +typedef struct SDL_DisplayEvent +{ + Uint32 type; /**< ::SDL_DISPLAYEVENT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 display; /**< The associated display index */ + Uint8 event; /**< ::SDL_DisplayEventID */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint32 data1; /**< event dependent data */ +} SDL_DisplayEvent; + /** * \brief Window state change event data (event.window.*) */ @@ -471,6 +492,17 @@ typedef struct SDL_DropEvent } SDL_DropEvent; +/** + * \brief Sensor event structure (event.sensor.*) + */ +typedef struct SDL_SensorEvent +{ + Uint32 type; /**< ::SDL_SENSORUPDATE */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Sint32 which; /**< The instance ID of the sensor */ + float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ +} SDL_SensorEvent; + /** * \brief The "quit requested" event */ @@ -526,6 +558,7 @@ typedef union SDL_Event { Uint32 type; /**< Event type, shared with all events */ SDL_CommonEvent common; /**< Common event data */ + SDL_DisplayEvent display; /**< Window event data */ SDL_WindowEvent window; /**< Window event data */ SDL_KeyboardEvent key; /**< Keyboard event data */ SDL_TextEditingEvent edit; /**< Text editing event data */ @@ -542,6 +575,7 @@ typedef union SDL_Event SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ SDL_AudioDeviceEvent adevice; /**< Audio device event data */ + SDL_SensorEvent sensor; /**< Sensor event data */ SDL_QuitEvent quit; /**< Quit request event data */ SDL_UserEvent user; /**< Custom event data */ SDL_SysWMEvent syswm; /**< System dependent window event data */ diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_filesystem.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_filesystem.h index a1c846ad0..fa6a1fa6e 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_filesystem.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_filesystem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_gamecontroller.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_gamecontroller.h index c9215132e..6ae9c9542 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_gamecontroller.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -175,6 +175,14 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); */ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); +/** + * Get the mapping of a game controller. + * This can be called before any controllers are opened. + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available + */ +extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index); + /** * Open a game controller for use. * The index passed as an argument refers to the N'th game controller on the system. @@ -196,6 +204,13 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL */ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); +/** + * Get the player index of an opened game controller, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); + /** * Get the USB vendor ID of an opened controller, if available. * If the vendor ID isn't available this function returns 0. @@ -345,6 +360,19 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); +/** + * Trigger a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param gamecontroller The controller to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + /** * Close a controller previously opened with SDL_GameControllerOpen(). */ diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_gesture.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_gesture.h index 2bba6a729..b223d80d4 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_gesture.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_haptic.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_haptic.h index 60daefaa7..2ea1bfc16 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_haptic.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -117,6 +117,17 @@ extern "C" { #endif /* __cplusplus */ +/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF). + * + * At the moment the magnitude variables are mixed between signed/unsigned, and + * it is also not made clear that ALL of those variables expect a max of 0x7FFF. + * + * Some platforms may have higher precision than that (Linux FF, Windows XInput) + * so we should fix the inconsistency in favor of higher possible precision, + * adjusting for platforms that use different scales. + * -flibit + */ + /** * \typedef SDL_Haptic * @@ -656,8 +667,8 @@ typedef struct SDL_HapticRamp * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. * * The Left/Right effect is used to explicitly control the large and small - * motors, commonly found in modern game controllers. One motor is high - * frequency, the other is low frequency. + * motors, commonly found in modern game controllers. The small (right) motor + * is high frequency, and the large (left) motor is low frequency. * * \sa SDL_HAPTIC_LEFTRIGHT * \sa SDL_HapticEffect @@ -668,7 +679,7 @@ typedef struct SDL_HapticLeftRight Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */ /* Replay */ - Uint32 length; /**< Duration of the effect. */ + Uint32 length; /**< Duration of the effect in milliseconds. */ /* Rumble */ Uint16 large_magnitude; /**< Control of the large controller motor. */ diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_hints.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_hints.h index 007a4bee0..4ee72e97d 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_hints.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -76,6 +76,7 @@ extern "C" { * "opengl" * "opengles2" * "opengles" + * "metal" * "software" * * The default varies by platform, but it's the first one in the list that @@ -210,6 +211,18 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" +/** + * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_BYPASS_COMPOSITOR + * "1" - Enable _NET_WM_BYPASS_COMPOSITOR + * + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR + * + */ +#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" + /** * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden * @@ -249,6 +262,16 @@ extern "C" { */ #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" +/** + * \brief A variable setting the double click time, in milliseconds. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME" + +/** + * \brief A variable setting the double click radius, in pixels. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS" + /** * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode */ @@ -316,7 +339,7 @@ extern "C" { #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" /** - * \brief A variable controlling which orientations are allowed on iOS. + * \brief A variable controlling which orientations are allowed on iOS/Android. * * In some circumstances it is necessary to be able to explicitly control * which UI orientations are allowed. @@ -355,16 +378,36 @@ extern "C" { #define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" /** - * \brief A variable controlling whether the Android / iOS built-in - * accelerometer should be listed as a joystick device, rather than listing - * actual joysticks only. + * \brief A variable controlling whether the home indicator bar on iPhone X + * should be hidden. * * This variable can be set to the following values: - * "0" - List only real joysticks and accept input from them - * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). + * "0" - The indicator bar is not hidden (default for windowed applications) + * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) + * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) + */ +#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR" + +/** + * \brief A variable controlling whether the Android / iOS built-in + * accelerometer should be listed as a joystick device. + * + * This variable can be set to the following values: + * "0" - The accelerometer is not listed as a joystick + * "1" - The accelerometer is available as a 3 axis joystick (the default). */ #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" +/** + * \brief A variable controlling whether the Android / tvOS remotes + * should be listed as joystick devices, instead of sending keyboard events. + * + * This variable can be set to the following values: + * "0" - Remotes send enter/escape/arrow key events + * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). + */ +#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" + /** * \brief A variable that lets you disable the detection and use of Xinput gamepad devices * @@ -432,6 +475,88 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" +/** + * \brief A variable controlling whether the HIDAPI joystick drivers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI drivers are not used + * "1" - HIDAPI drivers are used (the default) + * + * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below. + */ +#define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI" + +/** + * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4" + +/** + * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - extended reports are not enabled (the default) + * "1" - extended reports + * + * Extended input reports allow rumble on Bluetooth PS4 controllers, but + * break DirectInput handling for applications that don't use SDL. + * + * Once extended reports are enabled, they can not be disabled without + * power cycling the controller. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE" + +/** + * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM" + +/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH" + +/** + * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" + +/** + * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs + * + * The variable can be set to the following values: + * "0" - Do not scan for Steam Controllers + * "1" - Scan for Steam Controllers (the default) + * + * The default value is "1". This hint must be set before initializing the joystick subsystem. + */ +#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS" + + /** * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it. * This is a debugging aid for developers and not expected to be used by end users. The default is "1" @@ -494,6 +619,10 @@ extern "C" { * This is specially useful if you build SDL against a non glibc libc library (such as musl) which * provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). * Support for this hint is currently available only in the pthread, Windows, and PSP backend. +* +* Instead of this hint, in 2.0.9 and later, you can use +* SDL_CreateThreadWithStackSize(). This hint only works with the classic +* SDL_CreateThread(). */ #define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE" @@ -719,6 +848,35 @@ extern "C" { */ #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH" + /** + * \brief A variable to control whether we trap the Android back button to handle it manually. + * This is necessary for the right mouse button to work on some Android devices, or + * to be able to trap the back button for use in your code reliably. If set to true, + * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of + * SDL_SCANCODE_AC_BACK. + * + * The variable can be set to the following values: + * "0" - Back button will be handled as usual for system. (default) + * "1" - Back button will be trapped, allowing you to handle the key press + * manually. (This will also let right mouse click work on systems + * where the right mouse button functions as back.) + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" + + /** + * \brief A variable to control whether the return key on the soft keyboard + * should hide the soft keyboard on Android and iOS. + * + * The variable can be set to the following values: + * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - The return key will hide the keyboard. + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME" + /** * \brief override the binding element for keyboard inputs for Emscripten builds * @@ -752,7 +910,7 @@ extern "C" { * "0" - SDL will generate a window-close event when it sees Alt+F4. * "1" - SDL will only do normal key handling for Alt+F4. */ -#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" +#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" /** * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. @@ -797,6 +955,24 @@ extern "C" { */ #define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER" +/** + * \brief Tell the video driver that we only want a double buffer. + * + * By default, most lowlevel 2D APIs will use a triple buffer scheme that + * wastes no CPU time on waiting for vsync after issuing a flip, but + * introduces a frame of latency. On the other hand, using a double buffer + * scheme instead is recommended for cases where low latency is an important + * factor because we save a whole frame of latency. + * We do so by waiting for vsync immediately after issuing a flip, usually just + * after eglSwapBuffers call in the backend's *_SwapWindow function. + * + * Since it's driver-specific, it's only supported where possible and + * implemented. Currently supported the following drivers: + * - KMSDRM (kmsdrm) + * - Raspberry Pi (raspberrypi) + */ +#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER" + /** * \brief A variable controlling what driver to use for OpenGL ES contexts. * diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_joystick.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_joystick.h index f598dc828..6e05a9c20 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_joystick.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,10 +97,10 @@ typedef enum typedef enum { SDL_JOYSTICK_POWER_UNKNOWN = -1, - SDL_JOYSTICK_POWER_EMPTY, - SDL_JOYSTICK_POWER_LOW, - SDL_JOYSTICK_POWER_MEDIUM, - SDL_JOYSTICK_POWER_FULL, + SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */ + SDL_JOYSTICK_POWER_LOW, /* <= 20% */ + SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */ + SDL_JOYSTICK_POWER_FULL, /* <= 100% */ SDL_JOYSTICK_POWER_WIRED, SDL_JOYSTICK_POWER_MAX } SDL_JoystickPowerLevel; @@ -132,6 +132,12 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); */ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); +/** + * Get the player index of a joystick, or -1 if it's not available + * This can be called before any joysticks are opened. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index); + /** * Return the GUID for the joystick at this index * This can be called before any joysticks are opened. @@ -194,6 +200,13 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID */ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); +/** + * Get the player index of an opened joystick, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); + /** * Return the GUID for this opened joystick */ @@ -361,6 +374,19 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, int button); +/** + * Trigger a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param joystick The joystick to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + /** * Close a joystick previously opened with SDL_JoystickOpen(). */ diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_keyboard.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_keyboard.h index e78ca4690..874823171 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_keyboard.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_keycode.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_keycode.h index c41e45ff6..d7d5b1dbc 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_keycode.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_loadso.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_loadso.h index 6ea256c6a..da56fb452 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_loadso.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_log.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_log.h index 356d0e1cf..e12b65886 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_log.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_main.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_main.h index 2af32360f..98558217f 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_main.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -63,10 +63,13 @@ /* On Android SDL provides a Java class in SDLActivity.java that is the main activity entry point. - See README-android.md for more details on extending that class. + See docs/README-android.md for more details on extending that class. */ #define SDL_MAIN_NEEDED +/* We need to export SDL_main so it can be launched from Java */ +#define SDLMAIN_DECLSPEC DECLSPEC + #elif defined(__NACL__) /* On NACL we use ppapi_simple to set up the application helper code, then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before @@ -85,6 +88,10 @@ #define C_LINKAGE #endif /* __cplusplus */ +#ifndef SDLMAIN_DECLSPEC +#define SDLMAIN_DECLSPEC +#endif + /** * \file SDL_main.h * @@ -107,7 +114,7 @@ /** * The prototype for the application's main() function */ -extern C_LINKAGE DECLSPEC int SDL_main(int argc, char *argv[]); +extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); #include "begin_code.h" diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_messagebox.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_messagebox.h index c326d8f01..b7be59d88 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_messagebox.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_mouse.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_mouse.h index 6001bd46c..d3c9f6156 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_mouse.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_mutex.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_mutex.h index 0272379e5..ba4247ced 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_mutex.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_name.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_name.h index 8095ed3ff..ecd863f4c 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_name.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_name.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengl.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengl.h index 314dd57ed..253d9c93a 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengl.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengles.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengles.h index 800c59307..18dd984b3 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengles.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengles2.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengles2.h index 102f2f3fa..6ccecf216 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengles2.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_pixels.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_pixels.h index 04246689f..0b4364b18 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_pixels.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -287,7 +287,9 @@ enum SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */ SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'), SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */ - SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1') + SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'), + SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */ + SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ') }; typedef struct SDL_Color diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_platform.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_platform.h index 9dde385fa..7dea4ce94 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_platform.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -121,7 +121,12 @@ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) /* Try to find out if we're compiling for WinRT or non-WinRT */ #if defined(_MSC_VER) && defined(__has_include) -#define HAVE_WINAPIFAMILY_H __has_include() +#if __has_include() +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + /* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ #elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ #define HAVE_WINAPIFAMILY_H 1 diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_power.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_power.h index d48e8a379..a4fe8a935 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_power.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_quit.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_quit.h index 9283c3810..fea56a8d8 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_quit.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_rect.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_rect.h index c4f6d74b3..543bb6186 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_rect.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_render.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_render.h index ea6ef9ff6..d33619297 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_render.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -898,6 +898,27 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw */ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); +/** + * \brief Get the CAMetalLayer associated with the given Metal renderer + * + * \param renderer The renderer to query + * + * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalCommandEncoder() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer); + +/** + * \brief Get the Metal command encoder for the current frame + * + * \param renderer The renderer to query + * + * \return id on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalLayer() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_revision.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_revision.h index 9376093ee..92fbe67b1 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_revision.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_revision.h @@ -1,2 +1,2 @@ -#define SDL_REVISION "hg-11645:2088cd828335" -#define SDL_REVISION_NUMBER 11645 +#define SDL_REVISION "hg-12373:8feb5da6f2fb" +#define SDL_REVISION_NUMBER 12373 diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_rwops.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_rwops.h index 7f0cbdfd5..0960699d4 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_rwops.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_scancode.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_scancode.h index 1d5521204..63871aa3b 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_scancode.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_sensor.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_sensor.h new file mode 100644 index 000000000..ac163a8cd --- /dev/null +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_sensor.h @@ -0,0 +1,251 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + 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. + + 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 + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_sensor.h + * + * Include file for SDL sensor event handling + * + */ + +#ifndef _SDL_sensor_h +#define _SDL_sensor_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief SDL_sensor.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system + * for sensors, and load appropriate drivers. + */ + +struct _SDL_Sensor; +typedef struct _SDL_Sensor SDL_Sensor; + +/** + * This is a unique ID for a sensor for the time it is connected to the system, + * and is never reused for the lifetime of the application. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + */ +typedef Sint32 SDL_SensorID; + +/* The different sensors defined by SDL + * + * Additional sensors may be available, using platform dependent semantics. + * + * Hare are the additional Android sensors: + * https://developer.android.com/reference/android/hardware/SensorEvent.html#values + */ +typedef enum +{ + SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */ + SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */ + SDL_SENSOR_ACCEL, /**< Accelerometer */ + SDL_SENSOR_GYRO /**< Gyroscope */ +} SDL_SensorType; + +/** + * Accelerometer sensor + * + * The accelerometer returns the current acceleration in SI meters per + * second squared. This includes gravity, so a device at rest will have + * an acceleration of SDL_STANDARD_GRAVITY straight down. + * + * values[0]: Acceleration on the x axis + * values[1]: Acceleration on the y axis + * values[2]: Acceleration on the z axis + * + * For phones held in portrait mode, the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ +#define SDL_STANDARD_GRAVITY 9.80665f + +/** + * Gyroscope sensor + * + * The gyroscope returns the current rate of rotation in radians per second. + * The rotation is positive in the counter-clockwise direction. That is, + * an observer looking from a positive location on one of the axes would + * see positive rotation on that axis when it appeared to be rotating + * counter-clockwise. + * + * values[0]: Angular speed around the x axis + * values[1]: Angular speed around the y axis + * values[2]: Angular speed around the z axis + * + * For phones held in portrait mode, the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ + +/* Function prototypes */ + +/** + * \brief Count the number of sensors attached to the system right now + */ +extern DECLSPEC int SDLCALL SDL_NumSensors(void); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor name, or NULL if device_index is out of range. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if device_index is out of range. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if device_index is out of range. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index); + +/** + * \brief Open a sensor for use. + * + * The index passed as an argument refers to the N'th sensor on the system. + * + * \return A sensor identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index); + +/** + * Return the SDL_Sensor associated with an instance id. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * \return The sensor name, or NULL if the sensor is NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if the sensor is NULL. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor); + +/** + * Get the current state of an opened sensor. + * + * The number of values and interpretation of the data is sensor dependent. + * + * \param sensor The sensor to query + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * + * \return 0 or -1 if an error occurred. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values); + +/** + * Close a sensor previously opened with SDL_SensorOpen() + */ +extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor); + +/** + * Update the current state of the open sensors. + * + * This is called automatically by the event loop if sensor events are enabled. + * + * This needs to be called from the thread that initialized the sensor subsystem. + */ +extern DECLSPEC void SDLCALL SDL_SensorUpdate(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_sensor_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_shape.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_shape.h index 9e492d93a..40a6baaae 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_shape.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_stdinc.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_stdinc.h index 72402299f..e373bc380 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_stdinc.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -86,6 +86,28 @@ #ifdef HAVE_FLOAT_H # include #endif +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__BORLANDC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) +#pragma alloca +# elif defined(__MRC__) +void *alloca(unsigned); +# else +char *alloca(); +# endif +#endif /** * The number of elements in an array. @@ -328,28 +350,6 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); extern "C" { #endif -#if defined(HAVE_ALLOCA) && !defined(alloca) -# if defined(HAVE_ALLOCA_H) -# include -# elif defined(__GNUC__) -# define alloca __builtin_alloca -# elif defined(_MSC_VER) -# include -# define alloca _alloca -# elif defined(__WATCOMC__) -# include -# elif defined(__BORLANDC__) -# include -# elif defined(__DMC__) -# include -# elif defined(__AIX__) -#pragma alloca -# elif defined(__MRC__) -void *alloca(unsigned); -# else -char *alloca(); -# endif -#endif #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) @@ -445,12 +445,12 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) #endif } - extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); +extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); @@ -501,18 +501,35 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size #endif extern DECLSPEC double SDLCALL SDL_acos(double x); +extern DECLSPEC float SDLCALL SDL_acosf(float x); extern DECLSPEC double SDLCALL SDL_asin(double x); +extern DECLSPEC float SDLCALL SDL_asinf(float x); extern DECLSPEC double SDLCALL SDL_atan(double x); +extern DECLSPEC float SDLCALL SDL_atanf(float x); extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); +extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y); extern DECLSPEC double SDLCALL SDL_ceil(double x); +extern DECLSPEC float SDLCALL SDL_ceilf(float x); extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); +extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y); extern DECLSPEC double SDLCALL SDL_cos(double x); extern DECLSPEC float SDLCALL SDL_cosf(float x); +extern DECLSPEC double SDLCALL SDL_exp(double x); +extern DECLSPEC float SDLCALL SDL_expf(float x); extern DECLSPEC double SDLCALL SDL_fabs(double x); +extern DECLSPEC float SDLCALL SDL_fabsf(float x); extern DECLSPEC double SDLCALL SDL_floor(double x); +extern DECLSPEC float SDLCALL SDL_floorf(float x); +extern DECLSPEC double SDLCALL SDL_fmod(double x, double y); +extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y); extern DECLSPEC double SDLCALL SDL_log(double x); +extern DECLSPEC float SDLCALL SDL_logf(float x); +extern DECLSPEC double SDLCALL SDL_log10(double x); +extern DECLSPEC float SDLCALL SDL_log10f(float x); extern DECLSPEC double SDLCALL SDL_pow(double x, double y); +extern DECLSPEC float SDLCALL SDL_powf(float x, float y); extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); +extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n); extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC float SDLCALL SDL_sinf(float x); extern DECLSPEC double SDLCALL SDL_sqrt(double x); diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_surface.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_surface.h index 510690c9c..730d49fc8 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_surface.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,6 +97,17 @@ typedef struct SDL_Surface typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, struct SDL_Surface * dst, SDL_Rect * dstrect); +/** + * \brief The formula used for converting between YUV and RGB + */ +typedef enum +{ + SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */ + SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */ + SDL_YUV_CONVERSION_BT709, /**< BT.709 */ + SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */ +} SDL_YUV_CONVERSION_MODE; + /** * Allocate and free an RGB surface. * @@ -237,6 +248,13 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key); +/** + * \brief Returns whether the surface has a color key + * + * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface); + /** * \brief Gets the color key (transparent pixel) in a blittable surface. * @@ -509,6 +527,20 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled (SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); +/** + * \brief Set the YUV conversion mode + */ +extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode); + +/** + * \brief Get the YUV conversion mode + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void); + +/** + * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_system.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_system.h index eb069b33d..4dc372d6b 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_system.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -76,6 +76,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a #endif /* __WIN32__ */ +/* Platform specific functions for Linux */ +#ifdef __LINUX__ + +/** + \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available. + + \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority); + +#endif /* __LINUX__ */ + /* Platform specific functions for iOS */ #if defined(__IPHONEOS__) && __IPHONEOS__ @@ -108,6 +120,26 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void); */ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); +/** + \brief Return true if the application is running on Android TV + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); + +/** + \brief Return true if the application is running on a Chromebook + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void); + +/** + \brief Return true is the application is running on a Samsung DeX docking station + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void); + +/** + \brief Trigger the Android system back button behavior. + */ +extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void); + /** See the official Android developer guide for more information: http://developer.android.com/guide/topics/data/data-storage.html @@ -169,6 +201,25 @@ typedef enum } SDL_WinRT_Path; +/** + * \brief WinRT Device Family + */ +typedef enum +{ + /** \brief Unknown family */ + SDL_WINRT_DEVICEFAMILY_UNKNOWN, + + /** \brief Desktop family*/ + SDL_WINRT_DEVICEFAMILY_DESKTOP, + + /** \brief Mobile family (for example smartphone) */ + SDL_WINRT_DEVICEFAMILY_MOBILE, + + /** \brief XBox family */ + SDL_WINRT_DEVICEFAMILY_XBOX, +} SDL_WinRT_DeviceFamily; + + /** * \brief Retrieves a WinRT defined path on the local file system * @@ -203,8 +254,20 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path */ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); +/** + * \brief Detects the device family of WinRT plattform on runtime + * + * \return Device family + */ +extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); + #endif /* __WINRT__ */ +/** + \brief Return true if the current device is a tablet. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_syswm.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_syswm.h index 2d18afb6c..f1c4021cc 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_syswm.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,12 +33,6 @@ #include "SDL_video.h" #include "SDL_version.h" -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - /** * \file SDL_syswm.h * @@ -110,6 +104,12 @@ typedef void *EGLSurface; #include "SDL_egl.h" #endif +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /** * These are the various supported windowing subsystems */ diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test.h index f55afcb02..6cc373bf8 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_assert.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_assert.h index 11d836394..1788d7a20 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_assert.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_common.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_common.h index 24eeb32af..be2e6b2aa 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_common.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_compare.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_compare.h index 9f4c4587a..c22e447d8 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_compare.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_compare.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_crc32.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_crc32.h index add480c34..3d235d074 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_crc32.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_font.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_font.h index 58c9f9d5e..59cbdcad6 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_font.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_fuzzer.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_fuzzer.h index 6cf05747a..8fcb9ebbf 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_fuzzer.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_harness.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_harness.h index 68c4bcb7c..8641e0a7e 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_harness.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_images.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_images.h index 683d2f8a6..9c4dd5b82 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_images.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_images.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_log.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_log.h index 9f993fbbc..ebd44fb50 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_log.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_md5.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_md5.h index 67ca7d1de..0e4105768 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_md5.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_memory.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_memory.h index 43b67f521..4827ae6f2 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_memory.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_memory.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_random.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_random.h index 2b01922c3..0eb414ff2 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_random.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_thread.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_thread.h index d0f6575cd..554dd0b61 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_thread.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,12 +54,13 @@ typedef unsigned int SDL_TLSID; /** * The SDL thread priority. * - * \note On many systems you require special privileges to set high priority. + * \note On many systems you require special privileges to set high or time critical priority. */ typedef enum { SDL_THREAD_PRIORITY_LOW, SDL_THREAD_PRIORITY_NORMAL, - SDL_THREAD_PRIORITY_HIGH + SDL_THREAD_PRIORITY_HIGH, + SDL_THREAD_PRIORITY_TIME_CRITICAL } SDL_ThreadPriority; /** @@ -105,14 +106,24 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *), + const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); + + /** * Create a thread. */ #if defined(SDL_CreateThread) && SDL_DYNAMIC_API #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #endif #elif defined(__OS2__) @@ -132,15 +143,31 @@ extern DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); #if defined(SDL_CreateThread) && SDL_DYNAMIC_API #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) #endif #else +/** + * Create a thread with a default stack size. + * + * This is equivalent to calling: + * SDL_CreateThreadWithStackSize(fn, name, 0, data); + */ +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); + /** * Create a thread. * @@ -158,9 +185,17 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, * If a system imposes requirements, SDL will try to munge the string for * it (truncate, etc), but the original string contents will be available * from SDL_GetThreadName(). + * + * The size (in bytes) of the new stack can be specified. Zero means "use + * the system default" which might be wildly different between platforms + * (x86 Linux generally defaults to eight megabytes, an embedded device + * might be a few kilobytes instead). + * + * In SDL 2.1, stacksize will be folded into the original SDL_CreateThread + * function. */ extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data); #endif diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_timer.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_timer.h index 282625d3f..5600618ff 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_timer.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_touch.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_touch.h index db9e25ebd..f4075e79a 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_touch.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_types.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_types.h index 06ee80cb3..4ac248c8c 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_types.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_version.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_version.h index 5b4c40248..31443e149 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_version.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 7 +#define SDL_PATCHLEVEL 9 /** * \brief Macro to determine SDL version program was compiled against. diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_video.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_video.h index 6f6cda8b1..461f13805 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_video.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -110,7 +110,9 @@ typedef enum SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ - SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */ + SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported. + On macOS NSHighResolutionCapable must be set true in the + application's Info.plist for this to have any effect. */ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */ SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */ SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */ @@ -167,6 +169,24 @@ typedef enum SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */ } SDL_WindowEventID; +/** + * \brief Event subtype for display events + */ +typedef enum +{ + SDL_DISPLAYEVENT_NONE, /**< Never used */ + SDL_DISPLAYEVENT_ORIENTATION /**< Display orientation has changed to data1 */ +} SDL_DisplayEventID; + +typedef enum +{ + SDL_ORIENTATION_UNKNOWN, /**< The display orientation can't be determined */ + SDL_ORIENTATION_LANDSCAPE, /**< The display is in landscape mode, with the right side up, relative to portrait mode */ + SDL_ORIENTATION_LANDSCAPE_FLIPPED, /**< The display is in landscape mode, with the left side up, relative to portrait mode */ + SDL_ORIENTATION_PORTRAIT, /**< The display is in portrait mode */ + SDL_ORIENTATION_PORTRAIT_FLIPPED /**< The display is in portrait mode, upside down */ +} SDL_DisplayOrientation; + /** * \brief An opaque handle to an OpenGL context. */ @@ -314,18 +334,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetDisplayName(int displayIndex); */ extern DECLSPEC int SDLCALL SDL_GetDisplayBounds(int displayIndex, SDL_Rect * rect); -/** - * \brief Get the dots/pixels-per-inch for a display - * - * \note Diagonal, horizontal and vertical DPI can all be optionally - * returned if the parameter is non-NULL. - * - * \return 0 on success, or -1 if no DPI information is available or the index is out of range. - * - * \sa SDL_GetNumVideoDisplays() - */ -extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi); - /** * \brief Get the usable desktop area represented by a display, with the * primary display located at 0,0 @@ -345,6 +353,27 @@ extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, fl */ extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect); +/** + * \brief Get the dots/pixels-per-inch for a display + * + * \note Diagonal, horizontal and vertical DPI can all be optionally + * returned if the parameter is non-NULL. + * + * \return 0 on success, or -1 if no DPI information is available or the index is out of range. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi); + +/** + * \brief Get the orientation of a display + * + * \return The orientation of the display, or SDL_ORIENTATION_UNKNOWN if it isn't available. + * + * \sa SDL_GetNumVideoDisplays() + */ +extern DECLSPEC SDL_DisplayOrientation SDLCALL SDL_GetDisplayOrientation(int displayIndex); + /** * \brief Returns the number of available display modes. * @@ -470,7 +499,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); * If the window is created with any of the SDL_WINDOW_OPENGL or * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the - * corrensponding UnloadLibrary function is called by SDL_DestroyWindow(). + * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). * * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail. diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_vulkan.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_vulkan.h index 803b5feef..972cca4d7 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_vulkan.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/SDL_vulkan.h @@ -69,30 +69,43 @@ typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ * \brief Dynamically load a Vulkan loader library. * * \param [in] path The platform dependent Vulkan loader library name, or - * \c NULL to open the default Vulkan loader library. + * \c NULL. * * \return \c 0 on success, or \c -1 if the library couldn't be loaded. * - * This should be done after initializing the video driver, but before + * If \a path is NULL SDL will use the value of the environment variable + * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan + * loader library. + * + * This should be called after initializing the video driver, but before * creating any Vulkan windows. If no Vulkan loader library is loaded, the * default library will be loaded upon creation of the first Vulkan window. * - * \note If you specify a non-NULL \a path, you should retrieve all of the - * Vulkan functions used in your program from the dynamic library using + * \note It is fairly common for Vulkan applications to link with \a libvulkan + * instead of explicitly loading it at run time. This will work with + * SDL provided the application links to a dynamic library and both it + * and SDL use the same search path. + * + * \note If you specify a non-NULL \c path, an application should retrieve all + * of the Vulkan functions it uses from the dynamic library using * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee - * \a path points to the same vulkan loader library that you linked to. + * \c path points to the same vulkan loader library the application + * linked to. * * \note On Apple devices, if \a path is NULL, SDL will attempt to find * the vkGetInstanceProcAddr address within all the mach-o images of - * the current process. This is because the currently (v0.17.0) - * recommended MoltenVK (Vulkan on Metal) usage is as a static library. - * If it is not found then SDL will attempt to load \c libMoltenVK.dylib. - * Applications using the dylib alternative therefore do not need to do - * anything special when calling SDL. + * the current process. This is because it is fairly common for Vulkan + * applications to link with libvulkan (and historically MoltenVK was + * provided as a static library). If it is not found then, on macOS, SDL + * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, + * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order. + * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications + * using a dynamic framework or .dylib must ensure it is included in its + * application bundle. * - * \note On non-Apple devices, SDL requires you to either not link to the - * Vulkan loader or link to a dynamic library version. This limitation - * may be removed in a future version of SDL. + * \note On non-Apple devices, application linking with a static libvulkan is + * not supported. Either do not link to the Vulkan loader or link to a + * dynamic library version. * * \note This function will fail if there are no working Vulkan drivers * installed. @@ -122,11 +135,11 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * \brief Get the names of the Vulkan instance extensions needed to create * a surface with \c SDL_Vulkan_CreateSurface(). * - * \param [in] window Window for which the required Vulkan instance + * \param [in] \c NULL or window Window for which the required Vulkan instance * extensions should be retrieved - * \param [in,out] count pointer to an \c unsigned related to the number of + * \param [in,out] pCount pointer to an \c unsigned related to the number of * required Vulkan instance extensions - * \param [out] names \c NULL or a pointer to an array to be filled with the + * \param [out] pNames \c NULL or a pointer to an array to be filled with the * required Vulkan instance extensions * * \return \c SDL_TRUE on success, \c SDL_FALSE on error. @@ -140,6 +153,10 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * is smaller than the number of required extensions, \c SDL_FALSE will be * returned instead of \c SDL_TRUE, to indicate that not all the required * extensions were returned. + * + * \note If \c window is not NULL, it will be checked against its creation + * flags to ensure that the Vulkan flag is present. This parameter + * will be removed in a future major release. * * \note The returned list of extensions will contain \c VK_KHR_surface * and zero or more platform specific extensions @@ -147,12 +164,13 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * \note The extension names queried here must be enabled when calling * VkCreateInstance, otherwise surface creation will fail. * - * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag. + * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag + * or be \c NULL * * \code * unsigned int count; * // get count of required extensions - * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL)) + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL)) * handle_error(); * * static const char *const additionalExtensions[] = @@ -166,7 +184,7 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); * handle_error(); * * // get names of required extensions - * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names)) + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names)) * handle_error(); * * // copy additional extensions after required extensions @@ -240,6 +258,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface( * platform with high-DPI support (Apple calls this "Retina"), and not disabled * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. * + * \note On macOS high-DPI support must be enabled for an application by + * setting NSHighResolutionCapable to true in its Info.plist. + * * \sa SDL_GetWindowSize() * \sa SDL_CreateWindow() */ diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/begin_code.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/begin_code.h index 5372d6f04..6c2106246 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/begin_code.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/close_code.h b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/close_code.h index 2a352dbb9..b3b70a4c8 100644 --- a/libs/SDL2/x86_64-w64-mingw32/include/SDL2/close_code.h +++ b/libs/SDL2/x86_64-w64-mingw32/include/SDL2/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2/x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake b/libs/SDL2/x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake index f5bfc3b79..455d8ed55 100644 --- a/libs/SDL2/x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake +++ b/libs/SDL2/x86_64-w64-mingw32/lib/cmake/SDL2/sdl2-config.cmake @@ -1,11 +1,11 @@ # sdl2 cmake project-config input for ./configure scripts -set(prefix "/usr/local/x86_64-w64-mingw32") +set(prefix "/opt/local/x86_64-w64-mingw32") set(exec_prefix "${prefix}") set(libdir "${exec_prefix}/lib") -set(SDL2_PREFIX "/usr/local/x86_64-w64-mingw32") -set(SDL2_EXEC_PREFIX "/usr/local/x86_64-w64-mingw32") +set(SDL2_PREFIX "/opt/local/x86_64-w64-mingw32") +set(SDL2_EXEC_PREFIX "/opt/local/x86_64-w64-mingw32") set(SDL2_LIBDIR "${exec_prefix}/lib") set(SDL2_INCLUDE_DIRS "${prefix}/include/SDL2") -set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -lSDL2 -mwindows") +set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} -lmingw32 -lSDL2main -lSDL2 -mwindows") string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) diff --git a/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2.a b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2.a index d81a9cbcf..827950682 100644 Binary files a/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2.a and b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2.a differ diff --git a/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2.dll.a b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2.dll.a index 65648749c..669b6a637 100755 Binary files a/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2.dll.a and b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2.dll.a differ diff --git a/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2.la b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2.la new file mode 100644 index 000000000..d5295eec8 --- /dev/null +++ b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2.la @@ -0,0 +1,41 @@ +# libSDL2.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='../bin/SDL2.dll' + +# Names of this library. +library_names='libSDL2.dll.a' + +# The name of the static archive. +old_library='libSDL2.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libSDL2. +current=9 +age=9 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/valve/release/SDL/SDL2-2.0.9/x86_64-w64-mingw32/lib' diff --git a/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2_test.a b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2_test.a index af32f8689..fcbdbbf76 100644 Binary files a/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2_test.a and b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2_test.a differ diff --git a/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2_test.la b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2_test.la new file mode 100644 index 000000000..76ad43f0f --- /dev/null +++ b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2_test.la @@ -0,0 +1,41 @@ +# libSDL2_test.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libSDL2_test.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libSDL2_test. +current=0 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/valve/release/SDL/SDL2-2.0.9/x86_64-w64-mingw32/lib' diff --git a/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2main.a b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2main.a index decdd5a0f..3a26e430d 100644 Binary files a/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2main.a and b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2main.a differ diff --git a/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2main.la b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2main.la new file mode 100644 index 000000000..5aa469333 --- /dev/null +++ b/libs/SDL2/x86_64-w64-mingw32/lib/libSDL2main.la @@ -0,0 +1,41 @@ +# libSDL2main.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='' + +# Names of this library. +library_names='' + +# The name of the static archive. +old_library='libSDL2main.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libSDL2main. +current=0 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/valve/release/SDL/SDL2-2.0.9/x86_64-w64-mingw32/lib' diff --git a/libs/SDL2/x86_64-w64-mingw32/lib/pkgconfig/sdl2.pc b/libs/SDL2/x86_64-w64-mingw32/lib/pkgconfig/sdl2.pc index d06fc29cd..ae83be160 100644 --- a/libs/SDL2/x86_64-w64-mingw32/lib/pkgconfig/sdl2.pc +++ b/libs/SDL2/x86_64-w64-mingw32/lib/pkgconfig/sdl2.pc @@ -1,15 +1,15 @@ # sdl pkg-config source file -prefix=/usr/local/x86_64-w64-mingw32 +prefix=/opt/local/x86_64-w64-mingw32 exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: sdl2 Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. -Version: 2.0.7 +Version: 2.0.9 Requires: Conflicts: -Libs: -L${libdir} -lmingw32 -lSDL2main -lSDL2 -mwindows -Libs.private: -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -static-libgcc +Libs: -L${libdir} -lmingw32 -lSDL2main -lSDL2 -mwindows +Libs.private: -lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--no-undefined -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc Cflags: -I${includedir}/SDL2 -Dmain=SDL_main diff --git a/libs/SDL2_mixer/CHANGES.txt b/libs/SDL2_mixer/CHANGES.txt index 1c99deb8e..7760ddfe3 100644 --- a/libs/SDL2_mixer/CHANGES.txt +++ b/libs/SDL2_mixer/CHANGES.txt @@ -1,3 +1,15 @@ +2.0.4: +Ozkan Sezer - Wed, 10 Oct 2018 14:56:10 + * Removed smpeg support for mp3 music, now that it's replaced by libmpg123 +Ozkan Sezer - Sun, 07 Oct 2018 08:50:02 + * Fixed mp3 mad decoder to skip tags, which otherwise would lead to crashes +Ozkan Sezer - Fri, 15 Jun 2018 05:32:56 + * Added support for Opus music playback using opusfile library + +2.0.3: +Sam Lantinga - Thu, Mar 1, 2018 9:06:58 AM + * Fixed regression where Mix_Init() would return 0 for available music formats + 2.0.2: Sam Lantinga - Fri Oct 20 22:04:50 PDT 2017 * Implemented 24-bit and surround sound support for FLAC audio files diff --git a/libs/SDL2_mixer/COPYING.txt b/libs/SDL2_mixer/COPYING.txt index 056d0f352..234a5a5ef 100644 --- a/libs/SDL2_mixer/COPYING.txt +++ b/libs/SDL2_mixer/COPYING.txt @@ -1,6 +1,6 @@ /* SDL_mixer: An audio mixer library based on the SDL library - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/libs/SDL2_mixer/README.txt b/libs/SDL2_mixer/README.txt index 14de6e002..a639c37bc 100644 --- a/libs/SDL2_mixer/README.txt +++ b/libs/SDL2_mixer/README.txt @@ -14,7 +14,7 @@ for documentation on this mixer library. The mixer can currently load Microsoft WAVE files and Creative Labs VOC files as audio samples, it can load FLAC files with libFLAC, it can load Ogg Vorbis files with Ogg Vorbis or Tremor libraries, it can load MP3 files -using mpg123, SMPEG or libmad, and it can load MIDI files with Timidity, +using mpg123 or libmad, and it can load MIDI files with Timidity, FluidSynth, and natively on Windows, Mac OSX, and Linux, and finally it can load the following file formats via ModPlug or MikMod: .MOD .S3M .IT .XM. diff --git a/libs/SDL2_mixer/SRB2NOTE.txt b/libs/SDL2_mixer/SRB2NOTE.txt new file mode 100644 index 000000000..7053c44f6 --- /dev/null +++ b/libs/SDL2_mixer/SRB2NOTE.txt @@ -0,0 +1,15 @@ +# SDL Mixer Development Libaries + +Download both the VC and MinGW packages and extract them here. + +https://www.libsdl.org/projects/SDL_mixer/ + +## VC Package + +* include +* lib + +## MinGW Package + +* i686-w64-mingw32 +* x86_64-w64-mingw32 diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.FLAC.txt b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.FLAC.txt index 94fd3aa69..2e67b77cb 100644 --- a/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.FLAC.txt +++ b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.FLAC.txt @@ -1,5 +1,5 @@ The source code to this library used with SDL_mixer can be found here: -http://www.libsdl.org/projects/SDL_mixer/libs/ +https://hg.libsdl.org/SDL_mixer/file/default/external --- Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.modplug.txt b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.modplug.txt index 59fbf826c..a89532db8 100644 --- a/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.modplug.txt +++ b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.modplug.txt @@ -1 +1,5 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + ModPlug-XMMS and libmodplug are now in the public domain. diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.mpg123.txt b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.mpg123.txt index d7bb85fc3..2111cd79f 100644 --- a/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.mpg123.txt +++ b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.mpg123.txt @@ -1,3 +1,7 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + This is the file that contains the terms of use, copying, etc. for the mpg123 distribution package. Main message, to include in "About ..." boxes, etc: diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.ogg-vorbis.txt b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.ogg-vorbis.txt index c2cb6d56e..6456dc4ed 100644 --- a/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.ogg-vorbis.txt +++ b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.ogg-vorbis.txt @@ -1,5 +1,5 @@ The source code to this library used with SDL_mixer can be found here: -http://www.libsdl.org/projects/SDL_mixer/libs/ +https://hg.libsdl.org/SDL_image/file/default/external --- Copyright (c) 2002-2008 Xiph.org Foundation diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.opus.txt b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.opus.txt new file mode 100644 index 000000000..adb56a854 --- /dev/null +++ b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.opus.txt @@ -0,0 +1,48 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + +Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic, + Jean-Marc Valin, Timothy B. Terriberry, + CSIRO, Gregory Maxwell, Mark Borgerding, + Erik de Castro Lopo + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of Internet Society, IETF or IETF Trust, nor the +names of specific contributors, may be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Opus is subject to the royalty-free patent licenses which are +specified at: + +Xiph.Org Foundation: +https://datatracker.ietf.org/ipr/1524/ + +Microsoft Corporation: +https://datatracker.ietf.org/ipr/1914/ + +Broadcom Corporation: +https://datatracker.ietf.org/ipr/1526/ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.opusfile.txt b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.opusfile.txt new file mode 100644 index 000000000..dfc9681fc --- /dev/null +++ b/libs/SDL2_mixer/i686-w64-mingw32/bin/LICENSE.opusfile.txt @@ -0,0 +1,32 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + +Copyright (c) 1994-2013 Xiph.Org Foundation and contributors + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.Org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/SDL2_mixer.dll b/libs/SDL2_mixer/i686-w64-mingw32/bin/SDL2_mixer.dll index 54ebbb1d4..96abfa1ab 100755 Binary files a/libs/SDL2_mixer/i686-w64-mingw32/bin/SDL2_mixer.dll and b/libs/SDL2_mixer/i686-w64-mingw32/bin/SDL2_mixer.dll differ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/libFLAC-8.dll b/libs/SDL2_mixer/i686-w64-mingw32/bin/libFLAC-8.dll index 1c55ad496..b56ea2a8c 100755 Binary files a/libs/SDL2_mixer/i686-w64-mingw32/bin/libFLAC-8.dll and b/libs/SDL2_mixer/i686-w64-mingw32/bin/libFLAC-8.dll differ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/libmodplug-1.dll b/libs/SDL2_mixer/i686-w64-mingw32/bin/libmodplug-1.dll index a2cba0d6b..d66a317dd 100755 Binary files a/libs/SDL2_mixer/i686-w64-mingw32/bin/libmodplug-1.dll and b/libs/SDL2_mixer/i686-w64-mingw32/bin/libmodplug-1.dll differ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/libmpg123-0.dll b/libs/SDL2_mixer/i686-w64-mingw32/bin/libmpg123-0.dll index ca7de300d..240298bbf 100755 Binary files a/libs/SDL2_mixer/i686-w64-mingw32/bin/libmpg123-0.dll and b/libs/SDL2_mixer/i686-w64-mingw32/bin/libmpg123-0.dll differ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/libogg-0.dll b/libs/SDL2_mixer/i686-w64-mingw32/bin/libogg-0.dll index 3abe6ebfc..233c0f42a 100755 Binary files a/libs/SDL2_mixer/i686-w64-mingw32/bin/libogg-0.dll and b/libs/SDL2_mixer/i686-w64-mingw32/bin/libogg-0.dll differ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/libopus-0.dll b/libs/SDL2_mixer/i686-w64-mingw32/bin/libopus-0.dll new file mode 100644 index 000000000..94ea541d2 Binary files /dev/null and b/libs/SDL2_mixer/i686-w64-mingw32/bin/libopus-0.dll differ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/libopusfile-0.dll b/libs/SDL2_mixer/i686-w64-mingw32/bin/libopusfile-0.dll new file mode 100644 index 000000000..260796b6a Binary files /dev/null and b/libs/SDL2_mixer/i686-w64-mingw32/bin/libopusfile-0.dll differ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/libvorbis-0.dll b/libs/SDL2_mixer/i686-w64-mingw32/bin/libvorbis-0.dll index 4e44ef088..4e4aaa543 100755 Binary files a/libs/SDL2_mixer/i686-w64-mingw32/bin/libvorbis-0.dll and b/libs/SDL2_mixer/i686-w64-mingw32/bin/libvorbis-0.dll differ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/bin/libvorbisfile-3.dll b/libs/SDL2_mixer/i686-w64-mingw32/bin/libvorbisfile-3.dll index e757eb6de..5d90a235c 100755 Binary files a/libs/SDL2_mixer/i686-w64-mingw32/bin/libvorbisfile-3.dll and b/libs/SDL2_mixer/i686-w64-mingw32/bin/libvorbisfile-3.dll differ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/include/SDL2/SDL_mixer.h b/libs/SDL2_mixer/i686-w64-mingw32/include/SDL2/SDL_mixer.h index cbb8ae6b6..009d8a2da 100644 --- a/libs/SDL2_mixer/i686-w64-mingw32/include/SDL2/SDL_mixer.h +++ b/libs/SDL2_mixer/i686-w64-mingw32/include/SDL2/SDL_mixer.h @@ -1,6 +1,6 @@ /* SDL_mixer: An audio mixer library based on the SDL library - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,7 +38,7 @@ extern "C" { */ #define SDL_MIXER_MAJOR_VERSION 2 #define SDL_MIXER_MINOR_VERSION 0 -#define SDL_MIXER_PATCHLEVEL 2 +#define SDL_MIXER_PATCHLEVEL 4 /* This macro can be used to fill a version structure with the compile-time * version of the SDL_mixer library. @@ -80,7 +80,8 @@ typedef enum MIX_INIT_MOD = 0x00000002, MIX_INIT_MP3 = 0x00000008, MIX_INIT_OGG = 0x00000010, - MIX_INIT_MID = 0x00000020 + MIX_INIT_MID = 0x00000020, + MIX_INIT_OPUS = 0x00000040 } MIX_InitFlags; /* Loads dynamic libraries and prepares them for use. Flags should be @@ -134,7 +135,8 @@ typedef enum { MUS_MP3, MUS_MP3_MAD_UNUSED, MUS_FLAC, - MUS_MODPLUG_UNUSED + MUS_MODPLUG_UNUSED, + MUS_OPUS } Mix_MusicType; /* The internal format for a music chunk interpreted via mikmod */ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/lib/libSDL2_mixer.a b/libs/SDL2_mixer/i686-w64-mingw32/lib/libSDL2_mixer.a index 9cc3ed19c..5c780be51 100644 Binary files a/libs/SDL2_mixer/i686-w64-mingw32/lib/libSDL2_mixer.a and b/libs/SDL2_mixer/i686-w64-mingw32/lib/libSDL2_mixer.a differ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/lib/libSDL2_mixer.dll.a b/libs/SDL2_mixer/i686-w64-mingw32/lib/libSDL2_mixer.dll.a index 6b63de0ee..ac90388f2 100755 Binary files a/libs/SDL2_mixer/i686-w64-mingw32/lib/libSDL2_mixer.dll.a and b/libs/SDL2_mixer/i686-w64-mingw32/lib/libSDL2_mixer.dll.a differ diff --git a/libs/SDL2_mixer/i686-w64-mingw32/lib/libSDL2_mixer.la b/libs/SDL2_mixer/i686-w64-mingw32/lib/libSDL2_mixer.la new file mode 100644 index 000000000..f8179ea8c --- /dev/null +++ b/libs/SDL2_mixer/i686-w64-mingw32/lib/libSDL2_mixer.la @@ -0,0 +1,41 @@ +# libSDL2_mixer.la - a libtool library file +# Generated by ltmain.sh (GNU libtool) 2.2.6 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='../bin/SDL2_mixer.dll' + +# Names of this library. +library_names='libSDL2_mixer.dll.a' + +# The name of the static archive. +old_library='libSDL2_mixer.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -L/opt/local/i686-w64-mingw32/lib -lmingw32 /opt/local/i686-w64-mingw32/lib/libSDL2.la -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -lwinmm' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libSDL2_mixer. +current=2 +age=2 +revision=2 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/valve/release/SDL_mixer/SDL2_mixer-2.0.4/i686-w64-mingw32/lib' diff --git a/libs/SDL2_mixer/i686-w64-mingw32/lib/pkgconfig/SDL2_mixer.pc b/libs/SDL2_mixer/i686-w64-mingw32/lib/pkgconfig/SDL2_mixer.pc index 76ba57fab..0b8410993 100644 --- a/libs/SDL2_mixer/i686-w64-mingw32/lib/pkgconfig/SDL2_mixer.pc +++ b/libs/SDL2_mixer/i686-w64-mingw32/lib/pkgconfig/SDL2_mixer.pc @@ -1,11 +1,11 @@ -prefix=/usr/local/i686-w64-mingw32 +prefix=/opt/local/i686-w64-mingw32 exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: SDL2_mixer Description: mixer library for Simple DirectMedia Layer -Version: 2.0.2 +Version: 2.0.4 Requires: sdl2 >= 2.0.7 Libs: -L${libdir} -lSDL2_mixer Cflags: -I${includedir}/SDL2 diff --git a/libs/SDL2_mixer/include/SDL_mixer.h b/libs/SDL2_mixer/include/SDL_mixer.h index cbb8ae6b6..009d8a2da 100644 --- a/libs/SDL2_mixer/include/SDL_mixer.h +++ b/libs/SDL2_mixer/include/SDL_mixer.h @@ -1,6 +1,6 @@ /* SDL_mixer: An audio mixer library based on the SDL library - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,7 +38,7 @@ extern "C" { */ #define SDL_MIXER_MAJOR_VERSION 2 #define SDL_MIXER_MINOR_VERSION 0 -#define SDL_MIXER_PATCHLEVEL 2 +#define SDL_MIXER_PATCHLEVEL 4 /* This macro can be used to fill a version structure with the compile-time * version of the SDL_mixer library. @@ -80,7 +80,8 @@ typedef enum MIX_INIT_MOD = 0x00000002, MIX_INIT_MP3 = 0x00000008, MIX_INIT_OGG = 0x00000010, - MIX_INIT_MID = 0x00000020 + MIX_INIT_MID = 0x00000020, + MIX_INIT_OPUS = 0x00000040 } MIX_InitFlags; /* Loads dynamic libraries and prepares them for use. Flags should be @@ -134,7 +135,8 @@ typedef enum { MUS_MP3, MUS_MP3_MAD_UNUSED, MUS_FLAC, - MUS_MODPLUG_UNUSED + MUS_MODPLUG_UNUSED, + MUS_OPUS } Mix_MusicType; /* The internal format for a music chunk interpreted via mikmod */ diff --git a/libs/SDL2_mixer/lib/x64/LICENSE.FLAC.txt b/libs/SDL2_mixer/lib/x64/LICENSE.FLAC.txt index 94fd3aa69..2e67b77cb 100644 --- a/libs/SDL2_mixer/lib/x64/LICENSE.FLAC.txt +++ b/libs/SDL2_mixer/lib/x64/LICENSE.FLAC.txt @@ -1,5 +1,5 @@ The source code to this library used with SDL_mixer can be found here: -http://www.libsdl.org/projects/SDL_mixer/libs/ +https://hg.libsdl.org/SDL_mixer/file/default/external --- Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson diff --git a/libs/SDL2_mixer/lib/x64/LICENSE.modplug.txt b/libs/SDL2_mixer/lib/x64/LICENSE.modplug.txt index 59fbf826c..a89532db8 100644 --- a/libs/SDL2_mixer/lib/x64/LICENSE.modplug.txt +++ b/libs/SDL2_mixer/lib/x64/LICENSE.modplug.txt @@ -1 +1,5 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + ModPlug-XMMS and libmodplug are now in the public domain. diff --git a/libs/SDL2_mixer/lib/x64/LICENSE.mpg123.txt b/libs/SDL2_mixer/lib/x64/LICENSE.mpg123.txt index d7bb85fc3..2111cd79f 100644 --- a/libs/SDL2_mixer/lib/x64/LICENSE.mpg123.txt +++ b/libs/SDL2_mixer/lib/x64/LICENSE.mpg123.txt @@ -1,3 +1,7 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + This is the file that contains the terms of use, copying, etc. for the mpg123 distribution package. Main message, to include in "About ..." boxes, etc: diff --git a/libs/SDL2_mixer/lib/x64/LICENSE.ogg-vorbis.txt b/libs/SDL2_mixer/lib/x64/LICENSE.ogg-vorbis.txt index c2cb6d56e..6456dc4ed 100644 --- a/libs/SDL2_mixer/lib/x64/LICENSE.ogg-vorbis.txt +++ b/libs/SDL2_mixer/lib/x64/LICENSE.ogg-vorbis.txt @@ -1,5 +1,5 @@ The source code to this library used with SDL_mixer can be found here: -http://www.libsdl.org/projects/SDL_mixer/libs/ +https://hg.libsdl.org/SDL_image/file/default/external --- Copyright (c) 2002-2008 Xiph.org Foundation diff --git a/libs/SDL2_mixer/lib/x64/LICENSE.opus.txt b/libs/SDL2_mixer/lib/x64/LICENSE.opus.txt new file mode 100644 index 000000000..adb56a854 --- /dev/null +++ b/libs/SDL2_mixer/lib/x64/LICENSE.opus.txt @@ -0,0 +1,48 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + +Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic, + Jean-Marc Valin, Timothy B. Terriberry, + CSIRO, Gregory Maxwell, Mark Borgerding, + Erik de Castro Lopo + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of Internet Society, IETF or IETF Trust, nor the +names of specific contributors, may be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Opus is subject to the royalty-free patent licenses which are +specified at: + +Xiph.Org Foundation: +https://datatracker.ietf.org/ipr/1524/ + +Microsoft Corporation: +https://datatracker.ietf.org/ipr/1914/ + +Broadcom Corporation: +https://datatracker.ietf.org/ipr/1526/ diff --git a/libs/SDL2_mixer/lib/x64/LICENSE.opusfile.txt b/libs/SDL2_mixer/lib/x64/LICENSE.opusfile.txt new file mode 100644 index 000000000..dfc9681fc --- /dev/null +++ b/libs/SDL2_mixer/lib/x64/LICENSE.opusfile.txt @@ -0,0 +1,32 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + +Copyright (c) 1994-2013 Xiph.Org Foundation and contributors + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.Org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/libs/SDL2_mixer/lib/x64/SDL2_mixer.dll b/libs/SDL2_mixer/lib/x64/SDL2_mixer.dll old mode 100755 new mode 100644 index 116bb1df6..40bb1c146 Binary files a/libs/SDL2_mixer/lib/x64/SDL2_mixer.dll and b/libs/SDL2_mixer/lib/x64/SDL2_mixer.dll differ diff --git a/libs/SDL2_mixer/lib/x64/SDL2_mixer.lib b/libs/SDL2_mixer/lib/x64/SDL2_mixer.lib old mode 100755 new mode 100644 diff --git a/libs/SDL2_mixer/lib/x64/libFLAC-8.dll b/libs/SDL2_mixer/lib/x64/libFLAC-8.dll old mode 100755 new mode 100644 index b5603902d..71f2e19d9 Binary files a/libs/SDL2_mixer/lib/x64/libFLAC-8.dll and b/libs/SDL2_mixer/lib/x64/libFLAC-8.dll differ diff --git a/libs/SDL2_mixer/lib/x64/libmodplug-1.dll b/libs/SDL2_mixer/lib/x64/libmodplug-1.dll old mode 100755 new mode 100644 index 31509378b..7c0512674 Binary files a/libs/SDL2_mixer/lib/x64/libmodplug-1.dll and b/libs/SDL2_mixer/lib/x64/libmodplug-1.dll differ diff --git a/libs/SDL2_mixer/lib/x64/libmpg123-0.dll b/libs/SDL2_mixer/lib/x64/libmpg123-0.dll old mode 100755 new mode 100644 index d222d2dc5..c7809b163 Binary files a/libs/SDL2_mixer/lib/x64/libmpg123-0.dll and b/libs/SDL2_mixer/lib/x64/libmpg123-0.dll differ diff --git a/libs/SDL2_mixer/lib/x64/libogg-0.dll b/libs/SDL2_mixer/lib/x64/libogg-0.dll old mode 100755 new mode 100644 index 7b94e6032..513348159 Binary files a/libs/SDL2_mixer/lib/x64/libogg-0.dll and b/libs/SDL2_mixer/lib/x64/libogg-0.dll differ diff --git a/libs/SDL2_mixer/lib/x64/libopus-0.dll b/libs/SDL2_mixer/lib/x64/libopus-0.dll new file mode 100644 index 000000000..9ba6c3860 Binary files /dev/null and b/libs/SDL2_mixer/lib/x64/libopus-0.dll differ diff --git a/libs/SDL2_mixer/lib/x64/libopusfile-0.dll b/libs/SDL2_mixer/lib/x64/libopusfile-0.dll new file mode 100644 index 000000000..97a88b610 Binary files /dev/null and b/libs/SDL2_mixer/lib/x64/libopusfile-0.dll differ diff --git a/libs/SDL2_mixer/lib/x64/libvorbis-0.dll b/libs/SDL2_mixer/lib/x64/libvorbis-0.dll old mode 100755 new mode 100644 index 8d8d6537b..f5ae1bf75 Binary files a/libs/SDL2_mixer/lib/x64/libvorbis-0.dll and b/libs/SDL2_mixer/lib/x64/libvorbis-0.dll differ diff --git a/libs/SDL2_mixer/lib/x64/libvorbisfile-3.dll b/libs/SDL2_mixer/lib/x64/libvorbisfile-3.dll old mode 100755 new mode 100644 index 08f8f7aa8..d0787368a Binary files a/libs/SDL2_mixer/lib/x64/libvorbisfile-3.dll and b/libs/SDL2_mixer/lib/x64/libvorbisfile-3.dll differ diff --git a/libs/SDL2_mixer/lib/x86/LICENSE.FLAC.txt b/libs/SDL2_mixer/lib/x86/LICENSE.FLAC.txt index 94fd3aa69..2e67b77cb 100644 --- a/libs/SDL2_mixer/lib/x86/LICENSE.FLAC.txt +++ b/libs/SDL2_mixer/lib/x86/LICENSE.FLAC.txt @@ -1,5 +1,5 @@ The source code to this library used with SDL_mixer can be found here: -http://www.libsdl.org/projects/SDL_mixer/libs/ +https://hg.libsdl.org/SDL_mixer/file/default/external --- Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson diff --git a/libs/SDL2_mixer/lib/x86/LICENSE.modplug.txt b/libs/SDL2_mixer/lib/x86/LICENSE.modplug.txt index 59fbf826c..a89532db8 100644 --- a/libs/SDL2_mixer/lib/x86/LICENSE.modplug.txt +++ b/libs/SDL2_mixer/lib/x86/LICENSE.modplug.txt @@ -1 +1,5 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + ModPlug-XMMS and libmodplug are now in the public domain. diff --git a/libs/SDL2_mixer/lib/x86/LICENSE.mpg123.txt b/libs/SDL2_mixer/lib/x86/LICENSE.mpg123.txt index d7bb85fc3..2111cd79f 100644 --- a/libs/SDL2_mixer/lib/x86/LICENSE.mpg123.txt +++ b/libs/SDL2_mixer/lib/x86/LICENSE.mpg123.txt @@ -1,3 +1,7 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + This is the file that contains the terms of use, copying, etc. for the mpg123 distribution package. Main message, to include in "About ..." boxes, etc: diff --git a/libs/SDL2_mixer/lib/x86/LICENSE.ogg-vorbis.txt b/libs/SDL2_mixer/lib/x86/LICENSE.ogg-vorbis.txt index c2cb6d56e..6456dc4ed 100644 --- a/libs/SDL2_mixer/lib/x86/LICENSE.ogg-vorbis.txt +++ b/libs/SDL2_mixer/lib/x86/LICENSE.ogg-vorbis.txt @@ -1,5 +1,5 @@ The source code to this library used with SDL_mixer can be found here: -http://www.libsdl.org/projects/SDL_mixer/libs/ +https://hg.libsdl.org/SDL_image/file/default/external --- Copyright (c) 2002-2008 Xiph.org Foundation diff --git a/libs/SDL2_mixer/lib/x86/LICENSE.opus.txt b/libs/SDL2_mixer/lib/x86/LICENSE.opus.txt new file mode 100644 index 000000000..adb56a854 --- /dev/null +++ b/libs/SDL2_mixer/lib/x86/LICENSE.opus.txt @@ -0,0 +1,48 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + +Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic, + Jean-Marc Valin, Timothy B. Terriberry, + CSIRO, Gregory Maxwell, Mark Borgerding, + Erik de Castro Lopo + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of Internet Society, IETF or IETF Trust, nor the +names of specific contributors, may be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Opus is subject to the royalty-free patent licenses which are +specified at: + +Xiph.Org Foundation: +https://datatracker.ietf.org/ipr/1524/ + +Microsoft Corporation: +https://datatracker.ietf.org/ipr/1914/ + +Broadcom Corporation: +https://datatracker.ietf.org/ipr/1526/ diff --git a/libs/SDL2_mixer/lib/x86/LICENSE.opusfile.txt b/libs/SDL2_mixer/lib/x86/LICENSE.opusfile.txt new file mode 100644 index 000000000..dfc9681fc --- /dev/null +++ b/libs/SDL2_mixer/lib/x86/LICENSE.opusfile.txt @@ -0,0 +1,32 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + +Copyright (c) 1994-2013 Xiph.Org Foundation and contributors + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.Org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/libs/SDL2_mixer/lib/x86/SDL2_mixer.dll b/libs/SDL2_mixer/lib/x86/SDL2_mixer.dll old mode 100755 new mode 100644 index 54ebbb1d4..96abfa1ab Binary files a/libs/SDL2_mixer/lib/x86/SDL2_mixer.dll and b/libs/SDL2_mixer/lib/x86/SDL2_mixer.dll differ diff --git a/libs/SDL2_mixer/lib/x86/SDL2_mixer.lib b/libs/SDL2_mixer/lib/x86/SDL2_mixer.lib old mode 100755 new mode 100644 diff --git a/libs/SDL2_mixer/lib/x86/libFLAC-8.dll b/libs/SDL2_mixer/lib/x86/libFLAC-8.dll old mode 100755 new mode 100644 index 1c55ad496..b56ea2a8c Binary files a/libs/SDL2_mixer/lib/x86/libFLAC-8.dll and b/libs/SDL2_mixer/lib/x86/libFLAC-8.dll differ diff --git a/libs/SDL2_mixer/lib/x86/libmodplug-1.dll b/libs/SDL2_mixer/lib/x86/libmodplug-1.dll old mode 100755 new mode 100644 index a2cba0d6b..d66a317dd Binary files a/libs/SDL2_mixer/lib/x86/libmodplug-1.dll and b/libs/SDL2_mixer/lib/x86/libmodplug-1.dll differ diff --git a/libs/SDL2_mixer/lib/x86/libmpg123-0.dll b/libs/SDL2_mixer/lib/x86/libmpg123-0.dll old mode 100755 new mode 100644 index ca7de300d..240298bbf Binary files a/libs/SDL2_mixer/lib/x86/libmpg123-0.dll and b/libs/SDL2_mixer/lib/x86/libmpg123-0.dll differ diff --git a/libs/SDL2_mixer/lib/x86/libogg-0.dll b/libs/SDL2_mixer/lib/x86/libogg-0.dll old mode 100755 new mode 100644 index 3abe6ebfc..233c0f42a Binary files a/libs/SDL2_mixer/lib/x86/libogg-0.dll and b/libs/SDL2_mixer/lib/x86/libogg-0.dll differ diff --git a/libs/SDL2_mixer/lib/x86/libopus-0.dll b/libs/SDL2_mixer/lib/x86/libopus-0.dll new file mode 100644 index 000000000..94ea541d2 Binary files /dev/null and b/libs/SDL2_mixer/lib/x86/libopus-0.dll differ diff --git a/libs/SDL2_mixer/lib/x86/libopusfile-0.dll b/libs/SDL2_mixer/lib/x86/libopusfile-0.dll new file mode 100644 index 000000000..260796b6a Binary files /dev/null and b/libs/SDL2_mixer/lib/x86/libopusfile-0.dll differ diff --git a/libs/SDL2_mixer/lib/x86/libvorbis-0.dll b/libs/SDL2_mixer/lib/x86/libvorbis-0.dll old mode 100755 new mode 100644 index 4e44ef088..4e4aaa543 Binary files a/libs/SDL2_mixer/lib/x86/libvorbis-0.dll and b/libs/SDL2_mixer/lib/x86/libvorbis-0.dll differ diff --git a/libs/SDL2_mixer/lib/x86/libvorbisfile-3.dll b/libs/SDL2_mixer/lib/x86/libvorbisfile-3.dll old mode 100755 new mode 100644 index e757eb6de..5d90a235c Binary files a/libs/SDL2_mixer/lib/x86/libvorbisfile-3.dll and b/libs/SDL2_mixer/lib/x86/libvorbisfile-3.dll differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.FLAC.txt b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.FLAC.txt index 94fd3aa69..2e67b77cb 100644 --- a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.FLAC.txt +++ b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.FLAC.txt @@ -1,5 +1,5 @@ The source code to this library used with SDL_mixer can be found here: -http://www.libsdl.org/projects/SDL_mixer/libs/ +https://hg.libsdl.org/SDL_mixer/file/default/external --- Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.modplug.txt b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.modplug.txt index 59fbf826c..a89532db8 100644 --- a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.modplug.txt +++ b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.modplug.txt @@ -1 +1,5 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + ModPlug-XMMS and libmodplug are now in the public domain. diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.mpg123.txt b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.mpg123.txt index d7bb85fc3..2111cd79f 100644 --- a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.mpg123.txt +++ b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.mpg123.txt @@ -1,3 +1,7 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + This is the file that contains the terms of use, copying, etc. for the mpg123 distribution package. Main message, to include in "About ..." boxes, etc: diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.ogg-vorbis.txt b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.ogg-vorbis.txt index c2cb6d56e..6456dc4ed 100644 --- a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.ogg-vorbis.txt +++ b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.ogg-vorbis.txt @@ -1,5 +1,5 @@ The source code to this library used with SDL_mixer can be found here: -http://www.libsdl.org/projects/SDL_mixer/libs/ +https://hg.libsdl.org/SDL_image/file/default/external --- Copyright (c) 2002-2008 Xiph.org Foundation diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.opus.txt b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.opus.txt new file mode 100644 index 000000000..adb56a854 --- /dev/null +++ b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.opus.txt @@ -0,0 +1,48 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + +Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic, + Jean-Marc Valin, Timothy B. Terriberry, + CSIRO, Gregory Maxwell, Mark Borgerding, + Erik de Castro Lopo + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of Internet Society, IETF or IETF Trust, nor the +names of specific contributors, may be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Opus is subject to the royalty-free patent licenses which are +specified at: + +Xiph.Org Foundation: +https://datatracker.ietf.org/ipr/1524/ + +Microsoft Corporation: +https://datatracker.ietf.org/ipr/1914/ + +Broadcom Corporation: +https://datatracker.ietf.org/ipr/1526/ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.opusfile.txt b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.opusfile.txt new file mode 100644 index 000000000..dfc9681fc --- /dev/null +++ b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/LICENSE.opusfile.txt @@ -0,0 +1,32 @@ +The source code to this library used with SDL_mixer can be found here: +https://hg.libsdl.org/SDL_mixer/file/default/external +--- + +Copyright (c) 1994-2013 Xiph.Org Foundation and contributors + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +- Neither the name of the Xiph.Org Foundation nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION +OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/SDL2_mixer.dll b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/SDL2_mixer.dll index 116bb1df6..40bb1c146 100755 Binary files a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/SDL2_mixer.dll and b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/SDL2_mixer.dll differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libFLAC-8.dll b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libFLAC-8.dll index b5603902d..71f2e19d9 100755 Binary files a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libFLAC-8.dll and b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libFLAC-8.dll differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libmodplug-1.dll b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libmodplug-1.dll index 31509378b..7c0512674 100755 Binary files a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libmodplug-1.dll and b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libmodplug-1.dll differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libmpg123-0.dll b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libmpg123-0.dll index d222d2dc5..c7809b163 100755 Binary files a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libmpg123-0.dll and b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libmpg123-0.dll differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libogg-0.dll b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libogg-0.dll index 7b94e6032..513348159 100755 Binary files a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libogg-0.dll and b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libogg-0.dll differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libopus-0.dll b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libopus-0.dll new file mode 100644 index 000000000..9ba6c3860 Binary files /dev/null and b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libopus-0.dll differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libopusfile-0.dll b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libopusfile-0.dll new file mode 100644 index 000000000..97a88b610 Binary files /dev/null and b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libopusfile-0.dll differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libvorbis-0.dll b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libvorbis-0.dll index 8d8d6537b..f5ae1bf75 100755 Binary files a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libvorbis-0.dll and b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libvorbis-0.dll differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libvorbisfile-3.dll b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libvorbisfile-3.dll index 08f8f7aa8..d0787368a 100755 Binary files a/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libvorbisfile-3.dll and b/libs/SDL2_mixer/x86_64-w64-mingw32/bin/libvorbisfile-3.dll differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2/SDL_mixer.h b/libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2/SDL_mixer.h index cbb8ae6b6..009d8a2da 100644 --- a/libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2/SDL_mixer.h +++ b/libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2/SDL_mixer.h @@ -1,6 +1,6 @@ /* SDL_mixer: An audio mixer library based on the SDL library - Copyright (C) 1997-2017 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,7 +38,7 @@ extern "C" { */ #define SDL_MIXER_MAJOR_VERSION 2 #define SDL_MIXER_MINOR_VERSION 0 -#define SDL_MIXER_PATCHLEVEL 2 +#define SDL_MIXER_PATCHLEVEL 4 /* This macro can be used to fill a version structure with the compile-time * version of the SDL_mixer library. @@ -80,7 +80,8 @@ typedef enum MIX_INIT_MOD = 0x00000002, MIX_INIT_MP3 = 0x00000008, MIX_INIT_OGG = 0x00000010, - MIX_INIT_MID = 0x00000020 + MIX_INIT_MID = 0x00000020, + MIX_INIT_OPUS = 0x00000040 } MIX_InitFlags; /* Loads dynamic libraries and prepares them for use. Flags should be @@ -134,7 +135,8 @@ typedef enum { MUS_MP3, MUS_MP3_MAD_UNUSED, MUS_FLAC, - MUS_MODPLUG_UNUSED + MUS_MODPLUG_UNUSED, + MUS_OPUS } Mix_MusicType; /* The internal format for a music chunk interpreted via mikmod */ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/lib/libSDL2_mixer.a b/libs/SDL2_mixer/x86_64-w64-mingw32/lib/libSDL2_mixer.a index 7d39a1f63..b6483716e 100644 Binary files a/libs/SDL2_mixer/x86_64-w64-mingw32/lib/libSDL2_mixer.a and b/libs/SDL2_mixer/x86_64-w64-mingw32/lib/libSDL2_mixer.a differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/lib/libSDL2_mixer.dll.a b/libs/SDL2_mixer/x86_64-w64-mingw32/lib/libSDL2_mixer.dll.a index d812f5c85..82a4bef08 100755 Binary files a/libs/SDL2_mixer/x86_64-w64-mingw32/lib/libSDL2_mixer.dll.a and b/libs/SDL2_mixer/x86_64-w64-mingw32/lib/libSDL2_mixer.dll.a differ diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/lib/libSDL2_mixer.la b/libs/SDL2_mixer/x86_64-w64-mingw32/lib/libSDL2_mixer.la new file mode 100644 index 000000000..dba212c5a --- /dev/null +++ b/libs/SDL2_mixer/x86_64-w64-mingw32/lib/libSDL2_mixer.la @@ -0,0 +1,41 @@ +# libSDL2_mixer.la - a libtool library file +# Generated by ltmain.sh (GNU libtool) 2.2.6 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='../bin/SDL2_mixer.dll' + +# Names of this library. +library_names='libSDL2_mixer.dll.a' + +# The name of the static archive. +old_library='libSDL2_mixer.a' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -L/opt/local/x86_64-w64-mingw32/lib -lmingw32 /opt/local/x86_64-w64-mingw32/lib/libSDL2.la -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -lwinmm' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libSDL2_mixer. +current=2 +age=2 +revision=2 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/Users/valve/release/SDL_mixer/SDL2_mixer-2.0.4/x86_64-w64-mingw32/lib' diff --git a/libs/SDL2_mixer/x86_64-w64-mingw32/lib/pkgconfig/SDL2_mixer.pc b/libs/SDL2_mixer/x86_64-w64-mingw32/lib/pkgconfig/SDL2_mixer.pc index 56c30ccfe..b7984169f 100644 --- a/libs/SDL2_mixer/x86_64-w64-mingw32/lib/pkgconfig/SDL2_mixer.pc +++ b/libs/SDL2_mixer/x86_64-w64-mingw32/lib/pkgconfig/SDL2_mixer.pc @@ -1,11 +1,11 @@ -prefix=/usr/local/x86_64-w64-mingw32 +prefix=/opt/local/x86_64-w64-mingw32 exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: SDL2_mixer Description: mixer library for Simple DirectMedia Layer -Version: 2.0.2 +Version: 2.0.4 Requires: sdl2 >= 2.0.7 Libs: -L${libdir} -lSDL2_mixer Cflags: -I${includedir}/SDL2 diff --git a/libs/gme/win64/libgme.dll.a b/libs/gme/win64/libgme.dll.a new file mode 100644 index 000000000..38079dc2a Binary files /dev/null and b/libs/gme/win64/libgme.dll.a differ diff --git a/src/Makefile b/src/Makefile index f2d532cd5..8dda87564 100644 --- a/src/Makefile +++ b/src/Makefile @@ -64,6 +64,7 @@ # Compile without 3D sound support, add 'NOHS=1' # Compile with GDBstubs, add 'RDB=1' # Compile without PNG, add 'NOPNG=1' +# Compile without zlib, add 'NOZLIB=1' # # Addon for SDL: # To Cross-Compile, add 'SDL_CONFIG=/usr/*/bin/sdl-config' @@ -107,6 +108,7 @@ include Makefile.cfg ifdef DUMMY NOPNG=1 +NOZLIB=1 NONET=1 NOHW=1 NOHS=1 @@ -142,6 +144,11 @@ ifdef MINGW include win32/Makefile.cfg endif #ifdef MINGW +ifdef MINGW64 +MINGW=1 +include win32/Makefile.cfg +endif #ifdef MINGW64 + ifdef UNIX UNIXCOMMON=1 endif @@ -269,13 +276,6 @@ LIBS+=$(PNG_LDFLAGS) CFLAGS+=$(PNG_CFLAGS) endif -ZLIB_PKGCONFIG?=zlib -ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags) -ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs) - -LIBS+=$(ZLIB_LDFLAGS) -CFLAGS+=$(ZLIB_CFLAGS) - ifdef HAVE_LIBGME OPTS+=-DHAVE_LIBGME @@ -287,6 +287,18 @@ LIBS+=$(LIBGME_LDFLAGS) CFLAGS+=$(LIBGME_CFLAGS) endif +ifndef NOZLIB +OPTS+=-DHAVE_ZLIB +ZLIB_PKGCONFIG?=zlib +ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags) +ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs) + +LIBS+=$(ZLIB_LDFLAGS) +CFLAGS+=$(ZLIB_CFLAGS) +else +NOPNG=1 +endif + ifdef STATIC LIBS:=-static $(LIBS) endif @@ -601,7 +613,6 @@ $(BIN)/s_openal.so: $(OBJDIR)/s_openal.o -$(MKDIR) $(BIN) @echo Linking S_OpenAL.so... $(CC) --shared $^ -o $@ -g --nostartfiles -lm -lopenal - endif else diff --git a/src/Makefile.cfg b/src/Makefile.cfg index da4f220a9..6a1367275 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -221,6 +221,7 @@ ifndef LINUX ifndef FREEBSD ifndef CYGWIN32 ifndef MINGW +ifndef MINGW64 ifndef SDL ifndef DUMMY DJGPPDOS=1 @@ -230,6 +231,7 @@ endif endif endif endif +endif #determine the interface directory (where you put all i_*.c) i_cdmus_o=$(OBJDIR)/i_cdmus.o diff --git a/src/android/i_sound.c b/src/android/i_sound.c index ecf96f2f0..2bb304424 100644 --- a/src/android/i_sound.c +++ b/src/android/i_sound.c @@ -21,13 +21,14 @@ void I_ShutdownSound(void){} // SFX I/O // -INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority) +INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority, INT32 channel) { (void)id; (void)vol; (void)sep; (void)pitch; (void)priority; + (void)channel; return -1; } @@ -55,90 +56,87 @@ void I_SetSfxVolume(INT32 volume) (void)volume; } -// -// MUSIC I/O -// +/// ------------------------ +// MUSIC SYSTEM +/// ------------------------ + UINT8 music_started = 0; +UINT8 digmusic_started = 0; void I_InitMusic(void){} void I_ShutdownMusic(void){} -void I_PauseSong(INT32 handle) +/// ------------------------ +// MUSIC PROPERTIES +/// ------------------------ + +musictype_t I_SongType(void) { - (void)handle; + return MU_NONE; } -void I_ResumeSong(INT32 handle) +boolean I_SongPlaying(void) { - (void)handle; + return false; } -// -// MIDI I/O -// - -UINT8 midimusic_started = 0; - -void I_InitMIDIMusic(void){} - -void I_ShutdownMIDIMusic(void){} - -void I_SetMIDIMusicVolume(INT32 volume) +boolean I_SongPaused(void) { - (void)volume; + return false; } -INT32 I_RegisterSong(void *data, size_t len) -{ - (void)data; - (void)len; - return -1; -} - -boolean I_PlaySong(INT32 handle, INT32 looping) -{ - (void)handle; - (void)looping; - return false; -} - -void I_StopSong(INT32 handle) -{ - (void)handle; -} - -void I_UnRegisterSong(INT32 handle) -{ - (void)handle; -} - -// -// DIGMUSIC I/O -// - -UINT8 digmusic_started = 0; - -void I_InitDigMusic(void){} - -void I_ShutdownDigMusic(void){} - -boolean I_StartDigSong(const char *musicname, INT32 looping) -{ - (void)musicname; - (void)looping; - return false; -} - -void I_StopDigSong(void){} - -void I_SetDigMusicVolume(INT32 volume) -{ - (void)volume; -} +/// ------------------------ +// MUSIC EFFECTS +/// ------------------------ boolean I_SetSongSpeed(float speed) { (void)speed; return false; } + +/// ------------------------ +// MUSIC PLAYBACK +/// ------------------------ + +UINT8 midimusic_started = 0; + +boolean I_LoadSong(char *data, size_t len) +{ + (void)data; + (void)len; + return -1; +} + +void I_UnloadSong() +{ + +} + +boolean I_PlaySong(boolean looping) +{ + (void)handle; + (void)looping; + return false; +} + +void I_StopSong(void) +{ + (void)handle; +} + +void I_PauseSong(void) +{ + (void)handle; +} + +void I_ResumeSong(void) +{ + (void)handle; +} + +void I_SetMusicVolume(INT32 volume) +{ + (void)volume; +} diff --git a/src/byteptr.h b/src/byteptr.h index 410d7c004..364e6520c 100644 --- a/src/byteptr.h +++ b/src/byteptr.h @@ -15,7 +15,9 @@ #define DEALIGNED #endif -#ifndef _BIG_ENDIAN +#include "endian.h" + +#ifndef SRB2_BIG_ENDIAN // // Little-endian machines // @@ -75,7 +77,7 @@ #define READANGLE(p) *((angle_t *)p)++ #endif -#else //_BIG_ENDIAN +#else //SRB2_BIG_ENDIAN // // definitions for big-endian machines with alignment constraints. // @@ -144,7 +146,7 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr) #define READCHAR(p) ({ char *p_tmp = ( char *)p; char b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; }) #define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b = readlong(p); p_tmp++; p = (void *)p_tmp; b; }) #define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b = readulong(p); p_tmp++; p = (void *)p_tmp; b; }) -#endif //_BIG_ENDIAN +#endif //SRB2_BIG_ENDIAN #undef DEALIGNED diff --git a/src/command.c b/src/command.c index 62431b664..10af3a576 100644 --- a/src/command.c +++ b/src/command.c @@ -63,6 +63,7 @@ CV_PossibleValue_t CV_Unsigned[] = {{0, "MIN"}, {999999999, "MAX"}, {0, NULL}}; CV_PossibleValue_t CV_Natural[] = {{1, "MIN"}, {999999999, "MAX"}, {0, NULL}}; #define COM_BUF_SIZE 8192 // command buffer size +#define MAX_ALIAS_RECURSION 100 // max recursion allowed for aliases static INT32 com_wait; // one command per frame (for cmd sequences) @@ -485,6 +486,7 @@ static void COM_ExecuteString(char *ptext) { xcommand_t *cmd; cmdalias_t *a; + static INT32 recursion = 0; // detects recursion and stops it if it goes too far COM_TokenizeString(ptext); @@ -497,6 +499,7 @@ static void COM_ExecuteString(char *ptext) { if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase! { + recursion = 0; cmd->function(); return; } @@ -507,11 +510,20 @@ static void COM_ExecuteString(char *ptext) { if (!stricmp(com_argv[0], a->name)) { + if (recursion > MAX_ALIAS_RECURSION) + { + CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n")); + recursion = 0; + return; + } + recursion++; COM_BufInsertText(a->value); return; } } + recursion = 0; + // check cvars // Hurdler: added at Ebola's request ;) // (don't flood the console in software mode with bad gr_xxx command) diff --git a/src/console.c b/src/console.c index 9bc01cf19..f4234d949 100644 --- a/src/console.c +++ b/src/console.c @@ -232,18 +232,20 @@ UINT8 *yellowmap, *magentamap, *lgreenmap, *bluemap, *graymap, *redmap, *orangem // Console BG color UINT8 *consolebgmap = NULL; +UINT8 *promptbgmap = NULL; +static UINT8 promptbgcolor = UINT8_MAX; -void CON_SetupBackColormap(void) +void CON_SetupBackColormapEx(INT32 color, boolean prompt) { UINT16 i, palsum; UINT8 j, palindex, shift; UINT8 *pal = W_CacheLumpName(GetPalette(), PU_CACHE); - if (!consolebgmap) - consolebgmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); + if (color == INT32_MAX) + color = cons_backcolor.value; shift = 6; // 12 colors -- shift of 7 means 6 colors - switch (cons_backcolor.value) + switch (color) { case 0: palindex = 15; break; // White case 1: palindex = 31; break; // Gray @@ -257,20 +259,42 @@ void CON_SetupBackColormap(void) case 9: palindex = 187; break; // Magenta case 10: palindex = 139; break; // Aqua // Default green - default: palindex = 175; break; -} + default: palindex = 175; color = 11; break; + } + + if (prompt) + { + if (!promptbgmap) + promptbgmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); + + if (color == promptbgcolor) + return; + else + promptbgcolor = color; + } + else if (!consolebgmap) + consolebgmap = (UINT8 *)Z_Malloc(256, PU_STATIC, NULL); // setup background colormap for (i = 0, j = 0; i < 768; i += 3, j++) { palsum = (pal[i] + pal[i+1] + pal[i+2]) >> shift; - consolebgmap[j] = (UINT8)(palindex - palsum); + if (prompt) + promptbgmap[j] = (UINT8)(palindex - palsum); + else + consolebgmap[j] = (UINT8)(palindex - palsum); } } +void CON_SetupBackColormap(void) +{ + CON_SetupBackColormapEx(cons_backcolor.value, false); + CON_SetupBackColormapEx(1, true); // default to gray +} + static void CONS_backcolor_Change(void) { - CON_SetupBackColormap(); + CON_SetupBackColormapEx(cons_backcolor.value, false); } static void CON_SetupColormaps(void) diff --git a/src/console.h b/src/console.h index 970f841d0..c194f44bf 100644 --- a/src/console.h +++ b/src/console.h @@ -38,7 +38,9 @@ extern UINT8 *yellowmap, *magentamap, *lgreenmap, *bluemap, *graymap, *redmap, * // Console bg color (auto updated to match) extern UINT8 *consolebgmap; +extern UINT8 *promptbgmap; +void CON_SetupBackColormapEx(INT32 color, boolean prompt); void CON_SetupBackColormap(void); void CON_ClearHUD(void); // clear heads up messages diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 92da2492e..af2c1f762 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2353,7 +2353,7 @@ void CL_ClearPlayer(INT32 playernum) // // Removes a player from the current game // -static void CL_RemovePlayer(INT32 playernum) +static void CL_RemovePlayer(INT32 playernum, INT32 reason) { // Sanity check: exceptional cases (i.e. c-fails) can cause multiple // kick commands to be issued for the same player. @@ -2408,6 +2408,10 @@ static void CL_RemovePlayer(INT32 playernum) } } +#ifdef HAVE_BLUA + LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting +#endif + // Reset player data CL_ClearPlayer(playernum); @@ -2683,6 +2687,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) INT32 pnum, msg; char buf[3 + MAX_REASONLENGTH]; char *reason = buf; + kickreason_t kickreason = KR_KICK; pnum = READUINT8(*p); msg = READUINT8(*p); @@ -2765,14 +2770,17 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) { case KICK_MSG_GO_AWAY: CONS_Printf(M_GetText("has been kicked (Go away)\n")); + kickreason = KR_KICK; break; #ifdef NEWPING case KICK_MSG_PING_HIGH: CONS_Printf(M_GetText("left the game (Broke ping limit)\n")); + kickreason = KR_PINGLIMIT; break; #endif case KICK_MSG_CON_FAIL: CONS_Printf(M_GetText("left the game (Synch failure)\n")); + kickreason = KR_SYNCH; if (M_CheckParm("-consisdump")) // Helps debugging some problems { @@ -2809,21 +2817,26 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) break; case KICK_MSG_TIMEOUT: CONS_Printf(M_GetText("left the game (Connection timeout)\n")); + kickreason = KR_TIMEOUT; break; case KICK_MSG_PLAYER_QUIT: if (netgame) // not splitscreen/bots CONS_Printf(M_GetText("left the game\n")); + kickreason = KR_LEAVE; break; case KICK_MSG_BANNED: CONS_Printf(M_GetText("has been banned (Don't come back)\n")); + kickreason = KR_BAN; break; case KICK_MSG_CUSTOM_KICK: READSTRINGN(*p, reason, MAX_REASONLENGTH+1); CONS_Printf(M_GetText("has been kicked (%s)\n"), reason); + kickreason = KR_KICK; break; case KICK_MSG_CUSTOM_BAN: READSTRINGN(*p, reason, MAX_REASONLENGTH+1); CONS_Printf(M_GetText("has been banned (%s)\n"), reason); + kickreason = KR_BAN; break; } @@ -2851,7 +2864,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) M_StartMessage(M_GetText("You have been kicked by the server\n\nPress ESC\n"), NULL, MM_NOTHING); } else - CL_RemovePlayer(pnum); + CL_RemovePlayer(pnum, kickreason); } consvar_t cv_allownewplayer = {"allowjoin", "On", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL }; @@ -3108,16 +3121,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) displayplayer = newplayernum; secondarydisplayplayer = newplayernum; DEBFILE("spawning me\n"); - // Apply player flags as soon as possible! - players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE|PF_DIRECTIONCHAR|PF_AUTOBRAKE); - if (cv_flipcam.value) - players[newplayernum].pflags |= PF_FLIPCAM; - if (cv_analog.value) - players[newplayernum].pflags |= PF_ANALOGMODE; - if (cv_directionchar.value) - players[newplayernum].pflags |= PF_DIRECTIONCHAR; - if (cv_autobrake.value) - players[newplayernum].pflags |= PF_AUTOBRAKE; } else { @@ -3125,16 +3128,6 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) DEBFILE("spawning my brother\n"); if (botingame) players[newplayernum].bot = 1; - // Same goes for player 2 when relevant - players[newplayernum].pflags &= ~(PF_FLIPCAM|PF_ANALOGMODE|PF_DIRECTIONCHAR|PF_AUTOBRAKE); - if (cv_flipcam2.value) - players[newplayernum].pflags |= PF_FLIPCAM; - if (cv_analog2.value) - players[newplayernum].pflags |= PF_ANALOGMODE; - if (cv_directionchar2.value) - players[newplayernum].pflags |= PF_DIRECTIONCHAR; - if (cv_autobrake2.value) - players[newplayernum].pflags |= PF_AUTOBRAKE; } D_SendPlayerConfig(); addedtogame = true; diff --git a/src/d_clisrv.h b/src/d_clisrv.h index bdb85a76c..d5edd79d7 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -454,6 +454,17 @@ extern consvar_t cv_playbackspeed; #define KICK_MSG_CUSTOM_KICK 7 #define KICK_MSG_CUSTOM_BAN 8 +typedef enum +{ + KR_KICK = 1, //Kicked by server + KR_PINGLIMIT = 2, //Broke Ping Limit + KR_SYNCH = 3, //Synch Failure + KR_TIMEOUT = 4, //Connection Timeout + KR_BAN = 5, //Banned by server + KR_LEAVE = 6, //Quit the game + +} kickreason_t; + extern boolean server; #define client (!server) extern boolean dedicated; // For dedicated server diff --git a/src/d_main.c b/src/d_main.c index a2a51d3ff..c7708acf1 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -71,6 +71,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...); #include "fastcmp.h" #include "keys.h" #include "filesrch.h" // refreshdirmenu, mainwadstally +#include "g_input.h" // tutorial mode control scheming #ifdef CMAKECONFIG #include "config.h" @@ -112,13 +113,10 @@ INT32 postimgparam; postimg_t postimgtype2 = postimg_none; INT32 postimgparam2; -boolean nomidimusic = false, nosound = false; -boolean nodigimusic = false; // No fmod-based music - // These variables are only true if -// the respective sound system is initialized -// and active, but no sounds/music should play. -boolean music_disabled = false; +// whether the respective sound system is disabled +// or they're init'ed, but the player just toggled them +boolean midi_disabled = false; boolean sound_disabled = false; boolean digital_disabled = false; @@ -154,7 +152,7 @@ void D_PostEvent(const event_t *ev) eventhead = (eventhead+1) & (MAXEVENTS-1); } // just for lock this function -#ifndef DOXYGEN +#if defined (PC_DOS) && !defined (DOXYGEN) void D_PostEvent_end(void) {}; #endif @@ -434,6 +432,7 @@ static void D_Display(void) if (gamestate == GS_LEVEL) { ST_Drawer(); + F_TextPromptDrawer(); HU_Drawer(); } else @@ -748,6 +747,19 @@ void D_StartTitle(void) // Reset the palette if (rendermode != render_none) V_SetPaletteLump("PLAYPAL"); + + // The title screen is obviously not a tutorial! (Unless I'm mistaken) + if (tutorialmode && tutorialgcs) + { + G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gcl_tutorial_full, num_gcl_tutorial_full); // using gcs_custom as temp storage + CV_SetValue(&cv_usemouse, tutorialusemouse); + CV_SetValue(&cv_alwaysfreelook, tutorialfreelook); + CV_SetValue(&cv_mousemove, tutorialmousemove); + CV_SetValue(&cv_analog, tutorialanalog); + M_StartMessage("Do you want to \x82save the recommended \x82movement controls?\x80\n\nPress 'Y' or 'Enter' to confirm\nPress 'N' or any key to keep \nyour current controls", + M_TutorialSaveControlResponse, MM_YESNO); + } + tutorialmode = false; } // @@ -781,10 +793,6 @@ static inline void D_CleanFile(void) } } -#ifndef _MAX_PATH -#define _MAX_PATH MAX_WADPATH -#endif - // ========================================================================== // Identify the SRB2 version, and IWAD file to use. // ========================================================================== @@ -1204,27 +1212,27 @@ void D_SRB2Main(void) // setting up sound if (dedicated) { - nosound = true; - nomidimusic = nodigimusic = true; + sound_disabled = true; + midi_disabled = digital_disabled = true; } else { - CONS_Printf("S_Init(): Setting up sound.\n"); + CONS_Printf("S_InitSfxChannels(): Setting up sound channels.\n"); } if (M_CheckParm("-nosound")) - nosound = true; + sound_disabled = true; if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic - nomidimusic = nodigimusic = true; + midi_disabled = digital_disabled = true; else { if (M_CheckParm("-nomidimusic")) - nomidimusic = true; ; // WARNING: DOS version initmusic in I_StartupSound + midi_disabled = true; ; // WARNING: DOS version initmusic in I_StartupSound if (M_CheckParm("-nodigmusic")) - nodigimusic = true; // WARNING: DOS version initmusic in I_StartupSound + digital_disabled = true; // WARNING: DOS version initmusic in I_StartupSound } I_StartupSound(); I_InitMusic(); - S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); + S_InitSfxChannels(cv_soundvolume.value); CONS_Printf("ST_Init(): Init status bar.\n"); ST_Init(); diff --git a/src/d_main.h b/src/d_main.h index d73b19d1f..4c9c99ea5 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -40,8 +40,8 @@ void D_SRB2Main(void); // Called by IO functions when input is detected. void D_PostEvent(const event_t *ev); -#ifndef DOXYGEN -FUNCMATH void D_PostEvent_end(void); // delimiter for locking memory +#if defined (PC_DOS) && !defined (DOXYGEN) +void D_PostEvent_end(void); // delimiter for locking memory #endif void D_ProcessEvents(void); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 3df0aa196..d17860243 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -126,8 +126,6 @@ FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void); static void Command_Playintro_f(void); static void Command_Displayplayer_f(void); -static void Command_Tunes_f(void); -static void Command_RestartAudio_f(void); static void Command_ExitLevel_f(void); static void Command_Showmap_f(void); @@ -315,8 +313,6 @@ consvar_t cv_timetic = {"timerres", "Classic", CV_SAVE, timetic_cons_t, NULL, 0, static CV_PossibleValue_t powerupdisplay_cons_t[] = {{0, "Never"}, {1, "First-person only"}, {2, "Always"}, {0, NULL}}; consvar_t cv_powerupdisplay = {"powerupdisplay", "First-person only", CV_SAVE, powerupdisplay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; - static CV_PossibleValue_t pointlimit_cons_t[] = {{0, "MIN"}, {999999990, "MAX"}, {0, NULL}}; consvar_t cv_pointlimit = {"pointlimit", "0", CV_NETVAR|CV_CALL|CV_NOINIT, pointlimit_cons_t, PointLimit_OnChange, 0, NULL, NULL, 0, 0, NULL}; @@ -685,9 +681,6 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_ghost_guest); COM_AddCommand("displayplayer", Command_Displayplayer_f); - COM_AddCommand("tunes", Command_Tunes_f); - COM_AddCommand("restartaudio", Command_RestartAudio_f); - CV_RegisterVar(&cv_resetmusic); // FIXME: not to be here.. but needs be done for config loading CV_RegisterVar(&cv_globalgamma); @@ -719,6 +712,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_crosshair2); CV_RegisterVar(&cv_alwaysfreelook); CV_RegisterVar(&cv_alwaysfreelook2); + CV_RegisterVar(&cv_tutorialprompt); // g_input.c CV_RegisterVar(&cv_sideaxis); @@ -1445,13 +1439,13 @@ void SendWeaponPref(void) UINT8 buf[1]; buf[0] = 0; - if (players[consoleplayer].pflags & PF_FLIPCAM) + if (cv_flipcam.value) buf[0] |= 1; - if (players[consoleplayer].pflags & PF_ANALOGMODE) + if (cv_analog.value) buf[0] |= 2; - if (players[consoleplayer].pflags & PF_DIRECTIONCHAR) + if (cv_directionchar.value) buf[0] |= 4; - if (players[consoleplayer].pflags & PF_AUTOBRAKE) + if (cv_autobrake.value) buf[0] |= 8; SendNetXCmd(XD_WEAPONPREF, buf, 1); } @@ -1461,13 +1455,13 @@ void SendWeaponPref2(void) UINT8 buf[1]; buf[0] = 0; - if (players[secondarydisplayplayer].pflags & PF_FLIPCAM) + if (cv_flipcam2.value) buf[0] |= 1; - if (players[secondarydisplayplayer].pflags & PF_ANALOGMODE) + if (cv_analog2.value) buf[0] |= 2; - if (players[secondarydisplayplayer].pflags & PF_DIRECTIONCHAR) + if (cv_directionchar2.value) buf[0] |= 4; - if (players[secondarydisplayplayer].pflags & PF_AUTOBRAKE) + if (cv_autobrake2.value) buf[0] |= 8; SendNetXCmd2(XD_WEAPONPREF, buf, 1); } @@ -1815,6 +1809,16 @@ static void Command_Map_f(void) else fromlevelselect = ((netgame || multiplayer) && ((gametype == newgametype) && (newgametype == GT_COOP))); + if (tutorialmode && tutorialgcs) + { + G_CopyControls(gamecontrol, gamecontroldefault[gcs_custom], gcl_tutorial_full, num_gcl_tutorial_full); // using gcs_custom as temp storage + CV_SetValue(&cv_usemouse, tutorialusemouse); + CV_SetValue(&cv_alwaysfreelook, tutorialfreelook); + CV_SetValue(&cv_mousemove, tutorialmousemove); + CV_SetValue(&cv_analog, tutorialanalog); + } + tutorialmode = false; // warping takes us out of tutorial mode + D_MapChange(newmapnum, newgametype, false, newresetplayers, 0, false, fromlevelselect); } @@ -2766,6 +2770,12 @@ static void Command_Login_f(void) UINT8 finalmd5[16]; const char *pw; + if (!netgame) + { + CONS_Printf(M_GetText("This only works in a netgame.\n")); + return; + } + // If the server uses login, it will effectively just remove admin privileges // from whoever has them. This is good. if (COM_Argc() != 2) @@ -2833,6 +2843,12 @@ static void Command_Verify_f(void) return; } + if (!netgame) + { + CONS_Printf(M_GetText("This only works in a netgame.\n")); + return; + } + if (COM_Argc() != 2) { CONS_Printf(M_GetText("verify : give admin privileges to a node\n")); @@ -3132,7 +3148,7 @@ static void Command_Addfile(void) WRITEMEM(buf_p, md5sum, 16); } - if (adminplayer == consoleplayer) // Request to add file + if (adminplayer == consoleplayer && (!server)) // Request to add file SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf); else SendNetXCmd(XD_ADDFILE, buf, buf_p - buf); @@ -3956,95 +3972,6 @@ static void Command_Displayplayer_f(void) CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayer); } -static void Command_Tunes_f(void) -{ - const char *tunearg; - UINT16 tunenum, track = 0; - const size_t argc = COM_Argc(); - - if (argc < 2) //tunes slot ... - { - CONS_Printf("tunes [track] [speed] / <-show> / <-default> / <-none>:\n"); - CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n")); - CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n")); - CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n")); - CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n")); - CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n")); - return; - } - - tunearg = COM_Argv(1); - tunenum = (UINT16)atoi(tunearg); - track = 0; - - if (!strcasecmp(tunearg, "-show")) - { - CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"), - mapmusname, (mapmusflags & MUSIC_TRACKMASK)); - return; - } - if (!strcasecmp(tunearg, "-none")) - { - S_StopMusic(); - return; - } - else if (!strcasecmp(tunearg, "-default")) - { - tunearg = mapheaderinfo[gamemap-1]->musname; - track = mapheaderinfo[gamemap-1]->mustrack; - } - else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z') - tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]); - - if (tunenum && tunenum >= 1036) - { - CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n")); - return; - } - if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case - CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n")); - - if (argc > 2) - track = (UINT16)atoi(COM_Argv(2))-1; - - if (tunenum) - snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum)); - else - strncpy(mapmusname, tunearg, 7); - mapmusname[6] = 0; - mapmusflags = (track & MUSIC_TRACKMASK); - - S_ChangeMusic(mapmusname, mapmusflags, true); - - if (argc > 3) - { - float speed = (float)atof(COM_Argv(3)); - if (speed > 0.0f) - S_SpeedMusic(speed); - } -} - -static void Command_RestartAudio_f(void) -{ - if (dedicated) // No point in doing anything if game is a dedicated server. - return; - - S_StopMusic(); - I_ShutdownMusic(); - I_ShutdownSound(); - I_StartupSound(); - I_InitMusic(); - -// These must be called or no sound and music until manually set. - - I_SetSfxVolume(cv_soundvolume.value); - I_SetDigMusicVolume(cv_digmusicvolume.value); - I_SetMIDIMusicVolume(cv_midimusicvolume.value); - if (Playing()) // Gotta make sure the player is in a level - P_RestoreMusic(&players[consoleplayer]); - -} - /** Quits a game and returns to the title screen. * */ diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 57e23b0f1..3ffa3f3f1 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -103,8 +103,6 @@ extern consvar_t cv_startinglives; // for F_finale.c extern consvar_t cv_rollingdemos; -extern consvar_t cv_resetmusic; - extern consvar_t cv_ringslinger, cv_soundtest; extern consvar_t cv_specialrings, cv_powerstones, cv_matchboxes, cv_competitionboxes; @@ -203,5 +201,3 @@ void D_SetPassword(const char *pw); UINT8 CanChangeSkin(INT32 playernum); #endif - - diff --git a/src/d_netfil.c b/src/d_netfil.c index e43ad77e2..92ecab950 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -87,7 +87,7 @@ static filetran_t transfer[MAXNETNODES]; // Receiver structure INT32 fileneedednum; // Number of files needed to join the server fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files -char downloaddir[256] = "DOWNLOAD"; +char downloaddir[512] = "DOWNLOAD"; #ifdef CLIENT_LOADINGSCREEN // for cl loading screen diff --git a/src/d_netfil.h b/src/d_netfil.h index 6fdd0a8a1..28d9d5a63 100644 --- a/src/d_netfil.h +++ b/src/d_netfil.h @@ -47,7 +47,7 @@ typedef struct extern INT32 fileneedednum; extern fileneeded_t fileneeded[MAX_WADFILES]; -extern char downloaddir[256]; +extern char downloaddir[512]; #ifdef CLIENT_LOADINGSCREEN extern INT32 lastfilenum; diff --git a/src/dehacked.c b/src/dehacked.c index 9b2cf7fc0..381f7e4fc 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -32,6 +32,7 @@ #include "fastcmp.h" #include "lua_script.h" #include "lua_hook.h" +#include "d_clisrv.h" #include "m_cond.h" @@ -165,9 +166,14 @@ static char *myhashfgets(char *buf, size_t bufsize, MYFILE *f) if (c == '\n') // Ensure debug line is right... dbg_line++; if (c == '#') + { + if (i > 0) // don't let i wrap past 0 + i--; // don't include hash char in string break; + } } - i++; + if (buf[i] != '#') // don't include hash char in string + i++; buf[i] = '\0'; return buf; @@ -914,7 +920,10 @@ static void readlevelheader(MYFILE *f, INT32 num) // Get the part before the " = " tmp = strchr(s, '='); - *(tmp-1) = '\0'; + if (tmp) + *(tmp-1) = '\0'; + else + break; strupr(word); // Now get the part after @@ -1196,8 +1205,10 @@ static void readlevelheader(MYFILE *f, INT32 num) else if (fastcmp(word2, "NORMAL")) i = 0; else if (fastcmp(word2, "BOSS")) i = 1; else if (fastcmp(word2, "ERZ3")) i = 2; + else if (fastcmp(word2, "NIGHTS")) i = 3; + else if (fastcmp(word2, "NIGHTSLINK")) i = 4; - if (i >= -1 && i <= 2) // -1 for no bonus. Max is 2. + if (i >= -1 && i <= 4) // -1 for no bonus. Max is 4. mapheaderinfo[num-1]->bonustype = (SINT8)i; else deh_warning("Level header %d: invalid bonus type number %d", num, i); @@ -1543,6 +1554,365 @@ static void readcutscene(MYFILE *f, INT32 num) Z_Free(s); } +static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum) +{ + char *s = Z_Calloc(MAXLINELEN, PU_STATIC, NULL); + char *word; + char *word2; + INT32 i; + UINT16 usi; + UINT8 picid; + + do + { + if (myfgets(s, MAXLINELEN, f)) + { + if (s[0] == '\n') + break; + + word = strtok(s, " "); + if (word) + strupr(word); + else + break; + + if (fastcmp(word, "PAGETEXT")) + { + char *pagetext = NULL; + char *buffer; + const int bufferlen = 4096; + + for (i = 0; i < MAXLINELEN; i++) + { + if (s[i] == '=') + { + pagetext = &s[i+2]; + break; + } + } + + if (!pagetext) + { + Z_Free(textprompts[num]->page[pagenum].text); + textprompts[num]->page[pagenum].text = NULL; + continue; + } + + for (i = 0; i < MAXLINELEN; i++) + { + if (s[i] == '\0') + { + s[i] = '\n'; + s[i+1] = '\0'; + break; + } + } + + buffer = Z_Malloc(4096, PU_STATIC, NULL); + strcpy(buffer, pagetext); + + // \todo trim trailing whitespace before the # + // and also support # at the end of a PAGETEXT with no line break + + strcat(buffer, + myhashfgets(pagetext, bufferlen + - strlen(buffer) - 1, f)); + + // A text prompt overwriting another one... + Z_Free(textprompts[num]->page[pagenum].text); + + textprompts[num]->page[pagenum].text = Z_StrDup(buffer); + + Z_Free(buffer); + + continue; + } + + word2 = strtok(NULL, " = "); + if (word2) + strupr(word2); + else + break; + + if (word2[strlen(word2)-1] == '\n') + word2[strlen(word2)-1] = '\0'; + i = atoi(word2); + usi = (UINT16)i; + + // copypasta from readcutscenescene + if (fastcmp(word, "NUMBEROFPICS")) + { + textprompts[num]->page[pagenum].numpics = (UINT8)i; + } + else if (fastcmp(word, "PICMODE")) + { + UINT8 picmode = 0; // PROMPT_PIC_PERSIST + if (usi == 1 || word2[0] == 'L') picmode = PROMPT_PIC_LOOP; + else if (usi == 2 || word2[0] == 'D' || word2[0] == 'H') picmode = PROMPT_PIC_DESTROY; + textprompts[num]->page[pagenum].picmode = picmode; + } + else if (fastcmp(word, "PICTOLOOP")) + textprompts[num]->page[pagenum].pictoloop = (UINT8)i; + else if (fastcmp(word, "PICTOSTART")) + textprompts[num]->page[pagenum].pictostart = (UINT8)i; + else if (fastcmp(word, "PICSMETAPAGE")) + { + if (usi && usi <= textprompts[num]->numpages) + { + UINT8 metapagenum = usi - 1; + + textprompts[num]->page[pagenum].numpics = textprompts[num]->page[metapagenum].numpics; + textprompts[num]->page[pagenum].picmode = textprompts[num]->page[metapagenum].picmode; + textprompts[num]->page[pagenum].pictoloop = textprompts[num]->page[metapagenum].pictoloop; + textprompts[num]->page[pagenum].pictostart = textprompts[num]->page[metapagenum].pictostart; + + for (picid = 0; picid < MAX_PROMPT_PICS; picid++) + { + strncpy(textprompts[num]->page[pagenum].picname[picid], textprompts[num]->page[metapagenum].picname[picid], 8); + textprompts[num]->page[pagenum].pichires[picid] = textprompts[num]->page[metapagenum].pichires[picid]; + textprompts[num]->page[pagenum].picduration[picid] = textprompts[num]->page[metapagenum].picduration[picid]; + textprompts[num]->page[pagenum].xcoord[picid] = textprompts[num]->page[metapagenum].xcoord[picid]; + textprompts[num]->page[pagenum].ycoord[picid] = textprompts[num]->page[metapagenum].ycoord[picid]; + } + } + } + else if (fastncmp(word, "PIC", 3)) + { + picid = (UINT8)atoi(word + 3); + if (picid > MAX_PROMPT_PICS || picid == 0) + { + deh_warning("textpromptscene %d: unknown word '%s'", num, word); + continue; + } + --picid; + + if (fastcmp(word+4, "NAME")) + { + strncpy(textprompts[num]->page[pagenum].picname[picid], word2, 8); + } + else if (fastcmp(word+4, "HIRES")) + { + textprompts[num]->page[pagenum].pichires[picid] = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y'); + } + else if (fastcmp(word+4, "DURATION")) + { + textprompts[num]->page[pagenum].picduration[picid] = usi; + } + else if (fastcmp(word+4, "XCOORD")) + { + textprompts[num]->page[pagenum].xcoord[picid] = usi; + } + else if (fastcmp(word+4, "YCOORD")) + { + textprompts[num]->page[pagenum].ycoord[picid] = usi; + } + else + deh_warning("textpromptscene %d: unknown word '%s'", num, word); + } + else if (fastcmp(word, "MUSIC")) + { + strncpy(textprompts[num]->page[pagenum].musswitch, word2, 7); + textprompts[num]->page[pagenum].musswitch[6] = 0; + } +#ifdef MUSICSLOT_COMPATIBILITY + else if (fastcmp(word, "MUSICSLOT")) + { + i = get_mus(word2, true); + if (i && i <= 1035) + snprintf(textprompts[num]->page[pagenum].musswitch, 7, "%sM", G_BuildMapName(i)); + else if (i && i <= 1050) + strncpy(textprompts[num]->page[pagenum].musswitch, compat_special_music_slots[i - 1036], 7); + else + textprompts[num]->page[pagenum].musswitch[0] = 0; // becomes empty string + textprompts[num]->page[pagenum].musswitch[6] = 0; + } +#endif + else if (fastcmp(word, "MUSICTRACK")) + { + textprompts[num]->page[pagenum].musswitchflags = ((UINT16)i) & MUSIC_TRACKMASK; + } + else if (fastcmp(word, "MUSICLOOP")) + { + textprompts[num]->page[pagenum].musicloop = (UINT8)(i || word2[0] == 'T' || word2[0] == 'Y'); + } + // end copypasta from readcutscenescene + else if (fastcmp(word, "NAME")) + { + INT32 j; + + // HACK: Add yellow control char now + // so the drawing function doesn't call it repeatedly + char name[34]; + name[0] = '\x82'; // color yellow + name[1] = 0; + strncat(name, word2, 33); + name[33] = 0; + + // Replace _ with ' ' + for (j = 0; j < 32 && name[j]; j++) + { + if (name[j] == '_') + name[j] = ' '; + } + + strncpy(textprompts[num]->page[pagenum].name, name, 32); + } + else if (fastcmp(word, "ICON")) + strncpy(textprompts[num]->page[pagenum].iconname, word2, 8); + else if (fastcmp(word, "ICONALIGN")) + textprompts[num]->page[pagenum].rightside = (i || word2[0] == 'R'); + else if (fastcmp(word, "ICONFLIP")) + textprompts[num]->page[pagenum].iconflip = (i || word2[0] == 'T' || word2[0] == 'Y'); + else if (fastcmp(word, "LINES")) + textprompts[num]->page[pagenum].lines = usi; + else if (fastcmp(word, "BACKCOLOR")) + { + INT32 backcolor; + if (i == 0 || fastcmp(word2, "WHITE")) backcolor = 0; + else if (i == 1 || fastcmp(word2, "GRAY") || fastcmp(word2, "GREY") || + fastcmp(word2, "BLACK")) backcolor = 1; + else if (i == 2 || fastcmp(word2, "BROWN")) backcolor = 2; + else if (i == 3 || fastcmp(word2, "RED")) backcolor = 3; + else if (i == 4 || fastcmp(word2, "ORANGE")) backcolor = 4; + else if (i == 5 || fastcmp(word2, "YELLOW")) backcolor = 5; + else if (i == 6 || fastcmp(word2, "GREEN")) backcolor = 6; + else if (i == 7 || fastcmp(word2, "BLUE")) backcolor = 7; + else if (i == 8 || fastcmp(word2, "PURPLE")) backcolor = 8; + else if (i == 9 || fastcmp(word2, "MAGENTA")) backcolor = 9; + else if (i == 10 || fastcmp(word2, "AQUA")) backcolor = 10; + else if (i < 0) backcolor = INT32_MAX; // CONS_BACKCOLOR user-configured + else backcolor = 1; // default gray + textprompts[num]->page[pagenum].backcolor = backcolor; + } + else if (fastcmp(word, "ALIGN")) + { + UINT8 align = 0; // left + if (usi == 1 || word2[0] == 'R') align = 1; + else if (usi == 2 || word2[0] == 'C' || word2[0] == 'M') align = 2; + textprompts[num]->page[pagenum].align = align; + } + else if (fastcmp(word, "VERTICALALIGN")) + { + UINT8 align = 0; // top + if (usi == 1 || word2[0] == 'B') align = 1; + else if (usi == 2 || word2[0] == 'C' || word2[0] == 'M') align = 2; + textprompts[num]->page[pagenum].verticalalign = align; + } + else if (fastcmp(word, "TEXTSPEED")) + textprompts[num]->page[pagenum].textspeed = get_number(word2); + else if (fastcmp(word, "TEXTSFX")) + textprompts[num]->page[pagenum].textsfx = get_number(word2); + else if (fastcmp(word, "HIDEHUD")) + { + UINT8 hidehud = 0; + if ((word2[0] == 'F' && (word2[1] == 'A' || !word2[1])) || word2[0] == 'N') hidehud = 0; // false + else if (usi == 1 || word2[0] == 'T' || word2[0] == 'Y') hidehud = 1; // true (hide appropriate HUD elements) + else if (usi == 2 || word2[0] == 'A' || (word2[0] == 'F' && word2[1] == 'O')) hidehud = 2; // force (hide all HUD elements) + textprompts[num]->page[pagenum].hidehud = hidehud; + } + else if (fastcmp(word, "METAPAGE")) + { + if (usi && usi <= textprompts[num]->numpages) + { + UINT8 metapagenum = usi - 1; + + strncpy(textprompts[num]->page[pagenum].name, textprompts[num]->page[metapagenum].name, 32); + strncpy(textprompts[num]->page[pagenum].iconname, textprompts[num]->page[metapagenum].iconname, 8); + textprompts[num]->page[pagenum].rightside = textprompts[num]->page[metapagenum].rightside; + textprompts[num]->page[pagenum].iconflip = textprompts[num]->page[metapagenum].iconflip; + textprompts[num]->page[pagenum].lines = textprompts[num]->page[metapagenum].lines; + textprompts[num]->page[pagenum].backcolor = textprompts[num]->page[metapagenum].backcolor; + textprompts[num]->page[pagenum].align = textprompts[num]->page[metapagenum].align; + textprompts[num]->page[pagenum].verticalalign = textprompts[num]->page[metapagenum].verticalalign; + textprompts[num]->page[pagenum].textspeed = textprompts[num]->page[metapagenum].textspeed; + textprompts[num]->page[pagenum].textsfx = textprompts[num]->page[metapagenum].textsfx; + textprompts[num]->page[pagenum].hidehud = textprompts[num]->page[metapagenum].hidehud; + + // music: don't copy, else each page change may reset the music + } + } + else if (fastcmp(word, "TAG")) + strncpy(textprompts[num]->page[pagenum].tag, word2, 33); + else if (fastcmp(word, "NEXTPROMPT")) + textprompts[num]->page[pagenum].nextprompt = usi; + else if (fastcmp(word, "NEXTPAGE")) + textprompts[num]->page[pagenum].nextpage = usi; + else if (fastcmp(word, "NEXTTAG")) + strncpy(textprompts[num]->page[pagenum].nexttag, word2, 33); + else if (fastcmp(word, "TIMETONEXT")) + textprompts[num]->page[pagenum].timetonext = get_number(word2); + else + deh_warning("PromptPage %d: unknown word '%s'", num, word); + } + } while (!myfeof(f)); // finish when the line is empty + + Z_Free(s); +} + +static void readtextprompt(MYFILE *f, INT32 num) +{ + char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); + char *word; + char *word2; + char *tmp; + INT32 value; + + // Allocate memory for this prompt if we don't yet have any + if (!textprompts[num]) + textprompts[num] = Z_Calloc(sizeof (textprompt_t), PU_STATIC, NULL); + + do + { + if (myfgets(s, MAXLINELEN, f)) + { + if (s[0] == '\n') + break; + + tmp = strchr(s, '#'); + if (tmp) + *tmp = '\0'; + if (s == tmp) + continue; // Skip comment lines, but don't break. + + word = strtok(s, " "); + if (word) + strupr(word); + else + break; + + word2 = strtok(NULL, " "); + if (word2) + value = atoi(word2); + else + { + deh_warning("No value for token %s", word); + continue; + } + + if (fastcmp(word, "NUMPAGES")) + { + textprompts[num]->numpages = min(max(value, 0), MAX_PAGES); + } + else if (fastcmp(word, "PAGE")) + { + if (1 <= value && value <= MAX_PAGES) + { + textprompts[num]->page[value - 1].backcolor = 1; // default to gray + textprompts[num]->page[value - 1].hidehud = 1; // hide appropriate HUD elements + readtextpromptpage(f, num, value - 1); + } + else + deh_warning("Page number %d out of range (1 - %d)", value, MAX_PAGES); + + } + else + deh_warning("Prompt %d: unknown word '%s', Page expected.", num, word); + } + } while (!myfeof(f)); // finish when the line is empty + + Z_Free(s); +} + static void readhuditem(MYFILE *f, INT32 num) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); @@ -1571,7 +1941,10 @@ static void readhuditem(MYFILE *f, INT32 num) // Get the part before the " = " tmp = strchr(s, '='); - *(tmp-1) = '\0'; + if (tmp) + *(tmp-1) = '\0'; + else + break; strupr(word); // Now get the part after @@ -2077,7 +2450,10 @@ static void reademblemdata(MYFILE *f, INT32 num) // Get the part before the " = " tmp = strchr(s, '='); - *(tmp-1) = '\0'; + if (tmp) + *(tmp-1) = '\0'; + else + break; strupr(word); // Now get the part after @@ -2212,7 +2588,10 @@ static void readextraemblemdata(MYFILE *f, INT32 num) // Get the part before the " = " tmp = strchr(s, '='); - *(tmp-1) = '\0'; + if (tmp) + *(tmp-1) = '\0'; + else + break; strupr(word); // Now get the part after @@ -2287,7 +2666,10 @@ static void readunlockable(MYFILE *f, INT32 num) // Get the part before the " = " tmp = strchr(s, '='); - *(tmp-1) = '\0'; + if (tmp) + *(tmp-1) = '\0'; + else + break; strupr(word); // Now get the part after @@ -2574,7 +2956,10 @@ static void readconditionset(MYFILE *f, UINT8 setnum) // Get the part before the " = " tmp = strchr(s, '='); - *(tmp-1) = '\0'; + if (tmp) + *(tmp-1) = '\0'; + else + break; strupr(word); // Now get the part after @@ -2635,7 +3020,10 @@ static void readmaincfg(MYFILE *f) // Get the part before the " = " tmp = strchr(s, '='); - *(tmp-1) = '\0'; + if (tmp) + *(tmp-1) = '\0'; + else + break; strupr(word); // Now get the part after @@ -2732,11 +3120,14 @@ static void readmaincfg(MYFILE *f) { extralifetics = (UINT16)get_number(word2); } + else if (fastcmp(word, "NIGHTSLINKTICS")) + { + nightslinktics = (UINT16)get_number(word2); + } else if (fastcmp(word, "GAMEOVERTICS")) { gameovertics = get_number(word2); } - else if (fastcmp(word, "INTROTOPLAY")) { introtoplay = (UINT8)get_number(word2); @@ -2828,7 +3219,7 @@ static void readmaincfg(MYFILE *f) strncpy(timeattackfolder, gamedatafilename, min(filenamelen, sizeof (timeattackfolder))); timeattackfolder[min(filenamelen, sizeof (timeattackfolder) - 1)] = '\0'; - strncpy(savegamename, timeattackfolder, sizeof (timeattackfolder)); + strncpy(savegamename, timeattackfolder, strlen(timeattackfolder)); strlcat(savegamename, "%u.ssg", sizeof(savegamename)); // can't use sprintf since there is %u in savegamename strcatbf(savegamename, srb2home, PATHSEP); @@ -2865,6 +3256,19 @@ static void readmaincfg(MYFILE *f) startchar = (INT16)value; char_on = -1; } + else if (fastcmp(word, "TUTORIALMAP")) + { + // Support using the actual map name, + // i.e., Level AB, Level FZ, etc. + + // Convert to map number + if (word2[0] >= 'A' && word2[0] <= 'Z') + value = M_MapNumber(word2[0], word2[1]); + else + value = get_number(word2); + + tutorialmap = (INT16)value; + } else deh_warning("Maincfg: unknown word '%s'", word); } @@ -2903,7 +3307,10 @@ static void readwipes(MYFILE *f) // Get the part before the " = " tmp = strchr(s, '='); - *(tmp-1) = '\0'; + if (tmp) + *(tmp-1) = '\0'; + else + break; strupr(word); // Now get the part after @@ -3209,6 +3616,16 @@ static void DEH_LoadDehackedFile(MYFILE *f) ignorelines(f); } } + else if (fastcmp(word, "PROMPT")) + { + if (i > 0 && i < MAX_PROMPTS) + readtextprompt(f, i - 1); + else + { + deh_warning("Prompt number %d out of range (1 - %d)", i, MAX_PROMPTS); + ignorelines(f); + } + } else if (fastcmp(word, "FRAME") || fastcmp(word, "STATE")) { if (i == 0 && word2[0] != '0') // If word2 isn't a number @@ -5396,6 +5813,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_01_FLAP1", "S_FLICKY_01_FLAP2", "S_FLICKY_01_FLAP3", + "S_FLICKY_01_STAND", + "S_FLICKY_01_CENTER", // Rabbit "S_FLICKY_02_OUT", @@ -5403,6 +5822,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_02_HOP", "S_FLICKY_02_UP", "S_FLICKY_02_DOWN", + "S_FLICKY_02_STAND", + "S_FLICKY_02_CENTER", // Chicken "S_FLICKY_03_OUT", @@ -5411,6 +5832,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_03_UP", "S_FLICKY_03_FLAP1", "S_FLICKY_03_FLAP2", + "S_FLICKY_03_STAND", + "S_FLICKY_03_CENTER", // Seal "S_FLICKY_04_OUT", @@ -5422,6 +5845,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_04_SWIM2", "S_FLICKY_04_SWIM3", "S_FLICKY_04_SWIM4", + "S_FLICKY_04_STAND", + "S_FLICKY_04_CENTER", // Pig "S_FLICKY_05_OUT", @@ -5429,6 +5854,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_05_HOP", "S_FLICKY_05_UP", "S_FLICKY_05_DOWN", + "S_FLICKY_05_STAND", + "S_FLICKY_05_CENTER", // Chipmunk "S_FLICKY_06_OUT", @@ -5436,6 +5863,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_06_HOP", "S_FLICKY_06_UP", "S_FLICKY_06_DOWN", + "S_FLICKY_06_STAND", + "S_FLICKY_06_CENTER", // Penguin "S_FLICKY_07_OUT", @@ -5450,6 +5879,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_07_SWIM1", "S_FLICKY_07_SWIM2", "S_FLICKY_07_SWIM3", + "S_FLICKY_07_STAND", + "S_FLICKY_07_CENTER", // Fish "S_FLICKY_08_OUT", @@ -5463,6 +5894,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_08_SWIM2", "S_FLICKY_08_SWIM3", "S_FLICKY_08_SWIM4", + "S_FLICKY_08_STAND", + "S_FLICKY_08_CENTER", // Ram "S_FLICKY_09_OUT", @@ -5470,11 +5903,15 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_09_HOP", "S_FLICKY_09_UP", "S_FLICKY_09_DOWN", + "S_FLICKY_09_STAND", + "S_FLICKY_09_CENTER", // Puffin "S_FLICKY_10_OUT", "S_FLICKY_10_FLAP1", "S_FLICKY_10_FLAP2", + "S_FLICKY_10_STAND", + "S_FLICKY_10_CENTER", // Cow "S_FLICKY_11_OUT", @@ -5482,6 +5919,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_11_RUN1", "S_FLICKY_11_RUN2", "S_FLICKY_11_RUN3", + "S_FLICKY_11_STAND", + "S_FLICKY_11_CENTER", // Rat "S_FLICKY_12_OUT", @@ -5489,6 +5928,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_12_RUN1", "S_FLICKY_12_RUN2", "S_FLICKY_12_RUN3", + "S_FLICKY_12_STAND", + "S_FLICKY_12_CENTER", // Bear "S_FLICKY_13_OUT", @@ -5496,12 +5937,16 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_13_HOP", "S_FLICKY_13_UP", "S_FLICKY_13_DOWN", + "S_FLICKY_13_STAND", + "S_FLICKY_13_CENTER", // Dove "S_FLICKY_14_OUT", "S_FLICKY_14_FLAP1", "S_FLICKY_14_FLAP2", "S_FLICKY_14_FLAP3", + "S_FLICKY_14_STAND", + "S_FLICKY_14_CENTER", // Cat "S_FLICKY_15_OUT", @@ -5509,12 +5954,16 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLICKY_15_HOP", "S_FLICKY_15_UP", "S_FLICKY_15_DOWN", + "S_FLICKY_15_STAND", + "S_FLICKY_15_CENTER", // Canary "S_FLICKY_16_OUT", "S_FLICKY_16_FLAP1", "S_FLICKY_16_FLAP2", "S_FLICKY_16_FLAP3", + "S_FLICKY_16_STAND", + "S_FLICKY_16_CENTER", // Spider "S_SECRETFLICKY_01_OUT", @@ -5522,12 +5971,16 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SECRETFLICKY_01_HOP", "S_SECRETFLICKY_01_UP", "S_SECRETFLICKY_01_DOWN", + "S_SECRETFLICKY_01_STAND", + "S_SECRETFLICKY_01_CENTER", // Bat "S_SECRETFLICKY_02_OUT", "S_SECRETFLICKY_02_FLAP1", "S_SECRETFLICKY_02_FLAP2", "S_SECRETFLICKY_02_FLAP3", + "S_SECRETFLICKY_02_STAND", + "S_SECRETFLICKY_02_CENTER", // Fan "S_FAN", @@ -6726,23 +7179,41 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s // Flickies "MT_FLICKY_01", // Bluebird + "MT_FLICKY_01_CENTER", "MT_FLICKY_02", // Rabbit + "MT_FLICKY_02_CENTER", "MT_FLICKY_03", // Chicken + "MT_FLICKY_03_CENTER", "MT_FLICKY_04", // Seal + "MT_FLICKY_04_CENTER", "MT_FLICKY_05", // Pig + "MT_FLICKY_05_CENTER", "MT_FLICKY_06", // Chipmunk + "MT_FLICKY_06_CENTER", "MT_FLICKY_07", // Penguin + "MT_FLICKY_07_CENTER", "MT_FLICKY_08", // Fish + "MT_FLICKY_08_CENTER", "MT_FLICKY_09", // Ram + "MT_FLICKY_09_CENTER", "MT_FLICKY_10", // Puffin + "MT_FLICKY_10_CENTER", "MT_FLICKY_11", // Cow + "MT_FLICKY_11_CENTER", "MT_FLICKY_12", // Rat + "MT_FLICKY_12_CENTER", "MT_FLICKY_13", // Bear + "MT_FLICKY_13_CENTER", "MT_FLICKY_14", // Dove + "MT_FLICKY_14_CENTER", "MT_FLICKY_15", // Cat + "MT_FLICKY_15_CENTER", "MT_FLICKY_16", // Canary + "MT_FLICKY_16_CENTER", "MT_SECRETFLICKY_01", // Spider + "MT_SECRETFLICKY_01_CENTER", "MT_SECRETFLICKY_02", // Bat + "MT_SECRETFLICKY_02_CENTER", "MT_SEED", // Environmental Effects @@ -6878,6 +7349,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_PULL", "MT_GHOST", "MT_OVERLAY", + "MT_ANGLEMAN", "MT_POLYANCHOR", "MT_POLYSPAWN", "MT_POLYSPAWNCRUSH", @@ -7688,6 +8160,13 @@ struct { // Node flags {"NF_SUBSECTOR",NF_SUBSECTOR}, // Indicate a leaf. #endif +#ifdef ESLOPE + // Slope flags + {"SL_NOPHYSICS",SL_NOPHYSICS}, // Don't do momentum adjustment with this slope + {"SL_NODYNAMIC",SL_NODYNAMIC}, // Slope will never need to move during the level, so don't fuss with recalculating it + {"SL_ANCHORVERTEX",SL_ANCHORVERTEX},// Slope is using a Slope Vertex Thing to anchor its position + {"SL_VERTEXSLOPE",SL_VERTEXSLOPE}, // Slope is built from three Slope Vertex Things +#endif // Angles {"ANG1",ANG1}, @@ -7820,6 +8299,14 @@ struct { {"V_CHARCOLORSHIFT",V_CHARCOLORSHIFT}, {"V_ALPHASHIFT",V_ALPHASHIFT}, + + //Kick Reasons + {"KR_KICK",KR_KICK}, + {"KR_PINGLIMIT",KR_PINGLIMIT}, + {"KR_SYNCH",KR_SYNCH}, + {"KR_TIMEOUT",KR_TIMEOUT}, + {"KR_BAN",KR_BAN}, + {"KR_LEAVE",KR_LEAVE}, #endif {NULL,0} @@ -8208,7 +8695,7 @@ fixed_t get_number(const char *word) #endif } -void FUNCMATH DEH_Check(void) +void DEH_Check(void) { #if defined(_DEBUG) || defined(PARANOIA) const size_t dehstates = sizeof(STATE_LIST)/sizeof(const char*); @@ -8684,6 +9171,9 @@ static inline int lib_getenum(lua_State *L) } else if (fastcmp(word,"maptol")) { lua_pushinteger(L, maptol); return 1; + } else if (fastcmp(word,"ultimatemode")) { + lua_pushboolean(L, ultimatemode != 0); + return 1; } else if (fastcmp(word,"mariomode")) { lua_pushboolean(L, mariomode != 0); return 1; @@ -8810,17 +9300,17 @@ static int lib_getActionName(lua_State *L) { lua_settop(L, 1); // set top of stack to 1 (removing any extra args, which there shouldn't be) // get the name for this action, if possible. - lua_getfield(gL, LUA_REGISTRYINDEX, LREG_ACTIONS); - lua_pushnil(gL); + lua_getfield(L, LUA_REGISTRYINDEX, LREG_ACTIONS); + lua_pushnil(L); // Lua stack at this point: // 1 ... -2 -1 // arg ... LREG_ACTIONS nil - while (lua_next(gL, -2)) + while (lua_next(L, -2)) { // Lua stack at this point: // 1 ... -3 -2 -1 // arg ... LREG_ACTIONS "A_ACTION" function - if (lua_rawequal(gL, -1, 1)) // is this the same as the arg? + if (lua_rawequal(L, -1, 1)) // is this the same as the arg? { // make sure the key (i.e. "A_ACTION") is a string first // (note: we don't use lua_isstring because it also returns true for numbers) @@ -8829,12 +9319,12 @@ static int lib_getActionName(lua_State *L) lua_pushvalue(L, -2); // push "A_ACTION" string to top of stack return 1; } - lua_pop(gL, 2); // pop the name and function + lua_pop(L, 2); // pop the name and function break; // probably should have succeeded but we didn't, so end the loop } - lua_pop(gL, 1); + lua_pop(L, 1); } - lua_pop(gL, 1); // pop LREG_ACTIONS + lua_pop(L, 1); // pop LREG_ACTIONS return 0; // return nothing (don't error) } diff --git a/src/djgppdos/i_sound.c b/src/djgppdos/i_sound.c index 88fc807f4..52c90aac2 100644 --- a/src/djgppdos/i_sound.c +++ b/src/djgppdos/i_sound.c @@ -134,21 +134,12 @@ FUNCINLINE static ATTRINLINE int Volset(int vol) void I_SetSfxVolume(INT32 volume) { - if (nosound) + if (sound_disabled) return; set_volume (Volset(volume),-1); } -void I_SetMIDIMusicVolume(INT32 volume) -{ - if (nomidimusic) - return; - - // Now set volume on output device. - set_volume (-1, Volset(volume)); -} - // // Starting a sound means adding it // to the current list of active sounds @@ -165,11 +156,13 @@ INT32 I_StartSound ( sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, - INT32 priority ) + INT32 priority, + INT32 channel) { int voice; + (void)channel; - if (nosound) + if (sound_disabled) return 0; // UNUSED @@ -190,7 +183,7 @@ void I_StopSound (INT32 handle) // an setting the channel to zero. int voice=handle & (VIRTUAL_VOICES-1); - if (nosound) + if (sound_disabled) return; if (voice_check(voice)==S_sfx[handle>>VOICESSHIFT].data) @@ -199,7 +192,7 @@ void I_StopSound (INT32 handle) INT32 I_SoundIsPlaying(INT32 handle) { - if (nosound) + if (sound_disabled) return FALSE; if (voice_check(handle & (VIRTUAL_VOICES-1))==S_sfx[handle>>VOICESSHIFT].data) @@ -229,7 +222,7 @@ void I_UpdateSoundParams( INT32 handle, int voice=handle & (VIRTUAL_VOICES-1); int numsfx=handle>>VOICESSHIFT; - if (nosound) + if (sound_disabled) return; if (voice_check(voice)==S_sfx[numsfx].data) @@ -270,17 +263,17 @@ void I_StartupSound(void) char err[255]; #endif - if (nosound) + if (sound_disabled) sfxcard=DIGI_NONE; else sfxcard=DIGI_AUTODETECT; - if (nomidimusic) + if (midi_disabled) midicard=MIDI_NONE; else midicard=MIDI_AUTODETECT; //DetectMusicCard(); - nodigimusic=true; //Alam: No OGG/MP3/IT/MOD support + digital_disabled=true; //Alam: No OGG/MP3/IT/MOD support // Secure and configure sound device first. CONS_Printf("I_StartupSound: "); @@ -293,8 +286,8 @@ void I_StartupSound(void) { sprintf (err,"Sound init error : %s\n",allegro_error); CONS_Error (err); - nosound=true; - nomidimusic=true; + sound_disabled=true; + midi_disabled=true; } else { @@ -321,7 +314,11 @@ static MIDI* currsong; //im assuming only 1 song will be played at once static int islooping=0; static int musicdies=-1; UINT8 music_started=0; +boolean songpaused=false; +/// ------------------------ +// MUSIC SYSTEM +/// ------------------------ /* load_midi_mem: * Loads a standard MIDI file from memory, returning a pointer to @@ -389,116 +386,66 @@ static MIDI *load_midi_mem(char *mempointer,int *e) return midi; } -void I_InitMIDIMusic(void) +void I_InitMusic(void) { - if (nomidimusic) + if (midi_disabled) return; I_AddExitFunc(I_ShutdownMusic); music_started = true; -} - -void I_ShutdownMIDIMusic(void) -{ - if ( !music_started ) - return; - - I_StopSong(1); - - music_started=false; -} - -void I_InitDigMusic(void) -{ -// CONS_Printf("Digital music not yet supported under DOS.\n"); -} - -void I_ShutdownDigMusic(void) -{ -// CONS_Printf("Digital music not yet supported under DOS.\n"); -} - -void I_InitMusic(void) -{ - if (!nodigimusic) - I_InitDigMusic(); - if (!nomidimusic) - I_InitMIDIMusic(); + songpaused = false; } void I_ShutdownMusic(void) { - I_ShutdownMIDIMusic(); - I_ShutdownDigMusic(); + if ( !music_started ) + return; + + I_StopSong(); + + music_started=false; } -boolean I_PlaySong(INT32 handle, INT32 looping) -{ - handle = 0; - if (nomidimusic) - return false; +/// ------------------------ +// MUSIC PROPERTIES +/// ------------------------ - islooping = looping; - musicdies = gametic + NEWTICRATE*30; - if (play_midi(currsong,looping)==0) - return true; +musictype_t I_SongType(void) +{ + if (currsong) + return MU_MID; + else + return MU_NONE; +} + +boolean I_SongPlaying() +{ + return (boolean)currsong; +} + +boolean I_SongPaused() +{ + return songpaused; +} + +/// ------------------------ +// MUSIC EFFECTS +/// ------------------------ + +boolean I_SetSongSpeed(float speed) +{ + (void)speed; return false; } -void I_PauseSong (INT32 handle) -{ - handle = 0; - if (nomidimusic) - return; +/// ------------------------ +// MUSIC PLAYBACK +/// ------------------------ - midi_pause(); -} - -void I_ResumeSong (INT32 handle) -{ - handle = 0; - if (nomidimusic) - return; - - midi_resume(); -} - -void I_StopSong(INT32 handle) -{ - handle = 0; - if (nomidimusic) - return; - - islooping = 0; - musicdies = 0; - stop_midi(); -} - -// Is the song playing? -#if 0 -int I_QrySongPlaying(int handle) -{ - if (nomidimusic) - return 0; - - //return islooping || musicdies > gametic; - return (midi_pos==-1); -} -#endif - -void I_UnRegisterSong(INT32 handle) -{ - handle = 0; - if (nomidimusic) - return; - - //destroy_midi(currsong); -} - -INT32 I_RegisterSong(void *data, size_t len) +boolean I_LoadSong(char *data, size_t len) { int e = len; //Alam: For error - if (nomidimusic) + if (midi_disabled) return 0; if (memcmp(data,"MThd",4)==0) // support mid file in WAD !!! @@ -520,32 +467,81 @@ INT32 I_RegisterSong(void *data, size_t len) return 1; } -/// \todo Add OGG/MP3 support for dos -boolean I_StartDigSong(const char *musicname, INT32 looping) +void I_UnloadSong(void) { - musicname = NULL; - looping = 0; - //CONS_Printf("I_StartDigSong: Not yet supported under DOS.\n"); + handle = 0; + if (midi_disabled) + return; + + //destroy_midi(currsong); +} + +boolean I_PlaySong(boolean looping) +{ + handle = 0; + if (midi_disabled) + return false; + + islooping = looping; + musicdies = gametic + NEWTICRATE*30; + if (play_midi(currsong,looping)==0) + return true; return false; } -void I_StopDigSong(void) +void I_StopSong(void) { -// CONS_Printf("I_StopDigSong: Not yet supported under DOS.\n"); + handle = 0; + if (midi_disabled) + return; + + islooping = 0; + musicdies = 0; + stop_midi(); + songpaused = false; } -void I_SetDigMusicVolume(INT32 volume) +void I_PauseSong (INT32 handle) { - volume = 0; - if (nodigimusic) + handle = 0; + if (midi_disabled) + return; + midi_pause(); + songpaused = true; +} + +void I_ResumeSong (INT32 handle) +{ + handle = 0; + if (midi_disabled) + return; + midi_resume(); + songpaused = false; +} + +void I_SetMusicVolume(INT32 volume) +{ + if (midi_disabled) return; // Now set volume on output device. -// CONS_Printf("Digital music not yet supported under DOS.\n"); + set_volume (-1, Volset(volume)); } -boolean I_SetSongSpeed(float speed) +boolean I_SetSongTrack(INT32 track) { - (void)speed; + (void)track; return false; } + +// Is the song playing? +#if 0 +int I_QrySongPlaying(int handle) +{ + if (midi_disabled) + return 0; + + //return islooping || musicdies > gametic; + return (midi_pos==-1); +} +#endif diff --git a/src/doomdef.h b/src/doomdef.h index b09aaa415..169fd713e 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -571,4 +571,11 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// \note Required for proper collision with moving sloped surfaces that have sector specials on them. #define SECTORSPECIALSAFTERTHINK +/// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up +/// (that was the original comment from SRB2CB, sadly it is a lie and actually slows game down) +/// on the bright side it fixes some weird issues with translucent walls +/// \note SRB2CB port. +/// SRB2CB itself ported this from PrBoom+ +#define NEWCLIP + #endif // __DOOMDEF__ diff --git a/src/doomstat.h b/src/doomstat.h index 651540ecc..337eff7a9 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -90,10 +90,7 @@ extern boolean fromlevelselect; // Internal parameters for sound rendering. // ======================================== -extern boolean nomidimusic; // defined in d_main.c -extern boolean nosound; -extern boolean nodigimusic; -extern boolean music_disabled; +extern boolean midi_disabled; extern boolean sound_disabled; extern boolean digital_disabled; @@ -132,6 +129,14 @@ extern INT16 titlemap; extern boolean hidetitlepics; extern INT16 bootmap; //bootmap for loading a map on startup +extern INT16 tutorialmap; // map to load for tutorial +extern boolean tutorialmode; // are we in a tutorial right now? +extern INT32 tutorialgcs; // which control scheme is loaded? +extern INT32 tutorialusemouse; // store cv_usemouse user value +extern INT32 tutorialfreelook; // store cv_alwaysfreelook user value +extern INT32 tutorialmousemove; // store cv_mousemove user value +extern INT32 tutorialanalog; // store cv_analog user value + extern boolean looptitle; // CTF colors. @@ -169,6 +174,60 @@ typedef struct extern cutscene_t *cutscenes[128]; +// Reserve prompt space for tutorials +#define TUTORIAL_PROMPT 201 // one-based +#define TUTORIAL_AREAS 6 +#define TUTORIAL_AREA_PROMPTS 5 +#define MAX_PROMPTS (TUTORIAL_PROMPT+TUTORIAL_AREAS*TUTORIAL_AREA_PROMPTS*3) // 3 control modes +#define MAX_PAGES 128 + +#define PROMPT_PIC_PERSIST 0 +#define PROMPT_PIC_LOOP 1 +#define PROMPT_PIC_DESTROY 2 +#define MAX_PROMPT_PICS 8 +typedef struct +{ + UINT8 numpics; + UINT8 picmode; // sequence mode after displaying last pic, 0 = persist, 1 = loop, 2 = destroy + UINT8 pictoloop; // if picmode == loop, which pic to loop to? + UINT8 pictostart; // initial pic number to show + char picname[MAX_PROMPT_PICS][8]; + UINT8 pichires[MAX_PROMPT_PICS]; + UINT16 xcoord[MAX_PROMPT_PICS]; // gfx + UINT16 ycoord[MAX_PROMPT_PICS]; // gfx + UINT16 picduration[MAX_PROMPT_PICS]; + + char musswitch[7]; + UINT16 musswitchflags; + UINT8 musicloop; + + char tag[33]; // page tag + char name[34]; // narrator name, extra char for color + char iconname[8]; // narrator icon lump + boolean rightside; // narrator side, false = left, true = right + boolean iconflip; // narrator flip icon horizontally + UINT8 hidehud; // hide hud, 0 = show all, 1 = hide depending on prompt position (top/bottom), 2 = hide all + UINT8 lines; // # of lines to show. If name is specified, name takes one of the lines. If 0, defaults to 4. + INT32 backcolor; // see CON_SetupBackColormap: 0-11, INT32_MAX for user-defined (CONS_BACKCOLOR) + UINT8 align; // text alignment, 0 = left, 1 = right, 2 = center + UINT8 verticalalign; // vertical text alignment, 0 = top, 1 = bottom, 2 = middle + UINT8 textspeed; // text speed, delay in tics between characters. + sfxenum_t textsfx; // sfx_ id for printing text + UINT8 nextprompt; // next prompt to jump to, one-based. 0 = current prompt + UINT8 nextpage; // next page to jump to, one-based. 0 = next page within prompt->numpages + char nexttag[33]; // next tag to jump to. If set, this overrides nextprompt and nextpage. + INT32 timetonext; // time in tics to jump to next page automatically. 0 = don't jump automatically + char *text; +} textpage_t; + +typedef struct +{ + textpage_t page[MAX_PAGES]; + INT32 numpages; // Number of pages in this prompt +} textprompt_t; + +extern textprompt_t *textprompts[MAX_PROMPTS]; + // For the Custom Exit linedef. extern INT16 nextmapoverride; extern boolean skipstats; @@ -414,6 +473,7 @@ extern UINT16 tailsflytics; extern UINT16 underwatertics; extern UINT16 spacetimetics; extern UINT16 extralifetics; +extern UINT16 nightslinktics; extern UINT8 introtoplay; extern UINT8 creditscutscene; diff --git a/src/doomtype.h b/src/doomtype.h index b0623de9a..741b68c21 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -40,12 +40,13 @@ typedef long ssize_t; /* Older Visual C++ headers don't have the Win64-compatible typedefs... */ -#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) -#define DWORD_PTR DWORD -#endif - -#if ((_MSC_VER <= 1200) && (!defined(PDWORD_PTR))) -#define PDWORD_PTR PDWORD +#if (_MSC_VER <= 1200) + #ifndef DWORD_PTR + #define DWORD_PTR DWORD + #endif + #ifndef PDWORD_PTR + #define PDWORD_PTR PDWORD + #endif #endif #elif defined (__DJGPP__) #define UINT8 unsigned char @@ -80,11 +81,13 @@ typedef long ssize_t; #define NOIPX #endif +/* Strings and some misc platform specific stuff */ + #ifdef _MSC_VER // Microsoft VisualC++ #if (_MSC_VER <= 1800) // MSVC 2013 and back #define snprintf _snprintf -#if (_MSC_VER <= 1200) // MSVC 2012 and back +#if (_MSC_VER <= 1200) // MSVC 6.0 and back #define vsnprintf _vsnprintf #endif #endif @@ -148,6 +151,8 @@ size_t strlcpy(char *dst, const char *src, size_t siz); // not the number of bytes in the buffer. #define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst) +/* Boolean type definition */ + // \note __BYTEBOOL__ used to be set above if "macintosh" was defined, // if macintosh's version of boolean type isn't needed anymore, then isn't this macro pointless now? #ifndef __BYTEBOOL__ @@ -155,7 +160,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz); //faB: clean that up !! #if defined( _MSC_VER) && (_MSC_VER >= 1800) // MSVC 2013 and forward - #include "stdbool.h" + #include "stdbool.h" #elif defined (_WIN32) #define false FALSE // use windows types #define true TRUE @@ -205,89 +210,65 @@ size_t strlcpy(char *dst, const char *src, size_t siz); #define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */ #endif -union FColorRGBA -{ - UINT32 rgba; - struct - { - UINT8 red; - UINT8 green; - UINT8 blue; - UINT8 alpha; - } s; -} ATTRPACK; -typedef union FColorRGBA RGBA_t; - -typedef enum -{ - postimg_none, - postimg_water, - postimg_motion, - postimg_flip, - postimg_heat -} postimg_t; - -typedef UINT32 lumpnum_t; // 16 : 16 unsigned long (wad num: lump num) -#define LUMPERROR UINT32_MAX - -typedef UINT32 tic_t; -#define INFTICS UINT32_MAX - -#ifdef _BIG_ENDIAN -#define UINT2RGBA(a) a -#else -#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24) -#endif +/* Compiler-specific attributes and other macros */ #ifdef __GNUC__ // __attribute__ ((X)) -#define FUNCNORETURN __attribute__ ((noreturn)) -#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && defined (__MINGW32__) -#include "inttypes.h" -#if 0 //defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO > 0 -#define FUNCPRINTF __attribute__ ((format(gnu_printf, 1, 2))) -#define FUNCDEBUG __attribute__ ((format(gnu_printf, 2, 3))) -#define FUNCIERROR __attribute__ ((format(gnu_printf, 1, 2),noreturn)) -#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) -#define FUNCPRINTF __attribute__ ((format(ms_printf, 1, 2))) -#define FUNCDEBUG __attribute__ ((format(ms_printf, 2, 3))) -#define FUNCIERROR __attribute__ ((format(ms_printf, 1, 2),noreturn)) -#else -#define FUNCPRINTF __attribute__ ((format(printf, 1, 2))) -#define FUNCDEBUG __attribute__ ((format(printf, 2, 3))) -#define FUNCIERROR __attribute__ ((format(printf, 1, 2),noreturn)) -#endif -#else -#define FUNCPRINTF __attribute__ ((format(printf, 1, 2))) -#define FUNCDEBUG __attribute__ ((format(printf, 2, 3))) -#define FUNCIERROR __attribute__ ((format(printf, 1, 2),noreturn)) -#endif -#ifndef FUNCIERROR -#define FUNCIERROR __attribute__ ((noreturn)) -#endif -#define FUNCMATH __attribute__((const)) -#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) -#define FUNCDEAD __attribute__ ((deprecated)) -#define FUNCINLINE __attribute__((always_inline)) -#define FUNCNONNULL __attribute__((nonnull)) -#endif -#define FUNCNOINLINE __attribute__((noinline)) -#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) -#ifdef __i386__ // i386 only -#define FUNCTARGET(X) __attribute__ ((__target__ (X))) -#endif -#endif -#if defined (__MINGW32__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -#define ATTRPACK __attribute__((packed, gcc_struct)) -#else -#define ATTRPACK __attribute__((packed)) -#endif -#define ATTRUNUSED __attribute__((unused)) + #define FUNCNORETURN __attribute__ ((noreturn)) + + #if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && defined (__MINGW32__) // MinGW, >= GCC 4.1 + #include "inttypes.h" + #if 0 //defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO > 0 + #define FUNCPRINTF __attribute__ ((format(gnu_printf, 1, 2))) + #define FUNCDEBUG __attribute__ ((format(gnu_printf, 2, 3))) + #define FUNCIERROR __attribute__ ((format(gnu_printf, 1, 2),noreturn)) + #elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4 + #define FUNCPRINTF __attribute__ ((format(ms_printf, 1, 2))) + #define FUNCDEBUG __attribute__ ((format(ms_printf, 2, 3))) + #define FUNCIERROR __attribute__ ((format(ms_printf, 1, 2),noreturn)) + #else + #define FUNCPRINTF __attribute__ ((format(printf, 1, 2))) + #define FUNCDEBUG __attribute__ ((format(printf, 2, 3))) + #define FUNCIERROR __attribute__ ((format(printf, 1, 2),noreturn)) + #endif + #else + #define FUNCPRINTF __attribute__ ((format(printf, 1, 2))) + #define FUNCDEBUG __attribute__ ((format(printf, 2, 3))) + #define FUNCIERROR __attribute__ ((format(printf, 1, 2),noreturn)) + #endif + + #ifndef FUNCIERROR + #define FUNCIERROR __attribute__ ((noreturn)) + #endif + + #define FUNCMATH __attribute__((const)) + + #if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) // >= GCC 3.1 + #define FUNCDEAD __attribute__ ((deprecated)) + #define FUNCINLINE __attribute__((always_inline)) + #define FUNCNONNULL __attribute__((nonnull)) + #endif + + #define FUNCNOINLINE __attribute__((noinline)) + + #if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4 + #ifdef __i386__ // i386 only + #define FUNCTARGET(X) __attribute__ ((__target__ (X))) + #endif + #endif + + #if defined (__MINGW32__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) // MinGW, >= GCC 3.4 + #define ATTRPACK __attribute__((packed, gcc_struct)) + #else + #define ATTRPACK __attribute__((packed)) + #endif + + #define ATTRUNUSED __attribute__((unused)) #elif defined (_MSC_VER) -#define ATTRNORETURN __declspec(noreturn) -#define ATTRINLINE __forceinline -#if _MSC_VER > 1200 -#define ATTRNOINLINE __declspec(noinline) -#endif + #define ATTRNORETURN __declspec(noreturn) + #define ATTRINLINE __forceinline + #if _MSC_VER > 1200 // >= MSVC 6.0 + #define ATTRNOINLINE __declspec(noinline) + #endif #endif #ifndef FUNCPRINTF @@ -335,4 +316,43 @@ typedef UINT32 tic_t; #ifndef ATTRNOINLINE #define ATTRNOINLINE #endif + +/* Miscellaneous types that don't fit anywhere else (Can this be changed?) */ + +union FColorRGBA +{ + UINT32 rgba; + struct + { + UINT8 red; + UINT8 green; + UINT8 blue; + UINT8 alpha; + } s; +} ATTRPACK; +typedef union FColorRGBA RGBA_t; + +typedef enum +{ + postimg_none, + postimg_water, + postimg_motion, + postimg_flip, + postimg_heat +} postimg_t; + +typedef UINT32 lumpnum_t; // 16 : 16 unsigned long (wad num: lump num) +#define LUMPERROR UINT32_MAX + +typedef UINT32 tic_t; +#define INFTICS UINT32_MAX + +#include "endian.h" // This is needed to make sure the below macro acts correctly in big endian builds + +#ifdef SRB2_BIG_ENDIAN +#define UINT2RGBA(a) a +#else +#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24) +#endif + #endif //__DOOMTYPE__ diff --git a/src/dummy/i_sound.c b/src/dummy/i_sound.c index 51dbb610d..7275bb1ae 100644 --- a/src/dummy/i_sound.c +++ b/src/dummy/i_sound.c @@ -23,13 +23,14 @@ void I_UpdateSound(void){}; // SFX I/O // -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { (void)id; (void)vol; (void)sep; (void)pitch; (void)priority; + (void)channel; return -1; } @@ -57,82 +58,36 @@ void I_SetSfxVolume(UINT8 volume) (void)volume; } -// -// MUSIC I/O -// +/// ------------------------ +// MUSIC SYSTEM +/// ------------------------ void I_InitMusic(void){} void I_ShutdownMusic(void){} -void I_PauseSong(INT32 handle) +/// ------------------------ +// MUSIC PROPERTIES +/// ------------------------ + +musictype_t I_SongType(void) { - (void)handle; + return MU_NONE; } -void I_ResumeSong(INT32 handle) +boolean I_SongPlaying(void) { - (void)handle; -} - -// -// MIDI I/O -// - -void I_InitMIDIMusic(void){} - -void I_ShutdownMIDIMusic(void){} - -void I_SetMIDIMusicVolume(UINT8 volume) -{ - (void)volume; -} - -INT32 I_RegisterSong(void *data, size_t len) -{ - (void)data; - (void)len; - return -1; -} - -boolean I_PlaySong(INT32 handle, boolean looping) -{ - (void)handle; - (void)looping; return false; } -void I_StopSong(INT32 handle) +boolean I_SongPaused(void) { - (void)handle; -} - -void I_UnRegisterSong(INT32 handle) -{ - (void)handle; -} - -// -// DIGMUSIC I/O -// - -void I_InitDigMusic(void){} - -void I_ShutdownDigMusic(void){} - -boolean I_StartDigSong(const char *musicname, boolean looping) -{ - (void)musicname; - (void)looping; return false; } -void I_StopDigSong(void){} - -void I_SetDigMusicVolume(UINT8 volume) -{ - (void)volume; -} +/// ------------------------ +// MUSIC EFFECTS +/// ------------------------ boolean I_SetSongSpeed(float speed) { @@ -140,8 +95,51 @@ boolean I_SetSongSpeed(float speed) return false; } +/// ------------------------ +// MUSIC PLAYBACK +/// ------------------------ + +boolean I_LoadSong(char *data, size_t len) +{ + (void)data; + (void)len; + return -1; +} + +void I_UnloadSong(void) +{ + (void)handle; +} + +boolean I_PlaySong(boolean looping) +{ + (void)handle; + (void)looping; + return false; +} + +void I_StopSong(void) +{ + (void)handle; +} + +void I_PauseSong(void) +{ + (void)handle; +} + +void I_ResumeSong(void) +{ + (void)handle; +} + +void I_SetMusicVolume(UINT8 volume) +{ + (void)volume; +} + boolean I_SetSongTrack(int track) { (void)track; return false; -} +} \ No newline at end of file diff --git a/src/f_finale.c b/src/f_finale.c index fe191a415..1212fcdcb 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -34,6 +34,8 @@ #include "m_cond.h" #include "p_local.h" #include "p_setup.h" +#include "st_stuff.h" // hud hiding +#include "fastcmp.h" #ifdef HAVE_BLUA #include "lua_hud.h" @@ -49,6 +51,7 @@ static INT32 timetonext; // Delay between screen changes static INT32 continuetime; // Short delay when continuing static tic_t animtimer; // Used for some animation timings +static INT16 skullAnimCounter; // Chevron animation static INT32 roidtics; // Asteroid spinning static INT32 deplete; @@ -79,6 +82,18 @@ static patch_t *ttspop7; static void F_SkyScroll(INT32 scrollspeed); +// +// PROMPT STATE +// +static boolean promptactive = false; +static mobj_t *promptmo; +static INT16 promptpostexectag; +static boolean promptblockcontrols; +static char *promptpagetext = NULL; +static INT32 callpromptnum = INT32_MAX; +static INT32 callpagenum = INT32_MAX; +static INT32 callplayer = INT32_MAX; + // // CUTSCENE TEXT WRITING // @@ -1424,6 +1439,7 @@ void F_StartGameEnd(void) // void F_GameEndDrawer(void) { + // this function does nothing } // @@ -1818,7 +1834,7 @@ boolean F_ContinueResponder(event_t *event) // CUSTOM CUTSCENES // ================== static INT32 scenenum, cutnum; -static INT32 picxpos, picypos, picnum, pictime; +static INT32 picxpos, picypos, picnum, pictime, picmode, numpics, pictoloop; static INT32 textxpos, textypos; static boolean dofadenow = false, cutsceneover = false; static boolean runningprecutscene = false, precutresetplayer = false; @@ -2028,3 +2044,617 @@ boolean F_CutsceneResponder(event_t *event) return false; } + +// ================== +// TEXT PROMPTS +// ================== + +static void F_GetPageTextGeometry(UINT8 *pagelines, boolean *rightside, INT32 *boxh, INT32 *texth, INT32 *texty, INT32 *namey, INT32 *chevrony, INT32 *textx, INT32 *textr) +{ + // reuse: + // cutnum -> promptnum + // scenenum -> pagenum + lumpnum_t iconlump = W_CheckNumForName(textprompts[cutnum]->page[scenenum].iconname); + + *pagelines = textprompts[cutnum]->page[scenenum].lines ? textprompts[cutnum]->page[scenenum].lines : 4; + *rightside = (iconlump != LUMPERROR && textprompts[cutnum]->page[scenenum].rightside); + + // Vertical calculations + *boxh = *pagelines*2; + *texth = textprompts[cutnum]->page[scenenum].name[0] ? (*pagelines-1)*2 : *pagelines*2; // name takes up first line if it exists + *texty = BASEVIDHEIGHT - ((*texth * 4) + (*texth/2)*4); + *namey = BASEVIDHEIGHT - ((*boxh * 4) + (*boxh/2)*4); + *chevrony = BASEVIDHEIGHT - (((1*2) * 4) + ((1*2)/2)*4); // force on last line + + // Horizontal calculations + // Shift text to the right if we have a character icon on the left side + // Add 4 margin against icon + *textx = (iconlump != LUMPERROR && !*rightside) ? ((*boxh * 4) + (*boxh/2)*4) + 4 : 4; + *textr = *rightside ? BASEVIDWIDTH - (((*boxh * 4) + (*boxh/2)*4) + 4) : BASEVIDWIDTH-4; +} + +static fixed_t F_GetPromptHideHudBound(void) +{ + UINT8 pagelines; + boolean rightside; + INT32 boxh, texth, texty, namey, chevrony; + INT32 textx, textr; + + if (cutnum == INT32_MAX || scenenum == INT32_MAX || !textprompts[cutnum] || scenenum >= textprompts[cutnum]->numpages || + !textprompts[cutnum]->page[scenenum].hidehud || + (splitscreen && textprompts[cutnum]->page[scenenum].hidehud != 2)) // don't hide on splitscreen, unless hide all is forced + return 0; + else if (textprompts[cutnum]->page[scenenum].hidehud == 2) // hide all + return BASEVIDHEIGHT; + + F_GetPageTextGeometry(&pagelines, &rightside, &boxh, &texth, &texty, &namey, &chevrony, &textx, &textr); + + // calc boxheight (see V_DrawPromptBack) + boxh *= vid.dupy; + boxh = (boxh * 4) + (boxh/2)*5; // 4 lines of space plus gaps between and some leeway + + // return a coordinate to check + // if negative: don't show hud elements below this coordinate (visually) + // if positive: don't show hud elements above this coordinate (visually) + return 0 - boxh; // \todo: if prompt at top of screen (someday), make this return positive +} + +boolean F_GetPromptHideHudAll(void) +{ + if (cutnum == INT32_MAX || scenenum == INT32_MAX || !textprompts[cutnum] || scenenum >= textprompts[cutnum]->numpages || + !textprompts[cutnum]->page[scenenum].hidehud || + (splitscreen && textprompts[cutnum]->page[scenenum].hidehud != 2)) // don't hide on splitscreen, unless hide all is forced + return false; + else if (textprompts[cutnum]->page[scenenum].hidehud == 2) // hide all + return true; + else + return false; +} + +boolean F_GetPromptHideHud(fixed_t y) +{ + INT32 ybound; + boolean fromtop; + fixed_t ytest; + + if (!promptactive) + return false; + + ybound = F_GetPromptHideHudBound(); + fromtop = (ybound >= 0); + ytest = (fromtop ? ybound : BASEVIDHEIGHT + ybound); + + return (fromtop ? y < ytest : y >= ytest); // true means hide +} + +static void F_PreparePageText(char *pagetext) +{ + UINT8 pagelines; + boolean rightside; + INT32 boxh, texth, texty, namey, chevrony; + INT32 textx, textr; + + F_GetPageTextGeometry(&pagelines, &rightside, &boxh, &texth, &texty, &namey, &chevrony, &textx, &textr); + + if (promptpagetext) + Z_Free(promptpagetext); + promptpagetext = (pagetext && pagetext[0]) ? V_WordWrap(textx, textr, 0, pagetext) : Z_StrDup(""); + + F_NewCutscene(promptpagetext); + cutscene_textspeed = textprompts[cutnum]->page[scenenum].textspeed ? textprompts[cutnum]->page[scenenum].textspeed : TICRATE/5; + cutscene_textcount = 0; // no delay in beginning + cutscene_boostspeed = 0; // don't print 8 characters to start + + // \todo update control hot strings on re-config + // and somehow don't reset cutscene text counters +} + +static void F_AdvanceToNextPage(void) +{ + INT32 nextprompt = textprompts[cutnum]->page[scenenum].nextprompt ? textprompts[cutnum]->page[scenenum].nextprompt - 1 : INT32_MAX, + nextpage = textprompts[cutnum]->page[scenenum].nextpage ? textprompts[cutnum]->page[scenenum].nextpage - 1 : INT32_MAX, + oldcutnum = cutnum; + + if (textprompts[cutnum]->page[scenenum].nexttag[0]) + F_GetPromptPageByNamedTag(textprompts[cutnum]->page[scenenum].nexttag, &nextprompt, &nextpage); + + // determine next prompt + if (nextprompt != INT32_MAX) + { + if (nextprompt <= MAX_PROMPTS && textprompts[nextprompt]) + cutnum = nextprompt; + else + cutnum = INT32_MAX; + } + + // determine next page + if (nextpage != INT32_MAX) + { + if (cutnum != INT32_MAX) + { + scenenum = nextpage; + if (scenenum >= MAX_PAGES || scenenum > textprompts[cutnum]->numpages-1) + scenenum = INT32_MAX; + } + } + else + { + if (cutnum != oldcutnum) + scenenum = 0; + else if (scenenum + 1 < MAX_PAGES && scenenum < textprompts[cutnum]->numpages-1) + scenenum++; + else + scenenum = INT32_MAX; + } + + // close the prompt if either num is invalid + if (cutnum == INT32_MAX || scenenum == INT32_MAX) + F_EndTextPrompt(false, false); + else + { + // on page mode, number of tics before allowing boost + // on timer mode, number of tics until page advances + timetonext = textprompts[cutnum]->page[scenenum].timetonext ? textprompts[cutnum]->page[scenenum].timetonext : TICRATE/10; + F_PreparePageText(textprompts[cutnum]->page[scenenum].text); + + // gfx + picnum = textprompts[cutnum]->page[scenenum].pictostart; + numpics = textprompts[cutnum]->page[scenenum].numpics; + picmode = textprompts[cutnum]->page[scenenum].picmode; + pictoloop = textprompts[cutnum]->page[scenenum].pictoloop > 0 ? textprompts[cutnum]->page[scenenum].pictoloop - 1 : 0; + picxpos = textprompts[cutnum]->page[scenenum].xcoord[picnum]; + picypos = textprompts[cutnum]->page[scenenum].ycoord[picnum]; + animtimer = pictime = textprompts[cutnum]->page[scenenum].picduration[picnum]; + + // music change + if (textprompts[cutnum]->page[scenenum].musswitch[0]) + S_ChangeMusic(textprompts[cutnum]->page[scenenum].musswitch, + textprompts[cutnum]->page[scenenum].musswitchflags, + textprompts[cutnum]->page[scenenum].musicloop); + } +} + +void F_EndTextPrompt(boolean forceexec, boolean noexec) +{ + boolean promptwasactive = promptactive; + promptactive = false; + callpromptnum = callpagenum = callplayer = INT32_MAX; + + if (promptwasactive) + { + if (promptmo && promptmo->player && promptblockcontrols) + promptmo->reactiontime = TICRATE/4; // prevent jumping right away // \todo account freeze realtime for this) + // \todo reset frozen realtime? + } + + // \todo net safety, maybe loop all player thinkers? + if ((promptwasactive || forceexec) && !noexec && promptpostexectag) + { + if (tmthing) // edge case where starting an invalid prompt immediately on level load will make P_MapStart fail + P_LinedefExecute(promptpostexectag, promptmo, NULL); + else + { + P_MapStart(); + P_LinedefExecute(promptpostexectag, promptmo, NULL); + P_MapEnd(); + } + } +} + +void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postexectag, boolean blockcontrols, boolean freezerealtime) +{ + INT32 i; + + // if splitscreen and we already have a prompt active, ignore. + // \todo Proper per-player splitscreen support (individual prompts) + if (promptactive && splitscreen && promptnum == callpromptnum && pagenum == callpagenum) + return; + + // \todo proper netgame support + if (netgame) + { + F_EndTextPrompt(true, false); // run the post-effects immediately + return; + } + + // We share vars, so no starting text prompts over cutscenes or title screens! + keypressed = false; + finalecount = 0; + timetonext = 0; + animtimer = 0; + stoptimer = 0; + skullAnimCounter = 0; + + // Set up state + promptmo = mo; + promptpostexectag = postexectag; + promptblockcontrols = blockcontrols; + (void)freezerealtime; // \todo freeze player->realtime, maybe this needs to cycle through player thinkers + + // Initialize current prompt and scene + callpromptnum = promptnum; + callpagenum = pagenum; + cutnum = (promptnum < MAX_PROMPTS && textprompts[promptnum]) ? promptnum : INT32_MAX; + scenenum = (cutnum != INT32_MAX && pagenum < MAX_PAGES && pagenum <= textprompts[cutnum]->numpages-1) ? pagenum : INT32_MAX; + promptactive = (cutnum != INT32_MAX && scenenum != INT32_MAX); + + if (promptactive) + { + // on page mode, number of tics before allowing boost + // on timer mode, number of tics until page advances + timetonext = textprompts[cutnum]->page[scenenum].timetonext ? textprompts[cutnum]->page[scenenum].timetonext : TICRATE/10; + F_PreparePageText(textprompts[cutnum]->page[scenenum].text); + + // gfx + picnum = textprompts[cutnum]->page[scenenum].pictostart; + numpics = textprompts[cutnum]->page[scenenum].numpics; + picmode = textprompts[cutnum]->page[scenenum].picmode; + pictoloop = textprompts[cutnum]->page[scenenum].pictoloop > 0 ? textprompts[cutnum]->page[scenenum].pictoloop - 1 : 0; + picxpos = textprompts[cutnum]->page[scenenum].xcoord[picnum]; + picypos = textprompts[cutnum]->page[scenenum].ycoord[picnum]; + animtimer = pictime = textprompts[cutnum]->page[scenenum].picduration[picnum]; + + // music change + if (textprompts[cutnum]->page[scenenum].musswitch[0]) + S_ChangeMusic(textprompts[cutnum]->page[scenenum].musswitch, + textprompts[cutnum]->page[scenenum].musswitchflags, + textprompts[cutnum]->page[scenenum].musicloop); + + // get the calling player + if (promptblockcontrols && mo && mo->player) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (players[i].mo == mo) + { + callplayer = i; + break; + } + } + } + } + else + F_EndTextPrompt(true, false); // run the post-effects immediately +} + +static boolean F_GetTextPromptTutorialTag(char *tag, INT32 length) +{ + INT32 gcs = gcs_custom; + boolean suffixed = true; + + if (!tag || !tag[0] || !tutorialmode) + return false; + + if (!strncmp(tag, "TAM", 3)) // Movement + gcs = G_GetControlScheme(gamecontrol, gcl_movement, num_gcl_movement); + else if (!strncmp(tag, "TAC", 3)) // Camera + { + // Check for gcl_movement so we can differentiate between FPS and Platform schemes. + gcs = G_GetControlScheme(gamecontrol, gcl_movement, num_gcl_movement); + if (gcs == gcs_custom) // try again, maybe we'll get a match + gcs = G_GetControlScheme(gamecontrol, gcl_camera, num_gcl_camera); + if (gcs == gcs_fps && !cv_usemouse.value) + gcs = gcs_platform; // Platform (arrow) scheme is stand-in for no mouse + } + else if (!strncmp(tag, "TAD", 3)) // Movement and Camera + gcs = G_GetControlScheme(gamecontrol, gcl_movement_camera, num_gcl_movement_camera); + else if (!strncmp(tag, "TAJ", 3)) // Jump + gcs = G_GetControlScheme(gamecontrol, gcl_jump, num_gcl_jump); + else if (!strncmp(tag, "TAS", 3)) // Spin + gcs = G_GetControlScheme(gamecontrol, gcl_use, num_gcl_use); + else if (!strncmp(tag, "TAA", 3)) // Char ability + gcs = G_GetControlScheme(gamecontrol, gcl_jump, num_gcl_jump); + else if (!strncmp(tag, "TAW", 3)) // Shield ability + gcs = G_GetControlScheme(gamecontrol, gcl_jump_use, num_gcl_jump_use); + else + gcs = G_GetControlScheme(gamecontrol, gcl_tutorial_used, num_gcl_tutorial_used); + + switch (gcs) + { + case gcs_fps: + // strncat(tag, "FPS", length); + suffixed = false; + break; + + case gcs_platform: + strncat(tag, "PLATFORM", length); + break; + + default: + strncat(tag, "CUSTOM", length); + break; + } + + return suffixed; +} + +void F_GetPromptPageByNamedTag(const char *tag, INT32 *promptnum, INT32 *pagenum) +{ + INT32 nosuffixpromptnum = INT32_MAX, nosuffixpagenum = INT32_MAX; + INT32 tutorialpromptnum = (tutorialmode) ? TUTORIAL_PROMPT-1 : 0; + boolean suffixed = false, found = false; + char suffixedtag[33]; + + *promptnum = *pagenum = INT32_MAX; + + if (!tag || !tag[0]) + return; + + strncpy(suffixedtag, tag, 33); + suffixedtag[32] = 0; + + if (tutorialmode) + suffixed = F_GetTextPromptTutorialTag(suffixedtag, 33); + + for (*promptnum = 0 + tutorialpromptnum; *promptnum < MAX_PROMPTS; (*promptnum)++) + { + if (!textprompts[*promptnum]) + continue; + + for (*pagenum = 0; *pagenum < textprompts[*promptnum]->numpages && *pagenum < MAX_PAGES; (*pagenum)++) + { + if (suffixed && fastcmp(suffixedtag, textprompts[*promptnum]->page[*pagenum].tag)) + { + // this goes first because fastcmp ends early if first string is shorter + found = true; + break; + } + else if (nosuffixpromptnum == INT32_MAX && nosuffixpagenum == INT32_MAX && fastcmp(tag, textprompts[*promptnum]->page[*pagenum].tag)) + { + if (suffixed) + { + nosuffixpromptnum = *promptnum; + nosuffixpagenum = *pagenum; + // continue searching for the suffixed tag + } + else + { + found = true; + break; + } + } + } + + if (found) + break; + } + + if (suffixed && !found && nosuffixpromptnum != INT32_MAX && nosuffixpagenum != INT32_MAX) + { + found = true; + *promptnum = nosuffixpromptnum; + *pagenum = nosuffixpagenum; + } + + if (!found) + CONS_Debug(DBG_GAMELOGIC, "Text prompt: Can't find a page with named tag %s or suffixed tag %s\n", tag, suffixedtag); +} + +void F_TextPromptDrawer(void) +{ + // reuse: + // cutnum -> promptnum + // scenenum -> pagenum + lumpnum_t iconlump; + UINT8 pagelines; + boolean rightside; + INT32 boxh, texth, texty, namey, chevrony; + INT32 textx, textr; + + // Data + patch_t *patch; + + if (!promptactive) + return; + + iconlump = W_CheckNumForName(textprompts[cutnum]->page[scenenum].iconname); + F_GetPageTextGeometry(&pagelines, &rightside, &boxh, &texth, &texty, &namey, &chevrony, &textx, &textr); + + // Draw gfx first + if (picnum >= 0 && picnum < numpics && textprompts[cutnum]->page[scenenum].picname[picnum][0] != '\0') + { + if (textprompts[cutnum]->page[scenenum].pichires[picnum]) + V_DrawSmallScaledPatch(picxpos, picypos, 0, + W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_CACHE)); + else + V_DrawScaledPatch(picxpos,picypos, 0, + W_CachePatchName(textprompts[cutnum]->page[scenenum].picname[picnum], PU_CACHE)); + } + + // Draw background + V_DrawPromptBack(boxh, textprompts[cutnum]->page[scenenum].backcolor); + + // Draw narrator icon + if (iconlump != LUMPERROR) + { + INT32 iconx, icony, scale, scaledsize; + patch = W_CachePatchName(textprompts[cutnum]->page[scenenum].iconname, PU_CACHE); + + // scale and center + if (patch->width > patch->height) + { + scale = FixedDiv(((boxh * 4) + (boxh/2)*4) - 4, patch->width); + scaledsize = FixedMul(patch->height, scale); + iconx = (rightside ? BASEVIDWIDTH - (((boxh * 4) + (boxh/2)*4)) : 4) << FRACBITS; + icony = ((namey-4) << FRACBITS) + FixedDiv(BASEVIDHEIGHT - namey + 4 - scaledsize, 2); // account for 4 margin + } + else if (patch->height > patch->width) + { + scale = FixedDiv(((boxh * 4) + (boxh/2)*4) - 4, patch->height); + scaledsize = FixedMul(patch->width, scale); + iconx = (rightside ? BASEVIDWIDTH - (((boxh * 4) + (boxh/2)*4)) : 4) << FRACBITS; + icony = namey << FRACBITS; + iconx += FixedDiv(FixedMul(patch->height, scale) - scaledsize, 2); + } + else + { + scale = FixedDiv(((boxh * 4) + (boxh/2)*4) - 4, patch->width); + iconx = (rightside ? BASEVIDWIDTH - (((boxh * 4) + (boxh/2)*4)) : 4) << FRACBITS; + icony = namey << FRACBITS; + } + + if (textprompts[cutnum]->page[scenenum].iconflip) + iconx += FixedMul(patch->width, scale) << FRACBITS; + + V_DrawFixedPatch(iconx, icony, scale, (V_SNAPTOBOTTOM|(textprompts[cutnum]->page[scenenum].iconflip ? V_FLIP : 0)), patch, NULL); + W_UnlockCachedPatch(patch); + } + + // Draw text + V_DrawString(textx, texty, (V_SNAPTOBOTTOM|V_ALLOWLOWERCASE), cutscene_disptext); + + // Draw name + // Don't use V_YELLOWMAP here so that the name color can be changed with control codes + if (textprompts[cutnum]->page[scenenum].name[0]) + V_DrawString(textx, namey, (V_SNAPTOBOTTOM|V_ALLOWLOWERCASE), textprompts[cutnum]->page[scenenum].name); + + // Draw chevron + if (promptblockcontrols && !timetonext) + V_DrawString(textr-8, chevrony + (skullAnimCounter/5), (V_SNAPTOBOTTOM|V_YELLOWMAP), "\x1B"); // down arrow +} + +void F_TextPromptTicker(void) +{ + INT32 i; + + if (!promptactive || paused || P_AutoPause()) + return; + + // advance animation + finalecount++; + cutscene_boostspeed = 0; + + // for the chevron + if (--skullAnimCounter <= 0) + skullAnimCounter = 8; + + // button handling + if (textprompts[cutnum]->page[scenenum].timetonext) + { + if (promptblockcontrols) // same procedure as below, just without the button handling + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (netgame && i != serverplayer && i != adminplayer) + continue; + else if (splitscreen) { + // Both players' controls are locked, + // But only consoleplayer can advance the prompt. + // \todo Proper per-player splitscreen support (individual prompts) + if (i == consoleplayer || i == secondarydisplayplayer) + players[i].powers[pw_nocontrol] = 1; + } + else if (i == consoleplayer) + players[i].powers[pw_nocontrol] = 1; + + if (!splitscreen) + break; + } + } + + if (timetonext >= 1) + timetonext--; + + if (!timetonext) + F_AdvanceToNextPage(); + + F_WriteText(); + } + else + { + if (promptblockcontrols) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (netgame && i != serverplayer && i != adminplayer) + continue; + else if (splitscreen) { + // Both players' controls are locked, + // But only the triggering player can advance the prompt. + if (i == consoleplayer || i == secondarydisplayplayer) + { + players[i].powers[pw_nocontrol] = 1; + + if (callplayer == consoleplayer || callplayer == secondarydisplayplayer) + { + if (i != callplayer) + continue; + } + else if (i != consoleplayer) + continue; + } + else + continue; + } + else if (i == consoleplayer) + players[i].powers[pw_nocontrol] = 1; + else + continue; + + if ((players[i].cmd.buttons & BT_USE) || (players[i].cmd.buttons & BT_JUMP)) + { + if (timetonext > 1) + timetonext--; + else if (cutscene_baseptr) // don't set boost if we just reset the string + cutscene_boostspeed = 1; // only after a slight delay + + if (keypressed) + { + if (!splitscreen) + break; + else + continue; + } + + if (!timetonext) // is 0 when finished generating text + { + F_AdvanceToNextPage(); + if (promptactive) + S_StartSound(NULL, sfx_menu1); + } + keypressed = true; // prevent repeat events + } + else if (!(players[i].cmd.buttons & BT_USE) && !(players[i].cmd.buttons & BT_JUMP)) + keypressed = false; + + if (!splitscreen) + break; + } + } + + // generate letter-by-letter text + if (scenenum >= MAX_PAGES || + !textprompts[cutnum]->page[scenenum].text || + !textprompts[cutnum]->page[scenenum].text[0] || + !F_WriteText()) + timetonext = !promptblockcontrols; // never show the chevron if we can't toggle pages + } + + // gfx + if (picnum >= 0 && picnum < numpics) + { + if (animtimer <= 0) + { + boolean persistanimtimer = false; + + if (picnum < numpics-1 && textprompts[cutnum]->page[scenenum].picname[picnum+1][0] != '\0') + picnum++; + else if (picmode == PROMPT_PIC_LOOP) + picnum = pictoloop; + else if (picmode == PROMPT_PIC_DESTROY) + picnum = -1; + else // if (picmode == PROMPT_PIC_PERSIST) + persistanimtimer = true; + + if (!persistanimtimer && picnum >= 0) + { + picxpos = textprompts[cutnum]->page[scenenum].xcoord[picnum]; + picypos = textprompts[cutnum]->page[scenenum].ycoord[picnum]; + pictime = textprompts[cutnum]->page[scenenum].picduration[picnum]; + animtimer = pictime; + } + } + else + animtimer--; + } +} diff --git a/src/f_finale.h b/src/f_finale.h index aadc64ad0..8e8a06365 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -17,6 +17,7 @@ #include "doomtype.h" #include "d_event.h" +#include "p_mobj.h" // // FINALE @@ -33,9 +34,10 @@ void F_IntroTicker(void); void F_TitleScreenTicker(boolean run); void F_CutsceneTicker(void); void F_TitleDemoTicker(void); +void F_TextPromptTicker(void); // Called by main loop. -FUNCMATH void F_GameEndDrawer(void); +void F_GameEndDrawer(void); void F_IntroDrawer(void); void F_TitleScreenDrawer(void); @@ -50,6 +52,13 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset void F_CutsceneDrawer(void); void F_EndCutScene(void); +void F_StartTextPrompt(INT32 promptnum, INT32 pagenum, mobj_t *mo, UINT16 postexectag, boolean blockcontrols, boolean freezerealtime); +void F_GetPromptPageByNamedTag(const char *tag, INT32 *promptnum, INT32 *pagenum); +void F_TextPromptDrawer(void); +void F_EndTextPrompt(boolean forceexec, boolean noexec); +boolean F_GetPromptHideHudAll(void); +boolean F_GetPromptHideHud(fixed_t y); + void F_StartGameEnd(void); void F_StartIntro(void); void F_StartTitleScreen(void); diff --git a/src/g_game.c b/src/g_game.c index d3d8eeb25..95a76b95d 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -127,6 +127,14 @@ INT16 titlemap = 0; boolean hidetitlepics = false; INT16 bootmap; //bootmap for loading a map on startup +INT16 tutorialmap = 0; // map to load for tutorial +boolean tutorialmode = false; // are we in a tutorial right now? +INT32 tutorialgcs = gcs_custom; // which control scheme is loaded? +INT32 tutorialusemouse = 0; // store cv_usemouse user value +INT32 tutorialfreelook = 0; // store cv_alwaysfreelook user value +INT32 tutorialmousemove = 0; // store cv_mousemove user value +INT32 tutorialanalog = 0; // store cv_analog user value + boolean looptitle = false; UINT8 skincolor_redteam = SKINCOLOR_RED; @@ -138,6 +146,7 @@ tic_t countdowntimer = 0; boolean countdowntimeup = false; cutscene_t *cutscenes[128]; +textprompt_t *textprompts[MAX_PROMPTS]; INT16 nextmapoverride; boolean skipstats; @@ -201,6 +210,7 @@ UINT16 tailsflytics = 8*TICRATE; UINT16 underwatertics = 30*TICRATE; UINT16 spacetimetics = 11*TICRATE + (TICRATE/2); UINT16 extralifetics = 4*TICRATE; +UINT16 nightslinktics = 2*TICRATE; INT32 gameovertics = 15*TICRATE; @@ -1523,11 +1533,6 @@ static void Analog_OnChange(void) return; } - if (cv_analog.value) - players[consoleplayer].pflags |= PF_ANALOGMODE; - else - players[consoleplayer].pflags &= ~PF_ANALOGMODE; - SendWeaponPref(); } @@ -1543,51 +1548,26 @@ static void Analog2_OnChange(void) return; } - if (cv_analog2.value) - players[secondarydisplayplayer].pflags |= PF_ANALOGMODE; - else - players[secondarydisplayplayer].pflags &= ~PF_ANALOGMODE; - SendWeaponPref2(); } static void DirectionChar_OnChange(void) { - if (cv_directionchar.value) - players[consoleplayer].pflags |= PF_DIRECTIONCHAR; - else - players[consoleplayer].pflags &= ~PF_DIRECTIONCHAR; - SendWeaponPref(); } static void DirectionChar2_OnChange(void) { - if (cv_directionchar2.value) - players[secondarydisplayplayer].pflags |= PF_DIRECTIONCHAR; - else - players[secondarydisplayplayer].pflags &= ~PF_DIRECTIONCHAR; - SendWeaponPref2(); } static void AutoBrake_OnChange(void) { - if (cv_autobrake.value) - players[consoleplayer].pflags |= PF_AUTOBRAKE; - else - players[consoleplayer].pflags &= ~PF_AUTOBRAKE; - SendWeaponPref(); } static void AutoBrake2_OnChange(void) { - if (cv_autobrake2.value) - players[secondarydisplayplayer].pflags |= PF_AUTOBRAKE; - else - players[secondarydisplayplayer].pflags &= ~PF_AUTOBRAKE; - SendWeaponPref2(); } @@ -1956,6 +1936,7 @@ void G_Ticker(boolean run) F_TitleDemoTicker(); P_Ticker(run); // tic the game ST_Ticker(); + F_TextPromptTicker(); AM_Ticker(); HU_Ticker(); break; diff --git a/src/g_game.h b/src/g_game.h index 3d04370aa..dc0c3619d 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -56,6 +56,7 @@ extern INT16 rw_maximums[NUM_WEAPONS]; extern INT32 pausedelay; // used in game menu +extern consvar_t cv_tutorialprompt; extern consvar_t cv_crosshair, cv_crosshair2; extern consvar_t cv_invertmouse, cv_alwaysfreelook, cv_mousemove; extern consvar_t cv_invertmouse2, cv_alwaysfreelook2, cv_mousemove2; diff --git a/src/g_input.c b/src/g_input.c index 67aaf4179..4f7296cd5 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -45,6 +45,47 @@ UINT8 gamekeydown[NUMINPUTS]; // two key codes (or virtual key) per game control INT32 gamecontrol[num_gamecontrols][2]; INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player +INT32 gamecontroldefault[num_gamecontrolschemes][num_gamecontrols][2]; // default control storage, use 0 (gcs_custom) for memory retention + +// lists of GC codes for selective operation +const INT32 gcl_tutorial_check[num_gcl_tutorial_check] = { + gc_forward, gc_backward, gc_strafeleft, gc_straferight, + gc_turnleft, gc_turnright +}; + +const INT32 gcl_tutorial_used[num_gcl_tutorial_used] = { + gc_forward, gc_backward, gc_strafeleft, gc_straferight, + gc_turnleft, gc_turnright, + gc_jump, gc_use +}; + +const INT32 gcl_tutorial_full[num_gcl_tutorial_full] = { + gc_forward, gc_backward, gc_strafeleft, gc_straferight, + gc_lookup, gc_lookdown, gc_turnleft, gc_turnright, gc_centerview, + gc_jump, gc_use, + gc_fire, gc_firenormal +}; + +const INT32 gcl_movement[num_gcl_movement] = { + gc_forward, gc_backward, gc_strafeleft, gc_straferight +}; + +const INT32 gcl_camera[num_gcl_camera] = { + gc_turnleft, gc_turnright +}; + +const INT32 gcl_movement_camera[num_gcl_movement_camera] = { + gc_forward, gc_backward, gc_strafeleft, gc_straferight, + gc_turnleft, gc_turnright +}; + +const INT32 gcl_jump[num_gcl_jump] = { gc_jump }; + +const INT32 gcl_use[num_gcl_use] = { gc_use }; + +const INT32 gcl_jump_use[num_gcl_jump_use] = { + gc_jump, gc_use +}; typedef struct { @@ -611,55 +652,117 @@ INT32 G_KeyStringtoNum(const char *keystr) return 0; } -void G_Controldefault(void) +void G_DefineDefaultControls(void) { - gamecontrol[gc_forward ][0] = 'w'; - gamecontrol[gc_backward ][0] = 's'; - gamecontrol[gc_strafeleft ][0] = 'a'; - gamecontrol[gc_straferight][0] = 'd'; - gamecontrol[gc_turnleft ][0] = KEY_LEFTARROW; - gamecontrol[gc_turnright ][0] = KEY_RIGHTARROW; - gamecontrol[gc_weaponnext ][0] = 'e'; - gamecontrol[gc_weaponprev ][0] = 'q'; - gamecontrol[gc_wepslot1 ][0] = '1'; - gamecontrol[gc_wepslot2 ][0] = '2'; - gamecontrol[gc_wepslot3 ][0] = '3'; - gamecontrol[gc_wepslot4 ][0] = '4'; - gamecontrol[gc_wepslot5 ][0] = '5'; - gamecontrol[gc_wepslot6 ][0] = '6'; - gamecontrol[gc_wepslot7 ][0] = '7'; - gamecontrol[gc_wepslot8 ][0] = '8'; - gamecontrol[gc_wepslot9 ][0] = '9'; - gamecontrol[gc_wepslot10 ][0] = '0'; - gamecontrol[gc_fire ][0] = KEY_RCTRL; - gamecontrol[gc_fire ][1] = KEY_MOUSE1+0; - gamecontrol[gc_firenormal ][0] = 'c'; - gamecontrol[gc_tossflag ][0] = '\''; - gamecontrol[gc_use ][0] = KEY_LSHIFT; - gamecontrol[gc_camtoggle ][0] = 'v'; - gamecontrol[gc_camreset ][0] = 'r'; - gamecontrol[gc_lookup ][0] = KEY_UPARROW; - gamecontrol[gc_lookdown ][0] = KEY_DOWNARROW; - gamecontrol[gc_centerview ][0] = KEY_END; - gamecontrol[gc_talkkey ][0] = 't'; - gamecontrol[gc_teamkey ][0] = 'y'; - gamecontrol[gc_scores ][0] = KEY_TAB; - gamecontrol[gc_jump ][0] = KEY_SPACE; - gamecontrol[gc_console ][0] = KEY_CONSOLE; - gamecontrol[gc_pause ][0] = KEY_PAUSE; + INT32 i; + + // FPS game controls (WASD) + gamecontroldefault[gcs_fps][gc_forward ][0] = 'w'; + gamecontroldefault[gcs_fps][gc_backward ][0] = 's'; + gamecontroldefault[gcs_fps][gc_strafeleft ][0] = 'a'; + gamecontroldefault[gcs_fps][gc_straferight][0] = 'd'; + gamecontroldefault[gcs_fps][gc_lookup ][0] = KEY_UPARROW; + gamecontroldefault[gcs_fps][gc_lookdown ][0] = KEY_DOWNARROW; + gamecontroldefault[gcs_fps][gc_turnleft ][0] = KEY_LEFTARROW; + gamecontroldefault[gcs_fps][gc_turnright ][0] = KEY_RIGHTARROW; + gamecontroldefault[gcs_fps][gc_centerview ][0] = KEY_END; + gamecontroldefault[gcs_fps][gc_jump ][0] = KEY_SPACE; + gamecontroldefault[gcs_fps][gc_use ][0] = KEY_LSHIFT; + gamecontroldefault[gcs_fps][gc_fire ][0] = KEY_RCTRL; + gamecontroldefault[gcs_fps][gc_fire ][1] = KEY_MOUSE1+0; + gamecontroldefault[gcs_fps][gc_firenormal ][0] = 'c'; + + // Platform game controls (arrow keys) + gamecontroldefault[gcs_platform][gc_forward ][0] = KEY_UPARROW; + gamecontroldefault[gcs_platform][gc_backward ][0] = KEY_DOWNARROW; + gamecontroldefault[gcs_platform][gc_strafeleft ][0] = 'a'; + gamecontroldefault[gcs_platform][gc_straferight][0] = 'd'; + gamecontroldefault[gcs_platform][gc_lookup ][0] = KEY_PGUP; + gamecontroldefault[gcs_platform][gc_lookdown ][0] = KEY_PGDN; + gamecontroldefault[gcs_platform][gc_turnleft ][0] = KEY_LEFTARROW; + gamecontroldefault[gcs_platform][gc_turnright ][0] = KEY_RIGHTARROW; + gamecontroldefault[gcs_platform][gc_centerview ][0] = KEY_END; + gamecontroldefault[gcs_platform][gc_jump ][0] = KEY_SPACE; + gamecontroldefault[gcs_platform][gc_use ][0] = KEY_LSHIFT; + gamecontroldefault[gcs_platform][gc_fire ][0] = 's'; + gamecontroldefault[gcs_platform][gc_fire ][1] = KEY_MOUSE1+0; + gamecontroldefault[gcs_platform][gc_firenormal ][0] = 'w'; + + for (i = 1; i < num_gamecontrolschemes; i++) // skip gcs_custom (0) + { + gamecontroldefault[i][gc_weaponnext ][0] = 'e'; + gamecontroldefault[i][gc_weaponprev ][0] = 'q'; + gamecontroldefault[i][gc_wepslot1 ][0] = '1'; + gamecontroldefault[i][gc_wepslot2 ][0] = '2'; + gamecontroldefault[i][gc_wepslot3 ][0] = '3'; + gamecontroldefault[i][gc_wepslot4 ][0] = '4'; + gamecontroldefault[i][gc_wepslot5 ][0] = '5'; + gamecontroldefault[i][gc_wepslot6 ][0] = '6'; + gamecontroldefault[i][gc_wepslot7 ][0] = '7'; + gamecontroldefault[i][gc_wepslot8 ][0] = '8'; + gamecontroldefault[i][gc_wepslot9 ][0] = '9'; + gamecontroldefault[i][gc_wepslot10 ][0] = '0'; + gamecontroldefault[i][gc_tossflag ][0] = '\''; + gamecontroldefault[i][gc_camtoggle ][0] = 'v'; + gamecontroldefault[i][gc_camreset ][0] = 'r'; + gamecontroldefault[i][gc_talkkey ][0] = 't'; + gamecontroldefault[i][gc_teamkey ][0] = 'y'; + gamecontroldefault[i][gc_scores ][0] = KEY_TAB; + gamecontroldefault[i][gc_console ][0] = KEY_CONSOLE; + gamecontroldefault[i][gc_pause ][0] = KEY_PAUSE; + } } -void G_SaveKeySetting(FILE *f) +INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen) +{ + INT32 i, j, gc; + boolean skipscheme; + + for (i = 1; i < num_gamecontrolschemes; i++) // skip gcs_custom (0) + { + skipscheme = false; + for (j = 0; j < (gclist && gclen ? gclen : num_gamecontrols); j++) + { + gc = (gclist && gclen) ? gclist[j] : j; + if (((fromcontrols[gc][0] && gamecontroldefault[i][gc][0]) ? fromcontrols[gc][0] != gamecontroldefault[i][gc][0] : true) && + ((fromcontrols[gc][0] && gamecontroldefault[i][gc][1]) ? fromcontrols[gc][0] != gamecontroldefault[i][gc][1] : true) && + ((fromcontrols[gc][1] && gamecontroldefault[i][gc][0]) ? fromcontrols[gc][1] != gamecontroldefault[i][gc][0] : true) && + ((fromcontrols[gc][1] && gamecontroldefault[i][gc][1]) ? fromcontrols[gc][1] != gamecontroldefault[i][gc][1] : true)) + { + skipscheme = true; + break; + } + } + if (!skipscheme) + return i; + } + + return gcs_custom; +} + +void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen) +{ + INT32 i, gc; + + for (i = 0; i < (gclist && gclen ? gclen : num_gamecontrols); i++) + { + gc = (gclist && gclen) ? gclist[i] : i; + setupcontrols[gc][0] = fromcontrols[gc][0]; + setupcontrols[gc][1] = fromcontrols[gc][1]; + } +} + +void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2], INT32 (*fromcontrolsbis)[2]) { INT32 i; for (i = 1; i < num_gamecontrols; i++) { fprintf(f, "setcontrol \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(gamecontrol[i][0])); + G_KeynumToString(fromcontrols[i][0])); - if (gamecontrol[i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrol[i][1])); + if (fromcontrols[i][1]) + fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrols[i][1])); else fprintf(f, "\n"); } @@ -667,10 +770,10 @@ void G_SaveKeySetting(FILE *f) for (i = 1; i < num_gamecontrols; i++) { fprintf(f, "setcontrol2 \"%s\" \"%s\"", gamecontrolname[i], - G_KeynumToString(gamecontrolbis[i][0])); + G_KeynumToString(fromcontrolsbis[i][0])); - if (gamecontrolbis[i][1]) - fprintf(f, " \"%s\"\n", G_KeynumToString(gamecontrolbis[i][1])); + if (fromcontrolsbis[i][1]) + fprintf(f, " \"%s\"\n", G_KeynumToString(fromcontrolsbis[i][1])); else fprintf(f, "\n"); } diff --git a/src/g_input.h b/src/g_input.h index 2a447c683..4bf67ebd8 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -99,6 +99,14 @@ typedef enum num_gamecontrols } gamecontrols_e; +typedef enum +{ + gcs_custom, + gcs_fps, + gcs_platform, + num_gamecontrolschemes +} gamecontrolschemes_e; + // mouse values are used once extern consvar_t cv_mousesens, cv_mouseysens; extern consvar_t cv_mousesens2, cv_mouseysens2; @@ -116,9 +124,30 @@ extern UINT8 gamekeydown[NUMINPUTS]; // two key codes (or virtual key) per game control extern INT32 gamecontrol[num_gamecontrols][2]; extern INT32 gamecontrolbis[num_gamecontrols][2]; // secondary splitscreen player +extern INT32 gamecontroldefault[num_gamecontrolschemes][num_gamecontrols][2]; // default control storage, use 0 (gcs_custom) for memory retention #define PLAYER1INPUTDOWN(gc) (gamekeydown[gamecontrol[gc][0]] || gamekeydown[gamecontrol[gc][1]]) #define PLAYER2INPUTDOWN(gc) (gamekeydown[gamecontrolbis[gc][0]] || gamekeydown[gamecontrolbis[gc][1]]) +#define num_gcl_tutorial_check 6 +#define num_gcl_tutorial_used 8 +#define num_gcl_tutorial_full 13 +#define num_gcl_movement 4 +#define num_gcl_camera 2 +#define num_gcl_movement_camera 6 +#define num_gcl_jump 1 +#define num_gcl_use 1 +#define num_gcl_jump_use 2 + +extern const INT32 gcl_tutorial_check[num_gcl_tutorial_check]; +extern const INT32 gcl_tutorial_used[num_gcl_tutorial_used]; +extern const INT32 gcl_tutorial_full[num_gcl_tutorial_full]; +extern const INT32 gcl_movement[num_gcl_movement]; +extern const INT32 gcl_camera[num_gcl_camera]; +extern const INT32 gcl_movement_camera[num_gcl_movement_camera]; +extern const INT32 gcl_jump[num_gcl_jump]; +extern const INT32 gcl_use[num_gcl_use]; +extern const INT32 gcl_jump_use[num_gcl_jump_use]; + // peace to my little coder fingers! // check a gamecontrol being active or not @@ -133,8 +162,10 @@ INT32 G_KeyStringtoNum(const char *keystr); void G_ClearControlKeys(INT32 (*setupcontrols)[2], INT32 control); void Command_Setcontrol_f(void); void Command_Setcontrol2_f(void); -void G_Controldefault(void); -void G_SaveKeySetting(FILE *f); +void G_DefineDefaultControls(void); +INT32 G_GetControlScheme(INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen); +void G_CopyControls(INT32 (*setupcontrols)[2], INT32 (*fromcontrols)[2], const INT32 *gclist, INT32 gclen); +void G_SaveKeySetting(FILE *f, INT32 (*fromcontrols)[2], INT32 (*fromcontrolsbis)[2]); void G_CheckDoubleUsage(INT32 keynum); #endif diff --git a/src/hardware/hw3sound.c b/src/hardware/hw3sound.c index c68430921..f7c6e1da0 100644 --- a/src/hardware/hw3sound.c +++ b/src/hardware/hw3sound.c @@ -361,7 +361,7 @@ INT32 HW3S_I_StartSound(const void *origin_p, source3D_data_t *source_parm, chan if (splitscreen) listenmobj2 = players[secondarydisplayplayer].mo; - if (nosound) + if (sound_disabled) return -1; sfx = &S_sfx[sfx_id]; diff --git a/src/hardware/hw_clip.c b/src/hardware/hw_clip.c index fd6ba13f3..6d120efe7 100644 --- a/src/hardware/hw_clip.c +++ b/src/hardware/hw_clip.c @@ -338,7 +338,7 @@ angle_t gld_FrustumAngle(void) } // If the pitch is larger than this you can look all around at a FOV of 90 - if (aimingangle > (ANGLE_45+ANG1) && (ANGLE_315-ANG1) > aimingangle) + if (abs((signed)aimingangle) > 46 * ANG1) return 0xffffffff; // ok, this is a gross hack that barely works... diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index f6bbf9455..44929dd67 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -26,10 +26,6 @@ #include #endif -#if defined (VID_X11) && !defined (HAVE_SDL) -#include -#endif - #include "../doomdef.h" //THIS MUST DISAPPEAR!!! #include "hw_glide.h" diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 02608892e..100bb1180 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -114,10 +114,10 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option) if (option & V_NOSCALESTART) sdupx = sdupy = 2.0f; - v[0].x = v[3].x = (x*sdupx-gpatch->leftoffset*pdupx)/vid.width - 1; - v[2].x = v[1].x = (x*sdupx+(gpatch->width-gpatch->leftoffset)*pdupx)/vid.width - 1; - v[0].y = v[1].y = 1-(y*sdupy-gpatch->topoffset*pdupy)/vid.height; - v[2].y = v[3].y = 1-(y*sdupy+(gpatch->height-gpatch->topoffset)*pdupy)/vid.height; + v[0].x = v[3].x = (x*sdupx-SHORT(gpatch->leftoffset)*pdupx)/vid.width - 1; + v[2].x = v[1].x = (x*sdupx+(SHORT(gpatch->width)-SHORT(gpatch->leftoffset))*pdupx)/vid.width - 1; + v[0].y = v[1].y = 1-(y*sdupy-SHORT(gpatch->topoffset)*pdupy)/vid.height; + v[2].y = v[3].y = 1-(y*sdupy+(SHORT(gpatch->height)-SHORT(gpatch->topoffset))*pdupy)/vid.height; v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; @@ -183,18 +183,29 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, dupx = dupy = (dupx < dupy ? dupx : dupy); fscalew = fscaleh = FIXED_TO_FLOAT(pscale); - if (option & V_OFFSET) + // See my comments in v_video.c's V_DrawFixedPatch + // -- Monster Iestyn 29/10/18 { - cx -= (float)gpatch->leftoffset * dupx * fscalew; - cy -= (float)gpatch->topoffset * dupy * fscaleh; - } - else - { - cy -= (float)gpatch->topoffset * fscaleh; + float offsetx = 0.0f, offsety = 0.0f; + + // left offset if (option & V_FLIP) - cx -= ((float)gpatch->width - (float)gpatch->leftoffset) * fscalew; + offsetx = (float)(SHORT(gpatch->width) - SHORT(gpatch->leftoffset)) * fscalew; else - cx -= (float)gpatch->leftoffset * fscalew; + offsetx = (float)SHORT(gpatch->leftoffset) * fscalew; + + // top offset + // TODO: make some kind of vertical version of V_FLIP, maybe by deprecating V_OFFSET in future?!? + offsety = (float)SHORT(gpatch->topoffset) * fscaleh; + + if ((option & (V_NOSCALESTART|V_OFFSET)) == (V_NOSCALESTART|V_OFFSET)) // Multiply by dupx/dupy for crosshairs + { + offsetx *= dupx; + offsety *= dupy; + } + + cx -= offsetx; + cy -= offsety; } if (splitscreen && (option & V_PERPLAYER)) @@ -285,7 +296,7 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, Z_Free(realpatch); } // centre screen - if (vid.width != BASEVIDWIDTH * vid.dupx) + if ((float)vid.width != (float)BASEVIDWIDTH * dupx) { if (option & V_SNAPTORIGHT) cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)); @@ -296,7 +307,7 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, else if (perplayershuffle & 8) cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/4; } - if (vid.height != BASEVIDHEIGHT * vid.dupy) + if ((float)vid.height != (float)BASEVIDHEIGHT * dupy) { if (option & V_SNAPTOBOTTOM) cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)); @@ -312,13 +323,13 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, if (pscale != FRACUNIT || (splitscreen && option & V_PERPLAYER)) { - fwidth = (float)gpatch->width * fscalew * dupx; - fheight = (float)gpatch->height * fscaleh * dupy; + fwidth = (float)SHORT(gpatch->width) * fscalew * dupx; + fheight = (float)SHORT(gpatch->height) * fscaleh * dupy; } else { - fwidth = (float)gpatch->width * dupx; - fheight = (float)gpatch->height * dupy; + fwidth = (float)SHORT(gpatch->width) * dupx; + fheight = (float)SHORT(gpatch->height) * dupy; } // positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1 @@ -418,8 +429,8 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal // fuck it, no GL support for croppedpatch v_perplayer right now. it's not like it's accessible to Lua or anything, and we only use it for menus... - cy -= (float)gpatch->topoffset * fscale; - cx -= (float)gpatch->leftoffset * fscale; + cy -= (float)SHORT(gpatch->topoffset) * fscale; + cx -= (float)SHORT(gpatch->leftoffset) * fscale; if (!(option & V_NOSCALESTART)) { @@ -441,14 +452,14 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal Z_Free(realpatch); } // centre screen - if (vid.width != BASEVIDWIDTH * vid.dupx) + if ((float)vid.width != (float)BASEVIDWIDTH * dupx) { if (option & V_SNAPTORIGHT) cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)); else if (!(option & V_SNAPTOLEFT)) cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2; } - if (vid.height != BASEVIDHEIGHT * vid.dupy) + if ((float)vid.height != (float)BASEVIDHEIGHT * dupy) { if (option & V_SNAPTOBOTTOM) cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)); @@ -461,11 +472,11 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal fwidth = w; fheight = h; - if (fwidth > gpatch->width) - fwidth = gpatch->width; + if (fwidth > SHORT(gpatch->width)) + fwidth = SHORT(gpatch->width); - if (fheight > gpatch->height) - fheight = gpatch->height; + if (fheight > SHORT(gpatch->height)) + fheight = SHORT(gpatch->height); if (pscale != FRACUNIT) { @@ -495,17 +506,17 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; - v[0].sow = v[3].sow = ((sx )/(float)gpatch->width )*gpatch->max_s; - if (sx + w > gpatch->width) + v[0].sow = v[3].sow = ((sx )/(float)SHORT(gpatch->width) )*gpatch->max_s; + if (sx + w > SHORT(gpatch->width)) v[2].sow = v[1].sow = gpatch->max_s; else - v[2].sow = v[1].sow = ((sx+w)/(float)gpatch->width )*gpatch->max_s; + v[2].sow = v[1].sow = ((sx+w)/(float)SHORT(gpatch->width) )*gpatch->max_s; - v[0].tow = v[1].tow = ((sy )/(float)gpatch->height)*gpatch->max_t; - if (sy + h > gpatch->height) + v[0].tow = v[1].tow = ((sy )/(float)SHORT(gpatch->height))*gpatch->max_t; + if (sy + h > SHORT(gpatch->height)) v[2].tow = v[3].tow = gpatch->max_t; else - v[2].tow = v[3].tow = ((sy+h)/(float)gpatch->height)*gpatch->max_t; + v[2].tow = v[3].tow = ((sy+h)/(float)SHORT(gpatch->height))*gpatch->max_t; flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest; @@ -705,6 +716,32 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height) HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); } +// Very similar to HWR_DrawConsoleBack, except we draw from the middle(-ish) of the screen to the bottom. +void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight) +{ + FOutVector v[4]; + FSurfaceInfo Surf; + INT32 height = (boxheight * 4) + (boxheight/2)*5; // 4 lines of space plus gaps between and some leeway + + // setup some neat-o translucency effect + + v[0].x = v[3].x = -1.0f; + v[2].x = v[1].x = 1.0f; + v[0].y = v[1].y = -1.0f; + v[2].y = v[3].y = -1.0f+((height<<1)/(float)vid.height); + v[0].z = v[1].z = v[2].z = v[3].z = 1.0f; + + v[0].sow = v[3].sow = 0.0f; + v[2].sow = v[1].sow = 1.0f; + v[0].tow = v[1].tow = 1.0f; + v[2].tow = v[3].tow = 0.0f; + + Surf.FlatColor.rgba = UINT2RGBA(color); + Surf.FlatColor.s.alpha = (color == 0 ? 0xC0 : 0x80); // make black darker, like software + + HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); +} + // ========================================================================== // R_DRAW.C STUFF @@ -985,7 +1022,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) fw *= dupx; fh *= dupy; - if (vid.width != BASEVIDWIDTH * vid.dupx) + if ((float)vid.width != (float)BASEVIDWIDTH * dupx) { if (color & V_SNAPTORIGHT) fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)); @@ -996,7 +1033,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) else if (perplayershuffle & 8) fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 4; } - if (vid.height != BASEVIDHEIGHT * dupy) + if ((float)vid.height != (float)BASEVIDHEIGHT * dupy) { // same thing here if (color & V_SNAPTOBOTTOM) diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index a5ac82001..e2fa90eb0 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -32,10 +32,6 @@ // STANDARD DLL EXPORTS // ========================================================================== -#ifdef HAVE_SDL -#undef VID_X11 -#endif - EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction); #ifndef HAVE_SDL EXPORT void HWRAPI(Shutdown) (void); @@ -43,9 +39,6 @@ EXPORT void HWRAPI(Shutdown) (void); #ifdef _WINDOWS EXPORT void HWRAPI(GetModeList) (vmode_t **pvidmodes, INT32 *numvidmodes); #endif -#ifdef VID_X11 -EXPORT Window HWRAPI(HookXwin) (Display *, INT32, INT32, boolean); -#endif #if defined (PURESDL) || defined (macintosh) EXPORT void HWRAPI(SetPalette) (INT32 *, RGBA_t *gamma); #else @@ -71,10 +64,6 @@ EXPORT void HWRAPI(SetTransform) (FTransform *ptransform); EXPORT INT32 HWRAPI(GetTextureUsed) (void); EXPORT INT32 HWRAPI(GetRenderVersion) (void); -#ifdef VID_X11 // ifdef to be removed as soon as windoze supports that as well -// metzgermeister: added for Voodoo detection -EXPORT char *HWRAPI(GetRenderer) (void); -#endif #ifdef SHUFFLE #define SCREENVERTS 10 EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]); @@ -115,10 +104,6 @@ struct hwdriver_s #ifdef _WINDOWS GetModeList pfnGetModeList; #endif -#ifdef VID_X11 - HookXwin pfnHookXwin; - GetRenderer pfnGetRenderer; -#endif #ifndef HAVE_SDL Shutdown pfnShutdown; #endif diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 119be6b46..2e9e5726a 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1063,7 +1063,7 @@ static float HWR_ClipViewSegment(INT32 x, polyvertex_t *v1, polyvertex_t *v2) // // HWR_SplitWall // -static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, FSurfaceInfo* Surf, UINT32 cutflag, ffloor_t *pfloor) +static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor) { /* SoM: split up and light walls according to the lightlist. This may also include leaving out parts @@ -1126,7 +1126,7 @@ static void HWR_SplitWall(sector_t *sector, wallVert3D *wallVerts, INT32 texnum, else { lightnum = *list[i].lightlevel; - colormap = list[i].extra_colormap; + colormap = *list[i].extra_colormap; } } @@ -2116,6 +2116,10 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) else { fixed_t texturevpeg; + boolean attachtobottom = false; +#ifdef ESLOPE + boolean slopeskew = false; // skew FOF walls with slopes? +#endif // Wow, how was this missing from OpenGL for so long? // ...Oh well, anyway, Lower Unpegged now changes pegging of FOFs like in software @@ -2123,24 +2127,50 @@ static void HWR_StoreWallRange(double startfrac, double endfrac) if (newline) { texturevpeg = sides[newline->sidenum[0]].rowoffset; - if (newline->flags & ML_DONTPEGBOTTOM) - texturevpeg -= *rover->topheight - *rover->bottomheight; + attachtobottom = !!(newline->flags & ML_DONTPEGBOTTOM); +#ifdef ESLOPE + slopeskew = !!(newline->flags & ML_DONTPEGTOP); +#endif } else { texturevpeg = sides[rover->master->sidenum[0]].rowoffset; - if (gr_linedef->flags & ML_DONTPEGBOTTOM) - texturevpeg -= *rover->topheight - *rover->bottomheight; + attachtobottom = !!(gr_linedef->flags & ML_DONTPEGBOTTOM); +#ifdef ESLOPE + slopeskew = !!(rover->master->flags & ML_DONTPEGTOP); +#endif } grTex = HWR_GetTexture(texnum); #ifdef ESLOPE - wallVerts[3].t = (*rover->topheight - h + texturevpeg) * grTex->scaleY; - wallVerts[2].t = (*rover->topheight - hS + texturevpeg) * grTex->scaleY; - wallVerts[0].t = (*rover->topheight - l + texturevpeg) * grTex->scaleY; - wallVerts[1].t = (*rover->topheight - lS + texturevpeg) * grTex->scaleY; + if (!slopeskew) // no skewing + { + if (attachtobottom) + texturevpeg -= *rover->topheight - *rover->bottomheight; + wallVerts[3].t = (*rover->topheight - h + texturevpeg) * grTex->scaleY; + wallVerts[2].t = (*rover->topheight - hS + texturevpeg) * grTex->scaleY; + wallVerts[0].t = (*rover->topheight - l + texturevpeg) * grTex->scaleY; + wallVerts[1].t = (*rover->topheight - lS + texturevpeg) * grTex->scaleY; + } + else + { + if (!attachtobottom) // skew by top + { + wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY; + wallVerts[0].t = (h - l + texturevpeg) * grTex->scaleY; + wallVerts[1].t = (hS - lS + texturevpeg) * grTex->scaleY; + } + else // skew by bottom + { + wallVerts[0].t = wallVerts[1].t = texturevpeg * grTex->scaleY; + wallVerts[3].t = wallVerts[0].t - (h - l) * grTex->scaleY; + wallVerts[2].t = wallVerts[1].t - (hS - lS) * grTex->scaleY; + } + } #else + if (attachtobottom) + texturevpeg -= *rover->topheight - *rover->bottomheight; wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + texturevpeg) * grTex->scaleY; wallVerts[0].t = wallVerts[1].t = (*rover->topheight - l + texturevpeg) * grTex->scaleY; #endif @@ -3486,12 +3516,12 @@ static void HWR_Subsector(size_t num) light = R_GetPlaneLight(gr_frontsector, locFloorHeight, false); if (gr_frontsector->floorlightsec == -1) floorlightlevel = *gr_frontsector->lightlist[light].lightlevel; - floorcolormap = gr_frontsector->lightlist[light].extra_colormap; + floorcolormap = *gr_frontsector->lightlist[light].extra_colormap; light = R_GetPlaneLight(gr_frontsector, locCeilingHeight, false); if (gr_frontsector->ceilinglightsec == -1) ceilinglightlevel = *gr_frontsector->lightlist[light].lightlevel; - ceilingcolormap = gr_frontsector->lightlist[light].extra_colormap; + ceilingcolormap = *gr_frontsector->lightlist[light].extra_colormap; } sub->sector->extra_colormap = gr_frontsector->extra_colormap; @@ -3617,7 +3647,7 @@ static void HWR_Subsector(size_t num) *rover->bottomheight, *gr_frontsector->lightlist[light].lightlevel, rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, PF_Translucent, - false, gr_frontsector->lightlist[light].extra_colormap); + false, *gr_frontsector->lightlist[light].extra_colormap); #endif } else @@ -3625,7 +3655,7 @@ static void HWR_Subsector(size_t num) HWR_GetFlat(levelflats[*rover->bottompic].lumpnum); light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); HWR_RenderPlane(NULL, &extrasubsectors[num], false, *rover->bottomheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->bottompic].lumpnum, - rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap); + rover->master->frontsector, 255, false, *gr_frontsector->lightlist[light].extra_colormap); } } @@ -3680,7 +3710,7 @@ static void HWR_Subsector(size_t num) *rover->topheight, *gr_frontsector->lightlist[light].lightlevel, rover->alpha-1 > 255 ? 255 : rover->alpha-1, rover->master->frontsector, PF_Translucent, - false, gr_frontsector->lightlist[light].extra_colormap); + false, *gr_frontsector->lightlist[light].extra_colormap); #endif } @@ -3689,7 +3719,7 @@ static void HWR_Subsector(size_t num) HWR_GetFlat(levelflats[*rover->toppic].lumpnum); light = R_GetPlaneLight(gr_frontsector, centerHeight, dup_viewz < cullHeight ? true : false); HWR_RenderPlane(NULL, &extrasubsectors[num], true, *rover->topheight, PF_Occlude, *gr_frontsector->lightlist[light].lightlevel, levelflats[*rover->toppic].lumpnum, - rover->master->frontsector, 255, false, gr_frontsector->lightlist[light].extra_colormap); + rover->master->frontsector, 255, false, *gr_frontsector->lightlist[light].extra_colormap); } } } @@ -4200,8 +4230,8 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *sector->lightlist[light].lightlevel; - if (sector->lightlist[light].extra_colormap) - colormap = sector->lightlist[light].extra_colormap; + if (*sector->lightlist[light].extra_colormap) + colormap = *sector->lightlist[light].extra_colormap; } else { @@ -4362,7 +4392,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) // Start with the lightlevel and colormap from the top of the sprite lightlevel = *list[sector->numlights - 1].lightlevel; - colormap = list[sector->numlights - 1].extra_colormap; + colormap = *list[sector->numlights - 1].extra_colormap; i = 0; temp = FLOAT_TO_FIXED(realtop); @@ -4378,7 +4408,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) { if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *list[i-1].lightlevel; - colormap = list[i-1].extra_colormap; + colormap = *list[i-1].extra_colormap; break; } } @@ -4386,7 +4416,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) i = R_GetPlaneLight(sector, temp, false); if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *list[i].lightlevel; - colormap = list[i].extra_colormap; + colormap = *list[i].extra_colormap; #endif for (i = 0; i < sector->numlights; i++) @@ -4402,7 +4432,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) { if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *list[i].lightlevel; - colormap = list[i].extra_colormap; + colormap = *list[i].extra_colormap; } #ifdef ESLOPE @@ -4734,8 +4764,8 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr) if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *sector->lightlist[light].lightlevel; - if (sector->lightlist[light].extra_colormap) - colormap = sector->lightlist[light].extra_colormap; + if (*sector->lightlist[light].extra_colormap) + colormap = *sector->lightlist[light].extra_colormap; } else { @@ -5270,8 +5300,10 @@ static void HWR_AddSprites(sector_t *sec) approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); - if (approx_dist <= limit_dist) - HWR_ProjectSprite(thing); + if (approx_dist > limit_dist) + continue; + + HWR_ProjectSprite(thing); } } else @@ -5293,8 +5325,10 @@ static void HWR_AddSprites(sector_t *sec) approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); - if (approx_dist <= limit_dist) - HWR_ProjectPrecipitationSprite(precipthing); + if (approx_dist > limit_dist) + continue; + + HWR_ProjectPrecipitationSprite(precipthing); } } else @@ -5624,6 +5658,16 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) x1 = tr_x + x1 * rightcos; x2 = tr_x - x2 * rightcos; + // okay, we can't return now... this is a hack, but weather isn't networked, so it should be ok + if (!(thing->precipflags & PCF_THUNK)) + { + if (thing->precipflags & PCF_RAIN) + P_RainThinker(thing); + else + P_SnowThinker(thing); + thing->precipflags |= PCF_THUNK; + } + // // store information in a vissprite // diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 1ae2d8fc3..f25720d1e 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -35,6 +35,7 @@ void HWR_clearAutomap(void); void HWR_drawAMline(const fline_t *fl, INT32 color); void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength); void HWR_DrawConsoleBack(UINT32 color, INT32 height); +void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight); void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player); void HWR_RenderPlayerView(INT32 viewnumber, player_t *player); void HWR_DrawViewBorder(INT32 clearlines); diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index bfb2638ee..d69233a9b 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1194,8 +1194,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr) if (!(spr->mobj->frame & FF_FULLBRIGHT)) lightlevel = *sector->lightlist[light].lightlevel; - if (sector->lightlist[light].extra_colormap) - colormap = sector->lightlist[light].extra_colormap; + if (*sector->lightlist[light].extra_colormap) + colormap = *sector->lightlist[light].extra_colormap; } else { diff --git a/src/hardware/hw_md2.h b/src/hardware/hw_md2.h index c7cda35af..24a563933 100644 --- a/src/hardware/hw_md2.h +++ b/src/hardware/hw_md2.h @@ -29,6 +29,11 @@ // model version #define MD2_VERSION 8 +// magic number "IDP2" or 844121161 +#define MD2_IDENT (INT32)(('2' << 24) + ('P' << 16) + ('D' << 8) + 'I') +// model version +#define MD2_VERSION 8 + #define MD2_MAX_TRIANGLES 8192 #define MD2_MAX_VERTICES 4096 #define MD2_MAX_TEXCOORDS 4096 diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 9e67e49b5..46906dd73 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -86,7 +86,7 @@ void HU_Init(void); void HU_LoadGraphics(void); // reset heads up when consoleplayer respawns. -FUNCMATH void HU_Start(void); +void HU_Start(void); boolean HU_Responder(event_t *ev); diff --git a/src/i_sound.h b/src/i_sound.h index 084479ee1..bc9829fdd 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -18,6 +18,21 @@ #include "sounds.h" #include "command.h" +// copied from SDL mixer, plus GME +typedef enum { + MU_NONE, + MU_CMD, + MU_WAV, + MU_MOD, + MU_MID, + MU_OGG, + MU_MP3, + MU_MP3_MAD_UNUSED, // use MU_MP3 instead + MU_FLAC, + MU_MODPLUG_UNUSED, // use MU_MOD instead + MU_GME +} musictype_t; + /** \brief Sound subsystem runing and waiting */ extern UINT8 sound_started; @@ -51,9 +66,9 @@ void I_StartupSound(void); */ void I_ShutdownSound(void); -// -// SFX I/O -// +/// ------------------------ +/// SFX I/O +/// ------------------------ /** \brief Starts a sound in a particular sound channel. \param id sfxid @@ -64,7 +79,7 @@ void I_ShutdownSound(void); \return sfx handle */ -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority); +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel); /** \brief Stops a sound channel. @@ -105,9 +120,10 @@ void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch); */ void I_SetSfxVolume(UINT8 volume); -// -// MUSIC I/O -// +/// ------------------------ +// MUSIC SYSTEM +/// ------------------------ + /** \brief Init the music systems */ void I_InitMusic(void); @@ -116,41 +132,23 @@ void I_InitMusic(void); */ void I_ShutdownMusic(void); -/** \brief PAUSE game handling. +/// ------------------------ +// MUSIC PROPERTIES +/// ------------------------ - \param handle song handle +musictype_t I_SongType(void); +boolean I_SongPlaying(void); +boolean I_SongPaused(void); - \return void -*/ -void I_PauseSong(INT32 handle); +/// ------------------------ +// MUSIC EFFECTS +/// ------------------------ -/** \brief RESUME game handling +boolean I_SetSongSpeed(float speed); - \param handle song handle - - \return void -*/ -void I_ResumeSong(INT32 handle); - -// -// MIDI I/O -// - -/** \brief Startup the MIDI music system -*/ -void I_InitMIDIMusic(void); - -/** \brief Shutdown the MIDI music system -*/ -void I_ShutdownMIDIMusic(void); - -/** \brief The I_SetMIDIMusicVolume function - - \param volume volume to set at - - \return void -*/ -void I_SetMIDIMusicVolume(UINT8 volume); +/// ------------------------ +// MUSIC PLAYBACK +/// ------------------------ /** \brief Registers a song handle to song data. @@ -161,7 +159,16 @@ void I_SetMIDIMusicVolume(UINT8 volume); \todo Remove this */ -INT32 I_RegisterSong(void *data, size_t len); +boolean I_LoadSong(char *data, size_t len); + +/** \brief See ::I_LoadSong, then think backwards + + \param handle song handle + + \sa I_LoadSong + \todo remove midi handle +*/ +void I_UnloadSong(void); /** \brief Called by anything that wishes to start music @@ -172,7 +179,7 @@ INT32 I_RegisterSong(void *data, size_t len); \todo pass music name, not handle */ -boolean I_PlaySong(INT32 handle, boolean looping); +boolean I_PlaySong(boolean looping); /** \brief Stops a song over 3 seconds @@ -181,58 +188,37 @@ boolean I_PlaySong(INT32 handle, boolean looping); /todo drop handle */ -void I_StopSong(INT32 handle); +void I_StopSong(void); -/** \brief See ::I_RegisterSong, then think backwards +/** \brief PAUSE game handling. \param handle song handle - \sa I_RegisterSong - \todo remove midi handle + \return void */ -void I_UnRegisterSong(INT32 handle); +void I_PauseSong(void); -// -// DIGMUSIC I/O -// +/** \brief RESUME game handling -/** \brief Startup the music system + \param handle song handle + + \return void */ -void I_InitDigMusic(void); +void I_ResumeSong(void); -/** \brief Shutdown the music system -*/ -void I_ShutdownDigMusic(void); - -boolean I_SetSongSpeed(float speed); - -boolean I_SetSongTrack(INT32 track); - -/** \brief The I_StartDigSong function - - \param musicname music lump name - \param looping if true, loop the song - - \return if true, song playing -*/ -boolean I_StartDigSong(const char *musicname, boolean looping); - -/** \brief stop non-MIDI song -*/ -void I_StopDigSong(void); - -/** \brief The I_SetDigMusicVolume function +/** \brief The I_SetMusicVolume function \param volume volume to set at \return void */ -void I_SetDigMusicVolume(UINT8 volume); +void I_SetMusicVolume(UINT8 volume); -// -// CD MUSIC I/O -// +boolean I_SetSongTrack(INT32 track); +/// ------------------------ +// CD MUSIC I/O +/// ------------------------ /** \brief cd music interface */ diff --git a/src/i_tcp.c b/src/i_tcp.c index 9bb4ec630..c62adab06 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -225,6 +225,33 @@ static void wattcp_outch(char s) } #endif +#ifdef USE_WINSOCK +// stupid microsoft makes things complicated +static char *get_WSAErrorStr(int e) +{ + static char buf[256]; // allow up to 255 bytes + + buf[0] = '\0'; + + FormatMessageA( + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + (DWORD)e, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR)buf, + sizeof (buf), + NULL); + + if (!buf[0]) // provide a fallback error message if no message is available for some reason + sprintf(buf, "Unknown error"); + + return buf; +} +#undef strerror +#define strerror get_WSAErrorStr +#endif + #ifdef USE_WINSOCK2 #define inet_ntop inet_ntopA #define HAVE_NTOP @@ -649,14 +676,29 @@ static boolean SOCK_CanGet(void) #endif #ifndef NONET -static void SOCK_Send(void) +static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr) { - ssize_t c = ERRSOCKET; socklen_t d4 = (socklen_t)sizeof(struct sockaddr_in); #ifdef HAVE_IPV6 socklen_t d6 = (socklen_t)sizeof(struct sockaddr_in6); #endif socklen_t d, da = (socklen_t)sizeof(mysockaddr_t); + + switch (sockaddr->any.sa_family) + { + case AF_INET: d = d4; break; +#ifdef HAVE_IPV6 + case AF_INET6: d = d6; break; +#endif + default: d = da; break; + } + + return sendto(socket, (char *)&doomcom->data, doomcom->datalength, 0, &sockaddr->any, d); +} + +static void SOCK_Send(void) +{ + ssize_t c = ERRSOCKET; size_t i, j; if (!nodeconnected[doomcom->remotenode]) @@ -669,19 +711,7 @@ static void SOCK_Send(void) for (j = 0; j < broadcastaddresses; j++) { if (myfamily[i] == broadcastaddress[j].any.sa_family) - { - if (broadcastaddress[i].any.sa_family == AF_INET) - d = d4; -#ifdef HAVE_IPV6 - else if (broadcastaddress[i].any.sa_family == AF_INET6) - d = d6; -#endif - else - d = da; - - c = sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0, - &broadcastaddress[j].any, d); - } + SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]); } } return; @@ -691,40 +721,22 @@ static void SOCK_Send(void) for (i = 0; i < mysocketses; i++) { if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family) - { - if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET) - d = d4; -#ifdef HAVE_IPV6 - else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6) - d = d6; -#endif - else - d = da; - - sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0, - &clientaddress[doomcom->remotenode].any, d); - } + SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]); } return; } else { - if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET) - d = d4; -#ifdef HAVE_IPV6 - else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6) - d = d6; -#endif - else - d = da; - - c = sendto(nodesocket[doomcom->remotenode], (char *)&doomcom->data, doomcom->datalength, 0, - &clientaddress[doomcom->remotenode].any, d); + c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]); } - if (c == ERRSOCKET && errno != ECONNREFUSED && errno != EWOULDBLOCK) - I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode, - SOCK_GetNodeAddress(doomcom->remotenode), errno, strerror(errno)); + if (c == ERRSOCKET) + { + int e = errno; // save error code so it can't be modified later + if (e != ECONNREFUSED && e != EWOULDBLOCK) + I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode, + SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e)); + } } #endif @@ -1007,7 +1019,7 @@ static boolean UDP_Socket(void) if (gaie == 0) { runp = ai; - while (runp != NULL) + while (runp != NULL && s < MAXNETNODES+1) { memcpy(&clientaddress[s], runp->ai_addr, runp->ai_addrlen); s++; @@ -1022,12 +1034,15 @@ static boolean UDP_Socket(void) clientaddress[s].ip4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); //GetLocalAddress(); // my own ip s++; } + + s = 0; + // setup broadcast adress to BROADCASTADDR entry gaie = I_getaddrinfo("255.255.255.255", "0", &hints, &ai); if (gaie == 0) { runp = ai; - while (runp != NULL) + while (runp != NULL && s < MAXNETNODES+1) { memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen); s++; @@ -1050,7 +1065,7 @@ static boolean UDP_Socket(void) if (gaie == 0) { runp = ai; - while (runp != NULL) + while (runp != NULL && s < MAXNETNODES+1) { memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen); s++; diff --git a/src/info.c b/src/info.c index a6d847235..72abcede1 100644 --- a/src/info.c +++ b/src/info.c @@ -2641,6 +2641,8 @@ state_t states[NUMSTATES] = {SPR_FL01, 1, 3, {A_FlickyFly}, 4*FRACUNIT, 16*FRACUNIT, S_FLICKY_01_FLAP2}, // S_FLICKY_01_FLAP1 {SPR_FL01, 2, 3, {A_FlickyFly}, 4*FRACUNIT, 16*FRACUNIT, S_FLICKY_01_FLAP3}, // S_FLICKY_01_FLAP2 {SPR_FL01, 3, 3, {A_FlickyFly}, 4*FRACUNIT, 16*FRACUNIT, S_FLICKY_01_FLAP1}, // S_FLICKY_01_FLAP3 + {SPR_FL01, FF_ANIMATE|1, -1, {NULL}, 2, 3, S_NULL}, // S_FLICKY_01_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_01, 384*FRACUNIT, S_FLICKY_01_CENTER}, // S_FLICKY_01_CENTER // Rabbit {SPR_FL02, 0, 2, {A_FlickyCheck}, S_FLICKY_02_AIM, 0, S_FLICKY_02_OUT}, // S_FLICKY_02_OUT @@ -2648,6 +2650,8 @@ state_t states[NUMSTATES] = {SPR_FL02, 1, 1, {A_FlickyHop}, 6*FRACUNIT, 4*FRACUNIT, S_FLICKY_02_UP}, // S_FLICKY_02_HOP {SPR_FL02, 2, 2, {A_FlickyCheck}, S_FLICKY_02_AIM, S_FLICKY_02_DOWN, S_FLICKY_02_UP}, // S_FLICKY_02_UP {SPR_FL02, 3, 2, {A_FlickyCheck}, S_FLICKY_02_AIM, 0, S_FLICKY_02_DOWN}, // S_FLICKY_02_DOWN + {SPR_FL02, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_02_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_02, 384*FRACUNIT, S_FLICKY_02_CENTER}, // S_FLICKY_02_CENTER // Chicken {SPR_FL03, 0, 2, {A_FlickyCheck}, S_FLICKY_03_AIM, S_FLICKY_03_FLAP1, S_FLICKY_03_OUT}, // S_FLICKY_03_OUT @@ -2656,6 +2660,8 @@ state_t states[NUMSTATES] = {SPR_FL03, 2, 2, {A_FlickyFlutter}, S_FLICKY_03_HOP, S_FLICKY_03_FLAP1, S_FLICKY_03_UP}, // S_FLICKY_03_UP {SPR_FL03, 3, 2, {A_FlickyFlutter}, S_FLICKY_03_HOP, 0, S_FLICKY_03_FLAP2}, // S_FLICKY_03_FLAP1 {SPR_FL03, 4, 2, {A_FlickyFlutter}, S_FLICKY_03_HOP, 0, S_FLICKY_03_FLAP1}, // S_FLICKY_03_FLAP2 + {SPR_FL03, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_03_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_03, 384*FRACUNIT, S_FLICKY_03_CENTER}, // S_FLICKY_03_CENTER // Seal {SPR_FL04, 0, 2, {A_FlickyCheck}, S_FLICKY_04_AIM, 0, S_FLICKY_04_OUT}, // S_FLICKY_04_OUT @@ -2667,6 +2673,8 @@ state_t states[NUMSTATES] = {SPR_FL04, 4, 4, {A_FlickyCoast}, FRACUNIT, S_FLICKY_04_SWIM1, S_FLICKY_04_SWIM3}, // S_FLICKY_04_SWIM2 {SPR_FL04, 3, 4, {A_FlickyCoast}, FRACUNIT, S_FLICKY_04_SWIM1, S_FLICKY_04_SWIM4}, // S_FLICKY_04_SWIM3 {SPR_FL04, 5, 4, {A_FlickyCoast}, FRACUNIT, S_FLICKY_04_SWIM1, S_FLICKY_04_SWIM1}, // S_FLICKY_04_SWIM4 + {SPR_FL04, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_04_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_04, 384*FRACUNIT, S_FLICKY_04_CENTER}, // S_FLICKY_04_CENTER // Pig {SPR_FL05, 0, 2, {A_FlickyCheck}, S_FLICKY_05_AIM, 0, S_FLICKY_05_OUT}, // S_FLICKY_05_OUT @@ -2674,6 +2682,8 @@ state_t states[NUMSTATES] = {SPR_FL05, 1, 1, {A_FlickyHop}, 4*FRACUNIT, 3*FRACUNIT, S_FLICKY_05_UP}, // S_FLICKY_05_HOP {SPR_FL05, 2, 2, {A_FlickyCheck}, S_FLICKY_05_AIM, S_FLICKY_05_DOWN, S_FLICKY_05_UP}, // S_FLICKY_05_UP {SPR_FL05, 3, 2, {A_FlickyCheck}, S_FLICKY_05_AIM, 0, S_FLICKY_05_DOWN}, // S_FLICKY_05_DOWN + {SPR_FL05, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_05_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_05, 384*FRACUNIT, S_FLICKY_05_CENTER}, // S_FLICKY_05_CENTER // Chipmunk {SPR_FL06, 0, 2, {A_FlickyCheck}, S_FLICKY_06_AIM, 0, S_FLICKY_06_OUT}, // S_FLICKY_06_OUT @@ -2681,6 +2691,8 @@ state_t states[NUMSTATES] = {SPR_FL06, 1, 1, {A_FlickyHop}, 5*FRACUNIT, 6*FRACUNIT, S_FLICKY_06_UP}, // S_FLICKY_06_HOP {SPR_FL06, 2, 2, {A_FlickyCheck}, S_FLICKY_06_AIM, S_FLICKY_06_DOWN, S_FLICKY_06_UP}, // S_FLICKY_06_UP {SPR_FL06, 3, 2, {A_FlickyCheck}, S_FLICKY_06_AIM, 0, S_FLICKY_06_DOWN}, // S_FLICKY_06_DOWN + {SPR_FL06, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_06_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_06, 384*FRACUNIT, S_FLICKY_06_CENTER}, // S_FLICKY_06_CENTER // Penguin {SPR_FL07, 0, 2, {A_FlickyCheck}, S_FLICKY_07_AIML, 0, S_FLICKY_07_OUT}, // S_FLICKY_07_OUT @@ -2695,6 +2707,8 @@ state_t states[NUMSTATES] = {SPR_FL07, 4, 4, {A_FlickyFly}, 3*FRACUNIT, 72*FRACUNIT, S_FLICKY_07_SWIM2}, // S_FLICKY_07_SWIM1 {SPR_FL07, 5, 4, {A_FlickyCoast}, FRACUNIT, S_FLICKY_07_SWIM1, S_FLICKY_07_SWIM3}, // S_FLICKY_07_SWIM2 {SPR_FL07, 6, 4, {A_FlickyCoast}, 2*FRACUNIT, S_FLICKY_07_SWIM1, S_FLICKY_07_SWIM3}, // S_FLICKY_07_SWIM3 + {SPR_FL07, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_07_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_07, 384*FRACUNIT, S_FLICKY_07_CENTER}, // S_FLICKY_07_CENTER // Fish {SPR_FL08, 0, 2, {A_FlickyCheck}, S_FLICKY_08_AIM, 0, S_FLICKY_08_OUT}, // S_FLICKY_08_OUT @@ -2708,6 +2722,8 @@ state_t states[NUMSTATES] = {SPR_FL08, 1, 4, {A_FlickyCoast}, FRACUNIT, S_FLICKY_08_SWIM1, S_FLICKY_08_SWIM3}, // S_FLICKY_08_SWIM2 {SPR_FL08, 0, 4, {A_FlickyCoast}, FRACUNIT, S_FLICKY_08_SWIM1, S_FLICKY_08_SWIM4}, // S_FLICKY_08_SWIM3 {SPR_FL08, 2, 4, {A_FlickyCoast}, FRACUNIT, S_FLICKY_08_SWIM1, S_FLICKY_08_SWIM4}, // S_FLICKY_08_SWIM4 + {SPR_FL08, FF_ANIMATE, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_08_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_08, 384*FRACUNIT, S_FLICKY_08_CENTER}, // S_FLICKY_08_CENTER // Ram {SPR_FL09, 0, 2, {A_FlickyCheck}, S_FLICKY_09_AIM, 0, S_FLICKY_09_OUT}, // S_FLICKY_09_OUT @@ -2715,11 +2731,15 @@ state_t states[NUMSTATES] = {SPR_FL09, 1, 1, {A_FlickyHop}, 7*FRACUNIT, 2*FRACUNIT, S_FLICKY_09_UP}, // S_FLICKY_09_HOP {SPR_FL09, 2, 2, {A_FlickyCheck}, S_FLICKY_09_AIM, S_FLICKY_09_DOWN, S_FLICKY_09_UP}, // S_FLICKY_09_UP {SPR_FL09, 3, 2, {A_FlickyCheck}, S_FLICKY_09_AIM, 0, S_FLICKY_09_DOWN}, // S_FLICKY_09_DOWN + {SPR_FL09, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_09_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_09, 384*FRACUNIT, S_FLICKY_09_CENTER}, // S_FLICKY_09_CENTER // Puffin {SPR_FL10, 0, 2, {A_FlickyCheck}, S_FLICKY_10_FLAP1, S_FLICKY_10_FLAP1, S_FLICKY_10_OUT}, // S_FLICKY_10_OUT {SPR_FL10, 1, 3, {A_FlickySoar}, 4*FRACUNIT, 16*FRACUNIT, S_FLICKY_10_FLAP2}, // S_FLICKY_10_FLAP1 {SPR_FL10, 2, 3, {A_FlickySoar}, 4*FRACUNIT, 16*FRACUNIT, S_FLICKY_10_FLAP1}, // S_FLICKY_10_FLAP2 + {SPR_FL10, FF_ANIMATE|1, -1, {NULL}, 1, 3, S_NULL}, // S_FLICKY_10_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_10, 384*FRACUNIT, S_FLICKY_10_CENTER}, // S_FLICKY_10_CENTER // Cow {SPR_FL11, 0, 2, {A_FlickyCheck}, S_FLICKY_11_AIM, 0, S_FLICKY_11_OUT}, // S_FLICKY_11_OUT @@ -2727,6 +2747,8 @@ state_t states[NUMSTATES] = {SPR_FL11, 1, 3, {A_FlickyHop}, FRACUNIT/2, 2*FRACUNIT, S_FLICKY_11_RUN2}, // S_FLICKY_11_RUN1 {SPR_FL11, 2, 4, {A_FlickyHop}, FRACUNIT/2, 2*FRACUNIT, S_FLICKY_11_RUN3}, // S_FLICKY_11_RUN2 {SPR_FL11, 3, 4, {A_FlickyHop}, FRACUNIT/2, 2*FRACUNIT, S_FLICKY_11_AIM}, // S_FLICKY_11_RUN3 + {SPR_FL11, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_11_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_11, 384*FRACUNIT, S_FLICKY_11_CENTER}, // S_FLICKY_11_CENTER // Rat {SPR_FL12, 0, 2, {A_FlickyCheck}, S_FLICKY_12_AIM, 0, S_FLICKY_12_OUT}, // S_FLICKY_12_OUT @@ -2734,6 +2756,8 @@ state_t states[NUMSTATES] = {SPR_FL12, 1, 2, {A_FlickyHop}, 1, 12*FRACUNIT, S_FLICKY_12_RUN2}, // S_FLICKY_12_RUN1 {SPR_FL12, 2, 3, {A_FlickyHop}, 1, 12*FRACUNIT, S_FLICKY_12_RUN3}, // S_FLICKY_12_RUN2 {SPR_FL12, 3, 3, {A_FlickyHop}, 1, 12*FRACUNIT, S_FLICKY_12_AIM}, // S_FLICKY_12_RUN3 + {SPR_FL12, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_12_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_12, 384*FRACUNIT, S_FLICKY_12_CENTER}, // S_FLICKY_12_CENTER // Bear {SPR_FL13, 0, 2, {A_FlickyCheck}, S_FLICKY_13_AIM, 0, S_FLICKY_13_OUT}, // S_FLICKY_13_OUT @@ -2741,12 +2765,16 @@ state_t states[NUMSTATES] = {SPR_FL13, 1, 1, {A_FlickyHop}, 5*FRACUNIT, 3*FRACUNIT, S_FLICKY_13_UP}, // S_FLICKY_13_HOP {SPR_FL13, 2, 2, {A_FlickyCheck}, S_FLICKY_13_AIM, S_FLICKY_13_DOWN, S_FLICKY_13_UP}, // S_FLICKY_13_UP {SPR_FL13, 3, 2, {A_FlickyCheck}, S_FLICKY_13_AIM, 0, S_FLICKY_13_DOWN}, // S_FLICKY_13_DOWN + {SPR_FL13, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_13_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_13, 384*FRACUNIT, S_FLICKY_13_CENTER}, // S_FLICKY_13_CENTER // Dove {SPR_FL14, 0, 2, {A_FlickyCheck}, S_FLICKY_14_FLAP1, S_FLICKY_14_FLAP1, S_FLICKY_14_OUT}, // S_FLICKY_14_OUT {SPR_FL14, 1, 3, {A_FlickySoar}, 4*FRACUNIT, 32*FRACUNIT, S_FLICKY_14_FLAP2}, // S_FLICKY_14_FLAP1 {SPR_FL14, 2, 3, {A_FlickySoar}, 4*FRACUNIT, 32*FRACUNIT, S_FLICKY_14_FLAP3}, // S_FLICKY_14_FLAP2 {SPR_FL14, 3, 3, {A_FlickySoar}, 4*FRACUNIT, 32*FRACUNIT, S_FLICKY_14_FLAP1}, // S_FLICKY_14_FLAP3 + {SPR_FL14, FF_ANIMATE|1, -1, {NULL}, 2, 3, S_NULL}, // S_FLICKY_14_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_14, 384*FRACUNIT, S_FLICKY_14_CENTER}, // S_FLICKY_14_CENTER // Cat {SPR_FL15, 0, 2, {A_FlickyCheck}, S_FLICKY_15_AIM, 0, S_FLICKY_15_OUT}, // S_FLICKY_15_OUT @@ -2754,12 +2782,16 @@ state_t states[NUMSTATES] = {SPR_FL15, 1, 1, {A_FlickyFlounder}, 2*FRACUNIT, 6*FRACUNIT, S_FLICKY_15_UP}, // S_FLICKY_15_HOP {SPR_FL15, 2, 2, {A_FlickyCheck}, S_FLICKY_15_AIM, S_FLICKY_15_DOWN, S_FLICKY_15_UP}, // S_FLICKY_15_UP {SPR_FL15, 3, 2, {A_FlickyCheck}, S_FLICKY_15_AIM, 0, S_FLICKY_15_DOWN}, // S_FLICKY_15_DOWN + {SPR_FL15, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_FLICKY_15_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_15, 384*FRACUNIT, S_FLICKY_15_CENTER}, // S_FLICKY_15_CENTER // Canary {SPR_FL16, 0, 2, {A_FlickyHeightCheck}, S_FLICKY_16_FLAP1, 0, S_FLICKY_16_OUT}, // S_FLICKY_16_OUT {SPR_FL16, 1, 3, {A_FlickyFly}, 4*FRACUNIT, 8*FRACUNIT, S_FLICKY_16_FLAP2}, // S_FLICKY_16_FLAP1 {SPR_FL16, 2, 3, {A_SetObjectFlags}, MF_NOGRAVITY, 1, S_FLICKY_16_FLAP3}, // S_FLICKY_16_FLAP2 {SPR_FL16, 3, 3, {A_FlickyHeightCheck}, S_FLICKY_16_FLAP1, 0, S_FLICKY_16_FLAP3}, // S_FLICKY_16_FLAP3 + {SPR_FL16, FF_ANIMATE|1, -1, {NULL}, 2, 3, S_NULL}, // S_FLICKY_16_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_FLICKY_16, 384*FRACUNIT, S_FLICKY_16_CENTER}, // S_FLICKY_16_CENTER // Spider {SPR_FS01, 0, 2, {A_FlickyCheck}, S_SECRETFLICKY_01_AIM, 0, S_SECRETFLICKY_01_OUT}, // S_SECRETFLICKY_01_OUT @@ -2767,12 +2799,16 @@ state_t states[NUMSTATES] = {SPR_FS01, 1, 1, {A_FlickyFlounder}, 2*FRACUNIT, 6*FRACUNIT, S_SECRETFLICKY_01_UP}, // S_SECRETFLICKY_01_HOP {SPR_FS01, 2, 2, {A_FlickyCheck}, S_SECRETFLICKY_01_AIM, S_SECRETFLICKY_01_DOWN, S_SECRETFLICKY_01_UP}, // S_SECRETFLICKY_01_UP {SPR_FS01, 3, 2, {A_FlickyCheck}, S_SECRETFLICKY_01_AIM, 0, S_SECRETFLICKY_01_DOWN}, // S_SECRETFLICKY_01_DOWN + {SPR_FS01, FF_ANIMATE|1, -1, {NULL}, 2, 4, S_NULL}, // S_SECRETFLICKY_01_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_SECRETFLICKY_01, 384*FRACUNIT, S_SECRETFLICKY_01_CENTER}, // S_SECRETFLICKY_01_CENTER // Bat {SPR_FS02, 0, 2, {A_FlickyHeightCheck}, S_SECRETFLICKY_02_FLAP1, S_SECRETFLICKY_02_FLAP1, S_SECRETFLICKY_02_OUT}, // S_SECRETFLICKY_02_OUT {SPR_FS02, 1, 3, {A_FlickyFly}, 4*FRACUNIT, 16*FRACUNIT, S_SECRETFLICKY_02_FLAP2}, // S_SECRETFLICKY_02_FLAP1 {SPR_FS02, 2, 3, {A_FlickyFly}, 4*FRACUNIT, 16*FRACUNIT, S_SECRETFLICKY_02_FLAP3}, // S_SECRETFLICKY_02_FLAP2 {SPR_FS02, 3, 3, {A_FlickyFly}, 4*FRACUNIT, 16*FRACUNIT, S_SECRETFLICKY_02_FLAP1}, // S_SECRETFLICKY_02_FLAP3 + {SPR_FS02, FF_ANIMATE|1, -1, {NULL}, 2, 2, S_NULL}, // S_SECRETFLICKY_02_STAND + {SPR_NULL, 0, 15, {A_FlickyCenter}, MT_SECRETFLICKY_02, 384*FRACUNIT, S_SECRETFLICKY_02_CENTER}, // S_SECRETFLICKY_02_CENTER // Fan {SPR_FANS, 0, 1, {A_FanBubbleSpawn}, 2048, 0, S_FAN2}, // S_FAN @@ -3422,8 +3458,8 @@ state_t states[NUMSTATES] = {SPR_FMCE, 0, 20, {NULL}, 0, 0, S_SMASHSPIKE_EASE1}, // S_SMASHSPIKE_FLOAT {SPR_FMCE, 0, 4, {A_ZThrust}, 4, (1<<16)|1, S_SMASHSPIKE_EASE2}, // S_SMASHSPIKE_EASE1 - {SPR_FMCE, 0, 4, {A_ZThrust}, 0, (1<<16)|1, S_SMASHSPIKE_FALL}, // S_SMASHSPIKE_EASE1 - {SPR_FMCE, 0, 2, {A_ZThrust}, -6, (1<<16)|1, S_SMASHSPIKE_FALL}, // S_SMASHSPIKE_FALL + {SPR_FMCE, 0, 4, {A_ZThrust}, 0, (1<<16)|1, S_SMASHSPIKE_FALL}, // S_SMASHSPIKE_EASE2 + {SPR_FMCE, 0, 2, {A_ZThrust}, -6, 1, S_SMASHSPIKE_FALL}, // S_SMASHSPIKE_FALL {SPR_FMCE, 1, 2, {A_MultiShotDist}, (MT_DUST<<16)|10, -48, S_SMASHSPIKE_STOMP2}, // S_SMASHSPIKE_STOMP1 {SPR_FMCE, 2, 14, {NULL}, 0, 0, S_SMASHSPIKE_RISE1}, // S_SMASHSPIKE_STOMP2 {SPR_FMCE, 1, 2, {NULL}, 0, 0, S_SMASHSPIKE_RISE2}, // S_SMASHSPIKE_RISE1 @@ -13747,7 +13783,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = -1, // doomednum S_FLICKY_01_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_01_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -13770,11 +13806,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_01_CENTER + 2200, // doomednum + S_FLICKY_01_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_02 -1, // doomednum S_FLICKY_02_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_02_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -13797,11 +13860,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_02_CENTER + 2201, // doomednum + S_FLICKY_02_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_03 -1, // doomednum S_FLICKY_03_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_03_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -13824,11 +13914,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_03_CENTER + 2202, // doomednum + S_FLICKY_03_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_04 -1, // doomednum S_FLICKY_04_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_04_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -13851,9 +13968,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_FLICKY_05 - -1, // doomednum - S_FLICKY_05_OUT, // spawnstate + { // MT_FLICKY_04_CENTER + 2203, // doomednum + S_FLICKY_04_CENTER, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -13874,15 +13991,69 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 16, // mass 0, // damage sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + + { // MT_FLICKY_05 + -1, // doomednum + S_FLICKY_05_OUT, // spawnstate + 1000, // spawnhealth + S_FLICKY_05_STAND, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound MF_NOCLIPTHING, // flags S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_05_CENTER + 2204, // doomednum + S_FLICKY_05_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_06 -1, // doomednum S_FLICKY_06_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_06_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -13905,11 +14076,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_06_CENTER + 2205, // doomednum + S_FLICKY_06_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_07 -1, // doomednum S_FLICKY_07_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_07_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -13932,11 +14130,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_FLICKY_07_CENTER + 2206, // doomednum + S_FLICKY_07_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_08 -1, // doomednum S_FLICKY_08_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_08_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -13959,9 +14184,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_FLICKY_09 - -1, // doomednum - S_FLICKY_09_OUT, // spawnstate + { // MT_FLICKY_08_CENTER + 2207, // doomednum + S_FLICKY_08_CENTER, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -13982,15 +14207,69 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 16, // mass 0, // damage sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + + { // MT_FLICKY_09 + -1, // doomednum + S_FLICKY_09_OUT, // spawnstate + 1000, // spawnhealth + S_FLICKY_09_STAND, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound MF_NOCLIPTHING, // flags S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_09_CENTER + 2208, // doomednum + S_FLICKY_09_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_10 -1, // doomednum S_FLICKY_10_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_10_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -14013,11 +14292,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_10_CENTER + 2209, // doomednum + S_FLICKY_10_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_11 -1, // doomednum S_FLICKY_11_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_11_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -14040,11 +14346,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_11_CENTER + 2210, // doomednum + S_FLICKY_11_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_12 -1, // doomednum S_FLICKY_12_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_12_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -14067,11 +14400,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_12_CENTER + 2211, // doomednum + S_FLICKY_12_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_13 -1, // doomednum S_FLICKY_13_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_13_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -14094,11 +14454,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_13_CENTER + 2212, // doomednum + S_FLICKY_13_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_14 -1, // doomednum S_FLICKY_14_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_14_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -14121,11 +14508,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_14_CENTER + 2213, // doomednum + S_FLICKY_14_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_15 -1, // doomednum S_FLICKY_15_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_15_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -14148,11 +14562,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_15_CENTER + 2214, // doomednum + S_FLICKY_15_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_FLICKY_16 -1, // doomednum S_FLICKY_16_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_FLICKY_16_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -14175,11 +14616,38 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, + { // MT_FLICKY_16_CENTER + 2215, // doomednum + S_FLICKY_16_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_SECRETFLICKY_01 -1, // doomednum S_SECRETFLICKY_01_OUT, // spawnstate 1000, // spawnhealth - S_NULL, // seestate + S_SECRETFLICKY_01_STAND, // seestate sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound @@ -14202,9 +14670,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_FLICKY_BUBBLE // raisestate }, - { // MT_SECRETFLICKY_02 - -1, // doomednum - S_SECRETFLICKY_02_OUT, // spawnstate + { // MT_SECRETFLICKY_01_CENTER + 2216, // doomednum + S_SECRETFLICKY_01_CENTER, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -14225,10 +14693,64 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 16, // mass 0, // damage sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + + { // MT_SECRETFLICKY_02 + -1, // doomednum + S_SECRETFLICKY_02_OUT, // spawnstate + 1000, // spawnhealth + S_SECRETFLICKY_02_STAND, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound MF_NOCLIPTHING, // flags S_FLICKY_BUBBLE // raisestate }, + { // MT_SECRETFLICKY_02_CENTER + 2217, // doomednum + S_SECRETFLICKY_02_CENTER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 8, // speed + 8*FRACUNIT, // radius + 20*FRACUNIT, // height + 0, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOSECTOR|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SCENERY|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + { // MT_SEED -1, // doomednum S_SEED, // spawnstate @@ -17292,6 +17814,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_ANGLEMAN + 758, // doomednum + S_INVISIBLE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 8, // radius + 8, // height + 0, // display offset + 10, // mass + 0, // damage + sfx_None, // activesound + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOGRAVITY, // flags + S_NULL // raisestate + }, + { // MT_POLYANCHOR 760, // doomednum S_INVISIBLE, // spawnstate diff --git a/src/info.h b/src/info.h index 89bfd3504..c9de82541 100644 --- a/src/info.h +++ b/src/info.h @@ -216,6 +216,7 @@ void A_BrakLobShot(); void A_NapalmScatter(); void A_SpawnFreshCopy(); void A_FlickySpawn(); +void A_FlickyCenter(); void A_FlickyAim(); void A_FlickyFly(); void A_FlickySoar(); @@ -2748,6 +2749,8 @@ typedef enum state S_FLICKY_01_FLAP1, S_FLICKY_01_FLAP2, S_FLICKY_01_FLAP3, + S_FLICKY_01_STAND, + S_FLICKY_01_CENTER, // Rabbit S_FLICKY_02_OUT, @@ -2755,6 +2758,8 @@ typedef enum state S_FLICKY_02_HOP, S_FLICKY_02_UP, S_FLICKY_02_DOWN, + S_FLICKY_02_STAND, + S_FLICKY_02_CENTER, // Chicken S_FLICKY_03_OUT, @@ -2763,6 +2768,8 @@ typedef enum state S_FLICKY_03_UP, S_FLICKY_03_FLAP1, S_FLICKY_03_FLAP2, + S_FLICKY_03_STAND, + S_FLICKY_03_CENTER, // Seal S_FLICKY_04_OUT, @@ -2774,6 +2781,8 @@ typedef enum state S_FLICKY_04_SWIM2, S_FLICKY_04_SWIM3, S_FLICKY_04_SWIM4, + S_FLICKY_04_STAND, + S_FLICKY_04_CENTER, // Pig S_FLICKY_05_OUT, @@ -2781,6 +2790,8 @@ typedef enum state S_FLICKY_05_HOP, S_FLICKY_05_UP, S_FLICKY_05_DOWN, + S_FLICKY_05_STAND, + S_FLICKY_05_CENTER, // Chipmunk S_FLICKY_06_OUT, @@ -2788,6 +2799,8 @@ typedef enum state S_FLICKY_06_HOP, S_FLICKY_06_UP, S_FLICKY_06_DOWN, + S_FLICKY_06_STAND, + S_FLICKY_06_CENTER, // Penguin S_FLICKY_07_OUT, @@ -2802,6 +2815,8 @@ typedef enum state S_FLICKY_07_SWIM1, S_FLICKY_07_SWIM2, S_FLICKY_07_SWIM3, + S_FLICKY_07_STAND, + S_FLICKY_07_CENTER, // Fish S_FLICKY_08_OUT, @@ -2815,6 +2830,8 @@ typedef enum state S_FLICKY_08_SWIM2, S_FLICKY_08_SWIM3, S_FLICKY_08_SWIM4, + S_FLICKY_08_STAND, + S_FLICKY_08_CENTER, // Ram S_FLICKY_09_OUT, @@ -2822,11 +2839,15 @@ typedef enum state S_FLICKY_09_HOP, S_FLICKY_09_UP, S_FLICKY_09_DOWN, + S_FLICKY_09_STAND, + S_FLICKY_09_CENTER, // Puffin S_FLICKY_10_OUT, S_FLICKY_10_FLAP1, S_FLICKY_10_FLAP2, + S_FLICKY_10_STAND, + S_FLICKY_10_CENTER, // Cow S_FLICKY_11_OUT, @@ -2834,6 +2855,8 @@ typedef enum state S_FLICKY_11_RUN1, S_FLICKY_11_RUN2, S_FLICKY_11_RUN3, + S_FLICKY_11_STAND, + S_FLICKY_11_CENTER, // Rat S_FLICKY_12_OUT, @@ -2841,6 +2864,8 @@ typedef enum state S_FLICKY_12_RUN1, S_FLICKY_12_RUN2, S_FLICKY_12_RUN3, + S_FLICKY_12_STAND, + S_FLICKY_12_CENTER, // Bear S_FLICKY_13_OUT, @@ -2848,12 +2873,16 @@ typedef enum state S_FLICKY_13_HOP, S_FLICKY_13_UP, S_FLICKY_13_DOWN, + S_FLICKY_13_STAND, + S_FLICKY_13_CENTER, // Dove S_FLICKY_14_OUT, S_FLICKY_14_FLAP1, S_FLICKY_14_FLAP2, S_FLICKY_14_FLAP3, + S_FLICKY_14_STAND, + S_FLICKY_14_CENTER, // Cat S_FLICKY_15_OUT, @@ -2861,12 +2890,16 @@ typedef enum state S_FLICKY_15_HOP, S_FLICKY_15_UP, S_FLICKY_15_DOWN, + S_FLICKY_15_STAND, + S_FLICKY_15_CENTER, // Canary S_FLICKY_16_OUT, S_FLICKY_16_FLAP1, S_FLICKY_16_FLAP2, S_FLICKY_16_FLAP3, + S_FLICKY_16_STAND, + S_FLICKY_16_CENTER, // Spider S_SECRETFLICKY_01_OUT, @@ -2874,12 +2907,16 @@ typedef enum state S_SECRETFLICKY_01_HOP, S_SECRETFLICKY_01_UP, S_SECRETFLICKY_01_DOWN, + S_SECRETFLICKY_01_STAND, + S_SECRETFLICKY_01_CENTER, // Bat S_SECRETFLICKY_02_OUT, S_SECRETFLICKY_02_FLAP1, S_SECRETFLICKY_02_FLAP2, S_SECRETFLICKY_02_FLAP3, + S_SECRETFLICKY_02_STAND, + S_SECRETFLICKY_02_CENTER, // Fan S_FAN, @@ -4098,23 +4135,41 @@ typedef enum mobj_type // Flickies MT_FLICKY_01, // Bluebird + MT_FLICKY_01_CENTER, MT_FLICKY_02, // Rabbit + MT_FLICKY_02_CENTER, MT_FLICKY_03, // Chicken + MT_FLICKY_03_CENTER, MT_FLICKY_04, // Seal + MT_FLICKY_04_CENTER, MT_FLICKY_05, // Pig + MT_FLICKY_05_CENTER, MT_FLICKY_06, // Chipmunk + MT_FLICKY_06_CENTER, MT_FLICKY_07, // Penguin + MT_FLICKY_07_CENTER, MT_FLICKY_08, // Fish + MT_FLICKY_08_CENTER, MT_FLICKY_09, // Ram + MT_FLICKY_09_CENTER, MT_FLICKY_10, // Puffin + MT_FLICKY_10_CENTER, MT_FLICKY_11, // Cow + MT_FLICKY_11_CENTER, MT_FLICKY_12, // Rat + MT_FLICKY_12_CENTER, MT_FLICKY_13, // Bear + MT_FLICKY_13_CENTER, MT_FLICKY_14, // Dove + MT_FLICKY_14_CENTER, MT_FLICKY_15, // Cat + MT_FLICKY_15_CENTER, MT_FLICKY_16, // Canary + MT_FLICKY_16_CENTER, MT_SECRETFLICKY_01, // Spider + MT_SECRETFLICKY_01_CENTER, MT_SECRETFLICKY_02, // Bat + MT_SECRETFLICKY_02_CENTER, MT_SEED, // Environmental Effects @@ -4250,6 +4305,7 @@ typedef enum mobj_type MT_PULL, MT_GHOST, MT_OVERLAY, + MT_ANGLEMAN, MT_POLYANCHOR, MT_POLYSPAWN, MT_POLYSPAWNCRUSH, diff --git a/src/lua_baselib.c b/src/lua_baselib.c index c1fd87af3..bb9e93edf 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -14,6 +14,9 @@ #ifdef HAVE_BLUA #include "p_local.h" #include "p_setup.h" // So we can have P_SetupLevelSky +#ifdef ESLOPE +#include "p_slopes.h" // P_GetZAt +#endif #include "z_zone.h" #include "r_main.h" #include "r_things.h" @@ -1809,9 +1812,11 @@ static int lib_pFadeLight(lua_State *L) INT16 tag = (INT16)luaL_checkinteger(L, 1); INT32 destvalue = (INT32)luaL_checkinteger(L, 2); INT32 speed = (INT32)luaL_checkinteger(L, 3); + boolean ticbased = lua_optboolean(L, 4); + boolean force = lua_optboolean(L, 5); NOHUD INLEVEL - P_FadeLight(tag, destvalue, speed); + P_FadeLight(tag, destvalue, speed, ticbased, force); return 0; } @@ -2006,6 +2011,24 @@ static int lib_evStartCrumble(lua_State *L) return 0; } +#ifdef ESLOPE +// P_SLOPES +//////////// + +static int lib_pGetZAt(lua_State *L) +{ + pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE)); + fixed_t x = luaL_checkfixed(L, 2); + fixed_t y = luaL_checkfixed(L, 3); + //HUDSAFE + if (!slope) + return LUA_ErrInvalid(L, "pslope_t"); + + lua_pushfixed(L, P_GetZAt(slope, x, y)); + return 1; +} +#endif + // R_DEFS //////////// @@ -2629,6 +2652,11 @@ static luaL_Reg lib[] = { {"EV_CrumbleChain",lib_evCrumbleChain}, {"EV_StartCrumble",lib_evStartCrumble}, +#ifdef ESLOPE + // p_slopes + {"P_GetZAt",lib_pGetZAt}, +#endif + // r_defs {"R_PointToAngle",lib_rPointToAngle}, {"R_PointToAngle2",lib_rPointToAngle2}, diff --git a/src/lua_hook.h b/src/lua_hook.h index 822edf79f..2b113077c 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -48,6 +48,7 @@ enum hook { hook_MobjMoveBlocked, hook_MapThingSpawn, hook_FollowMobj, + hook_PlayerQuit, hook_MAX // last hook }; @@ -87,5 +88,6 @@ boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source, UINT8 #define LUAh_MobjMoveBlocked(mo) LUAh_MobjHook(mo, hook_MobjMoveBlocked) // Hook for P_XYMovement (when movement is blocked) boolean LUAh_MapThingSpawn(mobj_t *mo, mapthing_t *mthing); // Hook for P_SpawnMapThing by mobj type boolean LUAh_FollowMobj(player_t *player, mobj_t *mo); // Hook for P_PlayerAfterThink Smiles mobj-following +void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting #endif diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 53886f7ba..bb1f59729 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -59,6 +59,7 @@ const char *const hookNames[hook_MAX+1] = { "MobjMoveBlocked", "MapThingSpawn", "FollowMobj", + "PlayerQuit", NULL }; @@ -1192,4 +1193,30 @@ boolean LUAh_FollowMobj(player_t *player, mobj_t *mobj) return hooked; } +void LUAh_PlayerQuit(player_t *plr, int reason) +{ + hook_p hookp; + if (!gL || !(hooksAvailable[hook_PlayerQuit/8] & (1<<(hook_PlayerQuit%8)))) + return; + + lua_settop(gL, 0); + + for (hookp = roothook; hookp; hookp = hookp->next) + if (hookp->type == hook_PlayerQuit) + { + if (lua_gettop(gL) == 0) + { + LUA_PushUserdata(gL, plr, META_PLAYER); // Player that quit + lua_pushinteger(gL, reason); // Reason for quitting + } + lua_pushfstring(gL, FMT_HOOKID, hookp->id); + lua_gettable(gL, LUA_REGISTRYINDEX); + lua_pushvalue(gL, -3); + lua_pushvalue(gL, -3); + LUA_Call(gL, 2); + } + + lua_settop(gL, 0); +} + #endif diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index afc81c37d..9c5a21ec9 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -814,6 +814,15 @@ static int libd_RandomChance(lua_State *L) return 1; } +// 30/10/18 Lat': Get cv_translucenthud's value for HUD rendering as a normal V_xxTRANS int +// Could as well be thrown in global vars for ease of access but I guess it makes sense for it to be a HUD fn +static int libd_getlocaltransflag(lua_State *L) +{ + HUDONLY + lua_pushinteger(L, (10-cv_translucenthud.value)*V_10TRANS); // A bit weird that it's called "translucenthud" yet 10 is fully opaque :V + return 1; +} + static luaL_Reg lib_draw[] = { // cache {"patchExists", libd_patchExists}, @@ -844,6 +853,7 @@ static luaL_Reg lib_draw[] = { {"dupx", libd_dupx}, {"dupy", libd_dupy}, {"renderer", libd_renderer}, + {"localTransFlag", libd_getlocaltransflag}, {NULL, NULL} }; @@ -867,6 +877,19 @@ static int lib_huddisable(lua_State *L) return 0; } +// 30/10/18: Lat': How come this wasn't here before? +static int lib_hudenabled(lua_State *L) +{ + enum hud option = luaL_checkoption(L, 1, NULL, hud_disable_options); + if (hud_enabled[option/8] & (1<<(option%8))) + lua_pushboolean(L, true); + else + lua_pushboolean(L, false); + + return 1; +} + + // add a HUD element for rendering static int lib_hudadd(lua_State *L) { @@ -894,6 +917,7 @@ static int lib_hudadd(lua_State *L) static luaL_Reg lib_hud[] = { {"enable", lib_hudenable}, {"disable", lib_huddisable}, + {"enabled", lib_hudenabled}, {"add", lib_hudadd}, {NULL, NULL} }; diff --git a/src/lua_libs.h b/src/lua_libs.h index b63a3ceed..3ffdd8078 100644 --- a/src/lua_libs.h +++ b/src/lua_libs.h @@ -42,6 +42,11 @@ extern lua_State *gL; #define META_SEG "SEG_T*" #define META_NODE "NODE_T*" #endif +#ifdef ESLOPE +#define META_SLOPE "PSLOPE_T*" +#define META_VECTOR2 "VECTOR2_T" +#define META_VECTOR3 "VECTOR3_T" +#endif #define META_MAPHEADER "MAPHEADER_T*" #define META_CVAR "CONSVAR_T*" diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 28fe8c75f..66fbb22b3 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -16,6 +16,10 @@ #include "p_local.h" #include "p_setup.h" #include "z_zone.h" +#ifdef ESLOPE +#include "p_slopes.h" +#endif +#include "r_main.h" #include "lua_script.h" #include "lua_libs.h" @@ -38,7 +42,13 @@ enum sector_e { sector_heightsec, sector_camsec, sector_lines, +#ifdef ESLOPE + sector_ffloors, + sector_fslope, + sector_cslope +#else sector_ffloors +#endif }; static const char *const sector_opt[] = { @@ -55,6 +65,10 @@ static const char *const sector_opt[] = { "camsec", "lines", "ffloors", +#ifdef ESLOPE + "f_slope", + "c_slope", +#endif NULL}; enum subsector_e { @@ -160,6 +174,10 @@ enum ffloor_e { ffloor_toplightlevel, ffloor_bottomheight, ffloor_bottompic, +#ifdef ESLOPE + ffloor_tslope, + ffloor_bslope, +#endif ffloor_sector, ffloor_flags, ffloor_master, @@ -176,6 +194,10 @@ static const char *const ffloor_opt[] = { "toplightlevel", "bottomheight", "bottompic", +#ifdef ESLOPE + "t_slope", + "b_slope", +#endif "sector", // secnum pushed as control sector userdata "flags", "master", // control linedef @@ -261,6 +283,47 @@ static const char *const bbox_opt[] = { "right", NULL}; +#ifdef ESLOPE +enum slope_e { + slope_valid = 0, + slope_o, + slope_d, + slope_zdelta, + slope_normal, + slope_zangle, + slope_xydirection, + slope_sourceline, + slope_refpos, + slope_flags +}; + +static const char *const slope_opt[] = { + "valid", + "o", + "d", + "zdelta", + "normal", + "zangle", + "xydirection", + "sourceline", + "refpos", + "flags", + NULL}; + +// shared by both vector2_t and vector3_t +enum vector_e { + vector_x = 0, + vector_y, + vector_z +}; + +static const char *const vector_opt[] = { + "x", + "y", + "z", + NULL}; +#endif + static const char *const array_opt[] ={"iterate",NULL}; static const char *const valid_opt[] ={"valid",NULL}; @@ -493,6 +556,14 @@ static int sector_get(lua_State *L) LUA_PushUserdata(L, sector->ffloors, META_FFLOOR); lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function return 1; +#ifdef ESLOPE + case sector_fslope: // f_slope + LUA_PushUserdata(L, sector->f_slope, META_SLOPE); + return 1; + case sector_cslope: // c_slope + LUA_PushUserdata(L, sector->c_slope, META_SLOPE); + return 1; +#endif } return 0; } @@ -515,6 +586,10 @@ static int sector_set(lua_State *L) case sector_heightsec: // heightsec case sector_camsec: // camsec case sector_ffloors: // ffloors +#ifdef ESLOPE + case sector_fslope: // f_slope + case sector_cslope: // c_slope +#endif default: return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]); case sector_floorheight: { // floorheight @@ -1602,6 +1677,14 @@ static int ffloor_get(lua_State *L) lua_pushlstring(L, levelflat->name, 8); return 1; } +#ifdef ESLOPE + case ffloor_tslope: + LUA_PushUserdata(L, *ffloor->t_slope, META_SLOPE); + return 1; + case ffloor_bslope: + LUA_PushUserdata(L, *ffloor->b_slope, META_SLOPE); + return 1; +#endif case ffloor_sector: LUA_PushUserdata(L, §ors[ffloor->secnum], META_SECTOR); return 1; @@ -1641,6 +1724,10 @@ static int ffloor_set(lua_State *L) switch(field) { case ffloor_valid: // valid +#ifdef ESLOPE + case ffloor_tslope: // t_slope + case ffloor_bslope: // b_slope +#endif case ffloor_sector: // sector case ffloor_master: // master case ffloor_target: // target @@ -1701,6 +1788,189 @@ static int ffloor_set(lua_State *L) return 0; } +#ifdef ESLOPE +////////////// +// pslope_t // +////////////// + +static int slope_get(lua_State *L) +{ + pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE)); + enum slope_e field = luaL_checkoption(L, 2, slope_opt[0], slope_opt); + + if (!slope) + { + if (field == slope_valid) { + lua_pushboolean(L, 0); + return 1; + } + return luaL_error(L, "accessed pslope_t doesn't exist anymore."); + } + + switch(field) + { + case slope_valid: // valid + lua_pushboolean(L, 1); + return 1; + case slope_o: // o + LUA_PushUserdata(L, &slope->o, META_VECTOR3); + return 1; + case slope_d: // d + LUA_PushUserdata(L, &slope->d, META_VECTOR2); + return 1; + case slope_zdelta: // zdelta + lua_pushfixed(L, slope->zdelta); + return 1; + case slope_normal: // normal + LUA_PushUserdata(L, &slope->normal, META_VECTOR3); + return 1; + case slope_zangle: // zangle + lua_pushangle(L, slope->zangle); + return 1; + case slope_xydirection: // xydirection + lua_pushangle(L, slope->xydirection); + return 1; + case slope_sourceline: // source linedef + LUA_PushUserdata(L, slope->sourceline, META_LINE); + return 1; + case slope_refpos: // refpos + lua_pushinteger(L, slope->refpos); + return 1; + case slope_flags: // flags + lua_pushinteger(L, slope->flags); + return 1; + } + return 0; +} + +static int slope_set(lua_State *L) +{ + pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE)); + enum slope_e field = luaL_checkoption(L, 2, slope_opt[0], slope_opt); + + if (!slope) + return luaL_error(L, "accessed pslope_t doesn't exist anymore."); + + if (hud_running) + return luaL_error(L, "Do not alter pslope_t in HUD rendering code!"); + + switch(field) // todo: reorganize this shit + { + case slope_valid: // valid + case slope_sourceline: // sourceline + case slope_d: // d + case slope_flags: // flags + case slope_normal: // normal + case slope_refpos: // refpos + default: + return luaL_error(L, "pslope_t field " LUA_QS " cannot be set.", slope_opt[field]); + case slope_o: { // o + luaL_checktype(L, 3, LUA_TTABLE); + + lua_getfield(L, 3, "x"); + if (lua_isnil(L, -1)) + { + lua_pop(L, 1); + lua_rawgeti(L, 3, 1); + } + if (!lua_isnil(L, -1)) + slope->o.x = luaL_checkfixed(L, -1); + else + slope->o.x = 0; + lua_pop(L, 1); + + lua_getfield(L, 3, "y"); + if (lua_isnil(L, -1)) + { + lua_pop(L, 1); + lua_rawgeti(L, 3, 2); + } + if (!lua_isnil(L, -1)) + slope->o.y = luaL_checkfixed(L, -1); + else + slope->o.y = 0; + lua_pop(L, 1); + + lua_getfield(L, 3, "z"); + if (lua_isnil(L, -1)) + { + lua_pop(L, 1); + lua_rawgeti(L, 3, 3); + } + if (!lua_isnil(L, -1)) + slope->o.z = luaL_checkfixed(L, -1); + else + slope->o.z = 0; + lua_pop(L, 1); + break; + } + case slope_zdelta: { // zdelta, this is temp until i figure out wtf to do + slope->zdelta = luaL_checkfixed(L, 3); + slope->zangle = R_PointToAngle2(0, 0, FRACUNIT, -slope->zdelta); + P_CalculateSlopeNormal(slope); + break; + } + case slope_zangle: { // zangle + angle_t zangle = luaL_checkangle(L, 3); + if (zangle == ANGLE_90 || zangle == ANGLE_270) + return luaL_error(L, "invalid zangle for slope!"); + slope->zangle = zangle; + slope->zdelta = -FINETANGENT(((slope->zangle+ANGLE_90)>>ANGLETOFINESHIFT) & 4095); + P_CalculateSlopeNormal(slope); + break; + } + case slope_xydirection: // xydirection + slope->xydirection = luaL_checkangle(L, 3); + slope->d.x = -FINECOSINE((slope->xydirection>>ANGLETOFINESHIFT) & FINEMASK); + slope->d.y = -FINESINE((slope->xydirection>>ANGLETOFINESHIFT) & FINEMASK); + P_CalculateSlopeNormal(slope); + break; + } + return 0; +} + +/////////////// +// vector*_t // +/////////////// + +static int vector2_get(lua_State *L) +{ + vector2_t *vec = *((vector2_t **)luaL_checkudata(L, 1, META_VECTOR2)); + enum vector_e field = luaL_checkoption(L, 2, vector_opt[0], vector_opt); + + if (!vec) + return luaL_error(L, "accessed vector2_t doesn't exist anymore."); + + switch(field) + { + case vector_x: lua_pushfixed(L, vec->x); return 1; + case vector_y: lua_pushfixed(L, vec->y); return 1; + default: break; + } + + return 0; +} + +static int vector3_get(lua_State *L) +{ + vector3_t *vec = *((vector3_t **)luaL_checkudata(L, 1, META_VECTOR3)); + enum vector_e field = luaL_checkoption(L, 2, vector_opt[0], vector_opt); + + if (!vec) + return luaL_error(L, "accessed vector3_t doesn't exist anymore."); + + switch(field) + { + case vector_x: lua_pushfixed(L, vec->x); return 1; + case vector_y: lua_pushfixed(L, vec->y); return 1; + case vector_z: lua_pushfixed(L, vec->z); return 1; + default: break; + } + + return 0; +} +#endif + ///////////////////// // mapheaderinfo[] // ///////////////////// @@ -1922,6 +2192,26 @@ int LUA_MapLib(lua_State *L) lua_setfield(L, -2, "__index"); lua_pop(L, 1); +#ifdef ESLOPE + luaL_newmetatable(L, META_SLOPE); + lua_pushcfunction(L, slope_get); + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, slope_set); + lua_setfield(L, -2, "__newindex"); + lua_pop(L, 1); + + luaL_newmetatable(L, META_VECTOR2); + lua_pushcfunction(L, vector2_get); + lua_setfield(L, -2, "__index"); + lua_pop(L, 1); + + luaL_newmetatable(L, META_VECTOR3); + lua_pushcfunction(L, vector3_get); + lua_setfield(L, -2, "__index"); + lua_pop(L, 1); +#endif + luaL_newmetatable(L, META_MAPHEADER); lua_pushcfunction(L, mapheaderinfo_get); lua_setfield(L, -2, "__index"); diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 1583bd3c4..a9db95d4b 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -40,6 +40,8 @@ enum mobj_e { mobj_subsector, mobj_floorz, mobj_ceilingz, + mobj_floorrover, + mobj_ceilingrover, mobj_radius, mobj_height, mobj_momx, @@ -81,7 +83,12 @@ enum mobj_e { mobj_extravalue1, mobj_extravalue2, mobj_cusval, +#ifdef ESLOPE + mobj_cvmem, + mobj_standingslope +#else mobj_cvmem +#endif }; static const char *const mobj_opt[] = { @@ -100,6 +107,8 @@ static const char *const mobj_opt[] = { "subsector", "floorz", "ceilingz", + "floorrover", + "ceilingrover", "radius", "height", "momx", @@ -142,6 +151,9 @@ static const char *const mobj_opt[] = { "extravalue2", "cusval", "cvmem", +#ifdef ESLOPE + "standingslope", +#endif NULL}; #define UNIMPLEMENTED luaL_error(L, LUA_QL("mobj_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", mobj_opt[field]) @@ -208,6 +220,12 @@ static int mobj_get(lua_State *L) case mobj_ceilingz: lua_pushfixed(L, mo->ceilingz); break; + case mobj_floorrover: + LUA_PushUserdata(L, mo->floorrover, META_FFLOOR); + break; + case mobj_ceilingrover: + LUA_PushUserdata(L, mo->ceilingrover, META_FFLOOR); + break; case mobj_radius: lua_pushfixed(L, mo->radius); break; @@ -348,6 +366,11 @@ static int mobj_get(lua_State *L) case mobj_cvmem: lua_pushinteger(L, mo->cvmem); break; +#ifdef ESLOPE + case mobj_standingslope: + LUA_PushUserdata(L, mo->standingslope, META_SLOPE); + break; +#endif default: // extra custom variables in Lua memory lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); I_Assert(lua_istable(L, -1)); @@ -396,6 +419,8 @@ static int mobj_set(lua_State *L) P_CheckPosition(mo, mo->x, mo->y); mo->floorz = tmfloorz; mo->ceilingz = tmceilingz; + mo->floorrover = tmfloorrover; + mo->ceilingrover = tmceilingrover; P_SetTarget(&tmthing, ptmthing); break; } @@ -430,6 +455,10 @@ static int mobj_set(lua_State *L) return NOSETPOS; case mobj_ceilingz: return NOSETPOS; + case mobj_floorrover: + return NOSET; + case mobj_ceilingrover: + return NOSET; case mobj_radius: { mobj_t *ptmthing = tmthing; @@ -439,6 +468,8 @@ static int mobj_set(lua_State *L) P_CheckPosition(mo, mo->x, mo->y); mo->floorz = tmfloorz; mo->ceilingz = tmceilingz; + mo->floorrover = tmfloorrover; + mo->ceilingrover = tmceilingrover; P_SetTarget(&tmthing, ptmthing); break; } @@ -451,6 +482,8 @@ static int mobj_set(lua_State *L) P_CheckPosition(mo, mo->x, mo->y); mo->floorz = tmfloorz; mo->ceilingz = tmceilingz; + mo->floorrover = tmfloorrover; + mo->ceilingrover = tmceilingrover; P_SetTarget(&tmthing, ptmthing); break; } @@ -655,6 +688,10 @@ static int mobj_set(lua_State *L) case mobj_cvmem: mo->cvmem = luaL_checkinteger(L, 3); break; +#ifdef ESLOPE + case mobj_standingslope: + return NOSET; +#endif default: lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS); I_Assert(lua_istable(L, -1)); diff --git a/src/lua_script.c b/src/lua_script.c index d5736f9e5..69e275712 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -22,6 +22,9 @@ #include "byteptr.h" #include "p_saveg.h" #include "p_local.h" +#ifdef ESLOPE +#include "p_slopes.h" // for P_SlopeById +#endif #ifdef LUA_ALLOW_BYTECODE #include "d_netfil.h" // for LUA_DumpFile #endif @@ -193,25 +196,27 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump) { MYFILE f; char *name; - + size_t len; f.wad = wad; f.size = W_LumpLengthPwad(wad, lump); f.data = Z_Malloc(f.size, PU_LUA, NULL); W_ReadLumpPwad(wad, lump, f.data); f.curpos = f.data; + len = strlen(wadfiles[wad]->filename); // length of file name + if (wadfiles[wad]->type == RET_LUA) { - name = malloc(strlen(wadfiles[wad]->filename)+1); + name = malloc(len+1); strcpy(name, wadfiles[wad]->filename); } else // If it's not a .lua file, copy the lump name in too. { lumpinfo_t *lump_p = &wadfiles[wad]->lumpinfo[lump]; - size_t length = strlen(wadfiles[wad]->filename) + 1 + strlen(lump_p->name2); // length of file name, '|', and lump name - name = malloc(length + 1); + len += 1 + strlen(lump_p->name2); // length of file name, '|', and lump name + name = malloc(len+1); sprintf(name, "%s|%s", wadfiles[wad]->filename, lump_p->name2); - name[length] = '\0'; + name[len] = '\0'; } LUA_LoadFile(&f, name); // actually load file! @@ -496,6 +501,9 @@ enum ARCH_NODE, #endif ARCH_FFLOOR, +#ifdef ESLOPE + ARCH_SLOPE, +#endif ARCH_MAPHEADER, ARCH_TEND=0xFF, @@ -520,6 +528,9 @@ static const struct { {META_NODE, ARCH_NODE}, #endif {META_FFLOOR, ARCH_FFLOOR}, +#ifdef ESLOPE + {META_SLOPE, ARCH_SLOPE}, +#endif {META_MAPHEADER, ARCH_MAPHEADER}, {NULL, ARCH_NULL} }; @@ -774,6 +785,19 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) } break; } +#ifdef ESLOPE + case ARCH_SLOPE: + { + pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex)); + if (!slope) + WRITEUINT8(save_p, ARCH_NULL); + else { + WRITEUINT8(save_p, ARCH_SLOPE); + WRITEUINT16(save_p, slope->id); + } + break; + } +#endif case ARCH_MAPHEADER: { mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex)); @@ -995,8 +1019,13 @@ static UINT8 UnArchiveValue(int TABLESINDEX) LUA_PushUserdata(gL, rover, META_FFLOOR); break; } +#ifdef ESLOPE + case ARCH_SLOPE: + LUA_PushUserdata(gL, P_SlopeById(READUINT16(save_p)), META_SLOPE); + break; +#endif case ARCH_MAPHEADER: - LUA_PushUserdata(gL, §ors[READUINT16(save_p)], META_MAPHEADER); + LUA_PushUserdata(gL, mapheaderinfo[READUINT16(save_p)], META_MAPHEADER); break; case ARCH_TEND: return 1; diff --git a/src/m_anigif.c b/src/m_anigif.c index 6ae112ea8..4ebf2aff3 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -497,7 +497,9 @@ static void GIF_framewrite(void) // screen regions are handled in GIF_lzw { - UINT16 delay = 3; // todo + int d1 = (int)((100.0/NEWTICRATE)*(gif_frames+1)); + int d2 = (int)((100.0/NEWTICRATE)*(gif_frames)); + UINT16 delay = d1-d2; INT32 startline; WRITEMEM(p, gifframe_gchead, 4); diff --git a/src/m_menu.c b/src/m_menu.c index ce82cb69b..46a7d94fc 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -273,6 +273,7 @@ menu_t SP_MainDef, OP_MainDef; menu_t MISC_ScrambleTeamDef, MISC_ChangeTeamDef; // Single Player +static void M_StartTutorial(INT32 choice); static void M_LoadGame(INT32 choice); static void M_TimeAttackLevelSelect(INT32 choice); static void M_TimeAttack(INT32 choice); @@ -438,6 +439,9 @@ static CV_PossibleValue_t serversort_cons_t[] = { }; consvar_t cv_serversort = {"serversort", "Ping", CV_HIDEN | CV_CALL, serversort_cons_t, M_SortServerList, 0, NULL, NULL, 0, 0, NULL}; +// first time memory +consvar_t cv_tutorialprompt = {"tutorialprompt", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + // autorecord demos for time attack static consvar_t cv_autorecord = {"autorecord", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -729,6 +733,7 @@ static menuitem_t SR_EmblemHintMenu[] = // Single Player Main static menuitem_t SP_MainMenu[] = { + {IT_CALL | IT_STRING, NULL, "Tutorial", M_StartTutorial, 84}, {IT_CALL | IT_STRING, NULL, "Start Game", M_LoadGame, 92}, {IT_SECRET, NULL, "Record Attack", M_TimeAttack, 100}, {IT_SECRET, NULL, "NiGHTS Mode", M_NightsAttack, 108}, @@ -737,6 +742,7 @@ static menuitem_t SP_MainMenu[] = enum { + sptutorial, sploadgame, sprecordattack, spnightsmode, @@ -1552,7 +1558,18 @@ menu_t SR_EmblemHintDef = }; // Single Player -menu_t SP_MainDef = CENTERMENUSTYLE(NULL, SP_MainMenu, &MainDef, 72); +menu_t SP_MainDef = //CENTERMENUSTYLE(NULL, SP_MainMenu, &MainDef, 72); +{ + NULL, + sizeof(SP_MainMenu)/sizeof(menuitem_t), + &MainDef, + SP_MainMenu, + M_DrawCenteredMenu, + BASEVIDWIDTH/2, 72, + 1, // start at "Start Game" on first entry + NULL +}; + menu_t SP_LoadDef = { "M_PICKG", @@ -6088,6 +6105,8 @@ static void M_CustomLevelSelect(INT32 choice) static void M_SinglePlayerMenu(INT32 choice) { (void)choice; + SP_MainMenu[sptutorial].status = + tutorialmap ? IT_CALL|IT_STRING : IT_NOTHING|IT_DISABLED; SP_MainMenu[sprecordattack].status = (M_SecretUnlocked(SECRET_RECORDATTACK)) ? IT_CALL|IT_STRING : IT_SECRET; SP_MainMenu[spnightsmode].status = @@ -6113,6 +6132,80 @@ static void M_LoadGameLevelSelect(INT32 choice) M_SetupNextMenu(&SP_LevelSelectDef); } +void M_TutorialSaveControlResponse(INT32 ch) +{ + if (ch == 'y' || ch == KEY_ENTER) + { + G_CopyControls(gamecontrol, gamecontroldefault[tutorialgcs], gcl_tutorial_full, num_gcl_tutorial_full); + CV_Set(&cv_usemouse, cv_usemouse.defaultvalue); + CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue); + CV_Set(&cv_mousemove, cv_mousemove.defaultvalue); + CV_Set(&cv_analog, cv_analog.defaultvalue); + S_StartSound(NULL, sfx_itemup); + } + else + S_StartSound(NULL, sfx_menu1); +} + +static void M_TutorialControlResponse(INT32 ch) +{ + if (ch != KEY_ESCAPE) + { + G_CopyControls(gamecontroldefault[gcs_custom], gamecontrol, NULL, 0); // using gcs_custom as temp storage for old controls + if (ch == 'y' || ch == KEY_ENTER) + { + tutorialgcs = gcs_fps; + tutorialusemouse = cv_usemouse.value; + tutorialfreelook = cv_alwaysfreelook.value; + tutorialmousemove = cv_mousemove.value; + tutorialanalog = cv_analog.value; + + G_CopyControls(gamecontrol, gamecontroldefault[tutorialgcs], gcl_tutorial_full, num_gcl_tutorial_full); + CV_Set(&cv_usemouse, cv_usemouse.defaultvalue); + CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue); + CV_Set(&cv_mousemove, cv_mousemove.defaultvalue); + CV_Set(&cv_analog, cv_analog.defaultvalue); + + //S_StartSound(NULL, sfx_itemup); + } + else + { + tutorialgcs = gcs_custom; + S_StartSound(NULL, sfx_menu1); + } + M_StartTutorial(INT32_MAX); + } + else + S_StartSound(NULL, sfx_menu1); + + MessageDef.prevMenu = &SP_MainDef; // if FirstPrompt -> ControlsPrompt -> ESC, we would go to the main menu unless we force this +} + +// Starts up the tutorial immediately (tbh I wasn't sure where else to put this) +static void M_StartTutorial(INT32 choice) +{ + if (!tutorialmap) + return; // no map to go to, don't bother + + if (choice != INT32_MAX && G_GetControlScheme(gamecontrol, gcl_tutorial_check, num_gcl_tutorial_check) != gcs_fps) + { + M_StartMessage("Do you want to try the \202recommended \202movement controls\x80?\n\nWe will set them just for this tutorial.\n\nPress 'Y' or 'Enter' to confirm\nPress 'N' or any key to keep \nyour current controls.\n",M_TutorialControlResponse,MM_YESNO); + return; + } + else if (choice != INT32_MAX) + tutorialgcs = gcs_custom; + + CV_SetValue(&cv_tutorialprompt, 0); // first-time prompt + + tutorialmode = true; // turn on tutorial mode + + emeralds = 0; + M_ClearMenus(true); + gamecomplete = false; + cursaveslot = 0; + G_DeferedInitNew(false, G_BuildMapName(tutorialmap), 0, false, false); +} + // ============== // LOAD GAME MENU // ============== @@ -6720,6 +6813,26 @@ static void M_HandleLoadSave(INT32 choice) } } +static void M_FirstTimeResponse(INT32 ch) +{ + S_StartSound(NULL, sfx_menu1); + + if (ch == KEY_ESCAPE) + return; + + if (ch != 'y' && ch != KEY_ENTER) + { + CV_SetValue(&cv_tutorialprompt, 0); + M_ReadSaveStrings(); + MessageDef.prevMenu = &SP_LoadDef; // calls M_SetupNextMenu + } + else + { + M_StartTutorial(0); + MessageDef.prevMenu = &MessageDef; // otherwise, the controls prompt won't fire + } +} + // // Selected from SRB2 menu // @@ -6727,6 +6840,13 @@ static void M_LoadGame(INT32 choice) { (void)choice; + if (tutorialmap && cv_tutorialprompt.value) + { + M_StartMessage("Do you want to \x82play a brief Tutorial\x80?\n\nWe highly recommend this because \nthe controls are slightly different \nfrom other games.\n\nPress 'Y' or 'Enter' to go\nPress 'N' or any key to skip\n", + M_FirstTimeResponse, MM_YESNO); + return; + } + M_ReadSaveStrings(); M_SetupNextMenu(&SP_LoadDef); } @@ -9194,9 +9314,17 @@ static void M_DrawControl(void) // draw title (or big pic) M_DrawMenuTitle(); - M_CentreText(30, - (setupcontrols_secondaryplayer ? "SET CONTROLS FOR SECONDARY PLAYER" : - "PRESS ENTER TO CHANGE, BACKSPACE TO CLEAR")); + if (tutorialmode && tutorialgcs) + { + if ((gametic / TICRATE) % 2) + M_CentreText(30, "\202EXIT THE TUTORIAL TO CHANGE THE CONTROLS"); + else + M_CentreText(30, "EXIT THE TUTORIAL TO CHANGE THE CONTROLS"); + } + else + M_CentreText(30, + (setupcontrols_secondaryplayer ? "SET CONTROLS FOR SECONDARY PLAYER" : + "PRESS ENTER TO CHANGE, BACKSPACE TO CLEAR")); if (i) V_DrawString(currentMenu->x - 16, y-(skullAnimCounter/5), V_YELLOWMAP, "\x1A"); // up arrow @@ -9331,6 +9459,9 @@ static void M_ChangeControl(INT32 choice) { static char tmp[55]; + if (tutorialmode && tutorialgcs) // don't allow control changes if temp control override is active + return; + controltochange = currentMenu->menuitems[choice].alphaKey; sprintf(tmp, M_GetText("Hit the new key for\n%s\nESC for Cancel"), currentMenu->menuitems[choice].text); @@ -9346,7 +9477,7 @@ static void M_SoundMenu(INT32 choice) { (void)choice; - OP_SoundOptionsMenu[6].status = ((nosound || sound_disabled) ? IT_GRAYEDOUT : (IT_STRING | IT_CVAR)); + OP_SoundOptionsMenu[6].status = (sound_disabled ? IT_GRAYEDOUT : (IT_STRING | IT_CVAR)); M_SetupNextMenu(&OP_SoundOptionsDef); } @@ -9359,25 +9490,25 @@ void M_DrawSoundMenu(void) V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y+currentMenu->menuitems[0].alphaKey, - (nosound ? V_REDMAP : V_YELLOWMAP), - ((nosound || sound_disabled) ? offstring : onstring)); + (sound_disabled ? V_REDMAP : V_YELLOWMAP), + (sound_disabled ? offstring : onstring)); V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y+currentMenu->menuitems[2].alphaKey, - (nodigimusic ? V_REDMAP : V_YELLOWMAP), - ((nodigimusic || digital_disabled) ? offstring : onstring)); + (digital_disabled ? V_REDMAP : V_YELLOWMAP), + (digital_disabled ? offstring : onstring)); V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y+currentMenu->menuitems[4].alphaKey, - (nomidimusic ? V_REDMAP : V_YELLOWMAP), - ((nomidimusic || music_disabled) ? offstring : onstring)); + (midi_disabled ? V_REDMAP : V_YELLOWMAP), + (midi_disabled ? offstring : onstring)); if (itemOn == 0) - lengthstring = ((nosound || sound_disabled) ? 3 : 2); + lengthstring = (sound_disabled ? 3 : 2); else if (itemOn == 2) - lengthstring = ((nodigimusic || digital_disabled) ? 3 : 2); + lengthstring = (digital_disabled ? 3 : 2); else if (itemOn == 4) - lengthstring = ((nomidimusic || music_disabled) ? 3 : 2); + lengthstring = (midi_disabled ? 3 : 2); else return; @@ -9412,32 +9543,20 @@ static void M_ToggleSFX(INT32 choice) break; } - if (nosound) + if (sound_disabled) { - nosound = false; - I_StartupSound(); - if (nosound) return; - S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); + sound_disabled = false; + S_InitSfxChannels(cv_soundvolume.value); S_StartSound(NULL, sfx_strpst); OP_SoundOptionsMenu[6].status = IT_STRING | IT_CVAR; //M_StartMessage(M_GetText("SFX Enabled\n"), NULL, MM_NOTHING); } else { - if (sound_disabled) - { - sound_disabled = false; - S_StartSound(NULL, sfx_strpst); - OP_SoundOptionsMenu[6].status = IT_STRING | IT_CVAR; - //M_StartMessage(M_GetText("SFX Enabled\n"), NULL, MM_NOTHING); - } - else - { - sound_disabled = true; - S_StopSounds(); - OP_SoundOptionsMenu[6].status = IT_GRAYEDOUT; - //M_StartMessage(M_GetText("SFX Disabled\n"), NULL, MM_NOTHING); - } + sound_disabled = true; + S_StopSounds(); + OP_SoundOptionsMenu[6].status = IT_GRAYEDOUT; + //M_StartMessage(M_GetText("SFX Disabled\n"), NULL, MM_NOTHING); } } @@ -9465,12 +9584,10 @@ static void M_ToggleDigital(INT32 choice) break; } - if (nodigimusic) + if (digital_disabled) { - nodigimusic = false; - I_InitDigMusic(); - if (nodigimusic) return; - S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); + digital_disabled = false; + I_InitMusic(); S_StopMusic(); if (Playing()) P_RestoreMusic(&players[consoleplayer]); @@ -9480,21 +9597,27 @@ static void M_ToggleDigital(INT32 choice) } else { - if (digital_disabled) + digital_disabled = true; + if (S_MusicType() != MU_MID) { - digital_disabled = false; - if (Playing()) - P_RestoreMusic(&players[consoleplayer]); + if (midi_disabled) + S_StopMusic(); else - S_ChangeMusicInternal("_clear", false); - //M_StartMessage(M_GetText("Digital Music Enabled\n"), NULL, MM_NOTHING); - } - else - { - digital_disabled = true; - S_StopMusic(); - //M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING); + { + char mmusic[7]; + UINT16 mflags; + boolean looping; + + if (S_MusicInfo(mmusic, &mflags, &looping) && S_MIDIExists(mmusic)) + { + S_StopMusic(); + S_ChangeMusic(mmusic, mflags, looping); + } + else + S_StopMusic(); + } } + //M_StartMessage(M_GetText("Digital Music Disabled\n"), NULL, MM_NOTHING); } } @@ -9512,6 +9635,12 @@ static void M_ToggleMIDI(INT32 choice) itemOn--; return; + case KEY_LEFTARROW: + case KEY_RIGHTARROW: + if (S_MusicType() != MU_MID && S_MusicType() != MU_NONE) + S_StartSound(NULL, sfx_menu1); + break; + case KEY_ESCAPE: if (currentMenu->prevMenu) M_SetupNextMenu(currentMenu->prevMenu); @@ -9521,13 +9650,10 @@ static void M_ToggleMIDI(INT32 choice) default: break; } - - if (nomidimusic) + if (midi_disabled) { - nomidimusic = false; - I_InitMIDIMusic(); - if (nomidimusic) return; - S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); + midi_disabled = false; + I_InitMusic(); if (Playing()) P_RestoreMusic(&players[consoleplayer]); else @@ -9536,21 +9662,27 @@ static void M_ToggleMIDI(INT32 choice) } else { - if (music_disabled) + midi_disabled = true; + if (S_MusicType() == MU_MID) { - music_disabled = false; - if (Playing()) - P_RestoreMusic(&players[consoleplayer]); + if (digital_disabled) + S_StopMusic(); else - S_ChangeMusicInternal("_clear", false); - //M_StartMessage(M_GetText("MIDI Music Enabled\n"), NULL, MM_NOTHING); - } - else - { - music_disabled = true; - S_StopMusic(); - //M_StartMessage(M_GetText("MIDI Music Disabled\n"), NULL, MM_NOTHING); + { + char mmusic[7]; + UINT16 mflags; + boolean looping; + + if (S_MusicInfo(mmusic, &mflags, &looping) && S_DigExists(mmusic)) + { + S_StopMusic(); + S_ChangeMusic(mmusic, mflags, looping); + } + else + S_StopMusic(); + } } + //M_StartMessage(M_GetText("MIDI Music Disabled\n"), NULL, MM_NOTHING); } } diff --git a/src/m_menu.h b/src/m_menu.h index c1e48912a..894abbe74 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -240,6 +240,8 @@ extern INT16 char_on, startchar; #define BwehHehHe() S_StartSound(NULL, sfx_bewar1+M_RandomKey(4)) // Bweh heh he +void M_TutorialSaveControlResponse(INT32 ch); + void M_ForceSaveSlotSelected(INT32 sslot); void M_CheatActivationResponder(INT32 ch); diff --git a/src/m_misc.c b/src/m_misc.c index 50b6d7a05..fb3ffa5a7 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -58,7 +58,7 @@ typedef off_t off64_t; #if defined(__MINGW32__) && ((__GNUC__ > 7) || (__GNUC__ == 6 && __GNUC_MINOR__ >= 3)) #define PRIdS "u" -#elif defined (_WIN32) +#elif defined (_WIN32) #define PRIdS "Iu" #elif defined (DJGPP) #define PRIdS "u" @@ -475,7 +475,8 @@ void M_FirstLoadConfig(void) } // load default control - G_Controldefault(); + G_DefineDefaultControls(); + G_CopyControls(gamecontrol, gamecontroldefault[gcs_fps], NULL, 0); // load config, make sure those commands doesnt require the screen... COM_BufInsertText(va("exec \"%s\"\n", configfile)); @@ -538,8 +539,28 @@ void M_SaveConfig(const char *filename) // FIXME: save key aliases if ever implemented.. - CV_SaveVariables(f); - if (!dedicated) G_SaveKeySetting(f); + if (tutorialmode && tutorialgcs) + { + CV_SetValue(&cv_usemouse, tutorialusemouse); + CV_SetValue(&cv_alwaysfreelook, tutorialfreelook); + CV_SetValue(&cv_mousemove, tutorialmousemove); + CV_SetValue(&cv_analog, tutorialanalog); + CV_SaveVariables(f); + CV_Set(&cv_usemouse, cv_usemouse.defaultvalue); + CV_Set(&cv_alwaysfreelook, cv_alwaysfreelook.defaultvalue); + CV_Set(&cv_mousemove, cv_mousemove.defaultvalue); + CV_Set(&cv_analog, cv_analog.defaultvalue); + } + else + CV_SaveVariables(f); + + if (!dedicated) + { + if (tutorialmode && tutorialgcs) + G_SaveKeySetting(f, gamecontroldefault[gcs_custom], gamecontrolbis); // using gcs_custom as temp storage + else + G_SaveKeySetting(f, gamecontrol, gamecontrolbis); + } fclose(f); } @@ -651,11 +672,11 @@ static void M_PNGhdr(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png_ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png_byte movie) { #ifdef PNG_TEXT_SUPPORTED -#define SRB2PNGTXT 10 //PNG_KEYWORD_MAX_LENGTH(79) is the max +#define SRB2PNGTXT 11 //PNG_KEYWORD_MAX_LENGTH(79) is the max png_text png_infotext[SRB2PNGTXT]; char keytxt[SRB2PNGTXT][12] = { "Title", "Description", "Playername", "Mapnum", "Mapname", - "Location", "Interface", "Revision", "Build Date", "Build Time"}; + "Location", "Interface", "Render Mode", "Revision", "Build Date", "Build Time"}; char titletxt[] = "Sonic Robo Blast 2 " VERSIONSTRING; png_charp playertxt = cv_playername.zstring; char desctxt[] = "SRB2 Screenshot"; @@ -671,6 +692,7 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png #else "Unknown"; #endif + char rendermodetxt[9]; char maptext[8]; char lvlttltext[48]; char locationtxt[40]; @@ -678,6 +700,19 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png char ctdate[40]; char cttime[40]; + switch (rendermode) + { + case render_soft: + strcpy(rendermodetxt, "Software"); + break; + case render_opengl: + strcpy(rendermodetxt, "OpenGL"); + break; + default: // Just in case + strcpy(rendermodetxt, "None"); + break; + } + if (gamestate == GS_LEVEL) snprintf(maptext, 8, "%s", G_BuildMapName(gamemap)); else @@ -715,9 +750,10 @@ static void M_PNGText(png_structp png_ptr, png_infop png_info_ptr, PNG_CONST png png_infotext[4].text = lvlttltext; png_infotext[5].text = locationtxt; png_infotext[6].text = interfacetxt; - png_infotext[7].text = strncpy(ctrevision, comprevision, sizeof(ctrevision)-1); - png_infotext[8].text = strncpy(ctdate, compdate, sizeof(ctdate)-1); - png_infotext[9].text = strncpy(cttime, comptime, sizeof(cttime)-1); + png_infotext[7].text = rendermodetxt; + png_infotext[8].text = strncpy(ctrevision, comprevision, sizeof(ctrevision)-1); + png_infotext[9].text = strncpy(ctdate, compdate, sizeof(ctdate)-1); + png_infotext[10].text = strncpy(cttime, comptime, sizeof(cttime)-1); png_set_text(png_ptr, png_info_ptr, png_infotext, SRB2PNGTXT); #undef SRB2PNGTXT diff --git a/src/p_enemy.c b/src/p_enemy.c index 9235a1d0f..6fee7d2f0 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -243,6 +243,7 @@ void A_BrakLobShot(mobj_t *actor); void A_NapalmScatter(mobj_t *actor); void A_SpawnFreshCopy(mobj_t *actor); void A_FlickySpawn(mobj_t *actor); +void A_FlickyCenter(mobj_t *actor); void A_FlickyAim(mobj_t *actor); void A_FlickyFly(mobj_t *actor); void A_FlickySoar(mobj_t *actor); @@ -3323,6 +3324,11 @@ void A_MonitorPop(mobj_t *actor) newmobj->sprite = SPR_TV1P; } } + + // Run a linedef executor immediately upon popping + // You may want to delay your effects by 18 tics to sync with the reward giving + if (actor->spawnpoint && actor->lastlook) + P_LinedefExecute(actor->lastlook, actor->target, NULL); } // Function: A_GoldMonitorPop @@ -3406,6 +3412,11 @@ void A_GoldMonitorPop(mobj_t *actor) newmobj->sprite = SPR_TV1P; } } + + // Run a linedef executor immediately upon popping + // You may want to delay your effects by 18 tics to sync with the reward giving + if (actor->spawnpoint && actor->lastlook) + P_LinedefExecute(actor->lastlook, actor->target, NULL); } // Function: A_GoldMonitorRestore @@ -10774,6 +10785,145 @@ void A_FlickySpawn(mobj_t *actor) P_InternalFlickySpawn(actor, locvar1, ((locvar2) ? locvar2 : 8*FRACUNIT), true); } +// Internal Flicky color setting +void P_InternalFlickySetColor(mobj_t *actor, UINT8 extrainfo) +{ + UINT8 flickycolors[] = { + SKINCOLOR_RED, + SKINCOLOR_CYAN, + SKINCOLOR_BLUE, + SKINCOLOR_VAPOR, + SKINCOLOR_PURPLE, + SKINCOLOR_BUBBLEGUM, + SKINCOLOR_NEON, + SKINCOLOR_BLACK, + SKINCOLOR_BEIGE, + SKINCOLOR_LAVENDER, + SKINCOLOR_RUBY, + SKINCOLOR_SALMON, + SKINCOLOR_SUNSET, + SKINCOLOR_ORANGE, + SKINCOLOR_YELLOW, + }; + + if (extrainfo == 0) + // until we can customize flicky colors by level header, just stick to SRB2's defaults + actor->color = flickycolors[P_RandomKey(2)]; //flickycolors[P_RandomKey(sizeof(flickycolors))]; + else + actor->color = flickycolors[min(extrainfo-1, 14)]; // sizeof(flickycolors)-1 +} + +// Function: A_FlickyCenter +// +// Description: Place flickies in-level. +// +// var1: +// Lower 16 bits = if 0, spawns random flicky based on level header. Else, spawns the designated thing type. +// Bits 17-20 = Flicky color, up to 15. Applies to fish. +// Bit 21 = Flag MF_SLIDEME (see below) +// Bit 22 = Flag MF_GRENADEBOUNCE (see below) +// Bit 23 = Flag MF_NOCLIPTHING (see below) +// +// If actor is placed from a spawnpoint (map Thing), the Thing's properties take precedence. +// +// var2 = maximum default distance away from spawn the flickies are allowed to travel. If angle != 0, then that's the radius. +// +// If MTF_EXTRA (MF_SLIDEME): is flagged, Flickies move aimlessly. Else, orbit around the target. +// If MTF_OBJECTSPECIAL (MF_GRENADEBOUNCE): Flickies stand in-place without gravity (unless they hop, then gravity is applied.) +// If MTF_AMBUSH (MF_NOCLIPTHING): is flagged, Flickies hop. +// +void A_FlickyCenter(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; + UINT16 flickytype = (locvar1 & 0xFFFF); + UINT8 flickycolor = ((locvar1 >> 16) & 0xFF); + UINT8 flickyflags = ((locvar1 >> 20) & 0xF); +#ifdef HAVE_BLUA + if (LUA_CallAction("A_FlickyCenter", actor)) + return; +#endif + + if (!actor->tracer) + { + mobj_t *flicky = P_InternalFlickySpawn(actor, locvar1, 1, false); + P_SetTarget(&flicky->target, actor); + P_SetTarget(&actor->tracer, flicky); + + if (actor->spawnpoint) + { + actor->flags &= ~(MF_SLIDEME|MF_GRENADEBOUNCE|MF_NOCLIPTHING); + actor->flags |= ( + ((actor->spawnpoint->options & MTF_EXTRA) ? MF_SLIDEME : 0) + | ((actor->spawnpoint->options & MTF_OBJECTSPECIAL) ? MF_GRENADEBOUNCE : 0) + | ((actor->spawnpoint->options & MTF_AMBUSH) ? MF_NOCLIPTHING : 0) + ); + actor->extravalue1 = actor->spawnpoint->angle ? abs(actor->spawnpoint->angle) * FRACUNIT + : locvar2 ? abs(locvar2) : 384 * FRACUNIT; + actor->extravalue2 = actor->spawnpoint->extrainfo; + actor->friction = actor->spawnpoint->x*FRACUNIT; + actor->movefactor = actor->spawnpoint->y*FRACUNIT; + actor->watertop = actor->spawnpoint->z*FRACUNIT; + } + else + { + actor->flags &= ~(MF_SLIDEME|MF_GRENADEBOUNCE|MF_NOCLIPTHING); + actor->flags |= ( + ((flickyflags & 1) ? MF_SLIDEME : 0) + | ((flickyflags & 2) ? MF_GRENADEBOUNCE : 0) + | ((flickyflags & 4) ? MF_NOCLIPTHING : 0) + ); + actor->extravalue1 = abs(locvar2); + actor->extravalue2 = flickycolor; + actor->friction = actor->x; + actor->movefactor = actor->y; + actor->watertop = actor->z; + locvar1 = flickytype; + } + + if (actor->flags & MF_GRENADEBOUNCE) // in-place + actor->tracer->fuse = 0; + else if (actor->flags & MF_SLIDEME) // aimless + { + actor->tracer->fuse = 0; // less than 2*TICRATE means move aimlessly. + actor->tracer->angle = P_RandomKey(180)*ANG2; + } + else //orbit + actor->tracer->fuse = FRACUNIT; + + if (locvar1 == MT_FLICKY_08) + P_InternalFlickySetColor(actor->tracer, actor->extravalue2); + + actor->extravalue2 = 0; + } + + if (!(actor->flags & MF_SLIDEME) && !(actor->flags & MF_GRENADEBOUNCE)) + { + fixed_t originx = actor->friction; + fixed_t originy = actor->movefactor; + fixed_t originz = actor->watertop; + + actor->tracer->fuse = FRACUNIT; + + // Impose default home radius if flicky orbits around player + if (!actor->extravalue1) + actor->extravalue1 = locvar2 ? abs(locvar2) : 384 * FRACUNIT; + + P_LookForPlayers(actor, true, false, actor->extravalue1); + + if (actor->target && P_AproxDistance(actor->target->x - originx, actor->target->y - originy) < actor->extravalue1) + { + actor->extravalue2 = 1; + P_TeleportMove(actor, actor->target->x, actor->target->y, actor->target->z); + } + else if(actor->extravalue2) + { + actor->extravalue2 = 0; + P_TeleportMove(actor, originx, originy, originz); + } + } +} + // Internal Flicky bubbling function. void P_InternalFlickyBubble(mobj_t *actor) { @@ -10816,7 +10966,10 @@ void A_FlickyAim(mobj_t *actor) return; #endif - if (actor->momx == actor->momy && actor->momy == 0) + if ((actor->momx == actor->momy && actor->momy == 0) + || (actor->target && P_IsFlickyCenter(actor->target->type) + && actor->target->extravalue1 && (actor->target->flags & MF_SLIDEME) + && P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) >= actor->target->extravalue1)) flickyhitwall = true; P_InternalFlickyBubble(actor); @@ -10848,7 +11001,10 @@ void A_FlickyAim(mobj_t *actor) } else if (flickyhitwall) { - actor->angle += ANGLE_180; + if (actor->target && P_IsFlickyCenter(actor->target->type)) + actor->angle = R_PointToAngle2(actor->target->x, actor->target->y, actor->x, actor->y) + P_RandomRange(112, 248) * ANG1; + else + actor->angle += P_RandomRange(112, 248)*ANG1; actor->threshold = 0; } } @@ -10884,7 +11040,13 @@ void P_InternalFlickyFly(mobj_t *actor, fixed_t flyspeed, fixed_t targetdist, fi if (actor->target && abs(chasez - actor->z) > targetdist) targetdist = P_AproxDistance(actor->target->x - actor->x, actor->target->y - actor->y); - vertangle = (R_PointToAngle2(0, actor->z, targetdist, chasez) >> ANGLETOFINESHIFT) & FINEMASK; + if (actor->target + && P_IsFlickyCenter(actor->target->type) + && (actor->target->flags & MF_SLIDEME)) + vertangle = 0; + else + vertangle = (R_PointToAngle2(0, actor->z, targetdist, chasez) >> ANGLETOFINESHIFT) & FINEMASK; + P_InstaThrust(actor, actor->angle, FixedMul(FINECOSINE(vertangle), flyspeed)); actor->momz = FixedMul(FINESINE(vertangle), flyspeed); } @@ -11036,7 +11198,19 @@ void A_FlickyCheck(mobj_t *actor) if (LUA_CallAction("A_FlickyCheck", actor)) return; #endif - if (locvar2 && P_MobjFlip(actor)*actor->momz < 1) + if (actor->target + && P_IsFlickyCenter(actor->target->type) + && (actor->target->flags & MF_GRENADEBOUNCE)) + { + if (!(actor->target->flags & MF_NOCLIPTHING)) // no hopping + { + actor->momz = 0; + actor->flags |= MF_NOGRAVITY; + } + actor->flags |= MF_NOCLIP | MF_NOBLOCKMAP | MF_SCENERY; + P_SetMobjState(actor, mobjinfo[actor->type].seestate); + } + else if (locvar2 && P_MobjFlip(actor)*actor->momz < 1) P_SetMobjState(actor, locvar2); else if (locvar1 && ((!(actor->eflags & MFE_VERTICALFLIP) && actor->z <= actor->floorz) || ((actor->eflags & MFE_VERTICALFLIP) && actor->z + actor->height >= actor->ceilingz))) @@ -11061,7 +11235,19 @@ void A_FlickyHeightCheck(mobj_t *actor) if (LUA_CallAction("A_FlickyHeightCheck", actor)) return; #endif - if (locvar1 && actor->target && P_MobjFlip(actor)*actor->momz < 1 + if (actor->target + && P_IsFlickyCenter(actor->target->type) + && (actor->target->flags & MF_GRENADEBOUNCE)) + { + if (!(actor->target->flags & MF_NOCLIPTHING)) // no hopping + { + actor->momz = 0; + actor->flags |= MF_NOGRAVITY; + } + actor->flags |= MF_NOCLIP | MF_NOBLOCKMAP | MF_SCENERY; + P_SetMobjState(actor, mobjinfo[actor->type].seestate); + } + else if (locvar1 && actor->target && P_MobjFlip(actor)*actor->momz < 1 && ((P_MobjFlip(actor)*((actor->z + actor->height/2) - (actor->target->z + actor->target->height/2)) < locvar2) || (actor->z - actor->height < actor->floorz) || (actor->z + 2*actor->height > actor->ceilingz))) P_SetMobjState(actor, locvar1); @@ -11378,7 +11564,7 @@ void A_ConnectToGround(mobj_t *actor) mobj_t *work; fixed_t workz; fixed_t workh; - INT8 dir; + SINT8 dir; angle_t ang; INT32 locvar1 = var1; INT32 locvar2 = var2; @@ -11636,4 +11822,4 @@ void A_CheckFlags2(mobj_t *actor) if (actor->flags2 & locvar1) P_SetMobjState(actor, (statenum_t)locvar2); -} \ No newline at end of file +} diff --git a/src/p_floor.c b/src/p_floor.c index 0e28b831f..65e4b9537 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -815,6 +815,8 @@ void T_BounceCheese(levelspecthink_t *bouncer) { bouncer->sector->ceilingheight = actionsector->ceilingheight; bouncer->sector->floorheight = bouncer->sector->ceilingheight - (halfheight*2); + T_MovePlane(bouncer->sector, 0, bouncer->sector->ceilingheight, 0, 1, -1); // update things on ceiling + T_MovePlane(bouncer->sector, 0, bouncer->sector->floorheight, 0, 0, -1); // update things on floor P_RecalcPrecipInSector(actionsector); bouncer->sector->ceilingdata = NULL; bouncer->sector->floordata = NULL; @@ -829,6 +831,8 @@ void T_BounceCheese(levelspecthink_t *bouncer) { bouncer->sector->ceilingheight = floorheight + (halfheight << 1); bouncer->sector->floorheight = floorheight; + T_MovePlane(bouncer->sector, 0, bouncer->sector->ceilingheight, 0, 1, -1); // update things on ceiling + T_MovePlane(bouncer->sector, 0, bouncer->sector->floorheight, 0, 0, -1); // update things on floor P_RecalcPrecipInSector(actionsector); bouncer->sector->ceilingdata = NULL; bouncer->sector->floordata = NULL; @@ -845,9 +849,9 @@ void T_BounceCheese(levelspecthink_t *bouncer) } T_MovePlane(bouncer->sector, bouncer->speed/2, bouncer->sector->ceilingheight - - 70*FRACUNIT, 0, 1, -1); // move floor + 70*FRACUNIT, 0, 1, -1); // move ceiling T_MovePlane(bouncer->sector, bouncer->speed/2, bouncer->sector->floorheight - 70*FRACUNIT, - 0, 0, -1); // move ceiling + 0, 0, -1); // move floor bouncer->sector->floorspeed = -bouncer->speed/2; bouncer->sector->ceilspeed = 42; @@ -897,6 +901,8 @@ void T_BounceCheese(levelspecthink_t *bouncer) { bouncer->sector->floorheight = bouncer->floorwasheight; bouncer->sector->ceilingheight = bouncer->ceilingwasheight; + T_MovePlane(bouncer->sector, 0, bouncer->sector->ceilingheight, 0, 1, -1); // update things on ceiling + T_MovePlane(bouncer->sector, 0, bouncer->sector->floorheight, 0, 0, -1); // update things on floor bouncer->sector->ceilingdata = NULL; bouncer->sector->floordata = NULL; bouncer->sector->floorspeed = 0; @@ -1839,6 +1845,7 @@ void T_ThwompSector(levelspecthink_t *thwomp) #define ceilingwasheight vars[5] fixed_t thwompx, thwompy; sector_t *actionsector; + ffloor_t *rover = NULL; INT32 secnum; // If you just crashed down, wait a second before coming back up. @@ -1853,7 +1860,16 @@ void T_ThwompSector(levelspecthink_t *thwomp) secnum = P_FindSectorFromTag((INT16)thwomp->vars[0], -1); if (secnum > 0) + { actionsector = §ors[secnum]; + + // Look for thwomp FFloor + for (rover = actionsector->ffloors; rover; rover = rover->next) + { + if (rover->master == thwomp->sourceline) + break; + } + } else return; // Bad bad bad! @@ -1942,10 +1958,13 @@ void T_ThwompSector(levelspecthink_t *thwomp) { mobj_t *mp = (void *)&actionsector->soundorg; - if (thwomp->sourceline->flags & ML_EFFECT4) - S_StartSound(mp, sides[thwomp->sourceline->sidenum[0]].textureoffset>>FRACBITS); - else - S_StartSound(mp, sfx_thwomp); + if (!rover || (rover->flags & FF_EXISTS)) + { + if (thwomp->sourceline->flags & ML_EFFECT4) + S_StartSound(mp, sides[thwomp->sourceline->sidenum[0]].textureoffset>>FRACBITS); + else + S_StartSound(mp, sfx_thwomp); + } thwomp->direction = 1; // start heading back up thwomp->distance = TICRATE; // but only after a small delay @@ -1959,18 +1978,22 @@ void T_ThwompSector(levelspecthink_t *thwomp) thinker_t *th; mobj_t *mo; - // scan the thinkers to find players! - for (th = thinkercap.next; th != &thinkercap; th = th->next) + if (!rover || (rover->flags & FF_EXISTS)) { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - mo = (mobj_t *)th; - if (mo->type == MT_PLAYER && mo->health && mo->z <= thwomp->sector->ceilingheight - && P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT) + // scan the thinkers to find players! + for (th = thinkercap.next; th != &thinkercap; th = th->next) { - thwomp->direction = -1; - break; + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + mo = (mobj_t *)th; + if (mo->type == MT_PLAYER && mo->health && mo->player && !mo->player->spectator + && mo->z <= thwomp->sector->ceilingheight + && P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT) + { + thwomp->direction = -1; + break; + } } } diff --git a/src/p_inter.c b/src/p_inter.c index 57b47f1c6..63abf4c0e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -182,14 +182,14 @@ void P_DoNightsScore(player_t *player) { if (++players[i].linkcount > players[i].maxlink) players[i].maxlink = players[i].linkcount; - players[i].linktimer = 2*TICRATE; + players[i].linktimer = nightslinktics; } } else // Individual link counts { if (++player->linkcount > player->maxlink) player->maxlink = player->linkcount; - player->linktimer = 2*TICRATE; + player->linktimer = nightslinktics; } if (player->linkcount < 10) @@ -946,6 +946,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Yay! The thing's in reach! Pull it in! mo2->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT; mo2->flags2 |= MF2_NIGHTSPULL; + // New NiGHTS attract speed dummied out because the older behavior + // is exploited as a mechanic. Uncomment to enable. + mo2->movefactor = 0; // 32*FRACUNIT; // initialize the NightsItemChase timer P_SetTarget(&mo2->tracer, toucher); } } @@ -1159,7 +1162,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (!G_IsSpecialStage(gamemap)) { player->powers[pw_nights_linkfreeze] = (UINT16)special->info->speed; - player->linktimer = 2*TICRATE; + player->linktimer = nightslinktics; } else { @@ -1167,7 +1170,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (playeringame[i] && players[i].powers[pw_carry] == CR_NIGHTSMODE) { players[i].powers[pw_nights_linkfreeze] += (UINT16)special->info->speed; - players[i].linktimer = 2*TICRATE; + players[i].linktimer = nightslinktics; } if (special->info->deathsound != sfx_None) S_StartSound(NULL, special->info->deathsound); @@ -2120,7 +2123,10 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget target->flags |= MF_NOGRAVITY|MF_NOCLIP|MF_NOCLIPHEIGHT; // Don't drop Tails 03-08-2000 if (target->flags2 & MF2_NIGHTSPULL) + { P_SetTarget(&target->tracer, NULL); + target->movefactor = 0; // reset NightsItemChase timer + } // dead target is no more shootable target->flags &= ~(MF_SHOOTABLE|MF_FLOAT|MF_SPECIAL); @@ -2179,7 +2185,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget // to make people want to actually dash towards/paraloop enemies if (++source->player->linkcount > source->player->maxlink) source->player->maxlink = source->player->linkcount; - source->player->linktimer = 2*TICRATE; + source->player->linktimer = nightslinktics; } } else @@ -3307,12 +3313,10 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da } else if (player->powers[pw_carry] == CR_NIGHTSFALL) { - if (player->spheres > 0) - { - damage = player->spheres; - P_RingDamage(player, inflictor, source, damage, damagetype, true); - damage = 0; - } + // always damage so we can recoil upon losing points + damage = player->spheres; + P_RingDamage(player, inflictor, source, damage, damagetype, true); + damage = 0; } else if (player->rings > 0) // No shield but have rings. { diff --git a/src/p_lights.c b/src/p_lights.c index 8aa2eedca..c0b46f74c 100644 --- a/src/p_lights.c +++ b/src/p_lights.c @@ -23,7 +23,7 @@ * * \param sector The sector to remove effects from. */ -static void P_RemoveLighting(sector_t *sector) +void P_RemoveLighting(sector_t *sector) { if (sector->lightingdata) { @@ -322,39 +322,70 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector, return g; } -/** Fades all the lights in sectors with a particular tag to a new +/** Fades all the lights in specified sector to a new * value. * - * \param tag Tag to look for sectors by. + * \param sector Target sector * \param destvalue The final light value in these sectors. - * \param speed Speed of the fade; the change to the ligh + * \param speed If tic-based: total duration of effect. + * If speed-based: Speed of the fade; the change to the ligh * level in each sector per tic. - * \todo Calculate speed better so that it is possible to specify - * the time for completion of the fade, and all lights fade - * in this time regardless of initial values. + * \param ticbased Use a specific duration for the fade, defined by speed * \sa T_LightFade */ -void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed) +void P_FadeLightBySector(sector_t *sector, INT32 destvalue, INT32 speed, boolean ticbased) +{ + lightlevel_t *ll; + + P_RemoveLighting(sector); // remove the old lighting effect first + + if ((ticbased && !speed) || sector->lightlevel == destvalue) // set immediately + { + sector->lightlevel = destvalue; + return; + } + + ll = Z_Calloc(sizeof (*ll), PU_LEVSPEC, NULL); + ll->thinker.function.acp1 = (actionf_p1)T_LightFade; + sector->lightingdata = ll; // set it to the lightlevel_t + + P_AddThinker(&ll->thinker); // add thinker + + ll->sector = sector; + ll->sourcelevel = sector->lightlevel; + ll->destlevel = destvalue; + + ll->fixedcurlevel = sector->lightlevel<timer = abs(speed); + ll->fixedpertic = FixedDiv((destvalue<fixedcurlevel, speed<timer = FixedDiv((destvalue<fixedcurlevel, speed<>FRACBITS; + ll->fixedpertic = speed<= 0 ;) { - sector = §ors[i]; - - P_RemoveLighting(sector); // remove the old lighting effect first - ll = Z_Calloc(sizeof (*ll), PU_LEVSPEC, NULL); - ll->thinker.function.acp1 = (actionf_p1)T_LightFade; - sector->lightingdata = ll; // set it to the lightlevel_t - - P_AddThinker(&ll->thinker); // add thinker - - ll->sector = sector; - ll->destlevel = destvalue; - ll->speed = speed; + if (!force && ticbased // always let speed fader execute + && sectors[i].lightingdata + && ((lightlevel_t*)sectors[i].lightingdata)->thinker.function.acp1 == (actionf_p1)T_LightFade) + // && ((lightlevel_t*)sectors[i].lightingdata)->timer > 2) + { + CONS_Debug(DBG_GAMELOGIC, "Line type 420 Executor: Fade light thinker already exists, timer: %d\n", ((lightlevel_t*)sectors[i].lightingdata)->timer); + continue; + } + P_FadeLightBySector(§ors[i], destvalue, speed, ticbased); } } @@ -365,30 +396,13 @@ void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed) */ void T_LightFade(lightlevel_t *ll) { - if (ll->sector->lightlevel < ll->destlevel) + if (--ll->timer <= 0) { - // increase the lightlevel - if (ll->sector->lightlevel + ll->speed >= ll->destlevel) - { - // stop changing light level - ll->sector->lightlevel = (INT16)ll->destlevel; // set to dest lightlevel - - P_RemoveLighting(ll->sector); // clear lightingdata, remove thinker - } - else - ll->sector->lightlevel = (INT16)(ll->sector->lightlevel + (INT16)ll->speed); // move lightlevel + ll->sector->lightlevel = ll->destlevel; // set to dest lightlevel + P_RemoveLighting(ll->sector); // clear lightingdata, remove thinker + return; } - else - { - // decrease lightlevel - if (ll->sector->lightlevel - ll->speed <= ll->destlevel) - { - // stop changing light level - ll->sector->lightlevel = (INT16)ll->destlevel; // set to dest lightlevel - P_RemoveLighting(ll->sector); // clear lightingdata, remove thinker - } - else - ll->sector->lightlevel = (INT16)(ll->sector->lightlevel - (INT16)ll->speed); // move lightlevel - } + ll->fixedcurlevel = ll->fixedcurlevel + ll->fixedpertic; + ll->sector->lightlevel = (ll->fixedcurlevel)>>FRACBITS; } diff --git a/src/p_local.h b/src/p_local.h index 682fb7b55..b98eeae1c 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -311,6 +311,8 @@ void P_NewChaseDir(mobj_t *actor); boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed_t dist); mobj_t *P_InternalFlickySpawn(mobj_t *actor, mobjtype_t flickytype, fixed_t momz, boolean lookforplayers); +void P_InternalFlickySetColor(mobj_t *actor, UINT8 extrainfo); +#define P_IsFlickyCenter(type) (type > MT_FLICKY_01 && type < MT_SEED && (type - MT_FLICKY_01) % 2 ? 1 : 0) void P_InternalFlickyBubble(mobj_t *actor); void P_InternalFlickyFly(mobj_t *actor, fixed_t flyspeed, fixed_t targetdist, fixed_t chasez); void P_InternalFlickyHop(mobj_t *actor, fixed_t momz, fixed_t momh, angle_t angle); @@ -324,6 +326,7 @@ void P_InternalFlickyHop(mobj_t *actor, fixed_t momz, fixed_t momh, angle_t angl extern boolean floatok; extern fixed_t tmfloorz; extern fixed_t tmceilingz; +extern ffloor_t *tmfloorrover, *tmceilingrover; extern mobj_t *tmfloorthing, *tmhitthing, *tmthing; extern camera_t *mapcampointer; extern fixed_t tmx; diff --git a/src/p_map.c b/src/p_map.c index 6e5e03a8d..648bb2bcc 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -52,6 +52,7 @@ fixed_t tmfloorz, tmceilingz; static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector mobj_t *tmhitthing; // the solid thing you bumped into (for collisions) +ffloor_t *tmfloorrover, *tmceilingrover; #ifdef ESLOPE pslope_t *tmfloorslope, *tmceilingslope; #endif @@ -101,6 +102,8 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z) thing->floorz = tmfloorz; thing->ceilingz = tmceilingz; + thing->floorrover = tmfloorrover; + thing->ceilingrover = tmceilingrover; return true; } @@ -1126,6 +1129,8 @@ static boolean PIT_CheckThing(mobj_t *thing) // Respawn rings and items P_ReloadRings(); } + + P_RunNightsLapExecutors(pl->mo); } droneobj->extravalue1 = pl->flyangle; droneobj->extravalue2 = (INT32)leveltime + TICRATE; @@ -1415,6 +1420,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->z + thing->height > tmfloorz) { tmfloorz = thing->z + thing->height; + tmfloorrover = NULL; #ifdef ESLOPE tmfloorslope = NULL; #endif @@ -1435,6 +1441,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return false; tmfloorz = tmceilingz = topz; // block while in air + tmceilingrover = NULL; #ifdef ESLOPE tmceilingslope = NULL; #endif @@ -1443,6 +1450,7 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height) { tmceilingz = topz; + tmceilingrover = NULL; #ifdef ESLOPE tmceilingslope = NULL; #endif @@ -1459,6 +1467,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->z < tmceilingz) { tmceilingz = thing->z; + tmceilingrover = NULL; #ifdef ESLOPE tmceilingslope = NULL; #endif @@ -1479,6 +1488,7 @@ static boolean PIT_CheckThing(mobj_t *thing) return false; tmfloorz = tmceilingz = topz; // block while in air + tmfloorrover = NULL; #ifdef ESLOPE tmfloorslope = NULL; #endif @@ -1487,6 +1497,7 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z) { tmfloorz = topz; + tmfloorrover = NULL; #ifdef ESLOPE tmfloorslope = NULL; #endif @@ -1638,6 +1649,7 @@ static boolean PIT_CheckLine(line_t *ld) { tmceilingz = opentop; ceilingline = ld; + tmceilingrover = NULL; #ifdef ESLOPE tmceilingslope = opentopslope; #endif @@ -1646,6 +1658,7 @@ static boolean PIT_CheckLine(line_t *ld) if (openbottom > tmfloorz) { tmfloorz = openbottom; + tmfloorrover = NULL; #ifdef ESLOPE tmfloorslope = openbottomslope; #endif @@ -1727,6 +1740,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) // will adjust them. tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->floorheight; tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight; + tmfloorrover = NULL; + tmceilingrover = NULL; #ifdef ESLOPE tmfloorslope = newsubsec->sector->f_slope; tmceilingslope = newsubsec->sector->c_slope; @@ -1770,6 +1785,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) { if (tmfloorz < topheight - sinklevel) { tmfloorz = topheight - sinklevel; + tmfloorrover = rover; #ifdef ESLOPE tmfloorslope = *rover->t_slope; #endif @@ -1779,6 +1795,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) { if (tmceilingz > bottomheight + sinklevel) { tmceilingz = bottomheight + sinklevel; + tmceilingrover = rover; #ifdef ESLOPE tmceilingslope = *rover->b_slope; #endif @@ -1803,6 +1820,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) { if (tmfloorz < thing->z) { tmfloorz = thing->z; + tmfloorrover = rover; #ifdef ESLOPE tmfloorslope = NULL; #endif @@ -1821,6 +1839,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) && !(rover->flags & FF_REVERSEPLATFORM)) { tmfloorz = tmdropoffz = topheight; + tmfloorrover = rover; #ifdef ESLOPE tmfloorslope = *rover->t_slope; #endif @@ -1830,6 +1849,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) && !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE))) { tmceilingz = tmdrpoffceilz = bottomheight; + tmceilingrover = rover; #ifdef ESLOPE tmceilingslope = *rover->b_slope; #endif @@ -2326,6 +2346,8 @@ boolean PIT_PushableMoved(mobj_t *thing) mobj_t *oldthing = tmthing; line_t *oldceilline = ceilingline; line_t *oldblockline = blockingline; + ffloor_t *oldflrrover = tmfloorrover; + ffloor_t *oldceilrover = tmceilingrover; #ifdef ESLOPE pslope_t *oldfslope = tmfloorslope; pslope_t *oldcslope = tmceilingslope; @@ -2342,6 +2364,8 @@ boolean PIT_PushableMoved(mobj_t *thing) P_SetTarget(&tmthing, oldthing); ceilingline = oldceilline; blockingline = oldblockline; + tmfloorrover = oldflrrover; + tmceilingrover = oldceilrover; #ifdef ESLOPE tmfloorslope = oldfslope; tmceilingslope = oldcslope; @@ -2463,6 +2487,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) if (thingtop == thing->ceilingz && tmceilingz > thingtop && tmceilingz - thingtop <= maxstep) { thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; + thing->ceilingrover = tmceilingrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } #ifdef ESLOPE @@ -2470,6 +2495,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) else if (tmceilingslope && tmceilingz < thingtop && thingtop - tmceilingz <= maxstep) { thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; + thing->ceilingrover = tmceilingrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } #endif @@ -2477,6 +2503,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep) { thing->z = thing->floorz = tmfloorz; + thing->floorrover = tmfloorrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } #ifdef ESLOPE @@ -2484,6 +2511,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) else if (tmfloorslope && tmfloorz > thing->z && tmfloorz - thing->z <= maxstep) { thing->z = thing->floorz = tmfloorz; + thing->floorrover = tmfloorrover; thing->eflags |= MFE_JUSTSTEPPEDDOWN; } #endif @@ -2555,6 +2583,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->floorz = tmfloorz; thing->ceilingz = tmceilingz; + thing->floorrover = tmfloorrover; + thing->ceilingrover = tmceilingrover; #ifdef ESLOPE if (!(thing->flags & MF_NOCLIPHEIGHT)) @@ -2635,6 +2665,8 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y) thing->floorz = tmfloorz; thing->ceilingz = tmceilingz; + thing->floorrover = tmfloorrover; + thing->ceilingrover = tmceilingrover; thing->x = x; thing->y = y; @@ -2661,7 +2693,10 @@ static boolean P_ThingHeightClip(mobj_t *thing) { boolean floormoved; fixed_t oldfloorz = thing->floorz; + ffloor_t *oldfloorrover = thing->floorrover; + ffloor_t *oldceilingrover = thing->ceilingrover; boolean onfloor = P_IsObjectOnGround(thing);//(thing->z <= thing->floorz); + ffloor_t *rover = NULL; if (thing->flags & MF_NOCLIPHEIGHT) return true; @@ -2676,6 +2711,8 @@ static boolean P_ThingHeightClip(mobj_t *thing) thing->floorz = tmfloorz; thing->ceilingz = tmceilingz; + thing->floorrover = tmfloorrover; + thing->ceilingrover = tmceilingrover; // Ugly hack?!?! As long as just ceilingz is the lowest, // you'll still get crushed, right? @@ -2684,16 +2721,23 @@ static boolean P_ThingHeightClip(mobj_t *thing) if (onfloor && !(thing->flags & MF_NOGRAVITY) && floormoved) { - if (thing->eflags & MFE_VERTICALFLIP) - thing->pmomz = thing->ceilingz - (thing->z + thing->height); - else - thing->pmomz = thing->floorz - thing->z; - thing->eflags |= MFE_APPLYPMOMZ; + rover = (thing->eflags & MFE_VERTICALFLIP) ? oldceilingrover : oldfloorrover; - if (thing->eflags & MFE_VERTICALFLIP) - thing->z = thing->ceilingz - thing->height; - else - thing->z = thing->floorz; + // Match the Thing's old floorz to an FOF and check for FF_EXISTS + // If ~FF_EXISTS, don't set mobj Z. + if (!rover || ((rover->flags & FF_EXISTS) && (rover->flags & FF_SOLID))) + { + if (thing->eflags & MFE_VERTICALFLIP) + thing->pmomz = thing->ceilingz - (thing->z + thing->height); + else + thing->pmomz = thing->floorz - thing->z; + thing->eflags |= MFE_APPLYPMOMZ; + + if (thing->eflags & MFE_VERTICALFLIP) + thing->z = thing->ceilingz - thing->height; + else + thing->z = thing->floorz; + } } else if (!tmfloorthing) { diff --git a/src/p_mobj.c b/src/p_mobj.c index 4353e67c3..58dba9f56 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3729,14 +3729,15 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled if (player->pflags & PF_FLIPCAM && !(player->powers[pw_carry] == CR_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP) postimg = postimg_flip; - else if (player->awayviewtics) + else if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist { camera_t dummycam; dummycam.subsector = player->awayviewmobj->subsector; dummycam.x = player->awayviewmobj->x; dummycam.y = player->awayviewmobj->y; dummycam.z = player->awayviewmobj->z; - dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT + //dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT + dummycam.height = 0; // Why? Remote viewpoint cameras have no height. // Are we in water? if (P_CameraCheckWater(&dummycam)) postimg = postimg_water; @@ -4059,7 +4060,8 @@ void P_RecalcPrecipInSector(sector_t *sector) // void P_NullPrecipThinker(precipmobj_t *mobj) { - (void)mobj; + //(void)mobj; + mobj->precipflags &= ~PCF_THUNK; } void P_SnowThinker(precipmobj_t *mobj) @@ -4079,25 +4081,26 @@ void P_RainThinker(precipmobj_t *mobj) { // cycle through states, // calling action functions at transitions - if (mobj->tics > 0 && --mobj->tics == 0) - { - // you can cycle through multiple states in a tic - if (!P_SetPrecipMobjState(mobj, mobj->state->nextstate)) - return; // freed itself - } + if (mobj->tics <= 0) + return; + + if (--mobj->tics) + return; + + if (!P_SetPrecipMobjState(mobj, mobj->state->nextstate)) + return; + + if (mobj->state != &states[S_RAINRETURN]) + return; + + mobj->z = mobj->ceilingz; + P_SetPrecipMobjState(mobj, S_RAIN1); - if (mobj->state == &states[S_RAINRETURN]) - { - mobj->z = mobj->ceilingz; - P_SetPrecipMobjState(mobj, S_RAIN1); - } return; } // adjust height - mobj->z += mobj->momz; - - if (mobj->z <= mobj->floorz) + if ((mobj->z += mobj->momz) <= mobj->floorz) { // no splashes on sky or bottomless pits if (mobj->precipflags & PCF_PIT) @@ -6102,9 +6105,11 @@ void P_SetScale(mobj_t *mobj, fixed_t newscale) void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on your target { fixed_t dist, ndist, speedmul; + angle_t vangle; fixed_t tx = dest->x; fixed_t ty = dest->y; fixed_t tz = dest->z + (dest->height/2); // Aim for center + fixed_t xydist = P_AproxDistance(tx - source->x, ty - source->y); if (!dest || dest->health <= 0 || !dest->player || !source->tracer) return; @@ -6113,19 +6118,40 @@ void P_Attract(mobj_t *source, mobj_t *dest, boolean nightsgrab) // Home in on y source->angle = R_PointToAngle2(source->x, source->y, tx, ty); // change slope - dist = P_AproxDistance(P_AproxDistance(tx - source->x, ty - source->y), tz - source->z); + dist = P_AproxDistance(xydist, tz - source->z); if (dist < 1) dist = 1; - if (nightsgrab) - speedmul = P_AproxDistance(dest->momx, dest->momy) + FixedMul(8*FRACUNIT, source->scale); - else - speedmul = P_AproxDistance(dest->momx, dest->momy) + FixedMul(source->info->speed, source->scale); + if (nightsgrab && source->movefactor) + { + source->movefactor += FRACUNIT/2; - source->momx = FixedMul(FixedDiv(tx - source->x, dist), speedmul); - source->momy = FixedMul(FixedDiv(ty - source->y, dist), speedmul); - source->momz = FixedMul(FixedDiv(tz - source->z, dist), speedmul); + if (dist < source->movefactor) + { + source->momx = source->momy = source->momz = 0; + P_TeleportMove(source, tx, ty, tz); + } + else + { + vangle = R_PointToAngle2(source->z, 0, tz, xydist); + + source->momx = FixedMul(FINESINE(vangle >> ANGLETOFINESHIFT), FixedMul(FINECOSINE(source->angle >> ANGLETOFINESHIFT), source->movefactor)); + source->momy = FixedMul(FINESINE(vangle >> ANGLETOFINESHIFT), FixedMul(FINESINE(source->angle >> ANGLETOFINESHIFT), source->movefactor)); + source->momz = FixedMul(FINECOSINE(vangle >> ANGLETOFINESHIFT), source->movefactor); + } + } + else + { + if (nightsgrab) + speedmul = P_AproxDistance(dest->momx, dest->momy) + FixedMul(8*FRACUNIT, source->scale); + else + speedmul = P_AproxDistance(dest->momx, dest->momy) + FixedMul(source->info->speed, source->scale); + + source->momx = FixedMul(FixedDiv(tx - source->x, dist), speedmul); + source->momy = FixedMul(FixedDiv(ty - source->y, dist), speedmul); + source->momz = FixedMul(FixedDiv(tz - source->z, dist), speedmul); + } // Instead of just unsetting NOCLIP like an idiot, let's check the distance to our target. ndist = P_AproxDistance(P_AproxDistance(tx - (source->x+source->momx), @@ -6150,6 +6176,7 @@ static void P_NightsItemChase(mobj_t *thing) { P_SetTarget(&thing->tracer, NULL); thing->flags2 &= ~MF2_NIGHTSPULL; + thing->movefactor = 0; return; } @@ -7095,6 +7122,34 @@ void P_MobjThinker(mobj_t *mobj) S_StartSound(flame, sfx_fire); } break; + case MT_FLICKY_01_CENTER: + case MT_FLICKY_02_CENTER: + case MT_FLICKY_03_CENTER: + case MT_FLICKY_04_CENTER: + case MT_FLICKY_05_CENTER: + case MT_FLICKY_06_CENTER: + case MT_FLICKY_07_CENTER: + case MT_FLICKY_08_CENTER: + case MT_FLICKY_09_CENTER: + case MT_FLICKY_10_CENTER: + case MT_FLICKY_11_CENTER: + case MT_FLICKY_12_CENTER: + case MT_FLICKY_13_CENTER: + case MT_FLICKY_14_CENTER: + case MT_FLICKY_15_CENTER: + case MT_FLICKY_16_CENTER: + case MT_SECRETFLICKY_01_CENTER: + case MT_SECRETFLICKY_02_CENTER: + if (mobj->tracer && (mobj->flags & MF_NOCLIPTHING) + && (mobj->flags & MF_GRENADEBOUNCE)) + // for now: only do this bounce routine if flicky is in-place. \todo allow in all movements + { + if (!(mobj->tracer->flags2 & MF2_OBJECTFLIP) && mobj->tracer->z <= mobj->tracer->floorz) + mobj->tracer->momz = 7*FRACUNIT; + else if ((mobj->tracer->flags2 & MF2_OBJECTFLIP) && mobj->tracer->z >= mobj->tracer->ceilingz - mobj->tracer->height) + mobj->tracer->momz = -7*FRACUNIT; + } + break; case MT_SEED: if (P_MobjFlip(mobj)*mobj->momz < mobj->info->speed) mobj->momz = P_MobjFlip(mobj)*mobj->info->speed; @@ -7381,6 +7436,48 @@ void P_MobjThinker(mobj_t *mobj) if ((mobj->flags & MF_ENEMY) && (mobj->state->nextstate == mobj->info->spawnstate && mobj->tics == 1)) mobj->flags2 &= ~MF2_FRET; + // Angle-to-tracer to trigger a linedef exec + // See Linedef Exec 457 (Track mobj angle to point) + if ((mobj->eflags & MFE_TRACERANGLE) && mobj->tracer && mobj->extravalue2) + { + // mobj->lastlook - Don't disable behavior after first failure + // mobj->extravalue1 - Angle tolerance + // mobj->extravalue2 - Exec tag upon failure + // mobj->cvval - Allowable failure delay + // mobj->cvmem - Failure timer + + angle_t ang = mobj->angle - R_PointToAngle2(mobj->x, mobj->y, mobj->tracer->x, mobj->tracer->y); + + // \todo account for distance between mobj and tracer + // Because closer mobjs can be facing beyond the angle tolerance + // yet tracer is still in the camera view + + // failure state: mobj is not facing tracer + // Reasaonable defaults: ANGLE_67h, ANGLE_292h + if (ang >= (angle_t)mobj->extravalue1 && ang <= ANGLE_MAX - (angle_t)mobj->extravalue1) + { + if (mobj->cvmem) + mobj->cvmem--; + else + { + INT32 exectag = mobj->extravalue2; // remember this before we erase the values + + if (mobj->lastlook) + mobj->cvmem = mobj->cusval; // reset timer for next failure + else + { + // disable after first failure + mobj->eflags &= ~MFE_TRACERANGLE; + mobj->lastlook = mobj->extravalue1 = mobj->extravalue2 = mobj->cvmem = mobj->cusval = 0; + } + + P_LinedefExecute(exectag, mobj, NULL); + } + } + else + mobj->cvmem = mobj->cusval; // reset failure timer + } + switch (mobj->type) { case MT_WALLSPIKEBASE: @@ -7975,6 +8072,8 @@ void P_MobjThinker(mobj_t *mobj) return; mobj->floorz = tmfloorz; mobj->ceilingz = tmceilingz; + mobj->floorrover = tmfloorrover; + mobj->ceilingrover = tmceilingrover; if ((mobj->eflags & MFE_UNDERWATER) && mobj->health > 0) { @@ -8493,6 +8592,8 @@ void P_SceneryThinker(mobj_t *mobj) return; mobj->floorz = tmfloorz; mobj->ceilingz = tmceilingz; + mobj->floorrover = tmfloorrover; + mobj->ceilingrover = tmceilingrover; } else { @@ -8575,6 +8676,9 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) #endif mobj->subsector->sector->ceilingheight; + mobj->floorrover = NULL; + mobj->ceilingrover = NULL; + // Tells MobjCheckWater that the water height was not set. mobj->watertop = INT32_MAX; @@ -8751,7 +8855,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) nummaprings = -1; // no perfect bonus, rings are free break; case MT_EGGCAPSULE: - mobj->extravalue1 = -1; // timer for how long a player has been at the capsule + mobj->extravalue1 = -1; // sphere timer for how long a player has been at the capsule + mobj->extravalue2 = -1; // tic timer for how long a player has been at the capsule break; case MT_REDTEAMRING: mobj->color = skincolor_redteam; @@ -8837,6 +8942,9 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype #endif mobj->subsector->sector->ceilingheight; + mobj->floorrover = NULL; + mobj->ceilingrover = NULL; + mobj->z = z; mobj->momz = mobjinfo[type].speed; @@ -8858,14 +8966,15 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype static inline precipmobj_t *P_SpawnRainMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) { precipmobj_t *mo = P_SpawnPrecipMobj(x,y,z,type); - mo->thinker.function.acp1 = (actionf_p1)P_RainThinker; + mo->precipflags |= PCF_RAIN; + //mo->thinker.function.acp1 = (actionf_p1)P_RainThinker; return mo; } static inline precipmobj_t *P_SpawnSnowMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) { precipmobj_t *mo = P_SpawnPrecipMobj(x,y,z,type); - mo->thinker.function.acp1 = (actionf_p1)P_SnowThinker; + //mo->thinker.function.acp1 = (actionf_p1)P_SnowThinker; return mo; } @@ -9172,7 +9281,7 @@ void P_PrecipitationEffects(void) if (!playeringame[displayplayer] || !players[displayplayer].mo) return; - if (nosound || sound_disabled) + if (sound_disabled) return; // Sound off? D'aw, no fun. if (players[displayplayer].mo->subsector->sector->ceilingpic == skyflatnum) @@ -10828,6 +10937,16 @@ ML_EFFECT4 : Don't clip inside the ground mobj->flags2 |= MF2_OBJECTFLIP; } + // Extra functionality + if (mthing->options & MTF_EXTRA) + { + if (mobj->flags & MF_MONITOR && (mthing->angle & 16384)) + { + // Store line exec tag to run upon popping + mobj->lastlook = (mthing->angle & 16383); + } + } + // Final set of not being able to draw nightsitems. if (mobj->flags & MF_NIGHTSITEM) mobj->flags2 |= MF2_DONTDRAW; diff --git a/src/p_mobj.h b/src/p_mobj.h index afab6fda6..eac5118b8 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -239,6 +239,9 @@ typedef enum MFE_SPRUNG = 1<<8, // Platform movement MFE_APPLYPMOMZ = 1<<9, + // Compute and trigger on mobj angle relative to tracer + // See Linedef Exec 457 (Track mobj angle to point) + MFE_TRACERANGLE = 1<<10, // free: to and including 1<<15 } mobjeflag_t; @@ -254,6 +257,10 @@ typedef enum { PCF_FOF = 4, // Above MOVING FOF (this means we need to keep floorz up to date...) PCF_MOVINGFOF = 8, + // Is rain. + PCF_RAIN = 16, + // Ran the thinker this tic. + PCF_THUNK = 32, } precipflag_t; // Map Object definition. typedef struct mobj_s @@ -282,6 +289,8 @@ typedef struct mobj_s // The closest interval over all contacted sectors (or things). fixed_t floorz; // Nearest floor below. fixed_t ceilingz; // Nearest ceiling above. + struct ffloor_s *floorrover; // FOF referred by floorz + struct ffloor_s *ceilingrover; // FOF referred by ceilingz // For movement checking. fixed_t radius; @@ -398,6 +407,8 @@ typedef struct precipmobj_s // The closest interval over all contacted sectors (or things). fixed_t floorz; // Nearest floor below. fixed_t ceilingz; // Nearest ceiling above. + struct ffloor_s *floorrover; // FOF referred by floorz + struct ffloor_s *ceilingrover; // FOF referred by ceilingz // For movement checking. fixed_t radius; // Fixed at 2*FRACUNIT @@ -445,7 +456,7 @@ boolean P_SupermanLook4Players(mobj_t *actor); void P_DestroyRobots(void); void P_SnowThinker(precipmobj_t *mobj); void P_RainThinker(precipmobj_t *mobj); -FUNCMATH void P_NullPrecipThinker(precipmobj_t *mobj); +void P_NullPrecipThinker(precipmobj_t *mobj); void P_RemovePrecipMobj(precipmobj_t *mobj); void P_SetScale(mobj_t *mobj, fixed_t newscale); void P_XYMovement(mobj_t *mo); diff --git a/src/p_polyobj.c b/src/p_polyobj.c index fd3237c9d..875210435 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -985,6 +985,8 @@ static void Polyobj_pushThing(polyobj_t *po, line_t *line, mobj_t *mo) P_CheckPosition(mo, mo->x + momx, mo->y + momy); mo->floorz = tmfloorz; mo->ceilingz = tmceilingz; + mo->floorrover = tmfloorrover; + mo->ceilingrover = tmceilingrover; } } @@ -2853,6 +2855,165 @@ INT32 EV_DoPolyObjFlag(line_t *pfdata) return 1; } +void T_PolyObjFade(polyfade_t *th) +{ + boolean stillfading = false; + polyobj_t *po = Polyobj_GetForNum(th->polyObjNum); + + if (!po) +#ifdef RANGECHECK + I_Error("T_PolyObjFade: thinker has invalid id %d\n", th->polyObjNum); +#else + { + CONS_Debug(DBG_POLYOBJ, "T_PolyObjFade: thinker with invalid id %d removed.\n", th->polyObjNum); + P_RemoveThinkerDelayed(&th->thinker); + return; + } +#endif + + // check for displacement due to override and reattach when possible + if (po->thinker == NULL) + po->thinker = &th->thinker; + + stillfading = th->ticbased ? !(--(th->timer) <= 0) + : !((th->timer -= th->duration) <= 0); + + if (th->timer <= 0) + { + po->translucency = max(min(th->destvalue, NUMTRANSMAPS), 0); + + // remove thinker + if (po->thinker == &th->thinker) + po->thinker = NULL; + P_RemoveThinker(&th->thinker); + } + else + { + INT16 delta = abs(th->destvalue - th->sourcevalue); + INT32 duration = th->ticbased ? th->duration + : abs(FixedMul(FixedDiv(256, NUMTRANSMAPS), NUMTRANSMAPS - th->destvalue) + - FixedMul(FixedDiv(256, NUMTRANSMAPS), NUMTRANSMAPS - th->sourcevalue)); // speed-based internal counter duration: delta in 256 scale + fixed_t factor = min(FixedDiv(duration - th->timer, duration), 1*FRACUNIT); + if (th->destvalue < th->sourcevalue) + po->translucency = max(min(po->translucency, th->sourcevalue - (INT16)FixedMul(delta, factor)), th->destvalue); + else if (th->destvalue > th->sourcevalue) + po->translucency = min(max(po->translucency, th->sourcevalue + (INT16)FixedMul(delta, factor)), th->destvalue); + } + + if (!stillfading) + { + // set render flags + if (po->translucency >= NUMTRANSMAPS) // invisible + po->flags &= ~POF_RENDERALL; + else + po->flags |= (po->spawnflags & POF_RENDERALL); + + // set collision + if (th->docollision) + { + if (th->destvalue > th->sourcevalue) // faded out + { + po->flags &= ~POF_SOLID; + po->flags |= POF_NOSPECIALS; + } + else + { + po->flags |= (po->spawnflags & POF_SOLID); + if (!(po->spawnflags & POF_NOSPECIALS)) + po->flags &= ~POF_NOSPECIALS; + } + } + } + else + { + if (po->translucency >= NUMTRANSMAPS) + // HACK: OpenGL renders fully opaque when >= NUMTRANSMAPS + po->translucency = NUMTRANSMAPS-1; + + po->flags |= (po->spawnflags & POF_RENDERALL); + + // set collision + if (th->docollision) + { + if (th->doghostfade) + { + po->flags &= ~POF_SOLID; + po->flags |= POF_NOSPECIALS; + } + else + { + po->flags |= (po->spawnflags & POF_SOLID); + if (!(po->spawnflags & POF_NOSPECIALS)) + po->flags &= ~POF_NOSPECIALS; + } + } + } +} + +INT32 EV_DoPolyObjFade(polyfadedata_t *pfdata) +{ + polyobj_t *po; + polyobj_t *oldpo; + polyfade_t *th; + INT32 start; + + if (!(po = Polyobj_GetForNum(pfdata->polyObjNum))) + { + CONS_Debug(DBG_POLYOBJ, "EV_DoPolyObjFade: bad polyobj %d\n", pfdata->polyObjNum); + return 0; + } + + // don't allow line actions to affect bad polyobjects + if (po->isBad) + return 0; + + // already equal, nothing to do + if (po->translucency == pfdata->destvalue) + return 1; + + if (po->thinker && po->thinker->function.acp1 == (actionf_p1)T_PolyObjFade) + P_RemoveThinker(po->thinker); + + // create a new thinker + th = Z_Malloc(sizeof(polyfade_t), PU_LEVSPEC, NULL); + th->thinker.function.acp1 = (actionf_p1)T_PolyObjFade; + PolyObj_AddThinker(&th->thinker); + po->thinker = &th->thinker; + + // set fields + th->polyObjNum = pfdata->polyObjNum; + th->sourcevalue = po->translucency; + th->destvalue = pfdata->destvalue; + th->docollision = pfdata->docollision; + th->doghostfade = pfdata->doghostfade; + + if (pfdata->ticbased) + { + th->ticbased = true; + th->timer = th->duration = abs(pfdata->speed); // pfdata->speed is duration + } + else + { + th->ticbased = false; + th->timer = abs(FixedMul(FixedDiv(256, NUMTRANSMAPS), NUMTRANSMAPS - th->destvalue) + - FixedMul(FixedDiv(256, NUMTRANSMAPS), NUMTRANSMAPS - th->sourcevalue)); // delta converted to 256 scale, use as internal counter + th->duration = abs(pfdata->speed); // use th->duration as speed decrement + } + + oldpo = po; + + // apply action to mirroring polyobjects as well + start = 0; + while ((po = Polyobj_GetChild(oldpo, &start))) + { + pfdata->polyObjNum = po->id; + EV_DoPolyObjFade(pfdata); + } + + // action was successful + return 1; +} + #endif // ifdef POLYOBJECTS // EOF diff --git a/src/p_polyobj.h b/src/p_polyobj.h index c9838a922..524518f2a 100644 --- a/src/p_polyobj.h +++ b/src/p_polyobj.h @@ -207,6 +207,20 @@ typedef struct polydisplace_s fixed_t oldHeights; } polydisplace_t; +typedef struct polyfade_s +{ + thinker_t thinker; // must be first + + INT32 polyObjNum; + INT32 sourcevalue; + INT32 destvalue; + boolean docollision; + boolean doghostfade; + boolean ticbased; + INT32 duration; + INT32 timer; +} polyfade_t; + // // Line Activation Data Structures // @@ -266,6 +280,16 @@ typedef struct polydisplacedata_s fixed_t dy; } polydisplacedata_t; +typedef struct polyfadedata_s +{ + INT32 polyObjNum; + INT32 destvalue; + boolean docollision; + boolean doghostfade; + boolean ticbased; + INT32 speed; +} polyfadedata_t; + // // Functions // @@ -287,6 +311,7 @@ void T_PolyDoorSlide(polyslidedoor_t *); void T_PolyDoorSwing(polyswingdoor_t *); void T_PolyObjDisplace (polydisplace_t *); void T_PolyObjFlag (polymove_t *); +void T_PolyObjFade (polyfade_t *); INT32 EV_DoPolyDoor(polydoordata_t *); INT32 EV_DoPolyObjMove(polymovedata_t *); @@ -294,6 +319,7 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *); INT32 EV_DoPolyObjRotate(polyrotdata_t *); INT32 EV_DoPolyObjDisplace(polydisplacedata_t *); INT32 EV_DoPolyObjFlag(struct line_s *); +INT32 EV_DoPolyObjFade(polyfadedata_t *); // diff --git a/src/p_saveg.c b/src/p_saveg.c index 22d43f358..6a07e513f 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -21,6 +21,7 @@ #include "p_local.h" #include "p_setup.h" #include "p_saveg.h" +#include "r_data.h" #include "r_things.h" #include "r_state.h" #include "w_wad.h" @@ -473,6 +474,243 @@ static void P_NetUnArchivePlayers(void) } } +/// +/// Colormaps +/// + +static extracolormap_t *net_colormaps = NULL; +static UINT32 num_net_colormaps = 0; +static UINT32 num_ffloors = 0; // for loading + +// Copypasta from r_data.c AddColormapToList +// But also check for equality and return the matching index +static UINT32 CheckAddNetColormapToList(extracolormap_t *extra_colormap) +{ + extracolormap_t *exc, *exc_prev; + UINT32 i = 0; + + if (!net_colormaps) + { + net_colormaps = R_CopyColormap(extra_colormap, false); + net_colormaps->next = 0; + net_colormaps->prev = 0; + num_net_colormaps = i+1; + return i; + } + + for (exc = net_colormaps; exc; exc_prev = exc, exc = exc->next) + { + if (R_CheckEqualColormaps(exc, extra_colormap, true, true, true)) + return i; + i++; + } + + exc_prev->next = R_CopyColormap(extra_colormap, false); + extra_colormap->prev = exc_prev; + extra_colormap->next = 0; + + num_net_colormaps = i+1; + return i; +} + +static extracolormap_t *GetNetColormapFromList(UINT32 index) +{ + // For loading, we have to be tricky: + // We load the sectors BEFORE knowing the colormap values + // So if an index doesn't exist, fill our list with dummy colormaps + // until we get the index we want + // Then when we load the color data, we set up the dummy colormaps + + extracolormap_t *exc, *last_exc = NULL; + UINT32 i = 0; + + if (!net_colormaps) // initialize our list + net_colormaps = R_CreateDefaultColormap(false); + + for (exc = net_colormaps; exc; last_exc = exc, exc = exc->next) + { + if (i++ == index) + return exc; + } + + + // LET'S HOPE that index is a sane value, because we create up to [index] + // entries in net_colormaps. At this point, we don't know + // what the total colormap count is + if (index >= numsectors*3 + num_ffloors) + // if every sector had a unique colormap change AND a fade color thinker which has two colormap entries + // AND every ffloor had a fade FOF thinker with one colormap entry + I_Error("Colormap %d from server is too high for sectors %d", index, (UINT32)numsectors); + + // our index doesn't exist, so just make the entry + for (; i <= index; i++) + { + exc = R_CreateDefaultColormap(false); + if (last_exc) + last_exc->next = exc; + exc->prev = last_exc; + exc->next = NULL; + last_exc = exc; + } + return exc; +} + +static void ClearNetColormaps(void) +{ + // We're actually Z_Freeing each entry here, + // so don't call this in P_NetUnArchiveColormaps (where entries will be used in-game) + extracolormap_t *exc, *exc_next; + + for (exc = net_colormaps; exc; exc = exc_next) + { + exc_next = exc->next; + Z_Free(exc); + } + num_net_colormaps = 0; + num_ffloors = 0; + net_colormaps = NULL; +} + +static void P_NetArchiveColormaps(void) +{ + // We save and then we clean up our colormap mess + extracolormap_t *exc, *exc_next; + UINT32 i = 0; + WRITEUINT32(save_p, num_net_colormaps); // save for safety + + for (exc = net_colormaps; i < num_net_colormaps; i++, exc = exc_next) + { + // We must save num_net_colormaps worth of data + // So fill non-existent entries with default. + if (!exc) + exc = R_CreateDefaultColormap(false); + + WRITEUINT8(save_p, exc->fadestart); + WRITEUINT8(save_p, exc->fadeend); + WRITEUINT8(save_p, exc->fog); + + WRITEINT32(save_p, exc->rgba); + WRITEINT32(save_p, exc->fadergba); + +#ifdef EXTRACOLORMAPLUMPS + WRITESTRINGN(save_p, exc->lumpname, 9); +#endif + + exc_next = exc->next; + Z_Free(exc); // don't need anymore + } + + num_net_colormaps = 0; + num_ffloors = 0; + net_colormaps = NULL; +} + +static void P_NetUnArchiveColormaps(void) +{ + // When we reach this point, we already populated our list with + // dummy colormaps. Now that we are loading the color data, + // set up the dummies. + extracolormap_t *exc, *existing_exc, *exc_next = NULL; + UINT32 i = 0; + + num_net_colormaps = READUINT32(save_p); + + for (exc = net_colormaps; i < num_net_colormaps; i++, exc = exc_next) + { + UINT8 fadestart, fadeend, fog; + INT32 rgba, fadergba; +#ifdef EXTRACOLORMAPLUMPS + char lumpname[9]; +#endif + + fadestart = READUINT8(save_p); + fadeend = READUINT8(save_p); + fog = READUINT8(save_p); + + rgba = READINT32(save_p); + fadergba = READINT32(save_p); + +#ifdef EXTRACOLORMAPLUMPS + READSTRINGN(save_p, lumpname, 9); + + if (lumpname[0]) + { + if (!exc) + // no point making a new entry since nothing points to it, + // but we needed to read the data so now continue + continue; + + exc_next = exc->next; // this gets overwritten during our operations here, so get it now + existing_exc = R_ColormapForName(lumpname); + *exc = *existing_exc; + R_AddColormapToList(exc); // see HACK note below on why we're adding duplicates + continue; + } +#endif + + if (!exc) + // no point making a new entry since nothing points to it, + // but we needed to read the data so now continue + continue; + + exc_next = exc->next; // this gets overwritten during our operations here, so get it now + + exc->fadestart = fadestart; + exc->fadeend = fadeend; + exc->fog = fog; + + exc->rgba = rgba; + exc->fadergba = fadergba; + +#ifdef EXTRACOLORMAPLUMPS + exc->lump = LUMPERROR; + exc->lumpname[0] = 0; +#endif + + existing_exc = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, fog); + + if (existing_exc) + exc->colormap = existing_exc->colormap; + else + // CONS_Debug(DBG_RENDER, "Creating Colormap: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n", + // R_GetRgbaR(rgba), R_GetRgbaG(rgba), R_GetRgbaB(rgba), R_GetRgbaA(rgba), + // R_GetRgbaR(fadergba), R_GetRgbaG(fadergba), R_GetRgbaB(fadergba), R_GetRgbaA(fadergba)); + exc->colormap = R_CreateLightTable(exc); + + // HACK: If this dummy is a duplicate, we're going to add it + // to the extra_colormaps list anyway. I think this is faster + // than going through every loaded sector and correcting their + // colormap address to the pre-existing one, PER net_colormap entry + R_AddColormapToList(exc); + + if (i < num_net_colormaps-1 && !exc_next) + exc_next = R_CreateDefaultColormap(false); + } + + // if we still have a valid net_colormap after iterating up to num_net_colormaps, + // some sector had a colormap index higher than num_net_colormaps. We done goofed or $$$ was corrupted. + // In any case, add them to the colormap list too so that at least the sectors' colormap + // addresses are valid and accounted properly + if (exc_next) + { + existing_exc = R_GetDefaultColormap(); + for (exc = exc_next; exc; exc = exc->next) + { + exc->colormap = existing_exc->colormap; // all our dummies are default values + R_AddColormapToList(exc); + } + } + + // Don't need these anymore + num_net_colormaps = 0; + num_ffloors = 0; + net_colormaps = NULL; +} + +/// +/// World Archiving +/// + #define SD_FLOORHT 0x01 #define SD_CEILHT 0x02 #define SD_FLOORPIC 0x04 @@ -487,10 +725,14 @@ static void P_NetUnArchivePlayers(void) #define SD_FYOFFS 0x02 #define SD_CXOFFS 0x04 #define SD_CYOFFS 0x08 -#define SD_TAG 0x10 -#define SD_FLOORANG 0x20 -#define SD_CEILANG 0x40 -#define SD_TAGLIST 0x80 +#define SD_FLOORANG 0x10 +#define SD_CEILANG 0x20 +#define SD_TAG 0x40 +#define SD_DIFF3 0x80 + +// diff3 flags +#define SD_TAGLIST 0x01 +#define SD_COLORMAP 0x02 #define LD_FLAG 0x01 #define LD_SPECIAL 0x02 @@ -523,7 +765,10 @@ static void P_NetArchiveWorld(void) mapsidedef_t *msd; maplinedef_t *mld; const sector_t *ss = sectors; - UINT8 diff, diff2; + UINT8 diff, diff2, diff3; + + // initialize colormap vars because paranoia + ClearNetColormaps(); WRITEUINT32(save_p, ARCHIVEBLOCK_WORLD); put = save_p; @@ -550,7 +795,7 @@ static void P_NetArchiveWorld(void) for (i = 0; i < numsectors; i++, ss++, ms++) { - diff = diff2 = 0; + diff = diff2 = diff3 = 0; if (ss->floorheight != SHORT(ms->floorheight)<ceilingheight != SHORT(ms->ceilingheight)<tag != SHORT(ms->tag)) diff2 |= SD_TAG; if (ss->nexttag != ss->spawn_nexttag || ss->firsttag != ss->spawn_firsttag) - diff2 |= SD_TAGLIST; + diff3 |= SD_TAGLIST; + + if (ss->extra_colormap != ss->spawn_extra_colormap) + diff3 |= SD_COLORMAP; // Check if any of the sector's FOFs differ from how they spawned if (ss->ffloors) @@ -601,6 +849,9 @@ static void P_NetArchiveWorld(void) } } + if (diff3) + diff2 |= SD_DIFF3; + if (diff2) diff |= SD_DIFF2; @@ -612,6 +863,8 @@ static void P_NetArchiveWorld(void) WRITEUINT8(put, diff); if (diff & SD_DIFF2) WRITEUINT8(put, diff2); + if (diff2 & SD_DIFF3) + WRITEUINT8(put, diff3); if (diff & SD_FLOORHT) WRITEFIXED(put, ss->floorheight); if (diff & SD_CEILHT) @@ -632,18 +885,22 @@ static void P_NetArchiveWorld(void) WRITEFIXED(put, ss->ceiling_xoffs); if (diff2 & SD_CYOFFS) WRITEFIXED(put, ss->ceiling_yoffs); - if (diff2 & SD_TAG) // save only the tag - WRITEINT16(put, ss->tag); if (diff2 & SD_FLOORANG) WRITEANGLE(put, ss->floorpic_angle); if (diff2 & SD_CEILANG) WRITEANGLE(put, ss->ceilingpic_angle); - if (diff2 & SD_TAGLIST) // save both firsttag and nexttag + if (diff2 & SD_TAG) // save only the tag + WRITEINT16(put, ss->tag); + if (diff3 & SD_TAGLIST) // save both firsttag and nexttag { // either of these could be changed even if tag isn't WRITEINT32(put, ss->firsttag); WRITEINT32(put, ss->nexttag); } + if (diff3 & SD_COLORMAP) + WRITEUINT32(put, CheckAddNetColormapToList(ss->extra_colormap)); + // returns existing index if already added, or appends to net_colormaps and returns new index + // Special case: save the stats of all modified ffloors along with their ffloor "number"s // we don't bother with ffloors that haven't changed, that would just add to savegame even more than is really needed if (diff & SD_FFLOORS) @@ -680,7 +937,7 @@ static void P_NetArchiveWorld(void) // do lines for (i = 0; i < numlines; i++, mld++, li++) { - diff = diff2 = 0; + diff = diff2 = diff3 = 0; if (li->special != SHORT(mld->special)) diff |= LD_SPECIAL; @@ -772,11 +1029,22 @@ static void P_NetUnArchiveWorld(void) line_t *li; side_t *si; UINT8 *get; - UINT8 diff, diff2; + UINT8 diff, diff2, diff3; if (READUINT32(save_p) != ARCHIVEBLOCK_WORLD) I_Error("Bad $$$.sav at archive block World"); + // initialize colormap vars because paranoia + ClearNetColormaps(); + + // count the level's ffloors so that colormap loading can have an upper limit + for (i = 0; i < numsectors; i++) + { + ffloor_t *rover; + for (rover = sectors[i].ffloors; rover; rover = rover->next) + num_ffloors++; + } + get = save_p; for (;;) @@ -794,6 +1062,10 @@ static void P_NetUnArchiveWorld(void) diff2 = READUINT8(get); else diff2 = 0; + if (diff2 & SD_DIFF3) + diff3 = READUINT8(get); + else + diff3 = 0; if (diff & SD_FLOORHT) sectors[i].floorheight = READFIXED(get); @@ -822,17 +1094,20 @@ static void P_NetUnArchiveWorld(void) sectors[i].ceiling_xoffs = READFIXED(get); if (diff2 & SD_CYOFFS) sectors[i].ceiling_yoffs = READFIXED(get); - if (diff2 & SD_TAG) - sectors[i].tag = READINT16(get); // DON'T use P_ChangeSectorTag - if (diff2 & SD_TAGLIST) - { - sectors[i].firsttag = READINT32(get); - sectors[i].nexttag = READINT32(get); - } if (diff2 & SD_FLOORANG) sectors[i].floorpic_angle = READANGLE(get); if (diff2 & SD_CEILANG) sectors[i].ceilingpic_angle = READANGLE(get); + if (diff2 & SD_TAG) + sectors[i].tag = READINT16(get); // DON'T use P_ChangeSectorTag + if (diff3 & SD_TAGLIST) + { + sectors[i].firsttag = READINT32(get); + sectors[i].nexttag = READINT32(get); + } + + if (diff3 & SD_COLORMAP) + sectors[i].extra_colormap = GetNetColormapFromList(READUINT32(get)); if (diff & SD_FFLOORS) { @@ -891,6 +1166,9 @@ static void P_NetUnArchiveWorld(void) diff2 = READUINT8(get); else diff2 = 0; + + diff3 = 0; + if (diff & LD_FLAG) li->flags = READINT16(get); if (diff & LD_SPECIAL) @@ -972,11 +1250,13 @@ typedef enum MD2_EXTVAL1 = 1<<5, MD2_EXTVAL2 = 1<<6, MD2_HNEXT = 1<<7, -#ifdef ESLOPE MD2_HPREV = 1<<8, - MD2_SLOPE = 1<<9 + MD2_FLOORROVER = 1<<9, +#ifdef ESLOPE + MD2_CEILINGROVER = 1<<10, + MD2_SLOPE = 1<<11 #else - MD2_HPREV = 1<<8 + MD2_CEILINGROVER = 1<<10 #endif } mobj_diff2_t; @@ -996,6 +1276,7 @@ typedef enum tc_bouncecheese, tc_startcrumble, tc_marioblock, + tc_marioblockchecker, tc_spikesector, tc_floatsector, tc_bridgethinker, @@ -1010,6 +1291,8 @@ typedef enum tc_noenemies, tc_eachtime, tc_disappear, + tc_fade, + tc_fadecolormap, tc_planedisplace, #ifdef POLYOBJECTS tc_polyrotate, // haleyjd 03/26/06: polyobjects @@ -1019,6 +1302,7 @@ typedef enum tc_polyswingdoor, tc_polyflag, tc_polydisplace, + tc_polyfade, #endif tc_end } specials_e; @@ -1170,6 +1454,10 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 |= MD2_HNEXT; if (mobj->hprev) diff2 |= MD2_HPREV; + if (mobj->floorrover) + diff2 |= MD2_FLOORROVER; + if (mobj->ceilingrover) + diff2 |= MD2_CEILINGROVER; #ifdef ESLOPE if (mobj->standingslope) diff2 |= MD2_SLOPE; @@ -1193,6 +1481,46 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, mobj->floorz); WRITEFIXED(save_p, mobj->ceilingz); + if (diff2 & MD2_FLOORROVER) + { + ffloor_t *rover; + size_t i = 0; + UINT32 roverindex = 0; + + for (rover = mobj->floorrover->target->ffloors; rover; rover = rover->next) + { + if (rover == mobj->floorrover) + { + roverindex = i; + break; + } + i++; + } + + WRITEUINT32(save_p, (UINT32)(mobj->floorrover->target - sectors)); + WRITEUINT32(save_p, rover ? roverindex : i); // store max index to denote invalid ffloor ref + } + + if (diff2 & MD2_CEILINGROVER) + { + ffloor_t *rover; + size_t i = 0; + UINT32 roverindex = 0; + + for (rover = mobj->ceilingrover->target->ffloors; rover; rover = rover->next) + { + if (rover == mobj->ceilingrover) + { + roverindex = i; + break; + } + i++; + } + + WRITEUINT32(save_p, (UINT32)(mobj->ceilingrover->target - sectors)); + WRITEUINT32(save_p, rover ? roverindex : i); // store max index to denote invalid ffloor ref + } + if (diff & MD_SPAWNPOINT) { size_t z; @@ -1311,7 +1639,10 @@ static void SaveSpecialLevelThinker(const thinker_t *th, const UINT8 type) size_t i; WRITEUINT8(save_p, type); for (i = 0; i < 16; i++) + { WRITEFIXED(save_p, ht->vars[i]); //var[16] + WRITEFIXED(save_p, ht->var2s[i]); //var[16] + } WRITEUINT32(save_p, SaveLine(ht->sourceline)); WRITEUINT32(save_p, SaveSector(ht->sector)); } @@ -1537,8 +1868,11 @@ static void SaveLightlevelThinker(const thinker_t *th, const UINT8 type) const lightlevel_t *ht = (const void *)th; WRITEUINT8(save_p, type); WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEINT32(save_p, ht->destlevel); - WRITEINT32(save_p, ht->speed); + WRITEINT16(save_p, ht->sourcelevel); + WRITEINT16(save_p, ht->destlevel); + WRITEFIXED(save_p, ht->fixedcurlevel); + WRITEFIXED(save_p, ht->fixedpertic); + WRITEINT32(save_p, ht->timer); } // @@ -1574,6 +1908,51 @@ static void SaveDisappearThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, ht->exists); } +// +// SaveFadeThinker +// +// Saves a fade_t thinker +// +static void SaveFadeThinker(const thinker_t *th, const UINT8 type) +{ + const fade_t *ht = (const void *)th; + WRITEUINT8(save_p, type); + WRITEUINT32(save_p, CheckAddNetColormapToList(ht->dest_exc)); + WRITEUINT32(save_p, ht->sectornum); + WRITEUINT32(save_p, ht->ffloornum); + WRITEINT32(save_p, ht->alpha); + WRITEINT16(save_p, ht->sourcevalue); + WRITEINT16(save_p, ht->destvalue); + WRITEINT16(save_p, ht->destlightlevel); + WRITEINT16(save_p, ht->speed); + WRITEUINT8(save_p, (UINT8)ht->ticbased); + WRITEINT32(save_p, ht->timer); + WRITEUINT8(save_p, ht->doexists); + WRITEUINT8(save_p, ht->dotranslucent); + WRITEUINT8(save_p, ht->dolighting); + WRITEUINT8(save_p, ht->docolormap); + WRITEUINT8(save_p, ht->docollision); + WRITEUINT8(save_p, ht->doghostfade); + WRITEUINT8(save_p, ht->exactalpha); +} + +// +// SaveFadeColormapThinker +// +// Saves a fadecolormap_t thinker +// +static void SaveFadeColormapThinker(const thinker_t *th, const UINT8 type) +{ + const fadecolormap_t *ht = (const void *)th; + WRITEUINT8(save_p, type); + WRITEUINT32(save_p, SaveSector(ht->sector)); + WRITEUINT32(save_p, CheckAddNetColormapToList(ht->source_exc)); + WRITEUINT32(save_p, CheckAddNetColormapToList(ht->dest_exc)); + WRITEUINT8(save_p, (UINT8)ht->ticbased); + WRITEINT32(save_p, ht->duration); + WRITEINT32(save_p, ht->timer); +} + // // SavePlaneDisplaceThinker // @@ -1699,6 +2078,20 @@ static void SavePolydisplaceThinker(const thinker_t *th, const UINT8 type) WRITEFIXED(save_p, ht->oldHeights); } +static void SavePolyfadeThinker(const thinker_t *th, const UINT8 type) +{ + const polyfade_t *ht = (const void *)th; + WRITEUINT8(save_p, type); + WRITEINT32(save_p, ht->polyObjNum); + WRITEINT32(save_p, ht->sourcevalue); + WRITEINT32(save_p, ht->destvalue); + WRITEUINT8(save_p, (UINT8)ht->docollision); + WRITEUINT8(save_p, (UINT8)ht->doghostfade); + WRITEUINT8(save_p, (UINT8)ht->ticbased); + WRITEINT32(save_p, ht->duration); + WRITEINT32(save_p, ht->timer); +} + #endif /* // @@ -1728,8 +2121,7 @@ static void P_NetArchiveThinkers(void) for (th = thinkercap.next; th != &thinkercap; th = th->next) { if (!(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed - || th->function.acp1 == (actionf_p1)P_RainThinker - || th->function.acp1 == (actionf_p1)P_SnowThinker)) + || th->function.acp1 == (actionf_p1)P_NullPrecipThinker)) numsaved++; if (th->function.acp1 == (actionf_p1)P_MobjThinker) @@ -1738,8 +2130,7 @@ static void P_NetArchiveThinkers(void) continue; } #ifdef PARANOIA - else if (th->function.acp1 == (actionf_p1)P_RainThinker - || th->function.acp1 == (actionf_p1)P_SnowThinker); + else if (th->function.acp1 == (actionf_p1)P_NullPrecipThinker); #endif else if (th->function.acp1 == (actionf_p1)T_MoveCeiling) { @@ -1841,6 +2232,11 @@ static void P_NetArchiveThinkers(void) SaveSpecialLevelThinker(th, tc_marioblock); continue; } + else if (th->function.acp1 == (actionf_p1)T_MarioBlockChecker) + { + SaveSpecialLevelThinker(th, tc_marioblockchecker); + continue; + } else if (th->function.acp1 == (actionf_p1)T_SpikeSector) { SaveSpecialLevelThinker(th, tc_spikesector); @@ -1876,7 +2272,16 @@ static void P_NetArchiveThinkers(void) SaveDisappearThinker(th, tc_disappear); continue; } - + else if (th->function.acp1 == (actionf_p1)T_Fade) + { + SaveFadeThinker(th, tc_fade); + continue; + } + else if (th->function.acp1 == (actionf_p1)T_FadeColormap) + { + SaveFadeColormapThinker(th, tc_fadecolormap); + continue; + } else if (th->function.acp1 == (actionf_p1)T_PlaneDisplace) { SavePlaneDisplaceThinker(th, tc_planedisplace); @@ -1918,6 +2323,11 @@ static void P_NetArchiveThinkers(void) SavePolydisplaceThinker(th, tc_polydisplace); continue; } + else if (th->function.acp1 == (actionf_p1)T_PolyObjFade) + { + SavePolyfadeThinker(th, tc_polyfade); + continue; + } #endif #ifdef PARANOIA else if (th->function.acv != P_RemoveThinkerDelayed) // wait garbage collection @@ -1989,6 +2399,7 @@ static void LoadMobjThinker(actionf_p1 thinker) UINT16 diff2; INT32 i; fixed_t z, floorz, ceilingz; + ffloor_t *floorrover = NULL, *ceilingrover = NULL; diff = READUINT32(save_p); if (diff & MD_MORE) @@ -2002,6 +2413,38 @@ static void LoadMobjThinker(actionf_p1 thinker) floorz = READFIXED(save_p); ceilingz = READFIXED(save_p); + if (diff2 & MD2_FLOORROVER) + { + size_t floor_sectornum = (size_t)READUINT32(save_p); + size_t floor_rovernum = (size_t)READUINT32(save_p); + ffloor_t *rover = NULL; + size_t rovernum = 0; + + for (rover = sectors[floor_sectornum].ffloors; rover; rover = rover->next) + { + if (rovernum == floor_rovernum) + break; + rovernum++; + } + floorrover = rover; + } + + if (diff2 & MD2_CEILINGROVER) + { + size_t ceiling_sectornum = (size_t)READUINT32(save_p); + size_t ceiling_rovernum = (size_t)READUINT32(save_p); + ffloor_t *rover = NULL; + size_t rovernum = 0; + + for (rover = sectors[ceiling_sectornum].ffloors; rover; rover = rover->next) + { + if (rovernum == ceiling_rovernum) + break; + rovernum++; + } + ceilingrover = rover; + } + if (diff & MD_SPAWNPOINT) { UINT16 spawnpointnum = READUINT16(save_p); @@ -2026,6 +2469,8 @@ static void LoadMobjThinker(actionf_p1 thinker) mobj->z = z; mobj->floorz = floorz; mobj->ceilingz = ceilingz; + mobj->floorrover = floorrover; + mobj->ceilingrover = ceilingrover; if (diff & MD_TYPE) mobj->type = READUINT32(save_p); @@ -2236,7 +2681,10 @@ static void LoadSpecialLevelThinker(actionf_p1 thinker, UINT8 floorOrCeiling) size_t i; ht->thinker.function.acp1 = thinker; for (i = 0; i < 16; i++) + { ht->vars[i] = READFIXED(save_p); //var[16] + ht->var2s[i] = READFIXED(save_p); //var[16] + } ht->sourceline = LoadLine(READUINT32(save_p)); ht->sector = LoadSector(READUINT32(save_p)); @@ -2510,8 +2958,11 @@ static inline void LoadLightlevelThinker(actionf_p1 thinker) lightlevel_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; ht->sector = LoadSector(READUINT32(save_p)); - ht->destlevel = READINT32(save_p); - ht->speed = READINT32(save_p); + ht->sourcelevel = READINT16(save_p); + ht->destlevel = READINT16(save_p); + ht->fixedcurlevel = READFIXED(save_p); + ht->fixedpertic = READFIXED(save_p); + ht->timer = READINT32(save_p); if (ht->sector) ht->sector->lightingdata = ht; P_AddThinker(&ht->thinker); @@ -2552,6 +3003,72 @@ static inline void LoadDisappearThinker(actionf_p1 thinker) P_AddThinker(&ht->thinker); } +// +// LoadFadeThinker +// +// Loads a fade_t thinker +// +static inline void LoadFadeThinker(actionf_p1 thinker) +{ + sector_t *ss; + fade_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); + ht->thinker.function.acp1 = thinker; + ht->dest_exc = GetNetColormapFromList(READUINT32(save_p)); + ht->sectornum = READUINT32(save_p); + ht->ffloornum = READUINT32(save_p); + ht->alpha = READINT32(save_p); + ht->sourcevalue = READINT16(save_p); + ht->destvalue = READINT16(save_p); + ht->destlightlevel = READINT16(save_p); + ht->speed = READINT16(save_p); + ht->ticbased = (boolean)READUINT8(save_p); + ht->timer = READINT32(save_p); + ht->doexists = READUINT8(save_p); + ht->dotranslucent = READUINT8(save_p); + ht->dolighting = READUINT8(save_p); + ht->docolormap = READUINT8(save_p); + ht->docollision = READUINT8(save_p); + ht->doghostfade = READUINT8(save_p); + ht->exactalpha = READUINT8(save_p); + + ss = LoadSector(ht->sectornum); + if (ss) + { + size_t j = 0; // ss->ffloors is saved as ffloor #0, ss->ffloors->next is #1, etc + ffloor_t *rover; + for (rover = ss->ffloors; rover; rover = rover->next) + { + if (j == ht->ffloornum) + { + ht->rover = rover; + rover->fadingdata = ht; + break; + } + j++; + } + } + P_AddThinker(&ht->thinker); +} + +// LoadFadeColormapThinker +// +// Loads a fadecolormap_t from a save game +// +static inline void LoadFadeColormapThinker(actionf_p1 thinker) +{ + fadecolormap_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); + ht->thinker.function.acp1 = thinker; + ht->sector = LoadSector(READUINT32(save_p)); + ht->source_exc = GetNetColormapFromList(READUINT32(save_p)); + ht->dest_exc = GetNetColormapFromList(READUINT32(save_p)); + ht->ticbased = (boolean)READUINT8(save_p); + ht->duration = READINT32(save_p); + ht->timer = READINT32(save_p); + if (ht->sector) + ht->sector->fadecolormapdata = ht; + P_AddThinker(&ht->thinker); +} + // // LoadPlaneDisplaceThinker // @@ -2689,6 +3206,26 @@ static inline void LoadPolydisplaceThinker(actionf_p1 thinker) ht->oldHeights = READFIXED(save_p); P_AddThinker(&ht->thinker); } + +// +// LoadPolyfadeThinker +// +// Loads a polyfadet_t thinker +// +static void LoadPolyfadeThinker(actionf_p1 thinker) +{ + polyfade_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); + ht->thinker.function.acp1 = thinker; + ht->polyObjNum = READINT32(save_p); + ht->sourcevalue = READINT32(save_p); + ht->destvalue = READINT32(save_p); + ht->docollision = (boolean)READUINT8(save_p); + ht->doghostfade = (boolean)READUINT8(save_p); + ht->ticbased = (boolean)READUINT8(save_p); + ht->duration = READINT32(save_p); + ht->timer = READINT32(save_p); + P_AddThinker(&ht->thinker); +} #endif /* @@ -2738,7 +3275,7 @@ static void P_NetUnArchiveThinkers(void) // clear sector thinker pointers so they don't point to non-existant thinkers for all of eternity for (i = 0; i < numsectors; i++) { - sectors[i].floordata = sectors[i].ceilingdata = sectors[i].lightingdata = NULL; + sectors[i].floordata = sectors[i].ceilingdata = sectors[i].lightingdata = sectors[i].fadecolormapdata = NULL; } // read in saved thinkers @@ -2826,6 +3363,10 @@ static void P_NetUnArchiveThinkers(void) LoadSpecialLevelThinker((actionf_p1)T_MarioBlock, 3); break; + case tc_marioblockchecker: + LoadSpecialLevelThinker((actionf_p1)T_MarioBlockChecker, 0); + break; + case tc_spikesector: LoadSpecialLevelThinker((actionf_p1)T_SpikeSector, 0); break; @@ -2855,6 +3396,14 @@ static void P_NetUnArchiveThinkers(void) LoadDisappearThinker((actionf_p1)T_Disappear); break; + case tc_fade: + LoadFadeThinker((actionf_p1)T_Fade); + break; + + case tc_fadecolormap: + LoadFadeColormapThinker((actionf_p1)T_FadeColormap); + break; + case tc_planedisplace: LoadPlaneDisplaceThinker((actionf_p1)T_PlaneDisplace); break; @@ -2886,6 +3435,10 @@ static void P_NetUnArchiveThinkers(void) case tc_polydisplace: LoadPolydisplaceThinker((actionf_p1)T_PolyObjDisplace); break; + + case tc_polyfade: + LoadPolyfadeThinker((actionf_p1)T_PolyObjFade); + break; #endif case tc_scroll: LoadScrollThinker((actionf_p1)T_Scroll); @@ -3438,6 +3991,7 @@ void P_SaveNetGame(void) #endif P_NetArchiveThinkers(); P_NetArchiveSpecials(); + P_NetArchiveColormaps(); } #ifdef HAVE_BLUA LUA_Archive(); @@ -3480,6 +4034,7 @@ boolean P_LoadNetGame(void) #endif P_NetUnArchiveThinkers(); P_NetUnArchiveSpecials(); + P_NetUnArchiveColormaps(); P_RelinkPointers(); P_FinishMobjs(); } diff --git a/src/p_setup.c b/src/p_setup.c index e4011d79a..8d8f184c6 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -682,6 +682,7 @@ static void P_LoadRawSectors(UINT8 *data, size_t i) ss->ceilingpic = P_AddLevelFlat(ms->ceilingpic, foundflats); ss->lightlevel = SHORT(ms->lightlevel); + ss->spawn_lightlevel = SHORT(ms->lightlevel); ss->special = SHORT(ms->special); ss->tag = SHORT(ms->tag); ss->nexttag = ss->firsttag = -1; @@ -717,12 +718,12 @@ static void P_LoadRawSectors(UINT8 *data, size_t i) ss->moved = true; ss->extra_colormap = NULL; + ss->spawn_extra_colormap = NULL; ss->floor_xoffs = ss->ceiling_xoffs = ss->floor_yoffs = ss->ceiling_yoffs = 0; ss->spawn_flr_xoffs = ss->spawn_ceil_xoffs = ss->spawn_flr_yoffs = ss->spawn_ceil_yoffs = 0; ss->floorpic_angle = ss->ceilingpic_angle = 0; ss->spawn_flrpic_angle = ss->spawn_ceilpic_angle = 0; - ss->bottommap = ss->midmap = ss->topmap = -1; ss->gravity = NULL; ss->cullheight = NULL; ss->verticalflip = false; @@ -1335,7 +1336,8 @@ static void P_LoadLineDefs2(void) ld->backsector = ld->sidenum[1] != 0xffff ? sides[ld->sidenum[1]].sector : 0; // Repeat count for midtexture - if ((ld->flags & ML_EFFECT5) && (ld->sidenum[1] != 0xffff)) + if ((ld->flags & ML_EFFECT5) && (ld->sidenum[1] != 0xffff) + && !(ld->special >= 300 && ld->special < 500)) // exempt linedef exec specials { sides[ld->sidenum[0]].repeatcnt = (INT16)(((unsigned)sides[ld->sidenum[0]].textureoffset >> FRACBITS) >> 12); sides[ld->sidenum[0]].textureoffset = (((unsigned)sides[ld->sidenum[0]].textureoffset >> FRACBITS) & 2047) << FRACBITS; @@ -1442,7 +1444,6 @@ static inline void P_LoadSideDefs(lumpnum_t lumpnum) static void P_LoadRawSideDefs2(void *data) { UINT16 i; - INT32 num; for (i = 0; i < numsides; i++) { @@ -1464,117 +1465,23 @@ static void P_LoadRawSideDefs2(void *data) sd->sector = sec = §ors[sector_num]; } - // refined to allow colormaps to work as wall textures if invalid as colormaps - // but valid as textures. - sd->sector = sec = §ors[SHORT(msd->sector)]; + sd->colormap_data = NULL; + // Colormaps! switch (sd->special) { case 63: // variable colormap via 242 linedef case 606: //SoM: 4/4/2000: Just colormap transfer + case 447: // Change colormap of tagged sectors! -- Monster Iestyn 14/06/18 + case 455: // Fade colormaps! mazmazz 9/12/2018 (:flag_us:) // SoM: R_CreateColormap will only create a colormap in software mode... // Perhaps we should just call it instead of doing the calculations here. - if (rendermode == render_soft || rendermode == render_none) - { - if (msd->toptexture[0] == '#' || msd->bottomtexture[0] == '#') - { - sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture, - msd->bottomtexture); - sd->toptexture = sd->bottomtexture = 0; - } - else - { - if ((num = R_CheckTextureNumForName(msd->toptexture)) == -1) - sd->toptexture = 0; - else - sd->toptexture = num; - if ((num = R_CheckTextureNumForName(msd->midtexture)) == -1) - sd->midtexture = 0; - else - sd->midtexture = num; - if ((num = R_CheckTextureNumForName(msd->bottomtexture)) == -1) - sd->bottomtexture = 0; - else - sd->bottomtexture = num; - } - break; - } -#ifdef HWRENDER - else - { - // for now, full support of toptexture only - if ((msd->toptexture[0] == '#' && msd->toptexture[1] && msd->toptexture[2] && msd->toptexture[3] && msd->toptexture[4] && msd->toptexture[5] && msd->toptexture[6]) - || (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6])) - { - char *col; - - sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture, - msd->bottomtexture); - sd->toptexture = sd->bottomtexture = 0; -#define HEX2INT(x) (x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0) -#define ALPHA2INT(x) (x >= 'a' && x <= 'z' ? x - 'a' : x >= 'A' && x <= 'Z' ? x - 'A' : x >= '0' && x <= '9' ? 25 : 0) - sec->extra_colormap = &extra_colormaps[sec->midmap]; - - if (msd->toptexture[0] == '#' && msd->toptexture[1] && msd->toptexture[2] && msd->toptexture[3] && msd->toptexture[4] && msd->toptexture[5] && msd->toptexture[6]) - { - col = msd->toptexture; - - sec->extra_colormap->rgba = - (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) + - (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) + - (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16); - - // alpha - if (msd->toptexture[7]) - sec->extra_colormap->rgba += (ALPHA2INT(col[7]) << 24); - else - sec->extra_colormap->rgba += (25 << 24); - } - else - sec->extra_colormap->rgba = 0; - - if (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6]) - { - col = msd->bottomtexture; - - sec->extra_colormap->fadergba = - (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) + - (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) + - (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16); - - // alpha - if (msd->bottomtexture[7]) - sec->extra_colormap->fadergba += (ALPHA2INT(col[7]) << 24); - else - sec->extra_colormap->fadergba += (25 << 24); - } - else - sec->extra_colormap->fadergba = 0x19000000; // default alpha, (25 << 24) -#undef ALPHA2INT -#undef HEX2INT - } - else - { - if ((num = R_CheckTextureNumForName(msd->toptexture)) == -1) - sd->toptexture = 0; - else - sd->toptexture = num; - - if ((num = R_CheckTextureNumForName(msd->midtexture)) == -1) - sd->midtexture = 0; - else - sd->midtexture = num; - - if ((num = R_CheckTextureNumForName(msd->bottomtexture)) == -1) - sd->bottomtexture = 0; - else - sd->bottomtexture = num; - } - break; - } -#endif + sd->colormap_data = R_CreateColormap(msd->toptexture, msd->midtexture, + msd->bottomtexture); + sd->toptexture = sd->midtexture = sd->bottomtexture = 0; + break; case 413: // Change music { @@ -1638,6 +1545,7 @@ static void P_LoadRawSideDefs2(void *data) } case 443: // Calls a named Lua function + case 459: // Control text prompt (named tag) { char process[8*3+1]; memset(process,0,8*3+1); @@ -2691,6 +2599,43 @@ static void P_LoadNightsGhosts(void) free(gpath); } +static void P_SetupCamera(void) +{ + if (players[displayplayer].mo && (server || addedtogame)) + { + camera.x = players[displayplayer].mo->x; + camera.y = players[displayplayer].mo->y; + camera.z = players[displayplayer].mo->z; + camera.angle = players[displayplayer].mo->angle; + camera.subsector = R_PointInSubsector(camera.x, camera.y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18) + } + else + { + mapthing_t *thing; + + switch (gametype) + { + case GT_MATCH: + case GT_TAG: + thing = deathmatchstarts[0]; + break; + + default: + thing = playerstarts[0]; + break; + } + + if (thing) + { + camera.x = thing->x; + camera.y = thing->y; + camera.z = thing->z; + camera.angle = FixedAngle((fixed_t)thing->angle << FRACBITS); + camera.subsector = R_PointInSubsector(camera.x, camera.y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18) + } + } +} + static boolean CanSaveLevel(INT32 mapnum) { if (ultimatemode) // never save in ultimate (probably redundant with cursaveslot also being checked) @@ -2863,6 +2808,9 @@ boolean P_SetupLevel(boolean skipprecip) levelfadecol = (ranspecialwipe) ? 0 : 31; + // Close text prompt before freeing the old level + F_EndTextPrompt(false, true); + #ifdef HAVE_BLUA LUA_InvalidateLevel(); #endif @@ -2954,7 +2902,6 @@ boolean P_SetupLevel(boolean skipprecip) // Important: take care of the ordering of the next functions. if (!loadedbm) P_CreateBlockMap(); // Graue 02-29-2004 - R_MakeColormaps(); P_LoadLineDefs2(); P_GroupLines(); numdmstarts = numredctfstarts = numbluectfstarts = 0; @@ -2991,7 +2938,6 @@ boolean P_SetupLevel(boolean skipprecip) // Important: take care of the ordering of the next functions. if (!loadedbm) P_CreateBlockMap(); // Graue 02-29-2004 - R_MakeColormaps(); P_LoadLineDefs2(); P_GroupLines(); numdmstarts = numredctfstarts = numbluectfstarts = 0; @@ -3146,37 +3092,7 @@ boolean P_SetupLevel(boolean skipprecip) if (!dedicated) { - if (players[displayplayer].mo && (server || addedtogame)) - { - camera.x = players[displayplayer].mo->x; - camera.y = players[displayplayer].mo->y; - camera.z = players[displayplayer].mo->z; - camera.angle = players[displayplayer].mo->angle; - } - else - { - mapthing_t *thing; - - switch (gametype) - { - case GT_MATCH: - case GT_TAG: - thing = deathmatchstarts[0]; - break; - - default: - thing = playerstarts[0]; - break; - } - - if (thing) - { - camera.x = thing->x; - camera.y = thing->y; - camera.z = thing->z; - camera.angle = FixedAngle((fixed_t)thing->angle << FRACBITS); - } - } + P_SetupCamera(); // Salt: CV_ClearChangedFlags() messes with your settings :( /*if (!cv_cam_height.changed) diff --git a/src/p_slopes.c b/src/p_slopes.c index 7c84a2db5..b7cd597aa 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -29,7 +29,7 @@ static pslope_t *slopelist = NULL; static UINT16 slopecount = 0; // Calculate line normal -static void P_CalculateSlopeNormal(pslope_t *slope) { +void P_CalculateSlopeNormal(pslope_t *slope) { slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT); slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x); slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y); diff --git a/src/p_slopes.h b/src/p_slopes.h index f59c5b767..252bbdb3c 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -14,6 +14,7 @@ #define P_SLOPES_H__ #ifdef ESLOPE +void P_CalculateSlopeNormal(pslope_t *slope); void P_ResetDynamicSlopes(void); void P_RunDynamicSlopes(void); // P_SpawnSlope_Line diff --git a/src/p_spec.c b/src/p_spec.c index 1d842a0bb..18a831073 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -35,6 +35,7 @@ #include "m_misc.h" #include "m_cond.h" //unlock triggers #include "lua_hook.h" // LUAh_LinedefExecute +#include "f_finale.h" // control text prompt #ifdef HW3SOUND #include "hardware/hw3sound.h" @@ -103,6 +104,18 @@ static void P_SpawnFriction(void); static void P_SpawnPushers(void); static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t *source, INT32 affectee, INT32 referrer, INT32 exclusive, INT32 slider); //SoM: 3/9/2000 static void Add_MasterDisappearer(tic_t appeartime, tic_t disappeartime, tic_t offset, INT32 line, INT32 sourceline); +static void P_ResetFakeFloorFader(ffloor_t *rover, fade_t *data, boolean finalize); +#define P_RemoveFakeFloorFader(l) P_ResetFakeFloorFader(l, NULL, false); +static boolean P_FadeFakeFloor(ffloor_t *rover, INT16 sourcevalue, INT16 destvalue, INT16 speed, boolean ticbased, INT32 *timer, + boolean doexists, boolean dotranslucent, boolean dolighting, boolean docolormap, + boolean docollision, boolean doghostfade, boolean exactalpha); +static void P_AddFakeFloorFader(ffloor_t *rover, size_t sectornum, size_t ffloornum, + INT16 destvalue, INT16 speed, boolean ticbased, boolean relative, + boolean doexists, boolean dotranslucent, boolean dolighting, boolean docolormap, + boolean docollision, boolean doghostfade, boolean exactalpha); +static void P_ResetColormapFader(sector_t *sector); +static void Add_ColormapFader(sector_t *sector, extracolormap_t *source_exc, extracolormap_t *dest_exc, + boolean ticbased, INT32 duration); static void P_AddBlockThinker(sector_t *sec, line_t *sourceline); static void P_AddFloatThinker(sector_t *sec, INT32 tag, line_t *sourceline); //static void P_AddBridgeThinker(line_t *sourceline, sector_t *sec); @@ -1218,7 +1231,7 @@ static void PolyVisible(line_t *line) po->flags |= POF_SOLID; po->flags &= ~POF_NOSPECIALS; - po->flags |= POF_RENDERALL; + po->flags |= (po->spawnflags & POF_RENDERALL); } // @@ -1242,7 +1255,94 @@ static void PolyTranslucency(line_t *line) if (po->isBad) return; - po->translucency = (line->frontsector->floorheight >> FRACBITS) / 100; + // if DONTPEGBOTTOM, specify raw translucency value in Front X Offset + // else, take it out of 1000. If Front X Offset is specified, use that. Else, use floorheight. + if (line->flags & ML_EFFECT3) // relative calc + po->translucency = max(min(po->translucency + ((line->flags & ML_DONTPEGBOTTOM) ? + (sides[line->sidenum[0]].textureoffset ? + max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, NUMTRANSMAPS), -NUMTRANSMAPS) + : max(min(line->frontsector->floorheight>>FRACBITS, NUMTRANSMAPS), -NUMTRANSMAPS)) + : (sides[line->sidenum[0]].textureoffset ? + max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, 1000), -1000) / 100 + : max(min(line->frontsector->floorheight>>FRACBITS, 1000), -1000) / 100)), + NUMTRANSMAPS), 0); + else + po->translucency = (line->flags & ML_DONTPEGBOTTOM) ? + (sides[line->sidenum[0]].textureoffset ? + max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, NUMTRANSMAPS), 0) + : max(min(line->frontsector->floorheight>>FRACBITS, NUMTRANSMAPS), 0)) + : (sides[line->sidenum[0]].textureoffset ? + max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, 1000), 0) / 100 + : max(min(line->frontsector->floorheight>>FRACBITS, 1000), 0) / 100); +} + +// +// PolyFade +// +// Makes a polyobject translucency fade and applies tangibility +// +static boolean PolyFade(line_t *line) +{ + INT32 polyObjNum = line->tag; + polyobj_t *po; + polyfadedata_t pfd; + + if (!(po = Polyobj_GetForNum(polyObjNum))) + { + CONS_Debug(DBG_POLYOBJ, "PolyFade: bad polyobj %d\n", polyObjNum); + return 0; + } + + // don't allow line actions to affect bad polyobjects + if (po->isBad) + return 0; + + // Prevent continuous execs from interfering on an existing fade + if (!(line->flags & ML_EFFECT5) + && po->thinker + && po->thinker->function.acp1 == (actionf_p1)T_PolyObjFade) + { + CONS_Debug(DBG_POLYOBJ, "Line type 492 Executor: Fade PolyObject thinker already exists\n"); + return 0; + } + + pfd.polyObjNum = polyObjNum; + + // if DONTPEGBOTTOM, specify raw translucency value in Front X Offset + // else, take it out of 1000. If Front X Offset is specified, use that. Else, use floorheight. + if (line->flags & ML_EFFECT3) // relative calc + pfd.destvalue = max(min(po->translucency + ((line->flags & ML_DONTPEGBOTTOM) ? + (sides[line->sidenum[0]].textureoffset ? + max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, NUMTRANSMAPS), -NUMTRANSMAPS) + : max(min(line->frontsector->floorheight>>FRACBITS, NUMTRANSMAPS), -NUMTRANSMAPS)) + : (sides[line->sidenum[0]].textureoffset ? + max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, 1000), -1000) / 100 + : max(min(line->frontsector->floorheight>>FRACBITS, 1000), -1000) / 100)), + NUMTRANSMAPS), 0); + else + pfd.destvalue = (line->flags & ML_DONTPEGBOTTOM) ? + (sides[line->sidenum[0]].textureoffset ? + max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, NUMTRANSMAPS), 0) + : max(min(line->frontsector->floorheight>>FRACBITS, NUMTRANSMAPS), 0)) + : (sides[line->sidenum[0]].textureoffset ? + max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, 1000), 0) / 100 + : max(min(line->frontsector->floorheight>>FRACBITS, 1000), 0) / 100); + + // already equal, nothing to do + if (po->translucency == pfd.destvalue) + return 1; + + pfd.docollision = !(line->flags & ML_BOUNCY); // do not handle collision flags + pfd.doghostfade = (line->flags & ML_EFFECT1); // do ghost fade (no collision flags during fade) + pfd.ticbased = (line->flags & ML_EFFECT4); // Speed = Tic Duration + + // allow Back Y Offset to be consistent with other fade specials + pfd.speed = (line->sidenum[1] != 0xFFFF && !sides[line->sidenum[0]].rowoffset) ? + abs(sides[line->sidenum[1]].rowoffset>>FRACBITS) + : abs(sides[line->sidenum[0]].rowoffset>>FRACBITS); + + + return EV_DoPolyObjFade(&pfd); } // @@ -1375,6 +1475,67 @@ void P_ChangeSectorTag(UINT32 sector, INT16 newtag) } } +// +// P_RunNightserizeExecutors +// +void P_RunNightserizeExecutors(mobj_t *actor) +{ + size_t i; + + for (i = 0; i < numlines; i++) + { + if (lines[i].special == 323 || lines[i].special == 324) + P_RunTriggerLinedef(&lines[i], actor, NULL); + } +} + +// +// P_RunDeNightserizeExecutors +// +void P_RunDeNightserizeExecutors(mobj_t *actor) +{ + size_t i; + + for (i = 0; i < numlines; i++) + { + if (lines[i].special == 325 || lines[i].special == 326) + P_RunTriggerLinedef(&lines[i], actor, NULL); + } +} + +// +// P_RunNightsLapExecutors +// +void P_RunNightsLapExecutors(mobj_t *actor) +{ + size_t i; + + for (i = 0; i < numlines; i++) + { + if (lines[i].special == 327 || lines[i].special == 328) + P_RunTriggerLinedef(&lines[i], actor, NULL); + } +} + +// +// P_RunNightsCapsuleTouchExecutors +// +void P_RunNightsCapsuleTouchExecutors(mobj_t *actor, boolean entering, boolean enoughspheres) +{ + size_t i; + + for (i = 0; i < numlines; i++) + { + if ((lines[i].special == 329 || lines[i].special == 330) + && ((entering && (lines[i].flags & ML_TFERLINE)) + || (!entering && !(lines[i].flags & ML_TFERLINE))) + && ((lines[i].flags & ML_DONTPEGTOP) + || (enoughspheres && !(lines[i].flags & ML_BOUNCY)) + || (!enoughspheres && (lines[i].flags & ML_BOUNCY)))) + P_RunTriggerLinedef(&lines[i], actor, NULL); + } +} + /** Hashes the sector tags across the sectors and linedefs. * * \sa P_FindSectorFromTag, P_ChangeSectorTag @@ -1458,6 +1619,146 @@ static void P_AddExecutorDelay(line_t *line, mobj_t *mobj, sector_t *sector) P_AddThinker(&e->thinker); } +/** Used by P_RunTriggerLinedef to check a NiGHTS trigger linedef's conditions + * + * \param triggerline Trigger linedef to check conditions for; should NEVER be NULL. + * \param actor Object initiating the action; should not be NULL. + * \sa P_RunTriggerLinedef + */ +static boolean P_CheckNightsTriggerLine(line_t *triggerline, mobj_t *actor) +{ + INT16 specialtype = triggerline->special; + size_t i; + + UINT8 inputmare = max(0, min(255, sides[triggerline->sidenum[0]].textureoffset>>FRACBITS)); + UINT8 inputlap = max(0, min(255, sides[triggerline->sidenum[0]].rowoffset>>FRACBITS)); + + boolean ltemare = triggerline->flags & ML_NOCLIMB; + boolean gtemare = triggerline->flags & ML_BLOCKMONSTERS; + boolean ltelap = triggerline->flags & ML_EFFECT1; + boolean gtelap = triggerline->flags & ML_EFFECT2; + + boolean lapfrombonustime = triggerline->flags & ML_EFFECT3; + boolean perglobalinverse = triggerline->flags & ML_DONTPEGBOTTOM; + boolean perglobal = !(triggerline->flags & ML_EFFECT4) && !perglobalinverse; + + boolean donomares = triggerline->flags & ML_BOUNCY; // nightserize: run at end of level (no mares) + boolean fromnonights = triggerline->flags & ML_TFERLINE; // nightserize: from non-nights // denightserize: all players no nights + boolean fromnights = triggerline->flags & ML_DONTPEGTOP; // nightserize: from nights // denightserize: >0 players are nights + + UINT8 currentmare = UINT8_MAX; + UINT8 currentlap = UINT8_MAX; + + // Do early returns for Nightserize + if (specialtype >= 323 && specialtype <= 324) + { + // run only when no mares are found + if (donomares && P_FindLowestMare() != UINT8_MAX) + return false; + + // run only if there is a mare present + if (!donomares && P_FindLowestMare() == UINT8_MAX) + return false; + + // run only if player is nightserizing from non-nights + if (fromnonights) + { + if (!actor->player) + return false; + else if (actor->player->powers[pw_carry] == CR_NIGHTSMODE) + return false; + } + // run only if player is nightserizing from nights + else if (fromnights) + { + if (!actor->player) + return false; + else if (actor->player->powers[pw_carry] != CR_NIGHTSMODE) + return false; + } + } + + // Get current mare and lap (and check early return for DeNightserize) + if (perglobal || perglobalinverse + || (specialtype >= 325 && specialtype <= 326 && (fromnonights || fromnights))) + { + UINT8 playersarenights = 0; + + for (i = 0; i < MAXPLAYERS; i++) + { + UINT8 lap; + if (!playeringame[i] || players[i].spectator) + continue; + + // denightserize: run only if all players are not nights + if (specialtype >= 325 && specialtype <= 326 && fromnonights + && players[i].powers[pw_carry] == CR_NIGHTSMODE) + return false; + + // count number of nights players for denightserize return + if (specialtype >= 325 && specialtype <= 326 && fromnights + && players[i].powers[pw_carry] == CR_NIGHTSMODE) + playersarenights++; + + lap = lapfrombonustime ? players[i].marebonuslap : players[i].marelap; + + // get highest mare/lap of players + if (perglobal) + { + if (players[i].mare > currentmare || currentmare == UINT8_MAX) + { + currentmare = players[i].mare; + currentlap = UINT8_MAX; + } + if (players[i].mare == currentmare + && (lap > currentlap || currentlap == UINT8_MAX)) + currentlap = lap; + } + // get lowest mare/lap of players + else if (perglobalinverse) + { + if (players[i].mare < currentmare || currentmare == UINT8_MAX) + { + currentmare = players[i].mare; + currentlap = UINT8_MAX; + } + if (players[i].mare == currentmare + && (lap < currentlap || currentlap == UINT8_MAX)) + currentlap = lap; + } + } + + // denightserize: run only if >0 players are nights + if (specialtype >= 325 && specialtype <= 326 && fromnights + && playersarenights < 1) + return false; + } + // get current mare/lap from triggering player + else if (!perglobal && !perglobalinverse) + { + if (!actor->player) + return false; + currentmare = actor->player->mare; + currentlap = lapfrombonustime ? actor->player->marebonuslap : actor->player->marelap; + } + + if (lapfrombonustime && !currentlap) + return false; // special case: player->marebonuslap is 0 until passing through on bonus time. Don't trigger lines looking for inputlap 0. + + // Compare current mare/lap to input mare/lap based on rules + if (!(specialtype >= 323 && specialtype <= 324 && donomares) // don't return false if donomares and we got this far + && ((ltemare && currentmare > inputmare) + || (gtemare && currentmare < inputmare) + || (!ltemare && !gtemare && currentmare != inputmare) + || (ltelap && currentlap > inputlap) + || (gtelap && currentlap < inputlap) + || (!ltelap && !gtelap && currentlap != inputlap)) + ) + return false; + + return true; +} + /** Used by P_LinedefExecute to check a trigger linedef's conditions * The linedef executor specials in the trigger linedef's sector are run if all conditions are met. * Return false cancels P_LinedefExecute, this happens if a condition is not met. @@ -1668,6 +1969,18 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller return false; } break; + case 323: // nightserize - each time + case 324: // nightserize - once + case 325: // denightserize - each time + case 326: // denightserize - once + case 327: // nights lap - each time + case 328: // nights lap - once + case 329: // nights egg capsule touch - each time + case 330: // nights egg capsule touch - once + if (!P_CheckNightsTriggerLine(triggerline, actor)) + return false; + break; + default: break; } @@ -1796,6 +2109,10 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller || specialtype == 318 // Unlockable trigger - Once || specialtype == 320 // Unlockable - Once || specialtype == 321 || specialtype == 322 // Trigger on X calls - Continuous + Each Time + || specialtype == 324 // Nightserize - Once + || specialtype == 326 // DeNightserize - Once + || specialtype == 328 // Nights lap - Once + || specialtype == 330 // Nights Bonus Time - Once || specialtype == 399) // Level Load triggerline->special = 0; // Clear it out @@ -1910,8 +2227,7 @@ void P_SwitchWeather(INT32 weathernum) for (think = thinkercap.next; think != &thinkercap; think = think->next) { - if ((think->function.acp1 != (actionf_p1)P_SnowThinker) - && (think->function.acp1 != (actionf_p1)P_RainThinker)) + if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) continue; // not a precipmobj thinker precipmobj = (precipmobj_t *)think; @@ -1927,14 +2243,12 @@ void P_SwitchWeather(INT32 weathernum) for (think = thinkercap.next; think != &thinkercap; think = think->next) { + if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) + continue; // not a precipmobj thinker + precipmobj = (precipmobj_t *)think; + if (swap == PRECIP_RAIN) // Snow To Rain { - if (!(think->function.acp1 == (actionf_p1)P_SnowThinker - || think->function.acp1 == (actionf_p1)P_NullPrecipThinker)) - continue; // not a precipmobj thinker - - precipmobj = (precipmobj_t *)think; - precipmobj->flags = mobjinfo[MT_RAIN].flags; st = &states[mobjinfo[MT_RAIN].spawnstate]; precipmobj->state = st; @@ -1945,18 +2259,13 @@ void P_SwitchWeather(INT32 weathernum) precipmobj->precipflags &= ~PCF_INVISIBLE; - think->function.acp1 = (actionf_p1)P_RainThinker; + precipmobj->precipflags |= PCF_RAIN; + //think->function.acp1 = (actionf_p1)P_RainThinker; } else if (swap == PRECIP_SNOW) // Rain To Snow { INT32 z; - if (!(think->function.acp1 == (actionf_p1)P_RainThinker - || think->function.acp1 == (actionf_p1)P_NullPrecipThinker)) - continue; // not a precipmobj thinker - - precipmobj = (precipmobj_t *)think; - precipmobj->flags = mobjinfo[MT_SNOWFLAKE].flags; z = M_RandomByte(); @@ -1974,19 +2283,13 @@ void P_SwitchWeather(INT32 weathernum) precipmobj->frame = st->frame; precipmobj->momz = mobjinfo[MT_SNOWFLAKE].speed; - precipmobj->precipflags &= ~PCF_INVISIBLE; + precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_RAIN); - think->function.acp1 = (actionf_p1)P_SnowThinker; + //think->function.acp1 = (actionf_p1)P_SnowThinker; } else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse. { - if (!(think->function.acp1 == (actionf_p1)P_RainThinker - || think->function.acp1 == (actionf_p1)P_SnowThinker)) - continue; - - precipmobj = (precipmobj_t *)think; - - think->function.acp1 = (actionf_p1)P_NullPrecipThinker; + //think->function.acp1 = (actionf_p1)P_NullPrecipThinker; precipmobj->precipflags |= PCF_INVISIBLE; } @@ -2561,7 +2864,17 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; case 420: // Fade light levels in tagged sectors to new value - P_FadeLight(line->tag, line->frontsector->lightlevel, P_AproxDistance(line->dx, line->dy)>>FRACBITS); + P_FadeLight(line->tag, + (line->flags & ML_DONTPEGBOTTOM) ? max(sides[line->sidenum[0]].textureoffset>>FRACBITS, 0) : line->frontsector->lightlevel, + // failsafe: if user specifies Back Y Offset and NOT Front Y Offset, use the Back Offset + // to be consistent with other light and fade specials + (line->flags & ML_DONTPEGBOTTOM) ? + ((line->sidenum[1] != 0xFFFF && !(sides[line->sidenum[0]].rowoffset>>FRACBITS)) ? + max(min(sides[line->sidenum[1]].rowoffset>>FRACBITS, 255), 0) + : max(min(sides[line->sidenum[0]].rowoffset>>FRACBITS, 255), 0)) + : abs(P_AproxDistance(line->dx, line->dy))>>FRACBITS, + (line->flags & ML_EFFECT4), + (line->flags & ML_EFFECT5)); break; case 421: // Stop lighting effect in tagged sectors @@ -2765,6 +3078,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to crumble + boolean foundrover = false; // for debug, "Can't find a FOF" message for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;) { @@ -2779,16 +3093,18 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) for (rover = sec->ffloors; rover; rover = rover->next) { if (rover->master->frontsector->tag == foftag) - break; + { + foundrover = true; + + EV_CrumbleChain(sec, rover); + } } - if (!rover) + if (!foundrover) { CONS_Debug(DBG_GAMELOGIC, "Line type 436 Executor: Can't find a FOF control sector with tag %d\n", foftag); return; } - - EV_CrumbleChain(sec, rover); } } break; @@ -2949,6 +3265,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); sector_t *sec; // Sector that the FOF is visible (or not visible) in ffloor_t *rover; // FOF to vanish/un-vanish + boolean foundrover = false; // for debug, "Can't find a FOF" message ffloortype_e oldflags; // store FOF's old flags for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;) @@ -2964,26 +3281,28 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) for (rover = sec->ffloors; rover; rover = rover->next) { if (rover->master->frontsector->tag == foftag) - break; + { + foundrover = true; + + oldflags = rover->flags; + + // Abracadabra! + if (line->flags & ML_NOCLIMB) + rover->flags |= FF_EXISTS; + else + rover->flags &= ~FF_EXISTS; + + // if flags changed, reset sector's light list + if (rover->flags != oldflags) + sec->moved = true; + } } - if (!rover) + if (!foundrover) { CONS_Debug(DBG_GAMELOGIC, "Line type 445 Executor: Can't find a FOF control sector with tag %d\n", foftag); return; } - - oldflags = rover->flags; - - // Abracadabra! - if (line->flags & ML_NOCLIMB) - rover->flags |= FF_EXISTS; - else - rover->flags &= ~FF_EXISTS; - - // if flags changed, reset sector's light list - if (rover->flags != oldflags) - sec->moved = true; } } break; @@ -2994,6 +3313,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); sector_t *sec; // Sector that the FOF is visible in ffloor_t *rover; // FOF that we are going to make fall down + boolean foundrover = false; // for debug, "Can't find a FOF" message player_t *player = NULL; // player that caused FOF to fall boolean respawn = true; // should the fallen FOF respawn? @@ -3016,23 +3336,85 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) for (rover = sec->ffloors; rover; rover = rover->next) { if (rover->master->frontsector->tag == foftag) - break; + { + foundrover = true; + + if (line->flags & ML_BLOCKMONSTERS) // FOF flags determine respawn ability instead? + respawn = !(rover->flags & FF_NORETURN) ^ !!(line->flags & ML_NOCLIMB); // no climb inverts + + EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, respawn); + } } - if (!rover) + if (!foundrover) { CONS_Debug(DBG_GAMELOGIC, "Line type 446 Executor: Can't find a FOF control sector with tag %d\n", foftag); return; } - - if (line->flags & ML_BLOCKMONSTERS) // FOF flags determine respawn ability instead? - respawn = !(rover->flags & FF_NORETURN) ^ !!(line->flags & ML_NOCLIMB); // no climb inverts - - EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, respawn); } } break; + case 447: // Change colormap of tagged sectors! + // Basically this special applies a colormap to the tagged sectors, just like 606 (the colormap linedef) + // Except it is activated by linedef executor, not level load + // This could even override existing colormaps I believe + // -- Monster Iestyn 14/06/18 + for (secnum = -1; (secnum = P_FindSectorFromLineTag(line, secnum)) >= 0 ;) + { + P_ResetColormapFader(§ors[secnum]); + + if (line->flags & ML_EFFECT3) // relative calc + { + extracolormap_t *exc = R_AddColormaps( + (line->flags & ML_TFERLINE) && line->sidenum[1] != 0xFFFF ? + sides[line->sidenum[1]].colormap_data : sectors[secnum].extra_colormap, // use back colormap instead of target sector + sides[line->sidenum[0]].colormap_data, + line->flags & ML_EFFECT1, // subtract R + line->flags & ML_NOCLIMB, // subtract G + line->flags & ML_EFFECT2, // subtract B + false, // subtract A (no flag for this, just pass negative alpha) + line->flags & ML_EFFECT1, // subtract FadeR + line->flags & ML_NOCLIMB, // subtract FadeG + line->flags & ML_EFFECT2, // subtract FadeB + false, // subtract FadeA (no flag for this, just pass negative alpha) + false, // subtract FadeStart (we ran out of flags) + false, // subtract FadeEnd (we ran out of flags) + false, // ignore Fog (we ran out of flags) + line->flags & ML_DONTPEGBOTTOM, + (line->flags & ML_DONTPEGBOTTOM) ? (sides[line->sidenum[0]].textureoffset >> FRACBITS) : 0, + (line->flags & ML_DONTPEGBOTTOM) ? (sides[line->sidenum[0]].rowoffset >> FRACBITS) : 0, + false); + + if (!(sectors[secnum].extra_colormap = R_GetColormapFromList(exc))) + { + exc->colormap = R_CreateLightTable(exc); + R_AddColormapToList(exc); + sectors[secnum].extra_colormap = exc; + } + else + Z_Free(exc); + } + else if (line->flags & ML_DONTPEGBOTTOM) // alternate alpha (by texture offsets) + { + extracolormap_t *exc = R_CopyColormap(sides[line->sidenum[0]].colormap_data, false); + exc->rgba = R_GetRgbaRGB(exc->rgba) + R_PutRgbaA(max(min(sides[line->sidenum[0]].textureoffset >> FRACBITS, 25), 0)); + exc->fadergba = R_GetRgbaRGB(exc->fadergba) + R_PutRgbaA(max(min(sides[line->sidenum[0]].rowoffset >> FRACBITS, 25), 0)); + + if (!(sectors[secnum].extra_colormap = R_GetColormapFromList(exc))) + { + exc->colormap = R_CreateLightTable(exc); + R_AddColormapToList(exc); + sectors[secnum].extra_colormap = exc; + } + else + Z_Free(exc); + } + else + sectors[secnum].extra_colormap = sides[line->sidenum[0]].colormap_data; + } + break; + case 448: // Change skybox viewpoint/centerpoint if ((mo && mo->player && P_IsLocalPlayer(mo->player)) || (line->flags & ML_NOCLIMB)) { @@ -3093,6 +3475,351 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) break; } + case 452: // Set FOF alpha + { + INT16 destvalue = line->sidenum[1] != 0xffff ? + (INT16)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : (INT16)(P_AproxDistance(line->dx, line->dy)>>FRACBITS); + INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); + INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + sector_t *sec; // Sector that the FOF is visible in + ffloor_t *rover; // FOF that we are going to operate + boolean foundrover = false; // for debug, "Can't find a FOF" message + + for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;) + { + sec = sectors + secnum; + + if (!sec->ffloors) + { + CONS_Debug(DBG_GAMELOGIC, "Line type 452 Executor: Target sector #%d has no FOFs.\n", secnum); + return; + } + + for (rover = sec->ffloors; rover; rover = rover->next) + { + if (rover->master->frontsector->tag == foftag) + { + foundrover = true; + + // If fading an invisible FOF whose render flags we did not yet set, + // initialize its alpha to 1 + // for relative alpha calc + if (!(line->flags & ML_NOCLIMB) && // do translucent + (rover->spawnflags & FF_NOSHADE) && // do not include light blocks, which don't set FF_NOSHADE + !(rover->spawnflags & FF_RENDERSIDES) && + !(rover->spawnflags & FF_RENDERPLANES) && + !(rover->flags & FF_RENDERALL)) + rover->alpha = 1; + + P_RemoveFakeFloorFader(rover); + P_FadeFakeFloor(rover, + rover->alpha, + max(1, min(256, (line->flags & ML_EFFECT3) ? rover->alpha + destvalue : destvalue)), + 0, // set alpha immediately + false, NULL, // tic-based logic + false, // do not handle FF_EXISTS + !(line->flags & ML_NOCLIMB), // handle FF_TRANSLUCENT + false, // do not handle lighting + false, // do not handle colormap + false, // do not handle collision + false, // do not do ghost fade (no collision during fade) + true); // use exact alpha values (for opengl) + } + } + + if (!foundrover) + { + CONS_Debug(DBG_GAMELOGIC, "Line type 452 Executor: Can't find a FOF control sector with tag %d\n", foftag); + return; + } + } + break; + } + + case 453: // Fade FOF + { + INT16 destvalue = line->sidenum[1] != 0xffff ? + (INT16)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : (INT16)(line->dx>>FRACBITS); + INT16 speed = line->sidenum[1] != 0xffff ? + (INT16)(abs(sides[line->sidenum[1]].rowoffset>>FRACBITS)) : (INT16)(abs(line->dy)>>FRACBITS); + INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); + INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + sector_t *sec; // Sector that the FOF is visible in + ffloor_t *rover; // FOF that we are going to operate + boolean foundrover = false; // for debug, "Can't find a FOF" message + size_t j = 0; // sec->ffloors is saved as ffloor #0, ss->ffloors->next is #1, etc + + for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;) + { + sec = sectors + secnum; + + if (!sec->ffloors) + { + CONS_Debug(DBG_GAMELOGIC, "Line type 453 Executor: Target sector #%d has no FOFs.\n", secnum); + return; + } + + for (rover = sec->ffloors; rover; rover = rover->next) + { + if (rover->master->frontsector->tag == foftag) + { + foundrover = true; + + // Prevent continuous execs from interfering on an existing fade + if (!(line->flags & ML_EFFECT5) + && rover->fadingdata) + //&& ((fade_t*)rover->fadingdata)->timer > (ticbased ? 2 : speed*2)) + { + CONS_Debug(DBG_GAMELOGIC, "Line type 453 Executor: Fade FOF thinker already exists, timer: %d\n", ((fade_t*)rover->fadingdata)->timer); + continue; + } + + if (speed > 0) + P_AddFakeFloorFader(rover, secnum, j, + destvalue, + speed, + (line->flags & ML_EFFECT4), // tic-based logic + (line->flags & ML_EFFECT3), // Relative destvalue + !(line->flags & ML_BLOCKMONSTERS), // do not handle FF_EXISTS + !(line->flags & ML_NOCLIMB), // do not handle FF_TRANSLUCENT + !(line->flags & ML_EFFECT2), // do not handle lighting + !(line->flags & ML_EFFECT2), // do not handle colormap (ran out of flags) + !(line->flags & ML_BOUNCY), // do not handle collision + (line->flags & ML_EFFECT1), // do ghost fade (no collision during fade) + (line->flags & ML_TFERLINE)); // use exact alpha values (for opengl) + else + { + // If fading an invisible FOF whose render flags we did not yet set, + // initialize its alpha to 1 + // for relative alpha calc + if (!(line->flags & ML_NOCLIMB) && // do translucent + (rover->spawnflags & FF_NOSHADE) && // do not include light blocks, which don't set FF_NOSHADE + !(rover->spawnflags & FF_RENDERSIDES) && + !(rover->spawnflags & FF_RENDERPLANES) && + !(rover->flags & FF_RENDERALL)) + rover->alpha = 1; + + P_RemoveFakeFloorFader(rover); + P_FadeFakeFloor(rover, + rover->alpha, + max(1, min(256, (line->flags & ML_EFFECT3) ? rover->alpha + destvalue : destvalue)), + 0, // set alpha immediately + false, NULL, // tic-based logic + !(line->flags & ML_BLOCKMONSTERS), // do not handle FF_EXISTS + !(line->flags & ML_NOCLIMB), // do not handle FF_TRANSLUCENT + !(line->flags & ML_EFFECT2), // do not handle lighting + !(line->flags & ML_EFFECT2), // do not handle colormap (ran out of flags) + !(line->flags & ML_BOUNCY), // do not handle collision + (line->flags & ML_EFFECT1), // do ghost fade (no collision during fade) + (line->flags & ML_TFERLINE)); // use exact alpha values (for opengl) + } + } + j++; + } + + if (!foundrover) + { + CONS_Debug(DBG_GAMELOGIC, "Line type 453 Executor: Can't find a FOF control sector with tag %d\n", foftag); + return; + } + } + break; + } + + case 454: // Stop fading FOF + { + INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); + INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); + sector_t *sec; // Sector that the FOF is visible in + ffloor_t *rover; // FOF that we are going to operate + boolean foundrover = false; // for debug, "Can't find a FOF" message + + for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;) + { + sec = sectors + secnum; + + if (!sec->ffloors) + { + CONS_Debug(DBG_GAMELOGIC, "Line type 454 Executor: Target sector #%d has no FOFs.\n", secnum); + return; + } + + for (rover = sec->ffloors; rover; rover = rover->next) + { + if (rover->master->frontsector->tag == foftag) + { + foundrover = true; + + P_ResetFakeFloorFader(rover, NULL, + !(line->flags & ML_BLOCKMONSTERS)); // do not finalize collision flags + } + } + + if (!foundrover) + { + CONS_Debug(DBG_GAMELOGIC, "Line type 454 Executor: Can't find a FOF control sector with tag %d\n", foftag); + return; + } + } + break; + } + + case 455: // Fade colormap + for (secnum = -1; (secnum = P_FindSectorFromLineTag(line, secnum)) >= 0 ;) + { + extracolormap_t *source_exc, *dest_exc, *exc; + INT32 speed = (INT32)((line->flags & ML_DONTPEGBOTTOM) || !sides[line->sidenum[0]].rowoffset) && line->sidenum[1] != 0xFFFF ? + abs(sides[line->sidenum[1]].rowoffset >> FRACBITS) + : abs(sides[line->sidenum[0]].rowoffset >> FRACBITS); + + // Prevent continuous execs from interfering on an existing fade + if (!(line->flags & ML_EFFECT5) + && sectors[secnum].fadecolormapdata) + //&& ((fadecolormap_t*)sectors[secnum].fadecolormapdata)->timer > (ticbased ? 2 : speed*2)) + { + CONS_Debug(DBG_GAMELOGIC, "Line type 455 Executor: Fade color thinker already exists, timer: %d\n", ((fadecolormap_t*)sectors[secnum].fadecolormapdata)->timer); + continue; + } + + if (line->flags & ML_TFERLINE) // use back colormap instead of target sector + sectors[secnum].extra_colormap = (line->sidenum[1] != 0xFFFF) ? + sides[line->sidenum[1]].colormap_data : NULL; + + exc = sectors[secnum].extra_colormap; + + if (!(line->flags & ML_BOUNCY) // BOUNCY: Do not override fade from default rgba + && !R_CheckDefaultColormap(sides[line->sidenum[0]].colormap_data, true, false, false) + && R_CheckDefaultColormap(exc, true, false, false)) + { + exc = R_CopyColormap(exc, false); + exc->rgba = R_GetRgbaRGB(sides[line->sidenum[0]].colormap_data->rgba) + R_PutRgbaA(R_GetRgbaA(exc->rgba)); + //exc->fadergba = R_GetRgbaRGB(sides[line->sidenum[0]].colormap_data->rgba) + R_PutRgbaA(R_GetRgbaA(exc->fadergba)); + + if (!(source_exc = R_GetColormapFromList(exc))) + { + exc->colormap = R_CreateLightTable(exc); + R_AddColormapToList(exc); + source_exc = exc; + } + else + Z_Free(exc); + + sectors[secnum].extra_colormap = source_exc; + } + else + source_exc = exc ? exc : R_GetDefaultColormap(); + + if (line->flags & ML_EFFECT3) // relative calc + { + exc = R_AddColormaps( + source_exc, + sides[line->sidenum[0]].colormap_data, + line->flags & ML_EFFECT1, // subtract R + line->flags & ML_NOCLIMB, // subtract G + line->flags & ML_EFFECT2, // subtract B + false, // subtract A (no flag for this, just pass negative alpha) + line->flags & ML_EFFECT1, // subtract FadeR + line->flags & ML_NOCLIMB, // subtract FadeG + line->flags & ML_EFFECT2, // subtract FadeB + false, // subtract FadeA (no flag for this, just pass negative alpha) + false, // subtract FadeStart (we ran out of flags) + false, // subtract FadeEnd (we ran out of flags) + false, // ignore Fog (we ran out of flags) + line->flags & ML_DONTPEGBOTTOM, + (line->flags & ML_DONTPEGBOTTOM) ? (sides[line->sidenum[0]].textureoffset >> FRACBITS) : 0, + (line->flags & ML_DONTPEGBOTTOM) ? (sides[line->sidenum[0]].rowoffset >> FRACBITS) : 0, + false); + } + else if (line->flags & ML_DONTPEGBOTTOM) // alternate alpha (by texture offsets) + { + exc = R_CopyColormap(sides[line->sidenum[0]].colormap_data, false); + exc->rgba = R_GetRgbaRGB(exc->rgba) + R_PutRgbaA(max(min(sides[line->sidenum[0]].textureoffset >> FRACBITS, 25), 0)); + exc->fadergba = R_GetRgbaRGB(exc->fadergba) + R_PutRgbaA(max(min(sides[line->sidenum[0]].rowoffset >> FRACBITS, 25), 0)); + } + else + exc = R_CopyColormap(sides[line->sidenum[0]].colormap_data, false); + + if (!(dest_exc = R_GetColormapFromList(exc))) + { + exc->colormap = R_CreateLightTable(exc); + R_AddColormapToList(exc); + dest_exc = exc; + } + else + Z_Free(exc); + + Add_ColormapFader(§ors[secnum], source_exc, dest_exc, (line->flags & ML_EFFECT4), // tic-based timing + speed); + } + break; + + case 456: // Stop fade colormap + for (secnum = -1; (secnum = P_FindSectorFromLineTag(line, secnum)) >= 0 ;) + P_ResetColormapFader(§ors[secnum]); + break; + + case 457: // Track mobj angle to point + if (mo) + { + INT32 failureangle = FixedAngle((min(max(abs(sides[line->sidenum[0]].textureoffset>>FRACBITS), 0), 360))*FRACUNIT); + INT32 failuredelay = abs(sides[line->sidenum[0]].rowoffset>>FRACBITS); + INT32 failureexectag = line->sidenum[1] != 0xffff ? + (INT32)(sides[line->sidenum[1]].textureoffset>>FRACBITS) : 0; + boolean persist = (line->flags & ML_EFFECT2); + mobj_t *anchormo; + + if ((secnum = P_FindSectorFromLineTag(line, -1)) < 0) + return; + + anchormo = P_GetObjectTypeInSectorNum(MT_ANGLEMAN, secnum); + if (!anchormo) + return; + + mo->eflags |= MFE_TRACERANGLE; + P_SetTarget(&mo->tracer, anchormo); + mo->lastlook = persist; // don't disable behavior after first failure + mo->extravalue1 = failureangle; // angle to exceed for failure state + mo->extravalue2 = failureexectag; // exec tag for failure state (angle is not within range) + mo->cusval = mo->cvmem = failuredelay; // cusval = tics to allow failure before line trigger; cvmem = decrement timer + } + break; + + case 458: // Stop tracking mobj angle to point + if (mo && (mo->eflags & MFE_TRACERANGLE)) + { + mo->eflags &= ~MFE_TRACERANGLE; + P_SetTarget(&mo->tracer, NULL); + mo->lastlook = mo->cvmem = mo->cusval = mo->extravalue1 = mo->extravalue2 = 0; + } + break; + + case 459: // Control Text Prompt + // console player only unless NOCLIMB is set + if (mo && mo->player && P_IsLocalPlayer(mo->player) && (!bot || bot != mo)) + { + INT32 promptnum = max(0, (sides[line->sidenum[0]].textureoffset>>FRACBITS)-1); + INT32 pagenum = max(0, (sides[line->sidenum[0]].rowoffset>>FRACBITS)-1); + INT32 postexectag = abs((line->sidenum[1] != 0xFFFF) ? sides[line->sidenum[1]].textureoffset>>FRACBITS : line->tag); + + boolean closetextprompt = (line->flags & ML_BLOCKMONSTERS); + //boolean allplayers = (line->flags & ML_NOCLIMB); + boolean runpostexec = (line->flags & ML_EFFECT1); + boolean blockcontrols = !(line->flags & ML_EFFECT2); + boolean freezerealtime = !(line->flags & ML_EFFECT3); + //boolean freezethinkers = (line->flags & ML_EFFECT4); + boolean callbynamedtag = (line->flags & ML_TFERLINE); + + if (closetextprompt) + F_EndTextPrompt(false, false); + else + { + if (callbynamedtag && sides[line->sidenum[0]].text && sides[line->sidenum[0]].text[0]) + F_GetPromptPageByNamedTag(sides[line->sidenum[0]].text, &promptnum, &pagenum); + F_StartTextPrompt(promptnum, pagenum, mo, runpostexec ? postexectag : 0, blockcontrols, freezerealtime); + } + } + break; + #ifdef POLYOBJECTS case 480: // Polyobj_DoorSlide case 481: // Polyobj_DoorSwing @@ -3120,6 +3847,9 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) case 491: PolyTranslucency(line); break; + case 492: + PolyFade(line); + break; #endif default: @@ -4938,7 +5668,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f ffloor->spawnflags = ffloor->flags = flags; ffloor->master = master; ffloor->norender = INFTICS; - + ffloor->fadingdata = NULL; // Scan the thinkers to check for special conditions applying to this FOF. // If we have thinkers sorted by sector, just check the relevant ones; @@ -6419,6 +7149,17 @@ void P_SpawnSpecials(INT32 fromnetsave) } break; + // NiGHTS trigger executors + case 323: + case 324: + case 325: + case 326: + case 327: + case 328: + case 329: + case 330: + break; + case 399: // Linedef execute on map load // This is handled in P_RunLevelLoadExecutors. break; @@ -6532,7 +7273,7 @@ void P_SpawnSpecials(INT32 fromnetsave) case 606: // HACK! Copy colormaps. Just plain colormaps. for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) - sectors[s].midmap = lines[i].frontsector->midmap; + sectors[s].extra_colormap = sectors[s].spawn_extra_colormap = sides[lines[i].sidenum[0]].colormap_data; break; #ifdef ESLOPE // Slope copy specials. Handled here for sanity. @@ -7094,6 +7835,591 @@ void T_Disappear(disappear_t *d) } } +/** Removes fadingdata from FOF control sector + * + * \param line line to search for target faders + * \param data pointer to set new fadingdata to. Can be NULL to erase. + */ +static void P_ResetFakeFloorFader(ffloor_t *rover, fade_t *data, boolean finalize) +{ + fade_t *fadingdata = (fade_t *)rover->fadingdata; + // find any existing thinkers and remove them, then replace with new data + if (fadingdata != data) + { + if (fadingdata) + { + if (finalize) + P_FadeFakeFloor(rover, + fadingdata->sourcevalue, + fadingdata->alpha >= fadingdata->destvalue ? + fadingdata->alpha - 1 : // trigger fade-out finish + fadingdata->alpha + 1, // trigger fade-in finish + 0, + fadingdata->ticbased, + &fadingdata->timer, + fadingdata->doexists, + fadingdata->dotranslucent, + fadingdata->dolighting, + fadingdata->docolormap, + fadingdata->docollision, + fadingdata->doghostfade, + fadingdata->exactalpha); + rover->alpha = fadingdata->alpha; + + if (fadingdata->dolighting) + P_RemoveLighting(§ors[rover->secnum]); + + if (fadingdata->docolormap) + P_ResetColormapFader(§ors[rover->secnum]); + + P_RemoveThinker(&fadingdata->thinker); + } + + rover->fadingdata = data; + } +} + +static boolean P_FadeFakeFloor(ffloor_t *rover, INT16 sourcevalue, INT16 destvalue, INT16 speed, boolean ticbased, INT32 *timer, + boolean doexists, boolean dotranslucent, boolean dolighting, boolean docolormap, + boolean docollision, boolean doghostfade, boolean exactalpha) +{ + boolean stillfading = false; + INT32 alpha; + fade_t *fadingdata = (fade_t *)rover->fadingdata; + (void)docolormap; // *shrug* maybe we can use this in the future. For now, let's be consistent with our other function params + + if (rover->master->special == 258) // Laser block + return false; + + // If fading an invisible FOF whose render flags we did not yet set, + // initialize its alpha to 1 + if (dotranslucent && + (rover->spawnflags & FF_NOSHADE) && // do not include light blocks, which don't set FF_NOSHADE + !(rover->flags & FF_FOG) && // do not include fog + !(rover->spawnflags & FF_RENDERSIDES) && + !(rover->spawnflags & FF_RENDERPLANES) && + !(rover->flags & FF_RENDERALL)) + rover->alpha = 1; + + if (fadingdata) + alpha = fadingdata->alpha; + else + alpha = rover->alpha; + + // routines specific to fade in and fade out + if (!ticbased && alpha == destvalue) + return stillfading; + else if (alpha > destvalue) // fade out + { + // finish fading out + if (speed < 1 || (!ticbased && alpha - speed <= destvalue + speed) || + (ticbased && (--(*timer) <= 0 || alpha <= destvalue))) + { + alpha = destvalue; + + if (docollision) + { + if (rover->spawnflags & FF_SOLID) + rover->flags &= ~FF_SOLID; + if (rover->spawnflags & FF_SWIMMABLE) + rover->flags &= ~FF_SWIMMABLE; + if (rover->spawnflags & FF_QUICKSAND) + rover->flags &= ~FF_QUICKSAND; + if (rover->spawnflags & FF_BUSTUP) + rover->flags &= ~FF_BUSTUP; + if (rover->spawnflags & FF_MARIO) + rover->flags &= ~FF_MARIO; + } + } + else // continue fading out + { + if (!ticbased) + alpha -= speed; + else + { + INT16 delta = abs(destvalue - sourcevalue); + fixed_t factor = min(FixedDiv(speed - (*timer), speed), 1*FRACUNIT); + alpha = max(min(alpha, sourcevalue - (INT16)FixedMul(delta, factor)), destvalue); + } + stillfading = true; + } + } + else // fade in + { + // finish fading in + if (speed < 1 || (!ticbased && alpha + speed >= destvalue - speed) || + (ticbased && (--(*timer) <= 0 || alpha >= destvalue))) + { + alpha = destvalue; + + if (docollision) + { + if (rover->spawnflags & FF_SOLID) + rover->flags |= FF_SOLID; + if (rover->spawnflags & FF_SWIMMABLE) + rover->flags |= FF_SWIMMABLE; + if (rover->spawnflags & FF_QUICKSAND) + rover->flags |= FF_QUICKSAND; + if (rover->spawnflags & FF_BUSTUP) + rover->flags |= FF_BUSTUP; + if (rover->spawnflags & FF_MARIO) + rover->flags |= FF_MARIO; + } + } + else // continue fading in + { + if (!ticbased) + alpha += speed; + else + { + INT16 delta = abs(destvalue - sourcevalue); + fixed_t factor = min(FixedDiv(speed - (*timer), speed), 1*FRACUNIT); + alpha = min(max(alpha, sourcevalue + (INT16)FixedMul(delta, factor)), destvalue); + } + stillfading = true; + } + } + + // routines common to both fade in and fade out + if (!stillfading) + { + if (doexists && !(rover->spawnflags & FF_BUSTUP)) + { + if (alpha <= 1) + rover->flags &= ~FF_EXISTS; + else + rover->flags |= FF_EXISTS; + + // Re-render lighting at end of fade + if (dolighting && !(rover->spawnflags & FF_NOSHADE) && !(rover->flags & FF_EXISTS)) + rover->target->moved = true; + } + + if (dotranslucent && !(rover->flags & FF_FOG)) + { + if (alpha >= 256) + { + if (!(rover->flags & FF_CUTSOLIDS) && + (rover->spawnflags & FF_CUTSOLIDS)) + { + rover->flags |= FF_CUTSOLIDS; + rover->target->moved = true; + } + + rover->flags &= ~FF_TRANSLUCENT; + } + else + { + rover->flags |= FF_TRANSLUCENT; + + if ((rover->flags & FF_CUTSOLIDS) && + (rover->spawnflags & FF_CUTSOLIDS)) + { + rover->flags &= ~FF_CUTSOLIDS; + rover->target->moved = true; + } + } + + if ((rover->spawnflags & FF_NOSHADE) && // do not include light blocks, which don't set FF_NOSHADE + !(rover->spawnflags & FF_RENDERSIDES) && + !(rover->spawnflags & FF_RENDERPLANES)) + { + if (rover->alpha > 1) + rover->flags |= FF_RENDERALL; + else + rover->flags &= ~FF_RENDERALL; + } + } + } + else + { + if (doexists && !(rover->spawnflags & FF_BUSTUP)) + { + // Re-render lighting if we haven't yet set FF_EXISTS (beginning of fade) + if (dolighting && !(rover->spawnflags & FF_NOSHADE) && !(rover->flags & FF_EXISTS)) + rover->target->moved = true; + + rover->flags |= FF_EXISTS; + } + + if (dotranslucent && !(rover->flags & FF_FOG)) + { + rover->flags |= FF_TRANSLUCENT; + + if ((rover->flags & FF_CUTSOLIDS) && + (rover->spawnflags & FF_CUTSOLIDS)) + { + rover->flags &= ~FF_CUTSOLIDS; + rover->target->moved = true; + } + + if ((rover->spawnflags & FF_NOSHADE) && // do not include light blocks, which don't set FF_NOSHADE + !(rover->spawnflags & FF_RENDERSIDES) && + !(rover->spawnflags & FF_RENDERPLANES)) + rover->flags |= FF_RENDERALL; + } + + if (docollision) + { + if (doghostfade) // remove collision flags during fade + { + if (rover->spawnflags & FF_SOLID) + rover->flags &= ~FF_SOLID; + if (rover->spawnflags & FF_SWIMMABLE) + rover->flags &= ~FF_SWIMMABLE; + if (rover->spawnflags & FF_QUICKSAND) + rover->flags &= ~FF_QUICKSAND; + if (rover->spawnflags & FF_BUSTUP) + rover->flags &= ~FF_BUSTUP; + if (rover->spawnflags & FF_MARIO) + rover->flags &= ~FF_MARIO; + } + else // keep collision during fade + { + if (rover->spawnflags & FF_SOLID) + rover->flags |= FF_SOLID; + if (rover->spawnflags & FF_SWIMMABLE) + rover->flags |= FF_SWIMMABLE; + if (rover->spawnflags & FF_QUICKSAND) + rover->flags |= FF_QUICKSAND; + if (rover->spawnflags & FF_BUSTUP) + rover->flags |= FF_BUSTUP; + if (rover->spawnflags & FF_MARIO) + rover->flags |= FF_MARIO; + } + } + } + + if (!(rover->flags & FF_FOG)) // don't set FOG alpha + { + if (!stillfading || exactalpha) + rover->alpha = alpha; + else // clamp fadingdata->alpha to software's alpha levels + { + if (alpha < 12) + rover->alpha = destvalue < 12 ? destvalue : 1; // Don't even draw it + else if (alpha < 38) + rover->alpha = destvalue >= 12 && destvalue < 38 ? destvalue : 25; + else if (alpha < 64) + rover->alpha = destvalue >=38 && destvalue < 64 ? destvalue : 51; + else if (alpha < 89) + rover->alpha = destvalue >= 64 && destvalue < 89 ? destvalue : 76; + else if (alpha < 115) + rover->alpha = destvalue >= 89 && destvalue < 115 ? destvalue : 102; + else if (alpha < 140) + rover->alpha = destvalue >= 115 && destvalue < 140 ? destvalue : 128; + else if (alpha < 166) + rover->alpha = destvalue >= 140 && destvalue < 166 ? destvalue : 154; + else if (alpha < 192) + rover->alpha = destvalue >= 166 && destvalue < 192 ? destvalue : 179; + else if (alpha < 217) + rover->alpha = destvalue >= 192 && destvalue < 217 ? destvalue : 204; + else if (alpha < 243) + rover->alpha = destvalue >= 217 && destvalue < 243 ? destvalue : 230; + else // Opaque + rover->alpha = destvalue >= 243 ? destvalue : 256; + } + } + + if (fadingdata) + fadingdata->alpha = alpha; + + return stillfading; +} + +/** Adds fake floor fader thinker. + * + * \param destvalue transparency value to fade to + * \param speed speed to fade by + * \param ticbased tic-based logic, speed = duration + * \param relative Destvalue is relative to rover->alpha + * \param doexists handle FF_EXISTS + * \param dotranslucent handle FF_TRANSLUCENT + * \param dolighting fade FOF light + * \param docollision handle interactive flags + * \param doghostfade no interactive flags during fading + * \param exactalpha use exact alpha values (opengl) + */ +static void P_AddFakeFloorFader(ffloor_t *rover, size_t sectornum, size_t ffloornum, + INT16 destvalue, INT16 speed, boolean ticbased, boolean relative, + boolean doexists, boolean dotranslucent, boolean dolighting, boolean docolormap, + boolean docollision, boolean doghostfade, boolean exactalpha) +{ + fade_t *d; + + // If fading an invisible FOF whose render flags we did not yet set, + // initialize its alpha to 1 + if (dotranslucent && + (rover->spawnflags & FF_NOSHADE) && // do not include light blocks, which don't set FF_NOSHADE + !(rover->spawnflags & FF_RENDERSIDES) && + !(rover->spawnflags & FF_RENDERPLANES) && + !(rover->flags & FF_RENDERALL)) + rover->alpha = 1; + + // already equal, nothing to do + if (rover->alpha == max(1, min(256, relative ? rover->alpha + destvalue : destvalue))) + return; + + d = Z_Malloc(sizeof *d, PU_LEVSPEC, NULL); + + d->thinker.function.acp1 = (actionf_p1)T_Fade; + d->rover = rover; + d->sectornum = (UINT32)sectornum; + d->ffloornum = (UINT32)ffloornum; + + d->alpha = d->sourcevalue = rover->alpha; + d->destvalue = max(1, min(256, relative ? rover->alpha + destvalue : destvalue)); // ffloor->alpha is 1-256 + + if (ticbased) + { + d->ticbased = true; + d->timer = d->speed = abs(speed); // use d->speed as total duration + } + else + { + d->ticbased = false; + d->speed = max(1, speed); // minimum speed 1/tic // if speed < 1, alpha is set immediately in thinker + d->timer = -1; + } + + d->doexists = doexists; + d->dotranslucent = dotranslucent; + d->dolighting = dolighting; + d->docolormap = docolormap; + d->docollision = docollision; + d->doghostfade = doghostfade; + d->exactalpha = exactalpha; + + // find any existing thinkers and remove them, then replace with new data + P_ResetFakeFloorFader(rover, d, false); + + // Set a separate thinker for shadow fading + if (dolighting && !(rover->flags & FF_NOSHADE)) + { + UINT16 lightdelta = abs(sectors[rover->secnum].spawn_lightlevel - rover->target->lightlevel); + fixed_t alphapercent = min(FixedDiv(d->destvalue, rover->spawnalpha), 1*FRACUNIT); // don't make darker than spawn_lightlevel + fixed_t adjustedlightdelta = FixedMul(lightdelta, alphapercent); + + if (rover->target->lightlevel >= sectors[rover->secnum].spawn_lightlevel) // fading out, get lighter + d->destlightlevel = rover->target->lightlevel - adjustedlightdelta; + else // fading in, get darker + d->destlightlevel = rover->target->lightlevel + adjustedlightdelta; + + P_FadeLightBySector(§ors[rover->secnum], + d->destlightlevel, + ticbased ? d->timer : + FixedFloor(FixedDiv(abs(d->destvalue - d->alpha), d->speed))/FRACUNIT, + true); + } + else + d->destlightlevel = -1; + + // Set a separate thinker for colormap fading + if (docolormap && !(rover->flags & FF_NOSHADE) && sectors[rover->secnum].spawn_extra_colormap) + { + extracolormap_t *dest_exc, + *source_exc = sectors[rover->secnum].extra_colormap ? sectors[rover->secnum].extra_colormap : R_GetDefaultColormap(); + + INT32 colordelta = R_GetRgbaA(sectors[rover->secnum].spawn_extra_colormap->rgba); // alpha is from 0 + fixed_t alphapercent = min(FixedDiv(d->destvalue, rover->spawnalpha), 1*FRACUNIT); // don't make darker than spawn_lightlevel + fixed_t adjustedcolordelta = FixedMul(colordelta, alphapercent); + INT32 coloralpha; + + coloralpha = adjustedcolordelta; + + dest_exc = R_CopyColormap(sectors[rover->secnum].spawn_extra_colormap, false); + dest_exc->rgba = R_GetRgbaRGB(dest_exc->rgba) + R_PutRgbaA(coloralpha); + + if (!(d->dest_exc = R_GetColormapFromList(dest_exc))) + { + dest_exc->colormap = R_CreateLightTable(dest_exc); + R_AddColormapToList(dest_exc); + d->dest_exc = dest_exc; + } + else + Z_Free(dest_exc); + + // If fading from 0, set source_exc rgb same to dest_exc + if (!R_CheckDefaultColormap(d->dest_exc, true, false, false) + && R_CheckDefaultColormap(source_exc, true, false, false)) + { + extracolormap_t *exc = R_CopyColormap(source_exc, false); + exc->rgba = R_GetRgbaRGB(d->dest_exc->rgba) + R_PutRgbaA(R_GetRgbaA(source_exc->rgba)); + exc->fadergba = R_GetRgbaRGB(d->dest_exc->rgba) + R_PutRgbaA(R_GetRgbaA(source_exc->fadergba)); + + if (!(source_exc = R_GetColormapFromList(exc))) + { + exc->colormap = R_CreateLightTable(exc); + R_AddColormapToList(exc); + source_exc = exc; + } + else + Z_Free(exc); + } + + Add_ColormapFader(§ors[rover->secnum], source_exc, d->dest_exc, true, + ticbased ? d->timer : + FixedFloor(FixedDiv(abs(d->destvalue - d->alpha), d->speed))/FRACUNIT); + } + + P_AddThinker(&d->thinker); +} + +/** Makes a FOF fade + * + * \param d Fade thinker. + * \sa P_AddFakeFloorFader + */ +void T_Fade(fade_t *d) +{ + if (d->rover && !P_FadeFakeFloor(d->rover, d->sourcevalue, d->destvalue, d->speed, d->ticbased, &d->timer, + d->doexists, d->dotranslucent, d->dolighting, d->docolormap, d->docollision, d->doghostfade, d->exactalpha)) + { + // Finalize lighting, copypasta from P_AddFakeFloorFader + if (d->dolighting && !(d->rover->flags & FF_NOSHADE) && d->destlightlevel > -1) + sectors[d->rover->secnum].lightlevel = d->destlightlevel; + + // Finalize colormap + if (d->docolormap && !(d->rover->flags & FF_NOSHADE) && sectors[d->rover->secnum].spawn_extra_colormap) + sectors[d->rover->secnum].extra_colormap = d->dest_exc; + + P_RemoveFakeFloorFader(d->rover); + } +} + +static void P_ResetColormapFader(sector_t *sector) +{ + if (sector->fadecolormapdata) + { + // The thinker is the first member in all the action structs, + // so just let the thinker get freed, and that will free the whole + // structure. + P_RemoveThinker(&((elevator_t *)sector->fadecolormapdata)->thinker); + sector->fadecolormapdata = NULL; + } +} + +static void Add_ColormapFader(sector_t *sector, extracolormap_t *source_exc, extracolormap_t *dest_exc, + boolean ticbased, INT32 duration) +{ + fadecolormap_t *d; + + P_ResetColormapFader(sector); + + // nothing to do, set immediately + if (!duration || R_CheckEqualColormaps(source_exc, dest_exc, true, true, true)) + { + sector->extra_colormap = dest_exc; + return; + } + + d = Z_Malloc(sizeof *d, PU_LEVSPEC, NULL); + d->thinker.function.acp1 = (actionf_p1)T_FadeColormap; + d->sector = sector; + d->source_exc = source_exc; + d->dest_exc = dest_exc; + + if (ticbased) + { + d->ticbased = true; + d->duration = d->timer = duration; + } + else + { + d->ticbased = false; + d->timer = 256; + d->duration = duration; // use as speed + } + + sector->fadecolormapdata = d; + P_AddThinker(&d->thinker); // add thinker +} + +void T_FadeColormap(fadecolormap_t *d) +{ + if ((d->ticbased && --d->timer <= 0) + || (!d->ticbased && (d->timer -= d->duration) <= 0)) // d->duration used as speed decrement + { + d->sector->extra_colormap = d->dest_exc; + P_ResetColormapFader(d->sector); + } + else + { + extracolormap_t *exc; + INT32 duration = d->ticbased ? d->duration : 256; + fixed_t factor = min(FixedDiv(duration - d->timer, duration), 1*FRACUNIT); + INT16 cr, cg, cb, ca, fadestart, fadeend, fog; + INT32 rgba, fadergba; + + // NULL failsafes (or intentionally set to signify default) + if (!d->sector->extra_colormap) + d->sector->extra_colormap = R_GetDefaultColormap(); + + if (!d->source_exc) + d->source_exc = R_GetDefaultColormap(); + + if (!d->dest_exc) + d->dest_exc = R_GetDefaultColormap(); + + // For each var (rgba + fadergba + params = 11 vars), we apply + // percentage fading: currentval = sourceval + (delta * percent of duration elapsed) + // delta is negative when fading out (destval is lower) + // max/min are used to ensure progressive calcs don't go backwards and to cap values to dest. + +#define APPLYFADE(dest, src, cur) (\ +(dest-src < 0) ? \ + max(\ + min(cur,\ + src + (INT16)FixedMul(dest-src, factor)),\ + dest)\ +: (dest-src > 0) ? \ + min(\ + max(cur,\ + src + (INT16)FixedMul(dest-src, factor)),\ + dest)\ +: \ + dest\ +) + + cr = APPLYFADE(R_GetRgbaR(d->dest_exc->rgba), R_GetRgbaR(d->source_exc->rgba), R_GetRgbaR(d->sector->extra_colormap->rgba)); + cg = APPLYFADE(R_GetRgbaG(d->dest_exc->rgba), R_GetRgbaG(d->source_exc->rgba), R_GetRgbaG(d->sector->extra_colormap->rgba)); + cb = APPLYFADE(R_GetRgbaB(d->dest_exc->rgba), R_GetRgbaB(d->source_exc->rgba), R_GetRgbaB(d->sector->extra_colormap->rgba)); + ca = APPLYFADE(R_GetRgbaA(d->dest_exc->rgba), R_GetRgbaA(d->source_exc->rgba), R_GetRgbaA(d->sector->extra_colormap->rgba)); + + rgba = R_PutRgbaRGBA(cr, cg, cb, ca); + + cr = APPLYFADE(R_GetRgbaR(d->dest_exc->fadergba), R_GetRgbaR(d->source_exc->fadergba), R_GetRgbaR(d->sector->extra_colormap->fadergba)); + cg = APPLYFADE(R_GetRgbaG(d->dest_exc->fadergba), R_GetRgbaG(d->source_exc->fadergba), R_GetRgbaG(d->sector->extra_colormap->fadergba)); + cb = APPLYFADE(R_GetRgbaB(d->dest_exc->fadergba), R_GetRgbaB(d->source_exc->fadergba), R_GetRgbaB(d->sector->extra_colormap->fadergba)); + ca = APPLYFADE(R_GetRgbaA(d->dest_exc->fadergba), R_GetRgbaA(d->source_exc->fadergba), R_GetRgbaA(d->sector->extra_colormap->fadergba)); + + fadergba = R_PutRgbaRGBA(cr, cg, cb, ca); + + fadestart = APPLYFADE(d->dest_exc->fadestart, d->source_exc->fadestart, d->sector->extra_colormap->fadestart); + fadeend = APPLYFADE(d->dest_exc->fadeend, d->source_exc->fadeend, d->sector->extra_colormap->fadeend); + fog = abs(factor) > FRACUNIT/2 ? d->dest_exc->fog : d->source_exc->fog; // set new fog flag halfway through fade + +#undef APPLYFADE + + ////////////////// + // setup new colormap + ////////////////// + + if (!(d->sector->extra_colormap = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, fog))) + { + exc = R_CreateDefaultColormap(false); + exc->fadestart = fadestart; + exc->fadeend = fadeend; + exc->fog = (boolean)fog; + exc->rgba = rgba; + exc->fadergba = fadergba; + exc->colormap = R_CreateLightTable(exc); + R_AddColormapToList(exc); + d->sector->extra_colormap = exc; + } + } +} + /* SoM: 3/8/2000: Friction functions start. Add_Friction, diff --git a/src/p_spec.h b/src/p_spec.h index c4e05e072..f04e6590f 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -66,6 +66,10 @@ void P_SwitchWeather(INT32 weathernum); boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller); void P_LinedefExecute(INT16 tag, mobj_t *actor, sector_t *caller); void P_ChangeSectorTag(UINT32 sector, INT16 newtag); +void P_RunNightserizeExecutors(mobj_t *actor); +void P_RunDeNightserizeExecutors(mobj_t *actor); +void P_RunNightsLapExecutors(mobj_t *actor); +void P_RunNightsCapsuleTouchExecutors(mobj_t *actor, boolean entering, boolean enoughspheres); ffloor_t *P_GetFFloorByID(sector_t *sec, UINT16 id); @@ -130,10 +134,15 @@ typedef struct */ typedef struct { - thinker_t thinker; ///< Thinker in use for the effect. - sector_t *sector; ///< Sector where action is taking place. - INT32 destlevel; ///< Light level we're fading to. - INT32 speed; ///< Speed at which to change light level. + thinker_t thinker; ///< Thinker in use for the effect. + sector_t *sector; ///< Sector where action is taking place. + INT16 sourcelevel; ///< Light level we're fading from. + INT16 destlevel; ///< Light level we're fading to. + + fixed_t fixedcurlevel; ///< Fixed point for current light level. + fixed_t fixedpertic; ///< Fixed point for increment per tic. + // The reason for those two above to be fixed point is to deal with decimal values that would otherwise get trimmed away. + INT32 timer; ///< Internal timer. } lightlevel_t; #define GLOWSPEED 8 @@ -141,6 +150,8 @@ typedef struct #define FASTDARK 15 #define SLOWDARK 35 +void P_RemoveLighting(sector_t *sector); + void T_FireFlicker(fireflicker_t *flick); fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxsector, INT32 length); void T_LightningFlash(lightflash_t *flash); @@ -152,7 +163,8 @@ strobe_t * P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector void T_Glow(glow_t *g); glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector, INT32 length); -void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed); +void P_FadeLightBySector(sector_t *sector, INT32 destvalue, INT32 speed, boolean ticbased); +void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force); void T_LightFade(lightlevel_t *ll); typedef enum @@ -449,6 +461,47 @@ typedef struct void T_Disappear(disappear_t *d); +// Model for fading FOFs +typedef struct +{ + thinker_t thinker; ///< Thinker structure for effect. + ffloor_t *rover; ///< Target ffloor + extracolormap_t *dest_exc; ///< Colormap to fade to + UINT32 sectornum; ///< Number of ffloor target sector + UINT32 ffloornum; ///< Number of ffloor of target sector + INT32 alpha; ///< Internal alpha counter + INT16 sourcevalue; ///< Transparency value to fade from + INT16 destvalue; ///< Transparency value to fade to + INT16 destlightlevel; ///< Light level to fade to + INT16 speed; ///< Speed to fade by + boolean ticbased; ///< Tic-based logic toggle + INT32 timer; ///< Timer for tic-based logic + boolean doexists; ///< Handle FF_EXISTS + boolean dotranslucent; ///< Handle FF_TRANSLUCENT + boolean dolighting; ///< Handle shadows and light blocks + boolean docolormap; ///< Handle colormaps + boolean docollision; ///< Handle interactive flags + boolean doghostfade; ///< No interactive flags during fading + boolean exactalpha; ///< Use exact alpha values (opengl) +} fade_t; + +void T_Fade(fade_t *d); + +// Model for fading colormaps + +typedef struct +{ + thinker_t thinker; ///< Thinker structure for effect. + sector_t *sector; ///< Sector where action is taking place. + extracolormap_t *source_exc; + extracolormap_t *dest_exc; + boolean ticbased; ///< Tic-based timing + INT32 duration; ///< Total duration for tic-based logic (OR: speed increment) + INT32 timer; ///< Timer for tic-based logic (OR: internal speed counter) +} fadecolormap_t; + +void T_FadeColormap(fadecolormap_t *d); + // Prototype functions for pushers void T_Pusher(pusher_t *p); mobj_t *P_GetPushThing(UINT32 s); diff --git a/src/p_tick.c b/src/p_tick.c index a51ce2eb6..eb47e0c36 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -56,12 +56,12 @@ void Command_Numthinkers_f(void) CONS_Printf(M_GetText("numthinkers <#>: Count number of thinkers\n")); CONS_Printf( "\t1: P_MobjThinker\n" - "\t2: P_RainThinker\n" - "\t3: P_SnowThinker\n" - "\t4: P_NullPrecipThinker\n" - "\t5: T_Friction\n" - "\t6: T_Pusher\n" - "\t7: P_RemoveThinkerDelayed\n"); + /*"\t2: P_RainThinker\n" + "\t3: P_SnowThinker\n"*/ + "\t2: P_NullPrecipThinker\n" + "\t3: T_Friction\n" + "\t4: T_Pusher\n" + "\t5: P_RemoveThinkerDelayed\n"); return; } @@ -73,27 +73,27 @@ void Command_Numthinkers_f(void) action = (actionf_p1)P_MobjThinker; CONS_Printf(M_GetText("Number of %s: "), "P_MobjThinker"); break; - case 2: + /*case 2: action = (actionf_p1)P_RainThinker; CONS_Printf(M_GetText("Number of %s: "), "P_RainThinker"); break; case 3: action = (actionf_p1)P_SnowThinker; CONS_Printf(M_GetText("Number of %s: "), "P_SnowThinker"); - break; - case 4: + break;*/ + case 2: action = (actionf_p1)P_NullPrecipThinker; CONS_Printf(M_GetText("Number of %s: "), "P_NullPrecipThinker"); break; - case 5: + case 3: action = (actionf_p1)T_Friction; CONS_Printf(M_GetText("Number of %s: "), "T_Friction"); break; - case 6: + case 4: action = (actionf_p1)T_Pusher; CONS_Printf(M_GetText("Number of %s: "), "T_Pusher"); break; - case 7: + case 5: action = (actionf_p1)P_RemoveThinkerDelayed; CONS_Printf(M_GetText("Number of %s: "), "P_RemoveThinkerDelayed"); break; diff --git a/src/p_user.c b/src/p_user.c index 8050eb9c7..13557ab0a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -596,10 +596,6 @@ static void P_DeNightserizePlayer(player_t *player) else if (player == &players[secondarydisplayplayer]) localaiming2 = 0; - // If you screwed up, kiss your score and ring bonus goodbye. - player->marescore = 0; - player->rings = 0; - P_SetPlayerMobjState(player->mo, S_PLAY_FALL); // If in a special stage, add some preliminary exit time. @@ -611,6 +607,11 @@ static void P_DeNightserizePlayer(player_t *player) players[i].nightstime = 1; // force everyone else to fall too. player->exiting = 3*TICRATE; stagefailed = true; // NIGHT OVER + + // If you screwed up, kiss your score and ring bonus goodbye. + // But only do this in special stage (and instakill!) In regular stages, wait til we hit the ground. + player->marescore = player->spheres =\ + player->rings = 0; } // Check to see if the player should be killed. @@ -624,13 +625,19 @@ static void P_DeNightserizePlayer(player_t *player) continue; if (mo2->flags2 & MF2_AMBUSH) + { + player->marescore = player->spheres =\ + player->rings = 0; P_DamageMobj(player->mo, NULL, NULL, 1, DMG_INSTAKILL); + } break; } // Restore from drowning music P_RestoreMusic(player); + + P_RunDeNightserizeExecutors(player->mo); } // @@ -790,6 +797,9 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) (player->flyangle > 90 && player->flyangle < 270 ? ANGLE_90 : -ANGLE_90) : (player->flyangle > 90 && player->flyangle < 270 ? -ANGLE_90 : ANGLE_90)); + // Do this before setting CR_NIGHTSMODE so we can tell if player was non-NiGHTS + P_RunNightserizeExecutors(player->mo); + player->powers[pw_carry] = CR_NIGHTSMODE; } @@ -5952,6 +5962,8 @@ static void P_DoNiGHTSCapsule(player_t *player) { INT32 i; + player->capsule->extravalue2++; // tic counter + if (abs(player->mo->x-player->capsule->x) <= 2*FRACUNIT) { P_UnsetThingPosition(player->mo); @@ -6013,6 +6025,9 @@ static void P_DoNiGHTSCapsule(player_t *player) } } + if (player->capsule->extravalue2 <= 0 && player->capsule->health > 0) + P_RunNightsCapsuleTouchExecutors(player->mo, true, player->spheres >= player->capsule->health); // run capsule entrance executors + // Time to blow it up! if (player->mo->x == player->capsule->x && player->mo->y == player->capsule->y @@ -6036,7 +6051,7 @@ static void P_DoNiGHTSCapsule(player_t *player) player->capsule->flags &= ~MF_NOGRAVITY; player->capsule->momz = 5*FRACUNIT; player->capsule->reactiontime = 0; - player->capsule->extravalue1 = -1; + player->capsule->extravalue1 = player->capsule->extravalue2 = -1; for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && !player->exiting && players[i].mare == player->mare) @@ -6105,6 +6120,7 @@ static void P_DoNiGHTSCapsule(player_t *player) P_SetTarget(&players[i].capsule, NULL); // Remove capsule from everyone now that it is dead! S_StartScreamSound(player->mo, sfx_ngdone); P_SwitchSpheresBonusMode(true); + P_RunNightsCapsuleTouchExecutors(player->mo, false, true); // run capsule exit executors, and we destroyed it } } else @@ -6113,7 +6129,8 @@ static void P_DoNiGHTSCapsule(player_t *player) player->texttimer = 4*TICRATE; player->textvar = 3; // Get more rings! player->capsule->reactiontime = 0; - player->capsule->extravalue1 = -1; + player->capsule->extravalue1 = player->capsule->extravalue2 = -1; + P_RunNightsCapsuleTouchExecutors(player->mo, false, false); // run capsule exit executors, and we lacked rings } } else @@ -6666,7 +6683,18 @@ static void P_NiGHTSMovement(player_t *player) S_StartSound(player->mo, sfx_drill1); player->drilltimer = 32; } - else if (--player->drilltimer <= 0) + else if (player->drilltimer == 32) + { + // drill mash penalty + player->drilltimer = 31; + player->drillmeter -= TICRATE/2; + if (player->drillmeter <= 0) + player->drillmeter = TICRATE/10; + } + else if (--player->drilltimer == 11) + // give that drill mash penalty back (after 0.6 seconds) + player->drillmeter += TICRATE/2; + else if (player->drilltimer <= 0) { player->drilltimer = 10; S_StartSound(player->mo, sfx_drill2); @@ -7054,8 +7082,14 @@ static void P_MovePlayer(player_t *player) if (playeringame[i]) players[i].exiting = (14*TICRATE)/5 + 1; } - else if (player->spheres > 0) + else { + // Damage whether or not we have spheres, as player should recoil upon losing points P_DamageMobj(player->mo, NULL, NULL, 1, 0); + + // Now deduct our mare score! + player->marescore = player->spheres =\ + player->rings = 0; + } player->powers[pw_carry] = CR_NONE; } } @@ -8743,9 +8777,15 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall subsector_t *newsubsec; fixed_t f1, f2; - cameranoclip = (player->powers[pw_carry] == CR_NIGHTSMODE || player->pflags & PF_NOCLIP) || (player->mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)); // Noclipping player camera noclips too!! + // We probably shouldn't move the camera if there is no player or player mobj somehow + if (!player || !player->mo) + return true; - if (!(player->climbing || (player->powers[pw_carry] == CR_NIGHTSMODE) || player->playerstate == PST_DEAD)) + mo = player->mo; + + cameranoclip = (player->powers[pw_carry] == CR_NIGHTSMODE || player->pflags & PF_NOCLIP) || (mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)); // Noclipping player camera noclips too!! + + if (!(player->climbing || (player->powers[pw_carry] == CR_NIGHTSMODE) || player->playerstate == PST_DEAD || tutorialmode)) { if (player->spectator) // force cam off for spectators return true; @@ -8764,7 +8804,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall else if (player == &players[secondarydisplayplayer]) focusangle = localangle2; else - focusangle = player->mo->angle; + focusangle = mo->angle; if (thiscam == &camera) camrotate = cv_cam_rotate.value; else if (thiscam == &camera2) @@ -8776,17 +8816,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall return true; } - if (!player || !player->mo) - return true; - - mo = player->mo; - thiscam->radius = FixedMul(20*FRACUNIT, mo->scale); thiscam->height = FixedMul(16*FRACUNIT, mo->scale); - if (!mo) - return true; - // Don't run while respawning from a starpost // Inu 4/8/13 Why not?! // if (leveltime > 0 && timeinmap <= 0) @@ -8794,7 +8826,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (player->powers[pw_carry] == CR_NIGHTSMODE) { - focusangle = player->mo->angle; + focusangle = mo->angle; focusaiming = 0; } else if (player == &players[consoleplayer]) @@ -8809,14 +8841,23 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } else { - focusangle = player->mo->angle; + focusangle = mo->angle; focusaiming = player->aiming; } if (P_CameraThinker(player, thiscam, resetcalled)) return true; - if (thiscam == &camera) + if (tutorialmode) + { + // force defaults because we have a camera look section + camspeed = (INT32)(atof(cv_cam_speed.defaultvalue) * FRACUNIT); + camstill = (!stricmp(cv_cam_still.defaultvalue, "off")) ? false : true; + camrotate = atoi(cv_cam_rotate.defaultvalue); + camdist = FixedMul((INT32)(atof(cv_cam_dist.defaultvalue) * FRACUNIT), mo->scale); + camheight = FixedMul((INT32)(atof(cv_cam_height.defaultvalue) * FRACUNIT), FixedMul(player->camerascale, mo->scale)); + } + else if (thiscam == &camera) { camspeed = cv_cam_speed.value; camstill = cv_cam_still.value; @@ -8856,12 +8897,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall angle = R_PointToAngle2(player->axis1->x, player->axis1->y, player->axis2->x, player->axis2->y); angle += ANGLE_90; } - else if (player->mo->target) + else if (mo->target) { - if (player->mo->target->flags2 & MF2_AMBUSH) - angle = R_PointToAngle2(player->mo->target->x, player->mo->target->y, player->mo->x, player->mo->y); + if (mo->target->flags2 & MF2_AMBUSH) + angle = R_PointToAngle2(mo->target->x, mo->target->y, mo->x, mo->y); else - angle = R_PointToAngle2(player->mo->x, player->mo->y, player->mo->target->x, player->mo->target->y); + angle = R_PointToAngle2(mo->x, mo->y, mo->target->x, mo->target->y); } } else if (P_AnalogMove(player)) // Analog @@ -8950,7 +8991,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (twodlevel || (mo->flags2 & MF2_TWOD)) { // Camera doesn't ALWAYS need to move, only when running... - if (abs(player->mo->momx) > 10) + if (abs(mo->momx) > 10) { // Move the camera all smooth-like, not jerk it around... if (mo->momx > 0) @@ -9257,24 +9298,20 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall // Make player translucent if camera is too close (only in single player). if (!(multiplayer || netgame) && !splitscreen) { - fixed_t vx = 0, vy = 0; - if (player->awayviewtics) { + fixed_t vx = thiscam->x, vy = thiscam->y; + if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist + { vx = player->awayviewmobj->x; vy = player->awayviewmobj->y; } - else - { - vx = thiscam->x; - vy = thiscam->y; - } - if (P_AproxDistance(vx - player->mo->x, vy - player->mo->y) < FixedMul(48*FRACUNIT, mo->scale)) - player->mo->flags2 |= MF2_SHADOW; + if (P_AproxDistance(vx - mo->x, vy - mo->y) < FixedMul(48*FRACUNIT, mo->scale)) + mo->flags2 |= MF2_SHADOW; else - player->mo->flags2 &= ~MF2_SHADOW; + mo->flags2 &= ~MF2_SHADOW; } else - player->mo->flags2 &= ~MF2_SHADOW; + mo->flags2 &= ~MF2_SHADOW; /* if (!resetcalled && (player->powers[pw_carry] == CR_NIGHTSMODE && player->exiting)) { @@ -9589,8 +9626,9 @@ void P_PlayerThink(player_t *player) if (player->flashcount) player->flashcount--; - if (player->awayviewtics) - player->awayviewtics--; + // By the time P_MoveChaseCamera is called, this might be zero. Do not do it here. + //if (player->awayviewtics) + // player->awayviewtics--; /// \note do this in the cheat code if (player->pflags & PF_NOCLIP) @@ -9787,12 +9825,18 @@ void P_PlayerThink(player_t *player) || mo2->type == MT_NIGHTSCHIP || mo2->type == MT_NIGHTSSTAR)) continue; + if (mo2->flags2 & MF2_NIGHTSPULL) + continue; + if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > FixedMul(128*FRACUNIT, player->mo->scale)) continue; // Yay! The thing's in reach! Pull it in! mo2->flags |= MF_NOCLIP|MF_NOCLIPHEIGHT; mo2->flags2 |= MF2_NIGHTSPULL; + // New NiGHTS attract speed dummied out because the older behavior + // is exploited as a mechanic. Uncomment to enable. + mo2->movefactor = 0; // 40*FRACUNIT; // initialize the NightsItemChase timer P_SetTarget(&mo2->tracer, player->mo); } } @@ -10557,6 +10601,9 @@ void P_PlayerAfterThink(player_t *player) } } + if (player->awayviewtics) + player->awayviewtics--; + // spectator invisibility and nogravity. if ((netgame || multiplayer) && player->spectator) { diff --git a/src/r_bsp.c b/src/r_bsp.c index 183def25a..cbb012b28 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -234,8 +234,6 @@ static INT32 R_DoorClosed(void) sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, INT32 *ceilinglightlevel, boolean back) { - INT32 mapnum = -1; - if (floorlightlevel) *floorlightlevel = sec->floorlightsec == -1 ? sec->lightlevel : sectors[sec->floorlightsec].lightlevel; @@ -244,10 +242,10 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, *ceilinglightlevel = sec->ceilinglightsec == -1 ? sec->lightlevel : sectors[sec->ceilinglightsec].lightlevel; - // If the sector has a midmap, it's probably from 280 type - if (sec->midmap != -1) - mapnum = sec->midmap; - else if (sec->heightsec != -1) + // if (sec->midmap != -1) + // mapnum = sec->midmap; + // In original colormap code, this block did not run if sec->midmap was set + if (!sec->extra_colormap && sec->heightsec != -1) { const sector_t *s = §ors[sec->heightsec]; mobj_t *viewmobj = viewplayer->mo; @@ -271,8 +269,6 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, tempsec->floorheight = s->floorheight; tempsec->ceilingheight = s->ceilingheight; - mapnum = s->midmap; - if ((underwater && (tempsec-> floorheight = sec->floorheight, tempsec->ceilingheight = s->floorheight - 1, !back)) || viewz <= s->floorheight) { // head-below-floor hack @@ -298,7 +294,6 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, tempsec->ceiling_yoffs = s->ceiling_yoffs; tempsec->ceilingpic_angle = s->ceilingpic_angle; } - mapnum = s->bottommap; } tempsec->lightlevel = s->lightlevel; @@ -322,8 +317,6 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, tempsec->floor_yoffs = tempsec->ceiling_yoffs = s->ceiling_yoffs; tempsec->floorpic_angle = tempsec->ceilingpic_angle = s->ceilingpic_angle; - mapnum = s->topmap; - if (s->floorpic == skyflatnum) // SKYFIX? { tempsec->ceilingheight = tempsec->floorheight-1; @@ -354,11 +347,6 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, sec = tempsec; } - if (mapnum >= 0 && (size_t)mapnum < num_extra_colormaps) - sec->extra_colormap = &extra_colormaps[mapnum]; - else - sec->extra_colormap = NULL; - return sec; } @@ -937,11 +925,11 @@ static void R_Subsector(size_t num) light = R_GetPlaneLight(frontsector, floorcenterz, false); if (frontsector->floorlightsec == -1) floorlightlevel = *frontsector->lightlist[light].lightlevel; - floorcolormap = frontsector->lightlist[light].extra_colormap; + floorcolormap = *frontsector->lightlist[light].extra_colormap; light = R_GetPlaneLight(frontsector, ceilingcenterz, false); if (frontsector->ceilinglightsec == -1) ceilinglightlevel = *frontsector->lightlist[light].lightlevel; - ceilingcolormap = frontsector->lightlist[light].extra_colormap; + ceilingcolormap = *frontsector->lightlist[light].extra_colormap; } sub->sector->extra_colormap = frontsector->extra_colormap; @@ -1038,7 +1026,7 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic, *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, - *rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover + *rover->bottomyoffs, *rover->bottomangle, *frontsector->lightlist[light].extra_colormap, rover #ifdef POLYOBJECTS_PLANES , NULL #endif @@ -1084,7 +1072,7 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic, *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle, - frontsector->lightlist[light].extra_colormap, rover + *frontsector->lightlist[light].extra_colormap, rover #ifdef POLYOBJECTS_PLANES , NULL #endif @@ -1237,7 +1225,7 @@ void R_Prep3DFloors(sector_t *sector) ffloor_t *rover; ffloor_t *best; fixed_t bestheight, maxheight; - INT32 count, i, mapnum; + INT32 count, i; sector_t *sec; #ifdef ESLOPE pslope_t *bestslope = NULL; @@ -1276,7 +1264,7 @@ void R_Prep3DFloors(sector_t *sector) #endif sector->lightlist[0].lightlevel = §or->lightlevel; sector->lightlist[0].caster = NULL; - sector->lightlist[0].extra_colormap = sector->extra_colormap; + sector->lightlist[0].extra_colormap = §or->extra_colormap; sector->lightlist[0].flags = 0; maxheight = INT32_MAX; @@ -1342,11 +1330,6 @@ void R_Prep3DFloors(sector_t *sector) sector->lightlist[i].slope = bestslope; #endif sec = §ors[best->secnum]; - mapnum = sec->midmap; - if (mapnum >= 0 && (size_t)mapnum < num_extra_colormaps) - sec->extra_colormap = &extra_colormaps[mapnum]; - else - sec->extra_colormap = NULL; if (best->flags & FF_NOSHADE) { @@ -1356,12 +1339,12 @@ void R_Prep3DFloors(sector_t *sector) else if (best->flags & FF_COLORMAPONLY) { sector->lightlist[i].lightlevel = sector->lightlist[i-1].lightlevel; - sector->lightlist[i].extra_colormap = sec->extra_colormap; + sector->lightlist[i].extra_colormap = &sec->extra_colormap; } else { sector->lightlist[i].lightlevel = best->toplightlevel; - sector->lightlist[i].extra_colormap = sec->extra_colormap; + sector->lightlist[i].extra_colormap = &sec->extra_colormap; } if (best->flags & FF_DOUBLESHADOW) diff --git a/src/r_data.c b/src/r_data.c index 6aede0396..08e3d91b6 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1144,6 +1144,10 @@ void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *texindex) Z_Free((void *)texturesText); } +#ifdef EXTRACOLORMAPLUMPS +static lumplist_t *colormaplumps = NULL; ///\todo free leak +static size_t numcolormaplumps = 0; + static inline lumpnum_t R_CheckNumForNameList(const char *name, lumplist_t *list, size_t listsize) { size_t i; @@ -1160,9 +1164,6 @@ static inline lumpnum_t R_CheckNumForNameList(const char *name, lumplist_t *list return LUMPERROR; } -static lumplist_t *colormaplumps = NULL; ///\todo free leak -static size_t numcolormaplumps = 0; - static void R_InitExtraColormaps(void) { lumpnum_t startnum, endnum; @@ -1195,6 +1196,7 @@ static void R_InitExtraColormaps(void) } CONS_Printf(M_GetText("Number of Extra Colormaps: %s\n"), sizeu1(numcolormaplumps)); } +#endif // Search for flat name through all lumpnum_t R_GetFlatNumForName(const char *name) @@ -1291,7 +1293,9 @@ static void R_InitColormaps(void) // Init Boom colormaps. R_ClearColormaps(); +#ifdef EXTRACOLORMAPLUMPS R_InitExtraColormaps(); +#endif } void R_ReInitColormaps(UINT16 num) @@ -1311,11 +1315,6 @@ void R_ReInitColormaps(UINT16 num) R_ClearColormaps(); } -static lumpnum_t foundcolormaps[MAXCOLORMAPS]; - -static char colormapFixingArray[MAXCOLORMAPS][3][9]; -static size_t carrayindex; - // // R_ClearColormaps // @@ -1323,51 +1322,264 @@ static size_t carrayindex; // void R_ClearColormaps(void) { - size_t i; - - num_extra_colormaps = 0; - - carrayindex = 0; - - for (i = 0; i < MAXCOLORMAPS; i++) - foundcolormaps[i] = LUMPERROR; - - memset(extra_colormaps, 0, sizeof (extra_colormaps)); + // Purged by PU_LEVEL, just overwrite the pointer + extra_colormaps = R_CreateDefaultColormap(true); } -INT32 R_ColormapNumForName(char *name) +// +// R_CreateDefaultColormap() +// NOTE: The result colormap is not added to the extra_colormaps chain. You must do that yourself! +// +extracolormap_t *R_CreateDefaultColormap(boolean lighttable) { - lumpnum_t lump, i; + extracolormap_t *exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL); + exc->fadestart = 0; + exc->fadeend = 31; + exc->fog = 0; + exc->rgba = 0; + exc->fadergba = 0x19000000; + exc->colormap = lighttable ? R_CreateLightTable(exc) : NULL; +#ifdef EXTRACOLORMAPLUMPS + exc->lump = LUMPERROR; + exc->lumpname[0] = 0; +#endif + exc->next = exc->prev = NULL; + return exc; +} - if (num_extra_colormaps == MAXCOLORMAPS) - I_Error("R_ColormapNumForName: Too many colormaps! the limit is %d\n", MAXCOLORMAPS); +// +// R_GetDefaultColormap() +// +extracolormap_t *R_GetDefaultColormap(void) +{ +#ifdef COLORMAPREVERSELIST + extracolormap_t *exc; +#endif + + if (!extra_colormaps) + return (extra_colormaps = R_CreateDefaultColormap(true)); + +#ifdef COLORMAPREVERSELIST + for (exc = extra_colormaps; exc->next; exc = exc->next); + return exc; +#else + return extra_colormaps; +#endif +} + +// +// R_CopyColormap() +// NOTE: The result colormap is not added to the extra_colormaps chain. You must do that yourself! +// +extracolormap_t *R_CopyColormap(extracolormap_t *extra_colormap, boolean lighttable) +{ + extracolormap_t *exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL); + + if (!extra_colormap) + extra_colormap = R_GetDefaultColormap(); + + *exc = *extra_colormap; + exc->next = exc->prev = NULL; + +#ifdef EXTRACOLORMAPLUMPS + strncpy(exc->lumpname, extra_colormap->lumpname, 9); + + if (exc->lump != LUMPERROR && lighttable) + { + // aligned on 8 bit for asm code + exc->colormap = Z_MallocAlign(W_LumpLength(lump), PU_LEVEL, NULL, 16); + W_ReadLump(lump, exc->colormap); + } + else +#endif + if (lighttable) + exc->colormap = R_CreateLightTable(exc); + else + exc->colormap = NULL; + + return exc; +} + +// +// R_AddColormapToList +// +// Sets prev/next chain for extra_colormaps var +// Copypasta from P_AddFFloorToList +// +void R_AddColormapToList(extracolormap_t *extra_colormap) +{ +#ifndef COLORMAPREVERSELIST + extracolormap_t *exc; +#endif + + if (!extra_colormaps) + { + extra_colormaps = extra_colormap; + extra_colormap->next = 0; + extra_colormap->prev = 0; + return; + } + +#ifdef COLORMAPREVERSELIST + extra_colormaps->prev = extra_colormap; + extra_colormap->next = extra_colormaps; + extra_colormaps = extra_colormap; + extra_colormap->prev = 0; +#else + for (exc = extra_colormaps; exc->next; exc = exc->next); + + exc->next = extra_colormap; + extra_colormap->prev = exc; + extra_colormap->next = 0; +#endif +} + +// +// R_CheckDefaultColormapByValues() +// +#ifdef EXTRACOLORMAPLUMPS +boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, + INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog, lumpnum_t lump) +#else +boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, + INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog) +#endif +{ + return ( + (!checkparams ? true : + (fadestart == 0 + && fadeend == 31 + && !fog) + ) + && (!checkrgba ? true : rgba == 0) + && (!checkfadergba ? true : fadergba == 0x19000000) +#ifdef EXTRACOLORMAPLUMPS + && lump == LUMPERROR + && extra_colormap->lumpname[0] == 0 +#endif + ); +} + +boolean R_CheckDefaultColormap(extracolormap_t *extra_colormap, boolean checkrgba, boolean checkfadergba, boolean checkparams) +{ + if (!extra_colormap) + return true; + +#ifdef EXTRACOLORMAPLUMPS + return R_CheckDefaultColormapByValues(checkrgba, checkfadergba, checkparams, extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->fog, extra_colormap->lump); +#else + return R_CheckDefaultColormapByValues(checkrgba, checkfadergba, checkparams, extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->fog); +#endif +} + +boolean R_CheckEqualColormaps(extracolormap_t *exc_a, extracolormap_t *exc_b, boolean checkrgba, boolean checkfadergba, boolean checkparams) +{ + // Treat NULL as default colormap + // We need this because what if one exc is a default colormap, and the other is NULL? They're really both equal. + if (!exc_a) + exc_a = R_GetDefaultColormap(); + if (!exc_b) + exc_b = R_GetDefaultColormap(); + + if (exc_a == exc_b) + return true; + + return ( + (!checkparams ? true : + (exc_a->fadestart == exc_b->fadestart + && exc_a->fadeend == exc_b->fadeend + && exc_a->fog == exc_b->fog) + ) + && (!checkrgba ? true : exc_a->rgba == exc_b->rgba) + && (!checkfadergba ? true : exc_a->fadergba == exc_b->fadergba) +#ifdef EXTRACOLORMAPLUMPS + && exc_a->lump == exc_b->lump + && !strncmp(exc_a->lumpname, exc_b->lumpname, 9) +#endif + ); +} + +// +// R_GetColormapFromListByValues() +// NOTE: Returns NULL if no match is found +// +#ifdef EXTRACOLORMAPLUMPS +extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog, lumpnum_t lump) +#else +extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog) +#endif +{ + extracolormap_t *exc; + UINT32 dbg_i = 0; + + for (exc = extra_colormaps; exc; exc = exc->next) + { + if (rgba == exc->rgba + && fadergba == exc->fadergba + && fadestart == exc->fadestart + && fadeend == exc->fadeend + && fog == exc->fog +#ifdef EXTRACOLORMAPLUMPS + && (lump != LUMPERROR && lump == exc->lump) +#endif + ) + { + CONS_Debug(DBG_RENDER, "Found Colormap %d: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n", + dbg_i, R_GetRgbaR(rgba), R_GetRgbaG(rgba), R_GetRgbaB(rgba), R_GetRgbaA(rgba), + R_GetRgbaR(fadergba), R_GetRgbaG(fadergba), R_GetRgbaB(fadergba), R_GetRgbaA(fadergba)); + return exc; + } + dbg_i++; + } + return NULL; +} + +extracolormap_t *R_GetColormapFromList(extracolormap_t *extra_colormap) +{ +#ifdef EXTRACOLORMAPLUMPS + return R_GetColormapFromListByValues(extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->fog, extra_colormap->lump); +#else + return R_GetColormapFromListByValues(extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->fog); +#endif +} + +#ifdef EXTRACOLORMAPLUMPS +extracolormap_t *R_ColormapForName(char *name) +{ + lumpnum_t lump; + extracolormap_t *exc; lump = R_CheckNumForNameList(name, colormaplumps, numcolormaplumps); if (lump == LUMPERROR) - I_Error("R_ColormapNumForName: Cannot find colormap lump %.8s\n", name); + I_Error("R_ColormapForName: Cannot find colormap lump %.8s\n", name); - for (i = 0; i < num_extra_colormaps; i++) - if (lump == foundcolormaps[i]) - return i; + exc = R_GetColormapFromListByValues(0, 0x19000000, 0, 31, 0, lump); + if (exc) + return exc; - foundcolormaps[num_extra_colormaps] = lump; + exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL); + + exc->lump = lump; + strncpy(exc->lumpname, name, 9); + exc->lumpname[8] = 0; // aligned on 8 bit for asm code - extra_colormaps[num_extra_colormaps].colormap = Z_MallocAlign(W_LumpLength(lump), PU_LEVEL, NULL, 16); - W_ReadLump(lump, extra_colormaps[num_extra_colormaps].colormap); + exc->colormap = Z_MallocAlign(W_LumpLength(lump), PU_LEVEL, NULL, 16); + W_ReadLump(lump, exc->colormap); // We set all params of the colormap to normal because there // is no real way to tell how GL should handle a colormap lump anyway.. - extra_colormaps[num_extra_colormaps].maskcolor = 0xffff; - extra_colormaps[num_extra_colormaps].fadecolor = 0x0; - extra_colormaps[num_extra_colormaps].maskamt = 0x0; - extra_colormaps[num_extra_colormaps].fadestart = 0; - extra_colormaps[num_extra_colormaps].fadeend = 31; - extra_colormaps[num_extra_colormaps].fog = 0; + exc->fadestart = 0; + exc->fadeend = 31; + exc->fog = 0; + exc->rgba = 0; + exc->fadergba = 0x19000000; - num_extra_colormaps++; - return (INT32)num_extra_colormaps - 1; + R_AddColormapToList(exc); + + return exc; } +#endif // // R_CreateColormap @@ -1382,244 +1594,71 @@ static double deltas[256][3], map[256][3]; static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b); static int RoundUp(double number); -INT32 R_CreateColormap(char *p1, char *p2, char *p3) +lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap) { double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb; - double r, g, b, cbrightness, maskamt = 0, othermask = 0; - int mask, fog = 0; - size_t mapnum = num_extra_colormaps; - size_t i; - UINT32 cr, cg, cb, maskcolor, fadecolor; - UINT32 fadestart = 0, fadeend = 31, fadedist = 31; - -#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0) - if (p1[0] == '#') - { - cr = ((HEX2INT(p1[1]) * 16) + HEX2INT(p1[2])); - cmaskr = cr; - cg = ((HEX2INT(p1[3]) * 16) + HEX2INT(p1[4])); - cmaskg = cg; - cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6])); - cmaskb = cb; - // Create a rough approximation of the color (a 16 bit color) - maskcolor = ((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11); - if (p1[7] >= 'a' && p1[7] <= 'z') - mask = (p1[7] - 'a'); - else if (p1[7] >= 'A' && p1[7] <= 'Z') - mask = (p1[7] - 'A'); - else - mask = 24; - - maskamt = (double)(mask/24.0l); - - othermask = 1 - maskamt; - maskamt /= 0xff; - cmaskr *= maskamt; - cmaskg *= maskamt; - cmaskb *= maskamt; - } - else - { - cmaskr = cmaskg = cmaskb = 0xff; - maskamt = 0; - maskcolor = ((0xff) >> 3) + (((0xff) >> 2) << 5) + (((0xff) >> 3) << 11); - } - -#define NUMFROMCHAR(c) (c >= '0' && c <= '9' ? c - '0' : 0) - if (p2[0] == '#') - { - // Get parameters like fadestart, fadeend, and the fogflag - fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10); - fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10); - if (fadestart > 30) - fadestart = 0; - if (fadeend > 31 || fadeend < 1) - fadeend = 31; - fadedist = fadeend - fadestart; - fog = NUMFROMCHAR(p2[1]); - } -#undef getnum - - if (p3[0] == '#') - { - cdestr = cr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2])); - cdestg = cg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4])); - cdestb = cb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6])); - fadecolor = (((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11)); - } - else - cdestr = cdestg = cdestb = fadecolor = 0; -#undef HEX2INT - - for (i = 0; i < num_extra_colormaps; i++) - { - if (foundcolormaps[i] != LUMPERROR) - continue; - if (maskcolor == extra_colormaps[i].maskcolor - && fadecolor == extra_colormaps[i].fadecolor - && (float)maskamt == (float)extra_colormaps[i].maskamt - && fadestart == extra_colormaps[i].fadestart - && fadeend == extra_colormaps[i].fadeend - && fog == extra_colormaps[i].fog) - { - return (INT32)i; - } - } - - if (num_extra_colormaps == MAXCOLORMAPS) - I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS); - - strncpy(colormapFixingArray[num_extra_colormaps][0], p1, 8); - strncpy(colormapFixingArray[num_extra_colormaps][1], p2, 8); - strncpy(colormapFixingArray[num_extra_colormaps][2], p3, 8); - - num_extra_colormaps++; - - if (rendermode == render_soft) - { - for (i = 0; i < 256; i++) - { - r = pMasterPalette[i].s.red; - g = pMasterPalette[i].s.green; - b = pMasterPalette[i].s.blue; - cbrightness = sqrt((r*r) + (g*g) + (b*b)); - - map[i][0] = (cbrightness * cmaskr) + (r * othermask); - if (map[i][0] > 255.0l) - map[i][0] = 255.0l; - deltas[i][0] = (map[i][0] - cdestr) / (double)fadedist; - - map[i][1] = (cbrightness * cmaskg) + (g * othermask); - if (map[i][1] > 255.0l) - map[i][1] = 255.0l; - deltas[i][1] = (map[i][1] - cdestg) / (double)fadedist; - - map[i][2] = (cbrightness * cmaskb) + (b * othermask); - if (map[i][2] > 255.0l) - map[i][2] = 255.0l; - deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist; - } - } - - foundcolormaps[mapnum] = LUMPERROR; - - // aligned on 8 bit for asm code - extra_colormaps[mapnum].colormap = NULL; - extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor; - extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor; - extra_colormaps[mapnum].maskamt = maskamt; - extra_colormaps[mapnum].fadestart = (UINT16)fadestart; - extra_colormaps[mapnum].fadeend = (UINT16)fadeend; - extra_colormaps[mapnum].fog = fog; - - return (INT32)mapnum; -} - -void R_MakeColormaps(void) -{ - size_t i; - - carrayindex = num_extra_colormaps; - num_extra_colormaps = 0; - - for (i = 0; i < carrayindex; i++) - R_CreateColormap2(colormapFixingArray[i][0], colormapFixingArray[i][1], - colormapFixingArray[i][2]); -} - -void R_CreateColormap2(char *p1, char *p2, char *p3) -{ - double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb; - double r, g, b, cbrightness; double maskamt = 0, othermask = 0; - int mask, p, fog = 0; - size_t mapnum = num_extra_colormaps; + + UINT8 cr = R_GetRgbaR(extra_colormap->rgba), + cg = R_GetRgbaG(extra_colormap->rgba), + cb = R_GetRgbaB(extra_colormap->rgba), + ca = R_GetRgbaA(extra_colormap->rgba), + cfr = R_GetRgbaR(extra_colormap->fadergba), + cfg = R_GetRgbaG(extra_colormap->fadergba), + cfb = R_GetRgbaB(extra_colormap->fadergba); +// cfa = R_GetRgbaA(extra_colormap->fadergba); // unused in software + + UINT8 fadestart = extra_colormap->fadestart, + fadedist = extra_colormap->fadeend - extra_colormap->fadestart; + + lighttable_t *lighttable = NULL; size_t i; - char *colormap_p; - UINT32 cr, cg, cb, maskcolor, fadecolor; - UINT32 fadestart = 0, fadeend = 31, fadedist = 31; -#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0) - if (p1[0] == '#') - { - cr = ((HEX2INT(p1[1]) * 16) + HEX2INT(p1[2])); - cmaskr = cr; - cg = ((HEX2INT(p1[3]) * 16) + HEX2INT(p1[4])); - cmaskg = cg; - cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6])); - cmaskb = cb; - // Create a rough approximation of the color (a 16 bit color) - maskcolor = ((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11); - if (p1[7] >= 'a' && p1[7] <= 'z') - mask = (p1[7] - 'a'); - else if (p1[7] >= 'A' && p1[7] <= 'Z') - mask = (p1[7] - 'A'); - else - mask = 24; + ///////////////////// + // Calc the RGBA mask + ///////////////////// + cmaskr = cr; + cmaskg = cg; + cmaskb = cb; - maskamt = (double)(mask/24.0l); + maskamt = (double)(ca/24.0l); + othermask = 1 - maskamt; + maskamt /= 0xff; - othermask = 1 - maskamt; - maskamt /= 0xff; - cmaskr *= maskamt; - cmaskg *= maskamt; - cmaskb *= maskamt; - } - else - { - cmaskr = cmaskg = cmaskb = 0xff; - maskamt = 0; - maskcolor = ((0xff) >> 3) + (((0xff) >> 2) << 5) + (((0xff) >> 3) << 11); - } + cmaskr *= maskamt; + cmaskg *= maskamt; + cmaskb *= maskamt; -#define NUMFROMCHAR(c) (c >= '0' && c <= '9' ? c - '0' : 0) - if (p2[0] == '#') - { - // Get parameters like fadestart, fadeend, and the fogflag - fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10); - fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10); - if (fadestart > 30) - fadestart = 0; - if (fadeend > 31 || fadeend < 1) - fadeend = 31; - fadedist = fadeend - fadestart; - fog = NUMFROMCHAR(p2[1]); - } -#undef getnum + ///////////////////// + // Calc the RGBA fade mask + ///////////////////// + cdestr = cfr; + cdestg = cfg; + cdestb = cfb; - if (p3[0] == '#') - { - cdestr = cr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2])); - cdestg = cg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4])); - cdestb = cb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6])); - fadecolor = (((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11)); - } - else - cdestr = cdestg = cdestb = fadecolor = 0; -#undef HEX2INT + // fade alpha unused in software + // maskamt = (double)(cfa/24.0l); + // othermask = 1 - maskamt; + // maskamt /= 0xff; - for (i = 0; i < num_extra_colormaps; i++) - { - if (foundcolormaps[i] != LUMPERROR) - continue; - if (maskcolor == extra_colormaps[i].maskcolor - && fadecolor == extra_colormaps[i].fadecolor - && (float)maskamt == (float)extra_colormaps[i].maskamt - && fadestart == extra_colormaps[i].fadestart - && fadeend == extra_colormaps[i].fadeend - && fog == extra_colormaps[i].fog) - { - return; - } - } - - if (num_extra_colormaps == MAXCOLORMAPS) - I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS); - - num_extra_colormaps++; + // cdestr *= maskamt; + // cdestg *= maskamt; + // cdestb *= maskamt; + ///////////////////// + // This code creates the colormap array used by software renderer + ///////////////////// if (rendermode == render_soft) { + double r, g, b, cbrightness; + int p; + char *colormap_p; + + // Initialise the map and delta arrays + // map[i] stores an RGB color (as double) for index i, + // which is then converted to SRB2's palette later + // deltas[i] stores a corresponding fade delta between the RGB color and the final fade color; + // map[i]'s values are decremented by after each use for (i = 0; i < 256; i++) { r = pMasterPalette[i].s.red; @@ -1642,25 +1681,14 @@ void R_CreateColormap2(char *p1, char *p2, char *p3) map[i][2] = 255.0l; deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist; } - } - foundcolormaps[mapnum] = LUMPERROR; - - // aligned on 8 bit for asm code - extra_colormaps[mapnum].colormap = NULL; - extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor; - extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor; - extra_colormaps[mapnum].maskamt = maskamt; - extra_colormaps[mapnum].fadestart = (UINT16)fadestart; - extra_colormaps[mapnum].fadeend = (UINT16)fadeend; - extra_colormaps[mapnum].fog = fog; - -#define ABS2(x) ((x) < 0 ? -(x) : (x)) - if (rendermode == render_soft) - { + // Now allocate memory for the actual colormap array itself! + // aligned on 8 bit for asm code colormap_p = Z_MallocAlign((256 * 34) + 10, PU_LEVEL, NULL, 8); - extra_colormaps[mapnum].colormap = (UINT8 *)colormap_p; + lighttable = (UINT8 *)colormap_p; + // Calculate the palette index for each palette index, for each light level + // (as well as the two unused colormap lines we inherited from Doom) for (p = 0; p < 34; p++) { for (i = 0; i < 256; i++) @@ -1672,7 +1700,7 @@ void R_CreateColormap2(char *p1, char *p2, char *p3) if ((UINT32)p < fadestart) continue; - +#define ABS2(x) ((x) < 0 ? -(x) : (x)) if (ABS2(map[i][0] - cdestr) > ABS2(deltas[i][0])) map[i][0] -= deltas[i][0]; else @@ -1687,12 +1715,290 @@ void R_CreateColormap2(char *p1, char *p2, char *p3) map[i][2] -= deltas[i][2]; else map[i][2] = cdestb; +#undef ABS2 } } } -#undef ABS2 - return; + return lighttable; +} + +extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3) +{ + extracolormap_t *extra_colormap, *exc; + + // default values + UINT8 cr = 0, cg = 0, cb = 0, ca = 0, cfr = 0, cfg = 0, cfb = 0, cfa = 25; + UINT32 fadestart = 0, fadeend = 31; + UINT8 fog = 0; + INT32 rgba = 0, fadergba = 0x19000000; + +#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0) +#define ALPHA2INT(x) (x >= 'a' && x <= 'z' ? x - 'a' : x >= 'A' && x <= 'Z' ? x - 'A' : x >= '0' && x <= '9' ? 25 : 0) + + // Get base colormap value + // First alpha-only, then full value + if (p1[0] >= 'a' && p1[0] <= 'z' && !p1[1]) + ca = (p1[0] - 'a'); + else if (p1[0] == '#' && p1[1] >= 'a' && p1[1] <= 'z' && !p1[2]) + ca = (p1[1] - 'a'); + else if (p1[0] >= 'A' && p1[0] <= 'Z' && !p1[1]) + ca = (p1[0] - 'A'); + else if (p1[0] == '#' && p1[1] >= 'A' && p1[1] <= 'Z' && !p1[2]) + ca = (p1[1] - 'A'); + else if (p1[0] == '#') + { + // For each subsequent value, the value before it must exist + // If we don't get every value, then set alpha to max + if (p1[1] && p1[2]) + { + cr = ((HEX2INT(p1[1]) * 16) + HEX2INT(p1[2])); + if (p1[3] && p1[4]) + { + cg = ((HEX2INT(p1[3]) * 16) + HEX2INT(p1[4])); + if (p1[5] && p1[6]) + { + cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6])); + + if (p1[7] >= 'a' && p1[7] <= 'z') + ca = (p1[7] - 'a'); + else if (p1[7] >= 'A' && p1[7] <= 'Z') + ca = (p1[7] - 'A'); + else + ca = 25; + } + else + ca = 25; + } + else + ca = 25; + } + else + ca = 25; + } + +#define NUMFROMCHAR(c) (c >= '0' && c <= '9' ? c - '0' : 0) + + // Get parameters like fadestart, fadeend, and the fogflag + if (p2[0] == '#') + { + if (p2[1]) + { + fog = NUMFROMCHAR(p2[1]); + if (p2[2] && p2[3]) + { + fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10); + if (p2[4] && p2[5]) + fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10); + } + } + + if (fadestart > 30) + fadestart = 0; + if (fadeend > 31 || fadeend < 1) + fadeend = 31; + } + +#undef NUMFROMCHAR + + // Get fade (dark) colormap value + // First alpha-only, then full value + if (p3[0] >= 'a' && p3[0] <= 'z' && !p3[1]) + cfa = (p3[0] - 'a'); + else if (p3[0] == '#' && p3[1] >= 'a' && p3[1] <= 'z' && !p3[2]) + cfa = (p3[1] - 'a'); + else if (p3[0] >= 'A' && p3[0] <= 'Z' && !p3[1]) + cfa = (p3[0] - 'A'); + else if (p3[0] == '#' && p3[1] >= 'A' && p3[1] <= 'Z' && !p3[2]) + cfa = (p3[1] - 'A'); + else if (p3[0] == '#') + { + // For each subsequent value, the value before it must exist + // If we don't get every value, then set alpha to max + if (p3[1] && p3[2]) + { + cfr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2])); + if (p3[3] && p3[4]) + { + cfg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4])); + if (p3[5] && p3[6]) + { + cfb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6])); + + if (p3[7] >= 'a' && p3[7] <= 'z') + cfa = (p3[7] - 'a'); + else if (p3[7] >= 'A' && p3[7] <= 'Z') + cfa = (p3[7] - 'A'); + else + cfa = 25; + } + else + cfa = 25; + } + else + cfa = 25; + } + else + cfa = 25; + } +#undef ALPHA2INT +#undef HEX2INT + + // Pack rgba values into combined var + // OpenGL also uses this instead of lighttables for rendering + rgba = R_PutRgbaRGBA(cr, cg, cb, ca); + fadergba = R_PutRgbaRGBA(cfr, cfg, cfb, cfa); + + // Did we just make a default colormap? +#ifdef EXTRACOLORMAPLUMPS + if (R_CheckDefaultColormapByValues(true, true, true, rgba, fadergba, fadestart, fadeend, fog, LUMPERROR)) + return NULL; +#else + if (R_CheckDefaultColormapByValues(true, true, true, rgba, fadergba, fadestart, fadeend, fog)) + return NULL; +#endif + + // Look for existing colormaps +#ifdef EXTRACOLORMAPLUMPS + exc = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, fog, LUMPERROR); +#else + exc = R_GetColormapFromListByValues(rgba, fadergba, fadestart, fadeend, fog); +#endif + if (exc) + return exc; + + CONS_Debug(DBG_RENDER, "Creating Colormap: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n", + cr, cg, cb, ca, cfr, cfg, cfb, cfa); + + extra_colormap = Z_Calloc(sizeof (*extra_colormap), PU_LEVEL, NULL); + + extra_colormap->fadestart = (UINT16)fadestart; + extra_colormap->fadeend = (UINT16)fadeend; + extra_colormap->fog = fog; + + extra_colormap->rgba = rgba; + extra_colormap->fadergba = fadergba; + +#ifdef EXTRACOLORMAPLUMPS + extra_colormap->lump = LUMPERROR; + extra_colormap->lumpname[0] = 0; +#endif + + // Having lighttables for alpha-only entries is kind of pointless, + // but if there happens to be a matching rgba entry that is NOT alpha-only (but has same rgb values), + // then it needs this lighttable because we share matching entries. + extra_colormap->colormap = R_CreateLightTable(extra_colormap); + + R_AddColormapToList(extra_colormap); + + return extra_colormap; +} + +// +// R_AddColormaps() +// NOTE: The result colormap is not added to the extra_colormaps chain. You must do that yourself! +// +extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *exc_addend, + boolean subR, boolean subG, boolean subB, boolean subA, + boolean subFadeR, boolean subFadeG, boolean subFadeB, boolean subFadeA, + boolean subFadeStart, boolean subFadeEnd, boolean ignoreFog, + boolean useAltAlpha, INT16 altAlpha, INT16 altFadeAlpha, + boolean lighttable) +{ + INT16 red, green, blue, alpha; + + // exc_augend is added (or subtracted) onto by exc_addend + // In Rennaisance times, the first number was considered the augend, the second number the addend + // But since the commutative property was discovered, today they're both called addends! + // So let's be Olde English for a hot second. + + exc_augend = R_CopyColormap(exc_augend, false); + if(!exc_addend) + exc_addend = R_GetDefaultColormap(); + + /////////////////// + // base rgba + /////////////////// + + red = max(min( + R_GetRgbaR(exc_augend->rgba) + + (subR ? -1 : 1) // subtract R + * R_GetRgbaR(exc_addend->rgba) + , 255), 0); + + green = max(min( + R_GetRgbaG(exc_augend->rgba) + + (subG ? -1 : 1) // subtract G + * R_GetRgbaG(exc_addend->rgba) + , 255), 0); + + blue = max(min( + R_GetRgbaB(exc_augend->rgba) + + (subB ? -1 : 1) // subtract B + * R_GetRgbaB(exc_addend->rgba) + , 255), 0); + + alpha = useAltAlpha ? altAlpha : R_GetRgbaA(exc_addend->rgba); + alpha = max(min(R_GetRgbaA(exc_augend->rgba) + (subA ? -1 : 1) * alpha, 25), 0); + + exc_augend->rgba = R_PutRgbaRGBA(red, green, blue, alpha); + + /////////////////// + // fade/dark rgba + /////////////////// + + red = max(min( + R_GetRgbaR(exc_augend->fadergba) + + (subFadeR ? -1 : 1) // subtract R + * R_GetRgbaR(exc_addend->fadergba) + , 255), 0); + + green = max(min( + R_GetRgbaG(exc_augend->fadergba) + + (subFadeG ? -1 : 1) // subtract G + * R_GetRgbaG(exc_addend->fadergba) + , 255), 0); + + blue = max(min( + R_GetRgbaB(exc_augend->fadergba) + + (subFadeB ? -1 : 1) // subtract B + * R_GetRgbaB(exc_addend->fadergba) + , 255), 0); + + alpha = useAltAlpha ? altFadeAlpha : R_GetRgbaA(exc_addend->fadergba); + if (alpha == 25 && !useAltAlpha && !R_GetRgbaRGB(exc_addend->fadergba)) + alpha = 0; // HACK: fadergba A defaults at 25, so don't add anything in this case + alpha = max(min(R_GetRgbaA(exc_augend->fadergba) + (subFadeA ? -1 : 1) * alpha, 25), 0); + + exc_augend->fadergba = R_PutRgbaRGBA(red, green, blue, alpha); + + /////////////////// + // parameters + /////////////////// + + exc_augend->fadestart = max(min( + exc_augend->fadestart + + (subFadeStart ? -1 : 1) // subtract fadestart + * exc_addend->fadestart + , 31), 0); + + exc_augend->fadeend = max(min( + exc_augend->fadeend + + (subFadeEnd ? -1 : 1) // subtract fadeend + * (exc_addend->fadeend == 31 && !exc_addend->fadestart ? 0 : exc_addend->fadeend) + // HACK: fadeend defaults to 31, so don't add anything in this case + , 31), 0); + + if (!ignoreFog) // overwrite fog with new value + exc_augend->fog = exc_addend->fog; + + /////////////////// + // put it together + /////////////////// + + exc_augend->colormap = lighttable ? R_CreateLightTable(exc_augend) : NULL; + exc_augend->next = exc_augend->prev = NULL; + return exc_augend; } // Thanks to quake2 source! @@ -1735,20 +2041,18 @@ static int RoundUp(double number) return (int)number; } -const char *R_ColormapNameForNum(INT32 num) +#ifdef EXTRACOLORMAPLUMPS +const char *R_NameForColormap(extracolormap_t *extra_colormap) { - if (num == -1) + if (!extra_colormap) return "NONE"; - if (num < 0 || num > MAXCOLORMAPS) - I_Error("R_ColormapNameForNum: num %d is invalid!\n", num); - - if (foundcolormaps[num] == LUMPERROR) + if (extra_colormap->lump == LUMPERROR) return "INLEVEL"; - return W_CheckNameForNum(foundcolormaps[num]); + return extra_colormap->lumpname; } - +#endif // // build a table for quick conversion from 8bpp to 15bpp diff --git a/src/r_data.h b/src/r_data.h index 53bf27835..54857661a 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -96,13 +96,57 @@ void R_ClearTextureNumCache(boolean btell); INT32 R_TextureNumForName(const char *name); INT32 R_CheckTextureNumForName(const char *name); +// Extra Colormap lumps (C_START/C_END) are not used anywhere +// Uncomment to enable +//#define EXTRACOLORMAPLUMPS + +// Uncomment to make extra_colormaps order Newest -> Oldest +//#define COLORMAPREVERSELIST + void R_ReInitColormaps(UINT16 num); void R_ClearColormaps(void); -INT32 R_ColormapNumForName(char *name); -INT32 R_CreateColormap(char *p1, char *p2, char *p3); -void R_CreateColormap2(char *p1, char *p2, char *p3); -void R_MakeColormaps(void); -const char *R_ColormapNameForNum(INT32 num); +extracolormap_t *R_CreateDefaultColormap(boolean lighttable); +extracolormap_t *R_GetDefaultColormap(void); +extracolormap_t *R_CopyColormap(extracolormap_t *extra_colormap, boolean lighttable); +void R_AddColormapToList(extracolormap_t *extra_colormap); + +#ifdef EXTRACOLORMAPLUMPS +boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, + INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog, lumpnum_t lump); +extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog, lumpnum_t lump); +#else +boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, + INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog); +extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 fog); +#endif +boolean R_CheckDefaultColormap(extracolormap_t *extra_colormap, boolean checkrgba, boolean checkfadergba, boolean checkparams); +boolean R_CheckEqualColormaps(extracolormap_t *exc_a, extracolormap_t *exc_b, boolean checkrgba, boolean checkfadergba, boolean checkparams); +extracolormap_t *R_GetColormapFromList(extracolormap_t *extra_colormap); + +lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap); +extracolormap_t *R_CreateColormap(char *p1, char *p2, char *p3); +extracolormap_t *R_AddColormaps(extracolormap_t *exc_augend, extracolormap_t *exc_addend, + boolean subR, boolean subG, boolean subB, boolean subA, + boolean subFadeR, boolean subFadeG, boolean subFadeB, boolean subFadeA, + boolean subFadeStart, boolean subFadeEnd, boolean ignoreFog, + boolean useAltAlpha, INT16 altAlpha, INT16 altFadeAlpha, + boolean lighttable); +#ifdef EXTRACOLORMAPLUMPS +extracolormap_t *R_ColormapForName(char *name); +const char *R_NameForColormap(extracolormap_t *extra_colormap); +#endif + +#define R_GetRgbaR(rgba) (rgba & 0xFF) +#define R_GetRgbaG(rgba) ((rgba >> 8) & 0xFF) +#define R_GetRgbaB(rgba) ((rgba >> 16) & 0xFF) +#define R_GetRgbaA(rgba) ((rgba >> 24) & 0xFF) +#define R_GetRgbaRGB(rgba) (rgba & 0xFFFFFF) +#define R_PutRgbaR(r) (r) +#define R_PutRgbaG(g) (g << 8) +#define R_PutRgbaB(b) (b << 16) +#define R_PutRgbaA(a) (a << 24) +#define R_PutRgbaRGB(r, g, b) (R_PutRgbaR(r) + R_PutRgbaG(g) + R_PutRgbaB(b)) +#define R_PutRgbaRGBA(r, g, b, a) (R_PutRgbaRGB(r, g, b) + R_PutRgbaA(a)) extern INT32 numtextures; diff --git a/src/r_defs.h b/src/r_defs.h index 7c8f2a73f..0e63eec64 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -50,18 +50,25 @@ typedef struct typedef UINT8 lighttable_t; // ExtraColormap type. Use for extra_colormaps from now on. -typedef struct +typedef struct extracolormap_s { - UINT16 maskcolor, fadecolor; - double maskamt; - UINT16 fadestart, fadeend; - INT32 fog; + UINT8 fadestart, fadeend; + UINT8 fog; // categorical value, not boolean - // rgba is used in hw mode for colored sector lighting + // store rgba values in combined bitwise + // also used in OpenGL instead lighttables INT32 rgba; // similar to maskcolor in sw mode INT32 fadergba; // The colour the colourmaps fade to lighttable_t *colormap; + +#ifdef EXTRACOLORMAPLUMPS + lumpnum_t lump; // for colormap lump matching, init to LUMPERROR + char lumpname[9]; // for netsyncing +#endif + + struct extracolormap_s *next; + struct extracolormap_s *prev; } extracolormap_t; // @@ -177,6 +184,8 @@ typedef struct ffloor_s // these are saved for netgames, so do not let Lua touch these! ffloortype_e spawnflags; // flags the 3D floor spawned with INT32 spawnalpha; // alpha the 3D floor spawned with + + void *fadingdata; // fading FOF thinker } ffloor_t; @@ -187,7 +196,7 @@ typedef struct lightlist_s { fixed_t height; INT16 *lightlevel; - extracolormap_t *extra_colormap; + extracolormap_t **extra_colormap; // pointer-to-a-pointer, so we can react to colormap changes INT32 flags; ffloor_t *caster; #ifdef ESLOPE @@ -308,6 +317,7 @@ typedef struct sector_s void *floordata; // floor move thinker void *ceilingdata; // ceiling move thinker void *lightingdata; // lighting change thinker + void *fadecolormapdata; // fade colormap thinker // floor and ceiling texture offsets fixed_t floor_xoffs, floor_yoffs; @@ -323,8 +333,6 @@ typedef struct sector_s INT32 floorlightsec, ceilinglightsec; INT32 crumblestate; // used for crumbling and bobbing - INT32 bottommap, midmap, topmap; // dynamic colormaps - // list of mobjs that are at least partially in the sector // thinglist is a subset of touching_thinglist struct msecnode_s *touching_thinglist; @@ -383,6 +391,9 @@ typedef struct sector_s boolean hasslope; // The sector, or one of its visible FOFs, contains a slope #endif + // for fade thinker + INT16 spawn_lightlevel; + // these are saved for netgames, so do not let Lua touch these! INT32 spawn_nexttag, spawn_firsttag; // the actual nexttag/firsttag values may differ if the sector's tag was changed @@ -393,6 +404,9 @@ typedef struct sector_s // flag angles sector spawned with (via linedef type 7) angle_t spawn_flrpic_angle; angle_t spawn_ceilpic_angle; + + // colormap structure + extracolormap_t *spawn_extra_colormap; } sector_t; // @@ -468,6 +482,8 @@ typedef struct INT16 repeatcnt; // # of times to repeat midtexture char *text; // a concatination of all top, bottom, and mid texture names, for linedef specials that require a string. + + extracolormap_t *colormap_data; // storage for colormaps; not applied to sectors. } side_t; // diff --git a/src/r_draw8.c b/src/r_draw8.c index 76eb58c0d..bda146546 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -261,7 +261,7 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) val = source[frac>>FRACBITS]; if (val != TRANSPARENTPIXEL) - *dest = colormap[*(transmap + (val<<8) + (*dest))]; + *dest = *(transmap + (colormap[val]<<8) + (*dest)); dest += vid.width; @@ -281,12 +281,12 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = colormap[*(transmap + (val<<8) + (*dest))]; + *dest = *(transmap + (colormap[val]<<8) + (*dest)); dest += vid.width; frac += fracstep; val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = colormap[*(transmap + (val<<8) + (*dest))]; + *dest = *(transmap + (colormap[val]<<8) + (*dest)); dest += vid.width; frac += fracstep; } @@ -294,7 +294,7 @@ void R_Draw2sMultiPatchTranslucentColumn_8(void) { val = source[(frac>>FRACBITS) & heightmask]; if (val != TRANSPARENTPIXEL) - *dest = colormap[*(transmap + (val<<8) + (*dest))]; + *dest = *(transmap + (colormap[val]<<8) + (*dest)); } } } diff --git a/src/r_main.c b/src/r_main.c index 9d0a8fe60..ab5993c5b 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -118,8 +118,7 @@ lighttable_t *scalelightfixed[MAXLIGHTSCALE]; lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ]; // Hack to support extra boom colormaps. -size_t num_extra_colormaps; -extracolormap_t extra_colormaps[MAXCOLORMAPS]; +extracolormap_t *extra_colormaps = NULL; static CV_PossibleValue_t drawdist_cons_t[] = { {256, "256"}, {512, "512"}, {768, "768"}, @@ -220,21 +219,11 @@ static void ChaseCam2_OnChange(void) static void FlipCam_OnChange(void) { - if (cv_flipcam.value) - players[consoleplayer].pflags |= PF_FLIPCAM; - else - players[consoleplayer].pflags &= ~PF_FLIPCAM; - SendWeaponPref(); } static void FlipCam2_OnChange(void) { - if (cv_flipcam2.value) - players[secondarydisplayplayer].pflags |= PF_FLIPCAM; - else - players[secondarydisplayplayer].pflags &= ~PF_FLIPCAM; - SendWeaponPref2(); } @@ -914,7 +903,7 @@ void R_SetupFrame(player_t *player, boolean skybox) chasecam = (cv_chasecam.value != 0); } - if (player->climbing || (player->powers[pw_carry] == CR_NIGHTSMODE) || player->playerstate == PST_DEAD || gamestate == GS_TITLESCREEN) + if (player->climbing || (player->powers[pw_carry] == CR_NIGHTSMODE) || player->playerstate == PST_DEAD || gamestate == GS_TITLESCREEN || tutorialmode) chasecam = true; // force chasecam on else if (player->spectator) // no spectator chasecam chasecam = false; // force chasecam off @@ -1146,9 +1135,9 @@ void R_RenderPlayerView(player_t *player) if (cv_homremoval.value && player == &players[displayplayer]) // if this is display player 1 { if (cv_homremoval.value == 1) - V_DrawFill(0, 0, vid.width, vid.height, 31); // No HOM effect! + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // No HOM effect! else //'development' HOM removal -- makes it blindingly obvious if HOM is spotted. - V_DrawFill(0, 0, vid.width, vid.height, 32+(timeinmap&15)); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 32+(timeinmap&15)); } // load previous saved value of skyVisible for the player diff --git a/src/r_plane.h b/src/r_plane.h index 16c8c12a4..dff58669a 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -87,7 +87,7 @@ extern lighttable_t **planezlight; extern fixed_t *yslope; extern fixed_t distscale[MAXVIDWIDTH]; -FUNCMATH void R_InitPlanes(void); +void R_InitPlanes(void); void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale); void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale); void R_ClearPlanes(void); diff --git a/src/r_segs.c b/src/r_segs.c index a52b7cb61..d33696729 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -413,7 +413,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) #endif rlight->startheight = rlight->height; // keep starting value here to reset for each repeat rlight->lightlevel = *light->lightlevel; - rlight->extra_colormap = light->extra_colormap; + rlight->extra_colormap = *light->extra_colormap; rlight->flags = light->flags; if (rlight->flags & FF_FOG || (rlight->extra_colormap && rlight->extra_colormap->fog)) @@ -607,8 +607,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) else rlight->rcolormap = xwalllights[pindex]; - rlight->height += rlight->heightstep; height = rlight->height; + rlight->height += rlight->heightstep; if (height <= windowtop) { @@ -858,26 +858,21 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) light = &frontsector->lightlist[i]; rlight = &dc_lightlist[p]; #ifdef ESLOPE - if (light->slope) { - leftheight = P_GetZAt(light->slope, ds->leftpos.x, ds->leftpos.y); - rightheight = P_GetZAt(light->slope, ds->rightpos.x, ds->rightpos.y); - } else - leftheight = rightheight = light->height; - if (*pfloor->b_slope) { - pfloorleft = P_GetZAt(*pfloor->b_slope, ds->leftpos.x, ds->leftpos.y); - pfloorright = P_GetZAt(*pfloor->b_slope, ds->rightpos.x, ds->rightpos.y); - } else - pfloorleft = pfloorright = *pfloor->bottomheight; +#define SLOPEPARAMS(slope, end1, end2, normalheight) \ + if (slope) { \ + end1 = P_GetZAt(slope, ds->leftpos.x, ds->leftpos.y); \ + end2 = P_GetZAt(slope, ds->rightpos.x, ds->rightpos.y); \ + } else \ + end1 = end2 = normalheight; + + SLOPEPARAMS(light->slope, leftheight, rightheight, light->height) + SLOPEPARAMS(*pfloor->b_slope, pfloorleft, pfloorright, *pfloor->bottomheight) if (leftheight < pfloorleft && rightheight < pfloorright) continue; - if (*pfloor->t_slope) { - pfloorleft = P_GetZAt(*pfloor->t_slope, ds->leftpos.x, ds->leftpos.y); - pfloorright = P_GetZAt(*pfloor->t_slope, ds->rightpos.x, ds->rightpos.y); - } else - pfloorleft = pfloorright = *pfloor->topheight; + SLOPEPARAMS(*pfloor->t_slope, pfloorleft, pfloorright, *pfloor->topheight) if (leftheight > pfloorleft && rightheight > pfloorright && i+1 < dc_numlights) { @@ -890,17 +885,17 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) leftheight -= viewz; rightheight -= viewz; - overflow_test = (INT64)centeryfrac - (((INT64)leftheight*ds->scale1)>>FRACBITS); - if (overflow_test < 0) overflow_test = -overflow_test; - if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue; - overflow_test = (INT64)centeryfrac - (((INT64)rightheight*ds->scale2)>>FRACBITS); - if (overflow_test < 0) overflow_test = -overflow_test; - if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue; +#define OVERFLOWTEST(height, scale) \ + overflow_test = (INT64)centeryfrac - (((INT64)height*scale)>>FRACBITS); \ + if (overflow_test < 0) overflow_test = -overflow_test; \ + if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue; + + OVERFLOWTEST(leftheight, ds->scale1) + OVERFLOWTEST(rightheight, ds->scale2) rlight->height = (centeryfrac) - FixedMul(leftheight, ds->scale1); rlight->heightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); rlight->heightstep = (rlight->heightstep-rlight->height)/(range); - rlight->height -= rlight->heightstep; #else if (light->height < *pfloor->bottomheight) continue; @@ -910,41 +905,33 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) lheight = light->height;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : light->height; rlight->heightstep = -FixedMul (rw_scalestep, (lheight - viewz)); - rlight->height = (centeryfrac) - FixedMul((lheight - viewz), spryscale) - rlight->heightstep; + rlight->height = (centeryfrac) - FixedMul((lheight - viewz), spryscale); #endif rlight->flags = light->flags; if (light->flags & FF_CUTLEVEL) { #ifdef ESLOPE - if (*light->caster->b_slope) { - leftheight = P_GetZAt(*light->caster->b_slope, ds->leftpos.x, ds->leftpos.y); - rightheight = P_GetZAt(*light->caster->b_slope, ds->rightpos.x, ds->rightpos.y); - } else - leftheight = rightheight = *light->caster->bottomheight; - + SLOPEPARAMS(*light->caster->b_slope, leftheight, rightheight, *light->caster->bottomheight) +#undef SLOPEPARAMS leftheight -= viewz; rightheight -= viewz; - overflow_test = (INT64)centeryfrac - (((INT64)leftheight*ds->scale1)>>FRACBITS); - if (overflow_test < 0) overflow_test = -overflow_test; - if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue; - overflow_test = (INT64)centeryfrac - (((INT64)rightheight*ds->scale2)>>FRACBITS); - if (overflow_test < 0) overflow_test = -overflow_test; - if ((UINT64)overflow_test&0xFFFFFFFF80000000ULL) continue; + OVERFLOWTEST(leftheight, ds->scale1) + OVERFLOWTEST(rightheight, ds->scale2) +#undef OVERFLOWTEST rlight->botheight = (centeryfrac) - FixedMul(leftheight, ds->scale1); rlight->botheightstep = (centeryfrac) - FixedMul(rightheight, ds->scale2); rlight->botheightstep = (rlight->botheightstep-rlight->botheight)/(range); - rlight->botheight -= rlight->botheightstep; #else lheight = *light->caster->bottomheight;// > *pfloor->topheight ? *pfloor->topheight + FRACUNIT : *light->caster->bottomheight; rlight->botheightstep = -FixedMul (rw_scalestep, (lheight - viewz)); - rlight->botheight = (centeryfrac) - FixedMul((lheight - viewz), spryscale) - rlight->botheightstep; + rlight->botheight = (centeryfrac) - FixedMul((lheight - viewz), spryscale); #endif } rlight->lightlevel = *light->lightlevel; - rlight->extra_colormap = light->extra_colormap; + rlight->extra_colormap = *light->extra_colormap; // Check if the current light effects the colormap/lightlevel if (pfloor->flags & FF_FOG) @@ -1130,6 +1117,46 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) oldx = dc_x; } #endif + // Calculate bounds + // clamp the values if necessary to avoid overflows and rendering glitches caused by them + +#ifdef ESLOPE + if (top_frac > (INT64)CLAMPMAX) sprtopscreen = windowtop = CLAMPMAX; + else if (top_frac > (INT64)CLAMPMIN) sprtopscreen = windowtop = (fixed_t)top_frac; + else sprtopscreen = windowtop = CLAMPMIN; + if (bottom_frac > (INT64)CLAMPMAX) sprbotscreen = windowbottom = CLAMPMAX; + else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac; + else sprbotscreen = windowbottom = CLAMPMIN; + + top_frac += top_step; + bottom_frac += bottom_step; +#else + sprtopscreen = windowtop = (centeryfrac - FixedMul((dc_texturemid - offsetvalue), spryscale)); + sprbotscreen = windowbottom = FixedMul(*pfloor->topheight - *pfloor->bottomheight, spryscale) + sprtopscreen; +#endif + + // SoM: If column is out of range, why bother with it?? + if (windowbottom < topbounds || windowtop > bottombounds) + { + if (dc_numlights) + { + for (i = 0; i < dc_numlights; i++) + { + rlight = &dc_lightlist[i]; + rlight->height += rlight->heightstep; + if (rlight->flags & FF_CUTLEVEL) + rlight->botheight += rlight->botheightstep; + } + } + spryscale += rw_scalestep; + continue; + } + + dc_iscale = 0xffffffffu / (unsigned)spryscale; + + // Get data for the column + col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc_x]) - 3); + // SoM: New code does not rely on R_DrawColumnShadowed_8 which // will (hopefully) put less strain on the stack. if (dc_numlights) @@ -1140,40 +1167,6 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) INT32 solid = 0; INT32 lighteffect = 0; -#ifdef ESLOPE - if (top_frac > (INT64)CLAMPMAX) sprtopscreen = windowtop = CLAMPMAX; - else if (top_frac > (INT64)CLAMPMIN) sprtopscreen = windowtop = (fixed_t)top_frac; - else sprtopscreen = windowtop = CLAMPMIN; - if (bottom_frac > (INT64)CLAMPMAX) sprbotscreen = windowbottom = CLAMPMAX; - else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac; - else sprbotscreen = windowbottom = CLAMPMIN; - - top_frac += top_step; - bottom_frac += bottom_step; -#else - sprtopscreen = windowtop = (centeryfrac - FixedMul((dc_texturemid - offsetvalue), spryscale)); - sprbotscreen = windowbottom = FixedMul(*pfloor->topheight - *pfloor->bottomheight, spryscale) + sprtopscreen; -#endif - - // SoM: If column is out of range, why bother with it?? - if (windowbottom < topbounds || windowtop > bottombounds) - { - for (i = 0; i < dc_numlights; i++) - { - rlight = &dc_lightlist[i]; - rlight->height += rlight->heightstep; - if (rlight->flags & FF_CUTLEVEL) - rlight->botheight += rlight->botheightstep; - } - spryscale += rw_scalestep; - continue; - } - - dc_iscale = 0xffffffffu / (unsigned)spryscale; - - // draw the texture - col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc_x]) - 3); - for (i = 0; i < dc_numlights; i++) { // Check if the current light effects the colormap/lightlevel @@ -1192,7 +1185,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) pindex = FixedMul(spryscale, FixedDiv(640, vid.width))>>LIGHTSCALESHIFT; - if (pindex >= MAXLIGHTSCALE) + if (pindex >= MAXLIGHTSCALE) pindex = MAXLIGHTSCALE-1; if (pfloor->flags & FF_FOG) @@ -1231,13 +1224,13 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) else solid = 0; - rlight->height += rlight->heightstep; height = rlight->height; + rlight->height += rlight->heightstep; if (solid) { - rlight->botheight += rlight->botheightstep; bheight = rlight->botheight - (FRACUNIT >> 1); + rlight->botheight += rlight->botheightstep; } if (height <= windowtop) @@ -1253,6 +1246,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (windowbottom >= sprbotscreen) { windowbottom = sprbotscreen; + // draw the texture colfunc_2s (col); for (i++; i < dc_numlights; i++) { @@ -1263,6 +1257,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) } continue; } + // draw the texture colfunc_2s (col); if (solid) windowtop = bheight; @@ -1272,6 +1267,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) dc_colormap = rlight->rcolormap; } windowbottom = sprbotscreen; + // draw the texture, if there is any space left if (windowtop < windowbottom) colfunc_2s (col); @@ -1286,31 +1282,13 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) pindex = MAXLIGHTSCALE - 1; dc_colormap = walllights[pindex]; - if (frontsector->extra_colormap) - dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps); + if (pfloor->flags & FF_FOG && pfloor->master->frontsector->extra_colormap) dc_colormap = pfloor->master->frontsector->extra_colormap->colormap + (dc_colormap - colormaps); - -#ifdef ESLOPE - if (top_frac > (INT64)CLAMPMAX) sprtopscreen = windowtop = CLAMPMAX; - else if (top_frac > (INT64)CLAMPMIN) sprtopscreen = windowtop = (fixed_t)top_frac; - else sprtopscreen = windowtop = CLAMPMIN; - if (bottom_frac > (INT64)CLAMPMAX) sprbotscreen = windowbottom = CLAMPMAX; - else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac; - else sprbotscreen = windowbottom = CLAMPMIN; - - top_frac += top_step; - bottom_frac += bottom_step; -#else - sprtopscreen = windowtop = (centeryfrac - FixedMul((dc_texturemid - offsetvalue), spryscale)); - sprbotscreen = windowbottom = FixedMul(*pfloor->topheight - *pfloor->bottomheight, spryscale) + sprtopscreen; -#endif - - dc_iscale = 0xffffffffu / (unsigned)spryscale; + else if (frontsector->extra_colormap) + dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps); // draw the texture - col = (column_t *)((UINT8 *)R_GetColumn(texnum,maskedtexturecol[dc_x]) - 3); - colfunc_2s (col); spryscale += rw_scalestep; } @@ -2808,7 +2786,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) } rlight->lightlevel = *light->lightlevel; - rlight->extra_colormap = light->extra_colormap; + rlight->extra_colormap = *light->extra_colormap; p++; } diff --git a/src/r_splats.h b/src/r_splats.h index c0ba6881c..349d8fa7a 100644 --- a/src/r_splats.h +++ b/src/r_splats.h @@ -63,11 +63,7 @@ typedef struct floorsplat_s fixed_t P_SegLength(seg_t *seg); // call at P_SetupLevel() -#if !(defined (WALLSPLATS) || defined (FLOORSPLATS)) -FUNCMATH void R_ClearLevelSplats(void); -#else void R_ClearLevelSplats(void); -#endif #ifdef WALLSPLATS void R_AddWallSplat(line_t *wallline, INT16 sectorside, const char *patchname, fixed_t top, diff --git a/src/r_state.h b/src/r_state.h index ac3e1fa42..91c2092e9 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -40,11 +40,7 @@ extern sprcache_t *spritecachedinfo; extern lighttable_t *colormaps; // Boom colormaps. -// Had to put a limit on colormaps :( -#define MAXCOLORMAPS 60 - -extern size_t num_extra_colormaps; -extern extracolormap_t extra_colormaps[MAXCOLORMAPS]; +extern extracolormap_t *extra_colormaps; // for global animation extern INT32 *texturetranslation; diff --git a/src/r_things.c b/src/r_things.c index fb4664d90..e2f1a896b 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -981,7 +981,7 @@ static void R_SplitSprite(vissprite_t *sprite) else spritelights = scalelight[lightnum]; - newsprite->extra_colormap = sector->lightlist[i].extra_colormap; + newsprite->extra_colormap = *sector->lightlist[i].extra_colormap; if (!((newsprite->cut & SC_FULLBRIGHT) && (!newsprite->extra_colormap || !(newsprite->extra_colormap->fog & 1)))) @@ -1360,7 +1360,7 @@ static void R_ProjectSprite(mobj_t *thing) vis->sz = (INT16)((centeryfrac - FixedMul(vis->gz - viewz, sortscale))>>FRACBITS); vis->cut = cut; if (thing->subsector->sector->numlights) - vis->extra_colormap = thing->subsector->sector->lightlist[light].extra_colormap; + vis->extra_colormap = *thing->subsector->sector->lightlist[light].extra_colormap; else vis->extra_colormap = thing->subsector->sector->extra_colormap; @@ -1525,6 +1525,17 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) return; } + // okay, we can't return now except for vertical clipping... this is a hack, but weather isn't networked, so it should be ok + if (!(thing->precipflags & PCF_THUNK)) + { + if (thing->precipflags & PCF_RAIN) + P_RainThinker(thing); + else + P_SnowThinker(thing); + thing->precipflags |= PCF_THUNK; + } + + //SoM: 3/17/2000: Disregard sprites that are out of view.. gzt = thing->z + spritecachedinfo[lump].topoffset; gz = gzt - spritecachedinfo[lump].height; @@ -1642,8 +1653,10 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); - if (approx_dist <= limit_dist) - R_ProjectSprite(thing); + if (approx_dist > limit_dist) + continue; + + R_ProjectSprite(thing); } } else @@ -1664,8 +1677,10 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); - if (approx_dist <= limit_dist) - R_ProjectPrecipitationSprite(precipthing); + if (approx_dist > limit_dist) + continue; + + R_ProjectPrecipitationSprite(precipthing); } } else @@ -2499,7 +2514,7 @@ static void Sk_SetDefaultValue(skin_t *skin) strcpy(skin->realname, "Someone"); strcpy(skin->hudname, "???"); - strncpy(skin->charsel, "CHRSONIC", 8); + strncpy(skin->charsel, "CHRSONIC", 9); strncpy(skin->face, "MISSING", 8); strncpy(skin->superface, "MISSING", 8); diff --git a/src/r_things.h b/src/r_things.h index 9a9761d5b..508da6a54 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -75,7 +75,7 @@ typedef struct char realname[SKINNAMESIZE+1]; // Display name for level completion. char hudname[SKINNAMESIZE+1]; // HUD name to display (officially exactly 5 characters long) - char charsel[8], face[8], superface[8]; // Arbitrarily named patch lumps + char charsel[9], face[9], superface[9]; // Arbitrarily named patch lumps UINT8 ability; // ability definition UINT8 ability2; // secondary ability definition diff --git a/src/s_sound.c b/src/s_sound.c index af152db5f..ada4be6df 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -37,6 +37,7 @@ extern INT32 msg_id; #include "r_sky.h" // skyflatnum #include "p_local.h" // camera info #include "fastcmp.h" +#include "m_misc.h" // for tunes command #ifdef HW3SOUND // 3D Sound Interface @@ -47,6 +48,8 @@ static INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, I CV_PossibleValue_t soundvolume_cons_t[] = {{0, "MIN"}, {31, "MAX"}, {0, NULL}}; static void SetChannelsNum(void); +static void Command_Tunes_f(void); +static void Command_RestartAudio_f(void); // commands for music and sound servers #ifdef MUSSERV @@ -92,6 +95,7 @@ consvar_t cv_closedcaptioning = {"closedcaptioning", "Off", CV_SAVE|CV_CALL, CV_ consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL}; static consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; #define S_MAX_VOLUME 127 @@ -230,7 +234,7 @@ void S_RegisterSoundStuff(void) { if (dedicated) { - nosound = true; + sound_disabled = true; return; } @@ -247,6 +251,11 @@ void S_RegisterSoundStuff(void) #endif CV_RegisterVar(&surround); CV_RegisterVar(&cv_samplerate); + CV_RegisterVar(&cv_resetmusic); + + COM_AddCommand("tunes", Command_Tunes_f); + COM_AddCommand("restartaudio", Command_RestartAudio_f); + #if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff { @@ -494,7 +503,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) mobj_t *listenmobj = players[displayplayer].mo; mobj_t *listenmobj2 = NULL; - if (sound_disabled || !sound_started || nosound) + if (sound_disabled || !sound_started) return; // Don't want a sound? Okay then... @@ -626,7 +635,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) // Assigns the handle to one of the channels in the // mix/output buffer. - channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); + channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum); } dontplay: @@ -679,7 +688,7 @@ dontplay: // Assigns the handle to one of the channels in the // mix/output buffer. - channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); + channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum); } void S_StartSound(const void *origin, sfxenum_t sfx_id) @@ -824,7 +833,7 @@ void S_UpdateSounds(void) goto notinlevel; } - if (dedicated || nosound) + if (dedicated || sound_disabled) return; if (players[displayplayer].awayviewtics) @@ -1283,6 +1292,43 @@ void S_StartSoundName(void *mo, const char *soundname) S_StartSound(mo, soundnum); } +// +// Initializes sound stuff, including volume +// Sets channels, SFX volume, +// allocates channel buffer, sets S_sfx lookup. +// +void S_InitSfxChannels(INT32 sfxVolume) +{ + INT32 i; + + if (dedicated) + return; + + S_SetSfxVolume(sfxVolume); + + SetChannelsNum(); + + // Note that sounds have not been cached (yet). + for (i = 1; i < NUMSFX; i++) + { + S_sfx[i].usefulness = -1; // for I_GetSfx() + S_sfx[i].lumpnum = LUMPERROR; + } + + // precache sounds if requested by cmdline, or precachesound var true + if (!sound_disabled && (M_CheckParm("-precachesound") || precachesound.value)) + { + // Initialize external data (all sounds) at start, keep static. + CONS_Printf(M_GetText("Loading sounds... ")); + + for (i = 1; i < NUMSFX; i++) + if (S_sfx[i].name) + S_sfx[i].data = I_GetSfx(&S_sfx[i]); + + CONS_Printf(M_GetText(" pre-cached all sound data\n")); + } +} + /// ------------------------ /// Music /// ------------------------ @@ -1309,31 +1355,109 @@ const char *compat_special_music_slots[16] = }; #endif -#define music_playing (music_name[0]) // String is empty if no music is playing - static char music_name[7]; // up to 6-character name -static lumpnum_t music_lumpnum; // lump number of music (used??) -static void *music_data; // music raw data -static INT32 music_handle; // once registered, the handle for the music +static void *music_data; +static UINT16 music_flags; +static boolean music_looping; -static boolean mus_paused = 0; // whether songs are mus_paused +/// ------------------------ +/// Music Status +/// ------------------------ -static boolean S_MIDIMusic(const char *mname, boolean looping) +boolean S_DigMusicDisabled(void) +{ + return digital_disabled; +} + +boolean S_MIDIMusicDisabled(void) +{ + return midi_disabled; +} + +boolean S_MusicDisabled(void) +{ + return (midi_disabled && digital_disabled); +} + +boolean S_MusicPlaying(void) +{ + return I_SongPlaying(); +} + +boolean S_MusicPaused(void) +{ + return I_SongPaused(); +} + +musictype_t S_MusicType(void) +{ + return I_SongType(); +} + +boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping) +{ + if (!I_SongPlaying()) + return false; + + strncpy(mname, music_name, 7); + mname[6] = 0; + *mflags = music_flags; + *looping = music_looping; + + return (boolean)mname[0]; +} + +boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi) +{ + return ( + (checkDigi ? W_CheckNumForName(va("O_%s", mname)) != LUMPERROR : false) + || (checkMIDI ? W_CheckNumForName(va("D_%s", mname)) != LUMPERROR : false) + ); +} + +/// ------------------------ +/// Music Effects +/// ------------------------ + +boolean S_SpeedMusic(float speed) +{ + return I_SetSongSpeed(speed); +} + +/// ------------------------ +/// Music Playback +/// ------------------------ + +static boolean S_LoadMusic(const char *mname) { lumpnum_t mlumpnum; void *mdata; - INT32 mhandle; - if (nomidimusic || music_disabled) - return false; // didn't search. - - if (W_CheckNumForName(va("d_%s", mname)) == LUMPERROR) + if (S_MusicDisabled()) return false; - mlumpnum = W_GetNumForName(va("d_%s", mname)); + + if (!S_DigMusicDisabled() && S_DigExists(mname)) + mlumpnum = W_GetNumForName(va("o_%s", mname)); + else if (!S_MIDIMusicDisabled() && S_MIDIExists(mname)) + mlumpnum = W_GetNumForName(va("d_%s", mname)); + else if (S_DigMusicDisabled() && S_DigExists(mname)) + { + CONS_Alert(CONS_NOTICE, "Digital music is disabled!\n"); + return false; + } + else if (S_MIDIMusicDisabled() && S_MIDIExists(mname)) + { + CONS_Alert(CONS_NOTICE, "MIDI music is disabled!\n"); + return false; + } + else + { + CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mname); + return false; + } // load & register it mdata = W_CacheLumpNum(mlumpnum, PU_MUSIC); - mhandle = I_RegisterSong(mdata, W_LumpLength(mlumpnum)); #ifdef MUSSERV if (msg_id != -1) @@ -1347,37 +1471,49 @@ static boolean S_MIDIMusic(const char *mname, boolean looping) } #endif - // play it - if (!I_PlaySong(mhandle, looping)) + if (I_LoadSong(mdata, W_LumpLength(mlumpnum))) + { + strncpy(music_name, mname, 7); + music_name[6] = 0; + music_data = mdata; + return true; + } + else return false; - - strncpy(music_name, mname, 7); - music_name[6] = 0; - music_lumpnum = mlumpnum; - music_data = mdata; - music_handle = mhandle; - return true; } -static boolean S_DigMusic(const char *mname, boolean looping) +static void S_UnloadMusic(void) { - if (nodigimusic || digital_disabled) - return false; // try midi + I_UnloadSong(); - if (!I_StartDigSong(mname, looping)) +#ifndef HAVE_SDL //SDL uses RWOPS + Z_ChangeTag(music_data, PU_CACHE); +#endif + music_data = NULL; + + music_name[0] = 0; + music_flags = 0; + music_looping = false; +} + +static boolean S_PlayMusic(boolean looping) +{ + if (S_MusicDisabled()) return false; - strncpy(music_name, mname, 7); - music_name[6] = 0; - music_lumpnum = LUMPERROR; - music_data = NULL; - music_handle = 0; + if (!I_PlaySong(looping)) + { + S_UnloadMusic(); + return false; + } + + S_InitMusicVolume(); // switch between digi and sequence volume return true; } void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping) { - if ((nomidimusic || music_disabled) && (nodigimusic || digital_disabled)) + if (S_MusicDisabled()) return; // No Music (empty string) @@ -1387,44 +1523,39 @@ void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping) return; } - if (strncmp(music_name, mmusic, 6)) + if (strnicmp(music_name, mmusic, 6)) { S_StopMusic(); // shutdown old music - if (!S_DigMusic(mmusic, looping) && !S_MIDIMusic(mmusic, looping)) + + if (!S_LoadMusic(mmusic)) { - CONS_Alert(CONS_ERROR, M_GetText("Music lump %.6s not found!\n"), mmusic); + CONS_Alert(CONS_ERROR, "Music %.6s could not be loaded!\n", mmusic); + return; + } + + music_flags = mflags; + music_looping = looping; + + if (!S_PlayMusic(looping)) + { + CONS_Alert(CONS_ERROR, "Music %.6s could not be played!\n", mmusic); return; } } I_SetSongTrack(mflags & MUSIC_TRACKMASK); } -boolean S_SpeedMusic(float speed) -{ - return I_SetSongSpeed(speed); -} - void S_StopMusic(void) { - if (!music_playing) + if (!I_SongPlaying()) return; - if (mus_paused) - I_ResumeSong(music_handle); - - if (!nodigimusic) - I_StopDigSong(); + if (I_SongPaused()) + I_ResumeSong(); S_SpeedMusic(1.0f); - I_StopSong(music_handle); - I_UnRegisterSong(music_handle); - -#ifndef HAVE_SDL //SDL uses RWOPS - Z_ChangeTag(music_data, PU_CACHE); -#endif - - music_data = NULL; - music_name[0] = 0; + I_StopSong(); + S_UnloadMusic(); // for now, stopping also means you unload the song if (cv_closedcaptioning.value) { @@ -1433,81 +1564,70 @@ void S_StopMusic(void) } } -void S_SetDigMusicVolume(INT32 volume) +// +// Stop and resume music, during game PAUSE. +// +void S_PauseAudio(void) { - if (volume < 0 || volume > 31) - CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n"); + if (I_SongPlaying() && !I_SongPaused()) + I_PauseSong(); - CV_SetValue(&cv_digmusicvolume, volume&31); - actualdigmusicvolume = cv_digmusicvolume.value; //check for change of var - -#ifdef DJGPPDOS - I_SetDigMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this. + // pause cd music +#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) + I_PauseCD(); +#else + I_StopCD(); #endif - I_SetDigMusicVolume(volume&31); } -void S_SetMIDIMusicVolume(INT32 volume) +void S_ResumeAudio(void) { - if (volume < 0 || volume > 31) - CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n"); + if (I_SongPlaying() && I_SongPaused()) + I_ResumeSong(); - CV_SetValue(&cv_midimusicvolume, volume&0x1f); + // resume cd music + I_ResumeCD(); +} + +void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume) +{ + if (digvolume < 0) + digvolume = cv_digmusicvolume.value; + if (seqvolume < 0) + seqvolume = cv_midimusicvolume.value; + + if (digvolume < 0 || digvolume > 31) + CONS_Alert(CONS_WARNING, "digmusicvolume should be between 0-31\n"); + CV_SetValue(&cv_digmusicvolume, digvolume&31); + actualdigmusicvolume = cv_digmusicvolume.value; //check for change of var + + if (seqvolume < 0 || seqvolume > 31) + CONS_Alert(CONS_WARNING, "midimusicvolume should be between 0-31\n"); + CV_SetValue(&cv_midimusicvolume, seqvolume&31); actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var #ifdef DJGPPDOS - I_SetMIDIMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this. + digvolume = seqvolume = 31; #endif - I_SetMIDIMusicVolume(volume&0x1f); + + switch(I_SongType()) + { + case MU_MID: + //case MU_MOD: + //case MU_GME: + I_SetMusicVolume(seqvolume&31); + break; + default: + I_SetMusicVolume(digvolume&31); + break; + } } + /// ------------------------ /// Init & Others /// ------------------------ -// -// Initializes sound stuff, including volume -// Sets channels, SFX and music volume, -// allocates channel buffer, sets S_sfx lookup. -// -void S_Init(INT32 sfxVolume, INT32 digMusicVolume, INT32 midiMusicVolume) -{ - INT32 i; - - if (dedicated) - return; - - S_SetSfxVolume(sfxVolume); - S_SetDigMusicVolume(digMusicVolume); - S_SetMIDIMusicVolume(midiMusicVolume); - - SetChannelsNum(); - - // no sounds are playing, and they are not mus_paused - mus_paused = 0; - - // Note that sounds have not been cached (yet). - for (i = 1; i < NUMSFX; i++) - { - S_sfx[i].usefulness = -1; // for I_GetSfx() - S_sfx[i].lumpnum = LUMPERROR; - } - - // precache sounds if requested by cmdline, or precachesound var true - if (!nosound && (M_CheckParm("-precachesound") || precachesound.value)) - { - // Initialize external data (all sounds) at start, keep static. - CONS_Printf(M_GetText("Loading sounds... ")); - - for (i = 1; i < NUMSFX; i++) - if (S_sfx[i].name) - S_sfx[i].data = I_GetSfx(&S_sfx[i]); - - CONS_Printf(M_GetText(" pre-cached all sound data\n")); - } -} - - // // Per level startup code. // Kills playing sounds at start of level, @@ -1522,46 +1642,92 @@ void S_Start(void) mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK); } - mus_paused = 0; - if (cv_resetmusic.value) S_StopMusic(); S_ChangeMusic(mapmusname, mapmusflags, true); } -// -// Stop and resume music, during game PAUSE. -// -void S_PauseAudio(void) +static void Command_Tunes_f(void) { - if (!nodigimusic) - I_PauseSong(0); + const char *tunearg; + UINT16 tunenum, track = 0; + const size_t argc = COM_Argc(); - if (music_playing && !mus_paused) + if (argc < 2) //tunes slot ... { - I_PauseSong(music_handle); - mus_paused = true; + CONS_Printf("tunes [track] [speed] / <-show> / <-default> / <-none>:\n"); + CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n")); + CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n")); + CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n")); + CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n")); + CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n")); + return; } - // pause cd music -#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) - I_PauseCD(); -#else - I_StopCD(); -#endif -} + tunearg = COM_Argv(1); + tunenum = (UINT16)atoi(tunearg); + track = 0; -void S_ResumeAudio(void) -{ - if (!nodigimusic) - I_ResumeSong(0); + if (!strcasecmp(tunearg, "-show")) + { + CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"), + mapmusname, (mapmusflags & MUSIC_TRACKMASK)); + return; + } + if (!strcasecmp(tunearg, "-none")) + { + S_StopMusic(); + return; + } + else if (!strcasecmp(tunearg, "-default")) + { + tunearg = mapheaderinfo[gamemap-1]->musname; + track = mapheaderinfo[gamemap-1]->mustrack; + } + else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z') + tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]); + + if (tunenum && tunenum >= 1036) + { + CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n")); + return; + } + if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case + CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n")); + + if (argc > 2) + track = (UINT16)atoi(COM_Argv(2))-1; + + if (tunenum) + snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum)); else - if (music_playing && mus_paused) - { - I_ResumeSong(music_handle); - mus_paused = false; - } + strncpy(mapmusname, tunearg, 7); + mapmusname[6] = 0; + mapmusflags = (track & MUSIC_TRACKMASK); - // resume cd music - I_ResumeCD(); + S_ChangeMusic(mapmusname, mapmusflags, true); + + if (argc > 3) + { + float speed = (float)atof(COM_Argv(3)); + if (speed > 0.0f) + S_SpeedMusic(speed); + } +} + +static void Command_RestartAudio_f(void) +{ + S_StopMusic(); + S_StopSounds(); + I_ShutdownMusic(); + I_ShutdownSound(); + I_StartupSound(); + I_InitMusic(); + +// These must be called or no sound and music until manually set. + + I_SetSfxVolume(cv_soundvolume.value); + S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value); + if (Playing()) // Gotta make sure the player is in a level + P_RestoreMusic(&players[consoleplayer]); } diff --git a/src/s_sound.h b/src/s_sound.h index 4b9735480..0fcaace5e 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -14,6 +14,7 @@ #ifndef __S_SOUND__ #define __S_SOUND__ +#include "i_sound.h" // musictype_t #include "sounds.h" #include "m_fixed.h" #include "command.h" @@ -25,6 +26,7 @@ extern consvar_t stereoreverse; extern consvar_t cv_soundvolume, cv_closedcaptioning, cv_digmusicvolume, cv_midimusicvolume; extern consvar_t cv_numChannels; +extern consvar_t cv_resetmusic; #ifdef SNDSERV extern consvar_t sndserver_cmd, sndserver_arg; @@ -97,9 +99,9 @@ void S_RegisterSoundStuff(void); // // Initializes sound stuff, including volume -// Sets channels, SFX and music volume, allocates channel buffer, sets S_sfx lookup. +// Sets channels, SFX, allocates channel buffer, sets S_sfx lookup. // -void S_Init(INT32 sfxVolume, INT32 digMusicVolume, INT32 midiMusicVolume); +void S_InitSfxChannels(INT32 sfxVolume); // // Per level startup code. @@ -125,6 +127,33 @@ void S_StartSoundAtVolume(const void *origin, sfxenum_t sound_id, INT32 volume); // Stop sound for thing at void S_StopSound(void *origin); +// +// Music Status +// + +boolean S_DigMusicDisabled(void); +boolean S_MIDIMusicDisabled(void); +boolean S_MusicDisabled(void); +boolean S_MusicPlaying(void); +boolean S_MusicPaused(void); +musictype_t S_MusicType(void); +boolean S_MusicInfo(char *mname, UINT16 *mflags, boolean *looping); +boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi); +#define S_DigExists(a) S_MusicExists(a, false, true) +#define S_MIDIExists(a) S_MusicExists(a, true, false) + + +// +// Music Properties +// + +// Set Speed of Music +boolean S_SpeedMusic(float speed); + +// +// Music Routines +// + // Start music track, arbitrary, given its name, and set whether looping // note: music flags 12 bits for tracknum (gme, other formats with more than one track) // 13-15 aren't used yet @@ -132,9 +161,6 @@ void S_StopSound(void *origin); #define S_ChangeMusicInternal(a,b) S_ChangeMusic(a,0,b) void S_ChangeMusic(const char *mmusic, UINT16 mflags, boolean looping); -// Set Speed of Music -boolean S_SpeedMusic(float speed); - // Stops the music. void S_StopMusic(void); @@ -149,9 +175,11 @@ void S_UpdateSounds(void); FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2); -void S_SetDigMusicVolume(INT32 volume); -void S_SetMIDIMusicVolume(INT32 volume); void S_SetSfxVolume(INT32 volume); +void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume); +#define S_SetDigMusicVolume(a) S_SetMusicVolume(a,-1) +#define S_SetMIDIMusicVolume(a) S_SetMusicVolume(-1,a) +#define S_InitMusicVolume() S_SetMusicVolume(-1,-1) INT32 S_OriginPlaying(void *origin); INT32 S_IdPlaying(sfxenum_t id); diff --git a/src/screen.c b/src/screen.c index 20b7134a1..9ea996bf9 100644 --- a/src/screen.c +++ b/src/screen.c @@ -69,11 +69,7 @@ consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, N consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -#ifdef DIRECTFULLSCREEN -static FUNCMATH void SCR_ChangeFullscreen (void); -#else static void SCR_ChangeFullscreen (void); -#endif consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL}; @@ -285,7 +281,10 @@ void SCR_Recalc(void) vid.fdupy = FixedDiv(vid.height*FRACUNIT, BASEVIDHEIGHT*FRACUNIT); #ifdef HWRENDER - if (rendermode != render_opengl && rendermode != render_none) // This was just placing it incorrectly at non aspect correct resolutions in opengl + //if (rendermode != render_opengl && rendermode != render_none) // This was just placing it incorrectly at non aspect correct resolutions in opengl + // 13/11/18: + // The above is no longer necessary, since we want OpenGL to be just like software now + // -- Monster Iestyn #endif vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy); diff --git a/src/sdl/IMG_xpm.c b/src/sdl/IMG_xpm.c index 8adfd3434..af76ec1dd 100644 --- a/src/sdl/IMG_xpm.c +++ b/src/sdl/IMG_xpm.c @@ -45,9 +45,10 @@ #if 0 #include "SDL_image.h" #else -extern SDLCALL int SDLCALL IMG_isXPM(SDL_RWops *src); -extern SDLCALL SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src); -extern SDLCALL SDL_Surface * SDLCALL IMG_ReadXPMFromArray(const char **xpm); +// SDLCALL terms removed from original SDL_image declarations +int IMG_isXPM(SDL_RWops *src); +SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src); +SDL_Surface *IMG_ReadXPMFromArray(const char **xpm); #define IMG_SetError SDL_SetError #define IMG_GetError SDL_GetError #endif diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters index 1d132faf0..bf9e4ac13 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj.filters +++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters @@ -216,6 +216,9 @@ Hw_Hardware + + Hw_Hardware + Hw_Hardware @@ -606,6 +609,9 @@ Hw_Hardware + + Hw_Hardware + Hw_Hardware diff --git a/src/sdl/i_cdmus.c b/src/sdl/i_cdmus.c index 3105f5122..5d086e73a 100644 --- a/src/sdl/i_cdmus.c +++ b/src/sdl/i_cdmus.c @@ -12,19 +12,19 @@ consvar_t cd_volume = {"cd_volume","31",CV_SAVE,soundvolume_cons_t, NULL, 0, NUL consvar_t cdUpdate = {"cd_update","1",CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; -FUNCMATH void I_InitCD(void){} +void I_InitCD(void){} -FUNCMATH void I_StopCD(void){} +void I_StopCD(void){} -FUNCMATH void I_PauseCD(void){} +void I_PauseCD(void){} -FUNCMATH void I_ResumeCD(void){} +void I_ResumeCD(void){} -FUNCMATH void I_ShutdownCD(void){} +void I_ShutdownCD(void){} -FUNCMATH void I_UpdateCD(void){} +void I_UpdateCD(void){} -FUNCMATH void I_PlayCD(UINT8 track, UINT8 looping) +void I_PlayCD(UINT8 track, UINT8 looping) { (void)track; (void)looping; diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index c8fcd080e..0963cc288 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1,8 +1,11 @@ // Emacs style mode select -*- C++ -*- +// +// SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // // Copyright (C) 1993-1996 by id Software, Inc. // Portions Copyright (C) 1998-2000 by DooM Legacy Team. +// Copyright (C) 2014-2018 by Sonic Team Junior. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -124,6 +127,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include "macosx/mac_resources.h" #endif +#ifndef errno +#include +#endif + // Locations for searching the srb2.pk3 #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) #define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2" @@ -1149,6 +1156,7 @@ static void I_ShutdownJoystick2(void) D_PostEvent(&event); } + joystick2_started = 0; JoyReset(&JoyInfo2); if (!joystick_started && !joystick2_started && SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) { @@ -1678,7 +1686,7 @@ static void I_ShutdownMouse2(void) EscapeCommFunction(mouse2filehandle, CLRRTS); PurgeComm(mouse2filehandle, PURGE_TXABORT | PURGE_RXABORT | - PURGE_TXCLEAR | PURGE_RXCLEAR); + PURGE_TXCLEAR | PURGE_RXCLEAR); CloseHandle(mouse2filehandle); @@ -1871,11 +1879,11 @@ void I_StartupMouse2(void) { // COM file handle mouse2filehandle = CreateFileA(cv_mouse2port.string, GENERIC_READ | GENERIC_WRITE, - 0, // exclusive access - NULL, // no security attrs - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); + 0, // exclusive access + NULL, // no security attrs + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); if (mouse2filehandle == INVALID_HANDLE_VALUE) { INT32 e = GetLastError(); @@ -1895,7 +1903,7 @@ void I_StartupMouse2(void) // purge buffers PurgeComm(mouse2filehandle, PURGE_TXABORT | PURGE_RXABORT - | PURGE_TXCLEAR | PURGE_RXCLEAR); + | PURGE_TXCLEAR | PURGE_RXCLEAR); // setup port to 1200 7N1 dcb.DCBlength = sizeof (DCB); @@ -1921,14 +1929,14 @@ void I_StartupMouse2(void) // // I_Tactile // -FUNCMATH void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect) +void I_Tactile(FFType pFFType, const JoyFF_t *FFEffect) { // UNUSED. (void)pFFType; (void)FFEffect; } -FUNCMATH void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect) +void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect) { // UNUSED. (void)pFFType; @@ -1939,7 +1947,7 @@ FUNCMATH void I_Tactile2(FFType pFFType, const JoyFF_t *FFEffect) */ static ticcmd_t emptycmd; -FUNCMATH ticcmd_t *I_BaseTiccmd(void) +ticcmd_t *I_BaseTiccmd(void) { return &emptycmd; } @@ -1948,7 +1956,7 @@ FUNCMATH ticcmd_t *I_BaseTiccmd(void) */ static ticcmd_t emptycmd2; -FUNCMATH ticcmd_t *I_BaseTiccmd2(void) +ticcmd_t *I_BaseTiccmd2(void) { return &emptycmd2; } @@ -2024,7 +2032,7 @@ static void I_ShutdownTimer(void) tic_t I_GetTime (void) { static Uint32 basetime = 0; - Uint32 ticks = SDL_GetTicks(); + Uint32 ticks = SDL_GetTicks(); if (!basetime) basetime = ticks; @@ -2042,7 +2050,7 @@ tic_t I_GetTime (void) // //I_StartupTimer // -FUNCMATH void I_StartupTimer(void) +void I_StartupTimer(void) { #ifdef _WIN32 // for win2k time bug @@ -2090,7 +2098,6 @@ INT32 I_StartupSystem(void) return 0; } - // // I_Quit // @@ -2142,11 +2149,11 @@ void I_WaitVBL(INT32 count) SDL_Delay(count); } -FUNCMATH void I_BeginRead(void) +void I_BeginRead(void) { } -FUNCMATH void I_EndRead(void) +void I_EndRead(void) { } @@ -2369,7 +2376,7 @@ void I_GetDiskFreeSpace(INT64 *freespace) { DWORD SectorsPerCluster, BytesPerSector, NumberOfFreeClusters, TotalNumberOfClusters; GetDiskFreeSpace(NULL, &SectorsPerCluster, &BytesPerSector, - &NumberOfFreeClusters, &TotalNumberOfClusters); + &NumberOfFreeClusters, &TotalNumberOfClusters); *freespace = BytesPerSector*SectorsPerCluster*NumberOfFreeClusters; } #else // Dummy for platform independent; 1GB should be enough @@ -2576,22 +2583,22 @@ static const char *locateWad(void) #ifdef CMAKECONFIG #ifndef NDEBUG - I_OutputMsg(","CMAKE_ASSETS_DIR); - strcpy(returnWadPath, CMAKE_ASSETS_DIR); - if (isWadPathOk(returnWadPath)) - { - return returnWadPath; - } + I_OutputMsg(","CMAKE_ASSETS_DIR); + strcpy(returnWadPath, CMAKE_ASSETS_DIR); + if (isWadPathOk(returnWadPath)) + { + return returnWadPath; + } #endif #endif #ifdef __APPLE__ - OSX_GetResourcesPath(returnWadPath); - I_OutputMsg(",%s", returnWadPath); - if (isWadPathOk(returnWadPath)) - { - return returnWadPath; - } + OSX_GetResourcesPath(returnWadPath); + I_OutputMsg(",%s", returnWadPath); + if (isWadPathOk(returnWadPath)) + { + return returnWadPath; + } #endif // examine default dirs @@ -2696,7 +2703,30 @@ const char *I_LocateWad(void) #ifdef __linux__ #define MEMINFO_FILE "/proc/meminfo" #define MEMTOTAL "MemTotal:" +#define MEMAVAILABLE "MemAvailable:" #define MEMFREE "MemFree:" +#define CACHED "Cached:" +#define BUFFERS "Buffers:" +#define SHMEM "Shmem:" + +/* Parse the contents of /proc/meminfo (in buf), return value of "name" + * (example: MemTotal) */ +static long get_entry(const char* name, const char* buf) +{ + long val; + char* hit = strstr(buf, name); + if (hit == NULL) { + return -1; + } + + errno = 0; + val = strtol(hit + strlen(name), NULL, 10); + if (errno != 0) { + CONS_Alert(CONS_ERROR, M_GetText("get_entry: strtol() failed: %s\n"), strerror(errno)); + return -1; + } + return val; +} #endif // quick fix for compil @@ -2758,6 +2788,11 @@ UINT32 I_GetFreeMem(UINT32 *total) UINT32 totalKBytes; INT32 n; INT32 meminfo_fd = -1; + long Cached; + long MemFree; + long Buffers; + long Shmem; + long MemAvailable = -1; meminfo_fd = open(MEMINFO_FILE, O_RDONLY); n = read(meminfo_fd, buf, 1023); @@ -2783,16 +2818,28 @@ UINT32 I_GetFreeMem(UINT32 *total) memTag += sizeof (MEMTOTAL); totalKBytes = atoi(memTag); - if ((memTag = strstr(buf, MEMFREE)) == NULL) + if ((memTag = strstr(buf, MEMAVAILABLE)) == NULL) { - // Error - if (total) - *total = 0L; - return 0; - } + Cached = get_entry(CACHED, buf); + MemFree = get_entry(MEMFREE, buf); + Buffers = get_entry(BUFFERS, buf); + Shmem = get_entry(SHMEM, buf); + MemAvailable = Cached + MemFree + Buffers - Shmem; - memTag += sizeof (MEMFREE); - freeKBytes = atoi(memTag); + if (MemAvailable == -1) + { + // Error + if (total) + *total = 0L; + return 0; + } + freeKBytes = MemAvailable; + } + else + { + memTag += sizeof (MEMAVAILABLE); + freeKBytes = atoi(memTag); + } if (total) *total = totalKBytes << 10; @@ -2869,5 +2916,5 @@ const CPUInfoFlags *I_CPUInfo(void) } // note CPUAFFINITY code used to reside here -FUNCMATH void I_RegisterSysCommands(void) {} +void I_RegisterSysCommands(void) {} #endif diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index bd3f5e60a..05ed527de 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1,8 +1,10 @@ // Emacs style mode select -*- C++ -*- +// SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // // Copyright (C) 1993-1996 by id Software, Inc. // Portions Copyright (C) 1998-2000 by DooM Legacy Team. +// Copyright (C) 2014-2018 by Sonic Team Junior. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -566,7 +568,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) // Tell game we got focus back, resume music if necessary window_notinfocus = false; if (!paused) - I_ResumeSong(0); //resume it + I_ResumeSong(); //resume it if (!firsttimeonmouse) { @@ -578,7 +580,7 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) { // Tell game we lost focus, pause music window_notinfocus = true; - I_PauseSong(0); + I_PauseSong(); if (!disable_mouse) { @@ -1057,7 +1059,7 @@ void I_SetPalette(RGBA_t *palette) } // return number of fullscreen + X11 modes -FUNCMATH INT32 VID_NumModes(void) +INT32 VID_NumModes(void) { if (USE_FULLSCREEN && numVidModes != -1) return numVidModes - firstEntry; @@ -1065,7 +1067,7 @@ FUNCMATH INT32 VID_NumModes(void) return MAXWINMODES; } -FUNCMATH const char *VID_GetModeName(INT32 modeNum) +const char *VID_GetModeName(INT32 modeNum) { #if 0 if (USE_FULLSCREEN && numVidModes != -1) // fullscreen modes @@ -1095,7 +1097,7 @@ FUNCMATH const char *VID_GetModeName(INT32 modeNum) return &vidModeName[modeNum][0]; } -FUNCMATH INT32 VID_GetModeForSize(INT32 w, INT32 h) +INT32 VID_GetModeForSize(INT32 w, INT32 h) { int i; for (i = 0; i < MAXWINMODES; i++) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 5211efe0a..a3c421991 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -1,3 +1,11 @@ +// SONIC ROBO BLAST 2 +//----------------------------------------------------------------------------- +// Copyright (C) 2014-2018 by Sonic Team Junior. +// +// This program is free software distributed under the +// terms of the GNU General Public License, version 2. +// See the 'LICENSE' file for more details. +//----------------------------------------------------------------------------- /// \file /// \brief SDL Mixer interface for sound @@ -34,14 +42,18 @@ (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) #endif +// thanks alam for making the buildbots happy! +#if SDL_MIXER_VERSION_ATLEAST(2,0,2) +#define MUS_MP3_MAD MUS_MP3_MAD_UNUSED +#define MUS_MODPLUG MUS_MODPLUG_UNUSED +#endif + #ifdef HAVE_LIBGME #include "gme/gme.h" #define GME_TREBLE 5.0 #define GME_BASS 1.0 -#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng - -#define HAVE_ZLIB +#ifdef HAVE_ZLIB #ifndef _MSC_VER #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE @@ -57,14 +69,13 @@ #endif #include "zlib.h" -#endif -#endif +#endif // HAVE_ZLIB +#endif // HAVE_LIBGME UINT8 sound_started = false; -static boolean midimode; static Mix_Music *music; -static UINT8 music_volume, midi_volume, sfx_volume; +static UINT8 music_volume, sfx_volume; static float loop_point; static boolean songpaused; @@ -73,13 +84,20 @@ static Music_Emu *gme; static INT32 current_track; #endif +/// ------------------------ +/// Audio System +/// ------------------------ + void I_StartupSound(void) { I_Assert(!sound_started); // EE inits audio first so we're following along. if (SDL_WasInit(SDL_INIT_AUDIO) == SDL_INIT_AUDIO) - CONS_Printf("SDL Audio already started\n"); + { + CONS_Debug(DBG_DETAILED, "SDL Audio already started\n"); + return; + } else if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { CONS_Alert(CONS_ERROR, "Error initializing SDL Audio: %s\n", SDL_GetError()); @@ -87,9 +105,8 @@ void I_StartupSound(void) return; } - midimode = false; music = NULL; - music_volume = midi_volume = sfx_volume = 0; + music_volume = sfx_volume = 0; #if SDL_MIXER_VERSION_ATLEAST(1,2,11) Mix_Init(MIX_INIT_FLAC|MIX_INIT_MOD|MIX_INIT_MP3|MIX_INIT_OGG); @@ -126,10 +143,14 @@ void I_ShutdownSound(void) #endif } -FUNCMATH void I_UpdateSound(void) +void I_UpdateSound(void) { } +/// ------------------------ +/// SFX +/// ------------------------ + // this is as fast as I can possibly make it. // sorry. more asm needed. static Mix_Chunk *ds2chunk(void *stream) @@ -178,7 +199,7 @@ static Mix_Chunk *ds2chunk(void *stream) return NULL; // would and/or did wrap, can't store. break; } - sound = malloc(newsamples<<2); // samples * frequency shift * bytes per sample * channels + sound = Z_Malloc(newsamples<<2, PU_SOUND, NULL); // samples * frequency shift * bytes per sample * channels s = (SINT8 *)stream; d = (INT16 *)sound; @@ -246,6 +267,7 @@ void *I_GetSfx(sfxinfo_t *sfx) { void *lump; Mix_Chunk *chunk; + SDL_RWops *rw; #ifdef HAVE_LIBGME Music_Emu *emu; gme_info_t *info; @@ -361,7 +383,7 @@ void *I_GetSfx(sfxinfo_t *sfx) } Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up #else - //CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); + return NULL; // No zlib support #endif } // Try to read it as a GME sound @@ -387,21 +409,43 @@ void *I_GetSfx(sfxinfo_t *sfx) #endif // Try to load it as a WAVE or OGG using Mixer. - return Mix_LoadWAV_RW(SDL_RWFromMem(lump, sfx->length), 1); + rw = SDL_RWFromMem(lump, sfx->length); + if (rw != NULL) + { + chunk = Mix_LoadWAV_RW(rw, 1); + return chunk; + } + + return NULL; // haven't been able to get anything } void I_FreeSfx(sfxinfo_t *sfx) { if (sfx->data) + { + Mix_Chunk *chunk = (Mix_Chunk*)sfx->data; + UINT8 *abufdata = NULL; + if (chunk->allocated == 0) + { + // We allocated the data in this chunk, so get the abuf from mixer, then let it free the chunk, THEN we free the data + // I believe this should ensure the sound is not playing when we free it + abufdata = chunk->abuf; + } Mix_FreeChunk(sfx->data); + if (abufdata) + { + // I'm going to assume we used Z_Malloc to allocate this data. + Z_Free(abufdata); + } + } sfx->data = NULL; sfx->lumpnum = LUMPERROR; } -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 - INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0); + INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0); Mix_Volume(handle, volume); Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff)); (void)pitch; // Mixer can't handle pitch @@ -432,11 +476,10 @@ void I_SetSfxVolume(UINT8 volume) sfx_volume = volume; } -// -// Music -// +/// ------------------------ +/// Music Hooks +/// ------------------------ -// Music hooks static void music_loop(void) { Mix_PlayMusic(music, 0); @@ -464,78 +507,101 @@ static void mix_gme(void *udata, Uint8 *stream, int len) } #endif -FUNCMATH void I_InitMusic(void) + +/// ------------------------ +/// Music System +/// ------------------------ + +void I_InitMusic(void) { } void I_ShutdownMusic(void) { - I_ShutdownDigMusic(); - I_ShutdownMIDIMusic(); + I_UnloadSong(); } -void I_PauseSong(INT32 handle) -{ - (void)handle; - Mix_PauseMusic(); - songpaused = true; -} +/// ------------------------ +/// Music Properties +/// ------------------------ -void I_ResumeSong(INT32 handle) -{ - (void)handle; - Mix_ResumeMusic(); - songpaused = false; -} - -// -// Digital Music -// - -void I_InitDigMusic(void) +musictype_t I_SongType(void) { #ifdef HAVE_LIBGME - gme = NULL; - current_track = -1; + if (gme) + return MU_GME; + else #endif + if (!music) + return MU_NONE; + else if (Mix_GetMusicType(music) == MUS_MID) + return MU_MID; + else if (Mix_GetMusicType(music) == MUS_MOD || Mix_GetMusicType(music) == MUS_MODPLUG) + return MU_MOD; + else if (Mix_GetMusicType(music) == MUS_MP3 || Mix_GetMusicType(music) == MUS_MP3_MAD) + return MU_MP3; + else + return (musictype_t)Mix_GetMusicType(music); } -void I_ShutdownDigMusic(void) +boolean I_SongPlaying(void) { - if (midimode) - return; + return ( +#ifdef HAVE_LIBGME + (I_SongType() == MU_GME && gme) || +#endif + music != NULL + ); +} + +boolean I_SongPaused(void) +{ + return songpaused; +} + +/// ------------------------ +/// Music Effects +/// ------------------------ + +boolean I_SetSongSpeed(float speed) +{ + if (speed > 250.0f) + speed = 250.0f; //limit speed up to 250x #ifdef HAVE_LIBGME if (gme) { - Mix_HookMusic(NULL, NULL); - gme_delete(gme); - gme = NULL; + SDL_LockAudio(); + gme_set_tempo(gme, speed); + SDL_UnlockAudio(); + return true; } +#else + (void)speed; #endif - if (!music) - return; - Mix_HookMusicFinished(NULL); - Mix_FreeMusic(music); - music = NULL; + return false; } -boolean I_StartDigSong(const char *musicname, boolean looping) +/// ------------------------ +/// Music Playback +/// ------------------------ + +boolean I_LoadSong(char *data, size_t len) { - char *data; - size_t len; - lumpnum_t lumpnum = W_CheckNumForName(va("O_%s",musicname)); + const char *key1 = "LOOP"; + const char *key2 = "POINT="; + const char *key3 = "MS="; + const size_t key1len = strlen(key1); + const size_t key2len = strlen(key2); + const size_t key3len = strlen(key3); + char *p = data; + SDL_RWops *rw; - I_Assert(!music); + if (music #ifdef HAVE_LIBGME - I_Assert(!gme); + || gme #endif - - if (lumpnum == LUMPERROR) - return false; - midimode = false; - - data = (char *)W_CacheLumpNum(lumpnum, PU_MUSIC); - len = W_LumpLength(lumpnum); + ) + I_UnloadSong(); #ifdef HAVE_LIBGME if ((UINT8)data[0] == 0x1F @@ -621,66 +687,95 @@ boolean I_StartDigSong(const char *musicname, boolean looping) } Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up #else - //CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); + CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); + return true; #endif } else if (!gme_open_data(data, len, &gme, 44100)) { gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; - gme_start_track(gme, 0); - current_track = 0; gme_set_equalizer(gme, &eq); - Mix_HookMusic(mix_gme, gme); return true; } #endif - music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE); + rw = SDL_RWFromMem(data, len); + if (rw != NULL) + { + music = Mix_LoadMUS_RW(rw, 1); + } if (!music) { CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError()); - return true; + return false; } // Find the OGG loop point. loop_point = 0.0f; - if (looping) + + while ((UINT32)(p - data) < len) { - const char *key1 = "LOOP"; - const char *key2 = "POINT="; - const char *key3 = "MS="; - const size_t key1len = strlen(key1); - const size_t key2len = strlen(key2); - const size_t key3len = strlen(key3); - char *p = data; - while ((UINT32)(p - data) < len) + if (strncmp(p++, key1, key1len)) + continue; + p += key1len-1; // skip OOP (the L was skipped in strncmp) + if (!strncmp(p, key2, key2len)) // is it LOOPPOINT=? { - if (strncmp(p++, key1, key1len)) - continue; - p += key1len-1; // skip OOP (the L was skipped in strncmp) - if (!strncmp(p, key2, key2len)) // is it LOOPPOINT=? - { - p += key2len; // skip POINT= - loop_point = (float)((44.1L+atoi(p)) / 44100.0L); // LOOPPOINT works by sample count. - // because SDL_Mixer is USELESS and can't even tell us - // something simple like the frequency of the streaming music, - // we are unfortunately forced to assume that ALL MUSIC is 44100hz. - // This means a lot of tracks that are only 22050hz for a reasonable downloadable file size will loop VERY badly. - } - else if (!strncmp(p, key3, key3len)) // is it LOOPMS=? - { - p += key3len; // skip MS= - loop_point = (float)(atoi(p) / 1000.0L); // LOOPMS works by real time, as miliseconds. - // Everything that uses LOOPMS will work perfectly with SDL_Mixer. - } - // Neither?! Continue searching. + p += key2len; // skip POINT= + loop_point = (float)((44.1L+atoi(p)) / 44100.0L); // LOOPPOINT works by sample count. + // because SDL_Mixer is USELESS and can't even tell us + // something simple like the frequency of the streaming music, + // we are unfortunately forced to assume that ALL MUSIC is 44100hz. + // This means a lot of tracks that are only 22050hz for a reasonable downloadable file size will loop VERY badly. } + else if (!strncmp(p, key3, key3len)) // is it LOOPMS=? + { + p += key3len; // skip MS= + loop_point = (float)(atoi(p) / 1000.0L); // LOOPMS works by real time, as miliseconds. + // Everything that uses LOOPMS will work perfectly with SDL_Mixer. + } + // Neither?! Continue searching. } + return true; +} + +void I_UnloadSong(void) +{ + I_StopSong(); + +#ifdef HAVE_LIBGME + if (gme) + { + gme_delete(gme); + gme = NULL; + } +#endif + if (music) + { + Mix_FreeMusic(music); + music = NULL; + } +} + +boolean I_PlaySong(boolean looping) +{ +#ifdef HAVE_LIBGME + if (gme) + { + gme_start_track(gme, 0); + current_track = 0; + Mix_HookMusic(mix_gme, gme); + return true; + } + else +#endif + if (!music) + return false; + if (Mix_PlayMusic(music, looping && loop_point == 0.0f ? -1 : 0) == -1) { CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError()); - return true; + return false; } Mix_VolumeMusic((UINT32)music_volume*128/31); @@ -689,51 +784,49 @@ boolean I_StartDigSong(const char *musicname, boolean looping) return true; } -void I_StopDigSong(void) +void I_StopSong(void) { - if (midimode) - return; #ifdef HAVE_LIBGME if (gme) { Mix_HookMusic(NULL, NULL); - gme_delete(gme); - gme = NULL; current_track = -1; - return; } #endif - if (!music) - return; - Mix_HookMusicFinished(NULL); - Mix_FreeMusic(music); - music = NULL; -} - -void I_SetDigMusicVolume(UINT8 volume) -{ - music_volume = volume; - if (midimode || !music) - return; - Mix_VolumeMusic((UINT32)volume*128/31); -} - -boolean I_SetSongSpeed(float speed) -{ - if (speed > 250.0f) - speed = 250.0f; //limit speed up to 250x -#ifdef HAVE_LIBGME - if (gme) + if (music) { - SDL_LockAudio(); - gme_set_tempo(gme, speed); - SDL_UnlockAudio(); - return true; + Mix_HookMusicFinished(NULL); + Mix_HaltMusic(); } -#else - (void)speed; +} + +void I_PauseSong(void) +{ + Mix_PauseMusic(); + songpaused = true; +} + +void I_ResumeSong(void) +{ + Mix_ResumeMusic(); + songpaused = false; +} + +void I_SetMusicVolume(UINT8 volume) +{ + if (!I_SongPlaying()) + return; + +#ifdef _WIN32 + if (I_SongType() == MU_MID) + // HACK: Until we stop using native MIDI, + // disable volume changes + music_volume = 31; + else #endif - return false; + music_volume = volume; + + Mix_VolumeMusic((UINT32)music_volume*128/31); } boolean I_SetSongTrack(int track) @@ -767,79 +860,4 @@ boolean I_SetSongTrack(int track) return false; } -// -// MIDI Music -// - -FUNCMATH void I_InitMIDIMusic(void) -{ -} - -void I_ShutdownMIDIMusic(void) -{ - if (!midimode || !music) - return; - Mix_FreeMusic(music); - music = NULL; -} - -void I_SetMIDIMusicVolume(UINT8 volume) -{ - // HACK: Until we stop using native MIDI, - // disable volume changes - (void)volume; - midi_volume = 31; - //midi_volume = volume; - - if (!midimode || !music) - return; - Mix_VolumeMusic((UINT32)midi_volume*128/31); -} - -INT32 I_RegisterSong(void *data, size_t len) -{ - music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE); - if (!music) - { - CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError()); - return -1; - } - return 1337; -} - -boolean I_PlaySong(INT32 handle, boolean looping) -{ - (void)handle; - - midimode = true; - - if (Mix_PlayMusic(music, looping ? -1 : 0) == -1) - { - CONS_Alert(CONS_ERROR, "Mix_PlayMusic: %s\n", Mix_GetError()); - return false; - } - - Mix_VolumeMusic((UINT32)midi_volume*128/31); - return true; -} - -void I_StopSong(INT32 handle) -{ - if (!midimode || !music) - return; - - (void)handle; - Mix_HaltMusic(); -} - -void I_UnRegisterSong(INT32 handle) -{ - if (!midimode || !music) - return; - - (void)handle; - Mix_FreeMusic(music); - music = NULL; -} - #endif diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 63b51c625..ebd615de2 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -194,8 +194,8 @@ static srb2audio_t localdata; static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio callback { if (Snd_Mutex) SDL_LockMutex(Snd_Mutex); - else if (nosound) return; - else if (nomidimusic && nodigimusic + else if (sound_disabled) return; + else if (midi_disabled && digital_disabled #ifdef HW3SOUND && hws_mode == HWS_DEFAULT_MODE #endif @@ -208,8 +208,8 @@ static void Snd_LockAudio(void) //Alam: Lock audio data and uninstall audio call static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio callback { if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex); - else if (nosound) return; - else if (nomidimusic && nodigimusic + else if (sound_disabled) return; + else if (midi_disabled && digital_disabled #ifdef HW3SOUND && hws_mode == HWS_DEFAULT_MODE #endif @@ -219,7 +219,7 @@ static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio #endif } -FUNCMATH static inline Uint16 Snd_LowerRate(Uint16 sr) +static inline Uint16 Snd_LowerRate(Uint16 sr) { if (sr <= audio.freq) // already lowered rate? return sr; // good then @@ -493,7 +493,7 @@ static inline void I_SetChannels(void) INT32 *steptablemid = steptable + 128; - if (nosound) + if (sound_disabled) return; // This table provides step widths for pitch parameters. @@ -604,12 +604,13 @@ void I_FreeSfx(sfxinfo_t * sfx) // Pitching (that is, increased speed of playback) // is set, but currently not used by mixing. // -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { (void)priority; (void)pitch; + (void)channel; - if (nosound) + if (sound_disabled) return 0; if (S_sfx[id].data == NULL) return -1; @@ -989,7 +990,7 @@ FUNCINLINE static ATTRINLINE void I_UpdateStream16M(Uint8 *stream, int len) if (Snd_Mutex) SDL_UnlockMutex(Snd_Mutex); } -#ifdef HAVE_LIBGME +#if 0 //#ifdef HAVE_LIBGME static void I_UpdateSteamGME(Music_Emu *emu, INT16 *stream, int len, UINT8 looping) { #define GME_BUFFER_LEN 44100*2048 @@ -1049,14 +1050,16 @@ static void SDLCALL I_UpdateStream(void *userdata, Uint8 *stream, int len) else if (audio.channels == 2 && audio.format == AUDIO_S16SYS) { I_UpdateStream16S(stream, len); -#ifdef HAVE_LIBGME - if (userdata) - { - srb2audio_t *sa_userdata = userdata; - if (!sa_userdata->gme_pause) - I_UpdateSteamGME(sa_userdata->gme_emu, (INT16 *)stream, len/4, sa_userdata->gme_loop); - } -#endif + + // Crashes! But no matter; this build doesn't play music anyway... +// #ifdef HAVE_LIBGME +// if (userdata) +// { +// srb2audio_t *sa_userdata = userdata; +// if (!sa_userdata->gme_pause) +// I_UpdateSteamGME(sa_userdata->gme_emu, (INT16 *)stream, len/4, sa_userdata->gme_loop); +// } +// #endif } } @@ -1136,7 +1139,7 @@ static INT32 Init3DSDriver(const char *soName) void I_ShutdownSound(void) { - if (nosound || !sound_started) + if (sound_disabled || !sound_started) return; CONS_Printf("I_ShutdownSound: "); @@ -1150,7 +1153,7 @@ void I_ShutdownSound(void) } #endif - if (nomidimusic && nodigimusic) + if (midi_disabled && digital_disabled) SDL_CloseAudio(); CONS_Printf("%s", M_GetText("shut down\n")); sound_started = false; @@ -1170,7 +1173,7 @@ void I_StartupSound(void) const char *sdrv_name = NULL; #endif #ifndef HAVE_MIXER - nomidimusic = nodigimusic = true; + midi_disabled = digital_disabled = true; #endif memset(channels, 0, sizeof (channels)); //Alam: Clean it @@ -1213,7 +1216,7 @@ void I_StartupSound(void) audio.samples /= 2; } - if (nosound) + if (sound_disabled) return; #ifdef HW3SOUND @@ -1261,7 +1264,7 @@ void I_StartupSound(void) { snddev_t snddev; - //nosound = true; + //sound_disabled = true; //I_AddExitFunc(I_ShutdownSound); snddev.bps = 16; snddev.sample_rate = audio.freq; @@ -1288,7 +1291,7 @@ void I_StartupSound(void) if (!musicStarted && SDL_OpenAudio(&audio, &audio) < 0) { CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n")); - nosound = true; + sound_disabled = true; return; } else @@ -1313,13 +1316,11 @@ void I_StartupSound(void) // MUSIC API. // -void I_ShutdownMIDIMusic(void) -{ - nomidimusic = false; - if (nodigimusic) I_ShutdownMusic(); -} +/// ------------------------ +// MUSIC SYSTEM +/// ------------------------ -#ifdef HAVE_LIBGME +#if 0 //#ifdef HAVE_LIBGME static void I_ShutdownGMEMusic(void) { Snd_LockAudio(); @@ -1330,390 +1331,126 @@ static void I_ShutdownGMEMusic(void) } #endif -void I_ShutdownDigMusic(void) -{ - nodigimusic = false; - if (nomidimusic) I_ShutdownMusic(); -} - -#ifdef HAVE_MIXER -static boolean LoadSong(void *data, size_t lumplength, size_t selectpos) -{ - FILE *midfile; - const char *tempname; -#ifdef USE_RWOPS - if (canuseRW) - { - SDL_RWops *SDLRW; - void *olddata = Smidi[selectpos]; //quick shortcut to set - - Z_Free(olddata); //free old memory - Smidi[selectpos] = NULL; - - if (!data) - return olddata != NULL; //was there old data? - - SDLRW = SDL_RWFromConstMem(data, (int)lumplength); //new RWops from Z_zone - if (!SDLRW) //ERROR while making RWops! - { - CONS_Printf(M_GetText("Couldn't load music lump: %s\n"), SDL_GetError()); - Z_Free(data); - return false; - } - - music[selectpos] = Mix_LoadMUS_RW(SDLRW); // new Mix_Chuck from RWops - if (music[selectpos]) - Smidi[selectpos] = data; //all done - else //ERROR while making Mix_Chuck - { - CONS_Printf(M_GetText("Couldn't load music data: %s\n"), Mix_GetError()); - Z_Free(data); - SDL_RWclose(SDLRW); - Smidi[selectpos] = NULL; - } - return true; - } -#endif - tempname = va("%s/%s", MIDI_PATH, fmidi[selectpos]); - - if (!data) - { - if (FIL_FileExists(tempname)) - return unlink(tempname)+1; -#ifdef MIDI_PATH2 - else if (FIL_FileExists(tempname = va("%s/%s", MIDI_PATH2, fmidi[selectpos]))) - return unlink(tempname)+1; -#endif - else - return false; - } - - midfile = fopen(tempname, "wb"); - -#ifdef MIDI_PATH2 - if (!midfile) - { - tempname = va("%s/%s", MIDI_PATH2, fmidi[selectpos]); - midfile = fopen(tempname, "wb"); - } -#endif - - if (!midfile) - { - CONS_Printf(M_GetText("Couldn't open file %s to write music in\n"), tempname); - Z_Free(data); - return false; - } - - if (fwrite(data, lumplength, 1, midfile) == 0) - { - CONS_Printf(M_GetText("Couldn't write music into file %s because %s\n"), tempname, strerror(ferror(midfile))); - Z_Free(data); - fclose(midfile); - return false; - } - - fclose(midfile); - - Z_Free(data); - - music[selectpos] = Mix_LoadMUS(tempname); - if (!music[selectpos]) //ERROR while making Mix_Chuck - { - CONS_Printf(M_GetText("Couldn't load music file %s: %s\n"), tempname, Mix_GetError()); - return false; - } - return true; -} -#endif - - -void I_ShutdownMusic(void) -{ -#ifdef HAVE_MIXER - if ((nomidimusic && nodigimusic) || !musicStarted) - return; - - CONS_Printf("%s", M_GetText("I_ShutdownMusic: ")); - - I_UnRegisterSong(0); - I_StopDigSong(); - Mix_CloseAudio(); -#ifdef MIX_INIT - Mix_Quit(); -#endif - CONS_Printf("%s", M_GetText("shut down\n")); - musicStarted = SDL_FALSE; - if (Msc_Mutex) - SDL_DestroyMutex(Msc_Mutex); - Msc_Mutex = NULL; -#endif -} - -void I_InitMIDIMusic(void) -{ - if (nodigimusic) I_InitMusic(); -} - -void I_InitDigMusic(void) -{ - if (nomidimusic) I_InitMusic(); -} - void I_InitMusic(void) { -#ifdef HAVE_MIXER - char ad[100]; - SDL_version MIXcompiled; - const SDL_version *MIXlinked; -#ifdef MIXER_INIT - const int mixstart = MIX_INIT_OGG; - int mixflags; -#endif -#endif -#ifdef HAVE_LIBGME +#if 0 //#ifdef HAVE_LIBGME I_AddExitFunc(I_ShutdownGMEMusic); #endif - -#ifdef HAVE_MIXER - MIX_VERSION(&MIXcompiled) - MIXlinked = Mix_Linked_Version(); - I_OutputMsg("Compiled for SDL_mixer version: %d.%d.%d\n", - MIXcompiled.major, MIXcompiled.minor, MIXcompiled.patch); -#ifdef MIXER_POS - if (MIXlinked->major == 1 && MIXlinked->minor == 2 && MIXlinked->patch < 7) - canlooping = SDL_FALSE; -#endif -#ifdef USE_RWOPS - if (M_CheckParm("-noRW")) - canuseRW = SDL_FALSE; -#endif - I_OutputMsg("Linked with SDL_mixer version: %d.%d.%d\n", - MIXlinked->major, MIXlinked->minor, MIXlinked->patch); - if (audio.freq < 44100 && !M_CheckParm ("-freq")) //I want atleast 44Khz - { - audio.samples = (Uint16)(audio.samples*(INT32)(44100/audio.freq)); - audio.freq = 44100; //Alam: to keep it around the same XX ms - } - - if (sound_started -#ifdef HW3SOUND - && hws_mode == HWS_DEFAULT_MODE -#endif - ) - { - I_OutputMsg("Temp Shutdown of SDL Audio System"); - SDL_CloseAudio(); - I_OutputMsg(" Done\n"); - } - - CONS_Printf("%s", M_GetText("I_InitMusic:")); - -#ifdef MIXER_INIT - mixflags = Mix_Init(mixstart); - if ((mixstart & MIX_INIT_FLAC) != (mixflags & MIX_INIT_FLAC)) - { - CONS_Printf("%s", M_GetText(" Unable to load FLAC support\n")); - } - if ((mixstart & MIX_INIT_MOD ) != (mixflags & MIX_INIT_MOD )) - { - CONS_Printf("%s", M_GetText(" Unable to load MOD support\n")); - } - if ((mixstart & MIX_INIT_MP3 ) != (mixflags & MIX_INIT_MP3 )) - { - CONS_Printf("%s", M_GetText(" Unable to load MP3 support\n")); - } - if ((mixstart & MIX_INIT_OGG ) != (mixflags & MIX_INIT_OGG )) - { - CONS_Printf("%s", M_GetText(" Unable to load OGG support\n")); - } -#endif - - if (Mix_OpenAudio(audio.freq, audio.format, audio.channels, audio.samples) < 0) //open_music(&audio) - { - CONS_Printf(M_GetText(" Unable to open music: %s\n"), Mix_GetError()); - nomidimusic = nodigimusic = true; - if (sound_started -#ifdef HW3SOUND - && hws_mode == HWS_DEFAULT_MODE -#endif - ) - { - if (SDL_OpenAudio(&audio, NULL) < 0) //retry - { - CONS_Printf("%s", M_GetText(" couldn't open audio with desired format\n")); - nosound = true; - sound_started = false; - } - else - { - CONS_Printf(M_GetText(" Starting with audio driver : %s\n"), SDL_AudioDriverName(ad, (int)sizeof ad)); - } - } - return; - } - else - CONS_Printf(M_GetText(" Starting up with audio driver : %s with SDL_Mixer\n"), SDL_AudioDriverName(ad, (int)sizeof ad)); - - samplecount = audio.samples; - CV_SetValue(&cv_samplerate, audio.freq); - if (sound_started -#ifdef HW3SOUND - && hws_mode == HWS_DEFAULT_MODE -#endif - ) - I_OutputMsg(" Reconfigured SDL Audio System"); - else I_OutputMsg(" Configured SDL_Mixer System"); - I_OutputMsg(" with %d samples/slice at %ikhz(%dms buffer)\n", samplecount, audio.freq/1000, (INT32) ((audio.samples * 1000.0f) / audio.freq)); - Mix_SetPostMix(audio.callback, audio.userdata); // after mixing music, add sound effects - Mix_Resume(-1); - CONS_Printf("%s", M_GetText("Music initialized\n")); - musicStarted = SDL_TRUE; - Msc_Mutex = SDL_CreateMutex(); -#endif } -boolean I_PlaySong(INT32 handle, boolean looping) +void I_ShutdownMusic(void) { } + +/// ------------------------ +// MUSIC PROPERTIES +/// ------------------------ + +musictype_t I_SongType(void) { - (void)handle; -#ifdef HAVE_MIXER - if (nomidimusic || !musicStarted || !music[handle]) - return false; + return MU_NONE; +} -#ifdef MIXER_POS - if (canlooping) - Mix_HookMusicFinished(NULL); -#endif - - if (Mix_FadeInMusic(music[handle], looping ? -1 : 0, MIDIfade) == -1) - CONS_Printf(M_GetText("Couldn't play song because %s\n"), Mix_GetError()); - else - { - Mix_VolumeMusic(musicvol); - return true; - } -#else - (void)looping; -#endif +boolean I_SongPlaying(void) +{ return false; } +boolean I_SongPaused(void) +{ + return false; +} + +/// ------------------------ +// MUSIC EFFECTS +/// ------------------------ + +boolean I_SetSongSpeed(float speed) +{ + (void)speed; + return false; +} + +/// ------------------------ +// MUSIC PLAYBACK +/// ------------------------ + +#if 0 //#ifdef HAVE_LIBGME +static void I_StopGME(void) +{ + Snd_LockAudio(); + gme_seek(localdata.gme_emu, 0); + Snd_UnlockAudio(); +} + static void I_PauseGME(void) { -#ifdef HAVE_LIBGME localdata.gme_pause = true; -#endif -} - -void I_PauseSong(INT32 handle) -{ - (void)handle; - I_PauseGME(); -#ifdef HAVE_MIXER - if ((nomidimusic && nodigimusic) || !musicStarted) - return; - - Mix_PauseMusic(); - //I_StopSong(handle); -#endif } static void I_ResumeGME(void) { -#ifdef HAVE_LIBGME localdata.gme_pause = false; -#endif } - -void I_ResumeSong(INT32 handle) -{ - (void)handle; - I_ResumeGME(); -#ifdef HAVE_MIXER - if ((nomidimusic && nodigimusic) || !musicStarted) - return; - - Mix_VolumeMusic(musicvol); - Mix_ResumeMusic(); - //I_PlaySong(handle, true); #endif -} -void I_StopSong(INT32 handle) +boolean I_LoadSong(char *data, size_t len) { - (void)handle; -#ifdef HAVE_MIXER - if (nomidimusic || !musicStarted) - return; - Mix_FadeOutMusic(MIDIfade); -#endif -} - -void I_UnRegisterSong(INT32 handle) -{ -#ifdef HAVE_MIXER - - if (nomidimusic || !musicStarted) - return; - - Mix_HaltMusic(); - while (Mix_PlayingMusic()) - ; - - if (music[handle]) - Mix_FreeMusic(music[handle]); - music[handle] = NULL; - LoadSong(NULL, 0, handle); -#else - (void)handle; -#endif -} - -INT32 I_RegisterSong(void *data, size_t len) -{ -#ifdef HAVE_MIXER - if (nomidimusic || !musicStarted) - return false; - - if (!LoadSong(data, len, 0)) - return false; - - if (music[0]) - return true; - - CONS_Printf(M_GetText("Couldn't load MIDI: %s\n"), Mix_GetError()); -#else - (void)len; - (void)data; -#endif return false; } -void I_SetMIDIMusicVolume(UINT8 volume) -{ -#ifdef HAVE_MIXER - if ((nomidimusic && nodigimusic) || !musicStarted) - return; +void I_UnloadSong(void) { } - if (Msc_Mutex) SDL_LockMutex(Msc_Mutex); - musicvol = volume * 2; - if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); - Mix_VolumeMusic(musicvol); -#else - (void)volume; +boolean I_PlaySong(boolean looping) +{ + (void)looping; + return false; +} + +void I_StopSong(void) +{ +#if 0 //#ifdef HAVE_LIBGME + I_StopGME(); #endif } -#ifdef HAVE_LIBGME +void I_PauseSong(void) +{ +#if 0 //#ifdef HAVE_LIBGME + I_PauseGME(); +#endif +} + +void I_ResumeSong(void) +{ +#if 0 + I_ResumeGME(); +#endif +} + +void I_SetMusicVolume(UINT8 volume) +{ + (void)volume; +} + +boolean I_SetSongTrack(int track) +{ + (void)track; + return false; +} + +/// ------------------------ +// MUSIC LOADING AND CLEANUP +// \todo Split logic between loading and playing, +// then move to Playback section +/// ------------------------ + +#if 0 //#ifdef HAVE_LIBGME static void I_CleanupGME(void *userdata) { Z_Free(userdata); } -#endif static boolean I_StartGMESong(const char *musicname, boolean looping) { -#ifdef HAVE_LIBGME char filename[9]; void *data; lumpnum_t lumpnum; @@ -1759,240 +1496,7 @@ static boolean I_StartGMESong(const char *musicname, boolean looping) Snd_UnlockAudio(); return true; -#else - (void)musicname; - (void)looping; -#endif - return false; -} - -boolean I_StartDigSong(const char *musicname, boolean looping) -{ -#ifdef HAVE_MIXER - char filename[9]; - void *data; - lumpnum_t lumpnum; - size_t lumplength; -#endif - - if(I_StartGMESong(musicname, looping)) - return true; - -#ifdef HAVE_MIXER - if (nodigimusic) - return false; - - snprintf(filename, sizeof filename, "o_%s", musicname); - - lumpnum = W_CheckNumForName(filename); - - I_StopDigSong(); - - if (lumpnum == LUMPERROR) - { - // Alam_GBC: like in win32/win_snd.c: Graue 02-29-2004: don't worry about missing music, there might still be a MIDI - //I_OutputMsg("Music lump %s not found!\n", filename); - return false; // No music found. Oh well! - } - else - lumplength = W_LumpLength(lumpnum); - - data = W_CacheLumpNum(lumpnum, PU_MUSIC); - - if (Msc_Mutex) SDL_LockMutex(Msc_Mutex); - -#ifdef MIXER_POS - if (canlooping && (loopingDig = looping) == SDL_TRUE && strcmp(data, "OggS") == 0) - looping = false; // Only on looping Ogg files, will we will do our own looping - - // Scan the Ogg Vorbis file for the COMMENT= field for a custom - // loop point - if (!looping && loopingDig) - { - size_t scan; - const char *dataum = data; - char looplength[64]; - UINT32 loopstart = 0; - UINT8 newcount = 0; - - Mix_HookMusicFinished(I_FinishMusic); - - for (scan = 0; scan < lumplength; scan++) - { - if (*dataum++ == 'C'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'M'){ - if (*dataum++ == 'M'){ - if (*dataum++ == 'E'){ - if (*dataum++ == 'N'){ - if (*dataum++ == 'T'){ - if (*dataum++ == '='){ - if (*dataum++ == 'L'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'P'){ - if (*dataum++ == 'P'){ - if (*dataum++ == 'O'){ - if (*dataum++ == 'I'){ - if (*dataum++ == 'N'){ - if (*dataum++ == 'T'){ - if (*dataum++ == '=') - { - - while (*dataum != 1 && newcount != 63) - looplength[newcount++] = *dataum++; - - looplength[newcount] = '\0'; - - loopstart = atoi(looplength); - - } - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - else - dataum--;} - } - - if (loopstart > 0) - { - loopstartDig = (double)((44.1l+loopstart) / 44100.0l); //8 PCM chucks off and PCM to secs -//#ifdef PARANOIA - //I_OutputMsg("I_StartDigSong: setting looping point to %ul PCMs(%f seconds)\n", loopstart, loopstartDig); -//#endif - } - else - { - looping = true; // loopingDig true, but couldn't find start loop point - } - } - else - loopstartDig = 0.0l; -#else - if (looping && strcmp(data, "OggS") == 0) - I_OutputMsg("I_StartDigSong: SRB2 was not compiled with looping music support(no Mix_FadeInMusicPos)\n"); -#endif - - if (!LoadSong(data, lumplength, 1)) - { - if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); - return false; - } - - // Note: LoadSong() frees the data. Let's make sure - // we don't try to use the data again. - data = NULL; - - if (Mix_FadeInMusic(music[1], looping ? -1 : 0, Digfade) == -1) - { - if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); - I_OutputMsg("I_StartDigSong: Couldn't play song %s because %s\n", musicname, Mix_GetError()); - return false; - } - Mix_VolumeMusic(musicvol); - - if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); - return true; -#else - (void)looping; - (void)musicname; - return false; -#endif -} - -static void I_StopGME(void) -{ -#ifdef HAVE_LIBGME - Snd_LockAudio(); - gme_seek(localdata.gme_emu, 0); - Snd_UnlockAudio(); -#endif -} - -void I_StopDigSong(void) -{ - I_StopGME(); -#ifdef HAVE_MIXER - if (nodigimusic) - return; - -#ifdef MIXER_POS - if (canlooping) - Mix_HookMusicFinished(NULL); -#endif - - Mix_HaltMusic(); - while (Mix_PlayingMusic()) - ; - - if (music[1]) - Mix_FreeMusic(music[1]); - music[1] = NULL; - LoadSong(NULL, 0, 1); -#endif -} - -void I_SetDigMusicVolume(UINT8 volume) -{ - I_SetMIDIMusicVolume(volume); -} - -boolean I_SetSongSpeed(float speed) -{ - - (void)speed; - return false; -} - -boolean I_SetSongTrack(int track) -{ - (void)track; - return false; -} - -#ifdef MIXER_POS -static void SDLCALL I_FinishMusic(void) -{ - if (!music[1]) - return; - else if (Msc_Mutex) SDL_LockMutex(Msc_Mutex); -// I_OutputMsg("I_FinishMusic: Loopping song to %g seconds\n", loopstartDig); - - if (Mix_FadeInMusicPos(music[1], loopstartDig ? 0 : -1, Digfade, loopstartDig) == 0) - Mix_VolumeMusic(musicvol); - else - I_OutputMsg("I_FinishMusic: Couldn't loop song because %s\n", Mix_GetError()); - - if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); } #endif + #endif //HAVE_SDL diff --git a/src/st_stuff.c b/src/st_stuff.c index e98c5e16d..0e0f30e1f 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -603,6 +603,9 @@ static void ST_drawDebugInfo(void) static void ST_drawScore(void) { + if (F_GetPromptHideHud(hudinfo[HUD_SCORE].y)) + return; + // SCORE: ST_DrawPatchFromHud(HUD_SCORE, sboscore, V_HUDTRANS); if (objectplacing) @@ -712,6 +715,9 @@ static void ST_drawTime(void) tictrn = G_TicsToCentiseconds(tics); } + if (F_GetPromptHideHud(hudinfo[HUD_TIME].y)) + return; + // TIME: ST_DrawPatchFromHud(HUD_TIME, ((downwards && (tics < 30*TICRATE) && (leveltime/5 & 1)) ? sboredtime : sbotime), V_HUDTRANS); @@ -738,6 +744,9 @@ static inline void ST_drawRings(void) { INT32 ringnum; + if (F_GetPromptHideHud(hudinfo[HUD_RINGS].y)) + return; + ST_DrawPatchFromHud(HUD_RINGS, ((!stplyr->spectator && stplyr->rings <= 0 && leveltime/5 & 1) ? sboredrings : sborings), ((stplyr->spectator) ? V_HUDTRANSHALF : V_HUDTRANS)); ringnum = ((objectplacing) ? op_currentdoomednum : max(stplyr->rings, 0)); @@ -756,6 +765,9 @@ static void ST_drawLivesArea(void) if (!stplyr->skincolor) return; // Just joined a server, skin isn't loaded yet! + if (F_GetPromptHideHud(hudinfo[HUD_LIVES].y)) + return; + // face background V_DrawSmallScaledPatch(hudinfo[HUD_LIVES].x, hudinfo[HUD_LIVES].y, hudinfo[HUD_LIVES].f|V_PERPLAYER|V_HUDTRANS, livesback); @@ -927,6 +939,9 @@ static void ST_drawInput(void) if (stplyr->powers[pw_carry] == CR_NIGHTSMODE) y -= 16; + if (F_GetPromptHideHud(y)) + return; + // O backing V_DrawFill(x, y-1, 16, 16, hudinfo[HUD_LIVES].f|20); V_DrawFill(x, y+15, 16, 1, hudinfo[HUD_LIVES].f|29); @@ -1202,6 +1217,9 @@ static void ST_drawPowerupHUD(void) static INT32 flagoffs[2] = {0, 0}, shieldoffs[2] = {0, 0}; #define ICONSEP (16+4) // matches weapon rings HUD + if (F_GetPromptHideHud(hudinfo[HUD_POWERUPS].y)) + return; + if (stplyr->spectator || stplyr->playerstate != PST_LIVE) return; @@ -1364,7 +1382,7 @@ static void ST_drawFirstPersonHUD(void) p = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE); // Display the countdown drown numbers! - if (p) + if (p && !F_GetPromptHideHud(60 - SHORT(p->topoffset))) V_DrawScaledPatch((BASEVIDWIDTH/2) - (SHORT(p->width)/2) + SHORT(p->leftoffset), 60 - SHORT(p->topoffset), V_PERPLAYER|V_PERPLAYER|V_TRANSLUCENT, p); } @@ -1491,8 +1509,8 @@ static void ST_drawNiGHTSLink(void) else colornum = linkColor[mag][sel]; - aflag |= ((stplyr->linktimer < 2*TICRATE/3) - ? (9 - 9*stplyr->linktimer/(2*TICRATE/3)) << V_ALPHASHIFT + aflag |= ((stplyr->linktimer < nightslinktics/3) + ? (9 - 9*stplyr->linktimer/(nightslinktics/3)) << V_ALPHASHIFT : 0); y = (160+11)<spectator)) { if (leveltime < hidetime * TICRATE) @@ -2087,6 +2111,9 @@ static void ST_drawTeamHUD(void) patch_t *p; #define SEP 20 + if (F_GetPromptHideHud(0)) // y base is 0 + return; + if (gametype == GT_CTF) p = bflagico; else @@ -2200,7 +2227,8 @@ static INT32 ST_drawEmeraldHuntIcon(mobj_t *hunt, patch_t **patches, INT32 offse interval = 0; } - V_DrawScaledPatch(hudinfo[HUD_HUNTPICS].x+offset, hudinfo[HUD_HUNTPICS].y, hudinfo[HUD_HUNTPICS].f|V_PERPLAYER|V_HUDTRANS, patches[i]); + if (!F_GetPromptHideHud(hudinfo[HUD_HUNTPICS].y)) + V_DrawScaledPatch(hudinfo[HUD_HUNTPICS].x+offset, hudinfo[HUD_HUNTPICS].y, hudinfo[HUD_HUNTPICS].f|V_PERPLAYER|V_HUDTRANS, patches[i]); return interval; } @@ -2298,7 +2326,8 @@ static void ST_overlayDrawer(void) //hu_showscores = auto hide score/time/rings when tab rankings are shown if (!(hu_showscores && (netgame || multiplayer))) { - if (maptol & TOL_NIGHTS || G_IsSpecialStage(gamemap)) + if ((maptol & TOL_NIGHTS || G_IsSpecialStage(gamemap)) && + !F_GetPromptHideHudAll()) ST_drawNiGHTSHUD(); else { diff --git a/src/st_stuff.h b/src/st_stuff.h index 8f73eb2e6..9c48a38af 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -24,7 +24,7 @@ // // Called by main loop. -FUNCMATH void ST_Ticker(void); +void ST_Ticker(void); // Called by main loop. void ST_Drawer(void); diff --git a/src/v_video.c b/src/v_video.c index 765965ffd..ae7c08511 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -532,7 +532,6 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t { UINT8 (*patchdrawfunc)(const UINT8*, const UINT8*, fixed_t); UINT32 alphalevel = 0; - boolean flip = false; fixed_t col, ofs, colfrac, rowfrac, fdup; INT32 dupx, dupy; @@ -610,22 +609,32 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t colfrac = FixedDiv(FRACUNIT, fdup); rowfrac = FixedDiv(FRACUNIT, fdup); - if (scrn & V_OFFSET) // Crosshair shit + // So it turns out offsets aren't scaled in V_NOSCALESTART unless V_OFFSET is applied ...poo, that's terrible + // For now let's just at least give V_OFFSET the ability to support V_FLIP + // I'll probably make a better fix for 2.2 where I don't have to worry about breaking existing support for stuff + // -- Monster Iestyn 29/10/18 { - y -= FixedMul((SHORT(patch->topoffset)*dupy)<leftoffset)*dupx)<topoffset)<width) - SHORT(patch->leftoffset))<width) - SHORT(patch->leftoffset))<leftoffset)<leftoffset)<topoffset)<>FRACBITS) < SHORT(patch->width); col += colfrac, ++offx, desttop++) { INT32 topdelta, prevdelta = -1; - if (flip) // offx is measured from right edge instead of left + if (scrn & V_FLIP) // offx is measured from right edge instead of left { if (x+pwidth-offx < 0) // don't draw off the left of the screen (WRAP PREVENTION) break; @@ -798,7 +807,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t prevdelta = topdelta; source = (const UINT8 *)(column) + 3; dest = desttop; - if (flip) + if (scrn & V_FLIP) dest = deststart + (destend - desttop); dest += FixedInt(FixedMul(topdelta<= numskins || (skins[skinnum].flags & SF_HIRES)) V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE)); else { @@ -1480,6 +1489,49 @@ void V_DrawFadeConsBack(INT32 plines) *buf = consolebgmap[*buf]; } +// Very similar to F_DrawFadeConsBack, except we draw from the middle(-ish) of the screen to the bottom. +void V_DrawPromptBack(INT32 boxheight, INT32 color) +{ + UINT8 *deststop, *buf; + + boxheight *= vid.dupy; + + if (color == INT32_MAX) + color = cons_backcolor.value; + +#ifdef HWRENDER + if (rendermode != render_soft && rendermode != render_none) + { + UINT32 hwcolor; + switch (color) + { + case 0: hwcolor = 0xffffff00; break; // White + case 1: hwcolor = 0x00000000; break; // Gray // Note this is different from V_DrawFadeConsBack + case 2: hwcolor = 0x40201000; break; // Brown + case 3: hwcolor = 0xff000000; break; // Red + case 4: hwcolor = 0xff800000; break; // Orange + case 5: hwcolor = 0x80800000; break; // Yellow + case 6: hwcolor = 0x00800000; break; // Green + case 7: hwcolor = 0x0000ff00; break; // Blue + case 8: hwcolor = 0x4080ff00; break; // Cyan + // Default green + default: hwcolor = 0x00800000; break; + } + HWR_DrawTutorialBack(hwcolor, boxheight); + return; + } +#endif + + CON_SetupBackColormapEx(color, true); + + // heavily simplified -- we don't need to know x or y position, + // just the start and stop positions + deststop = screens[0] + vid.rowbytes * vid.height; + buf = deststop - vid.rowbytes * ((boxheight * 4) + (boxheight/2)*5); // 4 lines of space plus gaps between and some leeway + for (; buf < deststop; ++buf) + *buf = promptbgmap[*buf]; +} + // Gets string colormap, used for 0x80 color codes // static const UINT8 *V_GetStringColormap(INT32 colorflags) diff --git a/src/v_video.h b/src/v_video.h index 6113d08ec..84a027963 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -158,6 +158,7 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum); void V_DrawFadeScreen(UINT16 color, UINT8 strength); void V_DrawFadeConsBack(INT32 plines); +void V_DrawPromptBack(INT32 boxheight, INT32 color); // draw a single character void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed); diff --git a/src/w_wad.c b/src/w_wad.c index 322262f65..258552950 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -234,10 +234,10 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum) for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++) if (memcmp(lump_p->name,"SOC_",4)==0) // Check for generic SOC lump { // shameless copy+paste of code from LUA_LoadLump - size_t length = strlen(wadfiles[wadnum]->filename) + 1 + strlen(lump_p->name2); // length of file name, '|', and lump name - char *name = malloc(length + 1); + size_t len = strlen(wadfiles[wadnum]->filename) + 1 + strlen(lump_p->name2); // length of file name, '|', and lump name + char *name = malloc(len+1); sprintf(name, "%s|%s", wadfiles[wadnum]->filename, lump_p->name2); - name[length] = '\0'; + name[len] = '\0'; CONS_Printf(M_GetText("Loading SOC from %s\n"), name); DEH_LoadDehackedLumpPwad(wadnum, lump); @@ -397,6 +397,8 @@ UINT16 W_InitFile(const char *filename) if (!memcmp(wadfiles[i]->md5sum, md5sum, 16)) { CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename); + if (handle) + fclose(handle); return INT16_MAX; } } @@ -642,6 +644,8 @@ UINT16 W_InitFile(const char *filename) if (fread(&header, 1, sizeof header, handle) < sizeof header) { CONS_Alert(CONS_ERROR, M_GetText("Can't read wad header from %s because %s\n"), filename, strerror(ferror(handle))); + if (handle) + fclose(handle); return INT16_MAX; } @@ -652,6 +656,8 @@ UINT16 W_InitFile(const char *filename) && memcmp(header.identification, "SDLL", 4) != 0) { CONS_Alert(CONS_ERROR, M_GetText("%s does not have a valid WAD header\n"), filename); + if (handle) + fclose(handle); return INT16_MAX; } @@ -666,6 +672,8 @@ UINT16 W_InitFile(const char *filename) { CONS_Alert(CONS_ERROR, M_GetText("Wadfile directory in %s is corrupted (%s)\n"), filename, strerror(ferror(handle))); free(fileinfov); + if (handle) + fclose(handle); return INT16_MAX; } diff --git a/src/w_wad.h b/src/w_wad.h index ef4213579..16d97dd4c 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -67,7 +67,7 @@ typedef struct // DYNAMIC WAD LOADING // ========================================================================= -#define MAX_WADPATH 128 +#define MAX_WADPATH 512 #define MAX_WADFILES 48 // maximum of wad files used at the same time // (there is a max of simultaneous open files anyway, and this should be plenty) diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg index 749734a72..a73858bd4 100644 --- a/src/win32/Makefile.cfg +++ b/src/win32/Makefile.cfg @@ -9,6 +9,9 @@ ifdef MINGW64 NOASM=1 NONX86=1 + HAVE_LIBGME=1 + LIBGME_CFLAGS=-I../libs/gme/include + LIBGME_LDFLAGS=-L../libs/gme/win64 -lgme SDL_CFLAGS?=-I../libs/SDL2/x86_64-w64-mingw32/include/SDL2 -I../libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2 -Dmain=SDL_main SDL_LDFLAGS?=-L../libs/SDL2/x86_64-w64-mingw32/lib -L../libs/SDL2_mixer/x86_64-w64-mingw32/lib -lmingw32 -lSDL2main -lSDL2 -mwindows else @@ -23,7 +26,9 @@ ifndef NOASM USEASM=1 endif +ifndef MINGW64 #miniupnc is broken with MINGW64 HAVE_MINIUPNPC=1 +endif OPTS=-DSTDC_HEADERS diff --git a/src/win32/Srb2win-vc10.vcxproj.filters b/src/win32/Srb2win-vc10.vcxproj.filters index 6319749a9..c21cedb8a 100644 --- a/src/win32/Srb2win-vc10.vcxproj.filters +++ b/src/win32/Srb2win-vc10.vcxproj.filters @@ -93,6 +93,9 @@ Hw_Hardware + + Hw_Hardware + Hw_Hardware @@ -476,6 +479,9 @@ Win32app + + Hw_Hardware + Hw_Hardware diff --git a/src/win32/win_cd.c b/src/win32/win_cd.c index f6c430748..2586b8440 100644 --- a/src/win32/win_cd.c +++ b/src/win32/win_cd.c @@ -471,7 +471,7 @@ void I_PlayCD(UINT8 nTrack, UINT8 bLooping) //faB: stop MIDI music, MIDI music will restart if volume is upped later cv_digmusicvolume.value = 0; cv_midimusicvolume.value = 0; - I_StopSong (0); + I_StopSong(); //faB: I don't use the notify message, I'm trying to minimize the delay mciPlay.dwCallback = (DWORD)((size_t)hWndMain); diff --git a/src/win32/win_dll.c b/src/win32/win_dll.c index c9b3fba4e..71eda0437 100644 --- a/src/win32/win_dll.c +++ b/src/win32/win_dll.c @@ -148,7 +148,7 @@ static loadfunc_t hwdFuncTable[] = { #ifdef SHUFFLE {"PostImgRedraw", &hwdriver.pfnPostImgRedraw}, #endif - {"FlushScreenTextures"},&hwdriver.pfnFlushScreenTextures}, + {"FlushScreenTextures", &hwdriver.pfnFlushScreenTextures}, {"StartScreenWipe", &hwdriver.pfnStartScreenWipe}, {"EndScreenWipe", &hwdriver.pfnEndScreenWipe}, {"DoScreenWipe", &hwdriver.pfnDoScreenWipe}, diff --git a/src/win32/win_main.c b/src/win32/win_main.c index 6c774f557..bfe620a43 100644 --- a/src/win32/win_main.c +++ b/src/win32/win_main.c @@ -110,9 +110,9 @@ static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPAR // pause music when alt-tab if (appActive && !paused) - I_ResumeSong(0); + I_ResumeSong(); else if (!paused) - I_PauseSong(0); + I_PauseSong(); { HANDLE ci = GetStdHandle(STD_INPUT_HANDLE); DWORD mode; diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c index 88f34abf8..454c53e37 100644 --- a/src/win32/win_snd.c +++ b/src/win32/win_snd.c @@ -17,10 +17,8 @@ #include "gme/gme.h" #define GME_TREBLE 5.0 #define GME_BASS 1.0 -#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng - -#define HAVE_ZLIB +#ifdef HAVE_ZLIB #ifndef _MSC_VER #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE @@ -36,13 +34,12 @@ #endif #include "zlib.h" -#endif -#endif +#endif // HAVE_ZLIB +#endif // HAVE_LIBGME static FMOD_SYSTEM *fsys; static FMOD_SOUND *music_stream; static FMOD_CHANNEL *music_channel; -static boolean midimode; static UINT8 music_volume, midi_volume, sfx_volume; static INT32 current_track; @@ -355,12 +352,13 @@ void I_FreeSfx(sfxinfo_t *sfx) sfx->data = NULL; } -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { FMOD_SOUND *sound; FMOD_CHANNEL *chan; INT32 i; float frequency; + (void)channel; sound = (FMOD_SOUND *)S_sfx[id].data; I_Assert(sound != NULL); @@ -440,9 +438,9 @@ void I_SetSfxVolume(UINT8 volume) sfx_volume = volume; } -// -// MUSIC -// +/// ------------------------ +// MUSIC SYSTEM +/// ------------------------ void I_InitMusic(void) { @@ -450,53 +448,117 @@ void I_InitMusic(void) void I_ShutdownMusic(void) { - I_ShutdownDigMusic(); - I_ShutdownMIDIMusic(); + I_StopSong(); } -void I_PauseSong(INT32 handle) -{ - UNREFERENCED_PARAMETER(handle); - if (music_stream) - FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, true)); -} +/// ------------------------ +// MUSIC PROPERTIES +/// ------------------------ -void I_ResumeSong(INT32 handle) +musictype_t I_SongType(void) { - UNREFERENCED_PARAMETER(handle); - if (music_stream) - FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, false)); -} + FMOD_SOUND_TYPE type; -void I_InitDigMusic(void) -{ -} +#ifdef HAVE_LIBGME + if (gme) + return MU_GME; +#endif -void I_ShutdownDigMusic(void) -{ - if (!midimode) - I_StopDigSong(); -} + if (!music_stream) + return MU_NONE; -boolean I_StartDigSong(const char *musicname, boolean looping) -{ - char *data; - size_t len; - FMOD_CREATESOUNDEXINFO fmt; - lumpnum_t lumpnum = W_CheckNumForName(va("O_%s",musicname)); - - if (lumpnum == LUMPERROR) + if (FMOD_Sound_GetFormat(music_stream, &type, NULL, NULL, NULL) == FMOD_OK) { - lumpnum = W_CheckNumForName(va("D_%s",musicname)); - if (lumpnum == LUMPERROR) - return false; - midimode = true; + switch(type) + { + case FMOD_SOUND_TYPE_WAV: + return MU_WAV; + case FMOD_SOUND_TYPE_MOD: + return MU_MOD; + case FMOD_SOUND_TYPE_MIDI: + return MU_MID; + case FMOD_SOUND_TYPE_OGGVORBIS: + return MU_OGG; + case FMOD_SOUND_TYPE_MPEG: + return MU_MP3; + case FMOD_SOUND_TYPE_FLAC: + return MU_FLAC; + default: + return MU_NONE; + } } else - midimode = false; + return MU_NONE; +} - data = (char *)W_CacheLumpNum(lumpnum, PU_MUSIC); - len = W_LumpLength(lumpnum); +boolean I_SongPlaying(void) +{ + return (music_stream != NULL); +} + +boolean I_SongPaused(void) +{ + FMOD_BOOL fmpaused = false; + if (music_stream) + FMOD_Channel_GetPaused(music_channel, &fmpaused); + return (boolean)fmpaused; +} + +/// ------------------------ +// MUSIC EFFECTS +/// ------------------------ + +boolean I_SetSongSpeed(float speed) +{ + FMOD_RESULT e; + float frequency; + if (!music_stream) + return false; + if (speed > 250.0f) + speed = 250.0f; //limit speed up to 250x + +#ifdef HAVE_LIBGME + // Try to set GME speed + if (gme) + { + gme_set_tempo(gme, speed); + return true; + } +#endif + + // Try to set Mod/Midi speed + e = FMOD_Sound_SetMusicSpeed(music_stream, speed); + + if (e == FMOD_ERR_FORMAT) + { + // Just change pitch instead for Ogg/etc. + FMR(FMOD_Sound_GetDefaults(music_stream, &frequency, NULL, NULL, NULL)); + FMR_MUSIC(FMOD_Channel_SetFrequency(music_channel, speed*frequency)); + } + else + FMR_MUSIC(e); + + return true; +} + +/// ------------------------ +// MUSIC PLAYBACK +/// ------------------------ + +boolean I_LoadSong(char *data, size_t len) +{ + FMOD_CREATESOUNDEXINFO fmt; + FMOD_RESULT e; + FMOD_TAG tag; + unsigned int loopstart, loopend; + + if ( +#ifdef HAVE_LIBGME + gme || +#endif + music_stream + ) + I_UnloadSong(); memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO)); fmt.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); @@ -531,8 +593,6 @@ boolean I_StartDigSong(const char *musicname, boolean looping) gme_equalizer_t gmeq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around Z_Free(data); // We don't need this, either. - gme_start_track(gme, 0); - current_track = 0; gme_set_equalizer(gme,&gmeq); fmt.format = FMOD_SOUND_FORMAT_PCM16; fmt.defaultfrequency = 44100; @@ -541,10 +601,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping) fmt.decodebuffersize = (44100 * 2) / 35; fmt.pcmreadcallback = GMEReadCallback; fmt.userdata = gme; - FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER | (looping ? FMOD_LOOP_NORMAL : 0), &fmt, &music_stream)); - FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel)); - FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0)); - FMR(FMOD_Channel_SetPriority(music_channel, 0)); + FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER, &fmt, &music_stream)); return true; } } @@ -603,8 +660,6 @@ boolean I_StartDigSong(const char *musicname, boolean looping) { gme_equalizer_t gmeq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; Z_Free(data); // We don't need this anymore. - gme_start_track(gme, 0); - current_track = 0; gme_set_equalizer(gme,&gmeq); fmt.format = FMOD_SOUND_FORMAT_PCM16; fmt.defaultfrequency = 44100; @@ -613,7 +668,102 @@ boolean I_StartDigSong(const char *musicname, boolean looping) fmt.decodebuffersize = (44100 * 2) / 35; fmt.pcmreadcallback = GMEReadCallback; fmt.userdata = gme; - FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER | (looping ? FMOD_LOOP_NORMAL : 0), &fmt, &music_stream)); + FMR(FMOD_System_CreateStream(fsys, NULL, FMOD_OPENUSER, &fmt, &music_stream)); + return true; + } +#endif + + fmt.length = len; + + e = FMOD_System_CreateStream(fsys, data, FMOD_OPENMEMORY_POINT, &fmt, &music_stream); + if (e != FMOD_OK) + { + if (e == FMOD_ERR_FORMAT) + CONS_Alert(CONS_WARNING, "Failed to play music lump due to invalid format.\n"); + else + FMR(e); + return false; + } + + // Try to find a loop point in streaming music formats (ogg, mp3) + + // A proper LOOPPOINT is its own tag, stupid. + e = FMOD_Sound_GetTag(music_stream, "LOOPPOINT", 0, &tag); + if (e != FMOD_ERR_TAGNOTFOUND) + { + FMR(e); + loopstart = atoi((char *)tag.data); // assumed to be a string data tag. + FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM)); + if (loopstart > 0) + FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM)); + return true; + } + + // Use LOOPMS for time in miliseconds. + e = FMOD_Sound_GetTag(music_stream, "LOOPMS", 0, &tag); + if (e != FMOD_ERR_TAGNOTFOUND) + { + FMR(e); + loopstart = atoi((char *)tag.data); // assumed to be a string data tag. + FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_MS, &loopend, FMOD_TIMEUNIT_PCM)); + if (loopstart > 0) + FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_MS, loopend, FMOD_TIMEUNIT_PCM)); + return true; + } + + // Try to fetch it from the COMMENT tag, like A.J. Freda + e = FMOD_Sound_GetTag(music_stream, "COMMENT", 0, &tag); + if (e != FMOD_ERR_TAGNOTFOUND) + { + char *loopText; + // Handle any errors that arose, first + FMR(e); + // Figure out where the number starts + loopText = strstr((char *)tag.data,"LOOPPOINT="); + if (loopText != NULL) + { + // Skip the "LOOPPOINT=" part. + loopText += 10; + // Convert it to our looppoint + // FMOD seems to ensure the tag is properly NULL-terminated. + // atoi will stop when it reaches anything that's not a number. + loopstart = atoi(loopText); + // Now do the rest like above + FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM)); + if (loopstart > 0) + FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM)); + } + return true; + } + + // No special loop point + return true; +} + +void I_UnloadSong(void) +{ + I_StopSong(); +#ifdef HAVE_LIBGME + if (gme) + { + gme_delete(gme); + gme = NULL; + } +#endif + if (music_stream) + { + FMR(FMOD_Sound_Release(music_stream)); + music_stream = NULL; + } +} + +boolean I_PlaySong(boolean looping) +{ +#ifdef HAVE_LIBGME + if (gme) + { + gme_start_track(gme, 0); + current_track = 0; FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel)); FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0)); FMR(FMOD_Channel_SetPriority(music_channel, 0)); @@ -621,139 +771,48 @@ boolean I_StartDigSong(const char *musicname, boolean looping) } #endif - fmt.length = len; - { - FMOD_RESULT e = FMOD_System_CreateStream(fsys, data, FMOD_OPENMEMORY_POINT|(looping ? FMOD_LOOP_NORMAL : 0), &fmt, &music_stream); - if (e != FMOD_OK) - { - if (e == FMOD_ERR_FORMAT) - CONS_Alert(CONS_WARNING, "Failed to play music lump %s due to invalid format.\n", W_CheckNameForNum(lumpnum)); - else - FMR(e); - return false; - } - } + FMR(FMOD_Sound_SetMode(music_stream, (looping ? FMOD_LOOP_NORMAL : FMOD_LOOP_OFF))); FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel)); - if (midimode) + if (I_SongType() != MU_MID) FMR(FMOD_Channel_SetVolume(music_channel, midi_volume / 31.0)); else FMR(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0)); FMR(FMOD_Channel_SetPriority(music_channel, 0)); current_track = 0; - // Try to find a loop point in streaming music formats (ogg, mp3) - if (looping) - { - FMOD_RESULT e; - FMOD_TAG tag; - unsigned int loopstart, loopend; - - // A proper LOOPPOINT is its own tag, stupid. - e = FMOD_Sound_GetTag(music_stream, "LOOPPOINT", 0, &tag); - if (e != FMOD_ERR_TAGNOTFOUND) - { - FMR(e); - loopstart = atoi((char *)tag.data); // assumed to be a string data tag. - FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM)); - if (loopstart > 0) - FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM)); - return true; - } - - // Use LOOPMS for time in miliseconds. - e = FMOD_Sound_GetTag(music_stream, "LOOPMS", 0, &tag); - if (e != FMOD_ERR_TAGNOTFOUND) - { - FMR(e); - loopstart = atoi((char *)tag.data); // assumed to be a string data tag. - FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_MS, &loopend, FMOD_TIMEUNIT_PCM)); - if (loopstart > 0) - FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_MS, loopend, FMOD_TIMEUNIT_PCM)); - return true; - } - - // Try to fetch it from the COMMENT tag, like A.J. Freda - e = FMOD_Sound_GetTag(music_stream, "COMMENT", 0, &tag); - if (e != FMOD_ERR_TAGNOTFOUND) - { - char *loopText; - // Handle any errors that arose, first - FMR(e); - // Figure out where the number starts - loopText = strstr((char *)tag.data,"LOOPPOINT="); - if (loopText != NULL) - { - // Skip the "LOOPPOINT=" part. - loopText += 10; - // Convert it to our looppoint - // FMOD seems to ensure the tag is properly NULL-terminated. - // atoi will stop when it reaches anything that's not a number. - loopstart = atoi(loopText); - // Now do the rest like above - FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM)); - if (loopstart > 0) - FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM)); - } - return true; - } - } - - // No special loop point, but we're playing so it's all good. return true; } -void I_StopDigSong(void) +void I_StopSong(void) { - if (music_stream) - FMR(FMOD_Sound_Release(music_stream)); - music_stream = NULL; -#ifdef HAVE_LIBGME - if (gme) - gme_delete(gme); - gme = NULL; -#endif - current_track = -1; + if (music_channel) + FMR_MUSIC(FMOD_Channel_Stop(music_channel)); } -void I_SetDigMusicVolume(UINT8 volume) +void I_PauseSong(void) { + if (music_channel) + FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, true)); +} + +void I_ResumeSong(void) +{ + if (music_channel) + FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, false)); +} + +void I_SetMusicVolume(UINT8 volume) +{ + if (!music_channel) + return; + // volume is 0 to 31. - music_volume = volume; - if (!midimode && music_stream) - FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, volume / 31.0)); -} - -boolean I_SetSongSpeed(float speed) -{ - FMOD_RESULT e; - float frequency; - if (!music_stream) - return false; - if (speed > 250.0f) - speed = 250.0f; //limit speed up to 250x - -#ifdef HAVE_LIBGME - // Try to set GME speed - if (gme) - { - gme_set_tempo(gme, speed); - return true; - } -#endif - - // Try to set Mod/Midi speed - e = FMOD_Sound_SetMusicSpeed(music_stream, speed); - - if (e == FMOD_ERR_FORMAT) - { - // Just change pitch instead for Ogg/etc. - FMR(FMOD_Sound_GetDefaults(music_stream, &frequency, NULL, NULL, NULL)); - FMR_MUSIC(FMOD_Channel_SetFrequency(music_channel, speed*frequency)); - } + if (I_SongType() == MU_MID) + music_volume = 31; // windows bug hack else - FMR_MUSIC(e); + music_volume = volume; - return true; + FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, music_volume / 31.0)); } boolean I_SetSongTrack(INT32 track) @@ -800,62 +859,3 @@ boolean I_SetSongTrack(INT32 track) } return false; } - -// -// Fuck MIDI. ... Okay fine, you can have your silly D_-only mode. -// - -void I_InitMIDIMusic(void) -{ -} - -void I_ShutdownMIDIMusic(void) -{ - if (midimode) - I_StopSong(0); -} - -void I_SetMIDIMusicVolume(UINT8 volume) -{ - // volume is 0 to 31. - midi_volume = volume; - if (midimode && music_stream) - FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, volume / 31.0)); -} - -INT32 I_RegisterSong(void *data, size_t len) -{ - FMOD_CREATESOUNDEXINFO fmt; - memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO)); - fmt.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); - fmt.length = len; - FMR(FMOD_System_CreateStream(fsys, (char *)data, FMOD_OPENMEMORY_POINT, &fmt, &music_stream)); - return 1337; -} - -boolean I_PlaySong(INT32 handle, boolean looping) -{ - if (1337 == handle) - { - midimode = true; - if (looping) - FMR(FMOD_Sound_SetMode(music_stream, FMOD_LOOP_NORMAL)); - FMR(FMOD_System_PlaySound(fsys, FMOD_CHANNEL_FREE, music_stream, false, &music_channel)); - FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, midi_volume / 31.0)); - FMR_MUSIC(FMOD_Channel_SetPriority(music_channel, 0)); - } - return true; -} - -void I_StopSong(INT32 handle) -{ - I_UnRegisterSong(handle); -} - -void I_UnRegisterSong(INT32 handle) -{ - UNREFERENCED_PARAMETER(handle); - if (music_stream) - FMR(FMOD_Sound_Release(music_stream)); - music_stream = NULL; -} diff --git a/src/y_inter.c b/src/y_inter.c index 598f3c8ab..29e611730 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1595,6 +1595,7 @@ static void Y_CalculateCompetitionWinners(void) UINT32 maxrings[MAXPLAYERS]; UINT32 monitors[MAXPLAYERS]; UINT32 scores[MAXPLAYERS]; + char tempname[9]; memset(data.competition.points, 0, sizeof (data.competition.points)); memset(points, 0, sizeof (points)); @@ -1686,8 +1687,9 @@ static void Y_CalculateCompetitionWinners(void) data.competition.monitors[data.competition.numplayers] = monitors[winner]; data.competition.scores[data.competition.numplayers] = scores[winner]; - snprintf(data.competition.name[data.competition.numplayers], 9, "%s", player_names[winner]); - data.competition.name[data.competition.numplayers][8] = '\0'; + strncpy(tempname, player_names[winner], 8); + tempname[8] = '\0'; + strncpy(data.competition.name[data.competition.numplayers], tempname, 9); data.competition.color[data.competition.numplayers] = &players[winner].skincolor; data.competition.character[data.competition.numplayers] = &players[winner].skin; @@ -1750,6 +1752,26 @@ static void Y_SetRingBonus(player_t *player, y_bonus_t *bstruct) bstruct->points = max(0, (player->rings) * 100); } +// +// Y_SetNightsBonus +// +static void Y_SetNightsBonus(player_t *player, y_bonus_t *bstruct) +{ + strncpy(bstruct->patch, "YB_NIGHT", sizeof(bstruct->patch)); + bstruct->display = true; + bstruct->points = player->totalmarescore; +} + +// +// Y_SetLapBonus +// +static void Y_SetLapBonus(player_t *player, y_bonus_t *bstruct) +{ + strncpy(bstruct->patch, "YB_LAP", sizeof(bstruct->patch)); + bstruct->display = true; + bstruct->points = max(0, player->totalmarebonuslap * 1000); +} + // // Y_SetLinkBonus // @@ -1811,7 +1833,7 @@ static void Y_SetPerfectBonus(player_t *player, y_bonus_t *bstruct) // This list can be extended in the future with SOC/Lua, perhaps. typedef void (*bonus_f)(player_t *, y_bonus_t *); -bonus_f bonuses_list[4][4] = { +bonus_f bonuses_list[6][4] = { { Y_SetNullBonus, Y_SetNullBonus, @@ -1836,6 +1858,18 @@ bonus_f bonuses_list[4][4] = { Y_SetRingBonus, Y_SetPerfectBonus, }, + { + Y_SetNullBonus, + Y_SetNightsBonus, + Y_SetLapBonus, + Y_SetNullBonus, + }, + { + Y_SetNullBonus, + Y_SetLinkBonus, + Y_SetLapBonus, + Y_SetNullBonus, + }, }; @@ -1911,8 +1945,8 @@ static void Y_AwardSpecialStageBonus(void) if (!playeringame[i] || players[i].lives < 1) // not active or game over Y_SetNullBonus(&players[i], &localbonus); - else if (maptol & TOL_NIGHTS) // Link instead of Rings - Y_SetLinkBonus(&players[i], &localbonus); + else if (maptol & TOL_NIGHTS) // Mare score instead of Rings + Y_SetNightsBonus(&players[i], &localbonus); else Y_SetRingBonus(&players[i], &localbonus); players[i].score += localbonus.points; @@ -2022,4 +2056,5 @@ static void Y_UnloadData(void) //are not handled break; } + }