Merge branch 'master' into capsules-improvement

This commit is contained in:
VelocitOni 2022-12-14 23:19:34 -05:00
commit c5372f4ce3
123 changed files with 3012 additions and 1609 deletions

1
.gitignore vendored
View file

@ -21,3 +21,4 @@ Win32_LIB_ASM_Release
/assets/debian /assets/debian
/make /make
/bin /bin
/build

View file

@ -1,17 +1,15 @@
cmake_minimum_required(VERSION 3.13) cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
# Enable CCache early if("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
set(SRB2_USE_CCACHE OFF CACHE BOOL "Use CCache") message(FATAL_ERROR "In-source builds are blocked. Please build from a separate directory.")
if (${SRB2_USE_CCACHE})
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
message(STATUS "Found CCache: ${CCACHE_PROGRAM}")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
else()
message(WARNING "You have specified to use CCACHE but it was not found. Object files will not be cached.")
endif()
endif() endif()
# Set up CMAKE path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
include(CMakeDependentOption)
include(cmake/CPM.cmake)
file(STRINGS src/version.h SRB2_VERSION) file(STRINGS src/version.h SRB2_VERSION)
string(REGEX MATCH "[0-9]+\\.[0-9.]+" SRB2_VERSION ${SRB2_VERSION}) string(REGEX MATCH "[0-9]+\\.[0-9.]+" SRB2_VERSION ${SRB2_VERSION})
@ -19,117 +17,11 @@ string(REGEX MATCH "[0-9]+\\.[0-9.]+" SRB2_VERSION ${SRB2_VERSION})
# Version change is fine. # Version change is fine.
project(SRB2 project(SRB2
VERSION ${SRB2_VERSION} VERSION ${SRB2_VERSION}
LANGUAGES C) LANGUAGES C CXX)
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) if(APPLE)
message(FATAL_ERROR "In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from.") # DiscordRPC needs but does not properly specify ObjC
endif() enable_language(OBJC)
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/")
### Useful functions
# Add sources from Sourcefile
function(target_sourcefile type)
file(STRINGS Sourcefile list
REGEX "[-0-9A-Za-z_]+\.${type}")
target_sources(SRB2SDL2 PRIVATE ${list})
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)
message(STATUS "Target is 64-bit")
set(SRB2_SYSTEM_BITS 64)
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
message(STATUS "Target is 32-bit")
set(SRB2_SYSTEM_BITS 32)
endif()
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 ringracers CACHE STRING "Executable binary output name")
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
## 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}")
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)
add_subdirectory(src)
if(NOT ${SRB2_CONFIG_DEV_BUILD})
add_subdirectory(assets)
endif() endif()
##### PACKAGE CONFIGURATION ##### ##### PACKAGE CONFIGURATION #####
@ -137,11 +29,11 @@ endif()
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.") 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("${SRB2_CPACK_GENERATOR}" STREQUAL "")
if(${CMAKE_SYSTEM} MATCHES "Windows") if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
set(SRB2_CPACK_GENERATOR "ZIP") set(SRB2_CPACK_GENERATOR "ZIP")
elseif(${CMAKE_SYSTEM} MATCHES "Linux") elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(SRB2_CPACK_GENERATOR "TGZ") set(SRB2_CPACK_GENERATOR "TGZ")
elseif(${CMAKE_SYSTEM} MATCHES "Darwin") elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(SRB2_CPACK_GENERATOR "TGZ") set(SRB2_CPACK_GENERATOR "TGZ")
endif() endif()
endif() endif()
@ -157,3 +49,138 @@ set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}") set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
SET(CPACK_OUTPUT_FILE_PREFIX package) SET(CPACK_OUTPUT_FILE_PREFIX package)
include(CPack) 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}
)
# 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_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)
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.")
# Enable CCache
# (Set USE_CCACHE=ON to use, CCACHE_OPTIONS for options)
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL Windows)
option(USE_CCACHE "Enable ccache support" OFF)
if(USE_CCACHE)
find_program(CCACHE_TOOL_PATH ccache)
if(CCACHE_TOOL_PATH)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_TOOL_PATH} CACHE STRING "" FORCE)
else()
message(WARNING "USE_CCACHE was set but ccache is not found (set CCACHE_TOOL_PATH)")
endif()
endif()
else()
CPMAddPackage(
NAME Ccache.cmake
GITHUB_REPOSITORY TheLartians/Ccache.cmake
VERSION 1.2
)
endif()
# Dependencies
add_subdirectory(thirdparty)
if("${SRB2_CONFIG_SYSTEM_LIBRARIES}")
find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
find_package(SDL2 REQUIRED)
find_package(SDL2_mixer REQUIRED)
find_package(CURL REQUIRED)
find_package(OPENMPT REQUIRED)
find_package(GME REQUIRED)
find_package(DiscordRPC REQUIRED)
endif()
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
message(FATAL_ERROR "In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from.")
endif()
if ((${SRB2_USE_CCACHE}) AND (${CMAKE_C_COMPILER} MATCHES "clang"))
message(WARNING "Using clang and CCache: You may want to set environment variable CCACHE_CPP2=yes to prevent include errors during compile.")
endif()
# Add sources from Sourcefile
function(target_sourcefile type)
file(STRINGS Sourcefile list
REGEX "[-0-9A-Za-z_]+\.${type}")
target_sources(SRB2SDL2 PRIVATE ${list})
endfunction()
# bitness check
set(SRB2_SYSTEM_BITS 0)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
message(STATUS "Target is 64-bit")
set(SRB2_SYSTEM_BITS 64)
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
message(STATUS "Target is 32-bit")
set(SRB2_SYSTEM_BITS 32)
endif()
if(${SRB2_SYSTEM_BITS} EQUAL 0)
message(STATUS "Target bitness is unknown")
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")
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}")
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 "ringracers")
if(NOT "${SRB2_GIT_BRANCH}" STREQUAL "master")
list(APPEND EXE_NAME_PARTS ${SRB2_GIT_BRANCH})
endif()
else()
list(APPEND EXE_NAME_PARTS ${SRB2_SDL2_EXE_NAME})
endif()
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})

View file

@ -1,75 +1,53 @@
## Assets Target Configuration ## ## Assets Target Configuration ##
# For prepending the current source path, later if(${CMAKE_SYSTEM} MATCHES Linux)
FUNCTION(PREPEND var prefix) # Asset installation isn't part of the Linux target
SET(listVar "") return()
FOREACH(f ${ARGN}) endif()
LIST(APPEND listVar "${prefix}/${f}")
ENDFOREACH(f)
SET(${var} "${listVar}" PARENT_SCOPE)
ENDFUNCTION(PREPEND)
set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer" if("${SRB2_CONFIG_ASSET_DIRECTORY}" STREQUAL "")
CACHE STRING "Path to directory that contains all asset files for the installer.") message(WARNING "SRB2_CONFIG_ASSET_DIRECTORY is not set, so installation will not contain data files.")
return()
endif()
set(SRB2_ASSET_INSTALL ON get_filename_component(SRB2_ASSET_DIRECTORY_ABSOLUTE "${SRB2_CONFIG_ASSET_DIRECTORY}" ABSOLUTE)
CACHE BOOL "Insert asset files into the install directory or package.")
set(SRB2_ASSETS_DOCS
"README.txt"
"HISTORY.txt"
"README-SDL.txt"
"LICENSE.txt"
"LICENSE-3RD-PARTY.txt"
)
list(TRANSFORM SRB2_ASSETS_DOCS PREPEND "/")
list(TRANSFORM SRB2_ASSETS_DOCS PREPEND "${SRB2_ASSET_DIRECTORY_ABSOLUTE}")
#################### ####################
# POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list! # POST-V2.2 NOTE: Do not forget to add patch.pk3 to the end of this list!
#################### ####################
set(SRB2_ASSET_HASHED set(SRB2_ASSETS_GAME
"main.kart;\ "main.kart"
gfx.pk3;\ "gfx.pk3"
textures.pk3;\ "textures.pk3"
chars.pk3;\ "chars.pk3"
maps.pk3;\ "maps.pk3"
patch.pk3" "followers.pk3"
CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!" "patch.pk3"
) )
list(TRANSFORM SRB2_ASSETS_GAME PREPEND "/")
list(TRANSFORM SRB2_ASSETS_GAME PREPEND "${SRB2_ASSET_DIRECTORY_ABSOLUTE}")
set(SRB2_ASSET_DOCS set(SRB2_ASSETS ${SRB2_ASSET_DOCS} ${SRB2_ASSETS_GAME})
"README.txt;\
HISTORY.txt;\
LICENSE.txt;\
LICENSE-3RD-PARTY.txt;\
README-SDL.txt"
CACHE STRING "Documentation filenames. In OS X, these are packaged separately from other assets. No spaces between entries!"
)
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 # Installation
if(${CMAKE_SYSTEM} MATCHES Darwin) if(${CMAKE_SYSTEM} MATCHES Darwin)
get_target_property(outname SRB2SDL2 OUTPUT_NAME) get_target_property(outname SRB2SDL2 OUTPUT_NAME)
if(${SRB2_ASSET_INSTALL}) install(FILES ${SRB2_ASSETS} DESTINATION "${outname}.app/Contents/Resources")
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/" install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/models" DESTINATION "${outname}.app/Contents/Resources")
DESTINATION "${outname}.app/Contents/Resources" install(FILES ${SRB2_ASSETS_DOCS} DESTINATION .)
)
endif()
# Always install the doc files, even in non-asset packages.
install(FILES ${SRB2_ASSET_DOCS}
DESTINATION .
OPTIONAL
)
else() else()
if(${SRB2_ASSET_INSTALL}) install(FILES ${SRB2_ASSETS} DESTINATION .)
install(DIRECTORY "${SRB2_ASSET_DIRECTORY}/" install(DIRECTORY "${SRB2_ASSET_DIRECTORY_ABSOLUTE}/models" DESTINATION .)
DESTINATION .
)
# Docs are assumed to be located in SRB2_ASSET_DIRECTORY, so don't install them in their own call.
else()
# Always install the doc files, even in non-asset packages.
install(FILES ${SRB2_ASSET_DOCS}
DESTINATION .
OPTIONAL
)
endif()
endif() endif()

21
cmake/CPM.cmake Normal file
View file

@ -0,0 +1,21 @@
set(CPM_DOWNLOAD_VERSION 0.36.0)
if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()
# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION}
)
endif()
include(${CPM_DOWNLOAD_LOCATION})

View file

@ -21,3 +21,13 @@ find_library(DISCORDRPC_LIBRARY
set(DISCORDRPC_PROCESS_INCLUDES DISCORDRPC_INCLUDE_DIR) set(DISCORDRPC_PROCESS_INCLUDES DISCORDRPC_INCLUDE_DIR)
set(DISCORDRPC_PROCESS_LIBS DISCORDRPC_LIBRARY) set(DISCORDRPC_PROCESS_LIBS DISCORDRPC_LIBRARY)
libfind_process(DISCORDRPC) 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()

View file

@ -20,4 +20,14 @@ find_library(GME_LIBRARY
set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR) set(GME_PROCESS_INCLUDES GME_INCLUDE_DIR)
set(GME_PROCESS_LIBS GME_LIBRARY) set(GME_PROCESS_LIBS GME_LIBRARY)
libfind_process(GME) libfind_process(GME)
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()

View file

@ -20,4 +20,14 @@ find_library(OPENMPT_LIBRARY
set(OPENMPT_PROCESS_INCLUDES OPENMPT_INCLUDE_DIR) set(OPENMPT_PROCESS_INCLUDES OPENMPT_INCLUDE_DIR)
set(OPENMPT_PROCESS_LIBS OPENMPT_LIBRARY) set(OPENMPT_PROCESS_LIBS OPENMPT_LIBRARY)
libfind_process(OPENMPT) libfind_process(OPENMPT)
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()

View file

@ -31,3 +31,13 @@ find_library(SDL2_LIBRARY
set(SDL2_PROCESS_INCLUDES SDL2_INCLUDE_DIR) set(SDL2_PROCESS_INCLUDES SDL2_INCLUDE_DIR)
set(SDL2_PROCESS_LIBS SDL2_LIBRARY) set(SDL2_PROCESS_LIBS SDL2_LIBRARY)
libfind_process(SDL2) 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()

View file

@ -32,3 +32,13 @@ find_library(SDL2_MIXER_LIBRARY
set(SDL2_MIXER_PROCESS_INCLUDES SDL2_MIXER_INCLUDE_DIR) set(SDL2_MIXER_PROCESS_INCLUDES SDL2_MIXER_INCLUDE_DIR)
set(SDL2_MIXER_PROCESS_LIBS SDL2_MIXER_LIBRARY) set(SDL2_MIXER_PROCESS_LIBS SDL2_MIXER_LIBRARY)
libfind_process(SDL2_MIXER) 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()

View file

@ -1,3 +0,0 @@
#!/bin/sh
export CCACHE_CPP2=true
exec "${RULE_LAUNCH_COMPILE}" "${CMAKE_C_COMPILER}" "$@"

View file

@ -1,3 +0,0 @@
#!/bin/sh
export CCACHE_CPP2=true
exec "${RULE_LAUNCH_COMPILE}" "${CMAKE_C_COMPILER}" "$@"

View file

@ -1,7 +1,12 @@
# SRB2 Core
add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32) add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32)
if("${CMAKE_COMPILER_IS_GNUCC}" AND "${CMAKE_SYSTEM_NAME}" MATCHES "Windows" AND NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}")
# On MinGW with internal libraries, link the standard library statically
target_link_options(SRB2SDL2 PRIVATE "-static")
endif()
set_property(TARGET SRB2SDL2 PROPERTY C_STANDARD 11)
# Core sources # Core sources
target_sourcefile(c) target_sourcefile(c)
target_sources(SRB2SDL2 PRIVATE comptime.c md5.c config.h.in) target_sources(SRB2SDL2 PRIVATE comptime.c md5.c config.h.in)
@ -11,110 +16,56 @@ set(SRB2_ASM_SOURCES vid_copy.s)
set(SRB2_NASM_SOURCES tmap_mmx.nas tmap.nas) set(SRB2_NASM_SOURCES tmap_mmx.nas tmap.nas)
### Configuration ### Configuration
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_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_HAVE_OPENMPT ON CACHE BOOL
"Enable OpenMPT support.")
set(SRB2_CONFIG_HAVE_CURL ON CACHE BOOL
"Enable curl support.")
set(SRB2_CONFIG_HAVE_THREADS ON CACHE BOOL
"Enable multithreading support.")
if(${CMAKE_SYSTEM} MATCHES Windows)
set(SRB2_CONFIG_HAVE_MIXERX ON CACHE BOOL
"Enable SDL Mixer X support.")
else()
set(SRB2_CONFIG_HAVE_MIXERX OFF)
endif()
set(SRB2_CONFIG_HWRENDER ON CACHE BOOL
"Enable hardware rendering through OpenGL.")
set(SRB2_CONFIG_USEASM OFF CACHE BOOL set(SRB2_CONFIG_USEASM OFF CACHE BOOL
"Enable NASM tmap implementation for software mode speedup.") "Enable NASM tmap implementation for software mode speedup.")
set(SRB2_CONFIG_YASM OFF CACHE BOOL set(SRB2_CONFIG_YASM OFF CACHE BOOL
"Use YASM in place of NASM.") "Use YASM in place of NASM.")
set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
"Use statically linked OpenGL. NOT RECOMMENDED.")
set(SRB2_CONFIG_DEV_BUILD OFF CACHE BOOL set(SRB2_CONFIG_DEV_BUILD OFF CACHE BOOL
"Compile a development build of SRB2Kart.") "Compile a development build of SRB2Kart.")
### 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, cURL).")
endif()
add_subdirectory(blua) add_subdirectory(blua)
if(${SRB2_CONFIG_HAVE_GME}) # OS macros
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) if (UNIX)
set(GME_FOUND ON) target_compile_definitions(SRB2SDL2 PRIVATE -DUNIXCOMMON)
set(GME_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/gme/include) endif()
if(${SRB2_SYSTEM_BITS} EQUAL 64)
set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win64 -lgme") if(CMAKE_COMPILER_IS_GNUCC)
else() # 32-bit find_program(OBJCOPY objcopy)
set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win32 -lgme") endif()
endif()
else() if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
find_package(GME) target_compile_definitions(SRB2SDL2 PRIVATE -DLINUX)
endif() if(${SRB2_SYSTEM_BITS} EQUAL 64)
if(${GME_FOUND}) target_compile_definitions(SRB2SDL2 PRIVATE -DLINUX64)
set(SRB2_HAVE_GME ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
else()
message(WARNING "You have specified that GME is available but it was not found.")
endif() endif()
endif() endif()
if(${SRB2_CONFIG_HAVE_OPENMPT}) if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) target_compile_definitions(SRB2SDL2 PRIVATE -DMACOSX)
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)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_OPENMPT)
else()
message(WARNING "You have specified that OpenMPT is available but it was not found.")
endif()
endif() endif()
if(${SRB2_CONFIG_HAVE_MIXERX}) target_link_libraries(SRB2SDL2 PRIVATE gme)
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME)
set(MIXERX_FOUND ON) if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}")
set(MIXERX_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/SDLMixerX/i686-w64-mingw32/include/SDL2) # this sucks but gme doesn't use modern cmake to delineate public headers
if(${SRB2_SYSTEM_BITS} EQUAL 64) target_include_directories(SRB2SDL2 PRIVATE "${libgme_SOURCE_DIR}")
set(MIXERX_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDLMixerX/x86_64-w64-mingw32/lib -lSDL2_mixer_ext")
else() # 32-bit
set(MIXERX_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/SDLMixerX/i686-w64-mingw32/lib -lSDL2_mixer_ext")
endif()
else()
# No support for non-Windows (yet?)
#find_package(MIXERX)
message(WARNING "SDL Mixer X is not supported as an external library.")
set(MIXERX_FOUND OFF)
endif()
if(${MIXERX_FOUND})
set(SRB2_HAVE_MIXERX ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_MIXERX)
else()
message(WARNING "You have specified that SDL Mixer X is available but it was not found.")
endif()
endif() endif()
target_link_libraries(SRB2SDL2 PRIVATE openmpt)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_OPENMPT)
target_link_libraries(SRB2SDL2 PRIVATE ZLIB::ZLIB PNG::PNG CURL::libcurl)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_ZLIB -DHAVE_PNG -DHAVE_CURL -D_LARGEFILE64_SOURCE)
target_sources(SRB2SDL2 PRIVATE apng.c)
target_link_libraries(SRB2SDL2 PRIVATE DiscordRPC::DiscordRPC)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_DISCORDRPC -DUSE_STUN)
target_sources(SRB2SDL2 PRIVATE discord.c stun.c)
set(SRB2_HAVE_THREADS ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
if(${SRB2_CONFIG_HAVE_DISCORDRPC}) if(${SRB2_CONFIG_HAVE_DISCORDRPC})
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES}) if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
set(DISCORDRPC_FOUND ON) set(DISCORDRPC_FOUND ON)
@ -182,49 +133,32 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB})
endif() endif()
endif() endif()
if(${SRB2_CONFIG_HAVE_CURL}) if("${SRB2_CONFIG_HWRENDER}")
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)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_CURL)
else()
message(WARNING "You have specified that CURL is available but it was not found. SRB2Kart may not compile correctly.")
endif()
endif()
if(${SRB2_CONFIG_HAVE_THREADS})
set(SRB2_HAVE_THREADS ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_THREADS)
endif()
if(${SRB2_CONFIG_HWRENDER})
target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER) target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER)
add_subdirectory(hardware) add_subdirectory(hardware)
if("${SRB2_CONFIG_STATIC_OPENGL}")
find_package(OpenGL)
if(${OPENGL_FOUND})
target_compile_definitions(SRB2SDL2 PRIVATE -DSTATIC_OPENGL)
else()
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.")
endif()
endif()
endif() endif()
if(${SRB2_CONFIG_HWRENDER} AND ${SRB2_CONFIG_STATIC_OPENGL}) # TODO: build this with the game
find_package(OpenGL) if(${CMAKE_SYSTEM} MATCHES Windows AND ${CMAKE_C_COMPILER_ID} MATCHES "GNU" AND ${SRB2_SYSTEM_BITS} EQUAL 32)
if(${OPENGL_FOUND}) target_link_libraries(SRB2SDL2 PRIVATE
target_compile_definitions(SRB2SDL2 PRIVATE -DHWRENDER) "${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/lib/win32/libexchndl.a"
target_compile_definitions(SRB2SDL2 PRIVATE -DSTATIC_OPENGL) "${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/lib/win32/libmgwhelp.a"
else() )
message(WARNING "You have specified static opengl but opengl was not found. Not setting HWRENDER.") target_include_directories(SRB2SDL2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../libs/drmingw/include")
endif()
endif() endif()
if(${SRB2_CONFIG_USEASM}) if(${SRB2_CONFIG_USEASM})
#SRB2_ASM_FLAGS can be used to pass flags to either nasm or yasm. #SRB2_ASM_FLAGS can be used to pass flags to either nasm or yasm.
if(${CMAKE_SYSTEM} MATCHES "Linux") if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(SRB2_ASM_FLAGS "-DLINUX ${SRB2_ASM_FLAGS}") set(SRB2_ASM_FLAGS "-DLINUX ${SRB2_ASM_FLAGS}")
endif() endif()
@ -240,7 +174,7 @@ if(${SRB2_CONFIG_USEASM})
set(SRB2_USEASM ON) set(SRB2_USEASM ON)
target_compile_definitions(SRB2SDL2 PRIVATE -DUSEASM) target_compile_definitions(SRB2SDL2 PRIVATE -DUSEASM)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3 -mfpmath=sse") target_compile_options(SRB2SDL2 PRIVATE -msse3 -mfpmath=sse)
target_sources(SRB2SDL2 PRIVATE ${SRB2_ASM_SOURCES} target_sources(SRB2SDL2 PRIVATE ${SRB2_ASM_SOURCES}
${SRB2_NASM_SOURCES}) ${SRB2_NASM_SOURCES})
@ -253,7 +187,7 @@ endif()
# If using CCACHE, then force it. # If using CCACHE, then force it.
# https://github.com/Cockatrice/Cockatrice/pull/3052/files # https://github.com/Cockatrice/Cockatrice/pull/3052/files
if (${CMAKE_SYSTEM} MATCHES "Darwin") if ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
get_property(RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE) get_property(RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
if(RULE_LAUNCH_COMPILE) if(RULE_LAUNCH_COMPILE)
MESSAGE(STATUS "Force enabling CCache usage under macOS") MESSAGE(STATUS "Force enabling CCache usage under macOS")
@ -275,35 +209,171 @@ endif()
# Compatibility flag with later versions of GCC # Compatibility flag with later versions of GCC
# We should really fix our code to not need this # We should really fix our code to not need this
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -mno-ms-bitfields) target_compile_options(SRB2SDL2 PRIVATE -mno-ms-bitfields)
endif() endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # Compiler warnings configuration
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-absolute-value) target_compile_options(SRB2SDL2 PRIVATE
# Using generator expressions to handle per-language compile options
# C, GNU
# This is a direct translation from versions.mk
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:GNU>>:
-Wall
-Wno-trigraphs
-W # Was controlled by RELAXWARNINGS
-pedantic
-Wfloat-equal
-Wundef
-Wpointer-arith
-Wbad-function-cast
-Wcast-qual
-Wcast-align # Was controlled by NOCASTALIGNWARN
-Wwrite-strings
-Wsign-compare
-Wmissing-prototypes
-Wmissing-declarations
-Wmissing-noreturn
-Wnested-externs
-Winline
-Wformat-y2k
-Wformat-security
$<$<VERSION_LESS:$<C_COMPILER_VERSION>,2.9.5>:
-Wno-div-by-zero
-Wendif-labels
-Wdisabled-optimization
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.0.0>:
-Wold-style-definition
-Wmissing-field-initializers
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.1.0>:
-Wshadow
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.3.0>:
-funit-at-a-time
-Wlogical-op
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.5.0>:
-Wlogical-op
-Wno-error=array-bounds
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,4.6.0>:
-Wno-suggest-attribute=noreturn
-Wno-error=suggest-attribute=noreturn
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,5.4.0>:
-Wno-logical-op
-Wno-error=logical-op
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,6.1.0>:
-Wno-tautological-compare
-Wno-error=tautological-compare
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,7.1.0>:
-Wno-error=format-overflow=2
-Wimplicit-fallthrough=4
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,8.1.0>:
-Wno-error=format-overflow
-Wno-error=stringop-truncation
-Wno-error=stringop-overflow
-Wno-format-overflow
-Wno-stringop-truncation
-Wno-stringop-overflow
-Wno-error=multistatement-macros
>
$<$<VERSION_GREATER_EQUAL:$<C_COMPILER_VERSION>,9.1.0>:
-Wno-error=address-of-packed-member
>
>
# C, Clang and Apple Clang
$<$<AND:$<COMPILE_LANGUAGE:C>,$<OR:$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>:
-Wall
-Wno-absolute-value
-Wno-trigraphs
-Wno-error=non-literal-null-conversion
-Wno-error=constant-conversion
-Wno-error=unused-but-set-variable
>
# C, MSVC
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:MSVC>>:
# All warnings at and before Visual Studio 2019 RTM
# https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-by-compiler-version?view=msvc-170
/Wv:19.20.27004.0
>
# C++, GNU, Clang and Apple Clang
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>>:
-Wall
>
# C++, MSVC
$<$<AND:$<COMPILE_LANGUAGE:C>,$<C_COMPILER_ID:MSVC>>:
/Wv:19.20.27004.0
>
)
if(SRB2_CONFIG_ERRORMODE)
target_compile_options(SRB2SDL2 PRIVATE
$<$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:Clang>>:
-Werror
>
$<$<C_COMPILER_ID:MSVC>:
/WX
>
)
endif() 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}) if(${SRB2_CONFIG_DEV_BUILD})
target_compile_definitions(SRB2SDL2 PRIVATE -DDEVELOP) target_compile_definitions(SRB2SDL2 PRIVATE -DDEVELOP)
endif() endif()
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} -Wno-trigraphs)
target_compile_definitions(SRB2SDL2 PRIVATE -DCMAKECONFIG) target_compile_definitions(SRB2SDL2 PRIVATE -DCMAKECONFIG)
#add_library(SRB2Core STATIC # Misc. build options from Makefiles
# ${SRB2_CORE_SOURCES} if(SRB2_CONFIG_DEBUGMODE)
# ${SRB2_CORE_HEADERS} target_compile_definitions(SRB2SDL2 PRIVATE -DZDEBUG -DPARANOIA -DRANGECHECK -DPACKETDROP)
# ${SRB2_CORE_RENDER_SOURCES} endif()
# ${SRB2_CORE_GAME_SOURCES} if(SRB2_CONFIG_MOBJCONSISTANCY)
# ${SRB2_LUA_SOURCES} target_compile_definitions(SRB2SDL2 PRIVATE -DMOBJCONSISTANCY)
# ${SRB2_LUA_HEADERS} endif()
# ${SRB2_BLUA_SOURCES} if(SRB2_CONFIG_PACKETDROP)
# ${SRB2_BLUA_HEADERS} 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()
## strip debug symbols into separate file when using gcc. add_subdirectory(sdl)
## to be consistent with Makefile, don't generate for OS X. add_subdirectory(objects)
if((CMAKE_COMPILER_IS_GNUCC) AND NOT (${CMAKE_SYSTEM} MATCHES Darwin))
# strip debug symbols into separate file when using gcc.
# to be consistent with Makefile, don't generate for OS X.
if((CMAKE_COMPILER_IS_GNUCC) 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) OR (${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo))
if(${CMAKE_BUILD_TYPE} MATCHES Debug) if(${CMAKE_BUILD_TYPE} MATCHES Debug)
set(OBJCOPY_ONLY_KEEP_DEBUG "--only-keep-debug") set(OBJCOPY_ONLY_KEEP_DEBUG "--only-keep-debug")
@ -317,9 +387,26 @@ if((CMAKE_COMPILER_IS_GNUCC) AND NOT (${CMAKE_SYSTEM} MATCHES Darwin))
endif() endif()
endif() endif()
add_subdirectory(sdl) # copy DLLs to bin/ directory if building internal shared on windows
add_subdirectory(objects) 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)
# also copy implicitly linked system libraries
get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH)
list(APPEND ADDITIONAL_DLLS
"libgcc_s_dw2-1.dll"
"libstdc++-6.dll"
"libwinpthread-1.dll"
)
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}
if(NOT ${SRB2_SDL2_AVAILABLE}) $<TARGET_FILE_DIR:SRB2SDL2>
message(FATAL_ERROR "There are no targets available to build an SRB2Kart executable. :(") COMMAND_EXPAND_LISTS
COMMENT "Copying runtime DLLs"
)
endif() endif()

View file

@ -16,15 +16,15 @@
#include "d_event.h" #include "d_event.h"
typedef struct struct fpoint_t
{ {
INT32 x, y; INT32 x, y;
} fpoint_t; };
typedef struct struct fline_t
{ {
fpoint_t a, b; fpoint_t a, b;
} fline_t; };
extern boolean am_recalc; // true if screen size changes extern boolean am_recalc; // true if screen size changes
extern boolean automapactive; // In AutoMap mode? extern boolean automapactive; // In AutoMap mode?

View file

@ -79,14 +79,14 @@ void COM_Init(void);
// Variable sized buffers // Variable sized buffers
// ====================== // ======================
typedef struct vsbuf_s struct vsbuf_t
{ {
boolean allowoverflow; // if false, do a I_Error boolean allowoverflow; // if false, do a I_Error
boolean overflowed; // set to true if the buffer size failed boolean overflowed; // set to true if the buffer size failed
UINT8 *data; UINT8 *data;
size_t maxsize; size_t maxsize;
size_t cursize; size_t cursize;
} vsbuf_t; };
void VS_Alloc(vsbuf_t *buf, size_t initsize); void VS_Alloc(vsbuf_t *buf, size_t initsize);
void VS_Free(vsbuf_t *buf); void VS_Free(vsbuf_t *buf);
@ -127,13 +127,13 @@ typedef enum
CV_NOLUA = 4096,/* don't let this be called from Lua */ CV_NOLUA = 4096,/* don't let this be called from Lua */
} cvflags_t; } cvflags_t;
typedef struct CV_PossibleValue_s struct CV_PossibleValue_t
{ {
INT32 value; INT32 value;
const char *strvalue; const char *strvalue;
} CV_PossibleValue_t; };
typedef struct consvar_s //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NULL struct consvar_t //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NULL
{ {
const char *name; const char *name;
const char *defaultvalue; const char *defaultvalue;
@ -157,8 +157,8 @@ typedef struct consvar_s //NULL, NULL, 0, NULL, NULL |, 0, NULL, NULL, 0, 0, NUL
UINT16 netid; // used internaly : netid for send end receive UINT16 netid; // used internaly : netid for send end receive
// used only with CV_NETVAR // used only with CV_NETVAR
char changed; // has variable been changed by the user? 0 = no, 1 = yes char changed; // has variable been changed by the user? 0 = no, 1 = yes
struct consvar_s *next; consvar_t *next;
} consvar_t; };
/* name, defaultvalue, flags, PossibleValue, func */ /* name, defaultvalue, flags, PossibleValue, func */
#define CVAR_INIT( ... ) \ #define CVAR_INIT( ... ) \

View file

