mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-28 15:11:55 +00:00
Merge branch SRB2:next into mobj-alpha
This commit is contained in:
commit
0062c9fd59
73 changed files with 3449 additions and 761 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -26,3 +26,4 @@ Win32_LIB_ASM_Release
|
|||
/CMakeUserPresets.json
|
||||
/out
|
||||
/objs/VC10
|
||||
/thirdparty/vcpkg-overlays
|
||||
|
|
|
@ -8,7 +8,6 @@ endif()
|
|||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||
|
||||
include(CMakeDependentOption)
|
||||
include(cmake/CPM.cmake)
|
||||
|
||||
file(STRINGS src/version.h SRB2_VERSION)
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9.]+" SRB2_VERSION ${SRB2_VERSION})
|
||||
|
@ -46,28 +45,23 @@ SET(CPACK_OUTPUT_FILE_PREFIX package)
|
|||
include(CPack)
|
||||
|
||||
# Options
|
||||
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Linux)
|
||||
set(SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT ON)
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
|
||||
if(DEFINED VCPKG_TARGET_TRIPLET)
|
||||
set(SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT ON)
|
||||
else()
|
||||
set(SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT OFF)
|
||||
endif()
|
||||
else()
|
||||
set(SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT OFF)
|
||||
set(SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
# Clang tidy options will be ignored if CMAKE_<LANG>_CLANG_TIDY are set.
|
||||
option(SRB2_CONFIG_ENABLE_CLANG_TIDY_C "Enable default clang-tidy check configuration for C" OFF)
|
||||
option(SRB2_CONFIG_ENABLE_CLANG_TIDY_CXX "Enable default clang-tidy check configuration for C++" OFF)
|
||||
option(
|
||||
SRB2_CONFIG_SYSTEM_LIBRARIES
|
||||
"Link dependencies using CMake's find_package and do not use internal builds"
|
||||
${SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT}
|
||||
)
|
||||
option(SRB2_CONFIG_ENABLE_TESTS "Build the test suite" ON)
|
||||
# This option isn't recommended for distribution builds and probably won't work (yet).
|
||||
cmake_dependent_option(
|
||||
SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES
|
||||
"Use dynamic libraries when compiling internal dependencies"
|
||||
OFF "NOT SRB2_CONFIG_SYSTEM_LIBRARIES"
|
||||
OFF
|
||||
SRB2_CONFIG_STATIC_STDLIB
|
||||
"Link static version of standard library. All dependencies must also be static"
|
||||
ON
|
||||
)
|
||||
option(SRB2_CONFIG_HWRENDER "Enable hardware render (OpenGL) support" ON)
|
||||
option(SRB2_CONFIG_USE_GME "Enable GME playback support" OFF)
|
||||
|
@ -82,64 +76,28 @@ option(SRB2_CONFIG_ZDEBUG "Compile with ZDEBUG defined." OFF)
|
|||
option(SRB2_CONFIG_PROFILEMODE "Compile for profiling (GCC only)." OFF)
|
||||
set(SRB2_CONFIG_ASSET_DIRECTORY "" CACHE PATH "Path to directory that contains all asset files for the installer. If set, assets will be part of installation and cpack.")
|
||||
|
||||
if(SRB2_CONFIG_ENABLE_TESTS)
|
||||
# https://github.com/catchorg/Catch2
|
||||
CPMAddPackage(
|
||||
NAME Catch2
|
||||
VERSION 3.4.0
|
||||
GITHUB_REPOSITORY catchorg/Catch2
|
||||
OPTIONS
|
||||
"CATCH_INSTALL_DOCS OFF"
|
||||
)
|
||||
list(APPEND CMAKE_MODULE_PATH "${Catch2_SOURCE_DIR}/extras")
|
||||
include(CTest)
|
||||
include(Catch)
|
||||
add_executable(srb2tests)
|
||||
# To add tests, use target_sources to add individual test files to the target in subdirs.
|
||||
target_link_libraries(srb2tests PRIVATE Catch2::Catch2 Catch2::Catch2WithMain)
|
||||
target_compile_features(srb2tests PRIVATE c_std_11 cxx_std_17)
|
||||
catch_discover_tests(srb2tests)
|
||||
endif()
|
||||
|
||||
# Enable CCache
|
||||
# (Set USE_CCACHE=ON to use, CCACHE_OPTIONS for options)
|
||||
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL Windows)
|
||||
option(USE_CCACHE "Enable ccache support" OFF)
|
||||
|
||||
if(USE_CCACHE)
|
||||
find_program(CCACHE_TOOL_PATH ccache)
|
||||
if(CCACHE_TOOL_PATH)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
|
||||
else()
|
||||
message(WARNING "USE_CCACHE was set but ccache is not found (set CCACHE_TOOL_PATH)")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
CPMAddPackage(
|
||||
NAME Ccache.cmake
|
||||
GITHUB_REPOSITORY TheLartians/Ccache.cmake
|
||||
VERSION 1.2
|
||||
)
|
||||
endif()
|
||||
|
||||
# Dependencies
|
||||
add_subdirectory(thirdparty)
|
||||
|
||||
if("${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(SDL2 REQUIRED)
|
||||
find_package(SDL2_mixer REQUIRED)
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(OPENMPT REQUIRED)
|
||||
|
||||
# libgme defaults to "Nuked" YM2612 emulator, which is
|
||||
# very SLOW. The system library probably uses the
|
||||
# default so just always build it.
|
||||
#find_package(GME REQUIRED)
|
||||
if(SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES)
|
||||
set(SRB2_INTERNAL_LIBRARY_TYPE SHARED)
|
||||
set(NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES OFF)
|
||||
else()
|
||||
set(SRB2_INTERNAL_LIBRARY_TYPE STATIC)
|
||||
set(NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES ON)
|
||||
endif()
|
||||
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(libopenmpt QUIET)
|
||||
if("${SRB2_CONFIG_USE_GME}")
|
||||
find_package(libgme QUIET)
|
||||
endif()
|
||||
find_package(miniupnpc QUIET)
|
||||
|
||||
|
||||
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
|
||||
message(FATAL_ERROR "In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from.")
|
||||
endif()
|
||||
|
|
|
@ -2,26 +2,263 @@
|
|||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"description": "Build using default generator",
|
||||
"binaryDir": "build",
|
||||
"name": "__debug",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"SRB2_CONFIG_DEV_BUILD": "ON",
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "__develop",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_FLAGS_RELWITHDEBINFO": "-DNDEBUG",
|
||||
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "-DNDEBUG",
|
||||
"SRB2_CONFIG_DEV_BUILD": "ON",
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"description": "Build for development (no optimizations)",
|
||||
"inherits": "default",
|
||||
"name": "__release",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
"CMAKE_C_FLAGS_RELWITHDEBINFO": "-DNDEBUG",
|
||||
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "-DNDEBUG",
|
||||
"SRB2_CONFIG_DEV_BUILD": "OFF",
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "__testers",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_FLAGS_RELWITHDEBINFO": "-DNDEBUG",
|
||||
"CMAKE_CXX_FLAGS_RELWITHDEBINFO": "-DNDEBUG",
|
||||
"SRB2_CONFIG_DEV_BUILD": "ON",
|
||||
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
|
||||
"SRB2_CONFIG_TESTERS": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "__ninja",
|
||||
"hidden": true,
|
||||
"generator": "Ninja",
|
||||
"cacheVariables": {
|
||||
"CMAKE_COLOR_DIAGNOSTICS": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "__vcpkg-toolchain",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "__compiler-mingw-w64-i686",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_C_COMPILER": "i686-w64-mingw32-gcc",
|
||||
"CMAKE_CXX_COMPILER": "i686-w64-mingw32-g++"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "__mingw-dynamic",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"VCPKG_TARGET_TRIPLET": "x86-mingw-dynamic"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "__mingw-static",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"VCPKG_HOST_TRIPLET": "x86-mingw-static",
|
||||
"VCPKG_TARGET_TRIPLET": "x86-mingw-static"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "__osx_x64",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"VCPKG_TARGET_TRIPLET": "x64-osx"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "__osx_arm64",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"VCPKG_TARGET_TRIPLET": "arm64-osx"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"name": "ninja-debug",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__debug", "__ninja"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-develop",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__develop", "__ninja"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-release",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__release", "__ninja"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-testers",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__testers", "__ninja"]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "ninja-vcpkg-debug",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__debug", "__ninja", "__vcpkg-toolchain"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-vcpkg-develop",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__develop", "__ninja", "__vcpkg-toolchain"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-vcpkg-release",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__release", "__ninja", "__vcpkg-toolchain"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-vcpkg-testers",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__testers", "__ninja", "__vcpkg-toolchain"]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "ninja-x86_mingw_static_vcpkg-debug",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__debug", "__compiler-mingw-w64-i686", "__ninja", "__vcpkg-toolchain", "__mingw-static"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-x86_mingw_static_vcpkg-develop",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__develop", "__compiler-mingw-w64-i686", "__ninja", "__vcpkg-toolchain", "__mingw-static"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-x86_mingw_static_vcpkg-release",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__release", "__compiler-mingw-w64-i686", "__ninja", "__vcpkg-toolchain", "__mingw-static"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-x86_mingw_static_vcpkg-testers",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__testers", "__compiler-mingw-w64-i686", "__ninja", "__vcpkg-toolchain", "__mingw-static"]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "ninja-x64_osx_vcpkg-debug",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__debug", "__ninja", "__vcpkg-toolchain", "__osx_x64"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-x64_osx_vcpkg-develop",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__develop", "__ninja", "__vcpkg-toolchain", "__osx_x64"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-x64_osx_vcpkg-release",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__release", "__ninja", "__vcpkg-toolchain", "__osx_x64"]
|
||||
},
|
||||
|
||||
{
|
||||
"name": "ninja-arm64_osx_vcpkg-debug",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__debug", "__ninja", "__vcpkg-toolchain", "__osx_arm64"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-arm64_osx_vcpkg-develop",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__develop", "__ninja", "__vcpkg-toolchain", "__osx_arm64"]
|
||||
},
|
||||
{
|
||||
"name": "ninja-arm64_osx_vcpkg-release",
|
||||
"hidden": false,
|
||||
"binaryDir": "build/${presetName}",
|
||||
"inherits": ["__release", "__ninja", "__vcpkg-toolchain", "__osx_arm64"]
|
||||
}
|
||||
],
|
||||
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"configurePreset": "default"
|
||||
"name": "ninja-debug",
|
||||
"configurePreset": "ninja-debug"
|
||||
},
|
||||
{
|
||||
"name": "ninja-develop",
|
||||
"configurePreset": "ninja-develop"
|
||||
},
|
||||
{
|
||||
"name": "ninja-release",
|
||||
"configurePreset": "ninja-release"
|
||||
},
|
||||
{
|
||||
"name": "ninja-x86_mingw_static_vcpkg-debug",
|
||||
"configurePreset": "ninja-x86_mingw_static_vcpkg-debug"
|
||||
},
|
||||
{
|
||||
"name": "ninja-x86_mingw_static_vcpkg-develop",
|
||||
"configurePreset": "ninja-x86_mingw_static_vcpkg-develop"
|
||||
},
|
||||
{
|
||||
"name": "ninja-x86_mingw_static_vcpkg-release",
|
||||
"configurePreset": "ninja-x86_mingw_static_vcpkg-release"
|
||||
},
|
||||
{
|
||||
"name": "ninja-x86_mingw_static_vcpkg-testers",
|
||||
"configurePreset": "ninja-x86_mingw_static_vcpkg-testers"
|
||||
},
|
||||
{
|
||||
"name": "ninja-x64_osx_vcpkg-debug",
|
||||
"configurePreset": "ninja-x64_osx_vcpkg-debug"
|
||||
},
|
||||
{
|
||||
"name": "ninja-x64_osx_vcpkg-develop",
|
||||
"configurePreset": "ninja-x64_osx_vcpkg-develop"
|
||||
},
|
||||
{
|
||||
"name": "ninja-x64_osx_vcpkg-release",
|
||||
"configurePreset": "ninja-x64_osx_vcpkg-release"
|
||||
},
|
||||
{
|
||||
"name": "ninja-arm64_osx_vcpkg-debug",
|
||||
"configurePreset": "ninja-arm64_osx_vcpkg-debug"
|
||||
},
|
||||
{
|
||||
"name": "ninja-arm64_osx_vcpkg-develop",
|
||||
"configurePreset": "ninja-arm64_osx_vcpkg-develop"
|
||||
},
|
||||
{
|
||||
"name": "ninja-arm64_osx_vcpkg-release",
|
||||
"configurePreset": "ninja-arm64_osx_vcpkg-release"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
set(CPM_DOWNLOAD_VERSION 0.38.7)
|
||||
|
||||
if(CPM_SOURCE_CACHE)
|
||||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
|
||||
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
else()
|
||||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
endif()
|
||||
|
||||
# Expand relative path. This is important if the provided path contains a tilde (~)
|
||||
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
|
||||
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
|
||||
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
|
||||
file(DOWNLOAD
|
||||
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
|
||||
${CPM_DOWNLOAD_LOCATION}
|
||||
)
|
||||
endif()
|
||||
|
||||
include(${CPM_DOWNLOAD_LOCATION})
|
|
@ -1,33 +0,0 @@
|
|||
include(LibFindMacros)
|
||||
|
||||
libfind_pkg_check_modules(GME_PKGCONF GME)
|
||||
|
||||
find_path(GME_INCLUDE_DIR
|
||||
NAMES gme.h
|
||||
PATHS
|
||||
${GME_PKGCONF_INCLUDE_DIRS}
|
||||
"/usr/include/gme"
|
||||
"/usr/local/include/gme"
|
||||
)
|
||||
|
||||
find_library(GME_LIBRARY
|
||||
NAMES gme
|
||||
PATHS
|
||||
${GME_PKGCONF_LIBRARY_DIRS}
|
||||
"/usr/lib"
|
||||
"/usr/local/lib"
|
||||
)
|
||||
|
||||
set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR)
|
||||
set(GME_PROCESS_LIBS GME_LIBRARY)
|
||||
libfind_process(GME)
|
||||
|
||||
if(GME_FOUND AND NOT TARGET gme)
|
||||
add_library(gme UNKNOWN IMPORTED)
|
||||
set_target_properties(
|
||||
gme
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${GME_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${GME_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
|
@ -1,33 +0,0 @@
|
|||
include(LibFindMacros)
|
||||
|
||||
libfind_pkg_check_modules(OPENMPT_PKGCONF OPENMPT)
|
||||
|
||||
find_path(OPENMPT_INCLUDE_DIR
|
||||
NAMES libopenmpt.h
|
||||
PATHS
|
||||
${OPENMPT_PKGCONF_INCLUDE_DIRS}
|
||||
"/usr/include/libopenmpt"
|
||||
"/usr/local/include/libopenmpt"
|
||||
)
|
||||
|
||||
find_library(OPENMPT_LIBRARY
|
||||
NAMES openmpt
|
||||
PATHS
|
||||
${OPENMPT_PKGCONF_LIBRARY_DIRS}
|
||||
"/usr/lib"
|
||||
"/usr/local/lib"
|
||||
)
|
||||
|
||||
set(OPENMPT_PROCESS_INCLUDES OPENMPT_INCLUDE_DIR)
|
||||
set(OPENMPT_PROCESS_LIBS OPENMPT_LIBRARY)
|
||||
libfind_process(OPENMPT)
|
||||
|
||||
if(OPENMPT_FOUND AND NOT TARGET openmpt)
|
||||
add_library(openmpt UNKNOWN IMPORTED)
|
||||
set_target_properties(
|
||||
openmpt
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${OPENMPT_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OPENMPT_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
38
cmake/Modules/Findlibgme.cmake
Normal file
38
cmake/Modules/Findlibgme.cmake
Normal file
|
@ -0,0 +1,38 @@
|
|||
include(LibFindMacros)
|
||||
|
||||
libfind_pkg_check_modules(libgme_PKGCONF gme libgme)
|
||||
|
||||
find_path(libgme_INCLUDE_DIR
|
||||
NAMES gme.h
|
||||
PATHS
|
||||
${libgme_PKGCONF_INCLUDE_DIRS}
|
||||
"/usr/include"
|
||||
"/usr/local/include"
|
||||
PATH_SUFFIXES
|
||||
gme
|
||||
)
|
||||
|
||||
find_library(libgme_LIBRARY
|
||||
NAMES gme
|
||||
PATHS
|
||||
${libgme_PKGCONF_LIBRARY_DIRS}
|
||||
"/usr/lib"
|
||||
"/usr/local/lib"
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(libgme
|
||||
REQUIRED_VARS libgme_LIBRARY libgme_INCLUDE_DIR)
|
||||
|
||||
if(libgme_FOUND AND NOT TARGET gme)
|
||||
add_library(gme UNKNOWN IMPORTED)
|
||||
set_target_properties(
|
||||
gme
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${libgme_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${libgme_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(gme::gme ALIAS gme)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(libgme_LIBRARY libgme_INCLUDE_DIR)
|
37
cmake/Modules/Findlibopenmpt.cmake
Normal file
37
cmake/Modules/Findlibopenmpt.cmake
Normal file
|
@ -0,0 +1,37 @@
|
|||
include(LibFindMacros)
|
||||
|
||||
libfind_pkg_check_modules(libopenmpt_PKGCONF openmpt)
|
||||
|
||||
find_path(libopenmpt_INCLUDE_DIR
|
||||
NAMES libopenmpt.h
|
||||
PATHS
|
||||
${libopenmpt_PKGCONF_INCLUDE_DIRS}
|
||||
"${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/libopenmpt"
|
||||
"/usr/include/libopenmpt"
|
||||
"/usr/local/include/libopenmpt"
|
||||
)
|
||||
|
||||
find_library(libopenmpt_LIBRARY
|
||||
NAMES openmpt
|
||||
PATHS
|
||||
${libopenmpt_PKGCONF_LIBRARY_DIRS}
|
||||
"/usr/lib"
|
||||
"/usr/local/lib"
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(libopenmpt
|
||||
REQUIRED_VARS libopenmpt_LIBRARY libopenmpt_INCLUDE_DIR)
|
||||
|
||||
if(libopenmpt_FOUND AND NOT TARGET openmpt)
|
||||
add_library(openmpt UNKNOWN IMPORTED)
|
||||
set_target_properties(
|
||||
openmpt
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${libopenmpt_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${libopenmpt_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(libopenmpt::libopenmpt ALIAS openmpt)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(libopenmpt_LIBRARY libopenmpt_INCLUDE_DIR)
|
39
cmake/Modules/Findminiupnpc.cmake
Normal file
39
cmake/Modules/Findminiupnpc.cmake
Normal file
|
@ -0,0 +1,39 @@
|
|||
include(LibFindMacros)
|
||||
|
||||
libfind_pkg_check_modules(libminiupnpc_PKGCONF miniupnpc libminiupnpc)
|
||||
|
||||
find_path(libminiupnpc_INCLUDE_DIR
|
||||
NAMES miniupnpc.h
|
||||
PATHS
|
||||
${libminiupnpc_PKGCONF_INCLUDE_DIRS}
|
||||
"${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include"
|
||||
"/usr/include"
|
||||
"/usr/local/include"
|
||||
PATH_SUFFIXES
|
||||
miniupnpc
|
||||
)
|
||||
|
||||
find_library(libminiupnpc_LIBRARY
|
||||
NAMES miniupnpc
|
||||
PATHS
|
||||
${libminiupnpc_PKGCONF_LIBRARY_DIRS}
|
||||
"/usr/lib"
|
||||
"/usr/local/lib"
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(miniupnpc
|
||||
REQUIRED_VARS libminiupnpc_LIBRARY libminiupnpc_INCLUDE_DIR)
|
||||
|
||||
if(miniupnpc_FOUND AND NOT TARGET miniupnpc)
|
||||
add_library(miniupnpc UNKNOWN IMPORTED)
|
||||
set_target_properties(
|
||||
miniupnpc
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${libminiupnpc_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${libminiupnpc_INCLUDE_DIR}"
|
||||
)
|
||||
add_library(miniupnpc::miniupnpc ALIAS miniupnpc)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(libminiupnpc_LIBRARY libminiupnpc_INCLUDE_DIR)
|
30
cmake/PatchFile.cmake
Normal file
30
cmake/PatchFile.cmake
Normal file
|
@ -0,0 +1,30 @@
|
|||
# use GNU Patch from any platform
|
||||
|
||||
if(WIN32)
|
||||
# prioritize Git Patch on Windows as other Patches may be very old and incompatible.
|
||||
find_package(Git)
|
||||
if(Git_FOUND)
|
||||
get_filename_component(GIT_DIR ${GIT_EXECUTABLE} DIRECTORY)
|
||||
get_filename_component(GIT_DIR ${GIT_DIR} DIRECTORY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_program(PATCH
|
||||
NAMES patch
|
||||
HINTS ${GIT_DIR}
|
||||
PATH_SUFFIXES usr/bin
|
||||
)
|
||||
|
||||
if(NOT PATCH)
|
||||
message(FATAL_ERROR "Did not find GNU Patch")
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND ${PATCH} ${in_file} --input=${patch_file} --output=${out_file} --ignore-whitespace
|
||||
TIMEOUT 15
|
||||
COMMAND_ECHO STDOUT
|
||||
RESULT_VARIABLE ret
|
||||
)
|
||||
|
||||
if(NOT ret EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to apply patch ${patch_file} to ${in_file} with ${PATCH}")
|
||||
endif()
|
16
cmake/Toolchains/mingw-w64-i686.cmake
Normal file
16
cmake/Toolchains/mingw-w64-i686.cmake
Normal file
|
@ -0,0 +1,16 @@
|
|||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(TOOLCHAIN_PREFIX i686-w64-mingw32)
|
||||
|
||||
# cross compilers to use for C, C++ and Fortran
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
|
||||
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
|
||||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
|
||||
|
||||
# target environment on the build host system
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
# modify default behavior of FIND_XXX() commands
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
16
cmake/Toolchains/mingw-w64-x86_64.cmake
Normal file
16
cmake/Toolchains/mingw-w64-x86_64.cmake
Normal file
|
@ -0,0 +1,16 @@
|
|||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
|
||||
|
||||
# cross compilers to use for C, C++ and Fortran
|
||||
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
|
||||
set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran)
|
||||
set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
|
||||
|
||||
# target environment on the build host system
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
|
||||
|
||||
# modify default behavior of FIND_XXX() commands
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -228,6 +228,8 @@ Sonic Robo Blast 2 defines the following standardized fields:
|
|||
ropehang = <bool>; // Sector is a rope hang. Must be applied to a 3D floor.
|
||||
jumpflip = <bool>; // Sector flips the gravity of players who jump from it.
|
||||
gravityoverride = <bool>; // Reverse gravity effect is only applied when an object is in the sector.
|
||||
nophysics_floor = <bool>; // Disables floor slope physics if created through a plane equation.
|
||||
nophysics_ceiling = <bool>; // Disables ceiling slope physics if created through a plane equation.
|
||||
|
||||
friction = <float>; // Sector's friction factor.
|
||||
gravity = <float>; // Sector's gravity. Default is 1.0.
|
||||
|
|
|
@ -78,6 +78,8 @@ sectorflags
|
|||
ropehang = "Rope Hang";
|
||||
jumpflip = "Flip Gravity on Jump";
|
||||
gravityoverride = "Make Reverse Gravity Temporary";
|
||||
nophysics_floor = "Disable Floor Slope Physics";
|
||||
nophysics_ceiling = "Disable Ceiling Slope Physics";
|
||||
flipspecial_nofloor = "No Trigger on Floor Touch";
|
||||
flipspecial_ceiling = "Trigger on Ceiling Touch";
|
||||
triggerspecial_touch = "Trigger on Edge Touch";
|
||||
|
@ -114,6 +116,8 @@ sectorflagscategories
|
|||
ropehang = "special";
|
||||
jumpflip = "special";
|
||||
gravityoverride = "special";
|
||||
nophysics_floor = "special";
|
||||
nophysics_ceiling = "special";
|
||||
flipspecial_nofloor = "trigger";
|
||||
flipspecial_ceiling = "trigger";
|
||||
triggerspecial_touch = "trigger";
|
||||
|
|
|
@ -134,10 +134,13 @@ add_dependencies(SRB2SDL2 _SRB2_reconf)
|
|||
|
||||
if("${CMAKE_COMPILER_IS_GNUCC}" AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
|
||||
target_link_options(SRB2SDL2 PRIVATE "-Wl,--disable-dynamicbase")
|
||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
|
||||
if("${SRB2_CONFIG_STATIC_STDLIB}")
|
||||
# On MinGW with internal libraries, link the standard library statically
|
||||
target_link_options(SRB2SDL2 PRIVATE "-static")
|
||||
endif()
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
target_link_options(SRB2SDL2 PRIVATE "-Wl,--large-address-aware")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_compile_features(SRB2SDL2 PRIVATE c_std_11 cxx_std_17)
|
||||
|
@ -182,12 +185,7 @@ if("${SRB2_CONFIG_USE_GME}")
|
|||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(SRB2SDL2 PRIVATE openmpt)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_OPENMPT)
|
||||
|
||||
target_link_libraries(SRB2SDL2 PRIVATE ZLIB::ZLIB PNG::PNG CURL::libcurl)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB -DHAVE_PNG -DHAVE_CURL -D_LARGEFILE64_SOURCE)
|
||||
target_sources(SRB2SDL2 PRIVATE apng.c)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -D_LARGEFILE64_SOURCE)
|
||||
|
||||
set(SRB2_HAVE_THREADS ON)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
|
||||
|
@ -403,8 +401,66 @@ if(SRB2_CONFIG_PROFILEMODE AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
|||
endif()
|
||||
|
||||
add_subdirectory(sdl)
|
||||
if(SRB2_CONFIG_ENABLE_TESTS)
|
||||
add_subdirectory(tests)
|
||||
|
||||
if(TARGET ZLIB::ZLIB)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB)
|
||||
message(STATUS "Zlib Found")
|
||||
else()
|
||||
message(STATUS "No Zlib Found")
|
||||
endif()
|
||||
|
||||
if(TARGET PNG::PNG)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_PNG)
|
||||
target_sources(SRB2SDL2 PRIVATE apng.c ${libapng_HEADER})
|
||||
target_include_directories(SRB2SDL2 PRIVATE ${libapng_INCLUDE_DIRS} ${libpng_BINARY_DIR})
|
||||
#message(STATUS "libpng inc DIRS at ${libapng_INCLUDE_DIRS}")
|
||||
#message(STATUS "libpng bin DIRS at ${libpng_BINARY_DIR}")
|
||||
#message(STATUS "png.h at ${libapng_HEADER}")
|
||||
message(STATUS "libpng Found")
|
||||
else()
|
||||
message(STATUS "No libpng Found")
|
||||
endif()
|
||||
|
||||
if(TARGET PNG::PNG AND TARGET ZLIB::ZLIB)
|
||||
#libpng links zlib too?
|
||||
target_link_libraries(SRB2SDL2 PRIVATE PNG::PNG)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET PNG::PNG AND TARGET ZLIB::ZLIB)
|
||||
#got no libpng? we need zlib
|
||||
target_link_libraries(SRB2SDL2 PRIVATE ZLIB::ZLIB)
|
||||
endif()
|
||||
|
||||
if(TARGET gme::gme)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE gme::gme)
|
||||
message(STATUS "libgme Found")
|
||||
else()
|
||||
message(STATUS "No libgme Found")
|
||||
endif()
|
||||
|
||||
if(TARGET libopenmpt::libopenmpt)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_OPENMPT)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE libopenmpt::libopenmpt)
|
||||
message(STATUS "libopenmpt Found")
|
||||
else()
|
||||
message(STATUS "No libopenmpt Found")
|
||||
endif()
|
||||
|
||||
if(TARGET CURL::libcurl)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_CURL)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE CURL::libcurl)
|
||||
message(STATUS "libcurl Found")
|
||||
else()
|
||||
message(STATUS "No libcurl Found")
|
||||
endif()
|
||||
|
||||
if(TARGET miniupnpc::miniupnpc)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MINIUPNPC)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE miniupnpc::miniupnpc)
|
||||
message(STATUS "miniupnpc Found")
|
||||
else()
|
||||
message(STATUS "No miniupnpc Found")
|
||||
endif()
|
||||
|
||||
# strip debug symbols into separate file when using gcc.
|
||||
|
|
|
@ -373,6 +373,16 @@ typedef enum
|
|||
AI_SPINFOLLOW
|
||||
} aistatetype_t;
|
||||
|
||||
// NiGHTS text
|
||||
typedef enum
|
||||
{
|
||||
NTV_NONE = 0,
|
||||
NTV_GETSPHERES,
|
||||
NTV_GETMORESPHERES,
|
||||
NTV_BONUSTIMESTART,
|
||||
NTV_BONUSTIMEEND,
|
||||
} nightstextvar_t;
|
||||
|
||||
|
||||
// ========================================================================
|
||||
// PLAYER STRUCTURE
|
||||
|
@ -572,7 +582,8 @@ typedef struct player_s
|
|||
// Statistical purposes.
|
||||
tic_t marebegunat; // Leveltime when mare begun
|
||||
tic_t startedtime; // Time which you started this mare with.
|
||||
tic_t finishedtime; // Time it took you to finish the mare (used for display)
|
||||
tic_t finishedtime; // The time it took to destroy the capsule on this mare (used for bonus time display)
|
||||
tic_t lastmaretime; // The time it took to complete the last mare (used for rank display)
|
||||
tic_t lapbegunat; // Leveltime when lap begun
|
||||
tic_t lapstartedtime; // Time which you started this lap with.
|
||||
INT16 finishedspheres; // The spheres you had left upon finishing the mare
|
||||
|
@ -587,7 +598,7 @@ typedef struct player_s
|
|||
UINT8 totalmarebonuslap; // total mare bonus lap
|
||||
INT32 maxlink; // maximum link obtained
|
||||
UINT8 texttimer; // nights_texttime should not be local
|
||||
UINT8 textvar; // which line of NiGHTS text to show -- let's not use cheap hacks
|
||||
UINT8 textvar; // which line of NiGHTS text to show -- see nightstextvar_t
|
||||
|
||||
INT16 lastsidehit, lastlinehit;
|
||||
|
||||
|
|
|
@ -1543,6 +1543,12 @@ void readlevelheader(MYFILE *f, INT32 num)
|
|||
P_AddGradesForMare((INT16)(num-1), mare-1, word2);
|
||||
}
|
||||
|
||||
// NiGHTS time limits (per mare)
|
||||
else if (fastncmp(word, "NIGHTSTIME", 10))
|
||||
{
|
||||
P_AddNiGHTSTimes((INT16)(num-1), word2);
|
||||
}
|
||||
|
||||
// Strings that can be truncated
|
||||
else if (fastcmp(word, "SELECTHEADING"))
|
||||
{
|
||||
|
|
|
@ -335,6 +335,7 @@ typedef struct
|
|||
INT32 sstimer; ///< Timer for special stages.
|
||||
UINT32 ssspheres; ///< Sphere requirement in special stages.
|
||||
fixed_t gravity; ///< Map-wide gravity.
|
||||
UINT16 nightstimer[8]; ///< Per-mare time limits for NiGHTS stages.
|
||||
|
||||
// Title card.
|
||||
char ltzzpatch[8+1]; ///< Zig zag patch.
|
||||
|
|
|
@ -229,6 +229,7 @@ static UINT8 cutscene_boostspeed = 0;
|
|||
char stjrintro[9] = "STJRI000";
|
||||
|
||||
static huddrawlist_h luahuddrawlist_title;
|
||||
static huddrawlist_h luahuddrawlist_continue[2];
|
||||
|
||||
//
|
||||
// This alters the text string cutscene_disptext.
|
||||
|
@ -3532,9 +3533,14 @@ void F_TitleDemoTicker(void)
|
|||
static skin_t *contskins[2];
|
||||
static UINT16 cont_spr2[2][6];
|
||||
static UINT8 *contcolormaps[2];
|
||||
static player_t *contPlayers[2];
|
||||
static skincolornum_t contColors[2]; // it's possible to change your skincolor in the continue screen, so this is for Lua to identify the skincolor that was used to cache the colormap
|
||||
static boolean contOverrides[2];
|
||||
|
||||
void F_StartContinue(void)
|
||||
{
|
||||
UINT8 i;
|
||||
|
||||
I_Assert(!netgame && !multiplayer);
|
||||
|
||||
if (continuesInSession && players[consoleplayer].continues <= 0)
|
||||
|
@ -3557,9 +3563,12 @@ void F_StartContinue(void)
|
|||
S_ChangeMusicInternal("_conti", false);
|
||||
S_StopSounds();
|
||||
|
||||
contPlayers[0] = &players[consoleplayer];
|
||||
contskins[0] = skins[players[consoleplayer].skin];
|
||||
|
||||
cont_spr2[0][0] = P_GetSkinSprite2(contskins[0], SPR2_CNT1, NULL);
|
||||
cont_spr2[0][2] = contskins[0]->contangle & 7;
|
||||
contColors[0] = players[consoleplayer].skincolor;
|
||||
contcolormaps[0] = R_GetTranslationColormap(players[consoleplayer].skin, players[consoleplayer].skincolor, GTC_CACHE);
|
||||
cont_spr2[0][4] = contskins[0]->sprites[cont_spr2[0][0]].numframes;
|
||||
cont_spr2[0][5] = max(1, contskins[0]->contspeed);
|
||||
|
@ -3573,9 +3582,12 @@ void F_StartContinue(void)
|
|||
else // HACK
|
||||
secondplaya = 1;
|
||||
|
||||
contPlayers[1] = &players[secondplaya];
|
||||
contskins[1] = skins[players[secondplaya].skin];
|
||||
|
||||
cont_spr2[1][0] = P_GetSkinSprite2(contskins[1], SPR2_CNT4, NULL);
|
||||
cont_spr2[1][2] = (contskins[1]->contangle >> 3) & 7;
|
||||
contColors[1] = players[secondplaya].skincolor;
|
||||
contcolormaps[1] = R_GetTranslationColormap(players[secondplaya].skin, players[secondplaya].skincolor, GTC_CACHE);
|
||||
cont_spr2[1][4] = contskins[1]->sprites[cont_spr2[1][0]].numframes;
|
||||
if (cont_spr2[1][0] == SPR2_CNT4)
|
||||
|
@ -3595,6 +3607,58 @@ void F_StartContinue(void)
|
|||
|
||||
timetonext = (11*TICRATE)+11;
|
||||
continuetime = 0;
|
||||
|
||||
// allocate and/or clear Lua continue screen draw lists
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (!LUA_HUD_IsDrawListValid(luahuddrawlist_continue[i]))
|
||||
{
|
||||
LUA_HUD_DestroyDrawList(luahuddrawlist_continue[i]);
|
||||
luahuddrawlist_continue[i] = LUA_HUD_CreateDrawList();
|
||||
}
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_continue[i]);
|
||||
contOverrides[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void F_DestroyContinueDrawLists(void)
|
||||
{
|
||||
UINT8 i;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
LUA_HUD_DestroyDrawList(luahuddrawlist_continue[i]);
|
||||
luahuddrawlist_continue[i] = NULL;
|
||||
contOverrides[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void F_DrawContinueCharacter(INT32 dx, INT32 dy, UINT8 n)
|
||||
{
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
patch_t *patch;
|
||||
|
||||
if (renderisnewtic)
|
||||
{
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_continue[n]);
|
||||
contOverrides[n] = LUA_HookCharacterHUD
|
||||
(
|
||||
HUD_HOOK(continue), luahuddrawlist_continue[n], contPlayers[n],
|
||||
dx, dy, contskins[n]->highresscale,
|
||||
(INT32)(&contskins[n] - skins), cont_spr2[n][0], cont_spr2[n][1], cont_spr2[n][2] + 1, contColors[n], // add 1 to rotation to convert internal angle numbers (0-7) to WAD editor angle numbers (1-8)
|
||||
imcontinuing ? continuetime : timetonext, imcontinuing
|
||||
);
|
||||
}
|
||||
|
||||
LUA_HUD_DrawList(luahuddrawlist_continue[n]);
|
||||
|
||||
if (contOverrides[n] == true)
|
||||
return;
|
||||
|
||||
sprdef = &contskins[n]->sprites[cont_spr2[n][0]];
|
||||
sprframe = &sprdef->spriteframes[cont_spr2[n][1]];
|
||||
patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_PATCH_LOWPRIORITY);
|
||||
V_DrawFixedPatch((dx), (dy), contskins[n]->highresscale, (sprframe->flip & (1<<cont_spr2[n][2])) ? V_FLIP : 0, patch, contcolormaps[n]);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -3603,8 +3667,6 @@ void F_StartContinue(void)
|
|||
//
|
||||
void F_ContinueDrawer(void)
|
||||
{
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
patch_t *patch;
|
||||
INT32 i, x = (BASEVIDWIDTH>>1), ncontinues = players[consoleplayer].continues;
|
||||
char numbuf[9] = "CONTNUM*";
|
||||
|
@ -3649,7 +3711,7 @@ void F_ContinueDrawer(void)
|
|||
else if (ncontinues > 10)
|
||||
{
|
||||
if (!(continuetime & 1) || continuetime > 17)
|
||||
V_DrawContinueIcon(x, 68, 0, players[consoleplayer].skin, players[consoleplayer].skincolor);
|
||||
V_DrawContinueIcon(x, 68, 0, (INT32)(&contskins[0] - skins), contColors[0]);
|
||||
V_DrawScaledPatch(x+12, 66, 0, stlivex);
|
||||
V_DrawRightAlignedString(x+38, 64, 0,
|
||||
va("%d",(imcontinuing ? ncontinues-1 : ncontinues)));
|
||||
|
@ -3663,7 +3725,7 @@ void F_ContinueDrawer(void)
|
|||
{
|
||||
if (i == (ncontinues/2) && ((continuetime & 1) || continuetime > 17))
|
||||
continue;
|
||||
V_DrawContinueIcon(x - (i*30), 68, 0, players[consoleplayer].skin, players[consoleplayer].skincolor);
|
||||
V_DrawContinueIcon(x - (i*30), 68, 0, (INT32)(&contskins[0] - skins), contColors[0]);
|
||||
}
|
||||
x = BASEVIDWIDTH>>1;
|
||||
}
|
||||
|
@ -3703,21 +3765,12 @@ void F_ContinueDrawer(void)
|
|||
else if (lift[0] > TICRATE+5)
|
||||
lift[0] = TICRATE+5;
|
||||
|
||||
#define drawchar(dx, dy, n) {\
|
||||
sprdef = &contskins[n]->sprites[cont_spr2[n][0]];\
|
||||
sprframe = &sprdef->spriteframes[cont_spr2[n][1]];\
|
||||
patch = W_CachePatchNum(sprframe->lumppat[cont_spr2[n][2]], PU_PATCH_LOWPRIORITY);\
|
||||
V_DrawFixedPatch((dx), (dy), contskins[n]->highresscale, (sprframe->flip & (1<<cont_spr2[n][2])) ? V_FLIP : 0, patch, contcolormaps[n]);\
|
||||
}
|
||||
|
||||
if (offsy < 0)
|
||||
drawchar((BASEVIDWIDTH<<(FRACBITS-1))-offsx, ((140-lift[0])<<FRACBITS)-offsy, 0);
|
||||
F_DrawContinueCharacter((BASEVIDWIDTH<<(FRACBITS-1))-offsx, ((140-lift[0])<<FRACBITS)-offsy, 0);
|
||||
if (contskins[1])
|
||||
drawchar((BASEVIDWIDTH<<(FRACBITS-1))+offsx, ((140-lift[1])<<FRACBITS)+offsy, 1);
|
||||
F_DrawContinueCharacter((BASEVIDWIDTH<<(FRACBITS-1))+offsx, ((140-lift[1])<<FRACBITS)+offsy, 1);
|
||||
if (offsy >= 0)
|
||||
drawchar((BASEVIDWIDTH<<(FRACBITS-1))-offsx, ((140-lift[0])<<FRACBITS)-offsy, 0);
|
||||
|
||||
#undef drawchar
|
||||
F_DrawContinueCharacter((BASEVIDWIDTH<<(FRACBITS-1))-offsx, ((140-lift[0])<<FRACBITS)-offsy, 0);
|
||||
|
||||
if (timetonext > (11*TICRATE))
|
||||
V_DrawFadeScreen(31, timetonext-(11*TICRATE));
|
||||
|
@ -3733,6 +3786,7 @@ void F_ContinueTicker(void)
|
|||
{
|
||||
if (!(--timetonext))
|
||||
{
|
||||
F_DestroyContinueDrawLists();
|
||||
Command_ExitGame_f();
|
||||
return;
|
||||
}
|
||||
|
@ -3742,6 +3796,7 @@ void F_ContinueTicker(void)
|
|||
{
|
||||
if (++continuetime == 3*TICRATE)
|
||||
{
|
||||
F_DestroyContinueDrawLists();
|
||||
G_Continue();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1185,7 +1185,7 @@ boolean preparefilemenu(boolean samedepth)
|
|||
{
|
||||
if (!filenamebuf[i][0])
|
||||
{
|
||||
strncpy(filenamebuf[i], wadfiles[i]->filename, MAX_WADPATH);
|
||||
strncpy(filenamebuf[i], wadfiles[i]->filename, MAX_WADPATH-1);
|
||||
filenamebuf[i][MAX_WADPATH - 1] = '\0';
|
||||
nameonly(filenamebuf[i]);
|
||||
}
|
||||
|
|
|
@ -7493,12 +7493,12 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
sfx_steam1, // deathsound
|
||||
0, // speed
|
||||
32*FRACUNIT, // radius
|
||||
1*FRACUNIT, // height
|
||||
16*FRACUNIT, // height
|
||||
0, // display offset
|
||||
20*FRACUNIT, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SOLID, // flags
|
||||
MF_SPECIAL, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ automatically.
|
|||
X (title),/* titlescreen */\
|
||||
X (titlecard),\
|
||||
X (intermission),\
|
||||
X (continue),\
|
||||
X (playersetup),\
|
||||
|
||||
/*
|
||||
I chose to access the hook enums through a macro as well. This could provide
|
||||
|
@ -117,6 +119,13 @@ extern boolean hook_cmd_running;
|
|||
|
||||
void LUA_HookVoid(int hook);
|
||||
void LUA_HookHUD(int hook, huddrawlist_h drawlist);
|
||||
int LUA_HookCharacterHUD
|
||||
(
|
||||
int hook, huddrawlist_h drawlist, player_t *player,
|
||||
fixed_t x, fixed_t y, fixed_t scale,
|
||||
INT32 skinIndex, UINT8 sprite2, UINT8 frame, UINT8 rotation, skincolornum_t color,
|
||||
INT32 ticker, boolean mode
|
||||
);
|
||||
|
||||
int LUA_HookMobj(mobj_t *, int hook);
|
||||
int LUA_Hook2Mobj(mobj_t *, mobj_t *, int hook);
|
||||
|
|
|
@ -375,6 +375,17 @@ static boolean prepare_string_hook
|
|||
return false;
|
||||
}
|
||||
|
||||
static boolean prepare_hud_hook
|
||||
(
|
||||
Hook_State * hook,
|
||||
int default_status,
|
||||
int hook_type
|
||||
){
|
||||
return init_hook_type(hook, default_status,
|
||||
hook_type, 0, NULL,
|
||||
hudHookIds[hook_type].numHooks);
|
||||
}
|
||||
|
||||
static void init_hook_call
|
||||
(
|
||||
Hook_State * hook,
|
||||
|
@ -490,6 +501,21 @@ static int call_mobj_type_hooks(Hook_State *hook, mobjtype_t mobj_type)
|
|||
return call_mapped(hook, &mobjHookIds[mobj_type][hook->hook_type]);
|
||||
}
|
||||
|
||||
static void call_hud_hooks
|
||||
(
|
||||
Hook_State * hook,
|
||||
int results,
|
||||
Hook_Callback results_handler
|
||||
){
|
||||
hud_running = true; // local hook
|
||||
init_hook_call(hook, results, results_handler);
|
||||
call_mapped(hook, &hudHookIds[hook->hook_type]);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushnil(gL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
static int call_hooks
|
||||
(
|
||||
Hook_State * hook,
|
||||
|
@ -648,25 +674,41 @@ int LUA_HookKey(event_t *event, int hook_type)
|
|||
|
||||
void LUA_HookHUD(int hook_type, huddrawlist_h list)
|
||||
{
|
||||
const hook_t * map = &hudHookIds[hook_type];
|
||||
Hook_State hook;
|
||||
if (map->numHooks > 0)
|
||||
if (prepare_hud_hook(&hook, 0, hook_type))
|
||||
{
|
||||
start_hook_stack();
|
||||
begin_hook_values(&hook);
|
||||
|
||||
LUA_SetHudHook(hook_type, list);
|
||||
|
||||
hud_running = true; // local hook
|
||||
init_hook_call(&hook, 0, res_none);
|
||||
call_mapped(&hook, map);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushnil(gL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
call_hud_hooks(&hook, 0, res_none);
|
||||
}
|
||||
}
|
||||
|
||||
int LUA_HookCharacterHUD
|
||||
(
|
||||
int hook_type, huddrawlist_h list, player_t *player,
|
||||
fixed_t x, fixed_t y, fixed_t scale,
|
||||
INT32 skinIndex, UINT8 sprite2, UINT8 frame, UINT8 rotation, skincolornum_t color,
|
||||
INT32 ticker, boolean mode
|
||||
){
|
||||
Hook_State hook;
|
||||
if (prepare_hud_hook(&hook, false, hook_type))
|
||||
{
|
||||
LUA_SetHudHook(hook_type, list);
|
||||
LUA_PushUserdata(gL, player, META_PLAYER);
|
||||
lua_pushfixed(gL, x);
|
||||
lua_pushfixed(gL, y);
|
||||
lua_pushfixed(gL, scale);
|
||||
lua_pushstring(gL, skins[skinIndex]->name);
|
||||
lua_pushinteger(gL, sprite2);
|
||||
lua_pushinteger(gL, frame);
|
||||
lua_pushinteger(gL, rotation);
|
||||
lua_pushinteger(gL, color);
|
||||
lua_pushinteger(gL, ticker);
|
||||
lua_pushboolean(gL, mode);
|
||||
call_hud_hooks(&hook, 1, res_true);
|
||||
}
|
||||
return hook.status;
|
||||
}
|
||||
|
||||
/* =========================================================================
|
||||
SPECIALIZED HOOKS
|
||||
========================================================================= */
|
||||
|
|
|
@ -190,6 +190,7 @@ enum player_e
|
|||
player_marelap,
|
||||
player_marebonuslap,
|
||||
player_marebegunat,
|
||||
player_lastmaretime,
|
||||
player_startedtime,
|
||||
player_finishedtime,
|
||||
player_lapbegunat,
|
||||
|
@ -337,6 +338,7 @@ static const char *const player_opt[] = {
|
|||
"marelap",
|
||||
"marebonuslap",
|
||||
"marebegunat",
|
||||
"lastmaretime",
|
||||
"startedtime",
|
||||
"finishedtime",
|
||||
"lapbegunat",
|
||||
|
@ -725,6 +727,9 @@ static int player_get(lua_State *L)
|
|||
case player_marebegunat:
|
||||
lua_pushinteger(L, plr->marebegunat);
|
||||
break;
|
||||
case player_lastmaretime:
|
||||
lua_pushinteger(L, plr->lastmaretime);
|
||||
break;
|
||||
case player_startedtime:
|
||||
lua_pushinteger(L, plr->startedtime);
|
||||
break;
|
||||
|
@ -1219,6 +1224,9 @@ static int player_set(lua_State *L)
|
|||
case player_marebegunat:
|
||||
plr->marebegunat = (tic_t)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case player_lastmaretime:
|
||||
plr->lastmaretime = (tic_t)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case player_startedtime:
|
||||
plr->startedtime = (tic_t)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
|
|
181
src/m_menu.c
181
src/m_menu.c
|
@ -184,6 +184,9 @@ static fixed_t char_scroll = 0;
|
|||
|
||||
static tic_t keydown = 0;
|
||||
|
||||
// Lua
|
||||
static huddrawlist_h luahuddrawlist_playersetup;
|
||||
|
||||
//
|
||||
// PROTOTYPES
|
||||
//
|
||||
|
@ -11926,6 +11929,19 @@ static UINT8 multi_frame;
|
|||
static UINT16 multi_spr2;
|
||||
static boolean multi_paused;
|
||||
static boolean multi_invcolor;
|
||||
static boolean multi_override;
|
||||
|
||||
static spritedef_t *multi_followitem_sprdef;
|
||||
static INT32 multi_followitem_skinnum;
|
||||
static UINT8 multi_followitem_numframes;
|
||||
static UINT8 multi_followitem_startframe;
|
||||
static UINT8 multi_followitem_frame;
|
||||
static fixed_t multi_followitem_duration;
|
||||
static fixed_t multi_followitem_tics;
|
||||
static fixed_t multi_followitem_scale;
|
||||
static fixed_t multi_followitem_yoffset;
|
||||
|
||||
#define MULTI_DURATION (4*FRACUNIT)
|
||||
|
||||
// this is set before entering the MultiPlayer setup menu,
|
||||
// for either player 1 or 2
|
||||
|
@ -12070,9 +12086,92 @@ static menucolor_t *M_GridIndexToMenuColor(UINT16 index)
|
|||
}
|
||||
}
|
||||
|
||||
static void M_SetPlayerSetupFollowItem(void)
|
||||
{
|
||||
const mobjtype_t followitem = skins[setupm_fakeskin]->followitem;
|
||||
|
||||
switch (followitem)
|
||||
{
|
||||
case MT_TAILSOVERLAY:
|
||||
{
|
||||
const state_t *state = &states[S_TAILSOVERLAY_MINUS30DEGREES];
|
||||
const UINT8 sprite2 = P_GetSkinSprite2(skins[setupm_fakeskin], state->frame & FF_FRAMEMASK, NULL);
|
||||
|
||||
if (state->sprite != SPR_PLAY)
|
||||
break;
|
||||
|
||||
multi_followitem_sprdef = &skins[setupm_fakeskin]->sprites[sprite2];
|
||||
multi_followitem_skinnum = setupm_fakeskin;
|
||||
multi_followitem_numframes = multi_followitem_sprdef->numframes;
|
||||
multi_followitem_startframe = 0;
|
||||
multi_followitem_frame = multi_frame;
|
||||
multi_followitem_duration = MULTI_DURATION;
|
||||
multi_followitem_tics = multi_tics;
|
||||
multi_followitem_scale = FRACUNIT;
|
||||
multi_followitem_yoffset = 0;
|
||||
|
||||
if ((state->frame & FF_SPR2MIDSTART) && (multi_followitem_numframes > 0) && M_RandomChance(FRACUNIT / 2))
|
||||
{
|
||||
multi_followitem_frame += multi_followitem_numframes / 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MT_METALJETFUME:
|
||||
{
|
||||
const state_t *state = &states[S_JETFUME1];
|
||||
|
||||
if (!(state->frame & FF_ANIMATE))
|
||||
break;
|
||||
|
||||
multi_followitem_sprdef = &sprites[state->sprite];
|
||||
multi_followitem_skinnum = TC_DEFAULT;
|
||||
multi_followitem_numframes = state->var1 + 1;
|
||||
multi_followitem_startframe = state->frame & FF_FRAMEMASK;
|
||||
multi_followitem_frame = multi_followitem_startframe;
|
||||
multi_followitem_duration = state->var2 * FRACUNIT;
|
||||
multi_followitem_tics = multi_tics % multi_followitem_duration;
|
||||
multi_followitem_scale = 2 * FRACUNIT / 3;
|
||||
multi_followitem_yoffset = (skins[setupm_fakeskin]->height - FixedMul(mobjinfo[followitem].height, multi_followitem_scale)) >> 1;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
multi_followitem_sprdef = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void M_DrawPlayerSetupFollowItem(INT32 x, INT32 y, fixed_t scale, INT32 flags)
|
||||
{
|
||||
spriteframe_t *sprframe;
|
||||
patch_t *patch;
|
||||
UINT8 *colormap;
|
||||
|
||||
if (multi_followitem_sprdef == NULL)
|
||||
return;
|
||||
|
||||
if (multi_followitem_frame >= multi_followitem_startframe + multi_followitem_numframes)
|
||||
multi_followitem_frame = multi_followitem_startframe;
|
||||
|
||||
colormap = R_GetTranslationColormap(multi_followitem_skinnum, setupm_fakecolor->color, GTC_CACHE);
|
||||
|
||||
sprframe = &multi_followitem_sprdef->spriteframes[multi_followitem_frame];
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
if (sprframe->flip & 1) // Only for first sprite
|
||||
flags |= V_FLIP; // This sprite is left/right flipped!
|
||||
|
||||
x <<= FRACBITS;
|
||||
y <<= FRACBITS;
|
||||
y -= FixedMul(multi_followitem_yoffset, scale);
|
||||
|
||||
scale = FixedMul(scale, multi_followitem_scale);
|
||||
|
||||
V_DrawFixedPatch(x, y, scale, flags, patch, colormap);
|
||||
}
|
||||
|
||||
static void M_DrawSetupMultiPlayerMenu(void)
|
||||
{
|
||||
INT32 x, y, cursory = 0, flags = 0;
|
||||
fixed_t scale;
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
patch_t *patch;
|
||||
|
@ -12122,11 +12221,24 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||
y += 11;
|
||||
|
||||
// anim the player in the box
|
||||
multi_tics -= renderdeltatics;
|
||||
while (!multi_paused && multi_tics <= 0)
|
||||
if (!multi_paused)
|
||||
{
|
||||
multi_frame++;
|
||||
multi_tics += 4*FRACUNIT;
|
||||
multi_tics -= renderdeltatics;
|
||||
while (multi_tics <= 0)
|
||||
{
|
||||
multi_frame++;
|
||||
multi_tics += MULTI_DURATION;
|
||||
}
|
||||
|
||||
if (multi_followitem_sprdef != NULL)
|
||||
{
|
||||
multi_followitem_tics -= renderdeltatics;
|
||||
while (multi_followitem_tics <= 0)
|
||||
{
|
||||
multi_followitem_frame++;
|
||||
multi_followitem_tics += multi_followitem_duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define charw 74
|
||||
|
@ -12141,17 +12253,38 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||
goto faildraw;
|
||||
|
||||
// ok, draw player sprite for sure now
|
||||
colormap = R_GetTranslationColormap(setupm_fakeskin, setupm_fakecolor->color, GTC_CACHE);
|
||||
|
||||
if (multi_frame >= sprdef->numframes)
|
||||
multi_frame = 0;
|
||||
|
||||
scale = FixedDiv(skins[setupm_fakeskin]->highresscale, skins[setupm_fakeskin]->shieldscale);
|
||||
|
||||
#define chary (y+64)
|
||||
|
||||
if (renderisnewtic)
|
||||
{
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_playersetup);
|
||||
multi_override = LUA_HookCharacterHUD
|
||||
(
|
||||
HUD_HOOK(playersetup), luahuddrawlist_playersetup, setupm_player,
|
||||
x << FRACBITS, chary << FRACBITS, scale,
|
||||
setupm_fakeskin, multi_spr2, multi_frame, 1, setupm_fakecolor->color,
|
||||
(multi_tics >> FRACBITS) + 1, multi_paused
|
||||
);
|
||||
}
|
||||
|
||||
LUA_HUD_DrawList(luahuddrawlist_playersetup);
|
||||
|
||||
if (multi_override == true)
|
||||
goto colordraw;
|
||||
|
||||
colormap = R_GetTranslationColormap(setupm_fakeskin, setupm_fakecolor->color, GTC_CACHE);
|
||||
|
||||
sprframe = &sprdef->spriteframes[multi_frame];
|
||||
patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH);
|
||||
if (sprframe->flip & 1) // Only for first sprite
|
||||
flags |= V_FLIP; // This sprite is left/right flipped!
|
||||
|
||||
#define chary (y+64)
|
||||
M_DrawPlayerSetupFollowItem(x, chary, scale, flags & ~V_FLIP);
|
||||
|
||||
V_DrawFixedPatch(
|
||||
x<<FRACBITS,
|
||||
|
@ -12344,6 +12477,20 @@ static void M_DrawColorRamp(INT32 x, INT32 y, INT32 w, INT32 h, skincolor_t colo
|
|||
V_DrawFill(x, y+(i*h), w, h, color.ramp[i]);
|
||||
}
|
||||
|
||||
static void M_InitPlayerSetupLua(void)
|
||||
{
|
||||
// I'd really like to assume that the drawlist has been destroyed,
|
||||
// but it appears M_ClearMenus has options not to call exit routines...
|
||||
// so that doesn't seem safe to me??
|
||||
if (!LUA_HUD_IsDrawListValid(luahuddrawlist_playersetup))
|
||||
{
|
||||
LUA_HUD_DestroyDrawList(luahuddrawlist_playersetup);
|
||||
luahuddrawlist_playersetup = LUA_HUD_CreateDrawList();
|
||||
}
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_playersetup);
|
||||
multi_override = false;
|
||||
}
|
||||
|
||||
// Handle 1P/2P MP Setup
|
||||
static void M_HandleSetupMultiPlayer(INT32 choice)
|
||||
{
|
||||
|
@ -12389,6 +12536,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
|||
}
|
||||
while ((prev_setupm_fakeskin != setupm_fakeskin) && !(R_SkinUsable(-1, setupm_fakeskin)));
|
||||
multi_spr2 = P_GetSkinSprite2(skins[setupm_fakeskin], SPR2_WALK, NULL);
|
||||
M_SetPlayerSetupFollowItem();
|
||||
}
|
||||
else if (itemOn == 2) // player color
|
||||
{
|
||||
|
@ -12429,6 +12577,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
|||
}
|
||||
while ((prev_setupm_fakeskin != setupm_fakeskin) && !(R_SkinUsable(-1, setupm_fakeskin)));
|
||||
multi_spr2 = P_GetSkinSprite2(skins[setupm_fakeskin], SPR2_WALK, NULL);
|
||||
M_SetPlayerSetupFollowItem();
|
||||
}
|
||||
else if (itemOn == 2) // player color
|
||||
{
|
||||
|
@ -12549,7 +12698,7 @@ static void M_SetupMultiPlayer(INT32 choice)
|
|||
(void)choice;
|
||||
|
||||
multi_frame = 0;
|
||||
multi_tics = 4*FRACUNIT;
|
||||
multi_tics = MULTI_DURATION;
|
||||
|
||||
strcpy(setupm_name, cv_playername.string);
|
||||
|
||||
|
@ -12579,6 +12728,10 @@ static void M_SetupMultiPlayer(INT32 choice)
|
|||
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER|IT_STRING);
|
||||
|
||||
multi_spr2 = P_GetSkinSprite2(skins[setupm_fakeskin], SPR2_WALK, NULL);
|
||||
M_SetPlayerSetupFollowItem();
|
||||
|
||||
// allocate and/or clear Lua player setup draw list
|
||||
M_InitPlayerSetupLua();
|
||||
|
||||
MP_PlayerSetupDef.prevMenu = currentMenu;
|
||||
M_SetupNextMenu(&MP_PlayerSetupDef);
|
||||
|
@ -12590,7 +12743,7 @@ static void M_SetupMultiPlayer2(INT32 choice)
|
|||
(void)choice;
|
||||
|
||||
multi_frame = 0;
|
||||
multi_tics = 4*FRACUNIT;
|
||||
multi_tics = MULTI_DURATION;
|
||||
|
||||
strcpy (setupm_name, cv_playername2.string);
|
||||
|
||||
|
@ -12620,6 +12773,10 @@ static void M_SetupMultiPlayer2(INT32 choice)
|
|||
MP_PlayerSetupMenu[2].status = (IT_KEYHANDLER|IT_STRING);
|
||||
|
||||
multi_spr2 = P_GetSkinSprite2(skins[setupm_fakeskin], SPR2_WALK, NULL);
|
||||
M_SetPlayerSetupFollowItem();
|
||||
|
||||
// allocate and/or clear Lua player setup draw list
|
||||
M_InitPlayerSetupLua();
|
||||
|
||||
MP_PlayerSetupDef.prevMenu = currentMenu;
|
||||
M_SetupNextMenu(&MP_PlayerSetupDef);
|
||||
|
@ -12641,6 +12798,12 @@ static boolean M_QuitMultiPlayerMenu(void)
|
|||
// send color if changed
|
||||
if (setupm_fakecolor->color != setupm_cvcolor->value)
|
||||
COM_BufAddText (va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor->color));
|
||||
|
||||
// de-allocate Lua player setup drawlist
|
||||
LUA_HUD_DestroyDrawList(luahuddrawlist_playersetup);
|
||||
luahuddrawlist_playersetup = NULL;
|
||||
multi_override = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -114,16 +114,10 @@ typedef union
|
|||
} mysockaddr_t;
|
||||
|
||||
#ifdef HAVE_MINIUPNPC
|
||||
#ifdef MINIUPNP_STATICLIB
|
||||
#include "miniwget.h"
|
||||
#include "miniupnpc.h"
|
||||
#include "upnpcommands.h"
|
||||
#else
|
||||
#include "miniupnpc/miniwget.h"
|
||||
#include "miniupnpc/miniupnpc.h"
|
||||
#include "miniupnpc/upnpcommands.h"
|
||||
#endif
|
||||
static boolean UPNP_support = true;
|
||||
#include "miniupnpc/miniwget.h"
|
||||
#include "miniupnpc/miniupnpc.h"
|
||||
#include "miniupnpc/upnpcommands.h"
|
||||
static boolean UPNP_support = true;
|
||||
#endif // HAVE_MINIUPNC
|
||||
|
||||
#define MAXBANS 100
|
||||
|
|
|
@ -4189,8 +4189,10 @@ static void P_DoBoss5Death(mobj_t *mo)
|
|||
if (!P_MobjWasRemoved(pole))
|
||||
{
|
||||
P_SetScale(pole, 2*FRACUNIT, true);
|
||||
pole->angle = mo->tracer->angle;
|
||||
pole->momx = P_ReturnThrustX(pole, pole->angle, speed);
|
||||
pole->momy = P_ReturnThrustY(pole, pole->angle, speed);
|
||||
|
||||
P_SetTarget(&pole->tracer, P_SpawnMobj(
|
||||
pole->x, pole->y,
|
||||
pole->z - 256*FRACUNIT,
|
||||
|
@ -4199,7 +4201,7 @@ static void P_DoBoss5Death(mobj_t *mo)
|
|||
{
|
||||
pole->tracer->flags |= MF_NOCLIPTHING;
|
||||
P_SetScale(pole->tracer, 2*FRACUNIT, true);
|
||||
pole->angle = pole->tracer->angle = mo->tracer->angle;
|
||||
pole->tracer->angle = mo->tracer->angle;
|
||||
pole->tracer->momx = pole->momx;
|
||||
pole->tracer->momy = pole->momy;
|
||||
|
||||
|
@ -5192,7 +5194,7 @@ void A_SetSolidSteam(mobj_t *actor)
|
|||
return;
|
||||
|
||||
actor->flags &= ~MF_NOCLIP;
|
||||
actor->flags |= MF_SOLID;
|
||||
actor->flags |= MF_SPECIAL;
|
||||
if (!(actor->flags2 & MF2_AMBUSH))
|
||||
{
|
||||
if (P_RandomChance(FRACUNIT/8))
|
||||
|
@ -5222,7 +5224,7 @@ void A_UnsetSolidSteam(mobj_t *actor)
|
|||
if (LUA_CallAction(A_UNSETSOLIDSTEAM, actor))
|
||||
return;
|
||||
|
||||
actor->flags &= ~MF_SOLID;
|
||||
actor->flags &= ~MF_SPECIAL;
|
||||
actor->flags |= MF_NOCLIP;
|
||||
}
|
||||
|
||||
|
|
|
@ -392,17 +392,50 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
}
|
||||
}
|
||||
|
||||
player = toucher->player;
|
||||
I_Assert(player != NULL); // Only players can touch stuff!
|
||||
|
||||
if (player->spectator)
|
||||
return;
|
||||
|
||||
// Ignore multihits in "ouchie" mode
|
||||
if (special->flags & (MF_ENEMY|MF_BOSS) && special->flags2 & MF2_FRET)
|
||||
if (special->flags & (MF_ENEMY | MF_BOSS) && special->flags2 & MF2_FRET)
|
||||
return;
|
||||
|
||||
if (LUA_HookTouchSpecial(special, toucher) || P_MobjWasRemoved(special))
|
||||
player = toucher->player;
|
||||
|
||||
if (player)
|
||||
{
|
||||
if (player->spectator)
|
||||
return;
|
||||
|
||||
// Some hooks may assume that the toucher is a player, so we keep it in here.
|
||||
if (LUA_HookTouchSpecial(special, toucher) || P_MobjWasRemoved(special))
|
||||
return;
|
||||
}
|
||||
|
||||
if (player || (toucher->flags & MF_PUSHABLE)) // Special area for objects that are interactable by both player AND MF_PUSHABLE.
|
||||
{
|
||||
if (special->type == MT_STEAM)
|
||||
{
|
||||
if (player && player->mo->state == &states[player->mo->info->painstate]) // can't use gas jets when player is in pain!
|
||||
return;
|
||||
|
||||
fixed_t speed = special->info->mass; // gas jets use this for the vertical thrust
|
||||
SINT8 flipval = P_MobjFlip(special); // virtually everything here centers around the thruster's gravity, not the object's!
|
||||
|
||||
if (special->state != &states[S_STEAM1]) // Only when it bursts
|
||||
return;
|
||||
|
||||
toucher->eflags |= MFE_SPRUNG;
|
||||
toucher->momz = flipval * FixedMul(speed, FixedSqrt(FixedMul(special->scale, toucher->scale))); // scale the speed with both objects' scales, just like with springs!
|
||||
|
||||
if (player)
|
||||
{
|
||||
P_ResetPlayer(player);
|
||||
if (player->panim != PA_FALL)
|
||||
P_SetMobjState(toucher, S_PLAY_FALL);
|
||||
}
|
||||
|
||||
return; // Don't collect it!
|
||||
}
|
||||
}
|
||||
|
||||
if (!player) // Only players can touch stuff!
|
||||
return;
|
||||
|
||||
// 0 = none, 1 = elemental pierce, 2 = bubble bounce
|
||||
|
@ -1332,7 +1365,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
}
|
||||
break;
|
||||
case MT_NIGHTSEXTRATIME:
|
||||
if ((player->bot && player->bot != BOT_MPAI) || !(player->powers[pw_carry] == CR_NIGHTSMODE))
|
||||
if ((player->bot && player->bot != BOT_MPAI) || !(player->powers[pw_carry] == CR_NIGHTSMODE || (G_IsSpecialStage(gamemap) && !(maptol & TOL_NIGHTS))))
|
||||
return;
|
||||
if (!G_IsSpecialStage(gamemap))
|
||||
{
|
||||
|
@ -1344,7 +1377,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
else
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && players[i].powers[pw_carry] == CR_NIGHTSMODE)
|
||||
if (playeringame[i] && (player->powers[pw_carry] == CR_NIGHTSMODE || (G_IsSpecialStage(gamemap) && !(maptol & TOL_NIGHTS))))
|
||||
{
|
||||
players[i].nightstime += special->info->speed;
|
||||
players[i].startedtime += special->info->speed;
|
||||
|
@ -1881,6 +1914,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
|||
toucher->tracer->flags2 = (toucher->tracer->flags2 & ~MF2_AMBUSH) | destambush;
|
||||
}
|
||||
return;
|
||||
|
||||
default: // SOC or script pickup
|
||||
if (player->bot && player->bot != BOT_MPAI)
|
||||
return;
|
||||
|
@ -3606,7 +3640,7 @@ void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||
if (player->nightstime > 5*TICRATE)
|
||||
player->nightstime -= 5*TICRATE;
|
||||
else
|
||||
player->nightstime = 0;
|
||||
player->nightstime = 1;
|
||||
}
|
||||
|
||||
P_DoPlayerPain(player, inflictor, source);
|
||||
|
|
|
@ -307,21 +307,19 @@ void P_PushableThinker(mobj_t *mobj);
|
|||
void P_SceneryThinker(mobj_t *mobj);
|
||||
|
||||
|
||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
#define P_GetFloorZ(mobj, sector, x, y, line) P_MobjFloorZ(mobj, sector, NULL, x, y, line, false, false)
|
||||
#define P_GetCeilingZ(mobj, sector, x, y, line) P_MobjCeilingZ(mobj, sector, NULL, x, y, line, true, false)
|
||||
#define P_GetFOFTopZ(mobj, sector, fof, x, y, line) P_MobjCeilingZ(mobj, sectors + fof->secnum, sector, x, y, line, false, false)
|
||||
#define P_GetFOFBottomZ(mobj, sector, fof, x, y, line) P_MobjFloorZ(mobj, sectors + fof->secnum, sector, x, y, line, true, false)
|
||||
#define P_GetSpecialBottomZ(mobj, src, bound) P_MobjFloorZ(mobj, src, bound, mobj->x, mobj->y, NULL, src != bound, true)
|
||||
#define P_GetSpecialTopZ(mobj, src, bound) P_MobjCeilingZ(mobj, src, bound, mobj->x, mobj->y, NULL, src == bound, true)
|
||||
fixed_t P_MobjFloorZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean lowest, boolean perfect);
|
||||
fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean lowest, boolean perfect);
|
||||
#define P_GetFloorZ(mobj, sector, x, y, line) P_MobjFloorZ(sector, NULL, x, y, mobj->radius, line, false, false)
|
||||
#define P_GetCeilingZ(mobj, sector, x, y, line) P_MobjCeilingZ(sector, NULL, x, y, mobj->radius, line, true, false)
|
||||
#define P_GetFOFTopZ(mobj, sector, fof, x, y, line) P_MobjCeilingZ(sectors + fof->secnum, sector, x, y, mobj->radius, line, false, false)
|
||||
#define P_GetFOFBottomZ(mobj, sector, fof, x, y, line) P_MobjFloorZ(sectors + fof->secnum, sector, x, y, mobj->radius, line, true, false)
|
||||
#define P_GetSpecialBottomZ(mobj, src, bound) P_MobjFloorZ(src, bound, mobj->x, mobj->y, mobj->radius, NULL, src != bound, true)
|
||||
#define P_GetSpecialTopZ(mobj, src, bound) P_MobjCeilingZ(src, bound, mobj->x, mobj->y, mobj->radius, NULL, src == bound, true)
|
||||
|
||||
fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
#define P_CameraGetFloorZ(mobj, sector, x, y, line) P_CameraFloorZ(mobj, sector, NULL, x, y, line, false, false)
|
||||
#define P_CameraGetCeilingZ(mobj, sector, x, y, line) P_CameraCeilingZ(mobj, sector, NULL, x, y, line, true, false)
|
||||
#define P_CameraGetFOFTopZ(mobj, sector, fof, x, y, line) P_CameraCeilingZ(mobj, sectors + fof->secnum, sector, x, y, line, false, false)
|
||||
#define P_CameraGetFOFBottomZ(mobj, sector, fof, x, y, line) P_CameraFloorZ(mobj, sectors + fof->secnum, sector, x, y, line, true, false)
|
||||
#define P_CameraGetFloorZ(mobj, sector, x, y, line) P_MobjFloorZ(sector, NULL, x, y, mobj->radius, line, false, false)
|
||||
#define P_CameraGetCeilingZ(mobj, sector, x, y, line) P_MobjCeilingZ(sector, NULL, x, y, mobj->radius, line, true, false)
|
||||
#define P_CameraGetFOFTopZ(mobj, sector, fof, x, y, line) P_MobjCeilingZ(sectors + fof->secnum, sector, x, y, mobj->radius, line, false, false)
|
||||
#define P_CameraGetFOFBottomZ(mobj, sector, fof, x, y, line) P_MobjFloorZ(sectors + fof->secnum, sector, x, y, mobj->radius, line, true, false)
|
||||
|
||||
boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover);
|
||||
boolean P_CheckDeathPitCollide(mobj_t *mo);
|
||||
|
|
72
src/p_map.c
72
src/p_map.c
|
@ -502,72 +502,56 @@ springstate:
|
|||
return final;
|
||||
}
|
||||
|
||||
static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
||||
static void P_DoFan(mobj_t *fan, mobj_t *object)
|
||||
{
|
||||
player_t *p = object->player; // will be NULL if not a player
|
||||
fixed_t zdist; // distance between bottoms
|
||||
fixed_t speed = spring->info->mass; // conveniently, both fans and gas jets use this for the vertical thrust
|
||||
SINT8 flipval = P_MobjFlip(spring); // virtually everything here centers around the thruster's gravity, not the object's!
|
||||
fixed_t speed = fan->info->mass; // fans use this for the vertical thrust
|
||||
SINT8 flipval = P_MobjFlip(fan); // virtually everything here centers around the thruster's gravity, not the object's!
|
||||
|
||||
if (p && object->state == &states[object->info->painstate]) // can't use fans and gas jets when player is in pain!
|
||||
if (p && object->state == &states[object->info->painstate]) // can't use fans when player is in pain!
|
||||
return;
|
||||
|
||||
// is object's top below thruster's position? if not, calculate distance between their bottoms
|
||||
if (spring->eflags & MFE_VERTICALFLIP)
|
||||
if (fan->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
if (object->z > spring->z + spring->height)
|
||||
if (object->z > fan->z + fan->height)
|
||||
return;
|
||||
zdist = (spring->z + spring->height) - (object->z + object->height);
|
||||
zdist = (fan->z + fan->height) - (object->z + object->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (object->z + object->height < spring->z)
|
||||
if (object->z + object->height < fan->z)
|
||||
return;
|
||||
zdist = object->z - spring->z;
|
||||
zdist = object->z - fan->z;
|
||||
}
|
||||
|
||||
object->standingslope = NULL; // No launching off at silly angles for you.
|
||||
|
||||
switch (spring->type)
|
||||
switch (fan->type)
|
||||
{
|
||||
case MT_FAN: // fan
|
||||
if (zdist > (spring->health << FRACBITS)) // max z distance determined by health (set by map thing args[0])
|
||||
if (zdist > (fan->health << FRACBITS)) // max z distance determined by health (set by map thing args[0])
|
||||
break;
|
||||
if (flipval*object->momz >= FixedMul(speed, spring->scale)) // if object's already moving faster than your best, don't bother
|
||||
if (flipval*object->momz >= FixedMul(speed, fan->scale)) // if object's already moving faster than your best, don't bother
|
||||
break;
|
||||
if (p && (p->climbing || p->pflags & PF_GLIDING)) // doesn't affect Knux when he's using his abilities!
|
||||
break;
|
||||
|
||||
object->momz += flipval*FixedMul(speed/4, spring->scale);
|
||||
object->momz += flipval*FixedMul(speed/4, fan->scale);
|
||||
|
||||
// limit the speed if too high
|
||||
if (flipval*object->momz > FixedMul(speed, spring->scale))
|
||||
object->momz = flipval*FixedMul(speed, spring->scale);
|
||||
if (flipval*object->momz > FixedMul(speed, fan->scale))
|
||||
object->momz = flipval*FixedMul(speed, fan->scale);
|
||||
|
||||
if (p && !p->powers[pw_tailsfly] && !p->powers[pw_carry]) // doesn't reset anim for Tails' flight
|
||||
{
|
||||
P_ResetPlayer(p);
|
||||
P_SetMobjState(object, S_PLAY_FALL);
|
||||
P_SetTarget(&object->tracer, spring);
|
||||
P_SetTarget(&object->tracer, fan);
|
||||
p->powers[pw_carry] = CR_FAN;
|
||||
}
|
||||
break;
|
||||
case MT_STEAM: // Steam
|
||||
if (zdist > FixedMul(16*FRACUNIT, spring->scale))
|
||||
break;
|
||||
if (spring->state != &states[S_STEAM1]) // Only when it bursts
|
||||
break;
|
||||
|
||||
object->eflags |= MFE_SPRUNG;
|
||||
object->momz = flipval*FixedMul(speed, FixedSqrt(FixedMul(spring->scale, object->scale))); // scale the speed with both objects' scales, just like with springs!
|
||||
|
||||
if (p)
|
||||
{
|
||||
P_ResetPlayer(p);
|
||||
if (p->panim != PA_FALL)
|
||||
P_SetMobjState(object, S_PLAY_FALL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -1484,13 +1468,13 @@ static unsigned PIT_DoCheckThing(mobj_t *thing)
|
|||
}
|
||||
|
||||
// check for special pickup
|
||||
if (thing->flags & MF_SPECIAL && tmthing->player)
|
||||
if (thing->flags & MF_SPECIAL)
|
||||
{
|
||||
P_TouchSpecialThing(thing, tmthing, true); // can remove thing
|
||||
return CHECKTHING_COLLIDE;
|
||||
}
|
||||
// check again for special pickup
|
||||
if (tmthing->flags & MF_SPECIAL && thing->player)
|
||||
if (tmthing->flags & MF_SPECIAL)
|
||||
{
|
||||
P_TouchSpecialThing(tmthing, thing, true); // can remove thing
|
||||
return CHECKTHING_COLLIDE;
|
||||
|
@ -1578,15 +1562,15 @@ static unsigned PIT_DoCheckThing(mobj_t *thing)
|
|||
|
||||
if (thing->flags & MF_PUSHABLE)
|
||||
{
|
||||
if (tmthing->type == MT_FAN || tmthing->type == MT_STEAM)
|
||||
P_DoFanAndGasJet(tmthing, thing);
|
||||
if (tmthing->type == MT_FAN)
|
||||
P_DoFan(tmthing, thing);
|
||||
}
|
||||
|
||||
if (tmthing->flags & MF_PUSHABLE)
|
||||
{
|
||||
if (thing->type == MT_FAN || thing->type == MT_STEAM)
|
||||
if (thing->type == MT_FAN)
|
||||
{
|
||||
P_DoFanAndGasJet(thing, tmthing);
|
||||
P_DoFan(thing, tmthing);
|
||||
return CHECKTHING_COLLIDE;
|
||||
}
|
||||
else if (thing->flags & MF_SPRING)
|
||||
|
@ -1679,8 +1663,8 @@ static unsigned PIT_DoCheckThing(mobj_t *thing)
|
|||
}
|
||||
}
|
||||
|
||||
if (tmthing->type == MT_FAN || tmthing->type == MT_STEAM)
|
||||
P_DoFanAndGasJet(tmthing, thing);
|
||||
if (tmthing->type == MT_FAN)
|
||||
P_DoFan(tmthing, thing);
|
||||
}
|
||||
|
||||
if (tmthing->player) // Is the moving/interacting object the player?
|
||||
|
@ -1688,8 +1672,8 @@ static unsigned PIT_DoCheckThing(mobj_t *thing)
|
|||
if (!tmthing->health)
|
||||
return CHECKTHING_IGNORE;
|
||||
|
||||
if (thing->type == MT_FAN || thing->type == MT_STEAM)
|
||||
P_DoFanAndGasJet(thing, tmthing);
|
||||
if (thing->type == MT_FAN)
|
||||
P_DoFan(thing, tmthing);
|
||||
else if (thing->flags & MF_SPRING && tmthing->player->powers[pw_carry] != CR_MINECART)
|
||||
{
|
||||
if ( thing->z <= tmthing->z + tmthing->height
|
||||
|
@ -1755,8 +1739,8 @@ static unsigned PIT_DoCheckThing(mobj_t *thing)
|
|||
// not solid not blocked
|
||||
unsigned collide = CHECKTHING_NOCOLLIDE;
|
||||
|
||||
if ((tmthing->flags & MF_SPRING || tmthing->type == MT_STEAM || tmthing->type == MT_SPIKE || tmthing->type == MT_WALLSPIKE) && (thing->player))
|
||||
; // springs, gas jets and springs should never be able to step up onto a player
|
||||
if ((tmthing->flags & MF_SPRING || tmthing->type == MT_SPIKE || tmthing->type == MT_WALLSPIKE) && (thing->player))
|
||||
; // springs and spikes should never be able to step up onto a player
|
||||
// z checking at last
|
||||
// Treat noclip things as non-solid!
|
||||
else if ((thing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID
|
||||
|
|
|
@ -1026,23 +1026,35 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
|
|||
//
|
||||
boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *))
|
||||
{
|
||||
mobj_t *mobj;
|
||||
blocknode_t *block;
|
||||
mobj_t *bnext = NULL;
|
||||
blocknode_t *block, *next = NULL;
|
||||
|
||||
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
|
||||
return true;
|
||||
|
||||
// Check interaction with the objects in the blockmap.
|
||||
for (block = blocklinks[y*bmapwidth + x]; block; block = block->mnext)
|
||||
for (block = blocklinks[y*bmapwidth + x]; block; block = next)
|
||||
{
|
||||
mobj = block->mobj;
|
||||
next = block->mnext;
|
||||
if (next)
|
||||
P_SetTarget(&bnext, next->mobj); // We want to note our reference to bnext here in case it is MF_NOTHINK and gets removed!
|
||||
|
||||
if (!func(mobj))
|
||||
if (!func(block->mobj))
|
||||
{
|
||||
P_SetTarget(&bnext, NULL);
|
||||
return false;
|
||||
if (P_MobjWasRemoved(tmthing)) // func just broke blockmap chain, cannot continue.
|
||||
}
|
||||
|
||||
if (P_MobjWasRemoved(tmthing) // func just popped our tmthing, cannot continue.
|
||||
|| (bnext && P_MobjWasRemoved(bnext))) // func just broke blockmap chain, cannot continue.
|
||||
{
|
||||
P_SetTarget(&bnext, NULL);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
P_SetTarget(&bnext, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
212
src/p_mobj.c
212
src/p_mobj.c
|
@ -1108,9 +1108,8 @@ static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, line_t *line,
|
|||
);
|
||||
}
|
||||
|
||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
fixed_t P_MobjFloorZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
I_Assert(mobj != NULL);
|
||||
I_Assert(sector != NULL);
|
||||
|
||||
if (sector->f_slope) {
|
||||
|
@ -1119,14 +1118,14 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
|
|||
|
||||
// Get the corner of the object that should be the highest on the slope
|
||||
if (slope->d.x < 0)
|
||||
testx = mobj->radius;
|
||||
testx = radius;
|
||||
else
|
||||
testx = -mobj->radius;
|
||||
testx = -radius;
|
||||
|
||||
if (slope->d.y < 0)
|
||||
testy = mobj->radius;
|
||||
testy = radius;
|
||||
else
|
||||
testy = -mobj->radius;
|
||||
testy = -radius;
|
||||
|
||||
if ((slope->zdelta > 0) ^ !!(lowest)) {
|
||||
testx = -testx;
|
||||
|
@ -1141,7 +1140,7 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
|
|||
return P_GetSlopeZAt(slope, testx, testy);
|
||||
|
||||
// If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point
|
||||
if (perfect) {
|
||||
if (perfect && boundsec) {
|
||||
size_t i;
|
||||
line_t *ld;
|
||||
fixed_t bbox[4];
|
||||
|
@ -1152,10 +1151,10 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
|
|||
else
|
||||
finalheight = INT32_MIN;
|
||||
|
||||
bbox[BOXLEFT] = x-mobj->radius;
|
||||
bbox[BOXRIGHT] = x+mobj->radius;
|
||||
bbox[BOXTOP] = y+mobj->radius;
|
||||
bbox[BOXBOTTOM] = y-mobj->radius;
|
||||
bbox[BOXLEFT] = x-radius;
|
||||
bbox[BOXRIGHT] = x+radius;
|
||||
bbox[BOXTOP] = y+radius;
|
||||
bbox[BOXBOTTOM] = y-radius;
|
||||
for (i = 0; i < boundsec->linecount; i++) {
|
||||
ld = boundsec->lines[i];
|
||||
|
||||
|
@ -1167,9 +1166,9 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
|
|||
continue;
|
||||
|
||||
if (lowest)
|
||||
finalheight = min(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, true));
|
||||
finalheight = min(finalheight, HighestOnLine(radius, x, y, ld, slope, true));
|
||||
else
|
||||
finalheight = max(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, false));
|
||||
finalheight = max(finalheight, HighestOnLine(radius, x, y, ld, slope, false));
|
||||
}
|
||||
|
||||
return finalheight;
|
||||
|
@ -1180,14 +1179,13 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
|
|||
if (line == NULL)
|
||||
return P_GetSlopeZAt(slope, x, y);
|
||||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
return HighestOnLine(radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the floor height
|
||||
return sector->floorheight;
|
||||
}
|
||||
|
||||
fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
I_Assert(mobj != NULL);
|
||||
I_Assert(sector != NULL);
|
||||
|
||||
if (sector->c_slope) {
|
||||
|
@ -1196,14 +1194,14 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
|
|||
|
||||
// Get the corner of the object that should be the highest on the slope
|
||||
if (slope->d.x < 0)
|
||||
testx = mobj->radius;
|
||||
testx = radius;
|
||||
else
|
||||
testx = -mobj->radius;
|
||||
testx = -radius;
|
||||
|
||||
if (slope->d.y < 0)
|
||||
testy = mobj->radius;
|
||||
testy = radius;
|
||||
else
|
||||
testy = -mobj->radius;
|
||||
testy = -radius;
|
||||
|
||||
if ((slope->zdelta > 0) ^ !!(lowest)) {
|
||||
testx = -testx;
|
||||
|
@ -1218,7 +1216,7 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
|
|||
return P_GetSlopeZAt(slope, testx, testy);
|
||||
|
||||
// If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point
|
||||
if (perfect) {
|
||||
if (perfect && boundsec) {
|
||||
size_t i;
|
||||
line_t *ld;
|
||||
fixed_t bbox[4];
|
||||
|
@ -1229,10 +1227,10 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
|
|||
else
|
||||
finalheight = INT32_MIN;
|
||||
|
||||
bbox[BOXLEFT] = x-mobj->radius;
|
||||
bbox[BOXRIGHT] = x+mobj->radius;
|
||||
bbox[BOXTOP] = y+mobj->radius;
|
||||
bbox[BOXBOTTOM] = y-mobj->radius;
|
||||
bbox[BOXLEFT] = x-radius;
|
||||
bbox[BOXRIGHT] = x+radius;
|
||||
bbox[BOXTOP] = y+radius;
|
||||
bbox[BOXBOTTOM] = y-radius;
|
||||
for (i = 0; i < boundsec->linecount; i++) {
|
||||
ld = boundsec->lines[i];
|
||||
|
||||
|
@ -1244,9 +1242,9 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
|
|||
continue;
|
||||
|
||||
if (lowest)
|
||||
finalheight = min(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, true));
|
||||
finalheight = min(finalheight, HighestOnLine(radius, x, y, ld, slope, true));
|
||||
else
|
||||
finalheight = max(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, false));
|
||||
finalheight = max(finalheight, HighestOnLine(radius, x, y, ld, slope, false));
|
||||
}
|
||||
|
||||
return finalheight;
|
||||
|
@ -1257,165 +1255,11 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
|
|||
if (line == NULL)
|
||||
return P_GetSlopeZAt(slope, x, y);
|
||||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
return HighestOnLine(radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the ceiling height
|
||||
return sector->ceilingheight;
|
||||
}
|
||||
|
||||
// Now do the same as all above, but for cameras because apparently cameras are special?
|
||||
fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
I_Assert(mobj != NULL);
|
||||
I_Assert(sector != NULL);
|
||||
|
||||
if (sector->f_slope) {
|
||||
fixed_t testx, testy;
|
||||
pslope_t *slope = sector->f_slope;
|
||||
|
||||
// Get the corner of the object that should be the highest on the slope
|
||||
if (slope->d.x < 0)
|
||||
testx = mobj->radius;
|
||||
else
|
||||
testx = -mobj->radius;
|
||||
|
||||
if (slope->d.y < 0)
|
||||
testy = mobj->radius;
|
||||
else
|
||||
testy = -mobj->radius;
|
||||
|
||||
if ((slope->zdelta > 0) ^ !!(lowest)) {
|
||||
testx = -testx;
|
||||
testy = -testy;
|
||||
}
|
||||
|
||||
testx += x;
|
||||
testy += y;
|
||||
|
||||
// If the highest point is in the sector, then we have it easy! Just get the Z at that point
|
||||
if (R_IsPointInSector(boundsec ? boundsec : sector, testx, testy))
|
||||
return P_GetSlopeZAt(slope, testx, testy);
|
||||
|
||||
// If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point
|
||||
if (perfect) {
|
||||
size_t i;
|
||||
line_t *ld;
|
||||
fixed_t bbox[4];
|
||||
fixed_t finalheight;
|
||||
|
||||
if (lowest)
|
||||
finalheight = INT32_MAX;
|
||||
else
|
||||
finalheight = INT32_MIN;
|
||||
|
||||
bbox[BOXLEFT] = x-mobj->radius;
|
||||
bbox[BOXRIGHT] = x+mobj->radius;
|
||||
bbox[BOXTOP] = y+mobj->radius;
|
||||
bbox[BOXBOTTOM] = y-mobj->radius;
|
||||
for (i = 0; i < boundsec->linecount; i++) {
|
||||
ld = boundsec->lines[i];
|
||||
|
||||
if (bbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || bbox[BOXLEFT] >= ld->bbox[BOXRIGHT]
|
||||
|| bbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || bbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
|
||||
continue;
|
||||
|
||||
if (P_BoxOnLineSide(bbox, ld) != -1)
|
||||
continue;
|
||||
|
||||
if (lowest)
|
||||
finalheight = min(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, true));
|
||||
else
|
||||
finalheight = max(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, false));
|
||||
}
|
||||
|
||||
return finalheight;
|
||||
}
|
||||
|
||||
// If we're just testing for base sector location (no collision line), just go for the center's spot...
|
||||
// It'll get fixed when we test for collision anyway, and the final result can't be lower than this
|
||||
if (line == NULL)
|
||||
return P_GetSlopeZAt(slope, x, y);
|
||||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the floor height
|
||||
return sector->floorheight;
|
||||
}
|
||||
|
||||
fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
I_Assert(mobj != NULL);
|
||||
I_Assert(sector != NULL);
|
||||
|
||||
if (sector->c_slope) {
|
||||
fixed_t testx, testy;
|
||||
pslope_t *slope = sector->c_slope;
|
||||
|
||||
// Get the corner of the object that should be the highest on the slope
|
||||
if (slope->d.x < 0)
|
||||
testx = mobj->radius;
|
||||
else
|
||||
testx = -mobj->radius;
|
||||
|
||||
if (slope->d.y < 0)
|
||||
testy = mobj->radius;
|
||||
else
|
||||
testy = -mobj->radius;
|
||||
|
||||
if ((slope->zdelta > 0) ^ !!(lowest)) {
|
||||
testx = -testx;
|
||||
testy = -testy;
|
||||
}
|
||||
|
||||
testx += x;
|
||||
testy += y;
|
||||
|
||||
// If the highest point is in the sector, then we have it easy! Just get the Z at that point
|
||||
if (R_IsPointInSector(boundsec ? boundsec : sector, testx, testy))
|
||||
return P_GetSlopeZAt(slope, testx, testy);
|
||||
|
||||
// If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point
|
||||
if (perfect) {
|
||||
size_t i;
|
||||
line_t *ld;
|
||||
fixed_t bbox[4];
|
||||
fixed_t finalheight;
|
||||
|
||||
if (lowest)
|
||||
finalheight = INT32_MAX;
|
||||
else
|
||||
finalheight = INT32_MIN;
|
||||
|
||||
bbox[BOXLEFT] = x-mobj->radius;
|
||||
bbox[BOXRIGHT] = x+mobj->radius;
|
||||
bbox[BOXTOP] = y+mobj->radius;
|
||||
bbox[BOXBOTTOM] = y-mobj->radius;
|
||||
for (i = 0; i < boundsec->linecount; i++) {
|
||||
ld = boundsec->lines[i];
|
||||
|
||||
if (bbox[BOXRIGHT] <= ld->bbox[BOXLEFT] || bbox[BOXLEFT] >= ld->bbox[BOXRIGHT]
|
||||
|| bbox[BOXTOP] <= ld->bbox[BOXBOTTOM] || bbox[BOXBOTTOM] >= ld->bbox[BOXTOP])
|
||||
continue;
|
||||
|
||||
if (P_BoxOnLineSide(bbox, ld) != -1)
|
||||
continue;
|
||||
|
||||
if (lowest)
|
||||
finalheight = min(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, true));
|
||||
else
|
||||
finalheight = max(finalheight, HighestOnLine(mobj->radius, x, y, ld, slope, false));
|
||||
}
|
||||
|
||||
return finalheight;
|
||||
}
|
||||
|
||||
// If we're just testing for base sector location (no collision line), just go for the center's spot...
|
||||
// It'll get fixed when we test for collision anyway, and the final result can't be lower than this
|
||||
if (line == NULL)
|
||||
return P_GetSlopeZAt(slope, x, y);
|
||||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the ceiling height
|
||||
return sector->ceilingheight;
|
||||
}
|
||||
static void P_PlayerFlip(mobj_t *mo)
|
||||
{
|
||||
if (!mo->player)
|
||||
|
@ -2347,8 +2191,8 @@ boolean P_CheckDeathPitCollide(mobj_t *mo)
|
|||
if (mo->player && mo->player->pflags & PF_GODMODE)
|
||||
return false;
|
||||
|
||||
fixed_t sectorFloor = P_GetSectorFloorZAt(mo->subsector->sector, mo->x, mo->y);
|
||||
fixed_t sectorCeiling = P_GetSectorCeilingZAt(mo->subsector->sector, mo->x, mo->y);
|
||||
fixed_t sectorFloor = P_GetSpecialBottomZ(mo, mo->subsector->sector, mo->subsector->sector);
|
||||
fixed_t sectorCeiling = P_GetSpecialTopZ(mo, mo->subsector->sector, mo->subsector->sector);
|
||||
|
||||
if (((mo->z <= sectorFloor
|
||||
&& ((mo->subsector->sector->flags & MSF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & MSF_FLIPSPECIAL_FLOOR))
|
||||
|
|
|
@ -261,6 +261,7 @@ static void P_NetArchivePlayers(void)
|
|||
WRITEUINT8(save_p, players[i].marelap);
|
||||
WRITEUINT8(save_p, players[i].marebonuslap);
|
||||
WRITEUINT32(save_p, players[i].marebegunat);
|
||||
WRITEUINT32(save_p, players[i].lastmaretime);
|
||||
WRITEUINT32(save_p, players[i].startedtime);
|
||||
WRITEUINT32(save_p, players[i].finishedtime);
|
||||
WRITEUINT32(save_p, players[i].lapbegunat);
|
||||
|
@ -492,6 +493,7 @@ static void P_NetUnArchivePlayers(void)
|
|||
players[i].marelap = READUINT8(save_p);
|
||||
players[i].marebonuslap = READUINT8(save_p);
|
||||
players[i].marebegunat = READUINT32(save_p);
|
||||
players[i].lastmaretime = READUINT32(save_p);
|
||||
players[i].startedtime = READUINT32(save_p);
|
||||
players[i].finishedtime = READUINT32(save_p);
|
||||
players[i].lapbegunat = READUINT32(save_p);
|
||||
|
|
|
@ -358,6 +358,8 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
|||
mapheaderinfo[num]->marathonnext = 0;
|
||||
mapheaderinfo[num]->startrings = 0;
|
||||
mapheaderinfo[num]->sstimer = 90;
|
||||
for (UINT8 n = 0; n < 8; n++)
|
||||
mapheaderinfo[num]->nightstimer[n] = 0;
|
||||
mapheaderinfo[num]->ssspheres = 1;
|
||||
mapheaderinfo[num]->gravity = FRACUNIT/2;
|
||||
mapheaderinfo[num]->keywords[0] = '\0';
|
||||
|
@ -525,6 +527,29 @@ UINT32 P_GetScoreForGradeOverall(INT16 map, UINT8 grade)
|
|||
return score;
|
||||
}
|
||||
|
||||
void P_AddNiGHTSTimes(INT16 i, char *gtext)
|
||||
{
|
||||
char *spos = gtext;
|
||||
|
||||
for (UINT8 n = 0; n < 8; n++)
|
||||
{
|
||||
if (spos != NULL)
|
||||
{
|
||||
mapheaderinfo[i]->nightstimer[n] = atoi(spos);
|
||||
CONS_Debug(DBG_SETUP, "%u ", atoi(spos));
|
||||
// Grab next comma
|
||||
spos = strchr(spos, ',');
|
||||
if (spos)
|
||||
++spos;
|
||||
}
|
||||
else
|
||||
{
|
||||
mapheaderinfo[i]->nightstimer[n] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// levelflats
|
||||
//
|
||||
|
@ -1834,6 +1859,10 @@ static void ParseTextmapSectorParameter(UINT32 i, const char *param, const char
|
|||
sectors[i].specialflags |= SSF_JUMPFLIP;
|
||||
else if (fastcmp(param, "gravityoverride") && fastcmp("true", val))
|
||||
sectors[i].specialflags |= SSF_GRAVITYOVERRIDE;
|
||||
else if (fastcmp(param, "nophysics_floor") && fastcmp("true", val))
|
||||
sectors[i].specialflags |= SSF_NOPHYSICSFLOOR;
|
||||
else if (fastcmp(param, "nophysics_ceiling") && fastcmp("true", val))
|
||||
sectors[i].specialflags |= SSF_NOPHYSICSCEILING;
|
||||
else if (fastcmp(param, "friction"))
|
||||
sectors[i].friction = FLOAT_TO_FIXED(atof(val));
|
||||
else if (fastcmp(param, "gravity"))
|
||||
|
@ -2700,13 +2729,18 @@ static void P_WriteTextmap(void)
|
|||
fprintf(f, "rotationfloor = %f;\n", FIXED_TO_FLOAT(AngleFixed(wsectors[i].floorangle)));
|
||||
if (wsectors[i].ceilingangle != 0)
|
||||
fprintf(f, "rotationceiling = %f;\n", FIXED_TO_FLOAT(AngleFixed(wsectors[i].ceilingangle)));
|
||||
if (wsectors[i].extra_colormap)
|
||||
if (wsectors[i].extra_colormap)
|
||||
{
|
||||
INT32 lightcolor = P_RGBAToColor(wsectors[i].extra_colormap->rgba);
|
||||
UINT8 lightalpha = R_GetRgbaA(wsectors[i].extra_colormap->rgba);
|
||||
INT32 fadecolor = P_RGBAToColor(wsectors[i].extra_colormap->fadergba);
|
||||
UINT8 fadealpha = R_GetRgbaA(wsectors[i].extra_colormap->fadergba);
|
||||
|
||||
// For now, convert alpha from new (0-255) to old 'A-Z' (0-25) range
|
||||
// TODO: remove this limitation in a backwards-compatible way (UDMF versioning?)
|
||||
lightalpha /= 10;
|
||||
fadealpha /= 10;
|
||||
|
||||
if (lightcolor != 0)
|
||||
fprintf(f, "lightcolor = %d;\n", lightcolor);
|
||||
if (lightalpha != 25)
|
||||
|
@ -2968,7 +3002,8 @@ static void P_LoadTextmap(void)
|
|||
P_InitializeSector(sc);
|
||||
if (textmap_colormap.used)
|
||||
{
|
||||
// Convert alpha values from old 0-25 (A-Z) range to 0-255 range
|
||||
// Convert alpha values from old 'A-Z' (0-25) range to new UINT8 (0-255) range
|
||||
// TODO: remove this limitation in a backwards-compatible way (UDMF versioning?)
|
||||
UINT8 lightalpha = (textmap_colormap.lightalpha * 102) / 10;
|
||||
UINT8 fadealpha = (textmap_colormap.fadealpha * 102) / 10;
|
||||
|
||||
|
@ -2981,13 +3016,17 @@ static void P_LoadTextmap(void)
|
|||
{
|
||||
sc->f_slope = P_MakeSlopeViaEquationConstants(textmap_planefloor.a, textmap_planefloor.b, textmap_planefloor.c, textmap_planefloor.d);
|
||||
sc->hasslope = true;
|
||||
if (sc->specialflags & SSF_NOPHYSICSFLOOR)
|
||||
sc->f_slope->flags |= SL_NOPHYSICS;
|
||||
}
|
||||
|
||||
if (textmap_planeceiling.defined == (PD_A|PD_B|PD_C|PD_D))
|
||||
{
|
||||
sc->c_slope = P_MakeSlopeViaEquationConstants(textmap_planeceiling.a, textmap_planeceiling.b, textmap_planeceiling.c, textmap_planeceiling.d);
|
||||
sc->hasslope = true;
|
||||
}
|
||||
if (sc->specialflags & SSF_NOPHYSICSCEILING)
|
||||
sc->c_slope->flags |= SL_NOPHYSICS;
|
||||
}
|
||||
|
||||
TextmapFixFlatOffsets(sc);
|
||||
}
|
||||
|
|
|
@ -87,5 +87,6 @@ UINT8 P_GetGrade(UINT32 pscore, INT16 map, UINT8 mare);
|
|||
UINT8 P_HasGrades(INT16 map, UINT8 mare);
|
||||
UINT32 P_GetScoreForGrade(INT16 map, UINT8 mare, UINT8 grade);
|
||||
UINT32 P_GetScoreForGradeOverall(INT16 map, UINT8 grade);
|
||||
void P_AddNiGHTSTimes(INT16 i, char *gtext);
|
||||
|
||||
#endif
|
||||
|
|
16
src/p_tick.c
16
src/p_tick.c
|
@ -564,6 +564,12 @@ void P_DoTeamscrambling(void)
|
|||
CV_SetValue(&cv_teamscramble, 0);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_DoSpecialStageStuff()
|
||||
//
|
||||
// For old-style (non-NiGHTS) special stages
|
||||
//
|
||||
static inline void P_DoSpecialStageStuff(void)
|
||||
{
|
||||
boolean stillalive = false;
|
||||
|
@ -601,7 +607,15 @@ static inline void P_DoSpecialStageStuff(void)
|
|||
if (--players[i].nightstime > 6)
|
||||
{
|
||||
if (P_IsLocalPlayer(&players[i]) && oldnightstime > 10*TICRATE && players[i].nightstime <= 10*TICRATE)
|
||||
S_ChangeMusicInternal("_drown", false);
|
||||
{
|
||||
if (mapheaderinfo[gamemap-1]->levelflags & LF_MIXNIGHTSCOUNTDOWN)
|
||||
{
|
||||
S_FadeMusic(0, 10*MUSICRATE);
|
||||
S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS.
|
||||
}
|
||||
else
|
||||
S_ChangeMusicInternal("_drown", false);
|
||||
}
|
||||
stillalive = true;
|
||||
}
|
||||
else if (!players[i].exiting)
|
||||
|
|
35
src/p_user.c
35
src/p_user.c
|
@ -776,7 +776,7 @@ static void P_DeNightserizePlayer(player_t *player)
|
|||
// NiGHTS Time!
|
||||
void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
||||
{
|
||||
UINT8 oldmare, oldmarelap, oldmarebonuslap;
|
||||
UINT8 oldmare, oldmarelap, oldmarebonuslap, newmare;
|
||||
|
||||
// Bots can't be NiGHTSerized, silly!1 :P
|
||||
if (player->bot)
|
||||
|
@ -797,6 +797,11 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
}
|
||||
}
|
||||
|
||||
// Use mare-specific time limit if specified
|
||||
newmare = P_FindLowestMare();
|
||||
if (mapheaderinfo[gamemap-1]->nightstimer[newmare] > 0)
|
||||
nighttime = mapheaderinfo[gamemap-1]->nightstimer[newmare];
|
||||
|
||||
player->pflags &= ~(PF_SPINDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_SHIELDDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY|PF_SPINNING|PF_DRILLING);
|
||||
player->homing = 0;
|
||||
player->mo->fuse = 0;
|
||||
|
@ -867,7 +872,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
continue;
|
||||
|
||||
players[i].texttimer = (3 * TICRATE) - 10;
|
||||
players[i].textvar = 4; // Score and grades
|
||||
players[i].textvar = NTV_BONUSTIMEEND; // Score and grades
|
||||
players[i].lastmare = players[i].mare;
|
||||
players[i].lastmarelap = players[i].marelap;
|
||||
players[i].lastmarebonuslap = players[i].marebonuslap;
|
||||
|
@ -885,7 +890,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
}
|
||||
|
||||
// Add score to leaderboards now
|
||||
G_AddTempNightsRecords(player, players[i].marescore, leveltime - player->marebegunat, players[i].mare + 1);
|
||||
player->lastmaretime = leveltime - player->marebegunat;
|
||||
G_AddTempNightsRecords(player, players[i].marescore, player->lastmaretime, players[i].mare + 1);
|
||||
|
||||
// transfer scores anyway
|
||||
players[i].totalmarescore += players[i].marescore;
|
||||
|
@ -906,12 +912,13 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
player->lastmarelap = oldmarelap;
|
||||
player->lastmarebonuslap = oldmarebonuslap;
|
||||
player->texttimer = 4*TICRATE;
|
||||
player->textvar = 4; // Score and grades
|
||||
player->textvar = NTV_BONUSTIMEEND; // Score and grades
|
||||
player->finishedspheres = (INT16)(player->spheres);
|
||||
player->finishedrings = (INT16)(player->rings);
|
||||
|
||||
|
||||
// Add score to temp leaderboards
|
||||
G_AddTempNightsRecords(player, player->marescore, leveltime - player->marebegunat, (UINT8)(oldmare + 1));
|
||||
player->lastmaretime = leveltime - player->marebegunat;
|
||||
G_AddTempNightsRecords(player, player->marescore, player->lastmaretime, (UINT8)(oldmare + 1));
|
||||
|
||||
// Starting a new mare, transfer scores
|
||||
player->totalmarescore += player->marescore;
|
||||
|
@ -924,7 +931,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
|
|||
}
|
||||
else
|
||||
{
|
||||
player->textvar = 5; // Nothing, just tells it to go to the GET n RINGS/SPHERES text in a bit
|
||||
player->textvar = NTV_NONE; // Nothing, just tells it to go to the GET n RINGS/SPHERES text in a bit
|
||||
player->texttimer = 40;
|
||||
|
||||
// Don't show before title card
|
||||
|
@ -7006,7 +7013,7 @@ static void P_DoNiGHTSCapsule(player_t *player)
|
|||
{
|
||||
players[i].bonustime = true;
|
||||
players[i].texttimer = 4*TICRATE;
|
||||
players[i].textvar = 1; // Time Bonus
|
||||
players[i].textvar = NTV_BONUSTIMESTART; // Time Bonus
|
||||
players[i].finishedtime = players[i].nightstime;
|
||||
if (!G_IsSpecialStage(gamemap))
|
||||
P_AddPlayerScore(&players[i], (players[i].finishedtime/TICRATE) * 100);
|
||||
|
@ -7090,12 +7097,12 @@ static void P_DoNiGHTSCapsule(player_t *player)
|
|||
{
|
||||
S_StartScreamSound(player->mo, sfx_lose);
|
||||
player->texttimer = 4*TICRATE;
|
||||
player->textvar = 3; // Get more rings!
|
||||
player->textvar = NTV_GETMORESPHERES; // Get more spheres/chips!
|
||||
player->capsule->reactiontime = 0;
|
||||
player->capsule->extravalue1 = player->capsule->cvmem =\
|
||||
player->capsule->cusval = player->capsule->movecount =\
|
||||
player->capsule->lastlook = player->capsule->extravalue2 = -1;
|
||||
P_RunNightsCapsuleTouchExecutors(player->mo, false, false); // run capsule exit executors, and we lacked rings
|
||||
P_RunNightsCapsuleTouchExecutors(player->mo, false, false); // run capsule exit executors, and we lacked spheres/chips
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12449,13 +12456,13 @@ void P_PlayerThink(player_t *player)
|
|||
if (player->texttimer)
|
||||
{
|
||||
--player->texttimer;
|
||||
if (!player->texttimer && !player->exiting && player->textvar >= 4)
|
||||
if (!player->texttimer && !player->exiting && (player->textvar == NTV_NONE || player->textvar == NTV_BONUSTIMEEND))
|
||||
{
|
||||
player->texttimer = 4*TICRATE;
|
||||
player->textvar = 2; // GET n RINGS!
|
||||
player->textvar = NTV_GETSPHERES; // GET n SPHERES/CHIPS!
|
||||
|
||||
if (!P_MobjWasRemoved(player->capsule) && player->capsule->health != player->capsule->spawnpoint->angle)
|
||||
player->textvar++; // GET n MORE RINGS!
|
||||
if (!P_MobjWasRemoved(player->capsule) && player->capsule->health != player->capsule->spawnpoint->args[1])
|
||||
player->textvar = NTV_GETMORESPHERES; // GET n MORE SPHERES/CHIPS!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -405,6 +405,8 @@ typedef enum
|
|||
SSF_ROPEHANG = 1<<18,
|
||||
SSF_JUMPFLIP = 1<<19,
|
||||
SSF_GRAVITYOVERRIDE = 1<<20, // combine with MSF_GRAVITYFLIP
|
||||
SSF_NOPHYSICSFLOOR = 1<<21,
|
||||
SSF_NOPHYSICSCEILING = 1<<22,
|
||||
} sectorspecialflags_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -2494,11 +2494,11 @@ static void Command_Tunes_f(void)
|
|||
track = (UINT16)atoi(COM_Argv(2))-1;
|
||||
|
||||
strncpy(mapmusname, tunearg, 7);
|
||||
mapmusname[6] = 0;
|
||||
|
||||
if (argc > 4)
|
||||
position = (UINT32)atoi(COM_Argv(4));
|
||||
|
||||
mapmusname[6] = 0;
|
||||
mapmusflags = (track & MUSIC_TRACKMASK);
|
||||
mapmusposition = position;
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Declare SDL2 interface sources
|
||||
|
||||
target_sources(SRB2SDL2 PRIVATE
|
||||
mixer_sound.c
|
||||
ogl_sdl.c
|
||||
i_threads.c
|
||||
i_net.c
|
||||
|
@ -13,6 +12,161 @@ target_sources(SRB2SDL2 PRIVATE
|
|||
hwsym_sdl.c
|
||||
)
|
||||
|
||||
# Compatibility flag with later versions of GCC
|
||||
# We should really fix our code to not need this
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
target_compile_options(SRB2SDL2 PRIVATE -mno-ms-bitfields)
|
||||
endif()
|
||||
|
||||
# Yes we know we use insecure CRT functions...
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -D_CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# Compiler warnings configuration
|
||||
target_compile_options(SRB2SDL2 PRIVATE
|
||||
# Using generator expressions to handle per-language compile options
|
||||
|
||||
# C, GNU
|
||||
# This is a direct translation from versions.mk
|
||||
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:GNU>>:
|
||||
-Wall
|
||||
-Wno-trigraphs
|
||||
-W # Was controlled by RELAXWARNINGS
|
||||
-pedantic
|
||||
-Wpedantic
|
||||
-Wfloat-equal
|
||||
-Wundef
|
||||
-Wpointer-arith
|
||||
-Wbad-function-cast
|
||||
-Wcast-qual
|
||||
-Wcast-align # Was controlled by NOCASTALIGNWARN
|
||||
-Wwrite-strings
|
||||
-Wsign-compare
|
||||
-Wmissing-prototypes
|
||||
-Wmissing-declarations
|
||||
-Wmissing-noreturn
|
||||
-Winline
|
||||
-Wformat-y2k
|
||||
-Wformat-security
|
||||
|
||||
$<$<VERSION_LESS:$<C_COMPILER_VERSION>,2.9.5>:
|
||||
-Wno-div-by-zero
|
||||
-Wendif-labels
|
||||
-Wdisabled-optimization
|
||||
>
|
||||
|
||||
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.0.0>:
|
||||
-Wold-style-definition
|
||||
-Wmissing-field-initializers
|
||||
>
|
||||
|
||||
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.1.0>:
|
||||
-Wshadow
|
||||
>
|
||||
|
||||
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.3.0>:
|
||||
-funit-at-a-time
|
||||
-Wlogical-op
|
||||
>
|
||||
|
||||
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.5.0>:
|
||||
-Wlogical-op
|
||||
-Wno-error=array-bounds
|
||||
>
|
||||
|
||||
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.6.0>:
|
||||
-Wno-suggest-attribute=noreturn
|
||||
-Wno-error=suggest-attribute=noreturn
|
||||
-Werror=vla
|
||||
>
|
||||
|
||||
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,5.4.0>:
|
||||
-Wno-logical-op
|
||||
-Wno-error=logical-op
|
||||
>
|
||||
|
||||
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,6.1.0>:
|
||||
-Wno-tautological-compare
|
||||
-Wno-error=tautological-compare
|
||||
>
|
||||
|
||||
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,7.1.0>:
|
||||
-Wno-error=format-overflow=2
|
||||
-Wimplicit-fallthrough=4
|
||||
>
|
||||
|
||||
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,8.1.0>:
|
||||
-Wno-error=format-overflow
|
||||
-Wno-error=stringop-truncation
|
||||
-Wno-error=stringop-overflow
|
||||
-Wno-format-overflow
|
||||
-Wno-stringop-truncation
|
||||
-Wno-stringop-overflow
|
||||
-Wno-error=multistatement-macros
|
||||
>
|
||||
|
||||
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,9.1.0>:
|
||||
-Wno-error=address-of-packed-member
|
||||
>
|
||||
>
|
||||
|
||||
# C, Clang and Apple Clang
|
||||
$<$<AND:$<COMPILE_LANGUAGE:C>,$<OR:$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>:
|
||||
-Wall
|
||||
-Wno-absolute-value
|
||||
-Wno-trigraphs
|
||||
-Wno-error=non-literal-null-conversion
|
||||
-Wno-error=constant-conversion
|
||||
-Wno-unused-but-set-variable
|
||||
-Wno-error=unused-but-set-variable
|
||||
-Wno-shorten-64-to-32
|
||||
>
|
||||
|
||||
# C, MSVC
|
||||
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:MSVC>>:
|
||||
# All warnings at and before Visual Studio 2019 RTM
|
||||
# https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-by-compiler-version?view=msvc-170
|
||||
/Wv:19.20.27004.0
|
||||
>
|
||||
|
||||
# C++, GNU, Clang and Apple Clang
|
||||
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>:
|
||||
-Wall
|
||||
-Wno-unused-function
|
||||
-Wno-unused-but-set-variable
|
||||
-Wno-unused-private-field
|
||||
>
|
||||
|
||||
# C++, MSVC
|
||||
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<C_COMPILER_ID:MSVC>>:
|
||||
/Wv:19.20.27004.0
|
||||
>
|
||||
|
||||
# GNU
|
||||
$<$<C_COMPILER_ID:GNU>:
|
||||
-fmax-errors=5
|
||||
>
|
||||
)
|
||||
if(SRB2_CONFIG_ERRORMODE)
|
||||
target_compile_options(SRB2SDL2 PRIVATE
|
||||
$<$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>:
|
||||
-Werror
|
||||
>
|
||||
|
||||
$<$<C_COMPILER_ID:MSVC>:
|
||||
/WX
|
||||
>
|
||||
)
|
||||
endif()
|
||||
|
||||
# Link warnings configuration
|
||||
target_link_options(SRB2SDL2 PRIVATE
|
||||
$<$<C_COMPILER_ID:GNU>:
|
||||
# -Wl,--as-needed - Was controlled by NOLDWARNING
|
||||
>
|
||||
)
|
||||
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
|
||||
target_sources(SRB2SDL2 PRIVATE
|
||||
../win32/win_dbg.c
|
||||
|
@ -62,12 +216,6 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
|
|||
target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2main)
|
||||
endif()
|
||||
|
||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
|
||||
target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2-static SDL2_mixer::SDL2_mixer-static)
|
||||
else()
|
||||
target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2 SDL2_mixer::SDL2_mixer)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Linux)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE m rt)
|
||||
endif()
|
||||
|
@ -81,8 +229,84 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
|
|||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
|
||||
find_package(SDL2 CONFIG REQUIRED)
|
||||
find_package(SDL2 REQUIRED)
|
||||
if(TARGET SDL2main)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE SDL2main)
|
||||
endif()
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DDIRECTFULLSCREEN -DHAVE_SDL)
|
||||
target_include_directories(SRB2SDL2 PRIVATE ${SDL2_INCLUDE_DIR})
|
||||
|
||||
find_package(SDL2_mixer_ext CONFIG QUIET)
|
||||
find_package(SDL2_mixer_ext QUIET)
|
||||
if(TARGET SDL2_mixer_ext::SDL2_mixer_ext OR TARGET SDL2_mixer_ext::SDL2_mixer_ext_Static OR TARGET SDL2_mixer_ext OR TARGET SDL2_mixer_ext_Static)
|
||||
if(NOT TARGET SDL2_mixer_ext::SDL2_mixer_ext_Static AND TARGET SDL2_mixer_ext_Static)
|
||||
add_library(SDL2_mixer_ext::SDL2_mixer_ext_Static ALIAS SDL2_mixer_ext_Static)
|
||||
endif()
|
||||
if(NOT TARGET SDL2_mixer_ext::SDL2_mixer_ext AND TARGET SDL2_mixer_ext)
|
||||
add_library(SDL2_mixer_ext::SDL2_mixer_ext ALIAS SDL2_mixer_ext)
|
||||
endif()
|
||||
if(TARGET SDL2_mixer_ext::SDL2_mixer_ext OR TARGET SDL2_mixer_ext::SDL2_mixer_ext_Static)
|
||||
if(TARGET SDL2_mixer_ext::SDL2_mixer_ext_Static)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE SDL2_mixer_ext::SDL2_mixer_ext_Static)
|
||||
else()
|
||||
target_link_libraries(SRB2SDL2 PRIVATE SDL2_mixer_ext::SDL2_mixer_ext)
|
||||
endif()
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DHAVE_MIXERX -DSOUND=SOUND_MIXER)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(TARGET SDL2_mixer_ext::SDL2_mixer_ext OR TARGET SDL2_mixer_ext::SDL2_mixer_ext_Static)
|
||||
message(STATUS "SDL2_mixer_ext found, skipping SDL2_mixer")
|
||||
else()
|
||||
message(STATUS "SDL2_mixer_ext not found, going to try SDL2_mixer")
|
||||
find_package(SDL2_mixer CONFIG QUIET)
|
||||
find_package(SDL2_mixer QUIET)
|
||||
if(TARGET SDL2_mixer::SDL2_mixer OR TARGET SDL2_mixer::SDL2_mixer-static OR TARGET SDL2_mixer OR TARGET SDL2_mixer_Static)
|
||||
if(NOT TARGET SDL2_mixer::SDL2_mixer-static AND TARGET SDL2_mixer_Static)
|
||||
add_library(SDL2_mixer::SDL2_mixer-static ALIAS SDL2_mixer_Static)
|
||||
endif()
|
||||
if(NOT TARGET SDL2_mixer::SDL2_mixer AND TARGET SDL2_mixer)
|
||||
add_library(SDL2_mixer::SDL2_mixer ALIAS SDL2_mixer)
|
||||
endif()
|
||||
if(TARGET SDL2_mixer::SDL2_mixer OR TARGET SDL2_mixer::SDL2_mixer-static)
|
||||
if(TARGET SDL2_mixer::SDL2_mixer-static)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE SDL2_mixer::SDL2_mixer-static)
|
||||
else()
|
||||
target_link_libraries(SRB2SDL2 PRIVATE SDL2_mixer::SDL2_mixer)
|
||||
endif()
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(TARGET SDL2_mixer_ext::SDL2_mixer_ext OR TARGET SDL2_mixer_ext::SDL2_mixer_ext_Static OR TARGET SDL2_mixer::SDL2_mixer OR TARGET SDL2_mixer::SDL2_mixer-static)
|
||||
target_sources(SRB2SDL2 PRIVATE mixer_sound.c)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2)
|
||||
else()
|
||||
target_sources(SRB2SDL2 PRIVATE sdl_sound.c)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2)
|
||||
endif()
|
||||
|
||||
if(TARGET SDL2::SDL2)
|
||||
message(STATUS "SDL2 Found")
|
||||
else()
|
||||
message(STATUS "no SDL2 Found")
|
||||
endif()
|
||||
|
||||
if(TARGET SDL2::SDL2main)
|
||||
message(STATUS "SDL2main Found")
|
||||
else()
|
||||
message(STATUS "No SDL2main Found")
|
||||
endif()
|
||||
|
||||
if(TARGET SDL2_mixer_ext::SDL2_mixer_ext OR TARGET SDL2_mixer_ext::SDL2_mixer_ext_Static)
|
||||
message(STATUS "SDL2_mixer_ext Found")
|
||||
elseif(TARGET SDL2_mixer::SDL2_mixer OR TARGET SDL2_mixer::SDL2_mixer-static)
|
||||
message(STATUS "SDL2_mixer found")
|
||||
else()
|
||||
message(STATUS "no SDL2_mixer_ext or SDL2_mixer Found")
|
||||
endif()
|
||||
|
||||
#### Installation ####
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
|
||||
|
|
|
@ -2305,7 +2305,7 @@ void I_SleepDuration(precise_t duration)
|
|||
int status;
|
||||
do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts);
|
||||
while (status == EINTR);
|
||||
#else
|
||||
#elif defined (MIN_SLEEP_DURATION_MS)
|
||||
UINT64 precision = I_GetPrecisePrecision();
|
||||
INT32 sleepvalue = cv_sleep.value;
|
||||
UINT64 delaygranularity;
|
||||
|
|
|
@ -1755,22 +1755,23 @@ static void ST_drawNightsRecords(void)
|
|||
|
||||
switch (stplyr->textvar)
|
||||
{
|
||||
case 1: // A "Bonus Time Start" by any other name...
|
||||
case NTV_BONUSTIMESTART: // A "Bonus Time Start" by any other name...
|
||||
{
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 52, V_GREENMAP|aflag, M_GetText("GET TO THE GOAL!"));
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 60, aflag, M_GetText("SCORE MULTIPLIER START!"));
|
||||
|
||||
if (stplyr->finishedtime)
|
||||
{
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 140, aflag, "TIME:");
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 148, aflag, "BONUS:");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 140, V_ORANGEMAP|aflag, va("%d", (stplyr->startedtime - stplyr->finishedtime)/TICRATE));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 148, V_ORANGEMAP|aflag, va("%d", (stplyr->finishedtime/TICRATE) * 100));
|
||||
tic_t maretime = stplyr->startedtime - stplyr->finishedtime;
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 140, V_YELLOWMAP|aflag, "TIME:");
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 148, V_YELLOWMAP|aflag, "BONUS:");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 140, aflag, va("%i:%02i.%02i", G_TicsToMinutes(maretime,true), G_TicsToSeconds(maretime), G_TicsToCentiseconds(maretime)));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 148, aflag, va("%d", (stplyr->finishedtime/TICRATE) * 100));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // Get n Spheres
|
||||
case 3: // Get n more Spheres
|
||||
case NTV_GETSPHERES: // Get n Spheres
|
||||
case NTV_GETMORESPHERES: // Get n more Spheres
|
||||
{
|
||||
if (!stplyr->capsule)
|
||||
return;
|
||||
|
@ -1778,31 +1779,37 @@ static void ST_drawNightsRecords(void)
|
|||
// Yes, this string is an abomination.
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 60, aflag,
|
||||
va(M_GetText("\x80GET\x82 %d\x80 %s%s%s!"), stplyr->capsule->health,
|
||||
(stplyr->textvar == 3) ? M_GetText("MORE ") : "",
|
||||
(stplyr->textvar == NTV_GETMORESPHERES) ? M_GetText("MORE ") : "",
|
||||
(G_IsSpecialStage(gamemap)) ? "SPHERE" : "CHIP",
|
||||
(stplyr->capsule->health > 1) ? "S" : ""));
|
||||
break;
|
||||
}
|
||||
case 4: // End Bonus
|
||||
case NTV_BONUSTIMEEND: // End Bonus
|
||||
{
|
||||
V_DrawString(BASEVIDWIDTH/2 - 56, 140, aflag, (G_IsSpecialStage(gamemap)) ? "SPHERES:" : "CHIPS:");
|
||||
V_DrawString(BASEVIDWIDTH/2 - 56, 148, aflag, "BONUS:");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 56, 140, V_ORANGEMAP|aflag, va("%d", stplyr->finishedspheres));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 56, 148, V_ORANGEMAP|aflag, va("%d", stplyr->finishedspheres * 50));
|
||||
ST_DrawNightsOverlayNum((BASEVIDWIDTH/2 + 56)<<FRACBITS, 160<<FRACBITS, FRACUNIT, aflag, stplyr->lastmarescore, nightsnum, SKINCOLOR_AZURE);
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 132, V_YELLOWMAP|aflag, "TIME:");
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 140, V_YELLOWMAP|aflag, (G_IsSpecialStage(gamemap)) ? "SPHERES:" : "CHIPS:");
|
||||
V_DrawString(BASEVIDWIDTH/2 - 48, 148, V_YELLOWMAP|aflag, "BONUS:");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 132, aflag, va("%i:%02i.%02i", G_TicsToMinutes(stplyr->lastmaretime,true), G_TicsToSeconds(stplyr->lastmaretime), G_TicsToCentiseconds(stplyr->lastmaretime)));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 140, aflag, va("%d", stplyr->finishedspheres));
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 148, aflag, va("%d", stplyr->finishedspheres * 50));
|
||||
ST_DrawNightsOverlayNum((BASEVIDWIDTH/2 + 48)<<FRACBITS, 160<<FRACBITS, FRACUNIT, aflag, stplyr->lastmarescore, nightsnum, SKINCOLOR_AZURE);
|
||||
|
||||
// If this is a multi-mare map, display the mare number.
|
||||
if (stplyr->lastmare || P_FindLowestMare() < UINT8_MAX)
|
||||
V_DrawLevelActNum(BASEVIDWIDTH/2 - 80, 128 + 3, aflag, stplyr->lastmare + 1);
|
||||
|
||||
// If new record, say so!
|
||||
if (!(netgame || multiplayer) && G_GetBestNightsScore(gamemap, stplyr->lastmare + 1, clientGamedata) <= stplyr->lastmarescore)
|
||||
{
|
||||
if (stplyr->texttimer & 16)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 184, V_YELLOWMAP|aflag, "* NEW RECORD *");
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, 184, aflag, "\x85* \x82NEW RECORD \x85*\x80");
|
||||
}
|
||||
|
||||
if (P_HasGrades(gamemap, stplyr->lastmare + 1))
|
||||
{
|
||||
UINT8 grade = P_GetGrade(stplyr->lastmarescore, gamemap, stplyr->lastmare);
|
||||
if (modeattacking || grade >= GRADE_A)
|
||||
V_DrawTranslucentPatch(BASEVIDWIDTH/2 + 60, 160, aflag, ngradeletters[grade]);
|
||||
if (modeattacking || !G_IsSpecialStage(gamemap) || grade >= GRADE_A)
|
||||
V_DrawTranslucentPatch(BASEVIDWIDTH/2 + 60, 128, aflag, ngradeletters[grade]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1912,7 +1919,7 @@ static void ST_drawNiGHTSHUD(void)
|
|||
// Link drawing
|
||||
if (!oldspecialstage
|
||||
// Don't display when the score is showing (it popping up for a split second when exiting a map is intentional)
|
||||
&& !(stplyr->texttimer && stplyr->textvar == 4)
|
||||
&& !(stplyr->texttimer && stplyr->textvar == NTV_BONUSTIMEEND)
|
||||
&& LUA_HudEnabled(hud_nightslink)
|
||||
&& ((cv_debug & DBG_NIGHTSBASIC) || stplyr->linkcount > 1)) // When debugging, show "0 Link".
|
||||
{
|
||||
|
@ -1959,7 +1966,7 @@ static void ST_drawNiGHTSHUD(void)
|
|||
INT32 amount;
|
||||
const INT32 length = 88;
|
||||
|
||||
origamount = stplyr->capsule->spawnpoint->angle;
|
||||
origamount = stplyr->capsule->spawnpoint->args[1];
|
||||
I_Assert(origamount > 0); // should not happen now
|
||||
|
||||
ST_DrawTopLeftOverlayPatch(72, 8, nbracket);
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
target_sources(srb2tests PRIVATE
|
||||
boolcompat.cpp
|
||||
)
|
|
@ -1,8 +0,0 @@
|
|||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "../doomtype.h"
|
||||
|
||||
TEST_CASE("C++ bool is convertible to doomtype.h boolean") {
|
||||
REQUIRE(static_cast<boolean>(true) == 1);
|
||||
REQUIRE(static_cast<boolean>(false) == 0);
|
||||
}
|
26
thirdparty/00-SDL-Mixer-X-2.6.0-DISABLE_INSTALL.patch
vendored
Normal file
26
thirdparty/00-SDL-Mixer-X-2.6.0-DISABLE_INSTALL.patch
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
--- a/CMakeLists.txt 2023-11-22 22:42:53.000000000 -0500
|
||||
+++ b/CMakeLists.txt 2024-02-15 18:46:57.852076200 -0500
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
option(SDL_MIXER_X_STATIC "Build static library of SDL Mixer X" ${SDL_MIXER_X_STATIC_ENABLED_BY_DEFAULT})
|
||||
option(SDL_MIXER_X_SHARED "Build shared library of SDL Mixer X" ${SDL_MIXER_X_SHARED_ENABLED_BY_DEFAULT})
|
||||
+ option(SDL_MIXER_X_DISABLE_INSTALL "Disable install of SDL Mixer X" OFF)
|
||||
else()
|
||||
set(SDL_MIXER_X_STATIC ON)
|
||||
set(SDL_MIXER_X_SHARED OFF)
|
||||
@@ -475,6 +476,7 @@
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
+if(NOT SDL_MIXER_X_DISABLE_INSTALL)
|
||||
if(SDL_MIXER_X_STATIC AND NOT BUILD_AS_VB6_BINDING)
|
||||
install(TARGETS SDL2_mixer_ext_Static
|
||||
EXPORT SDL2MixerExtStaticTargets
|
||||
@@ -500,6 +502,7 @@
|
||||
NAMESPACE SDL2_mixer_ext::
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/SDL2_mixer_ext")
|
||||
endif()
|
||||
+endif()
|
||||
|
||||
|
||||
if(BUILD_AS_VB6_BINDING)
|
23
thirdparty/CMakeLists.txt
vendored
23
thirdparty/CMakeLists.txt
vendored
|
@ -1,23 +1,2 @@
|
|||
macro(export)
|
||||
endmacro()
|
||||
|
||||
if(SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES)
|
||||
set(SRB2_INTERNAL_LIBRARY_TYPE SHARED)
|
||||
set(NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES OFF)
|
||||
else()
|
||||
set(SRB2_INTERNAL_LIBRARY_TYPE STATIC)
|
||||
set(NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES ON)
|
||||
endif()
|
||||
|
||||
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
|
||||
include("cpm-sdl2.cmake")
|
||||
include("cpm-sdl2-mixer.cmake")
|
||||
include("cpm-zlib.cmake")
|
||||
include("cpm-png.cmake")
|
||||
include("cpm-curl.cmake")
|
||||
include("cpm-openmpt.cmake")
|
||||
endif()
|
||||
|
||||
if("${SRB2_CONFIG_USE_GME}")
|
||||
include("cpm-libgme.cmake")
|
||||
endif()
|
||||
include("Ccache.cmake")
|
||||
|
|
15
thirdparty/Ccache.cmake
vendored
Normal file
15
thirdparty/Ccache.cmake
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Enable CCache
|
||||
# (Set USE_CCACHE=ON to use, CCACHE_OPTIONS for options)
|
||||
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL Windows)
|
||||
option(USE_CCACHE "Enable ccache support" OFF)
|
||||
|
||||
if(USE_CCACHE)
|
||||
find_program(CCACHE_TOOL_PATH ccache)
|
||||
if(CCACHE_TOOL_PATH)
|
||||
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
|
||||
else()
|
||||
message(WARNING "USE_CCACHE was set but ccache is not found (set CCACHE_TOOL_PATH)")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
16
thirdparty/cpm-libgme.cmake
vendored
16
thirdparty/cpm-libgme.cmake
vendored
|
@ -1,16 +0,0 @@
|
|||
CPMAddPackage(
|
||||
NAME libgme
|
||||
VERSION 0.6.3
|
||||
URL "https://bitbucket.org/mpyne/game-music-emu/get/e76bdc0cb916e79aa540290e6edd0c445879d3ba.zip"
|
||||
EXCLUDE_FROM_ALL ON
|
||||
OPTIONS
|
||||
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||
"ENABLE_UBSAN OFF"
|
||||
"GME_YM2612_EMU MAME"
|
||||
)
|
||||
|
||||
if(libgme_ADDED)
|
||||
target_compile_features(gme PRIVATE cxx_std_11)
|
||||
# libgme's CMakeLists.txt already links this
|
||||
#target_link_libraries(gme PRIVATE ZLIB::ZLIB)
|
||||
endif()
|
69
thirdparty/cpm-png.cmake
vendored
69
thirdparty/cpm-png.cmake
vendored
|
@ -1,69 +0,0 @@
|
|||
CPMAddPackage(
|
||||
NAME png
|
||||
VERSION 1.6.38
|
||||
URL "https://github.com/glennrp/libpng/archive/refs/tags/v1.6.38.zip"
|
||||
# png cmake build is broken on msys/mingw32
|
||||
DOWNLOAD_ONLY YES
|
||||
)
|
||||
|
||||
if(png_ADDED)
|
||||
# Since png's cmake build is broken, we're going to create a target manually
|
||||
set(
|
||||
PNG_SOURCES
|
||||
png.h
|
||||
pngconf.h
|
||||
pngpriv.h
|
||||
pngdebug.h
|
||||
pnginfo.h
|
||||
pngstruct.h
|
||||
png.c
|
||||
pngerror.c
|
||||
pngget.c
|
||||
pngmem.c
|
||||
pngpread.c
|
||||
pngread.c
|
||||
pngrio.c
|
||||
pngrtran.c
|
||||
pngrutil.c
|
||||
pngset.c
|
||||
pngtrans.c
|
||||
pngwio.c
|
||||
pngwrite.c
|
||||
pngwtran.c
|
||||
pngwutil.c
|
||||
)
|
||||
list(TRANSFORM PNG_SOURCES PREPEND "${png_SOURCE_DIR}/")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT "${png_BINARY_DIR}/include/png.h" "${png_BINARY_DIR}/include/pngconf.h"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${png_SOURCE_DIR}/png.h" "${png_SOURCE_DIR}/pngconf.h" "${png_BINARY_DIR}/include"
|
||||
DEPENDS "${png_SOURCE_DIR}/png.h" "${png_SOURCE_DIR}/pngconf.h"
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT "${png_BINARY_DIR}/include/pnglibconf.h"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy "${png_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt" "${png_BINARY_DIR}/include/pnglibconf.h"
|
||||
DEPENDS "${png_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt"
|
||||
VERBATIM
|
||||
)
|
||||
list(
|
||||
APPEND PNG_SOURCES
|
||||
"${png_BINARY_DIR}/include/png.h"
|
||||
"${png_BINARY_DIR}/include/pngconf.h"
|
||||
"${png_BINARY_DIR}/include/pnglibconf.h"
|
||||
)
|
||||
add_library(png "${SRB2_INTERNAL_LIBRARY_TYPE}" ${PNG_SOURCES})
|
||||
|
||||
# Disable ARM NEON since having it automatic breaks libpng external build on clang for some reason
|
||||
target_compile_definitions(png PRIVATE -DPNG_ARM_NEON_OPT=0)
|
||||
|
||||
# The png includes need to be available to consumers
|
||||
target_include_directories(png PUBLIC "${png_BINARY_DIR}/include")
|
||||
|
||||
# ... and these also need to be present only for png build
|
||||
target_include_directories(png PRIVATE "${ZLIB_SOURCE_DIR}")
|
||||
target_include_directories(png PRIVATE "${ZLIB_BINARY_DIR}")
|
||||
target_include_directories(png PRIVATE "${png_BINARY_DIR}")
|
||||
target_link_libraries(png PRIVATE ZLIB::ZLIB)
|
||||
add_library(PNG::PNG ALIAS png)
|
||||
endif()
|
22
thirdparty/cpm-sdl2-mixer.cmake
vendored
22
thirdparty/cpm-sdl2-mixer.cmake
vendored
|
@ -1,22 +0,0 @@
|
|||
CPMAddPackage(
|
||||
NAME SDL2_mixer
|
||||
VERSION 2.6.2
|
||||
URL "https://github.com/libsdl-org/SDL_mixer/archive/refs/tags/release-2.6.2.zip"
|
||||
EXCLUDE_FROM_ALL ON
|
||||
OPTIONS
|
||||
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||
"SDL2MIXER_INSTALL OFF"
|
||||
"SDL2MIXER_DEPS_SHARED OFF"
|
||||
"SDL2MIXER_SAMPLES OFF"
|
||||
"SDL2MIXER_VENDORED ON"
|
||||
"SDL2MIXER_FLAC ON"
|
||||
"SDL2MIXER_FLAC_LIBFLAC OFF"
|
||||
"SDL2MIXER_FLAC_DRFLAC ON"
|
||||
"SDL2MIXER_MOD OFF"
|
||||
"SDL2MIXER_MP3 ON"
|
||||
"SDL2MIXER_MP3_DRMP3 ON"
|
||||
"SDL2MIXER_MIDI ON"
|
||||
"SDL2MIXER_OPUS OFF"
|
||||
"SDL2MIXER_VORBIS STB"
|
||||
"SDL2MIXER_WAVE ON"
|
||||
)
|
28
thirdparty/cpm-sdl2.cmake
vendored
28
thirdparty/cpm-sdl2.cmake
vendored
|
@ -1,28 +0,0 @@
|
|||
set(
|
||||
internal_sdl2_options
|
||||
|
||||
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||
"SDL_SHARED ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||
"SDL_STATIC ${NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||
"SDL_TEST OFF"
|
||||
"SDL2_DISABLE_INSTALL ON"
|
||||
)
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
list(APPEND internal_sdl2_options "SDL2_DISABLE_SDL2MAIN OFF")
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||
list(APPEND internal_sdl2_options "SDL2_DISABLE_SDL2MAIN OFF")
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM} MATCHES Linux)
|
||||
list(APPEND internal_sdl2_options "SDL2_DISABLE_SDL2MAIN ON")
|
||||
endif()
|
||||
|
||||
CPMAddPackage(
|
||||
NAME SDL2
|
||||
VERSION 2.28.5
|
||||
GITHUB_REPOSITORY "libsdl-org/SDL"
|
||||
GIT_TAG release-2.28.5
|
||||
EXCLUDE_FROM_ALL ON
|
||||
OPTIONS ${internal_sdl2_options}
|
||||
)
|
18
thirdparty/cpm-zlib.cmake
vendored
18
thirdparty/cpm-zlib.cmake
vendored
|
@ -1,18 +0,0 @@
|
|||
CPMAddPackage(
|
||||
NAME zlib
|
||||
VERSION 1.3.1
|
||||
GITHUB_REPOSITORY "madler/zlib"
|
||||
GIT_TAG v1.3.1
|
||||
EXCLUDE_FROM_ALL
|
||||
OPTIONS
|
||||
"ZLIB_BUILD_EXAMPLES OFF"
|
||||
)
|
||||
|
||||
if(zlib_ADDED)
|
||||
if(SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES)
|
||||
add_library(ZLIB::ZLIB ALIAS zlib)
|
||||
endif()
|
||||
if(NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES)
|
||||
add_library(ZLIB::ZLIB ALIAS zlibstatic)
|
||||
endif()
|
||||
endif()
|
|
@ -1,8 +1,16 @@
|
|||
if(TARGET CURL::libcurl)
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Third-party: creating target 'CURL::libcurl'")
|
||||
|
||||
set(CURL_ENABLE_EXPORT_TARGET OFF CACHE BOOL "" FORCE)
|
||||
|
||||
set(
|
||||
internal_curl_options
|
||||
|
||||
"BUILD_CURL_EXE OFF"
|
||||
"BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||
"BUILD_SHARED_LIBS OFF"
|
||||
"CURL_DISABLE_TESTS ON"
|
||||
"HTTP_ONLY ON"
|
||||
"CURL_DISABLE_CRYPTO_AUTH ON"
|
||||
|
@ -26,10 +34,25 @@ if(${CMAKE_SYSTEM} MATCHES Linux)
|
|||
list(APPEND internal_curl_options "CURL_USE_OPENSSL ON")
|
||||
endif()
|
||||
|
||||
CPMAddPackage(
|
||||
NAME curl
|
||||
VERSION 7.86.0
|
||||
URL "https://github.com/curl/curl/archive/refs/tags/curl-7_86_0.zip"
|
||||
EXCLUDE_FROM_ALL ON
|
||||
OPTIONS ${internal_curl_options}
|
||||
)
|
||||
include(FetchContent)
|
||||
|
||||
if (CURL_USE_THIRDPARTY)
|
||||
FetchContent_Declare(
|
||||
curl
|
||||
VERSION 7.88.1
|
||||
GITHUB_REPOSITORY "curl/curl"
|
||||
GIT_TAG curl-7_88_1
|
||||
EXCLUDE_FROM_ALL ON
|
||||
OPTIONS ${internal_curl_options}
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
curl
|
||||
SOURCE_DIR "${CMAKE_SOURCE_DIR}/thirdparty/curl/"
|
||||
EXCLUDE_FROM_ALL ON
|
||||
OPTIONS ${internal_curl_options}
|
||||
)
|
||||
endif()
|
||||
|
||||
FetchContent_MakeAvailable(curl)
|
||||
|
38
thirdparty/libapng.cmake
vendored
Normal file
38
thirdparty/libapng.cmake
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
if(TARGET libapng_static)
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Third-party: creating target 'libapng_static'")
|
||||
|
||||
set(PNG_SHARED OFF CACHE BOOL "" FORCE)
|
||||
set(PNG_BUILD_ZLIB ON CACHE BOOL "" FORCE)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
libapng-local
|
||||
SOURCE_DIR "${CMAKE_SOURCE_DIR}/thirdparty/libapng/"
|
||||
EXCLUDE_FROM_ALL ON
|
||||
DOWNLOAD_ONLY YES
|
||||
OPTION
|
||||
"PNG_SHARED OFF"
|
||||
"PNG_EXECUTABLES OFF"
|
||||
"PNG_TESTS OFF"
|
||||
"PNG_BUILD_ZLIB ON"
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(libapng-local)
|
||||
|
||||
#add_custom_command(
|
||||
#OUTPUT ${libapng-local_BINARY_DIR}/CMakeLists.txt
|
||||
#COMMAND ${CMAKE_COMMAND}
|
||||
# -Din_file:FILEPATH=${libapng-locall_SOURCE_DIR}/CMakeLists.txt
|
||||
# -Dpatch_file:FILEPATH=${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/00-libapng-ZLIB.patch
|
||||
# -Dout_file:FILEPATH=${libapng-local_BINARY_DIR}/CMakeLists.txt
|
||||
# -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/PatchFile.cmake
|
||||
#DEPENDS ${libapng-local_SOURCE_DIR}/CMakeLists.txt
|
||||
#)
|
||||
|
||||
set(libapng_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/libapng" "${libapng_BINARY_DIR}" CACHE PATH "" FORCE)
|
||||
|
||||
set(libapng_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/libapng/png.h" "${CMAKE_CURRENT_SOURCE_DIR}/libapng/pngconf.h" CACHE PATH "" FORCE)
|
|
@ -1,13 +1,33 @@
|
|||
CPMAddPackage(
|
||||
NAME openmpt
|
||||
VERSION 0.4.30
|
||||
URL "https://github.com/OpenMPT/openmpt/archive/refs/tags/libopenmpt-0.4.30.zip"
|
||||
DOWNLOAD_ONLY ON
|
||||
)
|
||||
if(TARGET libopenmpt)
|
||||
#return()
|
||||
endif()
|
||||
|
||||
if(openmpt_ADDED)
|
||||
message(STATUS "Third-party: creating target 'libopenmpt'")
|
||||
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
if (libopenmpt_USE_THIRDPARTY)
|
||||
FetchContent_Declare(
|
||||
libopenmpt-local
|
||||
GITHUB_REPOSITORY openmpt
|
||||
GIT_TAG libopenmpt-0.4.38
|
||||
version 0.4.38
|
||||
EXCLUDE_FROM_ALL ON
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
libopenmpt-local
|
||||
SOURCE_DIR "${CMAKE_SOURCE_DIR}/thirdparty/libopenmpt/"
|
||||
EXCLUDE_FROM_ALL ON
|
||||
)
|
||||
endif()
|
||||
|
||||
FetchContent_MakeAvailable(libopenmpt)
|
||||
|
||||
if(aaaa-libopenmpt-local_ADDED)
|
||||
set(
|
||||
openmpt_SOURCES
|
||||
libopenmpt-local_SOURCES
|
||||
|
||||
# minimp3
|
||||
# -DMPT_WITH_MINIMP3
|
||||
|
@ -264,26 +284,26 @@ if(openmpt_ADDED)
|
|||
libopenmpt/libopenmpt_impl.cpp
|
||||
libopenmpt/libopenmpt_ext_impl.cpp
|
||||
)
|
||||
list(TRANSFORM openmpt_SOURCES PREPEND "${openmpt_SOURCE_DIR}/")
|
||||
list(TRANSFORM libopenmpt-local_SOURCES PREPEND "${libopenmpt-local_SOURCE_DIR}/")
|
||||
|
||||
# -DLIBOPENMPT_BUILD
|
||||
configure_file("openmpt_svn_version.h" "svn_version.h")
|
||||
add_library(openmpt "${SRB2_INTERNAL_LIBRARY_TYPE}" ${openmpt_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/svn_version.h)
|
||||
add_library(libopenmpt STATIC ${libopenmpt-local_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/svn_version.h)
|
||||
if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU OR "${CMAKE_C_COMPILER_ID}" STREQUAL Clang OR "${CMAKE_C_COMPILER_ID}" STREQUAL AppleClang)
|
||||
target_compile_options(openmpt PRIVATE "-g0")
|
||||
target_compile_options(libopenmpt PRIVATE "-g0")
|
||||
endif()
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL Windows AND "${CMAKE_C_COMPILER_ID}" STREQUAL MSVC)
|
||||
target_link_libraries(openmpt PRIVATE Rpcrt4)
|
||||
target_link_libraries(libopenmpt PRIVATE Rpcrt4)
|
||||
endif()
|
||||
target_compile_features(openmpt PRIVATE cxx_std_11)
|
||||
target_compile_definitions(openmpt PRIVATE -DLIBOPENMPT_BUILD)
|
||||
target_compile_features(libopenmpt PRIVATE cxx_std_11)
|
||||
target_compile_definitions(libopenmpt PRIVATE -DLIBOPENMPT_BUILD)
|
||||
|
||||
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}/common")
|
||||
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}/src")
|
||||
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}/include")
|
||||
target_include_directories(openmpt PRIVATE "${openmpt_SOURCE_DIR}")
|
||||
target_include_directories(openmpt PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
target_include_directories(libopenmpt PRIVATE "${libopenmpt-local_SOURCE_DIR}/common")
|
||||
target_include_directories(libopenmpt PRIVATE "${libopenmpt-local_SOURCE_DIR}/src")
|
||||
target_include_directories(libopenmpt PRIVATE "${libopenmpt-local_SOURCE_DIR}/include")
|
||||
target_include_directories(libopenmpt PRIVATE "${libopenmpt-local_SOURCE_DIR}")
|
||||
target_include_directories(libopenmpt PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
# I wish this wasn't necessary, but it is
|
||||
target_include_directories(openmpt PUBLIC "${openmpt_SOURCE_DIR}")
|
||||
target_include_directories(libopenmpt PUBLIC "${libopenmpt-local_SOURCE_DIR}")
|
||||
endif()
|
1728
thirdparty/libpng-1.6.40-apng.patch
vendored
Normal file
1728
thirdparty/libpng-1.6.40-apng.patch
vendored
Normal file
File diff suppressed because it is too large
Load diff
10
thirdparty/openmpt_svn_version.h
vendored
10
thirdparty/openmpt_svn_version.h
vendored
|
@ -1,10 +0,0 @@
|
|||
|
||||
#pragma once
|
||||
#define OPENMPT_VERSION_SVNVERSION "17963"
|
||||
#define OPENMPT_VERSION_REVISION 17963
|
||||
#define OPENMPT_VERSION_DIRTY 0
|
||||
#define OPENMPT_VERSION_MIXEDREVISIONS 0
|
||||
#define OPENMPT_VERSION_URL "https://source.openmpt.org/svn/openmpt/tags/libopenmpt-0.4.32"
|
||||
#define OPENMPT_VERSION_DATE "2022-09-25T14:19:05.052596Z"
|
||||
#define OPENMPT_VERSION_IS_PACKAGE 1
|
||||
|
39
thirdparty/sdl2-mixer-ext.cmake
vendored
Normal file
39
thirdparty/sdl2-mixer-ext.cmake
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
if(TARGET SDL2_mixer_ext_Static)
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Third-party: creating target 'SDL2_mixer_ext::SDL2_mixer_ext'")
|
||||
|
||||
set(SDL_MIXER_X_SHARED ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES} CACHE BOOL "" FORCE)
|
||||
set(SDL_MIXER_X_STATIC ${NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES} CACHE BOOL "" FORCE)
|
||||
set(SDL_MIXER_X_DISABLE_INSTALL ON CACHE BOOL "" FORCE)
|
||||
set(USE_SYSTEM_SDL2 ON CACHE BOOL "" FORCE)
|
||||
set(SDL2_INCLUDE_PATH ${SDL2_INCLUDE_DIR} CACHE PATH "" FORCE)
|
||||
set(USE_XMP OFF CACHE PATH "" FORCE)
|
||||
|
||||
set(
|
||||
internal_SDL2_mixer_ext_options
|
||||
"SDL_MIXER_X_SHARED ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||
"SDL_MIXER_X_STATIC ${NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}"
|
||||
"SDL_MIXER_X_DISABLE_INSTALL ON"
|
||||
"USE_SYSTEM_SDL2 ON"
|
||||
"USE_XMP OFF"
|
||||
)
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
#list(APPEND internal_SDL2_mixer_ext_options "DOWNLOAD_AUDIO_CODECS_DEPENDENCY ON")
|
||||
#set(DOWNLOAD_AUDIO_CODECS_DEPENDENCY ON CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
|
||||
FetchContent_Declare(
|
||||
SDL2_mixer_ext
|
||||
OPTIONS ${internal_SDL2_mixer_ext_options}
|
||||
GIT_TAG "2.6.0-1"
|
||||
GIT_REPOSITORY "https://github.com/STJr/SDL-Mixer-X.git"
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(SDL2_mixer_ext)
|
||||
|
61
thirdparty/sdl2.cmake
vendored
Normal file
61
thirdparty/sdl2.cmake
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
if(TARGET SDL2-static)
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Third-party: creating target 'SDL2::SDL2'")
|
||||
|
||||
set(SDL_STATIC ON CACHE BOOL "" FORCE)
|
||||
set(SDL_SHARED OFF CACHE BOOL "" FORCE)
|
||||
set(SDL_TEST OFF CACHE BOOL "" FORCE)
|
||||
set(SDL2_DISABLE_INSTALL OFF CACHE BOOL "" FORCE)
|
||||
|
||||
set(
|
||||
internal_sdl2_options
|
||||
|
||||
"SDL_STATIC ON"
|
||||
"SDL_SHARED OFF"
|
||||
"SDL_TEST OFF"
|
||||
"SDL2_DISABLE_INSTALL OFF"
|
||||
)
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
list(APPEND internal_sdl2_options "SDL2_DISABLE_SDL2MAIN OFF")
|
||||
option(SDL2_DISABLE_SDL2MAIN "Disable building/installation of SDL2main" OFF)
|
||||
set(SDL2_DISABLE_SDL2MAIN OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||
list(APPEND internal_sdl2_options "SDL2_DISABLE_SDL2MAIN OFF")
|
||||
option(SDL2_DISABLE_SDL2MAIN "Disable building/installation of SDL2main" OFF)
|
||||
set(SDL2_DISABLE_SDL2MAIN OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM} MATCHES Linux)
|
||||
list(APPEND internal_sdl2_options "SDL2_DISABLE_SDL2MAIN ON")
|
||||
option(SDL2_DISABLE_SDL2MAIN "Disable building/installation of SDL2main" ON)
|
||||
set(SDL2_DISABLE_SDL2MAIN ON CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
if (SDL2_USE_THIRDPARTY)
|
||||
FetchContent_Declare(
|
||||
SDL2
|
||||
VERSION 2.30.0
|
||||
GITHUB_REPOSITORY "libsdl-org/SDL"
|
||||
GIT_TAG release-2.30.0
|
||||
OPTIONS ${internal_sdl2_options}
|
||||
OVERRIDE_FIND_PACKAGE
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
SDL2
|
||||
SOURCE_DIR "${CMAKE_SOURCE_DIR}/thirdparty/SDL2/"
|
||||
OPTIONS ${internal_sdl2_options}
|
||||
OVERRIDE_FIND_PACKAGE
|
||||
)
|
||||
endif()
|
||||
|
||||
FetchContent_MakeAvailable(SDL2)
|
||||
|
||||
set(SDL2_INCLUDE_DIR "${SDL2_BINARY_DIR}/include" CACHE PATH "" FORCE)
|
||||
set(SDL2_LIBRARY "${SDL2_BINARY_DIR}/SDL2-staticd.lib" CACHE PATH "" FORCE)
|
||||
set(SDL2_DIR ${SDL2_BINARY_DIR} CACHE PATH "" FORCE)
|
0
thirdparty/vcpkg-overlays/.placeholder
vendored
Normal file
0
thirdparty/vcpkg-overlays/.placeholder
vendored
Normal file
36
thirdparty/zlib.cmake
vendored
Normal file
36
thirdparty/zlib.cmake
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
if(TARGET ZLIB::ZLIB)
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(STATUS "Third-party: creating target 'ZLIB::ZLIB'")
|
||||
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
if (zlib_USE_THIRDPARTY)
|
||||
FetchContent_Declare(
|
||||
ZLIB
|
||||
GITHUB_REPOSITORY "madler/zlib"
|
||||
GIT_TAG v1.3.1
|
||||
OVERRIDE_FIND_PACKAGE
|
||||
OPTIONS
|
||||
"ZLIB_BUILD_EXAMPLES OFF"
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
ZLIB
|
||||
SOURCE_DIR "${CMAKE_SOURCE_DIR}/thirdparty/zlib/"
|
||||
OVERRIDE_FIND_PACKAGE
|
||||
OPTIONS
|
||||
"ZLIB_BUILD_EXAMPLES OFF"
|
||||
)
|
||||
endif()
|
||||
|
||||
FetchContent_MakeAvailable(ZLIB)
|
||||
|
||||
|
||||
add_library(ZLIB::ZLIB ALIAS zlibstatic)
|
||||
|
||||
set(ZLIB_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/zlib" "${zlib_BINARY_DIR}" CACHE PATH "" FORCE)
|
||||
|
6
vcpkg-configuration.json
Normal file
6
vcpkg-configuration.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json",
|
||||
"overlay-ports": [
|
||||
"./thirdparty/vcpkg-overlays"
|
||||
]
|
||||
}
|
85
vcpkg.json
Normal file
85
vcpkg.json
Normal file
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
|
||||
"name": "srb2",
|
||||
"version": "1.0.0",
|
||||
"builtin-baseline": "c823fd3e57035b10d970a96da2796a2db55e5df5",
|
||||
"dependencies": [
|
||||
"curl",
|
||||
{
|
||||
"name": "libgme",
|
||||
"platform": "!(windows & mingw) & !native"
|
||||
},
|
||||
{
|
||||
"name": "libopenmpt",
|
||||
"platform": "!(windows & mingw)"
|
||||
},
|
||||
"libpng",
|
||||
"miniupnpc",
|
||||
"sdl2",
|
||||
{
|
||||
"name": "sdl2-mixer-ext",
|
||||
"features": [
|
||||
{
|
||||
"name": "cmd",
|
||||
"platform": "linux"
|
||||
},
|
||||
{
|
||||
"name": "libflac",
|
||||
"platform": "!(windows & mingw & !static)"
|
||||
},
|
||||
{
|
||||
"name": "libgme",
|
||||
"platform": "!(windows & mingw) & !native"
|
||||
},
|
||||
{
|
||||
"name": "libmodplug",
|
||||
"platform": "!(windows & mingw)"
|
||||
},
|
||||
{
|
||||
"name": "libopnmidi",
|
||||
"platform": "!(windows & mingw)"
|
||||
},
|
||||
{
|
||||
"name": "libvorbis",
|
||||
"platform": "!(windows & mingw & !static)"
|
||||
},
|
||||
{
|
||||
"name": "libxmp",
|
||||
"platform": "!(windows & mingw)"
|
||||
},
|
||||
{
|
||||
"name": "mpg123",
|
||||
"platform": "!(windows & mingw)"
|
||||
},
|
||||
{
|
||||
"name": "nativemidi",
|
||||
"platform": "!(windows & mingw)"
|
||||
},
|
||||
{
|
||||
"name": "opusfile",
|
||||
"platform": "!(windows & mingw)"
|
||||
},
|
||||
{
|
||||
"name": "pxtone",
|
||||
"platform": "!(windows & mingw)"
|
||||
},
|
||||
{
|
||||
"name": "timidity",
|
||||
"platform": "!(windows & mingw)"
|
||||
},
|
||||
{
|
||||
"name": "wavpack",
|
||||
"platform": "!(windows & mingw)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"zlib"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"name": "sdl2",
|
||||
"version": "2.28.5",
|
||||
"port-version": 1
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue