Compare commits

..
85 Commits
Author SHA1 Message Date
Gustaf Alhäll 89cecb88f5 Update license info 2025-12-06 19:45:35 +01:00
Gustaf Alhäll baf5c8d66b Fix music looping on digital 2025-12-06 19:45:32 +01:00
Gustaf Alhäll 72000c4546 Fix memory leak in AATree string trees 2025-12-06 19:45:29 +01:00
Gustaf Alhäll 82b774b2c3 Fix use-after-free when mobj is removed while still playing sounds 2025-12-06 19:45:27 +01:00
Gustaf Alhäll 3818b9ad1a Limit audio channels to 2 2025-12-05 00:22:09 +01:00
Alug ca8e811bd9 sdl_sound: attempt to fix sounds cutting off
i suck at explaining so just trust. :chonkbuncle:
Game sound handling has no idea which sound it is playing/checking, so a sound that ended frees its slot and it might get occupied again without the game knowing
so just encode the channel number into the sound so we can actually check
2025-12-04 17:52:38 +01:00
Alug 97ca034037 sdl_sound: handle explicit float conversions 2025-12-04 17:52:35 +01:00
Alug ac46f7ed00 add missing Fluidsynth ifdefs 2025-12-04 17:52:32 +01:00
Gustaf Alhäll 0afed59329 Fix MIDI music looping 2025-12-04 17:52:30 +01:00
Gustaf Alhäll ec3a1fee70 Tweak audio settings 2025-12-04 17:52:25 +01:00
Alug 5e8c0c3806 Add chorus and reverb settings to MIDI 2025-12-04 17:52:22 +01:00
Gustaf Alhäll 05ea898345 Fix Haiku build 2025-12-04 17:52:11 +01:00
Gustaf Alhäll 0c1fdc0be8 Fine-tune volume settings 2025-12-04 17:52:08 +01:00
Gustaf Alhäll 0e4c72e6f6 Implement MIDI seeking 2025-12-04 17:52:05 +01:00
Alug 29b83903ef delet the bird music resynching stuff
idk who even wants this, its pain, and even more pain to adapt
2025-12-04 17:52:03 +01:00
Alug 1cae09fa11 sdl_audio: use float M_PI for S_CURVE
meant for floats, prevents implicit double conversions
2025-12-04 17:51:59 +01:00
Alug 4a56819bc3 makefile: move openmpt stuff to before sdl stuff
seems to fix linking openmpt without mixer for some reason oh well
2025-12-01 16:49:11 +01:00
Alug 567a48aac3 sdl_sound: fix -Wmaybe-uninitialized warning 2025-12-01 16:49:08 +01:00
Alug d100401c5f this shouldnt be in sourcefile oops 2025-12-01 16:49:05 +01:00
Alug 6dee9fa561 add back "nearest" resampling from mixer
sdls own resampler uses linear interpolation, which sounds super muffled to me
some may like this, but i dont want to change how the game "sounds"
2025-12-01 16:49:01 +01:00
Alug 5bd7a09d9f force 44100khz sample rate
sounds better to me honestly
2025-12-01 16:48:56 +01:00
Alug 47477c2d03 make gme and tracker music slightly louder
prob needs some adjustment, but both were always quite quiet
2025-12-01 16:48:53 +01:00
Alug cd128a1084 lock audio stream in I_PlaySong
seems to fix weird crashes with gme
2025-12-01 16:48:49 +01:00
Alug 34f2afa3d9 add "audiobuffersize" handling
uses the SDL_AUDIO_DEVICE_SAMPLE_FRAMES hint
2025-12-01 16:48:46 +01:00
Alug 22f285edec disable sound precache for sdl sound 2025-12-01 16:48:43 +01:00
Alug 592abdef96 pitch is a float 2025-12-01 16:48:40 +01:00
Alug a27eee8e2f add few missing audiostream unlocks 2025-12-01 16:48:37 +01:00
Alug 904019d24b fix startup playing a super loud bit of music 2025-12-01 16:48:32 +01:00
Alug c6ca5a6f0f i_video: few type fixes for sdl3 2025-12-01 16:48:29 +01:00
Alug 2392f0484c remove hwr_shutdown call
honestly this didnt help with the issue i had, game should already release all the memory on quit anyways.
this just makes it take longer to quit
2025-12-01 16:48:26 +01:00
Alug 986a131a36 fix a few warnings 2025-12-01 16:48:23 +01:00
Alug e9685ef3e8 port srb2classics sdl audio system
still needs a little work reimplementing everything we got

from: https://codeberg.org/srb2classic/srb2classic/pulls/177
2025-12-01 16:48:18 +01:00
Alug 59f194cb9d fuckit SDL3 2025-12-01 16:48:15 +01:00
Alug 99d5590435 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-30 19:34:36 +01:00
Alug 9b2cfe51d6 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-28 18:24:07 +01:00
Alug 66619f42f9 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-28 18:07:35 +01:00
Alug 890677e2b5 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-27 23:33:28 +01:00
Alug 1105526eb1 fix perfstats freaking out 2025-11-26 10:10:14 +01:00
Alug d963df36f1 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-26 10:10:12 +01:00
Alug 846967cb91 fix compile with HAVE_DISCORDRPC 2025-11-25 20:21:15 +01:00
Alug 6c8862ee4b Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-25 20:16:18 +01:00
Alug a49ea4defd Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-24 22:43:26 +01:00
Alug 3c776b321d Optimize: move a few strlen calls out of loops
when applicable and the input does not get modified within the loop
needs some testing incase i oversaw something
2025-11-24 20:52:03 +01:00
Alug 1ed9bfc9b4 Merge branch 'vidmodestuff' into Saturn-Testing 2025-11-24 20:50:04 +01:00
Alug a05413d925 fix erronous "Could not set custom resolution" warning on startup
the cvars may have not been initialised yet to anything
just return -2 and ignore
2025-11-24 20:49:45 +01:00
Alug fa9637fba4 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-24 18:29:05 +01:00
Alug 7f50a09bcd Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-24 00:35:31 +01:00
Alug e25191d7df Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-24 00:30:49 +01:00
Alug f4d8a903e8 Merge branch 'vidmodestuff' into Saturn-Testing 2025-11-23 23:21:54 +01:00
Alug 8a8cbffd12 I_CheckDesktopRes: use SDL_GetCurrentDisplayMode
instead of SDL_GetDesktopDisplayMode, as the former only returns the display mode from when the window was created, which might not reflect the actual current desktop mode.
Maybe fixes some resolutions being incorrectly reported asa having visual issues
2025-11-23 23:21:47 +01:00
Alug 0adf356325 HACK: abuse batching system for sprites and drawnodes
use batching system without sorting for order sensitive things like sprites and transparent stuff
even despite not being "optimally" sorted, drawing them in one go, instead of directly still gives a nice speed increase in certain cases (on my ryzen 5600 i get around 120fps+ on teiai towers starting area!)
2025-11-23 23:08:09 +01:00
Alug 0fef290858 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-23 22:52:10 +01:00
Alug 2516873ba1 fix signed integer overflow in polygon hash calculation
also gives a speedup on some maps lul
2025-11-22 18:55:30 +01:00
Alug c650394c31 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-22 18:13:54 +01:00
Alug 1fb6c63097 fix dedi compile 2025-11-21 14:45:44 +01:00
Alug e95382075c Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-21 00:00:29 +01:00
Alug 2d9776d792 OpenGL: keep around our drawnodes memory
no need to constantly reallocate new memory
we dont have renderer switch, and the next level will render drawnodes anyways
those wont grow super big also, so theres no big worry about wasting tons of memory
yes i like ceepeepee vectors, how can you tell
2025-11-19 19:27:36 +01:00
Alug 7fa3d119e8 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-19 19:26:41 +01:00
Alug e65741acaa Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-18 16:33:38 +01:00
Alug b36ab31a56 Merge remote-tracking branch 'origin/vidmodestuff' into Saturn-Testing 2025-11-18 16:33:35 +01:00
Alug a335da3473 Merge branch 'Saturn-Next' into Saturn-Testing 2025-11-18 16:21:05 +01:00
Alug c312380944 check if our desired screen res already is in the videomode list
before deciding to rebuild the whole list when changing the resolution cvars
2025-11-18 05:22:50 +01:00
Alug b5bb2b42bf I_FillScreenResolutionsList: shrink list if it is too large
we check against MAXMODEDESCS, which is the maximum of modes the videomode can list
just in case we really get a display with a fuckton of resolutions, which most likely wont ever be the case though
this just removes the smallest modes from the list (accounting for the canonicals), to keep things simple
2025-11-18 04:55:50 +01:00
Alug d074f375ca M_VideoModeMenu: make sure red marked modes take precedence 2025-11-18 04:55:45 +01:00
Alug 6fd14f0a80 M_VideoModeMenu: remove old video mode dupe check 2025-11-18 04:55:41 +01:00
Alug d6bbb2c1b3 use static buffer for windowedModes names
no need to worry about memory management here :chaosleep:
2025-11-18 04:55:36 +01:00
Alug fa66b87965 cmp_resolutions: compare by numbers directly
instead by comparing it with strings
2025-11-18 04:55:30 +01:00
Alug c59d5db03e Merge remote-tracking branch 'origin/Saturn-Next' into vidmodestuff 2025-11-18 04:55:22 +01:00
Alug d2f3d5aa4d anew the testing branch
wiped it out completely
2025-11-17 20:26:49 +01:00
Alug 913b8878d8 Optimize: Use doomednum lookup also when (re)spawning mapthings
not just for loading savegame thinkers
Actually even provides slight runtime performance improvement, but mostly makes levelload faster
2025-11-17 20:26:07 +01:00
Alug f02b9f953e Merge branch 'vidmodestuff' into Saturn-Testing 2025-11-17 20:25:49 +01:00
Alug b6edc90553 mark resolutions listed above the current dektop resolution in red
as they lead to visual errors in openglmode without fbo support
2025-11-09 22:20:57 +01:00
Alug 23735121ff raise MAXWINMODES to 128
YES WINDOWS THANKS VERY MUCH SUPER COOL OF YOU
2025-11-09 20:40:03 +01:00
Alug 20950b698f make sure the default 320x200 mode exists 2025-11-09 20:39:58 +01:00
Alug 44df85d6a4 reduce the scope of this 2025-11-09 20:41:24 +01:00
Alug 42d53f1f6f Merge branch 'Saturn-Next' into vidmodestuff 2025-11-09 20:36:00 +01:00
Alug 48f2d0ff83 make sure our custom res fits within MAXVIDMODES
33 are alot so this probably will never be the case (i hope)
2025-11-09 20:21:30 +01:00
Alug 517723f9c1 handle custom res differently + make VID_NumModes return actual vidmodes
custom resolutions now will be put into the resolution list
which means they are selectable from the menu
2025-11-09 20:16:44 +01:00
Alug 6915077e0f refresh the video menu list if our resolution list changes
if you move the gamewindow to a different display, the video menu will now upadate to the new resolutions
2025-11-09 19:16:36 +01:00
Alug 406dbf333d use a video_mode_t thing for our custom resolution
perhaps we may merge it into windowedmodes? not sure
but this works for now
2025-11-09 19:13:38 +01:00
Alug a730dfd212 fix checking for if display changed 2025-11-09 19:13:35 +01:00
Alug 3058d365f3 no need to call I_FillScreenResolutionsList everywhere
its fine after startup, and when we move our window
2025-11-09 19:13:31 +01:00
Alug ccc453e0b0 fix windowmoved never resetting 2025-11-09 19:13:28 +01:00
Alug c3d02090e4 WIP: remove hardcoded resolutions
much thanks dsda-doom for most of the code for this
TODO:
- resolution menu needs to refresh if the list changes
- clean up
- handle custom resolutions more sane
- figure out the best maximum resolution list size the menu can display
2025-11-09 19:13:25 +01:00
Alug 20cd7621c3 delet numVidModes
wasnt doing anything
2025-11-09 19:13:22 +01:00
102 changed files with 4985 additions and 2912 deletions

No files matched your search