@ -11,15 +11,6 @@
#ifdef CMAKECONFIG #ifdef CMAKECONFIG
#define ASSET_HASH_MAIN_KART "${SRB2_ASSET_main.kart_HASH}"
#define ASSET_HASH_GFX_PK3 "${SRB2_ASSET_gfx.pk3_HASH}"
#define ASSET_HASH_TEXTURES_PK3 "${SRB2_ASSET_textures.pk3_HASH}"
#define ASSET_HASH_CHARS_PK3 "${SRB2_ASSET_chars.pk3_HASH}"
#define ASSET_HASH_MAPS_PK3 "${SRB2_ASSET_maps.pk3_HASH}"
#ifdef USE_PATCH_FILE
#define ASSET_HASH_PATCH_PK3 "${SRB2_ASSET_patch.pk3_HASH}"
#endif
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}" #define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}" #define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
// This is done with configure_file instead of defines in order to avoid // This is done with configure_file instead of defines in order to avoid
@ -29,9 +20,7 @@
#define COMPVERSION_UNCOMMITTED #define COMPVERSION_UNCOMMITTED
#endif #endif
#define CMAKE_ASSETS_DIR "${CMAKE_SOURCE_DIR}/assets" #endif
#else
/* Manually defined asset hashes for non-CMake builds /* Manually defined asset hashes for non-CMake builds
* Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets * Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets
@ -48,4 +37,3 @@
#endif #endif
#endif #endif
#endif

View file

@ -130,43 +130,43 @@ void Command_Numnodes(void);
#endif #endif
// Client to server packet // Client to server packet
typedef struct struct clientcmd_pak
{ {
UINT8 client_tic; UINT8 client_tic;
UINT8 resendfrom; UINT8 resendfrom;
INT16 consistancy; INT16 consistancy;
ticcmd_t cmd; ticcmd_t cmd;
} ATTRPACK clientcmd_pak; } ATTRPACK;
// Splitscreen packet // Splitscreen packet
// WARNING: must have the same format of clientcmd_pak, for more easy use // WARNING: must have the same format of clientcmd_pak, for more easy use
typedef struct struct client2cmd_pak
{ {
UINT8 client_tic; UINT8 client_tic;
UINT8 resendfrom; UINT8 resendfrom;
INT16 consistancy; INT16 consistancy;
ticcmd_t cmd, cmd2; ticcmd_t cmd, cmd2;
} ATTRPACK client2cmd_pak; } ATTRPACK;
// 3P Splitscreen packet // 3P Splitscreen packet
// WARNING: must have the same format of clientcmd_pak, for more easy use // WARNING: must have the same format of clientcmd_pak, for more easy use
typedef struct struct client3cmd_pak
{ {
UINT8 client_tic; UINT8 client_tic;
UINT8 resendfrom; UINT8 resendfrom;
INT16 consistancy; INT16 consistancy;
ticcmd_t cmd, cmd2, cmd3; ticcmd_t cmd, cmd2, cmd3;
} ATTRPACK client3cmd_pak; } ATTRPACK;
// 4P Splitscreen packet // 4P Splitscreen packet
// WARNING: must have the same format of clientcmd_pak, for more easy use // WARNING: must have the same format of clientcmd_pak, for more easy use
typedef struct struct client4cmd_pak
{ {
UINT8 client_tic; UINT8 client_tic;
UINT8 resendfrom; UINT8 resendfrom;
INT16 consistancy; INT16 consistancy;
ticcmd_t cmd, cmd2, cmd3, cmd4; ticcmd_t cmd, cmd2, cmd3, cmd4;
} ATTRPACK client4cmd_pak; } ATTRPACK;
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable : 4200) #pragma warning(disable : 4200)
@ -174,15 +174,15 @@ typedef struct
// Server to client packet // Server to client packet
// this packet is too large // this packet is too large
typedef struct struct servertics_pak
{ {
UINT8 starttic; UINT8 starttic;
UINT8 numtics; UINT8 numtics;
UINT8 numslots; // "Slots filled": Highest player number in use plus one. UINT8 numslots; // "Slots filled": Highest player number in use plus one.
ticcmd_t cmds[45]; // Normally [BACKUPTIC][MAXPLAYERS] but too large ticcmd_t cmds[45]; // Normally [BACKUPTIC][MAXPLAYERS] but too large
} ATTRPACK servertics_pak; } ATTRPACK;
typedef struct struct serverconfig_pak
{ {
UINT8 version; // Different versions don't work UINT8 version; // Different versions don't work
UINT8 subversion; // Contains build version UINT8 subversion; // Contains build version
@ -204,9 +204,9 @@ typedef struct
UINT8 maxplayer; UINT8 maxplayer;
boolean allownewplayer; boolean allownewplayer;
boolean discordinvites; boolean discordinvites;
} ATTRPACK serverconfig_pak; } ATTRPACK;
typedef struct struct filetx_pak
{ {
UINT8 fileid; UINT8 fileid;
UINT32 filesize; UINT32 filesize;
@ -214,21 +214,21 @@ typedef struct
UINT32 position; UINT32 position;
UINT16 size; UINT16 size;
UINT8 data[]; // Size is variable using hardware_MAXPACKETLENGTH UINT8 data[]; // Size is variable using hardware_MAXPACKETLENGTH
} ATTRPACK filetx_pak; } ATTRPACK;
typedef struct struct fileacksegment_t
{ {
UINT32 start; UINT32 start;
UINT32 acks; UINT32 acks;
} ATTRPACK fileacksegment_t; } ATTRPACK;
typedef struct struct fileack_pak
{ {
UINT8 fileid; UINT8 fileid;
UINT8 iteration; UINT8 iteration;
UINT8 numsegments; UINT8 numsegments;
fileacksegment_t segments[]; fileacksegment_t segments[];
} ATTRPACK fileack_pak; } ATTRPACK;
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(default : 4200) #pragma warning(default : 4200)
@ -236,7 +236,7 @@ typedef struct
#define MAXAPPLICATION 16 #define MAXAPPLICATION 16
typedef struct struct clientconfig_pak
{ {
UINT8 _255;/* see serverinfo_pak */ UINT8 _255;/* see serverinfo_pak */
UINT8 packetversion; UINT8 packetversion;
@ -246,7 +246,7 @@ typedef struct
UINT8 localplayers; // number of splitscreen players UINT8 localplayers; // number of splitscreen players
UINT8 mode; UINT8 mode;
char names[MAXSPLITSCREENPLAYERS][MAXPLAYERNAME]; char names[MAXSPLITSCREENPLAYERS][MAXPLAYERNAME];
} ATTRPACK clientconfig_pak; } ATTRPACK;
#define SV_SPEEDMASK 0x03 // used to send kartspeed #define SV_SPEEDMASK 0x03 // used to send kartspeed
#define SV_DEDICATED 0x40 // server is dedicated #define SV_DEDICATED 0x40 // server is dedicated
@ -256,7 +256,7 @@ typedef struct
#define MAXFILENEEDED 915 #define MAXFILENEEDED 915
#define MAX_MIRROR_LENGTH 256 #define MAX_MIRROR_LENGTH 256
// This packet is too large // This packet is too large
typedef struct struct serverinfo_pak
{ {
/* /*
In the old packet, 'version' is the first field. Now that field is set In the old packet, 'version' is the first field. Now that field is set
@ -289,27 +289,27 @@ typedef struct
char httpsource[MAX_MIRROR_LENGTH]; // HTTP URL to download from, always defined for compatibility char httpsource[MAX_MIRROR_LENGTH]; // HTTP URL to download from, always defined for compatibility
INT16 avgpwrlv; // Kart avg power level INT16 avgpwrlv; // Kart avg power level
UINT8 fileneeded[MAXFILENEEDED]; // is filled with writexxx (byteptr.h) UINT8 fileneeded[MAXFILENEEDED]; // is filled with writexxx (byteptr.h)
} ATTRPACK serverinfo_pak; } ATTRPACK;
typedef struct struct serverrefuse_pak
{ {
char reason[255]; char reason[255];
} ATTRPACK serverrefuse_pak; } ATTRPACK;
typedef struct struct askinfo_pak
{ {
UINT8 version; UINT8 version;
tic_t time; // used for ping evaluation tic_t time; // used for ping evaluation
} ATTRPACK askinfo_pak; } ATTRPACK;
typedef struct struct msaskinfo_pak
{ {
char clientaddr[22]; char clientaddr[22];
tic_t time; // used for ping evaluation tic_t time; // used for ping evaluation
} ATTRPACK msaskinfo_pak; } ATTRPACK;
// Shorter player information for external use. // Shorter player information for external use.
typedef struct struct plrinfo
{ {
UINT8 num; UINT8 num;
char name[MAXPLAYERNAME+1]; char name[MAXPLAYERNAME+1];
@ -319,10 +319,10 @@ typedef struct
UINT8 data; // Color is first four bits, hasflag, isit and issuper have one bit each, the last is unused. UINT8 data; // Color is first four bits, hasflag, isit and issuper have one bit each, the last is unused.
UINT32 score; UINT32 score;
UINT16 timeinserver; // In seconds. UINT16 timeinserver; // In seconds.
} ATTRPACK plrinfo; } ATTRPACK;
// Shortest player information for join during intermission. // Shortest player information for join during intermission.
typedef struct struct plrconfig
{ {
char name[MAXPLAYERNAME+1]; char name[MAXPLAYERNAME+1];
UINT8 skin; UINT8 skin;
@ -330,20 +330,20 @@ typedef struct
UINT32 pflags; UINT32 pflags;
UINT32 score; UINT32 score;
UINT8 ctfteam; UINT8 ctfteam;
} ATTRPACK plrconfig; } ATTRPACK;
typedef struct struct filesneededconfig_pak
{ {
INT32 first; INT32 first;
UINT8 num; UINT8 num;
UINT8 more; UINT8 more;
UINT8 files[MAXFILENEEDED]; // is filled with writexxx (byteptr.h) UINT8 files[MAXFILENEEDED]; // is filled with writexxx (byteptr.h)
} ATTRPACK filesneededconfig_pak; } ATTRPACK;
// //
// Network packet data // Network packet data
// //
typedef struct struct doomdata_t
{ {
UINT32 checksum; UINT32 checksum;
UINT8 ack; // If not zero the node asks for acknowledgement, the receiver must resend the ack UINT8 ack; // If not zero the node asks for acknowledgement, the receiver must resend the ack
@ -375,18 +375,18 @@ typedef struct
filesneededconfig_pak filesneededcfg; // ??? bytes filesneededconfig_pak filesneededcfg; // ??? bytes
UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes
} u; // This is needed to pack diff packet types data together } u; // This is needed to pack diff packet types data together
} ATTRPACK doomdata_t; } ATTRPACK;
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma pack() #pragma pack()
#endif #endif
#define MAXSERVERLIST (MAXNETNODES-1) #define MAXSERVERLIST (MAXNETNODES-1)
typedef struct struct serverelem_t
{ {
SINT8 node; SINT8 node;
serverinfo_pak info; serverinfo_pak info;
} serverelem_t; };
extern serverelem_t serverlist[MAXSERVERLIST]; extern serverelem_t serverlist[MAXSERVERLIST];
extern UINT32 serverlistcount; extern UINT32 serverlistcount;
@ -528,7 +528,7 @@ extern boolean hu_stopped;
// SRB2Kart // SRB2Kart
// //
typedef struct rewind_s { struct rewind_t {
UINT8 savebuffer[(768*1024)]; UINT8 savebuffer[(768*1024)];
tic_t leveltime; tic_t leveltime;
size_t demopos; size_t demopos;
@ -536,8 +536,8 @@ typedef struct rewind_s {
ticcmd_t oldcmd[MAXPLAYERS]; ticcmd_t oldcmd[MAXPLAYERS];
mobj_t oldghost[MAXPLAYERS]; mobj_t oldghost[MAXPLAYERS];
struct rewind_s *next; rewind_t *next;
} rewind_t; };
void CL_ClearRewinds(void); void CL_ClearRewinds(void);
rewind_t *CL_SaveRewindPoint(size_t demopos); rewind_t *CL_SaveRewindPoint(size_t demopos);

View file

@ -28,14 +28,14 @@ typedef enum
} evtype_t; } evtype_t;
// Event structure. // Event structure.
typedef struct struct event_t
{ {
evtype_t type; evtype_t type;
INT32 data1; // keys / mouse/joystick buttons INT32 data1; // keys / mouse/joystick buttons
INT32 data2; // mouse/joystick x move INT32 data2; // mouse/joystick x move
INT32 data3; // mouse/joystick y move INT32 data3; // mouse/joystick y move
INT32 device; // which player's device it belongs to INT32 device; // which player's device it belongs to
} event_t; };
// //
// GLOBAL VARIABLES // GLOBAL VARIABLES

View file

@ -373,6 +373,9 @@ static void D_Display(void)
if (dedicated) //bail out after wipe logic if (dedicated) //bail out after wipe logic
return; return;
// Catch runaway clipping rectangles.
V_ClearClipRect();
// do buffered drawing // do buffered drawing
switch (gamestate) switch (gamestate)
{ {
@ -1203,7 +1206,11 @@ D_ConvertVersionNumbers (void)
void D_SRB2Main(void) void D_SRB2Main(void)
{ {
INT32 i, p; INT32 i, p;
INT32 pstartmap = 0; #ifdef DEVELOP
INT32 pstartmap = 1; // default to first loaded map (Test Run)
#else
INT32 pstartmap = 0; // default to random map (0 is not a valid map number)
#endif
boolean autostart = false; boolean autostart = false;
/* break the version string into version numbers, for netplay */ /* break the version string into version numbers, for netplay */

View file

@ -192,9 +192,9 @@ typedef struct
UINT8 nextacknum; UINT8 nextacknum;
UINT8 flags; UINT8 flags;
} node_t; } netnode_t;
static node_t nodes[MAXNETNODES]; static netnode_t nodes[MAXNETNODES];
#define NODETIMEOUT 14 #define NODETIMEOUT 14
// return <0 if a < b (mod 256) // return <0 if a < b (mod 256)
@ -218,7 +218,7 @@ FUNCMATH static INT32 cmpack(UINT8 a, UINT8 b)
*/ */
static boolean GetFreeAcknum(UINT8 *freeack, boolean lowtimer) static boolean GetFreeAcknum(UINT8 *freeack, boolean lowtimer)
{ {
node_t *node = &nodes[doomcom->remotenode]; netnode_t *node = &nodes[doomcom->remotenode];
INT32 i, numfreeslot = 0; INT32 i, numfreeslot = 0;
if (cmpack((UINT8)((node->remotefirstack + MAXACKTOSEND) % 256), node->nextacknum) < 0) if (cmpack((UINT8)((node->remotefirstack + MAXACKTOSEND) % 256), node->nextacknum) < 0)
@ -325,7 +325,7 @@ static boolean Processackpak(void)
{ {
INT32 i; INT32 i;
boolean goodpacket = true; boolean goodpacket = true;
node_t *node = &nodes[doomcom->remotenode]; netnode_t *node = &nodes[doomcom->remotenode];
// Received an ack return, so remove the ack in the list // Received an ack return, so remove the ack in the list
if (netbuffer->ackreturn && cmpack(node->remotefirstack, netbuffer->ackreturn) < 0) if (netbuffer->ackreturn && cmpack(node->remotefirstack, netbuffer->ackreturn) < 0)
@ -492,7 +492,7 @@ void Net_AckTicker(void)
for (i = 0; i < MAXACKPACKETS; i++) for (i = 0; i < MAXACKPACKETS; i++)
{ {
const INT32 nodei = ackpak[i].destinationnode; const INT32 nodei = ackpak[i].destinationnode;
node_t *node = &nodes[nodei]; netnode_t *node = &nodes[nodei];
if (ackpak[i].acknum && ackpak[i].senttime + NODETIMEOUT < I_GetTime()) if (ackpak[i].acknum && ackpak[i].senttime + NODETIMEOUT < I_GetTime())
{ {
if (ackpak[i].resentnum > 20 && (node->flags & NF_CLOSE)) if (ackpak[i].resentnum > 20 && (node->flags & NF_CLOSE))
@ -612,7 +612,7 @@ void Net_WaitAllAckReceived(UINT32 timeout)
} }
} }
static void InitNode(node_t *node) static void InitNode(netnode_t *node)
{ {
node->acktosend_head = node->acktosend_tail = 0; node->acktosend_head = node->acktosend_tail = 0;
node->firstacktosend = 0; node->firstacktosend = 0;

View file

@ -219,22 +219,22 @@ extern const char *netxcmdnames[MAXNETXCMD - 1];
//Packet composition for Command_TeamChange_f() ServerTeamChange, etc. //Packet composition for Command_TeamChange_f() ServerTeamChange, etc.
//bitwise structs make packing bits a little easier, but byte alignment harder? //bitwise structs make packing bits a little easier, but byte alignment harder?
//todo: decide whether to make the other netcommands conform, or just get rid of this experiment. //todo: decide whether to make the other netcommands conform, or just get rid of this experiment.
typedef struct { struct changeteam_packet_t {
UINT32 playernum : 5; // value 0 to 31 UINT32 playernum : 5; // value 0 to 31
UINT32 newteam : 5; // value 0 to 31 UINT32 newteam : 5; // value 0 to 31
UINT32 verification : 1; // value 0 to 1 UINT32 verification : 1; // value 0 to 1
UINT32 autobalance : 1; // value 0 to 1 UINT32 autobalance : 1; // value 0 to 1
UINT32 scrambled : 1; // value 0 to 1 UINT32 scrambled : 1; // value 0 to 1
} ATTRPACK changeteam_packet_t; } ATTRPACK;
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(default : 4214) #pragma warning(default : 4214)
#endif #endif
typedef struct { struct changeteam_value_t {
UINT16 l; // liitle endian UINT16 l; // liitle endian
UINT16 b; // big enian UINT16 b; // big enian
} ATTRPACK changeteam_value_t; } ATTRPACK;
//Since we do not want other files/modules to know about this data buffer we union it here with a Short Int. //Since we do not want other files/modules to know about this data buffer we union it here with a Short Int.
//Other files/modules will hand the INT16 back to us and we will decode it here. //Other files/modules will hand the INT16 back to us and we will decode it here.
@ -272,12 +272,12 @@ void RemoveAdminPlayer(INT32 playernum);
void ItemFinder_OnChange(void); void ItemFinder_OnChange(void);
void D_SetPassword(const char *pw); void D_SetPassword(const char *pw);
typedef struct struct scheduleTask_t
{ {
UINT16 basetime; UINT16 basetime;
UINT16 timer; UINT16 timer;
char *command; char *command;
} scheduleTask_t; };
extern scheduleTask_t **schedule; extern scheduleTask_t **schedule;
extern size_t schedule_size; extern size_t schedule_size;

View file

@ -37,7 +37,7 @@ typedef enum
FS_FALLBACK, // HTTP failed FS_FALLBACK, // HTTP failed
} filestatus_t; } filestatus_t;
typedef struct struct fileneeded_t
{ {
UINT8 willsend; // Is the server willing to send it? UINT8 willsend; // Is the server willing to send it?
char filename[MAX_WADPATH]; char filename[MAX_WADPATH];
@ -54,7 +54,7 @@ typedef struct
UINT32 currentsize; UINT32 currentsize;
UINT32 totalsize; UINT32 totalsize;
UINT32 ackresendposition; // Used when resuming downloads UINT32 ackresendposition; // Used when resuming downloads
} fileneeded_t; };
extern INT32 fileneedednum; extern INT32 fileneedednum;
extern fileneeded_t fileneeded[MAX_WADFILES]; extern fileneeded_t fileneeded[MAX_WADFILES];
@ -71,8 +71,6 @@ extern boolean curl_failedwebdownload;
extern boolean curl_running; extern boolean curl_running;
extern INT32 curl_transfers; extern INT32 curl_transfers;
typedef struct HTTP_login HTTP_login;
extern struct HTTP_login extern struct HTTP_login
{ {
char * url; char * url;
@ -112,7 +110,7 @@ typedef enum
LFTNS_SENT // The node already has the file LFTNS_SENT // The node already has the file
} luafiletransfernodestatus_t; } luafiletransfernodestatus_t;
typedef struct luafiletransfer_s struct luafiletransfer_t
{ {
char *filename; char *filename;
char *realfilename; char *realfilename;
@ -121,8 +119,8 @@ typedef struct luafiletransfer_s
boolean ongoing; boolean ongoing;
luafiletransfernodestatus_t nodestatus[MAXNETNODES]; luafiletransfernodestatus_t nodestatus[MAXNETNODES];
tic_t nodetimeouts[MAXNETNODES]; tic_t nodetimeouts[MAXNETNODES];
struct luafiletransfer_s *next; luafiletransfer_t *next;
} luafiletransfer_t; };
extern luafiletransfer_t *luafiletransfers; extern luafiletransfer_t *luafiletransfers;
extern boolean waitingforluafiletransfer; extern boolean waitingforluafiletransfer;

View file

@ -289,7 +289,7 @@ typedef enum
#define GARDENTOP_MAXGRINDTIME (45) #define GARDENTOP_MAXGRINDTIME (45)
// player_t struct for all respawn variables // player_t struct for all respawn variables
typedef struct respawnvars_s struct respawnvars_t
{ {
UINT8 state; // see RESPAWNST_ constants in k_respawn.h UINT8 state; // see RESPAWNST_ constants in k_respawn.h
waypoint_t *wp; // Waypoint that we're going towards, NULL if the position isn't linked to one waypoint_t *wp; // Waypoint that we're going towards, NULL if the position isn't linked to one
@ -303,10 +303,10 @@ typedef struct respawnvars_s
tic_t dropdash; // Drop Dash charge timer tic_t dropdash; // Drop Dash charge timer
boolean truedeath; // Your soul has left your body boolean truedeath; // Your soul has left your body
boolean manual; // Respawn coords were manually set, please respawn exactly there boolean manual; // Respawn coords were manually set, please respawn exactly there
} respawnvars_t; };
// player_t struct for all bot variables // player_t struct for all bot variables
typedef struct botvars_s struct botvars_t
{ {
UINT8 difficulty; // Bot's difficulty setting UINT8 difficulty; // Bot's difficulty setting
UINT8 diffincrease; // In GP: bot difficulty will increase this much next round UINT8 diffincrease; // In GP: bot difficulty will increase this much next round
@ -323,18 +323,18 @@ typedef struct botvars_s
SINT8 turnconfirm; // Confirm turn direction SINT8 turnconfirm; // Confirm turn direction
tic_t spindashconfirm; // When high enough, they will try spindashing tic_t spindashconfirm; // When high enough, they will try spindashing
} botvars_t; };
// player_t struct for all skybox variables // player_t struct for all skybox variables
typedef struct { struct skybox_t {
mobj_t * viewpoint; mobj_t * viewpoint;
mobj_t * centerpoint; mobj_t * centerpoint;
} skybox_t; };
// ======================================================================== // ========================================================================
// PLAYER STRUCTURE // PLAYER STRUCTURE
// ======================================================================== // ========================================================================
typedef struct player_s struct player_t
{ {
mobj_t *mo; mobj_t *mo;
@ -614,6 +614,6 @@ typedef struct player_s
#ifdef HWRENDER #ifdef HWRENDER
fixed_t fovadd; // adjust FOV for hw rendering fixed_t fovadd; // adjust FOV for hw rendering
#endif #endif
} player_t; };
#endif #endif

View file

@ -40,15 +40,15 @@ typedef union
typedef actionf_t think_t; typedef actionf_t think_t;
// Doubly linked list of actors. // Doubly linked list of actors.
typedef struct thinker_s struct thinker_t
{ {
struct thinker_s *prev; thinker_t *prev;
struct thinker_s *next; thinker_t *next;
think_t function; think_t function;
// killough 11/98: count of how many other objects reference // killough 11/98: count of how many other objects reference
// this one using pointers. Used for garbage collection. // this one using pointers. Used for garbage collection.
INT32 references; INT32 references;
} thinker_t; };
#endif #endif

View file

@ -63,7 +63,7 @@ typedef enum
#pragma pack(1) #pragma pack(1)
#endif #endif
typedef struct struct ticcmd_t
{ {
SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50) SINT8 forwardmove; // -MAXPLMOVE to MAXPLMOVE (50)
INT16 turning; // Turn speed INT16 turning; // Turn speed
@ -72,7 +72,7 @@ typedef struct
UINT16 buttons; UINT16 buttons;
UINT8 latency; // Netgames: how many tics ago was this ticcmd generated from this player's end? UINT8 latency; // Netgames: how many tics ago was this ticcmd generated from this player's end?
UINT8 flags; UINT8 flags;
} ATTRPACK ticcmd_t; } ATTRPACK;
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma pack() #pragma pack()

View file

@ -313,6 +313,7 @@ actionpointer_t actionpointers[] =
{{A_JawzExplode}, "A_JAWZEXPLODE"}, {{A_JawzExplode}, "A_JAWZEXPLODE"},
{{A_SSMineSearch}, "A_SSMINESEARCH"}, {{A_SSMineSearch}, "A_SSMINESEARCH"},
{{A_SSMineExplode}, "A_SSMINEEXPLODE"}, {{A_SSMineExplode}, "A_SSMINEEXPLODE"},
{{A_SSMineFlash}, "A_SSMINEFLASH"},
{{A_LandMineExplode}, "A_LANDMINEEXPLODE"}, {{A_LandMineExplode}, "A_LANDMINEEXPLODE"},
{{A_BallhogExplode}, "A_BALLHOGEXPLODE"}, {{A_BallhogExplode}, "A_BALLHOGEXPLODE"},
{{A_LightningFollowPlayer}, "A_LIGHTNINGFOLLOWPLAYER"}, {{A_LightningFollowPlayer}, "A_LIGHTNINGFOLLOWPLAYER"},
@ -4529,6 +4530,10 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
"S_JANKSPARK2", "S_JANKSPARK2",
"S_JANKSPARK3", "S_JANKSPARK3",
"S_JANKSPARK4", "S_JANKSPARK4",
// Broly Ki Orb
"S_BROLY1",
"S_BROLY2",
}; };
// RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1", // RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1",
@ -6371,6 +6376,7 @@ struct int_const_s const INT_CONST[] = {
{"DMG_TUMBLE",DMG_TUMBLE}, {"DMG_TUMBLE",DMG_TUMBLE},
{"DMG_STING",DMG_STING}, {"DMG_STING",DMG_STING},
{"DMG_KARMA",DMG_KARMA}, {"DMG_KARMA",DMG_KARMA},
{"DMG_VOLTAGE",DMG_VOLTAGE},
//// Death types //// Death types
{"DMG_INSTAKILL",DMG_INSTAKILL}, {"DMG_INSTAKILL",DMG_INSTAKILL},
{"DMG_DEATHPIT",DMG_DEATHPIT}, {"DMG_DEATHPIT",DMG_DEATHPIT},

View file

@ -41,11 +41,11 @@ struct flickytypes_s {
/** Action pointer for reading actions from Dehacked lumps. /** Action pointer for reading actions from Dehacked lumps.
*/ */
typedef struct struct actionpointer_t
{ {
actionf_t action; ///< Function pointer corresponding to the actual action. actionf_t action; ///< Function pointer corresponding to the actual action.
const char *name; ///< Name of the action in ALL CAPS. const char *name; ///< Name of the action in ALL CAPS.
} actionpointer_t; };
struct int_const_s { struct int_const_s {
const char *n; const char *n;

View file

@ -57,13 +57,13 @@ extern UINT8 superstack;
// the code was first write for a file // the code was first write for a file
// converted to use memory with this functions // converted to use memory with this functions
typedef struct struct MYFILE
{ {
char *data; char *data;
char *curpos; char *curpos;
size_t size; size_t size;
UINT16 wad; UINT16 wad;
} MYFILE; };
#define myfeof(a) (a->data + a->size <= a->curpos) #define myfeof(a) (a->data + a->size <= a->curpos)
char *myfgets(char *buf, size_t bufsize, MYFILE *f); char *myfgets(char *buf, size_t bufsize, MYFILE *f);
char *myhashfgets(char *buf, size_t bufsize, MYFILE *f); char *myhashfgets(char *buf, size_t bufsize, MYFILE *f);

View file

@ -15,7 +15,7 @@
#ifdef HAVE_DISCORDRPC #ifdef HAVE_DISCORDRPC
#include "discord_rpc.h" #include <discord_rpc.h>
extern consvar_t cv_discordrp; extern consvar_t cv_discordrp;
extern consvar_t cv_discordstreamer; extern consvar_t cv_discordstreamer;
@ -27,7 +27,7 @@ extern struct discordInfo_s {
boolean everyoneCanInvite; boolean everyoneCanInvite;
} discordInfo; } discordInfo;
typedef struct discordRequest_s { struct discordRequest_t {
char *username; // Discord user name. char *username; // Discord user name.
char *discriminator; // Discord discriminator (The little hashtag thing after the username). Separated for a "hide discriminators" cvar. char *discriminator; // Discord discriminator (The little hashtag thing after the username). Separated for a "hide discriminators" cvar.
char *userID; // The ID of the Discord user, gets used with Discord_Respond() char *userID; // The ID of the Discord user, gets used with Discord_Respond()
@ -38,9 +38,9 @@ typedef struct discordRequest_s {
// Hey, wanna add ImageMagick as a dependency? :dying: // Hey, wanna add ImageMagick as a dependency? :dying:
//patch_t *avatar; //patch_t *avatar;
struct discordRequest_s *next; // Next request in the list. discordRequest_t *next; // Next request in the list.
struct discordRequest_s *prev; // Previous request in the list. Not used normally, but just in case something funky happens, this should repair the list. discordRequest_t *prev; // Previous request in the list. Not used normally, but just in case something funky happens, this should repair the list.
} discordRequest_t; };
extern discordRequest_t *discordRequestList; extern discordRequest_t *discordRequestList;

View file

@ -68,24 +68,24 @@ enum
#endif #endif
// A single Vertex. // A single Vertex.
typedef struct struct mapvertex_t
{ {
INT16 x, y; INT16 x, y;
}ATTRPACK mapvertex_t; }ATTRPACK;
// A SideDef, defining the visual appearance of a wall, // A SideDef, defining the visual appearance of a wall,
// by setting textures and offsets. // by setting textures and offsets.
typedef struct struct mapsidedef_t
{ {
INT16 textureoffset, rowoffset; INT16 textureoffset, rowoffset;
char toptexture[8], bottomtexture[8], midtexture[8]; char toptexture[8], bottomtexture[8], midtexture[8];
// Front sector, towards viewer. // Front sector, towards viewer.
INT16 sector; INT16 sector;
} ATTRPACK mapsidedef_t; } ATTRPACK;
// A LineDef, as used for editing, and as input // A LineDef, as used for editing, and as input
// to the BSP builder. // to the BSP builder.
typedef struct struct maplinedef_t
{ {
INT16 v1, v2; INT16 v1, v2;
INT16 flags; INT16 flags;
@ -93,7 +93,7 @@ typedef struct
INT16 tag; INT16 tag;
// sidenum[1] will be 0xffff if one sided // sidenum[1] will be 0xffff if one sided
UINT16 sidenum[2]; UINT16 sidenum[2];
} ATTRPACK maplinedef_t; } ATTRPACK;
// //
// LineDef attributes. // LineDef attributes.
@ -152,7 +152,7 @@ enum
}; };
// Sector definition, from editing. // Sector definition, from editing.
typedef struct struct mapsector_t
{ {
INT16 floorheight; INT16 floorheight;
INT16 ceilingheight; INT16 ceilingheight;
@ -161,34 +161,34 @@ typedef struct
INT16 lightlevel; INT16 lightlevel;
INT16 special; INT16 special;
INT16 tag; INT16 tag;
} ATTRPACK mapsector_t; } ATTRPACK;
// SubSector, as generated by BSP. // SubSector, as generated by BSP.
typedef struct struct mapsubsector_t
{ {
UINT16 numsegs; UINT16 numsegs;
// Index of first one, segs are stored sequentially. // Index of first one, segs are stored sequentially.
UINT16 firstseg; UINT16 firstseg;
} ATTRPACK mapsubsector_t; } ATTRPACK;
// LineSeg, generated by splitting LineDefs // LineSeg, generated by splitting LineDefs
// using partition lines selected by BSP builder. // using partition lines selected by BSP builder.
typedef struct struct mapseg_t
{ {
INT16 v1, v2; INT16 v1, v2;
INT16 angle; INT16 angle;
INT16 linedef; INT16 linedef;
INT16 side; INT16 side;
INT16 offset; INT16 offset;
} ATTRPACK mapseg_t; } ATTRPACK;
// BSP node structure. // BSP node structure.
// Indicate a leaf. // Indicate a leaf.
#define NF_SUBSECTOR 0x8000 #define NF_SUBSECTOR 0x8000
typedef struct struct mapnode_t
{ {
// Partition line from (x,y) to x+dx,y+dy) // Partition line from (x,y) to x+dx,y+dy)
INT16 x, y; INT16 x, y;
@ -199,7 +199,7 @@ typedef struct
// If NF_SUBSECTOR it's a subsector, else it's a node of another subtree. // If NF_SUBSECTOR it's a subsector, else it's a node of another subtree.
UINT16 children[2]; UINT16 children[2];
} ATTRPACK mapnode_t; } ATTRPACK;
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma pack() #pragma pack()
@ -210,7 +210,7 @@ typedef struct
// Thing definition, position, orientation and type, // Thing definition, position, orientation and type,
// plus visibility flags and attributes. // plus visibility flags and attributes.
typedef struct struct mapthing_t
{ {
INT16 x, y; INT16 x, y;
INT16 angle, pitch, roll; INT16 angle, pitch, roll;
@ -222,8 +222,8 @@ typedef struct
fixed_t scale; fixed_t scale;
INT32 args[NUMMAPTHINGARGS]; INT32 args[NUMMAPTHINGARGS];
char *stringargs[NUMMAPTHINGSTRINGARGS]; char *stringargs[NUMMAPTHINGSTRINGARGS];
struct mobj_s *mobj; mobj_t *mobj;
} mapthing_t; };
#define ZSHIFT 4 #define ZSHIFT 4

View file

@ -210,7 +210,7 @@ extern char logfilename[1024];
// Master Server compatibility ONLY // Master Server compatibility ONLY
#define MSCOMPAT_MAXPLAYERS (32) #define MSCOMPAT_MAXPLAYERS (32)
typedef struct skincolor_s struct skincolor_t
{ {
char name[MAXCOLORNAME+1]; // Skincolor name char name[MAXCOLORNAME+1]; // Skincolor name
UINT8 ramp[COLORRAMPSIZE]; // Colormap ramp UINT8 ramp[COLORRAMPSIZE]; // Colormap ramp
@ -218,7 +218,7 @@ typedef struct skincolor_s
UINT8 invshade; // Signpost color shade UINT8 invshade; // Signpost color shade
UINT16 chatcolor; // Chat color UINT16 chatcolor; // Chat color
boolean accessible; // Accessible by the color command + setup menu boolean accessible; // Accessible by the color command + setup menu
} skincolor_t; };
#define FOLLOWERCOLOR_MATCH UINT16_MAX #define FOLLOWERCOLOR_MATCH UINT16_MAX
#define FOLLOWERCOLOR_OPPOSITE (UINT16_MAX-1) #define FOLLOWERCOLOR_OPPOSITE (UINT16_MAX-1)

View file

@ -92,12 +92,12 @@ typedef enum
PRECIPFX_WATERPARTICLES = 1<<2 PRECIPFX_WATERPARTICLES = 1<<2
} precipeffect_t; } precipeffect_t;
typedef struct struct precipprops_t
{ {
const char *name; const char *name;
mobjtype_t type; mobjtype_t type;
precipeffect_t effects; precipeffect_t effects;
} precipprops_t; };
extern precipprops_t precipprops[MAXPRECIP]; extern precipprops_t precipprops[MAXPRECIP];
extern preciptype_t precip_freeslot; extern preciptype_t precip_freeslot;
@ -107,13 +107,13 @@ extern preciptype_t curWeather;
/** Time attack information, currently a very small structure. /** Time attack information, currently a very small structure.
*/ */
typedef struct struct recorddata_t
{ {
tic_t time; ///< Time in which the level was finished. tic_t time; ///< Time in which the level was finished.
tic_t lap; ///< Best lap time for this level. tic_t lap; ///< Best lap time for this level.
//UINT32 score; ///< Score when the level was finished. //UINT32 score; ///< Score when the level was finished.
//UINT16 rings; ///< Rings when the level was finished. //UINT16 rings; ///< Rings when the level was finished.
} recorddata_t; };
// mapvisited is now a set of flags that says what we've done in the map. // mapvisited is now a set of flags that says what we've done in the map.
#define MV_VISITED (1) #define MV_VISITED (1)
@ -220,7 +220,7 @@ extern UINT16 skincolor_redteam, skincolor_blueteam, skincolor_redring, skincolo
extern boolean exitfadestarted; extern boolean exitfadestarted;
typedef struct struct scene_t
{ {
UINT8 numpics; UINT8 numpics;
char picname[8][8]; char picname[8][8];
@ -240,13 +240,13 @@ typedef struct
UINT8 fadecolor; // Color number for fade, 0 means don't do the first fade UINT8 fadecolor; // Color number for fade, 0 means don't do the first fade
UINT8 fadeinid; // ID of the first fade, to a color -- ignored if fadecolor is 0 UINT8 fadeinid; // ID of the first fade, to a color -- ignored if fadecolor is 0
UINT8 fadeoutid; // ID of the second fade, to the new screen UINT8 fadeoutid; // ID of the second fade, to the new screen
} scene_t; // TODO: It would probably behoove us to implement subsong/track selection here, too, but I'm lazy -SH }; // TODO: It would probably behoove us to implement subsong/track selection here, too, but I'm lazy -SH
typedef struct struct cutscene_t
{ {
scene_t scene[128]; // 128 scenes per cutscene. scene_t scene[128]; // 128 scenes per cutscene.
INT32 numscenes; // Number of scenes in this cutscene INT32 numscenes; // Number of scenes in this cutscene
} cutscene_t; };
extern cutscene_t *cutscenes[128]; extern cutscene_t *cutscenes[128];
@ -261,7 +261,7 @@ extern cutscene_t *cutscenes[128];
#define PROMPT_PIC_LOOP 1 #define PROMPT_PIC_LOOP 1
#define PROMPT_PIC_DESTROY 2 #define PROMPT_PIC_DESTROY 2
#define MAX_PROMPT_PICS 8 #define MAX_PROMPT_PICS 8
typedef struct struct textpage_t
{ {
UINT8 numpics; UINT8 numpics;
UINT8 picmode; // sequence mode after displaying last pic, 0 = persist, 1 = loop, 2 = destroy UINT8 picmode; // sequence mode after displaying last pic, 0 = persist, 1 = loop, 2 = destroy
@ -294,13 +294,13 @@ typedef struct
char nexttag[33]; // next tag to jump to. If set, this overrides nextprompt and nextpage. char nexttag[33]; // next tag to jump to. If set, this overrides nextprompt and nextpage.
INT32 timetonext; // time in tics to jump to next page automatically. 0 = don't jump automatically INT32 timetonext; // time in tics to jump to next page automatically. 0 = don't jump automatically
char *text; char *text;
} textpage_t; };
typedef struct struct textprompt_t
{ {
textpage_t page[MAX_PAGES]; textpage_t page[MAX_PAGES];
INT32 numpages; // Number of pages in this prompt INT32 numpages; // Number of pages in this prompt
} textprompt_t; };
extern textprompt_t *textprompts[MAX_PROMPTS]; extern textprompt_t *textprompts[MAX_PROMPTS];
@ -316,10 +316,10 @@ extern mapthing_t *rflagpoint, *bflagpoint; // Pointers to the flag spawn locati
#define GF_BLUEFLAG 2 #define GF_BLUEFLAG 2
// A single point in space. // A single point in space.
typedef struct struct mappoint_t
{ {
fixed_t x, y, z; fixed_t x, y, z;
} mappoint_t; };
extern struct quake extern struct quake
{ {
@ -333,11 +333,11 @@ extern struct quake
} quake; } quake;
// Custom Lua values // Custom Lua values
typedef struct struct customoption_t
{ {
char option[32]; // 31 usable characters char option[32]; // 31 usable characters
char value[256]; // 255 usable characters. If this seriously isn't enough then wtf. char value[256]; // 255 usable characters. If this seriously isn't enough then wtf.
} customoption_t; };
// This could support more, but is that a good idea? // This could support more, but is that a good idea?
// Keep in mind that it may encourage people making overly long cups just because they "can", and would be a waste of memory. // Keep in mind that it may encourage people making overly long cups just because they "can", and would be a waste of memory.
@ -347,7 +347,7 @@ typedef struct
#define CUPCACHE_SPECIAL (CUPCACHE_BONUS+MAXBONUSLIST) #define CUPCACHE_SPECIAL (CUPCACHE_BONUS+MAXBONUSLIST)
#define CUPCACHE_MAX (CUPCACHE_SPECIAL+1) #define CUPCACHE_MAX (CUPCACHE_SPECIAL+1)
typedef struct cupheader_s struct cupheader_t
{ {
UINT16 id; ///< Cup ID UINT16 id; ///< Cup ID
char name[15]; ///< Cup title (14 chars) char name[15]; ///< Cup title (14 chars)
@ -358,8 +358,8 @@ typedef struct cupheader_s
UINT8 numbonus; ///< Number of bonus stages defined UINT8 numbonus; ///< Number of bonus stages defined
UINT8 emeraldnum; ///< ID of Emerald to use for special stage (1-7 for Chaos Emeralds, 8-14 for Super Emeralds, 0 for no emerald) UINT8 emeraldnum; ///< ID of Emerald to use for special stage (1-7 for Chaos Emeralds, 8-14 for Super Emeralds, 0 for no emerald)
SINT8 unlockrequired; ///< An unlockable is required to select this cup. -1 for no unlocking required. SINT8 unlockrequired; ///< An unlockable is required to select this cup. -1 for no unlocking required.
struct cupheader_s *next; ///< Next cup in linked list cupheader_t *next; ///< Next cup in linked list
} cupheader_t; };
extern cupheader_t *kartcupheaders; // Start of cup linked list extern cupheader_t *kartcupheaders; // Start of cup linked list
extern UINT16 numkartcupheaders; extern UINT16 numkartcupheaders;
@ -368,7 +368,7 @@ extern UINT16 numkartcupheaders;
/** Map header information. /** Map header information.
*/ */
typedef struct struct mapheader_t
{ {
// Core game information, not user-modifiable directly // Core game information, not user-modifiable directly
char *lumpname; ///< Lump name can be really long char *lumpname; ///< Lump name can be really long
@ -441,7 +441,7 @@ typedef struct
// Lua information // Lua information
UINT8 numCustomOptions; ///< Internal. For Lua custom value support. UINT8 numCustomOptions; ///< Internal. For Lua custom value support.
customoption_t *customopts; ///< Custom options. Allocated dynamically for space reasons. Be careful. customoption_t *customopts; ///< Custom options. Allocated dynamically for space reasons. Be careful.
} mapheader_t; };
// level flags // level flags
#define LF_SCRIPTISFILE (1<<0) ///< True if the script is a file, not a lump. #define LF_SCRIPTISFILE (1<<0) ///< True if the script is a file, not a lump.
@ -530,11 +530,11 @@ enum TypeOfLevel
#define NUMBASETOLNAMES (4) #define NUMBASETOLNAMES (4)
#define NUMTOLNAMES (NUMBASETOLNAMES + NUMGAMETYPEFREESLOTS) #define NUMTOLNAMES (NUMBASETOLNAMES + NUMGAMETYPEFREESLOTS)
typedef struct struct tolinfo_t
{ {
const char *name; const char *name;
UINT32 flag; UINT32 flag;
} tolinfo_t; };
extern tolinfo_t TYPEOFLEVEL[NUMTOLNAMES]; extern tolinfo_t TYPEOFLEVEL[NUMTOLNAMES];
extern UINT32 lastcustomtol; extern UINT32 lastcustomtol;

View file

@ -406,4 +406,6 @@ typedef UINT64 precise_t;
#define FUNCPTRCAST(p) ((union{void(*f)(void);void*v;})\ #define FUNCPTRCAST(p) ((union{void(*f)(void);void*v;})\
{(void(*)(void))p}).v {(void(*)(void))p}).v
#include "typedef.h"
#endif //__DOOMTYPE__ #endif //__DOOMTYPE__

