From 8a032256bf29f2c86ebcfaf5a9da3cdb49e890c2 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 1 May 2020 17:25:39 +0100 Subject: [PATCH 001/141] don't define __USE_MINGW_ANSI_STDIO in makefiles (according to modern MinGW versions, defining this macro directly is deprecated) --- src/win32/Makefile.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg index 27926b208..90ebbd794 100644 --- a/src/win32/Makefile.cfg +++ b/src/win32/Makefile.cfg @@ -59,7 +59,8 @@ endif ifndef SDL OPTS+=-D_WINDOWS endif - OPTS+=-D__USE_MINGW_ANSI_STDIO=0 + # Do we need this? + #OPTS+=-D__USE_MINGW_ANSI_STDIO=0 ifndef SDL LIBS+=-lmingw32 -mwindows -ldinput -ldxguid -lgdi32 -lwinmm From 43e53368b5ca27d55e05f9ece3013f6f8209aaa9 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 12 Jul 2020 21:31:25 +0100 Subject: [PATCH 002/141] added tabbing to some of the preprocessor code in i_tcp.c and mserv.c to make it easier to read them (and to allow me to understand what I need to do for the next commit) --- src/i_tcp.c | 196 ++++++++++++++++++++++++++-------------------------- src/mserv.c | 76 ++++++++++---------- 2 files changed, 135 insertions(+), 137 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index 5180869a5..3c5923d2c 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -20,127 +20,127 @@ #endif #ifndef NO_IPV6 -#define HAVE_IPV6 + #define HAVE_IPV6 #endif #ifdef _WIN32 -#define USE_WINSOCK -#if defined (_WIN64) || defined (HAVE_IPV6) -#define USE_WINSOCK2 -#else //_WIN64/HAVE_IPV6 -#define USE_WINSOCK1 -#endif + #define USE_WINSOCK + #if defined (_WIN64) || defined (HAVE_IPV6) + #define USE_WINSOCK2 + #else //_WIN64/HAVE_IPV6 + #define USE_WINSOCK1 + #endif #endif //WIN32 OS #ifdef USE_WINSOCK2 -#include + #include #endif #include "doomdef.h" #if defined (NOMD5) && !defined (NONET) -//#define NONET + //#define NONET #endif #ifdef NONET -#undef HAVE_MINIUPNPC + #undef HAVE_MINIUPNPC #else -#ifdef USE_WINSOCK1 -#include -#elif !defined (SCOUW2) && !defined (SCOUW7) -#ifndef USE_WINSOCK -#include -#endif //normal BSD API + #ifdef USE_WINSOCK1 + #include + #elif !defined (SCOUW2) && !defined (SCOUW7) + #ifndef USE_WINSOCK + #include + #endif //normal BSD API -#ifndef USE_WINSOCK -#ifdef __APPLE_CC__ -#ifndef _BSD_SOCKLEN_T_ -#define _BSD_SOCKLEN_T_ -#endif //_BSD_SOCKLEN_T_ -#endif //__APPLE_CC__ -#include -#include -#endif //normal BSD API + #ifndef USE_WINSOCK + #ifdef __APPLE_CC__ + #ifndef _BSD_SOCKLEN_T_ + #define _BSD_SOCKLEN_T_ + #endif //_BSD_SOCKLEN_T_ + #endif //__APPLE_CC__ + #include + #include + #endif //normal BSD API -#ifndef USE_WINSOCK -#include -#include -#endif //normal BSD API + #ifndef USE_WINSOCK + #include + #include + #endif //normal BSD API -#include -#include + #include + #include -#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) - #include -#endif // UNIXCOMMON -#endif // !NONET + #if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) + #include + #endif // UNIXCOMMON + #endif // !defined (SCOUW2) && !defined (SCOUW7)) -#ifdef USE_WINSOCK - // some undefined under win32 - #undef errno - //#define errno WSAGetLastError() //Alam_GBC: this is the correct way, right? - #define errno h_errno // some very strange things happen when not using h_error?!? - #ifdef EWOULDBLOCK - #undef EWOULDBLOCK - #endif - #define EWOULDBLOCK WSAEWOULDBLOCK - #ifdef EMSGSIZE - #undef EMSGSIZE - #endif - #define EMSGSIZE WSAEMSGSIZE - #ifdef ECONNREFUSED - #undef ECONNREFUSED - #endif - #define ECONNREFUSED WSAECONNREFUSED - #ifdef ETIMEDOUT - #undef ETIMEDOUT - #endif - #define ETIMEDOUT WSAETIMEDOUT - #ifndef IOC_VENDOR - #define IOC_VENDOR 0x18000000 - #endif - #ifndef _WSAIOW - #define _WSAIOW(x,y) (IOC_IN|(x)|(y)) - #endif - #ifndef SIO_UDP_CONNRESET - #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12) - #endif - #ifndef AI_ADDRCONFIG - #define AI_ADDRCONFIG 0x00000400 - #endif - #ifndef STATUS_INVALID_PARAMETER - #define STATUS_INVALID_PARAMETER 0xC000000D - #endif -#endif + #ifdef USE_WINSOCK + // some undefined under win32 + #undef errno + //#define errno WSAGetLastError() //Alam_GBC: this is the correct way, right? + #define errno h_errno // some very strange things happen when not using h_error?!? + #ifdef EWOULDBLOCK + #undef EWOULDBLOCK + #endif + #define EWOULDBLOCK WSAEWOULDBLOCK + #ifdef EMSGSIZE + #undef EMSGSIZE + #endif + #define EMSGSIZE WSAEMSGSIZE + #ifdef ECONNREFUSED + #undef ECONNREFUSED + #endif + #define ECONNREFUSED WSAECONNREFUSED + #ifdef ETIMEDOUT + #undef ETIMEDOUT + #endif + #define ETIMEDOUT WSAETIMEDOUT + #ifndef IOC_VENDOR + #define IOC_VENDOR 0x18000000 + #endif + #ifndef _WSAIOW + #define _WSAIOW(x,y) (IOC_IN|(x)|(y)) + #endif + #ifndef SIO_UDP_CONNRESET + #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12) + #endif + #ifndef AI_ADDRCONFIG + #define AI_ADDRCONFIG 0x00000400 + #endif + #ifndef STATUS_INVALID_PARAMETER + #define STATUS_INVALID_PARAMETER 0xC000000D + #endif + #endif // USE_WINSOCK -#ifdef __DJGPP__ -#ifdef WATTCP // Alam_GBC: Wattcp may need this -#include -#define strerror strerror_s -#else // wattcp -#include -#endif // libsocket -#endif // djgpp + #ifdef __DJGPP__ + #ifdef WATTCP // Alam_GBC: Wattcp may need this + #include + #define strerror strerror_s + #else // wattcp + #include + #endif // libsocket + #endif // djgpp -typedef union -{ - struct sockaddr any; - struct sockaddr_in ip4; -#ifdef HAVE_IPV6 - struct sockaddr_in6 ip6; -#endif -} mysockaddr_t; + typedef union + { + struct sockaddr any; + struct sockaddr_in ip4; + #ifdef HAVE_IPV6 + struct sockaddr_in6 ip6; + #endif + } mysockaddr_t; -#ifdef HAVE_MINIUPNPC -#ifdef STATIC_MINIUPNPC -#define STATICLIB -#endif -#include "miniupnpc/miniwget.h" -#include "miniupnpc/miniupnpc.h" -#include "miniupnpc/upnpcommands.h" -#undef STATICLIB -static UINT8 UPNP_support = TRUE; -#endif + #ifdef HAVE_MINIUPNPC + #ifdef STATIC_MINIUPNPC + #define STATICLIB + #endif + #include "miniupnpc/miniwget.h" + #include "miniupnpc/miniupnpc.h" + #include "miniupnpc/upnpcommands.h" + #undef STATICLIB + static UINT8 UPNP_support = TRUE; + #endif // HAVE_MINIUPNC #endif // !NONET diff --git a/src/mserv.c b/src/mserv.c index 05a5344ba..58fb36bcb 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -19,37 +19,35 @@ #include #if (defined (NOMSERV)) && !defined (NONET) -#define NONET + #define NONET #endif #ifndef NONET + #ifndef NO_IPV6 + #define HAVE_IPV6 + #endif + #ifdef _WIN32 + #define RPC_NO_WINDOWS_H + #ifdef HAVE_IPV6 + #include + #else + #include // socket(),... + #endif //!HAVE_IPV6 + #else + #include + #ifdef __APPLE_CC__ + #ifndef _BSD_SOCKLEN_T_ + #define _BSD_SOCKLEN_T_ + #endif + #endif + #include // socket(),... + #include // sockaddr_in + #include // getaddrinfo(),... + #include -#ifndef NO_IPV6 -#define HAVE_IPV6 -#endif - -#ifdef _WIN32 -#define RPC_NO_WINDOWS_H -#ifdef HAVE_IPV6 -#include -#else -#include // socket(),... -#endif //!HAVE_IPV6 -#else -#include -#ifdef __APPLE_CC__ -#ifndef _BSD_SOCKLEN_T_ -#define _BSD_SOCKLEN_T_ -#endif -#endif -#include // socket(),... -#include // sockaddr_in -#include // getaddrinfo(),... -#include - -#include // timeval,... (TIMEOUT) -#include -#endif // _WIN32 + #include // timeval,... (TIMEOUT) + #include + #endif // _WIN32 #endif // !NONET #include "doomstat.h" @@ -155,18 +153,18 @@ typedef struct // win32 or djgpp #if defined (_WIN32) || defined (__DJGPP__) -#define ioctl ioctlsocket -#define close closesocket -#ifdef WATTCP -#define strerror strerror_s -#endif -#ifdef _WIN32 -#undef errno -#define errno h_errno // some very strange things happen when not using h_error -#endif -#ifndef AI_ADDRCONFIG -#define AI_ADDRCONFIG 0x00000400 -#endif + #define ioctl ioctlsocket + #define close closesocket + #ifdef WATTCP + #define strerror strerror_s + #endif + #ifdef _WIN32 + #undef errno + #define errno h_errno // some very strange things happen when not using h_error + #endif + #ifndef AI_ADDRCONFIG + #define AI_ADDRCONFIG 0x00000400 + #endif #endif #ifndef NONET From e133d8ec373b35e9b4e4a11bd0f8d09adb46d51e Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 12 Jul 2020 22:08:35 +0100 Subject: [PATCH 003/141] i_tcp.c: SCOUW2 and SCOUW7 haven't been defined since we got rid of Doom Legacy's makefiles for UnixWare 2/7 (which are ANCIENT), so get rid of them! --- src/i_tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index 3c5923d2c..e20e43ea4 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -47,7 +47,7 @@ #else #ifdef USE_WINSOCK1 #include - #elif !defined (SCOUW2) && !defined (SCOUW7) + #else #ifndef USE_WINSOCK #include #endif //normal BSD API @@ -73,7 +73,7 @@ #if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #include #endif // UNIXCOMMON - #endif // !defined (SCOUW2) && !defined (SCOUW7)) + #endif #ifdef USE_WINSOCK // some undefined under win32 From 0f4487eb68475d772b24469815c82f429c98abbb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 12 Jul 2020 22:24:10 +0100 Subject: [PATCH 004/141] * i_tcp.c: merge these three ifndef USE_WINSOCK blocks together * mserv.c: added i_tcp.c's USE_WINSOCK macros so socklen_t isn't redundantly defined if Winsock 2 is used --- src/i_tcp.c | 6 ------ src/mserv.c | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index e20e43ea4..4738b9df8 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -50,9 +50,6 @@ #else #ifndef USE_WINSOCK #include - #endif //normal BSD API - - #ifndef USE_WINSOCK #ifdef __APPLE_CC__ #ifndef _BSD_SOCKLEN_T_ #define _BSD_SOCKLEN_T_ @@ -60,9 +57,6 @@ #endif //__APPLE_CC__ #include #include - #endif //normal BSD API - - #ifndef USE_WINSOCK #include #include #endif //normal BSD API diff --git a/src/mserv.c b/src/mserv.c index 58fb36bcb..84fdca80e 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -22,6 +22,19 @@ #define NONET #endif +#ifndef NO_IPV6 + #define HAVE_IPV6 +#endif + +#ifdef _WIN32 + #define USE_WINSOCK + #if /*defined (_WIN64) ||*/ defined (HAVE_IPV6) + #define USE_WINSOCK2 + #else //_WIN64/HAVE_IPV6 + #define USE_WINSOCK1 + #endif +#endif //WIN32 OS + #ifndef NONET #ifndef NO_IPV6 #define HAVE_IPV6 @@ -196,7 +209,7 @@ typedef unsigned long SOCKET_TYPE; #define ERRSOCKET (-1) #endif -#if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (_WIN32) +#if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1) typedef int socklen_t; #endif From b8a794e37fb5e0c8be987585c940637aa066b7eb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 12 Jul 2020 22:29:15 +0100 Subject: [PATCH 005/141] socklen_t isn't actually needed in either i_tcp.c or mserv.c if NONET is on! (also added some more tabbing) --- src/i_tcp.c | 43 +++++++++++++++++++++---------------------- src/mserv.c | 31 +++++++++++++++---------------- 2 files changed, 36 insertions(+), 38 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index 4738b9df8..efd381765 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -171,32 +171,31 @@ #define DEFAULTPORT "5029" #if defined (USE_WINSOCK) && !defined (NONET) -typedef SOCKET SOCKET_TYPE; -#define ERRSOCKET (SOCKET_ERROR) + typedef SOCKET SOCKET_TYPE; + #define ERRSOCKET (SOCKET_ERROR) #else -#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__) -typedef int SOCKET_TYPE; -#else -typedef unsigned long SOCKET_TYPE; -#endif -#define ERRSOCKET (-1) -#endif - -#if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1) -typedef int socklen_t; + #if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__) + typedef int SOCKET_TYPE; + #else + typedef unsigned long SOCKET_TYPE; + #endif + #define ERRSOCKET (-1) #endif #ifndef NONET -static SOCKET_TYPE mysockets[MAXNETNODES+1] = {ERRSOCKET}; -static size_t mysocketses = 0; -static int myfamily[MAXNETNODES+1] = {0}; -static SOCKET_TYPE nodesocket[MAXNETNODES+1] = {ERRSOCKET}; -static mysockaddr_t clientaddress[MAXNETNODES+1]; -static mysockaddr_t broadcastaddress[MAXNETNODES+1]; -static size_t broadcastaddresses = 0; -static boolean nodeconnected[MAXNETNODES+1]; -static mysockaddr_t banned[MAXBANS]; -static UINT8 bannedmask[MAXBANS]; + #if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1) + typedef int socklen_t; + #endif + static SOCKET_TYPE mysockets[MAXNETNODES+1] = {ERRSOCKET}; + static size_t mysocketses = 0; + static int myfamily[MAXNETNODES+1] = {0}; + static SOCKET_TYPE nodesocket[MAXNETNODES+1] = {ERRSOCKET}; + static mysockaddr_t clientaddress[MAXNETNODES+1]; + static mysockaddr_t broadcastaddress[MAXNETNODES+1]; + static size_t broadcastaddresses = 0; + static boolean nodeconnected[MAXNETNODES+1]; + static mysockaddr_t banned[MAXBANS]; + static UINT8 bannedmask[MAXBANS]; #endif static size_t numbans = 0; diff --git a/src/mserv.c b/src/mserv.c index 84fdca80e..da163d7f6 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -198,26 +198,25 @@ static INT32 msnode = -1; UINT16 current_port = 0; #if defined (_WIN32) && !defined (NONET) -typedef SOCKET SOCKET_TYPE; -#define ERRSOCKET (SOCKET_ERROR) + typedef SOCKET SOCKET_TYPE; + #define ERRSOCKET (SOCKET_ERROR) #else -#if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__) -typedef int SOCKET_TYPE; -#else -typedef unsigned long SOCKET_TYPE; -#endif -#define ERRSOCKET (-1) -#endif - -#if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1) -typedef int socklen_t; + #if (defined (__unix__) && !defined (MSDOS)) || defined (__APPLE__) || defined (__HAIKU__) + typedef int SOCKET_TYPE; + #else + typedef unsigned long SOCKET_TYPE; + #endif + #define ERRSOCKET (-1) #endif #ifndef NONET -static SOCKET_TYPE socket_fd = ERRSOCKET; // WINSOCK socket -static struct timeval select_timeout; -static fd_set wset; -static size_t recvfull(SOCKET_TYPE s, char *buf, size_t len, int flags); + #if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1) + typedef int socklen_t; + #endif + static SOCKET_TYPE socket_fd = ERRSOCKET; // WINSOCK socket + static struct timeval select_timeout; + static fd_set wset; + static size_t recvfull(SOCKET_TYPE s, char *buf, size_t len, int flags); #endif // Room list is an external variable now. From ed70675df35eee1c185f07f8a774fa9c44117d5b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 12 Jul 2020 22:37:36 +0100 Subject: [PATCH 006/141] added some helpful comments, remove duplicate code --- src/i_tcp.c | 1 + src/mserv.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index efd381765..ab8a69a9f 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -183,6 +183,7 @@ #endif #ifndef NONET + // define socklen_t in DOS/Windows if it is not already defined #if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1) typedef int socklen_t; #endif diff --git a/src/mserv.c b/src/mserv.c index da163d7f6..72243e950 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -26,9 +26,11 @@ #define HAVE_IPV6 #endif +// -- Monster Iestyn 12/07/20 +// define Winsock related macros like in i_tcp.c (this is really all for socklen_t tbh) #ifdef _WIN32 #define USE_WINSOCK - #if /*defined (_WIN64) ||*/ defined (HAVE_IPV6) + #if /*defined (_WIN64) ||*/ defined (HAVE_IPV6) // (to be consistent with below code) #define USE_WINSOCK2 #else //_WIN64/HAVE_IPV6 #define USE_WINSOCK1 @@ -36,9 +38,6 @@ #endif //WIN32 OS #ifndef NONET - #ifndef NO_IPV6 - #define HAVE_IPV6 - #endif #ifdef _WIN32 #define RPC_NO_WINDOWS_H #ifdef HAVE_IPV6 @@ -210,6 +209,7 @@ UINT16 current_port = 0; #endif #ifndef NONET + // define socklen_t in DOS/Windows if it is not already defined #if (defined (WATTCP) && !defined (__libsocket_socklen_t)) || defined (USE_WINSOCK1) typedef int socklen_t; #endif From 3b79ca4fae6fce10d9a45bbc3fa81e0d66cc9600 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 18 Oct 2020 16:00:01 -0500 Subject: [PATCH 007/141] Improved text colormaps --- src/console.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/console.c b/src/console.c index 3eee67bb8..76c46538c 100644 --- a/src/console.c +++ b/src/console.c @@ -359,27 +359,31 @@ static void CON_SetupColormaps(void) for (i = 0; i < (256*15); i++, ++memorysrc) *memorysrc = (UINT8)(i & 0xFF); // remap each color to itself... -#define colset(map, a, b, c) \ +#define colset(map, a, b, c, d, e) \ map[1] = (UINT8)a;\ - map[3] = (UINT8)b;\ - map[9] = (UINT8)c + map[2] = (UINT8)b;\ + map[3] = (UINT8)c;\ + map[8] = (UINT8)d;\ + map[9] = (UINT8)e - colset(magentamap, 177, 178, 184); - colset(yellowmap, 82, 73, 66); - colset(lgreenmap, 97, 98, 106); - colset(bluemap, 146, 147, 155); - colset(redmap, 210, 32, 39); - colset(graymap, 6, 8, 14); - colset(orangemap, 51, 52, 57); - colset(skymap, 129, 130, 133); - colset(purplemap, 160, 161, 163); - colset(aquamap, 120, 121, 123); - colset(peridotmap, 88, 188, 190); - colset(azuremap, 144, 145, 170); - colset(brownmap, 219, 221, 224); - colset(rosymap, 200, 201, 203); - colset(invertmap, 27, 26, 22); + colset(magentamap, 177, 178, 180, 181, 183); + colset(yellowmap, 82, 73, 74, 75, 76); + colset(lgreenmap, 96, 112, 113, 114, 115); + colset(bluemap, 148, 149, 150, 151, 152); + colset(redmap, 33, 34, 35, 37, 39); + colset(graymap, 9, 11, 13, 15, 17); + colset(orangemap, 50, 52, 54, 56, 58); + colset(skymap, 129, 130, 132, 134, 135); + colset(purplemap, 161, 162, 163, 164, 166); + colset(aquamap, 121, 122, 123, 124, 125); + colset(peridotmap, 73, 188, 189, 190, 191); + colset(azuremap, 144, 145, 170, 171, 172); + colset(brownmap, 224, 226, 228, 230, 232); + colset(rosymap, 200, 201, 202, 203, 204); + colset(invertmap, 30, 29, 27, 25, 23); invertmap[26] = (UINT8)3; + invertmap[30] = (UINT8)1; + invertmap[31] = (UINT8)0; #undef colset From 14aec09d1317ef6cdec97352e383a7418dcba976 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 18 Oct 2020 16:21:06 -0500 Subject: [PATCH 008/141] possibly fixed --- src/console.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/console.c b/src/console.c index 76c46538c..66e04c198 100644 --- a/src/console.c +++ b/src/console.c @@ -360,11 +360,11 @@ static void CON_SetupColormaps(void) *memorysrc = (UINT8)(i & 0xFF); // remap each color to itself... #define colset(map, a, b, c, d, e) \ - map[1] = (UINT8)a;\ + map[0] = (UINT8)a;\ map[2] = (UINT8)b;\ - map[3] = (UINT8)c;\ - map[8] = (UINT8)d;\ - map[9] = (UINT8)e + map[4] = (UINT8)c;\ + map[6] = (UINT8)d;\ + map[8] = (UINT8)e colset(magentamap, 177, 178, 180, 181, 183); colset(yellowmap, 82, 73, 74, 75, 76); From 94cee68d4141ae09453c55fdf4eca4623c286707 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 18 Oct 2020 16:41:14 -0500 Subject: [PATCH 009/141] Calloc --- src/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console.c b/src/console.c index 66e04c198..b0eb2ce0f 100644 --- a/src/console.c +++ b/src/console.c @@ -333,7 +333,7 @@ static void CONS_backcolor_Change(void) static void CON_SetupColormaps(void) { INT32 i; - UINT8 *memorysrc = (UINT8 *)Z_Malloc((256*15), PU_STATIC, NULL); + UINT8 *memorysrc = (UINT8 *)Z_Calloc((256*15), PU_STATIC, NULL); magentamap = memorysrc; yellowmap = (magentamap+256); From 2403cbd57ba725c92e028d99467ac8828f1f51c5 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 18 Oct 2020 17:01:31 -0500 Subject: [PATCH 010/141] possibly final --- src/console.c | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/console.c b/src/console.c index b0eb2ce0f..8780bf5d2 100644 --- a/src/console.c +++ b/src/console.c @@ -360,30 +360,33 @@ static void CON_SetupColormaps(void) *memorysrc = (UINT8)(i & 0xFF); // remap each color to itself... #define colset(map, a, b, c, d, e) \ - map[0] = (UINT8)a;\ - map[2] = (UINT8)b;\ - map[4] = (UINT8)c;\ - map[6] = (UINT8)d;\ - map[8] = (UINT8)e + map[1] = (UINT8)a;\ + map[3] = (UINT8)b;\ + map[5] = (UINT8)c;\ + map[7] = (UINT8)d;\ + map[9] = (UINT8)e - colset(magentamap, 177, 178, 180, 181, 183); - colset(yellowmap, 82, 73, 74, 75, 76); - colset(lgreenmap, 96, 112, 113, 114, 115); - colset(bluemap, 148, 149, 150, 151, 152); - colset(redmap, 33, 34, 35, 37, 39); - colset(graymap, 9, 11, 13, 15, 17); - colset(orangemap, 50, 52, 54, 56, 58); - colset(skymap, 129, 130, 132, 134, 135); - colset(purplemap, 161, 162, 163, 164, 166); - colset(aquamap, 121, 122, 123, 124, 125); - colset(peridotmap, 73, 188, 189, 190, 191); - colset(azuremap, 144, 145, 170, 171, 172); - colset(brownmap, 224, 226, 228, 230, 232); - colset(rosymap, 200, 201, 202, 203, 204); - colset(invertmap, 30, 29, 27, 25, 23); - invertmap[26] = (UINT8)3; - invertmap[30] = (UINT8)1; - invertmap[31] = (UINT8)0; + colset(magentamap, 178, 179, 181, 182, 184); + colset(yellowmap, 83, 74, 75, 76, 77); + colset(lgreenmap, 97, 113, 114, 115, 116); + colset(bluemap, 149, 150, 151, 152, 153); + colset(redmap, 34, 35, 36, 38, 40); + colset(graymap, 10, 12, 14, 16, 18); + colset(orangemap, 51, 53, 55, 57, 59); + colset(skymap, 130, 131, 133, 135, 136); + colset(purplemap, 162, 163, 164, 165, 167); + colset(aquamap, 122, 123, 124, 125, 126); + colset(peridotmap, 74, 189, 190, 191, 192); + colset(azuremap, 145, 146, 171, 172, 173); + colset(brownmap, 225, 227, 229, 231, 233); + colset(rosymap, 201, 202, 203, 204, 205); + colset(invertmap, 31, 30, 28, 26, 24); + invertmap[27] = (UINT8)6; + invertmap[28] = (UINT8)5; + invertmap[29] = (UINT8)4; + invertmap[30] = (UINT8)3; + invertmap[31] = (UINT8)2; + invertmap[32] = (UINT8)1; #undef colset From e2d686ba42b42f4b1ab902672b5c10ad0f4a5dd2 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 18 Oct 2020 17:45:46 -0500 Subject: [PATCH 011/141] update --- src/console.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/console.c b/src/console.c index 8780bf5d2..bffa6d18c 100644 --- a/src/console.c +++ b/src/console.c @@ -360,11 +360,11 @@ static void CON_SetupColormaps(void) *memorysrc = (UINT8)(i & 0xFF); // remap each color to itself... #define colset(map, a, b, c, d, e) \ - map[1] = (UINT8)a;\ - map[3] = (UINT8)b;\ - map[5] = (UINT8)c;\ - map[7] = (UINT8)d;\ - map[9] = (UINT8)e + map[1] = (UINT8)a;\ + map[3] = (UINT8)b;\ + map[5] = (UINT8)c;\ + map[9] = (UINT8)d;\ + map[15] = (UINT8)e colset(magentamap, 178, 179, 181, 182, 184); colset(yellowmap, 83, 74, 75, 76, 77); @@ -381,6 +381,7 @@ static void CON_SetupColormaps(void) colset(brownmap, 225, 227, 229, 231, 233); colset(rosymap, 201, 202, 203, 204, 205); colset(invertmap, 31, 30, 28, 26, 24); + invertmap[26] = (UINT8)7; invertmap[27] = (UINT8)6; invertmap[28] = (UINT8)5; invertmap[29] = (UINT8)4; From 5dc90289dc7ced8b21386b78d15dae012ca5d53b Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 18 Oct 2020 21:59:34 -0500 Subject: [PATCH 012/141] thanks goldie --- src/console.c | 68 +++++++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/src/console.c b/src/console.c index bffa6d18c..7927ea925 100644 --- a/src/console.c +++ b/src/console.c @@ -333,7 +333,7 @@ static void CONS_backcolor_Change(void) static void CON_SetupColormaps(void) { INT32 i; - UINT8 *memorysrc = (UINT8 *)Z_Calloc((256*15), PU_STATIC, NULL); + UINT8 *memorysrc = (UINT8 *)Z_Malloc((256*15), PU_STATIC, NULL); magentamap = memorysrc; yellowmap = (magentamap+256); @@ -359,38 +359,48 @@ static void CON_SetupColormaps(void) for (i = 0; i < (256*15); i++, ++memorysrc) *memorysrc = (UINT8)(i & 0xFF); // remap each color to itself... -#define colset(map, a, b, c, d, e) \ - map[1] = (UINT8)a;\ - map[3] = (UINT8)b;\ - map[5] = (UINT8)c;\ - map[9] = (UINT8)d;\ - map[15] = (UINT8)e +#define colset(map, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \ + map[0x0] = (UINT8)a;\ + map[0x1] = (UINT8)b;\ + map[0x2] = (UINT8)c;\ + map[0x3] = (UINT8)d;\ + map[0x4] = (UINT8)e;\ + map[0x5] = (UINT8)f;\ + map[0x6] = (UINT8)g;\ + map[0x7] = (UINT8)h;\ + map[0x8] = (UINT8)i;\ + map[0x9] = (UINT8)j;\ + map[0xA] = (UINT8)k;\ + map[0xB] = (UINT8)l;\ + map[0xC] = (UINT8)m;\ + map[0xD] = (UINT8)n;\ + map[0xE] = (UINT8)o;\ + map[0xF] = (UINT8)p; - colset(magentamap, 178, 179, 181, 182, 184); - colset(yellowmap, 83, 74, 75, 76, 77); - colset(lgreenmap, 97, 113, 114, 115, 116); - colset(bluemap, 149, 150, 151, 152, 153); - colset(redmap, 34, 35, 36, 38, 40); - colset(graymap, 10, 12, 14, 16, 18); - colset(orangemap, 51, 53, 55, 57, 59); - colset(skymap, 130, 131, 133, 135, 136); - colset(purplemap, 162, 163, 164, 165, 167); - colset(aquamap, 122, 123, 124, 125, 126); - colset(peridotmap, 74, 189, 190, 191, 192); - colset(azuremap, 145, 146, 171, 172, 173); - colset(brownmap, 225, 227, 229, 231, 233); - colset(rosymap, 201, 202, 203, 204, 205); - colset(invertmap, 31, 30, 28, 26, 24); - invertmap[26] = (UINT8)7; - invertmap[27] = (UINT8)6; - invertmap[28] = (UINT8)5; - invertmap[29] = (UINT8)4; - invertmap[30] = (UINT8)3; - invertmap[31] = (UINT8)2; - invertmap[32] = (UINT8)1; + // I tried to make them kinda close to the originals, tell me how I did! ~Golden + + // 0x1 0x3 0x9 0xF + colset(magentamap, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, 184, 184); + colset(yellowmap, 82, 82, 72, 73, 74, 74, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67); + colset(lgreenmap, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111); + colset(bluemap, 147, 147, 148, 148, 149, 149, 149, 150, 150, 150, 151, 151, 151, 152, 152, 152); + colset(redmap, 210, 210, 211, 211, 32, 32, 33, 33, 34, 34, 35, 35, 37, 37, 38, 38); + colset(graymap, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); + colset(orangemap, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58); + colset(skymap, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135, 136, 136); + colset(purplemap, 160, 160, 161, 161, 162, 162, 162, 163, 163, 163, 164, 164, 164, 165, 165, 165); + colset(aquamap, 128, 120, 121, 121, 122, 122, 123, 123, 123, 123, 124, 124, 124, 125, 125, 125); + colset(peridotmap, 72, 72, 188, 188, 188, 189, 189, 189, 189, 190, 190, 191, 191, 104, 105, 106); + colset(azuremap, 144, 144, 145, 145, 146, 146, 146, 170, 170, 170, 171, 171, 171, 172, 172, 172); + colset(brownmap, 218, 219, 220, 221, 221, 222, 223, 223, 224, 224, 225, 226, 227, 228, 229, 230); + colset(rosymap, 200, 200, 201, 201, 201, 202, 202, 203, 203, 203, 204, 204, 205, 205, 206, 206); #undef colset + // Yeah just straight up invert it like a normal person + for (i = 0x00; i <= 0x1F; i++) + invertmap[0x1F - i] = i; + // Init back colormap CON_SetupBackColormap(); } From fed2fffaa1debb65e26acab4bddf91fd22d3cb22 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 18 Oct 2020 22:52:40 -0500 Subject: [PATCH 013/141] better colors --- src/console.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/console.c b/src/console.c index 7927ea925..feffdd338 100644 --- a/src/console.c +++ b/src/console.c @@ -378,22 +378,23 @@ static void CON_SetupColormaps(void) map[0xF] = (UINT8)p; // I tried to make them kinda close to the originals, tell me how I did! ~Golden + // decent but i made most of the colors better thanks for th help :3 // 0x1 0x3 0x9 0xF - colset(magentamap, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, 184, 184); + colset(magentamap, 176, 176, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183); colset(yellowmap, 82, 82, 72, 73, 74, 74, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67); - colset(lgreenmap, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111); - colset(bluemap, 147, 147, 148, 148, 149, 149, 149, 150, 150, 150, 151, 151, 151, 152, 152, 152); - colset(redmap, 210, 210, 211, 211, 32, 32, 33, 33, 34, 34, 35, 35, 37, 37, 38, 38); + colset(lgreenmap, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103); + colset(bluemap, 144, 144, 145, 145, 146, 146, 146, 147, 147, 147, 148, 148, 148, 149, 149, 149); + colset(redmap, 210, 210, 210, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35); colset(graymap, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); colset(orangemap, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58); - colset(skymap, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135, 136, 136); - colset(purplemap, 160, 160, 161, 161, 162, 162, 162, 163, 163, 163, 164, 164, 164, 165, 165, 165); - colset(aquamap, 128, 120, 121, 121, 122, 122, 123, 123, 123, 123, 124, 124, 124, 125, 125, 125); - colset(peridotmap, 72, 72, 188, 188, 188, 189, 189, 189, 189, 190, 190, 191, 191, 104, 105, 106); - colset(azuremap, 144, 144, 145, 145, 146, 146, 146, 170, 170, 170, 171, 171, 171, 172, 172, 172); + colset(skymap, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135); + colset(purplemap, 144, 144, 160, 160, 160, 161, 161, 161, 162, 162, 162, 162, 163, 163, 163, 163); + colset(aquamap, 128, 128, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 124, 125, 125, 125); + colset(peridotmap, 72, 72, 188, 188, 188, 189, 189, 189, 189, 190, 190, 191, 191, 104, 104, 104); + colset(azuremap, 144, 144, 145, 145, 146, 146, 146, 147, 147, 147, 170, 170, 170, 171, 171, 171); colset(brownmap, 218, 219, 220, 221, 221, 222, 223, 223, 224, 224, 225, 226, 227, 228, 229, 230); - colset(rosymap, 200, 200, 201, 201, 201, 202, 202, 203, 203, 203, 204, 204, 205, 205, 206, 206); + colset(rosymap, 200, 200, 201, 201, 201, 202, 202, 203, 203, 203, 204, 204, 204, 205, 205, 205); #undef colset From e5c891932aaff1ac8c8f285dd57648079c4d878b Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 18 Oct 2020 23:47:14 -0500 Subject: [PATCH 014/141] improvement --- src/console.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/console.c b/src/console.c index feffdd338..0d32eae85 100644 --- a/src/console.c +++ b/src/console.c @@ -381,13 +381,13 @@ static void CON_SetupColormaps(void) // decent but i made most of the colors better thanks for th help :3 // 0x1 0x3 0x9 0xF - colset(magentamap, 176, 176, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183); + colset(magentamap, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, 184, 184); colset(yellowmap, 82, 82, 72, 73, 74, 74, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67); - colset(lgreenmap, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103); - colset(bluemap, 144, 144, 145, 145, 146, 146, 146, 147, 147, 147, 148, 148, 148, 149, 149, 149); - colset(redmap, 210, 210, 210, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35); + colset(lgreenmap, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104); + colset(bluemap, 147, 147, 147, 148, 148, 148, 149, 149, 149, 150, 150, 151, 151, 151, 152, 152); + colset(redmap, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 37); colset(graymap, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); - colset(orangemap, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58); + colset(orangemap, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59); colset(skymap, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135); colset(purplemap, 144, 144, 160, 160, 160, 161, 161, 161, 162, 162, 162, 162, 163, 163, 163, 163); colset(aquamap, 128, 128, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 124, 125, 125, 125); From d633f2495aeb95f40dce30a7be337621f7f79bee Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 19 Oct 2020 14:12:28 -0500 Subject: [PATCH 015/141] red abd bkyue sikbucx --- src/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/console.c b/src/console.c index 0d32eae85..7b32889ea 100644 --- a/src/console.c +++ b/src/console.c @@ -384,8 +384,8 @@ static void CON_SetupColormaps(void) colset(magentamap, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, 184, 184); colset(yellowmap, 82, 82, 72, 73, 74, 74, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67); colset(lgreenmap, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104); - colset(bluemap, 147, 147, 147, 148, 148, 148, 149, 149, 149, 150, 150, 151, 151, 151, 152, 152); - colset(redmap, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 37); + colset(bluemap, 147, 147, 147, 148, 148, 148, 149, 149, 150, 150, 151, 151, 152, 152, 153, 153); + colset(redmap, 33, 33, 33, 34, 34, 34, 35, 35, 37, 37, 39, 39, 41, 41, 43, 43); colset(graymap, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); colset(orangemap, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59); colset(skymap, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135); From 81c9d2eae9576b6497e9b53749d36ae15739a3db Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 19 Oct 2020 18:41:23 -0500 Subject: [PATCH 016/141] forgot to send this like 3 hours ago --- src/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/console.c b/src/console.c index 7b32889ea..81d3abaac 100644 --- a/src/console.c +++ b/src/console.c @@ -384,8 +384,8 @@ static void CON_SetupColormaps(void) colset(magentamap, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, 184, 184); colset(yellowmap, 82, 82, 72, 73, 74, 74, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67); colset(lgreenmap, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104); - colset(bluemap, 147, 147, 147, 148, 148, 148, 149, 149, 150, 150, 151, 151, 152, 152, 153, 153); - colset(redmap, 33, 33, 33, 34, 34, 34, 35, 35, 37, 37, 39, 39, 41, 41, 43, 43); + colset(bluemap, 146, 146, 147, 147, 148, 148, 149, 149, 150, 150, 151, 151, 152, 152, 153, 153); + colset(redmap, 32, 32, 33, 33, 34, 34, 35, 35, 37, 37, 39, 39, 41, 41, 43, 43); colset(graymap, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); colset(orangemap, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59); colset(skymap, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135); From 04eae86d0a4bfbe0abe762bf705f5c1bddff5579 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 19 Oct 2020 19:58:50 -0500 Subject: [PATCH 017/141] t --- src/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/console.c b/src/console.c index 81d3abaac..239706679 100644 --- a/src/console.c +++ b/src/console.c @@ -384,8 +384,8 @@ static void CON_SetupColormaps(void) colset(magentamap, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, 184, 184); colset(yellowmap, 82, 82, 72, 73, 74, 74, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67); colset(lgreenmap, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104); - colset(bluemap, 146, 146, 147, 147, 148, 148, 149, 149, 150, 150, 151, 151, 152, 152, 153, 153); - colset(redmap, 32, 32, 33, 33, 34, 34, 35, 35, 37, 37, 39, 39, 41, 41, 43, 43); + colset(bluemap, 146, 146, 147, 147, 148, 148, 149, 149, 150, 150, 151, 151, 151, 152, 152, 152); + colset(redmap, 32, 32, 33, 33, 34, 34, 35, 35, 37, 37, 39, 39, 39, 41, 41, 41); colset(graymap, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); colset(orangemap, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59); colset(skymap, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135); From 4e985d71457fde8f342e4069ac5a251b4ed611f6 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 19 Oct 2020 20:36:59 -0500 Subject: [PATCH 018/141] blue & red really seem like a hassle don't they --- src/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/console.c b/src/console.c index 239706679..b66c73bd4 100644 --- a/src/console.c +++ b/src/console.c @@ -384,8 +384,8 @@ static void CON_SetupColormaps(void) colset(magentamap, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, 184, 184); colset(yellowmap, 82, 82, 72, 73, 74, 74, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67); colset(lgreenmap, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104); - colset(bluemap, 146, 146, 147, 147, 148, 148, 149, 149, 150, 150, 151, 151, 151, 152, 152, 152); - colset(redmap, 32, 32, 33, 33, 34, 34, 35, 35, 37, 37, 39, 39, 39, 41, 41, 41); + colset(bluemap, 146, 146, 147, 147, 148, 148, 148, 149, 149, 149, 150, 150, 150, 151, 151, 151); + colset(redmap, 32, 32, 33, 33, 34, 34, 34, 35, 35, 35, 37, 37, 37, 39, 39, 39); colset(graymap, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); colset(orangemap, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59); colset(skymap, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135); From 0b48f1052a1941b5f2fcf7ef790aca319c5ea4bd Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Tue, 20 Oct 2020 14:03:27 -0500 Subject: [PATCH 019/141] pencilvoid aqua --- src/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console.c b/src/console.c index b66c73bd4..ed15e583e 100644 --- a/src/console.c +++ b/src/console.c @@ -390,7 +390,7 @@ static void CON_SetupColormaps(void) colset(orangemap, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59); colset(skymap, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135); colset(purplemap, 144, 144, 160, 160, 160, 161, 161, 161, 162, 162, 162, 162, 163, 163, 163, 163); - colset(aquamap, 128, 128, 120, 120, 121, 121, 122, 122, 123, 123, 124, 124, 124, 125, 125, 125); + colset(aquamap, 128, 120, 120, 121, 121, 122, 123, 123, 123, 124, 124, 124, 125, 125, 126, 126); colset(peridotmap, 72, 72, 188, 188, 188, 189, 189, 189, 189, 190, 190, 191, 191, 104, 104, 104); colset(azuremap, 144, 144, 145, 145, 146, 146, 146, 147, 147, 147, 170, 170, 170, 171, 171, 171); colset(brownmap, 218, 219, 220, 221, 221, 222, 223, 223, 224, 224, 225, 226, 227, 228, 229, 230); From b65ac1df30ad11101ff30e4199181d743478e1f3 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Tue, 20 Oct 2020 14:40:10 -0500 Subject: [PATCH 020/141] sonicx azure --- src/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console.c b/src/console.c index ed15e583e..c181f670c 100644 --- a/src/console.c +++ b/src/console.c @@ -392,7 +392,7 @@ static void CON_SetupColormaps(void) colset(purplemap, 144, 144, 160, 160, 160, 161, 161, 161, 162, 162, 162, 162, 163, 163, 163, 163); colset(aquamap, 128, 120, 120, 121, 121, 122, 123, 123, 123, 124, 124, 124, 125, 125, 126, 126); colset(peridotmap, 72, 72, 188, 188, 188, 189, 189, 189, 189, 190, 190, 191, 191, 104, 104, 104); - colset(azuremap, 144, 144, 145, 145, 146, 146, 146, 147, 147, 147, 170, 170, 170, 171, 171, 171); + colset(azuremap, 144, 144, 145, 145, 146, 146, 146, 170, 170, 170, 171, 171, 171, 172, 172, 172); colset(brownmap, 218, 219, 220, 221, 221, 222, 223, 223, 224, 224, 225, 226, 227, 228, 229, 230); colset(rosymap, 200, 200, 201, 201, 201, 202, 202, 203, 203, 203, 204, 204, 204, 205, 205, 205); From 45dd26476a7d20a8f3ffd041a96e4de9103471bc Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Tue, 20 Oct 2020 14:52:25 -0500 Subject: [PATCH 021/141] SonicX8000 purple, peridot, rosy --- src/console.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/console.c b/src/console.c index c181f670c..64c07f619 100644 --- a/src/console.c +++ b/src/console.c @@ -389,12 +389,12 @@ static void CON_SetupColormaps(void) colset(graymap, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); colset(orangemap, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59); colset(skymap, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135); - colset(purplemap, 144, 144, 160, 160, 160, 161, 161, 161, 162, 162, 162, 162, 163, 163, 163, 163); + colset(purplemap, 144, 144, 160, 160, 161, 161, 161, 162, 162, 162, 163, 163, 163, 164, 164, 164); colset(aquamap, 128, 120, 120, 121, 121, 122, 123, 123, 123, 124, 124, 124, 125, 125, 126, 126); - colset(peridotmap, 72, 72, 188, 188, 188, 189, 189, 189, 189, 190, 190, 191, 191, 104, 104, 104); + colset(peridotmap, 72, 72, 188, 188, 189, 189, 189, 190, 190, 190, 191, 191, 191, 104, 104, 104); colset(azuremap, 144, 144, 145, 145, 146, 146, 146, 170, 170, 170, 171, 171, 171, 172, 172, 172); colset(brownmap, 218, 219, 220, 221, 221, 222, 223, 223, 224, 224, 225, 226, 227, 228, 229, 230); - colset(rosymap, 200, 200, 201, 201, 201, 202, 202, 203, 203, 203, 204, 204, 204, 205, 205, 205); + colset(rosymap, 200, 200, 201, 201, 202, 202, 202, 203, 203, 203, 204, 204, 204, 205, 205, 205); #undef colset From 03198ab31dd9a5e9eb791b1134d55677a2f0c782 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Tue, 20 Oct 2020 14:59:30 -0500 Subject: [PATCH 022/141] SonicX aqua --- src/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console.c b/src/console.c index 64c07f619..daa5f7f1b 100644 --- a/src/console.c +++ b/src/console.c @@ -390,7 +390,7 @@ static void CON_SetupColormaps(void) colset(orangemap, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59); colset(skymap, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135); colset(purplemap, 144, 144, 160, 160, 161, 161, 161, 162, 162, 162, 163, 163, 163, 164, 164, 164); - colset(aquamap, 128, 120, 120, 121, 121, 122, 123, 123, 123, 124, 124, 124, 125, 125, 126, 126); + colset(aquamap, 120, 120, 121, 121, 122, 122, 122, 123, 123, 123, 124, 124, 124, 125, 125, 125); colset(peridotmap, 72, 72, 188, 188, 189, 189, 189, 190, 190, 190, 191, 191, 191, 104, 104, 104); colset(azuremap, 144, 144, 145, 145, 146, 146, 146, 170, 170, 170, 171, 171, 171, 172, 172, 172); colset(brownmap, 218, 219, 220, 221, 221, 222, 223, 223, 224, 224, 225, 226, 227, 228, 229, 230); From 0f771edfd527f5c96d00d8da9d5065ac02f8b9f2 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Tue, 20 Oct 2020 15:11:00 -0500 Subject: [PATCH 023/141] SonicX orange --- src/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console.c b/src/console.c index daa5f7f1b..5d85ca663 100644 --- a/src/console.c +++ b/src/console.c @@ -387,7 +387,7 @@ static void CON_SetupColormaps(void) colset(bluemap, 146, 146, 147, 147, 148, 148, 148, 149, 149, 149, 150, 150, 150, 151, 151, 151); colset(redmap, 32, 32, 33, 33, 34, 34, 34, 35, 35, 35, 37, 37, 37, 39, 39, 39); colset(graymap, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); - colset(orangemap, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59); + colset(orangemap, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58); colset(skymap, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135); colset(purplemap, 144, 144, 160, 160, 161, 161, 161, 162, 162, 162, 163, 163, 163, 164, 164, 164); colset(aquamap, 120, 120, 121, 121, 122, 122, 122, 123, 123, 123, 124, 124, 124, 125, 125, 125); From 88c882fa9cf9845a0331a7f43011c1a8befe2499 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Tue, 20 Oct 2020 19:59:33 -0500 Subject: [PATCH 024/141] 81 --- src/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/console.c b/src/console.c index 5d85ca663..24ec6443c 100644 --- a/src/console.c +++ b/src/console.c @@ -382,7 +382,7 @@ static void CON_SetupColormaps(void) // 0x1 0x3 0x9 0xF colset(magentamap, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, 184, 184); - colset(yellowmap, 82, 82, 72, 73, 74, 74, 64, 64, 65, 65, 65, 66, 66, 66, 67, 67); + colset(yellowmap, 81, 81, 73, 73, 74, 74, 74, 65, 65, 65, 66, 66, 66, 67, 67, 67); colset(lgreenmap, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104); colset(bluemap, 146, 146, 147, 147, 148, 148, 148, 149, 149, 149, 150, 150, 150, 151, 151, 151); colset(redmap, 32, 32, 33, 33, 34, 34, 34, 35, 35, 35, 37, 37, 37, 39, 39, 39); From 288ffebea7d79454e455cb6eb2fc44ff25b94db1 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 24 Oct 2020 15:52:02 -0700 Subject: [PATCH 025/141] Do not save cleared ban list when reloading bans --- src/d_clisrv.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e314d419f..43ac12c93 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2918,16 +2918,14 @@ static void Ban_Add(const char *reason) reasontail = reasonlist; } -static void Command_ClearBans(void) +static void Ban_Clear(void) { banreason_t *temp; - if (!I_ClearBans) - return; - I_ClearBans(); - D_SaveBan(); + reasontail = NULL; + while (reasonhead) { temp = reasonhead->next; @@ -2937,6 +2935,15 @@ static void Command_ClearBans(void) } } +static void Command_ClearBans(void) +{ + if (!I_ClearBans) + return; + + Ban_Clear(); + D_SaveBan(); +} + static void Ban_Load_File(boolean warning) { FILE *f; @@ -2944,6 +2951,9 @@ static void Ban_Load_File(boolean warning) const char *address, *mask; char buffer[MAX_WADPATH]; + if (!I_ClearBans) + return; + f = fopen(va("%s"PATHSEP"%s", srb2home, "ban.txt"), "r"); if (!f) @@ -2953,13 +2963,7 @@ static void Ban_Load_File(boolean warning) return; } - if (I_ClearBans) - Command_ClearBans(); - else - { - fclose(f); - return; - } + Ban_Clear(); for (i=0; fgets(buffer, (int)sizeof(buffer), f); i++) { From 9278f04fbfa6083f10f980c1fe2914c64aae4dfa Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 24 Oct 2020 15:59:11 -0700 Subject: [PATCH 026/141] Delete ban.txt if no bans to save --- src/d_clisrv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 43ac12c93..12145c5c8 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2870,11 +2870,15 @@ void D_SaveBan(void) size_t i; banreason_t *reasonlist = reasonhead; const char *address, *mask; + const char *path = va("%s"PATHSEP"%s", srb2home, "ban.txt"); if (!reasonhead) + { + remove(path); return; + } - f = fopen(va("%s"PATHSEP"%s", srb2home, "ban.txt"), "w"); + f = fopen(path, "w"); if (!f) { From 425b56c2889c9342fb4c4e007be24371816c4e5e Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 6 Nov 2020 13:34:21 -0800 Subject: [PATCH 027/141] Remove win32 specific timer --- src/sdl/i_system.c | 98 ---------------------------------------------- 1 file changed, 98 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 10c0747bf..70ae938e9 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -54,11 +54,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include #endif -#if defined (_WIN32) -DWORD TimeFunction(int requested_frequency); -#else int TimeFunction(int requested_frequency); -#endif #include #ifdef _WIN32 @@ -2044,80 +2040,6 @@ ticcmd_t *I_BaseTiccmd2(void) return &emptycmd2; } -#if defined (_WIN32) -static HMODULE winmm = NULL; -static DWORD starttickcount = 0; // hack for win2k time bug -static p_timeGetTime pfntimeGetTime = NULL; - -// --------- -// I_GetTime -// Use the High Resolution Timer if available, -// else use the multimedia timer which has 1 millisecond precision on Windowz 95, -// but lower precision on Windows NT -// --------- - -DWORD TimeFunction(int requested_frequency) -{ - DWORD newtics = 0; - // this var acts as a multiplier if sub-millisecond precision is asked but is not available - int excess_frequency = requested_frequency / 1000; - - if (!starttickcount) // high precision timer - { - LARGE_INTEGER currtime; // use only LowPart if high resolution counter is not available - static LARGE_INTEGER basetime = {{0, 0}}; - - // use this if High Resolution timer is found - static LARGE_INTEGER frequency; - - if (!basetime.LowPart) - { - if (!QueryPerformanceFrequency(&frequency)) - frequency.QuadPart = 0; - else - QueryPerformanceCounter(&basetime); - } - - if (frequency.LowPart && QueryPerformanceCounter(&currtime)) - { - newtics = (INT32)((currtime.QuadPart - basetime.QuadPart) * requested_frequency - / frequency.QuadPart); - } - else if (pfntimeGetTime) - { - currtime.LowPart = pfntimeGetTime(); - if (!basetime.LowPart) - basetime.LowPart = currtime.LowPart; - if (requested_frequency > 1000) - newtics = currtime.LowPart - basetime.LowPart * excess_frequency; - else - newtics = (currtime.LowPart - basetime.LowPart)/(1000/requested_frequency); - } - } - else - { - if (requested_frequency > 1000) - newtics = (GetTickCount() - starttickcount) * excess_frequency; - else - newtics = (GetTickCount() - starttickcount)/(1000/requested_frequency); - } - - return newtics; -} - -static void I_ShutdownTimer(void) -{ - pfntimeGetTime = NULL; - if (winmm) - { - p_timeEndPeriod pfntimeEndPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeEndPeriod"); - if (pfntimeEndPeriod) - pfntimeEndPeriod(1); - FreeLibrary(winmm); - winmm = NULL; - } -} -#else // // I_GetTime // returns time in 1/TICRATE second tics @@ -2140,7 +2062,6 @@ int TimeFunction(int requested_frequency) return ticks; } -#endif tic_t I_GetTime(void) { @@ -2157,27 +2078,8 @@ int I_GetTimeMicros(void) // void I_StartupTimer(void) { -#ifdef _WIN32 - // for win2k time bug - if (M_CheckParm("-gettickcount")) - { - starttickcount = GetTickCount(); - CONS_Printf("%s", M_GetText("Using GetTickCount()\n")); - } - winmm = LoadLibraryA("winmm.dll"); - if (winmm) - { - p_timeEndPeriod pfntimeBeginPeriod = (p_timeEndPeriod)(LPVOID)GetProcAddress(winmm, "timeBeginPeriod"); - if (pfntimeBeginPeriod) - pfntimeBeginPeriod(1); - pfntimeGetTime = (p_timeGetTime)(LPVOID)GetProcAddress(winmm, "timeGetTime"); - } - I_AddExitFunc(I_ShutdownTimer); -#endif } - - void I_Sleep(void) { if (cv_sleep.value != -1) From 84ce53db60bce109fe87a895d5341ac3f7cd0673 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 7 Nov 2020 01:31:24 -0800 Subject: [PATCH 028/141] Use high precision timer, replace I_GetTimeMicros with I_GetPreciseTime and I_PreciseToMicros --- src/doomtype.h | 4 ++++ src/i_system.h | 8 +++++++- src/sdl/i_system.c | 35 +++++++++++++---------------------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/doomtype.h b/src/doomtype.h index 4e13ba96d..c239c7b8e 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -379,4 +379,8 @@ Needed for some lua shenanigans. #define FIELDFROM( type, field, have, want ) \ (void *)((intptr_t)(field) - offsetof (type, have) + offsetof (type, want)) +#ifdef HAVE_SDL +typedef UINT64 precise_t; +#endif + #endif //__DOOMTYPE__ diff --git a/src/i_system.h b/src/i_system.h index dd0b65f6d..12f0d751d 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -46,7 +46,13 @@ UINT32 I_GetFreeMem(UINT32 *total); */ tic_t I_GetTime(void); -int I_GetTimeMicros(void);// provides microsecond counter for render stats +/** \brief Returns precise time value for performance measurement. + */ +precise_t I_GetPreciseTime(void); + +/** \brief Returns the difference between precise times as microseconds. + */ +int I_PreciseToMicros(precise_t); /** \brief The I_Sleep function diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 70ae938e9..8a70847e1 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -54,8 +54,6 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include #endif -int TimeFunction(int requested_frequency); - #include #ifdef _WIN32 #include @@ -2045,32 +2043,23 @@ ticcmd_t *I_BaseTiccmd2(void) // returns time in 1/TICRATE second tics // -// millisecond precision only -int TimeFunction(int requested_frequency) -{ - static Uint64 basetime = 0; - Uint64 ticks = SDL_GetTicks(); - - if (!basetime) - basetime = ticks; - - ticks -= basetime; - - ticks = (ticks*requested_frequency); - - ticks = (ticks/1000); - - return ticks; -} +static Uint64 timer_frequency; +static Uint64 tic_epoch; tic_t I_GetTime(void) { - return TimeFunction(NEWTICRATE); + const Uint64 now = SDL_GetPerformanceCounter(); + return (now - tic_epoch) * NEWTICRATE / timer_frequency; } -int I_GetTimeMicros(void) +precise_t I_GetPreciseTime(void) { - return TimeFunction(1000000); + return SDL_GetPerformanceCounter(); +} + +int I_PreciseToMicros(precise_t d) +{ + return d / (timer_frequency / 1000000); } // @@ -2078,6 +2067,8 @@ int I_GetTimeMicros(void) // void I_StartupTimer(void) { + timer_frequency = SDL_GetPerformanceFrequency(); + tic_epoch = SDL_GetPerformanceCounter(); } void I_Sleep(void) From e5f37523b846665f3812d75741a590ea132ff681 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 7 Nov 2020 01:32:25 -0800 Subject: [PATCH 029/141] Use precise time for gif timing --- src/m_anigif.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/m_anigif.c b/src/m_anigif.c index 0d3206d11..4e28c3e72 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -18,7 +18,7 @@ #include "z_zone.h" #include "v_video.h" #include "i_video.h" -#include "i_system.h" // I_GetTimeMicros +#include "i_system.h" // I_GetPreciseTime #include "m_misc.h" #include "st_stuff.h" // st_palette @@ -47,8 +47,8 @@ static RGBA_t *gif_framepalette = NULL; static FILE *gif_out = NULL; static INT32 gif_frames = 0; -static UINT32 gif_prevframeus = 0; // "us" is microseconds -static UINT32 gif_delayus = 0; +static precise_t gif_prevframetime = 0; +static UINT32 gif_delayus = 0; // "us" is microseconds static UINT8 gif_writeover = 0; @@ -601,7 +601,7 @@ static void GIF_framewrite(void) if (gif_dynamicdelay) { // golden's attempt at creating a "dynamic delay" UINT16 mingifdelay = 10; // minimum gif delay in milliseconds (keep at 10 because gifs can't get more precise). - gif_delayus += (I_GetTimeMicros() - gif_prevframeus); // increase delay by how much time was spent between last measurement + gif_delayus += I_PreciseToMicros(I_GetPreciseTime() - gif_prevframetime); // increase delay by how much time was spent between last measurement if (gif_delayus/1000 >= mingifdelay) // delay is big enough to be able to effect gif frame delay? { @@ -695,7 +695,7 @@ static void GIF_framewrite(void) } fwrite(gifframe_data, 1, (p - gifframe_data), gif_out); ++gif_frames; - gif_prevframeus = I_GetTimeMicros(); + gif_prevframetime = I_GetPreciseTime(); } @@ -723,7 +723,7 @@ INT32 GIF_open(const char *filename) GIF_headwrite(); gif_frames = 0; - gif_prevframeus = I_GetTimeMicros(); + gif_prevframetime = I_GetPreciseTime(); gif_delayus = 0; return 1; } From b72789b0c90045a6c500663854c73ff17ee067cd Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 7 Nov 2020 01:32:59 -0800 Subject: [PATCH 030/141] Huge perfstats refactor I needed to update it to make it functional with the precise timer. But I also got sick of looking at the mess of sprintf followed by draw call. --- src/d_clisrv.c | 4 +- src/d_main.c | 14 +- src/hardware/hw_batching.c | 8 +- src/hardware/hw_main.c | 38 +- src/hardware/hw_main.h | 14 +- src/lua_hooklib.c | 6 +- src/m_perfstats.c | 807 +++++++++++++++++++------------------ src/m_perfstats.h | 14 +- src/p_tick.c | 18 +- src/r_main.c | 40 +- src/r_main.h | 18 +- 11 files changed, 511 insertions(+), 470 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index e314d419f..d9a7ce62c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -5445,14 +5445,14 @@ void TryRunTics(tic_t realtics) { DEBFILE(va("============ Running tic %d (local %d)\n", gametic, localgametic)); - ps_tictime = I_GetTimeMicros(); + ps_tictime = I_GetPreciseTime(); G_Ticker((gametic % NEWTICRATERATIO) == 0); ExtraDataTicker(); gametic++; consistancy[gametic%BACKUPTICS] = Consistancy(); - ps_tictime = I_GetTimeMicros() - ps_tictime; + ps_tictime = I_GetPreciseTime() - ps_tictime; // Leave a certain amount of tics present in the net buffer as long as we've ran at least one tic this frame. if (client && gamestate == GS_LEVEL && leveltime > 3 && neededtic <= gametic + cv_netticbuffer.value) diff --git a/src/d_main.c b/src/d_main.c index ce1331fe3..caf6f0c22 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -436,7 +436,7 @@ static void D_Display(void) if (!automapactive && !dedicated && cv_renderview.value) { - ps_rendercalltime = I_GetTimeMicros(); + ps_rendercalltime = I_GetPreciseTime(); if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD) { topleft = screens[0] + viewwindowy*vid.width + viewwindowx; @@ -483,7 +483,7 @@ static void D_Display(void) if (postimgtype2) V_DoPostProcessor(1, postimgtype2, postimgparam2); } - ps_rendercalltime = I_GetTimeMicros() - ps_rendercalltime; + ps_rendercalltime = I_GetPreciseTime() - ps_rendercalltime; } if (lastdraw) @@ -497,7 +497,7 @@ static void D_Display(void) lastdraw = false; } - ps_uitime = I_GetTimeMicros(); + ps_uitime = I_GetPreciseTime(); if (gamestate == GS_LEVEL) { @@ -510,7 +510,7 @@ static void D_Display(void) } else { - ps_uitime = I_GetTimeMicros(); + ps_uitime = I_GetPreciseTime(); } } @@ -552,7 +552,7 @@ static void D_Display(void) CON_Drawer(); - ps_uitime = I_GetTimeMicros() - ps_uitime; + ps_uitime = I_GetPreciseTime() - ps_uitime; // // wipe update @@ -638,9 +638,9 @@ static void D_Display(void) M_DrawPerfStats(); } - ps_swaptime = I_GetTimeMicros(); + ps_swaptime = I_GetPreciseTime(); I_FinishUpdate(); // page flip or blit buffer - ps_swaptime = I_GetTimeMicros() - ps_swaptime; + ps_swaptime = I_GetPreciseTime() - ps_swaptime; } needpatchflush = false; diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index 5ea9f55d4..fb3417158 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -248,12 +248,12 @@ void HWR_RenderBatches(void) } // sort polygons - ps_hw_batchsorttime = I_GetTimeMicros(); + ps_hw_batchsorttime = I_GetPreciseTime(); if (cv_glshaders.value && gl_shadersavailable) qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygons); else qsort(polygonIndexArray, polygonArraySize, sizeof(unsigned int), comparePolygonsNoShaders); - ps_hw_batchsorttime = I_GetTimeMicros() - ps_hw_batchsorttime; + ps_hw_batchsorttime = I_GetPreciseTime() - ps_hw_batchsorttime; // sort order // 1. shader // 2. texture @@ -261,7 +261,7 @@ void HWR_RenderBatches(void) // 4. colors + light level // not sure about what order of the last 2 should be, or if it even matters - ps_hw_batchdrawtime = I_GetTimeMicros(); + ps_hw_batchdrawtime = I_GetPreciseTime(); currentShader = polygonArray[polygonIndexArray[0]].shader; currentTexture = polygonArray[polygonIndexArray[0]].texture; @@ -446,7 +446,7 @@ void HWR_RenderBatches(void) polygonArraySize = 0; unsortedVertexArraySize = 0; - ps_hw_batchdrawtime = I_GetTimeMicros() - ps_hw_batchdrawtime; + ps_hw_batchdrawtime = I_GetPreciseTime() - ps_hw_batchdrawtime; } diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4268556e3..3df494272 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -146,11 +146,11 @@ static angle_t gl_aimingangle; static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean skybox); // Render stats -int ps_hw_skyboxtime = 0; -int ps_hw_nodesorttime = 0; -int ps_hw_nodedrawtime = 0; -int ps_hw_spritesorttime = 0; -int ps_hw_spritedrawtime = 0; +precise_t ps_hw_skyboxtime = 0; +precise_t ps_hw_nodesorttime = 0; +precise_t ps_hw_nodedrawtime = 0; +precise_t ps_hw_spritesorttime = 0; +precise_t ps_hw_spritedrawtime = 0; // Render stats for batching int ps_hw_numpolys = 0; @@ -160,8 +160,8 @@ int ps_hw_numshaders = 0; int ps_hw_numtextures = 0; int ps_hw_numpolyflags = 0; int ps_hw_numcolors = 0; -int ps_hw_batchsorttime = 0; -int ps_hw_batchdrawtime = 0; +precise_t ps_hw_batchsorttime = 0; +precise_t ps_hw_batchdrawtime = 0; boolean gl_shadersavailable = true; @@ -4503,7 +4503,7 @@ static void HWR_CreateDrawNodes(void) // that is already lying around. This should all be in some sort of linked list or lists. sortindex = Z_Calloc(sizeof(size_t) * (numplanes + numpolyplanes + numwalls), PU_STATIC, NULL); - ps_hw_nodesorttime = I_GetTimeMicros(); + ps_hw_nodesorttime = I_GetPreciseTime(); for (i = 0; i < numplanes; i++, p++) { @@ -4558,9 +4558,9 @@ static void HWR_CreateDrawNodes(void) } } - ps_hw_nodesorttime = I_GetTimeMicros() - ps_hw_nodesorttime; + ps_hw_nodesorttime = I_GetPreciseTime() - ps_hw_nodesorttime; - ps_hw_nodedrawtime = I_GetTimeMicros(); + ps_hw_nodedrawtime = I_GetPreciseTime(); // Okay! Let's draw it all! Woo! HWD.pfnSetTransform(&atransform); @@ -4597,7 +4597,7 @@ static void HWR_CreateDrawNodes(void) } } - ps_hw_nodedrawtime = I_GetTimeMicros() - ps_hw_nodedrawtime; + ps_hw_nodedrawtime = I_GetPreciseTime() - ps_hw_nodedrawtime; numwalls = 0; numplanes = 0; @@ -5778,10 +5778,10 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) if (viewnumber == 0) // Only do it if it's the first screen being rendered HWD.pfnClearBuffer(true, false, &ClearColor); // Clear the Color Buffer, stops HOMs. Also seems to fix the skybox issue on Intel GPUs. - ps_hw_skyboxtime = I_GetTimeMicros(); + ps_hw_skyboxtime = I_GetPreciseTime(); if (skybox && drawsky) // If there's a skybox and we should be drawing the sky, draw the skybox HWR_RenderSkyboxView(viewnumber, player); // This is drawn before everything else so it is placed behind - ps_hw_skyboxtime = I_GetTimeMicros() - ps_hw_skyboxtime; + ps_hw_skyboxtime = I_GetPreciseTime() - ps_hw_skyboxtime; { // do we really need to save player (is it not the same)? @@ -5894,7 +5894,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) ps_numbspcalls = 0; ps_numpolyobjects = 0; - ps_bsptime = I_GetTimeMicros(); + ps_bsptime = I_GetPreciseTime(); validcount++; @@ -5932,7 +5932,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) } #endif - ps_bsptime = I_GetTimeMicros() - ps_bsptime; + ps_bsptime = I_GetPreciseTime() - ps_bsptime; if (cv_glbatching.value) HWR_RenderBatches(); @@ -5948,12 +5948,12 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) // Draw MD2 and sprites ps_numsprites = gl_visspritecount; - ps_hw_spritesorttime = I_GetTimeMicros(); + ps_hw_spritesorttime = I_GetPreciseTime(); HWR_SortVisSprites(); - ps_hw_spritesorttime = I_GetTimeMicros() - ps_hw_spritesorttime; - ps_hw_spritedrawtime = I_GetTimeMicros(); + ps_hw_spritesorttime = I_GetPreciseTime() - ps_hw_spritesorttime; + ps_hw_spritedrawtime = I_GetPreciseTime(); HWR_DrawSprites(); - ps_hw_spritedrawtime = I_GetTimeMicros() - ps_hw_spritedrawtime; + ps_hw_spritedrawtime = I_GetPreciseTime() - ps_hw_spritedrawtime; #ifdef NEWCORONAS //Hurdler: they must be drawn before translucent planes, what about gl fog? diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 85072dfd9..4db0a9231 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -113,11 +113,11 @@ extern FTransform atransform; // Render stats -extern int ps_hw_skyboxtime; -extern int ps_hw_nodesorttime; -extern int ps_hw_nodedrawtime; -extern int ps_hw_spritesorttime; -extern int ps_hw_spritedrawtime; +extern precise_t ps_hw_skyboxtime; +extern precise_t ps_hw_nodesorttime; +extern precise_t ps_hw_nodedrawtime; +extern precise_t ps_hw_spritesorttime; +extern precise_t ps_hw_spritedrawtime; // Render stats for batching extern int ps_hw_numpolys; @@ -127,8 +127,8 @@ extern int ps_hw_numshaders; extern int ps_hw_numtextures; extern int ps_hw_numpolyflags; extern int ps_hw_numcolors; -extern int ps_hw_batchsorttime; -extern int ps_hw_batchdrawtime; +extern precise_t ps_hw_batchsorttime; +extern precise_t ps_hw_batchdrawtime; extern boolean gl_shadersavailable; diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 65d483dc1..602dbf0ec 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -25,7 +25,7 @@ #include "m_perfstats.h" #include "d_netcmd.h" // for cv_perfstats -#include "i_system.h" // I_GetTimeMicros +#include "i_system.h" // I_GetPreciseTime static UINT8 hooksAvailable[(hook_MAX/8)+1]; @@ -480,7 +480,7 @@ void LUAh_ThinkFrame(void) continue; if (cv_perfstats.value == 3) - time_taken = I_GetTimeMicros(); + time_taken = I_GetPreciseTime(); PushHook(gL, hookp); if (lua_pcall(gL, 0, 0, 1)) { if (!hookp->error || cv_debug & DBG_LUA) @@ -491,7 +491,7 @@ void LUAh_ThinkFrame(void) if (cv_perfstats.value == 3) { lua_Debug ar; - time_taken = I_GetTimeMicros() - time_taken; + time_taken = I_GetPreciseTime() - time_taken; // we need the function, let's just retrieve it again PushHook(gL, hookp); lua_getinfo(gL, ">S", &ar); diff --git a/src/m_perfstats.c b/src/m_perfstats.c index 085adda80..1596a87e5 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -22,32 +22,37 @@ #include "hardware/hw_main.h" #endif -int ps_tictime = 0; +struct perfstatcol; +struct perfstatrow; -int ps_playerthink_time = 0; -int ps_thinkertime = 0; +typedef struct perfstatcol perfstatcol_t; +typedef struct perfstatrow perfstatrow_t; -int ps_thlist_times[NUM_THINKERLISTS]; -static const char* thlist_names[] = { - "Polyobjects: %d", - "Main: %d", - "Mobjs: %d", - "Dynamic slopes: %d", - "Precipitation: %d", - NULL +struct perfstatcol { + INT32 lores_x; + INT32 hires_x; + INT32 color; + perfstatrow_t * rows; }; -static const char* thlist_shortnames[] = { - "plyobjs %d", - "main %d", - "mobjs %d", - "dynslop %d", - "precip %d", - NULL + +struct perfstatrow { + const char * lores_label; + const char * hires_label; + void * value; }; +static precise_t ps_frametime = 0; + +precise_t ps_tictime = 0; + +precise_t ps_playerthink_time = 0; +precise_t ps_thinkertime = 0; + +precise_t ps_thlist_times[NUM_THINKERLISTS]; + int ps_checkposition_calls = 0; -int ps_lua_thinkframe_time = 0; +precise_t ps_lua_thinkframe_time = 0; int ps_lua_mobjhooks = 0; // dynamically allocated resizeable array for thinkframe hook stats @@ -55,6 +60,8 @@ ps_hookinfo_t *thinkframe_hooks = NULL; int thinkframe_hooks_length = 0; int thinkframe_hooks_capacity = 16; +static INT32 draw_row; + void PS_SetThinkFrameHookInfo(int index, UINT32 time_taken, char* short_src) { if (!thinkframe_hooks) @@ -76,379 +83,413 @@ void PS_SetThinkFrameHookInfo(int index, UINT32 time_taken, char* short_src) thinkframe_hooks_length = index + 1; } +static void PS_SetFrameTime(void) +{ + precise_t currenttime = I_GetPreciseTime(); + ps_frametime = currenttime - ps_prevframetime; + ps_prevframetime = currenttime; +} + +static boolean M_HighResolution(void) +{ + return (vid.width >= 640 && vid.height >= 400); +} + +enum { + PERF_TIME, + PERF_COUNT, +}; + +static void M_DrawPerfString(perfstatcol_t *col, int type) +{ + const boolean hires = M_HighResolution(); + + INT32 draw_flags = V_MONOSPACE | col->color; + + perfstatrow_t * row; + + int value; + + if (hires) + draw_flags |= V_ALLOWLOWERCASE; + + for (row = col->rows; row->lores_label; ++row) + { + if (type == PERF_TIME) + value = I_PreciseToMicros(*(precise_t *)row->value); + else + value = *(int *)row->value; + + if (hires) + { + V_DrawSmallString(col->hires_x, draw_row, draw_flags, + va("%s %d", row->hires_label, value)); + + draw_row += 5; + } + else + { + V_DrawThinString(col->lores_x, draw_row, draw_flags, + va("%s %d", row->lores_label, value)); + + draw_row += 8; + } + } +} + +static void M_DrawPerfTiming(perfstatcol_t *col) +{ + M_DrawPerfString(col, PERF_TIME); +} + +static void M_DrawPerfCount(perfstatcol_t *col) +{ + M_DrawPerfString(col, PERF_COUNT); +} + +static void M_DrawRenderStats(void) +{ + const boolean hires = M_HighResolution(); + + const int half_row = hires ? 5 : 4; + + precise_t extrarendertime; + + perfstatrow_t frametime_row[] = { + {"frmtime", "Frame time: ", &ps_frametime}, + {0} + }; + + perfstatrow_t rendercalltime_row[] = { + {"drwtime", "3d rendering: ", &ps_rendercalltime}, + {0} + }; + + perfstatrow_t opengltime_row[] = { + {"skybox ", "Skybox render: ", &ps_hw_skyboxtime}, + {"bsptime", "RenderBSPNode: ", &ps_bsptime}, + {"nodesrt", "Drwnode sort: ", &ps_hw_nodesorttime}, + {"nodedrw", "Drwnode render:", &ps_hw_nodedrawtime}, + {"sprsort", "Sprite sort: ", &ps_hw_spritesorttime}, + {"sprdraw", "Sprite render: ", &ps_hw_spritedrawtime}, + {"other ", "Other: ", &extrarendertime}, + {0} + }; + + perfstatrow_t softwaretime_row[] = { + {"bsptime", "RenderBSPNode: ", &ps_bsptime}, + {"sprclip", "R_ClipSprites: ", &ps_sw_spritecliptime}, + {"portals", "Portals+Skybox:", &ps_sw_portaltime}, + {"planes ", "R_DrawPlanes: ", &ps_sw_planetime}, + {"masked ", "R_DrawMasked: ", &ps_sw_maskedtime}, + {"other ", "Other: ", &extrarendertime}, + {0} + }; + + perfstatrow_t uiswaptime_row[] = { + {"ui ", "UI render: ", &ps_uitime}, + {"finupdt", "I_FinishUpdate:", &ps_swaptime}, + {0} + }; + + perfstatrow_t tictime_row[] = { + {"logic ", "Game logic: ", &ps_tictime}, + {0} + }; + + perfstatrow_t rendercalls_row[] = { + {"bspcall", "BSP calls: ", &ps_numbspcalls}, + {"sprites", "Sprites: ", &ps_numsprites}, + {"drwnode", "Drawnodes: ", &ps_numdrawnodes}, + {"plyobjs", "Polyobjects: ", &ps_numpolyobjects}, + {0} + }; + + perfstatrow_t batchtime_row[] = { + {"batsort", "Batch sort: ", &ps_hw_batchsorttime}, + {"batdraw", "Batch render:", &ps_hw_batchdrawtime}, + {0} + }; + + perfstatrow_t batchcount_row[] = { + {"polygon", "Polygons: ", &ps_hw_numpolys}, + {"vertex ", "Vertices: ", &ps_hw_numverts}, + {0} + }; + + perfstatrow_t batchcalls_row[] = { + {"drwcall", "Draw calls:", &ps_hw_numcalls}, + {"shaders", "Shaders: ", &ps_hw_numshaders}, + {"texture", "Textures: ", &ps_hw_numtextures}, + {"polyflg", "Polyflags: ", &ps_hw_numpolyflags}, + {"colors ", "Colors: ", &ps_hw_numcolors}, + {0} + }; + + perfstatcol_t frametime_col = {20, 20, V_YELLOWMAP, frametime_row}; + perfstatcol_t rendercalltime_col = {20, 20, V_YELLOWMAP, rendercalltime_row}; + + perfstatcol_t opengltime_col = {24, 24, V_YELLOWMAP, opengltime_row}; + perfstatcol_t softwaretime_col = {24, 24, V_YELLOWMAP, softwaretime_row}; + + perfstatcol_t uiswaptime_col = {20, 20, V_YELLOWMAP, uiswaptime_row}; + perfstatcol_t tictime_col = {20, 20, V_GRAYMAP, tictime_row}; + + perfstatcol_t rendercalls_col = {90, 115, V_BLUEMAP, rendercalls_row}; + + perfstatcol_t batchtime_col = {90, 115, V_REDMAP, batchtime_row}; + + perfstatcol_t batchcount_col = {155, 200, V_PURPLEMAP, batchcount_row}; + perfstatcol_t batchcalls_col = {220, 200, V_PURPLEMAP, batchcalls_row}; + + + boolean rendering = ( + gamestate == GS_LEVEL || + (gamestate == GS_TITLESCREEN && titlemapinaction) + ); + + draw_row = 10; + M_DrawPerfTiming(&frametime_col); + + if (rendering) + { + M_DrawPerfTiming(&rendercalltime_col); + + // Remember to update this calculation when adding more 3d rendering stats! + extrarendertime = ps_rendercalltime - ps_bsptime; + +#ifdef HWRENDER + if (rendermode == render_opengl) + { + extrarendertime -= + ps_hw_skyboxtime + + ps_hw_nodesorttime + + ps_hw_nodedrawtime + + ps_hw_spritesorttime + + ps_hw_spritedrawtime; + + if (cv_glbatching.value) + { + extrarendertime -= + ps_hw_batchsorttime + + ps_hw_batchdrawtime; + } + + M_DrawPerfTiming(&opengltime_col); + } + else +#endif + { + extrarendertime -= + ps_sw_spritecliptime + + ps_sw_portaltime + + ps_sw_planetime + + ps_sw_maskedtime; + + M_DrawPerfTiming(&softwaretime_col); + } + } + + M_DrawPerfTiming(&uiswaptime_col); + + draw_row += half_row; + M_DrawPerfTiming(&tictime_col); + + if (rendering) + { + draw_row = 10; + M_DrawPerfCount(&rendercalls_col); + +#ifdef HWRENDER + if (rendermode == render_opengl && cv_glbatching.value) + { + draw_row += half_row; + M_DrawPerfTiming(&batchtime_col); + + draw_row = 10; + M_DrawPerfCount(&batchcount_col); + + if (hires) + draw_row += half_row; + else + draw_row = 10; + + M_DrawPerfCount(&batchcalls_col); + } +#endif + } +} + +static void M_DrawTickStats(void) +{ + int i = 0; + thinker_t *thinker; + int thinkercount = 0; + int polythcount = 0; + int mainthcount = 0; + int mobjcount = 0; + int nothinkcount = 0; + int scenerycount = 0; + int regularcount = 0; + int dynslopethcount = 0; + int precipcount = 0; + int removecount = 0; + + precise_t extratime = + ps_tictime - + ps_playerthink_time - + ps_thinkertime - + ps_lua_thinkframe_time; + + perfstatrow_t tictime_row[] = { + {"logic ", "Game logic: ", &ps_tictime}, + {0} + }; + + perfstatrow_t thinker_time_row[] = { + {"plrthnk", "P_PlayerThink: ", &ps_playerthink_time}, + {"thnkers", "P_RunThinkers: ", &ps_thinkertime}, + {0} + }; + + perfstatrow_t detailed_thinker_time_row[] = { + {"plyobjs", "Polyobjects: ", &ps_thlist_times[THINK_POLYOBJ]}, + {"main ", "Main: ", &ps_thlist_times[THINK_MAIN]}, + {"mobjs ", "Mobjs: ", &ps_thlist_times[THINK_MOBJ]}, + {"dynslop", "Dynamic slopes: ", &ps_thlist_times[THINK_DYNSLOPE]}, + {"precip ", "Precipitation: ", &ps_thlist_times[THINK_PRECIP]}, + {0} + }; + + perfstatrow_t extra_thinker_time_row[] = { + {"lthinkf", "LUAh_ThinkFrame:", &ps_lua_thinkframe_time}, + {"other ", "Other: ", &extratime}, + {0} + }; + + perfstatrow_t thinkercount_row[] = { + {"thnkers", "Thinkers: ", &thinkercount}, + {0} + }; + + perfstatrow_t detailed_thinkercount_row[] = { + {"plyobjs", "Polyobjects: ", &polythcount}, + {"main ", "Main: ", &mainthcount}, + {"mobjs ", "Mobjs: ", &mobjcount}, + {0} + }; + + perfstatrow_t mobjthinkercount_row[] = { + {"regular", "Regular: ", ®ularcount}, + {"scenery", "Scenery: ", &scenerycount}, + {0} + }; + + perfstatrow_t nothinkcount_row[] = { + {"nothink", "Nothink: ", ¬hinkcount}, + {0} + }; + + perfstatrow_t detailed_thinkercount_row2[] = { + {"dynslop", "Dynamic slopes: ", &dynslopethcount}, + {"precip ", "Precipitation: ", &precipcount}, + {"remove ", "Pending removal:", &removecount}, + {0} + }; + + perfstatrow_t misc_calls_row[] = { + {"lmhook", "Lua mobj hooks: ", &ps_lua_mobjhooks}, + {"chkpos", "P_CheckPosition:", &ps_checkposition_calls}, + {0} + }; + + perfstatcol_t tictime_col = {20, 20, V_YELLOWMAP, tictime_row}; + perfstatcol_t thinker_time_col = {24, 24, V_YELLOWMAP, thinker_time_row}; + perfstatcol_t detailed_thinker_time_col = {28, 28, V_YELLOWMAP, detailed_thinker_time_row}; + perfstatcol_t extra_thinker_time_col = {24, 24, V_YELLOWMAP, extra_thinker_time_row}; + + perfstatcol_t thinkercount_col = {90, 115, V_BLUEMAP, thinkercount_row}; + perfstatcol_t detailed_thinkercount_col = {94, 119, V_BLUEMAP, detailed_thinkercount_row}; + perfstatcol_t mobjthinkercount_col = {98, 123, V_BLUEMAP, mobjthinkercount_row}; + perfstatcol_t nothinkcount_col = {98, 123, V_BLUEMAP, nothinkcount_row}; + perfstatcol_t detailed_thinkercount_col2 = {94, 119, V_BLUEMAP, detailed_thinkercount_row2}; + perfstatcol_t misc_calls_col = {170, 216, V_PURPLEMAP, misc_calls_row}; + + for (i = 0; i < NUM_THINKERLISTS; i++) + { + for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next) + { + thinkercount++; + if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + removecount++; + else if (i == THINK_POLYOBJ) + polythcount++; + else if (i == THINK_MAIN) + mainthcount++; + else if (i == THINK_MOBJ) + { + if (thinker->function.acp1 == (actionf_p1)P_MobjThinker) + { + mobj_t *mobj = (mobj_t*)thinker; + mobjcount++; + if (mobj->flags & MF_NOTHINK) + nothinkcount++; + else if (mobj->flags & MF_SCENERY) + scenerycount++; + else + regularcount++; + } + } + else if (i == THINK_DYNSLOPE) + dynslopethcount++; + else if (i == THINK_PRECIP) + precipcount++; + } + } + + draw_row = 10; + M_DrawPerfTiming(&tictime_col); + M_DrawPerfTiming(&thinker_time_col); + M_DrawPerfTiming(&detailed_thinker_time_col); + M_DrawPerfTiming(&extra_thinker_time_col); + + draw_row = 10; + M_DrawPerfCount(&thinkercount_col); + M_DrawPerfCount(&detailed_thinkercount_col); + M_DrawPerfCount(&mobjthinkercount_col); + + if (nothinkcount) + M_DrawPerfCount(¬hinkcount_col); + + M_DrawPerfCount(&detailed_thinkercount_col2); + + if (M_HighResolution()) + { + V_DrawSmallString(212, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, "Calls:"); + + draw_row = 15; + } + else + { + draw_row = 10; + } + + M_DrawPerfCount(&misc_calls_col); +} + void M_DrawPerfStats(void) { char s[100]; - int currenttime = I_GetTimeMicros(); - int frametime = currenttime - ps_prevframetime; - ps_prevframetime = currenttime; + + PS_SetFrameTime(); if (cv_perfstats.value == 1) // rendering { - if (vid.width < 640 || vid.height < 400) // low resolution - { - snprintf(s, sizeof s - 1, "frmtime %d", frametime); - V_DrawThinString(20, 10, V_MONOSPACE | V_YELLOWMAP, s); - if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction))) - { - snprintf(s, sizeof s - 1, "ui %d", ps_uitime); - V_DrawThinString(20, 18, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "finupdt %d", ps_swaptime); - V_DrawThinString(20, 26, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "logic %d", ps_tictime); - V_DrawThinString(20, 38, V_MONOSPACE | V_GRAYMAP, s); - return; - } - snprintf(s, sizeof s - 1, "drwtime %d", ps_rendercalltime); - V_DrawThinString(20, 18, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "bspcall %d", ps_numbspcalls); - V_DrawThinString(90, 10, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "sprites %d", ps_numsprites); - V_DrawThinString(90, 18, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "drwnode %d", ps_numdrawnodes); - V_DrawThinString(90, 26, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "plyobjs %d", ps_numpolyobjects); - V_DrawThinString(90, 34, V_MONOSPACE | V_BLUEMAP, s); -#ifdef HWRENDER - if (rendermode == render_opengl) // OpenGL specific stats - { - snprintf(s, sizeof s - 1, "skybox %d", ps_hw_skyboxtime); - V_DrawThinString(24, 26, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "bsptime %d", ps_bsptime); - V_DrawThinString(24, 34, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "nodesrt %d", ps_hw_nodesorttime); - V_DrawThinString(24, 42, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "nodedrw %d", ps_hw_nodedrawtime); - V_DrawThinString(24, 50, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "sprsort %d", ps_hw_spritesorttime); - V_DrawThinString(24, 58, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "sprdraw %d", ps_hw_spritedrawtime); - V_DrawThinString(24, 66, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "other %d", - ps_rendercalltime - ps_hw_skyboxtime - ps_bsptime - ps_hw_nodesorttime - - ps_hw_nodedrawtime - ps_hw_spritesorttime - ps_hw_spritedrawtime - - ps_hw_batchsorttime - ps_hw_batchdrawtime); - V_DrawThinString(24, 74, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "ui %d", ps_uitime); - V_DrawThinString(20, 82, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "finupdt %d", ps_swaptime); - V_DrawThinString(20, 90, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "logic %d", ps_tictime); - V_DrawThinString(20, 102, V_MONOSPACE | V_GRAYMAP, s); - if (cv_glbatching.value) - { - snprintf(s, sizeof s - 1, "batsort %d", ps_hw_batchsorttime); - V_DrawThinString(90, 46, V_MONOSPACE | V_REDMAP, s); - snprintf(s, sizeof s - 1, "batdraw %d", ps_hw_batchdrawtime); - V_DrawThinString(90, 54, V_MONOSPACE | V_REDMAP, s); - - snprintf(s, sizeof s - 1, "polygon %d", ps_hw_numpolys); - V_DrawThinString(155, 10, V_MONOSPACE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "drwcall %d", ps_hw_numcalls); - V_DrawThinString(155, 18, V_MONOSPACE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "shaders %d", ps_hw_numshaders); - V_DrawThinString(155, 26, V_MONOSPACE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "vertex %d", ps_hw_numverts); - V_DrawThinString(155, 34, V_MONOSPACE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "texture %d", ps_hw_numtextures); - V_DrawThinString(220, 10, V_MONOSPACE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "polyflg %d", ps_hw_numpolyflags); - V_DrawThinString(220, 18, V_MONOSPACE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "colors %d", ps_hw_numcolors); - V_DrawThinString(220, 26, V_MONOSPACE | V_PURPLEMAP, s); - } - else - { - // reset these vars so the "other" measurement isn't off - ps_hw_batchsorttime = 0; - ps_hw_batchdrawtime = 0; - } - } - else // software specific stats -#endif - { - snprintf(s, sizeof s - 1, "bsptime %d", ps_bsptime); - V_DrawThinString(24, 26, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "sprclip %d", ps_sw_spritecliptime); - V_DrawThinString(24, 34, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "portals %d", ps_sw_portaltime); - V_DrawThinString(24, 42, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "planes %d", ps_sw_planetime); - V_DrawThinString(24, 50, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "masked %d", ps_sw_maskedtime); - V_DrawThinString(24, 58, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "other %d", - ps_rendercalltime - ps_bsptime - ps_sw_spritecliptime - - ps_sw_portaltime - ps_sw_planetime - ps_sw_maskedtime); - V_DrawThinString(24, 66, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "ui %d", ps_uitime); - V_DrawThinString(20, 74, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "finupdt %d", ps_swaptime); - V_DrawThinString(20, 82, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "logic %d", ps_tictime); - V_DrawThinString(20, 94, V_MONOSPACE | V_GRAYMAP, s); - } - } - else // high resolution - { - snprintf(s, sizeof s - 1, "Frame time: %d", frametime); - V_DrawSmallString(20, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction))) - { - snprintf(s, sizeof s - 1, "UI render: %d", ps_uitime); - V_DrawSmallString(20, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "I_FinishUpdate: %d", ps_swaptime); - V_DrawSmallString(20, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "Game logic: %d", ps_tictime); - V_DrawSmallString(20, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_GRAYMAP, s); - return; - } - snprintf(s, sizeof s - 1, "3d rendering: %d", ps_rendercalltime); - V_DrawSmallString(20, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "BSP calls: %d", ps_numbspcalls); - V_DrawSmallString(115, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "Sprites: %d", ps_numsprites); - V_DrawSmallString(115, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "Drawnodes: %d", ps_numdrawnodes); - V_DrawSmallString(115, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "Polyobjects: %d", ps_numpolyobjects); - V_DrawSmallString(115, 25, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); -#ifdef HWRENDER - if (rendermode == render_opengl) // OpenGL specific stats - { - snprintf(s, sizeof s - 1, "Skybox render: %d", ps_hw_skyboxtime); - V_DrawSmallString(24, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "RenderBSPNode: %d", ps_bsptime); - V_DrawSmallString(24, 25, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "Drwnode sort: %d", ps_hw_nodesorttime); - V_DrawSmallString(24, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "Drwnode render: %d", ps_hw_nodedrawtime); - V_DrawSmallString(24, 35, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "Sprite sort: %d", ps_hw_spritesorttime); - V_DrawSmallString(24, 40, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "Sprite render: %d", ps_hw_spritedrawtime); - V_DrawSmallString(24, 45, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - // Remember to update this calculation when adding more 3d rendering stats! - snprintf(s, sizeof s - 1, "Other: %d", - ps_rendercalltime - ps_hw_skyboxtime - ps_bsptime - ps_hw_nodesorttime - - ps_hw_nodedrawtime - ps_hw_spritesorttime - ps_hw_spritedrawtime - - ps_hw_batchsorttime - ps_hw_batchdrawtime); - V_DrawSmallString(24, 50, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "UI render: %d", ps_uitime); - V_DrawSmallString(20, 55, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "I_FinishUpdate: %d", ps_swaptime); - V_DrawSmallString(20, 60, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "Game logic: %d", ps_tictime); - V_DrawSmallString(20, 70, V_MONOSPACE | V_ALLOWLOWERCASE | V_GRAYMAP, s); - if (cv_glbatching.value) - { - snprintf(s, sizeof s - 1, "Batch sort: %d", ps_hw_batchsorttime); - V_DrawSmallString(115, 35, V_MONOSPACE | V_ALLOWLOWERCASE | V_REDMAP, s); - snprintf(s, sizeof s - 1, "Batch render: %d", ps_hw_batchdrawtime); - V_DrawSmallString(115, 40, V_MONOSPACE | V_ALLOWLOWERCASE | V_REDMAP, s); - - snprintf(s, sizeof s - 1, "Polygons: %d", ps_hw_numpolys); - V_DrawSmallString(200, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "Vertices: %d", ps_hw_numverts); - V_DrawSmallString(200, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "Draw calls: %d", ps_hw_numcalls); - V_DrawSmallString(200, 25, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "Shaders: %d", ps_hw_numshaders); - V_DrawSmallString(200, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "Textures: %d", ps_hw_numtextures); - V_DrawSmallString(200, 35, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "Polyflags: %d", ps_hw_numpolyflags); - V_DrawSmallString(200, 40, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "Colors: %d", ps_hw_numcolors); - V_DrawSmallString(200, 45, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s); - } - else - { - // reset these vars so the "other" measurement isn't off - ps_hw_batchsorttime = 0; - ps_hw_batchdrawtime = 0; - } - } - else // software specific stats -#endif - { - snprintf(s, sizeof s - 1, "RenderBSPNode: %d", ps_bsptime); - V_DrawSmallString(24, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "R_ClipSprites: %d", ps_sw_spritecliptime); - V_DrawSmallString(24, 25, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "Portals+Skybox: %d", ps_sw_portaltime); - V_DrawSmallString(24, 30, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "R_DrawPlanes: %d", ps_sw_planetime); - V_DrawSmallString(24, 35, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "R_DrawMasked: %d", ps_sw_maskedtime); - V_DrawSmallString(24, 40, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - // Remember to update this calculation when adding more 3d rendering stats! - snprintf(s, sizeof s - 1, "Other: %d", - ps_rendercalltime - ps_bsptime - ps_sw_spritecliptime - - ps_sw_portaltime - ps_sw_planetime - ps_sw_maskedtime); - V_DrawSmallString(24, 45, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "UI render: %d", ps_uitime); - V_DrawSmallString(20, 50, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "I_FinishUpdate: %d", ps_swaptime); - V_DrawSmallString(20, 55, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "Game logic: %d", ps_tictime); - V_DrawSmallString(20, 65, V_MONOSPACE | V_ALLOWLOWERCASE | V_GRAYMAP, s); - } - } + M_DrawRenderStats(); } else if (cv_perfstats.value == 2) // logic { - int i = 0; - thinker_t *thinker; - int thinkercount = 0; - int polythcount = 0; - int mainthcount = 0; - int mobjcount = 0; - int nothinkcount = 0; - int scenerycount = 0; - int dynslopethcount = 0; - int precipcount = 0; - int removecount = 0; - // y offset for drawing columns - int yoffset1 = 0; - int yoffset2 = 0; - - for (i = 0; i < NUM_THINKERLISTS; i++) - { - for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next) - { - thinkercount++; - if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) - removecount++; - else if (i == THINK_POLYOBJ) - polythcount++; - else if (i == THINK_MAIN) - mainthcount++; - else if (i == THINK_MOBJ) - { - if (thinker->function.acp1 == (actionf_p1)P_MobjThinker) - { - mobj_t *mobj = (mobj_t*)thinker; - mobjcount++; - if (mobj->flags & MF_NOTHINK) - nothinkcount++; - else if (mobj->flags & MF_SCENERY) - scenerycount++; - } - } - else if (i == THINK_DYNSLOPE) - dynslopethcount++; - else if (i == THINK_PRECIP) - precipcount++; - } - } - - if (vid.width < 640 || vid.height < 400) // low resolution - { - snprintf(s, sizeof s - 1, "logic %d", ps_tictime); - V_DrawThinString(20, 10, V_MONOSPACE | V_YELLOWMAP, s); - if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction))) - return; - snprintf(s, sizeof s - 1, "plrthnk %d", ps_playerthink_time); - V_DrawThinString(24, 18, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "thnkers %d", ps_thinkertime); - V_DrawThinString(24, 26, V_MONOSPACE | V_YELLOWMAP, s); - for (i = 0; i < NUM_THINKERLISTS; i++) - { - yoffset1 += 8; - snprintf(s, sizeof s - 1, thlist_shortnames[i], ps_thlist_times[i]); - V_DrawThinString(28, 26+yoffset1, V_MONOSPACE | V_YELLOWMAP, s); - } - snprintf(s, sizeof s - 1, "lthinkf %d", ps_lua_thinkframe_time); - V_DrawThinString(24, 34+yoffset1, V_MONOSPACE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "other %d", - ps_tictime - ps_playerthink_time - ps_thinkertime - ps_lua_thinkframe_time); - V_DrawThinString(24, 42+yoffset1, V_MONOSPACE | V_YELLOWMAP, s); - - snprintf(s, sizeof s - 1, "thnkers %d", thinkercount); - V_DrawThinString(90, 10, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "plyobjs %d", polythcount); - V_DrawThinString(94, 18, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "main %d", mainthcount); - V_DrawThinString(94, 26, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "mobjs %d", mobjcount); - V_DrawThinString(94, 34, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "regular %d", mobjcount - scenerycount - nothinkcount); - V_DrawThinString(98, 42, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "scenery %d", scenerycount); - V_DrawThinString(98, 50, V_MONOSPACE | V_BLUEMAP, s); - if (nothinkcount) - { - snprintf(s, sizeof s - 1, "nothink %d", nothinkcount); - V_DrawThinString(98, 58, V_MONOSPACE | V_BLUEMAP, s); - yoffset2 += 8; - } - snprintf(s, sizeof s - 1, "dynslop %d", dynslopethcount); - V_DrawThinString(94, 58+yoffset2, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "precip %d", precipcount); - V_DrawThinString(94, 66+yoffset2, V_MONOSPACE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "remove %d", removecount); - V_DrawThinString(94, 74+yoffset2, V_MONOSPACE | V_BLUEMAP, s); - - snprintf(s, sizeof s - 1, "lmhooks %d", ps_lua_mobjhooks); - V_DrawThinString(170, 10, V_MONOSPACE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "chkpos %d", ps_checkposition_calls); - V_DrawThinString(170, 18, V_MONOSPACE | V_PURPLEMAP, s); - } - else // high resolution - { - snprintf(s, sizeof s - 1, "Game logic: %d", ps_tictime); - V_DrawSmallString(20, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction))) - return; - snprintf(s, sizeof s - 1, "P_PlayerThink: %d", ps_playerthink_time); - V_DrawSmallString(24, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "P_RunThinkers: %d", ps_thinkertime); - V_DrawSmallString(24, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - for (i = 0; i < NUM_THINKERLISTS; i++) - { - yoffset1 += 5; - snprintf(s, sizeof s - 1, thlist_names[i], ps_thlist_times[i]); - V_DrawSmallString(28, 20+yoffset1, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - } - snprintf(s, sizeof s - 1, "LUAh_ThinkFrame: %d", ps_lua_thinkframe_time); - V_DrawSmallString(24, 25+yoffset1, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - snprintf(s, sizeof s - 1, "Other: %d", - ps_tictime - ps_playerthink_time - ps_thinkertime - ps_lua_thinkframe_time); - V_DrawSmallString(24, 30+yoffset1, V_MONOSPACE | V_ALLOWLOWERCASE | V_YELLOWMAP, s); - - snprintf(s, sizeof s - 1, "Thinkers: %d", thinkercount); - V_DrawSmallString(115, 10+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "Polyobjects: %d", polythcount); - V_DrawSmallString(119, 15+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "Main: %d", mainthcount); - V_DrawSmallString(119, 20+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "Mobjs: %d", mobjcount); - V_DrawSmallString(119, 25+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "Regular: %d", mobjcount - scenerycount - nothinkcount); - V_DrawSmallString(123, 30+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "Scenery: %d", scenerycount); - V_DrawSmallString(123, 35+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - if (nothinkcount) - { - snprintf(s, sizeof s - 1, "Nothink: %d", nothinkcount); - V_DrawSmallString(123, 40+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - yoffset2 += 5; - } - snprintf(s, sizeof s - 1, "Dynamic slopes: %d", dynslopethcount); - V_DrawSmallString(119, 40+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "Precipitation: %d", precipcount); - V_DrawSmallString(119, 45+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - snprintf(s, sizeof s - 1, "Pending removal: %d", removecount); - V_DrawSmallString(119, 50+yoffset2, V_MONOSPACE | V_ALLOWLOWERCASE | V_BLUEMAP, s); - - snprintf(s, sizeof s - 1, "Calls:"); - V_DrawSmallString(212, 10, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "Lua mobj hooks: %d", ps_lua_mobjhooks); - V_DrawSmallString(216, 15, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s); - snprintf(s, sizeof s - 1, "P_CheckPosition: %d", ps_checkposition_calls); - V_DrawSmallString(216, 20, V_MONOSPACE | V_ALLOWLOWERCASE | V_PURPLEMAP, s); - } + M_DrawTickStats(); } else if (cv_perfstats.value == 3) // lua thinkframe { diff --git a/src/m_perfstats.h b/src/m_perfstats.h index 01a818c1c..132bea38c 100644 --- a/src/m_perfstats.h +++ b/src/m_perfstats.h @@ -16,17 +16,17 @@ #include "lua_script.h" #include "p_local.h" -extern int ps_tictime; +extern precise_t ps_tictime; -extern int ps_playerthink_time; -extern int ps_thinkertime; +extern precise_t ps_playerthink_time; +extern precise_t ps_thinkertime; -extern int ps_thlist_times[]; +extern precise_t ps_thlist_times[]; -extern int ps_checkposition_calls; +extern int ps_checkposition_calls; -extern int ps_lua_thinkframe_time; -extern int ps_lua_mobjhooks; +extern precise_t ps_lua_thinkframe_time; +extern int ps_lua_mobjhooks; typedef struct { diff --git a/src/p_tick.c b/src/p_tick.c index 451e5e626..19fdc221b 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -22,7 +22,7 @@ #include "lua_script.h" #include "lua_hook.h" #include "m_perfstats.h" -#include "i_system.h" // I_GetTimeMicros +#include "i_system.h" // I_GetPreciseTime // Object place #include "m_cheat.h" @@ -323,7 +323,7 @@ static inline void P_RunThinkers(void) size_t i; for (i = 0; i < NUM_THINKERLISTS; i++) { - ps_thlist_times[i] = I_GetTimeMicros(); + ps_thlist_times[i] = I_GetPreciseTime(); for (currentthinker = thlist[i].next; currentthinker != &thlist[i]; currentthinker = currentthinker->next) { #ifdef PARANOIA @@ -331,7 +331,7 @@ static inline void P_RunThinkers(void) #endif currentthinker->function.acp1(currentthinker); } - ps_thlist_times[i] = I_GetTimeMicros() - ps_thlist_times[i]; + ps_thlist_times[i] = I_GetPreciseTime() - ps_thlist_times[i]; } } @@ -650,11 +650,11 @@ void P_Ticker(boolean run) LUAh_PreThinkFrame(); - ps_playerthink_time = I_GetTimeMicros(); + ps_playerthink_time = I_GetPreciseTime(); for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) P_PlayerThink(&players[i]); - ps_playerthink_time = I_GetTimeMicros() - ps_playerthink_time; + ps_playerthink_time = I_GetPreciseTime() - ps_playerthink_time; } // Keep track of how long they've been playing! @@ -669,18 +669,18 @@ void P_Ticker(boolean run) if (run) { - ps_thinkertime = I_GetTimeMicros(); + ps_thinkertime = I_GetPreciseTime(); P_RunThinkers(); - ps_thinkertime = I_GetTimeMicros() - ps_thinkertime; + ps_thinkertime = I_GetPreciseTime() - ps_thinkertime; // Run any "after all the other thinkers" stuff for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && players[i].mo && !P_MobjWasRemoved(players[i].mo)) P_PlayerAfterThink(&players[i]); - ps_lua_thinkframe_time = I_GetTimeMicros(); + ps_lua_thinkframe_time = I_GetPreciseTime(); LUAh_ThinkFrame(); - ps_lua_thinkframe_time = I_GetTimeMicros() - ps_lua_thinkframe_time; + ps_lua_thinkframe_time = I_GetPreciseTime() - ps_lua_thinkframe_time; } // Run shield positioning diff --git a/src/r_main.c b/src/r_main.c index 5165b3c87..7f2dd6729 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -34,7 +34,7 @@ #include "m_random.h" // quake camera shake #include "r_portal.h" #include "r_main.h" -#include "i_system.h" // I_GetTimeMicros +#include "i_system.h" // I_GetPreciseTime #ifdef HWRENDER #include "hardware/hw_main.h" @@ -100,17 +100,17 @@ lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ]; extracolormap_t *extra_colormaps = NULL; // Render stats -int ps_prevframetime = 0; -int ps_rendercalltime = 0; -int ps_uitime = 0; -int ps_swaptime = 0; +precise_t ps_prevframetime = 0; +precise_t ps_rendercalltime = 0; +precise_t ps_uitime = 0; +precise_t ps_swaptime = 0; -int ps_bsptime = 0; +precise_t ps_bsptime = 0; -int ps_sw_spritecliptime = 0; -int ps_sw_portaltime = 0; -int ps_sw_planetime = 0; -int ps_sw_maskedtime = 0; +precise_t ps_sw_spritecliptime = 0; +precise_t ps_sw_portaltime = 0; +precise_t ps_sw_planetime = 0; +precise_t ps_sw_maskedtime = 0; int ps_numbspcalls = 0; int ps_numsprites = 0; @@ -1491,9 +1491,9 @@ void R_RenderPlayerView(player_t *player) ProfZeroTimer(); #endif ps_numbspcalls = ps_numpolyobjects = ps_numdrawnodes = 0; - ps_bsptime = I_GetTimeMicros(); + ps_bsptime = I_GetPreciseTime(); R_RenderBSPNode((INT32)numnodes - 1); - ps_bsptime = I_GetTimeMicros() - ps_bsptime; + ps_bsptime = I_GetPreciseTime() - ps_bsptime; ps_numsprites = visspritecount; #ifdef TIMING RDMSR(0x10, &mycount); @@ -1504,9 +1504,9 @@ void R_RenderPlayerView(player_t *player) //profile stuff --------------------------------------------------------- Mask_Post(&masks[nummasks - 1]); - ps_sw_spritecliptime = I_GetTimeMicros(); + ps_sw_spritecliptime = I_GetPreciseTime(); R_ClipSprites(drawsegs, NULL); - ps_sw_spritecliptime = I_GetTimeMicros() - ps_sw_spritecliptime; + ps_sw_spritecliptime = I_GetPreciseTime() - ps_sw_spritecliptime; // Add skybox portals caused by sky visplanes. @@ -1514,7 +1514,7 @@ void R_RenderPlayerView(player_t *player) Portal_AddSkyboxPortals(); // Portal rendering. Hijacks the BSP traversal. - ps_sw_portaltime = I_GetTimeMicros(); + ps_sw_portaltime = I_GetPreciseTime(); if (portal_base) { portal_t *portal; @@ -1554,20 +1554,20 @@ void R_RenderPlayerView(player_t *player) Portal_Remove(portal); } } - ps_sw_portaltime = I_GetTimeMicros() - ps_sw_portaltime; + ps_sw_portaltime = I_GetPreciseTime() - ps_sw_portaltime; - ps_sw_planetime = I_GetTimeMicros(); + ps_sw_planetime = I_GetPreciseTime(); R_DrawPlanes(); #ifdef FLOORSPLATS R_DrawVisibleFloorSplats(); #endif - ps_sw_planetime = I_GetTimeMicros() - ps_sw_planetime; + ps_sw_planetime = I_GetPreciseTime() - ps_sw_planetime; // draw mid texture and sprite // And now 3D floors/sides! - ps_sw_maskedtime = I_GetTimeMicros(); + ps_sw_maskedtime = I_GetPreciseTime(); R_DrawMasked(masks, nummasks); - ps_sw_maskedtime = I_GetTimeMicros() - ps_sw_maskedtime; + ps_sw_maskedtime = I_GetPreciseTime() - ps_sw_maskedtime; free(masks); } diff --git a/src/r_main.h b/src/r_main.h index 379b5b8df..eb3d0eedd 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -78,17 +78,17 @@ boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixe // Render stats -extern int ps_prevframetime;// time when previous frame was rendered -extern int ps_rendercalltime; -extern int ps_uitime; -extern int ps_swaptime; +extern precise_t ps_prevframetime;// time when previous frame was rendered +extern precise_t ps_rendercalltime; +extern precise_t ps_uitime; +extern precise_t ps_swaptime; -extern int ps_bsptime; +extern precise_t ps_bsptime; -extern int ps_sw_spritecliptime; -extern int ps_sw_portaltime; -extern int ps_sw_planetime; -extern int ps_sw_maskedtime; +extern precise_t ps_sw_spritecliptime; +extern precise_t ps_sw_portaltime; +extern precise_t ps_sw_planetime; +extern precise_t ps_sw_maskedtime; extern int ps_numbspcalls; extern int ps_numsprites; From 515d7eeb9ea6cd84afffc6e0b93e63bbf3d7635f Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 7 Nov 2020 01:54:54 -0800 Subject: [PATCH 031/141] Let's try an experiment: move the epoch forward as I_GetTime is called This will make it even longer until time wraps around. Have you ever run a srb2 server for 4 years straight? --- src/sdl/i_system.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 8a70847e1..d4ef86c5a 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2044,12 +2044,20 @@ ticcmd_t *I_BaseTiccmd2(void) // static Uint64 timer_frequency; + +static double tic_frequency; static Uint64 tic_epoch; tic_t I_GetTime(void) { + static double elapsed; + const Uint64 now = SDL_GetPerformanceCounter(); - return (now - tic_epoch) * NEWTICRATE / timer_frequency; + + elapsed += (now - tic_epoch) / tic_frequency; + tic_epoch = now; // moving epoch + + return (tic_t)elapsed; } precise_t I_GetPreciseTime(void) @@ -2069,6 +2077,8 @@ void I_StartupTimer(void) { timer_frequency = SDL_GetPerformanceFrequency(); tic_epoch = SDL_GetPerformanceCounter(); + + tic_frequency = timer_frequency / NEWTICRATE; } void I_Sleep(void) From c0dbc562bb186069558bc44dd619d85f41323c4c Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 7 Nov 2020 13:48:37 -0800 Subject: [PATCH 032/141] Fix floating point math --- src/sdl/i_system.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index d4ef86c5a..d2c819c37 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2067,7 +2067,7 @@ precise_t I_GetPreciseTime(void) int I_PreciseToMicros(precise_t d) { - return d / (timer_frequency / 1000000); + return (int)(d / (timer_frequency / 1000000.0)); } // @@ -2078,7 +2078,7 @@ void I_StartupTimer(void) timer_frequency = SDL_GetPerformanceFrequency(); tic_epoch = SDL_GetPerformanceCounter(); - tic_frequency = timer_frequency / NEWTICRATE; + tic_frequency = timer_frequency / (double)NEWTICRATE; } void I_Sleep(void) From 1320f10839cb28d3fe5363a4feeee1cdd6fbb149 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sat, 7 Nov 2020 23:53:46 -0500 Subject: [PATCH 033/141] Allow access to skin.sprites[] Only numframes so far though, as there's already a function for what spriteframe provides. --- src/lua_baselib.c | 2 ++ src/lua_libs.h | 2 ++ src/lua_skinlib.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 132ebc1a8..ab074c8ad 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -162,6 +162,8 @@ static const struct { {META_SKIN, "skin_t"}, {META_POWERS, "player_t.powers"}, {META_SOUNDSID, "skin_t.soundsid"}, + {META_SKINSPRITES, "skin_t.sprites"}, + {META_SKINSPRITESLIST, "skin_t.sprites[]"}, {META_VERTEX, "vertex_t"}, {META_LINE, "line_t"}, diff --git a/src/lua_libs.h b/src/lua_libs.h index 03bd99cd2..82fdccf10 100644 --- a/src/lua_libs.h +++ b/src/lua_libs.h @@ -34,6 +34,8 @@ extern lua_State *gL; #define META_SKIN "SKIN_T*" #define META_POWERS "PLAYER_T*POWERS" #define META_SOUNDSID "SKIN_T*SOUNDSID" +#define META_SKINSPRITES "SKIN_T*SPRITES" +#define META_SKINSPRITESLIST "SKIN_T*SPRITES[]" #define META_VERTEX "VERTEX_T*" #define META_LINE "LINE_T*" diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 3e4ddb9f0..1cd9df631 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -54,7 +54,8 @@ enum skin { skin_contspeed, skin_contangle, skin_soundsid, - skin_availability + skin_availability, + skin_sprites }; static const char *const skin_opt[] = { "valid", @@ -93,6 +94,7 @@ static const char *const skin_opt[] = { "contangle", "soundsid", "availability", + "sprites", NULL}; #define UNIMPLEMENTED luaL_error(L, LUA_QL("skin_t") " field " LUA_QS " is not implemented for Lua and cannot be accessed.", skin_opt[field]) @@ -214,6 +216,9 @@ static int skin_get(lua_State *L) case skin_availability: lua_pushinteger(L, skin->availability); break; + case skin_sprites: + LUA_PushUserdata(L, skin->sprites, META_SKINSPRITES); + break; } return 1; } @@ -324,6 +329,49 @@ static int soundsid_num(lua_State *L) return 1; } +enum spritesopt { + numframes = 0 +}; + +static const char *const sprites_opt[] = { + "numframes", + NULL}; + +// skin.sprites[i] -> sprites[i] +static int lib_getSkinSprite(lua_State *L) +{ + spritedef_t *sprites = *((spritedef_t **)luaL_checkudata(L, 1, META_SKINSPRITES)); + playersprite_t i = luaL_checkinteger(L, 2); + + if (i < 0 || i >= NUMPLAYERSPRITES*2) + return luaL_error(L, "skin.sprites[] index %d out of range (0 - %d)", i, (NUMPLAYERSPRITES*2)-1); + + LUA_PushLightUserdata(L, &sprites[i], META_SKINSPRITESLIST); + return 1; +} + +// #skin.sprites -> NUMPLAYERSPRITES*2 +static int lib_numSkinsSprites(lua_State *L) +{ + lua_pushinteger(L, NUMPLAYERSPRITES*2); + return 1; +} + +static int sprite_get(lua_State *L) +{ + spritedef_t *sprite = (spritedef_t *)luaL_checkudata(L, 1, META_SKINSPRITESLIST); + enum spritesopt field = luaL_checkoption(L, 2, NULL, sprites_opt); + + switch (field) + { + case numframes: + lua_pushinteger(L, sprite->numframes); + break; + } + return 1; +} + + int LUA_SkinLib(lua_State *L) { luaL_newmetatable(L, META_SKIN); @@ -345,6 +393,19 @@ int LUA_SkinLib(lua_State *L) lua_setfield(L, -2, "__len"); lua_pop(L,1); + luaL_newmetatable(L, META_SKINSPRITES); + lua_pushcfunction(L, lib_getSkinSprite); + lua_setfield(L, -2, "__index"); + + lua_pushcfunction(L, lib_numSkinsSprites); + lua_setfield(L, -2, "__len"); + lua_pop(L,1); + + luaL_newmetatable(L, META_SKINSPRITESLIST); + lua_pushcfunction(L, sprite_get); + lua_setfield(L, -2, "__index"); + lua_pop(L,1); + lua_newuserdata(L, 0); lua_createtable(L, 0, 2); lua_pushcfunction(L, lib_getSkin); From 83a87042f1e76c8b378b188e9389830e50de0e3d Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 8 Nov 2020 13:25:56 -0500 Subject: [PATCH 034/141] Push skin->sprites as light userdata --- src/lua_skinlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 1cd9df631..d4d7bae12 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -217,7 +217,7 @@ static int skin_get(lua_State *L) lua_pushinteger(L, skin->availability); break; case skin_sprites: - LUA_PushUserdata(L, skin->sprites, META_SKINSPRITES); + LUA_PushLightUserdata(L, skin->sprites, META_SKINSPRITES); break; } return 1; @@ -340,7 +340,7 @@ static const char *const sprites_opt[] = { // skin.sprites[i] -> sprites[i] static int lib_getSkinSprite(lua_State *L) { - spritedef_t *sprites = *((spritedef_t **)luaL_checkudata(L, 1, META_SKINSPRITES)); + spritedef_t *sprites = (spritedef_t *)luaL_checkudata(L, 1, META_SKINSPRITES); playersprite_t i = luaL_checkinteger(L, 2); if (i < 0 || i >= NUMPLAYERSPRITES*2) From d26172661d6fac5720950c93365609dcf009cc68 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 8 Nov 2020 13:31:59 -0500 Subject: [PATCH 035/141] Remove spritedef field --- src/lua_skinlib.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index d4d7bae12..e2f16756a 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -21,7 +21,6 @@ enum skin { skin_valid = 0, skin_name, - skin_spritedef, skin_wadnum, skin_flags, skin_realname, @@ -60,7 +59,6 @@ enum skin { static const char *const skin_opt[] = { "valid", "name", - "spritedef", "wadnum", "flags", "realname", @@ -115,8 +113,6 @@ static int skin_get(lua_State *L) case skin_name: lua_pushstring(L, skin->name); break; - case skin_spritedef: - return UNIMPLEMENTED; case skin_wadnum: // !!WARNING!! May differ between clients due to music wads, therefore NOT NETWORK SAFE return UNIMPLEMENTED; From 365255990d7454dac7d345bdc719a9c64573c0f3 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Thu, 12 Nov 2020 21:25:31 +0100 Subject: [PATCH 036/141] Add shorthand aliases for fixed-point functions --- src/lua_mathlib.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index 7cbe7a6cc..10ba42ee0 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -192,18 +192,30 @@ static luaL_Reg lib[] = { {"cos", lib_finecosine}, {"tan", lib_finetangent}, {"FixedAngle", lib_fixedangle}, + {"fixangle" , lib_fixedangle}, {"AngleFixed", lib_anglefixed}, + {"anglefix" , lib_anglefixed}, {"InvAngle", lib_invangle}, {"FixedMul", lib_fixedmul}, + {"fixmul" , lib_fixedmul}, {"FixedInt", lib_fixedint}, + {"fixint" , lib_fixedint}, {"FixedDiv", lib_fixeddiv}, + {"fixdiv" , lib_fixeddiv}, {"FixedRem", lib_fixedrem}, + {"fixrem" , lib_fixedrem}, {"FixedSqrt", lib_fixedsqrt}, + {"fixsqrt" , lib_fixedsqrt}, {"FixedHypot", lib_fixedhypot}, + {"fixhypot" , lib_fixedhypot}, {"FixedFloor", lib_fixedfloor}, + {"fixfloor" , lib_fixedfloor}, {"FixedTrunc", lib_fixedtrunc}, + {"fixtrunc" , lib_fixedtrunc}, {"FixedCeil", lib_fixedceil}, + {"fixceil" , lib_fixedceil}, {"FixedRound", lib_fixedround}, + {"fixround" , lib_fixedround}, {"GetSecSpecial", lib_getsecspecial}, {"All7Emeralds", lib_all7emeralds}, {"ColorOpposite", lib_coloropposite}, From 3d1677bade6b46e2973b3df9e90cb962994d09f7 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Thu, 12 Nov 2020 21:33:47 +0100 Subject: [PATCH 037/141] Add a shorthand alias for FRACUNIT --- src/dehacked.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dehacked.c b/src/dehacked.c index 0380cc30e..86c09d03a 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -9511,6 +9511,7 @@ struct { // fixed_t constants, from m_fixed.h {"FRACUNIT",FRACUNIT}, + {"FU" ,FRACUNIT}, {"FRACBITS",FRACBITS}, // doomdef.h constants From 8814980a06acfcc1493b20828a5671594f9bc2e4 Mon Sep 17 00:00:00 2001 From: Riku Salminen <38985578+Riku-S@users.noreply.github.com> Date: Sat, 14 Nov 2020 19:18:36 +0200 Subject: [PATCH 038/141] Emeralds and tokens now reset when restarting marathon mode in first level --- src/g_game.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index 228295b62..528721e2f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2218,6 +2218,10 @@ void G_Ticker(boolean run) { marathonmode |= MA_INIT; marathontime = 0; + + tokenlist = 0; + token = 0; + emeralds = 0; } else if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE && players[consoleplayer].lives != INFLIVES) players[consoleplayer].lives -= 1; From 0a1beab8c80591a90107017b0d0712f74ecba720 Mon Sep 17 00:00:00 2001 From: Riku Salminen <38985578+Riku-S@users.noreply.github.com> Date: Sat, 14 Nov 2020 20:17:35 +0200 Subject: [PATCH 039/141] Reset a couple of other variables while we're at it --- src/g_game.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 528721e2f..d6861b252 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2216,12 +2216,32 @@ void G_Ticker(boolean run) // Costs a life to retry ... unless the player in question is dead already, or you haven't even touched the first starpost in marathon run. if (marathonmode && gamemap == spmarathon_start && !players[consoleplayer].starposttime) { + player_t *p = &players[consoleplayer]; marathonmode |= MA_INIT; marathontime = 0; - tokenlist = 0; - token = 0; - emeralds = 0; + numgameovers = tokenlist = token = 0; + countdown = countdown2 = exitfadestarted = 0; + + p->playerstate = PST_REBORN; + p->starpostx = p->starposty = p->starpostz = 0; + + p->lives = startinglivesbalance[0]; + p->continues = 1; + + p->score = 0; + + // The latter two should clear by themselves, but just in case + p->pflags &= ~(PF_TAGIT|PF_GAMETYPEOVER|PF_FULLSTASIS); + + // Clear cheatcodes too, just in case. + p->pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS); + + p->xtralife = 0; + + // Reset unlockable triggers + unlocktriggers = 0; + } else if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE && players[consoleplayer].lives != INFLIVES) players[consoleplayer].lives -= 1; From fb40a2836597f3aa751f0ac68aab2a87b93ecf02 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Tue, 17 Nov 2020 11:47:33 -0600 Subject: [PATCH 040/141] Do deh thing --- src/p_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_user.c b/src/p_user.c index 10b7e970e..a9194fbb2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4524,6 +4524,7 @@ void P_DoJump(player_t *player, boolean soundandstate) player->mo->eflags &= ~MFE_APPLYPMOMZ; player->pflags |= P_GetJumpFlags(player);; + player->pflags &= ~PF_SPINNING; if (soundandstate) { From ad9bf6085f0845c9fde5348c7299136735a83d84 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Wed, 18 Nov 2020 11:28:31 -0600 Subject: [PATCH 041/141] Fix no spin characters being able to damage enemies with their jump out of a spin without removing PF_SPINNING --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index a9194fbb2..c1b11965b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1135,7 +1135,8 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing) return true; // Spinning. - if (player->pflags & PF_SPINNING) + if ((player->pflags & PF_SPINNING) + && !((player->pflags & PF_JUMPED) && (player->pflags & PF_NOJUMPDAMAGE))) return true; if (player->dashmode >= DASHMODE_THRESHOLD && (player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE)) @@ -4524,7 +4525,6 @@ void P_DoJump(player_t *player, boolean soundandstate) player->mo->eflags &= ~MFE_APPLYPMOMZ; player->pflags |= P_GetJumpFlags(player);; - player->pflags &= ~PF_SPINNING; if (soundandstate) { From 16fd754a398901eb403faff323adbe646451fa36 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Wed, 18 Nov 2020 11:49:17 -0600 Subject: [PATCH 042/141] Allow forcespin sectors to work on no spin characters --- src/p_spec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index a1afdd00d..99a0a0994 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4503,7 +4503,7 @@ DoneSection2: P_InstaThrust(player->mo, player->mo->angle, linespeed); - if ((lines[i].flags & ML_EFFECT5) && (player->charability2 == CA2_SPINDASH)) // Roll! + if (lines[i].flags & ML_EFFECT5) // Roll! { if (!(player->pflags & PF_SPINNING)) player->pflags |= PF_SPINNING; @@ -4669,7 +4669,7 @@ DoneSection2: break; case 7: // Make player spin - if (!(player->pflags & PF_SPINNING) && P_IsObjectOnGround(player->mo) && (player->charability2 == CA2_SPINDASH)) + if (!(player->pflags & PF_SPINNING) && P_IsObjectOnGround(player->mo)) { player->pflags |= PF_SPINNING; P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); From 09644d69c084484762995f27ef3598ef383aa297 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Wed, 18 Nov 2020 12:01:06 -0600 Subject: [PATCH 043/141] Don't force S_PLAY_SPIN when landing with PF_SPINNING if you have certain PA flags --- src/p_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index c1b11965b..9f5484105 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2330,7 +2330,8 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) P_MobjCheckWater(player->mo); if (player->pflags & PF_SPINNING) { - if (player->mo->state-states != S_PLAY_ROLL && !(player->pflags & PF_STARTDASH)) + if (player->mo->state-states != S_PLAY_ROLL && !(player->pflags & PF_STARTDASH) && player->panim != PA_ROLL + && player->panim != PA_ETC && player->panim != PA_ABILITY && player->panim != PA_ABILITY2) { P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); S_StartSound(player->mo, sfx_spin); From 01a03a4daa330958ef4633691e4d150379e0d803 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Wed, 18 Nov 2020 12:03:48 -0600 Subject: [PATCH 044/141] lmao formatting --- src/p_user.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 9f5484105..004ff71d1 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2330,8 +2330,9 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) P_MobjCheckWater(player->mo); if (player->pflags & PF_SPINNING) { - if (player->mo->state-states != S_PLAY_ROLL && !(player->pflags & PF_STARTDASH) && player->panim != PA_ROLL - && player->panim != PA_ETC && player->panim != PA_ABILITY && player->panim != PA_ABILITY2) + if (player->mo->state-states != S_PLAY_ROLL && !(player->pflags & PF_STARTDASH) + && player->panim != PA_ROLL && player->panim != PA_ETC + && player->panim != PA_ABILITY && player->panim != PA_ABILITY2) { P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); S_StartSound(player->mo, sfx_spin); From 7ad8aa14770d923ac3501e44af4eff4ea7cd802e Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Wed, 18 Nov 2020 12:27:09 -0600 Subject: [PATCH 045/141] Allow the Forcespin sector type to be used with intangible fofs Didn't think simply removing the P_IsObjectOnGround was gonna work, but apparently it does. --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 99a0a0994..9e0203619 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4669,7 +4669,7 @@ DoneSection2: break; case 7: // Make player spin - if (!(player->pflags & PF_SPINNING) && P_IsObjectOnGround(player->mo)) + if (!(player->pflags & PF_SPINNING)) { player->pflags |= PF_SPINNING; P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); From 9163e7309227965894719d1bd08d1f68a1c9c08c Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Wed, 18 Nov 2020 12:35:40 -0600 Subject: [PATCH 046/141] Allow no spin characters to water skip while spinning --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 4fc561b20..004207a07 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3393,7 +3393,7 @@ void P_MobjCheckWater(mobj_t *mobj) } // skipping stone! - if (p && (p->charability2 == CA2_SPINDASH) && p->speed/2 > abs(mobj->momz) + if (p && p->speed/2 > abs(mobj->momz) && ((p->pflags & (PF_SPINNING|PF_JUMPED)) == PF_SPINNING) && ((!(mobj->eflags & MFE_VERTICALFLIP) && thingtop - mobj->momz > mobj->watertop) || ((mobj->eflags & MFE_VERTICALFLIP) && mobj->z - mobj->momz < mobj->waterbottom))) From 949c0c181d49cdead1ab094f1635caf10715c41e Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Thu, 15 Oct 2020 10:54:18 -0500 Subject: [PATCH 047/141] Add aPNG downscaling, and its associated consvar. --- src/d_netcmd.c | 1 + src/m_misc.c | 36 +++++++++++++++++++++++++++++------- src/m_misc.h | 2 +- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 87abd596a..0fc5c78c1 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -669,6 +669,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_zlib_strategya); CV_RegisterVar(&cv_zlib_window_bitsa); CV_RegisterVar(&cv_apng_delay); + CV_RegisterVar(&cv_apng_downscale); // GIF variables CV_RegisterVar(&cv_gif_optimize); CV_RegisterVar(&cv_gif_downscale); diff --git a/src/m_misc.c b/src/m_misc.c index d97d8f94b..ad2d133ab 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -163,6 +163,9 @@ consvar_t cv_zlib_levela = CVAR_INIT ("apng_compress_level", "4", CV_SAVE, zlib_ consvar_t cv_zlib_strategya = CVAR_INIT ("apng_strategy", "RLE", CV_SAVE, zlib_strategy_t, NULL); consvar_t cv_zlib_window_bitsa = CVAR_INIT ("apng_window_size", "32k", CV_SAVE, zlib_window_bits_t, NULL); consvar_t cv_apng_delay = CVAR_INIT ("apng_speed", "1x", CV_SAVE, apng_delay_t, NULL); +consvar_t cv_apng_downscale = CVAR_INIT ("apng_downscale", "On", CV_SAVE, CV_OnOff, NULL); + +static boolean apng_downscale = false; // So nobody can do something dumb like changing cvars mid output boolean takescreenshot = false; // Take a screenshot this tic @@ -981,25 +984,38 @@ static inline boolean M_PNGLib(void) static void M_PNGFrame(png_structp png_ptr, png_infop png_info_ptr, png_bytep png_buf) { + png_uint_16 downscale = apng_downscale ? vid.dupx : 1; + png_uint_32 pitch = png_get_rowbytes(png_ptr, png_info_ptr); - PNG_CONST png_uint_32 height = vid.height; - png_bytepp row_pointers = png_malloc(png_ptr, height* sizeof (png_bytep)); - png_uint_32 y; + PNG_CONST png_uint_32 width = vid.width / downscale; + PNG_CONST png_uint_32 height = vid.height / downscale; + png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep)); + png_uint_32 x, y; png_uint_16 framedelay = (png_uint_16)cv_apng_delay.value; apng_frames++; for (y = 0; y < height; y++) { - row_pointers[y] = png_buf; - png_buf += pitch; + row_pointers[y] = malloc(pitch * sizeof(png_byte)); + for (x = 0; x < width; x++) + row_pointers[y][x] = png_buf[x * downscale]; + png_buf += pitch * (downscale * downscale); } + //for (x = 0; x < width; x++) + //{ + // printf("%d", x); + // row_pointers[y][x] = 0; + //} + /* row_pointers[y] = calloc(1, sizeof(png_bytep)); + png_buf += pitch * 2; + }*/ #ifndef PNG_STATIC if (aPNG_write_frame_head) #endif aPNG_write_frame_head(apng_ptr, apng_info_ptr, row_pointers, - vid.width, /* width */ + width, /* width */ height, /* height */ 0, /* x offset */ 0, /* y offset */ @@ -1030,6 +1046,12 @@ static void M_PNGfix_acTL(png_structp png_ptr, png_infop png_info_ptr, static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal) { + png_uint_16 downscale; + + apng_downscale = (!!cv_apng_downscale.value); + + downscale = apng_downscale ? vid.dupx : 1; + apng_FILE = fopen(filename,"wb+"); // + mode for reading if (!apng_FILE) { @@ -1080,7 +1102,7 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal) png_set_compression_strategy(apng_ptr, cv_zlib_strategya.value); png_set_compression_window_bits(apng_ptr, cv_zlib_window_bitsa.value); - M_PNGhdr(apng_ptr, apng_info_ptr, vid.width, vid.height, pal); + M_PNGhdr(apng_ptr, apng_info_ptr, vid.width / downscale, vid.height / downscale, pal); M_PNGText(apng_ptr, apng_info_ptr, true); diff --git a/src/m_misc.h b/src/m_misc.h index dbded37d0..c5ef9f9f2 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -33,7 +33,7 @@ extern consvar_t cv_screenshot_option, cv_screenshot_folder, cv_screenshot_color extern consvar_t cv_moviemode, cv_movie_folder, cv_movie_option; extern consvar_t cv_zlib_memory, cv_zlib_level, cv_zlib_strategy, cv_zlib_window_bits; extern consvar_t cv_zlib_memorya, cv_zlib_levela, cv_zlib_strategya, cv_zlib_window_bitsa; -extern consvar_t cv_apng_delay; +extern consvar_t cv_apng_delay, cv_apng_downscale; void M_StartMovie(void); void M_SaveFrame(void); From 12ac096a950d953cb3cb115061662b4f5461d06f Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Thu, 15 Oct 2020 11:00:34 -0500 Subject: [PATCH 048/141] Add a menu option for aPNG downscaling. --- src/m_menu.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 5860f00ca..ffd5c6510 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1551,18 +1551,19 @@ static menuitem_t OP_ScreenshotOptionsMenu[] = {IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bits, 57}, {IT_HEADER, NULL, "Movie Mode (F9)", NULL, 64}, - {IT_STRING|IT_CVAR, NULL, "Storage Location", &cv_movie_option, 70}, - {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_movie_folder, 75}, - {IT_STRING|IT_CVAR, NULL, "Capture Mode", &cv_moviemode, 90}, + {IT_STRING|IT_CVAR, NULL, "Storage Location", &cv_movie_option, 70}, + {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_movie_folder, 75}, + {IT_STRING|IT_CVAR, NULL, "Capture Mode", &cv_moviemode, 90}, - {IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 95}, + {IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 95}, {IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 100}, {IT_STRING|IT_CVAR, NULL, "Local Color Table", &cv_gif_localcolortable, 105}, - {IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 95}, - {IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_levela, 100}, - {IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategya, 105}, - {IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bitsa, 110}, + {IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_apng_downscale, 95}, + {IT_STRING|IT_CVAR, NULL, "Memory Level", &cv_zlib_memorya, 100}, + {IT_STRING|IT_CVAR, NULL, "Compression Level", &cv_zlib_levela, 105}, + {IT_STRING|IT_CVAR, NULL, "Strategy", &cv_zlib_strategya, 110}, + {IT_STRING|IT_CVAR, NULL, "Window Size", &cv_zlib_window_bitsa, 115}, }; enum @@ -1575,7 +1576,7 @@ enum op_screenshot_gif_start = 13, op_screenshot_gif_end = 15, op_screenshot_apng_start = 16, - op_screenshot_apng_end = 19, + op_screenshot_apng_end = 20, }; static menuitem_t OP_EraseDataMenu[] = From 55f169f3c96152ac259a8e48a71ccf4ee43cea79 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Thu, 15 Oct 2020 11:04:52 -0500 Subject: [PATCH 049/141] Move the GIF downscaling menu option up one to create some parity. --- src/m_menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index ffd5c6510..ff9842f66 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1555,8 +1555,8 @@ static menuitem_t OP_ScreenshotOptionsMenu[] = {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Custom Folder", &cv_movie_folder, 75}, {IT_STRING|IT_CVAR, NULL, "Capture Mode", &cv_moviemode, 90}, - {IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 95}, - {IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 100}, + {IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_gif_downscale, 95}, + {IT_STRING|IT_CVAR, NULL, "Region Optimizing", &cv_gif_optimize, 100}, {IT_STRING|IT_CVAR, NULL, "Local Color Table", &cv_gif_localcolortable, 105}, {IT_STRING|IT_CVAR, NULL, "Downscaling", &cv_apng_downscale, 95}, From 377a9c10f09cd829dab666419a771cc63b411a67 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 21 Nov 2020 13:37:12 -0800 Subject: [PATCH 050/141] Lua: disallow bitwise not on anything but number values This fixes a crash. --- src/blua/lcode.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/blua/lcode.c b/src/blua/lcode.c index 5c7fed454..efb20e96b 100644 --- a/src/blua/lcode.c +++ b/src/blua/lcode.c @@ -686,6 +686,15 @@ static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { } +static void codeunaryarith (FuncState *fs, OpCode op, expdesc *e) { + expdesc e2; + e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; + if (!isnumeral(e)) + luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */ + codearith(fs, op, e, &e2); +} + + static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, expdesc *e2) { int o1 = luaK_exp2RK(fs, e1); @@ -706,18 +715,8 @@ void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { expdesc e2; e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; switch (op) { - case OPR_MINUS: { - if (!isnumeral(e)) - luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */ - codearith(fs, OP_UNM, e, &e2); - break; - } - case OPR_BNOT: { - if (e->k == VK) - luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */ - codearith(fs, OP_BNOT, e, &e2); - break; - } + case OPR_MINUS: codeunaryarith(fs, OP_UNM, e); break; + case OPR_BNOT: codeunaryarith(fs, OP_BNOT, e); break; case OPR_NOT: codenot(fs, e); break; case OPR_LEN: { luaK_exp2anyreg(fs, e); /* cannot operate on constants */ From 5a8e653cd5c6c33a129c40e3f5fa3fb17896b909 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 21 Nov 2020 13:43:32 -0800 Subject: [PATCH 051/141] More concise --- src/blua/lcode.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/blua/lcode.c b/src/blua/lcode.c index efb20e96b..fd4aaff24 100644 --- a/src/blua/lcode.c +++ b/src/blua/lcode.c @@ -689,7 +689,7 @@ static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { static void codeunaryarith (FuncState *fs, OpCode op, expdesc *e) { expdesc e2; e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; - if (!isnumeral(e)) + if (op == OP_LEN || !isnumeral(e)) luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */ codearith(fs, op, e, &e2); } @@ -712,17 +712,11 @@ static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { - expdesc e2; - e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; switch (op) { case OPR_MINUS: codeunaryarith(fs, OP_UNM, e); break; case OPR_BNOT: codeunaryarith(fs, OP_BNOT, e); break; case OPR_NOT: codenot(fs, e); break; - case OPR_LEN: { - luaK_exp2anyreg(fs, e); /* cannot operate on constants */ - codearith(fs, OP_LEN, e, &e2); - break; - } + case OPR_LEN: codeunaryarith(fs, OP_LEN, e); break; default: lua_assert(0); } } From 79bbb3fe468e8a8835d1a4a8d5c3ef5d520c6e88 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 21 Nov 2020 15:19:54 -0800 Subject: [PATCH 052/141] Remove Direct Draw from the Makefiles MINGW/MINGW64 implies SDL. --- src/Makefile | 88 +----------------------------------------- src/Makefile.cfg | 4 +- src/win32/Makefile.cfg | 29 +------------- 3 files changed, 4 insertions(+), 117 deletions(-) diff --git a/src/Makefile b/src/Makefile index 5d5db056f..dccbdd596 100644 --- a/src/Makefile +++ b/src/Makefile @@ -13,8 +13,7 @@ # -DHAVE_SDL -> use for the SDL interface # # Sets: -# Compile the DirectX/Mingw version with 'make MINGW=1' -# Compile the SDL/Mingw version with 'make MINGW=1 SDL=1' +# Compile the SDL/Mingw version with 'make MINGW=1' # Compile the SDL/Linux version with 'make LINUX=1' # Compile the SDL/Solaris version with 'make SOLARIS=1' # Compile the SDL/FreeBSD version with 'gmake FREEBSD=1' @@ -103,7 +102,6 @@ ifeq ($(OS),Windows_NT) # all windows are Windows_NT... # go for a 32-bit sdl mingw exe by default MINGW=1 - SDL=1 WINDOWSHELL=1 else # if you on the *nix @@ -552,12 +550,6 @@ all: pre-build $(BIN)/$(PNDNAME) endif -ifdef MINGW -ifndef SDL -all: pre-build $(BIN)/$(EXENAME) dll -endif -endif - ifdef SDL all: pre-build $(BIN)/$(EXENAME) endif @@ -637,57 +629,6 @@ endif $(OBJDIR): -$(MKDIR) $(OBJDIR) -ifndef SDL -ifdef NOHW -dll : -else -dll : opengl_dll -endif -ifdef MINGW -all_dll: opengl_dll ds3d_dll fmod_dll openal_dll - -opengl_dll: $(BIN)/r_opengl.dll -$(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o - -$(MKDIR) $(BIN) - @echo Linking R_OpenGL.dll... - $(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lgdi32 -static-libgcc -ifndef NOUPX - -$(UPX) $(UPX_OPTS) $@ -endif - -ds3d_dll: $(BIN)/s_ds3d.dll -$(BIN)/s_ds3d.dll: $(OBJDIR)/s_ds3d.o - @echo Linking S_DS3d.dll... - $(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -ldsound -luuid - -fmod_dll: $(BIN)/s_fmod.dll -$(BIN)/s_fmod.dll: $(OBJDIR)/s_fmod.o - -$(MKDIR) $(BIN) - @echo Linking S_FMOD.dll... - $(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lfmod - -openal_dll: $(BIN)/s_openal.dll -$(BIN)/s_openal.dll: $(OBJDIR)/s_openal.o - -$(MKDIR) $(BIN) - @echo Linking S_OpenAL.dll... - $(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lopenal32 -else -all_dll: fmod_so openal_so - -fmod_so: $(BIN)/s_fmod.so -$(BIN)/s_fmod.so: $(OBJDIR)/s_fmod.o - -$(MKDIR) $(BIN) - @echo Linking S_FMOD.so... - $(CC) --shared $^ -o $@ -g --nostartfiles -lm -lfmod - -openal_so: $(BIN)/s_openal.so -$(BIN)/s_openal.so: $(OBJDIR)/s_openal.o - -$(MKDIR) $(BIN) - @echo Linking S_OpenAL.so... - $(CC) --shared $^ -o $@ -g --nostartfiles -lm -lopenal -endif - -else ifdef SDL ifdef MINGW $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \ @@ -710,8 +651,6 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h endif endif -endif - #dependecy made by gcc itself ! $(OBJS): ifndef DUMMY @@ -774,31 +713,6 @@ $(OBJDIR)/SRB2.res: win32/Srb2win.rc win32/afxres.h win32/resource.h $(WINDRES) -i $< -O rc $(WINDRESFLAGS) --include-dir=win32 -o $@ -O coff -ifdef MINGW -ifndef SDL -ifndef NOHW -$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \ - doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \ - command.h hardware/hw_data.h hardware/hw_defs.h \ - hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \ - hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \ - am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ - p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h - $(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@ - -$(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \ - doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \ - command.h hardware/hw_data.h hardware/hw_defs.h \ - hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \ - hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \ - am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \ - p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h - $(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@ -endif - -endif -endif - ifdef SDL ifdef MINGW diff --git a/src/Makefile.cfg b/src/Makefile.cfg index db7230bb4..f081eacdf 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -420,14 +420,14 @@ ifdef CYGWIN32 BIN:=$(BIN)/Cygwin else ifdef MINGW64 - INTERFACE=win32 #NASMFORMAT=win64 + SDL=1 OBJDIR:=$(OBJDIR)/Mingw64 BIN:=$(BIN)/Mingw64 else ifdef MINGW - INTERFACE=win32 NASMFORMAT=win32 + SDL=1 OBJDIR:=$(OBJDIR)/Mingw BIN:=$(BIN)/Mingw endif diff --git a/src/win32/Makefile.cfg b/src/win32/Makefile.cfg index bf68f8c97..888072c9c 100644 --- a/src/win32/Makefile.cfg +++ b/src/win32/Makefile.cfg @@ -56,15 +56,8 @@ ifndef GCC44 #OPTS+=-mms-bitfields endif -ifndef SDL - OPTS+=-D_WINDOWS -endif OPTS+=-D__USE_MINGW_ANSI_STDIO=0 -ifndef SDL - LIBS+=-lmingw32 -mwindows -ldinput -ldxguid -lgdi32 -lwinmm -endif - LIBS+=-ladvapi32 -lkernel32 -lmsvcrt -luser32 ifdef MINGW64 LIBS+=-lws2_32 @@ -77,11 +70,7 @@ endif endif # name of the exefile -ifdef SDL EXENAME?=srb2win.exe -else - EXENAME?=srb2dd.exe -endif ifdef SDL i_system_o+=$(OBJDIR)/SRB2.res @@ -89,22 +78,6 @@ ifdef SDL ifndef NOHW OPTS+=-DUSE_WGL_SWAP endif -else - D_FILES+=$(D_DIR)/fmodex.dll - CFLAGS+=-I../libs/fmodex/inc - LDFLAGS+=-L../libs/fmodex/lib -ifdef MINGW64 - LIBS+=-lfmodex64_vc -else - LIBS+=-lfmodex_vc -endif - i_cdmus_o=$(OBJDIR)/win_cd.o - i_net_o=$(OBJDIR)/win_net.o - i_system_o=$(OBJDIR)/win_sys.o $(OBJDIR)/SRB2.res - i_sound_o=$(OBJDIR)/win_snd.o - i_main_o=$(OBJDIR)/win_main.o - #i_main_o+=$(OBJDIR)/win_dbg.o - OBJS=$(OBJDIR)/dx_error.o $(OBJDIR)/fabdxlib.o $(OBJDIR)/win_vid.o $(OBJDIR)/win_dll.o endif @@ -162,4 +135,4 @@ ifdef MINGW64 else CURL_LDFLAGS+=-L../libs/curl/lib32 -lcurl endif #MINGW64 -endif \ No newline at end of file +endif From f51be77aa21e125c4abd16da2f660c4da03daa84 Mon Sep 17 00:00:00 2001 From: Riku Salminen <38985578+Riku-S@users.noreply.github.com> Date: Sun, 22 Nov 2020 23:19:24 +0200 Subject: [PATCH 053/141] Now the fix actually does what the MR says... +lua banks --- src/g_game.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index d6861b252..1afaf8956 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2242,6 +2242,12 @@ void G_Ticker(boolean run) // Reset unlockable triggers unlocktriggers = 0; + emeralds = 0; + tokenbits = 0; + tokenlist = 0; + token = 0; + + memset(&luabanks, 0, sizeof(luabanks)); } else if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE && players[consoleplayer].lives != INFLIVES) players[consoleplayer].lives -= 1; From b9fa50f7ef00000bc1f79e5d47582aeae971b37f Mon Sep 17 00:00:00 2001 From: Riku Salminen <38985578+Riku-S@users.noreply.github.com> Date: Sun, 22 Nov 2020 23:23:32 +0200 Subject: [PATCH 054/141] No need to reset tokens twice --- src/g_game.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 1afaf8956..b91087b2b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2243,9 +2243,6 @@ void G_Ticker(boolean run) unlocktriggers = 0; emeralds = 0; - tokenbits = 0; - tokenlist = 0; - token = 0; memset(&luabanks, 0, sizeof(luabanks)); } From 7bbd563b73dc44ba1373bb3d038f5230a2d6329a Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Sun, 22 Nov 2020 23:23:35 -0600 Subject: [PATCH 055/141] Remove unneeded S_PLAY_ROLL check --- src/p_user.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 004ff71d1..0ffa5e1af 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2330,8 +2330,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) P_MobjCheckWater(player->mo); if (player->pflags & PF_SPINNING) { - if (player->mo->state-states != S_PLAY_ROLL && !(player->pflags & PF_STARTDASH) - && player->panim != PA_ROLL && player->panim != PA_ETC + if (!(player->pflags & PF_STARTDASH) && player->panim != PA_ROLL && player->panim != PA_ETC && player->panim != PA_ABILITY && player->panim != PA_ABILITY2) { P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); From 7b05ffd92d101d58aaaf8f5234413ff4ab8a0dd1 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Mon, 23 Nov 2020 09:18:05 -0600 Subject: [PATCH 056/141] Revert "Fix no spin characters being able to damage enemies with their jump out of a spin without removing PF_SPINNING" This reverts commit ad9bf6085f0845c9fde5348c7299136735a83d84. --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 0ffa5e1af..2ec8f5995 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1135,8 +1135,7 @@ boolean P_PlayerCanDamage(player_t *player, mobj_t *thing) return true; // Spinning. - if ((player->pflags & PF_SPINNING) - && !((player->pflags & PF_JUMPED) && (player->pflags & PF_NOJUMPDAMAGE))) + if (player->pflags & PF_SPINNING) return true; if (player->dashmode >= DASHMODE_THRESHOLD && (player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE)) @@ -4526,6 +4525,7 @@ void P_DoJump(player_t *player, boolean soundandstate) player->mo->eflags &= ~MFE_APPLYPMOMZ; player->pflags |= P_GetJumpFlags(player);; + player->pflags &= ~PF_SPINNING; if (soundandstate) { From ea7e06a61635860ff266da3864ec0b4ecd8dd295 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Mon, 23 Nov 2020 09:21:00 -0600 Subject: [PATCH 057/141] Remove PF_SPINNING when jumping if you have SF_NOJUMPDAMAGE --- src/p_user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 2ec8f5995..da7ad4cb9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4525,7 +4525,9 @@ void P_DoJump(player_t *player, boolean soundandstate) player->mo->eflags &= ~MFE_APPLYPMOMZ; player->pflags |= P_GetJumpFlags(player);; - player->pflags &= ~PF_SPINNING; + + if (!(player->charflags & SF_NOJUMPDAMAGE)) + player->pflags &= ~PF_SPINNING; if (soundandstate) { From fe066b3ef28a6b5f3bb91ca10a5ed319469e41d8 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Mon, 23 Nov 2020 09:23:02 -0600 Subject: [PATCH 058/141] ...snickerdoodles --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index da7ad4cb9..6c3c6f136 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4526,7 +4526,7 @@ void P_DoJump(player_t *player, boolean soundandstate) player->pflags |= P_GetJumpFlags(player);; - if (!(player->charflags & SF_NOJUMPDAMAGE)) + if (player->charflags & SF_NOJUMPDAMAGE) player->pflags &= ~PF_SPINNING; if (soundandstate) From 87968c946beb499c66f20c226f00067f8c0c1fd3 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 24 Nov 2020 14:56:22 +1100 Subject: [PATCH 059/141] Prevent non-CA2_SPINDASH characters from getting crushed by roll-jumping into a crevice --- src/p_user.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index b8e7d1746..7dfa9d83a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8614,6 +8614,7 @@ void P_MovePlayer(player_t *player) P_DoFiring(player, cmd); { + boolean atspinheight = false; fixed_t oldheight = player->mo->height; // Less height while spinning. Good for spinning under things...? @@ -8623,32 +8624,35 @@ void P_MovePlayer(player_t *player) || player->powers[pw_tailsfly] || player->pflags & PF_GLIDING || (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) || (player->charability == CA_FLY && player->mo->state-states == S_PLAY_FLY_TIRED)) + { player->mo->height = P_GetPlayerSpinHeight(player); + atspinheight = true; + } else player->mo->height = P_GetPlayerHeight(player); if (player->mo->eflags & MFE_VERTICALFLIP && player->mo->height != oldheight) // adjust z height for reverse gravity, similar to how it's done for scaling player->mo->z -= player->mo->height - oldheight; - } - // Crush test... - if ((player->mo->ceilingz - player->mo->floorz < player->mo->height) - && !(player->mo->flags & MF_NOCLIP)) - { - if ((player->charability2 == CA2_SPINDASH) && !(player->pflags & PF_SPINNING)) + // Crush test... + if ((player->mo->ceilingz - player->mo->floorz < player->mo->height) + && !(player->mo->flags & MF_NOCLIP)) { - player->pflags |= PF_SPINNING; - P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); - } - else if (player->mo->ceilingz - player->mo->floorz < player->mo->height) - { - if ((netgame || multiplayer) && player->spectator) - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_SPECTATOR); // Respawn crushed spectators - else - P_DamageMobj(player->mo, NULL, NULL, 1, DMG_CRUSHED); + if (!atspinheight) + { + player->pflags |= PF_SPINNING; + P_SetPlayerMobjState(player->mo, S_PLAY_ROLL); + } + else if (player->mo->ceilingz - player->mo->floorz < player->mo->height) + { + if ((netgame || multiplayer) && player->spectator) + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_SPECTATOR); // Respawn crushed spectators + else + P_DamageMobj(player->mo, NULL, NULL, 1, DMG_CRUSHED); - if (player->playerstate == PST_DEAD) - return; + if (player->playerstate == PST_DEAD) + return; + } } } From 76822cef2bdab3fd0d43f607b29682e060dd03a1 Mon Sep 17 00:00:00 2001 From: Zachary McAlpin Date: Tue, 24 Nov 2020 20:41:11 -0600 Subject: [PATCH 060/141] Expose the selectheading option from mapheader_t in Lua --- src/lua_maplib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 95cc8c101..83744c74d 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -2189,6 +2189,8 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->levelflags); else if (fastcmp(field,"menuflags")) lua_pushinteger(L, header->menuflags); + else if (fastcmp(field,"selectheading")) + lua_pushstring(L, header->selectheading); else if (fastcmp(field,"startrings")) lua_pushinteger(L, header->startrings); else if (fastcmp(field, "sstimer")) From b2d6d4f83fb07ddc8f3dfb850f9de8fc43152109 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Wed, 25 Nov 2020 12:35:36 -0600 Subject: [PATCH 061/141] Expose `player.skin` and `player.availabilities` to Lua as Read-only --- src/lua_playerlib.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 412dc3eff..0eb54808f 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -158,6 +158,10 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->flashpal); else if (fastcmp(field,"skincolor")) lua_pushinteger(L, plr->skincolor); + else if (fastcmp(field,"skin")) + lua_pushinteger(L, plr->skin); + else if (fastcmp(field,"availabilities")) + lua_pushinteger(L, plr->availabilities); else if (fastcmp(field,"score")) lua_pushinteger(L, plr->score); else if (fastcmp(field,"dashspeed")) @@ -469,6 +473,10 @@ static int player_set(lua_State *L) return luaL_error(L, "player.skincolor %d out of range (0 - %d).", newcolor, numskincolors-1); plr->skincolor = newcolor; } + else if (fastcmp(field,"skin")) + return NOSET; + else if (fastcmp(field,"availabilities")) + return NOSET; else if (fastcmp(field,"score")) plr->score = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"dashspeed")) From 5c71fe07103e7f3febbb94bc0d9a6a7bd9426fc0 Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Wed, 25 Nov 2020 14:31:24 -0600 Subject: [PATCH 062/141] Allow player.lastlinehit and player.lastsidehit to be used outside of Knuckles' climbing ability --- src/p_map.c | 14 +++++++++++--- src/p_mobj.c | 4 ++++ src/p_user.c | 6 ------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 922c0d9ec..4f344a9b0 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3443,9 +3443,17 @@ static boolean PTR_SlideTraverse(intercept_t *in) P_ProcessSpecialSector(slidemo->player, slidemo->subsector->sector, li->polyobj->lines[0]->backsector); } - if (slidemo->player && slidemo->player->charability == CA_GLIDEANDCLIMB - && (slidemo->player->pflags & PF_GLIDING || slidemo->player->climbing)) - PTR_GlideClimbTraverse(li); + if (slidemo->player) + { + if (slidemo->player->charability == CA_GLIDEANDCLIMB + && (slidemo->player->pflags & PF_GLIDING || slidemo->player->climbing)) + PTR_GlideClimbTraverse(li); + else + { + slidemo->player->lastsidehit = li->sidenum[P_PointOnLineSide(slidemo->x, slidemo->y, li)]; + slidemo->player->lastlinehit = (INT16)(li - lines); + } + } if (in->frac < bestslidefrac && (!slidemo->player || !slidemo->player->climbing)) { diff --git a/src/p_mobj.c b/src/p_mobj.c index 4fc561b20..8dab1b2cf 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11404,6 +11404,10 @@ void P_SpawnPlayer(INT32 playernum) p->normalspeed = skins[p->skin].normalspeed; p->jumpfactor = skins[p->skin].jumpfactor; } + + // Clear lastlinehit and lastsidehit + p->lastsidehit = -1; + p->lastlinehit = -1; //awayview stuff p->awayviewmobj = NULL; diff --git a/src/p_user.c b/src/p_user.c index 10b7e970e..73f6339a9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8601,12 +8601,6 @@ void P_MovePlayer(player_t *player) player->climbing--; } - if (!player->climbing) - { - player->lastsidehit = -1; - player->lastlinehit = -1; - } - // Make sure you're not teetering when you shouldn't be. if (player->panim == PA_EDGE && (player->mo->momx || player->mo->momy || player->mo->momz)) From db6b0c6aa0f305cfbf2bd98885b83c0a098237f1 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Wed, 25 Nov 2020 21:46:45 -0600 Subject: [PATCH 063/141] Fix normal one-up sound playing in Mario mode --- src/p_user.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index c5f919c78..57eb1e072 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1491,10 +1491,10 @@ void P_PlayLivesJingle(player_t *player) if (player && !P_IsLocalPlayer(player)) return; - if (use1upSound || cv_1upsound.value) - S_StartSound(NULL, sfx_oneup); - else if (mariomode) + if (mariomode) S_StartSound(NULL, sfx_marioa); + else if (use1upSound || cv_1upsound.value) + S_StartSound(NULL, sfx_oneup); else { P_PlayJingle(player, JT_1UP); From b9f6069cd07b14d15b2bd26da2f49db3ae96e608 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 28 Nov 2020 02:19:52 -0800 Subject: [PATCH 064/141] Replace TC macros with an enum that automatically counts up Also fixes TC_DASHMODE not being accessible to Lua. --- src/lua_hudlib.c | 6 ++++-- src/r_draw.h | 18 +++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index f4e5d5ccf..04fbf41a0 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -896,8 +896,10 @@ static int libd_getColormap(lua_State *L) else if (lua_type(L, 1) == LUA_TNUMBER) // skin number { skinnum = (INT32)luaL_checkinteger(L, 1); - if (skinnum < TC_BLINK || skinnum >= MAXSKINS) - return luaL_error(L, "skin number %d is out of range (%d - %d)", skinnum, TC_BLINK, MAXSKINS-1); + if (skinnum >= MAXSKINS) + return luaL_error(L, "skin number %d is out of range (>%d)", skinnum, MAXSKINS-1); + else if (skinnum < 0 && skinnum > TC_DEFAULT) + return luaL_error(L, "translation colormap index is out of range"); } else // skin name { diff --git a/src/r_draw.h b/src/r_draw.h index 9957541ca..d1eb83033 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -106,13 +106,17 @@ extern lumpnum_t viewborderlump[8]; #define GTC_CACHE 1 -#define TC_DEFAULT -1 -#define TC_BOSS -2 -#define TC_METALSONIC -3 // For Metal Sonic battle -#define TC_ALLWHITE -4 // For Cy-Brak-demon -#define TC_RAINBOW -5 // For single colour -#define TC_BLINK -6 // For item blinking, according to kart -#define TC_DASHMODE -7 // For Metal Sonic's dashmode +enum +{ + TC_BOSS = INT8_MIN, + TC_METALSONIC, // For Metal Sonic battle + TC_ALLWHITE, // For Cy-Brak-demon + TC_RAINBOW, // For single colour + TC_BLINK, // For item blinking, according to kart + TC_DASHMODE, // For Metal Sonic's dashmode + + TC_DEFAULT +}; // Custom player skin translation // Initialize color translation tables, for player rendering etc. From 75c5c8ba6a0ffc54ff609fe1ae644b70c53edb68 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 28 Nov 2020 02:22:08 -0800 Subject: [PATCH 065/141] Add missing *individual* skin flags --- src/d_player.h | 2 +- src/r_skins.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index eb0372832..79f2a3b92 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -51,7 +51,7 @@ typedef enum SF_NONIGHTSSUPER = 1<<15, // Disable super colors for NiGHTS (if you have SF_SUPER) SF_NOSUPERSPRITES = 1<<16, // Don't use super sprites while super SF_NOSUPERJUMPBOOST = 1<<17, // Disable the jump boost given while super (i.e. Knuckles) - SF_CANBUSTWALLS = 1<<18, // Can naturally bust walls on contact? (i.e. Knuckles) + SF_CANBUSTWALLS = 1<<18, // Can naturally bust walls on contact? (i.e. Knuckles) // free up to and including 1<<31 } skinflags_t; diff --git a/src/r_skins.c b/src/r_skins.c index 25904e95e..522d9236a 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -511,6 +511,9 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value) GETFLAG(MULTIABILITY) GETFLAG(NONIGHTSROTATION) GETFLAG(NONIGHTSSUPER) + GETFLAG(NOSUPERSPRITES) + GETFLAG(NOSUPERJUMPBOOST) + GETFLAG(CANBUSTWALLS) #undef GETFLAG else // let's check if it's a sound, otherwise error out From 6b4d4226649eebb200f1f00e0f863f39a28ea57d Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 28 Nov 2020 20:00:01 -0800 Subject: [PATCH 066/141] Don't add pk3 if there are holes ZIP tools often read the final central directory, but SRB2 may not if there are multiple central directories. It's just easier to not allow "holes", or unaccounted for bytes in the file. --- src/w_wad.c | 111 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 85 insertions(+), 26 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index aca530fa5..19432e937 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -716,7 +716,7 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup) #endif size_t packetsize; UINT8 md5sum[16]; - boolean important; + int important; if (!(refreshdirmenu & REFRESHDIR_ADDFILE)) refreshdirmenu = REFRESHDIR_NORMAL|REFRESHDIR_ADDFILE; // clean out cons_alerts that happened earlier @@ -746,10 +746,18 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup) if ((handle = W_OpenWadFile(&filename, true)) == NULL) return W_InitFileError(filename, startup); + important = W_VerifyNMUSlumps(filename); + + if (important == -1) + { + fclose(handle); + return W_InitFileError(filename, startup); + } + // Check if wad files will overflow fileneededbuffer. Only the filename part // is send in the packet; cf. // see PutFileNeeded in d_netfil.c - if ((important = !W_VerifyNMUSlumps(filename))) + if ((important = !important)) { packetsize = packetsizetally + nameonlylength(filename) + 22; @@ -1919,8 +1927,16 @@ static lumpchecklist_t folderblacklist[] = static int W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status) { + int verified = true; + zend_t zend; zentry_t zentry; + zlentry_t zlentry; + + long file_size;/* size of zip file */ + long data_size;/* size of data inside zip file */ + + long old_position; UINT16 numlumps; size_t i; @@ -1936,6 +1952,8 @@ W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status) // Central directory bullshit fseek(fp, 0, SEEK_END); + file_size = ftell(fp); + if (!ResFindSignature(fp, pat_end, max(0, ftell(fp) - (22 + 65536)))) return true; @@ -1943,6 +1961,8 @@ W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status) if (fread(&zend, 1, sizeof zend, fp) < sizeof zend) return true; + data_size = sizeof zend; + numlumps = zend.entries; fseek(fp, zend.cdiroffset, SEEK_SET); @@ -1957,40 +1977,79 @@ W_VerifyPK3 (FILE *fp, lumpchecklist_t *checklist, boolean status) if (memcmp(zentry.signature, pat_central, 4)) return true; - fullname = malloc(zentry.namelen + 1); - if (fgets(fullname, zentry.namelen + 1, fp) != fullname) - return true; - - // Strip away file address and extension for the 8char name. - if ((trimname = strrchr(fullname, '/')) != 0) - trimname++; - else - trimname = fullname; // Care taken for root files. - - if (*trimname) // Ignore directories, well kinda + if (verified == true) { - if ((dotpos = strrchr(trimname, '.')) == 0) - dotpos = fullname + strlen(fullname); // Watch for files without extension. + fullname = malloc(zentry.namelen + 1); + if (fgets(fullname, zentry.namelen + 1, fp) != fullname) + return true; - memset(lumpname, '\0', 9); // Making sure they're initialized to 0. Is it necessary? - strncpy(lumpname, trimname, min(8, dotpos - trimname)); + // Strip away file address and extension for the 8char name. + if ((trimname = strrchr(fullname, '/')) != 0) + trimname++; + else + trimname = fullname; // Care taken for root files. - if (! W_VerifyName(lumpname, checklist, status)) - return false; + if (*trimname) // Ignore directories, well kinda + { + if ((dotpos = strrchr(trimname, '.')) == 0) + dotpos = fullname + strlen(fullname); // Watch for files without extension. - // Check for directories next, if it's blacklisted it will return false - if (W_VerifyName(fullname, folderblacklist, status)) - return false; + memset(lumpname, '\0', 9); // Making sure they're initialized to 0. Is it necessary? + strncpy(lumpname, trimname, min(8, dotpos - trimname)); + + if (! W_VerifyName(lumpname, checklist, status)) + verified = false; + + // Check for directories next, if it's blacklisted it will return false + else if (W_VerifyName(fullname, folderblacklist, status)) + verified = false; + } + + free(fullname); + + // skip and ignore comments/extra fields + if (fseek(fp, zentry.xtralen + zentry.commlen, SEEK_CUR) != 0) + return true; + } + else + { + if (fseek(fp, zentry.namelen + zentry.xtralen + zentry.commlen, SEEK_CUR) != 0) + return true; } - free(fullname); + data_size += + sizeof zentry + zentry.namelen + zentry.xtralen + zentry.commlen; - // skip and ignore comments/extra fields - if (fseek(fp, zentry.xtralen + zentry.commlen, SEEK_CUR) != 0) + old_position = ftell(fp); + + if (fseek(fp, zentry.offset, SEEK_SET) != 0) return true; + + if (fread(&zlentry, 1, sizeof(zlentry_t), fp) < sizeof (zlentry_t)) + return true; + + data_size += + sizeof zlentry + zlentry.namelen + zlentry.xtralen + zlentry.compsize; + + fseek(fp, old_position, SEEK_SET); } - return true; + if (data_size < file_size) + { + const char * error = "ZIP file has holes (%ld extra bytes)\n"; + CONS_Alert(CONS_ERROR, error, (file_size - data_size)); + return -1; + } + else if (data_size > file_size) + { + const char * error = "Reported size of ZIP file contents exceeds file size (%ld extra bytes)\n"; + CONS_Alert(CONS_ERROR, error, (data_size - file_size)); + return -1; + } + else + { + return verified; + } } // Note: This never opens lumps themselves and therefore doesn't have to From 95dfb93a117a76f60e9a7cd0e316a7e9d81ca87a Mon Sep 17 00:00:00 2001 From: SMS Alfredo <65426124+SMS-Alfredo@users.noreply.github.com> Date: Sat, 28 Nov 2020 22:03:02 -0600 Subject: [PATCH 067/141] Allow non-player objects to apply the CR_PLAYER carry type without crashing the game --- src/p_user.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 10b7e970e..6205a40dd 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12580,13 +12580,16 @@ void P_PlayerAfterThink(player_t *player) player->powers[pw_carry] = CR_NONE; else { - P_TryMove(player->mo, tails->x + P_ReturnThrustX(tails, tails->player->drawangle, 4*FRACUNIT), tails->y + P_ReturnThrustY(tails, tails->player->drawangle, 4*FRACUNIT), true); + if (tails->player) + P_TryMove(player->mo, tails->x + P_ReturnThrustX(tails, tails->player->drawangle, 4*FRACUNIT), tails->y + P_ReturnThrustY(tails, tails->player->drawangle, 4*FRACUNIT), true); + else + P_TryMove(player->mo, tails->x + P_ReturnThrustX(tails, tails->angle, 4*FRACUNIT), tails->y + P_ReturnThrustY(tails, tails->angle, 4*FRACUNIT), true); player->mo->momx = tails->momx; player->mo->momy = tails->momy; player->mo->momz = tails->momz; } - if (G_CoopGametype() && (!tails->player || tails->player->bot != 1)) + if (G_CoopGametype() && tails->player && tails->player->bot != 1) { player->mo->angle = tails->angle; @@ -12601,7 +12604,7 @@ void P_PlayerAfterThink(player_t *player) { if (player->mo->state-states != S_PLAY_RIDE) P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); - if ((tails->skin && ((skin_t *)(tails->skin))->sprites[SPR2_SWIM].numframes) && (tails->eflags & MFE_UNDERWATER)) + if (tails->player && (tails->skin && ((skin_t *)(tails->skin))->sprites[SPR2_SWIM].numframes) && (tails->eflags & MFE_UNDERWATER)) tails->player->powers[pw_tailsfly] = 0; } else From 445d0407959ae36f93f7d7265ec5e36093782e8f Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 28 Nov 2020 20:51:21 -0800 Subject: [PATCH 068/141] Don't print W_VerifyFile errors more than once --- src/d_main.c | 6 +----- src/d_netcmd.c | 8 +++++++- src/w_wad.c | 23 +++++++++++++++++------ src/w_wad.h | 2 +- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 1045d4d99..ace1b5ed4 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -998,7 +998,7 @@ static void IdentifyVersion(void) #define MUSICTEST(str) \ {\ const char *musicpath = va(pandf,srb2waddir,str);\ - int ms = W_VerifyNMUSlumps(musicpath); \ + int ms = W_VerifyNMUSlumps(musicpath, false); \ if (ms == 1) \ D_AddFile(startupwadfiles, musicpath); \ else if (ms == 0) \ @@ -1187,11 +1187,7 @@ void D_SRB2Main(void) const char *s = M_GetNextParm(); if (s) // Check for NULL? - { - if (!W_VerifyNMUSlumps(s)) - G_SetGameModified(true); D_AddFile(startuppwads, s); - } } } } diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 31c10f58a..49a465ce7 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3294,7 +3294,13 @@ static void Command_Addfile(void) if (!isprint(fn[i]) || fn[i] == ';') return; - musiconly = W_VerifyNMUSlumps(fn); + musiconly = W_VerifyNMUSlumps(fn, false); + + if (musiconly == -1) + { + addedfiles[numfilesadded++] = fn; + continue; + } if (!musiconly) { diff --git a/src/w_wad.c b/src/w_wad.c index 19432e937..2429eaf92 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -66,6 +66,7 @@ #include "p_setup.h" // P_ScanThings #endif #include "m_misc.h" // M_MapNumber +#include "g_game.h" // G_SetGameModified #ifdef HWRENDER #include "hardware/hw_main.h" @@ -683,9 +684,9 @@ static UINT16 W_InitFileError (const char *filename, boolean exitworthy) if (exitworthy) { #ifdef _DEBUG - CONS_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n"); + CONS_Error(va("%s was not found or not valid.\nCheck the log for more details.\n", filename)); #else - I_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n"); + I_Error("%s was not found or not valid.\nCheck the log for more details.\n", filename); #endif } else @@ -746,12 +747,12 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup) if ((handle = W_OpenWadFile(&filename, true)) == NULL) return W_InitFileError(filename, startup); - important = W_VerifyNMUSlumps(filename); + important = W_VerifyNMUSlumps(filename, startup); if (important == -1) { fclose(handle); - return W_InitFileError(filename, startup); + return INT16_MAX; } // Check if wad files will overflow fileneededbuffer. Only the filename part @@ -819,6 +820,9 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup) return W_InitFileError(filename, startup); } + if (important && !mainfile) + G_SetGameModified(true); + // // link wad file to search files // @@ -2088,12 +2092,13 @@ static int W_VerifyFile(const char *filename, lumpchecklist_t *checklist, * be sent. * * \param filename Filename of the wad to check. + * \param exit_on_error Whether to exit upon file error. * \return 1 if file contains only music/sound lumps, 0 if it contains other * stuff (maps, sprites, dehacked lumps, and so on). -1 if there no * file exists with that filename * \author Alam Arias */ -int W_VerifyNMUSlumps(const char *filename) +int W_VerifyNMUSlumps(const char *filename, boolean exit_on_error) { // MIDI, MOD/S3M/IT/XM/OGG/MP3/WAV, WAVE SFX // ENDOOM text and palette lumps @@ -2167,7 +2172,13 @@ int W_VerifyNMUSlumps(const char *filename) {NULL, 0}, }; - return W_VerifyFile(filename, NMUSlist, false); + + int status = W_VerifyFile(filename, NMUSlist, false); + + if (status == -1) + W_InitFileError(filename, exit_on_error); + + return status; } /** \brief Generates a virtual resource used for level data loading. diff --git a/src/w_wad.h b/src/w_wad.h index 1e86eea5a..d0a86bcb4 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -206,6 +206,6 @@ void W_UnlockCachedPatch(void *patch); void W_VerifyFileMD5(UINT16 wadfilenum, const char *matchmd5); -int W_VerifyNMUSlumps(const char *filename); +int W_VerifyNMUSlumps(const char *filename, boolean exit_on_error); #endif // __W_WAD__ From 59d26465939ea9941f7d29e67a5b270c9362a21d Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sun, 29 Nov 2020 08:30:50 -0600 Subject: [PATCH 069/141] Send a `quitting` argument to the GameQuit Lua hook --- src/d_clisrv.c | 6 +++--- src/d_netcmd.c | 4 ++-- src/lua_hook.h | 2 +- src/lua_hooklib.c | 5 +++-- src/m_menu.c | 4 ++-- src/sdl/i_video.c | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index b198011a0..8951fe204 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3027,7 +3027,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) if (pnum == consoleplayer) { if (Playing()) - LUAh_GameQuit(); + LUAh_GameQuit(false); #ifdef DUMPCONSISTENCY if (msg == KICK_MSG_CON_FAIL) SV_SavedGame(); #endif @@ -3728,7 +3728,7 @@ static void HandleShutdown(SINT8 node) { (void)node; if (Playing()) - LUAh_GameQuit(); + LUAh_GameQuit(false); D_QuitNetGame(); CL_Reset(); D_StartTitle(); @@ -3744,7 +3744,7 @@ static void HandleTimeout(SINT8 node) { (void)node; if (Playing()) - LUAh_GameQuit(); + LUAh_GameQuit(false); D_QuitNetGame(); CL_Reset(); D_StartTitle(); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 31c10f58a..ec46aa4c3 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3607,7 +3607,7 @@ static void Command_Playintro_f(void) FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void) { if (Playing()) - LUAh_GameQuit(); + LUAh_GameQuit(true); I_Quit(); } @@ -4270,7 +4270,7 @@ void Command_ExitGame_f(void) INT32 i; if (Playing()) - LUAh_GameQuit(); + LUAh_GameQuit(false); D_QuitNetGame(); CL_Reset(); diff --git a/src/lua_hook.h b/src/lua_hook.h index 796f3a9d2..dd41814b5 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -117,6 +117,6 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_ #endif #define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname); // Hook for whether a jingle of the given music should continue playing -void LUAh_GameQuit(void); // Hook for game quitting +void LUAh_GameQuit(boolean quitting); // Hook for game quitting boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Hook for building player's ticcmd struct (Ported from SRB2Kart) boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping, UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes \ No newline at end of file diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 117aa48a3..a206f80db 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -1846,7 +1846,7 @@ boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname) } // Hook for game quitting -void LUAh_GameQuit(void) +void LUAh_GameQuit(boolean quitting) { hook_p hookp; if (!gL || !(hooksAvailable[hook_GameQuit/8] & (1<<(hook_GameQuit%8)))) @@ -1860,7 +1860,8 @@ void LUAh_GameQuit(void) continue; PushHook(gL, hookp); - if (lua_pcall(gL, 0, 0, 1)) { + lua_pushboolean(gL, quitting); + if (lua_pcall(gL, 1, 0, 1)) { if (!hookp->error || cv_debug & DBG_LUA) CONS_Alert(CONS_WARNING,"%s\n",lua_tostring(gL, -1)); lua_pop(gL, 1); diff --git a/src/m_menu.c b/src/m_menu.c index 77648f877..135137c12 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6938,7 +6938,7 @@ static void M_UltimateCheat(INT32 choice) { (void)choice; if (Playing()) - LUAh_GameQuit(); + LUAh_GameQuit(true); I_Quit(); } @@ -13373,7 +13373,7 @@ void M_QuitResponse(INT32 ch) if (ch != 'y' && ch != KEY_ENTER) return; if (Playing()) - LUAh_GameQuit(); + LUAh_GameQuit(true); if (!(netgame || cv_debug)) { S_ResetCaptions(); diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index b8b3b9d34..310275d55 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1058,7 +1058,7 @@ void I_GetEvent(void) break; case SDL_QUIT: if (Playing()) - LUAh_GameQuit(); + LUAh_GameQuit(true); I_Quit(); break; } From b389700de3a9523b946ecdb5cc8450ea70d422a4 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sun, 29 Nov 2020 08:32:04 -0600 Subject: [PATCH 070/141] Always call GameQuit when quitting via the Quit menu option on the title screen. --- src/m_menu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 135137c12..258b01318 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -13372,8 +13372,7 @@ void M_QuitResponse(INT32 ch) if (ch != 'y' && ch != KEY_ENTER) return; - if (Playing()) - LUAh_GameQuit(true); + LUAh_GameQuit(true); if (!(netgame || cv_debug)) { S_ResetCaptions(); From 119d2e9e37ec60c5a729e4dd255a96f37be8d7b2 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sun, 29 Nov 2020 16:53:29 -0600 Subject: [PATCH 071/141] Remove the rest of the Playing() checks for GameQuit hook --- src/d_clisrv.c | 9 +++------ src/d_netcmd.c | 6 ++---- src/m_menu.c | 3 +-- src/sdl/i_video.c | 3 +-- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 8951fe204..52f091fee 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3026,8 +3026,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) if (pnum == consoleplayer) { - if (Playing()) - LUAh_GameQuit(false); + LUAh_GameQuit(false); #ifdef DUMPCONSISTENCY if (msg == KICK_MSG_CON_FAIL) SV_SavedGame(); #endif @@ -3727,8 +3726,7 @@ static void HandleConnect(SINT8 node) static void HandleShutdown(SINT8 node) { (void)node; - if (Playing()) - LUAh_GameQuit(false); + LUAh_GameQuit(false); D_QuitNetGame(); CL_Reset(); D_StartTitle(); @@ -3743,8 +3741,7 @@ static void HandleShutdown(SINT8 node) static void HandleTimeout(SINT8 node) { (void)node; - if (Playing()) - LUAh_GameQuit(false); + LUAh_GameQuit(false); D_QuitNetGame(); CL_Reset(); D_StartTitle(); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ec46aa4c3..7d5a598db 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3606,8 +3606,7 @@ static void Command_Playintro_f(void) */ FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void) { - if (Playing()) - LUAh_GameQuit(true); + LUAh_GameQuit(true); I_Quit(); } @@ -4269,8 +4268,7 @@ void Command_ExitGame_f(void) { INT32 i; - if (Playing()) - LUAh_GameQuit(false); + LUAh_GameQuit(false); D_QuitNetGame(); CL_Reset(); diff --git a/src/m_menu.c b/src/m_menu.c index 258b01318..5ec9132f7 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6937,8 +6937,7 @@ static void M_SelectableClearMenus(INT32 choice) static void M_UltimateCheat(INT32 choice) { (void)choice; - if (Playing()) - LUAh_GameQuit(true); + LUAh_GameQuit(true); I_Quit(); } diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 310275d55..5ebff8700 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1057,8 +1057,7 @@ void I_GetEvent(void) M_SetupJoystickMenu(0); break; case SDL_QUIT: - if (Playing()) - LUAh_GameQuit(true); + LUAh_GameQuit(true); I_Quit(); break; } From f913d60a9faab27ddf9182051b8d1190af87ac17 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 29 Nov 2020 17:16:57 -0600 Subject: [PATCH 072/141] Make P_DoSuperTransformation (with giverings) add 50 rings instead of setting it --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index c5f919c78..04c5e1387 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1342,7 +1342,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_TRANS1); if (giverings) - player->rings = 50; + player->rings += 50; // Just in case. if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) From 412f3fc42b4c8b57ca0bd0eee0fd67c2f8abae71 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Sun, 29 Nov 2020 17:39:54 -0600 Subject: [PATCH 073/141] P_GivePlayerRings --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 04c5e1387..166027c8d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1342,7 +1342,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_TRANS1); if (giverings) - player->rings += 50; + P_GivePlayerRings(player, 50) // Just in case. if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) From da1a3029a90a43475afd0a8f7a356c94697366ea Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 30 Nov 2020 12:04:35 -0600 Subject: [PATCH 074/141] overhaul --- src/p_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 166027c8d..66cce3082 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1341,8 +1341,8 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) // Transformation animation P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_TRANS1); - if (giverings) - P_GivePlayerRings(player, 50) + if (giverings) && player->rings > 50 + player->rings = 50 // Just in case. if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) From 20d181198374a092d5639f149f635ae3f69885c3 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 30 Nov 2020 12:05:45 -0600 Subject: [PATCH 075/141] oops --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 66cce3082..e357c8b5c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1342,7 +1342,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_TRANS1); if (giverings) && player->rings > 50 - player->rings = 50 + player->rings = 50; // Just in case. if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC)) From 9770368ee9b2e60fb375b60da71e66f130c44e06 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Mon, 30 Nov 2020 18:21:06 -0300 Subject: [PATCH 076/141] Initialize junk line tag lists --- src/p_enemy.c | 8 ++++++++ src/p_inter.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/p_enemy.c b/src/p_enemy.c index 22de9bc67..63a14636d 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3924,6 +3924,10 @@ void A_BossDeath(mobj_t *mo) } else { + // Initialize my junk + junk.tags.tags = NULL; + junk.tags.count = 0; + // Bring the egg trap up to the surface // Incredibly shitty code ahead Tag_FSet(&junk.tags, LE_CAPSULE0); @@ -4053,6 +4057,10 @@ bossjustdie: } case MT_KOOPA: { + // Initialize my junk + junk.tags.tags = NULL; + junk.tags.count = 0; + Tag_FSet(&junk.tags, LE_KOOPA); EV_DoCeiling(&junk, raiseToHighest); return; diff --git a/src/p_inter.c b/src/p_inter.c index 415c679e4..9bfe54e54 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1388,6 +1388,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->bot) return; + // Initialize my junk + junk.tags.tags = NULL; + junk.tags.count = 0; + Tag_FSet(&junk.tags, LE_AXE); EV_DoElevator(&junk, bridgeFall, false); From 69248cc684541678162920b5573b125ec3f6bc73 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 30 Nov 2020 16:39:24 -0600 Subject: [PATCH 077/141] thanks zap --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index e357c8b5c..31aadffa6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1341,7 +1341,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) // Transformation animation P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_TRANS1); - if (giverings) && player->rings > 50 + if (giverings && player->rings < 50) player->rings = 50; // Just in case. From c8ae28bbaf3a16ca445647da47968573078507e9 Mon Sep 17 00:00:00 2001 From: Nev3r Date: Tue, 1 Dec 2020 18:35:24 +0100 Subject: [PATCH 078/141] Follow GZDoom's convention for stringargs. --- src/p_setup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 918ffbd4e..e02cb34aa 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1628,9 +1628,9 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val) return; lines[i].args[argnum] = atol(val); } - else if (fastncmp(param, "stringarg", 9) && strlen(param) > 9) + else if (strlen(param) == 7 && fastncmp(param, "arg", 3) && fastncmp(param + 4, "str", 3)) { - size_t argnum = param[9] - '0'; + size_t argnum = param[3] - '0'; if (argnum >= NUMLINESTRINGARGS) return; lines[i].stringargs[argnum] = Z_Malloc(strlen(val) + 1, PU_LEVEL, NULL); @@ -1727,9 +1727,9 @@ static void ParseTextmapThingParameter(UINT32 i, char *param, char *val) return; mapthings[i].args[argnum] = atol(val); } - else if (fastncmp(param, "stringarg", 9) && strlen(param) > 9) + else if (strlen(param) == 7 && fastncmp(param, "arg", 3) && fastncmp(param + 4, "str", 3)) { - size_t argnum = param[9] - '0'; + size_t argnum = param[3] - '0'; if (argnum >= NUMMAPTHINGSTRINGARGS) return; mapthings[i].stringargs[argnum] = Z_Malloc(strlen(val) + 1, PU_LEVEL, NULL); From 4d716cb1707b3822dd333f57214faf8e8875aac1 Mon Sep 17 00:00:00 2001 From: Nev3r Date: Tue, 1 Dec 2020 19:44:58 +0100 Subject: [PATCH 079/141] Move the numerical arg check below so that the string gets checked first (who decided to give them such similar names anyway). --- src/p_setup.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index e02cb34aa..41d8822e2 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1621,13 +1621,6 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val) P_SetLinedefV1(i, atol(val)); else if (fastcmp(param, "v2")) P_SetLinedefV2(i, atol(val)); - else if (fastncmp(param, "arg", 3) && strlen(param) > 3) - { - size_t argnum = atol(param + 3); - if (argnum >= NUMLINEARGS) - return; - lines[i].args[argnum] = atol(val); - } else if (strlen(param) == 7 && fastncmp(param, "arg", 3) && fastncmp(param + 4, "str", 3)) { size_t argnum = param[3] - '0'; @@ -1636,6 +1629,13 @@ static void ParseTextmapLinedefParameter(UINT32 i, char *param, char *val) lines[i].stringargs[argnum] = Z_Malloc(strlen(val) + 1, PU_LEVEL, NULL); M_Memcpy(lines[i].stringargs[argnum], val, strlen(val) + 1); } + else if (fastncmp(param, "arg", 3) && strlen(param) > 3) + { + size_t argnum = atol(param + 3); + if (argnum >= NUMLINEARGS) + return; + lines[i].args[argnum] = atol(val); + } else if (fastcmp(param, "sidefront")) lines[i].sidenum[0] = atol(val); else if (fastcmp(param, "sideback")) @@ -1720,13 +1720,6 @@ static void ParseTextmapThingParameter(UINT32 i, char *param, char *val) else if (fastcmp(param, "ambush") && fastcmp("true", val)) mapthings[i].options |= MTF_AMBUSH; - else if (fastncmp(param, "arg", 3) && strlen(param) > 3) - { - size_t argnum = atol(param + 3); - if (argnum >= NUMMAPTHINGARGS) - return; - mapthings[i].args[argnum] = atol(val); - } else if (strlen(param) == 7 && fastncmp(param, "arg", 3) && fastncmp(param + 4, "str", 3)) { size_t argnum = param[3] - '0'; @@ -1735,6 +1728,13 @@ static void ParseTextmapThingParameter(UINT32 i, char *param, char *val) mapthings[i].stringargs[argnum] = Z_Malloc(strlen(val) + 1, PU_LEVEL, NULL); M_Memcpy(mapthings[i].stringargs[argnum], val, strlen(val) + 1); } + else if (fastncmp(param, "arg", 3) && strlen(param) > 3) + { + size_t argnum = atol(param + 3); + if (argnum >= NUMMAPTHINGARGS) + return; + mapthings[i].args[argnum] = atol(val); + } } /** From a given position table, run a specified parser function through a {}-encapsuled text. From a67862665a054538788fdb7b01575198bc37a35d Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Wed, 2 Dec 2020 12:05:40 -0300 Subject: [PATCH 080/141] Don't spawn the projectile if you're just gonna delete it --- src/p_mobj.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 7ba6d1fad..a259847ea 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -5654,14 +5654,10 @@ static void P_Boss9Thinker(mobj_t *mobj) if (P_RandomRange(1,(dist>>FRACBITS)/16) == 1) break; } - if (spawner) + if (spawner && dist) { mobj_t *missile = P_SpawnMissile(spawner, mobj, MT_MSGATHER); - - if (dist == 0) - missile->fuse = 0; - else - missile->fuse = (dist/P_AproxDistance(missile->momx, missile->momy)); + missile->fuse = (dist/P_AproxDistance(missile->momx, missile->momy)); if (missile->fuse > mobj->fuse) P_RemoveMobj(missile); From 0ffb241c0a1705273c0c93790b67d2ce3474ad0e Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Wed, 2 Dec 2020 15:31:11 -0300 Subject: [PATCH 081/141] Fix 3D floor culling with polyobject segs --- src/r_segs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 1ed1f0285..3bc0d011c 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1191,7 +1191,7 @@ static void R_RenderSegLoop (void) // Lactozilla: Cull part of the column by the 3D floor if it can't be seen // "bottom" is the top pixel of the floor column - if (ffbottom >= bottom-1 && R_FFloorCanClip(&ffloor[i])) + if (ffbottom >= bottom-1 && R_FFloorCanClip(&ffloor[i]) && !curline->polyseg) { rw_floormarked = true; floorclip[rw_x] = fftop; @@ -1239,7 +1239,7 @@ static void R_RenderSegLoop (void) // Lactozilla: Cull part of the column by the 3D floor if it can't be seen // "top" is the height of the ceiling column - if (fftop <= top+1 && R_FFloorCanClip(&ffloor[i])) + if (fftop <= top+1 && R_FFloorCanClip(&ffloor[i]) && !curline->polyseg) { rw_ceilingmarked = true; ceilingclip[rw_x] = ffbottom; From 47b8c0648b2b87fdf7ec388e1f0c3b48239c8cff Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Wed, 2 Dec 2020 15:34:11 -0300 Subject: [PATCH 082/141] Don't clip if the 3D floor is fog --- src/r_segs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_segs.c b/src/r_segs.c index 3bc0d011c..c79071e9b 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -540,7 +540,7 @@ static boolean R_IsFFloorTranslucent(visffloor_t *pfloor) // Polyobjects have no ffloors, and they're handled in the conditional above. if (pfloor->ffloor != NULL) - return (pfloor->ffloor->flags & FF_TRANSLUCENT); + return (pfloor->ffloor->flags & (FF_TRANSLUCENT|FF_FOG)); return false; } From b5526312e7fb36ae58a27f44b3e6e979246ac42e Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Wed, 2 Dec 2020 19:47:00 -0600 Subject: [PATCH 083/141] Fix missing stuff --- src/deh_tables.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index 5733d9b0e..3240aee14 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4331,6 +4331,7 @@ const char *const MOBJFLAG2_LIST[] = { "AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH "LINKDRAW", // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position) "SHIELD", // Thinker calls P_AddShield/P_ShieldLook (must be partnered with MF_SCENERY to use) + "SPLAT", // Object is a splat NULL }; @@ -4871,6 +4872,36 @@ struct int_const_s const INT_CONST[] = { {"tr_trans90",tr_trans90}, {"NUMTRANSMAPS",NUMTRANSMAPS}, + // Alpha styles (blend modes) + {"AST_COPY",AST_COPY}, + {"AST_TRANSLUCENT",AST_TRANSLUCENT}, + {"AST_ADD",AST_ADD}, + {"AST_SUBTRACT",AST_SUBTRACT}, + {"AST_REVERSESUBTRACT",AST_REVERSESUBTRACT}, + {"AST_MODULATE",AST_MODULATE}, + {"AST_OVERLAY",AST_OVERLAY}, + + // Render flags + {"RF_HORIZONTALFLIP",RF_HORIZONTALFLIP}, + {"RF_VERTICALFLIP",RF_VERTICALFLIP}, + {"RF_ABSOLUTEOFFSETS",RF_ABSOLUTEOFFSETS}, + {"RF_FLIPOFFSETS",RF_FLIPOFFSETS}, + {"RF_SPLATMASK",RF_SLOPESPLAT}, + {"RF_SLOPESPLAT",RF_SLOPESPLAT}, + {"RF_OBJECTSLOPESPLAT",RF_OBJECTSLOPESPLAT}, + {"RF_NOSPLATBILLBOARD",RF_NOSPLATBILLBOARD}, + {"RF_NOSPLATROLLANGLE",RF_NOSPLATROLLANGLE}, + {"RF_BLENDMASK",RF_BLENDMASK}, + {"RF_FULLBRIGHT",RF_FULLBRIGHT}, + {"RF_FULLDARK",RF_FULLDARK}, + {"RF_NOCOLORMAPS",RF_NOCOLORMAPS}, + {"RF_SPRITETYPEMASK",RF_SPRITETYPEMASK}, + {"RF_PAPERSPRITE",RF_PAPERSPRITE}, + {"RF_FLOORSPRITE",RF_FLOORSPRITE}, + {"RF_SHADOWDRAW",RF_SHADOWDRAW}, + {"RF_SHADOWEFFECTS",RF_SHADOWEFFECTS}, + {"RF_DROPSHADOW",RF_DROPSHADOW}, + // Level flags {"LF_SCRIPTISFILE",LF_SCRIPTISFILE}, {"LF_SPEEDMUSIC",LF_SPEEDMUSIC}, From c28bd8005eea0cf8ab83326ddb1b0d35deca0e9d Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Thu, 3 Dec 2020 01:28:54 -0600 Subject: [PATCH 084/141] Fix fire objects disappearing in lava --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 7ba6d1fad..d06e57d66 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7937,7 +7937,7 @@ static boolean P_MobjPushableThink(mobj_t *mobj) P_PushableThinker(mobj); // Extinguish fire objects in water. (Yes, it's extraordinarily rare to have a pushable flame object, but Brak uses such a case.) - if (mobj->flags & MF_FIRE && mobj->type != MT_PUMA && mobj->type != MT_FIREBALL + if (mobj->flags & MF_FIRE && mobj->eflags ! MFE_TOUCHLAVA && (mobj->eflags & (MFE_UNDERWATER | MFE_TOUCHWATER))) { P_KillMobj(mobj, NULL, NULL, 0); @@ -9705,7 +9705,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) P_MobjCheckWater(mobj); // Extinguish fire objects in water - if (mobj->flags & MF_FIRE && mobj->type != MT_PUMA && mobj->type != MT_FIREBALL + if (mobj->flags & MF_FIRE && mobj->eflags ! MFE_TOUCHLAVA && (mobj->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))) { P_KillMobj(mobj, NULL, NULL, 0); From 29f56fb2d8c3dc7d2010023278433aad10481960 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Thu, 3 Dec 2020 02:05:10 -0600 Subject: [PATCH 085/141] g --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index d06e57d66..4494c72b7 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7937,7 +7937,7 @@ static boolean P_MobjPushableThink(mobj_t *mobj) P_PushableThinker(mobj); // Extinguish fire objects in water. (Yes, it's extraordinarily rare to have a pushable flame object, but Brak uses such a case.) - if (mobj->flags & MF_FIRE && mobj->eflags ! MFE_TOUCHLAVA + if ((mobj->flags & MF_FIRE) && !(mobj->eflags & MFE_TOUCHLAVA) && (mobj->eflags & (MFE_UNDERWATER | MFE_TOUCHWATER))) { P_KillMobj(mobj, NULL, NULL, 0); @@ -9705,7 +9705,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) P_MobjCheckWater(mobj); // Extinguish fire objects in water - if (mobj->flags & MF_FIRE && mobj->eflags ! MFE_TOUCHLAVA + if ((mobj->flags & MF_FIRE) && !(mobj->eflags & MFE_TOUCHLAVA) && (mobj->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))) { P_KillMobj(mobj, NULL, NULL, 0); From fae845f935db2973da75e5f74197ada426bcd9a8 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Thu, 3 Dec 2020 17:50:10 -0300 Subject: [PATCH 086/141] Initialize in p_spec.c too + magic number replacement --- src/p_spec.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index a1afdd00d..4996573a9 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4420,15 +4420,19 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers // clear the special so you can't push the button twice. sector->special = 0; + // Initialize my junk + junk.tags.tags = NULL; + junk.tags.count = 0; + // Move the button down - Tag_FSet(&junk.tags, 680); + Tag_FSet(&junk.tags, LE_CAPSULE0); EV_DoElevator(&junk, elevateDown, false); // Open the top FOF - Tag_FSet(&junk.tags, 681); + Tag_FSet(&junk.tags, LE_CAPSULE1); EV_DoFloor(&junk, raiseFloorToNearestFast); // Open the bottom FOF - Tag_FSet(&junk.tags, 682); + Tag_FSet(&junk.tags, LE_CAPSULE2); EV_DoCeiling(&junk, lowerToLowestFast); // Mark all players with the time to exit thingy! From 4c53eabc59c8d2d60d90d9019cf5b1939b627647 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 3 Dec 2020 21:14:27 -0500 Subject: [PATCH 087/141] Reword the error to be more consistent with other errors --- src/lua_skinlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index e2f16756a..ea368a9cd 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -340,7 +340,7 @@ static int lib_getSkinSprite(lua_State *L) playersprite_t i = luaL_checkinteger(L, 2); if (i < 0 || i >= NUMPLAYERSPRITES*2) - return luaL_error(L, "skin.sprites[] index %d out of range (0 - %d)", i, (NUMPLAYERSPRITES*2)-1); + return luaL_error(L, LUA_QL("skin_t") " field 'sprites' index %d out of range (0 - %d)", i, (NUMPLAYERSPRITES*2)-1); LUA_PushLightUserdata(L, &sprites[i], META_SKINSPRITESLIST); return 1; From f6af04ecbb45b34488c5c2160b44f6dcda1770cb Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sat, 5 Dec 2020 05:00:59 -0600 Subject: [PATCH 088/141] Fix weird spelling mistake --- src/deh_tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 3240aee14..ff596deea 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4886,7 +4886,7 @@ struct int_const_s const INT_CONST[] = { {"RF_VERTICALFLIP",RF_VERTICALFLIP}, {"RF_ABSOLUTEOFFSETS",RF_ABSOLUTEOFFSETS}, {"RF_FLIPOFFSETS",RF_FLIPOFFSETS}, - {"RF_SPLATMASK",RF_SLOPESPLAT}, + {"RF_SPLATMASK",RF_SPLATMASK}, {"RF_SLOPESPLAT",RF_SLOPESPLAT}, {"RF_OBJECTSLOPESPLAT",RF_OBJECTSLOPESPLAT}, {"RF_NOSPLATBILLBOARD",RF_NOSPLATBILLBOARD}, From 854140932940517a5800b9c93939081f189f2b08 Mon Sep 17 00:00:00 2001 From: katsy Date: Sat, 5 Dec 2020 23:13:47 -0500 Subject: [PATCH 089/141] add noclipheight on chaingrab --- src/p_inter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_inter.c b/src/p_inter.c index 415c679e4..189cbcea7 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1641,6 +1641,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Can't jump first frame player->pflags |= PF_JUMPSTASIS; + // Disable interaction with ground + player->mo->flags |= MF_NOCLIPHEIGHT; + return; } case MT_EGGMOBILE2_POGO: From 3dbb44e7b1afa8d42cf9b83ffcdc02525871f1af Mon Sep 17 00:00:00 2001 From: katsy Date: Sat, 5 Dec 2020 23:17:01 -0500 Subject: [PATCH 090/141] ensure the new flag is cleared properly --- src/p_user.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index c5f919c78..65397c287 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1085,6 +1085,9 @@ void P_ResetPlayer(player_t *player) player->powers[pw_carry] = CR_NONE; } + if (player->powers[pw_carry] == CR_MACESPIN || player->powers[pw_carry] == CR_GENERIC) + player->mo->flags &= ~MF_NOCLIPHEIGHT; + if (!(player->powers[pw_carry] == CR_NIGHTSMODE || player->powers[pw_carry] == CR_NIGHTSFALL || player->powers[pw_carry] == CR_BRAKGOOP || player->powers[pw_carry] == CR_MINECART)) player->powers[pw_carry] = CR_NONE; @@ -4426,6 +4429,8 @@ void P_DoJump(player_t *player, boolean soundandstate) if (!(player->mo->tracer->flags & MF_MISSILE)) // Missiles remember their owner! P_SetTarget(&player->mo->tracer->target, NULL); P_SetTarget(&player->mo->tracer, NULL); + player->mo->flags &= ~MF_NOCLIPHEIGHT; + } else if (player->powers[pw_carry] == CR_ROPEHANG) { @@ -5257,6 +5262,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); player->powers[pw_flashing] = TICRATE/4; + player->mo->flags &= ~MF_NOCLIPHEIGHT; } // can't jump while in air, can't jump while jumping else if (onground || player->climbing || player->powers[pw_carry]) From a7fa2b2e490268da0d75c82e91e825c21bf521a9 Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 6 Dec 2020 00:09:40 -0500 Subject: [PATCH 091/141] Replace p_mobj.c From 768ee5705743d8f42a4b72cac52da7dc910e1ecb Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 6 Dec 2020 00:10:28 -0500 Subject: [PATCH 092/141] Replace p_user.c --- src/p_user.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 65397c287..c5f919c78 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1085,9 +1085,6 @@ void P_ResetPlayer(player_t *player) player->powers[pw_carry] = CR_NONE; } - if (player->powers[pw_carry] == CR_MACESPIN || player->powers[pw_carry] == CR_GENERIC) - player->mo->flags &= ~MF_NOCLIPHEIGHT; - if (!(player->powers[pw_carry] == CR_NIGHTSMODE || player->powers[pw_carry] == CR_NIGHTSFALL || player->powers[pw_carry] == CR_BRAKGOOP || player->powers[pw_carry] == CR_MINECART)) player->powers[pw_carry] = CR_NONE; @@ -4429,8 +4426,6 @@ void P_DoJump(player_t *player, boolean soundandstate) if (!(player->mo->tracer->flags & MF_MISSILE)) // Missiles remember their owner! P_SetTarget(&player->mo->tracer->target, NULL); P_SetTarget(&player->mo->tracer, NULL); - player->mo->flags &= ~MF_NOCLIPHEIGHT; - } else if (player->powers[pw_carry] == CR_ROPEHANG) { @@ -5262,7 +5257,6 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); player->powers[pw_flashing] = TICRATE/4; - player->mo->flags &= ~MF_NOCLIPHEIGHT; } // can't jump while in air, can't jump while jumping else if (onground || player->climbing || player->powers[pw_carry]) From fd4674971a3a2ca7dac8203d801420aa76b06dec Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 6 Dec 2020 00:10:45 -0500 Subject: [PATCH 093/141] Replace p_inter.c --- src/p_inter.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 189cbcea7..415c679e4 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1641,9 +1641,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Can't jump first frame player->pflags |= PF_JUMPSTASIS; - // Disable interaction with ground - player->mo->flags |= MF_NOCLIPHEIGHT; - return; } case MT_EGGMOBILE2_POGO: From 2fcf613a3114803c90e3a7db51035265b5ab066b Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 6 Dec 2020 00:13:10 -0500 Subject: [PATCH 094/141] brak barrier is scaled up by 2x in gameplay, the actual object's parameters should be halved --- src/info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/info.c b/src/info.c index 29a79b1d6..d2f53c55c 100644 --- a/src/info.c +++ b/src/info.c @@ -6458,8 +6458,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // xdeathstate sfx_fizzle, // deathsound 10*FRACUNIT, // speed - 48*FRACUNIT, // radius - 160*FRACUNIT, // height + 24*FRACUNIT, // radius + 80*FRACUNIT, // height 0, // display offset DMG_ELECTRIC, // mass 1, // damage From ffd20ee7538609d2e8dbc841ff43ab3685badabe Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 6 Dec 2020 07:44:49 +0000 Subject: [PATCH 095/141] Revert "ensure the new flag is cleared properly" This reverts commit 3dbb44e7b1afa8d42cf9b83ffcdc02525871f1af --- src/p_user.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 65397c287..c5f919c78 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1085,9 +1085,6 @@ void P_ResetPlayer(player_t *player) player->powers[pw_carry] = CR_NONE; } - if (player->powers[pw_carry] == CR_MACESPIN || player->powers[pw_carry] == CR_GENERIC) - player->mo->flags &= ~MF_NOCLIPHEIGHT; - if (!(player->powers[pw_carry] == CR_NIGHTSMODE || player->powers[pw_carry] == CR_NIGHTSFALL || player->powers[pw_carry] == CR_BRAKGOOP || player->powers[pw_carry] == CR_MINECART)) player->powers[pw_carry] = CR_NONE; @@ -4429,8 +4426,6 @@ void P_DoJump(player_t *player, boolean soundandstate) if (!(player->mo->tracer->flags & MF_MISSILE)) // Missiles remember their owner! P_SetTarget(&player->mo->tracer->target, NULL); P_SetTarget(&player->mo->tracer, NULL); - player->mo->flags &= ~MF_NOCLIPHEIGHT; - } else if (player->powers[pw_carry] == CR_ROPEHANG) { @@ -5262,7 +5257,6 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); player->powers[pw_flashing] = TICRATE/4; - player->mo->flags &= ~MF_NOCLIPHEIGHT; } // can't jump while in air, can't jump while jumping else if (onground || player->climbing || player->powers[pw_carry]) From 5853a0b4d837fbb83c092c2a91ef4566ab906e64 Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 6 Dec 2020 07:44:59 +0000 Subject: [PATCH 096/141] Revert "add noclipheight on chaingrab" This reverts commit 854140932940517a5800b9c93939081f189f2b08 --- src/p_inter.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 189cbcea7..415c679e4 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1641,9 +1641,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // Can't jump first frame player->pflags |= PF_JUMPSTASIS; - // Disable interaction with ground - player->mo->flags |= MF_NOCLIPHEIGHT; - return; } case MT_EGGMOBILE2_POGO: From 8f4d23197c299d59778eede6a8c8424058f851d6 Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 6 Dec 2020 04:32:30 -0500 Subject: [PATCH 097/141] space --- src/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index d2f53c55c..56e764b5d 100644 --- a/src/info.c +++ b/src/info.c @@ -6459,7 +6459,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_fizzle, // deathsound 10*FRACUNIT, // speed 24*FRACUNIT, // radius - 80*FRACUNIT, // height + 80*FRACUNIT, // height 0, // display offset DMG_ELECTRIC, // mass 1, // damage From 233990099db1380560bfa64bb89c95340ed01124 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sun, 6 Dec 2020 04:28:12 -0600 Subject: [PATCH 098/141] Make caret coloring support letters. --- src/dehacked.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index e98ff71cf..b42663267 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -59,6 +59,12 @@ ATTRINLINE static FUNCINLINE char myfget_color(MYFILE *f) if (c >= '0' && c <= '9') return 0x80+(c-'0'); + + c = tolower(c); + + if (c >= 'a' && c <= 'f') + return 0x80+10+(c-'a'); + return 0x80; // Unhandled -- default to no color } From 3b85abdee7e557818486ef06f6714cb374360c11 Mon Sep 17 00:00:00 2001 From: Tatsuru <44866610+Ikkarin@users.noreply.github.com> Date: Sun, 6 Dec 2020 14:11:08 -0300 Subject: [PATCH 099/141] Kill saloon doors without a tracer, add height check for non-blocking doors --- src/p_map.c | 6 ++++-- src/p_mobj.c | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 922c0d9ec..24311c35a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -982,7 +982,8 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->type == MT_SALOONDOOR && tmthing->player) { mobj_t *ref = (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer)) ? tmthing->tracer : tmthing; - if ((thing->flags2 & MF2_AMBUSH) || ref != tmthing) + if (((thing->flags2 & MF2_AMBUSH) && (tmthing->z <= thing->z + thing->height) && (tmthing->z + tmthing->height >= thing->z)) + || ref != tmthing) { fixed_t dm = min(FixedHypot(ref->momx, ref->momy), 16*FRACUNIT); angle_t ang = R_PointToAngle2(0, 0, ref->momx, ref->momy) - thing->angle; @@ -995,7 +996,8 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->type == MT_SALOONDOORCENTER && tmthing->player) { - if ((thing->flags2 & MF2_AMBUSH) || (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer))) + if (((thing->flags2 & MF2_AMBUSH) && (tmthing->z <= thing->z + thing->height) && (tmthing->z + tmthing->height >= thing->z)) + || (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer))) return true; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 7ba6d1fad..65113a840 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9651,6 +9651,12 @@ static boolean P_MobjRegularThink(mobj_t *mobj) break; } case MT_SALOONDOOR: + if (!mobj->tracer) // Door center is gone or not spawned? + { + P_RemoveMobj(mobj); // Die + return false; + } + P_SaloonDoorThink(mobj); break; case MT_MINECARTSPAWNER: From 6546fc8ce775298d7818061166434992c598be38 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Sun, 6 Dec 2020 12:01:31 -0600 Subject: [PATCH 100/141] Fix HWR_DrawCroppedPatch scaling a patch when cropping the top and left sides. --- src/hardware/hw_draw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index b9cb288e9..c5d362520 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -506,13 +506,13 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, v[0].s = v[3].s = ((sx)/(float)(gpatch->width))*hwrPatch->max_s; if (sx + w > gpatch->width) - v[2].s = v[1].s = hwrPatch->max_s; + v[2].s = v[1].s = hwrPatch->max_s - ((sx+w)/(float)(gpatch->width))*hwrPatch->max_s; else v[2].s = v[1].s = ((sx+w)/(float)(gpatch->width))*hwrPatch->max_s; v[0].t = v[1].t = ((sy)/(float)(gpatch->height))*hwrPatch->max_t; if (sy + h > gpatch->height) - v[2].t = v[3].t = hwrPatch->max_t; + v[2].t = v[3].t = hwrPatch->max_t - ((sy+h)/(float)(gpatch->height))*hwrPatch->max_t; else v[2].t = v[3].t = ((sy+h)/(float)(gpatch->height))*hwrPatch->max_t; From 24ba78214421ff6fe4aafc5480a9d5e6e66c49db Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Sun, 6 Dec 2020 17:29:20 -0300 Subject: [PATCH 101/141] Fix archived mobjs having no default blend mode and sprite scales --- src/p_saveg.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index adedea049..03229e740 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1506,7 +1506,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) { const mobj_t *mobj = (const mobj_t *)th; UINT32 diff; - UINT16 diff2; + UINT32 diff2; // Ignore stationary hoops - these will be respawned from mapthings. if (mobj->type == MT_HOOP) @@ -1638,7 +1638,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 |= MD2_SHADOWSCALE; if (mobj->renderflags) diff2 |= MD2_RENDERFLAGS; - if (mobj->renderflags) + if (mobj->blendmode != AST_TRANSLUCENT) diff2 |= MD2_BLENDMODE; if (mobj->spritexscale != FRACUNIT) diff2 |= MD2_SPRITEXSCALE; @@ -1646,6 +1646,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 |= MD2_SPRITEYSCALE; if (mobj->spritexoffset) diff2 |= MD2_SPRITEXOFFSET; + if (mobj->spriteyoffset) + diff2 |= MD2_SPRITEYOFFSET; if (mobj->floorspriteslope) { pslope_t *slope = mobj->floorspriteslope; @@ -1667,7 +1669,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEUINT8(save_p, type); WRITEUINT32(save_p, diff); if (diff & MD_MORE) - WRITEUINT16(save_p, diff2); + WRITEUINT32(save_p, diff2); // save pointer, at load time we will search this pointer to reinitilize pointers WRITEUINT32(save_p, (size_t)mobj); @@ -2615,14 +2617,14 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) thinker_t *next; mobj_t *mobj; UINT32 diff; - UINT16 diff2; + UINT32 diff2; INT32 i; fixed_t z, floorz, ceilingz; ffloor_t *floorrover = NULL, *ceilingrover = NULL; diff = READUINT32(save_p); if (diff & MD_MORE) - diff2 = READUINT16(save_p); + diff2 = READUINT32(save_p); else diff2 = 0; @@ -2843,10 +2845,16 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->renderflags = READUINT32(save_p); if (diff2 & MD2_BLENDMODE) mobj->blendmode = READINT32(save_p); + else + mobj->blendmode = AST_TRANSLUCENT; if (diff2 & MD2_SPRITEXSCALE) mobj->spritexscale = READFIXED(save_p); + else + mobj->spritexscale = FRACUNIT; if (diff2 & MD2_SPRITEYSCALE) mobj->spriteyscale = READFIXED(save_p); + else + mobj->spriteyscale = FRACUNIT; if (diff2 & MD2_SPRITEXOFFSET) mobj->spritexoffset = READFIXED(save_p); if (diff2 & MD2_SPRITEYOFFSET) From 6f9c48a30560b0f2d89f7202371dfc164015b9ba Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Sun, 6 Dec 2020 17:46:35 -0300 Subject: [PATCH 102/141] Move a few mobj spawn defaults to its own function --- src/p_local.h | 1 + src/p_mobj.c | 76 ++++++++++++++++++++++++++++----------------------- src/p_saveg.c | 40 ++------------------------- 3 files changed, 46 insertions(+), 71 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 8a5084962..96401bb75 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -279,6 +279,7 @@ mobjtype_t P_GetMobjtype(UINT16 mthingtype); void P_RespawnSpecials(void); mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type); +void P_SetMobjSpawnDefaults(mobj_t *mobj); void P_RecalcPrecipInSector(sector_t *sector); void P_PrecipitationEffects(void); diff --git a/src/p_mobj.c b/src/p_mobj.c index 7ba6d1fad..e664d85be 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10438,44 +10438,11 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) mobj->x = x; mobj->y = y; - mobj->radius = info->radius; - mobj->height = info->height; - mobj->flags = info->flags; - - mobj->health = (info->spawnhealth ? info->spawnhealth : 1); - - mobj->reactiontime = info->reactiontime; - - mobj->lastlook = -1; // stuff moved in P_enemy.P_LookForPlayer - - // do not set the state with P_SetMobjState, - // because action routines can not be called yet - st = &states[info->spawnstate]; - - mobj->state = st; - mobj->tics = st->tics; - mobj->sprite = st->sprite; - mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits.. - P_SetupStateAnimation(mobj, st); - - mobj->friction = ORIG_FRICTION; - - mobj->movefactor = FRACUNIT; - - // All mobjs are created at 100% scale. - mobj->scale = FRACUNIT; - mobj->destscale = mobj->scale; - mobj->scalespeed = FRACUNIT/12; - // TODO: Make this a special map header if ((maptol & TOL_ERZ3) && !(mobj->type == MT_BLACKEGGMAN)) mobj->destscale = FRACUNIT/2; - // Sprite rendering - mobj->blendmode = AST_TRANSLUCENT; - mobj->spritexscale = mobj->spriteyscale = mobj->scale; - mobj->spritexoffset = mobj->spriteyoffset = 0; - mobj->floorspriteslope = NULL; + P_SetMobjSpawnDefaults(mobj); // set subsector and/or block links P_SetThingPosition(mobj); @@ -10785,6 +10752,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) mobj->frame &= ~FF_FRAMEMASK; } + st = &states[info->spawnstate]; + // Call action functions when the state is set if (st->action.acp1 && (mobj->flags & MF_RUNSPAWNFUNC)) { @@ -10815,6 +10784,45 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) return mobj; } +void P_SetMobjSpawnDefaults(mobj_t *mobj) +{ + const mobjinfo_t *info = mobj->info; + state_t *st = &states[info->spawnstate]; + + mobj->radius = info->radius; + mobj->height = info->height; + mobj->flags = info->flags; + + mobj->health = (info->spawnhealth ? info->spawnhealth : 1); + + mobj->reactiontime = info->reactiontime; + + mobj->lastlook = -1; // stuff moved in P_enemy.P_LookForPlayer + + // do not set the state with P_SetMobjState, + // because action routines can not be called yet + mobj->state = st; + mobj->tics = st->tics; + mobj->sprite = st->sprite; + mobj->frame = st->frame; // FF_FRAMEMASK for frame, and other bits.. + P_SetupStateAnimation(mobj, st); + + mobj->friction = ORIG_FRICTION; + + mobj->movefactor = FRACUNIT; + + // All mobjs are created at 100% scale. + mobj->scale = FRACUNIT; + mobj->destscale = mobj->scale; + mobj->scalespeed = FRACUNIT/12; + + // Sprite rendering + mobj->blendmode = AST_TRANSLUCENT; + mobj->spritexscale = mobj->spriteyscale = mobj->scale; + mobj->spritexoffset = mobj->spriteyoffset = 0; + mobj->floorspriteslope = NULL; +} + static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) { state_t *st; diff --git a/src/p_saveg.c b/src/p_saveg.c index 03229e740..c1364e08f 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -2692,7 +2692,10 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) } mobj->type = i; } + mobj->info = &mobjinfo[mobj->type]; + P_SetMobjSpawnDefaults(mobj); + if (diff & MD_POS) { mobj->x = READFIXED(save_p); @@ -2718,35 +2721,21 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) if (diff & MD_RADIUS) mobj->radius = READFIXED(save_p); - else - mobj->radius = mobj->info->radius; if (diff & MD_HEIGHT) mobj->height = READFIXED(save_p); - else - mobj->height = mobj->info->height; if (diff & MD_FLAGS) mobj->flags = READUINT32(save_p); - else - mobj->flags = mobj->info->flags; if (diff & MD_FLAGS2) mobj->flags2 = READUINT32(save_p); if (diff & MD_HEALTH) mobj->health = READINT32(save_p); - else - mobj->health = mobj->info->spawnhealth; if (diff & MD_RTIME) mobj->reactiontime = READINT32(save_p); - else - mobj->reactiontime = mobj->info->reactiontime; if (diff & MD_STATE) mobj->state = &states[READUINT16(save_p)]; - else - mobj->state = &states[mobj->info->spawnstate]; if (diff & MD_TICS) mobj->tics = READINT32(save_p); - else - mobj->tics = mobj->state->tics; if (diff & MD_SPRITE) { mobj->sprite = READUINT16(save_p); if (mobj->sprite == SPR_PLAY) @@ -2762,11 +2751,6 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->frame = READUINT32(save_p); mobj->anim_duration = READUINT16(save_p); } - else - { - mobj->frame = mobj->state->frame; - mobj->anim_duration = (UINT16)mobj->state->var2; - } if (diff & MD_EFLAGS) mobj->eflags = READUINT16(save_p); if (diff & MD_PLAYER) @@ -2783,20 +2767,14 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->threshold = READINT32(save_p); if (diff & MD_LASTLOOK) mobj->lastlook = READINT32(save_p); - else - mobj->lastlook = -1; if (diff & MD_TARGET) mobj->target = (mobj_t *)(size_t)READUINT32(save_p); if (diff & MD_TRACER) mobj->tracer = (mobj_t *)(size_t)READUINT32(save_p); if (diff & MD_FRICTION) mobj->friction = READFIXED(save_p); - else - mobj->friction = ORIG_FRICTION; if (diff & MD_MOVEFACTOR) mobj->movefactor = READFIXED(save_p); - else - mobj->movefactor = FRACUNIT; if (diff & MD_FUSE) mobj->fuse = READINT32(save_p); if (diff & MD_WATERTOP) @@ -2805,16 +2783,10 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->waterbottom = READFIXED(save_p); if (diff & MD_SCALE) mobj->scale = READFIXED(save_p); - else - mobj->scale = FRACUNIT; if (diff & MD_DSCALE) mobj->destscale = READFIXED(save_p); - else - mobj->destscale = mobj->scale; if (diff2 & MD2_SCALESPEED) mobj->scalespeed = READFIXED(save_p); - else - mobj->scalespeed = FRACUNIT/12; if (diff2 & MD2_CUSVAL) mobj->cusval = READINT32(save_p); if (diff2 & MD2_CVMEM) @@ -2845,16 +2817,10 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->renderflags = READUINT32(save_p); if (diff2 & MD2_BLENDMODE) mobj->blendmode = READINT32(save_p); - else - mobj->blendmode = AST_TRANSLUCENT; if (diff2 & MD2_SPRITEXSCALE) mobj->spritexscale = READFIXED(save_p); - else - mobj->spritexscale = FRACUNIT; if (diff2 & MD2_SPRITEYSCALE) mobj->spriteyscale = READFIXED(save_p); - else - mobj->spriteyscale = FRACUNIT; if (diff2 & MD2_SPRITEXOFFSET) mobj->spritexoffset = READFIXED(save_p); if (diff2 & MD2_SPRITEYOFFSET) From 18ee97c583117e7d10e4914e473e47adbfaa13d4 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Sun, 6 Dec 2020 20:17:14 -0300 Subject: [PATCH 103/141] Fix animated skincolors in OpenGL --- src/hardware/hw_cache.c | 73 +++++++++++++++++++++++++++++++++-------- src/hardware/hw_data.h | 13 ++++++-- src/hardware/hw_main.c | 4 +-- src/hardware/hw_md2.c | 17 ++++++++-- src/m_menu.c | 11 ++----- src/z_zone.c | 12 +++---- 6 files changed, 95 insertions(+), 35 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index b4fa7ec6c..43fdc89f0 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -108,7 +108,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm //Hurdler: 25/04/2000: now support colormap in hardware mode if (mipmap->colormap) - texel = mipmap->colormap[texel]; + texel = mipmap->colormap->data[texel]; // hope compiler will get this switch out of the loops (dreams...) // gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?) @@ -218,7 +218,7 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block, //Hurdler: 25/04/2000: now support colormap in hardware mode if (mipmap->colormap) - texel = mipmap->colormap[texel]; + texel = mipmap->colormap->data[texel]; // hope compiler will get this switch out of the loops (dreams...) // gcc do it ! but vcc not ! (why don't use cygwin gcc for win32 ?) @@ -659,7 +659,10 @@ void HWR_FreeTextureColormaps(patch_t *patch) // Free image data from memory. if (next->data) Z_Free(next->data); + if (next->colormap) + Z_Free(next->colormap); next->data = NULL; + next->colormap = NULL; HWD.pfnDeleteTexture(next); // Free the old colormap mipmap from memory. @@ -667,16 +670,29 @@ void HWR_FreeTextureColormaps(patch_t *patch) } } +static boolean FreeTextureCallback(void *mem) +{ + patch_t *patch = (patch_t *)mem; + HWR_FreeTexture(patch); + return false; +} + +static boolean FreeColormapsCallback(void *mem) +{ + patch_t *patch = (patch_t *)mem; + HWR_FreeTextureColormaps(patch); + return false; +} + static void HWR_FreePatchCache(boolean freeall) { - INT32 i; + boolean (*callback)(void *mem) = FreeTextureCallback; - for (i = 0; i < numwadfiles; i++) - { - INT32 j = 0; - for (; j < wadfiles[i]->numlumps; j++) - (freeall ? HWR_FreeTexture : HWR_FreeTextureColormaps)(wadfiles[i]->patchcache[j]); - } + if (!freeall) + callback = FreeColormapsCallback; + + Z_IterateTags(PU_PATCH, PU_PATCH_ROTATED, callback); + Z_IterateTags(PU_SPRITE, PU_HUDGFX, callback); } // free all textures after each level @@ -977,8 +993,28 @@ static void HWR_LoadPatchMipmap(patch_t *patch, GLMipmap_t *grMipmap) Z_ChangeTag(grMipmap->data, PU_HWRCACHE_UNLOCKED); } +// ----------------------+ +// HWR_UpdatePatchMipmap : Updates a mipmap. +// ----------------------+ +static void HWR_UpdatePatchMipmap(patch_t *patch, GLMipmap_t *grMipmap) +{ + GLPatch_t *grPatch = patch->hardware; + HWR_MakePatch(patch, grPatch, grMipmap, true); + + // If hardware does not have the texture, then call pfnSetTexture to upload it + // If it does have the texture, then call pfnUpdateTexture to update it + if (!grMipmap->downloaded) + HWD.pfnSetTexture(grMipmap); + else + HWD.pfnUpdateTexture(grMipmap); + HWR_SetCurrentTexture(grMipmap); + + // The system-memory data can be purged now. + Z_ChangeTag(grMipmap->data, PU_HWRCACHE_UNLOCKED); +} + // -----------------+ -// HWR_GetPatch : Download a patch to the hardware cache and make it ready for use +// HWR_GetPatch : Downloads a patch to the hardware cache and make it ready for use // -----------------+ void HWR_GetPatch(patch_t *patch) { @@ -1006,14 +1042,20 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap) return; } - // search for the mimmap + // search for the mipmap // skip the first (no colormap translated) for (grMipmap = grPatch->mipmap; grMipmap->nextcolormap; ) { grMipmap = grMipmap->nextcolormap; - if (grMipmap->colormap == colormap) + if (grMipmap->colormap && grMipmap->colormap->source == colormap) { - HWR_LoadPatchMipmap(patch, grMipmap); + if (memcmp(grMipmap->colormap->data, colormap, 256 * sizeof(UINT8))) + { + M_Memcpy(grMipmap->colormap->data, colormap, 256 * sizeof(UINT8)); + HWR_UpdatePatchMipmap(patch, grMipmap); + } + else + HWR_LoadPatchMipmap(patch, grMipmap); return; } } @@ -1029,7 +1071,10 @@ void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap) I_Error("%s: Out of memory", "HWR_GetMappedPatch"); grMipmap->nextcolormap = newMipmap; - newMipmap->colormap = colormap; + newMipmap->colormap = Z_Calloc(sizeof(*newMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL); + newMipmap->colormap->source = colormap; + M_Memcpy(newMipmap->colormap->data, colormap, 256 * sizeof(UINT8)); + HWR_LoadPatchMipmap(patch, newMipmap); } diff --git a/src/hardware/hw_data.h b/src/hardware/hw_data.h index 3ae4ef8bc..11e41b18a 100644 --- a/src/hardware/hw_data.h +++ b/src/hardware/hw_data.h @@ -39,6 +39,15 @@ typedef enum GLTextureFormat_e GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22, } GLTextureFormat_t; +// Colormap structure for mipmaps. +struct GLColormap_s +{ + const UINT8 *source; + UINT8 data[256]; +}; +typedef struct GLColormap_s GLColormap_t; + + // data holds the address of the graphics data cached in heap memory // NULL if the texture is not in Doom heap cache. struct GLMipmap_s @@ -53,7 +62,7 @@ struct GLMipmap_s UINT32 downloaded; // The GPU has this texture. struct GLMipmap_s *nextcolormap; - const UINT8 *colormap; + struct GLColormap_s *colormap; struct GLMipmap_s *nextmipmap; // Linked list of all textures }; @@ -77,7 +86,7 @@ struct GLPatch_s { float max_s,max_t; GLMipmap_t *mipmap; -} ATTRPACK; +}; typedef struct GLPatch_s GLPatch_t; #endif //_HWR_DATA_ diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 5dd2727bc..902ce55bd 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5295,7 +5295,7 @@ static void HWR_ProjectSprite(mobj_t *thing) vis->colormap = R_GetTranslationColormap(TC_DEFAULT, vis->mobj->color ? vis->mobj->color : SKINCOLOR_CYAN, GTC_CACHE); } else - vis->colormap = colormaps; + vis->colormap = NULL; // set top/bottom coords vis->gzt = gzt; @@ -5396,7 +5396,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) vis->flip = flip; vis->mobj = (mobj_t *)thing; - vis->colormap = colormaps; + vis->colormap = NULL; // set top/bottom coords vis->gzt = FIXED_TO_FLOAT(thing->z + spritecachedinfo[lumpoff].topoffset); diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 9c786e67e..2e944d3e6 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1106,11 +1106,19 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendpatch, INT32 ski for (grMipmap = grPatch->mipmap; grMipmap->nextcolormap; ) { grMipmap = grMipmap->nextcolormap; - if (grMipmap->colormap == colormap) + if (grMipmap->colormap && grMipmap->colormap->source == colormap) { if (grMipmap->downloaded && grMipmap->data) { - HWD.pfnSetTexture(grMipmap); // found the colormap, set it to the correct texture + if (memcmp(grMipmap->colormap->data, colormap, 256 * sizeof(UINT8))) + { + M_Memcpy(grMipmap->colormap->data, colormap, 256 * sizeof(UINT8)); + HWR_CreateBlendedTexture(patch, blendpatch, grMipmap, skinnum, color); + HWD.pfnUpdateTexture(grMipmap); + } + else + HWD.pfnSetTexture(grMipmap); // found the colormap, set it to the correct texture + Z_ChangeTag(grMipmap->data, PU_HWRMODELTEXTURE_UNLOCKED); return; } @@ -1128,7 +1136,10 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendpatch, INT32 ski if (newMipmap == NULL) I_Error("%s: Out of memory", "HWR_GetBlendedTexture"); grMipmap->nextcolormap = newMipmap; - newMipmap->colormap = colormap; + + newMipmap->colormap = Z_Calloc(sizeof(*newMipmap->colormap), PU_HWRPATCHCOLMIPMAP, NULL); + newMipmap->colormap->source = colormap; + M_Memcpy(newMipmap->colormap->data, colormap, 256 * sizeof(UINT8)); HWR_CreateBlendedTexture(patch, blendpatch, newMipmap, skinnum, color); diff --git a/src/m_menu.c b/src/m_menu.c index 77648f877..3a6b5ce22 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8423,7 +8423,7 @@ static void M_DrawLoadGameData(void) sprdef = &charbotskin->sprites[SPR2_SIGN]; if (!sprdef->numframes) goto skipbot; - colormap = R_GetTranslationColormap(savegameinfo[savetodraw].botskin-1, charbotskin->prefcolor, 0); + colormap = R_GetTranslationColormap(savegameinfo[savetodraw].botskin-1, charbotskin->prefcolor, GTC_CACHE); sprframe = &sprdef->spriteframes[0]; patch = W_CachePatchNum(sprframe->lumppat[0], PU_PATCH); @@ -8433,8 +8433,6 @@ static void M_DrawLoadGameData(void) charbotskin->highresscale, 0, patch, colormap); - Z_Free(colormap); - tempx -= (20<sprites[SPR2_SIGN]; - colormap = R_GetTranslationColormap(savegameinfo[savetodraw].skinnum, charskin->prefcolor, 0); + colormap = R_GetTranslationColormap(savegameinfo[savetodraw].skinnum, charskin->prefcolor, GTC_CACHE); if (!sprdef->numframes) goto skipsign; sprframe = &sprdef->spriteframes[0]; @@ -8483,8 +8481,6 @@ skipsign: charskin->highresscale/2, 0, patch, colormap); skiplife: - if (colormap) - Z_Free(colormap); patch = W_CachePatchName("STLIVEX", PU_PATCH); @@ -11755,7 +11751,7 @@ static void M_DrawSetupMultiPlayerMenu(void) goto faildraw; // ok, draw player sprite for sure now - colormap = R_GetTranslationColormap(setupm_fakeskin, setupm_fakecolor->color, 0); + colormap = R_GetTranslationColormap(setupm_fakeskin, setupm_fakecolor->color, GTC_CACHE); if (multi_frame >= sprdef->numframes) multi_frame = 0; @@ -11773,7 +11769,6 @@ static void M_DrawSetupMultiPlayerMenu(void) FixedDiv(skins[setupm_fakeskin].highresscale, skins[setupm_fakeskin].shieldscale), flags, patch, colormap); - Z_Free(colormap); goto colordraw; faildraw: diff --git a/src/z_zone.c b/src/z_zone.c index ad64a3a07..d7da17e51 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -813,12 +813,12 @@ static void Command_Memfree_f(void) #ifdef HWRENDER if (rendermode == render_opengl) { - CONS_Printf(M_GetText("Patch info headers: %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHINFO)>>10)); - CONS_Printf(M_GetText("Mipmap patches : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10)); - CONS_Printf(M_GetText("HW Texture cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10)); - CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10)); - CONS_Printf(M_GetText("HW model textures : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRMODELTEXTURE)>>10)); - CONS_Printf(M_GetText("HW Texture used : %7d KB\n"), HWR_GetTextureUsed()>>10); + CONS_Printf(M_GetText("Patch info headers : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHINFO)>>10)); + CONS_Printf(M_GetText("Cached textures : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10)); + CONS_Printf(M_GetText("Texture colormaps : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10)); + CONS_Printf(M_GetText("Model textures : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRMODELTEXTURE)>>10)); + CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10)); + CONS_Printf(M_GetText("All GPU textures : %7d KB\n"), HWR_GetTextureUsed()>>10); } #endif From 284205baacdd2ffb923ef222a3469178f9ddd12f Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 6 Dec 2020 22:20:06 -0500 Subject: [PATCH 104/141] Fix SPC looping on libgme versions >= 0.6.3 --- src/sdl/mixer_sound.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index c64164caa..d67536b04 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -1298,6 +1298,9 @@ boolean I_PlaySong(boolean looping) if (gme) { gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; +#if GME_VERSION >= 0x000603 + gme_set_autoload_playback_limit(gme, 0); +#endif gme_set_equalizer(gme, &eq); gme_start_track(gme, 0); current_track = 0; From c3a560f51d274b039bc3441bb8f4f2994350ea86 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 6 Dec 2020 22:30:50 -0500 Subject: [PATCH 105/141] Let's check for looping first --- src/sdl/mixer_sound.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index d67536b04..490ebb5ba 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -1299,7 +1299,8 @@ boolean I_PlaySong(boolean looping) { gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; #if GME_VERSION >= 0x000603 - gme_set_autoload_playback_limit(gme, 0); + if (looping) + gme_set_autoload_playback_limit(gme, 0); #endif gme_set_equalizer(gme, &eq); gme_start_track(gme, 0); From 11bbad9be8231c0403c1fb41d7c65c4a62a3fec3 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 6 Dec 2020 22:58:17 -0500 Subject: [PATCH 106/141] Tab fix --- src/sdl/mixer_sound.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 490ebb5ba..5cae48077 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -1299,8 +1299,8 @@ boolean I_PlaySong(boolean looping) { gme_equalizer_t eq = {GME_TREBLE, GME_BASS, 0,0,0,0,0,0,0,0}; #if GME_VERSION >= 0x000603 - if (looping) - gme_set_autoload_playback_limit(gme, 0); + if (looping) + gme_set_autoload_playback_limit(gme, 0); #endif gme_set_equalizer(gme, &eq); gme_start_track(gme, 0); From 27217259624c287b131d92e2f762057fa791bd12 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 7 Dec 2020 16:46:05 -0600 Subject: [PATCH 107/141] Final lap text for circuit --- src/p_spec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_spec.c b/src/p_spec.c index a1afdd00d..cdab17c97 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4823,6 +4823,8 @@ DoneSection2: if (player->laps >= (UINT8)cv_numlaps.value) CONS_Printf(M_GetText("%s has finished the race.\n"), player_names[player-players]); + else if (player->laps == (UINT8)cv_numlaps.value-1) + CONS_Printf(M_GetText("%s started the %c%s%c!\n"), player_names[player-players], 0x85, M_GetText("final lap"), 0x80); else CONS_Printf(M_GetText("%s started lap %u\n"), player_names[player-players], (UINT32)player->laps+1); From c2de684150262cca19402bcace64c14da3362767 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 7 Dec 2020 17:52:43 -0500 Subject: [PATCH 108/141] Fix double free occuring when unloading the intermission patches due to the same patch being cached twice --- src/y_inter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 061cbb5e1..bd3b557d7 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1229,7 +1229,10 @@ void Y_StartIntermission(void) data.coop.tics = players[consoleplayer].realtime; for (i = 0; i < 4; ++i) - data.coop.bonuspatches[i] = W_CachePatchName(data.coop.bonuses[i].patch, PU_PATCH); + { + if (strlen(data.coop.bonuses[i].patch)) + data.coop.bonuspatches[i] = W_CachePatchName(data.coop.bonuses[i].patch, PU_PATCH); + } data.coop.ptotal = W_CachePatchName("YB_TOTAL", PU_PATCH); // get act number @@ -1733,7 +1736,6 @@ static void Y_SetNullBonus(player_t *player, y_bonus_t *bstruct) { (void)player; memset(bstruct, 0, sizeof(y_bonus_t)); - strncpy(bstruct->patch, "MISSING", sizeof(bstruct->patch)); } // From 45a4b728b354fd867641e6c7c372c052ad827d32 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Tue, 8 Dec 2020 12:05:06 -0600 Subject: [PATCH 109/141] zwip suggestion --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index cdab17c97..06eee3b12 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4824,7 +4824,7 @@ DoneSection2: if (player->laps >= (UINT8)cv_numlaps.value) CONS_Printf(M_GetText("%s has finished the race.\n"), player_names[player-players]); else if (player->laps == (UINT8)cv_numlaps.value-1) - CONS_Printf(M_GetText("%s started the %c%s%c!\n"), player_names[player-players], 0x85, M_GetText("final lap"), 0x80); + CONS_Printf(M_GetText("%s started the \205final lap\200!\n"), player_names[player-players]); else CONS_Printf(M_GetText("%s started lap %u\n"), player_names[player-players], (UINT32)player->laps+1); From 1b888c689cb2a5a24e13f7fcf34f0b2235dad86c Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Tue, 8 Dec 2020 15:56:45 -0600 Subject: [PATCH 110/141] CTF text 1 --- src/p_spec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 06eee3b12..e79e02812 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4600,7 +4600,7 @@ DoneSection2: HU_SetCEchoFlags(V_AUTOFADEOUT|V_ALLOWLOWERCASE); HU_SetCEchoDuration(5); - HU_DoCEcho(va(M_GetText("%s%s%s\\CAPTURED THE %sBLUE FLAG%s.\\\\\\\\"), "\x85", player_names[player-players], "\x80", "\x84", "\x80")); + HU_DoCEcho(va(M_GetText("\205%s\200\\CAPTURED THE \204BLUE FLAG\200.\\\\\\\\"), player_names[player-players])); if (splitscreen || players[consoleplayer].ctfteam == 1) S_StartSound(NULL, sfx_flgcap); @@ -4633,7 +4633,7 @@ DoneSection2: HU_SetCEchoFlags(V_AUTOFADEOUT|V_ALLOWLOWERCASE); HU_SetCEchoDuration(5); - HU_DoCEcho(va(M_GetText("%s%s%s\\CAPTURED THE %sRED FLAG%s.\\\\\\\\"), "\x84", player_names[player-players], "\x80", "\x85", "\x80")); + HU_DoCEcho(va(M_GetText("\204%s\200\\CAPTURED THE \205RED FLAG\200.\\\\\\\\"), player_names[player-players])); if (splitscreen || players[consoleplayer].ctfteam == 2) S_StartSound(NULL, sfx_flgcap); From 7082db485b754bd0a007d44b3e71edcdd9e40c96 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Tue, 8 Dec 2020 16:09:51 -0600 Subject: [PATCH 111/141] CTF text 2, branch is finished --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 7ba6d1fad..0e80496b5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9835,7 +9835,7 @@ static void P_FlagFuseThink(mobj_t *mobj) if (mobj->type == MT_REDFLAG) { if (!(mobj->flags2 & MF2_JUSTATTACKED)) - CONS_Printf(M_GetText("The %c%s%c has returned to base.\n"), 0x85, M_GetText("Red flag"), 0x80); + CONS_Printf(M_GetText("The \205Red flag\200 has returned to base.\n")); // Assumedly in splitscreen players will be on opposing teams if (players[consoleplayer].ctfteam == 1 || splitscreen) @@ -9848,7 +9848,7 @@ static void P_FlagFuseThink(mobj_t *mobj) else // MT_BLUEFLAG { if (!(mobj->flags2 & MF2_JUSTATTACKED)) - CONS_Printf(M_GetText("The %c%s%c has returned to base.\n"), 0x84, M_GetText("Blue flag"), 0x80); + CONS_Printf(M_GetText("The \204Blue flag\200 has returned to base.\n")); // Assumedly in splitscreen players will be on opposing teams if (players[consoleplayer].ctfteam == 2 || splitscreen) From e7883f3f8e5514433f0e73d9118a7d51e483b135 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 17 Nov 2020 02:51:11 -0800 Subject: [PATCH 112/141] That moment when you see HAVE_BLUA crawl back from the grave This would mean MapChange hasn't been firing for demos ...since 2.2.5. --- src/d_clisrv.c | 2 -- src/g_demo.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index b198011a0..14fc1aea5 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1595,9 +1595,7 @@ static void CL_ReloadReceivedSavegame(void) for (i = 0; i < MAXPLAYERS; i++) { -#ifdef HAVE_BLUA LUA_InvalidatePlayer(&players[i]); -#endif sprintf(player_names[i], "Player %d", i + 1); } diff --git a/src/g_demo.c b/src/g_demo.c index 9d3b86015..593fd7723 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -1956,9 +1956,7 @@ void G_DoPlayDemo(char *defdemoname) // Set skin SetPlayerSkin(0, skin); -#ifdef HAVE_BLUA LUAh_MapChange(gamemap); -#endif displayplayer = consoleplayer = 0; memset(playeringame,0,sizeof(playeringame)); playeringame[0] = true; From 0df5d8ff58da2fcb6e20db31257308d8724c651e Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 10 Dec 2020 03:06:41 -0800 Subject: [PATCH 113/141] Oops! --- src/m_anigif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_anigif.c b/src/m_anigif.c index 5c42fc605..41f99254e 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -621,7 +621,7 @@ static void GIF_framewrite(void) { float delayf = ceil(100.0f/NEWTICRATE); - delay = (UINT16)((I_GetTimeMicros() - gif_prevframeus)/10/1000); + delay = (UINT16)I_PreciseToMicros((I_GetPreciseTime() - gif_prevframetime))/10/1000; if (delay < (UINT16)(delayf)) delay = (UINT16)(delayf); From 39a320734dcb53243aaff5228c63870e1295ef44 Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Thu, 12 Nov 2020 21:25:31 +0100 Subject: [PATCH 114/141] Add shorthand aliases for fixed-point functions --- src/lua_mathlib.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index 7cbe7a6cc..10ba42ee0 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -192,18 +192,30 @@ static luaL_Reg lib[] = { {"cos", lib_finecosine}, {"tan", lib_finetangent}, {"FixedAngle", lib_fixedangle}, + {"fixangle" , lib_fixedangle}, {"AngleFixed", lib_anglefixed}, + {"anglefix" , lib_anglefixed}, {"InvAngle", lib_invangle}, {"FixedMul", lib_fixedmul}, + {"fixmul" , lib_fixedmul}, {"FixedInt", lib_fixedint}, + {"fixint" , lib_fixedint}, {"FixedDiv", lib_fixeddiv}, + {"fixdiv" , lib_fixeddiv}, {"FixedRem", lib_fixedrem}, + {"fixrem" , lib_fixedrem}, {"FixedSqrt", lib_fixedsqrt}, + {"fixsqrt" , lib_fixedsqrt}, {"FixedHypot", lib_fixedhypot}, + {"fixhypot" , lib_fixedhypot}, {"FixedFloor", lib_fixedfloor}, + {"fixfloor" , lib_fixedfloor}, {"FixedTrunc", lib_fixedtrunc}, + {"fixtrunc" , lib_fixedtrunc}, {"FixedCeil", lib_fixedceil}, + {"fixceil" , lib_fixedceil}, {"FixedRound", lib_fixedround}, + {"fixround" , lib_fixedround}, {"GetSecSpecial", lib_getsecspecial}, {"All7Emeralds", lib_all7emeralds}, {"ColorOpposite", lib_coloropposite}, From 3aecc2276430ab55851a89f012a9663fec48f30f Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Thu, 12 Nov 2020 21:33:47 +0100 Subject: [PATCH 115/141] Add a shorthand alias for FRACUNIT --- src/deh_tables.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index 5733d9b0e..926ca805c 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4794,6 +4794,7 @@ struct int_const_s const INT_CONST[] = { // fixed_t constants, from m_fixed.h {"FRACUNIT",FRACUNIT}, + {"FU" ,FRACUNIT}, {"FRACBITS",FRACBITS}, // doomdef.h constants From 69d98b22ad19b49072143d98ce4333a474f65826 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 10 Dec 2020 13:40:47 -0800 Subject: [PATCH 116/141] Credits: add Zolton and Ors to the programming section --- src/f_finale.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/f_finale.c b/src/f_finale.c index 688cd4fc7..b23ab4f7a 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1074,6 +1074,7 @@ static const char *credits[] = { "\1Programming", "Alam \"GBC\" Arias", "Logan \"GBA\" Arias", + "Zolton \"Zippy_Zolton\" Auburn", "Colette \"fickleheart\" Bordelon", "Andrew \"orospakr\" Clunis", "Sally \"TehRealSalt\" Cochenour", @@ -1104,6 +1105,7 @@ static const char *credits[] = { "Sean \"Sryder13\" Ryder", "Ehab \"Wolfy\" Saeed", "Tasos \"tatokis\" Sahanidis", // Corrected C FixedMul, making 64-bit builds netplay compatible + "Riku \"Ors\" Salminen", // Demo consistency improvements "Jonas \"MascaraSnake\" Sauer", "Wessel \"sphere\" Smit", "\"SSNTails\"", From 317c107064a1ed88da40b342e07fc4f86d1d6197 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Thu, 10 Dec 2020 16:09:43 -0600 Subject: [PATCH 117/141] Make player->speed use R_PointToDist2 --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 892f4b678..292e452d7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5924,7 +5924,7 @@ static void P_3dMovement(player_t *player) player->rmomy = player->mo->momy - player->cmomy; // Calculates player's speed based on distance-of-a-line formula - player->speed = P_AproxDistance(player->rmomx, player->rmomy); + player->speed = R_PointToDist2(0, 0, player->rmomx, player->rmomy); // Monster Iestyn - 04-11-13 // Quadrants are stupid, excessive and broken, let's do this a much simpler way! From 3472b3ece38bc6d62ff248bfdf34950ec4709105 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Thu, 10 Dec 2020 21:55:22 -0300 Subject: [PATCH 118/141] Fix ERZ3 mode --- src/p_mobj.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index e664d85be..2393013de 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10438,19 +10438,12 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) mobj->x = x; mobj->y = y; - // TODO: Make this a special map header - if ((maptol & TOL_ERZ3) && !(mobj->type == MT_BLACKEGGMAN)) - mobj->destscale = FRACUNIT/2; - P_SetMobjSpawnDefaults(mobj); // set subsector and/or block links P_SetThingPosition(mobj); I_Assert(mobj->subsector != NULL); - // Make sure scale matches destscale immediately when spawned - P_SetScale(mobj, mobj->destscale); - mobj->floorz = P_GetSectorFloorZAt (mobj->subsector->sector, x, y); mobj->ceilingz = P_GetSectorCeilingZAt(mobj->subsector->sector, x, y); @@ -10816,9 +10809,16 @@ void P_SetMobjSpawnDefaults(mobj_t *mobj) mobj->destscale = mobj->scale; mobj->scalespeed = FRACUNIT/12; + // TODO: Make this a special map header + if ((maptol & TOL_ERZ3) && !(mobj->type == MT_BLACKEGGMAN)) + mobj->destscale = FRACUNIT/2; + + // Make sure scale matches destscale immediately when spawned + P_SetScale(mobj, mobj->destscale); + // Sprite rendering mobj->blendmode = AST_TRANSLUCENT; - mobj->spritexscale = mobj->spriteyscale = mobj->scale; + mobj->spritexscale = mobj->spriteyscale = FRACUNIT; mobj->spritexoffset = mobj->spriteyoffset = 0; mobj->floorspriteslope = NULL; } From 916cacb38f6e7072a1869bd1b964297f05210acb Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Thu, 10 Dec 2020 19:01:09 -0600 Subject: [PATCH 119/141] snailer --- src/p_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 63a14636d..5feae4188 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -1834,7 +1834,7 @@ void A_SnailerThink(mobj_t *actor) fixed_t dist; fixed_t dx, dy; - dist = P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y); + dist = R_PointToDist2(0, 0, actor->x - actor->target->x, actor->y - actor->target->y); if (an > ANGLE_45 && an <= ANGLE_90) // fire at 45 degrees to the left { From 440f46144a75d9048c24eef9fcaf34b0cad8181b Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Thu, 10 Dec 2020 22:01:53 -0300 Subject: [PATCH 120/141] Fix intro crash --- src/w_wad.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/w_wad.c b/src/w_wad.c index 2429eaf92..6566800c0 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1747,6 +1747,9 @@ void *W_CachePatchNum(lumpnum_t lumpnum, INT32 tag) void W_UnlockCachedPatch(void *patch) { + if (!patch) + return; + // The hardware code does its own memory management, as its patches // have different lifetimes from software's. #ifdef HWRENDER @@ -2144,7 +2147,7 @@ int W_VerifyNMUSlumps(const char *filename, boolean exit_on_error) {"LT", 2}, // Titlecard changes {"SLID", 4}, // Continue - {"CONT", 4}, + {"CONT", 4}, {"MINICAPS", 8}, // NiGHTS graphics here and below {"BLUESTAT", 8}, // Sphere status From f2095b57fd042dfbe58a1e696308d6b8c24083c3 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Thu, 10 Dec 2020 20:37:50 -0600 Subject: [PATCH 121/141] Player-Colored Elemental Fire for competitive gametypes --- src/deh_tables.c | 7 +++++++ src/hardware/hw_light.c | 1 + src/info.c | 8 ++++++++ src/info.h | 8 ++++++++ src/p_user.c | 10 ++++++++++ 5 files changed, 34 insertions(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index 7877903c5..67d876069 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -1522,6 +1522,13 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_SPINFIRE5", "S_SPINFIRE6", + "S_TEAM_SPINFIRE1", + "S_TEAM_SPINFIRE2", + "S_TEAM_SPINFIRE3", + "S_TEAM_SPINFIRE4", + "S_TEAM_SPINFIRE5", + "S_TEAM_SPINFIRE6", + // Spikes "S_SPIKE1", "S_SPIKE2", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 987d70c69..93c61f4e7 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -253,6 +253,7 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_SIGN &lspr[NOLIGHT], // SPR_SPIK &lspr[NOLIGHT], // SPR_SFLM + &lspr[NOLIGHT], // SPR_TFLM &lspr[NOLIGHT], // SPR_USPK &lspr[NOLIGHT], // SPR_WSPK &lspr[NOLIGHT], // SPR_WSPB diff --git a/src/info.c b/src/info.c index 56e764b5d..3ae9aeeb4 100644 --- a/src/info.c +++ b/src/info.c @@ -150,6 +150,7 @@ char sprnames[NUMSPRITES + 1][5] = "SIGN", // Level end sign "SPIK", // Spike Ball "SFLM", // Spin fire + "TFLM", // Spin fire (team) "USPK", // Floor spike "WSPK", // Wall spike "WSPB", // Wall spike base @@ -1894,6 +1895,13 @@ state_t states[NUMSTATES] = {SPR_SFLM, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_SPINFIRE6}, // S_SPINFIRE5 {SPR_SFLM, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_SPINFIRE1}, // S_SPINFIRE6 + {SPR_TFLM, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE2}, // S_TEAM_SPINFIRE1 + {SPR_TFLM, FF_FULLBRIGHT|1, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE3}, // S_TEAM_SPINFIRE2 + {SPR_TFLM, FF_FULLBRIGHT|2, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE4}, // S_TEAM_SPINFIRE3 + {SPR_TFLM, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE5}, // S_TEAM_SPINFIRE4 + {SPR_TFLM, FF_FULLBRIGHT|4, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE6}, // S_TEAM_SPINFIRE5 + {SPR_TFLM, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_TEAM_SPINFIRE1}, // S_TEAM_SPINFIRE6 + // Floor Spike {SPR_USPK, 0,-1, {A_SpikeRetract}, 1, 0, S_SPIKE2}, // S_SPIKE1 -- Fully extended {SPR_USPK, 1, 2, {A_Pain}, 0, 0, S_SPIKE3}, // S_SPIKE2 diff --git a/src/info.h b/src/info.h index 604922beb..461afd180 100644 --- a/src/info.h +++ b/src/info.h @@ -684,6 +684,7 @@ typedef enum sprite SPR_SIGN, // Level end sign SPR_SPIK, // Spike Ball SPR_SFLM, // Spin fire + SPR_TFLM, // Spin fire (team) SPR_USPK, // Floor spike SPR_WSPK, // Wall spike SPR_WSPB, // Wall spike base @@ -2324,6 +2325,13 @@ typedef enum state S_SPINFIRE5, S_SPINFIRE6, + S_TEAM_SPINFIRE1, + S_TEAM_SPINFIRE2, + S_TEAM_SPINFIRE3, + S_TEAM_SPINFIRE4, + S_TEAM_SPINFIRE5, + S_TEAM_SPINFIRE6, + // Spikes S_SPIKE1, S_SPIKE2, diff --git a/src/p_user.c b/src/p_user.c index 892f4b678..09d148f41 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7756,6 +7756,11 @@ void P_ElementalFire(player_t *player, boolean cropcircle) flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); P_InstaThrust(flame, flame->angle, FixedMul(3*FRACUNIT, flame->scale)); P_SetObjectMomZ(flame, 3*FRACUNIT, false); + if (!(gametyperules & GTR_FRIENDLY)) + { + P_SetMobjState(flame, S_TEAM_SPINFIRE1); + flame->color = player->mo->color; + } } #undef limitangle #undef numangles @@ -7783,6 +7788,11 @@ void P_ElementalFire(player_t *player, boolean cropcircle) flame->destscale = player->mo->scale; P_SetScale(flame, player->mo->scale); flame->eflags = (flame->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); + if (!(gametyperules & GTR_FRIENDLY)) + { + P_SetMobjState(flame, S_TEAM_SPINFIRE1); + flame->color = player->mo->color; + } flame->momx = 8; // this is a hack which is used to ensure it still behaves as a missile and can damage others P_XYMovement(flame); From 68de9f4bbe132bd57fbf072bc3dc861dd9f3be81 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Fri, 11 Dec 2020 12:34:30 -0600 Subject: [PATCH 122/141] Make Ring Drain sectors play the depletion sound instead of the ring sound --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 5b9e05c61..8843824ce 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4304,7 +4304,7 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers if (leveltime % (TICRATE/2) == 0 && player->rings > 0) { player->rings--; - S_StartSound(player->mo, sfx_itemup); + S_StartSound(player->mo, sfx_antiri); } break; case 11: // Special Stage Damage From ddf743d521654cbfb7ee7d7d9f5040c68351a49b Mon Sep 17 00:00:00 2001 From: katsy Date: Fri, 11 Dec 2020 20:59:14 -0500 Subject: [PATCH 123/141] make fire spindust dust fullbright --- src/info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/info.c b/src/info.c index 29a79b1d6..8684c68f5 100644 --- a/src/info.c +++ b/src/info.c @@ -3299,10 +3299,10 @@ state_t states[NUMSTATES] = {SPR_BUBL, 0, 6, {NULL}, 0, 0, S_SPINDUST_BUBBLE3}, // S_SPINDUST_BUBBLE2 {SPR_BUBL, FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_BUBBLE4}, // S_SPINDUST_BUBBLE3 {SPR_BUBL, FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_BUBBLE4 - {SPR_FPRT, 0, 7, {NULL}, 0, 0, S_SPINDUST_FIRE2}, // S_SPINDUST_FIRE1 - {SPR_FPRT, 0, 6, {NULL}, 0, 0, S_SPINDUST_FIRE3}, // S_SPINDUST_FIRE2 - {SPR_FPRT, FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_FIRE4}, // S_SPINDUST_FIRE3 - {SPR_FPRT, FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_FIRE4 + {SPR_FPRT, FF_FULLBRIGHT|0, 7, {NULL}, 0, 0, S_SPINDUST_FIRE2}, // S_SPINDUST_FIRE1 + {SPR_FPRT, FF_FULLBRIGHT|0, 6, {NULL}, 0, 0, S_SPINDUST_FIRE3}, // S_SPINDUST_FIRE2 + {SPR_FPRT, FF_FULLBRIGHT|FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_FIRE4}, // S_SPINDUST_FIRE3 + {SPR_FPRT, FF_FULLBRIGHT|FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_FIRE4 {SPR_TFOG, FF_FULLBRIGHT|FF_TRANS50, 2, {NULL}, 0, 0, S_FOG2}, // S_FOG1 From 2971156ba7c4699979218a4a8470d93d8faf63aa Mon Sep 17 00:00:00 2001 From: katsy Date: Fri, 11 Dec 2020 23:39:42 -0500 Subject: [PATCH 124/141] Update info.c --- src/info.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/info.c b/src/info.c index 8684c68f5..192e592af 100644 --- a/src/info.c +++ b/src/info.c @@ -3291,16 +3291,16 @@ state_t states[NUMSTATES] = {SPR_WZAP, FF_TRANS10|FF_ANIMATE|FF_RANDOMANIM, 4, {NULL}, 3, 2, S_NULL}, // S_WATERZAP // Spindash dust - {SPR_DUST, 0, 7, {NULL}, 0, 0, S_SPINDUST2}, // S_SPINDUST1 - {SPR_DUST, 1, 6, {NULL}, 0, 0, S_SPINDUST3}, // S_SPINDUST2 - {SPR_DUST, FF_TRANS30|2, 4, {NULL}, 0, 0, S_SPINDUST4}, // S_SPINDUST3 - {SPR_DUST, FF_TRANS60|3, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST4 - {SPR_BUBL, 0, 7, {NULL}, 0, 0, S_SPINDUST_BUBBLE2}, // S_SPINDUST_BUBBLE1 - {SPR_BUBL, 0, 6, {NULL}, 0, 0, S_SPINDUST_BUBBLE3}, // S_SPINDUST_BUBBLE2 - {SPR_BUBL, FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_BUBBLE4}, // S_SPINDUST_BUBBLE3 - {SPR_BUBL, FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_BUBBLE4 - {SPR_FPRT, FF_FULLBRIGHT|0, 7, {NULL}, 0, 0, S_SPINDUST_FIRE2}, // S_SPINDUST_FIRE1 - {SPR_FPRT, FF_FULLBRIGHT|0, 6, {NULL}, 0, 0, S_SPINDUST_FIRE3}, // S_SPINDUST_FIRE2 + {SPR_DUST, 0, 7, {NULL}, 0, 0, S_SPINDUST2}, // S_SPINDUST1 + {SPR_DUST, 1, 6, {NULL}, 0, 0, S_SPINDUST3}, // S_SPINDUST2 + {SPR_DUST, FF_TRANS30|2, 4, {NULL}, 0, 0, S_SPINDUST4}, // S_SPINDUST3 + {SPR_DUST, FF_TRANS60|3, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST4 + {SPR_BUBL, 0, 7, {NULL}, 0, 0, S_SPINDUST_BUBBLE2}, // S_SPINDUST_BUBBLE1 + {SPR_BUBL, 0, 6, {NULL}, 0, 0, S_SPINDUST_BUBBLE3}, // S_SPINDUST_BUBBLE2 + {SPR_BUBL, FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_BUBBLE4}, // S_SPINDUST_BUBBLE3 + {SPR_BUBL, FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_BUBBLE4 + {SPR_FPRT, FF_FULLBRIGHT|0, 7, {NULL}, 0, 0, S_SPINDUST_FIRE2}, // S_SPINDUST_FIRE1 + {SPR_FPRT, FF_FULLBRIGHT|0, 6, {NULL}, 0, 0, S_SPINDUST_FIRE3}, // S_SPINDUST_FIRE2 {SPR_FPRT, FF_FULLBRIGHT|FF_TRANS30|0, 4, {NULL}, 0, 0, S_SPINDUST_FIRE4}, // S_SPINDUST_FIRE3 {SPR_FPRT, FF_FULLBRIGHT|FF_TRANS60|0, 3, {NULL}, 0, 0, S_NULL}, // S_SPINDUST_FIRE4 From e55d842d7f4647719fb197621aa368677ae114a4 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 12 Dec 2020 02:11:23 -0800 Subject: [PATCH 125/141] Kill SEENAMES --- src/d_netcmd.c | 8 +------- src/d_netcmd.h | 2 -- src/deh_tables.c | 4 ---- src/doomdef.h | 3 --- src/g_game.c | 2 -- src/g_game.h | 2 -- src/info.c | 4 ---- src/info.h | 4 ---- src/lua_hook.h | 4 +--- src/lua_hooklib.c | 4 +--- src/m_menu.c | 2 -- src/p_floor.c | 2 -- src/p_local.h | 2 -- src/p_map.c | 6 ++---- src/p_user.c | 2 -- src/st_stuff.c | 2 -- 16 files changed, 5 insertions(+), 48 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 31c10f58a..bea1ab33e 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -214,11 +214,9 @@ consvar_t cv_respawntime = CVAR_INIT ("respawndelay", "3", CV_SAVE|CV_NETVAR|CV_ consvar_t cv_competitionboxes = CVAR_INIT ("competitionboxes", "Mystery", CV_SAVE|CV_NETVAR|CV_CHEAT, competitionboxes_cons_t, NULL); -#ifdef SEENAMES static CV_PossibleValue_t seenames_cons_t[] = {{0, "Off"}, {1, "Colorless"}, {2, "Team"}, {3, "Ally/Foe"}, {0, NULL}}; consvar_t cv_seenames = CVAR_INIT ("seenames", "Ally/Foe", CV_SAVE, seenames_cons_t, 0); consvar_t cv_allowseenames = CVAR_INIT ("allowseenames", "Yes", CV_SAVE|CV_NETVAR, CV_YesNo, NULL); -#endif // names consvar_t cv_playername = CVAR_INIT ("name", "Sonic", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Name_OnChange); @@ -597,9 +595,7 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_pingtimeout); CV_RegisterVar(&cv_showping); -#ifdef SEENAMES - CV_RegisterVar(&cv_allowseenames); -#endif + CV_RegisterVar(&cv_allowseenames); CV_RegisterVar(&cv_dummyconsvar); } @@ -690,9 +686,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_defaultplayercolor2); CV_RegisterVar(&cv_defaultskin2); -#ifdef SEENAMES CV_RegisterVar(&cv_seenames); -#endif CV_RegisterVar(&cv_rollingdemos); CV_RegisterVar(&cv_netstat); CV_RegisterVar(&cv_netticbuffer); diff --git a/src/d_netcmd.h b/src/d_netcmd.h index 98d8f1425..ac39626a4 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -31,9 +31,7 @@ extern consvar_t cv_defaultskin; extern consvar_t cv_defaultplayercolor2; extern consvar_t cv_defaultskin2; -#ifdef SEENAMES extern consvar_t cv_seenames, cv_allowseenames; -#endif extern consvar_t cv_usemouse; extern consvar_t cv_usejoystick; extern consvar_t cv_usejoystick2; diff --git a/src/deh_tables.c b/src/deh_tables.c index 5733d9b0e..95e326823 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3478,9 +3478,7 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_BLUEBRICKDEBRIS", "S_YELLOWBRICKDEBRIS", -#ifdef SEENAMES "S_NAMECHECK", -#endif }; // RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1", @@ -4260,9 +4258,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_BLUEBRICKDEBRIS", "MT_YELLOWBRICKDEBRIS", -#ifdef SEENAMES "MT_NAMECHECK", -#endif }; const char *const MOBJFLAG_LIST[] = { diff --git a/src/doomdef.h b/src/doomdef.h index d0b7ea0c2..52abc9597 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -582,9 +582,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; /// Dumps the contents of a network save game upon consistency failure for debugging. //#define DUMPCONSISTENCY -/// See name of player in your crosshair -#define SEENAMES - /// Who put weights on my recycler? ... Inuyasha did. /// \note XMOD port. //#define WEIGHTEDRECYCLER diff --git a/src/g_game.c b/src/g_game.c index 283113bbe..844acea74 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -444,9 +444,7 @@ consvar_t cv_firenaxis2 = CVAR_INIT ("joyaxis2_firenormal", "Z-Axis", CV_SAVE, j consvar_t cv_deadzone2 = CVAR_INIT ("joy_deadzone2", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL); consvar_t cv_digitaldeadzone2 = CVAR_INIT ("joy_digdeadzone2", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL); -#ifdef SEENAMES player_t *seenplayer; // player we're aiming at right now -#endif // now automatically allocated in D_RegisterClientCommands // so that it doesn't have to be updated depending on the value of MAXPLAYERS diff --git a/src/g_game.h b/src/g_game.h index 2bcf444c2..744d6755a 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -25,9 +25,7 @@ extern char timeattackfolder[64]; extern char customversionstring[32]; #define GAMEDATASIZE (4*8192) -#ifdef SEENAMES extern player_t *seenplayer; -#endif extern char player_names[MAXPLAYERS][MAXPLAYERNAME+1]; extern INT32 player_name_changes[MAXPLAYERS]; diff --git a/src/info.c b/src/info.c index 29a79b1d6..152a74927 100644 --- a/src/info.c +++ b/src/info.c @@ -3924,9 +3924,7 @@ state_t states[NUMSTATES] = {SPR_BRIB, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 31, 1, S_NULL}, // S_BLUEBRICKDEBRIS {SPR_BRIY, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 31, 1, S_NULL}, // S_YELLOWBRICKDEBRIS -#ifdef SEENAMES {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK -#endif }; mobjinfo_t mobjinfo[NUMMOBJTYPES] = @@ -21653,7 +21651,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, -#ifdef SEENAMES { // MT_NAMECHECK -1, // doomednum S_NAMECHECK, // spawnstate @@ -21680,7 +21677,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY|MF_NOSECTOR, // flags S_NULL // raisestate }, -#endif }; skincolor_t skincolors[MAXSKINCOLORS] = { diff --git a/src/info.h b/src/info.h index 604922beb..c6a2a2c44 100644 --- a/src/info.h +++ b/src/info.h @@ -4280,9 +4280,7 @@ typedef enum state S_BLUEBRICKDEBRIS, // for CEZ3 S_YELLOWBRICKDEBRIS, // for CEZ3 -#ifdef SEENAMES S_NAMECHECK, -#endif S_FIRSTFREESLOT, S_LASTFREESLOT = S_FIRSTFREESLOT + NUMSTATEFREESLOTS - 1, @@ -5082,9 +5080,7 @@ typedef enum mobj_type MT_BLUEBRICKDEBRIS, // for CEZ3 MT_YELLOWBRICKDEBRIS, // for CEZ3 -#ifdef SEENAMES MT_NAMECHECK, -#endif MT_FIRSTFREESLOT, MT_LASTFREESLOT = MT_FIRSTFREESLOT + NUMMOBJFREESLOTS - 1, diff --git a/src/lua_hook.h b/src/lua_hook.h index 796f3a9d2..260df0bee 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -112,11 +112,9 @@ void LUAh_PlayerQuit(player_t *plr, kickreason_t reason); // Hook for player qui void LUAh_IntermissionThinker(void); // Hook for Y_Ticker boolean LUAh_TeamSwitch(player_t *player, int newteam, boolean fromspectators, boolean tryingautobalance, boolean tryingscramble); // Hook for team switching in... uh.... UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean forced); // Hook for spy mode -#ifdef SEENAMES boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend); // Hook for MT_NAMECHECK -#endif #define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname); // Hook for whether a jingle of the given music should continue playing void LUAh_GameQuit(void); // Hook for game quitting boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Hook for building player's ticcmd struct (Ported from SRB2Kart) -boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping, UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes \ No newline at end of file +boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping, UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 117aa48a3..7bfe00fb5 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -1754,7 +1754,6 @@ UINT8 LUAh_ViewpointSwitch(player_t *player, player_t *newdisplayplayer, boolean } // Hook for MT_NAMECHECK -#ifdef SEENAMES boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend) { hook_p hookp; @@ -1798,7 +1797,6 @@ boolean LUAh_SeenPlayer(player_t *player, player_t *seenfriend) return hasSeenPlayer; } -#endif // SEENAMES boolean LUAh_ShouldJingleContinue(player_t *player, const char *musname) { @@ -1971,4 +1969,4 @@ boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boo lua_settop(gL, 0); newname[6] = 0; return hooked; -} \ No newline at end of file +} diff --git a/src/m_menu.c b/src/m_menu.c index 77648f877..8c2131dc8 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1356,9 +1356,7 @@ static menuitem_t OP_VideoOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Score/Time/Rings", &cv_timetic, 71}, {IT_STRING | IT_CVAR, NULL, "Show Powerups", &cv_powerupdisplay, 76}, {IT_STRING | IT_CVAR, NULL, "Local ping display", &cv_showping, 81}, // shows ping next to framerate if we want to. -#ifdef SEENAMES {IT_STRING | IT_CVAR, NULL, "Show player names", &cv_seenames, 86}, -#endif {IT_HEADER, NULL, "Console", NULL, 95}, {IT_STRING | IT_CVAR, NULL, "Background color", &cons_backcolor, 101}, diff --git a/src/p_floor.c b/src/p_floor.c index ed49b03a3..7c26065b5 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1064,9 +1064,7 @@ static mobj_t *SearchMarioNode(msecnode_t *node) case MT_HOOP: case MT_HOOPCOLLIDE: case MT_NIGHTSCORE: -#ifdef SEENAMES case MT_NAMECHECK: // DEFINITELY not this, because it is client-side. -#endif continue; default: break; diff --git a/src/p_local.h b/src/p_local.h index 8a5084962..8caab0d27 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -326,9 +326,7 @@ mobj_t *P_SpawnPointMissile(mobj_t *source, fixed_t xa, fixed_t ya, fixed_t za, mobj_t *P_SpawnAlteredDirectionMissile(mobj_t *source, mobjtype_t type, fixed_t x, fixed_t y, fixed_t z, INT32 shiftingAngle); mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype, UINT32 flags2); #define P_SpawnPlayerMissile(s,t,f) P_SPMAngle(s,t,s->angle,true,f) -#ifdef SEENAMES #define P_SpawnNameFinder(s,t) P_SPMAngle(s,t,s->angle,true,0) -#endif void P_ColorTeamMissile(mobj_t *missile, player_t *source); SINT8 P_MobjFlip(mobj_t *mobj); fixed_t P_GetMobjGravity(mobj_t *mo); diff --git a/src/p_map.c b/src/p_map.c index 922c0d9ec..1b46f9686 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -727,9 +727,8 @@ static boolean PIT_CheckThing(mobj_t *thing) || (thing->player && thing->player->spectator)) return true; -#ifdef SEENAMES - // Do name checks all the way up here - // So that NOTHING ELSE can see MT_NAMECHECK because it is client-side. + // Do name checks all the way up here + // So that NOTHING ELSE can see MT_NAMECHECK because it is client-side. if (tmthing->type == MT_NAMECHECK) { // Ignore things that aren't players, ignore spectators, ignore yourself. @@ -753,7 +752,6 @@ static boolean PIT_CheckThing(mobj_t *thing) seenplayer = thing->player; return false; } -#endif // Metal Sonic destroys tiny baby objects. if (tmthing->type == MT_METALSONIC_RACE diff --git a/src/p_user.c b/src/p_user.c index c5f919c78..dc9604110 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11482,7 +11482,6 @@ void P_PlayerThink(player_t *player) } } -#ifdef SEENAMES if (netgame && player == &players[displayplayer] && !(leveltime % (TICRATE/5))) { seenplayer = NULL; @@ -11507,7 +11506,6 @@ void P_PlayerThink(player_t *player) } } } -#endif if (player->awayviewmobj && P_MobjWasRemoved(player->awayviewmobj)) { diff --git a/src/st_stuff.c b/src/st_stuff.c index b25538d88..649644620 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2751,7 +2751,6 @@ static void ST_overlayDrawer(void) void ST_Drawer(void) { -#ifdef SEENAMES if (cv_seenames.value && cv_allowseenames.value && displayplayer == consoleplayer && seenplayer && seenplayer->mo) { INT32 c = 0; @@ -2775,7 +2774,6 @@ void ST_Drawer(void) V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF|c, player_names[seenplayer-players]); } -#endif // Doom's status bar only updated if necessary. // However, ours updates every frame regardless, so the "refresh" param was removed From b31c4db89d4b6a65b952fa6613605c886d8cb11a Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 12 Dec 2020 02:37:03 -0800 Subject: [PATCH 126/141] Remove trailing whitespace --- src/console.c | 2 +- src/lua_hooklib.c | 2 +- src/m_menu.c | 2 +- src/p_inter.c | 6 +++--- src/p_map.c | 4 ++-- src/s_sound.c | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/console.c b/src/console.c index 21f660a56..f3b0aa603 100644 --- a/src/console.c +++ b/src/console.c @@ -1421,7 +1421,7 @@ void CONS_Printf(const char *fmt, ...) if (con_started) CON_Print(txt); - CON_LogMessage(txt); + CON_LogMessage(txt); Lock_state(); diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index ebf6f9deb..d02601ce4 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -1793,6 +1793,6 @@ void LUAh_GameQuit(void) hookp->error = true; } } - + lua_pop(gL, 1); // Pop error handler } diff --git a/src/m_menu.c b/src/m_menu.c index c7786a496..9c21fbc00 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1483,7 +1483,7 @@ static menuitem_t OP_SoundOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "MIDI Music", &cv_gamemidimusic, 36}, {IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "MIDI Music Volume", &cv_midimusicvolume, 41}, - + {IT_STRING | IT_CVAR, NULL, "Music Preference", &cv_musicpref, 51}, {IT_HEADER, NULL, "Miscellaneous", NULL, 61}, diff --git a/src/p_inter.c b/src/p_inter.c index bd044f32a..5f2050b7f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -470,14 +470,14 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (!(player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2)) { fixed_t setmomz = -toucher->momz; // Store this, momz get changed by P_DoJump within P_DoBubbleBounce - + if (elementalpierce == 2) // Reset bubblewrap, part 1 P_DoBubbleBounce(player); toucher->momz = setmomz; if (elementalpierce == 2) // Reset bubblewrap, part 2 { boolean underwater = toucher->eflags & MFE_UNDERWATER; - + if (underwater) toucher->momz /= 2; toucher->momz -= (toucher->momz/(underwater ? 8 : 4)); // Cap the height! @@ -1613,7 +1613,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (special->tracer && !(special->tracer->flags2 & MF2_STRONGBOX)) macespin = true; - + if (macespin ? (player->powers[pw_ignorelatch] & (1<<15)) : (player->powers[pw_ignorelatch])) return; diff --git a/src/p_map.c b/src/p_map.c index 74c2790f7..1c10a78f3 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1681,7 +1681,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (!(player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2)) { fixed_t setmomz = -*momz; // Store this, momz get changed by P_DoJump within P_DoBubbleBounce - + if (elementalpierce == 2) // Reset bubblewrap, part 1 P_DoBubbleBounce(player); *momz = setmomz; // Therefore, you should be thrust in the opposite direction, vertically. @@ -1690,7 +1690,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (elementalpierce == 2) // Reset bubblewrap, part 2 { boolean underwater = tmthing->eflags & MFE_UNDERWATER; - + if (underwater) *momz /= 2; *momz -= (*momz/(underwater ? 8 : 4)); // Cap the height! diff --git a/src/s_sound.c b/src/s_sound.c index 1885cfcf9..64f092b80 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2152,7 +2152,7 @@ boolean S_RecallMusic(UINT16 status, boolean fromfirst) static lumpnum_t S_GetMusicLumpNum(const char *mname) { boolean midipref = cv_musicpref.value; - + if (S_PrefAvailable(midipref, mname)) return W_GetNumForName(va(midipref ? "d_%s":"o_%s", mname)); else if (S_PrefAvailable(!midipref, mname)) @@ -2302,7 +2302,7 @@ void S_ChangeMusicEx(const char *mmusic, UINT16 mflags, boolean looping, UINT32 I_FadeSong(0, prefadems, S_ChangeMusicToQueue); return; } - else if (strnicmp(music_name, newmusic, 6) || (mflags & MUSIC_FORCERESET) || + else if (strnicmp(music_name, newmusic, 6) || (mflags & MUSIC_FORCERESET) || (midipref != currentmidi && S_PrefAvailable(midipref, newmusic))) { CONS_Debug(DBG_DETAILED, "Now playing song %s\n", newmusic); From c8cc9c7a6f449505b9a809d106e29dc19e3f7a9c Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 12 Dec 2020 02:40:46 -0800 Subject: [PATCH 127/141] Remove trailing whitespace --- src/d_netcmd.c | 2 +- src/hardware/hw_batching.h | 2 +- src/lua_skinlib.c | 2 +- src/p_enemy.c | 2 +- src/p_mobj.c | 2 +- src/p_user.c | 8 ++++---- src/w_wad.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 6080b2fd0..f2e168616 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -878,7 +878,7 @@ void D_RegisterClientCommands(void) // CV_RegisterVar(&cv_snapto); CV_RegisterVar(&cv_freedemocamera); - + // add cheat commands COM_AddCommand("noclip", Command_CheatNoClip_f); COM_AddCommand("god", Command_CheatGod_f); diff --git a/src/hardware/hw_batching.h b/src/hardware/hw_batching.h index 3d22324ac..42291a0df 100644 --- a/src/hardware/hw_batching.h +++ b/src/hardware/hw_batching.h @@ -16,7 +16,7 @@ #include "hw_data.h" #include "hw_drv.h" -typedef struct +typedef struct { FSurfaceInfo surf;// surf also has its own polyflags for some reason, but it seems unused unsigned int vertsIndex;// location of verts in unsortedVertexArray diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index ea368a9cd..56be6bf4f 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -214,7 +214,7 @@ static int skin_get(lua_State *L) break; case skin_sprites: LUA_PushLightUserdata(L, skin->sprites, META_SKINSPRITES); - break; + break; } return 1; } diff --git a/src/p_enemy.c b/src/p_enemy.c index 63a14636d..7f322567e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -4060,7 +4060,7 @@ bossjustdie: // Initialize my junk junk.tags.tags = NULL; junk.tags.count = 0; - + Tag_FSet(&junk.tags, LE_KOOPA); EV_DoCeiling(&junk, raiseToHighest); return; diff --git a/src/p_mobj.c b/src/p_mobj.c index 1f87762bc..a1edcfe77 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11398,7 +11398,7 @@ void P_SpawnPlayer(INT32 playernum) p->normalspeed = skins[p->skin].normalspeed; p->jumpfactor = skins[p->skin].jumpfactor; } - + // Clear lastlinehit and lastsidehit p->lastsidehit = -1; p->lastlinehit = -1; diff --git a/src/p_user.c b/src/p_user.c index 892f4b678..2377134cc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2613,10 +2613,10 @@ static void P_CheckBustableBlocks(player_t *player) if ((netgame || multiplayer) && player->spectator) return; - + oldx = player->mo->x; oldy = player->mo->y; - + if (!(player->pflags & PF_BOUNCING)) // Bouncers only get to break downwards, not sideways { P_UnsetThingPosition(player->mo); @@ -2635,7 +2635,7 @@ static void P_CheckBustableBlocks(player_t *player) if (!node->m_sector->ffloors) continue; - + for (rover = node->m_sector->ffloors; rover; rover = rover->next) { if (!P_PlayerCanBust(player, rover)) @@ -4525,7 +4525,7 @@ void P_DoJump(player_t *player, boolean soundandstate) player->mo->eflags &= ~MFE_APPLYPMOMZ; player->pflags |= P_GetJumpFlags(player);; - + if (player->charflags & SF_NOJUMPDAMAGE) player->pflags &= ~PF_SPINNING; diff --git a/src/w_wad.c b/src/w_wad.c index 2429eaf92..4aae2ee46 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -2144,7 +2144,7 @@ int W_VerifyNMUSlumps(const char *filename, boolean exit_on_error) {"LT", 2}, // Titlecard changes {"SLID", 4}, // Continue - {"CONT", 4}, + {"CONT", 4}, {"MINICAPS", 8}, // NiGHTS graphics here and below {"BLUESTAT", 8}, // Sphere status From 7e0a1709de58ea290a6edef7d7f2b4ec28427ac8 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Mon, 14 Dec 2020 00:53:42 -0300 Subject: [PATCH 128/141] Fix a crash in Picture_GetPatchPixel with PICFMT_DOOMPATCH formats --- src/r_picformats.c | 9 +++++---- src/r_textures.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/r_picformats.c b/src/r_picformats.c index 02f1de4ab..f87362c76 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -544,21 +544,22 @@ void *Picture_GetPatchPixel( UINT16 *s16 = NULL; UINT32 *s32 = NULL; softwarepatch_t *doompatch = (softwarepatch_t *)patch; + boolean isdoompatch = Picture_IsDoomPatchFormat(informat); INT16 width; if (patch == NULL) I_Error("Picture_GetPatchPixel: patch == NULL"); - width = (Picture_IsDoomPatchFormat(informat) ? patch->width : SHORT(patch->width)); + width = (isdoompatch ? SHORT(doompatch->width) : patch->width); if (x >= 0 && x < width) { INT32 colx = (flags & PICFLAGS_XFLIP) ? (width-1)-x : x; INT32 topdelta, prevdelta = -1; - INT32 colofs = (Picture_IsDoomPatchFormat(informat) ? LONG(patch->columnofs[colx]) : patch->columnofs[colx]); + INT32 colofs = (isdoompatch ? LONG(doompatch->columnofs[colx]) : patch->columnofs[colx]); - // Column offsets are pointers so no casting required - if (Picture_IsDoomPatchFormat(informat)) + // Column offsets are pointers, so no casting is required. + if (isdoompatch) column = (column_t *)((UINT8 *)doompatch + colofs); else column = (column_t *)((UINT8 *)patch->columns + colofs); diff --git a/src/r_textures.c b/src/r_textures.c index 9de9649e2..a006d739f 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -604,7 +604,7 @@ void *R_GetLevelFlat(levelflat_t *levelflat) levelflat->height = ds_flatheight = SHORT(patch->height); levelflat->picture = Z_Malloc(levelflat->width * levelflat->height, PU_LEVEL, NULL); - converted = Picture_FlatConvert(PICFMT_DOOMPATCH, patch, PICFMT_FLAT, 0, &size, levelflat->width, levelflat->height, patch->topoffset, patch->leftoffset, 0); + converted = Picture_FlatConvert(PICFMT_DOOMPATCH, patch, PICFMT_FLAT, 0, &size, levelflat->width, levelflat->height, SHORT(patch->topoffset), SHORT(patch->leftoffset), 0); M_Memcpy(levelflat->picture, converted, size); Z_Free(converted); } From ca78fc69cad750a5a915cd5519c2cc45c5ff5848 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Mon, 14 Dec 2020 01:14:55 -0300 Subject: [PATCH 129/141] Restore the viewpoint's angle in R_DrawPlanes instead --- src/r_plane.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index c54b32382..b5ac7252f 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -607,6 +607,7 @@ void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2) void R_DrawPlanes(void) { visplane_t *pl; + angle_t va = viewangle; INT32 i; R_UpdatePlaneRipple(); @@ -621,6 +622,8 @@ void R_DrawPlanes(void) R_DrawSinglePlane(pl); } } + + viewangle = va; } // R_DrawSkyPlane @@ -788,7 +791,6 @@ void R_DrawSinglePlane(visplane_t *pl) ffloor_t *rover; int type; int spanfunctype = BASEDRAWFUNC; - angle_t viewang = viewangle; if (!(pl->minx <= pl->maxx)) return; @@ -1153,8 +1155,6 @@ using the palette colors. } } #endif - - viewangle = viewang; } void R_PlaneBounds(visplane_t *plane) From 2b2346835920ca359891c1212e8210a3543a4c27 Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 14 Dec 2020 02:36:00 -0500 Subject: [PATCH 130/141] remove amy --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index badf19372..b116b756c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11798,7 +11798,7 @@ static boolean P_AllowMobjSpawn(mapthing_t* mthing, mobjtype_t i) if (!(G_CoopGametype() || (mthing->options & MTF_EXTRA))) return false; // she doesn't hang out here - if (!mariomode && !(netgame || multiplayer) && players[consoleplayer].skin == 3) + if (!(netgame || multiplayer) && players[consoleplayer].skin == 3) return false; // no doubles break; From 0ce9d9127a7707aceb94c2f263508725438ef9dc Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 14 Dec 2020 04:01:50 -0500 Subject: [PATCH 131/141] add SF_NOSHIELDABILITY --- src/d_player.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index eb0372832..0e0f623d3 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -51,7 +51,8 @@ typedef enum SF_NONIGHTSSUPER = 1<<15, // Disable super colors for NiGHTS (if you have SF_SUPER) SF_NOSUPERSPRITES = 1<<16, // Don't use super sprites while super SF_NOSUPERJUMPBOOST = 1<<17, // Disable the jump boost given while super (i.e. Knuckles) - SF_CANBUSTWALLS = 1<<18, // Can naturally bust walls on contact? (i.e. Knuckles) + SF_CANBUSTWALLS = 1<<18, // Can naturally bust walls on contact? (i.e. Knuckles) + SF_NOSHIELDABILITY = 1<<19, // Disable shield abilities // free up to and including 1<<31 } skinflags_t; From dfbb1825f460fcc3db33880450fea4c93bd2e648 Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 14 Dec 2020 04:02:17 -0500 Subject: [PATCH 132/141] ditto --- src/deh_tables.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index 5733d9b0e..2a0f179d4 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4987,6 +4987,8 @@ struct int_const_s const INT_CONST[] = { {"SF_NOSUPERSPRITES",SF_NOSUPERSPRITES}, {"SF_NOSUPERJUMPBOOST",SF_NOSUPERJUMPBOOST}, {"SF_CANBUSTWALLS",SF_CANBUSTWALLS}, + {"SF_NOSHIELDABILITY",SF_NOSHIELDABILITY}, + // Dashmode constants {"DASHMODE_THRESHOLD",DASHMODE_THRESHOLD}, From 2bebaf12d0f19e97a84577af8c75fa1e1523172a Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 14 Dec 2020 04:03:14 -0500 Subject: [PATCH 133/141] add checks for new flag, make emergency jump call shieldspecial --- src/p_user.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index c5f919c78..f06ad998d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2491,6 +2491,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) player->mo->momx = player->mo->momy = 0; clipmomz = false; } + else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) // Bubble shield's bounce attack. { P_DoBubbleBounce(player); @@ -5020,7 +5021,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock if ((player->powers[pw_shield] & SH_NOSTACK) && !player->powers[pw_super] && !(player->pflags & PF_SPINDOWN) && ((!(player->pflags & PF_THOKKED) || (((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP || (player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) && player->secondjump == UINT8_MAX) ))) // thokked is optional if you're bubblewrapped / 3dblasted { - if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT) + if ((player->powers[pw_shield] & SH_NOSTACK) == SH_ATTRACT && !(player->charflags & SF_NOSHIELDABILITY)) { if ((lockonshield = P_LookForEnemies(player, false, false))) { @@ -5043,7 +5044,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock } } } - if (cmd->buttons & BT_SPIN && !LUAh_ShieldSpecial(player)) // Spin button effects + if ((!(player->charflags & SF_NOSHIELDABILITY)) && (cmd->buttons & BT_SPIN && !LUAh_ShieldSpecial(player))) // Spin button effects { // Force stop if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE) @@ -5491,7 +5492,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) break; } } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_WHIRLWIND && !player->powers[pw_super]) + else if ((!(player->charflags & SF_NOSHIELDABILITY)) && ((player->powers[pw_shield] & SH_NOSTACK) == SH_WHIRLWIND && !player->powers[pw_super] && !LUAh_ShieldSpecial(player))) P_DoJumpShield(player); } From 200e444016f61556fb080d956903364fee304abe Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 14 Dec 2020 04:05:14 -0500 Subject: [PATCH 134/141] go away whitespace --- src/deh_tables.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 2a0f179d4..e92a4f60c 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4989,7 +4989,6 @@ struct int_const_s const INT_CONST[] = { {"SF_CANBUSTWALLS",SF_CANBUSTWALLS}, {"SF_NOSHIELDABILITY",SF_NOSHIELDABILITY}, - // Dashmode constants {"DASHMODE_THRESHOLD",DASHMODE_THRESHOLD}, {"DASHMODE_MAX",DASHMODE_MAX}, From 4521827e2c2b101db0ba3c8ddd114fd8a1b18bc7 Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 14 Dec 2020 04:06:28 -0500 Subject: [PATCH 135/141] you too --- src/p_user.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index f06ad998d..917c7ddf6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2491,7 +2491,6 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) player->mo->momx = player->mo->momy = 0; clipmomz = false; } - else if ((player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) // Bubble shield's bounce attack. { P_DoBubbleBounce(player); From 3b36005ceb1fa04f8c2875e5d614aeb8c419cef9 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Mon, 14 Dec 2020 14:13:24 -0300 Subject: [PATCH 136/141] Replace the first entry in the taglist, instead of adding into it --- src/p_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_setup.c b/src/p_setup.c index 41d8822e2..66243fb0e 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3171,7 +3171,7 @@ static void P_ConvertBinaryMap(void) switch (mapthings[i].type) { case 750: - Tag_Add(&mapthings[i].tags, mapthings[i].angle); + Tag_FSet(&mapthings[i].tags, mapthings[i].angle); break; case 760: case 761: From 9b8bacd08886375c1090d46d8d964f6c1c2b1be6 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 14 Dec 2020 12:52:24 -0600 Subject: [PATCH 137/141] Redone colormaps by SonicX8000 --- src/console.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/console.c b/src/console.c index 982b0d550..3c19c5e18 100644 --- a/src/console.c +++ b/src/console.c @@ -378,24 +378,23 @@ static void CON_SetupColormaps(void) map[0xE] = (UINT8)o;\ map[0xF] = (UINT8)p; - // I tried to make them kinda close to the originals, tell me how I did! ~Golden - // decent but i made most of the colors better thanks for th help :3 + // Tried to keep the colors vanilla while adding some shades in between them ~SonicX8000 - // 0x1 0x3 0x9 0xF - colset(magentamap, 177, 177, 178, 178, 179, 179, 180, 180, 181, 181, 182, 182, 183, 183, 184, 184); - colset(yellowmap, 81, 81, 73, 73, 74, 74, 74, 65, 65, 65, 66, 66, 66, 67, 67, 67); - colset(lgreenmap, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104); - colset(bluemap, 146, 146, 147, 147, 148, 148, 148, 149, 149, 149, 150, 150, 150, 151, 151, 151); - colset(redmap, 32, 32, 33, 33, 34, 34, 34, 35, 35, 35, 37, 37, 37, 39, 39, 39); - colset(graymap, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); - colset(orangemap, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58); - colset(skymap, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135); - colset(purplemap, 144, 144, 160, 160, 161, 161, 161, 162, 162, 162, 163, 163, 163, 164, 164, 164); - colset(aquamap, 120, 120, 121, 121, 122, 122, 122, 123, 123, 123, 124, 124, 124, 125, 125, 125); - colset(peridotmap, 72, 72, 188, 188, 189, 189, 189, 190, 190, 190, 191, 191, 191, 104, 104, 104); - colset(azuremap, 144, 144, 145, 145, 146, 146, 146, 170, 170, 170, 171, 171, 171, 172, 172, 172); - colset(brownmap, 218, 219, 220, 221, 221, 222, 223, 223, 224, 224, 225, 226, 227, 228, 229, 230); - colset(rosymap, 200, 200, 201, 201, 202, 202, 202, 203, 203, 203, 204, 204, 204, 205, 205, 205); + // 0x1 0x3 0x9 0xF + colset(magentamap, 177, 177, 178, 178, 178, 181, 181, 181, 183, 183, 183, 183, 185, 185, 185, 186); + colset(yellowmap, 82, 82, 73, 73, 73, 64, 64, 64, 66, 66, 66, 66, 67, 67, 67, 68); + colset(lgreenmap, 96, 96, 98, 98, 98, 101, 101, 101, 105, 105, 105, 105, 107, 107, 107, 108); + colset(bluemap, 146, 146, 147, 147, 147, 149, 149, 149, 152, 152, 152, 152, 155, 155, 155, 157); + colset(redmap, 32, 32, 33, 33, 33, 35, 35, 35, 39, 39, 39, 39, 42, 42, 42, 44); + colset(graymap, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23); + colset(orangemap, 50, 50, 52, 52, 52, 54, 54, 54, 56, 56, 56, 56, 59, 59, 59, 60); + colset(skymap, 129, 129, 130, 130, 130, 131, 131, 131, 133, 133, 133, 133, 135, 135, 135, 136); + colset(purplemap, 160, 160, 161, 161, 161, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165); + colset(aquamap, 120, 120, 121, 121, 121, 122, 122, 122, 123, 123, 123, 123, 124, 124, 124, 125); + colset(peridotmap, 72, 72, 188, 188, 189, 189, 189, 189, 190, 190, 190, 190, 191, 191, 191, 94); + colset(azuremap, 144, 144, 145, 145, 145, 146, 146, 146, 170, 170, 170, 170, 171, 171, 171, 172); + colset(brownmap, 219, 219, 221, 221, 221, 222, 222, 222, 224, 224, 224, 224, 227, 227, 227, 229); + colset(rosymap, 200, 200, 201, 201, 201, 202, 202, 202, 203, 203, 203, 203, 204, 204, 204, 205); #undef colset From 07034cf44116b54bf769c80b42c39586b90338b6 Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Mon, 14 Dec 2020 16:14:20 -0600 Subject: [PATCH 138/141] fixes spaces --- src/console.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/console.c b/src/console.c index 3c19c5e18..478f93fc8 100644 --- a/src/console.c +++ b/src/console.c @@ -378,23 +378,23 @@ static void CON_SetupColormaps(void) map[0xE] = (UINT8)o;\ map[0xF] = (UINT8)p; - // Tried to keep the colors vanilla while adding some shades in between them ~SonicX8000 + // Tried to keep the colors vanilla while adding some shades in between them ~SonicX8000 - // 0x1 0x3 0x9 0xF - colset(magentamap, 177, 177, 178, 178, 178, 181, 181, 181, 183, 183, 183, 183, 185, 185, 185, 186); - colset(yellowmap, 82, 82, 73, 73, 73, 64, 64, 64, 66, 66, 66, 66, 67, 67, 67, 68); - colset(lgreenmap, 96, 96, 98, 98, 98, 101, 101, 101, 105, 105, 105, 105, 107, 107, 107, 108); - colset(bluemap, 146, 146, 147, 147, 147, 149, 149, 149, 152, 152, 152, 152, 155, 155, 155, 157); - colset(redmap, 32, 32, 33, 33, 33, 35, 35, 35, 39, 39, 39, 39, 42, 42, 42, 44); - colset(graymap, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23); - colset(orangemap, 50, 50, 52, 52, 52, 54, 54, 54, 56, 56, 56, 56, 59, 59, 59, 60); - colset(skymap, 129, 129, 130, 130, 130, 131, 131, 131, 133, 133, 133, 133, 135, 135, 135, 136); - colset(purplemap, 160, 160, 161, 161, 161, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165); - colset(aquamap, 120, 120, 121, 121, 121, 122, 122, 122, 123, 123, 123, 123, 124, 124, 124, 125); + // 0x1 0x3 0x9 0xF + colset(magentamap, 177, 177, 178, 178, 178, 181, 181, 181, 183, 183, 183, 183, 185, 185, 185, 186); + colset(yellowmap, 82, 82, 73, 73, 73, 64, 64, 64, 66, 66, 66, 66, 67, 67, 67, 68); + colset(lgreenmap, 96, 96, 98, 98, 98, 101, 101, 101, 105, 105, 105, 105, 107, 107, 107, 108); + colset(bluemap, 146, 146, 147, 147, 147, 149, 149, 149, 152, 152, 152, 152, 155, 155, 155, 157); + colset(redmap, 32, 32, 33, 33, 33, 35, 35, 35, 39, 39, 39, 39, 42, 42, 42, 44); + colset(graymap, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23); + colset(orangemap, 50, 50, 52, 52, 52, 54, 54, 54, 56, 56, 56, 56, 59, 59, 59, 60); + colset(skymap, 129, 129, 130, 130, 130, 131, 131, 131, 133, 133, 133, 133, 135, 135, 135, 136); + colset(purplemap, 160, 160, 161, 161, 161, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165); + colset(aquamap, 120, 120, 121, 121, 121, 122, 122, 122, 123, 123, 123, 123, 124, 124, 124, 125); colset(peridotmap, 72, 72, 188, 188, 189, 189, 189, 189, 190, 190, 190, 190, 191, 191, 191, 94); - colset(azuremap, 144, 144, 145, 145, 145, 146, 146, 146, 170, 170, 170, 170, 171, 171, 171, 172); - colset(brownmap, 219, 219, 221, 221, 221, 222, 222, 222, 224, 224, 224, 224, 227, 227, 227, 229); - colset(rosymap, 200, 200, 201, 201, 201, 202, 202, 202, 203, 203, 203, 203, 204, 204, 204, 205); + colset(azuremap, 144, 144, 145, 145, 145, 146, 146, 146, 170, 170, 170, 170, 171, 171, 171, 172); + colset(brownmap, 219, 219, 221, 221, 221, 222, 222, 222, 224, 224, 224, 224, 227, 227, 227, 229); + colset(rosymap, 200, 200, 201, 201, 201, 202, 202, 202, 203, 203, 203, 203, 204, 204, 204, 205); #undef colset From d999e436f1883dead04b1b603a67e3f9efa9e547 Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 14 Dec 2020 20:23:24 -0500 Subject: [PATCH 139/141] GETFLAG --- src/r_skins.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/r_skins.c b/src/r_skins.c index 522d9236a..6f150f234 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -514,6 +514,7 @@ static boolean R_ProcessPatchableFields(skin_t *skin, char *stoken, char *value) GETFLAG(NOSUPERSPRITES) GETFLAG(NOSUPERJUMPBOOST) GETFLAG(CANBUSTWALLS) + GETFLAG(NOSHIELDABILITY) #undef GETFLAG else // let's check if it's a sound, otherwise error out From fa9db2d64424bb6bfd98b350f43e44a63dfe8095 Mon Sep 17 00:00:00 2001 From: Jaime Ita Passos Date: Wed, 16 Dec 2020 00:26:08 -0300 Subject: [PATCH 140/141] Fix vibing slope planes I messed up the multiplication order for texture scaling: it multiplied a floating point number with a fixed point number, instead of multiplying two floats and then converting the result into a fixed point number. --- src/r_plane.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index c54b32382..194f85c4a 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -705,9 +705,9 @@ void R_CalculateSlopeVectors(pslope_t *slope, fixed_t planeviewx, fixed_t planev n.z = -xscale * cos(ang); ang = ANG2RAD(planeangle); - temp = P_GetSlopeZAt(slope, planeviewx + yscale * FLOAT_TO_FIXED(sin(ang)), planeviewy + yscale * FLOAT_TO_FIXED(cos(ang))); + temp = P_GetSlopeZAt(slope, planeviewx + FLOAT_TO_FIXED(yscale * sin(ang)), planeviewy + FLOAT_TO_FIXED(yscale * cos(ang))); m.y = FIXED_TO_FLOAT(temp) - zeroheight; - temp = P_GetSlopeZAt(slope, planeviewx + xscale * FLOAT_TO_FIXED(cos(ang)), planeviewy - xscale * FLOAT_TO_FIXED(sin(ang))); + temp = P_GetSlopeZAt(slope, planeviewx + FLOAT_TO_FIXED(xscale * cos(ang)), planeviewy - FLOAT_TO_FIXED(xscale * sin(ang))); n.y = FIXED_TO_FLOAT(temp) - zeroheight; if (ds_powersoftwo) From 45976d230454f37f62ca0c5cef5d1506c73dbccd Mon Sep 17 00:00:00 2001 From: Zippy_Zolton Date: Tue, 15 Dec 2020 22:19:57 -0600 Subject: [PATCH 141/141] magenta and green sonicx --- src/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/console.c b/src/console.c index 478f93fc8..c7bfe0fe1 100644 --- a/src/console.c +++ b/src/console.c @@ -381,9 +381,9 @@ static void CON_SetupColormaps(void) // Tried to keep the colors vanilla while adding some shades in between them ~SonicX8000 // 0x1 0x3 0x9 0xF - colset(magentamap, 177, 177, 178, 178, 178, 181, 181, 181, 183, 183, 183, 183, 185, 185, 185, 186); + colset(magentamap, 177, 177, 178, 178, 178, 180, 180, 180, 182, 182, 182, 182, 184, 184, 184, 185); colset(yellowmap, 82, 82, 73, 73, 73, 64, 64, 64, 66, 66, 66, 66, 67, 67, 67, 68); - colset(lgreenmap, 96, 96, 98, 98, 98, 101, 101, 101, 105, 105, 105, 105, 107, 107, 107, 108); + colset(lgreenmap, 96, 96, 98, 98, 98, 101, 101, 101, 104, 104, 104, 104, 106, 106, 106, 107); colset(bluemap, 146, 146, 147, 147, 147, 149, 149, 149, 152, 152, 152, 152, 155, 155, 155, 157); colset(redmap, 32, 32, 33, 33, 33, 35, 35, 35, 39, 39, 39, 39, 42, 42, 42, 44); colset(graymap, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23);