+87 -168
View File
@@ -1,169 +1,61 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
if("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
message(FATAL_ERROR "In-source builds are blocked. Please build from a separate directory.")
endif()
# Set up CMAKE path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
include(CMakeDependentOption)
#include(cmake/CPM.cmake)
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 CXX)
if(APPLE)
# DiscordRPC needs but does not properly specify ObjC
enable_language(OBJC)
endif()
##### 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 "SRB2Kart" CACHE STRING "Program name for display purposes")
set(CPACK_PACKAGE_VENDOR "Kart Krew" CACHE STRING "Vendor name for display purposes")
#set(CPACK_PACKAGE_DESCRIPTION_FILE )
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
SET(CPACK_OUTPUT_FILE_PREFIX package)
include(CPack)
# Options
if("${CMAKE_SYSTEM_NAME}" MATCHES Linux)
set(SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT ON)
else()
set(SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT OFF)
endif()
option(
SRB2_CONFIG_SYSTEM_LIBRARIES
"Link dependencies using CMake's find_package and do not use internal builds"
${SRB2_CONFIG_SYSTEM_LIBRARIES_DEFAULT}
)
option(SRB2_CONFIG_ENABLE_TESTS "Build the test suite" OFF)
# This option isn't recommended for distribution builds and probably won't work (yet).
cmake_dependent_option(
SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES
"Use dynamic libraries when compiling internal dependencies"
OFF "NOT SRB2_CONFIG_SYSTEM_LIBRARIES"
OFF
)
option(SRB2_CONFIG_ENABLE_DISCORDRPC "Enable Discord RPC features" ON)
option(SRB2_CONFIG_STATIC_STDLIB "Link static version of standard library. All dependencies must also be static" ON)
option(SRB2_CONFIG_HWRENDER "Enable hardware render (OpenGL) support" ON)
option(SRB2_CONFIG_STATIC_OPENGL "Enable static linking GL (do not do this)" OFF)
option(SRB2_CONFIG_ERRORMODE "Compile C code with warnings treated as errors." OFF)
option(SRB2_CONFIG_DEBUGMODE "Compile with PARANOIA, ZDEBUG, RANGECHECK and PACKETDROP defined." OFF)
option(SRB2_CONFIG_MOBJCONSISTANCY "Compile with MOBJCONSISTANCY defined." OFF)
option(SRB2_CONFIG_PACKETDROP "Compile with PACKETDROP defined." OFF)
option(SRB2_CONFIG_ZDEBUG "Compile with ZDEBUG defined." OFF)
# SRB2_CONFIG_PROFILEMODE is probably superceded by some CMake setting.
option(SRB2_CONFIG_PROFILEMODE "Compile for profiling (GCC only)." OFF)
option(SRB2_CONFIG_TRACY "Compile with Tracy profiling enabled" OFF)
option(SRB2_CONFIG_ASAN "Compile with AddressSanitizer (libasan)." OFF)
option(SRB2_CONFIG_UBSAN "Compile with UndefinedBehaviorSanitizer (libubsan)." OFF)
set(SRB2_CONFIG_ASSET_DIRECTORY "" CACHE PATH "Path to directory that contains all asset files for the installer. If set, assets will be part of installation and cpack.")
option(SRB2_CONFIG_LTO "Enable link time optimizations, improves performance at the cost of longer link times." ON)
option(SRB2_CONFIG_TIDY "Enable clang tiny, checks compiled code for issues at the cost of longer compile times." OFF)
# man i suck at explaining lmao
option(SRB2_CONFIG_SATURNPAK "Enable Saturn specific special packet. Required for using the newer resynch system" ON)
option(SRB2_CONFIG_SATURNJOIN "Enable Saturn specific allowjoin toggle." ON)
option(SRB2_CONFIG_SCREENFBO "Enable hardware render (OpenGL) FBO downsampling support" ON)
option(SRB2_CONFIG_LIBBACKTRACE "Enable using libbacktrace for crashlogs" ON)
#if(SRB2_CONFIG_ENABLE_TESTS)
# https://github.com/catchorg/Catch2
# CPMAddPackage(
# NAME Catch2
# VERSION 3.1.1
# GITHUB_REPOSITORY catchorg/Catch2
# OPTIONS
# "CATCH_INSTALL_DOCS OFF"
# )
# list(APPEND CMAKE_MODULE_PATH "${Catch2_SOURCE_DIR}/extras")
# include(CTest)
# include(Catch)
# add_executable(srb2tests)
# # To add tests, use target_sources to add individual test files to the target in subdirs.
# target_link_libraries(srb2tests PRIVATE Catch2::Catch2 Catch2::Catch2WithMain)
# target_compile_features(srb2tests PRIVATE c_std_11 cxx_std_17)
# catch_discover_tests(srb2tests)
#endif()
# Enable CCache
# (Set USE_CCACHE=ON to use, CCACHE_OPTIONS for options)
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL Windows)
option(USE_CCACHE "Enable ccache support" OFF)
if(USE_CCACHE)
find_program(CCACHE_TOOL_PATH ccache)
if(CCACHE_TOOL_PATH)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
else()
message(WARNING "USE_CCACHE was set but ccache is not found (set CCACHE_TOOL_PATH)")
endif()
endif()
else()
# TODO: fix windoze crap, i dont want cpm lol
#CPMAddPackage(
# NAME Ccache.cmake
# GITHUB_REPOSITORY TheLartians/Ccache.cmake
# VERSION 1.2.5
#)
endif()
# Dependencies
#add_subdirectory(thirdparty)
if("${SRB2_CONFIG_SYSTEM_LIBRARIES}")
find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
find_package(SDL2 REQUIRED)
find_package(SDL2_mixer REQUIRED)
find_package(CURL REQUIRED)
find_package(OPENMPT OPTIONAL)
find_package(GME REQUIRED)
find_package(DiscordRPC OPTIONAL)
find_package(libbacktrace OPTIONAL)
endif()
LANGUAGES C)
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
message(FATAL_ERROR "In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from.")
endif()
if ((${SRB2_USE_CCACHE}) AND (${CMAKE_C_COMPILER} MATCHES "clang"))
message(WARNING "Using clang and CCache: You may want to set environment variable CCACHE_CPP2=yes to prevent include errors during compile.")
endif()
# Set up CMAKE path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Add sources from Sourcefile
function(target_sourcefile type)
file(STRINGS Sourcefile list
REGEX "[-0-9A-Za-z_]+\.${type}")
target_sources(SRB2SDL2 PRIVATE ${list})
### Useful functions
# Prepend sources with current source directory
function(prepend_sources SOURCE_FILES)
foreach(SOURCE_FILE ${${SOURCE_FILES}})
set(MODIFIED ${MODIFIED} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE})
endforeach()
set(${SOURCE_FILES} ${MODIFIED} PARENT_SCOPE)
endfunction()
# Macro to add OSX framework
macro(add_framework fwname appname)
find_library(FRAMEWORK_${fwname}
NAMES ${fwname}
PATHS ${CMAKE_OSX_SYSROOT}/System/Library
${CMAKE_OSX_SYSROOT}/Library
/System/Library
/Library
ATH_SUFFIXES Frameworks
NO_DEFAULT_PATH)
if( ${FRAMEWORK_${fwname}} STREQUAL FRAMEWORK_${fwname}-NOTFOUND)
MESSAGE(ERROR ": Framework ${fwname} not found")
else()
TARGET_LINK_LIBRARIES(${appname} PRIVATE "${FRAMEWORK_${fwname}}/${fwname}")
MESSAGE(STATUS "Framework ${fwname} found at ${FRAMEWORK_${fwname}}")
endif()
endmacro()
# Macro to copy Windows DLLs to Debug/Release folder for easy debugging
# Note: this is general purpose, we could copy anything. Just using for DLLs on MSVC though
macro(copy_files_to_build_dir target dlllist_var)
if(MSVC)
# http://stackoverflow.com/a/26983405/3064195
foreach(dlllist_item ${${dlllist_var}})
get_filename_component(dllname ${dlllist_item} NAME)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${dlllist_item}
$<TARGET_FILE_DIR:${target}>/${dllname}
)
endforeach()
endif()
endmacro()
# bitness check
set(SRB2_SYSTEM_BITS 0)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -178,39 +70,66 @@ if(${SRB2_SYSTEM_BITS} EQUAL 0)
message(STATUS "Target bitness is unknown")
endif()
# OS macros
if (UNIX)
add_definitions(-DUNIXCOMMON)
endif()
if(CMAKE_COMPILER_IS_GNUCC)
find_program(OBJCOPY objcopy)
endif()
if(${CMAKE_SYSTEM} MATCHES "Linux")
add_definitions(-DLINUX)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
add_definitions(-DLINUX64)
endif()
endif()
if(${CMAKE_SYSTEM} MATCHES "Darwin")
add_definitions(-DMACOSX)
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
# Set EXE names so the assets CMakeLists can refer to its target
set(SRB2_SDL2_EXE_NAME "" CACHE STRING "Override executable binary output name")
set(SRB2_SDL2_EXE_SUFFIX "" CACHE STRING "Optional executable suffix, separated by an underscore")
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)
add_subdirectory(src)
add_subdirectory(assets)
## config.h generation
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
include(GitUtilities)
git_latest_commit(SRB2_COMP_COMMIT "${CMAKE_SOURCE_DIR}")
git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
#git_working_tree_dirty(SRB2_COMP_UNCOMMITTED "${CMAKE_SOURCE_DIR}") #TODO: fix this
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
set(SRB2_COMP_REVISION "${SRB2_COMP_COMMIT}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
if("${SRB2_SDL2_EXE_NAME}" STREQUAL "")
list(APPEND EXE_NAME_PARTS "srb2kart-saturn")
##### PACKAGE CONFIGURATION #####
if(NOT "${SRB2_GIT_BRANCH}" STREQUAL "master")
list(APPEND EXE_NAME_PARTS ${SRB2_GIT_BRANCH})
endif()
else()
list(APPEND EXE_NAME_PARTS ${SRB2_SDL2_EXE_NAME})
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()
list(APPEND EXE_NAME_PARTS ${SRB2_SDL2_EXE_SUFFIX})
list(JOIN EXE_NAME_PARTS "_" EXE_NAME)
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${EXE_NAME})
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)
+1 -8
View File
@@ -13,12 +13,10 @@ Mainly for use in visual-only addons like secondcolor.
**Not netsafe**. Returns player's current sliptide roll angle, taking sliptideroll cvar value into account.
## hud.setVoteBackground(name[, time\_per\_frame])
## hud.setVoteBackground(name)
Changes vote background texture prefix (game looks for PREFIX + "W" or "C" (depends on resolution) + FRAME\_NUMBER).
If time\_per\_frame is set, each frame will last this amount of tics, default value is 2
## hud.add(fn, "vote") and hud.add(fn, "intermission")
Hud hooks for vote screen and intermission screen. They only get drawer (`v`) as argument.
@@ -122,11 +120,6 @@ v.interpLatch(false)
```
When using a custom string drawer, enable this mode to avoid interpolation artifacting when the string changes.
## cameras[] global array
Local player cameras that can be accessed outside of hud hooks.
`#cameras` will return amount of available cameras. (0 on dedicated server, 1 with 1 player, 4 with 4p splitscreen, etc)
## mobj.spritexscale, mobj.spriteyscale, mobj.spritexoffset, mobj.spriteyoffset, mobj.rollangle, mobj.sloperoll, mobj.rollmodel fields
Same fields as in SRB2 2.2
+44 -37
View File
@@ -1,52 +1,59 @@
## 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
FUNCTION(PREPEND var prefix)
SET(listVar "")
FOREACH(f ${ARGN})
LIST(APPEND listVar "${prefix}/${f}")
ENDFOREACH(f)
SET(${var} "${listVar}" PARENT_SCOPE)
ENDFUNCTION(PREPEND)
if("${SRB2_CONFIG_ASSET_DIRECTORY}" STREQUAL "")
message(WARNING "SRB2_CONFIG_ASSET_DIRECTORY is not set, so installation will not contain data files.")
return()
endif()
set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer"
CACHE STRING "Path to directory that contains all asset files for the installer.")
get_filename_component(SRB2_ASSET_DIRECTORY_ABSOLUTE "${SRB2_CONFIG_ASSET_DIRECTORY}" ABSOLUTE)
set(SRB2_ASSETS_DOCS
"README.txt"
"HISTORY.txt"
"README-SDL.txt"
"LICENSE.txt"
"LICENSE-3RD-PARTY.txt"
set(SRB2_ASSET_HASHED
"srb2.srb;\
gfx.kart;\
textures.kart;\
chars.kart;\
maps.kart"
CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!"
)
list(TRANSFORM SRB2_ASSETS_DOCS PREPEND "/")
list(TRANSFORM SRB2_ASSETS_DOCS PREPEND "${SRB2_ASSET_DIRECTORY_ABSOLUTE}")
####################
# POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list!
####################
set(SRB2_ASSETS_GAME
"srb2.srb"
"gfx.kart"
"textures.kart"
"chars.kart"
"maps.kart"
set(SRB2_ASSET_DOCS
"README.txt;\
HISTORY.txt;\
LICENSE.txt;\
LICENSE-3RD-PARTY.txt"
CACHE STRING "Documentation filenames. In OS X, these are packaged separately from other assets. No spaces between entries!"
)
list(TRANSFORM SRB2_ASSETS_GAME PREPEND "/")
list(TRANSFORM SRB2_ASSETS_GAME PREPEND "${SRB2_ASSET_DIRECTORY_ABSOLUTE}")
set(SRB2_ASSETS ${SRB2_ASSET_DOCS} ${SRB2_ASSETS_GAME})
PREPEND(SRB2_ASSET_DOCS ${SRB2_ASSET_DIRECTORY} ${SRB2_ASSET_DOCS})
foreach(SRB2_ASSET ${SRB2_ASSET_HASHED})
file(MD5 ${SRB2_ASSET_DIRECTORY}/${SRB2_ASSET} "SRB2_ASSET_${SRB2_ASSET}_HASH")
set(SRB2_ASSET_${SRB2_ASSET}_HASH ${SRB2_ASSET_${SRB2_ASSET}_HASH} PARENT_SCOPE)
endforeach()
# Installation
if(${CMAKE_SYSTEM} MATCHES Darwin)
get_target_property(outname SRB2SDL2 OUTPUT_NAME)
install(FILES ${SRB2_ASSETS} DESTINATION "${outname}.app/Contents/Resources")
install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/models" DESTINATION "${outname}.app/Contents/Resources")
install(FILES ${SRB2_ASSETS_DOCS} DESTINATION .)
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
DESTINATION "${outname}.app/Contents/Resources"
)
install(FILES ${SRB2_ASSET_DOCS}
DESTINATION .
OPTIONAL
)
else()
install(FILES ${SRB2_ASSETS} DESTINATION .)
install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/models" DESTINATION .)
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/"
DESTINATION .
)
# Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install again
#install(FILES ${SRB2_ASSET_DOCS}
# DESTINATION .
# OPTIONAL
#)
endif()
+10 -6
View File
@@ -972,6 +972,14 @@ Public License instead of this License. But first, please read
Copyright (C) 1995-2018 Free Software Foundation, Inc.
https://www.gnu.org/software/gettext/
- FluidSynth
Copyright (C) 2000-2025 Peter Hanappe and others.
https://www.fluidsynth.org/
- libsndfile
Copyright (C) 1999-2016 Erik de Castro Lopo
https://libsndfile.github.io/libsndfile/
- mpg123
Copyright (c) 1995-2013 by Michael Hipp and others,
free software under the terms of the LGPL v2.1
@@ -1699,12 +1707,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
zlib License
applies to:
- Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
https://www.libsdl.org/hg.php
- SDL_mixer: An audio mixer library based on the SDL library
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
https://www.libsdl.org/projects/SDL_mixer/
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
https://libsdl.org/
- zlib
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
-19
View File
@@ -1,19 +0,0 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
set(CMAKE_BINARY_DIR "${BINARY_DIR}")
set(CMAKE_CURRENT_BINARY_DIR "${BINARY_DIR}")
# Set up CMAKE path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
include(GitUtilities)
git_current_branch(SRB2_COMP_BRANCH)
git_working_tree_dirty(SRB2_COMP_UNCOMMITTED)
git_latest_commit(SRB2_COMP_REVISION)
git_subject(subject)
string(REGEX REPLACE "([\"\\])" "\\\\\\1" SRB2_COMP_LASTCOMMIT "${subject}")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/build/src/config.h")
-10
View File
@@ -21,13 +21,3 @@ find_library(DISCORDRPC_LIBRARY
set(DISCORDRPC_PROCESS_INCLUDES DISCORDRPC_INCLUDE_DIR)
set(DISCORDRPC_PROCESS_LIBS DISCORDRPC_LIBRARY)
libfind_process(DISCORDRPC)
if(DISCORDRPC_FOUND AND NOT TARGET DiscordRPC::DiscordRPC)
add_library(DiscordRPC::DiscordRPC UNKNOWN IMPORTED)
set_target_properties(
DiscordRPC::DiscordRPC
PROPERTIES
IMPORTED_LOCATION "${DISCORDRPC_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${DISCORDRPC_INCLUDE_DIR}"
)
endif()
+41
View File
@@ -0,0 +1,41 @@
# Find FluidSynth
# Once done, this will define
#
# FLUIDSYNTH_FOUND - system has FluidSynth
# FLUIDSYNTH_INCLUDE_DIRS - FluidSynth include directories
# FLUIDSYNTH_LIBRARIES - link libraries
include(LibFindMacros)
libfind_pkg_check_modules(FLUIDSYNTH_PKGCONF FLUIDSYNTH)
# includes
find_path(FLUIDSYNTH_INCLUDE_DIR
NAMES fluidsynth.h
PATHS
${FLUIDSYNTH_PKGCONF_INCLUDE_DIRS}
)
# library
find_library(FLUIDSYNTH_LIBRARY
NAMES fluidsynth
PATHS
${FLUIDSYNTH_PKGCONF_LIBRARY_DIRS}
"/usr/lib"
"/usr/local/lib"
)
# set include dir variables
set(FLUIDSYNTH_PROCESS_INCLUDES FLUIDSYNTH_INCLUDE_DIR)
set(FLUIDSYNTH_PROCESS_LIBS FLUIDSYNTH_LIBRARY)
libfind_process(FLUIDSYNTH)
if(FLUIDSYNTH_FOUND AND NOT TARGET FluidSynth::libfluidsynth)
add_library(FluidSynth::libfluidsynth UNKNOWN IMPORTED)
set_target_properties(
FluidSynth::libfluidsynth
PROPERTIES
IMPORTED_LOCATION "${FLUIDSYNTH_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FLUIDSYNTH_INCLUDE_DIR}"
)
endif()
+1 -11
View File
@@ -20,14 +20,4 @@ find_library(GME_LIBRARY
set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR)
set(GME_PROCESS_LIBS GME_LIBRARY)
libfind_process(GME)
if(GME_FOUND AND NOT TARGET gme)
add_library(gme UNKNOWN IMPORTED)
set_target_properties(
gme
PROPERTIES
IMPORTED_LOCATION "${GME_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GME_INCLUDE_DIR}"
)
endif()
libfind_process(GME)
+1 -11
View File
@@ -20,14 +20,4 @@ find_library(OPENMPT_LIBRARY
set(OPENMPT_PROCESS_INCLUDES OPENMPT_INCLUDE_DIR)
set(OPENMPT_PROCESS_LIBS OPENMPT_LIBRARY)
libfind_process(OPENMPT)
if(OPENMPT_FOUND AND NOT TARGET openmpt)
add_library(openmpt UNKNOWN IMPORTED)
set_target_properties(
openmpt
PROPERTIES
IMPORTED_LOCATION "${OPENMPT_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${OPENMPT_INCLUDE_DIR}"
)
endif()
libfind_process(OPENMPT)
-10
View File
@@ -31,13 +31,3 @@ find_library(SDL2_LIBRARY
set(SDL2_PROCESS_INCLUDES SDL2_INCLUDE_DIR)
set(SDL2_PROCESS_LIBS SDL2_LIBRARY)
libfind_process(SDL2)
if(SDL2_FOUND AND NOT TARGET SDL2::SDL2)
add_library(SDL2::SDL2 UNKNOWN IMPORTED)
set_target_properties(
SDL2::SDL2
PROPERTIES
IMPORTED_LOCATION "${SDL2_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}"
)
endif()
-10
View File
@@ -32,13 +32,3 @@ find_library(SDL2_MIXER_LIBRARY
set(SDL2_MIXER_PROCESS_INCLUDES SDL2_MIXER_INCLUDE_DIR)
set(SDL2_MIXER_PROCESS_LIBS SDL2_MIXER_LIBRARY)
libfind_process(SDL2_MIXER)
if(SDL2_MIXER_FOUND AND NOT TARGET SDL2_mixer::SDL2_mixer)
add_library(SDL2_mixer::SDL2_mixer UNKNOWN IMPORTED)
set_target_properties(
SDL2_mixer::SDL2_mixer
PROPERTIES
IMPORTED_LOCATION "${SDL2_MIXER_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_MIXER_INCLUDE_DIR}"
)
endif()
-33
View File
@@ -1,33 +0,0 @@
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()
+24 -40
View File
@@ -6,54 +6,38 @@ endif()
set(__GitUtilities ON)
macro(_git_command)
execute_process(
COMMAND "${GIT_EXECUTABLE}" ${ARGN}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
function(git_describe variable path)
execute_process(COMMAND "${GIT_EXECUTABLE}" "describe"
WORKING_DIRECTORY "${path}"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endmacro()
macro(_git_easy_command)
_git_command(${ARGN})
set(${variable} "${output}" PARENT_SCOPE)
endmacro()
function(git_current_branch variable)
_git_command(symbolic-ref -q --short HEAD)
# If a detached head, a ref could still be resolved.
if("${output}" STREQUAL "")
_git_command(describe --all --exact-match)
# Get the ref, in the form heads/master or
# remotes/origin/master so isolate the final part.
string(REGEX REPLACE ".*/" "" output "${output}")
endif()
set(${variable} "${output}" PARENT_SCOPE)
endfunction()
function(git_latest_commit variable)
_git_easy_command(rev-parse --short HEAD)
function(git_current_branch variable path)
execute_process(COMMAND ${GIT_EXECUTABLE} "symbolic-ref" "--short" "HEAD"
WORKING_DIRECTORY "${path}"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(${variable} "${output}" PARENT_SCOPE)
endfunction()
function(git_working_tree_dirty variable)
_git_command(status --porcelain -uno)
function(git_latest_commit variable path)
execute_process(COMMAND ${GIT_EXECUTABLE} "rev-parse" "--short" "HEAD"
WORKING_DIRECTORY "${path}"
RESULT_VARIABLE result
OUTPUT_VARIABLE output
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(output STREQUAL "")
set(${variable} FALSE PARENT_SCOPE)
else()
set(${variable} TRUE PARENT_SCOPE)
endif()
endfunction()
function(git_subject variable)
_git_easy_command(log -1 "--format=%h %s")
endfunction()
function(get_git_dir variable)
_git_easy_command(rev-parse --git-dir)
endfunction()
set(${variable} "${output}" PARENT_SCOPE)
endfunction()
-2
View File
@@ -1,5 +1,3 @@
/cscope.out
*.json
*.idx
config.h
*.gdb_history
+495 -391
View File
@@ -1,146 +1,413 @@
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32)
if(("${CMAKE_COMPILER_IS_GNUCC}" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
target_link_options(SRB2SDL2 PRIVATE "-Wl,--disable-dynamicbase")
if("${SRB2_CONFIG_STATIC_STDLIB}")
# On MinGW with internal libraries, link the standard library statically
if(CMAKE_LINKER_TYPE STREQUAL "LLD")
target_link_options(SRB2SDL2 PRIVATE -Wl, -static-libgcc -static-libstdc++ -static -lpthread)
else()
target_link_options(SRB2SDL2 PRIVATE -Wl,--add-stdcall-alias -static-libgcc -static-libstdc++ -static -lpthread)
endif()
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
target_link_libraries(SRB2SDL2 PRIVATE Threads::Threads)
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
target_link_options(SRB2SDL2 PRIVATE "-Wl,--large-address-aware")
endif()
endif()
set(SRB2_CONFIG_STD23 OFF CACHE BOOL
"Compiles the game under c23 and cxx23 instead c11 and cxx17.")
if(SRB2_CONFIG_STD23)
message("-- Compiling game with C23 and CXX23.")
target_compile_features(SRB2SDL2 PRIVATE c_std_23 cxx_std_23)
set_property(TARGET SRB2SDL2 PROPERTY C_STANDARD 23)
set_property(TARGET SRB2SDL2 PROPERTY CXX_STANDARD 23)
else()
message("-- Compiling game with C11 and CXX17.")
target_compile_features(SRB2SDL2 PRIVATE c_std_11 cxx_std_17)
set_property(TARGET SRB2SDL2 PROPERTY C_STANDARD 11)
set_property(TARGET SRB2SDL2 PROPERTY CXX_STANDARD 17)
endif()
# SRB2 Core
# Core sources
target_sourcefile(c)
target_sources(SRB2SDL2 PRIVATE comptime.c config.h.in)
set(SRB2_CORE_SOURCES
am_map.c
b_bot.c
command.c
comptime.c
console.c
d_clisrv.c
d_main.c
d_net.c
d_netcmd.c
d_netfil.c
d_protocol.c
dehacked.c
f_finale.c
f_wipe.c
filesrch.c
g_game.c
g_input.c
hu_stuff.c
i_tcp.c
info.c
lzf.c
m_aatree.c
m_anigif.c
m_argv.c
m_bbox.c
m_cheat.c
m_cond.c
m_fixed.c
m_menu.c
m_textinput.c
m_misc.c
m_perfstats.c
m_queue.c
m_random.c
md5.c
mserv.c
http-mserv.c
qs22j.c
s_sound.c
screen.c
sounds.c
st_stuff.c
#string.c
tables.c
v_video.c
w_wad.c
y_inter.c
z_zone.c
)
target_sources(SRB2SDL2 PRIVATE md5.c md5.h)
set(SRB2_CORE_HEADERS
am_map.h
b_bot.h
byteptr.h
command.h
console.h
d_clisrv.h
d_event.h
d_main.h
d_net.h
d_netcmd.h
d_netfil.h
d_player.h
d_protocol.h
d_think.h
d_ticcmd.h
dehacked.h
doomdata.h
doomdef.h
doomstat.h
doomtype.h
endian.h
f_finale.h
fastcmp.h
filesrch.h
g_game.h
g_input.h
g_state.h
hu_stuff.h
i_joy.h
i_net.h
i_sound.h
i_system.h
i_tcp.h
i_time.h
i_video.h
info.h
keys.h
lzf.h
m_aatree.h
m_anigif.h
m_argv.h
m_bbox.h
m_cheat.h
m_cond.h
m_dllist.h
m_fixed.h
m_menu.h
m_textinput.h
m_misc.h
m_queue.h
m_perfstats.h
m_random.h
m_swap.h
md5.h
mserv.h
qs22j.h
s_sound.h
screen.h
sounds.h
st_stuff.h
tables.h
v_video.h
w_wad.h
y_inter.h
z_zone.h
config.h.in
)
set(SRB2_CORE_RENDER_SOURCES
r_bsp.c
r_data.c
r_draw.c
r_fps.c
r_main.c
r_patch.c
r_patchrotation.c
r_plane.c
r_segs.c
r_sky.c
r_splats.c
r_things.c
r_portal.c
r_bsp.h
r_data.h
r_defs.h
r_draw.h
r_fps.h
r_local.h
r_main.h
r_patch.h
r_patchrotation.h
r_plane.h
r_segs.h
r_sky.h
r_splats.h
r_state.h
r_things.h
r_portal.h
)
set(SRB2_CORE_GAME_SOURCES
p_ceilng.c
p_enemy.c
p_floor.c
p_inter.c
p_lights.c
p_map.c
p_maputl.c
p_mobj.c
p_polyobj.c
p_saveg.c
p_setup.c
p_sight.c
p_slopes.c
p_spec.c
p_telept.c
p_tick.c
p_user.c
k_director.c
k_kart.c
k_stats.c
i_time.c
p_local.h
p_maputl.h
p_mobj.h
p_polyobj.h
p_pspr.h
p_saveg.h
p_setup.h
p_slopes.h
p_spec.h
p_tick.h
k_director.h
k_kart.h
k_stats.h
)
if(NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(SRB2_CORE_SOURCES ${SRB2_CORE_SOURCES} string.c)
endif()
prepend_sources(SRB2_CORE_SOURCES)
prepend_sources(SRB2_CORE_HEADERS)
prepend_sources(SRB2_CORE_RENDER_SOURCES)
prepend_sources(SRB2_CORE_GAME_SOURCES)
set(SRB2_CORE_HEADERS ${SRB2_CORE_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/config.h)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
### Configuration
set(SRB2_CONFIG_DEV_BUILD OFF CACHE BOOL
"Compile a development build of SRB2Kart.")
set(SRB2_CONFIG_HAVE_BLUA ON CACHE BOOL
"Enable Lua interpreter support")
set(SRB2_CONFIG_HAVE_PNG ON CACHE BOOL
"Enable PNG support. Depends on zlib, so will be disabled if you don't enable that too.")
set(SRB2_CONFIG_HAVE_ZLIB ON CACHE BOOL
"Enable zlib support.")
set(SRB2_CONFIG_HAVE_GME ON CACHE BOOL
"Enable GME support.")
set(SRB2_CONFIG_HAVE_OPENMPT ON CACHE BOOL
"Enable OpenMPT support.")
set(SRB2_CONFIG_HAVE_DISCORDRPC OFF CACHE BOOL
"Enable Discord rich presence support.")
set(SRB2_CONFIG_HAVE_CURL ON CACHE BOOL
"Enable curl support, used for downloading files via HTTP.")
set(SRB2_CONFIG_HWRENDER ON CACHE BOOL
"Enable hardware rendering through OpenGL.")
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
"Use statically linked OpenGL. NOT RECOMMENDED.")
set(SRB2_CONFIG_USE_FBO_OGL ON CACHE BOOL
"Enable OpenGL FBO Downsampling support.")
set(SRB2_CONFIG_DEDICATED OFF CACHE BOOL
"Build a dedicated server.")
set(SRB2_CONFIG_SKIP_COMPTIME OFF CACHE BOOL
"Skip Comptime rebuild.")
if(${SRB2_CONFIG_DEDICATED})
set(SRB2_CONFIG_HAVE_GME NO)
set(SRB2_CONFIG_HAVE_OPENMPT NO)
set(SRB2_CONFIG_HWRENDER NO)
endif()
if(NOT SRB2_CONFIG_SKIP_COMPTIME)
# This updates the modification time for comptime.c at the
# end of building so when the build system is ran next time,
# that file gets flagged. comptime.c will always be rebuilt.
#
# This begs the question, why always rebuild comptime.c?
# Some things like the git commit must be checked each time
# the program is built. But the build system determines which
# files should be rebuilt before anything else. So
# comptime.c, which only needs to be rebuilt based on
# information known at build time, must be told to rebuild
# before that information can be ascertained.
add_custom_command(
TARGET SRB2SDL2
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_SOURCE_DIR}/comptime.c
### use internal libraries?
if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
set(SRB2_CONFIG_USE_INTERNAL_LIBRARIES OFF CACHE BOOL
"Use SRB2Kart's internal copies of required dependencies (SDL2, PNG, zlib, GME, OpenMPT).")
endif()
if(${SRB2_CONFIG_HAVE_BLUA})
add_definitions(-DHAVE_BLUA)
set(SRB2_LUA_SOURCES
lua_baselib.c
lua_blockmaplib.c
lua_consolelib.c
lua_hooklib.c
lua_hudlib.c
lua_hudlib_drawlist.c
lua_infolib.c
lua_maplib.c
lua_mathlib.c
lua_mobjlib.c
lua_playerlib.c
lua_script.c
lua_skinlib.c
lua_thinkerlib.c
lua_udatalib.c
lua_glib.c
)
set(SRB2_LUA_HEADERS
lua_hook.h
lua_hud.h
lua_hudlib_drawlist.h
lua_libs.h
lua_script.h
lua_udatalib.h
lua_glib.h
)
prepend_sources(SRB2_LUA_SOURCES)
prepend_sources(SRB2_LUA_HEADERS)
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
set(SRB2_BLUA_SOURCES
blua/lapi.c
blua/lauxlib.c
blua/lbaselib.c
blua/ldblib.c
blua/lcode.c
blua/ldebug.c
blua/ldo.c
blua/ldump.c
blua/lfunc.c
blua/lgc.c
blua/linit.c
blua/liolib.c
blua/llex.c
blua/lmem.c
blua/lobject.c
blua/lopcodes.c
blua/lparser.c
blua/lstate.c
blua/lstring.c
blua/lstrlib.c
blua/ltable.c
blua/ltablib.c
blua/ltm.c
blua/lundump.c
blua/lvm.c
blua/lzio.c
)
set(SRB2_BLUA_HEADERS
blua/lapi.h
blua/lauxlib.h
blua/lcode.h
blua/ldebug.h
blua/ldo.h
blua/lfunc.h
blua/lgc.h
blua/llex.h
blua/llimits.h
blua/lmem.h
blua/lobject.h
blua/lopcodes.h
blua/lparser.h
blua/lstate.h
blua/lstring.h
blua/ltable.h
blua/ltm.h
blua/lua.h
blua/luaconf.h
blua/lualib.h
blua/lundump.h
blua/lvm.h
blua/lzio.h
)
prepend_sources(SRB2_BLUA_SOURCES)
prepend_sources(SRB2_BLUA_HEADERS)
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
endif()
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
add_custom_target(_SRB2_reconf ALL
COMMAND ${CMAKE_COMMAND} -DGIT_EXECUTABLE=${GIT_EXECUTABLE} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/.. -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Comptime.cmake
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.."
)
add_dependencies(SRB2SDL2 _SRB2_reconf)
if(SRB2_CONFIG_ASAN)
target_compile_options(SRB2SDL2 PRIVATE -fsanitize=address)
target_link_options(SRB2SDL2 PRIVATE -fsanitize=address)
endif()
if(SRB2_CONFIG_UBSAN)
target_compile_options(SRB2SDL2 PRIVATE -fsanitize=undefined)
target_link_options(SRB2SDL2 PRIVATE -fsanitize=undefined)
endif()
if(SRB2_CONFIG_TIDY)
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*")
endif()
add_subdirectory(blua)
add_subdirectory(sdl)
add_subdirectory(core)
# OS macros
if (UNIX)
target_compile_definitions(SRB2SDL2 PRIVATE -DUNIXCOMMON)
target_link_libraries(SRB2SDL2 PRIVATE -rdynamic) # Use -rdynamic so a backtrace log shows function names
endif()
if(CMAKE_COMPILER_IS_GNUCC)
find_program(OBJCOPY objcopy)
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
target_compile_definitions(SRB2SDL2 PRIVATE -DLINUX)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
target_compile_definitions(SRB2SDL2 PRIVATE -DLINUX64)
if(${SRB2_CONFIG_HAVE_GME})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(GME_FOUND ON)
set(GME_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/gme/include)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win64 -lgme")
else() # 32-bit
set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win32 -lgme")
endif()
else()
find_package(GME)
endif()
if(${GME_FOUND})
set(SRB2_HAVE_GME ON)
add_definitions(-DHAVE_LIBGME)
else()
message(WARNING "You have specified that GME is available but it was not found.")
endif()
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
target_compile_definitions(SRB2SDL2 PRIVATE -DMACOSX)
if(${SRB2_CONFIG_HAVE_DISCORDRPC})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(DISCORDRPC_FOUND ON)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(DISCORDRPC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/discord-rpc/win64-dynamic/include)
set(DISCORDRPC_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/discord-rpc/win64-dynamic/lib -ldiscord-rpc")
else() # 32-bit
set(DISCORDRPC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/discord-rpc/win32-dynamic/include)
set(DISCORDRPC_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/discord-rpc/win32-dynamic/lib -ldiscord-rpc")
endif()
else()
find_package(DiscordRPC)
endif()
if(${DISCORDRPC_FOUND})
set(SRB2_HAVE_DISCORDRPC ON)
add_definitions(-DHAVE_DISCORDRPC)
add_definitions(-DUSE_STUN)
set(SRB2_DISCORDRPC_SOURCES discord.c stun.c)
set(SRB2_DISCORDRPC_HEADERS discord.h stun.h)
prepend_sources(SRB2_DISCORDRPC_SOURCES)
prepend_sources(SRB2_DISCORDRPC_HEADERS)
source_group("Discord Rich Presence" FILES ${SRB2_DISCORDRPC_SOURCES} ${SRB2_DISCORDRPC_HEADERS})
else()
message(WARNING "You have specified that Discord Rich Presence is available but it was not found.")
endif()
endif()
# add toggle for this
target_link_libraries(SRB2SDL2 PRIVATE openmpt)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_OPENMPT)
target_link_libraries(SRB2SDL2 PRIVATE ZLIB::ZLIB PNG::PNG CURL::libcurl)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB -DHAVE_PNG -DHAVE_CURL -D_LARGEFILE64_SOURCE)
target_compile_definitions(SRB2SDL2 PRIVATE -DUSE_STUN)
if(SRB2_CONFIG_ENABLE_DISCORDRPC)
target_link_libraries(SRB2SDL2 PRIVATE DiscordRPC::DiscordRPC)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_DISCORDRPC)
target_sources(SRB2SDL2 PRIVATE discord.c)
endif()
if(${SRB2_CONFIG_LIBBACKTRACE})
target_link_libraries(SRB2SDL2 PRIVATE libbacktrace)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_LIBBACKTRACE)
endif()
# FIXME macOS does not support C11 threads.h
if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(SRB2_HAVE_THREADS ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
if(${SRB2_CONFIG_HAVE_OPENMPT})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(OPENMPT_FOUND ON)
set(OPENMPT_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/inc)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(OPENMPT_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libopenmpt/lib/x86_64/mingw -lopenmpt")
else() # 32-bit
set(OPENMPT_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/libopenmpt/lib/x86/mingw -lopenmpt")
endif()
else()
find_package(OPENMPT)
endif()
if(${OPENMPT_FOUND})
set(SRB2_HAVE_OPENMPT ON)
add_definitions(-DHAVE_OPENMPT)
else()
message(WARNING "You have specified that OpenMPT is available but it was not found.")
endif()
endif()
if(${SRB2_CONFIG_HAVE_ZLIB})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(ZLIB_FOUND ON)
set(ZLIB_COMPAT ON)
set(WITH_GTEST OFF)
set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/zlib)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(ZLIB_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/zlib/win32 -lz64")
@@ -152,9 +419,9 @@ if(${SRB2_CONFIG_HAVE_ZLIB})
endif()
if(${ZLIB_FOUND})
set(SRB2_HAVE_ZLIB ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB)
add_definitions(-DHAVE_ZLIB)
else()
message(WARNING "You have specified that ZLIB is available but it was not found. SRB2Kart-Saturn may not compile correctly.")
message(WARNING "You have specified that ZLIB is available but it was not found. SRB2Kart may not compile correctly.")
endif()
endif()
@@ -173,292 +440,129 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
endif()
if(${PNG_FOUND})
set(SRB2_HAVE_PNG ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_PNG)
target_compile_definitions(SRB2SDL2 PRIVATE -D_LARGEFILE64_SOURCE)
add_definitions(-DHAVE_PNG)
add_definitions(-D_LARGEFILE64_SOURCE)
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS})
else()
message(WARNING "You have specified that PNG is available but it was not found. SRB2Kart-Saturn may not compile correctly.")
message(WARNING "You have specified that PNG is available but it was not found. SRB2Kart may not compile correctly.")
endif()
endif()
endif()
if("${SRB2_CONFIG_HWRENDER}")
target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
add_subdirectory(hardware)
if("${SRB2_CONFIG_STATIC_OPENGL}")
find_package(OpenGL)
if(${OPENGL_FOUND})
target_compile_definitions(SRB2SDL2 PRIVATE -DSTATIC_OPENGL)
else()
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.")
if(${SRB2_CONFIG_HAVE_CURL})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(CURL_FOUND ON)
set(CURL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/curl/include)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(CURL_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/curl/lib64 -lcurl")
else() # 32-bit
set(CURL_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/curl/lib32 -lcurl")
endif()
else()
find_package(CURL)
endif()
if(${CURL_FOUND})
set(SRB2_HAVE_CURL ON)
add_definitions(-DHAVE_CURL)
else()
message(WARNING "You have specified that CURL is available but it was not found. SRB2Kart may not compile correctly.")
endif()
endif()
# TODO: build this with the game
if(${CMAKE_SYSTEM} MATCHES Windows AND ${CMAKE_C_COMPILER_ID} MATCHES "GNU" AND ${SRB2_SYSTEM_BITS} EQUAL 32)
target_link_libraries(SRB2SDL2 PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/lib/win32/libexchndl.a"
"${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/lib/win32/libmgwhelp.a"
if(${SRB2_CONFIG_HWRENDER})
add_definitions(-DHWRENDER)
set(SRB2_HWRENDER_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_shaders.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.c
)
target_include_directories(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/include")
set (SRB2_HWRENDER_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_batching.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_shaders.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_gl.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_model.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/u_list.h
)
set(SRB2_R_OPENGL_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.c
)
set(SRB2_R_OPENGL_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/hardware/r_opengl/r_opengl.h
)
endif()
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL})
find_package(OpenGL)
if(${OPENGL_FOUND})
add_definitions(-DHWRENDER)
add_definitions(-DSTATIC_OPENGL)
else()
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.")
endif()
endif()
if(${SRB2_CONFIG_HWRENDER})
if(${SRB2_CONFIG_USE_FBO_OGL})
set(SRB2_USE_FBO_OGL ON)
add_definitions(-DUSE_FBO_OGL)
endif()
endif()
# Targets
# If using CCACHE, then force it.
# https://github.com/Cockatrice/Cockatrice/pull/3052/files
if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
get_property(RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
if(RULE_LAUNCH_COMPILE)
MESSAGE(STATUS "Force enabling CCache usage under macOS")
# Set up wrapper scripts
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/launch-c.in ${CMAKE_BINARY_DIR}/launch-c)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/launch-cxx.in ${CMAKE_BINARY_DIR}/launch-cxx)
execute_process(COMMAND chmod a+rx
"${CMAKE_BINARY_DIR}/launch-c"
"${CMAKE_BINARY_DIR}/launch-cxx")
# Set Xcode project attributes to route compilation through our scripts
set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/launch-cxx")
set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/launch-c")
set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/launch-cxx")
endif()
endif()
# Compatibility flag with later versions of GCC
# We should really fix our code to not need this
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|x64|amd64|AMD64|em64t|EM64T)")
target_compile_options(SRB2SDL2 PRIVATE -mno-ms-bitfields)
endif()
target_compile_options(SRB2SDL2 PRIVATE -Wno-trigraphs)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields)
endif()
# TODO: fix prng and P_CreateBlockmap overflow at some point
target_compile_options(SRB2SDL2 PRIVATE -fwrapv)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value)
endif()
if (${CMAKE_BUILD_TYPE} MATCHES Debug)
target_compile_options(SRB2SDL2 PRIVATE -O0)
target_compile_options(SRB2SDL2 PRIVATE -g)
add_definitions(-DCMAKECONFIG)
#add_library(SRB2Core STATIC
# ${SRB2_CORE_SOURCES}
# ${SRB2_CORE_HEADERS}
# ${SRB2_CORE_RENDER_SOURCES}
# ${SRB2_CORE_GAME_SOURCES}
# ${SRB2_LUA_SOURCES}
# ${SRB2_LUA_HEADERS}
# ${SRB2_BLUA_SOURCES}
# ${SRB2_BLUA_HEADERS}
#)
if(${SRB2_CONFIG_DEDICATED})
add_subdirectory(dedicated)
else()
target_compile_options(SRB2SDL2 PRIVATE -O3)
target_compile_options(SRB2SDL2 PRIVATE -g1) #should be enough for libbacktrace
add_subdirectory(sdl)
endif()
# Compiler warnings configuration
target_compile_options(SRB2SDL2 PRIVATE
# Using generator expressions to handle per-language compile options
# C, GNU
# This is a direct translation from versions.mk
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:GNU>>:
-Wall
-Wextra
-Wno-trigraphs
-W # Was controlled by RELAXWARNINGS
-Wfloat-equal
-Wundef
-Wpointer-arith
-Wbad-function-cast
-Wcast-qual
-Wcast-align # Was controlled by NOCASTALIGNWARN
-Wwrite-strings
-Wsign-compare
-Wno-comment
-Wno-alloc-size-larger-than # holy shit, be quiet up GCC
-Wmissing-prototypes
-Wmissing-declarations
-Wmissing-noreturn
-Wnested-externs
-Wformat-y2k
-Wformat-security
$<$<VERSION_LESS:$<C_COMPILER_VERSION>,2.9.5>:
-Wno-div-by-zero
-Wendif-labels
-Wdisabled-optimization
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.0.0>:
-Wold-style-definition
-Wmissing-field-initializers
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.1.0>:
-Wshadow
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.3.0>:
-funit-at-a-time
-Wlogical-op
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.5.0>:
-Wlogical-op
-Wno-error=array-bounds
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.6.0>:
-Wno-suggest-attribute=noreturn
-Wno-error=suggest-attribute=noreturn
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,5.4.0>:
-Wno-logical-op
-Wno-error=logical-op
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,6.1.0>:
-Wno-tautological-compare
-Wno-error=tautological-compare
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,7.1.0>:
-Wno-error=format-overflow=2
-Wimplicit-fallthrough=4
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,8.1.0>:
-Wno-error=format-overflow
-Wno-error=stringop-truncation
-Wno-error=stringop-overflow
-Wno-format-overflow
-Wno-stringop-truncation
-Wno-stringop-overflow
-Wno-error=multistatement-macros
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,9.1.0>:
-Wno-error=address-of-packed-member
>
>
# C, Clang and Apple Clang
$<$<AND:$<COMPILE_LANGUAGE:C>,$<OR:$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>:
-Wall
-Wextra
-Wno-absolute-value
-Wno-trigraphs
-Wno-error=non-literal-null-conversion
-Wno-error=constant-conversion
-Wno-unused-but-set-variable
-Wno-error=unused-but-set-variable
>
# C++, GNU, Clang and Apple Clang
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>:
-Wall
-Wno-unused-function
-Wno-unused-but-set-variable
-Wno-unused-private-field
>
# GNU
$<$<C_COMPILER_ID:GNU>:
-fmax-errors=5
>
)
if(SRB2_CONFIG_ERRORMODE)
target_compile_options(SRB2SDL2 PRIVATE
$<$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>:
-Werror
>
)
endif()
# Link warnings configuration
target_link_options(SRB2SDL2 PRIVATE
$<$<C_COMPILER_ID:GNU>:
# -Wl,--as-needed - Was controlled by NOLDWARNING
>
)
if(${SRB2_CONFIG_DEV_BUILD})
target_compile_definitions(SRB2SDL2 PRIVATE -DDEVELOP)
endif()
target_compile_definitions(SRB2SDL2 PRIVATE -DCMAKECONFIG)
# Misc. build options from Makefiles
if(SRB2_CONFIG_DEBUGMODE)
target_compile_definitions(SRB2SDL2 PRIVATE -D_DEBUG -DZDEBUG -DPARANOIA -DRANGECHECK -DPACKETDROP)
endif()
if(SRB2_CONFIG_MOBJCONSISTANCY)
target_compile_definitions(SRB2SDL2 PRIVATE -DMOBJCONSISTANCY)
endif()
if(SRB2_CONFIG_PACKETDROP)
target_compile_definitions(SRB2SDL2 PRIVATE -DPACKETDROP)
endif()
if(SRB2_CONFIG_ZDEBUG)
target_compile_definitions(SRB2SDL2 PRIVATE -DZDEBUG)
endif()
if(SRB2_CONFIG_PROFILEMODE AND "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(SRB2SDL2 PRIVATE -pg)
target_link_options(SRB2SDL2 PRIVATE -pg)
endif()
if(SRB2_CONFIG_LTO AND NOT SRB2_CONFIG_DEBUGMODE)
set_property(TARGET SRB2SDL2 PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
if(${SRB2_CONFIG_SCREENFBO} AND NOT ${SRB2_CONFIG_STATIC_OPENGL})
target_compile_definitions(SRB2SDL2 PRIVATE -DUSE_FBO_OGL)
endif()
if(${SRB2_CONFIG_SATURNPAK})
target_compile_definitions(SRB2SDL2 PRIVATE -DDOSATURNPAK)
endif()
if(${SRB2_CONFIG_SATURNJOIN})
target_compile_definitions(SRB2SDL2 PRIVATE -DDOSATURNJOIN)
endif()
# strip debug symbols into separate file when using gcc or clang.
# to be consistent with Makefile, don't generate for OS X.
if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT ("${CMAKE_SYSTEM_NAME}" MATCHES Darwin))
if((${CMAKE_BUILD_TYPE} MATCHES Debug) OR (${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo))
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
set(OBJCOPY_ONLY_KEEP_DEBUG "--only-keep-debug")
endif()
message(STATUS "Will make separate debug symbols in *.debug")
add_custom_command(TARGET SRB2SDL2 POST_BUILD
COMMAND ${CMAKE_OBJCOPY} ${OBJCOPY_ONLY_KEEP_DEBUG} $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
# mold linker: .gnu_debuglink is present by default, so --add-gnu-debuglink would fail
COMMAND ${CMAKE_OBJCOPY} --strip-debug --remove-section=.gnu_debuglink $<TARGET_FILE:SRB2SDL2>
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
)
endif()
endif()
# copy DLLs to bin/ directory if building internal shared on windows
if("${CMAKE_SYSTEM_NAME}" STREQUAL Windows AND NOT "${SRB2_CONFIG_INTERNAL_LIBRARIES}" AND "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
set(ADDITIONAL_DLLS "")
if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# also copy implicitly linked system libraries
get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH)
if("${CMAKE_C_COMPILER_ID}" STREQUAL GNU)
list(APPEND ADDITIONAL_DLLS
"libgcc_s_dw2-1.dll"
"libstdc++-6.dll"
"libwinpthread-1.dll"
)
else()
list(APPEND ADDITIONAL_DLLS
"libunwind.dll"
"libc++.dll"
"libwinpthread-1.dll"
)
endif()
list(TRANSFORM ADDITIONAL_DLLS PREPEND "${MINGW_BIN_PATH}/")
endif()
add_custom_command(TARGET SRB2SDL2 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_RUNTIME_DLLS:SRB2SDL2>
${ADDITIONAL_DLLS}
$<TARGET_FILE_DIR:SRB2SDL2>
COMMAND_EXPAND_LISTS
COMMENT "Copying runtime DLLs"
)
if(NOT ${SRB2_SDL2_AVAILABLE} AND NOT ${SRB2_WIN32_AVAILABLE})
message(FATAL_ERROR "There are no targets available to build an SRB2Kart executable. :(")
endif()
+1 -1
View File
@@ -8,6 +8,7 @@ passthru_opts+=\
HAVE_MINIUPNPC\
HAVE_DISCORDRPC DEVELOP\
NOHOLEPUNCH\
NOOPENMPT\
# build with debugging information
ifdef DEBUGMODE
@@ -91,7 +92,6 @@ endif
default_packages:=\
LIBGME/libgme/LIBGME\
OPENMPT/libopenmpt/LIBOPENMPT\
ZLIB/zlib\
$(foreach p,$(default_packages),\
+13 -9
View File
@@ -29,8 +29,19 @@ ifndef NOHW
sources+=sdl/ogl_sdl.c
endif
ifndef NOOPENMPT
LIBOPENMPT_PKGCONFIG?=libopenmpt
$(eval $(call Use_pkg_config,LIBOPENMPT))
opts+=-DHAVE_OPENMPT
endif
NOMIXER=1
ifdef NOMIXER
sources+=sdl/dummy_sound.c
#sources+=sdl/dummy_sound.c
sources+=sdl/sdl_sound.c
SNDFILE_PKGCONFIG?=sndfile
$(eval $(call Use_pkg_config,SNDFILE))
else
opts+=-DHAVE_MIXER
sources+=sdl/mixer_sound.c
@@ -45,15 +56,8 @@ opts+=-DHAVE_THREADS
sources+=sdl/i_threads.c
endif
ifdef SDL_PKGCONFIG
SDL_PKGCONFIG?=sdl3
$(eval $(call Use_pkg_config,SDL))
else
SDL_CONFIG?=$(call Prefix,sdl2-config)
SDL_CFLAGS?=$(shell $(SDL_CONFIG) --cflags)
SDL_LDFLAGS?=$(shell $(SDL_CONFIG) \
$(if $(STATIC),--static-libs,--libs))
$(eval $(call Propogate_flags,SDL))
endif
ifdef MINGW
ifndef NOSDLMAIN
+3 -3
View File
@@ -79,14 +79,14 @@ $(eval $(call _set,LIBOPENMPT))
lib:=../libs/SDL2_mixer/$(mingw)
ifdef SDL
mixer_opts:=-I$(lib)/include/SDL2
mixer_opts:=-I$(lib)/include/SDL3
mixer_libs:=-L$(lib)/lib
lib:=../libs/SDL2/$(mingw)
SDL_opts:=-I$(lib)/include/SDL2\
SDL_opts:=-I$(lib)/include/SDL3\
$(mixer_opts) -Dmain=SDL_main
SDL_libs:=-L$(lib)/lib $(mixer_libs)\
-lmingw32 -lSDL2main -lSDL2 -mwindows
-lmingw32 -lSDL3main -lSDL3 -mwindows
$(eval $(call _set,SDL))
endif
+1 -1
View File
@@ -1,4 +1,3 @@
string.c
am_map.c
b_bot.c
command.c
@@ -43,6 +42,7 @@ s_sound.c
screen.c
sounds.c
st_stuff.c
string.c
tables.c
v_video.c
w_wad.c
+11 -11
View File
@@ -47,7 +47,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
if (sonic->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
{
cmd->forwardmove = sonic->player->cmd.forwardmove;
cmd->angleturn = abs((signed)(tails->angle - sonic->angle)) >> TICCMD_REDUCE;
cmd->angleturn = abs((signed)(tails->angle - sonic->angle))>>16;
if (sonic->angle < tails->angle)
cmd->angleturn = -cmd->angleturn;
} else if (dist > FixedMul(512*FRACUNIT, tails->scale))
@@ -139,13 +139,13 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
// Don't mess with bot inputs during these unhandled movement conditions.
// The normal AI doesn't use abilities, so custom AI should be sending us exactly what it wants anyway.
if (forward)
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
if (backward)
cmd->forwardmove -= MAXPLMOVE<<FRACBITS >> TICCMD_REDUCE;
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
if (left || strafeleft)
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
if (right || straferight)
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
} else {
// In standard 2D mode, interpret "forward" as "the way you're facing" and everything else as "the way you're not facing"
if (left || right)
@@ -163,23 +163,23 @@ void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward
right = true;
}
if (left || strafeleft)
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
if (right || straferight)
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
}
} else {
if (forward)
cmd->forwardmove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
cmd->forwardmove += MAXPLMOVE<<FRACBITS>>16;
if (backward)
cmd->forwardmove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
cmd->forwardmove -= MAXPLMOVE<<FRACBITS>>16;
if (left)
cmd->angleturn += 1280;
if (right)
cmd->angleturn -= 1280;
if (strafeleft)
cmd->sidemove -= MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
cmd->sidemove -= MAXPLMOVE<<FRACBITS>>16;
if (straferight)
cmd->sidemove += MAXPLMOVE << FRACBITS >> TICCMD_REDUCE;
cmd->sidemove += MAXPLMOVE<<FRACBITS>>16;
}
if (jump)
cmd->buttons |= BT_DRIFT;
-1
View File
@@ -1 +0,0 @@
target_sourcefile(c)
-51
View File
@@ -93,57 +93,6 @@ LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
/* }====================================================== */
/*
** {======================================================
** 'luaL_resourcetryagain'
** This function uses 'errno' to check whether the last error was
** related to lack of resources (e.g., not enough memory or too many
** open files). If so, the function performs a full garbage collection
** to try to release resources, and then it returns 1 to signal to
** the caller that it is worth trying again the failed operation.
** Otherwise, it returns 0. Because error codes are not ANSI C, the
** code must handle any combination of error codes that are defined.
** =======================================================
*/
LUALIB_API int luaL_resourcetryagain (lua_State *L) {
/* these are the resource-related errors in Linux */
#if defined(EMFILE) || defined(ENFILE) || defined(ENOMEM)
#if !defined(EMFILE) /* too many open files in the process */
#define EMFILE -1 /* if not defined, use an impossible value */
#endif
#if !defined(ENFILE) /* too many open files in the system */
#define ENFILE -1
#endif
#if !defined(ENOMEM) /* not enough memory */
#define ENOMEM -1
#endif
if (errno == EMFILE || errno == ENFILE || errno == ENOMEM) {
CONS_Alert(CONS_WARNING, "%s, force calling lua garbage collector\n", strerror(errno));
lua_gc(L, LUA_GCCOLLECT, 0); /* try to release resources with a full GC */
return 1; /* signal to try again the creation */
}
#endif
return 0; /* else, asume errors are not due to lack of resources */
}
/* }====================================================== */
/*
** {======================================================
** Userdata's metatable manipulation
** =======================================================
*/
LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def,
const char *const lst[]) {
const char *name = (def) ? luaL_optstring(L, narg, def) :
-2
View File
@@ -95,8 +95,6 @@ LUALIB_API FUNCREPORT int (luaL_error) (lua_State *L, const char *fmt, ...);
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
const char *const lst[]);
LUALIB_API int (luaL_resourcetryagain) (lua_State *L);
LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
+15 -23
View File
@@ -58,6 +58,12 @@ static int pushresult (lua_State *L, int i, const char *filename) {
}
static void fileerror (lua_State *L, int arg, const char *filename) {
lua_pushfstring(L, "%s: %s", filename, strerror(errno));
luaL_argerror(L, arg, lua_tostring(L, -1));
}
#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE))
@@ -159,24 +165,6 @@ static int StartsWith(const char *a, const char *b) // this is wolfs being lazy
return 0;
}
/*
** Equivalent to 'fopen', but if it fails due to a lack of resources
** (see 'luaL_resourcetryagain'), do an "emergency" garbage collection to try
** to close some files and then tries to open the file again.
*/
static FILE *trytoopen (lua_State *L, const char *path, const char *mode) {
FILE *f = fopen(path, mode);
if (f == NULL && luaL_resourcetryagain(L)) /* resource failure? */
f = fopen(path, mode); /* try to open again */
return f;
}
static void opencheck (lua_State *L, const char *fname, const char *mode) {
FILE **p = newfile(L);
*p = trytoopen(L, fname, mode);
if (l_unlikely(*p == NULL))
luaL_error(L, "cannot open file '%s' (%s)", fname, strerror(errno));
}
static int io_open(lua_State *L)
{
@@ -224,7 +212,7 @@ static int io_open(lua_State *L)
}
pf = newfile(L);
*pf = trytoopen(L, destFilename, mode);
*pf = fopen(destFilename, mode);
return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
}
@@ -232,8 +220,6 @@ static int io_open(lua_State *L)
static int io_tmpfile (lua_State *L) {
FILE **pf = newfile(L);
*pf = tmpfile();
if (*pf == NULL && luaL_resourcetryagain(L)) /* resource failure? */
*pf = tmpfile(); /* try to open again */
return (*pf == NULL) ? pushresult(L, 0, NULL) : 1;
}
@@ -252,7 +238,10 @@ static int g_iofile (lua_State *L, int f, const char *mode) {
if (!lua_isnoneornil(L, 1)) {
const char *filename = lua_tostring(L, 1);
if (filename) {
opencheck(L, filename, mode);
FILE **pf = newfile(L);
*pf = fopen(filename, mode);
if (l_unlikely(*pf == NULL))
fileerror(L, 1, filename);
}
else {
tofile(L); /* check that it's a valid file handle */
@@ -301,7 +290,10 @@ static int io_lines (lua_State *L) {
}
else {
const char *filename = luaL_checkstring(L, 1);
opencheck(L, filename, "r");
FILE **pf = newfile(L);
*pf = fopen(filename, "r");
if (l_unlikely(*pf == NULL))
fileerror(L, 1, filename);
aux_lines(L, lua_gettop(L), 1);
return 1;
}
+2 -2
View File
@@ -655,7 +655,7 @@ static void COM_Alias_f(void)
CONS_Printf(M_GetText("All aliases that start with \x87'%s'\x80 are:\n"), begin);
int count = 0;
for (cmdalias_t *head = com_alias; head != NULL; head = head->next)
for (cmdalias_t *head = com_alias; head->next != NULL; head = head->next)
{
if (strncmp(begin, head->name, szBegin) == 0)
{
@@ -676,7 +676,7 @@ static void COM_Alias_f(void)
/* Display alias subtext, show all aliases. */
CONS_Printf(M_GetText("alias <name> <command>: create a shortcut command that executes other command(s)\n"));
for (cmdalias_t *head = com_alias; head != NULL; head = head->next)
for (cmdalias_t *head = com_alias; head->next != NULL; head = head->next)
{
CONS_Printf(alias_format, head->name, head->value);
}
+3 -3
View File
@@ -13,13 +13,13 @@
#ifndef __COMMAND_H__
#define __COMMAND_H__
#include <stdio.h>
#include "doomdef.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "doomdef.h"
//===================================
// Command buffer & command execution
//===================================
+38 -3
View File
@@ -11,6 +11,21 @@
#ifdef CMAKECONFIG
// Base SRB2 hashes
#define ASSET_HASH_SRB2_SRB "${SRB2_ASSET_srb2.srb_HASH}"
#ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}"
#endif
// SRB2Kart-specific hashes
#define ASSET_HASH_GFX_KART "${SRB2_ASSET_gfx.kart_HASH}"
#define ASSET_HASH_TEXTURES_KART "${SRB2_ASSET_textures.kart_HASH}"
#define ASSET_HASH_CHARS_KART "${SRB2_ASSET_chars.kart_HASH}"
#define ASSET_HASH_MAPS_KART "${SRB2_ASSET_maps.kart_HASH}"
#ifdef USE_PATCH_KART
#define ASSET_HASH_PATCH_KART "00000000000000000000000000000000"
#endif
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
@@ -18,10 +33,30 @@
#else
#define SRB2_COMP_REVISION ""
#define SRB2_COMP_BRANCH ""
/* Manually defined asset hashes for non-CMake builds
* Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb
* Last updated 2018 / 12 / 23 - SRB2 v2.1.22 - patch.dta
* Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets
* Last updated 2020 / 08 / 30 - Kart v1.3 - patch.kart
* Last updated 2022 / 08 / 16 - Kart v1.4 - Main assets
* Last updated 2022 / 08 / 19 - Kart v1.5 - gfx.kart
* Last updated 2022 / 11 / 01 - Kart v1.6 - gfx.kart, maps.kart
*/
#define CMAKE_ASSETS_DIR ""
// 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
#endif
#endif
+4 -12
View File
@@ -169,8 +169,6 @@ static CV_PossibleValue_t menuhighlight_cons_t[] =
};
consvar_t cons_menuhighlight = {"menuhighlight", "Gametype Default", CV_SAVE, menuhighlight_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cons_consoleprintinmenu = {"consoleprintinmenu", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static void CON_Print(char *msg);
//
@@ -428,7 +426,6 @@ void CON_Init(void)
CV_RegisterVar(&cons_backpic);
CV_RegisterVar(&cons_backcolor);
CV_RegisterVar(&cons_menuhighlight);
CV_RegisterVar(&cons_consoleprintinmenu);
COM_AddCommand("bind", CONS_Bind_f);
}
else
@@ -589,18 +586,12 @@ static void CON_ChangeHeight(void)
// Handles Console moves in/out of screen (per frame)
//
void CON_MoveConsole(void)
static void CON_MoveConsole(void)
{
static fixed_t fracmovement = 0;
Lock_state();
if (con_curlines == con_destlines)
{
Unlock_state();
return;
}
// instant
if (!cons_speed.value)
{
@@ -1593,12 +1584,13 @@ void CON_Drawer(void)
}
// console movement
CON_MoveConsole();
if (con_curlines != con_destlines)
CON_MoveConsole();
if (con_curlines > 0)
CON_DrawConsole();
else if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_CUTSCENE || gamestate == GS_CREDITS
|| gamestate == GS_VOTING || gamestate == GS_EVALUATION || gamestate == GS_WAITINGPLAYERS || (cons_consoleprintinmenu.value && gamestate == GS_TITLESCREEN))
|| gamestate == GS_VOTING || gamestate == GS_EVALUATION || gamestate == GS_WAITINGPLAYERS)
CON_DrawHudlines();
Unlock_state();
-2
View File
@@ -36,7 +36,6 @@ extern INT32 con_destlines;
extern UINT32 con_scalefactor; // console text scale factor
extern consvar_t cons_backcolor, cons_menuhighlight;
extern consvar_t cons_consoleprintinmenu;
extern UINT8 *yellowmap, *purplemap, *greenmap, *bluemap, *graymap, *redmap, *orangemap,\
*skymap, *goldmap, *lavendermap, *teamap, *steelmap, *pinkmap, *brownmap, *peachmap;
@@ -52,7 +51,6 @@ void CON_ClearHUD(void); // clear heads up messages
void CON_Ticker(void);
void CON_Drawer(void);
void CON_MoveConsole(void);
void CONS_Error(const char *msg); // print out error msg, and wait a key
// force console to move out
+51 -32
View File
@@ -1777,9 +1777,6 @@ static void SV_SendPlayerInfo(INT32 node)
static void SV_SendMapIcon(INT32 node)
{
if (node == 0)
return;
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
const char *map = va("%sP", G_BuildMapName(gamemap));
@@ -2074,7 +2071,6 @@ static void CL_LoadReceivedSavegame(boolean reloading)
length = FIL_ReadFile(tmpsave, &save.buffer);
CONS_Printf(M_GetText("Loading savegame length %s\n"), sizeu1(length));
if (!length)
{
I_Error("Can't read savegame sent");
@@ -2158,7 +2154,7 @@ static void CL_ReloadReceivedSavegame(void)
// we dont have P_ForceLocalAngle so were setting it manually here
for (i = 0; i <= splitscreen; i++)
{
P_ForceLocalAngle(&players[displayplayers[i]], (angle_t)(players[displayplayers[i]].cmd.angleturn << TICCMD_REDUCE));
P_ForceLocalAngle(&players[displayplayers[i]], (angle_t)(players[displayplayers[i]].cmd.angleturn << 16));
}
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
@@ -2197,8 +2193,12 @@ static void SendAskInfo(INT32 node)
HSendPacket(node, false, 0, sizeof (askinfo_pak));
}
serverelem_t serverlist[MAXSERVERLIST] = {};
serverelem_t serverlist[MAXSERVERLIST];
UINT32 serverlistcount = 0;
UINT32 serverlistultimatecount = 0;
static boolean resendserverlistnode[MAXNETNODES];
static tic_t serverlistepoch;
static void SL_ClearServerList(INT32 connectedserver)
{
@@ -2211,7 +2211,8 @@ static void SL_ClearServerList(INT32 connectedserver)
serverlist[i].node = 0;
}
serverlistcount = 0;
//memset(serverlist, 0, sizeof(serverlist));
memset(resendserverlistnode, 0, sizeof resendserverlistnode);
}
static UINT32 SL_SearchServer(INT32 node)
@@ -2228,6 +2229,8 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
{
UINT32 i;
resendserverlistnode[node] = false;
// search if not already on it
i = SL_SearchServer(node);
if (i == UINT32_MAX)
@@ -2261,7 +2264,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
M_SortServerList();
}
void CL_UpdateServerList(void)
void CL_UpdateServerList (void)
{
SL_ClearServerList(0);
@@ -2279,12 +2282,14 @@ void CL_UpdateServerList(void)
SendAskInfo(BROADCASTADDR);
}
void CL_QueryServerList(msg_server_t *server_list)
void CL_QueryServerList (msg_server_t *server_list)
{
INT32 i;
CL_UpdateServerList();
serverlistepoch = I_GetTime();
for (i = 0; server_list[i].header.buffer[0]; i++)
{
// Make sure MS version matches our own, to
@@ -2297,20 +2302,42 @@ void CL_QueryServerList(msg_server_t *server_list)
if (node == -1)
continue; // no more node free, or resolution failure
SendAskInfo(node);
resendserverlistnode[node] = true;
// Leave this node open. It'll be closed if the
// request times out (CL_TimeoutServerList).
}
}
// Force close the connection so that servers can't eat
// up nodes forever if we never get a reply back from them
// (usually when they've not forwarded their ports).
//
// Don't worry, we'll get in contact with the working
// servers again when they send SERVERINFO to us later!
//
// (Note: as a side effect this probably means every
// server in the list will probably be using the same node (e.g. node 1),
// not that it matters which nodes they use when
// the connections are closed afterwards anyway)
// -- Monster Iestyn 12/11/18
Net_CloseConnection(node|FORCECLOSE);
serverlistultimatecount = i;
}
#define SERVERLISTRESENDRATE NEWTICRATE
void CL_TimeoutServerList(void)
{
if (netgame && serverlistultimatecount > serverlistcount)
{
const tic_t timediff = I_GetTime() - serverlistepoch;
const tic_t timetoresend = timediff % SERVERLISTRESENDRATE;
const boolean timedout = timediff > connectiontimeout;
if (timedout || (timediff > 0 && timetoresend == 0))
{
INT32 node;
for (node = 1; node < MAXNETNODES; ++node)
{
if (resendserverlistnode[node])
{
if (timedout)
Net_CloseConnection(node|FORCECLOSE);
else
SendAskInfo(node);
}
}
if (timedout)
serverlistultimatecount = serverlistcount;
}
}
}
@@ -3477,9 +3504,6 @@ void CL_Reset(void)
memset(player_muted, 0, sizeof(player_muted));
for (INT32 i = 0; i < MAXPLAYERS; ++i)
playerinfo[i].node = 255;
// D_StartTitle should get done now, but the calling function will handle it
}
@@ -4268,9 +4292,6 @@ void D_ClientServerInit(void)
#endif
D_LoadBan(false);
for (INT32 i = 0; i < MAXPLAYERS; ++i)
playerinfo[i].node = 255;
gametic = 0;
localgametic = 0;
@@ -4506,7 +4527,7 @@ static void Got_AddPlayer(const UINT8 **p, INT32 playernum)
DEBFILE("spawning me\n");
}
P_ForceLocalAngle(&players[newplayernum], (angle_t)(players[newplayernum].cmd.angleturn << TICCMD_REDUCE));
P_ForceLocalAngle(&players[newplayernum], (angle_t)(players[newplayernum].cmd.angleturn << 16));
D_SendPlayerConfig();
addedtogame = true;
@@ -6453,7 +6474,6 @@ static void SV_SendTics(void)
continue;
DEBFILE(va("Sent %d anyway\n", realfirsttic));
}
realfirsttic = max(realfirsttic, firstticstosend);
// compute the length of the packet and cut it if too large
@@ -6599,8 +6619,7 @@ void SV_SpawnPlayer(INT32 playernum, INT32 x, INT32 y, angle_t angle)
// -- Monster Iestyn 16/01/18
break;
}
netcmds[tic%BACKUPTICS][playernum].angleturn = (INT16)((angle >> TICCMD_REDUCE) | TICCMD_RECEIVED);
netcmds[tic%BACKUPTICS][playernum].angleturn = (INT16)((angle>>16) | TICCMD_RECEIVED);
if (!tic) // failsafe for gametic == 0 -- Monster Iestyn 16/01/18
break;
+2
View File
@@ -516,6 +516,7 @@ typedef struct
extern serverelem_t serverlist[MAXSERVERLIST];
extern UINT32 serverlistcount;
extern UINT32 serverlistultimatecount;
extern INT32 mapchangepending;
// Points inside doomcom
@@ -626,6 +627,7 @@ void CL_ClearPlayer(INT32 playernum);
void CL_RemovePlayer(INT32 playernum, INT32 reason);
void CL_QueryServerList(msg_server_t *list);
void CL_UpdateServerList(void);
void CL_TimeoutServerList(void);
void CL_AbortConnection(void);
+5 -29
View File
@@ -80,31 +80,6 @@
#include "lua_script.h"
/* Manually defined asset hashes for non-CMake builds
* Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb
* Last updated 2018 / 12 / 23 - SRB2 v2.1.22 - patch.dta
* Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets
* Last updated 2020 / 08 / 30 - Kart v1.3 - patch.kart
* Last updated 2022 / 08 / 16 - Kart v1.4 - Main assets
* Last updated 2022 / 08 / 19 - Kart v1.5 - gfx.kart
* Last updated 2022 / 11 / 01 - Kart v1.6 - gfx.kart, maps.kart
*/
// Base SRB2 hashes
#define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7"
#ifdef USE_PATCH_DTA
#define ASSET_HASH_PATCH_DTA "b04fd9624bfd94dc96dcf4f400f7deb4"
#endif
// SRB2Kart-specific hashes
#define ASSET_HASH_GFX_KART "06f86ee16136eb8a7043b15001797034"
#define ASSET_HASH_TEXTURES_KART "abb53d56aba47c3a8cb0f764da1c8b80"
#define ASSET_HASH_CHARS_KART "e2c428347dde52858a3dacd29fc5b964"
#define ASSET_HASH_MAPS_KART "d051e55141ba736582228c456953cd98"
#ifdef USE_PATCH_KART
#define ASSET_HASH_PATCH_KART "00000000000000000000000000000000"
#endif
#ifdef CMAKECONFIG
#include "config.h"
#else
@@ -817,9 +792,9 @@ void D_SRB2Loop(void)
}
else if (!dedicated)
{
// always update console movement
// otherwise it will takes literal ages to open
CON_MoveConsole();
// always update console and hud
// otherwise it may take minutes to open it
CON_Drawer();
}
}
@@ -910,6 +885,7 @@ void D_ClearState(void)
CURLAbortFile();
SV_StopServer();
SV_ResetServer();
serverlistultimatecount = 0;
for (i = 0; i < MAXPLAYERS; i++)
CL_ClearPlayer(i);
@@ -1288,7 +1264,7 @@ static void IdentifyVersion(void)
if (AddIWAD("extra3.kart", srb2waddir))
found_extra3_kart = true;
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
#if defined (HAVE_SDL)
#define MUSICTEST(str) \
musicpath = va(pandf, srb2waddir, str);\
handle = W_OpenWadFile(&musicpath, false); \
+1 -7
View File
@@ -492,7 +492,6 @@ void Net_AckTicker(void)
ackpak[i].acknum = 0;
continue;
}
DEBFILE(va("Resend ack %d, %u<%d at %u\n", ackpak[i].acknum, ackpak[i].senttime,
NODETIMEOUT, I_GetTime()));
memcpy(netbuffer, ackpak[i].pak.raw, ackpak[i].length);
@@ -1225,7 +1224,7 @@ void D_SetDoomcom(void)
if (doomcom)
return;
doomcom = Z_Calloc(sizeof(doomcom_t), PU_STATIC, NULL);
doomcom = Z_Calloc(sizeof (doomcom_t), PU_STATIC, NULL);
doomcom->id = DOOMCOM_ID;
doomcom->numslots = doomcom->numnodes = 1;
}
@@ -1267,7 +1266,6 @@ boolean D_CheckNetGame(void)
ret = true;
if (client && netgame)
netgame = false;
server = true; // WTF? server always true???
// no! The deault mode is server. Client is set elsewhere
// when the client executes connect command.
@@ -1303,7 +1301,6 @@ boolean D_CheckNetGame(void)
if (doomcom->id != DOOMCOM_ID)
I_Error("Doomcom buffer invalid!");
if (doomcom->numnodes > MAXNETNODES)
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
@@ -1312,17 +1309,14 @@ boolean D_CheckNetGame(void)
{
char filename[21];
INT32 k = doomcom->consoleplayer - 1;
if (M_IsNextParm())
k = atoi(M_GetNextParm()) - 1;
while (!debugfile && k < MAXPLAYERS)
{
k++;
sprintf(filename, "debug%d.txt", k);
debugfile = fopen(va("%s" PATHSEP "%s", srb2home, filename), "w");
}
if (debugfile)
CONS_Printf(M_GetText("debug output to: %s\n"), va("%s" PATHSEP "%s", srb2home, filename));
else
+4 -33
View File
@@ -144,7 +144,6 @@ static void Command_Addfile(void);
static void Command_Addskins(void);
static void Command_GLocalSkin(void);
static void Command_ListWADS_f(void);
static void Command_LocateLump_f(void);
static void Command_ListDoomednums_f(void);
static void Command_ListUnusedSprites_f(void);
static void Command_RunSOC(void);
@@ -271,7 +270,7 @@ consvar_t cv_skin4 = {"skin4", DEFAULTSKIN4, CV_SAVE|CV_CALL|CV_NOINIT, NULL, Sk
// haha I've beaten you now, ONLINE
consvar_t cv_localskin = {"internal___localskin", "none", CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showlocalskinmenus = {"showlocalskinmenus", "Yes", CV_SAVE|CV_CALL, CV_YesNo, ShowLocalskinMenu_Onchange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_showlocalskinmenus = {"showlocalskinmenus", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -639,7 +638,6 @@ void D_RegisterServerCommands(void)
COM_AddCommand("addfile", Command_Addfile);
COM_AddCommand("addskins", Command_Addskins);
COM_AddCommand("listwad", Command_ListWADS_f);
COM_AddCommand("locatelump", Command_LocateLump_f);
COM_AddCommand("listmapthings", Command_ListDoomednums_f);
COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f);
@@ -939,7 +937,6 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_chatbacktint);
CV_RegisterVar(&cv_chatcentertext);
CV_RegisterVar(&cv_songcredits);
CV_RegisterVar(&cv_pausesongcredits);
CV_RegisterVar(&cv_showfreeplay);
CV_RegisterVar(&cv_skinselectspin);
CV_RegisterVar(&cv_showallmaps);
@@ -997,8 +994,6 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_litesteer[i]);
CV_RegisterVar(&cv_autoaccel[i]);
CV_RegisterVar(&cv_usejoystick[i]);
CV_RegisterVar(&cv_joyscale[i]);
CV_RegisterVar(&cv_rumble[i]);
@@ -1008,7 +1003,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_usemouse);
CV_RegisterVar(&cv_invertmouse);
CV_RegisterVar(&cv_mousexsens);
CV_RegisterVar(&cv_mousesens);
CV_RegisterVar(&cv_mouseysens);
CV_RegisterVar(&cv_mousevisible);
@@ -2652,6 +2647,7 @@ static void Command_Map_f(void)
return;
}
M_ClearMenus(true);
last_map_cmd = I_GetTime();
@@ -2834,8 +2830,6 @@ static void Command_Map_f(void)
fromlevelselect = false;
M_ClearMenus(true);
D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false);
}
@@ -4726,30 +4720,7 @@ static void Command_ListWADS_f(void)
}
}
static void Command_LocateLump_f(void)
{
if (COM_Argc() == 1)
{
CONS_Printf("Usage: locatelump <lump1>[ <lump2>[ ...]]\n");
return;
}
for (size_t i = 1; i < COM_Argc(); ++i)
{
const char *name = COM_Argv(i);
lumpnum_t num = W_CheckNumForName(name);
const char *wadname = "(not found)";
if (num != LUMPERROR)
{
wadname = wadfiles[WADFILENUM(num)]->filename;
}
CONS_Printf("%s - %s\n", name, wadname);
}
}
#define MAXDOOMEDNUM 4095
static void Command_ListDoomednums_f(void)
{
+2 -6
View File
@@ -1163,12 +1163,8 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
filestatus_t homecheck; // store result of last file search
boolean badmd5 = false; // store whether md5 was bad from either of the first two searches (if nothing was found in the third)
// see IdentifyVersion
// Iwads skip findfile due to passing fullpath to W_OpenWadFile
#if 0
// skip for Iwads, as they wont be in there
if (!startupiwadcount)
#endif
// skip for startup, our mainwads wont be in there
if (loaded_config)
{
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
{
+3 -8
View File
@@ -46,20 +46,15 @@ typedef enum
// Mainly movements/button commands per game tick,
// plus a checksum for internal state consistency.
// ticcmd turning bits
#define TICCMD_REDUCE 16
// ticcmd latency mask
#define TICCMD_LATENCYMASK 0xFF
// bits in angleturn
#define TICCMD_RECEIVED (0x01) /* Actual tic recieved from client */
#define TICCMD_RECEIVED 1
#define TICCMD_XY 2
typedef struct
{
SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50)
SINT8 sidemove; // -MAXPLMOVE to MAXPLMOVE (50)
INT16 angleturn; // << TICCMD_REDUCE for angle delta - saved as 1 byte into demos
INT16 angleturn; // <<16 for angle delta - saved as 1 byte into demos
INT16 aiming; // vertical aiming, see G_BuildTicCmd
UINT16 buttons;
INT16 driftturn; // SRB2Kart: Used for getting drift turn speed
+4
View File
@@ -178,6 +178,10 @@ static char returnWadPath[256];
#include "../m_argv.h"
#ifdef MAC_ALERT
#include "macosx/mac_alert.h"
#endif
#include "../d_main.h"
#if !defined(NOMUMBLE) && defined(HAVE_MUMBLE)
+4
View File
@@ -115,6 +115,10 @@ INT32 VID_GetModeForSize(INT32 w, INT32 h)
return -1;
}
void VID_RefreshModeList(void)
{
}
void VID_PrepareModeList(void)
{
}
+11 -10
View File
@@ -20,6 +20,7 @@
// but I can't stand that gibberish. D:
#define SOUND_DUMMY 0
#define SOUND_MIXER 1
#define SOUND_SDL 2
#ifndef SOUND
#ifdef HAVE_SDL
@@ -27,7 +28,7 @@
#ifdef HAVE_MIXER
#define SOUND SOUND_MIXER
#else
#define SOUND SOUND_DUMMY
#define SOUND SOUND_SDL
#endif
#else
#define SOUND SOUND_DUMMY
@@ -40,13 +41,6 @@
#define ASMCALL
#endif
#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
#ifdef __cplusplus
#include <cmath>
#else
#include <math.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
@@ -58,6 +52,13 @@ extern "C" {
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES // fixes M_PI errors in r_plane.c for Visual Studio
#ifdef __cplusplus
#include <cmath>
#else
#include <math.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
@@ -107,8 +108,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v9.2"
#define VERSIONSTRINGW L"Saturn v9.2"
#define VERSIONSTRING "Saturn v9.x - Testing"
#define VERSIONSTRINGW L"Saturn v9.x - Testing "
#define SATURN_TESTING // comment out for saturn release builds!
+1 -1
View File
@@ -542,7 +542,7 @@ extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF
#else
#define DEBUGFILE
#ifdef DEBUGFILE
#define DEBFILE(msg) { if (UNLIKELY(debugfile)) { fputs(msg, debugfile); fflush(debugfile); } }
#define DEBFILE(msg) { if (debugfile) { fputs(msg, debugfile); fflush(debugfile); } }
#else
#define DEBFILE(msg) {}
#endif
+1 -1
View File
@@ -644,7 +644,7 @@ void F_CreditDrawer(void)
sc = FRACUNIT; // quick hack so I don't have to add another field to credits_pics
}
V_DrawFixedPatch(credits_pics[i].x<<FRACBITS, (credits_pics[i].y<<FRACBITS) - 4*(animtimer<<FRACBITS)/5, sc, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH), colormap);
V_DrawFixedPatch(credits_pics[i].x<<FRACBITS, (credits_pics[i].y<<FRACBITS) - 4*(animtimer<<FRACBITS)/5, sc, 0, W_CachePatchName(credits_pics[i].patch, PU_PATCH_LOWPRIORITY), colormap);
}
// Dim the background
+2 -2
View File
@@ -10,7 +10,7 @@ FUNCINLINE static ATTRINLINE boolean fasticmp(const char *s, const char *c)
}
// case-sensitive of the above
FUNCINLINE static ATTRINLINE PUREFUNC boolean fastcmp(const char *s, const char *c)
FUNCINLINE static ATTRINLINE boolean fastcmp(const char *s, const char *c)
{
for (; *s && *s == *c; s++, c++) ;
return (*s == *c); // make sure both strings ended
@@ -18,7 +18,7 @@ FUNCINLINE static ATTRINLINE PUREFUNC boolean fastcmp(const char *s, const char
// length-limited of the above
// only true if both strings are at least l characters long AND match, case-sensitively!
FUNCINLINE static ATTRINLINE PUREFUNC boolean fastncmp(const char *s, const char *c, UINT16 l)
FUNCINLINE static ATTRINLINE boolean fastncmp(const char *s, const char *c, UINT16 l)
{
for (; *s && *s == *c && --l; s++, c++) ;
return !l; // make sure you reached the end
+88 -157
View File
@@ -55,8 +55,6 @@
#include "k_stats.h" // SRB2kart
#include "r_fps.h" // frame interpolation/uncapped
#include <errno.h>
#ifdef HAVE_DISCORDRPC
#include "discord.h"
#endif
@@ -248,12 +246,10 @@ void G_ReadDemoExtraData(void)
{
extradata = READUINT8(demobuf.p);
player_t *player = &players[p];
if (extradata & DXD_RESPAWN)
{
if (player->mo)
P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..?
if (players[p].mo)
P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL); // Is this how this should work..?
}
if (extradata & DXD_SKIN)
@@ -268,11 +264,11 @@ void G_ReadDemoExtraData(void)
kartspeed = READUINT8(demobuf.p);
kartweight = READUINT8(demobuf.p);
if (!fasticmp(skins[player->skin].name, name))
if (!fasticmp(skins[players[p].skin].name, name))
FindClosestSkinForStats(p, kartspeed, kartweight);
player->kartspeed = kartspeed;
player->kartweight = kartweight;
players[p].kartspeed = kartspeed;
players[p].kartweight = kartweight;
}
if (extradata & DXD_COLOR)
@@ -283,9 +279,9 @@ void G_ReadDemoExtraData(void)
for (i = 0; i < MAXSKINCOLORS; i++)
if (fasticmp(KartColor_Names[i], name)) // SRB2kart
{
player->skincolor = i;
if (player->mo)
player->mo->color = i;
players[p].skincolor = i;
if (players[p].mo)
players[p].mo->color = i;
break;
}
}
@@ -304,17 +300,17 @@ void G_ReadDemoExtraData(void)
switch (extradata)
{
case DXD_PST_PLAYING:
player->pflags |= PF_WANTSTOJOIN; // fuck you
players[p].pflags |= PF_WANTSTOJOIN; // fuck you
break;
case DXD_PST_SPECTATING:
player->pflags &= ~PF_WANTSTOJOIN; // double-fuck you
players[p].pflags &= ~PF_WANTSTOJOIN; // double-fuck you
if (!playeringame[p])
{
CL_ClearPlayer(p);
playeringame[p] = true;
G_AddPlayer(p);
player->spectator = true;
players[p].spectator = true;
// There's likely an off-by-one error in timing recording or playback of joins. This hacks around it so I don't have to find out where that is. \o/
if (oldcmd[p].forwardmove)
@@ -322,11 +318,11 @@ void G_ReadDemoExtraData(void)
}
else
{
player->spectator = true;
if (player->mo)
P_DamageMobj(player->mo, NULL, NULL, DMG_INSTAKILL);
players[p].spectator = true;
if (players[p].mo)
P_DamageMobj(players[p].mo, NULL, NULL, DMG_INSTAKILL);
else
player->playerstate = PST_REBORN;
players[p].playerstate = PST_REBORN;
}
break;
case DXD_PST_LEFT:
@@ -334,7 +330,7 @@ void G_ReadDemoExtraData(void)
break;
}
G_ResetViews(false); // dont reset our freecam pls thx!
G_ResetViews();
// maybe these are necessary?
if (G_BattleGametype())
@@ -1136,29 +1132,7 @@ void G_GhostTicker(void)
for (g = ghosts, p = NULL; g; g = g->next)
{
// Skip normal demo data.
UINT8 ziptic;
if (g->done)
{
continue;
}
ziptic = READUINT8(g->p);
fadeghost:
// Demo ends after ghost data.
if (ziptic == DEMOMARKER)
{
g->mo->momx = g->mo->momy = g->mo->momz = 0;
g->done = true;
if (p)
{
p->next = g->next;
}
continue;
}
UINT8 ziptic = READUINT8(g->p);
#ifdef DEMO_COMPAT_100
if (g->version != 0x0001)
@@ -1166,14 +1140,8 @@ fadeghost:
#endif
while (ziptic != DW_END) // Get rid of extradata stuff
{
if (ziptic < MAXPLAYERS)
if (ziptic == 0) // Only support player 0 info for now
{
#ifdef DEVELOP
UINT8 playerid = ziptic;
#endif
// We want to skip *any* player extradata because some demos have extradata for bogus players,
// but if there is tic data later for those players *then* we'll consider it invalid.
ziptic = READUINT8(g->p);
if (ziptic & DXD_SKIN)
@@ -1185,26 +1153,13 @@ fadeghost:
if (ziptic & DXD_NAME)
g->p += 16; // yea
if (ziptic & DXD_PLAYSTATE)
{
UINT8 playstate = READUINT8(g->p);
if (playstate != DXD_PST_PLAYING)
{
#ifdef DEVELOP
CONS_Alert(CONS_WARNING, "Ghost demo has non-playing playstate for player %d\n", playerid + 1);
#endif
;
}
}
if (ziptic & DXD_PLAYSTATE && READUINT8(g->p) != DXD_PST_PLAYING)
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
}
else if (ziptic == DW_RNG)
{
g->p += 4; // RNG seed
}
else
{
I_Error("Ghost is not a record attack ghost DXD (ziptic = %u)", ziptic); //@TODO lmao don't blow up like this
}
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
ziptic = READUINT8(g->p);
}
@@ -1227,7 +1182,7 @@ fadeghost:
if (ziptic & ZT_DRIFT)
g->p += 2;
if (ziptic & ZT_LATENCY)
g->p++;
g->p += 1;
// Grab ghost data.
ziptic = READUINT8(g->p);
@@ -1236,12 +1191,10 @@ fadeghost:
if (g->version != 0x0001)
{
#endif
if (ziptic == DEMOMARKER) // Had to end early for some reason
goto fadeghost;
if (ziptic == 0xFF)
goto skippedghosttic; // Didn't write ghost info this frame
if (ziptic != 0)
I_Error("Ghost is not a record attack ghost ZIPTIC"); //@TODO lmao don't blow up like this
else if (ziptic != 0)
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
ziptic = READUINT8(g->p);
#ifdef DEMO_COMPAT_100
}
@@ -1412,7 +1365,7 @@ fadeghost:
{
#endif
if (READUINT8(g->p) != 0xFF) // Make sure there isn't other ghost data here.
I_Error("Ghost is not a record attack ghost GHOSTEND"); //@TODO lmao don't blow up like this
I_Error("Ghost is not a record attack ghost"); //@TODO lmao don't blow up like this
#ifdef DEMO_COMPAT_100
}
#endif
@@ -1432,6 +1385,20 @@ skippedghosttic:
break;
}
// Demo ends after ghost data.
if (*g->p == DEMOMARKER)
{
g->mo->momx = g->mo->momy = g->mo->momz = 0;
if (p)
p->next = g->next;
else
ghosts = g->next;
Z_Free(g);
continue;
}
p = g;
}
}
@@ -1626,7 +1593,7 @@ void G_ConfirmRewind(tic_t rewindtime)
displayplayers[2] = olddp3;
displayplayers[3] = olddp4;
R_ExecuteSetViewSize();
G_ResetViews(true);
G_ResetViews();
for (i = splitscreen; i >= 0; i--)
P_ResetCamera(&players[displayplayers[i]], &camera[i]);
@@ -2403,69 +2370,49 @@ static long G_GetCreationTime(char *filepath)
static char *G_GetDemoDate(menudemo_t *pdemo)
{
char *endPos = NULL;
static char datetime[11];
char *datetime;
datetime = malloc(sizeof(pdemo->date)); // mallocma balls
// no mallocma balls... :c
if (!datetime)
{
return NULL;
}
time_t file_time = 0;
const char *format = NULL;
struct tm *tm_buf = NULL;
CLEANUP(pfree) char *filename = NULL;
// get le filepath
char *filename;
filename = strdup(pdemo->filepath);
#if defined (_WIN32)
if (!filename)
{
#if defined (_WIN32)
// if we cant get a filename try just getting the file creation time
// if we cant get a filename try just getting the file create time
file_time = G_GetCreationTime(pdemo->filepath);
goto skipfilenametime;
#else
return NULL;
#endif
}
#else
if (!filename)
{
free(datetime);
return NULL;
}
#endif
// get the actual filename Zzz...
nameonly(filename);
// the first 10 characters of a replay name usually is a unix timestamp
// not long enough to contain a valid timestamp
if (strlen(filename) < 10)
{
#if defined (_WIN32)
// try to get file creation time
file_time = G_GetCreationTime(pdemo->filepath);
goto skipfilenametime;
#else
return NULL;
#endif
}
#ifndef AVOID_ERRNO
errno = 0;
#endif
// get the timestamp as actual numbers lul
file_time = strtol(filename, &endPos, 10);
if (endPos == filename // Empty string
#ifndef AVOID_ERRNO
|| errno == ERANGE // Number out-of-range
#endif
|| file_time < 0) // Number is not positive
{
#if defined (_WIN32)
// just try and get the creation time then
file_time = G_GetCreationTime(pdemo->filepath);
#else
return NULL;
#endif
}
// convert it to long Zzz....
file_time = strtol(filename, NULL, 10);
free(filename); // dont need this anymore a
#if defined (_WIN32)
skipfilenametime:
#endif
// then throw it into localtime to get an actual human readable format lmao
struct tm *tm_buf = NULL;
tm_buf = localtime(&file_time);
// cant believe we ended up in 1970
@@ -2478,10 +2425,14 @@ skipfilenametime:
tm_buf = localtime(&file_time);
if (tm_buf == NULL || tm_buf->tm_year <= 110)
{
free(datetime);
return NULL;
}
goto gotcreationtime;
#else
free(datetime);
return NULL;
#endif
}
@@ -2490,27 +2441,17 @@ skipfilenametime:
gotcreationtime:
#endif
const char *format;
// US ppl are special (:
if (cv_demodateformat.value == 2)
format = "%m.%d.%Y";
else if (cv_demodateformat.value == 1)
format = "%d.%m.%Y";
else
{
const char *locale = setlocale(LC_TIME, NULL);
format = strstr(setlocale(LC_TIME, NULL), "en_US") ? "%m.%d.%Y" : "%d.%m.%Y";
if (locale == NULL)
format = "%d.%m.%Y"; // fallback to non US format
else if (strstr(locale, "en_US"))
format = "%m.%d.%Y";
else
format = "%d.%m.%Y";
}
if (strftime(datetime, sizeof(datetime), format, tm_buf) == 0)
{
return NULL;
}
strftime(datetime, sizeof(pdemo->date), format, tm_buf);
return datetime;
}
@@ -2519,7 +2460,6 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
{
UINT8 infobuffer[96], *info_p;
UINT16 pdemoversion;
char *demodate = NULL;
size_t count;
FILE *handle = fopen(pdemo->filepath, "rb");
@@ -2558,13 +2498,13 @@ void G_LoadDemoTitle(menudemo_t *pdemo)
memcpy(pdemo->title, info_p, 64);
// demo date
char *demodate;
demodate = G_GetDemoDate(pdemo);
if (demodate)
{
strlcpy(pdemo->date, demodate, sizeof(pdemo->date));
}
strncpy(pdemo->date, demodate, sizeof(pdemo->date));
free(demodate);
break;
#ifdef DEMO_COMPAT_100
case 0x0001:
@@ -2641,7 +2581,7 @@ void G_DoPlayDemo(char *defdemoname)
snprintf(msg, 1024, M_GetText("Failed to read file '%s'.\n"), defdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
gameaction = ga_nothing;
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
return;
}
@@ -2653,7 +2593,7 @@ void G_DoPlayDemo(char *defdemoname)
snprintf(msg, 1024, M_GetText("Failed to read lump '%s'.\n"), defdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
gameaction = ga_nothing;
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
return;
}
else // it's an internal demo
@@ -2673,7 +2613,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s is not a SRB2Kart replay file.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
@@ -2699,7 +2639,7 @@ void G_DoPlayDemo(char *defdemoname)
default:
snprintf(msg, 1024, M_GetText("%s is an incompatible replay format and cannot be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
@@ -2710,7 +2650,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s is the wrong type of recording and cannot be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
@@ -2727,7 +2667,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s is an alpha multiplayer replay and cannot be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
@@ -2785,7 +2725,7 @@ void G_DoPlayDemo(char *defdemoname)
CONS_Alert(CONS_ERROR, "%s", msg);
if (!CON_Ready()) // In the console they'll just see the notice there! No point pulling them out.
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
@@ -2823,16 +2763,6 @@ void G_DoPlayDemo(char *defdemoname)
#endif
demobuf.p += 4; // Extrainfo location
// ...*map* not loaded?
if (!gamemap || (gamemap > NUMMAPS) || (W_CheckNumForName(G_BuildMapName(gamemap)) == LUMPERROR))
{
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
G_ResetDemoPlayback();
return;
}
#ifdef DEMO_COMPAT_100
if (demo.version == 0x0001)
{
@@ -2860,7 +2790,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s features a character that is not currently loaded.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
@@ -2870,7 +2800,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s features a course that is not currently loaded.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
@@ -2893,7 +2823,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
@@ -2931,7 +2861,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s contains no data to be played.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
@@ -2980,7 +2910,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with spectators, and is thus invalid.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
@@ -2992,7 +2922,7 @@ void G_DoPlayDemo(char *defdemoname)
{
snprintf(msg, 1024, M_GetText("%s is a Record Attack replay with multiple players, and is thus invalid.\n"), pdemoname);
CONS_Alert(CONS_ERROR, "%s", msg);
M_StartMessage(msg, M_ReturnToTitleFromError, MM_EVENTHANDLER);
M_StartMessage(msg, NULL, MM_NOTHING);
G_ResetDemoPlayback();
return;
}
@@ -3602,6 +3532,7 @@ void G_FreeGhosts(void)
ghosts = NULL;
}
boolean G_CheckDemoStatus(void)
{
G_FreeGhosts();
-1
View File
@@ -149,7 +149,6 @@ typedef struct demoghost {
UINT8 checksum[16];
UINT8 *buffer, *p, color;
UINT16 version;
boolean done;
mobj_t oldmo, *mo;
struct demoghost *next;
} demoghost;
+22 -90
View File
@@ -312,8 +312,6 @@ consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, N
static CV_PossibleValue_t songcredits_cons_t[] = {{0, "Off"}, {1, "Default"}, {2, "Box"}, {0, NULL}};
consvar_t cv_songcredits = {"songcredits", "Default", CV_SAVE, songcredits_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_pausesongcredits = {"pausesongcredits", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
// Show "FREE PLAY" when you're alone. :(
consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -454,14 +452,6 @@ consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS] = {
{"litesteer4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
};
//static CV_PossibleValue_t autoaccelcons_t[] = {{0, "Off"}, {1, "Manual"}, {2, "Automatic"}, {0, NULL}};
consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS] = {
{"autoaccel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"autoaccel2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"autoaccel3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
{"autoaccel4", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}
};
static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}};
consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -672,7 +662,7 @@ INT16 G_ClipAimingPitch(INT32 *aiming)
else if (*aiming < -limitangle)
*aiming = -limitangle;
return (INT16)((*aiming) >> TICCMD_REDUCE);
return (INT16)((*aiming)>>16);
}
INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
@@ -685,7 +675,7 @@ INT16 G_SoftwareClipAimingPitch(INT32 *aiming)
else if (*aiming < -limitangle)
*aiming = -limitangle;
return (INT16)((*aiming) >> TICCMD_REDUCE);
return (INT16)((*aiming)>>16);
}
INT32 JoyAxis(axis_input_e axissel, UINT8 player)
@@ -808,10 +798,6 @@ static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
//
// G_HandleLocalDriftturn
// Hack for Lua menus that check directional inputs with driftturn
//
static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer)
{
INT32 axis = 0;
@@ -874,8 +860,9 @@ static void G_HandleLocalDriftturn(ticcmd_t *cmd, UINT8 ssplayer)
//
static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
{
boolean moveinput = false;
INT32 axis = 0;
const boolean usejoystick = cv_usejoystick[(ssplayer-1)].value;
const boolean usejoystick = (cv_usejoystick[(ssplayer-1)].value);
// check for inputs and return button commands
// for stuff like joining with item button, saltyhop, honking, etc.
@@ -910,11 +897,15 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
#undef CHECKINPUT
moveinput = (InputDown(gc_turnleft, ssplayer) || InputDown(gc_turnright, ssplayer)
|| InputDown(gc_aimforward, ssplayer) || InputDown(gc_aimbackward, ssplayer) ||
(usejoystick && JoyAxis(AXISAIM, ssplayer) != 0) || (usejoystick && JoyAxis(AXISTURN, ssplayer) != 0));
axis = JoyAxis(AXISLOOKBACK, ssplayer);
camspin[ssplayer-1] = (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0));
// Reset to our spec player if we watch someone else.
if ((cmd->driftturn || cmd->buttons)
if ((moveinput || cmd->buttons)
&& displayplayers[0] != consoleplayer && ssplayer == 1)
{
if (cv_director.value)
@@ -926,63 +917,6 @@ static void G_BuildLocalTiccmd(ticcmd_t *cmd, UINT8 ssplayer, boolean freecam)
}
}
//
// G_HandleAutoAcceleration
//
static void G_HandleAutoAcceleration(ticcmd_t *cmd, player_t *player, UINT8 forplayer)
{
if (!cv_autoaccel[forplayer].value)
return;
if (gamestate != GS_LEVEL)
return;
// dont accel before and during countdown
if (leveltime <= starttime)
return;
// dont do this in menus or when console is onscreen
if (menuactive || CON_Ready())
return;
// gotta have a player that aint respawning
if (!player->mo || player->kartstuff[k_respawn])
return;
// dont need for "finished" players
if (player->exiting || (player->pflags & PF_TIMEOVER))
return;
// dont do during spinout
if (player->kartstuff[k_spinouttimer])
return;
// spectators and freecam dont need special handling, see G_BuildTiccmd
if (cmd->buttons & BT_BRAKE)
{
if (cmd->buttons & BT_DRIFT ||
player->kartstuff[k_sneakertimer] ||
player->kartstuff[k_squishedtimer])
{
cmd->forwardmove = (SINT8)forwardmove[0];
cmd->buttons |= BT_ACCELERATE;
}
else
{
// allows us to drive backwards if we need to
if (cmd->forwardmove > 0)
cmd->forwardmove = 0;
cmd->buttons &= ~BT_ACCELERATE;
}
}
else
{
cmd->forwardmove = (SINT8)forwardmove[1];
cmd->buttons |= BT_ACCELERATE;
}
}
//
// G_BuildTiccmd
// Builds a ticcmd from all of the available inputs
@@ -1025,7 +959,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// Kart, don't build a ticcmd if someone is resynching or the server is stopped too so we don't fly off course in bad conditions
if (paused || P_AutoPause() || (gamestate == GS_LEVEL && player->playerstate == PST_REBORN) || hu_resynching)
{
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
cmd->angleturn = (INT16)(lang >> 16);
cmd->aiming = G_ClipAimingPitch(&laim);
return;
}
@@ -1033,7 +967,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
// dumbass thing so we can use a few buttons but dont accidentally drive away
if (player->spectator || freecam)
{
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
cmd->angleturn = (INT16)(lang >> 16);
G_BuildLocalTiccmd(cmd, ssplayer, freecam);
// let lua override everything
@@ -1130,7 +1064,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || player->kartstuff[k_sneakertimer])
{
cmd->buttons |= BT_ACCELERATE;
forward = forwardmove[1]; // 50
forward = forwardmove[1]; // 50
}
else if (analogjoystickmove && axis > 0)
{
@@ -1193,7 +1127,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->aiming = G_ClipAimingPitch(&laim);
mousex = mousey = 0;
mousex = mousey = mlooky = 0;
if (forward > MAXPLMOVE)
forward = MAXPLMOVE;
@@ -1211,8 +1145,6 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->sidemove = (SINT8)(cmd->sidemove + side);
}
G_HandleAutoAcceleration(cmd, player, forplayer);
//{ SRB2kart - Drift support
// Not grouped with the rest of turn stuff because it needs to know what buttons you're pressing for rubber-burn turn
// limit turning to angleturn[1] to stop mouselook letting you look too fast
@@ -1234,10 +1166,10 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|| (player->kartstuff[k_respawn]) // Respawning
|| (player->spectator || objectplacing))) // Not a physical player
lang += (cmd->angleturn << TICCMD_REDUCE);
lang += (cmd->angleturn<<16);
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
cmd->latency = modeattacking ? 0 : (leveltime & TICCMD_LATENCYMASK); // Send leveltime when this tic was generated to the server for control lag calculations
cmd->angleturn = (INT16)(lang >> 16);
cmd->latency = modeattacking ? 0 : (leveltime & 0xFF); // Send leveltime when this tic was generated to the server for control lag calculations
if (!hu_stopped)
{
@@ -1818,15 +1750,14 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
// Increment a viewpoint by offset from the current player. A negative value
// decrements.
//
void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean resetfreecam)
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive)
{
INT32 *displayplayerp, oldview;
displayplayerp = &displayplayers[viewnum-1];
oldview = (*displayplayerp);
// turn off the freecam
if (resetfreecam)
camera[viewnum-1].freecam = false;
camera[viewnum-1].freecam = false;
G_ResetView(viewnum, ( (*displayplayerp) + offset ), onlyactive);
@@ -1840,7 +1771,7 @@ void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean res
// Ensures all viewpoints are valid
// Also demotes splitscreen down to one player.
//
void G_ResetViews(boolean resetfreecam)
void G_ResetViews(void)
{
UINT8 splits;
UINT8 viewd;
@@ -1864,7 +1795,7 @@ void G_ResetViews(boolean resetfreecam)
*/
for (viewd = 1; viewd <= splits; ++viewd)
{
G_AdjustViewEx(viewd, 0, false, resetfreecam);
G_AdjustView(viewd, 0, false);
}
}
@@ -1945,7 +1876,7 @@ void G_Ticker(boolean run)
G_CopyTiccmd(cmd, &netcmds[buf][i], 1);
// Use the leveltime sent in the player's ticcmd to determine control lag
cmd->latency = modeattacking ? 0 : min(((leveltime & TICCMD_LATENCYMASK) - cmd->latency) & TICCMD_LATENCYMASK, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max
cmd->latency = modeattacking ? 0 : min(((leveltime & 0xFF) - cmd->latency) & 0xFF, MAXPREDICTTICS-1); //@TODO add a cvar to allow setting this max
}
}
@@ -1953,6 +1884,7 @@ void G_Ticker(boolean run)
switch (gamestate)
{
case GS_LEVEL:
for (; ra_timeskip < starttime - TICRATE*4; ra_timeskip++) // this looks weird but this is done to not break compability with older demos for now.
{
if (demo.title)
+3 -6
View File
@@ -50,7 +50,7 @@ extern INT16 rw_maximums[NUM_WEAPONS];
// used in game menu
extern consvar_t cv_chatwidth, cv_chatnotifications, cv_chatheight, cv_chattime, cv_consolechat, cv_chatbacktint, cv_chatspamprotection, cv_chatcentertext/*, cv_compactscoreboard*/;
extern consvar_t cv_songcredits, cv_pausesongcredits;
extern consvar_t cv_songcredits;
extern consvar_t cv_showfreeplay;
extern consvar_t cv_growmusic, cv_supermusic;
extern consvar_t cv_pauseifunfocused;
@@ -74,8 +74,6 @@ extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_litesteer[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_autoaccel[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
// Hud offsets
@@ -264,10 +262,9 @@ boolean G_CanView(INT32 playernum, UINT8 viewnum, boolean onlyactive);
INT32 G_FindView(INT32 startview, UINT8 viewnum, boolean onlyactive, boolean reverse);
INT32 G_CountPlayersPotentiallyViewable(boolean active);
void G_ResetViews(boolean resetfreecam);
void G_ResetViews(void);
void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive);
void G_AdjustViewEx(UINT8 viewnum, INT32 offset, boolean onlyactive, boolean resetfreecam);
#define G_AdjustView(v,o,oa) G_AdjustViewEx(v,o,oa, true)
void G_AdjustView(UINT8 viewnum, INT32 offset, boolean onlyactive);
void G_AddPlayer(INT32 playernum);
+11 -15
View File
@@ -34,7 +34,7 @@ static CV_PossibleValue_t onecontrolperkey_cons_t[] = {{1, "One"}, {2, "Several"
static CV_PossibleValue_t turnsmooth_cons_t[] = {{2, "Slow"}, {1, "Fast"}, {0, "Off"}, {0, NULL}};
// mouse values are used once
consvar_t cv_mousexsens = {"mousexsens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -125,17 +125,17 @@ static void led_off_handle4(void)
G_ResetPlayerGamepadIndicatorColor(3);
}
INT32 mousex = 0, mousey = 0;
INT32 mousex, mousey;
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
// joystick values are repeated
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET] = {};
INT32 joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET] = {};
INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
// current state of the keys: true if pushed
UINT8 gamekeydown[NUMINPUTS] = {};
UINT8 gamekeydown[NUMINPUTS];
// two key codes (or virtual key) per game control
INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2] = {};
INT32 gamecontrol[MAXSPLITSCREENPLAYERS][num_gamecontrols][2];
typedef struct
{
@@ -192,8 +192,9 @@ void G_MapEventsToControls(event_t *ev)
case ev_mouse: // buttons are virtual keys
if (menuactive || CON_Ready() || chat_on)
break;
mousex = (INT32)(ev->data2*((cv_mousexsens.value*cv_mousexsens.value)/110.0f + 0.1f));
mousey = (INT32)(ev->data3*((cv_mouseysens.value*cv_mouseysens.value)/110.0f + 0.1f));
mousex = (INT32)(ev->data2*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f));
mousey = (INT32)(ev->data3*((cv_mousesens.value*cv_mousesens.value)/110.0f + 0.1f));
mlooky = (INT32)(ev->data3*((cv_mouseysens.value*cv_mousesens.value)/110.0f + 0.1f));
break;
case ev_joystick: // buttons are virtual keys
@@ -214,7 +215,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_joystick3:
i = ev->data1;
if (i >= JOYAXISSET || menuactive)
if (i >= JOYAXISSET)
break;
if (ev->data2 != INT32_MAX) joyxmove[2][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[2][i] = ev->data3;
@@ -222,7 +223,7 @@ void G_MapEventsToControls(event_t *ev)
case ev_joystick4:
i = ev->data1;
if (i >= JOYAXISSET || menuactive)
if (i >= JOYAXISSET)
break;
if (ev->data2 != INT32_MAX) joyxmove[3][i] = ev->data2;
if (ev->data3 != INT32_MAX) joyymove[3][i] = ev->data3;
@@ -973,13 +974,8 @@ void G_DeviceLEDTick(void)
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
continue;
#pragma GCC diagnostic pop
G_SetPlayerGamepadIndicatorColor(i, newcolor);
curcolor[i] = newcolor;
+2 -1
View File
@@ -109,7 +109,7 @@ typedef enum
} gamecontrols_e;
// mouse values are used once
extern consvar_t cv_mousexsens, cv_mouseysens;
extern consvar_t cv_mousesens, cv_mouseysens;
extern consvar_t cv_controlperkey;
extern consvar_t cv_turnsmooth[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
@@ -117,6 +117,7 @@ extern consvar_t cv_rumblestrength[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
extern INT32 mousex, mousey;
extern INT32 mlooky; //mousey with mlookSensitivity
extern INT32 joyxmove[MAXSPLITSCREENPLAYERS][JOYAXISSET], joyymove[MAXSPLITSCREENPLAYERS][JOYAXISSET];
-1
View File
@@ -1 +0,0 @@
target_sourcefile(c)
+14 -8
View File
@@ -214,7 +214,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
const GLMipmap_t *texture1 = poly1->hash & 0x80000000 ? NULL : poly1->texture;
const GLMipmap_t *texture2 = poly2->hash & 0x80000000 ? NULL : poly2->texture;
const GLMipmap_t *texture2 = poly1->hash & 0x80000000 ? NULL : poly2->texture;
// skywalls and horizon lines must retain their order for horizon lines to work
if (!texture1 && !texture2)
@@ -237,7 +237,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
// This function organizes the geometry collected by HWR_ProcessPolygon calls into batches and uses
// the rendering backend to draw them.
void HWR_RenderBatches(void)
void HWR_RenderBatches(boolean sort)
{
int finalVertexWritePos = 0; // position in finalVertexArray
int finalIndexWritePos = 0; // position in finalVertexIndexArray
@@ -288,10 +288,13 @@ void HWR_RenderBatches(void)
polygonArraySorted[i] = &polygonArray[i];
}
// sort polygons
PS_START_TIMING(ps_hw_batchsorttime);
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), (useshader ? comparePolygons : comparePolygonsNoShaders));
PS_STOP_TIMING(ps_hw_batchsorttime);
if (sort)
{
// sort polygons
PS_START_TIMING(ps_hw_batchsorttime);
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), (useshader ? comparePolygons : comparePolygonsNoShaders));
PS_STOP_TIMING(ps_hw_batchsorttime);
}
// sort order
// 1. shader
@@ -300,7 +303,9 @@ void HWR_RenderBatches(void)
// 4. colors + light level
// not sure about what order of the last 2 should be, or if it even matters
PS_START_TIMING(ps_hw_batchdrawtime);
// dont overwrite this on consecutive calls
if (!sort)
PS_START_TIMING(ps_hw_batchdrawtime);
currentShader = polygonArraySorted[0]->shader;
currentTexture = polygonArraySorted[0]->texture;
@@ -495,7 +500,8 @@ void HWR_RenderBatches(void)
polygonArraySize = 0;
unsortedVertexArraySize = 0;
PS_STOP_TIMING(ps_hw_batchdrawtime);
if (!sort)
PS_STOP_TIMING(ps_hw_batchdrawtime);
}
#endif // HWRENDER
+1 -1
View File
@@ -37,7 +37,7 @@ typedef struct
void HWR_StartBatching(void);
void HWR_SetCurrentTexture(GLMipmap_t *texture);
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader, boolean horizonSpecial);
void HWR_RenderBatches(void);
void HWR_RenderBatches(boolean sort);
#ifdef __cplusplus
} // extern "C"
+168 -200
View File
@@ -643,8 +643,8 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
pv = planepoly->pts;
// reference point for flat texture coord for each vertex around the polygon
flatxref = static_cast<float>(static_cast<fixed_t>(pv->x) & (~flatflag)) / fflatsize;
flatyref = static_cast<float>(static_cast<fixed_t>(pv->y) & (~flatflag)) / fflatsize;
flatxref = (float)(((fixed_t)pv->x & (~flatflag)) / fflatsize);
flatyref = (float)(((fixed_t)pv->y & (~flatflag)) / fflatsize);
if (!isceiling) // it's a floor
{
@@ -661,13 +661,9 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
if (angle) // Only needs to be done if there's an altered angle
{
// This needs to be done so that it scrolls in a different direction after rotation like software
tempxsow = flatxref;
tempytow = flatyref;
anglef = ANG2RAD(InvAngle(angle));
// This needs to be done so everything aligns after rotation
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
cosangf = cosf(anglef);
sinangf = sinf(anglef);
flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
@@ -811,7 +807,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
}
}
}
#undef SETUP3DVERT
}
#ifdef WALLSPLATS
@@ -1371,8 +1366,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// x offset the texture
const fixed_t texturehpeg = gl_sidedef->textureoffset + gl_curline->offset;
const float cliplow = static_cast<float>(texturehpeg);
const float cliphigh = static_cast<float>(texturehpeg) + static_cast<float>(gl_curline->length);
const float cliplow = (float)texturehpeg;
const float cliphigh = ((float)texturehpeg + (float)gl_curline->length);
FUINT lightnum = gl_frontsector->lightlevel;
extracolormap_t *colormap = gl_frontsector->extra_colormap;
@@ -1386,8 +1381,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
const INT32 gl_midtexture = R_GetTextureNum(gl_sidedef->midtexture);
GLMapTexture_t *glTex = NULL;
static constexpr float FLOATMAX = static_cast<float>(INT32_MAX) / static_cast<float>(FRACUNIT);
static constexpr float FLOATMIN = static_cast<float>(INT32_MIN) / static_cast<float>(FRACUNIT);
static constexpr float FLOATMAX = (float)INT32_MAX / (float)FRACUNIT;
static constexpr float FLOATMIN = (float)INT32_MIN / (float)FRACUNIT;
// two sided line
if (gl_backsector)
@@ -1500,8 +1495,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_toptexture, noencore);
wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
@@ -1509,23 +1504,23 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (!(gl_linedef->flags & ML_EFFECT1))
{
// Unskewed
wallVerts[3].t -= static_cast<float>(worldtop - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[2].t -= static_cast<float>(worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[0].t -= static_cast<float>(worldhigh - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[1].t -= static_cast<float>(worldhighslope - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[3].t -= (worldtop - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[2].t -= (worldtopslope - gl_frontsector->ceilingheight) * glTex->scaleY;
wallVerts[0].t -= (worldhigh - gl_backsector->ceilingheight) * glTex->scaleY;
wallVerts[1].t -= (worldhighslope - gl_backsector->ceilingheight) * glTex->scaleY;
}
else if (gl_linedef->flags & ML_DONTPEGTOP)
{
// Skewed by top
wallVerts[0].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[1].t = static_cast<float>(texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
wallVerts[0].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + (worldtopslope - worldhighslope)) * glTex->scaleY;
}
else
{
// Skewed by bottom
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - static_cast<float>(worldtop - worldhigh) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldtopslope - worldhighslope) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldtop - worldhigh)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (worldtop - worldhigh) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldtopslope - worldhighslope) * glTex->scaleY;
}
// set top/bottom coords
@@ -1562,8 +1557,8 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_bottomtexture, noencore);
wallVerts[3].t = wallVerts[2].t = static_cast<float>(texturevpeg * glTex->scaleY);
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight)) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (gl_backsector->floorheight - gl_frontsector->floorheight)) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
@@ -1571,22 +1566,22 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (!(gl_linedef->flags & ML_EFFECT1))
{
// Unskewed
wallVerts[0].t -= static_cast<float>(worldbottom - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[1].t -= static_cast<float>(worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[3].t -= static_cast<float>(worldlow - gl_backsector->floorheight) * glTex->scaleY;
wallVerts[2].t -= static_cast<float>(worldlowslope - gl_backsector->floorheight) * glTex->scaleY;
wallVerts[0].t -= (worldbottom - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[1].t -= (worldbottomslope - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[3].t -= (worldlow - gl_backsector->floorheight) * glTex->scaleY;
wallVerts[2].t -= (worldlowslope - gl_backsector->floorheight) * glTex->scaleY;
}
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
{
// Skewed by bottom
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(worldlowslope - worldbottomslope) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (worldlowslope - worldbottomslope) * glTex->scaleY;
}
else
{
// Skewed by top
wallVerts[0].t = static_cast<float>(texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[1].t = static_cast<float>(texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
wallVerts[0].t = (texturevpeg + (worldlow - worldbottom)) * glTex->scaleY;
wallVerts[1].t = (texturevpeg + (worldlowslope - worldbottomslope)) * glTex->scaleY;
}
// set top/bottom coords
@@ -1748,13 +1743,13 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
glTex = HWR_GetTexture(gl_midtexture, noencore);
// Left side
wallVerts[3].t = static_cast<float>(texturevpeg * glTex->scaleY);
wallVerts[0].t = static_cast<float>(h - l + texturevpeg) * glTex->scaleY;
wallVerts[3].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = (h - l + texturevpeg) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
// Right side
wallVerts[2].t = texturevpegslope * glTex->scaleY;
wallVerts[1].t = static_cast<float>(hS - lS + texturevpegslope) * glTex->scaleY;
wallVerts[1].t = (hS - lS + texturevpegslope) * glTex->scaleY;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
// set top/bottom coords
@@ -1797,28 +1792,28 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
else
texturevpeg = gl_sidedef->rowoffset; // top of texture at top
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[0].t = wallVerts[1].t = static_cast<float>(texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * glTex->scaleY;
wallVerts[0].s = wallVerts[3].s = cliplow * glTex->scaleX;
wallVerts[2].s = wallVerts[1].s = cliphigh * glTex->scaleX;
// Texture correction for slopes
if (gl_linedef->flags & ML_EFFECT2)
{
wallVerts[3].t += static_cast<float>(gl_frontsector->ceilingheight - worldtop) * glTex->scaleY;
wallVerts[2].t += static_cast<float>(gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY;
wallVerts[0].t += static_cast<float>(gl_frontsector->floorheight - worldbottom) * glTex->scaleY;
wallVerts[1].t += static_cast<float>(gl_frontsector->floorheight - worldbottomslope) * glTex->scaleY;
wallVerts[3].t += (gl_frontsector->ceilingheight - worldtop) * glTex->scaleY;
wallVerts[2].t += (gl_frontsector->ceilingheight - worldtopslope) * glTex->scaleY;
wallVerts[0].t += (gl_frontsector->floorheight - worldbottom) * glTex->scaleY;
wallVerts[1].t += (gl_frontsector->floorheight - worldbottomslope) * glTex->scaleY;
}
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
{
wallVerts[3].t = wallVerts[0].t + static_cast<float>(worldbottom - worldtop) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t + static_cast<float>((worldbottomslope - worldtopslope)) * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t + (worldbottom - worldtop) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t + ((worldbottomslope - worldtopslope)) * glTex->scaleY;
}
else
{
wallVerts[0].t = wallVerts[3].t - static_cast<float>(worldbottom - worldtop) * glTex->scaleY;
wallVerts[1].t = wallVerts[2].t - static_cast<float>(worldbottomslope - worldtopslope) * glTex->scaleY;
wallVerts[0].t = wallVerts[3].t - (worldbottom - worldtop) * glTex->scaleY;
wallVerts[1].t = wallVerts[2].t - (worldbottomslope - worldtopslope) * glTex->scaleY;
}
//Set textures properly on single sided walls that are sloped
@@ -1881,7 +1876,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
// Used for height comparisons and etc across FOFs and slopes
fixed_t high1, highslope1, low1, lowslope1;
fixed_t high2, highslope2, low2, lowslope2;
INT32 texnum;
@@ -1894,6 +1888,19 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
for (rover = gl_backsector->ffloors; rover; rover = rover->next)
{
boolean bothsides = false;
// Skip if it exists on both sectors.
ffloor_t * r2;
for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
if (rover->master == r2->master)
{
bothsides = true;
break;
}
if (bothsides)
continue;
const ffloortype_e roverflags = rover->flags;
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || (roverflags & FF_INVERTSIDES))
@@ -1905,45 +1912,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
continue;
ffloor_t * r2;
for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
{
if (r2->master == rover->master) // Skip if same control line.
break;
const ffloortype_e r2flags = r2->flags;
if (!(r2flags & FF_EXISTS) || !(r2flags & FF_RENDERSIDES))
continue;
if (rover->flags & FF_EXTRA)
{
if (!(r2flags & FF_CUTEXTRA))
continue;
if (r2flags & FF_EXTRA && (r2flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG)))
continue;
}
else
{
if (!(r2flags & FF_CUTSOLIDS))
continue;
}
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
continue;
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
continue;
break;
}
if (r2)
continue;
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
boolean do_texture_skew;
@@ -2010,24 +1978,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (dont_peg_bottom)
texturevpeg -= (*rover->topheight - *rover->bottomheight);
wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
}
else
{
if (!dont_peg_bottom) // skew by top
{
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
}
else // skew by bottom
{
wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
}
}
@@ -2080,6 +2048,19 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
{
for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
{
boolean bothsides = false;
// Skip if it exists on both sectors.
ffloor_t * r2;
for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
if (rover->master == r2->master)
{
bothsides = true;
break;
}
if (bothsides)
continue;
const ffloortype_e roverflags = rover->flags;
if (!(roverflags & FF_EXISTS) || !(roverflags & FF_RENDERSIDES) || !(roverflags & FF_ALLSIDES))
@@ -2091,44 +2072,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if ((high1 < lowcut || highslope1 < lowcutslope) || (low1 > highcut || lowslope1 > highcutslope))
continue;
ffloor_t * r2;
for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
{
if (r2->master == rover->master) // Skip if same control line.
break;
const ffloortype_e r2flags = r2->flags;
if (!(r2flags & FF_EXISTS) || !(r2flags & FF_RENDERSIDES))
continue;
if (rover->flags & FF_EXTRA)
{
if (!(r2flags & FF_CUTEXTRA))
continue;
if (r2flags & FF_EXTRA && (r2flags & (FF_TRANSLUCENT|FF_FOG)) != (rover->flags & (FF_TRANSLUCENT|FF_FOG)))
continue;
}
else
{
if (!(r2flags & FF_CUTSOLIDS))
continue;
}
SLOPEPARAMS(*r2->t_slope, high2, highslope2, *r2->topheight)
SLOPEPARAMS(*r2->b_slope, low2, lowslope2, *r2->bottomheight)
if ((high2 < lowcut || highslope2 < lowcutslope) || (low2 > highcut || lowslope2 > highcutslope))
continue;
if ((high1 > high2 || highslope1 > highslope2) || (low1 < low2 || lowslope1 < lowslope2))
continue;
break;
}
if (r2)
continue;
side_t *side = R_GetFFloorSide(gl_curline->linedef, rover, gl_backsector);
boolean do_texture_skew;
@@ -2195,24 +2138,24 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
if (dont_peg_bottom)
texturevpeg -= (*rover->topheight - *rover->bottomheight);
wallVerts[3].t = static_cast<float>((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = static_cast<float>((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = static_cast<float>((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = ((*rover->topheight - h) + texturevpeg) * glTex->scaleY;
wallVerts[2].t = ((*rover->topheight - hS) + texturevpeg) * glTex->scaleY;
wallVerts[0].t = ((*rover->topheight - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((*rover->topheight - lS) + texturevpeg) * glTex->scaleY;
}
else
{
if (!dont_peg_bottom) // skew by top
{
wallVerts[3].t = wallVerts[2].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[0].t = static_cast<float>((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = static_cast<float>((hS - lS) + texturevpeg) * glTex->scaleY;
wallVerts[3].t = wallVerts[2].t = texturevpeg * glTex->scaleY;
wallVerts[0].t = ((h - l) + texturevpeg) * glTex->scaleY;
wallVerts[1].t = ((hS - lS) + texturevpeg) * glTex->scaleY;
}
else // skew by bottom
{
wallVerts[0].t = wallVerts[1].t = (static_cast<float>(texturevpeg) * glTex->scaleY);
wallVerts[3].t = wallVerts[0].t - static_cast<float>(h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - static_cast<float>(hS - lS) * glTex->scaleY;
wallVerts[0].t = wallVerts[1].t = texturevpeg * glTex->scaleY;
wallVerts[3].t = wallVerts[0].t - (h - l) * glTex->scaleY;
wallVerts[2].t = wallVerts[1].t - (hS - lS) * glTex->scaleY;
}
}
@@ -2553,10 +2496,8 @@ static boolean HWR_CheckBBox(const fixed_t *bspcoord)
// Find the corners of the box
// that define the edges from current viewpoint.
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 :
viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP] ? 0 :
viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
if (boxpos == 5)
return true;
@@ -2676,7 +2617,6 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
INT32 flatflag;
size_t len;
float scrollx = 0.0f, scrolly = 0.0f;
float anglef = 0.0f, cosangf = 0.0f, sinangf = 0.0f;
angle_t angle = 0;
FSurfaceInfo Surf;
fixed_t tempxsow, tempytow;
@@ -2698,14 +2638,12 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
return;
}
const sector_t *sec = FOFsector ? FOFsector : gl_frontsector;
// Allocate plane-vertex buffer if we need to
if (!planeVerts || nrPlaneVerts > numAllocedPlaneVerts)
{
numAllocedPlaneVerts = (UINT16)nrPlaneVerts;
Z_Free(planeVerts);
Z_Malloc(numAllocedPlaneVerts * sizeof(FOutVector), PU_LEVEL, &planeVerts);
Z_Malloc(numAllocedPlaneVerts * sizeof (FOutVector), PU_LEVEL, &planeVerts);
}
height = FixedToFloat(fixedheight);
@@ -2748,51 +2686,72 @@ static void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling,
flatxref = FixedToFloat(polysector->origVerts[0].x);
flatyref = FixedToFloat(polysector->origVerts[0].y);
flatxref = static_cast<float>(static_cast<fixed_t>(flatxref) & (~flatflag)) / fflatsize;
flatyref = static_cast<float>(static_cast<fixed_t>(flatyref) & (~flatflag)) / fflatsize;
flatxref = (float)(((fixed_t)flatxref & (~flatflag)) / fflatsize);
flatyref = (float)(((fixed_t)flatyref & (~flatflag)) / fflatsize);
if (!isceiling) // it's a floor
// transform
v3d = planeVerts;
if (FOFsector != NULL)
{
scrollx = FixedToFloat(sec->floor_xoffs)/fflatsize;
scrolly = FixedToFloat(sec->floor_yoffs)/fflatsize;
angle = sec->floorpic_angle;
if (!isceiling) // it's a floor
{
scrollx = FixedToFloat(FOFsector->floor_xoffs)/fflatsize;
scrolly = FixedToFloat(FOFsector->floor_yoffs)/fflatsize;
angle = FOFsector->floorpic_angle>>ANGLETOFINESHIFT;
}
else // it's a ceiling
{
scrollx = FixedToFloat(FOFsector->ceiling_xoffs)/fflatsize;
scrolly = FixedToFloat(FOFsector->ceiling_yoffs)/fflatsize;
angle = FOFsector->ceilingpic_angle>>ANGLETOFINESHIFT;
}
}
else // it's a ceiling
else if (gl_frontsector)
{
scrollx = FixedToFloat(sec->ceiling_xoffs)/fflatsize;
scrolly = FixedToFloat(sec->ceiling_yoffs)/fflatsize;
angle = sec->ceilingpic_angle;
if (!isceiling) // it's a floor
{
scrollx = FixedToFloat(gl_frontsector->floor_xoffs)/fflatsize;
scrolly = FixedToFloat(gl_frontsector->floor_yoffs)/fflatsize;
angle = gl_frontsector->floorpic_angle>>ANGLETOFINESHIFT;
}
else // it's a ceiling
{
scrollx = FixedToFloat(gl_frontsector->ceiling_xoffs)/fflatsize;
scrolly = FixedToFloat(gl_frontsector->ceiling_yoffs)/fflatsize;
angle = gl_frontsector->ceilingpic_angle>>ANGLETOFINESHIFT;
}
}
if (angle) // Only needs to be done if there's an altered angle
{
// This needs to be done so that it scrolls in a different direction after rotation like software
tempxsow = flatxref;
tempytow = flatyref;
anglef = ANG2RAD(InvAngle(angle));
tempxsow = FloatToFixed(scrollx);
tempytow = FloatToFixed(scrolly);
scrollx = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
scrolly = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
// This needs to be done so everything aligns after rotation
// It would be done so that rotation is done, THEN the translation, but I couldn't get it to rotate AND scroll like software does
cosangf = cosf(anglef);
sinangf = sinf(anglef);
flatxref = (tempxsow * cosangf) - (tempytow * sinangf);
flatyref = (tempxsow * sinangf) + (tempytow * cosangf);
tempxsow = FloatToFixed(flatxref);
tempytow = FloatToFixed(flatyref);
flatxref = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
flatyref = (FixedToFloat(FixedMul(tempxsow, FINESINE(angle)) + FixedMul(tempytow, FINECOSINE(angle))));
}
for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++, v3d++)
for (i = 0; i < (INT32)nrPlaneVerts; i++,v3d++)
{
// Go from the polysector's original vertex locations
// Means the flat is offset based on the original vertex locations
v3d->s = ((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx);
v3d->t = (flatyref - (FixedToFloat(polysector->origVerts[i].y) / fflatsize) + scrolly);
// Hurdler: add scrolling texture on floor/ceiling
v3d->s = (float)((FixedToFloat(polysector->origVerts[i].x) / fflatsize) - flatxref + scrollx); // Go from the polysector's original vertex locations
v3d->t = (float)(flatyref - (FixedToFloat(polysector->origVerts[i].y) / fflatsize) + scrolly); // Means the flat is offset based on the original vertex locations
// Need to rotate before translate
if (angle) // Only needs to be done if there's an altered angle
{
tempxsow = v3d->s;
tempytow = v3d->t;
v3d->s = (tempxsow * cosangf) - (tempytow * sinangf);
v3d->t = (tempxsow * sinangf) + (tempytow * cosangf);
tempxsow = FloatToFixed(v3d->s);
tempytow = FloatToFixed(v3d->t);
v3d->s = (FixedToFloat(FixedMul(tempxsow, FINECOSINE(angle)) - FixedMul(tempytow, FINESINE(angle))));
v3d->t = (FixedToFloat(-FixedMul(tempxsow, FINESINE(angle)) - FixedMul(tempytow, FINECOSINE(angle))));
}
v3d->x = FixedToFloat(polysector->vertices[i]->x);
@@ -3499,13 +3458,13 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
if (spr->mobj && fabsf(this_scale - 1.0f) > 1.0E-36f)
{
// Always a pixel above the floor, perfectly flat.
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - static_cast<float>(gpatch->topoffset) * this_scale - static_cast<float>(floorheight+3);
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - gpatch->topoffset * this_scale - (floorheight+3);
// Now transform the TOP vertices along the floor in the direction of the camera
swallVerts[3].x = spr->x1 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + ((static_cast<float>(gpatch->height) * this_scale) + offset) * gl_viewsin;
swallVerts[3].x = spr->x1 + ((gpatch->height * this_scale) + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + ((gpatch->height * this_scale) + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + ((gpatch->height * this_scale) + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + ((gpatch->height * this_scale) + offset) * gl_viewsin;
}
else
{
@@ -3513,10 +3472,10 @@ static void HWR_DrawSpriteShadow(gl_vissprite_t *spr, patch_t *gpatch, GLPatch_t
swallVerts[0].y = swallVerts[1].y = swallVerts[2].y = swallVerts[3].y = spr->gzt - gpatch->topoffset - (floorheight+3);
// Now transform the TOP vertices along the floor in the direction of the camera
swallVerts[3].x = spr->x1 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + (static_cast<float>(gpatch->height) + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + (static_cast<float>(gpatch->height) + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + (static_cast<float>(gpatch->height) + offset) * gl_viewsin;
swallVerts[3].x = spr->x1 + (gpatch->height + offset) * gl_viewcos;
swallVerts[2].x = spr->x2 + (gpatch->height + offset) * gl_viewcos;
swallVerts[3].z = spr->z1 + (gpatch->height + offset) * gl_viewsin;
swallVerts[2].z = spr->z2 + (gpatch->height + offset) * gl_viewsin;
}
// We also need to move the bottom ones away when shadowoffs is on
@@ -4447,6 +4406,9 @@ static void HWR_RenderDrawNodes(void)
// Okay! Let's draw it all! Woo!
GL_SetTransform(&atransform);
if (LIKELY(cv_glbatching.value))
HWR_StartBatching();
for (i = 0; i < numdrawnodes; i++)
{
gl_drawnode_t *drawnode = &drawnodes[sortindex[i]];
@@ -4500,6 +4462,9 @@ static void HWR_RenderDrawNodes(void)
PS_STOP_TIMING(ps_hw_nodedrawtime);
if (LIKELY(cv_glbatching.value))
HWR_RenderBatches(false);
drawnodes.clear(); // clear so our size is 0 again!
}
@@ -5188,8 +5153,6 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
z2 = tr_y - x2 * rightsin;
x1 = tr_x + x1 * rightcos;
x2 = tr_x - x2 * rightcos;
//y1 = tr_y + y1 * rightcos;
//y2 = tr_y - y2 * rightcos;
//
// store information in a vissprite
@@ -5368,7 +5331,7 @@ void HWR_BuildSkyDome(void)
}
// precompute to save a bit of division
static constexpr float FINEDEGREE = (360.0f/static_cast<float>(FINEANGLES));
static constexpr float FINEDEGREE = (360.0f/(float)FINEANGLES);
static void HWR_DrawSkyBackground(void)
{
@@ -5386,7 +5349,7 @@ static void HWR_DrawSkyBackground(void)
//04/01/2000: Hurdler: added for T&L
// It should replace all other gl_viewxxx when finished
HWR_SetTransformAiming(&dometransform);
dometransform.angley = static_cast<float>((viewangle-ANGLE_270) >> ANGLETOFINESHIFT)*(FINEDEGREE);
dometransform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(FINEDEGREE);
HWR_GetTexture(texturetranslation[skytexture], false);
@@ -5431,7 +5394,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
if (cv_glshearing.value)
{
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) * ((float)vid.width / vid.height) / ((float)BASEVIDWIDTH / BASEVIDHEIGHT);
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->shearing = true;
@@ -5443,7 +5406,7 @@ static void HWR_SetTransformAiming(FTransform *trans)
gl_aimingangle = aimingangle;
}
trans->anglex = static_cast<float>(gl_aimingangle >> ANGLETOFINESHIFT)*(FINEDEGREE);
trans->anglex = (float)(gl_aimingangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
}
void HWR_SetTransform(float fpov)
@@ -5462,11 +5425,11 @@ void HWR_SetTransform(float fpov)
atransform.z = gl_viewz;
atransform.scalex = 1;
atransform.scaley = static_cast<float>(vid.width) / static_cast<float>(vid.height);
atransform.scaley = (float)vid.width/vid.height;
atransform.scalez = 1;
HWR_SetTransformAiming(&atransform);
atransform.angley = static_cast<float>(viewangle >> ANGLETOFINESHIFT)*(FINEDEGREE);
atransform.angley = (float)(viewangle>>ANGLETOFINESHIFT)*(FINEDEGREE);
yaw = 270.0f - atransform.angley;
inv_yaw = 180.0f - yaw;
@@ -5477,8 +5440,8 @@ void HWR_SetTransform(float fpov)
// only needed for sprite billboarding
if (cv_glspritebillboarding.value && !cv_glshearing.value)
{
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle >> ANGLETOFINESHIFT));
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle >> ANGLETOFINESHIFT));
gl_viewludsin = FixedToFloat(FINECOSINE(gl_aimingangle>>ANGLETOFINESHIFT));
gl_viewludcos = FixedToFloat(-FINESINE(gl_aimingangle>>ANGLETOFINESHIFT));
}
atransform.fovangle = fpov; // Tails
@@ -5506,6 +5469,7 @@ void HWR_SetTransform(float fpov)
void HWR_ClearClipper(void)
{
const angle_t a1 = gld_FrustumAngle(gl_aimingangle);
gld_clipper_Clear();
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
#ifdef HAVE_SPHEREFRUSTRUM
@@ -5590,7 +5554,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
{
if (allow_portals && rootportal)
{
HWR_PortalFrame(rootportal);// for portalclipsector, it could have gone null from search
HWR_PortalFrame(rootportal); // for portalclipsector, it could have gone null from search
HWR_PortalClipping(rootportal);
}
}
@@ -5640,7 +5604,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
PS_STOP_TIMING(ps_bsptime);
if (LIKELY(cv_glbatching.value))
HWR_RenderBatches();
HWR_RenderBatches(true);
// Check for new console commands.
NetUpdate();
@@ -5667,11 +5631,15 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
HWR_SortVisSprites();
PS_STOP_TIMING(ps_hw_spritesorttime);
PS_START_TIMING(ps_hw_spritedrawtime);
if (LIKELY(cv_glbatching.value))
HWR_StartBatching();
if (UNLIKELY(cv_glmdls.value))
HWR_DrawSprites<DrawSpritesType::kModels>();
else
HWR_DrawSprites<DrawSpritesType::kSprites>();
PS_STOP_TIMING(ps_hw_spritedrawtime);
if (LIKELY(cv_glbatching.value))
HWR_RenderBatches(false);
ps_numdrawnodes.value.i = 0;
ps_hw_nodesorttime.value.p = 0;
@@ -5739,7 +5707,7 @@ static void HWR_RollTransform(FTransform *tr, angle_t roll)
{
if (roll != 0)
{
tr->rollangle = static_cast<float>(roll) / static_cast<float>(ANG1);
tr->rollangle = roll / (float)ANG1;
tr->roll = true;
tr->rollx = 1.0f;
tr->rollz = 0.0f;
@@ -6139,7 +6107,7 @@ static void HWR_DoPostProcessor(void)
for (y = 0; y < SCREENVERTS; y++)
{
// Change X position based on its Y position.
v[x][y][0] = x-4.5f + sinf(((disStart+(static_cast<float>(y) * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
v[x][y][0] = x-4.5f + sinf(((disStart+((float)y * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
v[x][y][1] = y-4.5f; // (y / scale)
}
}
+7 -1
View File
@@ -2209,10 +2209,16 @@ static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRG
UNIFORM_1(shader->uniforms[gluniform_light_contrast], shader_light_contrast, pglUniform1f);
UNIFORM_1(shader->uniforms[gluniform_light_backlight], shader_light_backlight, pglUniform1f);
}
else
{
UNIFORM_3(shader->uniforms[gluniform_light_dir], 0, 0, 0, pglUniform3f);
UNIFORM_1(shader->uniforms[gluniform_light_contrast], 0, pglUniform1f);
UNIFORM_1(shader->uniforms[gluniform_light_backlight], 0, pglUniform1f);
}
UNIFORM_1(shader->uniforms[gluniform_leveltime], shader_leveltime, pglUniform1f);
UNIFORM_2(shader->uniforms[gluniform_scr_resolution], (GLfloat)vid.width, (GLfloat)vid.height, pglUniform2f);
UNIFORM_2(shader->uniforms[gluniform_scr_resolution], vid.width, vid.height, pglUniform2f);
#undef UNIFORM_1
#undef UNIFORM_2
+1 -1
View File
@@ -27,7 +27,7 @@ extern "C" {
#ifdef HAVE_SDL
#define _MATH_DEFINES_DEFINED
#include "SDL_opengl.h" //Alam_GBC: Simple, yes?
#include <SDL3/SDL_opengl.h> //Alam_GBC: Simple, yes?
#else
#include <GL/gl.h>
+1 -1
View File
@@ -1738,7 +1738,7 @@ static void HU_drawChatLog(INT32 offset)
{
if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy)))
{
M_DrawEmote(x+dx+2, y+dy+1, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
M_DrawEmote(x+dx+2, y+dy, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT);
dx += EMOTEWIDTH - charwidth;
}
j += emotelen;
+2 -2
View File
@@ -80,8 +80,6 @@ typedef struct
#define DOOMCOM_DATA(d) (doomdata_t *)&(d)->data
extern doomcom_t *doomcom;
#ifdef HOLEPUNCH
typedef struct
{
@@ -93,6 +91,8 @@ typedef struct
#define HOLEPUNCH_DATA(d) (holepunch_t *)&(d)->data
#endif
extern doomcom_t *doomcom;
/** \brief return packet in doomcom struct
*/
extern boolean (*I_NetGet)(void);
-2
View File
@@ -158,8 +158,6 @@ UINT32 I_GetSongLoopPoint(void);
boolean I_SetSongPosition(UINT32 position);
UINT32 I_GetSongPosition(void);
void I_UpdateSongLagThreshold (void);
/// ------------------------
// MUSIC PLAYBACK
/// ------------------------
+5 -6
View File
@@ -568,12 +568,13 @@ void Command_Numnodes(void)
#ifdef HOLEPUNCH
/* not one of the reserved "local" addresses */
static boolean is_external_address(UINT32 p)
static boolean
is_external_address (UINT32 p)
{
UINT8 a = (p & 255);
UINT8 b = ((p >> 8) & 255);
if (p == (UINT32)~0) /* 255.255.255.255 */
if (p == (UINT32)~0)/* 255.255.255.255 */
return 0;
switch (a)
@@ -583,7 +584,7 @@ static boolean is_external_address(UINT32 p)
case 127:
return false;
case 172:
return (b & ~15) != 16; /* 16 - 31 */
return (b & ~15) != 16;/* 16 - 31 */
case 192:
return b != 168;
default:
@@ -762,7 +763,6 @@ static void SOCK_Send(void)
if (myfamily[i] == broadcastaddress[j].any.sa_family)
{
c = SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
if (c == ERRSOCKET)
{
e = errno;
@@ -780,7 +780,6 @@ static void SOCK_Send(void)
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
{
c = SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
if (c == ERRSOCKET)
{
e = errno;
@@ -793,7 +792,6 @@ static void SOCK_Send(void)
else
{
c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]);
if (c == ERRSOCKET)
{
e = errno;
@@ -1062,6 +1060,7 @@ static boolean UDP_Socket(void)
#endif
const char *serv;
for (s = 0; s < mysocketses; s++)
mysockets[s] = ERRSOCKET;
for (s = 0; s < MAXNETNODES+1; s++)
+2
View File
@@ -95,6 +95,7 @@ INT32 VID_SetMode(INT32 modenum);
*/
const char *VID_GetModeName(INT32 modenum);
void VID_RefreshModeList(void);
void VID_PrepareModeList(void);
/** \brief can video system do fullscreen
@@ -121,6 +122,7 @@ void I_ReadScreen(UINT8 * restrict scr, INT32 scale);
UINT32 I_GetRefreshRate(void);
boolean I_CheckAboveDesktopRes(INT32 width, INT32 height);
boolean I_CheckNativeRes(void);
void I_SetBorderlessWindow(void);
-2
View File
@@ -19,8 +19,6 @@
#include "sounds.h"
#include "m_fixed.h"
#define MAXDOOMEDNUM 4095
// dehacked.c now has lists for the more named enums! PLEASE keep them up to date!
// For great modding!!
+1 -1
View File
@@ -568,7 +568,7 @@ static patch_t *kp_racefinish[6];
static patch_t *kp_positionnum[NUMPOSNUMS][NUMPOSFRAMES];
static patch_t *kp_winnernum[NUMPOSFRAMES];
patch_t *kp_facenum[MAXPLAYERS+1];
static patch_t *kp_facenum[MAXPLAYERS+1];
static patch_t *kp_facehighlight[8];
static patch_t *kp_rankbumper;
-3
View File
@@ -41,9 +41,6 @@ extern consvar_t cv_battlespeedo;
extern consvar_t cv_multiitemicon;
extern consvar_t cv_huditemamount;
// for use in timeattack menu
extern patch_t *kp_facenum[MAXPLAYERS+1];
#define NUMSPEEDOSTUFF 8
extern CV_PossibleValue_t speedo_cons_t[NUMSPEEDOSTUFF];
#define NUMDGAUGESTUFF 6
+54 -50
View File
@@ -5179,24 +5179,6 @@ player_t *K_FindJawzTarget(mobj_t *actor, player_t *source)
return wtarg;
}
static INT32 K_GetEngineClass(const player_t *player)
{
INT32 speed, weight;
speed = (player->kartspeed - 1) / 3;
weight = (player->kartweight - 1) / 3;
#define LOCKSTAT(stat) \
if (stat < 0) { stat = 0; } \
if (stat > 2) { stat = 2; }
LOCKSTAT(speed);
LOCKSTAT(weight);
#undef LOCKSTAT
return (speed + (3*weight));
}
// Engine Sounds.
static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
{
@@ -5207,7 +5189,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
static const UINT8 dampenval = 48; // 255 * 48 = close enough to FRACUNIT/6
INT32 class; // engine class number
INT32 class, s, w; // engine class number
UINT8 volume = 255;
fixed_t volumedampen = FRACUNIT;
@@ -5243,7 +5225,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
targetsnd = (((6 * cmd->forwardmove) / 25) + ((player->speed / mapobjectscale) / 5)) / 2;
}
if (targetsnd < 0) { targetsnd = 0; }
if (targetsnd < 0) { targetsnd = 0; }
if (targetsnd > 12) { targetsnd = 12; }
if (player->kartstuff[k_enginesnd] < targetsnd) { player->kartstuff[k_enginesnd]++; }
@@ -5320,7 +5302,17 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
return;
}
class = K_GetEngineClass(player);
s = (player->kartspeed - 1) / 3;
w = (player->kartweight - 1) / 3;
#define LOCKSTAT(stat) \
if (stat < 0) { stat = 0; } \
if (stat > 2) { stat = 2; }
LOCKSTAT(s);
LOCKSTAT(w);
#undef LOCKSTAT
class = s + (3*w);
S_StartSoundAtVolume(player->mo, (sfx_krta00 + player->kartstuff[k_enginesnd]) + (class * numsnds), volume);
}
@@ -5739,7 +5731,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
K_UpdateInvincibilitySounds(player); // Also thanks, VAda!
// Plays the music during and after the starting countdown.
if ((leveltime <= MUSICSTARTTIME) && P_IsLocalPlayer(player))
if (P_IsLocalPlayer(player))
S_StartMapMusic();
}
@@ -5919,33 +5911,45 @@ static void K_KartDrift(player_t *player, boolean onground)
// Holding the Jump button will enable drifting.
// Drift Release (Moved here so you can't "chain" drifts)
if (onground && player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
&& player->kartstuff[k_driftcharge] < dsone
&& onground)
{
if (player->kartstuff[k_driftcharge] < dsone)
{
player->kartstuff[k_driftcharge] = 0;
}
else if (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo)
{
if (player->kartstuff[k_driftboost] < 20)
player->kartstuff[k_driftboost] = 20;
S_StartSound(player->mo, sfx_s23c);
player->kartstuff[k_driftcharge] = 0;
}
else if (player->kartstuff[k_driftcharge] < dsthree)
{
if (player->kartstuff[k_driftboost] < 50)
player->kartstuff[k_driftboost] = 50;
S_StartSound(player->mo, sfx_s23c);
player->kartstuff[k_driftcharge] = 0;
}
else if (player->kartstuff[k_driftcharge] >= dsthree)
{
if (player->kartstuff[k_driftboost] < 125)
player->kartstuff[k_driftboost] = 125;
S_StartSound(player->mo, sfx_s23c);
player->kartstuff[k_driftcharge] = 0;
}
player->kartstuff[k_driftcharge] = 0;
}
else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
&& (player->kartstuff[k_driftcharge] >= dsone && player->kartstuff[k_driftcharge] < dstwo)
&& onground)
{
if (player->kartstuff[k_driftboost] < 20)
player->kartstuff[k_driftboost] = 20;
S_StartSound(player->mo, sfx_s23c);
//K_SpawnDashDustRelease(player);
player->kartstuff[k_driftcharge] = 0;
}
else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
&& player->kartstuff[k_driftcharge] < dsthree
&& onground)
{
if (player->kartstuff[k_driftboost] < 50)
player->kartstuff[k_driftboost] = 50;
S_StartSound(player->mo, sfx_s23c);
//K_SpawnDashDustRelease(player);
player->kartstuff[k_driftcharge] = 0;
}
else if ((player->kartstuff[k_drift] != -5 && player->kartstuff[k_drift] != 5)
// || (player->kartstuff[k_drift] >= 1 && player->kartstuff[k_turndir] != 1) || (player->kartstuff[k_drift] <= -1 && player->kartstuff[k_turndir] != -1))
&& player->kartstuff[k_driftcharge] >= dsthree
&& onground)
{
if (player->kartstuff[k_driftboost] < 125)
player->kartstuff[k_driftboost] = 125;
S_StartSound(player->mo, sfx_s23c);
//K_SpawnDashDustRelease(player);
player->kartstuff[k_driftcharge] = 0;
}
// Drifting: left or right?
@@ -6023,8 +6027,8 @@ static void K_KartDrift(player_t *player, boolean onground)
// Sound whenever you get a different tier of sparks
if (driftblue
|| driftred
|| driftrainbow)
|| driftred
|| driftrainbow)
{
//S_StartSound(player->mo, sfx_s3ka2);
if (P_IsLocalPlayer(player)) // UGHGHGH...
+10 -65
View File
@@ -149,8 +149,7 @@ enum cameraf {
camera_momx,
camera_momy,
camera_momz,
camera_pnum,
camera_freecam,
camera_pnum
};
@@ -170,7 +169,6 @@ static const char *const camera_opt[] = {
"momy",
"momz",
"pnum",
"freecam",
NULL};
enum hudpatch {
@@ -389,43 +387,10 @@ static int camera_get(lua_State *L)
case camera_pnum:
lua_pushinteger(L, camnum);
break;
case camera_freecam:
lua_pushboolean(L, cam->freecam);
break;
}
return 1;
}
static int lib_getCamera(lua_State *L)
{
// No cameras on dedicated
if (dedicated)
return 0;
if (lua_type(L, 2) == LUA_TNUMBER)
{
int i = lua_tonumber(L, 2);
if (i < 0 || i > splitscreen)
return 0;
LUA_PushUserdata(L, &camera[i], META_CAMERA);
return 1;
}
return 0;
}
static int lib_lenCamera(lua_State *L)
{
if (dedicated)
lua_pushinteger(L, 0);
else
lua_pushinteger(L, splitscreen+1); // splitscreen == 0 -> 1 active camera, splitscreen == 1 -> 2 cameras and so on
return 1;
}
//
// lib_draw
//
@@ -1287,33 +1252,23 @@ extern int lib_hudadd(lua_State *L);
static int lib_hudsetvotebackground(lua_State *L)
{
// Reset to default
memset(VoteScreen.luaPrefix, 0, sizeof(VoteScreen.luaPrefix));
VoteScreen.timePerAnimFrame = 2;
if (!lua_isnoneornil(L, 1))
if (lua_isnoneornil(L, 1))
{
const char *prefix = luaL_checkstring(L, 1);
if (strlen(prefix) != 4)
{
return luaL_argerror(L, 1, "prefix should 4 characters wide");
}
strncpy(VoteScreen.luaPrefix, prefix, 4);
strupr(VoteScreen.luaPrefix);
return 0;
}
if (!lua_isnoneornil(L, 2))
const char *prefix = luaL_checkstring(L, 1);
if (strlen(prefix) != 4)
{
INT32 time_per_frame = luaL_checkinteger(L, 2);
if (time_per_frame <= 0)
return luaL_argerror(L, 2, "time per frame should be 1 or more");
VoteScreen.timePerAnimFrame = time_per_frame;
return luaL_argerror(L, 1, "prefix should 4 characters wide");
}
strncpy(VoteScreen.luaPrefix, prefix, 4);
strupr(VoteScreen.luaPrefix);
// Update background if we're already on vote screen
if (gamestate == GS_VOTING)
Y_VoteScreenCheck();
@@ -1416,16 +1371,6 @@ int LUA_HudLib(lua_State *L)
lua_setfield(L, -2, "__index");
lua_pop(L,1);
lua_newuserdata(L, 0);
lua_createtable(L, 0, 2);
lua_pushcfunction(L, lib_getCamera);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, lib_lenCamera);
lua_setfield(L, -2, "__len");
lua_setmetatable(L, -2);
lua_setglobal(L, "cameras");
camera_fields_ref = Lua_CreateFieldTable(L, camera_opt);
luaL_register(L, "hud", lib_hud);
+1 -1
View File
@@ -908,7 +908,7 @@ void OP_ObjectplaceMovement(player_t *player)
ticcmd_t *cmd = &player->cmd;
if (!player->climbing && (netgame || (player->pflags & PF_SPINNING)))
player->mo->angle = (cmd->angleturn << TICCMD_REDUCE);
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
ticruned++;
if (!(cmd->angleturn & TICCMD_RECEIVED))
+275 -386
View File
File diff suppressed because it is too large. Load diff
+7 -5
View File
@@ -223,6 +223,11 @@ extern menu_t *currentMenu;
extern menu_t MainDef;
extern menu_t SP_LoadDef;
#define MAXCOLUMNMODES 12 //max modes displayed in one column
#define MAXMODEDESCS (MAXCOLUMNMODES*3)
extern menu_t OP_VideoModeDef;
void M_VideoModeMenu(INT32 choice);
// Call upon joystick hotplug
void M_SetupJoystickMenu(INT32 choice);
extern menu_t OP_JoystickSetDef;
@@ -301,15 +306,12 @@ void SaturnHud_menu_Onchange(void);
void GameFocus_menu_Onchange (void);
void ShowLocalskinMenu_Onchange(void);
#ifdef HWRENDER
void M_UpdateOGLMenu(void);
#endif
void M_ResetDemoList(void);
void M_ReplayHut(INT32 choice);
void M_ReturnToTitleFromError(void);
void M_SetPlaybackMenuPointer(void);
void Nextmap_OnChange(void);
@@ -398,7 +400,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
NULL\
}
#define CONTROLMENUSTYLE(source, prev, tooltip)\
#define CONTROLMENUSTYLE(source, prev)\
{\
"M_CONTRO",\
sizeof (source)/sizeof (menuitem_t),\
@@ -409,7 +411,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na
26, 40,\
0,\
NULL,\
tooltip\
NULL\
}
#define IMAGEDEF(source)\
+81 -91
View File
@@ -600,7 +600,7 @@ static menuitem_t OP_MainMenu[] =
{IT_SUBMENU|IT_STRING, NULL, "Game Focus Options...", &OP_FocusOptionsDef, 33},
{IT_SUBMENU|IT_STRING, NULL, "HUD Options...", &OP_HUDOptionsDef, 46},
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 56},
{IT_SUBMENU|IT_STRING, NULL, "Camera Options...", &OP_CamOptionsDef, 56},
{IT_SUBMENU|IT_STRING, NULL, "Gameplay Options...", &OP_GameOptionsDef, 66},
{IT_SUBMENU|IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 76},
@@ -610,7 +610,7 @@ static menuitem_t OP_MainMenu[] =
{IT_CALL|IT_STRING, NULL, "Tricks & Secrets (F1)", M_Manual, 109},
{IT_CALL|IT_STRING, NULL, "Play Credits", M_Credits, 119},
{IT_SUBMENU|IT_STRING, NULL, "Accessibility Options...", &OP_AccessibilityDef, 132},
{IT_SUBMENU|IT_STRING, NULL, "Accessibility Options...",&OP_AccessibilityDef, 132},
{IT_SUBMENU|IT_STRING, NULL, "Saturn Options...", &OP_SaturnDef, 142},
{IT_SUBMENU|IT_STRING, NULL, "Bird...", &OP_BirdDef, 152},
@@ -648,6 +648,17 @@ static menuitem_t OP_ControlsMenu[] =
{IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 55},
{IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 75},
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P1)", &cv_turnsmooth[0], 85},
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P2)", &cv_turnsmooth[1], 95},
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P3)", &cv_turnsmooth[2], 105},
{IT_STRING | IT_CVAR, NULL, "Digital turn easing (P4)", &cv_turnsmooth[3], 115},
// i hate our menus sincerly
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P1)", &cv_litesteer[0], 135},
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P2)", &cv_litesteer[1], 145},
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P3)", &cv_litesteer[2], 155},
{IT_STRING | IT_CVAR, NULL, "Lite Steer (P4)", &cv_litesteer[3], 165},
};
static const char* OP_ControlsTooltips[] =
@@ -658,6 +669,15 @@ static const char* OP_ControlsTooltips[] =
"Setup player 4 controls.",
"Options for mouse control.",
"Allowed amount of controls per key.",
"Turn smoothing for non-analog turning (Player 1).",
"Turn smoothing for non-analog turning (Player 2).",
"Turn smoothing for non-analog turning (Player 3).",
"Turn smoothing for non-analog turning (Player 4).",
"Hold DOWN on d-pad/keyboard for shallow turns (Player 1).",
"Hold DOWN on d-pad/keyboard for shallow turns (Player 2).",
"Hold DOWN on d-pad/keyboard for shallow turns (Player 3).",
"Hold DOWN on d-pad/keyboard for shallow turns (Player 4).",
};
static menuitem_t OP_AllControlsMenu[] =
@@ -665,13 +685,6 @@ static menuitem_t OP_AllControlsMenu[] =
{IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0},
{IT_CALL|IT_STRING, NULL, "Reset to defaults", M_ResetControls, 8},
{IT_HEADER, NULL, "Control Options", NULL, 0},
{IT_SPACE, NULL, NULL, NULL, 0},
// Cvars are set in M_SetupControlsMenu
{IT_STRING|IT_CVAR, NULL, "Lite Steer", &cv_litesteer[0], 18},
{IT_STRING|IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth[0], 26},
//{IT_SPACE, NULL, NULL, NULL, 0},
{IT_HEADER, NULL, "Gameplay Controls", NULL, 0},
{IT_SPACE, NULL, NULL, NULL, 0},
@@ -720,17 +733,6 @@ static menuitem_t OP_AllControlsMenu[] =
{IT_CONTROL, NULL, "Custom Action 3", M_ChangeControl, gc_custom3 },
};
// Has to be same length as OP_AllControlsMenu, but otherwise its mostly empty
static const char* OP_AllControlsTooltips[sizeof(OP_AllControlsMenu)/sizeof(OP_AllControlsMenu[0])] = {
NULL,
NULL,
NULL,
NULL,
"Hold DOWN on d-pad/keyboard for shallow turns.",
"Turn smoothing for non-analog turning.",
// The rest is null, for now
};
#define OP_JOYMENU(pnum) \
{IT_HEADER, NULL, "Gameplay Controls", NULL, 7}, \
{IT_STRING | IT_CVAR, NULL, "Aim Forward/Back" , &cv_aimaxis[pnum] , 15}, \
@@ -798,7 +800,7 @@ static menuitem_t OP_MouseOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Mouse Turning", &cv_mouseturn, 20},
{IT_STRING | IT_CVAR, NULL, "Invert Mouse", &cv_invertmouse, 30},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse X Speed", &cv_mousexsens, 40},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse X Speed", &cv_mousesens, 40},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Mouse Y Speed", &cv_mouseysens, 50},
};
@@ -1151,6 +1153,13 @@ static menuitem_t OP_SoundAdvancedMenu[] =
{IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 35},
#endif
#ifdef HAVE_FLUIDSYNTH
{IT_HEADER, NULL, "MIDI Settings", NULL, NULL, OPENMPT_MENUOFFSET},
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Sound Font File", NULL, &cv_midisoundfontpath, OPENMPT_MENUOFFSET+12},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chorus", NULL, &cv_midichorus, OPENMPT_MENUOFFSET+40},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Reverb", NULL, &cv_midireverb, OPENMPT_MENUOFFSET+50},
#endif
{IT_HEADER, NULL, "Misc", NULL, 45},
{IT_STRING | IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 55},
@@ -1178,6 +1187,11 @@ static const char* OP_SoundAdvancedTooltips[] =
"Which Amiga should be used for .mod playback?",
#endif
"How far should the four channels in .mod be panned?",
#endif
#ifdef HAVE_FLUIDSYNTH
"Which MIDI soundfont to use",
"Controls the chorus of MIDI playback\n setting this too high might cause some instruments to be overexposed",
"Controls the reverb of MIDI playback\n setting this too high might cause notes to be drawn out",
#endif
NULL,
"How many times is the same sound allowed to play at once?\nIf 0 theres no limit.",
@@ -1323,14 +1337,13 @@ static menuitem_t OP_HUDOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Menu Highlights", &cons_menuhighlight, 95},
// highlight info - (GOOD HIGHLIGHT, WARNING HIGHLIGHT) - 110 (see M_DrawHUDOptions)
{IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120},
{IT_STRING | IT_CVAR, NULL, "Show Console Prints in Menu",&cons_consoleprintinmenu, 130},
{IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120},
{IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 145},
{IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 135},
{IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 155},
{IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 145},
{IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 165},
{IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 155},
};
static menuitem_t OP_CamOptionsMenu[] =
@@ -1339,19 +1352,16 @@ static menuitem_t OP_CamOptionsMenu[] =
{IT_STRING | IT_CVAR | IT_CV_BIGFLOAT, NULL, "Field of View",&cv_fov, 30},
{IT_STRING | IT_CVAR, NULL, "Flipcam Mode", &cv_flipcammode, 40},
{IT_STRING | IT_SUBMENU, NULL, "Player 1 Camera options...", &OP_Player1CamOptionsDef, 60},
{IT_STRING | IT_SUBMENU, NULL, "Player 2 Camera options...", &OP_Player2CamOptionsDef, 70},
{IT_STRING | IT_SUBMENU, NULL, "Player 3 Camera options...", &OP_Player3CamOptionsDef, 80},
{IT_STRING | IT_SUBMENU, NULL, "Player 4 Camera options...", &OP_Player4CamOptionsDef, 90},
{IT_STRING | IT_SUBMENU, NULL, "Player 1 Camera options...", &OP_Player1CamOptionsDef, 50},
{IT_STRING | IT_SUBMENU, NULL, "Player 2 Camera options...", &OP_Player2CamOptionsDef, 60},
{IT_STRING | IT_SUBMENU, NULL, "Player 3 Camera options...", &OP_Player3CamOptionsDef, 70},
{IT_STRING | IT_SUBMENU, NULL, "Player 4 Camera options...", &OP_Player4CamOptionsDef, 80},
};
static const char* OP_CamOptionsTooltips[] =
{
NULL,
"Player field of view.",
"Change flipcam mode.\nDisplayplayer - use currently viewed player option.\nLocal - use local flipcam toggle option.",
NULL,
NULL,
NULL,
@@ -1647,19 +1657,12 @@ static menuitem_t OP_AccessibilityMenu[] =
{IT_STRING|IT_CVAR, NULL, "Quake Screenshakes", &cv_screenquake, 60},
{IT_CALL|IT_STRING, NULL, "Camera Options...", M_CameraMenu, 65},
{IT_SUBMENU|IT_STRING, NULL, "Camera Options...", &OP_CamOptionsDef, 65},
{IT_HEADER, NULL, "Audio", NULL, 75},
{IT_STRING|IT_CVAR, NULL, "Reverse L/R Channels", &stereoreverse, 85},
{IT_STRING|IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 90},
{IT_HEADER, NULL, "Controls", NULL, 100},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P1)", &cv_autoaccel[0], 110},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P2)", &cv_autoaccel[1], 115},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P3)", &cv_autoaccel[2], 120},
{IT_STRING|IT_CVAR, NULL, "Automatic Acceleration (P4)", &cv_autoaccel[3], 125},
};
static const char* OP_AccessibilityTooltips[] =
@@ -1681,11 +1684,6 @@ static const char* OP_AccessibilityTooltips[] =
NULL,
"Reverse left and right channels of audio.",
"Change how often the same Sound is allowed to play at once.",
NULL,
"Automatically hold acceleration button (Player 1).",
"Automatically hold acceleration button (Player 2).",
"Automatically hold acceleration button (Player 3).",
"Automatically hold acceleration button (Player 4).",
};
static menuitem_t OP_SaturnMenu[] =
@@ -1862,16 +1860,15 @@ static menuitem_t OP_SaturnHudMenu[] =
{IT_STRING|IT_CVAR, NULL, "Player Angle Visual", &cv_showminimapangle, 150},
{IT_STRING|IT_CVAR, NULL, "Music Credits", &cv_songcredits, 160},
{IT_STRING|IT_CVAR, NULL, "Music Credits on Pause", &cv_pausesongcredits, 165},
{IT_STRING|IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 175},
{IT_STRING|IT_CVAR, NULL, "Beta Intermissionscreen", &cv_betainterscreen, 170},
{IT_STRING|IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 185},
{IT_STRING|IT_CVAR, NULL, "Show Director Prompt", &cv_showdirectorhud, 180},
{IT_STRING|IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 195},
{IT_STRING|IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 200},
{IT_STRING|IT_SUBMENU, NULL, "Nametags...", &OP_NametagDef, 190},
{IT_STRING|IT_SUBMENU, NULL, "Driftgauge...", &OP_DriftGaugeDef, 195},
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 210},
{IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 205},
};
static const char* OP_SaturnHudTooltips[] =
@@ -1898,7 +1895,6 @@ static const char* OP_SaturnHudTooltips[] =
"Erratically rotate player icons during spinouts.",
"Visualize the player facing angle.",
"Show the Music Credits and which style.",
"Show the Music Credits while in pause menu.",
"Make the Intermission screen look like in beta versions of Kart!\nEither with background or just the rest.",
"Show the Director Toggle prompt when spectating.",
"Nametag Options.",
@@ -1986,46 +1982,47 @@ static menuitem_t OP_HudOffsetMenu[] =
// absolutely crazy how many people put work into this at this point <3
static menuitem_t OP_SaturnCreditsMenu[] =
{
// in no particular order besides me and indev <3
{IT_HEADER, NULL, "Thanks to all contributers <3", NULL, 0},
{IT_STRING2+IT_SPACE, NULL, "Alug Indev", NULL, 10},
{IT_STRING2+IT_SPACE, NULL, "Haya Nepdisk", NULL, 20},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy xyzzy", NULL, 30},
{IT_STRING2+IT_SPACE, NULL, "Chearii riomccloud", NULL, 40},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe PAS", NULL, 50},
{IT_STRING2+IT_SPACE, NULL, "$HOME yama", NULL, 60},
{IT_STRING2+IT_SPACE, NULL, "Achii scizor300", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "Superjustinbros Lugent", NULL, 80},
{IT_STRING2+IT_SPACE, NULL, "Alug", NULL, 10},
{IT_STRING2+IT_SPACE, NULL, "Indev", NULL, 20},
{IT_STRING2+IT_SPACE, NULL, "Haya", NULL, 30},
{IT_STRING2+IT_SPACE, NULL, "Nepdisk", NULL, 40},
{IT_STRING2+IT_SPACE, NULL, "GenericHeroGuy", NULL, 50},
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 60},
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "riomccloud", NULL, 80},
{IT_STRING2+IT_SPACE, NULL, "chromaticpipe", NULL, 90},
{IT_STRING2+IT_SPACE, NULL, "PAS", NULL, 100},
{IT_STRING2+IT_SPACE, NULL, "$HOME", NULL, 110},
{IT_STRING2+IT_SPACE, NULL, "Achii", NULL, 120},
{IT_STRING2+IT_SPACE, NULL, "Anonimus", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "scizor300", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Lugent", NULL, 150},
{IT_HEADER, NULL, "", NULL, 74},
{IT_HEADER, NULL, "", NULL, 124},
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 110},
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 120},
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 130},
{IT_STRING2+IT_SPACE, NULL, "jin Mompi", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Phoenix", NULL, 150},
{IT_STRING2+IT_SPACE, NULL, "Sunflower Yuz", NULL, 180},
{IT_STRING2+IT_SPACE, NULL, "Democrab EXpand", NULL, 190},
{IT_STRING2+IT_SPACE, NULL, "Nexit Spee", NULL, 200},
{IT_STRING2+IT_SPACE, NULL, "jin", NULL, 210},
{IT_HEADER, NULL, "Special Thanks <3", NULL, 130},
{IT_HEADER, NULL, "Special Thanks <3", NULL, 168},
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 140},
{IT_STRING2+IT_SPACE, NULL, "Blankart", NULL, 150},
{IT_STRING2+IT_SPACE, NULL, "SRB2 Legacy", NULL, 160},
{IT_STRING2+IT_SPACE, NULL, "SRB2 Classic", NULL, 170},
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion and Birdhouse Team", NULL, 180},
{IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 190},
{IT_STRING2+IT_SPACE, NULL, "All of Sunflower's Garden", NULL, 178},
{IT_STRING2+IT_SPACE, NULL, "The Moe Mansion and Birdhouse Team", NULL, 188},
{IT_STRING2+IT_SPACE, NULL, "Galactice for Galaxy", NULL, 198},
{IT_STRING+IT_SPACE, NULL, "", NULL, 228}, // dummy text I
{IT_STRING, NULL, "", NULL, 278}, // dummy text II
{IT_STRING+IT_SPACE, NULL, "", NULL, 198}, // dummy text I
{IT_STRING, NULL, "", NULL, 258}, // dummy text II
};
// sry we dont have space for this anymore :c < now we have again, for now..... TODO: finally stop being a lazy ass and make a cool credits screen
static const char* OP_CreditTooltips[] =
// sry we dont have space for this anymore :c
/*static const char* OP_CreditTooltips[] =
{
// this sucks lol note to self: we need as many NULLs as we have entries in OP_SaturnCreditsMenu - 1
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
"Thanks everyone! <3"
};
};*/
static menuitem_t OP_BirdMenu[] =
@@ -2195,9 +2192,6 @@ static menuitem_t OP_AdvancedBirdMenu[] =
{IT_STRING | IT_CVAR, NULL, "Fade Back from Grow", &cv_growmusicfade, 20},
{IT_STRING | IT_CVAR, NULL, "Fade Out Before Respawning", &cv_respawnfademusicout, 30},
{IT_STRING | IT_CVAR, NULL, "Fade Back In While Respawning", &cv_respawnfademusicback, 40},
{IT_STRING | IT_CVAR, NULL, "Resync Threshold", &cv_music_resync_threshold, 60},
{IT_STRING | IT_CVAR, NULL, "Resync Special Music Only", &cv_music_resync_powerups_only, 70},
};
static const char* OP_AdvancedBirdTooltips[] =
@@ -2207,8 +2201,6 @@ static const char* OP_AdvancedBirdTooltips[] =
"Fade in music after Grow.",
"Fade out music before respawning.",
"Fade in music while respawning.",
"Threshold for syncing music.",
"Only sync special music.",
};
enum
@@ -2218,8 +2210,6 @@ enum
fadegrow,
respawnfadeout,
respawnfadein,
syncthreshold,
syncspecialonly,
};
menuitem_t OP_CustomCvarMenu[MAXMENUCCVARS];
@@ -2493,7 +2483,7 @@ menu_t OP_MainDef =
menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 40, 15, OP_ControlsTooltips);
//WTF
menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_MouseOptionsMenu, &OP_ControlsDef, 60, 30, OP_MouseTooltips);
menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef, OP_AllControlsTooltips);
menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef);
menu_t OP_Joystick1Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 30, 36, NULL);
menu_t OP_Joystick2Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 30, 36, NULL);
menu_t OP_Joystick3Def = DEFAULTSCROLLSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 30, 36, NULL);
@@ -2632,7 +2622,7 @@ menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &O
menu_t OP_AccessibilityDef = DEFAULTSCROLLSTYLE(NULL, OP_AccessibilityMenu, &OP_MainDef, 30, 30, OP_AccessibilityTooltips);
menu_t OP_SaturnDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 30, OP_SaturnTooltips);
menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 2, OP_CreditTooltips); // OP_CreditTooltips no space :c
menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 0, NULL); // OP_CreditTooltips no space :c
menu_t OP_SaturnHudDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnHudMenu, &OP_SaturnDef, 30, 30, OP_SaturnHudTooltips);
menu_t OP_PlayerDistortDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30, OP_PlayerDistortTooltips);
+2 -1
View File
@@ -687,7 +687,8 @@ void T_ContinuousFalling(levelspecthink_t *faller)
// P_SectorCheckWater
//
// Like P_MobjCheckWater, but takes a sector instead of a mobj.
static fixed_t P_SectorCheckWater(sector_t *analyzesector, sector_t *elevatorsec)
static fixed_t P_SectorCheckWater(sector_t *analyzesector,
sector_t *elevatorsec)
{
fixed_t watertop;
+5 -5
View File
@@ -14,6 +14,10 @@
#ifndef __P_LOCAL__
#define __P_LOCAL__
#ifdef __cplusplus
extern "C" {
#endif
#include "command.h"
#include "d_player.h"
#include "d_think.h"
@@ -24,10 +28,6 @@
#include "p_maputl.h"
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
#ifdef __cplusplus
extern "C" {
#endif
#define FLOATSPEED (FRACUNIT*4)
//#define VIEWHEIGHTS "41"
@@ -272,7 +272,7 @@ extern consvar_t cv_gravity;
void P_RespawnSpecials(void);
extern mobjtype_t g_doomednum_to_mobjtype[MAXDOOMEDNUM+1];
extern mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX];
void CalculateDoomednumToMobjtype(void);
mobj_t *P_AllocateMobj(void);
+7 -25
View File
@@ -3237,22 +3237,7 @@ void P_DestroyRobots(void)
// the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person
void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
{
boolean player_flipcam = false;
if (cv_flipcammode.value == 0)
player_flipcam = player->pflags & PF_FLIPCAM;
else
{
INT32 pnum = P_GetLocalPlayerNumForPlayer(player);
// Shouldn't happen but just in case
if (pnum == -1)
pnum = 0;
player_flipcam = cv_flipcam[pnum].value;
}
const boolean flipcam = (player_flipcam && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
const boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
UINT8 postimgtype = 0;
if (encoremode)
@@ -10463,20 +10448,17 @@ void P_PrecipitationEffects(void)
}
}
mobjtype_t g_doomednum_to_mobjtype[MAXDOOMEDNUM+1] = {};
mobjtype_t g_doomednum_to_mobjtype[UINT16_MAX];
void CalculateDoomednumToMobjtype(void)
{
memset(g_doomednum_to_mobjtype, MT_NULL, sizeof(g_doomednum_to_mobjtype));
for (size_t i = 0; i < NUMMOBJTYPES; i++)
for (size_t i = MT_NULL+1; i < NUMMOBJTYPES; i++)
{
const INT32 doomednum = mobjinfo[i].doomednum;
if (doomednum > 0 && doomednum <= MAXDOOMEDNUM)
if (mobjinfo[i].doomednum > 0 && mobjinfo[i].doomednum <= UINT16_MAX)
{
if (g_doomednum_to_mobjtype[doomednum] == MT_NULL)
g_doomednum_to_mobjtype[doomednum] = (mobjtype_t)i;
g_doomednum_to_mobjtype[ mobjinfo[i].doomednum ] = i;
}
}
}
@@ -10554,7 +10536,7 @@ void P_RespawnSpecials(void)
if (mthing)
{
mobjtype_t i = MT_NULL;
mobjtype_t i;
x = mthing->x << FRACBITS;
y = mthing->y << FRACBITS;
ss = R_PointInSubsector(x, y);
@@ -10990,7 +10972,7 @@ INT32 numhuntemeralds = 0;
//
void P_SpawnMapThing(mapthing_t *mthing)
{
mobjtype_t i = MT_NULL;
mobjtype_t i;
mobj_t *mobj;
fixed_t x, y, z;
subsector_t *ss;
+6 -1
View File
@@ -285,7 +285,7 @@ typedef struct mobj_s
// Info for drawing: position.
fixed_t x, y, z;
fixed_t old_x, old_y, old_z; // position interpolation
fixed_t old_z2; // ok guess we need that...
fixed_t old_x2, old_y2, old_z2;
// More list: links in sector (if needed)
struct mobj_s *bnext;
@@ -297,6 +297,7 @@ typedef struct mobj_s
// More drawing info: to determine current sprite.
angle_t angle, pitch, roll; // orientation
angle_t old_angle, old_pitch, old_roll; // orientation interpolation
angle_t old_angle2, old_pitch2, old_roll2;
angle_t rollangle;
spritenum_t sprite; // used to find patch_t and flip value
UINT32 frame; // frame number, plus bits see p_pspr.h
@@ -306,7 +307,9 @@ typedef struct mobj_s
fixed_t spritexscale, spriteyscale;
fixed_t spritexoffset, spriteyoffset;
fixed_t old_spritexscale, old_spriteyscale;
fixed_t old_spritexscale2, old_spriteyscale2;
fixed_t old_spritexoffset, old_spriteyoffset;
fixed_t old_spritexoffset2, old_spriteyoffset2;
INT16 lightlevel; // Add to sector lightlevel, -255 - 255
fixed_t realxscale, realyscale; // funn-E streeetch
@@ -317,6 +320,7 @@ typedef struct mobj_s
//sloperollangle
angle_t sloperoll, slopepitch;
angle_t old_sloperoll, old_slopepitch;
angle_t old_sloperoll2, old_slopepitch2;
angle_t pitch_sprite, roll_sprite;
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears
@@ -391,6 +395,7 @@ typedef struct mobj_s
fixed_t scale;
fixed_t old_scale; // interpolation
fixed_t old_scale2;
fixed_t destscale;
fixed_t scalespeed;
+6 -4
View File
@@ -680,11 +680,11 @@ INT32 P_AddLevelFlat(const char *flatname, levelflat_t *levelflat)
if (i == numlevelflats)
{
// store the name
strlcpy(levelflat->name, flatname, sizeof(levelflat->name));
strlcpy(levelflat->name, flatname, sizeof (levelflat->name));
strupr(levelflat->name);
// store the flat lump number
levelflat->lumpnum = R_GetFlatNumForName(levelflat->name);
levelflat->lumpnum = R_GetFlatNumForName(flatname);
levelflat->baselumpnum = LUMPERROR;
P_CheckCyanFlat(levelflat);
@@ -727,11 +727,11 @@ INT32 P_AddLevelFlatRuntime(const char *flatname)
levelflat = levelflats+i;
// store the name
strlcpy(levelflat->name, flatname, sizeof(levelflat->name));
strlcpy(levelflat->name, flatname, sizeof (levelflat->name));
strupr(levelflat->name);
// store the flat lump number
levelflat->lumpnum = R_GetFlatNumForName(levelflat->name);
levelflat->lumpnum = R_GetFlatNumForName(flatname);
levelflat->baselumpnum = LUMPERROR;
P_CheckCyanFlat(levelflat);
@@ -812,6 +812,8 @@ static void P_LoadSectors(UINT8 *data)
ss->tag = SHORT(ms->tag);
ss->flags |= SF_FLIPSPECIAL_FLOOR;
ss->soundorg.thinker.function = (actionf_p1)P_MobjThinker;
}
// set the sky flat num
+117 -7
View File
@@ -53,7 +53,7 @@ mobj_t *skyboxmo[2] = {};
#define MAXFLATSIZE (2048<<FRACBITS)
/** Animated texture definition.
* Used for loading an ANIMATED lump from a wad.
* Used for ::harddefs and for loading an ANIMATED lump from a wad.
*
* Animations are defined by the first and last frame (i.e., flat or texture).
* The animation sequence uses all flats between the start and end entry, in
@@ -97,6 +97,104 @@ anim_t *lastanim = NULL;
anim_t *anims = NULL; /// \todo free leak
static size_t maxanims;
//
// P_InitPicAnims
//
/** Hardcoded animation sequences.
* Used if no ANIMATED lump is found in a loaded wad.
*/
static animdef_t harddefs[] =
{
// flat animations.
{false, "LITEY3", "LITEY1", 4},
{false, "FWATER16", "FWATER1", 4},
{false, "BWATER16", "BWATER01", 4},
{false, "LWATER16", "LWATER1", 4},
{false, "WATER7", "WATER0", 4},
{false, "LAVA4", "LAVA1", 8},
{false, "DLAVA4", "DLAVA1", 8},
{false, "RLAVA8", "RLAVA1", 8},
{false, "LITER3", "LITER1", 8},
{false, "SURF08", "SURF01", 4},
{false, "CHEMG16", "CHEMG01", 4}, // THZ Chemical gunk
{false, "GOOP16", "GOOP01", 4}, // Green chemical gunk
{false, "OIL16", "OIL01", 4}, // Oil
{false, "THZBOXF4", "THZBOXF1", 2}, // Moved up with the flats
{false, "ALTBOXF4", "ALTBOXF1", 2},
{false, "LITEB3", "LITEB1", 4},
{false, "LITEN3", "LITEN1", 4},
{false, "ACZRFL1H", "ACZRFL1A", 4},
{false, "ACZRFL2H", "ACZRFL2A", 4},
{false, "EGRIDF3", "EGRIDF1", 4},
{false, "ERZFAN4", "ERZFAN1", 1},
{false, "ERZFANR4", "ERZFANR1", 1},
{false, "DISCO4", "DISCO1", 15},
// animated textures
{true, "GFALL4", "GFALL1", 2}, // Short waterfall
{true, "CFALL4", "CFALL1", 2}, // Long waterfall
{true, "TFALL4", "TFALL1", 2}, // THZ Chemical fall
{true, "AFALL4", "AFALL1", 2}, // Green Chemical fall
{true, "QFALL4", "QFALL1", 2}, // Quicksand fall
{true, "Q2FALL4", "Q2FALL1", 2},
{true, "Q3FALL4", "Q3FALL1", 2},
{true, "Q4FALL4", "Q4FALL1", 2},
{true, "Q5FALL4", "Q5FALL1", 2},
{true, "Q6FALL4", "Q6FALL1", 2},
{true, "Q7FALL4", "Q7FALL1", 2},
{true, "LFALL4", "LFALL1", 2},
{true, "MFALL4", "MFALL1", 2},
{true, "OFALL4", "OFALL1", 2},
{true, "DLAVA4", "DLAVA1", 8},
{true, "ERZLASA2", "ERZLASA1", 1},
{true, "ERZLASB4", "ERZLASB1", 1},
{true, "ERZLASC4", "ERZLASC1", 1},
{true, "THZBOX04", "THZBOX01", 2},
{true, "ALTBOX04", "ALTBOX01", 2},
{true, "SFALL4", "SFALL1", 4}, // Lava fall
{true, "RVZFALL8", "RVZFALL1", 4},
{true, "BFALL4", "BFALL1", 2}, // HPZ waterfall
{true, "GREYW3", "GREYW1", 4},
{true, "BLUEW3", "BLUEW1", 4},
{true, "COMP6", "COMP4", 4},
{true, "RED3", "RED1", 4},
{true, "YEL3", "YEL1", 4},
{true, "ACWRFL1D", "ACWRFL1A", 1},
{true, "ACWRFL2D", "ACWRFL2A", 1},
{true, "ACWRFL3D", "ACWRFL3A", 1},
{true, "ACWRFL4D", "ACWRFL4A", 1},
{true, "ACWRP1D", "ACWRP1A", 1},
{true, "ACWRP2D", "ACWRP2A", 1},
{true, "ACZRP1D", "ACZRP1A", 1},
{true, "ACZRP2D", "ACZRP2A", 1},
{true, "OILFALL4", "OILFALL1", 2},
{true, "SOLFALL4", "SOLFALL1", 2},
{true, "DOWN1C", "DOWN1A", 4},
{true, "DOWN2C", "DOWN2A", 4},
{true, "DOWN3D", "DOWN3A", 4},
{true, "DOWN4C", "DOWN4A", 4},
{true, "DOWN5C", "DOWN5A", 4},
{true, "UP1C", "UP1A", 4},
{true, "UP2C", "UP2A", 4},
{true, "UP3D", "UP3A", 4},
{true, "UP4C", "UP4A", 4},
{true, "UP5C", "UP5A", 4},
{true, "EGRID3", "EGRID1", 4},
{true, "ERFANW4", "ERFANW1", 1},
{true, "ERFANX4", "ERFANX1", 1},
{true, "DISCOD4", "DISCOD1", 15},
{true, "DANCE4", "DANCE1", 8},
{true, "SKY135", "SKY132", 2},
{true, "APPLMS4", "APPLMS1", 2},
{true, "APBOXW3", "APBOXW1", 2},
{true, "ERZLAZC4", "ERZLAZC1", 4},
// End of line
{ -1, "", "", 0},
};
// Animating line specials
// Init animated textures
@@ -110,7 +208,7 @@ void P_ParseAnimationDefintion(SINT8 istexture);
/** Sets up texture and flat animations.
*
* Converts an ::animdef_t array loaded from a lump into
* Converts an ::animdef_t array loaded from ::harddefs or a lump into
* ::anim_t format.
*
* Issues an error if any animation cycles are invalid.
@@ -156,9 +254,7 @@ void P_InitPicAnims(void)
{
memcpy(&(animdefs[i].istexture), currentPos, 1); // istexture, 1 byte
memcpy(animdefs[i].endname, (currentPos + 1), 9); // endname, 9 bytes
animdefs[i].endname[8] = '\0';
memcpy(animdefs[i].startname, (currentPos + 10), 9); // startname, 9 bytes
animdefs[i].startname[8] = '\0';
memcpy(&(animdefs[i].speed), (currentPos + 19), 4); // speed, 4 bytes
}
@@ -179,6 +275,11 @@ void P_InitPicAnims(void)
strncpy(animdefs[maxanims].startname, "", 9);
animdefs[maxanims].speed = 0;
}
else
{
animdefs = harddefs;
for (maxanims = 0; animdefs[maxanims].istexture != -1; maxanims++);
}
if (anims)
free(anims);
@@ -217,7 +318,10 @@ void P_InitPicAnims(void)
animdefs[i].startname, animdefs[i].endname);
}
lastanim->speed = LONG(animdefs[i].speed);
if (animdefs == harddefs)
lastanim->speed = animdefs[i].speed;
else
lastanim->speed = LONG(animdefs[i].speed);
lastanim++;
}
@@ -226,7 +330,8 @@ void P_InitPicAnims(void)
// Clear animdefs now that we're done with it.
// We'll only be using anims from now on.
Z_Free(animdefs);
if (animdefs != harddefs)
Z_Free(animdefs);
animdefs = NULL;
}
@@ -3881,7 +3986,12 @@ DoneSection2:
player->tossdelay = 3;
}
#if 0
// Event - Final Lap
// Still works for GME, but disabled for consistency
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f);
#endif
if (player->laps >= (unsigned)cv_numlaps.value)
{
if (P_IsLocalPlayer(player))
-9
View File
@@ -16,10 +16,6 @@
#include "doomdef.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __GNUG__
#pragma interface
#endif
@@ -47,9 +43,4 @@ mobj_t *P_SetTarget2(mobj_t **mo, mobj_t *target
#else
#define P_SetTarget P_SetTarget2
#endif
#ifdef __cplusplus
} // extern "C"
#endif
#endif
+136 -146
View File
@@ -78,6 +78,7 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move)
mo->momy += FixedMul(move, FINESINE(angle));
}
//
// P_InstaThrust
// Moves the given origin along a given angle instantly.
@@ -238,11 +239,10 @@ void P_GiveEmerald(boolean spawnObj)
if (spawnObj)
{
for (i = 0; i < MAXPLAYERS; i++)
{
if (playeringame[i])
P_SetMobjState(P_SpawnMobj(players[i].mo->x, players[i].mo->y, players[i].mo->z + players[i].mo->info->height, MT_GOTEMERALD),
mobjinfo[MT_GOTEMERALD].spawnstate + em);
}
}
}
@@ -352,9 +352,9 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
player->mo->z++;
if (player->mo->eflags & MFE_UNDERWATER)
P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT, 2600*FRACUNIT), false);
P_SetObjectMomZ(player->mo, FixedDiv(10511*FRACUNIT,2600*FRACUNIT), false);
else
P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT, 10*FRACUNIT), false);
P_SetObjectMomZ(player->mo, FixedDiv(69*FRACUNIT,10*FRACUNIT), false);
}
ang = R_PointToAngle2(inflictor->x, inflictor->y, player->mo->x, player->mo->y); // SRB2kart
@@ -619,11 +619,11 @@ boolean P_EndingMusic(player_t *player)
// Check for if this is valid or not
if (splitscreen)
{
for (UINT8 i = 0; i <= splitscreen; i++)
{
if (!(players[displayplayers[i]].exiting || (players[displayplayers[i]].pflags & PF_TIMEOVER)))
return false;
}
if (!((players[displayplayers[0]].exiting || (players[displayplayers[0]].pflags & PF_TIMEOVER))
|| (players[displayplayers[1]].exiting || (players[displayplayers[1]].pflags & PF_TIMEOVER))
|| ((splitscreen < 2) && (players[displayplayers[2]].exiting || (players[displayplayers[2]].pflags & PF_TIMEOVER)))
|| ((splitscreen < 3) && (players[displayplayers[3]].exiting || (players[displayplayers[3]].pflags & PF_TIMEOVER)))))
return false;
bestlocalplayer = &players[displayplayers[0]];
bestlocalpos = ((players[displayplayers[0]].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : getPlayerPos(&players[displayplayers[0]]));
@@ -703,74 +703,71 @@ void P_RestoreMusic(player_t *player)
// Event - Level Start
if (leveltime < MUSICSTARTTIME)
{
S_StartMapMusic();
return;
}
// see also where time overs are handled - search for "lives = 2" in this file
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
if (splitscreen)
else // see also where time overs are handled - search for "lives = 2" in this file
{
INT32 bestlocaltimer = 1;
INT32 wantedmus = 0; // 0 is level music, 1 is invincibility, 2 is grow
if (splitscreen)
{
INT32 bestlocaltimer = 1;
#define setbests(p) \
if (players[p].playerstate == PST_LIVE) \
{ \
if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \
{ wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \
else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \
{ wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \
}
setbests(displayplayers[0]);
setbests(displayplayers[1]);
if (splitscreen > 1)
setbests(displayplayers[2]);
if (splitscreen > 2)
setbests(displayplayers[3]);
if (players[p].playerstate == PST_LIVE) \
{ \
if (players[p].kartstuff[k_growshrinktimer] > bestlocaltimer) \
{ wantedmus = 2; bestlocaltimer = players[p].kartstuff[k_growshrinktimer]; } \
else if (players[p].kartstuff[k_invincibilitytimer] > bestlocaltimer) \
{ wantedmus = 1; bestlocaltimer = players[p].kartstuff[k_invincibilitytimer]; } \
}
setbests(displayplayers[0]);
setbests(displayplayers[1]);
if (splitscreen > 1)
setbests(displayplayers[2]);
if (splitscreen > 2)
setbests(displayplayers[3]);
#undef setbests
}
else
{
if (player->playerstate == PST_LIVE)
{
if (player->kartstuff[k_growshrinktimer] > 1)
wantedmus = 2;
else if (player->kartstuff[k_invincibilitytimer] > 1)
wantedmus = 1;
}
}
// Item - Grow
if (wantedmus == 2 && cv_growmusic.value == 1)
{
S_ChangeMusicInternal("kgrow", true);
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
}
// Item - Invincibility
else if (wantedmus == 1 && cv_supermusic.value == 1)
{
S_ChangeMusicInternal("kinvnc", true);
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
}
else
{
#if 0
// Event - Final Lap
// Still works for GME, but disabled for consistency
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f);
#endif
if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled
position = mapmusic.resume;
else
position = mapmusic.position;
{
if (player->playerstate == PST_LIVE)
{
if (player->kartstuff[k_growshrinktimer] > 1)
wantedmus = 2;
else if (player->kartstuff[k_invincibilitytimer] > 1)
wantedmus = 1;
}
}
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn());
S_ClearRestoreMusicFadeInCvar();
mapmusic.resume = 0;
// Item - Grow
if (wantedmus == 2 && cv_growmusic.value == 1)
{
S_ChangeMusicInternal("kgrow", true);
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
}
// Item - Invincibility
else if (wantedmus == 1 && cv_supermusic.value == 1)
{
S_ChangeMusicInternal("kinvnc", true);
S_SetRestoreMusicFadeInCvar(&cv_invincmusicfade);
}
else
{
#if 0
// Event - Final Lap
// Still works for GME, but disabled for consistency
if (G_RaceGametype() && player->laps >= (UINT8)(cv_numlaps.value - 1))
S_SpeedMusic(1.2f);
#endif
if (mapmusic.resume && cv_resume.value) // mapmusresume will be 0 anyways when birdmusic stuff is disabled
position = mapmusic.resume;
else
position = mapmusic.position;
S_ChangeMusicEx(mapmusic.name, mapmusic.flags, true, position, 0, S_GetRestoreMusicFadeIn());
S_ClearRestoreMusicFadeInCvar();
mapmusic.resume = 0;
}
}
}
@@ -974,18 +971,7 @@ fixed_t P_GetPlayerHeight(player_t *player)
//
fixed_t P_GetPlayerSpinHeight(player_t *player)
{
return FixedMul(FixedMul(player->mo->info->height, player->mo->scale), 2*FRACUNIT/3);
}
//
// P_GetLocalPlayerNumForNum
//
// Returns the player number
// on the local machine for given number.
//
INT32 P_GetLocalPlayerNumForNum(UINT8 pnum)
{
return (pnum == 0 ? consoleplayer : displayplayers[pnum]);
return FixedMul(FixedMul(player->mo->info->height, player->mo->scale),2*FRACUNIT/3);
}
//
@@ -999,6 +985,17 @@ player_t *P_GetLocalPlayerForNum(UINT8 pnum)
return (&players[P_GetLocalPlayerNumForNum(pnum)]);
}
//
// P_GetLocalPlayerNumForNum
//
// Returns the player number
// on the local machine for given number.
//
INT32 P_GetLocalPlayerNumForNum(UINT8 pnum)
{
return (pnum == 0 ? consoleplayer : displayplayers[pnum]);
}
INT32 P_GetLocalPlayerNumForPlayer(const player_t *player)
{
for (UINT8 i = 0; i <= splitscreen; i++)
@@ -1025,9 +1022,7 @@ boolean P_IsLocalPlayer(const player_t *player)
for (i = 0; i <= splitscreen; i++)
{
if (player == P_GetLocalPlayerForNum(i))
{
return true;
}
}
return false;
@@ -1046,9 +1041,7 @@ boolean P_IsLocalPlayerNum(UINT8 pnum)
for (i = 0; i <= splitscreen; i++)
{
if (pnum == P_GetLocalPlayerNumForNum(i))
{
return true;
}
}
return false;
@@ -1076,9 +1069,7 @@ boolean P_IsDisplayPlayer(const player_t *player)
}
if (player == &players[displayplayers[i]])
{
return true;
}
}
return false;
@@ -1238,20 +1229,19 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj)
mobj->flags &= ~MF_DONTENCOREMAP;
// Copy interpolation data :)
// old_x - mobj->momx - hack to preserve vanilla look
ghost->old_x = mobj->old_x - mobj->momx;
ghost->old_y = mobj->old_y - mobj->momy;
ghost->old_z = mobj->old_z2; // Slopes.....
ghost->old_angle = (mobj->player ? mobj->player->old_frameangle : mobj->old_angle);
ghost->old_pitch = mobj->old_pitch;
ghost->old_roll = mobj->old_roll;
ghost->old_sloperoll = mobj->old_sloperoll;
ghost->old_slopepitch = mobj->old_slopepitch;
ghost->old_scale = mobj->old_scale;
ghost->old_spritexscale = mobj->old_spritexscale;
ghost->old_spriteyscale = mobj->old_spriteyscale;
ghost->old_spritexoffset = mobj->old_spritexoffset;
ghost->old_spriteyoffset = mobj->old_spriteyoffset;
ghost->old_x = mobj->old_x2;
ghost->old_y = mobj->old_y2;
ghost->old_z = mobj->old_z2;
ghost->old_angle = (mobj->player ? mobj->player->old_frameangle2 : mobj->old_angle2);
ghost->old_pitch = mobj->old_pitch2;
ghost->old_roll = mobj->old_roll2;
ghost->old_sloperoll = mobj->old_sloperoll2;
ghost->old_slopepitch = mobj->old_slopepitch2;
ghost->old_scale = mobj->old_scale2;
ghost->old_spritexscale = mobj->old_spritexscale2;
ghost->old_spriteyscale = mobj->old_spriteyscale2;
ghost->old_spritexoffset = mobj->old_spritexoffset2;
ghost->old_spriteyoffset = mobj->old_spriteyoffset2;
return ghost;
}
@@ -1265,9 +1255,7 @@ void P_DoPlayerExit(player_t *player)
if (player->exiting || mapreset)
return;
const boolean islocalplayer = P_IsLocalPlayer(player);
if (islocalplayer && (!player->spectator && !demo.playback))
if (P_IsLocalPlayer(player) && (!player->spectator && !demo.playback))
legitimateexit = true;
if (player->griefstrikes > 0)
@@ -1282,7 +1270,7 @@ void P_DoPlayerExit(player_t *player)
{
const int soundid = K_IsPlayerLosing(player) ? sfx_klose: sfx_kwin; // fix godjjsa win sounds
if (islocalplayer)
if (P_IsLocalPlayer(player))
{
sfxenum_t sfx_id = K_GetMobjSkin(player->mo)->soundsid[S_sfx[soundid].skinsound];
S_StartSound(NULL, sfx_id);
@@ -1336,13 +1324,12 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL)
continue;
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + (mo->height/2) > topheight)
continue;
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + (mo->height/2) < bottomheight)
continue;
@@ -1373,13 +1360,12 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
if (!(rover->flags & FF_QUICKSAND))
continue;
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
topheight = P_GetFFloorTopZAt(rover, mo->x, mo->y);
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + flipoffset > topheight)
continue;
bottomheight = P_GetFFloorBottomZAt(rover, mo->x, mo->y);
if (mo->z + (mo->height/2) + flipoffset < bottomheight)
continue;
@@ -1561,12 +1547,13 @@ static void P_CheckBouncySectors(player_t *player)
if (top)
{
fixed_t newmom;
pslope_t *slope;
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) // Hit top
pslope_t *slope;
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top
slope = *rover->t_slope;
else // Hit bottom
} else { // Hit bottom
slope = *rover->b_slope;
}
momentum.x = player->mo->momx;
momentum.y = player->mo->momy;
@@ -1657,8 +1644,7 @@ static void P_CheckQuicksand(player_t *player)
for (rover = player->mo->subsector->sector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS))
continue;
if (!(rover->flags & FF_EXISTS)) continue;
if (!(rover->flags & FF_QUICKSAND))
continue;
@@ -1716,8 +1702,10 @@ static void P_CheckInvincibilityTimer(player_t *player)
{
if (!player->powers[pw_super])
{
player->mo->color = player->skincolor;
G_GhostAddColor((INT32)(player - players), GHC_NORMAL);
{
player->mo->color = player->skincolor;
G_GhostAddColor((INT32) (player - players), GHC_NORMAL);
}
// If you had a shield, restore its visual significance
P_SpawnShieldOrb(player);
@@ -1742,7 +1730,7 @@ static void P_DoBubbleBreath(player_t *player)
else
zh = player->mo->z + FixedDiv(player->mo->height,5*(FRACUNIT/4));
if (!(player->mo->eflags & MFE_UNDERWATER) || player->spectator || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)))
if (!(player->mo->eflags & MFE_UNDERWATER) || ((player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL && !(player->pflags & PF_NIGHTSMODE)) || player->spectator)
return;
if (P_RandomChance(FRACUNIT/16))
@@ -1756,6 +1744,9 @@ static void P_DoBubbleBreath(player_t *player)
bubble->destscale = player->mo->scale;
P_SetScale(bubble, bubble->destscale);
}
//if (player->pflags & PF_NIGHTSMODE) // NiGHTS Super doesn't spawn flight bubbles
//return;
}
//
@@ -1868,10 +1859,10 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range)
if (!P_CheckSight(player->mo, mo2))
continue; // if your psychic powers can't "see" it don't bother
an = R_PointToAngle2(player->mo->x, player->mo->y, mo2->x, mo2->y);
if (mo2->health > 0)
{
an = R_PointToAngle2(player->mo->x, player->mo->y, mo2->x, mo2->y);
P_Thrust(mo2, an, thrust);
if (mo2->type == MT_GOLDBUZZ || mo2->type == MT_REDBUZZ)
@@ -1921,7 +1912,7 @@ static void P_3dMovement(player_t *player)
if (analogmove)
{
movepushangle = (cmd->angleturn << TICCMD_REDUCE);
movepushangle = (cmd->angleturn<<16 /* not FRACBITS */);
}
else
{
@@ -2021,17 +2012,12 @@ static void P_3dMovement(player_t *player)
// The rest is unaffected.
angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection;
if (player->mo->standingslope->zdelta < 0) // Direction goes down, so thrustangle needs to face toward
{
if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270)
{
if (player->mo->standingslope->zdelta < 0) { // Direction goes down, so thrustangle needs to face toward
if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270) {
P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope);
}
}
else // Direction goes up, so thrustangle needs to face away
{
if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270)
{
} else { // Direction goes up, so thrustangle needs to face away
if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270) {
P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope);
}
}
@@ -2086,7 +2072,7 @@ static void P_SpectatorMovement(player_t *player)
{
ticcmd_t *cmd = &player->cmd;
player->mo->angle = (angle_t)(cmd->angleturn << TICCMD_REDUCE);
player->mo->angle = (angle_t)(cmd->angleturn<<16 /* not FRACBITS */);
ticruned++;
if (!(cmd->angleturn & TICCMD_RECEIVED))
@@ -2114,6 +2100,10 @@ static void P_SpectatorMovement(player_t *player)
// Quake-style flying spectators :D
player->mo->momz += FixedMul(cmd->forwardmove*mapobjectscale, AIMINGTOSLOPE(player->aiming));
}
/*if (cmd->sidemove != 0) -- was disabled in practice anyways, since sidemove was suppressed
{
P_Thrust(player->mo, player->mo->angle-ANGLE_90, cmd->sidemove*mapobjectscale);
}*/
}
void P_BlackOw(player_t *player)
@@ -2288,7 +2278,7 @@ static void P_MovePlayer(player_t *player)
{
// KART: Don't directly apply angleturn! It may have been either A) forged by a malicious client, or B) not be a smooth turn due to a player dropping frames.
// Instead, turn the player only up to the amount they're supposed to turn accounting for latency. Allow exactly 1 extra turn unit to try to keep old replays synced.
angle_diff = cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE);
angle_diff = cmd->angleturn - (player->mo->angle>>16);
max_left_turn = player->lturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS];
max_right_turn = player->rturn_max[(leveltime + MAXPREDICTTICS - cmd->latency) % MAXPREDICTTICS];
@@ -2301,18 +2291,18 @@ static void P_MovePlayer(player_t *player)
else
{
// Try to keep normal turning as accurate to 1.0.1 as possible to reduce replay desyncs.
player->mo->angle = cmd->angleturn << TICCMD_REDUCE;
player->mo->angle = cmd->angleturn<<16;
add_delta = false;
}
//CONS_Printf("applied turn: %d\n", angle_diff);
if (add_delta) {
player->mo->angle += angle_diff << TICCMD_REDUCE;
player->mo->angle += angle_diff<<16;
player->mo->angle &= ~0xFFFF; // Try to keep the turning somewhat similar to how it was before?
//CONS_Printf("leftover turn (%s): %5d or %4d%%\n",
// player_names[player-players],
// (INT16) (cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE)),
// (INT16) (cmd->angleturn - (player->mo->angle >> TICCMD_REDUCE)) * 100 / (angle_diff ? angle_diff : 1));
// (INT16) (cmd->angleturn - (player->mo->angle>>16)),
// (INT16) (cmd->angleturn - (player->mo->angle>>16)) * 100 / (angle_diff ? angle_diff : 1));
}
}
@@ -2742,9 +2732,6 @@ boolean P_LookForEnemies(player_t *player)
if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING)))
continue; // not a valid enemy
if (mo->type == MT_PLAYER) // Don't chase after other players!
continue;
if (mo->health <= 0) // dead
continue;
@@ -2772,6 +2759,9 @@ boolean P_LookForEnemies(player_t *player)
&& abs(player->mo->y-mo->y) > player->mo->radius))
continue; // not in your 2d plane
if (mo->type == MT_PLAYER) // Don't chase after other players!
continue;
if (closestmo && P_AproxDistance(P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y),
player->mo->z-mo->z) > P_AproxDistance(P_AproxDistance(player->mo->x-closestmo->x,
player->mo->y-closestmo->y), player->mo->z-closestmo->z))
@@ -3177,7 +3167,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
lang = cam->localangle;
laim = cam->localaiming;
cmd->angleturn = (INT16)(lang >> TICCMD_REDUCE);
cmd->angleturn = (INT16)(lang >> 16);
cmd->aiming = G_ClipAimingPitch(&laim);
const boolean analogjoystickmove = cv_usejoystick[num].value && !Joystick[num].bGamepadStyle;
@@ -3273,7 +3263,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
axis = JoyAxis(AXISLOOK, forplayer);
laim += (mousey<<19)*player_invert;
laim += (mlooky<<19)*player_invert;
if (InputDown(gc_lookup, forplayer) || (usejoystick && axis < 0))
{
@@ -3312,7 +3302,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
cmd->aiming = G_ClipAimingPitch(&laim);
}
mousex = mousey = 0;
mousex = mousey = mlooky = 0;
if (forward > MAXPLMOVE)
forward = MAXPLMOVE;
@@ -3330,7 +3320,7 @@ static ticcmd_t *P_CameraCmd(camera_t *cam, UINT8 num)
cmd->sidemove = (SINT8)(cmd->sidemove + side);
}
lang += (cmd->angleturn << TICCMD_REDUCE);
lang += (cmd->angleturn << 16);
cam->localangle = lang;
if (!cam->reset_aiming)
@@ -3360,7 +3350,7 @@ static void P_DemoCameraMovement(camera_t *cam, UINT8 num)
cam->aiming = cmd->aiming << FRACBITS;
}
cam->angle = cmd->angleturn << TICCMD_REDUCE;
cam->angle = cmd->angleturn << 16;
// camera movement:
if (!cam->button_a_held)
@@ -3840,7 +3830,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
// Sometimes stale ticcmds send a weird angle at the start of the race.
// P_UpdatePlayerAngle knows to ignore cmd angle when you literally can't turn, so we do the same here.
if (cv_demoangturn.value && leveltime > starttime)
focusangle = player->cmd.angleturn << TICCMD_REDUCE;
focusangle = player->cmd.angleturn << 16;
else
focusangle = mo->angle; // Just use something known sane.
focusaiming = 0;
+3 -7
View File
@@ -14,8 +14,6 @@
#include "doomdef.h"
#include "g_game.h"
#include <algorithm>
#include "r_fps.h"
#include "r_local.h"
#include "r_state.h"
@@ -517,15 +515,13 @@ const INT32 checkcoord[12][4] =
static boolean R_CheckBBox(const fixed_t *bspcoord)
{
angle_t angle1, angle2;
INT32 sx1, sx2;
INT32 sx1, sx2, boxpos;
const INT32* check;
// Find the corners of the box
// that define the edges from current viewpoint.
const INT32 boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 :
viewx < bspcoord[BOXRIGHT] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP] ? 0 :
viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
boxpos = (viewx <= bspcoord[BOXLEFT] ? 0 : viewx < bspcoord[BOXRIGHT ] ? 1 : 2) +
(viewy >= bspcoord[BOXTOP ] ? 0 : viewy > bspcoord[BOXBOTTOM] ? 4 : 8);
if (boxpos == 5)
return true;
+15 -4
View File
@@ -722,10 +722,6 @@ void R_AddMobjInterpolator(mobj_t *mobj)
interpolated_mobjs.push_back(mobj);
// Maybe not the best place for it, but for first tic this old_z is 0,
// so when R_ResetMobjInterpolationState is called old_z2 will be set to 0
mobj->old_z = mobj->z;
R_ResetMobjInterpolationState(mobj);
mobj->resetinterp = true;
}
@@ -767,7 +763,22 @@ void R_ResetMobjInterpolationState(mobj_t *mobj)
if (rendermode == render_none)
return;
mobj->old_x2 = mobj->old_x;
mobj->old_y2 = mobj->old_y;
mobj->old_z2 = mobj->old_z;
mobj->old_angle2 = mobj->old_angle;
mobj->old_scale2 = mobj->old_scale;
// rotation humor
mobj->old_pitch2 = mobj->old_pitch;
mobj->old_roll2 = mobj->old_roll;
mobj->old_slopepitch2 = mobj->old_slopepitch;
mobj->old_sloperoll2 = mobj->old_sloperoll;
mobj->old_spritexscale2 = mobj->old_spritexscale;
mobj->old_spriteyscale2 = mobj->old_spriteyscale;
mobj->old_spritexoffset2 = mobj->old_spritexoffset;
mobj->old_spriteyoffset2 = mobj->old_spriteyoffset;
mobj->old_x = mobj->x;
mobj->old_y = mobj->y;
+4 -4
View File
@@ -15,16 +15,16 @@
#ifndef __R_FPS_H__
#define __R_FPS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "m_fixed.h"
#include "p_local.h"
#include "r_state.h"
#include "r_things.h"
#include "m_perfstats.h"
#ifdef __cplusplus
extern "C" {
#endif
extern consvar_t cv_fpscap, cv_fpscapbg;
extern ps_metric_t ps_interp_frac;
+5 -14
View File
@@ -182,9 +182,6 @@ consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS] = {
{"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, FlipCam4_OnChange, 0, NULL, NULL, 0, 0, NULL}
};
static CV_PossibleValue_t flipcammode_cons_t[] = {{0, "Displayplayer"}, {1, "Local"}, {0, NULL}};
consvar_t cv_flipcammode = {"flipcammode", "Displayplayer", CV_SAVE, flipcammode_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_shadow = {"shadow", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_skybox = {"skybox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -570,7 +567,6 @@ static void R_InitTextureMapping(void)
else if (t > viewwidth+1)
t = viewwidth+1;
}
viewangletox[i] = t;
}
@@ -1113,8 +1109,7 @@ static void R_SetupCommonFrame(player_t * player)
static void R_SetupAimingFrame(player_t *player, camera_t *thiscam)
{
if (player->awayviewtics && player->awayviewmobj
&& !(thiscam && thiscam->freecam)) // dont force this if we wanna freecam!
if (player->awayviewtics && player->awayviewmobj)
{
newview->aim = player->awayviewaiming;
newview->angle = player->awayviewmobj->angle;
@@ -1281,10 +1276,9 @@ void R_SetupFrame(UINT8 pnum, boolean skybox)
R_SetupAimingFrame(player, thiscam);
if (player->awayviewtics && player->awayviewmobj // cut-away view stuff
&& !(thiscam && thiscam->freecam)) // dont force this when we wanna freecam!
if (player->awayviewtics && player->awayviewmobj) // cut-away view stuff
{
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN whos altview man?
viewmobj = player->awayviewmobj; // should be a MT_ALTVIEWMAN
I_Assert(viewmobj != NULL);
newview->x = viewmobj->x;
@@ -1343,7 +1337,7 @@ static void R_PortalFrame(portal_t *portal)
}
}
static void Mask_Pre(maskcount_t* m)
static void Mask_Pre (maskcount_t* m)
{
m->drawsegs[0] = ds_p - drawsegs;
m->vissprites[0] = visspritecount;
@@ -1353,7 +1347,7 @@ static void Mask_Pre(maskcount_t* m)
m->viewsector = viewsector;
}
static void Mask_Post(maskcount_t* m)
static void Mask_Post (maskcount_t* m)
{
m->drawsegs[1] = ds_p - drawsegs;
m->vissprites[1] = visspritecount;
@@ -1435,7 +1429,6 @@ void R_RenderPlayerView(player_t *player)
// Clear buffers.
R_ClearPlanes();
if (viewmorph.use)
{
portalclipstart = viewmorph.x1;
@@ -1549,8 +1542,6 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_flipcam[i]);
}
CV_RegisterVar(&cv_flipcammode);
// Enough for dedicated server
if (dedicated)
return;
+4 -5
View File
@@ -14,14 +14,14 @@
#ifndef __R_MAIN__
#define __R_MAIN__
#include "d_player.h"
#include "r_data.h"
#include "m_perfstats.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "d_player.h"
#include "r_data.h"
#include "m_perfstats.h"
//
// POV related.
//
@@ -205,7 +205,6 @@ extern consvar_t cv_showhud, cv_translucenthud, cv_uncappedhud;
extern consvar_t cv_homremoval;
extern consvar_t cv_chasecam[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_flipcam[MAXSPLITSCREENPLAYERS];
extern consvar_t cv_flipcammode;
extern consvar_t cv_shadow, cv_shadowoffs;
extern consvar_t cv_ffloorclip, cv_spriteclip;
extern consvar_t cv_softcyancut;
-2
View File
@@ -15,8 +15,6 @@
#include "r_local.h"
#include "r_sky.h"
#include <algorithm>
#include "r_portal.h"
#include "r_splats.h"
#include "r_fps.h" // newview
+19 -17
View File
@@ -58,7 +58,7 @@ static void AmigaType_OnChange(void);
#endif
static CV_PossibleValue_t audbuffersize_cons_t[] = {{128, "128"}, {256, "256"}, {512, "512"}, {1024, "1024"}, {2048, "2048"}, {4096, "4096"}, {0, NULL}};
consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE|CV_CALL, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_audbuffersize = {"audiobuffersize", "2048", CV_SAVE|CV_CALL|CV_NOINIT, audbuffersize_cons_t, BufferSize_OnChange, 0, NULL, NULL, 0, 0, NULL};
// stereo reverse
consvar_t stereoreverse = {"stereoreverse", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -94,14 +94,6 @@ consvar_t cv_playsoundifunfocused = {"playsoundsifunfocused", "No", CV_SAVE, CV_
consvar_t cv_pausemusic = {"playmusicifpaused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
//bird music stuff
static CV_PossibleValue_t music_resync_threshold_cons_t[] = {
{0, "MIN"},
{1000, "MAX"},
{0}
};
consvar_t cv_music_resync_threshold = {"music_resync_threshold", "0", CV_SAVE|CV_CALL, music_resync_threshold_cons_t, I_UpdateSongLagThreshold, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_music_resync_powerups_only = {"music_resync_powerups_only", "No", CV_SAVE|CV_CALL, CV_YesNo, I_UpdateSongLagThreshold, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_invincmusicfade = {"invincmusicfade", "300", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_growmusicfade = {"growmusicfade", "500", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_respawnfademusicout = {"respawnfademusicout", "1000", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -281,6 +273,12 @@ void S_RegisterSoundStuff(void)
CV_RegisterVar(&cv_gamesounds);
CV_RegisterVar(&cv_gamedigimusic);
#ifdef HAVE_FLUIDSYNTH
CV_RegisterVar(&cv_midisoundfontpath);
CV_RegisterVar(&cv_midichorus);
CV_RegisterVar(&cv_midireverb);
#endif
CV_RegisterVar(&cv_samesoundlimit);
// bird music stuff
@@ -288,9 +286,6 @@ void S_RegisterSoundStuff(void)
CV_RegisterVar(&cv_playsoundifunfocused);
CV_RegisterVar(&cv_pausemusic);
CV_RegisterVar(&cv_music_resync_threshold);
CV_RegisterVar(&cv_music_resync_powerups_only);
CV_RegisterVar(&cv_invincmusicfade);
CV_RegisterVar(&cv_growmusicfade);
@@ -362,6 +357,7 @@ boolean S_SoundDisabled(void)
int S_CacheSound(void)
{
#if SOUND == SOUND_MIXER
if (sound_disabled)
return SOUNDCACHE_OFF;
@@ -369,6 +365,9 @@ int S_CacheSound(void)
return SOUNDCACHE_PRECACHE;
return cv_cachesound.value;
#else
return SOUNDCACHE_OFF;
#endif
}
// Stop all sounds, load level info, THEN start sounds.
@@ -772,9 +771,14 @@ void S_UpdateSounds(void)
volume = c->volume; // 8 bits internal volume precision
sep = NORM_SEP;
if (P_MobjWasRemoved(c->origin))
{
// origin was removed, stop the music
S_StopChannel(cnum);
}
// check non-local sounds for distance clipping
// or modify their params
if (c->origin)
else
{
boolean itsUs = false;
@@ -1642,7 +1646,7 @@ UINT32 S_GetMusicPosition(void)
static lumpnum_t S_GetMusicLumpNum(const char *mname)
{
if (S_MusicExists(mname, false, true)) // check non midis first
return W_GetNumForName(va("o_%s", mname));
return W_GetNumForName(va("O_%s", mname));
if (S_MusicExists(mname, true, false))
{
@@ -1650,7 +1654,7 @@ static lumpnum_t S_GetMusicLumpNum(const char *mname)
CONS_Alert(CONS_ERROR, "A MIDI music lump %.6s was found,\nbut SRB2Kart does not support MIDI output.\nWe apologise for the inconvenience.\n", mname);
return LUMPERROR;
#else
return W_GetNumForName(va("d_%s", mname));
return W_GetNumForName(va("D_%s", mname));
#endif
}
@@ -1709,8 +1713,6 @@ static boolean S_PlayMusic(boolean looping, UINT32 fadeinms)
if (S_MusicDisabled())
return false;
I_UpdateSongLagThreshold();
if ((!fadeinms && !I_PlaySong(looping)) ||
(fadeinms && !I_FadeInPlaySong(fadeinms, looping)))
{
+6 -3
View File
@@ -54,10 +54,13 @@ extern consvar_t cv_amigatype;
#endif
#endif
//bird music stuff
extern consvar_t cv_music_resync_threshold;
extern consvar_t cv_music_resync_powerups_only;
#ifdef HAVE_FLUIDSYNTH
extern consvar_t cv_midisoundfontpath;
extern consvar_t cv_midichorus;
extern consvar_t cv_midireverb;
#endif
//bird music stuff
extern consvar_t cv_invincmusicfade;
extern consvar_t cv_growmusicfade;
+2 -2
View File
@@ -42,8 +42,8 @@ INT32 setmodeneeded = 0; // video mode change needed if > 0 (the mode number to
static CV_PossibleValue_t shittyscreen_cons_t[] = {{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}, {0, NULL}};
//added : 03-02-98: default screen mode, as loaded/saved in config
consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE|CV_CALL, CV_Unsigned, VID_RefreshModeList, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE|CV_CALL, CV_Unsigned, VID_RefreshModeList, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_frameskip = {"frameskip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
+329 -94
View File
@@ -1,115 +1,350 @@
# Declare SDL2 interface sources
target_sources(SRB2SDL2 PRIVATE
mixer_sound.c
ogl_sdl.c
i_threads.c
i_net.c
i_system.cpp
i_main.c
i_video.c
set(SRB2_CONFIG_SDL2_USEMIXER ON CACHE BOOL "Use SDL2_mixer or regular sdl sound")
if(${SRB2_CONFIG_SDL2_USEMIXER})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(SDL2_MIXER_FOUND ON)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(SDL2_MIXER_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/include/SDL2)
set(SDL2_MIXER_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/lib -lSDL2_mixer")
else() # 32-bit
set(SDL2_MIXER_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/include/SDL2)
set(SDL2_MIXER_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/lib -lSDL2_mixer")
endif()
else()
find_package(SDL2_mixer)
endif()
if(${SDL2_MIXER_FOUND})
set(SRB2_HAVE_MIXER ON)
set(SRB2_SDL2_SOUNDIMPL mixer_sound.c)
else()
message(WARNING "You specified that SDL2_mixer is available, but it was not found. Falling back to sdl sound.")
set(SRB2_SDL2_SOUNDIMPL sdl_sound.c)
endif()
else()
set(SRB2_SDL2_SOUNDIMPL sdl_sound.c)
endif()
set(SRB2_SDL2_SOURCES
dosstr.c
endtxt.c
hwsym_sdl.c
i_main.c
i_net.c
i_system.c
i_ttf.c
i_video.c
i_threads.c
#IMG_xpm.c
ogl_sdl.c
${SRB2_SDL2_SOUNDIMPL}
)
if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
target_sources(SRB2SDL2 PRIVATE
../win32/win_dbg.c
../win32/Srb2win.rc)
set(SRB2_SDL2_HEADERS
endtxt.h
hwsym_sdl.h
i_ttf.h
ogl_sdl.h
sdlmain.h
)
source_group("Interface Code" FILES ${SRB2_SDL2_SOURCES} ${SRB2_SDL2_HEADERS})
# Dependency
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(SDL2_FOUND ON)
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(SDL2_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/include/SDL2)
set(SDL2_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/lib -lSDL2")
else() # 32-bit
set(SDL2_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/include/SDL2)
set(SDL2_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/lib -lSDL2")
endif()
else()
find_package(SDL2)
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
set(MACOSX_BUNDLE_ICON_FILE Srb2mac.icns)
set_source_files_properties(macosx/Srb2mac.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
target_sources(SRB2SDL2 PRIVATE
macosx/mac_resources.c
macosx/mac_resources.h
macosx/Srb2mac.icns
if(${SDL2_FOUND})
set(SRB2_SDL2_TOTAL_SOURCES
${SRB2_CORE_SOURCES}
${SRB2_CORE_HEADERS}
${SRB2_DISCORDRPC_SOURCES}
${SRB2_DISCORDRPC_HEADERS}
${SRB2_PNG_SOURCES}
${SRB2_PNG_HEADERS}
${SRB2_CORE_RENDER_SOURCES}
${SRB2_CORE_GAME_SOURCES}
${SRB2_LUA_SOURCES}
${SRB2_LUA_HEADERS}
${SRB2_BLUA_SOURCES}
${SRB2_BLUA_HEADERS}
${SRB2_SDL2_SOURCES}
${SRB2_SDL2_HEADERS}
)
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
find_library(CORE_FOUNDATION_LIBRARY "CoreFoundation")
source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}
${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS})
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
source_group("Discord Rich Presence" FILES ${SRB2_DISCORDRPC_SOURCES} ${SRB2_DISCORDRPC_HEADERS})
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
if(${SRB2_CONFIG_HWRENDER})
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
${SRB2_HWRENDER_SOURCES}
${SRB2_HWRENDER_HEADERS}
${SRB2_R_OPENGL_SOURCES}
${SRB2_R_OPENGL_HEADERS}
)
source_group("Hardware" FILES ${SRB2_HWRENDER_SOURCES} ${SRB2_HWRENDER_HEADERS})
source_group("Hardware\\OpenGL Renderer" FILES ${SRB2_R_OPENGL_SOURCES} ${SRB2_R_OPENGL_HEADERS})
endif()
if(${SRB2_USEASM})
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
${SRB2_NASM_SOURCES}
)
endif()
if(${CMAKE_SYSTEM} MATCHES Windows)
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
${CMAKE_SOURCE_DIR}/src/win32/win_dbg.c
${CMAKE_SOURCE_DIR}/src/win32/Srb2win.rc
)
endif()
if(${CMAKE_SYSTEM} MATCHES Darwin)
set(MACOSX_BUNDLE_ICON_FILE Srb2mac.icns)
set_source_files_properties(macosx/Srb2mac.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(SRB2_SDL2_MAC_SOURCES
macosx/mac_alert.c
macosx/mac_alert.h
macosx/mac_resources.c
macosx/mac_resources.h
macosx/Srb2mac.icns
)
source_group("Interface Code\\OSX Compatibility" FILES ${SRB2_SDL2_MAC_SOURCES})
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES} ${SRB2_SDL2_MAC_SOURCES})
endif()
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32 ${SRB2_SDL2_TOTAL_SOURCES})
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME ${SRB2_SDL2_EXE_NAME})
if(${CMAKE_SYSTEM} MATCHES Darwin)
find_library(CORE_FOUNDATION_LIBRARY "CoreFoundation")
target_link_libraries(SRB2SDL2 PRIVATE
${CORE_FOUNDATION_LIBRARY}
)
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
# Configure the app bundle icon and plist properties
target_sources(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns")
set_target_properties(SRB2SDL2 PROPERTIES
MACOSX_BUNDLE_ICON_FILE "Srb2mac"
MACOSX_BUNDLE_BUNDLE_NAME "Sonic Robo Blast 2"
MACOSX_BUNDLE_BUNDLE_VERSION ${SRB2_VERSION}
RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns"
)
endif()
target_link_libraries(SRB2SDL2 PRIVATE
${CORE_FOUNDATION_LIBRARY}
${SDL2_LIBRARIES}
${SDL2_MIXER_LIBRARIES}
${GME_LIBRARIES}
${OPENMPT_LIBRARIES}
${MIXERX_LIBRARIES}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${OPENGL_LIBRARIES}
${CURL_LIBRARIES}
${DISCORDRPC_LIBRARIES}
)
if(${CMAKE_SYSTEM} MATCHES Linux)
target_link_libraries(SRB2SDL2 PRIVATE
m
rt
)
endif()
if(${CMAKE_SYSTEM} MATCHES Windows AND ${CMAKE_C_COMPILER_ID} MATCHES "GNU" AND ${SRB2_SYSTEM_BITS} EQUAL 32)
target_link_libraries(SRB2SDL2 PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/../../libs/drmingw/lib/win32/libexchndl.a"
"${CMAKE_CURRENT_SOURCE_DIR}/../../libs/drmingw/lib/win32/libmgwhelp.a"
)
target_include_directories(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../libs/drmingw/include")
endif()
#target_link_libraries(SRB2SDL2 PRIVATE SRB2Core)
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
# Configure the app bundle icon and plist properties
target_sources(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns")
set_target_properties(SRB2SDL2 PROPERTIES
MACOSX_BUNDLE_ICON_FILE "Srb2mac"
MACOSX_BUNDLE_BUNDLE_NAME "SRB2Kart-Saturn"
MACOSX_BUNDLE_BUNDLE_VERSION 1.6
RESOURCE "${CMAKE_CURRENT_SOURCE_DIR}/macosx/Srb2mac.icns"
)
endif()
if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2-static SDL2_mixer::SDL2_mixer-static)
else()
target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2 SDL2_mixer::SDL2_mixer)
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES Linux)
target_link_libraries(SRB2SDL2 PRIVATE m rt)
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES Windows)
target_link_libraries(SRB2SDL2 PRIVATE
ws2_32
)
target_compile_options(SRB2SDL2 PRIVATE
-U_WINDOWS
)
endif()
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_SDL)
#### Installation ####
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
install(TARGETS SRB2SDL2
BUNDLE DESTINATION .
)
set_property(TARGET SRB2SDL2 PROPERTY INSTALL_RPATH_USE_LINK_PATH ON)
else()
install(TARGETS SRB2SDL2 SRB2SDL2
RUNTIME DESTINATION .
)
if ((${CMAKE_BUILD_TYPE} MATCHES Debug) OR (${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo))
set(SRB2_DEBUG_INSTALL OFF CACHE BOOL "Insert *.debug file into the install directory or package.")
if (${SRB2_DEBUG_INSTALL})
install(FILES $<TARGET_FILE:SRB2SDL2>.debug
DESTINATION .
OPTIONAL
)
if(${SRB2_USEASM})
if(${SRB2_CONFIG_YASM})
set(ASM_ASSEMBLER_TEMP ${CMAKE_ASM_YASM_COMPILER})
set(ASM_ASSEMBLER_OBJFORMAT ${CMAKE_ASM_YASM_OBJECT_FORMAT})
set_source_files_properties(${SRB2_NASM_SOURCES} LANGUAGE ASM_YASM)
else()
set(ASM_ASSEMBLER_TEMP ${CMAKE_ASM_NASM_COMPILER})
set(ASM_ASSEMBLER_OBJFORMAT ${CMAKE_ASM_NASM_OBJECT_FORMAT})
set_source_files_properties(${SRB2_NASM_SOURCES} LANGUAGE ASM_NASM)
endif()
endif()
endif()
# Mac bundle fixup
# HACK: THIS IS IMPORTANT! See the escaped \${CMAKE_INSTALL_PREFIX}? This
# makes it so that var is evaluated LATER during cpack, not right now!
# This fixes the quirk where the bundled libraries don't land in the final package
# https://cmake.org/pipermail/cmake/2011-March/043532.html
#
# HOWEVER: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY} is NOT escaped, because that var
# is only available to us at this step. Read the link: ${CMAKE_INSTALL_PREFIX} at
# this current step points to the CMAKE build folder, NOT the folder that CPACK uses.
# Therefore, it makes sense to escape that var, but not the other.
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
install(CODE "
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${CPACK_PACKAGE_DESCRIPTION_SUMMARY}.app\"
\"\"
/Library/Frameworks
)"
if(${CMAKE_SYSTEM} MATCHES Windows)
target_link_libraries(SRB2SDL2 PRIVATE
ws2_32
)
target_compile_options(SRB2SDL2 PRIVATE
-U_WINDOWS
)
endif()
target_include_directories(SRB2SDL2 PRIVATE
${SDL2_INCLUDE_DIRS}
${SDL2_MIXER_INCLUDE_DIRS}
${GME_INCLUDE_DIRS}
${OPENMPT_INCLUDE_DIRS}
${PNG_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS}
${DISCORDRPC_INCLUDE_DIRS}
)
endif()
set(SRB2_SDL2_AVAILABLE YES PARENT_SCOPE)
if(${SRB2_HAVE_MIXER})
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXER -DSOUND=SOUND_MIXER)
endif()
target_compile_definitions(SRB2SDL2 PRIVATE
-DHAVE_SDL
-DHAVE_THREADS
)
## strip debug symbols into separate file when using gcc
# if(CMAKE_COMPILER_IS_GNUCC)
# if(${CMAKE_BUILD_TYPE} MATCHES Debug)
# message(STATUS "Will make separate debug symbols in *.debug")
# add_custom_command(TARGET SRB2SDL2 POST_BUILD
# COMMAND ${OBJCOPY} --only-keep-debug $<TARGET_FILE:SRB2SDL2> $<TARGET_FILE:SRB2SDL2>.debug
# COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:SRB2SDL2>
# COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE_NAME:SRB2SDL2>.debug $<TARGET_FILE:SRB2SDL2>
# )
# endif()
# endif()
#### Installation ####
if(${CMAKE_SYSTEM} MATCHES Darwin)
install(TARGETS SRB2SDL2
BUNDLE DESTINATION .
)
set_property(TARGET SRB2SDL2 PROPERTY INSTALL_RPATH_USE_LINK_PATH ON)
else()
install(TARGETS SRB2SDL2 SRB2SDL2
RUNTIME DESTINATION .
)
endif()
if(${CMAKE_SYSTEM} MATCHES Windows)
set(win_extra_dll_list "")
macro(getwinlib dllname defaultname)
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
if (${CMAKE_GENERATOR} STREQUAL "MinGW Makefiles")
if(${SRB2_SYSTEM_BITS} EQUAL 64)
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/x86_64
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/x86_64-w64-mingw32/bin
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/x86_64-w64-mingw32/bin
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86_64/mingw
)
else()
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/i686
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/i686-w64-mingw32/bin
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/i686-w64-mingw32/bin
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86/mingw
)
endif()
else()
if(${SRB2_SYSTEM_BITS} EQUAL 64)
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/x86_64
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x64
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x64
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86_64/mingw
)
else()
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}"
HINTS ${CMAKE_SOURCE_DIR}/libs/dll-binaries/i686
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2/lib/x86
HINTS ${CMAKE_SOURCE_DIR}/libs/SDL2_mixer/lib/x86
HINTS ${CMAKE_SOURCE_DIR}/libs/libopenmpt/bin/x86/mingw
)
endif()
endif()
list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
else()
find_library(SRB2_SDL2_DLL_${dllname} "${defaultname}")
list(APPEND win_extra_dll_list ${SRB2_SDL2_DLL_${dllname}})
endif()
endmacro()
getwinlib(SDL2 "SDL2.dll")
if(${SRB2_CONFIG_SDL2_USEMIXER})
getwinlib(SDL2_mixer "SDL2_mixer.dll")
getwinlib(libogg_0 "libogg-0.dll")
getwinlib(libvorbis_0 "libvorbis-0.dll")
getwinlib(libvorbisfile_3 "libvorbisfile-3.dll")
endif()
if(${SRB2_CONFIG_HAVE_GME})
getwinlib(libgme "libgme.dll")
endif()
if(${SRB2_CONFIG_HAVE_OPENMPT})
getwinlib(libopenmpt "libopenmpt.dll")
endif()
if(${SRB2_CONFIG_HAVE_DISCORDRPC})
getwinlib(discord-rpc "discord-rpc.dll")
endif()
install(PROGRAMS
${win_extra_dll_list}
DESTINATION .
)
# We also want to copy those DLLs to build directories on MSVC.
# So we'll add a post_build step.
copy_files_to_build_dir(SRB2SDL2 win_extra_dll_list)
endif()
# Mac bundle fixup
# HACK: THIS IS IMPORTANT! See the escaped \${CMAKE_INSTALL_PREFIX}? This
# makes it so that var is evaluated LATER during cpack, not right now!
# This fixes the quirk where the bundled libraries don't land in the final package
# https://cmake.org/pipermail/cmake/2011-March/043532.html
#
# HOWEVER: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY} is NOT escaped, because that var
# is only available to us at this step. Read the link: ${CMAKE_INSTALL_PREFIX} at
# this current step points to the CMAKE build folder, NOT the folder that CPACK uses.
# Therefore, it makes sense to escape that var, but not the other.
if(${CMAKE_SYSTEM} MATCHES Darwin)
install(CODE "
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/${CPACK_PACKAGE_DESCRIPTION_SUMMARY}.app\"
\"\"
/Library/Frameworks
)"
)
endif()
set(SRB2_SDL2_AVAILABLE YES PARENT_SCOPE)
else()
message(WARNING "SDL2 was not found, so the SDL2 target will not be available.")
set(SRB2_SDL2_AVAILABLE NO PARENT_SCOPE)
endif()
+25 -24
View File
@@ -46,8 +46,8 @@
#include "SDL_image.h"
#else
// SDLCALL terms removed from original SDL_image declarations
int IMG_isXPM(SDL_RWops *src);
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src);
int IMG_isXPM(SDL_IOStream *src);
SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src);
SDL_Surface *IMG_ReadXPMFromArray(const char **xpm);
#define IMG_SetError SDL_SetError
#define IMG_GetError SDL_GetError
@@ -56,7 +56,7 @@ SDL_Surface *IMG_ReadXPMFromArray(const char **xpm);
#ifdef LOAD_XPM
/* See if an image is contained in a data source */
int IMG_isXPM(SDL_RWops *src)
int IMG_isXPM(SDL_IOStream *src)
{
Sint64 start;
int is_XPM;
@@ -64,14 +64,14 @@ int IMG_isXPM(SDL_RWops *src)
if ( !src )
return 0;
start = SDL_RWtell(src);
start = SDL_TellIO(src);
is_XPM = 0;
if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
if ( SDL_ReadIO(src, magic, sizeof(magic)) ) {
if ( SDL_memcmp(magic, "/* XPM */", sizeof(magic)) == 0 ) {
is_XPM = 1;
}
}
SDL_RWseek(src, start, RW_SEEK_SET);
SDL_SeekIO(src, start, SDL_IO_SEEK_SET);
return(is_XPM);
}
@@ -933,7 +933,7 @@ static const char *error;
* If len > 0, it's assumed to be at least len chars (for efficiency).
* Return NULL and set error upon EOF or parse error.
*/
static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
static const char *get_next_line(const char ***lines, SDL_IOStream *src, int len)
{
char *linebufnew;
@@ -943,7 +943,7 @@ static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
char c;
int n;
do {
if (SDL_RWread(src, &c, 1, 1) <= 0) {
if (SDL_ReadIO(src, &c, 1) <= 0) {
error = "Premature end of data";
return NULL;
}
@@ -960,7 +960,7 @@ static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
}
linebuf = linebufnew;
}
if (SDL_RWread(src, linebuf, len - 1, 1) <= 0) {
if (SDL_ReadIO(src, linebuf, len - 1) <= 0) {
error = "Premature end of data";
return NULL;
}
@@ -980,7 +980,7 @@ static const char *get_next_line(const char ***lines, SDL_RWops *src, int len)
}
linebuf = linebufnew;
}
if (SDL_RWread(src, linebuf + n, 1, 1) <= 0) {
if (SDL_ReadIO(src, linebuf + n, 1) <= 0) {
error = "Premature end of data";
return NULL;
}
@@ -1005,7 +1005,7 @@ do { \
} while (0)
/* read XPM from either array or RWops */
static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
static SDL_Surface *load_xpm(const char **xpm, SDL_IOStream *src)
{
Sint64 start = 0;
SDL_Surface *image = NULL;
@@ -1027,7 +1027,7 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
buflen = 0;
if (src)
start = SDL_RWtell(src);
start = SDL_TellIO(src);
if (xpm)
xpmlines = &xpm;
@@ -1065,14 +1065,15 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
/* Create the new surface */
if (ncolors <= 256) {
indexed = 1;
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8,
0, 0, 0, 0);
im_colors = image->format->palette->colors;
image->format->palette->ncolors = ncolors;
image = SDL_CreateSurface(w, h,
SDL_PIXELFORMAT_INDEX8);
SDL_Palette *palette = SDL_CreateSurfacePalette(image);
im_colors = palette->colors;
palette->ncolors = ncolors;
} else {
indexed = 0;
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
0xff0000, 0x00ff00, 0x0000ff, 0);
image = SDL_CreateSurface(w, h,
SDL_GetPixelFormatForMasks(32, 0xff0000, 0x00ff00, 0x0000ff, 0));
}
if (!image) {
/* Hmm, some SDL error (out of memory?) */
@@ -1128,7 +1129,7 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
add_colorhash(colors, nextkey, cpp, pixel);
nextkey += cpp;
if (rgb == 0xffffffff)
SDL_SetColorKey(image, SDL_TRUE, pixel);
SDL_SetSurfaceColorKey(image, true, pixel);
break;
}
}
@@ -1164,9 +1165,9 @@ static SDL_Surface *load_xpm(const char **xpm, SDL_RWops *src)
done:
if (error) {
if ( src )
SDL_RWseek(src, start, RW_SEEK_SET);
SDL_SeekIO(src, start, SDL_IO_SEEK_SET);
if ( image ) {
SDL_FreeSurface(image);
SDL_DestroySurface(image);
image = NULL;
}
IMG_SetError("%s", error);
@@ -1180,7 +1181,7 @@ done:
}
/* Load a XPM type image from an RWops datasource */
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src)
{
if ( !src ) {
/* The error message has been set in SDL_RWFromFile */
@@ -1203,14 +1204,14 @@ SDL_Surface *IMG_ReadXPMFromArray(const char **xpm)
#else /* not LOAD_XPM */
/* See if an image is contained in a data source */
int IMG_isXPM(SDL_RWops *src)
int IMG_isXPM(SDL_IOStream *src)
{
return(0);
}
/* Load a XPM type image from an SDL datasource */
SDL_Surface *IMG_LoadXPM_RW(SDL_RWops *src)
SDL_Surface *IMG_LoadXPM_RW(SDL_IOStream *src)
{
return(NULL);
}
+2 -2
View File
@@ -27,10 +27,10 @@
#ifdef HAVE_SDL
#include "SDL.h"
#include <SDL3/SDL.h>
#ifndef NOLOADSO
#include "SDL_loadso.h"
#include <SDL3/SDL_loadso.h>
#endif
#define _CREATE_DLL_ // necessary for Unix AND Windows
+1 -1
View File
@@ -36,7 +36,7 @@
#ifdef HAVE_SDL
#ifdef HAVE_TTF
#include "SDL.h"
#include <SDL3/SDL.h>
#include "i_ttf.h"
#endif
+59 -56
View File
@@ -67,13 +67,15 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
#ifdef HAVE_SDL
#define _MATH_DEFINES_DEFINED
#include "SDL.h"
#include <SDL3/SDL.h>
#include <SDL3/SDL_joystick.h>
#include <SDL3/SDL_gamepad.h>
#ifdef HAVE_TTF
#include "i_ttf.h"
#endif
#include "SDL_cpuinfo.h"
#include <SDL3/SDL_cpuinfo.h>
#define HAVE_SDLCPUINFO
#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
@@ -201,6 +203,10 @@ static char returnWadPath[256];
#include "../s_sound.h"
#ifdef MAC_ALERT
#include "macosx/mac_alert.h"
#endif
#include "../d_main.h"
#if !defined(NOMUMBLE) && defined(HAVE_MUMBLE)
@@ -209,13 +215,13 @@ static char returnWadPath[256];
#include "../byteptr.h"
#endif
SDL_bool consolevent = SDL_FALSE;
SDL_bool framebuffer = SDL_FALSE;
bool consolevent = false;
bool framebuffer = false;
UINT8 keyboard_started = false;
#ifdef HAVE_TERMIOS
// TERMIOS console code from Quake3: thank you!
SDL_bool stdin_active = SDL_TRUE;
bool stdin_active = true;
typedef struct
{
@@ -278,7 +284,7 @@ static void I_ShutdownConsole(void)
if (consolevent)
{
I_OutputMsg("Shutdown tty console\n");
consolevent = SDL_FALSE;
consolevent = false;
tcsetattr(STDIN_FILENO, TCSADRAIN, &tty_tc);
}
}
@@ -293,11 +299,11 @@ static void I_StartupConsole(void)
signal(SIGTTIN, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
consolevent = static_cast<SDL_bool>(!M_CheckParm("-noconsole"));
framebuffer = static_cast<SDL_bool>( M_CheckParm("-framebuffer"));
consolevent = static_cast<bool>(!M_CheckParm("-noconsole"));
framebuffer = static_cast<bool>( M_CheckParm("-framebuffer"));
if (framebuffer)
consolevent = SDL_FALSE;
consolevent = false;
if (!consolevent)
return;
@@ -305,7 +311,7 @@ static void I_StartupConsole(void)
if (isatty(STDIN_FILENO)!=1)
{
I_OutputMsg("stdin is not a tty, tty console mode failed\n");
consolevent = SDL_FALSE;
consolevent = false;
return;
}
@@ -507,7 +513,7 @@ static void I_StartupConsole(void)
if (gotConsole)
{
SetConsoleTitleA("SRB2Kart Console");
consolevent = SDL_TRUE;
consolevent = true;
}
//Let get the real console HANDLE, because Mingw's Bash is bad!
@@ -540,7 +546,7 @@ static inline void I_StartupConsole(void)
framebuffer = M_CheckParm("-framebuffer");
if (framebuffer)
consolevent = SDL_FALSE;
consolevent = false;
}
static inline void I_ShutdownConsole(void){}
#endif
@@ -689,7 +695,7 @@ void I_OutputMsg(const char *fmt, ...)
//
// I_GetKey
//
INT32 I_GetKey (void)
INT32 I_GetKey(void)
{
// Warning: I_GetKey empties the event queue till next keypress
event_t *ev;
@@ -719,7 +725,7 @@ static void JoyReset(SDLJoyInfo_t *JoySet)
{
if (JoySet->dev)
{
SDL_GameControllerClose(JoySet->dev);
SDL_CloseGamepad(JoySet->dev);
}
JoySet->dev = NULL;
@@ -761,15 +767,15 @@ void I_JoyScale4(void)
}
// Cheat to get the device index for a joystick handle
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev)
INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev)
{
SDL_Joystick *joystick = NULL;
joystick = SDL_GameControllerGetJoystick(dev);
joystick = SDL_GetGamepadJoystick(dev);
if (joystick)
{
return SDL_JoystickInstanceID(joystick);
return SDL_GetJoystickID(joystick);
}
return -1;
@@ -879,7 +885,7 @@ void I_ShutdownJoystick(UINT8 index)
*/
static int joy_open(int playerIndex, int joyIndex)
{
SDL_GameController *newdev = NULL;
SDL_Gamepad *newdev = NULL;
int num_joy = 0;
if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0)
@@ -888,7 +894,7 @@ static int joy_open(int playerIndex, int joyIndex)
return -1;
}
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0)
if (SDL_WasInit(SDL_INIT_GAMEPAD) == 0)
{
CONS_Printf(M_GetText("Game Controller subsystem not started\n"));
return -1;
@@ -897,7 +903,7 @@ static int joy_open(int playerIndex, int joyIndex)
if (joyIndex <= 0)
return -1;
num_joy = SDL_NumJoysticks();
SDL_GetJoysticks(&num_joy);
if (num_joy == 0)
{
@@ -905,7 +911,7 @@ static int joy_open(int playerIndex, int joyIndex)
return -1;
}
newdev = SDL_GameControllerOpen(joyIndex-1);
newdev = SDL_OpenGamepad(joyIndex-1);
// Handle the edge case where the device <-> joystick index assignment can change due to hotplugging
// This indexing is SDL's responsibility and there's not much we can do about it.
@@ -920,8 +926,8 @@ static int joy_open(int playerIndex, int joyIndex)
if (JoyInfo[playerIndex].dev)
{
if (JoyInfo[playerIndex].dev == newdev // same device, nothing to do
|| (newdev == NULL && SDL_GameControllerGetAttached(JoyInfo[playerIndex].dev))) // we failed, but already have a working device
return SDL_CONTROLLER_AXIS_MAX;
|| (newdev == NULL && SDL_GamepadConnected(JoyInfo[playerIndex].dev))) // we failed, but already have a working device
return SDL_GAMEPAD_AXIS_COUNT;
// Else, we're changing devices, so send neutral joy events
CONS_Debug(DBG_GAMELOGIC, "Joystick1 device is changing; resetting events...\n");
@@ -938,13 +944,13 @@ static int joy_open(int playerIndex, int joyIndex)
}
else
{
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GameControllerName(JoyInfo[playerIndex].dev));
JoyInfo[playerIndex].axises = SDL_CONTROLLER_AXIS_MAX;
CONS_Debug(DBG_GAMELOGIC, M_GetText("Joystick1: %s\n"), SDL_GetGamepadName(JoyInfo[playerIndex].dev));
JoyInfo[playerIndex].axises = SDL_GAMEPAD_AXIS_COUNT;
if (JoyInfo[playerIndex].axises > JOYAXISSET*2)
JoyInfo[playerIndex].axises = JOYAXISSET*2;
JoyInfo[playerIndex].buttons = SDL_CONTROLLER_BUTTON_MAX ; // dpad is 4 buttons
JoyInfo[playerIndex].buttons = SDL_GAMEPAD_BUTTON_COUNT; // dpad is 4 buttons
if (JoyInfo[playerIndex].buttons > JOYBUTTONS)
JoyInfo[playerIndex].buttons = JOYBUTTONS;
@@ -964,7 +970,7 @@ static int joy_open(int playerIndex, int joyIndex)
void I_InitJoystick(UINT8 index)
{
UINT8 i;
SDL_GameController *newcontroller = NULL;
SDL_Gamepad *newcontroller = NULL;
// not sure if this is the best place to put this
SDL_SetHint(SDL_HINT_AUTO_UPDATE_SENSORS, "0");
@@ -982,15 +988,16 @@ void I_InitJoystick(UINT8 index)
{
CONS_Printf("I_InitJoystick()...\n");
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1)
if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK))
{
CONS_Printf(M_GetText("Couldn't initialize joystick: %s\n"), SDL_GetError());
return;
}
}
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 0)
if (SDL_WasInit(SDL_INIT_GAMEPAD) == 0)
{
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1)
if (!SDL_InitSubSystem(SDL_INIT_GAMEPAD))
{
CONS_Printf(M_GetText("Couldn't initialize gamepads: %s\n"), SDL_GetError());
return;
@@ -1003,7 +1010,7 @@ void I_InitJoystick(UINT8 index)
JoyInfo[index].axises = JoyInfo[index].buttons = JoyInfo[index].hats = JoyInfo[index].balls = 0;
if (cv_usejoystick[index].value)
newcontroller = SDL_GameControllerOpen(cv_usejoystick[index].value-1);
newcontroller = SDL_OpenGamepad(cv_usejoystick[index].value-1);
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
{
@@ -1043,7 +1050,7 @@ void I_InitJoystick(UINT8 index)
if (i == MAXSPLITSCREENPLAYERS)
{
// Joystick didn't end up being used
SDL_GameControllerClose(newcontroller);
SDL_CloseGamepad(newcontroller);
}
}
@@ -1078,10 +1085,10 @@ static void I_ShutdownInput(void)
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
I_ShutdownJoystick(i);
if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == SDL_INIT_GAMECONTROLLER)
if (SDL_WasInit(SDL_INIT_GAMEPAD) == SDL_INIT_GAMEPAD)
{
CONS_Printf("Shutting down gamecontroller system\n");
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
SDL_QuitSubSystem(SDL_INIT_GAMEPAD);
I_OutputMsg("I_Joystick: SDL's Game Controller system has been shutdown\n");
}
@@ -1098,7 +1105,9 @@ INT32 I_NumJoys(void)
INT32 numjoy = 0;
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
numjoy = SDL_NumJoysticks();
{
SDL_GetJoysticks(&numjoy);
}
return numjoy;
}
@@ -1113,7 +1122,7 @@ const char *I_GetJoyName(INT32 joyindex)
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
{
tempname = SDL_JoystickNameForIndex(joyindex);
tempname = SDL_GetJoystickNameForID(joyindex);
if (tempname)
{
@@ -1133,14 +1142,14 @@ void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength,
(void)high_strength;
(void)duration;
#else
SDL_GameController *controller = JoyInfo[playernum].dev;
SDL_Gamepad *controller = JoyInfo[playernum].dev;
if (controller == NULL)
{
return;
}
SDL_GameControllerRumble(controller, low_strength, high_strength, duration);
SDL_RumbleGamepad(controller, low_strength, high_strength, duration);
#endif
}
@@ -1152,14 +1161,14 @@ void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 b
(void)green;
(void)blue;
#else
SDL_GameController *controller = JoyInfo[playernum].dev;
SDL_Gamepad *controller = JoyInfo[playernum].dev;
if (controller == NULL)
{
return;
}
SDL_GameControllerSetLED(controller, red, green, blue);
SDL_SetGamepadLED(controller, red, green, blue);
#endif
}
@@ -1812,10 +1821,7 @@ static void I_Fork(void)
INT32 I_StartupSystem(void)
{
SDL_version SDLcompiled;
SDL_version SDLlinked;
SDL_VERSION(&SDLcompiled)
SDL_GetVersion(&SDLlinked);
int SDLlinked = SDL_GetVersion();
I_StartupConsole();
#ifdef NEWSIGNALHANDLER
// This is useful when debugging. It lets GDB attach to
@@ -1831,15 +1837,15 @@ INT32 I_StartupSystem(void)
#endif
I_RegisterSignals();
I_OutputMsg("Compiled for SDL version: %d.%d.%d\n",
SDLcompiled.major, SDLcompiled.minor, SDLcompiled.patch);
SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION);
I_OutputMsg("Linked with SDL version: %d.%d.%d\n",
SDLlinked.major, SDLlinked.minor, SDLlinked.patch);
SDL_VERSIONNUM_MAJOR(SDLlinked), SDL_VERSIONNUM_MINOR(SDLlinked), SDL_VERSIONNUM_MICRO(SDLlinked));
#if (SDL_VERSION_ATLEAST(2, 0, 18))
SDL_SetHint(SDL_HINT_APP_NAME, "SRB2Kart Saturn");
#endif
if (SDL_Init(0) < 0)
if (!SDL_Init(0))
I_Error("SRB2: SDL System Error: %s", SDL_GetError()); //Alam: Oh no....
#ifndef NOMUMBLE
I_SetupMumble();
@@ -1847,20 +1853,17 @@ INT32 I_StartupSystem(void)
return 0;
}
boolean is_quitting = false;
//
// I_Quit
//
FUNCNORETURN void ATTRNORETURN I_Quit(void)
{
static bool quiting = false;
/* prevent recursive I_Quit() */
if (is_quitting)
abort();
is_quitting = true;
SDL_ShowCursor(SDL_TRUE);
if (quiting) goto death;
SDL_ShowCursor();
quiting = false;
I_ShutdownConsole();
M_SaveConfig(NULL); //save game config, cvars..
D_SaveBan(); // save the ban list
@@ -1887,7 +1890,7 @@ FUNCNORETURN void ATTRNORETURN I_Quit(void)
}
if (myargmalloc)
free(myargv); // Deallocate allocated memory
death:
W_Shutdown();
exit(0);
}
+25 -34
View File
@@ -9,12 +9,10 @@
/// \file i_threads.c
/// \brief Multithreading abstraction
#ifdef HAVE_THREADS
#include "../doomdef.h"
#include "../i_threads.h"
#include <SDL.h>
#include <SDL3/SDL.h>
typedef void * (*Create_fn)(void);
@@ -47,7 +45,7 @@ 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 SDL_AtomicInt i_threads_running = {1};
static Link
Insert_link (
@@ -105,13 +103,13 @@ Identity (
){
void * id;
id = SDL_AtomicGetPtr(anchor);
id = SDL_GetAtomicPointer(anchor);
if (! id)
{
I_lock_mutex(&pool_mutex);
{
id = SDL_AtomicGetPtr(anchor);
id = SDL_GetAtomicPointer(anchor);
if (! id)
{
@@ -122,7 +120,7 @@ Identity (
Insert_link(pool_anchor, New_link(id));
SDL_AtomicSetPtr(anchor, id);
SDL_SetAtomicPointer(anchor, id);
}
}
I_unlock_mutex(pool_mutex);
@@ -141,11 +139,11 @@ Worker (
(*th->entry)(th->userdata);
if (SDL_AtomicGet(&i_threads_running))
if (SDL_GetAtomicInt(&i_threads_running))
{
I_lock_mutex(&i_thread_pool_mutex);
{
if (SDL_AtomicGet(&i_threads_running))
if (SDL_GetAtomicInt(&i_threads_running))
{
SDL_DetachThread(th->thread);
Free_link(&i_thread_pool, link);
@@ -178,7 +176,7 @@ I_spawn_thread (
{
link = Insert_link(&i_thread_pool, New_link(th));
if (SDL_AtomicGet(&i_threads_running))
if (SDL_GetAtomicInt(&i_threads_running))
{
th->thread = SDL_CreateThread(
(SDL_ThreadFunction)Worker,
@@ -196,7 +194,7 @@ I_spawn_thread (
int
I_thread_is_stopped (void)
{
return ( ! SDL_AtomicGet(&i_threads_running) );
return ( ! SDL_GetAtomicInt(&i_threads_running) );
}
void
@@ -222,13 +220,13 @@ I_stop_threads (void)
Link next;
Thread th;
SDL_mutex * mutex;
SDL_cond * cond;
SDL_Mutex * mutex;
SDL_Condition * cond;
if (i_threads_running.value)
{
/* rely on the good will of thread-san */
SDL_AtomicSet(&i_threads_running, 0);
SDL_SetAtomicInt(&i_threads_running, 0);
I_lock_mutex(&i_thread_pool_mutex);
{
@@ -269,7 +267,7 @@ I_stop_threads (void)
next = link->next;
cond = link->data;
SDL_DestroyCond(cond);
SDL_DestroyCondition(cond);
free(link);
}
@@ -284,7 +282,7 @@ void
I_lock_mutex (
I_mutex * anchor
){
SDL_mutex * mutex;
SDL_Mutex * mutex;
mutex = Identity(
&i_mutex_pool,
@@ -293,16 +291,14 @@ I_lock_mutex (
(Create_fn)SDL_CreateMutex
);
if (SDL_LockMutex(mutex) == -1)
abort();
SDL_LockMutex(mutex);
}
void
I_unlock_mutex (
I_mutex id
){
if (SDL_UnlockMutex(id) == -1)
abort();
SDL_UnlockMutex(id);
}
void
@@ -310,51 +306,46 @@ I_hold_cond (
I_cond * cond_anchor,
I_mutex mutex_id
){
SDL_cond * cond;
SDL_Condition * cond;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
cond_anchor,
(Create_fn)SDL_CreateCond
(Create_fn)SDL_CreateCondition
);
if (SDL_CondWait(cond, mutex_id) == -1)
abort();
SDL_WaitCondition(cond, mutex_id);
}
void
I_wake_one_cond (
I_cond * anchor
){
SDL_cond * cond;
SDL_Condition * cond;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
anchor,
(Create_fn)SDL_CreateCond
(Create_fn)SDL_CreateCondition
);
if (SDL_CondSignal(cond) == -1)
abort();
SDL_SignalCondition(cond);
}
void
I_wake_all_cond (
I_cond * anchor
){
SDL_cond * cond;
SDL_Condition * cond;
cond = Identity(
&i_cond_pool,
i_cond_pool_mutex,
anchor,
(Create_fn)SDL_CreateCond
(Create_fn)SDL_CreateCondition
);
if (SDL_CondBroadcast(cond) == -1)
abort();
SDL_BroadcastCondition(cond);
}
#endif // HAVE_THREADS
+3 -3
View File
@@ -16,7 +16,7 @@
/// \file
/// \brief SDL_ttf interface code. Necessary for platforms with no framebuffer console systems.
#if defined(HAVE_SDL) && defined(HAVE_TTF)
#if defined (HAVE_SDL) && defined (HAVE_TTF)
#include "SDL.h"
#include "SDL_ttf.h"
#include "../doomdef.h"
@@ -236,14 +236,14 @@ void I_StartupTTF(UINT32 fontpointsize, Uint32 initflags, Uint32 vidmodeflags)
// what's the point of trying to display an error?
// SDL_ttf is not started, can't display anything to screen (presumably)...
if (SDL_InitSubSystem(initflags) < 0)
if (!SDL_InitSubSystem(initflags))
I_Error("Couldn't initialize SDL: %s\n", SDL_GetError());
TTFSurface = SDL_SetVideoMode(res.width, res.height, bitsperpixel, vidmodeflags);
if (!TTFSurface)
I_Error("Couldn't set SDL Video resolution: %s\n", SDL_GetError());
if (TTF_Init() < 0)
if (!TTF_Init())
I_Error("Couldn't start SDL_ttf: %s\n", TTF_GetError());
// look for default font in many directories
+480 -299
View File
File diff suppressed because it is too large. Load diff
+64
View File
@@ -0,0 +1,64 @@
// 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
+27
View File
@@ -0,0 +1,27 @@
// 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 -10
View File
@@ -1,14 +1,5 @@
#ifndef __MAC_RESOURCES_H__
#define __MAC_RESOURCES_H__
#ifdef __cplusplus
extern "C" {
#endif
void OSX_GetResourcesPath(char * buffer);
#ifdef __cplusplus
} // extern "C"
#endif
#endif
#endif
+2 -2
View File
@@ -20,7 +20,7 @@
#ifdef HAVE_SDL
#define _MATH_DEFINES_DEFINED
#include "SDL.h"
#include <SDL3/SDL.h>
#include "sdlmain.h"
@@ -96,7 +96,7 @@ boolean VID_LoadOGLAPI(void)
if (M_CheckParm("-OGLlib") && M_IsNextParm())
OGLLibname = M_GetNextParm();
if (SDL_GL_LoadLibrary(OGLLibname) != 0)
if (!SDL_GL_LoadLibrary(OGLLibname))
{
CONS_Alert(CONS_ERROR, "Could not load OpenGL Library: %s\n", SDL_GetError());
if (!M_CheckParm("-OGLlib"))
+1962
View File
File diff suppressed because it is too large. Load diff
+7 -5
View File
@@ -23,14 +23,16 @@
extern "C" {
#endif
extern SDL_bool consolevent;
extern SDL_bool framebuffer;
extern bool consolevent;
extern bool framebuffer;
#include "../m_fixed.h"
// SDL2 stub macro
#define SDL2STUB() CONS_Printf("SDL2: stubbed: %s:%d\n", __func__, __LINE__)
#include <SDL3/SDL_gamepad.h>
// So m_menu knows whether to store cv_usejoystick value or string
#define JOYSTICK_HOTPLUG
@@ -41,9 +43,9 @@ extern SDL_bool framebuffer;
typedef struct SDLJoyInfo_s
{
/// Controller handle
SDL_GameController *dev;
SDL_Gamepad *dev;
/// Controller index
INT32 id;
SDL_JoystickID id;
/// number of old joystick
int oldjoy;
/// number of axies
@@ -71,7 +73,7 @@ extern SDLJoyInfo_t JoyInfo[4]; //MAXSPLITSCREENPLAYERS
void I_ShutdownJoystick(UINT8 index);
// Cheat to get the device index for a game controller handle
INT32 I_GetJoystickDeviceIndex(SDL_GameController *dev);
INT32 I_GetJoystickDeviceIndex(SDL_Gamepad *dev);
// Quick thing to make SDL_JOYDEVICEADDED events less of an abomination
void I_UpdateJoystickDeviceIndex(UINT8 player);
+16 -19
View File
@@ -352,7 +352,7 @@ static void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 x, INT32 hilicol)
if (pnum == whiteplayer)
{
UINT8 cursorframe = (intertic / 4) % 8;
V_DrawScaledPatch(x+16, y-4, 0, (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
V_DrawScaledPatch(x+16, y-4, 0, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
}
STRBUFCPY(strtime, standings->name[i]);
@@ -831,9 +831,6 @@ void Y_VoteScreenCheck(void)
VoteScreen.foundLuaVoteFrames = VoteScreen.foundLuaVoteWideFrames = 0;
VoteScreen.currentAnimFrame = 0;
if (VoteScreen.timePerAnimFrame == 0)
VoteScreen.timePerAnimFrame = 2;
INT32 i = 1;
// check for lua vote background replacements
@@ -859,8 +856,8 @@ void Y_VoteScreenCheck(void)
// non lua vote background handling
boolean prefbattletype = ((votelevels[0][1] & ~0x80) == GT_MATCH);
VoteScreen.widebgpatch = (patch_t *)W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH_LOWPRIORITY);
VoteScreen.bgpatch = (patch_t *)W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH_LOWPRIORITY);
VoteScreen.widebgpatch = W_CachePatchName((prefbattletype ? "BATTLSCW" : "INTERSCW"), PU_PATCH_LOWPRIORITY);
VoteScreen.bgpatch = W_CachePatchName((prefbattletype ? "BATTLSCR" : "INTERSCR"), PU_PATCH_LOWPRIORITY);
}
//
@@ -908,7 +905,7 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
// Draw non animated patch
if (!tempfoundAnimLuaVoteFrames)
{
votebg = (patch_t *)W_CachePatchName(va("%s1", tempPrefix), PU_PATCH_LOWPRIORITY);
votebg = W_CachePatchName(va("%s1", tempPrefix), PU_PATCH_LOWPRIORITY);
Y_VoteBackgroundDrawer(votebg);
return;
}
@@ -921,11 +918,11 @@ static void Y_DrawLuaVoteScreenPatch(boolean widePatch)
nextframe = (VoteScreen.currentAnimFrame + 1);
votebg = (patch_t *)W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH_LOWPRIORITY);
votebg = W_CachePatchName(va("%s%d", tempPrefix, nextframe), PU_PATCH_LOWPRIORITY);
Y_VoteBackgroundDrawer(votebg);
if (renderisnewtic && (votetic % VoteScreen.timePerAnimFrame == 0) && !paused)
if (renderisnewtic && (votetic % 2 == 0) && !paused)
VoteScreen.currentAnimFrame = (nextframe > tempfoundAnimLuaVoteFrames) ? 0 : nextframe;
}
@@ -1189,7 +1186,7 @@ void Y_VoteDrawer(void)
if (!splitscreen && i == consoleplayer)
{
UINT8 cursorframe = (votetic / 4) % 8;
V_DrawScaledPatch(x+24, y+9, V_SNAPTOLEFT, (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
V_DrawScaledPatch(x+24, y+9, V_SNAPTOLEFT, W_CachePatchName(va("K_CHILI%d", cursorframe+1), PU_PATCH));
}
}
@@ -1449,14 +1446,14 @@ static void Y_InitVoteDrawing(void)
// setup the background patches
Y_VoteScreenCheck();
VoteScreen.cursor[0] = (patch_t*)W_CachePatchName("M_CURSOR", PU_PATCH);
VoteScreen.cursor[1] = (patch_t*)W_CachePatchName("P1CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[2] = (patch_t*)W_CachePatchName("P2CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[3] = (patch_t*)W_CachePatchName("P3CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[4] = (patch_t*)W_CachePatchName("P4CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[0] = W_CachePatchName("M_CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[1] = W_CachePatchName("P1CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[2] = W_CachePatchName("P2CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[3] = W_CachePatchName("P3CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.cursor[4] = W_CachePatchName("P4CURSOR", PU_PATCH_LOWPRIORITY);
VoteScreen.randomlvl = (patch_t*)W_CachePatchName("RANDOMLV", PU_PATCH);
VoteScreen.rubyicon = (patch_t*)W_CachePatchName("RUBYICON", PU_PATCH);
VoteScreen.randomlvl = W_CachePatchName("RANDOMLV", PU_PATCH_LOWPRIORITY);
VoteScreen.rubyicon = W_CachePatchName("RUBYICON", PU_PATCH_LOWPRIORITY);
}
void Y_StartVote(void)
@@ -1541,9 +1538,9 @@ void Y_StartVote(void)
{
lumpnum = W_CheckNumForName(va("%sP", G_BuildMapName(votelevels[i][0]+1)));
if (lumpnum != LUMPERROR)
levelinfo[i].pic = (patch_t *)W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH);
levelinfo[i].pic = W_CachePatchName(va("%sP", G_BuildMapName(votelevels[i][0]+1)), PU_PATCH_LOWPRIORITY);
else
levelinfo[i].pic = (patch_t *)W_CachePatchName("BLANKLVL", PU_PATCH);
levelinfo[i].pic = W_CachePatchName("BLANKLVL", PU_PATCH_LOWPRIORITY);
}
}
Loaded 100 of 102 files, more files were not shown because too many files have changed in this diff. Show more