View file

@ -15,9 +15,7 @@
#define MAX_FONTS 32 #define MAX_FONTS 32
typedef struct font font_t; struct font_t
struct font
{ {
patch_t **font; patch_t **font;

View file

@ -28,12 +28,12 @@ extern consvar_t cv_recordmultiplayerdemos, cv_netdemosyncquality;
extern tic_t demostarttime; extern tic_t demostarttime;
typedef struct democharlist_s { struct democharlist_t {
UINT8 mapping; // No, this isn't about levels. It maps to loaded character ID. UINT8 mapping; // No, this isn't about levels. It maps to loaded character ID.
UINT8 kartspeed; UINT8 kartspeed;
UINT8 kartweight; UINT8 kartweight;
UINT32 flags; UINT32 flags;
} democharlist_t; };
// Publicly-accessible demo vars // Publicly-accessible demo vars
struct demovars_s { struct demovars_s {
@ -76,7 +76,7 @@ typedef enum {
MD_INVALID MD_INVALID
} menudemotype_e; } menudemotype_e;
typedef struct menudemo_s { struct menudemo_t {
char filepath[256]; char filepath[256];
menudemotype_e type; menudemotype_e type;
@ -93,7 +93,7 @@ typedef struct menudemo_s {
UINT8 skin, color; UINT8 skin, color;
UINT32 timeorscore; UINT32 timeorscore;
} standings[MAXPLAYERS]; } standings[MAXPLAYERS];
} menudemo_t; };
extern mobj_t *metalplayback; extern mobj_t *metalplayback;
@ -160,7 +160,7 @@ void G_LoadMetal(UINT8 **buffer);
// Your naming conventions are stupid and useless. // Your naming conventions are stupid and useless.
// There is no conflict here. // There is no conflict here.
typedef struct demoghost { struct demoghost {
UINT8 checksum[16]; UINT8 checksum[16];
UINT8 *buffer, *p, color; UINT8 *buffer, *p, color;
UINT8 fadein; UINT8 fadein;
@ -169,7 +169,7 @@ typedef struct demoghost {
democharlist_t *skinlist; democharlist_t *skinlist;
mobj_t oldmo, *mo; mobj_t oldmo, *mo;
struct demoghost *next; struct demoghost *next;
} demoghost; };
extern demoghost *ghosts; extern demoghost *ghosts;
// G_CheckDemoExtraFiles: checks if our loaded WAD list matches the demo's. // G_CheckDemoExtraFiles: checks if our loaded WAD list matches the demo's.

View file

@ -2824,6 +2824,11 @@ mapthing_t *G_FindMapStart(INT32 playernum)
spawnpoint = G_FindRaceStartOrFallback(playernum); spawnpoint = G_FindRaceStartOrFallback(playernum);
} }
// -- Grand Prix / Time Attack --
// Order: Race->DM->CTF
else if (grandprixinfo.gp || modeattacking)
spawnpoint = G_FindRaceStartOrFallback(playernum);
// -- CTF -- // -- CTF --
// Order: CTF->DM->Race // Order: CTF->DM->Race
else if ((gametyperules & GTR_TEAMSTARTS) && players[playernum].ctfteam) else if ((gametyperules & GTR_TEAMSTARTS) && players[playernum].ctfteam)

View file

@ -135,7 +135,7 @@ struct searchdim
UINT8 siz; UINT8 siz;
}; };
typedef struct struct mapsearchfreq_t
{ {
INT16 mapnum; INT16 mapnum;
UINT8 matchc; UINT8 matchc;
@ -143,8 +143,7 @@ typedef struct
UINT8 keywhc; UINT8 keywhc;
struct searchdim *keywhd;/* ...in KEYWORD */ struct searchdim *keywhd;/* ...in KEYWORD */
UINT8 total;/* total hits */ UINT8 total;/* total hits */
} };
mapsearchfreq_t;
INT32 G_FindMap(const char *query, char **foundmapnamep, INT32 G_FindMap(const char *query, char **foundmapnamep,
mapsearchfreq_t **freqp, INT32 *freqc); mapsearchfreq_t **freqp, INT32 *freqc);

View file

@ -145,6 +145,11 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
// 0--1 // 0--1
float dupx, dupy, fscalew, fscaleh, fwidth, fheight; float dupx, dupy, fscalew, fscaleh, fwidth, fheight;
const cliprect_t *clip = V_GetClipRect();
float s_min, s_max;
float t_min, t_max;
// make patch ready in hardware cache // make patch ready in hardware cache
if (!colormap) if (!colormap)
HWR_GetPatch(gpatch); HWR_GetPatch(gpatch);
@ -207,7 +212,7 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
INT32 intx, inty; INT32 intx, inty;
intx = (INT32)cx; intx = (INT32)cx;
inty = (INT32)cy; inty = (INT32)cy;
K_AdjustXYWithSnap(&intx, &inty, option, dupx, dupy); V_AdjustXYWithSnap(&intx, &inty, option, dupx, dupy);
cx = (float)intx; cx = (float)intx;
cy = (float)inty; cy = (float)inty;
} }
@ -224,6 +229,41 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
fheight = (float)(gpatch->height) * dupy; fheight = (float)(gpatch->height) * dupy;
} }
s_min = t_min = 0.0f;
s_max = hwrPatch->max_s;
t_max = hwrPatch->max_t;
if (clip)
{
if (cx < clip->left)
{
s_min = ((clip->left - cx) / fwidth) * s_max;
cx = clip->left;
}
if (cy < clip->top)
{
t_min = ((clip->top - cy) / fheight) * t_max;
cy = clip->top;
}
if ((cx + fwidth) > clip->right)
{
const float n = (clip->right - clip->left);
s_max = (s_min + ((n / fwidth) * s_max));
fwidth = n;
}
if ((cy + fheight) > clip->bottom)
{
const float n = (clip->bottom - clip->top);
t_max = (t_min + ((n / fheight) * t_max));
fheight = n;
}
}
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1 // positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
cx = -1 + (cx / (vid.width/2)); cx = -1 + (cx / (vid.width/2));
cy = 1 - (cy / (vid.height/2)); cy = 1 - (cy / (vid.height/2));
@ -243,24 +283,24 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
if (option & V_FLIP) if (option & V_FLIP)
{ {
v[0].s = v[3].s = hwrPatch->max_s; v[0].s = v[3].s = s_max;
v[2].s = v[1].s = 0.0f; v[2].s = v[1].s = s_min;
} }
else else
{ {
v[0].s = v[3].s = 0.0f; v[0].s = v[3].s = s_min;
v[2].s = v[1].s = hwrPatch->max_s; v[2].s = v[1].s = s_max;
} }
if (option & V_VFLIP) if (option & V_VFLIP)
{ {
v[0].t = v[1].t = hwrPatch->max_t; v[0].t = v[1].t = t_max;
v[2].t = v[3].t = 0.0f; v[2].t = v[3].t = t_min;
} }
else else
{ {
v[0].t = v[1].t = 0.0f; v[0].t = v[1].t = t_min;
v[2].t = v[3].t = hwrPatch->max_t; v[2].t = v[3].t = t_max;
} }
flags = PF_NoDepthTest; flags = PF_NoDepthTest;
@ -1011,7 +1051,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32
intx = (INT32)fx; intx = (INT32)fx;
inty = (INT32)fy; inty = (INT32)fy;
K_AdjustXYWithSnap(&intx, &inty, color, dupx, dupy); V_AdjustXYWithSnap(&intx, &inty, color, dupx, dupy);
fx = (float)intx; fx = (float)intx;
fy = (float)inty; fy = (float)inty;
} }
@ -1102,7 +1142,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
intx = (INT32)fx; intx = (INT32)fx;
inty = (INT32)fy; inty = (INT32)fy;
K_AdjustXYWithSnap(&intx, &inty, color, dupx, dupy); V_AdjustXYWithSnap(&intx, &inty, color, dupx, dupy);
fx = (float)intx; fx = (float)intx;
fy = (float)inty; fy = (float)inty;
} }

View file

@ -81,12 +81,12 @@ extern char english_shiftxform[];
// sorted player lines // sorted player lines
//------------------------------------ //------------------------------------
typedef struct struct playersort_t
{ {
UINT32 count; UINT32 count;
INT32 num; INT32 num;
const char *name; const char *name;
} playersort_t; };
//------------------------------------ //------------------------------------
// chat stuff // chat stuff

View file

@ -38,7 +38,7 @@
actually, we need to know if it is a gamepad or analog controls actually, we need to know if it is a gamepad or analog controls
*/ */
struct JoyType_s struct JoyType_t
{ {
/*! if true, we MUST Poll() to get new joystick data, /*! if true, we MUST Poll() to get new joystick data,
that is: we NEED the DIRECTINPUTDEVICE2 ! (watchout NT compatibility) */ that is: we NEED the DIRECTINPUTDEVICE2 ! (watchout NT compatibility) */
@ -48,7 +48,6 @@ struct JoyType_s
INT32 bGamepadStyle; INT32 bGamepadStyle;
}; };
typedef struct JoyType_s JoyType_t;
/** \brief Joystick info /** \brief Joystick info
for palyer[sic] 1-4's joystick/gamepad for palyer[sic] 1-4's joystick/gamepad
*/ */

View file

@ -40,7 +40,7 @@ extern INT32 net_bandwidth; // in byte/s
#pragma pack(1) #pragma pack(1)
#endif #endif
typedef struct struct doomcom_t
{ {
/// Supposed to be DOOMCOM_ID /// Supposed to be DOOMCOM_ID
INT32 id; INT32 id;
@ -77,14 +77,14 @@ typedef struct
/// The packet data to be sent. /// The packet data to be sent.
char data[MAXPACKETLENGTH]; char data[MAXPACKETLENGTH];
} ATTRPACK doomcom_t; } ATTRPACK;
typedef struct struct holepunch_t
{ {
INT32 magic; INT32 magic;
INT32 addr; INT32 addr;
INT16 port; INT16 port;
} ATTRPACK holepunch_t; } ATTRPACK;
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma pack() #pragma pack()
@ -172,11 +172,11 @@ extern boolean (*I_SetBanUsername) (const char *username);
extern boolean (*I_SetBanReason) (const char *reason); extern boolean (*I_SetBanReason) (const char *reason);
extern boolean (*I_SetUnbanTime) (time_t timestamp); extern boolean (*I_SetUnbanTime) (time_t timestamp);
typedef struct struct bannednode_t
{ {
size_t banid; size_t banid;
time_t timeleft; time_t timeleft;
} bannednode_t; };
extern bannednode_t *bannednode; extern bannednode_t *bannednode;
/// \brief Called by D_SRB2Main to be defined by extern network driver /// \brief Called by D_SRB2Main to be defined by extern network driver

View file

