Compare commits
38
Commits
v9.2
...
fixceemake
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9dd38ec75e | ||
|
|
25dd3b4976 | ||
|
|
0fe3086a5a | ||
|
|
c9afd4a2cd | ||
|
|
7518a6f181 | ||
|
|
2bf4c44259 | ||
|
|
1c95e5f40e | ||
|
|
7c848f4be5 | ||
|
|
a4af254643 | ||
|
|
860dc37fe4 | ||
|
|
8b3d55fbc8 | ||
|
|
0540b5656a | ||
|
|
6c98440f27 | ||
|
|
3828a9f8e0 | ||
|
|
2c7c9ec32a | ||
|
|
1ccd3e37bc | ||
|
|
6ad344f65d | ||
|
|
1c289d73ca | ||
|
|
44ba69cf53 | ||
|
|
4cea0c1414 | ||
|
|
4ee468f5c6 | ||
|
|
9a58eb3010 | ||
|
|
59ff5e61bf | ||
|
|
821c061f82 | ||
|
|
eb4d9bbdd5 | ||
|
|
c19c80d797 | ||
|
|
a2feaa7fde | ||
|
|
3cb4e86b48 | ||
|
|
ed758fc921 | ||
|
|
a191c8b71e | ||
|
|
3f2e0bd349 | ||
|
|
3bdc745bd1 | ||
|
|
c0775ff87b | ||
|
|
04e649d716 | ||
|
|
ee31cc1722 | ||
|
|
7657858407 | ||
|
|
8af93e5f26 | ||
|
|
fb640821c0 |
No files matched your search
+169
-88
@@ -1,60 +1,168 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
|
||||
# Version change is fine.
|
||||
project(SRB2
|
||||
VERSION 1.6
|
||||
LANGUAGES C)
|
||||
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
|
||||
|
||||
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.")
|
||||
if("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
message(FATAL_ERROR "In-source builds are blocked. Please build from a separate directory.")
|
||||
endif()
|
||||
|
||||
# Set up CMAKE path
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||
|
||||
### Useful functions
|
||||
include(CMakeDependentOption)
|
||||
#include(cmake/CPM.cmake)
|
||||
|
||||
# Prepend sources with current source directory
|
||||
function(prepend_sources SOURCE_FILES)
|
||||
foreach(SOURCE_FILE ${${SOURCE_FILES}})
|
||||
set(MODIFIED ${MODIFIED} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE})
|
||||
endforeach()
|
||||
set(${SOURCE_FILES} ${MODIFIED} PARENT_SCOPE)
|
||||
endfunction()
|
||||
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
|
||||
# Version change is fine.
|
||||
project(SRB2
|
||||
VERSION 1.6
|
||||
LANGUAGES C CXX)
|
||||
|
||||
# Macro to add OSX framework
|
||||
macro(add_framework fwname appname)
|
||||
find_library(FRAMEWORK_${fwname}
|
||||
NAMES ${fwname}
|
||||
PATHS ${CMAKE_OSX_SYSROOT}/System/Library
|
||||
${CMAKE_OSX_SYSROOT}/Library
|
||||
/System/Library
|
||||
/Library
|
||||
ATH_SUFFIXES Frameworks
|
||||
NO_DEFAULT_PATH)
|
||||
if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND)
|
||||
MESSAGE(ERROR ": Framework ${fwname} not found")
|
||||
else()
|
||||
TARGET_LINK_LIBRARIES(${appname} PRIVATE "${FRAMEWORK_${fwname}}/${fwname}")
|
||||
MESSAGE(STATUS "Framework ${fwname} found at ${FRAMEWORK_${fwname}}")
|
||||
endif()
|
||||
endmacro()
|
||||
if(APPLE)
|
||||
# DiscordRPC needs but does not properly specify ObjC
|
||||
enable_language(OBJC)
|
||||
endif()
|
||||
|
||||
# Macro to copy Windows DLLs to Debug/Release folder for easy debugging
|
||||
# Note: this is general purpose, we could copy anything. Just using for DLLs on MSVC though
|
||||
macro(copy_files_to_build_dir target dlllist_var)
|
||||
if(MSVC)
|
||||
# http://stackoverflow.com/a/26983405/3064195
|
||||
foreach(dlllist_item ${${dlllist_var}})
|
||||
get_filename_component(dllname ${dlllist_item} NAME)
|
||||
add_custom_command(TARGET ${target} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${dlllist_item}
|
||||
$<TARGET_FILE_DIR:${target}>/${dllname}
|
||||
)
|
||||
endforeach()
|
||||
##### PACKAGE CONFIGURATION #####
|
||||
|
||||
set(SRB2_CPACK_GENERATOR "" CACHE STRING "Generator to use for making a package. E.g., ZIP, TGZ, DragNDrop (OSX only). Leave blank for default generator.")
|
||||
|
||||
if("${SRB2_CPACK_GENERATOR}" STREQUAL "")
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
|
||||
set(SRB2_CPACK_GENERATOR "ZIP")
|
||||
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
set(SRB2_CPACK_GENERATOR "TGZ")
|
||||
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
||||
set(SRB2_CPACK_GENERATOR "TGZ")
|
||||
endif()
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
set(CPACK_GENERATOR ${SRB2_CPACK_GENERATOR})
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SRB2Kart" CACHE STRING "Program name for display purposes")
|
||||
set(CPACK_PACKAGE_VENDOR "Kart Krew" CACHE STRING "Vendor name for display purposes")
|
||||
#set(CPACK_PACKAGE_DESCRIPTION_FILE )
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
|
||||
SET(CPACK_OUTPUT_FILE_PREFIX package)
|
||||
include(CPack)
|
||||
|
||||
# Options
|
||||
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Linux)
|
||||
set(SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT ON)
|
||||
else()
|
||||
set(SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
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" OFF)
|
||||
# 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
|
||||
)
|
||||
option(SRB2_CONFIG_ENABLE_DISCORDRPC "Enable Discord RPC features" ON)
|
||||
option(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_STATIC_OPENGL "Enable static linking GL (do not do this)" OFF)
|
||||
option(SRB2_CONFIG_ERRORMODE "Compile C code with warnings treated as errors." OFF)
|
||||
option(SRB2_CONFIG_DEBUGMODE "Compile with PARANOIA, ZDEBUG, RANGECHECK and PACKETDROP defined." OFF)
|
||||
option(SRB2_CONFIG_MOBJCONSISTANCY "Compile with MOBJCONSISTANCY defined." OFF)
|
||||
option(SRB2_CONFIG_PACKETDROP "Compile with PACKETDROP defined." OFF)
|
||||
option(SRB2_CONFIG_ZDEBUG "Compile with ZDEBUG defined." OFF)
|
||||
# SRB2_CONFIG_PROFILEMODE is probably superceded by some CMake setting.
|
||||
option(SRB2_CONFIG_PROFILEMODE "Compile for profiling (GCC only)." OFF)
|
||||
option(SRB2_CONFIG_TRACY "Compile with Tracy profiling enabled" OFF)
|
||||
option(SRB2_CONFIG_ASAN "Compile with AddressSanitizer (libasan)." OFF)
|
||||
option(SRB2_CONFIG_UBSAN "Compile with UndefinedBehaviorSanitizer (libubsan)." 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.")
|
||||
option(SRB2_CONFIG_LTO "Enable link time optimizations, improves performance at the cost of longer link times." ON)
|
||||
option(SRB2_CONFIG_TIDY "Enable clang tiny, checks compiled code for issues at the cost of longer compile times." OFF)
|
||||
|
||||
# man i suck at explaining lmao
|
||||
option(SRB2_CONFIG_SATURNPAK "Enable Saturn specific special packet. Required for using the newer resynch system" ON)
|
||||
option(SRB2_CONFIG_SATURNJOIN "Enable Saturn specific allowjoin toggle." ON)
|
||||
option(SRB2_CONFIG_SCREENFBO "Enable hardware render (OpenGL) FBO downsampling support" ON)
|
||||
option(SRB2_CONFIG_LIBBACKTRACE "Enable using libbacktrace for crashlogs" ON)
|
||||
|
||||
#if(SRB2_CONFIG_ENABLE_TESTS)
|
||||
# https://github.com/catchorg/Catch2
|
||||
# CPMAddPackage(
|
||||
# NAME Catch2
|
||||
# VERSION 3.1.1
|
||||
# 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()
|
||||
# TODO: fix windoze crap, i dont want cpm lol
|
||||
#CPMAddPackage(
|
||||
# NAME Ccache.cmake
|
||||
# GITHUB_REPOSITORY TheLartians/Ccache.cmake
|
||||
# VERSION 1.2.5
|
||||
#)
|
||||
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 OPTIONAL)
|
||||
find_package(GME REQUIRED)
|
||||
find_package(DiscordRPC OPTIONAL)
|
||||
find_package(libbacktrace OPTIONAL)
|
||||
endif()
|
||||
|
||||
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()
|
||||
|
||||
if ((${SRB2_USE_CCACHE}) AND (${CMAKE_C_COMPILER} MATCHES "clang"))
|
||||
message(WARNING "Using clang and CCache: You may want to set environment variable CCACHE_CPP2=yes to prevent include errors during compile.")
|
||||
endif()
|
||||
|
||||
# Add sources from Sourcefile
|
||||
function(target_sourcefile type)
|
||||
file(STRINGS Sourcefile list
|
||||
REGEX "[-0-9A-Za-z_]+\.${type}")
|
||||
target_sources(SRB2SDL2 PRIVATE ${list})
|
||||
endfunction()
|
||||
|
||||
# bitness check
|
||||
set(SRB2_SYSTEM_BITS 0)
|
||||
@@ -70,66 +178,39 @@ if(${SRB2_SYSTEM_BITS} EQUAL 0)
|
||||
message(STATUS "Target bitness is unknown")
|
||||
endif()
|
||||
|
||||
# OS macros
|
||||
if (UNIX)
|
||||
add_definitions(-DUNIXCOMMON)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
find_program(OBJCOPY objcopy)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||
add_definitions(-DLINUX)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
add_definitions(-DLINUX64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES "Darwin")
|
||||
add_definitions(-DMACOSX)
|
||||
endif()
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
|
||||
# Set EXE names so the assets CMakeLists can refer to its target
|
||||
set(SRB2_SDL2_EXE_NAME srb2kart CACHE STRING "Executable binary output name")
|
||||
set(SRB2_WIN_EXE_NAME srb2kartdd CACHE STRING "Executable binary output name for DirectDraw build")
|
||||
set(SRB2_SDL2_EXE_NAME "" CACHE STRING "Override executable binary output name")
|
||||
set(SRB2_SDL2_EXE_SUFFIX "" CACHE STRING "Optional executable suffix, separated by an underscore")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(assets)
|
||||
|
||||
|
||||
## config.h generation
|
||||
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
|
||||
include(GitUtilities)
|
||||
git_latest_commit(SRB2_COMP_COMMIT "${CMAKE_SOURCE_DIR}")
|
||||
git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
|
||||
#git_working_tree_dirty(SRB2_COMP_UNCOMMITTED "${CMAKE_SOURCE_DIR}") #TODO: fix this
|
||||
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
|
||||
set(SRB2_COMP_REVISION "${SRB2_COMP_COMMIT}")
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
||||
|
||||
##### PACKAGE CONFIGURATION #####
|
||||
if("${SRB2_SDL2_EXE_NAME}" STREQUAL "")
|
||||
list(APPEND EXE_NAME_PARTS "srb2kart-saturn")
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES "Windows")
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||
set(CPACK_GENERATOR "TGZ")
|
||||
endif()
|
||||
if(${CMAKE_SYSTEM} MATCHES "Darwin")
|
||||
set(CPACK_GENERATOR "DragNDrop")
|
||||
if(NOT "${SRB2_GIT_BRANCH}" STREQUAL "master")
|
||||
list(APPEND EXE_NAME_PARTS ${SRB2_GIT_BRANCH})
|
||||
endif()
|
||||
else()
|
||||
list(APPEND EXE_NAME_PARTS ${SRB2_SDL2_EXE_NAME})
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2 Kart" CACHE STRING "Program name for display purposes")
|
||||
set(CPACK_PACKAGE_VENDOR "Kart Krew" CACHE STRING "Vendor name for display purposes")
|
||||
#set(CPACK_PACKAGE_DESCRIPTION_FILE )
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
|
||||
include(CPack)
|
||||
list(APPEND EXE_NAME_PARTS ${SRB2_SDL2_EXE_SUFFIX})
|
||||
|
||||
list(JOIN EXE_NAME_PARTS "_" EXE_NAME)
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${EXE_NAME})
|
||||
+37
-44
@@ -1,59 +1,52 @@
|
||||
## Assets Target Configuration ##
|
||||
|
||||
# For prepending the current source path, later
|
||||
FUNCTION(PREPEND var prefix)
|
||||
SET(listVar "")
|
||||
FOREACH(f ${ARGN})
|
||||
LIST(APPEND listVar "${prefix}/${f}")
|
||||
ENDFOREACH(f)
|
||||
SET(${var} "${listVar}" PARENT_SCOPE)
|
||||
ENDFUNCTION(PREPEND)
|
||||
if(${CMAKE_SYSTEM} MATCHES Linux)
|
||||
# Asset installation isn't part of the Linux target
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer"
|
||||
CACHE STRING "Path to directory that contains all asset files for the installer.")
|
||||
if("${SRB2_CONFIG_ASSET_DIRECTORY}" STREQUAL "")
|
||||
message(WARNING "SRB2_CONFIG_ASSET_DIRECTORY is not set, so installation will not contain data files.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(SRB2_ASSET_HASHED
|
||||
"srb2.srb;\
|
||||
gfx.kart;\
|
||||
textures.kart;\
|
||||
chars.kart;\
|
||||
maps.kart"
|
||||
CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!"
|
||||
get_filename_component(SRB2_ASSET_DIRECTORY_ABSOLUTE "${SRB2_CONFIG_ASSET_DIRECTORY}" ABSOLUTE)
|
||||
|
||||
set(SRB2_ASSETS_DOCS
|
||||
"README.txt"
|
||||
"HISTORY.txt"
|
||||
"README-SDL.txt"
|
||||
"LICENSE.txt"
|
||||
"LICENSE-3RD-PARTY.txt"
|
||||
)
|
||||
list(TRANSFORM SRB2_ASSETS_DOCS PREPEND "/")
|
||||
list(TRANSFORM SRB2_ASSETS_DOCS PREPEND "${SRB2_ASSET_DIRECTORY_ABSOLUTE}")
|
||||
|
||||
set(SRB2_ASSET_DOCS
|
||||
"README.txt;\
|
||||
HISTORY.txt;\
|
||||
LICENSE.txt;\
|
||||
LICENSE-3RD-PARTY.txt"
|
||||
CACHE STRING "Documentation filenames. In OS X, these are packaged separately from other assets. No spaces between entries!"
|
||||
####################
|
||||
# POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list!
|
||||
####################
|
||||
|
||||
set(SRB2_ASSETS_GAME
|
||||
"srb2.srb"
|
||||
"gfx.kart"
|
||||
"textures.kart"
|
||||
"chars.kart"
|
||||
"maps.kart"
|
||||
)
|
||||
list(TRANSFORM SRB2_ASSETS_GAME PREPEND "/")
|
||||
list(TRANSFORM SRB2_ASSETS_GAME PREPEND "${SRB2_ASSET_DIRECTORY_ABSOLUTE}")
|
||||
|
||||
PREPEND(SRB2_ASSET_DOCS ${SRB2_ASSET_DIRECTORY} ${SRB2_ASSET_DOCS})
|
||||
|
||||
foreach(SRB2_ASSET ${SRB2_ASSET_HASHED})
|
||||
file(MD5 ${SRB2_ASSET_DIRECTORY}/${SRB2_ASSET} "SRB2_ASSET_${SRB2_ASSET}_HASH")
|
||||
set(SRB2_ASSET_${SRB2_ASSET}_HASH ${SRB2_ASSET_${SRB2_ASSET}_HASH} PARENT_SCOPE)
|
||||
endforeach()
|
||||
set(SRB2_ASSETS ${SRB2_ASSET_DOCS} ${SRB2_ASSETS_GAME})
|
||||
|
||||
# Installation
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||
get_target_property(outname SRB2SDL2 OUTPUT_NAME)
|
||||
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
|
||||
DESTINATION "${outname}.app/Contents/Resources"
|
||||
)
|
||||
install(FILES ${SRB2_ASSET_DOCS}
|
||||
DESTINATION .
|
||||
OPTIONAL
|
||||
)
|
||||
install(FILES ${SRB2_ASSETS} DESTINATION "${outname}.app/Contents/Resources")
|
||||
install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/models" DESTINATION "${outname}.app/Contents/Resources")
|
||||
install(FILES ${SRB2_ASSETS_DOCS} DESTINATION .)
|
||||
else()
|
||||
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
|
||||
DESTINATION .
|
||||
)
|
||||
# Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install again
|
||||
#install(FILES ${SRB2_ASSET_DOCS}
|
||||
# DESTINATION .
|
||||
# OPTIONAL
|
||||
#)
|
||||
install(FILES ${SRB2_ASSETS} DESTINATION .)
|
||||
install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/models" DESTINATION .)
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
||||
|
||||
set(CMAKE_BINARY_DIR "${BINARY_DIR}")
|
||||
set(CMAKE_CURRENT_BINARY_DIR "${BINARY_DIR}")
|
||||
|
||||
# Set up CMAKE path
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
||||
|
||||
include(GitUtilities)
|
||||
|
||||
git_current_branch(SRB2_COMP_BRANCH)
|
||||
git_working_tree_dirty(SRB2_COMP_UNCOMMITTED)
|
||||
|
||||
git_latest_commit(SRB2_COMP_REVISION)
|
||||
git_subject(subject)
|
||||
string(REGEX REPLACE "([\"\\])" "\\\\\\1" SRB2_COMP_LASTCOMMIT "${subject}")
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/build/src/config.h")
|
||||
@@ -21,3 +21,13 @@ find_library(DISCORDRPC_LIBRARY
|
||||
set(DISCORDRPC_PROCESS_INCLUDES DISCORDRPC_INCLUDE_DIR)
|
||||
set(DISCORDRPC_PROCESS_LIBS DISCORDRPC_LIBRARY)
|
||||
libfind_process(DISCORDRPC)
|
||||
|
||||
if(DISCORDRPC_FOUND AND NOT TARGET DiscordRPC::DiscordRPC)
|
||||
add_library(DiscordRPC::DiscordRPC UNKNOWN IMPORTED)
|
||||
set_target_properties(
|
||||
DiscordRPC::DiscordRPC
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${DISCORDRPC_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${DISCORDRPC_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
@@ -20,4 +20,14 @@ find_library(GME_LIBRARY
|
||||
|
||||
set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR)
|
||||
set(GME_PROCESS_LIBS GME_LIBRARY)
|
||||
libfind_process(GME)
|
||||
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()
|
||||
@@ -20,4 +20,14 @@ find_library(OPENMPT_LIBRARY
|
||||
|
||||
set(OPENMPT_PROCESS_INCLUDES OPENMPT_INCLUDE_DIR)
|
||||
set(OPENMPT_PROCESS_LIBS OPENMPT_LIBRARY)
|
||||
libfind_process(OPENMPT)
|
||||
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()
|
||||
@@ -31,3 +31,13 @@ find_library(SDL2_LIBRARY
|
||||
set(SDL2_PROCESS_INCLUDES SDL2_INCLUDE_DIR)
|
||||
set(SDL2_PROCESS_LIBS SDL2_LIBRARY)
|
||||
libfind_process(SDL2)
|
||||
|
||||
if(SDL2_FOUND AND NOT TARGET SDL2::SDL2)
|
||||
add_library(SDL2::SDL2 UNKNOWN IMPORTED)
|
||||
set_target_properties(
|
||||
SDL2::SDL2
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${SDL2_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
@@ -32,3 +32,13 @@ find_library(SDL2_MIXER_LIBRARY
|
||||
set(SDL2_MIXER_PROCESS_INCLUDES SDL2_MIXER_INCLUDE_DIR)
|
||||
set(SDL2_MIXER_PROCESS_LIBS SDL2_MIXER_LIBRARY)
|
||||
libfind_process(SDL2_MIXER)
|
||||
|
||||
if(SDL2_MIXER_FOUND AND NOT TARGET SDL2_mixer::SDL2_mixer)
|
||||
add_library(SDL2_mixer::SDL2_mixer UNKNOWN IMPORTED)
|
||||
set_target_properties(
|
||||
SDL2_mixer::SDL2_mixer
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${SDL2_MIXER_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_MIXER_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1,33 @@
|
||||
include(LibFindMacros)
|
||||
|
||||
libfind_pkg_check_modules(LIBBACKTRACE_PKGCONF LIBBACKTRACE)
|
||||
|
||||
find_path(LIBBACKTRACE_INCLUDE_DIR
|
||||
NAMES backtrace.h
|
||||
PATHS
|
||||
${LIBBACKTRACE_PKGCONF_INCLUDE_DIRS}
|
||||
"/usr/include"
|
||||
"/usr/local/include"
|
||||
)
|
||||
|
||||
find_library(LIBBACKTRACE_LIBRARY
|
||||
NAMES backtrace
|
||||
PATHS
|
||||
${LIBBACKTRACE_PKGCONF_LIBRARY_DIRS}
|
||||
"/usr/lib"
|
||||
"/usr/local/lib"
|
||||
)
|
||||
|
||||
set(LIBBACKTRACE_PROCESS_INCLUDES LIBBACKTRACE_INCLUDE_DIR)
|
||||
set(LIBBACKTRACE_PROCESS_LIBS LIBBACKTRACE_LIBRARY)
|
||||
libfind_process(LIBBACKTRACE)
|
||||
|
||||
if(LIBBACKTRACE_FOUND AND NOT TARGET libbacktrace)
|
||||
add_library(libbacktrace UNKNOWN IMPORTED)
|
||||
set_target_properties(
|
||||
libbacktrace
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${LIBBACKTRACE_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${LIBBACKTRACE_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
@@ -6,38 +6,54 @@ endif()
|
||||
|
||||
set(__GitUtilities ON)
|
||||
|
||||
function(git_describe variable path)
|
||||
execute_process(COMMAND "${GIT_EXECUTABLE}" "describe"
|
||||
WORKING_DIRECTORY "${path}"
|
||||
RESULT_VARIABLE result
|
||||
macro(_git_command)
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" ${ARGN}
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endmacro()
|
||||
|
||||
macro(_git_easy_command)
|
||||
_git_command(${ARGN})
|
||||
set(${variable} "${output}" PARENT_SCOPE)
|
||||
endmacro()
|
||||
|
||||
function(git_current_branch variable)
|
||||
_git_command(symbolic-ref -q --short HEAD)
|
||||
|
||||
# If a detached head, a ref could still be resolved.
|
||||
if("${output}" STREQUAL "")
|
||||
_git_command(describe --all --exact-match)
|
||||
|
||||
# Get the ref, in the form heads/master or
|
||||
# remotes/origin/master so isolate the final part.
|
||||
string(REGEX REPLACE ".*/" "" output "${output}")
|
||||
endif()
|
||||
|
||||
set(${variable} "${output}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_current_branch variable path)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} "symbolic-ref" "--short" "HEAD"
|
||||
WORKING_DIRECTORY "${path}"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
set(${variable} "${output}" PARENT_SCOPE)
|
||||
function(git_latest_commit variable)
|
||||
_git_easy_command(rev-parse --short HEAD)
|
||||
endfunction()
|
||||
|
||||
function(git_latest_commit variable path)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} "rev-parse" "--short" "HEAD"
|
||||
WORKING_DIRECTORY "${path}"
|
||||
RESULT_VARIABLE result
|
||||
OUTPUT_VARIABLE output
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
function(git_working_tree_dirty variable)
|
||||
_git_command(status --porcelain -uno)
|
||||
|
||||
set(${variable} "${output}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
if(output STREQUAL "")
|
||||
set(${variable} FALSE PARENT_SCOPE)
|
||||
else()
|
||||
set(${variable} TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(git_subject variable)
|
||||
_git_easy_command(log -1 "--format=%h %s")
|
||||
endfunction()
|
||||
|
||||
function(get_git_dir variable)
|
||||
_git_easy_command(rev-parse --git-dir)
|
||||
endfunction()
|
||||
@@ -1,4 +1,5 @@
|
||||
/cscope.out
|
||||
*.json
|
||||
*.idx
|
||||
config.h
|
||||
*.gdb_history
|
||||
+391
-495
@@ -1,413 +1,146 @@
|
||||
# SRB2 Core
|
||||
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32)
|
||||
|
||||
if(("${CMAKE_COMPILER_IS_GNUCC}" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
|
||||
target_link_options(SRB2SDL2 PRIVATE "-Wl,--disable-dynamicbase")
|
||||
if("${SRB2_CONFIG_STATIC_STDLIB}")
|
||||
# On MinGW with internal libraries, link the standard library statically
|
||||
if(CMAKE_LINKER_TYPE STREQUAL "LLD")
|
||||
target_link_options(SRB2SDL2 PRIVATE -Wl, -static-libgcc -static-libstdc++ -static -lpthread)
|
||||
else()
|
||||
target_link_options(SRB2SDL2 PRIVATE -Wl,--add-stdcall-alias -static-libgcc -static-libstdc++ -static -lpthread)
|
||||
endif()
|
||||
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE Threads::Threads)
|
||||
endif()
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
target_link_options(SRB2SDL2 PRIVATE "-Wl,--large-address-aware")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(SRB2_CONFIG_STD23 OFF CACHE BOOL
|
||||
"Compiles the game under c23 and cxx23 instead c11 and cxx17.")
|
||||
|
||||
if(SRB2_CONFIG_STD23)
|
||||
message("-- Compiling game with C23 and CXX23.")
|
||||
target_compile_features(SRB2SDL2 PRIVATE c_std_23 cxx_std_23)
|
||||
set_property(TARGET SRB2SDL2 PROPERTY C_STANDARD 23)
|
||||
set_property(TARGET SRB2SDL2 PROPERTY CXX_STANDARD 23)
|
||||
else()
|
||||
message("-- Compiling game with C11 and CXX17.")
|
||||
target_compile_features(SRB2SDL2 PRIVATE c_std_11 cxx_std_17)
|
||||
set_property(TARGET SRB2SDL2 PROPERTY C_STANDARD 11)
|
||||
set_property(TARGET SRB2SDL2 PROPERTY CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
# Core sources
|
||||
set(SRB2_CORE_SOURCES
|
||||
am_map.c
|
||||
b_bot.c
|
||||
command.c
|
||||
comptime.c
|
||||
console.c
|
||||
d_clisrv.c
|
||||
d_main.c
|
||||
d_net.c
|
||||
d_netcmd.c
|
||||
d_netfil.c
|
||||
d_protocol.c
|
||||
dehacked.c
|
||||
f_finale.c
|
||||
f_wipe.c
|
||||
filesrch.c
|
||||
g_game.c
|
||||
g_input.c
|
||||
hu_stuff.c
|
||||
i_tcp.c
|
||||
info.c
|
||||
lzf.c
|
||||
m_aatree.c
|
||||
m_anigif.c
|
||||
m_argv.c
|
||||
m_bbox.c
|
||||
m_cheat.c
|
||||
m_cond.c
|
||||
m_fixed.c
|
||||
m_menu.c
|
||||
m_textinput.c
|
||||
m_misc.c
|
||||
m_perfstats.c
|
||||
m_queue.c
|
||||
m_random.c
|
||||
md5.c
|
||||
mserv.c
|
||||
http-mserv.c
|
||||
qs22j.c
|
||||
s_sound.c
|
||||
screen.c
|
||||
sounds.c
|
||||
st_stuff.c
|
||||
#string.c
|
||||
tables.c
|
||||
v_video.c
|
||||
w_wad.c
|
||||
y_inter.c
|
||||
z_zone.c
|
||||
)
|
||||
target_sourcefile(c)
|
||||
target_sources(SRB2SDL2 PRIVATE comptime.c config.h.in)
|
||||
|
||||
set(SRB2_CORE_HEADERS
|
||||
am_map.h
|
||||
b_bot.h
|
||||
byteptr.h
|
||||
command.h
|
||||
console.h
|
||||
d_clisrv.h
|
||||
d_event.h
|
||||
d_main.h
|
||||
d_net.h
|
||||
d_netcmd.h
|
||||
d_netfil.h
|
||||
d_player.h
|
||||
d_protocol.h
|
||||
d_think.h
|
||||
d_ticcmd.h
|
||||
dehacked.h
|
||||
doomdata.h
|
||||
doomdef.h
|
||||
doomstat.h
|
||||
doomtype.h
|
||||
endian.h
|
||||
f_finale.h
|
||||
fastcmp.h
|
||||
filesrch.h
|
||||
g_game.h
|
||||
g_input.h
|
||||
g_state.h
|
||||
hu_stuff.h
|
||||
i_joy.h
|
||||
i_net.h
|
||||
i_sound.h
|
||||
i_system.h
|
||||
i_tcp.h
|
||||
i_time.h
|
||||
i_video.h
|
||||
info.h
|
||||
keys.h
|
||||
lzf.h
|
||||
m_aatree.h
|
||||
m_anigif.h
|
||||
m_argv.h
|
||||
m_bbox.h
|
||||
m_cheat.h
|
||||
m_cond.h
|
||||
m_dllist.h
|
||||
m_fixed.h
|
||||
m_menu.h
|
||||
m_textinput.h
|
||||
m_misc.h
|
||||
m_queue.h
|
||||
m_perfstats.h
|
||||
m_random.h
|
||||
m_swap.h
|
||||
md5.h
|
||||
mserv.h
|
||||
qs22j.h
|
||||
s_sound.h
|
||||
screen.h
|
||||
sounds.h
|
||||
st_stuff.h
|
||||
tables.h
|
||||
v_video.h
|
||||
w_wad.h
|
||||
y_inter.h
|
||||
z_zone.h
|
||||
|
||||
config.h.in
|
||||
)
|
||||
|
||||
set(SRB2_CORE_RENDER_SOURCES
|
||||
r_bsp.c
|
||||
r_data.c
|
||||
r_draw.c
|
||||
r_fps.c
|
||||
r_main.c
|
||||
r_patch.c
|
||||
r_patchrotation.c
|
||||
r_plane.c
|
||||
r_segs.c
|
||||
r_sky.c
|
||||
r_splats.c
|
||||
r_things.c
|
||||
r_portal.c
|
||||
|
||||
r_bsp.h
|
||||
r_data.h
|
||||
r_defs.h
|
||||
r_draw.h
|
||||
r_fps.h
|
||||
r_local.h
|
||||
r_main.h
|
||||
r_patch.h
|
||||
r_patchrotation.h
|
||||
r_plane.h
|
||||
r_segs.h
|
||||
r_sky.h
|
||||
r_splats.h
|
||||
r_state.h
|
||||
r_things.h
|
||||
r_portal.h
|
||||
)
|
||||
|
||||
set(SRB2_CORE_GAME_SOURCES
|
||||
p_ceilng.c
|
||||
p_enemy.c
|
||||
p_floor.c
|
||||
p_inter.c
|
||||
p_lights.c
|
||||
p_map.c
|
||||
p_maputl.c
|
||||
p_mobj.c
|
||||
p_polyobj.c
|
||||
p_saveg.c
|
||||
p_setup.c
|
||||
p_sight.c
|
||||
p_slopes.c
|
||||
p_spec.c
|
||||
p_telept.c
|
||||
p_tick.c
|
||||
p_user.c
|
||||
k_director.c
|
||||
k_kart.c
|
||||
k_stats.c
|
||||
i_time.c
|
||||
|
||||
p_local.h
|
||||
p_maputl.h
|
||||
p_mobj.h
|
||||
p_polyobj.h
|
||||
p_pspr.h
|
||||
p_saveg.h
|
||||
p_setup.h
|
||||
p_slopes.h
|
||||
p_spec.h
|
||||
p_tick.h
|
||||
k_director.h
|
||||
k_kart.h
|
||||
k_stats.h
|
||||
)
|
||||
|
||||
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
|
||||
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
|
||||
endif()
|
||||
|
||||
prepend_sources(SRB2_CORE_SOURCES)
|
||||
prepend_sources(SRB2_CORE_HEADERS)
|
||||
prepend_sources(SRB2_CORE_RENDER_SOURCES)
|
||||
prepend_sources(SRB2_CORE_GAME_SOURCES)
|
||||
|
||||
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
|
||||
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
|
||||
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
|
||||
target_sources(SRB2SDL2 PRIVATE md5.c md5.h)
|
||||
|
||||
### Configuration
|
||||
set(SRB2_CONFIG_HAVE_BLUA ON CACHE BOOL
|
||||
"Enable Lua interpreter support")
|
||||
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
|
||||
"Enable PNG support. Depends on zlib, so will be disabled if you don't enable that too.")
|
||||
set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL
|
||||
"Enable zlib support.")
|
||||
set(SRB2_CONFIG_HAVE_GME ON CACHE BOOL
|
||||
"Enable GME support.")
|
||||
set(SRB2_CONFIG_HAVE_OPENMPT ON CACHE BOOL
|
||||
"Enable OpenMPT support.")
|
||||
set(SRB2_CONFIG_HAVE_DISCORDRPC OFF CACHE BOOL
|
||||
"Enable Discord rich presence support.")
|
||||
set(SRB2_CONFIG_HAVE_CURL ON CACHE BOOL
|
||||
"Enable curl support, used for downloading files via HTTP.")
|
||||
set(SRB2_CONFIG_HWRENDER ON CACHE BOOL
|
||||
"Enable hardware rendering through OpenGL.")
|
||||
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
|
||||
"Use statically linked OpenGL. NOT RECOMMENDED.")
|
||||
set(SRB2_CONFIG_USE_FBO_OGL ON CACHE BOOL
|
||||
"Enable OpenGL FBO Downsampling support.")
|
||||
set(SRB2_CONFIG_DEDICATED OFF CACHE BOOL
|
||||
"Build a dedicated server.")
|
||||
set(SRB2_CONFIG_DEV_BUILD OFF CACHE BOOL
|
||||
"Compile a development build of SRB2Kart.")
|
||||
|
||||
if(${SRB2_CONFIG_DEDICATED})
|
||||
set(SRB2_CONFIG_HAVE_GME NO)
|
||||
set(SRB2_CONFIG_HAVE_OPENMPT NO)
|
||||
set(SRB2_CONFIG_HWRENDER NO)
|
||||
endif()
|
||||
set(SRB2_CONFIG_SKIP_COMPTIME OFF CACHE BOOL
|
||||
"Skip Comptime rebuild.")
|
||||
|
||||
### use internal libraries?
|
||||
if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
|
||||
set(SRB2_CONFIG_USE_INTERNAL_LIBRARIES OFF CACHE BOOL
|
||||
"Use SRB2Kart's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_BLUA})
|
||||
add_definitions(-DHAVE_BLUA)
|
||||
set(SRB2_LUA_SOURCES
|
||||
lua_baselib.c
|
||||
lua_blockmaplib.c
|
||||
lua_consolelib.c
|
||||
lua_hooklib.c
|
||||
lua_hudlib.c
|
||||
lua_hudlib_drawlist.c
|
||||
lua_infolib.c
|
||||
lua_maplib.c
|
||||
lua_mathlib.c
|
||||
lua_mobjlib.c
|
||||
lua_playerlib.c
|
||||
lua_script.c
|
||||
lua_skinlib.c
|
||||
lua_thinkerlib.c
|
||||
lua_udatalib.c
|
||||
lua_glib.c
|
||||
if(NOT SRB2_CONFIG_SKIP_COMPTIME)
|
||||
# This updates the modification time for comptime.c at the
|
||||
# end of building so when the build system is ran next time,
|
||||
# that file gets flagged. comptime.c will always be rebuilt.
|
||||
#
|
||||
# This begs the question, why always rebuild comptime.c?
|
||||
# Some things like the git commit must be checked each time
|
||||
# the program is built. But the build system determines which
|
||||
# files should be rebuilt before anything else. So
|
||||
# comptime.c, which only needs to be rebuilt based on
|
||||
# information known at build time, must be told to rebuild
|
||||
# before that information can be ascertained.
|
||||
add_custom_command(
|
||||
TARGET SRB2SDL2
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_SOURCE_DIR}/comptime.c
|
||||
)
|
||||
set(SRB2_LUA_HEADERS
|
||||
lua_hook.h
|
||||
lua_hud.h
|
||||
lua_hudlib_drawlist.h
|
||||
lua_libs.h
|
||||
lua_script.h
|
||||
lua_udatalib.h
|
||||
lua_glib.h
|
||||
)
|
||||
|
||||
prepend_sources(SRB2_LUA_SOURCES)
|
||||
prepend_sources(SRB2_LUA_HEADERS)
|
||||
|
||||
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
|
||||
|
||||
set(SRB2_BLUA_SOURCES
|
||||
blua/lapi.c
|
||||
blua/lauxlib.c
|
||||
blua/lbaselib.c
|
||||
blua/ldblib.c
|
||||
blua/lcode.c
|
||||
blua/ldebug.c
|
||||
blua/ldo.c
|
||||
blua/ldump.c
|
||||
blua/lfunc.c
|
||||
blua/lgc.c
|
||||
blua/linit.c
|
||||
blua/liolib.c
|
||||
blua/llex.c
|
||||
blua/lmem.c
|
||||
blua/lobject.c
|
||||
blua/lopcodes.c
|
||||
blua/lparser.c
|
||||
blua/lstate.c
|
||||
blua/lstring.c
|
||||
blua/lstrlib.c
|
||||
blua/ltable.c
|
||||
blua/ltablib.c
|
||||
blua/ltm.c
|
||||
blua/lundump.c
|
||||
blua/lvm.c
|
||||
blua/lzio.c
|
||||
)
|
||||
set(SRB2_BLUA_HEADERS
|
||||
blua/lapi.h
|
||||
blua/lauxlib.h
|
||||
blua/lcode.h
|
||||
blua/ldebug.h
|
||||
blua/ldo.h
|
||||
blua/lfunc.h
|
||||
blua/lgc.h
|
||||
blua/llex.h
|
||||
blua/llimits.h
|
||||
blua/lmem.h
|
||||
blua/lobject.h
|
||||
blua/lopcodes.h
|
||||
blua/lparser.h
|
||||
blua/lstate.h
|
||||
blua/lstring.h
|
||||
blua/ltable.h
|
||||
blua/ltm.h
|
||||
blua/lua.h
|
||||
blua/luaconf.h
|
||||
blua/lualib.h
|
||||
blua/lundump.h
|
||||
blua/lvm.h
|
||||
blua/lzio.h
|
||||
)
|
||||
|
||||
prepend_sources(SRB2_BLUA_SOURCES)
|
||||
prepend_sources(SRB2_BLUA_HEADERS)
|
||||
|
||||
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_GME})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(GME_FOUND ON)
|
||||
set(GME_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/gme/include)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win64 -lgme")
|
||||
else() # 32-bit
|
||||
set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win32 -lgme")
|
||||
endif()
|
||||
else()
|
||||
find_package(GME)
|
||||
endif()
|
||||
if(${GME_FOUND})
|
||||
set(SRB2_HAVE_GME ON)
|
||||
add_definitions(-DHAVE_LIBGME)
|
||||
else()
|
||||
message(WARNING "You have specified that GME is available but it was not found.")
|
||||
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
|
||||
add_custom_target(_SRB2_reconf ALL
|
||||
COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/.. -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Comptime.cmake
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.."
|
||||
)
|
||||
add_dependencies(SRB2SDL2 _SRB2_reconf)
|
||||
|
||||
if(SRB2_CONFIG_ASAN)
|
||||
target_compile_options(SRB2SDL2 PRIVATE -fsanitize=address)
|
||||
target_link_options(SRB2SDL2 PRIVATE -fsanitize=address)
|
||||
endif()
|
||||
|
||||
if(SRB2_CONFIG_UBSAN)
|
||||
target_compile_options(SRB2SDL2 PRIVATE -fsanitize=undefined)
|
||||
target_link_options(SRB2SDL2 PRIVATE -fsanitize=undefined)
|
||||
endif()
|
||||
|
||||
if(SRB2_CONFIG_TIDY)
|
||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*")
|
||||
endif()
|
||||
|
||||
add_subdirectory(blua)
|
||||
add_subdirectory(sdl)
|
||||
add_subdirectory(core)
|
||||
|
||||
# OS macros
|
||||
if (UNIX)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DUNIXCOMMON)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE -rdynamic) # Use -rdynamic so a backtrace log shows function names
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
find_program(OBJCOPY objcopy)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DLINUX)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DLINUX64)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_DISCORDRPC})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(DISCORDRPC_FOUND ON)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
set(DISCORDRPC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/discord-rpc/win64-dynamic/include)
|
||||
set(DISCORDRPC_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/discord-rpc/win64-dynamic/lib -ldiscord-rpc")
|
||||
else() # 32-bit
|
||||
set(DISCORDRPC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/discord-rpc/win32-dynamic/include)
|
||||
set(DISCORDRPC_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/discord-rpc/win32-dynamic/lib -ldiscord-rpc")
|
||||
endif()
|
||||
else()
|
||||
find_package(DiscordRPC)
|
||||
endif()
|
||||
if(${DISCORDRPC_FOUND})
|
||||
set(SRB2_HAVE_DISCORDRPC ON)
|
||||
add_definitions(-DHAVE_DISCORDRPC)
|
||||
add_definitions(-DUSE_STUN)
|
||||
set(SRB2_DISCORDRPC_SOURCES discord.c stun.c)
|
||||
set(SRB2_DISCORDRPC_HEADERS discord.h stun.h)
|
||||
prepend_sources(SRB2_DISCORDRPC_SOURCES)
|
||||
prepend_sources(SRB2_DISCORDRPC_HEADERS)
|
||||
source_group("Discord Rich Presence" FILES ${SRB2_DISCORDRPC_SOURCES} ${SRB2_DISCORDRPC_HEADERS})
|
||||
else()
|
||||
message(WARNING "You have specified that Discord Rich Presence is available but it was not found.")
|
||||
endif()
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DMACOSX)
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_OPENMPT})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(OPENMPT_FOUND ON)
|
||||
set(OPENMPT_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/inc)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
set(OPENMPT_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libopenmpt/lib/x86_64/mingw -lopenmpt")
|
||||
else() # 32-bit
|
||||
set(OPENMPT_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libopenmpt/lib/x86/mingw -lopenmpt")
|
||||
endif()
|
||||
else()
|
||||
find_package(OPENMPT)
|
||||
endif()
|
||||
if(${OPENMPT_FOUND})
|
||||
set(SRB2_HAVE_OPENMPT ON)
|
||||
add_definitions(-DHAVE_OPENMPT)
|
||||
else()
|
||||
message(WARNING "You have specified that OpenMPT is available but it was not found.")
|
||||
endif()
|
||||
# add toggle for this
|
||||
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_compile_definitions(SRB2SDL2 PRIVATE -DUSE_STUN)
|
||||
if(SRB2_CONFIG_ENABLE_DISCORDRPC)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE DiscordRPC::DiscordRPC)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_DISCORDRPC)
|
||||
target_sources(SRB2SDL2 PRIVATE discord.c)
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_LIBBACKTRACE})
|
||||
target_link_libraries(SRB2SDL2 PRIVATE libbacktrace)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_LIBBACKTRACE)
|
||||
endif()
|
||||
|
||||
# FIXME macOS does not support C11 threads.h
|
||||
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
||||
set(SRB2_HAVE_THREADS ON)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_ZLIB})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(ZLIB_FOUND ON)
|
||||
set(ZLIB_COMPAT ON)
|
||||
set(WITH_GTEST OFF)
|
||||
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/zlib)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
set(ZLIB_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/zlib/win32 -lz64")
|
||||
@@ -419,9 +152,9 @@ if(${SRB2_CONFIG_HAVE_ZLIB})
|
||||
endif()
|
||||
if(${ZLIB_FOUND})
|
||||
set(SRB2_HAVE_ZLIB ON)
|
||||
add_definitions(-DHAVE_ZLIB)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB)
|
||||
else()
|
||||
message(WARNING "You have specified that ZLIB is available but it was not found. SRB2Kart may not compile correctly.")
|
||||
message(WARNING "You have specified that ZLIB is available but it was not found. SRB2Kart-Saturn may not compile correctly.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -440,129 +173,292 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
|
||||
endif()
|
||||
if(${PNG_FOUND})
|
||||
set(SRB2_HAVE_PNG ON)
|
||||
add_definitions(-DHAVE_PNG)
|
||||
add_definitions(-D_LARGEFILE64_SOURCE)
|
||||
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_PNG)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -D_LARGEFILE64_SOURCE)
|
||||
else()
|
||||
message(WARNING "You have specified that PNG is available but it was not found. SRB2Kart may not compile correctly.")
|
||||
message(WARNING "You have specified that PNG is available but it was not found. SRB2Kart-Saturn may not compile correctly.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_CURL})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(CURL_FOUND ON)
|
||||
set(CURL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/curl/include)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
set(CURL_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/curl/lib64 -lcurl")
|
||||
else() # 32-bit
|
||||
set(CURL_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/curl/lib32 -lcurl")
|
||||
if("${SRB2_CONFIG_HWRENDER}")
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
|
||||
add_subdirectory(hardware)
|
||||
|
||||
if("${SRB2_CONFIG_STATIC_OPENGL}")
|
||||
find_package(OpenGL)
|
||||
if(${OPENGL_FOUND})
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DSTATIC_OPENGL)
|
||||
else()
|
||||
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.")
|
||||
endif()
|
||||
else()
|
||||
find_package(CURL)
|
||||
endif()
|
||||
if(${CURL_FOUND})
|
||||
set(SRB2_HAVE_CURL ON)
|
||||
add_definitions(-DHAVE_CURL)
|
||||
else()
|
||||
message(WARNING "You have specified that CURL is available but it was not found. SRB2Kart may not compile correctly.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HWRENDER})
|
||||
add_definitions(-DHWRENDER)
|
||||
set(SRB2_HWRENDER_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_shaders.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.c
|
||||
# TODO: build this with the game
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows AND ${CMAKE_C_COMPILER_ID} MATCHES "GNU" AND ${SRB2_SYSTEM_BITS} EQUAL 32)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/lib/win32/libexchndl.a"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/lib/win32/libmgwhelp.a"
|
||||
)
|
||||
|
||||
set (SRB2_HWRENDER_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_shaders.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_gl.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.h
|
||||
)
|
||||
|
||||
set(SRB2_R_OPENGL_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.c
|
||||
)
|
||||
|
||||
set(SRB2_R_OPENGL_HEADERS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.h
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
|
||||
find_package(OpenGL)
|
||||
if(${OPENGL_FOUND})
|
||||
add_definitions(-DHWRENDER)
|
||||
add_definitions(-DSTATIC_OPENGL)
|
||||
else()
|
||||
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HWRENDER})
|
||||
if(${SRB2_CONFIG_USE_FBO_OGL})
|
||||
set(SRB2_USE_FBO_OGL ON)
|
||||
add_definitions(-DUSE_FBO_OGL)
|
||||
endif()
|
||||
target_include_directories(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/include")
|
||||
endif()
|
||||
|
||||
# Targets
|
||||
|
||||
# If using CCACHE, then force it.
|
||||
# https://github.com/Cockatrice/Cockatrice/pull/3052/files
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
||||
get_property(RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
|
||||
if(RULE_LAUNCH_COMPILE)
|
||||
MESSAGE(STATUS "Force enabling CCache usage under macOS")
|
||||
# Set up wrapper scripts
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/launch-c.in ${CMAKE_BINARY_DIR}/launch-c)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/launch-cxx.in ${CMAKE_BINARY_DIR}/launch-cxx)
|
||||
execute_process(COMMAND chmod a+rx
|
||||
"${CMAKE_BINARY_DIR}/launch-c"
|
||||
"${CMAKE_BINARY_DIR}/launch-cxx")
|
||||
|
||||
# Set Xcode project attributes to route compilation through our scripts
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/launch-c")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/launch-cxx")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/launch-c")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/launch-cxx")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Compatibility flag with later versions of GCC
|
||||
# We should really fix our code to not need this
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields)
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|x64|amd64|AMD64|em64t|EM64T)")
|
||||
target_compile_options(SRB2SDL2 PRIVATE -mno-ms-bitfields)
|
||||
endif()
|
||||
target_compile_options(SRB2SDL2 PRIVATE -Wno-trigraphs)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
|
||||
endif()
|
||||
# TODO: fix prng and P_CreateBlockmap overflow at some point
|
||||
target_compile_options(SRB2SDL2 PRIVATE -fwrapv)
|
||||
|
||||
add_definitions(-DCMAKECONFIG)
|
||||
|
||||
#add_library(SRB2Core STATIC
|
||||
# ${SRB2_CORE_SOURCES}
|
||||
# ${SRB2_CORE_HEADERS}
|
||||
# ${SRB2_CORE_RENDER_SOURCES}
|
||||
# ${SRB2_CORE_GAME_SOURCES}
|
||||
# ${SRB2_LUA_SOURCES}
|
||||
# ${SRB2_LUA_HEADERS}
|
||||
# ${SRB2_BLUA_SOURCES}
|
||||
# ${SRB2_BLUA_HEADERS}
|
||||
#)
|
||||
|
||||
if(${SRB2_CONFIG_DEDICATED})
|
||||
add_subdirectory(dedicated)
|
||||
if (${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||
target_compile_options(SRB2SDL2 PRIVATE -O0)
|
||||
target_compile_options(SRB2SDL2 PRIVATE -g)
|
||||
else()
|
||||
add_subdirectory(sdl)
|
||||
target_compile_options(SRB2SDL2 PRIVATE -O3)
|
||||
target_compile_options(SRB2SDL2 PRIVATE -g1) #should be enough for libbacktrace
|
||||
endif()
|
||||
|
||||
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
|
||||
message(FATAL_ERROR "There are no targets available to build an SRB2Kart executable. :(")
|
||||
# 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
|
||||
-Wextra
|
||||
-Wno-trigraphs
|
||||
-W # Was controlled by RELAXWARNINGS
|
||||
-Wfloat-equal
|
||||
-Wundef
|
||||
-Wpointer-arith
|
||||
-Wbad-function-cast
|
||||
-Wcast-qual
|
||||
-Wcast-align # Was controlled by NOCASTALIGNWARN
|
||||
-Wwrite-strings
|
||||
-Wsign-compare
|
||||
-Wno-comment
|
||||
-Wno-alloc-size-larger-than # holy shit, be quiet up GCC
|
||||
-Wmissing-prototypes
|
||||
-Wmissing-declarations
|
||||
-Wmissing-noreturn
|
||||
-Wnested-externs
|
||||
-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
|
||||
>
|
||||
|
||||
$<$<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
|
||||
-Wextra
|
||||
-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
|
||||
>
|
||||
|
||||
# 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
|
||||
>
|
||||
|
||||
# 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
|
||||
>
|
||||
)
|
||||
endif()
|
||||
|
||||
# Link warnings configuration
|
||||
target_link_options(SRB2SDL2 PRIVATE
|
||||
$<$<C_COMPILER_ID:GNU>:
|
||||
# -Wl,--as-needed - Was controlled by NOLDWARNING
|
||||
>
|
||||
)
|
||||
|
||||
if(${SRB2_CONFIG_DEV_BUILD})
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DDEVELOP)
|
||||
endif()
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DCMAKECONFIG)
|
||||
|
||||
# Misc. build options from Makefiles
|
||||
if(SRB2_CONFIG_DEBUGMODE)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -D_DEBUG -DZDEBUG -DPARANOIA -DRANGECHECK -DPACKETDROP)
|
||||
endif()
|
||||
if(SRB2_CONFIG_MOBJCONSISTANCY)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DMOBJCONSISTANCY)
|
||||
endif()
|
||||
if(SRB2_CONFIG_PACKETDROP)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DPACKETDROP)
|
||||
endif()
|
||||
if(SRB2_CONFIG_ZDEBUG)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DZDEBUG)
|
||||
endif()
|
||||
if(SRB2_CONFIG_PROFILEMODE AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
||||
target_compile_options(SRB2SDL2 PRIVATE -pg)
|
||||
target_link_options(SRB2SDL2 PRIVATE -pg)
|
||||
endif()
|
||||
|
||||
if(SRB2_CONFIG_LTO AND NOT SRB2_CONFIG_DEBUGMODE)
|
||||
set_property(TARGET SRB2SDL2 PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_SCREENFBO} AND NOT ${SRB2_CONFIG_STATIC_OPENGL})
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DUSE_FBO_OGL)
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_SATURNPAK})
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DDOSATURNPAK)
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_SATURNJOIN})
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DDOSATURNJOIN)
|
||||
endif()
|
||||
|
||||
# strip debug symbols into separate file when using gcc or clang.
|
||||
# to be consistent with Makefile, don't generate for OS X.
|
||||
if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT ("${CMAKE_SYSTEM_NAME}" MATCHES Darwin))
|
||||
if((${CMAKE_BUILD_TYPE} MATCHES Debug) OR (${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo))
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||
set(OBJCOPY_ONLY_KEEP_DEBUG "--only-keep-debug")
|
||||
endif()
|
||||
message(STATUS "Will make separate debug symbols in *.debug")
|
||||
add_custom_command(TARGET SRB2SDL2 POST_BUILD
|
||||
COMMAND ${CMAKE_OBJCOPY} ${OBJCOPY_ONLY_KEEP_DEBUG} $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
|
||||
# mold linker: .gnu_debuglink is present by default, so --add-gnu-debuglink would fail
|
||||
COMMAND ${CMAKE_OBJCOPY} --strip-debug --remove-section=.gnu_debuglink $<TARGET_FILE:SRB2SDL2>
|
||||
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# copy DLLs to bin/ directory if building internal shared on windows
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL Windows AND NOT "${SRB2_CONFIG_INTERNAL_LIBRARIES}" AND "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
|
||||
set(ADDITIONAL_DLLS "")
|
||||
if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# also copy implicitly linked system libraries
|
||||
get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH)
|
||||
if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU)
|
||||
list(APPEND ADDITIONAL_DLLS
|
||||
"libgcc_s_dw2-1.dll"
|
||||
"libstdc++-6.dll"
|
||||
"libwinpthread-1.dll"
|
||||
)
|
||||
else()
|
||||
list(APPEND ADDITIONAL_DLLS
|
||||
"libunwind.dll"
|
||||
"libc++.dll"
|
||||
"libwinpthread-1.dll"
|
||||
)
|
||||
endif()
|
||||
list(TRANSFORM ADDITIONAL_DLLS PREPEND "${MINGW_BIN_PATH}/")
|
||||
endif()
|
||||
add_custom_command(TARGET SRB2SDL2 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_RUNTIME_DLLS:SRB2SDL2>
|
||||
${ADDITIONAL_DLLS}
|
||||
|
||||
$<TARGET_FILE_DIR:SRB2SDL2>
|
||||
COMMAND_EXPAND_LISTS
|
||||
COMMENT "Copying runtime DLLs"
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1 @@
|
||||
target_sourcefile(c)
|
||||
+7
-4
@@ -237,10 +237,13 @@ void COM_ImmedExecute(const char *ptext)
|
||||
char line[1024] = "";
|
||||
INT32 quotes;
|
||||
|
||||
while (i < strlen(ptext))
|
||||
const size_t txtlength = strlen(ptext);
|
||||
|
||||
while (i < txtlength)
|
||||
{
|
||||
quotes = 0;
|
||||
for (j = 0; i < strlen(ptext); i++,j++)
|
||||
|
||||
for (j = 0; i < txtlength; i++,j++)
|
||||
{
|
||||
if (ptext[i] == '\"' && !quotes && i > 0 && ptext[i-1] != ' ') // Malformed command
|
||||
return;
|
||||
@@ -652,7 +655,7 @@ static void COM_Alias_f(void)
|
||||
CONS_Printf(M_GetText("All aliases that start with \x87'%s'\x80 are:\n"), begin);
|
||||
|
||||
int count = 0;
|
||||
for (cmdalias_t *head = com_alias; head->next != NULL; head = head->next)
|
||||
for (cmdalias_t *head = com_alias; head != NULL; head = head->next)
|
||||
{
|
||||
if (strncmp(begin, head->name, szBegin) == 0)
|
||||
{
|
||||
@@ -673,7 +676,7 @@ static void COM_Alias_f(void)
|
||||
/* Display alias subtext, show all aliases. */
|
||||
CONS_Printf(M_GetText("alias <name> <command>: create a shortcut command that executes other command(s)\n"));
|
||||
|
||||
for (cmdalias_t *head = com_alias; head->next != NULL; head = head->next)
|
||||
for (cmdalias_t *head = com_alias; head != NULL; head = head->next)
|
||||
{
|
||||
CONS_Printf(alias_format, head->name, head->value);
|
||||
}
|
||||
|
||||
+3
-3
@@ -13,13 +13,13 @@
|
||||
#ifndef __COMMAND_H__
|
||||
#define __COMMAND_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include "doomdef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "doomdef.h"
|
||||
|
||||
//===================================
|
||||
// Command buffer & command execution
|
||||
//===================================
|
||||
|
||||
+3
-38
@@ -11,21 +11,6 @@
|
||||
|
||||
#ifdef CMAKECONFIG
|
||||
|
||||
// Base SRB2 hashes
|
||||
#define ASSET_HASH_SRB2_SRB "${SRB2_ASSET_srb2.srb_HASH}"
|
||||
#ifdef USE_PATCH_DTA
|
||||
#define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}"
|
||||
#endif
|
||||
|
||||
// SRB2Kart-specific hashes
|
||||
#define ASSET_HASH_GFX_KART "${SRB2_ASSET_gfx.kart_HASH}"
|
||||
#define ASSET_HASH_TEXTURES_KART "${SRB2_ASSET_textures.kart_HASH}"
|
||||
#define ASSET_HASH_CHARS_KART "${SRB2_ASSET_chars.kart_HASH}"
|
||||
#define ASSET_HASH_MAPS_KART "${SRB2_ASSET_maps.kart_HASH}"
|
||||
#ifdef USE_PATCH_KART
|
||||
#define ASSET_HASH_PATCH_KART "00000000000000000000000000000000"
|
||||
#endif
|
||||
|
||||
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
|
||||
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
|
||||
|
||||
@@ -33,30 +18,10 @@
|
||||
|
||||
#else
|
||||
|
||||
/* Manually defined asset hashes for non-CMake builds
|
||||
* Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb
|
||||
* Last updated 2018 / 12 / 23 - SRB2 v2.1.22 - patch.dta
|
||||
* Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets
|
||||
* Last updated 2020 / 08 / 30 - Kart v1.3 - patch.kart
|
||||
* Last updated 2022 / 08 / 16 - Kart v1.4 - Main assets
|
||||
* Last updated 2022 / 08 / 19 - Kart v1.5 - gfx.kart
|
||||
* Last updated 2022 / 11 / 01 - Kart v1.6 - gfx.kart, maps.kart
|
||||
*/
|
||||
#define SRB2_COMP_REVISION ""
|
||||
#define SRB2_COMP_BRANCH ""
|
||||
|
||||
// Base SRB2 hashes
|
||||
#define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7"
|
||||
#ifdef USE_PATCH_DTA
|
||||
#define ASSET_HASH_PATCH_DTA "b04fd9624bfd94dc96dcf4f400f7deb4"
|
||||
#endif
|
||||
|
||||
// SRB2Kart-specific hashes
|
||||
#define ASSET_HASH_GFX_KART "06f86ee16136eb8a7043b15001797034"
|
||||
#define ASSET_HASH_TEXTURES_KART "abb53d56aba47c3a8cb0f764da1c8b80"
|
||||
#define ASSET_HASH_CHARS_KART "e2c428347dde52858a3dacd29fc5b964"
|
||||
#define ASSET_HASH_MAPS_KART "d051e55141ba736582228c456953cd98"
|
||||
#ifdef USE_PATCH_KART
|
||||
#define ASSET_HASH_PATCH_KART "00000000000000000000000000000000"
|
||||
#endif
|
||||
#define CMAKE_ASSETS_DIR ""
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+13
-2
@@ -1457,12 +1457,14 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
V_DrawFill(BASEVIDWIDTH/2-128, BASEVIDHEIGHT-58, dldlength, 8, 160);
|
||||
|
||||
memset(tempname, 0, sizeof(tempname));
|
||||
|
||||
// offset filename to just the name only part
|
||||
filename += strlen(filename) - nameonlylength(filename);
|
||||
const size_t filenamelength = strlen(filename);
|
||||
|
||||
if (strlen(filename) > sizeof(tempname)-1) // too long to display fully
|
||||
if (filenamelength > sizeof(tempname)-1) // too long to display fully
|
||||
{
|
||||
size_t endhalfpos = strlen(filename)-10;
|
||||
size_t endhalfpos = filenamelength-10;
|
||||
// display as first 14 chars + ... + last 10 chars
|
||||
// which should add up to 27 if our math(s) is correct
|
||||
snprintf(tempname, sizeof(tempname), "%.14s...%.10s", filename, filename+endhalfpos);
|
||||
@@ -1775,6 +1777,9 @@ static void SV_SendPlayerInfo(INT32 node)
|
||||
|
||||
static void SV_SendMapIcon(INT32 node)
|
||||
{
|
||||
if (node == 0)
|
||||
return;
|
||||
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
const char *map = va("%sP", G_BuildMapName(gamemap));
|
||||
@@ -3472,6 +3477,9 @@ void CL_Reset(void)
|
||||
|
||||
memset(player_muted, 0, sizeof(player_muted));
|
||||
|
||||
for (INT32 i = 0; i < MAXPLAYERS; ++i)
|
||||
playerinfo[i].node = 255;
|
||||
|
||||
// D_StartTitle should get done now, but the calling function will handle it
|
||||
}
|
||||
|
||||
@@ -4260,6 +4268,9 @@ void D_ClientServerInit(void)
|
||||
#endif
|
||||
D_LoadBan(false);
|
||||
|
||||
for (INT32 i = 0; i < MAXPLAYERS; ++i)
|
||||
playerinfo[i].node = 255;
|
||||
|
||||
gametic = 0;
|
||||
localgametic = 0;
|
||||
|
||||
|
||||
@@ -80,6 +80,31 @@
|
||||
|
||||
#include "lua_script.h"
|
||||
|
||||
/* Manually defined asset hashes for non-CMake builds
|
||||
* Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb
|
||||
* Last updated 2018 / 12 / 23 - SRB2 v2.1.22 - patch.dta
|
||||
* Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets
|
||||
* Last updated 2020 / 08 / 30 - Kart v1.3 - patch.kart
|
||||
* Last updated 2022 / 08 / 16 - Kart v1.4 - Main assets
|
||||
* Last updated 2022 / 08 / 19 - Kart v1.5 - gfx.kart
|
||||
* Last updated 2022 / 11 / 01 - Kart v1.6 - gfx.kart, maps.kart
|
||||
*/
|
||||
|
||||
// Base SRB2 hashes
|
||||
#define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7"
|
||||
#ifdef USE_PATCH_DTA
|
||||
#define ASSET_HASH_PATCH_DTA "b04fd9624bfd94dc96dcf4f400f7deb4"
|
||||
#endif
|
||||
|
||||
// SRB2Kart-specific hashes
|
||||
#define ASSET_HASH_GFX_KART "06f86ee16136eb8a7043b15001797034"
|
||||
#define ASSET_HASH_TEXTURES_KART "abb53d56aba47c3a8cb0f764da1c8b80"
|
||||
#define ASSET_HASH_CHARS_KART "e2c428347dde52858a3dacd29fc5b964"
|
||||
#define ASSET_HASH_MAPS_KART "d051e55141ba736582228c456953cd98"
|
||||
#ifdef USE_PATCH_KART
|
||||
#define ASSET_HASH_PATCH_KART "00000000000000000000000000000000"
|
||||
#endif
|
||||
|
||||
#ifdef CMAKECONFIG
|
||||
#include "config.h"
|
||||
#else
|
||||
|
||||
+2
-2
@@ -997,6 +997,8 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_litesteer[i]);
|
||||
|
||||
CV_RegisterVar(&cv_autoaccel[i]);
|
||||
|
||||
CV_RegisterVar(&cv_usejoystick[i]);
|
||||
CV_RegisterVar(&cv_joyscale[i]);
|
||||
CV_RegisterVar(&cv_rumble[i]);
|
||||
@@ -4749,8 +4751,6 @@ static void Command_LocateLump_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
#define MAXDOOMEDNUM 4095
|
||||
|
||||
static void Command_ListDoomednums_f(void)
|
||||
{
|
||||
INT16 i, j, k = 0, l = 0;
|
||||
|
||||
+12
-7
@@ -1079,12 +1079,14 @@ void CloseNetFile(void)
|
||||
|
||||
// Receiving a file?
|
||||
for (i = 0; i < MAX_WADFILES; i++)
|
||||
{
|
||||
if (fileneeded[i].status == FS_DOWNLOADING && fileneeded[i].file)
|
||||
{
|
||||
fclose(fileneeded[i].file);
|
||||
// File is not complete delete it
|
||||
remove(fileneeded[i].filename);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove PT_FILEFRAGMENT from acknowledge list
|
||||
Net_AbortPacketType(PT_FILEFRAGMENT);
|
||||
@@ -1098,17 +1100,16 @@ void nameonly(char *s)
|
||||
void *ns;
|
||||
|
||||
for (j = strlen(s); j != (size_t)-1; j--)
|
||||
{
|
||||
if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/'))
|
||||
{
|
||||
ns = &(s[j+1]);
|
||||
len = strlen(ns);
|
||||
#if 0
|
||||
memcpy(s, ns, len+1);
|
||||
#else
|
||||
memmove(s, ns, len+1);
|
||||
#endif
|
||||
memmove(s, ns, len+1);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the length in characters of the last element of a path.
|
||||
@@ -1162,8 +1163,12 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
|
||||
filestatus_t homecheck; // store result of last file search
|
||||
boolean badmd5 = false; // store whether md5 was bad from either of the first two searches (if nothing was found in the third)
|
||||
|
||||
// skip for startup, our mainwads wont be in there
|
||||
if (loaded_config)
|
||||
// see IdentifyVersion
|
||||
// Iwads skip findfile due to passing fullpath to W_OpenWadFile
|
||||
#if 0
|
||||
// skip for Iwads, as they wont be in there
|
||||
if (!startupiwadcount)
|
||||
#endif
|
||||
{
|
||||
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
|
||||
{
|
||||
|
||||
@@ -178,10 +178,6 @@ static char returnWadPath[256];
|
||||
|
||||
#include "../m_argv.h"
|
||||
|
||||
#ifdef MAC_ALERT
|
||||
#include "macosx/mac_alert.h"
|
||||
#endif
|
||||
|
||||
#include "../d_main.h"
|
||||
|
||||
#if !defined(NOMUMBLE) && defined(HAVE_MUMBLE)
|
||||
|
||||
+7
-7
@@ -40,6 +40,13 @@
|
||||
#define ASMCALL
|
||||
#endif
|
||||
|
||||
#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
|
||||
#ifdef __cplusplus
|
||||
#include <cmath>
|
||||
#else
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -51,13 +58,6 @@ extern "C" {
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
|
||||
#ifdef __cplusplus
|
||||
#include <cmath>
|
||||
#else
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ FUNCINLINE static ATTRINLINE boolean fasticmp(const char *s, const char *c)
|
||||
}
|
||||
|
||||
// case-sensitive of the above
|
||||
FUNCINLINE static ATTRINLINE boolean fastcmp(const char *s, const char *c)
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC boolean fastcmp(const char *s, const char *c)
|
||||
{
|
||||
for (; *s && *s == *c; s++, c++) ;
|
||||
return (*s == *c); // make sure both strings ended
|
||||
@@ -18,7 +18,7 @@ FUNCINLINE static ATTRINLINE boolean fastcmp(const char *s, const char *c)
|
||||
|
||||
// length-limited of the above
|
||||
// only true if both strings are at least l characters long AND match, case-sensitively!
|
||||
FUNCINLINE static ATTRINLINE boolean fastncmp(const char *s, const char *c, UINT16 l)
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC boolean fastncmp(const char *s, const char *c, UINT16 l)
|
||||
{
|
||||
for (; *s && *s == *c && --l; s++, c++) ;
|
||||
return !l; // make sure you reached the end
|
||||
|
||||
+72
-33
@@ -55,6 +55,8 @@
|
||||
#include "k_stats.h" // SRB2kart
|
||||
#include "r_fps.h" // frame interpolation/uncapped
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
#endif
|
||||
@@ -2401,49 +2403,69 @@ static long G_GetCreationTime(char *filepath)
|
||||
|
||||
static char *G_GetDemoDate(menudemo_t *pdemo)
|
||||
{
|
||||
char *datetime;
|
||||
datetime = malloc(sizeof(pdemo->date)); // mallocma balls
|
||||
|
||||
// no mallocma balls... :c
|
||||
if (!datetime)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *endPos = NULL;
|
||||
static char datetime[11];
|
||||
time_t file_time = 0;
|
||||
const char *format = NULL;
|
||||
struct tm *tm_buf = NULL;
|
||||
CLEANUP(pfree) char *filename = NULL;
|
||||
|
||||
// get le filepath
|
||||
char *filename;
|
||||
filename = strdup(pdemo->filepath);
|
||||
|
||||
#if defined (_WIN32)
|
||||
if (!filename)
|
||||
{
|
||||
// if we cant get a filename try just getting the file create time
|
||||
#if defined (_WIN32)
|
||||
// if we cant get a filename try just getting the file creation time
|
||||
file_time = G_GetCreationTime(pdemo->filepath);
|
||||
goto skipfilenametime;
|
||||
}
|
||||
#else
|
||||
if (!filename)
|
||||
{
|
||||
free(datetime);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// get the actual filename Zzz...
|
||||
nameonly(filename);
|
||||
|
||||
// convert it to long Zzz....
|
||||
file_time = strtol(filename, NULL, 10);
|
||||
free(filename); // dont need this anymore a
|
||||
// the first 10 characters of a replay name usually is a unix timestamp
|
||||
|
||||
// not long enough to contain a valid timestamp
|
||||
if (strlen(filename) < 10)
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
// try to get file creation time
|
||||
file_time = G_GetCreationTime(pdemo->filepath);
|
||||
goto skipfilenametime;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef AVOID_ERRNO
|
||||
errno = 0;
|
||||
#endif
|
||||
// get the timestamp as actual numbers lul
|
||||
file_time = strtol(filename, &endPos, 10);
|
||||
|
||||
if (endPos == filename // Empty string
|
||||
#ifndef AVOID_ERRNO
|
||||
|| errno == ERANGE // Number out-of-range
|
||||
#endif
|
||||
|| file_time < 0) // Number is not positive
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
// just try and get the creation time then
|
||||
file_time = G_GetCreationTime(pdemo->filepath);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (_WIN32)
|
||||
skipfilenametime:
|
||||
#endif
|
||||
|
||||
// then throw it into localtime to get an actual human readable format lmao
|
||||
struct tm *tm_buf = NULL;
|
||||
tm_buf = localtime(&file_time);
|
||||
|
||||
// cant believe we ended up in 1970
|
||||
@@ -2456,14 +2478,10 @@ skipfilenametime:
|
||||
tm_buf = localtime(&file_time);
|
||||
|
||||
if (tm_buf == NULL || tm_buf->tm_year <= 110)
|
||||
{
|
||||
free(datetime);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
goto gotcreationtime;
|
||||
#else
|
||||
free(datetime);
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
@@ -2472,17 +2490,27 @@ skipfilenametime:
|
||||
gotcreationtime:
|
||||
#endif
|
||||
|
||||
const char *format;
|
||||
|
||||
// US ppl are special (:
|
||||
if (cv_demodateformat.value == 2)
|
||||
format = "%m.%d.%Y";
|
||||
else if (cv_demodateformat.value == 1)
|
||||
format = "%d.%m.%Y";
|
||||
else
|
||||
format = strstr(setlocale(LC_TIME, NULL), "en_US") ? "%m.%d.%Y" : "%d.%m.%Y";
|
||||
{
|
||||
const char *locale = setlocale(LC_TIME, NULL);
|
||||
|
||||
strftime(datetime, sizeof(pdemo->date), format, tm_buf);
|
||||
if (locale == NULL)
|
||||
format = "%d.%m.%Y"; // fallback to non US format
|
||||
else if (strstr(locale, "en_US"))
|
||||
format = "%m.%d.%Y";
|
||||
else
|
||||
format = "%d.%m.%Y";
|
||||
}
|
||||
|
||||
if (strftime(datetime, sizeof(datetime), format, tm_buf) == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return datetime;
|
||||
}
|
||||
@@ -2491,6 +2519,7 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
|
||||
{
|
||||
UINT8 infobuffer[96], *info_p;
|
||||
UINT16 pdemoversion;
|
||||
char *demodate = NULL;
|
||||
size_t count;
|
||||
|
||||
FILE *handle = fopen(pdemo->filepath, "rb");
|
||||
@@ -2529,13 +2558,13 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
|
||||
memcpy(pdemo->title, info_p, 64);
|
||||
|
||||
// demo date
|
||||
char *demodate;
|
||||
demodate = G_GetDemoDate(pdemo);
|
||||
|
||||
if (demodate)
|
||||
strncpy(pdemo->date, demodate, sizeof(pdemo->date));
|
||||
{
|
||||
strlcpy(pdemo->date, demodate, sizeof(pdemo->date));
|
||||
}
|
||||
|
||||
free(demodate);
|
||||
break;
|
||||
#ifdef DEMO_COMPAT_100
|
||||
case 0x0001:
|
||||
@@ -2795,7 +2824,7 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
demobuf.p += 4; // Extrainfo location
|
||||
|
||||
// ...*map* not loaded?
|
||||
if (!gamemap || (gamemap > NUMMAPS) || !mapheaderinfo[gamemap-1] || !(mapheaderinfo[gamemap-1]->menuflags & LF2_EXISTSHACK))
|
||||
if (!gamemap || (gamemap > NUMMAPS) || (W_CheckNumForName(G_BuildMapName(gamemap)) == LUMPERROR))
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
@@ -2836,6 +2865,16 @@ void G_DoPlayDemo(char *defdemoname)
|
||||
return;
|
||||
}
|
||||
|
||||
// ...*map* not loaded?
|
||||
if (!gamemap || (gamemap > NUMMAPS) || !mapheaderinfo[gamemap-1] || !(mapheaderinfo[gamemap-1]->menuflags & LF2_EXISTSHACK))
|
||||
{
|
||||
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
|
||||
CONS_Alert(CONS_ERROR, "%s", msg);
|
||||
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
|
||||
G_ResetDemoPlayback();
|
||||
return;
|
||||
}
|
||||
|
||||
// Set color
|
||||
for (i = 0; i < MAXSKINCOLORS; i++)
|
||||
{
|
||||
|
||||
+74
-8
@@ -454,6 +454,14 @@ consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS] = {
|
||||
{"litesteer4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
//static CV_PossibleValue_t autoaccelcons_t[] = {{0, "Off"}, {1, "Manual"}, {2, "Automatic"}, {0, NULL}};
|
||||
consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS] = {
|
||||
{"autoaccel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"autoaccel2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"autoaccel3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"autoaccel4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -800,6 +808,10 @@ static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
|
||||
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
|
||||
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
|
||||
|
||||
//
|
||||
// G_HandleLocalDriftturn
|
||||
// Hack for Lua menus that check directional inputs with driftturn
|
||||
//
|
||||
static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer)
|
||||
{
|
||||
INT32 axis = 0;
|
||||
@@ -862,9 +874,8 @@ static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer)
|
||||
//
|
||||
static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
|
||||
{
|
||||
boolean moveinput = false;
|
||||
INT32 axis = 0;
|
||||
const boolean usejoystick = (cv_usejoystick[(ssplayer-1)].value);
|
||||
const boolean usejoystick = cv_usejoystick[(ssplayer-1)].value;
|
||||
|
||||
// check for inputs and return button commands
|
||||
// for stuff like joining with item button, saltyhop, honking, etc.
|
||||
@@ -899,15 +910,11 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
|
||||
|
||||
#undef CHECKINPUT
|
||||
|
||||
moveinput = (InputDown(gc_turnleft, ssplayer) || InputDown(gc_turnright, ssplayer)
|
||||
|| InputDown(gc_aimforward, ssplayer) || InputDown(gc_aimbackward, ssplayer) ||
|
||||
(usejoystick && JoyAxis(AXISAIM, ssplayer) != 0) || (usejoystick && JoyAxis(AXISTURN, ssplayer) != 0));
|
||||
|
||||
axis = JoyAxis(AXISLOOKBACK, ssplayer);
|
||||
camspin[ssplayer-1] = (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0));
|
||||
|
||||
// Reset to our spec player if we watch someone else.
|
||||
if ((moveinput || cmd->buttons)
|
||||
if ((cmd->driftturn || cmd->buttons)
|
||||
&& displayplayers[0] != consoleplayer && ssplayer == 1)
|
||||
{
|
||||
if (cv_director.value)
|
||||
@@ -919,6 +926,63 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_HandleAutoAcceleration
|
||||
//
|
||||
static void G_HandleAutoAcceleration(ticcmd_t *cmd, player_t *player, UINT8 forplayer)
|
||||
{
|
||||
if (!cv_autoaccel[forplayer].value)
|
||||
return;
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
return;
|
||||
|
||||
// dont accel before and during countdown
|
||||
if (leveltime <= starttime)
|
||||
return;
|
||||
|
||||
// dont do this in menus or when console is onscreen
|
||||
if (menuactive || CON_Ready())
|
||||
return;
|
||||
|
||||
// gotta have a player that aint respawning
|
||||
if (!player->mo || player->kartstuff[k_respawn])
|
||||
return;
|
||||
|
||||
// dont need for "finished" players
|
||||
if (player->exiting || (player->pflags & PF_TIMEOVER))
|
||||
return;
|
||||
|
||||
// dont do during spinout
|
||||
if (player->kartstuff[k_spinouttimer])
|
||||
return;
|
||||
|
||||
// spectators and freecam dont need special handling, see G_BuildTiccmd
|
||||
|
||||
if (cmd->buttons & BT_BRAKE)
|
||||
{
|
||||
if (cmd->buttons & BT_DRIFT ||
|
||||
player->kartstuff[k_sneakertimer] ||
|
||||
player->kartstuff[k_squishedtimer])
|
||||
{
|
||||
cmd->forwardmove = (SINT8)forwardmove[0];
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// allows us to drive backwards if we need to
|
||||
if (cmd->forwardmove > 0)
|
||||
cmd->forwardmove = 0;
|
||||
cmd->buttons &= ~BT_ACCELERATE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd->forwardmove = (SINT8)forwardmove[1];
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_BuildTiccmd
|
||||
// Builds a ticcmd from all of the available inputs
|
||||
@@ -1066,7 +1130,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || player->kartstuff[k_sneakertimer])
|
||||
{
|
||||
cmd->buttons |= BT_ACCELERATE;
|
||||
forward = forwardmove[1]; // 50
|
||||
forward = forwardmove[1]; // 50
|
||||
}
|
||||
else if (analogjoystickmove && axis > 0)
|
||||
{
|
||||
@@ -1147,6 +1211,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
cmd->sidemove = (SINT8)(cmd->sidemove + side);
|
||||
}
|
||||
|
||||
G_HandleAutoAcceleration(cmd, player, forplayer);
|
||||
|
||||
//{ SRB2kart - Drift support
|
||||
// Not grouped with the rest of turn stuff because it needs to know what buttons you're pressing for rubber-burn turn
|
||||
// limit turning to angleturn[1] to stop mouselook letting you look too fast
|
||||
|
||||
@@ -74,6 +74,8 @@ extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
||||
// Hud offsets
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
target_sourcefile(c)
|
||||
+101
-54
@@ -14,6 +14,7 @@
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include "../doomstat.h"
|
||||
#include "../doomdef.h"
|
||||
@@ -1880,6 +1881,7 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
|
||||
// Used for height comparisons and etc across FOFs and slopes
|
||||
fixed_t high1, highslope1, low1, lowslope1;
|
||||
fixed_t high2, highslope2, low2, lowslope2;
|
||||
|
||||
INT32 texnum;
|
||||
|
||||
@@ -1892,19 +1894,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
{
|
||||
for (rover = gl_backsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
boolean bothsides = false;
|
||||
// Skip if it exists on both sectors.
|
||||
ffloor_t * r2;
|
||||
for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
|
||||
if (rover->master == r2->master)
|
||||
{
|
||||
bothsides = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bothsides)
|
||||
continue;
|
||||
|
||||
const ffloortype_e roverflags = rover->flags;
|
||||
|
||||
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || (roverflags & FF_INVERTSIDES))
|
||||
@@ -1916,6 +1905,45 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
|
||||
continue;
|
||||
|
||||
ffloor_t * r2;
|
||||
for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
|
||||
{
|
||||
if (r2->master == rover->master) // Skip if same control line.
|
||||
break;
|
||||
|
||||
const ffloortype_e r2flags = r2->flags;
|
||||
|
||||
if (!(r2flags & FF_EXISTS) || !(r2flags & FF_RENDERSIDES))
|
||||
continue;
|
||||
|
||||
if (rover->flags & FF_EXTRA)
|
||||
{
|
||||
if (!(r2flags & FF_CUTEXTRA))
|
||||
continue;
|
||||
|
||||
if (r2flags & FF_EXTRA && (r2flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG)))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(r2flags & FF_CUTSOLIDS))
|
||||
continue;
|
||||
}
|
||||
|
||||
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
|
||||
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
|
||||
|
||||
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
|
||||
continue;
|
||||
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (r2)
|
||||
continue;
|
||||
|
||||
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
|
||||
|
||||
boolean do_texture_skew;
|
||||
@@ -2052,19 +2080,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
{
|
||||
for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
boolean bothsides = false;
|
||||
// Skip if it exists on both sectors.
|
||||
ffloor_t * r2;
|
||||
for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
|
||||
if (rover->master == r2->master)
|
||||
{
|
||||
bothsides = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bothsides)
|
||||
continue;
|
||||
|
||||
const ffloortype_e roverflags = rover->flags;
|
||||
|
||||
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || !(roverflags & FF_ALLSIDES))
|
||||
@@ -2076,6 +2091,44 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
|
||||
continue;
|
||||
|
||||
ffloor_t * r2;
|
||||
for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
|
||||
{
|
||||
if (r2->master == rover->master) // Skip if same control line.
|
||||
break;
|
||||
|
||||
const ffloortype_e r2flags = r2->flags;
|
||||
|
||||
if (!(r2flags & FF_EXISTS) || !(r2flags & FF_RENDERSIDES))
|
||||
continue;
|
||||
|
||||
if (rover->flags & FF_EXTRA)
|
||||
{
|
||||
if (!(r2flags & FF_CUTEXTRA))
|
||||
continue;
|
||||
|
||||
if (r2flags & FF_EXTRA && (r2flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG)))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(r2flags & FF_CUTSOLIDS))
|
||||
continue;
|
||||
}
|
||||
|
||||
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
|
||||
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
|
||||
|
||||
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
|
||||
continue;
|
||||
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
|
||||
continue;
|
||||
|
||||
break;
|
||||
}
|
||||
if (r2)
|
||||
continue;
|
||||
|
||||
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
|
||||
|
||||
boolean do_texture_skew;
|
||||
@@ -4174,6 +4227,7 @@ static int CompareVisSprites(const void *p1, const void *p2)
|
||||
static void HWR_SortVisSprites(void)
|
||||
{
|
||||
UINT32 i;
|
||||
|
||||
for (i = 0; i < gl_visspritecount; i++)
|
||||
{
|
||||
gl_vsprorder[i] = HWR_GetVisSprite(i);
|
||||
@@ -4242,38 +4296,29 @@ typedef struct
|
||||
|
||||
// initial size of drawnode array
|
||||
#define DRAWNODES_INIT_SIZE 64
|
||||
gl_drawnode_t *drawnodes = NULL;
|
||||
INT32 numdrawnodes = 0;
|
||||
INT32 alloceddrawnodes = 0;
|
||||
// no reason to waste all the allocations since every map will have atleast one translucent thing
|
||||
static std::vector<gl_drawnode_t> drawnodes;
|
||||
|
||||
static void *HWR_CreateDrawNode(gl_drawnode_type_t type)
|
||||
{
|
||||
gl_drawnode_t *drawnode;
|
||||
// if we didnt alloc anything yet, reserve atleast 64 nodes
|
||||
// dont declare with it as we want our size to be 0!
|
||||
drawnodes.reserve(DRAWNODES_INIT_SIZE);
|
||||
|
||||
if (!drawnodes)
|
||||
{
|
||||
alloceddrawnodes = DRAWNODES_INIT_SIZE;
|
||||
drawnodes = static_cast<gl_drawnode_t*>(Z_Malloc(alloceddrawnodes * sizeof(gl_drawnode_t), PU_LEVEL, &drawnodes));
|
||||
}
|
||||
else if (numdrawnodes >= alloceddrawnodes)
|
||||
{
|
||||
alloceddrawnodes *= 2;
|
||||
Z_Realloc(drawnodes, alloceddrawnodes * sizeof(gl_drawnode_t), PU_LEVEL, &drawnodes);
|
||||
}
|
||||
|
||||
drawnode = &drawnodes[numdrawnodes++];
|
||||
drawnode->type = type;
|
||||
drawnodes.emplace_back();
|
||||
drawnodes.back().type = type;
|
||||
|
||||
// not sure if returning different pointers to a union is necessary
|
||||
switch (type)
|
||||
{
|
||||
case DRAWNODE_PLANE:
|
||||
return &drawnode->u.plane;
|
||||
return &drawnodes.back().u.plane;
|
||||
case DRAWNODE_POLYOBJECT_PLANE:
|
||||
return &drawnode->u.polyplane;
|
||||
return &drawnodes.back().u.polyplane;
|
||||
case DRAWNODE_WALL:
|
||||
return &drawnode->u.wall;
|
||||
return &drawnodes.back().u.wall;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -4337,11 +4382,15 @@ static int CompareDrawNodePlanes(const void *p1, const void *p2)
|
||||
// Sorts and renders the list of drawnodes for the scene being rendered.
|
||||
static void HWR_RenderDrawNodes(void)
|
||||
{
|
||||
INT32 i = 0, run_start = 0;
|
||||
size_t i = 0, run_start = 0;
|
||||
static std::vector<INT32> sortindex;
|
||||
|
||||
sortindex.reserve(DRAWNODES_INIT_SIZE);
|
||||
|
||||
// Array for storing the rendering order.
|
||||
// A list of indices into the drawnodes array.
|
||||
INT32 *sortindex;
|
||||
|
||||
const size_t numdrawnodes = drawnodes.size();
|
||||
|
||||
if (!numdrawnodes)
|
||||
return;
|
||||
@@ -4350,7 +4399,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
|
||||
PS_START_TIMING(ps_hw_nodesorttime);
|
||||
|
||||
sortindex = static_cast<INT32*>(Z_Malloc(sizeof(INT32) * numdrawnodes, PU_STATIC, NULL));
|
||||
sortindex.resize(numdrawnodes);
|
||||
|
||||
// Reversed order
|
||||
for (i = 0; i < numdrawnodes; i++)
|
||||
@@ -4366,7 +4415,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
if (drawnodes[sortindex[run_start]].type == DRAWNODE_PLANE)
|
||||
{
|
||||
// found it, now look for run end
|
||||
INT32 run_end; // (inclusive)
|
||||
size_t run_end; // (inclusive)
|
||||
|
||||
for (i = run_start+1; i < numdrawnodes; i++)
|
||||
{
|
||||
@@ -4379,7 +4428,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
if (run_end > run_start) // if there are multiple consecutive planes, not just one
|
||||
{
|
||||
// consecutive run of planes found, now sort it
|
||||
qs22j(sortindex + run_start, run_end - run_start + 1, sizeof(INT32), CompareDrawNodePlanes);
|
||||
qs22j(sortindex.data() + run_start, run_end - run_start + 1, sizeof(INT32), CompareDrawNodePlanes);
|
||||
}
|
||||
|
||||
run_start = run_end + 1; // continue looking for runs coming right after this one
|
||||
@@ -4451,9 +4500,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
|
||||
PS_STOP_TIMING(ps_hw_nodedrawtime);
|
||||
|
||||
numdrawnodes = 0;
|
||||
|
||||
Z_Free(sortindex);
|
||||
drawnodes.clear(); // clear so our size is 0 again!
|
||||
}
|
||||
|
||||
|
||||
|
||||
+24
-17
@@ -596,12 +596,12 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
}
|
||||
|
||||
// Only servers/admins can CSAY.
|
||||
if(!server && !(IsPlayerAdmin(consoleplayer)))
|
||||
if (!server && !(IsPlayerAdmin(consoleplayer)))
|
||||
flags &= ~HU_CSAY;
|
||||
|
||||
// We handle HU_SERVER_SAY, not the caller.
|
||||
flags &= ~HU_SERVER_SAY;
|
||||
if(dedicated && !(flags & HU_CSAY))
|
||||
if (dedicated && !(flags & HU_CSAY))
|
||||
flags |= HU_SERVER_SAY;
|
||||
|
||||
buf[0] = target;
|
||||
@@ -615,17 +615,20 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
strlcat(msg, COM_Argv(ix + usedargs), msgspace);
|
||||
}
|
||||
|
||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
const size_t msglength = strlen(msg);
|
||||
|
||||
if (msglength > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
// what we're gonna do now is check if the node exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
const char *newmsg;
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *nodenum = (char*) malloc(3);
|
||||
CLEANUP(pfree) char *nodenum = (char*) malloc(3);
|
||||
memcpy(nodenum, msg+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
{
|
||||
// check if nodenum[1] is a space
|
||||
if (nodenum[1] == ' ')
|
||||
@@ -634,23 +637,21 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
else
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// I'm very bad at C, I swear I am, additional checks eww!
|
||||
if (spc != 0)
|
||||
{
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
target = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
//CONS_Printf("%d\n", target);
|
||||
|
||||
// check for target player, if it doesn't exist then we can't send the message!
|
||||
@@ -661,12 +662,13 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags)
|
||||
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
|
||||
return;
|
||||
}
|
||||
|
||||
buf[0] = target;
|
||||
newmsg = msg+5+spc;
|
||||
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
|
||||
}
|
||||
|
||||
SendNetXCmd(XD_SAY, buf, strlen(msg) + 1 + msg-buf);
|
||||
SendNetXCmd(XD_SAY, buf, msglength + 1 + msg-buf);
|
||||
}
|
||||
|
||||
/** Send a message to everyone.
|
||||
@@ -917,10 +919,12 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
|
||||
return;
|
||||
}
|
||||
|
||||
const size_t msglength = strlen(msg);
|
||||
|
||||
//check for invalid characters (0x80 or above)
|
||||
{
|
||||
size_t i;
|
||||
const size_t j = strlen(msg);
|
||||
const size_t j = msglength;
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
if (msg[i] & 0x80)
|
||||
@@ -967,7 +971,7 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
|
||||
}
|
||||
|
||||
// Handle "/me" actions, but only in messages to everyone.
|
||||
if (target == 0 && strlen(msg) > 4 && strnicmp(msg, "/me ", 4) == 0)
|
||||
if (target == 0 && msglength > 4 && strnicmp(msg, "/me ", 4) == 0)
|
||||
{
|
||||
msg += 4;
|
||||
action = true;
|
||||
@@ -1149,10 +1153,12 @@ static boolean HU_clearChatSpaces(void)
|
||||
size_t i = 0; // Used to just check our message
|
||||
char c; // current character we're iterating.
|
||||
boolean nothingbutspaces = true;
|
||||
const size_t chatlength = strlen(w_chat_buf);
|
||||
|
||||
for (; i < strlen(w_chat_buf); i++) // iterate through message and eradicate all spaces that don't belong.
|
||||
for (; i < chatlength; i++) // iterate through message and eradicate all spaces that don't belong.
|
||||
{
|
||||
c = w_chat_buf[i];
|
||||
|
||||
if (!c)
|
||||
break; // if there's nothing, it's safe to assume our message has ended, so let's not waste any more time here.
|
||||
|
||||
@@ -1161,6 +1167,7 @@ static boolean HU_clearChatSpaces(void)
|
||||
nothingbutspaces = false;
|
||||
}
|
||||
}
|
||||
|
||||
return nothingbutspaces;
|
||||
}
|
||||
|
||||
@@ -1207,11 +1214,11 @@ static void HU_SendChatMessage(void)
|
||||
return;
|
||||
}
|
||||
|
||||
size_t len = strlen(msg);
|
||||
const size_t msglength = strlen(msg);
|
||||
|
||||
if (len >= 5 && strnicmp(msg, "/mute", 5) == 0) // Used /mute
|
||||
if (msglength >= 5 && strnicmp(msg, "/mute", 5) == 0) // Used /mute
|
||||
{
|
||||
if (len > 6)
|
||||
if (msglength > 6)
|
||||
DoMute(msg+6);
|
||||
else
|
||||
HU_AddChatText("\x82NOTICE: \x80Usage: /mute <name|node>", false);
|
||||
@@ -1219,7 +1226,7 @@ static void HU_SendChatMessage(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (len > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
if (msglength > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
const char *newmsg;
|
||||
@@ -1991,7 +1998,7 @@ static void HU_DrawChat(void)
|
||||
longest_name_length = max(longest_name_length, strlen(player_names[i]));
|
||||
}
|
||||
|
||||
for(i = 0; i < MAXPLAYERS; i++)
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "sounds.h"
|
||||
#include "m_fixed.h"
|
||||
|
||||
#define MAXDOOMEDNUM 4095
|
||||
|
||||
// dehacked.c now has lists for the more named enums! PLEASE keep them up to date!
|
||||
// For great modding!!
|
||||
|
||||
|
||||
+3
-1
@@ -4468,7 +4468,9 @@ static void K_drawLapStartAnim(void)
|
||||
V_DrawFixedPatch(leftx, y, FRACUNIT, vflags, kp_lapanim_lap[min(progress/2, 6)], NULL);
|
||||
|
||||
char *lapnum = va("%02d", stplyr->laps + 1);
|
||||
for (int i = 0; i < (int)strlen(lapnum); i++)
|
||||
const size_t laplength = strlen(lapnum);
|
||||
|
||||
for (int i = 0; i < (int)laplength; i++)
|
||||
{
|
||||
int digit = lapnum[i] - '0';
|
||||
int frame = min(2, progress/2 - 8 - (i*2));
|
||||
|
||||
+6
-4
@@ -49,17 +49,19 @@ aatree_t *M_AATreeAlloc(UINT32 flags)
|
||||
return aatree;
|
||||
}
|
||||
|
||||
static void M_AATreeFree_Node(aatree_node_t *node)
|
||||
static void M_AATreeFree_Node(aatree_node_t *node, bool is_string)
|
||||
{
|
||||
if (node->left) M_AATreeFree_Node(node->left);
|
||||
if (node->right) M_AATreeFree_Node(node->right);
|
||||
if (node->left) M_AATreeFree_Node(node->left, is_string);
|
||||
if (node->right) M_AATreeFree_Node(node->right, is_string);
|
||||
if (is_string)
|
||||
Z_Free(node->value);
|
||||
Z_Free(node);
|
||||
}
|
||||
|
||||
void M_AATreeFree(aatree_t *aatree)
|
||||
{
|
||||
if (aatree->root)
|
||||
M_AATreeFree_Node(aatree->root);
|
||||
M_AATreeFree_Node(aatree->root, (aatree->flags & AATREE_STRING) == AATREE_STRING);
|
||||
|
||||
Z_Free(aatree);
|
||||
}
|
||||
|
||||
+45
-17
@@ -2868,8 +2868,9 @@ static void M_DrawCenteredMenu(void)
|
||||
static inline size_t M_StringHeight(const char *string)
|
||||
{
|
||||
size_t h = 8, i;
|
||||
const size_t strlength = strlen(string);
|
||||
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
for (i = 0; i < strlength; i++)
|
||||
if (string[i] == '\n')
|
||||
h += 8;
|
||||
|
||||
@@ -9358,29 +9359,32 @@ static void M_SetupControlsMenu(UINT8 pnum)
|
||||
break;
|
||||
}
|
||||
|
||||
OP_AllControlsMenu[4].itemaction = &cv_litesteer[pnum];
|
||||
OP_AllControlsMenu[5].itemaction = &cv_turnsmooth[pnum];
|
||||
|
||||
if (pnum > 0)
|
||||
{
|
||||
// Hide P1-only controls
|
||||
OP_AllControlsMenu[15].status = IT_GRAYEDOUT2; // Chat
|
||||
OP_AllControlsMenu[16].status = IT_GRAYEDOUT2; // Rankings
|
||||
OP_AllControlsMenu[17].status = IT_GRAYEDOUT2; // Pause
|
||||
OP_AllControlsMenu[18].status = IT_GRAYEDOUT2; // Screenshot
|
||||
OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // GIF
|
||||
OP_AllControlsMenu[20].status = IT_GRAYEDOUT2; // System Menu
|
||||
OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Console
|
||||
OP_AllControlsMenu[37].status = IT_GRAYEDOUT2; // Director
|
||||
OP_AllControlsMenu[19].status = IT_GRAYEDOUT2; // Chat
|
||||
OP_AllControlsMenu[10].status = IT_GRAYEDOUT2; // Rankings
|
||||
OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // Pause
|
||||
OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // Screenshot
|
||||
OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // GIF
|
||||
OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // System Menu
|
||||
OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Console
|
||||
OP_AllControlsMenu[41].status = IT_GRAYEDOUT2; // Director
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unhide P1-only controls
|
||||
OP_AllControlsMenu[15].status = IT_CONTROL; // Chat
|
||||
OP_AllControlsMenu[16].status = IT_CONTROL; // Rankings
|
||||
OP_AllControlsMenu[17].status = IT_CONTROL; // Pause
|
||||
OP_AllControlsMenu[18].status = IT_CONTROL; // Screenshot
|
||||
OP_AllControlsMenu[19].status = IT_CONTROL; // GIF
|
||||
OP_AllControlsMenu[20].status = IT_CONTROL; // System Menu
|
||||
OP_AllControlsMenu[21].status = IT_CONTROL; // Console
|
||||
OP_AllControlsMenu[37].status = IT_CONTROL; // Director
|
||||
OP_AllControlsMenu[19].status = IT_CONTROL; // Chat
|
||||
OP_AllControlsMenu[10].status = IT_CONTROL; // Rankings
|
||||
OP_AllControlsMenu[21].status = IT_CONTROL; // Pause
|
||||
OP_AllControlsMenu[22].status = IT_CONTROL; // Screenshot
|
||||
OP_AllControlsMenu[23].status = IT_CONTROL; // GIF
|
||||
OP_AllControlsMenu[24].status = IT_CONTROL; // System Menu
|
||||
OP_AllControlsMenu[25].status = IT_CONTROL; // Console
|
||||
OP_AllControlsMenu[41].status = IT_CONTROL; // Director
|
||||
}
|
||||
|
||||
M_SetupNextMenu(&OP_AllControlsDef);
|
||||
@@ -9494,12 +9498,36 @@ static void M_DrawControl(void)
|
||||
else if ((currentMenu->menuitems[i].status == IT_HEADER) && (i != max-1))
|
||||
V_DrawString(19, y+6, highlightflags|V_ALLOWLOWERCASE, currentMenu->menuitems[i].text);
|
||||
else if (currentMenu->menuitems[i].status & IT_STRING)
|
||||
{
|
||||
V_DrawString(x, y, ((i == itemOn) ? highlightflags|V_ALLOWLOWERCASE : V_ALLOWLOWERCASE), currentMenu->menuitems[i].text);
|
||||
|
||||
if (currentMenu->menuitems[i].status & IT_CVAR)
|
||||
{
|
||||
consvar_t *cv = (consvar_t *)currentMenu->menuitems[i].itemaction;
|
||||
|
||||
// IT_HEADER matches IT_CVAR, for some reason...
|
||||
if (cv)
|
||||
{
|
||||
INT32 w = V_StringWidth(cv->string, 0);
|
||||
V_DrawString(BASEVIDWIDTH - x - w, y,
|
||||
((cv->flags & CV_CHEAT) && !CV_IsSetToDefault(cv) ? warningflags : highlightflags)|MENUCAPS, cv->string);
|
||||
if (i == itemOn)
|
||||
{
|
||||
V_DrawCharacter(BASEVIDWIDTH - x - 10 - w - (skullAnimCounter/5), y,
|
||||
'\x1C' | highlightflags, false); // left arrow
|
||||
V_DrawCharacter(BASEVIDWIDTH - x + 2 + (skullAnimCounter/5), y,
|
||||
'\x1D' | highlightflags, false); // right arrow
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
y += SMALLLINEHEIGHT;
|
||||
}
|
||||
|
||||
V_DrawScaledPatch(currentMenu->x - 20, cursory, 0, (patch_t *)W_CachePatchName("M_CURSOR", PU_PATCH));
|
||||
|
||||
M_DoToolTips(currentMenu);
|
||||
}
|
||||
|
||||
#undef controlheight
|
||||
|
||||
+2
-2
@@ -398,7 +398,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
NULL\
|
||||
}
|
||||
|
||||
#define CONTROLMENUSTYLE(source, prev)\
|
||||
#define CONTROLMENUSTYLE(source, prev, tooltip)\
|
||||
{\
|
||||
"M_CONTRO",\
|
||||
sizeof (source)/sizeof (menuitem_t),\
|
||||
@@ -409,7 +409,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
|
||||
26, 40,\
|
||||
0,\
|
||||
NULL,\
|
||||
NULL\
|
||||
tooltip\
|
||||
}
|
||||
|
||||
#define IMAGEDEF(source)\
|
||||
|
||||
+38
-25
@@ -648,17 +648,6 @@ static menuitem_t OP_ControlsMenu[] =
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 55},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 75},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P1)", &cv_turnsmooth[0], 85},
|
||||
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P2)", &cv_turnsmooth[1], 95},
|
||||
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P3)", &cv_turnsmooth[2], 105},
|
||||
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P4)", &cv_turnsmooth[3], 115},
|
||||
|
||||
// i hate our menus sincerly
|
||||
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P1)", &cv_litesteer[0], 135},
|
||||
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P2)", &cv_litesteer[1], 145},
|
||||
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P3)", &cv_litesteer[2], 155},
|
||||
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P4)", &cv_litesteer[3], 165},
|
||||
};
|
||||
|
||||
static const char* OP_ControlsTooltips[] =
|
||||
@@ -669,15 +658,6 @@ static const char* OP_ControlsTooltips[] =
|
||||
"Setup player 4 controls.",
|
||||
"Options for mouse control.",
|
||||
"Allowed amount of controls per key.",
|
||||
"Turn smoothing for non-analog turning (Player 1).",
|
||||
"Turn smoothing for non-analog turning (Player 2).",
|
||||
"Turn smoothing for non-analog turning (Player 3).",
|
||||
"Turn smoothing for non-analog turning (Player 4).",
|
||||
|
||||
"Hold DOWN on d-pad/keyboard for shallow turns (Player 1).",
|
||||
"Hold DOWN on d-pad/keyboard for shallow turns (Player 2).",
|
||||
"Hold DOWN on d-pad/keyboard for shallow turns (Player 3).",
|
||||
"Hold DOWN on d-pad/keyboard for shallow turns (Player 4).",
|
||||
};
|
||||
|
||||
static menuitem_t OP_AllControlsMenu[] =
|
||||
@@ -685,6 +665,13 @@ static menuitem_t OP_AllControlsMenu[] =
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0},
|
||||
{IT_CALL|IT_STRING, NULL, "Reset to defaults", M_ResetControls, 8},
|
||||
|
||||
{IT_HEADER, NULL, "Control Options", NULL, 0},
|
||||
{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
|
||||
// Cvars are set in M_SetupControlsMenu
|
||||
{IT_STRING|IT_CVAR, NULL, "Lite Steer", &cv_litesteer[0], 18},
|
||||
{IT_STRING|IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth[0], 26},
|
||||
|
||||
//{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
{IT_HEADER, NULL, "Gameplay Controls", NULL, 0},
|
||||
{IT_SPACE, NULL, NULL, NULL, 0},
|
||||
@@ -733,6 +720,17 @@ static menuitem_t OP_AllControlsMenu[] =
|
||||
{IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 },
|
||||
};
|
||||
|
||||
// Has to be same length as OP_AllControlsMenu, but otherwise its mostly empty
|
||||
static const char* OP_AllControlsTooltips[sizeof(OP_AllControlsMenu)/sizeof(OP_AllControlsMenu[0])] = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"Hold DOWN on d-pad/keyboard for shallow turns.",
|
||||
"Turn smoothing for non-analog turning.",
|
||||
// The rest is null, for now
|
||||
};
|
||||
|
||||
#define OP_JOYMENU(pnum) \
|
||||
{IT_HEADER, NULL, "Gameplay Controls", NULL, 7}, \
|
||||
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[pnum] , 15}, \
|
||||
@@ -1341,16 +1339,19 @@ static menuitem_t OP_CamOptionsMenu[] =
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Field of View",&cv_fov, 30},
|
||||
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 1 Camera options...", &OP_Player1CamOptionsDef, 50},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 2 Camera options...", &OP_Player2CamOptionsDef, 60},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 3 Camera options...", &OP_Player3CamOptionsDef, 70},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 4 Camera options...", &OP_Player4CamOptionsDef, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flipcam Mode", &cv_flipcammode, 40},
|
||||
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 1 Camera options...", &OP_Player1CamOptionsDef, 60},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 2 Camera options...", &OP_Player2CamOptionsDef, 70},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 3 Camera options...", &OP_Player3CamOptionsDef, 80},
|
||||
{IT_STRING | IT_SUBMENU, NULL, "Player 4 Camera options...", &OP_Player4CamOptionsDef, 90},
|
||||
};
|
||||
|
||||
static const char* OP_CamOptionsTooltips[] =
|
||||
{
|
||||
NULL,
|
||||
"Player field of view.",
|
||||
"Change flipcam mode.\nDisplayplayer - use currently viewed player option.\nLocal - use local flipcam toggle option.",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1652,6 +1653,13 @@ static menuitem_t OP_AccessibilityMenu[] =
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 85},
|
||||
{IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 90},
|
||||
|
||||
{IT_HEADER, NULL, "Controls", NULL, 100},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P1)", &cv_autoaccel[0], 110},
|
||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P2)", &cv_autoaccel[1], 115},
|
||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P3)", &cv_autoaccel[2], 120},
|
||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P4)", &cv_autoaccel[3], 125},
|
||||
};
|
||||
|
||||
static const char* OP_AccessibilityTooltips[] =
|
||||
@@ -1673,6 +1681,11 @@ static const char* OP_AccessibilityTooltips[] =
|
||||
NULL,
|
||||
"Reverse left and right channels of audio.",
|
||||
"Change how often the same Sound is allowed to play at once.",
|
||||
NULL,
|
||||
"Automatically hold acceleration button (Player 1).",
|
||||
"Automatically hold acceleration button (Player 2).",
|
||||
"Automatically hold acceleration button (Player 3).",
|
||||
"Automatically hold acceleration button (Player 4).",
|
||||
};
|
||||
|
||||
static menuitem_t OP_SaturnMenu[] =
|
||||
@@ -2480,7 +2493,7 @@ menu_t OP_MainDef =
|
||||
menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 40, 15, OP_ControlsTooltips);
|
||||
//WTF
|
||||
menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30, OP_MouseTooltips);
|
||||
menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef);
|
||||
menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef, OP_AllControlsTooltips);
|
||||
menu_t OP_Joystick1Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 30, 36, NULL);
|
||||
menu_t OP_Joystick2Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 30, 36, NULL);
|
||||
menu_t OP_Joystick3Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 30, 36, NULL);
|
||||
|
||||
+7
-6
@@ -1693,22 +1693,23 @@ char *M_GetToken(const char *inputString)
|
||||
}
|
||||
|
||||
|
||||
const char * M_Ftrim (double f)
|
||||
const char * M_Ftrim(double f)
|
||||
{
|
||||
static char dig[9];/* "0." + 6 digits (6 is printf's default) */
|
||||
int i;
|
||||
|
||||
/* I know I said it's the default, but just in case... */
|
||||
sprintf(dig, "%.6f", fabs(modf(f, &f)));
|
||||
|
||||
/* trim trailing zeroes */
|
||||
for (i = strlen(dig)-1; dig[i] == '0'; --i)
|
||||
;
|
||||
|
||||
if (dig[i] == '.')/* :NOTHING: */
|
||||
return "";
|
||||
else
|
||||
{
|
||||
dig[i + 1] = '\0';
|
||||
return &dig[1];/* skip the 0 */
|
||||
}
|
||||
|
||||
dig[i + 1] = '\0';
|
||||
return &dig[1];/* skip the 0 */
|
||||
}
|
||||
|
||||
/** Count bits in a number.
|
||||
|
||||
+7
-4
@@ -14,10 +14,6 @@
|
||||
#ifndef __P_LOCAL__
|
||||
#define __P_LOCAL__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "command.h"
|
||||
#include "d_player.h"
|
||||
#include "d_think.h"
|
||||
@@ -28,6 +24,10 @@ extern "C" {
|
||||
#include "p_maputl.h"
|
||||
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FLOATSPEED (FRACUNIT*4)
|
||||
|
||||
//#define VIEWHEIGHTS "41"
|
||||
@@ -272,6 +272,9 @@ extern consvar_t cv_gravity;
|
||||
|
||||
void P_RespawnSpecials(void);
|
||||
|
||||
extern mobjtype_t g_doomednum_to_mobjtype[MAXDOOMEDNUM+1];
|
||||
void CalculateDoomednumToMobjtype(void);
|
||||
|
||||
mobj_t *P_AllocateMobj(void);
|
||||
mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type);
|
||||
|
||||
|
||||
+60
-35
@@ -3237,7 +3237,22 @@ void P_DestroyRobots(void)
|
||||
// the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person
|
||||
void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
|
||||
{
|
||||
const boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
|
||||
boolean player_flipcam = false;
|
||||
|
||||
if (cv_flipcammode.value == 0)
|
||||
player_flipcam = player->pflags & PF_FLIPCAM;
|
||||
else
|
||||
{
|
||||
INT32 pnum = P_GetLocalPlayerNumForPlayer(player);
|
||||
|
||||
// Shouldn't happen but just in case
|
||||
if (pnum == -1)
|
||||
pnum = 0;
|
||||
|
||||
player_flipcam = cv_flipcam[pnum].value;
|
||||
}
|
||||
|
||||
const boolean flipcam = (player_flipcam && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
|
||||
UINT8 postimgtype = 0;
|
||||
|
||||
if (encoremode)
|
||||
@@ -10448,6 +10463,24 @@ void P_PrecipitationEffects(void)
|
||||
}
|
||||
}
|
||||
|
||||
mobjtype_t g_doomednum_to_mobjtype[MAXDOOMEDNUM+1] = {};
|
||||
|
||||
void CalculateDoomednumToMobjtype(void)
|
||||
{
|
||||
memset(g_doomednum_to_mobjtype, MT_NULL, sizeof(g_doomednum_to_mobjtype));
|
||||
|
||||
for (size_t i = 0; i < NUMMOBJTYPES; i++)
|
||||
{
|
||||
const INT32 doomednum = mobjinfo[i].doomednum;
|
||||
|
||||
if (doomednum > 0 && doomednum <= MAXDOOMEDNUM)
|
||||
{
|
||||
if (g_doomednum_to_mobjtype[doomednum] == MT_NULL)
|
||||
g_doomednum_to_mobjtype[doomednum] = (mobjtype_t)i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_RespawnSpecials
|
||||
//
|
||||
@@ -10521,17 +10554,15 @@ void P_RespawnSpecials(void)
|
||||
|
||||
if (mthing)
|
||||
{
|
||||
mobjtype_t i;
|
||||
mobjtype_t i = MT_NULL;
|
||||
x = mthing->x << FRACBITS;
|
||||
y = mthing->y << FRACBITS;
|
||||
ss = R_PointInSubsector(x, y);
|
||||
|
||||
// find which type to spawn
|
||||
for (i = 0; i < NUMMOBJTYPES; i++)
|
||||
if (mthing->type == mobjinfo[i].doomednum)
|
||||
break;
|
||||
i = g_doomednum_to_mobjtype[mthing->type];
|
||||
|
||||
if (i == NUMMOBJTYPES) // prevent creation of objects with this type -- Monster Iestyn 17/12/17
|
||||
if (i <= MT_NULL || i >= NUMMOBJTYPES) // prevent creation of objects with this type -- Monster Iestyn 17/12/17
|
||||
{
|
||||
// 3D Mode start Thing is unlikely to be added to the que,
|
||||
// so don't bother checking for that specific type
|
||||
@@ -10959,7 +10990,7 @@ INT32 numhuntemeralds = 0;
|
||||
//
|
||||
void P_SpawnMapThing(mapthing_t *mthing)
|
||||
{
|
||||
mobjtype_t i;
|
||||
mobjtype_t i = MT_NULL;
|
||||
mobj_t *mobj;
|
||||
fixed_t x, y, z;
|
||||
subsector_t *ss;
|
||||
@@ -10972,11 +11003,9 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
if (objectplacing)
|
||||
{
|
||||
// find which type to spawn
|
||||
for (i = 0; i < NUMMOBJTYPES; i++)
|
||||
if (mthing->type == mobjinfo[i].doomednum)
|
||||
break;
|
||||
i = g_doomednum_to_mobjtype[mthing->type];
|
||||
|
||||
if (i == NUMMOBJTYPES)
|
||||
if (i <= MT_NULL || i >= NUMMOBJTYPES)
|
||||
{
|
||||
if (mthing->type == 3328) // 3D Mode start Thing
|
||||
return;
|
||||
@@ -11044,13 +11073,9 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
||||
}
|
||||
|
||||
// find which type to spawn
|
||||
for (i = 0; i < NUMMOBJTYPES; i++)
|
||||
{
|
||||
if (mthing->type == mobjinfo[i].doomednum)
|
||||
break;
|
||||
}
|
||||
i = g_doomednum_to_mobjtype[mthing->type];
|
||||
|
||||
if (i == NUMMOBJTYPES)
|
||||
if (i <= MT_NULL || i >= NUMMOBJTYPES)
|
||||
{
|
||||
if (mthing->type == 3328) // 3D Mode start Thing
|
||||
return;
|
||||
@@ -11743,32 +11768,32 @@ ML_NOCLIMB : Direction not controllable
|
||||
if (mobj->flags & MF_MONITOR)
|
||||
{
|
||||
// flag for strong/weak random boxes
|
||||
if (mthing->type == mobjinfo[MT_SUPERRINGBOX].doomednum || mthing->type == mobjinfo[MT_PRUP].doomednum ||
|
||||
mthing->type == mobjinfo[MT_SNEAKERTV].doomednum || mthing->type == mobjinfo[MT_INV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_WHITETV].doomednum || mthing->type == mobjinfo[MT_GREENTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum)
|
||||
if (i == MT_SUPERRINGBOX || i == MT_PRUP ||
|
||||
i == MT_SNEAKERTV || i == MT_INV ||
|
||||
i == MT_WHITETV || i == MT_GREENTV ||
|
||||
i == MT_YELLOWTV || i == MT_BLUETV ||
|
||||
i == MT_BLACKTV || i == MT_PITYTV ||
|
||||
i == MT_RECYCLETV || i == MT_MIXUPBOX)
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
|
||||
else if (mthing->type != mobjinfo[MT_AXIS].doomednum &&
|
||||
mthing->type != mobjinfo[MT_AXISTRANSFER].doomednum &&
|
||||
mthing->type != mobjinfo[MT_AXISTRANSFERLINE].doomednum &&
|
||||
mthing->type != mobjinfo[MT_NIGHTSBUMPER].doomednum &&
|
||||
mthing->type != mobjinfo[MT_STARPOST].doomednum)
|
||||
else if (
|
||||
i != MT_AXIS &&
|
||||
i != MT_AXISTRANSFER &&
|
||||
i != MT_AXISTRANSFERLINE &&
|
||||
i != MT_NIGHTSBUMPER &&
|
||||
i != MT_STARPOST)
|
||||
mobj->flags2 |= MF2_AMBUSH;
|
||||
}
|
||||
|
||||
if (mthing->options & MTF_OBJECTSPECIAL)
|
||||
{
|
||||
// flag for strong/weak random boxes
|
||||
if (mthing->type == mobjinfo[MT_SUPERRINGBOX].doomednum || mthing->type == mobjinfo[MT_PRUP].doomednum ||
|
||||
mthing->type == mobjinfo[MT_SNEAKERTV].doomednum || mthing->type == mobjinfo[MT_INV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_WHITETV].doomednum || mthing->type == mobjinfo[MT_GREENTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_YELLOWTV].doomednum || mthing->type == mobjinfo[MT_BLUETV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_BLACKTV].doomednum || mthing->type == mobjinfo[MT_PITYTV].doomednum ||
|
||||
mthing->type == mobjinfo[MT_RECYCLETV].doomednum || mthing->type == mobjinfo[MT_MIXUPBOX].doomednum)
|
||||
if (i == MT_SUPERRINGBOX || i == MT_PRUP ||
|
||||
i == MT_SNEAKERTV || i == MT_INV ||
|
||||
i == MT_WHITETV || i == MT_GREENTV ||
|
||||
i == MT_YELLOWTV || i == MT_BLUETV ||
|
||||
i == MT_BLACKTV || i == MT_PITYTV ||
|
||||
i == MT_RECYCLETV || i == MT_MIXUPBOX)
|
||||
mobj->flags2 |= MF2_STRONGBOX;
|
||||
|
||||
// Requires you to be in bonus time to activate
|
||||
|
||||
@@ -1965,21 +1965,6 @@ FUNCINLINE static ATTRINLINE player_t *LoadPlayer(UINT32 player)
|
||||
// Loads a mobj_t from a save game
|
||||
//
|
||||
|
||||
static mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX];
|
||||
|
||||
static void CalculateDoomednumToMobjtype(void)
|
||||
{
|
||||
memset(g_doomednum_to_mobjtype, MT_NULL, sizeof(g_doomednum_to_mobjtype));
|
||||
|
||||
for (size_t i = MT_NULL+1; i < NUMMOBJTYPES; i++)
|
||||
{
|
||||
if (mobjinfo[i].doomednum > 0 && mobjinfo[i].doomednum <= UINT16_MAX)
|
||||
{
|
||||
g_doomednum_to_mobjtype[ mobjinfo[i].doomednum ] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void LoadMobjThinker(savebuffer_t *save, actionf_p1 thinker)
|
||||
{
|
||||
mobj_t *mobj;
|
||||
@@ -2879,10 +2864,6 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
||||
if (READUINT32(save->p) != ARCHIVEBLOCK_THINKERS)
|
||||
I_Error("Bad $$$.sav at archive block Thinkers");
|
||||
|
||||
// Pre-calculate this lookup, because it was wasting
|
||||
// a shit ton of time loading mobj thinkers.
|
||||
CalculateDoomednumToMobjtype();
|
||||
|
||||
// remove all the current thinkers
|
||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap; currentthinker = next)
|
||||
{
|
||||
|
||||
@@ -2861,6 +2861,10 @@ boolean P_SetupLevel(boolean fromnetsave, boolean reloadinggamestate)
|
||||
|
||||
P_ResetDynamicSlopes();
|
||||
|
||||
// Pre-calculate this lookup, because it was wasting
|
||||
// a shit ton of time loading mobj thinkers.
|
||||
CalculateDoomednumToMobjtype();
|
||||
|
||||
P_SpawnMapThings();
|
||||
|
||||
P_SpawnEmblems(!fromnetsave);
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
#include "doomdef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface
|
||||
#endif
|
||||
@@ -43,4 +47,9 @@ mobj_t *P_SetTarget2(mobj_t **mo, mobj_t *target
|
||||
#else
|
||||
#define P_SetTarget P_SetTarget2
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "doomdef.h"
|
||||
#include "g_game.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "r_fps.h"
|
||||
#include "r_local.h"
|
||||
#include "r_state.h"
|
||||
|
||||
+4
-4
@@ -15,16 +15,16 @@
|
||||
#ifndef __R_FPS_H__
|
||||
#define __R_FPS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "m_fixed.h"
|
||||
#include "p_local.h"
|
||||
#include "r_state.h"
|
||||
#include "r_things.h"
|
||||
#include "m_perfstats.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern consvar_t cv_fpscap, cv_fpscapbg;
|
||||
|
||||
extern ps_metric_t ps_interp_frac;
|
||||
|
||||
@@ -182,6 +182,9 @@ consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS] = {
|
||||
{"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam4_OnChange, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
|
||||
static CV_PossibleValue_t flipcammode_cons_t[] = {{0, "Displayplayer"}, {1, "Local"}, {0, NULL}};
|
||||
consvar_t cv_flipcammode = {"flipcammode", "Displayplayer", CV_SAVE, flipcammode_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_shadow = {"shadow", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_skybox = {"skybox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -1546,6 +1549,8 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_flipcam[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_flipcammode);
|
||||
|
||||
// Enough for dedicated server
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
+5
-4
@@ -14,14 +14,14 @@
|
||||
#ifndef __R_MAIN__
|
||||
#define __R_MAIN__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "d_player.h"
|
||||
#include "r_data.h"
|
||||
#include "m_perfstats.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//
|
||||
// POV related.
|
||||
//
|
||||
@@ -205,6 +205,7 @@ extern consvar_t cv_showhud, cv_translucenthud, cv_uncappedhud;
|
||||
extern consvar_t cv_homremoval;
|
||||
extern consvar_t cv_chasecam[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_flipcammode;
|
||||
extern consvar_t cv_shadow, cv_shadowoffs;
|
||||
extern consvar_t cv_ffloorclip, cv_spriteclip;
|
||||
extern consvar_t cv_softcyancut;
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "r_local.h"
|
||||
#include "r_sky.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "r_portal.h"
|
||||
#include "r_splats.h"
|
||||
#include "r_fps.h" // newview
|
||||
|
||||
+96
-331
@@ -1,350 +1,115 @@
|
||||
# Declare SDL2 interface sources
|
||||
|
||||
set(SRB2_CONFIG_SDL2_USEMIXER ON CACHE BOOL "Use SDL2_mixer or regular sdl sound")
|
||||
|
||||
if(${SRB2_CONFIG_SDL2_USEMIXER})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(SDL2_MIXER_FOUND ON)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
set(SDL2_MIXER_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2)
|
||||
set(SDL2_MIXER_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/lib -lSDL2_mixer")
|
||||
else() # 32-bit
|
||||
set(SDL2_MIXER_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/include/SDL2)
|
||||
set(SDL2_MIXER_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/lib -lSDL2_mixer")
|
||||
endif()
|
||||
else()
|
||||
find_package(SDL2_mixer)
|
||||
endif()
|
||||
if(${SDL2_MIXER_FOUND})
|
||||
set(SRB2_HAVE_MIXER ON)
|
||||
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c)
|
||||
else()
|
||||
message(WARNING "You specified that SDL2_mixer is available, but it was not found. Falling back to sdl sound.")
|
||||
set(SRB2_SDL2_SOUNDIMPL sdl_sound.c)
|
||||
endif()
|
||||
else()
|
||||
set(SRB2_SDL2_SOUNDIMPL sdl_sound.c)
|
||||
endif()
|
||||
|
||||
set(SRB2_SDL2_SOURCES
|
||||
target_sources(SRB2SDL2 PRIVATE
|
||||
mixer_sound.c
|
||||
ogl_sdl.c
|
||||
i_threads.c
|
||||
i_net.c
|
||||
i_system.cpp
|
||||
i_main.c
|
||||
i_video.c
|
||||
dosstr.c
|
||||
endtxt.c
|
||||
hwsym_sdl.c
|
||||
i_main.c
|
||||
i_net.c
|
||||
i_system.c
|
||||
i_ttf.c
|
||||
i_video.c
|
||||
i_threads.c
|
||||
#IMG_xpm.c
|
||||
ogl_sdl.c
|
||||
|
||||
${SRB2_SDL2_SOUNDIMPL}
|
||||
)
|
||||
|
||||
set(SRB2_SDL2_HEADERS
|
||||
endtxt.h
|
||||
hwsym_sdl.h
|
||||
i_ttf.h
|
||||
ogl_sdl.h
|
||||
sdlmain.h
|
||||
)
|
||||
|
||||
source_group("Interface Code" FILES ${SRB2_SDL2_SOURCES} ${SRB2_SDL2_HEADERS})
|
||||
|
||||
# Dependency
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(SDL2_FOUND ON)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
set(SDL2_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/include/SDL2)
|
||||
set(SDL2_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/lib -lSDL2")
|
||||
else() # 32-bit
|
||||
set(SDL2_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/include/SDL2)
|
||||
set(SDL2_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/lib -lSDL2")
|
||||
endif()
|
||||
else()
|
||||
find_package(SDL2)
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
|
||||
target_sources(SRB2SDL2 PRIVATE
|
||||
../win32/win_dbg.c
|
||||
../win32/Srb2win.rc)
|
||||
endif()
|
||||
|
||||
if(${SDL2_FOUND})
|
||||
set(SRB2_SDL2_TOTAL_SOURCES
|
||||
${SRB2_CORE_SOURCES}
|
||||
${SRB2_CORE_HEADERS}
|
||||
${SRB2_DISCORDRPC_SOURCES}
|
||||
${SRB2_DISCORDRPC_HEADERS}
|
||||
${SRB2_PNG_SOURCES}
|
||||
${SRB2_PNG_HEADERS}
|
||||
${SRB2_CORE_RENDER_SOURCES}
|
||||
${SRB2_CORE_GAME_SOURCES}
|
||||
${SRB2_LUA_SOURCES}
|
||||
${SRB2_LUA_HEADERS}
|
||||
${SRB2_BLUA_SOURCES}
|
||||
${SRB2_BLUA_HEADERS}
|
||||
${SRB2_SDL2_SOURCES}
|
||||
${SRB2_SDL2_HEADERS}
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
|
||||
set(MACOSX_BUNDLE_ICON_FILE Srb2mac.icns)
|
||||
set_source_files_properties(macosx/Srb2mac.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
target_sources(SRB2SDL2 PRIVATE
|
||||
macosx/mac_resources.c
|
||||
macosx/mac_resources.h
|
||||
macosx/Srb2mac.icns
|
||||
)
|
||||
endif()
|
||||
|
||||
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}
|
||||
${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS})
|
||||
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
|
||||
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
|
||||
source_group("Discord Rich Presence" FILES ${SRB2_DISCORDRPC_SOURCES} ${SRB2_DISCORDRPC_HEADERS})
|
||||
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
|
||||
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
|
||||
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
|
||||
|
||||
|
||||
if(${SRB2_CONFIG_HWRENDER})
|
||||
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
|
||||
${SRB2_HWRENDER_SOURCES}
|
||||
${SRB2_HWRENDER_HEADERS}
|
||||
${SRB2_R_OPENGL_SOURCES}
|
||||
${SRB2_R_OPENGL_HEADERS}
|
||||
)
|
||||
|
||||
source_group("Hardware" FILES ${SRB2_HWRENDER_SOURCES} ${SRB2_HWRENDER_HEADERS})
|
||||
source_group("Hardware\\OpenGL Renderer" FILES ${SRB2_R_OPENGL_SOURCES} ${SRB2_R_OPENGL_HEADERS})
|
||||
endif()
|
||||
|
||||
if(${SRB2_USEASM})
|
||||
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
|
||||
${SRB2_NASM_SOURCES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
|
||||
${CMAKE_SOURCE_DIR}/src/win32/win_dbg.c
|
||||
${CMAKE_SOURCE_DIR}/src/win32/Srb2win.rc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||
set(MACOSX_BUNDLE_ICON_FILE Srb2mac.icns)
|
||||
set_source_files_properties(macosx/Srb2mac.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||
set(SRB2_SDL2_MAC_SOURCES
|
||||
macosx/mac_alert.c
|
||||
macosx/mac_alert.h
|
||||
macosx/mac_resources.c
|
||||
macosx/mac_resources.h
|
||||
macosx/Srb2mac.icns
|
||||
)
|
||||
source_group("Interface Code\\OSX Compatibility" FILES ${SRB2_SDL2_MAC_SOURCES})
|
||||
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES} ${SRB2_SDL2_MAC_SOURCES})
|
||||
endif()
|
||||
|
||||
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME})
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||
find_library(CORE_FOUNDATION_LIBRARY "CoreFoundation")
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
${CORE_FOUNDATION_LIBRARY}
|
||||
)
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
|
||||
|
||||
# Configure the app bundle icon and plist properties
|
||||
target_sources(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns")
|
||||
set_target_properties(SRB2SDL2 PROPERTIES
|
||||
MACOSX_BUNDLE_ICON_FILE "Srb2mac"
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "Sonic Robo Blast 2"
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${SRB2_VERSION}
|
||||
|
||||
RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns"
|
||||
)
|
||||
endif()
|
||||
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
|
||||
find_library(CORE_FOUNDATION_LIBRARY "CoreFoundation")
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
${SDL2_LIBRARIES}
|
||||
${SDL2_MIXER_LIBRARIES}
|
||||
${GME_LIBRARIES}
|
||||
${OPENMPT_LIBRARIES}
|
||||
${MIXERX_LIBRARIES}
|
||||
${PNG_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${CURL_LIBRARIES}
|
||||
${DISCORDRPC_LIBRARIES}
|
||||
${CORE_FOUNDATION_LIBRARY}
|
||||
)
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Linux)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
m
|
||||
rt
|
||||
)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows AND ${CMAKE_C_COMPILER_ID} MATCHES "GNU" AND ${SRB2_SYSTEM_BITS} EQUAL 32)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../../libs/drmingw/lib/win32/libexchndl.a"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../../libs/drmingw/lib/win32/libmgwhelp.a"
|
||||
)
|
||||
target_include_directories(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../libs/drmingw/include")
|
||||
endif()
|
||||
|
||||
#target_link_libraries(SRB2SDL2 PRIVATE SRB2Core)
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
|
||||
|
||||
if(${SRB2_USEASM})
|
||||
if(${SRB2_CONFIG_YASM})
|
||||
set(ASM_ASSEMBLER_TEMP ${CMAKE_ASM_YASM_COMPILER})
|
||||
set(ASM_ASSEMBLER_OBJFORMAT ${CMAKE_ASM_YASM_OBJECT_FORMAT})
|
||||
set_source_files_properties(${SRB2_NASM_SOURCES} LANGUAGE ASM_YASM)
|
||||
else()
|
||||
set(ASM_ASSEMBLER_TEMP ${CMAKE_ASM_NASM_COMPILER})
|
||||
set(ASM_ASSEMBLER_OBJFORMAT ${CMAKE_ASM_NASM_OBJECT_FORMAT})
|
||||
set_source_files_properties(${SRB2_NASM_SOURCES} LANGUAGE ASM_NASM)
|
||||
endif()
|
||||
endif()
|
||||
# Configure the app bundle icon and plist properties
|
||||
target_sources(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns")
|
||||
set_target_properties(SRB2SDL2 PROPERTIES
|
||||
MACOSX_BUNDLE_ICON_FILE "Srb2mac"
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "SRB2Kart-Saturn"
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION 1.6
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
ws2_32
|
||||
)
|
||||
target_compile_options(SRB2SDL2 PRIVATE
|
||||
-U_WINDOWS
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(SRB2SDL2 PRIVATE
|
||||
${SDL2_INCLUDE_DIRS}
|
||||
${SDL2_MIXER_INCLUDE_DIRS}
|
||||
${GME_INCLUDE_DIRS}
|
||||
${OPENMPT_INCLUDE_DIRS}
|
||||
${PNG_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
${OPENGL_INCLUDE_DIRS}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${DISCORDRPC_INCLUDE_DIRS}
|
||||
RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns"
|
||||
)
|
||||
|
||||
if(${SRB2_HAVE_MIXER})
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE
|
||||
-DHAVE_SDL
|
||||
-DHAVE_THREADS
|
||||
)
|
||||
|
||||
## strip debug symbols into separate file when using gcc
|
||||
# if(CMAKE_COMPILER_IS_GNUCC)
|
||||
# if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||
# message(STATUS "Will make separate debug symbols in *.debug")
|
||||
# add_custom_command(TARGET SRB2SDL2 POST_BUILD
|
||||
# COMMAND ${OBJCOPY} --only-keep-debug $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
|
||||
# COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:SRB2SDL2>
|
||||
# COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE_NAME:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
|
||||
# )
|
||||
# endif()
|
||||
# endif()
|
||||
|
||||
#### Installation ####
|
||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||
install(TARGETS SRB2SDL2
|
||||
BUNDLE DESTINATION .
|
||||
)
|
||||
set_property(TARGET SRB2SDL2 PROPERTY INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
else()
|
||||
install(TARGETS SRB2SDL2 SRB2SDL2
|
||||
RUNTIME DESTINATION .
|
||||
)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||
set(win_extra_dll_list "")
|
||||
macro(getwinlib dllname defaultname)
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
if (${CMAKE_GENERATOR} STREQUAL "MinGW Makefiles")
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/x86_64
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/bin
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/bin
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86_64/mingw
|
||||
)
|
||||
else()
|
||||
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/i686
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/bin
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/bin
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86/mingw
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/x86_64
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x64
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x64
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86_64/mingw
|
||||
)
|
||||
else()
|
||||
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/i686
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x86
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x86
|
||||
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86/mingw
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
|
||||
else()
|
||||
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}")
|
||||
list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
|
||||
endif()
|
||||
endmacro()
|
||||
getwinlib(SDL2 "SDL2.dll")
|
||||
if(${SRB2_CONFIG_SDL2_USEMIXER})
|
||||
getwinlib(SDL2_mixer "SDL2_mixer.dll")
|
||||
getwinlib(libogg_0 "libogg-0.dll")
|
||||
getwinlib(libvorbis_0 "libvorbis-0.dll")
|
||||
getwinlib(libvorbisfile_3 "libvorbisfile-3.dll")
|
||||
endif()
|
||||
if(${SRB2_CONFIG_HAVE_GME})
|
||||
getwinlib(libgme "libgme.dll")
|
||||
endif()
|
||||
if(${SRB2_CONFIG_HAVE_OPENMPT})
|
||||
getwinlib(libopenmpt "libopenmpt.dll")
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_DISCORDRPC})
|
||||
getwinlib(discord-rpc "discord-rpc.dll")
|
||||
endif()
|
||||
|
||||
install(PROGRAMS
|
||||
${win_extra_dll_list}
|
||||
DESTINATION .
|
||||
)
|
||||
|
||||
# We also want to copy those DLLs to build directories on MSVC.
|
||||
# So we'll add a post_build step.
|
||||
copy_files_to_build_dir(SRB2SDL2 win_extra_dll_list)
|
||||
endif()
|
||||
|
||||
|
||||
# Mac bundle fixup
|
||||
# HACK: THIS IS IMPORTANT! See the escaped \${CMAKE_INSTALL_PREFIX}? This
|
||||
# makes it so that var is evaluated LATER during cpack, not right now!
|
||||
# This fixes the quirk where the bundled libraries don't land in the final package
|
||||
# https://cmake.org/pipermail/cmake/2011-March/043532.html
|
||||
#
|
||||
# HOWEVER: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY} is NOT escaped, because that var
|
||||
# is only available to us at this step. Read the link: ${CMAKE_INSTALL_PREFIX} at
|
||||
# this current step points to the CMAKE build folder, NOT the folder that CPACK uses.
|
||||
# Therefore, it makes sense to escape that var, but not the other.
|
||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||
install(CODE "
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${CPACK_PACKAGE_DESCRIPTION_SUMMARY}.app\"
|
||||
\"\"
|
||||
/Library/Frameworks
|
||||
)"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(SRB2_SDL2_AVAILABLE YES PARENT_SCOPE)
|
||||
else()
|
||||
message(WARNING "SDL2 was not found, so the SDL2 target will not be available.")
|
||||
set(SRB2_SDL2_AVAILABLE NO PARENT_SCOPE)
|
||||
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()
|
||||
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
|
||||
target_link_libraries(SRB2SDL2 PRIVATE
|
||||
ws2_32
|
||||
)
|
||||
target_compile_options(SRB2SDL2 PRIVATE
|
||||
-U_WINDOWS
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
|
||||
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_SDL)
|
||||
|
||||
#### Installation ####
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
|
||||
install(TARGETS SRB2SDL2
|
||||
BUNDLE DESTINATION .
|
||||
)
|
||||
set_property(TARGET SRB2SDL2 PROPERTY INSTALL_RPATH_USE_LINK_PATH ON)
|
||||
else()
|
||||
install(TARGETS SRB2SDL2 SRB2SDL2
|
||||
RUNTIME DESTINATION .
|
||||
)
|
||||
if ((${CMAKE_BUILD_TYPE} MATCHES Debug) OR (${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo))
|
||||
set(SRB2_DEBUG_INSTALL OFF CACHE BOOL "Insert *.debug file into the install directory or package.")
|
||||
if (${SRB2_DEBUG_INSTALL})
|
||||
install(FILES $<TARGET_FILE:SRB2SDL2>.debug
|
||||
DESTINATION .
|
||||
OPTIONAL
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Mac bundle fixup
|
||||
# HACK: THIS IS IMPORTANT! See the escaped \${CMAKE_INSTALL_PREFIX}? This
|
||||
# makes it so that var is evaluated LATER during cpack, not right now!
|
||||
# This fixes the quirk where the bundled libraries don't land in the final package
|
||||
# https://cmake.org/pipermail/cmake/2011-March/043532.html
|
||||
#
|
||||
# HOWEVER: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY} is NOT escaped, because that var
|
||||
# is only available to us at this step. Read the link: ${CMAKE_INSTALL_PREFIX} at
|
||||
# this current step points to the CMAKE build folder, NOT the folder that CPACK uses.
|
||||
# Therefore, it makes sense to escape that var, but not the other.
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
|
||||
install(CODE "
|
||||
include(BundleUtilities)
|
||||
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${CPACK_PACKAGE_DESCRIPTION_SUMMARY}.app\"
|
||||
\"\"
|
||||
/Library/Frameworks
|
||||
)"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(SRB2_SDL2_AVAILABLE YES PARENT_SCOPE)
|
||||
+15
-11
@@ -201,10 +201,6 @@ static char returnWadPath[256];
|
||||
|
||||
#include "../s_sound.h"
|
||||
|
||||
#ifdef MAC_ALERT
|
||||
#include "macosx/mac_alert.h"
|
||||
#endif
|
||||
|
||||
#include "../d_main.h"
|
||||
|
||||
#if !defined(NOMUMBLE) && defined(HAVE_MUMBLE)
|
||||
@@ -1851,17 +1847,20 @@ INT32 I_StartupSystem(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean is_quitting = false;
|
||||
|
||||
//
|
||||
// I_Quit
|
||||
//
|
||||
FUNCNORETURN void ATTRNORETURN I_Quit(void)
|
||||
{
|
||||
static SDL_bool quiting = SDL_FALSE;
|
||||
|
||||
/* prevent recursive I_Quit() */
|
||||
if (quiting) goto death;
|
||||
if (is_quitting)
|
||||
abort();
|
||||
|
||||
is_quitting = true;
|
||||
SDL_ShowCursor(SDL_TRUE);
|
||||
quiting = SDL_FALSE;
|
||||
|
||||
I_ShutdownConsole();
|
||||
M_SaveConfig(NULL); //save game config, cvars..
|
||||
D_SaveBan(); // save the ban list
|
||||
@@ -1888,7 +1887,7 @@ FUNCNORETURN void ATTRNORETURN I_Quit(void)
|
||||
}
|
||||
if (myargmalloc)
|
||||
free(myargv); // Deallocate allocated memory
|
||||
death:
|
||||
|
||||
W_Shutdown();
|
||||
exit(0);
|
||||
}
|
||||
@@ -2314,12 +2313,17 @@ static void pathonly(char *s)
|
||||
size_t j;
|
||||
|
||||
for (j = strlen(s); j != (size_t)-1; j--)
|
||||
{
|
||||
if ((s[j] == '\\') || (s[j] == ':') || (s[j] == '/'))
|
||||
{
|
||||
if (s[j] == ':') s[j+1] = 0;
|
||||
else s[j] = 0;
|
||||
if (s[j] == ':')
|
||||
s[j+1] = 0;
|
||||
else
|
||||
s[j] = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** \brief search for srb2.srb in the given path
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
/// \file i_threads.c
|
||||
/// \brief Multithreading abstraction
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
|
||||
#include "../doomdef.h"
|
||||
#include "../i_threads.h"
|
||||
|
||||
@@ -354,3 +356,5 @@ I_wake_all_cond (
|
||||
if (SDL_CondBroadcast(cond) == -1)
|
||||
abort();
|
||||
}
|
||||
|
||||
#endif // HAVE_THREADS
|
||||
@@ -1,64 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief Graphical Alerts for MacOSX
|
||||
///
|
||||
/// Shows alerts, since we can't just print these to the screen when
|
||||
/// launched graphically on a mac.
|
||||
|
||||
#ifdef __APPLE_CC__
|
||||
|
||||
#include "mac_alert.h"
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#define CFSTRINGIFY(x) CFStringCreateWithCString(NULL, x, kCFStringEncodingASCII)
|
||||
|
||||
int MacShowAlert(const char *title, const char *message, const char *button1, const char *button2, const char *button3)
|
||||
{
|
||||
CFOptionFlags results;
|
||||
|
||||
CFStringRef cf_title = CFSTRINGIFY(title);
|
||||
CFStringRef cf_message = CFSTRINGIFY(message);
|
||||
CFStringRef cf_button1 = NULL;
|
||||
CFStringRef cf_button2 = NULL;
|
||||
CFStringRef cf_button3 = NULL;
|
||||
|
||||
if (button1 != NULL)
|
||||
cf_button1 = CFSTRINGIFY(button1);
|
||||
if (button2 != NULL)
|
||||
cf_button2 = CFSTRINGIFY(button2);
|
||||
if (button3 != NULL)
|
||||
cf_button3 = CFSTRINGIFY(button3);
|
||||
|
||||
CFOptionFlags alert_flags = kCFUserNotificationStopAlertLevel | kCFUserNotificationNoDefaultButtonFlag;
|
||||
|
||||
CFUserNotificationDisplayAlert(0, alert_flags, NULL, NULL, NULL, cf_title, cf_message,
|
||||
cf_button1, cf_button2, cf_button3, &results);
|
||||
|
||||
if (cf_button1 != NULL)
|
||||
CFRelease(cf_button1);
|
||||
if (cf_button2 != NULL)
|
||||
CFRelease(cf_button2);
|
||||
if (cf_button3 != NULL)
|
||||
CFRelease(cf_button3);
|
||||
CFRelease(cf_message);
|
||||
CFRelease(cf_title);
|
||||
|
||||
return (int)results;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,27 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief Graphical Alerts for MacOSX
|
||||
///
|
||||
/// Shows alerts, since we can't just print these to the screen when
|
||||
/// launched graphically on a mac.
|
||||
|
||||
#ifdef __APPLE_CC__
|
||||
|
||||
extern int MacShowAlert(const char *title, const char *message, const char *button1, const char *button2, const char *button3);
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,14 @@
|
||||
#ifndef __MAC_RESOURCES_H__
|
||||
#define __MAC_RESOURCES_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void OSX_GetResourcesPath(char * buffer);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+9
-3
@@ -2992,7 +2992,9 @@ INT32 V_CreditStringWidth(const char *string)
|
||||
if (!string)
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
const size_t strlength = strlen(string);
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
{
|
||||
c = toupper(string[i]) - CRED_FONTSTART;
|
||||
if (c < 0 || c >= CRED_FONTSIZE)
|
||||
@@ -3070,7 +3072,9 @@ INT32 V_LevelNameWidth(const char *string)
|
||||
INT32 c, w = 0;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
const size_t strlength = strlen(string);
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
{
|
||||
c = toupper(string[i]) - LT_FONTSTART;
|
||||
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
|
||||
@@ -3089,7 +3093,9 @@ INT32 V_LevelNameHeight(const char *string)
|
||||
INT32 c, w = 0;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < strlen(string); i++)
|
||||
const size_t strlength = strlen(string);
|
||||
|
||||
for (i = 0; i < strlength; i++)
|
||||
{
|
||||
c = toupper(string[i]) - LT_FONTSTART;
|
||||
if (c < 0 || c >= LT_FONTSIZE || !lt_font[c])
|
||||
|
||||
@@ -651,9 +651,6 @@ void Z_ChangeTag(void *ptr, INT32 tag)
|
||||
I_Error("Internal memory management error: "
|
||||
"tried to make block purgable but it has no owner");
|
||||
|
||||
// No, please, don't make my PU_STATIC patch NULL! It supposed to be always valid!
|
||||
if (block->tag < 10) return;
|
||||
|
||||
block->tag = tag;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user