Compare commits
58
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f58772a570 | ||
|
|
f7c065b22e | ||
|
|
55c8546d68 | ||
|
|
1762f18116 | ||
|
|
e4dbf1ce11 | ||
|
|
10b9d96259 | ||
|
|
b23154fd93 | ||
|
|
b0ee972178 | ||
|
|
544e1d3b21 | ||
|
|
0ca6947f99 | ||
|
|
3122c08039 | ||
|
|
7a279a6fd9 | ||
|
|
c4581bd9a6 | ||
|
|
bb47b976a7 | ||
|
|
6c419ff22e | ||
|
|
522904527f | ||
|
|
30539371c2 | ||
|
|
e2ecc315b4 | ||
|
|
eb2f186205 | ||
|
|
bbf06b3376 | ||
|
|
a1f70b0b31 | ||
|
|
2e0f5c02a4 | ||
|
|
0f7001ef5c | ||
|
|
4600da5782 | ||
|
|
a3557fadef | ||
|
|
d9a67faf47 | ||
|
|
96eaf8850e | ||
|
|
e7efd46419 | ||
|
|
346b1456cd | ||
|
|
9f5a5a735b | ||
|
|
8e4b304bed | ||
|
|
607fbc54fc | ||
|
|
276cf0a8cb | ||
|
|
59c9af97c2 | ||
|
|
4e75d99026 | ||
|
|
8e91c16e97 | ||
|
|
186421fe85 | ||
|
|
af952870c3 | ||
|
|
4eeb0b4b20 | ||
|
|
cb2c65e9d9 | ||
|
|
f7bbde3982 | ||
|
|
c9fc3b4820 | ||
|
|
f5195dd137 | ||
|
|
5289f13891 | ||
|
|
073b35690b | ||
|
|
43d3ac102d | ||
|
|
aa96f9ceb3 | ||
|
|
104b8260fb | ||
|
|
edebc728ef | ||
|
|
08e7ce3b5b | ||
|
|
29f187b751 | ||
|
|
ac3a1ad5eb | ||
|
|
1b8d7b1541 | ||
|
|
b812d61da2 | ||
|
|
6fd64383d3 | ||
|
|
e984e7a6c8 | ||
|
|
51aec0e012 | ||
|
|
f38ca9aa28 |
No files matched your search
+38
-29
@@ -1,14 +1,46 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
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)
|
|
||||||
|
|
||||||
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
|
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.")
|
message(FATAL_ERROR "In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
#set(CMAKE_CXX_EXTENSIONS OFF) # optional but recommended: disables GNU extensions, forces pure ISO C++
|
||||||
|
set(CMAKE_CXX_EXTENSIONS ON)
|
||||||
|
set(CMAKE_C_EXTENSIONS ON)
|
||||||
|
|
||||||
|
##### 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()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CPACK_GENERATOR ${SRB2_CPACK_GENERATOR})
|
||||||
|
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)
|
||||||
|
|
||||||
# Set up CMAKE path
|
# Set up CMAKE path
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||||
|
|
||||||
@@ -73,6 +105,7 @@ endif()
|
|||||||
# OS macros
|
# OS macros
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
add_definitions(-DUNIXCOMMON)
|
add_definitions(-DUNIXCOMMON)
|
||||||
|
add_link_options(-rdynamic) # Use -rdynamic so a backtrace log shows function names
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
@@ -95,14 +128,12 @@ set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
|||||||
|
|
||||||
# Set EXE names so the assets CMakeLists can refer to its target
|
# 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_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")
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(assets)
|
add_subdirectory(assets)
|
||||||
|
|
||||||
|
|
||||||
## config.h generation
|
## config.h generation
|
||||||
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
|
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
|
||||||
include(GitUtilities)
|
include(GitUtilities)
|
||||||
@@ -111,25 +142,3 @@ git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
|
|||||||
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
|
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
|
||||||
set(SRB2_COMP_REVISION "${SRB2_COMP_COMMIT}")
|
set(SRB2_COMP_REVISION "${SRB2_COMP_COMMIT}")
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
|
||||||
|
|
||||||
##### PACKAGE CONFIGURATION #####
|
|
||||||
|
|
||||||
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")
|
|
||||||
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)
|
|
||||||
@@ -22,14 +22,14 @@ We also have a Flatpak available on [Flathub](https://flathub.org/en/apps/org.sr
|
|||||||
|
|
||||||
See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling). The compiling process for SRB2Kart is largely identical to SRB2.
|
See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling). The compiling process for SRB2Kart is largely identical to SRB2.
|
||||||
|
|
||||||
Currently only the Makefile build system with GCC or Clang compiler is supported.
|
For Windows only the Makefile build system with GCC or Clang compiler is supported.
|
||||||
CMake is NOT supported at the moment, but will be availible again soon.
|
|
||||||
|
|
||||||
Visual C++ (MSVC) is unsupported.
|
Visual C++ (MSVC) is unsupported.
|
||||||
|
|
||||||
64-bit Windows builds are supported and recommended over 32-bit builds, they will build automatically when using the MSYS2 MinGW 64-bit executable (requires the mingw-w64-x86_64-gcc package), no extra flags needed!
|
64-bit Windows builds are supported and recommended over 32-bit builds, they will build automatically when using the MSYS2 MinGW 64-bit executable (requires the mingw-w64-x86_64-gcc package), no extra flags needed!
|
||||||
The specific DLLs can be found under /libs/dll-binaries/(i686 for 32bit/x86_64 for 64-bit)/ or in the Release packages
|
The specific DLLs can be found under /libs/dll-binaries/(i686 for 32bit/x86_64 for 64-bit)/ or in the Release packages
|
||||||
|
|
||||||
|
MacOS and Linux can be build with CMake, but it is recommended to use the Makefile for Linux over CMake
|
||||||
|
|
||||||
Alternatively the [srb2bld](https://github.com/Bijman/srb2bld) script by Bijman can be used aswell!
|
Alternatively the [srb2bld](https://github.com/Bijman/srb2bld) script by Bijman can be used aswell!
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
## Assets Target Configuration ##
|
## Assets Target Configuration ##
|
||||||
|
|
||||||
|
if(${CMAKE_SYSTEM} MATCHES Linux)
|
||||||
|
# Asset installation isn't part of the Linux target
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
# For prepending the current source path, later
|
# For prepending the current source path, later
|
||||||
FUNCTION(PREPEND var prefix)
|
FUNCTION(PREPEND var prefix)
|
||||||
SET(listVar "")
|
SET(listVar "")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
include(LibFindMacros)
|
include(LibFindMacros)
|
||||||
|
|
||||||
libfind_pkg_check_modules(GME_PKGCONF GME)
|
libfind_pkg_check_modules(GME_PKGCONF LIBGME)
|
||||||
|
|
||||||
find_path(GME_INCLUDE_DIR
|
find_path(GME_INCLUDE_DIR
|
||||||
NAMES gme.h
|
NAMES gme.h
|
||||||
@@ -8,6 +8,7 @@ find_path(GME_INCLUDE_DIR
|
|||||||
${GME_PKGCONF_INCLUDE_DIRS}
|
${GME_PKGCONF_INCLUDE_DIRS}
|
||||||
"/usr/include/gme"
|
"/usr/include/gme"
|
||||||
"/usr/local/include/gme"
|
"/usr/local/include/gme"
|
||||||
|
PATH_SUFFIXES gme
|
||||||
)
|
)
|
||||||
|
|
||||||
find_library(GME_LIBRARY
|
find_library(GME_LIBRARY
|
||||||
@@ -20,4 +21,4 @@ find_library(GME_LIBRARY
|
|||||||
|
|
||||||
set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR)
|
set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR)
|
||||||
set(GME_PROCESS_LIBS GME_LIBRARY)
|
set(GME_PROCESS_LIBS GME_LIBRARY)
|
||||||
libfind_process(GME)
|
libfind_process(GME)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
include(LibFindMacros)
|
include(LibFindMacros)
|
||||||
|
|
||||||
libfind_pkg_check_modules(OPENMPT_PKGCONF OPENMPT)
|
libfind_pkg_check_modules(OPENMPT_PKGCONF LIBOPENMPT)
|
||||||
|
|
||||||
find_path(OPENMPT_INCLUDE_DIR
|
find_path(OPENMPT_INCLUDE_DIR
|
||||||
NAMES libopenmpt.h
|
NAMES libopenmpt.h
|
||||||
@@ -8,6 +8,7 @@ find_path(OPENMPT_INCLUDE_DIR
|
|||||||
${OPENMPT_PKGCONF_INCLUDE_DIRS}
|
${OPENMPT_PKGCONF_INCLUDE_DIRS}
|
||||||
"/usr/include/libopenmpt"
|
"/usr/include/libopenmpt"
|
||||||
"/usr/local/include/libopenmpt"
|
"/usr/local/include/libopenmpt"
|
||||||
|
PATH_SUFFIXES libopenmpt
|
||||||
)
|
)
|
||||||
|
|
||||||
find_library(OPENMPT_LIBRARY
|
find_library(OPENMPT_LIBRARY
|
||||||
@@ -20,4 +21,4 @@ find_library(OPENMPT_LIBRARY
|
|||||||
|
|
||||||
set(OPENMPT_PROCESS_INCLUDES OPENMPT_INCLUDE_DIR)
|
set(OPENMPT_PROCESS_INCLUDES OPENMPT_INCLUDE_DIR)
|
||||||
set(OPENMPT_PROCESS_LIBS OPENMPT_LIBRARY)
|
set(OPENMPT_PROCESS_LIBS OPENMPT_LIBRARY)
|
||||||
libfind_process(OPENMPT)
|
libfind_process(OPENMPT)
|
||||||
@@ -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()
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# Version 2.2
|
# Version 2.4
|
||||||
# Public Domain, originally written by Lasse Kärkkäinen <tronic>
|
# Public Domain, originally written by Lasse Kärkkäinen <tronic>
|
||||||
# Maintained at https://github.com/Tronic/cmake-modules
|
# Maintained at https://github.com/Tronic/cmake-modules
|
||||||
# Please send your improvements as pull requests on Github.
|
# Please send your improvements as pull requests on Github.
|
||||||
@@ -52,6 +52,10 @@ function (libfind_pkg_detect PREFIX)
|
|||||||
if (libraryargs)
|
if (libraryargs)
|
||||||
find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS})
|
find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
# Read pkg-config version
|
||||||
|
if (${PREFIX}_PKGCONF_VERSION)
|
||||||
|
set(${PREFIX}_VERSION ${${PREFIX}_PKGCONF_VERSION} PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
# Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION.
|
# Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION.
|
||||||
@@ -125,24 +129,39 @@ function (libfind_process PREFIX)
|
|||||||
|
|
||||||
# Process deps to add to
|
# Process deps to add to
|
||||||
foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES})
|
foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES})
|
||||||
if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS)
|
if (DEFINED ${i}_INCLUDE_OPTS)
|
||||||
# The package seems to export option lists that we can use, woohoo!
|
# The package seems to export option lists that we can use, woohoo!
|
||||||
list(APPEND includeopts ${${i}_INCLUDE_OPTS})
|
list(APPEND includeopts ${${i}_INCLUDE_OPTS})
|
||||||
|
else()
|
||||||
|
if (DEFINED ${i}_INCLUDE_DIR)
|
||||||
|
# Singular forms can be used
|
||||||
|
list(APPEND includeopts ${i}_INCLUDE_DIR)
|
||||||
|
else()
|
||||||
|
if (DEFINED ${i}_INCLUDE_DIRS)
|
||||||
|
# Plural forms can be used
|
||||||
|
list(APPEND includeopts ${i}_INCLUDE_DIRS)
|
||||||
|
else()
|
||||||
|
# Oh no, we don't know the option names
|
||||||
|
message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes. Aieeh!")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (DEFINED ${i}_LIBRARY_OPTS)
|
||||||
|
# The package seems to export option lists that we can use, woohoo!
|
||||||
list(APPEND libraryopts ${${i}_LIBRARY_OPTS})
|
list(APPEND libraryopts ${${i}_LIBRARY_OPTS})
|
||||||
else()
|
else()
|
||||||
# If plural forms don't exist or they equal singular forms
|
if (DEFINED ${i}_LIBRARY)
|
||||||
if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR
|
|
||||||
({i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES))
|
|
||||||
# Singular forms can be used
|
# Singular forms can be used
|
||||||
if (DEFINED ${i}_INCLUDE_DIR)
|
list(APPEND libraryopts ${i}_LIBRARY)
|
||||||
list(APPEND includeopts ${i}_INCLUDE_DIR)
|
|
||||||
endif()
|
|
||||||
if (DEFINED ${i}_LIBRARY)
|
|
||||||
list(APPEND libraryopts ${i}_LIBRARY)
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
# Oh no, we don't know the option names
|
if (DEFINED ${i}_LIBRARIES)
|
||||||
message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!")
|
# Plural forms can be used
|
||||||
|
list(APPEND libraryopts ${i}_LIBRARIES)
|
||||||
|
else()
|
||||||
|
# Oh no, we don't know the option names
|
||||||
|
message(FATAL_ERROR "We couldn't determine config variable names for ${i} libraries. Aieeh!")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
@@ -209,12 +228,12 @@ function (libfind_process PREFIX)
|
|||||||
message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}")
|
message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}")
|
||||||
message(STATUS " ${PREFIX}_LIBRARIES=${libs}")
|
message(STATUS " ${PREFIX}_LIBRARIES=${libs}")
|
||||||
endif()
|
endif()
|
||||||
set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
|
|
||||||
set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
|
|
||||||
set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
|
|
||||||
set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
|
|
||||||
set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
|
|
||||||
endif()
|
endif()
|
||||||
|
set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
|
||||||
|
set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
|
||||||
|
set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
|
||||||
|
set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
|
||||||
|
set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
+88
-31
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
# Core sources
|
# Core sources
|
||||||
set(SRB2_CORE_SOURCES
|
set(SRB2_CORE_SOURCES
|
||||||
|
core/memory.cpp
|
||||||
|
core/thread_pool.cpp
|
||||||
am_map.c
|
am_map.c
|
||||||
b_bot.c
|
b_bot.c
|
||||||
command.c
|
command.c
|
||||||
@@ -18,17 +20,21 @@ set(SRB2_CORE_SOURCES
|
|||||||
f_wipe.c
|
f_wipe.c
|
||||||
filesrch.c
|
filesrch.c
|
||||||
g_game.c
|
g_game.c
|
||||||
|
g_demo.c
|
||||||
g_input.c
|
g_input.c
|
||||||
hu_stuff.c
|
hu_stuff.c
|
||||||
i_tcp.c
|
i_tcp.c
|
||||||
info.c
|
info.c
|
||||||
|
k_hud.c
|
||||||
lzf.c
|
lzf.c
|
||||||
m_aatree.c
|
m_aatree.c
|
||||||
m_anigif.c
|
m_anigif.c
|
||||||
m_argv.c
|
m_argv.c
|
||||||
m_bbox.c
|
m_bbox.c
|
||||||
m_cheat.c
|
m_cheat.c
|
||||||
|
m_curl.c
|
||||||
m_cond.c
|
m_cond.c
|
||||||
|
m_emotes.cpp
|
||||||
m_fixed.c
|
m_fixed.c
|
||||||
m_menu.c
|
m_menu.c
|
||||||
m_textinput.c
|
m_textinput.c
|
||||||
@@ -40,19 +46,25 @@ set(SRB2_CORE_SOURCES
|
|||||||
mserv.c
|
mserv.c
|
||||||
http-mserv.c
|
http-mserv.c
|
||||||
qs22j.c
|
qs22j.c
|
||||||
|
r_skins.c
|
||||||
s_sound.c
|
s_sound.c
|
||||||
screen.c
|
screen.c
|
||||||
sounds.c
|
sounds.c
|
||||||
st_stuff.c
|
st_stuff.c
|
||||||
#string.c
|
string.c
|
||||||
tables.c
|
tables.c
|
||||||
v_video.c
|
v_video.c
|
||||||
w_wad.c
|
w_wad.c
|
||||||
y_inter.c
|
y_inter.c
|
||||||
z_zone.c
|
z_zone.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SRB2_CORE_HEADERS
|
set(SRB2_CORE_HEADERS
|
||||||
|
core/memory.h
|
||||||
|
core/thread_pool.h
|
||||||
|
m_curl.h
|
||||||
|
m_emotes.h
|
||||||
|
k_hud.h
|
||||||
am_map.h
|
am_map.h
|
||||||
b_bot.h
|
b_bot.h
|
||||||
byteptr.h
|
byteptr.h
|
||||||
@@ -78,6 +90,7 @@ set(SRB2_CORE_HEADERS
|
|||||||
fastcmp.h
|
fastcmp.h
|
||||||
filesrch.h
|
filesrch.h
|
||||||
g_game.h
|
g_game.h
|
||||||
|
g_demo.h
|
||||||
g_input.h
|
g_input.h
|
||||||
g_state.h
|
g_state.h
|
||||||
hu_stuff.h
|
hu_stuff.h
|
||||||
@@ -109,6 +122,7 @@ set(SRB2_CORE_HEADERS
|
|||||||
md5.h
|
md5.h
|
||||||
mserv.h
|
mserv.h
|
||||||
qs22j.h
|
qs22j.h
|
||||||
|
r_skins.h
|
||||||
s_sound.h
|
s_sound.h
|
||||||
screen.h
|
screen.h
|
||||||
sounds.h
|
sounds.h
|
||||||
@@ -123,18 +137,18 @@ set(SRB2_CORE_HEADERS
|
|||||||
)
|
)
|
||||||
|
|
||||||
set(SRB2_CORE_RENDER_SOURCES
|
set(SRB2_CORE_RENDER_SOURCES
|
||||||
r_bsp.c
|
r_bsp.cpp
|
||||||
r_data.c
|
r_data.c
|
||||||
r_draw.c
|
r_draw.cpp
|
||||||
r_fps.c
|
r_fps.cpp
|
||||||
r_main.c
|
r_main.cpp
|
||||||
r_patch.c
|
r_patch.cpp
|
||||||
r_patchrotation.c
|
r_patchrotation.cpp
|
||||||
r_plane.c
|
r_plane.cpp
|
||||||
r_segs.c
|
r_segs.cpp
|
||||||
r_sky.c
|
r_sky.c
|
||||||
r_splats.c
|
r_splats.c
|
||||||
r_things.c
|
r_things.cpp
|
||||||
r_portal.c
|
r_portal.c
|
||||||
|
|
||||||
r_bsp.h
|
r_bsp.h
|
||||||
@@ -162,7 +176,7 @@ set(SRB2_CORE_GAME_SOURCES
|
|||||||
p_inter.c
|
p_inter.c
|
||||||
p_lights.c
|
p_lights.c
|
||||||
p_map.c
|
p_map.c
|
||||||
p_maputl.c
|
p_maputl.cpp
|
||||||
p_mobj.c
|
p_mobj.c
|
||||||
p_polyobj.c
|
p_polyobj.c
|
||||||
p_saveg.c
|
p_saveg.c
|
||||||
@@ -177,6 +191,7 @@ set(SRB2_CORE_GAME_SOURCES
|
|||||||
k_kart.c
|
k_kart.c
|
||||||
k_stats.c
|
k_stats.c
|
||||||
i_time.c
|
i_time.c
|
||||||
|
i_threads.c
|
||||||
|
|
||||||
p_local.h
|
p_local.h
|
||||||
p_maputl.h
|
p_maputl.h
|
||||||
@@ -193,10 +208,6 @@ set(SRB2_CORE_GAME_SOURCES
|
|||||||
k_stats.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_SOURCES)
|
||||||
prepend_sources(SRB2_CORE_HEADERS)
|
prepend_sources(SRB2_CORE_HEADERS)
|
||||||
prepend_sources(SRB2_CORE_RENDER_SOURCES)
|
prepend_sources(SRB2_CORE_RENDER_SOURCES)
|
||||||
@@ -226,10 +237,23 @@ set(SRB2_CONFIG_HWRENDER ON CACHE BOOL
|
|||||||
"Enable hardware rendering through OpenGL.")
|
"Enable hardware rendering through OpenGL.")
|
||||||
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
|
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
|
||||||
"Use statically linked OpenGL. NOT RECOMMENDED.")
|
"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
|
set(SRB2_CONFIG_DEDICATED OFF CACHE BOOL
|
||||||
"Build a dedicated server.")
|
"Build a dedicated server.")
|
||||||
|
set(SRB2_CONFIG_LIBBACKTRACE ON CACHE BOOL
|
||||||
|
"Enable using libbacktrace for crashlogs.")
|
||||||
|
set(SRB2_CONFIG_LTO ON CACHE BOOL
|
||||||
|
"Enable link time optimizations, improves performance at the cost of longer link times.")
|
||||||
|
set(SRB2_CONFIG_ASAN OFF CACHE BOOL
|
||||||
|
"Compile with AddressSanitizer (libasan).")
|
||||||
|
set(SRB2_CONFIG_UBSAN OFF CACHE BOOL
|
||||||
|
"Compile with UndefinedBehaviorSanitizer (libubsan).")
|
||||||
|
|
||||||
|
set(SRB2_CONFIG_SATURNPAK ON CACHE BOOL
|
||||||
|
"Enable Saturn specific special packet. Required for using the newer resynch system")
|
||||||
|
set(SRB2_CONFIG_SATURNJOIN ON CACHE BOOL
|
||||||
|
"Enable Saturn specific allowjoin toggle.")
|
||||||
|
set(SRB2_CONFIG_SCREENFBO ON CACHE BOOL
|
||||||
|
"Enable hardware renderer (OpenGL) FBO downsampling support")
|
||||||
|
|
||||||
if(${SRB2_CONFIG_DEDICATED})
|
if(${SRB2_CONFIG_DEDICATED})
|
||||||
set(SRB2_CONFIG_HAVE_GME NO)
|
set(SRB2_CONFIG_HAVE_GME NO)
|
||||||
@@ -469,16 +493,36 @@ if(${SRB2_CONFIG_HAVE_CURL})
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(${SRB2_CONFIG_LIBBACKTRACE})
|
||||||
|
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||||
|
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||||
|
set(LIBBACKTRACE_FOUND ON)
|
||||||
|
set(LIBBACKTRACE_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/libbacktrace/include)
|
||||||
|
set(LIBBACKTRACE_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libbacktrace/lib/x86_64 -lbacktrace")
|
||||||
|
else() # 32-bit
|
||||||
|
message(WARNING "libbacktrace is unsupported on 32-bit builds.")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(libbacktrace)
|
||||||
|
endif()
|
||||||
|
if(${LIBBACKTRACE_FOUND})
|
||||||
|
set(SRB2_HAVE_LIBBACKTRACE ON)
|
||||||
|
add_definitions(-DHAVE_LIBBACKTRACE)
|
||||||
|
else()
|
||||||
|
message(WARNING "You have specified that libbacktrace is available but it was not found.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(${SRB2_CONFIG_HWRENDER})
|
if(${SRB2_CONFIG_HWRENDER})
|
||||||
add_definitions(-DHWRENDER)
|
add_definitions(-DHWRENDER)
|
||||||
set(SRB2_HWRENDER_SOURCES
|
set(SRB2_HWRENDER_SOURCES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_shaders.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_shaders.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
|
||||||
@@ -493,7 +537,6 @@ if(${SRB2_CONFIG_HWRENDER})
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.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_gl.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
||||||
@@ -512,7 +555,6 @@ if(${SRB2_CONFIG_HWRENDER})
|
|||||||
set(SRB2_R_OPENGL_HEADERS
|
set(SRB2_R_OPENGL_HEADERS
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.h
|
||||||
)
|
)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
|
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
|
||||||
@@ -525,25 +567,40 @@ if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${SRB2_CONFIG_HWRENDER})
|
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_SCREENFBO})
|
||||||
if(${SRB2_CONFIG_USE_FBO_OGL})
|
add_definitions(-DUSE_FBO_OGL)
|
||||||
set(SRB2_USE_FBO_OGL ON)
|
endif()
|
||||||
add_definitions(-DUSE_FBO_OGL)
|
|
||||||
endif()
|
if(${SRB2_CONFIG_SATURNPAK})
|
||||||
|
add_definitions(-DDOSATURNPAK)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${SRB2_CONFIG_SATURNJOIN})
|
||||||
|
add_definitions(-DDOSATURNJOIN)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Targets
|
# Targets
|
||||||
|
|
||||||
# Compatibility flag with later versions of GCC
|
# Compatibility flag with later versions of GCC
|
||||||
# We should really fix our code to not need this
|
# We should really fix our code to not need this
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields)
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|x64|amd64|AMD64|em64t|EM64T)")
|
||||||
|
add_compile_options(-mno-ms-bitfields)
|
||||||
|
endif()
|
||||||
|
add_compile_options(-Wno-trigraphs)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
# TODO: fix prng and P_CreateBlockmap overflow at some point
|
||||||
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
|
add_compile_options(-fwrapv)
|
||||||
|
|
||||||
|
if (${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||||
|
add_compile_options(-O0)
|
||||||
|
else()
|
||||||
|
add_compile_options(-O3)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_compile_options(-g)
|
||||||
|
|
||||||
add_definitions(-DCMAKECONFIG)
|
add_definitions(-DCMAKECONFIG)
|
||||||
|
|
||||||
#add_library(SRB2Core STATIC
|
#add_library(SRB2Core STATIC
|
||||||
|
|||||||
@@ -8,11 +8,6 @@ ifdef MINGW
|
|||||||
libs+=-mconsole
|
libs+=-mconsole
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef NOTHREADS
|
|
||||||
opts+=-DHAVE_THREADS
|
|
||||||
sources+=dedicated/i_threads.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
NOOPENMPT=1
|
NOOPENMPT=1
|
||||||
NOLIBGME=1
|
NOLIBGME=1
|
||||||
NOHW=1
|
NOHW=1
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ endif
|
|||||||
gcc_versions:=\
|
gcc_versions:=\
|
||||||
152 151 150 15\
|
152 151 150 15\
|
||||||
142 141 140 14\
|
142 141 140 14\
|
||||||
132 131 130 13\
|
133 132 131 130 13\
|
||||||
123 122 121 120 12\
|
123 122 121 120 12\
|
||||||
114 113 112 111 110 11\
|
114 113 112 111 110 11\
|
||||||
105 104 103 102 101 100 10\
|
105 104 103 102 101 100 10\
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ endif
|
|||||||
sources+=$(call List,hardware/Sourcefile)
|
sources+=$(call List,hardware/Sourcefile)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef NOTHREADS
|
||||||
|
opts+=-DHAVE_THREADS
|
||||||
|
sources+=i_threads.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifndef NOMD5
|
ifndef NOMD5
|
||||||
sources+=md5.c
|
sources+=md5.c
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -40,11 +40,6 @@ sources+=sdl/mixer_sound.c
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifndef NOTHREADS
|
|
||||||
opts+=-DHAVE_THREADS
|
|
||||||
sources+=sdl/i_threads.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef SDL_PKGCONFIG
|
ifdef SDL_PKGCONFIG
|
||||||
$(eval $(call Use_pkg_config,SDL))
|
$(eval $(call Use_pkg_config,SDL))
|
||||||
else
|
else
|
||||||
|
|||||||
+3
-3
@@ -13,13 +13,13 @@
|
|||||||
#ifndef __COMMAND_H__
|
#ifndef __COMMAND_H__
|
||||||
#define __COMMAND_H__
|
#define __COMMAND_H__
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "doomdef.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "doomdef.h"
|
|
||||||
|
|
||||||
//===================================
|
//===================================
|
||||||
// Command buffer & command execution
|
// Command buffer & command execution
|
||||||
//===================================
|
//===================================
|
||||||
|
|||||||
+3
-38
@@ -11,21 +11,6 @@
|
|||||||
|
|
||||||
#ifdef CMAKECONFIG
|
#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_REVISION "${SRB2_COMP_REVISION}"
|
||||||
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
|
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
|
||||||
|
|
||||||
@@ -33,30 +18,10 @@
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/* Manually defined asset hashes for non-CMake builds
|
#define SRB2_COMP_REVISION ""
|
||||||
* Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb
|
#define SRB2_COMP_BRANCH ""
|
||||||
* 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 CMAKE_ASSETS_DIR ""
|
||||||
#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
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
+3
-3
@@ -44,14 +44,14 @@
|
|||||||
#define MAXHUDLINES 20
|
#define MAXHUDLINES 20
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_mutex con_mutex;
|
I_Mutex con_mutex;
|
||||||
|
|
||||||
// g_in_exiting_signal_handler is an evil hack
|
// g_in_exiting_signal_handler is an evil hack
|
||||||
// to avoid infinite SIGABRT recursion in the signal handler
|
// to avoid infinite SIGABRT recursion in the signal handler
|
||||||
// due to poisoned locks or mach-o kernel not supporting locks in signals
|
// due to poisoned locks or mach-o kernel not supporting locks in signals
|
||||||
// or something like that. idk
|
// or something like that. idk
|
||||||
# define Lock_state() if (!g_in_exiting_signal_handler) { I_lock_mutex(&con_mutex); }
|
# define Lock_state() if (!g_in_exiting_signal_handler) { I_LockMutex(&con_mutex); }
|
||||||
# define Unlock_state() if (!g_in_exiting_signal_handler) { I_unlock_mutex(con_mutex); }
|
# define Unlock_state() if (!g_in_exiting_signal_handler) { I_UnlockMutex(con_mutex); }
|
||||||
#else/*HAVE_THREADS*/
|
#else/*HAVE_THREADS*/
|
||||||
# define Lock_state()
|
# define Lock_state()
|
||||||
# define Unlock_state()
|
# define Unlock_state()
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ void CON_Init(void);
|
|||||||
boolean CON_Responder(event_t *ev);
|
boolean CON_Responder(event_t *ev);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
extern I_mutex con_mutex;
|
extern I_Mutex con_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set true when screen size has changed, to adapt console
|
// set true when screen size has changed, to adapt console
|
||||||
|
|||||||
+4
-4
@@ -2830,11 +2830,11 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
|||||||
F_TitleScreenDrawer();
|
F_TitleScreenDrawer();
|
||||||
CL_DrawConnectionStatus();
|
CL_DrawConnectionStatus();
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&m_menu_mutex);
|
I_LockMutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
M_Drawer(); //Needed for drawing messageboxes on the connection screen
|
M_Drawer(); //Needed for drawing messageboxes on the connection screen
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(m_menu_mutex);
|
I_UnlockMutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
I_UpdateNoVsync(); // page flip or blit buffer
|
I_UpdateNoVsync(); // page flip or blit buffer
|
||||||
if (moviemode)
|
if (moviemode)
|
||||||
@@ -7187,12 +7187,12 @@ void NetUpdate(void)
|
|||||||
{
|
{
|
||||||
resptime = nowtime;
|
resptime = nowtime;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&m_menu_mutex);
|
I_LockMutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
M_Ticker();
|
M_Ticker();
|
||||||
refreshdirmenu = 0;
|
refreshdirmenu = 0;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(m_menu_mutex);
|
I_UnlockMutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
CON_Ticker();
|
CON_Ticker();
|
||||||
}
|
}
|
||||||
|
|||||||
+36
-6
@@ -80,6 +80,31 @@
|
|||||||
|
|
||||||
#include "lua_script.h"
|
#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
|
#ifdef CMAKECONFIG
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#else
|
#else
|
||||||
@@ -198,13 +223,13 @@ void D_ProcessEvents(void)
|
|||||||
|
|
||||||
// Menu input
|
// Menu input
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&m_menu_mutex);
|
I_LockMutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
eaten = M_Responder(ev);
|
eaten = M_Responder(ev);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(m_menu_mutex);
|
I_UnlockMutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (eaten)
|
if (eaten)
|
||||||
@@ -219,13 +244,13 @@ void D_ProcessEvents(void)
|
|||||||
|
|
||||||
// console input
|
// console input
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&con_mutex);
|
I_LockMutex(&con_mutex);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
eaten = CON_Responder(ev);
|
eaten = CON_Responder(ev);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(con_mutex);
|
I_UnlockMutex(con_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (eaten)
|
if (eaten)
|
||||||
@@ -552,11 +577,11 @@ static boolean D_Display(void)
|
|||||||
vid.recalc = false;
|
vid.recalc = false;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&m_menu_mutex);
|
I_LockMutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
M_Drawer(); // menu is drawn even on top of everything...
|
M_Drawer(); // menu is drawn even on top of everything...
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(m_menu_mutex);
|
I_UnlockMutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
// focus lost moved to M_Drawer
|
// focus lost moved to M_Drawer
|
||||||
|
|
||||||
@@ -882,7 +907,9 @@ void D_ClearState(void)
|
|||||||
|
|
||||||
// okay, stop now
|
// okay, stop now
|
||||||
// (otherwise the game still thinks we're playing!)
|
// (otherwise the game still thinks we're playing!)
|
||||||
|
#ifdef HAVE_CURL
|
||||||
CURLAbortFile();
|
CURLAbortFile();
|
||||||
|
#endif
|
||||||
SV_StopServer();
|
SV_StopServer();
|
||||||
SV_ResetServer();
|
SV_ResetServer();
|
||||||
|
|
||||||
@@ -946,6 +973,9 @@ void D_ClearState(void)
|
|||||||
//
|
//
|
||||||
void D_StartTitle(void)
|
void D_StartTitle(void)
|
||||||
{
|
{
|
||||||
|
if (dedicated)
|
||||||
|
I_Error("D_StartTitle is called on dedicated server");
|
||||||
|
|
||||||
D_ClearState();
|
D_ClearState();
|
||||||
multiplayer = netgame = false; // title menu shouldnt be a netgame or multiplayer lmao
|
multiplayer = netgame = false; // title menu shouldnt be a netgame or multiplayer lmao
|
||||||
F_StartTitleScreen();
|
F_StartTitleScreen();
|
||||||
|
|||||||
+6
-1
@@ -54,6 +54,9 @@
|
|||||||
#include "fastcmp.h"
|
#include "fastcmp.h"
|
||||||
#include "m_perfstats.h"
|
#include "m_perfstats.h"
|
||||||
|
|
||||||
|
#include "r_data.h"
|
||||||
|
#include "r_skins.h"
|
||||||
|
|
||||||
#ifdef NETGAME_DEVMODE
|
#ifdef NETGAME_DEVMODE
|
||||||
#define CV_RESTRICT CV_NETVAR
|
#define CV_RESTRICT CV_NETVAR
|
||||||
#else
|
#else
|
||||||
@@ -1006,6 +1009,9 @@ void D_RegisterClientCommands(void)
|
|||||||
CV_RegisterVar(&cv_gamepadled[i]);
|
CV_RegisterVar(&cv_gamepadled[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CV_RegisterVar(&cv_gamepadledifunfocused);
|
||||||
|
CV_RegisterVar(&cv_rumbleifunfocused);
|
||||||
|
|
||||||
CV_RegisterVar(&cv_usemouse);
|
CV_RegisterVar(&cv_usemouse);
|
||||||
CV_RegisterVar(&cv_invertmouse);
|
CV_RegisterVar(&cv_invertmouse);
|
||||||
CV_RegisterVar(&cv_mousexsens);
|
CV_RegisterVar(&cv_mousexsens);
|
||||||
@@ -2652,7 +2658,6 @@ static void Command_Map_f(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
last_map_cmd = I_GetTime();
|
last_map_cmd = I_GetTime();
|
||||||
|
|
||||||
size_t first_option;
|
size_t first_option;
|
||||||
|
|||||||
+6
-6
@@ -112,7 +112,7 @@ static fileused_t transferFiles[UINT8_MAX + 1];
|
|||||||
INT32 fileneedednum = 0; // Number of files needed to join the server
|
INT32 fileneedednum = 0; // Number of files needed to join the server
|
||||||
fileneeded_t fileneeded[MAX_WADFILES] = {}; // List of needed files
|
fileneeded_t fileneeded[MAX_WADFILES] = {}; // List of needed files
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
static I_mutex downloadmutex;
|
static I_Mutex downloadmutex;
|
||||||
#endif
|
#endif
|
||||||
char downloaddir[512] = "DOWNLOAD";
|
char downloaddir[512] = "DOWNLOAD";
|
||||||
|
|
||||||
@@ -1427,7 +1427,7 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
|||||||
filedownload.http_running = true;
|
filedownload.http_running = true;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_spawn_thread("http-download", (I_thread_fn)CURLGetFile, NULL);
|
(void)!I_SpawnThread("http-download", (I_ThreadFn)CURLGetFile, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1440,15 +1440,15 @@ void CURLAbortFile(void)
|
|||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
// lock and unlock to wait for the download thread to exit
|
// lock and unlock to wait for the download thread to exit
|
||||||
I_lock_mutex(&downloadmutex);
|
I_LockMutex(&downloadmutex);
|
||||||
I_unlock_mutex(downloadmutex);
|
I_UnlockMutex(downloadmutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CURLGetFile(void)
|
static void CURLGetFile(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&downloadmutex);
|
I_LockMutex(&downloadmutex);
|
||||||
#endif
|
#endif
|
||||||
CURLMcode mc; /* return code used by curl_multi_wait() */
|
CURLMcode mc; /* return code used by curl_multi_wait() */
|
||||||
CURLcode easyres; /* Return from easy interface */
|
CURLcode easyres; /* Return from easy interface */
|
||||||
@@ -1549,7 +1549,7 @@ static void CURLGetFile(void)
|
|||||||
|
|
||||||
filedownload.http_running = false;
|
filedownload.http_running = false;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(downloadmutex);
|
I_UnlockMutex(downloadmutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,75 @@
|
|||||||
# Declare dedicated interface sources
|
# Declare dedicated interface sources
|
||||||
|
|
||||||
target_sourcefile(c)
|
set(SRB2_DEDICATED_SOURCES
|
||||||
|
i_system.c
|
||||||
|
i_main.c
|
||||||
|
i_video.c
|
||||||
|
i_sound.c
|
||||||
|
i_threads.c
|
||||||
|
dosstr.c
|
||||||
|
endtxt.c
|
||||||
|
)
|
||||||
|
|
||||||
target_sources(SRB2SDL2 PRIVATE)
|
set(SRB2_DEDICATED_HEADERS
|
||||||
|
endtxt.h
|
||||||
|
)
|
||||||
|
|
||||||
|
source_group("Interface Code" FILES ${SRB2_DEDICATED_SOURCES} ${SRB2_DEDICATED_HEADERS})
|
||||||
|
|
||||||
|
set(SRB2_DEDICATED_TOTAL_SOURCES
|
||||||
|
${SRB2_CORE_SOURCES}
|
||||||
|
${SRB2_CORE_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_DEDICATED_SOURCES}
|
||||||
|
${SRB2_DEDICATED_HEADERS}
|
||||||
|
)
|
||||||
|
|
||||||
|
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})
|
||||||
|
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
|
||||||
|
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||||
target_sources(SRB2SDL2 PRIVATE
|
set(SRB2_DEDICATED_TOTAL_SOURCES ${SRB2_DEDICATED_TOTAL_SOURCES}
|
||||||
../win32/win_dbg.c
|
${CMAKE_SOURCE_DIR}/src/win32/win_dbg.c
|
||||||
../win32/Srb2win.rc)
|
${CMAKE_SOURCE_DIR}/src/win32/Srb2win.rc
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_DEDICATED_TOTAL_SOURCES})
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2legacy)
|
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2kartd)
|
||||||
elseif(${CMAKE_SYSTEM} MATCHES Linux)
|
elseif(${CMAKE_SYSTEM} MATCHES Linux)
|
||||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME lsrb2dlegacy)
|
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME lsrb2kartd)
|
||||||
else()
|
else()
|
||||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2legacy)
|
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME srb2kartd)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
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()
|
endif()
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||||
@@ -24,25 +78,27 @@ if(${CMAKE_SYSTEM} MATCHES Darwin)
|
|||||||
${CORE_LIB}
|
${CORE_LIB}
|
||||||
${PNG_LIBRARIES}
|
${PNG_LIBRARIES}
|
||||||
${ZLIB_LIBRARIES}
|
${ZLIB_LIBRARIES}
|
||||||
|
${CURL_LIBRARIES}
|
||||||
)
|
)
|
||||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
|
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
|
||||||
else()
|
else()
|
||||||
target_link_libraries(SRB2SDL2 PRIVATE
|
target_link_libraries(SRB2SDL2 PRIVATE
|
||||||
${PNG_LIBRARIES}
|
${PNG_LIBRARIES}
|
||||||
${ZLIB_LIBRARIES}
|
${ZLIB_LIBRARIES}
|
||||||
|
${CURL_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Linux)
|
if(${CMAKE_SYSTEM} MATCHES Linux)
|
||||||
target_link_libraries(SRB2SDL2 PRIVATE
|
target_link_libraries(SRB2SDL2 PRIVATE
|
||||||
m
|
m
|
||||||
rt
|
rt
|
||||||
|
pthread
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#target_link_libraries(SRB2SDL2 PRIVATE SRB2Core)
|
if(${SRB2_HAVE_LIBBACKTRACE})
|
||||||
|
target_link_libraries(SRB2SDL2 PRIVATE ${LIBBACKTRACE_LIBRARIES})
|
||||||
set_target_properties(SRB2SDL2 PROPERTIES VERSION ${SRB2_VERSION})
|
endif()
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Windows)
|
if(${CMAKE_SYSTEM} MATCHES Windows)
|
||||||
target_link_libraries(SRB2SDL2 PRIVATE
|
target_link_libraries(SRB2SDL2 PRIVATE
|
||||||
@@ -60,20 +116,35 @@ target_include_directories(SRB2SDL2 PRIVATE
|
|||||||
|
|
||||||
target_compile_definitions(SRB2SDL2 PRIVATE
|
target_compile_definitions(SRB2SDL2 PRIVATE
|
||||||
-DDEDICATED
|
-DDEDICATED
|
||||||
|
-DHAVE_THREADS
|
||||||
)
|
)
|
||||||
|
|
||||||
## strip debug symbols into separate file when using gcc
|
if(SRB2_CONFIG_LTO AND NOT SRB2_CONFIG_DEBUGMODE)
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
set_property(TARGET SRB2SDL2 PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||||
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()
|
endif()
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
## 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 ####
|
#### Installation ####
|
||||||
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
if(${CMAKE_SYSTEM} MATCHES Darwin)
|
||||||
install(TARGETS SRB2SDL2
|
install(TARGETS SRB2SDL2
|
||||||
|
|||||||
@@ -2,6 +2,5 @@ i_system.c
|
|||||||
i_main.c
|
i_main.c
|
||||||
i_video.c
|
i_video.c
|
||||||
i_sound.c
|
i_sound.c
|
||||||
i_threads.c
|
|
||||||
dosstr.c
|
dosstr.c
|
||||||
endtxt.c
|
endtxt.c
|
||||||
@@ -180,10 +180,6 @@ static char returnWadPath[256];
|
|||||||
|
|
||||||
#include "../m_argv.h"
|
#include "../m_argv.h"
|
||||||
|
|
||||||
#ifdef MAC_ALERT
|
|
||||||
#include "macosx/mac_alert.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../d_main.h"
|
#include "../d_main.h"
|
||||||
|
|
||||||
#if !defined(NOMUMBLE) && defined(HAVE_MUMBLE)
|
#if !defined(NOMUMBLE) && defined(HAVE_MUMBLE)
|
||||||
@@ -1385,8 +1381,8 @@ INT32 I_StartupSystem(void)
|
|||||||
I_Fork();
|
I_Fork();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_start_threads();
|
I_StartThreads();
|
||||||
I_AddExitFunc(I_stop_threads);
|
I_AddExitFunc(I_StopThreads);
|
||||||
#endif
|
#endif
|
||||||
I_RegisterSignals();
|
I_RegisterSignals();
|
||||||
#ifndef NOMUMBLE
|
#ifndef NOMUMBLE
|
||||||
|
|||||||
+32
-9
@@ -40,22 +40,45 @@
|
|||||||
#define ASMCALL
|
#define ASMCALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus /* Only when compiled as C++ */
|
||||||
|
#include <algorithm> /* std::min, std::max, std::sort, … */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
// Force libc++ to expose std::min/std::max even when <cmath> is included first (Apple clang quirk)
|
||||||
|
#ifndef _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
|
||||||
|
#define _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
|
||||||
|
#endif
|
||||||
|
#ifndef _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
|
||||||
|
#define _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Optional: only try <version> if it actually exists (newer Xcode)
|
||||||
|
#if __has_include(<version>)
|
||||||
|
#include <version>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _USE_MATH_DEFINES
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstdarg>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstring>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#else
|
||||||
|
#include <math.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stddef.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
|
#include <limits.h>
|
||||||
#ifdef __cplusplus
|
|
||||||
#include <cmath>
|
|
||||||
#else
|
|
||||||
#include <math.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|||||||
@@ -223,6 +223,8 @@ typedef int32_t boolean;
|
|||||||
|
|
||||||
#define FUNCNOINLINE __attribute__((noinline))
|
#define FUNCNOINLINE __attribute__((noinline))
|
||||||
|
|
||||||
|
#define FUNCWARNRV __attribute__((warn_unused_result))
|
||||||
|
|
||||||
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
|
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
|
||||||
#ifdef __i386__ // i386 only
|
#ifdef __i386__ // i386 only
|
||||||
#define FUNCTARGET(X) __attribute__ ((__target__ (X)))
|
#define FUNCTARGET(X) __attribute__ ((__target__ (X)))
|
||||||
@@ -268,6 +270,9 @@ typedef int32_t boolean;
|
|||||||
#ifndef FUNCTARGET
|
#ifndef FUNCTARGET
|
||||||
#define FUNCTARGET(x)
|
#define FUNCTARGET(x)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FUNCWARNRV
|
||||||
|
#define FUNCWARNRV
|
||||||
|
#endif
|
||||||
#ifndef ATTRPACK
|
#ifndef ATTRPACK
|
||||||
#define ATTRPACK
|
#define ATTRPACK
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-3
@@ -1172,9 +1172,7 @@ void F_StartWaitingPlayers(void)
|
|||||||
randskin = M_RandomKey(numskins);
|
randskin = M_RandomKey(numskins);
|
||||||
boolean waithires = skins[randskin].flags && SF_HIRES;
|
boolean waithires = skins[randskin].flags && SF_HIRES;
|
||||||
|
|
||||||
if (waitcolormap)
|
Z_Free(waitcolormap);
|
||||||
Z_Free(waitcolormap);
|
|
||||||
|
|
||||||
waitcolormap = R_GetTranslationColormap(randskin, skins[randskin].prefcolor, 0);
|
waitcolormap = R_GetTranslationColormap(randskin, skins[randskin].prefcolor, 0);
|
||||||
|
|
||||||
if (waithires)
|
if (waithires)
|
||||||
|
|||||||
+2
-2
@@ -388,11 +388,11 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
|||||||
if (rendermode != render_none && drawMenu)
|
if (rendermode != render_none && drawMenu)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&m_menu_mutex);
|
I_LockMutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
M_Drawer(); // menu is drawn even on top of wipes
|
M_Drawer(); // menu is drawn even on top of wipes
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(m_menu_mutex);
|
I_UnlockMutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-8
@@ -317,8 +317,7 @@ void closefilemenu(boolean validsize)
|
|||||||
coredirmenu = NULL;
|
coredirmenu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refreshdirname)
|
Z_Free(refreshdirname);
|
||||||
Z_Free(refreshdirname);
|
|
||||||
refreshdirname = NULL;
|
refreshdirname = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,8 +345,7 @@ void searchfilemenu(char *tempname)
|
|||||||
|
|
||||||
if (!menusearch.length)
|
if (!menusearch.length)
|
||||||
{
|
{
|
||||||
if (dirmenu)
|
Z_Free(dirmenu);
|
||||||
Z_Free(dirmenu);
|
|
||||||
dirmenu = coredirmenu;
|
dirmenu = coredirmenu;
|
||||||
sizedirmenu = sizecoredirmenu;
|
sizedirmenu = sizecoredirmenu;
|
||||||
|
|
||||||
@@ -389,8 +387,8 @@ void searchfilemenu(char *tempname)
|
|||||||
I_Error("searchfilemenu(): could not create \"No results...\".");
|
I_Error("searchfilemenu(): could not create \"No results...\".");
|
||||||
sizedirmenu = 1;
|
sizedirmenu = 1;
|
||||||
dir_on[menudepthleft] = 0;
|
dir_on[menudepthleft] = 0;
|
||||||
if (tempname)
|
Z_Free(tempname);
|
||||||
Z_Free(tempname);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -505,8 +503,8 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
|||||||
{
|
{
|
||||||
closedir(dirhandle);
|
closedir(dirhandle);
|
||||||
closefilemenu(false);
|
closefilemenu(false);
|
||||||
if (tempname)
|
Z_Free(tempname);
|
||||||
Z_Free(tempname);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-9
@@ -456,10 +456,10 @@ consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS] = {
|
|||||||
|
|
||||||
//static CV_PossibleValue_t autoaccelcons_t[] = {{0, "Off"}, {1, "Manual"}, {2, "Automatic"}, {0, NULL}};
|
//static CV_PossibleValue_t autoaccelcons_t[] = {{0, "Off"}, {1, "Manual"}, {2, "Automatic"}, {0, NULL}};
|
||||||
consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS] = {
|
consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS] = {
|
||||||
{"autoaccel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
{"kartautoaccel", "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},
|
{"kartautoaccel2", "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},
|
{"kartautoaccel3", "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}
|
{"kartautoaccel4", "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}};
|
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
|
||||||
@@ -523,11 +523,8 @@ void G_ClearRecords(void)
|
|||||||
INT16 i;
|
INT16 i;
|
||||||
for (i = 0; i < NUMMAPS; ++i)
|
for (i = 0; i < NUMMAPS; ++i)
|
||||||
{
|
{
|
||||||
if (mainrecords[i])
|
Z_Free(mainrecords[i]);
|
||||||
{
|
mainrecords[i] = NULL;
|
||||||
Z_Free(mainrecords[i]);
|
|
||||||
mainrecords[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-7
@@ -81,6 +81,9 @@ consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS] = {
|
|||||||
{"gamepadled4", "Skincolor", CV_SAVE|CV_CALL|CV_NOINIT, gamepadled_cons_t, led_off_handle4, 0, NULL, NULL, 0, 0, NULL}
|
{"gamepadled4", "Skincolor", CV_SAVE|CV_CALL|CV_NOINIT, gamepadled_cons_t, led_off_handle4, 0, NULL, NULL, 0, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
consvar_t cv_gamepadledifunfocused = {"gamepadledunfocused", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
consvar_t cv_rumbleifunfocused = {"rumbleifunfocused", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
static void rumble_off_handle(void)
|
static void rumble_off_handle(void)
|
||||||
{
|
{
|
||||||
if (!cv_rumble[0].value)
|
if (!cv_rumble[0].value)
|
||||||
@@ -930,7 +933,7 @@ void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT8 color)
|
|||||||
|
|
||||||
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||||
|
|
||||||
if (cv_gamepadled[playernum].value == 0
|
if (cv_gamepadled[playernum].value == 0 || (window_notinfocus && cv_gamepadledifunfocused.value == 0)
|
||||||
|| color >= MAXTRANSLATIONS)
|
|| color >= MAXTRANSLATIONS)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -945,6 +948,8 @@ void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT8 color)
|
|||||||
|
|
||||||
static void G_ResetPlayerGamepadIndicatorColor(INT32 playernum)
|
static void G_ResetPlayerGamepadIndicatorColor(INT32 playernum)
|
||||||
{
|
{
|
||||||
|
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||||
|
|
||||||
if (cv_gamepadled[playernum].value == 0)
|
if (cv_gamepadled[playernum].value == 0)
|
||||||
{
|
{
|
||||||
I_SetGamepadIndicatorColor(playernum, 0, 0, 255);
|
I_SetGamepadIndicatorColor(playernum, 0, 0, 255);
|
||||||
@@ -973,13 +978,8 @@ void G_DeviceLEDTick(void)
|
|||||||
|
|
||||||
newcolor = G_GetSkinColorForGamepad(i);
|
newcolor = G_GetSkinColorForGamepad(i);
|
||||||
|
|
||||||
// compiler be absolutely tripping
|
|
||||||
// delet this if this gets fixed within gcc
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
|
||||||
if (curcolor[i] == newcolor) // dont update if same colour
|
if (curcolor[i] == newcolor) // dont update if same colour
|
||||||
continue;
|
continue;
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
|
|
||||||
G_SetPlayerGamepadIndicatorColor(i, newcolor);
|
G_SetPlayerGamepadIndicatorColor(i, newcolor);
|
||||||
curcolor[i] = newcolor;
|
curcolor[i] = newcolor;
|
||||||
@@ -994,6 +994,7 @@ void G_ResetDeviceLED(void)
|
|||||||
|
|
||||||
static void G_ResetPlayerDeviceRumble(INT32 playernum)
|
static void G_ResetPlayerDeviceRumble(INT32 playernum)
|
||||||
{
|
{
|
||||||
|
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||||
I_GamepadRumble(playernum, 0, 0, 0);
|
I_GamepadRumble(playernum, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1011,7 +1012,7 @@ void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_stre
|
|||||||
{
|
{
|
||||||
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||||
|
|
||||||
if (cv_rumble[playernum].value == 0)
|
if (cv_rumble[playernum].value == 0 || (window_notinfocus && cv_rumbleifunfocused.value == 0))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,9 @@ extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
|
|||||||
extern consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS];
|
extern consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS];
|
||||||
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
|
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
|
||||||
|
|
||||||
|
extern consvar_t cv_gamepadledifunfocused;
|
||||||
|
extern consvar_t cv_rumbleifunfocused;
|
||||||
|
|
||||||
extern INT32 mousex, mousey;
|
extern INT32 mousex, mousey;
|
||||||
|
|
||||||
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
|
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
|
|||||||
floatangle = 2.0 + (45.0 + ((double)tilt / 1.9)) * clipfov / 90.0;
|
floatangle = 2.0 + (45.0 + ((double)tilt / 1.9)) * clipfov / 90.0;
|
||||||
if (floatangle >= 180.0)
|
if (floatangle >= 180.0)
|
||||||
return 0xffffffff;
|
return 0xffffffff;
|
||||||
a1 = (angle_t)xs_CRoundToInt(ANG1 * floatangle);
|
a1 = (angle_t)lrint(ANG1 * floatangle);
|
||||||
return a1;
|
return a1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+22
-25
@@ -101,7 +101,8 @@ sector_t *gl_backsector = NULL;
|
|||||||
static constexpr float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f};
|
static constexpr float clipping_distances[] = {1024.0f, 2048.0f, 4096.0f, 6144.0f, 8192.0f, 12288.0f, 16384.0f};
|
||||||
// values for bsp culling
|
// values for bsp culling
|
||||||
// slightly higher than the far clipping plane to compensate for impreciseness
|
// slightly higher than the far clipping plane to compensate for impreciseness
|
||||||
static constexpr INT32 bsp_culling_distances[] = {(1024+512)*FRACUNIT, (2048+512)*FRACUNIT, (4096+512)*FRACUNIT,
|
static constexpr INT32 bsp_culling_distances[] = {
|
||||||
|
(1024+512)*FRACUNIT, (2048+512)*FRACUNIT, (4096+512)*FRACUNIT,
|
||||||
(6144+512)*FRACUNIT, (8192+512)*FRACUNIT, (12288+512)*FRACUNIT, (16384+512)*FRACUNIT};
|
(6144+512)*FRACUNIT, (8192+512)*FRACUNIT, (12288+512)*FRACUNIT, (16384+512)*FRACUNIT};
|
||||||
|
|
||||||
// Performance stats
|
// Performance stats
|
||||||
@@ -587,15 +588,11 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
|||||||
const sector_t *sec = FOFsector ? FOFsector : gl_frontsector;
|
const sector_t *sec = FOFsector ? FOFsector : gl_frontsector;
|
||||||
|
|
||||||
// Get the slope pointer to simplify future code
|
// Get the slope pointer to simplify future code
|
||||||
if (sec->f_slope && !isceiling)
|
if (!isceiling && sec->f_slope)
|
||||||
slope = sec->f_slope;
|
slope = sec->f_slope;
|
||||||
else if (sec->c_slope && isceiling)
|
else if (isceiling && sec->c_slope)
|
||||||
slope = sec->c_slope;
|
slope = sec->c_slope;
|
||||||
|
|
||||||
// Set fixedheight to the slope's height from our viewpoint, if we have a slope
|
|
||||||
if (slope)
|
|
||||||
fixedheight = P_GetSlopeZAt(slope, viewx, viewy);
|
|
||||||
|
|
||||||
height = FixedToFloat(fixedheight);
|
height = FixedToFloat(fixedheight);
|
||||||
|
|
||||||
// Allocate plane-vertex buffer if we need to
|
// Allocate plane-vertex buffer if we need to
|
||||||
@@ -687,18 +684,19 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
|||||||
vert->s = (tempxsow * cosangf) - (tempytow * sinangf);\
|
vert->s = (tempxsow * cosangf) - (tempytow * sinangf);\
|
||||||
vert->t = (tempxsow * sinangf) + (tempytow * cosangf);\
|
vert->t = (tempxsow * sinangf) + (tempytow * cosangf);\
|
||||||
}\
|
}\
|
||||||
|
\
|
||||||
|
if (slope)\
|
||||||
|
{\
|
||||||
|
fixedheight = P_GetSlopeZAt(slope, FloatToFixed((vx)), FloatToFixed((vy)));\
|
||||||
|
height = FixedToFloat(fixedheight);\
|
||||||
|
}\
|
||||||
\
|
\
|
||||||
vert->x = (vx);\
|
vert->x = (vx);\
|
||||||
vert->y = height;\
|
vert->y = height;\
|
||||||
vert->z = (vy);\
|
vert->z = (vy);\
|
||||||
\
|
\
|
||||||
if (slope)\
|
|
||||||
{\
|
|
||||||
fixedheight = P_GetSlopeZAt(slope, FloatToFixed((vx)), FloatToFixed((vy)));\
|
|
||||||
vert->y = FixedToFloat(fixedheight);\
|
|
||||||
}\
|
|
||||||
}
|
}
|
||||||
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++)
|
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++, pv++)
|
||||||
SETUP3DVERT(v3d, pv->x, pv->y);
|
SETUP3DVERT(v3d, pv->x, pv->y);
|
||||||
|
|
||||||
if (slope)
|
if (slope)
|
||||||
@@ -1785,10 +1783,10 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
|||||||
// Single sided line... Deal only with the middletexture (if one exists)
|
// Single sided line... Deal only with the middletexture (if one exists)
|
||||||
if (gl_midtexture && gl_linedef->special != HORIZONSPECIAL) // Ignore horizon line for OGL
|
if (gl_midtexture && gl_linedef->special != HORIZONSPECIAL) // Ignore horizon line for OGL
|
||||||
{
|
{
|
||||||
glTex = HWR_GetTexture(gl_midtexture, noencore);
|
|
||||||
|
|
||||||
fixed_t texturevpeg;
|
fixed_t texturevpeg;
|
||||||
|
|
||||||
|
glTex = HWR_GetTexture(gl_midtexture, noencore);
|
||||||
|
|
||||||
// PEGGING
|
// PEGGING
|
||||||
if ((gl_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2))
|
if ((gl_linedef->flags & (ML_DONTPEGBOTTOM|ML_EFFECT2)) == (ML_DONTPEGBOTTOM|ML_EFFECT2))
|
||||||
texturevpeg = gl_frontsector->floorheight + textureheight[gl_sidedef->midtexture] - gl_frontsector->ceilingheight + gl_sidedef->rowoffset;
|
texturevpeg = gl_frontsector->floorheight + textureheight[gl_sidedef->midtexture] - gl_frontsector->ceilingheight + gl_sidedef->rowoffset;
|
||||||
@@ -1875,8 +1873,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
|||||||
//Hurdler: 3d-floors test
|
//Hurdler: 3d-floors test
|
||||||
if (!gl_drawing_stencil && gl_backsector && gl_frontsector->tag != gl_backsector->tag && (gl_backsector->ffloors || gl_frontsector->ffloors))
|
if (!gl_drawing_stencil && gl_backsector && gl_frontsector->tag != gl_backsector->tag && (gl_backsector->ffloors || gl_frontsector->ffloors))
|
||||||
{
|
{
|
||||||
ffloor_t * rover;
|
ffloor_t *rover;
|
||||||
fixed_t highcut = 0, lowcut = 0;
|
fixed_t highcut = 0, lowcut = 0;
|
||||||
fixed_t lowcutslope = 0, highcutslope = 0;
|
fixed_t lowcutslope = 0, highcutslope = 0;
|
||||||
|
|
||||||
// Used for height comparisons and etc across FOFs and slopes
|
// Used for height comparisons and etc across FOFs and slopes
|
||||||
@@ -2947,7 +2945,7 @@ static void HWR_Subsector(size_t num)
|
|||||||
static sector_t tempsec; //SoM: 4/7/2000
|
static sector_t tempsec; //SoM: 4/7/2000
|
||||||
INT32 floorlightlevel;
|
INT32 floorlightlevel;
|
||||||
INT32 ceilinglightlevel;
|
INT32 ceilinglightlevel;
|
||||||
INT32 locFloorHeight, locCeilingHeight;
|
INT32 locFloorHeight = 0, locCeilingHeight = 0;
|
||||||
INT32 cullFloorHeight, cullCeilingHeight;
|
INT32 cullFloorHeight, cullCeilingHeight;
|
||||||
INT32 light = 0;
|
INT32 light = 0;
|
||||||
extracolormap_t *floorcolormap;
|
extracolormap_t *floorcolormap;
|
||||||
@@ -2993,11 +2991,12 @@ static void HWR_Subsector(size_t num)
|
|||||||
|
|
||||||
cullFloorHeight = P_GetSectorFloorZAt (gl_frontsector, viewx, viewy);
|
cullFloorHeight = P_GetSectorFloorZAt (gl_frontsector, viewx, viewy);
|
||||||
cullCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, viewx, viewy);
|
cullCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, viewx, viewy);
|
||||||
locFloorHeight = P_GetSectorFloorZAt (gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
|
|
||||||
locCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
|
|
||||||
|
|
||||||
if (gl_frontsector->ffloors)
|
if (gl_frontsector->ffloors)
|
||||||
{
|
{
|
||||||
|
locFloorHeight = P_GetSectorFloorZAt (gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
|
||||||
|
locCeilingHeight = P_GetSectorCeilingZAt(gl_frontsector, gl_frontsector->soundorg.x, gl_frontsector->soundorg.y);
|
||||||
|
|
||||||
boolean anyMoved = gl_frontsector->moved;
|
boolean anyMoved = gl_frontsector->moved;
|
||||||
|
|
||||||
if (anyMoved == false)
|
if (anyMoved == false)
|
||||||
@@ -3052,8 +3051,7 @@ static void HWR_Subsector(size_t num)
|
|||||||
{
|
{
|
||||||
HWR_GetFlat(levelflats[gl_frontsector->floorpic].lumpnum, R_NoEncore(gl_frontsector, false));
|
HWR_GetFlat(levelflats[gl_frontsector->floorpic].lumpnum, R_NoEncore(gl_frontsector, false));
|
||||||
HWR_RenderPlane(sub, &extrasubsectors[num], false,
|
HWR_RenderPlane(sub, &extrasubsectors[num], false,
|
||||||
// Hack to make things continue to work around slopes.
|
gl_frontsector->floorheight,
|
||||||
locFloorHeight == cullFloorHeight ? locFloorHeight : gl_frontsector->floorheight,
|
|
||||||
// We now return you to your regularly scheduled rendering.
|
// We now return you to your regularly scheduled rendering.
|
||||||
PF_Occlude, floorlightlevel, levelflats[gl_frontsector->floorpic].lumpnum, NULL, 255, floorcolormap);
|
PF_Occlude, floorlightlevel, levelflats[gl_frontsector->floorpic].lumpnum, NULL, 255, floorcolormap);
|
||||||
}
|
}
|
||||||
@@ -3068,8 +3066,7 @@ static void HWR_Subsector(size_t num)
|
|||||||
{
|
{
|
||||||
HWR_GetFlat(levelflats[gl_frontsector->ceilingpic].lumpnum, R_NoEncore(gl_frontsector, true));
|
HWR_GetFlat(levelflats[gl_frontsector->ceilingpic].lumpnum, R_NoEncore(gl_frontsector, true));
|
||||||
HWR_RenderPlane(sub, &extrasubsectors[num], true,
|
HWR_RenderPlane(sub, &extrasubsectors[num], true,
|
||||||
// Hack to make things continue to work around slopes.
|
gl_frontsector->ceilingheight,
|
||||||
locCeilingHeight == cullCeilingHeight ? locCeilingHeight : gl_frontsector->ceilingheight,
|
|
||||||
// We now return you to your regularly scheduled rendering.
|
// We now return you to your regularly scheduled rendering.
|
||||||
PF_Occlude, ceilinglightlevel, levelflats[gl_frontsector->ceilingpic].lumpnum, NULL, 255, ceilingcolormap);
|
PF_Occlude, ceilinglightlevel, levelflats[gl_frontsector->ceilingpic].lumpnum, NULL, 255, ceilingcolormap);
|
||||||
}
|
}
|
||||||
@@ -5447,7 +5444,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
|
|||||||
fixed_t fixedaiming = AIMINGTODY(aimingangle);
|
fixed_t fixedaiming = AIMINGTODY(aimingangle);
|
||||||
trans->viewaiming = FixedToFloat(fixedaiming) * (static_cast<float>(vid.width) / static_cast<float>(vid.height)) / (static_cast<float>(BASEVIDWIDTH) / static_cast<float>(BASEVIDHEIGHT));
|
trans->viewaiming = FixedToFloat(fixedaiming) * (static_cast<float>(vid.width) / static_cast<float>(vid.height)) / (static_cast<float>(BASEVIDWIDTH) / static_cast<float>(BASEVIDHEIGHT));
|
||||||
if (splitscreen == 1) // only for 2 player splitscreen
|
if (splitscreen == 1) // only for 2 player splitscreen
|
||||||
trans->viewaiming *= 2.125; // splitscreen adjusts fov with 0.8, so compensate (but only halfway, since splitscreen means only half the screen is used)
|
trans->viewaiming *= 2.125f; // splitscreen adjusts fov with 0.8, so compensate (but only halfway, since splitscreen means only half the screen is used)
|
||||||
trans->shearing = true;
|
trans->shearing = true;
|
||||||
gl_aimingangle = 0;
|
gl_aimingangle = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -579,7 +579,7 @@ md2found:
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HWR_AddPlayerMD2(int skin, boolean local) // For MD2's that were added after startup
|
void HWR_AddPlayerMD2(INT32 skin, boolean local) // For MD2's that were added after startup
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char name[20], filename[32];
|
char name[20], filename[32];
|
||||||
@@ -1508,7 +1508,7 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c
|
|||||||
else
|
else
|
||||||
frame = 0;
|
frame = 0;
|
||||||
|
|
||||||
gpatch = static_cast<patch_t *>(md2->glpatch);
|
gpatch = (patch_t *)(md2->glpatch);
|
||||||
if (gpatch)
|
if (gpatch)
|
||||||
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
||||||
|
|
||||||
@@ -1516,11 +1516,11 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c
|
|||||||
((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !md2->notexturefile))
|
((!hwrPatch->mipmap->format || !hwrPatch->mipmap->downloaded) && !md2->notexturefile))
|
||||||
md2_loadTexture(md2);
|
md2_loadTexture(md2);
|
||||||
|
|
||||||
gpatch = static_cast<patch_t *>(md2->glpatch);
|
gpatch = (patch_t*)(md2->glpatch);
|
||||||
if (gpatch)
|
if (gpatch)
|
||||||
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
hwrPatch = ((GLPatch_t *)gpatch->hardware);
|
||||||
|
|
||||||
blendgpatch = static_cast<patch_t *>(md2->blendglpatch);
|
blendgpatch = (patch_t*)(md2->blendglpatch);
|
||||||
if (blendgpatch)
|
if (blendgpatch)
|
||||||
hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware);
|
hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware);
|
||||||
|
|
||||||
@@ -1529,7 +1529,7 @@ void HWR_Draw2DModel(md2_t *md2, INT32 x, INT32 y, INT32 skinnum, skincolors_t c
|
|||||||
((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !md2->noblendfile)))
|
((!hwrBlendPatch->mipmap->format || !hwrBlendPatch->mipmap->downloaded) && !md2->noblendfile)))
|
||||||
md2_loadBlendTexture(md2);
|
md2_loadBlendTexture(md2);
|
||||||
|
|
||||||
blendgpatch = static_cast<patch_t *>(md2->blendglpatch);
|
blendgpatch = (patch_t*)(md2->blendglpatch);
|
||||||
if (blendgpatch)
|
if (blendgpatch)
|
||||||
hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware);
|
hwrBlendPatch = ((GLPatch_t *)blendgpatch->hardware);
|
||||||
|
|
||||||
|
|||||||
@@ -3591,22 +3591,30 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
|
|||||||
1.0f, -1.0f, 1.0f
|
1.0f, -1.0f, 1.0f
|
||||||
};
|
};
|
||||||
|
|
||||||
xfix = 1/((float)screen_texsizew/(float)screen_width);
|
|
||||||
yfix = 1/((float)screen_texsizeh/(float)screen_height);
|
|
||||||
|
|
||||||
const GLfloat scrwf = (float)screen_width;
|
const GLfloat scrwf = (float)screen_width;
|
||||||
const GLfloat scrwh = (float)screen_height;
|
const GLfloat scrwh = (float)screen_height;
|
||||||
|
|
||||||
|
xfix = 1/((float)screen_texsizew/scrwf);
|
||||||
|
yfix = 1/((float)screen_texsizeh/scrwh);
|
||||||
|
|
||||||
|
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||||
|
|
||||||
// Slight fuzziness
|
// Slight fuzziness
|
||||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
||||||
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
|
||||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
||||||
|
|
||||||
const float stride = 2.f/scrwh;
|
uint32_t r = rand();
|
||||||
|
|
||||||
for (i = 0; i < 1; i += stride)
|
const float ystep = 2.f/scrwh * (float)vid.udup/4.f;
|
||||||
|
|
||||||
|
for (i = 0; i < 1; i += ystep)
|
||||||
{
|
{
|
||||||
fix[2] = (float)(rand() % 128) / -22000.f * xfix;
|
// avoid calling rand thousands of times
|
||||||
|
r ^= r >> 13;
|
||||||
|
r ^= r >> 11;
|
||||||
|
r ^= r << 21;
|
||||||
|
|
||||||
|
fix[2] = (float)(r & 127) / -22000.f * xfix;
|
||||||
fix[0] = fix[2];
|
fix[0] = fix[2];
|
||||||
fix[6] = fix[0] + xfix;
|
fix[6] = fix[0] + xfix;
|
||||||
fix[4] = fix[2] + xfix;
|
fix[4] = fix[2] + xfix;
|
||||||
@@ -3624,8 +3632,8 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Upward bar
|
// Upward bar
|
||||||
//GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
||||||
//pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
||||||
|
|
||||||
color[0] = color[1] = color[2] = 190;
|
color[0] = color[1] = color[2] = 190;
|
||||||
color[3] = 250;
|
color[3] = 250;
|
||||||
@@ -3648,13 +3656,14 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
|
|||||||
|
|
||||||
fix[1] = fix[7] += (fix[3] - fix[7])*2;
|
fix[1] = fix[7] += (fix[3] - fix[7])*2;
|
||||||
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
|
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
|
||||||
|
|
||||||
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
||||||
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
||||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
|
||||||
// Downward bar
|
// Downward bar
|
||||||
//GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
||||||
//pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
||||||
|
|
||||||
fix[0] = 0.0f;
|
fix[0] = 0.0f;
|
||||||
fix[6] = xfix;
|
fix[6] = xfix;
|
||||||
@@ -3673,6 +3682,7 @@ void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8
|
|||||||
|
|
||||||
fix[1] = fix[7] += (fix[3] - fix[7])*2;
|
fix[1] = fix[7] += (fix[3] - fix[7])*2;
|
||||||
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
|
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
|
||||||
|
|
||||||
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
||||||
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
||||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
@@ -3712,7 +3722,7 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
|
|||||||
{
|
{
|
||||||
float xfix, yfix;
|
float xfix, yfix;
|
||||||
float origaspect, newaspect;
|
float origaspect, newaspect;
|
||||||
float xoff = 1, yoff = 1; // xoffset and yoffset for the polygon to have black bars around the screen
|
float xoff = 1.0f, yoff = 1.0f; // xoffset and yoffset for the polygon to have black bars around the screen
|
||||||
|
|
||||||
static float off[12] =
|
static float off[12] =
|
||||||
{
|
{
|
||||||
@@ -3735,19 +3745,19 @@ void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean usesh
|
|||||||
if (origaspect < newaspect)
|
if (origaspect < newaspect)
|
||||||
{
|
{
|
||||||
xoff = origaspect / newaspect;
|
xoff = origaspect / newaspect;
|
||||||
yoff = 1;
|
yoff = 1.0f;
|
||||||
}
|
}
|
||||||
else if (origaspect > newaspect)
|
else if (origaspect > newaspect)
|
||||||
{
|
{
|
||||||
xoff = 1;
|
xoff = 1.0f;
|
||||||
yoff = newaspect / origaspect;
|
yoff = newaspect / origaspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
// float off[12];
|
// float off[12];
|
||||||
off[0] = off[3] = -xoff;
|
off[0] = off[3] = -xoff;
|
||||||
off[1] = off[10] = -yoff;
|
off[1] = off[10] = -yoff;
|
||||||
off[4] = off[7] = yoff;
|
off[4] = off[7] = yoff;
|
||||||
off[6] = off[9] = xoff;
|
off[6] = off[9] = xoff;
|
||||||
|
|
||||||
// float fix[8];
|
// float fix[8];
|
||||||
fix[3] = fix[5] = yfix;
|
fix[3] = fix[5] = yfix;
|
||||||
|
|||||||
+9
-9
@@ -62,7 +62,7 @@ static int hms_started;
|
|||||||
|
|
||||||
static char *hms_api;
|
static char *hms_api;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
static I_mutex hms_api_mutex;
|
static I_Mutex hms_api_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *hms_server_token;
|
static char *hms_server_token;
|
||||||
@@ -90,9 +90,9 @@ Printf_url (const char *url)
|
|||||||
boolean startup;
|
boolean startup;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&con_mutex);
|
I_LockMutex(&con_mutex);
|
||||||
startup = con_startup;
|
startup = con_startup;
|
||||||
I_unlock_mutex(con_mutex);
|
I_UnlockMutex(con_mutex);
|
||||||
#else
|
#else
|
||||||
startup = con_startup;
|
startup = con_startup;
|
||||||
#endif
|
#endif
|
||||||
@@ -183,7 +183,7 @@ HMS_connect (const char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&hms_api_mutex);
|
I_LockMutex(&hms_api_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
seek = strlen(hms_api) + 1;/* + '/' */
|
seek = strlen(hms_api) + 1;/* + '/' */
|
||||||
@@ -195,7 +195,7 @@ HMS_connect (const char *format, ...)
|
|||||||
sprintf(url, "%s/", hms_api);
|
sprintf(url, "%s/", hms_api);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(hms_api_mutex);
|
I_UnlockMutex(hms_api_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
va_start (ap, format);
|
va_start (ap, format);
|
||||||
@@ -477,12 +477,12 @@ HMS_fetch_servers (msg_server_t *list, int query_id)
|
|||||||
if (address && port)
|
if (address && port)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&ms_QueryId_mutex);
|
I_LockMutex(&ms_QueryId_mutex);
|
||||||
{
|
{
|
||||||
if (query_id != ms_QueryId)
|
if (query_id != ms_QueryId)
|
||||||
doing_shit = 0;
|
doing_shit = 0;
|
||||||
}
|
}
|
||||||
I_unlock_mutex(ms_QueryId_mutex);
|
I_UnlockMutex(ms_QueryId_mutex);
|
||||||
|
|
||||||
if (! doing_shit)
|
if (! doing_shit)
|
||||||
break;
|
break;
|
||||||
@@ -611,14 +611,14 @@ void
|
|||||||
HMS_set_api (char *api)
|
HMS_set_api (char *api)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&hms_api_mutex);
|
I_LockMutex(&hms_api_mutex);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
free(hms_api);
|
free(hms_api);
|
||||||
hms_api = Strip_trailing_slashes(api);
|
hms_api = Strip_trailing_slashes(api);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(hms_api_mutex);
|
I_UnlockMutex(hms_api_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-12
@@ -1072,8 +1072,7 @@ static void Got_Saycmd(const UINT8 **p, INT32 playernum)
|
|||||||
|
|
||||||
HU_AddChatText(va(fmt2, prefix, cstart, dispname, textcolor, msg), cv_chatnotifications.value); // add to chat
|
HU_AddChatText(va(fmt2, prefix, cstart, dispname, textcolor, msg), cv_chatnotifications.value); // add to chat
|
||||||
|
|
||||||
if (tempchar)
|
Z_Free(tempchar);
|
||||||
Z_Free(tempchar);
|
|
||||||
}
|
}
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
// I just want to point out while I'm here that because the data is still
|
// I just want to point out while I'm here that because the data is still
|
||||||
@@ -1484,6 +1483,7 @@ static char *CHAT_WordWrap(INT32 x, INT32 w, INT32 option, const char *string)
|
|||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return newstring;
|
return newstring;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1522,7 +1522,7 @@ static void HU_drawMiniChat(void)
|
|||||||
emote_t *emote = NULL;
|
emote_t *emote = NULL;
|
||||||
int emotelen = 0;
|
int emotelen = 0;
|
||||||
|
|
||||||
while(msg[j]) // iterate through msg
|
while (msg[j]) // iterate through msg
|
||||||
{
|
{
|
||||||
if (msg[j] < HU_FONTSTART) // don't draw
|
if (msg[j] < HU_FONTSTART) // don't draw
|
||||||
{
|
{
|
||||||
@@ -1554,19 +1554,21 @@ static void HU_drawMiniChat(void)
|
|||||||
{
|
{
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
prev_linereturn = false;
|
prev_linereturn = false;
|
||||||
dx += charwidth;
|
dx += charwidth;
|
||||||
|
|
||||||
if (dx >= boxw)
|
if (dx >= boxw)
|
||||||
{
|
{
|
||||||
dx = 0;
|
dx = 0;
|
||||||
linescount += 1;
|
linescount += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dy = 0;
|
dy = 0;
|
||||||
dx = 0;
|
dx = 0;
|
||||||
msglines += linescount+1;
|
msglines += linescount+1;
|
||||||
if (msg)
|
Z_Free(msg);
|
||||||
Z_Free(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
y = chaty - charheight*(msglines+1);
|
y = chaty - charheight*(msglines+1);
|
||||||
@@ -1598,7 +1600,7 @@ static void HU_drawMiniChat(void)
|
|||||||
emote_t *emote = NULL;
|
emote_t *emote = NULL;
|
||||||
int emotelen = 0;
|
int emotelen = 0;
|
||||||
|
|
||||||
while(msg[j]) // iterate through msg
|
while (msg[j]) // iterate through msg
|
||||||
{
|
{
|
||||||
if (msg[j] < HU_FONTSTART) // don't draw
|
if (msg[j] < HU_FONTSTART) // don't draw
|
||||||
{
|
{
|
||||||
@@ -1643,16 +1645,17 @@ static void HU_drawMiniChat(void)
|
|||||||
|
|
||||||
dx += charwidth;
|
dx += charwidth;
|
||||||
prev_linereturn = false;
|
prev_linereturn = false;
|
||||||
|
|
||||||
if (dx >= boxw)
|
if (dx >= boxw)
|
||||||
{
|
{
|
||||||
dx = 0;
|
dx = 0;
|
||||||
dy += charheight;
|
dy += charheight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dy += charheight;
|
dy += charheight;
|
||||||
dx = 0;
|
dx = 0;
|
||||||
if (msg)
|
Z_Free(msg);
|
||||||
Z_Free(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// decrement addy and make that shit smooth:
|
// decrement addy and make that shit smooth:
|
||||||
@@ -1704,7 +1707,7 @@ static void HU_drawChatLog(INT32 offset)
|
|||||||
|
|
||||||
V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box
|
V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box
|
||||||
|
|
||||||
for (i=0; i<chat_nummsg_log; i++) // iterate through our chatlog
|
for (i = 0; i < chat_nummsg_log; i++) // iterate through our chatlog
|
||||||
{
|
{
|
||||||
INT32 clrflag = 0;
|
INT32 clrflag = 0;
|
||||||
INT32 j = 0;
|
INT32 j = 0;
|
||||||
@@ -1713,7 +1716,7 @@ static void HU_drawChatLog(INT32 offset)
|
|||||||
emote_t *emote = NULL;
|
emote_t *emote = NULL;
|
||||||
int emotelen = 0;
|
int emotelen = 0;
|
||||||
|
|
||||||
while(msg[j]) // iterate through msg
|
while (msg[j]) // iterate through msg
|
||||||
{
|
{
|
||||||
if (msg[j] < HU_FONTSTART) // don't draw
|
if (msg[j] < HU_FONTSTART) // don't draw
|
||||||
{
|
{
|
||||||
@@ -1758,10 +1761,10 @@ static void HU_drawChatLog(INT32 offset)
|
|||||||
dy += charheight;
|
dy += charheight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dy += charheight;
|
dy += charheight;
|
||||||
dx = 0;
|
dx = 0;
|
||||||
if (msg)
|
Z_Free(msg);
|
||||||
Z_Free(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling.
|
if (((chat_scroll >= chat_maxscroll) || (chat_scrollmedown)) && !(justscrolleddown || justscrolledup || chat_scrolltime)) // was already at the bottom of the page before new maxscroll calculation and was NOT scrolling.
|
||||||
|
|||||||
+4
-10
@@ -1510,11 +1510,8 @@ static boolean SOCK_SetBanUsername(const char *username)
|
|||||||
username = "Direct IP ban";
|
username = "Direct IP ban";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (banned[numbans - 1].username)
|
Z_Free(banned[numbans - 1].username);
|
||||||
{
|
banned[numbans - 1].username = NULL;
|
||||||
Z_Free(banned[numbans - 1].username);
|
|
||||||
banned[numbans - 1].username = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
banned[numbans - 1].username = Z_StrDup(username);
|
banned[numbans - 1].username = Z_StrDup(username);
|
||||||
|
|
||||||
@@ -1528,11 +1525,8 @@ static boolean SOCK_SetBanReason(const char *reason)
|
|||||||
reason = "No reason given";
|
reason = "No reason given";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (banned[numbans - 1].reason)
|
Z_Free(banned[numbans - 1].reason);
|
||||||
{
|
banned[numbans - 1].reason = NULL;
|
||||||
Z_Free(banned[numbans - 1].reason);
|
|
||||||
banned[numbans - 1].reason = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
banned[numbans - 1].reason = Z_StrDup(reason);
|
banned[numbans - 1].reason = Z_StrDup(reason);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// SONIC ROBO BLAST 2
|
// SONIC ROBO BLAST 2 KART
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2020-2023 by James R.
|
// Copyright (C) 2020-2023 by James R.
|
||||||
//
|
//
|
||||||
@@ -9,12 +9,14 @@
|
|||||||
/// \file i_threads.c
|
/// \file i_threads.c
|
||||||
/// \brief Multithreading abstraction
|
/// \brief Multithreading abstraction
|
||||||
|
|
||||||
#if defined (__unix__) || (!defined(__APPLE__) && defined (UNIXCOMMON))
|
#ifdef HAVE_THREADS
|
||||||
|
#if defined (__unix__) || defined(UNIXCOMMON)
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "../i_threads.h"
|
#include "i_threads.h"
|
||||||
#include "../doomdef.h"
|
#include "doomdef.h"
|
||||||
|
#include "doomtype.h"
|
||||||
|
|
||||||
typedef struct thread_s thread_t;
|
typedef struct thread_s thread_t;
|
||||||
|
|
||||||
@@ -22,7 +24,7 @@ struct thread_s
|
|||||||
{
|
{
|
||||||
thread_t *next;
|
thread_t *next;
|
||||||
void *userdata;
|
void *userdata;
|
||||||
I_thread_fn func;
|
I_ThreadFn func;
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -41,12 +43,8 @@ static void *HandleThread(void *data)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
FUNCWARNRV
|
||||||
I_spawn_thread (
|
int I_SpawnThread(const char *name, I_ThreadFn entry, void *userdata)
|
||||||
const char * name,
|
|
||||||
I_thread_fn entry,
|
|
||||||
void * userdata
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
thread_t *thread;
|
thread_t *thread;
|
||||||
(void)name;
|
(void)name;
|
||||||
@@ -66,17 +64,20 @@ I_spawn_thread (
|
|||||||
if (thread == NULL)
|
if (thread == NULL)
|
||||||
{
|
{
|
||||||
thread = malloc(sizeof(thread_t));
|
thread = malloc(sizeof(thread_t));
|
||||||
|
if (thread == NULL)
|
||||||
|
return false;
|
||||||
thread->next = thread_list;
|
thread->next = thread_list;
|
||||||
thread_list = thread;
|
thread_list = thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
thread->func = entry;
|
thread->func = entry;
|
||||||
thread->userdata = userdata;
|
thread->userdata = userdata;
|
||||||
pthread_create(&thread->thread, NULL, HandleThread, thread);
|
int err = pthread_create(&thread->thread, NULL, HandleThread, thread);
|
||||||
pthread_mutex_unlock(&thread_lock);
|
pthread_mutex_unlock(&thread_lock);
|
||||||
|
return err == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int I_thread_is_stopped(void)
|
int I_ThreadIsStopped(void)
|
||||||
{
|
{
|
||||||
thread_t *thread;
|
thread_t *thread;
|
||||||
pthread_mutex_lock(&thread_lock);
|
pthread_mutex_lock(&thread_lock);
|
||||||
@@ -94,11 +95,11 @@ int I_thread_is_stopped(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_start_threads(void)
|
void I_StartThreads(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_stop_threads(void)
|
void I_StopThreads(void)
|
||||||
{
|
{
|
||||||
thread_t *thread = thread_list;
|
thread_t *thread = thread_list;
|
||||||
while (thread != NULL)
|
while (thread != NULL)
|
||||||
@@ -109,7 +110,7 @@ void I_stop_threads(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_lock_mutex(I_mutex *anchor)
|
void I_LockMutex(I_Mutex *anchor)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&thread_lock);
|
pthread_mutex_lock(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -127,25 +128,25 @@ void I_lock_mutex(I_mutex *anchor)
|
|||||||
pthread_mutex_lock(*anchor);
|
pthread_mutex_lock(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_unlock_mutex(I_mutex id)
|
void I_UnlockMutex(I_Mutex id)
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(id);
|
pthread_mutex_unlock(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
void I_HoldCond(I_Cond *condAnchor, I_Mutex mutexId)
|
||||||
{
|
{
|
||||||
I_Assert(mutex_id != NULL);
|
I_Assert(mutexId != NULL);
|
||||||
pthread_mutex_lock(&thread_lock);
|
pthread_mutex_lock(&thread_lock);
|
||||||
if (*cond_anchor == NULL)
|
if (*condAnchor == NULL)
|
||||||
{
|
{
|
||||||
*cond_anchor = malloc(sizeof(pthread_cond_t));
|
*condAnchor = malloc(sizeof(pthread_cond_t));
|
||||||
pthread_cond_init(*cond_anchor, NULL);
|
pthread_cond_init(*condAnchor, NULL);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&thread_lock);
|
pthread_mutex_unlock(&thread_lock);
|
||||||
pthread_cond_wait(*cond_anchor, mutex_id);
|
pthread_cond_wait(*condAnchor, mutexId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_wake_one_cond(I_cond *anchor)
|
void I_WakeOneCond(I_Cond *anchor)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&thread_lock);
|
pthread_mutex_lock(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -157,7 +158,7 @@ void I_wake_one_cond(I_cond *anchor)
|
|||||||
pthread_cond_signal(*anchor);
|
pthread_cond_signal(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_wake_all_cond(I_cond *anchor)
|
void I_WakeAllCond(I_Cond *anchor)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&thread_lock);
|
pthread_mutex_lock(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -168,12 +169,17 @@ void I_wake_all_cond(I_cond *anchor)
|
|||||||
pthread_mutex_unlock(&thread_lock);
|
pthread_mutex_unlock(&thread_lock);
|
||||||
pthread_cond_broadcast(*anchor);
|
pthread_cond_broadcast(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thread_handle_t I_GetCurrentThread(void)
|
||||||
|
{
|
||||||
|
return pthread_self();
|
||||||
|
}
|
||||||
#elif defined (_WIN32)
|
#elif defined (_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#include "../i_threads.h"
|
#include "i_threads.h"
|
||||||
#include "../doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "../doomtype.h"
|
#include "doomtype.h"
|
||||||
|
|
||||||
typedef struct thread_s thread_t;
|
typedef struct thread_s thread_t;
|
||||||
|
|
||||||
@@ -181,9 +187,9 @@ struct thread_s
|
|||||||
{
|
{
|
||||||
thread_t *next;
|
thread_t *next;
|
||||||
void *userdata;
|
void *userdata;
|
||||||
I_thread_fn func;
|
I_ThreadFn func;
|
||||||
HANDLE thread;
|
HANDLE thread;
|
||||||
DWORD thread_id;
|
DWORD threadId;
|
||||||
};
|
};
|
||||||
|
|
||||||
// we use a linked list to avoid moving memory blocks when allocating new threads.
|
// we use a linked list to avoid moving memory blocks when allocating new threads.
|
||||||
@@ -201,7 +207,8 @@ static DWORD __stdcall HandleThread(void *data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
|
FUNCWARNRV
|
||||||
|
int I_SpawnThread(const char *name, I_ThreadFn entry, void *userdata)
|
||||||
{
|
{
|
||||||
thread_t *thread;
|
thread_t *thread;
|
||||||
(void)name;
|
(void)name;
|
||||||
@@ -219,17 +226,20 @@ void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
|
|||||||
if (thread == NULL)
|
if (thread == NULL)
|
||||||
{
|
{
|
||||||
thread = malloc(sizeof(thread_t));
|
thread = malloc(sizeof(thread_t));
|
||||||
|
if (thread == NULL)
|
||||||
|
return false;
|
||||||
thread->next = thread_list;
|
thread->next = thread_list;
|
||||||
thread_list = thread;
|
thread_list = thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
thread->func = entry;
|
thread->func = entry;
|
||||||
thread->userdata = userdata;
|
thread->userdata = userdata;
|
||||||
thread->thread = CreateThread(NULL, 0, HandleThread, thread, 0, &thread->thread_id);
|
thread->thread = CreateThread(NULL, 0, HandleThread, thread, 0, &thread->threadId);
|
||||||
LeaveCriticalSection(&thread_lock);
|
LeaveCriticalSection(&thread_lock);
|
||||||
|
return thread->thread != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int I_thread_is_stopped(void)
|
int I_ThreadIsStopped(void)
|
||||||
{
|
{
|
||||||
thread_t *thread;
|
thread_t *thread;
|
||||||
EnterCriticalSection(&thread_lock);
|
EnterCriticalSection(&thread_lock);
|
||||||
@@ -247,12 +257,12 @@ int I_thread_is_stopped(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_start_threads(void)
|
void I_StartThreads(void)
|
||||||
{
|
{
|
||||||
InitializeCriticalSection(&thread_lock);
|
InitializeCriticalSection(&thread_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_stop_threads(void)
|
void I_StopThreads(void)
|
||||||
{
|
{
|
||||||
thread_t *thread = thread_list;
|
thread_t *thread = thread_list;
|
||||||
while (thread != NULL)
|
while (thread != NULL)
|
||||||
@@ -264,7 +274,7 @@ void I_stop_threads(void)
|
|||||||
DeleteCriticalSection(&thread_lock);
|
DeleteCriticalSection(&thread_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_lock_mutex(I_mutex *anchor)
|
void I_LockMutex(I_Mutex *anchor)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&thread_lock);
|
EnterCriticalSection(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -276,25 +286,25 @@ void I_lock_mutex(I_mutex *anchor)
|
|||||||
EnterCriticalSection(*anchor);
|
EnterCriticalSection(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_unlock_mutex(I_mutex id)
|
void I_UnlockMutex(I_Mutex id)
|
||||||
{
|
{
|
||||||
LeaveCriticalSection(id);
|
LeaveCriticalSection(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
void I_HoldCond(I_Cond *condAnchor, I_Mutex mutexId)
|
||||||
{
|
{
|
||||||
I_Assert(mutex_id != NULL);
|
I_Assert(mutexId != NULL);
|
||||||
EnterCriticalSection(&thread_lock);
|
EnterCriticalSection(&thread_lock);
|
||||||
if (*cond_anchor == NULL)
|
if (*condAnchor == NULL)
|
||||||
{
|
{
|
||||||
*cond_anchor = malloc(sizeof(CONDITION_VARIABLE));
|
*condAnchor = malloc(sizeof(CONDITION_VARIABLE));
|
||||||
InitializeConditionVariable(*cond_anchor);
|
InitializeConditionVariable(*condAnchor);
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(&thread_lock);
|
LeaveCriticalSection(&thread_lock);
|
||||||
SleepConditionVariableCS(*cond_anchor, mutex_id, INFINITE);
|
SleepConditionVariableCS(*condAnchor, mutexId, INFINITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_wake_one_cond(I_cond *anchor)
|
void I_WakeOneCond(I_Cond *anchor)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&thread_lock);
|
EnterCriticalSection(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -306,7 +316,7 @@ void I_wake_one_cond(I_cond *anchor)
|
|||||||
WakeConditionVariable(*anchor);
|
WakeConditionVariable(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_wake_all_cond(I_cond *anchor)
|
void I_WakeAllCond(I_Cond *anchor)
|
||||||
{
|
{
|
||||||
EnterCriticalSection(&thread_lock);
|
EnterCriticalSection(&thread_lock);
|
||||||
if (*anchor == NULL)
|
if (*anchor == NULL)
|
||||||
@@ -317,48 +327,66 @@ void I_wake_all_cond(I_cond *anchor)
|
|||||||
LeaveCriticalSection(&thread_lock);
|
LeaveCriticalSection(&thread_lock);
|
||||||
WakeAllConditionVariable(*anchor);
|
WakeAllConditionVariable(*anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *I_GetCurrentThread(void)
|
||||||
|
{
|
||||||
|
return GetCurrentThread();
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
void I_spawn_thread(const char *name, I_thread_fn entry, void *userdata)
|
#include "i_threads.h"
|
||||||
|
|
||||||
|
FUNCWARNRV
|
||||||
|
int I_SpawnThread(const char *name, I_ThreadFn entry, void *userdata)
|
||||||
{
|
{
|
||||||
(void)name;
|
(void)name;
|
||||||
entry(userdata);
|
entry(userdata);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int I_thread_is_stopped(void)
|
int I_ThreadIsStopped(void)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void I_StartThreads(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_start_threads(void)
|
void I_StopThreads(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_stop_threads(void)
|
void I_LockMutex(I_Mutex *anchor)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void I_lock_mutex(I_mutex *anchor)
|
|
||||||
{
|
{
|
||||||
(void)anchor;
|
(void)anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_unlock_mutex(I_mutex id)
|
void I_UnlockMutex(I_Mutex id)
|
||||||
{
|
{
|
||||||
(void)id;
|
(void)id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_hold_cond(I_cond *cond_anchor, I_mutex mutex_id)
|
void I_HoldCond(I_Cond *condAnchor, I_Mutex mutexId)
|
||||||
{
|
{
|
||||||
(void)cond_anchor;
|
(void)condAnchor;
|
||||||
(void)mutex_id;
|
(void)mutexId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_wake_one_cond(I_cond *anchor)
|
void I_WakeOneCond(I_Cond *anchor)
|
||||||
{
|
{
|
||||||
(void)anchor;
|
(void)anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_wake_all_cond(I_cond *anchor)
|
void I_WakeAllCond(I_Cond *anchor)
|
||||||
{
|
{
|
||||||
(void)anchor;
|
(void)anchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *I_GetCurrentThread(void)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif // HAVE_THREADS
|
||||||
+25
-13
@@ -1,6 +1,6 @@
|
|||||||
// SONIC ROBO BLAST 2 KART
|
// SONIC ROBO BLAST 2 KART
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Copyright (C) 2020 by James R.
|
// Copyright (C) 2020-2023 by James R.
|
||||||
//
|
//
|
||||||
// This program is free software distributed under the
|
// This program is free software distributed under the
|
||||||
// terms of the GNU General Public License, version 2.
|
// terms of the GNU General Public License, version 2.
|
||||||
@@ -14,34 +14,46 @@
|
|||||||
#ifndef I_THREADS_H
|
#ifndef I_THREADS_H
|
||||||
#define I_THREADS_H
|
#define I_THREADS_H
|
||||||
|
|
||||||
|
#include "doomtype.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef void (*I_thread_fn)(void *userdata);
|
typedef void (*I_ThreadFn)(void *userdata);
|
||||||
|
|
||||||
typedef void * I_mutex;
|
typedef void * I_Mutex;
|
||||||
typedef void * I_cond;
|
typedef void * I_Cond;
|
||||||
|
|
||||||
void I_start_threads (void);
|
#ifdef __linux__
|
||||||
void I_stop_threads (void);
|
typedef long unsigned int thread_handle_t;
|
||||||
|
#else
|
||||||
|
typedef void *thread_handle_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
void I_spawn_thread (const char *name, I_thread_fn, void *userdata);
|
void I_StartThreads (void);
|
||||||
|
void I_StopThreads (void);
|
||||||
|
|
||||||
|
FUNCWARNRV
|
||||||
|
int I_SpawnThread (const char *name, I_ThreadFn, void *userdata);
|
||||||
|
|
||||||
/* check in your thread whether to return early */
|
/* check in your thread whether to return early */
|
||||||
int I_thread_is_stopped (void);
|
int I_ThreadIsStopped (void);
|
||||||
|
|
||||||
void I_lock_mutex (I_mutex *);
|
void I_LockMutex (I_Mutex *);
|
||||||
void I_unlock_mutex (I_mutex);
|
void I_UnlockMutex (I_Mutex);
|
||||||
|
|
||||||
void I_hold_cond (I_cond *, I_mutex);
|
void I_HoldCond (I_Cond *, I_Mutex);
|
||||||
|
|
||||||
void I_wake_one_cond (I_cond *);
|
void I_WakeOneCond (I_Cond *);
|
||||||
void I_wake_all_cond (I_cond *);
|
void I_WakeAllCond (I_Cond *);
|
||||||
|
|
||||||
|
thread_handle_t I_GetCurrentThread(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif/*I_THREADS_H*/
|
#endif/*I_THREADS_H*/
|
||||||
|
|
||||||
#endif/*HAVE_THREADS*/
|
#endif/*HAVE_THREADS*/
|
||||||
+1
-2
@@ -99,8 +99,7 @@ void K_EraseStats(void)
|
|||||||
// The only field we want to remember
|
// The only field we want to remember
|
||||||
boolean vanilla = kartstats.vanilla;
|
boolean vanilla = kartstats.vanilla;
|
||||||
|
|
||||||
if (kartstats.copy)
|
Z_Free(kartstats.copy);
|
||||||
Z_Free(kartstats.copy);
|
|
||||||
|
|
||||||
memset(&kartstats, 0, sizeof(kartstats_t));
|
memset(&kartstats, 0, sizeof(kartstats_t));
|
||||||
|
|
||||||
|
|||||||
@@ -1293,6 +1293,7 @@ static int lib_pPlayRinglossSound(lua_State *L)
|
|||||||
player_t *player = NULL;
|
player_t *player = NULL;
|
||||||
mobj_t *damager = NULL;
|
mobj_t *damager = NULL;
|
||||||
NOHUD
|
NOHUD
|
||||||
|
LUA_UsageWarning(L, "P_PlayRinglossSound: using this function from lua might cause desynchs, consider using S_StartSound(origin, sfx_khurt1 + P_RandomKey(2)) as workaround");
|
||||||
if (!source)
|
if (!source)
|
||||||
return LUA_ErrInvalid(L, "mobj_t");
|
return LUA_ErrInvalid(L, "mobj_t");
|
||||||
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
if (!lua_isnone(L, 2) && lua_isuserdata(L, 2))
|
||||||
|
|||||||
@@ -136,18 +136,9 @@ void LUA_HUD_DestroyDrawList(huddrawlist_h list)
|
|||||||
{
|
{
|
||||||
if (list == NULL) return;
|
if (list == NULL) return;
|
||||||
|
|
||||||
if (list->items)
|
Z_Free(list->items);
|
||||||
{
|
Z_Free(list->olditems);
|
||||||
Z_Free(list->items);
|
Z_Free(list->strbuf);
|
||||||
}
|
|
||||||
if (list->olditems)
|
|
||||||
{
|
|
||||||
Z_Free(list->olditems);
|
|
||||||
}
|
|
||||||
if (list->strbuf)
|
|
||||||
{
|
|
||||||
Z_Free(list->strbuf);
|
|
||||||
}
|
|
||||||
Z_Free(list);
|
Z_Free(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
#include "lua_hook.h" // cmd errors
|
#include "lua_hook.h" // cmd errors
|
||||||
|
|
||||||
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor);
|
boolean LUA_CallAction(enum actionnum actionnum, mobj_t *actor);
|
||||||
state_t *astate;
|
state_t *astate = NULL;
|
||||||
|
|
||||||
boolean actionsoverridden[NUMACTIONS] = {false};
|
boolean actionsoverridden[NUMACTIONS] = {false};
|
||||||
|
|
||||||
|
|||||||
+18
-21
@@ -45,20 +45,20 @@ int hook_defrosting = 0;
|
|||||||
|
|
||||||
// List of internal libraries to load from SRB2
|
// List of internal libraries to load from SRB2
|
||||||
static lua_CFunction liblist[] = {
|
static lua_CFunction liblist[] = {
|
||||||
LUA_EnumLib, // global metatable for enums
|
LUA_EnumLib, // global metatable for enums
|
||||||
LUA_SOCLib, // A_Action functions, freeslot
|
LUA_SOCLib, // A_Action functions, freeslot
|
||||||
LUA_BaseLib, // string concatination by +, CONS_Printf, p_local.h stuff (P_InstaThrust, P_Move), etc.
|
LUA_BaseLib, // string concatination by +, CONS_Printf, p_local.h stuff (P_InstaThrust, P_Move), etc.
|
||||||
LUA_MathLib, // fixed_t and angle_t math functions
|
LUA_MathLib, // fixed_t and angle_t math functions
|
||||||
LUA_HookLib, // hookAdd and hook-calling functions
|
LUA_HookLib, // hookAdd and hook-calling functions
|
||||||
LUA_ConsoleLib, // console command/variable functions and structs
|
LUA_ConsoleLib, // console command/variable functions and structs
|
||||||
LUA_InfoLib, // info.h stuff: mobjinfo_t, mobjinfo[], state_t, states[]
|
LUA_InfoLib, // info.h stuff: mobjinfo_t, mobjinfo[], state_t, states[]
|
||||||
LUA_MobjLib, // mobj_t, mapthing_t
|
LUA_MobjLib, // mobj_t, mapthing_t
|
||||||
LUA_PlayerLib, // player_t
|
LUA_PlayerLib, // player_t
|
||||||
LUA_SkinLib, // skin_t, skins[]
|
LUA_SkinLib, // skin_t, skins[]
|
||||||
LUA_ThinkerLib, // thinker_t
|
LUA_ThinkerLib, // thinker_t
|
||||||
LUA_MapLib, // line_t, side_t, sector_t, subsector_t
|
LUA_MapLib, // line_t, side_t, sector_t, subsector_t
|
||||||
LUA_BlockmapLib, // blockmap stuff
|
LUA_BlockmapLib, // blockmap stuff
|
||||||
LUA_HudLib, // HUD stuff
|
LUA_HudLib, // HUD stuff
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -66,12 +66,8 @@ static lua_CFunction liblist[] = {
|
|||||||
static void *LUA_Alloc(void *ud, void *ptr, size_t osize, size_t nsize)
|
static void *LUA_Alloc(void *ud, void *ptr, size_t osize, size_t nsize)
|
||||||
{
|
{
|
||||||
(void)ud;
|
(void)ud;
|
||||||
if (nsize == 0) {
|
(void)osize;
|
||||||
if (osize != 0)
|
return Z_Realloc(ptr, nsize, PU_LUA, NULL);
|
||||||
Z_Free(ptr);
|
|
||||||
return NULL;
|
|
||||||
} else
|
|
||||||
return Z_Realloc(ptr, nsize, PU_LUA, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Panic function Lua calls when there's an unprotected error.
|
// Panic function Lua calls when there's an unprotected error.
|
||||||
@@ -213,7 +209,8 @@ void LUA_ClearState(void)
|
|||||||
lua_setfield(L, LUA_REGISTRYINDEX, LREG_VALID);
|
lua_setfield(L, LUA_REGISTRYINDEX, LREG_VALID);
|
||||||
|
|
||||||
// open srb2 libraries
|
// open srb2 libraries
|
||||||
for(i = 0; liblist[i]; i++) {
|
for (i = 0; liblist[i]; i++)
|
||||||
|
{
|
||||||
lua_pushcfunction(L, liblist[i]);
|
lua_pushcfunction(L, liblist[i]);
|
||||||
lua_call(L, 0, 0);
|
lua_call(L, 0, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-6
@@ -695,16 +695,13 @@ INT32 GIF_close(void)
|
|||||||
fclose(gif_out);
|
fclose(gif_out);
|
||||||
gif_out = NULL;
|
gif_out = NULL;
|
||||||
|
|
||||||
if (gifbwr_buf)
|
Z_Free(gifbwr_buf);
|
||||||
Z_Free(gifbwr_buf);
|
|
||||||
gifbwr_buf = gifbwr_cur = NULL;
|
gifbwr_buf = gifbwr_cur = NULL;
|
||||||
|
|
||||||
if (gifframe_data)
|
Z_Free(gifframe_data);
|
||||||
Z_Free(gifframe_data);
|
|
||||||
gifframe_data = NULL;
|
gifframe_data = NULL;
|
||||||
|
|
||||||
if (giflzw_hashTable)
|
Z_Free(giflzw_hashTable);
|
||||||
Z_Free(giflzw_hashTable);
|
|
||||||
giflzw_hashTable = NULL;
|
giflzw_hashTable = NULL;
|
||||||
|
|
||||||
Z_Free(scrbuf_screens);
|
Z_Free(scrbuf_screens);
|
||||||
|
|||||||
+1
-1
@@ -301,7 +301,7 @@ void Command_CheatNoTarget_f(void)
|
|||||||
void Command_Scale_f(void)
|
void Command_Scale_f(void)
|
||||||
{
|
{
|
||||||
const double scaled = atof(COM_Argv(1));
|
const double scaled = atof(COM_Argv(1));
|
||||||
fixed_t scale = FLOAT_TO_FIXED(scaled);
|
fixed_t scale = DoubleToFixed(scaled);
|
||||||
|
|
||||||
REQUIRE_DEVMODE;
|
REQUIRE_DEVMODE;
|
||||||
REQUIRE_INLEVEL;
|
REQUIRE_INLEVEL;
|
||||||
|
|||||||
+3
-6
@@ -248,12 +248,9 @@ void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1
|
|||||||
|
|
||||||
void M_ClearConditionSet(UINT8 set)
|
void M_ClearConditionSet(UINT8 set)
|
||||||
{
|
{
|
||||||
if (conditionSets[set - 1].numconditions)
|
Z_Free(conditionSets[set - 1].condition);
|
||||||
{
|
conditionSets[set - 1].condition = NULL;
|
||||||
Z_Free(conditionSets[set - 1].condition);
|
conditionSets[set - 1].numconditions = 0;
|
||||||
conditionSets[set - 1].condition = NULL;
|
|
||||||
conditionSets[set - 1].numconditions = 0;
|
|
||||||
}
|
|
||||||
conditionSets[set - 1].achieved = false;
|
conditionSets[set - 1].achieved = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -12,14 +12,14 @@
|
|||||||
#ifndef __M_EMOTES__
|
#ifndef __M_EMOTES__
|
||||||
#define __M_EMOTES__
|
#define __M_EMOTES__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "doomdef.h"
|
#include "doomdef.h"
|
||||||
#include "m_fixed.h"
|
#include "m_fixed.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
extern consvar_t cv_emotes;
|
extern consvar_t cv_emotes;
|
||||||
|
|
||||||
#define MAXEMOTENAME 32
|
#define MAXEMOTENAME 32
|
||||||
|
|||||||
@@ -265,35 +265,6 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x)
|
|||||||
return INT32_MAX;
|
return INT32_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief The xs_CRoundToInt function
|
|
||||||
|
|
||||||
\param val double number
|
|
||||||
|
|
||||||
\return Round toward nearest, but ties round toward even
|
|
||||||
*/
|
|
||||||
#if defined(SRB2_BIG_ENDIAN)
|
|
||||||
#define _xs_iexp_ 0
|
|
||||||
#define _xs_iman_ 1
|
|
||||||
#else
|
|
||||||
#define _xs_iexp_ 1 //intel is little endian
|
|
||||||
#define _xs_iman_ 0
|
|
||||||
#endif //BigEndian_
|
|
||||||
|
|
||||||
typedef double real64;
|
|
||||||
|
|
||||||
typedef union _xs_doubleints
|
|
||||||
{
|
|
||||||
real64 val;
|
|
||||||
unsigned ival[2];
|
|
||||||
} _xs_doubleints;
|
|
||||||
|
|
||||||
FUNCMATH FUNCINLINE static ATTRINLINE int xs_CRoundToInt(real64 val)
|
|
||||||
{
|
|
||||||
_xs_doubleints uval;
|
|
||||||
uval.val = val + 6755399441055744.0;
|
|
||||||
return uval.ival[_xs_iman_];
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
fixed_t x;
|
fixed_t x;
|
||||||
|
|||||||
+100
-90
@@ -142,7 +142,7 @@ typedef enum
|
|||||||
} text_enum;
|
} text_enum;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_mutex m_menu_mutex;
|
I_Mutex m_menu_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
M_waiting_mode_t m_waiting_mode = M_NOT_WAITING;
|
M_waiting_mode_t m_waiting_mode = M_NOT_WAITING;
|
||||||
@@ -1967,7 +1967,7 @@ void M_Ticker(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||||
I_lock_mutex(&ms_ServerList_mutex);
|
I_LockMutex(&ms_ServerList_mutex);
|
||||||
{
|
{
|
||||||
if (ms_ServerList)
|
if (ms_ServerList)
|
||||||
{
|
{
|
||||||
@@ -1976,7 +1976,7 @@ void M_Ticker(void)
|
|||||||
ms_ServerList = NULL;
|
ms_ServerList = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
I_unlock_mutex(ms_ServerList_mutex);
|
I_UnlockMutex(ms_ServerList_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4014,14 +4014,14 @@ size_t demolist_all_size = 0;
|
|||||||
boolean replaynamesloaded = false;
|
boolean replaynamesloaded = false;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_mutex replayquerymutex;
|
I_Mutex replayquerymutex;
|
||||||
|
|
||||||
// g_in_exiting_signal_handler is an evil hack
|
// g_in_exiting_signal_handler is an evil hack
|
||||||
// to avoid infinite SIGABRT recursion in the signal handler
|
// to avoid infinite SIGABRT recursion in the signal handler
|
||||||
// due to poisoned locks or mach-o kernel not supporting locks in signals
|
// due to poisoned locks or mach-o kernel not supporting locks in signals
|
||||||
// or something like that. idk
|
// or something like that. idk
|
||||||
# define Lock_search_state() if (!g_in_exiting_signal_handler) { I_lock_mutex(&replayquerymutex); }
|
# define Lock_search_state() if (!g_in_exiting_signal_handler) { I_LockMutex(&replayquerymutex); }
|
||||||
# define Unlock_search_state() if (!g_in_exiting_signal_handler) { I_unlock_mutex(replayquerymutex); }
|
# define Unlock_search_state() if (!g_in_exiting_signal_handler) { I_UnlockMutex(replayquerymutex); }
|
||||||
#else/*HAVE_THREADS*/
|
#else/*HAVE_THREADS*/
|
||||||
# define Lock_search_state()
|
# define Lock_search_state()
|
||||||
# define Unlock_search_state()
|
# define Unlock_search_state()
|
||||||
@@ -4088,7 +4088,10 @@ static void LoadReplayNames(void)
|
|||||||
Unlock_search_state();
|
Unlock_search_state();
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_spawn_thread("replay-names-load", ReplayNamesLoadThread, replaydirpath);
|
if (!I_SpawnThread("replay-names-load", ReplayNamesLoadThread, replaydirpath))
|
||||||
|
{
|
||||||
|
free(replaydirpath);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
ReplayNamesLoadThread(replaydirpath);
|
ReplayNamesLoadThread(replaydirpath);
|
||||||
#endif
|
#endif
|
||||||
@@ -4719,7 +4722,7 @@ static void M_DrawReplayHut(void)
|
|||||||
if (y > scaledviewheight-80)
|
if (y > scaledviewheight-80)
|
||||||
{
|
{
|
||||||
V_DrawFill(BASEVIDWIDTH-4, 75, 4, scaledviewheight-80, V_SNAPTOTOP|V_SNAPTORIGHT|239);
|
V_DrawFill(BASEVIDWIDTH-4, 75, 4, scaledviewheight-80, V_SNAPTOTOP|V_SNAPTORIGHT|239);
|
||||||
V_DrawFill(BASEVIDWIDTH-3, 76 + (scaledviewheight-80) * replayhutmenuy / y, 2, (((scaledviewheight-80) * (scaledviewheight-80))-1) / y - 1, V_SNAPTOTOP|V_SNAPTORIGHT|229);
|
V_DrawFill(BASEVIDWIDTH-3, 76 + (scaledviewheight-80) * replayhutmenuy / y, 2, max((((scaledviewheight-80) * (scaledviewheight-80))-1) / y - 1, 1), V_SNAPTOTOP|V_SNAPTORIGHT|229);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the cursor
|
// Draw the cursor
|
||||||
@@ -5356,7 +5359,7 @@ void M_PopupMasterServerRules(void)
|
|||||||
{
|
{
|
||||||
firstDismissedRulesThisBoot = false;
|
firstDismissedRulesThisBoot = false;
|
||||||
M_StartMessage(va("%s\n(press any key)", rules), NULL, MM_NOTHING);
|
M_StartMessage(va("%s\n(press any key)", rules), NULL, MM_NOTHING);
|
||||||
Z_Free(rules);
|
free(rules);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -6560,17 +6563,22 @@ static void M_EraseGuest(INT32 choice)
|
|||||||
|
|
||||||
static void M_OverwriteGuest(const char *which)
|
static void M_OverwriteGuest(const char *which)
|
||||||
{
|
{
|
||||||
char *rguest = Z_StrDup(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)));
|
char *rguest;
|
||||||
UINT8 *buf;
|
UINT8 *buf;
|
||||||
size_t len;
|
size_t len;
|
||||||
len = FIL_ReadFile(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), cv_chooseskin.string, which), &buf);
|
len = FIL_ReadFile(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), cv_chooseskin.string, which), &buf);
|
||||||
if (!len) {
|
|
||||||
|
if (!len)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (FIL_FileExists(rguest)) {
|
rguest = Z_StrDup(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)));
|
||||||
|
|
||||||
|
if (FIL_FileExists(rguest))
|
||||||
|
{
|
||||||
M_StopMessage(0);
|
M_StopMessage(0);
|
||||||
remove(rguest);
|
remove(rguest);
|
||||||
}
|
}
|
||||||
|
|
||||||
FIL_WriteFile(rguest, buf, len);
|
FIL_WriteFile(rguest, buf, len);
|
||||||
Z_Free(rguest);
|
Z_Free(rguest);
|
||||||
|
|
||||||
@@ -6679,11 +6687,11 @@ static void M_EndGame(INT32 choice)
|
|||||||
void M_SetWaitingMode(int mode)
|
void M_SetWaitingMode(int mode)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&m_menu_mutex);
|
I_LockMutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
m_waiting_mode = mode;
|
m_waiting_mode = mode;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(m_menu_mutex);
|
I_UnlockMutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6692,11 +6700,11 @@ int M_GetWaitingMode(void)
|
|||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&m_menu_mutex);
|
I_LockMutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
mode = m_waiting_mode;
|
mode = m_waiting_mode;
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(m_menu_mutex);
|
I_UnlockMutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return mode;
|
return mode;
|
||||||
@@ -6708,20 +6716,23 @@ static void Spawn_masterserver_thread(const char *name, void (*thread)(int*))
|
|||||||
{
|
{
|
||||||
int *id = malloc(sizeof *id);
|
int *id = malloc(sizeof *id);
|
||||||
|
|
||||||
I_lock_mutex(&ms_QueryId_mutex);
|
I_LockMutex(&ms_QueryId_mutex);
|
||||||
*id = ms_QueryId;
|
*id = ms_QueryId;
|
||||||
I_unlock_mutex(ms_QueryId_mutex);
|
I_UnlockMutex(ms_QueryId_mutex);
|
||||||
|
|
||||||
I_spawn_thread(name, (I_thread_fn)thread, id);
|
if (!I_SpawnThread(name, (I_ThreadFn)thread, id))
|
||||||
|
{
|
||||||
|
free(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Same_instance(int id)
|
static int Same_instance(int id)
|
||||||
{
|
{
|
||||||
int okay;
|
int okay;
|
||||||
|
|
||||||
I_lock_mutex(&ms_QueryId_mutex);
|
I_LockMutex(&ms_QueryId_mutex);
|
||||||
okay = ( id == ms_QueryId );
|
okay = ( id == ms_QueryId );
|
||||||
I_unlock_mutex(ms_QueryId_mutex);
|
I_UnlockMutex(ms_QueryId_mutex);
|
||||||
|
|
||||||
return okay;
|
return okay;
|
||||||
}
|
}
|
||||||
@@ -6750,9 +6761,9 @@ static void Fetch_servers_thread(int *id)
|
|||||||
M_SetWaitingMode(M_NOT_WAITING);
|
M_SetWaitingMode(M_NOT_WAITING);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&ms_ServerList_mutex);
|
I_LockMutex(&ms_ServerList_mutex);
|
||||||
ms_ServerList = server_list;
|
ms_ServerList = server_list;
|
||||||
I_unlock_mutex(ms_ServerList_mutex);
|
I_UnlockMutex(ms_ServerList_mutex);
|
||||||
#else
|
#else
|
||||||
CL_QueryServerList(server_list);
|
CL_QueryServerList(server_list);
|
||||||
free(server_list);
|
free(server_list);
|
||||||
@@ -6785,7 +6796,7 @@ static void M_SearchServerList(void)
|
|||||||
serverlistsearchedcount = 0;
|
serverlistsearchedcount = 0;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&ms_ServerList_mutex);
|
I_LockMutex(&ms_ServerList_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (UINT32 i = 0; i < serverlistcount; ++i)
|
for (UINT32 i = 0; i < serverlistcount; ++i)
|
||||||
@@ -6796,7 +6807,7 @@ static void M_SearchServerList(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(ms_ServerList_mutex);
|
I_UnlockMutex(ms_ServerList_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (menuinput.length > 0)
|
if (menuinput.length > 0)
|
||||||
@@ -7162,11 +7173,11 @@ static void M_CheckMODVersion(int id)
|
|||||||
{
|
{
|
||||||
sprintf(updatestring, UPDATE_ALERT_STRING, VERSIONSTRING, updatecheck);
|
sprintf(updatestring, UPDATE_ALERT_STRING, VERSIONSTRING, updatecheck);
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&m_menu_mutex);
|
I_LockMutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
M_StartMessage(updatestring, NULL, MM_NOTHING);
|
M_StartMessage(updatestring, NULL, MM_NOTHING);
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(m_menu_mutex);
|
I_UnlockMutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7212,13 +7223,13 @@ static void M_ConnectMenu(INT32 choice)
|
|||||||
itemOn = 0;
|
itemOn = 0;
|
||||||
|
|
||||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||||
I_lock_mutex(&ms_QueryId_mutex);
|
I_LockMutex(&ms_QueryId_mutex);
|
||||||
{
|
{
|
||||||
ms_QueryId++;
|
ms_QueryId++;
|
||||||
}
|
}
|
||||||
I_unlock_mutex(ms_QueryId_mutex);
|
I_UnlockMutex(ms_QueryId_mutex);
|
||||||
|
|
||||||
I_lock_mutex(&ms_ServerList_mutex);
|
I_LockMutex(&ms_ServerList_mutex);
|
||||||
{
|
{
|
||||||
if (ms_ServerList)
|
if (ms_ServerList)
|
||||||
{
|
{
|
||||||
@@ -7226,7 +7237,7 @@ static void M_ConnectMenu(INT32 choice)
|
|||||||
ms_ServerList = NULL;
|
ms_ServerList = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
I_unlock_mutex(ms_ServerList_mutex);
|
I_UnlockMutex(ms_ServerList_mutex);
|
||||||
|
|
||||||
#ifdef UPDATE_ALERT
|
#ifdef UPDATE_ALERT
|
||||||
Spawn_masterserver_thread("check-new-version", Check_new_version_thread);
|
Spawn_masterserver_thread("check-new-version", Check_new_version_thread);
|
||||||
@@ -7587,7 +7598,6 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
|
|||||||
|
|
||||||
static void M_DrawServerMenu(void)
|
static void M_DrawServerMenu(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
M_DrawLevelSelectOnly(false, false);
|
M_DrawLevelSelectOnly(false, false);
|
||||||
#ifdef MASTERSERVER
|
#ifdef MASTERSERVER
|
||||||
if (currentMenu == &MP_ServerDef && cv_advertise.value) // Remind players where they're hosting.
|
if (currentMenu == &MP_ServerDef && cv_advertise.value) // Remind players where they're hosting.
|
||||||
@@ -7902,7 +7912,7 @@ static void M_HandleConnectIP(INT32 choice)
|
|||||||
if (exitmenu)
|
if (exitmenu)
|
||||||
{
|
{
|
||||||
if (currentMenu->prevMenu)
|
if (currentMenu->prevMenu)
|
||||||
M_SetupNextMenu (currentMenu->prevMenu);
|
M_SetupNextMenu(currentMenu->prevMenu);
|
||||||
else
|
else
|
||||||
M_ClearMenus(true);
|
M_ClearMenus(true);
|
||||||
}
|
}
|
||||||
@@ -8271,10 +8281,9 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||||||
INT32 curx = (((setupm_skinselect % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH/2)) + SKINXSHIFT) + 20;
|
INT32 curx = (((setupm_skinselect % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH/2)) + SKINXSHIFT) + 20;
|
||||||
INT32 cury = (((setupm_skinselect / SKINGRIDNEWWIDTH) - setupm_skinypos) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2))+ gridyoffset);
|
INT32 cury = (((setupm_skinselect / SKINGRIDNEWWIDTH) - setupm_skinypos) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2))+ gridyoffset);
|
||||||
|
|
||||||
UINT8 cursorframe = (I_GetTime() / 4) % 7;
|
UINT8 cursorframe = (I_GetTime() / 4) % 7;
|
||||||
|
cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
|
||||||
cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
|
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
|
||||||
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -8313,14 +8322,12 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||||||
if (setupm_skinselect < numskins)
|
if (setupm_skinselect < numskins)
|
||||||
{
|
{
|
||||||
UINT8 *cmap = R_GetTranslationColormap(setupm_skinselect, setupm_fakecolor, GTC_MENUCACHE);
|
UINT8 *cmap = R_GetTranslationColormap(setupm_skinselect, setupm_fakecolor, GTC_MENUCACHE);
|
||||||
|
|
||||||
cursor = facewantprefix[skinsorted[setupm_skinselect]];
|
cursor = facewantprefix[skinsorted[setupm_skinselect]];
|
||||||
V_DrawFixedPatch(((curx-8) << FRACBITS), ((cury-8) << FRACBITS), FRACUNIT, 0, cursor, cmap);
|
V_DrawFixedPatch(((curx-8) << FRACBITS), ((cury-8) << FRACBITS), FRACUNIT, 0, cursor, cmap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT8 cursorframe = (I_GetTime() / 4) % 7;
|
UINT8 cursorframe = (I_GetTime() / 4) % 7;
|
||||||
|
|
||||||
cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
|
cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
|
||||||
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
|
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
|
||||||
}
|
}
|
||||||
@@ -8384,7 +8391,6 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
UINT8 cursorframe = (I_GetTime() / 4) % 7;
|
UINT8 cursorframe = (I_GetTime() / 4) % 7;
|
||||||
|
|
||||||
cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
|
cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH);
|
||||||
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
|
V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL);
|
||||||
}
|
}
|
||||||
@@ -8509,7 +8515,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||||||
switch (cv_skinselectmenu.value)
|
switch (cv_skinselectmenu.value)
|
||||||
{
|
{
|
||||||
case SKINMENUTYPE_2D:
|
case SKINMENUTYPE_2D:
|
||||||
skintodisplay = setupm_fakeskin;
|
skintodisplay = (UINT8)setupm_fakeskin;
|
||||||
if (setupm_skinlockedselect) // show the skin we are trying to select
|
if (setupm_skinlockedselect) // show the skin we are trying to select
|
||||||
skintodisplay = skinstats[setupm_skinxpos][setupm_skinypos][setupm_skinselect];
|
skintodisplay = skinstats[setupm_skinxpos][setupm_skinypos][setupm_skinselect];
|
||||||
else if (skinstatscount[setupm_skinxpos][setupm_skinypos] && itemOn == 1)
|
else if (skinstatscount[setupm_skinxpos][setupm_skinypos] && itemOn == 1)
|
||||||
@@ -8517,13 +8523,16 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||||||
break;
|
break;
|
||||||
case SKINMENUTYPE_EXTENDED:
|
case SKINMENUTYPE_EXTENDED:
|
||||||
case SKINMENUTYPE_GRID:
|
case SKINMENUTYPE_GRID:
|
||||||
skintodisplay = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin);
|
skintodisplay = ((itemOn == 1 && (setupm_skinselect < numskins)) ? skinsorted[setupm_skinselect] : (UINT8)setupm_fakeskin);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
skintodisplay = setupm_fakeskin;
|
skintodisplay = (UINT8)setupm_fakeskin;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (skintodisplay >= MAXSKINS)
|
||||||
|
skintodisplay = 0;
|
||||||
|
|
||||||
skinnum = R_SkinAvailable(skins[skintodisplay].name);
|
skinnum = R_SkinAvailable(skins[skintodisplay].name);
|
||||||
|
|
||||||
if (skinnum < 0 || skinnum >= MAXSKINS)
|
if (skinnum < 0 || skinnum >= MAXSKINS)
|
||||||
@@ -8538,18 +8547,6 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||||||
if (frame >= sprdef->numframes) // Walking animation missing
|
if (frame >= sprdef->numframes) // Walking animation missing
|
||||||
frame = 0; // Try to use standing frame
|
frame = 0; // Try to use standing frame
|
||||||
|
|
||||||
sprframe = &sprdef->spriteframes[frame];
|
|
||||||
|
|
||||||
// minenice's speen css, it's a piece of shit but hey
|
|
||||||
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
|
|
||||||
|
|
||||||
// this is a very shitty solution for checking if a sprite needs flipping
|
|
||||||
// but it works
|
|
||||||
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
|
|
||||||
flags = V_FLIP; // This sprite is left/right flipped!
|
|
||||||
|
|
||||||
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
|
|
||||||
|
|
||||||
// draw box around guy
|
// draw box around guy
|
||||||
V_DrawFill(mx + 36 - (charw/2), my+65, charw, 84, 239);
|
V_DrawFill(mx + 36 - (charw/2), my+65, charw, 84, 239);
|
||||||
#undef charw
|
#undef charw
|
||||||
@@ -8560,33 +8557,47 @@ static void M_DrawSetupMultiPlayerMenu(void)
|
|||||||
UINT8 *colormap = R_GetTranslationColormap(skintodisplay, setupm_fakecolor, GTC_MENUCACHE);
|
UINT8 *colormap = R_GetTranslationColormap(skintodisplay, setupm_fakecolor, GTC_MENUCACHE);
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
md2_t *md2 = &md2_playermodels[skinnum];
|
md2_t *md2 = &md2_playermodels[skinnum];
|
||||||
|
#endif
|
||||||
|
mx += 36;
|
||||||
|
my += 131;
|
||||||
|
#ifdef HWRENDER
|
||||||
// if we have 3d models enabled and a model exists
|
// if we have 3d models enabled and a model exists
|
||||||
// try to show it instead of the sprite
|
// try to show it instead of the sprite
|
||||||
if (rendermode == render_opengl && cv_glmdls.value
|
if (rendermode == render_opengl && cv_glmdls.value
|
||||||
&& !md2->error && !md2->notfound)
|
&& !md2->error && !md2->notfound)
|
||||||
{
|
{
|
||||||
mx += 36;
|
|
||||||
my += 131;
|
|
||||||
|
|
||||||
const angle_t ROTATE_PER_TIC = (UINT64)ANGLE_45 * cv_skinselectspin.value / TICRATE;
|
const angle_t ROTATE_PER_TIC = (UINT64)ANGLE_45 * cv_skinselectspin.value / TICRATE;
|
||||||
|
|
||||||
angle_t angle = I_GetTime()*ROTATE_PER_TIC + FixedMul(cv_uncappedhud.value ? renderdeltatics : FRACUNIT, ROTATE_PER_TIC);
|
angle_t angle = I_GetTime()*ROTATE_PER_TIC + FixedMul(cv_uncappedhud.value ? renderdeltatics : FRACUNIT, ROTATE_PER_TIC);
|
||||||
|
|
||||||
HWR_Draw2DModel(md2, mx, my, skinnum, (skincolors_t)setupm_fakecolor, colormap, 8*FRACUNIT/3, frame, angle);
|
HWR_Draw2DModel(md2, mx, my, skinnum, (skincolors_t)setupm_fakecolor, colormap, 8*FRACUNIT/3, frame, angle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
sprframe = &sprdef->spriteframes[frame];
|
||||||
|
|
||||||
|
// minenice's speen css, it's a piece of shit but hey
|
||||||
|
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
|
||||||
|
|
||||||
|
// this is a very shitty solution for checking if a sprite needs flipping
|
||||||
|
// but it works
|
||||||
|
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
|
||||||
|
{
|
||||||
|
flags = V_FLIP; // This sprite is left/right flipped!
|
||||||
|
}
|
||||||
|
|
||||||
|
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
|
||||||
|
|
||||||
if (skins[skintodisplay].flags & SF_HIRES)
|
if (skins[skintodisplay].flags & SF_HIRES)
|
||||||
{
|
{
|
||||||
V_DrawFixedPatch((mx+36)<<FRACBITS,
|
V_DrawFixedPatch(mx<<FRACBITS,
|
||||||
(my+131)<<FRACBITS,
|
my<<FRACBITS,
|
||||||
skins[skintodisplay].highresscale,
|
skins[skintodisplay].highresscale,
|
||||||
flags, patch, colormap);
|
flags, patch, colormap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
V_DrawMappedPatch(mx+36, my+131, flags, patch, colormap);
|
{
|
||||||
|
V_DrawMappedPatch(mx, my, flags, patch, colormap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9889,7 +9900,7 @@ static void M_DrawLocalSkinMenu(void)
|
|||||||
spriteframe_t *sprframe;
|
spriteframe_t *sprframe;
|
||||||
patch_t *patch;
|
patch_t *patch;
|
||||||
UINT8 frame;
|
UINT8 frame;
|
||||||
INT16 skintodisplay;
|
INT32 skintodisplay = 0;
|
||||||
UINT32 speenframe;
|
UINT32 speenframe;
|
||||||
skin_t displayskin;
|
skin_t displayskin;
|
||||||
|
|
||||||
@@ -9942,25 +9953,10 @@ static void M_DrawLocalSkinMenu(void)
|
|||||||
if (frame >= sprdef->numframes) // Walking animation missing
|
if (frame >= sprdef->numframes) // Walking animation missing
|
||||||
frame = 0; // Try to use standing frame
|
frame = 0; // Try to use standing frame
|
||||||
|
|
||||||
sprframe = &sprdef->spriteframes[frame];
|
|
||||||
|
|
||||||
//minenice's speen css, it's a piece of shit but hey
|
|
||||||
//patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[1], PU_PATCH);
|
|
||||||
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
|
|
||||||
|
|
||||||
//this is a very shitty solution for checking if a sprite needs flipping
|
|
||||||
//but it works
|
|
||||||
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
|
|
||||||
{
|
|
||||||
flags = V_FLIP; // This sprite is left/right flipped!
|
|
||||||
}
|
|
||||||
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
|
|
||||||
|
|
||||||
// draw box around guy
|
// draw box around guy
|
||||||
V_DrawFill(mx + 220 - (charw/2), my+54, charw, 84, 239);
|
V_DrawFill(mx + 220 - (charw/2), my+54, charw, 84, 239);
|
||||||
#undef charw
|
#undef charw
|
||||||
|
|
||||||
// draw player sprite
|
|
||||||
UINT8 *colormap = R_GetLocalTranslationColormap(&skins[displayskin.localnum], (displayskin.localskin ? &localskins[displayskin.localnum] : NULL), cv_playercolor.value, GTC_MENUCACHE, displayskin.localskin);
|
UINT8 *colormap = R_GetLocalTranslationColormap(&skins[displayskin.localnum], (displayskin.localskin ? &localskins[displayskin.localnum] : NULL), cv_playercolor.value, GTC_MENUCACHE, displayskin.localskin);
|
||||||
|
|
||||||
V_DrawMappedPatch(mx, my+50, 0, (patch_t *)W_CachePatchName(displayskin.facewant, PU_PATCH), colormap);
|
V_DrawMappedPatch(mx, my+50, 0, (patch_t *)W_CachePatchName(displayskin.facewant, PU_PATCH), colormap);
|
||||||
@@ -9974,6 +9970,9 @@ static void M_DrawLocalSkinMenu(void)
|
|||||||
V_DrawString(mx+20, my+118, V_ALLOWLOWERCASE|highlightflags, displayskin.realname);
|
V_DrawString(mx+20, my+118, V_ALLOWLOWERCASE|highlightflags, displayskin.realname);
|
||||||
|
|
||||||
// draw player sprite
|
// draw player sprite
|
||||||
|
mx += 220;
|
||||||
|
my += 120;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
md2_t *md2 = (displayskin.localskin ? &md2_localplayermodels[skintodisplay] : &md2_playermodels[skintodisplay]);
|
md2_t *md2 = (displayskin.localskin ? &md2_localplayermodels[skintodisplay] : &md2_playermodels[skintodisplay]);
|
||||||
|
|
||||||
@@ -9982,24 +9981,35 @@ static void M_DrawLocalSkinMenu(void)
|
|||||||
if (rendermode == render_opengl && cv_glmdls.value
|
if (rendermode == render_opengl && cv_glmdls.value
|
||||||
&& !md2->error && !md2->notfound)
|
&& !md2->error && !md2->notfound)
|
||||||
{
|
{
|
||||||
mx += 220;
|
|
||||||
my += 120;
|
|
||||||
|
|
||||||
const angle_t ROTATE_PER_TIC = (UINT64)ANGLE_45 * cv_skinselectspin.value / TICRATE;
|
const angle_t ROTATE_PER_TIC = (UINT64)ANGLE_45 * cv_skinselectspin.value / TICRATE;
|
||||||
|
|
||||||
angle_t angle = I_GetTime()*ROTATE_PER_TIC + FixedMul(cv_uncappedhud.value ? renderdeltatics : FRACUNIT, ROTATE_PER_TIC);
|
angle_t angle = I_GetTime()*ROTATE_PER_TIC + FixedMul(cv_uncappedhud.value ? renderdeltatics : FRACUNIT, ROTATE_PER_TIC);
|
||||||
|
|
||||||
HWR_Draw2DModel(md2, mx, my, skintodisplay, (skincolors_t)cv_playercolor.value, colormap, 8*FRACUNIT/3, frame, angle);
|
HWR_Draw2DModel(md2, mx, my, skintodisplay, (skincolors_t)cv_playercolor.value, colormap, 8*FRACUNIT/3, frame, angle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
sprframe = &sprdef->spriteframes[frame];
|
||||||
|
|
||||||
|
// minenice's speen css, it's a piece of shit but hey
|
||||||
|
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
|
||||||
|
|
||||||
|
// this is a very shitty solution for checking if a sprite needs flipping
|
||||||
|
// but it works
|
||||||
|
if ((speenframe > 4) && (sprframe->lumppat[speenframe] == sprframe->lumppat[8-speenframe]))
|
||||||
|
{
|
||||||
|
flags = V_FLIP; // This sprite is left/right flipped!
|
||||||
|
}
|
||||||
|
|
||||||
|
patch = (patch_t *)W_CachePatchNum(sprframe->lumppat[speenframe], PU_PATCH);
|
||||||
|
|
||||||
if (displayskin.flags & SF_HIRES)
|
if (displayskin.flags & SF_HIRES)
|
||||||
{
|
{
|
||||||
V_DrawFixedPatch((mx+220)<<FRACBITS, (my+120)<<FRACBITS, displayskin.highresscale, flags, patch, colormap);
|
V_DrawFixedPatch(mx<<FRACBITS, my<<FRACBITS, displayskin.highresscale, flags, patch, colormap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
V_DrawMappedPatch(mx+220, my+120, flags, patch, colormap);
|
{
|
||||||
|
V_DrawMappedPatch(mx, my, flags, patch, colormap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -215,7 +215,7 @@ void M_SetupNextMenu(menu_t *menudef);
|
|||||||
void M_ClearMenus(boolean callexitmenufunc);
|
void M_ClearMenus(boolean callexitmenufunc);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
extern I_mutex m_menu_mutex;
|
extern I_Mutex m_menu_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern menu_t *currentMenu;
|
extern menu_t *currentMenu;
|
||||||
|
|||||||
+24
-16
@@ -1205,6 +1205,10 @@ static menuitem_t OP_FocusOptionsMenu[] =
|
|||||||
{IT_STRING|IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 100},
|
{IT_STRING|IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 100},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Visible Mouse", &cv_mousevisible, 120},
|
{IT_STRING|IT_CVAR, NULL, "Visible Mouse", &cv_mousevisible, 120},
|
||||||
|
|
||||||
|
{IT_STRING|IT_CVAR, NULL, "Gamepad LED Color While Unfocused ", &cv_gamepadledifunfocused, 140},
|
||||||
|
{IT_STRING|IT_CVAR, NULL, "Gamepad Rumble While Unfocused", &cv_rumbleifunfocused, 150},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* OP_FocusOptionsTooltips[] =
|
static const char* OP_FocusOptionsTooltips[] =
|
||||||
@@ -1216,6 +1220,8 @@ static const char* OP_FocusOptionsTooltips[] =
|
|||||||
"Set manual framerate cap while the game is unfocused.",
|
"Set manual framerate cap while the game is unfocused.",
|
||||||
"Should the FOCUS LOST window appear\n while the game is unfocused?",
|
"Should the FOCUS LOST window appear\n while the game is unfocused?",
|
||||||
"Displays the mouse cursor while the game is in focus.",
|
"Displays the mouse cursor while the game is in focus.",
|
||||||
|
"Should gamepad LED indicator change color when unfocused?",
|
||||||
|
"Should gamepad rumble apply when unfocused?",
|
||||||
};
|
};
|
||||||
|
|
||||||
static menuitem_t OP_DataOptionsMenu[] =
|
static menuitem_t OP_DataOptionsMenu[] =
|
||||||
@@ -1633,33 +1639,34 @@ static menuitem_t OP_AccessibilityMenu[] =
|
|||||||
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "Saturation", &cv_globalsaturation, 25},
|
{IT_STRING|IT_CVAR|IT_CV_SLIDER, NULL, "Saturation", &cv_globalsaturation, 25},
|
||||||
{IT_SUBMENU|IT_STRING, NULL, "Video Color Settings...", &OP_ColorOptionsDef, 30},
|
{IT_SUBMENU|IT_STRING, NULL, "Video Color Settings...", &OP_ColorOptionsDef, 30},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Midnight Channel Flicker", &cv_lessflicker, 35},
|
{IT_STRING|IT_CVAR, NULL, "Reduce Effects", &cv_reducevfx, 35},
|
||||||
|
{IT_STRING|IT_CVAR, NULL, "Midnight Channel Flicker", &cv_lessflicker, 40}, // obsolete now? or still better be a seperate toggle?
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Minimum Sector Brightness", &cv_secbright, 40},
|
{IT_STRING|IT_CVAR, NULL, "Minimum Sector Brightness", &cv_secbright, 45},
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
{IT_STRING|IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 45},
|
{IT_STRING|IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 50},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Water Surface Ripples", &cv_ripplewater, 50},
|
{IT_STRING|IT_CVAR, NULL, "Water Surface Ripples", &cv_ripplewater, 55},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Fade Players near Camera", &cv_playerfade, 55},
|
{IT_STRING|IT_CVAR, NULL, "Fade Players near Camera", &cv_playerfade, 60},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 60},
|
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 65},
|
||||||
|
|
||||||
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 65},
|
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 70},
|
||||||
|
|
||||||
{IT_HEADER, NULL, "Audio", NULL, 75},
|
{IT_HEADER, NULL, "Audio", NULL, 80},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 85},
|
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 90},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 90},
|
{IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 95},
|
||||||
|
|
||||||
{IT_HEADER, NULL, "Controls", NULL, 100},
|
{IT_HEADER, NULL, "Controls", NULL, 105},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P1)", &cv_autoaccel[0], 110},
|
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P1)", &cv_autoaccel[0], 115},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P2)", &cv_autoaccel[1], 115},
|
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P2)", &cv_autoaccel[1], 120},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P3)", &cv_autoaccel[2], 120},
|
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P3)", &cv_autoaccel[2], 125},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P4)", &cv_autoaccel[3], 125},
|
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P4)", &cv_autoaccel[3], 130},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* OP_AccessibilityTooltips[] =
|
static const char* OP_AccessibilityTooltips[] =
|
||||||
@@ -1669,10 +1676,11 @@ static const char* OP_AccessibilityTooltips[] =
|
|||||||
"Gamma (brightness) of the game.",
|
"Gamma (brightness) of the game.",
|
||||||
"Saturation of the game.",
|
"Saturation of the game.",
|
||||||
"Advanced color settings of the game.",
|
"Advanced color settings of the game.",
|
||||||
|
"Reduces or disables certain effects players might be sensitive to\nSuch as flashing, flickering, certain screen effects and more.",
|
||||||
"Disables the flicker effect on Midnight Channel.",
|
"Disables the flicker effect on Midnight Channel.",
|
||||||
"Sets minimum sector brightness, useful for dark areas",
|
"Sets minimum sector brightness, useful for dark areas",
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
"Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.",
|
"Disabling Screen Textures will disable the Underwater and Heat screen effects.",
|
||||||
#endif
|
#endif
|
||||||
"Toggles the ripple effect on water surfaces",
|
"Toggles the ripple effect on water surfaces",
|
||||||
"Fades other Players that are close to the camera in and out",
|
"Fades other Players that are close to the camera in and out",
|
||||||
|
|||||||
+2
-2
@@ -540,7 +540,7 @@ static boolean M_BackupConfig(const char *filename)
|
|||||||
void M_SaveConfig(const char *filename)
|
void M_SaveConfig(const char *filename)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char *filepath;
|
CLEANUP(Z_Pfree) char *filepath = NULL;
|
||||||
|
|
||||||
// make sure not to write back the config until it's been correctly loaded
|
// make sure not to write back the config until it's been correctly loaded
|
||||||
if (!loaded_config)
|
if (!loaded_config)
|
||||||
@@ -558,7 +558,7 @@ void M_SaveConfig(const char *filename)
|
|||||||
// append srb2home to beginning of filename
|
// append srb2home to beginning of filename
|
||||||
// but check if srb2home isn't already there, first
|
// but check if srb2home isn't already there, first
|
||||||
if (!strstr(filename, srb2home))
|
if (!strstr(filename, srb2home))
|
||||||
filepath = va(pandf,srb2home, filename);
|
filepath = Z_StrDup(va(pandf, srb2home, filename));
|
||||||
else
|
else
|
||||||
filepath = Z_StrDup(filename);
|
filepath = Z_StrDup(filename);
|
||||||
|
|
||||||
|
|||||||
+37
-32
@@ -41,11 +41,11 @@ static time_t MSLastPing;
|
|||||||
static char *MSRules;
|
static char *MSRules;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
static I_mutex MSMutex;
|
static I_Mutex MSMutex;
|
||||||
static I_cond MSCond;
|
static I_Cond MSCond;
|
||||||
|
|
||||||
# define Lock_state() I_lock_mutex (&MSMutex)
|
# define Lock_state() I_LockMutex (&MSMutex)
|
||||||
# define Unlock_state() I_unlock_mutex (MSMutex)
|
# define Unlock_state() I_UnlockMutex (MSMutex)
|
||||||
#else/*HAVE_THREADS*/
|
#else/*HAVE_THREADS*/
|
||||||
# define Lock_state()
|
# define Lock_state()
|
||||||
# define Unlock_state()
|
# define Unlock_state()
|
||||||
@@ -90,10 +90,10 @@ consvar_t cv_masterserver_nagattempts = {"masterserver_nagattempts", "5", CV_SAV
|
|||||||
|
|
||||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||||
int ms_QueryId = 0;
|
int ms_QueryId = 0;
|
||||||
I_mutex ms_QueryId_mutex;
|
I_Mutex ms_QueryId_mutex;
|
||||||
|
|
||||||
msg_server_t *ms_ServerList = NULL;
|
msg_server_t *ms_ServerList = NULL;
|
||||||
I_mutex ms_ServerList_mutex;
|
I_Mutex ms_ServerList_mutex;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UINT16 current_port = 0;
|
UINT16 current_port = 0;
|
||||||
@@ -129,11 +129,11 @@ void AddMServCommands(void)
|
|||||||
static void WarnGUI (void)
|
static void WarnGUI (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&m_menu_mutex);
|
I_LockMutex(&m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
M_PopupMasterServerConnectError();
|
M_PopupMasterServerConnectError();
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_unlock_mutex(m_menu_mutex);
|
I_UnlockMutex(m_menu_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,12 +168,12 @@ char *GetMODVersion(int id)
|
|||||||
c = HMS_compare_mod_version(buffer, 16);
|
c = HMS_compare_mod_version(buffer, 16);
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_lock_mutex(&ms_QueryId_mutex);
|
I_LockMutex(&ms_QueryId_mutex);
|
||||||
{
|
{
|
||||||
if (id != ms_QueryId)
|
if (id != ms_QueryId)
|
||||||
c = -1;
|
c = -1;
|
||||||
}
|
}
|
||||||
I_unlock_mutex(ms_QueryId_mutex);
|
I_UnlockMutex(ms_QueryId_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
@@ -219,8 +219,9 @@ static void Get_masterserver_rules(boolean checkfirst)
|
|||||||
if (HMS_fetch_rules(rules, sizeof rules))
|
if (HMS_fetch_rules(rules, sizeof rules))
|
||||||
{
|
{
|
||||||
Lock_state();
|
Lock_state();
|
||||||
Z_Free(MSRules);
|
if (MSRules)
|
||||||
MSRules = Z_StrDup(rules);
|
free(MSRules);
|
||||||
|
MSRules = strdup(rules);
|
||||||
|
|
||||||
if (MSRegistered == true)
|
if (MSRegistered == true)
|
||||||
{
|
{
|
||||||
@@ -340,7 +341,7 @@ Finish_unlist (void)
|
|||||||
Unlock_state();
|
Unlock_state();
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_wake_all_cond(&MSCond);
|
I_WakeAllCond(&MSCond);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -376,7 +377,7 @@ New_server_id (void)
|
|||||||
Lock_state();
|
Lock_state();
|
||||||
{
|
{
|
||||||
*id = ++MSId;
|
*id = ++MSId;
|
||||||
I_wake_all_cond(&MSCond);
|
I_WakeAllCond(&MSCond);
|
||||||
}
|
}
|
||||||
Unlock_state();
|
Unlock_state();
|
||||||
return id;
|
return id;
|
||||||
@@ -391,7 +392,7 @@ Register_server_thread (int *id)
|
|||||||
{
|
{
|
||||||
/* wait for previous unlist to finish */
|
/* wait for previous unlist to finish */
|
||||||
while (*id == MSId && MSRegistered)
|
while (*id == MSId && MSRegistered)
|
||||||
I_hold_cond(&MSCond, MSMutex);
|
I_HoldCond(&MSCond, MSMutex);
|
||||||
|
|
||||||
same = ( *id == MSId );/* it could have been a while */
|
same = ( *id == MSId );/* it could have been a while */
|
||||||
}
|
}
|
||||||
@@ -443,7 +444,7 @@ Change_masterserver_thread (char *api)
|
|||||||
Lock_state();
|
Lock_state();
|
||||||
{
|
{
|
||||||
while (MSRegistered)
|
while (MSRegistered)
|
||||||
I_hold_cond(&MSCond, MSMutex);
|
I_HoldCond(&MSCond, MSMutex);
|
||||||
}
|
}
|
||||||
Unlock_state();
|
Unlock_state();
|
||||||
|
|
||||||
@@ -463,9 +464,9 @@ void RegisterServer(void)
|
|||||||
{
|
{
|
||||||
#ifdef MASTERSERVER
|
#ifdef MASTERSERVER
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_spawn_thread(
|
(void)!I_SpawnThread(
|
||||||
"register-server",
|
"register-server",
|
||||||
(I_thread_fn)Register_server_thread,
|
(I_ThreadFn)Register_server_thread,
|
||||||
New_server_id()
|
New_server_id()
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
@@ -477,9 +478,9 @@ void RegisterServer(void)
|
|||||||
static void UpdateServer(void)
|
static void UpdateServer(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_spawn_thread(
|
(void)!I_SpawnThread(
|
||||||
"update-server",
|
"update-server",
|
||||||
(I_thread_fn)Update_server_thread,
|
(I_ThreadFn)Update_server_thread,
|
||||||
Server_id()
|
Server_id()
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
@@ -491,9 +492,9 @@ void UnregisterServer(void)
|
|||||||
{
|
{
|
||||||
#ifdef MASTERSERVER
|
#ifdef MASTERSERVER
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_spawn_thread(
|
(void)!I_SpawnThread(
|
||||||
"unlist-server",
|
"unlist-server",
|
||||||
(I_thread_fn)Unlist_server_thread,
|
(I_ThreadFn)Unlist_server_thread,
|
||||||
Server_id()
|
Server_id()
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
@@ -507,7 +508,7 @@ char *GetMasterServerRules(void)
|
|||||||
char *rules;
|
char *rules;
|
||||||
|
|
||||||
Lock_state();
|
Lock_state();
|
||||||
rules = MSRules ? Z_StrDup(MSRules) : NULL;
|
rules = MSRules ? strdup(MSRules) : NULL;
|
||||||
Unlock_state();
|
Unlock_state();
|
||||||
|
|
||||||
return rules;
|
return rules;
|
||||||
@@ -556,14 +557,18 @@ void MasterClient_Ticker(void)
|
|||||||
static void
|
static void
|
||||||
Set_api (const char *api)
|
Set_api (const char *api)
|
||||||
{
|
{
|
||||||
|
char *dapi = strdup(api);
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_spawn_thread(
|
if (!I_SpawnThread(
|
||||||
"change-masterserver",
|
"change-masterserver",
|
||||||
(I_thread_fn)Change_masterserver_thread,
|
(I_ThreadFn)Change_masterserver_thread,
|
||||||
strdup(api)
|
dapi
|
||||||
);
|
))
|
||||||
|
{
|
||||||
|
free(dapi);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
Finish_masterserver_change(strdup(api));
|
Finish_masterserver_change(dapi);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,9 +576,9 @@ void
|
|||||||
Get_rules (void)
|
Get_rules (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_spawn_thread(
|
(void)!I_SpawnThread(
|
||||||
"get-masterserver-rules",
|
"get-masterserver-rules",
|
||||||
(I_thread_fn)Get_masterserver_rules_thread,
|
(I_ThreadFn)Get_masterserver_rules_thread,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
|
|||||||
+2
-2
@@ -69,10 +69,10 @@ extern consvar_t cv_rendezvousserver;
|
|||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
extern int ms_QueryId;
|
extern int ms_QueryId;
|
||||||
extern I_mutex ms_QueryId_mutex;
|
extern I_Mutex ms_QueryId_mutex;
|
||||||
|
|
||||||
extern msg_server_t *ms_ServerList;
|
extern msg_server_t *ms_ServerList;
|
||||||
extern I_mutex ms_ServerList_mutex;
|
extern I_Mutex ms_ServerList_mutex;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MASTERSERVER
|
#ifdef MASTERSERVER
|
||||||
void RegisterServer(void);
|
void RegisterServer(void);
|
||||||
|
|||||||
+4
-4
@@ -14,10 +14,6 @@
|
|||||||
#ifndef __P_LOCAL__
|
#ifndef __P_LOCAL__
|
||||||
#define __P_LOCAL__
|
#define __P_LOCAL__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "d_player.h"
|
#include "d_player.h"
|
||||||
#include "d_think.h"
|
#include "d_think.h"
|
||||||
@@ -28,6 +24,10 @@ extern "C" {
|
|||||||
#include "p_maputl.h"
|
#include "p_maputl.h"
|
||||||
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
|
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FLOATSPEED (FRACUNIT*4)
|
#define FLOATSPEED (FRACUNIT*4)
|
||||||
|
|
||||||
//#define VIEWHEIGHTS "41"
|
//#define VIEWHEIGHTS "41"
|
||||||
|
|||||||
+1
-3
@@ -320,9 +320,7 @@ void P_AddGradesForMare(INT16 i, UINT8 mare, char *gtext)
|
|||||||
*/
|
*/
|
||||||
void P_DeleteGrades(INT16 i)
|
void P_DeleteGrades(INT16 i)
|
||||||
{
|
{
|
||||||
if (mapheaderinfo[i]->grades)
|
Z_Free(mapheaderinfo[i]->grades);
|
||||||
Z_Free(mapheaderinfo[i]->grades);
|
|
||||||
|
|
||||||
mapheaderinfo[i]->grades = NULL;
|
mapheaderinfo[i]->grades = NULL;
|
||||||
mapheaderinfo[i]->numGradedMares = 0;
|
mapheaderinfo[i]->numGradedMares = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -6221,8 +6221,7 @@ void P_SpawnSpecials(INT32 fromnetsave, boolean reloadinggamestate)
|
|||||||
|
|
||||||
// Allocate each list
|
// Allocate each list
|
||||||
for (i = 0; i < numsectors; i++)
|
for (i = 0; i < numsectors; i++)
|
||||||
if(secthinkers[i].thinkers)
|
Z_Free(secthinkers[i].thinkers);
|
||||||
Z_Free(secthinkers[i].thinkers);
|
|
||||||
|
|
||||||
Z_Free(secthinkers);
|
Z_Free(secthinkers);
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
extern tic_t leveltime;
|
extern tic_t leveltime;
|
||||||
|
|
||||||
// Called by G_Ticker. Carries out all thinking of enemies and players.
|
// Called by G_Ticker. Carries out all thinking of enemies and players.
|
||||||
@@ -38,6 +42,10 @@ mobj_t *P_SetTarget2(mobj_t **mo, mobj_t *target
|
|||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
#define P_SetTarget(...) P_SetTarget2(__VA_ARGS__, __FILE__, __LINE__)
|
#define P_SetTarget(...) P_SetTarget2(__VA_ARGS__, __FILE__, __LINE__)
|
||||||
#else
|
#else
|
||||||
|
|||||||
+1
-2
@@ -1720,8 +1720,7 @@ void R_InitData(void)
|
|||||||
|
|
||||||
void R_ClearTextureNumCache(boolean btell)
|
void R_ClearTextureNumCache(boolean btell)
|
||||||
{
|
{
|
||||||
if (tidcache)
|
Z_Free(tidcache);
|
||||||
Z_Free(tidcache);
|
|
||||||
tidcache = NULL;
|
tidcache = NULL;
|
||||||
if (btell)
|
if (btell)
|
||||||
CONS_Debug(DBG_SETUP, "Fun Fact: There are %d textures used in this map.\n", tidcachelen);
|
CONS_Debug(DBG_SETUP, "Fun Fact: There are %d textures used in this map.\n", tidcachelen);
|
||||||
|
|||||||
+8
-2
@@ -289,8 +289,14 @@ void R_GenerateBlendTables(void)
|
|||||||
state->LocalPalette = static_cast<RGBA_t *>(memcpy(malloc(palsize), pLocalPalette, palsize));
|
state->LocalPalette = static_cast<RGBA_t *>(memcpy(malloc(palsize), pLocalPalette, palsize));
|
||||||
state->gammaCorrectedPalette = static_cast<RGBA_t *>(memcpy(malloc(palsize), pGammaCorrectedPalette, palsize));
|
state->gammaCorrectedPalette = static_cast<RGBA_t *>(memcpy(malloc(palsize), pGammaCorrectedPalette, palsize));
|
||||||
|
|
||||||
I_spawn_thread("blend-tables",
|
if (!I_SpawnThread("blend-tables",
|
||||||
R_GenerateBlendTables_Thread, state);
|
R_GenerateBlendTables_Thread, state))
|
||||||
|
{
|
||||||
|
free(state->gammaCorrectedPalette);
|
||||||
|
free(state->LocalPalette);
|
||||||
|
free(state);
|
||||||
|
I_Error("R_GenerateBlendTables: Failed to generate BlendTables\n"); // should we just retry on main thread instead?
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
struct GenerateBlendTables_State state = {pLocalPalette, pGammaCorrectedPalette};
|
struct GenerateBlendTables_State state = {pLocalPalette, pGammaCorrectedPalette};
|
||||||
R_GenerateBlendTables_Core(&state);
|
R_GenerateBlendTables_Core(&state);
|
||||||
|
|||||||
+4
-4
@@ -15,16 +15,16 @@
|
|||||||
#ifndef __R_FPS_H__
|
#ifndef __R_FPS_H__
|
||||||
#define __R_FPS_H__
|
#define __R_FPS_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "m_fixed.h"
|
#include "m_fixed.h"
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "r_state.h"
|
#include "r_state.h"
|
||||||
#include "r_things.h"
|
#include "r_things.h"
|
||||||
#include "m_perfstats.h"
|
#include "m_perfstats.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
extern consvar_t cv_fpscap, cv_fpscapbg;
|
extern consvar_t cv_fpscap, cv_fpscapbg;
|
||||||
|
|
||||||
extern ps_metric_t ps_interp_frac;
|
extern ps_metric_t ps_interp_frac;
|
||||||
|
|||||||
+8
-12
@@ -925,11 +925,11 @@ void R_ExecuteSetViewSize(void)
|
|||||||
viewheight = vid.height;
|
viewheight = vid.height;
|
||||||
|
|
||||||
if (splitscreen)
|
if (splitscreen)
|
||||||
|
{
|
||||||
viewheight >>= 1;
|
viewheight >>= 1;
|
||||||
|
|
||||||
if (splitscreen > 1)
|
if (splitscreen > 1)
|
||||||
{
|
viewwidth >>= 1;
|
||||||
viewwidth >>= 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
centerx = viewwidth/2;
|
centerx = viewwidth/2;
|
||||||
@@ -956,13 +956,9 @@ void R_ExecuteSetViewSize(void)
|
|||||||
screenheightarray[i] = (INT16)viewheight;
|
screenheightarray[i] = (INT16)viewheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ds_su)
|
Z_Free(ds_su);
|
||||||
Z_Free(ds_su);
|
Z_Free(ds_sv);
|
||||||
if (ds_sv)
|
Z_Free(ds_sz);
|
||||||
Z_Free(ds_sv);
|
|
||||||
if (ds_sz)
|
|
||||||
Z_Free(ds_sz);
|
|
||||||
|
|
||||||
ds_su = ds_sv = ds_sz = NULL;
|
ds_su = ds_sv = ds_sz = NULL;
|
||||||
|
|
||||||
memset(scalelight, 0xFF, sizeof(scalelight));
|
memset(scalelight, 0xFF, sizeof(scalelight));
|
||||||
@@ -1018,8 +1014,8 @@ static void R_InitViewMapping(void)
|
|||||||
|
|
||||||
for (INT32 i = 0; i < j; i++)
|
for (INT32 i = 0; i < j; i++)
|
||||||
{
|
{
|
||||||
fixed_t dy = (i - viewheight*8)<<FRACBITS;
|
fixed_t dy = abs(i - viewheight*8) << FRACBITS;
|
||||||
dy = FixedMul(abs(dy), fovtan);
|
dy = FixedMul(dy, fovtan);
|
||||||
yslopetab[i] = FixedDiv(centerx*FRACUNIT, dy);
|
yslopetab[i] = FixedDiv(centerx*FRACUNIT, dy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -14,14 +14,14 @@
|
|||||||
#ifndef __R_MAIN__
|
#ifndef __R_MAIN__
|
||||||
#define __R_MAIN__
|
#define __R_MAIN__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "d_player.h"
|
#include "d_player.h"
|
||||||
#include "r_data.h"
|
#include "r_data.h"
|
||||||
#include "m_perfstats.h"
|
#include "m_perfstats.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// POV related.
|
// POV related.
|
||||||
//
|
//
|
||||||
|
|||||||
+2
-4
@@ -405,10 +405,8 @@ static void Patch_FreeData(patch_t *patch)
|
|||||||
}*/
|
}*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (patch->columnofs)
|
Z_Free(patch->columnofs);
|
||||||
Z_Free(patch->columnofs);
|
Z_Free(patch->columns);
|
||||||
if (patch->columns)
|
|
||||||
Z_Free(patch->columns);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Patch_Free(patch_t *patch)
|
void Patch_Free(patch_t *patch)
|
||||||
|
|||||||
+12
-9
@@ -57,8 +57,11 @@ visffloor_t visffloor[MAXFFLOORS] = {};
|
|||||||
INT32 numffloors = 0;
|
INT32 numffloors = 0;
|
||||||
|
|
||||||
//SoM: 3/23/2000: Boom visplane hashing routine.
|
//SoM: 3/23/2000: Boom visplane hashing routine.
|
||||||
#define visplane_hash(picnum,lightlevel,height) \
|
constexpr unsigned int visplane_hash(const unsigned int picnum, const unsigned int lightlevel,
|
||||||
((unsigned)((picnum)*3+(lightlevel)+(height)*7) & VISPLANEHASHMASK)
|
const unsigned int height)
|
||||||
|
{
|
||||||
|
return ((picnum * 3) + lightlevel + (height * 7)) & VISPLANEHASHMASK;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clip values are the solid pixel bounding the range.
|
// Clip values are the solid pixel bounding the range.
|
||||||
@@ -136,7 +139,7 @@ void R_AllocPlaneMemory(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
yslopetab = static_cast<fixed_t*>(Z_Realloc(yslopetab, sizeof(*yslopetab) * (viewheight * 16), PU_STATIC, NULL));
|
yslopetab = static_cast<fixed_t*>(Z_Realloc(yslopetab, sizeof(*yslopetab) * (viewheight * 16), PU_STATIC, NULL));
|
||||||
spanstart = static_cast<fixed_t*>(Z_Realloc(spanstart, sizeof(*spanstart) * viewheight, PU_STATIC, NULL));
|
spanstart = static_cast<INT32*>(Z_Realloc(spanstart, sizeof(*spanstart) * viewheight, PU_STATIC, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -451,7 +454,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hash = visplane_hash(picnum, lightlevel, height);
|
hash = visplane_hash(picnum, lightlevel, height >> FRACBITS);
|
||||||
|
|
||||||
for (check = visplanes[hash]; check; check = check->next)
|
for (check = visplanes[hash]; check; check = check->next)
|
||||||
{
|
{
|
||||||
@@ -562,7 +565,7 @@ visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned hash = visplane_hash(pl->picnum, pl->lightlevel, pl->height);
|
unsigned hash = visplane_hash(pl->picnum, pl->lightlevel, pl->height >> FRACBITS);
|
||||||
new_pl = new_visplane(hash);
|
new_pl = new_visplane(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -920,12 +923,12 @@ static void R_SetSlopePlane(drawspandata_t* ds, pslope_t *slope, fixed_t xpos, f
|
|||||||
|
|
||||||
// m is the v direction vector in view space
|
// m is the v direction vector in view space
|
||||||
ang = ANG2RAD(ANGLE_180 - (angle + plangle));
|
ang = ANG2RAD(ANGLE_180 - (angle + plangle));
|
||||||
m->x = cos(ang);
|
m->x = cosf(ang);
|
||||||
m->z = sin(ang);
|
m->z = sinf(ang);
|
||||||
|
|
||||||
// n is the u direction vector in view space
|
// n is the u direction vector in view space
|
||||||
n->x = sin(ang);
|
n->x = sinf(ang);
|
||||||
n->z = -cos(ang);
|
n->z = -cosf(ang);
|
||||||
|
|
||||||
plangle >>= ANGLETOFINESHIFT;
|
plangle >>= ANGLETOFINESHIFT;
|
||||||
temp = P_GetSlopeZAt(slope, xpos + FINESINE(plangle), ypos + FINECOSINE(plangle));
|
temp = P_GetSlopeZAt(slope, xpos + FINESINE(plangle), ypos + FINECOSINE(plangle));
|
||||||
|
|||||||
@@ -246,7 +246,6 @@ static boolean TrimVisplaneBounds(const visplane_t* plane, INT16* start, INT16*
|
|||||||
if (!(*start < *end))
|
if (!(*start < *end))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
/** Trims a visplane's horizontal gap to match its render area.
|
/** Trims a visplane's horizontal gap to match its render area.
|
||||||
*
|
*
|
||||||
* Visplanes' minx/maxx may sometimes exceed the area they're
|
* Visplanes' minx/maxx may sometimes exceed the area they're
|
||||||
|
|||||||
+4
-2
@@ -15,6 +15,8 @@
|
|||||||
#include "r_local.h"
|
#include "r_local.h"
|
||||||
#include "r_sky.h"
|
#include "r_sky.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "r_portal.h"
|
#include "r_portal.h"
|
||||||
#include "r_splats.h"
|
#include "r_splats.h"
|
||||||
#include "r_fps.h" // newview
|
#include "r_fps.h" // newview
|
||||||
@@ -2878,7 +2880,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
if (markceiling)
|
if (markceiling)
|
||||||
{
|
{
|
||||||
if (ceilingplane) //SoM: 3/29/2000: Check for null ceiling planes
|
if (ceilingplane) //SoM: 3/29/2000: Check for null ceiling planes
|
||||||
ceilingplane = R_CheckPlane (ceilingplane, rw_x, rw_stopx-1);
|
ceilingplane = R_CheckPlane(ceilingplane, rw_x, rw_stopx-1);
|
||||||
else
|
else
|
||||||
markceiling = false;
|
markceiling = false;
|
||||||
|
|
||||||
@@ -2892,7 +2894,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||||||
if (markfloor)
|
if (markfloor)
|
||||||
{
|
{
|
||||||
if (floorplane) //SoM: 3/29/2000: Check for null planes
|
if (floorplane) //SoM: 3/29/2000: Check for null planes
|
||||||
floorplane = R_CheckPlane (floorplane, rw_x, rw_stopx-1);
|
floorplane = R_CheckPlane(floorplane, rw_x, rw_stopx-1);
|
||||||
else
|
else
|
||||||
markfloor = false;
|
markfloor = false;
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -70,7 +70,7 @@ INT16 *screenheightarray = NULL;
|
|||||||
|
|
||||||
typedef struct drawseg_xrange_item_s
|
typedef struct drawseg_xrange_item_s
|
||||||
{
|
{
|
||||||
INT16 x1, x2;
|
INT32 x1, x2;
|
||||||
drawseg_t *user;
|
drawseg_t *user;
|
||||||
} drawseg_xrange_item_t;
|
} drawseg_xrange_item_t;
|
||||||
|
|
||||||
@@ -391,7 +391,7 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16
|
|||||||
|
|
||||||
// allocate space for the frames present and copy sprtemp to it
|
// allocate space for the frames present and copy sprtemp to it
|
||||||
if (spritedef->numframes && // has been allocated
|
if (spritedef->numframes && // has been allocated
|
||||||
spritedef->numframes < maxframe) // more frames are defined ?
|
spritedef->numframes < maxframe) // more frames are defined ?
|
||||||
{
|
{
|
||||||
|
|
||||||
Z_Free(spritedef->spriteframes);
|
Z_Free(spritedef->spriteframes);
|
||||||
@@ -489,8 +489,8 @@ void R_InitSprites(void)
|
|||||||
for (angle = 1; angle < ROTANGLES; angle++)
|
for (angle = 1; angle < ROTANGLES; angle++)
|
||||||
{
|
{
|
||||||
fa = ANG2RAD(FixedAngle((ROTANGDIFF * angle)<<FRACBITS));
|
fa = ANG2RAD(FixedAngle((ROTANGDIFF * angle)<<FRACBITS));
|
||||||
rollcosang[angle] = FLOAT_TO_FIXED(cos(-fa));
|
rollcosang[angle] = FLOAT_TO_FIXED(cosf(-fa));
|
||||||
rollsinang[angle] = FLOAT_TO_FIXED(sin(-fa));
|
rollsinang[angle] = FLOAT_TO_FIXED(sinf(-fa));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ typedef struct viddef_s
|
|||||||
|
|
||||||
INT32 dup; // scale 1, 2, 3 value for menus & overlays
|
INT32 dup; // scale 1, 2, 3 value for menus & overlays
|
||||||
INT32 fdup; // same as dup, but exact value when aspect ratio isn't 320/200
|
INT32 fdup; // same as dup, but exact value when aspect ratio isn't 320/200
|
||||||
|
INT32 udup; // same as dup but does not account for highreshudscale
|
||||||
UINT8 smalldup; // factor for a little bit of scaling
|
UINT8 smalldup; // factor for a little bit of scaling
|
||||||
UINT8 meddup; // factor for moderate, but not full, scaling
|
UINT8 meddup; // factor for moderate, but not full, scaling
|
||||||
|
|
||||||
|
|||||||
+21
-5
@@ -32,10 +32,9 @@ set(SRB2_SDL2_SOURCES
|
|||||||
hwsym_sdl.c
|
hwsym_sdl.c
|
||||||
i_main.c
|
i_main.c
|
||||||
i_net.c
|
i_net.c
|
||||||
i_system.c
|
i_system.cpp
|
||||||
i_ttf.c
|
i_ttf.c
|
||||||
i_video.c
|
i_video.c
|
||||||
i_threads.c
|
|
||||||
#IMG_xpm.c
|
#IMG_xpm.c
|
||||||
ogl_sdl.c
|
ogl_sdl.c
|
||||||
|
|
||||||
@@ -123,8 +122,6 @@ if(${SDL2_FOUND})
|
|||||||
set(MACOSX_BUNDLE_ICON_FILE Srb2mac.icns)
|
set(MACOSX_BUNDLE_ICON_FILE Srb2mac.icns)
|
||||||
set_source_files_properties(macosx/Srb2mac.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
set_source_files_properties(macosx/Srb2mac.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||||
set(SRB2_SDL2_MAC_SOURCES
|
set(SRB2_SDL2_MAC_SOURCES
|
||||||
macosx/mac_alert.c
|
|
||||||
macosx/mac_alert.h
|
|
||||||
macosx/mac_resources.c
|
macosx/mac_resources.c
|
||||||
macosx/mac_resources.h
|
macosx/mac_resources.h
|
||||||
macosx/Srb2mac.icns
|
macosx/Srb2mac.icns
|
||||||
@@ -167,10 +164,15 @@ if(${SDL2_FOUND})
|
|||||||
${DISCORDRPC_LIBRARIES}
|
${DISCORDRPC_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(${SRB2_HAVE_LIBBACKTRACE})
|
||||||
|
target_link_libraries(SRB2SDL2 PRIVATE ${LIBBACKTRACE_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM} MATCHES Linux)
|
if(${CMAKE_SYSTEM} MATCHES Linux)
|
||||||
target_link_libraries(SRB2SDL2 PRIVATE
|
target_link_libraries(SRB2SDL2 PRIVATE
|
||||||
m
|
m
|
||||||
rt
|
rt
|
||||||
|
pthread
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -226,6 +228,20 @@ if(${SDL2_FOUND})
|
|||||||
-DHAVE_THREADS
|
-DHAVE_THREADS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(SRB2_CONFIG_LTO AND NOT SRB2_CONFIG_DEBUGMODE)
|
||||||
|
set_property(TARGET SRB2SDL2 PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
## strip debug symbols into separate file when using gcc
|
## strip debug symbols into separate file when using gcc
|
||||||
# if(CMAKE_COMPILER_IS_GNUCC)
|
# if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
# if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
# if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||||
@@ -292,7 +308,7 @@ if(${SDL2_FOUND})
|
|||||||
else()
|
else()
|
||||||
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}")
|
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}")
|
||||||
list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
|
list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
getwinlib(SDL2 "SDL2.dll")
|
getwinlib(SDL2 "SDL2.dll")
|
||||||
if(${SRB2_CONFIG_SDL2_USEMIXER})
|
if(${SRB2_CONFIG_SDL2_USEMIXER})
|
||||||
|
|||||||
+139
-77
@@ -31,6 +31,10 @@
|
|||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||||
|
#include <poll.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define RPC_NO_WINDOWS_H
|
#define RPC_NO_WINDOWS_H
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@@ -201,10 +205,6 @@ static char returnWadPath[256];
|
|||||||
|
|
||||||
#include "../s_sound.h"
|
#include "../s_sound.h"
|
||||||
|
|
||||||
#ifdef MAC_ALERT
|
|
||||||
#include "macosx/mac_alert.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../d_main.h"
|
#include "../d_main.h"
|
||||||
|
|
||||||
#if !defined(NOMUMBLE) && defined(HAVE_MUMBLE)
|
#if !defined(NOMUMBLE) && defined(HAVE_MUMBLE)
|
||||||
@@ -726,13 +726,14 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
|
|||||||
|
|
||||||
JoySet->dev = NULL;
|
JoySet->dev = NULL;
|
||||||
JoySet->oldjoy = -1;
|
JoySet->oldjoy = -1;
|
||||||
|
#if (SDL_VERSION_ATLEAST(2,32,4))
|
||||||
JoySet->id = -1;
|
JoySet->id = -1;
|
||||||
JoySet->axises = JoySet->buttons = JoySet->hats = JoySet->balls = 0;
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief SDL info about joystick
|
/** \brief SDL info about joystick
|
||||||
*/
|
*/
|
||||||
SDLJoyInfo_t JoyInfo[MAXSPLITSCREENPLAYERS];
|
SDLJoyInfo_t JoyInfo[MAXSPLITSCREENPLAYERS] = {};
|
||||||
INT32 numcontrollers = 0;
|
INT32 numcontrollers = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -740,26 +741,26 @@ INT32 numcontrollers = 0;
|
|||||||
//
|
//
|
||||||
void I_JoyScale(void)
|
void I_JoyScale(void)
|
||||||
{
|
{
|
||||||
Joystick[0].bGamepadStyle = cv_joyscale[0].value==0;
|
Joystick[0].bGamepadStyle = cv_joyscale[0].value == 0;
|
||||||
JoyInfo[0].scale = Joystick[0].bGamepadStyle?1:cv_joyscale[0].value;
|
JoyInfo[0].scale = Joystick[0].bGamepadStyle ? 1 : cv_joyscale[0].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_JoyScale2(void)
|
void I_JoyScale2(void)
|
||||||
{
|
{
|
||||||
Joystick[1].bGamepadStyle = cv_joyscale[1].value==0;
|
Joystick[1].bGamepadStyle = cv_joyscale[1].value == 0;
|
||||||
JoyInfo[1].scale = Joystick[1].bGamepadStyle?1:cv_joyscale[1].value;
|
JoyInfo[1].scale = Joystick[1].bGamepadStyle ? 1 : cv_joyscale[1].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_JoyScale3(void)
|
void I_JoyScale3(void)
|
||||||
{
|
{
|
||||||
Joystick[2].bGamepadStyle = cv_joyscale[2].value==0;
|
Joystick[2].bGamepadStyle = cv_joyscale[2].value == 0;
|
||||||
JoyInfo[2].scale = Joystick[2].bGamepadStyle?1:cv_joyscale[2].value;
|
JoyInfo[2].scale = Joystick[2].bGamepadStyle ? 1 : cv_joyscale[2].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_JoyScale4(void)
|
void I_JoyScale4(void)
|
||||||
{
|
{
|
||||||
Joystick[3].bGamepadStyle = cv_joyscale[3].value==0;
|
Joystick[3].bGamepadStyle = cv_joyscale[3].value == 0;
|
||||||
JoyInfo[3].scale = Joystick[3].bGamepadStyle?1:cv_joyscale[3].value;
|
JoyInfo[3].scale = Joystick[3].bGamepadStyle ? 1 : cv_joyscale[3].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cheat to get the device index for a joystick handle
|
// Cheat to get the device index for a joystick handle
|
||||||
@@ -784,7 +785,11 @@ void I_UpdateJoystickDeviceIndex(UINT8 player)
|
|||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
if (JoyInfo[player].dev)
|
if (JoyInfo[player].dev)
|
||||||
{
|
{
|
||||||
|
#if (SDL_VERSION_ATLEAST(2,32,4))
|
||||||
cv_usejoystick[player].value = JoyInfo[player].id + 1;
|
cv_usejoystick[player].value = JoyInfo[player].id + 1;
|
||||||
|
#else
|
||||||
|
cv_usejoystick[player].value = I_GetJoystickDeviceIndex(JoyInfo[player].dev) + 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -886,13 +891,13 @@ static int joy_open(int playerIndex, int joyIndex)
|
|||||||
|
|
||||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Joystick subsystem not started\n"));
|
CONS_Printf("Joystick subsystem not started\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0)
|
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0)
|
||||||
{
|
{
|
||||||
CONS_Printf(M_GetText("Game Controller subsystem not started\n"));
|
CONS_Printf("Game Controller subsystem not started\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -903,7 +908,7 @@ static int joy_open(int playerIndex, int joyIndex)
|
|||||||
|
|
||||||
if (num_joy == 0)
|
if (num_joy == 0)
|
||||||
{
|
{
|
||||||
CONS_Printf("%s", M_GetText("Found no joysticks on this system\n"));
|
CONS_Printf("%s", "Found no joysticks on this system\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -926,38 +931,25 @@ static int joy_open(int playerIndex, int joyIndex)
|
|||||||
return SDL_CONTROLLER_AXIS_MAX;
|
return SDL_CONTROLLER_AXIS_MAX;
|
||||||
|
|
||||||
// Else, we're changing devices, so send neutral joy events
|
// Else, we're changing devices, so send neutral joy events
|
||||||
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device is changing; resetting events...\n");
|
CONS_Debug(DBG_GAMELOGIC, "Joystick %d device is changing; resetting events...\n", playerIndex+1);
|
||||||
I_ShutdownJoystick(playerIndex);
|
I_ShutdownJoystick(playerIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
JoyInfo[playerIndex].dev = newdev;
|
JoyInfo[playerIndex].dev = newdev;
|
||||||
JoyInfo[playerIndex].id = I_GetJoystickDeviceIndex(JoyInfo[playerIndex].dev);
|
|
||||||
|
|
||||||
if (JoyInfo[playerIndex].dev == NULL)
|
if (JoyInfo[playerIndex].dev == NULL)
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: Couldn't open device - %s\n"), SDL_GetError());
|
CONS_Debug(DBG_GAMELOGIC, "Joystick %d: Couldn't open device - %s\n", playerIndex+1, SDL_GetError());
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GameControllerName(JoyInfo[playerIndex].dev));
|
|
||||||
JoyInfo[playerIndex].axises = SDL_CONTROLLER_AXIS_MAX;
|
|
||||||
|
|
||||||
if (JoyInfo[playerIndex].axises > JOYAXISSET*2)
|
CONS_Debug(DBG_GAMELOGIC, "Joystick %d: %s\n", playerIndex+1, SDL_GameControllerName(JoyInfo[playerIndex].dev));
|
||||||
JoyInfo[playerIndex].axises = JOYAXISSET*2;
|
|
||||||
|
|
||||||
JoyInfo[playerIndex].buttons = SDL_CONTROLLER_BUTTON_MAX ; // dpad is 4 buttons
|
#if (SDL_VERSION_ATLEAST(2,32,4))
|
||||||
if (JoyInfo[playerIndex].buttons > JOYBUTTONS)
|
JoyInfo[playerIndex].id = I_GetJoystickDeviceIndex(JoyInfo[playerIndex].dev);
|
||||||
JoyInfo[playerIndex].buttons = JOYBUTTONS;
|
#endif
|
||||||
|
|
||||||
JoyInfo[playerIndex].hats = 4;
|
return SDL_CONTROLLER_AXIS_MAX;
|
||||||
if (JoyInfo[playerIndex].hats > JOYHATS)
|
|
||||||
JoyInfo[playerIndex].hats = JOYHATS;
|
|
||||||
|
|
||||||
JoyInfo[playerIndex].balls = 0;
|
|
||||||
|
|
||||||
return JoyInfo[playerIndex].axises;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1001,8 +993,9 @@ void I_InitJoystick(UINT8 index)
|
|||||||
|
|
||||||
JoyInfo[index].dev = NULL;
|
JoyInfo[index].dev = NULL;
|
||||||
JoyInfo[index].oldjoy = -1;
|
JoyInfo[index].oldjoy = -1;
|
||||||
|
#if (SDL_VERSION_ATLEAST(2,32,4))
|
||||||
JoyInfo[index].id = -1;
|
JoyInfo[index].id = -1;
|
||||||
JoyInfo[index].axises = JoyInfo[index].buttons = JoyInfo[index].hats = JoyInfo[index].balls = 0;
|
#endif
|
||||||
|
|
||||||
if (cv_usejoystick[index].value)
|
if (cv_usejoystick[index].value)
|
||||||
newcontroller = SDL_GameControllerOpen(cv_usejoystick[index].value-1);
|
newcontroller = SDL_GameControllerOpen(cv_usejoystick[index].value-1);
|
||||||
@@ -1016,17 +1009,27 @@ void I_InitJoystick(UINT8 index)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (SDL_VERSION_ATLEAST(2,32,4))
|
||||||
JoyInfo[index].id = I_GetJoystickDeviceIndex(JoyInfo[index].dev);
|
JoyInfo[index].id = I_GetJoystickDeviceIndex(JoyInfo[index].dev);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (newcontroller && i < MAXSPLITSCREENPLAYERS) // don't override an active device
|
if (newcontroller && i < MAXSPLITSCREENPLAYERS) // don't override an active device
|
||||||
{
|
{
|
||||||
|
#if (SDL_VERSION_ATLEAST(2,32,4))
|
||||||
cv_usejoystick[index].value = JoyInfo[index].id + 1;
|
cv_usejoystick[index].value = JoyInfo[index].id + 1;
|
||||||
|
#else
|
||||||
|
cv_usejoystick[index].value = I_GetJoystickDeviceIndex(JoyInfo[index].dev) + 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (newcontroller && joy_open(index, cv_usejoystick[index].value) != -1)
|
else if (newcontroller && joy_open(index, cv_usejoystick[index].value) != -1)
|
||||||
{
|
{
|
||||||
|
#if (SDL_VERSION_ATLEAST(2,32,4))
|
||||||
|
JoyInfo[index].oldjoy = JoyInfo[index].id + 1;
|
||||||
|
#else
|
||||||
// SDL's device indexes are unstable, so cv_usejoystick may not match
|
// SDL's device indexes are unstable, so cv_usejoystick may not match
|
||||||
// the actual device index. So let's cheat a bit and find the device's current index.
|
// the actual device index. So let's cheat a bit and find the device's current index.
|
||||||
JoyInfo[index].oldjoy = JoyInfo[index].id + 1;
|
JoyInfo[index].oldjoy = I_GetJoystickDeviceIndex(JoyInfo[index].dev) + 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1386,7 +1389,7 @@ void I_SleepDuration(precise_t duration)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg);
|
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg, char *signal_ttl);
|
||||||
|
|
||||||
#ifdef HAVE_LIBBACKTRACE
|
#ifdef HAVE_LIBBACKTRACE
|
||||||
#include <backtrace.h>
|
#include <backtrace.h>
|
||||||
@@ -1482,6 +1485,7 @@ static void bt_error_cb(void *data, const char *msg, int errnum)
|
|||||||
static void write_backtrace(bt_crash_reason_t reason)
|
static void write_backtrace(bt_crash_reason_t reason)
|
||||||
{
|
{
|
||||||
char sig_msg[512];
|
char sig_msg[512];
|
||||||
|
char sig_name[128];
|
||||||
const char *filename = va("%s" PATHSEP CRASH_LOGFILE_NAME, srb2home);
|
const char *filename = va("%s" PATHSEP CRASH_LOGFILE_NAME, srb2home);
|
||||||
FILE *out = fopen(filename, "a+");
|
FILE *out = fopen(filename, "a+");
|
||||||
|
|
||||||
@@ -1538,8 +1542,8 @@ static void write_backtrace(bt_crash_reason_t reason)
|
|||||||
switch (reason.type)
|
switch (reason.type)
|
||||||
{
|
{
|
||||||
case BTCRASH_SIGNAL:
|
case BTCRASH_SIGNAL:
|
||||||
I_PrintSignal(reason.value.signal, false, sig_msg);
|
I_PrintSignal(reason.value.signal, false, sig_msg, sig_name);
|
||||||
fprintf(out, "%s", sig_msg);
|
fprintf(out, "%s - %s", sig_name, sig_msg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BTCRASH_ERRORMSG:
|
case BTCRASH_ERRORMSG:
|
||||||
@@ -1575,42 +1579,49 @@ static std::thread::id g_main_thread_id;
|
|||||||
|
|
||||||
boolean g_in_exiting_signal_handler = false;
|
boolean g_in_exiting_signal_handler = false;
|
||||||
|
|
||||||
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg)
|
static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_msg, char *signal_name)
|
||||||
{
|
{
|
||||||
const char *sigmsg;
|
const char *sigmsg, *signame;
|
||||||
|
|
||||||
switch (signal_num)
|
switch (signal_num)
|
||||||
{
|
{
|
||||||
#ifdef SIGINT
|
#ifdef SIGINT
|
||||||
case SIGINT:
|
case SIGINT:
|
||||||
sigmsg = ("SIGINT - SRB2Kart-Saturn was interrupted prematurely by the user.");
|
sigmsg = ("SRB2Kart-Saturn was interrupted prematurely by the user.");
|
||||||
|
signame = "SIGINT";
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case SIGILL: // illegal instruction - invalid function image
|
case SIGILL: // illegal instruction - invalid function image
|
||||||
sigmsg = ("SIGILL - SRB2Kart-Saturn has attempted to execute an illegal instruction and needs to close.");
|
sigmsg = ("SRB2Kart-Saturn has attempted to execute an illegal instruction and needs to close.");
|
||||||
|
signame = "SIGILL";
|
||||||
break;
|
break;
|
||||||
case SIGFPE: // mathematical exception
|
case SIGFPE: // mathematical exception
|
||||||
sigmsg = ("SIGFPE - SRB2Kart-Saturn has encountered a mathematical exception and needs to close.");
|
sigmsg = ("SRB2Kart-Saturn has encountered a mathematical exception and needs to close.");
|
||||||
|
signame = "SIGFPE";
|
||||||
break;
|
break;
|
||||||
case SIGSEGV: // segment violation
|
case SIGSEGV: // segment violation
|
||||||
sigmsg = ("SIGSEGV - SRB2Kart-Saturn has attempted to access a memory location that it shouldn't and needs to close.");
|
sigmsg = ("SRB2Kart-Saturn has attempted to access a memory location that it shouldn't and needs to close.");
|
||||||
|
signame = "SIGSEGV";
|
||||||
break;
|
break;
|
||||||
#ifdef SIGTERM
|
#ifdef SIGTERM
|
||||||
case SIGTERM: // Software termination signal from kill
|
case SIGTERM: // Software termination signal from kill
|
||||||
sigmsg = ("SIGTERM - SRB2Kart-Saturn was terminated by a kill signal.");
|
sigmsg = ("SRB2Kart-Saturn was terminated by a kill signal.");
|
||||||
|
signame = "SIGTERM";
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SIGBREAK
|
#ifdef SIGBREAK
|
||||||
case SIGBREAK: // Ctrl-Break sequence
|
case SIGBREAK: // Ctrl-Break sequence
|
||||||
sigmsg =("SIGBREAK - SRB2Kart-Saturn was terminated by a Ctrl-Break sequence.");
|
sigmsg =("SIGBREAK - SRB2Kart-Saturn was terminated by a Ctrl-Break sequence.");
|
||||||
|
signame = "SIGBREAK";
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case SIGABRT: // abnormal termination triggered by abort call
|
case SIGABRT: // abnormal termination triggered by abort call
|
||||||
sigmsg = ("SIGABRT - SRB2Kart-Saturn was terminated by an abort signal.");
|
sigmsg = ("SRB2Kart-Saturn was terminated by an abort signal.");
|
||||||
|
signame = "SIGABRT";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(signal_msg, "Signal number %d", signal_num);
|
sigmsg = "SRB2Kart-Saturn was terminated by an unknown signal.";
|
||||||
sigmsg = (core_dumped ? "Unknown signal" : signal_msg);
|
signame = core_dumped ? "Unknown signal" : va("Signal number %d", signal_num);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1625,18 +1636,80 @@ static void I_PrintSignal(INT32 signal_num, boolean core_dumped, char *signal_ms
|
|||||||
{
|
{
|
||||||
sprintf(signal_msg, "%s", sigmsg);
|
sprintf(signal_msg, "%s", sigmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sprintf(signal_name, "%s", signame);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int I_OpenURL(const char *url)
|
||||||
|
{
|
||||||
|
#if SDL_VERSION_ATLEAST(2,0,14)
|
||||||
|
return SDL_OpenURL(va("%s", url));
|
||||||
|
#else
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void I_ShowErrorBox(const char *title, const char *msg)
|
||||||
|
{
|
||||||
|
if (M_CheckParm("-dedicated"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
const char *reportmsg = "\n\n\nTo help us figure out the cause, please report the issue to our github page with " CRASH_LOGFILE_NAME " attached.\n\nSorry for the inconvenience!";
|
||||||
|
|
||||||
|
const SDL_MessageBoxButtonData buttons[] = {
|
||||||
|
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 0, "OK" },
|
||||||
|
{ 0, 1, "Report Issue" },
|
||||||
|
};
|
||||||
|
|
||||||
|
const SDL_MessageBoxData messageboxdata = {
|
||||||
|
SDL_MESSAGEBOX_ERROR, /* .flags */
|
||||||
|
NULL, /* .window */
|
||||||
|
title, /* .title */
|
||||||
|
va("%s %s", msg, reportmsg), /* .message */
|
||||||
|
SDL_arraysize(buttons), /* .numbuttons */
|
||||||
|
buttons, /* .buttons */
|
||||||
|
NULL /* .colorScheme */
|
||||||
|
};
|
||||||
|
|
||||||
|
int buttonid;
|
||||||
|
|
||||||
|
SDL_ShowMessageBox(&messageboxdata, &buttonid);
|
||||||
|
|
||||||
|
if (buttonid == 1)
|
||||||
|
I_OpenURL("https://github.com/Indev450/SRB2Kart-Saturn/issues");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void I_ShowSimpleErrorBox(const char *title, char *msg)
|
||||||
|
{
|
||||||
|
if (M_CheckParm("-dedicated"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Implement message box with SDL_ShowSimpleMessageBox,
|
||||||
|
// which should fail gracefully if it can't put a message box up
|
||||||
|
// on the target system
|
||||||
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, msg, NULL);
|
||||||
|
// Note that SDL_ShowSimpleMessageBox does *not* require SDL to be
|
||||||
|
// initialized at the time, so calling it after SDL_Quit() is
|
||||||
|
// perfectly okay! In addition, we do this on purpose so the
|
||||||
|
// fullscreen window is closed before displaying the error message
|
||||||
|
// in case the fullscreen window blocks it for some absurd reason.
|
||||||
}
|
}
|
||||||
|
|
||||||
static void I_ReportSignal(int num, int coredumped)
|
static void I_ReportSignal(int num, int coredumped)
|
||||||
{
|
{
|
||||||
char sigmsg[512];
|
char sigmsg[512];
|
||||||
|
char signame[128];
|
||||||
|
char sigttl[512] = "Process killed by signal: ";
|
||||||
|
|
||||||
I_PrintSignal(num, coredumped, sigmsg);
|
I_PrintSignal(num, coredumped, sigmsg, signame);
|
||||||
|
|
||||||
size_t len = strlen(sigmsg);
|
size_t len = strlen(sigmsg);
|
||||||
snprintf(sigmsg + len, sizeof(sigmsg) - len, "\n\nCrash report has been saved into %s", CRASH_LOGFILE_NAME);
|
snprintf(sigmsg + len, sizeof(sigmsg) - len, "\n\nCrash report has been saved into %s", CRASH_LOGFILE_NAME);
|
||||||
I_OutputMsg("\nProcess killed by signal: %s\n\n", sigmsg);
|
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Process killed by signal", sigmsg, NULL);
|
strcat(sigttl, signame);
|
||||||
|
I_OutputMsg("\n%s\n\n", sigttl);
|
||||||
|
//I_ShowSimpleErrorBox(sigttl, sigmsg);
|
||||||
|
I_ShowErrorBox(sigttl, sigmsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NEWSIGNALHANDLER
|
#ifndef NEWSIGNALHANDLER
|
||||||
@@ -1744,10 +1817,7 @@ FUNCNORETURN static ATTRNORETURN void newsignalhandler_Warn(const char *pr)
|
|||||||
);
|
);
|
||||||
|
|
||||||
I_OutputMsg("%s\n", text);
|
I_OutputMsg("%s\n", text);
|
||||||
|
I_ShowSimpleErrorBox("Startup error", text);
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
|
||||||
"Startup error",
|
|
||||||
text, NULL);
|
|
||||||
|
|
||||||
I_ShutdownConsole();
|
I_ShutdownConsole();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
@@ -1826,8 +1896,8 @@ INT32 I_StartupSystem(void)
|
|||||||
I_Fork();
|
I_Fork();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
I_start_threads();
|
I_StartThreads();
|
||||||
I_AddExitFunc(I_stop_threads);
|
I_AddExitFunc(I_StopThreads);
|
||||||
I_ThreadPoolInit();
|
I_ThreadPoolInit();
|
||||||
I_AddExitFunc(I_ThreadPoolShutdown);
|
I_AddExitFunc(I_ThreadPoolShutdown);
|
||||||
#endif
|
#endif
|
||||||
@@ -1909,6 +1979,7 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
|
|||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char buffer[8192];
|
char buffer[8192];
|
||||||
|
const char *sigttl = "";
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
if (std::this_thread::get_id() != g_main_thread_id)
|
if (std::this_thread::get_id() != g_main_thread_id)
|
||||||
@@ -1945,12 +2016,9 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
|
|||||||
va_start(argptr, error);
|
va_start(argptr, error);
|
||||||
vsnprintf(buffer, 8192, error, argptr);
|
vsnprintf(buffer, 8192, error, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
// Implement message box with SDL_ShowSimpleMessageBox,
|
|
||||||
// which should fail gracefully if it can't put a message box up
|
sigttl = "SRB2Kart " VERSIONSTRING " Recursive Error";
|
||||||
// on the target system
|
I_ShowSimpleErrorBox(sigttl, buffer);
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
|
|
||||||
"SRB2Kart " VERSIONSTRING " Recursive Error",
|
|
||||||
buffer, NULL);
|
|
||||||
|
|
||||||
W_Shutdown();
|
W_Shutdown();
|
||||||
exit(-1); // recursive errors detected
|
exit(-1); // recursive errors detected
|
||||||
@@ -1990,15 +2058,9 @@ FUNCIERROR void ATTRNORETURN I_Error(const char *error, ...)
|
|||||||
I_ShutdownSystem();
|
I_ShutdownSystem();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
||||||
// Implement message box with SDL_ShowSimpleMessageBox,
|
sigttl = "SRB2Kart " VERSIONSTRING " Error";
|
||||||
// which should fail gracefully if it can't put a message box up
|
//I_ShowSimpleErrorBox(sigttl, buffer);
|
||||||
// on the target system
|
I_ShowErrorBox(sigttl, buffer);
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "SRB2Kart " VERSIONSTRING " Error", buffer, NULL);
|
|
||||||
// Note that SDL_ShowSimpleMessageBox does *not* require SDL to be
|
|
||||||
// initialized at the time, so calling it after SDL_Quit() is
|
|
||||||
// perfectly okay! In addition, we do this on purpose so the
|
|
||||||
// fullscreen window is closed before displaying the error message
|
|
||||||
// in case the fullscreen window blocks it for some absurd reason.
|
|
||||||
|
|
||||||
W_Shutdown();
|
W_Shutdown();
|
||||||
|
|
||||||
@@ -2424,7 +2486,7 @@ static const char *locateWad(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *I_LocateWad(void)
|
extern "C" const char *I_LocateWad(void)
|
||||||
{
|
{
|
||||||
const char *waddir = NULL;
|
const char *waddir = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -1,356 +0,0 @@
|
|||||||
// SONIC ROBO BLAST 2 KART
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Copyright (C) 2020 by James R.
|
|
||||||
//
|
|
||||||
// This program is free software distributed under the
|
|
||||||
// terms of the GNU General Public License, version 2.
|
|
||||||
// See the 'LICENSE' file for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file i_threads.c
|
|
||||||
/// \brief Multithreading abstraction
|
|
||||||
|
|
||||||
#include "../doomdef.h"
|
|
||||||
#include "../i_threads.h"
|
|
||||||
|
|
||||||
#include <SDL.h>
|
|
||||||
|
|
||||||
typedef void * (*Create_fn)(void);
|
|
||||||
|
|
||||||
struct Link;
|
|
||||||
struct Thread;
|
|
||||||
|
|
||||||
typedef struct Link * Link;
|
|
||||||
typedef struct Thread * Thread;
|
|
||||||
|
|
||||||
struct Link
|
|
||||||
{
|
|
||||||
void * data;
|
|
||||||
Link next;
|
|
||||||
Link prev;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Thread
|
|
||||||
{
|
|
||||||
I_thread_fn entry;
|
|
||||||
void * userdata;
|
|
||||||
|
|
||||||
SDL_Thread * thread;
|
|
||||||
};
|
|
||||||
|
|
||||||
static Link i_thread_pool;
|
|
||||||
static Link i_mutex_pool;
|
|
||||||
static Link i_cond_pool;
|
|
||||||
|
|
||||||
static I_mutex i_thread_pool_mutex;
|
|
||||||
static I_mutex i_mutex_pool_mutex;
|
|
||||||
static I_mutex i_cond_pool_mutex;
|
|
||||||
|
|
||||||
static SDL_atomic_t i_threads_running = {1};
|
|
||||||
|
|
||||||
static Link
|
|
||||||
Insert_link (
|
|
||||||
Link * head,
|
|
||||||
Link link
|
|
||||||
){
|
|
||||||
link->prev = NULL;
|
|
||||||
link->next = (*head);
|
|
||||||
if ((*head))
|
|
||||||
(*head)->prev = link;
|
|
||||||
(*head) = link;
|
|
||||||
return link;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
Free_link (
|
|
||||||
Link * head,
|
|
||||||
Link link
|
|
||||||
){
|
|
||||||
if (link->prev)
|
|
||||||
link->prev->next = link->next;
|
|
||||||
else
|
|
||||||
(*head) = link->next;
|
|
||||||
|
|
||||||
if (link->next)
|
|
||||||
link->next->prev = link->prev;
|
|
||||||
|
|
||||||
free(link->data);
|
|
||||||
free(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Link
|
|
||||||
New_link (void *data)
|
|
||||||
{
|
|
||||||
Link link;
|
|
||||||
|
|
||||||
link = malloc(sizeof *link);
|
|
||||||
|
|
||||||
if (! link)
|
|
||||||
abort();
|
|
||||||
|
|
||||||
link->data = data;
|
|
||||||
|
|
||||||
return link;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
|
||||||
Identity (
|
|
||||||
Link * pool_anchor,
|
|
||||||
I_mutex pool_mutex,
|
|
||||||
|
|
||||||
void ** anchor,
|
|
||||||
|
|
||||||
Create_fn create_fn
|
|
||||||
){
|
|
||||||
void * id;
|
|
||||||
|
|
||||||
id = SDL_AtomicGetPtr(anchor);
|
|
||||||
|
|
||||||
if (! id)
|
|
||||||
{
|
|
||||||
I_lock_mutex(&pool_mutex);
|
|
||||||
{
|
|
||||||
id = SDL_AtomicGetPtr(anchor);
|
|
||||||
|
|
||||||
if (! id)
|
|
||||||
{
|
|
||||||
id = (*create_fn)();
|
|
||||||
|
|
||||||
if (! id)
|
|
||||||
abort();
|
|
||||||
|
|
||||||
Insert_link(pool_anchor, New_link(id));
|
|
||||||
|
|
||||||
SDL_AtomicSetPtr(anchor, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
I_unlock_mutex(pool_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
Worker (
|
|
||||||
Link link
|
|
||||||
){
|
|
||||||
Thread th;
|
|
||||||
|
|
||||||
th = link->data;
|
|
||||||
|
|
||||||
(*th->entry)(th->userdata);
|
|
||||||
|
|
||||||
if (SDL_AtomicGet(&i_threads_running))
|
|
||||||
{
|
|
||||||
I_lock_mutex(&i_thread_pool_mutex);
|
|
||||||
{
|
|
||||||
if (SDL_AtomicGet(&i_threads_running))
|
|
||||||
{
|
|
||||||
SDL_DetachThread(th->thread);
|
|
||||||
Free_link(&i_thread_pool, link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
I_unlock_mutex(i_thread_pool_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
I_spawn_thread (
|
|
||||||
const char * name,
|
|
||||||
I_thread_fn entry,
|
|
||||||
void * userdata
|
|
||||||
){
|
|
||||||
Link link;
|
|
||||||
Thread th;
|
|
||||||
|
|
||||||
th = malloc(sizeof *th);
|
|
||||||
|
|
||||||
if (! th)
|
|
||||||
abort();/* this is pretty GNU of me */
|
|
||||||
|
|
||||||
th->entry = entry;
|
|
||||||
th->userdata = userdata;
|
|
||||||
|
|
||||||
I_lock_mutex(&i_thread_pool_mutex);
|
|
||||||
{
|
|
||||||
link = Insert_link(&i_thread_pool, New_link(th));
|
|
||||||
|
|
||||||
if (SDL_AtomicGet(&i_threads_running))
|
|
||||||
{
|
|
||||||
th->thread = SDL_CreateThread(
|
|
||||||
(SDL_ThreadFunction)Worker,
|
|
||||||
name,
|
|
||||||
link
|
|
||||||
);
|
|
||||||
|
|
||||||
if (! th->thread)
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
I_unlock_mutex(i_thread_pool_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
I_thread_is_stopped (void)
|
|
||||||
{
|
|
||||||
return ( ! SDL_AtomicGet(&i_threads_running) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
I_start_threads (void)
|
|
||||||
{
|
|
||||||
i_thread_pool_mutex = SDL_CreateMutex();
|
|
||||||
i_mutex_pool_mutex = SDL_CreateMutex();
|
|
||||||
i_cond_pool_mutex = SDL_CreateMutex();
|
|
||||||
|
|
||||||
if (!(
|
|
||||||
i_thread_pool_mutex &&
|
|
||||||
i_mutex_pool_mutex &&
|
|
||||||
i_cond_pool_mutex
|
|
||||||
)){
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
I_stop_threads (void)
|
|
||||||
{
|
|
||||||
Link link;
|
|
||||||
Link next;
|
|
||||||
|
|
||||||
Thread th;
|
|
||||||
SDL_mutex * mutex;
|
|
||||||
SDL_cond * cond;
|
|
||||||
|
|
||||||
if (i_threads_running.value)
|
|
||||||
{
|
|
||||||
/* rely on the good will of thread-san */
|
|
||||||
SDL_AtomicSet(&i_threads_running, 0);
|
|
||||||
|
|
||||||
I_lock_mutex(&i_thread_pool_mutex);
|
|
||||||
{
|
|
||||||
for (
|
|
||||||
link = i_thread_pool;
|
|
||||||
link;
|
|
||||||
link = next
|
|
||||||
){
|
|
||||||
next = link->next;
|
|
||||||
th = link->data;
|
|
||||||
|
|
||||||
SDL_WaitThread(th->thread, NULL);
|
|
||||||
|
|
||||||
free(th);
|
|
||||||
free(link);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
I_unlock_mutex(i_thread_pool_mutex);
|
|
||||||
|
|
||||||
for (
|
|
||||||
link = i_mutex_pool;
|
|
||||||
link;
|
|
||||||
link = next
|
|
||||||
){
|
|
||||||
next = link->next;
|
|
||||||
mutex = link->data;
|
|
||||||
|
|
||||||
SDL_DestroyMutex(mutex);
|
|
||||||
|
|
||||||
free(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (
|
|
||||||
link = i_cond_pool;
|
|
||||||
link;
|
|
||||||
link = next
|
|
||||||
){
|
|
||||||
next = link->next;
|
|
||||||
cond = link->data;
|
|
||||||
|
|
||||||
SDL_DestroyCond(cond);
|
|
||||||
|
|
||||||
free(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_DestroyMutex(i_thread_pool_mutex);
|
|
||||||
SDL_DestroyMutex(i_mutex_pool_mutex);
|
|
||||||
SDL_DestroyMutex(i_cond_pool_mutex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
I_lock_mutex (
|
|
||||||
I_mutex * anchor
|
|
||||||
){
|
|
||||||
SDL_mutex * mutex;
|
|
||||||
|
|
||||||
mutex = Identity(
|
|
||||||
&i_mutex_pool,
|
|
||||||
i_mutex_pool_mutex,
|
|
||||||
anchor,
|
|
||||||
(Create_fn)SDL_CreateMutex
|
|
||||||
);
|
|
||||||
|
|
||||||
if (SDL_LockMutex(mutex) == -1)
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
I_unlock_mutex (
|
|
||||||
I_mutex id
|
|
||||||
){
|
|
||||||
if (SDL_UnlockMutex(id) == -1)
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
I_hold_cond (
|
|
||||||
I_cond * cond_anchor,
|
|
||||||
I_mutex mutex_id
|
|
||||||
){
|
|
||||||
SDL_cond * cond;
|
|
||||||
|
|
||||||
cond = Identity(
|
|
||||||
&i_cond_pool,
|
|
||||||
i_cond_pool_mutex,
|
|
||||||
cond_anchor,
|
|
||||||
(Create_fn)SDL_CreateCond
|
|
||||||
);
|
|
||||||
|
|
||||||
if (SDL_CondWait(cond, mutex_id) == -1)
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
I_wake_one_cond (
|
|
||||||
I_cond * anchor
|
|
||||||
){
|
|
||||||
SDL_cond * cond;
|
|
||||||
|
|
||||||
cond = Identity(
|
|
||||||
&i_cond_pool,
|
|
||||||
i_cond_pool_mutex,
|
|
||||||
anchor,
|
|
||||||
(Create_fn)SDL_CreateCond
|
|
||||||
);
|
|
||||||
|
|
||||||
if (SDL_CondSignal(cond) == -1)
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
I_wake_all_cond (
|
|
||||||
I_cond * anchor
|
|
||||||
){
|
|
||||||
SDL_cond * cond;
|
|
||||||
|
|
||||||
cond = Identity(
|
|
||||||
&i_cond_pool,
|
|
||||||
i_cond_pool_mutex,
|
|
||||||
anchor,
|
|
||||||
(Create_fn)SDL_CreateCond
|
|
||||||
);
|
|
||||||
|
|
||||||
if (SDL_CondBroadcast(cond) == -1)
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
+13
-1
@@ -467,7 +467,7 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
raxis = JoyInfo[pid].scale!=1?((raxis/JoyInfo[pid].scale)*JoyInfo[pid].scale):raxis;
|
raxis = JoyInfo[pid].scale != 1 ? ((raxis/JoyInfo[pid].scale)*JoyInfo[pid].scale) : raxis;
|
||||||
|
|
||||||
#ifdef SDL_JDEADZONE
|
#ifdef SDL_JDEADZONE
|
||||||
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
if (-SDL_JDEADZONE <= raxis && raxis <= SDL_JDEADZONE)
|
||||||
@@ -784,7 +784,11 @@ static void Impl_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt)
|
|||||||
// Determine the Joystick IDs for each current open joystick
|
// Determine the Joystick IDs for each current open joystick
|
||||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
#if (SDL_VERSION_ATLEAST(2,32,4))
|
||||||
if (evt.which == JoyInfo[i].id)
|
if (evt.which == JoyInfo[i].id)
|
||||||
|
#else
|
||||||
|
if (evt.which == SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev)))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
event.type = ev_joystick + i;
|
event.type = ev_joystick + i;
|
||||||
break;
|
break;
|
||||||
@@ -844,7 +848,11 @@ static void Impl_HandleControllerHatEvent(SDL_ControllerButtonEvent evt, Uint32
|
|||||||
// Determine the Joystick IDs for each current open joystick
|
// Determine the Joystick IDs for each current open joystick
|
||||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
#if (SDL_VERSION_ATLEAST(2,32,4))
|
||||||
if (evt.which == JoyInfo[i].id)
|
if (evt.which == JoyInfo[i].id)
|
||||||
|
#else
|
||||||
|
if (evt.which == SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev)))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
event.data1 = hat_buttons_base[i];
|
event.data1 = hat_buttons_base[i];
|
||||||
break;
|
break;
|
||||||
@@ -906,7 +914,11 @@ static void Impl_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint
|
|||||||
// Determine the Joystick IDs for each current open joystick
|
// Determine the Joystick IDs for each current open joystick
|
||||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||||
{
|
{
|
||||||
|
#if (SDL_VERSION_ATLEAST(2,32,4))
|
||||||
if (evt.which == JoyInfo[i].id)
|
if (evt.which == JoyInfo[i].id)
|
||||||
|
#else
|
||||||
|
if (evt.which == SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(JoyInfo[i].dev)))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
event.data1 = buttons_base[i];
|
event.data1 = buttons_base[i];
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -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,11 @@
|
|||||||
#ifndef __MAC_RESOURCES_H__
|
#ifndef __MAC_RESOURCES_H__
|
||||||
#define __MAC_RESOURCES_H__
|
#define __MAC_RESOURCES_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
void OSX_GetResourcesPath(char * buffer);
|
void OSX_GetResourcesPath(char * buffer);
|
||||||
#endif
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
@@ -1107,7 +1107,7 @@ UINT32 I_GetSongPosition(void)
|
|||||||
|
|
||||||
void I_UpdateSongLagThreshold(void)
|
void I_UpdateSongLagThreshold(void)
|
||||||
{
|
{
|
||||||
stutter_threshold = cv_music_resync_powerups_only.value ? 0 : (cv_music_resync_threshold.value/1000.0*(4*44100));
|
stutter_threshold = (UINT32)(cv_music_resync_powerups_only.value ? 0 : (cv_music_resync_threshold.value/1000.0*(4*44100)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ------------------------
|
/// ------------------------
|
||||||
|
|||||||
+8
-4
@@ -23,6 +23,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "SDL_version.h"
|
||||||
|
|
||||||
#include "../m_fixed.h"
|
#include "../m_fixed.h"
|
||||||
|
|
||||||
// SDL2 stub macro
|
// SDL2 stub macro
|
||||||
@@ -39,20 +41,22 @@ typedef struct SDLJoyInfo_s
|
|||||||
{
|
{
|
||||||
/// Controller handle
|
/// Controller handle
|
||||||
SDL_GameController *dev;
|
SDL_GameController *dev;
|
||||||
|
#if (SDL_VERSION_ATLEAST(2,32,4))
|
||||||
/// Controller index
|
/// Controller index
|
||||||
INT32 id;
|
INT32 id;
|
||||||
|
#endif
|
||||||
/// number of old joystick
|
/// number of old joystick
|
||||||
int oldjoy;
|
int oldjoy;
|
||||||
/// number of axies
|
/// number of axies
|
||||||
int axises;
|
//int axises;
|
||||||
/// scale of axises
|
/// scale of axises
|
||||||
INT32 scale;
|
INT32 scale;
|
||||||
/// number of buttons
|
/// number of buttons
|
||||||
int buttons;
|
//int buttons;
|
||||||
/// number of hats
|
/// number of hats
|
||||||
int hats;
|
//int hats;
|
||||||
/// number of balls
|
/// number of balls
|
||||||
int balls;
|
//int balls;
|
||||||
} SDLJoyInfo_t;
|
} SDLJoyInfo_t;
|
||||||
|
|
||||||
/** \brief SDL info about controller 1
|
/** \brief SDL info about controller 1
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
trycmp (char **pp, char *cp,
|
trycmp (char **pp, char *cp,
|
||||||
const char *q, size_t qn)
|
const char *q, size_t qn)
|
||||||
|
|||||||
+16
-11
@@ -465,7 +465,7 @@ void V_CubeApply(RGBA_t *input)
|
|||||||
if (!Cubeapply)
|
if (!Cubeapply)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
linear = ((*input).s.red/255.0);
|
linear = ((*input).s.red/255.0f);
|
||||||
#define dolerp(e1, e2) ((1 - linear)*e1 + linear*e2)
|
#define dolerp(e1, e2) ((1 - linear)*e1 + linear*e2)
|
||||||
for (q = 0; q < 3; q++)
|
for (q = 0; q < 3; q++)
|
||||||
{
|
{
|
||||||
@@ -475,21 +475,21 @@ void V_CubeApply(RGBA_t *input)
|
|||||||
working[3][q] = dolerp(Cubepal[0][1][1][q], Cubepal[1][1][1][q]);
|
working[3][q] = dolerp(Cubepal[0][1][1][q], Cubepal[1][1][1][q]);
|
||||||
}
|
}
|
||||||
|
|
||||||
linear = ((*input).s.green/255.0);
|
linear = ((*input).s.green/255.0f);
|
||||||
for (q = 0; q < 3; q++)
|
for (q = 0; q < 3; q++)
|
||||||
{
|
{
|
||||||
working[0][q] = dolerp(working[0][q], working[1][q]);
|
working[0][q] = dolerp(working[0][q], working[1][q]);
|
||||||
working[1][q] = dolerp(working[2][q], working[3][q]);
|
working[1][q] = dolerp(working[2][q], working[3][q]);
|
||||||
}
|
}
|
||||||
|
|
||||||
linear = ((*input).s.blue/255.0);
|
linear = ((*input).s.blue/255.0f);
|
||||||
for (q = 0; q < 3; q++)
|
for (q = 0; q < 3; q++)
|
||||||
{
|
{
|
||||||
working[0][q] = 255*dolerp(working[0][q], working[1][q]);
|
working[0][q] = 255*dolerp(working[0][q], working[1][q]);
|
||||||
if (working[0][q] > 255.0f)
|
if (working[0][q] > 255.0f)
|
||||||
working[0][q] = 255.0f;
|
working[0][q] = 255.0f;
|
||||||
else if (working[0][q] < 0.0f)
|
else if (working[0][q] < 0.0f)
|
||||||
working[0][q] = 0.0;
|
working[0][q] = 0.0f;
|
||||||
}
|
}
|
||||||
#undef dolerp
|
#undef dolerp
|
||||||
|
|
||||||
@@ -1742,6 +1742,7 @@ void V_DrawHorizontallyScaledFullScreenPatch(patch_t *patch)
|
|||||||
void V_DrawVhsEffect(boolean rewind)
|
void V_DrawVhsEffect(boolean rewind)
|
||||||
{
|
{
|
||||||
fixed_t uby, dby;
|
fixed_t uby, dby;
|
||||||
|
// upbary is the bar going from top to bottom for some reason
|
||||||
static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT;
|
static fixed_t upbary = 100*FRACUNIT, downbary = 150*FRACUNIT;
|
||||||
|
|
||||||
UINT8 barsize, updistort, downdistort;
|
UINT8 barsize, updistort, downdistort;
|
||||||
@@ -1759,20 +1760,24 @@ void V_DrawVhsEffect(boolean rewind)
|
|||||||
if (cv_reducevfx.value)
|
if (cv_reducevfx.value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
barsize = vid.dup << 5;
|
barsize = vid.udup << 5;
|
||||||
updistort = vid.dup << (rewind ? 5 : 3);
|
updistort = vid.udup << (rewind ? 5 : 3);
|
||||||
downdistort = updistort >> 1;
|
downdistort = updistort >> 1;
|
||||||
|
|
||||||
if (rewind)
|
if (rewind)
|
||||||
V_DrawVhsEffect(false); // experimentation
|
V_DrawVhsEffect(false); // experimentation
|
||||||
|
|
||||||
upbary -= renderdeltatics * (vid.dup * (rewind ? 3 : 1.8f));
|
upbary -= renderdeltatics * (fixed_t)(vid.udup * (rewind ? 3 : 1.8f));
|
||||||
downbary += renderdeltatics * (vid.dup * (rewind ? 2 : 1));
|
downbary += renderdeltatics * (vid.udup * (rewind ? 2 : 1));
|
||||||
|
|
||||||
if (upbary < -barsize*FRACUNIT)
|
if (upbary < -barsize*FRACUNIT)
|
||||||
upbary = vid.height << FRACBITS;
|
upbary = vid.height << FRACBITS;
|
||||||
|
if (upbary > vid.height << FRACBITS)
|
||||||
|
upbary = -barsize*FRACUNIT;
|
||||||
if (downbary > vid.height << FRACBITS)
|
if (downbary > vid.height << FRACBITS)
|
||||||
downbary = -barsize*FRACUNIT;
|
downbary = -barsize*FRACUNIT;
|
||||||
|
if (downbary < -barsize*FRACUNIT)
|
||||||
|
downbary = vid.height << FRACBITS;
|
||||||
|
|
||||||
uby = upbary >> FRACBITS;
|
uby = upbary >> FRACBITS;
|
||||||
dby = downbary >> FRACBITS;
|
dby = downbary >> FRACBITS;
|
||||||
@@ -3711,9 +3716,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
|||||||
// Make sure table is built
|
// Make sure table is built
|
||||||
if (heatshifter == NULL || lastheight != viewheight)
|
if (heatshifter == NULL || lastheight != viewheight)
|
||||||
{
|
{
|
||||||
if (heatshifter)
|
Z_Free(heatshifter);
|
||||||
Z_Free(heatshifter);
|
|
||||||
|
|
||||||
heatshifter = Z_Calloc(viewheight * sizeof(boolean), PU_STATIC, NULL);
|
heatshifter = Z_Calloc(viewheight * sizeof(boolean), PU_STATIC, NULL);
|
||||||
|
|
||||||
for (y = 0; y < viewheight; y++)
|
for (y = 0; y < viewheight; y++)
|
||||||
@@ -3923,6 +3926,8 @@ void V_Recalc(void)
|
|||||||
vid.fdup = (vid.height*FRACUNIT) / BASEVIDHEIGHT;
|
vid.fdup = (vid.height*FRACUNIT) / BASEVIDHEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vid.udup = vid.dup;
|
||||||
|
|
||||||
if (loaded_config // this could use a better name, since it is more and indicator that early startup is done and its safe to do sketchy shit now :chaosleep:
|
if (loaded_config // this could use a better name, since it is more and indicator that early startup is done and its safe to do sketchy shit now :chaosleep:
|
||||||
&& (vid.width > 720) && (vid.height > 1280)) // ehhhh well this thing has so many issues, so ill lock it to higher resolutions instead
|
&& (vid.width > 720) && (vid.height > 1280)) // ehhhh well this thing has so many issues, so ill lock it to higher resolutions instead
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-4
@@ -122,7 +122,9 @@ void W_Shutdown(void)
|
|||||||
|
|
||||||
if (wad->handle)
|
if (wad->handle)
|
||||||
fclose(wad->handle);
|
fclose(wad->handle);
|
||||||
|
|
||||||
Z_Free(wad->filename);
|
Z_Free(wad->filename);
|
||||||
|
|
||||||
while (wad->numlumps--)
|
while (wad->numlumps--)
|
||||||
{
|
{
|
||||||
Z_Free(wad->lumpinfo[wad->numlumps].longname);
|
Z_Free(wad->lumpinfo[wad->numlumps].longname);
|
||||||
@@ -2730,10 +2732,7 @@ void vres_Free(virtres_t* vres)
|
|||||||
|
|
||||||
while (vres->numlumps--)
|
while (vres->numlumps--)
|
||||||
{
|
{
|
||||||
if (vres->vlumps[vres->numlumps].data)
|
Z_Free(vres->vlumps[vres->numlumps].data);
|
||||||
{
|
|
||||||
Z_Free(vres->vlumps[vres->numlumps].data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Z_Free(vres->vlumps);
|
Z_Free(vres->vlumps);
|
||||||
|
|||||||
+6
-6
@@ -187,13 +187,13 @@ static VOID ShowModuleInfo(HANDLE LogFile, HMODULE ModuleHandle)
|
|||||||
// Open the code module file so that we can get its file date
|
// Open the code module file so that we can get its file date
|
||||||
// and size.
|
// and size.
|
||||||
ModuleFile = CreateFileA(ModName, GENERIC_READ,
|
ModuleFile = CreateFileA(ModName, GENERIC_READ,
|
||||||
FILE_SHARE_READ, 0, OPEN_EXISTING,
|
FILE_SHARE_READ, NULL, OPEN_EXISTING,
|
||||||
FILE_ATTRIBUTE_NORMAL, 0);
|
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (ModuleFile != INVALID_HANDLE_VALUE)
|
if (ModuleFile != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
FILETIME LastWriteTime;
|
FILETIME LastWriteTime;
|
||||||
FileSize = GetFileSize(ModuleFile, 0);
|
FileSize = GetFileSize(ModuleFile, NULL);
|
||||||
if (GetFileTime(ModuleFile, 0, 0, &LastWriteTime))
|
if (GetFileTime(ModuleFile, NULL, NULL, &LastWriteTime))
|
||||||
{
|
{
|
||||||
wsprintfA(TimeBuffer, " - file date is ");
|
wsprintfA(TimeBuffer, " - file date is ");
|
||||||
PrintTime(TimeBuffer + strlen(TimeBuffer), LastWriteTime);
|
PrintTime(TimeBuffer + strlen(TimeBuffer), LastWriteTime);
|
||||||
@@ -227,7 +227,7 @@ static VOID RecordModuleList(HANDLE LogFile)
|
|||||||
size_t PageSize;
|
size_t PageSize;
|
||||||
size_t NumPages;
|
size_t NumPages;
|
||||||
size_t pageNum = 0;
|
size_t pageNum = 0;
|
||||||
LPVOID LastAllocationBase = 0;
|
LPVOID LastAllocationBase = NULL;
|
||||||
|
|
||||||
FPrintf(LogFile, "\r\n"
|
FPrintf(LogFile, "\r\n"
|
||||||
"\tModule list: names, addresses, sizes, time stamps "
|
"\tModule list: names, addresses, sizes, time stamps "
|
||||||
@@ -385,7 +385,7 @@ LONG WINAPI RecordExceptionInfo(PEXCEPTION_POINTERS data/*, LPCSTR Message, LPST
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Append to the error log.
|
// Append to the error log.
|
||||||
SetFilePointer(fileHandle, 0, 0, FILE_END);
|
SetFilePointer(fileHandle, 0, NULL, FILE_END);
|
||||||
|
|
||||||
// Print out some blank lines to separate this error log from any previous ones.
|
// Print out some blank lines to separate this error log from any previous ones.
|
||||||
FPrintf(fileHandle, "Email Sonic Team Junior so we can fix the bugs\r\n"); // Tails
|
FPrintf(fileHandle, "Email Sonic Team Junior so we can fix the bugs\r\n"); // Tails
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ typedef struct memblock_s
|
|||||||
#define MEMORY(x) (void *)((uintptr_t)(x) + sizeof(memblock_t) + ALIGNPAD)
|
#define MEMORY(x) (void *)((uintptr_t)(x) + sizeof(memblock_t) + ALIGNPAD)
|
||||||
#define MEMBLOCK(x) (memblock_t *)((uintptr_t)(x) - ALIGNPAD - sizeof(memblock_t))
|
#define MEMBLOCK(x) (memblock_t *)((uintptr_t)(x) - ALIGNPAD - sizeof(memblock_t))
|
||||||
|
|
||||||
|
static thread_handle_t main_thread;
|
||||||
|
|
||||||
// both the head and tail of the zone memory block list
|
// both the head and tail of the zone memory block list
|
||||||
static memblock_t head;
|
static memblock_t head;
|
||||||
|
|
||||||
@@ -108,6 +110,7 @@ static void Command_Memdump_f(void);
|
|||||||
void Z_Init(void)
|
void Z_Init(void)
|
||||||
{
|
{
|
||||||
size_t total, memfree;
|
size_t total, memfree;
|
||||||
|
main_thread = I_GetCurrentThread();
|
||||||
|
|
||||||
memset(&head, 0x00, sizeof(head));
|
memset(&head, 0x00, sizeof(head));
|
||||||
|
|
||||||
@@ -143,6 +146,8 @@ void Z_Free(void *ptr)
|
|||||||
{
|
{
|
||||||
memblock_t *block;
|
memblock_t *block;
|
||||||
|
|
||||||
|
I_Assert(I_GetCurrentThread() == main_thread);
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -237,6 +242,8 @@ void *Z_Malloc(size_t size, INT32 tag, void *user)
|
|||||||
memblock_t *block;
|
memblock_t *block;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
|
I_Assert(I_GetCurrentThread() == main_thread);
|
||||||
|
|
||||||
#ifdef ZDEBUG2
|
#ifdef ZDEBUG2
|
||||||
CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line);
|
CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line);
|
||||||
#endif
|
#endif
|
||||||
@@ -300,6 +307,8 @@ void *Z_Calloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line
|
|||||||
void *Z_Calloc(size_t size, INT32 tag, void *user)
|
void *Z_Calloc(size_t size, INT32 tag, void *user)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
I_Assert(I_GetCurrentThread() == main_thread);
|
||||||
|
|
||||||
#ifdef VALGRIND_MEMPOOL_ALLOC
|
#ifdef VALGRIND_MEMPOOL_ALLOC
|
||||||
Z_calloc = true;
|
Z_calloc = true;
|
||||||
#endif
|
#endif
|
||||||
@@ -335,6 +344,8 @@ void *Z_Realloc(void *ptr, size_t size, INT32 tag, void *user)
|
|||||||
memblock_t *block;
|
memblock_t *block;
|
||||||
size_t copysize;
|
size_t copysize;
|
||||||
|
|
||||||
|
I_Assert(I_GetCurrentThread() == main_thread);
|
||||||
|
|
||||||
#ifdef ZDEBUG2
|
#ifdef ZDEBUG2
|
||||||
CONS_Debug(DBG_MEMORY, "Z_Realloc %s:%d\n", file, line);
|
CONS_Debug(DBG_MEMORY, "Z_Realloc %s:%d\n", file, line);
|
||||||
#endif
|
#endif
|
||||||
@@ -414,6 +425,8 @@ void Z_FreeTags(INT32 lowtag, INT32 hightag)
|
|||||||
{
|
{
|
||||||
memblock_t *block, *next;
|
memblock_t *block, *next;
|
||||||
|
|
||||||
|
I_Assert(I_GetCurrentThread() == main_thread);
|
||||||
|
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
Z_CheckHeap2(file, line);
|
Z_CheckHeap2(file, line);
|
||||||
#else
|
#else
|
||||||
@@ -447,6 +460,8 @@ void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *))
|
|||||||
{
|
{
|
||||||
memblock_t *block, *next;
|
memblock_t *block, *next;
|
||||||
|
|
||||||
|
I_Assert(I_GetCurrentThread() == main_thread);
|
||||||
|
|
||||||
if (!iterfunc)
|
if (!iterfunc)
|
||||||
I_Error("Z_IterateTags: no iterator function was given");
|
I_Error("Z_IterateTags: no iterator function was given");
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -91,7 +91,7 @@ void Z_Init(void);
|
|||||||
|
|
||||||
// Z_Free and alloc with alignment
|
// Z_Free and alloc with alignment
|
||||||
#ifdef ZDEBUG
|
#ifdef ZDEBUG
|
||||||
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
|
#define Z_Free(p) Z_Free2(p, __FILE__, __LINE__)
|
||||||
#define Z_Malloc(s,t,u) Z_Malloc2(s, t, u, __FILE__, __LINE__)
|
#define Z_Malloc(s,t,u) Z_Malloc2(s, t, u, __FILE__, __LINE__)
|
||||||
#define Z_Calloc(s,t,u) Z_Calloc2(s, t, u, __FILE__, __LINE__)
|
#define Z_Calloc(s,t,u) Z_Calloc2(s, t, u, __FILE__, __LINE__)
|
||||||
#define Z_Realloc(p,s,t,u) Z_Realloc2(p,s, t, u, __FILE__, __LINE__)
|
#define Z_Realloc(p,s,t,u) Z_Realloc2(p,s, t, u, __FILE__, __LINE__)
|
||||||
|
|||||||
Reference in new issue
Block a user