@ -128,7 +128,7 @@ typedef enum
NumberofForces, NumberofForces,
} FFType; } FFType;
typedef struct JoyFF_s struct JoyFF_t
{ {
INT32 ForceX; ///< The X of the Force's Vel INT32 ForceX; ///< The X of the Force's Vel
INT32 ForceY; ///< The Y of the Force's Vel INT32 ForceY; ///< The Y of the Force's Vel
@ -144,7 +144,7 @@ typedef struct JoyFF_s
INT32 Offset; ///< Offset of the effect. INT32 Offset; ///< Offset of the effect.
UINT32 Phase; ///< Position in the cycle of the periodic effect at which playback begins, in the range from 0 through 35,999 UINT32 Phase; ///< Position in the cycle of the periodic effect at which playback begins, in the range from 0 through 35,999
UINT32 Period; ///< Period of the effect, in microseconds. UINT32 Period; ///< Period of the effect, in microseconds.
} JoyFF_t; };
/** \brief Forcefeedback for the first joystick /** \brief Forcefeedback for the first joystick
@ -298,7 +298,7 @@ char *I_GetUserName(void);
*/ */
INT32 I_mkdir(const char *dirname, INT32 unixright); INT32 I_mkdir(const char *dirname, INT32 unixright);
typedef struct { struct CPUInfoFlags {
int FPU : 1; ///< FPU availabile int FPU : 1; ///< FPU availabile
int CPUID : 1; ///< CPUID instruction int CPUID : 1; ///< CPUID instruction
int RDTSC : 1; ///< RDTSC instruction int RDTSC : 1; ///< RDTSC instruction
@ -324,7 +324,7 @@ typedef struct {
int ALPHAbyte : 1; ///< ? int ALPHAbyte : 1; ///< ?
int PAE : 1; ///< Physical Address Extension int PAE : 1; ///< Physical Address Extension
int CPUs : 8; int CPUs : 8;
} CPUInfoFlags; };
/** \brief Info about CPU /** \brief Info about CPU

View file

@ -22,10 +22,10 @@
extern "C" { extern "C" {
#endif #endif
typedef struct timestate_s { struct timestate_t {
tic_t time; tic_t time;
fixed_t timefrac; fixed_t timefrac;
} timestate_t; };
extern timestate_t g_time; extern timestate_t g_time;
extern consvar_t cv_timescale; extern consvar_t cv_timescale;

View file

@ -495,6 +495,7 @@ char sprnames[NUMSPRITES + 1][5] =
"BOM3", // Boss Explosion 2 "BOM3", // Boss Explosion 2
"BOM4", // Underwater Explosion "BOM4", // Underwater Explosion
"BMNB", // Mine Explosion "BMNB", // Mine Explosion
"LSSJ", // My ki is overflowing!!
// Crumbly rocks // Crumbly rocks
"ROIA", "ROIA",
@ -543,6 +544,7 @@ char sprnames[NUMSPRITES + 1][5] =
"KINF", // Invincibility flash "KINF", // Invincibility flash
"INVI", // Invincibility speedlines "INVI", // Invincibility speedlines
"ICAP", // Item capsules "ICAP", // Item capsules
"IMON", // Item Monitor
"MGBX", // Heavy Magician transform box "MGBX", // Heavy Magician transform box
"MGBT", // Heavy Magician transform box top "MGBT", // Heavy Magician transform box top
"MGBB", // Heavy Magician transform box bottom "MGBB", // Heavy Magician transform box bottom
@ -5140,6 +5142,10 @@ state_t states[NUMSTATES] =
{SPR_JANK, FF_PAPERSPRITE|FF_FULLBRIGHT|FF_ANIMATE, 4, {NULL}, 3, 1, S_JANKSPARK3}, // S_JANKSPARK2 {SPR_JANK, FF_PAPERSPRITE|FF_FULLBRIGHT|FF_ANIMATE, 4, {NULL}, 3, 1, S_JANKSPARK3}, // S_JANKSPARK2
{SPR_JANK, 0, 0, {A_SetCustomValue}, -1, 5, S_JANKSPARK4}, // S_JANKSPARK3 {SPR_JANK, 0, 0, {A_SetCustomValue}, -1, 5, S_JANKSPARK4}, // S_JANKSPARK3
{SPR_JANK, 0, 0, {A_ChangeAngleRelative}, 180, 180, S_JANKSPARK2}, // S_JANKSPARK4 {SPR_JANK, 0, 0, {A_ChangeAngleRelative}, 180, 180, S_JANKSPARK2}, // S_JANKSPARK4
// Broly Ki Orb
{SPR_LSSJ, FF_REVERSESUBTRACT|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_BROLY2}, // S_BROLY1
{SPR_NULL, 0, 5*TICRATE, {A_SSMineFlash}, 0, 0, S_NULL}, // S_BROLY2
}; };
mobjinfo_t mobjinfo[NUMMOBJTYPES] = mobjinfo_t mobjinfo[NUMMOBJTYPES] =
@ -23341,7 +23347,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // deathsound sfx_None, // deathsound
0, // speed 0, // speed
16*FRACUNIT, // radius 16*FRACUNIT, // radius
24*FRACUNIT, // height 56*FRACUNIT, // height
0, // display offset 0, // display offset
100, // mass 100, // mass
1, // damage 1, // damage
@ -28673,7 +28679,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
{ // MT_BATTLECAPSULE { // MT_BATTLECAPSULE
2333, // doomednum 2333, // doomednum
S_INVISIBLE, // spawnstate S_SHADOW, // spawnstate
1, // spawnhealth 1, // spawnhealth
S_NULL, // seestate S_NULL, // seestate
sfx_None, // seesound sfx_None, // seesound
@ -28688,8 +28694,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL, // xdeathstate S_NULL, // xdeathstate
sfx_None, // deathsound sfx_None, // deathsound
0, // speed 0, // speed
28<<FRACBITS, // radius 64<<FRACBITS, // radius
112<<FRACBITS, // height 144<<FRACBITS, // height
0, // display offset 0, // display offset
100, // mass 100, // mass
0, // damage 0, // damage

View file

@ -549,6 +549,7 @@ void A_ItemPop();
void A_JawzExplode(); void A_JawzExplode();
void A_SSMineSearch(); void A_SSMineSearch();
void A_SSMineExplode(); void A_SSMineExplode();
void A_SSMineFlash();
void A_LandMineExplode(); void A_LandMineExplode();
void A_LandMineExplode(); void A_LandMineExplode();
void A_BallhogExplode(); void A_BallhogExplode();
@ -1041,6 +1042,7 @@ typedef enum sprite
SPR_BOM3, // Boss Explosion 2 SPR_BOM3, // Boss Explosion 2
SPR_BOM4, // Underwater Explosion SPR_BOM4, // Underwater Explosion
SPR_BMNB, // Mine Explosion SPR_BMNB, // Mine Explosion
SPR_LSSJ, // My ki is overflowing!!
// Crumbly rocks // Crumbly rocks
SPR_ROIA, SPR_ROIA,
@ -1089,6 +1091,7 @@ typedef enum sprite
SPR_KINF, // Invincibility flash SPR_KINF, // Invincibility flash
SPR_INVI, // Invincibility speedlines SPR_INVI, // Invincibility speedlines
SPR_ICAP, // Item capsules SPR_ICAP, // Item capsules
SPR_IMON, // Item Monitor
SPR_MGBX, // Heavy Magician transform box SPR_MGBX, // Heavy Magician transform box
SPR_MGBT, // Heavy Magician transform box top SPR_MGBT, // Heavy Magician transform box top
SPR_MGBB, // Heavy Magician transform box bottom SPR_MGBB, // Heavy Magician transform box bottom
@ -5562,12 +5565,16 @@ typedef enum state
S_JANKSPARK3, S_JANKSPARK3,
S_JANKSPARK4, S_JANKSPARK4,
// Broly Ki Orb
S_BROLY1,
S_BROLY2,
S_FIRSTFREESLOT, S_FIRSTFREESLOT,
S_LASTFREESLOT = S_FIRSTFREESLOT + NUMSTATEFREESLOTS - 1, S_LASTFREESLOT = S_FIRSTFREESLOT + NUMSTATEFREESLOTS - 1,
NUMSTATES NUMSTATES
} statenum_t; } statenum_t;
typedef struct struct state_t
{ {
spritenum_t sprite; spritenum_t sprite;
UINT32 frame; // we use the upper 16 bits for translucency and other shade effects UINT32 frame; // we use the upper 16 bits for translucency and other shade effects
@ -5576,7 +5583,7 @@ typedef struct
INT32 var1; INT32 var1;
INT32 var2; INT32 var2;
statenum_t nextstate; statenum_t nextstate;
} state_t; };
extern state_t states[NUMSTATES]; extern state_t states[NUMSTATES];
extern char sprnames[NUMSPRITES + 1][5]; extern char sprnames[NUMSPRITES + 1][5];
@ -6682,7 +6689,7 @@ typedef enum mobj_type
NUMMOBJTYPES NUMMOBJTYPES
} mobjtype_t; } mobjtype_t;
typedef struct struct mobjinfo_t
{ {
INT32 doomednum; INT32 doomednum;
statenum_t spawnstate; statenum_t spawnstate;
@ -6708,7 +6715,7 @@ typedef struct
sfxenum_t activesound; sfxenum_t activesound;
UINT32 flags; UINT32 flags;
statenum_t raisestate; statenum_t raisestate;
} mobjinfo_t; };
extern mobjinfo_t mobjinfo[NUMMOBJTYPES]; extern mobjinfo_t mobjinfo[NUMMOBJTYPES];

View file

@ -17,21 +17,21 @@
typedef void(*updateindexfunc)(void *const, const size_t); typedef void(*updateindexfunc)(void *const, const size_t);
typedef struct bheapitem_s struct bheapitem_t
{ {
size_t heapindex; // The index in the heap this item is size_t heapindex; // The index in the heap this item is
updateindexfunc indexchanged; // A callback function that is called when this item changes index to alert data updateindexfunc indexchanged; // A callback function that is called when this item changes index to alert data
struct bheap_s *owner; // The heap that owns this item bheap_t *owner; // The heap that owns this item
void *data; // data for this heap item void *data; // data for this heap item
UINT32 value; // The value of this item, the lowest value item is first in the array UINT32 value; // The value of this item, the lowest value item is first in the array
} bheapitem_t; };
typedef struct bheap_s struct bheap_t
{ {
size_t capacity; // capacity of the heap size_t capacity; // capacity of the heap
size_t count; // number of items in the heap size_t count; // number of items in the heap
bheapitem_t *array; // pointer to the heap items array bheapitem_t *array; // pointer to the heap items array
} bheap_t; };
/*-------------------------------------------------- /*--------------------------------------------------

View file

@ -26,14 +26,14 @@ typedef enum
#define NUMWEAKSPOTS 8 #define NUMWEAKSPOTS 8
#define WEAKSPOTANIMTIME (3*TICRATE) #define WEAKSPOTANIMTIME (3*TICRATE)
typedef struct weakspot_t struct weakspot_t
{ {
mobj_t *spot; mobj_t *spot;
spottype_t type; spottype_t type;
tic_t time; tic_t time;
UINT16 color; UINT16 color;
boolean minimap; boolean minimap;
} weakspot_t; };
#define BOSSHEALTHBARLEN 110 #define BOSSHEALTHBARLEN 110

View file

@ -710,7 +710,7 @@ static botprediction_t *K_CreateBotPrediction(player_t *player)
if (P_TraceBotTraversal(player->mo, wp->mobj) == false) if (P_TraceBotTraversal(player->mo, wp->mobj) == false)
{ {
// If we can't get a direct path to this waypoint, predict less. // If we can't get a direct path to this waypoint, predict less.
distanceleft -= disttonext; distanceleft /= 2;
radreduce = FRACUNIT >> 1; radreduce = FRACUNIT >> 1;
} }
@ -745,6 +745,25 @@ static botprediction_t *K_CreateBotPrediction(player_t *player)
predict->y += P_ReturnThrustY(NULL, angletonext, min(disttonext, distanceleft) * FRACUNIT); predict->y += P_ReturnThrustY(NULL, angletonext, min(disttonext, distanceleft) * FRACUNIT);
} }
if (player->mo->standingslope != NULL)
{
const pslope_t *slope = player->mo->standingslope;
if (!(slope->flags & SL_NOPHYSICS) && abs(slope->zdelta) >= FRACUNIT/21)
{
// Displace the prediction to go against the slope physics.
angle_t angle = slope->xydirection;
if (P_MobjFlip(player->mo) * slope->zdelta < 0)
{
angle ^= ANGLE_180;
}
predict->x -= P_ReturnThrustX(NULL, angle, startDist * abs(slope->zdelta));
predict->y -= P_ReturnThrustY(NULL, angle, startDist * abs(slope->zdelta));
}
}
ps_bots[player - players].prediction += I_GetPreciseTime() - time; ps_bots[player - players].prediction += I_GetPreciseTime() - time;
return predict; return predict;
} }
@ -875,7 +894,7 @@ static void K_DrawPredictionDebug(botprediction_t *predict, player_t *player)
debugMobj->frame |= FF_TRANS20|FF_FULLBRIGHT; debugMobj->frame |= FF_TRANS20|FF_FULLBRIGHT;
debugMobj->color = SKINCOLOR_ORANGE; debugMobj->color = SKINCOLOR_ORANGE;
debugMobj->scale *= 2; P_SetScale(debugMobj, debugMobj->destscale * 2);
debugMobj->tics = 2; debugMobj->tics = 2;
@ -902,7 +921,7 @@ static void K_DrawPredictionDebug(botprediction_t *predict, player_t *player)
radiusMobj->frame |= FF_TRANS20|FF_FULLBRIGHT; radiusMobj->frame |= FF_TRANS20|FF_FULLBRIGHT;
radiusMobj->color = SKINCOLOR_YELLOW; radiusMobj->color = SKINCOLOR_YELLOW;
radiusMobj->scale /= 2; P_SetScale(debugMobj, debugMobj->destscale / 2);
radiusMobj->tics = 2; radiusMobj->tics = 2;
} }
@ -1452,7 +1471,7 @@ void K_BuildBotTiccmd(player_t *player, ticcmd_t *cmd)
} }
} }
if (spindash == 0) if (spindash == 0 && player->exiting == 0)
{ {
// Don't pointlessly try to use rings/sneakers while charging a spindash. // Don't pointlessly try to use rings/sneakers while charging a spindash.
// TODO: Allowing projectile items like orbinaut while e-braking would be nice, maybe just pass in the spindash variable? // TODO: Allowing projectile items like orbinaut while e-braking would be nice, maybe just pass in the spindash variable?

View file

@ -31,10 +31,10 @@
#define BOTSPINDASHCONFIRM (2*TICRATE) #define BOTSPINDASHCONFIRM (2*TICRATE)
// Point for bots to aim for // Point for bots to aim for
typedef struct botprediction_s { struct botprediction_t {
fixed_t x, y; fixed_t x, y;
fixed_t radius; fixed_t radius;
} botprediction_t; };
// AVAILABLE FOR LUA // AVAILABLE FOR LUA

View file

@ -486,6 +486,12 @@ static void K_BotItemGenericOrbitShield(player_t *player, ticcmd_t *cmd)
--------------------------------------------------*/ --------------------------------------------------*/
static void K_BotItemSneaker(player_t *player, ticcmd_t *cmd) static void K_BotItemSneaker(player_t *player, ticcmd_t *cmd)
{ {
if (P_IsObjectOnGround(player->mo) == false)
{
// Don't use while mid-air.
return;
}
if ((player->offroad && K_ApplyOffroad(player)) // Stuck in offroad, use it NOW if ((player->offroad && K_ApplyOffroad(player)) // Stuck in offroad, use it NOW
|| K_GetWaypointIsShortcut(player->nextwaypoint) == true // Going toward a shortcut! || K_GetWaypointIsShortcut(player->nextwaypoint) == true // Going toward a shortcut!
|| player->speed < K_GetKartSpeed(player, false, true) / 2 // Being slowed down too much || player->speed < K_GetKartSpeed(player, false, true) / 2 // Being slowed down too much
@ -518,6 +524,12 @@ static void K_BotItemSneaker(player_t *player, ticcmd_t *cmd)
--------------------------------------------------*/ --------------------------------------------------*/
static void K_BotItemRocketSneaker(player_t *player, ticcmd_t *cmd) static void K_BotItemRocketSneaker(player_t *player, ticcmd_t *cmd)
{ {
if (P_IsObjectOnGround(player->mo) == false)
{
// Don't use while mid-air.
return;
}
if (player->botvars.itemconfirm > TICRATE) if (player->botvars.itemconfirm > TICRATE)
{ {
if (player->sneakertimer == 0 && K_ItemButtonWasDown(player) == false) if (player->sneakertimer == 0 && K_ItemButtonWasDown(player) == false)
@ -892,9 +904,9 @@ static void K_BotItemOrbinaut(player_t *player, ticcmd_t *cmd)
} }
/*-------------------------------------------------- /*--------------------------------------------------
static void K_BotItemDropTarget(player_t *player, ticcmd_t *cmd) static void K_BotItemBallhog(player_t *player, ticcmd_t *cmd)
Item usage for Drop Target throwing. Item usage for Ballhog throwing.
Input Arguments:- Input Arguments:-
player - Bot to do this for. player - Bot to do this for.
@ -903,14 +915,15 @@ static void K_BotItemOrbinaut(player_t *player, ticcmd_t *cmd)
Return:- Return:-
None None
--------------------------------------------------*/ --------------------------------------------------*/
static void K_BotItemDropTarget(player_t *player, ticcmd_t *cmd) static void K_BotItemBallhog(player_t *player, ticcmd_t *cmd)
{ {
const fixed_t topspeed = K_GetKartSpeed(player, false, true); const fixed_t topspeed = K_GetKartSpeed(player, false, true);
fixed_t radius = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed)); fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
SINT8 throwdir = -1; SINT8 throwdir = -1;
boolean tryLookback = false; boolean tryLookback = false;
UINT8 snipeMul = 2; UINT8 snipeMul = 2;
player_t *target = NULL; player_t *target = NULL;
boolean hold = false;
if (player->speed > topspeed) if (player->speed > topspeed)
{ {
@ -918,8 +931,6 @@ static void K_BotItemDropTarget(player_t *player, ticcmd_t *cmd)
snipeMul = 3; // Confirm faster when you'll throw it with a bunch of extra speed!! snipeMul = 3; // Confirm faster when you'll throw it with a bunch of extra speed!!
} }
player->botvars.itemconfirm++;
target = K_PlayerInCone(player, radius, 15, false); target = K_PlayerInCone(player, radius, 15, false);
if (target != NULL) if (target != NULL)
{ {
@ -943,7 +954,89 @@ static void K_BotItemDropTarget(player_t *player, ticcmd_t *cmd)
cmd->buttons |= BT_LOOKBACK; cmd->buttons |= BT_LOOKBACK;
} }
if (player->botvars.itemconfirm > 25*TICRATE) if (target != NULL)
{
// Charge up!
hold = true;
}
else
{
// If we lose sight of the target, then we'll just
// let go and it'll do a partial-blast.
// If we've been waiting for too long though, then
// we'll go for the full charge :)
player->botvars.itemconfirm++;
hold = (player->botvars.itemconfirm > 10*TICRATE);
}
if (hold == true)
{
cmd->throwdir = KART_FULLTURN * throwdir;
cmd->buttons |= BT_ATTACK;
}
}
/*--------------------------------------------------
static void K_BotItemDropTarget(player_t *player, ticcmd_t *cmd, INT16 turnamt)
Item usage for Drop Target throwing.
Input Arguments:-
player - Bot to do this for.
cmd - Bot's ticcmd to edit.
turnamt - How hard they currently are turning.
Return:-
None
--------------------------------------------------*/
static void K_BotItemDropTarget(player_t *player, ticcmd_t *cmd, INT16 turnamt)
{
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
fixed_t radius = FixedMul(1280 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
SINT8 throwdir = -1;
boolean tryLookback = false;
UINT8 snipeMul = 2;
player_t *target = NULL;
if (player->speed > topspeed)
{
radius = FixedMul(radius, FixedDiv(player->speed, topspeed));
snipeMul = 3; // Confirm faster when you'll throw it with a bunch of extra speed!!
}
player->botvars.itemconfirm++;
if (abs(turnamt) >= KART_FULLTURN/2)
{
player->botvars.itemconfirm += player->botvars.difficulty / 2;
throwdir = -1;
}
target = K_PlayerInCone(player, radius, 15, false);
if (target != NULL)
{
K_ItemConfirmForTarget(player, target, player->botvars.difficulty * snipeMul);
throwdir = 1;
}
else
{
target = K_PlayerInCone(player, radius, 15, true);
if (target != NULL)
{
K_ItemConfirmForTarget(player, target, player->botvars.difficulty);
throwdir = -1;
tryLookback = true;
}
}
if (tryLookback == true && throwdir == -1)
{
cmd->buttons |= BT_LOOKBACK;
}
if (player->botvars.itemconfirm > 10*TICRATE || player->bananadrag >= TICRATE)
{ {
K_BotGenericPressItem(player, cmd, throwdir); K_BotGenericPressItem(player, cmd, throwdir);
} }
@ -1166,6 +1259,92 @@ static void K_BotItemFlame(player_t *player, ticcmd_t *cmd)
} }
} }
/*--------------------------------------------------
static void K_BotItemGardenTopDeploy(player_t *player, ticcmd_t *cmd)
Item usage for deploying the Garden Top.
Input Arguments:-
player - Bot to do this for.
cmd - Bot's ticcmd to edit.
Return:-
None
--------------------------------------------------*/
static void K_BotItemGardenTopDeploy(player_t *player, ticcmd_t *cmd)
{
//if (player->curshield != KSHIELD_TOP)
if (player->botvars.itemconfirm++ > 2*TICRATE)
{
K_BotGenericPressItem(player, cmd, 0);
}
}
/*--------------------------------------------------
static void K_BotItemGardenTop(player_t *player, ticcmd_t *cmd, INT16 turnamt)
Item usage for Garden Top movement.
Input Arguments:-
player - Bot to do this for.
cmd - Bot's ticcmd to edit.
turnamt - How hard they currently are turning.
Return:-
None
--------------------------------------------------*/
static void K_BotItemGardenTop(player_t *player, ticcmd_t *cmd, INT16 turnamt)
{
const fixed_t topspeed = K_GetKartSpeed(player, false, true);
fixed_t radius = FixedMul(2560 * mapobjectscale, K_GetKartGameSpeedScalar(gamespeed));
SINT8 throwdir = -1;
UINT8 snipeMul = 1;
player_t *target = NULL;
if (player->speed > topspeed)
{
radius = FixedMul(radius, FixedDiv(player->speed, topspeed));
snipeMul = 2; // Confirm faster when you'll throw it with a bunch of extra speed!!
}
player->botvars.itemconfirm++;
target = K_PlayerInCone(player, radius, 15, false);
if (target != NULL)
{
K_ItemConfirmForTarget(player, target, player->botvars.difficulty * snipeMul);
throwdir = 1;
}
if (player->topdriftheld > 0)
{
// Grinding in place.
// Wait until we're mostly done turning.
// Cancel early if we hit max thrust speed.
if ((abs(turnamt) >= KART_FULLTURN/8)
&& (player->topdriftheld <= GARDENTOP_MAXGRINDTIME))
{
cmd->buttons |= BT_DRIFT;
}
}
else
{
const angle_t maxDelta = ANGLE_11hh;
angle_t delta = AngleDelta(player->mo->angle, K_MomentumAngle(player->mo));
if (delta > maxDelta)
{
// Do we need to turn? Start grinding!
cmd->buttons |= BT_DRIFT;
}
}
if (player->botvars.itemconfirm > 25*TICRATE)
{
K_BotGenericPressItem(player, cmd, throwdir);
}
}
/*-------------------------------------------------- /*--------------------------------------------------
static void K_BotItemRings(player_t *player, ticcmd_t *cmd) static void K_BotItemRings(player_t *player, ticcmd_t *cmd)
@ -1182,6 +1361,12 @@ static void K_BotItemRings(player_t *player, ticcmd_t *cmd)
{ {
INT32 saferingsval = 16 - K_GetKartRingPower(player, false); INT32 saferingsval = 16 - K_GetKartRingPower(player, false);
if (P_IsObjectOnGround(player->mo) == false)
{
// Don't use while mid-air.
return;
}
if (player->speed < K_GetKartSpeed(player, false, true) / 2 // Being slowed down too much if (player->speed < K_GetKartSpeed(player, false, true) / 2 // Being slowed down too much
|| player->speedboost > (FRACUNIT/5)) // Have another type of boost (tethering) || player->speedboost > (FRACUNIT/5)) // Have another type of boost (tethering)
{ {
@ -1242,7 +1427,7 @@ void K_BotItemUsage(player_t *player, ticcmd_t *cmd, INT16 turnamt)
{ {
// Use rings! // Use rings!
if (leveltime > starttime && !player->exiting) if (leveltime > starttime)
{ {
K_BotItemRings(player, cmd); K_BotItemRings(player, cmd);
} }
@ -1293,7 +1478,6 @@ void K_BotItemUsage(player_t *player, ticcmd_t *cmd, INT16 turnamt)
case KITEM_SPB: case KITEM_SPB:
case KITEM_GROW: case KITEM_GROW:
case KITEM_SHRINK: case KITEM_SHRINK:
case KITEM_HYUDORO:
case KITEM_SUPERRING: case KITEM_SUPERRING:
K_BotItemGenericTap(player, cmd); K_BotItemGenericTap(player, cmd);
break; break;
@ -1325,8 +1509,6 @@ void K_BotItemUsage(player_t *player, ticcmd_t *cmd, INT16 turnamt)
K_BotItemGenericOrbitShield(player, cmd); K_BotItemGenericOrbitShield(player, cmd);
} }
else if (player->position != 1) // Hold onto orbiting items when in 1st :) else if (player->position != 1) // Hold onto orbiting items when in 1st :)
/* FALLTHRU */
case KITEM_BALLHOG:
{ {
K_BotItemOrbinaut(player, cmd); K_BotItemOrbinaut(player, cmd);
} }
@ -1352,8 +1534,12 @@ void K_BotItemUsage(player_t *player, ticcmd_t *cmd, INT16 turnamt)
} }
break; break;
case KITEM_LANDMINE: case KITEM_LANDMINE:
case KITEM_HYUDORO: // Function re-use, as they have about the same usage.
K_BotItemLandmine(player, cmd, turnamt); K_BotItemLandmine(player, cmd, turnamt);
break; break;
case KITEM_BALLHOG:
K_BotItemBallhog(player, cmd);
break;
case KITEM_DROPTARGET: case KITEM_DROPTARGET:
if (!(player->pflags & PF_ITEMOUT)) if (!(player->pflags & PF_ITEMOUT))
{ {
@ -1361,7 +1547,17 @@ void K_BotItemUsage(player_t *player, ticcmd_t *cmd, INT16 turnamt)
} }
else else
{ {
K_BotItemDropTarget(player, cmd); K_BotItemDropTarget(player, cmd, turnamt);
}
break;
case KITEM_GARDENTOP:
if (player->curshield != KSHIELD_TOP)
{
K_BotItemGardenTopDeploy(player, cmd);
}
else
{
K_BotItemGardenTop(player, cmd, turnamt);
} }
break; break;
case KITEM_LIGHTNINGSHIELD: case KITEM_LIGHTNINGSHIELD:

View file

@ -149,7 +149,7 @@ static boolean K_BotHatesThisSectorsSpecial(player_t *player, sector_t *sec)
return true; return true;
} }
if (sec->offroad > FRACUNIT) // Only care about strong offroad. if (sec->offroad > 0)
{ {
return !K_BotCanTakeCut(player); return !K_BotCanTakeCut(player);
} }

View file

