Merge remote-tracking branch 'pub/next'
This commit is contained in:
commit
ef108cbb36
94 changed files with 3554 additions and 2284 deletions
23
cmake/Modules/FindDiscordRPC.cmake
Normal file
23
cmake/Modules/FindDiscordRPC.cmake
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
include(LibFindMacros)
|
||||
|
||||
libfind_pkg_check_modules(DISCORDRPC_PKGCONF DISCORDRPC)
|
||||
|
||||
find_path(DISCORDRPC_INCLUDE_DIR
|
||||
NAMES discord_rpc.h
|
||||
PATHS
|
||||
${DISCORDRPC_PKGCONF_INCLUDE_DIRS}
|
||||
"/usr/include"
|
||||
"/usr/local/include"
|
||||
)
|
||||
|
||||
find_library(DISCORDRPC_LIBRARY
|
||||
NAMES discord-rpc
|
||||
PATHS
|
||||
${DISCORDRPC_PKGCONF_LIBRARY_DIRS}
|
||||
"/usr/lib"
|
||||
"/usr/local/lib"
|
||||
)
|
||||
|
||||
set(DISCORDRPC_PROCESS_INCLUDES DISCORDRPC_INCLUDE_DIR)
|
||||
set(DISCORDRPC_PROCESS_LIBS DISCORDRPC_LIBRARY)
|
||||
libfind_process(DISCORDRPC)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# SRB2Kart - Which DLLs do I need to bundle?
|
||||
|
||||
Updated 12/4/2018 (v2.1.21)
|
||||
Updated 8/23/2020 (v1.3)
|
||||
|
||||
Here are the required DLLs, per build. For each architecture, copy all the binaries from these folders:
|
||||
|
||||
|
|
@ -14,6 +14,7 @@ and don't forget to build r_opengl.dll for srb2dd.
|
|||
|
||||
* libs\dll-binaries\i686\exchndl.dll
|
||||
* libs\dll-binaries\i686\libgme.dll
|
||||
* libs\dll-binaries\i686\discord-rpc.dll
|
||||
* libs\dll-binaries\i686\mgwhelp.dll (depend for exchndl.dll)
|
||||
* libs\SDL2\i686-w64-mingw32\bin\SDL2.dll
|
||||
* libs\SDL2_mixer\i686-w64-mingw32\bin\*.dll (get everything)
|
||||
|
|
@ -22,22 +23,7 @@ and don't forget to build r_opengl.dll for srb2dd.
|
|||
|
||||
* libs\dll-binaries\x86_64\exchndl.dll
|
||||
* libs\dll-binaries\x86_64\libgme.dll
|
||||
* libs\dll-binaries\x86_64\discord-rpc.dll
|
||||
* libs\dll-binaries\x86_64\mgwhelp.dll (depend for exchndl.dll)
|
||||
* libs\SDL2\x86_64-w64-mingw32\bin\SDL2.dll
|
||||
* libs\SDL2_mixer\x86_64-w64-mingw32\bin\*.dll (get everything)
|
||||
|
||||
## srb2kartdd, 32-bit
|
||||
|
||||
* libs\dll-binaries\i686\exchndl.dll
|
||||
* libs\dll-binaries\i686\fmodex.dll
|
||||
* libs\dll-binaries\i686\libgme.dll
|
||||
* libs\dll-binaries\i686\mgwhelp.dll (depend for exchndl.dll)
|
||||
* r_opengl.dll (build this from make)
|
||||
|
||||
## srb2kartdd, 64-bit
|
||||
|
||||
* libs\dll-binaries\x86_64\exchndl.dll
|
||||
* libs\dll-binaries\x86_64\fmodex.dll
|
||||
* libs\dll-binaries\x86_64\libgme.dll
|
||||
* libs\dll-binaries\x86_64\mgwhelp.dll (depend for exchndl.dll)
|
||||
* r_opengl.dll (build this from make)
|
||||
|
|
|
|||
16
libs/discord-rpc.props
Normal file
16
libs/discord-rpc.props
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<LibraryPath Condition="'$(Platform)' == 'Win32'">$(SolutionDir)libs\discord-rpc\win32-dynamic\lib;$(LibraryPath)</LibraryPath>
|
||||
<IncludePath Condition="'$(Platform)' == 'Win32'">$(SolutionDir)libs\discord-rpc\win32-dynamic\lib;$(IncludePath)</IncludePath>
|
||||
<LibraryPath Condition="'$(Platform)' == 'x64'">$(SolutionDir)libs\discord-rpc\win64-dynamic\lib;$(LibraryPath)</LibraryPath>
|
||||
<IncludePath Condition="'$(Platform)' == 'x64'">$(SolutionDir)libs\discord-rpc\win64-dynamic\lib;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' OR '$(Platform)' == 'x64'">
|
||||
<Link>
|
||||
<AdditionalDependencies>discord-rpc.dll.a;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
</Project>
|
||||
26
libs/discord-rpc/win32-dynamic/include/discord_register.h
Normal file
26
libs/discord-rpc/win32-dynamic/include/discord_register.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#if defined(DISCORD_DYNAMIC_LIB)
|
||||
#if defined(_WIN32)
|
||||
#if defined(DISCORD_BUILDING_SDK)
|
||||
#define DISCORD_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DISCORD_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define DISCORD_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
#else
|
||||
#define DISCORD_EXPORT
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command);
|
||||
DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
87
libs/discord-rpc/win32-dynamic/include/discord_rpc.h
Normal file
87
libs/discord-rpc/win32-dynamic/include/discord_rpc.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
// clang-format off
|
||||
|
||||
#if defined(DISCORD_DYNAMIC_LIB)
|
||||
# if defined(_WIN32)
|
||||
# if defined(DISCORD_BUILDING_SDK)
|
||||
# define DISCORD_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define DISCORD_EXPORT __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# define DISCORD_EXPORT __attribute__((visibility("default")))
|
||||
# endif
|
||||
#else
|
||||
# define DISCORD_EXPORT
|
||||
#endif
|
||||
|
||||
// clang-format on
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct DiscordRichPresence {
|
||||
const char* state; /* max 128 bytes */
|
||||
const char* details; /* max 128 bytes */
|
||||
int64_t startTimestamp;
|
||||
int64_t endTimestamp;
|
||||
const char* largeImageKey; /* max 32 bytes */
|
||||
const char* largeImageText; /* max 128 bytes */
|
||||
const char* smallImageKey; /* max 32 bytes */
|
||||
const char* smallImageText; /* max 128 bytes */
|
||||
const char* partyId; /* max 128 bytes */
|
||||
int partySize;
|
||||
int partyMax;
|
||||
const char* matchSecret; /* max 128 bytes */
|
||||
const char* joinSecret; /* max 128 bytes */
|
||||
const char* spectateSecret; /* max 128 bytes */
|
||||
int8_t instance;
|
||||
} DiscordRichPresence;
|
||||
|
||||
typedef struct DiscordUser {
|
||||
const char* userId;
|
||||
const char* username;
|
||||
const char* discriminator;
|
||||
const char* avatar;
|
||||
} DiscordUser;
|
||||
|
||||
typedef struct DiscordEventHandlers {
|
||||
void (*ready)(const DiscordUser* request);
|
||||
void (*disconnected)(int errorCode, const char* message);
|
||||
void (*errored)(int errorCode, const char* message);
|
||||
void (*joinGame)(const char* joinSecret);
|
||||
void (*spectateGame)(const char* spectateSecret);
|
||||
void (*joinRequest)(const DiscordUser* request);
|
||||
} DiscordEventHandlers;
|
||||
|
||||
#define DISCORD_REPLY_NO 0
|
||||
#define DISCORD_REPLY_YES 1
|
||||
#define DISCORD_REPLY_IGNORE 2
|
||||
|
||||
DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
|
||||
DiscordEventHandlers* handlers,
|
||||
int autoRegister,
|
||||
const char* optionalSteamId);
|
||||
DISCORD_EXPORT void Discord_Shutdown(void);
|
||||
|
||||
/* checks for incoming messages, dispatches callbacks */
|
||||
DISCORD_EXPORT void Discord_RunCallbacks(void);
|
||||
|
||||
/* If you disable the lib starting its own io thread, you'll need to call this from your own */
|
||||
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||
DISCORD_EXPORT void Discord_UpdateConnection(void);
|
||||
#endif
|
||||
|
||||
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
|
||||
DISCORD_EXPORT void Discord_ClearPresence(void);
|
||||
|
||||
DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply);
|
||||
|
||||
DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* handlers);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
BIN
libs/discord-rpc/win32-dynamic/lib/discord-rpc.lib
Normal file
BIN
libs/discord-rpc/win32-dynamic/lib/discord-rpc.lib
Normal file
Binary file not shown.
26
libs/discord-rpc/win64-dynamic/include/discord_register.h
Normal file
26
libs/discord-rpc/win64-dynamic/include/discord_register.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#if defined(DISCORD_DYNAMIC_LIB)
|
||||
#if defined(_WIN32)
|
||||
#if defined(DISCORD_BUILDING_SDK)
|
||||
#define DISCORD_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
#define DISCORD_EXPORT __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#define DISCORD_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
#else
|
||||
#define DISCORD_EXPORT
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command);
|
||||
DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
87
libs/discord-rpc/win64-dynamic/include/discord_rpc.h
Normal file
87
libs/discord-rpc/win64-dynamic/include/discord_rpc.h
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
// clang-format off
|
||||
|
||||
#if defined(DISCORD_DYNAMIC_LIB)
|
||||
# if defined(_WIN32)
|
||||
# if defined(DISCORD_BUILDING_SDK)
|
||||
# define DISCORD_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define DISCORD_EXPORT __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# define DISCORD_EXPORT __attribute__((visibility("default")))
|
||||
# endif
|
||||
#else
|
||||
# define DISCORD_EXPORT
|
||||
#endif
|
||||
|
||||
// clang-format on
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct DiscordRichPresence {
|
||||
const char* state; /* max 128 bytes */
|
||||
const char* details; /* max 128 bytes */
|
||||
int64_t startTimestamp;
|
||||
int64_t endTimestamp;
|
||||
const char* largeImageKey; /* max 32 bytes */
|
||||
const char* largeImageText; /* max 128 bytes */
|
||||
const char* smallImageKey; /* max 32 bytes */
|
||||
const char* smallImageText; /* max 128 bytes */
|
||||
const char* partyId; /* max 128 bytes */
|
||||
int partySize;
|
||||
int partyMax;
|
||||
const char* matchSecret; /* max 128 bytes */
|
||||
const char* joinSecret; /* max 128 bytes */
|
||||
const char* spectateSecret; /* max 128 bytes */
|
||||
int8_t instance;
|
||||
} DiscordRichPresence;
|
||||
|
||||
typedef struct DiscordUser {
|
||||
const char* userId;
|
||||
const char* username;
|
||||
const char* discriminator;
|
||||
const char* avatar;
|
||||
} DiscordUser;
|
||||
|
||||
typedef struct DiscordEventHandlers {
|
||||
void (*ready)(const DiscordUser* request);
|
||||
void (*disconnected)(int errorCode, const char* message);
|
||||
void (*errored)(int errorCode, const char* message);
|
||||
void (*joinGame)(const char* joinSecret);
|
||||
void (*spectateGame)(const char* spectateSecret);
|
||||
void (*joinRequest)(const DiscordUser* request);
|
||||
} DiscordEventHandlers;
|
||||
|
||||
#define DISCORD_REPLY_NO 0
|
||||
#define DISCORD_REPLY_YES 1
|
||||
#define DISCORD_REPLY_IGNORE 2
|
||||
|
||||
DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
|
||||
DiscordEventHandlers* handlers,
|
||||
int autoRegister,
|
||||
const char* optionalSteamId);
|
||||
DISCORD_EXPORT void Discord_Shutdown(void);
|
||||
|
||||
/* checks for incoming messages, dispatches callbacks */
|
||||
DISCORD_EXPORT void Discord_RunCallbacks(void);
|
||||
|
||||
/* If you disable the lib starting its own io thread, you'll need to call this from your own */
|
||||
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||
DISCORD_EXPORT void Discord_UpdateConnection(void);
|
||||
#endif
|
||||
|
||||
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
|
||||
DISCORD_EXPORT void Discord_ClearPresence(void);
|
||||
|
||||
DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply);
|
||||
|
||||
DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* handlers);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
BIN
libs/discord-rpc/win64-dynamic/lib/discord-rpc.lib
Normal file
BIN
libs/discord-rpc/win64-dynamic/lib/discord-rpc.lib
Normal file
Binary file not shown.
BIN
libs/dll-binaries/i686/discord-rpc.dll
Normal file
BIN
libs/dll-binaries/i686/discord-rpc.dll
Normal file
Binary file not shown.
BIN
libs/dll-binaries/x86_64/discord-rpc.dll
Normal file
BIN
libs/dll-binaries/x86_64/discord-rpc.dll
Normal file
Binary file not shown.
39
libs/drmingw/include/exchndl.h
Normal file
39
libs/drmingw/include/exchndl.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2002-2015 Jose Fonseca
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
// Set the unhandled exception handler.
|
||||
// Must be called when exchndll.dll is statically loaded (as opposed to loaded
|
||||
// dynamically via LoadLibrary)
|
||||
EXTERN_C VOID APIENTRY
|
||||
ExcHndlInit(void);
|
||||
|
||||
|
||||
// Override the report file name.
|
||||
//
|
||||
// Default is prog_name.RPT, in the same directory as the main executable.
|
||||
//
|
||||
// You can also pass "-" for stderr.
|
||||
EXTERN_C BOOL APIENTRY
|
||||
ExcHndlSetLogFileNameA(const char *szLogFileName);
|
||||
BIN
libs/drmingw/lib/win32/libexchndl.a
Normal file
BIN
libs/drmingw/lib/win32/libexchndl.a
Normal file
Binary file not shown.
BIN
libs/drmingw/lib/win32/libmgwhelp.a
Normal file
BIN
libs/drmingw/lib/win32/libmgwhelp.a
Normal file
Binary file not shown.
|
|
@ -246,6 +246,8 @@ 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_HWRENDER ON CACHE BOOL
|
||||
|
|
@ -260,7 +262,7 @@ set(SRB2_CONFIG_STATIC_OPENGL OFF CACHE BOOL
|
|||
### use internal libraries?
|
||||
if(${CMAKE_SYSTEM} MATCHES "Windows") ###set on Windows only
|
||||
set(SRB2_CONFIG_USE_INTERNAL_LIBRARIES OFF CACHE BOOL
|
||||
"Use SRB2's internal copies of required dependencies (SDL2, PNG, zlib, GME).")
|
||||
"Use SRB2Kart's internal copies of required dependencies (SDL2, PNG, zlib, GME).")
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_BLUA})
|
||||
|
|
@ -303,6 +305,7 @@ if(${SRB2_CONFIG_HAVE_BLUA})
|
|||
blua/lfunc.c
|
||||
blua/lgc.c
|
||||
blua/linit.c
|
||||
blua/liolib.c
|
||||
blua/llex.c
|
||||
blua/lmem.c
|
||||
blua/lobject.c
|
||||
|
|
@ -354,7 +357,7 @@ if(${SRB2_CONFIG_HAVE_GME})
|
|||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(GME_FOUND ON)
|
||||
set(GME_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/gme/include)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win64 -lgme")
|
||||
else() # 32-bit
|
||||
set(GME_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/gme/win32 -lgme")
|
||||
|
|
@ -370,6 +373,32 @@ if(${SRB2_CONFIG_HAVE_GME})
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_DISCORDRPC})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(DISCORDRPC_FOUND ON)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
set(DISCORDRPC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/discord-rpc/win64-dynamic/include)
|
||||
set(DISCORDRPC_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/discord-rpc/win64-dynamic/lib -ldiscord-rpc")
|
||||
else() # 32-bit
|
||||
set(DISCORDRPC_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/discord-rpc/win32-dynamic/include)
|
||||
set(DISCORDRPC_LIBRARIES "-L${CMAKE_SOURCE_DIR}/libs/discord-rpc/win32-dynamic/lib -ldiscord-rpc")
|
||||
endif()
|
||||
else()
|
||||
find_package(DiscordRPC)
|
||||
endif()
|
||||
if(${DISCORDRPC_FOUND})
|
||||
set(SRB2_HAVE_DISCORDRPC ON)
|
||||
add_definitions(-DHAVE_DISCORDRPC)
|
||||
set(SRB2_DISCORDRPC_SOURCES discord.c)
|
||||
set(SRB2_DISCORDRPC_HEADERS discord.h)
|
||||
prepend_sources(SRB2_DISCORDRPC_SOURCES)
|
||||
prepend_sources(SRB2_DISCORDRPC_HEADERS)
|
||||
source_group("Discord Rich Presence" FILES ${SRB2_DISCORDRPC_SOURCES} ${SRB2_DISCORDRPC_HEADERS})
|
||||
else()
|
||||
message(WARNING "You have specified that Discord Rich Presence is available but it was not found.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_ZLIB})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(ZLIB_FOUND ON)
|
||||
|
|
@ -422,7 +451,7 @@ endif()
|
|||
if(${SRB2_CONFIG_HAVE_CURL})
|
||||
if(${SRB2_CONFIG_USE_INTERNAL_LIBRARIES})
|
||||
set(CURL_FOUND ON)
|
||||
set(CURL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/libs/curl)
|
||||
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
|
||||
|
|
|
|||
85
src/Makefile
85
src/Makefile
|
|
@ -61,10 +61,10 @@
|
|||
# Compile a profile version, add 'PROFILEMODE=1'
|
||||
# Compile a debug version, add 'DEBUGMODE=1'
|
||||
# Compile for the testers group (they don't get to play unless we're watching *wink*), add 'TESTERS=1'
|
||||
# Compile with extra warnings, add 'WARNINGMODE=1'
|
||||
# Compile with less warnings, add 'RELAXWARNINGS=1'
|
||||
# Generate compiler errors for most compiler warnings, add 'ERRORMODE=1'
|
||||
# Compile without NASM's tmap.nas, add 'NOASM=1'
|
||||
# Compile without 3D hardware support, add 'NOHW=1'
|
||||
# Compile without 3D sound support, add 'NOHS=1'
|
||||
# Compile with GDBstubs, add 'RDB=1'
|
||||
# Compile without PNG, add 'NOPNG=1'
|
||||
# Compile without zlib, add 'NOZLIB=1'
|
||||
|
|
@ -82,6 +82,58 @@
|
|||
#
|
||||
#############################################################################
|
||||
|
||||
ALL_SYSTEMS=\
|
||||
PANDORA\
|
||||
LINUX64\
|
||||
MINGW64\
|
||||
HAIKU\
|
||||
DUMMY\
|
||||
DJGPPDOS\
|
||||
MINGW\
|
||||
UNIX\
|
||||
LINUX\
|
||||
SOLARIS\
|
||||
FREEBSD\
|
||||
MACOSX\
|
||||
SDL\
|
||||
|
||||
# check for user specified system
|
||||
ifeq (,$(filter $(ALL_SYSTEMS),$(.VARIABLES)))
|
||||
ifeq ($(OS),Windows_NT) # all windows are Windows_NT...
|
||||
|
||||
$(info Detected a Windows system, compiling for 32-bit MinGW SDL2...)
|
||||
|
||||
# go for a 32-bit sdl mingw exe by default
|
||||
MINGW=1
|
||||
SDL=1
|
||||
WINDOWSHELL=1
|
||||
|
||||
else # if you on the *nix
|
||||
|
||||
system:=$(shell uname -s)
|
||||
|
||||
ifeq ($(system),Linux)
|
||||
new_system=LINUX
|
||||
else
|
||||
|
||||
$(error \
|
||||
Could not automatically detect your system,\
|
||||
try specifying a system manually)
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(shell getconf LONG_BIT),64)
|
||||
system+=64-bit
|
||||
new_system:=$(new_system)64
|
||||
endif
|
||||
|
||||
$(info Detected $(system) ($(new_system))...)
|
||||
$(new_system)=1
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# SRB2 data files
|
||||
D_DIR?=../bin/Resources
|
||||
D_FILES=$(D_DIR)/main.kart \
|
||||
|
|
@ -135,7 +187,6 @@ NOPNG=1
|
|||
NOZLIB=1
|
||||
NONET=1
|
||||
NOHW=1
|
||||
NOHS=1
|
||||
NOASM=1
|
||||
NOIPX=1
|
||||
EXENAME?=srb2dummy
|
||||
|
|
@ -166,7 +217,6 @@ endif
|
|||
ifdef PANDORA
|
||||
NONX86=1
|
||||
NOHW=1
|
||||
NOHS=1
|
||||
endif
|
||||
|
||||
ifdef WII
|
||||
|
|
@ -216,7 +266,6 @@ NOPNG=1
|
|||
NOZLIB=1
|
||||
NONET=1
|
||||
#NOHW=1
|
||||
NOHS=1
|
||||
NOASM=1
|
||||
NOIPX=1
|
||||
NONX86=1
|
||||
|
|
@ -286,13 +335,6 @@ endif
|
|||
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o
|
||||
endif
|
||||
|
||||
ifdef NOHS
|
||||
OPTS+=-DNOHS
|
||||
else
|
||||
OPTS+=-DHW3SOUND
|
||||
OBJS+=$(OBJDIR)/hw3sound.o
|
||||
endif
|
||||
|
||||
OPTS += -DCOMPVERSION
|
||||
|
||||
ifndef NONX86
|
||||
|
|
@ -395,6 +437,12 @@ CFLAGS+=-DHAVE_MINIUPNPC
|
|||
endif
|
||||
endif
|
||||
|
||||
ifdef HAVE_DISCORDRPC
|
||||
LIBS+=-ldiscord-rpc
|
||||
CFLAGS+=-DHAVE_DISCORDRPC
|
||||
OBJS+=$(OBJDIR)/discord.o
|
||||
endif
|
||||
|
||||
ifndef NO_LUA
|
||||
include blua/Makefile.cfg
|
||||
endif
|
||||
|
|
@ -959,19 +1007,6 @@ $(OBJDIR)/r_minigl.o: hardware/r_minigl/r_minigl.c hardware/r_opengl/r_opengl.h
|
|||
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
||||
endif
|
||||
|
||||
ifndef NOHS
|
||||
$(OBJDIR)/s_ds3d.o: hardware/s_ds3d/s_ds3d.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_ds3d.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_ds3d/s_ds3d.c
|
||||
|
||||
$(OBJDIR)/s_fmod.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_fmod.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_fmod/s_fmod.c
|
||||
|
||||
$(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o $(WFLAGS) -D_WINDOWS -mwindows -c hardware/s_openal/s_openal.c
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -12,14 +12,15 @@
|
|||
# to avoid a false positive with the version detection...
|
||||
|
||||
SUPPORTED_GCC_VERSIONS:=\
|
||||
91\
|
||||
81 82 83\
|
||||
71 72\
|
||||
101 102\
|
||||
91 92 93\
|
||||
81 82 83 84\
|
||||
71 72 73 74 75\
|
||||
61 62 63 64\
|
||||
51 52 53 54\
|
||||
51 52 53 54 55\
|
||||
40 41 42 43 44 45 46 47 48 49
|
||||
|
||||
LATEST_GCC_VERSION=9.1
|
||||
LATEST_GCC_VERSION=10.2
|
||||
|
||||
# gcc or g++
|
||||
ifdef PREFIX
|
||||
|
|
@ -47,7 +48,9 @@ endif
|
|||
|
||||
# Automatically set version flag, but not if one was manually set
|
||||
ifeq (,$(filter GCC%,$(.VARIABLES)))
|
||||
ifneq (,$(findstring gcc,$(shell $(CC) --version))) # if it's GCC
|
||||
version:=$(shell $(CC) --version)
|
||||
# check if this is in fact GCC
|
||||
ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version))))
|
||||
version:=$(shell $(CC) -dumpversion)
|
||||
|
||||
# Turn version into words of major, minor
|
||||
|
|
@ -68,7 +71,27 @@ ifeq (,$(filter GCC%,$(.VARIABLES)))
|
|||
endif
|
||||
endif
|
||||
|
||||
ifdef GCC102
|
||||
GCC101=1
|
||||
endif
|
||||
|
||||
ifdef GCC101
|
||||
GCC93=1
|
||||
endif
|
||||
|
||||
ifdef GCC93
|
||||
GCC92=1
|
||||
endif
|
||||
|
||||
ifdef GCC92
|
||||
GCC91=1
|
||||
endif
|
||||
|
||||
ifdef GCC91
|
||||
GCC84=1
|
||||
endif
|
||||
|
||||
ifdef GCC84
|
||||
GCC83=1
|
||||
endif
|
||||
|
||||
|
|
@ -81,6 +104,18 @@ GCC81=1
|
|||
endif
|
||||
|
||||
ifdef GCC81
|
||||
GCC75=1
|
||||
endif
|
||||
|
||||
ifdef GCC75
|
||||
GCC74=1
|
||||
endif
|
||||
|
||||
ifdef GCC74
|
||||
GCC73=1
|
||||
endif
|
||||
|
||||
ifdef GCC73
|
||||
GCC72=1
|
||||
endif
|
||||
|
||||
|
|
@ -105,6 +140,10 @@ GCC61=1
|
|||
endif
|
||||
|
||||
ifdef GCC61
|
||||
GCC55=1
|
||||
endif
|
||||
|
||||
ifdef GCC55
|
||||
GCC54=1
|
||||
endif
|
||||
|
||||
|
|
@ -175,10 +214,7 @@ WFLAGS=-Wall
|
|||
ifndef GCC295
|
||||
#WFLAGS+=-Wno-packed
|
||||
endif
|
||||
ifdef ERRORMODE
|
||||
WARNINGMODE=1
|
||||
endif
|
||||
ifdef WARNINGMODE
|
||||
ifndef RELAXWARNINGS
|
||||
WFLAGS+=-W
|
||||
#WFLAGS+=-Wno-sign-compare
|
||||
ifndef GCC295
|
||||
|
|
|
|||
32
src/am_map.c
32
src/am_map.c
|
|
@ -862,10 +862,8 @@ static inline void AM_drawWalls(void)
|
|||
{
|
||||
size_t i;
|
||||
static mline_t l;
|
||||
#ifdef ESLOPE
|
||||
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
|
||||
#endif
|
||||
|
||||
for (i = 0; i < numlines; i++)
|
||||
{
|
||||
|
|
@ -873,7 +871,6 @@ static inline void AM_drawWalls(void)
|
|||
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
|
||||
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
|
||||
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
|
||||
#ifdef ESLOPE
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
if (slope) { \
|
||||
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \
|
||||
|
|
@ -888,7 +885,6 @@ static inline void AM_drawWalls(void)
|
|||
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
|
||||
}
|
||||
#undef SLOPEPARAMS
|
||||
#endif
|
||||
|
||||
if (!lines[i].backsector) // 1-sided
|
||||
{
|
||||
|
|
@ -897,19 +893,11 @@ static inline void AM_drawWalls(void)
|
|||
else
|
||||
AM_drawMline(&l, WALLCOLORS);
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
|
||||
{
|
||||
if (backf1 == backc1 && backf2 == backc2
|
||||
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
|
||||
#else
|
||||
else if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight // Back is thok barrier
|
||||
|| lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // Front is thok barrier
|
||||
{
|
||||
if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight
|
||||
&& lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // BOTH are thok barriers
|
||||
#endif
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||
|
|
@ -927,20 +915,10 @@ static inline void AM_drawWalls(void)
|
|||
else
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB) {
|
||||
#ifdef ESLOPE
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
#else
|
||||
if (lines[i].backsector->floorheight
|
||||
!= lines[i].frontsector->floorheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
#else
|
||||
else if (lines[i].backsector->ceilingheight
|
||||
!= lines[i].frontsector->ceilingheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
|
||||
}
|
||||
else
|
||||
|
|
@ -948,20 +926,10 @@ static inline void AM_drawWalls(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
#else
|
||||
if (lines[i].backsector->floorheight
|
||||
!= lines[i].frontsector->floorheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, FDWALLCOLORS); // floor level change
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
#else
|
||||
else if (lines[i].backsector->ceilingheight
|
||||
!= lines[i].frontsector->ceilingheight) {
|
||||
#endif
|
||||
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ OBJS:=$(OBJS) \
|
|||
$(OBJDIR)/ldo.o \
|
||||
$(OBJDIR)/lfunc.o \
|
||||
$(OBJDIR)/linit.o \
|
||||
$(OBJDIR)/liolib.o \
|
||||
$(OBJDIR)/llex.o \
|
||||
$(OBJDIR)/lmem.o \
|
||||
$(OBJDIR)/lobject.o \
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
static const luaL_Reg lualibs[] = {
|
||||
{"", luaopen_base},
|
||||
{LUA_TABLIBNAME, luaopen_table},
|
||||
{LUA_IOLIBNAME, luaopen_io},
|
||||
{LUA_STRLIBNAME, luaopen_string},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
|||
589
src/blua/liolib.c
Normal file
589
src/blua/liolib.c
Normal file
|
|
@ -0,0 +1,589 @@
|
|||
/*
|
||||
** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $
|
||||
** Standard I/O (and system) library
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define liolib_c
|
||||
#define LUA_LIB
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
#include "../i_system.h"
|
||||
#include "../doomdef.h"
|
||||
#include "../m_misc.h"
|
||||
|
||||
|
||||
|
||||
#define IO_INPUT 1
|
||||
#define IO_OUTPUT 2
|
||||
|
||||
#define FILELIMIT 1024*1024 // Size limit for reading/writing files
|
||||
|
||||
|
||||
static const char *const fnames[] = {"input", "output"};
|
||||
static const char *whitelist[] = { // Allow scripters to write files of these types to SRB2's folder
|
||||
".txt",
|
||||
".sav2",
|
||||
".cfg",
|
||||
".png",
|
||||
".bmp"
|
||||
};
|
||||
|
||||
|
||||
static int pushresult (lua_State *L, int i, const char *filename) {
|
||||
int en = errno; /* calls to Lua API may change this value */
|
||||
if (i) {
|
||||
lua_pushboolean(L, 1);
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
lua_pushnil(L);
|
||||
if (filename)
|
||||
lua_pushfstring(L, "%s: %s", filename, strerror(en));
|
||||
else
|
||||
lua_pushfstring(L, "%s", strerror(en));
|
||||
lua_pushinteger(L, en);
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void fileerror (lua_State *L, int arg, const char *filename) {
|
||||
lua_pushfstring(L, "%s: %s", filename, strerror(errno));
|
||||
luaL_argerror(L, arg, lua_tostring(L, -1));
|
||||
}
|
||||
|
||||
|
||||
#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE))
|
||||
|
||||
|
||||
static int io_type (lua_State *L) {
|
||||
void *ud;
|
||||
luaL_checkany(L, 1);
|
||||
ud = lua_touserdata(L, 1);
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE);
|
||||
if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1))
|
||||
lua_pushnil(L); /* not a file */
|
||||
else if (*((FILE **)ud) == NULL)
|
||||
lua_pushliteral(L, "closed file");
|
||||
else
|
||||
lua_pushliteral(L, "file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static FILE *tofile (lua_State *L) {
|
||||
FILE **f = tofilep(L);
|
||||
if (*f == NULL)
|
||||
luaL_error(L, "attempt to use a closed file");
|
||||
return *f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** When creating file handles, always creates a `closed' file handle
|
||||
** before opening the actual file; so, if there is a memory error, the
|
||||
** file is not left opened.
|
||||
*/
|
||||
static FILE **newfile (lua_State *L) {
|
||||
FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *));
|
||||
*pf = NULL; /* file handle is currently `closed' */
|
||||
luaL_getmetatable(L, LUA_FILEHANDLE);
|
||||
lua_setmetatable(L, -2);
|
||||
return pf;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** function to (not) close the standard files stdin, stdout, and stderr
|
||||
*/
|
||||
static int io_noclose (lua_State *L) {
|
||||
lua_pushnil(L);
|
||||
lua_pushliteral(L, "cannot close standard file");
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** function to close regular files
|
||||
*/
|
||||
static int io_fclose (lua_State *L) {
|
||||
FILE **p = tofilep(L);
|
||||
int ok = (fclose(*p) == 0);
|
||||
*p = NULL;
|
||||
return pushresult(L, ok, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int aux_close (lua_State *L) {
|
||||
lua_getfenv(L, 1);
|
||||
lua_getfield(L, -1, "__close");
|
||||
return (lua_tocfunction(L, -1))(L);
|
||||
}
|
||||
|
||||
|
||||
static int io_close (lua_State *L) {
|
||||
if (lua_isnone(L, 1))
|
||||
lua_rawgeti(L, LUA_ENVIRONINDEX, IO_OUTPUT);
|
||||
tofile(L); /* make sure argument is a file */
|
||||
return aux_close(L);
|
||||
}
|
||||
|
||||
|
||||
static int io_gc (lua_State *L) {
|
||||
FILE *f = *tofilep(L);
|
||||
/* ignore closed files */
|
||||
if (f != NULL)
|
||||
aux_close(L);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int io_tostring (lua_State *L) {
|
||||
FILE *f = *tofilep(L);
|
||||
if (f == NULL)
|
||||
lua_pushliteral(L, "file (closed)");
|
||||
else
|
||||
lua_pushfstring(L, "file (%p)", f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int StartsWith(const char *a, const char *b) // this is wolfs being lazy yet again
|
||||
{
|
||||
if(strncmp(a, b, strlen(b)) == 0) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int io_open (lua_State *L) {
|
||||
FILE **pf;
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
int pass = 0;
|
||||
size_t i;
|
||||
int length = strlen(filename);
|
||||
char *splitter, *forward, *backward;
|
||||
char *destFilename;
|
||||
const char *mode = luaL_optstring(L, 2, "r");
|
||||
|
||||
for (i = 0; i < (sizeof (whitelist) / sizeof(const char *)); i++)
|
||||
{
|
||||
if (!stricmp(&filename[length - strlen(whitelist[i])], whitelist[i]))
|
||||
{
|
||||
pass = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\")
|
||||
|| StartsWith(filename, "/") || !pass)
|
||||
{
|
||||
luaL_error(L,"access denied to %s", filename);
|
||||
return pushresult(L,0,filename);
|
||||
}
|
||||
|
||||
destFilename = va("luafiles"PATHSEP"%s", filename);
|
||||
|
||||
// Make directories as needed
|
||||
splitter = destFilename;
|
||||
|
||||
forward = strchr(splitter, '/');
|
||||
backward = strchr(splitter, '\\');
|
||||
while ((splitter = (forward && backward) ? min(forward, backward) : (forward ?: backward)))
|
||||
{
|
||||
*splitter = 0;
|
||||
I_mkdir(destFilename, 0755);
|
||||
*splitter = '/';
|
||||
splitter++;
|
||||
|
||||
forward = strchr(splitter, '/');
|
||||
backward = strchr(splitter, '\\');
|
||||
}
|
||||
|
||||
pf = newfile(L);
|
||||
*pf = fopen(destFilename, mode);
|
||||
return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
|
||||
}
|
||||
|
||||
|
||||
static int io_tmpfile (lua_State *L) {
|
||||
FILE **pf = newfile(L);
|
||||
*pf = tmpfile();
|
||||
return (*pf == NULL) ? pushresult(L, 0, NULL) : 1;
|
||||
}
|
||||
|
||||
|
||||
static FILE *getiofile (lua_State *L, int findex) {
|
||||
FILE *f;
|
||||
lua_rawgeti(L, LUA_ENVIRONINDEX, findex);
|
||||
f = *(FILE **)lua_touserdata(L, -1);
|
||||
if (f == NULL)
|
||||
luaL_error(L, "standard %s file is closed", fnames[findex - 1]);
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
static int g_iofile (lua_State *L, int f, const char *mode) {
|
||||
if (!lua_isnoneornil(L, 1)) {
|
||||
const char *filename = lua_tostring(L, 1);
|
||||
if (filename) {
|
||||
FILE **pf = newfile(L);
|
||||
*pf = fopen(filename, mode);
|
||||
if (*pf == NULL)
|
||||
fileerror(L, 1, filename);
|
||||
}
|
||||
else {
|
||||
tofile(L); /* check that it's a valid file handle */
|
||||
lua_pushvalue(L, 1);
|
||||
}
|
||||
lua_rawseti(L, LUA_ENVIRONINDEX, f);
|
||||
}
|
||||
/* return current value */
|
||||
lua_rawgeti(L, LUA_ENVIRONINDEX, f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int io_input (lua_State *L) {
|
||||
return g_iofile(L, IO_INPUT, "r");
|
||||
}
|
||||
|
||||
|
||||
static int io_output (lua_State *L) {
|
||||
return g_iofile(L, IO_OUTPUT, "w");
|
||||
}
|
||||
|
||||
|
||||
static int io_readline (lua_State *L);
|
||||
|
||||
|
||||
static void aux_lines (lua_State *L, int idx, int toclose) {
|
||||
lua_pushvalue(L, idx);
|
||||
lua_pushboolean(L, toclose); /* close/not close file when finished */
|
||||
lua_pushcclosure(L, io_readline, 2);
|
||||
}
|
||||
|
||||
|
||||
static int f_lines (lua_State *L) {
|
||||
tofile(L); /* check that it's a valid file handle */
|
||||
aux_lines(L, 1, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int io_lines (lua_State *L) {
|
||||
if (lua_isnoneornil(L, 1)) { /* no arguments? */
|
||||
/* will iterate over default input */
|
||||
lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT);
|
||||
return f_lines(L);
|
||||
}
|
||||
else {
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
FILE **pf = newfile(L);
|
||||
*pf = fopen(filename, "r");
|
||||
if (*pf == NULL)
|
||||
fileerror(L, 1, filename);
|
||||
aux_lines(L, lua_gettop(L), 1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** READ
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
|
||||
static int read_number (lua_State *L, FILE *f) {
|
||||
lua_Number d;
|
||||
if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
|
||||
lua_pushnumber(L, d);
|
||||
return 1;
|
||||
}
|
||||
else return 0; /* read fails */
|
||||
}
|
||||
|
||||
|
||||
static int test_eof (lua_State *L, FILE *f) {
|
||||
int c = getc(f);
|
||||
ungetc(c, f);
|
||||
lua_pushlstring(L, NULL, 0);
|
||||
return (c != EOF);
|
||||
}
|
||||
|
||||
|
||||
static int read_line (lua_State *L, FILE *f) {
|
||||
luaL_Buffer b;
|
||||
luaL_buffinit(L, &b);
|
||||
for (;;) {
|
||||
size_t l;
|
||||
char *p = luaL_prepbuffer(&b);
|
||||
if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */
|
||||
luaL_pushresult(&b); /* close buffer */
|
||||
return (lua_objlen(L, -1) > 0); /* check whether read something */
|
||||
}
|
||||
l = strlen(p);
|
||||
if (l == 0 || p[l-1] != '\n')
|
||||
luaL_addsize(&b, l);
|
||||
else {
|
||||
luaL_addsize(&b, l - 1); /* do not include `eol' */
|
||||
luaL_pushresult(&b); /* close buffer */
|
||||
return 1; /* read at least an `eol' */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int read_chars (lua_State *L, FILE *f, size_t n) {
|
||||
size_t rlen; /* how much to read */
|
||||
size_t nr; /* number of chars actually read */
|
||||
luaL_Buffer b;
|
||||
luaL_buffinit(L, &b);
|
||||
rlen = LUAL_BUFFERSIZE; /* try to read that much each time */
|
||||
do {
|
||||
char *p = luaL_prepbuffer(&b);
|
||||
if (rlen > n) rlen = n; /* cannot read more than asked */
|
||||
nr = fread(p, sizeof(char), rlen, f);
|
||||
luaL_addsize(&b, nr);
|
||||
n -= nr; /* still have to read `n' chars */
|
||||
} while (n > 0 && nr == rlen); /* until end of count or eof */
|
||||
luaL_pushresult(&b); /* close buffer */
|
||||
return (n == 0 || lua_objlen(L, -1) > 0);
|
||||
}
|
||||
|
||||
|
||||
static int g_read (lua_State *L, FILE *f, int first) {
|
||||
int nargs = lua_gettop(L) - 1;
|
||||
int success;
|
||||
int n;
|
||||
clearerr(f);
|
||||
if (nargs == 0) { /* no arguments? */
|
||||
success = read_line(L, f);
|
||||
n = first+1; /* to return 1 result */
|
||||
}
|
||||
else { /* ensure stack space for all results and for auxlib's buffer */
|
||||
luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments");
|
||||
success = 1;
|
||||
for (n = first; nargs-- && success; n++) {
|
||||
if (lua_type(L, n) == LUA_TNUMBER) {
|
||||
size_t l = (size_t)lua_tointeger(L, n);
|
||||
success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l);
|
||||
}
|
||||
else {
|
||||
const char *p = lua_tostring(L, n);
|
||||
luaL_argcheck(L, p && p[0] == '*', n, "invalid option");
|
||||
switch (p[1]) {
|
||||
case 'n': /* number */
|
||||
success = read_number(L, f);
|
||||
break;
|
||||
case 'l': /* line */
|
||||
success = read_line(L, f);
|
||||
break;
|
||||
case 'a': /* file */
|
||||
read_chars(L, f, ~((size_t)0)); /* read MAX_SIZE_T chars */
|
||||
success = 1; /* always success */
|
||||
break;
|
||||
default:
|
||||
return luaL_argerror(L, n, "invalid format");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ferror(f))
|
||||
return pushresult(L, 0, NULL);
|
||||
if (!success) {
|
||||
lua_pop(L, 1); /* remove last result */
|
||||
lua_pushnil(L); /* push nil instead */
|
||||
}
|
||||
return n - first;
|
||||
}
|
||||
|
||||
|
||||
static int io_read (lua_State *L) {
|
||||
return g_read(L, getiofile(L, IO_INPUT), 1);
|
||||
}
|
||||
|
||||
|
||||
static int f_read (lua_State *L) {
|
||||
return g_read(L, tofile(L), 2);
|
||||
}
|
||||
|
||||
|
||||
static int io_readline (lua_State *L) {
|
||||
FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1));
|
||||
int sucess;
|
||||
if (f == NULL) /* file is already closed? */
|
||||
luaL_error(L, "file is already closed");
|
||||
sucess = read_line(L, f);
|
||||
if (ferror(f))
|
||||
return luaL_error(L, "%s", strerror(errno));
|
||||
if (sucess) return 1;
|
||||
else { /* EOF */
|
||||
if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */
|
||||
lua_settop(L, 0);
|
||||
lua_pushvalue(L, lua_upvalueindex(1));
|
||||
aux_close(L); /* close it */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
static int g_write (lua_State *L, FILE *f, int arg) {
|
||||
int nargs = lua_gettop(L) - 1;
|
||||
int status = 1;
|
||||
size_t count;
|
||||
for (; nargs--; arg++) {
|
||||
if (lua_type(L, arg) == LUA_TNUMBER) {
|
||||
/* optimization: could be done exactly as for strings */
|
||||
status = status &&
|
||||
fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0;
|
||||
}
|
||||
else {
|
||||
size_t l;
|
||||
const char *s = luaL_checklstring(L, arg, &l);
|
||||
count += l;
|
||||
if (ftell(f) + l > FILELIMIT)
|
||||
{
|
||||
luaL_error(L,"write limit bypassed in file. Changes have been discarded.");
|
||||
break;
|
||||
}
|
||||
status = status && (fwrite(s, sizeof(char), l, f) == l);
|
||||
}
|
||||
}
|
||||
return pushresult(L, status, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int io_write (lua_State *L) {
|
||||
return g_write(L, getiofile(L, IO_OUTPUT), 1);
|
||||
}
|
||||
|
||||
|
||||
static int f_write (lua_State *L) {
|
||||
return g_write(L, tofile(L), 2);
|
||||
}
|
||||
|
||||
|
||||
static int f_seek (lua_State *L) {
|
||||
static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END};
|
||||
static const char *const modenames[] = {"set", "cur", "end", NULL};
|
||||
FILE *f = tofile(L);
|
||||
int op = luaL_checkoption(L, 2, "cur", modenames);
|
||||
long offset = luaL_optlong(L, 3, 0);
|
||||
op = fseek(f, offset, mode[op]);
|
||||
if (op)
|
||||
return pushresult(L, 0, NULL); /* error */
|
||||
else {
|
||||
lua_pushinteger(L, ftell(f));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int f_setvbuf (lua_State *L) {
|
||||
static const int mode[] = {_IONBF, _IOFBF, _IOLBF};
|
||||
static const char *const modenames[] = {"no", "full", "line", NULL};
|
||||
FILE *f = tofile(L);
|
||||
int op = luaL_checkoption(L, 2, NULL, modenames);
|
||||
lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE);
|
||||
int res = setvbuf(f, NULL, mode[op], sz);
|
||||
return pushresult(L, res == 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int io_flush (lua_State *L) {
|
||||
return pushresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int f_flush (lua_State *L) {
|
||||
return pushresult(L, fflush(tofile(L)) == 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
static const luaL_Reg iolib[] = {
|
||||
{"close", io_close},
|
||||
{"flush", io_flush},
|
||||
{"input", io_input},
|
||||
{"lines", io_lines},
|
||||
{"open", io_open},
|
||||
{"output", io_output},
|
||||
{"read", io_read},
|
||||
{"tmpfile", io_tmpfile},
|
||||
{"type", io_type},
|
||||
{"write", io_write},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static const luaL_Reg flib[] = {
|
||||
{"close", io_close},
|
||||
{"flush", f_flush},
|
||||
{"lines", f_lines},
|
||||
{"read", f_read},
|
||||
{"seek", f_seek},
|
||||
{"setvbuf", f_setvbuf},
|
||||
{"write", f_write},
|
||||
{"__gc", io_gc},
|
||||
{"__tostring", io_tostring},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
static void createmeta (lua_State *L) {
|
||||
luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */
|
||||
lua_pushvalue(L, -1); /* push metatable */
|
||||
lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */
|
||||
luaL_register(L, NULL, flib); /* file methods */
|
||||
}
|
||||
|
||||
|
||||
static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) {
|
||||
*newfile(L) = f;
|
||||
if (k > 0) {
|
||||
lua_pushvalue(L, -1);
|
||||
lua_rawseti(L, LUA_ENVIRONINDEX, k);
|
||||
}
|
||||
lua_pushvalue(L, -2); /* copy environment */
|
||||
lua_setfenv(L, -2); /* set it */
|
||||
lua_setfield(L, -3, fname);
|
||||
}
|
||||
|
||||
|
||||
static void newfenv (lua_State *L, lua_CFunction cls) {
|
||||
lua_createtable(L, 0, 1);
|
||||
lua_pushcfunction(L, cls);
|
||||
lua_setfield(L, -2, "__close");
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API int luaopen_io (lua_State *L) {
|
||||
createmeta(L);
|
||||
/* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */
|
||||
newfenv(L, io_fclose);
|
||||
lua_replace(L, LUA_ENVIRONINDEX);
|
||||
/* open library */
|
||||
luaL_register(L, LUA_IOLIBNAME, iolib);
|
||||
/* create (and set) default files */
|
||||
newfenv(L, io_noclose); /* close function for default files */
|
||||
createstdfile(L, stdin, IO_INPUT, "stdin");
|
||||
createstdfile(L, stdout, IO_OUTPUT, "stdout");
|
||||
createstdfile(L, stderr, 0, "stderr");
|
||||
lua_pop(L, 1); /* pop environment for default files */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -21,6 +21,9 @@ LUALIB_API int (luaopen_base) (lua_State *L);
|
|||
#define LUA_TABLIBNAME "table"
|
||||
LUALIB_API int (luaopen_table) (lua_State *L);
|
||||
|
||||
#define LUA_IOLIBNAME "io"
|
||||
LUALIB_API int (luaopen_io) (lua_State *L);
|
||||
|
||||
#define LUA_STRLIBNAME "string"
|
||||
LUALIB_API int (luaopen_string) (lua_State *L);
|
||||
|
||||
|
|
|
|||
|
|
@ -322,8 +322,8 @@ static void Arith (lua_State *L, StkId ra, TValue *rb,
|
|||
case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break;
|
||||
case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break;
|
||||
case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break;
|
||||
case TM_DIV: if (nc == 0) { lua_pushliteral(L, "divide by zero error"); lua_error(L); } else setnvalue(ra, luai_numdiv(nb, nc)); break;
|
||||
case TM_MOD: if (nc == 0) { lua_pushliteral(L, "modulo by zero error"); lua_error(L); } else setnvalue(ra, luai_nummod(nb, nc)); break;
|
||||
case TM_DIV: if (nc == 0) { luaG_runerror(L, "divide by zero error"); } else setnvalue(ra, luai_numdiv(nb, nc)); break;
|
||||
case TM_MOD: if (nc == 0) { luaG_runerror(L, "modulo by zero error"); } else setnvalue(ra, luai_nummod(nb, nc)); break;
|
||||
case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break;
|
||||
case TM_UNM: setnvalue(ra, luai_numunm(nb)); break;
|
||||
case TM_AND: setnvalue(ra, luai_numand(nb, nc)); break;
|
||||
|
|
@ -492,8 +492,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
|||
if (ttisnumber(rb) && ttisnumber(rc)) {
|
||||
lua_Number nb = nvalue(rb), nc = nvalue(rc);
|
||||
if (nc == 0) {
|
||||
lua_pushliteral(L, "divide by zero error");
|
||||
lua_error(L);
|
||||
luaG_runerror(L, "divide by zero error");
|
||||
}
|
||||
else
|
||||
setnvalue(ra, luai_numdiv(nb, nc));
|
||||
|
|
@ -508,8 +507,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
|||
if (ttisnumber(rb) && ttisnumber(rc)) {
|
||||
lua_Number nb = nvalue(rb), nc = nvalue(rc);
|
||||
if (nc == 0) {
|
||||
lua_pushliteral(L, "modulo by zero error");
|
||||
lua_error(L);
|
||||
luaG_runerror(L, "modulo by zero error");
|
||||
}
|
||||
else
|
||||
setnvalue(ra, luai_nummod(nb, nc));
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
/* Manually defined asset hashes for non-CMake builds
|
||||
* Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets
|
||||
* Last updated 2020 / 05 / 09 - Kart v1.2 - patch.kart
|
||||
* Last updated 2020 / 08 / 30 - Kart v1.3 - patch.kart
|
||||
*/
|
||||
|
||||
#define ASSET_HASH_MAIN_KART "00000000000000000000000000000000"
|
||||
|
|
|
|||
626
src/d_clisrv.c
626
src/d_clisrv.c
File diff suppressed because it is too large
Load diff
|
|
@ -36,13 +36,7 @@ applications may follow different packet versions.
|
|||
|
||||
// SOME numpty changed all the gametype constants and it fell out of sync with vanilla and now we have to pretend to be vanilla when talking to the master server...
|
||||
#define VANILLA_GT_RACE 2
|
||||
// Woah, what do these numbers mean? 200 refers to SRB2 2.0, 246 refers to
|
||||
// SRB2Riders. Both use the old 2.0 gametype numbers.
|
||||
#if VERSION == 200 || VERSION == 246
|
||||
#define VANILLA_GT_MATCH 1
|
||||
#else
|
||||
#define VANILLA_GT_MATCH 3
|
||||
#endif
|
||||
|
||||
// Networking and tick handling related.
|
||||
#define BACKUPTICS 32
|
||||
|
|
@ -363,6 +357,11 @@ typedef struct
|
|||
|
||||
char server_context[8]; // Unique context id, generated at server startup.
|
||||
|
||||
// Discord info (always defined for net compatibility)
|
||||
UINT8 maxplayer;
|
||||
boolean allownewplayer;
|
||||
boolean discordinvites;
|
||||
|
||||
UINT8 varlengthinputs[0]; // Playernames and netvars
|
||||
} ATTRPACK serverconfig_pak;
|
||||
|
||||
|
|
@ -564,6 +563,10 @@ typedef enum
|
|||
|
||||
} kickreason_t;
|
||||
|
||||
/* the max number of name changes in some time period */
|
||||
#define MAXNAMECHANGES (5)
|
||||
#define NAMECHANGERATE (60*TICRATE)
|
||||
|
||||
extern boolean server;
|
||||
extern boolean serverrunning;
|
||||
#define client (!server)
|
||||
|
|
@ -589,6 +592,8 @@ extern consvar_t
|
|||
#endif
|
||||
cv_netticbuffer, cv_allownewplayer, cv_maxplayers, cv_resynchattempts, cv_blamecfail, cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||
|
||||
extern consvar_t cv_discordinvites;
|
||||
|
||||
// Used in d_net, the only dependence
|
||||
tic_t ExpandTics(INT32 low, tic_t basetic);
|
||||
void D_ClientServerInit(void);
|
||||
|
|
@ -615,7 +620,7 @@ void CL_Reset(void);
|
|||
void CL_ClearPlayer(INT32 playernum);
|
||||
void CL_RemovePlayer(INT32 playernum, INT32 reason);
|
||||
void CL_QueryServerList(msg_server_t *list);
|
||||
void CL_UpdateServerList(boolean internetsearch, INT32 room);
|
||||
void CL_UpdateServerList(void);
|
||||
// Is there a game running
|
||||
boolean Playing(void);
|
||||
|
||||
|
|
|
|||
73
src/d_main.c
73
src/d_main.c
|
|
@ -69,7 +69,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
|||
#include "m_cheat.h"
|
||||
#include "y_inter.h"
|
||||
#include "p_local.h" // chasecam
|
||||
#include "mserv.h" // ms_RoomId
|
||||
#include "m_misc.h" // screenshot functionality
|
||||
#include "dehacked.h" // Dehacked list test
|
||||
#include "m_cond.h" // condition initialization
|
||||
|
|
@ -104,6 +103,10 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
|||
#include "lua_script.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
#endif
|
||||
|
||||
// platform independant focus loss
|
||||
UINT8 window_notinfocus = false;
|
||||
|
||||
|
|
@ -722,6 +725,13 @@ void D_SRB2Loop(void)
|
|||
#ifdef HAVE_BLUA
|
||||
LUA_Step();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (! dedicated)
|
||||
{
|
||||
Discord_RunCallbacks();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -839,9 +849,23 @@ static inline void D_CleanFile(char **filearray)
|
|||
// Identify the SRB2 version, and IWAD file to use.
|
||||
// ==========================================================================
|
||||
|
||||
static boolean AddIWAD(void)
|
||||
{
|
||||
char * path = va(pandf,srb2path,"srb2.srb");
|
||||
|
||||
if (FIL_ReadFileOK(path))
|
||||
{
|
||||
D_AddFile(path, startupwadfiles);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void IdentifyVersion(void)
|
||||
{
|
||||
char *mainresource;
|
||||
const char *srb2waddir = NULL;
|
||||
|
||||
#if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
|
||||
|
|
@ -865,36 +889,21 @@ static void IdentifyVersion(void)
|
|||
#ifdef _arch_dreamcast
|
||||
srb2waddir = "/cd";
|
||||
#else
|
||||
srb2waddir = ".";
|
||||
srb2waddir = srb2path;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if defined (macintosh) && !defined (HAVE_SDL)
|
||||
// cwd is always "/" when app is dbl-clicked
|
||||
if (!stricmp(srb2waddir, "/"))
|
||||
srb2waddir = I_GetWadDir();
|
||||
#endif
|
||||
// Commercial.
|
||||
mainresource = malloc(strlen(srb2waddir)+1+9+1);
|
||||
if (mainresource == NULL)
|
||||
I_Error("No more free memory to look in %s", srb2waddir);
|
||||
if (mainresource != NULL)
|
||||
sprintf(mainresource, pandf, srb2waddir, "main.kart");
|
||||
// Load the IWAD
|
||||
if (! AddIWAD())
|
||||
{
|
||||
I_Error("MAIN.KART not found! Expected in %s\n", srb2waddir);
|
||||
}
|
||||
|
||||
// will be overwritten in case of -cdrom or unix/win home
|
||||
snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, srb2waddir);
|
||||
configfile[sizeof configfile - 1] = '\0';
|
||||
|
||||
// Load the IWAD
|
||||
if (mainresource != NULL && FIL_ReadFileOK(mainresource))
|
||||
D_AddFile(mainresource, startupwadfiles);
|
||||
else
|
||||
I_Error("MAIN.KART not found! Expected in %s, ss file: %s \n", srb2waddir, mainresource);
|
||||
|
||||
if (mainresource)
|
||||
free(mainresource);
|
||||
|
||||
// if you change the ordering of this or add/remove a file, be sure to update the md5
|
||||
// checking in D_SRB2Main
|
||||
|
||||
|
|
@ -1428,17 +1437,6 @@ void D_SRB2Main(void)
|
|||
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||
ST_Init();
|
||||
|
||||
if (M_CheckParm("-room"))
|
||||
{
|
||||
if (!M_IsNextParm())
|
||||
I_Error("usage: -room <room_id>\nCheck the Master Server's webpage for room ID numbers.\n");
|
||||
ms_RoomId = atoi(M_GetNextParm());
|
||||
|
||||
#ifdef UPDATE_ALERT
|
||||
GetMODVersion_Console();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Set up splitscreen players before joining!
|
||||
if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm()))
|
||||
{
|
||||
|
|
@ -1643,6 +1641,13 @@ void D_SRB2Main(void)
|
|||
if (!P_SetupLevel(false))
|
||||
I_Quit(); // fail so reset game stuff
|
||||
}
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (! dedicated)
|
||||
{
|
||||
DRPC_Init();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *D_Home(void)
|
||||
|
|
|
|||
101
src/d_netcmd.c
101
src/d_netcmd.c
|
|
@ -60,6 +60,10 @@
|
|||
#define CV_RESTRICT 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
#endif
|
||||
|
||||
// ------
|
||||
// protos
|
||||
// ------
|
||||
|
|
@ -88,6 +92,7 @@ static void Got_RandomSeed(UINT8 **cp, INT32 playernum);
|
|||
static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Teamchange(UINT8 **cp, INT32 playernum);
|
||||
static void Got_Clearscores(UINT8 **cp, INT32 playernum);
|
||||
static void Got_DiscordInfo(UINT8 **cp, INT32 playernum);
|
||||
|
||||
static void PointLimit_OnChange(void);
|
||||
static void TimeLimit_OnChange(void);
|
||||
|
|
@ -811,10 +816,13 @@ void D_RegisterServerCommands(void)
|
|||
CV_RegisterVar(&cv_showviewpointtext);
|
||||
|
||||
#ifdef SEENAMES
|
||||
CV_RegisterVar(&cv_allowseenames);
|
||||
CV_RegisterVar(&cv_allowseenames);
|
||||
#endif
|
||||
|
||||
CV_RegisterVar(&cv_dummyconsvar);
|
||||
|
||||
CV_RegisterVar(&cv_discordinvites);
|
||||
RegisterNetXCmd(XD_DISCORD, Got_DiscordInfo);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
|
|
@ -1161,6 +1169,12 @@ void D_RegisterClientCommands(void)
|
|||
#if defined(HAVE_BLUA) && defined(LUA_ALLOW_BYTECODE)
|
||||
COM_AddCommand("dumplua", Command_Dumplua_f);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
CV_RegisterVar(&cv_discordrp);
|
||||
CV_RegisterVar(&cv_discordstreamer);
|
||||
CV_RegisterVar(&cv_discordasks);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Checks if a name (as received from another player) is okay.
|
||||
|
|
@ -1365,6 +1379,8 @@ static void SetPlayerName(INT32 playernum, char *newname)
|
|||
if (netgame)
|
||||
HU_AddChatText(va("\x82*%s renamed to %s", player_names[playernum], newname), false);
|
||||
|
||||
player_name_changes[playernum]++;
|
||||
|
||||
strcpy(player_names[playernum], newname);
|
||||
demo_extradata[playernum] |= DXD_NAME;
|
||||
}
|
||||
|
|
@ -1587,7 +1603,12 @@ static void SendNameAndColor(void)
|
|||
snacpending++;
|
||||
|
||||
// Don't change name if muted
|
||||
if (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer)))
|
||||
if (player_name_changes[consoleplayer] >= MAXNAMECHANGES)
|
||||
{
|
||||
CV_StealthSet(&cv_playername, player_names[consoleplayer]);
|
||||
HU_AddChatText("\x85*You must wait to change your name again", false);
|
||||
}
|
||||
else if (cv_mute.value && !(server || IsPlayerAdmin(consoleplayer)))
|
||||
CV_StealthSet(&cv_playername, player_names[consoleplayer]);
|
||||
else // Cleanup name if changing it
|
||||
CleanupPlayerName(consoleplayer, cv_playername.zstring);
|
||||
|
|
@ -1717,7 +1738,12 @@ static void SendNameAndColor2(void)
|
|||
snac2pending++;
|
||||
|
||||
// Don't change name if muted
|
||||
if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[1])))
|
||||
if (player_name_changes[g_localplayers[1]] >= MAXNAMECHANGES)
|
||||
{
|
||||
CV_StealthSet(&cv_playername2, player_names[g_localplayers[1]]);
|
||||
HU_AddChatText("\x85*You must wait to change your name again", false);
|
||||
}
|
||||
else if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[1])))
|
||||
CV_StealthSet(&cv_playername2, player_names[g_localplayers[1]]);
|
||||
else // Cleanup name if changing it
|
||||
CleanupPlayerName(g_localplayers[1], cv_playername2.zstring);
|
||||
|
|
@ -1846,7 +1872,12 @@ static void SendNameAndColor3(void)
|
|||
snac3pending++;
|
||||
|
||||
// Don't change name if muted
|
||||
if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[2])))
|
||||
if (player_name_changes[g_localplayers[2]] >= MAXNAMECHANGES)
|
||||
{
|
||||
CV_StealthSet(&cv_playername3, player_names[g_localplayers[2]]);
|
||||
HU_AddChatText("\x85*You must wait to change your name again", false);
|
||||
}
|
||||
else if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[2])))
|
||||
CV_StealthSet(&cv_playername3, player_names[g_localplayers[2]]);
|
||||
else // Cleanup name if changing it
|
||||
CleanupPlayerName(g_localplayers[2], cv_playername3.zstring);
|
||||
|
|
@ -1975,7 +2006,12 @@ static void SendNameAndColor4(void)
|
|||
snac4pending++;
|
||||
|
||||
// Don't change name if muted
|
||||
if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[3])))
|
||||
if (player_name_changes[g_localplayers[3]] >= MAXNAMECHANGES)
|
||||
{
|
||||
CV_StealthSet(&cv_playername4, player_names[g_localplayers[3]]);
|
||||
HU_AddChatText("\x85*You must wait to change your name again", false);
|
||||
}
|
||||
else if (cv_mute.value && !(server || IsPlayerAdmin(g_localplayers[3])))
|
||||
CV_StealthSet(&cv_playername4, player_names[g_localplayers[3]]);
|
||||
else // Cleanup name if changing it
|
||||
CleanupPlayerName(g_localplayers[3], cv_playername4.zstring);
|
||||
|
|
@ -2035,8 +2071,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
followercolor = READSINT8(*cp);
|
||||
|
||||
// set name
|
||||
if (strcasecmp(player_names[playernum], name) != 0)
|
||||
SetPlayerName(playernum, name);
|
||||
if (player_name_changes[playernum] < MAXNAMECHANGES)
|
||||
{
|
||||
if (strcasecmp(player_names[playernum], name) != 0)
|
||||
SetPlayerName(playernum, name);
|
||||
}
|
||||
|
||||
// set color
|
||||
p->skincolor = color % MAXSKINCOLORS;
|
||||
|
|
@ -2099,6 +2138,11 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
|||
|
||||
// set follower
|
||||
SetFollower(playernum, follower);
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (playernum == consoleplayer)
|
||||
DRPC_UpdatePresence();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SendWeaponPref(void)
|
||||
|
|
@ -3305,6 +3349,10 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
if (demo.recording) // Okay, level loaded, character spawned and skinned,
|
||||
G_BeginRecording(); // I AM NOW READY TO RECORD.
|
||||
demo.deferstart = true;
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
DRPC_UpdatePresence();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Command_Pause(void)
|
||||
|
|
@ -4728,7 +4776,7 @@ static void Command_RunSOC(void)
|
|||
static void Got_RunSOCcmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char filename[256];
|
||||
filestatus_t ncs = FS_NOTFOUND;
|
||||
filestatus_t ncs = FS_NOTCHECKED;
|
||||
|
||||
if (playernum != serverplayer && !IsPlayerAdmin(playernum))
|
||||
{
|
||||
|
|
@ -4900,7 +4948,7 @@ static void Command_Delfile(void)
|
|||
static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char filename[241];
|
||||
filestatus_t ncs = FS_NOTFOUND;
|
||||
filestatus_t ncs = FS_NOTCHECKED;
|
||||
UINT8 md5sum[16];
|
||||
boolean kick = false;
|
||||
boolean toomany = false;
|
||||
|
|
@ -4995,7 +5043,7 @@ static void Got_Delfilecmd(UINT8 **cp, INT32 playernum)
|
|||
static void Got_Addfilecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
char filename[241];
|
||||
filestatus_t ncs = FS_NOTFOUND;
|
||||
filestatus_t ncs = FS_NOTCHECKED;
|
||||
UINT8 md5sum[16];
|
||||
|
||||
READSTRINGN(*cp, filename, 240);
|
||||
|
|
@ -5293,6 +5341,10 @@ static void TimeLimit_OnChange(void)
|
|||
}
|
||||
else if (netgame || multiplayer)
|
||||
CONS_Printf(M_GetText("Time limit disabled\n"));
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
DRPC_UpdatePresence();
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Adjusts certain settings to match a changed gametype.
|
||||
|
|
@ -6651,3 +6703,32 @@ static void KartEliminateLast_OnChange(void)
|
|||
P_CheckRacers();
|
||||
}
|
||||
}
|
||||
|
||||
void Got_DiscordInfo(UINT8 **p, INT32 playernum)
|
||||
{
|
||||
if (playernum != serverplayer /*&& !IsPlayerAdmin(playernum)*/)
|
||||
{
|
||||
// protect against hacked/buggy client
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Illegal Discord info command received from %s\n"), player_names[playernum]);
|
||||
if (server)
|
||||
{
|
||||
XBOXSTATIC UINT8 buf[2];
|
||||
|
||||
buf[0] = (UINT8)playernum;
|
||||
buf[1] = KICK_MSG_CON_FAIL;
|
||||
SendNetXCmd(XD_KICK, &buf, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't do anything with the information if we don't have Discord RP support
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
discordInfo.maxPlayers = READUINT8(*p);
|
||||
discordInfo.joinsAllowed = (boolean)READUINT8(*p);
|
||||
discordInfo.everyoneCanInvite = (boolean)READUINT8(*p);
|
||||
|
||||
DRPC_UpdatePresence();
|
||||
#else
|
||||
(*p) += 3;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,9 +191,10 @@ typedef enum
|
|||
XD_CANCELPARTYINVITE, // 30
|
||||
XD_GIVEITEM, // 31
|
||||
XD_ADDBOT, // 32
|
||||
XD_DISCORD, // 33
|
||||
#ifdef HAVE_BLUA
|
||||
XD_LUACMD, // 33
|
||||
XD_LUAVAR, // 34
|
||||
XD_LUACMD, // 34
|
||||
XD_LUAVAR, // 35
|
||||
#endif
|
||||
MAXNETXCMD
|
||||
} netxcmd_t;
|
||||
|
|
|
|||
|
|
@ -108,6 +108,10 @@ char downloaddir[512] = "DOWNLOAD";
|
|||
#ifdef CLIENT_LOADINGSCREEN
|
||||
// for cl loading screen
|
||||
INT32 lastfilenum = -1;
|
||||
INT32 downloadcompletednum = 0;
|
||||
UINT32 downloadcompletedsize = 0;
|
||||
INT32 totalfilesrequestednum = 0;
|
||||
UINT32 totalfilesrequestedsize = 0;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
|
|
@ -141,7 +145,7 @@ UINT8 *PutFileNeeded(UINT16 firstfile)
|
|||
char wadfilename[MAX_WADPATH] = "";
|
||||
UINT8 filestatus;
|
||||
|
||||
for (i = mainwads; i < numwadfiles; i++)
|
||||
for (i = mainwads+1; i < numwadfiles; i++) //mainwads+1, otherwise we start on the first mainwad
|
||||
{
|
||||
// If it has only music/sound lumps, don't put it in the list
|
||||
if (!wadfiles[i]->important)
|
||||
|
|
@ -207,7 +211,7 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi
|
|||
p = (UINT8 *)fileneededstr;
|
||||
for (i = firstfile; i < fileneedednum; i++)
|
||||
{
|
||||
fileneeded[i].status = FS_NOTFOUND; // We haven't even started looking for the file yet
|
||||
fileneeded[i].status = FS_NOTCHECKED; // We haven't even started looking for the file yet
|
||||
filestatus = READUINT8(p); // The first byte is the file status
|
||||
fileneeded[i].willsend = (UINT8)(filestatus >> 4);
|
||||
fileneeded[i].totalsize = READUINT32(p); // The four next bytes are the file size
|
||||
|
|
@ -370,15 +374,17 @@ boolean Got_RequestFilePak(INT32 node)
|
|||
* \return 0 if some files are missing
|
||||
* 1 if all files exist
|
||||
* 2 if some already loaded files are not requested or are in a different order
|
||||
* 3 too many files, over WADLIMIT
|
||||
* 4 still checking, continuing next tic
|
||||
*
|
||||
*/
|
||||
INT32 CL_CheckFiles(void)
|
||||
{
|
||||
INT32 i, j;
|
||||
char wadfilename[MAX_WADPATH];
|
||||
INT32 ret = 1;
|
||||
size_t packetsize = 0;
|
||||
size_t filestoget = 0;
|
||||
size_t filestoload = 0;
|
||||
boolean downloadrequired = false;
|
||||
|
||||
// if (M_CheckParm("-nofiles"))
|
||||
// return 1;
|
||||
|
|
@ -394,7 +400,7 @@ INT32 CL_CheckFiles(void)
|
|||
if (modifiedgame)
|
||||
{
|
||||
CONS_Debug(DBG_NETPLAY, "game is modified; only doing basic checks\n");
|
||||
for (i = 0, j = mainwads; i < fileneedednum || j < numwadfiles;)
|
||||
for (i = 0, j = mainwads+1; i < fileneedednum || j < numwadfiles;)
|
||||
{
|
||||
if (j < numwadfiles && !wadfiles[j]->important)
|
||||
{
|
||||
|
|
@ -423,10 +429,19 @@ INT32 CL_CheckFiles(void)
|
|||
|
||||
for (i = 0; i < fileneedednum; i++)
|
||||
{
|
||||
if (fileneeded[i].status == FS_NOTFOUND || fileneeded[i].status == FS_FALLBACK)
|
||||
downloadrequired = true;
|
||||
|
||||
if (fileneeded[i].status == FS_FOUND || fileneeded[i].status == FS_NOTFOUND)
|
||||
filestoload++;
|
||||
|
||||
if (fileneeded[i].status != FS_NOTCHECKED) //since we're running this over multiple tics now, its possible for us to come across files checked in previous tics
|
||||
continue;
|
||||
|
||||
CONS_Debug(DBG_NETPLAY, "searching for '%s' ", fileneeded[i].filename);
|
||||
|
||||
// Check in already loaded files
|
||||
for (j = mainwads; wadfiles[j]; j++)
|
||||
for (j = mainwads+1; wadfiles[j]; j++)
|
||||
{
|
||||
nameonly(strcpy(wadfilename, wadfiles[j]->filename));
|
||||
if (!stricmp(wadfilename, fileneeded[i].filename) &&
|
||||
|
|
@ -434,36 +449,35 @@ INT32 CL_CheckFiles(void)
|
|||
{
|
||||
CONS_Debug(DBG_NETPLAY, "already loaded\n");
|
||||
fileneeded[i].status = FS_OPEN;
|
||||
break;
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
if (fileneeded[i].status != FS_NOTFOUND)
|
||||
continue;
|
||||
|
||||
packetsize += nameonlylength(fileneeded[i].filename) + 22;
|
||||
|
||||
if (mainwads+filestoget >= MAX_WADFILES)
|
||||
return 3;
|
||||
|
||||
filestoget++;
|
||||
|
||||
fileneeded[i].status = findfile(fileneeded[i].filename, fileneeded[i].md5sum, true);
|
||||
CONS_Debug(DBG_NETPLAY, "found %d\n", fileneeded[i].status);
|
||||
if (fileneeded[i].status != FS_FOUND)
|
||||
ret = 0;
|
||||
return 4;
|
||||
}
|
||||
return ret;
|
||||
|
||||
//now making it here means we've checked the entire list and no FS_NOTCHECKED files remain
|
||||
if (numwadfiles+filestoload > MAX_WADFILES)
|
||||
return 3;
|
||||
else if (downloadrequired)
|
||||
return 0; //some stuff is FS_NOTFOUND, needs download
|
||||
else
|
||||
return 1; //everything is FS_OPEN or FS_FOUND, proceed to loading
|
||||
}
|
||||
|
||||
// Load it now
|
||||
void CL_LoadServerFiles(void)
|
||||
boolean CL_LoadServerFiles(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// if (M_CheckParm("-nofiles"))
|
||||
// return;
|
||||
|
||||
for (i = 1; i < fileneedednum; i++)
|
||||
for (i = 0; i < fileneedednum; i++)
|
||||
{
|
||||
if (fileneeded[i].status == FS_OPEN)
|
||||
continue; // Already loaded
|
||||
|
|
@ -472,6 +486,7 @@ void CL_LoadServerFiles(void)
|
|||
P_AddWadFile(fileneeded[i].filename);
|
||||
G_SetGameModified(true, false);
|
||||
fileneeded[i].status = FS_OPEN;
|
||||
return false;
|
||||
}
|
||||
else if (fileneeded[i].status == FS_MD5SUMBAD)
|
||||
I_Error("Wrong version of file %s", fileneeded[i].filename);
|
||||
|
|
@ -497,6 +512,7 @@ void CL_LoadServerFiles(void)
|
|||
fileneeded[i].status, s);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Number of files to send
|
||||
|
|
@ -854,6 +870,10 @@ void Got_Filetxpak(void)
|
|||
file->status = FS_FOUND;
|
||||
CONS_Printf(M_GetText("Downloading %s...(done)\n"),
|
||||
filename);
|
||||
#ifndef NONET
|
||||
downloadcompletednum++;
|
||||
downloadcompletedsize += file->totalsize;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1165,6 +1185,8 @@ void CURLGetFile(void)
|
|||
{
|
||||
nameonly(curl_realname);
|
||||
CONS_Printf(M_GetText("Finished downloading %s\n"), curl_realname);
|
||||
downloadcompletednum++;
|
||||
downloadcompletedsize += curl_curfile->totalsize;
|
||||
curl_curfile->status = FS_FOUND;
|
||||
fclose(curl_curfile->file);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ typedef enum
|
|||
|
||||
typedef enum
|
||||
{
|
||||
FS_NOTCHECKED,
|
||||
FS_NOTFOUND,
|
||||
FS_FOUND,
|
||||
FS_REQUESTED,
|
||||
|
|
@ -52,6 +53,10 @@ extern char downloaddir[512];
|
|||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
extern INT32 lastfilenum;
|
||||
extern INT32 downloadcompletednum;
|
||||
extern UINT32 downloadcompletedsize;
|
||||
extern INT32 totalfilesrequestednum;
|
||||
extern UINT32 totalfilesrequestedsize;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
|
|
@ -65,7 +70,7 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi
|
|||
void CL_PrepareDownloadSaveGame(const char *tmpsave);
|
||||
|
||||
INT32 CL_CheckFiles(void);
|
||||
void CL_LoadServerFiles(void);
|
||||
boolean CL_LoadServerFiles(void);
|
||||
void SV_SendRam(INT32 node, void *data, size_t size, freemethod_t freemethod,
|
||||
UINT8 fileid);
|
||||
|
||||
|
|
|
|||
|
|
@ -1191,6 +1191,18 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
sizeof(mapheaderinfo[num-1]->subttl), va("Level header %d: subtitle", num));
|
||||
continue;
|
||||
}
|
||||
else if (fastcmp(word, "LEVELNAME"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->lvlttl, word2,
|
||||
sizeof(mapheaderinfo[num-1]->lvlttl), va("Level header %d: levelname", num));
|
||||
continue;
|
||||
}
|
||||
else if (fastcmp(word, "ZONETITLE"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->zonttl, word2,
|
||||
sizeof(mapheaderinfo[num-1]->zonttl), va("Level header %d: zonetitle", num));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Lua custom options also go above, contents may be case sensitive.
|
||||
if (fastncmp(word, "LUA.", 4))
|
||||
|
|
@ -1253,16 +1265,6 @@ static void readlevelheader(MYFILE *f, INT32 num)
|
|||
}
|
||||
|
||||
// Strings that can be truncated
|
||||
else if (fastcmp(word, "LEVELNAME"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->lvlttl, word2,
|
||||
sizeof(mapheaderinfo[num-1]->lvlttl), va("Level header %d: levelname", num));
|
||||
}
|
||||
else if (fastcmp(word, "ZONETITLE"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->zonttl, word2,
|
||||
sizeof(mapheaderinfo[num-1]->zonttl), va("Level header %d: zonetitle", num));
|
||||
}
|
||||
else if (fastcmp(word, "SCRIPTNAME"))
|
||||
{
|
||||
deh_strlcpy(mapheaderinfo[num-1]->scriptname, word2,
|
||||
|
|
@ -8380,7 +8382,6 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
|
|||
"MT_TWINKLECARTAMBIENCE",
|
||||
"MT_EXPLODINGBARREL",
|
||||
"MT_MERRYHORSE",
|
||||
"MT_ARIDTOAD",
|
||||
"MT_BLUEFRUIT",
|
||||
"MT_ORANGEFRUIT",
|
||||
"MT_REDFRUIT",
|
||||
|
|
@ -8391,6 +8392,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
|
|||
"MT_BOOSTPROMPT",
|
||||
"MT_BOOSTOFF",
|
||||
"MT_BOOSTON",
|
||||
"MT_ARIDTOAD",
|
||||
"MT_LIZARDMAN",
|
||||
"MT_LIONMAN",
|
||||
|
||||
|
|
@ -9263,13 +9265,11 @@ struct {
|
|||
{"FF_COLORMAPONLY",FF_COLORMAPONLY}, ///< Only copy the colormap, not the lightlevel
|
||||
{"FF_GOOWATER",FF_GOOWATER}, ///< Used with ::FF_SWIMMABLE. Makes thick bouncey goop.
|
||||
|
||||
#ifdef ESLOPE
|
||||
// Slope flags
|
||||
{"SL_NOPHYSICS",SL_NOPHYSICS}, // Don't do momentum adjustment with this slope
|
||||
{"SL_NODYNAMIC",SL_NODYNAMIC}, // Slope will never need to move during the level, so don't fuss with recalculating it
|
||||
{"SL_ANCHORVERTEX",SL_ANCHORVERTEX},// Slope is using a Slope Vertex Thing to anchor its position
|
||||
{"SL_VERTEXSLOPE",SL_VERTEXSLOPE}, // Slope is built from three Slope Vertex Things
|
||||
#endif
|
||||
|
||||
// Angles
|
||||
{"ANG1",ANG1},
|
||||
|
|
@ -10421,6 +10421,9 @@ static inline int lib_getenum(lua_State *L)
|
|||
} else if (fastcmp(word,"exitcountdown")) {
|
||||
lua_pushinteger(L, exitcountdown); // This name is pretty dumb. Hence why we'll prefer more descriptive names at least in Lua...
|
||||
return 1;
|
||||
} else if (fastcmp(word,"replayplayback")) {
|
||||
lua_pushboolean(L, demo.playback);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
712
src/discord.c
Normal file
712
src/discord.c
Normal file
|
|
@ -0,0 +1,712 @@
|
|||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2018-2020 by Sally "TehRealSalt" Cochenour.
|
||||
// Copyright (C) 2018-2020 by Kart Krew.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file discord.h
|
||||
/// \brief Discord Rich Presence handling
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
#include <curl/curl.h>
|
||||
#endif // HAVE_CURL
|
||||
|
||||
#include "i_system.h"
|
||||
#include "d_clisrv.h"
|
||||
#include "d_netcmd.h"
|
||||
#include "i_net.h"
|
||||
#include "g_game.h"
|
||||
#include "p_tick.h"
|
||||
#include "m_menu.h" // gametype_cons_t
|
||||
#include "r_things.h" // skins
|
||||
#include "mserv.h" // cv_advertise
|
||||
#include "z_zone.h"
|
||||
#include "byteptr.h"
|
||||
|
||||
#include "discord.h"
|
||||
#include "doomdef.h"
|
||||
|
||||
// Feel free to provide your own, if you care enough to create another Discord app for this :P
|
||||
#define DISCORD_APPID "503531144395096085"
|
||||
|
||||
// length of IP strings
|
||||
#define IP_SIZE 21
|
||||
|
||||
consvar_t cv_discordrp = {"discordrp", "On", CV_SAVE|CV_CALL, CV_OnOff, DRPC_UpdatePresence, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_discordstreamer = {"discordstreamer", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_discordasks = {"discordasks", "Yes", CV_SAVE|CV_CALL, CV_YesNo, DRPC_UpdatePresence, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
struct discordInfo_s discordInfo;
|
||||
|
||||
discordRequest_t *discordRequestList = NULL;
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
struct SelfIPbuffer
|
||||
{
|
||||
CURL *curl;
|
||||
char *pointer;
|
||||
size_t length;
|
||||
};
|
||||
|
||||
static char self_ip[IP_SIZE];
|
||||
#endif // HAVE_CURL
|
||||
|
||||
/*--------------------------------------------------
|
||||
static char *DRPC_XORIPString(const char *input)
|
||||
|
||||
Simple XOR encryption/decryption. Not complex or
|
||||
very secretive because we aren't sending anything
|
||||
that isn't easily accessible via our Master Server anyway.
|
||||
--------------------------------------------------*/
|
||||
static char *DRPC_XORIPString(const char *input)
|
||||
{
|
||||
const UINT8 xor[IP_SIZE] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21};
|
||||
char *output = malloc(sizeof(char) * (IP_SIZE+1));
|
||||
UINT8 i;
|
||||
|
||||
for (i = 0; i < IP_SIZE; i++)
|
||||
{
|
||||
char xorinput;
|
||||
|
||||
if (!input[i])
|
||||
break;
|
||||
|
||||
xorinput = input[i] ^ xor[i];
|
||||
|
||||
if (xorinput < 32 || xorinput > 126)
|
||||
{
|
||||
xorinput = input[i];
|
||||
}
|
||||
|
||||
output[i] = xorinput;
|
||||
}
|
||||
|
||||
output[i] = '\0';
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void DRPC_HandleReady(const DiscordUser *user)
|
||||
|
||||
Callback function, ran when the game connects to Discord.
|
||||
|
||||
Input Arguments:-
|
||||
user - Struct containing Discord user info.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
static void DRPC_HandleReady(const DiscordUser *user)
|
||||
{
|
||||
if (cv_discordstreamer.value)
|
||||
{
|
||||
CONS_Printf("Discord: connected to %s\n", user->username);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("Discord: connected to %s#%s (%s)\n", user->username, user->discriminator, user->userId);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void DRPC_HandleDisconnect(int err, const char *msg)
|
||||
|
||||
Callback function, ran when disconnecting from Discord.
|
||||
|
||||
Input Arguments:-
|
||||
err - Error type
|
||||
msg - Error message
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
static void DRPC_HandleDisconnect(int err, const char *msg)
|
||||
{
|
||||
CONS_Printf("Discord: disconnected (%d: %s)\n", err, msg);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void DRPC_HandleError(int err, const char *msg)
|
||||
|
||||
Callback function, ran when Discord outputs an error.
|
||||
|
||||
Input Arguments:-
|
||||
err - Error type
|
||||
msg - Error message
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
static void DRPC_HandleError(int err, const char *msg)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "Discord error (%d: %s)\n", err, msg);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void DRPC_HandleJoin(const char *secret)
|
||||
|
||||
Callback function, ran when Discord wants to
|
||||
connect a player to the game via a channel invite
|
||||
or a join request.
|
||||
|
||||
Input Arguments:-
|
||||
secret - Value that links you to the server.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
static void DRPC_HandleJoin(const char *secret)
|
||||
{
|
||||
char *ip = DRPC_XORIPString(secret);
|
||||
CONS_Printf("Connecting to %s via Discord\n", ip);
|
||||
COM_BufAddText(va("connect \"%s\"\n", ip));
|
||||
free(ip);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static boolean DRPC_InvitesAreAllowed(void)
|
||||
|
||||
Determines whenever or not invites or
|
||||
ask to join requests are allowed.
|
||||
|
||||
Input Arguments:-
|
||||
None
|
||||
|
||||
Return:-
|
||||
true if invites are allowed, false otherwise.
|
||||
--------------------------------------------------*/
|
||||
static boolean DRPC_InvitesAreAllowed(void)
|
||||
{
|
||||
if (!Playing())
|
||||
{
|
||||
// We're not playing, so we should not be getting invites.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cv_discordasks.value == 0)
|
||||
{
|
||||
// Client has the CVar set to off, so never allow invites from this client.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (discordInfo.joinsAllowed == true)
|
||||
{
|
||||
if (discordInfo.everyoneCanInvite == true)
|
||||
{
|
||||
// Everyone's allowed!
|
||||
return true;
|
||||
}
|
||||
else if (consoleplayer == serverplayer || IsPlayerAdmin(consoleplayer))
|
||||
{
|
||||
// Only admins are allowed!
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Did not pass any of the checks
|
||||
return false;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
static void DRPC_HandleJoinRequest(const DiscordUser *requestUser)
|
||||
|
||||
Callback function, ran when Discord wants to
|
||||
ask the player if another Discord user can join
|
||||
or not.
|
||||
|
||||
Input Arguments:-
|
||||
requestUser - DiscordUser struct for the user trying to connect.
|
||||
|
||||
Return:-
|
||||
None
|
||||
--------------------------------------------------*/
|
||||
static void DRPC_HandleJoinRequest(const DiscordUser *requestUser)
|
||||
{
|
||||
discordRequest_t *append = discordRequestList;
|
||||
discordRequest_t *newRequest;
|
||||
|
||||
if (DRPC_InvitesAreAllowed() == false)
|
||||
{
|
||||
// Something weird happened if this occurred...
|
||||
Discord_Respond(requestUser->userId, DISCORD_REPLY_IGNORE);
|
||||
return;
|
||||
}
|
||||
|
||||
newRequest = Z_Calloc(sizeof(discordRequest_t), PU_STATIC, NULL);
|
||||
|
||||
newRequest->username = Z_Calloc(344, PU_STATIC, NULL);
|
||||
snprintf(newRequest->username, 344, "%s", requestUser->username);
|
||||
|
||||
newRequest->discriminator = Z_Calloc(8, PU_STATIC, NULL);
|
||||
snprintf(newRequest->discriminator, 8, "%s", requestUser->discriminator);
|
||||
|
||||
newRequest->userID = Z_Calloc(32, PU_STATIC, NULL);
|
||||
snprintf(newRequest->userID, 32, "%s", requestUser->userId);
|
||||
|
||||
if (append != NULL)
|
||||
{
|
||||
discordRequest_t *prev = NULL;
|
||||
|
||||
while (append != NULL)
|
||||
{
|
||||
// CHECK FOR DUPES!! Ignore any that already exist from the same user.
|
||||
if (!strcmp(newRequest->userID, append->userID))
|
||||
{
|
||||
Discord_Respond(newRequest->userID, DISCORD_REPLY_IGNORE);
|
||||
DRPC_RemoveRequest(newRequest);
|
||||
return;
|
||||
}
|
||||
|
||||
prev = append;
|
||||
append = append->next;
|
||||
}
|
||||
|
||||
newRequest->prev = prev;
|
||||
prev->next = newRequest;
|
||||
}
|
||||
else
|
||||
{
|
||||
discordRequestList = newRequest;
|
||||
M_RefreshPauseMenu();
|
||||
}
|
||||
|
||||
// Made it to the end, request was valid, so play the request sound :)
|
||||
S_StartSound(NULL, sfx_requst);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_RemoveRequest(discordRequest_t *removeRequest)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void DRPC_RemoveRequest(discordRequest_t *removeRequest)
|
||||
{
|
||||
if (removeRequest->prev != NULL)
|
||||
{
|
||||
removeRequest->prev->next = removeRequest->next;
|
||||
}
|
||||
|
||||
if (removeRequest->next != NULL)
|
||||
{
|
||||
removeRequest->next->prev = removeRequest->prev;
|
||||
|
||||
if (removeRequest == discordRequestList)
|
||||
{
|
||||
discordRequestList = removeRequest->next;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (removeRequest == discordRequestList)
|
||||
{
|
||||
discordRequestList = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Z_Free(removeRequest->username);
|
||||
Z_Free(removeRequest->userID);
|
||||
Z_Free(removeRequest);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_Init(void)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void DRPC_Init(void)
|
||||
{
|
||||
DiscordEventHandlers handlers;
|
||||
memset(&handlers, 0, sizeof(handlers));
|
||||
|
||||
handlers.ready = DRPC_HandleReady;
|
||||
handlers.disconnected = DRPC_HandleDisconnect;
|
||||
handlers.errored = DRPC_HandleError;
|
||||
handlers.joinGame = DRPC_HandleJoin;
|
||||
handlers.joinRequest = DRPC_HandleJoinRequest;
|
||||
|
||||
Discord_Initialize(DISCORD_APPID, &handlers, 1, NULL);
|
||||
I_AddExitFunc(Discord_Shutdown);
|
||||
DRPC_UpdatePresence();
|
||||
}
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
/*--------------------------------------------------
|
||||
static size_t DRPC_WriteServerIP(char *s, size_t size, size_t n, void *userdata)
|
||||
|
||||
Writing function for use with curl. Only intended to be used with simple text.
|
||||
|
||||
Input Arguments:-
|
||||
s - Data to write
|
||||
size - Always 1.
|
||||
n - Length of data
|
||||
userdata - Passed in from CURLOPT_WRITEDATA, intended to be SelfIPbuffer
|
||||
|
||||
Return:-
|
||||
Number of bytes wrote in this pass.
|
||||
--------------------------------------------------*/
|
||||
static size_t DRPC_WriteServerIP(char *s, size_t size, size_t n, void *userdata)
|
||||
{
|
||||
struct SelfIPbuffer *buffer;
|
||||
size_t newlength;
|
||||
|
||||
buffer = userdata;
|
||||
|
||||
newlength = buffer->length + size*n;
|
||||
buffer->pointer = realloc(buffer->pointer, newlength+1);
|
||||
|
||||
memcpy(buffer->pointer + buffer->length, s, size*n);
|
||||
|
||||
buffer->pointer[newlength] = '\0';
|
||||
buffer->length = newlength;
|
||||
|
||||
return size*n;
|
||||
}
|
||||
#endif // HAVE_CURL
|
||||
|
||||
/*--------------------------------------------------
|
||||
static const char *DRPC_GetServerIP(void)
|
||||
|
||||
Retrieves the IP address of the server that you're
|
||||
connected to. Will attempt to use curl for getting your
|
||||
own IP address, if it's not yours.
|
||||
--------------------------------------------------*/
|
||||
static const char *DRPC_GetServerIP(void)
|
||||
{
|
||||
const char *address;
|
||||
|
||||
// If you're connected
|
||||
if (I_GetNodeAddress && (address = I_GetNodeAddress(servernode)) != NULL)
|
||||
{
|
||||
if (strcmp(address, "self"))
|
||||
{
|
||||
// We're not the server, so we could successfully get the IP!
|
||||
// No need to do anything else :)
|
||||
return address;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
// This is a little bit goofy, but
|
||||
// there's practically no good way to get your own public IP address,
|
||||
// so we've gotta break out curl for this :V
|
||||
if (!self_ip[0])
|
||||
{
|
||||
CURL *curl;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
curl = curl_easy_init();
|
||||
|
||||
if (curl)
|
||||
{
|
||||
// The API to get your public IP address from.
|
||||
// Picked because it's stupid simple and it's been up for a long time.
|
||||
const char *api = "http://ip4only.me/api/";
|
||||
|
||||
struct SelfIPbuffer buffer;
|
||||
CURLcode success;
|
||||
|
||||
buffer.length = 0;
|
||||
buffer.pointer = malloc(buffer.length+1);
|
||||
buffer.pointer[0] = '\0';
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, api);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, DRPC_WriteServerIP);
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
|
||||
|
||||
success = curl_easy_perform(curl);
|
||||
|
||||
if (success == CURLE_OK)
|
||||
{
|
||||
char *tmp;
|
||||
tmp = strtok(buffer.pointer, ",");
|
||||
|
||||
if (!strcmp(tmp, "IPv4")) // ensure correct type of IP
|
||||
{
|
||||
tmp = strtok(NULL, ",");
|
||||
strncpy(self_ip, tmp, IP_SIZE); // Yay, we have the IP :)
|
||||
}
|
||||
}
|
||||
|
||||
free(buffer.pointer);
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
|
||||
curl_global_cleanup();
|
||||
}
|
||||
|
||||
if (self_ip[0])
|
||||
return self_ip;
|
||||
else
|
||||
#endif // HAVE_CURL
|
||||
return NULL; // Could not get your IP for whatever reason, so we cannot do Discord invites
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_EmptyRequests(void)
|
||||
|
||||
Empties the request list. Any existing requests
|
||||
will get an ignore reply.
|
||||
--------------------------------------------------*/
|
||||
static void DRPC_EmptyRequests(void)
|
||||
{
|
||||
while (discordRequestList != NULL)
|
||||
{
|
||||
Discord_Respond(discordRequestList->userID, DISCORD_REPLY_IGNORE);
|
||||
DRPC_RemoveRequest(discordRequestList);
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_UpdatePresence(void)
|
||||
|
||||
See header file for description.
|
||||
--------------------------------------------------*/
|
||||
void DRPC_UpdatePresence(void)
|
||||
{
|
||||
char detailstr[48+1];
|
||||
|
||||
char mapimg[8+1];
|
||||
char mapname[5+21+21+2+1];
|
||||
|
||||
char charimg[4+SKINNAMESIZE+1];
|
||||
char charname[11+SKINNAMESIZE+1];
|
||||
|
||||
boolean joinSecretSet = false;
|
||||
|
||||
DiscordRichPresence discordPresence;
|
||||
memset(&discordPresence, 0, sizeof(discordPresence));
|
||||
|
||||
if (dedicated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cv_discordrp.value)
|
||||
{
|
||||
// User doesn't want to show their game information, so update with empty presence.
|
||||
// This just shows that they're playing SRB2Kart. (If that's too much, then they should disable game activity :V)
|
||||
DRPC_EmptyRequests();
|
||||
Discord_UpdatePresence(&discordPresence);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEVELOP
|
||||
// This way, we can use the invite feature in-dev, but not have snoopers seeing any potential secrets! :P
|
||||
discordPresence.largeImageKey = "miscdevelop";
|
||||
discordPresence.largeImageText = "No peeking!";
|
||||
discordPresence.state = "Testing the game";
|
||||
|
||||
DRPC_EmptyRequests();
|
||||
Discord_UpdatePresence(&discordPresence);
|
||||
return;
|
||||
#endif // DEVELOP
|
||||
|
||||
// Server info
|
||||
if (netgame)
|
||||
{
|
||||
if (cv_advertise.value)
|
||||
{
|
||||
discordPresence.state = "Public";
|
||||
}
|
||||
else
|
||||
{
|
||||
discordPresence.state = "Private";
|
||||
}
|
||||
|
||||
discordPresence.partyId = server_context; // Thanks, whoever gave us Mumble support, for implementing the EXACT thing Discord wanted for this field!
|
||||
discordPresence.partySize = D_NumPlayers(); // Players in server
|
||||
discordPresence.partyMax = discordInfo.maxPlayers; // Max players
|
||||
|
||||
if (DRPC_InvitesAreAllowed() == true)
|
||||
{
|
||||
const char *join;
|
||||
|
||||
// Grab the host's IP for joining.
|
||||
if ((join = DRPC_GetServerIP()) != NULL)
|
||||
{
|
||||
char *xorjoin = DRPC_XORIPString(join);
|
||||
discordPresence.joinSecret = xorjoin;
|
||||
free(xorjoin);
|
||||
|
||||
joinSecretSet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset discord info if you're not in a place that uses it!
|
||||
// Important for if you join a server that compiled without HAVE_DISCORDRPC,
|
||||
// so that you don't ever end up using bad information from another server.
|
||||
memset(&discordInfo, 0, sizeof(discordInfo));
|
||||
|
||||
// Offline info
|
||||
if (Playing())
|
||||
discordPresence.state = "Offline";
|
||||
else if (demo.playback && !demo.title)
|
||||
discordPresence.state = "Watching Replay";
|
||||
else
|
||||
discordPresence.state = "Menu";
|
||||
}
|
||||
|
||||
// Gametype info
|
||||
if ((gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING) && Playing())
|
||||
{
|
||||
if (modeattacking)
|
||||
discordPresence.details = "Time Attack";
|
||||
else
|
||||
{
|
||||
snprintf(detailstr, 48, "%s%s%s",
|
||||
gametype_cons_t[gametype].strvalue,
|
||||
(gametype == GT_RACE) ? va(" | %s", kartspeed_cons_t[gamespeed].strvalue) : "",
|
||||
(encoremode == true) ? " | Encore" : ""
|
||||
);
|
||||
discordPresence.details = detailstr;
|
||||
}
|
||||
}
|
||||
|
||||
if ((gamestate == GS_LEVEL || gamestate == GS_INTERMISSION) // Map info
|
||||
&& !(demo.playback && demo.title))
|
||||
{
|
||||
if ((gamemap >= 1 && gamemap <= 60) // supported race maps
|
||||
|| (gamemap >= 136 && gamemap <= 164)) // supported battle maps
|
||||
{
|
||||
snprintf(mapimg, 8, "%s", G_BuildMapName(gamemap));
|
||||
strlwr(mapimg);
|
||||
discordPresence.largeImageKey = mapimg; // Map image
|
||||
}
|
||||
else if (mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
|
||||
{
|
||||
// Hell map, use the method that got you here :P
|
||||
discordPresence.largeImageKey = "miscdice";
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is probably a custom map!
|
||||
discordPresence.largeImageKey = "mapcustom";
|
||||
}
|
||||
|
||||
if (mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
|
||||
{
|
||||
// Hell map, hide the name
|
||||
discordPresence.largeImageText = "Map: ???";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Map name on tool tip
|
||||
snprintf(mapname, 48, "Map: %s", G_BuildMapTitle(gamemap));
|
||||
discordPresence.largeImageText = mapname;
|
||||
}
|
||||
|
||||
if (gamestate == GS_LEVEL && Playing())
|
||||
{
|
||||
const time_t currentTime = time(NULL);
|
||||
const time_t mapTimeStart = currentTime - ((leveltime + (modeattacking ? starttime : 0)) / TICRATE);
|
||||
|
||||
discordPresence.startTimestamp = mapTimeStart;
|
||||
|
||||
if (timelimitintics > 0)
|
||||
{
|
||||
const time_t mapTimeEnd = mapTimeStart + ((timelimitintics + starttime + 1) / TICRATE);
|
||||
discordPresence.endTimestamp = mapTimeEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gamestate == GS_VOTING)
|
||||
{
|
||||
discordPresence.largeImageKey = (G_BattleGametype() ? "miscredplanet" : "miscblueplanet");
|
||||
discordPresence.largeImageText = "Voting";
|
||||
}
|
||||
else
|
||||
{
|
||||
discordPresence.largeImageKey = "misctitle";
|
||||
discordPresence.largeImageText = "Title Screen";
|
||||
}
|
||||
|
||||
// Character info
|
||||
if (Playing() && playeringame[consoleplayer] && !players[consoleplayer].spectator)
|
||||
{
|
||||
// Supported skin names
|
||||
static const char *supportedSkins[] = {
|
||||
// base game
|
||||
"sonic",
|
||||
"tails",
|
||||
"knuckles",
|
||||
"eggman",
|
||||
"metalsonic",
|
||||
// bonus chars
|
||||
"flicky",
|
||||
"motobug",
|
||||
"amy",
|
||||
"mighty",
|
||||
"ray",
|
||||
"espio",
|
||||
"vector",
|
||||
"chao",
|
||||
"gamma",
|
||||
"chaos",
|
||||
"shadow",
|
||||
"rouge",
|
||||
"herochao",
|
||||
"darkchao",
|
||||
"cream",
|
||||
"omega",
|
||||
"blaze",
|
||||
"silver",
|
||||
"wonderboy",
|
||||
"arle",
|
||||
"nights",
|
||||
"sakura",
|
||||
"ulala",
|
||||
"beat",
|
||||
"vyse",
|
||||
"aiai",
|
||||
"kiryu",
|
||||
"aigis",
|
||||
"miku",
|
||||
"doom",
|
||||
NULL
|
||||
};
|
||||
|
||||
boolean customChar = true;
|
||||
UINT8 checkSkin = 0;
|
||||
|
||||
// Character image
|
||||
while (supportedSkins[checkSkin] != NULL)
|
||||
{
|
||||
if (!strcmp(skins[players[consoleplayer].skin].name, supportedSkins[checkSkin]))
|
||||
{
|
||||
snprintf(charimg, 21, "char%s", supportedSkins[checkSkin]);
|
||||
discordPresence.smallImageKey = charimg;
|
||||
customChar = false;
|
||||
break;
|
||||
}
|
||||
|
||||
checkSkin++;
|
||||
}
|
||||
|
||||
if (customChar == true)
|
||||
{
|
||||
// Use the custom character icon!
|
||||
discordPresence.smallImageKey = "charcustom";
|
||||
}
|
||||
|
||||
snprintf(charname, 28, "Character: %s", skins[players[consoleplayer].skin].realname);
|
||||
discordPresence.smallImageText = charname; // Character name
|
||||
}
|
||||
|
||||
if (joinSecretSet == false)
|
||||
{
|
||||
// Not able to join? Flush the request list, if it exists.
|
||||
DRPC_EmptyRequests();
|
||||
}
|
||||
|
||||
Discord_UpdatePresence(&discordPresence);
|
||||
}
|
||||
|
||||
#endif // HAVE_DISCORDRPC
|
||||
80
src/discord.h
Normal file
80
src/discord.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2018-2020 by Sally "TehRealSalt" Cochenour.
|
||||
// Copyright (C) 2018-2020 by Kart Krew.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file discord.h
|
||||
/// \brief Discord Rich Presence handling
|
||||
|
||||
#ifndef __DISCORD__
|
||||
#define __DISCORD__
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
|
||||
#include "discord_rpc.h"
|
||||
|
||||
extern consvar_t cv_discordrp;
|
||||
extern consvar_t cv_discordstreamer;
|
||||
extern consvar_t cv_discordasks;
|
||||
|
||||
extern struct discordInfo_s {
|
||||
UINT8 maxPlayers;
|
||||
boolean joinsAllowed;
|
||||
boolean everyoneCanInvite;
|
||||
} discordInfo;
|
||||
|
||||
typedef struct discordRequest_s {
|
||||
char *username; // Discord user name.
|
||||
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()
|
||||
|
||||
// HAHAHA, no.
|
||||
// *Maybe* if it was only PNG I would boot up curl just to get AND convert this to Doom GFX,
|
||||
// but it can *also* be a JEPG, WebP, or GIF :)
|
||||
// Hey, wanna add ImageMagick as a dependency? :dying:
|
||||
//patch_t *avatar;
|
||||
|
||||
struct discordRequest_s *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;
|
||||
|
||||
extern discordRequest_t *discordRequestList;
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_RemoveRequest(void);
|
||||
|
||||
Removes an invite from the list.
|
||||
--------------------------------------------------*/
|
||||
|
||||
void DRPC_RemoveRequest(discordRequest_t *removeRequest);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_Init(void);
|
||||
|
||||
Initalizes Discord Rich Presence by linking the Application ID
|
||||
and setting the callback functions.
|
||||
--------------------------------------------------*/
|
||||
|
||||
void DRPC_Init(void);
|
||||
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_UpdatePresence(void);
|
||||
|
||||
Updates what is displayed by Rich Presence on the user's profile.
|
||||
Should be called whenever something that is displayed is
|
||||
changed in-game.
|
||||
--------------------------------------------------*/
|
||||
|
||||
void DRPC_UpdatePresence(void);
|
||||
|
||||
|
||||
#endif // HAVE_DISCORDRPC
|
||||
|
||||
#endif // __DISCORD__
|
||||
|
|
@ -30,7 +30,6 @@
|
|||
#ifdef HAVE_MIXER
|
||||
//#if !defined(DC) && !defined(_WIN32_WCE) && !defined(_XBOX) && !defined(GP2X)
|
||||
#define SOUND SOUND_MIXER
|
||||
#define NOHS // No HW3SOUND
|
||||
#ifdef HW3SOUND
|
||||
#undef HW3SOUND
|
||||
#endif
|
||||
|
|
@ -47,7 +46,6 @@
|
|||
// Use FMOD?
|
||||
#ifdef HAVE_FMOD
|
||||
#define SOUND SOUND_FMOD
|
||||
#define NOHS // No HW3SOUND
|
||||
#ifdef HW3SOUND
|
||||
#undef HW3SOUND
|
||||
#endif
|
||||
|
|
@ -64,10 +62,6 @@
|
|||
#if !defined (HWRENDER) && !defined (NOHW)
|
||||
#define HWRENDER
|
||||
#endif
|
||||
// judgecutor: 3D sound support
|
||||
#if !defined(HW3SOUND) && !defined (NOHS)
|
||||
#define HW3SOUND
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32) || defined (_WIN32_WCE)
|
||||
|
|
@ -181,32 +175,13 @@ extern char logfilename[1024];
|
|||
// Please change to apply to your modification (we don't want everyone asking where your mod is on SRB2.org!).
|
||||
#define UPDATE_ALERT_STRING \
|
||||
"A new update is available for SRB2Kart.\n"\
|
||||
"Please visit mb.srb2.org to download it.\n"\
|
||||
"Please visit kartkrew.org to download it.\n"\
|
||||
"\n"\
|
||||
"You are using version: %s\n"\
|
||||
"The newest version is: %s\n"\
|
||||
"\n"\
|
||||
"This update is required for online\n"\
|
||||
"play using the Master Server.\n"\
|
||||
"You will not be able to connect to\n"\
|
||||
"the Master Server until you update to\n"\
|
||||
"the newest version of the game.\n"\
|
||||
"\n"\
|
||||
"(Press a key)\n"
|
||||
|
||||
// The string used in the I_Error alert upon trying to host through command line parameters.
|
||||
// Generally less filled with newlines, since Windows gives you lots more room to work with.
|
||||
#define UPDATE_ALERT_STRING_CONSOLE \
|
||||
"A new update is available for SRB2Kart.\n"\
|
||||
"Please visit mb.srb2.org to download it.\n"\
|
||||
"\n"\
|
||||
"You are using version: %s\n"\
|
||||
"The newest version is: %s\n"\
|
||||
"\n"\
|
||||
"This update is required for online play using the Master Server.\n"\
|
||||
"You will not be able to connect to the Master Server\n"\
|
||||
"until you update to the newest version of the game.\n"
|
||||
|
||||
// For future use, the codebase is the version of SRB2 that the modification is based on,
|
||||
// and should not be changed unless you have merged changes between versions of SRB2
|
||||
// (such as 2.0.4 to 2.0.5, etc) into your working copy.
|
||||
|
|
@ -223,7 +198,7 @@ extern char logfilename[1024];
|
|||
// it's only for detection of the version the player is using so the MS can alert them of an update.
|
||||
// Only set it higher, not lower, obviously.
|
||||
// Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1".
|
||||
#define MODVERSION 6
|
||||
#define MODVERSION 7
|
||||
|
||||
// Filter consvars by version
|
||||
// To version config.cfg, MAJOREXECVERSION is set equal to MODVERSION automatically.
|
||||
|
|
@ -601,11 +576,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// Kalaron/Eternity Engine slope code (SRB2CB ported)
|
||||
#define ESLOPE
|
||||
|
||||
#ifdef ESLOPE
|
||||
/// Backwards compatibility with SRB2CB's slope linedef types.
|
||||
/// \note A simple shim that prints a warning.
|
||||
#define ESLOPE_TYPESHIM
|
||||
#endif
|
||||
|
||||
/// Delete file while the game is running.
|
||||
/// \note EXTREMELY buggy, tends to crash game.
|
||||
|
|
@ -676,4 +649,10 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
|||
/// Hardware renderer: OpenGL
|
||||
#define GL_SHADERS
|
||||
|
||||
#if defined (HAVE_CURL) && ! defined (NONET)
|
||||
#define MASTERSERVER
|
||||
#else
|
||||
#undef UPDATE_ALERT
|
||||
#endif
|
||||
|
||||
#endif // __DOOMDEF__
|
||||
|
|
|
|||
31
src/g_game.c
31
src/g_game.c
|
|
@ -56,6 +56,10 @@
|
|||
#include "k_respawn.h"
|
||||
#include "k_grandprix.h"
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
#endif
|
||||
|
||||
gameaction_t gameaction;
|
||||
gamestate_t gamestate = GS_NULL;
|
||||
UINT8 ultimatemode = false;
|
||||
|
|
@ -575,6 +579,8 @@ char player_names[MAXPLAYERS][MAXPLAYERNAME+1] =
|
|||
"Player 16"
|
||||
}; // SRB2kart - removed Players 17 through 32
|
||||
|
||||
INT32 player_name_changes[MAXPLAYERS];
|
||||
|
||||
INT16 rw_maximums[NUM_WEAPONS] =
|
||||
{
|
||||
800, // MAX_INFINITY
|
||||
|
|
@ -2493,6 +2499,11 @@ void G_Ticker(boolean run)
|
|||
spectatedelay3--;
|
||||
if (spectatedelay4)
|
||||
spectatedelay4--;
|
||||
|
||||
if (gametic % NAMECHANGERATE == 0)
|
||||
{
|
||||
memset(player_name_changes, 0, sizeof player_name_changes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4720,7 +4731,7 @@ char *G_BuildMapTitle(INT32 mapnum)
|
|||
}
|
||||
else if (!(mapheaderinfo[mapnum-1]->levelflags & LF_NOZONE))
|
||||
{
|
||||
zonetext = M_GetText("ZONE");
|
||||
zonetext = M_GetText("Zone");
|
||||
len += strlen(zonetext) + 1; // ' ' + zonetext
|
||||
}
|
||||
if (strlen(mapheaderinfo[mapnum-1]->actnum) > 0)
|
||||
|
|
@ -6302,8 +6313,8 @@ void G_RecordDemo(const char *name)
|
|||
maxsize = 1024*1024*2;
|
||||
if (M_CheckParm("-maxdemo") && M_IsNextParm())
|
||||
maxsize = atoi(M_GetNextParm()) * 1024;
|
||||
// if (demobuffer)
|
||||
// free(demobuffer);
|
||||
if (demobuffer)
|
||||
free(demobuffer);
|
||||
demo_p = NULL;
|
||||
demobuffer = malloc(maxsize);
|
||||
demoend = demobuffer + maxsize;
|
||||
|
|
@ -6357,7 +6368,7 @@ void G_BeginRecording(void)
|
|||
|
||||
// Full replay title
|
||||
demo_p += 64;
|
||||
snprintf(demo.titlename, 64, "%s - %s", G_BuildMapTitle(gamemap), modeattacking ? "Record Attack" : connectedservername);
|
||||
snprintf(demo.titlename, 64, "%s - %s", G_BuildMapTitle(gamemap), modeattacking ? "Time Attack" : connectedservername);
|
||||
|
||||
// demo checksum
|
||||
demo_p += 16;
|
||||
|
|
@ -7139,6 +7150,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
return;
|
||||
|
|
@ -7163,6 +7175,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
return;
|
||||
|
|
@ -7175,6 +7188,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
return;
|
||||
|
|
@ -7236,6 +7250,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
return;
|
||||
|
|
@ -7293,6 +7308,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
return;
|
||||
|
|
@ -7348,6 +7364,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
return;
|
||||
|
|
@ -7362,6 +7379,7 @@ void G_DoPlayDemo(char *defdemoname)
|
|||
M_StartMessage(msg, NULL, MM_NOTHING);
|
||||
Z_Free(pdemoname);
|
||||
Z_Free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
demo.playback = false;
|
||||
demo.title = false;
|
||||
return;
|
||||
|
|
@ -7953,6 +7971,7 @@ ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void)
|
|||
saved = FIL_WriteFile(va("%sMS.LMP", G_BuildMapName(gamemap)), demobuffer, demo_p - demobuffer); // finally output the file.
|
||||
}
|
||||
free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
metalrecording = false;
|
||||
if (saved)
|
||||
I_Error("Saved to %sMS.LMP", G_BuildMapName(gamemap));
|
||||
|
|
@ -8133,6 +8152,7 @@ void G_SaveDemo(void)
|
|||
if (FIL_WriteFile(va(pandf, srb2home, demoname), demobuffer, demo_p - demobuffer)) // finally output the file.
|
||||
demo.savemode = DSM_SAVED;
|
||||
free(demobuffer);
|
||||
demobuffer = NULL;
|
||||
demo.recording = false;
|
||||
|
||||
if (!modeattacking)
|
||||
|
|
@ -8201,6 +8221,9 @@ boolean G_DemoTitleResponder(event_t *ev)
|
|||
void G_SetGamestate(gamestate_t newstate)
|
||||
{
|
||||
gamestate = newstate;
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
DRPC_UpdatePresence();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* These functions handle the exitgame flag. Before, when the user
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ extern char customversionstring[32];
|
|||
#ifdef SEENAMES
|
||||
extern player_t *seenplayer;
|
||||
#endif
|
||||
extern char player_names[MAXPLAYERS][MAXPLAYERNAME+1];
|
||||
extern char player_names[MAXPLAYERS][MAXPLAYERNAME+1];
|
||||
extern INT32 player_name_changes[MAXPLAYERS];
|
||||
|
||||
extern player_t players[MAXPLAYERS];
|
||||
extern boolean playeringame[MAXPLAYERS];
|
||||
|
|
|
|||
|
|
@ -4684,6 +4684,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
|||
}
|
||||
|
||||
R_SetupFrame(player, false); // This can stay false because it is only used to set viewsky in r_main.c, which isn't used here
|
||||
framecount++; // for timedemo
|
||||
HWR_RenderFrame(viewnumber, player, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
277
src/http-mserv.c
277
src/http-mserv.c
|
|
@ -11,10 +11,12 @@
|
|||
/*
|
||||
Documentation available here.
|
||||
|
||||
<http://mb.srb2.org/MS/tools/api/v1/>
|
||||
<https://ms.kartkrew.org/tools/api/2/>
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CURL
|
||||
#include <curl/curl.h>
|
||||
#endif
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "d_clisrv.h"
|
||||
|
|
@ -49,6 +51,8 @@ consvar_t cv_masterserver_token = {
|
|||
NULL, 0, NULL, NULL, 0, 0, NULL/* C90 moment */
|
||||
};
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
|
||||
static int hms_started;
|
||||
|
||||
static char *hms_api;
|
||||
|
|
@ -137,7 +141,7 @@ HMS_connect (const char *format, ...)
|
|||
if (cv_masterserver_token.string[0])
|
||||
{
|
||||
quack_token = curl_easy_escape(curl, cv_masterserver_token.string, 0);
|
||||
token_length = ( sizeof "?token="-1 )+ strlen(quack_token);
|
||||
token_length = ( sizeof "&token="-1 )+ strlen(quack_token);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -152,7 +156,9 @@ HMS_connect (const char *format, ...)
|
|||
seek = strlen(hms_api) + 1;/* + '/' */
|
||||
|
||||
va_start (ap, format);
|
||||
url = malloc(seek + vsnprintf(0, 0, format, ap) + token_length + 1);
|
||||
url = malloc(seek + vsnprintf(0, 0, format, ap) +
|
||||
sizeof "?v=2" - 1 +
|
||||
token_length + 1);
|
||||
va_end (ap);
|
||||
|
||||
sprintf(url, "%s/", hms_api);
|
||||
|
|
@ -165,8 +171,11 @@ HMS_connect (const char *format, ...)
|
|||
seek += vsprintf(&url[seek], format, ap);
|
||||
va_end (ap);
|
||||
|
||||
strcpy(&url[seek], "?v=2");
|
||||
seek += sizeof "?v=2" - 1;
|
||||
|
||||
if (quack_token)
|
||||
sprintf(&url[seek], "?token=%s", quack_token);
|
||||
sprintf(&url[seek], "&token=%s", quack_token);
|
||||
|
||||
CONS_Printf("HMS: connecting '%s'...\n", url);
|
||||
|
||||
|
|
@ -254,117 +263,6 @@ HMS_end (struct HMS_buffer *buffer)
|
|||
free(buffer);
|
||||
}
|
||||
|
||||
int
|
||||
HMS_fetch_rooms (int joining, int query_id)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
|
||||
int doing_shit;
|
||||
|
||||
char *id;
|
||||
char *title;
|
||||
char *room_motd;
|
||||
|
||||
int id_no;
|
||||
|
||||
char *p;
|
||||
char *end;
|
||||
|
||||
int i;
|
||||
|
||||
(void)query_id;
|
||||
|
||||
hms = HMS_connect("rooms");
|
||||
|
||||
if (! hms)
|
||||
return 0;
|
||||
|
||||
if (HMS_do(hms))
|
||||
{
|
||||
doing_shit = 1;
|
||||
|
||||
p = hms->buffer;
|
||||
|
||||
for (i = 0; i < NUM_LIST_ROOMS && ( end = strstr(p, "\n\n\n") );)
|
||||
{
|
||||
*end = '\0';
|
||||
|
||||
id = strtok(p, "\n");
|
||||
title = strtok(0, "\n");
|
||||
room_motd = strtok(0, "");
|
||||
|
||||
if (id && title && room_motd)
|
||||
{
|
||||
id_no = atoi(id);
|
||||
|
||||
/*
|
||||
Don't show the 'All' room if hosting. And it's a hack like this
|
||||
because I'm way too lazy to add another feature to the MS.
|
||||
*/
|
||||
if (joining || id_no != 0)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
I_lock_mutex(&ms_QueryId_mutex);
|
||||
{
|
||||
if (query_id != ms_QueryId)
|
||||
doing_shit = 0;
|
||||
}
|
||||
I_unlock_mutex(ms_QueryId_mutex);
|
||||
|
||||
if (! doing_shit)
|
||||
break;
|
||||
#endif
|
||||
|
||||
room_list[i].header.buffer[0] = 1;
|
||||
|
||||
room_list[i].id = id_no;
|
||||
strlcpy(room_list[i].name, title, sizeof room_list[i].name);
|
||||
strlcpy(room_list[i].motd, room_motd, sizeof room_list[i].motd);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
p = ( end + 3 );/* skip the three linefeeds */
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (doing_shit)
|
||||
room_list[i].header.buffer[0] = 0;
|
||||
|
||||
ok = 1;
|
||||
|
||||
if (doing_shit)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
I_lock_mutex(&m_menu_mutex);
|
||||
#endif
|
||||
{
|
||||
for (i = 0; room_list[i].header.buffer[0]; i++)
|
||||
{
|
||||
if(*room_list[i].name != '\0')
|
||||
{
|
||||
MP_RoomMenu[i+1].text = room_list[i].name;
|
||||
roomIds[i] = room_list[i].id;
|
||||
MP_RoomMenu[i+1].status = IT_STRING|IT_CALL;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_THREADS
|
||||
I_unlock_mutex(m_menu_mutex);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
ok = 0;
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
int
|
||||
HMS_register (void)
|
||||
{
|
||||
|
|
@ -373,29 +271,26 @@ HMS_register (void)
|
|||
|
||||
char post[256];
|
||||
|
||||
char *title;
|
||||
char *contact;
|
||||
|
||||
hms = HMS_connect("rooms/%d/register", ms_RoomId);
|
||||
hms = HMS_connect(
|
||||
"games/%s/%d/servers/register", SRB2APPLICATION, MODVERSION);
|
||||
|
||||
if (! hms)
|
||||
return 0;
|
||||
|
||||
title = curl_easy_escape(hms->curl, cv_servername.string, 0);
|
||||
contact = curl_easy_escape(hms->curl, cv_server_contact.string, 0);
|
||||
|
||||
snprintf(post, sizeof post,
|
||||
"port=%d&"
|
||||
"title=%s&"
|
||||
"version=%d.%d",
|
||||
"contact=%s",
|
||||
|
||||
current_port,
|
||||
|
||||
title,
|
||||
|
||||
VERSION,
|
||||
SUBVERSION
|
||||
contact
|
||||
);
|
||||
|
||||
curl_free(title);
|
||||
curl_free(contact);
|
||||
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
|
||||
|
||||
|
|
@ -469,19 +364,13 @@ HMS_list_servers (void)
|
|||
{
|
||||
struct HMS_buffer *hms;
|
||||
|
||||
char *p;
|
||||
|
||||
hms = HMS_connect("servers");
|
||||
hms = HMS_connect("games/%s/%d/servers", SRB2APPLICATION, MODVERSION);
|
||||
|
||||
if (! hms)
|
||||
return;
|
||||
|
||||
if (HMS_do(hms))
|
||||
{
|
||||
p = &hms->buffer[strlen(hms->buffer)];
|
||||
while (*--p == '\n')
|
||||
;
|
||||
|
||||
CONS_Printf("%s\n", hms->buffer);
|
||||
}
|
||||
|
||||
|
|
@ -489,35 +378,24 @@ HMS_list_servers (void)
|
|||
}
|
||||
|
||||
msg_server_t *
|
||||
HMS_fetch_servers (msg_server_t *list, int room_number, int query_id)
|
||||
HMS_fetch_servers (msg_server_t *list, int query_id)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
|
||||
int doing_shit;
|
||||
|
||||
char local_version[9];
|
||||
|
||||
char *room;
|
||||
|
||||
char *address;
|
||||
char *port;
|
||||
char *title;
|
||||
char *version;
|
||||
char *contact;
|
||||
|
||||
char *end;
|
||||
char *section_end;
|
||||
char *p;
|
||||
|
||||
int i;
|
||||
|
||||
(void)query_id;
|
||||
|
||||
if (room_number > 0)
|
||||
{
|
||||
hms = HMS_connect("rooms/%d/servers", room_number);
|
||||
}
|
||||
else
|
||||
hms = HMS_connect("servers");
|
||||
hms = HMS_connect("games/%s/%d/servers", SRB2APPLICATION, MODVERSION);
|
||||
|
||||
if (! hms)
|
||||
return NULL;
|
||||
|
|
@ -526,81 +404,51 @@ HMS_fetch_servers (msg_server_t *list, int room_number, int query_id)
|
|||
{
|
||||
doing_shit = 1;
|
||||
|
||||
snprintf(local_version, sizeof local_version,
|
||||
"%d.%d",
|
||||
VERSION,
|
||||
SUBVERSION
|
||||
);
|
||||
|
||||
p = hms->buffer;
|
||||
i = 0;
|
||||
|
||||
do
|
||||
while (i < MAXSERVERLIST && ( end = strchr(p, '\n') ))
|
||||
{
|
||||
section_end = strstr(p, "\n\n");
|
||||
*end = '\0';
|
||||
|
||||
room = strtok(p, "\n");
|
||||
address = strtok(p, " ");
|
||||
port = strtok(0, " ");
|
||||
contact = strtok(0, "");
|
||||
|
||||
p = strtok(0, "");
|
||||
|
||||
if (! p)
|
||||
break;
|
||||
|
||||
while (i < MAXSERVERLIST && ( end = strchr(p, '\n') ))
|
||||
if (address && port)
|
||||
{
|
||||
*end = '\0';
|
||||
|
||||
address = strtok(p, " ");
|
||||
port = strtok(0, " ");
|
||||
title = strtok(0, " ");
|
||||
version = strtok(0, "");
|
||||
|
||||
if (address && port && title && version)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
I_lock_mutex(&ms_QueryId_mutex);
|
||||
{
|
||||
if (query_id != ms_QueryId)
|
||||
doing_shit = 0;
|
||||
}
|
||||
I_unlock_mutex(ms_QueryId_mutex);
|
||||
I_lock_mutex(&ms_QueryId_mutex);
|
||||
{
|
||||
if (query_id != ms_QueryId)
|
||||
doing_shit = 0;
|
||||
}
|
||||
I_unlock_mutex(ms_QueryId_mutex);
|
||||
|
||||
if (! doing_shit)
|
||||
break;
|
||||
if (! doing_shit)
|
||||
break;
|
||||
#endif
|
||||
|
||||
if (strcmp(version, local_version) == 0)
|
||||
{
|
||||
strlcpy(list[i].ip, address, sizeof list[i].ip);
|
||||
strlcpy(list[i].port, port, sizeof list[i].port);
|
||||
strlcpy(list[i].name, title, sizeof list[i].name);
|
||||
strlcpy(list[i].version, version, sizeof list[i].version);
|
||||
strlcpy(list[i].ip, address, sizeof list[i].ip);
|
||||
strlcpy(list[i].port, port, sizeof list[i].port);
|
||||
|
||||
list[i].room = atoi(room);
|
||||
|
||||
list[i].header.buffer[0] = 1;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
if (end == section_end)/* end of list for this room */
|
||||
break;
|
||||
else
|
||||
p = ( end + 1 );/* skip server delimiter */
|
||||
}
|
||||
else
|
||||
if (contact)
|
||||
{
|
||||
section_end = 0;/* malformed so quit the parsing */
|
||||
break;
|
||||
strlcpy(list[i].contact, contact, sizeof list[i].contact);
|
||||
}
|
||||
|
||||
list[i].header.buffer[0] = 1;
|
||||
|
||||
i++;
|
||||
|
||||
p = ( end + 1 );/* skip server delimiter */
|
||||
}
|
||||
|
||||
if (! doing_shit)
|
||||
else
|
||||
{
|
||||
/* malformed so quit the parsing */
|
||||
break;
|
||||
|
||||
p = ( section_end + 2 );
|
||||
}
|
||||
}
|
||||
while (section_end) ;
|
||||
|
||||
if (doing_shit)
|
||||
list[i].header.buffer[0] = 0;
|
||||
|
|
@ -622,7 +470,7 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
|||
char *version;
|
||||
char *version_name;
|
||||
|
||||
hms = HMS_connect("versions/%d", MODID);
|
||||
hms = HMS_connect("games/%s/version", SRB2APPLICATION);
|
||||
|
||||
if (! hms)
|
||||
return 0;
|
||||
|
|
@ -651,6 +499,19 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
|||
return ok;
|
||||
}
|
||||
|
||||
static char *
|
||||
Strip_trailing_slashes (char *api)
|
||||
{
|
||||
char * p = &api[strlen(api)];
|
||||
|
||||
while (*--p == '/')
|
||||
;
|
||||
|
||||
p[1] = '\0';
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
void
|
||||
HMS_set_api (char *api)
|
||||
{
|
||||
|
|
@ -659,17 +520,21 @@ HMS_set_api (char *api)
|
|||
#endif
|
||||
{
|
||||
free(hms_api);
|
||||
hms_api = api;
|
||||
hms_api = Strip_trailing_slashes(api);
|
||||
}
|
||||
#ifdef HAVE_THREADS
|
||||
I_unlock_mutex(hms_api_mutex);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif/*MASTERSERVER*/
|
||||
|
||||
static void
|
||||
MasterServer_Debug_OnChange (void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
/* TODO: change to 'latest-log.txt' for log files revision. */
|
||||
if (cv_masterserver_debug.value)
|
||||
CONS_Printf("Master server debug messages will appear in log.txt\n");
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
175
src/k_kart.c
175
src/k_kart.c
|
|
@ -305,35 +305,35 @@ static INT32 K_KartItemOddsRace[NUMKARTRESULTS-1][8] =
|
|||
/*Jawz x2*/ { 0, 0, 1, 2, 0, 0, 0, 0 } // Jawz x2
|
||||
};
|
||||
|
||||
static INT32 K_KartItemOddsBattle[NUMKARTRESULTS-1][6] =
|
||||
static INT32 K_KartItemOddsBattle[NUMKARTRESULTS][2] =
|
||||
{
|
||||
//P-Odds 0 1 2 3 4 5
|
||||
/*Sneaker*/ { 3, 2, 2, 2, 0, 2 }, // Sneaker
|
||||
/*Rocket Sneaker*/ { 0, 0, 0, 0, 0, 0 }, // Rocket Sneaker
|
||||
/*Invincibility*/ { 0, 1, 2, 3, 4, 2 }, // Invincibility
|
||||
/*Banana*/ { 2, 1, 0, 0, 0, 0 }, // Banana
|
||||
/*Eggman Monitor*/ { 1, 1, 0, 0, 0, 0 }, // Eggman Monitor
|
||||
/*Orbinaut*/ { 6, 2, 1, 0, 0, 0 }, // Orbinaut
|
||||
/*Jawz*/ { 3, 3, 3, 2, 0, 2 }, // Jawz
|
||||
/*Mine*/ { 2, 3, 3, 1, 0, 2 }, // Mine
|
||||
/*Ballhog*/ { 0, 1, 2, 1, 0, 2 }, // Ballhog
|
||||
/*Self-Propelled Bomb*/ { 0, 0, 0, 0, 0, 0 }, // Self-Propelled Bomb
|
||||
/*Grow*/ { 0, 0, 1, 2, 4, 2 }, // Grow
|
||||
/*Shrink*/ { 0, 0, 0, 0, 0, 0 }, // Shrink
|
||||
/*Thunder Shield*/ { 0, 0, 0, 0, 0, 0 }, // Thunder Shield
|
||||
/*Bubble Shield*/ { 0, 0, 0, 0, 0, 0 }, // Bubble Shield
|
||||
/*Flame Shield*/ { 0, 0, 0, 0, 0, 0 }, // Flame Shield
|
||||
/*Hyudoro*/ { 1, 1, 0, 0, 0, 0 }, // Hyudoro
|
||||
/*Pogo Spring*/ { 1, 1, 0, 0, 0, 0 }, // Pogo Spring
|
||||
/*Super Ring*/ { 0, 0, 0, 0, 0, 0 }, // Super Ring
|
||||
/*Kitchen Sink*/ { 0, 0, 0, 0, 0, 0 }, // Kitchen Sink
|
||||
/*Sneaker x2*/ { 0, 0, 0, 0, 0, 0 }, // Sneaker x2
|
||||
/*Sneaker x3*/ { 0, 0, 0, 2, 4, 2 }, // Sneaker x3
|
||||
/*Banana x3*/ { 1, 2, 1, 0, 0, 0 }, // Banana x3
|
||||
/*Banana x10*/ { 0, 0, 1, 1, 0, 2 }, // Banana x10
|
||||
/*Orbinaut x3*/ { 0, 1, 2, 1, 0, 0 }, // Orbinaut x3
|
||||
/*Orbinaut x4*/ { 0, 0, 1, 3, 4, 2 }, // Orbinaut x4
|
||||
/*Jawz x2*/ { 0, 0, 1, 2, 4, 2 } // Jawz x2
|
||||
//P-Odds 0 1
|
||||
/*Sneaker*/ { 2, 1 }, // Sneaker
|
||||
/*Rocket Sneaker*/ { 0, 0 }, // Rocket Sneaker
|
||||
/*Invincibility*/ { 2, 1 }, // Invincibility
|
||||
/*Banana*/ { 1, 0 }, // Banana
|
||||
/*Eggman Monitor*/ { 1, 0 }, // Eggman Monitor
|
||||
/*Orbinaut*/ { 8, 0 }, // Orbinaut
|
||||
/*Jawz*/ { 8, 1 }, // Jawz
|
||||
/*Mine*/ { 4, 1 }, // Mine
|
||||
/*Ballhog*/ { 2, 1 }, // Ballhog
|
||||
/*Self-Propelled Bomb*/ { 0, 0 }, // Self-Propelled Bomb
|
||||
/*Grow*/ { 2, 1 }, // Grow
|
||||
/*Shrink*/ { 0, 0 }, // Shrink
|
||||
/*Thunder Shield*/ { 0, 0 }, // Thunder Shield
|
||||
/*Bubble Shield*/ { 0, 0 }, // Bubble Shield
|
||||
/*Flame Shield*/ { 0, 0 }, // Flame Shield
|
||||
/*Hyudoro*/ { 2, 0 }, // Hyudoro
|
||||
/*Pogo Spring*/ { 2, 0 }, // Pogo Spring
|
||||
/*Super Ring*/ { 0, 0 }, // Super Ring
|
||||
/*Kitchen Sink*/ { 0, 0 }, // Kitchen Sink
|
||||
/*Sneaker x2*/ { 0, 0 }, // Sneaker x2
|
||||
/*Sneaker x3*/ { 0, 1 }, // Sneaker x3
|
||||
/*Banana x3*/ { 1, 0 }, // Banana x3
|
||||
/*Banana x10*/ { 0, 1 }, // Banana x10
|
||||
/*Orbinaut x3*/ { 2, 0 }, // Orbinaut x3
|
||||
/*Orbinaut x4*/ { 1, 1 }, // Orbinaut x4
|
||||
/*Jawz x2*/ { 2, 1 } // Jawz x2
|
||||
};
|
||||
|
||||
#define DISTVAR (2048) // Magic number distance for use with item roulette tiers
|
||||
|
|
@ -622,16 +622,18 @@ UINT8 K_FindUseodds(player_t *player, fixed_t mashed, UINT32 pdis, UINT8 bestbum
|
|||
UINT8 n = 0;
|
||||
UINT8 useodds = 0;
|
||||
UINT8 disttable[14];
|
||||
UINT8 totallen = 0;
|
||||
UINT8 distlen = 0;
|
||||
boolean oddsvalid[8];
|
||||
|
||||
// Unused now, oops :V
|
||||
(void)bestbumper;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
UINT8 j;
|
||||
boolean available = false;
|
||||
|
||||
if (G_BattleGametype() && i > 5)
|
||||
if (G_BattleGametype() && i > 1)
|
||||
{
|
||||
oddsvalid[i] = false;
|
||||
break;
|
||||
|
|
@ -652,30 +654,24 @@ UINT8 K_FindUseodds(player_t *player, fixed_t mashed, UINT32 pdis, UINT8 bestbum
|
|||
#define SETUPDISTTABLE(odds, num) \
|
||||
if (oddsvalid[odds]) \
|
||||
for (i = num; i; --i) \
|
||||
disttable[distlen++] = odds; \
|
||||
totallen += num;
|
||||
disttable[distlen++] = odds;
|
||||
|
||||
if (G_BattleGametype()) // Battle Mode
|
||||
{
|
||||
SETUPDISTTABLE(0,1);
|
||||
SETUPDISTTABLE(1,1);
|
||||
SETUPDISTTABLE(2,1);
|
||||
SETUPDISTTABLE(3,1);
|
||||
SETUPDISTTABLE(4,1);
|
||||
|
||||
if (player->kartstuff[k_roulettetype] == 1 && oddsvalid[5]) // 5 is the extreme odds of player-controlled "Karma" items
|
||||
useodds = 5;
|
||||
if (player->kartstuff[k_roulettetype] == 1 && oddsvalid[1] == true)
|
||||
{
|
||||
// 1 is the extreme odds of player-controlled "Karma" items
|
||||
useodds = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SINT8 wantedpos = (bestbumper-player->kartstuff[k_bumper]); // 0 is the best player's bumper count, 1 is a bumper below best, 2 is two bumpers below, etc
|
||||
if (K_IsPlayerWanted(player))
|
||||
wantedpos++;
|
||||
if (wantedpos > 4) // Don't run off into karma items
|
||||
wantedpos = 4;
|
||||
if (wantedpos < 0) // Don't go below somehow
|
||||
wantedpos = 0;
|
||||
n = (wantedpos * distlen) / totallen;
|
||||
useodds = disttable[n];
|
||||
useodds = 0;
|
||||
|
||||
if (oddsvalid[0] == false && oddsvalid[1] == true)
|
||||
{
|
||||
// try to use karma odds as a fallback
|
||||
useodds = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1274,7 +1270,7 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
|
|||
}
|
||||
}
|
||||
|
||||
/** \brief Checks that the player is on an offroad subsector for realsies
|
||||
/** \brief Checks that the player is on an offroad subsector for realsies. Also accounts for line riding to prevent cheese.
|
||||
|
||||
\param mo player mobj object
|
||||
|
||||
|
|
@ -1282,18 +1278,64 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
|
|||
*/
|
||||
static UINT8 K_CheckOffroadCollide(mobj_t *mo)
|
||||
{
|
||||
UINT8 i;
|
||||
// Check for sectors in touching_sectorlist
|
||||
UINT8 i; // special type iter
|
||||
msecnode_t *node; // touching_sectorlist iter
|
||||
sector_t *s; // main sector shortcut
|
||||
sector_t *s2; // FOF sector shortcut
|
||||
ffloor_t *rover; // FOF
|
||||
|
||||
fixed_t flr;
|
||||
fixed_t cel; // floor & ceiling for height checks to make sure we're touching the offroad sector.
|
||||
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
||||
for (i = 2; i < 5; i++)
|
||||
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||
{
|
||||
if (P_MobjTouchingSectorSpecial(mo, 1, i, true))
|
||||
return i-1;
|
||||
}
|
||||
if (!node->m_sector)
|
||||
break; // shouldn't happen.
|
||||
|
||||
return 0;
|
||||
s = node->m_sector;
|
||||
// 1: Check for the main sector, make sure we're on the floor of that sector and see if we can apply offroad.
|
||||
// Make arbitrary Z checks because we want to check for 1 sector in particular, we don't want to affect the player if the offroad sector is way below them and they're lineriding a normal sector above.
|
||||
|
||||
flr = P_MobjFloorZ(mo, s, s, mo->x, mo->y, NULL, false, true);
|
||||
cel = P_MobjCeilingZ(mo, s, s, mo->x, mo->y, NULL, true, true); // get Z coords of both floors and ceilings for this sector (this accounts for slopes properly.)
|
||||
// NOTE: we don't use P_GetZAt with our x/y directly because the mobj won't have the same height because of its hitbox on the slope. Complex garbage but tldr it doesn't work.
|
||||
|
||||
if ( ((s->flags & SF_FLIPSPECIAL_FLOOR) && mo->z == flr) // floor check
|
||||
|| ((mo->eflags & MFE_VERTICALFLIP && (s->flags & SF_FLIPSPECIAL_CEILING) && (mo->z + mo->height) == cel)) ) // ceiling check.
|
||||
|
||||
for (i = 2; i < 5; i++) // check for sector special
|
||||
|
||||
if (GETSECSPECIAL(s->special, 1) == i)
|
||||
return i-1; // return offroad type
|
||||
|
||||
// 2: If we're here, we haven't found anything. So let's try looking for FOFs in the sectors using the same logic.
|
||||
for (rover = s->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS)) // This FOF doesn't exist anymore.
|
||||
continue;
|
||||
|
||||
s2 = §ors[rover->secnum]; // makes things easier for us
|
||||
|
||||
flr = P_GetFOFBottomZ(mo, s, rover, mo->x, mo->y, NULL);
|
||||
cel = P_GetFOFTopZ(mo, s, rover, mo->x, mo->y, NULL); // Z coords for fof top/bottom.
|
||||
|
||||
// we will do essentially the same checks as above instead of bothering with top/bottom height of the FOF.
|
||||
// Reminder that an FOF's floor is its bottom, silly!
|
||||
if ( ((s2->flags & SF_FLIPSPECIAL_FLOOR) && mo->z == cel) // "floor" check
|
||||
|| ((s2->flags & SF_FLIPSPECIAL_CEILING) && (mo->z + mo->height) == flr) ) // "ceiling" check.
|
||||
|
||||
for (i = 2; i < 5; i++) // check for sector special
|
||||
|
||||
if (GETSECSPECIAL(s2->special, 1) == i)
|
||||
return i-1; // return offroad type
|
||||
|
||||
}
|
||||
}
|
||||
return 0; // couldn't find any offroad
|
||||
}
|
||||
|
||||
/** \brief Updates the Player's offroad value once per frame
|
||||
|
|
@ -1304,13 +1346,18 @@ static UINT8 K_CheckOffroadCollide(mobj_t *mo)
|
|||
*/
|
||||
static void K_UpdateOffroad(player_t *player)
|
||||
{
|
||||
fixed_t offroadstrength = (K_CheckOffroadCollide(player->mo) << FRACBITS);
|
||||
fixed_t offroad;
|
||||
UINT8 offroadstrength = K_CheckOffroadCollide(player->mo);
|
||||
|
||||
// If you are in offroad, a timer starts.
|
||||
if (offroadstrength)
|
||||
{
|
||||
if (player->kartstuff[k_offroad] < offroadstrength)
|
||||
player->kartstuff[k_offroad] += offroadstrength / TICRATE;
|
||||
if (/*K_CheckOffroadCollide(player->mo) &&*/ player->kartstuff[k_offroad] == 0) // With the way offroad is detected now that first check is no longer necessary. -Lat'
|
||||
player->kartstuff[k_offroad] = (TICRATE/2);
|
||||
|
||||
if (player->kartstuff[k_offroad] > 0)
|
||||
{
|
||||
offroad = (offroadstrength << FRACBITS) / (TICRATE/2);
|
||||
|
||||
if (player->kartstuff[k_offroad] > offroadstrength)
|
||||
player->kartstuff[k_offroad] = offroadstrength;
|
||||
|
|
@ -3414,14 +3461,12 @@ void K_SpawnBoostTrail(player_t *player)
|
|||
{
|
||||
newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale));
|
||||
newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale));
|
||||
#ifdef ESLOPE
|
||||
if (player->mo->standingslope)
|
||||
{
|
||||
ground = P_GetZAt(player->mo->standingslope, newx, newy);
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
ground -= FixedMul(mobjinfo[MT_SNEAKERTRAIL].height, player->mo->scale);
|
||||
}
|
||||
#endif
|
||||
flame = P_SpawnMobj(newx, newy, ground, MT_SNEAKERTRAIL);
|
||||
|
||||
P_SetTarget(&flame->target, player->mo);
|
||||
|
|
@ -3953,13 +3998,13 @@ void K_PuntMine(mobj_t *thismine, mobj_t *punter)
|
|||
mine->flags2 = thismine->flags2;
|
||||
mine->floorz = thismine->floorz;
|
||||
mine->ceilingz = thismine->ceilingz;
|
||||
|
||||
|
||||
//Since we aren't using P_KillMobj, we need to clean up the hnext reference
|
||||
{
|
||||
P_SetTarget(&thismine->target->hnext, NULL); //target is the player who owns the mine
|
||||
thismine->target->player->kartstuff[k_bananadrag] = 0;
|
||||
thismine->target->player->kartstuff[k_itemheld] = 0;
|
||||
|
||||
|
||||
if (--thismine->target->player->kartstuff[k_itemamount] <= 0)
|
||||
thismine->target->player->kartstuff[k_itemtype] = KITEM_NONE;
|
||||
}
|
||||
|
|
@ -4290,9 +4335,7 @@ void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound)
|
|||
if (mo->eflags & MFE_SPRUNG)
|
||||
return;
|
||||
|
||||
#ifdef ESLOPE
|
||||
mo->standingslope = NULL;
|
||||
#endif
|
||||
|
||||
mo->eflags |= MFE_SPRUNG;
|
||||
|
||||
|
|
@ -4615,7 +4658,7 @@ void K_DropRocketSneaker(player_t *player)
|
|||
flingangle = -(ANG60);
|
||||
else
|
||||
flingangle = ANG60;
|
||||
|
||||
|
||||
S_StartSound(shoe, shoe->info->deathsound);
|
||||
P_SetObjectMomZ(shoe, 8*FRACUNIT, false);
|
||||
P_InstaThrust(shoe, R_PointToAngle2(shoe->target->x, shoe->target->y, shoe->x, shoe->y)+flingangle, 16*FRACUNIT);
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@
|
|||
#ifdef HAVE_BLUA
|
||||
#include "p_local.h"
|
||||
#include "p_setup.h" // So we can have P_SetupLevelSky
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h" // P_GetZAt
|
||||
#endif
|
||||
#include "z_zone.h"
|
||||
#include "r_main.h"
|
||||
#include "r_things.h"
|
||||
|
|
@ -1537,7 +1535,6 @@ static int lib_evCrumbleChain(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
// P_SLOPES
|
||||
////////////
|
||||
|
||||
|
|
@ -1553,7 +1550,6 @@ static int lib_pGetZAt(lua_State *L)
|
|||
lua_pushfixed(L, P_GetZAt(slope, x, y));
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// R_DEFS
|
||||
////////////
|
||||
|
|
@ -3051,10 +3047,8 @@ static luaL_Reg lib[] = {
|
|||
{"P_StartQuake",lib_pStartQuake},
|
||||
{"EV_CrumbleChain",lib_evCrumbleChain},
|
||||
|
||||
#ifdef ESLOPE
|
||||
// p_slopes
|
||||
{"P_GetZAt",lib_pGetZAt},
|
||||
#endif
|
||||
|
||||
// r_defs
|
||||
{"R_PointToAngle",lib_rPointToAngle},
|
||||
|
|
|
|||
|
|
@ -79,9 +79,7 @@ static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *th
|
|||
{
|
||||
INT32 offset;
|
||||
const INT32 *list; // Big blockmap
|
||||
#ifdef POLYOBJECTS
|
||||
polymaplink_t *plink; // haleyjd 02/22/06
|
||||
#endif
|
||||
line_t *ld;
|
||||
|
||||
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
|
||||
|
|
@ -89,7 +87,6 @@ static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *th
|
|||
|
||||
offset = y*bmapwidth + x;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 02/22/06: consider polyobject lines
|
||||
plink = polyblocklinks[offset];
|
||||
|
||||
|
|
@ -132,7 +129,6 @@ static UINT8 lib_searchBlockmap_Lines(lua_State *L, INT32 x, INT32 y, mobj_t *th
|
|||
}
|
||||
plink = (polymaplink_t *)(plink->link.next);
|
||||
}
|
||||
#endif
|
||||
|
||||
offset = *(blockmap + offset); // offset = blockmap[y*bmapwidth+x];
|
||||
|
||||
|
|
|
|||
|
|
@ -40,11 +40,9 @@ extern lua_State *gL;
|
|||
#define META_SUBSECTOR "SUBSECTOR_T*"
|
||||
#define META_SECTOR "SECTOR_T*"
|
||||
#define META_FFLOOR "FFLOOR_T*"
|
||||
#ifdef ESLOPE
|
||||
#define META_SLOPE "PSLOPE_T*"
|
||||
#define META_VECTOR2 "VECTOR2_T"
|
||||
#define META_VECTOR3 "VECTOR3_T"
|
||||
#endif
|
||||
#define META_MAPHEADER "MAPHEADER_T*"
|
||||
|
||||
#define META_CVAR "CONSVAR_T*"
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@
|
|||
#include "p_local.h"
|
||||
#include "p_setup.h"
|
||||
#include "z_zone.h"
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h"
|
||||
#endif
|
||||
#include "r_main.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
|
|
@ -43,13 +41,9 @@ enum sector_e {
|
|||
sector_heightsec,
|
||||
sector_camsec,
|
||||
sector_lines,
|
||||
#ifdef ESLOPE
|
||||
sector_ffloors,
|
||||
sector_fslope,
|
||||
sector_cslope
|
||||
#else
|
||||
sector_ffloors
|
||||
#endif
|
||||
};
|
||||
|
||||
static const char *const sector_opt[] = {
|
||||
|
|
@ -66,10 +60,8 @@ static const char *const sector_opt[] = {
|
|||
"camsec",
|
||||
"lines",
|
||||
"ffloors",
|
||||
#ifdef ESLOPE
|
||||
"f_slope",
|
||||
"c_slope",
|
||||
#endif
|
||||
NULL};
|
||||
|
||||
enum subsector_e {
|
||||
|
|
@ -175,10 +167,8 @@ enum ffloor_e {
|
|||
ffloor_toplightlevel,
|
||||
ffloor_bottomheight,
|
||||
ffloor_bottompic,
|
||||
#ifdef ESLOPE
|
||||
ffloor_tslope,
|
||||
ffloor_bslope,
|
||||
#endif
|
||||
ffloor_sector,
|
||||
ffloor_flags,
|
||||
ffloor_master,
|
||||
|
|
@ -195,10 +185,8 @@ static const char *const ffloor_opt[] = {
|
|||
"toplightlevel",
|
||||
"bottomheight",
|
||||
"bottompic",
|
||||
#ifdef ESLOPE
|
||||
"t_slope",
|
||||
"b_slope",
|
||||
#endif
|
||||
"sector", // secnum pushed as control sector userdata
|
||||
"flags",
|
||||
"master", // control linedef
|
||||
|
|
@ -208,7 +196,6 @@ static const char *const ffloor_opt[] = {
|
|||
"alpha",
|
||||
NULL};
|
||||
|
||||
#ifdef ESLOPE
|
||||
enum slope_e {
|
||||
slope_valid = 0,
|
||||
slope_o,
|
||||
|
|
@ -247,7 +234,6 @@ static const char *const vector_opt[] = {
|
|||
"y",
|
||||
"z",
|
||||
NULL};
|
||||
#endif
|
||||
|
||||
static const char *const array_opt[] ={"iterate",NULL};
|
||||
static const char *const valid_opt[] ={"valid",NULL};
|
||||
|
|
@ -463,14 +449,12 @@ static int sector_get(lua_State *L)
|
|||
LUA_PushUserdata(L, sector->ffloors, META_FFLOOR);
|
||||
lua_pushcclosure(L, sector_iterate, 2); // push lib_iterateFFloors and sector->ffloors as upvalues for the function
|
||||
return 1;
|
||||
#ifdef ESLOPE
|
||||
case sector_fslope: // f_slope
|
||||
LUA_PushUserdata(L, sector->f_slope, META_SLOPE);
|
||||
return 1;
|
||||
case sector_cslope: // c_slope
|
||||
LUA_PushUserdata(L, sector->c_slope, META_SLOPE);
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -495,10 +479,8 @@ static int sector_set(lua_State *L)
|
|||
case sector_heightsec: // heightsec
|
||||
case sector_camsec: // camsec
|
||||
case sector_ffloors: // ffloors
|
||||
#ifdef ESLOPE
|
||||
case sector_fslope: // f_slope
|
||||
case sector_cslope: // c_slope
|
||||
#endif
|
||||
default:
|
||||
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
|
||||
case sector_floorheight: { // floorheight
|
||||
|
|
@ -1134,14 +1116,12 @@ static int ffloor_get(lua_State *L)
|
|||
lua_pushlstring(L, levelflat->name, i);
|
||||
return 1;
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
case ffloor_tslope:
|
||||
LUA_PushUserdata(L, *ffloor->t_slope, META_SLOPE);
|
||||
return 1;
|
||||
case ffloor_bslope:
|
||||
LUA_PushUserdata(L, *ffloor->b_slope, META_SLOPE);
|
||||
return 1;
|
||||
#endif
|
||||
case ffloor_sector:
|
||||
LUA_PushUserdata(L, §ors[ffloor->secnum], META_SECTOR);
|
||||
return 1;
|
||||
|
|
@ -1183,10 +1163,8 @@ static int ffloor_set(lua_State *L)
|
|||
switch(field)
|
||||
{
|
||||
case ffloor_valid: // valid
|
||||
#ifdef ESLOPE
|
||||
case ffloor_tslope: // t_slope
|
||||
case ffloor_bslope: // b_slope
|
||||
#endif
|
||||
case ffloor_sector: // sector
|
||||
case ffloor_master: // master
|
||||
case ffloor_target: // target
|
||||
|
|
@ -1247,7 +1225,6 @@ static int ffloor_set(lua_State *L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
static int slope_get(lua_State *L)
|
||||
{
|
||||
pslope_t *slope = *((pslope_t **)luaL_checkudata(L, 1, META_SLOPE));
|
||||
|
|
@ -1422,7 +1399,6 @@ static int vector3_get(lua_State *L)
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int lib_getMapheaderinfo(lua_State *L)
|
||||
{
|
||||
|
|
@ -1614,7 +1590,6 @@ int LUA_MapLib(lua_State *L)
|
|||
lua_setfield(L, -2, "__newindex");
|
||||
lua_pop(L, 1);
|
||||
|
||||
#ifdef ESLOPE
|
||||
luaL_newmetatable(L, META_SLOPE);
|
||||
lua_pushcfunction(L, slope_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
|
@ -1632,7 +1607,6 @@ int LUA_MapLib(lua_State *L)
|
|||
lua_pushcfunction(L, vector3_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
lua_pop(L, 1);
|
||||
#endif
|
||||
|
||||
luaL_newmetatable(L, META_MAPHEADER);
|
||||
lua_pushcfunction(L, mapheaderinfo_get);
|
||||
|
|
|
|||
|
|
@ -83,9 +83,7 @@ enum mobj_e {
|
|||
mobj_extravalue2,
|
||||
mobj_cusval,
|
||||
mobj_cvmem,
|
||||
#ifdef ESLOPE
|
||||
mobj_standingslope,
|
||||
#endif
|
||||
mobj_colorized,
|
||||
mobj_shadowscale,
|
||||
mobj_whiteshadow,
|
||||
|
|
@ -152,9 +150,7 @@ static const char *const mobj_opt[] = {
|
|||
"extravalue2",
|
||||
"cusval",
|
||||
"cvmem",
|
||||
#ifdef ESLOPE
|
||||
"standingslope",
|
||||
#endif
|
||||
"colorized",
|
||||
"shadowscale",
|
||||
"whiteshadow",
|
||||
|
|
@ -367,11 +363,9 @@ static int mobj_get(lua_State *L)
|
|||
case mobj_cvmem:
|
||||
lua_pushinteger(L, mo->cvmem);
|
||||
break;
|
||||
#ifdef ESLOPE
|
||||
case mobj_standingslope:
|
||||
LUA_PushUserdata(L, mo->standingslope, META_SLOPE);
|
||||
break;
|
||||
#endif
|
||||
case mobj_colorized:
|
||||
lua_pushboolean(L, mo->colorized);
|
||||
break;
|
||||
|
|
@ -703,10 +697,8 @@ static int mobj_set(lua_State *L)
|
|||
case mobj_cvmem:
|
||||
mo->cvmem = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
#ifdef ESLOPE
|
||||
case mobj_standingslope:
|
||||
return NOSET;
|
||||
#endif
|
||||
case mobj_colorized:
|
||||
mo->colorized = luaL_checkboolean(L, 3);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -22,9 +22,7 @@
|
|||
#include "byteptr.h"
|
||||
#include "p_saveg.h"
|
||||
#include "p_local.h"
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h" // for P_SlopeById
|
||||
#endif
|
||||
#ifdef LUA_ALLOW_BYTECODE
|
||||
#include "d_netfil.h" // for LUA_DumpFile
|
||||
#endif
|
||||
|
|
@ -472,9 +470,7 @@ enum
|
|||
ARCH_SIDE,
|
||||
ARCH_SUBSECTOR,
|
||||
ARCH_SECTOR,
|
||||
#ifdef ESLOPE
|
||||
ARCH_SLOPE,
|
||||
#endif
|
||||
ARCH_MAPHEADER,
|
||||
|
||||
ARCH_TEND=0xFF,
|
||||
|
|
@ -494,9 +490,7 @@ static const struct {
|
|||
{META_SIDE, ARCH_SIDE},
|
||||
{META_SUBSECTOR,ARCH_SUBSECTOR},
|
||||
{META_SECTOR, ARCH_SECTOR},
|
||||
#ifdef ESLOPE
|
||||
{META_SLOPE, ARCH_SLOPE},
|
||||
#endif
|
||||
{META_MAPHEADER, ARCH_MAPHEADER},
|
||||
{NULL, ARCH_NULL}
|
||||
};
|
||||
|
|
@ -701,7 +695,6 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
case ARCH_SLOPE:
|
||||
{
|
||||
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
|
||||
|
|
@ -713,7 +706,6 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case ARCH_MAPHEADER:
|
||||
{
|
||||
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
|
||||
|
|
@ -915,7 +907,6 @@ static UINT8 ArchiveValueDemo(int TABLESINDEX, int myindex)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
case ARCH_SLOPE:
|
||||
{
|
||||
pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex));
|
||||
|
|
@ -927,7 +918,6 @@ static UINT8 ArchiveValueDemo(int TABLESINDEX, int myindex)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case ARCH_MAPHEADER:
|
||||
{
|
||||
mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex));
|
||||
|
|
@ -1233,11 +1223,9 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
|
|||
case ARCH_SECTOR:
|
||||
LUA_PushUserdata(gL, §ors[READUINT16(save_p)], META_SECTOR);
|
||||
break;
|
||||
#ifdef ESLOPE
|
||||
case ARCH_SLOPE:
|
||||
LUA_PushUserdata(gL, P_SlopeById(READUINT16(save_p)), META_SLOPE);
|
||||
break;
|
||||
#endif
|
||||
case ARCH_MAPHEADER:
|
||||
LUA_PushUserdata(gL, mapheaderinfo[READUINT16(save_p)], META_MAPHEADER);
|
||||
break;
|
||||
|
|
@ -1336,11 +1324,9 @@ static UINT8 UnArchiveValueDemo(int TABLESINDEX, char field[1024])
|
|||
case ARCH_SECTOR:
|
||||
LUA_PushUserdata(gL, §ors[READUINT16(demo_p)], META_SECTOR);
|
||||
break;
|
||||
#ifdef ESLOPE
|
||||
case ARCH_SLOPE:
|
||||
LUA_PushUserdata(gL, P_SlopeById(READUINT16(demo_p)), META_SLOPE);
|
||||
break;
|
||||
#endif
|
||||
case ARCH_MAPHEADER:
|
||||
LUA_PushUserdata(gL, mapheaderinfo[READUINT16(demo_p)], META_MAPHEADER);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -869,13 +869,9 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
|
|||
|
||||
if (ceiling)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
// Truncate position to match where mapthing would be when spawned
|
||||
// (this applies to every further P_GetZAt call as well)
|
||||
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight;
|
||||
#else
|
||||
fixed_t cheight = sec->ceilingheight;
|
||||
#endif
|
||||
|
||||
if (((cheight - player->mo->z - player->mo->height)>>FRACBITS) >= (1 << (16-ZSHIFT)))
|
||||
{
|
||||
|
|
@ -886,11 +882,7 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
|
||||
#else
|
||||
fixed_t fheight = sec->floorheight;
|
||||
#endif
|
||||
if (((player->mo->z - fheight)>>FRACBITS) >= (1 << (16-ZSHIFT)))
|
||||
{
|
||||
CONS_Printf(M_GetText("Sorry, you're too %s to place this object (max: %d %s).\n"), M_GetText("high"),
|
||||
|
|
@ -938,20 +930,12 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
|||
mt->y = (INT16)(player->mo->y>>FRACBITS);
|
||||
if (ceiling)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->ceilingheight;
|
||||
#else
|
||||
fixed_t cheight = sec->ceilingheight;
|
||||
#endif
|
||||
mt->options = (UINT16)((cheight - player->mo->z - player->mo->height)>>FRACBITS);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) : sec->floorheight;
|
||||
#else
|
||||
fixed_t fheight = sec->floorheight;
|
||||
#endif
|
||||
mt->options = (UINT16)((player->mo->z - fheight)>>FRACBITS);
|
||||
}
|
||||
mt->options <<= ZSHIFT;
|
||||
|
|
@ -1008,11 +992,7 @@ void OP_NightsObjectplace(player_t *player)
|
|||
UINT16 angle = (UINT16)(player->anotherflyangle % 360);
|
||||
INT16 temp = (INT16)FixedInt(AngleFixed(player->mo->angle)); // Traditional 2D Angle
|
||||
sector_t *sec = player->mo->subsector->sector;
|
||||
#ifdef ESLOPE
|
||||
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
|
||||
#else
|
||||
fixed_t fheight = sec->floorheight;
|
||||
#endif
|
||||
|
||||
|
||||
player->pflags |= PF_ATTACKDOWN;
|
||||
|
|
@ -1169,20 +1149,12 @@ void OP_ObjectplaceMovement(player_t *player)
|
|||
|
||||
if (!!(mobjinfo[op_currentthing].flags & MF_SPAWNCEILING) ^ !!(cv_opflags.value & MTF_OBJECTFLIP))
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
fixed_t cheight = sec->c_slope ? P_GetZAt(sec->c_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->ceilingheight;
|
||||
#else
|
||||
fixed_t cheight = sec->ceilingheight;
|
||||
#endif
|
||||
op_displayflags = (UINT16)((cheight - player->mo->z - mobjinfo[op_currentthing].height)>>FRACBITS);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
fixed_t fheight = sec->f_slope ? P_GetZAt(sec->f_slope, player->mo->x & 0xFFFF0000, player->mo->y & 0xFFFF0000) : sec->floorheight;
|
||||
#else
|
||||
fixed_t fheight = sec->floorheight;
|
||||
#endif
|
||||
op_displayflags = (UINT16)((player->mo->z - fheight)>>FRACBITS);
|
||||
}
|
||||
op_displayflags <<= ZSHIFT;
|
||||
|
|
|
|||
797
src/m_menu.c
797
src/m_menu.c
File diff suppressed because it is too large
Load diff
|
|
@ -79,7 +79,6 @@ typedef enum
|
|||
M_NOT_WAITING,
|
||||
|
||||
M_WAITING_VERSION,
|
||||
M_WAITING_ROOMS,
|
||||
M_WAITING_SERVERS,
|
||||
}
|
||||
M_waiting_mode_t;
|
||||
|
|
@ -175,9 +174,6 @@ typedef struct menuitem_s
|
|||
|
||||
extern menuitem_t PlayerMenu[MAXSKINS];
|
||||
|
||||
extern menuitem_t MP_RoomMenu[];
|
||||
extern UINT32 roomIds[NUM_LIST_ROOMS];
|
||||
|
||||
typedef struct menu_s
|
||||
{
|
||||
const char *menutitlepic;
|
||||
|
|
@ -267,6 +263,8 @@ void Addons_option_Onchange(void);
|
|||
void M_ReplayHut(INT32 choice);
|
||||
void M_SetPlaybackMenuPointer(void);
|
||||
|
||||
void M_RefreshPauseMenu(void);
|
||||
|
||||
INT32 HU_GetHighlightColor(void);
|
||||
|
||||
// These defines make it a little easier to make menus
|
||||
|
|
|
|||
153
src/mserv.c
153
src/mserv.c
|
|
@ -23,6 +23,12 @@
|
|||
#include "m_menu.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
#endif
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
|
||||
static int MSId;
|
||||
static int MSRegisteredId = -1;
|
||||
|
||||
|
|
@ -43,27 +49,33 @@ static I_cond MSCond;
|
|||
# define Unlock_state()
|
||||
#endif/*HAVE_THREADS*/
|
||||
|
||||
static void Update_parameters (void);
|
||||
|
||||
#ifndef NONET
|
||||
static void Command_Listserv_f(void);
|
||||
#endif
|
||||
|
||||
#endif/*MASTERSERVER*/
|
||||
|
||||
static void Update_parameters (void);
|
||||
|
||||
static void MasterServer_OnChange(void);
|
||||
|
||||
static void Advertise_OnChange(void);
|
||||
|
||||
static CV_PossibleValue_t masterserver_update_rate_cons_t[] = {
|
||||
{2, "MIN"},
|
||||
{60, "MAX"},
|
||||
{0}
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
consvar_t cv_masterserver = {"masterserver", "https://mb.srb2.org/MS/0", CV_SAVE|CV_CALL, NULL, MasterServer_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_masterserver = {"masterserver", "https://ms.kartkrew.org/ms/api", CV_SAVE|CV_CALL, NULL, MasterServer_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_servername = {"servername", "SRB2Kart server", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_server_contact = {"server_contact", "", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_masterserver_update_rate = {"masterserver_update_rate", "15", CV_SAVE|CV_CALL|CV_NOINIT, masterserver_update_rate_cons_t, Update_parameters, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_masterserver_update_rate = {"masterserver_update_rate", "15", CV_SAVE|CV_CALL|CV_NOINIT, masterserver_update_rate_cons_t, MasterClient_Ticker, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
INT16 ms_RoomId = -1;
|
||||
consvar_t cv_advertise = {"advertise", "No", CV_NETVAR|CV_CALL|CV_NOINIT, CV_YesNo, Advertise_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
#if defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||
int ms_QueryId;
|
||||
I_mutex ms_QueryId_mutex;
|
||||
|
||||
|
|
@ -73,10 +85,6 @@ I_mutex ms_ServerList_mutex;
|
|||
|
||||
UINT16 current_port = 0;
|
||||
|
||||
// Room list is an external variable now.
|
||||
// Avoiding having to get info ten thousand times...
|
||||
msg_rooms_t room_list[NUM_LIST_ROOMS+1]; // +1 for easy test
|
||||
|
||||
/** Adds variables and commands relating to the master server.
|
||||
*
|
||||
* \sa cv_masterserver, cv_servername,
|
||||
|
|
@ -90,11 +98,17 @@ void AddMServCommands(void)
|
|||
CV_RegisterVar(&cv_masterserver_timeout);
|
||||
CV_RegisterVar(&cv_masterserver_debug);
|
||||
CV_RegisterVar(&cv_masterserver_token);
|
||||
CV_RegisterVar(&cv_advertise);
|
||||
CV_RegisterVar(&cv_servername);
|
||||
CV_RegisterVar(&cv_server_contact);
|
||||
#ifdef MASTERSERVER
|
||||
COM_AddCommand("listserv", Command_Listserv_f);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MASTERSERVER
|
||||
|
||||
static void WarnGUI (void)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
|
|
@ -107,14 +121,14 @@ static void WarnGUI (void)
|
|||
}
|
||||
|
||||
#define NUM_LIST_SERVER MAXSERVERLIST
|
||||
msg_server_t *GetShortServersList(INT32 room, int id)
|
||||
msg_server_t *GetShortServersList(int id)
|
||||
{
|
||||
msg_server_t *server_list;
|
||||
|
||||
// +1 for easy test
|
||||
server_list = malloc(( NUM_LIST_SERVER + 1 ) * sizeof *server_list);
|
||||
|
||||
if (HMS_fetch_servers(server_list, room, id))
|
||||
if (HMS_fetch_servers(server_list, id))
|
||||
return server_list;
|
||||
else
|
||||
{
|
||||
|
|
@ -124,17 +138,6 @@ msg_server_t *GetShortServersList(INT32 room, int id)
|
|||
}
|
||||
}
|
||||
|
||||
INT32 GetRoomsList(boolean hosting, int id)
|
||||
{
|
||||
if (HMS_fetch_rooms( ! hosting, id))
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
WarnGUI();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UPDATE_ALERT
|
||||
char *GetMODVersion(int id)
|
||||
{
|
||||
|
|
@ -168,15 +171,6 @@ char *GetMODVersion(int id)
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Console only version of the above (used before game init)
|
||||
void GetMODVersion_Console(void)
|
||||
{
|
||||
char buffer[16];
|
||||
|
||||
if (HMS_compare_mod_version(buffer, sizeof buffer) > 0)
|
||||
I_Error(UPDATE_ALERT_STRING_CONSOLE, VERSIONSTRING, buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
|
|
@ -267,6 +261,9 @@ Finish_unlist (void)
|
|||
Lock_state();
|
||||
{
|
||||
registered = MSRegistered;
|
||||
|
||||
if (MSId == MSRegisteredId)
|
||||
MSId++;
|
||||
}
|
||||
Unlock_state();
|
||||
|
||||
|
|
@ -287,13 +284,6 @@ Finish_unlist (void)
|
|||
I_wake_all_cond(&MSCond);
|
||||
#endif
|
||||
}
|
||||
|
||||
Lock_state();
|
||||
{
|
||||
if (MSId == MSRegisteredId)
|
||||
MSId++;
|
||||
}
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
|
|
@ -395,6 +385,7 @@ Change_masterserver_thread (char *api)
|
|||
|
||||
void RegisterServer(void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
#ifdef HAVE_THREADS
|
||||
I_spawn_thread(
|
||||
"register-server",
|
||||
|
|
@ -404,6 +395,7 @@ void RegisterServer(void)
|
|||
#else
|
||||
Finish_registration();
|
||||
#endif
|
||||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
||||
static void UpdateServer(void)
|
||||
|
|
@ -421,6 +413,7 @@ static void UpdateServer(void)
|
|||
|
||||
void UnregisterServer(void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
#ifdef HAVE_THREADS
|
||||
I_spawn_thread(
|
||||
"unlist-server",
|
||||
|
|
@ -430,12 +423,13 @@ void UnregisterServer(void)
|
|||
#else
|
||||
Finish_unlist();
|
||||
#endif
|
||||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
||||
static boolean
|
||||
Online (void)
|
||||
{
|
||||
return ( serverrunning && ms_RoomId > 0 );
|
||||
return ( serverrunning && cv_advertise.value );
|
||||
}
|
||||
|
||||
static inline void SendPingToMasterServer(void)
|
||||
|
|
@ -465,9 +459,33 @@ static inline void SendPingToMasterServer(void)
|
|||
}
|
||||
}
|
||||
|
||||
void MasterClient_Ticker(void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
SendPingToMasterServer();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
Set_api (const char *api)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
I_spawn_thread(
|
||||
"change-masterserver",
|
||||
(I_thread_fn)Change_masterserver_thread,
|
||||
strdup(api)
|
||||
);
|
||||
#else
|
||||
HMS_set_api(strdup(api));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif/*MASTERSERVER*/
|
||||
|
||||
static void
|
||||
Update_parameters (void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
int registered;
|
||||
int delayed;
|
||||
|
||||
|
|
@ -487,29 +505,12 @@ Update_parameters (void)
|
|||
if (! delayed && registered)
|
||||
UpdateServer();
|
||||
}
|
||||
}
|
||||
|
||||
void MasterClient_Ticker(void)
|
||||
{
|
||||
SendPingToMasterServer();
|
||||
}
|
||||
|
||||
static void
|
||||
Set_api (const char *api)
|
||||
{
|
||||
#ifdef HAVE_THREADS
|
||||
I_spawn_thread(
|
||||
"change-masterserver",
|
||||
(I_thread_fn)Change_masterserver_thread,
|
||||
strdup(api)
|
||||
);
|
||||
#else
|
||||
HMS_set_api(strdup(api));
|
||||
#endif
|
||||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
||||
static void MasterServer_OnChange(void)
|
||||
{
|
||||
#ifdef MASTERSERVER
|
||||
UnregisterServer();
|
||||
|
||||
/*
|
||||
|
|
@ -527,4 +528,36 @@ static void MasterServer_OnChange(void)
|
|||
|
||||
if (Online())
|
||||
RegisterServer();
|
||||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
||||
static void
|
||||
Advertise_OnChange(void)
|
||||
{
|
||||
int different;
|
||||
|
||||
if (cv_advertise.value)
|
||||
{
|
||||
if (serverrunning)
|
||||
{
|
||||
Lock_state();
|
||||
{
|
||||
different = ( MSId != MSRegisteredId );
|
||||
}
|
||||
Unlock_state();
|
||||
|
||||
if (different)
|
||||
{
|
||||
RegisterServer();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UnregisterServer();
|
||||
}
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
DRPC_UpdatePresence();
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
28
src/mserv.h
28
src/mserv.h
|
|
@ -16,9 +16,6 @@
|
|||
|
||||
#include "i_threads.h"
|
||||
|
||||
// lowered from 32 due to menu changes
|
||||
#define NUM_LIST_ROOMS 16
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
|
@ -35,19 +32,10 @@ typedef struct
|
|||
msg_header_t header;
|
||||
char ip[16];
|
||||
char port[8];
|
||||
char name[32];
|
||||
INT32 room;
|
||||
char contact[32];
|
||||
char version[8]; // format is: x.yy.z (like 1.30.2 or 1.31)
|
||||
} ATTRPACK msg_server_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
msg_header_t header;
|
||||
INT32 id;
|
||||
char name[32];
|
||||
char motd[255];
|
||||
} ATTRPACK msg_rooms_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
msg_header_t header;
|
||||
|
|
@ -65,15 +53,13 @@ typedef struct
|
|||
// ================================ GLOBALS ===============================
|
||||
|
||||
extern consvar_t cv_masterserver, cv_servername;
|
||||
extern consvar_t cv_server_contact;
|
||||
extern consvar_t cv_masterserver_update_rate;
|
||||
extern consvar_t cv_masterserver_timeout;
|
||||
extern consvar_t cv_masterserver_debug;
|
||||
extern consvar_t cv_masterserver_token;
|
||||
|
||||
// < 0 to not connect (usually -1) (offline mode)
|
||||
// == 0 to show all rooms, not a valid hosting room
|
||||
// anything else is whatever room the MS assigns to that number (online mode)
|
||||
extern INT16 ms_RoomId;
|
||||
extern consvar_t cv_advertise;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
extern int ms_QueryId;
|
||||
|
|
@ -88,24 +74,20 @@ void UnregisterServer(void);
|
|||
|
||||
void MasterClient_Ticker(void);
|
||||
|
||||
msg_server_t *GetShortServersList(INT32 room, int id);
|
||||
INT32 GetRoomsList(boolean hosting, int id);
|
||||
msg_server_t *GetShortServersList(int id);
|
||||
#ifdef UPDATE_ALERT
|
||||
char *GetMODVersion(int id);
|
||||
void GetMODVersion_Console(void);
|
||||
#endif
|
||||
extern msg_rooms_t room_list[NUM_LIST_ROOMS+1];
|
||||
|
||||
void AddMServCommands(void);
|
||||
|
||||
/* HTTP */
|
||||
void HMS_set_api (char *api);
|
||||
int HMS_fetch_rooms (int joining, int id);
|
||||
int HMS_register (void);
|
||||
int HMS_unlist (void);
|
||||
int HMS_update (void);
|
||||
void HMS_list_servers (void);
|
||||
msg_server_t * HMS_fetch_servers (msg_server_t *list, int room, int id);
|
||||
msg_server_t * HMS_fetch_servers (msg_server_t *list, int id);
|
||||
int HMS_compare_mod_version (char *buffer, size_t size_of_buffer);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5815,13 +5815,8 @@ void A_MixUp(mobj_t *actor)
|
|||
|
||||
P_SetThingPosition(players[i].mo);
|
||||
|
||||
#ifdef ESLOPE
|
||||
players[i].mo->floorz = P_GetFloorZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL);
|
||||
players[i].mo->ceilingz = P_GetCeilingZ(players[i].mo, players[i].mo->subsector->sector, players[i].mo->x, players[i].mo->y, NULL);
|
||||
#else
|
||||
players[i].mo->floorz = players[i].mo->subsector->sector->floorheight;
|
||||
players[i].mo->ceilingz = players[i].mo->subsector->sector->ceilingheight;
|
||||
#endif
|
||||
|
||||
P_CheckPosition(players[i].mo, players[i].mo->x, players[i].mo->y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -327,9 +327,7 @@ extern mobj_t *tmfloorthing, *tmhitthing, *tmthing;
|
|||
extern camera_t *mapcampointer;
|
||||
extern fixed_t tmx;
|
||||
extern fixed_t tmy;
|
||||
#ifdef ESLOPE
|
||||
extern pslope_t *tmfloorslope, *tmceilingslope;
|
||||
#endif
|
||||
|
||||
/* cphipps 2004/08/30 */
|
||||
extern void P_MapStart(void);
|
||||
|
|
|
|||
60
src/p_map.c
60
src/p_map.c
|
|
@ -33,9 +33,7 @@
|
|||
|
||||
#include "r_splats.h"
|
||||
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h"
|
||||
#endif
|
||||
|
||||
#include "z_zone.h"
|
||||
|
||||
|
|
@ -58,9 +56,7 @@ fixed_t tmfloorz, tmceilingz;
|
|||
static fixed_t tmdropoffz, tmdrpoffceilz; // drop-off floor/ceiling heights
|
||||
mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz is from a sector
|
||||
mobj_t *tmhitthing; // the solid thing you bumped into (for collisions)
|
||||
#ifdef ESLOPE
|
||||
pslope_t *tmfloorslope, *tmceilingslope;
|
||||
#endif
|
||||
|
||||
// keep track of the line that lowers the ceiling,
|
||||
// so missiles don't explode against sky hack walls
|
||||
|
|
@ -251,9 +247,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
object->standingslope = NULL; // Okay, now we can't return - no launching off at silly angles for you.
|
||||
#endif
|
||||
|
||||
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
||||
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
|
||||
|
|
@ -402,9 +396,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
|||
zdist = object->z - spring->z;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
object->standingslope = NULL; // No launching off at silly angles for you.
|
||||
#endif
|
||||
|
||||
switch (spring->type)
|
||||
{
|
||||
|
|
@ -1634,9 +1626,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (thing->z + thing->height > tmfloorz)
|
||||
{
|
||||
tmfloorz = thing->z + thing->height;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = NULL;
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1653,17 +1643,13 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
&& tmthing->z + tmthing->height < tmthing->ceilingz)
|
||||
{
|
||||
tmfloorz = tmceilingz = topz; // block while in air
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = NULL;
|
||||
#endif
|
||||
tmfloorthing = thing; // needed for side collision
|
||||
}
|
||||
else if (topz < tmceilingz && tmthing->z <= thing->z+thing->height)
|
||||
{
|
||||
tmceilingz = topz;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = NULL;
|
||||
#endif
|
||||
tmfloorthing = thing; // thing we may stand on
|
||||
}
|
||||
}
|
||||
|
|
@ -1677,9 +1663,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (thing->z < tmceilingz)
|
||||
{
|
||||
tmceilingz = thing->z;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = NULL;
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1696,17 +1680,13 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
&& tmthing->z > tmthing->floorz)
|
||||
{
|
||||
tmfloorz = tmceilingz = topz; // block while in air
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = NULL;
|
||||
#endif
|
||||
tmfloorthing = thing; // needed for side collision
|
||||
}
|
||||
else if (topz > tmfloorz && tmthing->z+tmthing->height >= thing->z)
|
||||
{
|
||||
tmfloorz = topz;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = NULL;
|
||||
#endif
|
||||
tmfloorthing = thing; // thing we may stand on
|
||||
}
|
||||
}
|
||||
|
|
@ -1840,17 +1820,13 @@ static boolean PIT_CheckLine(line_t *ld)
|
|||
{
|
||||
tmceilingz = opentop;
|
||||
ceilingline = ld;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = opentopslope;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (openbottom > tmfloorz)
|
||||
{
|
||||
tmfloorz = openbottom;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = openbottomslope;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (highceiling > tmdrpoffceilz)
|
||||
|
|
@ -1935,10 +1911,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
// will adjust them.
|
||||
tmfloorz = tmdropoffz = P_GetFloorZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->floorheight;
|
||||
tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = newsubsec->sector->f_slope;
|
||||
tmceilingslope = newsubsec->sector->c_slope;
|
||||
#endif
|
||||
|
||||
// Check list of fake floors and see if tmfloorz/tmceilingz need to be altered.
|
||||
if (newsubsec->sector->ffloors)
|
||||
|
|
@ -1978,18 +1952,14 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
{
|
||||
if (tmfloorz < topheight - sinklevel) {
|
||||
tmfloorz = topheight - sinklevel;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = *rover->t_slope;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (thing->eflags & MFE_VERTICALFLIP && thingtop <= bottomheight + sinklevel && thing->momz >= 0)
|
||||
{
|
||||
if (tmceilingz > bottomheight + sinklevel) {
|
||||
tmceilingz = bottomheight + sinklevel;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = *rover->b_slope;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2011,9 +1981,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
{
|
||||
if (tmfloorz < thing->z) {
|
||||
tmfloorz = thing->z;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// Quicksand blocks never change heights otherwise.
|
||||
|
|
@ -2029,18 +1997,14 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
&& !(rover->flags & FF_REVERSEPLATFORM))
|
||||
{
|
||||
tmfloorz = tmdropoffz = topheight;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = *rover->t_slope;
|
||||
#endif
|
||||
}
|
||||
if (bottomheight < tmceilingz && abs(delta1) >= abs(delta2)
|
||||
&& !(rover->flags & FF_PLATFORM)
|
||||
&& !(thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)))
|
||||
{
|
||||
tmceilingz = tmdrpoffceilz = bottomheight;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = *rover->b_slope;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2057,7 +2021,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// Check polyobjects and see if tmfloorz/tmceilingz need to be altered
|
||||
{
|
||||
validcount++;
|
||||
|
|
@ -2115,23 +2078,18 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
|||
|
||||
if (polytop > tmfloorz && abs(delta1) < abs(delta2)) {
|
||||
tmfloorz = tmdropoffz = polytop;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (polybottom < tmceilingz && abs(delta1) >= abs(delta2)) {
|
||||
tmceilingz = tmdrpoffceilz = polybottom;
|
||||
#ifdef ESLOPE
|
||||
tmceilingslope = NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
plink = (polymaplink_t *)(plink->link.next);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// tmfloorthing is set when tmfloorz comes from a thing's top
|
||||
tmfloorthing = NULL;
|
||||
|
|
@ -2292,7 +2250,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||
|
||||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// Check polyobjects and see if tmfloorz/tmceilingz need to be altered
|
||||
{
|
||||
validcount++;
|
||||
|
|
@ -2363,7 +2320,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// check lines
|
||||
for (bx = xl; bx <= xh; bx++)
|
||||
|
|
@ -2542,10 +2498,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
|
|||
mobj_t *oldthing = tmthing;
|
||||
line_t *oldceilline = ceilingline;
|
||||
line_t *oldblockline = blockingline;
|
||||
#ifdef ESLOPE
|
||||
pslope_t *oldfslope = tmfloorslope;
|
||||
pslope_t *oldcslope = tmceilingslope;
|
||||
#endif
|
||||
|
||||
// Move the player
|
||||
P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true);
|
||||
|
|
@ -2558,10 +2512,8 @@ boolean PIT_PushableMoved(mobj_t *thing)
|
|||
P_SetTarget(&tmthing, oldthing);
|
||||
ceilingline = oldceilline;
|
||||
blockingline = oldblockline;
|
||||
#ifdef ESLOPE
|
||||
tmfloorslope = oldfslope;
|
||||
tmceilingslope = oldcslope;
|
||||
#endif
|
||||
thing->momz = stand->momz;
|
||||
}
|
||||
else
|
||||
|
|
@ -2585,9 +2537,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
fixed_t oldy = tryy;
|
||||
fixed_t radius = thing->radius;
|
||||
fixed_t thingtop = thing->z + thing->height;
|
||||
#ifdef ESLOPE
|
||||
fixed_t startingonground = P_IsObjectOnGround(thing);
|
||||
#endif
|
||||
floatok = false;
|
||||
|
||||
// reset this to 0 at the start of each trymove call as it's only used here
|
||||
|
|
@ -2672,26 +2622,22 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (tmceilingz < thingtop && thingtop - tmceilingz <= maxstep)
|
||||
{
|
||||
thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (thing->z == thing->floorz && tmfloorz < thing->z && thing->z - tmfloorz <= maxstep)
|
||||
{
|
||||
thing->z = thing->floorz = tmfloorz;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (tmfloorz > thing->z && tmfloorz - thing->z <= maxstep)
|
||||
{
|
||||
thing->z = thing->floorz = tmfloorz;
|
||||
thing->eflags |= MFE_JUSTSTEPPEDDOWN;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (thing->eflags & MFE_VERTICALFLIP)
|
||||
|
|
@ -2753,7 +2699,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
thing->floorz = tmfloorz;
|
||||
thing->ceilingz = tmceilingz;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (!(thing->flags & MF_NOCLIPHEIGHT))
|
||||
{
|
||||
// Assign thing's standingslope if needed
|
||||
|
|
@ -2784,7 +2729,6 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
|||
}
|
||||
else // don't set standingslope if you're not going to clip against it
|
||||
thing->standingslope = NULL;
|
||||
#endif
|
||||
|
||||
thing->x = x;
|
||||
thing->y = y;
|
||||
|
|
@ -4681,10 +4625,8 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
|||
sector_t *sec = R_PointInSubsector(x, y)->sector;
|
||||
fixed_t floorz = sec->floorheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (sec->f_slope)
|
||||
floorz = P_GetZAt(sec->f_slope, x, y);
|
||||
#endif
|
||||
|
||||
// Intercept the stupid 'fall through 3dfloors' bug Tails 03-17-2002
|
||||
if (sec->ffloors)
|
||||
|
|
@ -4704,12 +4646,10 @@ fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
|
|||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, x, y);
|
||||
if (*rover->b_slope)
|
||||
bottomheight = P_GetZAt(*rover->b_slope, x, y);
|
||||
#endif
|
||||
|
||||
if (rover->flags & FF_QUICKSAND)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -308,9 +308,7 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1)
|
|||
// OPTIMIZE: keep this precalculated
|
||||
//
|
||||
fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
|
||||
#ifdef ESLOPE
|
||||
pslope_t *opentopslope, *openbottomslope;
|
||||
#endif
|
||||
|
||||
// P_CameraLineOpening
|
||||
// P_LineOpening, but for camera
|
||||
|
|
@ -337,24 +335,20 @@ void P_CameraLineOpening(line_t *linedef)
|
|||
{
|
||||
frontfloor = sectors[front->camsec].floorheight;
|
||||
frontceiling = sectors[front->camsec].ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
if (sectors[front->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
|
||||
frontfloor = P_GetZAt(sectors[front->camsec].f_slope, camera[0].x, camera[0].y);
|
||||
if (sectors[front->camsec].c_slope)
|
||||
frontceiling = P_GetZAt(sectors[front->camsec].c_slope, camera[0].x, camera[0].y);
|
||||
#endif
|
||||
|
||||
}
|
||||
else if (front->heightsec >= 0)
|
||||
{
|
||||
frontfloor = sectors[front->heightsec].floorheight;
|
||||
frontceiling = sectors[front->heightsec].ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
if (sectors[front->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
|
||||
frontfloor = P_GetZAt(sectors[front->heightsec].f_slope, camera[0].x, camera[0].y);
|
||||
if (sectors[front->heightsec].c_slope)
|
||||
frontceiling = P_GetZAt(sectors[front->heightsec].c_slope, camera[0].x, camera[0].y);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -365,23 +359,19 @@ void P_CameraLineOpening(line_t *linedef)
|
|||
{
|
||||
backfloor = sectors[back->camsec].floorheight;
|
||||
backceiling = sectors[back->camsec].ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
if (sectors[back->camsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
|
||||
frontfloor = P_GetZAt(sectors[back->camsec].f_slope, camera[0].x, camera[0].y);
|
||||
if (sectors[back->camsec].c_slope)
|
||||
frontceiling = P_GetZAt(sectors[back->camsec].c_slope, camera[0].x, camera[0].y);
|
||||
#endif
|
||||
}
|
||||
else if (back->heightsec >= 0)
|
||||
{
|
||||
backfloor = sectors[back->heightsec].floorheight;
|
||||
backceiling = sectors[back->heightsec].ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
if (sectors[back->heightsec].f_slope) // SRB2CBTODO: ESLOPE (sectors[front->heightsec].f_slope)
|
||||
frontfloor = P_GetZAt(sectors[back->heightsec].f_slope, camera[0].x, camera[0].y);
|
||||
if (sectors[back->heightsec].c_slope)
|
||||
frontceiling = P_GetZAt(sectors[back->heightsec].c_slope, camera[0].x, camera[0].y);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -501,14 +491,12 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
}
|
||||
|
||||
// Treat polyobjects kind of like 3D Floors
|
||||
#ifdef POLYOBJECTS
|
||||
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT))
|
||||
{
|
||||
front = linedef->frontsector;
|
||||
back = linedef->frontsector;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
front = linedef->frontsector;
|
||||
back = linedef->backsector;
|
||||
|
|
@ -527,17 +515,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
opentop = frontheight;
|
||||
highceiling = backheight;
|
||||
#ifdef ESLOPE
|
||||
opentopslope = front->c_slope;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
opentop = backheight;
|
||||
highceiling = frontheight;
|
||||
#ifdef ESLOPE
|
||||
opentopslope = back->c_slope;
|
||||
#endif
|
||||
}
|
||||
|
||||
frontheight = P_GetFloorZ(mobj, front, tmx, tmy, linedef);
|
||||
|
|
@ -547,17 +531,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
openbottom = frontheight;
|
||||
lowfloor = backheight;
|
||||
#ifdef ESLOPE
|
||||
openbottomslope = front->f_slope;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
openbottom = backheight;
|
||||
lowfloor = frontheight;
|
||||
#ifdef ESLOPE
|
||||
openbottomslope = back->f_slope;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -625,9 +605,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
|
||||
// Check for fake floors in the sector.
|
||||
if (front->ffloors || back->ffloors
|
||||
#ifdef POLYOBJECTS
|
||||
|| linedef->polyobj
|
||||
#endif
|
||||
)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
|
|
@ -637,10 +615,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
fixed_t highestfloor = openbottom;
|
||||
fixed_t lowestfloor = lowfloor;
|
||||
fixed_t delta1, delta2;
|
||||
#ifdef ESLOPE
|
||||
pslope_t *ceilingslope = opentopslope;
|
||||
pslope_t *floorslope = openbottomslope;
|
||||
#endif
|
||||
|
||||
// Check for frontsector's fake floors
|
||||
for (rover = front->ffloors; rover; rover = rover->next)
|
||||
|
|
@ -665,9 +641,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
if (bottomheight < lowestceiling) {
|
||||
lowestceiling = bottomheight;
|
||||
#ifdef ESLOPE
|
||||
ceilingslope = *rover->b_slope;
|
||||
#endif
|
||||
}
|
||||
else if (bottomheight < highestceiling)
|
||||
highestceiling = bottomheight;
|
||||
|
|
@ -677,9 +651,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
if (topheight > highestfloor) {
|
||||
highestfloor = topheight;
|
||||
#ifdef ESLOPE
|
||||
floorslope = *rover->t_slope;
|
||||
#endif
|
||||
}
|
||||
else if (topheight > lowestfloor)
|
||||
lowestfloor = topheight;
|
||||
|
|
@ -709,9 +681,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
if (bottomheight < lowestceiling) {
|
||||
lowestceiling = bottomheight;
|
||||
#ifdef ESLOPE
|
||||
ceilingslope = *rover->b_slope;
|
||||
#endif
|
||||
}
|
||||
else if (bottomheight < highestceiling)
|
||||
highestceiling = bottomheight;
|
||||
|
|
@ -721,16 +691,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
{
|
||||
if (topheight > highestfloor) {
|
||||
highestfloor = topheight;
|
||||
#ifdef ESLOPE
|
||||
floorslope = *rover->t_slope;
|
||||
#endif
|
||||
}
|
||||
else if (topheight > lowestfloor)
|
||||
lowestfloor = topheight;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// Treat polyobj's backsector like a 3D Floor
|
||||
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT))
|
||||
{
|
||||
|
|
@ -740,38 +707,29 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
|||
delta2 = abs(thingtop - (polysec->floorheight + ((polysec->ceilingheight - polysec->floorheight)/2)));
|
||||
if (polysec->floorheight < lowestceiling && delta1 >= delta2) {
|
||||
lowestceiling = polysec->floorheight;
|
||||
#ifdef ESLOPE
|
||||
ceilingslope = NULL;
|
||||
#endif
|
||||
}
|
||||
else if (polysec->floorheight < highestceiling && delta1 >= delta2)
|
||||
highestceiling = polysec->floorheight;
|
||||
|
||||
if (polysec->ceilingheight > highestfloor && delta1 < delta2) {
|
||||
highestfloor = polysec->ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
floorslope = NULL;
|
||||
#endif
|
||||
}
|
||||
else if (polysec->ceilingheight > lowestfloor && delta1 < delta2)
|
||||
lowestfloor = polysec->ceilingheight;
|
||||
}
|
||||
#endif
|
||||
if (highestceiling < highceiling)
|
||||
highceiling = highestceiling;
|
||||
|
||||
if (highestfloor > openbottom) {
|
||||
openbottom = highestfloor;
|
||||
#ifdef ESLOPE
|
||||
openbottomslope = floorslope;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (lowestceiling < opentop) {
|
||||
opentop = lowestceiling;
|
||||
#ifdef ESLOPE
|
||||
opentopslope = ceilingslope;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (lowestfloor > lowfloor)
|
||||
|
|
@ -1023,9 +981,7 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
|
|||
{
|
||||
INT32 offset;
|
||||
const INT32 *list; // Big blockmap
|
||||
#ifdef POLYOBJECTS
|
||||
polymaplink_t *plink; // haleyjd 02/22/06
|
||||
#endif
|
||||
line_t *ld;
|
||||
|
||||
if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight)
|
||||
|
|
@ -1033,7 +989,6 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
|
|||
|
||||
offset = y*bmapwidth + x;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 02/22/06: consider polyobject lines
|
||||
plink = polyblocklinks[offset];
|
||||
|
||||
|
|
@ -1057,7 +1012,6 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *))
|
|||
}
|
||||
plink = (polymaplink_t *)(plink->link.next);
|
||||
}
|
||||
#endif
|
||||
|
||||
offset = *(blockmap + offset); // offset = blockmap[y*bmapwidth+x];
|
||||
|
||||
|
|
|
|||
|
|
@ -56,9 +56,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y);
|
|||
void P_HitSpecialLines(mobj_t *thing, fixed_t x, fixed_t y, fixed_t momx, fixed_t momy);
|
||||
|
||||
extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling;
|
||||
#ifdef ESLOPE
|
||||
extern pslope_t *opentopslope, *openbottomslope;
|
||||
#endif
|
||||
|
||||
void P_LineOpening(line_t *plinedef, mobj_t *mobj);
|
||||
|
||||
|
|
|
|||
156
src/p_mobj.c
156
src/p_mobj.c
|
|
@ -31,9 +31,7 @@
|
|||
#include "i_video.h"
|
||||
#include "lua_hook.h"
|
||||
#include "k_bot.h"
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h"
|
||||
#endif
|
||||
|
||||
#include "k_kart.h"
|
||||
#include "k_battle.h"
|
||||
|
|
@ -681,12 +679,10 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
|
|||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
|
||||
if (*rover->b_slope)
|
||||
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
|
||||
#endif
|
||||
|
||||
if (mobj->z > topheight)
|
||||
return false;
|
||||
|
|
@ -697,7 +693,6 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
// P_GetFloorZ (and its ceiling counterpart)
|
||||
// Gets the floor height (or ceiling height) of the mobj's contact point in sector, assuming object's center if moved to [x, y]
|
||||
// If line is supplied, it's a divider line on the sector. Set it to NULL if you're not checking for collision with a line
|
||||
|
|
@ -801,15 +796,11 @@ static fixed_t HighestOnLine(fixed_t radius, fixed_t x, fixed_t y, line_t *line,
|
|||
P_GetZAt(slope, v2.x, v2.y)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
I_Assert(mobj != NULL);
|
||||
#endif
|
||||
I_Assert(sector != NULL);
|
||||
#ifdef ESLOPE
|
||||
if (sector->f_slope) {
|
||||
fixed_t testx, testy;
|
||||
pslope_t *slope = sector->f_slope;
|
||||
|
|
@ -879,25 +870,13 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t
|
|||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the floor height
|
||||
#else
|
||||
(void)mobj;
|
||||
(void)boundsec;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)line;
|
||||
(void)lowest;
|
||||
(void)perfect;
|
||||
#endif
|
||||
return sector->floorheight;
|
||||
}
|
||||
|
||||
fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
I_Assert(mobj != NULL);
|
||||
#endif
|
||||
I_Assert(sector != NULL);
|
||||
#ifdef ESLOPE
|
||||
if (sector->c_slope) {
|
||||
fixed_t testx, testy;
|
||||
pslope_t *slope = sector->c_slope;
|
||||
|
|
@ -967,26 +946,14 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed
|
|||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the ceiling height
|
||||
#else
|
||||
(void)mobj;
|
||||
(void)boundsec;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)line;
|
||||
(void)lowest;
|
||||
(void)perfect;
|
||||
#endif
|
||||
return sector->ceilingheight;
|
||||
}
|
||||
|
||||
// Now do the same as all above, but for cameras because apparently cameras are special?
|
||||
fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
I_Assert(mobj != NULL);
|
||||
#endif
|
||||
I_Assert(sector != NULL);
|
||||
#ifdef ESLOPE
|
||||
if (sector->f_slope) {
|
||||
fixed_t testx, testy;
|
||||
pslope_t *slope = sector->f_slope;
|
||||
|
|
@ -1056,25 +1023,13 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix
|
|||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the floor height
|
||||
#else
|
||||
(void)mobj;
|
||||
(void)boundsec;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)line;
|
||||
(void)lowest;
|
||||
(void)perfect;
|
||||
#endif
|
||||
return sector->floorheight;
|
||||
}
|
||||
|
||||
fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
I_Assert(mobj != NULL);
|
||||
#endif
|
||||
I_Assert(sector != NULL);
|
||||
#ifdef ESLOPE
|
||||
if (sector->c_slope) {
|
||||
fixed_t testx, testy;
|
||||
pslope_t *slope = sector->c_slope;
|
||||
|
|
@ -1144,15 +1099,6 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
|
|||
|
||||
return HighestOnLine(mobj->radius, x, y, line, slope, lowest);
|
||||
} else // Well, that makes it easy. Just get the ceiling height
|
||||
#else
|
||||
(void)mobj;
|
||||
(void)boundsec;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)line;
|
||||
(void)lowest;
|
||||
(void)perfect;
|
||||
#endif
|
||||
return sector->ceilingheight;
|
||||
}
|
||||
static void P_PlayerFlip(mobj_t *mo)
|
||||
|
|
@ -1443,9 +1389,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
|
|||
else if (abs(player->rmomx) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
|
||||
&& (!(K_GetForwardMove(player) && !(twodlevel || mo->flags2 & MF2_TWOD)) && !(player->pflags & PF_SPINNING))
|
||||
#ifdef ESLOPE
|
||||
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)))// && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// if in a walking frame, stop moving
|
||||
|
|
@ -1585,11 +1529,9 @@ void P_XYMovement(mobj_t *mo)
|
|||
fixed_t xmove, ymove;
|
||||
fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls
|
||||
boolean moved;
|
||||
#ifdef ESLOPE
|
||||
pslope_t *oldslope = NULL;
|
||||
vector3_t slopemom;
|
||||
fixed_t predictedz = 0;
|
||||
#endif
|
||||
|
||||
I_Assert(mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(mo));
|
||||
|
|
@ -1619,7 +1561,6 @@ void P_XYMovement(mobj_t *mo)
|
|||
oldx = mo->x;
|
||||
oldy = mo->y;
|
||||
|
||||
#ifdef ESLOPE
|
||||
// adjust various things based on slope
|
||||
if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8) {
|
||||
if (!P_IsObjectOnGround(mo)) { // We fell off at some point? Do the twisty thing!
|
||||
|
|
@ -1641,7 +1582,6 @@ void P_XYMovement(mobj_t *mo)
|
|||
}
|
||||
} else if (P_IsObjectOnGround(mo) && !mo->momz)
|
||||
predictedz = mo->z;
|
||||
#endif
|
||||
|
||||
// Pushables can break some blocks
|
||||
if (CheckForBustableBlocks && mo->flags & MF_PUSHABLE)
|
||||
|
|
@ -1821,7 +1761,6 @@ void P_XYMovement(mobj_t *mo)
|
|||
if (P_MobjWasRemoved(mo)) // MF_SPECIAL touched a player! O_o;;
|
||||
return;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (moved && oldslope) { // Check to see if we ran off
|
||||
|
||||
if (oldslope != mo->standingslope) { // First, compare different slopes
|
||||
|
|
@ -1872,7 +1811,6 @@ void P_XYMovement(mobj_t *mo)
|
|||
//CONS_Printf("Launched off of flat surface running into downward slope\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check the gravity status.
|
||||
P_CheckGravity(mo, false);
|
||||
|
|
@ -1923,11 +1861,9 @@ void P_XYMovement(mobj_t *mo)
|
|||
if (player && player->pflags & PF_NIGHTSMODE)
|
||||
return; // no friction for NiGHTS players
|
||||
|
||||
#ifdef ESLOPE
|
||||
if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED)
|
||||
&& (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes
|
||||
return;
|
||||
#endif
|
||||
|
||||
//{ SRB2kart stuff
|
||||
if (mo->type == MT_FLINGRING || mo->type == MT_BALLHOG || mo->type == MT_BUBBLESHIELDTRAP)
|
||||
|
|
@ -2166,9 +2102,7 @@ boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover)
|
|||
|
||||
{
|
||||
fixed_t topheight =
|
||||
#ifdef ESLOPE
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) :
|
||||
#endif
|
||||
*rover->topheight;
|
||||
|
||||
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3
|
||||
|
|
@ -2206,7 +2140,6 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
}
|
||||
mo->z += mo->momz;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (mo->standingslope)
|
||||
{
|
||||
if (mo->flags & MF_NOCLIPHEIGHT)
|
||||
|
|
@ -2214,7 +2147,6 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
else if (!P_IsObjectOnGround(mo))
|
||||
P_SlopeLaunch(mo);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (mo->type)
|
||||
{
|
||||
|
|
@ -2406,7 +2338,6 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
else
|
||||
mo->z = mo->floorz;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (!(mo->flags & MF_MISSILE) && mo->standingslope) // You're still on the ground; why are we here?
|
||||
{
|
||||
mo->momz = 0;
|
||||
|
|
@ -2422,7 +2353,6 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
#endif
|
||||
P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||
}
|
||||
#endif
|
||||
|
||||
// hit the floor
|
||||
if (mo->type == MT_FIREBALL) // special case for the fireball
|
||||
|
|
@ -2533,13 +2463,11 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
else
|
||||
mom.y -= FixedMul(6*FRACUNIT, mo->scale);
|
||||
}
|
||||
#ifdef ESLOPE
|
||||
else if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)
|
||||
{
|
||||
// Pop the object up a bit to encourage bounciness
|
||||
//mom.z = P_MobjFlip(mo)*mo->scale;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
mom.x = mom.y = mom.z = 0;
|
||||
|
|
@ -2585,11 +2513,9 @@ static boolean P_ZMovement(mobj_t *mo)
|
|||
|| tmfloorthing->flags2 & MF2_STANDONME || tmfloorthing->type == MT_PLAYER))
|
||||
mom.z = tmfloorthing->momz;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above.
|
||||
P_QuantizeMomentumToSlope(&mom, mo->standingslope);
|
||||
}
|
||||
#endif
|
||||
|
||||
mo->momx = mom.x;
|
||||
mo->momy = mom.y;
|
||||
|
|
@ -2708,7 +2634,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
|| mo->player->playerstate == PST_REBORN)
|
||||
return;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (mo->standingslope)
|
||||
{
|
||||
if (mo->flags & MF_NOCLIPHEIGHT)
|
||||
|
|
@ -2716,7 +2641,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
else if (!P_IsObjectOnGround(mo))
|
||||
P_SlopeLaunch(mo);
|
||||
}
|
||||
#endif
|
||||
|
||||
// clip movement
|
||||
if (P_IsObjectOnGround(mo) && !(mo->flags & MF_NOCLIPHEIGHT))
|
||||
|
|
@ -2745,19 +2669,15 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
&& mo->player->kartstuff[k_spinouttimer] == 0 && mo->player->kartstuff[k_squishedtimer] == 0) // SRB2kart
|
||||
P_SetPlayerMobjState(mo, S_KART_STILL1);
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) {
|
||||
// Handle landing on slope during Z movement
|
||||
P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) {
|
||||
// Handle landing on slope during Z movement
|
||||
P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (P_MobjFlip(mo)*mo->momz < 0) // falling
|
||||
{
|
||||
|
|
@ -2775,7 +2695,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
|
||||
if (mo->eflags & MFE_JUSTHITFLOOR)
|
||||
{
|
||||
#ifdef POLYOBJECTS
|
||||
// Check if we're on a polyobject
|
||||
// that triggers a linedef executor.
|
||||
msecnode_t *node;
|
||||
|
|
@ -2832,7 +2751,6 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (mo->health)
|
||||
|
|
@ -2987,7 +2905,6 @@ static boolean P_SceneryZMovement(mobj_t *mo)
|
|||
// set standingslope
|
||||
P_TryMove(mo, mo->x, mo->y, true);
|
||||
mo->momz = -mo->momz;
|
||||
#ifdef ESLOPE
|
||||
if (mo->standingslope)
|
||||
{
|
||||
if (mo->flags & MF_NOCLIPHEIGHT)
|
||||
|
|
@ -2995,7 +2912,6 @@ static boolean P_SceneryZMovement(mobj_t *mo)
|
|||
else if (!P_IsObjectOnGround(mo))
|
||||
P_SlopeLaunch(mo);
|
||||
}
|
||||
#endif
|
||||
S_StartSound(mo, mo->info->activesound);
|
||||
}
|
||||
break;
|
||||
|
|
@ -3164,13 +3080,11 @@ void P_MobjCheckWater(mobj_t *mobj)
|
|||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
|
||||
|
||||
if (*rover->b_slope)
|
||||
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
|
||||
#endif
|
||||
|
||||
if (mobj->eflags & MFE_VERTICALFLIP)
|
||||
{
|
||||
|
|
@ -3406,13 +3320,11 @@ static void P_SceneryCheckWater(mobj_t *mobj)
|
|||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
|
||||
|
||||
if (*rover->b_slope)
|
||||
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
|
||||
#endif
|
||||
|
||||
if (topheight <= mobj->z
|
||||
|| bottomheight > (mobj->z + FixedMul(mobj->info->height >> 1, mobj->scale)))
|
||||
|
|
@ -3458,13 +3370,9 @@ static boolean P_CameraCheckHeat(camera_t *thiscam)
|
|||
continue;
|
||||
|
||||
if (halfheight >= (
|
||||
#ifdef ESLOPE
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
|
||||
#endif
|
||||
*rover->topheight) || halfheight <= (
|
||||
#ifdef ESLOPE
|
||||
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
|
||||
#endif
|
||||
*rover->bottomheight))
|
||||
continue;
|
||||
|
||||
|
|
@ -3494,13 +3402,9 @@ static boolean P_CameraCheckWater(camera_t *thiscam)
|
|||
continue;
|
||||
|
||||
if (halfheight >= (
|
||||
#ifdef ESLOPE
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
|
||||
#endif
|
||||
*rover->topheight) || halfheight <= (
|
||||
#ifdef ESLOPE
|
||||
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
|
||||
#endif
|
||||
*rover->bottomheight))
|
||||
continue;
|
||||
|
||||
|
|
@ -3701,9 +3605,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
|||
|
||||
P_MobjCheckWater(mobj);
|
||||
|
||||
#ifdef ESLOPE
|
||||
P_ButteredSlope(mobj);
|
||||
#endif
|
||||
|
||||
// momentum movement
|
||||
mobj->eflags &= ~MFE_JUSTSTEPPEDDOWN;
|
||||
|
|
@ -3866,9 +3768,7 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
|
|||
else
|
||||
return;
|
||||
mobj->floorz =
|
||||
#ifdef ESLOPE
|
||||
mobjsecsubsec->f_slope ? P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) :
|
||||
#endif
|
||||
mobjsecsubsec->floorheight;
|
||||
if (mobjsecsubsec->ffloors)
|
||||
{
|
||||
|
|
@ -3884,11 +3784,9 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
|
|||
if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE))
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
|
||||
else
|
||||
#endif
|
||||
topheight = *rover->topheight;
|
||||
|
||||
if (topheight > mobj->floorz)
|
||||
|
|
@ -10395,7 +10293,6 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s
|
|||
mobj->eflags &= ~MFE_JUSTHITFLOOR;
|
||||
}
|
||||
|
||||
#ifdef ESLOPE // Sliding physics for slidey mobjs!
|
||||
if (mobj->type == MT_FLINGRING
|
||||
|| mobj->type == MT_FLINGCOIN
|
||||
|| P_WeaponOrPanel(mobj->type)
|
||||
|
|
@ -10410,7 +10307,6 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s
|
|||
//if (mobj->standingslope) CONS_Printf("slope physics on mobj\n");
|
||||
P_ButteredSlope(mobj);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (mobj->flags & (MF_ENEMY|MF_BOSS) && mobj->health
|
||||
&& P_CheckDeathPitCollide(mobj)) // extra pit check in case these didn't have momz
|
||||
|
|
@ -10800,14 +10696,10 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
|
|||
P_SetScale(mobj, mobj->destscale);
|
||||
|
||||
mobj->floorz =
|
||||
#ifdef ESLOPE
|
||||
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
|
||||
#endif
|
||||
mobj->subsector->sector->floorheight;
|
||||
mobj->ceilingz =
|
||||
#ifdef ESLOPE
|
||||
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
|
||||
#endif
|
||||
mobj->subsector->sector->ceilingheight;
|
||||
|
||||
// Tells MobjCheckWater that the water height was not set.
|
||||
|
|
@ -11199,14 +11091,10 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
|
|||
P_SetPrecipitationThingPosition(mobj);
|
||||
|
||||
mobj->floorz = starting_floorz =
|
||||
#ifdef ESLOPE
|
||||
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
|
||||
#endif
|
||||
mobj->subsector->sector->floorheight;
|
||||
mobj->ceilingz =
|
||||
#ifdef ESLOPE
|
||||
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
|
||||
#endif
|
||||
mobj->subsector->sector->ceilingheight;
|
||||
|
||||
mobj->z = z;
|
||||
|
|
@ -11729,9 +11617,7 @@ void P_RespawnSpecials(void)
|
|||
if (mthing->options & MTF_OBJECTFLIP)
|
||||
{
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
|
||||
#endif
|
||||
ss->sector->ceilingheight) - (mthing->options >> ZSHIFT) * FRACUNIT;
|
||||
if (mthing->options & MTF_AMBUSH
|
||||
&& (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i)))
|
||||
|
|
@ -11741,9 +11627,7 @@ void P_RespawnSpecials(void)
|
|||
else
|
||||
{
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
|
||||
#endif
|
||||
ss->sector->floorheight) + (mthing->options >> ZSHIFT) * FRACUNIT;
|
||||
if (mthing->options & MTF_AMBUSH
|
||||
&& (i == MT_RING || i == MT_REDTEAMRING || i == MT_BLUETEAMRING || i == MT_COIN || P_WeaponOrPanel(i)))
|
||||
|
|
@ -12013,14 +11897,10 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
|
|||
sector = R_PointInSubsector(x, y)->sector;
|
||||
|
||||
floor =
|
||||
#ifdef ESLOPE
|
||||
sector->f_slope ? P_GetZAt(sector->f_slope, x, y) :
|
||||
#endif
|
||||
sector->floorheight;
|
||||
ceiling =
|
||||
#ifdef ESLOPE
|
||||
sector->c_slope ? P_GetZAt(sector->c_slope, x, y) :
|
||||
#endif
|
||||
sector->ceilingheight;
|
||||
|
||||
if (mthing)
|
||||
|
|
@ -12095,14 +11975,10 @@ void P_MovePlayerToStarpost(INT32 playernum)
|
|||
sector = R_PointInSubsector(mobj->x, mobj->y)->sector;
|
||||
|
||||
floor =
|
||||
#ifdef ESLOPE
|
||||
sector->f_slope ? P_GetZAt(sector->f_slope, mobj->x, mobj->y) :
|
||||
#endif
|
||||
sector->floorheight;
|
||||
ceiling =
|
||||
#ifdef ESLOPE
|
||||
sector->c_slope ? P_GetZAt(sector->c_slope, mobj->x, mobj->y) :
|
||||
#endif
|
||||
sector->ceilingheight;
|
||||
|
||||
z = p->respawn.pointz;
|
||||
|
|
@ -12264,9 +12140,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
|||
|
||||
ss = R_PointInSubsector(mthing->x << FRACBITS, mthing->y << FRACBITS);
|
||||
mthing->z = (INT16)(((
|
||||
#ifdef ESLOPE
|
||||
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, mthing->x << FRACBITS, mthing->y << FRACBITS) :
|
||||
#endif
|
||||
ss->sector->floorheight)>>FRACBITS) + (mthing->options >> ZSHIFT));
|
||||
|
||||
if (numhuntemeralds < MAXHUNTEMERALDS)
|
||||
|
|
@ -12382,9 +12256,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
|||
|
||||
if (i == MT_NIGHTSBUMPER)
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
|
||||
#endif
|
||||
ss->sector->floorheight) + ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
else if (i == MT_AXIS || i == MT_AXISTRANSFER || i == MT_AXISTRANSFERLINE)
|
||||
z = ONFLOORZ;
|
||||
|
|
@ -12393,9 +12265,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
|||
if (mthing->options & MTF_OBJECTFLIP)
|
||||
{
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
|
||||
#endif
|
||||
ss->sector->ceilingheight);
|
||||
|
||||
if (mthing->options & MTF_AMBUSH) // Special flag for rings
|
||||
|
|
@ -12408,9 +12278,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
|||
else
|
||||
{
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
|
||||
#endif
|
||||
ss->sector->floorheight);
|
||||
|
||||
if (mthing->options & MTF_AMBUSH) // Special flag for rings
|
||||
|
|
@ -12452,15 +12320,11 @@ void P_SpawnMapThing(mapthing_t *mthing)
|
|||
// base positions
|
||||
if (flip)
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
ss->sector->c_slope ? P_GetZAt(ss->sector->c_slope, x, y) :
|
||||
#endif
|
||||
ss->sector->ceilingheight) - mobjinfo[i].height;
|
||||
else
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
ss->sector->f_slope ? P_GetZAt(ss->sector->f_slope, x, y) :
|
||||
#endif
|
||||
ss->sector->floorheight);
|
||||
|
||||
// offsetting
|
||||
|
|
@ -13133,9 +12997,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
//hoopcenter->flags |= MF_NOTHINK;
|
||||
|
||||
z +=
|
||||
#ifdef ESLOPE
|
||||
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||
#endif
|
||||
sec->floorheight;
|
||||
|
||||
hoopcenter->z = z - hoopcenter->height/2;
|
||||
|
|
@ -13276,9 +13138,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
hoopcenter->spawnpoint = mthing;
|
||||
|
||||
z +=
|
||||
#ifdef ESLOPE
|
||||
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||
#endif
|
||||
sec->floorheight;
|
||||
hoopcenter->z = z - hoopcenter->height/2;
|
||||
|
||||
|
|
@ -13396,9 +13256,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
else if (mthing->type == mobjinfo[MT_NIGHTSWING].doomednum)
|
||||
{
|
||||
z =
|
||||
#ifdef ESLOPE
|
||||
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||
#endif
|
||||
sec->floorheight;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
|
|
@ -13450,9 +13308,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
if (mthing->options & MTF_OBJECTFLIP)
|
||||
{
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
|
||||
#endif
|
||||
sec->ceilingheight) - mobjinfo[ringthing].height;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
|
|
@ -13460,9 +13316,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
else
|
||||
{
|
||||
z =
|
||||
#ifdef ESLOPE
|
||||
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||
#endif
|
||||
sec->floorheight;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
|
|
@ -13516,9 +13370,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
if (mthing->options & MTF_OBJECTFLIP)
|
||||
{
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
|
||||
#endif
|
||||
sec->ceilingheight) - mobjinfo[ringthing].height - dist*r;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
|
|
@ -13526,9 +13378,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
else
|
||||
{
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||
#endif
|
||||
sec->floorheight) + dist*r;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
|
|
@ -13574,9 +13424,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
if (mthing->options & MTF_OBJECTFLIP)
|
||||
{
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
|
||||
#endif
|
||||
sec->ceilingheight) - mobjinfo[ringthing].height - 64*FRACUNIT*r;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
|
|
@ -13584,9 +13432,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
else
|
||||
{
|
||||
z = (
|
||||
#ifdef ESLOPE
|
||||
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||
#endif
|
||||
sec->floorheight) + 64*FRACUNIT*r;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
|
|
@ -13619,9 +13465,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
|
|||
}
|
||||
|
||||
z =
|
||||
#ifdef ESLOPE
|
||||
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
|
||||
#endif
|
||||
sec->floorheight;
|
||||
if (mthing->options >> ZSHIFT)
|
||||
z += ((mthing->options >> ZSHIFT) << FRACBITS);
|
||||
|
|
|
|||
|
|
@ -396,11 +396,9 @@ typedef struct mobj_s
|
|||
INT32 cusval;
|
||||
INT32 cvmem;
|
||||
|
||||
#ifdef ESLOPE
|
||||
struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?)
|
||||
#ifdef HWRENDER
|
||||
struct pslope_s *modeltilt; // Slope used for model tilting. Also is not synched, this is totally visual.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
boolean colorized; // Whether the mobj uses the rainbow colormap
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "r_state.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
|
||||
/*
|
||||
Theory behind Polyobjects:
|
||||
|
|
@ -2867,6 +2866,5 @@ INT32 EV_DoPolyObjFlag(line_t *pfdata)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#endif // ifdef POLYOBJECTS
|
||||
|
||||
// EOF
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
#include "r_defs.h"
|
||||
|
||||
// haleyjd: temporary define
|
||||
#ifdef POLYOBJECTS
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
|
|
@ -303,7 +302,6 @@ extern polyobj_t *PolyObjects;
|
|||
extern INT32 numPolyObjects;
|
||||
extern polymaplink_t **polyblocklinks; // polyobject blockmap
|
||||
|
||||
#endif // ifdef POLYOBJECTS
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,7 @@
|
|||
#include "r_sky.h"
|
||||
#include "p_polyobj.h"
|
||||
#include "lua_script.h"
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h"
|
||||
#endif
|
||||
|
||||
// SRB2Kart
|
||||
#include "k_battle.h"
|
||||
|
|
@ -995,9 +993,7 @@ typedef enum
|
|||
MD2_WAYPOINTCAP = 1<<10,
|
||||
MD2_KITEMCAP = 1<<11,
|
||||
MD2_ITNEXT = 1<<12,
|
||||
#ifdef ESLOPE
|
||||
MD2_SLOPE = 1<<13,
|
||||
#endif
|
||||
MD2_SHADOWSCALE = 1<<14,
|
||||
MD2_DRAWFLAGS = 1<<15,
|
||||
} mobj_diff2_t;
|
||||
|
|
@ -1033,7 +1029,6 @@ typedef enum
|
|||
tc_noenemies,
|
||||
tc_eachtime,
|
||||
tc_disappear,
|
||||
#ifdef POLYOBJECTS
|
||||
tc_polyrotate, // haleyjd 03/26/06: polyobjects
|
||||
tc_polymove,
|
||||
tc_polywaypoint,
|
||||
|
|
@ -1041,7 +1036,6 @@ typedef enum
|
|||
tc_polyswingdoor,
|
||||
tc_polyflag,
|
||||
tc_polydisplace,
|
||||
#endif
|
||||
tc_end
|
||||
} specials_e;
|
||||
|
||||
|
|
@ -1192,10 +1186,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
diff2 |= MD2_HPREV;
|
||||
if (mobj->itnext)
|
||||
diff2 |= MD2_ITNEXT;
|
||||
#ifdef ESLOPE
|
||||
if (mobj->standingslope)
|
||||
diff2 |= MD2_SLOPE;
|
||||
#endif
|
||||
if (mobj->shadowscale)
|
||||
diff2 |= MD2_SHADOWSCALE;
|
||||
if (mobj->drawflags)
|
||||
|
|
@ -1323,10 +1315,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type)
|
|||
WRITEUINT32(save_p, mobj->hprev->mobjnum);
|
||||
if (diff2 & MD2_ITNEXT)
|
||||
WRITEUINT32(save_p, mobj->itnext->mobjnum);
|
||||
#ifdef ESLOPE
|
||||
if (diff2 & MD2_SLOPE)
|
||||
WRITEUINT16(save_p, mobj->standingslope->id);
|
||||
#endif
|
||||
if (diff2 & MD2_COLORIZED)
|
||||
WRITEUINT8(save_p, mobj->colorized);
|
||||
if (diff2 & MD2_SHADOWSCALE)
|
||||
|
|
@ -1623,7 +1613,6 @@ static void SaveDisappearThinker(const thinker_t *th, const UINT8 type)
|
|||
WRITEINT32(save_p, ht->exists);
|
||||
}
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
|
||||
//
|
||||
// SavePolyrotateThinker
|
||||
|
|
@ -1733,7 +1722,6 @@ static void SavePolydisplaceThinker(const thinker_t *th, const UINT8 type)
|
|||
WRITEFIXED(save_p, ht->oldHeights);
|
||||
}
|
||||
|
||||
#endif
|
||||
/*
|
||||
//
|
||||
// SaveWhatThinker
|
||||
|
|
@ -1913,7 +1901,6 @@ static void P_NetArchiveThinkers(void)
|
|||
SaveDisappearThinker(th, tc_disappear);
|
||||
continue;
|
||||
}
|
||||
#ifdef POLYOBJECTS
|
||||
else if (th->function.acp1 == (actionf_p1)T_PolyObjRotate)
|
||||
{
|
||||
SavePolyrotatetThinker(th, tc_polyrotate);
|
||||
|
|
@ -1949,7 +1936,6 @@ static void P_NetArchiveThinkers(void)
|
|||
SavePolydisplaceThinker(th, tc_polydisplace);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#ifdef PARANOIA
|
||||
else if (th->function.acv != P_RemoveThinkerDelayed) // wait garbage collection
|
||||
I_Error("unknown thinker type %p", th->function.acp1);
|
||||
|
|
@ -2258,7 +2244,6 @@ static void LoadMobjThinker(actionf_p1 thinker)
|
|||
mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p);
|
||||
if (diff2 & MD2_ITNEXT)
|
||||
mobj->itnext = (mobj_t *)(size_t)READUINT32(save_p);
|
||||
#ifdef ESLOPE
|
||||
if (diff2 & MD2_SLOPE)
|
||||
{
|
||||
mobj->standingslope = P_SlopeById(READUINT16(save_p));
|
||||
|
|
@ -2266,7 +2251,6 @@ static void LoadMobjThinker(actionf_p1 thinker)
|
|||
mobj->modeltilt = mobj->standingslope;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (diff2 & MD2_COLORIZED)
|
||||
mobj->colorized = READUINT8(save_p);
|
||||
if (diff2 & MD2_SHADOWSCALE)
|
||||
|
|
@ -2645,7 +2629,6 @@ static inline void LoadDisappearThinker(actionf_p1 thinker)
|
|||
P_AddThinker(&ht->thinker);
|
||||
}
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
|
||||
//
|
||||
// LoadPolyrotateThinker
|
||||
|
|
@ -2765,7 +2748,6 @@ static inline void LoadPolydisplaceThinker(actionf_p1 thinker)
|
|||
ht->oldHeights = READFIXED(save_p);
|
||||
P_AddThinker(&ht->thinker);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
//
|
||||
|
|
@ -2934,7 +2916,6 @@ static void P_NetUnArchiveThinkers(void)
|
|||
case tc_disappear:
|
||||
LoadDisappearThinker((actionf_p1)T_Disappear);
|
||||
break;
|
||||
#ifdef POLYOBJECTS
|
||||
case tc_polyrotate:
|
||||
LoadPolyrotatetThinker((actionf_p1)T_PolyObjRotate);
|
||||
break;
|
||||
|
|
@ -2962,7 +2943,6 @@ static void P_NetUnArchiveThinkers(void)
|
|||
case tc_polydisplace:
|
||||
LoadPolydisplaceThinker((actionf_p1)T_PolyObjDisplace);
|
||||
break;
|
||||
#endif
|
||||
case tc_scroll:
|
||||
LoadScrollThinker((actionf_p1)T_Scroll);
|
||||
break;
|
||||
|
|
@ -3003,7 +2983,6 @@ static void P_NetUnArchiveThinkers(void)
|
|||
//
|
||||
// haleyjd 03/26/06: PolyObject saving code
|
||||
//
|
||||
#ifdef POLYOBJECTS
|
||||
#define PD_FLAGS 0x01
|
||||
#define PD_TRANS 0x02
|
||||
|
||||
|
|
@ -3092,7 +3071,6 @@ static inline void P_UnArchivePolyObjects(void)
|
|||
for (i = 0; i < numSavedPolys; ++i)
|
||||
P_UnArchivePolyObj(&PolyObjects[i]);
|
||||
}
|
||||
#endif
|
||||
//
|
||||
// P_FinishMobjs
|
||||
//
|
||||
|
|
@ -3649,9 +3627,7 @@ void P_SaveNetGame(void)
|
|||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
P_NetArchiveWorld();
|
||||
#ifdef POLYOBJECTS
|
||||
P_ArchivePolyObjects();
|
||||
#endif
|
||||
P_NetArchiveThinkers();
|
||||
P_NetArchiveSpecials();
|
||||
P_NetArchiveWaypoints();
|
||||
|
|
@ -3694,9 +3670,7 @@ boolean P_LoadNetGame(void)
|
|||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
P_NetUnArchiveWorld();
|
||||
#ifdef POLYOBJECTS
|
||||
P_UnArchivePolyObjects();
|
||||
#endif
|
||||
P_NetUnArchiveThinkers();
|
||||
P_NetUnArchiveSpecials();
|
||||
P_NetUnArchiveWaypoints();
|
||||
|
|
|
|||
|
|
@ -78,9 +78,7 @@
|
|||
#include "hardware/hw_light.h"
|
||||
#endif
|
||||
|
||||
#ifdef ESLOPE
|
||||
#include "p_slopes.h"
|
||||
#endif
|
||||
|
||||
// SRB2Kart
|
||||
#include "k_kart.h"
|
||||
|
|
@ -1037,9 +1035,7 @@ static void P_LoadThings(void)
|
|||
|
||||
// Z for objects
|
||||
mt->z = (INT16)(
|
||||
#ifdef ESLOPE
|
||||
mtsector->f_slope ? P_GetZAt(mtsector->f_slope, mt->x << FRACBITS, mt->y << FRACBITS) :
|
||||
#endif
|
||||
mtsector->floorheight)>>FRACBITS;
|
||||
|
||||
if (mt->type == 1700 // MT_AXIS
|
||||
|
|
@ -1319,9 +1315,7 @@ static void P_LoadRawLineDefs(UINT8 *data, size_t i)
|
|||
if (ld->sidenum[1] != 0xffff && ld->special)
|
||||
sides[ld->sidenum[1]].special = ld->special;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
ld->polyobj = NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1449,8 +1443,6 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
{
|
||||
UINT16 i;
|
||||
INT32 num;
|
||||
size_t j;
|
||||
RGBA_t color;
|
||||
|
||||
for (i = 0; i < numsides; i++)
|
||||
{
|
||||
|
|
@ -1517,6 +1509,8 @@ static void P_LoadRawSideDefs2(void *data)
|
|||
|| (msd->bottomtexture[0] == '#' && msd->bottomtexture[1] && msd->bottomtexture[2] && msd->bottomtexture[3] && msd->bottomtexture[4] && msd->bottomtexture[5] && msd->bottomtexture[6]))
|
||||
{
|
||||
char *col;
|
||||
RGBA_t color;
|
||||
size_t j;
|
||||
|
||||
sec->midmap = R_CreateColormap(msd->toptexture, msd->midtexture,
|
||||
msd->bottomtexture);
|
||||
|
|
@ -1991,11 +1985,9 @@ static void P_CreateBlockMap(void)
|
|||
blocklinks = Z_Calloc(count, PU_LEVEL, NULL);
|
||||
blockmap = blockmaplump + 4;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 2/22/06: setup polyobject blockmap
|
||||
count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;
|
||||
polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2068,11 +2060,9 @@ static boolean P_LoadBlockMap(lumpnum_t lumpnum)
|
|||
blocklinks = Z_Calloc(count, PU_LEVEL, NULL);
|
||||
blockmap = blockmaplump+4;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 2/22/06: setup polyobject blockmap
|
||||
count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;
|
||||
polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
|
||||
#endif
|
||||
return true;
|
||||
/* Original
|
||||
blockmaplump = W_CacheLumpNum(lump, PU_LEVEL);
|
||||
|
|
@ -2134,11 +2124,9 @@ static boolean P_LoadRawBlockMap(UINT8 *data, size_t count, const char *lumpname
|
|||
blocklinks = Z_Calloc(count, PU_LEVEL, NULL);
|
||||
blockmap = blockmaplump+4;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 2/22/06: setup polyobject blockmap
|
||||
count = sizeof(*polyblocklinks) * bmapwidth * bmapheight;
|
||||
polyblocklinks = Z_Calloc(count, PU_LEVEL, NULL);
|
||||
#endif
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -3072,7 +3060,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
snprintf(tx, 63, "%s%s%s",
|
||||
mapheaderinfo[gamemap-1]->lvlttl,
|
||||
(strlen(mapheaderinfo[gamemap-1]->zonttl) > 0) ? va(" %s",mapheaderinfo[gamemap-1]->zonttl) : // SRB2kart
|
||||
((mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE"),
|
||||
((mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " Zone"),
|
||||
(strlen(mapheaderinfo[gamemap-1]->actnum) > 0) ? va(", Act %s",mapheaderinfo[gamemap-1]->actnum) : "");
|
||||
V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx);
|
||||
I_UpdateNoVsync();
|
||||
|
|
@ -3218,9 +3206,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
|||
// anything that P_ResetDynamicSlopes/P_LoadThings needs to know
|
||||
P_InitSpecials();
|
||||
|
||||
#ifdef ESLOPE
|
||||
P_ResetDynamicSlopes();
|
||||
#endif
|
||||
|
||||
P_LoadThings();
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,6 @@ static fixed_t P_InterceptVector2(divline_t *v2, divline_t *v1)
|
|||
return frac;
|
||||
}
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
|
||||
{
|
||||
size_t i;
|
||||
|
|
@ -169,7 +168,6 @@ static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// P_CrossSubsector
|
||||
|
|
@ -180,9 +178,7 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
|||
{
|
||||
seg_t *seg;
|
||||
INT32 count;
|
||||
#ifdef POLYOBJECTS
|
||||
polyobj_t *po; // haleyjd 02/23/06
|
||||
#endif
|
||||
|
||||
#ifdef RANGECHECK
|
||||
if (num >= numsubsectors)
|
||||
|
|
@ -192,7 +188,6 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
|||
// haleyjd 02/23/06: this assignment should be after the above check
|
||||
seg = segs + subsectors[num].firstline;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 02/23/06: check polyobject lines
|
||||
if ((po = subsectors[num].polyList))
|
||||
{
|
||||
|
|
@ -207,7 +202,6 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
|||
po = (polyobj_t *)(po->link.next);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (count = subsectors[num].numlines; --count >= 0; seg++) // check lines
|
||||
{
|
||||
|
|
@ -434,15 +428,10 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
|
|||
|
||||
// killough 11/98: shortcut for melee situations
|
||||
// same subsector? obviously visible
|
||||
#ifndef POLYOBJECTS
|
||||
if (t1->subsector == t2->subsector)
|
||||
return true;
|
||||
#else
|
||||
// haleyjd 02/23/06: can't do this if there are polyobjects in the subsec
|
||||
if (!t1->subsector->polyList &&
|
||||
t1->subsector == t2->subsector)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
// An unobstructed LOS is possible.
|
||||
// Now look from eyes of t1 to any part of t2.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include "w_wad.h"
|
||||
#include "k_kart.h" // K_PlayerEBrake
|
||||
|
||||
#ifdef ESLOPE
|
||||
|
||||
static pslope_t *slopelist = NULL;
|
||||
static UINT16 slopecount = 0;
|
||||
|
|
@ -628,7 +627,6 @@ void P_ResetDynamicSlopes(void) {
|
|||
size_t i;
|
||||
#ifdef ESLOPE_TYPESHIM // Rewrite old specials to new ones, and give a console warning
|
||||
boolean warned = false;
|
||||
#endif
|
||||
|
||||
slopelist = NULL;
|
||||
slopecount = 0;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
#ifndef P_SLOPES_H__
|
||||
#define P_SLOPES_H__
|
||||
|
||||
#ifdef ESLOPE
|
||||
void P_CalculateSlopeNormal(pslope_t *slope);
|
||||
void P_ResetDynamicSlopes(void);
|
||||
void P_RunDynamicSlopes(void);
|
||||
|
|
@ -41,7 +40,6 @@ void P_SlopeLaunch(mobj_t *mo);
|
|||
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope);
|
||||
void P_ButteredSlope(mobj_t *mo);
|
||||
|
||||
#endif
|
||||
|
||||
// EOF
|
||||
#endif // #ifdef ESLOPE
|
||||
|
|
|
|||
16
src/p_spec.c
16
src/p_spec.c
|
|
@ -1243,7 +1243,6 @@ INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start)
|
|||
}
|
||||
|
||||
// haleyjd: temporary define
|
||||
#ifdef POLYOBJECTS
|
||||
|
||||
//
|
||||
// PolyDoor
|
||||
|
|
@ -1452,7 +1451,6 @@ static boolean PolyDisplace(line_t *line)
|
|||
return EV_DoPolyObjDisplace(&pdd);
|
||||
}
|
||||
|
||||
#endif // ifdef POLYOBJECTS
|
||||
|
||||
/** Changes a sector's tag.
|
||||
* Used by the linedef executor tag changer and by crumblers.
|
||||
|
|
@ -3217,7 +3215,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
case 480: // Polyobj_DoorSlide
|
||||
case 481: // Polyobj_DoorSwing
|
||||
PolyDoor(line);
|
||||
|
|
@ -3244,7 +3241,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
case 491:
|
||||
PolyTranslucency(line);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
|
|
@ -5046,10 +5042,8 @@ void P_UpdateSpecials(void)
|
|||
// POINT LIMIT
|
||||
P_CheckPointLimit();
|
||||
|
||||
#ifdef ESLOPE
|
||||
// Dynamic slopeness
|
||||
P_RunDynamicSlopes();
|
||||
#endif
|
||||
|
||||
// ANIMATE TEXTURES
|
||||
for (anim = anims; anim < lastanim; anim++)
|
||||
|
|
@ -5194,11 +5188,9 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
|||
ffloor->topyoffs = &sec2->ceiling_yoffs;
|
||||
ffloor->topangle = &sec2->ceilingpic_angle;
|
||||
|
||||
#ifdef ESLOPE
|
||||
// Add slopes
|
||||
ffloor->t_slope = &sec2->c_slope;
|
||||
ffloor->b_slope = &sec2->f_slope;
|
||||
#endif
|
||||
|
||||
if ((flags & FF_SOLID) && (master->flags & ML_EFFECT1)) // Block player only
|
||||
flags &= ~FF_BLOCKOTHERS;
|
||||
|
|
@ -5711,15 +5703,11 @@ void T_LaserFlash(laserthink_t *flash)
|
|||
|
||||
sourcesec = ffloor->master->frontsector; // Less to type!
|
||||
|
||||
#ifdef ESLOPE
|
||||
top = (*ffloor->t_slope) ? P_GetZAt(*ffloor->t_slope, sector->soundorg.x, sector->soundorg.y)
|
||||
: *ffloor->topheight;
|
||||
bottom = (*ffloor->b_slope) ? P_GetZAt(*ffloor->b_slope, sector->soundorg.x, sector->soundorg.y)
|
||||
: *ffloor->bottomheight;
|
||||
sector->soundorg.z = (top + bottom)/2;
|
||||
#else
|
||||
sector->soundorg.z = (*ffloor->topheight + *ffloor->bottomheight)/2;
|
||||
#endif
|
||||
S_StartSound(§or->soundorg, sfx_laser);
|
||||
|
||||
// Seek out objects to DESTROY! MUAHAHHAHAHAA!!!*cough*
|
||||
|
|
@ -6857,7 +6845,6 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
|||
|
||||
Z_Free(secthinkers);
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 02/20/06: spawn polyobjects
|
||||
Polyobj_InitLevel();
|
||||
|
||||
|
|
@ -6874,7 +6861,6 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
P_RunLevelLoadExecutors();
|
||||
}
|
||||
|
|
@ -7427,11 +7413,9 @@ void T_Disappear(disappear_t *d)
|
|||
|
||||
if (!(lines[d->sourceline].flags & ML_NOCLIMB))
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
if (*rover->t_slope)
|
||||
sectors[s].soundorg.z = P_GetZAt(*rover->t_slope, sectors[s].soundorg.x, sectors[s].soundorg.y);
|
||||
else
|
||||
#endif
|
||||
sectors[s].soundorg.z = *rover->topheight;
|
||||
S_StartSound(§ors[s].soundorg, sfx_appear);
|
||||
}
|
||||
|
|
|
|||
92
src/p_user.c
92
src/p_user.c
|
|
@ -1799,13 +1799,8 @@ boolean P_InSpaceSector(mobj_t *mo) // Returns true if you are in space
|
|||
|
||||
if (GETSECSPECIAL(rover->master->frontsector->special, 1) != SPACESPECIAL)
|
||||
continue;
|
||||
#ifdef ESLOPE
|
||||
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight;
|
||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight;
|
||||
#else
|
||||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
#endif
|
||||
|
||||
if (mo->z + (mo->height/2) > topheight)
|
||||
continue;
|
||||
|
|
@ -1839,13 +1834,8 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
|
|||
if (!(rover->flags & FF_QUICKSAND))
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : *rover->topheight;
|
||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : *rover->bottomheight;
|
||||
#else
|
||||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
#endif
|
||||
|
||||
if (mo->z + flipoffset > topheight)
|
||||
continue;
|
||||
|
|
@ -1984,9 +1974,7 @@ static void P_CheckBouncySectors(player_t *player)
|
|||
fixed_t oldx;
|
||||
fixed_t oldy;
|
||||
fixed_t oldz;
|
||||
#ifdef ESLOPE
|
||||
vector3_t momentum;
|
||||
#endif
|
||||
|
||||
oldx = player->mo->x;
|
||||
oldy = player->mo->y;
|
||||
|
|
@ -2041,7 +2029,6 @@ static void P_CheckBouncySectors(player_t *player)
|
|||
{
|
||||
fixed_t newmom;
|
||||
|
||||
#ifdef ESLOPE
|
||||
pslope_t *slope;
|
||||
if (abs(oldz - topheight) < abs(oldz + player->mo->height - bottomheight)) { // Hit top
|
||||
slope = *rover->t_slope;
|
||||
|
|
@ -2057,9 +2044,6 @@ static void P_CheckBouncySectors(player_t *player)
|
|||
P_ReverseQuantizeMomentumToSlope(&momentum, slope);
|
||||
|
||||
newmom = momentum.z = -FixedMul(momentum.z,linedist)/2;
|
||||
#else
|
||||
newmom = -FixedMul(player->mo->momz,linedist);
|
||||
#endif
|
||||
|
||||
if (abs(newmom) < (linedist*2))
|
||||
{
|
||||
|
|
@ -2082,7 +2066,6 @@ static void P_CheckBouncySectors(player_t *player)
|
|||
else if (newmom < -P_GetPlayerHeight(player)/2)
|
||||
newmom = -P_GetPlayerHeight(player)/2;
|
||||
|
||||
#ifdef ESLOPE
|
||||
momentum.z = newmom*2;
|
||||
|
||||
if (slope)
|
||||
|
|
@ -2091,9 +2074,6 @@ static void P_CheckBouncySectors(player_t *player)
|
|||
player->mo->momx = momentum.x;
|
||||
player->mo->momy = momentum.y;
|
||||
player->mo->momz = momentum.z/2;
|
||||
#else
|
||||
player->mo->momz = newmom;
|
||||
#endif
|
||||
|
||||
if (player->pflags & PF_SPINNING)
|
||||
{
|
||||
|
|
@ -2150,13 +2130,8 @@ static void P_CheckQuicksand(player_t *player)
|
|||
if (!(rover->flags & FF_QUICKSAND))
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
|
||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||
#else
|
||||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
#endif
|
||||
|
||||
if (topheight >= player->mo->z && bottomheight < player->mo->z + player->mo->height)
|
||||
{
|
||||
|
|
@ -2524,15 +2499,10 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
|
|||
floorclimb = true;
|
||||
else
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
floorheight = glidesector->sector->f_slope ? P_GetZAt(glidesector->sector->f_slope, player->mo->x, player->mo->y)
|
||||
: glidesector->sector->floorheight;
|
||||
ceilingheight = glidesector->sector->c_slope ? P_GetZAt(glidesector->sector->c_slope, player->mo->x, player->mo->y)
|
||||
: glidesector->sector->ceilingheight;
|
||||
#else
|
||||
floorheight = glidesector->sector->floorheight;
|
||||
ceilingheight = glidesector->sector->ceilingheight;
|
||||
#endif
|
||||
|
||||
if (glidesector->sector->ffloors)
|
||||
{
|
||||
|
|
@ -2546,13 +2516,8 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
|
|||
|
||||
floorclimb = true;
|
||||
|
||||
#ifdef ESLOPE
|
||||
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
|
||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||
#else
|
||||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
#endif
|
||||
|
||||
// Only supports rovers that are moving like an 'elevator', not just the top or bottom.
|
||||
if (rover->master->frontsector->floorspeed && rover->master->frontsector->ceilspeed == 42)
|
||||
|
|
@ -2593,11 +2558,7 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
|
|||
if (roverbelow == rover)
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
bottomheight2 = *roverbelow->b_slope ? P_GetZAt(*roverbelow->b_slope, player->mo->x, player->mo->y) : *roverbelow->bottomheight;
|
||||
#else
|
||||
bottomheight2 = *roverbelow->bottomheight;
|
||||
#endif
|
||||
|
||||
if (bottomheight2 < topheight + FixedMul(16*FRACUNIT, player->mo->scale))
|
||||
foundfof = true;
|
||||
|
|
@ -2643,11 +2604,7 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
|
|||
if (roverbelow == rover)
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
topheight2 = *roverbelow->t_slope ? P_GetZAt(*roverbelow->t_slope, player->mo->x, player->mo->y) : *roverbelow->topheight;
|
||||
#else
|
||||
topheight2 = *roverbelow->topheight;
|
||||
#endif
|
||||
|
||||
if (topheight2 > bottomheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
||||
foundfof = true;
|
||||
|
|
@ -2702,11 +2659,7 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
|
|||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||
#else
|
||||
bottomheight = *rover->bottomheight;
|
||||
#endif
|
||||
|
||||
if (bottomheight < floorheight + FixedMul(16*FRACUNIT, player->mo->scale))
|
||||
{
|
||||
|
|
@ -2747,11 +2700,7 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
|
|||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_BLOCKPLAYER) || (rover->flags & FF_BUSTUP))
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
|
||||
#else
|
||||
topheight = *rover->topheight;
|
||||
#endif
|
||||
|
||||
if (topheight > ceilingheight - FixedMul(16*FRACUNIT, player->mo->scale))
|
||||
{
|
||||
|
|
@ -3120,12 +3069,10 @@ static void P_DoTeeter(player_t *player) // SRB2kart - unused.
|
|||
|
||||
ceilingheight = sec->ceilingheight;
|
||||
floorheight = sec->floorheight;
|
||||
#ifdef ESLOPE
|
||||
if (sec->c_slope)
|
||||
ceilingheight = P_GetZAt(sec->c_slope, checkx, checky);
|
||||
if (sec->f_slope)
|
||||
floorheight = P_GetZAt(sec->f_slope, checkx, checky);
|
||||
#endif
|
||||
highestceilingheight = (ceilingheight > highestceilingheight) ? ceilingheight : highestceilingheight;
|
||||
lowestfloorheight = (floorheight < lowestfloorheight) ? floorheight : lowestfloorheight;
|
||||
|
||||
|
|
@ -3136,13 +3083,8 @@ static void P_DoTeeter(player_t *player) // SRB2kart - unused.
|
|||
{
|
||||
if (!(rover->flags & FF_EXISTS)) continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
|
||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||
#else
|
||||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
#endif
|
||||
|
||||
if (P_CheckSolidLava(player->mo, rover))
|
||||
;
|
||||
|
|
@ -3214,7 +3156,6 @@ static void P_DoTeeter(player_t *player) // SRB2kart - unused.
|
|||
BMBOUNDFIX(xl, xh, yl, yh);
|
||||
|
||||
// Polyobjects
|
||||
#ifdef POLYOBJECTS
|
||||
validcount++;
|
||||
|
||||
for (by = yl; by <= yh; by++)
|
||||
|
|
@ -3308,7 +3249,6 @@ static void P_DoTeeter(player_t *player) // SRB2kart - unused.
|
|||
plink = (polymaplink_t *)(plink->link.next);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (teeter) // only bother with objects as a last resort if you were already teetering
|
||||
{
|
||||
mobj_t *oldtmthing = tmthing;
|
||||
|
|
@ -3601,9 +3541,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) // SRB2kart - unused.
|
|||
&& !P_PlayerInPain(player)) // subsequent revs
|
||||
{
|
||||
if ((cmd->buttons & BT_BRAKE) && player->speed < FixedMul(5<<FRACBITS, player->mo->scale) && !player->mo->momz && onground && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING)
|
||||
#ifdef ESLOPE
|
||||
&& (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
player->mo->momx = player->cmomx;
|
||||
|
|
@ -3634,9 +3572,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) // SRB2kart - unused.
|
|||
// AKA Just go into a spin on the ground, you idiot. ;)
|
||||
else if ((cmd->buttons & BT_BRAKE || ((twodlevel || (player->mo->flags2 & MF2_TWOD)) && cmd->forwardmove < -20))
|
||||
&& !player->climbing && !player->mo->momz && onground && (player->speed > FixedMul(5<<FRACBITS, player->mo->scale)
|
||||
#ifdef ESLOPE
|
||||
|| (player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) >= FRACUNIT/2)
|
||||
#endif
|
||||
) && !(player->pflags & PF_USEDOWN) && !(player->pflags & PF_SPINNING))
|
||||
{
|
||||
player->pflags |= PF_SPINNING;
|
||||
|
|
@ -3650,9 +3586,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd) // SRB2kart - unused.
|
|||
// Rolling normally
|
||||
if (onground && player->pflags & PF_SPINNING && !(player->pflags & PF_STARTDASH)
|
||||
&& player->speed < FixedMul(5*FRACUNIT,player->mo->scale)
|
||||
#ifdef ESLOPE
|
||||
&& (!player->mo->standingslope || (player->mo->standingslope->flags & SL_NOPHYSICS) || abs(player->mo->standingslope->zdelta) < FRACUNIT/2)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
if (GETSECSPECIAL(player->mo->subsector->sector->special, 4) == 7 || (player->mo->ceilingz - player->mo->floorz < P_GetPlayerHeight(player)))
|
||||
|
|
@ -3878,9 +3812,7 @@ static void P_2dMovement(player_t *player)
|
|||
else if (player->onconveyor == 4 && !P_IsObjectOnGround(player->mo)) // Actual conveyor belt
|
||||
player->cmomx = player->cmomy = 0;
|
||||
else if (player->onconveyor != 2 && player->onconveyor != 4
|
||||
#ifdef POLYOBJECTS
|
||||
&& player->onconveyor != 1
|
||||
#endif
|
||||
)
|
||||
player->cmomx = player->cmomy = 0;
|
||||
|
||||
|
|
@ -4027,12 +3959,10 @@ static void P_3dMovement(player_t *player)
|
|||
//boolean dangleflip = false; // SRB2kart - toaster
|
||||
//fixed_t normalspd = FixedMul(player->normalspeed, player->mo->scale);
|
||||
fixed_t oldMagnitude, newMagnitude;
|
||||
#ifdef ESLOPE
|
||||
vector3_t totalthrust;
|
||||
|
||||
totalthrust.x = totalthrust.y = 0; // I forget if this is needed
|
||||
totalthrust.z = FRACUNIT*P_MobjFlip(player->mo)/3; // A bit of extra push-back on slopes
|
||||
#endif // ESLOPE
|
||||
|
||||
// Get the old momentum; this will be needed at the end of the function! -SH
|
||||
oldMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
|
||||
|
|
@ -4056,9 +3986,7 @@ static void P_3dMovement(player_t *player)
|
|||
else if (player->onconveyor == 4 && !P_IsObjectOnGround(player->mo)) // Actual conveyor belt
|
||||
player->cmomx = player->cmomy = 0;
|
||||
else if (player->onconveyor != 2 && player->onconveyor != 4
|
||||
#ifdef POLYOBJECTS
|
||||
&& player->onconveyor != 1
|
||||
#endif
|
||||
)
|
||||
player->cmomx = player->cmomy = 0;
|
||||
|
||||
|
|
@ -5580,14 +5508,12 @@ void P_ElementalFireTrail(player_t *player)
|
|||
{
|
||||
newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale));
|
||||
newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale));
|
||||
#ifdef ESLOPE
|
||||
if (player->mo->standingslope)
|
||||
{
|
||||
ground = P_GetZAt(player->mo->standingslope, newx, newy);
|
||||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
ground -= FixedMul(mobjinfo[MT_SPINFIRE].height, player->mo->scale);
|
||||
}
|
||||
#endif
|
||||
flame = P_SpawnMobj(newx, newy, ground, MT_SPINFIRE);
|
||||
P_SetTarget(&flame->target, player->mo);
|
||||
flame->angle = travelangle;
|
||||
|
|
@ -7860,7 +7786,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// Check polyobjects and see if floorz/ceilingz need to be altered
|
||||
{
|
||||
INT32 xl, xh, yl, yh, bx, by;
|
||||
|
|
@ -7939,7 +7864,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// crushed camera
|
||||
if (myceilingz <= myfloorz + thiscam->height && !resetcalled && !cameranoclip)
|
||||
|
|
@ -8228,13 +8152,8 @@ static void P_CalcPostImg(player_t *player)
|
|||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
|
||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||
#else
|
||||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
#endif
|
||||
|
||||
if (pviewheight >= topheight || pviewheight <= bottomheight)
|
||||
continue;
|
||||
|
|
@ -8256,13 +8175,8 @@ static void P_CalcPostImg(player_t *player)
|
|||
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKPLAYER)
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
topheight = *rover->t_slope ? P_GetZAt(*rover->t_slope, player->mo->x, player->mo->y) : *rover->topheight;
|
||||
bottomheight = *rover->b_slope ? P_GetZAt(*rover->b_slope, player->mo->x, player->mo->y) : *rover->bottomheight;
|
||||
#else
|
||||
topheight = *rover->topheight;
|
||||
bottomheight = *rover->bottomheight;
|
||||
#endif
|
||||
|
||||
if (pviewheight >= topheight || pviewheight <= bottomheight)
|
||||
continue;
|
||||
|
|
@ -8794,9 +8708,7 @@ void P_PlayerThink(player_t *player)
|
|||
P_MobjCheckWater(player->mo);
|
||||
|
||||
#ifndef SECTORSPECIALSAFTERTHINK
|
||||
#ifdef POLYOBJECTS
|
||||
if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo))
|
||||
#endif
|
||||
player->onconveyor = 0;
|
||||
// check special sectors : damage & secrets
|
||||
|
||||
|
|
@ -8933,10 +8845,8 @@ void P_PlayerThink(player_t *player)
|
|||
// it lasts for one tic.
|
||||
player->pflags &= ~PF_FULLSTASIS;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
if (player->onconveyor == 1)
|
||||
player->cmomy = player->cmomx = 0;
|
||||
#endif
|
||||
|
||||
//P_DoSuperStuff(player);
|
||||
//P_CheckSneakerAndLivesTimer(player);
|
||||
|
|
@ -9182,9 +9092,7 @@ void P_PlayerAfterThink(player_t *player)
|
|||
cmd = &player->cmd;
|
||||
|
||||
#ifdef SECTORSPECIALSAFTERTHINK
|
||||
#ifdef POLYOBJECTS
|
||||
if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo))
|
||||
#endif
|
||||
player->onconveyor = 0;
|
||||
// check special sectors : damage & secrets
|
||||
|
||||
|
|
|
|||
88
src/r_bsp.c
88
src/r_bsp.c
|
|
@ -381,15 +381,11 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
|
|||
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back)
|
||||
{
|
||||
return (
|
||||
#ifdef POLYOBJECTS
|
||||
!line->polyseg &&
|
||||
#endif
|
||||
back->ceilingpic == front->ceilingpic
|
||||
&& back->floorpic == front->floorpic
|
||||
#ifdef ESLOPE
|
||||
&& back->f_slope == front->f_slope
|
||||
&& back->c_slope == front->c_slope
|
||||
#endif
|
||||
&& back->lightlevel == front->lightlevel
|
||||
&& !line->sidedef->midtexture
|
||||
// Check offsets too!
|
||||
|
|
@ -504,7 +500,6 @@ static void R_AddLine(seg_t *line)
|
|||
doorclosed = 0;
|
||||
|
||||
// Closed door.
|
||||
#ifdef ESLOPE
|
||||
if (frontsector->f_slope || frontsector->c_slope || backsector->f_slope || backsector->c_slope)
|
||||
{
|
||||
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||
|
|
@ -547,7 +542,6 @@ static void R_AddLine(seg_t *line)
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (viewsector != backsector && viewsector != frontsector)
|
||||
{
|
||||
|
|
@ -664,7 +658,6 @@ static boolean R_CheckBBox(const fixed_t *bspcoord)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
|
||||
size_t numpolys; // number of polyobjects in current subsector
|
||||
size_t num_po_ptrs; // number of polyobject pointers allocated
|
||||
|
|
@ -829,7 +822,6 @@ static void R_AddPolyObjects(subsector_t *sub)
|
|||
R_AddLine(po_ptrs[i]->segs[j]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// R_Subsector
|
||||
|
|
@ -870,15 +862,11 @@ static void R_Subsector(size_t num)
|
|||
floorcolormap = ceilingcolormap = frontsector->extra_colormap;
|
||||
|
||||
floorcenterz =
|
||||
#ifdef ESLOPE
|
||||
frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
|
||||
#endif
|
||||
frontsector->floorheight;
|
||||
|
||||
ceilingcenterz =
|
||||
#ifdef ESLOPE
|
||||
frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
|
||||
#endif
|
||||
frontsector->ceilingheight;
|
||||
|
||||
// Check and prep all 3D floors. Set the sector floor/ceiling light levels and colormaps.
|
||||
|
|
@ -909,29 +897,21 @@ static void R_Subsector(size_t num)
|
|||
R_PlaneLightOverride(frontsector, true, &ceilinglightlevel);
|
||||
|
||||
if (((
|
||||
#ifdef ESLOPE
|
||||
frontsector->f_slope ? P_GetZAt(frontsector->f_slope, viewx, viewy) :
|
||||
#endif
|
||||
frontsector->floorheight) < viewz || (frontsector->heightsec != -1
|
||||
&& sectors[frontsector->heightsec].ceilingpic == skyflatnum)))
|
||||
{
|
||||
floorplane = R_FindPlane(frontsector->floorheight, frontsector->floorpic, floorlightlevel,
|
||||
frontsector->floor_xoffs, frontsector->floor_yoffs, frontsector->floorpic_angle, floorcolormap, NULL
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
, NULL
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
, frontsector->f_slope
|
||||
#endif
|
||||
, R_NoEncore(frontsector, false));
|
||||
}
|
||||
else
|
||||
floorplane = NULL;
|
||||
|
||||
if (((
|
||||
#ifdef ESLOPE
|
||||
frontsector->c_slope ? P_GetZAt(frontsector->c_slope, viewx, viewy) :
|
||||
#endif
|
||||
frontsector->ceilingheight) > viewz || frontsector->ceilingpic == skyflatnum
|
||||
|| (frontsector->heightsec != -1
|
||||
&& sectors[frontsector->heightsec].floorpic == skyflatnum)))
|
||||
|
|
@ -939,21 +919,15 @@ static void R_Subsector(size_t num)
|
|||
ceilingplane = R_FindPlane(frontsector->ceilingheight, frontsector->ceilingpic, ceilinglightlevel,
|
||||
frontsector->ceiling_xoffs, frontsector->ceiling_yoffs, frontsector->ceilingpic_angle,
|
||||
ceilingcolormap, NULL
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
, NULL
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
, frontsector->c_slope
|
||||
#endif
|
||||
, R_NoEncore(frontsector, true));
|
||||
}
|
||||
else
|
||||
ceilingplane = NULL;
|
||||
|
||||
numffloors = 0;
|
||||
#ifdef ESLOPE
|
||||
ffloor[numffloors].slope = NULL;
|
||||
#endif
|
||||
ffloor[numffloors].plane = NULL;
|
||||
ffloor[numffloors].polyobj = NULL;
|
||||
if (frontsector->ffloors)
|
||||
|
|
@ -979,15 +953,11 @@ static void R_Subsector(size_t num)
|
|||
ffloor[numffloors].polyobj = NULL;
|
||||
|
||||
heightcheck =
|
||||
#ifdef ESLOPE
|
||||
*rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) :
|
||||
#endif
|
||||
*rover->bottomheight;
|
||||
|
||||
planecenterz =
|
||||
#ifdef ESLOPE
|
||||
*rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
|
||||
#endif
|
||||
*rover->bottomheight;
|
||||
if (planecenterz <= ceilingcenterz
|
||||
&& planecenterz >= floorcenterz
|
||||
|
|
@ -1000,21 +970,15 @@ static void R_Subsector(size_t num)
|
|||
ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic,
|
||||
*frontsector->lightlist[light].lightlevel, *rover->bottomxoffs,
|
||||
*rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
, NULL
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
, *rover->b_slope
|
||||
#endif
|
||||
, R_NoEncore(rover->master->frontsector, true));
|
||||
|
||||
#ifdef ESLOPE
|
||||
ffloor[numffloors].slope = *rover->b_slope;
|
||||
|
||||
// Tell the renderer this sector has slopes in it.
|
||||
if (ffloor[numffloors].slope)
|
||||
frontsector->hasslope = true;
|
||||
#endif
|
||||
|
||||
ffloor[numffloors].height = heightcheck;
|
||||
ffloor[numffloors].ffloor = rover;
|
||||
|
|
@ -1026,15 +990,11 @@ static void R_Subsector(size_t num)
|
|||
ffloor[numffloors].polyobj = NULL;
|
||||
|
||||
heightcheck =
|
||||
#ifdef ESLOPE
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) :
|
||||
#endif
|
||||
*rover->topheight;
|
||||
|
||||
planecenterz =
|
||||
#ifdef ESLOPE
|
||||
*rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) :
|
||||
#endif
|
||||
*rover->topheight;
|
||||
if (planecenterz >= floorcenterz
|
||||
&& planecenterz <= ceilingcenterz
|
||||
|
|
@ -1046,21 +1006,15 @@ static void R_Subsector(size_t num)
|
|||
ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic,
|
||||
*frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle,
|
||||
frontsector->lightlist[light].extra_colormap, rover
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
, NULL
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
, *rover->t_slope
|
||||
#endif
|
||||
, R_NoEncore(rover->master->frontsector, false));
|
||||
|
||||
#ifdef ESLOPE
|
||||
ffloor[numffloors].slope = *rover->t_slope;
|
||||
|
||||
// Tell the renderer this sector has slopes in it.
|
||||
if (ffloor[numffloors].slope)
|
||||
frontsector->hasslope = true;
|
||||
#endif
|
||||
|
||||
ffloor[numffloors].height = heightcheck;
|
||||
ffloor[numffloors].ffloor = rover;
|
||||
|
|
@ -1069,7 +1023,6 @@ static void R_Subsector(size_t num)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
// Polyobjects have planes, too!
|
||||
if (sub->polyList)
|
||||
{
|
||||
|
|
@ -1099,16 +1052,12 @@ static void R_Subsector(size_t num)
|
|||
polysec->lightlevel, polysec->floor_xoffs, polysec->floor_yoffs,
|
||||
polysec->floorpic_angle-po->angle,
|
||||
NULL, NULL, po
|
||||
#ifdef ESLOPE
|
||||
, NULL // will ffloors be slopable eventually?
|
||||
#endif
|
||||
, R_NoEncore(polysec, false));
|
||||
|
||||
ffloor[numffloors].height = polysec->floorheight;
|
||||
ffloor[numffloors].polyobj = po;
|
||||
#ifdef ESLOPE
|
||||
ffloor[numffloors].slope = NULL;
|
||||
#endif
|
||||
// ffloor[numffloors].ffloor = rover;
|
||||
po->visplane = ffloor[numffloors].plane;
|
||||
numffloors++;
|
||||
|
|
@ -1128,16 +1077,12 @@ static void R_Subsector(size_t num)
|
|||
polysec->lightlevel, polysec->ceiling_xoffs, polysec->ceiling_yoffs,
|
||||
polysec->ceilingpic_angle-po->angle,
|
||||
NULL, NULL, po
|
||||
#ifdef ESLOPE
|
||||
, NULL // will ffloors be slopable eventually?
|
||||
#endif
|
||||
, R_NoEncore(polysec, true));
|
||||
|
||||
ffloor[numffloors].polyobj = po;
|
||||
ffloor[numffloors].height = polysec->ceilingheight;
|
||||
#ifdef ESLOPE
|
||||
ffloor[numffloors].slope = NULL;
|
||||
#endif
|
||||
// ffloor[numffloors].ffloor = rover;
|
||||
po->visplane = ffloor[numffloors].plane;
|
||||
numffloors++;
|
||||
|
|
@ -1146,7 +1091,6 @@ static void R_Subsector(size_t num)
|
|||
po = (polyobj_t *)(po->link.next);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FLOORSPLATS
|
||||
if (sub->splats)
|
||||
|
|
@ -1169,18 +1113,14 @@ static void R_Subsector(size_t num)
|
|||
|
||||
firstseg = NULL;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
// haleyjd 02/19/06: draw polyobjects before static lines
|
||||
if (sub->polyList)
|
||||
R_AddPolyObjects(sub);
|
||||
#endif
|
||||
|
||||
while (count--)
|
||||
{
|
||||
// CONS_Debug(DBG_GAMELOGIC, "Adding normal line %d...(%d)\n", line->linedef-lines, leveltime);
|
||||
#ifdef POLYOBJECTS
|
||||
if (!line->polyseg) // ignore segs that belong to polyobjects
|
||||
#endif
|
||||
R_AddLine(line);
|
||||
line++;
|
||||
curline = NULL; /* cph 2001/11/18 - must clear curline now we're done with it, so stuff doesn't try using it for other things */
|
||||
|
|
@ -1199,11 +1139,9 @@ void R_Prep3DFloors(sector_t *sector)
|
|||
fixed_t bestheight, maxheight;
|
||||
INT32 count, i, mapnum;
|
||||
sector_t *sec;
|
||||
#ifdef ESLOPE
|
||||
pslope_t *bestslope = NULL;
|
||||
fixed_t heighttest; // I think it's better to check the Z height at the sector's center
|
||||
// than assume unsloped heights are accurate indicators of order in sloped sectors. -Red
|
||||
#endif
|
||||
|
||||
count = 1;
|
||||
for (rover = sector->ffloors; rover; rover = rover->next)
|
||||
|
|
@ -1226,14 +1164,10 @@ void R_Prep3DFloors(sector_t *sector)
|
|||
else
|
||||
memset(sector->lightlist, 0, sizeof (lightlist_t) * count);
|
||||
|
||||
#ifdef ESLOPE
|
||||
heighttest = sector->c_slope ? P_GetZAt(sector->c_slope, sector->soundorg.x, sector->soundorg.y) : sector->ceilingheight;
|
||||
|
||||
sector->lightlist[0].height = heighttest + 1;
|
||||
sector->lightlist[0].slope = sector->c_slope;
|
||||
#else
|
||||
sector->lightlist[0].height = sector->ceilingheight + 1;
|
||||
#endif
|
||||
sector->lightlist[0].lightlevel = §or->lightlevel;
|
||||
sector->lightlist[0].caster = NULL;
|
||||
sector->lightlist[0].extra_colormap = sector->extra_colormap;
|
||||
|
|
@ -1251,7 +1185,6 @@ void R_Prep3DFloors(sector_t *sector)
|
|||
&& !(rover->flags & FF_CUTLEVEL) && !(rover->flags & FF_CUTSPRITES)))
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
heighttest = *rover->t_slope ? P_GetZAt(*rover->t_slope, sector->soundorg.x, sector->soundorg.y) : *rover->topheight;
|
||||
|
||||
if (heighttest > bestheight && heighttest < maxheight)
|
||||
|
|
@ -1273,21 +1206,6 @@ void R_Prep3DFloors(sector_t *sector)
|
|||
continue;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (*rover->topheight > bestheight && *rover->topheight < maxheight)
|
||||
{
|
||||
best = rover;
|
||||
bestheight = *rover->topheight;
|
||||
continue;
|
||||
}
|
||||
if (rover->flags & FF_DOUBLESHADOW && *rover->bottomheight > bestheight
|
||||
&& *rover->bottomheight < maxheight)
|
||||
{
|
||||
best = rover;
|
||||
bestheight = *rover->bottomheight;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (!best)
|
||||
{
|
||||
|
|
@ -1298,9 +1216,7 @@ void R_Prep3DFloors(sector_t *sector)
|
|||
sector->lightlist[i].height = maxheight = bestheight;
|
||||
sector->lightlist[i].caster = best;
|
||||
sector->lightlist[i].flags = best->flags;
|
||||
#ifdef ESLOPE
|
||||
sector->lightlist[i].slope = bestslope;
|
||||
#endif
|
||||
sec = §ors[best->secnum];
|
||||
mapnum = sec->midmap;
|
||||
if (mapnum >= 0 && (size_t)mapnum < num_extra_colormaps)
|
||||
|
|
@ -1326,12 +1242,8 @@ void R_Prep3DFloors(sector_t *sector)
|
|||
|
||||
if (best->flags & FF_DOUBLESHADOW)
|
||||
{
|
||||
#ifdef ESLOPE
|
||||
heighttest = *best->b_slope ? P_GetZAt(*best->b_slope, sector->soundorg.x, sector->soundorg.y) : *best->bottomheight;
|
||||
if (bestheight == heighttest) ///TODO: do this in a more efficient way -Red
|
||||
#else
|
||||
if (bestheight == *best->bottomheight)
|
||||
#endif
|
||||
{
|
||||
sector->lightlist[i].lightlevel = sector->lightlist[best->lastlight].lightlevel;
|
||||
sector->lightlist[i].extra_colormap =
|
||||
|
|
|
|||
|
|
@ -44,13 +44,11 @@ void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2);
|
|||
// no longer a static since this is used for encore in hw_main.c as well now:
|
||||
boolean R_NoEncore(sector_t *sector, boolean ceiling);
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
void R_SortPolyObjects(subsector_t *sub);
|
||||
|
||||
extern size_t numpolys; // number of polyobjects in current subsector
|
||||
extern size_t num_po_ptrs; // number of polyobject pointers allocated
|
||||
extern polyobj_t **po_ptrs; // temp ptr array to sort polyobject pointers
|
||||
#endif
|
||||
|
||||
sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
|
||||
INT32 *ceilinglightlevel, boolean back);
|
||||
|
|
|
|||
18
src/r_defs.h
18
src/r_defs.h
|
|
@ -91,9 +91,7 @@ typedef struct
|
|||
fixed_t z; ///< Z coordinate.
|
||||
} degenmobj_t;
|
||||
|
||||
#ifdef POLYOBJECTS
|
||||
#include "p_polyobj.h"
|
||||
#endif
|
||||
|
||||
// Store fake planes in a resizable array insted of just by
|
||||
// heightsec. Allows for multiple fake planes.
|
||||
|
|
@ -155,11 +153,9 @@ typedef struct ffloor_s
|
|||
fixed_t *bottomyoffs;
|
||||
angle_t *bottomangle;
|
||||
|
||||
#ifdef ESLOPE
|
||||
// Pointers to pointers. Yup.
|
||||
struct pslope_s **t_slope;
|
||||
struct pslope_s **b_slope;
|
||||
#endif
|
||||
|
||||
size_t secnum;
|
||||
ffloortype_e flags;
|
||||
|
|
@ -190,9 +186,7 @@ typedef struct lightlist_s
|
|||
extracolormap_t *extra_colormap;
|
||||
INT32 flags;
|
||||
ffloor_t *caster;
|
||||
#ifdef ESLOPE
|
||||
struct pslope_s *slope; // FF_DOUBLESHADOW makes me have to store this pointer here. Bluh bluh.
|
||||
#endif
|
||||
} lightlist_t;
|
||||
|
||||
|
||||
|
|
@ -226,7 +220,6 @@ typedef struct linechain_s
|
|||
|
||||
|
||||
// Slopes
|
||||
#ifdef ESLOPE
|
||||
typedef enum {
|
||||
SL_NOPHYSICS = 1, // Don't do momentum adjustment with this slope
|
||||
SL_NODYNAMIC = 1<<1, // Slope will never need to move during the level, so don't fuss with recalculating it
|
||||
|
|
@ -269,7 +262,6 @@ typedef struct pslope_s
|
|||
|
||||
struct pslope_s *next; // Make a linked list of dynamic slopes, for easy reference later
|
||||
} pslope_t;
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
@ -376,12 +368,10 @@ typedef struct sector_s
|
|||
precipmobj_t *preciplist;
|
||||
struct mprecipsecnode_s *touching_preciplist;
|
||||
|
||||
#ifdef ESLOPE
|
||||
// Eternity engine slope
|
||||
pslope_t *f_slope; // floor slope
|
||||
pslope_t *c_slope; // ceiling slope
|
||||
boolean hasslope; // The sector, or one of its visible FOFs, contains a slope
|
||||
#endif
|
||||
|
||||
// these are saved for netgames, so do not let Lua touch these!
|
||||
INT32 spawn_nexttag, spawn_firsttag; // the actual nexttag/firsttag values may differ if the sector's tag was changed
|
||||
|
|
@ -439,9 +429,7 @@ typedef struct line_s
|
|||
void *splats; // wallsplat_t list
|
||||
#endif
|
||||
INT32 firsttag, nexttag; // improves searches for tags.
|
||||
#ifdef POLYOBJECTS
|
||||
polyobj_t *polyobj; // Belongs to a polyobject?
|
||||
#endif
|
||||
|
||||
char *text; // a concatination 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
|
||||
|
|
@ -483,9 +471,7 @@ typedef struct subsector_s
|
|||
sector_t *sector;
|
||||
INT16 numlines;
|
||||
UINT16 firstline;
|
||||
#ifdef POLYOBJECTS
|
||||
struct polyobj_s *polyList; // haleyjd 02/19/06: list of polyobjects
|
||||
#endif
|
||||
#if 1//#ifdef FLOORSPLATS
|
||||
void *splats; // floorsplat_t list
|
||||
#endif
|
||||
|
|
@ -561,10 +547,8 @@ typedef struct seg_s
|
|||
// Why slow things down by calculating lightlists for every thick side?
|
||||
size_t numlights;
|
||||
r_lightlist_t *rlights;
|
||||
#ifdef POLYOBJECTS
|
||||
polyobj_t *polyseg;
|
||||
boolean dontrenderme;
|
||||
#endif
|
||||
|
||||
// Fake contrast calculated on level load
|
||||
SINT8 lightOffset;
|
||||
|
|
@ -647,11 +631,9 @@ typedef struct drawseg_s
|
|||
|
||||
UINT8 portalpass; // if > 0 and <= portalrender, do not affect sprite clipping
|
||||
|
||||
#ifdef ESLOPE
|
||||
fixed_t maskedtextureheight[MAXVIDWIDTH]; // For handling sloped midtextures
|
||||
|
||||
vertex_t leftpos, rightpos; // Used for rendering FOF walls with slopes
|
||||
#endif
|
||||
} drawseg_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
|||
|
|
@ -112,11 +112,9 @@ fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
|
|||
UINT8 *ds_source; // start of a 64*64 tile image
|
||||
UINT8 *ds_transmap; // one of the translucency tables
|
||||
|
||||
#ifdef ESLOPE
|
||||
pslope_t *ds_slope; // Current slope being used
|
||||
floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff?
|
||||
float focallengthf, zeroheight;
|
||||
#endif
|
||||
|
||||
/** \brief Variable flat sizes
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ extern fixed_t ds_xfrac, ds_yfrac, ds_xstep, ds_ystep;
|
|||
extern UINT8 *ds_source; // start of a 64*64 tile image
|
||||
extern UINT8 *ds_transmap;
|
||||
|
||||
#ifdef ESLOPE
|
||||
typedef struct {
|
||||
float x, y, z;
|
||||
} floatv3_t;
|
||||
|
|
@ -70,7 +69,6 @@ typedef struct {
|
|||
extern pslope_t *ds_slope; // Current slope being used
|
||||
extern floatv3_t ds_su, ds_sv, ds_sz; // Vectors for... stuff?
|
||||
extern float focallengthf, zeroheight;
|
||||
#endif
|
||||
|
||||
// Variable flat sizes
|
||||
extern UINT32 nflatxshift;
|
||||
|
|
@ -157,12 +155,10 @@ void ASMCALL R_DrawSpan_8_MMX(void);
|
|||
void R_DrawTranslatedColumn_8(void);
|
||||
void R_DrawTranslatedTranslucentColumn_8(void);
|
||||
void R_DrawSpan_8(void);
|
||||
#ifdef ESLOPE
|
||||
void R_CalcTiltedLighting(fixed_t start, fixed_t end);
|
||||
void R_DrawTiltedSpan_8(void);
|
||||
void R_DrawTiltedTranslucentSpan_8(void);
|
||||
void R_DrawTiltedSplat_8(void);
|
||||
#endif
|
||||
void R_DrawSplat_8(void);
|
||||
void R_DrawTranslucentSplat_8(void);
|
||||
void R_DrawTranslucentSpan_8(void);
|
||||
|
|
|
|||
|
|
@ -620,7 +620,6 @@ void R_DrawSpan_8 (void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
// R_CalcTiltedLighting
|
||||
// Exactly what it says on the tin. I wish I wasn't too lazy to explain things properly.
|
||||
static INT32 tiltlighting[MAXVIDWIDTH];
|
||||
|
|
@ -1058,7 +1057,6 @@ void R_DrawTiltedSplat_8(void)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#endif // ESLOPE
|
||||
|
||||
/** \brief The R_DrawSplat_8 function
|
||||
Just like R_DrawSpan_8, but skips transparent pixels.
|
||||
|
|
|
|||
|
|
@ -513,9 +513,7 @@ static void R_InitTextureMapping(void)
|
|||
focallength = FixedDiv(projection,
|
||||
FINETANGENT(FINEANGLES/4+/*cv_fov.value*/ FIELDOFVIEW/2));
|
||||
|
||||
#ifdef ESLOPE
|
||||
focallengthf = FIXED_TO_FLOAT(focallength);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < FINEANGLES/2; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -322,11 +322,9 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
|
|||
if (pindex >= MAXLIGHTZ)
|
||||
pindex = MAXLIGHTZ - 1;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (currentplane->slope)
|
||||
ds_colormap = colormaps;
|
||||
else
|
||||
#endif
|
||||
ds_colormap = planezlight[pindex];
|
||||
if (encoremap && !currentplane->noencore)
|
||||
ds_colormap += (256*32);
|
||||
|
|
@ -424,20 +422,14 @@ static visplane_t *new_visplane(unsigned hash)
|
|||
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
||||
fixed_t xoff, fixed_t yoff, angle_t plangle, extracolormap_t *planecolormap,
|
||||
ffloor_t *pfloor
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
, polyobj_t *polyobj
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
, pslope_t *slope
|
||||
#endif
|
||||
, boolean noencore)
|
||||
{
|
||||
visplane_t *check;
|
||||
unsigned hash;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (slope); else // Don't mess with this right now if a slope is involved
|
||||
#endif
|
||||
{
|
||||
xoff += viewx;
|
||||
yoff -= viewy;
|
||||
|
|
@ -452,7 +444,6 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
if (polyobj)
|
||||
{
|
||||
if (polyobj->angle != 0)
|
||||
|
|
@ -467,7 +458,6 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
|||
yoff += polyobj->centerPt.y;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// This appears to fix the Nimbus Ruins sky bug.
|
||||
if (picnum == skyflatnum && pfloor)
|
||||
|
|
@ -481,12 +471,10 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
|||
|
||||
for (check = visplanes[hash]; check; check = check->next)
|
||||
{
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
if (check->polyobj && pfloor)
|
||||
continue;
|
||||
if (polyobj != check->polyobj)
|
||||
continue;
|
||||
#endif
|
||||
if (height == check->height && picnum == check->picnum
|
||||
&& lightlevel == check->lightlevel
|
||||
&& xoff == check->xoffs && yoff == check->yoffs
|
||||
|
|
@ -495,9 +483,7 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
|||
&& check->viewx == viewx && check->viewy == viewy && check->viewz == viewz
|
||||
&& check->viewangle == viewangle
|
||||
&& check->plangle == plangle
|
||||
#ifdef ESLOPE
|
||||
&& check->slope == slope
|
||||
#endif
|
||||
&& check->noencore == noencore)
|
||||
{
|
||||
return check;
|
||||
|
|
@ -520,12 +506,8 @@ visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel,
|
|||
check->viewz = viewz;
|
||||
check->viewangle = viewangle;
|
||||
check->plangle = plangle;
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
check->polyobj = polyobj;
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
check->slope = slope;
|
||||
#endif
|
||||
check->noencore = noencore;
|
||||
|
||||
memset(check->top, 0xff, sizeof (check->top));
|
||||
|
|
@ -593,12 +575,8 @@ visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop)
|
|||
new_pl->viewz = pl->viewz;
|
||||
new_pl->viewangle = pl->viewangle;
|
||||
new_pl->plangle = pl->plangle;
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
new_pl->polyobj = pl->polyobj;
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
new_pl->slope = pl->slope;
|
||||
#endif
|
||||
new_pl->noencore = pl->noencore;
|
||||
pl = new_pl;
|
||||
pl->minx = start;
|
||||
|
|
@ -623,11 +601,9 @@ void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop)
|
|||
INT32 unionl, unionh;
|
||||
// INT32 x;
|
||||
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
// Don't expand polyobject planes here - we do that on our own.
|
||||
if (pl->polyobj)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (start < pl->minx)
|
||||
{
|
||||
|
|
@ -742,9 +718,7 @@ void R_DrawPlanes(void)
|
|||
}
|
||||
|
||||
if (pl->ffloor != NULL
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
|| pl->polyobj != NULL
|
||||
#endif
|
||||
)
|
||||
continue;
|
||||
|
||||
|
|
@ -773,7 +747,6 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
#endif
|
||||
spanfunc = basespanfunc;
|
||||
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
if (pl->polyobj && pl->polyobj->translucency != 0) {
|
||||
spanfunc = R_DrawTranslucentSpan_8;
|
||||
|
||||
|
|
@ -795,7 +768,6 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
light = LIGHTLEVELS-1;
|
||||
|
||||
} else
|
||||
#endif
|
||||
if (pl->ffloor)
|
||||
{
|
||||
// Don't draw planes that shouldn't be drawn.
|
||||
|
|
@ -861,9 +833,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
|
||||
#ifndef NOWATER
|
||||
if (pl->ffloor->flags & FF_RIPPLE
|
||||
#ifdef ESLOPE
|
||||
&& !pl->slope
|
||||
#endif
|
||||
)
|
||||
{
|
||||
INT32 top, bottom;
|
||||
|
|
@ -902,9 +872,7 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
}
|
||||
else light = (pl->lightlevel >> LIGHTSEGSHIFT);
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (!pl->slope) // Don't mess with angle on slopes! We'll handle this ourselves later
|
||||
#endif
|
||||
if (viewangle != pl->viewangle+pl->plangle)
|
||||
{
|
||||
memset(cachedheight, 0, sizeof (cachedheight));
|
||||
|
|
@ -978,7 +946,6 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
if (light < 0)
|
||||
light = 0;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (pl->slope) {
|
||||
// Potentially override other stuff for now cus we're mean. :< But draw a slope plane!
|
||||
// I copied ZDoom's code and adapted it to SRB2... -fickle
|
||||
|
|
@ -1118,7 +1085,6 @@ void R_DrawSinglePlane(visplane_t *pl)
|
|||
|
||||
planezlight = scalelight[light];
|
||||
} else
|
||||
#endif // ESLOPE
|
||||
|
||||
planezlight = zlight[light];
|
||||
|
||||
|
|
|
|||
|
|
@ -45,12 +45,8 @@ typedef struct visplane_s
|
|||
fixed_t xoffs, yoffs; // Scrolling flats.
|
||||
|
||||
struct ffloor_s *ffloor;
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
polyobj_t *polyobj;
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
pslope_t *slope;
|
||||
#endif
|
||||
|
||||
boolean noencore;
|
||||
} visplane_t;
|
||||
|
|
@ -83,12 +79,8 @@ void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2);
|
|||
void R_DrawPlanes(void);
|
||||
visplane_t *R_FindPlane(fixed_t height, INT32 picnum, INT32 lightlevel, fixed_t xoff, fixed_t yoff, angle_t plangle,
|
||||
extracolormap_t *planecolormap, ffloor_t *ffloor
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
, polyobj_t *polyobj
|
||||
#endif
|
||||
#ifdef ESLOPE
|
||||
, pslope_t *slope
|
||||
#endif
|
||||
, boolean noencore);
|
||||
visplane_t *R_CheckPlane(visplane_t *pl, INT32 start, INT32 stop);
|
||||
void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop);
|
||||
|
|
@ -108,18 +100,14 @@ typedef struct planemgr_s
|
|||
INT16 f_clip[MAXVIDWIDTH];
|
||||
INT16 c_clip[MAXVIDWIDTH];
|
||||
|
||||
#ifdef ESLOPE
|
||||
// For slope rendering; the height at the other end
|
||||
fixed_t f_pos_slope;
|
||||
fixed_t b_pos_slope;
|
||||
|
||||
struct pslope_s *slope;
|
||||
#endif
|
||||
|
||||
struct ffloor_s *ffloor;
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
polyobj_t *polyobj;
|
||||
#endif
|
||||
} visffloor_t;
|
||||
|
||||
extern visffloor_t ffloor[MAXFFLOORS];
|
||||
|
|
|
|||
348
src/r_segs.c
348
src/r_segs.c
File diff suppressed because it is too large
Load diff
|
|
@ -1078,10 +1078,8 @@ static void R_SplitSprite(vissprite_t *sprite)
|
|||
if (!(sector->lightlist[i].caster->flags & FF_CUTSPRITES))
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (sector->lightlist[i].slope)
|
||||
testheight = P_GetZAt(sector->lightlist[i].slope, sprite->gx, sprite->gy);
|
||||
#endif
|
||||
|
||||
if (testheight >= sprite->gzt)
|
||||
continue;
|
||||
|
|
@ -1742,7 +1740,6 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
if (thing->subsector->sector->numlights)
|
||||
{
|
||||
INT32 lightnum;
|
||||
#ifdef ESLOPE // R_GetPlaneLight won't work on sloped lights!
|
||||
light = thing->subsector->sector->numlights - 1;
|
||||
|
||||
for (lightnum = 1; lightnum < thing->subsector->sector->numlights; lightnum++) {
|
||||
|
|
@ -1753,9 +1750,6 @@ static void R_ProjectSprite(mobj_t *thing)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
light = R_GetPlaneLight(thing->subsector->sector, gzt, false);
|
||||
#endif
|
||||
lightnum = (*thing->subsector->sector->lightlist[light].lightlevel >> LIGHTSEGSHIFT);
|
||||
|
||||
if (lightnum < 0)
|
||||
|
|
@ -2283,7 +2277,6 @@ static void R_CreateDrawNodes(void)
|
|||
entry->ffloor = ds->thicksides[i];
|
||||
}
|
||||
}
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
// Check for a polyobject plane, but only if this is a front line
|
||||
if (ds->curline->polyseg && ds->curline->polyseg->visplane && !ds->curline->side) {
|
||||
plane = ds->curline->polyseg->visplane;
|
||||
|
|
@ -2299,7 +2292,6 @@ static void R_CreateDrawNodes(void)
|
|||
}
|
||||
ds->curline->polyseg->visplane = NULL;
|
||||
}
|
||||
#endif
|
||||
if (ds->maskedtexturecol)
|
||||
{
|
||||
entry = R_CreateDrawNode(&nodehead);
|
||||
|
|
@ -2344,7 +2336,6 @@ static void R_CreateDrawNodes(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef POLYOBJECTS_PLANES
|
||||
// find all the remaining polyobject planes and add them on the end of the list
|
||||
// probably this is a terrible idea if we wanted them to be sorted properly
|
||||
// but it works getting them in for now
|
||||
|
|
@ -2365,7 +2356,6 @@ static void R_CreateDrawNodes(void)
|
|||
// note: no seg is set, for what should be obvious reasons
|
||||
PolyObjects[i].visplane = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (visspritecount == 0)
|
||||
return;
|
||||
|
|
@ -2388,13 +2378,11 @@ static void R_CreateDrawNodes(void)
|
|||
if (rover->szt > r2->plane->low || rover->sz < r2->plane->high)
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
// Effective height may be different for each comparison in the case of slopes
|
||||
if (r2->plane->slope) {
|
||||
planeobjectz = P_GetZAt(r2->plane->slope, rover->gx, rover->gy);
|
||||
planecameraz = P_GetZAt(r2->plane->slope, viewx, viewy);
|
||||
} else
|
||||
#endif
|
||||
planeobjectz = planecameraz = r2->plane->height;
|
||||
|
||||
if (rover->mobjflags & MF_NOCLIPHEIGHT)
|
||||
|
|
@ -2453,20 +2441,16 @@ static void R_CreateDrawNodes(void)
|
|||
if (scale <= rover->sortscale)
|
||||
continue;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*r2->ffloor->t_slope) {
|
||||
topplaneobjectz = P_GetZAt(*r2->ffloor->t_slope, rover->gx, rover->gy);
|
||||
topplanecameraz = P_GetZAt(*r2->ffloor->t_slope, viewx, viewy);
|
||||
} else
|
||||
#endif
|
||||
topplaneobjectz = topplanecameraz = *r2->ffloor->topheight;
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (*r2->ffloor->b_slope) {
|
||||
botplaneobjectz = P_GetZAt(*r2->ffloor->b_slope, rover->gx, rover->gy);
|
||||
botplanecameraz = P_GetZAt(*r2->ffloor->b_slope, viewx, viewy);
|
||||
} else
|
||||
#endif
|
||||
botplaneobjectz = botplanecameraz = *r2->ffloor->bottomheight;
|
||||
|
||||
if ((topplanecameraz > viewz && botplanecameraz < viewz) ||
|
||||
|
|
@ -3138,7 +3122,7 @@ void R_AddSkins(UINT16 wadnum)
|
|||
|
||||
if (numskins >= MAXSKINS)
|
||||
{
|
||||
CONS_Debug(DBG_RENDER, "ignored skin (%d skins maximum)\n", MAXSKINS);
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Unable to add skin, too many characters are loaded (%d maximum)\n"), MAXSKINS);
|
||||
continue; // so we know how many skins couldn't be added
|
||||
}
|
||||
buf = W_CacheLumpNumPwad(wadnum, lump, PU_CACHE);
|
||||
|
|
|
|||
|
|
@ -172,6 +172,9 @@ typedef struct
|
|||
// origin of sound
|
||||
const void *origin;
|
||||
|
||||
// initial volume of sound, which is applied after distance and direction
|
||||
INT32 volume;
|
||||
|
||||
// handle of the sound being played
|
||||
INT32 handle;
|
||||
|
||||
|
|
@ -445,6 +448,7 @@ void S_StopSoundByNum(sfxenum_t sfxnum)
|
|||
|
||||
void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume)
|
||||
{
|
||||
const INT32 initial_volume = volume;
|
||||
INT32 sep, pitch, priority, cnum;
|
||||
sfxinfo_t *sfx;
|
||||
const boolean reverse = (stereoreverse.value ^ encoremode);
|
||||
|
|
@ -802,6 +806,7 @@ dontplay4:
|
|||
|
||||
// Assigns the handle to one of the channels in the
|
||||
// mix/output buffer.
|
||||
channels[cnum].volume = initial_volume;
|
||||
channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum);
|
||||
}
|
||||
|
||||
|
|
@ -1067,7 +1072,7 @@ void S_UpdateSounds(void)
|
|||
if (I_SoundIsPlaying(c->handle))
|
||||
{
|
||||
// initialize parameters
|
||||
volume = 255; // 8 bits internal volume precision
|
||||
volume = c->volume; // 8 bits internal volume precision
|
||||
pitch = NORM_PITCH;
|
||||
sep = NORM_SEP;
|
||||
|
||||
|
|
@ -1374,15 +1379,12 @@ INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, INT32 *v
|
|||
}
|
||||
|
||||
// volume calculation
|
||||
if (approx_dist < S_CLOSE_DIST)
|
||||
{
|
||||
// SfxVolume is now hardware volume
|
||||
*vol = 255; // not snd_SfxVolume
|
||||
}
|
||||
else
|
||||
/* not sure if it should be > (no =), but this matches the old behavior */
|
||||
if (approx_dist >= S_CLOSE_DIST)
|
||||
{
|
||||
// distance effect
|
||||
*vol = (15 * ((S_CLIPPING_DIST - approx_dist)>>FRACBITS)) / S_ATTENUATOR;
|
||||
INT32 n = (15 * ((S_CLIPPING_DIST - approx_dist)>>FRACBITS));
|
||||
*vol = FixedMul(*vol * FRACUNIT / 255, n) / S_ATTENUATOR;
|
||||
}
|
||||
|
||||
if (r_splitscreen)
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ if(${SDL2_FOUND})
|
|||
set(SRB2_SDL2_TOTAL_SOURCES
|
||||
${SRB2_CORE_SOURCES}
|
||||
${SRB2_CORE_HEADERS}
|
||||
${SRB2_DISCORDRPC_SOURCES}
|
||||
${SRB2_DISCORDRPC_HEADERS}
|
||||
${SRB2_PNG_SOURCES}
|
||||
${SRB2_PNG_HEADERS}
|
||||
${SRB2_CORE_RENDER_SOURCES}
|
||||
|
|
@ -86,9 +88,11 @@ if(${SDL2_FOUND})
|
|||
${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS})
|
||||
source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES})
|
||||
source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES})
|
||||
source_group("Discord Rich Presence" FILES ${SRB2_DISCORDRPC_SOURCES} ${SRB2_DISCORDRPC_HEADERS})
|
||||
source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES})
|
||||
source_group("LUA" FILES ${SRB2_LUA_SOURCES} ${SRB2_LUA_HEADERS})
|
||||
source_group("LUA\\Interpreter" FILES ${SRB2_BLUA_SOURCES} ${SRB2_BLUA_HEADERS})
|
||||
|
||||
|
||||
if(${SRB2_CONFIG_HWRENDER})
|
||||
set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_SDL2_TOTAL_SOURCES}
|
||||
|
|
@ -153,6 +157,7 @@ if(${SDL2_FOUND})
|
|||
${ZLIB_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${CURL_LIBRARIES}
|
||||
${DISCORDRPC_LIBRARIES}
|
||||
)
|
||||
set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
|
||||
else()
|
||||
|
|
@ -164,6 +169,7 @@ if(${SDL2_FOUND})
|
|||
${ZLIB_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
${CURL_LIBRARIES}
|
||||
${DISCORDRPC_LIBRARIES}
|
||||
)
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES Linux)
|
||||
|
|
@ -244,6 +250,7 @@ if(${SDL2_FOUND})
|
|||
${ZLIB_INCLUDE_DIRS}
|
||||
${OPENGL_INCLUDE_DIRS}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${DISCORDRPC_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(${SRB2_HAVE_MIXER})
|
||||
|
|
@ -328,6 +335,10 @@ if(${SDL2_FOUND})
|
|||
getwinlib(libgme "libgme.dll")
|
||||
endif()
|
||||
|
||||
if(${SRB2_CONFIG_HAVE_DISCORDRPC})
|
||||
getwinlib(discord-rpc "discord-rpc.dll")
|
||||
endif()
|
||||
|
||||
install(PROGRAMS
|
||||
${win_extra_dll_list}
|
||||
DESTINATION .
|
||||
|
|
|
|||
|
|
@ -53,28 +53,6 @@ ifndef NOHW
|
|||
OBJS+=$(OBJDIR)/r_opengl.o $(OBJDIR)/ogl_sdl.o
|
||||
endif
|
||||
|
||||
ifndef NOHS
|
||||
ifdef OPENAL
|
||||
OBJS+=$(OBJDIR)/s_openal.o
|
||||
OPTS+=-DSTATIC3DS
|
||||
STATICHS=1
|
||||
else
|
||||
ifdef FMOD
|
||||
OBJS+=$(OBJDIR)/s_fmod.o
|
||||
OPTS+=-DSTATIC3DS
|
||||
STATICHS=1
|
||||
else
|
||||
ifdef MINGW
|
||||
ifdef DS3D
|
||||
OBJS+=$(OBJDIR)/s_ds3d.o
|
||||
OPTS+=-DSTATIC3DS
|
||||
STATICHS=1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef NOMIXER
|
||||
i_sound_o=$(OBJDIR)/sdl_sound.o
|
||||
else
|
||||
|
|
|
|||
|
|
@ -65,6 +65,10 @@ char logfilename[1024];
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32)
|
||||
#include "exchndl.h"
|
||||
#endif
|
||||
|
||||
#if defined (_WIN32)
|
||||
#include "../win32/win_dbg.h"
|
||||
typedef BOOL (WINAPI *p_IsDebuggerPresent)(VOID);
|
||||
|
|
@ -104,6 +108,20 @@ static inline VOID MakeCodeWritable(VOID)
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
static void
|
||||
ChDirToExe (void)
|
||||
{
|
||||
CHAR path[MAX_PATH];
|
||||
if (GetModuleFileNameA(NULL, path, MAX_PATH) > 0)
|
||||
{
|
||||
strrchr(path, '\\')[0] = '\0';
|
||||
SetCurrentDirectoryA(path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** \brief The main function
|
||||
|
||||
\param argc number of arg
|
||||
|
|
@ -133,6 +151,10 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
ChDirToExe();
|
||||
#endif
|
||||
|
||||
#ifdef LOGMESSAGES
|
||||
if (!M_CheckParm("-nolog"))
|
||||
{
|
||||
|
|
@ -231,7 +253,7 @@ int main(int argc, char **argv)
|
|||
)
|
||||
#endif
|
||||
{
|
||||
LoadLibraryA("exchndl.dll");
|
||||
ExcHndlInit();
|
||||
}
|
||||
}
|
||||
#ifndef __MINGW32__
|
||||
|
|
|
|||
|
|
@ -146,11 +146,6 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||
#define DEFAULTSEARCHPATH1 "/usr/local/games"
|
||||
#define DEFAULTSEARCHPATH2 "/usr/games"
|
||||
#define DEFAULTSEARCHPATH3 "/usr/local"
|
||||
#elif defined (_WIN32)
|
||||
#define DEFAULTWADLOCATION1 "c:\\games\\srb2kart"
|
||||
#define DEFAULTWADLOCATION2 "\\games\\srb2kart"
|
||||
#define DEFAULTSEARCHPATH1 "c:\\games"
|
||||
#define DEFAULTSEARCHPATH2 "\\games"
|
||||
#endif
|
||||
|
||||
/** \brief WAD file to look for
|
||||
|
|
@ -3698,6 +3693,18 @@ static const char *locateWad(void)
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef DEFAULTDIR
|
||||
I_OutputMsg(",HOME/" DEFAULTDIR);
|
||||
// examine user jart directory
|
||||
if ((envstr = I_GetEnv("HOME")) != NULL)
|
||||
{
|
||||
sprintf(returnWadPath, "%s" PATHSEP DEFAULTDIR, envstr);
|
||||
if (isWadPathOk(returnWadPath))
|
||||
return returnWadPath;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef CMAKECONFIG
|
||||
#ifndef NDEBUG
|
||||
I_OutputMsg(","CMAKE_ASSETS_DIR);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
/// \brief SRB2 graphics stuff for SDL
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
|
|
@ -81,6 +82,10 @@
|
|||
#include "ogl_sdl.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "../discord.h"
|
||||
#endif
|
||||
|
||||
// maximum number of windowed modes (see windowedModes[][])
|
||||
#define MAXWINMODES (18)
|
||||
|
||||
|
|
@ -92,7 +97,7 @@ static INT32 numVidModes = -1;
|
|||
*/
|
||||
static char vidModeName[33][32]; // allow 33 different modes
|
||||
|
||||
rendermode_t rendermode=render_soft;
|
||||
rendermode_t rendermode = render_none;
|
||||
|
||||
boolean highcolor = false;
|
||||
|
||||
|
|
@ -1413,6 +1418,11 @@ void I_FinishUpdate(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (discordRequestList != NULL)
|
||||
ST_AskToJoinEnvelope();
|
||||
#endif
|
||||
|
||||
if (rendermode == render_soft && screens[0])
|
||||
{
|
||||
SDL_Rect rect;
|
||||
|
|
@ -1816,6 +1826,13 @@ static void Impl_VideoSetupBuffer(void)
|
|||
}
|
||||
}
|
||||
|
||||
static FILE *
|
||||
OpenRendererFile (const char * mode)
|
||||
{
|
||||
char * path = va(pandf,srb2home,"renderer.txt");
|
||||
return fopen(path, mode);
|
||||
}
|
||||
|
||||
void I_StartupGraphics(void)
|
||||
{
|
||||
if (dedicated)
|
||||
|
|
@ -1863,6 +1880,62 @@ void I_StartupGraphics(void)
|
|||
rendermode = render_opengl;
|
||||
#endif
|
||||
|
||||
if (rendermode == render_none)
|
||||
{
|
||||
#ifdef HWRENDER
|
||||
char line[16];
|
||||
char * word;
|
||||
FILE * file = OpenRendererFile("r");
|
||||
if (file != NULL)
|
||||
{
|
||||
if (fgets(line, sizeof line, file) != NULL)
|
||||
{
|
||||
word = strtok(line, "\n");
|
||||
|
||||
if (strcasecmp(word, "software") == 0)
|
||||
{
|
||||
rendermode = render_soft;
|
||||
}
|
||||
else if (strcasecmp(word, "opengl") == 0)
|
||||
{
|
||||
rendermode = render_opengl;
|
||||
}
|
||||
|
||||
if (rendermode != render_none)
|
||||
{
|
||||
CONS_Printf("Using last known renderer: %s\n", line);
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
#endif
|
||||
if (rendermode == render_none)
|
||||
{
|
||||
rendermode = render_soft;
|
||||
CONS_Printf("Using default software renderer.\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FILE * file = OpenRendererFile("w");
|
||||
if (file != NULL)
|
||||
{
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
fputs("software\n", file);
|
||||
}
|
||||
else if (rendermode == render_opengl)
|
||||
{
|
||||
fputs("opengl\n", file);
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("Could not save renderer to file: %s\n", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
usesdl2soft = M_CheckParm("-softblit");
|
||||
borderlesswindow = M_CheckParm("-borderless");
|
||||
|
||||
|
|
|
|||
|
|
@ -123,6 +123,29 @@ static void var_cleanup(void)
|
|||
internal_volume = 100;
|
||||
}
|
||||
|
||||
#if defined (HAVE_LIBGME) && defined (HAVE_ZLIB)
|
||||
static const char* get_zlib_error(int zErr)
|
||||
{
|
||||
switch (zErr)
|
||||
{
|
||||
case Z_ERRNO:
|
||||
return "Z_ERRNO";
|
||||
case Z_STREAM_ERROR:
|
||||
return "Z_STREAM_ERROR";
|
||||
case Z_DATA_ERROR:
|
||||
return "Z_DATA_ERROR";
|
||||
case Z_MEM_ERROR:
|
||||
return "Z_MEM_ERROR";
|
||||
case Z_BUF_ERROR:
|
||||
return "Z_BUF_ERROR";
|
||||
case Z_VERSION_ERROR:
|
||||
return "Z_VERSION_ERROR";
|
||||
default:
|
||||
return "unknown error";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// ------------------------
|
||||
/// Audio System
|
||||
/// ------------------------
|
||||
|
|
@ -384,51 +407,11 @@ void *I_GetSfx(sfxinfo_t *sfx)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *errorType;
|
||||
switch (zErr)
|
||||
{
|
||||
case Z_ERRNO:
|
||||
errorType = "Z_ERRNO"; break;
|
||||
case Z_STREAM_ERROR:
|
||||
errorType = "Z_STREAM_ERROR"; break;
|
||||
case Z_DATA_ERROR:
|
||||
errorType = "Z_DATA_ERROR"; break;
|
||||
case Z_MEM_ERROR:
|
||||
errorType = "Z_MEM_ERROR"; break;
|
||||
case Z_BUF_ERROR:
|
||||
errorType = "Z_BUF_ERROR"; break;
|
||||
case Z_VERSION_ERROR:
|
||||
errorType = "Z_VERSION_ERROR"; break;
|
||||
default:
|
||||
errorType = "unknown error";
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg);
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
(void)inflateEnd(&stream);
|
||||
}
|
||||
else // Hold up, zlib's got a problem
|
||||
{
|
||||
const char *errorType;
|
||||
switch (zErr)
|
||||
{
|
||||
case Z_ERRNO:
|
||||
errorType = "Z_ERRNO"; break;
|
||||
case Z_STREAM_ERROR:
|
||||
errorType = "Z_STREAM_ERROR"; break;
|
||||
case Z_DATA_ERROR:
|
||||
errorType = "Z_DATA_ERROR"; break;
|
||||
case Z_MEM_ERROR:
|
||||
errorType = "Z_MEM_ERROR"; break;
|
||||
case Z_BUF_ERROR:
|
||||
errorType = "Z_BUF_ERROR"; break;
|
||||
case Z_VERSION_ERROR:
|
||||
errorType = "Z_VERSION_ERROR"; break;
|
||||
default:
|
||||
errorType = "unknown error";
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg);
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
#else
|
||||
return NULL; // No zlib support
|
||||
|
|
@ -1009,73 +992,25 @@ boolean I_LoadSong(char *data, size_t len)
|
|||
// Run GME on new data
|
||||
if (!gme_open_data(inflatedData, inflatedLen, &gme, 44100))
|
||||
{
|
||||
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
|
||||
gme_start_track(gme, 0);
|
||||
current_track = 0;
|
||||
gme_set_equalizer(gme, &eq);
|
||||
Mix_HookMusic(mix_gme, gme);
|
||||
Z_Free(inflatedData); // GME supposedly makes a copy for itself, so we don't need this lying around
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *errorType;
|
||||
switch (zErr)
|
||||
{
|
||||
case Z_ERRNO:
|
||||
errorType = "Z_ERRNO"; break;
|
||||
case Z_STREAM_ERROR:
|
||||
errorType = "Z_STREAM_ERROR"; break;
|
||||
case Z_DATA_ERROR:
|
||||
errorType = "Z_DATA_ERROR"; break;
|
||||
case Z_MEM_ERROR:
|
||||
errorType = "Z_MEM_ERROR"; break;
|
||||
case Z_BUF_ERROR:
|
||||
errorType = "Z_BUF_ERROR"; break;
|
||||
case Z_VERSION_ERROR:
|
||||
errorType = "Z_VERSION_ERROR"; break;
|
||||
default:
|
||||
errorType = "unknown error";
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflate: %s\n", errorType, stream.msg);
|
||||
}
|
||||
CONS_Alert(CONS_ERROR, "Encountered %s when running inflate: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
(void)inflateEnd(&stream);
|
||||
}
|
||||
else // Hold up, zlib's got a problem
|
||||
{
|
||||
const char *errorType;
|
||||
switch (zErr)
|
||||
{
|
||||
case Z_ERRNO:
|
||||
errorType = "Z_ERRNO"; break;
|
||||
case Z_STREAM_ERROR:
|
||||
errorType = "Z_STREAM_ERROR"; break;
|
||||
case Z_DATA_ERROR:
|
||||
errorType = "Z_DATA_ERROR"; break;
|
||||
case Z_MEM_ERROR:
|
||||
errorType = "Z_MEM_ERROR"; break;
|
||||
case Z_BUF_ERROR:
|
||||
errorType = "Z_BUF_ERROR"; break;
|
||||
case Z_VERSION_ERROR:
|
||||
errorType = "Z_VERSION_ERROR"; break;
|
||||
default:
|
||||
errorType = "unknown error";
|
||||
}
|
||||
CONS_Alert(CONS_ERROR,"Encountered %s when running inflateInit: %s\n", errorType, stream.msg);
|
||||
}
|
||||
CONS_Alert(CONS_ERROR, "Encountered %s when running inflateInit: %s\n", get_zlib_error(zErr), stream.msg);
|
||||
Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up
|
||||
return false;
|
||||
#else
|
||||
CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n");
|
||||
return true;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
else if (!gme_open_data(data, len, &gme, 44100))
|
||||
{
|
||||
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
|
||||
gme_set_equalizer(gme, &eq);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
rw = SDL_RWFromMem(data, len);
|
||||
|
|
@ -1146,6 +1081,8 @@ boolean I_PlaySong(boolean looping)
|
|||
#ifdef HAVE_LIBGME
|
||||
if (gme)
|
||||
{
|
||||
gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0};
|
||||
gme_set_equalizer(gme, &eq);
|
||||
gme_start_track(gme, 0);
|
||||
current_track = 0;
|
||||
Mix_HookMusic(mix_gme, gme);
|
||||
|
|
|
|||
|
|
@ -1434,6 +1434,8 @@ static void I_ResumeGME(void)
|
|||
|
||||
boolean I_LoadSong(char *data, size_t len)
|
||||
{
|
||||
(void)data;
|
||||
(void)len;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1495,6 +1497,7 @@ boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms
|
|||
(void)target_volume;
|
||||
(void)source_volume;
|
||||
(void)ms;
|
||||
(void)callback;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1502,6 +1505,7 @@ boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void))
|
|||
{
|
||||
(void)target_volume;
|
||||
(void)ms;
|
||||
(void)callback;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -818,6 +818,10 @@ sfxinfo_t S_sfx[NUMSFX] =
|
|||
{"bhurry", false, 255, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // v1.0.2 Battle overtime
|
||||
{"bsnipe", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Banana sniping
|
||||
{"sploss", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Down to yellow sparks
|
||||
{"join", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Player joined server
|
||||
{"leave", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Player left server
|
||||
{"requst", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Got a Discord join request
|
||||
{"syfail", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Funny sync failure
|
||||
{"itfree", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // :shitsfree:
|
||||
{"dbgsal", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Debug notification
|
||||
{"cock", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Hammer cocks, bang bang
|
||||
|
|
|
|||
|
|
@ -895,6 +895,10 @@ typedef enum
|
|||
sfx_bhurry,
|
||||
sfx_bsnipe,
|
||||
sfx_sploss,
|
||||
sfx_join,
|
||||
sfx_leave,
|
||||
sfx_requst,
|
||||
sfx_syfail,
|
||||
sfx_itfree,
|
||||
sfx_dbgsal,
|
||||
sfx_cock,
|
||||
|
|
|
|||
|
|
@ -129,6 +129,11 @@ static patch_t *gotbflag;
|
|||
static patch_t *hud_tv1;
|
||||
static patch_t *hud_tv2;
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
// Discord Rich Presence
|
||||
static patch_t *envelope;
|
||||
#endif
|
||||
|
||||
// SRB2kart
|
||||
|
||||
hudinfo_t hudinfo[NUMHUDITEMS] =
|
||||
|
|
@ -349,6 +354,11 @@ void ST_LoadGraphics(void)
|
|||
// Midnight Channel:
|
||||
hud_tv1 = W_CachePatchName("HUD_TV1", PU_HUDGFX);
|
||||
hud_tv2 = W_CachePatchName("HUD_TV2", PU_HUDGFX);
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
// Discord Rich Presence
|
||||
envelope = W_CachePatchName("K_REQUES", PU_HUDGFX);
|
||||
#endif
|
||||
}
|
||||
|
||||
// made separate so that skins code can reload custom face graphics
|
||||
|
|
@ -776,7 +786,7 @@ static void ST_drawLevelTitle(void)
|
|||
if (zonttl[0])
|
||||
zonexpos -= V_LevelNameWidth(zonttl); // SRB2kart
|
||||
else
|
||||
zonexpos -= V_LevelNameWidth(M_GetText("ZONE"));
|
||||
zonexpos -= V_LevelNameWidth(M_GetText("Zone"));
|
||||
}
|
||||
|
||||
if (lvlttlxpos < 0)
|
||||
|
|
@ -813,7 +823,7 @@ static void ST_drawLevelTitle(void)
|
|||
if (strlen(zonttl) > 0)
|
||||
V_DrawLevelTitle(zonexpos, bary+6, 0, zonttl);
|
||||
else if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE))
|
||||
V_DrawLevelTitle(zonexpos, bary+6, 0, M_GetText("ZONE"));
|
||||
V_DrawLevelTitle(zonexpos, bary+6, 0, M_GetText("Zone"));
|
||||
|
||||
if (actnum[0])
|
||||
V_DrawLevelTitle(ttlnumxpos+12, bary+6, 0, actnum);
|
||||
|
|
@ -2081,6 +2091,22 @@ static void ST_MayonakaStatic(void)
|
|||
V_DrawFixedPatch(320<<FRACBITS, 142<<FRACBITS, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_FLIP|flag, hud_tv2, NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
void ST_AskToJoinEnvelope(void)
|
||||
{
|
||||
const tic_t freq = TICRATE/2;
|
||||
|
||||
if (menuactive)
|
||||
return;
|
||||
|
||||
if ((leveltime % freq) < freq/2)
|
||||
return;
|
||||
|
||||
V_DrawFixedPatch(296*FRACUNIT, 2*FRACUNIT, FRACUNIT, V_SNAPTOTOP|V_SNAPTORIGHT, envelope, NULL);
|
||||
// maybe draw number of requests with V_DrawPingNum ?
|
||||
}
|
||||
#endif
|
||||
|
||||
void ST_Drawer(void)
|
||||
{
|
||||
UINT8 i;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ void ST_Ticker(void);
|
|||
// Called when naming a replay.
|
||||
void ST_DrawDemoTitleEntry(void);
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
// Called when you have Discord asks
|
||||
void ST_AskToJoinEnvelope(void);
|
||||
#endif
|
||||
|
||||
// Called by main loop.
|
||||
void ST_Drawer(void);
|
||||
|
||||
|
|
|
|||
41
src/w_wad.c
41
src/w_wad.c
|
|
@ -11,6 +11,24 @@
|
|||
/// \file w_wad.c
|
||||
/// \brief Handles WAD file header, directory, lump I/O
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LFS64_LARGEFILE
|
||||
#define _LFS64_LARGEFILE
|
||||
#endif
|
||||
|
||||
#ifndef _FILE_OFFSET_BITS
|
||||
#define _FILE_OFFSET_BITS 0
|
||||
#endif
|
||||
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
|
@ -66,24 +84,6 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
|
|||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LFS64_LARGEFILE
|
||||
#define _LFS64_LARGEFILE
|
||||
#endif
|
||||
|
||||
#ifndef _FILE_OFFSET_BITS
|
||||
#define _FILE_OFFSET_BITS 0
|
||||
#endif
|
||||
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
|
@ -150,7 +150,10 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
|
|||
{
|
||||
FILE *handle;
|
||||
|
||||
strncpy(filenamebuf, *filename, MAX_WADPATH);
|
||||
if (filenamebuf != *filename) {
|
||||
// avoid overlap
|
||||
strncpy(filenamebuf, *filename, MAX_WADPATH);
|
||||
}
|
||||
filenamebuf[MAX_WADPATH - 1] = '\0';
|
||||
*filename = filenamebuf;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@ ifndef MINGW64 #miniupnc is broken with MINGW64
|
|||
endif
|
||||
endif
|
||||
|
||||
ifndef NO_DISCORDRPC
|
||||
HAVE_DISCORDRPC=1
|
||||
endif
|
||||
|
||||
OPTS=-DSTDC_HEADERS
|
||||
|
||||
ifndef GCC44
|
||||
|
|
@ -56,6 +60,12 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
ifndef MINGW64
|
||||
CPPFLAGS+=-I../libs/drmingw/include
|
||||
LDFLAGS+=-L../libs/drmingw/lib/win32
|
||||
LIBS+=-lmgwhelp -lexchndl
|
||||
endif
|
||||
|
||||
# name of the exefile
|
||||
ifdef SDL
|
||||
EXENAME?=srb2kart.exe
|
||||
|
|
@ -142,4 +152,15 @@ ifdef MINGW64
|
|||
else
|
||||
CURL_LDFLAGS+=-L../libs/curl/lib32 -lcurl
|
||||
endif #MINGW64
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef HAVE_DISCORDRPC
|
||||
ifdef MINGW64
|
||||
CPPFLAGS+=-I../libs/discord-rpc/win64-dynamic/include
|
||||
LDFLAGS+=-L../libs/discord-rpc/win64-dynamic/lib
|
||||
else
|
||||
CPPFLAGS+=-I../libs/discord-rpc/win32-dynamic/include
|
||||
LDFLAGS+=-L../libs/discord-rpc/win32-dynamic/lib
|
||||
endif
|
||||
LIBS+=-ldiscord-rpc
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
|
|||
}
|
||||
else
|
||||
{
|
||||
const char *zonttl = (mapheaderinfo[prevmap]->zonttl[0] ? mapheaderinfo[prevmap]->zonttl : "ZONE");
|
||||
const char *zonttl = (mapheaderinfo[prevmap]->zonttl[0] ? mapheaderinfo[prevmap]->zonttl : "Zone");
|
||||
if (mapheaderinfo[prevmap]->actnum[0])
|
||||
snprintf(data.match.levelstring,
|
||||
sizeof data.match.levelstring,
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
SRB2Kart Install Instructions
|
||||
|
||||
1. Move every file from the "new-install" folder to this main install folder.
|
||||
|
||||
2. DELETE "staging.bat" and "staging.txt"! These can mess up your installation if run by accident!
|
||||
|
||||
3. Optionally, create a folder in your user profile named "SRB2Kart". This is where your game data and addons may live. For example,
|
||||
|
||||
C:\Users\[User]\SRB2Kart
|
||||
|
||||
4. Run the game! Double-click srb2kart.exe -- or see if you have Start Menu icons under "SRB2Kart".
|
||||
Loading…
Reference in a new issue