@ -17,7 +17,7 @@
#include "doomdef.h" #include "doomdef.h"
#include "doomtype.h" #include "doomtype.h"
typedef struct brightmapStorage_s struct brightmapStorage_t
{ {
// Brightmap storage struct. // Brightmap storage struct.
// Stores data for brightmap definitions, // Stores data for brightmap definitions,
@ -28,7 +28,7 @@ typedef struct brightmapStorage_s
char brightmapName[9]; // The brightmap's name. char brightmapName[9]; // The brightmap's name.
UINT32 brightmapHash; // The brightmap name's hash. UINT32 brightmapHash; // The brightmap name's hash.
} brightmapStorage_t; };
/*-------------------------------------------------- /*--------------------------------------------------
void K_InitBrightmapsPwad(INT32 wadNum); void K_InitBrightmapsPwad(INT32 wadNum);

View file

@ -206,6 +206,7 @@ boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2)
static mobj_t *grenade; static mobj_t *grenade;
static fixed_t explodedist; static fixed_t explodedist;
static boolean explodespin; static boolean explodespin;
static tic_t minehitlag;
static inline boolean PIT_SSMineChecks(mobj_t *thing) static inline boolean PIT_SSMineChecks(mobj_t *thing)
{ {
@ -284,17 +285,22 @@ static inline BlockItReturn_t PIT_SSMineExplode(mobj_t *thing)
if (PIT_SSMineChecks(thing) == true) if (PIT_SSMineChecks(thing) == true)
return BMIT_CONTINUE; return BMIT_CONTINUE;
P_DamageMobj(thing, grenade, grenade->target, 1, (explodespin ? DMG_NORMAL : DMG_EXPLODE)); if (P_DamageMobj(thing, grenade, grenade->target, 1, (explodespin ? DMG_NORMAL : DMG_EXPLODE)))
{
minehitlag = thing->hitlag;
}
return BMIT_CONTINUE; return BMIT_CONTINUE;
} }
void K_MineExplodeAttack(mobj_t *actor, fixed_t size, boolean spin) tic_t K_MineExplodeAttack(mobj_t *actor, fixed_t size, boolean spin)
{ {
INT32 bx, by, xl, xh, yl, yh; INT32 bx, by, xl, xh, yl, yh;
explodespin = spin; explodespin = spin;
explodedist = FixedMul(size, actor->scale); explodedist = FixedMul(size, actor->scale);
grenade = actor; grenade = actor;
minehitlag = 0;
// Use blockmap to check for nearby shootables // Use blockmap to check for nearby shootables
yh = (unsigned)(actor->y + explodedist - bmaporgy)>>MAPBLOCKSHIFT; yh = (unsigned)(actor->y + explodedist - bmaporgy)>>MAPBLOCKSHIFT;
@ -310,6 +316,15 @@ void K_MineExplodeAttack(mobj_t *actor, fixed_t size, boolean spin)
// Set this flag to ensure that the inital action won't be triggered twice. // Set this flag to ensure that the inital action won't be triggered twice.
actor->flags2 |= MF2_DEBRIS; actor->flags2 |= MF2_DEBRIS;
if (!spin)
{
K_SpawnBrolyKi(actor, minehitlag);
return minehitlag;
}
return 0;
} }
boolean K_MineCollide(mobj_t *t1, mobj_t *t2) boolean K_MineCollide(mobj_t *t1, mobj_t *t2)
@ -397,6 +412,7 @@ boolean K_LandMineCollide(mobj_t *t1, mobj_t *t2)
P_DamageMobj(t2, t1, t1->target, 1, DMG_TUMBLE); P_DamageMobj(t2, t1, t1->target, 1, DMG_TUMBLE);
} }
t1->reactiontime = t2->hitlag;
P_KillMobj(t1, t2, t2, DMG_NORMAL); P_KillMobj(t1, t2, t2, DMG_NORMAL);
} }
else if (t2->type == MT_BANANA || t2->type == MT_BANANA_SHIELD else if (t2->type == MT_BANANA || t2->type == MT_BANANA_SHIELD
@ -420,6 +436,7 @@ boolean K_LandMineCollide(mobj_t *t1, mobj_t *t2)
P_SpawnMobj(t2->x/2 + t1->x/2, t2->y/2 + t1->y/2, t2->z/2 + t1->z/2, MT_ITEMCLASH); P_SpawnMobj(t2->x/2 + t1->x/2, t2->y/2 + t1->y/2, t2->z/2 + t1->z/2, MT_ITEMCLASH);
t1->reactiontime = t2->hitlag;
P_KillMobj(t1, t2, t2, DMG_NORMAL); P_KillMobj(t1, t2, t2, DMG_NORMAL);
} }
else if (t2->type == MT_SSMINE_SHIELD || t2->type == MT_SSMINE || t2->type == MT_LANDMINE) else if (t2->type == MT_SSMINE_SHIELD || t2->type == MT_SSMINE || t2->type == MT_LANDMINE)
@ -432,6 +449,8 @@ boolean K_LandMineCollide(mobj_t *t1, mobj_t *t2)
{ {
// Shootable damage // Shootable damage
P_DamageMobj(t2, t1, t1->target, 1, DMG_NORMAL); P_DamageMobj(t2, t1, t1->target, 1, DMG_NORMAL);
t1->reactiontime = t2->hitlag;
P_KillMobj(t1, t2, t2, DMG_NORMAL); P_KillMobj(t1, t2, t2, DMG_NORMAL);
} }
@ -626,7 +645,7 @@ static inline BlockItReturn_t PIT_LightningShieldAttack(mobj_t *thing)
} }
#endif #endif
P_DamageMobj(thing, lightningSource, lightningSource, 1, DMG_NORMAL|DMG_CANTHURTSELF|DMG_WOMBO); P_DamageMobj(thing, lightningSource, lightningSource, 1, DMG_VOLTAGE|DMG_CANTHURTSELF|DMG_WOMBO);
return BMIT_CONTINUE; return BMIT_CONTINUE;
} }

View file

@ -10,7 +10,7 @@ boolean K_BananaBallhogCollide(mobj_t *t1, mobj_t *t2);
boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2); boolean K_EggItemCollide(mobj_t *t1, mobj_t *t2);
void K_DoMineSearch(mobj_t *actor, fixed_t size); void K_DoMineSearch(mobj_t *actor, fixed_t size);
void K_MineExplodeAttack(mobj_t *actor, fixed_t size, boolean spin); tic_t K_MineExplodeAttack(mobj_t *actor, fixed_t size, boolean spin);
boolean K_MineCollide(mobj_t *t1, mobj_t *t2); boolean K_MineCollide(mobj_t *t1, mobj_t *t2);
boolean K_LandMineCollide(mobj_t *t1, mobj_t *t2); boolean K_LandMineCollide(mobj_t *t1, mobj_t *t2);

View file

@ -43,7 +43,7 @@ typedef enum
// //
// We'll define these here because they're really just a mobj that'll follow some rules behind a player // We'll define these here because they're really just a mobj that'll follow some rules behind a player
// //
typedef struct follower_s struct follower_t
{ {
char name[SKINNAMESIZE+1]; // Skin Name. This is what to refer to when asking the commands anything.. char name[SKINNAMESIZE+1]; // Skin Name. This is what to refer to when asking the commands anything..
char icon[8+1]; // Lump names are only 8 characters. (+1 for \0) char icon[8+1]; // Lump names are only 8 characters. (+1 for \0)
@ -81,19 +81,19 @@ typedef struct follower_s
statenum_t losestate; // state when the player has lost statenum_t losestate; // state when the player has lost
statenum_t hitconfirmstate; // state for hit confirm statenum_t hitconfirmstate; // state for hit confirm
tic_t hitconfirmtime; // time to keep the above playing for tic_t hitconfirmtime; // time to keep the above playing for
} follower_t; };
extern INT32 numfollowers; extern INT32 numfollowers;
extern follower_t followers[MAXSKINS]; extern follower_t followers[MAXSKINS];
#define MAXFOLLOWERCATEGORIES 32 #define MAXFOLLOWERCATEGORIES 32
typedef struct followercategory_s struct followercategory_t
{ {
char name[SKINNAMESIZE+1]; // Name. This is used for the menus. We'll just follow the same rules as skins for this. char name[SKINNAMESIZE+1]; // Name. This is used for the menus. We'll just follow the same rules as skins for this.
char icon[8+1]; // Lump names are only 8 characters. (+1 for \0) char icon[8+1]; // Lump names are only 8 characters. (+1 for \0)
UINT8 numincategory; UINT8 numincategory;
} followercategory_t; };
extern INT32 numfollowercategories; extern INT32 numfollowercategories;
extern followercategory_t followercategories[MAXFOLLOWERCATEGORIES]; extern followercategory_t followercategories[MAXFOLLOWERCATEGORIES];

View file

@ -804,117 +804,6 @@ INT32 POSI2_X, POSI2_Y;
// trick "cool" // trick "cool"
INT32 TCOOL_X, TCOOL_Y; INT32 TCOOL_X, TCOOL_Y;
void K_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dupx, INT32 dupy)
{
// dupx adjustments pretend that screen width is BASEVIDWIDTH * dupx
INT32 screenwidth = vid.width;
INT32 screenheight = vid.height;
INT32 basewidth = BASEVIDWIDTH * dupx;
INT32 baseheight = BASEVIDHEIGHT * dupy;
SINT8 player = -1;
UINT8 i;
if (options & V_SPLITSCREEN)
{
if (r_splitscreen > 0)
{
screenheight /= 2;
baseheight /= 2;
}
if (r_splitscreen > 1)
{
screenwidth /= 2;
basewidth /= 2;
}
}
for (i = 0; i <= r_splitscreen; i++)
{
if (stplyr == &players[displayplayers[i]])
{
player = i;
break;
}
}
if (vid.width != (BASEVIDWIDTH * dupx))
{
if (options & V_SNAPTORIGHT)
*x += (screenwidth - basewidth);
else if (!(options & V_SNAPTOLEFT))
*x += (screenwidth - basewidth) / 2;
}
if (vid.height != (BASEVIDHEIGHT * dupy))
{
if (options & V_SNAPTOBOTTOM)
*y += (screenheight - baseheight);
else if (!(options & V_SNAPTOTOP))
*y += (screenheight - baseheight) / 2;
}
if (options & V_SPLITSCREEN)
{
if (r_splitscreen == 1)
{
if (player == 1)
*y += screenheight;
}
else if (r_splitscreen > 1)
{
if (player == 1 || player == 3)
*x += screenwidth;
if (player == 2 || player == 3)
*y += screenheight;
}
}
if (options & V_SLIDEIN)
{
const tic_t length = TICRATE/4;
tic_t timer = lt_exitticker;
if (bossinfo.boss == true)
{
if (leveltime <= 3)
timer = 0;
else
timer = leveltime-3;
}
if (timer < length)
{
boolean slidefromright = false;
const INT32 offsetAmount = (screenwidth * FRACUNIT/2) / length;
fixed_t offset = (screenwidth * FRACUNIT/2) - (timer * offsetAmount);
offset += FixedMul(offsetAmount, renderdeltatics);
offset /= FRACUNIT;
if (r_splitscreen > 1)
{
if (stplyr == &players[displayplayers[1]] || stplyr == &players[displayplayers[3]])
slidefromright = true;
}
if (options & V_SNAPTORIGHT)
slidefromright = true;
else if (options & V_SNAPTOLEFT)
slidefromright = false;
if (slidefromright == true)
{
offset = -offset;
}
*x -= offset;
}
}
}
// This version of the function was prototyped in Lua by Nev3r ... a HUGE thank you goes out to them! // This version of the function was prototyped in Lua by Nev3r ... a HUGE thank you goes out to them!
void K_ObjectTracking(trackingResult_t *result, vector3_t *point, boolean reverse) void K_ObjectTracking(trackingResult_t *result, vector3_t *point, boolean reverse)
{ {
@ -1349,6 +1238,8 @@ static void K_drawKartItem(void)
V_DrawScaledPatch(fx, fy, V_HUDTRANS|V_SLIDEIN|fflags, localbg); V_DrawScaledPatch(fx, fy, V_HUDTRANS|V_SLIDEIN|fflags, localbg);
//V_SetClipRect((fx + 10) << FRACBITS, (fy + 10) << FRACBITS, 30 << FRACBITS, 30 << FRACBITS, V_HUDTRANS|V_SLIDEIN|fflags);
// Then, the numbers: // Then, the numbers:
if (stplyr->itemamount >= numberdisplaymin && !stplyr->itemroulette) if (stplyr->itemamount >= numberdisplaymin && !stplyr->itemroulette)
{ {
@ -1368,6 +1259,8 @@ static void K_drawKartItem(void)
else else
V_DrawFixedPatch(fx<<FRACBITS, fy<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SLIDEIN|fflags, localpatch, colmap); V_DrawFixedPatch(fx<<FRACBITS, fy<<FRACBITS, FRACUNIT, V_HUDTRANS|V_SLIDEIN|fflags, localpatch, colmap);
//V_ClearClipRect();
// Extensible meter, currently only used for rocket sneaker... // Extensible meter, currently only used for rocket sneaker...
if (itembar) if (itembar)
{ {

View file

@ -21,9 +21,7 @@
#define POS_DELAY_TIME 10 #define POS_DELAY_TIME 10
void K_AdjustXYWithSnap(INT32 *x, INT32 *y, UINT32 options, INT32 dupx, INT32 dupy); struct trackingResult_t
typedef struct trackingResult_s
{ {
fixed_t x, y; fixed_t x, y;
fixed_t scale; fixed_t scale;

View file

@ -1520,7 +1520,7 @@ static fixed_t K_PlayerWeight(mobj_t *mobj, mobj_t *against)
weight = (mobj->player->kartweight) * FRACUNIT; weight = (mobj->player->kartweight) * FRACUNIT;
if (mobj->player->speed > spd) if (mobj->player->speed > spd)
weight += (mobj->player->speed - spd) / 8; weight += FixedDiv((mobj->player->speed - spd), 8 * mapobjectscale);
if (mobj->player->itemtype == KITEM_BUBBLESHIELD) if (mobj->player->itemtype == KITEM_BUBBLESHIELD)
weight += 9*FRACUNIT; weight += 9*FRACUNIT;
@ -5113,6 +5113,8 @@ void K_MineFlashScreen(mobj_t *source)
INT32 pnum; INT32 pnum;
player_t *p; player_t *p;
S_StartSound(source, sfx_s3k4e);
// check for potential display players near the source so we can have a sick earthquake / flashpal. // check for potential display players near the source so we can have a sick earthquake / flashpal.
for (pnum = 0; pnum < MAXPLAYERS; pnum++) for (pnum = 0; pnum < MAXPLAYERS; pnum++)
{ {
@ -5135,7 +5137,7 @@ void K_MineFlashScreen(mobj_t *source)
} }
// Spawns the purely visual explosion // Spawns the purely visual explosion
void K_SpawnMineExplosion(mobj_t *source, UINT8 color) void K_SpawnMineExplosion(mobj_t *source, UINT8 color, tic_t delay)
{ {
INT32 i, radius, height; INT32 i, radius, height;
mobj_t *smoldering = P_SpawnMobj(source->x, source->y, source->z, MT_SMOLDERING); mobj_t *smoldering = P_SpawnMobj(source->x, source->y, source->z, MT_SMOLDERING);
@ -5143,15 +5145,12 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
mobj_t *truc; mobj_t *truc;
INT32 speed, speed2; INT32 speed, speed2;
K_MineFlashScreen(source);
K_MatchGenericExtraFlags(smoldering, source); K_MatchGenericExtraFlags(smoldering, source);
smoldering->tics = TICRATE*3; smoldering->tics = TICRATE*3;
smoldering->hitlag += delay;
radius = source->radius>>FRACBITS; radius = source->radius>>FRACBITS;
height = source->height>>FRACBITS; height = source->height>>FRACBITS;
S_StartSound(smoldering, sfx_s3k4e);
if (!color) if (!color)
color = SKINCOLOR_KETCHUP; color = SKINCOLOR_KETCHUP;
@ -5164,6 +5163,8 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
dust->destscale = source->scale*10; dust->destscale = source->scale*10;
dust->scalespeed = source->scale/12; dust->scalespeed = source->scale/12;
P_InstaThrust(dust, dust->angle, FixedMul(20*FRACUNIT, source->scale)); P_InstaThrust(dust, dust->angle, FixedMul(20*FRACUNIT, source->scale));
dust->hitlag += delay;
dust->renderflags |= RF_DONTDRAW;
truc = P_SpawnMobj(source->x + P_RandomRange(PR_EXPLOSION, -radius, radius)*FRACUNIT, truc = P_SpawnMobj(source->x + P_RandomRange(PR_EXPLOSION, -radius, radius)*FRACUNIT,
source->y + P_RandomRange(PR_EXPLOSION, -radius, radius)*FRACUNIT, source->y + P_RandomRange(PR_EXPLOSION, -radius, radius)*FRACUNIT,
@ -5180,6 +5181,8 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
if (truc->eflags & MFE_UNDERWATER) if (truc->eflags & MFE_UNDERWATER)
truc->momz = (117 * truc->momz) / 200; truc->momz = (117 * truc->momz) / 200;
truc->color = color; truc->color = color;
truc->hitlag += delay;
truc->renderflags |= RF_DONTDRAW;
} }
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
@ -5193,6 +5196,8 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
dust->scalespeed = source->scale/12; dust->scalespeed = source->scale/12;
dust->tics = 30; dust->tics = 30;
dust->momz = P_RandomRange(PR_EXPLOSION, FixedMul(3*FRACUNIT, source->scale)>>FRACBITS, FixedMul(7*FRACUNIT, source->scale)>>FRACBITS)*FRACUNIT; dust->momz = P_RandomRange(PR_EXPLOSION, FixedMul(3*FRACUNIT, source->scale)>>FRACBITS, FixedMul(7*FRACUNIT, source->scale)>>FRACBITS)*FRACUNIT;
dust->hitlag += delay;
dust->renderflags |= RF_DONTDRAW;
truc = P_SpawnMobj(source->x + P_RandomRange(PR_EXPLOSION, -radius, radius)*FRACUNIT, truc = P_SpawnMobj(source->x + P_RandomRange(PR_EXPLOSION, -radius, radius)*FRACUNIT,
source->y + P_RandomRange(PR_EXPLOSION, -radius, radius)*FRACUNIT, source->y + P_RandomRange(PR_EXPLOSION, -radius, radius)*FRACUNIT,
@ -5213,9 +5218,44 @@ void K_SpawnMineExplosion(mobj_t *source, UINT8 color)
truc->momz = (117 * truc->momz) / 200; truc->momz = (117 * truc->momz) / 200;
truc->tics = TICRATE*2; truc->tics = TICRATE*2;
truc->color = color; truc->color = color;
truc->hitlag += delay;
truc->renderflags |= RF_DONTDRAW;
} }
} }
void K_SpawnBrolyKi(mobj_t *source, tic_t duration)
{
mobj_t *x;
if (duration == 0)
{
return;
}
x = P_SpawnMobjFromMobj(source, 0, 0, 0, MT_THOK);
// Shrink into center of source object.
x->z = (source->z + source->height / 2);
x->height = 0;
P_SetMobjState(x, S_BROLY1);
x->colorized = true;
x->color = source->color;
x->hitlag = 0; // do not copy source hitlag
P_SetScale(x, 64 * mapobjectscale);
x->scalespeed = x->scale / duration;
// The last tic doesn't actually get rendered so in order
// to show scale = destscale, add one buffer tic.
x->tics = (duration + 1);
x->destscale = 1; // 0 also doesn't work
K_ReduceVFX(x, NULL);
S_StartSound(x, sfx_cdfm74);
}
#undef MINEQUAKEDIST #undef MINEQUAKEDIST
fixed_t K_ItemScaleForPlayer(player_t *player) fixed_t K_ItemScaleForPlayer(player_t *player)
@ -6688,6 +6728,9 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
mo->momz = FixedDiv(mo->momz, FixedSqrt(3*FRACUNIT)); mo->momz = FixedDiv(mo->momz, FixedSqrt(3*FRACUNIT));
} }
mo->pitch = 0;
mo->roll = 0;
if (sound) if (sound)
{ {
S_StartSound(mo, (sound == 1 ? sfx_kc2f : sfx_kpogos)); S_StartSound(mo, (sound == 1 ? sfx_kc2f : sfx_kpogos));
@ -8631,6 +8674,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
//player->flashing = 0; //player->flashing = 0;
eggsexplode = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_SPBEXPLOSION); eggsexplode = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_SPBEXPLOSION);
eggsexplode->height = 2 * player->mo->height;
eggsexplode->color = player->mo->color;
if (player->eggmanblame >= 0 if (player->eggmanblame >= 0
&& player->eggmanblame < MAXPLAYERS && player->eggmanblame < MAXPLAYERS
&& playeringame[player->eggmanblame] && playeringame[player->eggmanblame]
@ -9097,6 +9143,11 @@ static waypoint_t *K_GetPlayerNextWaypoint(player_t *player)
if (angledelta < nextbestdelta && momdelta < nextbestmomdelta) if (angledelta < nextbestdelta && momdelta < nextbestmomdelta)
{ {
if (waypoint->prevwaypoints[i] == finishline) // NEVER allow finish line.
{
continue;
}
if (P_TraceWaypointTraversal(player->mo, waypoint->prevwaypoints[i]->mobj) == false) if (P_TraceWaypointTraversal(player->mo, waypoint->prevwaypoints[i]->mobj) == false)
{ {
// Save sight checks when all of the other checks pass, so we only do it if we have to // Save sight checks when all of the other checks pass, so we only do it if we have to

View file

@ -106,7 +106,8 @@ void K_HandleBumperChanges(player_t *player, UINT8 prevBumpers);
void K_DestroyBumpers(player_t *player, UINT8 amount); void K_DestroyBumpers(player_t *player, UINT8 amount);
void K_TakeBumpersFromPlayer(player_t *player, player_t *victim, UINT8 amount); void K_TakeBumpersFromPlayer(player_t *player, player_t *victim, UINT8 amount);
void K_MineFlashScreen(mobj_t *source); void K_MineFlashScreen(mobj_t *source);
void K_SpawnMineExplosion(mobj_t *source, UINT8 color); void K_SpawnMineExplosion(mobj_t *source, UINT8 color, tic_t delay);
void K_SpawnBrolyKi(mobj_t *source, tic_t duration);
void K_RunFinishLineBeam(void); void K_RunFinishLineBeam(void);
UINT16 K_DriftSparkColor(player_t *player, INT32 charge); UINT16 K_DriftSparkColor(player_t *player, INT32 charge);
void K_SpawnBoostTrail(player_t *player); void K_SpawnBoostTrail(player_t *player);

View file

@ -101,17 +101,17 @@ extern M_waiting_mode_t m_waiting_mode;
typedef union typedef union
{ {
struct menu_s *submenu; // IT_SUBMENU menu_t *submenu; // IT_SUBMENU
consvar_t *cvar; // IT_CVAR consvar_t *cvar; // IT_CVAR
void (*routine)(INT32 choice); // IT_CALL, IT_KEYHANDLER, IT_ARROWS void (*routine)(INT32 choice); // IT_CALL, IT_KEYHANDLER, IT_ARROWS
} itemaction_t; } itemaction_t;
// Player Setup menu colors linked list // Player Setup menu colors linked list
typedef struct menucolor_s { struct menucolor_t {
struct menucolor_s *next; menucolor_t *next;
struct menucolor_s *prev; menucolor_t *prev;
UINT16 color; UINT16 color;
} menucolor_t; };
extern menucolor_t *menucolorhead, *menucolortail; extern menucolor_t *menucolorhead, *menucolortail;
@ -121,7 +121,7 @@ extern CV_PossibleValue_t gametype_cons_t[];
// MENU TYPEDEFS // MENU TYPEDEFS
// //
typedef struct menuitem_s struct menuitem_t
{ {
UINT16 status; // show IT_xxx UINT16 status; // show IT_xxx
@ -134,12 +134,12 @@ typedef struct menuitem_s
// extra variables // extra variables
INT32 mvar1; INT32 mvar1;
INT32 mvar2; INT32 mvar2;
} menuitem_t; };
typedef struct menu_s struct menu_t
{ {
INT16 numitems; // # of menu items INT16 numitems; // # of menu items
struct menu_s *prevMenu; // previous menu menu_t *prevMenu; // previous menu
INT16 lastOn; // last item user was on in menu INT16 lastOn; // last item user was on in menu
menuitem_t *menuitems; // menu items menuitem_t *menuitems; // menu items
@ -155,7 +155,7 @@ typedef struct menu_s
void (*initroutine)(void); // called when starting a new menu void (*initroutine)(void); // called when starting a new menu
boolean (*quitroutine)(void); // called before quit a menu return true if we can boolean (*quitroutine)(void); // called before quit a menu return true if we can
boolean (*inputroutine)(INT32); // if set, called every frame in the input handler. Returning true overwrites normal input handling. boolean (*inputroutine)(INT32); // if set, called every frame in the input handler. Returning true overwrites normal input handling.
} menu_t; };
typedef enum typedef enum
{ {
@ -522,7 +522,7 @@ typedef enum
MBT_START = 1<<8 MBT_START = 1<<8
} menuButtonCode_t; } menuButtonCode_t;
typedef struct menucmd_s struct menucmd_t
{ {
SINT8 dpad_ud; // up / down dpad SINT8 dpad_ud; // up / down dpad
SINT8 dpad_lr; // left / right SINT8 dpad_lr; // left / right
@ -530,15 +530,15 @@ typedef struct menucmd_s
UINT32 buttonsHeld; // prev frame's buttons UINT32 buttonsHeld; // prev frame's buttons
UINT16 delay; // menu wait UINT16 delay; // menu wait
UINT32 delayCount; // num times ya did menu wait (to make the wait shorter each time) UINT32 delayCount; // num times ya did menu wait (to make the wait shorter each time)
} menucmd_t; };
extern menucmd_t menucmd[MAXSPLITSCREENPLAYERS]; extern menucmd_t menucmd[MAXSPLITSCREENPLAYERS];
extern struct menutransition_s { extern struct menutransition_s {
INT16 tics; INT16 tics;
INT16 dest; INT16 dest;
struct menu_s *startmenu; menu_t *startmenu;
struct menu_s *endmenu; menu_t *endmenu;
boolean in; boolean in;
} menutransition; } menutransition;
@ -607,7 +607,7 @@ typedef enum
CSSTEP_READY CSSTEP_READY
} setup_mdepth_t; } setup_mdepth_t;
typedef struct setup_player_s struct setup_player_t
{ {
SINT8 gridx, gridy; SINT8 gridx, gridy;
UINT8 profilen; UINT8 profilen;
@ -633,7 +633,7 @@ typedef struct setup_player_s
tic_t follower_timer; tic_t follower_timer;
UINT8 follower_frame; UINT8 follower_frame;
state_t *follower_state; state_t *follower_state;
} setup_player_t; };
extern setup_player_t setup_player[MAXSPLITSCREENPLAYERS]; extern setup_player_t setup_player[MAXSPLITSCREENPLAYERS];
@ -800,12 +800,12 @@ void M_ServerListFillDebug(void);
// Options menu: // Options menu:
// mode descriptions for video mode menu // mode descriptions for video mode menu
typedef struct struct modedesc_t
{ {
INT32 modenum; // video mode number in the vidmodes list INT32 modenum; // video mode number in the vidmodes list
const char *desc; // XXXxYYY const char *desc; // XXXxYYY
UINT8 goodratio; // aspect correct if 1 UINT8 goodratio; // aspect correct if 1
} modedesc_t; };
#define MAXCOLUMNMODES 12 //max modes displayed in one column #define MAXCOLUMNMODES 12 //max modes displayed in one column

View file

@ -35,27 +35,27 @@ typedef boolean(*getpathfindfinishedfunc)(void*, void*);
// A pathfindnode contains information about a node from the pathfinding // A pathfindnode contains information about a node from the pathfinding
// heapindex is only used within the pathfinding algorithm itself, and is always 0 after it is completed // heapindex is only used within the pathfinding algorithm itself, and is always 0 after it is completed
typedef struct pathfindnode_s { struct pathfindnode_t {
size_t heapindex; // The index in the openset binary heap. Only valid while the node is in the openset. size_t heapindex; // The index in the openset binary heap. Only valid while the node is in the openset.
void *nodedata; void *nodedata;
struct pathfindnode_s *camefrom; // should eventually be the most efficient predecessor node pathfindnode_t *camefrom; // should eventually be the most efficient predecessor node
UINT32 gscore; // The accumulated distance from the start to this node UINT32 gscore; // The accumulated distance from the start to this node
UINT32 hscore; // The heuristic from this node to the goal UINT32 hscore; // The heuristic from this node to the goal
} pathfindnode_t; };
// Contains the final created path after pathfinding is completed // Contains the final created path after pathfinding is completed
typedef struct path_s { struct path_t {
size_t numnodes; size_t numnodes;
struct pathfindnode_s *array; pathfindnode_t *array;
UINT32 totaldist; UINT32 totaldist;
} path_t; };
// Contains info about the pathfinding used to setup the algorithm // Contains info about the pathfinding used to setup the algorithm
// (e.g. the base capacities of the dynamically allocated arrays) // (e.g. the base capacities of the dynamically allocated arrays)
// should be setup by the caller before starting pathfinding // should be setup by the caller before starting pathfinding
// base capacities will be 8 if they aren't setup, missing callback functions will cause an error. // base capacities will be 8 if they aren't setup, missing callback functions will cause an error.
// Can be accessed after the pathfinding is complete to get the final capacities of them // Can be accessed after the pathfinding is complete to get the final capacities of them
typedef struct pathfindsetup_s { struct pathfindsetup_t {
size_t opensetcapacity; size_t opensetcapacity;
size_t closedsetcapacity; size_t closedsetcapacity;
size_t nodesarraycapacity; size_t nodesarraycapacity;
@ -67,7 +67,7 @@ typedef struct pathfindsetup_s {
getnodeheuristicfunc getheuristic; getnodeheuristicfunc getheuristic;
getnodetraversablefunc gettraversable; getnodetraversablefunc gettraversable;
getpathfindfinishedfunc getfinished; getpathfindfinishedfunc getfinished;
} pathfindsetup_t; };
/*-------------------------------------------------- /*--------------------------------------------------

View file

@ -45,7 +45,7 @@
// profile_t definition (WIP) // profile_t definition (WIP)
// If you edit, see PR_SaveProfiles and PR_LoadProfiles // If you edit, see PR_SaveProfiles and PR_LoadProfiles
typedef struct profile_s struct profile_t
{ {
// Versionning // Versionning
@ -70,7 +70,7 @@ typedef struct profile_s
// Finally, control data itself // Finally, control data itself
INT32 controls[num_gamecontrols][MAXINPUTMAPPING]; // Lists of all the controls, defined the same way as default inputs in g_input.c INT32 controls[num_gamecontrols][MAXINPUTMAPPING]; // Lists of all the controls, defined the same way as default inputs in g_input.c
} profile_t; };
// Functions // Functions

View file

@ -22,7 +22,7 @@
#define TERRAIN_NAME_LEN 32 #define TERRAIN_NAME_LEN 32
typedef struct t_splash_s struct t_splash_t
{ {
// Splash definition. // Splash definition.
// These are particles spawned when hitting the floor. // These are particles spawned when hitting the floor.
@ -41,9 +41,9 @@ typedef struct t_splash_s
angle_t cone; // Randomized angle of the push-out. angle_t cone; // Randomized angle of the push-out.
UINT8 numParticles; // Number of particles to spawn. UINT8 numParticles; // Number of particles to spawn.
} t_splash_t; };
typedef struct t_footstep_s struct t_footstep_t
{ {
// Footstep definition. // Footstep definition.
// These are particles spawned when moving fast enough on a floor. // These are particles spawned when moving fast enough on a floor.
@ -64,7 +64,7 @@ typedef struct t_footstep_s
tic_t sfxFreq; // How frequently to play the sound. tic_t sfxFreq; // How frequently to play the sound.
tic_t frequency; // How frequently to spawn the particles. tic_t frequency; // How frequently to spawn the particles.
fixed_t requiredSpeed; // Speed percentage you need to be at to trigger the particles. fixed_t requiredSpeed; // Speed percentage you need to be at to trigger the particles.
} t_footstep_t; };
typedef enum typedef enum
{ {
@ -75,7 +75,7 @@ typedef enum
TOV__MAX TOV__MAX
} t_overlay_action_t; } t_overlay_action_t;
typedef struct t_overlay_s struct t_overlay_t
{ {
// Overlay definition. // Overlay definition.
// These are sprites displayed on top of the base object. // These are sprites displayed on top of the base object.
@ -87,7 +87,7 @@ typedef struct t_overlay_s
fixed_t scale; // Thing scale multiplier. fixed_t scale; // Thing scale multiplier.
UINT16 color; // Colorize effect. SKINCOLOR_NONE has no colorize. UINT16 color; // Colorize effect. SKINCOLOR_NONE has no colorize.
fixed_t speed; // Speed-up based on object speed. 0 plays the animation at a constant rate. fixed_t speed; // Speed-up based on object speed. 0 plays the animation at a constant rate.
} t_overlay_t; };
typedef enum typedef enum
{ {
@ -98,7 +98,7 @@ typedef enum
TRF_TRIPWIRE = 1<<3 // Texture is a tripwire when used as a midtexture TRF_TRIPWIRE = 1<<3 // Texture is a tripwire when used as a midtexture
} terrain_flags_t; } terrain_flags_t;
typedef struct terrain_s struct terrain_t
{ {
// Terrain definition. // Terrain definition.
// These are all of the properties that the floor gets. // These are all of the properties that the floor gets.
@ -118,9 +118,9 @@ typedef struct terrain_s
angle_t speedPadAngle; // Speed pad angle angle_t speedPadAngle; // Speed pad angle
fixed_t floorClip; // Offset for sprites on this ground fixed_t floorClip; // Offset for sprites on this ground
UINT32 flags; // Flag values (see: terrain_flags_t) UINT32 flags; // Flag values (see: terrain_flags_t)
} terrain_t; };
typedef struct t_floor_s struct t_floor_t
{ {
// Terrain floor definition. // Terrain floor definition.
// Ties a texture name to a terrain definition. // Ties a texture name to a terrain definition.
@ -128,7 +128,7 @@ typedef struct t_floor_s
char textureName[9]; // Floor texture name. char textureName[9]; // Floor texture name.
UINT32 textureHash; // Floor texture hash. UINT32 textureHash; // Floor texture hash.
size_t terrainID; // Terrain definition ID. size_t terrainID; // Terrain definition ID.
} t_floor_t; };
/*-------------------------------------------------- /*--------------------------------------------------

View file

@ -361,7 +361,7 @@ waypoint_t *K_GetBestWaypointForMobj(mobj_t *const mobj)
// remember: huge radius // remember: huge radius
if (closestdist <= rad && checkdist <= rad && finishline != NULL) if (closestdist <= rad && checkdist <= rad && finishline != NULL)
{ {
if (!P_TraceBlockingLines(mobj, checkwaypoint->mobj)) // Intentionally not P_TraceWaypointTraversal if (!P_TraceWaypointTraversal(mobj, checkwaypoint->mobj))
{ {
// Save sight checks when all of the other checks pass, so we only do it if we have to // Save sight checks when all of the other checks pass, so we only do it if we have to
continue; continue;
@ -379,7 +379,7 @@ waypoint_t *K_GetBestWaypointForMobj(mobj_t *const mobj)
} }
else if (checkdist < closestdist && bestfindist == INT32_MAX) else if (checkdist < closestdist && bestfindist == INT32_MAX)
{ {
if (!P_TraceBlockingLines(mobj, checkwaypoint->mobj)) // Intentionally not P_TraceWaypointTraversal if (!P_TraceWaypointTraversal(mobj, checkwaypoint->mobj))
{ {
// Save sight checks when all of the other checks pass, so we only do it if we have to // Save sight checks when all of the other checks pass, so we only do it if we have to
continue; continue;

View file

@ -20,17 +20,17 @@
#define DEFAULT_WAYPOINT_RADIUS (384) #define DEFAULT_WAYPOINT_RADIUS (384)
typedef struct waypoint_s struct waypoint_t
{ {
mobj_t *mobj; mobj_t *mobj;
boolean onaline; boolean onaline;
struct waypoint_s **nextwaypoints; waypoint_t **nextwaypoints;
struct waypoint_s **prevwaypoints; waypoint_t **prevwaypoints;
UINT32 *nextwaypointdistances; UINT32 *nextwaypointdistances;
UINT32 *prevwaypointdistances; UINT32 *prevwaypointdistances;
size_t numnextwaypoints; size_t numnextwaypoints;
size_t numprevwaypoints; size_t numprevwaypoints;
} waypoint_t; };
// AVAILABLE FOR LUA // AVAILABLE FOR LUA

View file

@ -3601,10 +3601,11 @@ static int lib_kSpawnMineExplosion(lua_State *L)
{ {
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
UINT8 color = (UINT8)luaL_optinteger(L, 2, SKINCOLOR_KETCHUP); UINT8 color = (UINT8)luaL_optinteger(L, 2, SKINCOLOR_KETCHUP);
tic_t delay = (tic_t)luaL_optinteger(L, 3, 0);
NOHUD NOHUD
if (!source) if (!source)
return LUA_ErrInvalid(L, "mobj_t"); return LUA_ErrInvalid(L, "mobj_t");
K_SpawnMineExplosion(source, color); K_SpawnMineExplosion(source, color, delay);
return 0; return 0;
} }

View file

@ -27,6 +27,8 @@
#include "d_netcmd.h" // for cv_perfstats #include "d_netcmd.h" // for cv_perfstats
#include "i_system.h" // I_GetPreciseTime #include "i_system.h" // I_GetPreciseTime
#include "v_video.h" // V_ClearClipRect
/* ========================================================================= /* =========================================================================
ABSTRACTION ABSTRACTION
========================================================================= */ ========================================================================= */
@ -641,8 +643,13 @@ void LUA_HookHUD(huddrawlist_h list, int hook_type)
LUA_SetHudHook(hook_type, list); LUA_SetHudHook(hook_type, list);
hud_running = true; // local hook hud_running = true; // local hook
// Catch runaway clipping rectangles.
V_ClearClipRect();
init_hook_call(&hook, 0, res_none); init_hook_call(&hook, 0, res_none);
call_mapped(&hook, map); call_mapped(&hook, map);
hud_running = false; hud_running = false;
} }
} }

View file

@ -24,8 +24,6 @@
extern "C" { extern "C" {
#endif #endif
typedef struct huddrawlist_s *huddrawlist_h;
// Create a new drawlist. Returns a handle to it. // Create a new drawlist. Returns a handle to it.
huddrawlist_h LUA_HUD_CreateDrawList(void); huddrawlist_h LUA_HUD_CreateDrawList(void);
// Clears the draw list. // Clears the draw list.

View file

@ -27,7 +27,7 @@ typedef struct aatree_node_s
struct aatree_node_s *left, *right; struct aatree_node_s *left, *right;
} aatree_node_t; } aatree_node_t;
struct aatree_s struct aatree_t
{ {
aatree_node_t *root; aatree_node_t *root;
UINT32 flags; UINT32 flags;

View file

@ -19,7 +19,6 @@
// Flags for AA trees. // Flags for AA trees.
#define AATREE_ZUSER 1 // Treat values as z_zone-allocated blocks and set their user fields #define AATREE_ZUSER 1 // Treat values as z_zone-allocated blocks and set their user fields
typedef struct aatree_s aatree_t;
typedef void (*aatree_iter_t)(INT32 key, void *value); typedef void (*aatree_iter_t)(INT32 key, void *value);
aatree_t *M_AATreeAlloc(UINT32 flags); aatree_t *M_AATreeAlloc(UINT32 flags);

View file

@ -37,7 +37,7 @@ typedef enum
} conditiontype_t; } conditiontype_t;
// Condition Set information // Condition Set information
typedef struct struct condition_t
{ {
UINT32 id; /// <- The ID of this condition. UINT32 id; /// <- The ID of this condition.
/// In an unlock condition, all conditions with the same ID /// In an unlock condition, all conditions with the same ID
@ -47,14 +47,14 @@ typedef struct
INT32 requirement; /// <- The requirement for this variable. INT32 requirement; /// <- The requirement for this variable.
INT16 extrainfo1; /// <- Extra information for the condition when needed. INT16 extrainfo1; /// <- Extra information for the condition when needed.
INT16 extrainfo2; /// <- Extra information for the condition when needed. INT16 extrainfo2; /// <- Extra information for the condition when needed.
} condition_t; };
typedef struct struct conditionset_t
{ {
UINT32 numconditions; /// <- number of conditions. UINT32 numconditions; /// <- number of conditions.
condition_t *condition; /// <- All conditionals to be checked. condition_t *condition; /// <- All conditionals to be checked.
UINT8 achieved; /// <- Whether this conditional has been achieved already or not. UINT8 achieved; /// <- Whether this conditional has been achieved already or not.
/// (Conditional checking is skipped if true -- it's assumed you can't relock an unlockable) /// (Conditional checking is skipped if true -- it's assumed you can't relock an unlockable)
} conditionset_t; };
// Emblem information // Emblem information
#define ET_GLOBAL 0 // Emblem with a position in space #define ET_GLOBAL 0 // Emblem with a position in space
@ -69,7 +69,7 @@ typedef struct
// Map emblem flags // Map emblem flags
#define ME_ENCORE 1 #define ME_ENCORE 1
typedef struct struct emblem_t
{ {
UINT8 type; ///< Emblem type UINT8 type; ///< Emblem type
INT16 tag; ///< Tag of emblem mapthing INT16 tag; ///< Tag of emblem mapthing
@ -79,8 +79,8 @@ typedef struct
INT32 var; ///< If needed, specifies information on the target amount to achieve (or target skin) INT32 var; ///< If needed, specifies information on the target amount to achieve (or target skin)
char hint[110]; ///< Hint for emblem hints menu char hint[110]; ///< Hint for emblem hints menu
UINT8 collected; ///< Do you have this emblem? UINT8 collected; ///< Do you have this emblem?
} emblem_t; };
typedef struct struct extraemblem_t
{ {
char name[20]; ///< Name of the goal (used in the "emblem awarded" cecho) char name[20]; ///< Name of the goal (used in the "emblem awarded" cecho)
char description[40]; ///< Description of goal (used in statistics) char description[40]; ///< Description of goal (used in statistics)
@ -89,10 +89,10 @@ typedef struct
UINT8 sprite; ///< emblem sprite to use, 0 - 25 UINT8 sprite; ///< emblem sprite to use, 0 - 25
UINT16 color; ///< skincolor to use UINT16 color; ///< skincolor to use
UINT8 collected; ///< Do you have this emblem? UINT8 collected; ///< Do you have this emblem?
} extraemblem_t; };
// Unlockable information // Unlockable information
typedef struct struct unlockable_t
{ {
char name[64]; char name[64];
char objective[64]; char objective[64];
@ -103,7 +103,7 @@ typedef struct
UINT8 nocecho; UINT8 nocecho;
UINT8 nochecklist; UINT8 nochecklist;
UINT8 unlocked; UINT8 unlocked;
} unlockable_t; };
#define SECRET_NONE 0 // Does nil. Use with levels locked by UnlockRequired #define SECRET_NONE 0 // Does nil. Use with levels locked by UnlockRequired
#define SECRET_HEADER 1 // Does nothing on its own, just serves as a header for the menu #define SECRET_HEADER 1 // Does nothing on its own, just serves as a header for the menu

View file

@ -29,11 +29,11 @@
#pragma warning(disable : 4706) #pragma warning(disable : 4706)
#endif #endif
typedef struct mdllistitem_s struct mdllistitem_t
{ {
struct mdllistitem_s *next; mdllistitem_t *next;
struct mdllistitem_s **prev; mdllistitem_t **prev;
} mdllistitem_t; };
FUNCINLINE static ATTRINLINE void M_DLListInsert(mdllistitem_t *item, mdllistitem_t **head) FUNCINLINE static ATTRINLINE void M_DLListInsert(mdllistitem_t *item, mdllistitem_t **head)
{ {

View file

@ -333,11 +333,11 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x)
return INT32_MAX; return INT32_MAX;
} }
typedef struct struct vector2_t
{ {
fixed_t x; fixed_t x;
fixed_t y; fixed_t y;
} vector2_t; };
vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y); vector2_t *FV2_Load(vector2_t *vec, fixed_t x, fixed_t y);
vector2_t *FV2_UnLoad(vector2_t *vec, fixed_t *x, fixed_t *y); vector2_t *FV2_UnLoad(vector2_t *vec, fixed_t *x, fixed_t *y);
@ -361,10 +361,10 @@ boolean FV2_Equal(const vector2_t *a_1, const vector2_t *a_2);
fixed_t FV2_Dot(const vector2_t *a_1, const vector2_t *a_2); fixed_t FV2_Dot(const vector2_t *a_1, const vector2_t *a_2);
vector2_t *FV2_Point2Vec (const vector2_t *point1, const vector2_t *point2, vector2_t *a_o); vector2_t *FV2_Point2Vec (const vector2_t *point1, const vector2_t *point2, vector2_t *a_o);
typedef struct struct vector3_t
{ {
fixed_t x, y, z; fixed_t x, y, z;
} vector3_t; };
vector3_t *FV3_Load(vector3_t *vec, fixed_t x, fixed_t y, fixed_t z); vector3_t *FV3_Load(vector3_t *vec, fixed_t x, fixed_t y, fixed_t z);
vector3_t *FV3_UnLoad(vector3_t *vec, fixed_t *x, fixed_t *y, fixed_t *z); vector3_t *FV3_UnLoad(vector3_t *vec, fixed_t *x, fixed_t *y, fixed_t *z);
@ -401,10 +401,10 @@ vector3_t *FV3_IntersectionPoint(const vector3_t *vNormal, const vector3_t *vLin
UINT8 FV3_PointOnLineSide(const vector3_t *point, const vector3_t *line); UINT8 FV3_PointOnLineSide(const vector3_t *point, const vector3_t *line);
boolean FV3_PointInsideBox(const vector3_t *point, const vector3_t *box); boolean FV3_PointInsideBox(const vector3_t *point, const vector3_t *box);
typedef struct struct matrix_t
{ {
fixed_t m[16]; fixed_t m[16];
} matrix_t; };
void FM_LoadIdentity(matrix_t* matrix); void FM_LoadIdentity(matrix_t* matrix);
void FM_CreateObjectMatrix(matrix_t *matrix, fixed_t x, fixed_t y, fixed_t z, fixed_t anglex, fixed_t angley, fixed_t anglez, fixed_t upx, fixed_t upy, fixed_t upz, fixed_t radius); void FM_CreateObjectMatrix(matrix_t *matrix, fixed_t x, fixed_t y, fixed_t z, fixed_t anglex, fixed_t angley, fixed_t anglez, fixed_t upx, fixed_t upy, fixed_t upz, fixed_t radius);

View file

@ -38,22 +38,22 @@ extern int ps_checkposition_calls;
extern precise_t ps_lua_thinkframe_time; extern precise_t ps_lua_thinkframe_time;
extern int ps_lua_mobjhooks; extern int ps_lua_mobjhooks;
typedef struct struct ps_hookinfo_t
{ {
precise_t time_taken; precise_t time_taken;
char short_src[LUA_IDSIZE]; char short_src[LUA_IDSIZE];
} ps_hookinfo_t; };
void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src); void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src);
typedef struct struct ps_botinfo_t
{ {
boolean isBot; boolean isBot;
precise_t total; precise_t total;
precise_t prediction; // K_CreateBotPrediction precise_t prediction; // K_CreateBotPrediction
precise_t nudge; // K_NudgePredictionTowardsObjects precise_t nudge; // K_NudgePredictionTowardsObjects
precise_t item; // K_BotItemUsage precise_t item; // K_BotItemUsage
} ps_botinfo_t; };
extern ps_botinfo_t ps_bots[MAXPLAYERS]; extern ps_botinfo_t ps_bots[MAXPLAYERS];

View file

@ -13,17 +13,17 @@
#ifndef M_QUEUE_H #ifndef M_QUEUE_H
#define M_QUEUE_H #define M_QUEUE_H
typedef struct mqueueitem_s struct mqueueitem_t
{ {
struct mqueueitem_s *next; mqueueitem_t *next;
} mqueueitem_t; };
typedef struct mqueue_s struct mqueue_t
{ {
mqueueitem_t head; mqueueitem_t head;
mqueueitem_t *tail; mqueueitem_t *tail;
mqueueitem_t *rover; mqueueitem_t *rover;
} mqueue_t; };
void M_QueueInit(mqueue_t *queue); void M_QueueInit(mqueue_t *queue);
void M_QueueInsert(mqueueitem_t *item, mqueue_t *queue); void M_QueueInsert(mqueueitem_t *item, mqueue_t *queue);

View file

@ -27,16 +27,16 @@ typedef union
} ATTRPACK msg_header_t; } ATTRPACK msg_header_t;
// Keep this structure 8 bytes aligned (current size is 80) // Keep this structure 8 bytes aligned (current size is 80)
typedef struct struct msg_server_t
{ {
msg_header_t header; msg_header_t header;
char ip[16]; char ip[16];
char port[8]; char port[8];
char contact[32]; char contact[32];
char version[8]; // format is: x.yy.z (like 1.30.2 or 1.31) char version[8]; // format is: x.yy.z (like 1.30.2 or 1.31)
} ATTRPACK msg_server_t; } ATTRPACK;
typedef struct struct msg_ban_t
{ {
msg_header_t header; msg_header_t header;
char ipstart[16]; char ipstart[16];
@ -44,7 +44,7 @@ typedef struct
char endstamp[32]; char endstamp[32];
char reason[255]; char reason[255];
INT32 hostonly; INT32 hostonly;
} ATTRPACK msg_ban_t; } ATTRPACK;
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma pack() #pragma pack()

View file

@ -315,6 +315,7 @@ void A_ItemPop(mobj_t *actor);
void A_JawzExplode(mobj_t *actor); void A_JawzExplode(mobj_t *actor);
void A_SSMineSearch(mobj_t *actor); void A_SSMineSearch(mobj_t *actor);
void A_SSMineExplode(mobj_t *actor); void A_SSMineExplode(mobj_t *actor);
void A_SSMineFlash(mobj_t *actor);
void A_LandMineExplode(mobj_t *actor); void A_LandMineExplode(mobj_t *actor);
void A_BallhogExplode(mobj_t *actor); void A_BallhogExplode(mobj_t *actor);
void A_LightningFollowPlayer(mobj_t *actor); void A_LightningFollowPlayer(mobj_t *actor);
@ -750,9 +751,6 @@ boolean P_LookForPlayers(mobj_t *actor, boolean allaround, boolean tracer, fixed
if (player->mo->health <= 0) if (player->mo->health <= 0)
continue; // dead continue; // dead
if (player->bot)
continue; // ignore bots
if (dist > 0 if (dist > 0
&& P_AproxDistance(P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist) && P_AproxDistance(P_AproxDistance(player->mo->x - actor->x, player->mo->y - actor->y), player->mo->z - actor->z) > dist)
continue; // Too far away continue; // Too far away
@ -13120,14 +13118,21 @@ void A_SSMineExplode(mobj_t *actor)
{ {
INT32 locvar1 = var1; INT32 locvar1 = var1;
tic_t delay;
if (LUA_CallAction(A_SSMINEEXPLODE, actor)) if (LUA_CallAction(A_SSMINEEXPLODE, actor))
return; return;
if (actor->flags2 & MF2_DEBRIS) if (actor->flags2 & MF2_DEBRIS)
return; return;
K_SpawnMineExplosion(actor, (actor->target && actor->target->player) ? actor->target->player->skincolor : SKINCOLOR_KETCHUP); delay = K_MineExplodeAttack(actor, (3*actor->info->painchance)>>1, (boolean)locvar1);
K_MineExplodeAttack(actor, (3*actor->info->painchance)>>1, (boolean)locvar1); K_SpawnMineExplosion(actor, (actor->target && actor->target->player) ? actor->target->player->skincolor : SKINCOLOR_KETCHUP, delay);
}
void A_SSMineFlash(mobj_t *actor)
{
K_MineFlashScreen(actor);
} }
void A_LandMineExplode(mobj_t *actor) void A_LandMineExplode(mobj_t *actor)
@ -13138,21 +13143,27 @@ void A_LandMineExplode(mobj_t *actor)
INT32 i; INT32 i;
mobj_t *smoldering; mobj_t *smoldering;
tic_t delay = actor->reactiontime;
if (LUA_CallAction(A_LANDMINEEXPLODE, actor)) if (LUA_CallAction(A_LANDMINEEXPLODE, actor))
return; return;
if (delay == 0)
{
delay = 8;
}
// we'll base the explosion "timer" off of some stupid variable like uh... cvmem! // we'll base the explosion "timer" off of some stupid variable like uh... cvmem!
// Yeah let's use cvmem since nobody uses that // Yeah let's use cvmem since nobody uses that
if (actor->target && !P_MobjWasRemoved(actor->target)) if (actor->target && !P_MobjWasRemoved(actor->target))
colour = actor->target->color; colour = actor->target->color;
K_MineFlashScreen(actor);
// Spawn smoke remains: // Spawn smoke remains:
smoldering = P_SpawnMobj(actor->x, actor->y, actor->z, MT_SMOLDERING); smoldering = P_SpawnMobj(actor->x, actor->y, actor->z, MT_SMOLDERING);
P_SetScale(smoldering, actor->scale); P_SetScale(smoldering, actor->scale);
smoldering->tics = TICRATE*3; smoldering->tics = TICRATE*3;
smoldering->hitlag = delay;
actor->fuse = actor->tics; // disappear when this state ends. actor->fuse = actor->tics; // disappear when this state ends.
@ -13162,6 +13173,8 @@ void A_LandMineExplode(mobj_t *actor)
expl = P_SpawnMobj(actor->x, actor->y, actor->z + actor->scale, MT_BOOMEXPLODE); expl = P_SpawnMobj(actor->x, actor->y, actor->z + actor->scale, MT_BOOMEXPLODE);
expl->color = colour; expl->color = colour;
expl->tics = (i+1); expl->tics = (i+1);
expl->hitlag = delay;
expl->renderflags |= RF_DONTDRAW;
//K_MatchGenericExtraFlags(expl, actor); //K_MatchGenericExtraFlags(expl, actor);
P_SetScale(expl, actor->scale*4); P_SetScale(expl, actor->scale*4);
@ -13172,6 +13185,8 @@ void A_LandMineExplode(mobj_t *actor)
// 100/45 = 2.22 fu/t // 100/45 = 2.22 fu/t
expl->momz = ((i+1)*actor->scale*5/2)*P_MobjFlip(expl); expl->momz = ((i+1)*actor->scale*5/2)*P_MobjFlip(expl);
} }
K_SpawnBrolyKi(actor, delay);
} }
void A_BallhogExplode(mobj_t *actor) void A_BallhogExplode(mobj_t *actor)

View file

@ -2181,6 +2181,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
K_SpinPlayer(player, inflictor, source, KSPIN_WIPEOUT); K_SpinPlayer(player, inflictor, source, KSPIN_WIPEOUT);
K_KartPainEnergyFling(player); K_KartPainEnergyFling(player);
break; break;
case DMG_VOLTAGE:
case DMG_NORMAL: case DMG_NORMAL:
default: default:
K_SpinPlayer(player, inflictor, source, KSPIN_SPINOUT); K_SpinPlayer(player, inflictor, source, KSPIN_SPINOUT);

View file

@ -80,7 +80,7 @@ void P_RemoveThinker(thinker_t *thinker);
// //
// P_USER // P_USER
// //
typedef struct camera_s struct camera_t
{ {
boolean chase; boolean chase;
angle_t aiming; angle_t aiming;
@ -96,7 +96,7 @@ typedef struct camera_s
//More drawing info: to determine current sprite. //More drawing info: to determine current sprite.
angle_t angle; // orientation angle_t angle; // orientation
struct subsector_s *subsector; subsector_t *subsector;
// The closest interval over all contacted Sectors (or Things). // The closest interval over all contacted Sectors (or Things).
fixed_t floorz; fixed_t floorz;
@ -119,7 +119,7 @@ typedef struct camera_s
// Interpolation data // Interpolation data
fixed_t old_x, old_y, old_z; fixed_t old_x, old_y, old_z;
angle_t old_angle, old_aiming; angle_t old_angle, old_aiming;
} camera_t; };
// demo freecam or something before i commit die // demo freecam or something before i commit die
struct demofreecam_s { struct demofreecam_s {
@ -246,11 +246,11 @@ typedef enum
NUMJINGLES NUMJINGLES
} jingletype_t; } jingletype_t;
typedef struct struct jingle_t
{ {
char musname[7]; char musname[7];
boolean looping; boolean looping;
} jingle_t; };
extern jingle_t jingleinfo[NUMJINGLES]; extern jingle_t jingleinfo[NUMJINGLES];
@ -381,7 +381,7 @@ void P_InternalFlickyHop(mobj_t *actor, fixed_t momz, fixed_t momh, angle_t angl
// P_MAP // P_MAP
// //
typedef struct tm_s struct tm_t
{ {
mobj_t *thing; mobj_t *thing;
fixed_t x, y; fixed_t x, y;
@ -411,7 +411,7 @@ typedef struct tm_s
// set by PIT_CheckLine() for any line that stopped the PIT_CheckLine() // set by PIT_CheckLine() for any line that stopped the PIT_CheckLine()
// that is, for any line which is 'solid' // that is, for any line which is 'solid'
line_t *blockingline; line_t *blockingline;
} tm_t; };
extern tm_t tm; extern tm_t tm;
@ -431,12 +431,12 @@ void P_UnsetThingPosition(mobj_t *thing);
void P_SetThingPosition(mobj_t *thing); void P_SetThingPosition(mobj_t *thing);
void P_SetUnderlayPosition(mobj_t *thing); void P_SetUnderlayPosition(mobj_t *thing);
typedef struct TryMoveResult_s struct TryMoveResult_t
{ {
boolean success; boolean success;
line_t *line; line_t *line;
mobj_t *mo; mobj_t *mo;
} TryMoveResult_t; };
boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y, TryMoveResult_t *result); boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y, TryMoveResult_t *result);
boolean P_CheckMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, TryMoveResult_t *result); boolean P_CheckMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff, TryMoveResult_t *result);
@ -496,7 +496,7 @@ extern mobj_t **blocklinks; // for thing chains
// //
// P_INTER // P_INTER
// //
typedef struct BasicFF_s struct BasicFF_t
{ {
INT32 ForceX; ///< The X of the Force's Vel INT32 ForceX; ///< The X of the Force's Vel
INT32 ForceY; ///< The Y of the Force's Vel INT32 ForceY; ///< The Y of the Force's Vel
@ -506,7 +506,7 @@ typedef struct BasicFF_s
INT32 Gain; ///< /The gain to be applied to the effect, in the range from 0 through 10,000. INT32 Gain; ///< /The gain to be applied to the effect, in the range from 0 through 10,000.
//All, CONSTANTFORCE <20>10,000 to 10,000 //All, CONSTANTFORCE <20>10,000 to 10,000
INT32 Magnitude; ///< Magnitude of the effect, in the range from 0 through 10,000. INT32 Magnitude; ///< Magnitude of the effect, in the range from 0 through 10,000.
} BasicFF_t; };
/* Damage/death types, for P_DamageMobj and related */ /* Damage/death types, for P_DamageMobj and related */
//// Damage types //// Damage types
@ -516,6 +516,7 @@ typedef struct BasicFF_s
#define DMG_TUMBLE 0x03 #define DMG_TUMBLE 0x03
#define DMG_STING 0x04 #define DMG_STING 0x04
#define DMG_KARMA 0x05 // Karma Bomb explosion -- works like DMG_EXPLODE, but steals half of their bumpers & deletes the rest #define DMG_KARMA 0x05 // Karma Bomb explosion -- works like DMG_EXPLODE, but steals half of their bumpers & deletes the rest
#define DMG_VOLTAGE 0x06
//// Death types - cannot be combined with damage types //// Death types - cannot be combined with damage types
#define DMG_INSTAKILL 0x80 #define DMG_INSTAKILL 0x80
#define DMG_DEATHPIT 0x81 #define DMG_DEATHPIT 0x81

View file

@ -1464,6 +1464,11 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
} }
} }
// This code is causing conflicts for Ring Racers,
// as solid objects cause bumping. If you need to
// bring back this code for a moving platform-style
// object, separate it properly.
#if 0
if ((tm.thing->flags & MF_SPRING || tm.thing->type == MT_STEAM || tm.thing->type == MT_SPIKE || tm.thing->type == MT_WALLSPIKE) && (thing->player)) if ((tm.thing->flags & MF_SPRING || tm.thing->type == MT_STEAM || tm.thing->type == MT_SPIKE || tm.thing->type == MT_WALLSPIKE) && (thing->player))
; // springs, gas jets and springs should never be able to step up onto a player ; // springs, gas jets and springs should never be able to step up onto a player
// z checking at last // z checking at last
@ -1562,6 +1567,7 @@ static BlockItReturn_t PIT_CheckThing(mobj_t *thing)
} }
} }
} }
#endif
// not solid not blocked // not solid not blocked
return BMIT_CONTINUE; return BMIT_CONTINUE;

View file

@ -534,7 +534,7 @@ P_GetMidtextureTopBottom
texbottom = back->floorheight + side->rowoffset; texbottom = back->floorheight + side->rowoffset;
textop = back->ceilingheight + side->rowoffset; textop = back->ceilingheight + side->rowoffset;
} }
else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_MIDPEG)) else if (linedef->flags & ML_MIDPEG)
{ {
texbottom = back->floorheight + side->rowoffset; texbottom = back->floorheight + side->rowoffset;
textop = texbottom + texheight*(side->repeatcnt+1); textop = texbottom + texheight*(side->repeatcnt+1);
@ -553,7 +553,7 @@ P_GetMidtextureTopBottom
texbottom += side->rowoffset; texbottom += side->rowoffset;
textop += side->rowoffset; textop += side->rowoffset;
} }
else if (!!(linedef->flags & ML_DONTPEGBOTTOM) ^ !!(linedef->flags & ML_MIDPEG)) else if (linedef->flags & ML_MIDPEG)
{ {
texbottom += side->rowoffset; texbottom += side->rowoffset;
textop = texbottom + texheight*(side->repeatcnt+1); textop = texbottom + texheight*(side->repeatcnt+1);

View file

@ -20,12 +20,12 @@
// //
// P_MAPUTL // P_MAPUTL
// //
typedef struct struct divline_t
{ {
fixed_t x, y, dx, dy; fixed_t x, y, dx, dy;
} divline_t; };
typedef struct struct intercept_t
{ {
fixed_t frac; // along trace line fixed_t frac; // along trace line
boolean isaline; boolean isaline;
@ -34,7 +34,7 @@ typedef struct
mobj_t *thing; mobj_t *thing;
line_t *line; line_t *line;
} d; } d;
} intercept_t; };
typedef boolean (*traverser_t)(intercept_t *in); typedef boolean (*traverser_t)(intercept_t *in);

View file

@ -4546,7 +4546,7 @@ boolean P_SupermanLook4Players(mobj_t *actor)
{ {
if (playeringame[c] && !players[c].spectator) if (playeringame[c] && !players[c].spectator)
{ {
if (!players[c].mo || players[c].bot) if (!players[c].mo)
continue; continue;
if (players[c].mo->health <= 0) if (players[c].mo->health <= 0)
@ -5895,9 +5895,13 @@ static void P_MobjSceneryThink(mobj_t *mobj)
K_MatchGenericExtraFlags(smoke, mobj); K_MatchGenericExtraFlags(smoke, mobj);
smoke->scale = mobj->scale * 2; smoke->scale = mobj->scale * 2;
smoke->destscale = mobj->scale * 6; smoke->destscale = mobj->scale * 6;
smoke->momz = P_RandomRange(PR_SMOLDERING, 4, 9)*FRACUNIT*P_MobjFlip(smoke); smoke->momz = P_RandomRange(PR_SMOLDERING, 4, 9)*mobj->scale*P_MobjFlip(smoke);
} }
break; break;
case MT_SMOKE:
case MT_BOOMEXPLODE:
mobj->renderflags &= ~(RF_DONTDRAW);
break;
case MT_BOOMPARTICLE: case MT_BOOMPARTICLE:
{ {
fixed_t x = P_RandomRange(PR_EXPLOSION, -16, 16)*mobj->scale; fixed_t x = P_RandomRange(PR_EXPLOSION, -16, 16)*mobj->scale;
@ -6393,15 +6397,121 @@ static void P_MobjSceneryThink(mobj_t *mobj)
break; break;
case MT_BATTLECAPSULE_PIECE: case MT_BATTLECAPSULE_PIECE:
if (mobj->extravalue2) if (mobj->extravalue2)
{
mobj->frame |= FF_VERTICALFLIP; mobj->frame |= FF_VERTICALFLIP;
}
else else
{
mobj->frame &= ~FF_VERTICALFLIP; mobj->frame &= ~FF_VERTICALFLIP;
}
if (mobj->flags2 & MF2_OBJECTFLIP) if (mobj->flags2 & MF2_OBJECTFLIP)
{
mobj->eflags |= MFE_VERTICALFLIP; mobj->eflags |= MFE_VERTICALFLIP;
}
if (mobj->tics > 0) if (mobj->tics > 0)
{
// Despawning.
mobj->renderflags ^= RF_DONTDRAW; mobj->renderflags ^= RF_DONTDRAW;
}
else
{
statenum_t state = (statenum_t)(mobj->state - states);
mobj_t *owner = mobj->target;
fixed_t newx, newy, newz;
SINT8 flip;
if (owner == NULL || P_MobjWasRemoved(owner) == true)
{
// Exit early.
break;
}
newx = owner->x;
newy = owner->y;
newz = P_GetMobjFeet(owner);
flip = P_MobjFlip(owner); // Flying capsules needs flipped sprites, but not flipped gravity
if (owner->extravalue1)
{
flip = -flip;
newz += owner->height;
}
mobj->scale = owner->scale;
mobj->destscale = owner->destscale;
mobj->scalespeed = owner->scalespeed;
mobj->extravalue2 = owner->extravalue1;
mobj->flags2 = (mobj->flags2 & ~MF2_OBJECTFLIP) | (owner->flags2 & MF2_OBJECTFLIP);
switch (state)
{
case S_BATTLECAPSULE_TOP:
{
newz += (80 * owner->scale * flip);
break;
}
case S_BATTLECAPSULE_BUTTON:
{
newz += (120 * owner->scale * flip);
break;
}
case S_BATTLECAPSULE_SUPPORT:
case S_BATTLECAPSULE_SUPPORTFLY:
case S_KARMAWHEEL:
{
fixed_t offx = 36 * owner->scale;
fixed_t offy = 36 * owner->scale;
if (mobj->extravalue1 & 1)
{
offx = -offx;
}
if (mobj->extravalue1 > 1)
{
offy = -offy;
}
newx += offx;
newy += offy;
break;
}
case S_BATTLECAPSULE_SIDE1:
case S_BATTLECAPSULE_SIDE2:
{
#define inradius 3797355 // Precalculated
#ifndef inradius
fixed_t inradius = FixedDiv(48 << FRACBITS, 2 * FINETANGENT((((ANGLE_180 / 8) + ANGLE_90) >> ANGLETOFINESHIFT) & 4095));
#endif
fixed_t offset = FixedMul(inradius, owner->scale);
angle_t angle = (ANGLE_45 * mobj->extravalue1);
newx += FixedMul(offset, FINECOSINE(angle >> ANGLETOFINESHIFT));
newy += FixedMul(offset, FINESINE(angle >> ANGLETOFINESHIFT));
newz += (12 * owner->scale * flip);
mobj->angle = angle + ANGLE_90;
break;
#undef inradius
}
default:
{
break;
}
}
mobj->momx = newx - mobj->x;
mobj->momy = newy - mobj->y;
mobj->momz = newz - mobj->z;
}
break; break;
case MT_SPINDASHWIND: case MT_SPINDASHWIND:
case MT_DRIFTELECTRICSPARK: case MT_DRIFTELECTRICSPARK:
@ -9050,8 +9160,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
{ {
SINT8 realflip = P_MobjFlip(mobj); SINT8 realflip = P_MobjFlip(mobj);
SINT8 flip = realflip; // Flying capsules needs flipped sprites, but not flipped gravity SINT8 flip = realflip; // Flying capsules needs flipped sprites, but not flipped gravity
fixed_t bottom;
mobj_t *cur;
if (mobj->extravalue1) if (mobj->extravalue1)
{ {
@ -9156,67 +9264,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
} }
} }
} }
if (flip == -1)
bottom = mobj->z + mobj->height;
else
bottom = mobj->z;
cur = mobj->hnext;
// Move each piece to the proper position
while (cur && !P_MobjWasRemoved(cur))
{
fixed_t newx = mobj->x;
fixed_t newy = mobj->y;
fixed_t newz = bottom;
statenum_t state = (statenum_t)(cur->state-states);
cur->scale = mobj->scale;
cur->destscale = mobj->destscale;
cur->scalespeed = mobj->scalespeed;
cur->extravalue2 = mobj->extravalue1;
cur->flags2 = (cur->flags2 & ~MF2_OBJECTFLIP)|(mobj->flags2 & MF2_OBJECTFLIP);
if (state == S_BATTLECAPSULE_TOP)
newz += (80 * mobj->scale * flip);
else if (state == S_BATTLECAPSULE_BUTTON)
newz += (108 * mobj->scale * flip);
else if (state == S_BATTLECAPSULE_SUPPORT
|| state == S_BATTLECAPSULE_SUPPORTFLY
|| state == S_KARMAWHEEL)
{
fixed_t offx = mobj->radius;
fixed_t offy = mobj->radius;
if (cur->extravalue1 & 1)
offx = -offx;
if (cur->extravalue1 > 1)
offy = -offy;
newx += offx;
newy += offy;
}
else if (state == S_BATTLECAPSULE_SIDE1
|| state == S_BATTLECAPSULE_SIDE2)
{
fixed_t offset = 48 * mobj->scale;
angle_t angle = (ANGLE_45 * cur->extravalue1);
newx += FixedMul(offset, FINECOSINE(angle >> ANGLETOFINESHIFT));
newy += FixedMul(offset, FINESINE(angle >> ANGLETOFINESHIFT));
newz += (12 * mobj->scale * flip);
cur->angle = angle + ANGLE_90;
}
P_MoveOrigin(cur, newx, newy, newz);
cur = cur->hnext;
}
} }
break; break;
case MT_RANDOMITEM: case MT_RANDOMITEM:
@ -10008,6 +10055,7 @@ static void P_DefaultMobjShadowScale(mobj_t *thing)
{ {
case MT_PLAYER: case MT_PLAYER:
case MT_KART_LEFTOVER: case MT_KART_LEFTOVER:
case MT_BATTLECAPSULE:
thing->shadowscale = FRACUNIT; thing->shadowscale = FRACUNIT;
break; break;
case MT_SMALLMACE: case MT_SMALLMACE:

View file

@ -270,7 +270,7 @@ typedef enum {
} precipflag_t; } precipflag_t;
// Map Object definition. // Map Object definition.
typedef struct mobj_s struct mobj_t
{ {
// List: thinker links. // List: thinker links.
thinker_t thinker; thinker_t thinker;
@ -284,8 +284,8 @@ typedef struct mobj_s
fixed_t old_x2, old_y2, old_z2; fixed_t old_x2, old_y2, old_z2;
// More list: links in sector (if needed) // More list: links in sector (if needed)
struct mobj_s *snext; mobj_t *snext;
struct mobj_s **sprev; // killough 8/11/98: change to ptr-to-ptr mobj_t **sprev; // killough 8/11/98: change to ptr-to-ptr
// More drawing info: to determine current sprite. // More drawing info: to determine current sprite.
angle_t angle, pitch, roll; // orientation angle_t angle, pitch, roll; // orientation
@ -302,17 +302,17 @@ typedef struct mobj_s
fixed_t spritexoffset, spriteyoffset; fixed_t spritexoffset, spriteyoffset;
fixed_t old_spritexscale, old_spriteyscale; fixed_t old_spritexscale, old_spriteyscale;
fixed_t old_spritexoffset, old_spriteyoffset; fixed_t old_spritexoffset, old_spriteyoffset;
struct pslope_s *floorspriteslope; // The slope that the floorsprite is rotated by pslope_t *floorspriteslope; // The slope that the floorsprite is rotated by
struct msecnode_s *touching_sectorlist; // a linked list of sectors where this object appears msecnode_t *touching_sectorlist; // a linked list of sectors where this object appears
struct subsector_s *subsector; // Subsector the mobj resides in. subsector_t *subsector; // Subsector the mobj resides in.
// The closest interval over all contacted sectors (or things). // The closest interval over all contacted sectors (or things).
fixed_t floorz; // Nearest floor below. fixed_t floorz; // Nearest floor below.
fixed_t ceilingz; // Nearest ceiling above. fixed_t ceilingz; // Nearest ceiling above.
struct ffloor_s *floorrover; // FOF referred by floorz ffloor_t *floorrover; // FOF referred by floorz
struct ffloor_s *ceilingrover; // FOF referred by ceilingz ffloor_t *ceilingrover; // FOF referred by ceilingz
fixed_t floordrop; fixed_t floordrop;
fixed_t ceilingdrop; fixed_t ceilingdrop;
@ -337,15 +337,15 @@ typedef struct mobj_s
// Interaction info, by BLOCKMAP. // Interaction info, by BLOCKMAP.
// Links in blocks (if needed). // Links in blocks (if needed).
struct mobj_s *bnext; mobj_t *bnext;
struct mobj_s **bprev; // killough 8/11/98: change to ptr-to-ptr mobj_t **bprev; // killough 8/11/98: change to ptr-to-ptr
// Additional pointers for NiGHTS hoops // Additional pointers for NiGHTS hoops
struct mobj_s *hnext; mobj_t *hnext;
struct mobj_s *hprev; mobj_t *hprev;
// One last pointer for kart item lists // One last pointer for kart item lists
struct mobj_s *itnext; mobj_t *itnext;
INT32 health; // for player this is rings + 1 -- no it isn't, not any more!! INT32 health; // for player this is rings + 1 -- no it isn't, not any more!!
@ -353,7 +353,7 @@ typedef struct mobj_s
angle_t movedir; // dirtype_t 0-7; also used by Deton for up/down angle angle_t movedir; // dirtype_t 0-7; also used by Deton for up/down angle
INT32 movecount; // when 0, select a new dir INT32 movecount; // when 0, select a new dir
struct mobj_s *target; // Thing being chased/attacked (or NULL), and originator for missiles. mobj_t *target; // Thing being chased/attacked (or NULL), and originator for missiles.
INT32 reactiontime; // If not 0, don't attack yet. INT32 reactiontime; // If not 0, don't attack yet.
@ -361,13 +361,13 @@ typedef struct mobj_s
// Additional info record for player avatars only. // Additional info record for player avatars only.
// Only valid if type == MT_PLAYER // Only valid if type == MT_PLAYER
struct player_s *player; player_t *player;
INT32 lastlook; // Player number last looked for. INT32 lastlook; // Player number last looked for.
mapthing_t *spawnpoint; // Used for CTF flags, objectplace, and a handful other applications. mapthing_t *spawnpoint; // Used for CTF flags, objectplace, and a handful other applications.
struct mobj_s *tracer; // Thing being chased/attacked for tracers. mobj_t *tracer; // Thing being chased/attacked for tracers.
fixed_t friction; fixed_t friction;
fixed_t movefactor; fixed_t movefactor;
@ -394,7 +394,7 @@ typedef struct mobj_s
INT32 cusval; INT32 cusval;
INT32 cvmem; INT32 cvmem;
struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?) pslope_t *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?)
boolean resetinterp; // if true, some fields should not be interpolated (see R_InterpolateMobjState implementation) boolean resetinterp; // if true, some fields should not be interpolated (see R_InterpolateMobjState implementation)
boolean colorized; // Whether the mobj uses the rainbow colormap boolean colorized; // Whether the mobj uses the rainbow colormap
@ -405,8 +405,8 @@ typedef struct mobj_s
fixed_t sprxoff, spryoff, sprzoff; // Sprite offsets in real space, does NOT affect position or collision fixed_t sprxoff, spryoff, sprzoff; // Sprite offsets in real space, does NOT affect position or collision
struct terrain_s *terrain; // Terrain definition of the floor this object last hit. NULL when in the air. terrain_t *terrain; // Terrain definition of the floor this object last hit. NULL when in the air.
struct mobj_s *terrainOverlay; // Overlay sprite object for terrain mobj_t *terrainOverlay; // Overlay sprite object for terrain
INT32 hitlag; // Sal-style hit lag, straight from Captain Fetch's jowls INT32 hitlag; // Sal-style hit lag, straight from Captain Fetch's jowls
UINT8 waterskip; // Water skipping counter UINT8 waterskip; // Water skipping counter
@ -414,7 +414,7 @@ typedef struct mobj_s
INT32 dispoffset; INT32 dispoffset;
// WARNING: New fields must be added separately to savegame and Lua. // WARNING: New fields must be added separately to savegame and Lua.
} mobj_t; };
// //
// For precipitation // For precipitation
@ -423,7 +423,7 @@ typedef struct mobj_s
// so please keep the start of the // so please keep the start of the
// structure the same. // structure the same.
// //
typedef struct precipmobj_s struct precipmobj_t
{ {
// List: thinker links. // List: thinker links.
thinker_t thinker; thinker_t thinker;
@ -437,8 +437,8 @@ typedef struct precipmobj_s
fixed_t old_x2, old_y2, old_z2; fixed_t old_x2, old_y2, old_z2;
// More list: links in sector (if needed) // More list: links in sector (if needed)
struct precipmobj_s *snext; precipmobj_t *snext;
struct precipmobj_s **sprev; // killough 8/11/98: change to ptr-to-ptr precipmobj_t **sprev; // killough 8/11/98: change to ptr-to-ptr
// More drawing info: to determine current sprite. // More drawing info: to determine current sprite.
angle_t angle, pitch, roll; // orientation angle_t angle, pitch, roll; // orientation
@ -455,17 +455,17 @@ typedef struct precipmobj_s
fixed_t spritexoffset, spriteyoffset; fixed_t spritexoffset, spriteyoffset;
fixed_t old_spritexscale, old_spriteyscale; fixed_t old_spritexscale, old_spriteyscale;
fixed_t old_spritexoffset, old_spriteyoffset; fixed_t old_spritexoffset, old_spriteyoffset;
struct pslope_s *floorspriteslope; // The slope that the floorsprite is rotated by pslope_t *floorspriteslope; // The slope that the floorsprite is rotated by
struct mprecipsecnode_s *touching_sectorlist; // a linked list of sectors where this object appears mprecipsecnode_t *touching_sectorlist; // a linked list of sectors where this object appears
struct subsector_s *subsector; // Subsector the mobj resides in. subsector_t *subsector; // Subsector the mobj resides in.
// The closest interval over all contacted sectors (or things). // The closest interval over all contacted sectors (or things).
fixed_t floorz; // Nearest floor below. fixed_t floorz; // Nearest floor below.
fixed_t ceilingz; // Nearest ceiling above. fixed_t ceilingz; // Nearest ceiling above.
struct ffloor_s *floorrover; // FOF referred by floorz ffloor_t *floorrover; // FOF referred by floorz
struct ffloor_s *ceilingrover; // FOF referred by ceilingz ffloor_t *ceilingrover; // FOF referred by ceilingz
fixed_t floordrop; fixed_t floordrop;
fixed_t ceilingdrop; fixed_t ceilingdrop;
@ -480,15 +480,15 @@ typedef struct precipmobj_s
INT32 tics; // state tic counter INT32 tics; // state tic counter
state_t *state; state_t *state;
UINT32 flags; // flags from mobjinfo tables UINT32 flags; // flags from mobjinfo tables
} precipmobj_t; };
typedef struct actioncache_s struct actioncache_t
{ {
struct actioncache_s *next; actioncache_t *next;
struct actioncache_s *prev; actioncache_t *prev;
struct mobj_s *mobj; mobj_t *mobj;
INT32 statenum; INT32 statenum;
} actioncache_t; };
extern actioncache_t actioncachehead; extern actioncache_t actioncachehead;

View file

@ -66,7 +66,7 @@ typedef enum
// Polyobject Structure // Polyobject Structure
// //
typedef struct polyobj_s struct polyobj_t
{ {
mdllistitem_t link; // for subsector links; must be first mdllistitem_t link; // for subsector links; must be first
@ -78,7 +78,7 @@ typedef struct polyobj_s
size_t segCount; // number of segs in polyobject size_t segCount; // number of segs in polyobject
size_t numSegsAlloc; // number of segs allocated size_t numSegsAlloc; // number of segs allocated
struct seg_s **segs; // the segs, a reallocating array. seg_t **segs; // the segs, a reallocating array.
size_t numVertices; // number of vertices (generally == segCount) size_t numVertices; // number of vertices (generally == segCount)
size_t numVerticesAlloc; // number of vertices allocated size_t numVerticesAlloc; // number of vertices allocated
@ -88,7 +88,7 @@ typedef struct polyobj_s
size_t numLines; // number of linedefs (generally <= segCount) size_t numLines; // number of linedefs (generally <= segCount)
size_t numLinesAlloc; // number of linedefs allocated size_t numLinesAlloc; // number of linedefs allocated
struct line_s **lines; // linedefs this polyobject must move line_t **lines; // linedefs this polyobject must move
degenmobj_t spawnSpot; // location of spawn spot degenmobj_t spawnSpot; // location of spawn spot
vertex_t centerPt; // center point vertex_t centerPt; // center point
@ -109,28 +109,28 @@ typedef struct polyobj_s
INT32 translucency; // index to translucency tables INT32 translucency; // index to translucency tables
INT16 triggertag; // Tag of linedef executor to trigger on touch INT16 triggertag; // Tag of linedef executor to trigger on touch
struct visplane_s *visplane; // polyobject's visplane, for ease of putting into the list later visplane_t *visplane; // polyobject's visplane, for ease of putting into the list later
// these are saved for netgames, so do not let Lua touch these! // these are saved for netgames, so do not let Lua touch these!
INT32 spawnflags; // Flags the polyobject originally spawned with INT32 spawnflags; // Flags the polyobject originally spawned with
INT32 spawntrans; // Translucency the polyobject originally spawned with INT32 spawntrans; // Translucency the polyobject originally spawned with
} polyobj_t; };
// //
// Polyobject Blockmap Link Structure // Polyobject Blockmap Link Structure
// //
typedef struct polymaplink_s struct polymaplink_t
{ {
mdllistitem_t link; // for blockmap links mdllistitem_t link; // for blockmap links
polyobj_t *po; // pointer to polyobject polyobj_t *po; // pointer to polyobject
} polymaplink_t; };
// //
// Polyobject Special Thinkers // Polyobject Special Thinkers
// //
typedef struct polyrotate_s struct polyrotate_t
{ {
thinker_t thinker; // must be first thinker_t thinker; // must be first
@ -138,9 +138,9 @@ typedef struct polyrotate_s
INT32 speed; // speed of movement per frame INT32 speed; // speed of movement per frame
INT32 distance; // distance to move INT32 distance; // distance to move
UINT8 turnobjs; // turn objects? PTF_ flags UINT8 turnobjs; // turn objects? PTF_ flags
} polyrotate_t; };
typedef struct polymove_s struct polymove_t
{ {
thinker_t thinker; // must be first thinker_t thinker; // must be first
@ -150,7 +150,7 @@ typedef struct polymove_s
fixed_t momy; // y component of speed along angle fixed_t momy; // y component of speed along angle
INT32 distance; // total distance to move INT32 distance; // total distance to move
UINT32 angle; // angle along which to move UINT32 angle; // angle along which to move
} polymove_t; };
// PolyObject waypoint movement return behavior // PolyObject waypoint movement return behavior
typedef enum typedef enum
@ -160,7 +160,7 @@ typedef enum
PWR_COMEBACK, // Repeat sequence in reverse PWR_COMEBACK, // Repeat sequence in reverse
} polywaypointreturn_e; } polywaypointreturn_e;
typedef struct polywaypoint_s struct polywaypoint_t
{ {
thinker_t thinker; // must be first thinker_t thinker; // must be first
@ -172,9 +172,9 @@ typedef struct polywaypoint_s
UINT8 returnbehavior; // behavior after reaching the last waypoint UINT8 returnbehavior; // behavior after reaching the last waypoint
UINT8 continuous; // continuously move - used with PWR_WRAP or PWR_COMEBACK UINT8 continuous; // continuously move - used with PWR_WRAP or PWR_COMEBACK
UINT8 stophere; // Will stop after it reaches the next waypoint UINT8 stophere; // Will stop after it reaches the next waypoint
} polywaypoint_t; };
typedef struct polyslidedoor_s struct polyslidedoor_t
{ {
thinker_t thinker; // must be first thinker_t thinker; // must be first
@ -191,9 +191,9 @@ typedef struct polyslidedoor_s
fixed_t momx; // x component of speed along angle fixed_t momx; // x component of speed along angle
fixed_t momy; // y component of speed along angle fixed_t momy; // y component of speed along angle
UINT8 closing; // if true, is closing UINT8 closing; // if true, is closing
} polyslidedoor_t; };
typedef struct polyswingdoor_s struct polyswingdoor_t
{ {
thinker_t thinker; // must be first thinker_t thinker; // must be first
@ -205,31 +205,31 @@ typedef struct polyswingdoor_s
INT32 initDistance; // initial distance to travel INT32 initDistance; // initial distance to travel
INT32 distance; // current distance to travel INT32 distance; // current distance to travel
UINT8 closing; // if true, is closing UINT8 closing; // if true, is closing
} polyswingdoor_t; };
typedef struct polydisplace_s struct polydisplace_t
{ {
thinker_t thinker; // must be first thinker_t thinker; // must be first
INT32 polyObjNum; INT32 polyObjNum;
struct sector_s *controlSector; sector_t *controlSector;
fixed_t dx; fixed_t dx;
fixed_t dy; fixed_t dy;
fixed_t oldHeights; fixed_t oldHeights;
} polydisplace_t; };
typedef struct polyrotdisplace_s struct polyrotdisplace_t
{ {
thinker_t thinker; // must be first thinker_t thinker; // must be first
INT32 polyObjNum; INT32 polyObjNum;
struct sector_s *controlSector; sector_t *controlSector;
fixed_t rotscale; fixed_t rotscale;
UINT8 turnobjs; UINT8 turnobjs;
fixed_t oldHeights; fixed_t oldHeights;
} polyrotdisplace_t; };
typedef struct polyfade_s struct polyfade_t
{ {
thinker_t thinker; // must be first thinker_t thinker; // must be first
@ -241,7 +241,7 @@ typedef struct polyfade_s
boolean ticbased; boolean ticbased;
INT32 duration; INT32 duration;
INT32 timer; INT32 timer;
} polyfade_t; };
// //
// Line Activation Data Structures // Line Activation Data Structures
@ -261,23 +261,23 @@ typedef enum
PTF_OTHERS = 1<<1, // Turn other mobjs with movement PTF_OTHERS = 1<<1, // Turn other mobjs with movement
} polyturnflags_e; } polyturnflags_e;
typedef struct polyrotdata_s struct polyrotdata_t
{ {
INT32 polyObjNum; // numeric id of polyobject to affect INT32 polyObjNum; // numeric id of polyobject to affect
INT32 direction; // direction of rotation INT32 direction; // direction of rotation
INT32 speed; // angular speed INT32 speed; // angular speed
INT32 distance; // distance to move INT32 distance; // distance to move
UINT8 flags; // TMPR_ flags UINT8 flags; // TMPR_ flags
} polyrotdata_t; };
typedef struct polymovedata_s struct polymovedata_t
{ {
INT32 polyObjNum; // numeric id of polyobject to affect INT32 polyObjNum; // numeric id of polyobject to affect
fixed_t distance; // distance to move fixed_t distance; // distance to move
fixed_t speed; // linear speed fixed_t speed; // linear speed
angle_t angle; // angle of movement angle_t angle; // angle of movement
UINT8 overRide; // if true, will override any action on the object UINT8 overRide; // if true, will override any action on the object
} polymovedata_t; };
typedef enum typedef enum
{ {
@ -285,14 +285,14 @@ typedef enum
PWF_LOOP = 1<<1, // Loop movement (used with PWR_WRAP or PWR_COMEBACK) PWF_LOOP = 1<<1, // Loop movement (used with PWR_WRAP or PWR_COMEBACK)
} polywaypointflags_e; } polywaypointflags_e;
typedef struct polywaypointdata_s struct polywaypointdata_t
{ {
INT32 polyObjNum; // numeric id of polyobject to affect INT32 polyObjNum; // numeric id of polyobject to affect
INT32 sequence; // waypoint sequence # INT32 sequence; // waypoint sequence #
fixed_t speed; // linear speed fixed_t speed; // linear speed
UINT8 returnbehavior; // behavior after reaching the last waypoint UINT8 returnbehavior; // behavior after reaching the last waypoint
UINT8 flags; // PWF_ flags UINT8 flags; // PWF_ flags
} polywaypointdata_t; };
typedef enum typedef enum
{ {
@ -315,7 +315,7 @@ typedef enum
POLY_DOOR_SWING, POLY_DOOR_SWING,
} polydoor_e; } polydoor_e;
typedef struct polydoordata_s struct polydoordata_t
{ {
INT32 polyObjNum; // numeric id of polyobject to affect INT32 polyObjNum; // numeric id of polyobject to affect
INT32 doorType; // polyobj door type INT32 doorType; // polyobj door type
@ -323,31 +323,31 @@ typedef struct polydoordata_s
angle_t angle; // for slide door only, angle of motion angle_t angle; // for slide door only, angle of motion
INT32 distance; // distance to move INT32 distance; // distance to move
INT32 delay; // delay time after opening INT32 delay; // delay time after opening
} polydoordata_t; };
typedef struct polydisplacedata_s struct polydisplacedata_t
{ {
INT32 polyObjNum; INT32 polyObjNum;
struct sector_s *controlSector; sector_t *controlSector;
fixed_t dx; fixed_t dx;
fixed_t dy; fixed_t dy;
} polydisplacedata_t; };
typedef struct polyrotdisplacedata_s struct polyrotdisplacedata_t
{ {
INT32 polyObjNum; INT32 polyObjNum;
struct sector_s *controlSector; sector_t *controlSector;
fixed_t rotscale; fixed_t rotscale;
UINT8 turnobjs; UINT8 turnobjs;
} polyrotdisplacedata_t; };
typedef struct polyflagdata_s struct polyflagdata_t
{ {
INT32 polyObjNum; INT32 polyObjNum;
INT32 speed; INT32 speed;
UINT32 angle; UINT32 angle;
fixed_t momx; fixed_t momx;
} polyflagdata_t; };
typedef enum typedef enum
{ {
@ -358,7 +358,7 @@ typedef enum
TMPF_GHOSTFADE = 1<<4, TMPF_GHOSTFADE = 1<<4,
} textmappolyfade_t; } textmappolyfade_t;
typedef struct polyfadedata_s struct polyfadedata_t
{ {
INT32 polyObjNum; INT32 polyObjNum;
INT32 destvalue; INT32 destvalue;
@ -366,7 +366,7 @@ typedef struct polyfadedata_s
boolean doghostfade; boolean doghostfade;
boolean ticbased; boolean ticbased;
INT32 speed; INT32 speed;
} polyfadedata_t; };
// //
// Functions // Functions

View file

@ -28,14 +28,14 @@ boolean P_LoadNetGame(boolean reloading);
mobj_t *P_FindNewPosition(UINT32 oldposition); mobj_t *P_FindNewPosition(UINT32 oldposition);
typedef struct struct savedata_t
{ {
UINT8 skin; UINT8 skin;
INT32 score; INT32 score;
INT32 lives; INT32 lives;
UINT16 emeralds; UINT16 emeralds;
UINT8 numgameovers; UINT8 numgameovers;
} savedata_t; };
extern savedata_t savedata; extern savedata_t savedata;
extern UINT8 *save_p; extern UINT8 *save_p;

View file

@ -45,7 +45,7 @@ enum
// //
// MAP used flats lookup table // MAP used flats lookup table
// //
typedef struct struct levelflat_t
{ {
char name[9]; // resource name from wad char name[9]; // resource name from wad
@ -85,7 +85,7 @@ typedef struct
void *mipmap; void *mipmap;
void *mippic; void *mippic;
#endif #endif
} levelflat_t; };
extern size_t numlevelflats; extern size_t numlevelflats;
extern levelflat_t *levelflats; extern levelflat_t *levelflats;

View file

@ -334,6 +334,12 @@ static boolean P_CanTraceBlockingLine(seg_t *seg, divline_t *divl, register los_
(void)divl; (void)divl;
if (!(line->flags & ML_TWOSIDED))
{
// stop because it is not two sided anyway
return false;
}
if (P_IsLineBlocking(line, los->compareThing) == true) if (P_IsLineBlocking(line, los->compareThing) == true)
{ {
// This line will always block us // This line will always block us
@ -380,11 +386,16 @@ static boolean P_CanBotTraverse(seg_t *seg, divline_t *divl, register los_t *los
if (los->compareThing->player != NULL && los->alreadyHates == false) if (los->compareThing->player != NULL && los->alreadyHates == false)
{ {
// Treat damage sectors like walls, if you're not already in a bad sector. // Treat damage sectors like walls, if you're not already in a bad sector.
sector_t *front, *back;
vertex_t pos; vertex_t pos;
P_ClosestPointOnLine(los->compareThing->x, los->compareThing->y, line, &pos); P_ClosestPointOnLine(los->compareThing->x, los->compareThing->y, line, &pos);
if (K_BotHatesThisSector(los->compareThing->player, line->frontsector, pos.x, pos.y) front = seg->frontsector;
|| K_BotHatesThisSector(los->compareThing->player, line->backsector, pos.x, pos.y)) back = seg->backsector;
if (K_BotHatesThisSector(los->compareThing->player, front, pos.x, pos.y)
|| K_BotHatesThisSector(los->compareThing->player, back, pos.x, pos.y))
{ {
// This line does not block us, but we don't want to be in it. // This line does not block us, but we don't want to be in it.
return false; return false;

View file

@ -117,16 +117,16 @@ typedef enum {
} dynplanetype_t; } dynplanetype_t;
/// Permit slopes to be dynamically altered through a thinker. /// Permit slopes to be dynamically altered through a thinker.
typedef struct struct dynlineplanethink_t
{ {
thinker_t thinker; thinker_t thinker;
pslope_t *slope; pslope_t *slope;
dynplanetype_t type; dynplanetype_t type;
line_t *sourceline; line_t *sourceline;
fixed_t extent; fixed_t extent;
} dynlineplanethink_t; };
typedef struct struct dynvertexplanethink_t
{ {
thinker_t thinker; thinker_t thinker;
pslope_t *slope; pslope_t *slope;
@ -135,7 +135,7 @@ typedef struct
fixed_t origsecheights[3]; fixed_t origsecheights[3];
fixed_t origvecheights[3]; fixed_t origvecheights[3];
UINT8 relative; UINT8 relative;
} dynvertexplanethink_t; };
void T_DynamicSlopeLine (dynlineplanethink_t* th); void T_DynamicSlopeLine (dynlineplanethink_t* th);
void T_DynamicSlopeVert (dynvertexplanethink_t* th); void T_DynamicSlopeVert (dynvertexplanethink_t* th);

View file

@ -4282,7 +4282,7 @@ boolean P_IsPlayerValid(size_t playernum)
boolean P_CanPlayerTrigger(size_t playernum) boolean P_CanPlayerTrigger(size_t playernum)
{ {
return P_IsPlayerValid(playernum) && !players[playernum].bot; return P_IsPlayerValid(playernum);
} }
/// \todo check continues for proper splitscreen support? /// \todo check continues for proper splitscreen support?
@ -4310,7 +4310,7 @@ static void P_ProcessEggCapsule(player_t *player, sector_t *sector)
mobj_t *mo2; mobj_t *mo2;
INT32 i; INT32 i;
if (player->bot || sector->ceilingdata || sector->floordata) if (sector->ceilingdata || sector->floordata)
return; return;
// Find the center of the Eggtrap and release all the pretty animals! // Find the center of the Eggtrap and release all the pretty animals!
@ -4517,9 +4517,6 @@ static void P_EvaluateDamageType(player_t *player, sector_t *sector, boolean isT
static void P_EvaluateLinedefExecutorTrigger(player_t *player, sector_t *sector, boolean isTouching) static void P_EvaluateLinedefExecutorTrigger(player_t *player, sector_t *sector, boolean isTouching)
{ {
if (player->bot)
return;
if (!sector->triggertag) if (!sector->triggertag)
return; return;

View file

@ -578,17 +578,17 @@ UINT16 P_GetFFloorID(ffloor_t *fflr);
ffloor_t *P_GetFFloorByID(sector_t *sec, UINT16 id); ffloor_t *P_GetFFloorByID(sector_t *sec, UINT16 id);
// Use this when you don't know the type of your thinker data struct but need to access its thinker. // Use this when you don't know the type of your thinker data struct but need to access its thinker.
typedef struct struct thinkerdata_t
{ {
thinker_t thinker; thinker_t thinker;
} thinkerdata_t; };
// //
// P_LIGHTS // P_LIGHTS
// //
/** Fire flicker action structure. /** Fire flicker action structure.
*/ */
typedef struct struct fireflicker_t
{ {
thinker_t thinker; ///< The thinker in use for the effect. thinker_t thinker; ///< The thinker in use for the effect.
sector_t *sector; ///< The sector where action is taking place. sector_t *sector; ///< The sector where action is taking place.
@ -596,29 +596,29 @@ typedef struct
INT32 resetcount; INT32 resetcount;
INT16 maxlight; ///< The brightest light level to use. INT16 maxlight; ///< The brightest light level to use.
INT16 minlight; ///< The darkest light level to use. INT16 minlight; ///< The darkest light level to use.
} fireflicker_t; };
typedef struct struct lightflash_t
{ {
thinker_t thinker; thinker_t thinker;
sector_t *sector; sector_t *sector;
INT32 maxlight; INT32 maxlight;
INT32 minlight; INT32 minlight;
} lightflash_t; };
/** Laser block thinker. /** Laser block thinker.
*/ */
typedef struct struct laserthink_t
{ {
thinker_t thinker; ///< Thinker structure for laser. thinker_t thinker; ///< Thinker structure for laser.
INT16 tag; INT16 tag;
line_t *sourceline; line_t *sourceline;
UINT8 nobosses; UINT8 nobosses;
} laserthink_t; };
/** Strobe light action structure.. /** Strobe light action structure..
*/ */
typedef struct struct strobe_t
{ {
thinker_t thinker; ///< The thinker in use for the effect. thinker_t thinker; ///< The thinker in use for the effect.
sector_t *sector; ///< The sector where the action is taking place. sector_t *sector; ///< The sector where the action is taking place.
@ -627,9 +627,9 @@ typedef struct
INT16 maxlight; ///< The maximum light level to use. INT16 maxlight; ///< The maximum light level to use.
INT32 darktime; ///< How INT32 to use minlight. INT32 darktime; ///< How INT32 to use minlight.
INT32 brighttime; ///< How INT32 to use maxlight. INT32 brighttime; ///< How INT32 to use maxlight.
} strobe_t; };
typedef struct struct glow_t
{ {
thinker_t thinker; thinker_t thinker;
sector_t *sector; sector_t *sector;
@ -637,11 +637,11 @@ typedef struct
INT16 maxlight; INT16 maxlight;
INT16 direction; INT16 direction;
INT16 speed; INT16 speed;
} glow_t; };
/** Thinker struct for fading lights. /** Thinker struct for fading lights.
*/ */
typedef struct struct lightlevel_t
{ {
thinker_t thinker; ///< Thinker in use for the effect. thinker_t thinker; ///< Thinker in use for the effect.
sector_t *sector; ///< Sector where action is taking place. sector_t *sector; ///< Sector where action is taking place.
@ -652,7 +652,7 @@ typedef struct
fixed_t fixedpertic; ///< Fixed point for increment per tic. fixed_t fixedpertic; ///< Fixed point for increment per tic.
// The reason for those two above to be fixed point is to deal with decimal values that would otherwise get trimmed away. // The reason for those two above to be fixed point is to deal with decimal values that would otherwise get trimmed away.
INT32 timer; ///< Internal timer. INT32 timer; ///< Internal timer.
} lightlevel_t; };
#define GLOWSPEED 8 #define GLOWSPEED 8
#define STROBEBRIGHT 5 #define STROBEBRIGHT 5
@ -709,7 +709,7 @@ typedef enum
/** Ceiling movement structure. /** Ceiling movement structure.
*/ */
typedef struct struct ceiling_t
{ {
thinker_t thinker; ///< Thinker for the type of movement. thinker_t thinker; ///< Thinker for the type of movement.
ceiling_e type; ///< Type of movement. ceiling_e type; ///< Type of movement.
@ -728,7 +728,7 @@ typedef struct
INT16 tag; ///< Tag of linedef executor to run when movement is done. INT16 tag; ///< Tag of linedef executor to run when movement is done.
fixed_t origspeed; ///< The original, "real" speed. fixed_t origspeed; ///< The original, "real" speed.
INT32 sourceline; ///< Index of the source linedef INT32 sourceline; ///< Index of the source linedef
} ceiling_t; };
#define CEILSPEED (FRACUNIT) #define CEILSPEED (FRACUNIT)
@ -771,7 +771,7 @@ typedef enum
bridgeFall, bridgeFall,
} elevator_e; } elevator_e;
typedef struct struct floormove_t
{ {
thinker_t thinker; thinker_t thinker;
floor_e type; floor_e type;
@ -786,9 +786,9 @@ typedef struct
fixed_t delaytimer; fixed_t delaytimer;
INT16 tag; INT16 tag;
INT32 sourceline; INT32 sourceline;
} floormove_t; };
typedef struct struct elevator_t
{ {
thinker_t thinker; thinker_t thinker;
elevator_e type; elevator_e type;
@ -807,7 +807,7 @@ typedef struct
fixed_t floorwasheight; // Height the floor WAS at fixed_t floorwasheight; // Height the floor WAS at
fixed_t ceilingwasheight; // Height the ceiling WAS at fixed_t ceilingwasheight; // Height the ceiling WAS at
line_t *sourceline; line_t *sourceline;
} elevator_t; };
typedef enum typedef enum
{ {
@ -816,7 +816,7 @@ typedef enum
CF_REVERSE = 1<<2, // Reverse gravity CF_REVERSE = 1<<2, // Reverse gravity
} crumbleflag_t; } crumbleflag_t;
typedef struct struct crumble_t
{ {
thinker_t thinker; thinker_t thinker;
line_t *sourceline; line_t *sourceline;
@ -830,15 +830,15 @@ typedef struct
fixed_t floorwasheight; // Height the floor WAS at fixed_t floorwasheight; // Height the floor WAS at
fixed_t ceilingwasheight; // Height the ceiling WAS at fixed_t ceilingwasheight; // Height the ceiling WAS at
UINT8 flags; UINT8 flags;
} crumble_t; };
typedef struct struct noenemies_t
{ {
thinker_t thinker; thinker_t thinker;
line_t *sourceline; // Source line of the thinker line_t *sourceline; // Source line of the thinker
} noenemies_t; };
typedef struct struct continuousfall_t
{ {
thinker_t thinker; thinker_t thinker;
sector_t *sector; sector_t *sector;
@ -847,9 +847,9 @@ typedef struct
fixed_t floorstartheight; fixed_t floorstartheight;
fixed_t ceilingstartheight; fixed_t ceilingstartheight;
fixed_t destheight; fixed_t destheight;
} continuousfall_t; };
typedef struct struct bouncecheese_t
{ {
thinker_t thinker; thinker_t thinker;
line_t *sourceline; line_t *sourceline;
@ -859,9 +859,9 @@ typedef struct
fixed_t floorwasheight; fixed_t floorwasheight;
fixed_t ceilingwasheight; fixed_t ceilingwasheight;
boolean low; boolean low;
} bouncecheese_t; };
typedef struct struct mariothink_t
{ {
thinker_t thinker; thinker_t thinker;
sector_t *sector; sector_t *sector;
@ -870,16 +870,16 @@ typedef struct
fixed_t floorstartheight; fixed_t floorstartheight;
fixed_t ceilingstartheight; fixed_t ceilingstartheight;
INT16 tag; INT16 tag;
} mariothink_t; };
typedef struct struct mariocheck_t
{ {
thinker_t thinker; thinker_t thinker;
line_t *sourceline; line_t *sourceline;
sector_t *sector; sector_t *sector;
} mariocheck_t; };
typedef struct struct thwomp_t
{ {
thinker_t thinker; thinker_t thinker;
line_t *sourceline; line_t *sourceline;
@ -893,23 +893,23 @@ typedef struct
INT16 tag; INT16 tag;
UINT16 sound; UINT16 sound;
INT32 initDelay; INT32 initDelay;
} thwomp_t; };
typedef struct struct floatthink_t
{ {
thinker_t thinker; thinker_t thinker;
line_t *sourceline; line_t *sourceline;
sector_t *sector; sector_t *sector;
INT16 tag; INT16 tag;
} floatthink_t; };
typedef struct struct eachtime_t
{ {
thinker_t thinker; thinker_t thinker;
line_t *sourceline; // Source line of the thinker line_t *sourceline; // Source line of the thinker
boolean playersInArea[MAXPLAYERS]; boolean playersInArea[MAXPLAYERS];
boolean triggerOnExit; boolean triggerOnExit;
} eachtime_t; };
typedef enum typedef enum
{ {
@ -918,7 +918,7 @@ typedef enum
RF_DYNAMIC = 1<<2, //Dynamically sinking platform RF_DYNAMIC = 1<<2, //Dynamically sinking platform
} raiseflag_t; } raiseflag_t;
typedef struct struct raise_t
{ {
thinker_t thinker; thinker_t thinker;
INT16 tag; INT16 tag;
@ -929,7 +929,7 @@ typedef struct
fixed_t extraspeed; //For dynamically sinking platform fixed_t extraspeed; //For dynamically sinking platform
UINT8 shaketimer; //For dynamically sinking platform UINT8 shaketimer; //For dynamically sinking platform
UINT8 flags; UINT8 flags;
} raise_t; };
#define ELEVATORSPEED (FRACUNIT*4) #define ELEVATORSPEED (FRACUNIT*4)
#define FLOORSPEED (FRACUNIT) #define FLOORSPEED (FRACUNIT)
@ -971,20 +971,20 @@ void T_EachTimeThinker(eachtime_t *eachtime);
void T_CameraScanner(elevator_t *elevator); void T_CameraScanner(elevator_t *elevator);
void T_RaiseSector(raise_t *raise); void T_RaiseSector(raise_t *raise);
typedef struct struct executor_t
{ {
thinker_t thinker; // Thinker for linedef executor delay thinker_t thinker; // Thinker for linedef executor delay
line_t *line; // Pointer to line that is waiting. line_t *line; // Pointer to line that is waiting.
mobj_t *caller; // Pointer to calling mobj mobj_t *caller; // Pointer to calling mobj
sector_t *sector; // Pointer to triggering sector sector_t *sector; // Pointer to triggering sector
INT32 timer; // Delay timer INT32 timer; // Delay timer
} executor_t; };
void T_ExecutorDelay(executor_t *e); void T_ExecutorDelay(executor_t *e);
/** Generalized scroller. /** Generalized scroller.
*/ */
typedef struct struct scroll_t
{ {
thinker_t thinker; ///< Thinker structure for scrolling. thinker_t thinker; ///< Thinker structure for scrolling.
fixed_t dx, dy; ///< (dx,dy) scroll speeds. fixed_t dx, dy; ///< (dx,dy) scroll speeds.
@ -1004,14 +1004,14 @@ typedef struct
sc_carry, ///< Carry objects on floor. sc_carry, ///< Carry objects on floor.
sc_carry_ceiling,///< Carry objects on ceiling (for 3Dfloor conveyors). sc_carry_ceiling,///< Carry objects on ceiling (for 3Dfloor conveyors).
} type; } type;
} scroll_t; };
void T_Scroll(scroll_t *s); void T_Scroll(scroll_t *s);
void T_LaserFlash(laserthink_t *flash); void T_LaserFlash(laserthink_t *flash);
/** Friction for ice/sludge effects. /** Friction for ice/sludge effects.
*/ */
typedef struct struct friction_t
{ {
thinker_t thinker; ///< Thinker structure for friction. thinker_t thinker; ///< Thinker structure for friction.
INT32 friction; ///< Friction value, 0xe800 = normal. INT32 friction; ///< Friction value, 0xe800 = normal.
@ -1019,7 +1019,7 @@ typedef struct
INT32 affectee; ///< Number of affected sector. INT32 affectee; ///< Number of affected sector.
INT32 referrer; ///< If roverfriction == true, then this will contain the sector # of the control sector where the effect was applied. INT32 referrer; ///< If roverfriction == true, then this will contain the sector # of the control sector where the effect was applied.
UINT8 roverfriction; ///< flag for whether friction originated from a FOF or not UINT8 roverfriction; ///< flag for whether friction originated from a FOF or not
} friction_t; };
// Friction defines. // Friction defines.
#define ORIG_FRICTION (0xF5 << (FRACBITS-8)) ///< Original value. #define ORIG_FRICTION (0xF5 << (FRACBITS-8)) ///< Original value.
@ -1033,7 +1033,7 @@ typedef enum
} pushertype_e; } pushertype_e;
// Model for pushers for push/pull effects // Model for pushers for push/pull effects
typedef struct struct pusher_t
{ {
thinker_t thinker; ///< Thinker structure for pusher effect. thinker_t thinker; ///< Thinker structure for pusher effect.
pushertype_e type; ///< Type of pusher effect. pushertype_e type; ///< Type of pusher effect.
@ -1045,10 +1045,10 @@ typedef struct
INT32 referrer; ///< If roverpusher == true, then this will contain the sector # of the control sector where the effect was applied. INT32 referrer; ///< If roverpusher == true, then this will contain the sector # of the control sector where the effect was applied.
INT32 exclusive; /// < Once this affect has been applied to a mobj, no other pushers may affect it. INT32 exclusive; /// < Once this affect has been applied to a mobj, no other pushers may affect it.
INT32 slider; /// < Should the player go into an uncontrollable slide? INT32 slider; /// < Should the player go into an uncontrollable slide?
} pusher_t; };
// Model for disappearing/reappearing FOFs // Model for disappearing/reappearing FOFs
typedef struct struct disappear_t
{ {
thinker_t thinker; ///< Thinker structure for effect. thinker_t thinker; ///< Thinker structure for effect.
tic_t appeartime; ///< Tics to be appeared for tic_t appeartime; ///< Tics to be appeared for
@ -1058,12 +1058,12 @@ typedef struct
INT32 affectee; ///< Number of affected line INT32 affectee; ///< Number of affected line
INT32 sourceline; ///< Number of source line INT32 sourceline; ///< Number of source line
INT32 exists; ///< Exists toggle INT32 exists; ///< Exists toggle
} disappear_t; };
void T_Disappear(disappear_t *d); void T_Disappear(disappear_t *d);
// Model for fading FOFs // Model for fading FOFs
typedef struct struct fade_t
{ {
thinker_t thinker; ///< Thinker structure for effect. thinker_t thinker; ///< Thinker structure for effect.
ffloor_t *rover; ///< Target ffloor ffloor_t *rover; ///< Target ffloor
@ -1084,13 +1084,13 @@ typedef struct
boolean docollision; ///< Handle interactive flags boolean docollision; ///< Handle interactive flags
boolean doghostfade; ///< No interactive flags during fading boolean doghostfade; ///< No interactive flags during fading
boolean exactalpha; ///< Use exact alpha values (opengl) boolean exactalpha; ///< Use exact alpha values (opengl)
} fade_t; };
void T_Fade(fade_t *d); void T_Fade(fade_t *d);
// Model for fading colormaps // Model for fading colormaps
typedef struct struct fadecolormap_t
{ {
thinker_t thinker; ///< Thinker structure for effect. thinker_t thinker; ///< Thinker structure for effect.
sector_t *sector; ///< Sector where action is taking place. sector_t *sector; ///< Sector where action is taking place.
@ -1099,7 +1099,7 @@ typedef struct
boolean ticbased; ///< Tic-based timing boolean ticbased; ///< Tic-based timing
INT32 duration; ///< Total duration for tic-based logic (OR: speed increment) INT32 duration; ///< Total duration for tic-based logic (OR: speed increment)
INT32 timer; ///< Timer for tic-based logic (OR: internal speed counter) INT32 timer; ///< Timer for tic-based logic (OR: internal speed counter)
} fadecolormap_t; };
void T_FadeColormap(fadecolormap_t *d); void T_FadeColormap(fadecolormap_t *d);
@ -1107,7 +1107,7 @@ void T_FadeColormap(fadecolormap_t *d);
void T_Pusher(pusher_t *p); void T_Pusher(pusher_t *p);
// Plane displacement // Plane displacement
typedef struct struct planedisplace_t
{ {
thinker_t thinker; ///< Thinker structure for plane displacement effect. thinker_t thinker; ///< Thinker structure for plane displacement effect.
INT32 affectee; ///< Number of affected sector. INT32 affectee; ///< Number of affected sector.
@ -1123,7 +1123,7 @@ typedef struct
pd_ceiling, ///< Displace ceiling. pd_ceiling, ///< Displace ceiling.
pd_both, ///< Displace both floor AND ceiling. pd_both, ///< Displace both floor AND ceiling.
} type; } type;
} planedisplace_t; };
void T_PlaneDisplace(planedisplace_t *pd); void T_PlaneDisplace(planedisplace_t *pd);

View file

@ -478,6 +478,12 @@ void P_ResetPlayer(player_t *player)
player->trickpanel = 0; player->trickpanel = 0;
player->glanceDir = 0; player->glanceDir = 0;
player->fastfall = 0; player->fastfall = 0;
if (player->mo != NULL && P_MobjWasRemoved(player->mo) == false)
{
player->mo->pitch = 0;
player->mo->roll = 0;
}
} }
// //

View file

@ -23,12 +23,12 @@
#endif #endif
// Store lists of lumps for F_START/F_END etc. // Store lists of lumps for F_START/F_END etc.
typedef struct struct lumplist_t
{ {
UINT16 wadfile; UINT16 wadfile;
UINT16 firstlump; UINT16 firstlump;
size_t numlumps; size_t numlumps;
} lumplist_t; };
UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha); UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha);
UINT32 ASTBlendTexturePixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha); UINT32 ASTBlendTexturePixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha);

View file

@ -35,11 +35,11 @@
// Clips the given range of columns // Clips the given range of columns
// and includes it in the new clip list. // and includes it in the new clip list.
// //
typedef struct struct cliprange_t
{ {
INT32 first; INT32 first;
INT32 last; INT32 last;
} cliprange_t; };
// Silhouette, needed for clipping segs (mainly) and sprites representing things. // Silhouette, needed for clipping segs (mainly) and sprites representing things.
#define SIL_NONE 0 #define SIL_NONE 0
@ -57,7 +57,7 @@ typedef UINT8 lighttable_t;
#define CMF_FOG 4 #define CMF_FOG 4
// ExtraColormap type. Use for extra_colormaps from now on. // ExtraColormap type. Use for extra_colormaps from now on.
typedef struct extracolormap_s struct extracolormap_t
{ {
UINT8 fadestart, fadeend; UINT8 fadestart, fadeend;
UINT8 flags; UINT8 flags;
@ -74,9 +74,9 @@ typedef struct extracolormap_s
char lumpname[9]; // for netsyncing char lumpname[9]; // for netsyncing
#endif #endif
struct extracolormap_s *next; extracolormap_t *next;
struct extracolormap_s *prev; extracolormap_t *prev;
} extracolormap_t; };
// //
// INTERNAL MAP TYPES used by play and refresh // INTERNAL MAP TYPES used by play and refresh
@ -84,28 +84,25 @@ typedef struct extracolormap_s
/** Your plain vanilla vertex. /** Your plain vanilla vertex.
*/ */
typedef struct struct vertex_t
{ {
fixed_t x, y; fixed_t x, y;
boolean floorzset, ceilingzset; boolean floorzset, ceilingzset;
fixed_t floorz, ceilingz; fixed_t floorz, ceilingz;
} vertex_t; };
// Forward of linedefs, for sectors.
struct line_s;
/** Degenerate version of ::mobj_t, storing only a location. /** Degenerate version of ::mobj_t, storing only a location.
* Used for sound origins in sectors, hoop centers, and the like. Does not * Used for sound origins in sectors, hoop centers, and the like. Does not
* handle sound from moving objects (doppler), because position is probably * handle sound from moving objects (doppler), because position is probably
* just buffered, not updated. * just buffered, not updated.
*/ */
typedef struct struct degenmobj_t
{ {
thinker_t thinker; ///< Not used for anything. thinker_t thinker; ///< Not used for anything.
fixed_t x; ///< X coordinate. fixed_t x; ///< X coordinate.
fixed_t y; ///< Y coordinate. fixed_t y; ///< Y coordinate.
fixed_t z; ///< Z coordinate. fixed_t z; ///< Z coordinate.
} degenmobj_t; };
#include "p_polyobj.h" #include "p_polyobj.h"
@ -208,7 +205,7 @@ typedef enum
BT_STRONG, BT_STRONG,
} busttype_e; } busttype_e;
typedef struct ffloor_s struct ffloor_t
{ {
fixed_t *topheight; fixed_t *topheight;
INT32 *toppic; INT32 *toppic;
@ -224,17 +221,17 @@ typedef struct ffloor_s
angle_t *bottomangle; angle_t *bottomangle;
// Pointers to pointers. Yup. // Pointers to pointers. Yup.
struct pslope_s **t_slope; pslope_t **t_slope;
struct pslope_s **b_slope; pslope_t **b_slope;
size_t secnum; size_t secnum;
ffloortype_e fofflags; ffloortype_e fofflags;
struct line_s *master; line_t *master;
struct sector_s *target; sector_t *target;
struct ffloor_s *next; ffloor_t *next;
struct ffloor_s *prev; ffloor_t *prev;
INT32 lastlight; INT32 lastlight;
INT32 alpha; INT32 alpha;
@ -258,25 +255,25 @@ typedef struct ffloor_s
INT32 spawnalpha; // alpha the 3D floor spawned with INT32 spawnalpha; // alpha the 3D floor spawned with
void *fadingdata; // fading FOF thinker void *fadingdata; // fading FOF thinker
} ffloor_t; };
// This struct holds information for shadows casted by 3D floors. // This struct holds information for shadows casted by 3D floors.
// This information is contained inside the sector_t and is used as the base // This information is contained inside the sector_t and is used as the base
// information for casted shadows. // information for casted shadows.
typedef struct lightlist_s struct lightlist_t
{ {
fixed_t height; fixed_t height;
INT16 *lightlevel; INT16 *lightlevel;
extracolormap_t **extra_colormap; // pointer-to-a-pointer, so we can react to colormap changes extracolormap_t **extra_colormap; // pointer-to-a-pointer, so we can react to colormap changes
INT32 flags; INT32 flags;
ffloor_t *caster; ffloor_t *caster;
struct pslope_s *slope; // FOF_DOUBLESHADOW makes me have to store this pointer here. Bluh bluh. pslope_t *slope; // FOF_DOUBLESHADOW makes me have to store this pointer here. Bluh bluh.
} lightlist_t; };
// This struct is used for rendering walls with shadows casted on them... // This struct is used for rendering walls with shadows casted on them...
typedef struct r_lightlist_s struct r_lightlist_t
{ {
fixed_t height; fixed_t height;
fixed_t heightstep; fixed_t heightstep;
@ -288,7 +285,7 @@ typedef struct r_lightlist_s
lighttable_t *rcolormap; lighttable_t *rcolormap;
ffloortype_e flags; ffloortype_e flags;
INT32 lightnum; INT32 lightnum;
} r_lightlist_t; };
// Slopes // Slopes
typedef enum { typedef enum {
@ -296,10 +293,10 @@ typedef enum {
SL_DYNAMIC = 1<<1, /// This plane slope will be assigned a thinker to make it dynamic. SL_DYNAMIC = 1<<1, /// This plane slope will be assigned a thinker to make it dynamic.
} slopeflags_t; } slopeflags_t;
typedef struct pslope_s struct pslope_t
{ {
UINT16 id; // The number of the slope, mostly used for netgame syncing purposes UINT16 id; // The number of the slope, mostly used for netgame syncing purposes
struct pslope_s *next; // Make a linked list of dynamic slopes, for easy reference later pslope_t *next; // Make a linked list of dynamic slopes, for easy reference later
// The plane's definition. // The plane's definition.
vector3_t o; /// Plane origin. vector3_t o; /// Plane origin.
@ -323,7 +320,7 @@ typedef struct pslope_s
#ifdef HWRENDER #ifdef HWRENDER
INT16 hwLightOffset; INT16 hwLightOffset;
#endif #endif
} pslope_t; };
typedef enum typedef enum
{ {
@ -399,7 +396,7 @@ typedef enum
// The SECTORS record, at runtime. // The SECTORS record, at runtime.
// Stores things/mobjs. // Stores things/mobjs.
// //
typedef struct sector_s struct sector_t
{ {
fixed_t floorheight; fixed_t floorheight;
fixed_t ceilingheight; fixed_t ceilingheight;
@ -445,10 +442,10 @@ typedef struct sector_s
// list of mobjs that are at least partially in the sector // list of mobjs that are at least partially in the sector
// thinglist is a subset of touching_thinglist // thinglist is a subset of touching_thinglist
struct msecnode_s *touching_thinglist; msecnode_t *touching_thinglist;
size_t linecount; size_t linecount;
struct line_s **lines; // [linecount] size line_t **lines; // [linecount] size
// Improved fake floor hack // Improved fake floor hack
ffloor_t *ffloors; ffloor_t *ffloors;
@ -480,14 +477,14 @@ typedef struct sector_s
fixed_t friction; fixed_t friction;
// Sprite culling feature // Sprite culling feature
struct line_s *cullheight; line_t *cullheight;
// Current speed of ceiling/floor. For Knuckles to hold onto stuff. // Current speed of ceiling/floor. For Knuckles to hold onto stuff.
fixed_t floorspeed, ceilspeed; fixed_t floorspeed, ceilspeed;
// list of precipitation mobjs in sector // list of precipitation mobjs in sector
precipmobj_t *preciplist; precipmobj_t *preciplist;
struct mprecipsecnode_s *touching_preciplist; mprecipsecnode_t *touching_preciplist;
// Eternity engine slope // Eternity engine slope
pslope_t *f_slope; // floor slope pslope_t *f_slope; // floor slope
@ -499,7 +496,7 @@ typedef struct sector_s
// colormap structure // colormap structure
extracolormap_t *spawn_extra_colormap; extracolormap_t *spawn_extra_colormap;
} sector_t; };
// //
// Move clipping aid for linedefs. // Move clipping aid for linedefs.
@ -517,7 +514,7 @@ typedef enum
#define NUMLINEARGS 10 #define NUMLINEARGS 10
#define NUMLINESTRINGARGS 2 #define NUMLINESTRINGARGS 2
typedef struct line_s struct line_t
{ {
// Vertices, from v1 to v2. // Vertices, from v1 to v2.
vertex_t *v1; vertex_t *v1;
@ -556,9 +553,9 @@ typedef struct line_s
char *text; // a concatenation of all front and back texture names, for linedef specials that require a string. char *text; // a concatenation of all front and back texture names, for linedef specials that require a string.
INT16 callcount; // no. of calls left before triggering, for the "X calls" linedef specials, defaults to 0 INT16 callcount; // no. of calls left before triggering, for the "X calls" linedef specials, defaults to 0
} line_t; };
typedef struct struct side_t
{ {
// add this to the calculated texture column // add this to the calculated texture column
fixed_t textureoffset; fixed_t textureoffset;
@ -582,7 +579,7 @@ typedef struct
char *text; // a concatenation of all top, bottom, and mid texture names, for linedef specials that require a string. char *text; // a concatenation of all top, bottom, and mid texture names, for linedef specials that require a string.
extracolormap_t *colormap_data; // storage for colormaps; not applied to sectors. extracolormap_t *colormap_data; // storage for colormaps; not applied to sectors.
} side_t; };
// //
// A subsector. // A subsector.
@ -590,14 +587,14 @@ typedef struct
// Basically, this is a list of linesegs, indicating the visible walls that define // Basically, this is a list of linesegs, indicating the visible walls that define
// (all or some) sides of a convex BSP leaf. // (all or some) sides of a convex BSP leaf.
// //
typedef struct subsector_s struct subsector_t
{ {
sector_t *sector; sector_t *sector;
INT16 numlines; INT16 numlines;
UINT16 firstline; UINT16 firstline;
struct polyobj_s *polyList; // haleyjd 02/19/06: list of polyobjects polyobj_t *polyList; // haleyjd 02/19/06: list of polyobjects
size_t validcount; size_t validcount;
} subsector_t; };
// Sector list node showing all sectors an object appears in. // Sector list node showing all sectors an object appears in.
// //
@ -613,32 +610,32 @@ typedef struct subsector_s
// //
// For the links, NULL means top or end of list. // For the links, NULL means top or end of list.
typedef struct msecnode_s struct msecnode_t
{ {
sector_t *m_sector; // a sector containing this object sector_t *m_sector; // a sector containing this object
struct mobj_s *m_thing; // this object mobj_t *m_thing; // this object
struct msecnode_s *m_sectorlist_prev; // prev msecnode_t for this thing msecnode_t *m_sectorlist_prev; // prev msecnode_t for this thing
struct msecnode_s *m_sectorlist_next; // next msecnode_t for this thing msecnode_t *m_sectorlist_next; // next msecnode_t for this thing
struct msecnode_s *m_thinglist_prev; // prev msecnode_t for this sector msecnode_t *m_thinglist_prev; // prev msecnode_t for this sector
struct msecnode_s *m_thinglist_next; // next msecnode_t for this sector msecnode_t *m_thinglist_next; // next msecnode_t for this sector
boolean visited; // used in search algorithms boolean visited; // used in search algorithms
} msecnode_t; };
typedef struct mprecipsecnode_s struct mprecipsecnode_t
{ {
sector_t *m_sector; // a sector containing this object sector_t *m_sector; // a sector containing this object
struct precipmobj_s *m_thing; // this object precipmobj_t *m_thing; // this object
struct mprecipsecnode_s *m_sectorlist_prev; // prev msecnode_t for this thing mprecipsecnode_t *m_sectorlist_prev; // prev msecnode_t for this thing
struct mprecipsecnode_s *m_sectorlist_next; // next msecnode_t for this thing mprecipsecnode_t *m_sectorlist_next; // next msecnode_t for this thing
struct mprecipsecnode_s *m_thinglist_prev; // prev msecnode_t for this sector mprecipsecnode_t *m_thinglist_prev; // prev msecnode_t for this sector
struct mprecipsecnode_s *m_thinglist_next; // next msecnode_t for this sector mprecipsecnode_t *m_thinglist_next; // next msecnode_t for this sector
boolean visited; // used in search algorithms boolean visited; // used in search algorithms
} mprecipsecnode_t; };
// for now, only used in hardware mode // for now, only used in hardware mode
// maybe later for software as well? // maybe later for software as well?
// that's why it's moved here // that's why it's moved here
typedef struct light_s struct light_t
{ {
UINT16 type; // light,... (cfr #define in hwr_light.c) UINT16 type; // light,... (cfr #define in hwr_light.c)
@ -651,19 +648,19 @@ typedef struct light_s
UINT32 dynamic_color; // color of the light for dynamic lighting UINT32 dynamic_color; // color of the light for dynamic lighting
float dynamic_radius; // radius of the light ball float dynamic_radius; // radius of the light ball
float dynamic_sqrradius; // radius^2 of the light ball float dynamic_sqrradius; // radius^2 of the light ball
} light_t; };
typedef struct lightmap_s struct lightmap_t
{ {
float s[2], t[2]; float s[2], t[2];
light_t *light; light_t *light;
struct lightmap_s *next; lightmap_t *next;
} lightmap_t; };
// //
// The lineseg. // The lineseg.
// //
typedef struct seg_s struct seg_t
{ {
vertex_t *v1; vertex_t *v1;
vertex_t *v2; vertex_t *v2;
@ -704,12 +701,12 @@ typedef struct seg_s
#ifdef HWRENDER #ifdef HWRENDER
INT16 hwLightOffset; INT16 hwLightOffset;
#endif #endif
} seg_t; };
// //
// BSP node. // BSP node.
// //
typedef struct struct node_t
{ {
// Partition line. // Partition line.
fixed_t x, y; fixed_t x, y;
@ -720,18 +717,18 @@ typedef struct
// If NF_SUBSECTOR its a subsector. // If NF_SUBSECTOR its a subsector.
UINT16 children[2]; UINT16 children[2];
} node_t; };
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma pack(1) #pragma pack(1)
#endif #endif
// posts are runs of non masked source pixels // posts are runs of non masked source pixels
typedef struct struct post_t
{ {
UINT8 topdelta; // -1 is the last post in a column UINT8 topdelta; // -1 is the last post in a column
UINT8 length; // length data bytes follows UINT8 length; // length data bytes follows
} ATTRPACK post_t; } ATTRPACK;
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma pack() #pragma pack()
@ -751,7 +748,7 @@ typedef post_t column_t;
// //
// ? // ?
// //
typedef struct drawseg_s struct drawseg_t
{ {
seg_t *curline; seg_t *curline;
INT32 x1; INT32 x1;
@ -771,9 +768,9 @@ typedef struct drawseg_s
INT16 *sprbottomclip; INT16 *sprbottomclip;
INT16 *maskedtexturecol; INT16 *maskedtexturecol;
struct visplane_s *ffloorplanes[MAXFFLOORS]; visplane_t *ffloorplanes[MAXFFLOORS];
INT32 numffloorplanes; INT32 numffloorplanes;
struct ffloor_s *thicksides[MAXFFLOORS]; ffloor_t *thicksides[MAXFFLOORS];
INT16 *thicksidecol; INT16 *thicksidecol;
INT32 numthicksides; INT32 numthicksides;
fixed_t frontscale[MAXVIDWIDTH]; fixed_t frontscale[MAXVIDWIDTH];
@ -783,7 +780,7 @@ typedef struct drawseg_s
fixed_t maskedtextureheight[MAXVIDWIDTH]; // For handling sloped midtextures fixed_t maskedtextureheight[MAXVIDWIDTH]; // For handling sloped midtextures
vertex_t leftpos, rightpos; // Used for rendering FOF walls with slopes vertex_t leftpos, rightpos; // Used for rendering FOF walls with slopes
} drawseg_t; };
typedef enum typedef enum
{ {
@ -795,11 +792,11 @@ typedef enum
} pic_mode_t; } pic_mode_t;
#ifdef ROTSPRITE #ifdef ROTSPRITE
typedef struct struct rotsprite_t
{ {
INT32 angles; INT32 angles;
void **patches; void **patches;
} rotsprite_t; };
#endif #endif
// Patches. // Patches.
@ -807,7 +804,7 @@ typedef struct
// Patches are used for sprites and all masked pictures, and we compose // Patches are used for sprites and all masked pictures, and we compose
// textures from the TEXTURES list of patches. // textures from the TEXTURES list of patches.
// //
typedef struct struct patch_t
{ {
INT16 width, height; INT16 width, height;
INT16 leftoffset, topoffset; INT16 leftoffset, topoffset;
@ -821,7 +818,7 @@ typedef struct
#ifdef ROTSPRITE #ifdef ROTSPRITE
rotsprite_t *rotated; // Rotated patches rotsprite_t *rotated; // Rotated patches
#endif #endif
} patch_t; };
extern patch_t *missingpat; extern patch_t *missingpat;
extern patch_t *blanklvl; extern patch_t *blanklvl;
@ -830,7 +827,7 @@ extern patch_t *blanklvl;
#pragma pack(1) #pragma pack(1)
#endif #endif
typedef struct struct softwarepatch_t
{ {
INT16 width; // bounding box size INT16 width; // bounding box size
INT16 height; INT16 height;
@ -838,14 +835,14 @@ typedef struct
INT16 topoffset; // pixels below the origin INT16 topoffset; // pixels below the origin
INT32 columnofs[8]; // only [width] used INT32 columnofs[8]; // only [width] used
// the [0] is &columnofs[width] // the [0] is &columnofs[width]
} ATTRPACK softwarepatch_t; } ATTRPACK;
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable : 4200) #pragma warning(disable : 4200)
#endif #endif
// a pic is an unmasked block of pixels, stored in horizontal way // a pic is an unmasked block of pixels, stored in horizontal way
typedef struct struct pic_t
{ {
INT16 width; INT16 width;
UINT8 zero; // set to 0 allow autodetection of pic_t UINT8 zero; // set to 0 allow autodetection of pic_t
@ -854,7 +851,7 @@ typedef struct
INT16 height; INT16 height;
INT16 reserved1; // set to 0 INT16 reserved1; // set to 0
UINT8 data[]; UINT8 data[];
} ATTRPACK pic_t; } ATTRPACK;
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(default : 4200) #pragma warning(default : 4200)
@ -951,7 +948,7 @@ typedef enum
// Or the right side: NNNNFR // Or the right side: NNNNFR
// Or both, mirrored: NNNNFLFR // Or both, mirrored: NNNNFLFR
// //
typedef struct struct spriteframe_t
{ {
// If false use 0 for any position. // If false use 0 for any position.
// Note: as eight entries are available, we might as well insert the same // Note: as eight entries are available, we might as well insert the same
@ -968,15 +965,15 @@ typedef struct
#ifdef ROTSPRITE #ifdef ROTSPRITE
rotsprite_t *rotated[2][16]; // Rotated patches rotsprite_t *rotated[2][16]; // Rotated patches
#endif #endif
} spriteframe_t; };
// //
// A sprite definition: a number of animation frames. // A sprite definition: a number of animation frames.
// //
typedef struct struct spritedef_t
{ {
size_t numframes; size_t numframes;
spriteframe_t *spriteframes; spriteframe_t *spriteframes;
} spritedef_t; };
#endif #endif

View file

@ -103,7 +103,7 @@ UINT8 *dc_transmap; // one of the translucency tables
*/ */
UINT8 *dc_translation; UINT8 *dc_translation;
struct r_lightlist_s *dc_lightlist = NULL; struct r_lightlist_t *dc_lightlist = NULL;
INT32 dc_numlights = 0, dc_maxlights, dc_texheight; INT32 dc_numlights = 0, dc_maxlights, dc_texheight;
// ========================================================================= // =========================================================================

View file

@ -47,7 +47,7 @@ extern UINT8 *dc_transmap;
extern UINT8 *dc_translation; extern UINT8 *dc_translation;
extern struct r_lightlist_s *dc_lightlist; extern struct r_lightlist_t *dc_lightlist;
extern INT32 dc_numlights, dc_maxlights; extern INT32 dc_numlights, dc_maxlights;
//Fix TUTIFRUTI //Fix TUTIFRUTI
@ -72,9 +72,9 @@ extern UINT8 *ds_source;
extern UINT8 *ds_brightmap; extern UINT8 *ds_brightmap;
extern UINT8 *ds_transmap; extern UINT8 *ds_transmap;
typedef struct { struct floatv3_t {
float x, y, z; float x, y, z;
} floatv3_t; };
// Vectors for Software's tilted slope drawers // Vectors for Software's tilted slope drawers
extern floatv3_t *ds_su, *ds_sv, *ds_sz; extern floatv3_t *ds_su, *ds_sv, *ds_sz;

View file

@ -40,7 +40,7 @@ extern enum viewcontext_e viewcontext;
#define R_GetViewNumber() ((viewcontext - VIEWCONTEXT_PLAYER1) & 3) #define R_GetViewNumber() ((viewcontext - VIEWCONTEXT_PLAYER1) & 3)
typedef struct { struct viewvars_t {
fixed_t x; fixed_t x;
fixed_t y; fixed_t y;
fixed_t z; fixed_t z;
@ -54,11 +54,11 @@ typedef struct {
fixed_t cos; fixed_t cos;
fixed_t sin; fixed_t sin;
mobj_t *mobj; mobj_t *mobj;
} viewvars_t; };
extern viewvars_t *newview; extern viewvars_t *newview;
typedef struct { struct interpmobjstate_t {
fixed_t x; fixed_t x;
fixed_t y; fixed_t y;
fixed_t z; fixed_t z;
@ -69,7 +69,7 @@ typedef struct {
fixed_t spriteyscale; fixed_t spriteyscale;
fixed_t spritexoffset; fixed_t spritexoffset;
fixed_t spriteyoffset; fixed_t spriteyoffset;
} interpmobjstate_t; };
// Level interpolators // Level interpolators
@ -83,7 +83,7 @@ typedef enum {
} levelinterpolator_type_e; } levelinterpolator_type_e;
// Tagged union of a level interpolator // Tagged union of a level interpolator
typedef struct levelinterpolator_s { struct levelinterpolator_t {
levelinterpolator_type_e type; levelinterpolator_type_e type;
thinker_t *thinker; thinker_t *thinker;
union { union {
@ -116,7 +116,7 @@ typedef struct levelinterpolator_s {
fixed_t oldzdelta, bakzdelta; fixed_t oldzdelta, bakzdelta;
} dynslope; } dynslope;
}; };
} levelinterpolator_t; };
// Interpolates the current view variables (r_state.h) against the selected view context in R_SetViewContext // Interpolates the current view variables (r_state.h) against the selected view context in R_SetViewContext
void R_InterpolateView(fixed_t frac); void R_InterpolateView(fixed_t frac);

View file

@ -92,18 +92,18 @@ typedef enum
ROTAXIS_Z // Yaw ROTAXIS_Z // Yaw
} rotaxis_t; } rotaxis_t;
typedef struct struct spriteframepivot_t
{ {
INT32 x, y; INT32 x, y;
rotaxis_t rotaxis; rotaxis_t rotaxis;
} spriteframepivot_t; };
typedef struct struct spriteinfo_t
{ {
spriteframepivot_t pivot[64 + 1]; spriteframepivot_t pivot[64 + 1];
#define SPRINFO_DEFAULT_PIVOT (64) #define SPRINFO_DEFAULT_PIVOT (64)
UINT8 available[BIT_ARRAY_SIZE(64 + 1)]; // 1 extra for default_pivot UINT8 available[BIT_ARRAY_SIZE(64 + 1)]; // 1 extra for default_pivot
} spriteinfo_t; };
// Portable Network Graphics // Portable Network Graphics
#define PNG_HEADER_SIZE (8) #define PNG_HEADER_SIZE (8)

View file

@ -28,9 +28,9 @@
// Now what is a visplane, anyway? // Now what is a visplane, anyway?
// Simple: kinda floor/ceiling polygon optimised for SRB2 rendering. // Simple: kinda floor/ceiling polygon optimised for SRB2 rendering.
// //
typedef struct visplane_s struct visplane_t
{ {
struct visplane_s *next; visplane_t *next;
fixed_t height; fixed_t height;
fixed_t viewx, viewy, viewz; fixed_t viewx, viewy, viewz;
@ -50,13 +50,13 @@ typedef struct visplane_s
fixed_t xoffs, yoffs; // Scrolling flats. fixed_t xoffs, yoffs; // Scrolling flats.
struct ffloor_s *ffloor; ffloor_t *ffloor;
polyobj_t *polyobj; polyobj_t *polyobj;
pslope_t *slope; pslope_t *slope;
boolean noencore; boolean noencore;
boolean ripple; boolean ripple;
} visplane_t; };
extern visplane_t *visplanes[MAXVISPLANES]; extern visplane_t *visplanes[MAXVISPLANES];
extern visplane_t *floorplane; extern visplane_t *floorplane;
@ -104,7 +104,7 @@ void R_CalculateSlopeVectors(void);
// Sets the slope vector pointers for the current tilted span. // Sets the slope vector pointers for the current tilted span.
void R_SetTiltedSpan(INT32 span); void R_SetTiltedSpan(INT32 span);
typedef struct planemgr_s struct visffloor_t
{ {
visplane_t *plane; visplane_t *plane;
fixed_t height; fixed_t height;
@ -119,11 +119,11 @@ typedef struct planemgr_s
fixed_t f_pos_slope; fixed_t f_pos_slope;
fixed_t b_pos_slope; fixed_t b_pos_slope;
struct pslope_s *slope; pslope_t *slope;
struct ffloor_s *ffloor; ffloor_t *ffloor;
polyobj_t *polyobj; polyobj_t *polyobj;
} visffloor_t; };
extern visffloor_t ffloor[MAXFFLOORS]; extern visffloor_t ffloor[MAXFFLOORS];
extern INT32 numffloors; extern INT32 numffloors;

View file

@ -20,9 +20,9 @@
/** Portal structure for the software renderer. /** Portal structure for the software renderer.
*/ */
typedef struct portal_s struct portal_t
{ {
struct portal_s *next; portal_t *next;
// Viewport. // Viewport.
fixed_t viewx; fixed_t viewx;
@ -39,7 +39,7 @@ typedef struct portal_s
INT16 *ceilingclip; /**< Temporary screen top clipping array. */ INT16 *ceilingclip; /**< Temporary screen top clipping array. */
INT16 *floorclip; /**< Temporary screen bottom clipping array. */ INT16 *floorclip; /**< Temporary screen bottom clipping array. */
fixed_t *frontscale;/**< Temporary screen bottom clipping array. */ fixed_t *frontscale;/**< Temporary screen bottom clipping array. */
} portal_t; };
extern portal_t* portal_base; extern portal_t* portal_base;
extern portal_t* portal_cap; extern portal_t* portal_cap;

View file

@ -30,7 +30,7 @@
#define DEFAULTSKIN4 "knuckles" // fourth player #define DEFAULTSKIN4 "knuckles" // fourth player
/// The skin_t struct /// The skin_t struct
typedef struct struct skin_t
{ {
char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin char name[SKINNAMESIZE+1]; // INT16 descriptive name of the skin
UINT16 wadnum; UINT16 wadnum;
@ -61,7 +61,7 @@ typedef struct
// contains super versions too // contains super versions too
spritedef_t sprites[NUMPLAYERSPRITES*2]; spritedef_t sprites[NUMPLAYERSPRITES*2];
spriteinfo_t sprinfo[NUMPLAYERSPRITES*2]; spriteinfo_t sprinfo[NUMPLAYERSPRITES*2];
} skin_t; };
enum facepatches { enum facepatches {
FACE_RANK = 0, FACE_RANK = 0,

Some files were not shown because too many files have changed in this diff Show more