From 50a34d85ddfe5769c8495bd7b37554c24630ef28 Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Mon, 26 Dec 2022 21:06:46 -0600 Subject: [PATCH 001/353] Clean up the backtrace code and make it use write() more safely. --- src/sdl/i_system.c | 78 +++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index e328bedc2..076134d0a 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -258,68 +258,82 @@ SDL_bool framebuffer = SDL_FALSE; UINT8 keyboard_started = false; #ifdef UNIXBACKTRACE -#define STDERR_WRITE(string) if (fd != -1) I_OutputMsg("%s", string) -#define CRASHLOG_WRITE(string) if (fd != -1) write(fd, string, strlen(string)) -#define CRASHLOG_STDERR_WRITE(string) \ - if (fd != -1)\ - write(fd, string, strlen(string));\ - I_OutputMsg("%s", string) + +// NOTE: if written ends up ever being -1, all further writes end up being cancelled. +// i figure an error is a reason to stop writing... +#define WRITE_FILE(string) \ + sourcelen = strlen(string); \ + while (fd != -1 && (written != -1 && errno != EINTR) && written < sourcelen) \ + written = write(fd, string, sourcelen); + +#define WRITE_STDERR(string) \ + I_OutputMsg("%s", string); + +#define WRITE_ALL(string) \ + WRITE_FILE(string); \ + WRITE_STDERR(string); static void write_backtrace(INT32 signal) { int fd = -1; - size_t size; + ssize_t written = 0; + ssize_t sourcelen = 0; time_t rawtime; struct tm timeinfo; + size_t size; enum { BT_SIZE = 1024, STR_SIZE = 32 }; - void *array[BT_SIZE]; + void *funcptrs[BT_SIZE]; char timestr[STR_SIZE]; - const char *error = "An error occurred within SRB2! Send this stack trace to someone who can help!\n"; - const char *error2 = "(Or find crash-log.txt in your SRB2 directory.)\n"; // Shown only to stderr. + const char *filename = va("%s" PATHSEP "%s", srb2home, "crash-log.txt"); - fd = open(va("%s" PATHSEP "%s", srb2home, "crash-log.txt"), O_CREAT|O_APPEND|O_RDWR, S_IRUSR|S_IWUSR); + fd = open(filename, O_CREAT|O_APPEND|O_RDWR, S_IRUSR|S_IWUSR); - if (fd == -1) - I_OutputMsg("\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n"); + if (fd == -1) // File handle error + WRITE_STDERR("\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n"); // Get the current time as a string. time(&rawtime); localtime_r(&rawtime, &timeinfo); strftime(timestr, STR_SIZE, "%a, %d %b %Y %T %z", &timeinfo); - CRASHLOG_WRITE("------------------------\n"); // Nice looking seperator + WRITE_FILE("------------------------\n"); // Nice looking seperator - CRASHLOG_STDERR_WRITE("\n"); // Newline to look nice for both outputs. - CRASHLOG_STDERR_WRITE(error); // "Oops, SRB2 crashed" message - STDERR_WRITE(error2); // Tell the user where the crash log is. + WRITE_ALL("\n"); // Newline to look nice for both outputs. + WRITE_ALL("An error occurred within SRB2! Send this stack trace to someone who can help!\n"); + + if (fd != -1) // If the crash log exists, + WRITE_STDERR("(Or find crash-log.txt in your SRB2 directory.)\n"); // tell the user where the crash log is. // Tell the log when we crashed. - CRASHLOG_WRITE("Time of crash: "); - CRASHLOG_WRITE(timestr); - CRASHLOG_WRITE("\n"); + WRITE_FILE("Time of crash: "); + WRITE_FILE(timestr); + WRITE_FILE("\n"); // Give the crash log the cause and a nice 'Backtrace:' thing // The signal is given to the user when the parent process sees we crashed. - CRASHLOG_WRITE("Cause: "); - CRASHLOG_WRITE(strsignal(signal)); - CRASHLOG_WRITE("\n"); // Newline for the signal name + WRITE_FILE("Cause: "); + WRITE_FILE(strsignal(signal)); + WRITE_FILE("\n"); // Newline for the signal name - CRASHLOG_STDERR_WRITE("\nBacktrace:\n"); + WRITE_ALL("\nBacktrace:\n"); // Flood the output and log with the backtrace - size = backtrace(array, BT_SIZE); - backtrace_symbols_fd(array, size, fd); - backtrace_symbols_fd(array, size, STDERR_FILENO); + size = backtrace(funcptrs, BT_SIZE); + backtrace_symbols_fd(funcptrs, size, fd); + backtrace_symbols_fd(funcptrs, size, STDERR_FILENO); - CRASHLOG_WRITE("\n"); // Write another newline to the log so it looks nice :) + WRITE_FILE("\n"); // Write another newline to the log so it looks nice :) - close(fd); + if (fd != -1) { + fsync(fd); // reaaaaally make sure we got that data written. + close(fd); + } } -#undef STDERR_WRITE -#undef CRASHLOG_WRITE -#undef CRASHLOG_STDERR_WRITE +#undef WRITE_FILE +#undef WRITE_STDERR +#undef WRITE_ALL #endif // UNIXBACKTRACE static void I_ReportSignal(int num, int coredumped) From c5e69fcf94c8e3296b567a56efb9aca66352564d Mon Sep 17 00:00:00 2001 From: GoldenTails Date: Thu, 13 Apr 2023 01:19:12 -0500 Subject: [PATCH 002/353] Replace macros with static functions, rename size int to bt_size. --- src/sdl/i_system.c | 63 +++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 076134d0a..d4055ba26 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -259,28 +259,29 @@ UINT8 keyboard_started = false; #ifdef UNIXBACKTRACE -// NOTE: if written ends up ever being -1, all further writes end up being cancelled. -// i figure an error is a reason to stop writing... -#define WRITE_FILE(string) \ - sourcelen = strlen(string); \ - while (fd != -1 && (written != -1 && errno != EINTR) && written < sourcelen) \ +static void bt_write_file(int fd, const char *string) { + ssize_t written = 0; + ssize_t sourcelen = strlen(string); + + while (fd != -1 && (written != -1 && errno != EINTR) && written < sourcelen) written = write(fd, string, sourcelen); +} -#define WRITE_STDERR(string) \ - I_OutputMsg("%s", string); +static void bt_write_stderr(const char *string) { + bt_write_file(STDERR_FILENO, string); +} -#define WRITE_ALL(string) \ - WRITE_FILE(string); \ - WRITE_STDERR(string); +static void bt_write_all(int fd, const char *string) { + bt_write_file(fd, string); + bt_write_file(STDERR_FILENO, string); +} static void write_backtrace(INT32 signal) { int fd = -1; - ssize_t written = 0; - ssize_t sourcelen = 0; time_t rawtime; struct tm timeinfo; - size_t size; + size_t bt_size; enum { BT_SIZE = 1024, STR_SIZE = 32 }; void *funcptrs[BT_SIZE]; @@ -291,49 +292,47 @@ static void write_backtrace(INT32 signal) fd = open(filename, O_CREAT|O_APPEND|O_RDWR, S_IRUSR|S_IWUSR); if (fd == -1) // File handle error - WRITE_STDERR("\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n"); + bt_write_stderr("\nWARNING: Couldn't open crash log for writing! Make sure your permissions are correct. Please save the below report!\n"); // Get the current time as a string. time(&rawtime); localtime_r(&rawtime, &timeinfo); strftime(timestr, STR_SIZE, "%a, %d %b %Y %T %z", &timeinfo); - WRITE_FILE("------------------------\n"); // Nice looking seperator + bt_write_file(fd, "------------------------\n"); // Nice looking seperator - WRITE_ALL("\n"); // Newline to look nice for both outputs. - WRITE_ALL("An error occurred within SRB2! Send this stack trace to someone who can help!\n"); + bt_write_all(fd, "\n"); // Newline to look nice for both outputs. + bt_write_all(fd, "An error occurred within SRB2! Send this stack trace to someone who can help!\n"); if (fd != -1) // If the crash log exists, - WRITE_STDERR("(Or find crash-log.txt in your SRB2 directory.)\n"); // tell the user where the crash log is. + bt_write_stderr("(Or find crash-log.txt in your SRB2 directory.)\n"); // tell the user where the crash log is. // Tell the log when we crashed. - WRITE_FILE("Time of crash: "); - WRITE_FILE(timestr); - WRITE_FILE("\n"); + bt_write_file(fd, "Time of crash: "); + bt_write_file(fd, timestr); + bt_write_file(fd, "\n"); // Give the crash log the cause and a nice 'Backtrace:' thing // The signal is given to the user when the parent process sees we crashed. - WRITE_FILE("Cause: "); - WRITE_FILE(strsignal(signal)); - WRITE_FILE("\n"); // Newline for the signal name + bt_write_file(fd, "Cause: "); + bt_write_file(fd, strsignal(signal)); + bt_write_file(fd, "\n"); // Newline for the signal name - WRITE_ALL("\nBacktrace:\n"); + bt_write_all(fd, "\nBacktrace:\n"); // Flood the output and log with the backtrace - size = backtrace(funcptrs, BT_SIZE); - backtrace_symbols_fd(funcptrs, size, fd); - backtrace_symbols_fd(funcptrs, size, STDERR_FILENO); + bt_size = backtrace(funcptrs, BT_SIZE); + backtrace_symbols_fd(funcptrs, bt_size, fd); + backtrace_symbols_fd(funcptrs, bt_size, STDERR_FILENO); - WRITE_FILE("\n"); // Write another newline to the log so it looks nice :) + bt_write_file(fd, "\n"); // Write another newline to the log so it looks nice :) if (fd != -1) { fsync(fd); // reaaaaally make sure we got that data written. close(fd); } } -#undef WRITE_FILE -#undef WRITE_STDERR -#undef WRITE_ALL + #endif // UNIXBACKTRACE static void I_ReportSignal(int num, int coredumped) From 68ad3a1c627ac47ba2a19fe0b0d2ec38b443d3af Mon Sep 17 00:00:00 2001 From: spherallic Date: Fri, 1 Sep 2023 02:53:08 +0200 Subject: [PATCH 003/353] STJr intro tweaks: - Disable initial fade from startup screen - Add half-second pauses at the start and end --- src/d_main.c | 4 ++-- src/f_finale.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 24c70843a..6e17af258 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -297,8 +297,8 @@ void D_ProcessEvents(void) // added comment : there is a wipe eatch change of the gamestate gamestate_t wipegamestate = GS_LEVEL; // -1: Default; 0-n: Wipe index; INT16_MAX: do not wipe -INT16 wipetypepre = -1; -INT16 wipetypepost = -1; +INT16 wipetypepre = INT16_MAX; +INT16 wipetypepost = INT16_MAX; static void D_Display(void) { diff --git a/src/f_finale.c b/src/f_finale.c index 11ea909e9..c592c69bb 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -312,7 +312,7 @@ const char *introtext[NUMINTROSCENES]; static tic_t introscenetime[NUMINTROSCENES] = { - 5*TICRATE, // STJr Presents + 6*TICRATE, // STJr Presents 11*TICRATE + (TICRATE/2), // Two months had passed since... 15*TICRATE + (TICRATE/2), // As it was about to drain the rings... 14*TICRATE, // What Sonic, Tails, and Knuckles... @@ -622,15 +622,15 @@ void F_IntroDrawer(void) { V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); - if (intro_curtime < TICRATE-5) // Make the text shine! + if (intro_curtime > TICRATE-17 && intro_curtime < 2*TICRATE-22) // Make the text shine! { - sprintf(stjrintro, "STJRI%03u", intro_curtime-1); + sprintf(stjrintro, "STJRI%03u", intro_curtime-19); } - else if (intro_curtime >= TICRATE-6 && intro_curtime < 2*TICRATE-20) // Pause on black screen for just a second + else if (intro_curtime >= 2*TICRATE-23 && intro_curtime < 2*TICRATE-3) // Pause on black screen for just a second { return; } - else if (intro_curtime == 2*TICRATE-19) + else if (intro_curtime == 2*TICRATE-2) { // Fade in the text // The text fade out is automatically handled when switching to a new intro scene @@ -949,7 +949,7 @@ void F_IntroTicker(void) if (rendermode != render_none) { - if (intro_scenenum == 0 && intro_curtime == 2*TICRATE-19) + if (intro_scenenum == 0 && intro_curtime == 2*TICRATE-2) { S_ChangeMusicInternal("_stjr", false); From 5e2311c48db8c409e2571e8377e2f178fa4f7726 Mon Sep 17 00:00:00 2001 From: Logan Aerl Arias Date: Tue, 2 Jan 2024 22:03:51 -0500 Subject: [PATCH 004/353] Update i_system.c removed CRASHLOG_STDERR_WRITE --- src/sdl/i_system.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 2307961d2..ca68d031a 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -339,14 +339,6 @@ static void write_backtrace(INT32 signal) bt_size = backtrace(funcptrs, BT_SIZE); backtrace_symbols_fd(funcptrs, bt_size, fd); backtrace_symbols_fd(funcptrs, bt_size, STDERR_FILENO); -#ifndef NOEXECINFO - CRASHLOG_STDERR_WRITE("\nBacktrace:\n"); - - // Flood the output and log with the backtrace - size = backtrace(array, BT_SIZE); - backtrace_symbols_fd(array, size, fd); - backtrace_symbols_fd(array, size, STDERR_FILENO); -#endif bt_write_file(fd, "\n"); // Write another newline to the log so it looks nice :) if (fd != -1) { From eae89efbb92574b325710c9a9f61cee313203f95 Mon Sep 17 00:00:00 2001 From: Logan Aerl Arias Date: Tue, 2 Jan 2024 22:06:00 -0500 Subject: [PATCH 005/353] Update i_system.c remove unused size_t size remove unused void *array[BT_SIZE]; --- src/sdl/i_system.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index ca68d031a..6e6031f4e 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -288,18 +288,12 @@ static void bt_write_all(int fd, const char *string) { static void write_backtrace(INT32 signal) { int fd = -1; -#ifndef NOEXECINFO - size_t size; -#endif time_t rawtime; struct tm timeinfo; size_t bt_size; enum { BT_SIZE = 1024, STR_SIZE = 32 }; void *funcptrs[BT_SIZE]; -#ifndef NOEXECINFO - void *array[BT_SIZE]; -#endif char timestr[STR_SIZE]; const char *filename = va("%s" PATHSEP "%s", srb2home, "crash-log.txt"); From 4fddc8fec71d9c6fd4915895b00fb6b20f6d4622 Mon Sep 17 00:00:00 2001 From: Logan Aerl Arias Date: Tue, 2 Jan 2024 22:23:52 -0500 Subject: [PATCH 006/353] Update i_system.c backtrace() doesn't exist in non-glibc systems --- src/sdl/i_system.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 6e6031f4e..bc21134da 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -290,10 +290,12 @@ static void write_backtrace(INT32 signal) int fd = -1; time_t rawtime; struct tm timeinfo; - size_t bt_size; enum { BT_SIZE = 1024, STR_SIZE = 32 }; +#ifndef NOEXECINFO void *funcptrs[BT_SIZE]; + size_t bt_size; +#endif char timestr[STR_SIZE]; const char *filename = va("%s" PATHSEP "%s", srb2home, "crash-log.txt"); @@ -327,12 +329,16 @@ static void write_backtrace(INT32 signal) bt_write_file(fd, strsignal(signal)); bt_write_file(fd, "\n"); // Newline for the signal name +#ifdef NOEXECINFO + bt_write_all(fd, "\nNo Backtrace support\n"); +#else bt_write_all(fd, "\nBacktrace:\n"); // Flood the output and log with the backtrace bt_size = backtrace(funcptrs, BT_SIZE); backtrace_symbols_fd(funcptrs, bt_size, fd); backtrace_symbols_fd(funcptrs, bt_size, STDERR_FILENO); +#endif bt_write_file(fd, "\n"); // Write another newline to the log so it looks nice :) if (fd != -1) { From 7ff1d5877d0eb355dbb457758f82d8388179b038 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 1 Feb 2024 18:16:24 +0100 Subject: [PATCH 007/353] Replace glBuild2DMipmaps with GL_GENERATE_MIPMAPS Quote "gluBuild2DMipmaps. Never use this." gluBuild2DMipmaps was causing massive stutters on many maps on windows this replaces it with GL_GENERATE_MIPMAP and removes glBuild2DMipmaps completely https://www.khronos.org/opengl/wiki/Common_Mistakes --- src/hardware/r_opengl/r_opengl.c | 18 ++++++++---------- src/hardware/r_opengl/r_opengl.h | 1 + src/sdl/ogl_sdl.c | 5 +++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index ea831e41d..932cfbaff 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -77,6 +77,7 @@ static GLint min_filter = GL_LINEAR; static GLint mag_filter = GL_LINEAR; static GLint anisotropic_filter = 0; static boolean model_lighting = false; +boolean supportMipMap = false; const GLubyte *gl_version = NULL; const GLubyte *gl_renderer = NULL; @@ -397,9 +398,6 @@ static PFNglCopyTexImage2D pglCopyTexImage2D; typedef void (APIENTRY * PFNglCopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); static PFNglCopyTexSubImage2D pglCopyTexSubImage2D; #endif -/* GLU functions */ -typedef GLint (APIENTRY * PFNgluBuild2DMipmaps) (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data); -static PFNgluBuild2DMipmaps pgluBuild2DMipmaps; /* 1.3 functions for multitexturing */ typedef void (APIENTRY *PFNglActiveTexture) (GLenum); @@ -907,9 +905,6 @@ void SetupGLFunc4(void) pglUniform3fv = GetGLFunc("glUniform3fv"); pglGetUniformLocation = GetGLFunc("glGetUniformLocation"); #endif - - // GLU - pgluBuild2DMipmaps = GetGLFunc("gluBuild2DMipmaps"); } EXPORT boolean HWRAPI(CompileShaders) (void) @@ -1887,7 +1882,8 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo) //pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); if (MipMap) { - pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_LUMINANCE_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex); + pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); + pglTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0); if (pTexInfo->flags & TF_TRANSPARENT) pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff @@ -1908,7 +1904,8 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo) //pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); if (MipMap) { - pgluBuild2DMipmaps(GL_TEXTURE_2D, GL_ALPHA, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex); + pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); + pglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0); if (pTexInfo->flags & TF_TRANSPARENT) pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, 0); // No mippmaps on transparent stuff @@ -1928,7 +1925,8 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo) { if (MipMap) { - pgluBuild2DMipmaps(GL_TEXTURE_2D, textureformatGL, w, h, GL_RGBA, GL_UNSIGNED_BYTE, ptex); + pglTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); + pglTexImage2D(GL_TEXTURE_2D, 0, textureformatGL, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, ptex); // Control the mipmap level of detail pglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0); // the lower the number, the higer the detail if (pTexInfo->flags & TF_TRANSPARENT) @@ -2463,7 +2461,7 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value) mag_filter = GL_LINEAR; min_filter = GL_NEAREST; } - if (!pgluBuild2DMipmaps) + if (!supportMipMap) { MipMap = GL_FALSE; min_filter = GL_LINEAR; diff --git a/src/hardware/r_opengl/r_opengl.h b/src/hardware/r_opengl/r_opengl.h index f44e0818b..8e4784c65 100644 --- a/src/hardware/r_opengl/r_opengl.h +++ b/src/hardware/r_opengl/r_opengl.h @@ -126,6 +126,7 @@ extern GLint screen_width; extern GLint screen_height; extern GLbyte screen_depth; extern GLint maximumAnisotropy; +extern boolean supportMipMap; /** \brief OpenGL flags for video driver */ diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index db0538195..81b1314e0 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -189,6 +189,11 @@ boolean OglSdlSurface(INT32 w, INT32 h) else maximumAnisotropy = 1; + if (atof((const char*)gl_version) >= 1.4) + supportMipMap = true; + else + supportMipMap = false; + SetupGLFunc4(); glanisotropicmode_cons_t[1].value = maximumAnisotropy; From e892cc1d4b7fcfa5abe9359f7506ca97e501504c Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 1 Feb 2024 18:57:55 +0100 Subject: [PATCH 008/353] Fix FOFs with transferline flag and many linedefs randomly crashing linenum could go out of bounds if you use more than 4 linedefs for such setup, hence making the game unable to retrieve textures and therefore crashing the games sometimes many thanks to indev for helping me figuring this one out c: --- src/hardware/hw_main.c | 4 ++-- src/r_segs.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index be0c7ba62..faa5372f2 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1631,7 +1631,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (rover->master->flags & ML_TFERLINE) { - size_t linenum = gl_curline->linedef-gl_backsector->lines[0]; + size_t linenum = min(gl_curline->linedef-gl_backsector->lines[0], rover->master->frontsector->linecount); newline = rover->master->frontsector->lines[0] + linenum; side = &sides[newline->sidenum[0]]; do_texture_skew = newline->flags & ML_SKEWTD; @@ -1785,7 +1785,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (rover->master->flags & ML_TFERLINE) { - size_t linenum = gl_curline->linedef-gl_backsector->lines[0]; + size_t linenum = min(gl_curline->linedef-gl_backsector->lines[0], rover->master->frontsector->linecount); newline = rover->master->frontsector->lines[0] + linenum; side = &sides[newline->sidenum[0]]; } diff --git a/src/r_segs.c b/src/r_segs.c index 9340ca50c..b43f5e714 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -571,7 +571,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (pfloor->master->flags & ML_TFERLINE) { - size_t linenum = curline->linedef-backsector->lines[0]; + size_t linenum = min(curline->linedef-backsector->lines[0], pfloor->master->frontsector->linecount); line_t *newline = pfloor->master->frontsector->lines[0] + linenum; sidedef = &sides[newline->sidenum[0]]; do_texture_skew = newline->flags & ML_SKEWTD; From afa9b324080789d503fb4f39e6e210e95729be11 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 1 Feb 2024 19:13:13 +0100 Subject: [PATCH 009/353] compiler complains --- src/hardware/hw_main.c | 4 ++-- src/r_segs.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index faa5372f2..8a1ad4f69 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1631,7 +1631,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (rover->master->flags & ML_TFERLINE) { - size_t linenum = min(gl_curline->linedef-gl_backsector->lines[0], rover->master->frontsector->linecount); + size_t linenum = min((size_t)(gl_curline->linedef-gl_backsector->lines[0]), rover->master->frontsector->linecount); newline = rover->master->frontsector->lines[0] + linenum; side = &sides[newline->sidenum[0]]; do_texture_skew = newline->flags & ML_SKEWTD; @@ -1785,7 +1785,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (rover->master->flags & ML_TFERLINE) { - size_t linenum = min(gl_curline->linedef-gl_backsector->lines[0], rover->master->frontsector->linecount); + size_t linenum = min((size_t)(gl_curline->linedef-gl_backsector->lines[0]), rover->master->frontsector->linecount); newline = rover->master->frontsector->lines[0] + linenum; side = &sides[newline->sidenum[0]]; } diff --git a/src/r_segs.c b/src/r_segs.c index b43f5e714..326b406f7 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -571,7 +571,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (pfloor->master->flags & ML_TFERLINE) { - size_t linenum = min(curline->linedef-backsector->lines[0], pfloor->master->frontsector->linecount); + size_t linenum = min((size_t)(curline->linedef-backsector->lines[0]), pfloor->master->frontsector->linecount); line_t *newline = pfloor->master->frontsector->lines[0] + linenum; sidedef = &sides[newline->sidenum[0]]; do_texture_skew = newline->flags & ML_SKEWTD; From 30e7bd90a430cc2f37670f7e826949fb91b1481e Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 1 Feb 2024 21:03:28 +0100 Subject: [PATCH 010/353] Better Opengl version check somehow forgor about vendor information in the version string lmao --- src/sdl/ogl_sdl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 81b1314e0..9b6678401 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -155,6 +155,7 @@ boolean OglSdlSurface(INT32 w, INT32 h) { INT32 cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value; static boolean first_init = false; + static int majorGL = 0, minorGL = 0; oglflags = 0; @@ -189,7 +190,8 @@ boolean OglSdlSurface(INT32 w, INT32 h) else maximumAnisotropy = 1; - if (atof((const char*)gl_version) >= 1.4) + if (sscanf((const char*)gl_version, "%d.%d", &majorGL, &minorGL) + && (!(majorGL == 1 && minorGL <= 3))) supportMipMap = true; else supportMipMap = false; From 338088104e6a16ddbba5e5f32811a4dbaaf64cef Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 1 Feb 2024 22:10:38 +0100 Subject: [PATCH 011/353] Remove GLU library loading code hope i didnt forger smth X) --- src/hardware/r_opengl/ogl_win.c | 12 +-------- src/hardware/r_opengl/r_opengl.h | 1 - src/sdl/i_video.c | 2 -- src/sdl/ogl_sdl.c | 46 -------------------------------- src/sdl/ogl_sdl.h | 2 -- 5 files changed, 1 insertion(+), 62 deletions(-) diff --git a/src/hardware/r_opengl/ogl_win.c b/src/hardware/r_opengl/ogl_win.c index c9bf60144..ec8fc9bdb 100644 --- a/src/hardware/r_opengl/ogl_win.c +++ b/src/hardware/r_opengl/ogl_win.c @@ -117,7 +117,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, // handle to DLL module #define pwglDeleteContext wglDeleteContext; #define pwglMakeCurrent wglMakeCurrent; #else -static HMODULE OGL32, GLU32; +static HMODULE OGL32; typedef void *(WINAPI *PFNwglGetProcAddress) (const char *); static PFNwglGetProcAddress pwglGetProcAddress; typedef HGLRC (WINAPI *PFNwglCreateContext) (HDC hdc); @@ -132,13 +132,6 @@ static PFNwglMakeCurrent pwglMakeCurrent; void *GetGLFunc(const char *proc) { void *func = NULL; - if (strncmp(proc, "glu", 3) == 0) - { - if (GLU32) - func = GetProcAddress(GLU32, proc); - else - return NULL; - } if (pwglGetProcAddress) func = pwglGetProcAddress(proc); if (!func) @@ -155,8 +148,6 @@ boolean LoadGL(void) if (!OGL32) return 0; - GLU32 = LoadLibrary("GLU32.DLL"); - pwglGetProcAddress = GetGLFunc("wglGetProcAddress"); pwglCreateContext = GetGLFunc("wglCreateContext"); pwglDeleteContext = GetGLFunc("wglDeleteContext"); @@ -528,7 +519,6 @@ EXPORT void HWRAPI(Shutdown) (void) ReleaseDC(hWnd, hDC); hDC = NULL; } - FreeLibrary(GLU32); FreeLibrary(OGL32); GL_DBG_Printf ("HWRAPI Shutdown(DONE)\n"); } diff --git a/src/hardware/r_opengl/r_opengl.h b/src/hardware/r_opengl/r_opengl.h index 8e4784c65..fefe43ae7 100644 --- a/src/hardware/r_opengl/r_opengl.h +++ b/src/hardware/r_opengl/r_opengl.h @@ -35,7 +35,6 @@ #else #include -#include #ifdef STATIC_OPENGL // Because of the 1.3 functions, you'll need GLext to compile it if static #define GL_GLEXT_PROTOTYPES diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index d3a602c05..6fccf3a17 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -2026,8 +2026,6 @@ void I_ShutdownGraphics(void) I_OutputMsg("shut down\n"); #ifdef HWRENDER - if (GLUhandle) - hwClose(GLUhandle); if (sdlglcontext) { SDL_GL_DeleteContext(sdlglcontext); diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 9b6678401..b47c09833 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -70,18 +70,10 @@ PFNglGetString pglGetString; /** \brief SDL video display surface */ INT32 oglflags = 0; -void *GLUhandle = NULL; SDL_GLContext sdlglcontext = 0; void *GetGLFunc(const char *proc) { - if (strncmp(proc, "glu", 3) == 0) - { - if (GLUhandle) - return hwSym(proc, GLUhandle); - else - return NULL; - } return SDL_GL_GetProcAddress(proc); } @@ -89,7 +81,6 @@ boolean LoadGL(void) { #ifndef STATIC_OPENGL const char *OGLLibname = NULL; - const char *GLULibname = NULL; if (M_CheckParm("-OGLlib") && M_IsNextParm()) OGLLibname = M_GetNextParm(); @@ -102,43 +93,6 @@ boolean LoadGL(void) CONS_Printf("If you know what is the OpenGL library's name, use -OGLlib\n"); return 0; } - -#if 0 - GLULibname = "/proc/self/exe"; -#elif defined (_WIN32) - GLULibname = "GLU32.DLL"; -#elif defined (__MACH__) - GLULibname = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib"; -#elif defined (macintos) - GLULibname = "OpenGLLibrary"; -#elif defined (__unix__) - GLULibname = "libGLU.so.1"; -#elif defined (__HAIKU__) - GLULibname = "libGLU.so"; -#else - GLULibname = NULL; -#endif - - if (M_CheckParm("-GLUlib") && M_IsNextParm()) - GLULibname = M_GetNextParm(); - - if (GLULibname) - { - GLUhandle = hwOpen(GLULibname); - if (GLUhandle) - return SetupGLfunc(); - else - { - CONS_Alert(CONS_ERROR, "Could not load GLU Library: %s\n", GLULibname); - if (!M_CheckParm ("-GLUlib")) - CONS_Alert(CONS_ERROR, "If you know what is the GLU library's name, use -GLUlib\n"); - } - } - else - { - CONS_Alert(CONS_ERROR, "Could not load GLU Library\n"); - CONS_Alert(CONS_ERROR, "If you know what is the GLU library's name, use -GLUlib\n"); - } #endif return SetupGLfunc(); } diff --git a/src/sdl/ogl_sdl.h b/src/sdl/ogl_sdl.h index bd1d699ff..87df5e5e6 100644 --- a/src/sdl/ogl_sdl.h +++ b/src/sdl/ogl_sdl.h @@ -19,8 +19,6 @@ #include "../v_video.h" -extern void *GLUhandle; - boolean OglSdlSurface(INT32 w, INT32 h); void OglSdlFinishUpdate(boolean vidwait); From 75c270d546583e1a6421f911561b76edb06069cc Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sat, 10 Feb 2024 18:55:10 +0100 Subject: [PATCH 012/353] Expose PF_SHIELDDOWN to Lua --- src/deh_tables.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index fa86518e2..1f8cebed6 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -4483,6 +4483,8 @@ const char *const PLAYERFLAG_LIST[] = { "CANCARRY", // Can carry? "FINISHED", + "SHIELDDOWN", // Shield has been pressed. + NULL // stop loop here. }; From 07678311d1d84ee942bb69ab57eb430ec2523848 Mon Sep 17 00:00:00 2001 From: SSNTails Date: Thu, 15 Feb 2024 08:39:23 -0500 Subject: [PATCH 013/353] Missiles fired by player will not hit bots --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 7887c117d..dba8cc5cf 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1278,8 +1278,8 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) if (tmthing->type != MT_SHELL && tmthing->target && tmthing->target->type == thing->type) { - // Don't hit same species as originator. - if (thing == tmthing->target) + // Don't hit yourself, and if a player, don't hit bots + if (thing == tmthing->target || (thing->player && thing->player->bot)) return CHECKTHING_IGNORE; if (thing->type != MT_PLAYER) From 2db0dc3ad983c2c4c2fd75ddc09ed1fa94701cfc Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 15 Feb 2024 10:32:21 -0500 Subject: [PATCH 014/353] Zwip-Zwap's suggestion of checking for coop and types of bots --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index dba8cc5cf..0c976d5b0 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1279,7 +1279,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) if (tmthing->type != MT_SHELL && tmthing->target && tmthing->target->type == thing->type) { // Don't hit yourself, and if a player, don't hit bots - if (thing == tmthing->target || (thing->player && thing->player->bot)) + if (thing == tmthing->target || (thing->player && gametype == GT_COOP && (thing->player->bot == BOT_2PAI || thing->player->bot == BOT_2PHUMAN))) return CHECKTHING_IGNORE; if (thing->type != MT_PLAYER) From 398b5a1840d93b67d9d6c862098896466e2e2289 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 15 Feb 2024 23:00:35 -0500 Subject: [PATCH 015/353] P_PlayerCanHurtPlayer() --- src/p_inter.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/p_local.h | 1 + src/p_map.c | 2 +- 3 files changed, 63 insertions(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index 82169bc54..afcdd5217 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3279,6 +3279,67 @@ static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, IN return true; } +// +// P_PlayerCanHurtPlayer +// +// Is it permissible for a player to hurt another player? +// This should be the definitive global function to determine if pain is allowed. :) +// +boolean P_PlayerCanHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype) +{ + if (!(damagetype & DMG_CANHURTSELF)) + { + // You can't kill yourself, idiot... + if (source == target) + return false; + + // In COOP/RACE, you can't hurt other players unless cv_friendlyfire is on + if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && (gametyperules & GTR_FRIENDLY)) + return false; + } + + // Tag handling + if (G_TagGametype()) + { + // If flashing or invulnerable, ignore the tag, + if (target->powers[pw_flashing] || target->powers[pw_invulnerability]) + return false; + + // Don't allow any damage before the round starts. + if (leveltime <= hidetime * TICRATE) + return false; + + // Ignore IT players shooting each other, unless friendlyfire is on. + if ((target->pflags & PF_TAGIT && !((cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) + && source->pflags & PF_TAGIT))) + return false; + + // Don't allow players on the same team to hurt one another, + // unless cv_friendlyfire is on. + if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) && (target->pflags & PF_TAGIT) == (source->pflags & PF_TAGIT)) + return false; + + if (inflictor->type == MT_LHRT) + return false; + + return true; + } + else if (damagetype & DMG_CANHURTSELF) + return true; + else if (G_GametypeHasTeams()) // CTF + Team Match + { + // Don't allow players on the same team to hurt one another, + // unless cv_friendlyfire is on. + if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && target->ctfteam == source->ctfteam) + return false; + } + + if (inflictor->type == MT_LHRT) + return false; + + return true; +} + static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype) { player_t *player = target->player; diff --git a/src/p_local.h b/src/p_local.h index 9644e7a24..d4b32b005 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -506,6 +506,7 @@ void P_RemoveShield(player_t *player); void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source); boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype); void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype); +boolean P_PlayerCanHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype); void P_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c void P_PlayerWeaponPanelBurst(player_t *player); void P_PlayerWeaponAmmoBurst(player_t *player); diff --git a/src/p_map.c b/src/p_map.c index 0c976d5b0..cdd66a12d 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1279,7 +1279,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) if (tmthing->type != MT_SHELL && tmthing->target && tmthing->target->type == thing->type) { // Don't hit yourself, and if a player, don't hit bots - if (thing == tmthing->target || (thing->player && gametype == GT_COOP && (thing->player->bot == BOT_2PAI || thing->player->bot == BOT_2PHUMAN))) + if (thing->player && tmthing->target->player && !P_PlayerCanHurtPlayer(thing->player, tmthing, tmthing->target->player, 0)) return CHECKTHING_IGNORE; if (thing->type != MT_PLAYER) From 5e29cd84a2cd3b69dd793b3f006b3980052c138b Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 16 Feb 2024 11:46:37 -0500 Subject: [PATCH 016/353] Stash changes --- src/p_inter.c | 18 ++++++++++-------- src/p_local.h | 2 +- src/p_map.c | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index afcdd5217..77604208f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3280,13 +3280,21 @@ static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, IN } // -// P_PlayerCanHurtPlayer +// P_CanPlayerHurtPlayer // // Is it permissible for a player to hurt another player? // This should be the definitive global function to determine if pain is allowed. :) // -boolean P_PlayerCanHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype) +boolean P_CanPlayerHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype) { + I_Assert(target != NULL); + I_Assert(source != NULL); + I_Assert(inflictor != NULL); + + // MT_LHRT should return true here, because we want it to go through the 'damage' process + if (inflictor->type == MT_LHRT) + return true; + if (!(damagetype & DMG_CANHURTSELF)) { // You can't kill yourself, idiot... @@ -3319,9 +3327,6 @@ boolean P_PlayerCanHurtPlayer(player_t *target, mobj_t *inflictor, player_t *sou if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) && (target->pflags & PF_TAGIT) == (source->pflags & PF_TAGIT)) return false; - if (inflictor->type == MT_LHRT) - return false; - return true; } else if (damagetype & DMG_CANHURTSELF) @@ -3334,9 +3339,6 @@ boolean P_PlayerCanHurtPlayer(player_t *target, mobj_t *inflictor, player_t *sou return false; } - if (inflictor->type == MT_LHRT) - return false; - return true; } diff --git a/src/p_local.h b/src/p_local.h index d4b32b005..136b7df28 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -506,7 +506,7 @@ void P_RemoveShield(player_t *player); void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source); boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype); void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype); -boolean P_PlayerCanHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype); +boolean P_CanPlayerHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype); void P_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c void P_PlayerWeaponPanelBurst(player_t *player); void P_PlayerWeaponAmmoBurst(player_t *player); diff --git a/src/p_map.c b/src/p_map.c index cdd66a12d..b18f0d1c1 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1279,7 +1279,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) if (tmthing->type != MT_SHELL && tmthing->target && tmthing->target->type == thing->type) { // Don't hit yourself, and if a player, don't hit bots - if (thing->player && tmthing->target->player && !P_PlayerCanHurtPlayer(thing->player, tmthing, tmthing->target->player, 0)) + if (thing->player && tmthing->target->player && !P_CanPlayerHurtPlayer(thing->player, tmthing, tmthing->target->player, 0)) return CHECKTHING_IGNORE; if (thing->type != MT_PLAYER) From dc625496d89ba310fe36a8335704d4fdab2fc7bb Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 16 Feb 2024 12:27:25 -0500 Subject: [PATCH 017/353] re-introduce the thing == tmthing->target check, so it applies to non-players --- src/p_map.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index b18f0d1c1..d4083cfd7 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1279,7 +1279,8 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) if (tmthing->type != MT_SHELL && tmthing->target && tmthing->target->type == thing->type) { // Don't hit yourself, and if a player, don't hit bots - if (thing->player && tmthing->target->player && !P_CanPlayerHurtPlayer(thing->player, tmthing, tmthing->target->player, 0)) + if (thing == tmthing->target + || (thing->player && tmthing->target->player && !P_CanPlayerHurtPlayer(thing->player, tmthing, tmthing->target->player, 0))) return CHECKTHING_IGNORE; if (thing->type != MT_PLAYER) From 487f4ef49fe7c8ff27614393cab85d7ba2d540e9 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sat, 17 Feb 2024 10:55:43 +0100 Subject: [PATCH 018/353] Fix addon loading issues with symlinks on Linux/*BSD --- src/filesrch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/filesrch.c b/src/filesrch.c index 6429b6fa2..734a599b3 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -444,12 +444,11 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name); #if defined(__linux__) || defined(__FreeBSD__) - if (dent->d_type == DT_UNKNOWN) - if (lstat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode)) + if (dent->d_type == DT_UNKNOWN || dent->d_type == DT_LNK) + if (stat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode)) dent->d_type = DT_DIR; // Linux and FreeBSD has a special field for file type on dirent, so use that to speed up lookups. - // FIXME: should we also follow symlinks? if (dent->d_type == DT_DIR && depthleft) #else if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat From 9a75ef18c388b7e5d1aab13c201695944153945a Mon Sep 17 00:00:00 2001 From: Arthur Date: Sat, 17 Feb 2024 10:04:34 -0500 Subject: [PATCH 019/353] Sometimes simple is better..? --- src/p_inter.c | 63 --------------------------------------------------- src/p_local.h | 1 - src/p_map.c | 2 +- 3 files changed, 1 insertion(+), 65 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 77604208f..82169bc54 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3279,69 +3279,6 @@ static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, IN return true; } -// -// P_CanPlayerHurtPlayer -// -// Is it permissible for a player to hurt another player? -// This should be the definitive global function to determine if pain is allowed. :) -// -boolean P_CanPlayerHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype) -{ - I_Assert(target != NULL); - I_Assert(source != NULL); - I_Assert(inflictor != NULL); - - // MT_LHRT should return true here, because we want it to go through the 'damage' process - if (inflictor->type == MT_LHRT) - return true; - - if (!(damagetype & DMG_CANHURTSELF)) - { - // You can't kill yourself, idiot... - if (source == target) - return false; - - // In COOP/RACE, you can't hurt other players unless cv_friendlyfire is on - if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && (gametyperules & GTR_FRIENDLY)) - return false; - } - - // Tag handling - if (G_TagGametype()) - { - // If flashing or invulnerable, ignore the tag, - if (target->powers[pw_flashing] || target->powers[pw_invulnerability]) - return false; - - // Don't allow any damage before the round starts. - if (leveltime <= hidetime * TICRATE) - return false; - - // Ignore IT players shooting each other, unless friendlyfire is on. - if ((target->pflags & PF_TAGIT && !((cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) - && source->pflags & PF_TAGIT))) - return false; - - // Don't allow players on the same team to hurt one another, - // unless cv_friendlyfire is on. - if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) && (target->pflags & PF_TAGIT) == (source->pflags & PF_TAGIT)) - return false; - - return true; - } - else if (damagetype & DMG_CANHURTSELF) - return true; - else if (G_GametypeHasTeams()) // CTF + Team Match - { - // Don't allow players on the same team to hurt one another, - // unless cv_friendlyfire is on. - if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && target->ctfteam == source->ctfteam) - return false; - } - - return true; -} - static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype) { player_t *player = target->player; diff --git a/src/p_local.h b/src/p_local.h index 136b7df28..9644e7a24 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -506,7 +506,6 @@ void P_RemoveShield(player_t *player); void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source); boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype); void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype); -boolean P_CanPlayerHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype); void P_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c void P_PlayerWeaponPanelBurst(player_t *player); void P_PlayerWeaponAmmoBurst(player_t *player); diff --git a/src/p_map.c b/src/p_map.c index d4083cfd7..32428208b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1280,7 +1280,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) { // Don't hit yourself, and if a player, don't hit bots if (thing == tmthing->target - || (thing->player && tmthing->target->player && !P_CanPlayerHurtPlayer(thing->player, tmthing, tmthing->target->player, 0))) + || (thing->player && tmthing->target->player && (thing->player->bot == BOT_2PAI || thing->player->bot == BOT_2PHUMAN))) return CHECKTHING_IGNORE; if (thing->type != MT_PLAYER) From 34817d9776b13879cd4201f36d06e6b45e012c36 Mon Sep 17 00:00:00 2001 From: SSNTails Date: Sun, 18 Feb 2024 22:38:34 -0500 Subject: [PATCH 020/353] Rollout rock handling with gravity boots --- src/p_map.c | 2 +- src/p_mobj.c | 8 ++++++++ src/p_user.c | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 7887c117d..b84fc7e27 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1043,7 +1043,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) if ((thing->flags & MF_PUSHABLE) // not carrying a player && (tmthing->player->powers[pw_carry] == CR_NONE) // player is not already riding something && !(tmthing->player->powers[pw_ignorelatch] & (1<<15)) - && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP)) + && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP) || tmthing->player->powers[pw_gravityboots]) && (P_MobjFlip(tmthing)*tmthing->momz <= 0) && ((!(tmthing->eflags & MFE_VERTICALFLIP) && abs(thing->z + thing->height - tmthing->z) < (thing->height>>2)) || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) diff --git a/src/p_mobj.c b/src/p_mobj.c index 1dd766fc3..eac8dc3d7 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1525,6 +1525,14 @@ fixed_t P_GetMobjGravity(mobj_t *mo) case MT_WATERDROP: case MT_CYBRAKDEMON: gravityadd >>= 1; + case MT_ROLLOUTROCK: + // If a player has gravity boots and its riding a rollout rock, the rock should copy the player's gravity + if (mo->tracer && mo->tracer->player && mo->tracer->player->powers[pw_gravityboots]) + { + gravityadd = -gravityadd; + mo->eflags ^= MFE_VERTICALFLIP; + } + break; default: break; } diff --git a/src/p_user.c b/src/p_user.c index 25a60cf34..9de234273 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1082,6 +1082,13 @@ void P_ResetPlayer(player_t *player) if (player->mo->tracer && !P_MobjWasRemoved(player->mo->tracer)) { player->mo->tracer->flags |= MF_PUSHABLE; + + // goose the mom a little bit to trigger gravity to process for a tic + if (player->mo->eflags & MFE_VERTICALFLIP) + player->mo->tracer->momz -= 1; + else + player->mo->tracer->momz += 1; + P_SetTarget(&player->mo->tracer->tracer, NULL); } P_SetTarget(&player->mo->tracer, NULL); @@ -4560,6 +4567,13 @@ void P_DoJump(player_t *player, boolean soundandstate, boolean allowflip) player->mo->momz += player->mo->tracer->momz; if (!P_IsObjectOnGround(player->mo->tracer)) P_SetObjectMomZ(player->mo->tracer, -9*FRACUNIT, true); + + // goose the mom a little bit to trigger gravity to process for a tic + if (player->mo->eflags & MFE_VERTICALFLIP) + player->mo->tracer->momz -= 1; + else + player->mo->tracer->momz += 1; + player->mo->tracer->flags |= MF_PUSHABLE; P_SetTarget(&player->mo->tracer->tracer, NULL); } From 372cbbc544e27b3689a0df8dbeddf5539dde83c3 Mon Sep 17 00:00:00 2001 From: SSNTails Date: Mon, 19 Feb 2024 08:08:12 -0500 Subject: [PATCH 021/353] missing 'break' --- src/p_mobj.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index eac8dc3d7..cdd71ccc4 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1525,6 +1525,7 @@ fixed_t P_GetMobjGravity(mobj_t *mo) case MT_WATERDROP: case MT_CYBRAKDEMON: gravityadd >>= 1; + break; case MT_ROLLOUTROCK: // If a player has gravity boots and its riding a rollout rock, the rock should copy the player's gravity if (mo->tracer && mo->tracer->player && mo->tracer->player->powers[pw_gravityboots]) From 716b9527bf9a0966154688818f5b8041b8351f8c Mon Sep 17 00:00:00 2001 From: Arthur Date: Wed, 21 Feb 2024 14:38:11 -0500 Subject: [PATCH 022/353] Add a -allowdesync parameter that will allow individual demos to desync. Warning is still shown, but player position will not be modified. --- src/d_main.c | 4 ++-- src/f_finale.c | 1 + src/g_demo.c | 20 ++++++++++++-------- src/g_demo.h | 5 +++-- src/m_menu.c | 1 + src/netcode/d_netcmd.c | 4 +++- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 83cb425c9..2bd9546bb 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1664,10 +1664,10 @@ void D_SRB2Main(void) if (M_CheckParm("-playdemo")) { singledemo = true; // quit after one demo - G_DeferedPlayDemo(tmp); + G_DeferedPlayDemo(tmp, M_CheckParm("-allowdemodesync") != 0); } else - G_TimeDemo(tmp); + G_TimeDemo(tmp, M_CheckParm("-allowdemodesync") != 0); G_SetGamestate(GS_NULL); wipegamestate = GS_NULL; diff --git a/src/f_finale.c b/src/f_finale.c index edeb08820..001f06137 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -3513,6 +3513,7 @@ void F_TitleScreenTicker(boolean run) titledemo = true; demofileoverride = DFILE_OVERRIDE_NONE; + demoallowdesync = false; G_DoPlayDemo(dname); } } diff --git a/src/g_demo.c b/src/g_demo.c index f64f34168..a35498e92 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -51,6 +51,7 @@ boolean demorecording; boolean demoplayback; boolean titledemo; // Title Screen demo can be cancelled by any key demo_file_override_e demofileoverride; +boolean demoallowdesync = false; // Allow demo files to de-sync static UINT8 *demobuffer = NULL; static UINT8 *demo_p, *demotime_p; static UINT8 *demoend; @@ -660,11 +661,14 @@ void G_ConsGhostTic(void) CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n")); demosynced = false; - P_UnsetThingPosition(testmo); - testmo->x = oldghost.x; - testmo->y = oldghost.y; - P_SetThingPosition(testmo); - testmo->z = oldghost.z; + if (!demoallowdesync) + { + P_UnsetThingPosition(testmo); + testmo->x = oldghost.x; + testmo->y = oldghost.y; + P_SetThingPosition(testmo); + testmo->z = oldghost.z; + } } if (*demo_p == DEMOMARKER) @@ -1975,7 +1979,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname) // // G_PlayDemo // -void G_DeferedPlayDemo(const char *name) +void G_DeferedPlayDemo(const char *name, boolean allowdesync) { COM_BufAddText("playdemo \""); COM_BufAddText(name); @@ -2633,7 +2637,7 @@ void G_FreeGhosts(void) // static INT32 restorecv_vidwait; -void G_TimeDemo(const char *name) +void G_TimeDemo(const char *name, boolean allowdesync) { nodrawers = M_CheckParm("-nodraw"); noblit = M_CheckParm("-noblit"); @@ -2644,7 +2648,7 @@ void G_TimeDemo(const char *name) singletics = true; framecount = 0; demostarttime = I_GetTime(); - G_DeferedPlayDemo(name); + G_DeferedPlayDemo(name, allowdesync); } void G_DoPlayMetal(void) diff --git a/src/g_demo.h b/src/g_demo.h index e8c0c8d95..19fbc80e2 100644 --- a/src/g_demo.h +++ b/src/g_demo.h @@ -35,6 +35,7 @@ typedef enum } demo_file_override_e; extern demo_file_override_e demofileoverride; +extern boolean demoallowdesync; // Quit after playing a demo from cmdline. extern boolean singledemo; @@ -94,9 +95,9 @@ void G_WriteMetalTic(mobj_t *metal); void G_SaveMetal(UINT8 **buffer); void G_LoadMetal(UINT8 **buffer); -void G_DeferedPlayDemo(const char *demo); +void G_DeferedPlayDemo(const char *demo, boolean allowdesync); void G_DoPlayDemo(char *defdemoname); -void G_TimeDemo(const char *name); +void G_TimeDemo(const char *name, boolean allowdesync); void G_AddGhost(char *defdemoname); void G_FreeGhosts(void); void G_DoPlayMetal(void); diff --git a/src/m_menu.c b/src/m_menu.c index 3c6ef0fe3..b18515842 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -10529,6 +10529,7 @@ static void M_StartTimeAttackReplay(INT32 choice) { M_ClearMenus(true); modeattacking = ATTACKING_RECORD; // set modeattacking before G_DoPlayDemo so the map loader knows + demoallowdesync = false; G_DoPlayDemo(ra_demoname); } } diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index 66a30637f..bd3edc2b8 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -1596,6 +1596,8 @@ static void Command_Playdemo_f(void) demofileoverride = DFILE_OVERRIDE_SKIP; } + demoallowdesync = COM_CheckParm("-allowdesync"); + // Internal if no extension, external if one exists // If external, convert the file name to a path in SRB2's home directory if (FIL_CheckExtension(name)) @@ -1643,7 +1645,7 @@ static void Command_Timedemo_f(void) CONS_Printf(M_GetText("Timing demo '%s'.\n"), timedemo_name); - G_TimeDemo(timedemo_name); + G_TimeDemo(timedemo_name, COM_CheckParm("-allowdesync")); } // stop current demo From a407ff88999c7300a185e508d04a7005d491b631 Mon Sep 17 00:00:00 2001 From: Arthur Date: Wed, 21 Feb 2024 16:22:00 -0500 Subject: [PATCH 023/353] Zwip Zwap Zapony's suggestion to use a consvar --- src/d_main.c | 4 ++-- src/f_finale.c | 1 - src/g_demo.c | 11 ++++++----- src/g_demo.h | 6 +++--- src/m_menu.c | 1 - src/netcode/d_netcmd.c | 5 ++--- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 2bd9546bb..83cb425c9 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1664,10 +1664,10 @@ void D_SRB2Main(void) if (M_CheckParm("-playdemo")) { singledemo = true; // quit after one demo - G_DeferedPlayDemo(tmp, M_CheckParm("-allowdemodesync") != 0); + G_DeferedPlayDemo(tmp); } else - G_TimeDemo(tmp, M_CheckParm("-allowdemodesync") != 0); + G_TimeDemo(tmp); G_SetGamestate(GS_NULL); wipegamestate = GS_NULL; diff --git a/src/f_finale.c b/src/f_finale.c index 001f06137..edeb08820 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -3513,7 +3513,6 @@ void F_TitleScreenTicker(boolean run) titledemo = true; demofileoverride = DFILE_OVERRIDE_NONE; - demoallowdesync = false; G_DoPlayDemo(dname); } } diff --git a/src/g_demo.c b/src/g_demo.c index a35498e92..ec3d223bd 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -51,7 +51,6 @@ boolean demorecording; boolean demoplayback; boolean titledemo; // Title Screen demo can be cancelled by any key demo_file_override_e demofileoverride; -boolean demoallowdesync = false; // Allow demo files to de-sync static UINT8 *demobuffer = NULL; static UINT8 *demo_p, *demotime_p; static UINT8 *demoend; @@ -68,6 +67,8 @@ static UINT8 *metalbuffer = NULL; static UINT8 *metal_p; static UINT16 metalversion; +consvar_t cv_resyncdemo = CVAR_INIT("resyncdemo", "On", 0, CV_OnOff, NULL); + // extra data stuff (events registered this frame while recording) static struct { UINT8 flags; // EZT flags @@ -661,7 +662,7 @@ void G_ConsGhostTic(void) CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n")); demosynced = false; - if (!demoallowdesync) + if (cv_resyncdemo.value) { P_UnsetThingPosition(testmo); testmo->x = oldghost.x; @@ -1979,7 +1980,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname) // // G_PlayDemo // -void G_DeferedPlayDemo(const char *name, boolean allowdesync) +void G_DeferedPlayDemo(const char *name) { COM_BufAddText("playdemo \""); COM_BufAddText(name); @@ -2637,7 +2638,7 @@ void G_FreeGhosts(void) // static INT32 restorecv_vidwait; -void G_TimeDemo(const char *name, boolean allowdesync) +void G_TimeDemo(const char *name) { nodrawers = M_CheckParm("-nodraw"); noblit = M_CheckParm("-noblit"); @@ -2648,7 +2649,7 @@ void G_TimeDemo(const char *name, boolean allowdesync) singletics = true; framecount = 0; demostarttime = I_GetTime(); - G_DeferedPlayDemo(name, allowdesync); + G_DeferedPlayDemo(name); } void G_DoPlayMetal(void) diff --git a/src/g_demo.h b/src/g_demo.h index 19fbc80e2..67f61f54d 100644 --- a/src/g_demo.h +++ b/src/g_demo.h @@ -35,7 +35,7 @@ typedef enum } demo_file_override_e; extern demo_file_override_e demofileoverride; -extern boolean demoallowdesync; +extern consvar_t cv_resyncdemo; // Quit after playing a demo from cmdline. extern boolean singledemo; @@ -95,9 +95,9 @@ void G_WriteMetalTic(mobj_t *metal); void G_SaveMetal(UINT8 **buffer); void G_LoadMetal(UINT8 **buffer); -void G_DeferedPlayDemo(const char *demo, boolean allowdesync); +void G_DeferedPlayDemo(const char *demo); void G_DoPlayDemo(char *defdemoname); -void G_TimeDemo(const char *name, boolean allowdesync); +void G_TimeDemo(const char *name); void G_AddGhost(char *defdemoname); void G_FreeGhosts(void); void G_DoPlayMetal(void); diff --git a/src/m_menu.c b/src/m_menu.c index b18515842..3c6ef0fe3 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -10529,7 +10529,6 @@ static void M_StartTimeAttackReplay(INT32 choice) { M_ClearMenus(true); modeattacking = ATTACKING_RECORD; // set modeattacking before G_DoPlayDemo so the map loader knows - demoallowdesync = false; G_DoPlayDemo(ra_demoname); } } diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index bd3edc2b8..f7aa2c6fa 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -675,6 +675,7 @@ void D_RegisterClientCommands(void) COM_AddCommand("timedemo", Command_Timedemo_f, 0); COM_AddCommand("stopdemo", Command_Stopdemo_f, COM_LUA); COM_AddCommand("playintro", Command_Playintro_f, COM_LUA); + CV_RegisterVar(&cv_resyncdemo); COM_AddCommand("resetcamera", Command_ResetCamera_f, COM_LUA); @@ -1596,8 +1597,6 @@ static void Command_Playdemo_f(void) demofileoverride = DFILE_OVERRIDE_SKIP; } - demoallowdesync = COM_CheckParm("-allowdesync"); - // Internal if no extension, external if one exists // If external, convert the file name to a path in SRB2's home directory if (FIL_CheckExtension(name)) @@ -1645,7 +1644,7 @@ static void Command_Timedemo_f(void) CONS_Printf(M_GetText("Timing demo '%s'.\n"), timedemo_name); - G_TimeDemo(timedemo_name, COM_CheckParm("-allowdesync")); + G_TimeDemo(timedemo_name); } // stop current demo From ea218c2e68839f025661607e6e2ef02d2b230ae3 Mon Sep 17 00:00:00 2001 From: SSNTails Date: Wed, 21 Feb 2024 19:25:57 -0500 Subject: [PATCH 024/353] Can't have a radius of 0 here! --- src/p_map.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 7887c117d..76be8851b 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3964,23 +3964,25 @@ stairstep: mo->momy = tmymove; } + const fixed_t tmradius = mo->radius > 8 ? mo->radius : 8; + do { - if (tmxmove > mo->radius) { - newx = mo->x + mo->radius; - tmxmove -= mo->radius; - } else if (tmxmove < -mo->radius) { - newx = mo->x - mo->radius; - tmxmove += mo->radius; + if (tmxmove > tmradius) { + newx = mo->x + tmradius; + tmxmove -= tmradius; + } else if (tmxmove < -tmradius) { + newx = mo->x - tmradius; + tmxmove += tmradius; } else { newx = mo->x + tmxmove; tmxmove = 0; } - if (tmymove > mo->radius) { - newy = mo->y + mo->radius; - tmymove -= mo->radius; - } else if (tmymove < -mo->radius) { - newy = mo->y - mo->radius; - tmymove += mo->radius; + if (tmymove > tmradius) { + newy = mo->y + tmradius; + tmymove -= tmradius; + } else if (tmymove < -tmradius) { + newy = mo->y - tmradius; + tmymove += tmradius; } else { newy = mo->y + tmymove; tmymove = 0; From d43d5fb9e14ebf417077cd9e31be861a3939d7c5 Mon Sep 17 00:00:00 2001 From: SSNTails Date: Fri, 23 Feb 2024 15:23:39 -0500 Subject: [PATCH 025/353] Don't change drawangle while riding on a fan --- src/p_user.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index 25a60cf34..1964a6b3e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12134,6 +12134,8 @@ void P_PlayerThink(player_t *player) case CR_DUSTDEVIL: player->drawangle += ANG20; break; + case CR_FAN: // Don't impact drawangle in any special way when on a fan + break; /* -- in case we wanted to have the camera freely movable during zoom tubes case CR_ZOOMTUBE:*/ case CR_ROPEHANG: From de8464cd2f8217e1cd1f50c195a185929e5071de Mon Sep 17 00:00:00 2001 From: MIDIMan Date: Sat, 24 Feb 2024 20:04:48 -0500 Subject: [PATCH 026/353] Add alpha support for mobjs --- src/hardware/hw_main.c | 15 ++++++++++++++- src/lua_mobjlib.c | 13 +++++++++++++ src/p_mobj.c | 4 ++++ src/p_mobj.h | 1 + src/p_saveg.c | 9 ++++++++- src/p_user.c | 1 + src/r_things.c | 18 ++++++++++++++++++ src/r_things.h | 1 + 8 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 5a0d997fa..40f17301b 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2825,7 +2825,7 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale) } HWR_Lighting(&sSurf, 0, colormap); - sSurf.PolyColor.s.alpha = alpha; + sSurf.PolyColor.s.alpha = FixedMul(thing->alpha, alpha); if (HWR_UseShader()) { @@ -2999,11 +2999,16 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) // baseWallVerts is used to know the final shape to easily get the vertex // co-ordinates memcpy(wallVerts, baseWallVerts, sizeof(baseWallVerts)); + + UINT32 newalpha = spr->mobj->alpha; // if sprite has linkdraw, then dont write to z-buffer (by not using PF_Occlude) // this will result in sprites drawn afterwards to be drawn on top like intended when using linkdraw. if ((spr->mobj->flags2 & MF2_LINKDRAW) && spr->mobj->tracer) + { + newalpha = spr->mobj->tracer->alpha; occlusion = 0; + } else occlusion = PF_Occlude; @@ -3039,6 +3044,8 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) blend = HWR_GetBlendModeFlag(blendmode)|occlusion; if (!occlusion) use_linkdraw_hack = true; } + + Surf.PolyColor.s.alpha = FixedMul(newalpha, Surf.PolyColor.s.alpha); if (HWR_UseShader()) { @@ -3488,11 +3495,15 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) FBITFIELD blend = 0; FBITFIELD occlusion; boolean use_linkdraw_hack = false; + UINT32 newalpha = spr->mobj->alpha; // if sprite has linkdraw, then dont write to z-buffer (by not using PF_Occlude) // this will result in sprites drawn afterwards to be drawn on top like intended when using linkdraw. if ((spr->mobj->flags2 & MF2_LINKDRAW) && spr->mobj->tracer) + { occlusion = 0; + newalpha = spr->mobj->tracer->alpha; + } else occlusion = PF_Occlude; @@ -3528,6 +3539,8 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) blend = HWR_GetBlendModeFlag(blendmode)|occlusion; if (!occlusion) use_linkdraw_hack = true; } + + Surf.PolyColor.s.alpha = FixedMul(newalpha, Surf.PolyColor.s.alpha); if (spr->renderflags & RF_SHADOWEFFECTS) { diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 7fd16b32b..79d839677 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -69,6 +69,7 @@ enum mobj_e { mobj_color, mobj_translation, mobj_blendmode, + mobj_alpha, mobj_bnext, mobj_bprev, mobj_hnext, @@ -150,6 +151,7 @@ static const char *const mobj_opt[] = { "color", "translation", "blendmode", + "alpha", "bnext", "bprev", "hnext", @@ -354,6 +356,9 @@ static int mobj_get(lua_State *L) case mobj_blendmode: lua_pushinteger(L, mo->blendmode); break; + case mobj_alpha: + lua_pushinteger(L, mo->alpha); + break; case mobj_bnext: if (mo->blocknode && mo->blocknode->bnext) { LUA_PushUserdata(L, mo->blocknode->bnext->mobj, META_MOBJ); @@ -733,6 +738,14 @@ static int mobj_set(lua_State *L) mo->blendmode = blendmode; break; } + case mobj_alpha: + INT32 alpha = (INT32)luaL_checkinteger(L, 3); + if (alpha < 0) + alpha = 0; + else if (alpha > FRACUNIT) + alpha = FRACUNIT; + mo->alpha = alpha; + break; case mobj_bnext: return NOSETPOS; case mobj_bprev: diff --git a/src/p_mobj.c b/src/p_mobj.c index 8bc6abc54..72a4c1ddb 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10503,6 +10503,9 @@ void P_MobjThinker(mobj_t *mobj) mobj->frame &= ~FF_TRANSMASK; mobj->frame |= value << FF_TRANSSHIFT; + + // TODO: Consider replacing the above with the commented-out line of code below + //mobj->alpha = FixedDiv(mobj->fuse, mobj->info->damage); } break; default: @@ -10838,6 +10841,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...) // Sprite rendering mobj->blendmode = AST_TRANSLUCENT; + mobj->alpha = FRACUNIT; mobj->spritexscale = mobj->spriteyscale = mobj->scale; mobj->spritexoffset = mobj->spriteyoffset = 0; mobj->floorspriteslope = NULL; diff --git a/src/p_mobj.h b/src/p_mobj.h index f833415ed..401071295 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -313,6 +313,7 @@ typedef struct mobj_s UINT32 renderflags; // render flags INT32 blendmode; // blend mode + UINT32 alpha; // alpha fixed_t spritexscale, spriteyscale; fixed_t spritexoffset, spriteyoffset; fixed_t old_spritexscale, old_spriteyscale; diff --git a/src/p_saveg.c b/src/p_saveg.c index 6c6548c56..c8b812a3e 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1742,7 +1742,8 @@ typedef enum MD2_DISPOFFSET = 1<<23, MD2_DRAWONLYFORPLAYER = 1<<24, MD2_DONTDRAWFORVIEWMOBJ = 1<<25, - MD2_TRANSLATION = 1<<26 + MD2_TRANSLATION = 1<<26, + MD2_ALPHA = 1<<27 } mobj_diff2_t; typedef enum @@ -1985,6 +1986,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 |= MD2_DONTDRAWFORVIEWMOBJ; if (mobj->dispoffset != mobj->info->dispoffset) diff2 |= MD2_DISPOFFSET; + if (mobj->alpha < FRACUNIT) + diff2 |= MD2_ALPHA; if (diff2 != 0) diff |= MD_MORE; @@ -2168,6 +2171,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEINT32(save_p, mobj->dispoffset); if (diff2 & MD2_TRANSLATION) WRITEUINT16(save_p, mobj->translation); + if (diff2 & MD2_ALPHA) + WRITEUINT32(save_p, mobj->alpha); WRITEUINT32(save_p, mobj->mobjnum); } @@ -3234,6 +3239,8 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->dispoffset = mobj->info->dispoffset; if (diff2 & MD2_TRANSLATION) mobj->translation = READUINT16(save_p); + if (diff2 & MD2_ALPHA) + mobj->alpha = READUINT32(save_p); if (diff & MD_REDFLAG) { diff --git a/src/p_user.c b/src/p_user.c index 9d0eed288..2f73db272 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2065,6 +2065,7 @@ mobj_t *P_SpawnGhostMobj(mobj_t *mobj) ghost->renderflags = mobj->renderflags; ghost->blendmode = mobj->blendmode; + ghost->alpha = mobj->alpha; ghost->spritexscale = mobj->spritexscale; ghost->spriteyscale = mobj->spriteyscale; diff --git a/src/r_things.c b/src/r_things.c index 57078b4a6..a27a03e77 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -763,6 +763,14 @@ UINT8 *R_GetTranslationForThing(mobj_t *mobj, skincolornum_t color, UINT16 trans return NULL; } +transnum_t R_GetTransmapFromAlpha(UINT32 alpha, transnum_t transmap) +{ + INT32 value = 10 - transmap; + value = 10 - (FixedCeil(alpha * value)>>FRACBITS); + + return value; +} + // // R_DrawVisSprite // mfloorclip and mceilingclip should also be set. @@ -1268,6 +1276,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, floordiff = abs((isflipped ? interp.height : 0) + interp.z - groundz); trans = floordiff / (100*FRACUNIT) + 3; + trans = R_GetTransmapFromAlpha(thing->alpha, trans); if (trans >= 9) return; scalemul = FixedMul(FRACUNIT - floordiff/640, scale); @@ -1952,6 +1961,11 @@ static void R_ProjectSprite(mobj_t *thing) } else trans = 0; + + if ((oldthing->flags2 & MF2_LINKDRAW) && oldthing->tracer) + trans = R_GetTransmapFromAlpha(oldthing->tracer->alpha, trans); + else + trans = R_GetTransmapFromAlpha(oldthing->alpha, trans); // Check if this sprite needs to be rendered like a shadow shadowdraw = (!!(thing->renderflags & RF_SHADOWDRAW) && !(papersprite || splat)); @@ -3414,6 +3428,10 @@ boolean R_ThingVisible (mobj_t *thing) (thing->sprite == SPR_NULL) || // Don't draw null-sprites (thing->flags2 & MF2_DONTDRAW) || // Don't draw MF2_LINKDRAW objects (thing->drawonlyforplayer && thing->drawonlyforplayer != viewplayer) || // Don't draw other players' personal objects + //(thing->alpha == 0) || // Don't draw objects with an alpha of 0 + ((rendermode == render_soft && R_GetTransmapFromAlpha(thing->alpha, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT) >= 10) || + (rendermode == render_opengl && thing->alpha == 0)) || // TODO: Maybe rethink this + //(rendermode == render_soft && R_GetTransmapFromAlpha(thing->alpha, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT) >= 10) || (!P_MobjWasRemoved(r_viewmobj) && ( (r_viewmobj == thing) || // Don't draw first-person players or awayviewmobj objects (r_viewmobj->player && r_viewmobj->player->followmobj == thing) || // Don't draw first-person players' followmobj diff --git a/src/r_things.h b/src/r_things.h index 043b454b0..086dd8b55 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -90,6 +90,7 @@ boolean R_ThingIsFullDark (mobj_t *thing); boolean R_ThingIsFlashing (mobj_t *thing); UINT8 *R_GetTranslationForThing(mobj_t *mobj, skincolornum_t color, UINT16 translation); +transnum_t R_GetTransmapFromAlpha(UINT32 alpha, transnum_t transmap); void R_ThingOffsetOverlay (mobj_t *thing, fixed_t *outx, fixed_t *outy); From d168bbaff38dbf325e2a7311fda1ff6466473cdc Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 24 Feb 2024 16:28:02 -0500 Subject: [PATCH 027/353] compiling SRB2 with OSXCROSS --- .gitlab-ci.yml | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 016ac951b..9d870dcd7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -764,3 +764,81 @@ Alpine 3 GCC Dedicated: - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" + +osxcross x86_64: + stage: build + + when: manual + + allow_failure: true + + artifacts: + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang" + + variables: + OSXCROSS_HOST: x86_64-apple-darwin21.4 + LD: x86_64-apple-darwin21.4-ld + + script: + - - | + # apt_development + echo -e "\e[0Ksection_start:`date +%s`:macports_development[collapsed=true]\r\e[0KInstalling development packages" + - osxcross-macports install curl libopenmpt libsdl2_mixer + - | + # apt_development + echo -e "\e[0Ksection_end:`date +%s`:macports_development\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -D CPM_USE_LOCAL_PACKAGES:BOOL=ON -D OPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -D SDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -D SRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -D SRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -D SRB2_USE_LIBGME:BOOL=OFF -G "Unix Makefiles" + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=build.osxcross--keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" + +osxcross arm64: + stage: build + + when: manual + + allow_failure: true + + artifacts: + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang" + + variables: + OSXCROSS_HOST: arm64-apple-darwin21.4 + LD: arm64-apple-darwin21.4-ld + + script: + - - | + # apt_development + echo -e "\e[0Ksection_start:`date +%s`:macports_development[collapsed=true]\r\e[0KInstalling development packages" + - osxcross-macports install --arm64 curl libopenmpt libsdl2_mixer + - | + # apt_development + echo -e "\e[0Ksection_end:`date +%s`:macports_development\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -D CPM_USE_LOCAL_PACKAGES:BOOL=ON -D OPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -D SDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -D SRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -D SRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -D SRB2_USE_LIBGME:BOOL=OFF -G "Unix Makefiles" + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=build.osxcross--keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" From 4190106f2e6c0933b850ca01810fa37aa6cccada Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 24 Feb 2024 16:40:41 -0500 Subject: [PATCH 028/353] Gitlab CI: cmake create config.h, keep that as an artifact --- .gitlab-ci.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9d870dcd7..15892b24d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -533,7 +533,7 @@ Debian stable Clang: artifacts: paths: - "build.clang/bin/" - - "build.clang/src/comptime.h" + - "build.clang/src/config.h" expose_as: "clang" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang" @@ -589,7 +589,7 @@ Debian testing Clang: artifacts: paths: - "build.clang/bin/" - - "build.clang/src/comptime.h" + - "build.clang/src/config.h" expose_as: "testing-clang" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-testing-clang" @@ -773,6 +773,10 @@ osxcross x86_64: allow_failure: true artifacts: + paths: + - "build.osxcross/bin/" + - "build.osxcross/src/config.h" + expose_as: "Mac x86_64" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang" variables: @@ -799,7 +803,7 @@ osxcross x86_64: - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=build.osxcross--keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 + - make --directory=build.osxcross --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" @@ -812,6 +816,10 @@ osxcross arm64: allow_failure: true artifacts: + paths: + - "build.osxcross/bin/" + - "build.osxcross/src/config.h" + expose_as: "Mac arm64" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-clang" variables: @@ -838,7 +846,7 @@ osxcross arm64: - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=build.osxcross--keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 + - make --directory=build.osxcross --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" From 1a8311d8edecb56956f62bc3d732c8cf7d718266 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 24 Feb 2024 22:34:36 +0000 Subject: [PATCH 029/353] Update .gitlab-ci.yml file Do not fallback to Linux Makefile for Mac builds` Do not build with libgme, it needs to linked with C++ runtime library --- .gitlab-ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15892b24d..d558e50ed 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -564,7 +564,7 @@ Debian stable Clang: - - | # cmake echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" - - cmake -B build.clang -D CPM_USE_LOCAL_PACKAGES:BOOL=ON -D SRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -D SRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -G "Unix Makefiles" + - cmake -B build.clang -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_USE_LIBGME:BOOL=OFF -G "Unix Makefiles" - | # cmake echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" @@ -572,7 +572,7 @@ Debian stable Clang: - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=build.clang --keep-going || make --directory=src --keep-going + - make --directory=build.clang --keep-going || make --directory=build.clang --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" @@ -795,7 +795,7 @@ osxcross x86_64: - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KBuilding Makefiles" - - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -D CPM_USE_LOCAL_PACKAGES:BOOL=ON -D OPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -D SDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -D SRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -D SRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -D SRB2_USE_LIBGME:BOOL=OFF -G "Unix Makefiles" + - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_USE_LIBGME:BOOL=OFF -G "Unix Makefiles" - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" @@ -803,7 +803,7 @@ osxcross x86_64: - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=build.osxcross --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 + - make --directory=build.osxcross --keep-going || make --directory=build.osxcross --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" @@ -838,7 +838,7 @@ osxcross arm64: - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KBuilding Makefiles" - - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -D CPM_USE_LOCAL_PACKAGES:BOOL=ON -D OPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -D SDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -D SRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -D SRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -D SRB2_USE_LIBGME:BOOL=OFF -G "Unix Makefiles" + - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_USE_LIBGME:BOOL=OFF -G "Unix Makefiles" - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" @@ -846,7 +846,7 @@ osxcross arm64: - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=build.osxcross --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 + - make --directory=build.osxcross --keep-going || make --directory=build.osxcross --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" From 2ca791a2ad2d53926c03440afd1abb3a3b895dff Mon Sep 17 00:00:00 2001 From: Logan Aerl Arias Date: Sat, 24 Feb 2024 19:37:38 -0500 Subject: [PATCH 030/353] disable libgme by default --- CMakeLists.txt | 1 + src/CMakeLists.txt | 12 +++++++----- thirdparty/CMakeLists.txt | 4 +++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8803620e7..358e62cc4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,7 @@ cmake_dependent_option( OFF ) option(SRB2_CONFIG_HWRENDER "Enable hardware render (OpenGL) support" ON) +option(SRB2_CONFIG_USE_GME "Enable GME playback support" OFF) option(SRB2_CONFIG_STATIC_OPENGL "Enable static linking GL (do not do this)" OFF) option(SRB2_CONFIG_ERRORMODE "Compile C code with warnings treated as errors." OFF) option(SRB2_CONFIG_DEBUGMODE "Compile with PARANOIA, ZDEBUG, RANGECHECK and PACKETDROP defined." OFF) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 160174080..1bdfc94f5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -173,11 +173,13 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") target_compile_definitions(SRB2SDL2 PRIVATE -DMACOSX) endif() -target_link_libraries(SRB2SDL2 PRIVATE gme) -target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME) -if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}") - # this sucks but gme doesn't use modern cmake to delineate public headers - target_include_directories(SRB2SDL2 PRIVATE "${libgme_SOURCE_DIR}") +if("${SRB2_CONFIG_USE_GME}") + target_link_libraries(SRB2SDL2 PRIVATE gme) + target_compile_definitions(SRB2SDL2 PRIVATE -DHAVE_GME) + if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}") + # this sucks but gme doesn't use modern cmake to delineate public headers + target_include_directories(SRB2SDL2 PRIVATE "${libgme_SOURCE_DIR}") + endif() endif() target_link_libraries(SRB2SDL2 PRIVATE openmpt) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index f33b3bf3f..19aa22c9b 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -18,4 +18,6 @@ if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}") include("cpm-openmpt.cmake") endif() -include("cpm-libgme.cmake") +if("${SRB2_CONFIG_USE_GME}") + include("cpm-libgme.cmake") +endif() From eab8df9f35abe64a8423d63b355eddefda795e6e Mon Sep 17 00:00:00 2001 From: Logan Aerl Arias Date: Sun, 25 Feb 2024 00:52:40 +0000 Subject: [PATCH 031/353] auto build MacOSX binary for x86_64 --- .gitlab-ci.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d558e50ed..b21ce1b00 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -768,10 +768,6 @@ Alpine 3 GCC Dedicated: osxcross x86_64: stage: build - when: manual - - allow_failure: true - artifacts: paths: - "build.osxcross/bin/" @@ -795,7 +791,7 @@ osxcross x86_64: - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KBuilding Makefiles" - - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_USE_LIBGME:BOOL=OFF -G "Unix Makefiles" + - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_CONFIG_USE_GME:BOOL=OFF -G "Unix Makefiles" - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" @@ -838,7 +834,7 @@ osxcross arm64: - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KBuilding Makefiles" - - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_USE_LIBGME:BOOL=OFF -G "Unix Makefiles" + - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_CONFIG_USE_GME:BOOL=OFF -G "Unix Makefiles" - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" From 17e7aea311df6fead55921fa0ddacc72ca8eaf8a Mon Sep 17 00:00:00 2001 From: MIDIMan Date: Wed, 28 Feb 2024 14:41:17 -0500 Subject: [PATCH 032/353] Fix clang build error (hopefully) --- src/lua_mobjlib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 79d839677..451ae6081 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -739,6 +739,7 @@ static int mobj_set(lua_State *L) break; } case mobj_alpha: + { INT32 alpha = (INT32)luaL_checkinteger(L, 3); if (alpha < 0) alpha = 0; @@ -746,6 +747,7 @@ static int mobj_set(lua_State *L) alpha = FRACUNIT; mo->alpha = alpha; break; + } case mobj_bnext: return NOSETPOS; case mobj_bprev: From d18a4cca1ebb6ada21cd691e7b9bffae016c8e52 Mon Sep 17 00:00:00 2001 From: MIDIMan Date: Fri, 1 Mar 2024 13:09:25 -0500 Subject: [PATCH 033/353] Clean up comments --- src/p_mobj.c | 4 +--- src/r_things.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index df08cb9be..15da6e616 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10493,6 +10493,7 @@ void P_MobjThinker(mobj_t *mobj) case MT_GRENADEPICKUP: if (mobj->health == 0) // Fading tile { + // TODO: Maybe use mobj->alpha instead of messing with frame flags INT32 value = mobj->info->damage/10; value = mobj->fuse/value; value = 10-value; @@ -10503,9 +10504,6 @@ void P_MobjThinker(mobj_t *mobj) mobj->frame &= ~FF_TRANSMASK; mobj->frame |= value << FF_TRANSSHIFT; - - // TODO: Consider replacing the above with the commented-out line of code below - //mobj->alpha = FixedDiv(mobj->fuse, mobj->info->damage); } break; default: diff --git a/src/r_things.c b/src/r_things.c index a27a03e77..defdc7aaa 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -3428,10 +3428,8 @@ boolean R_ThingVisible (mobj_t *thing) (thing->sprite == SPR_NULL) || // Don't draw null-sprites (thing->flags2 & MF2_DONTDRAW) || // Don't draw MF2_LINKDRAW objects (thing->drawonlyforplayer && thing->drawonlyforplayer != viewplayer) || // Don't draw other players' personal objects - //(thing->alpha == 0) || // Don't draw objects with an alpha of 0 ((rendermode == render_soft && R_GetTransmapFromAlpha(thing->alpha, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT) >= 10) || - (rendermode == render_opengl && thing->alpha == 0)) || // TODO: Maybe rethink this - //(rendermode == render_soft && R_GetTransmapFromAlpha(thing->alpha, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT) >= 10) || + (rendermode == render_opengl && thing->alpha == 0)) || (!P_MobjWasRemoved(r_viewmobj) && ( (r_viewmobj == thing) || // Don't draw first-person players or awayviewmobj objects (r_viewmobj->player && r_viewmobj->player->followmobj == thing) || // Don't draw first-person players' followmobj From a76544a3765d2bd9e69b420d60ff171bf76ac87b Mon Sep 17 00:00:00 2001 From: MIDIMan Date: Fri, 1 Mar 2024 16:29:39 -0500 Subject: [PATCH 034/353] Make alpha use fixed_t and add alpha field to precipmobj_t --- src/lua_mobjlib.c | 4 ++-- src/p_mobj.h | 3 ++- src/p_saveg.c | 6 +++--- src/r_things.c | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index 451ae6081..9a858c4b6 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -357,7 +357,7 @@ static int mobj_get(lua_State *L) lua_pushinteger(L, mo->blendmode); break; case mobj_alpha: - lua_pushinteger(L, mo->alpha); + lua_pushfixed(L, mo->alpha); break; case mobj_bnext: if (mo->blocknode && mo->blocknode->bnext) { @@ -740,7 +740,7 @@ static int mobj_set(lua_State *L) } case mobj_alpha: { - INT32 alpha = (INT32)luaL_checkinteger(L, 3); + fixed_t alpha = luaL_checkfixed(L, 3); if (alpha < 0) alpha = 0; else if (alpha > FRACUNIT) diff --git a/src/p_mobj.h b/src/p_mobj.h index 401071295..545f0847f 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -313,7 +313,7 @@ typedef struct mobj_s UINT32 renderflags; // render flags INT32 blendmode; // blend mode - UINT32 alpha; // alpha + fixed_t alpha; // alpha fixed_t spritexscale, spriteyscale; fixed_t spritexoffset, spriteyoffset; fixed_t old_spritexscale, old_spriteyscale; @@ -457,6 +457,7 @@ typedef struct precipmobj_s UINT32 renderflags; // render flags INT32 blendmode; // blend mode + fixed_t alpha; // alpha fixed_t spritexscale, spriteyscale; fixed_t spritexoffset, spriteyoffset; fixed_t old_spritexscale, old_spriteyscale; diff --git a/src/p_saveg.c b/src/p_saveg.c index 05cda779a..47f0b8297 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1745,7 +1745,7 @@ typedef enum MD2_DRAWONLYFORPLAYER = 1<<24, MD2_DONTDRAWFORVIEWMOBJ = 1<<25, MD2_TRANSLATION = 1<<26, - MD2_ALPHA = 1<<27 + MD2_ALPHA = 1<<27 } mobj_diff2_t; typedef enum @@ -2174,7 +2174,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) if (diff2 & MD2_TRANSLATION) WRITEUINT16(save_p, mobj->translation); if (diff2 & MD2_ALPHA) - WRITEUINT32(save_p, mobj->alpha); + WRITEFIXED(save_p, mobj->alpha); WRITEUINT32(save_p, mobj->mobjnum); } @@ -3242,7 +3242,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) if (diff2 & MD2_TRANSLATION) mobj->translation = READUINT16(save_p); if (diff2 & MD2_ALPHA) - mobj->alpha = READUINT32(save_p); + mobj->alpha = READFIXED(save_p); if (diff & MD_REDFLAG) { diff --git a/src/r_things.c b/src/r_things.c index defdc7aaa..843bf36ee 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1276,7 +1276,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, floordiff = abs((isflipped ? interp.height : 0) + interp.z - groundz); trans = floordiff / (100*FRACUNIT) + 3; - trans = R_GetTransmapFromAlpha(thing->alpha, trans); + trans = R_GetTransmapFromAlpha((UINT32)thing->alpha, trans); if (trans >= 9) return; scalemul = FixedMul(FRACUNIT - floordiff/640, scale); @@ -1963,9 +1963,9 @@ static void R_ProjectSprite(mobj_t *thing) trans = 0; if ((oldthing->flags2 & MF2_LINKDRAW) && oldthing->tracer) - trans = R_GetTransmapFromAlpha(oldthing->tracer->alpha, trans); + trans = R_GetTransmapFromAlpha((UINT32)oldthing->tracer->alpha, trans); else - trans = R_GetTransmapFromAlpha(oldthing->alpha, trans); + trans = R_GetTransmapFromAlpha((UINT32)oldthing->alpha, trans); // Check if this sprite needs to be rendered like a shadow shadowdraw = (!!(thing->renderflags & RF_SHADOWDRAW) && !(papersprite || splat)); @@ -3428,7 +3428,7 @@ boolean R_ThingVisible (mobj_t *thing) (thing->sprite == SPR_NULL) || // Don't draw null-sprites (thing->flags2 & MF2_DONTDRAW) || // Don't draw MF2_LINKDRAW objects (thing->drawonlyforplayer && thing->drawonlyforplayer != viewplayer) || // Don't draw other players' personal objects - ((rendermode == render_soft && R_GetTransmapFromAlpha(thing->alpha, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT) >= 10) || + ((rendermode == render_soft && R_GetTransmapFromAlpha((UINT32)thing->alpha, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT) >= 10) || (rendermode == render_opengl && thing->alpha == 0)) || (!P_MobjWasRemoved(r_viewmobj) && ( (r_viewmobj == thing) || // Don't draw first-person players or awayviewmobj objects From 509adc345409f321f54f5302aed007f19ccede86 Mon Sep 17 00:00:00 2001 From: MIDIMan Date: Sat, 2 Mar 2024 09:51:28 -0500 Subject: [PATCH 035/353] Change all remaining instances (hopefully) of UINT32 to fixed_t for alpha --- src/hardware/hw_main.c | 4 ++-- src/r_things.c | 10 +++++----- src/r_things.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 40f17301b..b58d58111 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3000,7 +3000,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) // co-ordinates memcpy(wallVerts, baseWallVerts, sizeof(baseWallVerts)); - UINT32 newalpha = spr->mobj->alpha; + fixed_t newalpha = spr->mobj->alpha; // if sprite has linkdraw, then dont write to z-buffer (by not using PF_Occlude) // this will result in sprites drawn afterwards to be drawn on top like intended when using linkdraw. @@ -3495,7 +3495,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) FBITFIELD blend = 0; FBITFIELD occlusion; boolean use_linkdraw_hack = false; - UINT32 newalpha = spr->mobj->alpha; + fixed_t newalpha = spr->mobj->alpha; // if sprite has linkdraw, then dont write to z-buffer (by not using PF_Occlude) // this will result in sprites drawn afterwards to be drawn on top like intended when using linkdraw. diff --git a/src/r_things.c b/src/r_things.c index 843bf36ee..cede03b80 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -763,7 +763,7 @@ UINT8 *R_GetTranslationForThing(mobj_t *mobj, skincolornum_t color, UINT16 trans return NULL; } -transnum_t R_GetTransmapFromAlpha(UINT32 alpha, transnum_t transmap) +transnum_t R_GetTransmapFromAlpha(fixed_t alpha, transnum_t transmap) { INT32 value = 10 - transmap; value = 10 - (FixedCeil(alpha * value)>>FRACBITS); @@ -1276,7 +1276,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, floordiff = abs((isflipped ? interp.height : 0) + interp.z - groundz); trans = floordiff / (100*FRACUNIT) + 3; - trans = R_GetTransmapFromAlpha((UINT32)thing->alpha, trans); + trans = R_GetTransmapFromAlpha(thing->alpha, trans); if (trans >= 9) return; scalemul = FixedMul(FRACUNIT - floordiff/640, scale); @@ -1963,9 +1963,9 @@ static void R_ProjectSprite(mobj_t *thing) trans = 0; if ((oldthing->flags2 & MF2_LINKDRAW) && oldthing->tracer) - trans = R_GetTransmapFromAlpha((UINT32)oldthing->tracer->alpha, trans); + trans = R_GetTransmapFromAlpha(oldthing->tracer->alpha, trans); else - trans = R_GetTransmapFromAlpha((UINT32)oldthing->alpha, trans); + trans = R_GetTransmapFromAlpha(oldthing->alpha, trans); // Check if this sprite needs to be rendered like a shadow shadowdraw = (!!(thing->renderflags & RF_SHADOWDRAW) && !(papersprite || splat)); @@ -3428,7 +3428,7 @@ boolean R_ThingVisible (mobj_t *thing) (thing->sprite == SPR_NULL) || // Don't draw null-sprites (thing->flags2 & MF2_DONTDRAW) || // Don't draw MF2_LINKDRAW objects (thing->drawonlyforplayer && thing->drawonlyforplayer != viewplayer) || // Don't draw other players' personal objects - ((rendermode == render_soft && R_GetTransmapFromAlpha((UINT32)thing->alpha, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT) >= 10) || + ((rendermode == render_soft && R_GetTransmapFromAlpha(thing->alpha, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT) >= 10) || (rendermode == render_opengl && thing->alpha == 0)) || (!P_MobjWasRemoved(r_viewmobj) && ( (r_viewmobj == thing) || // Don't draw first-person players or awayviewmobj objects diff --git a/src/r_things.h b/src/r_things.h index 086dd8b55..268e5562b 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -90,7 +90,7 @@ boolean R_ThingIsFullDark (mobj_t *thing); boolean R_ThingIsFlashing (mobj_t *thing); UINT8 *R_GetTranslationForThing(mobj_t *mobj, skincolornum_t color, UINT16 translation); -transnum_t R_GetTransmapFromAlpha(UINT32 alpha, transnum_t transmap); +transnum_t R_GetTransmapFromAlpha(fixed_t alpha, transnum_t transmap); void R_ThingOffsetOverlay (mobj_t *thing, fixed_t *outx, fixed_t *outy); From 02811b72f62e51a80a20c5816d2936e417cc7656 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Tue, 23 Jan 2024 22:43:25 +0100 Subject: [PATCH 036/353] Fix segfault when trying to spawn an MT_PLAYER from Lua --- src/lua_baselib.c | 4 ++-- src/p_local.h | 2 +- src/p_mobj.c | 18 ++++++++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index e75a911ee..d6f125bbd 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -641,7 +641,7 @@ static int lib_pSpawnMobj(lua_State *L) NOHUD INLEVEL NOSPAWNNULL - LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type), META_MOBJ); + LUA_PushUserdata(L, P_SpawnMobj(x, y, z, type, NULL), META_MOBJ); return 1; } @@ -657,7 +657,7 @@ static int lib_pSpawnMobjFromMobj(lua_State *L) NOSPAWNNULL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); - LUA_PushUserdata(L, P_SpawnMobjFromMobj(actor, x, y, z, type), META_MOBJ); + LUA_PushUserdata(L, P_SpawnMobjFromMobj(actor, x, y, z, type, NULL), META_MOBJ); return 1; } diff --git a/src/p_local.h b/src/p_local.h index 0bcd6da1d..7e4741ffd 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -328,7 +328,7 @@ boolean P_CheckDeathPitCollide(mobj_t *mo); boolean P_CheckSolidLava(ffloor_t *rover); void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motype); -mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type); +mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type, ...); mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type); mobj_t *P_SpawnXYZMissile(mobj_t *source, mobj_t *dest, mobjtype_t type, fixed_t x, fixed_t y, fixed_t z); diff --git a/src/p_mobj.c b/src/p_mobj.c index 55be8e54f..c6f437c9a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -14420,15 +14420,29 @@ void P_FlashPal(player_t *pl, UINT16 type, UINT16 duration) // Spawns an object with offsets relative to the position of another object. // Scale, gravity flip, etc. is taken into account automatically. // -mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type) +mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type, ...) { + va_list args; mobj_t *newmobj; xofs = FixedMul(xofs, mobj->scale); yofs = FixedMul(yofs, mobj->scale); zofs = FixedMul(zofs, mobj->scale); - newmobj = P_SpawnMobj(mobj->x + xofs, mobj->y + yofs, mobj->z + zofs, type); + if (type == MT_PLAYER) + { + player_t *player; + // MT_PLAYER requires an additional parameter for the player, so pass that forth. + va_start(args, type); + player = va_arg(args, player_t *); + va_end(args); + newmobj = P_SpawnMobj(mobj->x + xofs, mobj->y + yofs, mobj->z + zofs, type, player); + } + else + { + newmobj = P_SpawnMobj(mobj->x + xofs, mobj->y + yofs, mobj->z + zofs, type); + } + if (!newmobj) return NULL; From 259997d121c0bc32cbcc062fc52507f381a21668 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Wed, 24 Jan 2024 17:11:04 +0100 Subject: [PATCH 037/353] Remove varargs from P_SpawnMobjFromMobj --- src/lua_baselib.c | 2 +- src/p_local.h | 2 +- src/p_mobj.c | 16 ++-------------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index d6f125bbd..47ee3976d 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -657,7 +657,7 @@ static int lib_pSpawnMobjFromMobj(lua_State *L) NOSPAWNNULL if (!actor) return LUA_ErrInvalid(L, "mobj_t"); - LUA_PushUserdata(L, P_SpawnMobjFromMobj(actor, x, y, z, type, NULL), META_MOBJ); + LUA_PushUserdata(L, P_SpawnMobjFromMobj(actor, x, y, z, type), META_MOBJ); return 1; } diff --git a/src/p_local.h b/src/p_local.h index 7e4741ffd..0bcd6da1d 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -328,7 +328,7 @@ boolean P_CheckDeathPitCollide(mobj_t *mo); boolean P_CheckSolidLava(ffloor_t *rover); void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motype); -mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type, ...); +mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type); mobj_t *P_SpawnMissile(mobj_t *source, mobj_t *dest, mobjtype_t type); mobj_t *P_SpawnXYZMissile(mobj_t *source, mobj_t *dest, mobjtype_t type, fixed_t x, fixed_t y, fixed_t z); diff --git a/src/p_mobj.c b/src/p_mobj.c index c6f437c9a..3999c9476 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -14420,7 +14420,7 @@ void P_FlashPal(player_t *pl, UINT16 type, UINT16 duration) // Spawns an object with offsets relative to the position of another object. // Scale, gravity flip, etc. is taken into account automatically. // -mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type, ...) +mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type) { va_list args; mobj_t *newmobj; @@ -14429,19 +14429,7 @@ mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zo yofs = FixedMul(yofs, mobj->scale); zofs = FixedMul(zofs, mobj->scale); - if (type == MT_PLAYER) - { - player_t *player; - // MT_PLAYER requires an additional parameter for the player, so pass that forth. - va_start(args, type); - player = va_arg(args, player_t *); - va_end(args); - newmobj = P_SpawnMobj(mobj->x + xofs, mobj->y + yofs, mobj->z + zofs, type, player); - } - else - { - newmobj = P_SpawnMobj(mobj->x + xofs, mobj->y + yofs, mobj->z + zofs, type); - } + newmobj = P_SpawnMobj(mobj->x + xofs, mobj->y + yofs, mobj->z + zofs, type, NULL); if (!newmobj) return NULL; From b3aa23bc214e3aee7accca87d820c7943f012c13 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Wed, 24 Jan 2024 16:13:34 +0000 Subject: [PATCH 038/353] Remove unused variable --- src/p_mobj.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 3999c9476..4bed833fb 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -14422,7 +14422,6 @@ void P_FlashPal(player_t *pl, UINT16 type, UINT16 duration) // mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type) { - va_list args; mobj_t *newmobj; xofs = FixedMul(xofs, mobj->scale); From 51e912e87be2dac061565bddeb1b0e56e867d71b Mon Sep 17 00:00:00 2001 From: Hanicef Date: Tue, 5 Mar 2024 18:29:07 +0100 Subject: [PATCH 039/353] Fix segfault when passing NULL as player --- src/p_mobj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 4bed833fb..84884eef3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10886,7 +10886,8 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...) // when spawning MT_PLAYER, set mobj->player before calling MobjSpawn hook to prevent P_RemoveMobj from succeeding on player mobj. va_start(args, type); mobj->player = va_arg(args, player_t *); - mobj->player->mo = mobj; + if (mobj->player) + mobj->player->mo = mobj; va_end(args); } From 7e3f6a28030bc62c4d464128a08de4eb21fbfbf0 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 25 Feb 2024 19:05:16 +0100 Subject: [PATCH 040/353] Add variable to move idle players to spectators --- src/netcode/d_clisrv.c | 17 ++++++++++++++++- src/netcode/d_clisrv.h | 2 +- src/netcode/d_netcmd.c | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/netcode/d_clisrv.c b/src/netcode/d_clisrv.c index 2bf9d2dde..06c274f58 100644 --- a/src/netcode/d_clisrv.c +++ b/src/netcode/d_clisrv.c @@ -114,6 +114,7 @@ static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, consvar_t cv_playbackspeed = CVAR_INIT ("playbackspeed", "1", 0, playbackspeed_cons_t, NULL); consvar_t cv_idletime = CVAR_INIT ("idletime", "0", CV_SAVE, CV_Unsigned, NULL); +consvar_t cv_idlespectate = CVAR_INIT ("idlespectate", "On", CV_SAVE, CV_OnOff, NULL); consvar_t cv_dedicatedidletime = CVAR_INIT ("dedicatedidletime", "10", CV_SAVE, CV_Unsigned, NULL); consvar_t cv_httpsource = CVAR_INIT ("http_source", "", CV_SAVE, NULL, NULL); @@ -1372,7 +1373,21 @@ static void IdleUpdate(void) if (players[i].lastinputtime > (tic_t)cv_idletime.value * TICRATE * 60) { players[i].lastinputtime = 0; - SendKick(i, KICK_MSG_IDLE | KICK_MSG_KEEP_BODY); + if (cv_idlespectate.value && G_GametypeHasSpectators()) + { + changeteam_union NetPacket; + UINT16 usvalue; + NetPacket.value.l = NetPacket.value.b = 0; + NetPacket.packet.newteam = 0; + NetPacket.packet.playernum = i; + NetPacket.packet.verification = true; // This signals that it's a server change + usvalue = SHORT(NetPacket.value.l|NetPacket.value.b); + SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue)); + } + else + { + SendKick(i, KICK_MSG_IDLE | KICK_MSG_KEEP_BODY); + } } } else diff --git a/src/netcode/d_clisrv.h b/src/netcode/d_clisrv.h index 5aac4693d..342173dff 100644 --- a/src/netcode/d_clisrv.h +++ b/src/netcode/d_clisrv.h @@ -73,7 +73,7 @@ extern UINT32 realpingtable[MAXPLAYERS]; extern UINT32 playerpingtable[MAXPLAYERS]; extern tic_t servermaxping; -extern consvar_t cv_netticbuffer, cv_resynchattempts, cv_blamecfail, cv_playbackspeed, cv_idletime, cv_dedicatedidletime; +extern consvar_t cv_netticbuffer, cv_resynchattempts, cv_blamecfail, cv_playbackspeed, cv_idletime, cv_idlespectate, cv_dedicatedidletime; extern consvar_t cv_httpsource; // Used in d_net, the only dependence diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index e073a863c..70a75714f 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -620,6 +620,7 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_blamecfail); CV_RegisterVar(&cv_dedicatedidletime); CV_RegisterVar(&cv_idletime); + CV_RegisterVar(&cv_idlespectate); CV_RegisterVar(&cv_httpsource); COM_AddCommand("ping", Command_Ping_f, COM_LUA); From 7d3c0ca3018edcdee2614e91173f8410413c5a08 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 25 Feb 2024 19:16:12 +0100 Subject: [PATCH 041/353] Fix finished players getting kicked for idling --- src/netcode/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/netcode/d_clisrv.c b/src/netcode/d_clisrv.c index 06c274f58..d46e75c3f 100644 --- a/src/netcode/d_clisrv.c +++ b/src/netcode/d_clisrv.c @@ -1363,7 +1363,7 @@ static void IdleUpdate(void) for (i = 1; i < MAXPLAYERS; i++) { - if (cv_idletime.value && playeringame[i] && playernode[i] != UINT8_MAX && !players[i].quittime && !players[i].spectator && !players[i].bot && !IsPlayerAdmin(i) && i != serverplayer && gamestate == GS_LEVEL) + if (cv_idletime.value && playeringame[i] && playernode[i] != UINT8_MAX && !players[i].quittime && !players[i].spectator && !players[i].bot && !IsPlayerAdmin(i) && i != serverplayer && gamestate == GS_LEVEL && !(players[i].pflags & PF_FINISHED)) { if (players[i].cmd.forwardmove || players[i].cmd.sidemove || players[i].cmd.buttons) players[i].lastinputtime = 0; From 8dce0e1a3f58c5f5d77cd227bc6f92ebfded5f0c Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 12 Mar 2024 17:29:08 +0100 Subject: [PATCH 042/353] Prevent white flash upon starting the game (in Software) --- src/d_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/d_main.c b/src/d_main.c index 46e64267e..41c8e6336 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -749,6 +749,8 @@ void D_SRB2Loop(void) // hack to start on a nice clear console screen. COM_ImmedExecute("cls;version"); + // hack to prevent white flash upon initial window resize + V_DrawFill(0,0,BASEVIDWIDTH,BASEVIDHEIGHT,31); I_FinishUpdate(); // page flip or blit buffer /* From 34cf7c1a018cd8fbf73c0686513c9f3a89c41b8c Mon Sep 17 00:00:00 2001 From: SSNTails Date: Wed, 13 Mar 2024 18:08:07 -0400 Subject: [PATCH 043/353] I don't think flipping the flag here is even needed... --- src/p_mobj.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index cdd71ccc4..27282fe52 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1529,10 +1529,7 @@ fixed_t P_GetMobjGravity(mobj_t *mo) case MT_ROLLOUTROCK: // If a player has gravity boots and its riding a rollout rock, the rock should copy the player's gravity if (mo->tracer && mo->tracer->player && mo->tracer->player->powers[pw_gravityboots]) - { gravityadd = -gravityadd; - mo->eflags ^= MFE_VERTICALFLIP; - } break; default: break; From cfc23648f5e66f300e652f75ecceeb3b32e8acd6 Mon Sep 17 00:00:00 2001 From: BarrelsOFun <161785144+BarrelsOFun@users.noreply.github.com> Date: Wed, 13 Mar 2024 19:58:24 -0700 Subject: [PATCH 044/353] Transform FlingRing instead of spawning new Ring --- src/p_enemy.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 4990db6fd..f9e643eb2 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -4865,7 +4865,7 @@ void A_AttractChase(mobj_t *actor) else actor->flags2 &= ~MF2_DONTDRAW; - // Turn flingrings back into regular rings if attracted. + // Turn rings into flingrings if shield is lost or out of range if (actor->tracer && actor->tracer->player && !(actor->tracer->player->powers[pw_shield] & SH_PROTECTELECTRIC) && actor->info->reactiontime && actor->type != (mobjtype_t)actor->info->reactiontime) { @@ -4897,8 +4897,9 @@ void A_AttractChase(mobj_t *actor) // If a FlingRing gets attracted by a shield, change it into a normal ring. if (actor->type == (mobjtype_t)actor->info->reactiontime) { - P_SpawnMobj(actor->x, actor->y, actor->z, actor->info->painchance); - P_RemoveMobj(actor); + actor->type = mobjinfo[actor->type].painchance; // Become the regular version of the fling object. + actor->flags = mobjinfo[actor->type].flags; // Reset actor flags. + P_SetMobjState(actor, actor->info->spawnstate); // Go to regular object's spawn state. return; } From e44c751187345b5fdd7b331acf211f115839227b Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Thu, 14 Mar 2024 04:13:09 -0300 Subject: [PATCH 045/353] Fix #1215 --- src/r_segs.c | 80 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 16 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index e07ced86a..d68db60de 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -442,26 +442,75 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) } // Loop through R_DrawMaskedColumn calls +static fixed_t repeatscroll = 0; + static void R_DrawRepeatMaskedColumn(column_t *col, unsigned lengthcol) { - while (sprtopscreen < sprbotscreen) { - R_DrawMaskedColumn(col, lengthcol); - if ((INT64)sprtopscreen + (INT64)dc_texheight*spryscale > (INT64)INT32_MAX) // prevent overflow - sprtopscreen = INT32_MAX; - else - sprtopscreen += dc_texheight*spryscale; + fixed_t topscreen = sprtopscreen; + fixed_t bottomscreen = sprbotscreen; + + fixed_t texheight = dc_texheight*spryscale; + + fixed_t scroll = -repeatscroll; + if (scroll < 0) + { + scroll = -FixedMul((abs(scroll) % (dc_texheight*FRACUNIT)), spryscale); + bottomscreen += texheight; // Draw an extra time } + else if (scroll) + { + scroll = FixedMul(scroll % (dc_texheight*FRACUNIT), spryscale); + topscreen -= texheight; // Draw an extra time + } + + while (topscreen < bottomscreen) + { + sprtopscreen = topscreen + scroll; + + R_DrawMaskedColumn(col, lengthcol); + + if ((INT64)topscreen + (INT64)texheight > (INT64)INT32_MAX) // prevent overflow + break; + + topscreen += texheight; + } + + sprtopscreen = sprbotscreen; } static void R_DrawRepeatFlippedMaskedColumn(column_t *col, unsigned lengthcol) { - while (sprtopscreen < sprbotscreen) { - R_DrawFlippedMaskedColumn(col, lengthcol); - if ((INT64)sprtopscreen + (INT64)dc_texheight*spryscale > (INT64)INT32_MAX) // prevent overflow - sprtopscreen = INT32_MAX; - else - sprtopscreen += dc_texheight*spryscale; + fixed_t topscreen = sprtopscreen; + fixed_t bottomscreen = sprbotscreen; + + fixed_t texheight = dc_texheight*spryscale; + + fixed_t scroll = -repeatscroll; + if (scroll < 0) + { + scroll = -FixedMul((abs(scroll) % (dc_texheight*FRACUNIT)), spryscale); + bottomscreen += texheight; // Draw an extra time } + else if (scroll) + { + scroll = FixedMul(scroll % (dc_texheight*FRACUNIT), spryscale); + topscreen -= texheight; // Draw an extra time + } + + while (topscreen < bottomscreen) + { + sprtopscreen = topscreen + scroll; + sprbotscreen = bottomscreen + scroll; + + R_DrawFlippedMaskedColumn(col, lengthcol); + + if ((INT64)topscreen + (INT64)texheight > (INT64)INT32_MAX) // prevent overflow + break; + + topscreen += texheight; + } + + sprtopscreen = sprbotscreen; } // Returns true if a fake floor is translucent. @@ -497,7 +546,6 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) sector_t tempsec; INT32 templight; INT32 i, p; - fixed_t offsetvalue; lightlist_t *light; r_lightlist_t *rlight; INT32 range; @@ -734,7 +782,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) else dc_texturemid = FixedMul(*pfloor->topheight - viewz, wall_scaley); - offsetvalue = sidedef->rowoffset + sidedef->offsety_mid; + repeatscroll = sidedef->rowoffset + sidedef->offsety_mid; if (dont_peg_bottom) { @@ -744,7 +792,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) dc_texturemid = FixedMul(left_bottom, wall_scaley); } else - offsetvalue -= FixedMul(*pfloor->topheight - *pfloor->bottomheight, wall_scaley); + repeatscroll -= FixedMul(*pfloor->topheight - *pfloor->bottomheight, wall_scaley); } if (skewslope) @@ -753,7 +801,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) ffloortextureslide = FixedMul(R_GetSlopeTextureSlide(skewslope, lineangle), wall_scaley); } - dc_texturemid += offsetvalue; + dc_texturemid += repeatscroll; // Texture must be cached R_CheckTextureCache(texnum); From a58d9036bc48736d40c69fe9401747dbf083c90d Mon Sep 17 00:00:00 2001 From: SSNTails Date: Fri, 15 Mar 2024 14:28:44 -0400 Subject: [PATCH 046/353] Restore MF2_OBJECTFLIP/MFE_VERTICALFLIP on rollout rock disconnect --- src/p_map.c | 4 ++++ src/p_user.c | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index b84fc7e27..088d55208 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1057,6 +1057,10 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) P_SetTarget(&tmthing->tracer, thing); if (!P_IsObjectOnGround(thing)) thing->momz += tmthing->momz; + + thing->extravalue1 = thing->flags2; + thing->extravalue2 = thing->eflags; + return CHECKTHING_COLLIDE; } } diff --git a/src/p_user.c b/src/p_user.c index 9de234273..417154b19 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1089,6 +1089,17 @@ void P_ResetPlayer(player_t *player) else player->mo->tracer->momz += 1; + // Restore MF2_OBJECTFLIP / MFE_VERTICALFLIP + if (player->mo->tracer->extravalue1 & MF2_OBJECTFLIP) + player->mo->tracer->flags2 |= MF2_OBJECTFLIP; + else + player->mo->tracer->flags2 &= ~MF2_OBJECTFLIP; + + if (player->mo->tracer->extravalue2 & MFE_VERTICALFLIP) + player->mo->tracer->eflags |= MFE_VERTICALFLIP; + else + player->mo->tracer->eflags &= ~MFE_VERTICALFLIP; + P_SetTarget(&player->mo->tracer->tracer, NULL); } P_SetTarget(&player->mo->tracer, NULL); @@ -4574,6 +4585,17 @@ void P_DoJump(player_t *player, boolean soundandstate, boolean allowflip) else player->mo->tracer->momz += 1; + // Restore MF2_OBJECTFLIP / MFE_VERTICALFLIP + if (player->mo->tracer->extravalue1 & MF2_OBJECTFLIP) + player->mo->tracer->flags2 |= MF2_OBJECTFLIP; + else + player->mo->tracer->flags2 &= ~MF2_OBJECTFLIP; + + if (player->mo->tracer->extravalue2 & MFE_VERTICALFLIP) + player->mo->tracer->eflags |= MFE_VERTICALFLIP; + else + player->mo->tracer->eflags &= ~MFE_VERTICALFLIP; + player->mo->tracer->flags |= MF_PUSHABLE; P_SetTarget(&player->mo->tracer->tracer, NULL); } From 01b017019b42dead468fe62ffed5c55cc8c8be3c Mon Sep 17 00:00:00 2001 From: Hanicef Date: Fri, 15 Mar 2024 21:35:28 +0100 Subject: [PATCH 047/353] Fix spectator list not compensating for non-green resolutions --- src/hu_stuff.c | 43 +++++-------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 4e2f3d492..632c06585 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2458,53 +2458,20 @@ static inline void HU_DrawSpectatorTicker(void) { int i; int length = 0, height = 174; - int totallength = 0, templength = 0; + int totallength = 0; for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && players[i].spectator) totallength += (signed)strlen(player_names[i]) * 8 + 16; - length -= (leveltime % (totallength + BASEVIDWIDTH)); - length += BASEVIDWIDTH; + length -= (leveltime % (totallength + (vid.width / vid.dup))); + length += (vid.width / vid.dup); for (i = 0; i < MAXPLAYERS; i++) if (playeringame[i] && players[i].spectator) { - char *pos; - char initial[MAXPLAYERNAME+1]; - char current[MAXPLAYERNAME+1]; - - strcpy(initial, player_names[i]); - pos = initial; - - if (length >= -((signed)strlen(player_names[i]) * 8 + 16) && length <= BASEVIDWIDTH) - { - if (length < 0) - { - UINT8 eatenchars = (UINT8)(abs(length) / 8 + 1); - - if (eatenchars <= strlen(initial)) - { - // Eat one letter off the left side, - // then compensate the drawing position. - pos += eatenchars; - strcpy(current, pos); - templength = length % 8 + 8; - } - else - { - strcpy(current, " "); - templength = length; - } - } - else - { - strcpy(current, initial); - templength = length; - } - - V_DrawString(templength, height + 8, V_TRANSLUCENT|V_ALLOWLOWERCASE, current); - } + if (length >= -((signed)strlen(player_names[i]) * 8 + 16) && length <= (vid.width / vid.dup)) + V_DrawString(length, height + 8, V_TRANSLUCENT|V_ALLOWLOWERCASE|V_SNAPTOLEFT, player_names[i]); length += (signed)strlen(player_names[i]) * 8 + 16; } From 2181dadb4cead6b3dbb8f63ada6446ee72202d90 Mon Sep 17 00:00:00 2001 From: SSNTails Date: Fri, 15 Mar 2024 16:39:37 -0400 Subject: [PATCH 048/353] Checking MFE_VERTICALFLIP matching is actually redundant.. --- src/p_map.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 088d55208..57883b448 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1043,7 +1043,6 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) if ((thing->flags & MF_PUSHABLE) // not carrying a player && (tmthing->player->powers[pw_carry] == CR_NONE) // player is not already riding something && !(tmthing->player->powers[pw_ignorelatch] & (1<<15)) - && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP) || tmthing->player->powers[pw_gravityboots]) && (P_MobjFlip(tmthing)*tmthing->momz <= 0) && ((!(tmthing->eflags & MFE_VERTICALFLIP) && abs(thing->z + thing->height - tmthing->z) < (thing->height>>2)) || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) From b4ad0544225bef1c5b872af3e1b76991fd4d2a8b Mon Sep 17 00:00:00 2001 From: SSNTails Date: Sat, 16 Mar 2024 10:28:49 -0400 Subject: [PATCH 049/353] Zwip Zwap Zapony's suggestions --- src/p_enemy.c | 10 ++++++++-- src/p_map.c | 3 --- src/p_mobj.c | 5 ----- src/p_user.c | 26 ++------------------------ 4 files changed, 10 insertions(+), 34 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index a386d8ee9..6a52b6402 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -14799,12 +14799,18 @@ void A_RolloutRock(mobj_t *actor) if (!actor->tracer || P_MobjWasRemoved(actor->tracer) || !actor->tracer->health) actor->flags |= MF_PUSHABLE; + else if (actor->tracer->eflags & MFE_VERTICALFLIP) + { + actor->flags2 |= MF2_OBJECTFLIP; + actor->eflags |= MFE_VERTICALFLIP; + } else { - actor->flags2 = (actor->flags2 & ~MF2_OBJECTFLIP) | (actor->tracer->flags2 & MF2_OBJECTFLIP); - actor->eflags = (actor->eflags & ~MFE_VERTICALFLIP) | (actor->tracer->eflags & MFE_VERTICALFLIP); + actor->flags2 &= ~MF2_OBJECTFLIP; + actor->eflags &= ~MFE_VERTICALFLIP; } + actor->friction = FRACUNIT; // turns out riding on solids sucks, so let's just make it easier on ourselves if (actor->eflags & MFE_JUSTHITFLOOR) diff --git a/src/p_map.c b/src/p_map.c index 57883b448..aa8ef17ec 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1057,9 +1057,6 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) if (!P_IsObjectOnGround(thing)) thing->momz += tmthing->momz; - thing->extravalue1 = thing->flags2; - thing->extravalue2 = thing->eflags; - return CHECKTHING_COLLIDE; } } diff --git a/src/p_mobj.c b/src/p_mobj.c index 27282fe52..4c08c81da 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1526,11 +1526,6 @@ fixed_t P_GetMobjGravity(mobj_t *mo) case MT_CYBRAKDEMON: gravityadd >>= 1; break; - case MT_ROLLOUTROCK: - // If a player has gravity boots and its riding a rollout rock, the rock should copy the player's gravity - if (mo->tracer && mo->tracer->player && mo->tracer->player->powers[pw_gravityboots]) - gravityadd = -gravityadd; - break; default: break; } diff --git a/src/p_user.c b/src/p_user.c index 417154b19..707d420fc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1084,22 +1084,11 @@ void P_ResetPlayer(player_t *player) player->mo->tracer->flags |= MF_PUSHABLE; // goose the mom a little bit to trigger gravity to process for a tic - if (player->mo->eflags & MFE_VERTICALFLIP) + if (player->mo->tracer->eflags & MFE_VERTICALFLIP) player->mo->tracer->momz -= 1; else player->mo->tracer->momz += 1; - // Restore MF2_OBJECTFLIP / MFE_VERTICALFLIP - if (player->mo->tracer->extravalue1 & MF2_OBJECTFLIP) - player->mo->tracer->flags2 |= MF2_OBJECTFLIP; - else - player->mo->tracer->flags2 &= ~MF2_OBJECTFLIP; - - if (player->mo->tracer->extravalue2 & MFE_VERTICALFLIP) - player->mo->tracer->eflags |= MFE_VERTICALFLIP; - else - player->mo->tracer->eflags &= ~MFE_VERTICALFLIP; - P_SetTarget(&player->mo->tracer->tracer, NULL); } P_SetTarget(&player->mo->tracer, NULL); @@ -4580,22 +4569,11 @@ void P_DoJump(player_t *player, boolean soundandstate, boolean allowflip) P_SetObjectMomZ(player->mo->tracer, -9*FRACUNIT, true); // goose the mom a little bit to trigger gravity to process for a tic - if (player->mo->eflags & MFE_VERTICALFLIP) + if (player->mo->tracer->eflags & MFE_VERTICALFLIP) player->mo->tracer->momz -= 1; else player->mo->tracer->momz += 1; - // Restore MF2_OBJECTFLIP / MFE_VERTICALFLIP - if (player->mo->tracer->extravalue1 & MF2_OBJECTFLIP) - player->mo->tracer->flags2 |= MF2_OBJECTFLIP; - else - player->mo->tracer->flags2 &= ~MF2_OBJECTFLIP; - - if (player->mo->tracer->extravalue2 & MFE_VERTICALFLIP) - player->mo->tracer->eflags |= MFE_VERTICALFLIP; - else - player->mo->tracer->eflags &= ~MFE_VERTICALFLIP; - player->mo->tracer->flags |= MF_PUSHABLE; P_SetTarget(&player->mo->tracer->tracer, NULL); } From 8794e411bd57d9c5017ba38137770a586c558b06 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Wed, 20 Mar 2024 19:23:13 +0100 Subject: [PATCH 050/353] Don't traverse the entire HOME directory to find wads --- src/dedicated/i_system.c | 8 +++++++- src/sdl/i_system.c | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 858dfaf20..b231080a8 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -1433,9 +1433,15 @@ static const char *locateWad(void) #ifndef NOHOME // find in $HOME - I_OutputMsg(",HOME"); + I_OutputMsg(",HOME/.srb2"); if ((envstr = I_GetEnv("HOME")) != NULL) + { + char *tmp = malloc(strlen(envstr) + sizeof("/.srb2")); + strcpy(tmp, envstr); + strcat(tmp, "/.srb2"); SEARCHWAD(envstr); + free(tmp); + } #endif // search paths diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 9f0fa0250..c6750ce74 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -3038,10 +3038,16 @@ static const char *locateWad(void) } #ifndef NOHOME - // find in $HOME - I_OutputMsg(",HOME"); + // find in $HOME/.srb2 + I_OutputMsg(",HOME/.srb2"); if ((envstr = I_GetEnv("HOME")) != NULL) + { + char *tmp = malloc(strlen(envstr) + sizeof("/.srb2")); + strcpy(tmp, envstr); + strcat(tmp, "/.srb2"); SEARCHWAD(envstr); + free(tmp); + } #endif // search paths From c3a8f452e2607ac502edba59ef45e63f62c6e1c9 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Wed, 20 Mar 2024 20:30:06 +0100 Subject: [PATCH 051/353] Fix equation slopes breaking with slopes farther than 32k FU away from the map center --- src/p_slopes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index e75d36ede..fd741398b 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -810,10 +810,10 @@ void P_InitSlopes(void) // Returns the height of the sloped plane at (x, y) as a fixed_t fixed_t P_GetSlopeZAt(const pslope_t *slope, fixed_t x, fixed_t y) { - fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) + - FixedMul(y - slope->o.y, slope->d.y); + fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) / 2 + + FixedMul(y - slope->o.y, slope->d.y) / 2; - return slope->o.z + FixedMul(dist, slope->zdelta); + return slope->o.z + FixedMul(dist, slope->zdelta) * 2; } // Like P_GetSlopeZAt but falls back to z if slope is NULL From 10365e943aacd35d7b1052cdc4543556b94ee6f8 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Wed, 20 Mar 2024 20:44:17 +0100 Subject: [PATCH 052/353] Use DEFAULTDIR instead of hardcoding .srb2 --- src/dedicated/i_system.c | 6 +++--- src/sdl/i_system.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index b231080a8..61b7a239a 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -1433,12 +1433,12 @@ static const char *locateWad(void) #ifndef NOHOME // find in $HOME - I_OutputMsg(",HOME/.srb2"); + I_OutputMsg(",HOME/" DEFAULTDIR); if ((envstr = I_GetEnv("HOME")) != NULL) { - char *tmp = malloc(strlen(envstr) + sizeof("/.srb2")); + char *tmp = malloc(strlen(envstr) + sizeof(DEFAULTDIR)); strcpy(tmp, envstr); - strcat(tmp, "/.srb2"); + strcat(tmp, DEFAULTDIR); SEARCHWAD(envstr); free(tmp); } diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index c6750ce74..64fcb2f2b 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -3038,13 +3038,13 @@ static const char *locateWad(void) } #ifndef NOHOME - // find in $HOME/.srb2 - I_OutputMsg(",HOME/.srb2"); + // find in $HOME + I_OutputMsg(",HOME/" DEFAULTDIR); if ((envstr = I_GetEnv("HOME")) != NULL) { - char *tmp = malloc(strlen(envstr) + sizeof("/.srb2")); + char *tmp = malloc(strlen(envstr) + sizeof(DEFAULTDIR)); strcpy(tmp, envstr); - strcat(tmp, "/.srb2"); + strcat(tmp, DEFAULTDIR); SEARCHWAD(envstr); free(tmp); } From d0dd329a8223c99ba84d70a59db3e977ca34e86e Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sat, 23 Mar 2024 13:01:21 +0100 Subject: [PATCH 053/353] Fix buffer overflow when loading addons through symlinks --- src/sdl/i_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 2d051888d..e151734f8 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2976,7 +2976,7 @@ static void pathonly(char *s) */ static const char *searchWad(const char *searchDir) { - static char tempsw[256] = ""; + static char tempsw[MAX_WADPATH] = ""; filestatus_t fstemp; strcpy(tempsw, WADKEYWORD1); From fece34cef60bb3dd326b9292a93f4ce450d0639f Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sat, 23 Mar 2024 13:05:29 +0100 Subject: [PATCH 054/353] Fix segfault when passing a long string to v.drawString --- src/lua_hudlib_drawlist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lua_hudlib_drawlist.c b/src/lua_hudlib_drawlist.c index c518ba525..cb58e628e 100644 --- a/src/lua_hudlib_drawlist.c +++ b/src/lua_hudlib_drawlist.c @@ -180,7 +180,8 @@ static const char *CopyString(huddrawlist_h list, const char* str) const char *old_offset = list->strbuf; size_t i; if (list->strbuf_capacity == 0) list->strbuf_capacity = 256; - else list->strbuf_capacity *= 2; + while (list->strbuf_capacity <= list->strbuf_len + lenstr + 1) + list->strbuf_capacity *= 2; list->strbuf = (char*) Z_Realloc(list->strbuf, sizeof(char) * list->strbuf_capacity, PU_STATIC, NULL); // align the string pointers to make sure old pointers don't point towards invalid addresses From 0a1662a89397b6723c4d13021113eb2510c7ac0b Mon Sep 17 00:00:00 2001 From: Ace Lite <47698279+Ace-Lite@users.noreply.github.com> Date: Sat, 30 Mar 2024 12:41:44 +0100 Subject: [PATCH 055/353] Initial Commit - Hook addon load --- src/lua_hook.h | 1 + src/p_setup.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/lua_hook.h b/src/lua_hook.h index 17e0e99a0..f4ca43371 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -72,6 +72,7 @@ automatically. X (MusicChange),\ X (PlayerHeight),/* override player height */\ X (PlayerCanEnterSpinGaps),\ + X (AddonLoaded),\ X (KeyDown),\ X (KeyUp),\ diff --git a/src/p_setup.c b/src/p_setup.c index 41487d702..8acdeca49 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -8345,6 +8345,8 @@ static boolean P_LoadAddon(UINT16 numlumps) if (!mapsadded) CONS_Printf(M_GetText("No maps added\n")); + LUA_HookVoid(HOOK(AddonLoaded)); + R_LoadSpriteInfoLumps(wadnum, numlumps); #ifdef HWRENDER From 755adb0c46e0bb0dba1bb876fe155e962d9ca016 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sat, 30 Mar 2024 17:58:27 +0100 Subject: [PATCH 056/353] Fix vertical aim being off when using lack of perspective --- src/hardware/hw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index f533082f7..d764e2bb1 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5221,7 +5221,7 @@ static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean if (cv_glshearing.value == 1 || (cv_glshearing.value == 2 && R_IsViewpointThirdPerson(player, skybox))) { fixed_t fixedaiming = AIMINGTODY(aimingangle); - trans->viewaiming = FIXED_TO_FLOAT(fixedaiming); + trans->viewaiming = FIXED_TO_FLOAT(fixedaiming) * (vid.width / vid.height) / (BASEVIDWIDTH / BASEVIDHEIGHT); trans->shearing = true; gl_aimingangle = 0; } From 4147569e10dc0001ef037a8a13eb53575fdb9ffa Mon Sep 17 00:00:00 2001 From: Ace Lite <47698279+Ace-Lite@users.noreply.github.com> Date: Sat, 30 Mar 2024 19:06:52 +0100 Subject: [PATCH 057/353] Just moved Lua_HookVoid really to the end of the function. --- src/p_setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 8acdeca49..4a99fef18 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -8345,8 +8345,6 @@ static boolean P_LoadAddon(UINT16 numlumps) if (!mapsadded) CONS_Printf(M_GetText("No maps added\n")); - LUA_HookVoid(HOOK(AddonLoaded)); - R_LoadSpriteInfoLumps(wadnum, numlumps); #ifdef HWRENDER @@ -8368,6 +8366,8 @@ static boolean P_LoadAddon(UINT16 numlumps) SendNetXCmd(XD_EXITLEVEL, NULL, 0); } + LUA_HookVoid(HOOK(AddonLoaded)); + return true; } From de74137cae75de891194be808936893b82bd9a1e Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sat, 30 Mar 2024 21:10:09 +0100 Subject: [PATCH 058/353] Use float for calculating aspect ratio --- src/hardware/hw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index d764e2bb1..0771708eb 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5221,7 +5221,7 @@ static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean if (cv_glshearing.value == 1 || (cv_glshearing.value == 2 && R_IsViewpointThirdPerson(player, skybox))) { fixed_t fixedaiming = AIMINGTODY(aimingangle); - trans->viewaiming = FIXED_TO_FLOAT(fixedaiming) * (vid.width / vid.height) / (BASEVIDWIDTH / BASEVIDHEIGHT); + trans->viewaiming = FIXED_TO_FLOAT(fixedaiming) * ((float)vid.width / vid.height) / ((float)BASEVIDWIDTH / BASEVIDHEIGHT); trans->shearing = true; gl_aimingangle = 0; } From 2b9cfa8262b73e1ec1a935ee0dc4b318c649a394 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 31 Mar 2024 18:27:57 +0200 Subject: [PATCH 059/353] Fix crash when spawning a BOT_2PAI on a dedicated server --- src/b_bot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/b_bot.c b/src/b_bot.c index af57d65ec..6229cb1d6 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -387,7 +387,8 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd) } // Bot AI isn't programmed in analog. - CV_SetValue(&cv_analog[1], false); + if (!dedicated) + CV_SetValue(&cv_analog[1], false); // Let Lua scripts build ticcmds if (LUA_HookTiccmd(player, cmd, HOOK(BotTiccmd))) From 6c628db56a265115438cab865832455d12e42d5c Mon Sep 17 00:00:00 2001 From: Logan Aerl Arias Date: Wed, 3 Apr 2024 00:54:35 -0400 Subject: [PATCH 060/353] 1st try around sorting the lumps by name --- src/filesrch.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/filesrch.c b/src/filesrch.c index 944e8447f..7ccf532c8 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -699,6 +699,13 @@ static void initdirpath(char *dirpath, size_t *dirpathindex, int depthleft) dirpathindex[depthleft]--; } +//sortdir by name? +static int lumpnamecompare( const void *A, const void *B ) +{ + return strcmp( (((lumpinfo_t *)A)->fullname), (((lumpinfo_t *)B)->fullname)); + +} + lumpinfo_t *getdirectoryfiles(const char *path, UINT16 *nlmp, UINT16 *nfolders) { DIR **dirhandle; @@ -889,6 +896,9 @@ lumpinfo_t *getdirectoryfiles(const char *path, UINT16 *nlmp, UINT16 *nfolders) free(dirpathindex); free(dirhandle); + //sort files and directories + qsort ( lumpinfo, numlumps, sizeof( lumpinfo_t ), lumpnamecompare ); + (*nlmp) = numlumps; return lumpinfo; } From aab11cd87385b399826e2d97dee47cf3b202a218 Mon Sep 17 00:00:00 2001 From: Logan Aerl Arias Date: Wed, 3 Apr 2024 18:42:36 -0400 Subject: [PATCH 061/353] reformat the compare func used in qsort --- src/d_main.c | 12 ++++++++---- src/filesrch.c | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index c139650d1..6ced36624 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1842,17 +1842,21 @@ static boolean check_top_dir(const char **path, const char *top) return true; } -static int cmp_strlen_desc(const void *a, const void *b) +static int cmp_strlen_desc(const void *A, const void *B) { - return ((int)strlen(*(const char*const*)b) - (int)strlen(*(const char*const*)a)); + const char *pA = A; + const char *pB = B; + size_t As = strlen(pA); + size_t Bs = strlen(pB); + return ((int)Bs - (int)As); } boolean D_IsPathAllowed(const char *path) { - const char *paths[] = { + char *paths[] = { srb2home, srb2path, - cv_addons_folder.string + cv_addons_folder.zstring }; const size_t n_paths = sizeof paths / sizeof *paths; diff --git a/src/filesrch.c b/src/filesrch.c index 7ccf532c8..3a729a9c8 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -700,9 +700,11 @@ static void initdirpath(char *dirpath, size_t *dirpathindex, int depthleft) } //sortdir by name? -static int lumpnamecompare( const void *A, const void *B ) +static int lumpnamecompare(const void *A, const void *B) { - return strcmp( (((lumpinfo_t *)A)->fullname), (((lumpinfo_t *)B)->fullname)); + const lumpinfo_t *pA = A; + const lumpinfo_t *pB = B; + return strcmp((pA->fullname), (pB->fullname)); } @@ -897,7 +899,7 @@ lumpinfo_t *getdirectoryfiles(const char *path, UINT16 *nlmp, UINT16 *nfolders) free(dirhandle); //sort files and directories - qsort ( lumpinfo, numlumps, sizeof( lumpinfo_t ), lumpnamecompare ); + qsort (lumpinfo, numlumps, sizeof(lumpinfo_t), lumpnamecompare); (*nlmp) = numlumps; return lumpinfo; From b2ff4e61674869b82d97b16ffcf7e9a13b506d39 Mon Sep 17 00:00:00 2001 From: katsy Date: Mon, 8 Apr 2024 00:07:51 -0500 Subject: [PATCH 062/353] Fix PlayerZMovement spam and infinite MFE_JUSTHITFLOOR when standing on a solid object --- src/p_mobj.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 9cdd2628d..ed7e25d40 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2245,7 +2245,7 @@ boolean P_ZMovement(mobj_t *mo) else if (!onground) P_SlopeLaunch(mo); } - + if (!mo->player && P_CheckDeathPitCollide(mo) && mo->health && !(mo->flags & MF_NOCLIPHEIGHT) && !(mo->flags2 & MF2_BOSSDEAD)) { @@ -2938,7 +2938,7 @@ boolean P_SceneryZMovement(mobj_t *mo) mo->eflags &= ~MFE_APPLYPMOMZ; } mo->z += mo->momz; - + if (!mo->player && P_CheckDeathPitCollide(mo) && mo->health && !(mo->flags & MF_NOCLIPHEIGHT) && !(mo->flags2 & MF2_BOSSDEAD)) { @@ -3781,7 +3781,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) // always do the gravity bit now, that's simpler // BUT CheckPosition only if wasn't done before. - if (!(mobj->eflags & MFE_ONGROUND) || mobj->momz + if (mobj->momz || ((mobj->eflags & MFE_VERTICALFLIP) && mobj->z + mobj->height != mobj->ceilingz) || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z != mobj->floorz) || P_IsObjectInGoop(mobj)) @@ -3794,17 +3794,6 @@ static void P_PlayerMobjThinker(mobj_t *mobj) } else { -#if 0 // i don't know why this is here, it's causing a few undesired state glitches, and disabling it doesn't appear to negatively affect the game, but i don't want it gone permanently just in case some obscure bug crops up - if (!(mobj->player->powers[pw_carry] == CR_NIGHTSMODE)) // used for drilling - mobj->player->pflags &= ~PF_STARTJUMP; - mobj->player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE); - if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly]) - { - mobj->player->secondjump = 0; - mobj->player->powers[pw_tailsfly] = 0; - P_SetMobjState(mobj, S_PLAY_WALK); - } -#endif mobj->eflags &= ~MFE_JUSTHITFLOOR; } @@ -10730,7 +10719,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...) // Set shadowscale here, before spawn hook so that Lua can change it mobj->shadowscale = P_DefaultMobjShadowScale(mobj); - + // A monitor can't respawn if we're not in multiplayer, // or if we're in co-op and it's score or a 1up if (mobj->flags & MF_MONITOR && (!(netgame || multiplayer) From 26da1e1e09574ed6cbc07fab924c3862f69fe036 Mon Sep 17 00:00:00 2001 From: VladDoc Date: Thu, 11 Apr 2024 22:36:12 +0300 Subject: [PATCH 063/353] Shaders with absent #version directive to compile on linux via prepending of said directive --- src/hardware/hw_shaders.c | 103 +++++++++++++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 1 deletion(-) diff --git a/src/hardware/hw_shaders.c b/src/hardware/hw_shaders.c index 36cbb5db9..32336d63f 100644 --- a/src/hardware/hw_shaders.c +++ b/src/hardware/hw_shaders.c @@ -448,6 +448,101 @@ void HWR_LoadAllCustomShaders(void) HWR_LoadCustomShadersFromFile(i, W_FileHasFolders(wadfiles[i])); } +static const char version_directives[][14] = { + "#version 330\n", + "#version 150\n", + "#version 140\n", + "#version 130\n", + "#version 120\n", + "#version 110\n", +}; + +static boolean HWR_VersionDirectiveExists(const char* source) +{ + return strncmp(source, "#version", 8) == 0; +} + +static char* HWR_PrependVersionDirective(const char* source, UINT32 version_index) +{ + const UINT32 version_len = sizeof(version_directives[version_index]) - 1; + const UINT32 source_len = strlen(source); + + char* result = Z_Malloc(source_len + version_len + 1, PU_STATIC, NULL); + + strcpy(result, version_directives[version_index]); + strcpy(result + version_len, source); + + return result; +} + +static void HWR_ReplaceVersionInplace(char* shader, UINT32 version_index) +{ + shader[9] = version_directives[version_index][9]; + shader[10] = version_directives[version_index][10]; + shader[11] = version_directives[version_index][11]; +} + +static boolean HWR_CheckVersionDirectives(const char* vert, const char* frag) +{ + return HWR_VersionDirectiveExists(vert) && HWR_VersionDirectiveExists(frag); +} + +static void HWR_TryToCompileShaderWithImplicitVersion(INT32 shader_index, INT32 shaderxlat_id) +{ + char* vert_shader = gl_shaders[shader_index].vertex; + char* frag_shader = gl_shaders[shader_index].fragment; + + boolean vert_shader_version_exists = HWR_VersionDirectiveExists(vert_shader); + boolean frag_shader_version_exists = HWR_VersionDirectiveExists(frag_shader); + + if(!vert_shader_version_exists) { + CONS_Alert(CONS_WARNING, "HWR_LoadCustomShadersFromFile: vertex shader '%s' is missing a #version directive\n", HWR_GetShaderName(shaderxlat_id)); + } + + if(!frag_shader_version_exists) { + CONS_Alert(CONS_WARNING, "HWR_LoadCustomShadersFromFile: fragment shader '%s' is missing a #version directive\n", HWR_GetShaderName(shaderxlat_id)); + } + + // try to compile as is + HWR_CompileShader(shader_index); + if (gl_shaders[shader_index].compiled) + return; + + // try each version directive + for(UINT32 i = 0; i < sizeof(version_directives) / sizeof(version_directives[0]); ++i) { + CONS_Alert(CONS_NOTICE, "HWR_TryToCompileShaderWithImplicitVersion: Trying %s\n", version_directives[i]); + + if(!vert_shader_version_exists) { + // first time reallocation would have to be made + if(i == 0) { + void* old = (void*)gl_shaders[shader_index].vertex; + vert_shader = gl_shaders[shader_index].vertex = HWR_PrependVersionDirective(vert_shader, i); + Z_Free(old); + } else { + HWR_ReplaceVersionInplace(vert_shader, i); + } + } + + if(!frag_shader_version_exists) { + if(i == 0) { + void* old = (void*)gl_shaders[shader_index].fragment; + frag_shader = gl_shaders[shader_index].fragment = HWR_PrependVersionDirective(frag_shader, i); + Z_Free(old); + } else { + HWR_ReplaceVersionInplace(frag_shader, i); + } + } + + HWR_CompileShader(shader_index); + if (gl_shaders[shader_index].compiled) { + CONS_Alert(CONS_NOTICE, "HWR_TryToCompileShaderWithImplicitVersion: Compiled with %s\n", + version_directives[i]); + CONS_Alert(CONS_WARNING, "Implicit GLSL version is used. Correct behavior is not guaranteed\n"); + return; + } + } +} + void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3) { UINT16 lump; @@ -610,7 +705,13 @@ skip_field: gl_shaders[shader_index].fragment = Z_StrDup(gl_shadersources[i].fragment); if (!gl_shaders[shader_index].vertex) gl_shaders[shader_index].vertex = Z_StrDup(gl_shadersources[i].vertex); - HWR_CompileShader(shader_index); + + if(!HWR_CheckVersionDirectives(gl_shaders[shader_index].vertex, gl_shaders[shader_index].fragment)) { + HWR_TryToCompileShaderWithImplicitVersion(shader_index, i); + } else { + HWR_CompileShader(shader_index); + } + if (!gl_shaders[shader_index].compiled) CONS_Alert(CONS_ERROR, "HWR_LoadCustomShadersFromFile: A compilation error occured for the %s shader in file %s. See the console messages above for more information.\n", shaderxlat[i].type, wadfiles[wadnum]->filename); } From fb437a3c72184584aa3cb33e009758e3b122ecc7 Mon Sep 17 00:00:00 2001 From: VladDoc Date: Fri, 12 Apr 2024 20:37:17 +0300 Subject: [PATCH 064/353] white space fix --- src/hardware/hw_shaders.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_shaders.c b/src/hardware/hw_shaders.c index 32336d63f..ee1e2acdf 100644 --- a/src/hardware/hw_shaders.c +++ b/src/hardware/hw_shaders.c @@ -468,11 +468,10 @@ static char* HWR_PrependVersionDirective(const char* source, UINT32 version_inde const UINT32 source_len = strlen(source); char* result = Z_Malloc(source_len + version_len + 1, PU_STATIC, NULL); - strcpy(result, version_directives[version_index]); - strcpy(result + version_len, source); + strcpy(result + version_len, source); - return result; + return result; } static void HWR_ReplaceVersionInplace(char* shader, UINT32 version_index) @@ -514,6 +513,7 @@ static void HWR_TryToCompileShaderWithImplicitVersion(INT32 shader_index, INT32 if(!vert_shader_version_exists) { // first time reallocation would have to be made + if(i == 0) { void* old = (void*)gl_shaders[shader_index].vertex; vert_shader = gl_shaders[shader_index].vertex = HWR_PrependVersionDirective(vert_shader, i); From 92cccd682c53f212202bab2907652bd97f95fdc9 Mon Sep 17 00:00:00 2001 From: katsy Date: Wed, 17 Apr 2024 18:00:30 -0500 Subject: [PATCH 065/353] Fix automatic mode z-target bugs and crashes --- src/g_game.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 8d19c9e7c..ed9e88362 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1363,11 +1363,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) axis = PlayerJoyAxis(ssplayer, JA_FIRENORMAL); if (PLAYERINPUTDOWN(ssplayer, GC_FIRENORMAL) || (usejoystick && axis > 0)) cmd->buttons |= BT_FIRENORMAL; - + // Toss flag button if (PLAYERINPUTDOWN(ssplayer, GC_TOSSFLAG)) cmd->buttons |= BT_TOSSFLAG; - + // Shield button axis = PlayerJoyAxis(ssplayer, JA_SHIELD); if (PLAYERINPUTDOWN(ssplayer, GC_SHIELD) || (usejoystick && axis > 0)) @@ -1420,7 +1420,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) ticcmd_centerviewdown[forplayer] = true; } - else if (ticcmd_centerviewdown[forplayer]) + else if (ticcmd_centerviewdown[forplayer] || (leveltime < 5)) { if (controlstyle == CS_SIMPLE) { @@ -1435,6 +1435,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) { if ( P_MobjWasRemoved(ticcmd_ztargetfocus[forplayer]) || + (leveltime < 5) || + (player->playerstate != PST_LIVE) || + player->exiting || !ticcmd_ztargetfocus[forplayer]->health || (ticcmd_ztargetfocus[forplayer]->type == MT_EGGMOBILE3 && !ticcmd_ztargetfocus[forplayer]->movecount) // Sea Egg is moving around underground and shouldn't be tracked ) @@ -1466,7 +1469,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) P_SetTarget(&newtarget->target, ticcmd_ztargetfocus[forplayer]); newtarget->drawonlyforplayer = player; // Hide it from the other player in splitscreen, and yourself when spectating - if (player->mo && P_AproxDistance( + if (player->mo && R_PointToDist2(0, 0, player->mo->x - ticcmd_ztargetfocus[forplayer]->x, player->mo->y - ticcmd_ztargetfocus[forplayer]->y ) > 50*player->mo->scale) @@ -4018,7 +4021,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent) INT32 i; INT16 newmapnum; boolean spec = G_IsSpecialStage(gamemap); - + // go to next level // newmapnum is 0-based, unlike gamemap if (nextmapoverride != 0) @@ -4122,7 +4125,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent) if (spec && (!gottoken || ignoretokens) && !nextmapoverride) newmapnum = lastmap; // Exiting from a special stage? Go back to the game. Tails 08-11-2001 - + if (!(gametyperules & GTR_CAMPAIGN)) { if (cv_advancemap.value == 0) // Stay on same map. @@ -4130,7 +4133,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent) else if (cv_advancemap.value == 2) // Go to random map. newmapnum = RandMap(G_TOLFlag(gametype_to_use), prevmap); } - + return newmapnum; } @@ -4140,7 +4143,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent) static void G_DoCompleted(void) { INT32 i; - + tokenlist = 0; // Reset the list if (modeattacking && pausedelay) @@ -4168,7 +4171,7 @@ static void G_DoCompleted(void) //Get and set prevmap/nextmap prevmap = (INT16)(gamemap-1); nextmap = G_GetNextMap(false, false); - + automapactive = false; // We are committed to this map now. From 723b5662efe6b656d5b72f34a0ba7b4e926ba05d Mon Sep 17 00:00:00 2001 From: Zwip-Zwap Zapony Date: Thu, 18 Apr 2024 20:15:30 +0200 Subject: [PATCH 066/353] Fix CR_PLAYER/CR_PTERABYTE positioning --- src/p_user.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 7cd128cf0..b29b81271 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8812,6 +8812,8 @@ void P_MovePlayer(player_t *player) player->mo->height = P_GetPlayerSpinHeight(player); atspinheight = true; } + else if (player->powers[pw_carry] == CR_PLAYER || player->powers[pw_carry] == CR_PTERABYTE) // You're slightly shorter while being carried + player->mo->height = FixedDiv(P_GetPlayerHeight(player), FixedDiv(14*FRACUNIT,10*FRACUNIT)); else player->mo->height = P_GetPlayerHeight(player); @@ -12829,9 +12831,9 @@ void P_PlayerAfterThink(player_t *player) else { 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); + P_TryMove(player->mo, tails->x + P_ReturnThrustX(tails, tails->player->drawangle, 4*tails->scale), tails->y + P_ReturnThrustY(tails, tails->player->drawangle, 4*tails->scale), 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); + P_TryMove(player->mo, tails->x + P_ReturnThrustX(tails, tails->angle, 4*tails->scale), tails->y + P_ReturnThrustY(tails, tails->angle, 4*tails->scale), true); player->mo->momx = tails->momx; player->mo->momy = tails->momy; player->mo->momz = tails->momz; @@ -12845,7 +12847,7 @@ void P_PlayerAfterThink(player_t *player) P_SetPlayerAngle(player, player->mo->angle); } - if (P_AproxDistance(player->mo->x - tails->x, player->mo->y - tails->y) > player->mo->radius) + if (P_AproxDistance(player->mo->x - tails->x, player->mo->y - tails->y) > tails->radius) player->powers[pw_carry] = CR_NONE; if (player->powers[pw_carry] == CR_PLAYER) @@ -13066,7 +13068,7 @@ void P_PlayerAfterThink(player_t *player) player->mo->momy = ptera->momy; player->mo->momz = ptera->momz; - if (P_AproxDistance(player->mo->x - ptera->x - ptera->watertop, player->mo->y - ptera->y - ptera->waterbottom) > player->mo->radius) + if (P_AproxDistance(player->mo->x - ptera->x - ptera->watertop, player->mo->y - ptera->y - ptera->waterbottom) > ptera->radius) goto dropoff; ptera->watertop >>= 1; From df3b26878ac6e250768316a01ac8d8fe18484096 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 11 Feb 2024 05:33:20 -0800 Subject: [PATCH 067/353] Got_Luacmd: ensure lua stack is large enough for command arguments --- src/lua_consolelib.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 3783b8f7b..31d999440 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -30,6 +30,12 @@ return luaL_error(L, "HUD rendering code should not call this function!"); static consvar_t *this_cvar; +static void clear_lua_stack(void) +{ + if (gL) // check if Lua is actually turned on first, you dummmy -- Monster Iestyn 04/07/18 + lua_settop(gL, 0); // clear stack +} + void Got_Luacmd(UINT8 **cp, INT32 playernum) { UINT8 i, argc, flags; @@ -74,6 +80,13 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum) lua_remove(gL, -2); // pop command info table + if (!lua_checkstack(gL, argc)) // player + command arguments + { + clear_lua_stack(); + CONS_Alert(CONS_WARNING, "lua command stack overflow from %s (%d, need %d more)\n", player_names[playernum], lua_gettop(gL), argc); + return; + } + LUA_PushUserdata(gL, &players[playernum], META_PLAYER); for (i = 1; i < argc; i++) { @@ -85,8 +98,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum) deny: //must be hacked/buggy client - if (gL) // check if Lua is actually turned on first, you dummmy -- Monster Iestyn 04/07/18 - lua_settop(gL, 0); // clear stack + clear_lua_stack(); CONS_Alert(CONS_WARNING, M_GetText("Illegal lua command received from %s\n"), player_names[playernum]); if (server) From 388a72a89b9ea3fd6e4d3c3b2c7d14e1b7384975 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 11 Feb 2024 05:35:42 -0800 Subject: [PATCH 068/353] Got_Saycmd: copy message content into intermediate buffer This prevents modifying the original buffer at the cleanup step as well as potentially writing out of bounds. --- src/hu_stuff.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index e223d3208..180d31704 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -641,6 +641,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) SINT8 target; UINT8 flags; const char *dispname; + char buf[HU_MAXMSGLEN + 1]; char *msg; boolean action = false; char *ptr; @@ -650,8 +651,8 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) target = READSINT8(*p); flags = READUINT8(*p); - msg = (char *)*p; - SKIPSTRINGL(*p, HU_MAXMSGLEN + 1); + msg = buf; + READSTRINGL(*p, msg, HU_MAXMSGLEN + 1); if ((cv_mute.value || flags & (HU_CSAY|HU_SERVER_SAY)) && playernum != serverplayer && !(IsPlayerAdmin(playernum))) { From 73cf19038caf689404e52493d5cc4fc9b51e7bcb Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sun, 11 Feb 2024 15:10:51 -0600 Subject: [PATCH 069/353] Check Lua stack before pushing cons args Prevents a Lua stack overrun when executing absurd console commands for local-only lua commands. --- src/lua_consolelib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 31d999440..a1518a2fe 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -184,6 +184,11 @@ void COM_Lua_f(void) I_Assert(lua_isfunction(gL, -1)); lua_remove(gL, -2); // pop command info table + if (!lua_checkstack(gL, COM_Argc() + 1)) + { + CONS_Alert(CONS_WARNING, "lua command stack overflow (%d, need %s more)\n", lua_gettop(gL), sizeu1(COM_Argc() + 1)); + return; + } LUA_PushUserdata(gL, &players[playernum], META_PLAYER); for (i = 1; i < COM_Argc(); i++) lua_pushstring(gL, COM_Argv(i)); From 08ee6ca6b969179d05c7422d2d855d1f3bfb1890 Mon Sep 17 00:00:00 2001 From: James R Date: Sun, 11 Feb 2024 15:40:04 -0800 Subject: [PATCH 070/353] Got_Luacmd: always read netxcmd data, even if command is not executed --- src/lua_consolelib.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index a1518a2fe..6010946ac 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -39,8 +39,18 @@ static void clear_lua_stack(void) void Got_Luacmd(UINT8 **cp, INT32 playernum) { UINT8 i, argc, flags; + const char *argv[256]; char buf[256]; + argc = READUINT8(*cp); + argv[0] = (const char*)*cp; + SKIPSTRINGN(*cp, 255); + for (i = 1; i < argc; i++) + { + argv[i] = (const char*)*cp; + SKIPSTRINGN(*cp, 255); + } + // don't use I_Assert here, goto the deny code below // to clean up and kick people who try nefarious exploits // like sending random junk lua commands to crash the server @@ -53,8 +63,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum) lua_getfield(gL, LUA_REGISTRYINDEX, "COM_Command"); // push COM_Command if (!lua_istable(gL, -1)) goto deny; - argc = READUINT8(*cp); - READSTRINGN(*cp, buf, 255); + strlcpy(buf, argv[0], 255); strlwr(buf); // must lowercase buffer lua_getfield(gL, -1, buf); // push command info table if (!lua_istable(gL, -1)) goto deny; @@ -90,7 +99,7 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum) LUA_PushUserdata(gL, &players[playernum], META_PLAYER); for (i = 1; i < argc; i++) { - READSTRINGN(*cp, buf, 255); + strlcpy(buf, argv[i], 255); lua_pushstring(gL, buf); } LUA_Call(gL, (int)argc, 0, 1); // argc is 1-based, so this will cover the player we passed too. From f8650a17a0f5b6d31dbb462457378a2e96477d64 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 28 Apr 2024 16:21:48 +0200 Subject: [PATCH 071/353] Fix aim in splitscreen --- src/hardware/hw_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 0771708eb..376639878 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5222,6 +5222,8 @@ static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean { fixed_t fixedaiming = AIMINGTODY(aimingangle); trans->viewaiming = FIXED_TO_FLOAT(fixedaiming) * ((float)vid.width / vid.height) / ((float)BASEVIDWIDTH / BASEVIDHEIGHT); + if (splitscreen) + trans->viewaiming *= 2.125; // splitscreen adjusts fov with 0.8, so compensate (but only halfway, since splitscreen means only half the screen is used) trans->shearing = true; gl_aimingangle = 0; } From b0f5255a0d9e2fbd9949fabf0f0507e32b776d9f Mon Sep 17 00:00:00 2001 From: katsy Date: Sun, 28 Apr 2024 17:10:34 -0500 Subject: [PATCH 072/353] Removed thokked when hitting springs --- src/p_map.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index f97ddfa3c..f6f9c69b5 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -389,7 +389,6 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) { INT32 pflags; UINT8 secondjump; - boolean washoming; if (spring->flags & MF_ENEMY) // Spring shells P_SetTarget(&spring->target, object); @@ -421,7 +420,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) { boolean wasSpindashing = object->player->dashspeed > 0 && (object->player->charability2 == CA2_SPINDASH); - pflags = object->player->pflags & (PF_STARTJUMP | PF_JUMPED | PF_NOJUMPDAMAGE | PF_SPINNING | PF_THOKKED | PF_BOUNCING); // I still need these. + pflags = object->player->pflags & (PF_STARTJUMP | PF_JUMPED | PF_NOJUMPDAMAGE | PF_SPINNING | PF_BOUNCING); // I still need these. if (wasSpindashing) // Ensure we're in the rolling state, and not spindash. P_SetMobjState(object, S_PLAY_ROLL); @@ -433,7 +432,6 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) } } secondjump = object->player->secondjump; - washoming = object->player->homing; P_ResetPlayer(object->player); if (spring->info->painchance == 1) // For all those ancient, SOC'd abilities. @@ -445,8 +443,6 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) { object->player->pflags |= (pflags &~ PF_STARTJUMP); object->player->secondjump = secondjump; - if (washoming) - object->player->pflags &= ~PF_THOKKED; } else if (!vertispeed) { From c208921c4a65e6485c73066a28207978141da261 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Wed, 1 May 2024 17:26:02 +0200 Subject: [PATCH 073/353] Add tofixed lua function --- src/lua_baselib.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index f6b8f462b..dc6a26c81 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -345,6 +345,18 @@ static int lib_reserveLuabanks(lua_State *L) return 1; } +static int lib_tofixed(lua_State *L) +{ + const char *arg = luaL_checkstring(L, 1); + char *end; + float f = strtof(arg, &end); + if (*end != '\0') + lua_pushnil(L); + else + lua_pushnumber(L, FLOAT_TO_FIXED(f)); + return 1; +} + // M_MENU ////////////// @@ -4333,6 +4345,7 @@ static luaL_Reg lib[] = { {"userdataMetatable", lib_userdataMetatable}, {"IsPlayerAdmin", lib_isPlayerAdmin}, {"reserveLuabanks", lib_reserveLuabanks}, + {"tofixed", lib_tofixed}, // m_menu {"M_MoveColorAfter",lib_pMoveColorAfter}, From efced4e7637eacf803592e530149788c75c67c4d Mon Sep 17 00:00:00 2001 From: spherallic Date: Fri, 3 May 2024 15:54:36 +0200 Subject: [PATCH 074/353] Allow less than 3 emerald shards instead of crashing --- src/p_setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 41487d702..f6d9604d5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -831,13 +831,15 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum) static void P_SpawnEmeraldHunt(void) { - INT32 emer[3], num[MAXHUNTEMERALDS], i, randomkey; + INT32 emer[3], num[MAXHUNTEMERALDS], i, amount, randomkey; fixed_t x, y, z; for (i = 0; i < numhuntemeralds; i++) num[i] = i; - for (i = 0; i < 3; i++) + amount = min(numhuntemeralds, 3); + + for (i = 0; i < amount; i++) { // generate random index, shuffle afterwards randomkey = P_RandomKey(numhuntemeralds--); From da3355a1536d212e58ced550bcfd5a56efd2f8af Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 4 May 2024 03:39:41 -0300 Subject: [PATCH 075/353] Fix #1247 --- src/r_draw.c | 2 +- src/r_draw.h | 5 +- src/r_draw8.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++ src/r_segs.c | 63 +++++++++++++----- src/r_things.c | 12 ++-- 5 files changed, 235 insertions(+), 23 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index 86f7e488c..feb4693bb 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -74,7 +74,7 @@ UINT8 *dc_transmap; // one of the translucency tables UINT8 *dc_translation; struct r_lightlist_s *dc_lightlist = NULL; -INT32 dc_numlights = 0, dc_maxlights, dc_texheight; +INT32 dc_numlights = 0, dc_maxlights, dc_texheight, dc_postlength; // ========================================================================= // SPAN DRAWING CODE STUFF diff --git a/src/r_draw.h b/src/r_draw.h index 1a828312a..77588d7de 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -41,8 +41,7 @@ extern UINT8 *dc_translation; extern struct r_lightlist_s *dc_lightlist; extern INT32 dc_numlights, dc_maxlights; -//Fix TUTIFRUTI -extern INT32 dc_texheight; +extern INT32 dc_texheight, dc_postlength; // ----------------------- // SPAN DRAWING CODE STUFF @@ -154,8 +153,10 @@ void R_VideoErase(size_t ofs, INT32 count); // ----------------- void R_DrawColumn_8(void); +void R_DrawColumnClamped_8(void); void R_DrawShadeColumn_8(void); void R_DrawTranslucentColumn_8(void); +void R_DrawTranslucentColumnClamped_8(void); void R_DrawDropShadowColumn_8(void); void R_DrawTranslatedColumn_8(void); void R_DrawTranslatedTranslucentColumn_8(void); diff --git a/src/r_draw8.c b/src/r_draw8.c index 99fb71e28..735127f88 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -100,6 +100,98 @@ void R_DrawColumn_8(void) } } +/** \brief The R_DrawColumnClamped_8 function + Same as R_DrawColumn_8, but prevents artifacts from showing up (caused by fixed-point imprecisions) +*/ +void R_DrawColumnClamped_8(void) +{ + INT32 count; + UINT8 *dest; + fixed_t frac; + fixed_t fracstep; + + count = dc_yh - dc_yl; + + if (count < 0) // Zero length, column does not exceed a pixel. + return; + +#ifdef RANGECHECK + if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height) + return; +#endif + + // Framebuffer destination address. + dest = &topleft[dc_yl*vid.width + dc_x]; + + count++; + + // Determine scaling, which is the only mapping to be done. + fracstep = dc_iscale; + frac = dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep); + + // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. + // This is as fast as it gets. + { + const UINT8 *source = dc_source; + const lighttable_t *colormap = dc_colormap; + INT32 heightmask = dc_texheight-1; + INT32 idx; + if (dc_texheight & heightmask) // not a power of 2 -- killough + { + heightmask++; + heightmask <<= FRACBITS; + + if (frac < 0) + while ((frac += heightmask) < 0); + else + while (frac >= heightmask) + frac -= heightmask; + + do + { + // Re-map color indices from wall texture column + // using a lighting/special effects LUT. + // heightmask is the Tutti-Frutti fix + idx = frac>>FRACBITS; + if (idx >= 0 && idx < dc_postlength) + *dest = colormap[source[idx]]; + dest += vid.width; + + // Avoid overflow. + if (fracstep > 0x7FFFFFFF - frac) + frac += fracstep - heightmask; + else + frac += fracstep; + + while (frac >= heightmask) + frac -= heightmask; + } while (--count); + } + else + { + while ((count -= 2) >= 0) // texture height is a power of 2 + { + idx = (frac>>FRACBITS) & heightmask; + if (idx >= 0 && idx < dc_postlength) + *dest = colormap[source[idx]]; + dest += vid.width; + frac += fracstep; + idx = (frac>>FRACBITS) & heightmask; + if (idx >= 0 && idx < dc_postlength) + *dest = colormap[source[idx]]; + dest += vid.width; + frac += fracstep; + } + if (count & 1) + { + idx = (frac>>FRACBITS) & heightmask; + if (idx >= 0 && idx < dc_postlength) + *dest = colormap[source[idx]]; + } + } + } +} + /** \brief The R_DrawShadeColumn_8 function Experiment to make software go faster. Taken from the Boom source */ @@ -212,6 +304,90 @@ void R_DrawTranslucentColumn_8(void) } } +/** \brief The R_DrawTranslucentColumnClamped_8 function + Same as R_DrawTranslucentColumn_8, but prevents artifacts from showing up (caused by fixed-point imprecisions) +*/ +void R_DrawTranslucentColumnClamped_8(void) +{ + INT32 count; + UINT8 *dest; + fixed_t frac, fracstep; + + count = dc_yh - dc_yl + 1; + + if (count <= 0) // Zero length, column does not exceed a pixel. + return; + +#ifdef RANGECHECK + if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height) + I_Error("R_DrawTranslucentColumnClamped_8: %d to %d at %d", dc_yl, dc_yh, dc_x); +#endif + + dest = &topleft[dc_yl*vid.width + dc_x]; + + // Looks familiar. + fracstep = dc_iscale; + frac = dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep); + + // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. + // This is as fast as it gets. + { + const UINT8 *source = dc_source; + const UINT8 *transmap = dc_transmap; + const lighttable_t *colormap = dc_colormap; + INT32 heightmask = dc_texheight - 1; + INT32 idx; + if (dc_texheight & heightmask) + { + heightmask++; + heightmask <<= FRACBITS; + + if (frac < 0) + while ((frac += heightmask) < 0) + ; + else + while (frac >= heightmask) + frac -= heightmask; + + do + { + // Re-map color indices from wall texture column + // using a lighting/special effects LUT. + // heightmask is the Tutti-Frutti fix + idx = frac>>FRACBITS; + if (idx >= 0 && idx < dc_postlength) + *dest = *(transmap + (colormap[source[idx]]<<8) + (*dest)); + dest += vid.width; + if ((frac += fracstep) >= heightmask) + frac -= heightmask; + } + while (--count); + } + else + { + while ((count -= 2) >= 0) // texture height is a power of 2 + { + idx = (frac>>FRACBITS)&heightmask; + if (idx >= 0 && idx < dc_postlength) + *dest = *(transmap + (colormap[source[idx]]<<8) + (*dest)); + dest += vid.width; + frac += fracstep; + idx = (frac>>FRACBITS)&heightmask; + if (idx >= 0 && idx < dc_postlength) + *dest = *(transmap + (colormap[source[idx]]<<8) + (*dest)); + dest += vid.width; + frac += fracstep; + } + if (count & 1) + { + idx = (frac>>FRACBITS)&heightmask; + if (idx >= 0 && idx < dc_postlength) + *dest = *(transmap + (colormap[source[idx]]<<8) + (*dest)); + } + } + } +} + // Hack: A cut-down copy of R_DrawTranslucentColumn_8 that does not read texture // data since something about calculating the texture reading address for drop shadows is broken. // dc_texturemid and dc_iscale get wrong values for drop shadows, however those are not strictly diff --git a/src/r_segs.c b/src/r_segs.c index e07ced86a..b7f9cd77b 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -515,6 +515,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) fixed_t wall_scalex, wall_scaley; UINT8 vertflip; unsigned lengthcol; + boolean fog = false; + boolean fuzzy = false; void (*colfunc_2s) (column_t *, unsigned); @@ -528,8 +530,6 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) frontsector = curline->frontsector == pfloor->target ? curline->backsector : curline->frontsector; sidedef = R_GetFFloorSide(curline, pfloor); - colfunc = colfuncs[BASEDRAWFUNC]; - if (pfloor->master->flags & ML_TFERLINE) { line_t *newline = R_GetFFloorLine(curline, pfloor); @@ -547,7 +547,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (pfloor->fofflags & FOF_TRANSLUCENT) { - boolean fuzzy = true; + fuzzy = true; // Hacked up support for alpha value in software mode Tails 09-24-2002 // ...unhacked by toaster 04-01-2021, re-hacked a little by sphere 19-11-2021 @@ -560,17 +560,14 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) else if (!(dc_transmap = R_GetTranslucencyTable(trans)) || trans == 0) fuzzy = false; // Opaque } - - if (fuzzy) - colfunc = colfuncs[COLDRAWFUNC_FUZZY]; } else if (pfloor->fofflags & FOF_FOG) + { colfunc = colfuncs[COLDRAWFUNC_FOG]; + fog = true; + } range = max(ds->x2-ds->x1, 1); - //SoM: Moved these up here so they are available for my lightlist calculations - rw_scalestep = ds->scalestep; - spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep; dc_numlights = 0; if (frontsector->numlights) @@ -673,9 +670,9 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) // Get correct light level! if ((frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG))) lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT); - else if (pfloor->fofflags & FOF_FOG) + else if (fog) lightnum = (pfloor->master->frontsector->lightlevel >> LIGHTSEGSHIFT); - else if (colfunc == colfuncs[COLDRAWFUNC_FUZZY]) + else if (fuzzy) lightnum = LIGHTLEVELS-1; else lightnum = R_FakeFlat(frontsector, &tempsec, &templight, &templight, false) @@ -703,6 +700,14 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) vertflip = !vertflip; } + //SoM: Moved these up here so they are available for my lightlist calculations + // Lactozilla: Moved them back down + // This uses floating point math now, because the fixed-point imprecisions + // become more severe the bigger the texture is scaled. + double dwall_scaley = FixedToDouble(wall_scaley); + double scalestep = FixedToDouble(ds->scalestep) / dwall_scaley; + double yscale = (FixedToDouble(ds->scale1) + (x1 - ds->x1)*scalestep) / dwall_scaley; + thicksidecol = ffloortexturecolumn; wall_offsetx = ds->offsetx + sidedef->offsetx_mid; @@ -824,15 +829,41 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) rlight->botheight += rlight->botheightstep; } } - spryscale += rw_scalestep; + yscale += scalestep; continue; } - dc_iscale = FixedMul(0xffffffffu / (unsigned)spryscale, wall_scaley); - // Get data for the column col = R_GetColumn(texnum, ((thicksidecol[dc_x] + wall_offsetx) >> FRACBITS)); + spryscale = DoubleToFixed(yscale); + + // Eh. I tried fixing the scaling artifacts but it still wasn't perfect. + // So this checks if the column has gaps in it or not, and if it does, uses a version of the column drawers + // that prevents the artifacts from being visible. + // Note that if rendering fog then none of this matters because there's no texture mapping to be done + if (!fog) + { + dc_iscale = 0xffffffffu / (unsigned)spryscale; + + // Column has a single post and it matches the texture height, use regular column drawers + if (col->num_posts == 1 && col->posts[0].topdelta == 0 && col->posts[0].length == (unsigned)dc_texheight) + { + if (fuzzy) + colfunc = colfuncs[COLDRAWFUNC_FUZZY]; + else + colfunc = colfuncs[BASEDRAWFUNC]; + } + else + { + // Otherwise use column drawers with extra checks + if (fuzzy) + colfunc = R_DrawTranslucentColumnClamped_8; + else + colfunc = R_DrawColumnClamped_8; + } + } + // SoM: New code does not rely on R_DrawColumnShadowed_8 which // will (hopefully) put less strain on the stack. if (dc_numlights) @@ -947,7 +978,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (windowtop < windowbottom) colfunc_2s (col, lengthcol); - spryscale += rw_scalestep; + yscale += scalestep; continue; } @@ -966,7 +997,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) // draw the texture colfunc_2s (col, lengthcol); - spryscale += rw_scalestep; + yscale += scalestep; } colfunc = colfuncs[BASEDRAWFUNC]; diff --git a/src/r_things.c b/src/r_things.c index c46d81624..fb9757a9a 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -839,8 +839,10 @@ void R_DrawMaskedColumn(column_t *column, unsigned lengthcol) { post_t *post = &column->posts[i]; + dc_postlength = post->length; + INT32 topscreen = sprtopscreen + spryscale*post->topdelta; - INT32 bottomscreen = topscreen + spryscale*post->length; + INT32 bottomscreen = topscreen + spryscale*dc_postlength; dc_yl = (topscreen+FRACUNIT-1)>>FRACBITS; dc_yh = (bottomscreen-1)>>FRACBITS; @@ -909,10 +911,12 @@ void R_DrawFlippedMaskedColumn(column_t *column, unsigned lengthcol) if (!post->length) continue; - topdelta = lengthcol-post->length-post->topdelta; + dc_postlength = post->length; + + topdelta = lengthcol-dc_postlength-post->topdelta; topscreen = sprtopscreen + spryscale*topdelta; - bottomscreen = sprbotscreen == INT32_MAX ? topscreen + spryscale*post->length - : sprbotscreen + spryscale*post->length; + bottomscreen = sprbotscreen == INT32_MAX ? topscreen + spryscale*dc_postlength + : sprbotscreen + spryscale*dc_postlength; dc_yl = (topscreen+FRACUNIT-1)>>FRACBITS; dc_yh = (bottomscreen-1)>>FRACBITS; From df856aa823736124446a27ff48184c0b0f613053 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Tue, 7 May 2024 18:10:31 +0200 Subject: [PATCH 076/353] Do not access memory on misaligned addresses --- src/byteptr.h | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/byteptr.h b/src/byteptr.h index 8ab359c4c..4377fae57 100644 --- a/src/byteptr.h +++ b/src/byteptr.h @@ -11,9 +11,6 @@ /// \brief Macros to read/write from/to a UINT8 *, /// used for packet creation and such -#if defined (__alpha__) || defined (__arm__) || defined (__mips__) || defined (__ia64__) || defined (__clang__) -#define DEALIGNED -#endif #include "endian.h" @@ -21,7 +18,6 @@ // // Little-endian machines // -#ifdef DEALIGNED #define WRITEUINT8(p,b) do { UINT8 *p_tmp = (void *)p; const UINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; p = (void *)p_tmp; } while (0) #define WRITESINT8(p,b) do { SINT8 *p_tmp = (void *)p; const SINT8 tv = ( UINT8)(b); memcpy(p, &tv, sizeof( UINT8)); p_tmp++; p = (void *)p_tmp; } while (0) #define WRITEINT16(p,b) do { INT16 *p_tmp = (void *)p; const INT16 tv = ( INT16)(b); memcpy(p, &tv, sizeof( INT16)); p_tmp++; p = (void *)p_tmp; } while (0) @@ -31,20 +27,8 @@ #define WRITECHAR(p,b) do { char *p_tmp = (void *)p; const char tv = ( char)(b); memcpy(p, &tv, sizeof( char)); p_tmp++; p = (void *)p_tmp; } while (0) #define WRITEFIXED(p,b) do { fixed_t *p_tmp = (void *)p; const fixed_t tv = (fixed_t)(b); memcpy(p, &tv, sizeof(fixed_t)); p_tmp++; p = (void *)p_tmp; } while (0) #define WRITEANGLE(p,b) do { angle_t *p_tmp = (void *)p; const angle_t tv = (angle_t)(b); memcpy(p, &tv, sizeof(angle_t)); p_tmp++; p = (void *)p_tmp; } while (0) -#else -#define WRITEUINT8(p,b) do { UINT8 *p_tmp = ( UINT8 *)p; *p_tmp = ( UINT8)(b); p_tmp++; p = (void *)p_tmp; } while (0) -#define WRITESINT8(p,b) do { SINT8 *p_tmp = ( SINT8 *)p; *p_tmp = ( SINT8)(b); p_tmp++; p = (void *)p_tmp; } while (0) -#define WRITEINT16(p,b) do { INT16 *p_tmp = ( INT16 *)p; *p_tmp = ( INT16)(b); p_tmp++; p = (void *)p_tmp; } while (0) -#define WRITEUINT16(p,b) do { UINT16 *p_tmp = ( UINT16 *)p; *p_tmp = ( UINT16)(b); p_tmp++; p = (void *)p_tmp; } while (0) -#define WRITEINT32(p,b) do { INT32 *p_tmp = ( INT32 *)p; *p_tmp = ( INT32)(b); p_tmp++; p = (void *)p_tmp; } while (0) -#define WRITEUINT32(p,b) do { UINT32 *p_tmp = ( UINT32 *)p; *p_tmp = ( UINT32)(b); p_tmp++; p = (void *)p_tmp; } while (0) -#define WRITECHAR(p,b) do { char *p_tmp = ( char *)p; *p_tmp = ( char)(b); p_tmp++; p = (void *)p_tmp; } while (0) -#define WRITEFIXED(p,b) do { fixed_t *p_tmp = (fixed_t *)p; *p_tmp = (fixed_t)(b); p_tmp++; p = (void *)p_tmp; } while (0) -#define WRITEANGLE(p,b) do { angle_t *p_tmp = (angle_t *)p; *p_tmp = (angle_t)(b); p_tmp++; p = (void *)p_tmp; } while (0) -#endif #ifdef __GNUC__ -#ifdef DEALIGNED #define READUINT8(p) ({ UINT8 *p_tmp = (void *)p; UINT8 b; memcpy(&b, p, sizeof( UINT8)); p_tmp++; p = (void *)p_tmp; b; }) #define READSINT8(p) ({ SINT8 *p_tmp = (void *)p; SINT8 b; memcpy(&b, p, sizeof( SINT8)); p_tmp++; p = (void *)p_tmp; b; }) #define READINT16(p) ({ INT16 *p_tmp = (void *)p; INT16 b; memcpy(&b, p, sizeof( INT16)); p_tmp++; p = (void *)p_tmp; b; }) @@ -55,17 +39,6 @@ #define READFIXED(p) ({ fixed_t *p_tmp = (void *)p; fixed_t b; memcpy(&b, p, sizeof(fixed_t)); p_tmp++; p = (void *)p_tmp; b; }) #define READANGLE(p) ({ angle_t *p_tmp = (void *)p; angle_t b; memcpy(&b, p, sizeof(angle_t)); p_tmp++; p = (void *)p_tmp; b; }) #else -#define READUINT8(p) ({ UINT8 *p_tmp = ( UINT8 *)p; UINT8 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; }) -#define READSINT8(p) ({ SINT8 *p_tmp = ( SINT8 *)p; SINT8 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; }) -#define READINT16(p) ({ INT16 *p_tmp = ( INT16 *)p; INT16 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; }) -#define READUINT16(p) ({ UINT16 *p_tmp = ( UINT16 *)p; UINT16 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; }) -#define READINT32(p) ({ INT32 *p_tmp = ( INT32 *)p; INT32 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; }) -#define READUINT32(p) ({ UINT32 *p_tmp = ( UINT32 *)p; UINT32 b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; }) -#define READCHAR(p) ({ char *p_tmp = ( char *)p; char b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; }) -#define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; }) -#define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; }) -#endif -#else #define READUINT8(p) *(( UINT8 *)p)++ #define READSINT8(p) *(( SINT8 *)p)++ #define READINT16(p) *(( INT16 *)p)++ @@ -148,8 +121,6 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr) #define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b = readulong(p); p_tmp++; p = (void *)p_tmp; b; }) #endif //SRB2_BIG_ENDIAN -#undef DEALIGNED - #define WRITESTRINGN(p, s, n) { \ size_t tmp_i; \ \ From b3418cd6859d7669e7bbbb812c4dfbc0ecc9d5bd Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 19 May 2024 01:29:54 -0300 Subject: [PATCH 077/353] Fix #523 --- src/p_maputl.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 242bc559e..e9ec71eec 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -500,6 +500,20 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) INT32 texnum = R_GetTextureNum(side->midtexture); // make sure the texture is actually valid if (texnum) { + fixed_t midopentop, midopenbottom; + + if (linedef->flags & ML_NOSKEW) + { + // Use the sector's actual heights if the midtexture is not skewed + midopentop = min(front->ceilingheight, back->ceilingheight); + midopenbottom = max(front->floorheight, back->floorheight); + } + else + { + midopentop = opentop; + midopenbottom = openbottom; + } + // Get the midtexture's height texheight = textures[texnum]->height << FRACBITS; @@ -522,13 +536,13 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) #endif { if (linedef->flags & ML_WRAPMIDTEX && !side->repeatcnt) { // "infinite" repeat - texbottom = openbottom + side->rowoffset + side->offsety_mid; - textop = opentop + side->rowoffset + side->offsety_mid; + texbottom = midopenbottom + side->rowoffset + side->offsety_mid; + textop = midopentop + side->rowoffset + side->offsety_mid; } else if (linedef->flags & ML_MIDPEG) { - texbottom = openbottom + side->rowoffset + side->offsety_mid; + texbottom = midopenbottom + side->rowoffset + side->offsety_mid; textop = texbottom + texheight*(side->repeatcnt+1); } else { - textop = opentop + side->rowoffset + side->offsety_mid; + textop = midopentop + side->rowoffset + side->offsety_mid; texbottom = textop - texheight*(side->repeatcnt+1); } } @@ -539,11 +553,17 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) delta2 = abs(thingtop - texmid); if (delta1 > delta2) { // Below - if (opentop > texbottom) + if (opentop > texbottom) { opentop = texbottom; + if (linedef->flags & ML_NOSKEW) + opentopslope = NULL; // Object is not actually on a slope + } } else { // Above - if (openbottom < textop) + if (openbottom < textop) { openbottom = textop; + if (linedef->flags & ML_NOSKEW) + openbottomslope = NULL; // Object is not actually on a slope + } } } } From ccadfd8157e2b408c277232bc7c88e54e9f9c47b Mon Sep 17 00:00:00 2001 From: Refrag Date: Sun, 19 May 2024 09:08:00 +0200 Subject: [PATCH 078/353] Fix mouse buttons not working in menus with alwaysgrabmouse on This commit fixes #1257 by reintroducing something left out in commit 9f116c7c9ef29b77e42df8ccae94087c81fc3285. From my testing, it looks look the behavior is the exact same regarding the lua hook script that the original commit was fixing (#879). --- src/sdl/i_video.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 76fe172fc..249be61f6 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -382,6 +382,8 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code) static boolean ShouldIgnoreMouse(void) { + if (cv_alwaysgrabmouse.value) + return false; if (menuactive) return !M_MouseNeeded(); if (paused || con_destlines || chat_on) From 64df78228794a27612dbb848ade690804b41db3c Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 19 May 2024 12:20:03 +0200 Subject: [PATCH 079/353] Refactor TTY input handling --- src/dedicated/i_system.c | 78 ++++++++++++++-------------------------- src/sdl/i_system.c | 78 ++++++++++++++-------------------------- 2 files changed, 52 insertions(+), 104 deletions(-) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 858dfaf20..29a3e9511 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -705,10 +705,9 @@ typedef struct static feild_t tty_con; -// when printing general stuff to stdout stderr (Sys_Printf) -// we need to disable the tty console stuff -// this increments so we can recursively disable -static INT32 ttycon_hide = 0; +// lock to prevent clearing partial lines, since not everything +// printed ends on a newline. +static boolean ttycon_ateol = true; // some key codes that the terminal may be using // TTimo NOTE: I'm not sure how relevant this is static INT32 tty_erase; @@ -736,63 +735,31 @@ static inline void tty_FlushIn(void) // TTimo NOTE: it seems on some terminals just sending '\b' is not enough // so for now, in any case we send "\b \b" .. yeah well .. // (there may be a way to find out if '\b' alone would work though) +// Hanicef NOTE: using \b this way is unreliable because of terminal state, +// it's better to use \r to reset the cursor to the beginning of the +// line and clear from there. static void tty_Back(void) { - char key; - ssize_t d; - key = '\b'; - d = write(STDOUT_FILENO, &key, 1); - key = ' '; - d = write(STDOUT_FILENO, &key, 1); - key = '\b'; - d = write(STDOUT_FILENO, &key, 1); - (void)d; + write(STDOUT_FILENO, "\r", 1); + if (tty_con.cursor>0) + { + write(STDOUT_FILENO, tty_con.buffer, tty_con.cursor); + } + write(STDOUT_FILENO, " \b", 2); } static void tty_Clear(void) { size_t i; + write(STDOUT_FILENO, "\r", 1); if (tty_con.cursor>0) { for (i=0; i0); - ttycon_hide--; - if (ttycon_hide == 0 && tty_con.cursor) - { - for (i=0; i0) + { + write(STDOUT_FILENO, tty_con.buffer, tty_con.cursor); + } + write(STDOUT_FILENO, " \b", 2); } static void tty_Clear(void) { size_t i; + write(STDOUT_FILENO, "\r", 1); if (tty_con.cursor>0) { for (i=0; i0); - ttycon_hide--; - if (ttycon_hide == 0 && tty_con.cursor) - { - for (i=0; i Date: Sun, 19 May 2024 15:28:55 -0300 Subject: [PATCH 080/353] Fix #1248 --- src/p_maputl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 242bc559e..f00534d63 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -501,7 +501,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (texnum) { // Get the midtexture's height - texheight = textures[texnum]->height << FRACBITS; + texheight = FixedDiv(textureheight[texnum], abs(side->scaley_mid)); // Set texbottom and textop to the Z coordinates of the texture's boundaries #if 0 From 3a62ebbe3edbae3eacdadb0392a62412e25f089d Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 19 May 2024 18:56:14 -0300 Subject: [PATCH 081/353] Set correct slope for solid midtextures --- src/p_maputl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 242bc559e..18a15a928 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -539,11 +539,19 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) delta2 = abs(thingtop - texmid); if (delta1 > delta2) { // Below - if (opentop > texbottom) + if (opentop > texbottom) { opentop = texbottom; + if ((linedef->flags & ML_MIDPEG) != 0) { + opentopslope = openbottomslope; + } + } } else { // Above - if (openbottom < textop) + if (openbottom < textop) { openbottom = textop; + if ((linedef->flags & ML_MIDPEG) == 0) { + openbottomslope = opentopslope; + } + } } } } From e67e225ff2f796ba8cb78c9bacc5c91f052d5271 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 19 May 2024 20:40:40 -0300 Subject: [PATCH 082/353] Improve slope physics on solid middle textures --- src/p_local.h | 1 + src/p_map.c | 27 ++++++++-- src/p_maputl.c | 5 ++ src/p_maputl.h | 1 + src/p_mobj.c | 31 ++++++++---- src/p_mobj.h | 4 +- src/p_saveg.c | 9 +++- src/p_slopes.c | 130 +++++++++++++++++++++++++++++++++++++++++++------ src/p_slopes.h | 10 +++- src/p_user.c | 6 +-- 10 files changed, 189 insertions(+), 35 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 249c3cd4b..6a4aa241c 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -399,6 +399,7 @@ extern camera_t *mapcampointer; extern fixed_t tmx; extern fixed_t tmy; extern pslope_t *tmfloorslope, *tmceilingslope; +extern line_t *tmfloorline, *tmceilingline; /* cphipps 2004/08/30 */ extern void P_MapStart(void); diff --git a/src/p_map.c b/src/p_map.c index f97ddfa3c..aeeeda056 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -55,6 +55,7 @@ mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz mobj_t *tmhitthing; // the solid thing you bumped into (for collisions) ffloor_t *tmfloorrover, *tmceilingrover; pslope_t *tmfloorslope, *tmceilingslope; +line_t *tmfloorline, *tmceilingline; // keep track of the line that lowers the ceiling, // so missiles don't explode against sky hack walls @@ -1760,6 +1761,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmfloorz = thing->z + thing->height; tmfloorrover = NULL; tmfloorslope = NULL; + tmfloorline = NULL; } return CHECKTHING_COLLIDE; } @@ -1779,6 +1781,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmfloorz = tmceilingz = topz; // block while in air tmceilingrover = NULL; tmceilingslope = NULL; + tmceilingline = NULL; tmfloorthing = thing; // needed for side collision collide = CHECKTHING_COLLIDE; @@ -1788,6 +1791,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmceilingz = topz; tmceilingrover = NULL; tmceilingslope = NULL; + tmceilingline = NULL; tmfloorthing = thing; // thing we may stand on collide = CHECKTHING_COLLIDE; @@ -1805,6 +1809,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmceilingz = thing->z; tmceilingrover = NULL; tmceilingslope = NULL; + tmceilingline = NULL; } return CHECKTHING_COLLIDE; } @@ -1824,6 +1829,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmfloorz = tmceilingz = topz; // block while in air tmfloorrover = NULL; tmfloorslope = NULL; + tmfloorline = NULL; tmfloorthing = thing; // needed for side collision collide = CHECKTHING_COLLIDE; @@ -1833,6 +1839,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmfloorz = topz; tmfloorrover = NULL; tmfloorslope = NULL; + tmfloorline = NULL; tmfloorthing = thing; // thing we may stand on collide = CHECKTHING_COLLIDE; @@ -2000,6 +2007,7 @@ static boolean PIT_CheckLine(line_t *ld) ceilingline = ld; tmceilingrover = openceilingrover; tmceilingslope = opentopslope; + tmceilingline = opentopline; } if (openbottom > tmfloorz) @@ -2007,6 +2015,7 @@ static boolean PIT_CheckLine(line_t *ld) tmfloorz = openbottom; tmfloorrover = openfloorrover; tmfloorslope = openbottomslope; + tmfloorline = openbottomline; } if (highceiling > tmdrpoffceilz) @@ -2057,6 +2066,8 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight; tmfloorrover = NULL; tmceilingrover = NULL; + tmfloorline = NULL; + tmceilingline = NULL; tmfloorslope = newsubsec->sector->f_slope; tmceilingslope = newsubsec->sector->c_slope; @@ -2642,6 +2653,8 @@ boolean PIT_PushableMoved(mobj_t *thing) ffloor_t *oldceilrover = tmceilingrover; pslope_t *oldfslope = tmfloorslope; pslope_t *oldcslope = tmceilingslope; + line_t *oldfline = tmfloorline; + line_t *oldcline = tmceilingline; // Move the player P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true); @@ -2658,6 +2671,8 @@ boolean PIT_PushableMoved(mobj_t *thing) tmceilingrover = oldceilrover; tmfloorslope = oldfslope; tmceilingslope = oldcslope; + tmfloorline = oldfline; + tmceilingline = oldcline; thing->momz = stand->momz; } else @@ -2899,11 +2914,12 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) // Assign thing's standingslope if needed if (thing->z <= tmfloorz && !(thing->eflags & MFE_VERTICALFLIP)) { if (!startingonground && tmfloorslope) - P_HandleSlopeLanding(thing, tmfloorslope); + P_HandleSlopeLanding(thing, tmfloorslope, tmfloorline); if (thing->momz <= 0) { thing->standingslope = tmfloorslope; + thing->standingline = tmfloorline; P_SetPitchRollFromSlope(thing, thing->standingslope); if (thing->momz == 0 && thing->player && !startingonground) @@ -2912,11 +2928,12 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) } else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) { if (!startingonground && tmceilingslope) - P_HandleSlopeLanding(thing, tmceilingslope); + P_HandleSlopeLanding(thing, tmceilingslope, tmceilingline); if (thing->momz >= 0) { thing->standingslope = tmceilingslope; + thing->standingline = tmceilingline; P_SetPitchRollFromSlope(thing, thing->standingslope); if (thing->momz == 0 && thing->player && !startingonground) @@ -2924,8 +2941,12 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) } } } - else // don't set standingslope if you're not going to clip against it + else + { + // don't set standingslope or standingline if you're not going to clip against them thing->standingslope = NULL; + thing->standingline = NULL; + } thing->x = x; thing->y = y; diff --git a/src/p_maputl.c b/src/p_maputl.c index 18a15a928..7de5b5369 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -280,6 +280,7 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1) fixed_t opentop, openbottom, openrange, lowfloor, highceiling; pslope_t *opentopslope, *openbottomslope; ffloor_t *openfloorrover, *openceilingrover; +line_t *opentopline, *openbottomline; // P_CameraLineOpening // P_LineOpening, but for camera @@ -440,6 +441,8 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) I_Assert(back != NULL); openfloorrover = openceilingrover = NULL; + opentopline = openbottomline = NULL; + if (linedef->polyobj) { // set these defaults so that polyobjects don't interfere with collision above or below them @@ -544,6 +547,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if ((linedef->flags & ML_MIDPEG) != 0) { opentopslope = openbottomslope; } + opentopline = linedef; } } else { // Above if (openbottom < textop) { @@ -551,6 +555,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if ((linedef->flags & ML_MIDPEG) == 0) { openbottomslope = opentopslope; } + openbottomline = linedef; } } } diff --git a/src/p_maputl.h b/src/p_maputl.h index e894c08a2..ca29fc203 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -57,6 +57,7 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y); extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling; extern pslope_t *opentopslope, *openbottomslope; extern ffloor_t *openfloorrover, *openceilingrover; +extern line_t *opentopline, *openbottomline; void P_LineOpening(line_t *plinedef, mobj_t *mobj); diff --git a/src/p_mobj.c b/src/p_mobj.c index 9cdd2628d..221149f70 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1672,6 +1672,7 @@ void P_XYMovement(mobj_t *mo) fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls boolean moved; pslope_t *oldslope = NULL; + line_t *oldstandingline = NULL; vector3_t slopemom = {0,0,0}; fixed_t predictedz = 0; @@ -1704,7 +1705,10 @@ void P_XYMovement(mobj_t *mo) oldy = mo->y; if (mo->flags & MF_NOCLIPHEIGHT) + { mo->standingslope = NULL; + mo->standingline = NULL; + } // adjust various things based on slope if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8) { @@ -1716,7 +1720,7 @@ void P_XYMovement(mobj_t *mo) slopemom.x = xmove; slopemom.y = ymove; slopemom.z = 0; - P_QuantizeMomentumToSlope(&slopemom, mo->standingslope); + P_QuantizeObjectMomentumToSlope(mo, &slopemom); xmove = slopemom.x; ymove = slopemom.y; @@ -1724,6 +1728,7 @@ void P_XYMovement(mobj_t *mo) predictedz = mo->z + slopemom.z; // We'll use this later... oldslope = mo->standingslope; + oldstandingline = mo->standingline; } } else if (P_IsObjectOnGround(mo) && !mo->momz) predictedz = mo->z; @@ -1799,12 +1804,16 @@ void P_XYMovement(mobj_t *mo) { // try to slide along it // Wall transfer part 1. pslope_t *transferslope = NULL; + line_t *transferline = NULL; fixed_t transfermomz = 0; if (oldslope && (P_MobjFlip(mo)*(predictedz - mo->z) > 0)) // Only for moving up (relative to gravity), otherwise there's a failed launch when going down slopes and hitting walls { + angle_t zangle; transferslope = ((mo->standingslope) ? mo->standingslope : oldslope); - if (((transferslope->zangle < ANGLE_180) ? transferslope->zangle : InvAngle(transferslope->zangle)) >= ANGLE_45) // Prevent some weird stuff going on on shallow slopes. - transfermomz = P_GetWallTransferMomZ(mo, transferslope); + transferline = ((mo->standingline) ? mo->standingline : oldstandingline); + zangle = P_GetStandingSlopeZAngle(transferslope, transferline); + if (((zangle < ANGLE_180) ? zangle : InvAngle(zangle)) >= ANGLE_45) // Prevent some weird stuff going on on shallow slopes. + transfermomz = P_GetWallTransferMomZ(mo, transferslope, transferline); } P_SlideMove(mo); @@ -1817,7 +1826,7 @@ void P_XYMovement(mobj_t *mo) { angle_t relation; // Scale transfer momentum based on how head-on it is to the slope. if (mo->momx || mo->momy) // "Guess" the angle of the wall you hit using new momentum - relation = transferslope->xydirection - R_PointToAngle2(0, 0, mo->momx, mo->momy); + relation = P_GetStandingSlopeDirection(transferslope, transferline) - R_PointToAngle2(0, 0, mo->momx, mo->momy); else // Give it for free, I guess. relation = ANGLE_90; transfermomz = FixedMul(transfermomz, @@ -1826,6 +1835,7 @@ void P_XYMovement(mobj_t *mo) { mo->momz = transfermomz; mo->standingslope = NULL; + mo->standingline = NULL; if (player) { player->powers[pw_justlaunched] = 2; @@ -1875,7 +1885,7 @@ void P_XYMovement(mobj_t *mo) oldangle = FixedMul((signed)oldslope->zangle, FINECOSINE((moveangle - oldslope->xydirection) >> ANGLETOFINESHIFT)); if (mo->standingslope) - newangle = FixedMul((signed)mo->standingslope->zangle, FINECOSINE((moveangle - mo->standingslope->xydirection) >> ANGLETOFINESHIFT)); + newangle = FixedMul((signed)P_GetObjectStandingSlopeZAngle(mo), FINECOSINE((moveangle - P_GetObjectStandingSlopeDirection(mo)) >> ANGLETOFINESHIFT)); else newangle = 0; @@ -1899,7 +1909,7 @@ void P_XYMovement(mobj_t *mo) } } else if (moved && mo->standingslope && predictedz) { angle_t moveangle = R_PointToAngle2(0, 0, mo->momx, mo->momy); - angle_t newangle = FixedMul((signed)mo->standingslope->zangle, FINECOSINE((moveangle - mo->standingslope->xydirection) >> ANGLETOFINESHIFT)); + angle_t newangle = FixedMul((signed)P_GetObjectStandingSlopeZAngle(mo), FINECOSINE((moveangle - P_GetObjectStandingSlopeDirection(mo)) >> ANGLETOFINESHIFT)); /*CONS_Printf("flat to angle %f - predicted z of %f\n", FIXED_TO_FLOAT(AngleFixed(ANGLE_MAX-newangle)), @@ -2432,8 +2442,9 @@ boolean P_ZMovement(mobj_t *mo) if (((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) && (mo->type != MT_STEAM)) { mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope; + mo->standingline = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingline : tmfloorline; P_SetPitchRollFromSlope(mo, mo->standingslope); - P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope); + P_ReverseQuantizeObjectMomentumToSlope(mo, &mom); } // hit the floor @@ -2579,7 +2590,7 @@ boolean P_ZMovement(mobj_t *mo) mom.z = tmfloorthing->momz; if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above. - P_QuantizeMomentumToSlope(&mom, mo->standingslope); + P_QuantizeObjectMomentumToSlope(mo, &mom); } mo->momx = mom.x; @@ -2825,7 +2836,9 @@ void P_PlayerZMovement(mobj_t *mo) if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) { // Handle landing on slope during Z movement - P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)); + P_HandleSlopeLanding(mo, + (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope), + (mo->eflags & MFE_VERTICALFLIP ? tmceilingline : tmfloorline)); } if (P_MobjFlip(mo)*mo->momz < 0) // falling diff --git a/src/p_mobj.h b/src/p_mobj.h index 2f013a2f3..ae4c5a51d 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -412,7 +412,9 @@ typedef struct mobj_s INT32 cusval; INT32 cvmem; - struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?) + struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?) (it does) + + struct line_s *standingline; // The line that the object is standing on boolean resetinterp; // if true, some fields should not be interpolated (see R_InterpolateMobjState implementation) boolean colorized; // Whether the mobj uses the rainbow colormap diff --git a/src/p_saveg.c b/src/p_saveg.c index 5e4d6d076..675d68acd 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1746,7 +1746,8 @@ typedef enum MD2_DISPOFFSET = 1<<23, MD2_DRAWONLYFORPLAYER = 1<<24, MD2_DONTDRAWFORVIEWMOBJ = 1<<25, - MD2_TRANSLATION = 1<<26 + MD2_TRANSLATION = 1<<26, + MD2_STANDINGLINE = 1<<27 } mobj_diff2_t; typedef enum @@ -1953,6 +1954,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 |= MD2_CEILINGROVER; if (mobj->standingslope) diff2 |= MD2_SLOPE; + if (mobj->standingline) + diff2 |= MD2_STANDINGLINE; if (mobj->colorized) diff2 |= MD2_COLORIZED; if (mobj->mirrored) @@ -2125,6 +2128,8 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEUINT32(save_p, mobj->hprev->mobjnum); if (diff2 & MD2_SLOPE) WRITEUINT16(save_p, mobj->standingslope->id); + if (diff2 & MD2_STANDINGLINE) + WRITEUINT32(save_p, SaveLine(mobj->standingline)); if (diff2 & MD2_COLORIZED) WRITEUINT8(save_p, mobj->colorized); if (diff2 & MD2_MIRRORED) @@ -3181,6 +3186,8 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p); if (diff2 & MD2_SLOPE) mobj->standingslope = P_SlopeById(READUINT16(save_p)); + if (diff2 & MD2_STANDINGLINE) + mobj->standingline = LoadLine(READUINT32(save_p)); if (diff2 & MD2_COLORIZED) mobj->colorized = READUINT8(save_p); if (diff2 & MD2_MIRRORED) diff --git a/src/p_slopes.c b/src/p_slopes.c index e75d36ede..745be2eac 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -859,11 +859,10 @@ fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y) // When given a vector, rotates it and aligns it to a slope void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) { - vector3_t axis; // Fuck you, C90. - if (slope->flags & SL_NOPHYSICS) return; // No physics, no quantizing. + vector3_t axis; axis.x = -slope->d.y; axis.y = slope->d.x; axis.z = 0; @@ -877,9 +876,91 @@ void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) // When given a vector, rotates and aligns it to a flat surface (from being relative to a given slope) void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) { - slope->zangle = InvAngle(slope->zangle); - P_QuantizeMomentumToSlope(momentum, slope); - slope->zangle = InvAngle(slope->zangle); + if (slope->flags & SL_NOPHYSICS) + return; // No physics, no quantizing. + + vector3_t axis; + axis.x = -slope->d.y; + axis.y = slope->d.x; + axis.z = 0; + + FV3_Rotate(momentum, &axis, InvAngle(slope->zangle) >> ANGLETOFINESHIFT); +} + +angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line) +{ + angle_t zangle = slope->zangle; + + if (line) + { + zangle = R_PointToAngle2(0, P_GetSlopeZAt(slope, line->v1->x, line->v1->y), + R_PointToDist2(line->v1->x, line->v1->y, line->v2->x, line->v2->y), P_GetSlopeZAt(slope, line->v2->x, line->v2->y)); + } + + return zangle; +} + +angle_t P_GetStandingSlopeDirection(pslope_t *slope, line_t *line) +{ + angle_t xydirection = slope->xydirection; + + if (line) + { + xydirection = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y); + } + + return xydirection; +} + +angle_t P_GetObjectStandingSlopeZAngle(mobj_t *mo) +{ + return P_GetStandingSlopeZAngle(mo->standingslope, mo->standingline); +} + +angle_t P_GetObjectStandingSlopeDirection(mobj_t *mo) +{ + return P_GetStandingSlopeDirection(mo->standingslope, mo->standingline); +} + +static void QuantizeMomentumToSlope(pslope_t *slope, line_t *line, vector3_t *momentum, boolean reverse) +{ + if (!slope || slope->flags & SL_NOPHYSICS) + return; + + angle_t zangle = P_GetStandingSlopeZAngle(slope, line); + + if (reverse) + zangle = InvAngle(zangle); + + vector3_t axis; + axis.z = 0; + + if (line) + { + fixed_t len = R_PointToDist2(0, 0, line->dx, line->dy); + axis.x = FixedDiv(line->dy, len); + axis.y = -FixedDiv(line->dx, len); + } + else + { + axis.x = -slope->d.y; + axis.y = slope->d.x; + } + + FV3_Rotate(momentum, &axis, zangle >> ANGLETOFINESHIFT); +} + +// Given a vector of the object's momentum, rotates it and aligns it to the slope the object is standing on +void P_QuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum) +{ + QuantizeMomentumToSlope(mo->standingslope, mo->standingline, momentum, false); +} + +// Given a vector of the object's momentum, rotates and aligns it to a flat surface +// (from being relative to the slope the object is standing on) +void P_ReverseQuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum) +{ + QuantizeMomentumToSlope(mo->standingslope, mo->standingline, momentum, true); } // @@ -899,7 +980,7 @@ void P_SlopeLaunch(mobj_t *mo) slopemom.x = mo->momx; slopemom.y = mo->momy; slopemom.z = mo->momz*2; - P_QuantizeMomentumToSlope(&slopemom, mo->standingslope); + P_QuantizeObjectMomentumToSlope(mo, &slopemom); mo->momx = slopemom.x; mo->momy = slopemom.y; @@ -919,7 +1000,7 @@ void P_SlopeLaunch(mobj_t *mo) // It would be nice to have a single function that does everything necessary for slope-to-wall transfer. // However, it needs to be seperated out in P_XYMovement to take into account momentum before and after hitting the wall. // This just performs the necessary calculations for getting the base vertical momentum; the horizontal is already reasonably calculated by P_SlideMove. -fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope) +fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope, line_t *line) { vector3_t slopemom, axis; angle_t ang; @@ -927,18 +1008,30 @@ fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope) if (slope->flags & SL_NOPHYSICS) return 0; + angle_t zangle = P_GetStandingSlopeZAngle(slope, line); + // If there's physics, time for launching. // Doesn't kill the vertical momentum as much as P_SlopeLaunch does. - ang = slope->zangle + ANG15*((slope->zangle > 0) ? 1 : -1); + ang = zangle + ANG15*((zangle > 0) ? 1 : -1); if (ang > ANGLE_90 && ang < ANGLE_180) - ang = ((slope->zangle > 0) ? ANGLE_90 : InvAngle(ANGLE_90)); // hard cap of directly upwards + ang = ((zangle > 0) ? ANGLE_90 : InvAngle(ANGLE_90)); // hard cap of directly upwards slopemom.x = mo->momx; slopemom.y = mo->momy; slopemom.z = 3*(mo->momz/2); - axis.x = -slope->d.y; - axis.y = slope->d.x; + if (line) + { + fixed_t len = R_PointToDist2(0, 0, line->dx, line->dy); + axis.x = FixedDiv(line->dy, len); + axis.y = -FixedDiv(line->dx, len); + } + else + { + axis.x = -slope->d.y; + axis.y = slope->d.x; + } + axis.z = 0; FV3_Rotate(&slopemom, &axis, ang >> ANGLETOFINESHIFT); @@ -947,7 +1040,7 @@ fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope) } // Function to help handle landing on slopes -void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) +void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line) { vector3_t mom; // Ditto. if (slope->flags & SL_NOPHYSICS || (slope->normal.x == 0 && slope->normal.y == 0)) { // No physics, no need to make anything complicated. @@ -966,12 +1059,13 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) mom.y = thing->momy; mom.z = thing->momz*2; - P_ReverseQuantizeMomentumToSlope(&mom, slope); + QuantizeMomentumToSlope(slope, line, &mom, true); if (P_MobjFlip(thing)*mom.z < 0) { // falling, land on slope thing->momx = mom.x; thing->momy = mom.y; thing->standingslope = slope; + thing->standingline = line; P_SetPitchRollFromSlope(thing, slope); if (!thing->player || !(thing->player->pflags & PF_BOUNCING)) thing->momz = -P_MobjFlip(thing); @@ -983,6 +1077,7 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) void P_ButteredSlope(mobj_t *mo) { fixed_t thrust; + angle_t zangle, xydirection; if (!mo->standingslope) return; @@ -1001,12 +1096,15 @@ void P_ButteredSlope(mobj_t *mo) return; // Allow the player to stand still on slopes below a certain steepness } - thrust = FINESINE(mo->standingslope->zangle>>ANGLETOFINESHIFT) * 3 / 2 * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); + zangle = P_GetStandingSlopeZAngle(mo->standingslope, mo->standingline); + xydirection = P_GetStandingSlopeDirection(mo->standingslope, mo->standingline); + + thrust = FINESINE(zangle>>ANGLETOFINESHIFT) * 3 / 2 * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); if (mo->player && (mo->player->pflags & PF_SPINNING)) { fixed_t mult = 0; if (mo->momx || mo->momy) { - angle_t angle = R_PointToAngle2(0, 0, mo->momx, mo->momy) - mo->standingslope->xydirection; + angle_t angle = R_PointToAngle2(0, 0, mo->momx, mo->momy) - xydirection; if (P_MobjFlip(mo) * mo->standingslope->zdelta < 0) angle ^= ANGLE_180; @@ -1027,5 +1125,5 @@ void P_ButteredSlope(mobj_t *mo) // ... and its friction against the ground for good measure (divided by original friction to keep behaviour for normal slopes the same). thrust = FixedMul(thrust, FixedDiv(mo->friction, ORIG_FRICTION)); - P_Thrust(mo, mo->standingslope->xydirection, thrust); + P_Thrust(mo, xydirection, thrust); } diff --git a/src/p_slopes.h b/src/p_slopes.h index fdc07f67e..f33053ac1 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -84,9 +84,15 @@ fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y); // Lots of physics-based bullshit void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope); void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope); +void P_QuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum); +void P_ReverseQuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum); +angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line); +angle_t P_GetStandingSlopeDirection(pslope_t *slope, line_t *line); +angle_t P_GetObjectStandingSlopeZAngle(mobj_t *mo); +angle_t P_GetObjectStandingSlopeDirection(mobj_t *mo); void P_SlopeLaunch(mobj_t *mo); -fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope); -void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope); +fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope, line_t *line); +void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line); void P_ButteredSlope(mobj_t *mo); pslope_t *P_MakeSlopeViaEquationConstants(const double a, const double b, const double c, const double d); diff --git a/src/p_user.c b/src/p_user.c index 7cd128cf0..1782c5386 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6257,15 +6257,15 @@ static void P_3dMovement(player_t *player) && player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) { // Factor thrust to slope, but only for the part pushing up it! // The rest is unaffected. - angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection; + angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-P_GetObjectStandingSlopeDirection(player->mo); if (player->mo->standingslope->zdelta < 0) { // Direction goes down, so thrustangle needs to face toward if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270) { - P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope); + P_QuantizeObjectMomentumToSlope(player->mo, &totalthrust); } } else { // Direction goes up, so thrustangle needs to face away if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270) { - P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope); + P_QuantizeObjectMomentumToSlope(player->mo, &totalthrust); } } } From 3a09c475c71462f923a6a1c500901e450fa027b7 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 19 May 2024 22:53:00 -0300 Subject: [PATCH 083/353] Add comments --- src/p_slopes.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 745be2eac..1d53bfcf4 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -852,7 +852,6 @@ fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y) return light->slope ? P_GetSlopeZAt(light->slope, x, y) : light->height; } - // // P_QuantizeMomentumToSlope // @@ -887,6 +886,8 @@ void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) FV3_Rotate(momentum, &axis, InvAngle(slope->zangle) >> ANGLETOFINESHIFT); } +// Returns the angle of the slope plane. +// If line is provided, a new calculation is performed as if the slope were on the top or bottom of a solid midtexture. angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line) { angle_t zangle = slope->zangle; @@ -900,28 +901,23 @@ angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line) return zangle; } +// Returns the angle of the projected normal of slope plane. +// If line is provided, this simply returns the line's angle. angle_t P_GetStandingSlopeDirection(pslope_t *slope, line_t *line) { angle_t xydirection = slope->xydirection; if (line) { - xydirection = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y); + xydirection = line->angle; } return xydirection; } -angle_t P_GetObjectStandingSlopeZAngle(mobj_t *mo) -{ - return P_GetStandingSlopeZAngle(mo->standingslope, mo->standingline); -} - -angle_t P_GetObjectStandingSlopeDirection(mobj_t *mo) -{ - return P_GetStandingSlopeDirection(mo->standingslope, mo->standingline); -} - +// When given a vector, rotates it and aligns it to either a slope, or a flat surface relative to the slope. +// If line is provided, this calculation is performed as if the slope were on the top or bottom of a solid midtexture. +// See also: P_QuantizeMomentumToSlope static void QuantizeMomentumToSlope(pslope_t *slope, line_t *line, vector3_t *momentum, boolean reverse) { if (!slope || slope->flags & SL_NOPHYSICS) @@ -963,6 +959,18 @@ void P_ReverseQuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum) QuantizeMomentumToSlope(mo->standingslope, mo->standingline, momentum, true); } +// Wrapper for P_GetStandingSlopeZAngle. +angle_t P_GetObjectStandingSlopeZAngle(mobj_t *mo) +{ + return P_GetStandingSlopeZAngle(mo->standingslope, mo->standingline); +} + +// Wrapper for P_GetObjectStandingSlopeDirection. +angle_t P_GetObjectStandingSlopeDirection(mobj_t *mo) +{ + return P_GetStandingSlopeDirection(mo->standingslope, mo->standingline); +} + // // P_SlopeLaunch // @@ -1042,7 +1050,6 @@ fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope, line_t *line) // Function to help handle landing on slopes void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line) { - vector3_t mom; // Ditto. if (slope->flags & SL_NOPHYSICS || (slope->normal.x == 0 && slope->normal.y == 0)) { // No physics, no need to make anything complicated. if (P_MobjFlip(thing)*(thing->momz) < 0) // falling, land on slope { @@ -1055,6 +1062,7 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line) return; } + vector3_t mom; mom.x = thing->momx; mom.y = thing->momy; mom.z = thing->momz*2; From a19f843a3ecae75c2963918675c66c7dcae89d73 Mon Sep 17 00:00:00 2001 From: MIDIMan Date: Sun, 19 May 2024 22:21:09 -0400 Subject: [PATCH 084/353] Implement Lactozilla's suggestions and add 3D model support --- src/hardware/hw_md2.c | 7 +++++++ src/p_saveg.c | 2 +- src/r_things.c | 17 +++++++---------- src/r_things.h | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 0bb8de851..d16700909 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1285,6 +1285,11 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) // Apparently people don't like jump frames like that, so back it goes //if (tics > durs) //durs = tics; + + // Make linkdraw objects use their tracer's alpha value + fixed_t newalpha = spr->mobj->alpha; + if ((spr->mobj->flags2 & MF2_LINKDRAW) && spr->mobj->tracer) + newalpha = spr->mobj->tracer->alpha; INT32 blendmode; if (spr->mobj->frame & FF_BLENDMASK) @@ -1299,6 +1304,8 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) Surf.PolyColor.s.alpha = (spr->mobj->flags2 & MF2_SHADOW) ? 0x40 : 0xff; Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode); } + + Surf.PolyColor.s.alpha = FixedMul(newalpha, Surf.PolyColor.s.alpha); // don't forget to enable the depth test because we can't do this // like before: model polygons are not sorted diff --git a/src/p_saveg.c b/src/p_saveg.c index 1aed73784..219410bb6 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1990,7 +1990,7 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 |= MD2_DONTDRAWFORVIEWMOBJ; if (mobj->dispoffset != mobj->info->dispoffset) diff2 |= MD2_DISPOFFSET; - if (mobj->alpha < FRACUNIT) + if (mobj->alpha != FRACUNIT) diff2 |= MD2_ALPHA; if (diff2 != 0) diff --git a/src/r_things.c b/src/r_things.c index 41e1c144e..afa861832 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -992,12 +992,10 @@ UINT8 *R_GetTranslationForThing(mobj_t *mobj, skincolornum_t color, UINT16 trans return NULL; } -transnum_t R_GetTransmapFromAlpha(fixed_t alpha, transnum_t transmap) +// Based off of R_GetLinedefTransTable +transnum_t R_GetThingTransTable(fixed_t alpha, transnum_t transmap) { - INT32 value = 10 - transmap; - value = 10 - (FixedCeil(alpha * value)>>FRACBITS); - - return value; + return (20*(FRACUNIT - ((alpha * (10 - transmap))/10) - 1) + FRACUNIT) >> (FRACBITS+1); } // @@ -1505,7 +1503,7 @@ static void R_ProjectDropShadow(mobj_t *thing, vissprite_t *vis, fixed_t scale, floordiff = abs((isflipped ? interp.height : 0) + interp.z - groundz); trans = floordiff / (100*FRACUNIT) + 3; - trans = R_GetTransmapFromAlpha(thing->alpha, trans); + trans = R_GetThingTransTable(thing->alpha, trans); if (trans >= 9) return; scalemul = FixedMul(FRACUNIT - floordiff/640, scale); @@ -2194,9 +2192,9 @@ static void R_ProjectSprite(mobj_t *thing) trans = 0; if ((oldthing->flags2 & MF2_LINKDRAW) && oldthing->tracer) - trans = R_GetTransmapFromAlpha(oldthing->tracer->alpha, trans); + trans = R_GetThingTransTable(oldthing->tracer->alpha, trans); else - trans = R_GetTransmapFromAlpha(oldthing->alpha, trans); + trans = R_GetThingTransTable(oldthing->alpha, trans); // Check if this sprite needs to be rendered like a shadow shadowdraw = (!!(thing->renderflags & RF_SHADOWDRAW) && !(papersprite || splat)); @@ -3658,8 +3656,7 @@ boolean R_ThingVisible (mobj_t *thing) (thing->sprite == SPR_NULL) || // Don't draw null-sprites (thing->flags2 & MF2_DONTDRAW) || // Don't draw MF2_LINKDRAW objects (thing->drawonlyforplayer && thing->drawonlyforplayer != viewplayer) || // Don't draw other players' personal objects - ((rendermode == render_soft && R_GetTransmapFromAlpha(thing->alpha, (thing->frame & FF_TRANSMASK)>>FF_TRANSSHIFT) >= 10) || - (rendermode == render_opengl && thing->alpha == 0)) || + (!R_BlendLevelVisible(thing->blendmode, R_GetThingTransTable(thing->alpha, 0))) || (!P_MobjWasRemoved(r_viewmobj) && ( (r_viewmobj == thing) || // Don't draw first-person players or awayviewmobj objects (r_viewmobj->player && r_viewmobj->player->followmobj == thing) || // Don't draw first-person players' followmobj diff --git a/src/r_things.h b/src/r_things.h index 530898917..55ab71ec3 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -93,7 +93,7 @@ boolean R_ThingIsFullDark (mobj_t *thing); boolean R_ThingIsFlashing (mobj_t *thing); UINT8 *R_GetTranslationForThing(mobj_t *mobj, skincolornum_t color, UINT16 translation); -transnum_t R_GetTransmapFromAlpha(fixed_t alpha, transnum_t transmap); +transnum_t R_GetThingTransTable(fixed_t alpha, transnum_t transmap); void R_ThingOffsetOverlay (mobj_t *thing, fixed_t *outx, fixed_t *outy); From 4502e67f0f2c8bcfda5ddd35345fe2edac2ac696 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Mon, 20 May 2024 02:48:38 -0300 Subject: [PATCH 085/353] Ignore flats when loading patches --- src/console.c | 6 +- src/d_main.c | 4 +- src/f_finale.c | 8 +- src/hu_stuff.c | 2 +- src/m_menu.c | 10 +- src/st_stuff.c | 6 +- src/w_wad.c | 271 ++++++++++++++++++++++++++++++++++++++++++------- src/w_wad.h | 6 ++ 8 files changed, 256 insertions(+), 57 deletions(-) diff --git a/src/console.c b/src/console.c index 874fc2a4f..d3320fbfc 100644 --- a/src/console.c +++ b/src/console.c @@ -1730,12 +1730,12 @@ static void CON_DrawBackpic(void) // Get the lumpnum for CONSBACK, STARTUP (Only during game startup) or fallback into MISSING. if (con_startup) - piclump = W_CheckNumForName("STARTUP"); + piclump = W_CheckNumForPatchName("STARTUP"); else - piclump = W_CheckNumForName("CONSBACK"); + piclump = W_CheckNumForPatchName("CONSBACK"); if (piclump == LUMPERROR) - piclump = W_GetNumForName("MISSING"); + piclump = W_GetNumForPatchName("MISSING"); // Cache the patch. con_backpic = W_CachePatchNum(piclump, PU_PATCH); diff --git a/src/d_main.c b/src/d_main.c index c139650d1..afa10ae3c 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -758,9 +758,9 @@ void D_SRB2Loop(void) /* Smells like a hack... Don't fade Sonic's ass into the title screen. */ if (gamestate != GS_TITLESCREEN) { - gstartuplumpnum = W_CheckNumForName("STARTUP"); + gstartuplumpnum = W_CheckNumForPatchName("STARTUP"); if (gstartuplumpnum == LUMPERROR) - gstartuplumpnum = W_GetNumForName("MISSING"); + gstartuplumpnum = W_GetNumForPatchName("MISSING"); V_DrawScaledPatch(0, 0, 0, W_CachePatchNum(gstartuplumpnum, PU_PATCH)); } diff --git a/src/f_finale.c b/src/f_finale.c index 9ff50147e..810af4e82 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -2336,7 +2336,7 @@ void F_SkyScroll(const char *patchname) } #define LOADTTGFX(arr, name, maxf) \ -lumpnum = W_CheckNumForName(name); \ +lumpnum = W_CheckNumForPatchName(name); \ if (lumpnum != LUMPERROR) \ { \ arr[0] = W_CachePatchName(name, PU_PATCH_LOWPRIORITY); \ @@ -2350,7 +2350,7 @@ else if (strlen(name) <= 6) \ { \ sprintf(&lumpname[cnt], "%.2hu", (UINT16)(i+1)); \ lumpname[8] = 0; \ - lumpnum = W_CheckNumForName(lumpname); \ + lumpnum = W_CheckNumForPatchName(lumpname); \ if (lumpnum != LUMPERROR) \ arr[i] = W_CachePatchName(lumpname, PU_PATCH_LOWPRIORITY); \ else \ @@ -4116,7 +4116,7 @@ static void F_GetPageTextGeometry(UINT8 *pagelines, boolean *rightside, INT32 *b // reuse: // cutnum -> promptnum // scenenum -> pagenum - lumpnum_t iconlump = W_CheckNumForName(textprompts[cutnum]->page[scenenum].iconname); + lumpnum_t iconlump = W_CheckNumForPatchName(textprompts[cutnum]->page[scenenum].iconname); *pagelines = textprompts[cutnum]->page[scenenum].lines ? textprompts[cutnum]->page[scenenum].lines : 4; *rightside = (iconlump != LUMPERROR && textprompts[cutnum]->page[scenenum].rightside); @@ -4508,7 +4508,7 @@ void F_TextPromptDrawer(void) if (!promptactive) return; - iconlump = W_CheckNumForName(textprompts[cutnum]->page[scenenum].iconname); + iconlump = W_CheckNumForPatchName(textprompts[cutnum]->page[scenenum].iconname); F_GetPageTextGeometry(&pagelines, &rightside, &boxh, &texth, &texty, &namey, &chevrony, &textx, &textr); // Draw gfx first diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 4e2f3d492..f8574a962 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -272,7 +272,7 @@ void HU_LoadFontCharacters(fontdef_t *font, const char *prefix) for (i = 0; i < FONTSIZE; i++, j++) { sprintf(buffer, "%.5s%.3d", prefix, j); - if (W_CheckNumForName(buffer) == LUMPERROR) + if (W_CheckNumForPatchName(buffer) == LUMPERROR) font->chars[i] = NULL; else font->chars[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX); diff --git a/src/m_menu.c b/src/m_menu.c index 500113475..36b81b947 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4015,11 +4015,11 @@ static void M_DrawThermo(INT32 x, INT32 y, consvar_t *cv) lumpnum_t leftlump, rightlump, centerlump[2], cursorlump; patch_t *p; - leftlump = W_GetNumForName("M_THERML"); - rightlump = W_GetNumForName("M_THERMR"); - centerlump[0] = W_GetNumForName("M_THERMM"); - centerlump[1] = W_GetNumForName("M_THERMM"); - cursorlump = W_GetNumForName("M_THERMO"); + leftlump = W_CheckNumForPatchName("M_THERML"); + rightlump = W_CheckNumForPatchName("M_THERMR"); + centerlump[0] = W_CheckNumForPatchName("M_THERMM"); + centerlump[1] = W_CheckNumForPatchName("M_THERMM"); + cursorlump = W_CheckNumForPatchName("M_THERMO"); V_DrawScaledPatch(xx, y, 0, p = W_CachePatchNum(leftlump,PU_PATCH)); xx += p->width - p->leftoffset; diff --git a/src/st_stuff.c b/src/st_stuff.c index 7df6f8848..e088a448c 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1269,19 +1269,19 @@ tic_t lt_exitticker = 0, lt_endtime = 0; // static void ST_cacheLevelTitle(void) { -#define SETPATCH(default, warning, custom, idx) \ +#define SETPATCH(def, warning, custom, idx) \ { \ lumpnum_t patlumpnum = LUMPERROR; \ if (mapheaderinfo[gamemap-1]->custom[0] != '\0') \ { \ - patlumpnum = W_CheckNumForName(mapheaderinfo[gamemap-1]->custom); \ + patlumpnum = W_CheckNumForPatchName(mapheaderinfo[gamemap-1]->custom); \ if (patlumpnum != LUMPERROR) \ lt_patches[idx] = (patch_t *)W_CachePatchNum(patlumpnum, PU_HUDGFX); \ } \ if (patlumpnum == LUMPERROR) \ { \ if (!(mapheaderinfo[gamemap-1]->levelflags & LF_WARNINGTITLE)) \ - lt_patches[idx] = (patch_t *)W_CachePatchName(default, PU_HUDGFX); \ + lt_patches[idx] = (patch_t *)W_CachePatchName(def, PU_HUDGFX); \ else \ lt_patches[idx] = (patch_t *)W_CachePatchName(warning, PU_HUDGFX); \ } \ diff --git a/src/w_wad.c b/src/w_wad.c index 78d26f905..cc7cdc201 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -98,6 +98,7 @@ typedef struct lumpnum_cache_s { char lumpname[32]; lumpnum_t lumpnum; + UINT32 hash; } lumpnum_cache_t; static lumpnum_cache_t lumpnumcache[LUMPNUMCACHESIZE]; @@ -1475,6 +1476,63 @@ UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump) return INT16_MAX; } +static lumpnum_t CheckLumpInCache(const char *name, boolean longname) +{ + if (longname) + { + UINT32 hash = quickncasehash(name, 32); + + // Loop backwards so that we check most recent entries first + for (INT32 i = lumpnumcacheindex + LUMPNUMCACHESIZE; i > lumpnumcacheindex; i--) + { + if (lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].hash == hash + && stricmp(lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname, name) == 0) + { + lumpnumcacheindex = i & (LUMPNUMCACHESIZE - 1); + return lumpnumcache[lumpnumcacheindex].lumpnum; + } + } + } + else + { + UINT32 hash = quickncasehash(name, 8); + + // Loop backwards so that we check most recent entries first + for (INT32 i = lumpnumcacheindex + LUMPNUMCACHESIZE; i > lumpnumcacheindex; i--) + { + if (lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].hash == hash + && lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname[8] == '\0' + && strnicmp(lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname, name, 8) == 0) + { + lumpnumcacheindex = i & (LUMPNUMCACHESIZE - 1); + return lumpnumcache[lumpnumcacheindex].lumpnum; + } + } + } + + return LUMPERROR; +} + +static void AddLumpToCache(lumpnum_t lumpnum, const char *name, boolean longname) +{ + if (longname && strlen(name) >= 32) + return; + + lumpnumcacheindex = (lumpnumcacheindex + 1) & (LUMPNUMCACHESIZE - 1); + memset(lumpnumcache[lumpnumcacheindex].lumpname, '\0', 32); + if (longname) + { + strlcpy(lumpnumcache[lumpnumcacheindex].lumpname, name, 32); + lumpnumcache[lumpnumcacheindex].hash = quickncasehash(name, 32); + } + else + { + strncpy(lumpnumcache[lumpnumcacheindex].lumpname, name, 8); + lumpnumcache[lumpnumcacheindex].hash = quickncasehash(name, 8); + } + lumpnumcache[lumpnumcacheindex].lumpnum = lumpnum; +} + // // W_CheckNumForName // Returns LUMPERROR if name not found. @@ -1487,17 +1545,10 @@ lumpnum_t W_CheckNumForName(const char *name) if (!*name) // some doofus gave us an empty string? return LUMPERROR; - // Check the lumpnumcache first. Loop backwards so that we check - // most recent entries first - for (i = lumpnumcacheindex + LUMPNUMCACHESIZE; i > lumpnumcacheindex; i--) - { - if (!lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname[8] - && strncmp(lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname, name, 8) == 0) - { - lumpnumcacheindex = i & (LUMPNUMCACHESIZE - 1); - return lumpnumcache[lumpnumcacheindex].lumpnum; - } - } + // Check the lumpnumcache first. + lumpnum_t cachenum = CheckLumpInCache(name, false); + if (cachenum != LUMPERROR) + return cachenum; // scan wad files backwards so patch lump files take precedence for (i = numwadfiles - 1; i >= 0; i--) @@ -1511,12 +1562,11 @@ lumpnum_t W_CheckNumForName(const char *name) else { // Update the cache. - lumpnumcacheindex = (lumpnumcacheindex + 1) & (LUMPNUMCACHESIZE - 1); - memset(lumpnumcache[lumpnumcacheindex].lumpname, '\0', 32); - strncpy(lumpnumcache[lumpnumcacheindex].lumpname, name, 8); - lumpnumcache[lumpnumcacheindex].lumpnum = (i<<16)+check; + lumpnum_t lumpnum = (i << 16) + check; - return lumpnumcache[lumpnumcacheindex].lumpnum; + AddLumpToCache(lumpnum, name, false); + + return lumpnum; } } @@ -1534,16 +1584,10 @@ lumpnum_t W_CheckNumForLongName(const char *name) if (!*name) // some doofus gave us an empty string? return LUMPERROR; - // Check the lumpnumcache first. Loop backwards so that we check - // most recent entries first - for (i = lumpnumcacheindex + LUMPNUMCACHESIZE; i > lumpnumcacheindex; i--) - { - if (strcmp(lumpnumcache[i & (LUMPNUMCACHESIZE - 1)].lumpname, name) == 0) - { - lumpnumcacheindex = i & (LUMPNUMCACHESIZE - 1); - return lumpnumcache[lumpnumcacheindex].lumpnum; - } - } + // Check the lumpnumcache first. + lumpnum_t cachenum = CheckLumpInCache(name, true); + if (cachenum != LUMPERROR) + return cachenum; // scan wad files backwards so patch lump files take precedence for (i = numwadfiles - 1; i >= 0; i--) @@ -1556,16 +1600,12 @@ lumpnum_t W_CheckNumForLongName(const char *name) if (check == INT16_MAX) return LUMPERROR; else { - if (strlen(name) < 32) - { - // Update the cache. - lumpnumcacheindex = (lumpnumcacheindex + 1) & (LUMPNUMCACHESIZE - 1); - memset(lumpnumcache[lumpnumcacheindex].lumpname, '\0', 32); - strlcpy(lumpnumcache[lumpnumcacheindex].lumpname, name, 32); - lumpnumcache[lumpnumcacheindex].lumpnum = (i << 16) + check; - } + // Update the cache. + lumpnum_t lumpnum = (i << 16) + check; - return (i << 16) + check; + AddLumpToCache(lumpnum, name, true); + + return lumpnum; } } @@ -1647,6 +1687,159 @@ lumpnum_t W_GetNumForLongName(const char *name) return i; } +// +// Same as W_CheckNumForNamePwad, but handles namespaces. +// +static UINT16 W_CheckNumForPatchNamePwad(const char *name, UINT16 wad, boolean longname) +{ + UINT16 i, start, end; + static char uname[8 + 1] = { 0 }; + UINT32 hash = 0; + lumpinfo_t *lump_p; + + if (!TestValidLump(wad,0)) + return INT16_MAX; + + if (!longname) + { + strlcpy(uname, name, sizeof uname); + strupr(uname); + hash = quickncasehash(uname, 8); + } + + // SRB2 doesn't have a specific namespace for graphics, which means someone can do weird things + // like placing graphics inside a namespace it doesn't make sense for them to be in, like Sounds/ or SOC/ + // So for now, this checks for lumps OUTSIDE of the flats namespace. + // When this situation changes, change the loops below to check for lumps INSIDE the namespaces to look in. + // TODO: cache namespace lump IDs + if (W_FileHasFolders(wadfiles[wad])) + { + start = W_CheckNumForFolderStartPK3("Flats/", wad, 0); + end = W_CheckNumForFolderEndPK3("Flats/", wad, start); + } + else + { + start = W_CheckNumForMarkerStartPwad("F_START", wad, 0); + end = W_CheckNumForNamePwad("F_END", wad, start); + if (end != INT16_MAX) + end++; + } + + lump_p = wadfiles[wad]->lumpinfo; + + if (start == INT16_MAX) + start = wadfiles[wad]->numlumps; + + for (i = 0; i < start; i++, lump_p++) + { + if ((!longname && lump_p->hash == hash && !strncmp(lump_p->name, uname, sizeof(uname) - 1)) + || (longname && stricmp(lump_p->longname, name) == 0)) + return i; + } + + if (end != INT16_MAX && start < end) + { + lump_p = wadfiles[wad]->lumpinfo + end; + + for (i = end; i < wadfiles[wad]->numlumps; i++, lump_p++) + { + if ((!longname && lump_p->hash == hash && !strncmp(lump_p->name, uname, sizeof(uname) - 1)) + || (longname && stricmp(lump_p->longname, name) == 0)) + return i; + } + } + + // not found. + return INT16_MAX; +} + +// +// W_CheckNumForPatchNameInternal +// Gets a lump number out of a patch name. Returns LUMPERROR if name not found. +// +static lumpnum_t W_CheckNumForPatchNameInternal(const char *name, boolean longname) +{ + INT32 i; + lumpnum_t check = INT16_MAX; + + if (!*name) // some doofus gave us an empty string? + return LUMPERROR; + + // Check the lumpnumcache first. + lumpnum_t cachenum = CheckLumpInCache(name, longname); + if (cachenum != LUMPERROR) + return cachenum; + + // scan wad files backwards so patch lump files take precedence + for (i = numwadfiles - 1; i >= 0; i--) + { + check = W_CheckNumForPatchNamePwad(name,(UINT16)i,longname); + if (check != INT16_MAX) + break; //found it + } + + if (check == INT16_MAX) return LUMPERROR; + else + { + // Update the cache. + lumpnum_t lumpnum = (i << 16) + check; + + AddLumpToCache(lumpnum, name, longname); + + return lumpnum; + } +} + +// +// W_CheckNumForPatchName +// Wrapper for W_CheckNumForPatchNameInternal(name, false). Returns LUMPERROR if name not found. +// +lumpnum_t W_CheckNumForPatchName(const char *name) +{ + return W_CheckNumForPatchNameInternal(name, false); +} + +// +// Like W_CheckNumForPatchName, but can find entries with long names. +// Wrapper for W_CheckNumForPatchNameInternal(name, true). Returns LUMPERROR if name not found. +// +lumpnum_t W_CheckNumForLongPatchName(const char *name) +{ + return W_CheckNumForPatchNameInternal(name, true); +} + +// +// W_GetNumForPatchName +// +// Calls W_CheckNumForPatchName, but bombs out if not found. +// +lumpnum_t W_GetNumForPatchName(const char *name) +{ + lumpnum_t i; + + i = W_CheckNumForPatchName(name); + + if (i == LUMPERROR) + I_Error("W_CheckNumForPatchName: %s not found!\n", name); + + return i; +} + +// +// Like W_GetNumForPatchName, but can find entries with long names +// +lumpnum_t W_GetNumForLongPatchName(const char *name) +{ + lumpnum_t i; + + i = W_CheckNumForLongPatchName(name); + + if (i == LUMPERROR) + I_Error("W_GetNumForLongPatchName: %s not found!\n", name); + + return i; +} + // // W_CheckNumForNameInBlock // Checks only in blocks from blockstart lump to blockend lump @@ -2291,10 +2484,10 @@ void *W_CachePatchName(const char *name, INT32 tag) { lumpnum_t num; - num = W_CheckNumForName(name); + num = W_CheckNumForPatchName(name); if (num == LUMPERROR) - return W_CachePatchNum(W_GetNumForName("MISSING"), tag); + return W_CachePatchNum(W_GetNumForPatchName("MISSING"), tag); return W_CachePatchNum(num, tag); } @@ -2302,10 +2495,10 @@ void *W_CachePatchLongName(const char *name, INT32 tag) { lumpnum_t num; - num = W_CheckNumForLongName(name); + num = W_CheckNumForLongPatchName(name); if (num == LUMPERROR) - return W_CachePatchNum(W_GetNumForLongName("MISSING"), tag); + return W_CachePatchNum(W_GetNumForLongPatchName("MISSING"), tag); return W_CachePatchNum(num, tag); } #ifndef NOMD5 diff --git a/src/w_wad.h b/src/w_wad.h index 80e0e32fd..3dcb9b6e8 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -193,6 +193,12 @@ lumpnum_t W_CheckNumForName(const char *name); lumpnum_t W_CheckNumForLongName(const char *name); lumpnum_t W_GetNumForName(const char *name); // like W_CheckNumForName but I_Error on LUMPERROR lumpnum_t W_GetNumForLongName(const char *name); + +lumpnum_t W_CheckNumForPatchName(const char *name); +lumpnum_t W_CheckNumForLongPatchName(const char *name); +lumpnum_t W_GetNumForPatchName(const char *name); // like W_CheckNumForPatchName but I_Error on LUMPERROR +lumpnum_t W_GetNumForLongPatchName(const char *name); + lumpnum_t W_CheckNumForNameInBlock(const char *name, const char *blockstart, const char *blockend); UINT8 W_LumpExists(const char *name); // Lua uses this. From 0186e5bce5d94665867ebb02b354063f9b3653cb Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Mon, 20 May 2024 02:54:45 -0300 Subject: [PATCH 086/353] Fix a mistake --- src/m_menu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 36b81b947..dd9d2fdbd 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4015,11 +4015,11 @@ static void M_DrawThermo(INT32 x, INT32 y, consvar_t *cv) lumpnum_t leftlump, rightlump, centerlump[2], cursorlump; patch_t *p; - leftlump = W_CheckNumForPatchName("M_THERML"); - rightlump = W_CheckNumForPatchName("M_THERMR"); - centerlump[0] = W_CheckNumForPatchName("M_THERMM"); - centerlump[1] = W_CheckNumForPatchName("M_THERMM"); - cursorlump = W_CheckNumForPatchName("M_THERMO"); + leftlump = W_GetNumForPatchName("M_THERML"); + rightlump = W_GetNumForPatchName("M_THERMR"); + centerlump[0] = W_GetNumForPatchName("M_THERMM"); + centerlump[1] = W_GetNumForPatchName("M_THERMM"); + cursorlump = W_GetNumForPatchName("M_THERMO"); V_DrawScaledPatch(xx, y, 0, p = W_CachePatchNum(leftlump,PU_PATCH)); xx += p->width - p->leftoffset; From 68264e7288c4db5b5797d806bab7df8dc22a8d17 Mon Sep 17 00:00:00 2001 From: Refrag Date: Wed, 15 May 2024 20:03:04 +0200 Subject: [PATCH 087/353] Fix buffer overflow when setting a NETVAR string CVar There was a possible buffer overflow if you tried setting a console var that had the CV_NETVAR and that was of the string type. The overflow would happen if you were trying to set the console variable while in a multiplayer / netgame state. This commit just increases the size of buf to account for everything that needs to be written to it. --- src/command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command.c b/src/command.c index a46cc98bc..7947048ed 100644 --- a/src/command.c +++ b/src/command.c @@ -1992,7 +1992,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth) if (var->flags & CV_NETVAR) { // send the value of the variable - UINT8 buf[128]; + UINT8 buf[512]; UINT8 *p = buf; // Loading from a config in a netgame? Set revert value. From 6bf58ce8705111b1c7456edcf269e22e8ed6f1ee Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Mon, 20 May 2024 20:10:25 -0300 Subject: [PATCH 088/353] Revert "Add comments" This reverts commit 3a09c475c71462f923a6a1c500901e450fa027b7. --- src/p_slopes.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 1d53bfcf4..745be2eac 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -852,6 +852,7 @@ fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y) return light->slope ? P_GetSlopeZAt(light->slope, x, y) : light->height; } + // // P_QuantizeMomentumToSlope // @@ -886,8 +887,6 @@ void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) FV3_Rotate(momentum, &axis, InvAngle(slope->zangle) >> ANGLETOFINESHIFT); } -// Returns the angle of the slope plane. -// If line is provided, a new calculation is performed as if the slope were on the top or bottom of a solid midtexture. angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line) { angle_t zangle = slope->zangle; @@ -901,23 +900,28 @@ angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line) return zangle; } -// Returns the angle of the projected normal of slope plane. -// If line is provided, this simply returns the line's angle. angle_t P_GetStandingSlopeDirection(pslope_t *slope, line_t *line) { angle_t xydirection = slope->xydirection; if (line) { - xydirection = line->angle; + xydirection = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y); } return xydirection; } -// When given a vector, rotates it and aligns it to either a slope, or a flat surface relative to the slope. -// If line is provided, this calculation is performed as if the slope were on the top or bottom of a solid midtexture. -// See also: P_QuantizeMomentumToSlope +angle_t P_GetObjectStandingSlopeZAngle(mobj_t *mo) +{ + return P_GetStandingSlopeZAngle(mo->standingslope, mo->standingline); +} + +angle_t P_GetObjectStandingSlopeDirection(mobj_t *mo) +{ + return P_GetStandingSlopeDirection(mo->standingslope, mo->standingline); +} + static void QuantizeMomentumToSlope(pslope_t *slope, line_t *line, vector3_t *momentum, boolean reverse) { if (!slope || slope->flags & SL_NOPHYSICS) @@ -959,18 +963,6 @@ void P_ReverseQuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum) QuantizeMomentumToSlope(mo->standingslope, mo->standingline, momentum, true); } -// Wrapper for P_GetStandingSlopeZAngle. -angle_t P_GetObjectStandingSlopeZAngle(mobj_t *mo) -{ - return P_GetStandingSlopeZAngle(mo->standingslope, mo->standingline); -} - -// Wrapper for P_GetObjectStandingSlopeDirection. -angle_t P_GetObjectStandingSlopeDirection(mobj_t *mo) -{ - return P_GetStandingSlopeDirection(mo->standingslope, mo->standingline); -} - // // P_SlopeLaunch // @@ -1050,6 +1042,7 @@ fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope, line_t *line) // Function to help handle landing on slopes void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line) { + vector3_t mom; // Ditto. if (slope->flags & SL_NOPHYSICS || (slope->normal.x == 0 && slope->normal.y == 0)) { // No physics, no need to make anything complicated. if (P_MobjFlip(thing)*(thing->momz) < 0) // falling, land on slope { @@ -1062,7 +1055,6 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line) return; } - vector3_t mom; mom.x = thing->momx; mom.y = thing->momy; mom.z = thing->momz*2; From 3d4c9eedf841dda8ad50b0d8fc028b3db89fdcc4 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Mon, 20 May 2024 20:10:34 -0300 Subject: [PATCH 089/353] Revert "Improve slope physics on solid middle textures" This reverts commit e67e225ff2f796ba8cb78c9bacc5c91f052d5271. --- src/p_local.h | 1 - src/p_map.c | 27 ++-------- src/p_maputl.c | 5 -- src/p_maputl.h | 1 - src/p_mobj.c | 31 ++++-------- src/p_mobj.h | 4 +- src/p_saveg.c | 9 +--- src/p_slopes.c | 130 ++++++------------------------------------------- src/p_slopes.h | 10 +--- src/p_user.c | 6 +-- 10 files changed, 35 insertions(+), 189 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 6a4aa241c..249c3cd4b 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -399,7 +399,6 @@ extern camera_t *mapcampointer; extern fixed_t tmx; extern fixed_t tmy; extern pslope_t *tmfloorslope, *tmceilingslope; -extern line_t *tmfloorline, *tmceilingline; /* cphipps 2004/08/30 */ extern void P_MapStart(void); diff --git a/src/p_map.c b/src/p_map.c index aeeeda056..f97ddfa3c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -55,7 +55,6 @@ mobj_t *tmfloorthing; // the thing corresponding to tmfloorz or NULL if tmfloorz mobj_t *tmhitthing; // the solid thing you bumped into (for collisions) ffloor_t *tmfloorrover, *tmceilingrover; pslope_t *tmfloorslope, *tmceilingslope; -line_t *tmfloorline, *tmceilingline; // keep track of the line that lowers the ceiling, // so missiles don't explode against sky hack walls @@ -1761,7 +1760,6 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmfloorz = thing->z + thing->height; tmfloorrover = NULL; tmfloorslope = NULL; - tmfloorline = NULL; } return CHECKTHING_COLLIDE; } @@ -1781,7 +1779,6 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmfloorz = tmceilingz = topz; // block while in air tmceilingrover = NULL; tmceilingslope = NULL; - tmceilingline = NULL; tmfloorthing = thing; // needed for side collision collide = CHECKTHING_COLLIDE; @@ -1791,7 +1788,6 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmceilingz = topz; tmceilingrover = NULL; tmceilingslope = NULL; - tmceilingline = NULL; tmfloorthing = thing; // thing we may stand on collide = CHECKTHING_COLLIDE; @@ -1809,7 +1805,6 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmceilingz = thing->z; tmceilingrover = NULL; tmceilingslope = NULL; - tmceilingline = NULL; } return CHECKTHING_COLLIDE; } @@ -1829,7 +1824,6 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmfloorz = tmceilingz = topz; // block while in air tmfloorrover = NULL; tmfloorslope = NULL; - tmfloorline = NULL; tmfloorthing = thing; // needed for side collision collide = CHECKTHING_COLLIDE; @@ -1839,7 +1833,6 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) tmfloorz = topz; tmfloorrover = NULL; tmfloorslope = NULL; - tmfloorline = NULL; tmfloorthing = thing; // thing we may stand on collide = CHECKTHING_COLLIDE; @@ -2007,7 +2000,6 @@ static boolean PIT_CheckLine(line_t *ld) ceilingline = ld; tmceilingrover = openceilingrover; tmceilingslope = opentopslope; - tmceilingline = opentopline; } if (openbottom > tmfloorz) @@ -2015,7 +2007,6 @@ static boolean PIT_CheckLine(line_t *ld) tmfloorz = openbottom; tmfloorrover = openfloorrover; tmfloorslope = openbottomslope; - tmfloorline = openbottomline; } if (highceiling > tmdrpoffceilz) @@ -2066,8 +2057,6 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) tmceilingz = P_GetCeilingZ(thing, newsubsec->sector, x, y, NULL); //newsubsec->sector->ceilingheight; tmfloorrover = NULL; tmceilingrover = NULL; - tmfloorline = NULL; - tmceilingline = NULL; tmfloorslope = newsubsec->sector->f_slope; tmceilingslope = newsubsec->sector->c_slope; @@ -2653,8 +2642,6 @@ boolean PIT_PushableMoved(mobj_t *thing) ffloor_t *oldceilrover = tmceilingrover; pslope_t *oldfslope = tmfloorslope; pslope_t *oldcslope = tmceilingslope; - line_t *oldfline = tmfloorline; - line_t *oldcline = tmceilingline; // Move the player P_TryMove(thing, thing->x+stand->momx, thing->y+stand->momy, true); @@ -2671,8 +2658,6 @@ boolean PIT_PushableMoved(mobj_t *thing) tmceilingrover = oldceilrover; tmfloorslope = oldfslope; tmceilingslope = oldcslope; - tmfloorline = oldfline; - tmceilingline = oldcline; thing->momz = stand->momz; } else @@ -2914,12 +2899,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) // Assign thing's standingslope if needed if (thing->z <= tmfloorz && !(thing->eflags & MFE_VERTICALFLIP)) { if (!startingonground && tmfloorslope) - P_HandleSlopeLanding(thing, tmfloorslope, tmfloorline); + P_HandleSlopeLanding(thing, tmfloorslope); if (thing->momz <= 0) { thing->standingslope = tmfloorslope; - thing->standingline = tmfloorline; P_SetPitchRollFromSlope(thing, thing->standingslope); if (thing->momz == 0 && thing->player && !startingonground) @@ -2928,12 +2912,11 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) } else if (thing->z+thing->height >= tmceilingz && (thing->eflags & MFE_VERTICALFLIP)) { if (!startingonground && tmceilingslope) - P_HandleSlopeLanding(thing, tmceilingslope, tmceilingline); + P_HandleSlopeLanding(thing, tmceilingslope); if (thing->momz >= 0) { thing->standingslope = tmceilingslope; - thing->standingline = tmceilingline; P_SetPitchRollFromSlope(thing, thing->standingslope); if (thing->momz == 0 && thing->player && !startingonground) @@ -2941,12 +2924,8 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) } } } - else - { - // don't set standingslope or standingline if you're not going to clip against them + else // don't set standingslope if you're not going to clip against it thing->standingslope = NULL; - thing->standingline = NULL; - } thing->x = x; thing->y = y; diff --git a/src/p_maputl.c b/src/p_maputl.c index 7de5b5369..18a15a928 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -280,7 +280,6 @@ fixed_t P_InterceptVector(divline_t *v2, divline_t *v1) fixed_t opentop, openbottom, openrange, lowfloor, highceiling; pslope_t *opentopslope, *openbottomslope; ffloor_t *openfloorrover, *openceilingrover; -line_t *opentopline, *openbottomline; // P_CameraLineOpening // P_LineOpening, but for camera @@ -441,8 +440,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) I_Assert(back != NULL); openfloorrover = openceilingrover = NULL; - opentopline = openbottomline = NULL; - if (linedef->polyobj) { // set these defaults so that polyobjects don't interfere with collision above or below them @@ -547,7 +544,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if ((linedef->flags & ML_MIDPEG) != 0) { opentopslope = openbottomslope; } - opentopline = linedef; } } else { // Above if (openbottom < textop) { @@ -555,7 +551,6 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if ((linedef->flags & ML_MIDPEG) == 0) { openbottomslope = opentopslope; } - openbottomline = linedef; } } } diff --git a/src/p_maputl.h b/src/p_maputl.h index ca29fc203..e894c08a2 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -57,7 +57,6 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y); extern fixed_t opentop, openbottom, openrange, lowfloor, highceiling; extern pslope_t *opentopslope, *openbottomslope; extern ffloor_t *openfloorrover, *openceilingrover; -extern line_t *opentopline, *openbottomline; void P_LineOpening(line_t *plinedef, mobj_t *mobj); diff --git a/src/p_mobj.c b/src/p_mobj.c index 221149f70..9cdd2628d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1672,7 +1672,6 @@ void P_XYMovement(mobj_t *mo) fixed_t oldx, oldy; // reducing bobbing/momentum on ice when up against walls boolean moved; pslope_t *oldslope = NULL; - line_t *oldstandingline = NULL; vector3_t slopemom = {0,0,0}; fixed_t predictedz = 0; @@ -1705,10 +1704,7 @@ void P_XYMovement(mobj_t *mo) oldy = mo->y; if (mo->flags & MF_NOCLIPHEIGHT) - { mo->standingslope = NULL; - mo->standingline = NULL; - } // adjust various things based on slope if (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8) { @@ -1720,7 +1716,7 @@ void P_XYMovement(mobj_t *mo) slopemom.x = xmove; slopemom.y = ymove; slopemom.z = 0; - P_QuantizeObjectMomentumToSlope(mo, &slopemom); + P_QuantizeMomentumToSlope(&slopemom, mo->standingslope); xmove = slopemom.x; ymove = slopemom.y; @@ -1728,7 +1724,6 @@ void P_XYMovement(mobj_t *mo) predictedz = mo->z + slopemom.z; // We'll use this later... oldslope = mo->standingslope; - oldstandingline = mo->standingline; } } else if (P_IsObjectOnGround(mo) && !mo->momz) predictedz = mo->z; @@ -1804,16 +1799,12 @@ void P_XYMovement(mobj_t *mo) { // try to slide along it // Wall transfer part 1. pslope_t *transferslope = NULL; - line_t *transferline = NULL; fixed_t transfermomz = 0; if (oldslope && (P_MobjFlip(mo)*(predictedz - mo->z) > 0)) // Only for moving up (relative to gravity), otherwise there's a failed launch when going down slopes and hitting walls { - angle_t zangle; transferslope = ((mo->standingslope) ? mo->standingslope : oldslope); - transferline = ((mo->standingline) ? mo->standingline : oldstandingline); - zangle = P_GetStandingSlopeZAngle(transferslope, transferline); - if (((zangle < ANGLE_180) ? zangle : InvAngle(zangle)) >= ANGLE_45) // Prevent some weird stuff going on on shallow slopes. - transfermomz = P_GetWallTransferMomZ(mo, transferslope, transferline); + if (((transferslope->zangle < ANGLE_180) ? transferslope->zangle : InvAngle(transferslope->zangle)) >= ANGLE_45) // Prevent some weird stuff going on on shallow slopes. + transfermomz = P_GetWallTransferMomZ(mo, transferslope); } P_SlideMove(mo); @@ -1826,7 +1817,7 @@ void P_XYMovement(mobj_t *mo) { angle_t relation; // Scale transfer momentum based on how head-on it is to the slope. if (mo->momx || mo->momy) // "Guess" the angle of the wall you hit using new momentum - relation = P_GetStandingSlopeDirection(transferslope, transferline) - R_PointToAngle2(0, 0, mo->momx, mo->momy); + relation = transferslope->xydirection - R_PointToAngle2(0, 0, mo->momx, mo->momy); else // Give it for free, I guess. relation = ANGLE_90; transfermomz = FixedMul(transfermomz, @@ -1835,7 +1826,6 @@ void P_XYMovement(mobj_t *mo) { mo->momz = transfermomz; mo->standingslope = NULL; - mo->standingline = NULL; if (player) { player->powers[pw_justlaunched] = 2; @@ -1885,7 +1875,7 @@ void P_XYMovement(mobj_t *mo) oldangle = FixedMul((signed)oldslope->zangle, FINECOSINE((moveangle - oldslope->xydirection) >> ANGLETOFINESHIFT)); if (mo->standingslope) - newangle = FixedMul((signed)P_GetObjectStandingSlopeZAngle(mo), FINECOSINE((moveangle - P_GetObjectStandingSlopeDirection(mo)) >> ANGLETOFINESHIFT)); + newangle = FixedMul((signed)mo->standingslope->zangle, FINECOSINE((moveangle - mo->standingslope->xydirection) >> ANGLETOFINESHIFT)); else newangle = 0; @@ -1909,7 +1899,7 @@ void P_XYMovement(mobj_t *mo) } } else if (moved && mo->standingslope && predictedz) { angle_t moveangle = R_PointToAngle2(0, 0, mo->momx, mo->momy); - angle_t newangle = FixedMul((signed)P_GetObjectStandingSlopeZAngle(mo), FINECOSINE((moveangle - P_GetObjectStandingSlopeDirection(mo)) >> ANGLETOFINESHIFT)); + angle_t newangle = FixedMul((signed)mo->standingslope->zangle, FINECOSINE((moveangle - mo->standingslope->xydirection) >> ANGLETOFINESHIFT)); /*CONS_Printf("flat to angle %f - predicted z of %f\n", FIXED_TO_FLOAT(AngleFixed(ANGLE_MAX-newangle)), @@ -2442,9 +2432,8 @@ boolean P_ZMovement(mobj_t *mo) if (((mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope) && (mo->type != MT_STEAM)) { mo->standingslope = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingslope : tmfloorslope; - mo->standingline = (mo->eflags & MFE_VERTICALFLIP) ? tmceilingline : tmfloorline; P_SetPitchRollFromSlope(mo, mo->standingslope); - P_ReverseQuantizeObjectMomentumToSlope(mo, &mom); + P_ReverseQuantizeMomentumToSlope(&mom, mo->standingslope); } // hit the floor @@ -2590,7 +2579,7 @@ boolean P_ZMovement(mobj_t *mo) mom.z = tmfloorthing->momz; if (mo->standingslope) { // MT_STEAM will never have a standingslope, see above. - P_QuantizeObjectMomentumToSlope(mo, &mom); + P_QuantizeMomentumToSlope(&mom, mo->standingslope); } mo->momx = mom.x; @@ -2836,9 +2825,7 @@ void P_PlayerZMovement(mobj_t *mo) if (!mo->standingslope && (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)) { // Handle landing on slope during Z movement - P_HandleSlopeLanding(mo, - (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope), - (mo->eflags & MFE_VERTICALFLIP ? tmceilingline : tmfloorline)); + P_HandleSlopeLanding(mo, (mo->eflags & MFE_VERTICALFLIP ? tmceilingslope : tmfloorslope)); } if (P_MobjFlip(mo)*mo->momz < 0) // falling diff --git a/src/p_mobj.h b/src/p_mobj.h index ae4c5a51d..2f013a2f3 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -412,9 +412,7 @@ typedef struct mobj_s INT32 cusval; INT32 cvmem; - struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?) (it does) - - struct line_s *standingline; // The line that the object is standing on + struct pslope_s *standingslope; // The slope that the object is standing on (shouldn't need synced in savegames, right?) boolean resetinterp; // if true, some fields should not be interpolated (see R_InterpolateMobjState implementation) boolean colorized; // Whether the mobj uses the rainbow colormap diff --git a/src/p_saveg.c b/src/p_saveg.c index 675d68acd..5e4d6d076 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1746,8 +1746,7 @@ typedef enum MD2_DISPOFFSET = 1<<23, MD2_DRAWONLYFORPLAYER = 1<<24, MD2_DONTDRAWFORVIEWMOBJ = 1<<25, - MD2_TRANSLATION = 1<<26, - MD2_STANDINGLINE = 1<<27 + MD2_TRANSLATION = 1<<26 } mobj_diff2_t; typedef enum @@ -1954,8 +1953,6 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) diff2 |= MD2_CEILINGROVER; if (mobj->standingslope) diff2 |= MD2_SLOPE; - if (mobj->standingline) - diff2 |= MD2_STANDINGLINE; if (mobj->colorized) diff2 |= MD2_COLORIZED; if (mobj->mirrored) @@ -2128,8 +2125,6 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) WRITEUINT32(save_p, mobj->hprev->mobjnum); if (diff2 & MD2_SLOPE) WRITEUINT16(save_p, mobj->standingslope->id); - if (diff2 & MD2_STANDINGLINE) - WRITEUINT32(save_p, SaveLine(mobj->standingline)); if (diff2 & MD2_COLORIZED) WRITEUINT8(save_p, mobj->colorized); if (diff2 & MD2_MIRRORED) @@ -3186,8 +3181,6 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p); if (diff2 & MD2_SLOPE) mobj->standingslope = P_SlopeById(READUINT16(save_p)); - if (diff2 & MD2_STANDINGLINE) - mobj->standingline = LoadLine(READUINT32(save_p)); if (diff2 & MD2_COLORIZED) mobj->colorized = READUINT8(save_p); if (diff2 & MD2_MIRRORED) diff --git a/src/p_slopes.c b/src/p_slopes.c index 745be2eac..e75d36ede 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -859,10 +859,11 @@ fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y) // When given a vector, rotates it and aligns it to a slope void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) { + vector3_t axis; // Fuck you, C90. + if (slope->flags & SL_NOPHYSICS) return; // No physics, no quantizing. - vector3_t axis; axis.x = -slope->d.y; axis.y = slope->d.x; axis.z = 0; @@ -876,91 +877,9 @@ void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) // When given a vector, rotates and aligns it to a flat surface (from being relative to a given slope) void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope) { - if (slope->flags & SL_NOPHYSICS) - return; // No physics, no quantizing. - - vector3_t axis; - axis.x = -slope->d.y; - axis.y = slope->d.x; - axis.z = 0; - - FV3_Rotate(momentum, &axis, InvAngle(slope->zangle) >> ANGLETOFINESHIFT); -} - -angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line) -{ - angle_t zangle = slope->zangle; - - if (line) - { - zangle = R_PointToAngle2(0, P_GetSlopeZAt(slope, line->v1->x, line->v1->y), - R_PointToDist2(line->v1->x, line->v1->y, line->v2->x, line->v2->y), P_GetSlopeZAt(slope, line->v2->x, line->v2->y)); - } - - return zangle; -} - -angle_t P_GetStandingSlopeDirection(pslope_t *slope, line_t *line) -{ - angle_t xydirection = slope->xydirection; - - if (line) - { - xydirection = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y); - } - - return xydirection; -} - -angle_t P_GetObjectStandingSlopeZAngle(mobj_t *mo) -{ - return P_GetStandingSlopeZAngle(mo->standingslope, mo->standingline); -} - -angle_t P_GetObjectStandingSlopeDirection(mobj_t *mo) -{ - return P_GetStandingSlopeDirection(mo->standingslope, mo->standingline); -} - -static void QuantizeMomentumToSlope(pslope_t *slope, line_t *line, vector3_t *momentum, boolean reverse) -{ - if (!slope || slope->flags & SL_NOPHYSICS) - return; - - angle_t zangle = P_GetStandingSlopeZAngle(slope, line); - - if (reverse) - zangle = InvAngle(zangle); - - vector3_t axis; - axis.z = 0; - - if (line) - { - fixed_t len = R_PointToDist2(0, 0, line->dx, line->dy); - axis.x = FixedDiv(line->dy, len); - axis.y = -FixedDiv(line->dx, len); - } - else - { - axis.x = -slope->d.y; - axis.y = slope->d.x; - } - - FV3_Rotate(momentum, &axis, zangle >> ANGLETOFINESHIFT); -} - -// Given a vector of the object's momentum, rotates it and aligns it to the slope the object is standing on -void P_QuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum) -{ - QuantizeMomentumToSlope(mo->standingslope, mo->standingline, momentum, false); -} - -// Given a vector of the object's momentum, rotates and aligns it to a flat surface -// (from being relative to the slope the object is standing on) -void P_ReverseQuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum) -{ - QuantizeMomentumToSlope(mo->standingslope, mo->standingline, momentum, true); + slope->zangle = InvAngle(slope->zangle); + P_QuantizeMomentumToSlope(momentum, slope); + slope->zangle = InvAngle(slope->zangle); } // @@ -980,7 +899,7 @@ void P_SlopeLaunch(mobj_t *mo) slopemom.x = mo->momx; slopemom.y = mo->momy; slopemom.z = mo->momz*2; - P_QuantizeObjectMomentumToSlope(mo, &slopemom); + P_QuantizeMomentumToSlope(&slopemom, mo->standingslope); mo->momx = slopemom.x; mo->momy = slopemom.y; @@ -1000,7 +919,7 @@ void P_SlopeLaunch(mobj_t *mo) // It would be nice to have a single function that does everything necessary for slope-to-wall transfer. // However, it needs to be seperated out in P_XYMovement to take into account momentum before and after hitting the wall. // This just performs the necessary calculations for getting the base vertical momentum; the horizontal is already reasonably calculated by P_SlideMove. -fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope, line_t *line) +fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope) { vector3_t slopemom, axis; angle_t ang; @@ -1008,30 +927,18 @@ fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope, line_t *line) if (slope->flags & SL_NOPHYSICS) return 0; - angle_t zangle = P_GetStandingSlopeZAngle(slope, line); - // If there's physics, time for launching. // Doesn't kill the vertical momentum as much as P_SlopeLaunch does. - ang = zangle + ANG15*((zangle > 0) ? 1 : -1); + ang = slope->zangle + ANG15*((slope->zangle > 0) ? 1 : -1); if (ang > ANGLE_90 && ang < ANGLE_180) - ang = ((zangle > 0) ? ANGLE_90 : InvAngle(ANGLE_90)); // hard cap of directly upwards + ang = ((slope->zangle > 0) ? ANGLE_90 : InvAngle(ANGLE_90)); // hard cap of directly upwards slopemom.x = mo->momx; slopemom.y = mo->momy; slopemom.z = 3*(mo->momz/2); - if (line) - { - fixed_t len = R_PointToDist2(0, 0, line->dx, line->dy); - axis.x = FixedDiv(line->dy, len); - axis.y = -FixedDiv(line->dx, len); - } - else - { - axis.x = -slope->d.y; - axis.y = slope->d.x; - } - + axis.x = -slope->d.y; + axis.y = slope->d.x; axis.z = 0; FV3_Rotate(&slopemom, &axis, ang >> ANGLETOFINESHIFT); @@ -1040,7 +947,7 @@ fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope, line_t *line) } // Function to help handle landing on slopes -void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line) +void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope) { vector3_t mom; // Ditto. if (slope->flags & SL_NOPHYSICS || (slope->normal.x == 0 && slope->normal.y == 0)) { // No physics, no need to make anything complicated. @@ -1059,13 +966,12 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line) mom.y = thing->momy; mom.z = thing->momz*2; - QuantizeMomentumToSlope(slope, line, &mom, true); + P_ReverseQuantizeMomentumToSlope(&mom, slope); if (P_MobjFlip(thing)*mom.z < 0) { // falling, land on slope thing->momx = mom.x; thing->momy = mom.y; thing->standingslope = slope; - thing->standingline = line; P_SetPitchRollFromSlope(thing, slope); if (!thing->player || !(thing->player->pflags & PF_BOUNCING)) thing->momz = -P_MobjFlip(thing); @@ -1077,7 +983,6 @@ void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line) void P_ButteredSlope(mobj_t *mo) { fixed_t thrust; - angle_t zangle, xydirection; if (!mo->standingslope) return; @@ -1096,15 +1001,12 @@ void P_ButteredSlope(mobj_t *mo) return; // Allow the player to stand still on slopes below a certain steepness } - zangle = P_GetStandingSlopeZAngle(mo->standingslope, mo->standingline); - xydirection = P_GetStandingSlopeDirection(mo->standingslope, mo->standingline); - - thrust = FINESINE(zangle>>ANGLETOFINESHIFT) * 3 / 2 * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); + thrust = FINESINE(mo->standingslope->zangle>>ANGLETOFINESHIFT) * 3 / 2 * (mo->eflags & MFE_VERTICALFLIP ? 1 : -1); if (mo->player && (mo->player->pflags & PF_SPINNING)) { fixed_t mult = 0; if (mo->momx || mo->momy) { - angle_t angle = R_PointToAngle2(0, 0, mo->momx, mo->momy) - xydirection; + angle_t angle = R_PointToAngle2(0, 0, mo->momx, mo->momy) - mo->standingslope->xydirection; if (P_MobjFlip(mo) * mo->standingslope->zdelta < 0) angle ^= ANGLE_180; @@ -1125,5 +1027,5 @@ void P_ButteredSlope(mobj_t *mo) // ... and its friction against the ground for good measure (divided by original friction to keep behaviour for normal slopes the same). thrust = FixedMul(thrust, FixedDiv(mo->friction, ORIG_FRICTION)); - P_Thrust(mo, xydirection, thrust); + P_Thrust(mo, mo->standingslope->xydirection, thrust); } diff --git a/src/p_slopes.h b/src/p_slopes.h index f33053ac1..fdc07f67e 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -84,15 +84,9 @@ fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y); // Lots of physics-based bullshit void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope); void P_ReverseQuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope); -void P_QuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum); -void P_ReverseQuantizeObjectMomentumToSlope(mobj_t *mo, vector3_t *momentum); -angle_t P_GetStandingSlopeZAngle(pslope_t *slope, line_t *line); -angle_t P_GetStandingSlopeDirection(pslope_t *slope, line_t *line); -angle_t P_GetObjectStandingSlopeZAngle(mobj_t *mo); -angle_t P_GetObjectStandingSlopeDirection(mobj_t *mo); void P_SlopeLaunch(mobj_t *mo); -fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope, line_t *line); -void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope, line_t *line); +fixed_t P_GetWallTransferMomZ(mobj_t *mo, pslope_t *slope); +void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope); void P_ButteredSlope(mobj_t *mo); pslope_t *P_MakeSlopeViaEquationConstants(const double a, const double b, const double c, const double d); diff --git a/src/p_user.c b/src/p_user.c index 1782c5386..7cd128cf0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6257,15 +6257,15 @@ static void P_3dMovement(player_t *player) && player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && abs(player->mo->standingslope->zdelta) > FRACUNIT/2) { // Factor thrust to slope, but only for the part pushing up it! // The rest is unaffected. - angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-P_GetObjectStandingSlopeDirection(player->mo); + angle_t thrustangle = R_PointToAngle2(0, 0, totalthrust.x, totalthrust.y)-player->mo->standingslope->xydirection; if (player->mo->standingslope->zdelta < 0) { // Direction goes down, so thrustangle needs to face toward if (thrustangle < ANGLE_90 || thrustangle > ANGLE_270) { - P_QuantizeObjectMomentumToSlope(player->mo, &totalthrust); + P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope); } } else { // Direction goes up, so thrustangle needs to face away if (thrustangle > ANGLE_90 && thrustangle < ANGLE_270) { - P_QuantizeObjectMomentumToSlope(player->mo, &totalthrust); + P_QuantizeMomentumToSlope(&totalthrust, player->mo->standingslope); } } } From 3fb5907effb3814c77f39dd9b2c6e1f9b2a1dd2b Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Mon, 20 May 2024 20:08:47 -0300 Subject: [PATCH 090/353] Add slope data to lines --- src/p_maputl.c | 14 +++--- src/p_setup.c | 2 + src/p_slopes.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++++- src/r_defs.h | 2 + 4 files changed, 137 insertions(+), 8 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index 18a15a928..3373a40c4 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -541,16 +541,18 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (delta1 > delta2) { // Below if (opentop > texbottom) { opentop = texbottom; - if ((linedef->flags & ML_MIDPEG) != 0) { - opentopslope = openbottomslope; - } + if (linedef->flags & ML_NOSKEW) + opentopslope = NULL; + else + opentopslope = linedef->midtexslope; } } else { // Above if (openbottom < textop) { openbottom = textop; - if ((linedef->flags & ML_MIDPEG) == 0) { - openbottomslope = opentopslope; - } + if (linedef->flags & ML_NOSKEW) + openbottomslope = NULL; + else + openbottomslope = linedef->midtexslope; } } } diff --git a/src/p_setup.c b/src/p_setup.c index 41487d702..3dd3d942c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1113,6 +1113,8 @@ static void P_InitializeLinedef(line_t *ld) ld->callcount = 0; ld->secportal = UINT32_MAX; + ld->midtexslope = NULL; + // cph 2006/09/30 - fix sidedef errors right away. // cph 2002/07/20 - these errors are fatal if not fixed, so apply them for (j = 0; j < 2; j++) diff --git a/src/p_slopes.c b/src/p_slopes.c index e75d36ede..d941c71f9 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -28,6 +28,8 @@ pslope_t *slopelist = NULL; UINT16 slopecount = 0; +static void P_UpdateMidtextureSlopesForSector(sector_t *sector); + // Calculate line normal void P_CalculateSlopeNormal(pslope_t *slope) { @@ -212,6 +214,9 @@ void T_DynamicSlopeLine (dynlineplanethink_t* th) slope->zangle = R_PointToAngle2(0, 0, th->extent, -zdelta); slope->moved = true; P_CalculateSlopeNormal(slope); + P_UpdateMidtextureSlopesForSector(srcline->frontsector); + if (srcline->backsector) + P_UpdateMidtextureSlopesForSector(srcline->backsector); } } @@ -232,6 +237,12 @@ void T_DynamicSlopeVert (dynvertexplanethink_t* th) } ReconfigureViaVertexes(th->slope, th->vex[0], th->vex[1], th->vex[2]); + + for (i = 0; i < 3; i++) + { + if (th->secs[i]) + P_UpdateMidtextureSlopesForSector(th->secs[i]); + } } static inline void P_AddDynLineSlopeThinker (pslope_t* slope, dynplanetype_t type, line_t* sourceline, fixed_t extent) @@ -758,6 +769,111 @@ pslope_t *P_MakeSlopeViaEquationConstants(const double a, const double b, const return ret; } +static pslope_t *P_GetReferenceSlopeForMidtexture(line_t *line) +{ + if (line->flags & ML_MIDPEG) + { + // Line has ML_MIDPEG, so use the floor slope + fixed_t frontheight = P_GetSectorFloorZAt(line->frontsector, line->v1->x, line->v1->y); + fixed_t backheight = P_GetSectorFloorZAt(line->backsector, line->v1->x, line->v1->y); + + if (frontheight > backheight) + { + return line->frontsector->f_slope; + } + else + { + return line->backsector->f_slope; + } + } + else + { + // Line does not have ML_MIDPEG, so use the ceiling slope + fixed_t frontheight = P_GetSectorCeilingZAt(line->frontsector, line->v1->x, line->v1->y); + fixed_t backheight = P_GetSectorCeilingZAt(line->backsector, line->v1->x, line->v1->y); + + if (frontheight < backheight) + { + return line->frontsector->c_slope; + } + else + { + return line->backsector->c_slope; + } + } + + return NULL; +} + +// Updates a slope for a solid midtexture based on the slope of the sector it's in. +static void P_UpdateSolidMidtextureSlope(line_t *line, pslope_t *ref) +{ + pslope_t *slope = line->midtexslope; + + if (ref == NULL) + return; + + // Set origin + vector3_t origin; + origin.x = line->v1->x; + origin.y = line->v1->y; + origin.z = P_GetSlopeZAt(ref, origin.x, origin.y); + FV3_Copy(&slope->o, &origin); + + // Get where the line ends + vector3_t point; + point.x = line->v2->x; + point.y = line->v2->y; + point.z = P_GetSlopeZAt(ref, point.x, point.y); + + // Get length of the line + fixed_t extent = R_PointToDist2(0, 0, line->dx, line->dy); + + // Precalculate variables + slope->zdelta = FixedDiv(origin.z - point.z, extent); + slope->zangle = R_PointToAngle2(0, origin.z, extent, point.z); + slope->xydirection = line->angle; + + // Precalculate the direction + vector2_t dir; + dir.x = FixedMul(FINECOSINE(slope->zangle >> ANGLETOFINESHIFT), FINECOSINE((slope->xydirection+ANGLE_180) >> ANGLETOFINESHIFT)); + dir.y = FixedMul(FINECOSINE(slope->zangle >> ANGLETOFINESHIFT), FINESINE((slope->xydirection+ANGLE_180) >> ANGLETOFINESHIFT)); + FV2_Copy(&slope->d, &dir); + + P_CalculateSlopeNormal(slope); + + // Calling P_CalculateSlopeVectors is not necessary. + slope->moved = true; +} + +// Goes through every line in the sector and updates the midtexture slope if it is present +static void P_UpdateMidtextureSlopesForSector(sector_t *sector) +{ + for (size_t i = 0; i < sector->linecount; i++) + { + if (sector->lines[i]->midtexslope != NULL) + P_UpdateSolidMidtextureSlope(sector->lines[i], P_GetReferenceSlopeForMidtexture(sector->lines[i])); + } +} + +// Creates a solid midtexture slope for the line if possible +static void P_CreateSolidMidtextureSlope(line_t *line) +{ + if (line->backsector == NULL) // Ignore single-sided lines (of course) + return; + + if ((line->flags & ML_MIDSOLID) == 0) // Ignore if the midtexture is not solid + return; + + pslope_t *ref = P_GetReferenceSlopeForMidtexture(line); + if (ref) + { + line->midtexslope = Slope_Add(0); + + P_UpdateSolidMidtextureSlope(line, ref); + } +} + /// Initializes and reads the slopes from the map data. void P_SpawnSlopes(const boolean fromsave) { size_t i; @@ -785,14 +901,21 @@ void P_SpawnSlopes(const boolean fromsave) { /// Copies slopes from tagged sectors via line specials. /// \note Doesn't actually copy, but instead they share the same pointers. + // Also, creates midtexture slopes. for (i = 0; i < numlines; i++) - switch (lines[i].special) + { + line_t *line = &lines[i]; + + switch (line->special) { case 720: - P_CopySectorSlope(&lines[i]); + P_CopySectorSlope(line); default: break; } + + P_CreateSolidMidtextureSlope(line); + } } /// Initializes slopes. diff --git a/src/r_defs.h b/src/r_defs.h index da4dd2d70..7a6f518ee 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -612,6 +612,8 @@ typedef struct line_s INT16 callcount; // no. of calls left before triggering, for the "X calls" linedef specials, defaults to 0 UINT32 secportal; // transferred sector portal + + struct pslope_s *midtexslope; } line_t; typedef struct From 36395bfaac4b247234aa85c1f85780547d649bf0 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Mon, 20 May 2024 20:25:42 -0300 Subject: [PATCH 091/353] Copy the flags of the reference slope --- src/p_slopes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index d941c71f9..11327506e 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -868,7 +868,7 @@ static void P_CreateSolidMidtextureSlope(line_t *line) pslope_t *ref = P_GetReferenceSlopeForMidtexture(line); if (ref) { - line->midtexslope = Slope_Add(0); + line->midtexslope = Slope_Add(ref->flags & SL_NOPHYSICS); P_UpdateSolidMidtextureSlope(line, ref); } From 341139ea73ea419d506d583daf63c8028a6830df Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 22 May 2024 23:37:09 -0300 Subject: [PATCH 092/353] Scale the vertical offsets --- src/p_maputl.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index f00534d63..0bc22390b 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -500,8 +500,11 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) INT32 texnum = R_GetTextureNum(side->midtexture); // make sure the texture is actually valid if (texnum) { + fixed_t scaley = abs(side->scaley_mid); + fixed_t offsetvalue = FixedDiv(side->rowoffset + side->offsety_mid, scaley); + // Get the midtexture's height - texheight = FixedDiv(textureheight[texnum], abs(side->scaley_mid)); + texheight = FixedDiv(textureheight[texnum], scaley); // Set texbottom and textop to the Z coordinates of the texture's boundaries #if 0 @@ -509,26 +512,26 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) // on non-solid polyobjects should NEVER happen in the future if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) { if (linedef->flags & ML_WRAPMIDTEX && !side->repeatcnt) { // "infinite" repeat - texbottom = back->floorheight + side->rowoffset + side->offsety_mid; - textop = back->ceilingheight + side->rowoffset + side->offsety_mid; + texbottom = back->floorheight + offsetvalue; + textop = back->ceilingheight + offsetvalue; } else if (linedef->flags & ML_MIDTEX) { - texbottom = back->floorheight + side->rowoffset + side->offsety_mid; + texbottom = back->floorheight + offsetvalue; textop = texbottom + texheight*(side->repeatcnt+1); } else { - textop = back->ceilingheight + side->rowoffset + side->offsety_mid; + textop = back->ceilingheight + offsetvalue; texbottom = textop - texheight*(side->repeatcnt+1); } } else #endif { if (linedef->flags & ML_WRAPMIDTEX && !side->repeatcnt) { // "infinite" repeat - texbottom = openbottom + side->rowoffset + side->offsety_mid; - textop = opentop + side->rowoffset + side->offsety_mid; + texbottom = openbottom + offsetvalue; + textop = opentop + offsetvalue; } else if (linedef->flags & ML_MIDPEG) { - texbottom = openbottom + side->rowoffset + side->offsety_mid; + texbottom = openbottom + offsetvalue; textop = texbottom + texheight*(side->repeatcnt+1); } else { - textop = opentop + side->rowoffset + side->offsety_mid; + textop = opentop + offsetvalue; texbottom = textop - texheight*(side->repeatcnt+1); } } From 813c609c5fd932f5b0adb195a7cbba424f2907b1 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Thu, 23 May 2024 01:32:13 -0300 Subject: [PATCH 093/353] Fix repeatcnt data type mistake in UDMF specification --- doc/specs/udmf_srb2.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/specs/udmf_srb2.txt b/doc/specs/udmf_srb2.txt index b25ed1af3..d6d71a0d5 100644 --- a/doc/specs/udmf_srb2.txt +++ b/doc/specs/udmf_srb2.txt @@ -126,7 +126,7 @@ Sonic Robo Blast 2 defines the following standardized fields: texturebottom = ; // Lower texture. Default = "-". texturemiddle = ; // Middle texture. Default = "-". - repeatcnt = ; // Number of middle texture repetitions. Default = 0 + repeatcnt = ; // Number of middle texture repetitions. Default = 0. sector = ; // Sector index. No valid default. From 72f294292981a02cf2b700c4a68fa0c45b20978b Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sat, 25 May 2024 18:04:49 +0200 Subject: [PATCH 094/353] Fix players not rendering on team scoreboards --- src/hu_stuff.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 16c59d9cf..1c951475b 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2015,13 +2015,13 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer) greycheck = greycheckdef; supercheck = supercheckdef; - if (tab[i].color == skincolor_redteam) //red + if (players[tab[i].num].ctfteam == 1) //red { redplayers++; x = 14 + (BASEVIDWIDTH/2); y = (redplayers * 9) + 20; } - else if (tab[i].color == skincolor_blueteam) //blue + else if (players[tab[i].num].ctfteam == 2) //blue { blueplayers++; x = 14; @@ -2103,7 +2103,7 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer) if (players[tab[i].num].spectator) continue; //ignore them. - if (tab[i].color == skincolor_redteam) //red + if (players[tab[i].num].ctfteam == 1) //red { if (redplayers++ > 8) { @@ -2111,7 +2111,7 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer) break; // don't make more loops than we need to. } } - else if (tab[i].color == skincolor_blueteam) //blue + else if (players[tab[i].num].ctfteam == 2) //blue { if (blueplayers++ > 8) { @@ -2142,14 +2142,14 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer) if (players[tab[i].num].spectator) continue; //ignore them. - if (tab[i].color == skincolor_redteam) //red + if (players[tab[i].num].ctfteam == 1) //red { if (redplayers++ > 8) continue; x = 32 + (BASEVIDWIDTH/2); y = (redplayers * 16) + 16; } - else if (tab[i].color == skincolor_blueteam) //blue + else if (players[tab[i].num].ctfteam == 2) //blue { if (blueplayers++ > 8) continue; From 92fc592966cd544d9a2cf3a6dd8fe87604f67981 Mon Sep 17 00:00:00 2001 From: kaldrum1 <116390251+kaldrum1@users.noreply.github.com> Date: Sat, 25 May 2024 20:08:43 -0700 Subject: [PATCH 095/353] fix spr2defaults probably --- src/hardware/hw_md2.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 0bb8de851..97864bf7b 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1099,13 +1099,13 @@ static modelspr2frames_t *HWR_GetModelSprite2Frames(md2_t *md2, UINT16 spr2) return NULL; } -static modelspr2frames_t *HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT16 spr2, player_t *player) +static UINT16 *HWR_GetModelSprite2Num(md2_t *md2, skin_t *skin, UINT16 spr2, player_t *player) { UINT16 super = 0; UINT8 i = 0; if (!md2 || !md2->model || !skin) - return HWR_GetModelSprite2Frames(md2, 0); + return 0; while (!HWR_GetModelSprite2Frames(md2, spr2) && spr2 != SPR2_STND @@ -1145,7 +1145,7 @@ static modelspr2frames_t *HWR_GetModelSprite2(md2_t *md2, skin_t *skin, UINT16 s if (i >= 32) // probably an infinite loop... spr2 = 0; - return HWR_GetModelSprite2Frames(md2, spr2); + return spr2; } // Adjust texture coords of model to fit into a patch's max_s and max_t @@ -1269,6 +1269,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(spr->mobj)); const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !R_ThingHorizontallyFlipped(spr->mobj)); spritedef_t *sprdef; + UINT16 spr2 = 0; spriteframe_t *sprframe; INT32 mod; interpmobjstate_t interp; @@ -1438,13 +1439,17 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) frame = (spr->mobj->frame & FF_FRAMEMASK); if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) - spr2frames = HWR_GetModelSprite2(md2, spr->mobj->skin, spr->mobj->sprite2, spr->mobj->player); + { + spr2 = HWR_GetModelSprite2Num(md2, spr->mobj->skin, spr->mobj->sprite2, spr->mobj->player); + spr2frames = HWR_GetModelSprite2Frames(md2, spr2); + } if (spr2frames) { + spritedef_t *defaultdef = P_GetSkinSpritedef(spr->mobj->skin, spr2); mod = spr2frames->numframes; #ifndef DONTHIDEDIFFANIMLENGTH // by default, different anim length is masked by the mod - if (mod > (INT32)sprdef->numframes) - mod = sprdef->numframes; + if (mod > (INT32)defaultdef->numframes) + mod = defaultdef->numframes; #endif if (!mod) mod = 1; From b7fdcdf2b2ba68bea3b2899d8702a6674eb8187f Mon Sep 17 00:00:00 2001 From: kaldrum1 <116390251+kaldrum1@users.noreply.github.com> Date: Sat, 25 May 2024 20:49:29 -0700 Subject: [PATCH 096/353] fix spr2defaults pretty sure --- src/hardware/hw_md2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 97864bf7b..0f466f051 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1093,13 +1093,13 @@ static modelspr2frames_t *HWR_GetModelSprite2Frames(md2_t *md2, UINT16 spr2) return &md2->model->superspr2frames[spr2]; } - if (md2->model->spr2frames) + if (md2->model->spr2frames[spr2].numframes) return &md2->model->spr2frames[spr2]; return NULL; } -static UINT16 *HWR_GetModelSprite2Num(md2_t *md2, skin_t *skin, UINT16 spr2, player_t *player) +static UINT16 HWR_GetModelSprite2Num(md2_t *md2, skin_t *skin, UINT16 spr2, player_t *player) { UINT16 super = 0; UINT8 i = 0; From 19500742d2179417b4441a97ff5ea592f0e8c237 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 26 May 2024 13:00:16 +0200 Subject: [PATCH 097/353] Avoid updating IPv4 MS entry if it failed to register --- src/netcode/http-mserv.c | 44 +++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/netcode/http-mserv.c b/src/netcode/http-mserv.c index b8c662a51..4a0804984 100644 --- a/src/netcode/http-mserv.c +++ b/src/netcode/http-mserv.c @@ -486,20 +486,23 @@ int HMS_unlist (void) { struct HMS_buffer *hms; - int ok; + int ok = 0; - hms = HMS_connect(PROTO_V4, "servers/%s/unlist", hms_server_token); + if (hms_server_token) + { + hms = HMS_connect(PROTO_V4, "servers/%s/unlist", hms_server_token); - if (! hms) - return 0; + if (! hms) + return 0; - curl_easy_setopt(hms->curl, CURLOPT_POST, 1); - curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0); + curl_easy_setopt(hms->curl, CURLOPT_POST, 1); + curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0); - ok = HMS_do(hms); - HMS_end(hms); + ok = HMS_do(hms); + HMS_end(hms); - free(hms_server_token); + free(hms_server_token); + } #ifndef NO_IPV6 if (hms_server_token_ipv6 && hms_allow_ipv6) @@ -526,18 +529,13 @@ int HMS_update (void) { struct HMS_buffer *hms; - int ok; + int ok = 0; char post[256]; char *title; - hms = HMS_connect(PROTO_V4, "servers/%s/update", hms_server_token); - - if (! hms) - return 0; - - title = curl_easy_escape(hms->curl, cv_servername.string, 0); + title = curl_easy_escape(NULL, cv_servername.string, 0); snprintf(post, sizeof post, "title=%s", @@ -546,10 +544,18 @@ HMS_update (void) curl_free(title); - curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post); + if (hms_server_token) + { + hms = HMS_connect(PROTO_V4, "servers/%s/update", hms_server_token); - ok = HMS_do(hms); - HMS_end(hms); + if (! hms) + return 0; + + curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post); + + ok = HMS_do(hms); + HMS_end(hms); + } #ifndef NO_IPV6 if (hms_server_token_ipv6 && hms_allow_ipv6) From 3b14531dc2d56b7a8d38ff3fccdada71f018b67d Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sun, 26 May 2024 17:51:20 +0200 Subject: [PATCH 098/353] Fix spriteinfo indexing --- src/lua_infolib.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/lua_infolib.c b/src/lua_infolib.c index eeb1067a3..67b9fb82d 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -242,17 +242,12 @@ static int lib_getSpriteInfo(lua_State *L) UINT32 i = NUMSPRITES; lua_remove(L, 1); - if (lua_isstring(L, 1)) + if (lua_type(L, 1) == LUA_TSTRING) { const char *name = lua_tostring(L, 1); INT32 spr = R_GetSpriteNumByName(name); if (spr == NUMSPRITES) - { - char *check; - i = strtol(name, &check, 10); - if (check == name || *check != '\0') - return luaL_error(L, "unknown sprite name %s", name); - } + return luaL_error(L, "unknown sprite name %s", name); i = spr; } else From 1ba9ecf02794e3acfd8def53ef5dd219b1e173eb Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Sun, 26 May 2024 17:51:48 +0200 Subject: [PATCH 099/353] Add missing newline in console warning --- src/lua_infolib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_infolib.c b/src/lua_infolib.c index 67b9fb82d..511c20031 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -1735,7 +1735,7 @@ static int lib_setSkinColor(lua_State *L) else if (i == 6 || (str && fastcmp(str,"accessible"))) { boolean v = lua_toboolean(L, 3); if (cnum < FIRSTSUPERCOLOR && v != skincolors[cnum].accessible) - CONS_Alert(CONS_WARNING, "skincolors[] index %d is a standard color; accessibility changes are prohibited.", cnum); + CONS_Alert(CONS_WARNING, "skincolors[] index %d is a standard color; accessibility changes are prohibited.\n", cnum); else info->accessible = v; } @@ -1830,7 +1830,7 @@ static int skincolor_set(lua_State *L) else if (fastcmp(field,"accessible")) { boolean v = lua_toboolean(L, 3); if (cnum < FIRSTSUPERCOLOR && v != skincolors[cnum].accessible) - CONS_Alert(CONS_WARNING, "skincolors[] index %d is a standard color; accessibility changes are prohibited.", cnum); + CONS_Alert(CONS_WARNING, "skincolors[] index %d is a standard color; accessibility changes are prohibited.\n", cnum); else info->accessible = v; } else From c53da609b1d7eba57d460da8a3b7ac598ac25065 Mon Sep 17 00:00:00 2001 From: Zwip-Zwap Zapony Date: Tue, 28 May 2024 14:17:57 +0200 Subject: [PATCH 100/353] Shield button prompt for old configs --- src/m_menu.c | 37 +++++++++++++++++++++++++++++++++++++ src/m_menu.h | 1 + src/m_misc.c | 5 +++++ 3 files changed, 43 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index 4d8ee17e8..86f8516b6 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -140,6 +140,7 @@ static char *char_notes = NULL; boolean menuactive = false; boolean fromlevelselect = false; +tic_t shieldbuttonprompt = 0; // Show a prompt about the new Shield button for old configs // TODO: 2.3: Remove typedef enum { @@ -3161,6 +3162,7 @@ static void Command_Manual_f(void) if (modeattacking) return; M_StartControlPanel(); + if (shieldbuttonprompt) return; // TODO: 2.3: Delete this line currentMenu = &MISC_HelpDef; itemOn = 0; } @@ -3340,6 +3342,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); + if (shieldbuttonprompt) return true; // TODO: 2.3: Delete this line M_Options(0); // Uncomment the below if you want the menu to reset to the top each time like before. M_SetupNextMenu will fix it automatically. //OP_SoundOptionsDef.lastOn = 0; @@ -3350,6 +3353,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); + if (shieldbuttonprompt) return true; // TODO: 2.3: Delete this line M_Options(0); M_VideoModeMenu(0); return true; @@ -3361,6 +3365,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); + if (shieldbuttonprompt) return true; // TODO: 2.3: Delete this line M_Options(0); M_SetupNextMenu(&OP_MainDef); return true; @@ -3631,6 +3636,27 @@ void M_Drawer(void) } } +// Handle the "Do you want to assign Shield Ability now?" pop-up for old configs // TODO: 2.3: Remove +static void M_ShieldButtonResponse(INT32 ch) +{ + if (I_GetTime() <= shieldbuttonprompt) // Don't mash past the pop-up by accident! + { + stopstopmessage = true; + return; + } + + S_StartSound(NULL, sfx_menu1); + noFurtherInput = true; + shieldbuttonprompt = 0; + + if (ch == 'y' || ch == KEY_ENTER) + { + stopstopmessage = true; // Stop MessageDef from calling M_SetupNextMenu automatically + OP_ChangeControlsDef.lastOn = 8; // Highlight Shield Ability in the controls menu + M_Setup1PControlsMenu(ch); // Set up P1's controls menu and call M_SetupNextMenu + } +} + // // M_StartControlPanel // @@ -3662,6 +3688,17 @@ void M_StartControlPanel(void) currentMenu = &MainDef; itemOn = singleplr; M_UpdateItemOn(); + + if (shieldbuttonprompt) // For old configs, show a pop-up about the new Shield button // TODO: 2.3: Remove + { + S_StartSound(NULL, sfx_menu1); + shieldbuttonprompt = I_GetTime() + TICRATE; // Don't mash past the pop-up by accident! + + M_StartMessage(M_GetText("Welcome back! Since you last played,\nSpin has been split into separate\n\"Spin\" and \"Shield Ability\" controls." + "\n\nDo you want to \x82""assign Shield Ability now\x80""?" + "\n\n\nPress \x82""ENTER\x80"" or the \x83""A button\x80"" to accept\nPress \x82""ESC\x80"" or the \x85""B button\x80"" to skip\n"), + M_ShieldButtonResponse, MM_YESNO); + } } else if (modeattacking) { diff --git a/src/m_menu.h b/src/m_menu.h index 99a5b6de4..ea130a607 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -176,6 +176,7 @@ typedef struct extern menupres_t menupres[NUMMENUTYPES]; extern UINT32 prevMenuId; extern UINT32 activeMenuId; +extern tic_t shieldbuttonprompt; // Show a prompt about the new Shield button for old configs // TODO: 2.3: Remove void M_InitMenuPresTables(void); UINT8 M_GetYoungestChildMenu(void); diff --git a/src/m_misc.c b/src/m_misc.c index a60bbea98..ee810a031 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -560,6 +560,11 @@ void M_FirstLoadConfig(void) COM_BufInsertText(va("exec \"%s\"\n", configfile)); // no COM_BufExecute() needed; that does it right away + // For configs loaded at startup only, check for pre-Shield-button configs // TODO: 2.3: Remove + if (GETMAJOREXECVERSION(cv_execversion.value) < 55 // Pre-v2.2.14 configs + && cv_execversion.value != 25) // Make sure that the config exists, too + shieldbuttonprompt = 1; + // don't filter anymore vars and don't let this convsvar be changed COM_BufInsertText(va("%s \"%d\"\n", cv_execversion.name, EXECVERSION)); CV_ToggleExecVersion(false); From b1f15a35baf673ae970f606e6a46f7d4521e3f9b Mon Sep 17 00:00:00 2001 From: Zwip-Zwap Zapony Date: Tue, 28 May 2024 14:25:30 +0200 Subject: [PATCH 101/353] Use a three-option menu instead of a yes/no prompt --- src/m_menu.c | 249 ++++++++++++++++++++++++++++++++++++++++++++++----- src/m_menu.h | 2 +- src/m_misc.c | 2 +- 3 files changed, 227 insertions(+), 26 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 86f8516b6..a459abf41 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -140,7 +140,7 @@ static char *char_notes = NULL; boolean menuactive = false; boolean fromlevelselect = false; -tic_t shieldbuttonprompt = 0; // Show a prompt about the new Shield button for old configs // TODO: 2.3: Remove +tic_t shieldprompt_timer = 0; // Show a prompt about the new Shield button for old configs // TODO: 2.3: Remove typedef enum { @@ -3162,7 +3162,7 @@ static void Command_Manual_f(void) if (modeattacking) return; M_StartControlPanel(); - if (shieldbuttonprompt) return; // TODO: 2.3: Delete this line + if (shieldprompt_timer) return; // TODO: 2.3: Delete this line currentMenu = &MISC_HelpDef; itemOn = 0; } @@ -3342,7 +3342,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); - if (shieldbuttonprompt) return true; // TODO: 2.3: Delete this line + if (shieldprompt_timer) return true; // TODO: 2.3: Delete this line M_Options(0); // Uncomment the below if you want the menu to reset to the top each time like before. M_SetupNextMenu will fix it automatically. //OP_SoundOptionsDef.lastOn = 0; @@ -3353,7 +3353,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); - if (shieldbuttonprompt) return true; // TODO: 2.3: Delete this line + if (shieldprompt_timer) return true; // TODO: 2.3: Delete this line M_Options(0); M_VideoModeMenu(0); return true; @@ -3365,7 +3365,7 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); - if (shieldbuttonprompt) return true; // TODO: 2.3: Delete this line + if (shieldprompt_timer) return true; // TODO: 2.3: Delete this line M_Options(0); M_SetupNextMenu(&OP_MainDef); return true; @@ -3636,27 +3636,230 @@ void M_Drawer(void) } } -// Handle the "Do you want to assign Shield Ability now?" pop-up for old configs // TODO: 2.3: Remove -static void M_ShieldButtonResponse(INT32 ch) +// Handle the "Do you want to assign Shield Ability now?" pop-up for old configs // TODO: 2.3: Remove this line... +static UINT8 shieldprompt_currentchoice = 0; // ...and this line... + +static void M_ShieldPromptUseDefaults(void) // ...and this function { - if (I_GetTime() <= shieldbuttonprompt) // Don't mash past the pop-up by accident! + // With a default config from v2.2.10 to v2.2.13, the B button will be set to Custom 1, + // and Controls per Key defaults to "One", so it will override the default Shield button. + // A default config from v2.2.0 to v2.2.9 has Next Weapon on B, so it suffers from this too. + + // So for "Use default Shield Ability buttons", we should update old configs to mitigate gamepad conflicts + // (even with "Several" Controls per Key!), and show a message with the default bindings + + for (setupcontrols = gamecontrol; true; setupcontrols = gamecontrolbis) // Do stuff for both P1 and P2 { - stopstopmessage = true; - return; + INT32 JOY1 = (setupcontrols == gamecontrol) ? KEY_JOY1 : KEY_2JOY1; // Is this for P1 or for P2? + + if ((setupcontrols[GC_CUSTOM1][0] == JOY1+1 || setupcontrols[GC_CUSTOM1][1] == JOY1+1) + && (setupcontrols[GC_CUSTOM2][0] == JOY1+3 || setupcontrols[GC_CUSTOM2][1] == JOY1+3) + && (setupcontrols[GC_CUSTOM3][0] == JOY1+8 || setupcontrols[GC_CUSTOM3][1] == JOY1+8)) + { + // If the player has v2.2.13's default gamepad Custom 1/2/3 buttons, + // shuffle Custom 1/2/3 around to make room for Shield Ability on B + UINT8 shield_slot = (setupcontrols[GC_SHIELD ][0] == KEY_NULL ) ? 0 : 1; + UINT8 custom1_slot = (setupcontrols[GC_CUSTOM1][0] == JOY1+1) ? 0 : 1; + UINT8 custom2_slot = (setupcontrols[GC_CUSTOM2][0] == JOY1+3) ? 0 : 1; + UINT8 custom3_slot = (setupcontrols[GC_CUSTOM3][0] == JOY1+8) ? 0 : 1; + + setupcontrols[GC_SHIELD ][shield_slot ] = JOY1+1; // Assign Shield Ability to B + setupcontrols[GC_CUSTOM1][custom1_slot] = JOY1+3; // Move Custom 1 from B to Y + setupcontrols[GC_CUSTOM2][custom2_slot] = JOY1+8; // Move Custom 2 from Y to LS + setupcontrols[GC_CUSTOM3][custom3_slot] = KEY_NULL; // Unassign Custom 3 from LS... + // (The alternative would be to check and update the ENTIRE gamepad layout. + // That'd be nice, but it would mess with people that are used to the old defaults.) + } + else if ((setupcontrols[GC_WEAPONNEXT][0] == JOY1+1 || setupcontrols[GC_WEAPONNEXT][1] == JOY1+1) + && (setupcontrols[GC_WEAPONPREV][0] == JOY1+2 || setupcontrols[GC_WEAPONPREV][1] == JOY1+2)) + { + // Or if the user has a default config from v2.2.0 to v2.2.9, + // the B button will be Next Weapon, and X will be Previous Weapon. + // It's "safe" to discard one of them, you just have to press X multiple times to select in the other direction + UINT8 shield_slot = (setupcontrols[GC_SHIELD ][0] == KEY_NULL ) ? 0 : 1; + UINT8 nweapon_slot = (setupcontrols[GC_WEAPONNEXT][0] == JOY1+1) ? 0 : 1; + UINT8 pweapon_slot = (setupcontrols[GC_WEAPONPREV][0] == JOY1+2) ? 0 : 1; + + setupcontrols[GC_SHIELD ][shield_slot ] = JOY1+1; // Assign Shield Ability to B + setupcontrols[GC_WEAPONNEXT][nweapon_slot] = JOY1+3; // Move Next Weapon from B to X + setupcontrols[GC_WEAPONPREV][pweapon_slot] = KEY_NULL; // Unassign Previous Weapon from X + } + + if (setupcontrols == gamecontrolbis) // If we've already updated both players, break out + break; } - S_StartSound(NULL, sfx_menu1); - noFurtherInput = true; - shieldbuttonprompt = 0; - if (ch == 'y' || ch == KEY_ENTER) + // Now, show a message about the default Shield Ability bindings + if ((gamecontrol[GC_SHIELD][0] == KEY_LALT && gamecontrol[GC_SHIELD][1] == KEY_JOY1+1) + || (gamecontrol[GC_SHIELD][0] == KEY_JOY1+1 && gamecontrol[GC_SHIELD][1] == KEY_LALT)) { - stopstopmessage = true; // Stop MessageDef from calling M_SetupNextMenu automatically - OP_ChangeControlsDef.lastOn = 8; // Highlight Shield Ability in the controls menu - M_Setup1PControlsMenu(ch); // Set up P1's controls menu and call M_SetupNextMenu + // Left Alt and the B button are both assigned + M_StartMessage(M_GetText("Shield Ability defaults to\nthe \x82""Left Alt\x80"" key on keyboard,\nand the \x85""B button\x80"" on gamepads." + "\n\nYou can always reassign it\nin the Options menu later." + "\n\n\nPress 'Enter' to continue\n"), + NULL, MM_NOTHING); + MessageDef.x = 43; // Change the pop-up message's background position/width + MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 27; + } + else if (gamecontrol[GC_SHIELD][0] == KEY_LALT || gamecontrol[GC_SHIELD][1] == KEY_LALT) + { + // Left Alt is assigned, but the B button isn't. + M_StartMessage(M_GetText("Shield Ability defaults to\nthe \x82""Left Alt\x80"" key on keyboard.\nThe \x85""B button\x80"" on gamepads was taken." + "\n\nYou can always reassign it\nin the Options menu later." + "\n\n\nPress 'Enter' to continue\n"), + NULL, MM_NOTHING); + MessageDef.x = 24; // Change the pop-up message's background position/width + MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 32; + } + else if (gamecontrol[GC_SHIELD][0] == KEY_JOY1+1 || gamecontrol[GC_SHIELD][1] == KEY_JOY1+1) + { + // The B button is assigned, but Left Alt isn't + M_StartMessage(M_GetText("Shield Ability defaults to\nthe \x85""B button\x80"" on gamepads.\nThe \x82""Left Alt\x80"" key on keyboard was taken." + "\n\nYou can always reassign it\nin the Options menu later." + "\n\n\nPress 'Enter' to continue\n"), + NULL, MM_NOTHING); + MessageDef.x = 8; // Change the pop-up message's background position/width + MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 36; + } + else if (gamecontrol[GC_SHIELD][0] == KEY_NULL && gamecontrol[GC_SHIELD][1] == KEY_NULL) + { + // Neither Left Alt nor the B button are assigned + M_StartMessage(M_GetText("Shield Ability is unassigned!\nThe \x82""Left Alt\x80"" key on keyboard and\nthe \x85""B button\x80"" on gamepads were taken." + "\n\nYou should assign Shield Ability\nin the Options menu later." + "\n\n\nPress 'Enter' to continue\n"), + NULL, MM_NOTHING); + MessageDef.x = 19; // Change the pop-up message's background position/width + MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 33; + } + else + { + // Neither Left Alt nor the B button are assigned... but something else is??? + // (This can technically happen if you edit your config or use setcontrol in the console before opening the menu) + char keystr[16+16+2+7+1]; // Two 16-char keys + two colour codes + "' and '" + null + + if (gamecontrol[GC_SHIELD][0] != KEY_NULL && gamecontrol[GC_SHIELD][1] != KEY_NULL) + STRBUFCPY(keystr, va("%s\x80""' and '\x82""%s", + G_KeyNumToName(gamecontrol[GC_SHIELD][0]), + G_KeyNumToName(gamecontrol[GC_SHIELD][1]))); + else if (gamecontrol[GC_SHIELD][0] != KEY_NULL) + STRBUFCPY(keystr, G_KeyNumToName(gamecontrol[GC_SHIELD][0])); + else //if (gamecontrol[GC_SHIELD][1] != KEY_NULL) + STRBUFCPY(keystr, G_KeyNumToName(gamecontrol[GC_SHIELD][1])); + + M_StartMessage(va("Shield Ability is assigned to\n'\x82""%s\x80""'." + "\n\nYou can always reassign it\nin the Options menu later." + "\n\n\nPress 'Enter' to continue\n", + keystr), NULL, MM_NOTHING); + MessageDef.x = 23; // Change the pop-up message's background position/width + MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 32; } } +static void M_HandleShieldPromptMenu(INT32 choice) // TODO: 2.3: Remove +{ + switch (choice) + { + case KEY_ESCAPE: + if (I_GetTime() <= shieldprompt_timer) // Don't mash past the pop-up by accident! + break; + + S_StartSound(NULL, sfx_menu1); + noFurtherInput = true; + shieldprompt_timer = 0; + M_ShieldPromptUseDefaults(); + break; + + case KEY_ENTER: + if (I_GetTime() <= shieldprompt_timer) // Don't mash past the pop-up by accident! + break; + + S_StartSound(NULL, sfx_menu1); + noFurtherInput = true; + shieldprompt_timer = 0; + + if (shieldprompt_currentchoice == 0) + { + OP_ChangeControlsDef.lastOn = 8; // Highlight Shield Ability in the controls menu + M_Setup1PControlsMenu(0); // Set up P1's controls menu and call M_SetupNextMenu + } + else if (shieldprompt_currentchoice == 1) // Copy the Spin buttons to the Shield buttons + { + CV_SetValue(&cv_controlperkey, 2); // Make sure that Controls per Key is "Several" + + gamecontrol [GC_SHIELD][0] = gamecontrol [GC_SPIN][0]; + gamecontrol [GC_SHIELD][1] = gamecontrol [GC_SPIN][1]; + gamecontrolbis[GC_SHIELD][0] = gamecontrolbis[GC_SPIN][0]; + gamecontrolbis[GC_SHIELD][1] = gamecontrolbis[GC_SPIN][1]; + CV_SetValue(&cv_shieldaxis, cv_spinaxis.value); + CV_SetValue(&cv_shieldaxis2, cv_spinaxis2.value); + + M_StartMessage(M_GetText("Spin and Shield Ability are now\nthe same button." + "\n\nYou can always reassign them\nin the Options menu later." + "\n\n\nPress 'Enter' to continue\n"), + NULL, MM_NOTHING); + MessageDef.x = 36; // Change the pop-up message's background position/width + MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 29; + } + else + M_ShieldPromptUseDefaults(); + break; + + case KEY_UPARROW: + S_StartSound(NULL, sfx_menu1); + shieldprompt_currentchoice = (shieldprompt_currentchoice+2)%3; + break; + + case KEY_DOWNARROW: + S_StartSound(NULL, sfx_menu1); + shieldprompt_currentchoice = (shieldprompt_currentchoice+1)%3; + break; + } + + MessageDef.prevMenu = &MainDef; +} + +static void M_DrawShieldPromptMenu(void) // TODO: 2.3: Remove +{ + INT16 cursorx = (BASEVIDWIDTH/2) - 24; + + V_DrawFill(10-3, 68-3, 300+6, 40+6, 159); + // V_DrawCenteredString doesn't centre newlines, so we have to draw each line separately + V_DrawCenteredString(BASEVIDWIDTH/2, 68, V_ALLOWLOWERCASE, "Welcome back! Since you last played,"); + V_DrawCenteredString(BASEVIDWIDTH/2, 76, V_ALLOWLOWERCASE, "Spin has been split into separate"); + V_DrawCenteredString(BASEVIDWIDTH/2, 84, V_ALLOWLOWERCASE, "\"Spin\" and \"Shield Ability\" controls."); + + V_DrawCenteredString(BASEVIDWIDTH/2, 98, V_ALLOWLOWERCASE, "Do you want to assign Shield Ability now?"); + + + V_DrawCenteredString(BASEVIDWIDTH/2, 164, + (shieldprompt_currentchoice == 0) ? V_YELLOWMAP : 0, "Open Control Setup"); + V_DrawCenteredString(BASEVIDWIDTH/2, 172, + (shieldprompt_currentchoice == 1) ? V_YELLOWMAP : 0, "Keep the old behaviour"); + V_DrawCenteredString(BASEVIDWIDTH/2, 180, + (shieldprompt_currentchoice == 2) ? V_YELLOWMAP : 0, "Use default Shield Ability buttons"); + + switch (shieldprompt_currentchoice) + { + case 0: cursorx -= V_StringWidth("Open Control Setup", 0)/2; break; + case 1: cursorx -= V_StringWidth("Keep the old behaviour", 0)/2; break; + default: cursorx -= V_StringWidth("Use default Shield Ability buttons", 0)/2; break; + } + V_DrawScaledPatch(cursorx, 164 + (shieldprompt_currentchoice*8), 0, W_CachePatchName("M_CURSOR", PU_PATCH)); +} + +static menuitem_t OP_ShieldPromptMenu[] = {{IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleShieldPromptMenu, 0}}; // TODO: 2.3: Remove + +menu_t OP_ShieldPromptDef = { // TODO: 2.3: Remove + MN_SPECIAL, + NULL, + 1, + &MainDef, + OP_ShieldPromptMenu, + M_DrawShieldPromptMenu, + 0, 0, 0, NULL +}; + // // M_StartControlPanel // @@ -3689,15 +3892,13 @@ void M_StartControlPanel(void) itemOn = singleplr; M_UpdateItemOn(); - if (shieldbuttonprompt) // For old configs, show a pop-up about the new Shield button // TODO: 2.3: Remove + if (shieldprompt_timer) // For old configs, show a pop-up about the new Shield button // TODO: 2.3: Remove { - S_StartSound(NULL, sfx_menu1); - shieldbuttonprompt = I_GetTime() + TICRATE; // Don't mash past the pop-up by accident! + S_StartSound(NULL, sfx_strpst); + noFurtherInput = true; + shieldprompt_timer = I_GetTime() + TICRATE; // Don't mash past the pop-up by accident! - M_StartMessage(M_GetText("Welcome back! Since you last played,\nSpin has been split into separate\n\"Spin\" and \"Shield Ability\" controls." - "\n\nDo you want to \x82""assign Shield Ability now\x80""?" - "\n\n\nPress \x82""ENTER\x80"" or the \x83""A button\x80"" to accept\nPress \x82""ESC\x80"" or the \x85""B button\x80"" to skip\n"), - M_ShieldButtonResponse, MM_YESNO); + M_SetupNextMenu(&OP_ShieldPromptDef); } } else if (modeattacking) diff --git a/src/m_menu.h b/src/m_menu.h index ea130a607..55c0b4060 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -176,7 +176,7 @@ typedef struct extern menupres_t menupres[NUMMENUTYPES]; extern UINT32 prevMenuId; extern UINT32 activeMenuId; -extern tic_t shieldbuttonprompt; // Show a prompt about the new Shield button for old configs // TODO: 2.3: Remove +extern tic_t shieldprompt_timer; // Show a prompt about the new Shield button for old configs // TODO: 2.3: Remove void M_InitMenuPresTables(void); UINT8 M_GetYoungestChildMenu(void); diff --git a/src/m_misc.c b/src/m_misc.c index ee810a031..724717aa6 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -563,7 +563,7 @@ void M_FirstLoadConfig(void) // For configs loaded at startup only, check for pre-Shield-button configs // TODO: 2.3: Remove if (GETMAJOREXECVERSION(cv_execversion.value) < 55 // Pre-v2.2.14 configs && cv_execversion.value != 25) // Make sure that the config exists, too - shieldbuttonprompt = 1; + shieldprompt_timer = 1; // don't filter anymore vars and don't let this convsvar be changed COM_BufInsertText(va("%s \"%d\"\n", cv_execversion.name, EXECVERSION)); From 712414817b946a82b60e2a66ed00cb69bc4aaf36 Mon Sep 17 00:00:00 2001 From: pastel Date: Tue, 28 May 2024 13:51:29 -0500 Subject: [PATCH 102/353] also fix ticcmd intro crash --- src/g_game.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index ed9e88362..bf369d111 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1386,6 +1386,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (PLAYERINPUTDOWN(ssplayer, GC_SPIN) || (usejoystick && axis > 0)) cmd->buttons |= BT_SPIN; + if (gamestate != GS_LEVEL) // not in a level, don't build anything else + { + cmd->angleturn = ticcmd_oldangleturn[forplayer]; + cmd->aiming = G_ClipAimingPitch(myaiming); + return; + } + // Centerview can be a toggle in simple mode! { static boolean last_centerviewdown[2], centerviewhold[2]; // detect taps for toggle behavior @@ -1717,7 +1724,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) // At this point, cmd doesn't contain the final angle yet, // So we need to temporarily transform it so Lua scripters // don't need to handle it differently than in other hooks. - if (addedtogame && gamestate == GS_LEVEL) + if (addedtogame) { INT16 extra = ticcmd_oldangleturn[forplayer] - player->oldrelangleturn; INT16 origangle = cmd->angleturn; From a2bba687ba73f29487648c26716763e57e1f4d74 Mon Sep 17 00:00:00 2001 From: SSNTails Date: Wed, 29 May 2024 17:19:49 -0400 Subject: [PATCH 103/353] Don't break automatic mode. --- src/p_user.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 1964a6b3e..6d3bcb168 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12134,8 +12134,6 @@ void P_PlayerThink(player_t *player) case CR_DUSTDEVIL: player->drawangle += ANG20; break; - case CR_FAN: // Don't impact drawangle in any special way when on a fan - break; /* -- in case we wanted to have the camera freely movable during zoom tubes case CR_ZOOMTUBE:*/ case CR_ROPEHANG: @@ -12146,7 +12144,8 @@ void P_PlayerThink(player_t *player) } /* FALLTHRU */ default: - player->drawangle = player->mo->angle; + if (player->powers[pw_carry] == CR_FAN && !(player->pflags & PF_DIRECTIONCHAR)) // Don't impact drawangle in any special way when on a fan + player->drawangle = player->mo->angle; break; } } From 19736fa55e5d789effd8657d3707e0a3f7c6f0ad Mon Sep 17 00:00:00 2001 From: SSNTails Date: Wed, 29 May 2024 21:18:36 -0400 Subject: [PATCH 104/353] possibly more valid...? --- 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 6d3bcb168..6d83a18e6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12144,7 +12144,7 @@ void P_PlayerThink(player_t *player) } /* FALLTHRU */ default: - if (player->powers[pw_carry] == CR_FAN && !(player->pflags & PF_DIRECTIONCHAR)) // Don't impact drawangle in any special way when on a fan + if (!(player->powers[pw_carry] == CR_FAN && (player->pflags & PF_DIRECTIONCHAR))) // Don't impact drawangle in any special way when on a fan player->drawangle = player->mo->angle; break; } From bd8684e3e0ef18691945e032bf9073871fae79f1 Mon Sep 17 00:00:00 2001 From: SSNTails Date: Wed, 29 May 2024 21:42:05 -0400 Subject: [PATCH 105/353] pastel's ideas --- src/p_user.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index f789de0d9..44d31ab44 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12129,6 +12129,10 @@ void P_PlayerThink(player_t *player) case CR_DUSTDEVIL: player->drawangle += ANG20; break; + case CR_FAN: + if (player->pflags & PF_ANALOGMODE) // Don't impact drawangle in any special way when on a fan + player->drawangle = player->mo->angle; + break; /* -- in case we wanted to have the camera freely movable during zoom tubes case CR_ZOOMTUBE:*/ case CR_ROPEHANG: @@ -12139,8 +12143,6 @@ void P_PlayerThink(player_t *player) } /* FALLTHRU */ default: - if (!(player->powers[pw_carry] == CR_FAN && (player->pflags & PF_DIRECTIONCHAR))) // Don't impact drawangle in any special way when on a fan - player->drawangle = player->mo->angle; break; } } From b453e6732d50727b0423e6a32eea086e3fd2849d Mon Sep 17 00:00:00 2001 From: SSNTails Date: Wed, 29 May 2024 21:43:09 -0400 Subject: [PATCH 106/353] pastel's ideas #2 --- src/p_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_user.c b/src/p_user.c index 44d31ab44..a995e87f9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -12143,6 +12143,7 @@ void P_PlayerThink(player_t *player) } /* FALLTHRU */ default: + player->drawangle = player->mo->angle; break; } } From dd1ac23bdb6550d9c0db9528b577451b3001aee5 Mon Sep 17 00:00:00 2001 From: pastel Date: Fri, 31 May 2024 15:52:24 -0500 Subject: [PATCH 107/353] Update skin cvar from character select and compare against cvar when warping to map without character select --- src/d_main.c | 2 +- src/m_menu.c | 12 +++++++----- src/netcode/d_netcmd.c | 12 +++++++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index c139650d1..d96ad9813 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -983,7 +983,7 @@ void D_StartTitle(void) emeralds = 0; memset(&luabanks, 0, sizeof(luabanks)); lastmaploaded = 0; - pickedchar = R_SkinAvailable(cv_defaultskin.string); + pickedchar = R_SkinAvailable(cv_skin.string); // In case someone exits out at the same time they start a time attack run, // reset modeattacking diff --git a/src/m_menu.c b/src/m_menu.c index 4d8ee17e8..798ab43df 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3674,7 +3674,7 @@ void M_StartControlPanel(void) { // Devmode unlocks Pandora's Box in the pause menu boolean pandora = ((M_SecretUnlocked(SECRET_PANDORA, serverGamedata) || cv_debug || devparm) && !marathonmode); - + if (gamestate != GS_LEVEL || ultimatemode) // intermission, so gray out stuff. { SPauseMenu[spause_pandora].status = (pandora) ? (IT_GRAYEDOUT) : (IT_DISABLED); @@ -4156,7 +4156,7 @@ static void M_DrawStaticBox(fixed_t x, fixed_t y, INT32 flags, fixed_t w, fixed_ temp = (gametic % temp) * h*2*FRACUNIT; // Which frame to draw V_DrawCroppedPatch(x*FRACUNIT, y*FRACUNIT, (w*FRACUNIT) / 160, (h*FRACUNIT) / 100, flags, patch, NULL, 0, temp, w*2*FRACUNIT, h*2*FRACUNIT); - + W_UnlockCachedPatch(patch); return; } @@ -9510,6 +9510,8 @@ static void M_ChoosePlayer(INT32 choice) //lastmapsaved = 0; gamecomplete = 0; + CV_StealthSet(&cv_skin, skins[skinnum]->name); + G_DeferedInitNew(ultmode, G_BuildMapName(startmap), skinnum, false, fromlevelselect); COM_BufAddText("dummyconsvar 1\n"); // G_DeferedInitNew doesn't do this @@ -10186,7 +10188,7 @@ void M_DrawNightsAttackMenu(void) skinnumber = 0; //Default to Sonic else skinnumber = (cv_chooseskin.value-1); - + spritedef_t *sprdef = &skins[skinnumber]->sprites[SPR2_NFLY]; //Make our patch the selected character's NFLY sprite spritetimer = FixedInt(ntsatkdrawtimer/2) % skins[skinnumber]->sprites[SPR2_NFLY].numframes; //Make the sprite timer cycle though all the frames at 2 tics per frame spriteframe_t *sprframe = &sprdef->spriteframes[spritetimer]; //Our animation frame is equal to the number on the timer @@ -10199,11 +10201,11 @@ void M_DrawNightsAttackMenu(void) color = skins[skinnumber]->supercolor+4; else //If you don't go super in NiGHTS or at all, use prefcolor color = skins[skinnumber]->prefcolor; - + angle_t fa = (FixedAngle(((FixedInt(ntsatkdrawtimer * 4)) % 360)<>ANGLETOFINESHIFT) & FINEMASK; V_DrawFixedPatch(270<highresscale, skins[skinnumber]->shieldscale), + FixedDiv(skins[skinnumber]->highresscale, skins[skinnumber]->shieldscale), (sprframe->flip & 1<<6) ? V_FLIP : 0, natksprite, R_GetTranslationColormap(TC_BLINK, color, GTC_CACHE)); diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index e073a863c..cab1d6072 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -1308,7 +1308,7 @@ static void SendNameAndColor(void) SetColorLocal(consoleplayer, cv_playercolor.value); - if (splitscreen) + if (splitscreen || (!pickedchar && stricmp(cv_skin.string, skins[consoleplayer]->name) != 0)) SetSkinLocal(consoleplayer, R_SkinAvailable(cv_skin.string)); else SetSkinLocal(consoleplayer, pickedchar); @@ -4608,7 +4608,7 @@ static void Command_ExitLevel_f(void) SendNetXCmd(XD_EXITLEVEL, NULL, 0); return; } - + // Allow exiting without cheating if at least one player beat the level // Consistent with just setting playersforexit to one if (splitscreen || multiplayer) @@ -4622,7 +4622,7 @@ static void Command_ExitLevel_f(void) continue; if (players[i].lives <= 0) continue; - + if ((players[i].pflags & PF_FINISHED) || players[i].exiting) { SendNetXCmd(XD_EXITLEVEL, NULL, 0); @@ -4630,7 +4630,7 @@ static void Command_ExitLevel_f(void) } } } - + // Only consider it a cheat if we're not allowed to go to the next map if (M_CampaignWarpIsCheat(gametype, G_GetNextMap(true, true) + 1, serverGamedata)) CONS_Alert(CONS_NOTICE, M_GetText("Cheats must be enabled to force exit to a locked level!\n")); @@ -4769,7 +4769,7 @@ static void Command_Cheats_f(void) G_SetUsedCheats(false); return; } - + if (usedCheats) CONS_Printf(M_GetText("Cheats are enabled, the game cannot be saved.\n")); else @@ -4941,6 +4941,8 @@ static boolean Skin2_CanChange(const char *valstr) */ static void Skin_OnChange(void) { + pickedchar = R_SkinAvailable(cv_skin.string); + if (!Playing()) return; From e2e879a7048b6f95e4771309f644148f61ba39c3 Mon Sep 17 00:00:00 2001 From: pastel Date: Fri, 31 May 2024 21:10:25 -0500 Subject: [PATCH 108/353] handle file loading correctly --- src/g_game.c | 14 +++++++------- src/m_menu.c | 8 ++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 8d19c9e7c..de95e9be3 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1363,11 +1363,11 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) axis = PlayerJoyAxis(ssplayer, JA_FIRENORMAL); if (PLAYERINPUTDOWN(ssplayer, GC_FIRENORMAL) || (usejoystick && axis > 0)) cmd->buttons |= BT_FIRENORMAL; - + // Toss flag button if (PLAYERINPUTDOWN(ssplayer, GC_TOSSFLAG)) cmd->buttons |= BT_TOSSFLAG; - + // Shield button axis = PlayerJoyAxis(ssplayer, JA_SHIELD); if (PLAYERINPUTDOWN(ssplayer, GC_SHIELD) || (usejoystick && axis > 0)) @@ -4018,7 +4018,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent) INT32 i; INT16 newmapnum; boolean spec = G_IsSpecialStage(gamemap); - + // go to next level // newmapnum is 0-based, unlike gamemap if (nextmapoverride != 0) @@ -4122,7 +4122,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent) if (spec && (!gottoken || ignoretokens) && !nextmapoverride) newmapnum = lastmap; // Exiting from a special stage? Go back to the game. Tails 08-11-2001 - + if (!(gametyperules & GTR_CAMPAIGN)) { if (cv_advancemap.value == 0) // Stay on same map. @@ -4130,7 +4130,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent) else if (cv_advancemap.value == 2) // Go to random map. newmapnum = RandMap(G_TOLFlag(gametype_to_use), prevmap); } - + return newmapnum; } @@ -4140,7 +4140,7 @@ INT16 G_GetNextMap(boolean ignoretokens, boolean silent) static void G_DoCompleted(void) { INT32 i; - + tokenlist = 0; // Reset the list if (modeattacking && pausedelay) @@ -4168,7 +4168,7 @@ static void G_DoCompleted(void) //Get and set prevmap/nextmap prevmap = (INT16)(gamemap-1); nextmap = G_GetNextMap(false, false); - + automapactive = false; // We are committed to this map now. diff --git a/src/m_menu.c b/src/m_menu.c index 798ab43df..a6deaae2f 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7000,7 +7000,10 @@ static void M_LevelSelectWarp(INT32 choice) if (currentMenu == &SP_LevelSelectDef || currentMenu == &SP_PauseLevelSelectDef) { if (cursaveslot > 0) // do we have a save slot to load? + { + CV_StealthSet(&cv_skin, DEFAULTSKIN); // already handled by loadgame so we don't want this G_LoadGame((UINT32)cursaveslot, startmap); // reload from SP save data: this is needed to keep score/lives/continues from reverting to defaults + } else // no save slot, start new game but keep the current skin { M_ClearMenus(true); @@ -8649,9 +8652,14 @@ static void M_LoadSelect(INT32 choice) M_NewGame(); } else if (savegameinfo[saveSlotSelected-1].gamemap & 8192) // Completed + { M_LoadGameLevelSelect(0); + } else + { + CV_StealthSet(&cv_skin, DEFAULTSKIN); // already handled by loadgame so we don't want this G_LoadGame((UINT32)saveSlotSelected, 0); + } cursaveslot = saveSlotSelected; } From c0c1b8de90b94589e81d6c2d0565938e9042ed0a Mon Sep 17 00:00:00 2001 From: pastel Date: Sat, 1 Jun 2024 14:40:44 -0500 Subject: [PATCH 109/353] don't adjust texture coords of nonexistant gpatch --- src/hardware/hw_md2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 0bb8de851..1c198a166 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1154,6 +1154,9 @@ static void adjustTextureCoords(model_t *model, patch_t *patch) int i; GLPatch_t *gpatch = ((GLPatch_t *)patch->hardware); + if (!gpatch) + return; + for (i = 0; i < model->numMeshes; i++) { int j; From f8a7ba4a75dc7860a4fef942c6b6bc702c8f767d Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 2 Jun 2024 16:54:11 -0300 Subject: [PATCH 110/353] Prevent infinite loop in R_RenderThickSideRange --- 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 d68db60de..d7296583c 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -469,7 +469,7 @@ static void R_DrawRepeatMaskedColumn(column_t *col, unsigned lengthcol) R_DrawMaskedColumn(col, lengthcol); - if ((INT64)topscreen + (INT64)texheight > (INT64)INT32_MAX) // prevent overflow + if ((INT64)sprtopscreen + (INT64)dc_texheight*spryscale > (INT64)INT32_MAX) // prevent overflow break; topscreen += texheight; @@ -504,7 +504,7 @@ static void R_DrawRepeatFlippedMaskedColumn(column_t *col, unsigned lengthcol) R_DrawFlippedMaskedColumn(col, lengthcol); - if ((INT64)topscreen + (INT64)texheight > (INT64)INT32_MAX) // prevent overflow + if ((INT64)sprtopscreen + (INT64)dc_texheight*spryscale > (INT64)INT32_MAX) // prevent overflow break; topscreen += texheight; From dd5f030b160eade4a97779574f209f679a0f31ad Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 2 Jun 2024 20:45:00 -0300 Subject: [PATCH 111/353] Use palette index 255 for transparency --- src/hardware/hw_cache.c | 40 ++++++- src/hardware/hw_glob.h | 2 +- src/hardware/hw_main.c | 19 ++-- src/hardware/r_opengl/r_opengl.c | 37 ++++++- src/r_defs.h | 2 + src/r_draw.h | 2 + src/r_draw8.c | 183 +++++++++++++++++++++++++++++++ src/r_segs.c | 144 +++++++++++++++++++++--- src/r_textures.c | 39 +++++-- src/r_textures.h | 1 + src/screen.c | 4 + src/screen.h | 4 + 12 files changed, 440 insertions(+), 37 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 56f5416cf..0022897d6 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -756,7 +756,7 @@ static void GetMapTexture(INT32 tex, GLMapTexture_t *grtex, GLMipmap_t *mipmap) Z_ChangeTag(mipmap->data, PU_HWRCACHE_UNLOCKED); } -GLMapTexture_t *HWR_GetTexture(INT32 tex) +GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean chromakeyed) { if (tex < 0 || tex >= (signed)gl_numtextures) { @@ -769,7 +769,43 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex) GLMapTexture_t *grtex = &gl_textures[tex]; - GetMapTexture(tex, grtex, &grtex->mipmap); + GLMipmap_t *grMipmap = &grtex->mipmap; + GLMipmap_t *originalMipmap = grMipmap; + + if (!originalMipmap->data && !originalMipmap->downloaded) + HWR_GenerateTexture(tex, grtex, originalMipmap); + + // If chroma-keyed, create or use a different mipmap for the variant + if (chromakeyed && !textures[tex]->transparency && originalMipmap->data) + { + // Allocate it if it wasn't already + if (!originalMipmap->nextcolormap) + { + GLMipmap_t *newMipmap = calloc(1, sizeof (*grMipmap)); + if (newMipmap == NULL) + I_Error("%s: Out of memory", "HWR_GetLevelFlat"); + + newMipmap->flags = TF_WRAPXY | TF_CHROMAKEYED; + newMipmap->width = (UINT16)textures[tex]->width; + newMipmap->height = (UINT16)textures[tex]->height; + newMipmap->format = textureformat; + originalMipmap->nextcolormap = newMipmap; + } + + // Upload and bind the variant texture instead of the original one + grMipmap = originalMipmap->nextcolormap; + + // Use the original texture's pixel data + // It can just be a pointer to it, since the r_opengl backend deals with the pixels + // that are supposed to be transparent. + grMipmap->data = originalMipmap->data; + } + + if (!grMipmap->downloaded) + HWD.pfnSetTexture(grMipmap); + HWR_SetCurrentTexture(grMipmap); + + Z_ChangeTag(grMipmap->data, PU_HWRCACHE_UNLOCKED); return grtex; } diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 807c70989..5678cd593 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -120,7 +120,7 @@ void HWR_GetPatch(patch_t *patch); void HWR_GetMappedPatch(patch_t *patch, const UINT8 *colormap); void HWR_GetFadeMask(lumpnum_t fademasklumpnum); -GLMapTexture_t *HWR_GetTexture(INT32 tex); +GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean chromakeyed); void HWR_GetLevelFlat(levelflat_t *levelflat, boolean chromakeyed); void HWR_GetRawFlat(lumpnum_t flatlumpnum); diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 68681295e..91b2e2c50 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -951,7 +951,7 @@ static void HWR_RenderMidtexture(INT32 gl_midtexture, float cliplow, float cliph else repeats = 1; - GLMapTexture_t *grTex = HWR_GetTexture(gl_midtexture); + GLMapTexture_t *grTex = HWR_GetTexture(gl_midtexture, true); float xscale = FixedToFloat(gl_sidedef->scalex_mid); float yscale = FixedToFloat(gl_sidedef->scaley_mid); @@ -1210,7 +1210,7 @@ static void HWR_ProcessSeg(void) // check TOP TEXTURE if ((worldhighslope < worldtopslope || worldhigh < worldtop) && gl_toptexture) { - grTex = HWR_GetTexture(gl_toptexture); + grTex = HWR_GetTexture(gl_toptexture, false); xscale = FixedToFloat(abs(gl_sidedef->scalex_top)); yscale = FixedToFloat(abs(gl_sidedef->scaley_top)); @@ -1300,7 +1300,7 @@ static void HWR_ProcessSeg(void) // check BOTTOM TEXTURE if ((worldlowslope > worldbottomslope || worldlow > worldbottom) && gl_bottomtexture) { - grTex = HWR_GetTexture(gl_bottomtexture); + grTex = HWR_GetTexture(gl_bottomtexture, false); xscale = FixedToFloat(abs(gl_sidedef->scalex_bottom)); yscale = FixedToFloat(abs(gl_sidedef->scaley_bottom)); @@ -1414,7 +1414,7 @@ static void HWR_ProcessSeg(void) // Single sided line... Deal only with the middletexture (if one exists) if (gl_midtexture && gl_linedef->special != SPECIAL_HORIZON_LINE) // (Ignore horizon line for OGL) { - grTex = HWR_GetTexture(gl_midtexture); + grTex = HWR_GetTexture(gl_midtexture, false); xscale = FixedToFloat(gl_sidedef->scalex_mid); yscale = FixedToFloat(gl_sidedef->scaley_mid); @@ -1588,7 +1588,7 @@ static void HWR_ProcessSeg(void) // -- Monster Iestyn 26/06/18 fixed_t texturevpeg = side->rowoffset + side->offsety_mid; - grTex = HWR_GetTexture(texnum); + grTex = HWR_GetTexture(texnum, true); xscale = FixedToFloat(side->scalex_mid); yscale = FixedToFloat(side->scaley_mid); @@ -1745,7 +1745,7 @@ static void HWR_ProcessSeg(void) // -- Monster Iestyn 26/06/18 fixed_t texturevpeg = side->rowoffset + side->offsety_mid; - grTex = HWR_GetTexture(texnum); + grTex = HWR_GetTexture(texnum, true); xscale = FixedToFloat(side->scalex_mid); yscale = FixedToFloat(side->scaley_mid); @@ -4086,7 +4086,7 @@ static void HWR_CreateDrawNodes(void) else if (sortnode[sortindex[i]].wall) { if (!(sortnode[sortindex[i]].wall->blend & PF_NoTexture)) - HWR_GetTexture(sortnode[sortindex[i]].wall->texnum); + HWR_GetTexture(sortnode[sortindex[i]].wall->texnum, true); HWR_RenderWall(sortnode[sortindex[i]].wall->wallVerts, &sortnode[sortindex[i]].wall->Surf, sortnode[sortindex[i]].wall->blend, sortnode[sortindex[i]].wall->fogwall, sortnode[sortindex[i]].wall->lightlevel, sortnode[sortindex[i]].wall->wallcolormap); } @@ -5066,6 +5066,8 @@ static void HWR_DrawSkyBackground(player_t *player) HWD.pfnSetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated); + HWR_GetTexture(texturetranslation[skytexture], false); + if (cv_glskydome.value) { FTransform dometransform; @@ -5081,8 +5083,6 @@ static void HWR_DrawSkyBackground(player_t *player) HWR_SetTransformAiming(&dometransform, player, false); dometransform.angley = (float)((viewangle-ANGLE_270)>>ANGLETOFINESHIFT)*(360.0f/(float)FINEANGLES); - HWR_GetTexture(texturetranslation[skytexture]); - if (gl_sky.texture != texturetranslation[skytexture]) { HWR_ClearSkyDome(); @@ -5102,7 +5102,6 @@ static void HWR_DrawSkyBackground(player_t *player) float aspectratio; float angleturn; - HWR_GetTexture(texturetranslation[skytexture]); aspectratio = (float)vid.width/(float)vid.height; //Hurdler: the sky is the only texture who need 4.0f instead of 1.0 diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 75a92c2fb..fa6b48b4f 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1556,8 +1556,41 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo) } else if (pTexInfo->format == GL_TEXFMT_RGBA) { - // Directly upload the texture data without any kind of conversion. - ptex = pImgData; + if (pTexInfo->flags & TF_CHROMAKEYED) + { + RGBA_t *color = (RGBA_t *)pTexInfo->data; + + AllocTextureBuffer(pTexInfo); + ptex = tex = textureBuffer; + + for (j = 0; j < h; j++) + { + for (i = 0; i < w; i++) + { + if (color->rgba == myPaletteData[HWR_PATCHES_CHROMAKEY_COLORINDEX].rgba) + { + tex[w*j+i].s.red = 0; + tex[w*j+i].s.green = 0; + tex[w*j+i].s.blue = 0; + tex[w*j+i].s.alpha = 0; + pTexInfo->flags |= TF_TRANSPARENT; // there is a hole in it + } + else + { + tex[w*j+i].s.red = color->s.red; + tex[w*j+i].s.green = color->s.green; + tex[w*j+i].s.blue = color->s.blue; + tex[w*j+i].s.alpha = color->s.alpha; + } + color++; + } + } + } + else + { + // Directly upload the texture data without any kind of conversion. + ptex = pImgData; + } } else if (pTexInfo->format == GL_TEXFMT_ALPHA_INTENSITY_88) { diff --git a/src/r_defs.h b/src/r_defs.h index da4dd2d70..a363d99ff 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -60,6 +60,8 @@ typedef UINT8 lighttable_t; #define CMF_FADEFULLBRIGHTSPRITES 1 #define CMF_FOG 4 +#define TEXTURE_255_IS_TRANSPARENT + // ExtraColormap type. Use for extra_colormaps from now on. typedef struct extracolormap_s { diff --git a/src/r_draw.h b/src/r_draw.h index 77588d7de..6a6ab2db1 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -154,9 +154,11 @@ void R_VideoErase(size_t ofs, INT32 count); void R_DrawColumn_8(void); void R_DrawColumnClamped_8(void); +void R_Draw2sMultiPatchColumn_8(void); void R_DrawShadeColumn_8(void); void R_DrawTranslucentColumn_8(void); void R_DrawTranslucentColumnClamped_8(void); +void R_Draw2sMultiPatchTranslucentColumn_8(void); void R_DrawDropShadowColumn_8(void); void R_DrawTranslatedColumn_8(void); void R_DrawTranslatedTranslucentColumn_8(void); diff --git a/src/r_draw8.c b/src/r_draw8.c index 735127f88..2011e4640 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -192,6 +192,189 @@ void R_DrawColumnClamped_8(void) } } +void R_Draw2sMultiPatchColumn_8(void) +{ + INT32 count; + register UINT8 *dest; + register fixed_t frac; + fixed_t fracstep; + + count = dc_yh - dc_yl; + + if (count < 0) // Zero length, column does not exceed a pixel. + return; + +#ifdef RANGECHECK + if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height) + return; +#endif + + // Framebuffer destination address. + dest = &topleft[dc_yl*vid.width + dc_x]; + + count++; + + // Determine scaling, which is the only mapping to be done. + fracstep = dc_iscale; + frac = dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep); + + // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. + // This is as fast as it gets. + { + register const UINT8 *source = dc_source; + register const lighttable_t *colormap = dc_colormap; + register INT32 heightmask = dc_texheight-1; + register UINT8 val; + if (dc_texheight & heightmask) // not a power of 2 -- killough + { + heightmask++; + heightmask <<= FRACBITS; + + if (frac < 0) + while ((frac += heightmask) < 0); + else + while (frac >= heightmask) + frac -= heightmask; + + do + { + // Re-map color indices from wall texture column + // using a lighting/special effects LUT. + // heightmask is the Tutti-Frutti fix + val = source[frac>>FRACBITS]; + + if (val != TRANSPARENTPIXEL) + *dest = colormap[val]; + + dest += vid.width; + + // Avoid overflow. + if (fracstep > 0x7FFFFFFF - frac) + frac += fracstep - heightmask; + else + frac += fracstep; + + while (frac >= heightmask) + frac -= heightmask; + } while (--count); + } + else + { + while ((count -= 2) >= 0) // texture height is a power of 2 + { + val = source[(frac>>FRACBITS) & heightmask]; + if (val != TRANSPARENTPIXEL) + *dest = colormap[val]; + dest += vid.width; + frac += fracstep; + val = source[(frac>>FRACBITS) & heightmask]; + if (val != TRANSPARENTPIXEL) + *dest = colormap[val]; + dest += vid.width; + frac += fracstep; + } + if (count & 1) + { + val = source[(frac>>FRACBITS) & heightmask]; + if (val != TRANSPARENTPIXEL) + *dest = colormap[val]; + } + } + } +} + +void R_Draw2sMultiPatchTranslucentColumn_8(void) +{ + INT32 count; + register UINT8 *dest; + register fixed_t frac; + fixed_t fracstep; + + count = dc_yh - dc_yl; + + if (count < 0) // Zero length, column does not exceed a pixel. + return; + +#ifdef RANGECHECK + if ((unsigned)dc_x >= (unsigned)vid.width || dc_yl < 0 || dc_yh >= vid.height) + return; +#endif + + // Framebuffer destination address. + dest = &topleft[dc_yl*vid.width + dc_x]; + + count++; + + // Determine scaling, which is the only mapping to be done. + fracstep = dc_iscale; + frac = dc_texturemid + FixedMul((dc_yl << FRACBITS) - centeryfrac, fracstep); + + // Inner loop that does the actual texture mapping, e.g. a DDA-like scaling. + // This is as fast as it gets. + { + register const UINT8 *source = dc_source; + register const UINT8 *transmap = dc_transmap; + register const lighttable_t *colormap = dc_colormap; + register INT32 heightmask = dc_texheight-1; + register UINT8 val; + if (dc_texheight & heightmask) // not a power of 2 -- killough + { + heightmask++; + heightmask <<= FRACBITS; + + if (frac < 0) + while ((frac += heightmask) < 0); + else + while (frac >= heightmask) + frac -= heightmask; + + do + { + // Re-map color indices from wall texture column + // using a lighting/special effects LUT. + // heightmask is the Tutti-Frutti fix + val = source[frac>>FRACBITS]; + + if (val != TRANSPARENTPIXEL) + *dest = *(transmap + (colormap[val]<<8) + (*dest)); + + dest += vid.width; + + // Avoid overflow. + if (fracstep > 0x7FFFFFFF - frac) + frac += fracstep - heightmask; + else + frac += fracstep; + + while (frac >= heightmask) + frac -= heightmask; + } while (--count); + } + else + { + while ((count -= 2) >= 0) // texture height is a power of 2 + { + val = source[(frac>>FRACBITS) & heightmask]; + if (val != TRANSPARENTPIXEL) + *dest = *(transmap + (colormap[val]<<8) + (*dest)); + dest += vid.width; + frac += fracstep; + val = source[(frac>>FRACBITS) & heightmask]; + if (val != TRANSPARENTPIXEL) + *dest = *(transmap + (colormap[val]<<8) + (*dest)); + dest += vid.width; + frac += fracstep; + } + if (count & 1) + { + val = source[(frac>>FRACBITS) & heightmask]; + if (val != TRANSPARENTPIXEL) + *dest = *(transmap + (colormap[val]<<8) + (*dest)); + } + } + } +} + /** \brief The R_DrawShadeColumn_8 function Experiment to make software go faster. Taken from the Boom source */ diff --git a/src/r_segs.c b/src/r_segs.c index 75c95aa93..8e9368baf 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -94,6 +94,98 @@ transnum_t R_GetLinedefTransTable(fixed_t alpha) return (20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1); } +// If we have a multi-patch texture on a 2sided wall (rare) then we draw +// it using R_DrawColumn, else we draw it using R_DrawMaskedColumn, this +// way we don't have to store extra post_t info with each column for +// multi-patch textures. They are not normally needed as multi-patch +// textures don't have holes in it. At least not for now. +static void R_Render2sidedMultiPatchColumn(column_t *column, unsigned lengthcol) +{ + INT32 topscreen, bottomscreen; + + post_t *post = &column->posts[0]; + if (!post->length) + return; + + topscreen = sprtopscreen; + bottomscreen = topscreen + spryscale * lengthcol; + + dc_yl = (sprtopscreen+FRACUNIT-1)>>FRACBITS; + dc_yh = (bottomscreen-1)>>FRACBITS; + + if (windowtop != INT32_MAX && windowbottom != INT32_MAX) + { + dc_yl = ((windowtop + FRACUNIT)>>FRACBITS); + dc_yh = (windowbottom - 1)>>FRACBITS; + } + + if (dc_yh >= mfloorclip[dc_x]) + dc_yh = mfloorclip[dc_x] - 1; + if (dc_yl <= mceilingclip[dc_x]) + dc_yl = mceilingclip[dc_x] + 1; + + if (dc_yl >= vid.height || dc_yh < 0) + return; + + if (dc_yl <= dc_yh && dc_yh < vid.height && dc_yh > 0) + { + dc_source = column->pixels + post->data_offset; + dc_postlength = post->length; + + if (colfunc == colfuncs[BASEDRAWFUNC]) + (colfuncs[COLDRAWFUNC_TWOSMULTIPATCH])(); + else if (colfunc == colfuncs[COLDRAWFUNC_FUZZY]) + (colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS])(); + else + colfunc(); + } +} + +static void R_RenderFlipped2sidedMultiPatchColumn(column_t *column, unsigned lengthcol) +{ + INT32 topscreen, bottomscreen; + + void (*localcolfunc)(void); + + post_t *post = &column->posts[0]; + if (!post->length) + return; + + topscreen = sprtopscreen; + bottomscreen = topscreen + spryscale * lengthcol; + + dc_yl = (sprtopscreen+FRACUNIT-1)>>FRACBITS; + dc_yh = (bottomscreen-1)>>FRACBITS; + + if (windowtop != INT32_MAX && windowbottom != INT32_MAX) + { + dc_yl = ((windowtop + FRACUNIT)>>FRACBITS); + dc_yh = (windowbottom - 1)>>FRACBITS; + } + + if (dc_yh >= mfloorclip[dc_x]) + dc_yh = mfloorclip[dc_x] - 1; + if (dc_yl <= mceilingclip[dc_x]) + dc_yl = mceilingclip[dc_x] + 1; + + if (dc_yl >= vid.height || dc_yh < 0) + return; + + if (dc_yl <= dc_yh && dc_yh < vid.height && dc_yh > 0) + { + dc_postlength = post->length; + + if (colfunc == colfuncs[BASEDRAWFUNC]) + localcolfunc = colfuncs[COLDRAWFUNC_TWOSMULTIPATCH]; + else if (colfunc == colfuncs[COLDRAWFUNC_FUZZY]) + localcolfunc = colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS]; + else + localcolfunc = colfunc; + + R_DrawFlippedPost(column->pixels + post->data_offset, post->length, localcolfunc); + } +} + void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) { size_t pindex; @@ -181,7 +273,16 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) // Texture must be cached R_CheckTextureCache(texnum); - if (vertflip) // vertically flipped? + // handle case where multipatch texture is drawn on a 2sided wall, multi-patch textures + // are not stored per-column with post info in SRB2 + if (!textures[texnum]->transparency) + { + if (vertflip) // vertically flipped? + colfunc_2s = R_RenderFlipped2sidedMultiPatchColumn; + else + colfunc_2s = R_Render2sidedMultiPatchColumn; + } + else if (vertflip) // vertically flipped? colfunc_2s = R_DrawFlippedMaskedColumn; else colfunc_2s = R_DrawMaskedColumn; // render the usual 2sided single-patch packed texture @@ -811,7 +912,16 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) // Texture must be cached R_CheckTextureCache(texnum); - if (vertflip) // vertically flipped? + // handle case where multipatch texture is drawn on a 2sided wall, multi-patch textures + // are not stored per-column with post info in SRB2 + if (!textures[texnum]->transparency) + { + if (vertflip) // vertically flipped? + colfunc_2s = R_RenderFlipped2sidedMultiPatchColumn; + else + colfunc_2s = R_Render2sidedMultiPatchColumn; + } + else if (vertflip) // vertically flipped? colfunc_2s = R_DrawRepeatFlippedMaskedColumn; else colfunc_2s = R_DrawRepeatMaskedColumn; @@ -894,21 +1004,25 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) { dc_iscale = 0xffffffffu / (unsigned)spryscale; - // Column has a single post and it matches the texture height, use regular column drawers - if (col->num_posts == 1 && col->posts[0].topdelta == 0 && col->posts[0].length == (unsigned)dc_texheight) + // Skip if texture is multipatch + if (textures[texnum]->transparency) { - if (fuzzy) - colfunc = colfuncs[COLDRAWFUNC_FUZZY]; + // Column has a single post and it matches the texture height, use regular column drawers + if (col->num_posts == 1 && col->posts[0].topdelta == 0 && col->posts[0].length == (unsigned)dc_texheight) + { + if (fuzzy) + colfunc = colfuncs[COLDRAWFUNC_FUZZY]; + else + colfunc = colfuncs[BASEDRAWFUNC]; + } else - colfunc = colfuncs[BASEDRAWFUNC]; - } - else - { - // Otherwise use column drawers with extra checks - if (fuzzy) - colfunc = R_DrawTranslucentColumnClamped_8; - else - colfunc = R_DrawColumnClamped_8; + { + // Otherwise use column drawers with extra checks + if (fuzzy) + colfunc = colfuncs[COLDRAWFUNC_CLAMPEDTRANS]; + else + colfunc = colfuncs[COLDRAWFUNC_CLAMPED]; + } } } diff --git a/src/r_textures.c b/src/r_textures.c index 5d3fe24db..6e01d5641 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -147,9 +147,9 @@ static void R_DrawFlippedColumnInCache(column_t *column, UINT8 *cache, texpatch_ if (count > 0) { - for (; dest < cache + position + count; --source, is_opaque++) + for (; dest < cache + position + count; --source, dest++, is_opaque++) { - *dest++ = *source; + *dest = *source; *is_opaque = true; } } @@ -295,7 +295,6 @@ UINT8 *R_GenerateTexture(size_t texnum) UINT16 lumpnum = patch->lump; UINT8 *pdata; softwarepatch_t *realpatch; - boolean holey = false; #ifndef NO_PNG_LUMPS UINT8 header[PNG_HEADER_SIZE]; @@ -310,9 +309,11 @@ UINT8 *R_GenerateTexture(size_t texnum) pdata = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); realpatch = (softwarepatch_t *)pdata; + texture->transparency = false; + // Check the patch for holes. if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height)) - holey = true; + texture->transparency = true; else { UINT8 *colofs = (UINT8 *)realpatch->columnofs; @@ -332,12 +333,12 @@ UINT8 *R_GenerateTexture(size_t texnum) col = (doompost_t *)((UINT8 *)col + col->length + 4); } if (y < texture->height) - holey = true; // this texture is HOLEy! D: + texture->transparency = true; // this texture is HOLEy! D: } } // If the patch uses transparency, we have to save it this way. - if (holey) + if (texture->transparency) { texture->flip = patch->flip; @@ -378,6 +379,15 @@ UINT8 *R_GenerateTexture(size_t texnum) temp_columns = Z_Calloc(sizeof(column_t) * texture->width, PU_STATIC, NULL); temp_block = Z_Calloc(total_pixels, PU_STATIC, NULL); +#ifdef TEXTURE_255_IS_TRANSPARENT + texture->transparency = false; + + // Transparency hack + memset(temp_block, TRANSPARENTPIXEL, total_pixels); +#else + texture->transparency = true; +#endif + for (x = 0; x < texture->width; x++) { column_t *column = &temp_columns[x]; @@ -474,13 +484,27 @@ UINT8 *R_GenerateTexture(size_t texnum) // Now write the columns column_posts = Z_Calloc(sizeof(unsigned) * texture->width, PU_STATIC, NULL); +#ifdef TEXTURE_255_IS_TRANSPARENT + total_posts = texture->width; + temp_posts = Z_Realloc(temp_posts, sizeof(post_t) * total_posts, PU_CACHE, NULL); +#endif + for (x = 0; x < texture->width; x++) { post_t *post = NULL; - boolean was_opaque = false; column_t *column = &temp_columns[x]; +#ifdef TEXTURE_255_IS_TRANSPARENT + post = &temp_posts[x]; + post->topdelta = 0; + post->length = texture->height; + post->data_offset = 0; + column_posts[x] = x; + column->num_posts = 1; +#else + boolean was_opaque = false; + column_posts[x] = (unsigned)-1; for (INT32 y = 0; y < texture->height; y++) @@ -510,6 +534,7 @@ UINT8 *R_GenerateTexture(size_t texnum) post->length++; } +#endif } blocksize = (sizeof(column_t) * texture->width) + (sizeof(post_t) * total_posts) + (sizeof(UINT8) * total_pixels); diff --git a/src/r_textures.h b/src/r_textures.h index eb68ec09f..7e1588851 100644 --- a/src/r_textures.h +++ b/src/r_textures.h @@ -54,6 +54,7 @@ typedef struct char name[8]; UINT32 hash; UINT8 type; // TEXTURETYPE_* + boolean transparency; INT16 width, height; UINT8 flip; // 1 = flipx, 2 = flipy, 3 = both void *flat; // The texture, as a flat. diff --git a/src/screen.c b/src/screen.c index 9a82a1561..014a20117 100644 --- a/src/screen.c +++ b/src/screen.c @@ -112,6 +112,10 @@ void SCR_SetDrawFuncs(void) colfuncs[COLDRAWFUNC_SHADE] = R_DrawShadeColumn_8; colfuncs[COLDRAWFUNC_SHADOWED] = R_DrawColumnShadowed_8; colfuncs[COLDRAWFUNC_TRANSTRANS] = R_DrawTranslatedTranslucentColumn_8; + colfuncs[COLDRAWFUNC_CLAMPED] = R_DrawColumnClamped_8; + colfuncs[COLDRAWFUNC_CLAMPEDTRANS] = R_DrawTranslucentColumnClamped_8; + colfuncs[COLDRAWFUNC_TWOSMULTIPATCH] = R_Draw2sMultiPatchColumn_8; + colfuncs[COLDRAWFUNC_TWOSMULTIPATCHTRANS] = R_Draw2sMultiPatchTranslucentColumn_8; colfuncs[COLDRAWFUNC_FOG] = R_DrawFogColumn_8; spanfuncs[SPANDRAWFUNC_TRANS] = R_DrawTranslucentSpan_8; diff --git a/src/screen.h b/src/screen.h index 8b952e553..e23e8cbd6 100644 --- a/src/screen.h +++ b/src/screen.h @@ -97,6 +97,10 @@ enum COLDRAWFUNC_SHADE, COLDRAWFUNC_SHADOWED, COLDRAWFUNC_TRANSTRANS, + COLDRAWFUNC_CLAMPED, + COLDRAWFUNC_CLAMPEDTRANS, + COLDRAWFUNC_TWOSMULTIPATCH, + COLDRAWFUNC_TWOSMULTIPATCHTRANS, COLDRAWFUNC_FOG, COLDRAWFUNC_MAX From bd641c38575d2c469d9b1190436fede539d387e0 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 2 Jun 2024 21:40:14 -0300 Subject: [PATCH 112/353] Fix #1263 --- src/lua_baselib.c | 6 ++++-- src/lua_libs.h | 5 +++-- src/lua_skinlib.c | 53 +++++++++++++++++++++++++++++++++++------------ src/r_skins.c | 8 +++++++ src/r_skins.h | 3 +++ 5 files changed, 58 insertions(+), 17 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index f6b8f462b..dd3653a82 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -184,8 +184,10 @@ 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_SKINSPRITES, "skin_t.skinsprites"}, + {META_SKINSPRITESLIST, "skin_t.skinsprites[]"}, + {META_SKINSPRITESCOMPAT, "skin_t.sprites"}, // TODO: 2.3: Delete {META_VERTEX, "vertex_t"}, {META_LINE, "line_t"}, diff --git a/src/lua_libs.h b/src/lua_libs.h index a90d8ac7f..90c7bba7c 100644 --- a/src/lua_libs.h +++ b/src/lua_libs.h @@ -42,8 +42,9 @@ extern boolean ignoregameinputs; #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_SKINSPRITES "SKIN_T*SKINSPRITES" +#define META_SKINSPRITESLIST "SKIN_T*SKINSPRITES[]" +#define META_SKINSPRITESCOMPAT "SKIN_T*SPRITES" // TODO: 2.3: Delete #define META_VERTEX "VERTEX_T*" #define META_LINE "LINE_T*" diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 24d948a67..a00661884 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -54,7 +54,8 @@ enum skin { skin_contspeed, skin_contangle, skin_soundsid, - skin_sprites, + skin_sprites, // TODO: 2.3: Delete + skin_skinsprites, skin_supersprites, skin_natkcolor }; @@ -95,7 +96,8 @@ static const char *const skin_opt[] = { "contspeed", "contangle", "soundsid", - "sprites", + "sprites", // TODO: 2.3: Delete + "skinsprites", "supersprites", "natkcolor", NULL}; @@ -219,7 +221,10 @@ static int skin_get(lua_State *L) case skin_soundsid: LUA_PushUserdata(L, skin->soundsid, META_SOUNDSID); break; - case skin_sprites: + case skin_sprites: // TODO: 2.3: Delete + LUA_PushUserdata(L, skin->sprites_compat, META_SKINSPRITESCOMPAT); + break; + case skin_skinsprites: LUA_PushUserdata(L, skin->sprites, META_SKINSPRITES); break; case skin_supersprites: @@ -338,15 +343,7 @@ 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] +// skin.skinsprites[i] -> sprites[i] static int lib_getSkinSprite(lua_State *L) { spritedef_t *sksprites = *(spritedef_t **)luaL_checkudata(L, 1, META_SKINSPRITES); @@ -359,13 +356,42 @@ static int lib_getSkinSprite(lua_State *L) return 1; } -// #skin.sprites -> NUMPLAYERSPRITES +// #skin.skinsprites -> NUMPLAYERSPRITES static int lib_numSkinsSprites(lua_State *L) { lua_pushinteger(L, NUMPLAYERSPRITES); return 1; } +// TODO: 2.3: Delete +// skin.sprites[i] -> sprites[i] +static int lib_getSkinSpriteCompat(lua_State *L) +{ + spritedef_t *sksprites = *(spritedef_t **)luaL_checkudata(L, 1, META_SKINSPRITESCOMPAT); + 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_PushUserdata(L, &sksprites[i], META_SKINSPRITESLIST); + return 1; +} + +// #skin.sprites -> NUMPLAYERSPRITES*2 +static int lib_numSkinsSpritesCompat(lua_State *L) +{ + lua_pushinteger(L, NUMPLAYERSPRITES*2); + return 1; +} + +enum spritesopt { + numframes = 0 +}; + +static const char *const sprites_opt[] = { + "numframes", + NULL}; + static int sprite_get(lua_State *L) { spritedef_t *sprite = *(spritedef_t **)luaL_checkudata(L, 1, META_SKINSPRITESLIST); @@ -387,6 +413,7 @@ int LUA_SkinLib(lua_State *L) LUA_RegisterUserdataMetatable(L, META_SOUNDSID, soundsid_get, NULL, soundsid_num); LUA_RegisterUserdataMetatable(L, META_SKINSPRITES, lib_getSkinSprite, NULL, lib_numSkinsSprites); LUA_RegisterUserdataMetatable(L, META_SKINSPRITESLIST, sprite_get, NULL, NULL); + LUA_RegisterUserdataMetatable(L, META_SKINSPRITESCOMPAT, lib_getSkinSpriteCompat, NULL, lib_numSkinsSpritesCompat); skin_fields_ref = Lua_CreateFieldTable(L, skin_opt); diff --git a/src/r_skins.c b/src/r_skins.c index cd7d60b53..a341ee80f 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -636,6 +636,14 @@ static void R_LoadSkinSprites(UINT16 wadnum, UINT16 *lump, UINT16 *lastlump, ski if (skin->sprites[0].numframes == 0) CONS_Alert(CONS_ERROR, M_GetText("No frames found for sprite SPR2_%s\n"), spr2names[0]); + + // TODO: 2.3: Delete + memcpy(&skin->sprites_compat[start_spr2], + &skin->sprites[start_spr2], + sizeof(spritedef_t) * (free_spr2 - start_spr2)); + memcpy(&skin->sprites_compat[start_spr2 + NUMPLAYERSPRITES], + &skin->super.sprites[start_spr2], + sizeof(spritedef_t) * (free_spr2 - start_spr2)); } // returns whether found appropriate property diff --git a/src/r_skins.h b/src/r_skins.h index 1f2c57472..5122b53a6 100644 --- a/src/r_skins.h +++ b/src/r_skins.h @@ -88,6 +88,9 @@ typedef struct spritedef_t sprites[NUMPLAYERSPRITES]; spriteinfo_t sprinfo[NUMPLAYERSPRITES]; } super; + + // TODO: 2.3: Delete + spritedef_t sprites_compat[NUMPLAYERSPRITES * 2]; } skin_t; /// Externs From cb09b9055639aed4f1d34736467954385d70cb42 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 2 Jun 2024 21:45:36 -0300 Subject: [PATCH 113/353] Add missing comments --- src/lua_skinlib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index a00661884..26f4011d3 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -377,6 +377,7 @@ static int lib_getSkinSpriteCompat(lua_State *L) return 1; } +// TODO: 2.3: Delete // #skin.sprites -> NUMPLAYERSPRITES*2 static int lib_numSkinsSpritesCompat(lua_State *L) { @@ -413,7 +414,7 @@ int LUA_SkinLib(lua_State *L) LUA_RegisterUserdataMetatable(L, META_SOUNDSID, soundsid_get, NULL, soundsid_num); LUA_RegisterUserdataMetatable(L, META_SKINSPRITES, lib_getSkinSprite, NULL, lib_numSkinsSprites); LUA_RegisterUserdataMetatable(L, META_SKINSPRITESLIST, sprite_get, NULL, NULL); - LUA_RegisterUserdataMetatable(L, META_SKINSPRITESCOMPAT, lib_getSkinSpriteCompat, NULL, lib_numSkinsSpritesCompat); + LUA_RegisterUserdataMetatable(L, META_SKINSPRITESCOMPAT, lib_getSkinSpriteCompat, NULL, lib_numSkinsSpritesCompat); // TODO: 2.3: Delete skin_fields_ref = Lua_CreateFieldTable(L, skin_opt); From b89aaf709e875f82b66c874351cf485f1608c5e8 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Mon, 3 Jun 2024 00:14:33 -0300 Subject: [PATCH 114/353] Generate the TF_CHROMAKEYED texture in hw_cache.c --- src/hardware/hw_cache.c | 55 +++++++++++--------------------- src/hardware/r_opengl/r_opengl.c | 37 ++------------------- 2 files changed, 21 insertions(+), 71 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 0022897d6..203f78799 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -450,15 +450,10 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, GLMipmap_t texture = textures[texnum]; - mipmap->flags = TF_WRAPXY; - mipmap->width = (UINT16)texture->width; - mipmap->height = (UINT16)texture->height; - mipmap->format = textureformat; - blockwidth = texture->width; blockheight = texture->height; - blocksize = (blockwidth * blockheight); - block = MakeBlock(&grtex->mipmap); + blocksize = blockwidth * blockheight; + block = MakeBlock(mipmap); // Composite the columns together. for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++) @@ -488,7 +483,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, GLMipmap_t realpatch = W_CachePatchNumPwad(wadnum, lumpnum, PU_PATCH); } - HWR_DrawTexturePatchInCache(&grtex->mipmap, blockwidth, blockheight, texture, patch, realpatch); + HWR_DrawTexturePatchInCache(mipmap, blockwidth, blockheight, texture, patch, realpatch); if (free_patch) Patch_Free(realpatch); @@ -741,21 +736,6 @@ void HWR_LoadMapTextures(size_t pnumtextures) // -------------------------------------------------------------------------- // Make sure texture is downloaded and set it as the source // -------------------------------------------------------------------------- -static void GetMapTexture(INT32 tex, GLMapTexture_t *grtex, GLMipmap_t *mipmap) -{ - // Generate texture if missing from the cache - if (!mipmap->data && !mipmap->downloaded) - HWR_GenerateTexture(tex, grtex, mipmap); - - // If hardware does not have the texture, then call pfnSetTexture to upload it - if (!mipmap->downloaded) - HWD.pfnSetTexture(mipmap); - HWR_SetCurrentTexture(mipmap); - - // The system-memory data can be purged now. - Z_ChangeTag(mipmap->data, PU_HWRCACHE_UNLOCKED); -} - GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean chromakeyed) { if (tex < 0 || tex >= (signed)gl_numtextures) @@ -772,35 +752,38 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean chromakeyed) GLMipmap_t *grMipmap = &grtex->mipmap; GLMipmap_t *originalMipmap = grMipmap; - if (!originalMipmap->data && !originalMipmap->downloaded) - HWR_GenerateTexture(tex, grtex, originalMipmap); + if (!originalMipmap->downloaded) + { + originalMipmap->flags = TF_WRAPXY; + originalMipmap->width = (UINT16)textures[tex]->width; + originalMipmap->height = (UINT16)textures[tex]->height; + originalMipmap->format = textureformat; + } // If chroma-keyed, create or use a different mipmap for the variant - if (chromakeyed && !textures[tex]->transparency && originalMipmap->data) + if (chromakeyed && !textures[tex]->transparency) { // Allocate it if it wasn't already if (!originalMipmap->nextcolormap) { GLMipmap_t *newMipmap = calloc(1, sizeof (*grMipmap)); if (newMipmap == NULL) - I_Error("%s: Out of memory", "HWR_GetLevelFlat"); + I_Error("%s: Out of memory", "HWR_GetTexture"); - newMipmap->flags = TF_WRAPXY | TF_CHROMAKEYED; - newMipmap->width = (UINT16)textures[tex]->width; - newMipmap->height = (UINT16)textures[tex]->height; - newMipmap->format = textureformat; + newMipmap->flags = originalMipmap->flags | TF_CHROMAKEYED; + newMipmap->width = originalMipmap->width; + newMipmap->height = originalMipmap->height; + newMipmap->format = originalMipmap->format; originalMipmap->nextcolormap = newMipmap; } // Upload and bind the variant texture instead of the original one grMipmap = originalMipmap->nextcolormap; - - // Use the original texture's pixel data - // It can just be a pointer to it, since the r_opengl backend deals with the pixels - // that are supposed to be transparent. - grMipmap->data = originalMipmap->data; } + if (!grMipmap->data) + HWR_GenerateTexture(tex, grtex, grMipmap); + if (!grMipmap->downloaded) HWD.pfnSetTexture(grMipmap); HWR_SetCurrentTexture(grMipmap); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index fa6b48b4f..75a92c2fb 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1556,41 +1556,8 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo) } else if (pTexInfo->format == GL_TEXFMT_RGBA) { - if (pTexInfo->flags & TF_CHROMAKEYED) - { - RGBA_t *color = (RGBA_t *)pTexInfo->data; - - AllocTextureBuffer(pTexInfo); - ptex = tex = textureBuffer; - - for (j = 0; j < h; j++) - { - for (i = 0; i < w; i++) - { - if (color->rgba == myPaletteData[HWR_PATCHES_CHROMAKEY_COLORINDEX].rgba) - { - tex[w*j+i].s.red = 0; - tex[w*j+i].s.green = 0; - tex[w*j+i].s.blue = 0; - tex[w*j+i].s.alpha = 0; - pTexInfo->flags |= TF_TRANSPARENT; // there is a hole in it - } - else - { - tex[w*j+i].s.red = color->s.red; - tex[w*j+i].s.green = color->s.green; - tex[w*j+i].s.blue = color->s.blue; - tex[w*j+i].s.alpha = color->s.alpha; - } - color++; - } - } - } - else - { - // Directly upload the texture data without any kind of conversion. - ptex = pImgData; - } + // Directly upload the texture data without any kind of conversion. + ptex = pImgData; } else if (pTexInfo->format == GL_TEXFMT_ALPHA_INTENSITY_88) { From 1a02c7fd7381be22b5c862d916a3140029372074 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Mon, 3 Jun 2024 12:56:44 +0000 Subject: [PATCH 115/353] Expose BASEVIDWIDTH and BASEVIDHEIGHT to Lua and SOC --- src/deh_tables.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index c7c7c6040..f113f6b19 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5804,6 +5804,10 @@ struct int_const_s const INT_CONST[] = { {"MB_SCROLLUP",MB_SCROLLUP}, {"MB_SCROLLDOWN",MB_SCROLLDOWN}, + // screen.h constants + {"BASEVIDWIDTH",BASEVIDWIDTH}, + {"BASEVIDHEIGHT",BASEVIDHEIGHT}, + {NULL,0} }; From 1f71ecdc800e048c506a0b393795c6f6d016f6f0 Mon Sep 17 00:00:00 2001 From: pastel Date: Mon, 3 Jun 2024 12:59:52 +0000 Subject: [PATCH 116/353] Fix forcecharacter regressions & crash (resolves #1262) --- src/m_menu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 4d8ee17e8..fded90750 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -263,7 +263,7 @@ static void M_ConfirmTeamScramble(INT32 choice); static void M_ConfirmTeamChange(INT32 choice); static void M_SecretsMenu(INT32 choice); static void M_SetupChoosePlayer(INT32 choice); -static UINT16 M_SetupChoosePlayerDirect(INT32 choice); +static INT32 M_SetupChoosePlayerDirect(INT32 choice); static void M_QuitSRB2(INT32 choice); menu_t SP_MainDef, OP_MainDef; menu_t MISC_ScrambleTeamDef, MISC_ChangeTeamDef; @@ -3674,7 +3674,7 @@ void M_StartControlPanel(void) { // Devmode unlocks Pandora's Box in the pause menu boolean pandora = ((M_SecretUnlocked(SECRET_PANDORA, serverGamedata) || cv_debug || devparm) && !marathonmode); - + if (gamestate != GS_LEVEL || ultimatemode) // intermission, so gray out stuff. { SPauseMenu[spause_pandora].status = (pandora) ? (IT_GRAYEDOUT) : (IT_DISABLED); @@ -4156,7 +4156,7 @@ static void M_DrawStaticBox(fixed_t x, fixed_t y, INT32 flags, fixed_t w, fixed_ temp = (gametic % temp) * h*2*FRACUNIT; // Which frame to draw V_DrawCroppedPatch(x*FRACUNIT, y*FRACUNIT, (w*FRACUNIT) / 160, (h*FRACUNIT) / 100, flags, patch, NULL, 0, temp, w*2*FRACUNIT, h*2*FRACUNIT); - + W_UnlockCachedPatch(patch); return; } @@ -9072,7 +9072,7 @@ static void M_CacheCharacterSelectEntry(INT32 i, INT32 skinnum) description[i].namepic = W_CachePatchName(description[i].nametag, PU_PATCH); } -static UINT16 M_SetupChoosePlayerDirect(INT32 choice) +static INT32 M_SetupChoosePlayerDirect(INT32 choice) { INT32 skinnum, botskinnum; UINT16 i; @@ -9161,7 +9161,7 @@ static UINT16 M_SetupChoosePlayerDirect(INT32 choice) static void M_SetupChoosePlayer(INT32 choice) { - UINT16 skinset = M_SetupChoosePlayerDirect(choice); + INT32 skinset = M_SetupChoosePlayerDirect(choice); if (skinset != MAXCHARACTERSLOTS) { M_ChoosePlayer(skinset); @@ -10186,7 +10186,7 @@ void M_DrawNightsAttackMenu(void) skinnumber = 0; //Default to Sonic else skinnumber = (cv_chooseskin.value-1); - + spritedef_t *sprdef = &skins[skinnumber]->sprites[SPR2_NFLY]; //Make our patch the selected character's NFLY sprite spritetimer = FixedInt(ntsatkdrawtimer/2) % skins[skinnumber]->sprites[SPR2_NFLY].numframes; //Make the sprite timer cycle though all the frames at 2 tics per frame spriteframe_t *sprframe = &sprdef->spriteframes[spritetimer]; //Our animation frame is equal to the number on the timer @@ -10199,11 +10199,11 @@ void M_DrawNightsAttackMenu(void) color = skins[skinnumber]->supercolor+4; else //If you don't go super in NiGHTS or at all, use prefcolor color = skins[skinnumber]->prefcolor; - + angle_t fa = (FixedAngle(((FixedInt(ntsatkdrawtimer * 4)) % 360)<>ANGLETOFINESHIFT) & FINEMASK; V_DrawFixedPatch(270<highresscale, skins[skinnumber]->shieldscale), + FixedDiv(skins[skinnumber]->highresscale, skins[skinnumber]->shieldscale), (sprframe->flip & 1<<6) ? V_FLIP : 0, natksprite, R_GetTranslationColormap(TC_BLINK, color, GTC_CACHE)); From b0d5828e79b9f698ad60639d63a18b49a9ff6c29 Mon Sep 17 00:00:00 2001 From: pastel Date: Mon, 3 Jun 2024 14:36:20 +0000 Subject: [PATCH 117/353] Fix tiny spindash math moment --- src/p_user.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 7cd128cf0..f15e8e194 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -915,7 +915,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->textvar = NTV_BONUSTIMEEND; // Score and grades player->finishedspheres = (INT16)(player->spheres); player->finishedrings = (INT16)(player->rings); - + // Add score to temp leaderboards player->lastmaretime = leveltime - player->marebegunat; G_AddTempNightsRecords(player, player->marescore, player->lastmaretime, (UINT8)(oldmare + 1)); @@ -2372,7 +2372,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) if (dorollstuff) { if ((player->charability2 == CA2_SPINDASH) && !((player->pflags & (PF_SPINNING|PF_THOKKED)) == PF_THOKKED) && !(player->charability == CA_THOK && player->secondjump) - && (player->cmd.buttons & BT_SPIN) && (FixedHypot(player->mo->momx, player->mo->momy) > (5*player->mo->scale))) + && (player->cmd.buttons & BT_SPIN) && (FixedHypot(player->mo->momx, player->mo->momy) >= (5*player->mo->scale))) player->pflags = (player->pflags|PF_SPINNING) & ~PF_THOKKED; else if (!(player->pflags & PF_STARTDASH)) player->pflags &= ~PF_SPINNING; @@ -4721,7 +4721,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) // Revving else if ((cmd->buttons & BT_SPIN) && (player->pflags & PF_STARTDASH)) { - if (player->speed > 5*player->mo->scale) + if (player->speed >= 5*player->mo->scale) { player->pflags &= ~PF_STARTDASH; P_SetMobjState(player->mo, S_PLAY_ROLL); @@ -4761,9 +4761,8 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) if (!player->spectator) S_StartSound(player->mo, sfx_spin); } - else // Catapult the player from a spindash rev! - if (onground && !(player->pflags & PF_SPINDOWN) && (player->pflags & PF_STARTDASH) && (player->pflags & PF_SPINNING)) + else if (onground && !(player->pflags & PF_SPINDOWN) && (player->pflags & PF_STARTDASH) && (player->pflags & PF_SPINNING)) { player->pflags &= ~PF_STARTDASH; if (player->powers[pw_carry] == CR_BRAKGOOP) @@ -8766,7 +8765,7 @@ void P_MovePlayer(player_t *player) if (!(player->mo->momz || player->mo->momx || player->mo->momy) && !(player->mo->eflags & MFE_GOOWATER) && player->panim == PA_IDLE && !(player->powers[pw_carry])) P_DoTeeter(player); - + // Toss a flag if (G_GametypeHasTeams() && (cmd->buttons & BT_TOSSFLAG) && !(player->powers[pw_super]) && !(player->tossdelay)) { From 4840310f1a428fac46a04689269c1d8a5aeb1080 Mon Sep 17 00:00:00 2001 From: pastel Date: Mon, 3 Jun 2024 14:47:27 +0000 Subject: [PATCH 118/353] Fix exitgame-ing a demo crashing the game (resolves #1237) --- src/g_demo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/g_demo.c b/src/g_demo.c index 0efba5a59..54b12f797 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -549,6 +549,9 @@ void G_ConsGhostTic(void) testmo = players[0].mo; + if (P_MobjWasRemoved(testmo)) + return; // No valid mobj exists, probably because of unexpected quit + // Grab ghost data. ziptic = READUINT8(demo_p); if (ziptic & GZT_XYZ) From d0b420c76038df2dfdf512e24c6af80bc35fd546 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Mon, 3 Jun 2024 13:29:49 -0300 Subject: [PATCH 119/353] Prevent a memory leak --- src/hardware/hw_cache.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 203f78799..f282ca891 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -675,25 +675,24 @@ void HWR_InitMapTextures(void) gl_maptexturesloaded = false; } -static void DeleteTextureMipmap(GLMipmap_t *grMipmap) +static void DeleteTextureMipmap(GLMipmap_t *grMipmap, boolean delete_mipmap) { HWD.pfnDeleteTexture(grMipmap); - // Chroma-keyed textures do not own their texture data, so do not free it - if (!(grMipmap->flags & TF_CHROMAKEYED)) + if (delete_mipmap) Z_Free(grMipmap->data); } -static void FreeMapTexture(GLMapTexture_t *tex) +static void FreeMapTexture(GLMapTexture_t *tex, boolean delete_chromakeys) { if (tex->mipmap.nextcolormap) { - DeleteTextureMipmap(tex->mipmap.nextcolormap); + DeleteTextureMipmap(tex->mipmap.nextcolormap, delete_chromakeys); free(tex->mipmap.nextcolormap); tex->mipmap.nextcolormap = NULL; } - DeleteTextureMipmap(&tex->mipmap); + DeleteTextureMipmap(&tex->mipmap, true); } void HWR_FreeMapTextures(void) @@ -702,8 +701,8 @@ void HWR_FreeMapTextures(void) for (i = 0; i < gl_numtextures; i++) { - FreeMapTexture(&gl_textures[i]); - FreeMapTexture(&gl_flats[i]); + FreeMapTexture(&gl_textures[i], true); + FreeMapTexture(&gl_flats[i], false); } // now the heap don't have any 'user' pointing to our @@ -777,7 +776,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean chromakeyed) originalMipmap->nextcolormap = newMipmap; } - // Upload and bind the variant texture instead of the original one + // Generate, upload and bind the variant texture instead of the original one grMipmap = originalMipmap->nextcolormap; } From f19ec6f676da79722b4c44a3c8b048ff97e6ecb7 Mon Sep 17 00:00:00 2001 From: SMS Alfredo Date: Mon, 3 Jun 2024 23:25:02 +0000 Subject: [PATCH 120/353] Fix shieldscale 0 bugs --- src/m_menu.c | 11 ++++++++--- src/p_mobj.c | 17 +++++++++++++++-- src/r_things.c | 4 ++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index e0c240fec..38165472e 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -10211,9 +10211,12 @@ void M_DrawNightsAttackMenu(void) color = skins[skinnumber]->prefcolor; angle_t fa = (FixedAngle(((FixedInt(ntsatkdrawtimer * 4)) % 360)<>ANGLETOFINESHIFT) & FINEMASK; + fixed_t scale = skins[skinnumber]->highresscale; + if (skins[skinnumber]->shieldscale) + scale = FixedDiv(scale, skins[skinnumber]->shieldscale); V_DrawFixedPatch(270<highresscale, skins[skinnumber]->shieldscale), + scale, (sprframe->flip & 1<<6) ? V_FLIP : 0, natksprite, R_GetTranslationColormap(TC_BLINK, color, GTC_CACHE)); @@ -12300,7 +12303,9 @@ static void M_DrawSetupMultiPlayerMenu(void) if (multi_frame >= sprdef->numframes) multi_frame = 0; - scale = FixedDiv(skins[setupm_fakeskin]->highresscale, skins[setupm_fakeskin]->shieldscale); + scale = skins[setupm_fakeskin]->highresscale; + if (skins[setupm_fakeskin]->shieldscale) + scale = FixedDiv(scale, skins[setupm_fakeskin]->shieldscale); #define chary (y+64) @@ -12333,7 +12338,7 @@ static void M_DrawSetupMultiPlayerMenu(void) V_DrawFixedPatch( x<highresscale, skins[setupm_fakeskin]->shieldscale), + scale, flags, patch, colormap); goto colordraw; diff --git a/src/p_mobj.c b/src/p_mobj.c index fbbae5a1e..4716042e3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6662,8 +6662,21 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) thing->flags |= MF_NOCLIPHEIGHT; thing->eflags = (thing->eflags & ~MFE_VERTICALFLIP)|(thing->target->eflags & MFE_VERTICALFLIP); - P_SetScale(thing, FixedMul(thing->target->scale, thing->target->player->shieldscale), true); - thing->old_scale = FixedMul(thing->target->old_scale, thing->target->player->shieldscale); + //Set the shield's scale based on shieldscale, hide it if we're too small! + fixed_t scale = FixedMul(thing->target->scale, thing->target->player->shieldscale); + if (scale < 1) { + P_SetScale(thing, thing->target->scale, true); + thing->old_scale = thing->target->old_scale; + + thing->flags2 |= (MF2_DONTDRAW|MF2_JUSTATTACKED); //Hide and indicate we're hidden + } else { + P_SetScale(thing, scale, true); + thing->old_scale = FixedMul(thing->target->old_scale, thing->target->player->shieldscale); + + //Only unhide if we were hidden by the above code + if (thing->flags2 & MF2_JUSTATTACKED) + thing->flags2 &= ~(MF2_DONTDRAW|MF2_JUSTATTACKED); + } #define NewMH(mobj) mobj->height // Ugly mobj-height and player-height defines, for the sake of prettier code #define NewPH(player) P_GetPlayerHeight(player) diff --git a/src/r_things.c b/src/r_things.c index fb9757a9a..dc9cab997 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1774,6 +1774,10 @@ static void R_ProjectSprite(mobj_t *thing) } this_scale = interp.scale; + + if (this_scale < 1) + return; + radius = interp.radius; // For drop shadows height = interp.height; // Ditto From 37270c871e39cef5cb3ee022f270921cd365d21f Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 4 Jun 2024 02:08:25 -0300 Subject: [PATCH 121/353] Raise TEXTMAP parser limits --- src/p_setup.c | 60 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index c4b4a35b3..e888ec5a5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1554,11 +1554,41 @@ static void P_LoadThings(UINT8 *data) } // Stores positions for relevant map data spread through a TEXTMAP. -UINT32 mapthingsPos[UINT16_MAX]; -UINT32 linesPos[UINT16_MAX]; -UINT32 sidesPos[UINT16_MAX]; -UINT32 vertexesPos[UINT16_MAX]; -UINT32 sectorsPos[UINT16_MAX]; +typedef struct textmap_block_s +{ + UINT32 *pos; + size_t capacity; +} textmap_block_t; + +static textmap_block_t mapthingBlocks; +static textmap_block_t linedefBlocks; +static textmap_block_t sidedefBlocks; +static textmap_block_t vertexBlocks; +static textmap_block_t sectorBlocks; + +static void TextmapStorePos(textmap_block_t *blocks, size_t *count) +{ + size_t locCount = (*count) + 1; + + if (blocks->pos == NULL) + { + // Initial capacity (half of the former one.) + blocks->capacity = UINT16_MAX / 2; + + Z_Calloc(sizeof(blocks->pos) * blocks->capacity, PU_LEVEL, &blocks->pos); + } + else if (locCount >= blocks->capacity) + { + // If we hit the list's capacity, make space for 1024 more blocks + blocks->capacity += 1024; + + Z_Realloc(blocks->pos, sizeof(blocks->pos) * blocks->capacity, PU_LEVEL, &blocks->pos); + } + + blocks->pos[locCount - 1] = M_TokenizerGetEndPos(); + + (*count) = locCount; +} // Determine total amount of map data in TEXTMAP. static boolean TextmapCount(size_t size) @@ -1602,15 +1632,15 @@ static boolean TextmapCount(size_t size) brackets++; // Check for valid fields. else if (fastcmp(tkn, "thing")) - mapthingsPos[nummapthings++] = M_TokenizerGetEndPos(); + TextmapStorePos(&mapthingBlocks, &nummapthings); else if (fastcmp(tkn, "linedef")) - linesPos[numlines++] = M_TokenizerGetEndPos(); + TextmapStorePos(&linedefBlocks, &numlines); else if (fastcmp(tkn, "sidedef")) - sidesPos[numsides++] = M_TokenizerGetEndPos(); + TextmapStorePos(&sidedefBlocks, &numsides); else if (fastcmp(tkn, "vertex")) - vertexesPos[numvertexes++] = M_TokenizerGetEndPos(); + TextmapStorePos(&vertexBlocks, &numvertexes); else if (fastcmp(tkn, "sector")) - sectorsPos[numsectors++] = M_TokenizerGetEndPos(); + TextmapStorePos(§orBlocks, &numsectors); else CONS_Alert(CONS_NOTICE, "Unknown field '%s'.\n", tkn); } @@ -2944,7 +2974,7 @@ static void P_LoadTextmap(void) vt->floorzset = vt->ceilingzset = false; vt->floorz = vt->ceilingz = 0; - TextmapParse(vertexesPos[i], i, ParseTextmapVertexParameter); + TextmapParse(vertexBlocks.pos[i], i, ParseTextmapVertexParameter); if (vt->x == INT32_MAX) I_Error("P_LoadTextmap: vertex %s has no x value set!\n", sizeu1(i)); @@ -3001,7 +3031,7 @@ static void P_LoadTextmap(void) textmap_planefloor.defined = 0; textmap_planeceiling.defined = 0; - TextmapParse(sectorsPos[i], i, ParseTextmapSectorParameter); + TextmapParse(sectorBlocks.pos[i], i, ParseTextmapSectorParameter); P_InitializeSector(sc); if (textmap_colormap.used) @@ -3050,7 +3080,7 @@ static void P_LoadTextmap(void) ld->sidenum[0] = NO_SIDEDEF; ld->sidenum[1] = NO_SIDEDEF; - TextmapParse(linesPos[i], i, ParseTextmapLinedefParameter); + TextmapParse(linedefBlocks.pos[i], i, ParseTextmapLinedefParameter); if (!ld->v1) I_Error("P_LoadTextmap: linedef %s has no v1 value set!\n", sizeu1(i)); @@ -3077,7 +3107,7 @@ static void P_LoadTextmap(void) sd->sector = NULL; sd->repeatcnt = 0; - TextmapParse(sidesPos[i], i, ParseTextmapSidedefParameter); + TextmapParse(sidedefBlocks.pos[i], i, ParseTextmapSidedefParameter); if (!sd->sector) I_Error("P_LoadTextmap: sidedef %s has no sector value set!\n", sizeu1(i)); @@ -3101,7 +3131,7 @@ static void P_LoadTextmap(void) memset(mt->stringargs, 0x00, NUMMAPTHINGSTRINGARGS*sizeof(*mt->stringargs)); mt->mobj = NULL; - TextmapParse(mapthingsPos[i], i, ParseTextmapThingParameter); + TextmapParse(mapthingBlocks.pos[i], i, ParseTextmapThingParameter); } } From b16c4df31c779bccd518fa5103b73b1b6f778165 Mon Sep 17 00:00:00 2001 From: Refrag Date: Mon, 20 May 2024 10:40:55 +0200 Subject: [PATCH 122/353] Ensure the servername fits into MAXSERVERNAME before setting it This commit adds a verification before setting the servername console variable. We now check that it fits within the MAXSERVERNAME length and we cancel setting it if it doesn't. Letting the servername be more than MAXSERVERNAME could lead to crashes when trying to edit the server name from the menu so, we now avoid those. --- src/netcode/mserv.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/netcode/mserv.c b/src/netcode/mserv.c index 3acacd24c..74ee120f9 100644 --- a/src/netcode/mserv.c +++ b/src/netcode/mserv.c @@ -50,6 +50,8 @@ static void Command_Listserv_f(void); #endif/*MASTERSERVER*/ +static boolean ServerName_CanChange (const char*); + static void Update_parameters (void); static void MasterServer_OnChange(void); @@ -61,7 +63,7 @@ static CV_PossibleValue_t masterserver_update_rate_cons_t[] = { }; consvar_t cv_masterserver = CVAR_INIT ("masterserver", "https://ds.ms.srb2.org/MS/0", CV_SAVE|CV_CALL, NULL, MasterServer_OnChange); -consvar_t cv_servername = CVAR_INIT ("servername", "SRB2 server", CV_SAVE|CV_NETVAR|CV_CALL|CV_NOINIT|CV_ALLOWLUA, NULL, Update_parameters); +consvar_t cv_servername = CVAR_INIT_WITH_CALLBACKS ("servername", "SRB2 server", CV_SAVE|CV_NETVAR|CV_CALL|CV_NOINIT|CV_ALLOWLUA, NULL, Update_parameters, ServerName_CanChange); consvar_t cv_masterserver_update_rate = CVAR_INIT ("masterserver_update_rate", "15", CV_SAVE|CV_CALL|CV_NOINIT, masterserver_update_rate_cons_t, Update_parameters); @@ -497,6 +499,15 @@ Set_api (const char *api) #endif/*MASTERSERVER*/ +static boolean ServerName_CanChange(const char* newvalue) +{ + if (strlen(newvalue) < MAXSERVERNAME) + return true; + + CONS_Alert(CONS_NOTICE, "The server name must be shorter than %d characters\n", MAXSERVERNAME); + return false; +} + static void Update_parameters (void) { From b480f78c96a4e6c19fcd81a1d9fbdf71e64201f2 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 4 Jun 2024 18:34:38 -0300 Subject: [PATCH 123/353] Implement support for ZDoom GL2 nodes --- src/p_setup.c | 71 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 21 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index c4b4a35b3..3e327a549 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3419,13 +3419,13 @@ typedef enum { } nodetype_t; // Find out the BSP format. -static nodetype_t P_GetNodetype(const virtres_t *virt, UINT8 **nodedata) +static nodetype_t P_GetNodetype(const virtres_t *virt, UINT8 **nodedata, char signature[4 + 1]) { boolean supported[NUMNODETYPES] = {0}; nodetype_t nodetype = NT_UNSUPPORTED; - char signature[4 + 1]; *nodedata = NULL; + signature[0] = signature[4] = '\0'; if (udmf) { @@ -3434,7 +3434,7 @@ static nodetype_t P_GetNodetype(const virtres_t *virt, UINT8 **nodedata) if (virtznodes && virtznodes->size) { *nodedata = virtznodes->data; - supported[NT_XGLN] = supported[NT_XGL3] = true; + supported[NT_XGLN] = supported[NT_XGL2] = supported[NT_XGL3] = true; } } else @@ -3456,9 +3456,9 @@ static nodetype_t P_GetNodetype(const virtres_t *virt, UINT8 **nodedata) virtssectors = vres_Find(virt, "SSECTORS"); if (virtssectors && virtssectors->size) - { // Possibly GL nodes: NODES ignored, SSECTORS takes precedence as nodes lump, (It is confusing yeah) and has a signature. + { // Possibly GL nodes: NODES ignored, SSECTORS takes precedence as nodes lump (it is confusing, yeah), and has a signature. *nodedata = virtssectors->data; - supported[NT_XGLN] = supported[NT_ZGLN] = supported[NT_XGL3] = true; + supported[NT_XGLN] = supported[NT_ZGLN] = supported[NT_XGL2] = supported[NT_XGL3] = true; } else { // Possibly ZDoom extended nodes: SSECTORS is empty, NODES has a signature. @@ -3478,19 +3478,42 @@ static nodetype_t P_GetNodetype(const virtres_t *virt, UINT8 **nodedata) } M_Memcpy(signature, *nodedata, 4); - signature[4] = '\0'; (*nodedata) += 4; - if (!strcmp(signature, "XNOD")) - nodetype = NT_XNOD; - else if (!strcmp(signature, "ZNOD")) - nodetype = NT_ZNOD; - else if (!strcmp(signature, "XGLN")) - nodetype = NT_XGLN; - else if (!strcmp(signature, "ZGLN")) - nodetype = NT_ZGLN; - else if (!strcmp(signature, "XGL3")) - nodetype = NT_XGL3; + // Identify node format from its starting signature. + if (memcmp(&signature[1], "NOD", 3) == 0) // ZDoom extended nodes + { + if (signature[0] == 'X') + { + nodetype = NT_XNOD; // Uncompressed + } + else if (signature[0] == 'Z') + { + nodetype = NT_ZNOD; // Compressed + } + } + else if (memcmp(&signature[1], "GL", 2) == 0) // GL nodes + { + switch (signature[0]) + { + case 'X': // Uncompressed + switch (signature[3]) + { + case 'N': nodetype = NT_XGLN; break; // GL nodes + case '2': nodetype = NT_XGL2; break; // Version 2 GL nodes + case '3': nodetype = NT_XGL3; break; // Version 3 GL nodes + } + break; + case 'Z': // Compressed + switch (signature[3]) + { + case 'N': nodetype = NT_ZGLN; break; // GL nodes (compressed) + case '2': nodetype = NT_ZGL2; break; // Version 2 GL nodes (compressed) + case '3': nodetype = NT_ZGL3; break; // Version 3 GL nodes (compressed) + } + break; + } + } return supported[nodetype] ? nodetype : NT_UNSUPPORTED; } @@ -3560,6 +3583,7 @@ static boolean P_LoadExtendedSubsectorsAndSegs(UINT8 **data, nodetype_t nodetype switch (nodetype) { case NT_XGLN: + case NT_XGL2: case NT_XGL3: for (m = 0; m < (size_t)subsectors[i].numlines; m++, k++) { @@ -3571,7 +3595,7 @@ static boolean P_LoadExtendedSubsectorsAndSegs(UINT8 **data, nodetype_t nodetype READUINT32((*data)); // partner, can be ignored by software renderer - if (nodetype == NT_XGL3) + if (nodetype != NT_XGLN) { UINT32 linenum = READUINT32((*data)); if (linenum != 0xFFFFFFFF && linenum >= numlines) @@ -3682,8 +3706,9 @@ static void P_LoadExtendedNodes(UINT8 **data, nodetype_t nodetype) static void P_LoadMapBSP(const virtres_t *virt) { + char signature[4 + 1]; UINT8 *nodedata = NULL; - nodetype_t nodetype = P_GetNodetype(virt, &nodedata); + nodetype_t nodetype = P_GetNodetype(virt, &nodedata, signature); switch (nodetype) { @@ -3715,6 +3740,7 @@ static void P_LoadMapBSP(const virtres_t *virt) } case NT_XNOD: case NT_XGLN: + case NT_XGL2: case NT_XGL3: if (!P_LoadExtraVertices(&nodedata)) return; @@ -3723,10 +3749,13 @@ static void P_LoadMapBSP(const virtres_t *virt) P_LoadExtendedNodes(&nodedata, nodetype); break; default: - CONS_Alert(CONS_WARNING, "Unsupported BSP format detected.\n"); - return; + if (isprint(signature[0]) && isprint(signature[1]) && isprint(signature[2]) && isprint(signature[3])) + { + I_Error("Unsupported BSP format '%s' detected!\n", signature); + return; + } + I_Error("Unknown BSP format detected!\n"); } - return; } // Split from P_LoadBlockMap for convenience From 89dbfe32db3b77a4de25dbc65cfe076a39add10c Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 5 Jun 2024 15:40:50 -0300 Subject: [PATCH 124/353] Disable -Wpedantic --- src/sdl/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index ee48fa2b1..99425108e 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -33,8 +33,6 @@ target_compile_options(SRB2SDL2 PRIVATE -Wall -Wno-trigraphs -W # Was controlled by RELAXWARNINGS - -pedantic - -Wpedantic -Wfloat-equal -Wundef -Wpointer-arith From a50d7f5db5876b5c9c7882b4f068d11e1fd2ed40 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 5 Jun 2024 17:01:48 -0300 Subject: [PATCH 125/353] Fix code that emits -Wcalloc-transposed-args warnings --- src/apng.c | 2 +- src/d_main.c | 2 +- src/deh_soc.c | 2 +- src/filesrch.c | 2 +- src/sdl/i_video.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apng.c b/src/apng.c index 11d3ab9f5..cfb1473a4 100644 --- a/src/apng.c +++ b/src/apng.c @@ -71,7 +71,7 @@ apng_create_info_struct (png_structp pngp) { apng_infop ainfop; (void)pngp; - if (( ainfop = calloc(sizeof (apng_info),1) )) + if (( ainfop = calloc(1,sizeof (apng_info)) )) { apng_set_write_fn(pngp, ainfop, 0, 0, 0, 0, 0); apng_set_set_acTL_fn(pngp, ainfop, 0); diff --git a/src/d_main.c b/src/d_main.c index 2405b0136..3a3a0b26a 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1024,7 +1024,7 @@ void D_StartTitle(void) #define REALLOC_FILE_LIST \ if (list->files == NULL) \ { \ - list->files = calloc(sizeof(list->files), 2); \ + list->files = calloc(2, sizeof(list->files)); \ list->numfiles = 1; \ } \ else \ diff --git a/src/deh_soc.c b/src/deh_soc.c index dda3b2ef4..3759cc9c7 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2791,7 +2791,7 @@ void readframe(MYFILE *f, INT32 num) size_t z; boolean found = false; size_t actionlen = strlen(word2) + 1; - char *actiontocompare = calloc(actionlen, 1); + char *actiontocompare = calloc(1, actionlen); strcpy(actiontocompare, word2); strupr(actiontocompare); diff --git a/src/filesrch.c b/src/filesrch.c index 3a729a9c8..ea19e00cd 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -1191,7 +1191,7 @@ boolean preparefilemenu(boolean samedepth) size_t i; if (filenamebuf == NULL) - filenamebuf = calloc(sizeof(char) * MAX_WADPATH, numwadfiles); + filenamebuf = calloc(numwadfiles, sizeof(char) * MAX_WADPATH); for (i = 0; i < numwadfiles; i++) { diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 249be61f6..10c866a1e 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1706,7 +1706,7 @@ static void Impl_VideoSetupBuffer(void) vid.direct = NULL; if (vid.buffer) free(vid.buffer); - vid.buffer = calloc(vid.rowbytes*vid.height, NUMSCREENS); + vid.buffer = calloc(NUMSCREENS, vid.rowbytes*vid.height); if (!vid.buffer) { I_Error("%s", M_GetText("Not enough memory for video buffer\n")); From 85376ebe25743a98c97994f8a658566f65898d68 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 5 Jun 2024 18:18:02 -0300 Subject: [PATCH 126/353] Fix #1153 --- src/p_setup.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index c4b4a35b3..b8fcf6b71 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3502,7 +3502,6 @@ static boolean P_LoadExtraVertices(UINT8 **data) UINT32 xtrvrtx = READUINT32((*data)); line_t* ld = lines; vertex_t *oldpos = vertexes; - ssize_t offset; size_t i; if (numvertexes != origvrtx) // If native vertex count doesn't match node original vertex count, bail out (broken data?). @@ -3517,12 +3516,11 @@ static boolean P_LoadExtraVertices(UINT8 **data) // If extra vertexes were generated, reallocate the vertex array and fix the pointers. numvertexes += xtrvrtx; vertexes = Z_Realloc(vertexes, numvertexes*sizeof(*vertexes), PU_LEVEL, NULL); - offset = (size_t)(vertexes - oldpos); for (i = 0, ld = lines; i < numlines; i++, ld++) { - ld->v1 += offset; - ld->v2 += offset; + ld->v1 = &vertexes[ld->v1 - oldpos]; + ld->v2 = &vertexes[ld->v2 - oldpos]; } // Read extra vertex data. From 7751c7f132ce508a47cda7f94cca70503fdb284e Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 5 Jun 2024 18:56:02 -0300 Subject: [PATCH 127/353] Fix code that generated warnings under Clang Fixed code that generated the following warnings under Clang: -Wdeprecated-non-prototype -Wsingle-bit-bitfield-constant-conversion warnings --- src/info.h | 538 ++++++++++++++++++++++++++------------------------- src/r_defs.h | 2 +- 2 files changed, 271 insertions(+), 269 deletions(-) diff --git a/src/info.h b/src/info.h index 0361f6428..f58aee07d 100644 --- a/src/info.h +++ b/src/info.h @@ -298,276 +298,278 @@ enum actionnum NUMACTIONS }; +struct mobj_s; + // IMPORTANT NOTE: If you add/remove from this list of action // functions, don't forget to update them in deh_tables.c! -void A_Explode(); -void A_Pain(); -void A_Fall(); -void A_MonitorPop(); -void A_GoldMonitorPop(); -void A_GoldMonitorRestore(); -void A_GoldMonitorSparkle(); -void A_Look(); -void A_Chase(); -void A_FaceStabChase(); -void A_FaceStabRev(); -void A_FaceStabHurl(); -void A_FaceStabMiss(); -void A_StatueBurst(); -void A_FaceTarget(); -void A_FaceTracer(); -void A_Scream(); -void A_BossDeath(); -void A_SetShadowScale(); -void A_ShadowScream(); // MARIA!!!!!! -void A_CustomPower(); // Use this for a custom power -void A_GiveWeapon(); // Gives the player weapon(s) -void A_RingBox(); // Obtained Ring Box Tails -void A_Invincibility(); // Obtained Invincibility Box -void A_SuperSneakers(); // Obtained Super Sneakers Box -void A_BunnyHop(); // have bunny hop tails -void A_BubbleSpawn(); // Randomly spawn bubbles -void A_FanBubbleSpawn(); -void A_BubbleRise(); // Bubbles float to surface -void A_BubbleCheck(); // Don't draw if not underwater -void A_AwardScore(); -void A_ExtraLife(); // Extra Life -void A_GiveShield(); // Obtained Shield -void A_GravityBox(); -void A_ScoreRise(); // Rise the score logo -void A_AttractChase(); // Ring Chase -void A_DropMine(); // Drop Mine from Skim or Jetty-Syn Bomber -void A_FishJump(); // Fish Jump -void A_ThrownRing(); // Sparkle trail for red ring -void A_SetSolidSteam(); -void A_UnsetSolidSteam(); -void A_SignSpin(); -void A_SignPlayer(); -void A_OverlayThink(); -void A_JetChase(); -void A_JetbThink(); // Jetty-Syn Bomber Thinker -void A_JetgThink(); // Jetty-Syn Gunner Thinker -void A_JetgShoot(); // Jetty-Syn Shoot Function -void A_ShootBullet(); // JetgShoot without reactiontime setting -void A_MinusDigging(); -void A_MinusPopup(); -void A_MinusCheck(); -void A_ChickenCheck(); -void A_MouseThink(); // Mouse Thinker -void A_DetonChase(); // Deton Chaser -void A_CapeChase(); // Fake little Super Sonic cape -void A_RotateSpikeBall(); // Spike ball rotation -void A_SlingAppear(); -void A_UnidusBall(); -void A_RockSpawn(); -void A_SetFuse(); -void A_CrawlaCommanderThink(); // Crawla Commander -void A_SmokeTrailer(); -void A_RingExplode(); -void A_OldRingExplode(); -void A_MixUp(); -void A_RecyclePowers(); -void A_BossScream(); -void A_Boss2TakeDamage(); -void A_GoopSplat(); -void A_Boss2PogoSFX(); -void A_Boss2PogoTarget(); -void A_EggmanBox(); -void A_TurretFire(); -void A_SuperTurretFire(); -void A_TurretStop(); -void A_JetJawRoam(); -void A_JetJawChomp(); -void A_PointyThink(); -void A_CheckBuddy(); -void A_HoodFire(); -void A_HoodThink(); -void A_HoodFall(); -void A_ArrowBonks(); -void A_SnailerThink(); -void A_SharpChase(); -void A_SharpSpin(); -void A_SharpDecel(); -void A_CrushstaceanWalk(); -void A_CrushstaceanPunch(); -void A_CrushclawAim(); -void A_CrushclawLaunch(); -void A_VultureVtol(); -void A_VultureCheck(); -void A_VultureHover(); -void A_VultureBlast(); -void A_VultureFly(); -void A_SkimChase(); -void A_SkullAttack(); -void A_LobShot(); -void A_FireShot(); -void A_SuperFireShot(); -void A_BossFireShot(); -void A_Boss7FireMissiles(); -void A_Boss1Laser(); -void A_FocusTarget(); -void A_Boss4Reverse(); -void A_Boss4SpeedUp(); -void A_Boss4Raise(); -void A_SparkFollow(); -void A_BuzzFly(); -void A_GuardChase(); -void A_EggShield(); -void A_SetReactionTime(); -void A_Boss1Spikeballs(); -void A_Boss3TakeDamage(); -void A_Boss3Path(); -void A_Boss3ShockThink(); -void A_Shockwave(); -void A_LinedefExecute(); -void A_LinedefExecuteFromArg(); -void A_PlaySeeSound(); -void A_PlayAttackSound(); -void A_PlayActiveSound(); -void A_1upThinker(); -void A_BossZoom(); //Unused -void A_Boss1Chase(); -void A_Boss2Chase(); -void A_Boss2Pogo(); -void A_Boss7Chase(); -void A_BossJetFume(); -void A_SpawnObjectAbsolute(); -void A_SpawnObjectRelative(); -void A_ChangeAngleRelative(); -void A_ChangeAngleAbsolute(); -void A_RollAngle(); -void A_ChangeRollAngleRelative(); -void A_ChangeRollAngleAbsolute(); -void A_PlaySound(); -void A_FindTarget(); -void A_FindTracer(); -void A_SetTics(); -void A_SetRandomTics(); -void A_ChangeColorRelative(); -void A_ChangeColorAbsolute(); -void A_Dye(); -void A_SetTranslation(); -void A_MoveRelative(); -void A_MoveAbsolute(); -void A_Thrust(); -void A_ZThrust(); -void A_SetTargetsTarget(); -void A_SetObjectFlags(); -void A_SetObjectFlags2(); -void A_RandomState(); -void A_RandomStateRange(); -void A_StateRangeByAngle(); -void A_StateRangeByParameter(); -void A_DualAction(); -void A_RemoteAction(); -void A_ToggleFlameJet(); -void A_OrbitNights(); -void A_GhostMe(); -void A_SetObjectState(); -void A_SetObjectTypeState(); -void A_KnockBack(); -void A_PushAway(); -void A_RingDrain(); -void A_SplitShot(); -void A_MissileSplit(); -void A_MultiShot(); -void A_InstaLoop(); -void A_Custom3DRotate(); -void A_SearchForPlayers(); -void A_CheckRandom(); -void A_CheckTargetRings(); -void A_CheckRings(); -void A_CheckTotalRings(); -void A_CheckHealth(); -void A_CheckRange(); -void A_CheckHeight(); -void A_CheckTrueRange(); -void A_CheckThingCount(); -void A_CheckAmbush(); -void A_CheckCustomValue(); -void A_CheckCusValMemo(); -void A_SetCustomValue(); -void A_UseCusValMemo(); -void A_RelayCustomValue(); -void A_CusValAction(); -void A_ForceStop(); -void A_ForceWin(); -void A_SpikeRetract(); -void A_InfoState(); -void A_Repeat(); -void A_SetScale(); -void A_RemoteDamage(); -void A_HomingChase(); -void A_TrapShot(); -void A_VileTarget(); -void A_VileAttack(); -void A_VileFire(); -void A_BrakChase(); -void A_BrakFireShot(); -void A_BrakLobShot(); -void A_NapalmScatter(); -void A_SpawnFreshCopy(); -void A_FlickySpawn(); -void A_FlickyCenter(); -void A_FlickyAim(); -void A_FlickyFly(); -void A_FlickySoar(); -void A_FlickyCoast(); -void A_FlickyHop(); -void A_FlickyFlounder(); -void A_FlickyCheck(); -void A_FlickyHeightCheck(); -void A_FlickyFlutter(); -void A_FlameParticle(); -void A_FadeOverlay(); -void A_Boss5Jump(); -void A_LightBeamReset(); -void A_MineExplode(); -void A_MineRange(); -void A_ConnectToGround(); -void A_SpawnParticleRelative(); -void A_MultiShotDist(); -void A_WhoCaresIfYourSonIsABee(); -void A_ParentTriesToSleep(); -void A_CryingToMomma(); -void A_CheckFlags2(); -void A_Boss5FindWaypoint(); -void A_DoNPCSkid(); -void A_DoNPCPain(); -void A_PrepareRepeat(); -void A_Boss5ExtraRepeat(); -void A_Boss5Calm(); -void A_Boss5CheckOnGround(); -void A_Boss5CheckFalling(); -void A_Boss5PinchShot(); -void A_Boss5MakeItRain(); -void A_Boss5MakeJunk(); -void A_LookForBetter(); -void A_Boss5BombExplode(); -void A_DustDevilThink(); -void A_TNTExplode(); -void A_DebrisRandom(); -void A_TrainCameo(); -void A_TrainCameo2(); -void A_CanarivoreGas(); -void A_KillSegments(); -void A_SnapperSpawn(); -void A_SnapperThinker(); -void A_SaloonDoorSpawn(); -void A_MinecartSparkThink(); -void A_ModuloToState(); -void A_LavafallRocks(); -void A_LavafallLava(); -void A_FallingLavaCheck(); -void A_FireShrink(); -void A_SpawnPterabytes(); -void A_PterabyteHover(); -void A_RolloutSpawn(); -void A_RolloutRock(); -void A_DragonbomberSpawn(); -void A_DragonWing(); -void A_DragonSegment(); -void A_ChangeHeight(); +void A_Explode(struct mobj_s *actor); +void A_Pain(struct mobj_s *actor); +void A_Fall(struct mobj_s *actor); +void A_MonitorPop(struct mobj_s *actor); +void A_GoldMonitorPop(struct mobj_s *actor); +void A_GoldMonitorRestore(struct mobj_s *actor); +void A_GoldMonitorSparkle(struct mobj_s *actor); +void A_Look(struct mobj_s *actor); +void A_Chase(struct mobj_s *actor); +void A_FaceStabChase(struct mobj_s *actor); +void A_FaceStabRev(struct mobj_s *actor); +void A_FaceStabHurl(struct mobj_s *actor); +void A_FaceStabMiss(struct mobj_s *actor); +void A_StatueBurst(struct mobj_s *actor); +void A_FaceTarget(struct mobj_s *actor); +void A_FaceTracer(struct mobj_s *actor); +void A_Scream(struct mobj_s *actor); +void A_BossDeath(struct mobj_s *actor); +void A_SetShadowScale(struct mobj_s *actor); +void A_ShadowScream(struct mobj_s *actor); // MARIA!!!!!! +void A_CustomPower(struct mobj_s *actor); // Use this for a custom power +void A_GiveWeapon(struct mobj_s *actor); // Gives the player weapon(s) +void A_RingBox(struct mobj_s *actor); // Obtained Ring Box Tails +void A_Invincibility(struct mobj_s *actor); // Obtained Invincibility Box +void A_SuperSneakers(struct mobj_s *actor); // Obtained Super Sneakers Box +void A_BunnyHop(struct mobj_s *actor); // have bunny hop tails +void A_BubbleSpawn(struct mobj_s *actor); // Randomly spawn bubbles +void A_FanBubbleSpawn(struct mobj_s *actor); +void A_BubbleRise(struct mobj_s *actor); // Bubbles float to surface +void A_BubbleCheck(struct mobj_s *actor); // Don't draw if not underwater +void A_AwardScore(struct mobj_s *actor); +void A_ExtraLife(struct mobj_s *actor); // Extra Life +void A_GiveShield(struct mobj_s *actor); // Obtained Shield +void A_GravityBox(struct mobj_s *actor); +void A_ScoreRise(struct mobj_s *actor); // Rise the score logo +void A_AttractChase(struct mobj_s *actor); // Ring Chase +void A_DropMine(struct mobj_s *actor); // Drop Mine from Skim or Jetty-Syn Bomber +void A_FishJump(struct mobj_s *actor); // Fish Jump +void A_ThrownRing(struct mobj_s *actor); // Sparkle trail for red ring +void A_SetSolidSteam(struct mobj_s *actor); +void A_UnsetSolidSteam(struct mobj_s *actor); +void A_SignSpin(struct mobj_s *actor); +void A_SignPlayer(struct mobj_s *actor); +void A_OverlayThink(struct mobj_s *actor); +void A_JetChase(struct mobj_s *actor); +void A_JetbThink(struct mobj_s *actor); // Jetty-Syn Bomber Thinker +void A_JetgThink(struct mobj_s *actor); // Jetty-Syn Gunner Thinker +void A_JetgShoot(struct mobj_s *actor); // Jetty-Syn Shoot Function +void A_ShootBullet(struct mobj_s *actor); // JetgShoot without reactiontime setting +void A_MinusDigging(struct mobj_s *actor); +void A_MinusPopup(struct mobj_s *actor); +void A_MinusCheck(struct mobj_s *actor); +void A_ChickenCheck(struct mobj_s *actor); +void A_MouseThink(struct mobj_s *actor); // Mouse Thinker +void A_DetonChase(struct mobj_s *actor); // Deton Chaser +void A_CapeChase(struct mobj_s *actor); // Fake little Super Sonic cape +void A_RotateSpikeBall(struct mobj_s *actor); // Spike ball rotation +void A_SlingAppear(struct mobj_s *actor); +void A_UnidusBall(struct mobj_s *actor); +void A_RockSpawn(struct mobj_s *actor); +void A_SetFuse(struct mobj_s *actor); +void A_CrawlaCommanderThink(struct mobj_s *actor); // Crawla Commander +void A_SmokeTrailer(struct mobj_s *actor); +void A_RingExplode(struct mobj_s *actor); +void A_OldRingExplode(struct mobj_s *actor); +void A_MixUp(struct mobj_s *actor); +void A_RecyclePowers(struct mobj_s *actor); +void A_BossScream(struct mobj_s *actor); +void A_Boss2TakeDamage(struct mobj_s *actor); +void A_GoopSplat(struct mobj_s *actor); +void A_Boss2PogoSFX(struct mobj_s *actor); +void A_Boss2PogoTarget(struct mobj_s *actor); +void A_EggmanBox(struct mobj_s *actor); +void A_TurretFire(struct mobj_s *actor); +void A_SuperTurretFire(struct mobj_s *actor); +void A_TurretStop(struct mobj_s *actor); +void A_JetJawRoam(struct mobj_s *actor); +void A_JetJawChomp(struct mobj_s *actor); +void A_PointyThink(struct mobj_s *actor); +void A_CheckBuddy(struct mobj_s *actor); +void A_HoodFire(struct mobj_s *actor); +void A_HoodThink(struct mobj_s *actor); +void A_HoodFall(struct mobj_s *actor); +void A_ArrowBonks(struct mobj_s *actor); +void A_SnailerThink(struct mobj_s *actor); +void A_SharpChase(struct mobj_s *actor); +void A_SharpSpin(struct mobj_s *actor); +void A_SharpDecel(struct mobj_s *actor); +void A_CrushstaceanWalk(struct mobj_s *actor); +void A_CrushstaceanPunch(struct mobj_s *actor); +void A_CrushclawAim(struct mobj_s *actor); +void A_CrushclawLaunch(struct mobj_s *actor); +void A_VultureVtol(struct mobj_s *actor); +void A_VultureCheck(struct mobj_s *actor); +void A_VultureHover(struct mobj_s *actor); +void A_VultureBlast(struct mobj_s *actor); +void A_VultureFly(struct mobj_s *actor); +void A_SkimChase(struct mobj_s *actor); +void A_SkullAttack(struct mobj_s *actor); +void A_LobShot(struct mobj_s *actor); +void A_FireShot(struct mobj_s *actor); +void A_SuperFireShot(struct mobj_s *actor); +void A_BossFireShot(struct mobj_s *actor); +void A_Boss7FireMissiles(struct mobj_s *actor); +void A_Boss1Laser(struct mobj_s *actor); +void A_FocusTarget(struct mobj_s *actor); +void A_Boss4Reverse(struct mobj_s *actor); +void A_Boss4SpeedUp(struct mobj_s *actor); +void A_Boss4Raise(struct mobj_s *actor); +void A_SparkFollow(struct mobj_s *actor); +void A_BuzzFly(struct mobj_s *actor); +void A_GuardChase(struct mobj_s *actor); +void A_EggShield(struct mobj_s *actor); +void A_SetReactionTime(struct mobj_s *actor); +void A_Boss1Spikeballs(struct mobj_s *actor); +void A_Boss3TakeDamage(struct mobj_s *actor); +void A_Boss3Path(struct mobj_s *actor); +void A_Boss3ShockThink(struct mobj_s *actor); +void A_Shockwave(struct mobj_s *actor); +void A_LinedefExecute(struct mobj_s *actor); +void A_LinedefExecuteFromArg(struct mobj_s *actor); +void A_PlaySeeSound(struct mobj_s *actor); +void A_PlayAttackSound(struct mobj_s *actor); +void A_PlayActiveSound(struct mobj_s *actor); +void A_1upThinker(struct mobj_s *actor); +void A_BossZoom(struct mobj_s *actor); //Unused +void A_Boss1Chase(struct mobj_s *actor); +void A_Boss2Chase(struct mobj_s *actor); +void A_Boss2Pogo(struct mobj_s *actor); +void A_Boss7Chase(struct mobj_s *actor); +void A_BossJetFume(struct mobj_s *actor); +void A_SpawnObjectAbsolute(struct mobj_s *actor); +void A_SpawnObjectRelative(struct mobj_s *actor); +void A_ChangeAngleRelative(struct mobj_s *actor); +void A_ChangeAngleAbsolute(struct mobj_s *actor); +void A_RollAngle(struct mobj_s *actor); +void A_ChangeRollAngleRelative(struct mobj_s *actor); +void A_ChangeRollAngleAbsolute(struct mobj_s *actor); +void A_PlaySound(struct mobj_s *actor); +void A_FindTarget(struct mobj_s *actor); +void A_FindTracer(struct mobj_s *actor); +void A_SetTics(struct mobj_s *actor); +void A_SetRandomTics(struct mobj_s *actor); +void A_ChangeColorRelative(struct mobj_s *actor); +void A_ChangeColorAbsolute(struct mobj_s *actor); +void A_Dye(struct mobj_s *actor); +void A_SetTranslation(struct mobj_s *actor); +void A_MoveRelative(struct mobj_s *actor); +void A_MoveAbsolute(struct mobj_s *actor); +void A_Thrust(struct mobj_s *actor); +void A_ZThrust(struct mobj_s *actor); +void A_SetTargetsTarget(struct mobj_s *actor); +void A_SetObjectFlags(struct mobj_s *actor); +void A_SetObjectFlags2(struct mobj_s *actor); +void A_RandomState(struct mobj_s *actor); +void A_RandomStateRange(struct mobj_s *actor); +void A_StateRangeByAngle(struct mobj_s *actor); +void A_StateRangeByParameter(struct mobj_s *actor); +void A_DualAction(struct mobj_s *actor); +void A_RemoteAction(struct mobj_s *actor); +void A_ToggleFlameJet(struct mobj_s *actor); +void A_OrbitNights(struct mobj_s *actor); +void A_GhostMe(struct mobj_s *actor); +void A_SetObjectState(struct mobj_s *actor); +void A_SetObjectTypeState(struct mobj_s *actor); +void A_KnockBack(struct mobj_s *actor); +void A_PushAway(struct mobj_s *actor); +void A_RingDrain(struct mobj_s *actor); +void A_SplitShot(struct mobj_s *actor); +void A_MissileSplit(struct mobj_s *actor); +void A_MultiShot(struct mobj_s *actor); +void A_InstaLoop(struct mobj_s *actor); +void A_Custom3DRotate(struct mobj_s *actor); +void A_SearchForPlayers(struct mobj_s *actor); +void A_CheckRandom(struct mobj_s *actor); +void A_CheckTargetRings(struct mobj_s *actor); +void A_CheckRings(struct mobj_s *actor); +void A_CheckTotalRings(struct mobj_s *actor); +void A_CheckHealth(struct mobj_s *actor); +void A_CheckRange(struct mobj_s *actor); +void A_CheckHeight(struct mobj_s *actor); +void A_CheckTrueRange(struct mobj_s *actor); +void A_CheckThingCount(struct mobj_s *actor); +void A_CheckAmbush(struct mobj_s *actor); +void A_CheckCustomValue(struct mobj_s *actor); +void A_CheckCusValMemo(struct mobj_s *actor); +void A_SetCustomValue(struct mobj_s *actor); +void A_UseCusValMemo(struct mobj_s *actor); +void A_RelayCustomValue(struct mobj_s *actor); +void A_CusValAction(struct mobj_s *actor); +void A_ForceStop(struct mobj_s *actor); +void A_ForceWin(struct mobj_s *actor); +void A_SpikeRetract(struct mobj_s *actor); +void A_InfoState(struct mobj_s *actor); +void A_Repeat(struct mobj_s *actor); +void A_SetScale(struct mobj_s *actor); +void A_RemoteDamage(struct mobj_s *actor); +void A_HomingChase(struct mobj_s *actor); +void A_TrapShot(struct mobj_s *actor); +void A_VileTarget(struct mobj_s *actor); +void A_VileAttack(struct mobj_s *actor); +void A_VileFire(struct mobj_s *actor); +void A_BrakChase(struct mobj_s *actor); +void A_BrakFireShot(struct mobj_s *actor); +void A_BrakLobShot(struct mobj_s *actor); +void A_NapalmScatter(struct mobj_s *actor); +void A_SpawnFreshCopy(struct mobj_s *actor); +void A_FlickySpawn(struct mobj_s *actor); +void A_FlickyCenter(struct mobj_s *actor); +void A_FlickyAim(struct mobj_s *actor); +void A_FlickyFly(struct mobj_s *actor); +void A_FlickySoar(struct mobj_s *actor); +void A_FlickyCoast(struct mobj_s *actor); +void A_FlickyHop(struct mobj_s *actor); +void A_FlickyFlounder(struct mobj_s *actor); +void A_FlickyCheck(struct mobj_s *actor); +void A_FlickyHeightCheck(struct mobj_s *actor); +void A_FlickyFlutter(struct mobj_s *actor); +void A_FlameParticle(struct mobj_s *actor); +void A_FadeOverlay(struct mobj_s *actor); +void A_Boss5Jump(struct mobj_s *actor); +void A_LightBeamReset(struct mobj_s *actor); +void A_MineExplode(struct mobj_s *actor); +void A_MineRange(struct mobj_s *actor); +void A_ConnectToGround(struct mobj_s *actor); +void A_SpawnParticleRelative(struct mobj_s *actor); +void A_MultiShotDist(struct mobj_s *actor); +void A_WhoCaresIfYourSonIsABee(struct mobj_s *actor); +void A_ParentTriesToSleep(struct mobj_s *actor); +void A_CryingToMomma(struct mobj_s *actor); +void A_CheckFlags2(struct mobj_s *actor); +void A_Boss5FindWaypoint(struct mobj_s *actor); +void A_DoNPCSkid(struct mobj_s *actor); +void A_DoNPCPain(struct mobj_s *actor); +void A_PrepareRepeat(struct mobj_s *actor); +void A_Boss5ExtraRepeat(struct mobj_s *actor); +void A_Boss5Calm(struct mobj_s *actor); +void A_Boss5CheckOnGround(struct mobj_s *actor); +void A_Boss5CheckFalling(struct mobj_s *actor); +void A_Boss5PinchShot(struct mobj_s *actor); +void A_Boss5MakeItRain(struct mobj_s *actor); +void A_Boss5MakeJunk(struct mobj_s *actor); +void A_LookForBetter(struct mobj_s *actor); +void A_Boss5BombExplode(struct mobj_s *actor); +void A_DustDevilThink(struct mobj_s *actor); +void A_TNTExplode(struct mobj_s *actor); +void A_DebrisRandom(struct mobj_s *actor); +void A_TrainCameo(struct mobj_s *actor); +void A_TrainCameo2(struct mobj_s *actor); +void A_CanarivoreGas(struct mobj_s *actor); +void A_KillSegments(struct mobj_s *actor); +void A_SnapperSpawn(struct mobj_s *actor); +void A_SnapperThinker(struct mobj_s *actor); +void A_SaloonDoorSpawn(struct mobj_s *actor); +void A_MinecartSparkThink(struct mobj_s *actor); +void A_ModuloToState(struct mobj_s *actor); +void A_LavafallRocks(struct mobj_s *actor); +void A_LavafallLava(struct mobj_s *actor); +void A_FallingLavaCheck(struct mobj_s *actor); +void A_FireShrink(struct mobj_s *actor); +void A_SpawnPterabytes(struct mobj_s *actor); +void A_PterabyteHover(struct mobj_s *actor); +void A_RolloutSpawn(struct mobj_s *actor); +void A_RolloutRock(struct mobj_s *actor); +void A_DragonbomberSpawn(struct mobj_s *actor); +void A_DragonWing(struct mobj_s *actor); +void A_DragonSegment(struct mobj_s *actor); +void A_ChangeHeight(struct mobj_s *actor); extern int actionsoverridden[NUMACTIONS][MAX_ACTION_RECURSION]; diff --git a/src/r_defs.h b/src/r_defs.h index 7a6f518ee..54d43e824 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -358,7 +358,7 @@ typedef struct pslope_s double dzdelta; - boolean moved : 1; + boolean moved; UINT8 flags; // Slope options } pslope_t; From 4065860ddda41435092a3137a8ebe48796b5913c Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 5 Jun 2024 18:57:48 -0300 Subject: [PATCH 128/353] Delete duplicated prototypes --- src/p_enemy.c | 270 -------------------------------------------------- 1 file changed, 270 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 59934aa40..e1b21e295 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -54,276 +54,6 @@ static dirtype_t diags[] = DI_NORTHWEST, DI_NORTHEAST, DI_SOUTHWEST, DI_SOUTHEAST }; -//Real Prototypes to A_* -void A_Fall(mobj_t *actor); -void A_Look(mobj_t *actor); -void A_Chase(mobj_t *actor); -void A_FaceStabChase(mobj_t *actor); -void A_FaceStabRev(mobj_t *actor); -void A_FaceStabHurl(mobj_t *actor); -void A_FaceStabMiss(mobj_t *actor); -void A_StatueBurst(mobj_t *actor); -void A_JetJawRoam(mobj_t *actor); -void A_JetJawChomp(mobj_t *actor); -void A_PointyThink(mobj_t *actor); -void A_CheckBuddy(mobj_t *actor); -void A_HoodFire(mobj_t *actor); -void A_HoodThink(mobj_t *actor); -void A_HoodFall(mobj_t *actor); -void A_ArrowBonks(mobj_t *actor); -void A_SnailerThink(mobj_t *actor); -void A_SharpChase(mobj_t *actor); -void A_SharpSpin(mobj_t *actor); -void A_SharpDecel(mobj_t *actor); -void A_CrushstaceanWalk(mobj_t *actor); -void A_CrushstaceanPunch(mobj_t *actor); -void A_CrushclawAim(mobj_t *actor); -void A_CrushclawLaunch(mobj_t *actor); -void A_VultureVtol(mobj_t *actor); -void A_VultureCheck(mobj_t *actor); -void A_VultureHover(mobj_t *actor); -void A_VultureBlast(mobj_t *actor); -void A_VultureFly(mobj_t *actor); -void A_SkimChase(mobj_t *actor); -void A_FaceTarget(mobj_t *actor); -void A_FaceTracer(mobj_t *actor); -void A_LobShot(mobj_t *actor); -void A_FireShot(mobj_t *actor); -void A_SuperFireShot(mobj_t *actor); -void A_BossFireShot(mobj_t *actor); -void A_Boss7FireMissiles(mobj_t *actor); -void A_Boss1Laser(mobj_t *actor); -void A_FocusTarget(mobj_t *actor); -void A_Boss4Reverse(mobj_t *actor); -void A_Boss4SpeedUp(mobj_t *actor); -void A_Boss4Raise(mobj_t *actor); -void A_SkullAttack(mobj_t *actor); -void A_BossZoom(mobj_t *actor); -void A_BossScream(mobj_t *actor); -void A_Scream(mobj_t *actor); -void A_Pain(mobj_t *actor); -void A_1upThinker(mobj_t *actor); -void A_MonitorPop(mobj_t *actor); -void A_GoldMonitorPop(mobj_t *actor); -void A_GoldMonitorRestore(mobj_t *actor); -void A_GoldMonitorSparkle(mobj_t *actor); -void A_Explode(mobj_t *actor); -void A_BossDeath(mobj_t *actor); -void A_SetShadowScale(mobj_t *actor); -void A_ShadowScream(mobj_t *actor); -void A_CustomPower(mobj_t *actor); -void A_GiveWeapon(mobj_t *actor); -void A_RingBox(mobj_t *actor); -void A_Invincibility(mobj_t *actor); -void A_SuperSneakers(mobj_t *actor); -void A_AwardScore(mobj_t *actor); -void A_ExtraLife(mobj_t *actor); -void A_GiveShield(mobj_t *actor); -void A_GravityBox(mobj_t *actor); -void A_ScoreRise(mobj_t *actor); -void A_BunnyHop(mobj_t *actor); -void A_BubbleSpawn(mobj_t *actor); -void A_FanBubbleSpawn(mobj_t *actor); -void A_BubbleRise(mobj_t *actor); -void A_BubbleCheck(mobj_t *actor); -void A_AttractChase(mobj_t *actor); -void A_DropMine(mobj_t *actor); -void A_FishJump(mobj_t *actor); -void A_ThrownRing(mobj_t *actor); -void A_SetSolidSteam(mobj_t *actor); -void A_UnsetSolidSteam(mobj_t *actor); -void A_SignSpin(mobj_t *actor); -void A_SignPlayer(mobj_t *actor); -void A_OverlayThink(mobj_t *actor); -void A_JetChase(mobj_t *actor); -void A_JetbThink(mobj_t *actor); -void A_JetgShoot(mobj_t *actor); -void A_JetgThink(mobj_t *actor); -void A_ShootBullet(mobj_t *actor); -void A_MinusDigging(mobj_t *actor); -void A_MinusPopup(mobj_t *actor); -void A_MinusCheck(mobj_t *actor); -void A_ChickenCheck(mobj_t *actor); -void A_MouseThink(mobj_t *actor); -void A_DetonChase(mobj_t *actor); -void A_CapeChase(mobj_t *actor); -void A_RotateSpikeBall(mobj_t *actor); -void A_SlingAppear(mobj_t *actor); -void A_UnidusBall(mobj_t *actor); -void A_RockSpawn(mobj_t *actor); -void A_SetFuse(mobj_t *actor); -void A_CrawlaCommanderThink(mobj_t *actor); -void A_RingExplode(mobj_t *actor); -void A_OldRingExplode(mobj_t *actor); -void A_MixUp(mobj_t *actor); -void A_RecyclePowers(mobj_t *actor); -void A_Boss2TakeDamage(mobj_t *actor); -void A_Boss7Chase(mobj_t *actor); -void A_GoopSplat(mobj_t *actor); -void A_Boss2PogoSFX(mobj_t *actor); -void A_Boss2PogoTarget(mobj_t *actor); -void A_EggmanBox(mobj_t *actor); -void A_TurretFire(mobj_t *actor); -void A_SuperTurretFire(mobj_t *actor); -void A_TurretStop(mobj_t *actor); -void A_SparkFollow(mobj_t *actor); -void A_BuzzFly(mobj_t *actor); -void A_GuardChase(mobj_t *actor); -void A_EggShield(mobj_t *actor); -void A_SetReactionTime(mobj_t *actor); -void A_Boss1Spikeballs(mobj_t *actor); -void A_Boss3TakeDamage(mobj_t *actor); -void A_Boss3Path(mobj_t *actor); -void A_Boss3ShockThink(mobj_t *actor); -void A_Shockwave(mobj_t *actor); -void A_LinedefExecute(mobj_t *actor); -void A_LinedefExecuteFromArg(mobj_t *actor); -void A_PlaySeeSound(mobj_t *actor); -void A_PlayAttackSound(mobj_t *actor); -void A_PlayActiveSound(mobj_t *actor); -void A_SmokeTrailer(mobj_t *actor); -void A_SpawnObjectAbsolute(mobj_t *actor); -void A_SpawnObjectRelative(mobj_t *actor); -void A_ChangeAngleRelative(mobj_t *actor); -void A_ChangeAngleAbsolute(mobj_t *actor); -void A_RollAngle(mobj_t *actor); -void A_ChangeRollAngleRelative(mobj_t *actor); -void A_ChangeRollAngleAbsolute(mobj_t *actor); -void A_PlaySound(mobj_t *actor); -void A_FindTarget(mobj_t *actor); -void A_FindTracer(mobj_t *actor); -void A_SetTics(mobj_t *actor); -void A_SetRandomTics(mobj_t *actor); -void A_ChangeColorRelative(mobj_t *actor); -void A_ChangeColorAbsolute(mobj_t *actor); -void A_Dye(mobj_t *actor); -void A_SetTranslation(mobj_t *actor); -void A_MoveRelative(mobj_t *actor); -void A_MoveAbsolute(mobj_t *actor); -void A_Thrust(mobj_t *actor); -void A_ZThrust(mobj_t *actor); -void A_SetTargetsTarget(mobj_t *actor); -void A_SetObjectFlags(mobj_t *actor); -void A_SetObjectFlags2(mobj_t *actor); -void A_RandomState(mobj_t *actor); -void A_RandomStateRange(mobj_t *actor); -void A_StateRangeByAngle(mobj_t *actor); -void A_StateRangeByParameter(mobj_t *actor); -void A_DualAction(mobj_t *actor); -void A_RemoteAction(mobj_t *actor); -void A_ToggleFlameJet(mobj_t *actor); -void A_OrbitNights(mobj_t *actor); -void A_GhostMe(mobj_t *actor); -void A_SetObjectState(mobj_t *actor); -void A_SetObjectTypeState(mobj_t *actor); -void A_KnockBack(mobj_t *actor); -void A_PushAway(mobj_t *actor); -void A_RingDrain(mobj_t *actor); -void A_SplitShot(mobj_t *actor); -void A_MissileSplit(mobj_t *actor); -void A_MultiShot(mobj_t *actor); -void A_InstaLoop(mobj_t *actor); -void A_Custom3DRotate(mobj_t *actor); -void A_SearchForPlayers(mobj_t *actor); -void A_CheckRandom(mobj_t *actor); -void A_CheckTargetRings(mobj_t *actor); -void A_CheckRings(mobj_t *actor); -void A_CheckTotalRings(mobj_t *actor); -void A_CheckHealth(mobj_t *actor); -void A_CheckRange(mobj_t *actor); -void A_CheckHeight(mobj_t *actor); -void A_CheckTrueRange(mobj_t *actor); -void A_CheckThingCount(mobj_t *actor); -void A_CheckAmbush(mobj_t *actor); -void A_CheckCustomValue(mobj_t *actor); -void A_CheckCusValMemo(mobj_t *actor); -void A_SetCustomValue(mobj_t *actor); -void A_UseCusValMemo(mobj_t *actor); -void A_RelayCustomValue(mobj_t *actor); -void A_CusValAction(mobj_t *actor); -void A_ForceStop(mobj_t *actor); -void A_ForceWin(mobj_t *actor); -void A_SpikeRetract(mobj_t *actor); -void A_InfoState(mobj_t *actor); -void A_Repeat(mobj_t *actor); -void A_SetScale(mobj_t *actor); -void A_RemoteDamage(mobj_t *actor); -void A_HomingChase(mobj_t *actor); -void A_TrapShot(mobj_t *actor); -void A_Boss1Chase(mobj_t *actor); -void A_Boss2Chase(mobj_t *actor); -void A_Boss2Pogo(mobj_t *actor); -void A_BossJetFume(mobj_t *actor); -void A_VileTarget(mobj_t *actor); -void A_VileAttack(mobj_t *actor); -void A_VileFire(mobj_t *actor); -void A_BrakChase(mobj_t *actor); -void A_BrakFireShot(mobj_t *actor); -void A_BrakLobShot(mobj_t *actor); -void A_NapalmScatter(mobj_t *actor); -void A_SpawnFreshCopy(mobj_t *actor); -void A_FlickySpawn(mobj_t *actor); -void A_FlickyCenter(mobj_t *actor); -void A_FlickyAim(mobj_t *actor); -void A_FlickyFly(mobj_t *actor); -void A_FlickySoar(mobj_t *actor); -void A_FlickyCoast(mobj_t *actor); -void A_FlickyHop(mobj_t *actor); -void A_FlickyFlounder(mobj_t *actor); -void A_FlickyCheck(mobj_t *actor); -void A_FlickyHeightCheck(mobj_t *actor); -void A_FlickyFlutter(mobj_t *actor); -void A_FlameParticle(mobj_t *actor); -void A_FadeOverlay(mobj_t *actor); -void A_Boss5Jump(mobj_t *actor); -void A_LightBeamReset(mobj_t *actor); -void A_MineExplode(mobj_t *actor); -void A_MineRange(mobj_t *actor); -void A_ConnectToGround(mobj_t *actor); -void A_SpawnParticleRelative(mobj_t *actor); -void A_MultiShotDist(mobj_t *actor); -void A_WhoCaresIfYourSonIsABee(mobj_t *actor); -void A_ParentTriesToSleep(mobj_t *actor); -void A_CryingToMomma(mobj_t *actor); -void A_CheckFlags2(mobj_t *actor); -void A_Boss5FindWaypoint(mobj_t *actor); -void A_DoNPCSkid(mobj_t *actor); -void A_DoNPCPain(mobj_t *actor); -void A_PrepareRepeat(mobj_t *actor); -void A_Boss5ExtraRepeat(mobj_t *actor); -void A_Boss5Calm(mobj_t *actor); -void A_Boss5CheckOnGround(mobj_t *actor); -void A_Boss5CheckFalling(mobj_t *actor); -void A_Boss5PinchShot(mobj_t *actor); -void A_Boss5MakeItRain(mobj_t *actor); -void A_Boss5MakeJunk(mobj_t *actor); -void A_LookForBetter(mobj_t *actor); -void A_Boss5BombExplode(mobj_t *actor); -void A_DustDevilThink(mobj_t *actor); -void A_TNTExplode(mobj_t *actor); -void A_DebrisRandom(mobj_t *actor); -void A_TrainCameo(mobj_t *actor); -void A_TrainCameo2(mobj_t *actor); -void A_CanarivoreGas(mobj_t *actor); -void A_KillSegments(mobj_t *actor); -void A_SnapperSpawn(mobj_t *actor); -void A_SnapperThinker(mobj_t *actor); -void A_SaloonDoorSpawn(mobj_t *actor); -void A_MinecartSparkThink(mobj_t *actor); -void A_ModuloToState(mobj_t *actor); -void A_LavafallRocks(mobj_t *actor); -void A_LavafallLava(mobj_t *actor); -void A_FallingLavaCheck(mobj_t *actor); -void A_FireShrink(mobj_t *actor); -void A_SpawnPterabytes(mobj_t *actor); -void A_PterabyteHover(mobj_t *actor); -void A_RolloutSpawn(mobj_t *actor); -void A_RolloutRock(mobj_t *actor); -void A_DragonbomberSpawn(mobj_t *actor); -void A_DragonWing(mobj_t *actor); -void A_DragonSegment(mobj_t *actor); -void A_ChangeHeight(mobj_t *actor); - //for p_enemy.c // From 1718361123c75b65df59457a208a4efcc4888c5f Mon Sep 17 00:00:00 2001 From: Hanicef Date: Fri, 7 Jun 2024 12:40:23 +0200 Subject: [PATCH 129/353] Fix segfault when setting forceskin to None --- src/command.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/command.c b/src/command.c index 7947048ed..e0156274e 100644 --- a/src/command.c +++ b/src/command.c @@ -2065,11 +2065,10 @@ static void CV_SetValueMaybeStealth(consvar_t *var, INT32 value, boolean stealth if (var == &cv_forceskin) // Special handling. { const char *tmpskin = NULL; - if ((value < 0) || (value >= numskins)) - ; - else + if (value >= 0 && value < numskins) tmpskin = skins[value]->name; - memcpy(val, tmpskin, SKINNAMESIZE); + if (tmpskin) + memcpy(val, tmpskin, SKINNAMESIZE); } else sprintf(val, "%d", value); From 5f7389142e4cd4005f0f1bbe0704a8969dc8f73f Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Fri, 7 Jun 2024 19:08:22 -0300 Subject: [PATCH 130/353] Interpolate renderer-specific slope vectors --- src/m_vector.c | 26 ++++++++++++++++++++++++++ src/m_vector.h | 4 ++++ src/r_fps.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- src/r_fps.h | 3 +++ 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/src/m_vector.c b/src/m_vector.c index 3132a869d..1b04f8ae1 100644 --- a/src/m_vector.c +++ b/src/m_vector.c @@ -21,6 +21,32 @@ void DVector3_Load(dvector3_t *vec, double x, double y, double z) vec->z = z; } +void DVector3_Copy(dvector3_t *a_o, const dvector3_t *a_i) +{ + memcpy(a_o, a_i, sizeof(dvector3_t)); +} + +void DVector3_Add(const dvector3_t *a_i, const dvector3_t *a_c, dvector3_t *a_o) +{ + a_o->x = a_i->x + a_c->x; + a_o->y = a_i->y + a_c->y; + a_o->z = a_i->z + a_c->z; +} + +void DVector3_Subtract(const dvector3_t *a_i, const dvector3_t *a_c, dvector3_t *a_o) +{ + a_o->x = a_i->x - a_c->x; + a_o->y = a_i->y - a_c->y; + a_o->z = a_i->z - a_c->z; +} + +void DVector3_Multiply(const dvector3_t *a_i, double a_c, dvector3_t *a_o) +{ + a_o->x = a_i->x * a_c; + a_o->y = a_i->y * a_c; + a_o->z = a_i->z * a_c; +} + double DVector3_Magnitude(const dvector3_t *a_normal) { double xs = a_normal->x * a_normal->x; diff --git a/src/m_vector.h b/src/m_vector.h index 55669be03..1395744f2 100644 --- a/src/m_vector.h +++ b/src/m_vector.h @@ -19,6 +19,10 @@ typedef struct } dvector3_t; void DVector3_Load(dvector3_t *vec, double x, double y, double z); +void DVector3_Copy(dvector3_t *a_o, const dvector3_t *a_i); +void DVector3_Add(const dvector3_t *a_i, const dvector3_t *a_c, dvector3_t *a_o); +void DVector3_Subtract(const dvector3_t *a_i, const dvector3_t *a_c, dvector3_t *a_o); +void DVector3_Multiply(const dvector3_t *a_i, double a_c, dvector3_t *a_o); double DVector3_Magnitude(const dvector3_t *a_normal); double DVector3_Normalize(dvector3_t *a_normal); void DVector3_Negate(dvector3_t *a_o); diff --git a/src/r_fps.c b/src/r_fps.c index 0773f228d..7f1f2bb30 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -120,6 +120,19 @@ static vector3_t *R_LerpVector3(const vector3_t *from, const vector3_t *to, fixe return out; } +static double R_LerpDouble(double from, double to, double frac) +{ + return from + (frac * (to - from)); +} + +static dvector3_t *R_LerpDVector3(const dvector3_t *from, const dvector3_t *to, double frac, dvector3_t *out) +{ + DVector3_Subtract(to, from, out); + DVector3_Multiply(out, frac, out); + DVector3_Add(from, out, out); + return out; +} + // recalc necessary stuff for mouseaiming // slopes are already calculated for the full possible view (which is 4*viewheight). // 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out) @@ -497,6 +510,14 @@ void R_CreateInterpolator_DynSlope(thinker_t *thinker, pslope_t *slope) FV2_Copy(&interp->dynslope.bakd, &slope->d); interp->dynslope.oldzdelta = interp->dynslope.bakzdelta = slope->zdelta; + + DVector3_Copy(&interp->dynslope.oldorigin, &slope->dorigin); + DVector3_Copy(&interp->dynslope.bakorigin, &slope->dorigin); + + DVector3_Copy(&interp->dynslope.oldnormdir, &slope->dnormdir); + DVector3_Copy(&interp->dynslope.baknormdir, &slope->dnormdir); + + interp->dynslope.olddzdelta = interp->dynslope.bakdzdelta = slope->dzdelta; } void R_InitializeLevelInterpolators(void) @@ -561,6 +582,21 @@ static void UpdateLevelInterpolatorState(levelinterpolator_t *interp) FV3_Copy(&interp->dynslope.bako, &interp->dynslope.slope->o); FV2_Copy(&interp->dynslope.bakd, &interp->dynslope.slope->d); interp->dynslope.bakzdelta = interp->dynslope.slope->zdelta; + + DVector3_Copy(&interp->dynslope.oldorigin, &interp->dynslope.bakorigin); + DVector3_Copy(&interp->dynslope.oldnormdir, &interp->dynslope.baknormdir); + interp->dynslope.olddzdelta = interp->dynslope.bakdzdelta; + + if (interp->dynslope.slope->moved) + { + P_CalculateSlopeVectors(interp->dynslope.slope); + + interp->dynslope.slope->moved = false; + } + + DVector3_Copy(&interp->dynslope.bakorigin, &interp->dynslope.slope->dorigin); + DVector3_Copy(&interp->dynslope.baknormdir, &interp->dynslope.slope->dnormdir); + interp->dynslope.bakdzdelta = interp->dynslope.slope->dzdelta; break; } } @@ -646,7 +682,13 @@ void R_ApplyLevelInterpolators(fixed_t frac) R_LerpVector3(&interp->dynslope.oldo, &interp->dynslope.bako, frac, &interp->dynslope.slope->o); R_LerpVector2(&interp->dynslope.oldd, &interp->dynslope.bakd, frac, &interp->dynslope.slope->d); interp->dynslope.slope->zdelta = R_LerpFixed(interp->dynslope.oldzdelta, interp->dynslope.bakzdelta, frac); - interp->dynslope.slope->moved = true; + if (rendermode == render_soft) + { + double dfrac = FixedToDouble(frac); + R_LerpDVector3(&interp->dynslope.oldorigin, &interp->dynslope.bakorigin, dfrac, &interp->dynslope.slope->dorigin); + R_LerpDVector3(&interp->dynslope.oldnormdir, &interp->dynslope.baknormdir, dfrac, &interp->dynslope.slope->dnormdir); + interp->dynslope.slope->dzdelta = R_LerpDouble(interp->dynslope.olddzdelta, interp->dynslope.bakdzdelta, dfrac); + } break; } } @@ -704,6 +746,10 @@ void R_RestoreLevelInterpolators(void) FV3_Copy(&interp->dynslope.slope->o, &interp->dynslope.bako); FV2_Copy(&interp->dynslope.slope->d, &interp->dynslope.bakd); interp->dynslope.slope->zdelta = interp->dynslope.bakzdelta; + + DVector3_Copy(&interp->dynslope.slope->dorigin, &interp->dynslope.bakorigin); + DVector3_Copy(&interp->dynslope.slope->dnormdir, &interp->dynslope.baknormdir); + interp->dynslope.slope->dzdelta = interp->dynslope.bakdzdelta; break; } } diff --git a/src/r_fps.h b/src/r_fps.h index cd40b0a9a..33224a83a 100644 --- a/src/r_fps.h +++ b/src/r_fps.h @@ -115,6 +115,9 @@ typedef struct levelinterpolator_s { vector3_t oldo, bako; vector2_t oldd, bakd; fixed_t oldzdelta, bakzdelta; + dvector3_t oldorigin, bakorigin; + dvector3_t oldnormdir, baknormdir; + double olddzdelta, bakdzdelta; } dynslope; }; } levelinterpolator_t; From cae93e310825a1b61ca32ed5a6e146c00ad36a66 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sat, 8 Jun 2024 13:25:28 +0200 Subject: [PATCH 131/353] Fix crash if a packet fails to reach the client --- src/netcode/i_tcp.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/netcode/i_tcp.c b/src/netcode/i_tcp.c index 6a50f440b..b9247834a 100644 --- a/src/netcode/i_tcp.c +++ b/src/netcode/i_tcp.c @@ -87,6 +87,10 @@ #undef EHOSTUNREACH #endif #define EHOSTUNREACH WSAEHOSTUNREACH + #ifdef ENETUNREACH + #undef ENETUNREACH + #endif + #define ENETUNREACH WSAENETUNREACH #ifndef IOC_VENDOR #define IOC_VENDOR 0x18000000 #endif @@ -681,7 +685,6 @@ static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr socklen_t d6 = (socklen_t)sizeof(struct sockaddr_in6); #endif socklen_t d, da = (socklen_t)sizeof(mysockaddr_t); - ssize_t status; switch (sockaddr->any.sa_family) { @@ -692,14 +695,11 @@ static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr default: d = da; break; } - status = sendto(socket, (char *)&doomcom->data, doomcom->datalength, 0, &sockaddr->any, d); - if (status == -1) - { - CONS_Alert(CONS_WARNING, "Unable to send packet to %s: %s\n", SOCK_AddrToStr(sockaddr), strerror(errno)); - } - return status; + return sendto(socket, (char *)&doomcom->data, doomcom->datalength, 0, &sockaddr->any, d); } +#define ALLOWEDERROR(x) ((x) == ECONNREFUSED || (x) == EWOULDBLOCK || (x) == EHOSTUNREACH || (x) == ENETUNREACH) + static void SOCK_Send(void) { ssize_t c = ERRSOCKET; @@ -714,19 +714,25 @@ static void SOCK_Send(void) for (size_t j = 0; j < broadcastaddresses; j++) { if (myfamily[i] == broadcastaddress[j].any.sa_family) - SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]); + { + c = SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]); + if (c == ERRSOCKET && !ALLOWEDERROR(errno)) + break; + } } } - return; } else if (nodesocket[doomcom->remotenode] == (SOCKET_TYPE)ERRSOCKET) { for (size_t i = 0; i < mysocketses; i++) { if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family) - SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]); + { + c = SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]); + if (c == ERRSOCKET && !ALLOWEDERROR(errno)) + break; + } } - return; } else { @@ -736,12 +742,14 @@ static void SOCK_Send(void) if (c == ERRSOCKET) { int e = errno; // save error code so it can't be modified later - if (e != ECONNREFUSED && e != EWOULDBLOCK && e != EHOSTUNREACH) + if (!ALLOWEDERROR(e)) I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode, SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e)); } } +#undef ALLOWEDERROR + static void SOCK_FreeNodenum(INT32 numnode) { // can't disconnect from self :) From 650f7a52a7796c485082eba7d21585daf46efb57 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 9 Jun 2024 01:54:02 -0300 Subject: [PATCH 132/353] Check if snake minigame is active before mapping joystick events --- src/snake.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/snake.c b/src/snake.c index 2349d5fdb..4219d5b8f 100644 --- a/src/snake.c +++ b/src/snake.c @@ -582,7 +582,7 @@ boolean Snake_JoyGrabber(void *opaque, event_t *ev) { snake_t *snake = opaque; - if (ev->type == ev_joystick && ev->key == 0) + if (snake != NULL && ev->type == ev_joystick && ev->key == 0) { snake->joyevents[snake->joyeventcount] = ev; snake->joyeventcount++; From 60eb9fdb447439d74b4bd6ff1e00833c40aab7a8 Mon Sep 17 00:00:00 2001 From: Blur Date: Sun, 9 Jun 2024 16:33:24 -0500 Subject: [PATCH 133/353] Prevent bots from taking slot 0 with lua. --- src/lua_baselib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 6d2c8661e..304c866c9 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -3878,7 +3878,7 @@ static int lib_gAddPlayer(lua_State *L) player_t *newplayer; SINT8 skinnum = 0, bot; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 1; i < MAXPLAYERS; i++) { if (!playeringame[i]) break; From 28dfe91b4f778a92eaed8314150e720ec297334a Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 12 Jun 2024 14:25:45 +0200 Subject: [PATCH 134/353] Per-wall lighting --- src/hardware/hw_main.c | 39 ++++++++++++++++++++----- src/lua_maplib.c | 64 ++++++++++++++++++++++++++++++++++++++++++ src/p_saveg.c | 24 +++++++++++++++- src/p_setup.c | 12 ++++++++ src/r_defs.h | 5 ++++ src/r_segs.c | 45 +++++++++++++++++++++-------- 6 files changed, 170 insertions(+), 19 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 831c8d7c4..3abcef4a3 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -309,6 +309,30 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, angle_t dir, fixed_t delta) return (FUINT)finallight; } +static FUINT HWR_SideLightLevel(side_t *side, UINT8 base_lightlevel) +{ + return side->light + + ((side->lightabsolute) ? 0 : base_lightlevel); +} + +static FUINT HWR_TopLightLevel(side_t *side, UINT8 base_lightlevel) +{ + return side->light_top + + ((side->lightabsolute_top) ? 0 : HWR_SideLightLevel(side, base_lightlevel)); +} + +static FUINT HWR_MidLightLevel(side_t *side, UINT8 base_lightlevel) +{ + return side->light_mid + + ((side->lightabsolute_mid) ? 0 : HWR_SideLightLevel(side, base_lightlevel)); +} + +static FUINT HWR_BottomLightLevel(side_t *side, UINT8 base_lightlevel) +{ + return side->light_bottom + + ((side->lightabsolute_bottom) ? 0 : HWR_SideLightLevel(side, base_lightlevel)); +} + // ========================================================================== // FLOOR/CEILING GENERATION FROM SUBSECTORS // ========================================================================== @@ -705,8 +729,9 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, fixed_t v2x = FloatToFixed(wallVerts[1].x); fixed_t v2y = FloatToFixed(wallVerts[1].z); + FUINT lightnum = HWR_SideLightLevel(gl_sidedef, sector->lightlevel); const UINT8 alpha = Surf->PolyColor.s.alpha; - FUINT lightnum = HWR_CalcWallLight(sector->lightlevel, v1x, v1y, v2x, v2y); + lightnum = HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y); extracolormap_t *colormap = NULL; if (!r_renderwalls) @@ -750,13 +775,13 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, { if (pfloor && (pfloor->fofflags & FOF_FOG)) { - lightnum = pfloor->master->frontsector->lightlevel; + lightnum = HWR_SideLightLevel(gl_sidedef, pfloor->master->frontsector->lightlevel); colormap = pfloor->master->frontsector->extra_colormap; lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y); } else { - lightnum = *list[i].lightlevel; + lightnum = HWR_SideLightLevel(gl_sidedef, *list[i].lightlevel); colormap = *list[i].extra_colormap; lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, v1x, v1y, v2x, v2y); } @@ -1167,7 +1192,7 @@ static void HWR_ProcessSeg(void) float cliplow = (float)gl_curline->offset; float cliphigh = cliplow + (gl_curline->flength * FRACUNIT); - FUINT lightnum = gl_frontsector->lightlevel; + FUINT lightnum = HWR_SideLightLevel(gl_sidedef, gl_frontsector->lightlevel); extracolormap_t *colormap = gl_frontsector->extra_colormap; lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y); @@ -1628,11 +1653,11 @@ static void HWR_ProcessSeg(void) { blendmode = PF_Fog|PF_NoTexture; - lightnum = rover->master->frontsector->lightlevel; + lightnum = HWR_SideLightLevel(gl_sidedef, rover->master->frontsector->lightlevel); colormap = rover->master->frontsector->extra_colormap; lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y); - Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); + Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(HWR_SideLightLevel(gl_sidedef, rover->master->frontsector->lightlevel), rover->master->frontsector->extra_colormap); if (gl_frontsector->numlights) HWR_SplitWall(gl_frontsector, wallVerts, 0, &Surf, rover->fofflags, rover, blendmode); @@ -1785,7 +1810,7 @@ static void HWR_ProcessSeg(void) { blendmode = PF_Fog|PF_NoTexture; - lightnum = rover->master->frontsector->lightlevel; + lightnum = HWR_SideLightLevel(gl_sidedef, rover->master->frontsector->lightlevel); colormap = rover->master->frontsector->extra_colormap; lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y); diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 6b489f22b..2afebadf4 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -213,6 +213,14 @@ enum side_e { side_sector, side_special, side_repeatcnt, + side_light, + side_light_top, + side_light_mid, + side_light_bottom, + side_lightabsolute, + side_lightabsolute_top, + side_lightabsolute_mid, + side_lightabsolute_bottom, side_text }; @@ -241,6 +249,14 @@ static const char *const side_opt[] = { "sector", "special", "repeatcnt", + "light", + "light_top", + "light_mid", + "light_bottom", + "lightabsolute", + "lightabsolute_top", + "lightabsolute_mid", + "lightabsolute_bottom", "text", NULL}; @@ -1311,6 +1327,30 @@ static int side_get(lua_State *L) case side_repeatcnt: lua_pushinteger(L, side->repeatcnt); return 1; + case side_light: + lua_pushinteger(L, side->light); + return 1; + case side_light_top: + lua_pushinteger(L, side->light_top); + return 1; + case side_light_mid: + lua_pushinteger(L, side->light_mid); + return 1; + case side_light_bottom: + lua_pushinteger(L, side->light_bottom); + return 1; + case side_lightabsolute: + lua_pushboolean(L, side->lightabsolute); + return 1; + case side_lightabsolute_top: + lua_pushboolean(L, side->lightabsolute_top); + return 1; + case side_lightabsolute_mid: + lua_pushboolean(L, side->lightabsolute_mid); + return 1; + case side_lightabsolute_bottom: + lua_pushboolean(L, side->lightabsolute_bottom); + return 1; // TODO: 2.3: Delete case side_text: { @@ -1413,6 +1453,30 @@ static int side_set(lua_State *L) case side_repeatcnt: side->repeatcnt = luaL_checkinteger(L, 3); break; + case side_light: + side->repeatcnt = luaL_checkinteger(L, 3); + break; + case side_light_top: + side->repeatcnt = luaL_checkinteger(L, 3); + break; + case side_light_mid: + side->repeatcnt = luaL_checkinteger(L, 3); + break; + case side_light_bottom: + side->repeatcnt = luaL_checkinteger(L, 3); + break; + case side_lightabsolute: + side->lightabsolute = luaL_checkboolean(L, 3); + break; + case side_lightabsolute_top: + side->lightabsolute_top = luaL_checkboolean(L, 3); + break; + case side_lightabsolute_mid: + side->lightabsolute_mid = luaL_checkboolean(L, 3); + break; + case side_lightabsolute_bottom: + side->lightabsolute_bottom = luaL_checkboolean(L, 3); + break; } return 0; } diff --git a/src/p_saveg.c b/src/p_saveg.c index 5e4d6d076..ab3552673 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -919,7 +919,11 @@ enum LD_SDMIDLIGHT = 1<<19, LD_SDBOTLIGHT = 1<<20, LD_SDREPEATCNT = 1<<21, - LD_SDFLAGS = 1<<22 + LD_SDFLAGS = 1<<22, + LD_SDLIGHTABS = 1<<23, + LD_SDTOPLIGHTABS = 1<<24, + LD_SDMIDLIGHTABS = 1<<25, + LD_SDBOTLIGHTABS = 1<<26 }; static boolean P_AreArgsEqual(const line_t *li, const line_t *spawnli) @@ -1393,6 +1397,16 @@ static UINT32 GetSideDiff(const side_t *si, const side_t *spawnsi) diff |= LD_SDBOTSCALEY; if (si->repeatcnt != spawnsi->repeatcnt) diff |= LD_SDREPEATCNT; + if (si->light != spawnsi->light) + diff |= LD_SDLIGHT; + if (si->light_top != spawnsi->light_top) + diff |= LD_SDTOPLIGHT; + if (si->light_mid != spawnsi->light_mid) + diff |= LD_SDMIDLIGHT; + if (si->light_bottom != spawnsi->light_bottom) + diff |= LD_SDBOTLIGHT; + if (si->lightabsolute != spawnsi->lightabsolute) + diff |= LD_SDLIGHTABS; return diff; } @@ -1436,6 +1450,10 @@ static void ArchiveSide(const side_t *si, UINT32 diff) WRITEFIXED(save_p, si->scaley_bottom); if (diff & LD_SDREPEATCNT) WRITEINT16(save_p, si->repeatcnt); + if (diff & LD_SDLIGHT) + WRITEINT16(save_p, si->light); + if (diff & LD_SDLIGHTABS) + WRITEINT16(save_p, si->lightabsolute); } static void ArchiveLines(void) @@ -1576,6 +1594,10 @@ static void UnArchiveSide(side_t *si) si->scaley_bottom = READFIXED(save_p); if (diff & LD_SDREPEATCNT) si->repeatcnt = READINT16(save_p); + if (diff & LD_SDLIGHT) + si->light = READINT16(save_p); + if (diff & LD_SDLIGHTABS) + si->lightabsolute = READINT16(save_p); } static void UnArchiveLines(void) diff --git a/src/p_setup.c b/src/p_setup.c index e9bd69dc5..8819d11cb 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1367,6 +1367,9 @@ static void P_LoadSidedefs(UINT8 *data) sd->scalex_top = sd->scalex_mid = sd->scalex_bottom = FRACUNIT; sd->scaley_top = sd->scaley_mid = sd->scaley_bottom = FRACUNIT; + sd->light = sd->light_top = sd->light_mid = sd->light_bottom = 0; + sd->lightabsolute = sd->lightabsolute_top = sd->lightabsolute_mid = sd->lightabsolute_bottom = false; + P_SetSidedefSector(i, (UINT16)SHORT(msd->sector)); // Special info stored in texture fields! @@ -1977,6 +1980,10 @@ static void ParseTextmapSidedefParameter(UINT32 i, const char *param, const char P_SetSidedefSector(i, atol(val)); else if (fastcmp(param, "repeatcnt")) sides[i].repeatcnt = atol(val); + else if (fastcmp(param, "light")) + sides[i].light = atol(val); + else if (fastcmp(param, "lightabsolute") && fastcmp("true", val)) + sides[i].lightabsolute = true; } static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char *val) @@ -2704,6 +2711,10 @@ static void P_WriteTextmap(void) fprintf(f, "texturemiddle = \"%.*s\";\n", 8, textures[wsides[i].midtexture]->name); if (wsides[i].repeatcnt != 0) fprintf(f, "repeatcnt = %d;\n", wsides[i].repeatcnt); + if (wsides[i].light != 0) + fprintf(f, "light = %d;\n", wsides[i].light); + if (wsides[i].lightabsolute != 0) + fprintf(f, "lightabsolute = %d;\n", wsides[i].lightabsolute); fprintf(f, "}\n"); fprintf(f, "\n"); } @@ -3106,6 +3117,7 @@ static void P_LoadTextmap(void) sd->bottomtexture = R_TextureNumForName("-"); sd->sector = NULL; sd->repeatcnt = 0; + sd->light = sd->lightabsolute = 0; TextmapParse(sidedefBlocks.pos[i], i, ParseTextmapSidedefParameter); diff --git a/src/r_defs.h b/src/r_defs.h index 54d43e824..17f94bc1b 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -631,6 +631,11 @@ typedef struct fixed_t scalex_top, scalex_mid, scalex_bottom; fixed_t scaley_top, scaley_mid, scaley_bottom; + // per-wall lighting for UDMF + // TODO: implement per-texture lighting + INT16 light, light_top, light_mid, light_bottom; + boolean lightabsolute, lightabsolute_top, lightabsolute_mid, lightabsolute_bottom; + // Texture indices. // We do not maintain names here. INT32 toptexture, bottomtexture, midtexture; diff --git a/src/r_segs.c b/src/r_segs.c index 75c95aa93..ba6e0cc0d 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -94,6 +94,30 @@ transnum_t R_GetLinedefTransTable(fixed_t alpha) return (20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1); } +static INT16 R_SideLightLevel(side_t *side, UINT8 base_lightlevel) +{ + return side->light + + ((side->lightabsolute) ? 0 : base_lightlevel); +} + +static INT16 R_TopLightLevel(side_t *side, UINT8 base_lightlevel) +{ + return side->light_top + + ((side->lightabsolute_top) ? 0 : R_SideLightLevel(side, base_lightlevel)); +} + +static INT16 R_MidLightLevel(side_t *side, UINT8 base_lightlevel) +{ + return side->light_mid + + ((side->lightabsolute_mid) ? 0 : R_SideLightLevel(side, base_lightlevel)); +} + +static INT16 R_BottomLightLevel(side_t *side, UINT8 base_lightlevel) +{ + return side->light_bottom + + ((side->lightabsolute_bottom) ? 0 : R_SideLightLevel(side, base_lightlevel)); +} + void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) { size_t pindex; @@ -223,7 +247,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) if ((colfunc != colfuncs[COLDRAWFUNC_FUZZY]) || (rlight->flags & FOF_FOG) || (rlight->extra_colormap && (rlight->extra_colormap->flags & CMF_FOG))) - lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT); + lightnum = R_SideLightLevel(curline->sidedef, rlight->lightlevel) >> LIGHTSEGSHIFT; else lightnum = LIGHTLEVELS - 1; @@ -241,7 +265,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) { if ((colfunc != colfuncs[COLDRAWFUNC_FUZZY]) || (frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG))) - lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT); + lightnum = R_SideLightLevel(curline->sidedef, frontsector->lightlevel) >> LIGHTSEGSHIFT; else lightnum = LIGHTLEVELS - 1; @@ -697,9 +721,9 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) // Check if the current light effects the colormap/lightlevel if (pfloor->fofflags & FOF_FOG) - rlight->lightnum = (pfloor->master->frontsector->lightlevel >> LIGHTSEGSHIFT); + rlight->lightnum = R_SideLightLevel(curline->sidedef, pfloor->master->frontsector->lightlevel) >> LIGHTSEGSHIFT; else - rlight->lightnum = (rlight->lightlevel >> LIGHTSEGSHIFT); + rlight->lightnum = R_SideLightLevel(curline->sidedef, rlight->lightlevel) >> LIGHTSEGSHIFT; if (pfloor->fofflags & FOF_FOG || rlight->flags & FOF_FOG || (rlight->extra_colormap && (rlight->extra_colormap->flags & CMF_FOG))) ; @@ -717,18 +741,17 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) { // Get correct light level! if ((frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG))) - lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT); + lightnum = R_SideLightLevel(curline->sidedef, frontsector->lightlevel) >> LIGHTSEGSHIFT; else if (fog) - lightnum = (pfloor->master->frontsector->lightlevel >> LIGHTSEGSHIFT); + lightnum = R_SideLightLevel(curline->sidedef, pfloor->master->frontsector->lightlevel) >> LIGHTSEGSHIFT; else if (fuzzy) lightnum = LIGHTLEVELS-1; else - lightnum = R_FakeFlat(frontsector, &tempsec, &templight, &templight, false) - ->lightlevel >> LIGHTSEGSHIFT; + lightnum = R_SideLightLevel(curline->sidedef, R_FakeFlat(frontsector, &tempsec, &templight, &templight, false)->lightlevel) >> LIGHTSEGSHIFT; if (pfloor->fofflags & FOF_FOG || (frontsector->extra_colormap && (frontsector->extra_colormap->flags & CMF_FOG))); else if (curline->v1->y == curline->v2->y) - lightnum--; + lightnum--; else if (curline->v1->x == curline->v2->x) lightnum++; @@ -1353,7 +1376,7 @@ static void R_RenderSegLoop (void) for (i = 0; i < dc_numlights; i++) { INT32 lightnum; - lightnum = (dc_lightlist[i].lightlevel >> LIGHTSEGSHIFT); + lightnum = R_SideLightLevel(curline->sidedef, dc_lightlist[i].lightlevel) >> LIGHTSEGSHIFT; if (dc_lightlist[i].extra_colormap) ; @@ -2540,7 +2563,7 @@ void R_StoreWallRange(INT32 start, INT32 stop) // use different light tables // for horizontal / vertical / diagonal // OPTIMIZE: get rid of LIGHTSEGSHIFT globally - lightnum = (frontsector->lightlevel >> LIGHTSEGSHIFT); + lightnum = R_SideLightLevel(curline->sidedef, frontsector->lightlevel) >> LIGHTSEGSHIFT; if (curline->v1->y == curline->v2->y) lightnum--; From 5302f0ce594e0ba85a5fba2c56ee47c938ebb604 Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 12 Jun 2024 14:32:20 +0200 Subject: [PATCH 135/353] Enable wall brightness in UZB config --- extras/conf/udb/Includes/SRB222_common.cfg | 2 +- extras/conf/udb/Includes/SRB222_misc.cfg | 24 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/extras/conf/udb/Includes/SRB222_common.cfg b/extras/conf/udb/Includes/SRB222_common.cfg index 90c85cdea..e5cafead4 100644 --- a/extras/conf/udb/Includes/SRB222_common.cfg +++ b/extras/conf/udb/Includes/SRB222_common.cfg @@ -115,7 +115,7 @@ mapformat_udmf // Enables setting distinct brightness for floor, ceiling, and walls distinctfloorandceilingbrightness = true; - distinctwallbrightness = false; + distinctwallbrightness = true; // Enables setting distinct brightness for upper, middle, and lower sidedef parts distinctsidedefpartbrightness = false; diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index 37b01d7dd..c37c29ce0 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -280,18 +280,18 @@ universalfields default = ""; } - //light - //{ - // type = 0; - // default = 0; - //} - // - //lightabsolute - //{ - // type = 3; - // default = false; - //} - // + light + { + type = 0; + default = 0; + } + + lightabsolute + { + type = 3; + default = false; + } + //light_top //{ // type = 0; From e7dc0506d51279674a221d8e01b51d88be57438e Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 12 Jun 2024 15:38:52 +0200 Subject: [PATCH 136/353] Fix tedious mistakes, comment out unused functions --- src/hardware/hw_main.c | 2 ++ src/lua_maplib.c | 8 ++++---- src/p_saveg.c | 34 ++++++++++++++++++++++++++++++++-- src/p_setup.c | 31 ++++++++++++++++++++++++++++--- src/r_segs.c | 2 ++ 5 files changed, 68 insertions(+), 9 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 3abcef4a3..4e651891d 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -315,6 +315,7 @@ static FUINT HWR_SideLightLevel(side_t *side, UINT8 base_lightlevel) ((side->lightabsolute) ? 0 : base_lightlevel); } +/* TODO: implement per-texture lighting static FUINT HWR_TopLightLevel(side_t *side, UINT8 base_lightlevel) { return side->light_top + @@ -332,6 +333,7 @@ static FUINT HWR_BottomLightLevel(side_t *side, UINT8 base_lightlevel) return side->light_bottom + ((side->lightabsolute_bottom) ? 0 : HWR_SideLightLevel(side, base_lightlevel)); } +*/ // ========================================================================== // FLOOR/CEILING GENERATION FROM SUBSECTORS diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 2afebadf4..9985e5631 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1454,16 +1454,16 @@ static int side_set(lua_State *L) side->repeatcnt = luaL_checkinteger(L, 3); break; case side_light: - side->repeatcnt = luaL_checkinteger(L, 3); + side->light = luaL_checkinteger(L, 3); break; case side_light_top: - side->repeatcnt = luaL_checkinteger(L, 3); + side->light_top = luaL_checkinteger(L, 3); break; case side_light_mid: - side->repeatcnt = luaL_checkinteger(L, 3); + side->light_mid = luaL_checkinteger(L, 3); break; case side_light_bottom: - side->repeatcnt = luaL_checkinteger(L, 3); + side->light_bottom = luaL_checkinteger(L, 3); break; case side_lightabsolute: side->lightabsolute = luaL_checkboolean(L, 3); diff --git a/src/p_saveg.c b/src/p_saveg.c index ab3552673..8e511e350 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1407,6 +1407,12 @@ static UINT32 GetSideDiff(const side_t *si, const side_t *spawnsi) diff |= LD_SDBOTLIGHT; if (si->lightabsolute != spawnsi->lightabsolute) diff |= LD_SDLIGHTABS; + if (si->lightabsolute_top != spawnsi->lightabsolute_top) + diff |= LD_SDTOPLIGHTABS; + if (si->lightabsolute_mid != spawnsi->lightabsolute_mid) + diff |= LD_SDMIDLIGHTABS; + if (si->lightabsolute_bottom != spawnsi->lightabsolute_bottom) + diff |= LD_SDBOTLIGHTABS; return diff; } @@ -1452,8 +1458,20 @@ static void ArchiveSide(const side_t *si, UINT32 diff) WRITEINT16(save_p, si->repeatcnt); if (diff & LD_SDLIGHT) WRITEINT16(save_p, si->light); + if (diff & LD_SDTOPLIGHT) + WRITEINT16(save_p, si->light_top); + if (diff & LD_SDMIDLIGHT) + WRITEINT16(save_p, si->light_mid); + if (diff & LD_SDBOTLIGHT) + WRITEINT16(save_p, si->light_bottom); if (diff & LD_SDLIGHTABS) - WRITEINT16(save_p, si->lightabsolute); + WRITEUINT8(save_p, si->lightabsolute); + if (diff & LD_SDTOPLIGHTABS) + WRITEUINT8(save_p, si->lightabsolute_top); + if (diff & LD_SDMIDLIGHTABS) + WRITEUINT8(save_p, si->lightabsolute_mid); + if (diff & LD_SDBOTLIGHTABS) + WRITEUINT8(save_p, si->lightabsolute_bottom); } static void ArchiveLines(void) @@ -1596,8 +1614,20 @@ static void UnArchiveSide(side_t *si) si->repeatcnt = READINT16(save_p); if (diff & LD_SDLIGHT) si->light = READINT16(save_p); + if (diff & LD_SDTOPLIGHT) + si->light_top = READINT16(save_p); + if (diff & LD_SDMIDLIGHT) + si->light_mid = READINT16(save_p); + if (diff & LD_SDBOTLIGHT) + si->light_bottom = READINT16(save_p); if (diff & LD_SDLIGHTABS) - si->lightabsolute = READINT16(save_p); + si->lightabsolute = READUINT8(save_p); + if (diff & LD_SDTOPLIGHTABS) + si->lightabsolute_top = READUINT8(save_p); + if (diff & LD_SDMIDLIGHTABS) + si->lightabsolute_mid = READUINT8(save_p); + if (diff & LD_SDBOTLIGHTABS) + si->lightabsolute_bottom = READUINT8(save_p); } static void UnArchiveLines(void) diff --git a/src/p_setup.c b/src/p_setup.c index 8819d11cb..b5ed485d8 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1982,8 +1982,20 @@ static void ParseTextmapSidedefParameter(UINT32 i, const char *param, const char sides[i].repeatcnt = atol(val); else if (fastcmp(param, "light")) sides[i].light = atol(val); + else if (fastcmp(param, "light_top")) + sides[i].light_top = atol(val); + else if (fastcmp(param, "light_mid")) + sides[i].light_mid = atol(val); + else if (fastcmp(param, "light_bottom")) + sides[i].light_bottom = atol(val); else if (fastcmp(param, "lightabsolute") && fastcmp("true", val)) sides[i].lightabsolute = true; + else if (fastcmp(param, "lightabsolute_top") && fastcmp("true", val)) + sides[i].lightabsolute_top = true; + else if (fastcmp(param, "lightabsolute_mid") && fastcmp("true", val)) + sides[i].lightabsolute_mid = true; + else if (fastcmp(param, "lightabsolute_bottom") && fastcmp("true", val)) + sides[i].lightabsolute_bottom = true; } static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char *val) @@ -2713,8 +2725,20 @@ static void P_WriteTextmap(void) fprintf(f, "repeatcnt = %d;\n", wsides[i].repeatcnt); if (wsides[i].light != 0) fprintf(f, "light = %d;\n", wsides[i].light); - if (wsides[i].lightabsolute != 0) - fprintf(f, "lightabsolute = %d;\n", wsides[i].lightabsolute); + if (wsides[i].light_top != 0) + fprintf(f, "light_top = %d;\n", wsides[i].light_top); + if (wsides[i].light_mid != 0) + fprintf(f, "light_mid = %d;\n", wsides[i].light_mid); + if (wsides[i].light_bottom != 0) + fprintf(f, "light_bottom = %d;\n", wsides[i].light_bottom); + if (wsides[i].lightabsolute) + fprintf(f, "lightabsolute = true;\n"); + if (wsides[i].lightabsolute_top) + fprintf(f, "lightabsolute_top = true;\n"); + if (wsides[i].lightabsolute_mid) + fprintf(f, "lightabsolute_mid = true;\n"); + if (wsides[i].lightabsolute_bottom) + fprintf(f, "lightabsolute_bottom = true;\n"); fprintf(f, "}\n"); fprintf(f, "\n"); } @@ -3117,7 +3141,8 @@ static void P_LoadTextmap(void) sd->bottomtexture = R_TextureNumForName("-"); sd->sector = NULL; sd->repeatcnt = 0; - sd->light = sd->lightabsolute = 0; + sd->light = sd->light_top = sd->light_mid = sd->light_bottom = 0; + sd->lightabsolute = sd->lightabsolute_top = sd->lightabsolute_mid = sd->lightabsolute_bottom = false; TextmapParse(sidedefBlocks.pos[i], i, ParseTextmapSidedefParameter); diff --git a/src/r_segs.c b/src/r_segs.c index ba6e0cc0d..51487d242 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -100,6 +100,7 @@ static INT16 R_SideLightLevel(side_t *side, UINT8 base_lightlevel) ((side->lightabsolute) ? 0 : base_lightlevel); } +/* TODO: implement per-texture lighting static INT16 R_TopLightLevel(side_t *side, UINT8 base_lightlevel) { return side->light_top + @@ -117,6 +118,7 @@ static INT16 R_BottomLightLevel(side_t *side, UINT8 base_lightlevel) return side->light_bottom + ((side->lightabsolute_bottom) ? 0 : R_SideLightLevel(side, base_lightlevel)); } +*/ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) { From 616e90e87658d386f65ef1d77d34b3ceaf417b51 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 16 Jun 2024 14:34:22 +0200 Subject: [PATCH 137/353] Allow passing player names to moderation commands --- src/netcode/d_netcmd.c | 44 ++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index f7b98c4db..5b077817f 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -2510,11 +2510,11 @@ static void MutePlayer(boolean mute) if (COM_Argc() < 2) { - CONS_Printf(M_GetText("muteplayer : mute a player\n")); + CONS_Printf(M_GetText("muteplayer : mute a player\n")); return; } - data[0] = atoi(COM_Argv(1)); + data[0] = nametonum(COM_Argv(1)); if (data[0] >= MAXPLAYERS || !playeringame[data[0]]) { CONS_Alert(CONS_NOTICE, M_GetText("There is no player %u!\n"), (unsigned int)data[0]); @@ -2603,11 +2603,11 @@ static void Command_ServerTeamChange_f(void) if (COM_Argc() < 3) { if (G_TagGametype()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "it, notit, playing, or spectator"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "it, notit, playing, or spectator"); else if (G_GametypeHasTeams()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "red, blue or spectator"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "red, blue or spectator"); else if (G_GametypeHasSpectators()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "spectator or playing"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "spectator or playing"); else CONS_Alert(CONS_NOTICE, M_GetText("This command cannot be used in this gametype.\n")); return; @@ -2655,19 +2655,19 @@ static void Command_ServerTeamChange_f(void) if (error) { if (G_TagGametype()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "it, notit, playing, or spectator"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "it, notit, playing, or spectator"); else if (G_GametypeHasTeams()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "red, blue or spectator"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "red, blue or spectator"); else if (G_GametypeHasSpectators()) - CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "spectator or playing"); + CONS_Printf(M_GetText("serverchangeteam : switch player to a new team (%s)\n"), "spectator or playing"); return; } - NetPacket.packet.playernum = atoi(COM_Argv(1)); + NetPacket.packet.playernum = nametonum(COM_Argv(1)); - if (!playeringame[NetPacket.packet.playernum]) + if (NetPacket.packet.playernum == -1 || !playeringame[NetPacket.packet.playernum]) { - CONS_Alert(CONS_NOTICE, M_GetText("There is no player %d!\n"), NetPacket.packet.playernum); + CONS_Alert(CONS_NOTICE, M_GetText("There is no player %s!\n"), COM_Argv(1)); return; } @@ -3106,13 +3106,16 @@ static void Command_Verify_f(void) if (COM_Argc() != 2) { - CONS_Printf(M_GetText("promote : give admin privileges to a player\n")); + CONS_Printf(M_GetText("promote : give admin privileges to a player\n")); return; } - strlcpy(buf, COM_Argv(1), sizeof (buf)); - - playernum = atoi(buf); + playernum = nametonum(COM_Argv(1)); + if (playernum == -1) + { + CONS_Alert(CONS_NOTICE, M_GetText("There is no player %s!\n"), COM_Argv(1)); + return; + } temp = buf; @@ -3156,13 +3159,16 @@ static void Command_RemoveAdmin_f(void) if (COM_Argc() != 2) { - CONS_Printf(M_GetText("demote : remove admin privileges from a player\n")); + CONS_Printf(M_GetText("demote : remove admin privileges from a player\n")); return; } - strlcpy(buf, COM_Argv(1), sizeof(buf)); - - playernum = atoi(buf); + playernum = nametonum(COM_Argv(1)); + if (playernum == -1) + { + CONS_Alert(CONS_NOTICE, M_GetText("There is no player %s!\n"), COM_Argv(1)); + return; + } temp = buf; From 0846024adcbee7e5e34ade11f043ea7cca747802 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 16 Jun 2024 15:00:51 +0200 Subject: [PATCH 138/353] Add CVar for changing room ID --- src/d_main.c | 2 +- src/m_menu.c | 4 ++-- src/netcode/mserv.c | 16 +++++++++++++++- src/netcode/mserv.h | 1 + 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 3a3a0b26a..9935dcaa1 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1600,7 +1600,7 @@ void D_SRB2Main(void) { if (!M_IsNextParm()) I_Error("usage: -room \nCheck the Master Server's webpage for room ID numbers.\n"); - ms_RoomId = atoi(M_GetNextParm()); + CV_SetValue(&cv_masterserver_room_id, atoi(M_GetNextParm())); #ifdef UPDATE_ALERT GetMODVersion_Console(); diff --git a/src/m_menu.c b/src/m_menu.c index 38165472e..d3df61b65 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -11524,10 +11524,10 @@ static void M_ChooseRoom(INT32 choice) #endif if (choice == 0) - ms_RoomId = -1; + CV_SetValue(&cv_masterserver_room_id, 0); else { - ms_RoomId = roomIds[choice-1]; + CV_SetValue(&cv_masterserver_room_id, roomIds[choice-1]); menuRoomIndex = choice - 1; } diff --git a/src/netcode/mserv.c b/src/netcode/mserv.c index 74ee120f9..db0f640d7 100644 --- a/src/netcode/mserv.c +++ b/src/netcode/mserv.c @@ -55,6 +55,7 @@ static boolean ServerName_CanChange (const char*); static void Update_parameters (void); static void MasterServer_OnChange(void); +static void RoomId_OnChange(void); static CV_PossibleValue_t masterserver_update_rate_cons_t[] = { {2, "MIN"}, @@ -66,8 +67,9 @@ consvar_t cv_masterserver = CVAR_INIT ("masterserver", "https://ds.ms.srb2.org/M consvar_t cv_servername = CVAR_INIT_WITH_CALLBACKS ("servername", "SRB2 server", CV_SAVE|CV_NETVAR|CV_CALL|CV_NOINIT|CV_ALLOWLUA, NULL, Update_parameters, ServerName_CanChange); consvar_t cv_masterserver_update_rate = CVAR_INIT ("masterserver_update_rate", "15", CV_SAVE|CV_CALL|CV_NOINIT, masterserver_update_rate_cons_t, Update_parameters); +consvar_t cv_masterserver_room_id = CVAR_INIT ("masterserver_room_id", "0", CV_CALL, CV_Unsigned, RoomId_OnChange); -INT16 ms_RoomId = -1; +INT16 ms_RoomId = 0; #if defined (MASTERSERVER) && defined (HAVE_THREADS) int ms_QueryId; @@ -92,6 +94,7 @@ void AddMServCommands(void) { CV_RegisterVar(&cv_masterserver); CV_RegisterVar(&cv_masterserver_update_rate); + CV_RegisterVar(&cv_masterserver_room_id); CV_RegisterVar(&cv_masterserver_timeout); CV_RegisterVar(&cv_masterserver_debug); CV_RegisterVar(&cv_masterserver_token); @@ -534,6 +537,17 @@ Update_parameters (void) #endif/*MASTERSERVER*/ } +static void RoomId_OnChange(void) +{ + if (ms_RoomId != cv_masterserver_room_id.value) + { + UnregisterServer(); + ms_RoomId = cv_masterserver_room_id.value; + if (Online()) + RegisterServer(); + } +} + static void MasterServer_OnChange(void) { #ifdef MASTERSERVER diff --git a/src/netcode/mserv.h b/src/netcode/mserv.h index 0bc8c8e6b..419c11a89 100644 --- a/src/netcode/mserv.h +++ b/src/netcode/mserv.h @@ -66,6 +66,7 @@ typedef struct extern consvar_t cv_masterserver, cv_servername; extern consvar_t cv_masterserver_update_rate; +extern consvar_t cv_masterserver_room_id; extern consvar_t cv_masterserver_timeout; extern consvar_t cv_masterserver_debug; extern consvar_t cv_masterserver_token; From 7cd96a6b2ea836ccfb71a5d521982ed4db7db085 Mon Sep 17 00:00:00 2001 From: StarManiaKG Date: Tue, 18 Jun 2024 17:07:19 -0400 Subject: [PATCH 139/353] Add actual multiplayer automap support --- src/am_map.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/am_map.c b/src/am_map.c index df3a45cff..36b62f2f9 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -1076,6 +1076,9 @@ static inline void AM_drawPlayers(void) if (!playeringame[i] || players[i].spectator) continue; + if (!players[i].mo) + continue; + p = &players[i]; if (p->skincolor > 0) color = R_GetTranslationColormap(TC_DEFAULT, p->skincolor, GTC_CACHE)[GREENS + 8]; From 926487eb8f58e14807b7e25cf7d13e09365101a1 Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 19 Jun 2024 10:22:26 +0200 Subject: [PATCH 140/353] Add light and lightabsolute to UDMF specification --- doc/specs/udmf_srb2.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/specs/udmf_srb2.txt b/doc/specs/udmf_srb2.txt index d6d71a0d5..eaa3a8a97 100644 --- a/doc/specs/udmf_srb2.txt +++ b/doc/specs/udmf_srb2.txt @@ -1,5 +1,5 @@ =============================================================================== -Universal Doom Map Format Sonic Robo Blast 2 extensions v1.0 19.02.2024 +Universal Doom Map Format Sonic Robo Blast 2 extensions v1.0 19.06.2024 Copyright (c) 2024 Sonic Team Junior uses Universal Doom Map Format Specification v1.1 as a template, @@ -143,6 +143,9 @@ Sonic Robo Blast 2 defines the following standardized fields: offsetx_bottom = ; // X offset for lower texture. Default = 0.0. offsety_bottom = ; // Y offset for lower texture. Default = 0.0. + light = ; // Light level, relative to 'sector' light level. Default = 0. + lightabsolute = ; // true = 'light' is an absolute value, ignoring 'sector' light level. + comment = ; // A comment. Implementors should attach no special // semantic meaning to this field. } From 4f33b71ef1992b3e5f2261103a74a21a184ba096 Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 24 Jun 2024 21:48:36 +0200 Subject: [PATCH 141/353] Fix FOF side transparency/blending in Software --- src/r_segs.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 8e9368baf..303de8880 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1004,25 +1004,21 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) { dc_iscale = 0xffffffffu / (unsigned)spryscale; - // Skip if texture is multipatch - if (textures[texnum]->transparency) + // Column has a single post and it matches the texture height, use regular column drawers + if (col->num_posts == 1 && col->posts[0].topdelta == 0 && col->posts[0].length == (unsigned)dc_texheight) { - // Column has a single post and it matches the texture height, use regular column drawers - if (col->num_posts == 1 && col->posts[0].topdelta == 0 && col->posts[0].length == (unsigned)dc_texheight) - { - if (fuzzy) - colfunc = colfuncs[COLDRAWFUNC_FUZZY]; - else - colfunc = colfuncs[BASEDRAWFUNC]; - } + if (fuzzy) + colfunc = colfuncs[COLDRAWFUNC_FUZZY]; else - { - // Otherwise use column drawers with extra checks - if (fuzzy) - colfunc = colfuncs[COLDRAWFUNC_CLAMPEDTRANS]; - else - colfunc = colfuncs[COLDRAWFUNC_CLAMPED]; - } + colfunc = colfuncs[BASEDRAWFUNC]; + } + else + { + // Otherwise use column drawers with extra checks + if (fuzzy) + colfunc = colfuncs[COLDRAWFUNC_CLAMPEDTRANS]; + else + colfunc = colfuncs[COLDRAWFUNC_CLAMPED]; } } From d47a95e9ba4cfbd51f8011a99ba25cbee9513093 Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 24 Jun 2024 23:51:03 +0200 Subject: [PATCH 142/353] Fix #1230 --- src/p_user.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index ff7c02bcc..ea68f9443 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -976,6 +976,9 @@ pflags_t P_GetJumpFlags(player_t *player) // boolean P_PlayerInPain(player_t *player) { + if (P_MobjWasRemoved(player->mo)) + return false; + // no silly, sliding isn't pain if (!(player->pflags & PF_SLIDING) && player->mo->state == &states[player->mo->info->painstate] && player->powers[pw_flashing]) return true; From 2eebd4df29f41e2d26eab772b94fbc97fb08678c Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 24 Jun 2024 23:51:47 +0200 Subject: [PATCH 143/353] Fix #1146 --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index c4fccb372..7d4049df2 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8610,7 +8610,7 @@ static void M_DrawLoadGameData(void) if (savegameinfo[savetodraw].lives == -42) col = 26; else if (savegameinfo[savetodraw].botskin == 3) // & knuckles - col = 105; + col = 106; else if (savegameinfo[savetodraw].botskin) // tailsbot or custom col = 134; else From e0f666d30bacc1f362857a63fcedf4b3d2ca8aa1 Mon Sep 17 00:00:00 2001 From: Henry3230 <2703436416@qq.com> Date: Mon, 24 Jun 2024 22:28:16 +0000 Subject: [PATCH 144/353] MobjDamage hook tweaks for special stages --- src/p_inter.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_inter.c b/src/p_inter.c index e73cd1fce..cbd56183d 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3786,6 +3786,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (player->powers[pw_carry] == CR_NIGHTSMODE) // NiGHTS damage handling { + if (player->powers[pw_flashing]) + return false; if (!force) { if (source == target) @@ -3803,6 +3805,10 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (G_IsSpecialStage(gamemap) && !(damagetype & DMG_DEATHMASK)) { + if (player->powers[pw_flashing]) + return false; + if (LUA_HookMobjDamage(target, inflictor, source, damage, damagetype)) + return true; P_SpecialStageDamage(player, inflictor, source); return true; } From 90195e61052094e9319a16ac06d7656e0f9a75be Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 20 May 2024 17:55:33 -0400 Subject: [PATCH 145/353] W_GetTexPatchLumpNum uses W_CheckNumForPatchName Absolutely never allow a flat --- src/r_textures.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_textures.c b/src/r_textures.c index 6e01d5641..b61ddb86f 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -1179,7 +1179,7 @@ static lumpnum_t W_GetTexPatchLumpNum(const char *name) if (lump == LUMPERROR) { // Use whatever else you can find. - return W_GetNumForName(name); + return W_CheckNumForPatchName(name); } return lump; From a78b957ceb41be93059a24e9a21b23810d100c7d Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Wed, 22 May 2024 01:32:21 -0400 Subject: [PATCH 146/353] -warp/+map is not a cheat for dedicated servers It already is not a cheat for listen servers. Fixes dedicated servers not being able to save. --- src/d_main.c | 2 +- src/m_cond.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/d_main.c b/src/d_main.c index 3a3a0b26a..bad78c530 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1535,7 +1535,7 @@ void D_SRB2Main(void) I_Error("Cannot find a map remotely named '%s'\n", word); else { - if (!M_CheckParm("-server")) + if (!(M_CheckParm("-server") || dedicated)) G_SetUsedCheats(true); autostart = true; } diff --git a/src/m_cond.c b/src/m_cond.c index 5a5913297..fa6cda223 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -494,6 +494,12 @@ UINT8 M_MapLocked(INT32 mapnum, gamedata_t *data) UINT8 M_CampaignWarpIsCheat(INT32 gt, INT32 mapnum, gamedata_t *data) { + if (dedicated) + { + // See M_MapLocked; don't make dedicated servers annoying. + return false; + } + if (M_MapLocked(mapnum, data) == true) { // Warping to locked maps is definitely always a cheat From cd5a6ddeb417c015046fefc2122a3c9b232392a9 Mon Sep 17 00:00:00 2001 From: sphere Date: Tue, 25 Jun 2024 12:17:40 +0000 Subject: [PATCH 147/353] Revert "Merge branch 'quick-intro' into 'next'" This reverts merge request !2132 --- src/d_main.c | 6 ++---- src/f_finale.c | 12 ++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index e287d5c38..bad78c530 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -298,8 +298,8 @@ void D_ProcessEvents(void) // added comment : there is a wipe eatch change of the gamestate gamestate_t wipegamestate = GS_LEVEL; // -1: Default; 0-n: Wipe index; INT16_MAX: do not wipe -INT16 wipetypepre = INT16_MAX; -INT16 wipetypepost = INT16_MAX; +INT16 wipetypepre = -1; +INT16 wipetypepost = -1; static void D_Display(void) { @@ -749,8 +749,6 @@ void D_SRB2Loop(void) // hack to start on a nice clear console screen. COM_ImmedExecute("cls;version"); - // hack to prevent white flash upon initial window resize - V_DrawFill(0,0,BASEVIDWIDTH,BASEVIDHEIGHT,31); I_FinishUpdate(); // page flip or blit buffer /* diff --git a/src/f_finale.c b/src/f_finale.c index 5fb901e0d..810af4e82 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -313,7 +313,7 @@ const char *introtext[NUMINTROSCENES]; static tic_t introscenetime[NUMINTROSCENES] = { - 6*TICRATE, // STJr Presents + 5*TICRATE, // STJr Presents 10*TICRATE + (TICRATE/2), // Two months had passed since... 12*TICRATE + ((TICRATE/4) * 3), // As it was about to drain the rings... 12*TICRATE + (TICRATE/4), // What Sonic, Tails, and Knuckles... @@ -623,15 +623,15 @@ void F_IntroDrawer(void) { V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); - if (intro_curtime > TICRATE-17 && intro_curtime < 2*TICRATE-22) // Make the text shine! + if (intro_curtime < TICRATE-5) // Make the text shine! { - sprintf(stjrintro, "STJRI%03u", intro_curtime-19); + sprintf(stjrintro, "STJRI%03u", intro_curtime-1); } - else if (intro_curtime >= 2*TICRATE-23 && intro_curtime < 2*TICRATE-3) // Pause on black screen for just a second + else if (intro_curtime >= TICRATE-6 && intro_curtime < 2*TICRATE-20) // Pause on black screen for just a second { return; } - else if (intro_curtime == 2*TICRATE-2) + else if (intro_curtime == 2*TICRATE-19) { // Fade in the text // The text fade out is automatically handled when switching to a new intro scene @@ -950,7 +950,7 @@ void F_IntroTicker(void) if (rendermode != render_none) { - if (intro_scenenum == 0 && intro_curtime == 2*TICRATE-2) + if (intro_scenenum == 0 && intro_curtime == 2*TICRATE-19) { S_ChangeMusicInternal("_stjr", false); From be1a9e3f5dc73de04f1ba8f3608059627b62337a Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 24 Jun 2024 14:52:51 +0200 Subject: [PATCH 148/353] Update asset hashes for 2.2.14 --- src/config.h.in | 5 +++-- src/doomdef.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index 6d49a6989..1148cab2c 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -40,9 +40,10 @@ * Last updated 2023 / 05 / 02 - v2.2.11 - patch.pk3 & zones.pk3 * Last updated 2023 / 09 / 06 - v2.2.12 - patch.pk3 * Last updated 2023 / 09 / 09 - v2.2.13 - none + * Last updated 2024 / 06 / 24 - v2.2.14 - main assets */ -#define ASSET_HASH_SRB2_PK3 "ad911f29a28a18968ee5b2d11c2acb39" -#define ASSET_HASH_ZONES_PK3 "1c8adf8d079ecb87d00081f158acf3c7" +#define ASSET_HASH_SRB2_PK3 "9b8cf9510c56d442616086ca65ff93a7" +#define ASSET_HASH_ZONES_PK3 "b7db0245434ca3ad61935ee36403e966" #define ASSET_HASH_PLAYER_DTA "2e7aaae8a6b1b77d90ffe7606ceadb6c" #ifdef USE_PATCH_DTA #define ASSET_HASH_PATCH_PK3 "3c7b73f34af7e9a7bceb2d5260f76172" diff --git a/src/doomdef.h b/src/doomdef.h index 1b0e76314..aeae908da 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -168,7 +168,7 @@ extern char logfilename[1024]; // Does this version require an added patch file? // Comment or uncomment this as necessary. -#define USE_PATCH_DTA +//#define USE_PATCH_DTA // Enforce a limit of loaded WAD files. //#define ENFORCE_WAD_LIMIT From f822fd71341d168ea199d1e8742837fd7d728245 Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 25 Jun 2024 17:23:05 +0200 Subject: [PATCH 149/353] Enable OpenGL palette rendering by default --- src/hardware/hw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 1ca288932..0e452ca48 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5698,7 +5698,7 @@ consvar_t cv_glbatching = CVAR_INIT ("gr_batching", "On", 0, CV_OnOff, NULL); static CV_PossibleValue_t glpalettedepth_cons_t[] = {{16, "16 bits"}, {24, "24 bits"}, {0, NULL}}; -consvar_t cv_glpaletterendering = CVAR_INIT ("gr_paletterendering", "Off", CV_SAVE|CV_CALL, CV_OnOff, CV_glpaletterendering_OnChange); +consvar_t cv_glpaletterendering = CVAR_INIT ("gr_paletterendering", "On", CV_SAVE|CV_CALL, CV_OnOff, CV_glpaletterendering_OnChange); consvar_t cv_glpalettedepth = CVAR_INIT ("gr_palettedepth", "16 bits", CV_SAVE|CV_CALL, glpalettedepth_cons_t, CV_glpalettedepth_OnChange); #define ONLY_IF_GL_LOADED if (vid.glstate != VID_GL_LIBRARY_LOADED) return; From 6f2d6e6b067b32498dde1cc8a0e23177123f4822 Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 25 Jun 2024 22:29:40 +0200 Subject: [PATCH 150/353] Support floor/ceiling light level on FOF planes --- src/hardware/hw_main.c | 30 ++++++++++++++++++++++-------- src/r_bsp.c | 27 +++++++++++++++++++-------- 2 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 1ca288932..e9f791947 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -335,6 +335,17 @@ static FUINT HWR_BottomLightLevel(side_t *side, UINT8 base_lightlevel) } */ +static UINT8 HWR_FloorLightLevel(sector_t *sector, INT16 base_lightlevel) +{ + return max(0, min(255, sector->floorlightlevel + + ((sector->floorlightabsolute) ? 0 : base_lightlevel))); +} + +static UINT8 HWR_CeilingLightLevel(sector_t *sector, INT16 base_lightlevel) +{ + return max(0, min(255, sector->ceilinglightlevel + + ((sector->ceilinglightabsolute) ? 0 : base_lightlevel))); +} // ========================================================================== // FLOOR/CEILING GENERATION FROM SUBSECTORS // ========================================================================== @@ -2469,6 +2480,9 @@ static void HWR_Subsector(size_t num) rover; rover = rover->next) { fixed_t bottomCullHeight, topCullHeight, centerHeight; + + INT16 floorlight = HWR_FloorLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel); + INT16 ceilinglight = HWR_CeilingLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel); if (!(rover->fofflags & FOF_EXISTS) || !(rover->fofflags & FOF_RENDERPLANES)) continue; @@ -2498,13 +2512,13 @@ static void HWR_Subsector(size_t num) UINT8 alpha; light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false); - alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap); + alpha = HWR_FogBlockAlpha(floorlight, rover->master->frontsector->extra_colormap); HWR_AddTransparentFloor(0, &extrasubsectors[num], false, *rover->bottomheight, - *gl_frontsector->lightlist[light].lightlevel, + floorlight, alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, false, rover->master->frontsector->extra_colormap); } @@ -2516,7 +2530,7 @@ static void HWR_Subsector(size_t num) &extrasubsectors[num], false, *rover->bottomheight, - *gl_frontsector->lightlist[light].lightlevel, + floorlight, max(0, min(rover->alpha, 255)), rover->master->frontsector, HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent), false, rover->fofflags & FOF_SPLAT, *gl_frontsector->lightlist[light].extra_colormap); @@ -2525,7 +2539,7 @@ static void HWR_Subsector(size_t num) { HWR_GetLevelFlat(&levelflats[*rover->bottompic], rover->fofflags & FOF_SPLAT); light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false); - HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->bottompic], + HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, floorlight, &levelflats[*rover->bottompic], rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); } } @@ -2543,13 +2557,13 @@ static void HWR_Subsector(size_t num) UINT8 alpha; light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false); - alpha = HWR_FogBlockAlpha(*gl_frontsector->lightlist[light].lightlevel, rover->master->frontsector->extra_colormap); + alpha = HWR_FogBlockAlpha(ceilinglight, rover->master->frontsector->extra_colormap); HWR_AddTransparentFloor(0, &extrasubsectors[num], true, *rover->topheight, - *gl_frontsector->lightlist[light].lightlevel, + ceilinglight, alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, false, rover->master->frontsector->extra_colormap); } @@ -2561,7 +2575,7 @@ static void HWR_Subsector(size_t num) &extrasubsectors[num], true, *rover->topheight, - *gl_frontsector->lightlist[light].lightlevel, + ceilinglight, max(0, min(rover->alpha, 255)), rover->master->frontsector, HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent), false, rover->fofflags & FOF_SPLAT, *gl_frontsector->lightlist[light].extra_colormap); @@ -2570,7 +2584,7 @@ static void HWR_Subsector(size_t num) { HWR_GetLevelFlat(&levelflats[*rover->toppic], rover->fofflags & FOF_SPLAT); light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false); - HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, *gl_frontsector->lightlist[light].lightlevel, &levelflats[*rover->toppic], + HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, ceilinglight, &levelflats[*rover->toppic], rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); } } diff --git a/src/r_bsp.c b/src/r_bsp.c index d606d7a27..373a170c9 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -230,6 +230,18 @@ static INT32 R_DoorClosed(void) && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture); } +static UINT8 R_FloorLightLevel(sector_t *sector, INT16 base_lightlevel) +{ + return max(0, min(255, sector->floorlightlevel + + ((sector->floorlightabsolute) ? 0 : base_lightlevel))); +} + +static UINT8 R_CeilingLightLevel(sector_t *sector, INT16 base_lightlevel) +{ + return max(0, min(255, sector->ceilinglightlevel + + ((sector->ceilinglightabsolute) ? 0 : base_lightlevel))); +} + // // If player's view height is underneath fake floor, lower the // drawn ceiling to be just under the floor height, and replace @@ -312,11 +324,11 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, tempsec->lightlevel = s->lightlevel; if (floorlightlevel) - *floorlightlevel = s->floorlightsec == -1 ? (s->floorlightabsolute ? s->floorlightlevel : max(0, min(255, s->lightlevel + s->floorlightlevel))) + *floorlightlevel = s->floorlightsec == -1 ? (s->floorlightabsolute ? s->floorlightlevel : max(0, min(255, s->lightlevel + s->floorlightlevel))) : sectors[s->floorlightsec].lightlevel; if (ceilinglightlevel) - *ceilinglightlevel = s->ceilinglightsec == -1 ? (s->ceilinglightabsolute ? s->ceilinglightlevel : max(0, min(255, s->lightlevel + s->ceilinglightlevel))) + *ceilinglightlevel = s->ceilinglightsec == -1 ? (s->ceilinglightabsolute ? s->ceilinglightlevel : max(0, min(255, s->lightlevel + s->ceilinglightlevel))) : sectors[s->ceilinglightsec].lightlevel; } else if (heightsec != -1 && viewz >= sectors[heightsec].ceilingheight @@ -356,11 +368,11 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel, tempsec->lightlevel = s->lightlevel; if (floorlightlevel) - *floorlightlevel = s->floorlightsec == -1 ? (s->floorlightabsolute ? s->floorlightlevel : max(0, min(255, s->lightlevel + s->floorlightlevel))) + *floorlightlevel = s->floorlightsec == -1 ? (s->floorlightabsolute ? s->floorlightlevel : max(0, min(255, s->lightlevel + s->floorlightlevel))) : sectors[s->floorlightsec].lightlevel; if (ceilinglightlevel) - *ceilinglightlevel = s->ceilinglightsec == -1 ? (s->ceilinglightabsolute ? s->ceilinglightlevel : max(0, min(255, s->lightlevel + s->ceilinglightlevel))) + *ceilinglightlevel = s->ceilinglightsec == -1 ? (s->ceilinglightabsolute ? s->ceilinglightlevel : max(0, min(255, s->lightlevel + s->ceilinglightlevel))) : sectors[s->ceilinglightsec].lightlevel; } sec = tempsec; @@ -968,11 +980,10 @@ static void R_Subsector(size_t num) && ((viewz < heightcheck && (rover->fofflags & FOF_BOTHPLANES || !(rover->fofflags & FOF_INVERTPLANES))) || (viewz > heightcheck && (rover->fofflags & FOF_BOTHPLANES || rover->fofflags & FOF_INVERTPLANES)))) { - light = R_GetPlaneLight(frontsector, planecenterz, - viewz < heightcheck); + light = R_GetPlaneLight(frontsector, planecenterz, viewz < heightcheck); ffloor[numffloors].plane = R_FindPlane(rover->master->frontsector, *rover->bottomheight, *rover->bottompic, - *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, *rover->bottomyoffs, + R_FloorLightLevel(rover->master->frontsector, *frontsector->lightlist[light].lightlevel), *rover->bottomxoffs, *rover->bottomyoffs, *rover->bottomxscale, *rover->bottomyscale, *rover->bottomangle, *frontsector->lightlist[light].extra_colormap, rover, NULL, *rover->b_slope, NULL); @@ -1002,7 +1013,7 @@ static void R_Subsector(size_t num) light = R_GetPlaneLight(frontsector, planecenterz, viewz < heightcheck); ffloor[numffloors].plane = R_FindPlane(rover->master->frontsector, *rover->topheight, *rover->toppic, - *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, + R_CeilingLightLevel(rover->master->frontsector, *frontsector->lightlist[light].lightlevel), *rover->topxoffs, *rover->topyoffs, *rover->topxscale, *rover->topyscale, *rover->topangle, *frontsector->lightlist[light].extra_colormap, rover, NULL, *rover->t_slope, NULL); From 12e5c3b9ce45dea5a823224fe0ecc7a4c2a14c61 Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 26 Jun 2024 13:31:15 +0200 Subject: [PATCH 151/353] Fix incorrect light level usage on overlapping FOFs in OpenGL --- src/hardware/hw_main.c | 29 ++++++++++++++--------------- src/r_bsp.c | 4 ++-- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index e9f791947..0ac0c2e7c 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -335,13 +335,13 @@ static FUINT HWR_BottomLightLevel(side_t *side, UINT8 base_lightlevel) } */ -static UINT8 HWR_FloorLightLevel(sector_t *sector, INT16 base_lightlevel) +static UINT8 HWR_FloorLightLevel(sector_t *sector, UINT8 base_lightlevel) { return max(0, min(255, sector->floorlightlevel + ((sector->floorlightabsolute) ? 0 : base_lightlevel))); } -static UINT8 HWR_CeilingLightLevel(sector_t *sector, INT16 base_lightlevel) +static UINT8 HWR_CeilingLightLevel(sector_t *sector, UINT8 base_lightlevel) { return max(0, min(255, sector->ceilinglightlevel + ((sector->ceilinglightabsolute) ? 0 : base_lightlevel))); @@ -2481,9 +2481,6 @@ static void HWR_Subsector(size_t num) { fixed_t bottomCullHeight, topCullHeight, centerHeight; - INT16 floorlight = HWR_FloorLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel); - INT16 ceilinglight = HWR_CeilingLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel); - if (!(rover->fofflags & FOF_EXISTS) || !(rover->fofflags & FOF_RENDERPLANES)) continue; if (sub->validcount == validcount) @@ -2512,13 +2509,13 @@ static void HWR_Subsector(size_t num) UINT8 alpha; light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false); - alpha = HWR_FogBlockAlpha(floorlight, rover->master->frontsector->extra_colormap); + alpha = HWR_FogBlockAlpha(HWR_FloorLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel), rover->master->frontsector->extra_colormap); HWR_AddTransparentFloor(0, &extrasubsectors[num], false, *rover->bottomheight, - floorlight, + HWR_FloorLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel), alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, false, rover->master->frontsector->extra_colormap); } @@ -2530,7 +2527,7 @@ static void HWR_Subsector(size_t num) &extrasubsectors[num], false, *rover->bottomheight, - floorlight, + HWR_FloorLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel), max(0, min(rover->alpha, 255)), rover->master->frontsector, HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent), false, rover->fofflags & FOF_SPLAT, *gl_frontsector->lightlist[light].extra_colormap); @@ -2539,8 +2536,9 @@ static void HWR_Subsector(size_t num) { HWR_GetLevelFlat(&levelflats[*rover->bottompic], rover->fofflags & FOF_SPLAT); light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false); - HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, floorlight, &levelflats[*rover->bottompic], - rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); + HWR_RenderPlane(sub, &extrasubsectors[num], false, *rover->bottomheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, + HWR_FloorLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel), + &levelflats[*rover->bottompic], rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); } } @@ -2557,13 +2555,13 @@ static void HWR_Subsector(size_t num) UINT8 alpha; light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false); - alpha = HWR_FogBlockAlpha(ceilinglight, rover->master->frontsector->extra_colormap); + alpha = HWR_FogBlockAlpha(HWR_CeilingLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel), rover->master->frontsector->extra_colormap); HWR_AddTransparentFloor(0, &extrasubsectors[num], true, *rover->topheight, - ceilinglight, + HWR_CeilingLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel), alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, false, rover->master->frontsector->extra_colormap); } @@ -2575,7 +2573,7 @@ static void HWR_Subsector(size_t num) &extrasubsectors[num], true, *rover->topheight, - ceilinglight, + HWR_CeilingLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel), max(0, min(rover->alpha, 255)), rover->master->frontsector, HWR_RippleBlend(gl_frontsector, rover, false) | (rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent), false, rover->fofflags & FOF_SPLAT, *gl_frontsector->lightlist[light].extra_colormap); @@ -2584,8 +2582,9 @@ static void HWR_Subsector(size_t num) { HWR_GetLevelFlat(&levelflats[*rover->toppic], rover->fofflags & FOF_SPLAT); light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false); - HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, ceilinglight, &levelflats[*rover->toppic], - rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); + HWR_RenderPlane(sub, &extrasubsectors[num], true, *rover->topheight, HWR_RippleBlend(gl_frontsector, rover, false)|PF_Occlude, + HWR_CeilingLightLevel(rover->master->frontsector, *gl_frontsector->lightlist[light].lightlevel), + &levelflats[*rover->toppic], rover->master->frontsector, 255, *gl_frontsector->lightlist[light].extra_colormap); } } } diff --git a/src/r_bsp.c b/src/r_bsp.c index 373a170c9..4b4c81b88 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -230,13 +230,13 @@ static INT32 R_DoorClosed(void) && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture); } -static UINT8 R_FloorLightLevel(sector_t *sector, INT16 base_lightlevel) +static UINT8 R_FloorLightLevel(sector_t *sector, UINT8 base_lightlevel) { return max(0, min(255, sector->floorlightlevel + ((sector->floorlightabsolute) ? 0 : base_lightlevel))); } -static UINT8 R_CeilingLightLevel(sector_t *sector, INT16 base_lightlevel) +static UINT8 R_CeilingLightLevel(sector_t *sector, UINT8 base_lightlevel) { return max(0, min(255, sector->ceilinglightlevel + ((sector->ceilinglightabsolute) ? 0 : base_lightlevel))); From 556ddcaa584565e8dd5a542af8392ecf33f1847c Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 26 Jun 2024 13:47:09 +0200 Subject: [PATCH 152/353] Make OpenGL transparent plane brightness consistent with Software again --- src/hardware/hw_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 0ac0c2e7c..7647084c4 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3946,7 +3946,7 @@ void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boo planeinfo[numplanes].isceiling = isceiling; planeinfo[numplanes].fixedheight = fixedheight; - planeinfo[numplanes].lightlevel = (planecolormap && (planecolormap->flags & CMF_FOG)) ? 255 : lightlevel; + planeinfo[numplanes].lightlevel = (planecolormap && (planecolormap->flags & CMF_FOG)) ? lightlevel : 255; planeinfo[numplanes].levelflat = levelflat; planeinfo[numplanes].xsub = xsub; planeinfo[numplanes].alpha = alpha; @@ -3978,7 +3978,7 @@ void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polyse polyplaneinfo[numpolyplanes].isceiling = isceiling; polyplaneinfo[numpolyplanes].fixedheight = fixedheight; - polyplaneinfo[numpolyplanes].lightlevel = (planecolormap && (planecolormap->flags & CMF_FOG)) ? 255 : lightlevel; + polyplaneinfo[numpolyplanes].lightlevel = (planecolormap && (planecolormap->flags & CMF_FOG)) ? lightlevel : 255; polyplaneinfo[numpolyplanes].levelflat = levelflat; polyplaneinfo[numpolyplanes].polysector = polysector; polyplaneinfo[numpolyplanes].alpha = alpha; From 66b5de4c01b584d75b25394f40e9e2ce0962ef8a Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 26 Jun 2024 16:27:58 +0200 Subject: [PATCH 153/353] Add TODO comments for future changes --- src/hardware/hw_main.c | 4 ++-- src/r_plane.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 7647084c4..c70b6dd01 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3946,7 +3946,7 @@ void HWR_AddTransparentFloor(levelflat_t *levelflat, extrasubsector_t *xsub, boo planeinfo[numplanes].isceiling = isceiling; planeinfo[numplanes].fixedheight = fixedheight; - planeinfo[numplanes].lightlevel = (planecolormap && (planecolormap->flags & CMF_FOG)) ? lightlevel : 255; + planeinfo[numplanes].lightlevel = (planecolormap && (planecolormap->flags & CMF_FOG)) ? lightlevel : 255; // TODO: 2.3: Make transparent FOF planes always use light level planeinfo[numplanes].levelflat = levelflat; planeinfo[numplanes].xsub = xsub; planeinfo[numplanes].alpha = alpha; @@ -3978,7 +3978,7 @@ void HWR_AddTransparentPolyobjectFloor(levelflat_t *levelflat, polyobj_t *polyse polyplaneinfo[numpolyplanes].isceiling = isceiling; polyplaneinfo[numpolyplanes].fixedheight = fixedheight; - polyplaneinfo[numpolyplanes].lightlevel = (planecolormap && (planecolormap->flags & CMF_FOG)) ? lightlevel : 255; + polyplaneinfo[numpolyplanes].lightlevel = (planecolormap && (planecolormap->flags & CMF_FOG)) ? lightlevel : 255; // TODO: 2.3: Make transparent polyobject planes always use light level polyplaneinfo[numpolyplanes].levelflat = levelflat; polyplaneinfo[numpolyplanes].polysector = polysector; polyplaneinfo[numpolyplanes].alpha = alpha; diff --git a/src/r_plane.c b/src/r_plane.c index 33e3aac13..04272f8d3 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -910,7 +910,7 @@ void R_DrawSinglePlane(visplane_t *pl) if (pl->polyobj->translucency == 0 || (pl->extra_colormap && (pl->extra_colormap->flags & CMF_FOG))) light = (pl->lightlevel >> LIGHTSEGSHIFT); - else + else // TODO: 2.3: Make transparent polyobject planes always use light level light = LIGHTLEVELS-1; } else @@ -952,7 +952,7 @@ void R_DrawSinglePlane(visplane_t *pl) if ((spanfunctype == SPANDRAWFUNC_SPLAT) || (pl->extra_colormap && (pl->extra_colormap->flags & CMF_FOG))) light = (pl->lightlevel >> LIGHTSEGSHIFT); - else + else // TODO: 2.3: Make transparent FOF planes use light level instead of always being fullbright light = LIGHTLEVELS-1; } else if (pl->ffloor->fofflags & FOF_FOG) From e4642c278fccb85708455782cc9b3e1abf489025 Mon Sep 17 00:00:00 2001 From: spherallic Date: Wed, 26 Jun 2024 22:14:30 +0200 Subject: [PATCH 154/353] Fix a bug that !2382 introduced --- src/p_saveg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_saveg.c b/src/p_saveg.c index 84aaf0e36..da73dd8a0 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3297,6 +3297,8 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->translation = READUINT16(save_p); if (diff2 & MD2_ALPHA) mobj->alpha = READFIXED(save_p); + else + mobj->alpha = FRACUNIT; if (diff & MD_REDFLAG) { From 8ec4bce1bf041b00ae3fbf84ce7d9c686a854090 Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 27 Jun 2024 00:25:56 +0200 Subject: [PATCH 155/353] Rename idlespectate to idleaction for future expansion --- src/netcode/d_clisrv.c | 12 +++++++----- src/netcode/d_clisrv.h | 2 +- src/netcode/d_netcmd.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/netcode/d_clisrv.c b/src/netcode/d_clisrv.c index d46e75c3f..03668d0f0 100644 --- a/src/netcode/d_clisrv.c +++ b/src/netcode/d_clisrv.c @@ -113,9 +113,11 @@ consvar_t cv_blamecfail = CVAR_INIT ("blamecfail", "Off", CV_SAVE|CV_NETVAR, CV_ static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, NULL}}; consvar_t cv_playbackspeed = CVAR_INIT ("playbackspeed", "1", 0, playbackspeed_cons_t, NULL); -consvar_t cv_idletime = CVAR_INIT ("idletime", "0", CV_SAVE, CV_Unsigned, NULL); -consvar_t cv_idlespectate = CVAR_INIT ("idlespectate", "On", CV_SAVE, CV_OnOff, NULL); -consvar_t cv_dedicatedidletime = CVAR_INIT ("dedicatedidletime", "10", CV_SAVE, CV_Unsigned, NULL); +consvar_t cv_dedicatedidletime = CVAR_INIT ("dedicatedidletime", "10", CV_SAVE|CV_NETVAR, CV_Unsigned, NULL); + +static CV_PossibleValue_t idleaction_cons_t[] = {{1, "Kick"}, {2, "Spectate"}, {0, NULL}}; +consvar_t cv_idleaction = CVAR_INIT ("idleaction", "Spectate", CV_SAVE|CV_NETVAR, idleaction_cons_t, NULL); +consvar_t cv_idletime = CVAR_INIT ("idletime", "3", CV_SAVE|CV_NETVAR, CV_Unsigned, NULL); consvar_t cv_httpsource = CVAR_INIT ("http_source", "", CV_SAVE, NULL, NULL); @@ -1373,7 +1375,7 @@ static void IdleUpdate(void) if (players[i].lastinputtime > (tic_t)cv_idletime.value * TICRATE * 60) { players[i].lastinputtime = 0; - if (cv_idlespectate.value && G_GametypeHasSpectators()) + if (cv_idleaction.value == 2 && G_GametypeHasSpectators()) { changeteam_union NetPacket; UINT16 usvalue; @@ -1384,7 +1386,7 @@ static void IdleUpdate(void) usvalue = SHORT(NetPacket.value.l|NetPacket.value.b); SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue)); } - else + else if (cv_idleaction.value == 1) { SendKick(i, KICK_MSG_IDLE | KICK_MSG_KEEP_BODY); } diff --git a/src/netcode/d_clisrv.h b/src/netcode/d_clisrv.h index 342173dff..86af61e9e 100644 --- a/src/netcode/d_clisrv.h +++ b/src/netcode/d_clisrv.h @@ -73,7 +73,7 @@ extern UINT32 realpingtable[MAXPLAYERS]; extern UINT32 playerpingtable[MAXPLAYERS]; extern tic_t servermaxping; -extern consvar_t cv_netticbuffer, cv_resynchattempts, cv_blamecfail, cv_playbackspeed, cv_idletime, cv_idlespectate, cv_dedicatedidletime; +extern consvar_t cv_netticbuffer, cv_resynchattempts, cv_blamecfail, cv_playbackspeed, cv_idletime, cv_idleaction, cv_dedicatedidletime; extern consvar_t cv_httpsource; // Used in d_net, the only dependence diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index 4134c633e..b0f872d86 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -620,7 +620,7 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_blamecfail); CV_RegisterVar(&cv_dedicatedidletime); CV_RegisterVar(&cv_idletime); - CV_RegisterVar(&cv_idlespectate); + CV_RegisterVar(&cv_idleaction); CV_RegisterVar(&cv_httpsource); COM_AddCommand("ping", Command_Ping_f, COM_LUA); From 05c97dbd5622cbd0e50c136a4fd8889dcbff10e5 Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 27 Jun 2024 10:48:59 +0200 Subject: [PATCH 156/353] Fix chat word wrapping by reintroducing some old hacks --- src/hu_stuff.c | 65 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 8489e4058..9f1d09d11 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1218,27 +1218,36 @@ static void HU_drawMiniChat(void) INT32 charwidth = 4, charheight = 6; INT32 boxw = cv_chatwidth.value; INT32 dx = 0, dy = 0; + boolean prev_linereturn = false; if (!chat_nummsg_min) return; // needless to say it's useless to do anything if we don't have anything to draw. for (size_t i = chat_nummsg_min; i > 0; i--) { - char *msg = V_ChatWordWrap(chatx, boxw-charwidth, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]); + char *msg = V_ChatWordWrap(0, boxw-charwidth, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE|V_MONOSPACE, chat_mini[i-1]); for(size_t j = 0; msg[j]; j++) // iterate through msg { if (msg[j] == '\n') // get back down. { - chatheight += charheight; - dx = 0; + if (!prev_linereturn) + { + chatheight += charheight; + dx = 0; + } + prev_linereturn = true; } else if (msg[j] >= FONTSTART) { + prev_linereturn = false; + dx += charwidth; - if (dx >= boxw) + + if (dx >= boxw-charwidth-2) { dx = 0; chatheight += charheight; + prev_linereturn = true; } } } @@ -1250,35 +1259,43 @@ static void HU_drawMiniChat(void) } y = chaty - (chatheight + charheight); + prev_linereturn = false; for (size_t i = 0; i < chat_nummsg_min; i++) // iterate through our hot messages { INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below... INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one. - char *msg = V_ChatWordWrap(chatx, boxw-charwidth, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it. + char *msg = V_ChatWordWrap(0, boxw-charwidth, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE|V_MONOSPACE, chat_mini[i]); // get the current message, and word wrap it. UINT8 *colormap = NULL; for(size_t j = 0; msg[j]; j++) // iterate through msg { if (msg[j] == '\n') // get back down. { - dy += charheight; - dx = 0; + if (!prev_linereturn) + { + dy += charheight; + dx = 0; + } + prev_linereturn = true; } else if (msg[j] & 0x80) // get colormap colormap = V_GetStringColormap(((msg[j] & 0x7f) << V_CHARCOLORSHIFT) & V_CHARCOLORMASK); else if (msg[j] >= FONTSTART) { + prev_linereturn = false; + if (cv_chatbacktint.value) // on request of wolfy V_DrawFillConsoleMap(x + dx + 2, y+dy, charwidth, charheight, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); - V_DrawChatCharacter(x + dx + 2, y+dy, msg[j] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|transflag, true, colormap); - + V_DrawChatCharacter(x + dx + 2, y+dy, msg[j] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_MONOSPACE|transflag, true, colormap); dx += charwidth; - if (dx >= boxw) + + if (dx >= boxw-charwidth-2) { dx = 0; dy += charheight; + prev_linereturn = true; } } } @@ -1303,6 +1320,7 @@ static void HU_drawChatLog(INT32 offset) UINT32 i = 0; INT32 chat_topy, chat_bottomy; boolean atbottom = false; + boolean prev_linereturn = false; // make sure that our scroll position isn't "illegal"; if (chat_scroll > chat_maxscroll) @@ -1335,27 +1353,38 @@ static void HU_drawChatLog(INT32 offset) for (i=0; i= FONTSTART) + else { - if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy))) - V_DrawChatCharacter(x + dx + 2, y+dy+2, msg[j] |V_SNAPTOBOTTOM|V_SNAPTOLEFT, true, colormap); + prev_linereturn = false; - dx += charwidth; - if (dx >= boxw-charwidth-2 && i= FONTSTART) + { + if ((y+dy+2 >= chat_topy) && (y+dy < (chat_bottomy))) + V_DrawChatCharacter(x + dx + 2, y+dy+2, msg[j] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_MONOSPACE, true, colormap); + + dx += charwidth; + } + + if (dx >= boxw-charwidth-2 && i < chat_nummsg_log) // end of message shouldn't count, nor should invisible characters!!!! { dx = 0; dy += charheight; + prev_linereturn = true; } } } From 8e7cce8b61aa8e3e2b3ec0db101646ef6a8fb9a6 Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 27 Jun 2024 17:16:03 +0200 Subject: [PATCH 157/353] Fix dynamic slope height changes not always being considered as "moved" --- src/p_slopes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index c2bacad9e..ce276a672 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -181,8 +181,8 @@ void T_DynamicSlopeLine (dynlineplanethink_t* th) { pslope_t* slope = th->slope; line_t* srcline = th->sourceline; - - fixed_t zdelta; + + fixed_t zdelta, oldoz = slope->o.z; switch(th->type) { case DP_FRONTFLOOR: @@ -209,7 +209,7 @@ void T_DynamicSlopeLine (dynlineplanethink_t* th) return; } - if (slope->zdelta != FixedDiv(zdelta, th->extent)) { + if (slope->zdelta != FixedDiv(zdelta, th->extent) || oldoz != slope->o.z) { slope->zdelta = FixedDiv(zdelta, th->extent); slope->zangle = R_PointToAngle2(0, 0, th->extent, -zdelta); slope->moved = true; From 32bbc48be5c9c0a13ca3a2822c1a68f738640b27 Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 27 Jun 2024 18:51:33 +0200 Subject: [PATCH 158/353] Fix light level issue with walls and FOF planes --- src/hardware/hw_main.c | 28 ++++++++++++++-------------- src/r_bsp.c | 4 ++-- src/r_segs.c | 24 ++++++++++++------------ 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index c70b6dd01..f395a8390 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -309,39 +309,39 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, angle_t dir, fixed_t delta) return (FUINT)finallight; } -static FUINT HWR_SideLightLevel(side_t *side, UINT8 base_lightlevel) +static UINT8 HWR_SideLightLevel(side_t *side, INT16 base_lightlevel) { - return side->light + - ((side->lightabsolute) ? 0 : base_lightlevel); + return max(0, min(255, side->light + + ((side->lightabsolute) ? 0 : base_lightlevel))); } /* TODO: implement per-texture lighting -static FUINT HWR_TopLightLevel(side_t *side, UINT8 base_lightlevel) +static UINT8 HWR_TopLightLevel(side_t *side, INT16 base_lightlevel) { - return side->light_top + - ((side->lightabsolute_top) ? 0 : HWR_SideLightLevel(side, base_lightlevel)); + return max(0, min(255, side->light_top + + ((side->lightabsolute_top) ? 0 : HWR_SideLightLevel(side, base_lightlevel)))); } -static FUINT HWR_MidLightLevel(side_t *side, UINT8 base_lightlevel) +static UINT8 HWR_MidLightLevel(side_t *side, INT16 base_lightlevel) { - return side->light_mid + - ((side->lightabsolute_mid) ? 0 : HWR_SideLightLevel(side, base_lightlevel)); + return max(0, min(255, side->light_mid + + ((side->lightabsolute_mid) ? 0 : HWR_SideLightLevel(side, base_lightlevel)))); } -static FUINT HWR_BottomLightLevel(side_t *side, UINT8 base_lightlevel) +static UINT8 HWR_BottomLightLevel(side_t *side, INT16 base_lightlevel) { - return side->light_bottom + - ((side->lightabsolute_bottom) ? 0 : HWR_SideLightLevel(side, base_lightlevel)); + return max(0, min(255, side->light_bottom + + ((side->lightabsolute_bottom) ? 0 : HWR_SideLightLevel(side, base_lightlevel)))); } */ -static UINT8 HWR_FloorLightLevel(sector_t *sector, UINT8 base_lightlevel) +static UINT8 HWR_FloorLightLevel(sector_t *sector, INT16 base_lightlevel) { return max(0, min(255, sector->floorlightlevel + ((sector->floorlightabsolute) ? 0 : base_lightlevel))); } -static UINT8 HWR_CeilingLightLevel(sector_t *sector, UINT8 base_lightlevel) +static UINT8 HWR_CeilingLightLevel(sector_t *sector, INT16 base_lightlevel) { return max(0, min(255, sector->ceilinglightlevel + ((sector->ceilinglightabsolute) ? 0 : base_lightlevel))); diff --git a/src/r_bsp.c b/src/r_bsp.c index 4b4c81b88..373a170c9 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -230,13 +230,13 @@ static INT32 R_DoorClosed(void) && (backsector->floorheight <= frontsector->floorheight || curline->sidedef->bottomtexture); } -static UINT8 R_FloorLightLevel(sector_t *sector, UINT8 base_lightlevel) +static UINT8 R_FloorLightLevel(sector_t *sector, INT16 base_lightlevel) { return max(0, min(255, sector->floorlightlevel + ((sector->floorlightabsolute) ? 0 : base_lightlevel))); } -static UINT8 R_CeilingLightLevel(sector_t *sector, UINT8 base_lightlevel) +static UINT8 R_CeilingLightLevel(sector_t *sector, INT16 base_lightlevel) { return max(0, min(255, sector->ceilinglightlevel + ((sector->ceilinglightabsolute) ? 0 : base_lightlevel))); diff --git a/src/r_segs.c b/src/r_segs.c index 637e528fe..a8a065c9b 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -94,29 +94,29 @@ transnum_t R_GetLinedefTransTable(fixed_t alpha) return (20*(FRACUNIT - alpha - 1) + FRACUNIT) >> (FRACBITS+1); } -static INT16 R_SideLightLevel(side_t *side, UINT8 base_lightlevel) +static UINT8 R_SideLightLevel(side_t *side, INT16 base_lightlevel) { - return side->light + - ((side->lightabsolute) ? 0 : base_lightlevel); + return max(0, min(255, side->light + + ((side->lightabsolute) ? 0 : base_lightlevel))); } /* TODO: implement per-texture lighting -static INT16 R_TopLightLevel(side_t *side, UINT8 base_lightlevel) +static UINT8 R_TopLightLevel(side_t *side, INT16 base_lightlevel) { - return side->light_top + - ((side->lightabsolute_top) ? 0 : R_SideLightLevel(side, base_lightlevel)); + return max(0, min(255, side->light_top + + ((side->lightabsolute_top) ? 0 : R_SideLightLevel(side, base_lightlevel)))); } -static INT16 R_MidLightLevel(side_t *side, UINT8 base_lightlevel) +static UINT8 R_MidLightLevel(side_t *side, INT16 base_lightlevel) { - return side->light_mid + - ((side->lightabsolute_mid) ? 0 : R_SideLightLevel(side, base_lightlevel)); + return max(0, min(255, side->light_mid + + ((side->lightabsolute_mid) ? 0 : R_SideLightLevel(side, base_lightlevel)))); } -static INT16 R_BottomLightLevel(side_t *side, UINT8 base_lightlevel) +static UINT8 R_BottomLightLevel(side_t *side, INT16 base_lightlevel) { - return side->light_bottom + - ((side->lightabsolute_bottom) ? 0 : R_SideLightLevel(side, base_lightlevel)); + return max(0, min(255, side->light_bottom + + ((side->lightabsolute_bottom) ? 0 : R_SideLightLevel(side, base_lightlevel)))); } */ From ac739b40bf6cb065bcc9773ed9874475604df05c Mon Sep 17 00:00:00 2001 From: pastel Date: Thu, 27 Jun 2024 13:14:52 -0500 Subject: [PATCH 159/353] Fix trycameramove crash on dedicated server --- src/p_map.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index b8584205b..b79f9d45c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2502,6 +2502,9 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) floatok = false; + if (dedicated) // this crashes so don't even try it + return false; + if (twodlevel || (thiscam == &camera && players[displayplayer].mo && (players[displayplayer].mo->flags2 & MF2_TWOD)) || (thiscam == &camera2 && players[secondarydisplayplayer].mo && (players[secondarydisplayplayer].mo->flags2 & MF2_TWOD))) From 746072c58bb74ab7cc20ac7ffc6f6f3ff002888d Mon Sep 17 00:00:00 2001 From: Hanicef Date: Thu, 27 Jun 2024 20:59:14 +0200 Subject: [PATCH 160/353] Remove unused low-level netcode stuff --- src/netcode/d_net.c | 27 +-------------------------- src/netcode/d_netfil.c | 1 - src/netcode/i_net.h | 20 -------------------- src/netcode/i_tcp.c | 2 -- 4 files changed, 1 insertion(+), 49 deletions(-) diff --git a/src/netcode/d_net.c b/src/netcode/d_net.c index b24409db1..4f21ca984 100644 --- a/src/netcode/d_net.c +++ b/src/netcode/d_net.c @@ -62,9 +62,6 @@ static doomdata_t reboundstore[MAXREBOUND]; static INT16 reboundsize[MAXREBOUND]; static INT32 rebound_head, rebound_tail; -/// \brief bandwith of netgame -INT32 net_bandwidth; - /// \brief max length per packet INT16 hardware_MAXPACKETLENGTH; @@ -1189,10 +1186,7 @@ void D_SetDoomcom(void) { if (doomcom) return; doomcom = Z_Calloc(sizeof (doomcom_t), PU_STATIC, NULL); - doomcom->id = DOOMCOM_ID; doomcom->numslots = doomcom->numnodes = 1; - doomcom->gametype = 0; - doomcom->consoleplayer = 0; doomcom->extratics = 0; } @@ -1217,7 +1211,6 @@ boolean D_CheckNetGame(void) I_NetMakeNodewPort = NULL; hardware_MAXPACKETLENGTH = MAXPACKETLENGTH; - net_bandwidth = 30000; // I_InitNetwork sets doomcom and netgame // check and initialize the network driver multiplayer = false; @@ -1237,7 +1230,6 @@ boolean D_CheckNetGame(void) server = true; // WTF? server always true??? // no! The deault mode is server. Client is set elsewhere // when the client executes connect command. - doomcom->ticdup = 1; if (M_CheckParm("-extratic")) { @@ -1248,21 +1240,6 @@ boolean D_CheckNetGame(void) CONS_Printf(M_GetText("Set extratics to %d\n"), doomcom->extratics); } - if (M_CheckParm("-bandwidth")) - { - if (M_IsNextParm()) - { - net_bandwidth = atoi(M_GetNextParm()); - if (net_bandwidth < 1000) - net_bandwidth = 1000; - if (net_bandwidth > 100000) - hardware_MAXPACKETLENGTH = MAXPACKETLENGTH; - CONS_Printf(M_GetText("Network bandwidth set to %d\n"), net_bandwidth); - } - else - I_Error("usage: -bandwidth "); - } - software_MAXPACKETLENGTH = hardware_MAXPACKETLENGTH; if (M_CheckParm("-packetsize")) { @@ -1282,8 +1259,6 @@ boolean D_CheckNetGame(void) if (netgame) multiplayer = true; - if (doomcom->id != DOOMCOM_ID) - I_Error("Doomcom buffer invalid!"); if (doomcom->numnodes > MAXNETNODES) I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES); @@ -1293,7 +1268,7 @@ boolean D_CheckNetGame(void) if (M_CheckParm("-debugfile")) { char filename[21]; - INT32 k = doomcom->consoleplayer - 1; + INT32 k = consoleplayer - 1; if (M_IsNextParm()) k = atoi(M_GetNextParm()) - 1; while (!debugfile && k < MAXPLAYERS) diff --git a/src/netcode/d_netfil.c b/src/netcode/d_netfil.c index a8a10d475..adec1a0e4 100644 --- a/src/netcode/d_netfil.c +++ b/src/netcode/d_netfil.c @@ -1033,7 +1033,6 @@ void FileSendTicker(void) netbuffer->packettype = PT_FILEFRAGMENT; - // (((sendbytes-nowsentbyte)*TICRATE)/(I_GetTime()-starttime)<(UINT32)net_bandwidth) while (packetsent-- && filestosend != 0) { for (i = currentnode, j = 0; j < MAXNETNODES; diff --git a/src/netcode/i_net.h b/src/netcode/i_net.h index 09b842296..6ac4bfc87 100644 --- a/src/netcode/i_net.h +++ b/src/netcode/i_net.h @@ -32,7 +32,6 @@ #define INETPACKETLENGTH 1024 extern INT16 hardware_MAXPACKETLENGTH; -extern INT32 net_bandwidth; // in byte/s #if defined(_MSC_VER) #pragma pack(1) @@ -40,36 +39,17 @@ extern INT32 net_bandwidth; // in byte/s typedef struct { - /// Supposed to be DOOMCOM_ID - INT32 id; - - /// SRB2 executes an INT32 to execute commands. - INT16 intnum; - /// Communication between SRB2 and the driver. - /// Is CMD_SEND or CMD_GET. - INT16 command; /// Is dest for send, set by get (-1 = no packet). INT16 remotenode; - /// Number of bytes in doomdata to be sent INT16 datalength; /// Info common to all nodes. /// Console is always node 0. INT16 numnodes; - /// Flag: 1 = no duplication, 2-5 = dup for slow nets. - INT16 ticdup; /// Flag: 1 = send a backup tic in every packet. INT16 extratics; - /// kind of game - INT16 gametype; - /// Flag: -1 = new game, 0-5 = load savegame - INT16 savegame; - /// currect map - INT16 map; - /// Info specific to this node. - INT16 consoleplayer; /// Number of "slots": the highest player number in use plus one. INT16 numslots; diff --git a/src/netcode/i_tcp.c b/src/netcode/i_tcp.c index 6a50f440b..1eb63b6bf 100644 --- a/src/netcode/i_tcp.c +++ b/src/netcode/i_tcp.c @@ -1374,7 +1374,6 @@ boolean I_InitTcpNetwork(void) // FIXME: // ??? and now ? // server on a big modem ??? 4*isdn - net_bandwidth = 16000; hardware_MAXPACKETLENGTH = INETPACKETLENGTH; ret = true; @@ -1403,7 +1402,6 @@ boolean I_InitTcpNetwork(void) // so we're on a LAN COM_BufAddText("connect any\n"); - net_bandwidth = 800000; hardware_MAXPACKETLENGTH = MAXPACKETLENGTH; } } From f713f5fdebe841bdf08674984a392af095efd80c Mon Sep 17 00:00:00 2001 From: Hanicef Date: Fri, 28 Jun 2024 12:37:13 +0200 Subject: [PATCH 161/353] Don't traverse the entire HOME directory but for real this time --- src/dedicated/i_system.c | 14 ++++++++------ src/sdl/i_system.c | 13 ++++++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 82dd51be0..1a1db8fb3 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -1390,8 +1390,8 @@ static const char *searchWad(const char *searchDir) #define CHECKWADPATH(ret) \ do { \ - I_OutputMsg(",%s", returnWadPath); \ - if (isWadPathOk(returnWadPath)) \ + I_OutputMsg(",%s", ret); \ + if (isWadPathOk(ret)) \ return ret; \ } while (0) @@ -1416,7 +1416,9 @@ static const char *locateWad(void) #ifndef NOCWD // examine current dir strcpy(returnWadPath, "."); - CHECKWADPATH(NULL); + I_OutputMsg(",%s", returnWadPath); + if (isWadPathOk(returnWadPath)) + return NULL; #endif #ifdef __APPLE__ @@ -1433,13 +1435,13 @@ static const char *locateWad(void) #ifndef NOHOME // find in $HOME - I_OutputMsg(",HOME/" DEFAULTDIR); if ((envstr = I_GetEnv("HOME")) != NULL) { - char *tmp = malloc(strlen(envstr) + sizeof(DEFAULTDIR)); + char *tmp = malloc(strlen(envstr) + 1 + sizeof(DEFAULTDIR)); strcpy(tmp, envstr); + strcat(tmp, "/"); strcat(tmp, DEFAULTDIR); - SEARCHWAD(envstr); + CHECKWADPATH(tmp); free(tmp); } #endif diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index e28fbd34a..9fe50a6a2 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -3003,8 +3003,8 @@ static const char *searchWad(const char *searchDir) #define CHECKWADPATH(ret) \ do { \ - I_OutputMsg(",%s", returnWadPath); \ - if (isWadPathOk(returnWadPath)) \ + I_OutputMsg(",%s", ret); \ + if (isWadPathOk(ret)) \ return ret; \ } while (0) @@ -3033,7 +3033,9 @@ static const char *locateWad(void) #ifndef NOCWD // examine current dir strcpy(returnWadPath, "."); - CHECKWADPATH(NULL); + I_OutputMsg(",%s", returnWadPath); + if (isWadPathOk(returnWadPath)) + return NULL; #endif #ifdef __APPLE__ @@ -3053,10 +3055,11 @@ static const char *locateWad(void) I_OutputMsg(",HOME/" DEFAULTDIR); if ((envstr = I_GetEnv("HOME")) != NULL) { - char *tmp = malloc(strlen(envstr) + sizeof(DEFAULTDIR)); + char *tmp = malloc(strlen(envstr) + 1 + sizeof(DEFAULTDIR)); strcpy(tmp, envstr); + strcat(tmp, "/"); strcat(tmp, DEFAULTDIR); - SEARCHWAD(envstr); + CHECKWADPATH(tmp); free(tmp); } #endif From 06949628cf21c15c1f50bb00d63037b472863682 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 30 Jun 2024 11:24:07 +0200 Subject: [PATCH 162/353] Fix lastinputtime not incrementing if idletime is 0 --- src/netcode/d_clisrv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/netcode/d_clisrv.c b/src/netcode/d_clisrv.c index d46e75c3f..5fee506af 100644 --- a/src/netcode/d_clisrv.c +++ b/src/netcode/d_clisrv.c @@ -1361,16 +1361,16 @@ static void IdleUpdate(void) if (!server || !netgame) return; - for (i = 1; i < MAXPLAYERS; i++) + for (i = 0; i < MAXPLAYERS; i++) { - if (cv_idletime.value && playeringame[i] && playernode[i] != UINT8_MAX && !players[i].quittime && !players[i].spectator && !players[i].bot && !IsPlayerAdmin(i) && i != serverplayer && gamestate == GS_LEVEL && !(players[i].pflags & PF_FINISHED)) + if (playeringame[i] && playernode[i] != UINT8_MAX && !players[i].quittime && !players[i].spectator && !players[i].bot && gamestate == GS_LEVEL) { if (players[i].cmd.forwardmove || players[i].cmd.sidemove || players[i].cmd.buttons) players[i].lastinputtime = 0; else players[i].lastinputtime++; - if (players[i].lastinputtime > (tic_t)cv_idletime.value * TICRATE * 60) + if (cv_idletime.value && !IsPlayerAdmin(i) && i != serverplayer && !(players[i].pflags & PF_FINISHED) && players[i].lastinputtime > (tic_t)cv_idletime.value * TICRATE * 60) { players[i].lastinputtime = 0; if (cv_idlespectate.value && G_GametypeHasSpectators()) From 4ff127bc0e21f9cdc5592167818a5dc067106836 Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 1 Jul 2024 12:46:51 +0200 Subject: [PATCH 163/353] Improve relative teleport interpolation --- src/p_spec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 78cf46063..d4939669a 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2405,18 +2405,15 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) y = line->args[3] << FRACBITS; z = line->args[4] << FRACBITS; - P_UnsetThingPosition(mo); - mo->x += x; - mo->y += y; - mo->z += z; - P_SetThingPosition(mo); - + P_SetOrigin(mo, mo->x + x, mo->y + y, mo->z + z); + if (mo->player) { if (bot) // This might put poor Tails in a wall if he's too far behind! D: But okay, whatever! >:3 P_SetOrigin(bot, bot->x + x, bot->y + y, bot->z + z); if (splitscreen && mo->player == &players[secondarydisplayplayer] && camera2.chase) { + camera2.reset = true; camera2.x += x; camera2.y += y; camera2.z += z; @@ -2424,6 +2421,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) } else if (camera.chase && mo->player == &players[displayplayer]) { + camera.reset = true; camera.x += x; camera.y += y; camera.z += z; From e9e2f20de9ed000d8d3bf15fbbec4ba87faa1b54 Mon Sep 17 00:00:00 2001 From: pastel Date: Mon, 1 Jul 2024 14:14:05 +0000 Subject: [PATCH 164/353] Make files with missing skins tell you who the skin is (resolves #1071) --- src/m_menu.c | 19 ++++++++++++++++--- src/m_menu.h | 1 + 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 38165472e..6ac0f15bf 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8432,7 +8432,17 @@ static void M_DrawLoadGameData(void) if (savegameinfo[savetodraw].lives == -42) V_DrawRightAlignedThinString(x + 79, y, V_GRAYMAP, "NEW GAME"); else if (savegameinfo[savetodraw].lives == -666) - V_DrawRightAlignedThinString(x + 79, y, V_REDMAP, "CAN'T LOAD!"); + { + if (savegameinfo[savetodraw].continuescore == -62) + { + V_DrawRightAlignedThinString(x + 79, y, V_REDMAP, "ADDON NOT LOADED"); + V_DrawRightAlignedThinString(x + 79, y-10, V_REDMAP, savegameinfo[savetodraw].skinname); + } + else + { + V_DrawRightAlignedThinString(x + 79, y, V_REDMAP, "CAN'T LOAD!"); + } + } else if (savegameinfo[savetodraw].gamemap & 8192) V_DrawRightAlignedThinString(x + 79, y, V_GREENMAP, "CLEAR!"); else @@ -8665,6 +8675,7 @@ static void M_LoadSelect(INT32 choice) } #define VERSIONSIZE 16 +#define MISSING { savegameinfo[slot].continuescore = -62; savegameinfo[slot].lives = -666; Z_Free(savebuffer); return; } #define BADSAVE { savegameinfo[slot].lives = -666; Z_Free(savebuffer); return; } #define CHECKPOS if (sav_p >= end_p) BADSAVE // Reads the save file to list lives, level, player, etc. @@ -8761,10 +8772,11 @@ static void M_ReadSavegameInfo(UINT32 slot) CHECKPOS READSTRINGN(sav_p, ourSkinName, SKINNAMESIZE); savegameinfo[slot].skinnum = R_SkinAvailable(ourSkinName); + STRBUFCPY(savegameinfo[slot].skinname, ourSkinName); if (savegameinfo[slot].skinnum >= numskins || !R_SkinUsable(-1, savegameinfo[slot].skinnum)) - BADSAVE + MISSING CHECKPOS READSTRINGN(sav_p, botSkinName, SKINNAMESIZE); @@ -8772,7 +8784,7 @@ static void M_ReadSavegameInfo(UINT32 slot) if (savegameinfo[slot].botskin-1 >= numskins || !R_SkinUsable(-1, savegameinfo[slot].botskin-1)) - BADSAVE + MISSING } CHECKPOS @@ -8817,6 +8829,7 @@ static void M_ReadSavegameInfo(UINT32 slot) } #undef CHECKPOS #undef BADSAVE +#undef MISSING // // M_ReadSaveStrings diff --git a/src/m_menu.h b/src/m_menu.h index 99a5b6de4..1e3cadfbe 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -421,6 +421,7 @@ typedef struct { char levelname[32]; UINT8 skinnum; + char skinname [SKINNAMESIZE+1]; UINT8 botskin; UINT8 numemeralds; UINT8 numgameovers; From 88fa2eb7761a6eb174b78225c7d53842662761b1 Mon Sep 17 00:00:00 2001 From: spherallic Date: Mon, 1 Jul 2024 19:53:12 +0200 Subject: [PATCH 165/353] Set player height to skin height instead of default height in G_AddPlayer --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index bf369d111..5d6954b9b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3352,7 +3352,7 @@ void G_AddPlayer(INT32 playernum) p->playerstate = PST_REBORN; - p->height = mobjinfo[MT_PLAYER].height; + p->height = skins[p->skin]->height; if (G_GametypeUsesLives() || ((netgame || multiplayer) && (gametyperules & GTR_FRIENDLY))) p->lives = cv_startinglives.value; From 51af830d3014a99831482121e2c71408fc95a46e Mon Sep 17 00:00:00 2001 From: pastel Date: Mon, 1 Jul 2024 17:20:33 -0500 Subject: [PATCH 166/353] Fix miniupnpc version 18+ --- src/netcode/i_tcp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/netcode/i_tcp.c b/src/netcode/i_tcp.c index 6a50f440b..24dfd7ec2 100644 --- a/src/netcode/i_tcp.c +++ b/src/netcode/i_tcp.c @@ -317,7 +317,11 @@ init_upnpc_once(struct upnpdata *upnpuserdata) I_OutputMsg(M_GetText("Found UPnP device:\n desc: %s\n st: %s\n"), dev->descURL, dev->st); +#if (MINIUPNPC_API_VERSION >= 18) + UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr), NULL, 0); +#else UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)); +#endif I_OutputMsg(M_GetText("Local LAN IP address: %s\n"), lanaddr); descXML = miniwget(dev->descURL, &descXMLsize, scope_id, &status_code); if (descXML) From f92f1f3527b8d389cb9dd61fb0a1a11ed4dc0435 Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 2 Jul 2024 02:43:34 +0200 Subject: [PATCH 167/353] Correct chat word wrapping further, clean up unused status bar dimensions --- src/d_main.c | 8 ++++---- src/hu_stuff.c | 8 ++++---- src/r_draw.c | 1 - src/screen.h | 4 ---- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index bad78c530..bf6c62ef2 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -679,13 +679,13 @@ static void D_Display(void) s[sizeof s - 1] = '\0'; snprintf(s, sizeof s - 1, "get %d b/s", getbps); - V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-40, V_YELLOWMAP, s); + V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-40, V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "send %d b/s", sendbps); - V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-30, V_YELLOWMAP, s); + V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-30, V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "GameMiss %.2f%%", gamelostpercent); - V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-20, V_YELLOWMAP, s); + V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-20, V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "SysMiss %.2f%%", lostpercent); - V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-10, V_YELLOWMAP, s); + V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-10, V_YELLOWMAP, s); } if (cv_perfstats.value) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 9f1d09d11..5a27968cc 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -29,7 +29,7 @@ #include "i_video.h" #include "i_system.h" -#include "st_stuff.h" // ST_HEIGHT +#include "st_stuff.h" #include "r_local.h" #include "keys.h" @@ -1225,7 +1225,7 @@ static void HU_drawMiniChat(void) for (size_t i = chat_nummsg_min; i > 0; i--) { - char *msg = V_ChatWordWrap(0, boxw-charwidth, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE|V_MONOSPACE, chat_mini[i-1]); + char *msg = V_ChatWordWrap(0, boxw-charwidth-2, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE|V_MONOSPACE, chat_mini[i-1]); for(size_t j = 0; msg[j]; j++) // iterate through msg { if (msg[j] == '\n') // get back down. @@ -1265,7 +1265,7 @@ static void HU_drawMiniChat(void) { INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below... INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one. - char *msg = V_ChatWordWrap(0, boxw-charwidth, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE|V_MONOSPACE, chat_mini[i]); // get the current message, and word wrap it. + char *msg = V_ChatWordWrap(0, boxw-charwidth-2, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE|V_MONOSPACE, chat_mini[i]); // get the current message, and word wrap it. UINT8 *colormap = NULL; for(size_t j = 0; msg[j]; j++) // iterate through msg @@ -1353,7 +1353,7 @@ static void HU_drawChatLog(INT32 offset) for (i=0; i Date: Tue, 2 Jul 2024 15:16:43 +0200 Subject: [PATCH 168/353] Change BETAVERSION to pre1 --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index 8d8f8978e..2e8e52ddb 100644 --- a/src/version.h +++ b/src/version.h @@ -12,4 +12,4 @@ #define MODVERSION 55 // Define this as a prerelease version suffix (pre#, RC#) -#define BETAVERSION "nightly" +#define BETAVERSION "pre1" From 1334c6bb3de7a081bbb1abd35b3c2147facfbf05 Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 2 Jul 2024 16:38:31 +0200 Subject: [PATCH 169/353] Update srb2.pk3 hash --- src/config.h.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index 1148cab2c..63a175cbd 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -40,9 +40,9 @@ * Last updated 2023 / 05 / 02 - v2.2.11 - patch.pk3 & zones.pk3 * Last updated 2023 / 09 / 06 - v2.2.12 - patch.pk3 * Last updated 2023 / 09 / 09 - v2.2.13 - none - * Last updated 2024 / 06 / 24 - v2.2.14 - main assets + * Last updated 2024 / 07 / 02 - v2.2.14 - main assets */ -#define ASSET_HASH_SRB2_PK3 "9b8cf9510c56d442616086ca65ff93a7" +#define ASSET_HASH_SRB2_PK3 "b528b081a30f56aecf1040985474ff78" #define ASSET_HASH_ZONES_PK3 "b7db0245434ca3ad61935ee36403e966" #define ASSET_HASH_PLAYER_DTA "2e7aaae8a6b1b77d90ffe7606ceadb6c" #ifdef USE_PATCH_DTA From 5d15c65f15592857a5a28ac08d02eaabf1844f7e Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 2 Jul 2024 21:51:43 +0200 Subject: [PATCH 170/353] Update srb2.pk3 asset hash again --- src/config.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.h.in b/src/config.h.in index 63a175cbd..6870d1352 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -42,7 +42,7 @@ * Last updated 2023 / 09 / 09 - v2.2.13 - none * Last updated 2024 / 07 / 02 - v2.2.14 - main assets */ -#define ASSET_HASH_SRB2_PK3 "b528b081a30f56aecf1040985474ff78" +#define ASSET_HASH_SRB2_PK3 "dcf62cabd247e87074ed57336f7a5969" #define ASSET_HASH_ZONES_PK3 "b7db0245434ca3ad61935ee36403e966" #define ASSET_HASH_PLAYER_DTA "2e7aaae8a6b1b77d90ffe7606ceadb6c" #ifdef USE_PATCH_DTA From 01a368632e3d1515a5da925461886ab142b153d0 Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 2 Jul 2024 21:52:17 +0200 Subject: [PATCH 171/353] Correct line spacing on title card font --- src/hu_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 5a27968cc..caf13a445 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -204,7 +204,7 @@ void HU_LoadGraphics(void) HU_SetFontProperties(&hu_font, 0, 4, 8, 12); HU_SetFontProperties(&tny_font, 0, 2, 4, 12); HU_SetFontProperties(&cred_font, 0, 16, 16, 16); - HU_SetFontProperties(<_font, 0, 16, 20, 20); + HU_SetFontProperties(<_font, 0, 16, 20, 16); HU_SetFontProperties(&ntb_font, 2, 4, 20, 21); HU_SetFontProperties(&nto_font, 0, 4, 20, 21); From 64aefe7322db8b5b181298c44c60527a112e6138 Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 4 Jul 2024 12:42:16 +0200 Subject: [PATCH 172/353] Remove OpenGL-only fake contrast cvars --- src/hardware/hw_main.c | 91 ++++-------------------------------------- src/hardware/hw_main.h | 2 - 2 files changed, 7 insertions(+), 86 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 36e80f378..599c39132 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -226,87 +226,17 @@ UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap) // Let's see if return surfcolor.s.alpha; } -static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y) +static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y) // TODO: improve "fake contrast" system { INT16 finallight = lightnum; + const UINT8 contrast = 8; - if (cv_glfakecontrast.value != 0) - { - const UINT8 contrast = 8; - fixed_t extralight = 0; + if (v1y == v2y) + finallight -= contrast; + else if (v1x == v2x) + finallight += contrast; - if (cv_glfakecontrast.value == 2) // Smooth setting - { - extralight = (-(contrast<> FRACBITS; - } - else - { - if (v1y == v2y) - extralight = -contrast; - else if (v1x == v2x) - extralight = contrast; - } - - if (extralight != 0) - { - finallight += extralight; - - if (finallight < 0) - finallight = 0; - if (finallight > 255) - finallight = 255; - } - } - - return (FUINT)finallight; -} - -static FUINT HWR_CalcSlopeLight(FUINT lightnum, angle_t dir, fixed_t delta) -{ - INT16 finallight = lightnum; - - if (cv_glfakecontrast.value != 0 && cv_glslopecontrast.value != 0) - { - const UINT8 contrast = 8; - fixed_t extralight = 0; - - if (cv_glfakecontrast.value == 2) // Smooth setting - { - fixed_t dirmul = abs(FixedDiv(AngleFixed(dir) - (180<> FRACBITS; - } - else - { - dir = ((dir + ANGLE_45) / ANGLE_90) * ANGLE_90; - - if (dir == ANGLE_180) - extralight = -contrast; - else if (dir == 0) - extralight = contrast; - - if (delta >= FRACUNIT/2) - extralight *= 2; - } - - if (extralight != 0) - { - finallight += extralight; - - if (finallight < 0) - finallight = 0; - if (finallight > 255) - finallight = 255; - } - } - - return (FUINT)finallight; + return (FUINT)max(0, min(255, finallight)); } static UINT8 HWR_SideLightLevel(side_t *side, INT16 base_lightlevel) @@ -498,9 +428,6 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++) SETUP3DVERT(v3d, pv->x, pv->y); - if (slope) - lightlevel = HWR_CalcSlopeLight(lightlevel, R_PointToAngle2(0, 0, slope->normal.x, slope->normal.y), abs(slope->zdelta)); - HWR_Lighting(&Surf, lightlevel, planecolormap); if (PolyFlags & (PF_Translucent|PF_Fog|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment)) @@ -5665,7 +5592,6 @@ void HWR_LoadLevel(void) static CV_PossibleValue_t glshaders_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Ignore custom shaders"}, {0, NULL}}; static CV_PossibleValue_t glmodelinterpolation_cons_t[] = {{0, "Off"}, {1, "Sometimes"}, {2, "Always"}, {0, NULL}}; -static CV_PossibleValue_t glfakecontrast_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Smooth"}, {0, NULL}}; static CV_PossibleValue_t glshearing_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Third-person"}, {0, NULL}}; static void CV_glfiltermode_OnChange(void); @@ -5699,8 +5625,6 @@ consvar_t cv_glmodellighting = CVAR_INIT ("gr_modellighting", "Off", CV_SAVE|CV_ consvar_t cv_glshearing = CVAR_INIT ("gr_shearing", "Off", CV_SAVE, glshearing_cons_t, NULL); consvar_t cv_glspritebillboarding = CVAR_INIT ("gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL); consvar_t cv_glskydome = CVAR_INIT ("gr_skydome", "On", CV_SAVE, CV_OnOff, NULL); -consvar_t cv_glfakecontrast = CVAR_INIT ("gr_fakecontrast", "Smooth", CV_SAVE, glfakecontrast_cons_t, NULL); -consvar_t cv_glslopecontrast = CVAR_INIT ("gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NULL); consvar_t cv_glfiltermode = CVAR_INIT ("gr_filtermode", "Nearest", CV_SAVE|CV_CALL, glfiltermode_cons_t, CV_glfiltermode_OnChange); consvar_t cv_glanisotropicmode = CVAR_INIT ("gr_anisotropicmode", "1", CV_SAVE|CV_CALL, glanisotropicmode_cons_t, CV_glanisotropic_OnChange); @@ -5782,7 +5706,6 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_glskydome); CV_RegisterVar(&cv_glspritebillboarding); - CV_RegisterVar(&cv_glfakecontrast); CV_RegisterVar(&cv_glshearing); CV_RegisterVar(&cv_glshaders); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index ea610a48b..2492bf6c8 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -91,8 +91,6 @@ extern consvar_t cv_glsolvetjoin; extern consvar_t cv_glshearing; extern consvar_t cv_glspritebillboarding; extern consvar_t cv_glskydome; -extern consvar_t cv_glfakecontrast; -extern consvar_t cv_glslopecontrast; extern consvar_t cv_glbatching; extern consvar_t cv_glpaletterendering; extern consvar_t cv_glpalettedepth; From 39d3b1cbd523c92e25ed0d00b3a87f45025f15c7 Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 4 Jul 2024 22:54:07 +0200 Subject: [PATCH 173/353] Update srb2.pk3 hash yet again --- src/config.h.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index 6870d1352..9aa4f6da5 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -40,9 +40,9 @@ * Last updated 2023 / 05 / 02 - v2.2.11 - patch.pk3 & zones.pk3 * Last updated 2023 / 09 / 06 - v2.2.12 - patch.pk3 * Last updated 2023 / 09 / 09 - v2.2.13 - none - * Last updated 2024 / 07 / 02 - v2.2.14 - main assets + * Last updated 2024 / 07 / 04 - v2.2.14 - main assets */ -#define ASSET_HASH_SRB2_PK3 "dcf62cabd247e87074ed57336f7a5969" +#define ASSET_HASH_SRB2_PK3 "4ef6f57eefdf263288cae12084791cd2" #define ASSET_HASH_ZONES_PK3 "b7db0245434ca3ad61935ee36403e966" #define ASSET_HASH_PLAYER_DTA "2e7aaae8a6b1b77d90ffe7606ceadb6c" #ifdef USE_PATCH_DTA From 4557ce0253801b70802c59419012abcc43cc9bf7 Mon Sep 17 00:00:00 2001 From: spherallic Date: Fri, 5 Jul 2024 22:42:14 +0200 Subject: [PATCH 174/353] NiGHTS mode: move timer and closed caption positions --- src/screen.c | 6 ++---- src/st_stuff.c | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/screen.c b/src/screen.c index 014a20117..191c8638a 100644 --- a/src/screen.c +++ b/src/screen.c @@ -493,11 +493,9 @@ void SCR_ClosedCaptions(void) basey -= 42; else if (splitscreen) basey -= 8; - else if ((modeattacking == ATTACKING_NIGHTS) - || (!(maptol & TOL_NIGHTS) - && LUA_HudEnabled(hud_powerups) + else if (LUA_HudEnabled(hud_powerups) && ((cv_powerupdisplay.value == 2) // "Always" - || (cv_powerupdisplay.value == 1 && !camera.chase)))) // "First-person only" + || (cv_powerupdisplay.value == 1 && !camera.chase))) // "First-person only" basey -= 16; } diff --git a/src/st_stuff.c b/src/st_stuff.c index e088a448c..6a83e99ea 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2078,24 +2078,25 @@ static void ST_drawNiGHTSHUD(void) if (!stplyr->exiting && !oldspecialstage && LUA_HudEnabled(hud_nightsscore)) ST_DrawNightsOverlayNum(304<marescore, nightsnum, SKINCOLOR_AZURE); - // TODO give this its own section for Lua + // TODO: give this its own section for Lua + // TODO: on multi-mare maps, show time & grade for each completed mare if (!stplyr->exiting && LUA_HudEnabled(hud_nightsscore)) { if (modeattacking == ATTACKING_NIGHTS) { INT32 maretime = max(stplyr->realtime - stplyr->marebegunat, 0); -#define VFLAGS V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_PERPLAYER|V_HUDTRANS - V_DrawScaledPatch(BASEVIDWIDTH-22, BASEVIDHEIGHT-20, VFLAGS, W_CachePatchName("NGRTIMER", PU_HUDGFX)); - V_DrawPaddedTallNum(BASEVIDWIDTH-22, BASEVIDHEIGHT-20, VFLAGS, G_TicsToCentiseconds(maretime), 2); - V_DrawScaledPatch(BASEVIDWIDTH-46, BASEVIDHEIGHT-20, VFLAGS, sboperiod); +#define VFLAGS V_SNAPTOTOP|V_SNAPTORIGHT|V_PERPLAYER|V_HUDTRANS + V_DrawScaledPatch(BASEVIDWIDTH-16, 40, VFLAGS, W_CachePatchName("NGRTIMER", PU_HUDGFX)); + V_DrawPaddedTallNum(BASEVIDWIDTH-16, 40, VFLAGS, G_TicsToCentiseconds(maretime), 2); + V_DrawScaledPatch(BASEVIDWIDTH-40, 40, VFLAGS, sboperiod); if (maretime < 60*TICRATE) - V_DrawTallNum(BASEVIDWIDTH-46, BASEVIDHEIGHT-20, VFLAGS, G_TicsToSeconds(maretime)); + V_DrawTallNum(BASEVIDWIDTH-40, 40, VFLAGS, G_TicsToSeconds(maretime)); else { - V_DrawPaddedTallNum(BASEVIDWIDTH-46, BASEVIDHEIGHT-20, VFLAGS, G_TicsToSeconds(maretime), 2); - V_DrawScaledPatch(BASEVIDWIDTH-70, BASEVIDHEIGHT-20, VFLAGS, sbocolon); - V_DrawTallNum(BASEVIDWIDTH-70, BASEVIDHEIGHT-20, VFLAGS, G_TicsToMinutes(maretime, true)); + V_DrawPaddedTallNum(BASEVIDWIDTH-40, 40, VFLAGS, G_TicsToSeconds(maretime), 2); + V_DrawScaledPatch(BASEVIDWIDTH-64, 40, VFLAGS, sbocolon); + V_DrawTallNum(BASEVIDWIDTH-64, 40, VFLAGS, G_TicsToMinutes(maretime, true)); } #undef VFLAGS } From 792b80cddb411e3ef7839beb33717403acd58f09 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 7 Jul 2024 17:02:48 +0200 Subject: [PATCH 175/353] Lift savebuffer limits --- src/g_game.c | 242 ++- src/lua_script.c | 281 ++-- src/lua_script.h | 5 +- src/netcode/d_netcmd.c | 24 +- src/netcode/gamestate.c | 81 +- src/p_mobj.h | 2 + src/p_saveg.c | 3543 +++++++++++++++++++++------------------ src/p_saveg.h | 50 +- 8 files changed, 2240 insertions(+), 1988 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 5d6954b9b..5466b483a 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -256,8 +256,6 @@ boolean precache = true; // if true, load all graphics at start INT16 prevmap, nextmap; -static UINT8 *savebuffer; - // Analog Control static void UserAnalog_OnChange(void); static void UserAnalog2_OnChange(void); @@ -4396,7 +4394,7 @@ void G_LoadGameSettings(void) // Loads the main data file, which stores information such as emblems found, etc. void G_LoadGameData(gamedata_t *data) { - size_t length; + save_t savebuffer; INT32 i, j; UINT32 versionID; @@ -4438,18 +4436,18 @@ void G_LoadGameData(gamedata_t *data) return; } - length = FIL_ReadFile(va(pandf, srb2home, gamedatafilename), &savebuffer); - if (!length) + savebuffer.size = FIL_ReadFile(va(pandf, srb2home, gamedatafilename), &savebuffer.buf); + if (!savebuffer.size) { // No gamedata. We can save a new one. data->loaded = true; return; } - save_p = savebuffer; + savebuffer.pos = 0; // Version check - versionID = READUINT32(save_p); + versionID = P_ReadUINT32(&savebuffer); if (versionID != GAMEDATA_ID #ifdef COMPAT_GAMEDATA_ID // backwards compat behavior && versionID != COMPAT_GAMEDATA_ID @@ -4460,8 +4458,7 @@ void G_LoadGameData(gamedata_t *data) if (strcmp(srb2home,".")) gdfolder = srb2home; - Z_Free(savebuffer); - save_p = NULL; + Z_Free(savebuffer.buf); I_Error("Game data is from another version of SRB2.\nDelete %s(maybe in %s) and try again.", gamedatafilename, gdfolder); } @@ -4473,14 +4470,14 @@ void G_LoadGameData(gamedata_t *data) } #endif - data->totalplaytime = READUINT32(save_p); + data->totalplaytime = P_ReadUINT32(&savebuffer); #ifdef COMPAT_GAMEDATA_ID if (versionID == COMPAT_GAMEDATA_ID) { // We'll temporarily use the old condition when loading an older file. // The proper mod-specific hash will get saved in afterwards. - boolean modded = READUINT8(save_p); + boolean modded = P_ReadUINT8(&savebuffer); if (modded && !savemoddata) { @@ -4500,13 +4497,13 @@ void G_LoadGameData(gamedata_t *data) strcpy(currentfilename, gamedatafilename); STRBUFCPY(backupfilename, strcat(currentfilename, bak)); - FIL_WriteFile(va(pandf, srb2home, backupfilename), savebuffer, length); + FIL_WriteFile(va(pandf, srb2home, backupfilename), &savebuffer.buf, savebuffer.size); } else #endif { // Quick & dirty hash for what mod this save file is for. - UINT32 modID = READUINT32(save_p); + UINT32 modID = P_ReadUINT32(&savebuffer); UINT32 expectedID = quickncasehash(timeattackfolder, sizeof timeattackfolder); if (modID != expectedID) @@ -4518,50 +4515,50 @@ void G_LoadGameData(gamedata_t *data) // TODO put another cipher on these things? meh, I don't care... for (i = 0; i < NUMMAPS; i++) - if ((data->mapvisited[i] = READUINT8(save_p)) > MV_MAX) + if ((data->mapvisited[i] = P_ReadUINT8(&savebuffer)) > MV_MAX) goto datacorrupt; // To save space, use one bit per collected/achieved/unlocked flag for (i = 0; i < max_emblems;) { - rtemp = READUINT8(save_p); + rtemp = P_ReadUINT8(&savebuffer); for (j = 0; j < 8 && j+i < max_emblems; ++j) data->collected[j+i] = ((rtemp >> j) & 1); i += j; } for (i = 0; i < max_extraemblems;) { - rtemp = READUINT8(save_p); + rtemp = P_ReadUINT8(&savebuffer); for (j = 0; j < 8 && j+i < max_extraemblems; ++j) data->extraCollected[j+i] = ((rtemp >> j) & 1); i += j; } for (i = 0; i < max_unlockables;) { - rtemp = READUINT8(save_p); + rtemp = P_ReadUINT8(&savebuffer); for (j = 0; j < 8 && j+i < max_unlockables; ++j) data->unlocked[j+i] = ((rtemp >> j) & 1); i += j; } for (i = 0; i < max_conditionsets;) { - rtemp = READUINT8(save_p); + rtemp = P_ReadUINT8(&savebuffer); for (j = 0; j < 8 && j+i < max_conditionsets; ++j) data->achieved[j+i] = ((rtemp >> j) & 1); i += j; } - data->timesBeaten = READUINT32(save_p); - data->timesBeatenWithEmeralds = READUINT32(save_p); - data->timesBeatenUltimate = READUINT32(save_p); + data->timesBeaten = P_ReadUINT32(&savebuffer); + data->timesBeatenWithEmeralds = P_ReadUINT32(&savebuffer); + data->timesBeatenUltimate = P_ReadUINT32(&savebuffer); // Main records for (i = 0; i < NUMMAPS; ++i) { - recscore = READUINT32(save_p); - rectime = (tic_t)READUINT32(save_p); - recrings = READUINT16(save_p); - save_p++; // compat + recscore = P_ReadUINT32(&savebuffer); + rectime = (tic_t)P_ReadUINT32(&savebuffer); + recrings = P_ReadUINT16(&savebuffer); + P_ReadUINT8(&savebuffer); // compat if (recrings > 10000 || recscore > MAXSCORE) goto datacorrupt; @@ -4578,16 +4575,16 @@ void G_LoadGameData(gamedata_t *data) // Nights records for (i = 0; i < NUMMAPS; ++i) { - if ((recmares = READUINT8(save_p)) == 0) + if ((recmares = P_ReadUINT8(&savebuffer)) == 0) continue; G_AllocNightsRecordData((INT16)i, data); for (curmare = 0; curmare < (recmares+1); ++curmare) { - data->nightsrecords[i]->score[curmare] = READUINT32(save_p); - data->nightsrecords[i]->grade[curmare] = READUINT8(save_p); - data->nightsrecords[i]->time[curmare] = (tic_t)READUINT32(save_p); + data->nightsrecords[i]->score[curmare] = P_ReadUINT32(&savebuffer); + data->nightsrecords[i]->grade[curmare] = P_ReadUINT8(&savebuffer); + data->nightsrecords[i]->time[curmare] = (tic_t)P_ReadUINT32(&savebuffer); if (data->nightsrecords[i]->grade[curmare] > GRADE_S) { @@ -4599,8 +4596,7 @@ void G_LoadGameData(gamedata_t *data) } // done - Z_Free(savebuffer); - save_p = NULL; + Z_Free(savebuffer.buf); // Don't consider loaded until it's a success! // It used to do this much earlier, but this would cause the gamedata to @@ -4621,8 +4617,7 @@ void G_LoadGameData(gamedata_t *data) if (strcmp(srb2home,".")) gdfolder = srb2home; - Z_Free(savebuffer); - save_p = NULL; + Z_Free(savebuffer.buf); I_Error("Corrupt game data file.\nDelete %s(maybe in %s) and try again.", gamedatafilename, gdfolder); } @@ -4632,9 +4627,8 @@ void G_LoadGameData(gamedata_t *data) // Saves the main data file, which stores information such as emblems found, etc. void G_SaveGameData(gamedata_t *data) { - UINT8 *data_p; + save_t savebuffer; - size_t length; INT32 i, j; UINT8 btemp; @@ -4646,30 +4640,31 @@ void G_SaveGameData(gamedata_t *data) if (!data->loaded) return; // If never loaded (-nodata), don't save - data_p = savebuffer = (UINT8 *)malloc(GAMEDATASIZE); - if (!data_p) + savebuffer.size = GAMEDATASIZE; + savebuffer.buf = (UINT8 *)malloc(savebuffer.size); + if (!savebuffer.buf) { CONS_Alert(CONS_ERROR, M_GetText("No more free memory for saving game data\n")); return; } + savebuffer.pos = 0; if (usedCheats) { - free(savebuffer); - savebuffer = NULL; + free(savebuffer.buf); return; } // Version test - WRITEUINT32(data_p, GAMEDATA_ID); + P_WriteUINT32(&savebuffer, GAMEDATA_ID); - WRITEUINT32(data_p, data->totalplaytime); + P_WriteUINT32(&savebuffer, data->totalplaytime); - WRITEUINT32(data_p, quickncasehash(timeattackfolder, sizeof timeattackfolder)); + P_WriteUINT32(&savebuffer, quickncasehash(timeattackfolder, sizeof timeattackfolder)); // TODO put another cipher on these things? meh, I don't care... for (i = 0; i < NUMMAPS; i++) - WRITEUINT8(data_p, (data->mapvisited[i] & MV_MAX)); + P_WriteUINT8(&savebuffer, (data->mapvisited[i] & MV_MAX)); // To save space, use one bit per collected/achieved/unlocked flag for (i = 0; i < MAXEMBLEMS;) @@ -4677,7 +4672,7 @@ void G_SaveGameData(gamedata_t *data) btemp = 0; for (j = 0; j < 8 && j+i < MAXEMBLEMS; ++j) btemp |= (data->collected[j+i] << j); - WRITEUINT8(data_p, btemp); + P_WriteUINT8(&savebuffer, btemp); i += j; } for (i = 0; i < MAXEXTRAEMBLEMS;) @@ -4685,7 +4680,7 @@ void G_SaveGameData(gamedata_t *data) btemp = 0; for (j = 0; j < 8 && j+i < MAXEXTRAEMBLEMS; ++j) btemp |= (data->extraCollected[j+i] << j); - WRITEUINT8(data_p, btemp); + P_WriteUINT8(&savebuffer, btemp); i += j; } for (i = 0; i < MAXUNLOCKABLES;) @@ -4693,7 +4688,7 @@ void G_SaveGameData(gamedata_t *data) btemp = 0; for (j = 0; j < 8 && j+i < MAXUNLOCKABLES; ++j) btemp |= (data->unlocked[j+i] << j); - WRITEUINT8(data_p, btemp); + P_WriteUINT8(&savebuffer, btemp); i += j; } for (i = 0; i < MAXCONDITIONSETS;) @@ -4701,30 +4696,30 @@ void G_SaveGameData(gamedata_t *data) btemp = 0; for (j = 0; j < 8 && j+i < MAXCONDITIONSETS; ++j) btemp |= (data->achieved[j+i] << j); - WRITEUINT8(data_p, btemp); + P_WriteUINT8(&savebuffer, btemp); i += j; } - WRITEUINT32(data_p, data->timesBeaten); - WRITEUINT32(data_p, data->timesBeatenWithEmeralds); - WRITEUINT32(data_p, data->timesBeatenUltimate); + P_WriteUINT32(&savebuffer, data->timesBeaten); + P_WriteUINT32(&savebuffer, data->timesBeatenWithEmeralds); + P_WriteUINT32(&savebuffer, data->timesBeatenUltimate); // Main records for (i = 0; i < NUMMAPS; i++) { if (data->mainrecords[i]) { - WRITEUINT32(data_p, data->mainrecords[i]->score); - WRITEUINT32(data_p, data->mainrecords[i]->time); - WRITEUINT16(data_p, data->mainrecords[i]->rings); + P_WriteUINT32(&savebuffer, data->mainrecords[i]->score); + P_WriteUINT32(&savebuffer, data->mainrecords[i]->time); + P_WriteUINT16(&savebuffer, data->mainrecords[i]->rings); } else { - WRITEUINT32(data_p, 0); - WRITEUINT32(data_p, 0); - WRITEUINT16(data_p, 0); + P_WriteUINT32(&savebuffer, 0); + P_WriteUINT32(&savebuffer, 0); + P_WriteUINT16(&savebuffer, 0); } - WRITEUINT8(data_p, 0); // compat + P_WriteUINT8(&savebuffer, 0); // compat } // NiGHTS records @@ -4732,25 +4727,22 @@ void G_SaveGameData(gamedata_t *data) { if (!data->nightsrecords[i] || !data->nightsrecords[i]->nummares) { - WRITEUINT8(data_p, 0); + P_WriteUINT8(&savebuffer, 0); continue; } - WRITEUINT8(data_p, data->nightsrecords[i]->nummares); + P_WriteUINT8(&savebuffer, data->nightsrecords[i]->nummares); for (curmare = 0; curmare < (data->nightsrecords[i]->nummares + 1); ++curmare) { - WRITEUINT32(data_p, data->nightsrecords[i]->score[curmare]); - WRITEUINT8(data_p, data->nightsrecords[i]->grade[curmare]); - WRITEUINT32(data_p, data->nightsrecords[i]->time[curmare]); + P_WriteUINT32(&savebuffer, data->nightsrecords[i]->score[curmare]); + P_WriteUINT8(&savebuffer, data->nightsrecords[i]->grade[curmare]); + P_WriteUINT32(&savebuffer, data->nightsrecords[i]->time[curmare]); } } - length = data_p - savebuffer; - - FIL_WriteFile(va(pandf, srb2home, gamedatafilename), savebuffer, length); - free(savebuffer); - savebuffer = NULL; + FIL_WriteFile(va(pandf, srb2home, gamedatafilename), savebuffer.buf, savebuffer.pos); + free(savebuffer.buf); } #define VERSIONSIZE 16 @@ -4761,7 +4753,7 @@ void G_SaveGameData(gamedata_t *data) // void G_LoadGame(UINT32 slot, INT16 mapoverride) { - size_t length; + save_t savebuffer; char vcheck[VERSIONSIZE]; char savename[255]; @@ -4778,18 +4770,18 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) else sprintf(savename, savegamename, slot); - length = FIL_ReadFile(savename, &savebuffer); - if (!length) + savebuffer.size = FIL_ReadFile(savename, &savebuffer.buf); + if (!savebuffer.size) { CONS_Printf(M_GetText("Couldn't read file %s\n"), savename); return; } - save_p = savebuffer; + savebuffer.pos = 0; memset(vcheck, 0, sizeof (vcheck)); sprintf(vcheck, (marathonmode ? "back-up %d" : "version %d"), VERSION); - if (strcmp((const char *)save_p, (const char *)vcheck)) + if (strcmp((const char *)&savebuffer.buf[savebuffer.pos], (const char *)vcheck)) { #ifdef SAVEGAME_OTHERVERSIONS M_StartMessage(M_GetText("Save game from different version.\nYou can load this savegame, but\nsaving afterwards will be disabled.\n\nDo you want to continue anyway?\n\n(Press 'Y' to confirm)\n"), @@ -4799,15 +4791,14 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) M_ClearMenus(true); // so ESC backs out to title M_StartMessage(M_GetText("Save game from different version\n\nPress ESC\n"), NULL, MM_NOTHING); Command_ExitGame_f(); - Z_Free(savebuffer); - save_p = savebuffer = NULL; + Z_Free(savebuffer.buf); // no cheating! memset(&savedata, 0, sizeof(savedata)); #endif return; // bad version } - save_p += VERSIONSIZE; + savebuffer.pos += VERSIONSIZE; // if (demoplayback) // reset game engine // G_StopDemo(); @@ -4816,13 +4807,12 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) // automapactive = false; // dearchive all the modifications - if (!P_LoadGame(mapoverride)) + if (!P_LoadGame(&savebuffer, mapoverride)) { M_ClearMenus(true); // so ESC backs out to title M_StartMessage(M_GetText("Savegame file corrupted\n\nPress ESC\n"), NULL, MM_NOTHING); Command_ExitGame_f(); - Z_Free(savebuffer); - save_p = savebuffer = NULL; + Z_Free(savebuffer.buf); // no cheating! memset(&savedata, 0, sizeof(savedata)); @@ -4830,13 +4820,12 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) } if (marathonmode) { - marathontime = READUINT32(save_p); - marathonmode |= READUINT8(save_p); + marathontime = P_ReadUINT32(&savebuffer); + marathonmode |= P_ReadUINT8(&savebuffer); } // done - Z_Free(savebuffer); - save_p = savebuffer = NULL; + Z_Free(savebuffer.buf); displayplayer = consoleplayer; multiplayer = splitscreen = false; @@ -4854,6 +4843,7 @@ void G_LoadGame(UINT32 slot, INT16 mapoverride) // void G_SaveGame(UINT32 slot, INT16 mapnum) { + save_t savebuffer; boolean saved; char savename[256] = ""; const char *backup; @@ -4867,33 +4857,32 @@ void G_SaveGame(UINT32 slot, INT16 mapnum) gameaction = ga_nothing; { char name[VERSIONSIZE]; - size_t length; - save_p = savebuffer = (UINT8 *)malloc(SAVEGAMESIZE); - if (!save_p) + savebuffer.size = SAVEGAMESIZE; + savebuffer.buf = (UINT8 *)malloc(savebuffer.size); + if (!savebuffer.buf) { CONS_Alert(CONS_ERROR, M_GetText("No more free memory for saving game data\n")); return; } + savebuffer.pos = 0; memset(name, 0, sizeof (name)); sprintf(name, (marathonmode ? "back-up %d" : "version %d"), VERSION); - WRITEMEM(save_p, name, VERSIONSIZE); + P_WriteMem(&savebuffer, name, VERSIONSIZE); - P_SaveGame(mapnum); + P_SaveGame(&savebuffer, mapnum); if (marathonmode) { UINT32 writetime = marathontime; if (!(marathonmode & MA_INGAME)) writetime += TICRATE*5; // live event backup penalty because we don't know how long it takes to get to the next map - WRITEUINT32(save_p, writetime); - WRITEUINT8(save_p, (marathonmode & ~MA_INIT)); + P_WriteUINT32(&savebuffer, writetime); + P_WriteUINT8(&savebuffer, (marathonmode & ~MA_INIT)); } - length = save_p - savebuffer; - saved = FIL_WriteFile(backup, savebuffer, length); - free(savebuffer); - save_p = savebuffer = NULL; + saved = FIL_WriteFile(backup, savebuffer.buf, savebuffer.pos); + free(savebuffer.buf); } gameaction = ga_nothing; @@ -4905,11 +4894,10 @@ void G_SaveGame(UINT32 slot, INT16 mapnum) } #define BADSAVE goto cleanup; -#define CHECKPOS if (save_p >= end_p) BADSAVE void G_SaveGameOver(UINT32 slot, boolean modifylives) { + save_t savebuffer; boolean saved = false; - size_t length; char vcheck[VERSIONSIZE]; char savename[255]; const char *backup; @@ -4920,42 +4908,38 @@ void G_SaveGameOver(UINT32 slot, boolean modifylives) sprintf(savename, savegamename, slot); backup = va("%s",savename); - length = FIL_ReadFile(savename, &savebuffer); - if (!length) + savebuffer.size = FIL_ReadFile(savename, &savebuffer.buf); + if (!savebuffer.size) { CONS_Printf(M_GetText("Couldn't read file %s\n"), savename); return; } + savebuffer.pos = 0; + { char temp[sizeof(timeattackfolder)]; - UINT8 *end_p = savebuffer + length; UINT8 *lives_p; SINT8 pllives; #ifdef NEWSKINSAVES INT16 backwardsCompat = 0; #endif - save_p = savebuffer; // Version check memset(vcheck, 0, sizeof (vcheck)); sprintf(vcheck, (marathonmode ? "back-up %d" : "version %d"), VERSION); - if (strcmp((const char *)save_p, (const char *)vcheck)) BADSAVE - save_p += VERSIONSIZE; + if (strcmp((const char *)&savebuffer.buf[savebuffer.pos], (const char *)vcheck)) BADSAVE + savebuffer.pos += VERSIONSIZE; // P_UnArchiveMisc() - (void)READINT16(save_p); - CHECKPOS - (void)READUINT16(save_p); // emeralds - CHECKPOS - READSTRINGN(save_p, temp, sizeof(temp)); // mod it belongs to + (void)P_ReadINT16(&savebuffer); + (void)P_ReadUINT16(&savebuffer); // emeralds + P_ReadStringN(&savebuffer, temp, sizeof(temp)); // mod it belongs to if (strcmp(temp, timeattackfolder)) BADSAVE // P_UnArchivePlayer() - CHECKPOS #ifdef NEWSKINSAVES - backwardsCompat = READUINT16(save_p); - CHECKPOS + backwardsCompat = P_ReadUINT16(&savebuffer); if (backwardsCompat == NEWSKINSAVES) // New save, read skin names #endif @@ -4963,47 +4947,37 @@ void G_SaveGameOver(UINT32 slot, boolean modifylives) char ourSkinName[SKINNAMESIZE+1]; char botSkinName[SKINNAMESIZE+1]; - READSTRINGN(save_p, ourSkinName, SKINNAMESIZE); - CHECKPOS + P_ReadStringN(&savebuffer, ourSkinName, SKINNAMESIZE); - READSTRINGN(save_p, botSkinName, SKINNAMESIZE); - CHECKPOS + P_ReadStringN(&savebuffer, botSkinName, SKINNAMESIZE); } - WRITEUINT8(save_p, numgameovers); - CHECKPOS + P_WriteUINT8(&savebuffer, numgameovers); - lives_p = save_p; - pllives = READSINT8(save_p); // lives - CHECKPOS + lives_p = &savebuffer.buf[savebuffer.pos]; + pllives = P_ReadSINT8(&savebuffer); // lives if (modifylives && pllives < startinglivesbalance[numgameovers]) { - pllives = startinglivesbalance[numgameovers]; - WRITESINT8(lives_p, pllives); + *lives_p = startinglivesbalance[numgameovers]; } - (void)READINT32(save_p); // Score - CHECKPOS - (void)READINT32(save_p); // continues + (void)P_ReadINT32(&savebuffer); // Score + (void)P_ReadINT32(&savebuffer); // continues // File end marker check - CHECKPOS - switch (READUINT8(save_p)) + switch (P_ReadUINT8(&savebuffer)) { case 0xb7: { UINT8 i, banksinuse; - CHECKPOS - banksinuse = READUINT8(save_p); - CHECKPOS + banksinuse = P_ReadUINT8(&savebuffer); if (banksinuse > NUM_LUABANKS) BADSAVE for (i = 0; i < banksinuse; i++) { - (void)READINT32(save_p); - CHECKPOS + (void)P_ReadINT32(&savebuffer); } - if (READUINT8(save_p) != 0x1d) + if (P_ReadUINT8(&savebuffer) != 0x1d) BADSAVE } case 0x1d: @@ -5013,7 +4987,7 @@ void G_SaveGameOver(UINT32 slot, boolean modifylives) } // done - saved = FIL_WriteFile(backup, savebuffer, length); + saved = FIL_WriteFile(backup, savebuffer.buf, savebuffer.size); } cleanup: @@ -5021,11 +4995,9 @@ cleanup: CONS_Printf(M_GetText("Game saved.\n")); else if (!saved) CONS_Alert(CONS_ERROR, M_GetText("Error while writing to %s for save slot %u, base: %s\n"), backup, slot, (marathonmode ? liveeventbackup : savegamename)); - Z_Free(savebuffer); - save_p = savebuffer = NULL; + Z_Free(savebuffer.buf); } -#undef CHECKPOS #undef BADSAVE // diff --git a/src/lua_script.c b/src/lua_script.c index 057899555..51808977f 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -1098,7 +1098,7 @@ static UINT8 GetUserdataArchType(int index) return ARCH_NULL; } -static UINT8 ArchiveValue(int TABLESINDEX, int myindex) +static UINT8 ArchiveValue(save_t *save_p, int TABLESINDEX, int myindex) { if (myindex < 0) myindex = lua_gettop(gL)+1+myindex; @@ -1106,34 +1106,34 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { case LUA_TNONE: case LUA_TNIL: - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); break; // This might be a problem. D: case LUA_TLIGHTUSERDATA: case LUA_TTHREAD: case LUA_TFUNCTION: - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); return 2; case LUA_TBOOLEAN: - WRITEUINT8(save_p, lua_toboolean(gL, myindex) ? ARCH_TRUE : ARCH_FALSE); + P_WriteUINT8(save_p, lua_toboolean(gL, myindex) ? ARCH_TRUE : ARCH_FALSE); break; case LUA_TNUMBER: { lua_Integer number = lua_tointeger(gL, myindex); if (number >= INT8_MIN && number <= INT8_MAX) { - WRITEUINT8(save_p, ARCH_INT8); - WRITESINT8(save_p, number); + P_WriteUINT8(save_p, ARCH_INT8); + P_WriteSINT8(save_p, number); } else if (number >= INT16_MIN && number <= INT16_MAX) { - WRITEUINT8(save_p, ARCH_INT16); - WRITEINT16(save_p, number); + P_WriteUINT8(save_p, ARCH_INT16); + P_WriteINT16(save_p, number); } else { - WRITEUINT8(save_p, ARCH_INT32); - WRITEFIXED(save_p, number); + P_WriteUINT8(save_p, ARCH_INT32); + P_WriteFixed(save_p, number); } break; } @@ -1144,23 +1144,23 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) UINT32 i = 0; // if you're wondering why we're writing a string to save_p this way, // it turns out that Lua can have embedded zeros ('\0') in the strings, - // so we can't use WRITESTRING as that cuts off when it finds a '\0'. + // so we can't use P_WriteString as that cuts off when it finds a '\0'. // Saving the size of the string also allows us to get the size of the string on the other end, // fixing the awful crashes previously encountered for reading strings longer than 1024 // (yes I know that's kind of a stupid thing to care about, but it'd be evil to trim or ignore them?) // -- Monster Iestyn 05/08/18 if (len < 255) { - WRITEUINT8(save_p, ARCH_SMALLSTRING); - WRITEUINT8(save_p, len); // save size of string + P_WriteUINT8(save_p, ARCH_SMALLSTRING); + P_WriteUINT8(save_p, len); // save size of string } else { - WRITEUINT8(save_p, ARCH_LARGESTRING); - WRITEUINT32(save_p, len); // save size of string + P_WriteUINT8(save_p, ARCH_LARGESTRING); + P_WriteUINT32(save_p, len); // save size of string } while (i < len) - WRITECHAR(save_p, s[i++]); // write chars individually, including the embedded zeros + P_WriteChar(save_p, s[i++]); // write chars individually, including the embedded zeros break; } case LUA_TTABLE: @@ -1186,13 +1186,13 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) if (t == 0) { CONS_Alert(CONS_ERROR, "Too many tables to archive!\n"); - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); return 0; } } - WRITEUINT8(save_p, ARCH_TABLE); - WRITEUINT16(save_p, t); + P_WriteUINT8(save_p, ARCH_TABLE); + P_WriteUINT16(save_p, t); if (!found) { @@ -1208,25 +1208,25 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) case ARCH_MOBJINFO: { mobjinfo_t *info = *((mobjinfo_t **)lua_touserdata(gL, myindex)); - WRITEUINT8(save_p, ARCH_MOBJINFO); - WRITEUINT16(save_p, info - mobjinfo); + P_WriteUINT8(save_p, ARCH_MOBJINFO); + P_WriteUINT16(save_p, info - mobjinfo); break; } case ARCH_STATE: { state_t *state = *((state_t **)lua_touserdata(gL, myindex)); - WRITEUINT8(save_p, ARCH_STATE); - WRITEUINT16(save_p, state - states); + P_WriteUINT8(save_p, ARCH_STATE); + P_WriteUINT16(save_p, state - states); break; } case ARCH_MOBJ: { mobj_t *mobj = *((mobj_t **)lua_touserdata(gL, myindex)); if (!mobj) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_MOBJ); - WRITEUINT32(save_p, mobj->mobjnum); + P_WriteUINT8(save_p, ARCH_MOBJ); + P_WriteUINT32(save_p, mobj->mobjnum); } break; } @@ -1234,10 +1234,10 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { player_t *player = *((player_t **)lua_touserdata(gL, myindex)); if (!player) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_PLAYER); - WRITEUINT8(save_p, player - players); + P_WriteUINT8(save_p, ARCH_PLAYER); + P_WriteUINT8(save_p, player - players); } break; } @@ -1245,10 +1245,10 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { mapthing_t *mapthing = *((mapthing_t **)lua_touserdata(gL, myindex)); if (!mapthing) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_MAPTHING); - WRITEUINT16(save_p, mapthing - mapthings); + P_WriteUINT8(save_p, ARCH_MAPTHING); + P_WriteUINT16(save_p, mapthing - mapthings); } break; } @@ -1256,10 +1256,10 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { vertex_t *vertex = *((vertex_t **)lua_touserdata(gL, myindex)); if (!vertex) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_VERTEX); - WRITEUINT16(save_p, vertex - vertexes); + P_WriteUINT8(save_p, ARCH_VERTEX); + P_WriteUINT16(save_p, vertex - vertexes); } break; } @@ -1267,10 +1267,10 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { line_t *line = *((line_t **)lua_touserdata(gL, myindex)); if (!line) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_LINE); - WRITEUINT16(save_p, line - lines); + P_WriteUINT8(save_p, ARCH_LINE); + P_WriteUINT16(save_p, line - lines); } break; } @@ -1278,10 +1278,10 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { side_t *side = *((side_t **)lua_touserdata(gL, myindex)); if (!side) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_SIDE); - WRITEUINT16(save_p, side - sides); + P_WriteUINT8(save_p, ARCH_SIDE); + P_WriteUINT16(save_p, side - sides); } break; } @@ -1289,10 +1289,10 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { subsector_t *subsector = *((subsector_t **)lua_touserdata(gL, myindex)); if (!subsector) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_SUBSECTOR); - WRITEUINT16(save_p, subsector - subsectors); + P_WriteUINT8(save_p, ARCH_SUBSECTOR); + P_WriteUINT16(save_p, subsector - subsectors); } break; } @@ -1300,10 +1300,10 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { sector_t *sector = *((sector_t **)lua_touserdata(gL, myindex)); if (!sector) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_SECTOR); - WRITEUINT16(save_p, sector - sectors); + P_WriteUINT8(save_p, ARCH_SECTOR); + P_WriteUINT16(save_p, sector - sectors); } break; } @@ -1312,10 +1312,10 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { seg_t *seg = *((seg_t **)lua_touserdata(gL, myindex)); if (!seg) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_SEG); - WRITEUINT16(save_p, seg - segs); + P_WriteUINT8(save_p, ARCH_SEG); + P_WriteUINT16(save_p, seg - segs); } break; } @@ -1323,10 +1323,10 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { node_t *node = *((node_t **)lua_touserdata(gL, myindex)); if (!node) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_NODE); - WRITEUINT16(save_p, node - nodes); + P_WriteUINT8(save_p, ARCH_NODE); + P_WriteUINT16(save_p, node - nodes); } break; } @@ -1335,16 +1335,16 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { ffloor_t *rover = *((ffloor_t **)lua_touserdata(gL, myindex)); if (!rover) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { UINT16 i = P_GetFFloorID(rover); if (i == UINT16_MAX) // invalid ID - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_FFLOOR); - WRITEUINT16(save_p, rover->target - sectors); - WRITEUINT16(save_p, i); + P_WriteUINT8(save_p, ARCH_FFLOOR); + P_WriteUINT16(save_p, rover->target - sectors); + P_WriteUINT16(save_p, i); } } break; @@ -1353,10 +1353,10 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { polyobj_t *polyobj = *((polyobj_t **)lua_touserdata(gL, myindex)); if (!polyobj) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_POLYOBJ); - WRITEUINT16(save_p, polyobj-PolyObjects); + P_WriteUINT8(save_p, ARCH_POLYOBJ); + P_WriteUINT16(save_p, polyobj-PolyObjects); } break; } @@ -1364,10 +1364,10 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { pslope_t *slope = *((pslope_t **)lua_touserdata(gL, myindex)); if (!slope) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_SLOPE); - WRITEUINT16(save_p, slope->id); + P_WriteUINT8(save_p, ARCH_SLOPE); + P_WriteUINT16(save_p, slope->id); } break; } @@ -1375,36 +1375,36 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) { mapheader_t *header = *((mapheader_t **)lua_touserdata(gL, myindex)); if (!header) - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); else { - WRITEUINT8(save_p, ARCH_MAPHEADER); - WRITEUINT16(save_p, header - *mapheaderinfo); + P_WriteUINT8(save_p, ARCH_MAPHEADER); + P_WriteUINT16(save_p, header - *mapheaderinfo); } break; } case ARCH_SKINCOLOR: { skincolor_t *info = *((skincolor_t **)lua_touserdata(gL, myindex)); - WRITEUINT8(save_p, ARCH_SKINCOLOR); - WRITEUINT16(save_p, info - skincolors); + P_WriteUINT8(save_p, ARCH_SKINCOLOR); + P_WriteUINT16(save_p, info - skincolors); break; } case ARCH_MOUSE: { mouse_t *m = *((mouse_t **)lua_touserdata(gL, myindex)); - WRITEUINT8(save_p, ARCH_MOUSE); - WRITEUINT8(save_p, m == &mouse ? 1 : 2); + P_WriteUINT8(save_p, ARCH_MOUSE); + P_WriteUINT8(save_p, m == &mouse ? 1 : 2); break; } case ARCH_SKIN: { skin_t *skin = *((skin_t **)lua_touserdata(gL, myindex)); - WRITEUINT8(save_p, ARCH_SKIN); - WRITEUINT8(save_p, skin->skinnum); // UINT8 because MAXSKINS must be <= 256 + P_WriteUINT8(save_p, ARCH_SKIN); + P_WriteUINT8(save_p, skin->skinnum); // UINT8 because MAXSKINS must be <= 256 break; } default: - WRITEUINT8(save_p, ARCH_NULL); + P_WriteUINT8(save_p, ARCH_NULL); return 2; } break; @@ -1412,14 +1412,14 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex) return 0; } -static void ArchiveExtVars(void *pointer, const char *ptype) +static void ArchiveExtVars(save_t *save_p, void *pointer, const char *ptype) { int TABLESINDEX; UINT16 i; if (!gL) { if (fastcmp(ptype,"player")) // players must always be included, even if no vars - WRITEUINT16(save_p, 0); + P_WriteUINT16(save_p, 0); return; } @@ -1435,7 +1435,7 @@ static void ArchiveExtVars(void *pointer, const char *ptype) { // no extra values table lua_pop(gL, 1); if (fastcmp(ptype,"player")) // players must always be included, even if no vars - WRITEUINT16(save_p, 0); + P_WriteUINT16(save_p, 0); return; } @@ -1447,20 +1447,20 @@ static void ArchiveExtVars(void *pointer, const char *ptype) if (i == 0) { if (fastcmp(ptype,"player")) // always include players even if they have no extra variables - WRITEUINT16(save_p, 0); + P_WriteUINT16(save_p, 0); lua_pop(gL, 1); return; } if (fastcmp(ptype,"mobj")) // mobjs must write their mobjnum as a header - WRITEUINT32(save_p, ((mobj_t *)pointer)->mobjnum); - WRITEUINT16(save_p, i); + P_WriteUINT32(save_p, ((mobj_t *)pointer)->mobjnum); + P_WriteUINT16(save_p, i); lua_pushnil(gL); while (lua_next(gL, -2)) { I_Assert(lua_type(gL, -2) == LUA_TSTRING); - WRITESTRING(save_p, lua_tostring(gL, -2)); - if (ArchiveValue(TABLESINDEX, -1) == 2) + P_WriteString(save_p, lua_tostring(gL, -2)); + if (ArchiveValue(save_p, TABLESINDEX, -1) == 2) CONS_Alert(CONS_ERROR, "Type of value for %s entry '%s' (%s) could not be archived!\n", ptype, lua_tostring(gL, -2), luaL_typename(gL, -1)); lua_pop(gL, 1); } @@ -1468,16 +1468,19 @@ static void ArchiveExtVars(void *pointer, const char *ptype) lua_pop(gL, 1); } +// FIXME: remove and pass as local variable +static save_t *lua_save_p; + static int NetArchive(lua_State *L) { int TABLESINDEX = lua_upvalueindex(1); int i, n = lua_gettop(L); for (i = 1; i <= n; i++) - ArchiveValue(TABLESINDEX, i); + ArchiveValue(lua_save_p, TABLESINDEX, i); return n; } -static void ArchiveTables(void) +static void ArchiveTables(save_t *save_p) { int TABLESINDEX; UINT16 i, n; @@ -1496,14 +1499,14 @@ static void ArchiveTables(void) while (lua_next(gL, -2)) { // Write key - e = ArchiveValue(TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this. + e = ArchiveValue(save_p, TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this. if (e == 1) n++; // the table contained a new table we'll have to archive. :( else if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise) CONS_Alert(CONS_ERROR, "Index '%s' (%s) of table %d could not be archived!\n", lua_tostring(gL, -2), luaL_typename(gL, -2), i); // Write value - e = ArchiveValue(TABLESINDEX, -1); + e = ArchiveValue(save_p, TABLESINDEX, -1); if (e == 1) n++; // the table contained a new table we'll have to archive. :( else if (e == 2) // invalid value type @@ -1511,7 +1514,7 @@ static void ArchiveTables(void) lua_pop(gL, 1); } - WRITEUINT8(save_p, ARCH_TEND); + P_WriteUINT8(save_p, ARCH_TEND); // Write metatable ID if (lua_getmetatable(gL, -1)) @@ -1520,19 +1523,19 @@ static void ArchiveTables(void) lua_getfield(gL, LUA_REGISTRYINDEX, LREG_METATABLES); lua_pushvalue(gL, -2); lua_gettable(gL, -2); - WRITEUINT16(save_p, lua_isnil(gL, -1) ? 0 : lua_tointeger(gL, -1)); + P_WriteUINT16(save_p, lua_isnil(gL, -1) ? 0 : lua_tointeger(gL, -1)); lua_pop(gL, 3); } else - WRITEUINT16(save_p, 0); + P_WriteUINT16(save_p, 0); lua_pop(gL, 1); } } -static UINT8 UnArchiveValue(int TABLESINDEX) +static UINT8 UnArchiveValue(save_t *save_p, int TABLESINDEX) { - UINT8 type = READUINT8(save_p); + UINT8 type = P_ReadUINT8(save_p); switch (type) { case ARCH_NULL: @@ -1545,13 +1548,13 @@ static UINT8 UnArchiveValue(int TABLESINDEX) lua_pushboolean(gL, false); break; case ARCH_INT8: - lua_pushinteger(gL, READSINT8(save_p)); + lua_pushinteger(gL, P_ReadSINT8(save_p)); break; case ARCH_INT16: - lua_pushinteger(gL, READINT16(save_p)); + lua_pushinteger(gL, P_ReadINT16(save_p)); break; case ARCH_INT32: - lua_pushinteger(gL, READFIXED(save_p)); + lua_pushinteger(gL, P_ReadFixed(save_p)); break; case ARCH_SMALLSTRING: case ARCH_LARGESTRING: @@ -1562,23 +1565,23 @@ static UINT8 UnArchiveValue(int TABLESINDEX) // See my comments in the ArchiveValue function; // it's much the same for reading strings as writing them! - // (i.e. we can't use READSTRING either) + // (i.e. we can't use P_ReadString either) // -- Monster Iestyn 05/08/18 if (type == ARCH_SMALLSTRING) - len = READUINT8(save_p); // length of string, including embedded zeros + len = P_ReadUINT8(save_p); // length of string, including embedded zeros else - len = READUINT32(save_p); // length of string, including embedded zeros + len = P_ReadUINT32(save_p); // length of string, including embedded zeros value = malloc(len); // make temp buffer of size len // now read the actual string while (i < len) - value[i++] = READCHAR(save_p); // read chars individually, including the embedded zeros + value[i++] = P_ReadChar(save_p); // read chars individually, including the embedded zeros lua_pushlstring(gL, value, len); // push the string (note: this function supports embedded zeros) free(value); // free the buffer break; } case ARCH_TABLE: { - UINT16 tid = READUINT16(save_p); + UINT16 tid = P_ReadUINT16(save_p); lua_rawgeti(gL, TABLESINDEX, tid); if (lua_isnil(gL, -1)) { @@ -1591,69 +1594,69 @@ static UINT8 UnArchiveValue(int TABLESINDEX) break; } case ARCH_MOBJINFO: - LUA_PushUserdata(gL, &mobjinfo[READUINT16(save_p)], META_MOBJINFO); + LUA_PushUserdata(gL, &mobjinfo[P_ReadUINT16(save_p)], META_MOBJINFO); break; case ARCH_STATE: - LUA_PushUserdata(gL, &states[READUINT16(save_p)], META_STATE); + LUA_PushUserdata(gL, &states[P_ReadUINT16(save_p)], META_STATE); break; case ARCH_MOBJ: - LUA_PushUserdata(gL, P_FindNewPosition(READUINT32(save_p)), META_MOBJ); + LUA_PushUserdata(gL, P_FindNewPosition(P_ReadUINT32(save_p)), META_MOBJ); break; case ARCH_PLAYER: - LUA_PushUserdata(gL, &players[READUINT8(save_p)], META_PLAYER); + LUA_PushUserdata(gL, &players[P_ReadUINT8(save_p)], META_PLAYER); break; case ARCH_MAPTHING: - LUA_PushUserdata(gL, &mapthings[READUINT16(save_p)], META_MAPTHING); + LUA_PushUserdata(gL, &mapthings[P_ReadUINT16(save_p)], META_MAPTHING); break; case ARCH_VERTEX: - LUA_PushUserdata(gL, &vertexes[READUINT16(save_p)], META_VERTEX); + LUA_PushUserdata(gL, &vertexes[P_ReadUINT16(save_p)], META_VERTEX); break; case ARCH_LINE: - LUA_PushUserdata(gL, &lines[READUINT16(save_p)], META_LINE); + LUA_PushUserdata(gL, &lines[P_ReadUINT16(save_p)], META_LINE); break; case ARCH_SIDE: - LUA_PushUserdata(gL, &sides[READUINT16(save_p)], META_SIDE); + LUA_PushUserdata(gL, &sides[P_ReadUINT16(save_p)], META_SIDE); break; case ARCH_SUBSECTOR: - LUA_PushUserdata(gL, &subsectors[READUINT16(save_p)], META_SUBSECTOR); + LUA_PushUserdata(gL, &subsectors[P_ReadUINT16(save_p)], META_SUBSECTOR); break; case ARCH_SECTOR: - LUA_PushUserdata(gL, §ors[READUINT16(save_p)], META_SECTOR); + LUA_PushUserdata(gL, §ors[P_ReadUINT16(save_p)], META_SECTOR); break; #ifdef HAVE_LUA_SEGS case ARCH_SEG: - LUA_PushUserdata(gL, &segs[READUINT16(save_p)], META_SEG); + LUA_PushUserdata(gL, &segs[P_ReadUINT16(save_p)], META_SEG); break; case ARCH_NODE: - LUA_PushUserdata(gL, &nodes[READUINT16(save_p)], META_NODE); + LUA_PushUserdata(gL, &nodes[P_ReadUINT16(save_p)], META_NODE); break; #endif case ARCH_FFLOOR: { - sector_t *sector = §ors[READUINT16(save_p)]; - UINT16 id = READUINT16(save_p); + sector_t *sector = §ors[P_ReadUINT16(save_p)]; + UINT16 id = P_ReadUINT16(save_p); ffloor_t *rover = P_GetFFloorByID(sector, id); if (rover) LUA_PushUserdata(gL, rover, META_FFLOOR); break; } case ARCH_POLYOBJ: - LUA_PushUserdata(gL, &PolyObjects[READUINT16(save_p)], META_POLYOBJ); + LUA_PushUserdata(gL, &PolyObjects[P_ReadUINT16(save_p)], META_POLYOBJ); break; case ARCH_SLOPE: - LUA_PushUserdata(gL, P_SlopeById(READUINT16(save_p)), META_SLOPE); + LUA_PushUserdata(gL, P_SlopeById(P_ReadUINT16(save_p)), META_SLOPE); break; case ARCH_MAPHEADER: - LUA_PushUserdata(gL, mapheaderinfo[READUINT16(save_p)], META_MAPHEADER); + LUA_PushUserdata(gL, mapheaderinfo[P_ReadUINT16(save_p)], META_MAPHEADER); break; case ARCH_SKINCOLOR: - LUA_PushUserdata(gL, &skincolors[READUINT16(save_p)], META_SKINCOLOR); + LUA_PushUserdata(gL, &skincolors[P_ReadUINT16(save_p)], META_SKINCOLOR); break; case ARCH_MOUSE: - LUA_PushUserdata(gL, READUINT16(save_p) == 1 ? &mouse : &mouse2, META_MOUSE); + LUA_PushUserdata(gL, P_ReadUINT16(save_p) == 1 ? &mouse : &mouse2, META_MOUSE); break; case ARCH_SKIN: - LUA_PushUserdata(gL, skins[READUINT8(save_p)], META_SKIN); + LUA_PushUserdata(gL, skins[P_ReadUINT8(save_p)], META_SKIN); break; case ARCH_TEND: return 1; @@ -1661,10 +1664,10 @@ static UINT8 UnArchiveValue(int TABLESINDEX) return 0; } -static void UnArchiveExtVars(void *pointer) +static void UnArchiveExtVars(save_t *save_p, void *pointer) { int TABLESINDEX; - UINT16 field_count = READUINT16(save_p); + UINT16 field_count = P_ReadUINT16(save_p); UINT16 i; char field[1024]; @@ -1677,8 +1680,8 @@ static void UnArchiveExtVars(void *pointer) for (i = 0; i < field_count; i++) { - READSTRING(save_p, field); - UnArchiveValue(TABLESINDEX); + P_ReadString(save_p, field); + UnArchiveValue(save_p, TABLESINDEX); lua_setfield(gL, -2, field); } @@ -1695,11 +1698,11 @@ static int NetUnArchive(lua_State *L) int TABLESINDEX = lua_upvalueindex(1); int i, n = lua_gettop(L); for (i = 1; i <= n; i++) - UnArchiveValue(TABLESINDEX); + UnArchiveValue(lua_save_p, TABLESINDEX); return n; } -static void UnArchiveTables(void) +static void UnArchiveTables(save_t *save_p) { int TABLESINDEX; UINT16 i, n; @@ -1716,13 +1719,13 @@ static void UnArchiveTables(void) lua_rawgeti(gL, TABLESINDEX, i); while (true) { - UINT8 e = UnArchiveValue(TABLESINDEX); // read key + UINT8 e = UnArchiveValue(save_p, TABLESINDEX); // read key if (e == 1) // End of table break; else if (e == 2) // Key contains a new table n++; - if (UnArchiveValue(TABLESINDEX) == 2) // read value + if (UnArchiveValue(save_p, TABLESINDEX) == 2) // read value n++; if (lua_isnil(gL, -2)) // if key is nil (if a function etc was accidentally saved) @@ -1734,7 +1737,7 @@ static void UnArchiveTables(void) lua_rawset(gL, -3); } - metatableid = READUINT16(save_p); + metatableid = P_ReadUINT16(save_p); if (metatableid) { // setmetatable(table, registry.metatables[metatableid]) @@ -1758,7 +1761,7 @@ void LUA_Step(void) lua_gc(gL, LUA_GCSTEP, 1); } -void LUA_Archive(void) +void LUA_Archive(save_t *save_p) { INT32 i; thinker_t *th; @@ -1771,7 +1774,7 @@ void LUA_Archive(void) if (!playeringame[i] && i > 0) // dedicated servers... continue; // all players in game will be archived, even if they just add a 0. - ArchiveExtVars(&players[i], "player"); + ArchiveExtVars(save_p, &players[i], "player"); } for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) @@ -1781,19 +1784,20 @@ void LUA_Archive(void) // archive function will determine when to skip mobjs, // and write mobjnum in otherwise. - ArchiveExtVars(th, "mobj"); + ArchiveExtVars(save_p, th, "mobj"); } - WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum. + P_WriteUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum. + lua_save_p = save_p; LUA_HookNetArchive(NetArchive); // call the NetArchive hook in archive mode - ArchiveTables(); + ArchiveTables(save_p); if (gL) lua_pop(gL, 1); // pop tables } -void LUA_UnArchive(void) +void LUA_UnArchive(save_t *save_p) { UINT32 mobjnum; INT32 i; @@ -1806,23 +1810,24 @@ void LUA_UnArchive(void) { if (!playeringame[i] && i > 0) // dedicated servers... continue; - UnArchiveExtVars(&players[i]); + UnArchiveExtVars(save_p, &players[i]); } do { - mobjnum = READUINT32(save_p); // read a mobjnum + mobjnum = P_ReadUINT32(save_p); // read a mobjnum for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) continue; if (((mobj_t *)th)->mobjnum != mobjnum) // find matching mobj continue; - UnArchiveExtVars(th); // apply variables + UnArchiveExtVars(save_p, th); // apply variables } } while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker. + lua_save_p = save_p; LUA_HookNetArchive(NetUnArchive); // call the NetArchive hook in unarchive mode - UnArchiveTables(); + UnArchiveTables(save_p); if (gL) lua_pop(gL, 1); // pop tables diff --git a/src/lua_script.h b/src/lua_script.h index 45d2a37ff..968ef078d 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -13,6 +13,7 @@ #ifndef LUA_SCRIPT_H #define LUA_SCRIPT_H +#include "p_saveg.h" #include "m_fixed.h" #include "doomtype.h" #include "d_player.h" @@ -52,8 +53,8 @@ void LUA_DumpFile(const char *filename); #endif fixed_t LUA_EvalMath(const char *word); void LUA_Step(void); -void LUA_Archive(void); -void LUA_UnArchive(void); +void LUA_Archive(save_t *save_p); +void LUA_UnArchive(save_t *save_p); int LUA_PushGlobals(lua_State *L, const char *word); int LUA_CheckGlobals(lua_State *L, const char *word); void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index 4134c633e..64feeeda3 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -4799,12 +4799,11 @@ static void Command_Togglemodified_f(void) modifiedgame = !modifiedgame; } -extern UINT8 *save_p; static void Command_Archivetest_f(void) { - UINT8 *buf; UINT32 i, wrote; thinker_t *th; + save_t savebuffer; if (gamestate != GS_LEVEL) { CONS_Printf("This command only works in-game, you dummy.\n"); @@ -4818,28 +4817,29 @@ static void Command_Archivetest_f(void) ((mobj_t *)th)->mobjnum = i++; // allocate buffer - buf = save_p = ZZ_Alloc(1024); + savebuffer.size = 1024; + savebuffer.buf = malloc(savebuffer.size); + savebuffer.pos = 0; // test archive CONS_Printf("LUA_Archive...\n"); - LUA_Archive(); - WRITEUINT8(save_p, 0x7F); - wrote = (UINT32)(save_p-buf); + LUA_Archive(&savebuffer); + P_WriteUINT8(&savebuffer, 0x7F); + wrote = savebuffer.pos; // clear Lua state, so we can really see what happens! CONS_Printf("Clearing state!\n"); LUA_ClearExtVars(); // test unarchive - save_p = buf; CONS_Printf("LUA_UnArchive...\n"); - LUA_UnArchive(); - i = READUINT8(save_p); - if (i != 0x7F || wrote != (UINT32)(save_p-buf)) - CONS_Printf("Savegame corrupted. (write %u, read %u)\n", wrote, (UINT32)(save_p-buf)); + LUA_UnArchive(&savebuffer); + i = P_ReadUINT8(&savebuffer); + if (i != 0x7F || wrote != (UINT32)(savebuffer.pos)) + CONS_Printf("Savegame corrupted. (write %u, read %u)\n", wrote, (UINT32)(savebuffer.pos)); // free buffer - Z_Free(buf); + free(savebuffer.buf); CONS_Printf("Done. No crash.\n"); } #endif diff --git a/src/netcode/gamestate.c b/src/netcode/gamestate.c index f36347c6d..fbc2b4ca7 100644 --- a/src/netcode/gamestate.c +++ b/src/netcode/gamestate.c @@ -54,30 +54,25 @@ boolean SV_ResendingSavegameToAnyone(void) void SV_SendSaveGame(INT32 node, boolean resending) { size_t length, compressedlen; - UINT8 *savebuffer; + save_t savebuffer; UINT8 *compressedsave; UINT8 *buffertosend; // first save it in a malloced buffer - savebuffer = (UINT8 *)malloc(SAVEGAMESIZE); - if (!savebuffer) + savebuffer.size = SAVEGAMESIZE; + savebuffer.buf = (UINT8 *)malloc(savebuffer.size); + if (!savebuffer.buf) { CONS_Alert(CONS_ERROR, M_GetText("No more free memory for savegame\n")); return; } // Leave room for the uncompressed length. - save_p = savebuffer + sizeof(UINT32); + savebuffer.pos = sizeof(UINT32); - P_SaveNetGame(resending); + P_SaveNetGame(&savebuffer, resending); - length = save_p - savebuffer; - if (length > SAVEGAMESIZE) - { - free(savebuffer); - save_p = NULL; - I_Error("Savegame buffer overrun"); - } + length = savebuffer.pos; // Allocate space for compressed save: one byte fewer than for the // uncompressed data to ensure that the compression is worthwhile. @@ -89,11 +84,11 @@ void SV_SendSaveGame(INT32 node, boolean resending) } // Attempt to compress it. - if((compressedlen = lzf_compress(savebuffer + sizeof(UINT32), length - sizeof(UINT32), compressedsave + sizeof(UINT32), length - sizeof(UINT32) - 1))) + if((compressedlen = lzf_compress(savebuffer.buf + sizeof(UINT32), length - sizeof(UINT32), compressedsave + sizeof(UINT32), length - sizeof(UINT32) - 1))) { // Compressing succeeded; send compressed data - free(savebuffer); + free(savebuffer.buf); // State that we're compressed. buffertosend = compressedsave; @@ -107,12 +102,12 @@ void SV_SendSaveGame(INT32 node, boolean resending) free(compressedsave); // State that we're not compressed - buffertosend = savebuffer; - WRITEUINT32(savebuffer, 0); + buffertosend = savebuffer.buf; + savebuffer.pos = 0; + P_WriteUINT32(&savebuffer, 0); } AddRamToSendQueue(node, buffertosend, length, SF_RAM, 0); - save_p = NULL; // Remember when we started sending the savegame so we can handle timeouts netnodes[node].sendingsavegame = true; @@ -125,8 +120,7 @@ static consvar_t cv_dumpconsistency = CVAR_INIT ("dumpconsistency", "Off", CV_SA void SV_SavedGame(void) { - size_t length; - UINT8 *savebuffer; + save_t savebuffer; char tmpsave[256]; if (!cv_dumpconsistency.value) @@ -135,29 +129,22 @@ void SV_SavedGame(void) sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home); // first save it in a malloced buffer - save_p = savebuffer = (UINT8 *)malloc(SAVEGAMESIZE); - if (!save_p) + savebuffer.size = SAVEGAMESIZE; + savebuffer.buf = (UINT8 *)malloc(savebuffer.size); + if (!savebuffer.buf) { CONS_Alert(CONS_ERROR, M_GetText("No more free memory for savegame\n")); return; } + savebuffer.pos = 0; - P_SaveNetGame(false); - - length = save_p - savebuffer; - if (length > SAVEGAMESIZE) - { - free(savebuffer); - save_p = NULL; - I_Error("Savegame buffer overrun"); - } + P_SaveNetGame(&savebuffer, false); // then save it! - if (!FIL_WriteFile(tmpsave, savebuffer, length)) + if (!FIL_WriteFile(tmpsave, savebuffer.buf, savebuffer.pos)) CONS_Printf(M_GetText("Didn't save %s for netgame"), tmpsave); - free(savebuffer); - save_p = NULL; + free(savebuffer.pos); } #undef TMPSAVENAME @@ -167,33 +154,34 @@ void SV_SavedGame(void) void CL_LoadReceivedSavegame(boolean reloading) { - UINT8 *savebuffer = NULL; - size_t length, decompressedlen; + save_t savebuffer; + size_t decompressedlen; char tmpsave[256]; FreeFileNeeded(); sprintf(tmpsave, "%s" PATHSEP TMPSAVENAME, srb2home); - length = FIL_ReadFile(tmpsave, &savebuffer); + savebuffer.size = FIL_ReadFile(tmpsave, &savebuffer.buf); + savebuffer.pos = 0; - CONS_Printf(M_GetText("Loading savegame length %s\n"), sizeu1(length)); - if (!length) + CONS_Printf(M_GetText("Loading savegame length %s\n"), sizeu1(savebuffer.size)); + if (!savebuffer.size) { I_Error("Can't read savegame sent"); return; } - save_p = savebuffer; - // Decompress saved game if necessary. - decompressedlen = READUINT32(save_p); + decompressedlen = P_ReadUINT32(&savebuffer); if(decompressedlen > 0) { UINT8 *decompressedbuffer = Z_Malloc(decompressedlen, PU_STATIC, NULL); - lzf_decompress(save_p, length - sizeof(UINT32), decompressedbuffer, decompressedlen); - Z_Free(savebuffer); - save_p = savebuffer = decompressedbuffer; + lzf_decompress(savebuffer.buf + sizeof(UINT32), savebuffer.size - sizeof(UINT32), decompressedbuffer, decompressedlen); + Z_Free(savebuffer.buf); + savebuffer.buf = decompressedbuffer; + savebuffer.size = decompressedlen; + savebuffer.pos = 0; } paused = false; @@ -203,7 +191,7 @@ void CL_LoadReceivedSavegame(boolean reloading) automapactive = false; // load a base level - if (P_LoadNetGame(reloading)) + if (P_LoadNetGame(&savebuffer, reloading)) { const UINT8 actnum = mapheaderinfo[gamemap-1]->actnum; CONS_Printf(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap)); @@ -219,8 +207,7 @@ void CL_LoadReceivedSavegame(boolean reloading) } // done - Z_Free(savebuffer); - save_p = NULL; + Z_Free(savebuffer.buf); if (unlink(tmpsave) == -1) CONS_Alert(CONS_ERROR, M_GetText("Can't delete %s\n"), tmpsave); consistancy[gametic%BACKUPTICS] = Consistancy(); diff --git a/src/p_mobj.h b/src/p_mobj.h index f281410f6..4ebcc993a 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -539,6 +539,8 @@ boolean P_SceneryZMovement(mobj_t *mo); void P_PlayerZMovement(mobj_t *mo); void P_EmeraldManager(void); +mobj_t *P_FindNewPosition(UINT32 oldposition); + extern INT32 modulothing; #define MAXHUNTEMERALDS 64 diff --git a/src/p_saveg.c b/src/p_saveg.c index da73dd8a0..b40d7cbdd 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -37,7 +37,246 @@ #include "p_slopes.h" savedata_t savedata; -UINT8 *save_p; + +#define ALLOC_SIZE(p, z) \ + if ((p)->pos + (z) > (p)->size) \ + { \ + while ((p)->pos + (z) > (p)->size) \ + (p)->size <<= 1; \ + (p)->buf = realloc((p)->buf, (p)->size); \ + } + +void P_WriteUINT8(save_t *p, UINT8 v) +{ + ALLOC_SIZE(p, sizeof(v)); + memcpy(&p->buf[p->pos], &v, sizeof(v)); + p->pos += sizeof(v); +} + +void P_WriteSINT8(save_t *p, SINT8 v) +{ + ALLOC_SIZE(p, sizeof(v)); + memcpy(&p->buf[p->pos], &v, sizeof(v)); + p->pos += sizeof(v); +} + +void P_WriteUINT16(save_t *p, UINT16 v) +{ + ALLOC_SIZE(p, sizeof(v)); + memcpy(&p->buf[p->pos], &v, sizeof(v)); + p->pos += sizeof(v); +} + +void P_WriteINT16(save_t *p, INT16 v) +{ + ALLOC_SIZE(p, sizeof(v)); + memcpy(&p->buf[p->pos], &v, sizeof(v)); + p->pos += sizeof(v); +} + +void P_WriteUINT32(save_t *p, UINT32 v) +{ + ALLOC_SIZE(p, sizeof(v)); + memcpy(&p->buf[p->pos], &v, sizeof(v)); + p->pos += sizeof(v); +} + +void P_WriteINT32(save_t *p, INT32 v) +{ + ALLOC_SIZE(p, sizeof(v)); + memcpy(&p->buf[p->pos], &v, sizeof(v)); + p->pos += sizeof(v); +} + +void P_WriteChar(save_t *p, char v) +{ + ALLOC_SIZE(p, sizeof(v)); + memcpy(&p->buf[p->pos], &v, sizeof(v)); + p->pos += sizeof(v); +} + +void P_WriteFixed(save_t *p, fixed_t v) +{ + ALLOC_SIZE(p, sizeof(v)); + memcpy(&p->buf[p->pos], &v, sizeof(v)); + p->pos += sizeof(v); +} + +void P_WriteAngle(save_t *p, angle_t v) +{ + ALLOC_SIZE(p, sizeof(v)); + memcpy(&p->buf[p->pos], &v, sizeof(v)); + p->pos += sizeof(v); +} + +void P_WriteStringN(save_t *p, char const *s, size_t n) +{ + size_t i; + + for (i = 0; i < n && s[i] != '\0'; i++) + P_WriteChar(p, s[i]); + + if (i < n) + P_WriteChar(p, '\0'); +} + +void P_WriteStringL(save_t *p, char const *s, size_t n) +{ + size_t i; + + for (i = 0; i < n - 1 && s[i] != '\0'; i++) + P_WriteChar(p, s[i]); + + P_WriteChar(p, '\0'); +} + +void P_WriteString(save_t *p, char const *s) +{ + size_t i; + + for (i = 0; s[i] != '\0'; i++) + P_WriteChar(p, s[i]); + + P_WriteChar(p, '\0'); +} + +void P_WriteMem(save_t *p, void const *s, size_t n) +{ + ALLOC_SIZE(p, n); + memcpy(&p->buf[p->pos], s, n); + p->pos += n; +} + +void P_SkipStringN(save_t *p, size_t n) +{ + size_t i; + for (i = 0; p->pos < p->size && i < n && P_ReadChar(p) != '\0'; i++); +} + +void P_SkipStringL(save_t *p, size_t n) +{ + P_SkipStringN(p, n); +} + +void P_SkipString(save_t *p) +{ + P_SkipStringN(p, SIZE_MAX); +} + +UINT8 P_ReadUINT8(save_t *p) +{ + UINT8 v; + if (p->pos + sizeof(v) > p->size) + return 0; + memcpy(&v, &p->buf[p->pos], sizeof(v)); + p->pos += sizeof(v); + return v; +} + +SINT8 P_ReadSINT8(save_t *p) +{ + SINT8 v; + if (p->pos + sizeof(v) > p->size) + return 0; + memcpy(&v, &p->buf[p->pos], sizeof(v)); + p->pos += sizeof(v); + return v; +} + +UINT16 P_ReadUINT16(save_t *p) +{ + UINT16 v; + if (p->pos + sizeof(v) > p->size) + return 0; + memcpy(&v, &p->buf[p->pos], sizeof(v)); + p->pos += sizeof(v); + return v; +} + +INT16 P_ReadINT16(save_t *p) +{ + INT16 v; + if (p->pos + sizeof(v) > p->size) + return 0; + memcpy(&v, &p->buf[p->pos], sizeof(v)); + p->pos += sizeof(v); + return v; +} + +UINT32 P_ReadUINT32(save_t *p) +{ + UINT32 v; + if (p->pos + sizeof(v) > p->size) + return 0; + memcpy(&v, &p->buf[p->pos], sizeof(v)); + p->pos += sizeof(v); + return v; +} + +INT32 P_ReadINT32(save_t *p) +{ + INT32 v; + if (p->pos + sizeof(v) > p->size) + return 0; + memcpy(&v, &p->buf[p->pos], sizeof(v)); + p->pos += sizeof(v); + return v; +} + +char P_ReadChar(save_t *p) +{ + char v; + if (p->pos + sizeof(v) > p->size) + return 0; + memcpy(&v, &p->buf[p->pos], sizeof(v)); + p->pos += sizeof(v); + return v; +} + +fixed_t P_ReadFixed(save_t *p) +{ + fixed_t v; + if (p->pos + sizeof(v) > p->size) + return 0; + memcpy(&v, &p->buf[p->pos], sizeof(v)); + p->pos += sizeof(v); + return v; +} + +angle_t P_ReadAngle(save_t *p) +{ + angle_t v; + if (p->pos + sizeof(v) > p->size) + return 0; + memcpy(&v, &p->buf[p->pos], sizeof(v)); + p->pos += sizeof(v); + return v; +} + +void P_ReadStringN(save_t *p, char *s, size_t n) +{ + size_t i; + for (i = 0; p->pos < p->size && i < n && (s[i] = P_ReadChar(p)) != '\0'; i++); + s[i] = '\0'; +} + +void P_ReadStringL(save_t *p, char *s, size_t n) +{ + P_ReadStringN(p, s, n - 1); +} + +void P_ReadString(save_t *p, char *s) +{ + P_ReadStringN(p, s, SIZE_MAX); +} + +void P_ReadMem(save_t *p, void *s, size_t n) +{ + if (p->pos + n > p->size) + return; + memcpy(s, &p->buf[p->pos], n); + p->pos += n; +} // Block UINT32s to attempt to ensure that the correct data is // being sent and received @@ -62,7 +301,7 @@ typedef enum DRONE = 0x80, } player_saveflags; -static inline void P_ArchivePlayer(void) +static inline void P_ArchivePlayer(save_t *save_p) { const player_t *player = &players[consoleplayer]; SINT8 pllives = player->lives; @@ -72,32 +311,32 @@ static inline void P_ArchivePlayer(void) #ifdef NEWSKINSAVES // Write a specific value into the old skininfo location. // If we read something other than this, it's an older save file that used skin numbers. - WRITEUINT16(save_p, NEWSKINSAVES); + P_WriteUINT16(save_p, NEWSKINSAVES); #endif // Write skin names, so that loading skins in different orders // doesn't change who the save file is for! - WRITESTRINGN(save_p, skins[player->skin]->name, SKINNAMESIZE); + P_WriteStringN(save_p, skins[player->skin]->name, SKINNAMESIZE); if (botskin != 0) { - WRITESTRINGN(save_p, skins[botskin-1]->name, SKINNAMESIZE); + P_WriteStringN(save_p, skins[botskin-1]->name, SKINNAMESIZE); } else { - WRITESTRINGN(save_p, "\0", SKINNAMESIZE); + P_WriteStringN(save_p, "\0", SKINNAMESIZE); } - WRITEUINT8(save_p, numgameovers); - WRITESINT8(save_p, pllives); - WRITEUINT32(save_p, player->score); - WRITEINT32(save_p, player->continues); + P_WriteUINT8(save_p, numgameovers); + P_WriteSINT8(save_p, pllives); + P_WriteUINT32(save_p, player->score); + P_WriteINT32(save_p, player->continues); } -static inline void P_UnArchivePlayer(void) +static inline void P_UnArchivePlayer(save_t *save_p) { #ifdef NEWSKINSAVES - INT16 backwardsCompat = READUINT16(save_p); + INT16 backwardsCompat = P_ReadUINT16(save_p); if (backwardsCompat != NEWSKINSAVES) { @@ -111,30 +350,30 @@ static inline void P_UnArchivePlayer(void) char ourSkinName[SKINNAMESIZE+1]; char botSkinName[SKINNAMESIZE+1]; - READSTRINGN(save_p, ourSkinName, SKINNAMESIZE); + P_ReadStringN(save_p, ourSkinName, SKINNAMESIZE); savedata.skin = R_SkinAvailable(ourSkinName); - READSTRINGN(save_p, botSkinName, SKINNAMESIZE); + P_ReadStringN(save_p, botSkinName, SKINNAMESIZE); savedata.botskin = R_SkinAvailable(botSkinName) + 1; } - savedata.numgameovers = READUINT8(save_p); - savedata.lives = READSINT8(save_p); - savedata.score = READUINT32(save_p); - savedata.continues = READINT32(save_p); + savedata.numgameovers = P_ReadUINT8(save_p); + savedata.lives = P_ReadSINT8(save_p); + savedata.score = P_ReadUINT32(save_p); + savedata.continues = P_ReadINT32(save_p); } -static void P_NetArchivePlayers(void) +static void P_NetArchivePlayers(save_t *save_p) { INT32 i, j; UINT16 flags; // size_t q; - WRITEUINT32(save_p, ARCHIVEBLOCK_PLAYERS); + P_WriteUINT32(save_p, ARCHIVEBLOCK_PLAYERS); for (i = 0; i < MAXPLAYERS; i++) { - WRITESINT8(save_p, (SINT8)adminplayers[i]); + P_WriteSINT8(save_p, (SINT8)adminplayers[i]); if (!playeringame[i]) continue; @@ -143,142 +382,142 @@ static void P_NetArchivePlayers(void) // no longer send ticcmds - WRITESTRINGN(save_p, player_names[i], MAXPLAYERNAME); - WRITEINT16(save_p, players[i].angleturn); - WRITEINT16(save_p, players[i].oldrelangleturn); - WRITEANGLE(save_p, players[i].aiming); - WRITEANGLE(save_p, players[i].drawangle); - WRITEANGLE(save_p, players[i].viewrollangle); - WRITEANGLE(save_p, players[i].awayviewaiming); - WRITEINT32(save_p, players[i].awayviewtics); - WRITEINT16(save_p, players[i].rings); - WRITEINT16(save_p, players[i].spheres); + P_WriteStringN(save_p, player_names[i], MAXPLAYERNAME); + P_WriteINT16(save_p, players[i].angleturn); + P_WriteINT16(save_p, players[i].oldrelangleturn); + P_WriteAngle(save_p, players[i].aiming); + P_WriteAngle(save_p, players[i].drawangle); + P_WriteAngle(save_p, players[i].viewrollangle); + P_WriteAngle(save_p, players[i].awayviewaiming); + P_WriteINT32(save_p, players[i].awayviewtics); + P_WriteINT16(save_p, players[i].rings); + P_WriteINT16(save_p, players[i].spheres); - WRITESINT8(save_p, players[i].pity); - WRITEINT32(save_p, players[i].currentweapon); - WRITEINT32(save_p, players[i].ringweapons); + P_WriteSINT8(save_p, players[i].pity); + P_WriteINT32(save_p, players[i].currentweapon); + P_WriteINT32(save_p, players[i].ringweapons); - WRITEUINT16(save_p, players[i].ammoremoval); - WRITEUINT32(save_p, players[i].ammoremovaltimer); - WRITEINT32(save_p, players[i].ammoremovaltimer); + P_WriteUINT16(save_p, players[i].ammoremoval); + P_WriteUINT32(save_p, players[i].ammoremovaltimer); + P_WriteINT32(save_p, players[i].ammoremovaltimer); for (j = 0; j < NUMPOWERS; j++) - WRITEUINT16(save_p, players[i].powers[j]); + P_WriteUINT16(save_p, players[i].powers[j]); - WRITEUINT8(save_p, players[i].playerstate); - WRITEUINT32(save_p, players[i].pflags); - WRITEUINT8(save_p, players[i].panim); - WRITEUINT8(save_p, players[i].stronganim); - WRITEUINT8(save_p, players[i].spectator); - WRITEUINT8(save_p, players[i].muted); + P_WriteUINT8(save_p, players[i].playerstate); + P_WriteUINT32(save_p, players[i].pflags); + P_WriteUINT8(save_p, players[i].panim); + P_WriteUINT8(save_p, players[i].stronganim); + P_WriteUINT8(save_p, players[i].spectator); + P_WriteUINT8(save_p, players[i].muted); - WRITEUINT16(save_p, players[i].flashpal); - WRITEUINT16(save_p, players[i].flashcount); + P_WriteUINT16(save_p, players[i].flashpal); + P_WriteUINT16(save_p, players[i].flashcount); - WRITEUINT16(save_p, players[i].skincolor); - WRITEINT32(save_p, players[i].skin); - WRITEUINT32(save_p, players[i].availabilities); - WRITEUINT32(save_p, players[i].score); - WRITEUINT32(save_p, players[i].recordscore); - WRITEFIXED(save_p, players[i].dashspeed); - WRITESINT8(save_p, players[i].lives); - WRITESINT8(save_p, players[i].continues); - WRITESINT8(save_p, players[i].xtralife); - WRITEUINT8(save_p, players[i].gotcontinue); - WRITEFIXED(save_p, players[i].speed); - WRITEUINT8(save_p, players[i].secondjump); - WRITEUINT8(save_p, players[i].fly1); - WRITEUINT8(save_p, players[i].scoreadd); - WRITEUINT32(save_p, players[i].glidetime); - WRITEUINT8(save_p, players[i].climbing); - WRITEINT32(save_p, players[i].deadtimer); - WRITEUINT32(save_p, players[i].exiting); - WRITEUINT8(save_p, players[i].homing); - WRITEUINT32(save_p, players[i].dashmode); - WRITEUINT32(save_p, players[i].skidtime); + P_WriteUINT16(save_p, players[i].skincolor); + P_WriteINT32(save_p, players[i].skin); + P_WriteUINT32(save_p, players[i].availabilities); + P_WriteUINT32(save_p, players[i].score); + P_WriteUINT32(save_p, players[i].recordscore); + P_WriteFixed(save_p, players[i].dashspeed); + P_WriteSINT8(save_p, players[i].lives); + P_WriteSINT8(save_p, players[i].continues); + P_WriteSINT8(save_p, players[i].xtralife); + P_WriteUINT8(save_p, players[i].gotcontinue); + P_WriteFixed(save_p, players[i].speed); + P_WriteUINT8(save_p, players[i].secondjump); + P_WriteUINT8(save_p, players[i].fly1); + P_WriteUINT8(save_p, players[i].scoreadd); + P_WriteUINT32(save_p, players[i].glidetime); + P_WriteUINT8(save_p, players[i].climbing); + P_WriteINT32(save_p, players[i].deadtimer); + P_WriteUINT32(save_p, players[i].exiting); + P_WriteUINT8(save_p, players[i].homing); + P_WriteUINT32(save_p, players[i].dashmode); + P_WriteUINT32(save_p, players[i].skidtime); ////////// // Bots // ////////// - WRITEUINT8(save_p, players[i].bot); - WRITEUINT8(save_p, players[i].botmem.lastForward); - WRITEUINT8(save_p, players[i].botmem.lastBlocked); - WRITEUINT8(save_p, players[i].botmem.catchup_tics); - WRITEUINT8(save_p, players[i].botmem.thinkstate); - WRITEUINT8(save_p, players[i].removing); + P_WriteUINT8(save_p, players[i].bot); + P_WriteUINT8(save_p, players[i].botmem.lastForward); + P_WriteUINT8(save_p, players[i].botmem.lastBlocked); + P_WriteUINT8(save_p, players[i].botmem.catchup_tics); + P_WriteUINT8(save_p, players[i].botmem.thinkstate); + P_WriteUINT8(save_p, players[i].removing); - WRITEUINT8(save_p, players[i].blocked); - WRITEUINT16(save_p, players[i].lastbuttons); + P_WriteUINT8(save_p, players[i].blocked); + P_WriteUINT16(save_p, players[i].lastbuttons); //////////////////////////// // Conveyor Belt Movement // //////////////////////////// - WRITEFIXED(save_p, players[i].cmomx); // Conveyor momx - WRITEFIXED(save_p, players[i].cmomy); // Conveyor momy - WRITEFIXED(save_p, players[i].rmomx); // "Real" momx (momx - cmomx) - WRITEFIXED(save_p, players[i].rmomy); // "Real" momy (momy - cmomy) + P_WriteFixed(save_p, players[i].cmomx); // Conveyor momx + P_WriteFixed(save_p, players[i].cmomy); // Conveyor momy + P_WriteFixed(save_p, players[i].rmomx); // "Real" momx (momx - cmomx) + P_WriteFixed(save_p, players[i].rmomy); // "Real" momy (momy - cmomy) ///////////////////// // Race Mode Stuff // ///////////////////// - WRITEINT16(save_p, players[i].numboxes); - WRITEINT16(save_p, players[i].totalring); - WRITEUINT32(save_p, players[i].realtime); - WRITEUINT8(save_p, players[i].laps); + P_WriteINT16(save_p, players[i].numboxes); + P_WriteINT16(save_p, players[i].totalring); + P_WriteUINT32(save_p, players[i].realtime); + P_WriteUINT8(save_p, players[i].laps); //////////////////// // CTF Mode Stuff // //////////////////// - WRITEINT32(save_p, players[i].ctfteam); - WRITEUINT16(save_p, players[i].gotflag); + P_WriteINT32(save_p, players[i].ctfteam); + P_WriteUINT16(save_p, players[i].gotflag); - WRITEINT32(save_p, players[i].weapondelay); - WRITEINT32(save_p, players[i].tossdelay); + P_WriteINT32(save_p, players[i].weapondelay); + P_WriteINT32(save_p, players[i].tossdelay); - WRITEUINT32(save_p, players[i].starposttime); - WRITEINT16(save_p, players[i].starpostx); - WRITEINT16(save_p, players[i].starposty); - WRITEINT16(save_p, players[i].starpostz); - WRITEINT32(save_p, players[i].starpostnum); - WRITEANGLE(save_p, players[i].starpostangle); - WRITEFIXED(save_p, players[i].starpostscale); + P_WriteUINT32(save_p, players[i].starposttime); + P_WriteINT16(save_p, players[i].starpostx); + P_WriteINT16(save_p, players[i].starposty); + P_WriteINT16(save_p, players[i].starpostz); + P_WriteINT32(save_p, players[i].starpostnum); + P_WriteAngle(save_p, players[i].starpostangle); + P_WriteFixed(save_p, players[i].starpostscale); - WRITEANGLE(save_p, players[i].angle_pos); - WRITEANGLE(save_p, players[i].old_angle_pos); + P_WriteAngle(save_p, players[i].angle_pos); + P_WriteAngle(save_p, players[i].old_angle_pos); - WRITEINT32(save_p, players[i].flyangle); - WRITEUINT32(save_p, players[i].drilltimer); - WRITEINT32(save_p, players[i].linkcount); - WRITEUINT32(save_p, players[i].linktimer); - WRITEINT32(save_p, players[i].anotherflyangle); - WRITEUINT32(save_p, players[i].nightstime); - WRITEUINT32(save_p, players[i].bumpertime); - WRITEINT32(save_p, players[i].drillmeter); - WRITEUINT8(save_p, players[i].drilldelay); - WRITEUINT8(save_p, players[i].bonustime); - WRITEFIXED(save_p, players[i].oldscale); - WRITEUINT8(save_p, players[i].mare); - WRITEUINT8(save_p, players[i].marelap); - WRITEUINT8(save_p, players[i].marebonuslap); - WRITEUINT32(save_p, players[i].marebegunat); - WRITEUINT32(save_p, players[i].lastmaretime); - WRITEUINT32(save_p, players[i].startedtime); - WRITEUINT32(save_p, players[i].finishedtime); - WRITEUINT32(save_p, players[i].lapbegunat); - WRITEUINT32(save_p, players[i].lapstartedtime); - WRITEINT16(save_p, players[i].finishedspheres); - WRITEINT16(save_p, players[i].finishedrings); - WRITEUINT32(save_p, players[i].marescore); - WRITEUINT32(save_p, players[i].lastmarescore); - WRITEUINT32(save_p, players[i].totalmarescore); - WRITEUINT8(save_p, players[i].lastmare); - WRITEUINT8(save_p, players[i].lastmarelap); - WRITEUINT8(save_p, players[i].lastmarebonuslap); - WRITEUINT8(save_p, players[i].totalmarelap); - WRITEUINT8(save_p, players[i].totalmarebonuslap); - WRITEINT32(save_p, players[i].maxlink); - WRITEUINT8(save_p, players[i].texttimer); - WRITEUINT8(save_p, players[i].textvar); + P_WriteINT32(save_p, players[i].flyangle); + P_WriteUINT32(save_p, players[i].drilltimer); + P_WriteINT32(save_p, players[i].linkcount); + P_WriteUINT32(save_p, players[i].linktimer); + P_WriteINT32(save_p, players[i].anotherflyangle); + P_WriteUINT32(save_p, players[i].nightstime); + P_WriteUINT32(save_p, players[i].bumpertime); + P_WriteINT32(save_p, players[i].drillmeter); + P_WriteUINT8(save_p, players[i].drilldelay); + P_WriteUINT8(save_p, players[i].bonustime); + P_WriteFixed(save_p, players[i].oldscale); + P_WriteUINT8(save_p, players[i].mare); + P_WriteUINT8(save_p, players[i].marelap); + P_WriteUINT8(save_p, players[i].marebonuslap); + P_WriteUINT32(save_p, players[i].marebegunat); + P_WriteUINT32(save_p, players[i].lastmaretime); + P_WriteUINT32(save_p, players[i].startedtime); + P_WriteUINT32(save_p, players[i].finishedtime); + P_WriteUINT32(save_p, players[i].lapbegunat); + P_WriteUINT32(save_p, players[i].lapstartedtime); + P_WriteINT16(save_p, players[i].finishedspheres); + P_WriteINT16(save_p, players[i].finishedrings); + P_WriteUINT32(save_p, players[i].marescore); + P_WriteUINT32(save_p, players[i].lastmarescore); + P_WriteUINT32(save_p, players[i].totalmarescore); + P_WriteUINT8(save_p, players[i].lastmare); + P_WriteUINT8(save_p, players[i].lastmarelap); + P_WriteUINT8(save_p, players[i].lastmarebonuslap); + P_WriteUINT8(save_p, players[i].totalmarelap); + P_WriteUINT8(save_p, players[i].totalmarebonuslap); + P_WriteINT32(save_p, players[i].maxlink); + P_WriteUINT8(save_p, players[i].texttimer); + P_WriteUINT8(save_p, players[i].textvar); if (players[i].capsule) flags |= CAPSULE; @@ -298,73 +537,73 @@ static void P_NetArchivePlayers(void) if (players[i].drone) flags |= DRONE; - WRITEINT16(save_p, players[i].lastsidehit); - WRITEINT16(save_p, players[i].lastlinehit); + P_WriteINT16(save_p, players[i].lastsidehit); + P_WriteINT16(save_p, players[i].lastlinehit); - WRITEUINT32(save_p, players[i].losstime); + P_WriteUINT32(save_p, players[i].losstime); - WRITEUINT8(save_p, players[i].timeshit); + P_WriteUINT8(save_p, players[i].timeshit); - WRITEINT32(save_p, players[i].onconveyor); + P_WriteINT32(save_p, players[i].onconveyor); - WRITEUINT32(save_p, players[i].jointime); - WRITEUINT32(save_p, players[i].quittime); + P_WriteUINT32(save_p, players[i].jointime); + P_WriteUINT32(save_p, players[i].quittime); - WRITEUINT16(save_p, flags); + P_WriteUINT16(save_p, flags); if (flags & CAPSULE) - WRITEUINT32(save_p, players[i].capsule->mobjnum); + P_WriteUINT32(save_p, players[i].capsule->mobjnum); if (flags & FIRSTAXIS) - WRITEUINT32(save_p, players[i].axis1->mobjnum); + P_WriteUINT32(save_p, players[i].axis1->mobjnum); if (flags & SECONDAXIS) - WRITEUINT32(save_p, players[i].axis2->mobjnum); + P_WriteUINT32(save_p, players[i].axis2->mobjnum); if (flags & AWAYVIEW) - WRITEUINT32(save_p, players[i].awayviewmobj->mobjnum); + P_WriteUINT32(save_p, players[i].awayviewmobj->mobjnum); if (flags & FOLLOW) - WRITEUINT32(save_p, players[i].followmobj->mobjnum); + P_WriteUINT32(save_p, players[i].followmobj->mobjnum); if (flags & DRONE) - WRITEUINT32(save_p, players[i].drone->mobjnum); + P_WriteUINT32(save_p, players[i].drone->mobjnum); - WRITEFIXED(save_p, players[i].camerascale); - WRITEFIXED(save_p, players[i].shieldscale); + P_WriteFixed(save_p, players[i].camerascale); + P_WriteFixed(save_p, players[i].shieldscale); - WRITEUINT8(save_p, players[i].charability); - WRITEUINT8(save_p, players[i].charability2); - WRITEUINT32(save_p, players[i].charflags); - WRITEUINT32(save_p, (UINT32)players[i].thokitem); - WRITEUINT32(save_p, (UINT32)players[i].spinitem); - WRITEUINT32(save_p, (UINT32)players[i].revitem); - WRITEUINT32(save_p, (UINT32)players[i].followitem); - WRITEFIXED(save_p, players[i].actionspd); - WRITEFIXED(save_p, players[i].mindash); - WRITEFIXED(save_p, players[i].maxdash); - WRITEFIXED(save_p, players[i].normalspeed); - WRITEFIXED(save_p, players[i].runspeed); - WRITEUINT8(save_p, players[i].thrustfactor); - WRITEUINT8(save_p, players[i].accelstart); - WRITEUINT8(save_p, players[i].acceleration); - WRITEFIXED(save_p, players[i].jumpfactor); - WRITEFIXED(save_p, players[i].height); - WRITEFIXED(save_p, players[i].spinheight); + P_WriteUINT8(save_p, players[i].charability); + P_WriteUINT8(save_p, players[i].charability2); + P_WriteUINT32(save_p, players[i].charflags); + P_WriteUINT32(save_p, (UINT32)players[i].thokitem); + P_WriteUINT32(save_p, (UINT32)players[i].spinitem); + P_WriteUINT32(save_p, (UINT32)players[i].revitem); + P_WriteUINT32(save_p, (UINT32)players[i].followitem); + P_WriteFixed(save_p, players[i].actionspd); + P_WriteFixed(save_p, players[i].mindash); + P_WriteFixed(save_p, players[i].maxdash); + P_WriteFixed(save_p, players[i].normalspeed); + P_WriteFixed(save_p, players[i].runspeed); + P_WriteUINT8(save_p, players[i].thrustfactor); + P_WriteUINT8(save_p, players[i].accelstart); + P_WriteUINT8(save_p, players[i].acceleration); + P_WriteFixed(save_p, players[i].jumpfactor); + P_WriteFixed(save_p, players[i].height); + P_WriteFixed(save_p, players[i].spinheight); } } -static void P_NetUnArchivePlayers(void) +static void P_NetUnArchivePlayers(save_t *save_p) { INT32 i, j; UINT16 flags; - if (READUINT32(save_p) != ARCHIVEBLOCK_PLAYERS) + if (P_ReadUINT32(save_p) != ARCHIVEBLOCK_PLAYERS) I_Error("Bad $$$.sav at archive block Players"); for (i = 0; i < MAXPLAYERS; i++) { - adminplayers[i] = (INT32)READSINT8(save_p); + adminplayers[i] = (INT32)P_ReadSINT8(save_p); // Do NOT memset player struct to 0 // other areas may initialize data elsewhere @@ -374,198 +613,198 @@ static void P_NetUnArchivePlayers(void) // NOTE: sending tics should (hopefully) no longer be necessary - READSTRINGN(save_p, player_names[i], MAXPLAYERNAME); - players[i].angleturn = READINT16(save_p); - players[i].oldrelangleturn = READINT16(save_p); - players[i].aiming = READANGLE(save_p); - players[i].drawangle = READANGLE(save_p); - players[i].viewrollangle = READANGLE(save_p); - players[i].awayviewaiming = READANGLE(save_p); - players[i].awayviewtics = READINT32(save_p); - players[i].rings = READINT16(save_p); - players[i].spheres = READINT16(save_p); + P_ReadStringN(save_p, player_names[i], MAXPLAYERNAME); + players[i].angleturn = P_ReadINT16(save_p); + players[i].oldrelangleturn = P_ReadINT16(save_p); + players[i].aiming = P_ReadAngle(save_p); + players[i].drawangle = P_ReadAngle(save_p); + players[i].viewrollangle = P_ReadAngle(save_p); + players[i].awayviewaiming = P_ReadAngle(save_p); + players[i].awayviewtics = P_ReadINT32(save_p); + players[i].rings = P_ReadINT16(save_p); + players[i].spheres = P_ReadINT16(save_p); - players[i].pity = READSINT8(save_p); - players[i].currentweapon = READINT32(save_p); - players[i].ringweapons = READINT32(save_p); + players[i].pity = P_ReadSINT8(save_p); + players[i].currentweapon = P_ReadINT32(save_p); + players[i].ringweapons = P_ReadINT32(save_p); - players[i].ammoremoval = READUINT16(save_p); - players[i].ammoremovaltimer = READUINT32(save_p); - players[i].ammoremovalweapon = READINT32(save_p); + players[i].ammoremoval = P_ReadUINT16(save_p); + players[i].ammoremovaltimer = P_ReadUINT32(save_p); + players[i].ammoremovalweapon = P_ReadINT32(save_p); for (j = 0; j < NUMPOWERS; j++) - players[i].powers[j] = READUINT16(save_p); + players[i].powers[j] = P_ReadUINT16(save_p); - players[i].playerstate = READUINT8(save_p); - players[i].pflags = READUINT32(save_p); - players[i].panim = READUINT8(save_p); - players[i].stronganim = READUINT8(save_p); - players[i].spectator = READUINT8(save_p); - players[i].muted = READUINT8(save_p); + players[i].playerstate = P_ReadUINT8(save_p); + players[i].pflags = P_ReadUINT32(save_p); + players[i].panim = P_ReadUINT8(save_p); + players[i].stronganim = P_ReadUINT8(save_p); + players[i].spectator = P_ReadUINT8(save_p); + players[i].muted = P_ReadUINT8(save_p); - players[i].flashpal = READUINT16(save_p); - players[i].flashcount = READUINT16(save_p); + players[i].flashpal = P_ReadUINT16(save_p); + players[i].flashcount = P_ReadUINT16(save_p); - players[i].skincolor = READUINT16(save_p); - players[i].skin = READINT32(save_p); - players[i].availabilities = READUINT32(save_p); - players[i].score = READUINT32(save_p); - players[i].recordscore = READUINT32(save_p); - players[i].dashspeed = READFIXED(save_p); // dashing speed - players[i].lives = READSINT8(save_p); - players[i].continues = READSINT8(save_p); // continues that player has acquired - players[i].xtralife = READSINT8(save_p); // Ring Extra Life counter - players[i].gotcontinue = READUINT8(save_p); // got continue from stage - players[i].speed = READFIXED(save_p); // Player's speed (distance formula of MOMX and MOMY values) - players[i].secondjump = READUINT8(save_p); - players[i].fly1 = READUINT8(save_p); // Tails flying - players[i].scoreadd = READUINT8(save_p); // Used for multiple enemy attack bonus - players[i].glidetime = READUINT32(save_p); // Glide counter for thrust - players[i].climbing = READUINT8(save_p); // Climbing on the wall - players[i].deadtimer = READINT32(save_p); // End game if game over lasts too long - players[i].exiting = READUINT32(save_p); // Exitlevel timer - players[i].homing = READUINT8(save_p); // Are you homing? - players[i].dashmode = READUINT32(save_p); // counter for dashmode ability - players[i].skidtime = READUINT32(save_p); // Skid timer + players[i].skincolor = P_ReadUINT16(save_p); + players[i].skin = P_ReadINT32(save_p); + players[i].availabilities = P_ReadUINT32(save_p); + players[i].score = P_ReadUINT32(save_p); + players[i].recordscore = P_ReadUINT32(save_p); + players[i].dashspeed = P_ReadFixed(save_p); // dashing speed + players[i].lives = P_ReadSINT8(save_p); + players[i].continues = P_ReadSINT8(save_p); // continues that player has acquired + players[i].xtralife = P_ReadSINT8(save_p); // Ring Extra Life counter + players[i].gotcontinue = P_ReadUINT8(save_p); // got continue from stage + players[i].speed = P_ReadFixed(save_p); // Player's speed (distance formula of MOMX and MOMY values) + players[i].secondjump = P_ReadUINT8(save_p); + players[i].fly1 = P_ReadUINT8(save_p); // Tails flying + players[i].scoreadd = P_ReadUINT8(save_p); // Used for multiple enemy attack bonus + players[i].glidetime = P_ReadUINT32(save_p); // Glide counter for thrust + players[i].climbing = P_ReadUINT8(save_p); // Climbing on the wall + players[i].deadtimer = P_ReadINT32(save_p); // End game if game over lasts too long + players[i].exiting = P_ReadUINT32(save_p); // Exitlevel timer + players[i].homing = P_ReadUINT8(save_p); // Are you homing? + players[i].dashmode = P_ReadUINT32(save_p); // counter for dashmode ability + players[i].skidtime = P_ReadUINT32(save_p); // Skid timer ////////// // Bots // ////////// - players[i].bot = READUINT8(save_p); + players[i].bot = P_ReadUINT8(save_p); - players[i].botmem.lastForward = READUINT8(save_p); - players[i].botmem.lastBlocked = READUINT8(save_p); - players[i].botmem.catchup_tics = READUINT8(save_p); - players[i].botmem.thinkstate = READUINT8(save_p); - players[i].removing = READUINT8(save_p); + players[i].botmem.lastForward = P_ReadUINT8(save_p); + players[i].botmem.lastBlocked = P_ReadUINT8(save_p); + players[i].botmem.catchup_tics = P_ReadUINT8(save_p); + players[i].botmem.thinkstate = P_ReadUINT8(save_p); + players[i].removing = P_ReadUINT8(save_p); - players[i].blocked = READUINT8(save_p); - players[i].lastbuttons = READUINT16(save_p); + players[i].blocked = P_ReadUINT8(save_p); + players[i].lastbuttons = P_ReadUINT16(save_p); //////////////////////////// // Conveyor Belt Movement // //////////////////////////// - players[i].cmomx = READFIXED(save_p); // Conveyor momx - players[i].cmomy = READFIXED(save_p); // Conveyor momy - players[i].rmomx = READFIXED(save_p); // "Real" momx (momx - cmomx) - players[i].rmomy = READFIXED(save_p); // "Real" momy (momy - cmomy) + players[i].cmomx = P_ReadFixed(save_p); // Conveyor momx + players[i].cmomy = P_ReadFixed(save_p); // Conveyor momy + players[i].rmomx = P_ReadFixed(save_p); // "Real" momx (momx - cmomx) + players[i].rmomy = P_ReadFixed(save_p); // "Real" momy (momy - cmomy) ///////////////////// // Race Mode Stuff // ///////////////////// - players[i].numboxes = READINT16(save_p); // Number of item boxes obtained for Race Mode - players[i].totalring = READINT16(save_p); // Total number of rings obtained for Race Mode - players[i].realtime = READUINT32(save_p); // integer replacement for leveltime - players[i].laps = READUINT8(save_p); // Number of laps (optional) + players[i].numboxes = P_ReadINT16(save_p); // Number of item boxes obtained for Race Mode + players[i].totalring = P_ReadINT16(save_p); // Total number of rings obtained for Race Mode + players[i].realtime = P_ReadUINT32(save_p); // integer replacement for leveltime + players[i].laps = P_ReadUINT8(save_p); // Number of laps (optional) //////////////////// // CTF Mode Stuff // //////////////////// - players[i].ctfteam = READINT32(save_p); // 1 == Red, 2 == Blue - players[i].gotflag = READUINT16(save_p); // 1 == Red, 2 == Blue Do you have the flag? + players[i].ctfteam = P_ReadINT32(save_p); // 1 == Red, 2 == Blue + players[i].gotflag = P_ReadUINT16(save_p); // 1 == Red, 2 == Blue Do you have the flag? - players[i].weapondelay = READINT32(save_p); - players[i].tossdelay = READINT32(save_p); + players[i].weapondelay = P_ReadINT32(save_p); + players[i].tossdelay = P_ReadINT32(save_p); - players[i].starposttime = READUINT32(save_p); - players[i].starpostx = READINT16(save_p); - players[i].starposty = READINT16(save_p); - players[i].starpostz = READINT16(save_p); - players[i].starpostnum = READINT32(save_p); - players[i].starpostangle = READANGLE(save_p); - players[i].starpostscale = READFIXED(save_p); + players[i].starposttime = P_ReadUINT32(save_p); + players[i].starpostx = P_ReadINT16(save_p); + players[i].starposty = P_ReadINT16(save_p); + players[i].starpostz = P_ReadINT16(save_p); + players[i].starpostnum = P_ReadINT32(save_p); + players[i].starpostangle = P_ReadAngle(save_p); + players[i].starpostscale = P_ReadFixed(save_p); - players[i].angle_pos = READANGLE(save_p); - players[i].old_angle_pos = READANGLE(save_p); + players[i].angle_pos = P_ReadAngle(save_p); + players[i].old_angle_pos = P_ReadAngle(save_p); - players[i].flyangle = READINT32(save_p); - players[i].drilltimer = READUINT32(save_p); - players[i].linkcount = READINT32(save_p); - players[i].linktimer = READUINT32(save_p); - players[i].anotherflyangle = READINT32(save_p); - players[i].nightstime = READUINT32(save_p); - players[i].bumpertime = READUINT32(save_p); - players[i].drillmeter = READINT32(save_p); - players[i].drilldelay = READUINT8(save_p); - players[i].bonustime = (boolean)READUINT8(save_p); - players[i].oldscale = READFIXED(save_p); - players[i].mare = READUINT8(save_p); - players[i].marelap = READUINT8(save_p); - players[i].marebonuslap = READUINT8(save_p); - players[i].marebegunat = READUINT32(save_p); - players[i].lastmaretime = READUINT32(save_p); - players[i].startedtime = READUINT32(save_p); - players[i].finishedtime = READUINT32(save_p); - players[i].lapbegunat = READUINT32(save_p); - players[i].lapstartedtime = READUINT32(save_p); - players[i].finishedspheres = READINT16(save_p); - players[i].finishedrings = READINT16(save_p); - players[i].marescore = READUINT32(save_p); - players[i].lastmarescore = READUINT32(save_p); - players[i].totalmarescore = READUINT32(save_p); - players[i].lastmare = READUINT8(save_p); - players[i].lastmarelap = READUINT8(save_p); - players[i].lastmarebonuslap = READUINT8(save_p); - players[i].totalmarelap = READUINT8(save_p); - players[i].totalmarebonuslap = READUINT8(save_p); - players[i].maxlink = READINT32(save_p); - players[i].texttimer = READUINT8(save_p); - players[i].textvar = READUINT8(save_p); + players[i].flyangle = P_ReadINT32(save_p); + players[i].drilltimer = P_ReadUINT32(save_p); + players[i].linkcount = P_ReadINT32(save_p); + players[i].linktimer = P_ReadUINT32(save_p); + players[i].anotherflyangle = P_ReadINT32(save_p); + players[i].nightstime = P_ReadUINT32(save_p); + players[i].bumpertime = P_ReadUINT32(save_p); + players[i].drillmeter = P_ReadINT32(save_p); + players[i].drilldelay = P_ReadUINT8(save_p); + players[i].bonustime = (boolean)P_ReadUINT8(save_p); + players[i].oldscale = P_ReadFixed(save_p); + players[i].mare = P_ReadUINT8(save_p); + players[i].marelap = P_ReadUINT8(save_p); + players[i].marebonuslap = P_ReadUINT8(save_p); + players[i].marebegunat = P_ReadUINT32(save_p); + players[i].lastmaretime = P_ReadUINT32(save_p); + players[i].startedtime = P_ReadUINT32(save_p); + players[i].finishedtime = P_ReadUINT32(save_p); + players[i].lapbegunat = P_ReadUINT32(save_p); + players[i].lapstartedtime = P_ReadUINT32(save_p); + players[i].finishedspheres = P_ReadINT16(save_p); + players[i].finishedrings = P_ReadINT16(save_p); + players[i].marescore = P_ReadUINT32(save_p); + players[i].lastmarescore = P_ReadUINT32(save_p); + players[i].totalmarescore = P_ReadUINT32(save_p); + players[i].lastmare = P_ReadUINT8(save_p); + players[i].lastmarelap = P_ReadUINT8(save_p); + players[i].lastmarebonuslap = P_ReadUINT8(save_p); + players[i].totalmarelap = P_ReadUINT8(save_p); + players[i].totalmarebonuslap = P_ReadUINT8(save_p); + players[i].maxlink = P_ReadINT32(save_p); + players[i].texttimer = P_ReadUINT8(save_p); + players[i].textvar = P_ReadUINT8(save_p); - players[i].lastsidehit = READINT16(save_p); - players[i].lastlinehit = READINT16(save_p); + players[i].lastsidehit = P_ReadINT16(save_p); + players[i].lastlinehit = P_ReadINT16(save_p); - players[i].losstime = READUINT32(save_p); + players[i].losstime = P_ReadUINT32(save_p); - players[i].timeshit = READUINT8(save_p); + players[i].timeshit = P_ReadUINT8(save_p); - players[i].onconveyor = READINT32(save_p); + players[i].onconveyor = P_ReadINT32(save_p); - players[i].jointime = READUINT32(save_p); - players[i].quittime = READUINT32(save_p); + players[i].jointime = P_ReadUINT32(save_p); + players[i].quittime = P_ReadUINT32(save_p); - flags = READUINT16(save_p); + flags = P_ReadUINT16(save_p); if (flags & CAPSULE) - players[i].capsule = (mobj_t *)(size_t)READUINT32(save_p); + players[i].capsule = (mobj_t *)(size_t)P_ReadUINT32(save_p); if (flags & FIRSTAXIS) - players[i].axis1 = (mobj_t *)(size_t)READUINT32(save_p); + players[i].axis1 = (mobj_t *)(size_t)P_ReadUINT32(save_p); if (flags & SECONDAXIS) - players[i].axis2 = (mobj_t *)(size_t)READUINT32(save_p); + players[i].axis2 = (mobj_t *)(size_t)P_ReadUINT32(save_p); if (flags & AWAYVIEW) - players[i].awayviewmobj = (mobj_t *)(size_t)READUINT32(save_p); + players[i].awayviewmobj = (mobj_t *)(size_t)P_ReadUINT32(save_p); if (flags & FOLLOW) - players[i].followmobj = (mobj_t *)(size_t)READUINT32(save_p); + players[i].followmobj = (mobj_t *)(size_t)P_ReadUINT32(save_p); if (flags & DRONE) - players[i].drone = (mobj_t *)(size_t)READUINT32(save_p); + players[i].drone = (mobj_t *)(size_t)P_ReadUINT32(save_p); - players[i].camerascale = READFIXED(save_p); - players[i].shieldscale = READFIXED(save_p); + players[i].camerascale = P_ReadFixed(save_p); + players[i].shieldscale = P_ReadFixed(save_p); //SetPlayerSkinByNum(i, players[i].skin); - players[i].charability = READUINT8(save_p); - players[i].charability2 = READUINT8(save_p); - players[i].charflags = READUINT32(save_p); - players[i].thokitem = (mobjtype_t)READUINT32(save_p); - players[i].spinitem = (mobjtype_t)READUINT32(save_p); - players[i].revitem = (mobjtype_t)READUINT32(save_p); - players[i].followitem = (mobjtype_t)READUINT32(save_p); - players[i].actionspd = READFIXED(save_p); - players[i].mindash = READFIXED(save_p); - players[i].maxdash = READFIXED(save_p); - players[i].normalspeed = READFIXED(save_p); - players[i].runspeed = READFIXED(save_p); - players[i].thrustfactor = READUINT8(save_p); - players[i].accelstart = READUINT8(save_p); - players[i].acceleration = READUINT8(save_p); - players[i].jumpfactor = READFIXED(save_p); - players[i].height = READFIXED(save_p); - players[i].spinheight = READFIXED(save_p); + players[i].charability = P_ReadUINT8(save_p); + players[i].charability2 = P_ReadUINT8(save_p); + players[i].charflags = P_ReadUINT32(save_p); + players[i].thokitem = (mobjtype_t)P_ReadUINT32(save_p); + players[i].spinitem = (mobjtype_t)P_ReadUINT32(save_p); + players[i].revitem = (mobjtype_t)P_ReadUINT32(save_p); + players[i].followitem = (mobjtype_t)P_ReadUINT32(save_p); + players[i].actionspd = P_ReadFixed(save_p); + players[i].mindash = P_ReadFixed(save_p); + players[i].maxdash = P_ReadFixed(save_p); + players[i].normalspeed = P_ReadFixed(save_p); + players[i].runspeed = P_ReadFixed(save_p); + players[i].thrustfactor = P_ReadUINT8(save_p); + players[i].accelstart = P_ReadUINT8(save_p); + players[i].acceleration = P_ReadUINT8(save_p); + players[i].jumpfactor = P_ReadFixed(save_p); + players[i].height = P_ReadFixed(save_p); + players[i].spinheight = P_ReadFixed(save_p); players[i].viewheight = 41*players[i].height/48; // scale cannot be factored in at this point } @@ -668,12 +907,12 @@ static void ClearNetColormaps(void) net_colormaps = NULL; } -static void P_NetArchiveColormaps(void) +static void P_NetArchiveColormaps(save_t *save_p) { // We save and then we clean up our colormap mess extracolormap_t *exc, *exc_next; UINT32 i = 0; - WRITEUINT32(save_p, num_net_colormaps); // save for safety + P_WriteUINT32(save_p, num_net_colormaps); // save for safety for (exc = net_colormaps; i < num_net_colormaps; i++, exc = exc_next) { @@ -682,15 +921,15 @@ static void P_NetArchiveColormaps(void) if (!exc) exc = R_CreateDefaultColormap(false); - WRITEUINT8(save_p, exc->fadestart); - WRITEUINT8(save_p, exc->fadeend); - WRITEUINT8(save_p, exc->flags); + P_WriteUINT8(save_p, exc->fadestart); + P_WriteUINT8(save_p, exc->fadeend); + P_WriteUINT8(save_p, exc->flags); - WRITEINT32(save_p, exc->rgba); - WRITEINT32(save_p, exc->fadergba); + P_WriteINT32(save_p, exc->rgba); + P_WriteINT32(save_p, exc->fadergba); #ifdef EXTRACOLORMAPLUMPS - WRITESTRINGN(save_p, exc->lumpname, 9); + P_WriteStringN(save_p, exc->lumpname, 9); #endif exc_next = exc->next; @@ -702,7 +941,7 @@ static void P_NetArchiveColormaps(void) net_colormaps = NULL; } -static void P_NetUnArchiveColormaps(void) +static void P_NetUnArchiveColormaps(save_t *save_p) { // When we reach this point, we already populated our list with // dummy colormaps. Now that we are loading the color data, @@ -710,7 +949,7 @@ static void P_NetUnArchiveColormaps(void) extracolormap_t *exc, *existing_exc, *exc_next = NULL; UINT32 i = 0; - num_net_colormaps = READUINT32(save_p); + num_net_colormaps = P_ReadUINT32(save_p); for (exc = net_colormaps; i < num_net_colormaps; i++, exc = exc_next) { @@ -720,15 +959,15 @@ static void P_NetUnArchiveColormaps(void) char lumpname[9]; #endif - fadestart = READUINT8(save_p); - fadeend = READUINT8(save_p); - flags = READUINT8(save_p); + fadestart = P_ReadUINT8(save_p); + fadeend = P_ReadUINT8(save_p); + flags = P_ReadUINT8(save_p); - rgba = READINT32(save_p); - fadergba = READINT32(save_p); + rgba = P_ReadINT32(save_p); + fadergba = P_ReadINT32(save_p); #ifdef EXTRACOLORMAPLUMPS - READSTRINGN(save_p, lumpname, 9); + P_ReadStringN(save_p, lumpname, 9); if (lumpname[0]) { @@ -804,29 +1043,29 @@ static void P_NetUnArchiveColormaps(void) net_colormaps = NULL; } -static void P_NetArchiveWaypoints(void) +static void P_NetArchiveWaypoints(save_t *save_p) { INT32 i, j; for (i = 0; i < NUMWAYPOINTSEQUENCES; i++) { - WRITEUINT16(save_p, numwaypoints[i]); + P_WriteUINT16(save_p, numwaypoints[i]); for (j = 0; j < numwaypoints[i]; j++) - WRITEUINT32(save_p, waypoints[i][j] ? waypoints[i][j]->mobjnum : 0); + P_WriteUINT32(save_p, waypoints[i][j] ? waypoints[i][j]->mobjnum : 0); } } -static void P_NetUnArchiveWaypoints(void) +static void P_NetUnArchiveWaypoints(save_t *save_p) { INT32 i, j; UINT32 mobjnum; for (i = 0; i < NUMWAYPOINTSEQUENCES; i++) { - numwaypoints[i] = READUINT16(save_p); + numwaypoints[i] = P_ReadUINT16(save_p); for (j = 0; j < numwaypoints[i]; j++) { - mobjnum = READUINT32(save_p); + mobjnum = P_ReadUINT32(save_p); waypoints[i][j] = (mobjnum == 0) ? NULL : P_FindNewPosition(mobjnum); } } @@ -973,7 +1212,7 @@ static boolean CheckFFloorDiff(const sector_t *ss) // Special case: save the stats of all modified ffloors along with their ffloor "number"s // we don't bother with ffloors that haven't changed, that would just add to savegame even more than is really needed -static void ArchiveFFloors(const sector_t *ss) +static void ArchiveFFloors(save_t *save_p, const sector_t *ss) { size_t j = 0; // ss->ffloors is saved as ffloor #0, ss->ffloors->next is #1, etc ffloor_t *rover; @@ -988,19 +1227,19 @@ static void ArchiveFFloors(const sector_t *ss) if (fflr_diff) { - WRITEUINT16(save_p, j); // save ffloor "number" - WRITEUINT8(save_p, fflr_diff); + P_WriteUINT16(save_p, j); // save ffloor "number" + P_WriteUINT8(save_p, fflr_diff); if (fflr_diff & FD_FLAGS) - WRITEUINT32(save_p, rover->fofflags); + P_WriteUINT32(save_p, rover->fofflags); if (fflr_diff & FD_ALPHA) - WRITEINT16(save_p, rover->alpha); + P_WriteINT16(save_p, rover->alpha); } j++; } - WRITEUINT16(save_p, 0xffff); + P_WriteUINT16(save_p, 0xffff); } -static void UnArchiveFFloors(const sector_t *ss) +static void UnArchiveFFloors(save_t *save_p, const sector_t *ss) { UINT16 j = 0; // number of current ffloor in loop UINT16 fflr_i; // saved ffloor "number" of next modified ffloor @@ -1011,7 +1250,7 @@ static void UnArchiveFFloors(const sector_t *ss) if (!rover) // it is assumed sectors[i].ffloors actually exists, but just in case... I_Error("Sector does not have any ffloors!"); - fflr_i = READUINT16(save_p); // get first modified ffloor's number ready + fflr_i = P_ReadUINT16(save_p); // get first modified ffloor's number ready for (;;) // for some reason the usual for (rover = x; ...) thing doesn't work here? { if (fflr_i == 0xffff) // end of modified ffloors list, let's stop already @@ -1026,21 +1265,21 @@ static void UnArchiveFFloors(const sector_t *ss) continue; } - fflr_diff = READUINT8(save_p); + fflr_diff = P_ReadUINT8(save_p); if (fflr_diff & FD_FLAGS) - rover->fofflags = READUINT32(save_p); + rover->fofflags = P_ReadUINT32(save_p); if (fflr_diff & FD_ALPHA) - rover->alpha = READINT16(save_p); + rover->alpha = P_ReadINT16(save_p); - fflr_i = READUINT16(save_p); // get next ffloor "number" ready + fflr_i = P_ReadUINT16(save_p); // get next ffloor "number" ready j++; rover = rover->next; } } -static void ArchiveSectors(void) +static void ArchiveSectors(save_t *save_p) { size_t i, j; const sector_t *ss = sectors; @@ -1134,102 +1373,102 @@ static void ArchiveSectors(void) if (diff) { - WRITEUINT32(save_p, i); - WRITEUINT8(save_p, diff); + P_WriteUINT32(save_p, i); + P_WriteUINT8(save_p, diff); if (diff & SD_DIFF2) - WRITEUINT8(save_p, diff2); + P_WriteUINT8(save_p, diff2); if (diff2 & SD_DIFF3) - WRITEUINT8(save_p, diff3); + P_WriteUINT8(save_p, diff3); if (diff3 & SD_DIFF4) - WRITEUINT8(save_p, diff4); + P_WriteUINT8(save_p, diff4); if (diff4 & SD_DIFF5) - WRITEUINT8(save_p, diff5); + P_WriteUINT8(save_p, diff5); if (diff & SD_FLOORHT) - WRITEFIXED(save_p, ss->floorheight); + P_WriteFixed(save_p, ss->floorheight); if (diff & SD_CEILHT) - WRITEFIXED(save_p, ss->ceilingheight); + P_WriteFixed(save_p, ss->ceilingheight); if (diff & SD_FLOORPIC) - WRITEMEM(save_p, levelflats[ss->floorpic].name, 8); + P_WriteMem(save_p, levelflats[ss->floorpic].name, 8); if (diff & SD_CEILPIC) - WRITEMEM(save_p, levelflats[ss->ceilingpic].name, 8); + P_WriteMem(save_p, levelflats[ss->ceilingpic].name, 8); if (diff & SD_LIGHT) - WRITEINT16(save_p, ss->lightlevel); + P_WriteINT16(save_p, ss->lightlevel); if (diff & SD_SPECIAL) - WRITEINT16(save_p, ss->special); + P_WriteINT16(save_p, ss->special); if (diff2 & SD_FXOFFS) - WRITEFIXED(save_p, ss->floorxoffset); + P_WriteFixed(save_p, ss->floorxoffset); if (diff2 & SD_FYOFFS) - WRITEFIXED(save_p, ss->flooryoffset); + P_WriteFixed(save_p, ss->flooryoffset); if (diff2 & SD_CXOFFS) - WRITEFIXED(save_p, ss->ceilingxoffset); + P_WriteFixed(save_p, ss->ceilingxoffset); if (diff2 & SD_CYOFFS) - WRITEFIXED(save_p, ss->ceilingyoffset); + P_WriteFixed(save_p, ss->ceilingyoffset); if (diff2 & SD_FLOORANG) - WRITEANGLE(save_p, ss->floorangle); + P_WriteAngle(save_p, ss->floorangle); if (diff2 & SD_CEILANG) - WRITEANGLE(save_p, ss->ceilingangle); + P_WriteAngle(save_p, ss->ceilingangle); if (diff2 & SD_TAG) { - WRITEUINT32(save_p, ss->tags.count); + P_WriteUINT32(save_p, ss->tags.count); for (j = 0; j < ss->tags.count; j++) - WRITEINT16(save_p, ss->tags.tags[j]); + P_WriteINT16(save_p, ss->tags.tags[j]); } if (diff3 & SD_COLORMAP) - WRITEUINT32(save_p, CheckAddNetColormapToList(ss->extra_colormap)); + P_WriteUINT32(save_p, CheckAddNetColormapToList(ss->extra_colormap)); // returns existing index if already added, or appends to net_colormaps and returns new index if (diff3 & SD_CRUMBLESTATE) - WRITEINT32(save_p, ss->crumblestate); + P_WriteINT32(save_p, ss->crumblestate); if (diff3 & SD_FLOORLIGHT) { - WRITEINT16(save_p, ss->floorlightlevel); - WRITEUINT8(save_p, ss->floorlightabsolute); + P_WriteINT16(save_p, ss->floorlightlevel); + P_WriteUINT8(save_p, ss->floorlightabsolute); } if (diff3 & SD_CEILLIGHT) { - WRITEINT16(save_p, ss->ceilinglightlevel); - WRITEUINT8(save_p, ss->ceilinglightabsolute); + P_WriteINT16(save_p, ss->ceilinglightlevel); + P_WriteUINT8(save_p, ss->ceilinglightabsolute); } if (diff3 & SD_FLAG) - WRITEUINT32(save_p, ss->flags); + P_WriteUINT32(save_p, ss->flags); if (diff3 & SD_SPECIALFLAG) - WRITEUINT32(save_p, ss->specialflags); + P_WriteUINT32(save_p, ss->specialflags); if (diff4 & SD_DAMAGETYPE) - WRITEUINT8(save_p, ss->damagetype); + P_WriteUINT8(save_p, ss->damagetype); if (diff4 & SD_TRIGGERTAG) - WRITEINT16(save_p, ss->triggertag); + P_WriteINT16(save_p, ss->triggertag); if (diff4 & SD_TRIGGERER) - WRITEUINT8(save_p, ss->triggerer); + P_WriteUINT8(save_p, ss->triggerer); if (diff4 & SD_FXSCALE) - WRITEFIXED(save_p, ss->floorxscale); + P_WriteFixed(save_p, ss->floorxscale); if (diff4 & SD_FYSCALE) - WRITEFIXED(save_p, ss->flooryscale); + P_WriteFixed(save_p, ss->flooryscale); if (diff4 & SD_CXSCALE) - WRITEFIXED(save_p, ss->ceilingxscale); + P_WriteFixed(save_p, ss->ceilingxscale); if (diff4 & SD_CYSCALE) - WRITEFIXED(save_p, ss->ceilingyscale); + P_WriteFixed(save_p, ss->ceilingyscale); if (diff5 & SD_GRAVITY) - WRITEFIXED(save_p, ss->gravity); + P_WriteFixed(save_p, ss->gravity); if (diff5 & SD_FLOORPORTAL) - WRITEUINT32(save_p, ss->portal_floor); + P_WriteUINT32(save_p, ss->portal_floor); if (diff5 & SD_CEILPORTAL) - WRITEUINT32(save_p, ss->portal_ceiling); + P_WriteUINT32(save_p, ss->portal_ceiling); if (diff & SD_FFLOORS) - ArchiveFFloors(ss); + ArchiveFFloors(save_p, ss); } } - WRITEUINT32(save_p, 0xffffffff); + P_WriteUINT32(save_p, 0xffffffff); } -static void UnArchiveSectors(void) +static void UnArchiveSectors(save_t *save_p) { UINT32 i; UINT16 j; UINT8 diff, diff2, diff3, diff4, diff5; for (;;) { - i = READUINT32(save_p); + i = P_ReadUINT32(save_p); if (i == 0xffffffff) break; @@ -1237,28 +1476,28 @@ static void UnArchiveSectors(void) if (i > numsectors) I_Error("Invalid sector number %u from server (expected end at %s)", i, sizeu1(numsectors)); - diff = READUINT8(save_p); + diff = P_ReadUINT8(save_p); if (diff & SD_DIFF2) - diff2 = READUINT8(save_p); + diff2 = P_ReadUINT8(save_p); else diff2 = 0; if (diff2 & SD_DIFF3) - diff3 = READUINT8(save_p); + diff3 = P_ReadUINT8(save_p); else diff3 = 0; if (diff3 & SD_DIFF4) - diff4 = READUINT8(save_p); + diff4 = P_ReadUINT8(save_p); else diff4 = 0; if (diff4 & SD_DIFF5) - diff5 = READUINT8(save_p); + diff5 = P_ReadUINT8(save_p); else diff5 = 0; if (diff & SD_FLOORHT) - sectors[i].floorheight = READFIXED(save_p); + sectors[i].floorheight = P_ReadFixed(save_p); if (diff & SD_CEILHT) - sectors[i].ceilingheight = READFIXED(save_p); + sectors[i].ceilingheight = P_ReadFixed(save_p); if (diff & SD_FLOORPIC) { sectors[i].floorpic = P_AddLevelFlatRuntime((char *)save_p); @@ -1270,25 +1509,25 @@ static void UnArchiveSectors(void) save_p += 8; } if (diff & SD_LIGHT) - sectors[i].lightlevel = READINT16(save_p); + sectors[i].lightlevel = P_ReadINT16(save_p); if (diff & SD_SPECIAL) - sectors[i].special = READINT16(save_p); + sectors[i].special = P_ReadINT16(save_p); if (diff2 & SD_FXOFFS) - sectors[i].floorxoffset = READFIXED(save_p); + sectors[i].floorxoffset = P_ReadFixed(save_p); if (diff2 & SD_FYOFFS) - sectors[i].flooryoffset = READFIXED(save_p); + sectors[i].flooryoffset = P_ReadFixed(save_p); if (diff2 & SD_CXOFFS) - sectors[i].ceilingxoffset = READFIXED(save_p); + sectors[i].ceilingxoffset = P_ReadFixed(save_p); if (diff2 & SD_CYOFFS) - sectors[i].ceilingyoffset = READFIXED(save_p); + sectors[i].ceilingyoffset = P_ReadFixed(save_p); if (diff2 & SD_FLOORANG) - sectors[i].floorangle = READANGLE(save_p); + sectors[i].floorangle = P_ReadAngle(save_p); if (diff2 & SD_CEILANG) - sectors[i].ceilingangle = READANGLE(save_p); + sectors[i].ceilingangle = P_ReadAngle(save_p); if (diff2 & SD_TAG) { - size_t ncount = READUINT32(save_p); + size_t ncount = P_ReadUINT32(save_p); // Remove entries from global lists. for (j = 0; j < sectors[i].tags.count; j++) @@ -1302,7 +1541,7 @@ static void UnArchiveSectors(void) } for (j = 0; j < ncount; j++) - sectors[i].tags.tags[j] = READINT16(save_p); + sectors[i].tags.tags[j] = P_ReadINT16(save_p); // Add new entries. for (j = 0; j < sectors[i].tags.count; j++) @@ -1311,49 +1550,49 @@ static void UnArchiveSectors(void) if (diff3 & SD_COLORMAP) - sectors[i].extra_colormap = GetNetColormapFromList(READUINT32(save_p)); + sectors[i].extra_colormap = GetNetColormapFromList(P_ReadUINT32(save_p)); if (diff3 & SD_CRUMBLESTATE) - sectors[i].crumblestate = READINT32(save_p); + sectors[i].crumblestate = P_ReadINT32(save_p); if (diff3 & SD_FLOORLIGHT) { - sectors[i].floorlightlevel = READINT16(save_p); - sectors[i].floorlightabsolute = READUINT8(save_p); + sectors[i].floorlightlevel = P_ReadINT16(save_p); + sectors[i].floorlightabsolute = P_ReadUINT8(save_p); } if (diff3 & SD_CEILLIGHT) { - sectors[i].ceilinglightlevel = READINT16(save_p); - sectors[i].ceilinglightabsolute = READUINT8(save_p); + sectors[i].ceilinglightlevel = P_ReadINT16(save_p); + sectors[i].ceilinglightabsolute = P_ReadUINT8(save_p); } if (diff3 & SD_FLAG) { - sectors[i].flags = READUINT32(save_p); + sectors[i].flags = P_ReadUINT32(save_p); CheckForReverseGravity |= (sectors[i].flags & MSF_GRAVITYFLIP); } if (diff3 & SD_SPECIALFLAG) - sectors[i].specialflags = READUINT32(save_p); + sectors[i].specialflags = P_ReadUINT32(save_p); if (diff4 & SD_DAMAGETYPE) - sectors[i].damagetype = READUINT8(save_p); + sectors[i].damagetype = P_ReadUINT8(save_p); if (diff4 & SD_TRIGGERTAG) - sectors[i].triggertag = READINT16(save_p); + sectors[i].triggertag = P_ReadINT16(save_p); if (diff4 & SD_TRIGGERER) - sectors[i].triggerer = READUINT8(save_p); + sectors[i].triggerer = P_ReadUINT8(save_p); if (diff4 & SD_FXSCALE) - sectors[i].floorxscale = READFIXED(save_p); + sectors[i].floorxscale = P_ReadFixed(save_p); if (diff4 & SD_FYSCALE) - sectors[i].flooryscale = READFIXED(save_p); + sectors[i].flooryscale = P_ReadFixed(save_p); if (diff4 & SD_CXSCALE) - sectors[i].ceilingxscale = READFIXED(save_p); + sectors[i].ceilingxscale = P_ReadFixed(save_p); if (diff4 & SD_CYSCALE) - sectors[i].ceilingyscale = READFIXED(save_p); + sectors[i].ceilingyscale = P_ReadFixed(save_p); if (diff5 & SD_GRAVITY) - sectors[i].gravity = READFIXED(save_p); + sectors[i].gravity = P_ReadFixed(save_p); if (diff5 & SD_FLOORPORTAL) - sectors[i].portal_floor = READUINT32(save_p); + sectors[i].portal_floor = P_ReadUINT32(save_p); if (diff5 & SD_CEILPORTAL) - sectors[i].portal_ceiling = READUINT32(save_p); + sectors[i].portal_ceiling = P_ReadUINT32(save_p); if (diff & SD_FFLOORS) - UnArchiveFFloors(§ors[i]); + UnArchiveFFloors(save_p, §ors[i]); } } @@ -1416,65 +1655,65 @@ static UINT32 GetSideDiff(const side_t *si, const side_t *spawnsi) return diff; } -static void ArchiveSide(const side_t *si, UINT32 diff) +static void ArchiveSide(save_t *save_p, const side_t *si, UINT32 diff) { - WRITEUINT32(save_p, diff); + P_WriteUINT32(save_p, diff); if (diff & LD_SDTEXOFFX) - WRITEFIXED(save_p, si->textureoffset); + P_WriteFixed(save_p, si->textureoffset); if (diff & LD_SDTEXOFFY) - WRITEFIXED(save_p, si->rowoffset); + P_WriteFixed(save_p, si->rowoffset); if (diff & LD_SDTOPTEX) - WRITEINT32(save_p, si->toptexture); + P_WriteINT32(save_p, si->toptexture); if (diff & LD_SDBOTTEX) - WRITEINT32(save_p, si->bottomtexture); + P_WriteINT32(save_p, si->bottomtexture); if (diff & LD_SDMIDTEX) - WRITEINT32(save_p, si->midtexture); + P_WriteINT32(save_p, si->midtexture); if (diff & LD_SDTOPOFFX) - WRITEFIXED(save_p, si->offsetx_top); + P_WriteFixed(save_p, si->offsetx_top); if (diff & LD_SDMIDOFFX) - WRITEFIXED(save_p, si->offsetx_mid); + P_WriteFixed(save_p, si->offsetx_mid); if (diff & LD_SDBOTOFFX) - WRITEFIXED(save_p, si->offsetx_bottom); + P_WriteFixed(save_p, si->offsetx_bottom); if (diff & LD_SDTOPOFFY) - WRITEFIXED(save_p, si->offsety_top); + P_WriteFixed(save_p, si->offsety_top); if (diff & LD_SDMIDOFFY) - WRITEFIXED(save_p, si->offsety_mid); + P_WriteFixed(save_p, si->offsety_mid); if (diff & LD_SDBOTOFFY) - WRITEFIXED(save_p, si->offsety_bottom); + P_WriteFixed(save_p, si->offsety_bottom); if (diff & LD_SDTOPSCALEX) - WRITEFIXED(save_p, si->scalex_top); + P_WriteFixed(save_p, si->scalex_top); if (diff & LD_SDMIDSCALEX) - WRITEFIXED(save_p, si->scalex_mid); + P_WriteFixed(save_p, si->scalex_mid); if (diff & LD_SDBOTSCALEX) - WRITEFIXED(save_p, si->scalex_bottom); + P_WriteFixed(save_p, si->scalex_bottom); if (diff & LD_SDTOPSCALEY) - WRITEFIXED(save_p, si->scaley_top); + P_WriteFixed(save_p, si->scaley_top); if (diff & LD_SDMIDSCALEY) - WRITEFIXED(save_p, si->scaley_mid); + P_WriteFixed(save_p, si->scaley_mid); if (diff & LD_SDBOTSCALEY) - WRITEFIXED(save_p, si->scaley_bottom); + P_WriteFixed(save_p, si->scaley_bottom); if (diff & LD_SDREPEATCNT) - WRITEINT16(save_p, si->repeatcnt); + P_WriteINT16(save_p, si->repeatcnt); if (diff & LD_SDLIGHT) - WRITEINT16(save_p, si->light); + P_WriteINT16(save_p, si->light); if (diff & LD_SDTOPLIGHT) - WRITEINT16(save_p, si->light_top); + P_WriteINT16(save_p, si->light_top); if (diff & LD_SDMIDLIGHT) - WRITEINT16(save_p, si->light_mid); + P_WriteINT16(save_p, si->light_mid); if (diff & LD_SDBOTLIGHT) - WRITEINT16(save_p, si->light_bottom); + P_WriteINT16(save_p, si->light_bottom); if (diff & LD_SDLIGHTABS) - WRITEUINT8(save_p, si->lightabsolute); + P_WriteUINT8(save_p, si->lightabsolute); if (diff & LD_SDTOPLIGHTABS) - WRITEUINT8(save_p, si->lightabsolute_top); + P_WriteUINT8(save_p, si->lightabsolute_top); if (diff & LD_SDMIDLIGHTABS) - WRITEUINT8(save_p, si->lightabsolute_mid); + P_WriteUINT8(save_p, si->lightabsolute_mid); if (diff & LD_SDBOTLIGHTABS) - WRITEUINT8(save_p, si->lightabsolute_bottom); + P_WriteUINT8(save_p, si->lightabsolute_bottom); } -static void ArchiveLines(void) +static void ArchiveLines(save_t *save_p) { size_t i; const line_t *li = lines; @@ -1524,21 +1763,21 @@ static void ArchiveLines(void) if (diff) { - WRITEUINT32(save_p, i); - WRITEUINT8(save_p, diff); + P_WriteUINT32(save_p, i); + P_WriteUINT8(save_p, diff); if (diff & LD_DIFF2) - WRITEUINT8(save_p, diff2); + P_WriteUINT8(save_p, diff2); if (diff & LD_FLAG) - WRITEINT16(save_p, li->flags); + P_WriteINT16(save_p, li->flags); if (diff & LD_SPECIAL) - WRITEINT16(save_p, li->special); + P_WriteINT16(save_p, li->special); if (diff & LD_CLLCOUNT) - WRITEINT16(save_p, li->callcount); + P_WriteINT16(save_p, li->callcount); if (diff & LD_ARGS) { UINT8 j; for (j = 0; j < NUMLINEARGS; j++) - WRITEINT32(save_p, li->args[j]); + P_WriteINT32(save_p, li->args[j]); } if (diff & LD_STRINGARGS) { @@ -1549,88 +1788,88 @@ static void ArchiveLines(void) if (!li->stringargs[j]) { - WRITEINT32(save_p, 0); + P_WriteINT32(save_p, 0); continue; } len = strlen(li->stringargs[j]); - WRITEINT32(save_p, len); + P_WriteINT32(save_p, len); for (k = 0; k < len; k++) - WRITECHAR(save_p, li->stringargs[j][k]); + P_WriteChar(save_p, li->stringargs[j][k]); } } if (diff & LD_SIDE1) - ArchiveSide(&sides[li->sidenum[0]], side1diff); + ArchiveSide(save_p, &sides[li->sidenum[0]], side1diff); if (diff & LD_SIDE2) - ArchiveSide(&sides[li->sidenum[1]], side2diff); + ArchiveSide(save_p, &sides[li->sidenum[1]], side2diff); if (diff2 & LD_EXECUTORDELAY) - WRITEINT32(save_p, li->executordelay); + P_WriteINT32(save_p, li->executordelay); if (diff2 & LD_TRANSFPORTAL) - WRITEUINT32(save_p, li->secportal); + P_WriteUINT32(save_p, li->secportal); } } - WRITEUINT32(save_p, 0xffffffff); + P_WriteUINT32(save_p, 0xffffffff); } -static void UnArchiveSide(side_t *si) +static void UnArchiveSide(save_t *save_p, side_t *si) { - UINT32 diff = READUINT32(save_p); + UINT32 diff = P_ReadUINT32(save_p); if (diff & LD_SDTEXOFFX) - si->textureoffset = READFIXED(save_p); + si->textureoffset = P_ReadFixed(save_p); if (diff & LD_SDTEXOFFY) - si->rowoffset = READFIXED(save_p); + si->rowoffset = P_ReadFixed(save_p); if (diff & LD_SDTOPTEX) - si->toptexture = READINT32(save_p); + si->toptexture = P_ReadINT32(save_p); if (diff & LD_SDBOTTEX) - si->bottomtexture = READINT32(save_p); + si->bottomtexture = P_ReadINT32(save_p); if (diff & LD_SDMIDTEX) - si->midtexture = READINT32(save_p); + si->midtexture = P_ReadINT32(save_p); if (diff & LD_SDTOPOFFX) - si->offsetx_top = READFIXED(save_p); + si->offsetx_top = P_ReadFixed(save_p); if (diff & LD_SDMIDOFFX) - si->offsetx_mid = READFIXED(save_p); + si->offsetx_mid = P_ReadFixed(save_p); if (diff & LD_SDBOTOFFX) - si->offsetx_bottom = READFIXED(save_p); + si->offsetx_bottom = P_ReadFixed(save_p); if (diff & LD_SDTOPOFFY) - si->offsety_top = READFIXED(save_p); + si->offsety_top = P_ReadFixed(save_p); if (diff & LD_SDMIDOFFY) - si->offsety_mid = READFIXED(save_p); + si->offsety_mid = P_ReadFixed(save_p); if (diff & LD_SDBOTOFFY) - si->offsety_bottom = READFIXED(save_p); + si->offsety_bottom = P_ReadFixed(save_p); if (diff & LD_SDTOPSCALEX) - si->scalex_top = READFIXED(save_p); + si->scalex_top = P_ReadFixed(save_p); if (diff & LD_SDMIDSCALEX) - si->scalex_mid = READFIXED(save_p); + si->scalex_mid = P_ReadFixed(save_p); if (diff & LD_SDBOTSCALEX) - si->scalex_bottom = READFIXED(save_p); + si->scalex_bottom = P_ReadFixed(save_p); if (diff & LD_SDTOPSCALEY) - si->scaley_top = READFIXED(save_p); + si->scaley_top = P_ReadFixed(save_p); if (diff & LD_SDMIDSCALEY) - si->scaley_mid = READFIXED(save_p); + si->scaley_mid = P_ReadFixed(save_p); if (diff & LD_SDBOTSCALEY) - si->scaley_bottom = READFIXED(save_p); + si->scaley_bottom = P_ReadFixed(save_p); if (diff & LD_SDREPEATCNT) - si->repeatcnt = READINT16(save_p); + si->repeatcnt = P_ReadINT16(save_p); if (diff & LD_SDLIGHT) - si->light = READINT16(save_p); + si->light = P_ReadINT16(save_p); if (diff & LD_SDTOPLIGHT) - si->light_top = READINT16(save_p); + si->light_top = P_ReadINT16(save_p); if (diff & LD_SDMIDLIGHT) - si->light_mid = READINT16(save_p); + si->light_mid = P_ReadINT16(save_p); if (diff & LD_SDBOTLIGHT) - si->light_bottom = READINT16(save_p); + si->light_bottom = P_ReadINT16(save_p); if (diff & LD_SDLIGHTABS) - si->lightabsolute = READUINT8(save_p); + si->lightabsolute = P_ReadUINT8(save_p); if (diff & LD_SDTOPLIGHTABS) - si->lightabsolute_top = READUINT8(save_p); + si->lightabsolute_top = P_ReadUINT8(save_p); if (diff & LD_SDMIDLIGHTABS) - si->lightabsolute_mid = READUINT8(save_p); + si->lightabsolute_mid = P_ReadUINT8(save_p); if (diff & LD_SDBOTLIGHTABS) - si->lightabsolute_bottom = READUINT8(save_p); + si->lightabsolute_bottom = P_ReadUINT8(save_p); } -static void UnArchiveLines(void) +static void UnArchiveLines(save_t *save_p) { UINT32 i; line_t *li; @@ -1638,38 +1877,38 @@ static void UnArchiveLines(void) for (;;) { - i = READUINT32(save_p); + i = P_ReadUINT32(save_p); if (i == 0xffffffff) break; if (i > numlines) I_Error("Invalid line number %u from server", i); - diff = READUINT8(save_p); + diff = P_ReadUINT8(save_p); if (diff & LD_DIFF2) - diff2 = READUINT8(save_p); + diff2 = P_ReadUINT8(save_p); else diff2 = 0; li = &lines[i]; if (diff & LD_FLAG) - li->flags = READINT16(save_p); + li->flags = P_ReadINT16(save_p); if (diff & LD_SPECIAL) - li->special = READINT16(save_p); + li->special = P_ReadINT16(save_p); if (diff & LD_CLLCOUNT) - li->callcount = READINT16(save_p); + li->callcount = P_ReadINT16(save_p); if (diff & LD_ARGS) { UINT8 j; for (j = 0; j < NUMLINEARGS; j++) - li->args[j] = READINT32(save_p); + li->args[j] = P_ReadINT32(save_p); } if (diff & LD_STRINGARGS) { UINT8 j; for (j = 0; j < NUMLINESTRINGARGS; j++) { - size_t len = READINT32(save_p); + size_t len = P_ReadINT32(save_p); size_t k; if (!len) @@ -1681,38 +1920,38 @@ static void UnArchiveLines(void) li->stringargs[j] = Z_Realloc(li->stringargs[j], len + 1, PU_LEVEL, NULL); for (k = 0; k < len; k++) - li->stringargs[j][k] = READCHAR(save_p); + li->stringargs[j][k] = P_ReadChar(save_p); li->stringargs[j][len] = '\0'; } } if (diff & LD_SIDE1) - UnArchiveSide(&sides[li->sidenum[0]]); + UnArchiveSide(save_p, &sides[li->sidenum[0]]); if (diff & LD_SIDE2) - UnArchiveSide(&sides[li->sidenum[1]]); + UnArchiveSide(save_p, &sides[li->sidenum[1]]); if (diff2 & LD_EXECUTORDELAY) - li->executordelay = READINT32(save_p); + li->executordelay = P_ReadINT32(save_p); if (diff2 & LD_TRANSFPORTAL) - li->secportal = READUINT32(save_p); + li->secportal = P_ReadUINT32(save_p); } } -static void P_NetArchiveWorld(void) +static void P_NetArchiveWorld(save_t *save_p) { // initialize colormap vars because paranoia ClearNetColormaps(); - WRITEUINT32(save_p, ARCHIVEBLOCK_WORLD); + P_WriteUINT32(save_p, ARCHIVEBLOCK_WORLD); - ArchiveSectors(); - ArchiveLines(); + ArchiveSectors(save_p); + ArchiveLines(save_p); R_ClearTextureNumCache(false); } -static void P_NetUnArchiveWorld(void) +static void P_NetUnArchiveWorld(save_t *save_p) { UINT16 i; - if (READUINT32(save_p) != ARCHIVEBLOCK_WORLD) + if (P_ReadUINT32(save_p) != ARCHIVEBLOCK_WORLD) I_Error("Bad $$$.sav at archive block World"); // initialize colormap vars because paranoia @@ -1726,8 +1965,8 @@ static void P_NetUnArchiveWorld(void) num_ffloors++; } - UnArchiveSectors(); - UnArchiveLines(); + UnArchiveSectors(save_p); + UnArchiveLines(save_p); } // @@ -1878,7 +2117,7 @@ static UINT32 SaveSlope(const pslope_t *slope) return 0xFFFFFFFF; } -static void SaveMobjThinker(const thinker_t *th, const UINT8 type) +static void SaveMobjThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const mobj_t *mobj = (const mobj_t *)th; UINT32 diff; @@ -2052,28 +2291,28 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) if (mobj->type == MT_HOOPCENTER) diff = MD_SPAWNPOINT; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, diff); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, diff); if (diff & MD_MORE) - WRITEUINT32(save_p, diff2); + P_WriteUINT32(save_p, diff2); // save pointer, at load time we will search this pointer to reinitilize pointers - WRITEUINT32(save_p, (size_t)mobj); + P_WriteUINT32(save_p, (size_t)mobj); - WRITEFIXED(save_p, mobj->z); // Force this so 3dfloor problems don't arise. - WRITEFIXED(save_p, mobj->floorz); - WRITEFIXED(save_p, mobj->ceilingz); + P_WriteFixed(save_p, mobj->z); // Force this so 3dfloor problems don't arise. + P_WriteFixed(save_p, mobj->floorz); + P_WriteFixed(save_p, mobj->ceilingz); if (diff2 & MD2_FLOORROVER) { - WRITEUINT32(save_p, SaveSector(mobj->floorrover->target)); - WRITEUINT16(save_p, P_GetFFloorID(mobj->floorrover)); + P_WriteUINT32(save_p, SaveSector(mobj->floorrover->target)); + P_WriteUINT16(save_p, P_GetFFloorID(mobj->floorrover)); } if (diff2 & MD2_CEILINGROVER) { - WRITEUINT32(save_p, SaveSector(mobj->ceilingrover->target)); - WRITEUINT16(save_p, P_GetFFloorID(mobj->ceilingrover)); + P_WriteUINT32(save_p, SaveSector(mobj->ceilingrover->target)); + P_WriteUINT16(save_p, P_GetFFloorID(mobj->ceilingrover)); } if (diff & MD_SPAWNPOINT) @@ -2082,649 +2321,649 @@ static void SaveMobjThinker(const thinker_t *th, const UINT8 type) for (z = 0; z < nummapthings; z++) if (&mapthings[z] == mobj->spawnpoint) - WRITEUINT16(save_p, z); + P_WriteUINT16(save_p, z); if (mobj->type == MT_HOOPCENTER) return; } if (diff & MD_TYPE) - WRITEUINT32(save_p, mobj->type); + P_WriteUINT32(save_p, mobj->type); if (diff & MD_POS) { - WRITEFIXED(save_p, mobj->x); - WRITEFIXED(save_p, mobj->y); - WRITEANGLE(save_p, mobj->angle); - WRITEANGLE(save_p, mobj->pitch); - WRITEANGLE(save_p, mobj->roll); + P_WriteFixed(save_p, mobj->x); + P_WriteFixed(save_p, mobj->y); + P_WriteAngle(save_p, mobj->angle); + P_WriteAngle(save_p, mobj->pitch); + P_WriteAngle(save_p, mobj->roll); } if (diff & MD_MOM) { - WRITEFIXED(save_p, mobj->momx); - WRITEFIXED(save_p, mobj->momy); - WRITEFIXED(save_p, mobj->momz); - WRITEFIXED(save_p, mobj->pmomz); + P_WriteFixed(save_p, mobj->momx); + P_WriteFixed(save_p, mobj->momy); + P_WriteFixed(save_p, mobj->momz); + P_WriteFixed(save_p, mobj->pmomz); } if (diff & MD_RADIUS) - WRITEFIXED(save_p, mobj->radius); + P_WriteFixed(save_p, mobj->radius); if (diff & MD_HEIGHT) - WRITEFIXED(save_p, mobj->height); + P_WriteFixed(save_p, mobj->height); if (diff & MD_FLAGS) - WRITEUINT32(save_p, mobj->flags); + P_WriteUINT32(save_p, mobj->flags); if (diff & MD_FLAGS2) - WRITEUINT32(save_p, mobj->flags2); + P_WriteUINT32(save_p, mobj->flags2); if (diff & MD_HEALTH) - WRITEINT32(save_p, mobj->health); + P_WriteINT32(save_p, mobj->health); if (diff & MD_RTIME) - WRITEINT32(save_p, mobj->reactiontime); + P_WriteINT32(save_p, mobj->reactiontime); if (diff & MD_STATE) - WRITEUINT16(save_p, mobj->state-states); + P_WriteUINT16(save_p, mobj->state-states); if (diff & MD_TICS) - WRITEINT32(save_p, mobj->tics); + P_WriteINT32(save_p, mobj->tics); if (diff & MD_SPRITE) { - WRITEUINT16(save_p, mobj->sprite); + P_WriteUINT16(save_p, mobj->sprite); if (mobj->sprite == SPR_PLAY) - WRITEUINT16(save_p, mobj->sprite2); + P_WriteUINT16(save_p, mobj->sprite2); } if (diff & MD_FRAME) { - WRITEUINT32(save_p, mobj->frame); - WRITEUINT16(save_p, mobj->anim_duration); + P_WriteUINT32(save_p, mobj->frame); + P_WriteUINT16(save_p, mobj->anim_duration); } if (diff & MD_EFLAGS) - WRITEUINT16(save_p, mobj->eflags); + P_WriteUINT16(save_p, mobj->eflags); if (diff & MD_PLAYER) - WRITEUINT8(save_p, mobj->player-players); + P_WriteUINT8(save_p, mobj->player-players); if (diff & MD_MOVEDIR) - WRITEANGLE(save_p, mobj->movedir); + P_WriteAngle(save_p, mobj->movedir); if (diff & MD_MOVECOUNT) - WRITEINT32(save_p, mobj->movecount); + P_WriteINT32(save_p, mobj->movecount); if (diff & MD_THRESHOLD) - WRITEINT32(save_p, mobj->threshold); + P_WriteINT32(save_p, mobj->threshold); if (diff & MD_LASTLOOK) - WRITEINT32(save_p, mobj->lastlook); + P_WriteINT32(save_p, mobj->lastlook); if (diff & MD_TARGET) - WRITEUINT32(save_p, mobj->target->mobjnum); + P_WriteUINT32(save_p, mobj->target->mobjnum); if (diff & MD_TRACER) - WRITEUINT32(save_p, mobj->tracer->mobjnum); + P_WriteUINT32(save_p, mobj->tracer->mobjnum); if (diff & MD_FRICTION) - WRITEFIXED(save_p, mobj->friction); + P_WriteFixed(save_p, mobj->friction); if (diff & MD_MOVEFACTOR) - WRITEFIXED(save_p, mobj->movefactor); + P_WriteFixed(save_p, mobj->movefactor); if (diff & MD_FUSE) - WRITEINT32(save_p, mobj->fuse); + P_WriteINT32(save_p, mobj->fuse); if (diff & MD_WATERTOP) - WRITEFIXED(save_p, mobj->watertop); + P_WriteFixed(save_p, mobj->watertop); if (diff & MD_WATERBOTTOM) - WRITEFIXED(save_p, mobj->waterbottom); + P_WriteFixed(save_p, mobj->waterbottom); if (diff & MD_SCALE) - WRITEFIXED(save_p, mobj->scale); + P_WriteFixed(save_p, mobj->scale); if (diff & MD_DSCALE) - WRITEFIXED(save_p, mobj->destscale); + P_WriteFixed(save_p, mobj->destscale); if (diff2 & MD2_SCALESPEED) - WRITEFIXED(save_p, mobj->scalespeed); + P_WriteFixed(save_p, mobj->scalespeed); if (diff2 & MD2_CUSVAL) - WRITEINT32(save_p, mobj->cusval); + P_WriteINT32(save_p, mobj->cusval); if (diff2 & MD2_CVMEM) - WRITEINT32(save_p, mobj->cvmem); + P_WriteINT32(save_p, mobj->cvmem); if (diff2 & MD2_SKIN) - WRITEUINT8(save_p, (UINT8)(((skin_t *)mobj->skin)->skinnum)); + P_WriteUINT8(save_p, (UINT8)(((skin_t *)mobj->skin)->skinnum)); if (diff2 & MD2_COLOR) - WRITEUINT16(save_p, mobj->color); + P_WriteUINT16(save_p, mobj->color); if (diff2 & MD2_EXTVAL1) - WRITEINT32(save_p, mobj->extravalue1); + P_WriteINT32(save_p, mobj->extravalue1); if (diff2 & MD2_EXTVAL2) - WRITEINT32(save_p, mobj->extravalue2); + P_WriteINT32(save_p, mobj->extravalue2); if (diff2 & MD2_HNEXT) - WRITEUINT32(save_p, mobj->hnext->mobjnum); + P_WriteUINT32(save_p, mobj->hnext->mobjnum); if (diff2 & MD2_HPREV) - WRITEUINT32(save_p, mobj->hprev->mobjnum); + P_WriteUINT32(save_p, mobj->hprev->mobjnum); if (diff2 & MD2_SLOPE) - WRITEUINT16(save_p, mobj->standingslope->id); + P_WriteUINT16(save_p, mobj->standingslope->id); if (diff2 & MD2_COLORIZED) - WRITEUINT8(save_p, mobj->colorized); + P_WriteUINT8(save_p, mobj->colorized); if (diff2 & MD2_MIRRORED) - WRITEUINT8(save_p, mobj->mirrored); + P_WriteUINT8(save_p, mobj->mirrored); if (diff2 & MD2_SPRITEROLL) - WRITEANGLE(save_p, mobj->spriteroll); + P_WriteAngle(save_p, mobj->spriteroll); if (diff2 & MD2_SHADOWSCALE) - WRITEFIXED(save_p, mobj->shadowscale); + P_WriteFixed(save_p, mobj->shadowscale); if (diff2 & MD2_RENDERFLAGS) - WRITEUINT32(save_p, mobj->renderflags); + P_WriteUINT32(save_p, mobj->renderflags); if (diff2 & MD2_BLENDMODE) - WRITEINT32(save_p, mobj->blendmode); + P_WriteINT32(save_p, mobj->blendmode); if (diff2 & MD2_SPRITEXSCALE) - WRITEFIXED(save_p, mobj->spritexscale); + P_WriteFixed(save_p, mobj->spritexscale); if (diff2 & MD2_SPRITEYSCALE) - WRITEFIXED(save_p, mobj->spriteyscale); + P_WriteFixed(save_p, mobj->spriteyscale); if (diff2 & MD2_SPRITEXOFFSET) - WRITEFIXED(save_p, mobj->spritexoffset); + P_WriteFixed(save_p, mobj->spritexoffset); if (diff2 & MD2_SPRITEYOFFSET) - WRITEFIXED(save_p, mobj->spriteyoffset); + P_WriteFixed(save_p, mobj->spriteyoffset); if (diff2 & MD2_FLOORSPRITESLOPE) { pslope_t *slope = mobj->floorspriteslope; - WRITEFIXED(save_p, slope->zdelta); - WRITEANGLE(save_p, slope->zangle); - WRITEANGLE(save_p, slope->xydirection); + P_WriteFixed(save_p, slope->zdelta); + P_WriteAngle(save_p, slope->zangle); + P_WriteAngle(save_p, slope->xydirection); - WRITEFIXED(save_p, slope->o.x); - WRITEFIXED(save_p, slope->o.y); - WRITEFIXED(save_p, slope->o.z); + P_WriteFixed(save_p, slope->o.x); + P_WriteFixed(save_p, slope->o.y); + P_WriteFixed(save_p, slope->o.z); - WRITEFIXED(save_p, slope->d.x); - WRITEFIXED(save_p, slope->d.y); + P_WriteFixed(save_p, slope->d.x); + P_WriteFixed(save_p, slope->d.y); - WRITEFIXED(save_p, slope->normal.x); - WRITEFIXED(save_p, slope->normal.y); - WRITEFIXED(save_p, slope->normal.z); + P_WriteFixed(save_p, slope->normal.x); + P_WriteFixed(save_p, slope->normal.y); + P_WriteFixed(save_p, slope->normal.z); } if (diff2 & MD2_DRAWONLYFORPLAYER) - WRITEUINT8(save_p, mobj->drawonlyforplayer-players); + P_WriteUINT8(save_p, mobj->drawonlyforplayer-players); if (diff2 & MD2_DONTDRAWFORVIEWMOBJ) - WRITEUINT32(save_p, mobj->dontdrawforviewmobj->mobjnum); + P_WriteUINT32(save_p, mobj->dontdrawforviewmobj->mobjnum); if (diff2 & MD2_DISPOFFSET) - WRITEINT32(save_p, mobj->dispoffset); + P_WriteINT32(save_p, mobj->dispoffset); if (diff2 & MD2_TRANSLATION) - WRITEUINT16(save_p, mobj->translation); + P_WriteUINT16(save_p, mobj->translation); if (diff2 & MD2_ALPHA) - WRITEFIXED(save_p, mobj->alpha); + P_WriteFixed(save_p, mobj->alpha); - WRITEUINT32(save_p, mobj->mobjnum); + P_WriteUINT32(save_p, mobj->mobjnum); } -static void SaveNoEnemiesThinker(const thinker_t *th, const UINT8 type) +static void SaveNoEnemiesThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const noenemies_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveLine(ht->sourceline)); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveLine(ht->sourceline)); } -static void SaveBounceCheeseThinker(const thinker_t *th, const UINT8 type) +static void SaveBounceCheeseThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const bouncecheese_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveLine(ht->sourceline)); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEFIXED(save_p, ht->speed); - WRITEFIXED(save_p, ht->distance); - WRITEFIXED(save_p, ht->floorwasheight); - WRITEFIXED(save_p, ht->ceilingwasheight); - WRITECHAR(save_p, ht->low); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveLine(ht->sourceline)); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteFixed(save_p, ht->speed); + P_WriteFixed(save_p, ht->distance); + P_WriteFixed(save_p, ht->floorwasheight); + P_WriteFixed(save_p, ht->ceilingwasheight); + P_WriteChar(save_p, ht->low); } -static void SaveContinuousFallThinker(const thinker_t *th, const UINT8 type) +static void SaveContinuousFallThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const continuousfall_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEFIXED(save_p, ht->speed); - WRITEINT32(save_p, ht->direction); - WRITEFIXED(save_p, ht->floorstartheight); - WRITEFIXED(save_p, ht->ceilingstartheight); - WRITEFIXED(save_p, ht->destheight); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteFixed(save_p, ht->speed); + P_WriteINT32(save_p, ht->direction); + P_WriteFixed(save_p, ht->floorstartheight); + P_WriteFixed(save_p, ht->ceilingstartheight); + P_WriteFixed(save_p, ht->destheight); } -static void SaveMarioBlockThinker(const thinker_t *th, const UINT8 type) +static void SaveMarioBlockThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const mariothink_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEFIXED(save_p, ht->speed); - WRITEINT32(save_p, ht->direction); - WRITEFIXED(save_p, ht->floorstartheight); - WRITEFIXED(save_p, ht->ceilingstartheight); - WRITEINT16(save_p, ht->tag); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteFixed(save_p, ht->speed); + P_WriteINT32(save_p, ht->direction); + P_WriteFixed(save_p, ht->floorstartheight); + P_WriteFixed(save_p, ht->ceilingstartheight); + P_WriteINT16(save_p, ht->tag); } -static void SaveMarioCheckThinker(const thinker_t *th, const UINT8 type) +static void SaveMarioCheckThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const mariocheck_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveLine(ht->sourceline)); - WRITEUINT32(save_p, SaveSector(ht->sector)); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveLine(ht->sourceline)); + P_WriteUINT32(save_p, SaveSector(ht->sector)); } -static void SaveThwompThinker(const thinker_t *th, const UINT8 type) +static void SaveThwompThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const thwomp_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveLine(ht->sourceline)); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEFIXED(save_p, ht->crushspeed); - WRITEFIXED(save_p, ht->retractspeed); - WRITEINT32(save_p, ht->direction); - WRITEFIXED(save_p, ht->floorstartheight); - WRITEFIXED(save_p, ht->ceilingstartheight); - WRITEINT32(save_p, ht->delay); - WRITEINT16(save_p, ht->tag); - WRITEUINT16(save_p, ht->sound); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveLine(ht->sourceline)); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteFixed(save_p, ht->crushspeed); + P_WriteFixed(save_p, ht->retractspeed); + P_WriteINT32(save_p, ht->direction); + P_WriteFixed(save_p, ht->floorstartheight); + P_WriteFixed(save_p, ht->ceilingstartheight); + P_WriteINT32(save_p, ht->delay); + P_WriteINT16(save_p, ht->tag); + P_WriteUINT16(save_p, ht->sound); } -static void SaveFloatThinker(const thinker_t *th, const UINT8 type) +static void SaveFloatThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const floatthink_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveLine(ht->sourceline)); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEINT16(save_p, ht->tag); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveLine(ht->sourceline)); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteINT16(save_p, ht->tag); } -static void SaveEachTimeThinker(const thinker_t *th, const UINT8 type) +static void SaveEachTimeThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const eachtime_t *ht = (const void *)th; size_t i; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveLine(ht->sourceline)); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveLine(ht->sourceline)); for (i = 0; i < MAXPLAYERS; i++) { - WRITECHAR(save_p, ht->playersInArea[i]); + P_WriteChar(save_p, ht->playersInArea[i]); } - WRITECHAR(save_p, ht->triggerOnExit); + P_WriteChar(save_p, ht->triggerOnExit); } -static void SaveRaiseThinker(const thinker_t *th, const UINT8 type) +static void SaveRaiseThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const raise_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT16(save_p, ht->tag); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEFIXED(save_p, ht->ceilingbottom); - WRITEFIXED(save_p, ht->ceilingtop); - WRITEFIXED(save_p, ht->basespeed); - WRITEFIXED(save_p, ht->extraspeed); - WRITEUINT8(save_p, ht->shaketimer); - WRITEUINT8(save_p, ht->flags); + P_WriteUINT8(save_p, type); + P_WriteINT16(save_p, ht->tag); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteFixed(save_p, ht->ceilingbottom); + P_WriteFixed(save_p, ht->ceilingtop); + P_WriteFixed(save_p, ht->basespeed); + P_WriteFixed(save_p, ht->extraspeed); + P_WriteUINT8(save_p, ht->shaketimer); + P_WriteUINT8(save_p, ht->flags); } -static void SaveCeilingThinker(const thinker_t *th, const UINT8 type) +static void SaveCeilingThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const ceiling_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT8(save_p, ht->type); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEFIXED(save_p, ht->bottomheight); - WRITEFIXED(save_p, ht->topheight); - WRITEFIXED(save_p, ht->speed); - WRITEFIXED(save_p, ht->delay); - WRITEFIXED(save_p, ht->delaytimer); - WRITEUINT8(save_p, ht->crush); - WRITEINT32(save_p, ht->texture); - WRITEINT32(save_p, ht->direction); - WRITEINT16(save_p, ht->tag); - WRITEFIXED(save_p, ht->origspeed); - WRITEFIXED(save_p, ht->sourceline); + P_WriteUINT8(save_p, type); + P_WriteUINT8(save_p, ht->type); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteFixed(save_p, ht->bottomheight); + P_WriteFixed(save_p, ht->topheight); + P_WriteFixed(save_p, ht->speed); + P_WriteFixed(save_p, ht->delay); + P_WriteFixed(save_p, ht->delaytimer); + P_WriteUINT8(save_p, ht->crush); + P_WriteINT32(save_p, ht->texture); + P_WriteINT32(save_p, ht->direction); + P_WriteINT16(save_p, ht->tag); + P_WriteFixed(save_p, ht->origspeed); + P_WriteFixed(save_p, ht->sourceline); } -static void SaveFloormoveThinker(const thinker_t *th, const UINT8 type) +static void SaveFloormoveThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const floormove_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT8(save_p, ht->type); - WRITEUINT8(save_p, ht->crush); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEINT32(save_p, ht->direction); - WRITEINT32(save_p, ht->texture); - WRITEFIXED(save_p, ht->floordestheight); - WRITEFIXED(save_p, ht->speed); - WRITEFIXED(save_p, ht->origspeed); - WRITEFIXED(save_p, ht->delay); - WRITEFIXED(save_p, ht->delaytimer); - WRITEINT16(save_p, ht->tag); - WRITEFIXED(save_p, ht->sourceline); + P_WriteUINT8(save_p, type); + P_WriteUINT8(save_p, ht->type); + P_WriteUINT8(save_p, ht->crush); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteINT32(save_p, ht->direction); + P_WriteINT32(save_p, ht->texture); + P_WriteFixed(save_p, ht->floordestheight); + P_WriteFixed(save_p, ht->speed); + P_WriteFixed(save_p, ht->origspeed); + P_WriteFixed(save_p, ht->delay); + P_WriteFixed(save_p, ht->delaytimer); + P_WriteINT16(save_p, ht->tag); + P_WriteFixed(save_p, ht->sourceline); } -static void SaveLightflashThinker(const thinker_t *th, const UINT8 type) +static void SaveLightflashThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const lightflash_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEINT32(save_p, ht->maxlight); - WRITEINT32(save_p, ht->minlight); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteINT32(save_p, ht->maxlight); + P_WriteINT32(save_p, ht->minlight); } -static void SaveStrobeThinker(const thinker_t *th, const UINT8 type) +static void SaveStrobeThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const strobe_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEINT32(save_p, ht->count); - WRITEINT16(save_p, ht->minlight); - WRITEINT16(save_p, ht->maxlight); - WRITEINT32(save_p, ht->darktime); - WRITEINT32(save_p, ht->brighttime); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteINT32(save_p, ht->count); + P_WriteINT16(save_p, ht->minlight); + P_WriteINT16(save_p, ht->maxlight); + P_WriteINT32(save_p, ht->darktime); + P_WriteINT32(save_p, ht->brighttime); } -static void SaveGlowThinker(const thinker_t *th, const UINT8 type) +static void SaveGlowThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const glow_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEINT16(save_p, ht->minlight); - WRITEINT16(save_p, ht->maxlight); - WRITEINT16(save_p, ht->direction); - WRITEINT16(save_p, ht->speed); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteINT16(save_p, ht->minlight); + P_WriteINT16(save_p, ht->maxlight); + P_WriteINT16(save_p, ht->direction); + P_WriteINT16(save_p, ht->speed); } -static inline void SaveFireflickerThinker(const thinker_t *th, const UINT8 type) +static inline void SaveFireflickerThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const fireflicker_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEINT32(save_p, ht->count); - WRITEINT32(save_p, ht->resetcount); - WRITEINT16(save_p, ht->maxlight); - WRITEINT16(save_p, ht->minlight); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteINT32(save_p, ht->count); + P_WriteINT32(save_p, ht->resetcount); + P_WriteINT16(save_p, ht->maxlight); + P_WriteINT16(save_p, ht->minlight); } -static void SaveElevatorThinker(const thinker_t *th, const UINT8 type) +static void SaveElevatorThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const elevator_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT8(save_p, ht->type); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEUINT32(save_p, SaveSector(ht->actionsector)); - WRITEINT32(save_p, ht->direction); - WRITEFIXED(save_p, ht->floordestheight); - WRITEFIXED(save_p, ht->ceilingdestheight); - WRITEFIXED(save_p, ht->speed); - WRITEFIXED(save_p, ht->origspeed); - WRITEFIXED(save_p, ht->low); - WRITEFIXED(save_p, ht->high); - WRITEFIXED(save_p, ht->distance); - WRITEFIXED(save_p, ht->delay); - WRITEFIXED(save_p, ht->delaytimer); - WRITEFIXED(save_p, ht->floorwasheight); - WRITEFIXED(save_p, ht->ceilingwasheight); - WRITEUINT32(save_p, SaveLine(ht->sourceline)); + P_WriteUINT8(save_p, type); + P_WriteUINT8(save_p, ht->type); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteUINT32(save_p, SaveSector(ht->actionsector)); + P_WriteINT32(save_p, ht->direction); + P_WriteFixed(save_p, ht->floordestheight); + P_WriteFixed(save_p, ht->ceilingdestheight); + P_WriteFixed(save_p, ht->speed); + P_WriteFixed(save_p, ht->origspeed); + P_WriteFixed(save_p, ht->low); + P_WriteFixed(save_p, ht->high); + P_WriteFixed(save_p, ht->distance); + P_WriteFixed(save_p, ht->delay); + P_WriteFixed(save_p, ht->delaytimer); + P_WriteFixed(save_p, ht->floorwasheight); + P_WriteFixed(save_p, ht->ceilingwasheight); + P_WriteUINT32(save_p, SaveLine(ht->sourceline)); } -static void SaveCrumbleThinker(const thinker_t *th, const UINT8 type) +static void SaveCrumbleThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const crumble_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveLine(ht->sourceline)); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEUINT32(save_p, SaveSector(ht->actionsector)); - WRITEUINT32(save_p, SavePlayer(ht->player)); // was dummy - WRITEINT32(save_p, ht->direction); - WRITEINT32(save_p, ht->origalpha); - WRITEINT32(save_p, ht->timer); - WRITEFIXED(save_p, ht->speed); - WRITEFIXED(save_p, ht->floorwasheight); - WRITEFIXED(save_p, ht->ceilingwasheight); - WRITEUINT8(save_p, ht->flags); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveLine(ht->sourceline)); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteUINT32(save_p, SaveSector(ht->actionsector)); + P_WriteUINT32(save_p, SavePlayer(ht->player)); // was dummy + P_WriteINT32(save_p, ht->direction); + P_WriteINT32(save_p, ht->origalpha); + P_WriteINT32(save_p, ht->timer); + P_WriteFixed(save_p, ht->speed); + P_WriteFixed(save_p, ht->floorwasheight); + P_WriteFixed(save_p, ht->ceilingwasheight); + P_WriteUINT8(save_p, ht->flags); } -static inline void SaveScrollThinker(const thinker_t *th, const UINT8 type) +static inline void SaveScrollThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const scroll_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEFIXED(save_p, ht->dx); - WRITEFIXED(save_p, ht->dy); - WRITEINT32(save_p, ht->affectee); - WRITEINT32(save_p, ht->control); - WRITEFIXED(save_p, ht->last_height); - WRITEFIXED(save_p, ht->vdx); - WRITEFIXED(save_p, ht->vdy); - WRITEINT32(save_p, ht->accel); - WRITEINT32(save_p, ht->exclusive); - WRITEUINT8(save_p, ht->type); + P_WriteUINT8(save_p, type); + P_WriteFixed(save_p, ht->dx); + P_WriteFixed(save_p, ht->dy); + P_WriteINT32(save_p, ht->affectee); + P_WriteINT32(save_p, ht->control); + P_WriteFixed(save_p, ht->last_height); + P_WriteFixed(save_p, ht->vdx); + P_WriteFixed(save_p, ht->vdy); + P_WriteINT32(save_p, ht->accel); + P_WriteINT32(save_p, ht->exclusive); + P_WriteUINT8(save_p, ht->type); } -static inline void SaveFrictionThinker(const thinker_t *th, const UINT8 type) +static inline void SaveFrictionThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const friction_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT32(save_p, ht->friction); - WRITEINT32(save_p, ht->movefactor); - WRITEINT32(save_p, ht->affectee); - WRITEINT32(save_p, ht->referrer); - WRITEUINT8(save_p, ht->roverfriction); + P_WriteUINT8(save_p, type); + P_WriteINT32(save_p, ht->friction); + P_WriteINT32(save_p, ht->movefactor); + P_WriteINT32(save_p, ht->affectee); + P_WriteINT32(save_p, ht->referrer); + P_WriteUINT8(save_p, ht->roverfriction); } -static inline void SavePusherThinker(const thinker_t *th, const UINT8 type) +static inline void SavePusherThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const pusher_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT8(save_p, ht->type); - WRITEFIXED(save_p, ht->x_mag); - WRITEFIXED(save_p, ht->y_mag); - WRITEFIXED(save_p, ht->z_mag); - WRITEINT32(save_p, ht->affectee); - WRITEUINT8(save_p, ht->roverpusher); - WRITEINT32(save_p, ht->referrer); - WRITEINT32(save_p, ht->exclusive); - WRITEINT32(save_p, ht->slider); + P_WriteUINT8(save_p, type); + P_WriteUINT8(save_p, ht->type); + P_WriteFixed(save_p, ht->x_mag); + P_WriteFixed(save_p, ht->y_mag); + P_WriteFixed(save_p, ht->z_mag); + P_WriteINT32(save_p, ht->affectee); + P_WriteUINT8(save_p, ht->roverpusher); + P_WriteINT32(save_p, ht->referrer); + P_WriteINT32(save_p, ht->exclusive); + P_WriteINT32(save_p, ht->slider); } -static void SaveLaserThinker(const thinker_t *th, const UINT8 type) +static void SaveLaserThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const laserthink_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT16(save_p, ht->tag); - WRITEUINT32(save_p, SaveLine(ht->sourceline)); - WRITEUINT8(save_p, ht->nobosses); + P_WriteUINT8(save_p, type); + P_WriteINT16(save_p, ht->tag); + P_WriteUINT32(save_p, SaveLine(ht->sourceline)); + P_WriteUINT8(save_p, ht->nobosses); } -static void SaveLightlevelThinker(const thinker_t *th, const UINT8 type) +static void SaveLightlevelThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const lightlevel_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEINT16(save_p, ht->sourcelevel); - WRITEINT16(save_p, ht->destlevel); - WRITEFIXED(save_p, ht->fixedcurlevel); - WRITEFIXED(save_p, ht->fixedpertic); - WRITEINT32(save_p, ht->timer); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteINT16(save_p, ht->sourcelevel); + P_WriteINT16(save_p, ht->destlevel); + P_WriteFixed(save_p, ht->fixedcurlevel); + P_WriteFixed(save_p, ht->fixedpertic); + P_WriteINT32(save_p, ht->timer); } -static void SaveExecutorThinker(const thinker_t *th, const UINT8 type) +static void SaveExecutorThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const executor_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveLine(ht->line)); - WRITEUINT32(save_p, SaveMobjnum(ht->caller)); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEINT32(save_p, ht->timer); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveLine(ht->line)); + P_WriteUINT32(save_p, SaveMobjnum(ht->caller)); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteINT32(save_p, ht->timer); } -static void SaveDisappearThinker(const thinker_t *th, const UINT8 type) +static void SaveDisappearThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const disappear_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, ht->appeartime); - WRITEUINT32(save_p, ht->disappeartime); - WRITEUINT32(save_p, ht->offset); - WRITEUINT32(save_p, ht->timer); - WRITEINT32(save_p, ht->affectee); - WRITEINT32(save_p, ht->sourceline); - WRITEINT32(save_p, ht->exists); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, ht->appeartime); + P_WriteUINT32(save_p, ht->disappeartime); + P_WriteUINT32(save_p, ht->offset); + P_WriteUINT32(save_p, ht->timer); + P_WriteINT32(save_p, ht->affectee); + P_WriteINT32(save_p, ht->sourceline); + P_WriteINT32(save_p, ht->exists); } -static void SaveFadeThinker(const thinker_t *th, const UINT8 type) +static void SaveFadeThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const fade_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, CheckAddNetColormapToList(ht->dest_exc)); - WRITEUINT32(save_p, ht->sectornum); - WRITEUINT32(save_p, ht->ffloornum); - WRITEINT32(save_p, ht->alpha); - WRITEINT16(save_p, ht->sourcevalue); - WRITEINT16(save_p, ht->destvalue); - WRITEINT16(save_p, ht->destlightlevel); - WRITEINT16(save_p, ht->speed); - WRITEUINT8(save_p, (UINT8)ht->ticbased); - WRITEINT32(save_p, ht->timer); - WRITEUINT8(save_p, ht->doexists); - WRITEUINT8(save_p, ht->dotranslucent); - WRITEUINT8(save_p, ht->dolighting); - WRITEUINT8(save_p, ht->docolormap); - WRITEUINT8(save_p, ht->docollision); - WRITEUINT8(save_p, ht->doghostfade); - WRITEUINT8(save_p, ht->exactalpha); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, CheckAddNetColormapToList(ht->dest_exc)); + P_WriteUINT32(save_p, ht->sectornum); + P_WriteUINT32(save_p, ht->ffloornum); + P_WriteINT32(save_p, ht->alpha); + P_WriteINT16(save_p, ht->sourcevalue); + P_WriteINT16(save_p, ht->destvalue); + P_WriteINT16(save_p, ht->destlightlevel); + P_WriteINT16(save_p, ht->speed); + P_WriteUINT8(save_p, (UINT8)ht->ticbased); + P_WriteINT32(save_p, ht->timer); + P_WriteUINT8(save_p, ht->doexists); + P_WriteUINT8(save_p, ht->dotranslucent); + P_WriteUINT8(save_p, ht->dolighting); + P_WriteUINT8(save_p, ht->docolormap); + P_WriteUINT8(save_p, ht->docollision); + P_WriteUINT8(save_p, ht->doghostfade); + P_WriteUINT8(save_p, ht->exactalpha); } -static void SaveFadeColormapThinker(const thinker_t *th, const UINT8 type) +static void SaveFadeColormapThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const fadecolormap_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveSector(ht->sector)); - WRITEUINT32(save_p, CheckAddNetColormapToList(ht->source_exc)); - WRITEUINT32(save_p, CheckAddNetColormapToList(ht->dest_exc)); - WRITEUINT8(save_p, (UINT8)ht->ticbased); - WRITEINT32(save_p, ht->duration); - WRITEINT32(save_p, ht->timer); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveSector(ht->sector)); + P_WriteUINT32(save_p, CheckAddNetColormapToList(ht->source_exc)); + P_WriteUINT32(save_p, CheckAddNetColormapToList(ht->dest_exc)); + P_WriteUINT8(save_p, (UINT8)ht->ticbased); + P_WriteINT32(save_p, ht->duration); + P_WriteINT32(save_p, ht->timer); } -static void SavePlaneDisplaceThinker(const thinker_t *th, const UINT8 type) +static void SavePlaneDisplaceThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const planedisplace_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT32(save_p, ht->affectee); - WRITEINT32(save_p, ht->control); - WRITEFIXED(save_p, ht->last_height); - WRITEFIXED(save_p, ht->speed); - WRITEUINT8(save_p, ht->type); + P_WriteUINT8(save_p, type); + P_WriteINT32(save_p, ht->affectee); + P_WriteINT32(save_p, ht->control); + P_WriteFixed(save_p, ht->last_height); + P_WriteFixed(save_p, ht->speed); + P_WriteUINT8(save_p, ht->type); } -static inline void SaveDynamicLineSlopeThinker(const thinker_t *th, const UINT8 type) +static inline void SaveDynamicLineSlopeThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const dynlineplanethink_t* ht = (const void*)th; - WRITEUINT8(save_p, type); - WRITEUINT8(save_p, ht->type); - WRITEUINT32(save_p, SaveSlope(ht->slope)); - WRITEUINT32(save_p, SaveLine(ht->sourceline)); - WRITEFIXED(save_p, ht->extent); + P_WriteUINT8(save_p, type); + P_WriteUINT8(save_p, ht->type); + P_WriteUINT32(save_p, SaveSlope(ht->slope)); + P_WriteUINT32(save_p, SaveLine(ht->sourceline)); + P_WriteFixed(save_p, ht->extent); } -static inline void SaveDynamicVertexSlopeThinker(const thinker_t *th, const UINT8 type) +static inline void SaveDynamicVertexSlopeThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { size_t i; const dynvertexplanethink_t* ht = (const void*)th; - WRITEUINT8(save_p, type); - WRITEUINT32(save_p, SaveSlope(ht->slope)); + P_WriteUINT8(save_p, type); + P_WriteUINT32(save_p, SaveSlope(ht->slope)); for (i = 0; i < 3; i++) - WRITEUINT32(save_p, SaveSector(ht->secs[i])); - WRITEMEM(save_p, ht->vex, sizeof(ht->vex)); - WRITEMEM(save_p, ht->origsecheights, sizeof(ht->origsecheights)); - WRITEMEM(save_p, ht->origvecheights, sizeof(ht->origvecheights)); - WRITEUINT8(save_p, ht->relative); + P_WriteUINT32(save_p, SaveSector(ht->secs[i])); + P_WriteMem(save_p, ht->vex, sizeof(ht->vex)); + P_WriteMem(save_p, ht->origsecheights, sizeof(ht->origsecheights)); + P_WriteMem(save_p, ht->origvecheights, sizeof(ht->origvecheights)); + P_WriteUINT8(save_p, ht->relative); } -static inline void SavePolyrotatetThinker(const thinker_t *th, const UINT8 type) +static inline void SavePolyrotatetThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const polyrotate_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT32(save_p, ht->polyObjNum); - WRITEINT32(save_p, ht->speed); - WRITEINT32(save_p, ht->distance); - WRITEUINT8(save_p, ht->turnobjs); + P_WriteUINT8(save_p, type); + P_WriteINT32(save_p, ht->polyObjNum); + P_WriteINT32(save_p, ht->speed); + P_WriteINT32(save_p, ht->distance); + P_WriteUINT8(save_p, ht->turnobjs); } -static void SavePolymoveThinker(const thinker_t *th, const UINT8 type) +static void SavePolymoveThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const polymove_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT32(save_p, ht->polyObjNum); - WRITEINT32(save_p, ht->speed); - WRITEFIXED(save_p, ht->momx); - WRITEFIXED(save_p, ht->momy); - WRITEINT32(save_p, ht->distance); - WRITEANGLE(save_p, ht->angle); + P_WriteUINT8(save_p, type); + P_WriteINT32(save_p, ht->polyObjNum); + P_WriteINT32(save_p, ht->speed); + P_WriteFixed(save_p, ht->momx); + P_WriteFixed(save_p, ht->momy); + P_WriteINT32(save_p, ht->distance); + P_WriteAngle(save_p, ht->angle); } -static void SavePolywaypointThinker(const thinker_t *th, UINT8 type) +static void SavePolywaypointThinker(save_t *save_p, const thinker_t *th, UINT8 type) { const polywaypoint_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT32(save_p, ht->polyObjNum); - WRITEINT32(save_p, ht->speed); - WRITEINT32(save_p, ht->sequence); - WRITEINT32(save_p, ht->pointnum); - WRITEINT32(save_p, ht->direction); - WRITEUINT8(save_p, ht->returnbehavior); - WRITEUINT8(save_p, ht->continuous); - WRITEUINT8(save_p, ht->stophere); + P_WriteUINT8(save_p, type); + P_WriteINT32(save_p, ht->polyObjNum); + P_WriteINT32(save_p, ht->speed); + P_WriteINT32(save_p, ht->sequence); + P_WriteINT32(save_p, ht->pointnum); + P_WriteINT32(save_p, ht->direction); + P_WriteUINT8(save_p, ht->returnbehavior); + P_WriteUINT8(save_p, ht->continuous); + P_WriteUINT8(save_p, ht->stophere); } -static void SavePolyslidedoorThinker(const thinker_t *th, const UINT8 type) +static void SavePolyslidedoorThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const polyslidedoor_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT32(save_p, ht->polyObjNum); - WRITEINT32(save_p, ht->delay); - WRITEINT32(save_p, ht->delayCount); - WRITEINT32(save_p, ht->initSpeed); - WRITEINT32(save_p, ht->speed); - WRITEINT32(save_p, ht->initDistance); - WRITEINT32(save_p, ht->distance); - WRITEUINT32(save_p, ht->initAngle); - WRITEUINT32(save_p, ht->angle); - WRITEUINT32(save_p, ht->revAngle); - WRITEFIXED(save_p, ht->momx); - WRITEFIXED(save_p, ht->momy); - WRITEUINT8(save_p, ht->closing); + P_WriteUINT8(save_p, type); + P_WriteINT32(save_p, ht->polyObjNum); + P_WriteINT32(save_p, ht->delay); + P_WriteINT32(save_p, ht->delayCount); + P_WriteINT32(save_p, ht->initSpeed); + P_WriteINT32(save_p, ht->speed); + P_WriteINT32(save_p, ht->initDistance); + P_WriteINT32(save_p, ht->distance); + P_WriteUINT32(save_p, ht->initAngle); + P_WriteUINT32(save_p, ht->angle); + P_WriteUINT32(save_p, ht->revAngle); + P_WriteFixed(save_p, ht->momx); + P_WriteFixed(save_p, ht->momy); + P_WriteUINT8(save_p, ht->closing); } -static void SavePolyswingdoorThinker(const thinker_t *th, const UINT8 type) +static void SavePolyswingdoorThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const polyswingdoor_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT32(save_p, ht->polyObjNum); - WRITEINT32(save_p, ht->delay); - WRITEINT32(save_p, ht->delayCount); - WRITEINT32(save_p, ht->initSpeed); - WRITEINT32(save_p, ht->speed); - WRITEINT32(save_p, ht->initDistance); - WRITEINT32(save_p, ht->distance); - WRITEUINT8(save_p, ht->closing); + P_WriteUINT8(save_p, type); + P_WriteINT32(save_p, ht->polyObjNum); + P_WriteINT32(save_p, ht->delay); + P_WriteINT32(save_p, ht->delayCount); + P_WriteINT32(save_p, ht->initSpeed); + P_WriteINT32(save_p, ht->speed); + P_WriteINT32(save_p, ht->initDistance); + P_WriteINT32(save_p, ht->distance); + P_WriteUINT8(save_p, ht->closing); } -static void SavePolydisplaceThinker(const thinker_t *th, const UINT8 type) +static void SavePolydisplaceThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const polydisplace_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT32(save_p, ht->polyObjNum); - WRITEUINT32(save_p, SaveSector(ht->controlSector)); - WRITEFIXED(save_p, ht->dx); - WRITEFIXED(save_p, ht->dy); - WRITEFIXED(save_p, ht->oldHeights); + P_WriteUINT8(save_p, type); + P_WriteINT32(save_p, ht->polyObjNum); + P_WriteUINT32(save_p, SaveSector(ht->controlSector)); + P_WriteFixed(save_p, ht->dx); + P_WriteFixed(save_p, ht->dy); + P_WriteFixed(save_p, ht->oldHeights); } -static void SavePolyrotdisplaceThinker(const thinker_t *th, const UINT8 type) +static void SavePolyrotdisplaceThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const polyrotdisplace_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT32(save_p, ht->polyObjNum); - WRITEUINT32(save_p, SaveSector(ht->controlSector)); - WRITEFIXED(save_p, ht->rotscale); - WRITEUINT8(save_p, ht->turnobjs); - WRITEFIXED(save_p, ht->oldHeights); + P_WriteUINT8(save_p, type); + P_WriteINT32(save_p, ht->polyObjNum); + P_WriteUINT32(save_p, SaveSector(ht->controlSector)); + P_WriteFixed(save_p, ht->rotscale); + P_WriteUINT8(save_p, ht->turnobjs); + P_WriteFixed(save_p, ht->oldHeights); } -static void SavePolyfadeThinker(const thinker_t *th, const UINT8 type) +static void SavePolyfadeThinker(save_t *save_p, const thinker_t *th, const UINT8 type) { const polyfade_t *ht = (const void *)th; - WRITEUINT8(save_p, type); - WRITEINT32(save_p, ht->polyObjNum); - WRITEINT32(save_p, ht->sourcevalue); - WRITEINT32(save_p, ht->destvalue); - WRITEUINT8(save_p, (UINT8)ht->docollision); - WRITEUINT8(save_p, (UINT8)ht->doghostfade); - WRITEUINT8(save_p, (UINT8)ht->ticbased); - WRITEINT32(save_p, ht->duration); - WRITEINT32(save_p, ht->timer); + P_WriteUINT8(save_p, type); + P_WriteINT32(save_p, ht->polyObjNum); + P_WriteINT32(save_p, ht->sourcevalue); + P_WriteINT32(save_p, ht->destvalue); + P_WriteUINT8(save_p, (UINT8)ht->docollision); + P_WriteUINT8(save_p, (UINT8)ht->doghostfade); + P_WriteUINT8(save_p, (UINT8)ht->ticbased); + P_WriteINT32(save_p, ht->duration); + P_WriteINT32(save_p, ht->timer); } -static void P_NetArchiveThinkers(void) +static void P_NetArchiveThinkers(save_t *save_p) { const thinker_t *th; UINT32 i; - WRITEUINT32(save_p, ARCHIVEBLOCK_THINKERS); + P_WriteUINT32(save_p, ARCHIVEBLOCK_THINKERS); for (i = 0; i < NUM_THINKERLISTS; i++) { @@ -2738,7 +2977,7 @@ static void P_NetArchiveThinkers(void) if (th->function.acp1 == (actionf_p1)P_MobjThinker) { - SaveMobjThinker(th, tc_mobj); + SaveMobjThinker(save_p, th, tc_mobj); continue; } #ifdef PARANOIA @@ -2746,202 +2985,202 @@ static void P_NetArchiveThinkers(void) #endif else if (th->function.acp1 == (actionf_p1)T_MoveCeiling) { - SaveCeilingThinker(th, tc_ceiling); + SaveCeilingThinker(save_p, th, tc_ceiling); continue; } else if (th->function.acp1 == (actionf_p1)T_CrushCeiling) { - SaveCeilingThinker(th, tc_crushceiling); + SaveCeilingThinker(save_p, th, tc_crushceiling); continue; } else if (th->function.acp1 == (actionf_p1)T_MoveFloor) { - SaveFloormoveThinker(th, tc_floor); + SaveFloormoveThinker(save_p, th, tc_floor); continue; } else if (th->function.acp1 == (actionf_p1)T_LightningFlash) { - SaveLightflashThinker(th, tc_flash); + SaveLightflashThinker(save_p, th, tc_flash); continue; } else if (th->function.acp1 == (actionf_p1)T_StrobeFlash) { - SaveStrobeThinker(th, tc_strobe); + SaveStrobeThinker(save_p, th, tc_strobe); continue; } else if (th->function.acp1 == (actionf_p1)T_Glow) { - SaveGlowThinker(th, tc_glow); + SaveGlowThinker(save_p, th, tc_glow); continue; } else if (th->function.acp1 == (actionf_p1)T_FireFlicker) { - SaveFireflickerThinker(th, tc_fireflicker); + SaveFireflickerThinker(save_p, th, tc_fireflicker); continue; } else if (th->function.acp1 == (actionf_p1)T_MoveElevator) { - SaveElevatorThinker(th, tc_elevator); + SaveElevatorThinker(save_p, th, tc_elevator); continue; } else if (th->function.acp1 == (actionf_p1)T_ContinuousFalling) { - SaveContinuousFallThinker(th, tc_continuousfalling); + SaveContinuousFallThinker(save_p, th, tc_continuousfalling); continue; } else if (th->function.acp1 == (actionf_p1)T_ThwompSector) { - SaveThwompThinker(th, tc_thwomp); + SaveThwompThinker(save_p, th, tc_thwomp); continue; } else if (th->function.acp1 == (actionf_p1)T_NoEnemiesSector) { - SaveNoEnemiesThinker(th, tc_noenemies); + SaveNoEnemiesThinker(save_p, th, tc_noenemies); continue; } else if (th->function.acp1 == (actionf_p1)T_EachTimeThinker) { - SaveEachTimeThinker(th, tc_eachtime); + SaveEachTimeThinker(save_p, th, tc_eachtime); continue; } else if (th->function.acp1 == (actionf_p1)T_RaiseSector) { - SaveRaiseThinker(th, tc_raisesector); + SaveRaiseThinker(save_p, th, tc_raisesector); continue; } else if (th->function.acp1 == (actionf_p1)T_CameraScanner) { - SaveElevatorThinker(th, tc_camerascanner); + SaveElevatorThinker(save_p, th, tc_camerascanner); continue; } else if (th->function.acp1 == (actionf_p1)T_Scroll) { - SaveScrollThinker(th, tc_scroll); + SaveScrollThinker(save_p, th, tc_scroll); continue; } else if (th->function.acp1 == (actionf_p1)T_Friction) { - SaveFrictionThinker(th, tc_friction); + SaveFrictionThinker(save_p, th, tc_friction); continue; } else if (th->function.acp1 == (actionf_p1)T_Pusher) { - SavePusherThinker(th, tc_pusher); + SavePusherThinker(save_p, th, tc_pusher); continue; } else if (th->function.acp1 == (actionf_p1)T_BounceCheese) { - SaveBounceCheeseThinker(th, tc_bouncecheese); + SaveBounceCheeseThinker(save_p, th, tc_bouncecheese); continue; } else if (th->function.acp1 == (actionf_p1)T_StartCrumble) { - SaveCrumbleThinker(th, tc_startcrumble); + SaveCrumbleThinker(save_p, th, tc_startcrumble); continue; } else if (th->function.acp1 == (actionf_p1)T_MarioBlock) { - SaveMarioBlockThinker(th, tc_marioblock); + SaveMarioBlockThinker(save_p, th, tc_marioblock); continue; } else if (th->function.acp1 == (actionf_p1)T_MarioBlockChecker) { - SaveMarioCheckThinker(th, tc_marioblockchecker); + SaveMarioCheckThinker(save_p, th, tc_marioblockchecker); continue; } else if (th->function.acp1 == (actionf_p1)T_FloatSector) { - SaveFloatThinker(th, tc_floatsector); + SaveFloatThinker(save_p, th, tc_floatsector); continue; } else if (th->function.acp1 == (actionf_p1)T_LaserFlash) { - SaveLaserThinker(th, tc_laserflash); + SaveLaserThinker(save_p, th, tc_laserflash); continue; } else if (th->function.acp1 == (actionf_p1)T_LightFade) { - SaveLightlevelThinker(th, tc_lightfade); + SaveLightlevelThinker(save_p, th, tc_lightfade); continue; } else if (th->function.acp1 == (actionf_p1)T_ExecutorDelay) { - SaveExecutorThinker(th, tc_executor); + SaveExecutorThinker(save_p, th, tc_executor); continue; } else if (th->function.acp1 == (actionf_p1)T_Disappear) { - SaveDisappearThinker(th, tc_disappear); + SaveDisappearThinker(save_p, th, tc_disappear); continue; } else if (th->function.acp1 == (actionf_p1)T_Fade) { - SaveFadeThinker(th, tc_fade); + SaveFadeThinker(save_p, th, tc_fade); continue; } else if (th->function.acp1 == (actionf_p1)T_FadeColormap) { - SaveFadeColormapThinker(th, tc_fadecolormap); + SaveFadeColormapThinker(save_p, th, tc_fadecolormap); continue; } else if (th->function.acp1 == (actionf_p1)T_PlaneDisplace) { - SavePlaneDisplaceThinker(th, tc_planedisplace); + SavePlaneDisplaceThinker(save_p, th, tc_planedisplace); continue; } else if (th->function.acp1 == (actionf_p1)T_PolyObjRotate) { - SavePolyrotatetThinker(th, tc_polyrotate); + SavePolyrotatetThinker(save_p, th, tc_polyrotate); continue; } else if (th->function.acp1 == (actionf_p1)T_PolyObjMove) { - SavePolymoveThinker(th, tc_polymove); + SavePolymoveThinker(save_p, th, tc_polymove); continue; } else if (th->function.acp1 == (actionf_p1)T_PolyObjWaypoint) { - SavePolywaypointThinker(th, tc_polywaypoint); + SavePolywaypointThinker(save_p, th, tc_polywaypoint); continue; } else if (th->function.acp1 == (actionf_p1)T_PolyDoorSlide) { - SavePolyslidedoorThinker(th, tc_polyslidedoor); + SavePolyslidedoorThinker(save_p, th, tc_polyslidedoor); continue; } else if (th->function.acp1 == (actionf_p1)T_PolyDoorSwing) { - SavePolyswingdoorThinker(th, tc_polyswingdoor); + SavePolyswingdoorThinker(save_p, th, tc_polyswingdoor); continue; } else if (th->function.acp1 == (actionf_p1)T_PolyObjFlag) { - SavePolymoveThinker(th, tc_polyflag); + SavePolymoveThinker(save_p, th, tc_polyflag); continue; } else if (th->function.acp1 == (actionf_p1)T_PolyObjDisplace) { - SavePolydisplaceThinker(th, tc_polydisplace); + SavePolydisplaceThinker(save_p, th, tc_polydisplace); continue; } else if (th->function.acp1 == (actionf_p1)T_PolyObjRotDisplace) { - SavePolyrotdisplaceThinker(th, tc_polyrotdisplace); + SavePolyrotdisplaceThinker(save_p, th, tc_polyrotdisplace); continue; } else if (th->function.acp1 == (actionf_p1)T_PolyObjFade) { - SavePolyfadeThinker(th, tc_polyfade); + SavePolyfadeThinker(save_p, th, tc_polyfade); continue; } else if (th->function.acp1 == (actionf_p1)T_DynamicSlopeLine) { - SaveDynamicLineSlopeThinker(th, tc_dynslopeline); + SaveDynamicLineSlopeThinker(save_p, th, tc_dynslopeline); continue; } else if (th->function.acp1 == (actionf_p1)T_DynamicSlopeVert) { - SaveDynamicVertexSlopeThinker(th, tc_dynslopevert); + SaveDynamicVertexSlopeThinker(save_p, th, tc_dynslopevert); continue; } #ifdef PARANOIA @@ -2952,7 +3191,7 @@ static void P_NetArchiveThinkers(void) CONS_Debug(DBG_NETPLAY, "%u thinkers saved in list %d\n", numsaved, i); - WRITEUINT8(save_p, tc_end); + P_WriteUINT8(save_p, tc_end); } } @@ -3016,7 +3255,7 @@ static inline pslope_t *LoadSlope(UINT32 slopeid) return NULL; } -static thinker_t* LoadMobjThinker(actionf_p1 thinker) +static thinker_t* LoadMobjThinker(save_t *save_p, actionf_p1 thinker) { thinker_t *next; mobj_t *mobj; @@ -3026,35 +3265,35 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) fixed_t z, floorz, ceilingz; ffloor_t *floorrover = NULL, *ceilingrover = NULL; - diff = READUINT32(save_p); + diff = P_ReadUINT32(save_p); if (diff & MD_MORE) - diff2 = READUINT32(save_p); + diff2 = P_ReadUINT32(save_p); else diff2 = 0; - next = (void *)(size_t)READUINT32(save_p); + next = (void *)(size_t)P_ReadUINT32(save_p); - z = READFIXED(save_p); // Force this so 3dfloor problems don't arise. - floorz = READFIXED(save_p); - ceilingz = READFIXED(save_p); + z = P_ReadFixed(save_p); // Force this so 3dfloor problems don't arise. + floorz = P_ReadFixed(save_p); + ceilingz = P_ReadFixed(save_p); if (diff2 & MD2_FLOORROVER) { - sector_t *sec = LoadSector(READUINT32(save_p)); - UINT16 id = READUINT16(save_p); + sector_t *sec = LoadSector(P_ReadUINT32(save_p)); + UINT16 id = P_ReadUINT16(save_p); floorrover = P_GetFFloorByID(sec, id); } if (diff2 & MD2_CEILINGROVER) { - sector_t *sec = LoadSector(READUINT32(save_p)); - UINT16 id = READUINT16(save_p); + sector_t *sec = LoadSector(P_ReadUINT32(save_p)); + UINT16 id = P_ReadUINT16(save_p); ceilingrover = P_GetFFloorByID(sec, id); } if (diff & MD_SPAWNPOINT) { - UINT16 spawnpointnum = READUINT16(save_p); + UINT16 spawnpointnum = P_ReadUINT16(save_p); if (mapthings[spawnpointnum].type == 1713) // NiGHTS Hoop special case { @@ -3080,7 +3319,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->ceilingrover = ceilingrover; if (diff & MD_TYPE) - mobj->type = READUINT32(save_p); + mobj->type = P_ReadUINT32(save_p); else { for (i = 0; i < NUMMOBJTYPES; i++) @@ -3099,11 +3338,11 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->info = &mobjinfo[mobj->type]; if (diff & MD_POS) { - mobj->x = READFIXED(save_p); - mobj->y = READFIXED(save_p); - mobj->angle = READANGLE(save_p); - mobj->pitch = READANGLE(save_p); - mobj->roll = READANGLE(save_p); + mobj->x = P_ReadFixed(save_p); + mobj->y = P_ReadFixed(save_p); + mobj->angle = P_ReadAngle(save_p); + mobj->pitch = P_ReadAngle(save_p); + mobj->roll = P_ReadAngle(save_p); } else { @@ -3115,47 +3354,47 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) } if (diff & MD_MOM) { - mobj->momx = READFIXED(save_p); - mobj->momy = READFIXED(save_p); - mobj->momz = READFIXED(save_p); - mobj->pmomz = READFIXED(save_p); + mobj->momx = P_ReadFixed(save_p); + mobj->momy = P_ReadFixed(save_p); + mobj->momz = P_ReadFixed(save_p); + mobj->pmomz = P_ReadFixed(save_p); } // otherwise they're zero, and the memset took care of it if (diff & MD_RADIUS) - mobj->radius = READFIXED(save_p); + mobj->radius = P_ReadFixed(save_p); else mobj->radius = mobj->info->radius; if (diff & MD_HEIGHT) - mobj->height = READFIXED(save_p); + mobj->height = P_ReadFixed(save_p); else mobj->height = mobj->info->height; if (diff & MD_FLAGS) - mobj->flags = READUINT32(save_p); + mobj->flags = P_ReadUINT32(save_p); else mobj->flags = mobj->info->flags; if (diff & MD_FLAGS2) - mobj->flags2 = READUINT32(save_p); + mobj->flags2 = P_ReadUINT32(save_p); if (diff & MD_HEALTH) - mobj->health = READINT32(save_p); + mobj->health = P_ReadINT32(save_p); else mobj->health = mobj->info->spawnhealth; if (diff & MD_RTIME) - mobj->reactiontime = READINT32(save_p); + mobj->reactiontime = P_ReadINT32(save_p); else mobj->reactiontime = mobj->info->reactiontime; if (diff & MD_STATE) - mobj->state = &states[READUINT16(save_p)]; + mobj->state = &states[P_ReadUINT16(save_p)]; else mobj->state = &states[mobj->info->spawnstate]; if (diff & MD_TICS) - mobj->tics = READINT32(save_p); + mobj->tics = P_ReadINT32(save_p); else mobj->tics = mobj->state->tics; if (diff & MD_SPRITE) { - mobj->sprite = READUINT16(save_p); + mobj->sprite = P_ReadUINT16(save_p); if (mobj->sprite == SPR_PLAY) - mobj->sprite2 = READUINT16(save_p); + mobj->sprite2 = P_ReadUINT16(save_p); } else { mobj->sprite = mobj->state->sprite; @@ -3164,8 +3403,8 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) } if (diff & MD_FRAME) { - mobj->frame = READUINT32(save_p); - mobj->anim_duration = READUINT16(save_p); + mobj->frame = P_ReadUINT32(save_p); + mobj->anim_duration = P_ReadUINT16(save_p); } else { @@ -3173,130 +3412,130 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) mobj->anim_duration = (UINT16)mobj->state->var2; } if (diff & MD_EFLAGS) - mobj->eflags = READUINT16(save_p); + mobj->eflags = P_ReadUINT16(save_p); if (diff & MD_PLAYER) { - i = READUINT8(save_p); + i = P_ReadUINT8(save_p); mobj->player = &players[i]; mobj->player->mo = mobj; } if (diff & MD_MOVEDIR) - mobj->movedir = READANGLE(save_p); + mobj->movedir = P_ReadAngle(save_p); if (diff & MD_MOVECOUNT) - mobj->movecount = READINT32(save_p); + mobj->movecount = P_ReadINT32(save_p); if (diff & MD_THRESHOLD) - mobj->threshold = READINT32(save_p); + mobj->threshold = P_ReadINT32(save_p); if (diff & MD_LASTLOOK) - mobj->lastlook = READINT32(save_p); + mobj->lastlook = P_ReadINT32(save_p); else mobj->lastlook = -1; if (diff & MD_TARGET) - mobj->target = (mobj_t *)(size_t)READUINT32(save_p); + mobj->target = (mobj_t *)(size_t)P_ReadUINT32(save_p); if (diff & MD_TRACER) - mobj->tracer = (mobj_t *)(size_t)READUINT32(save_p); + mobj->tracer = (mobj_t *)(size_t)P_ReadUINT32(save_p); if (diff & MD_FRICTION) - mobj->friction = READFIXED(save_p); + mobj->friction = P_ReadFixed(save_p); else mobj->friction = ORIG_FRICTION; if (diff & MD_MOVEFACTOR) - mobj->movefactor = READFIXED(save_p); + mobj->movefactor = P_ReadFixed(save_p); else mobj->movefactor = FRACUNIT; if (diff & MD_FUSE) - mobj->fuse = READINT32(save_p); + mobj->fuse = P_ReadINT32(save_p); if (diff & MD_WATERTOP) - mobj->watertop = READFIXED(save_p); + mobj->watertop = P_ReadFixed(save_p); if (diff & MD_WATERBOTTOM) - mobj->waterbottom = READFIXED(save_p); + mobj->waterbottom = P_ReadFixed(save_p); if (diff & MD_SCALE) - mobj->scale = READFIXED(save_p); + mobj->scale = P_ReadFixed(save_p); else mobj->scale = FRACUNIT; if (diff & MD_DSCALE) - mobj->destscale = READFIXED(save_p); + mobj->destscale = P_ReadFixed(save_p); else mobj->destscale = mobj->scale; if (diff2 & MD2_SCALESPEED) - mobj->scalespeed = READFIXED(save_p); + mobj->scalespeed = P_ReadFixed(save_p); else mobj->scalespeed = FRACUNIT/12; if (diff2 & MD2_CUSVAL) - mobj->cusval = READINT32(save_p); + mobj->cusval = P_ReadINT32(save_p); if (diff2 & MD2_CVMEM) - mobj->cvmem = READINT32(save_p); + mobj->cvmem = P_ReadINT32(save_p); if (diff2 & MD2_SKIN) - mobj->skin = skins[READUINT8(save_p)]; + mobj->skin = skins[P_ReadUINT8(save_p)]; if (diff2 & MD2_COLOR) - mobj->color = READUINT16(save_p); + mobj->color = P_ReadUINT16(save_p); if (diff2 & MD2_EXTVAL1) - mobj->extravalue1 = READINT32(save_p); + mobj->extravalue1 = P_ReadINT32(save_p); if (diff2 & MD2_EXTVAL2) - mobj->extravalue2 = READINT32(save_p); + mobj->extravalue2 = P_ReadINT32(save_p); if (diff2 & MD2_HNEXT) - mobj->hnext = (mobj_t *)(size_t)READUINT32(save_p); + mobj->hnext = (mobj_t *)(size_t)P_ReadUINT32(save_p); if (diff2 & MD2_HPREV) - mobj->hprev = (mobj_t *)(size_t)READUINT32(save_p); + mobj->hprev = (mobj_t *)(size_t)P_ReadUINT32(save_p); if (diff2 & MD2_SLOPE) - mobj->standingslope = P_SlopeById(READUINT16(save_p)); + mobj->standingslope = P_SlopeById(P_ReadUINT16(save_p)); if (diff2 & MD2_COLORIZED) - mobj->colorized = READUINT8(save_p); + mobj->colorized = P_ReadUINT8(save_p); if (diff2 & MD2_MIRRORED) - mobj->mirrored = READUINT8(save_p); + mobj->mirrored = P_ReadUINT8(save_p); if (diff2 & MD2_SPRITEROLL) - mobj->spriteroll = READANGLE(save_p); + mobj->spriteroll = P_ReadAngle(save_p); if (diff2 & MD2_SHADOWSCALE) - mobj->shadowscale = READFIXED(save_p); + mobj->shadowscale = P_ReadFixed(save_p); if (diff2 & MD2_RENDERFLAGS) - mobj->renderflags = READUINT32(save_p); + mobj->renderflags = P_ReadUINT32(save_p); if (diff2 & MD2_BLENDMODE) - mobj->blendmode = READINT32(save_p); + mobj->blendmode = P_ReadINT32(save_p); else mobj->blendmode = AST_TRANSLUCENT; if (diff2 & MD2_SPRITEXSCALE) - mobj->spritexscale = READFIXED(save_p); + mobj->spritexscale = P_ReadFixed(save_p); else mobj->spritexscale = FRACUNIT; if (diff2 & MD2_SPRITEYSCALE) - mobj->spriteyscale = READFIXED(save_p); + mobj->spriteyscale = P_ReadFixed(save_p); else mobj->spriteyscale = FRACUNIT; if (diff2 & MD2_SPRITEXOFFSET) - mobj->spritexoffset = READFIXED(save_p); + mobj->spritexoffset = P_ReadFixed(save_p); if (diff2 & MD2_SPRITEYOFFSET) - mobj->spriteyoffset = READFIXED(save_p); + mobj->spriteyoffset = P_ReadFixed(save_p); if (diff2 & MD2_FLOORSPRITESLOPE) { pslope_t *slope = (pslope_t *)P_CreateFloorSpriteSlope(mobj); - slope->zdelta = READFIXED(save_p); - slope->zangle = READANGLE(save_p); - slope->xydirection = READANGLE(save_p); + slope->zdelta = P_ReadFixed(save_p); + slope->zangle = P_ReadAngle(save_p); + slope->xydirection = P_ReadAngle(save_p); - slope->o.x = READFIXED(save_p); - slope->o.y = READFIXED(save_p); - slope->o.z = READFIXED(save_p); + slope->o.x = P_ReadFixed(save_p); + slope->o.y = P_ReadFixed(save_p); + slope->o.z = P_ReadFixed(save_p); - slope->d.x = READFIXED(save_p); - slope->d.y = READFIXED(save_p); + slope->d.x = P_ReadFixed(save_p); + slope->d.y = P_ReadFixed(save_p); - slope->normal.x = READFIXED(save_p); - slope->normal.y = READFIXED(save_p); - slope->normal.z = READFIXED(save_p); + slope->normal.x = P_ReadFixed(save_p); + slope->normal.y = P_ReadFixed(save_p); + slope->normal.z = P_ReadFixed(save_p); slope->moved = true; } if (diff2 & MD2_DRAWONLYFORPLAYER) - mobj->drawonlyforplayer = &players[READUINT8(save_p)]; + mobj->drawonlyforplayer = &players[P_ReadUINT8(save_p)]; if (diff2 & MD2_DONTDRAWFORVIEWMOBJ) - mobj->dontdrawforviewmobj = (mobj_t *)(size_t)READUINT32(save_p); + mobj->dontdrawforviewmobj = (mobj_t *)(size_t)P_ReadUINT32(save_p); if (diff2 & MD2_DISPOFFSET) - mobj->dispoffset = READINT32(save_p); + mobj->dispoffset = P_ReadINT32(save_p); else mobj->dispoffset = mobj->info->dispoffset; if (diff2 & MD2_TRANSLATION) - mobj->translation = READUINT16(save_p); + mobj->translation = P_ReadUINT16(save_p); if (diff2 & MD2_ALPHA) - mobj->alpha = READFIXED(save_p); + mobj->alpha = P_ReadFixed(save_p); else mobj->alpha = FRACUNIT; @@ -3314,7 +3553,7 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) // set sprev, snext, bprev, bnext, subsector P_SetThingPosition(mobj); - mobj->mobjnum = READUINT32(save_p); + mobj->mobjnum = P_ReadUINT32(save_p); if (mobj->player) { @@ -3343,25 +3582,25 @@ static thinker_t* LoadMobjThinker(actionf_p1 thinker) return &mobj->thinker; } -static thinker_t* LoadNoEnemiesThinker(actionf_p1 thinker) +static thinker_t* LoadNoEnemiesThinker(save_t *save_p, actionf_p1 thinker) { noenemies_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sourceline = LoadLine(READUINT32(save_p)); + ht->sourceline = LoadLine(P_ReadUINT32(save_p)); return &ht->thinker; } -static thinker_t* LoadBounceCheeseThinker(actionf_p1 thinker) +static thinker_t* LoadBounceCheeseThinker(save_t *save_p, actionf_p1 thinker) { bouncecheese_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sourceline = LoadLine(READUINT32(save_p)); - ht->sector = LoadSector(READUINT32(save_p)); - ht->speed = READFIXED(save_p); - ht->distance = READFIXED(save_p); - ht->floorwasheight = READFIXED(save_p); - ht->ceilingwasheight = READFIXED(save_p); - ht->low = READCHAR(save_p); + ht->sourceline = LoadLine(P_ReadUINT32(save_p)); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->speed = P_ReadFixed(save_p); + ht->distance = P_ReadFixed(save_p); + ht->floorwasheight = P_ReadFixed(save_p); + ht->ceilingwasheight = P_ReadFixed(save_p); + ht->low = P_ReadChar(save_p); if (ht->sector) ht->sector->ceilingdata = ht; @@ -3369,16 +3608,16 @@ static thinker_t* LoadBounceCheeseThinker(actionf_p1 thinker) return &ht->thinker; } -static thinker_t* LoadContinuousFallThinker(actionf_p1 thinker) +static thinker_t* LoadContinuousFallThinker(save_t *save_p, actionf_p1 thinker) { continuousfall_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sector = LoadSector(READUINT32(save_p)); - ht->speed = READFIXED(save_p); - ht->direction = READINT32(save_p); - ht->floorstartheight = READFIXED(save_p); - ht->ceilingstartheight = READFIXED(save_p); - ht->destheight = READFIXED(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->speed = P_ReadFixed(save_p); + ht->direction = P_ReadINT32(save_p); + ht->floorstartheight = P_ReadFixed(save_p); + ht->ceilingstartheight = P_ReadFixed(save_p); + ht->destheight = P_ReadFixed(save_p); if (ht->sector) { @@ -3389,16 +3628,16 @@ static thinker_t* LoadContinuousFallThinker(actionf_p1 thinker) return &ht->thinker; } -static thinker_t* LoadMarioBlockThinker(actionf_p1 thinker) +static thinker_t* LoadMarioBlockThinker(save_t *save_p, actionf_p1 thinker) { mariothink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sector = LoadSector(READUINT32(save_p)); - ht->speed = READFIXED(save_p); - ht->direction = READINT32(save_p); - ht->floorstartheight = READFIXED(save_p); - ht->ceilingstartheight = READFIXED(save_p); - ht->tag = READINT16(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->speed = P_ReadFixed(save_p); + ht->direction = P_ReadINT32(save_p); + ht->floorstartheight = P_ReadFixed(save_p); + ht->ceilingstartheight = P_ReadFixed(save_p); + ht->tag = P_ReadINT16(save_p); if (ht->sector) { @@ -3409,29 +3648,29 @@ static thinker_t* LoadMarioBlockThinker(actionf_p1 thinker) return &ht->thinker; } -static thinker_t* LoadMarioCheckThinker(actionf_p1 thinker) +static thinker_t* LoadMarioCheckThinker(save_t *save_p, actionf_p1 thinker) { mariocheck_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sourceline = LoadLine(READUINT32(save_p)); - ht->sector = LoadSector(READUINT32(save_p)); + ht->sourceline = LoadLine(P_ReadUINT32(save_p)); + ht->sector = LoadSector(P_ReadUINT32(save_p)); return &ht->thinker; } -static thinker_t* LoadThwompThinker(actionf_p1 thinker) +static thinker_t* LoadThwompThinker(save_t *save_p, actionf_p1 thinker) { thwomp_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sourceline = LoadLine(READUINT32(save_p)); - ht->sector = LoadSector(READUINT32(save_p)); - ht->crushspeed = READFIXED(save_p); - ht->retractspeed = READFIXED(save_p); - ht->direction = READINT32(save_p); - ht->floorstartheight = READFIXED(save_p); - ht->ceilingstartheight = READFIXED(save_p); - ht->delay = READINT32(save_p); - ht->tag = READINT16(save_p); - ht->sound = READUINT16(save_p); + ht->sourceline = LoadLine(P_ReadUINT32(save_p)); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->crushspeed = P_ReadFixed(save_p); + ht->retractspeed = P_ReadFixed(save_p); + ht->direction = P_ReadINT32(save_p); + ht->floorstartheight = P_ReadFixed(save_p); + ht->ceilingstartheight = P_ReadFixed(save_p); + ht->delay = P_ReadINT32(save_p); + ht->tag = P_ReadINT16(save_p); + ht->sound = P_ReadUINT16(save_p); if (ht->sector) { @@ -3442,163 +3681,163 @@ static thinker_t* LoadThwompThinker(actionf_p1 thinker) return &ht->thinker; } -static thinker_t* LoadFloatThinker(actionf_p1 thinker) +static thinker_t* LoadFloatThinker(save_t *save_p, actionf_p1 thinker) { floatthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sourceline = LoadLine(READUINT32(save_p)); - ht->sector = LoadSector(READUINT32(save_p)); - ht->tag = READINT16(save_p); + ht->sourceline = LoadLine(P_ReadUINT32(save_p)); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->tag = P_ReadINT16(save_p); return &ht->thinker; } -static thinker_t* LoadEachTimeThinker(actionf_p1 thinker) +static thinker_t* LoadEachTimeThinker(save_t *save_p, actionf_p1 thinker) { size_t i; eachtime_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sourceline = LoadLine(READUINT32(save_p)); + ht->sourceline = LoadLine(P_ReadUINT32(save_p)); for (i = 0; i < MAXPLAYERS; i++) { - ht->playersInArea[i] = READCHAR(save_p); + ht->playersInArea[i] = P_ReadChar(save_p); } - ht->triggerOnExit = READCHAR(save_p); + ht->triggerOnExit = P_ReadChar(save_p); return &ht->thinker; } -static thinker_t* LoadRaiseThinker(actionf_p1 thinker) +static thinker_t* LoadRaiseThinker(save_t *save_p, actionf_p1 thinker) { raise_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->tag = READINT16(save_p); - ht->sector = LoadSector(READUINT32(save_p)); - ht->ceilingbottom = READFIXED(save_p); - ht->ceilingtop = READFIXED(save_p); - ht->basespeed = READFIXED(save_p); - ht->extraspeed = READFIXED(save_p); - ht->shaketimer = READUINT8(save_p); - ht->flags = READUINT8(save_p); + ht->tag = P_ReadINT16(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->ceilingbottom = P_ReadFixed(save_p); + ht->ceilingtop = P_ReadFixed(save_p); + ht->basespeed = P_ReadFixed(save_p); + ht->extraspeed = P_ReadFixed(save_p); + ht->shaketimer = P_ReadUINT8(save_p); + ht->flags = P_ReadUINT8(save_p); return &ht->thinker; } -static thinker_t* LoadCeilingThinker(actionf_p1 thinker) +static thinker_t* LoadCeilingThinker(save_t *save_p, actionf_p1 thinker) { ceiling_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->type = READUINT8(save_p); - ht->sector = LoadSector(READUINT32(save_p)); - ht->bottomheight = READFIXED(save_p); - ht->topheight = READFIXED(save_p); - ht->speed = READFIXED(save_p); - ht->delay = READFIXED(save_p); - ht->delaytimer = READFIXED(save_p); - ht->crush = READUINT8(save_p); - ht->texture = READINT32(save_p); - ht->direction = READINT32(save_p); - ht->tag = READINT16(save_p); - ht->origspeed = READFIXED(save_p); - ht->sourceline = READFIXED(save_p); + ht->type = P_ReadUINT8(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->bottomheight = P_ReadFixed(save_p); + ht->topheight = P_ReadFixed(save_p); + ht->speed = P_ReadFixed(save_p); + ht->delay = P_ReadFixed(save_p); + ht->delaytimer = P_ReadFixed(save_p); + ht->crush = P_ReadUINT8(save_p); + ht->texture = P_ReadINT32(save_p); + ht->direction = P_ReadINT32(save_p); + ht->tag = P_ReadINT16(save_p); + ht->origspeed = P_ReadFixed(save_p); + ht->sourceline = P_ReadFixed(save_p); if (ht->sector) ht->sector->ceilingdata = ht; return &ht->thinker; } -static thinker_t* LoadFloormoveThinker(actionf_p1 thinker) +static thinker_t* LoadFloormoveThinker(save_t *save_p, actionf_p1 thinker) { floormove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->type = READUINT8(save_p); - ht->crush = READUINT8(save_p); - ht->sector = LoadSector(READUINT32(save_p)); - ht->direction = READINT32(save_p); - ht->texture = READINT32(save_p); - ht->floordestheight = READFIXED(save_p); - ht->speed = READFIXED(save_p); - ht->origspeed = READFIXED(save_p); - ht->delay = READFIXED(save_p); - ht->delaytimer = READFIXED(save_p); - ht->tag = READINT16(save_p); - ht->sourceline = READFIXED(save_p); + ht->type = P_ReadUINT8(save_p); + ht->crush = P_ReadUINT8(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->direction = P_ReadINT32(save_p); + ht->texture = P_ReadINT32(save_p); + ht->floordestheight = P_ReadFixed(save_p); + ht->speed = P_ReadFixed(save_p); + ht->origspeed = P_ReadFixed(save_p); + ht->delay = P_ReadFixed(save_p); + ht->delaytimer = P_ReadFixed(save_p); + ht->tag = P_ReadINT16(save_p); + ht->sourceline = P_ReadFixed(save_p); if (ht->sector) ht->sector->floordata = ht; return &ht->thinker; } -static thinker_t* LoadLightflashThinker(actionf_p1 thinker) +static thinker_t* LoadLightflashThinker(save_t *save_p, actionf_p1 thinker) { lightflash_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sector = LoadSector(READUINT32(save_p)); - ht->maxlight = READINT32(save_p); - ht->minlight = READINT32(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->maxlight = P_ReadINT32(save_p); + ht->minlight = P_ReadINT32(save_p); if (ht->sector) ht->sector->lightingdata = ht; return &ht->thinker; } -static thinker_t* LoadStrobeThinker(actionf_p1 thinker) +static thinker_t* LoadStrobeThinker(save_t *save_p, actionf_p1 thinker) { strobe_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sector = LoadSector(READUINT32(save_p)); - ht->count = READINT32(save_p); - ht->minlight = READINT16(save_p); - ht->maxlight = READINT16(save_p); - ht->darktime = READINT32(save_p); - ht->brighttime = READINT32(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->count = P_ReadINT32(save_p); + ht->minlight = P_ReadINT16(save_p); + ht->maxlight = P_ReadINT16(save_p); + ht->darktime = P_ReadINT32(save_p); + ht->brighttime = P_ReadINT32(save_p); if (ht->sector) ht->sector->lightingdata = ht; return &ht->thinker; } -static thinker_t* LoadGlowThinker(actionf_p1 thinker) +static thinker_t* LoadGlowThinker(save_t *save_p, actionf_p1 thinker) { glow_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sector = LoadSector(READUINT32(save_p)); - ht->minlight = READINT16(save_p); - ht->maxlight = READINT16(save_p); - ht->direction = READINT16(save_p); - ht->speed = READINT16(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->minlight = P_ReadINT16(save_p); + ht->maxlight = P_ReadINT16(save_p); + ht->direction = P_ReadINT16(save_p); + ht->speed = P_ReadINT16(save_p); if (ht->sector) ht->sector->lightingdata = ht; return &ht->thinker; } -static thinker_t* LoadFireflickerThinker(actionf_p1 thinker) +static thinker_t* LoadFireflickerThinker(save_t *save_p, actionf_p1 thinker) { fireflicker_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sector = LoadSector(READUINT32(save_p)); - ht->count = READINT32(save_p); - ht->resetcount = READINT32(save_p); - ht->maxlight = READINT16(save_p); - ht->minlight = READINT16(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->count = P_ReadINT32(save_p); + ht->resetcount = P_ReadINT32(save_p); + ht->maxlight = P_ReadINT16(save_p); + ht->minlight = P_ReadINT16(save_p); if (ht->sector) ht->sector->lightingdata = ht; return &ht->thinker; } -static thinker_t* LoadElevatorThinker(actionf_p1 thinker, boolean setplanedata) +static thinker_t* LoadElevatorThinker(save_t *save_p, actionf_p1 thinker, boolean setplanedata) { elevator_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->type = READUINT8(save_p); - ht->sector = LoadSector(READUINT32(save_p)); - ht->actionsector = LoadSector(READUINT32(save_p)); - ht->direction = READINT32(save_p); - ht->floordestheight = READFIXED(save_p); - ht->ceilingdestheight = READFIXED(save_p); - ht->speed = READFIXED(save_p); - ht->origspeed = READFIXED(save_p); - ht->low = READFIXED(save_p); - ht->high = READFIXED(save_p); - ht->distance = READFIXED(save_p); - ht->delay = READFIXED(save_p); - ht->delaytimer = READFIXED(save_p); - ht->floorwasheight = READFIXED(save_p); - ht->ceilingwasheight = READFIXED(save_p); - ht->sourceline = LoadLine(READUINT32(save_p)); + ht->type = P_ReadUINT8(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->actionsector = LoadSector(P_ReadUINT32(save_p)); + ht->direction = P_ReadINT32(save_p); + ht->floordestheight = P_ReadFixed(save_p); + ht->ceilingdestheight = P_ReadFixed(save_p); + ht->speed = P_ReadFixed(save_p); + ht->origspeed = P_ReadFixed(save_p); + ht->low = P_ReadFixed(save_p); + ht->high = P_ReadFixed(save_p); + ht->distance = P_ReadFixed(save_p); + ht->delay = P_ReadFixed(save_p); + ht->delaytimer = P_ReadFixed(save_p); + ht->floorwasheight = P_ReadFixed(save_p); + ht->ceilingwasheight = P_ReadFixed(save_p); + ht->sourceline = LoadLine(P_ReadUINT32(save_p)); if (ht->sector && setplanedata) { @@ -3609,21 +3848,21 @@ static thinker_t* LoadElevatorThinker(actionf_p1 thinker, boolean setplanedata) return &ht->thinker; } -static thinker_t* LoadCrumbleThinker(actionf_p1 thinker) +static thinker_t* LoadCrumbleThinker(save_t *save_p, actionf_p1 thinker) { crumble_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sourceline = LoadLine(READUINT32(save_p)); - ht->sector = LoadSector(READUINT32(save_p)); - ht->actionsector = LoadSector(READUINT32(save_p)); - ht->player = LoadPlayer(READUINT32(save_p)); - ht->direction = READINT32(save_p); - ht->origalpha = READINT32(save_p); - ht->timer = READINT32(save_p); - ht->speed = READFIXED(save_p); - ht->floorwasheight = READFIXED(save_p); - ht->ceilingwasheight = READFIXED(save_p); - ht->flags = READUINT8(save_p); + ht->sourceline = LoadLine(P_ReadUINT32(save_p)); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->actionsector = LoadSector(P_ReadUINT32(save_p)); + ht->player = LoadPlayer(P_ReadUINT32(save_p)); + ht->direction = P_ReadINT32(save_p); + ht->origalpha = P_ReadINT32(save_p); + ht->timer = P_ReadINT32(save_p); + ht->speed = P_ReadFixed(save_p); + ht->floorwasheight = P_ReadFixed(save_p); + ht->ceilingwasheight = P_ReadFixed(save_p); + ht->flags = P_ReadUINT8(save_p); if (ht->sector) ht->sector->floordata = ht; @@ -3631,123 +3870,123 @@ static thinker_t* LoadCrumbleThinker(actionf_p1 thinker) return &ht->thinker; } -static thinker_t* LoadScrollThinker(actionf_p1 thinker) +static thinker_t* LoadScrollThinker(save_t *save_p, actionf_p1 thinker) { scroll_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->dx = READFIXED(save_p); - ht->dy = READFIXED(save_p); - ht->affectee = READINT32(save_p); - ht->control = READINT32(save_p); - ht->last_height = READFIXED(save_p); - ht->vdx = READFIXED(save_p); - ht->vdy = READFIXED(save_p); - ht->accel = READINT32(save_p); - ht->exclusive = READINT32(save_p); - ht->type = READUINT8(save_p); + ht->dx = P_ReadFixed(save_p); + ht->dy = P_ReadFixed(save_p); + ht->affectee = P_ReadINT32(save_p); + ht->control = P_ReadINT32(save_p); + ht->last_height = P_ReadFixed(save_p); + ht->vdx = P_ReadFixed(save_p); + ht->vdy = P_ReadFixed(save_p); + ht->accel = P_ReadINT32(save_p); + ht->exclusive = P_ReadINT32(save_p); + ht->type = P_ReadUINT8(save_p); return &ht->thinker; } -static inline thinker_t* LoadFrictionThinker(actionf_p1 thinker) +static inline thinker_t* LoadFrictionThinker(save_t *save_p, actionf_p1 thinker) { friction_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->friction = READINT32(save_p); - ht->movefactor = READINT32(save_p); - ht->affectee = READINT32(save_p); - ht->referrer = READINT32(save_p); - ht->roverfriction = READUINT8(save_p); + ht->friction = P_ReadINT32(save_p); + ht->movefactor = P_ReadINT32(save_p); + ht->affectee = P_ReadINT32(save_p); + ht->referrer = P_ReadINT32(save_p); + ht->roverfriction = P_ReadUINT8(save_p); return &ht->thinker; } -static thinker_t* LoadPusherThinker(actionf_p1 thinker) +static thinker_t* LoadPusherThinker(save_t *save_p, actionf_p1 thinker) { pusher_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->type = READUINT8(save_p); - ht->x_mag = READFIXED(save_p); - ht->y_mag = READFIXED(save_p); - ht->z_mag = READFIXED(save_p); - ht->affectee = READINT32(save_p); - ht->roverpusher = READUINT8(save_p); - ht->referrer = READINT32(save_p); - ht->exclusive = READINT32(save_p); - ht->slider = READINT32(save_p); + ht->type = P_ReadUINT8(save_p); + ht->x_mag = P_ReadFixed(save_p); + ht->y_mag = P_ReadFixed(save_p); + ht->z_mag = P_ReadFixed(save_p); + ht->affectee = P_ReadINT32(save_p); + ht->roverpusher = P_ReadUINT8(save_p); + ht->referrer = P_ReadINT32(save_p); + ht->exclusive = P_ReadINT32(save_p); + ht->slider = P_ReadINT32(save_p); return &ht->thinker; } -static inline thinker_t* LoadLaserThinker(actionf_p1 thinker) +static inline thinker_t* LoadLaserThinker(save_t *save_p, actionf_p1 thinker) { laserthink_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->tag = READINT16(save_p); - ht->sourceline = LoadLine(READUINT32(save_p)); - ht->nobosses = READUINT8(save_p); + ht->tag = P_ReadINT16(save_p); + ht->sourceline = LoadLine(P_ReadUINT32(save_p)); + ht->nobosses = P_ReadUINT8(save_p); return &ht->thinker; } -static inline thinker_t* LoadLightlevelThinker(actionf_p1 thinker) +static inline thinker_t* LoadLightlevelThinker(save_t *save_p, actionf_p1 thinker) { lightlevel_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sector = LoadSector(READUINT32(save_p)); - ht->sourcelevel = READINT16(save_p); - ht->destlevel = READINT16(save_p); - ht->fixedcurlevel = READFIXED(save_p); - ht->fixedpertic = READFIXED(save_p); - ht->timer = READINT32(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->sourcelevel = P_ReadINT16(save_p); + ht->destlevel = P_ReadINT16(save_p); + ht->fixedcurlevel = P_ReadFixed(save_p); + ht->fixedpertic = P_ReadFixed(save_p); + ht->timer = P_ReadINT32(save_p); if (ht->sector) ht->sector->lightingdata = ht; return &ht->thinker; } -static inline thinker_t* LoadExecutorThinker(actionf_p1 thinker) +static inline thinker_t* LoadExecutorThinker(save_t *save_p, actionf_p1 thinker) { executor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->line = LoadLine(READUINT32(save_p)); - ht->caller = LoadMobj(READUINT32(save_p)); - ht->sector = LoadSector(READUINT32(save_p)); - ht->timer = READINT32(save_p); + ht->line = LoadLine(P_ReadUINT32(save_p)); + ht->caller = LoadMobj(P_ReadUINT32(save_p)); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->timer = P_ReadINT32(save_p); return &ht->thinker; } -static inline thinker_t* LoadDisappearThinker(actionf_p1 thinker) +static inline thinker_t* LoadDisappearThinker(save_t *save_p, actionf_p1 thinker) { disappear_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->appeartime = READUINT32(save_p); - ht->disappeartime = READUINT32(save_p); - ht->offset = READUINT32(save_p); - ht->timer = READUINT32(save_p); - ht->affectee = READINT32(save_p); - ht->sourceline = READINT32(save_p); - ht->exists = READINT32(save_p); + ht->appeartime = P_ReadUINT32(save_p); + ht->disappeartime = P_ReadUINT32(save_p); + ht->offset = P_ReadUINT32(save_p); + ht->timer = P_ReadUINT32(save_p); + ht->affectee = P_ReadINT32(save_p); + ht->sourceline = P_ReadINT32(save_p); + ht->exists = P_ReadINT32(save_p); return &ht->thinker; } -static inline thinker_t* LoadFadeThinker(actionf_p1 thinker) +static inline thinker_t* LoadFadeThinker(save_t *save_p, actionf_p1 thinker) { sector_t *ss; fade_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->dest_exc = GetNetColormapFromList(READUINT32(save_p)); - ht->sectornum = READUINT32(save_p); - ht->ffloornum = READUINT32(save_p); - ht->alpha = READINT32(save_p); - ht->sourcevalue = READINT16(save_p); - ht->destvalue = READINT16(save_p); - ht->destlightlevel = READINT16(save_p); - ht->speed = READINT16(save_p); - ht->ticbased = (boolean)READUINT8(save_p); - ht->timer = READINT32(save_p); - ht->doexists = READUINT8(save_p); - ht->dotranslucent = READUINT8(save_p); - ht->dolighting = READUINT8(save_p); - ht->docolormap = READUINT8(save_p); - ht->docollision = READUINT8(save_p); - ht->doghostfade = READUINT8(save_p); - ht->exactalpha = READUINT8(save_p); + ht->dest_exc = GetNetColormapFromList(P_ReadUINT32(save_p)); + ht->sectornum = P_ReadUINT32(save_p); + ht->ffloornum = P_ReadUINT32(save_p); + ht->alpha = P_ReadINT32(save_p); + ht->sourcevalue = P_ReadINT16(save_p); + ht->destvalue = P_ReadINT16(save_p); + ht->destlightlevel = P_ReadINT16(save_p); + ht->speed = P_ReadINT16(save_p); + ht->ticbased = (boolean)P_ReadUINT8(save_p); + ht->timer = P_ReadINT32(save_p); + ht->doexists = P_ReadUINT8(save_p); + ht->dotranslucent = P_ReadUINT8(save_p); + ht->dolighting = P_ReadUINT8(save_p); + ht->docolormap = P_ReadUINT8(save_p); + ht->docollision = P_ReadUINT8(save_p); + ht->doghostfade = P_ReadUINT8(save_p); + ht->exactalpha = P_ReadUINT8(save_p); ss = LoadSector(ht->sectornum); if (ss) @@ -3768,176 +4007,176 @@ static inline thinker_t* LoadFadeThinker(actionf_p1 thinker) return &ht->thinker; } -static inline thinker_t* LoadFadeColormapThinker(actionf_p1 thinker) +static inline thinker_t* LoadFadeColormapThinker(save_t *save_p, actionf_p1 thinker) { fadecolormap_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->sector = LoadSector(READUINT32(save_p)); - ht->source_exc = GetNetColormapFromList(READUINT32(save_p)); - ht->dest_exc = GetNetColormapFromList(READUINT32(save_p)); - ht->ticbased = (boolean)READUINT8(save_p); - ht->duration = READINT32(save_p); - ht->timer = READINT32(save_p); + ht->sector = LoadSector(P_ReadUINT32(save_p)); + ht->source_exc = GetNetColormapFromList(P_ReadUINT32(save_p)); + ht->dest_exc = GetNetColormapFromList(P_ReadUINT32(save_p)); + ht->ticbased = (boolean)P_ReadUINT8(save_p); + ht->duration = P_ReadINT32(save_p); + ht->timer = P_ReadINT32(save_p); if (ht->sector) ht->sector->fadecolormapdata = ht; return &ht->thinker; } -static inline thinker_t* LoadPlaneDisplaceThinker(actionf_p1 thinker) +static inline thinker_t* LoadPlaneDisplaceThinker(save_t *save_p, actionf_p1 thinker) { planedisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->affectee = READINT32(save_p); - ht->control = READINT32(save_p); - ht->last_height = READFIXED(save_p); - ht->speed = READFIXED(save_p); - ht->type = READUINT8(save_p); + ht->affectee = P_ReadINT32(save_p); + ht->control = P_ReadINT32(save_p); + ht->last_height = P_ReadFixed(save_p); + ht->speed = P_ReadFixed(save_p); + ht->type = P_ReadUINT8(save_p); return &ht->thinker; } -static inline thinker_t* LoadDynamicLineSlopeThinker(actionf_p1 thinker) +static inline thinker_t* LoadDynamicLineSlopeThinker(save_t *save_p, actionf_p1 thinker) { dynlineplanethink_t* ht = Z_Malloc(sizeof(*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->type = READUINT8(save_p); - ht->slope = LoadSlope(READUINT32(save_p)); - ht->sourceline = LoadLine(READUINT32(save_p)); - ht->extent = READFIXED(save_p); + ht->type = P_ReadUINT8(save_p); + ht->slope = LoadSlope(P_ReadUINT32(save_p)); + ht->sourceline = LoadLine(P_ReadUINT32(save_p)); + ht->extent = P_ReadFixed(save_p); return &ht->thinker; } -static inline thinker_t* LoadDynamicVertexSlopeThinker(actionf_p1 thinker) +static inline thinker_t* LoadDynamicVertexSlopeThinker(save_t *save_p, actionf_p1 thinker) { size_t i; dynvertexplanethink_t* ht = Z_Malloc(sizeof(*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->slope = LoadSlope(READUINT32(save_p)); + ht->slope = LoadSlope(P_ReadUINT32(save_p)); for (i = 0; i < 3; i++) - ht->secs[i] = LoadSector(READUINT32(save_p)); - READMEM(save_p, ht->vex, sizeof(ht->vex)); - READMEM(save_p, ht->origsecheights, sizeof(ht->origsecheights)); - READMEM(save_p, ht->origvecheights, sizeof(ht->origvecheights)); - ht->relative = READUINT8(save_p); + ht->secs[i] = LoadSector(P_ReadUINT32(save_p)); + P_ReadMem(save_p, ht->vex, sizeof(ht->vex)); + P_ReadMem(save_p, ht->origsecheights, sizeof(ht->origsecheights)); + P_ReadMem(save_p, ht->origvecheights, sizeof(ht->origvecheights)); + ht->relative = P_ReadUINT8(save_p); return &ht->thinker; } -static inline thinker_t* LoadPolyrotatetThinker(actionf_p1 thinker) +static inline thinker_t* LoadPolyrotatetThinker(save_t *save_p, actionf_p1 thinker) { polyrotate_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->polyObjNum = READINT32(save_p); - ht->speed = READINT32(save_p); - ht->distance = READINT32(save_p); - ht->turnobjs = READUINT8(save_p); + ht->polyObjNum = P_ReadINT32(save_p); + ht->speed = P_ReadINT32(save_p); + ht->distance = P_ReadINT32(save_p); + ht->turnobjs = P_ReadUINT8(save_p); return &ht->thinker; } -static thinker_t* LoadPolymoveThinker(actionf_p1 thinker) +static thinker_t* LoadPolymoveThinker(save_t *save_p, actionf_p1 thinker) { polymove_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->polyObjNum = READINT32(save_p); - ht->speed = READINT32(save_p); - ht->momx = READFIXED(save_p); - ht->momy = READFIXED(save_p); - ht->distance = READINT32(save_p); - ht->angle = READANGLE(save_p); + ht->polyObjNum = P_ReadINT32(save_p); + ht->speed = P_ReadINT32(save_p); + ht->momx = P_ReadFixed(save_p); + ht->momy = P_ReadFixed(save_p); + ht->distance = P_ReadINT32(save_p); + ht->angle = P_ReadAngle(save_p); return &ht->thinker; } -static inline thinker_t* LoadPolywaypointThinker(actionf_p1 thinker) +static inline thinker_t* LoadPolywaypointThinker(save_t *save_p, actionf_p1 thinker) { polywaypoint_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->polyObjNum = READINT32(save_p); - ht->speed = READINT32(save_p); - ht->sequence = READINT32(save_p); - ht->pointnum = READINT32(save_p); - ht->direction = READINT32(save_p); - ht->returnbehavior = READUINT8(save_p); - ht->continuous = READUINT8(save_p); - ht->stophere = READUINT8(save_p); + ht->polyObjNum = P_ReadINT32(save_p); + ht->speed = P_ReadINT32(save_p); + ht->sequence = P_ReadINT32(save_p); + ht->pointnum = P_ReadINT32(save_p); + ht->direction = P_ReadINT32(save_p); + ht->returnbehavior = P_ReadUINT8(save_p); + ht->continuous = P_ReadUINT8(save_p); + ht->stophere = P_ReadUINT8(save_p); return &ht->thinker; } -static inline thinker_t* LoadPolyslidedoorThinker(actionf_p1 thinker) +static inline thinker_t* LoadPolyslidedoorThinker(save_t *save_p, actionf_p1 thinker) { polyslidedoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->polyObjNum = READINT32(save_p); - ht->delay = READINT32(save_p); - ht->delayCount = READINT32(save_p); - ht->initSpeed = READINT32(save_p); - ht->speed = READINT32(save_p); - ht->initDistance = READINT32(save_p); - ht->distance = READINT32(save_p); - ht->initAngle = READUINT32(save_p); - ht->angle = READUINT32(save_p); - ht->revAngle = READUINT32(save_p); - ht->momx = READFIXED(save_p); - ht->momy = READFIXED(save_p); - ht->closing = READUINT8(save_p); + ht->polyObjNum = P_ReadINT32(save_p); + ht->delay = P_ReadINT32(save_p); + ht->delayCount = P_ReadINT32(save_p); + ht->initSpeed = P_ReadINT32(save_p); + ht->speed = P_ReadINT32(save_p); + ht->initDistance = P_ReadINT32(save_p); + ht->distance = P_ReadINT32(save_p); + ht->initAngle = P_ReadUINT32(save_p); + ht->angle = P_ReadUINT32(save_p); + ht->revAngle = P_ReadUINT32(save_p); + ht->momx = P_ReadFixed(save_p); + ht->momy = P_ReadFixed(save_p); + ht->closing = P_ReadUINT8(save_p); return &ht->thinker; } -static inline thinker_t* LoadPolyswingdoorThinker(actionf_p1 thinker) +static inline thinker_t* LoadPolyswingdoorThinker(save_t *save_p, actionf_p1 thinker) { polyswingdoor_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->polyObjNum = READINT32(save_p); - ht->delay = READINT32(save_p); - ht->delayCount = READINT32(save_p); - ht->initSpeed = READINT32(save_p); - ht->speed = READINT32(save_p); - ht->initDistance = READINT32(save_p); - ht->distance = READINT32(save_p); - ht->closing = READUINT8(save_p); + ht->polyObjNum = P_ReadINT32(save_p); + ht->delay = P_ReadINT32(save_p); + ht->delayCount = P_ReadINT32(save_p); + ht->initSpeed = P_ReadINT32(save_p); + ht->speed = P_ReadINT32(save_p); + ht->initDistance = P_ReadINT32(save_p); + ht->distance = P_ReadINT32(save_p); + ht->closing = P_ReadUINT8(save_p); return &ht->thinker; } -static inline thinker_t* LoadPolydisplaceThinker(actionf_p1 thinker) +static inline thinker_t* LoadPolydisplaceThinker(save_t *save_p, actionf_p1 thinker) { polydisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->polyObjNum = READINT32(save_p); - ht->controlSector = LoadSector(READUINT32(save_p)); - ht->dx = READFIXED(save_p); - ht->dy = READFIXED(save_p); - ht->oldHeights = READFIXED(save_p); + ht->polyObjNum = P_ReadINT32(save_p); + ht->controlSector = LoadSector(P_ReadUINT32(save_p)); + ht->dx = P_ReadFixed(save_p); + ht->dy = P_ReadFixed(save_p); + ht->oldHeights = P_ReadFixed(save_p); return &ht->thinker; } -static inline thinker_t* LoadPolyrotdisplaceThinker(actionf_p1 thinker) +static inline thinker_t* LoadPolyrotdisplaceThinker(save_t *save_p, actionf_p1 thinker) { polyrotdisplace_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->polyObjNum = READINT32(save_p); - ht->controlSector = LoadSector(READUINT32(save_p)); - ht->rotscale = READFIXED(save_p); - ht->turnobjs = READUINT8(save_p); - ht->oldHeights = READFIXED(save_p); + ht->polyObjNum = P_ReadINT32(save_p); + ht->controlSector = LoadSector(P_ReadUINT32(save_p)); + ht->rotscale = P_ReadFixed(save_p); + ht->turnobjs = P_ReadUINT8(save_p); + ht->oldHeights = P_ReadFixed(save_p); return &ht->thinker; } -static thinker_t* LoadPolyfadeThinker(actionf_p1 thinker) +static thinker_t* LoadPolyfadeThinker(save_t *save_p, actionf_p1 thinker) { polyfade_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL); ht->thinker.function.acp1 = thinker; - ht->polyObjNum = READINT32(save_p); - ht->sourcevalue = READINT32(save_p); - ht->destvalue = READINT32(save_p); - ht->docollision = (boolean)READUINT8(save_p); - ht->doghostfade = (boolean)READUINT8(save_p); - ht->ticbased = (boolean)READUINT8(save_p); - ht->duration = READINT32(save_p); - ht->timer = READINT32(save_p); + ht->polyObjNum = P_ReadINT32(save_p); + ht->sourcevalue = P_ReadINT32(save_p); + ht->destvalue = P_ReadINT32(save_p); + ht->docollision = (boolean)P_ReadUINT8(save_p); + ht->doghostfade = (boolean)P_ReadUINT8(save_p); + ht->ticbased = (boolean)P_ReadUINT8(save_p); + ht->duration = P_ReadINT32(save_p); + ht->timer = P_ReadINT32(save_p); return &ht->thinker; } -static void P_NetUnArchiveThinkers(void) +static void P_NetUnArchiveThinkers(save_t *save_p) { thinker_t *currentthinker; thinker_t *next; @@ -3946,7 +4185,7 @@ static void P_NetUnArchiveThinkers(void) UINT32 i; UINT32 numloaded = 0; - if (READUINT32(save_p) != ARCHIVEBLOCK_THINKERS) + if (P_ReadUINT32(save_p) != ARCHIVEBLOCK_THINKERS) I_Error("Bad $$$.sav at archive block Thinkers"); // remove all the current thinkers @@ -3984,7 +4223,7 @@ static void P_NetUnArchiveThinkers(void) for (;;) { thinker_t* th = NULL; - tclass = READUINT8(save_p); + tclass = P_ReadUINT8(save_p); if (tclass == tc_end) break; // leave the saved thinker reading loop @@ -3993,167 +4232,167 @@ static void P_NetUnArchiveThinkers(void) switch (tclass) { case tc_mobj: - th = LoadMobjThinker((actionf_p1)P_MobjThinker); + th = LoadMobjThinker(save_p, (actionf_p1)P_MobjThinker); break; case tc_ceiling: - th = LoadCeilingThinker((actionf_p1)T_MoveCeiling); + th = LoadCeilingThinker(save_p, (actionf_p1)T_MoveCeiling); break; case tc_crushceiling: - th = LoadCeilingThinker((actionf_p1)T_CrushCeiling); + th = LoadCeilingThinker(save_p, (actionf_p1)T_CrushCeiling); break; case tc_floor: - th = LoadFloormoveThinker((actionf_p1)T_MoveFloor); + th = LoadFloormoveThinker(save_p, (actionf_p1)T_MoveFloor); break; case tc_flash: - th = LoadLightflashThinker((actionf_p1)T_LightningFlash); + th = LoadLightflashThinker(save_p, (actionf_p1)T_LightningFlash); break; case tc_strobe: - th = LoadStrobeThinker((actionf_p1)T_StrobeFlash); + th = LoadStrobeThinker(save_p, (actionf_p1)T_StrobeFlash); break; case tc_glow: - th = LoadGlowThinker((actionf_p1)T_Glow); + th = LoadGlowThinker(save_p, (actionf_p1)T_Glow); break; case tc_fireflicker: - th = LoadFireflickerThinker((actionf_p1)T_FireFlicker); + th = LoadFireflickerThinker(save_p, (actionf_p1)T_FireFlicker); break; case tc_elevator: - th = LoadElevatorThinker((actionf_p1)T_MoveElevator, true); + th = LoadElevatorThinker(save_p, (actionf_p1)T_MoveElevator, true); break; case tc_continuousfalling: - th = LoadContinuousFallThinker((actionf_p1)T_ContinuousFalling); + th = LoadContinuousFallThinker(save_p, (actionf_p1)T_ContinuousFalling); break; case tc_thwomp: - th = LoadThwompThinker((actionf_p1)T_ThwompSector); + th = LoadThwompThinker(save_p, (actionf_p1)T_ThwompSector); break; case tc_noenemies: - th = LoadNoEnemiesThinker((actionf_p1)T_NoEnemiesSector); + th = LoadNoEnemiesThinker(save_p, (actionf_p1)T_NoEnemiesSector); break; case tc_eachtime: - th = LoadEachTimeThinker((actionf_p1)T_EachTimeThinker); + th = LoadEachTimeThinker(save_p, (actionf_p1)T_EachTimeThinker); break; case tc_raisesector: - th = LoadRaiseThinker((actionf_p1)T_RaiseSector); + th = LoadRaiseThinker(save_p, (actionf_p1)T_RaiseSector); break; case tc_camerascanner: - th = LoadElevatorThinker((actionf_p1)T_CameraScanner, false); + th = LoadElevatorThinker(save_p, (actionf_p1)T_CameraScanner, false); break; case tc_bouncecheese: - th = LoadBounceCheeseThinker((actionf_p1)T_BounceCheese); + th = LoadBounceCheeseThinker(save_p, (actionf_p1)T_BounceCheese); break; case tc_startcrumble: - th = LoadCrumbleThinker((actionf_p1)T_StartCrumble); + th = LoadCrumbleThinker(save_p, (actionf_p1)T_StartCrumble); break; case tc_marioblock: - th = LoadMarioBlockThinker((actionf_p1)T_MarioBlock); + th = LoadMarioBlockThinker(save_p, (actionf_p1)T_MarioBlock); break; case tc_marioblockchecker: - th = LoadMarioCheckThinker((actionf_p1)T_MarioBlockChecker); + th = LoadMarioCheckThinker(save_p, (actionf_p1)T_MarioBlockChecker); break; case tc_floatsector: - th = LoadFloatThinker((actionf_p1)T_FloatSector); + th = LoadFloatThinker(save_p, (actionf_p1)T_FloatSector); break; case tc_laserflash: - th = LoadLaserThinker((actionf_p1)T_LaserFlash); + th = LoadLaserThinker(save_p, (actionf_p1)T_LaserFlash); break; case tc_lightfade: - th = LoadLightlevelThinker((actionf_p1)T_LightFade); + th = LoadLightlevelThinker(save_p, (actionf_p1)T_LightFade); break; case tc_executor: - th = LoadExecutorThinker((actionf_p1)T_ExecutorDelay); + th = LoadExecutorThinker(save_p, (actionf_p1)T_ExecutorDelay); restoreNum = true; break; case tc_disappear: - th = LoadDisappearThinker((actionf_p1)T_Disappear); + th = LoadDisappearThinker(save_p, (actionf_p1)T_Disappear); break; case tc_fade: - th = LoadFadeThinker((actionf_p1)T_Fade); + th = LoadFadeThinker(save_p, (actionf_p1)T_Fade); break; case tc_fadecolormap: - th = LoadFadeColormapThinker((actionf_p1)T_FadeColormap); + th = LoadFadeColormapThinker(save_p, (actionf_p1)T_FadeColormap); break; case tc_planedisplace: - th = LoadPlaneDisplaceThinker((actionf_p1)T_PlaneDisplace); + th = LoadPlaneDisplaceThinker(save_p, (actionf_p1)T_PlaneDisplace); break; case tc_polyrotate: - th = LoadPolyrotatetThinker((actionf_p1)T_PolyObjRotate); + th = LoadPolyrotatetThinker(save_p, (actionf_p1)T_PolyObjRotate); break; case tc_polymove: - th = LoadPolymoveThinker((actionf_p1)T_PolyObjMove); + th = LoadPolymoveThinker(save_p, (actionf_p1)T_PolyObjMove); break; case tc_polywaypoint: - th = LoadPolywaypointThinker((actionf_p1)T_PolyObjWaypoint); + th = LoadPolywaypointThinker(save_p, (actionf_p1)T_PolyObjWaypoint); break; case tc_polyslidedoor: - th = LoadPolyslidedoorThinker((actionf_p1)T_PolyDoorSlide); + th = LoadPolyslidedoorThinker(save_p, (actionf_p1)T_PolyDoorSlide); break; case tc_polyswingdoor: - th = LoadPolyswingdoorThinker((actionf_p1)T_PolyDoorSwing); + th = LoadPolyswingdoorThinker(save_p, (actionf_p1)T_PolyDoorSwing); break; case tc_polyflag: - th = LoadPolymoveThinker((actionf_p1)T_PolyObjFlag); + th = LoadPolymoveThinker(save_p, (actionf_p1)T_PolyObjFlag); break; case tc_polydisplace: - th = LoadPolydisplaceThinker((actionf_p1)T_PolyObjDisplace); + th = LoadPolydisplaceThinker(save_p, (actionf_p1)T_PolyObjDisplace); break; case tc_polyrotdisplace: - th = LoadPolyrotdisplaceThinker((actionf_p1)T_PolyObjRotDisplace); + th = LoadPolyrotdisplaceThinker(save_p, (actionf_p1)T_PolyObjRotDisplace); break; case tc_polyfade: - th = LoadPolyfadeThinker((actionf_p1)T_PolyObjFade); + th = LoadPolyfadeThinker(save_p, (actionf_p1)T_PolyObjFade); break; case tc_dynslopeline: - th = LoadDynamicLineSlopeThinker((actionf_p1)T_DynamicSlopeLine); + th = LoadDynamicLineSlopeThinker(save_p, (actionf_p1)T_DynamicSlopeLine); break; case tc_dynslopevert: - th = LoadDynamicVertexSlopeThinker((actionf_p1)T_DynamicSlopeVert); + th = LoadDynamicVertexSlopeThinker(save_p, (actionf_p1)T_DynamicSlopeVert); break; case tc_scroll: - th = LoadScrollThinker((actionf_p1)T_Scroll); + th = LoadScrollThinker(save_p, (actionf_p1)T_Scroll); break; case tc_friction: - th = LoadFrictionThinker((actionf_p1)T_Friction); + th = LoadFrictionThinker(save_p, (actionf_p1)T_Friction); break; case tc_pusher: - th = LoadPusherThinker((actionf_p1)T_Pusher); + th = LoadPusherThinker(save_p, (actionf_p1)T_Pusher); break; default: @@ -4193,29 +4432,29 @@ static void P_NetUnArchiveThinkers(void) #define PD_FLAGS 0x01 #define PD_TRANS 0x02 -static inline void P_ArchivePolyObj(polyobj_t *po) +static inline void P_ArchivePolyObj(save_t *save_p, polyobj_t *po) { UINT8 diff = 0; - WRITEINT32(save_p, po->id); - WRITEANGLE(save_p, po->angle); + P_WriteINT32(save_p, po->id); + P_WriteAngle(save_p, po->angle); - WRITEFIXED(save_p, po->spawnSpot.x); - WRITEFIXED(save_p, po->spawnSpot.y); + P_WriteFixed(save_p, po->spawnSpot.x); + P_WriteFixed(save_p, po->spawnSpot.y); if (po->flags != po->spawnflags) diff |= PD_FLAGS; if (po->translucency != po->spawntrans) diff |= PD_TRANS; - WRITEUINT8(save_p, diff); + P_WriteUINT8(save_p, diff); if (diff & PD_FLAGS) - WRITEINT32(save_p, po->flags); + P_WriteINT32(save_p, po->flags); if (diff & PD_TRANS) - WRITEINT32(save_p, po->translucency); + P_WriteINT32(save_p, po->translucency); } -static inline void P_UnArchivePolyObj(polyobj_t *po) +static inline void P_UnArchivePolyObj(save_t *save_p, polyobj_t *po) { INT32 id; UINT32 angle; @@ -4227,19 +4466,19 @@ static inline void P_UnArchivePolyObj(polyobj_t *po) // when they first start to run. po->thinker = NULL; - id = READINT32(save_p); + id = P_ReadINT32(save_p); - angle = READANGLE(save_p); + angle = P_ReadAngle(save_p); - x = READFIXED(save_p); - y = READFIXED(save_p); + x = P_ReadFixed(save_p); + y = P_ReadFixed(save_p); - diff = READUINT8(save_p); + diff = P_ReadUINT8(save_p); if (diff & PD_FLAGS) - po->flags = READINT32(save_p); + po->flags = P_ReadINT32(save_p); if (diff & PD_TRANS) - po->translucency = READINT32(save_p); + po->translucency = P_ReadINT32(save_p); // if the object is bad or isn't in the id hash, we can do nothing more // with it, so return now @@ -4250,33 +4489,33 @@ static inline void P_UnArchivePolyObj(polyobj_t *po) Polyobj_MoveOnLoad(po, angle, x, y); } -static inline void P_ArchivePolyObjects(void) +static inline void P_ArchivePolyObjects(save_t *save_p) { INT32 i; - WRITEUINT32(save_p, ARCHIVEBLOCK_POBJS); + P_WriteUINT32(save_p, ARCHIVEBLOCK_POBJS); // save number of polyobjects - WRITEINT32(save_p, numPolyObjects); + P_WriteINT32(save_p, numPolyObjects); for (i = 0; i < numPolyObjects; ++i) - P_ArchivePolyObj(&PolyObjects[i]); + P_ArchivePolyObj(save_p, &PolyObjects[i]); } -static inline void P_UnArchivePolyObjects(void) +static inline void P_UnArchivePolyObjects(save_t *save_p) { INT32 i, numSavedPolys; - if (READUINT32(save_p) != ARCHIVEBLOCK_POBJS) + if (P_ReadUINT32(save_p) != ARCHIVEBLOCK_POBJS) I_Error("Bad $$$.sav at archive block Pobjs"); - numSavedPolys = READINT32(save_p); + numSavedPolys = P_ReadINT32(save_p); if (numSavedPolys != numPolyObjects) I_Error("P_UnArchivePolyObjects: polyobj count inconsistency\n"); for (i = 0; i < numSavedPolys; ++i) - P_UnArchivePolyObj(&PolyObjects[i]); + P_UnArchivePolyObj(save_p, &PolyObjects[i]); } static inline void P_FinishMobjs(void) @@ -4394,11 +4633,11 @@ static void P_RelinkPointers(void) } } -static inline void P_NetArchiveSpecials(void) +static inline void P_NetArchiveSpecials(save_t *save_p) { size_t i, z; - WRITEUINT32(save_p, ARCHIVEBLOCK_SPECIALS); + P_WriteUINT32(save_p, ARCHIVEBLOCK_SPECIALS); // itemrespawn queue for deathmatch i = iquetail; @@ -4408,53 +4647,54 @@ static inline void P_NetArchiveSpecials(void) { if (&mapthings[z] == itemrespawnque[i]) { - WRITEUINT32(save_p, z); + P_WriteUINT32(save_p, z); break; } } - WRITEUINT32(save_p, itemrespawntime[i]); + P_WriteUINT32(save_p, itemrespawntime[i]); i = (i + 1) & (ITEMQUESIZE-1); } // end delimiter - WRITEUINT32(save_p, 0xffffffff); + P_WriteUINT32(save_p, 0xffffffff); // Sky number - WRITEINT32(save_p, globallevelskynum); + P_WriteINT32(save_p, globallevelskynum); // Current global weather type - WRITEUINT8(save_p, globalweather); + P_WriteUINT8(save_p, globalweather); if (metalplayback) // Is metal sonic running? { - WRITEUINT8(save_p, 0x01); - G_SaveMetal(&save_p); + UINT8 *p = &save_p->buf[save_p->pos+1]; + P_WriteUINT8(save_p, 0x01); + G_SaveMetal(&p); } else - WRITEUINT8(save_p, 0x00); + P_WriteUINT8(save_p, 0x00); } -static void P_NetUnArchiveSpecials(void) +static void P_NetUnArchiveSpecials(save_t *save_p) { size_t i; INT32 j; - if (READUINT32(save_p) != ARCHIVEBLOCK_SPECIALS) + if (P_ReadUINT32(save_p) != ARCHIVEBLOCK_SPECIALS) I_Error("Bad $$$.sav at archive block Specials"); // BP: added save itemrespawn queue for deathmatch iquetail = iquehead = 0; - while ((i = READUINT32(save_p)) != 0xffffffff) + while ((i = P_ReadUINT32(save_p)) != 0xffffffff) { itemrespawnque[iquehead] = &mapthings[i]; - itemrespawntime[iquehead++] = READINT32(save_p); + itemrespawntime[iquehead++] = P_ReadINT32(save_p); } - j = READINT32(save_p); + j = P_ReadINT32(save_p); if (j != globallevelskynum) P_SetupLevelSky(j, true); - globalweather = READUINT8(save_p); + globalweather = P_ReadUINT8(save_p); if (globalweather) { @@ -4469,14 +4709,17 @@ static void P_NetUnArchiveSpecials(void) P_SwitchWeather(globalweather); } - if (READUINT8(save_p) == 0x01) // metal sonic - G_LoadMetal(&save_p); + if (P_ReadUINT8(save_p) == 0x01) // metal sonic + { + UINT8 *p = &save_p->buf[save_p->pos]; + G_LoadMetal(&p); + } } // ======================================================================= // Misc // ======================================================================= -static inline void P_ArchiveMisc(INT16 mapnum) +static inline void P_ArchiveMisc(save_t *save_p, INT16 mapnum) { //lastmapsaved = mapnum; lastmaploaded = mapnum; @@ -4484,16 +4727,16 @@ static inline void P_ArchiveMisc(INT16 mapnum) if (gamecomplete) mapnum |= 8192; - WRITEINT16(save_p, mapnum); - WRITEUINT16(save_p, emeralds+357); - WRITESTRINGN(save_p, timeattackfolder, sizeof(timeattackfolder)); + P_WriteINT16(save_p, mapnum); + P_WriteUINT16(save_p, emeralds+357); + P_WriteStringN(save_p, timeattackfolder, sizeof(timeattackfolder)); } -static inline void P_UnArchiveSPGame(INT16 mapoverride) +static inline void P_UnArchiveSPGame(save_t *save_p, INT16 mapoverride) { char testname[sizeof(timeattackfolder)]; - gamemap = READINT16(save_p); + gamemap = P_ReadINT16(save_p); if (mapoverride != 0) { @@ -4514,9 +4757,9 @@ static inline void P_UnArchiveSPGame(INT16 mapoverride) tokenlist = 0; token = 0; - savedata.emeralds = READUINT16(save_p)-357; + savedata.emeralds = P_ReadUINT16(save_p)-357; - READSTRINGN(save_p, testname, sizeof(testname)); + P_ReadStringN(save_p, testname, sizeof(testname)); if (strcmp(testname, timeattackfolder)) { @@ -4530,100 +4773,100 @@ static inline void P_UnArchiveSPGame(INT16 mapoverride) playeringame[consoleplayer] = true; } -static void P_NetArchiveMisc(boolean resending) +static void P_NetArchiveMisc(save_t *save_p, boolean resending) { INT32 i; - WRITEUINT32(save_p, ARCHIVEBLOCK_MISC); + P_WriteUINT32(save_p, ARCHIVEBLOCK_MISC); if (resending) - WRITEUINT32(save_p, gametic); - WRITEINT16(save_p, gamemap); + P_WriteUINT32(save_p, gametic); + P_WriteINT16(save_p, gamemap); if (gamestate != GS_LEVEL) - WRITEINT16(save_p, GS_WAITINGPLAYERS); // nice hack to put people back into waitingplayers + P_WriteINT16(save_p, GS_WAITINGPLAYERS); // nice hack to put people back into waitingplayers else - WRITEINT16(save_p, gamestate); - WRITEINT16(save_p, gametype); + P_WriteINT16(save_p, gamestate); + P_WriteINT16(save_p, gametype); { UINT32 pig = 0; for (i = 0; i < MAXPLAYERS; i++) pig |= (playeringame[i] != 0)<totalplaytime); + P_WriteUINT32(save_p, data->totalplaytime); // TODO put another cipher on these things? meh, I don't care... for (i = 0; i < NUMMAPS; i++) - WRITEUINT8(save_p, (data->mapvisited[i] & MV_MAX)); + P_WriteUINT8(save_p, (data->mapvisited[i] & MV_MAX)); // To save space, use one bit per collected/achieved/unlocked flag for (i = 0; i < MAXEMBLEMS;) @@ -4742,7 +4985,7 @@ static inline void P_NetArchiveEmblems(void) btemp = 0; for (j = 0; j < 8 && j+i < MAXEMBLEMS; ++j) btemp |= (data->collected[j+i] << j); - WRITEUINT8(save_p, btemp); + P_WriteUINT8(save_p, btemp); i += j; } for (i = 0; i < MAXEXTRAEMBLEMS;) @@ -4750,7 +4993,7 @@ static inline void P_NetArchiveEmblems(void) btemp = 0; for (j = 0; j < 8 && j+i < MAXEXTRAEMBLEMS; ++j) btemp |= (data->extraCollected[j+i] << j); - WRITEUINT8(save_p, btemp); + P_WriteUINT8(save_p, btemp); i += j; } for (i = 0; i < MAXUNLOCKABLES;) @@ -4758,7 +5001,7 @@ static inline void P_NetArchiveEmblems(void) btemp = 0; for (j = 0; j < 8 && j+i < MAXUNLOCKABLES; ++j) btemp |= (data->unlocked[j+i] << j); - WRITEUINT8(save_p, btemp); + P_WriteUINT8(save_p, btemp); i += j; } for (i = 0; i < MAXCONDITIONSETS;) @@ -4766,28 +5009,28 @@ static inline void P_NetArchiveEmblems(void) btemp = 0; for (j = 0; j < 8 && j+i < MAXCONDITIONSETS; ++j) btemp |= (data->achieved[j+i] << j); - WRITEUINT8(save_p, btemp); + P_WriteUINT8(save_p, btemp); i += j; } - WRITEUINT32(save_p, data->timesBeaten); - WRITEUINT32(save_p, data->timesBeatenWithEmeralds); - WRITEUINT32(save_p, data->timesBeatenUltimate); + P_WriteUINT32(save_p, data->timesBeaten); + P_WriteUINT32(save_p, data->timesBeatenWithEmeralds); + P_WriteUINT32(save_p, data->timesBeatenUltimate); // Main records for (i = 0; i < NUMMAPS; i++) { if (data->mainrecords[i]) { - WRITEUINT32(save_p, data->mainrecords[i]->score); - WRITEUINT32(save_p, data->mainrecords[i]->time); - WRITEUINT16(save_p, data->mainrecords[i]->rings); + P_WriteUINT32(save_p, data->mainrecords[i]->score); + P_WriteUINT32(save_p, data->mainrecords[i]->time); + P_WriteUINT16(save_p, data->mainrecords[i]->rings); } else { - WRITEUINT32(save_p, 0); - WRITEUINT32(save_p, 0); - WRITEUINT16(save_p, 0); + P_WriteUINT32(save_p, 0); + P_WriteUINT32(save_p, 0); + P_WriteUINT16(save_p, 0); } } @@ -4796,43 +5039,43 @@ static inline void P_NetArchiveEmblems(void) { if (!data->nightsrecords[i] || !data->nightsrecords[i]->nummares) { - WRITEUINT8(save_p, 0); + P_WriteUINT8(save_p, 0); continue; } - WRITEUINT8(save_p, data->nightsrecords[i]->nummares); + P_WriteUINT8(save_p, data->nightsrecords[i]->nummares); for (curmare = 0; curmare < (data->nightsrecords[i]->nummares + 1); ++curmare) { - WRITEUINT32(save_p, data->nightsrecords[i]->score[curmare]); - WRITEUINT8(save_p, data->nightsrecords[i]->grade[curmare]); - WRITEUINT32(save_p, data->nightsrecords[i]->time[curmare]); + P_WriteUINT32(save_p, data->nightsrecords[i]->score[curmare]); + P_WriteUINT8(save_p, data->nightsrecords[i]->grade[curmare]); + P_WriteUINT32(save_p, data->nightsrecords[i]->time[curmare]); } } // Mid-map stuff - WRITEUINT32(save_p, unlocktriggers); + P_WriteUINT32(save_p, unlocktriggers); for (i = 0; i < MAXPLAYERS; i++) { if (!ntemprecords[i].nummares) { - WRITEUINT8(save_p, 0); + P_WriteUINT8(save_p, 0); continue; } - WRITEUINT8(save_p, ntemprecords[i].nummares); + P_WriteUINT8(save_p, ntemprecords[i].nummares); for (curmare = 0; curmare < (ntemprecords[i].nummares + 1); ++curmare) { - WRITEUINT32(save_p, ntemprecords[i].score[curmare]); - WRITEUINT8(save_p, ntemprecords[i].grade[curmare]); - WRITEUINT32(save_p, ntemprecords[i].time[curmare]); + P_WriteUINT32(save_p, ntemprecords[i].score[curmare]); + P_WriteUINT8(save_p, ntemprecords[i].grade[curmare]); + P_WriteUINT32(save_p, ntemprecords[i].time[curmare]); } } } -static inline void P_NetUnArchiveEmblems(void) +static inline void P_NetUnArchiveEmblems(save_t *save_p) { gamedata_t *data = serverGamedata; INT32 i, j; @@ -4843,14 +5086,14 @@ static inline void P_NetUnArchiveEmblems(void) UINT8 recmares; INT32 curmare; - if (READUINT32(save_p) != ARCHIVEBLOCK_EMBLEMS) + if (P_ReadUINT32(save_p) != ARCHIVEBLOCK_EMBLEMS) I_Error("Bad $$$.sav at archive block Emblems"); - savemoddata = (boolean)READUINT8(save_p); // this one is actually necessary because savemoddata stays false otherwise for some reason. + savemoddata = (boolean)P_ReadUINT8(save_p); // this one is actually necessary because savemoddata stays false otherwise for some reason. - if (numemblems != READINT32(save_p)) + if (numemblems != P_ReadINT32(save_p)) I_Error("Bad $$$.sav dearchiving Emblems (numemblems mismatch)"); - if (numextraemblems != READINT32(save_p)) + if (numextraemblems != P_ReadINT32(save_p)) I_Error("Bad $$$.sav dearchiving Emblems (numextraemblems mismatch)"); // This shouldn't happen, but if something really fucked up happens and you transfer @@ -4865,53 +5108,53 @@ static inline void P_NetUnArchiveEmblems(void) // TODO: Optimize this to only read information about emblems, unlocks, etc. which actually exist // There is no need to go all the way up to MAXEMBLEMS when wads are guaranteed to be the same. - data->totalplaytime = READUINT32(save_p); + data->totalplaytime = P_ReadUINT32(save_p); // TODO put another cipher on these things? meh, I don't care... for (i = 0; i < NUMMAPS; i++) - if ((data->mapvisited[i] = READUINT8(save_p)) > MV_MAX) + if ((data->mapvisited[i] = P_ReadUINT8(save_p)) > MV_MAX) I_Error("Bad $$$.sav dearchiving Emblems (invalid visit flags)"); // To save space, use one bit per collected/achieved/unlocked flag for (i = 0; i < MAXEMBLEMS;) { - rtemp = READUINT8(save_p); + rtemp = P_ReadUINT8(save_p); for (j = 0; j < 8 && j+i < MAXEMBLEMS; ++j) data->collected[j+i] = ((rtemp >> j) & 1); i += j; } for (i = 0; i < MAXEXTRAEMBLEMS;) { - rtemp = READUINT8(save_p); + rtemp = P_ReadUINT8(save_p); for (j = 0; j < 8 && j+i < MAXEXTRAEMBLEMS; ++j) data->extraCollected[j+i] = ((rtemp >> j) & 1); i += j; } for (i = 0; i < MAXUNLOCKABLES;) { - rtemp = READUINT8(save_p); + rtemp = P_ReadUINT8(save_p); for (j = 0; j < 8 && j+i < MAXUNLOCKABLES; ++j) data->unlocked[j+i] = ((rtemp >> j) & 1); i += j; } for (i = 0; i < MAXCONDITIONSETS;) { - rtemp = READUINT8(save_p); + rtemp = P_ReadUINT8(save_p); for (j = 0; j < 8 && j+i < MAXCONDITIONSETS; ++j) data->achieved[j+i] = ((rtemp >> j) & 1); i += j; } - data->timesBeaten = READUINT32(save_p); - data->timesBeatenWithEmeralds = READUINT32(save_p); - data->timesBeatenUltimate = READUINT32(save_p); + data->timesBeaten = P_ReadUINT32(save_p); + data->timesBeatenWithEmeralds = P_ReadUINT32(save_p); + data->timesBeatenUltimate = P_ReadUINT32(save_p); // Main records for (i = 0; i < NUMMAPS; ++i) { - recscore = READUINT32(save_p); - rectime = (tic_t)READUINT32(save_p); - recrings = READUINT16(save_p); + recscore = P_ReadUINT32(save_p); + rectime = (tic_t)P_ReadUINT32(save_p); + recrings = P_ReadUINT16(save_p); if (recrings > 10000 || recscore > MAXSCORE) I_Error("Bad $$$.sav dearchiving Emblems (invalid score)"); @@ -4928,16 +5171,16 @@ static inline void P_NetUnArchiveEmblems(void) // Nights records for (i = 0; i < NUMMAPS; ++i) { - if ((recmares = READUINT8(save_p)) == 0) + if ((recmares = P_ReadUINT8(save_p)) == 0) continue; G_AllocNightsRecordData((INT16)i, data); for (curmare = 0; curmare < (recmares+1); ++curmare) { - data->nightsrecords[i]->score[curmare] = READUINT32(save_p); - data->nightsrecords[i]->grade[curmare] = READUINT8(save_p); - data->nightsrecords[i]->time[curmare] = (tic_t)READUINT32(save_p); + data->nightsrecords[i]->score[curmare] = P_ReadUINT32(save_p); + data->nightsrecords[i]->grade[curmare] = P_ReadUINT8(save_p); + data->nightsrecords[i]->time[curmare] = (tic_t)P_ReadUINT32(save_p); if (data->nightsrecords[i]->grade[curmare] > GRADE_S) { @@ -4949,18 +5192,18 @@ static inline void P_NetUnArchiveEmblems(void) } // Mid-map stuff - unlocktriggers = READUINT32(save_p); + unlocktriggers = P_ReadUINT32(save_p); for (i = 0; i < MAXPLAYERS; ++i) { - if ((recmares = READUINT8(save_p)) == 0) + if ((recmares = P_ReadUINT8(save_p)) == 0) continue; for (curmare = 0; curmare < (recmares+1); ++curmare) { - ntemprecords[i].score[curmare] = READUINT32(save_p); - ntemprecords[i].grade[curmare] = READUINT8(save_p); - ntemprecords[i].time[curmare] = (tic_t)READUINT32(save_p); + ntemprecords[i].score[curmare] = P_ReadUINT32(save_p); + ntemprecords[i].grade[curmare] = P_ReadUINT8(save_p); + ntemprecords[i].time[curmare] = (tic_t)P_ReadUINT32(save_p); if (ntemprecords[i].grade[curmare] > GRADE_S) { @@ -4972,37 +5215,37 @@ static inline void P_NetUnArchiveEmblems(void) } } -static void P_NetArchiveSectorPortals(void) +static void P_NetArchiveSectorPortals(save_t *save_p) { - WRITEUINT32(save_p, ARCHIVEBLOCK_SECPORTALS); + P_WriteUINT32(save_p, ARCHIVEBLOCK_SECPORTALS); - WRITEUINT32(save_p, secportalcount); + P_WriteUINT32(save_p, secportalcount); for (size_t i = 0; i < secportalcount; i++) { UINT8 type = secportals[i].type; - WRITEUINT8(save_p, type); - WRITEFIXED(save_p, secportals[i].origin.x); - WRITEFIXED(save_p, secportals[i].origin.y); + P_WriteUINT8(save_p, type); + P_WriteFixed(save_p, secportals[i].origin.x); + P_WriteFixed(save_p, secportals[i].origin.y); switch (type) { case SECPORTAL_LINE: - WRITEUINT32(save_p, SaveLine(secportals[i].line.start)); - WRITEUINT32(save_p, SaveLine(secportals[i].line.dest)); + P_WriteUINT32(save_p, SaveLine(secportals[i].line.start)); + P_WriteUINT32(save_p, SaveLine(secportals[i].line.dest)); break; case SECPORTAL_PLANE: case SECPORTAL_HORIZON: case SECPORTAL_FLOOR: case SECPORTAL_CEILING: - WRITEUINT32(save_p, SaveSector(secportals[i].sector)); + P_WriteUINT32(save_p, SaveSector(secportals[i].sector)); break; case SECPORTAL_OBJECT: if (secportals[i].mobj && !P_MobjWasRemoved(secportals[i].mobj)) SaveMobjnum(secportals[i].mobj); else - WRITEUINT32(save_p, 0); + P_WriteUINT32(save_p, 0); break; default: break; @@ -5010,15 +5253,15 @@ static void P_NetArchiveSectorPortals(void) } } -static void P_NetUnArchiveSectorPortals(void) +static void P_NetUnArchiveSectorPortals(save_t *save_p) { - if (READUINT32(save_p) != ARCHIVEBLOCK_SECPORTALS) + if (P_ReadUINT32(save_p) != ARCHIVEBLOCK_SECPORTALS) I_Error("Bad $$$.sav at archive block Secportals"); Z_Free(secportals); P_InitSectorPortals(); - UINT32 count = READUINT32(save_p); + UINT32 count = P_ReadUINT32(save_p); for (UINT32 i = 0; i < count; i++) { @@ -5026,24 +5269,24 @@ static void P_NetUnArchiveSectorPortals(void) sectorportal_t *secportal = &secportals[id]; - secportal->type = READUINT8(save_p); - secportal->origin.x = READFIXED(save_p); - secportal->origin.y = READFIXED(save_p); + secportal->type = P_ReadUINT8(save_p); + secportal->origin.x = P_ReadFixed(save_p); + secportal->origin.y = P_ReadFixed(save_p); switch (secportal->type) { case SECPORTAL_LINE: - secportal->line.start = LoadLine(READUINT32(save_p)); - secportal->line.dest = LoadLine(READUINT32(save_p)); + secportal->line.start = LoadLine(P_ReadUINT32(save_p)); + secportal->line.dest = LoadLine(P_ReadUINT32(save_p)); break; case SECPORTAL_PLANE: case SECPORTAL_HORIZON: case SECPORTAL_FLOOR: case SECPORTAL_CEILING: - secportal->sector = LoadSector(READUINT32(save_p)); + secportal->sector = LoadSector(P_ReadUINT32(save_p)); break; case SECPORTAL_OBJECT: - id = READUINT32(save_p); + id = P_ReadUINT32(save_p); secportal->mobj = (id == 0) ? NULL : P_FindNewPosition(id); break; default: @@ -5052,7 +5295,7 @@ static void P_NetUnArchiveSectorPortals(void) } } -static inline void P_ArchiveLuabanksAndConsistency(void) +static inline void P_ArchiveLuabanksAndConsistency(save_t *save_p) { UINT8 i, banksinuse = NUM_LUABANKS; @@ -5061,30 +5304,30 @@ static inline void P_ArchiveLuabanksAndConsistency(void) if (banksinuse) { - WRITEUINT8(save_p, 0xb7); // luabanks marker - WRITEUINT8(save_p, banksinuse); + P_WriteUINT8(save_p, 0xb7); // luabanks marker + P_WriteUINT8(save_p, banksinuse); for (i = 0; i < banksinuse; i++) - WRITEINT32(save_p, luabanks[i]); + P_WriteINT32(save_p, luabanks[i]); } - WRITEUINT8(save_p, 0x1d); // consistency marker + P_WriteUINT8(save_p, 0x1d); // consistency marker } -static inline boolean P_UnArchiveLuabanksAndConsistency(void) +static inline boolean P_UnArchiveLuabanksAndConsistency(save_t *save_p) { - switch (READUINT8(save_p)) + switch (P_ReadUINT8(save_p)) { case 0xb7: // luabanks marker { - UINT8 i, banksinuse = READUINT8(save_p); + UINT8 i, banksinuse = P_ReadUINT8(save_p); if (banksinuse > NUM_LUABANKS) { CONS_Alert(CONS_ERROR, M_GetText("Corrupt Luabanks! (Too many banks in use)\n")); return false; } for (i = 0; i < banksinuse; i++) - luabanks[i] = READINT32(save_p); - if (READUINT8(save_p) != 0x1d) // consistency marker + luabanks[i] = P_ReadINT32(save_p); + if (P_ReadUINT8(save_p) != 0x1d) // consistency marker { CONS_Alert(CONS_ERROR, M_GetText("Corrupt Luabanks! (Failed consistency check)\n")); return false; @@ -5100,22 +5343,24 @@ static inline boolean P_UnArchiveLuabanksAndConsistency(void) return true; } -void P_SaveGame(INT16 mapnum) +void P_SaveGame(save_t *save_p, INT16 mapnum) { - P_ArchiveMisc(mapnum); - P_ArchivePlayer(); - P_ArchiveLuabanksAndConsistency(); + P_ArchiveMisc(save_p, mapnum); + P_ArchivePlayer(save_p); + P_ArchiveLuabanksAndConsistency(save_p); } -void P_SaveNetGame(boolean resending) +void P_SaveNetGame(save_t *save_p, boolean resending) { thinker_t *th; mobj_t *mobj; INT32 i = 1; // don't start from 0, it'd be confused with a blank pointer otherwise - CV_SaveNetVars(&save_p); - P_NetArchiveMisc(resending); - P_NetArchiveEmblems(); + UINT8 *p = &save_p->buf[save_p->pos]; + CV_SaveNetVars(&p); + save_p->pos = p - save_p->buf; + P_NetArchiveMisc(save_p, resending); + P_NetArchiveEmblems(save_p); // Assign the mobjnumber for pointer tracking for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) @@ -5129,32 +5374,32 @@ void P_SaveNetGame(boolean resending) mobj->mobjnum = i++; } - P_NetArchivePlayers(); + P_NetArchivePlayers(save_p); if (gamestate == GS_LEVEL) { - P_NetArchiveWorld(); - P_ArchivePolyObjects(); - P_NetArchiveThinkers(); - P_NetArchiveSpecials(); - P_NetArchiveColormaps(); - P_NetArchiveWaypoints(); - P_NetArchiveSectorPortals(); + P_NetArchiveWorld(save_p); + P_ArchivePolyObjects(save_p); + P_NetArchiveThinkers(save_p); + P_NetArchiveSpecials(save_p); + P_NetArchiveColormaps(save_p); + P_NetArchiveWaypoints(save_p); + P_NetArchiveSectorPortals(save_p); } - LUA_Archive(); + LUA_Archive(save_p); - P_ArchiveLuabanksAndConsistency(); + P_ArchiveLuabanksAndConsistency(save_p); } -boolean P_LoadGame(INT16 mapoverride) +boolean P_LoadGame(save_t *save_p, INT16 mapoverride) { if (gamestate == GS_INTERMISSION) Y_EndIntermission(); G_SetGamestate(GS_NULL); // should be changed in P_UnArchiveMisc - P_UnArchiveSPGame(mapoverride); - P_UnArchivePlayer(); + P_UnArchiveSPGame(save_p, mapoverride); + P_UnArchivePlayer(save_p); - if (!P_UnArchiveLuabanksAndConsistency()) + if (!P_UnArchiveLuabanksAndConsistency(save_p)) return false; // Only do this after confirming savegame is ok @@ -5164,26 +5409,28 @@ boolean P_LoadGame(INT16 mapoverride) return true; } -boolean P_LoadNetGame(boolean reloading) +boolean P_LoadNetGame(save_t *save_p, boolean reloading) { - CV_LoadNetVars(&save_p); - if (!P_NetUnArchiveMisc(reloading)) + UINT8 *p = &save_p->buf[save_p->pos]; + CV_LoadNetVars(&p); + save_p->pos = p - save_p->buf; + if (!P_NetUnArchiveMisc(save_p, reloading)) return false; - P_NetUnArchiveEmblems(); - P_NetUnArchivePlayers(); + P_NetUnArchiveEmblems(save_p); + P_NetUnArchivePlayers(save_p); if (gamestate == GS_LEVEL) { - P_NetUnArchiveWorld(); - P_UnArchivePolyObjects(); - P_NetUnArchiveThinkers(); - P_NetUnArchiveSpecials(); - P_NetUnArchiveColormaps(); - P_NetUnArchiveWaypoints(); - P_NetUnArchiveSectorPortals(); + P_NetUnArchiveWorld(save_p); + P_UnArchivePolyObjects(save_p); + P_NetUnArchiveThinkers(save_p); + P_NetUnArchiveSpecials(save_p); + P_NetUnArchiveColormaps(save_p); + P_NetUnArchiveWaypoints(save_p); + P_NetUnArchiveSectorPortals(save_p); P_RelinkPointers(); P_FinishMobjs(); } - LUA_UnArchive(); + LUA_UnArchive(save_p); // This is stupid and hacky, but maybe it'll work! P_SetRandSeed(P_GetInitSeed()); @@ -5194,5 +5441,5 @@ boolean P_LoadNetGame(boolean reloading) // precipitation when loading a netgame save. Instead, precip has to be spawned here. // This is done in P_NetUnArchiveSpecials now. - return P_UnArchiveLuabanksAndConsistency(); + return P_UnArchiveLuabanksAndConsistency(save_p); } diff --git a/src/p_saveg.h b/src/p_saveg.h index 545008e7e..8aa83c80f 100644 --- a/src/p_saveg.h +++ b/src/p_saveg.h @@ -18,17 +18,24 @@ #pragma interface #endif +#include "tables.h" + #define NEWSKINSAVES (INT16_MAX) // TODO: 2.3: Delete (Purely for backwards compatibility) // Persistent storage/archiving. // These are the load / save game routines. -void P_SaveGame(INT16 mapnum); -void P_SaveNetGame(boolean resending); -boolean P_LoadGame(INT16 mapoverride); -boolean P_LoadNetGame(boolean reloading); +typedef struct +{ + unsigned char *buf; + size_t size; + size_t pos; +} save_t; -mobj_t *P_FindNewPosition(UINT32 oldposition); +void P_SaveGame(save_t *save_p, INT16 mapnum); +void P_SaveNetGame(save_t *save_p, boolean resending); +boolean P_LoadGame(save_t *save_p, INT16 mapoverride); +boolean P_LoadNetGame(save_t *save_p, boolean reloading); typedef struct { @@ -42,6 +49,37 @@ typedef struct } savedata_t; extern savedata_t savedata; -extern UINT8 *save_p; + +void P_WriteUINT8(save_t *p, UINT8 v); +void P_WriteSINT8(save_t *p, SINT8 v); +void P_WriteUINT16(save_t *p, UINT16 v); +void P_WriteINT16(save_t *p, INT16 v); +void P_WriteUINT32(save_t *p, UINT32 v); +void P_WriteINT32(save_t *p, INT32 v); +void P_WriteChar(save_t *p, char v); +void P_WriteFixed(save_t *p, fixed_t v); +void P_WriteAngle(save_t *p, angle_t v); +void P_WriteStringN(save_t *p, char const *s, size_t n); +void P_WriteStringL(save_t *p, char const *s, size_t n); +void P_WriteString(save_t *p, char const *s); +void P_WriteMem(save_t *p, void const *s, size_t n); + +void P_SkipStringN(save_t *p, size_t n); +void P_SkipStringL(save_t *p, size_t n); +void P_SkipString(save_t *p); + +UINT8 P_ReadUINT8(save_t *p); +SINT8 P_ReadSINT8(save_t *p); +UINT16 P_ReadUINT16(save_t *p); +INT16 P_ReadINT16(save_t *p); +UINT32 P_ReadUINT32(save_t *p); +INT32 P_ReadINT32(save_t *p); +char P_ReadChar(save_t *p); +fixed_t P_ReadFixed(save_t *p); +angle_t P_ReadAngle(save_t *p); +void P_ReadStringN(save_t *p, char *s, size_t n); +void P_ReadStringL(save_t *p, char *s, size_t n); +void P_ReadString(save_t *p, char *s); +void P_ReadMem(save_t *p, void *s, size_t n); #endif From 0cf3ce91e963436fe18d39897773aab68e8e4897 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 7 Jul 2024 21:31:46 +0200 Subject: [PATCH 176/353] Fix compilation warning --- src/p_saveg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index b40d7cbdd..38af26fd6 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -790,10 +790,10 @@ static void P_NetUnArchivePlayers(save_t *save_p) players[i].charability = P_ReadUINT8(save_p); players[i].charability2 = P_ReadUINT8(save_p); players[i].charflags = P_ReadUINT32(save_p); - players[i].thokitem = (mobjtype_t)P_ReadUINT32(save_p); - players[i].spinitem = (mobjtype_t)P_ReadUINT32(save_p); - players[i].revitem = (mobjtype_t)P_ReadUINT32(save_p); - players[i].followitem = (mobjtype_t)P_ReadUINT32(save_p); + players[i].thokitem = P_ReadUINT32(save_p); + players[i].spinitem = P_ReadUINT32(save_p); + players[i].revitem = P_ReadUINT32(save_p); + players[i].followitem = P_ReadUINT32(save_p); players[i].actionspd = P_ReadFixed(save_p); players[i].mindash = P_ReadFixed(save_p); players[i].maxdash = P_ReadFixed(save_p); From eefcca6259e4ecac9738c70833a0623f547aabd1 Mon Sep 17 00:00:00 2001 From: kaldrum1 <116390251+kaldrum1@users.noreply.github.com> Date: Mon, 8 Jul 2024 15:27:42 -0700 Subject: [PATCH 177/353] adjust interpolation duration based on speed, allow anim_duration to be used as a lua override to hardcoded values --- src/hardware/hw_md2.c | 90 +++++++++++++++++++++++++++++++++++++++++-- src/p_mobj.c | 4 ++ 2 files changed, 91 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 2616d4085..fc8047c6c 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1193,6 +1193,90 @@ static void adjustTextureCoords(model_t *model, patch_t *patch) model->max_t = gpatch->max_t; } +static INT32 GetAnimDuration(mobj_t *mobj) //part of p_mobj's setplayermobjstate logic, used to make sure that anim durations are actually correct when the speed gets adjusted on players +{ + player_t *player = mobj->player; + INT32 tics = mobj->state->tics; + + if (!(mobj->frame & FF_ANIMATE) && mobj->anim_duration) //set manually by something through lua + return mobj->anim_duration; + + if (!player && mobj->type == MT_TAILSOVERLAY) //so tails overlays interpolate properly + player = mobj->tracer->player; + if (player) + { + if (player->panim == PA_EDGE && (player->charflags & SF_FASTEDGE)) + tics = 2; + else if (player->powers[pw_tailsfly] && (!(player->mo->eflags & MFE_UNDERWATER) || (mobj->type == MT_PLAYER))) //tailsoverlay does not get adjusted from these rules when underwater + { + if (player->fly1 > 0) + tics = 1; + else if (!(player->mo->eflags & MFE_UNDERWATER)) + tics = 2; + else + tics = 4; + } + else if (!(disableSpeedAdjust || player->charflags & SF_NOSPEEDADJUST)) + { + fixed_t speed;// = FixedDiv(player->speed, FixedMul(mobj->scale, player->mo->movefactor)); + if (player->panim == PA_FALL) + { + speed = FixedDiv(abs(mobj->momz), mobj->scale); + if (speed < 10<panim == PA_ABILITY2 && player->charability2 == CA2_SPINDASH) + { + fixed_t step = (player->maxdash - player->mindash)/4; + speed = (player->dashspeed - player->mindash); + if (speed > 3*step) + tics = 1; + else if (speed > step) + tics = 2; + else + tics = 3; + } + else + { + speed = FixedDiv(player->speed, FixedMul(mobj->scale, player->mo->movefactor)); + if (player->panim == PA_ROLL || player->panim == PA_JUMP) + { + if (speed > 16<charability == CA_FLOAT || player->charability == CA_SLOWFALL) && player->secondjump == 1) || player->powers[pw_super]) // Only if on the ground or superflying. + { + if (player->panim == PA_WALK) + { + if (speed > 12< 6<panim == PA_RUN) || (player->panim == PA_DASH)) + { + if (speed > 52<mobj->state->tics; + float durs = GetAnimDuration(spr->mobj); float tics = (float)spr->mobj->tics; const boolean papersprite = (R_ThingIsPaperSprite(spr->mobj) && !R_ThingIsFloorSprite(spr->mobj)); const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(spr->mobj)); @@ -1287,8 +1371,8 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) } // Apparently people don't like jump frames like that, so back it goes - //if (tics > durs) - //durs = tics; + if (tics > durs) + durs = tics; // Make linkdraw objects use their tracer's alpha value fixed_t newalpha = spr->mobj->alpha; diff --git a/src/p_mobj.c b/src/p_mobj.c index 1ec09ab85..92133c1dc 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -96,11 +96,15 @@ static void P_SetupStateAnimation(mobj_t *mobj, state_t *st) animlength = st->var1; if (!(st->frame & FF_ANIMATE)) + { + mobj->anim_duration = 0; return; + } if (animlength <= 0 || st->var2 == 0) { mobj->frame &= ~FF_ANIMATE; + mobj->anim_duration = 0; return; // Crash/stupidity prevention } From 147aa123f926ef03f6e3bc1f737d19b8a9e65508 Mon Sep 17 00:00:00 2001 From: kaldrum1 <116390251+kaldrum1@users.noreply.github.com> Date: Wed, 10 Jul 2024 21:14:11 -0700 Subject: [PATCH 178/353] fix crash when tails tails dont have a tails to be the tail of --- src/hardware/hw_md2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index fc8047c6c..88aa4f430 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1201,7 +1201,7 @@ static INT32 GetAnimDuration(mobj_t *mobj) //part of p_mobj's setplayermobjstate if (!(mobj->frame & FF_ANIMATE) && mobj->anim_duration) //set manually by something through lua return mobj->anim_duration; - if (!player && mobj->type == MT_TAILSOVERLAY) //so tails overlays interpolate properly + if (!player && mobj->type == MT_TAILSOVERLAY && mobj->tracer) //so tails overlays interpolate properly player = mobj->tracer->player; if (player) { @@ -1691,7 +1691,6 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf); } } - return true; } From 319610763e127bd689ef8bfadf589bb537ccae92 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 17 Jul 2024 23:22:56 -0300 Subject: [PATCH 179/353] Fix "Several patches used in Sol Sestancia 2 are broken" --- src/w_wad.c | 24 +++++++++++++++++++----- src/w_wad.h | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index cc7cdc201..97208296a 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1329,10 +1329,10 @@ UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlum /* SLADE is special and puts a single directory entry. Skip that. */ if (strlen(lump_p->fullname) == name_length) i++; - break; + return i; } } - return i; + return INT16_MAX; } // In a PK3 type of resource file, it looks for the next lumpinfo entry that doesn't share the specified pathfile. @@ -1350,6 +1350,17 @@ UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump) return i; } +// Returns 0 if the folder is not empty, 1 if it is empty, -1 if it doesn't exist +INT32 W_IsFolderEmpty(const char *name, UINT16 wad) +{ + UINT16 start = W_CheckNumForFolderStartPK3(name, wad, 0); + if (start == INT16_MAX) + return -1; + + // Unlike W_CheckNumForFolderStartPK3, W_CheckNumForFolderEndPK3 doesn't return INT16_MAX. + return W_CheckNumForFolderEndPK3(name, wad, start) <= start; +} + char *W_GetLumpFolderPathPK3(UINT16 wad, UINT16 lump) { const char *fullname = wadfiles[wad]->lumpinfo[lump].fullname; @@ -1692,7 +1703,7 @@ lumpnum_t W_GetNumForLongName(const char *name) // static UINT16 W_CheckNumForPatchNamePwad(const char *name, UINT16 wad, boolean longname) { - UINT16 i, start, end; + UINT16 i, start = INT16_MAX, end = INT16_MAX; static char uname[8 + 1] = { 0 }; UINT32 hash = 0; lumpinfo_t *lump_p; @@ -1714,8 +1725,11 @@ static UINT16 W_CheckNumForPatchNamePwad(const char *name, UINT16 wad, boolean l // TODO: cache namespace lump IDs if (W_FileHasFolders(wadfiles[wad])) { - start = W_CheckNumForFolderStartPK3("Flats/", wad, 0); - end = W_CheckNumForFolderEndPK3("Flats/", wad, start); + if (!W_IsFolderEmpty("Flats/", wad)) + { + start = W_CheckNumForFolderStartPK3("Flats/", wad, 0); + end = W_CheckNumForFolderEndPK3("Flats/", wad, start); + } } else { diff --git a/src/w_wad.h b/src/w_wad.h index 3dcb9b6e8..4fd7b2c00 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -180,6 +180,7 @@ UINT16 W_CheckNumForMarkerStartPwad(const char *name, UINT16 wad, UINT16 startlu UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump); UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump); UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump); +INT32 W_IsFolderEmpty(const char *name, UINT16 wad); char *W_GetLumpFolderPathPK3(UINT16 wad, UINT16 lump); char *W_GetLumpFolderNamePK3(UINT16 wad, UINT16 lump); From 522b354b4989863342e2f6794fdfc4d4d2500e4b Mon Sep 17 00:00:00 2001 From: Hanicef Date: Mon, 22 Jul 2024 18:00:52 +0200 Subject: [PATCH 180/353] Lift ban limits --- src/netcode/i_tcp.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/netcode/i_tcp.c b/src/netcode/i_tcp.c index 24dfd7ec2..046c13d09 100644 --- a/src/netcode/i_tcp.c +++ b/src/netcode/i_tcp.c @@ -37,6 +37,7 @@ #endif #include "../doomdef.h" +#include "../z_zone.h" #ifdef USE_WINSOCK1 #include @@ -120,8 +121,6 @@ typedef union static boolean UPNP_support = true; #endif // HAVE_MINIUPNC -#define MAXBANS 100 - #include "../i_system.h" #include "i_net.h" #include "d_net.h" @@ -169,8 +168,8 @@ 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]; +static mysockaddr_t *banned; +static UINT8 *bannedmask; static size_t numbans = 0; static boolean SOCK_bannednode[MAXNETNODES+1]; /// \note do we really need the +1? @@ -1253,9 +1252,9 @@ static boolean SOCK_Ban(INT32 node) { if (node > MAXNETNODES) return false; - if (numbans == MAXBANS) - return false; + banned = Z_Realloc(banned, sizeof(*banned) * (numbans+1), PU_STATIC, NULL); + bannedmask = Z_Realloc(bannedmask, sizeof(*bannedmask) * (numbans+1), PU_STATIC, NULL); M_Memcpy(&banned[numbans], &clientaddress[node], sizeof (mysockaddr_t)); if (banned[numbans].any.sa_family == AF_INET) { @@ -1278,7 +1277,7 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask) struct my_addrinfo *ai, *runp, hints; int gaie; - if (numbans == MAXBANS || !address) + if (!address) return false; memset(&hints, 0x00, sizeof(hints)); @@ -1293,8 +1292,10 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask) runp = ai; - while(runp != NULL && numbans != MAXBANS) + while(runp != NULL) { + banned = Z_Realloc(banned, sizeof(*banned) * (numbans+1), PU_STATIC, NULL); + bannedmask = Z_Realloc(bannedmask, sizeof(*bannedmask) * (numbans+1), PU_STATIC, NULL); memcpy(&banned[numbans], runp->ai_addr, runp->ai_addrlen); if (mask) @@ -1324,6 +1325,10 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask) static void SOCK_ClearBans(void) { numbans = 0; + Z_Free(banned); + banned = NULL; + Z_Free(bannedmask); + bannedmask = NULL; } boolean I_InitTcpNetwork(void) From a74fcf7c490ee2aab332f63368aaa8008061acd6 Mon Sep 17 00:00:00 2001 From: MIDIMan Date: Sat, 27 Jul 2024 22:37:12 -0400 Subject: [PATCH 181/353] Re-add player check(s) for MF_SPECIAL objects in PIT_DoCheckThing --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index b79f9d45c..c742e2e85 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1465,13 +1465,13 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) } // check for special pickup - if (thing->flags & MF_SPECIAL) + if (thing->flags & MF_SPECIAL && (tmthing->player || (tmthing->flags & MF_PUSHABLE))) // MF_PUSHABLE added for steam jets { P_TouchSpecialThing(thing, tmthing, true); // can remove thing return CHECKTHING_COLLIDE; } // check again for special pickup - if (tmthing->flags & MF_SPECIAL) + if (tmthing->flags & MF_SPECIAL && (thing->player || (thing->flags & MF_PUSHABLE))) // MF_PUSHABLE added for steam jets { P_TouchSpecialThing(tmthing, thing, true); // can remove thing return CHECKTHING_COLLIDE; From 8e337487eaa168afc053eaa07c3cd6f365df3174 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Fri, 2 Aug 2024 21:42:27 +0200 Subject: [PATCH 182/353] Fix players being unmuted after respawning --- src/g_game.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index 5d6954b9b..7d5c396dc 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2624,6 +2624,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) boolean spectator; boolean outofcoop; boolean removing; + boolean muted; INT16 bot; SINT8 pity; INT16 rings; @@ -2641,6 +2642,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) spectator = players[player].spectator; outofcoop = players[player].outofcoop; removing = players[player].removing; + muted = players[player].muted; pflags = (players[player].pflags & (PF_FLIPCAM|PF_ANALOGMODE|PF_DIRECTIONCHAR|PF_AUTOBRAKE|PF_TAGIT|PF_GAMETYPEOVER)); playerangleturn = players[player].angleturn; oldrelangleturn = players[player].oldrelangleturn; @@ -2718,6 +2720,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) p->spectator = spectator; p->outofcoop = outofcoop; p->removing = removing; + p->muted = muted; p->angleturn = playerangleturn; p->oldrelangleturn = oldrelangleturn; From ef58615f42cb76d116ae634204ffcacb6e38eba2 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Fri, 9 Aug 2024 22:24:00 +0200 Subject: [PATCH 183/353] Fix input panel overdrawing the scoreboard --- src/st_stuff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/st_stuff.c b/src/st_stuff.c index e088a448c..9f1fb6d88 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1042,6 +1042,9 @@ static void ST_drawInput(void) INT32 x = hudinfo[HUD_INPUT].x, y = hudinfo[HUD_INPUT].y; + if (hu_showscores) + return; + if (stplyr->powers[pw_carry] == CR_NIGHTSMODE) y += 8; else if (modeattacking || !LUA_HudEnabled(hud_lives)) From a9d7da600303499d0e41f1d8898d90464871d7bc Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 13 Aug 2024 14:43:24 +0200 Subject: [PATCH 184/353] Restore super transformation conditions --- src/lua_baselib.c | 3 +-- src/p_local.h | 2 +- src/p_user.c | 29 +++++++++-------------------- src/y_inter.c | 4 ++-- 4 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 304c866c9..2534c92ac 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1730,12 +1730,11 @@ static int lib_pResetCamera(lua_State *L) static int lib_pSuperReady(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); - boolean transform = (boolean)lua_opttrueboolean(L, 2); //HUDSAFE INLEVEL if (!player) return LUA_ErrInvalid(L, "player_t"); - lua_pushboolean(L, P_SuperReady(player, transform)); + lua_pushboolean(L, P_SuperReady(player)); return 1; } diff --git a/src/p_local.h b/src/p_local.h index 249c3cd4b..f2470f72d 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -203,7 +203,7 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet); void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius); void P_Earthquake(mobj_t *inflictor, mobj_t *source, fixed_t radius); boolean P_HomingAttack(mobj_t *source, mobj_t *enemy); /// \todo doesn't belong in p_user -boolean P_SuperReady(player_t *player, boolean transform); +boolean P_SuperReady(player_t *player); void P_DoJump(player_t *player, boolean soundandstate, boolean allowflip); void P_DoSpinDashDust(player_t *player); #define P_AnalogMove(player) (P_ControlStyle(player) == CS_LMAOGALOG) diff --git a/src/p_user.c b/src/p_user.c index 3ee13aca9..c5ff5aa72 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4438,27 +4438,21 @@ static void P_DoSuperStuff(player_t *player) // // Returns true if player is ready to transform or detransform // -boolean P_SuperReady(player_t *player, boolean transform) +boolean P_SuperReady(player_t *player) { - if (!transform && - (player->powers[pw_super] < TICRATE*3/2 - || !G_CoopGametype())) // No turning back in competitive! - return false; - else if (transform - && (player->powers[pw_super] - || !ALL7EMERALDS(emeralds) - || !(player->rings >= 50))) - return false; - if (player->mo + && (player->rings >= 50) + && ALL7EMERALDS(emeralds) + && (player->charflags & SF_SUPER) + && (player->pflags & PF_JUMPED) + && !player->powers[pw_super] + && !player->powers[pw_invulnerability] + && !(player->powers[pw_shield] & SH_NOSTACK) && !player->powers[pw_tailsfly] && !player->powers[pw_carry] - && (player->charflags & SF_SUPER) && !P_PlayerInPain(player) && !player->climbing && !(player->pflags & (PF_JUMPSTASIS|PF_THOKKED|PF_STARTDASH|PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY)) - && ((player->pflags & PF_JUMPED) || (P_IsObjectOnGround(player->mo) && (player->panim == PA_IDLE || player->panim == PA_EDGE - || player->panim == PA_WALK || player->panim == PA_RUN || (player->charflags & SF_DASHMODE && player->panim == PA_DASH)))) && !(maptol & TOL_NIGHTS)) return true; @@ -5318,8 +5312,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd, boolean spinshieldhac ; else if (cmd->buttons & BT_SPIN) { - if (spinshieldhack && !(player->pflags & PF_SPINDOWN) && P_SuperReady(player, true) - && !player->powers[pw_invulnerability] && !(player->powers[pw_shield] & SH_NOSTACK)) // These two checks are no longer in P_SuperReady + if (spinshieldhack && !(player->pflags & PF_SPINDOWN) && P_SuperReady(player)) { // If you're using two-button play, can turn Super and aren't already, // and you don't have a shield, then turn Super! @@ -8805,10 +8798,6 @@ void P_MovePlayer(player_t *player) // Transform into super if we can! if (P_SuperReady(player, true)) P_DoSuperTransformation(player, false); - - // Detransform from super if we can! - else if (P_SuperReady(player, false)) - P_DoSuperDetransformation(player); } } diff --git a/src/y_inter.c b/src/y_inter.c index 2add8645b..cbe71901d 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -579,9 +579,9 @@ void Y_IntermissionDrawer(void) { if (LUA_HudEnabled(hud_intermissiontitletext)) { - const char *ringtext = "\x82" "get 50 rings, then"; + const char *ringtext = "\x82" "50 rings, no shield"; const char *tut1text = "\x82" "press " "\x80" "shield"; - const char *tut2text = "\x82" "to transform"; + const char *tut2text = "\x82" "mid-" "\x80" "jump"; ttheight = 8; V_DrawLevelTitle(data.spec.passedx1 + xoffset1, ttheight, 0, data.spec.passed1); ttheight += V_LevelNameHeight(data.spec.passed3) + 2; From 417bd0b0001557a16b620f57ea9000f3328e4a06 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 24 Aug 2024 19:18:28 -0300 Subject: [PATCH 185/353] Fix #1258 --- src/g_game.c | 2 + src/st_stuff.c | 118 +++++++++++++++++++++++-------------------------- src/st_stuff.h | 2 +- 3 files changed, 58 insertions(+), 64 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 7d5c396dc..cc02f98e7 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1936,6 +1936,8 @@ void G_DoLoadLevel(boolean resetplayer) // void G_StartTitleCard(void) { + ST_stopTitleCard(); + // The title card has been disabled for this map. // Oh well. if (!G_IsTitleCardAvailable()) diff --git a/src/st_stuff.c b/src/st_stuff.c index 9f1fb6d88..b99f003da 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1258,6 +1258,8 @@ static void ST_drawInput(void) V_DrawThinString(x, y, hudinfo[HUD_INPUT].f|((leveltime & 4) ? V_YELLOWMAP : V_REDMAP), "BAD DEMO!!"); } +static boolean lt_active = false; + static patch_t *lt_patches[3]; static INT32 lt_scroll = 0; static INT32 lt_mom = 0; @@ -1306,6 +1308,7 @@ void ST_startTitleCard(void) ST_cacheLevelTitle(); // initialize HUD variables + lt_active = true; lt_ticker = lt_exitticker = lt_lasttic = 0; lt_endtime = 2*TICRATE + (10*NEWTICRATERATIO); lt_scroll = BASEVIDWIDTH * FRACUNIT; @@ -1314,21 +1317,11 @@ void ST_startTitleCard(void) } // -// What happens before drawing the title card. -// Which is just setting the HUD translucency. +// Stops the title card. // -void ST_preDrawTitleCard(void) +void ST_stopTitleCard(void) { - if (!G_IsTitleCardAvailable()) - return; - - if (lt_ticker >= (lt_endtime + TICRATE)) - return; - - if (!lt_exitticker) - st_translucency = 0; - else - st_translucency = max(0, min((INT32)lt_exitticker-4, cv_translucenthud.value)); + lt_active = false; } // @@ -1337,47 +1330,43 @@ void ST_preDrawTitleCard(void) // void ST_runTitleCard(void) { - boolean run = !(paused || P_AutoPause()); - - if (!G_IsTitleCardAvailable()) + if (!lt_active || ((paused || P_AutoPause()) && lt_ticker >= PRELEVELTIME)) return; - if (lt_ticker >= (lt_endtime + TICRATE)) - return; - - if (run || (lt_ticker < PRELEVELTIME)) + if (!lt_exitticker) { - // tick - lt_ticker++; - if (lt_ticker >= lt_endtime) - lt_exitticker++; - - // scroll to screen (level title) - if (!lt_exitticker) - { - if (abs(lt_scroll) > FRACUNIT) - lt_scroll -= (lt_scroll>>2); - else - lt_scroll = 0; - } - // scroll away from screen (level title) + if (abs(lt_scroll) > FRACUNIT) + lt_scroll -= (lt_scroll>>2); else + lt_scroll = 0; + + if (abs(lt_zigzag) > FRACUNIT) + lt_zigzag -= (lt_zigzag>>2); + else + lt_zigzag = 0; + } + else + { + lt_mom -= FRACUNIT*6; + + if (lt_scroll > -BASEVIDWIDTH * FRACUNIT * 2) { - lt_mom -= FRACUNIT*6; lt_scroll += lt_mom; } - // scroll to screen (zigzag) - if (!lt_exitticker) + if (lt_zigzag > -(lt_patches[1]->width)*FRACUNIT) { - if (abs(lt_zigzag) > FRACUNIT) - lt_zigzag -= (lt_zigzag>>2); - else - lt_zigzag = 0; - } - // scroll away from screen (zigzag) - else lt_zigzag += lt_mom; + } + } + + lt_ticker++; + lt_exitticker = max((signed)lt_ticker - (signed)lt_endtime, 0); + + if (lt_ticker >= (lt_endtime + TICRATE)) + { + lt_active = false; + return; } } @@ -1404,9 +1393,6 @@ void ST_drawTitleCard(void) colormap = R_GetTranslationColormap(TC_DEFAULT, colornum, GTC_CACHE); - if (!G_IsTitleCardAvailable()) - return; - if (!LUA_HudEnabled(hud_stagetitle)) goto luahook; @@ -1487,13 +1473,14 @@ void ST_preLevelTitleCardDrawer(void) // void ST_drawWipeTitleCard(void) { + if (!lt_active) + return; + stplyr = &players[consoleplayer]; - ST_preDrawTitleCard(); ST_drawTitleCard(); if (splitscreen) { stplyr = &players[secondarydisplayplayer]; - ST_preDrawTitleCard(); ST_drawTitleCard(); } } @@ -2704,24 +2691,14 @@ static boolean ST_doItemFinderIconsAndSound(void) return true; } +static boolean drawstagetitle = false; + // // Draw the status bar overlay, customisable: the user chooses which // kind of information to overlay // static void ST_overlayDrawer(void) { - // Decide whether to draw the stage title or not - boolean stagetitle = false; - - // Check for a valid level title - // If the HUD is enabled - // And, if Lua is running, if the HUD library has the stage title enabled - if (G_IsTitleCardAvailable() && *mapheaderinfo[gamemap-1]->lvlttl != '\0' && !(hu_showscores && (netgame || multiplayer))) - { - stagetitle = true; - ST_preDrawTitleCard(); - } - // hu_showscores = auto hide score/time/rings when tab rankings are shown if (!(hu_showscores && (netgame || multiplayer))) { @@ -2861,7 +2838,7 @@ static void ST_overlayDrawer(void) } // draw level title Tails - if (stagetitle && (!WipeInAction) && (!WipeStageTitle)) + if (drawstagetitle && !WipeInAction && !WipeStageTitle) ST_drawTitleCard(); if (!hu_showscores && (netgame || multiplayer) && LUA_HudEnabled(hud_textspectator)) @@ -2932,7 +2909,22 @@ void ST_Drawer(void) } } - st_translucency = cv_translucenthud.value; + // Decide whether to draw the stage title or not + if (lt_active) + { + drawstagetitle = !(hu_showscores && (netgame || multiplayer)); + + if (!lt_exitticker) + st_translucency = 0; + else + st_translucency = max(0, min((INT32)lt_exitticker-4, cv_translucenthud.value)); + } + else + { + st_translucency = cv_translucenthud.value; + + drawstagetitle = false; + } if (st_overlay) { diff --git a/src/st_stuff.h b/src/st_stuff.h index 6f6bac1fa..357930de0 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -49,9 +49,9 @@ void ST_doPaletteStuff(void); // title card void ST_startTitleCard(void); +void ST_stopTitleCard(void); void ST_runTitleCard(void); void ST_drawTitleCard(void); -void ST_preDrawTitleCard(void); void ST_preLevelTitleCardDrawer(void); void ST_drawWipeTitleCard(void); From 3c1736ebf8955e470c2e9f2c2fec59937a0f1ba0 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 24 Aug 2024 19:26:01 -0300 Subject: [PATCH 186/353] Fix #1277 --- src/deh_lua.c | 6 ++++++ src/dehacked.c | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/deh_lua.c b/src/deh_lua.c index 64fb52fc7..0a4d7d0a9 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -28,6 +28,12 @@ static inline int lib_freeslot(lua_State *L) if (!lua_lumploading) return luaL_error(L, "This function cannot be called from within a hook or coroutine!"); + if (!deh_loaded) + { + initfreeslots(); + deh_loaded = true; + } + while (n-- > 0) { s = Z_StrDup(luaL_checkstring(L,1)); diff --git a/src/dehacked.c b/src/dehacked.c index 2050a117f..63656753d 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -192,7 +192,10 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) INT32 i; if (!deh_loaded) + { initfreeslots(); + deh_loaded = true; + } deh_num_warning = 0; @@ -605,14 +608,10 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) if (deh_num_warning) { CONS_Printf(M_GetText("%d warning%s in the SOC lump\n"), deh_num_warning, deh_num_warning == 1 ? "" : "s"); - if (devparm) { + if (devparm) I_Error("%s%s",va(M_GetText("%d warning%s in the SOC lump\n"), deh_num_warning, deh_num_warning == 1 ? "" : "s"), M_GetText("See log.txt for details.\n")); - //while (!I_GetKey()) - //I_OsPolling(); - } } - deh_loaded = true; Z_Free(s); } From 7061c307445a3a5bf11ddd97ffaebd1c25a8d9aa Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 25 Aug 2024 12:24:03 +0200 Subject: [PATCH 187/353] Pass save_t to NetVar save/load function --- src/command.c | 68 +++++++++++++++++++++-------------------- src/command.h | 9 +++--- src/g_demo.c | 25 +++++++++++++-- src/netcode/gamestate.c | 1 + src/p_saveg.c | 8 ++--- 5 files changed, 65 insertions(+), 46 deletions(-) diff --git a/src/command.c b/src/command.c index e0156274e..25eb83d19 100644 --- a/src/command.c +++ b/src/command.c @@ -1722,8 +1722,7 @@ badinput: static boolean serverloading = false; -static consvar_t * -ReadNetVar (UINT8 **p, char **return_value, boolean *return_stealth) +static consvar_t *ReadNetVar(save_t *p, char **return_value, boolean *return_stealth) { UINT16 netid; char *val; @@ -1731,10 +1730,10 @@ ReadNetVar (UINT8 **p, char **return_value, boolean *return_stealth) consvar_t *cvar; - netid = READUINT16 (*p); - val = (char *)*p; - SKIPSTRING (*p); - stealth = READUINT8 (*p); + netid = P_ReadUINT16(p); + val = (char *)&p->buf[p->pos]; + P_SkipString(p); + stealth = P_ReadUINT8(p); cvar = CV_FindNetVar(netid); @@ -1752,8 +1751,7 @@ ReadNetVar (UINT8 **p, char **return_value, boolean *return_stealth) } #ifdef OLD22DEMOCOMPAT -static consvar_t * -ReadOldDemoVar (UINT8 **p, char **return_value, boolean *return_stealth) +static consvar_t *ReadOldDemoVar(save_t *p, char **return_value, boolean *return_stealth) { UINT16 id; char *val; @@ -1761,10 +1759,10 @@ ReadOldDemoVar (UINT8 **p, char **return_value, boolean *return_stealth) old_demo_var_t *demovar; - id = READUINT16 (*p); - val = (char *)*p; - SKIPSTRING (*p); - stealth = READUINT8 (*p); + id = P_ReadUINT16(p); + val = (char *)&p->buf[p->pos]; + P_SkipString(p); + stealth = P_ReadUINT8(p); demovar = CV_FindOldDemoVar(id); @@ -1783,8 +1781,7 @@ ReadOldDemoVar (UINT8 **p, char **return_value, boolean *return_stealth) } #endif/*OLD22DEMOCOMPAT*/ -static consvar_t * -ReadDemoVar (UINT8 **p, char **return_value, boolean *return_stealth) +static consvar_t *ReadDemoVar(save_t *p, char **return_value, boolean *return_stealth) { char *name; char *val; @@ -1792,11 +1789,11 @@ ReadDemoVar (UINT8 **p, char **return_value, boolean *return_stealth) consvar_t *cvar; - name = (char *)*p; - SKIPSTRING (*p); - val = (char *)*p; - SKIPSTRING (*p); - stealth = READUINT8 (*p); + name = (char *)&p->buf[p->pos]; + P_SkipString(p); + val = (char *)&p->buf[p->pos]; + P_SkipString(p); + stealth = P_ReadUINT8(p); cvar = CV_FindVar(name); @@ -1826,41 +1823,46 @@ static void Got_NetVar(UINT8 **p, INT32 playernum) return; } - cvar = ReadNetVar(p, &svalue, &stealth); + save_t save_p; + save_p.buf = *p; + save_p.size = MAXTEXTCMD; + save_p.pos = 0; + cvar = ReadNetVar(&save_p, &svalue, &stealth); + *p = &save_p.buf[save_p.pos]; if (cvar) Setvalue(cvar, svalue, stealth); } -void CV_SaveVars(UINT8 **p, boolean in_demo) +void CV_SaveVars(save_t *p, boolean in_demo) { consvar_t *cvar; - UINT8 *count_p = *p; + UINT8 *count_p = &p->buf[p->pos]; UINT16 count = 0; // send only changed cvars ... // the client will reset all netvars to default before loading - WRITEUINT16(*p, 0x0000); + P_WriteUINT16(p, 0x0000); for (cvar = consvar_vars; cvar; cvar = cvar->next) if ((cvar->flags & CV_NETVAR) && !CV_IsSetToDefault(cvar)) { if (in_demo) { - WRITESTRING(*p, cvar->name); + P_WriteString(p, cvar->name); } else { - WRITEUINT16(*p, cvar->netid); + P_WriteUINT16(p, cvar->netid); } - WRITESTRING(*p, cvar->string); - WRITEUINT8(*p, false); + P_WriteString(p, cvar->string); + P_WriteUINT8(p, false); ++count; } WRITEUINT16(count_p, count); } -static void CV_LoadVars(UINT8 **p, - consvar_t *(*got)(UINT8 **p, char **ret_value, boolean *ret_stealth)) +static void CV_LoadVars(save_t *p, + consvar_t *(*got)(save_t *p, char **ret_value, boolean *ret_stealth)) { const boolean store = (client || demoplayback); @@ -1888,7 +1890,7 @@ static void CV_LoadVars(UINT8 **p, } } - count = READUINT16(*p); + count = P_ReadUINT16(p); while (count--) { cvar = (*got)(p, &val, &stealth); @@ -1921,19 +1923,19 @@ void CV_RevertNetVars(void) } } -void CV_LoadNetVars(UINT8 **p) +void CV_LoadNetVars(save_t *p) { CV_LoadVars(p, ReadNetVar); } #ifdef OLD22DEMOCOMPAT -void CV_LoadOldDemoVars(UINT8 **p) +void CV_LoadOldDemoVars(save_t *p) { CV_LoadVars(p, ReadOldDemoVar); } #endif -void CV_LoadDemoVars(UINT8 **p) +void CV_LoadDemoVars(save_t *p) { CV_LoadVars(p, ReadDemoVar); } diff --git a/src/command.h b/src/command.h index f0dc62418..368c2fb3f 100644 --- a/src/command.h +++ b/src/command.h @@ -15,6 +15,7 @@ #include #include "doomdef.h" +#include "p_saveg.h" //=================================== // Command buffer & command execution @@ -218,19 +219,19 @@ void CV_AddValue(consvar_t *var, INT32 increment); void CV_SaveVariables(FILE *f); // load/save gamesate (load and save option and for network join in game) -void CV_SaveVars(UINT8 **p, boolean in_demo); +void CV_SaveVars(save_t *p, boolean in_demo); #define CV_SaveNetVars(p) CV_SaveVars(p, false) -void CV_LoadNetVars(UINT8 **p); +void CV_LoadNetVars(save_t *p); // then revert after leaving a netgame void CV_RevertNetVars(void); #define CV_SaveDemoVars(p) CV_SaveVars(p, true) -void CV_LoadDemoVars(UINT8 **p); +void CV_LoadDemoVars(save_t *p); #ifdef OLD22DEMOCOMPAT -void CV_LoadOldDemoVars(UINT8 **p); +void CV_LoadOldDemoVars(save_t *p); #endif // reset cheat netvars after cheats is deactivated diff --git a/src/g_demo.c b/src/g_demo.c index cfa34fc7e..77f8f7b0d 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -1454,6 +1454,7 @@ void G_BeginRecording(void) char *filename; UINT16 totalfiles; UINT8 *m; + save_t savebuffer; if (demo_p) return; @@ -1603,7 +1604,11 @@ void G_BeginRecording(void) } // Save netvar data - CV_SaveDemoVars(&demo_p); + savebuffer.buf = demo_p; + savebuffer.size = demoend - demo_p; + savebuffer.pos = 0; + CV_SaveDemoVars(&savebuffer); + demo_p = &savebuffer.buf[savebuffer.pos]; memset(&oldcmd,0,sizeof(oldcmd)); memset(&oldghost,0,sizeof(oldghost)); @@ -2236,10 +2241,24 @@ void G_DoPlayDemo(char *defdemoname) // net var data #ifdef OLD22DEMOCOMPAT if (demoversion < 0x000d) - CV_LoadOldDemoVars(&demo_p); + { + save_t savebuffer; + savebuffer.buf = demo_p; + savebuffer.size = demoend - demo_p; + savebuffer.pos = 0; + CV_LoadOldDemoVars(&savebuffer); + demo_p = &savebuffer.buf[savebuffer.pos]; + } else #endif - CV_LoadDemoVars(&demo_p); + { + save_t savebuffer; + savebuffer.buf = demo_p; + savebuffer.size = demoend - demo_p; + savebuffer.pos = 0; + CV_LoadDemoVars(&savebuffer); + demo_p = &savebuffer.buf[savebuffer.pos]; + } // Sigh ... it's an empty demo. if (*demo_p == DEMOMARKER) diff --git a/src/netcode/gamestate.c b/src/netcode/gamestate.c index fbc2b4ca7..d38555245 100644 --- a/src/netcode/gamestate.c +++ b/src/netcode/gamestate.c @@ -80,6 +80,7 @@ void SV_SendSaveGame(INT32 node, boolean resending) if (!compressedsave) { CONS_Alert(CONS_ERROR, M_GetText("No more free memory for savegame\n")); + free(savebuffer.buf); return; } diff --git a/src/p_saveg.c b/src/p_saveg.c index 38af26fd6..95e729c66 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -5356,9 +5356,7 @@ void P_SaveNetGame(save_t *save_p, boolean resending) mobj_t *mobj; INT32 i = 1; // don't start from 0, it'd be confused with a blank pointer otherwise - UINT8 *p = &save_p->buf[save_p->pos]; - CV_SaveNetVars(&p); - save_p->pos = p - save_p->buf; + CV_SaveNetVars(save_p); P_NetArchiveMisc(save_p, resending); P_NetArchiveEmblems(save_p); @@ -5411,9 +5409,7 @@ boolean P_LoadGame(save_t *save_p, INT16 mapoverride) boolean P_LoadNetGame(save_t *save_p, boolean reloading) { - UINT8 *p = &save_p->buf[save_p->pos]; - CV_LoadNetVars(&p); - save_p->pos = p - save_p->buf; + CV_LoadNetVars(save_p); if (!P_NetUnArchiveMisc(save_p, reloading)) return false; P_NetUnArchiveEmblems(save_p); From 5c4b9bf8c75a813f7098fb35fc80dd776e708bd0 Mon Sep 17 00:00:00 2001 From: spherallic Date: Sun, 25 Aug 2024 21:59:52 +0200 Subject: [PATCH 188/353] Fix build error --- 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 c5ff5aa72..acd8a6f63 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8796,7 +8796,7 @@ void P_MovePlayer(player_t *player) if ((cmd->buttons & BT_SHIELD) && !(player->pflags & PF_SHIELDDOWN) && !spinshieldhack) { // Transform into super if we can! - if (P_SuperReady(player, true)) + if (P_SuperReady(player)) P_DoSuperTransformation(player, false); } } From b22a258e3aadb86b132bd115df2bc018380afb4f Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 29 Aug 2024 15:40:53 +0200 Subject: [PATCH 189/353] Use FF_SEMIBRIGHT for some more common objects --- src/info.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/info.c b/src/info.c index d66c24af8..b463c1790 100644 --- a/src/info.c +++ b/src/info.c @@ -1784,8 +1784,8 @@ state_t states[NUMSTATES] = {SPR_RING, FF_ANIMATE|FF_GLOBALANIM, -1, {NULL}, 23, 1, S_RING, 0}, // S_RING // Blue Sphere for special stages - {SPR_SPHR, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BLUESPHERE - {SPR_SPHR, FF_FULLBRIGHT + {SPR_SPHR, FF_SEMIBRIGHT, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BLUESPHERE + {SPR_SPHR, FF_SEMIBRIGHT #ifdef MANIASPHERES |FF_ANIMATE|FF_RANDOMANIM #endif @@ -1794,13 +1794,13 @@ state_t states[NUMSTATES] = // Bomb Sphere {SPR_SPHR, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_BOMBSPHERE2, 0}, // S_BOMBSPHERE1 - {SPR_SPHR, FF_FULLBRIGHT|4, 1, {NULL}, 0, 0, S_BOMBSPHERE3, 0}, // S_BOMBSPHERE2 - {SPR_SPHR, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_BOMBSPHERE4, 0}, // S_BOMBSPHERE3 - {SPR_SPHR, FF_FULLBRIGHT|4, 1, {NULL}, 0, 0, S_BOMBSPHERE1, 0}, // S_BOMBSPHERE4 + {SPR_SPHR, FF_SEMIBRIGHT|4, 1, {NULL}, 0, 0, S_BOMBSPHERE3, 0}, // S_BOMBSPHERE2 + {SPR_SPHR, FF_SEMIBRIGHT|5, 2, {NULL}, 0, 0, S_BOMBSPHERE4, 0}, // S_BOMBSPHERE3 + {SPR_SPHR, FF_SEMIBRIGHT|4, 1, {NULL}, 0, 0, S_BOMBSPHERE1, 0}, // S_BOMBSPHERE4 // NiGHTS Chip - {SPR_NCHP, FF_FULLBRIGHT|FF_ANIMATE, -1, {NULL}, 15, 2, S_NULL, 0}, // S_NIGHTSCHIP - {SPR_NCHP, FF_FULLBRIGHT|FF_ANIMATE|16, -1, {NULL}, 15, 2, S_NULL, 0}, // S_NIGHTSCHIPBONUS + {SPR_NCHP, FF_SEMIBRIGHT|FF_ANIMATE, -1, {NULL}, 15, 2, S_NULL, 0}, // S_NIGHTSCHIP + {SPR_NCHP, FF_SEMIBRIGHT|FF_ANIMATE|16, -1, {NULL}, 15, 2, S_NULL, 0}, // S_NIGHTSCHIPBONUS // NiGHTS Star {SPR_NSTR, FF_ANIMATE, -1, {NULL}, 14, 2, S_NULL, 0}, // S_NIGHTSSTAR @@ -1858,9 +1858,9 @@ state_t states[NUMSTATES] = {SPR_CEMG, FF_FULLBRIGHT|6, -1, {NULL}, 0, 0, S_NULL, 0}, // S_CEMG7 // Emerald hunt shards - {SPR_SHRD, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD1 - {SPR_SHRD, 1, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD2 - {SPR_SHRD, 2, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD3 + {SPR_SHRD, FF_SEMIBRIGHT, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD1 + {SPR_SHRD, FF_SEMIBRIGHT|1, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD2 + {SPR_SHRD, FF_SEMIBRIGHT|2, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD3 // Bubble Source {SPR_BBLS, 0, 8, {A_BubbleSpawn}, 2048, 0, S_BUBBLES2, 0}, // S_BUBBLES1 From 9b5b2d31f0c94d6a731437c6d6a8dba3953f06d8 Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 3 Sep 2024 23:57:16 +0200 Subject: [PATCH 190/353] Disable UDMF console notice --- 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 b5ed485d8..9a3c96790 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2995,7 +2995,7 @@ static void P_LoadTextmap(void) side_t *sd; mapthing_t *mt; - CONS_Alert(CONS_NOTICE, "UDMF support is still a work-in-progress; its specs and features are prone to change until it is fully implemented.\n"); + //CONS_Alert(CONS_NOTICE, "UDMF support is still a work-in-progress; its specs and features are prone to change until it is fully implemented.\n"); /// Given the UDMF specs, some fields are given a default value. /// If an element's field has a default value set, it is omitted From f54eab54f33fe1afb582f6cbc38eddd318f2a1f4 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Thu, 5 Sep 2024 20:24:37 +0200 Subject: [PATCH 191/353] Fix mirrored long sprite rotations not working in Software --- src/r_things.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.c b/src/r_things.c index b32181670..36c35fde8 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -379,7 +379,7 @@ static void MirrorMissingRotations(void) UINT8 baserotation = GetOppositeRotation(rotation, frame->rotate); UINT32 lumpnum = frame->lumppat[baserotation - 1]; - R_InstallSpriteLump(WADFILENUM(lumpnum), LUMPNUM(lumpnum), frame->lumpid[baserotation], framenum, rotation, 1); + R_InstallSpriteLump(WADFILENUM(lumpnum), LUMPNUM(lumpnum), frame->lumpid[baserotation - 1], framenum, rotation, 1); } } } From 53db028bdb9041b9753dcabe9ecc9e97d2f4f5d9 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Fri, 6 Sep 2024 12:21:34 +0200 Subject: [PATCH 192/353] Synchronize rate limit variables and limit PlayerMsg hook --- src/hu_stuff.c | 10 ++++------ src/hu_stuff.h | 3 +++ src/p_saveg.c | 13 +++++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index caf13a445..a7d0aea74 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -587,8 +587,8 @@ static void Command_CSay_f(void) DoSayCommand(0, 1, HU_CSAY); } -static tic_t spam_tokens[MAXPLAYERS] = { 1 }; // fill the buffer with 1 so the motd can be sent. -static tic_t spam_tics[MAXPLAYERS]; +UINT8 spam_tokens[MAXPLAYERS] = { 1 }; // fill the buffer with 1 so the motd can be sent. +tic_t spam_tics[MAXPLAYERS]; /** Receives a message, processing an ::XD_SAY command. * \sa DoSayCommand @@ -649,14 +649,12 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) else spam_tokens[playernum] -= 1; - // run the lua hook even if we were supposed to eat the msg, netgame consistency goes first. + if (spam_eatmsg) + return; // don't proceed if we were supposed to eat the message. if (LUA_HookPlayerMsg(playernum, target, flags, msg)) return; - if (spam_eatmsg) - return; // don't proceed if we were supposed to eat the message. - // If it's a CSAY, just CECHO and be done with it. if (flags & HU_CSAY) { diff --git a/src/hu_stuff.h b/src/hu_stuff.h index ca77ed930..07881ce1a 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -79,6 +79,9 @@ void HU_AddChatText(const char *text, boolean playsound); // set true when entering a chat message extern boolean chat_on; +extern UINT8 spam_tokens[MAXPLAYERS]; +extern tic_t spam_tics[MAXPLAYERS]; + extern patch_t *emeraldpics[3][8]; extern patch_t *rflagico; extern patch_t *bflagico; diff --git a/src/p_saveg.c b/src/p_saveg.c index da73dd8a0..c5ec57d01 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -35,6 +35,7 @@ #include "p_polyobj.h" #include "lua_script.h" #include "p_slopes.h" +#include "hu_stuff.h" savedata_t savedata; UINT8 *save_p; @@ -4611,6 +4612,12 @@ static void P_NetArchiveMisc(boolean resending) WRITEUINT8(save_p, 0x2f); else WRITEUINT8(save_p, 0x2e); + + for (i = 0; i < MAXPLAYERS; i++) + { + WRITEUINT8(save_p, spam_tokens[i]); + WRITEUINT32(save_p, spam_tics[i]); + } } static inline boolean P_NetUnArchiveMisc(boolean reloading) @@ -4708,6 +4715,12 @@ static inline boolean P_NetUnArchiveMisc(boolean reloading) if (READUINT8(save_p) == 0x2f) paused = true; + for (i = 0; i < MAXPLAYERS; i++) + { + spam_tokens[i] = READUINT8(save_p); + spam_tics[i] = READUINT32(save_p); + } + return true; } From cfb3b45ae4d8031a8c4a03cb7ebdd1fd476ad134 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Fri, 6 Sep 2024 15:50:09 +0200 Subject: [PATCH 193/353] Refactor dedicated idling a little --- src/netcode/d_clisrv.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/netcode/d_clisrv.c b/src/netcode/d_clisrv.c index 5fee506af..dd4a25be2 100644 --- a/src/netcode/d_clisrv.c +++ b/src/netcode/d_clisrv.c @@ -1500,18 +1500,15 @@ void NetUpdate(void) { INT32 i; - for (i = 1; i < MAXNETNODES; ++i) + boolean empty = true; + for (i = 1; i < MAXNETNODES; i++) if (netnodes[i].ingame) { - if (dedicatedidle >= dedicatedidletime) - { - CONS_Printf("DEDICATED: Awakening from idle (Node %d detected...)\n", i); - dedicatedidle = 0; - } + empty = false; break; } - if (i == MAXNETNODES) + if (empty) { if (leveltime == 2) { @@ -1541,6 +1538,14 @@ void NetUpdate(void) dedicatedidle = dedicatedidletime; } } + else + { + if (dedicatedidle >= dedicatedidletime) + { + CONS_Printf("DEDICATED: Awakening from idle (Node detected...)\n"); + dedicatedidle = 0; + } + } } else { From ba8b1e084879cfd57894a4c1dd6b8f6ce5b55d3f Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Fri, 6 Sep 2024 15:51:57 +0200 Subject: [PATCH 194/353] Fix dedicated idling ignoring disconnected players --- src/netcode/d_clisrv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/netcode/d_clisrv.c b/src/netcode/d_clisrv.c index dd4a25be2..d9b26e851 100644 --- a/src/netcode/d_clisrv.c +++ b/src/netcode/d_clisrv.c @@ -1501,8 +1501,8 @@ void NetUpdate(void) INT32 i; boolean empty = true; - for (i = 1; i < MAXNETNODES; i++) - if (netnodes[i].ingame) + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i]) { empty = false; break; @@ -1542,7 +1542,7 @@ void NetUpdate(void) { if (dedicatedidle >= dedicatedidletime) { - CONS_Printf("DEDICATED: Awakening from idle (Node detected...)\n"); + CONS_Printf("DEDICATED: Awakening from idle (Player detected...)\n"); dedicatedidle = 0; } } From c69df42f6c3c35ede3b644b18506469c1eb00929 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Fri, 6 Sep 2024 15:53:53 +0200 Subject: [PATCH 195/353] Fix dedicated idle timer not resetting when toggled --- src/netcode/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/netcode/d_clisrv.c b/src/netcode/d_clisrv.c index d9b26e851..16405b982 100644 --- a/src/netcode/d_clisrv.c +++ b/src/netcode/d_clisrv.c @@ -1543,8 +1543,8 @@ void NetUpdate(void) if (dedicatedidle >= dedicatedidletime) { CONS_Printf("DEDICATED: Awakening from idle (Player detected...)\n"); - dedicatedidle = 0; } + dedicatedidle = 0; } } else From c09ec5933dbb79c8df5756aeaca332d944988507 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Fri, 6 Sep 2024 16:09:30 +0200 Subject: [PATCH 196/353] Cleanup --- src/netcode/d_clisrv.c | 146 ++++++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 68 deletions(-) diff --git a/src/netcode/d_clisrv.c b/src/netcode/d_clisrv.c index 16405b982..99d1b4728 100644 --- a/src/netcode/d_clisrv.c +++ b/src/netcode/d_clisrv.c @@ -1414,6 +1414,83 @@ static void IdleUpdate(void) } } +static void DedicatedIdleUpdate(INT32 *realtics) +{ + const tic_t dedicatedidletime = cv_dedicatedidletime.value * TICRATE; + static tic_t dedicatedidletimeprev = 0; + static tic_t dedicatedidle = 0; + + if (!server || !dedicated || gamestate != GS_LEVEL) + return; + + if (dedicatedidletime > 0) + { + INT32 i; + + boolean empty = true; + for (i = 0; i < MAXPLAYERS; i++) + if (playeringame[i]) + { + empty = false; + break; + } + + if (empty) + { + if (leveltime == 2) + { + // On next tick... + dedicatedidle = dedicatedidletime - 1; + } + else if (dedicatedidle >= dedicatedidletime) + { + if (D_GetExistingTextcmd(gametic, 0) || D_GetExistingTextcmd(gametic + 1, 0)) + { + CONS_Printf("DEDICATED: Awakening from idle (Netxcmd detected...)\n"); + dedicatedidle = 0; + } + else + { + (*realtics) = 0; + } + } + else + { + dedicatedidle += (*realtics); + + if (dedicatedidle >= dedicatedidletime) + { + const char *idlereason = "at round start"; + if (leveltime > 3) + idlereason = va("for %d seconds", dedicatedidle/TICRATE); + + CONS_Printf("DEDICATED: No nodes %s, idling...\n", idlereason); + (*realtics) = 0; + dedicatedidle = dedicatedidletime; + } + } + } + else + { + if (dedicatedidle >= dedicatedidletime) + { + CONS_Printf("DEDICATED: Awakening from idle (Player detected...)\n"); + } + dedicatedidle = 0; + } + } + else + { + if (dedicatedidletimeprev > 0 && dedicatedidle >= dedicatedidletimeprev) + { + CONS_Printf("DEDICATED: Awakening from idle (Idle disabled...)\n"); + } + dedicatedidle = 0; + } + + dedicatedidletimeprev = dedicatedidletime; +} + // Handle timeouts to prevent definitive freezes from happenning static void HandleNodeTimeouts(void) { @@ -1490,74 +1567,7 @@ void NetUpdate(void) realtics = 5; } - if (server && dedicated && gamestate == GS_LEVEL) - { - const tic_t dedicatedidletime = cv_dedicatedidletime.value * TICRATE; - static tic_t dedicatedidletimeprev = 0; - static tic_t dedicatedidle = 0; - - if (dedicatedidletime > 0) - { - INT32 i; - - boolean empty = true; - for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i]) - { - empty = false; - break; - } - - if (empty) - { - if (leveltime == 2) - { - // On next tick... - dedicatedidle = dedicatedidletime-1; - } - else if (dedicatedidle >= dedicatedidletime) - { - if (D_GetExistingTextcmd(gametic, 0) || D_GetExistingTextcmd(gametic+1, 0)) - { - CONS_Printf("DEDICATED: Awakening from idle (Netxcmd detected...)\n"); - dedicatedidle = 0; - } - else - { - realtics = 0; - } - } - else if ((dedicatedidle += realtics) >= dedicatedidletime) - { - const char *idlereason = "at round start"; - if (leveltime > 3) - idlereason = va("for %d seconds", dedicatedidle/TICRATE); - - CONS_Printf("DEDICATED: No nodes %s, idling...\n", idlereason); - realtics = 0; - dedicatedidle = dedicatedidletime; - } - } - else - { - if (dedicatedidle >= dedicatedidletime) - { - CONS_Printf("DEDICATED: Awakening from idle (Player detected...)\n"); - } - dedicatedidle = 0; - } - } - else - { - if (dedicatedidletimeprev > 0 && dedicatedidle >= dedicatedidletimeprev) - { - CONS_Printf("DEDICATED: Awakening from idle (Idle disabled...)\n"); - } - dedicatedidle = 0; - } - - dedicatedidletimeprev = dedicatedidletime; - } + DedicatedIdleUpdate(&realtics); gametime = nowtime; From 46309370f07aebf59c93c4f88d16d76cdcc803de Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Fri, 6 Sep 2024 16:17:15 +0200 Subject: [PATCH 197/353] Say "players" instead of "nodes" --- src/netcode/d_clisrv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/netcode/d_clisrv.c b/src/netcode/d_clisrv.c index 99d1b4728..d34dbc4e0 100644 --- a/src/netcode/d_clisrv.c +++ b/src/netcode/d_clisrv.c @@ -1462,9 +1462,9 @@ static void DedicatedIdleUpdate(INT32 *realtics) { const char *idlereason = "at round start"; if (leveltime > 3) - idlereason = va("for %d seconds", dedicatedidle/TICRATE); + idlereason = va("for %d seconds", dedicatedidle / TICRATE); - CONS_Printf("DEDICATED: No nodes %s, idling...\n", idlereason); + CONS_Printf("DEDICATED: No players %s, idling...\n", idlereason); (*realtics) = 0; dedicatedidle = dedicatedidletime; } From 70383c24aaa80e7ba16005c75f61350742f9f661 Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 12 Sep 2024 19:18:40 +0200 Subject: [PATCH 198/353] Fix -opengl parameter crash --- src/hardware/hw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 599c39132..c14509c8a 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5521,7 +5521,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) // Can't have palette rendering if shaders are disabled. boolean HWR_ShouldUsePaletteRendering(void) { - return (cv_glpaletterendering.value && HWR_UseShader()); + return (pMasterPalette != NULL && cv_glpaletterendering.value && HWR_UseShader()); } // enable or disable palette rendering state depending on settings and availability From 8d49d5612a7d9e8ed46c6272b210f008c7b95994 Mon Sep 17 00:00:00 2001 From: pastel Date: Thu, 12 Sep 2024 18:03:32 +0000 Subject: [PATCH 199/353] update my username --- src/f_finale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index 810af4e82..c6c2f1fd1 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1065,12 +1065,12 @@ static const char *credits[] = { "Julio \"Chaos Zero 64\" Guir", "\"Hanicef\"", "\"Hannu_Hanhi\"", // For many OpenGL performance improvements! + "\"hazepastel\"", "Kepa \"Nev3r\" Iceta", "Thomas \"Shadow Hog\" Igoe", "Iestyn \"Monster Iestyn\" Jealous", "\"Kaito Sinclaire\"", "\"Kalaron\"", // Coded some of Sryder13's collection of OpenGL fixes, especially fog - "\"katsy\"", "Ronald \"Furyhunter\" Kinard", // The SDL2 port "\"Lat'\"", // SRB2-CHAT, the chat window from Kart "\"LZA\"", From 947fa0ca5c153af9ee8932be76a0938166591be5 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Fri, 13 Sep 2024 18:40:17 +0200 Subject: [PATCH 200/353] Deprecate performance-sensitive type-agnostic mobj hooks --- src/lua_hooklib.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 54381e4ae..14781986e 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -498,6 +498,22 @@ static int call_string_hooks(Hook_State *hook) static int call_mobj_type_hooks(Hook_State *hook, mobjtype_t mobj_type) { + if (mobj_type == MT_NULL && ( + hook->hook_type == MOBJ_HOOK(MobjThinker ) + || hook->hook_type == MOBJ_HOOK(MobjCollide ) + || hook->hook_type == MOBJ_HOOK(MobjLineCollide) + || hook->hook_type == MOBJ_HOOK(MobjMoveCollide) + || hook->hook_type == MOBJ_HOOK(MobjFuse ) + || hook->hook_type == MOBJ_HOOK(MobjThinker ) + || hook->hook_type == MOBJ_HOOK(BossThinker ) + || hook->hook_type == MOBJ_HOOK(MobjMoveBlocked) + || hook->hook_type == MOBJ_HOOK(FollowMobj ) + )) + LUA_UsageWarning(L, va( + "%s hooks not attached to a specific mobj type are deprecated and will be removed.", + mobjHookNames[hook->hook_type]) + ); + return call_mapped(hook, &mobjHookIds[mobj_type][hook->hook_type]); } @@ -751,7 +767,7 @@ static void hook_think_frame(int type) PS_SetThinkFrameHookInfo(hook_index, time_taken, ar.short_src); else if (type == 6) PS_SetPostThinkFrameHookInfo(hook_index, time_taken, ar.short_src); - + hook_index++; } } From 60852cab0e2a6bec29a2aa8e430bdc4d336dfd58 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Tue, 17 Sep 2024 21:15:54 +0200 Subject: [PATCH 201/353] Fix command prompt issues on dedicated build on Windows --- src/dedicated/i_system.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 1a1db8fb3..e5e6aa2cd 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -999,20 +999,8 @@ static void I_GetConsoleEvents(void) static void I_StartupConsole(void) { HANDLE ci, co; - const INT32 ded = M_CheckParm("-dedicated"); - BOOL gotConsole = FALSE; - if (M_CheckParm("-console") || ded) - gotConsole = AllocConsole(); -#ifdef _DEBUG - else if (M_CheckParm("-noconsole") && !ded) -#else - else if (!M_CheckParm("-console") && !ded) -#endif - { - FreeConsole(); - gotConsole = FALSE; - } - + BOOL gotConsole = AllocConsole(); + consolevent = !M_CheckParm("-noconsole"); if (gotConsole) { SetConsoleTitleA("SRB2 Console"); @@ -1040,12 +1028,7 @@ static inline void I_ShutdownConsole(void){} static void I_GetConsoleEvents(void){} static inline void I_StartupConsole(void) { -#ifdef _DEBUG consolevent = !M_CheckParm("-noconsole"); -#else - consolevent = M_CheckParm("-console"); -#endif - framebuffer = M_CheckParm("-framebuffer"); if (framebuffer) From 77ab7e166eeacce7d60c5a3132e5be30fb7762a2 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Thu, 19 Sep 2024 20:48:47 +0200 Subject: [PATCH 202/353] Fix L/R frames not being automatically mirrored --- src/r_things.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_things.c b/src/r_things.c index 36c35fde8..917e4e8b4 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -367,7 +367,7 @@ static void MirrorMissingRotations(void) { spriteframe_t *frame = &sprtemp[framenum]; - if (frame->rotate == SRF_NONE || !(frame->rotate & SRF_3DMASK)) + if (frame->rotate == SRF_NONE || !(frame->rotate & (SRF_3DMASK | SRF_2D))) continue; UINT8 numrotations = frame->rotate == SRF_3D ? 8 : 16; @@ -2198,7 +2198,7 @@ static void R_ProjectSprite(mobj_t *thing) } else trans = 0; - + if ((oldthing->flags2 & MF2_LINKDRAW) && oldthing->tracer) trans = R_GetThingTransTable(oldthing->tracer->alpha, trans); else From 1076e0328b6e156d6f99e80be2289a568e1cf327 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 21 Sep 2024 20:12:56 -0300 Subject: [PATCH 203/353] Updated copyrights to 2024 --- assets/README.txt | 2 +- assets/debian-template/copyright | 4 ++-- debian-template/copyright | 4 ++-- src/d_main.c | 2 +- src/win32/Srb2win.rc | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/assets/README.txt b/assets/README.txt index e384333ed..2c522966e 100644 --- a/assets/README.txt +++ b/assets/README.txt @@ -39,7 +39,7 @@ https://facebook.com/SonicRoboBlast2 COPYRIGHT AND DISCLAIMER -Design and content in Sonic Robo Blast 2 is copyright 1998-2023 by Sonic Team Jr. +Design and content in Sonic Robo Blast 2 is copyright 1998-2024 by Sonic Team Jr. All original material in this game is copyrighted by their respective owners, and no copyright infringement is intended. Sonic Team Jr. is in no way affiliated with SEGA or Sonic Team, and we do not claim ownership of any of SEGA's intellectual property used in SRB2. diff --git a/assets/debian-template/copyright b/assets/debian-template/copyright index cc47c453b..649e796fb 100644 --- a/assets/debian-template/copyright +++ b/assets/debian-template/copyright @@ -12,7 +12,7 @@ Upstream Author(s): Copyright: - Copyright (C) 1998-2018 by Sonic Team Junior + Copyright (C) 1998-2024 by Sonic Team Junior License: @@ -21,7 +21,7 @@ License: The Debian packaging is: Copyright (C) 2010 Callum Dickinson - Copyright (C) 2010-2018 by Sonic Team Junior + Copyright (C) 2010-2024 by Sonic Team Junior and is licensed under the GPL version 2, see "/usr/share/common-licenses/GPL-2". diff --git a/debian-template/copyright b/debian-template/copyright index cc47c453b..649e796fb 100644 --- a/debian-template/copyright +++ b/debian-template/copyright @@ -12,7 +12,7 @@ Upstream Author(s): Copyright: - Copyright (C) 1998-2018 by Sonic Team Junior + Copyright (C) 1998-2024 by Sonic Team Junior License: @@ -21,7 +21,7 @@ License: The Debian packaging is: Copyright (C) 2010 Callum Dickinson - Copyright (C) 2010-2018 by Sonic Team Junior + Copyright (C) 2010-2024 by Sonic Team Junior and is licensed under the GPL version 2, see "/usr/share/common-licenses/GPL-2". diff --git a/src/d_main.c b/src/d_main.c index bf6c62ef2..65100318b 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1250,7 +1250,7 @@ void D_SRB2Main(void) // Print GPL notice for our console users (Linux) CONS_Printf( "\n\nSonic Robo Blast 2\n" - "Copyright (C) 1998-2023 by Sonic Team Junior\n\n" + "Copyright (C) 1998-2024 by Sonic Team Junior\n\n" "This program comes with ABSOLUTELY NO WARRANTY.\n\n" "This is free software, and you are welcome to redistribute it\n" "and/or modify it under the terms of the GNU General Public License\n" diff --git a/src/win32/Srb2win.rc b/src/win32/Srb2win.rc index 46114f871..bbe61cb17 100644 --- a/src/win32/Srb2win.rc +++ b/src/win32/Srb2win.rc @@ -98,7 +98,7 @@ BEGIN VALUE "FileDescription", "Sonic Robo Blast 2\0" VALUE "FileVersion", VERSIONSTRING_RC VALUE "InternalName", "srb2\0" - VALUE "LegalCopyright", "Copyright 1998-2023 by Sonic Team Junior\0" + VALUE "LegalCopyright", "Copyright 1998-2024 by Sonic Team Junior\0" VALUE "LegalTrademarks", "Sonic the Hedgehog and related characters are trademarks of Sega.\0" VALUE "OriginalFilename", "srb2win.exe\0" VALUE "PrivateBuild", "\0" From e7b4beba20c49e0943be587e5792b6398d5642d1 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 21 Sep 2024 21:35:01 -0300 Subject: [PATCH 204/353] Update dates in copyright notices of all files modified in 2024 --- src/b_bot.c | 2 +- src/byteptr.h | 2 +- src/command.c | 2 +- src/command.h | 2 +- src/console.c | 2 +- src/console.h | 2 +- src/d_main.c | 2 +- src/d_player.h | 2 +- src/dedicated/i_system.c | 2 +- src/deh_lua.c | 2 +- src/deh_soc.c | 2 +- src/deh_tables.c | 2 +- src/deh_tables.h | 2 +- src/doomdef.h | 2 +- src/doomstat.h | 2 +- src/doomtype.h | 2 +- src/f_finale.c | 2 +- src/f_finale.h | 2 +- src/g_demo.c | 2 +- src/g_demo.h | 2 +- src/g_game.c | 2 +- src/g_game.h | 2 +- src/g_input.c | 2 +- src/hardware/hw_batching.c | 2 +- src/hardware/hw_batching.h | 2 +- src/hardware/hw_defs.h | 2 +- src/hardware/hw_draw.c | 2 +- src/hardware/hw_drv.h | 2 +- src/hardware/hw_glob.h | 2 +- src/hardware/hw_light.c | 2 +- src/hardware/hw_main.c | 2 +- src/hardware/hw_main.h | 2 +- src/hardware/hw_md2.c | 2 +- src/hardware/hw_shaders.c | 2 +- src/hardware/hw_shaders.h | 2 +- src/hu_stuff.c | 2 +- src/hu_stuff.h | 2 +- src/i_system.h | 2 +- src/i_video.h | 2 +- src/info.c | 2 +- src/info.h | 2 +- src/lua_baselib.c | 2 +- src/lua_colorlib.c | 4 ++-- src/lua_hook.h | 2 +- src/lua_hooklib.c | 2 +- src/lua_hud.h | 2 +- src/lua_hudlib.c | 2 +- src/lua_hudlib_drawlist.c | 2 +- src/lua_infolib.c | 2 +- src/lua_libs.h | 2 +- src/lua_maplib.c | 2 +- src/lua_mobjlib.c | 2 +- src/lua_playerlib.c | 2 +- src/lua_script.c | 2 +- src/lua_script.h | 2 +- src/lua_skinlib.c | 2 +- src/m_anigif.c | 2 +- src/m_cheat.c | 2 +- src/m_cheat.h | 2 +- src/m_cond.c | 2 +- src/m_fixed.c | 2 +- src/m_fixed.h | 2 +- src/m_menu.c | 2 +- src/m_menu.h | 2 +- src/m_misc.c | 2 +- src/m_misc.h | 2 +- src/m_tokenizer.c | 2 +- src/m_tokenizer.h | 2 +- src/netcode/commands.c | 2 +- src/netcode/d_net.c | 2 +- src/netcode/d_netcmd.h | 2 +- src/netcode/gamestate.c | 2 +- src/netcode/i_net.h | 2 +- src/netcode/i_tcp.c | 2 +- src/netcode/mserv.c | 2 +- src/p_enemy.c | 2 +- src/p_inter.c | 2 +- src/p_local.h | 2 +- src/p_map.c | 2 +- src/p_maputl.c | 2 +- src/p_maputl.h | 2 +- src/p_mobj.c | 2 +- src/p_mobj.h | 2 +- src/p_polyobj.c | 2 +- src/p_pspr.h | 2 +- src/p_saveg.c | 2 +- src/p_saveg.h | 2 +- src/p_setup.c | 2 +- src/p_setup.h | 2 +- src/p_slopes.c | 2 +- src/p_slopes.h | 2 +- src/p_spec.c | 2 +- src/p_spec.h | 2 +- src/p_tick.c | 2 +- src/p_user.c | 2 +- src/r_bsp.c | 2 +- src/r_data.c | 2 +- src/r_data.h | 2 +- src/r_defs.h | 2 +- src/r_draw.c | 2 +- src/r_draw.h | 2 +- src/r_draw8.c | 2 +- src/r_draw8_npo2.c | 2 +- src/r_fps.c | 2 +- src/r_fps.h | 2 +- src/r_main.c | 2 +- src/r_main.h | 2 +- src/r_patch.h | 2 +- src/r_picformats.c | 4 ++-- src/r_picformats.h | 4 ++-- src/r_plane.c | 2 +- src/r_segs.c | 2 +- src/r_skins.c | 2 +- src/r_skins.h | 2 +- src/r_sky.c | 2 +- src/r_splats.c | 2 +- src/r_textures.c | 2 +- src/r_textures.h | 2 +- src/r_things.c | 2 +- src/r_things.h | 2 +- src/r_translation.c | 2 +- src/r_translation.h | 2 +- src/s_sound.c | 2 +- src/s_sound.h | 2 +- src/screen.c | 2 +- src/screen.h | 2 +- src/st_stuff.c | 2 +- src/st_stuff.h | 2 +- src/string.c | 2 +- src/tables.c | 2 +- src/tables.h | 2 +- src/v_video.c | 2 +- src/v_video.h | 2 +- src/w_wad.c | 2 +- src/w_wad.h | 2 +- src/y_inter.c | 2 +- 136 files changed, 139 insertions(+), 139 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index 6229cb1d6..97dcd1078 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2007-2016 by John "JTE" Muniz. -// Copyright (C) 2011-2023 by Sonic Team Junior. +// Copyright (C) 2011-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/byteptr.h b/src/byteptr.h index 4377fae57..61cefd350 100644 --- a/src/byteptr.h +++ b/src/byteptr.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/command.c b/src/command.c index 25eb83d19..399714bd0 100644 --- a/src/command.c +++ b/src/command.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/command.h b/src/command.h index 368c2fb3f..c1ac7d486 100644 --- a/src/command.h +++ b/src/command.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/console.c b/src/console.c index 0c3eac4f7..50ecfec9c 100644 --- a/src/console.c +++ b/src/console.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/console.h b/src/console.h index 6ad1dba1e..2af01f1a3 100644 --- a/src/console.h +++ b/src/console.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_main.c b/src/d_main.c index 65100318b..a6a9385d2 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/d_player.h b/src/d_player.h index 95d2f609d..5f5bf53d6 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 1a1db8fb3..7949a8bd7 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -3,7 +3,7 @@ // // Copyright (C) 1993-1996 by id Software, Inc. // Portions Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 2014-2023 by Sonic Team Junior. +// Copyright (C) 2014-2024 by Sonic Team Junior. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/deh_lua.c b/src/deh_lua.c index 64fb52fc7..e81a8c08e 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/deh_soc.c b/src/deh_soc.c index 3759cc9c7..c0e646f60 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/deh_tables.c b/src/deh_tables.c index 15991a936..91163b206 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/deh_tables.h b/src/deh_tables.h index b6986adff..94af2fa52 100644 --- a/src/deh_tables.h +++ b/src/deh_tables.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/doomdef.h b/src/doomdef.h index 1b0e76314..c92e6dc37 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/doomstat.h b/src/doomstat.h index bde2bacc7..5246349de 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/doomtype.h b/src/doomtype.h index fa8616793..415669ac4 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/f_finale.c b/src/f_finale.c index c6c2f1fd1..37e4ba070 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/f_finale.h b/src/f_finale.h index 4b777eb11..e12a81cc6 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_demo.c b/src/g_demo.c index 77f8f7b0d..b0e16adda 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_demo.h b/src/g_demo.h index 67f61f54d..d7c682871 100644 --- a/src/g_demo.h +++ b/src/g_demo.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_game.c b/src/g_game.c index 8170efdd4..d409bb2cf 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_game.h b/src/g_game.h index 0d5fc7e37..2680fa973 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/g_input.c b/src/g_input.c index 4a9692e88..3ba709978 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index b9ab2592d..7a57a7a12 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020-2023 by Sonic Team Junior. +// Copyright (C) 2020-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_batching.h b/src/hardware/hw_batching.h index df1a4c38b..4214ca410 100644 --- a/src/hardware/hw_batching.h +++ b/src/hardware/hw_batching.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020-2023 by Sonic Team Junior. +// Copyright (C) 2020-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_defs.h b/src/hardware/hw_defs.h index 7d06ceb60..77d7133b6 100644 --- a/src/hardware/hw_defs.h +++ b/src/hardware/hw_defs.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index ddce7d988..369f59ac2 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index 45ee2933a..694cc1b8c 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 5678cd593..62fe8d0bd 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index e7769edbd..1d2772dc4 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index f395a8390..4741c6a46 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index ea610a48b..2277c32f3 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 2616d4085..426c014d2 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_shaders.c b/src/hardware/hw_shaders.c index ee1e2acdf..fde67375f 100644 --- a/src/hardware/hw_shaders.c +++ b/src/hardware/hw_shaders.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by Sonic Team Junior. +// Copyright (C) 2021-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hardware/hw_shaders.h b/src/hardware/hw_shaders.h index bb0e6a232..38a2d9911 100644 --- a/src/hardware/hw_shaders.h +++ b/src/hardware/hw_shaders.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021 by Sonic Team Junior. +// Copyright (C) 2021-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hu_stuff.c b/src/hu_stuff.c index a7d0aea74..9333a61d2 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 07881ce1a..2618d873b 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_system.h b/src/i_system.h index f4d169113..5348caf4d 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/i_video.h b/src/i_video.h index 4b459e25b..f3bbc90b9 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/info.c b/src/info.c index d66c24af8..a138db8a4 100644 --- a/src/info.c +++ b/src/info.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/info.h b/src/info.h index f58aee07d..ddbfc31b7 100644 --- a/src/info.h +++ b/src/info.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 304c866c9..19775eb8a 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2023 by Sonic Team Junior. +// Copyright (C) 2012-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_colorlib.c b/src/lua_colorlib.c index 3fab589b2..a8785f705 100644 --- a/src/lua_colorlib.c +++ b/src/lua_colorlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021-2022 by "Lactozilla". -// Copyright (C) 2014-2023 by Sonic Team Junior. +// Copyright (C) 2021-2024 by "Lactozilla". +// Copyright (C) 2014-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_hook.h b/src/lua_hook.h index 17e0e99a0..90a11d05d 100644 --- a/src/lua_hook.h +++ b/src/lua_hook.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2023 by Sonic Team Junior. +// Copyright (C) 2012-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 14781986e..51ebe3938 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2023 by Sonic Team Junior. +// Copyright (C) 2012-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_hud.h b/src/lua_hud.h index 36ce230ed..ae938e28a 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2014-2016 by John "JTE" Muniz. -// Copyright (C) 2014-2023 by Sonic Team Junior. +// Copyright (C) 2014-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index d6771f108..d2b3d9679 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2014-2016 by John "JTE" Muniz. -// Copyright (C) 2014-2023 by Sonic Team Junior. +// Copyright (C) 2014-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_hudlib_drawlist.c b/src/lua_hudlib_drawlist.c index cb58e628e..358d615cf 100644 --- a/src/lua_hudlib_drawlist.c +++ b/src/lua_hudlib_drawlist.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2014-2016 by John "JTE" Muniz. -// Copyright (C) 2014-2023 by Sonic Team Junior. +// Copyright (C) 2014-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_infolib.c b/src/lua_infolib.c index 511c20031..a65ee23eb 100644 --- a/src/lua_infolib.c +++ b/src/lua_infolib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2023 by Sonic Team Junior. +// Copyright (C) 2012-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_libs.h b/src/lua_libs.h index 90c7bba7c..e1585f488 100644 --- a/src/lua_libs.h +++ b/src/lua_libs.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2023 by Sonic Team Junior. +// Copyright (C) 2012-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 9985e5631..c946b10ce 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2023 by Sonic Team Junior. +// Copyright (C) 2012-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index eadcbe33b..ebe995ea8 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2023 by Sonic Team Junior. +// Copyright (C) 2012-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 744a56f7f..37b42fde5 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2023 by Sonic Team Junior. +// Copyright (C) 2012-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_script.c b/src/lua_script.c index 51808977f..623d88673 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2023 by Sonic Team Junior. +// Copyright (C) 2012-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_script.h b/src/lua_script.h index 968ef078d..c5a5069ef 100644 --- a/src/lua_script.h +++ b/src/lua_script.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2023 by Sonic Team Junior. +// Copyright (C) 2012-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 26f4011d3..0e8860804 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2014-2016 by John "JTE" Muniz. -// Copyright (C) 2014-2023 by Sonic Team Junior. +// Copyright (C) 2014-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_anigif.c b/src/m_anigif.c index 6e6ec68aa..5ebc4892c 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 2013-2016 by Matthew "Kaito Sinclaire" Walsh. // Copyright (C) 2013 by "Ninji". -// Copyright (C) 2013-2023 by Sonic Team Junior. +// Copyright (C) 2013-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_cheat.c b/src/m_cheat.c index 07f100717..2b32253fa 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_cheat.h b/src/m_cheat.h index 564c6da77..6bd1546f8 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_cond.c b/src/m_cond.c index fa6cda223..418b2ff2b 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 2012-2023 by Sonic Team Junior. +// Copyright (C) 2012-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_fixed.c b/src/m_fixed.c index 19c1e8091..ace05fd3b 100644 --- a/src/m_fixed.c +++ b/src/m_fixed.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // Copyright (C) 2009 by Stephen McGranahan. // // This program is free software distributed under the diff --git a/src/m_fixed.h b/src/m_fixed.h index f40c7b308..504b53a6e 100644 --- a/src/m_fixed.h +++ b/src/m_fixed.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_menu.c b/src/m_menu.c index 301c40075..2e4a42506 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3,7 +3,7 @@ // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 2011-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_menu.h b/src/m_menu.h index e76010c17..cfe811d0b 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -3,7 +3,7 @@ // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 2011-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_misc.c b/src/m_misc.c index 724717aa6..dda3ffc86 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_misc.h b/src/m_misc.h index 04ac66ca6..636810944 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_tokenizer.c b/src/m_tokenizer.c index 8bb094cae..09f8915a5 100644 --- a/src/m_tokenizer.c +++ b/src/m_tokenizer.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2013-2023 by Sonic Team Junior. +// Copyright (C) 2013-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_tokenizer.h b/src/m_tokenizer.h index 7ee856b3c..4f03563a2 100644 --- a/src/m_tokenizer.h +++ b/src/m_tokenizer.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2013-2023 by Sonic Team Junior. +// Copyright (C) 2013-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/netcode/commands.c b/src/netcode/commands.c index f3bbc8a86..8d6dab06b 100644 --- a/src/netcode/commands.c +++ b/src/netcode/commands.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/netcode/d_net.c b/src/netcode/d_net.c index 4f21ca984..031336852 100644 --- a/src/netcode/d_net.c +++ b/src/netcode/d_net.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/netcode/d_netcmd.h b/src/netcode/d_netcmd.h index f92878a4e..c11575575 100644 --- a/src/netcode/d_netcmd.h +++ b/src/netcode/d_netcmd.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/netcode/gamestate.c b/src/netcode/gamestate.c index d38555245..967e23650 100644 --- a/src/netcode/gamestate.c +++ b/src/netcode/gamestate.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/netcode/i_net.h b/src/netcode/i_net.h index 6ac4bfc87..4fd317994 100644 --- a/src/netcode/i_net.h +++ b/src/netcode/i_net.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/netcode/i_tcp.c b/src/netcode/i_tcp.c index d9af91c04..ed1f5b4e7 100644 --- a/src/netcode/i_tcp.c +++ b/src/netcode/i_tcp.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/netcode/mserv.c b/src/netcode/mserv.c index 74ee120f9..78a395344 100644 --- a/src/netcode/mserv.c +++ b/src/netcode/mserv.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // Copyright (C) 2020-2023 by James R. // // This program is free software distributed under the diff --git a/src/p_enemy.c b/src/p_enemy.c index e1b21e295..2ae7276df 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_inter.c b/src/p_inter.c index cbd56183d..19ab5ead4 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_local.h b/src/p_local.h index 249c3cd4b..39856bffb 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_map.c b/src/p_map.c index c742e2e85..1116ae06a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_maputl.c b/src/p_maputl.c index 200b89cff..f10a396a3 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_maputl.h b/src/p_maputl.h index e894c08a2..67f7fd086 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_mobj.c b/src/p_mobj.c index 1ec09ab85..b377ff82f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_mobj.h b/src/p_mobj.h index 4ebcc993a..4a8427669 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_polyobj.c b/src/p_polyobj.c index e779956e8..168fca61f 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2006 by James Haley -// Copyright (C) 2006-2023 by Sonic Team Junior. +// Copyright (C) 2006-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_pspr.h b/src/p_pspr.h index 6510190f1..5e1c1e05e 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_saveg.c b/src/p_saveg.c index 5c2228593..aad7351f0 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_saveg.h b/src/p_saveg.h index 8aa83c80f..05e82190a 100644 --- a/src/p_saveg.h +++ b/src/p_saveg.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_setup.c b/src/p_setup.c index b5ed485d8..2524803ab 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_setup.h b/src/p_setup.h index da38d4c08..6b0218854 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_slopes.c b/src/p_slopes.c index ce276a672..7f070e2a1 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2009 by Stephen McGranahan. -// Copyright (C) 2015-2023 by Sonic Team Junior. +// Copyright (C) 2015-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_slopes.h b/src/p_slopes.h index fdc07f67e..39b7ba56d 100644 --- a/src/p_slopes.h +++ b/src/p_slopes.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2009 by Stephen McGranahan. -// Copyright (C) 2015-2023 by Sonic Team Junior. +// Copyright (C) 2015-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_spec.c b/src/p_spec.c index d4939669a..6f3543161 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_spec.h b/src/p_spec.h index b9c3a2ca3..ba08781b6 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_tick.c b/src/p_tick.c index 56e0fd897..68de09138 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/p_user.c b/src/p_user.c index 3ee13aca9..a2bae228b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_bsp.c b/src/r_bsp.c index 373a170c9..ad27b9bf8 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_data.c b/src/r_data.c index 75ec0556d..e7200ecbd 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_data.h b/src/r_data.h index 9340ed284..7c6ee19d5 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_defs.h b/src/r_defs.h index 51cc08646..51fac21fa 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_draw.c b/src/r_draw.c index eca3f36b7..906398ec4 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_draw.h b/src/r_draw.h index 6a6ab2db1..00032e44f 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_draw8.c b/src/r_draw8.c index 2011e4640..220878f88 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_draw8_npo2.c b/src/r_draw8_npo2.c index 1ed3a8fa4..6213ecbc5 100644 --- a/src/r_draw8_npo2.c +++ b/src/r_draw8_npo2.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_fps.c b/src/r_fps.c index 7f1f2bb30..71f6e59a7 100644 --- a/src/r_fps.c +++ b/src/r_fps.c @@ -3,7 +3,7 @@ // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1999-2000 by Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze, Andrey Budko (prboom) -// Copyright (C) 1999-2019 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_fps.h b/src/r_fps.h index 33224a83a..ce64d19be 100644 --- a/src/r_fps.h +++ b/src/r_fps.h @@ -3,7 +3,7 @@ // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 1999-2000 by Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze, Andrey Budko (prboom) -// Copyright (C) 1999-2019 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_main.c b/src/r_main.c index 067b8abdb..50293341d 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_main.h b/src/r_main.h index 64a69fffe..af7086e83 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patch.h b/src/r_patch.h index f1a018c03..6369fef9e 100644 --- a/src/r_patch.h +++ b/src/r_patch.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020-2023 by Jaime "Lactozilla" Passos. +// Copyright (C) 2020-2024 by Jaime "Lactozilla" Passos. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_picformats.c b/src/r_picformats.c index d71657021..08cb663d4 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -2,8 +2,8 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 2005-2009 by Andrey "entryway" Budko. -// Copyright (C) 2018-2023 by Jaime "Lactozilla" Passos. -// Copyright (C) 2019-2023 by Sonic Team Junior. +// Copyright (C) 2018-2024 by Jaime "Lactozilla" Passos. +// Copyright (C) 2019-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_picformats.h b/src/r_picformats.h index 098f927a5..a928bbde5 100644 --- a/src/r_picformats.h +++ b/src/r_picformats.h @@ -1,8 +1,8 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. -// Copyright (C) 2018-2023 by Jaime "Lactozilla" Passos. -// Copyright (C) 2019-2023 by Sonic Team Junior. +// Copyright (C) 2018-2024 by Jaime "Lactozilla" Passos. +// Copyright (C) 2019-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_plane.c b/src/r_plane.c index 04272f8d3..380f39eab 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_segs.c b/src/r_segs.c index a8a065c9b..4939d1fc8 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_skins.c b/src/r_skins.c index a341ee80f..f364273e8 100644 --- a/src/r_skins.c +++ b/src/r_skins.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_skins.h b/src/r_skins.h index 5122b53a6..645fea540 100644 --- a/src/r_skins.h +++ b/src/r_skins.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_sky.c b/src/r_sky.c index 1b2c43d12..ad7262c6e 100644 --- a/src/r_sky.c +++ b/src/r_sky.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_splats.c b/src/r_splats.c index 027ccd720..813c4b243 100644 --- a/src/r_splats.c +++ b/src/r_splats.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_textures.c b/src/r_textures.c index b61ddb86f..bd22a2df1 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_textures.h b/src/r_textures.h index 7e1588851..35db40d42 100644 --- a/src/r_textures.h +++ b/src/r_textures.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_things.c b/src/r_things.c index 917e4e8b4..432b5e10b 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_things.h b/src/r_things.h index 55ab71ec3..ae21d2404 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_translation.c b/src/r_translation.c index a53b30e9f..53bb0e6a0 100644 --- a/src/r_translation.c +++ b/src/r_translation.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2006 by Randy Heit. -// Copyright (C) 2023 by Sonic Team Junior. +// Copyright (C) 2023-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_translation.h b/src/r_translation.h index 1eb40233d..9cae1a647 100644 --- a/src/r_translation.h +++ b/src/r_translation.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2006 by Randy Heit. -// Copyright (C) 2023 by Sonic Team Junior. +// Copyright (C) 2023-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/s_sound.c b/src/s_sound.c index 32353a59c..0329c289e 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/s_sound.h b/src/s_sound.h index d64778fc3..589060c8c 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/screen.c b/src/screen.c index 014a20117..a2c1f04da 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/screen.h b/src/screen.h index 375b3e04e..6d45560c4 100644 --- a/src/screen.h +++ b/src/screen.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/st_stuff.c b/src/st_stuff.c index b99f003da..a44771e4b 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/st_stuff.h b/src/st_stuff.h index 357930de0..a2fb8a0ed 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/string.c b/src/string.c index b24e12e6e..c5d95b224 100644 --- a/src/string.c +++ b/src/string.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2006 by Graue. -// Copyright (C) 2006-2023 by Sonic Team Junior. +// Copyright (C) 2006-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/tables.c b/src/tables.c index d0fb428ba..8e9075be2 100644 --- a/src/tables.c +++ b/src/tables.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // Copyright (C) 2009 by Stephen McGranahan. // // This program is free software distributed under the diff --git a/src/tables.h b/src/tables.h index 65d7f7243..3c0dd2a81 100644 --- a/src/tables.h +++ b/src/tables.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/v_video.c b/src/v_video.c index 3beb435b5..42a4aaa00 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/v_video.h b/src/v_video.h index d37762466..bdab23e8a 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/w_wad.c b/src/w_wad.c index 97208296a..4a6900113 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/w_wad.h b/src/w_wad.h index 4fd7b2c00..5872ae50a 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2023 by Sonic Team Junior. +// Copyright (C) 1999-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/y_inter.c b/src/y_inter.c index 2add8645b..95a08a387 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2004-2023 by Sonic Team Junior. +// Copyright (C) 2004-2024 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. From a050df102256ef30b74b36dd6b1d2fa36558ca62 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 21 Sep 2024 21:38:05 -0300 Subject: [PATCH 205/353] Update names --- src/lua_colorlib.c | 2 +- src/m_easing.c | 2 +- src/m_easing.h | 2 +- src/r_patch.c | 2 +- src/r_patch.h | 2 +- src/r_patchrotation.c | 2 +- src/r_patchrotation.h | 2 +- src/r_picformats.c | 2 +- src/r_picformats.h | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lua_colorlib.c b/src/lua_colorlib.c index a8785f705..9e679eb40 100644 --- a/src/lua_colorlib.c +++ b/src/lua_colorlib.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2021-2024 by "Lactozilla". +// Copyright (C) 2021-2024 by Lactozilla. // Copyright (C) 2014-2024 by Sonic Team Junior. // // This program is free software distributed under the diff --git a/src/m_easing.c b/src/m_easing.c index 48fe1efbc..60ca6e9b6 100644 --- a/src/m_easing.c +++ b/src/m_easing.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020-2023 by Jaime "Lactozilla" Passos. +// Copyright (C) 2020-2023 by Lactozilla. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_easing.h b/src/m_easing.h index eaa5d6773..6884833af 100644 --- a/src/m_easing.h +++ b/src/m_easing.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020-2023 by Jaime "Lactozilla" Passos. +// Copyright (C) 2020-2023 by Lactozilla. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patch.c b/src/r_patch.c index a6a9dc2eb..19e66404f 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020-2023 by Jaime "Lactozilla" Passos. +// Copyright (C) 2020-2023 by Lactozilla. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patch.h b/src/r_patch.h index 6369fef9e..ff76254e8 100644 --- a/src/r_patch.h +++ b/src/r_patch.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020-2024 by Jaime "Lactozilla" Passos. +// Copyright (C) 2020-2024 by Lactozilla. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patchrotation.c b/src/r_patchrotation.c index b91069849..989665d74 100644 --- a/src/r_patchrotation.c +++ b/src/r_patchrotation.c @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020-2023 by Jaime "Lactozilla" Passos. +// Copyright (C) 2020-2023 by Lactozilla. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_patchrotation.h b/src/r_patchrotation.h index a239ac5fa..184d7ac13 100644 --- a/src/r_patchrotation.h +++ b/src/r_patchrotation.h @@ -1,6 +1,6 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- -// Copyright (C) 2020-2023 by Jaime "Lactozilla" Passos. +// Copyright (C) 2020-2023 by Lactozilla. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/r_picformats.c b/src/r_picformats.c index 08cb663d4..a45c143b0 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 2005-2009 by Andrey "entryway" Budko. -// Copyright (C) 2018-2024 by Jaime "Lactozilla" Passos. +// Copyright (C) 2018-2024 by Lactozilla. // Copyright (C) 2019-2024 by Sonic Team Junior. // // This program is free software distributed under the diff --git a/src/r_picformats.h b/src/r_picformats.h index a928bbde5..123dda976 100644 --- a/src/r_picformats.h +++ b/src/r_picformats.h @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. -// Copyright (C) 2018-2024 by Jaime "Lactozilla" Passos. +// Copyright (C) 2018-2024 by Lactozilla. // Copyright (C) 2019-2024 by Sonic Team Junior. // // This program is free software distributed under the From 697509bd68642053fbd64d41119ad8b850329940 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Tue, 24 Sep 2024 23:26:54 +0200 Subject: [PATCH 206/353] Fix global mobj hooks deprecation warning always triggering --- src/lua_hooklib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index 51ebe3938..1bf3caf65 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -498,7 +498,9 @@ static int call_string_hooks(Hook_State *hook) static int call_mobj_type_hooks(Hook_State *hook, mobjtype_t mobj_type) { - if (mobj_type == MT_NULL && ( + int numCalls = call_mapped(hook, &mobjHookIds[mobj_type][hook->hook_type]); + + if (numCalls > 0 && mobj_type == MT_NULL && ( hook->hook_type == MOBJ_HOOK(MobjThinker ) || hook->hook_type == MOBJ_HOOK(MobjCollide ) || hook->hook_type == MOBJ_HOOK(MobjLineCollide) @@ -514,7 +516,7 @@ static int call_mobj_type_hooks(Hook_State *hook, mobjtype_t mobj_type) mobjHookNames[hook->hook_type]) ); - return call_mapped(hook, &mobjHookIds[mobj_type][hook->hook_type]); + return numCalls; } static void call_hud_hooks From 209c545743376702e763cc385044f8a17ec51d21 Mon Sep 17 00:00:00 2001 From: UnmatchedBracket Date: Wed, 25 Sep 2024 13:44:22 -0600 Subject: [PATCH 207/353] fix quake epicenter for first person and awayviews --- src/r_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 50293341d..dcb69b662 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1152,8 +1152,14 @@ void R_SetupFrame(player_t *player) if (quake.epicenter) { // Calculate 3D distance from epicenter, using the camera. - fixed_t xydist = R_PointToDist2(thiscam->x, thiscam->y, quake.epicenter->x, quake.epicenter->y); - fixed_t dist = R_PointToDist2(0, thiscam->z, xydist, quake.epicenter->z); + fixed_t xydist, dist; + if (r_viewmobj == NULL) { + xydist = R_PointToDist2(thiscam->x, thiscam->y, quake.epicenter->x, quake.epicenter->y); + dist = R_PointToDist2(0, thiscam->z, xydist, quake.epicenter->z); + } else { + xydist = R_PointToDist2(r_viewmobj->x, r_viewmobj->y, quake.epicenter->x, quake.epicenter->y); + dist = R_PointToDist2(0, r_viewmobj->z, xydist, quake.epicenter->z); + } // More effect closer to epicenter, outside of radius = no effect if (!quake.radius || dist > quake.radius) From 491c77bd767ddfa81f47cd60e4ebd203ae5e5e3b Mon Sep 17 00:00:00 2001 From: Unmatched Bracket <2755-UnmatchedBracket@users.noreply.git.do.srb2.org> Date: Wed, 25 Sep 2024 20:40:34 +0000 Subject: [PATCH 208/353] [quake fixes] Use P_MobjWasRemoved instead of checking against NULL per Zapony's suggestion --- src/r_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_main.c b/src/r_main.c index dcb69b662..32e3138eb 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1153,7 +1153,7 @@ void R_SetupFrame(player_t *player) if (quake.epicenter) { // Calculate 3D distance from epicenter, using the camera. fixed_t xydist, dist; - if (r_viewmobj == NULL) { + if (P_MobjWasRemoved(r_viewmobj)) { xydist = R_PointToDist2(thiscam->x, thiscam->y, quake.epicenter->x, quake.epicenter->y); dist = R_PointToDist2(0, thiscam->z, xydist, quake.epicenter->z); } else { From ac802318f94b82f6aed262f004a3cd0f3bead030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Fri, 27 Sep 2024 18:25:14 +0200 Subject: [PATCH 209/353] Remove select-related testing functions --- src/netcode/d_net.c | 14 +-------- src/netcode/i_net.h | 8 ----- src/netcode/i_tcp.c | 71 ++------------------------------------------- 3 files changed, 4 insertions(+), 89 deletions(-) diff --git a/src/netcode/d_net.c b/src/netcode/d_net.c index 031336852..99859ea4c 100644 --- a/src/netcode/d_net.c +++ b/src/netcode/d_net.c @@ -67,8 +67,6 @@ INT16 hardware_MAXPACKETLENGTH; boolean (*I_NetGet)(void) = NULL; void (*I_NetSend)(void) = NULL; -boolean (*I_NetCanSend)(void) = NULL; -boolean (*I_NetCanGet)(void) = NULL; void (*I_NetCloseSocket)(void) = NULL; void (*I_NetFreeNodenum)(INT32 nodenum) = NULL; SINT8 (*I_NetMakeNodewPort)(const char *address, const char* port) = NULL; @@ -993,15 +991,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen netbuffer->ackreturn = 0; if (reliable) { - if (I_NetCanSend && !I_NetCanSend()) - { - if (netbuffer->packettype < PT_CANFAIL) - GetFreeAcknum(&netbuffer->ack, true); - - DEBFILE("HSendPacket: Out of bandwidth\n"); - return false; - } - else if (!GetFreeAcknum(&netbuffer->ack, false)) + if (!GetFreeAcknum(&netbuffer->ack, false)) return false; } else @@ -1205,7 +1195,6 @@ boolean D_CheckNetGame(void) I_NetGet = Internal_Get; I_NetSend = Internal_Send; - I_NetCanSend = NULL; I_NetCloseSocket = NULL; I_NetFreeNodenum = Internal_FreeNodenum; I_NetMakeNodewPort = NULL; @@ -1375,7 +1364,6 @@ void D_CloseConnection(void) I_NetGet = Internal_Get; I_NetSend = Internal_Send; - I_NetCanSend = NULL; I_NetCloseSocket = NULL; I_NetFreeNodenum = Internal_FreeNodenum; I_NetMakeNodewPort = NULL; diff --git a/src/netcode/i_net.h b/src/netcode/i_net.h index 4fd317994..a2039bd19 100644 --- a/src/netcode/i_net.h +++ b/src/netcode/i_net.h @@ -67,18 +67,10 @@ extern doomcom_t *doomcom; */ extern boolean (*I_NetGet)(void); -/** \brief ask to driver if there is data waiting -*/ -extern boolean (*I_NetCanGet)(void); - /** \brief send packet within doomcom struct */ extern void (*I_NetSend)(void); -/** \brief ask to driver if all is ok to send data now -*/ -extern boolean (*I_NetCanSend)(void); - /** \brief close a connection \param nodenum node to be closed diff --git a/src/netcode/i_tcp.c b/src/netcode/i_tcp.c index ed1f5b4e7..87cc94a0c 100644 --- a/src/netcode/i_tcp.c +++ b/src/netcode/i_tcp.c @@ -143,7 +143,6 @@ typedef union #endif #include "i_addrinfo.h" -#define SELECTTEST #define DEFAULTPORT "5029" #ifdef USE_WINSOCK @@ -631,56 +630,6 @@ static boolean SOCK_Get(void) return false; } -// check if we can send (do not go over the buffer) - -static fd_set masterset; - -#ifdef SELECTTEST -static boolean FD_CPY(fd_set *src, fd_set *dst, SOCKET_TYPE *fd, size_t len) -{ - boolean testset = false; - FD_ZERO(dst); - for (size_t i = 0; i < len;i++) - { - if(fd[i] != (SOCKET_TYPE)ERRSOCKET && - FD_ISSET(fd[i], src) && !FD_ISSET(fd[i], dst)) // no checking for dups - { - FD_SET(fd[i], dst); - testset = true; - } - } - return testset; -} - -static boolean SOCK_CanSend(void) -{ - struct timeval timeval_for_select = {0, 0}; - fd_set tset; - int wselect; - - if(!FD_CPY(&masterset, &tset, mysockets, mysocketses)) - return false; - wselect = select(255, NULL, &tset, NULL, &timeval_for_select); - if (wselect >= 1) - return true; - return false; -} - -static boolean SOCK_CanGet(void) -{ - struct timeval timeval_for_select = {0, 0}; - fd_set tset; - int rselect; - - if(!FD_CPY(&masterset, &tset, mysockets, mysocketses)) - return false; - rselect = select(255, &tset, NULL, NULL, &timeval_for_select); - if (rselect >= 1) - return true; - return false; -} -#endif - static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr) { socklen_t d4 = (socklen_t)sizeof(struct sockaddr_in); @@ -922,7 +871,6 @@ static boolean UDP_Socket(void) mysockets[s] = ERRSOCKET; for (s = 0; s < MAXNETNODES+1; s++) nodesocket[s] = ERRSOCKET; - FD_ZERO(&masterset); s = 0; memset(&hints, 0x00, sizeof (hints)); @@ -949,7 +897,6 @@ static boolean UDP_Socket(void) mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen); if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET) { - FD_SET(mysockets[s], &masterset); myfamily[s] = hints.ai_family; s++; } @@ -970,7 +917,6 @@ static boolean UDP_Socket(void) mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen); if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET) { - FD_SET(mysockets[s], &masterset); myfamily[s] = hints.ai_family; s++; #ifdef HAVE_MINIUPNPC @@ -1003,7 +949,6 @@ static boolean UDP_Socket(void) mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen); if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET) { - FD_SET(mysockets[s], &masterset); myfamily[s] = hints.ai_family; s++; } @@ -1024,7 +969,6 @@ static boolean UDP_Socket(void) mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen); if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET) { - FD_SET(mysockets[s], &masterset); myfamily[s] = hints.ai_family; s++; } @@ -1150,16 +1094,13 @@ boolean I_InitTcpDriver(void) static void SOCK_CloseSocket(void) { - for (size_t i=0; i < MAXNETNODES+1; i++) + for (size_t i=0; i < mysocketses; i++) { - if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET - && FD_ISSET(mysockets[i], &masterset)) - { - FD_CLR(mysockets[i], &masterset); + if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET) close(mysockets[i]); - } mysockets[i] = ERRSOCKET; } + mysocketses = 0; } void I_ShutdownTcpDriver(void) @@ -1245,12 +1186,6 @@ static boolean SOCK_OpenSocket(void) I_NetFreeNodenum = SOCK_FreeNodenum; I_NetMakeNodewPort = SOCK_NetMakeNodewPort; -#ifdef SELECTTEST - // seem like not work with libsocket : ( - I_NetCanSend = SOCK_CanSend; - I_NetCanGet = SOCK_CanGet; -#endif - // build the socket but close it first SOCK_CloseSocket(); return UDP_Socket(); From 438de82c69185469ca86bf70c1ad3f291ceb198b Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Fri, 27 Sep 2024 19:47:54 -0300 Subject: [PATCH 210/353] Fix TRNSLATE lumps being recognized as valid sprite names --- src/r_things.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/r_things.c b/src/r_things.c index 432b5e10b..50855e2fc 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -279,6 +279,14 @@ static boolean GetFramesAndRotationsFromShortLumpName( *ret_rotation2 = R_Char2Rotation(name[7]); if (*ret_frame2 >= 64 || *ret_rotation2 == 255) return false; + + // TRNSLATE is a valid but extremely unlikely sprite name: + // * The sprite name is "TRNS" + // * The frame is L, rotation A; mirrored to frame T, rotation E + // In the very unfortunate event that TRNSLATE is found between sprite lumps, + // this name check prevents it from being added as a sprite, when it actually isn't. + if (memcmp(name, "TRNSLATE", 8) == 0) + return false; } else { From 6dbcd2ba19a103da615125190d154b5348bd8997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 29 Sep 2024 21:40:17 +0200 Subject: [PATCH 211/353] Fix buffer overflow when registering a dedicated build server on MS --- src/dedicated/i_threads.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dedicated/i_threads.c b/src/dedicated/i_threads.c index 6902e23a5..55c0a069e 100644 --- a/src/dedicated/i_threads.c +++ b/src/dedicated/i_threads.c @@ -157,7 +157,7 @@ void I_wake_all_cond(I_cond *anchor) pthread_mutex_lock(&thread_lock); if (*anchor == NULL) { - *anchor = malloc(sizeof(pthread_t)); + *anchor = malloc(sizeof(pthread_cond_t)); pthread_cond_init(*anchor, NULL); } pthread_mutex_unlock(&thread_lock); From a71257308e8ccd005f9876d746f587aae435e962 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 1 Oct 2024 20:30:01 -0300 Subject: [PATCH 212/353] Disallow any directories named LongSprites/ --- src/w_wad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/w_wad.c b/src/w_wad.c index 4a6900113..4a1d44548 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -2657,7 +2657,8 @@ static lumpchecklist_t folderblacklist[] = { {"Lua/", 4}, {"SOC/", 4}, - {"Sprites/", 8}, + {"Sprites/", 8}, + {"LongSprites/", 12}, {"Textures/", 9}, {"Patches/", 8}, {"Flats/", 6}, From c833d73e3225df5f27b6905383d3b8087c66a22a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sat, 5 Oct 2024 11:28:03 +0200 Subject: [PATCH 213/353] Fix potential segfault when flat images has changed on netcode --- src/p_saveg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index aad7351f0..d6f8d23c5 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1501,13 +1501,13 @@ static void UnArchiveSectors(save_t *save_p) sectors[i].ceilingheight = P_ReadFixed(save_p); if (diff & SD_FLOORPIC) { - sectors[i].floorpic = P_AddLevelFlatRuntime((char *)save_p); - save_p += 8; + sectors[i].floorpic = P_AddLevelFlatRuntime((char *)&save_p->buf[save_p->pos]); + save_p->pos += 8; } if (diff & SD_CEILPIC) { - sectors[i].ceilingpic = P_AddLevelFlatRuntime((char *)save_p); - save_p += 8; + sectors[i].ceilingpic = P_AddLevelFlatRuntime((char *)&save_p->buf[save_p->pos]); + save_p->pos += 8; } if (diff & SD_LIGHT) sectors[i].lightlevel = P_ReadINT16(save_p); From 455ffec1e4c2c3d7981d0b42534b2fa3b195d5c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Mon, 7 Oct 2024 15:48:42 +0200 Subject: [PATCH 214/353] Check for empty string before printing in console --- src/dedicated/i_system.c | 5 ++++- src/sdl/i_system.c | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 29a3e9511..e95ea3417 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -1035,6 +1035,9 @@ void I_OutputMsg(const char *fmt, ...) va_start(argptr,fmt); len = vsnprintf(NULL, 0, fmt, argptr); va_end(argptr); + if (len == 0) + return; + txt = malloc(len+1); va_start(argptr,fmt); vsprintf(txt, fmt, argptr); @@ -1134,7 +1137,7 @@ void I_OutputMsg(const char *fmt, ...) if (!framebuffer) fprintf(stderr, "%s", txt); #ifdef HAVE_TERMIOS - if (consolevent && txt[strlen(txt)-1] == '\n') + if (consolevent && txt[len-1] == '\n') { write(STDOUT_FILENO, tty_con.buffer, tty_con.cursor); ttycon_ateol = true; diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 8227cd52c..3eb70373b 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -840,9 +840,16 @@ static void I_RegisterChildSignals(void) void I_OutputMsg(const char *fmt, ...) { size_t len; - char txt[8192]; + char *txt; va_list argptr; + va_start(argptr,fmt); + len = vsnprintf(NULL, 0, fmt, argptr); + va_end(argptr); + if (len == 0) + return; + + txt = malloc(len+1); va_start(argptr,fmt); vsprintf(txt, fmt, argptr); va_end(argptr); @@ -876,7 +883,10 @@ void I_OutputMsg(const char *fmt, ...) DWORD bytesWritten; if (co == INVALID_HANDLE_VALUE) + { + free(txt); return; + } if (GetFileType(co) == FILE_TYPE_CHAR && GetConsoleMode(co, &bytesWritten)) { @@ -892,11 +902,16 @@ void I_OutputMsg(const char *fmt, ...) if (oldLength > 0) { LPVOID blank = malloc(oldLength); - if (!blank) return; + if (!blank) + { + free(txt); + return; + } memset(blank, ' ', oldLength); // Blank out. oldLines = malloc(oldLength*sizeof(TCHAR)); if (!oldLines) { + free(txt); free(blank); return; } @@ -941,7 +956,7 @@ void I_OutputMsg(const char *fmt, ...) if (!framebuffer) fprintf(stderr, "%s", txt); #ifdef HAVE_TERMIOS - if (consolevent && txt[strlen(txt)-1] == '\n') + if (consolevent && txt[len-1] == '\n') { write(STDOUT_FILENO, tty_con.buffer, tty_con.cursor); ttycon_ateol = true; @@ -953,6 +968,7 @@ void I_OutputMsg(const char *fmt, ...) fflush(stderr); #endif + free(txt); } // From 22ce859e65da2a0770d6966e0c1a3f32192cb54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 13 Oct 2024 14:06:45 +0200 Subject: [PATCH 215/353] Fix BootMap not having any effect when loaded from the addon menu --- src/deh_soc.c | 2 ++ src/dehacked.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index c0e646f60..a2be99fa0 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3549,6 +3549,8 @@ void readmaincfg(MYFILE *f) char *tmp; INT32 value; + bootmap = 0; // reset bootmap so we don't warp to the wrong map if another maincfg had set this before + do { if (myfgets(s, MAXLINELEN, f)) diff --git a/src/dehacked.c b/src/dehacked.c index 2050a117f..8743a482e 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -587,7 +587,12 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) if (gamestate == GS_TITLESCREEN) { - if (introchanged) + if (bootmap) + { + menuactive = false; + D_MapChange(bootmap, gametype, ultimatemode, true, 0, false, false); + } + else if (introchanged) { menuactive = false; I_UpdateMouseGrab(); From 0b2202e5cbc9f1139598e88cd68345bddf6d5000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 13 Oct 2024 16:50:41 +0200 Subject: [PATCH 216/353] Fix bootmap not resetting properly after reload --- src/deh_soc.c | 2 -- src/dehacked.c | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index a2be99fa0..c0e646f60 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3549,8 +3549,6 @@ void readmaincfg(MYFILE *f) char *tmp; INT32 value; - bootmap = 0; // reset bootmap so we don't warp to the wrong map if another maincfg had set this before - do { if (myfgets(s, MAXLINELEN, f)) diff --git a/src/dehacked.c b/src/dehacked.c index 8743a482e..505c7ed1f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -196,6 +196,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) deh_num_warning = 0; + bootmap = 0; gamedataadded = titlechanged = introchanged = false; // it doesn't test the version of SRB2 and version of dehacked file From 0dac4ed492fd78d801f939a8fef27fcf7a7c3655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 13 Oct 2024 17:47:56 +0200 Subject: [PATCH 217/353] Fix (hopufully) all remaining edge cases --- src/deh_soc.c | 1 + src/dehacked.c | 6 +++--- src/dehacked.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index c0e646f60..80a5358c0 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3925,6 +3925,7 @@ void readmaincfg(MYFILE *f) value = get_number(word2); bootmap = (INT16)value; + bootmapchanged = true; //titlechanged = true; } else if (fastcmp(word, "STARTCHAR")) diff --git a/src/dehacked.c b/src/dehacked.c index 505c7ed1f..473e77e55 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -20,6 +20,7 @@ boolean deh_loaded = false; boolean gamedataadded = false; boolean titlechanged = false; boolean introchanged = false; +boolean bootmapchanged = false; static int dbg_line; static INT32 deh_num_warning = 0; @@ -196,8 +197,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) deh_num_warning = 0; - bootmap = 0; - gamedataadded = titlechanged = introchanged = false; + gamedataadded = titlechanged = introchanged = bootmapchanged = false; // it doesn't test the version of SRB2 and version of dehacked file dbg_line = -1; // start at -1 so the first line is 0. @@ -588,7 +588,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) if (gamestate == GS_TITLESCREEN) { - if (bootmap) + if (bootmapchanged && bootmap) { menuactive = false; D_MapChange(bootmap, gametype, ultimatemode, true, 0, false, false); diff --git a/src/dehacked.h b/src/dehacked.h index d985b14b0..e7b9b4656 100644 --- a/src/dehacked.h +++ b/src/dehacked.h @@ -39,6 +39,7 @@ extern boolean deh_loaded; extern boolean gamedataadded; extern boolean titlechanged; extern boolean introchanged; +extern boolean bootmapchanged; #define MAX_ACTION_RECURSION 30 extern const char *luaactions[MAX_ACTION_RECURSION]; From 7b143cc87b3652c08bd2d934214d77cfa9b20a8e Mon Sep 17 00:00:00 2001 From: pastel Date: Tue, 15 Oct 2024 13:09:34 -0500 Subject: [PATCH 218/353] Disinclude unused function when NOMD5 --- src/w_wad.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 4a1d44548..6964f24aa 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -307,12 +307,10 @@ static void W_LoadDehackedLumps(UINT16 wadnum, boolean mainfile) * \param resblock resulting MD5 checksum * \return 0 if MD5 checksum was made, and is at resblock, 1 if error was found */ + +#ifndef NOMD5 static INT32 W_MakeFileMD5(const char *filename, void *resblock) { -#ifdef NOMD5 - (void)filename; - memset(resblock, 0x00, 16); -#else FILE *fhandle; if ((fhandle = fopen(filename, "rb")) != NULL) @@ -329,9 +327,9 @@ static INT32 W_MakeFileMD5(const char *filename, void *resblock) fclose(fhandle); return 0; } -#endif return 1; } +#endif // Invalidates the cache of lump numbers. Call this whenever a wad is added. static void W_InvalidateLumpnumCache(void) From 8e66ed73ab2371e89a548344e4ad26139e7d5db2 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Wed, 16 Oct 2024 17:46:37 -0500 Subject: [PATCH 219/353] Add mac universal fuse build scripts --- scripts/arm64-osx-1015.cmake | 7 +++++++ scripts/make-macos-universal.sh | 25 +++++++++++++++++++++++++ scripts/x64-osx-1015.cmake | 7 +++++++ 3 files changed, 39 insertions(+) create mode 100644 scripts/arm64-osx-1015.cmake create mode 100755 scripts/make-macos-universal.sh create mode 100644 scripts/x64-osx-1015.cmake diff --git a/scripts/arm64-osx-1015.cmake b/scripts/arm64-osx-1015.cmake new file mode 100644 index 000000000..224430bc1 --- /dev/null +++ b/scripts/arm64-osx-1015.cmake @@ -0,0 +1,7 @@ +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_OSX_DEPLOYMENT_TARGET 10.15) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES arm64) diff --git a/scripts/make-macos-universal.sh b/scripts/make-macos-universal.sh new file mode 100755 index 000000000..f1b17516c --- /dev/null +++ b/scripts/make-macos-universal.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# Makes a fused macOS Universal app bundle in the arm64 release preset dir +# Only works if in master branch or in source tarball + +set -e + +rm -rf "build/ninja-x64_osx_vcpkg-release" +rm -rf "build/ninja-arm64_osx_vcpkg-release" +cmake --preset ninja-x64_osx_vcpkg-release -DVCPKG_OVERLAY_TRIPLETS=scripts/ -DVCPKG_TARGET_TRIPLET=x64-osx-1015 -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 "-DSRB2_SDL2_EXE_NAME=srb2" +cmake --build --preset ninja-x64_osx_vcpkg-release +cmake --preset ninja-arm64_osx_vcpkg-release -DVCPKG_OVERLAY_TRIPLETS=scripts/ -DVCPKG_TARGET_TRIPLET=arm64-osx-1015 -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 "-DSRB2_SDL2_EXE_NAME=srb2" +cmake --build --preset ninja-arm64_osx_vcpkg-release + +mkdir -p build/dist +rm -rf "build/dist/Sonic Robo Blast 2.app" "build/dist/srb2.app" + +cp -r build/ninja-arm64_osx_vcpkg-release/bin/srb2.app build/dist/ + +lipo -create \ + -output "build/dist/srb2.app/Contents/MacOS/srb2" \ + build/ninja-x64_osx_vcpkg-release/bin/srb2.app/Contents/MacOS/srb2 \ + build/ninja-arm64_osx_vcpkg-release/bin/srb2.app/Contents/MacOS/srb2 + +mv build/dist/srb2.app "build/dist/Sonic Robo Blast 2.app" diff --git a/scripts/x64-osx-1015.cmake b/scripts/x64-osx-1015.cmake new file mode 100644 index 000000000..5f0c7b66e --- /dev/null +++ b/scripts/x64-osx-1015.cmake @@ -0,0 +1,7 @@ +set(VCPKG_TARGET_ARCHITECTURE x64) +set(VCPKG_OSX_DEPLOYMENT_TARGET 10.15) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) + +set(VCPKG_CMAKE_SYSTEM_NAME Darwin) +set(VCPKG_OSX_ARCHITECTURES x86_64) From a39422852662c415ca51bf41fb5809e24bae900b Mon Sep 17 00:00:00 2001 From: Hanicef Date: Tue, 24 Sep 2024 21:24:33 +0000 Subject: [PATCH 220/353] Revive Haiku build --- src/Makefile.d/detect.mk | 4 ++- src/Makefile.d/haiku.mk | 71 ++++++++++++++++++++++++++++++++++++++ src/Makefile.d/platform.mk | 4 +++ src/Makefile.d/sdl.mk | 12 ++++--- 4 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 src/Makefile.d/haiku.mk diff --git a/src/Makefile.d/detect.mk b/src/Makefile.d/detect.mk index 9e2736946..853ad3d6d 100644 --- a/src/Makefile.d/detect.mk +++ b/src/Makefile.d/detect.mk @@ -4,7 +4,6 @@ # Previously featured:\ PANDORA\ - HAIKU\ DUMMY\ DJGPPDOS\ SOLARIS\ @@ -17,6 +16,7 @@ all_systems:=\ UNIX\ LINUX\ FREEBSD\ + HAIKU\ # check for user specified system ifeq (,$(filter $(all_systems),$(.VARIABLES))) @@ -35,6 +35,8 @@ system:=$(shell uname -s) ifeq ($(system),Linux) new_system:=LINUX +else ifeq ($(system),Haiku) +new_system:=HAIKU else $(error \ diff --git a/src/Makefile.d/haiku.mk b/src/Makefile.d/haiku.mk new file mode 100644 index 000000000..6742ec75b --- /dev/null +++ b/src/Makefile.d/haiku.mk @@ -0,0 +1,71 @@ +# +# Makefile options for Haiku +# + +opts+=-DUNIXCOMMON -DLUA_USE_POSIX + +ifndef DEDICATED +ifndef DUMMY +SDL?=1 +DEDICATED?=0 +endif +endif + +NOEXECINFO=1 + +ifeq (${SDL},1) +EXENAME?=srb2haiku +else ifeq (${DEDICATED},1) +EXENAME?=srb2haikud +endif + +ifndef NONET +libs+=-lnetwork +endif + +define _set = +$(1)_CFLAGS?=$($(1)_opts) +$(1)_LDFLAGS?=$($(1)_libs) +endef + +lib:=../libs/gme +LIBGME_opts:=-I$(lib)/include +LIBGME_libs:=-l:libgme.so.0 +$(eval $(call _set,LIBGME)) + +lib:=../libs/libopenmpt +LIBOPENMPT_opts:=-I$(lib)/inc +LIBOPENMPT_libs:=-l:libopenmpt.so.0 +$(eval $(call _set,LIBOPENMPT)) + +ifdef SDL +lib:=../libs/SDL2_mixer +mixer_opts:=-I$(lib)/include +mixer_libs:=-l:libSDL2_mixer-2.0.so.0 + +lib:=../libs/SDL2 +SDL_opts:=-I$(lib)/include $(mixer_opts) +SDL_libs:=$(mixer_libs) -l:libSDL2-2.0.so.0 +$(eval $(call _set,SDL)) +endif + +lib:=../libs/zlib +ZLIB_opts:=-I$(lib) +ZLIB_libs:=-l:libz.so.1 +$(eval $(call _set,ZLIB)) + +ifndef PNG_CONFIG +PNG_opts:= +PNG_libs:=-l:libpng16.so.16 +$(eval $(call _set,PNG)) +endif + +lib:=../libs/curl +CURL_opts:=-I$(lib)/include +CURL_libs:=-l:libcurl.so.4 +$(eval $(call _set,CURL)) + +lib:=../libs/miniupnpc +MINIUPNPC_opts:=-I$(lib)/include +MINIUPNPC_libs:=-l:libminiupnpc.so.17 +$(eval $(call _set,MINIUPNPC)) diff --git a/src/Makefile.d/platform.mk b/src/Makefile.d/platform.mk index d9a2954f6..d5423a397 100644 --- a/src/Makefile.d/platform.mk +++ b/src/Makefile.d/platform.mk @@ -35,6 +35,10 @@ endif else ifdef FREEBSD UNIX=1 platform=freebsd +else ifdef HAIKU +# Give Haiku its own configuration, since it +# isn't actually UNIX. +include Makefile.d/haiku.mk else ifdef SOLARIS # FIXME: UNTESTED UNIX=1 platform=solaris diff --git a/src/Makefile.d/sdl.mk b/src/Makefile.d/sdl.mk index a1bfa3303..d5e83989c 100644 --- a/src/Makefile.d/sdl.mk +++ b/src/Makefile.d/sdl.mk @@ -33,11 +33,13 @@ else opts+=-DHAVE_MIXER sources+=sdl/mixer_sound.c - ifdef HAVE_MIXERX - opts+=-DHAVE_MIXERX - libs+=-lSDL2_mixer_ext - else - libs+=-lSDL2_mixer + ifndef HAIKU # Haiku has a special import path + ifdef HAVE_MIXERX + opts+=-DHAVE_MIXERX + libs+=-lSDL2_mixer_ext + else + libs+=-lSDL2_mixer + endif endif endif From ff1fc58b8d08ba538f7f97f786641774fa4de076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Wed, 30 Oct 2024 16:31:52 +0100 Subject: [PATCH 221/353] Fix skybox and horizon lines not being batched --- src/hardware/hw_batching.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index 7a57a7a12..5d1af10e2 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -114,7 +114,7 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt polygonArray[polygonArraySize].numVerts = iNumPts; polygonArray[polygonArraySize].polyFlags = PolyFlags; polygonArray[polygonArraySize].texture = current_texture; - polygonArray[polygonArraySize].shader = (shader_target != -1) ? HWR_GetShaderFromTarget(shader_target) : shader_target; + polygonArray[polygonArraySize].shader = (shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target; polygonArray[polygonArraySize].horizonSpecial = horizonSpecial; // default to polygonArraySize so we don't lose order on horizon lines // (yes, it's supposed to be negative, since we're sorting in that direction) @@ -311,7 +311,6 @@ void HWR_RenderBatches(void) int nextIndex = polygonIndexArray[polygonReadPos]; if (polygonArray[index].hash != polygonArray[nextIndex].hash) { - changeState = true; nextShader = polygonArray[nextIndex].shader; nextTexture = polygonArray[nextIndex].texture; nextPolyFlags = polygonArray[nextIndex].polyFlags; @@ -320,14 +319,17 @@ void HWR_RenderBatches(void) nextTexture = 0; if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable) { + changeState = true; changeShader = true; } if (currentTexture != nextTexture) { + changeState = true; changeTexture = true; } if (currentPolyFlags != nextPolyFlags) { + changeState = true; changePolyFlags = true; } if (cv_glshaders.value && gl_shadersavailable) @@ -339,6 +341,7 @@ void HWR_RenderBatches(void) currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start || currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end) { + changeState = true; changeSurfaceInfo = true; } } @@ -346,6 +349,7 @@ void HWR_RenderBatches(void) { if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba) { + changeState = true; changeSurfaceInfo = true; } } From 1fad5e0507f34b6dd5f8de89b2d80613ab0509de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 3 Nov 2024 17:30:05 +0100 Subject: [PATCH 222/353] Fix holes in FOF due to culling --- src/hardware/hw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4741c6a46..acc4da5fa 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2492,7 +2492,7 @@ static void HWR_Subsector(size_t num) if (gl_frontsector->cullheight) { - if (HWR_DoCulling(gl_frontsector->cullheight, viewsector->cullheight, gl_viewz, FIXED_TO_FLOAT(bottomCullHeight), FIXED_TO_FLOAT(topCullHeight))) + if (HWR_DoCulling(gl_frontsector->cullheight, viewsector->cullheight, gl_viewz, FIXED_TO_FLOAT(*rover->bottomheight), FIXED_TO_FLOAT(*rover->topheight))) continue; } From 4468219d7cf8b3cc36b89ec35dbb4d2efce095d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 3 Nov 2024 18:06:05 +0100 Subject: [PATCH 223/353] Ban by /64 by default instead of /128 --- src/netcode/i_tcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/netcode/i_tcp.c b/src/netcode/i_tcp.c index ed1f5b4e7..12774daf4 100644 --- a/src/netcode/i_tcp.c +++ b/src/netcode/i_tcp.c @@ -1273,7 +1273,7 @@ static boolean SOCK_Ban(INT32 node) else if (banned[numbans].any.sa_family == AF_INET6) { banned[numbans].ip6.sin6_port = 0; - bannedmask[numbans] = 128; + bannedmask[numbans] = 64; } #endif numbans++; @@ -1310,7 +1310,7 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask) bannedmask[numbans] = (UINT8)atoi(mask); #ifdef HAVE_IPV6 else if (runp->ai_family == AF_INET6) - bannedmask[numbans] = 128; + bannedmask[numbans] = 64; #endif else bannedmask[numbans] = 32; @@ -1319,7 +1319,7 @@ static boolean SOCK_SetBanAddress(const char *address, const char *mask) bannedmask[numbans] = 32; #ifdef HAVE_IPV6 else if (bannedmask[numbans] > 128 && runp->ai_family == AF_INET6) - bannedmask[numbans] = 128; + bannedmask[numbans] = 64; #endif numbans++; runp = runp->ai_next; From ebb63499e031f277062a7b8a382ffc54d956651b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Mon, 4 Nov 2024 21:07:15 +0100 Subject: [PATCH 224/353] Fix polyobject midtextures being stretched into infinity --- src/hardware/hw_main.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4741c6a46..e58b62113 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -954,6 +954,7 @@ static boolean HWR_BlendMidtextureSurface(FSurfaceInfo *pSurf) static void HWR_RenderMidtexture(INT32 gl_midtexture, float cliplow, float cliphigh, fixed_t worldtop, fixed_t worldbottom, fixed_t worldhigh, fixed_t worldlow, fixed_t worldtopslope, fixed_t worldbottomslope, fixed_t worldhighslope, fixed_t worldlowslope, UINT32 lightnum, FOutVector *inWallVerts) { + sector_t *front, *back; FOutVector wallVerts[4]; FSurfaceInfo Surf; @@ -963,6 +964,16 @@ static void HWR_RenderMidtexture(INT32 gl_midtexture, float cliplow, float cliph if (!HWR_BlendMidtextureSurface(&Surf)) return; + if (gl_linedef->frontsector->heightsec != -1) + front = §ors[gl_linedef->frontsector->heightsec]; + else + front = gl_linedef->frontsector; + + if (gl_linedef->backsector->heightsec != -1) + back = §ors[gl_linedef->backsector->heightsec]; + else + back = gl_linedef->backsector; + fixed_t texheight = FixedDiv(textureheight[gl_midtexture], abs(gl_sidedef->scaley_mid)); INT32 repeats; @@ -972,15 +983,15 @@ static void HWR_RenderMidtexture(INT32 gl_midtexture, float cliplow, float cliph { fixed_t high, low; - if (gl_frontsector->ceilingheight > gl_backsector->ceilingheight) - high = gl_backsector->ceilingheight; + if (front->ceilingheight > back->ceilingheight) + high = back->ceilingheight; else - high = gl_frontsector->ceilingheight; + high = front->ceilingheight; - if (gl_frontsector->floorheight > gl_backsector->floorheight) - low = gl_frontsector->floorheight; + if (front->floorheight > back->floorheight) + low = front->floorheight; else - low = gl_backsector->floorheight; + low = back->floorheight; repeats = (high - low) / texheight; if ((high - low) % texheight) @@ -1007,8 +1018,8 @@ static void HWR_RenderMidtexture(INT32 gl_midtexture, float cliplow, float cliph if (gl_curline->polyseg) { // Change this when polyobjects support slopes - popentop = popentopslope = gl_curline->backsector->ceilingheight; - popenbottom = popenbottomslope = gl_curline->backsector->floorheight; + popentop = popentopslope = back->ceilingheight; + popenbottom = popenbottomslope = back->floorheight; } else { From 2503e6c3502d0076849db242531be89572a6a26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Mon, 4 Nov 2024 21:55:42 +0100 Subject: [PATCH 225/353] Fix lag when touching collected emblems --- src/p_inter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index 19ab5ead4..dc606a47e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -836,7 +836,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { clientGamedata->collected[special->health-1] = true; M_UpdateUnlockablesAndExtraEmblems(clientGamedata); - G_SaveGameData(clientGamedata); + if (!prevCollected) // don't thrash the disk and wreak performance. + G_SaveGameData(clientGamedata); } if (netgame) From 79dd5de63b05a7264d2c3cd39a98cb55d20be76b Mon Sep 17 00:00:00 2001 From: Hanicef Date: Thu, 7 Nov 2024 18:59:13 +0000 Subject: [PATCH 226/353] Include Haiku for nanosleep sleeping --- src/sdl/i_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 9fe50a6a2..07088b957 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2307,7 +2307,7 @@ void I_Sleep(UINT32 ms) void I_SleepDuration(precise_t duration) { -#if defined(__linux__) || defined(__FreeBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__) UINT64 precision = I_GetPrecisePrecision(); struct timespec ts = { .tv_sec = duration / precision, From 3cf48e31d6efb04dc5f9cd6c0128e3a715530df7 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Thu, 7 Nov 2024 19:23:34 +0000 Subject: [PATCH 227/353] Fix netcode on Haiku --- src/netcode/i_tcp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/netcode/i_tcp.c b/src/netcode/i_tcp.c index ed1f5b4e7..442ed9817 100644 --- a/src/netcode/i_tcp.c +++ b/src/netcode/i_tcp.c @@ -1211,11 +1211,16 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port) // test ip address of server for (i = 0; i < mysocketses; ++i) { +#ifdef __HAIKU__ + // Haiku doesn't appreciate empty packets, so just hope for the best. + if (runp->ai_addr->sa_family == myfamily[i]) +#else /* sendto tests that there is a network to this address */ if (runp->ai_addr->sa_family == myfamily[i] && sendto(mysockets[i], NULL, 0, 0, runp->ai_addr, runp->ai_addrlen) == 0) +#endif { memcpy(&clientaddress[newnode], runp->ai_addr, runp->ai_addrlen); break; From 0a611b0f09b5a3108c1cf4ed806a1df0a7f645e7 Mon Sep 17 00:00:00 2001 From: Jordan Christiansen Date: Wed, 6 Nov 2024 19:59:58 -0600 Subject: [PATCH 228/353] Convert waddir to an absolute path Since we change directories to the waddir, if waddir is a relative path, it will be invalidated after changing directories. Converting it to an absolute path means we can change directories without messing anything up. Fixes #1310 --- src/dedicated/i_system.c | 2 ++ src/sdl/i_system.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 23c0149ca..91cc18d9f 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -1453,8 +1453,10 @@ const char *I_LocateWad(void) { // change to the directory where we found srb2.pk3 #if defined (_WIN32) + waddir = _fullpath(NULL, waddir, MAX_PATH); SetCurrentDirectoryA(waddir); #else + waddir = realpath(waddir, NULL); if (chdir(waddir) == -1) I_OutputMsg("Couldn't change working directory\n"); #endif diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 9fe50a6a2..d8fb4346b 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -3087,8 +3087,10 @@ const char *I_LocateWad(void) { // change to the directory where we found srb2.pk3 #if defined (_WIN32) + waddir = _fullpath(NULL, waddir, MAX_PATH); SetCurrentDirectoryA(waddir); #else + waddir = realpath(waddir, NULL); if (chdir(waddir) == -1) I_OutputMsg("Couldn't change working directory\n"); #endif From bd9c6a7d623a5049e17ad90c40dd85fc2d95f718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 10 Nov 2024 16:59:47 +0100 Subject: [PATCH 229/353] Fix inconsistency in master server listing --- src/netcode/i_tcp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/netcode/i_tcp.c b/src/netcode/i_tcp.c index 87cc94a0c..a27249dcb 100644 --- a/src/netcode/i_tcp.c +++ b/src/netcode/i_tcp.c @@ -1152,11 +1152,7 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port) // test ip address of server for (i = 0; i < mysocketses; ++i) { - /* sendto tests that there is a network to this - address */ - if (runp->ai_addr->sa_family == myfamily[i] && - sendto(mysockets[i], NULL, 0, 0, - runp->ai_addr, runp->ai_addrlen) == 0) + if (runp->ai_addr->sa_family == myfamily[i]) { memcpy(&clientaddress[newnode], runp->ai_addr, runp->ai_addrlen); break; From b796a2cc32759ef07c43aee9ae8f88a2e96fb487 Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 3 Sep 2024 23:57:16 +0200 Subject: [PATCH 230/353] Disable UDMF console notice --- 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 2524803ab..39be19d54 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2995,7 +2995,7 @@ static void P_LoadTextmap(void) side_t *sd; mapthing_t *mt; - CONS_Alert(CONS_NOTICE, "UDMF support is still a work-in-progress; its specs and features are prone to change until it is fully implemented.\n"); + //CONS_Alert(CONS_NOTICE, "UDMF support is still a work-in-progress; its specs and features are prone to change until it is fully implemented.\n"); /// Given the UDMF specs, some fields are given a default value. /// If an element's field has a default value set, it is omitted From 01d99f4c4a7e220ad58f51d06b2874b536751b78 Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 29 Aug 2024 15:40:53 +0200 Subject: [PATCH 231/353] Use FF_SEMIBRIGHT for some more common objects --- src/info.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/info.c b/src/info.c index a138db8a4..715fe5d53 100644 --- a/src/info.c +++ b/src/info.c @@ -1784,8 +1784,8 @@ state_t states[NUMSTATES] = {SPR_RING, FF_ANIMATE|FF_GLOBALANIM, -1, {NULL}, 23, 1, S_RING, 0}, // S_RING // Blue Sphere for special stages - {SPR_SPHR, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BLUESPHERE - {SPR_SPHR, FF_FULLBRIGHT + {SPR_SPHR, FF_SEMIBRIGHT, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BLUESPHERE + {SPR_SPHR, FF_SEMIBRIGHT #ifdef MANIASPHERES |FF_ANIMATE|FF_RANDOMANIM #endif @@ -1794,13 +1794,13 @@ state_t states[NUMSTATES] = // Bomb Sphere {SPR_SPHR, FF_FULLBRIGHT|3, 2, {NULL}, 0, 0, S_BOMBSPHERE2, 0}, // S_BOMBSPHERE1 - {SPR_SPHR, FF_FULLBRIGHT|4, 1, {NULL}, 0, 0, S_BOMBSPHERE3, 0}, // S_BOMBSPHERE2 - {SPR_SPHR, FF_FULLBRIGHT|5, 2, {NULL}, 0, 0, S_BOMBSPHERE4, 0}, // S_BOMBSPHERE3 - {SPR_SPHR, FF_FULLBRIGHT|4, 1, {NULL}, 0, 0, S_BOMBSPHERE1, 0}, // S_BOMBSPHERE4 + {SPR_SPHR, FF_SEMIBRIGHT|4, 1, {NULL}, 0, 0, S_BOMBSPHERE3, 0}, // S_BOMBSPHERE2 + {SPR_SPHR, FF_SEMIBRIGHT|5, 2, {NULL}, 0, 0, S_BOMBSPHERE4, 0}, // S_BOMBSPHERE3 + {SPR_SPHR, FF_SEMIBRIGHT|4, 1, {NULL}, 0, 0, S_BOMBSPHERE1, 0}, // S_BOMBSPHERE4 // NiGHTS Chip - {SPR_NCHP, FF_FULLBRIGHT|FF_ANIMATE, -1, {NULL}, 15, 2, S_NULL, 0}, // S_NIGHTSCHIP - {SPR_NCHP, FF_FULLBRIGHT|FF_ANIMATE|16, -1, {NULL}, 15, 2, S_NULL, 0}, // S_NIGHTSCHIPBONUS + {SPR_NCHP, FF_SEMIBRIGHT|FF_ANIMATE, -1, {NULL}, 15, 2, S_NULL, 0}, // S_NIGHTSCHIP + {SPR_NCHP, FF_SEMIBRIGHT|FF_ANIMATE|16, -1, {NULL}, 15, 2, S_NULL, 0}, // S_NIGHTSCHIPBONUS // NiGHTS Star {SPR_NSTR, FF_ANIMATE, -1, {NULL}, 14, 2, S_NULL, 0}, // S_NIGHTSSTAR @@ -1858,9 +1858,9 @@ state_t states[NUMSTATES] = {SPR_CEMG, FF_FULLBRIGHT|6, -1, {NULL}, 0, 0, S_NULL, 0}, // S_CEMG7 // Emerald hunt shards - {SPR_SHRD, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD1 - {SPR_SHRD, 1, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD2 - {SPR_SHRD, 2, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD3 + {SPR_SHRD, FF_SEMIBRIGHT, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD1 + {SPR_SHRD, FF_SEMIBRIGHT|1, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD2 + {SPR_SHRD, FF_SEMIBRIGHT|2, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHRD3 // Bubble Source {SPR_BBLS, 0, 8, {A_BubbleSpawn}, 2048, 0, S_BUBBLES2, 0}, // S_BUBBLES1 From 702c7bd63d3adae9f4b75d333af4a98fe3fd768b Mon Sep 17 00:00:00 2001 From: spherallic Date: Thu, 12 Sep 2024 19:18:40 +0200 Subject: [PATCH 232/353] Fix -opengl parameter crash --- src/hardware/hw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 2a886a1c6..9cfeaeeb2 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5605,7 +5605,7 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player) // Can't have palette rendering if shaders are disabled. boolean HWR_ShouldUsePaletteRendering(void) { - return (cv_glpaletterendering.value && HWR_UseShader()); + return (pMasterPalette != NULL && cv_glpaletterendering.value && HWR_UseShader()); } // enable or disable palette rendering state depending on settings and availability From 4bb857b0ecfaf4982b87dfe0d350706b17650368 Mon Sep 17 00:00:00 2001 From: spherallic Date: Tue, 25 Jun 2024 17:23:05 +0200 Subject: [PATCH 233/353] Enable OpenGL palette rendering by default --- src/hardware/hw_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 9cfeaeeb2..e208a91b6 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5722,7 +5722,7 @@ consvar_t cv_glbatching = CVAR_INIT ("gr_batching", "On", 0, CV_OnOff, NULL); static CV_PossibleValue_t glpalettedepth_cons_t[] = {{16, "16 bits"}, {24, "24 bits"}, {0, NULL}}; -consvar_t cv_glpaletterendering = CVAR_INIT ("gr_paletterendering", "Off", CV_SAVE|CV_CALL, CV_OnOff, CV_glpaletterendering_OnChange); +consvar_t cv_glpaletterendering = CVAR_INIT ("gr_paletterendering", "On", CV_SAVE|CV_CALL, CV_OnOff, CV_glpaletterendering_OnChange); consvar_t cv_glpalettedepth = CVAR_INIT ("gr_palettedepth", "16 bits", CV_SAVE|CV_CALL, glpalettedepth_cons_t, CV_glpalettedepth_OnChange); #define ONLY_IF_GL_LOADED if (vid.glstate != VID_GL_LIBRARY_LOADED) return; From 46ef724942dc068dbb2f6445281df6c1f58a641f Mon Sep 17 00:00:00 2001 From: Neon Date: Wed, 13 Nov 2024 04:19:36 +0000 Subject: [PATCH 234/353] A_LavafallLava: prevent a modulus by 0 --- 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 2ae7276df..59ca95409 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -14395,7 +14395,7 @@ void A_LavafallLava(mobj_t *actor) if (LUA_CallAction(A_LAVAFALLLAVA, actor)) return; - if ((40 - actor->fuse) % (2*(actor->scale >> FRACBITS))) + if ((40 - actor->fuse) % max(2*(actor->scale >> FRACBITS), 1)) // avoid crashes if actor->scale < FRACUNIT return; // Don't spawn lava unless a player is nearby. From 05d9b59fe9c2677d103c73f633a537e9420dd0cd Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 24 Nov 2024 05:09:07 -0300 Subject: [PATCH 235/353] Fix sector portal heights --- src/p_saveg.c | 8 ++++---- src/p_spec.c | 10 +++++----- src/r_defs.h | 5 ++--- src/r_portal.c | 35 +++++++++++++++++++++++++---------- src/r_portal.h | 2 +- 5 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index d6f8d23c5..7d858807c 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -5239,8 +5239,8 @@ static void P_NetArchiveSectorPortals(save_t *save_p) UINT8 type = secportals[i].type; P_WriteUINT8(save_p, type); - P_WriteFixed(save_p, secportals[i].origin.x); - P_WriteFixed(save_p, secportals[i].origin.y); + P_WriteUINT8(save_p, secportals[i].ceiling ? 1 : 0); + P_WriteUINT32(save_p, SaveSector(secportals[i].target)); switch (type) { @@ -5283,8 +5283,8 @@ static void P_NetUnArchiveSectorPortals(save_t *save_p) sectorportal_t *secportal = &secportals[id]; secportal->type = P_ReadUINT8(save_p); - secportal->origin.x = P_ReadFixed(save_p); - secportal->origin.y = P_ReadFixed(save_p); + secportal->ceiling = (P_ReadUINT8(save_p) != 0) ? true : false; + secportal->target = LoadSector(P_ReadUINT32(save_p)); switch (secportal->type) { diff --git a/src/p_spec.c b/src/p_spec.c index 6f3543161..9b124f9af 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -6236,7 +6236,7 @@ static void P_DoPortalCopyFromLine(sector_t *dest_sector, int plane_type, int ta } } -static sectorportal_t *P_SectorGetPortalOrCreate(sector_t *sector, UINT32 *num, UINT32 *result) +static sectorportal_t *P_SectorGetPortalOrCreate(sector_t *sector, UINT32 *num, UINT32 *result, boolean ceiling) { sectorportal_t *secportal = NULL; @@ -6244,8 +6244,8 @@ static sectorportal_t *P_SectorGetPortalOrCreate(sector_t *sector, UINT32 *num, { *num = P_NewSectorPortal(); secportal = &secportals[*num]; - secportal->origin.x = sector->soundorg.x; - secportal->origin.y = sector->soundorg.y; + secportal->target = sector; + secportal->ceiling = ceiling; *result = *num; } else @@ -6259,12 +6259,12 @@ static sectorportal_t *P_SectorGetPortalOrCreate(sector_t *sector, UINT32 *num, static sectorportal_t *P_SectorGetFloorPortalOrCreate(sector_t *sector, UINT32 *result) { - return P_SectorGetPortalOrCreate(sector, §or->portal_floor, result); + return P_SectorGetPortalOrCreate(sector, §or->portal_floor, result, false); } static sectorportal_t *P_SectorGetCeilingPortalOrCreate(sector_t *sector, UINT32 *result) { - return P_SectorGetPortalOrCreate(sector, §or->portal_ceiling, result); + return P_SectorGetPortalOrCreate(sector, §or->portal_ceiling, result, true); } static void P_CopySectorPortalToLines(UINT32 portal_num, int sector_tag) diff --git a/src/r_defs.h b/src/r_defs.h index 51fac21fa..7db5701d5 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -242,9 +242,8 @@ typedef struct sectorportal_s struct sector_s *sector; struct mobj_s *mobj; }; - struct { - fixed_t x, y; - } origin; + struct sector_s *target; + boolean ceiling; } sectorportal_t; typedef struct ffloor_s diff --git a/src/r_portal.c b/src/r_portal.c index 4d042cae3..c3eb4888c 100644 --- a/src/r_portal.c +++ b/src/r_portal.c @@ -142,11 +142,9 @@ void Portal_Remove (portal_t* portal) Z_Free(portal); } -static void Portal_GetViewpointForLine(portal_t *portal, line_t *start, line_t *dest) +static void Portal_GetViewpointForLine(portal_t *portal, line_t *start, line_t *dest, angle_t dangle) { // Offset the portal view by the linedef centers - angle_t dangle = R_PointToAngle2(0,0,dest->dx,dest->dy) - R_PointToAngle2(start->dx,start->dy,0,0); - fixed_t disttopoint; angle_t angtopoint; @@ -168,7 +166,6 @@ static void Portal_GetViewpointForLine(portal_t *portal, line_t *start, line_t * portal->viewx = dest_c.x + FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint); portal->viewy = dest_c.y + FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint); - portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight; portal->viewangle = viewangle + dangle; } @@ -189,7 +186,11 @@ void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, con line_t* start = &lines[line1]; line_t* dest = &lines[line2]; - Portal_GetViewpointForLine(portal, start, dest); + angle_t dangle = R_PointToAngle2(0,0,dest->dx,dest->dy) - R_PointToAngle2(start->dx,start->dy,0,0); + + Portal_GetViewpointForLine(portal, start, dest, dangle); + + portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight; portal->clipline = line2; portal->is_skybox = false; @@ -332,10 +333,23 @@ static void Portal_GetViewpointForSecPortal(portal_t *portal, sectorportal_t *se fixed_t x, y, z; angle_t angle; + sector_t *target = secportal->target; + + fixed_t target_x = target->soundorg.x; + fixed_t target_y = target->soundorg.y; + fixed_t target_z; + + if (secportal->ceiling) + target_z = P_GetSectorCeilingZAt(target, target_x, target_y); + else + target_z = P_GetSectorFloorZAt(target, target_x, target_y); + switch (secportal->type) { case SECPORTAL_LINE: - Portal_GetViewpointForLine(portal, secportal->line.start, secportal->line.dest); + angle = secportal->line.dest->angle - secportal->line.start->angle; + Portal_GetViewpointForLine(portal, secportal->line.start, secportal->line.dest, angle); + portal->viewz = viewz; // Apparently it just works like that. Not going to question it. return; case SECPORTAL_OBJECT: if (!secportal->mobj || P_MobjWasRemoved(secportal->mobj)) @@ -373,8 +387,9 @@ static void Portal_GetViewpointForSecPortal(portal_t *portal, sectorportal_t *se return; } - fixed_t refx = secportal->origin.x - viewx; - fixed_t refy = secportal->origin.y - viewy; + fixed_t refx = target_x - viewx; + fixed_t refy = target_y - viewy; + fixed_t refz = target_z - viewz; // Rotate the X/Y to match the target angle if (angle != 0) @@ -387,7 +402,7 @@ static void Portal_GetViewpointForSecPortal(portal_t *portal, sectorportal_t *se portal->viewx = x - refx; portal->viewy = y - refy; - portal->viewz = z + viewz; + portal->viewz = z - refz; portal->viewangle = angle + viewangle; } @@ -425,7 +440,7 @@ static boolean Portal_AddSectorPortal (const visplane_t* plane) /** Creates a transferred sector portal. */ -void Portal_AddTransferred (UINT32 secportalnum, const INT32 x1, const INT32 x2) +void Portal_AddTransferred (const UINT32 secportalnum, const INT32 x1, const INT32 x2) { if (secportalnum >= secportalcount) return; diff --git a/src/r_portal.h b/src/r_portal.h index 2485e45a7..05250c0be 100644 --- a/src/r_portal.h +++ b/src/r_portal.h @@ -58,7 +58,7 @@ extern INT32 portalclipstart, portalclipend; void Portal_InitList (void); void Portal_Remove (portal_t* portal); void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, const INT32 x2); -void Portal_AddTransferred (UINT32 secportalnum, const INT32 x1, const INT32 x2); +void Portal_AddTransferred (const UINT32 secportalnum, const INT32 x1, const INT32 x2); void Portal_ClipRange (portal_t* portal); void Portal_ClipApply (const portal_t* portal); From 5194ed81ad9defbfd4eb6012001d6de26c4742ed Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 24 Nov 2024 13:33:28 -0300 Subject: [PATCH 236/353] Fix colormap textures not being updated for palette shaders --- src/hardware/hw_cache.c | 57 +++++++++++++++++++++++--------- src/hardware/hw_drv.h | 2 ++ src/hardware/hw_glob.h | 3 +- src/hardware/r_opengl/r_opengl.c | 18 ++++++++++ src/lua_colorlib.c | 2 +- src/r_data.c | 9 +++++ src/r_data.h | 1 + src/r_defs.h | 7 ++-- src/sdl/hwsym_sdl.c | 1 + src/sdl/i_video.c | 1 + src/z_zone.c | 1 + src/z_zone.h | 1 + 12 files changed, 83 insertions(+), 20 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index f282ca891..b71bf7007 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -1258,20 +1258,29 @@ void HWR_SetMapPalette(void) // Creates a hardware lighttable from the supplied lighttable. // Returns the id of the hw lighttable, usable in FSurfaceInfo. -UINT32 HWR_CreateLightTable(UINT8 *lighttable) +UINT32 HWR_CreateLightTable(UINT8 *lighttable, RGBA_t *hw_lighttable) { - UINT32 i, id; + UINT32 i; RGBA_t *palette = HWR_GetTexturePalette(); - RGBA_t *hw_lighttable = Z_Malloc(256 * 32 * sizeof(RGBA_t), PU_STATIC, NULL); // To make the palette index -> RGBA mapping easier for the shader, // the hardware lighttable is composed of RGBA colors instead of palette indices. for (i = 0; i < 256 * 32; i++) hw_lighttable[i] = palette[lighttable[i]]; - id = HWD.pfnCreateLightTable(hw_lighttable); - Z_Free(hw_lighttable); - return id; + return HWD.pfnCreateLightTable(hw_lighttable); +} + +// Updates a hardware lighttable of a given id from the supplied lighttable. +void HWR_UpdateLightTable(UINT32 id, UINT8 *lighttable, RGBA_t *hw_lighttable) +{ + UINT32 i; + RGBA_t *palette = HWR_GetTexturePalette(); + + for (i = 0; i < 256 * 32; i++) + hw_lighttable[i] = palette[lighttable[i]]; + + HWD.pfnUpdateLightTable(id, hw_lighttable); } // get hwr lighttable id for colormap, create it if it doesn't already exist @@ -1285,25 +1294,41 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap) default_colormap = true; } - // create hw lighttable if there isn't one - if (!colormap->gl_lighttable_id) - { - UINT8 *colormap_pointer; + UINT8 *colormap_pointer; - if (default_colormap) - colormap_pointer = colormaps; // don't actually use the data from the "default colormap" - else - colormap_pointer = colormap->colormap; - colormap->gl_lighttable_id = HWR_CreateLightTable(colormap_pointer); + if (default_colormap) + colormap_pointer = colormaps; // don't actually use the data from the "default colormap" + else + colormap_pointer = colormap->colormap; + + // create hw lighttable if there isn't one + if (colormap->gl_lighttable.data == NULL) + { + Z_Malloc(256 * 32 * sizeof(RGBA_t), PU_HWRLIGHTTABLEDATA, &colormap->gl_lighttable.data); } - return colormap->gl_lighttable_id; + // Generate the texture for this light table + if (!colormap->gl_lighttable.id) + { + colormap->gl_lighttable.id = HWR_CreateLightTable(colormap_pointer, colormap->gl_lighttable.data); + } + // Update the texture if it was directly changed by a script + else if (colormap->gl_lighttable.needs_update) + { + HWR_UpdateLightTable(colormap->gl_lighttable.id, colormap_pointer, colormap->gl_lighttable.data); + } + + colormap->gl_lighttable.needs_update = false; + + return colormap->gl_lighttable.id; } // Note: all hardware lighttable ids assigned before this // call become invalid and must not be used. void HWR_ClearLightTables(void) { + Z_FreeTag(PU_HWRLIGHTTABLEDATA); + if (vid.glstate == VID_GL_LIBRARY_LOADED) HWD.pfnClearLightTables(); } diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index 694cc1b8c..a5fdc00a4 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -71,6 +71,7 @@ EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value); EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut); EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable); +EXPORT void HWRAPI(UpdateLightTable)(UINT32 id, RGBA_t *hw_lighttable); EXPORT void HWRAPI(ClearLightTables)(void); EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette); @@ -125,6 +126,7 @@ struct hwdriver_s SetPaletteLookup pfnSetPaletteLookup; CreateLightTable pfnCreateLightTable; + UpdateLightTable pfnUpdateLightTable; ClearLightTables pfnClearLightTables; SetScreenPalette pfnSetScreenPalette; }; diff --git a/src/hardware/hw_glob.h b/src/hardware/hw_glob.h index 62fe8d0bd..bf9f7da3b 100644 --- a/src/hardware/hw_glob.h +++ b/src/hardware/hw_glob.h @@ -133,7 +133,8 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch); void HWR_SetPalette(RGBA_t *palette); void HWR_SetMapPalette(void); -UINT32 HWR_CreateLightTable(UINT8 *lighttable); +UINT32 HWR_CreateLightTable(UINT8 *lighttable, RGBA_t *hw_lighttable); +void HWR_UpdateLightTable(UINT32 id, UINT8 *lighttable, RGBA_t *hw_lighttable); UINT32 HWR_GetLightTableID(extracolormap_t *colormap); void HWR_ClearLightTables(void); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 75a92c2fb..85a50edb0 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -3257,6 +3257,24 @@ EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable) return item->id; } +EXPORT void HWRAPI(UpdateLightTable)(UINT32 id, RGBA_t *hw_lighttable) +{ + LTListItem *item = LightTablesHead; + while (item && item->id != id) + item = item->next; + + if (item) + { + pglBindTexture(GL_TEXTURE_2D, item->id); + + // Just update it + pglTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 256, 32, GL_RGBA, GL_UNSIGNED_BYTE, hw_lighttable); + + // restore previously bound texture + pglBindTexture(GL_TEXTURE_2D, tex_downloaded); + } +} + // Delete light table textures, ids given before become invalid and must not be used. EXPORT void HWRAPI(ClearLightTables)(void) { diff --git a/src/lua_colorlib.c b/src/lua_colorlib.c index 9e679eb40..2743635ed 100644 --- a/src/lua_colorlib.c +++ b/src/lua_colorlib.c @@ -593,7 +593,7 @@ static int extracolormap_set(lua_State *L) || exc->fadergba != old_fade_rgba || exc->fadestart != old_fade_start || exc->fadeend != old_fade_end) - R_GenerateLightTable(exc, true); + R_UpdateLightTable(exc, true); return 0; } diff --git a/src/r_data.c b/src/r_data.c index e7200ecbd..244690ebe 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -849,6 +849,15 @@ void R_GenerateLightTable(extracolormap_t *extra_colormap, boolean uselookup) } } +void R_UpdateLightTable(extracolormap_t *extra_colormap, boolean uselookup) +{ + R_GenerateLightTable(extra_colormap, uselookup); + +#ifdef HWRENDER + extra_colormap->gl_lighttable.needs_update = true; +#endif +} + extracolormap_t *R_CreateColormapFromLinedef(char *p1, char *p2, char *p3) { // default values diff --git a/src/r_data.h b/src/r_data.h index 7c6ee19d5..64abf6d83 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -90,6 +90,7 @@ typedef enum } textmapcolormapflags_t; void R_GenerateLightTable(extracolormap_t *extra_colormap, boolean uselookup); +void R_UpdateLightTable(extracolormap_t *extra_colormap, boolean uselookup); lighttable_t *R_CreateLightTable(extracolormap_t *extra_colormap); extracolormap_t * R_CreateColormapFromLinedef(char *p1, char *p2, char *p3); extracolormap_t* R_CreateColormap(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags); diff --git a/src/r_defs.h b/src/r_defs.h index 51fac21fa..7269aa9d5 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -76,8 +76,11 @@ typedef struct extracolormap_s lighttable_t *colormap; #ifdef HWRENDER - // The id of the hardware lighttable. Zero means it does not exist yet. - UINT32 gl_lighttable_id; + struct { + UINT32 id; // The id of the hardware lighttable. Zero means it does not exist yet. + RGBA_t *data; // The texture data of the hardware lighttable. + boolean needs_update; // If the colormap changed recently or not. + } gl_lighttable; #endif #ifdef EXTRACOLORMAPLUMPS diff --git a/src/sdl/hwsym_sdl.c b/src/sdl/hwsym_sdl.c index ca87fcc79..f56126601 100644 --- a/src/sdl/hwsym_sdl.c +++ b/src/sdl/hwsym_sdl.c @@ -112,6 +112,7 @@ void *hwSym(const char *funcName,void *handle) GETFUNC(SetPaletteLookup); GETFUNC(CreateLightTable); + GETFUNC(UpdateLightTable); GETFUNC(ClearLightTables); GETFUNC(SetScreenPalette); diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 10c866a1e..36bfd380f 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -1901,6 +1901,7 @@ void VID_StartupOpenGL(void) HWD.pfnSetPaletteLookup = hwSym("SetPaletteLookup",NULL); HWD.pfnCreateLightTable = hwSym("CreateLightTable",NULL); + HWD.pfnUpdateLightTable = hwSym("UpdateLightTable",NULL); HWD.pfnClearLightTables = hwSym("ClearLightTables",NULL); HWD.pfnSetScreenPalette = hwSym("SetScreenPalette",NULL); diff --git a/src/z_zone.c b/src/z_zone.c index 5750f8ae0..0852fabae 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -671,6 +671,7 @@ static void Command_Memfree_f(void) 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("Light table textures : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRLIGHTTABLEDATA)>>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); } diff --git a/src/z_zone.h b/src/z_zone.h index ce7af4a15..56c540c3b 100644 --- a/src/z_zone.h +++ b/src/z_zone.h @@ -55,6 +55,7 @@ enum PU_HWRPATCHINFO = 21, // Hardware GLPatch_t struct for OpenGL texture cache PU_HWRPATCHCOLMIPMAP = 22, // Hardware GLMipmap_t struct colormap variation of patch PU_HWRMODELTEXTURE = 23, // Hardware model texture + PU_HWRLIGHTTABLEDATA = 24, // Hardware light table data PU_HWRCACHE = 48, // static until unlocked PU_CACHE = 49, // static until unlocked From 1c02badd47adfe071ca92e76b8953b3524304b14 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 30 Nov 2024 09:53:07 -0300 Subject: [PATCH 237/353] Set r_viewmobj when rendering type 8 sector portals --- src/r_main.c | 3 +++ src/r_portal.c | 21 ++++----------------- src/r_portal.h | 2 ++ 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 32e3138eb..ee05876da 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1434,6 +1434,9 @@ static void R_PortalFrame(portal_t *portal) viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT); viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT); + if (!P_MobjWasRemoved(portal->viewmobj)) + r_viewmobj = portal->viewmobj; + portalclipstart = portal->start; portalclipend = portal->end; diff --git a/src/r_portal.c b/src/r_portal.c index c3eb4888c..957d574b2 100644 --- a/src/r_portal.c +++ b/src/r_portal.c @@ -101,7 +101,7 @@ void Portal_ClipApply (const portal_t* portal) static portal_t* Portal_Add (const INT16 x1, const INT16 x2) { - portal_t *portal = Z_Malloc(sizeof(portal_t), PU_LEVEL, NULL); + portal_t *portal = Z_Calloc(sizeof(portal_t), PU_LEVEL, NULL); INT16 *ceilingclipsave = Z_Malloc(sizeof(INT16)*(x2-x1 + 1), PU_LEVEL, NULL); INT16 *floorclipsave = Z_Malloc(sizeof(INT16)*(x2-x1 + 1), PU_LEVEL, NULL); fixed_t *frontscalesave = Z_Malloc(sizeof(fixed_t)*(x2-x1 + 1), PU_LEVEL, NULL); @@ -117,7 +117,7 @@ static portal_t* Portal_Add (const INT16 x1, const INT16 x2) portal_cap->next = portal; portal_cap = portal; } - portal->next = NULL; + portal->clipline = -1; // Store clipping values so they can be restored once the portal is rendered. portal->ceilingclip = ceilingclipsave; @@ -193,9 +193,6 @@ void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, con portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight; portal->clipline = line2; - portal->is_skybox = false; - portal->is_horizon = false; - portal->horizon_sector = NULL; Portal_ClipRange(portal); @@ -318,10 +315,7 @@ static boolean Portal_AddSkybox (const visplane_t* plane) Portal_ClipVisplane(plane, portal); - portal->clipline = -1; portal->is_skybox = true; - portal->is_horizon = false; - portal->horizon_sector = NULL; Portal_GetViewpointForSkybox(portal); @@ -352,8 +346,9 @@ static void Portal_GetViewpointForSecPortal(portal_t *portal, sectorportal_t *se portal->viewz = viewz; // Apparently it just works like that. Not going to question it. return; case SECPORTAL_OBJECT: - if (!secportal->mobj || P_MobjWasRemoved(secportal->mobj)) + if (P_MobjWasRemoved(secportal->mobj)) return; + portal->viewmobj = secportal->mobj; x = secportal->mobj->x; y = secportal->mobj->y; z = secportal->mobj->z; @@ -428,11 +423,6 @@ static boolean Portal_AddSectorPortal (const visplane_t* plane) Portal_ClipVisplane(plane, portal); - portal->clipline = -1; - portal->is_horizon = false; - portal->is_skybox = false; - portal->horizon_sector = NULL; - Portal_GetViewpointForSecPortal(portal, secportal); return true; @@ -450,9 +440,6 @@ void Portal_AddTransferred (const UINT32 secportalnum, const INT32 x1, const INT return; portal_t* portal = Portal_Add(x1, x2); - portal->is_skybox = false; - portal->is_horizon = false; - portal->horizon_sector = NULL; if (secportal->type == SECPORTAL_SKYBOX) Portal_GetViewpointForSkybox(portal); diff --git a/src/r_portal.h b/src/r_portal.h index 05250c0be..5190885b7 100644 --- a/src/r_portal.h +++ b/src/r_portal.h @@ -36,6 +36,8 @@ typedef struct portal_s boolean is_skybox; + mobj_t *viewmobj; + UINT8 pass; /**< Keeps track of the portal's recursion depth. */ INT32 clipline; /**< Optional clipline for line-based portals. */ From c9318599c7a0683294d5c88f12f576c0dd655d63 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 30 Nov 2024 10:25:30 -0300 Subject: [PATCH 238/353] Skip unchanged value validation in CV_SetCVar if there is a can_change callback --- src/command.c | 2 +- src/netcode/d_netcmd.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/command.c b/src/command.c index 399714bd0..8f9166361 100644 --- a/src/command.c +++ b/src/command.c @@ -1988,7 +1988,7 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth) if (!var->string) I_Error("CV_Set: %s no string set!\n", var->name); #endif - if (!var || !var->string || !value || !stricmp(var->string, value)) + if (!var || !var->string || !value || (var->can_change == NULL && !stricmp(var->string, value))) return; // no changes if (var->flags & CV_NETVAR) diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index 64feeeda3..961de44c2 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -4910,14 +4910,16 @@ static void Name2_OnChange(void) static boolean Skin_CanChange(const char *valstr) { - (void)valstr; - if (!Playing()) return true; // do whatever you want if (!(multiplayer || netgame)) // In single player. return true; + // You already are that skin. + if (stricmp(skins[players[consoleplayer].skin]->name, valstr) == 0) + return false; + if (CanChangeSkin(consoleplayer) && !P_PlayerMoving(consoleplayer)) return true; else @@ -4929,11 +4931,13 @@ static boolean Skin_CanChange(const char *valstr) static boolean Skin2_CanChange(const char *valstr) { - (void)valstr; - if (!Playing() || !splitscreen) return true; // do whatever you want + // You already are that skin. + if (stricmp(skins[players[secondarydisplayplayer].skin]->name, valstr) == 0) + return false; + if (CanChangeSkin(secondarydisplayplayer) && !P_PlayerMoving(secondarydisplayplayer)) return true; else From 17a1136960e6941e96e44db6953e444695a0ff78 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 30 Nov 2024 10:33:41 -0300 Subject: [PATCH 239/353] Move these two lines up --- src/netcode/d_netcmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index 961de44c2..630999cd0 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -4913,13 +4913,13 @@ static boolean Skin_CanChange(const char *valstr) if (!Playing()) return true; // do whatever you want - if (!(multiplayer || netgame)) // In single player. - return true; - // You already are that skin. if (stricmp(skins[players[consoleplayer].skin]->name, valstr) == 0) return false; + if (!(multiplayer || netgame)) // In single player. + return true; + if (CanChangeSkin(consoleplayer) && !P_PlayerMoving(consoleplayer)) return true; else From 50db80f001213330e6d5ef17a4bada4032d67dfd Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 30 Nov 2024 10:58:28 -0300 Subject: [PATCH 240/353] Remove keypad handling in M_HandleConnectIP There is no need to have that code anymore, since keypad presses also generate ev_text events. Additionally, made text fields in menus ignore ev_keydown events if they are keypad keys. --- src/m_menu.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 2e4a42506..63a702474 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3401,7 +3401,7 @@ boolean M_Responder(event_t *ev) { // ignore ev_keydown events if the key maps to a character, since // the ev_text event will follow immediately after in that case. - if (ev->type == ev_keydown && ch >= 32 && ch <= 127) + if (ev->type == ev_keydown && ((ch >= 32 && ch <= 127) || (ch >= KEY_KEYPAD7 && ch <= KEY_KPADDEL))) return true; routine(ch); @@ -12195,15 +12195,6 @@ static void M_HandleConnectIP(INT32 choice) setupm_ip[l] = (char)choice; setupm_ip[l+1] = 0; } - else if (choice >= 199 && choice <= 211 && choice != 202 && choice != 206) //numpad too! - { - char keypad_translation[] = {'7','8','9','-','4','5','6','+','1','2','3','0','.'}; - choice = keypad_translation[choice - 199]; - S_StartSound(NULL,sfx_menu1); // Tails - setupm_ip[l] = (char)choice; - setupm_ip[l+1] = 0; - } - break; } From a531499b8f19a1cd67f2a79436e9c8a7a2153bf7 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 30 Nov 2024 11:47:43 -0300 Subject: [PATCH 241/353] Fix regression in P_SetupStateAnimation --- 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 b377ff82f..fb9e7d78e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -90,7 +90,7 @@ static void P_SetupStateAnimation(mobj_t *mobj, state_t *st) if (mobj->sprite == SPR_PLAY && mobj->skin) { spritedef_t *spritedef = P_GetSkinSpritedef(mobj->skin, mobj->sprite2); - animlength = (INT32)(spritedef->numframes); + animlength = (INT32)(spritedef->numframes) - 1; } else animlength = st->var1; From 54dde5305f56fe25d22d5e44375c6ff9a8abf470 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 30 Nov 2024 12:15:51 -0300 Subject: [PATCH 242/353] Implement blended rendering for tilted splat planes Also, fixed a bug where OpenGL would not render a plane with regular transparency if it had the splat flag. --- src/hardware/hw_main.c | 4 +- src/r_draw.h | 2 + src/r_draw8.c | 130 +++++++++++++++++++++++++++ src/r_draw8_npo2.c | 198 +++++++++++++++++++++++++++++++++++++++++ src/r_plane.c | 3 + src/screen.c | 2 + src/screen.h | 1 + 7 files changed, 338 insertions(+), 2 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index e208a91b6..4c1753654 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2530,7 +2530,7 @@ static void HWR_Subsector(size_t num) alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, false, rover->master->frontsector->extra_colormap); } - else if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend) // SoM: Flags are more efficient + else if (rover->fofflags & FOF_TRANSLUCENT || rover->blend) // SoM: Flags are more efficient { light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false); @@ -2576,7 +2576,7 @@ static void HWR_Subsector(size_t num) alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, false, rover->master->frontsector->extra_colormap); } - else if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend) + else if (rover->fofflags & FOF_TRANSLUCENT || rover->blend) { light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false); diff --git a/src/r_draw.h b/src/r_draw.h index 00032e44f..d5c5b4e25 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -173,6 +173,7 @@ void R_DrawTiltedTranslucentSpan_8(void); void R_DrawSplat_8(void); void R_DrawTranslucentSplat_8(void); void R_DrawTiltedSplat_8(void); +void R_DrawTiltedTranslucentSplat_8(void); void R_DrawFloorSprite_8(void); void R_DrawTranslucentFloorSprite_8(void); @@ -194,6 +195,7 @@ void R_DrawTiltedTranslucentSpan_NPO2_8(void); void R_DrawSplat_NPO2_8(void); void R_DrawTranslucentSplat_NPO2_8(void); void R_DrawTiltedSplat_NPO2_8(void); +void R_DrawTiltedTranslucentSplat_NPO2_8(void); void R_DrawFloorSprite_NPO2_8(void); void R_DrawTranslucentFloorSprite_NPO2_8(void); diff --git a/src/r_draw8.c b/src/r_draw8.c index 220878f88..c720f454e 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -1301,6 +1301,136 @@ void R_DrawTiltedSplat_8(void) #endif } +void R_DrawTiltedTranslucentSplat_8(void) +{ + // x1, x2 = ds_x1, ds_x2 + int width = ds_x2 - ds_x1; + double iz, uz, vz; + UINT32 u, v; + int i; + + UINT8 *source; + UINT8 *colormap; + UINT8 *dest; + + UINT8 val; + + double startz, startu, startv; + double izstep, uzstep, vzstep; + double endz, endu, endv; + UINT32 stepu, stepv; + + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); + uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx); + vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx); + + R_CalcSlopeLight(); + + dest = &topleft[ds_y*vid.width + ds_x1]; + source = ds_source; + //colormap = ds_colormap; + +#if 0 // The "perfect" reference version of this routine. Pretty slow. + // Use it only to see how things are supposed to look. + i = 0; + do + { + double z = 1.f/iz; + u = (INT64)(uz*z); + v = (INT64)(vz*z); + + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + + val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; + if (val != TRANSPARENTPIXEL) + *dest = *(ds_transmap + (colormap[val] << 8) + *dest); + + dest++; + iz += ds_sz.x; + uz += ds_su.x; + vz += ds_sv.x; + } while (--width >= 0); +#else + startz = 1.f/iz; + startu = uz*startz; + startv = vz*startz; + + izstep = ds_sz.x * SPANSIZE; + uzstep = ds_su.x * SPANSIZE; + vzstep = ds_sv.x * SPANSIZE; + //x1 = 0; + width++; + + while (width >= SPANSIZE) + { + iz += izstep; + uz += uzstep; + vz += vzstep; + + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + stepu = (INT64)((endu - startu) * INVSPAN); + stepv = (INT64)((endv - startv) * INVSPAN); + u = (INT64)(startu); + v = (INT64)(startv); + + for (i = SPANSIZE-1; i >= 0; i--) + { + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; + if (val != TRANSPARENTPIXEL) + *dest = *(ds_transmap + (colormap[val] << 8) + *dest); + dest++; + u += stepu; + v += stepv; + } + startu = endu; + startv = endv; + width -= SPANSIZE; + } + if (width > 0) + { + if (width == 1) + { + u = (INT64)(startu); + v = (INT64)(startv); + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; + if (val != TRANSPARENTPIXEL) + *dest = *(ds_transmap + (colormap[val] << 8) + *dest); + } + else + { + double left = width; + iz += ds_sz.x * left; + uz += ds_su.x * left; + vz += ds_sv.x * left; + + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + left = 1.f/left; + stepu = (INT64)((endu - startu) * left); + stepv = (INT64)((endv - startv) * left); + u = (INT64)(startu); + v = (INT64)(startv); + + for (; width != 0; width--) + { + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + val = source[((v >> nflatyshift) & nflatmask) | (u >> nflatxshift)]; + if (val != TRANSPARENTPIXEL) + *dest = *(ds_transmap + (colormap[val] << 8) + *dest); + dest++; + u += stepu; + v += stepv; + } + } + } +#endif +} + /** \brief The R_DrawSplat_8 function Just like R_DrawSpan_8, but skips transparent pixels. */ diff --git a/src/r_draw8_npo2.c b/src/r_draw8_npo2.c index 6213ecbc5..7fbb40d84 100644 --- a/src/r_draw8_npo2.c +++ b/src/r_draw8_npo2.c @@ -666,6 +666,204 @@ void R_DrawTiltedSplat_NPO2_8(void) #endif } +void R_DrawTiltedTranslucentSplat_NPO2_8(void) +{ + // x1, x2 = ds_x1, ds_x2 + int width = ds_x2 - ds_x1; + double iz, uz, vz; + UINT32 u, v; + int i; + + UINT8 *source; + UINT8 *colormap; + UINT8 *dest; + + UINT8 val; + + double startz, startu, startv; + double izstep, uzstep, vzstep; + double endz, endu, endv; + UINT32 stepu, stepv; + + struct libdivide_u32_t x_divider = libdivide_u32_gen(ds_flatwidth); + struct libdivide_u32_t y_divider = libdivide_u32_gen(ds_flatheight); + + iz = ds_sz.z + ds_sz.y*(centery-ds_y) + ds_sz.x*(ds_x1-centerx); + uz = ds_su.z + ds_su.y*(centery-ds_y) + ds_su.x*(ds_x1-centerx); + vz = ds_sv.z + ds_sv.y*(centery-ds_y) + ds_sv.x*(ds_x1-centerx); + + R_CalcSlopeLight(); + + dest = &topleft[ds_y*vid.width + ds_x1]; + source = ds_source; + //colormap = ds_colormap; + +#if 0 // The "perfect" reference version of this routine. Pretty slow. + // Use it only to see how things are supposed to look. + i = 0; + do + { + double z = 1.f/iz; + u = (INT64)(uz*z); + v = (INT64)(vz*z); + + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + + // Lactozilla: Non-powers-of-two + { + fixed_t x = (((fixed_t)u) >> FRACBITS); + fixed_t y = (((fixed_t)v) >> FRACBITS); + + // Carefully align all of my Friends. + if (x < 0) + x += (libdivide_u32_do((UINT32)(-x-1), &x_divider) + 1) * ds_flatwidth; + else + x -= libdivide_u32_do((UINT32)x, &x_divider) * ds_flatwidth; + if (y < 0) + y += (libdivide_u32_do((UINT32)(-y-1), &y_divider) + 1) * ds_flatheight; + else + y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight; + + val = source[((y * ds_flatwidth) + x)]; + } + + if (val != TRANSPARENTPIXEL) + *dest = *(ds_transmap + (colormap[val] << 8) + *dest); + + dest++; + iz += ds_sz.x; + uz += ds_su.x; + vz += ds_sv.x; + } while (--width >= 0); +#else + startz = 1.f/iz; + startu = uz*startz; + startv = vz*startz; + + izstep = ds_sz.x * SPANSIZE; + uzstep = ds_su.x * SPANSIZE; + vzstep = ds_sv.x * SPANSIZE; + //x1 = 0; + width++; + + while (width >= SPANSIZE) + { + iz += izstep; + uz += uzstep; + vz += vzstep; + + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + stepu = (INT64)((endu - startu) * INVSPAN); + stepv = (INT64)((endv - startv) * INVSPAN); + u = (INT64)(startu); + v = (INT64)(startv); + + for (i = SPANSIZE-1; i >= 0; i--) + { + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + // Lactozilla: Non-powers-of-two + { + fixed_t x = (((fixed_t)u) >> FRACBITS); + fixed_t y = (((fixed_t)v) >> FRACBITS); + + // Carefully align all of my Friends. + if (x < 0) + x += (libdivide_u32_do((UINT32)(-x-1), &x_divider) + 1) * ds_flatwidth; + else + x -= libdivide_u32_do((UINT32)x, &x_divider) * ds_flatwidth; + if (y < 0) + y += (libdivide_u32_do((UINT32)(-y-1), &y_divider) + 1) * ds_flatheight; + else + y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight; + + val = source[((y * ds_flatwidth) + x)]; + } + if (val != TRANSPARENTPIXEL) + *dest = *(ds_transmap + (colormap[val] << 8) + *dest); + dest++; + u += stepu; + v += stepv; + } + startu = endu; + startv = endv; + width -= SPANSIZE; + } + if (width > 0) + { + if (width == 1) + { + u = (INT64)(startu); + v = (INT64)(startv); + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + // Lactozilla: Non-powers-of-two + { + fixed_t x = (((fixed_t)u) >> FRACBITS); + fixed_t y = (((fixed_t)v) >> FRACBITS); + + // Carefully align all of my Friends. + if (x < 0) + x += (libdivide_u32_do((UINT32)(-x-1), &x_divider) + 1) * ds_flatwidth; + else + x -= libdivide_u32_do((UINT32)x, &x_divider) * ds_flatwidth; + if (y < 0) + y += (libdivide_u32_do((UINT32)(-y-1), &y_divider) + 1) * ds_flatheight; + else + y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight; + + val = source[((y * ds_flatwidth) + x)]; + } + if (val != TRANSPARENTPIXEL) + *dest = *(ds_transmap + (colormap[val] << 8) + *dest); + } + else + { + double left = width; + iz += ds_sz.x * left; + uz += ds_su.x * left; + vz += ds_sv.x * left; + + endz = 1.f/iz; + endu = uz*endz; + endv = vz*endz; + left = 1.f/left; + stepu = (INT64)((endu - startu) * left); + stepv = (INT64)((endv - startv) * left); + u = (INT64)(startu); + v = (INT64)(startv); + + for (; width != 0; width--) + { + colormap = planezlight[tiltlighting[ds_x1++]] + (ds_colormap - colormaps); + // Lactozilla: Non-powers-of-two + { + fixed_t x = (((fixed_t)u) >> FRACBITS); + fixed_t y = (((fixed_t)v) >> FRACBITS); + + // Carefully align all of my Friends. + if (x < 0) + x += (libdivide_u32_do((UINT32)(-x-1), &x_divider) + 1) * ds_flatwidth; + else + x -= libdivide_u32_do((UINT32)x, &x_divider) * ds_flatwidth; + if (y < 0) + y += (libdivide_u32_do((UINT32)(-y-1), &y_divider) + 1) * ds_flatheight; + else + y -= libdivide_u32_do((UINT32)y, &y_divider) * ds_flatheight; + + val = source[((y * ds_flatwidth) + x)]; + } + if (val != TRANSPARENTPIXEL) + *dest = *(ds_transmap + (colormap[val] << 8) + *dest); + dest++; + u += stepu; + v += stepv; + } + } + } +#endif +} + /** \brief The R_DrawSplat_NPO2_8 function Just like R_DrawSpan_NPO2_8, but skips transparent pixels. */ diff --git a/src/r_plane.c b/src/r_plane.c index 380f39eab..7642a4dd6 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -1079,6 +1079,9 @@ void R_DrawSinglePlane(visplane_t *pl) case SPANDRAWFUNC_SPLAT: spanfunctype = SPANDRAWFUNC_TILTEDSPLAT; break; + case SPANDRAWFUNC_TRANSSPLAT: + spanfunctype = SPANDRAWFUNC_TILTEDTRANSSPLAT; + break; case SPANDRAWFUNC_SOLID: spanfunctype = SPANDRAWFUNC_TILTEDSOLID; break; diff --git a/src/screen.c b/src/screen.c index a2c1f04da..781d22335 100644 --- a/src/screen.c +++ b/src/screen.c @@ -124,6 +124,7 @@ void SCR_SetDrawFuncs(void) spanfuncs[SPANDRAWFUNC_SPLAT] = R_DrawSplat_8; spanfuncs[SPANDRAWFUNC_TRANSSPLAT] = R_DrawTranslucentSplat_8; spanfuncs[SPANDRAWFUNC_TILTEDSPLAT] = R_DrawTiltedSplat_8; + spanfuncs[SPANDRAWFUNC_TILTEDTRANSSPLAT] = R_DrawTiltedTranslucentSplat_8; spanfuncs[SPANDRAWFUNC_SPRITE] = R_DrawFloorSprite_8; spanfuncs[SPANDRAWFUNC_TRANSSPRITE] = R_DrawTranslucentFloorSprite_8; spanfuncs[SPANDRAWFUNC_TILTEDSPRITE] = R_DrawTiltedFloorSprite_8; @@ -146,6 +147,7 @@ void SCR_SetDrawFuncs(void) spanfuncs_npo2[SPANDRAWFUNC_SPLAT] = R_DrawSplat_NPO2_8; spanfuncs_npo2[SPANDRAWFUNC_TRANSSPLAT] = R_DrawTranslucentSplat_NPO2_8; spanfuncs_npo2[SPANDRAWFUNC_TILTEDSPLAT] = R_DrawTiltedSplat_NPO2_8; + spanfuncs_npo2[SPANDRAWFUNC_TILTEDTRANSSPLAT] = R_DrawTiltedTranslucentSplat_NPO2_8; spanfuncs_npo2[SPANDRAWFUNC_SPRITE] = R_DrawFloorSprite_NPO2_8; spanfuncs_npo2[SPANDRAWFUNC_TRANSSPRITE] = R_DrawTranslucentFloorSprite_NPO2_8; spanfuncs_npo2[SPANDRAWFUNC_TILTEDSPRITE] = R_DrawTiltedFloorSprite_NPO2_8; diff --git a/src/screen.h b/src/screen.h index 6d45560c4..3ce593a52 100644 --- a/src/screen.h +++ b/src/screen.h @@ -115,6 +115,7 @@ enum SPANDRAWFUNC_SPLAT, SPANDRAWFUNC_TRANSSPLAT, SPANDRAWFUNC_TILTEDSPLAT, + SPANDRAWFUNC_TILTEDTRANSSPLAT, SPANDRAWFUNC_SPRITE, SPANDRAWFUNC_TRANSSPRITE, From a5488e200591279d3155de9d0891173a199d2a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 1 Dec 2024 15:59:19 +0100 Subject: [PATCH 243/353] Fix connecting to localhost on non-standard ports --- src/netcode/d_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/netcode/d_net.c b/src/netcode/d_net.c index 99859ea4c..4860d8688 100644 --- a/src/netcode/d_net.c +++ b/src/netcode/d_net.c @@ -1143,7 +1143,7 @@ static void Internal_FreeNodenum(INT32 nodenum) char *I_NetSplitAddress(char *host, char **port) { - boolean v4 = (strchr(host, '.') != NULL); + boolean v4 = (host[0] != '['); host = strtok(host, v4 ? ":" : "[]"); From e7e7a5c472f262462e72886321b9087f101c8a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 1 Dec 2024 16:19:13 +0100 Subject: [PATCH 244/353] Fix crash when spawning a BOT_2PAI on a 2D map --- src/p_setup.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 39be19d54..baa08a67d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7645,20 +7645,20 @@ static void P_InitCamera(void) CV_SetValue(&cv_analog[1], 0); displayplayer = consoleplayer; // Start with your OWN view, please! - } - if (twodlevel) - { - CV_SetValue(&cv_analog[0], false); - CV_SetValue(&cv_analog[1], false); - } - else - { - if (cv_useranalog[0].value) - CV_SetValue(&cv_analog[0], true); + if (twodlevel) + { + CV_SetValue(&cv_analog[0], false); + CV_SetValue(&cv_analog[1], false); + } + else + { + if (cv_useranalog[0].value) + CV_SetValue(&cv_analog[0], true); - if ((splitscreen && cv_useranalog[1].value) || botingame) - CV_SetValue(&cv_analog[1], true); + if ((splitscreen && cv_useranalog[1].value) || botingame) + CV_SetValue(&cv_analog[1], true); + } } } From a40d5dccdc0074411bc17218f024ac9d462e3734 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 1 Dec 2024 22:11:48 -0300 Subject: [PATCH 245/353] Don't consider 3D floors as transparent if they have FOF_SPLAT and an alpha of 255 --- src/hardware/hw_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4c1753654..da8965454 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -1692,7 +1692,7 @@ static void HWR_ProcessSeg(void) { blendmode = PF_Masked; - if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend) + if ((rover->fofflags & FOF_TRANSLUCENT && !((rover->fofflags & FOF_SPLAT) && rover->alpha >= 255)) || rover->blend) { blendmode = rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent; Surf.PolyColor.s.alpha = max(0, min(rover->alpha, 255)); @@ -1849,7 +1849,7 @@ static void HWR_ProcessSeg(void) { blendmode = PF_Masked; - if ((rover->fofflags & FOF_TRANSLUCENT && !(rover->fofflags & FOF_SPLAT)) || rover->blend) + if ((rover->fofflags & FOF_TRANSLUCENT && !((rover->fofflags & FOF_SPLAT) && rover->alpha >= 255)) || rover->blend) { blendmode = rover->blend ? HWR_GetBlendModeFlag(rover->blend) : PF_Translucent; Surf.PolyColor.s.alpha = max(0, min(rover->alpha, 255)); @@ -2530,7 +2530,7 @@ static void HWR_Subsector(size_t num) alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, false, rover->master->frontsector->extra_colormap); } - else if (rover->fofflags & FOF_TRANSLUCENT || rover->blend) // SoM: Flags are more efficient + else if ((rover->fofflags & FOF_TRANSLUCENT && !((rover->fofflags & FOF_SPLAT) && rover->alpha >= 255)) || rover->blend) // SoM: Flags are more efficient { light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < bottomCullHeight ? true : false); @@ -2576,7 +2576,7 @@ static void HWR_Subsector(size_t num) alpha, rover->master->frontsector, PF_Fog|PF_NoTexture, true, false, rover->master->frontsector->extra_colormap); } - else if (rover->fofflags & FOF_TRANSLUCENT || rover->blend) + else if ((rover->fofflags & FOF_TRANSLUCENT && !((rover->fofflags & FOF_SPLAT) && rover->alpha >= 255)) || rover->blend) { light = R_GetPlaneLight(gl_frontsector, centerHeight, viewz < topCullHeight ? true : false); From 389f25638dd47815f413472f93ed6b85bdd978cc Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sun, 1 Dec 2024 20:43:18 -0500 Subject: [PATCH 246/353] GitLab CI: timeout apt-get update command with 2 minutes --- .gitlab/ci/templates/srb2ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/ci/templates/srb2ci.yml b/.gitlab/ci/templates/srb2ci.yml index 3716d9df9..bdf8a3ed6 100644 --- a/.gitlab/ci/templates/srb2ci.yml +++ b/.gitlab/ci/templates/srb2ci.yml @@ -61,7 +61,7 @@ - - | # apt_update echo -e "\e[0Ksection_start:`date +%s`:apt_update[collapsed=true]\r\e[0KUpdating APT listing" - - apt-get update + - timeout 2m apt-get update || timeout 2m apt-get update - | # apt_update echo -e "\e[0Ksection_end:`date +%s`:apt_update\r\e[0K" From 14199102b7d1ba1d58e8b905c6a55442d576d00a Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Tue, 3 Dec 2024 19:57:29 +0100 Subject: [PATCH 247/353] Fix AddonLoaded hook --- src/p_setup.c | 6 ++---- src/w_wad.c | 10 ++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 4356e0574..cf549680f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -530,7 +530,7 @@ UINT32 P_GetScoreForGradeOverall(INT16 map, UINT8 grade) void P_AddNiGHTSTimes(INT16 i, char *gtext) { char *spos = gtext; - + for (UINT8 n = 0; n < 8; n++) { if (spos != NULL) @@ -3075,7 +3075,7 @@ static void P_LoadTextmap(void) // TODO: remove this limitation in a backwards-compatible way (UDMF versioning?) UINT8 lightalpha = (textmap_colormap.lightalpha * 102) / 10; UINT8 fadealpha = (textmap_colormap.fadealpha * 102) / 10; - + INT32 rgba = P_ColorToRGBA(textmap_colormap.lightcolor, lightalpha); INT32 fadergba = P_ColorToRGBA(textmap_colormap.fadecolor, fadealpha); sc->extra_colormap = sc->spawn_extra_colormap = R_CreateColormap(rgba, fadergba, textmap_colormap.fadestart, textmap_colormap.fadeend, textmap_colormap.flags); @@ -8464,8 +8464,6 @@ static boolean P_LoadAddon(UINT16 numlumps) SendNetXCmd(XD_EXITLEVEL, NULL, 0); } - LUA_HookVoid(HOOK(AddonLoaded)); - return true; } diff --git a/src/w_wad.c b/src/w_wad.c index 6964f24aa..57dd09de6 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -65,6 +65,7 @@ #include "i_video.h" // rendermode #include "md5.h" #include "lua_script.h" +#include "lua_hook.h" #ifdef SCANTHINGS #include "p_setup.h" // P_ScanThings #endif @@ -1009,6 +1010,10 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup) break; } + lua_lumploading++; + LUA_HookVoid(HOOK(AddonLoaded)); + lua_lumploading--; + W_InvalidateLumpnumCache(); return wadfile->numlumps; } @@ -1169,6 +1174,11 @@ UINT16 W_InitFolder(const char *path, boolean mainfile, boolean startup) W_ReadFileShaders(wadfile); W_LoadTrnslateLumps(numwadfiles - 1); W_LoadDehackedLumpsPK3(numwadfiles - 1, mainfile); + + lua_lumploading++; + LUA_HookVoid(HOOK(AddonLoaded)); + lua_lumploading--; + W_InvalidateLumpnumCache(); return wadfile->numlumps; From cef4cfe4121a60ede42f83b1628ba121d475198a Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Fri, 6 Dec 2024 03:12:52 -0300 Subject: [PATCH 248/353] Fix P_NetArchiveSectorPortals --- src/p_saveg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_saveg.c b/src/p_saveg.c index 7d858807c..e939cf8e3 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -5255,8 +5255,8 @@ static void P_NetArchiveSectorPortals(save_t *save_p) P_WriteUINT32(save_p, SaveSector(secportals[i].sector)); break; case SECPORTAL_OBJECT: - if (secportals[i].mobj && !P_MobjWasRemoved(secportals[i].mobj)) - SaveMobjnum(secportals[i].mobj); + if (!P_MobjWasRemoved(secportals[i].mobj)) + P_WriteUINT32(save_p, SaveMobjnum(secportals[i].mobj)); else P_WriteUINT32(save_p, 0); break; From 98aed03f15b8e2012011a130626adc466f5d8af0 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 7 Dec 2024 17:41:39 -0300 Subject: [PATCH 249/353] Fix HWR_ClearLightTables being called too late extracolormaps own the OpenGL-specific light table data, so that has to be freed earlier. --- src/p_setup.c | 3 +++ src/r_data.c | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 8f0d13190..906195c18 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -8002,6 +8002,9 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) // Free GPU textures before freeing patches. if (rendermode == render_opengl && (vid.glstate == VID_GL_LIBRARY_LOADED)) HWR_ClearAllTextures(); + + // Delete light table textures + HWR_ClearLightTables(); #endif Patch_FreeTag(PU_PATCH_LOWPRIORITY); diff --git a/src/r_data.c b/src/r_data.c index 244690ebe..32faa07a8 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -426,9 +426,6 @@ void R_ClearColormaps(void) { // Purged by PU_LEVEL, just overwrite the pointer extra_colormaps = R_CreateDefaultColormap(true); -#ifdef HWRENDER - HWR_ClearLightTables(); -#endif } // From 608e236d90473a8f3313f2fb8b84c79d849dc2e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sat, 7 Dec 2024 23:11:59 +0100 Subject: [PATCH 250/353] Fix segfault when accessing skin from lua on a delayed removal --- src/lua_mobjlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua_mobjlib.c b/src/lua_mobjlib.c index ebe995ea8..6bdebf774 100644 --- a/src/lua_mobjlib.c +++ b/src/lua_mobjlib.c @@ -198,12 +198,12 @@ static int mobj_get(lua_State *L) enum mobj_e field = Lua_optoption(L, 2, -1, mobj_fields_ref); lua_settop(L, 2); - if (!mo || !ISINLEVEL) { + if (P_MobjWasRemoved(mo) || !ISINLEVEL) { if (field == mobj_valid) { lua_pushboolean(L, 0); return 1; } - if (!mo) { + if (P_MobjWasRemoved(mo)) { return LUA_ErrInvalid(L, "mobj_t"); } else return luaL_error(L, "Do not access an mobj_t field outside a level!"); From 2b2df194dc7f389309a4b56dfdc676e0cdac8951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 8 Dec 2024 16:13:45 +0100 Subject: [PATCH 251/353] Fix performance regressions in addon loading --- src/w_wad.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/w_wad.c b/src/w_wad.c index 57dd09de6..50ba622a9 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1358,17 +1358,6 @@ UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump) return i; } -// Returns 0 if the folder is not empty, 1 if it is empty, -1 if it doesn't exist -INT32 W_IsFolderEmpty(const char *name, UINT16 wad) -{ - UINT16 start = W_CheckNumForFolderStartPK3(name, wad, 0); - if (start == INT16_MAX) - return -1; - - // Unlike W_CheckNumForFolderStartPK3, W_CheckNumForFolderEndPK3 doesn't return INT16_MAX. - return W_CheckNumForFolderEndPK3(name, wad, start) <= start; -} - char *W_GetLumpFolderPathPK3(UINT16 wad, UINT16 lump) { const char *fullname = wadfiles[wad]->lumpinfo[lump].fullname; @@ -1733,10 +1722,14 @@ static UINT16 W_CheckNumForPatchNamePwad(const char *name, UINT16 wad, boolean l // TODO: cache namespace lump IDs if (W_FileHasFolders(wadfiles[wad])) { - if (!W_IsFolderEmpty("Flats/", wad)) + start = W_CheckNumForFolderStartPK3("Flats/", wad, 0); + end = W_CheckNumForFolderEndPK3("Flats/", wad, start); + + // if the start and end is the same, the folder is empty + if (end <= start) { - start = W_CheckNumForFolderStartPK3("Flats/", wad, 0); - end = W_CheckNumForFolderEndPK3("Flats/", wad, start); + start = INT16_MAX; + end = INT16_MAX; } } else From bf23d61dc17bc4c97e29644fd9152fc8aba22e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 8 Dec 2024 20:32:04 +0100 Subject: [PATCH 252/353] Remove W_IsFolderEmpty header definition --- src/w_wad.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/w_wad.h b/src/w_wad.h index 5872ae50a..84aafa3a4 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -180,7 +180,6 @@ UINT16 W_CheckNumForMarkerStartPwad(const char *name, UINT16 wad, UINT16 startlu UINT16 W_CheckNumForFullNamePK3(const char *name, UINT16 wad, UINT16 startlump); UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlump); UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump); -INT32 W_IsFolderEmpty(const char *name, UINT16 wad); char *W_GetLumpFolderPathPK3(UINT16 wad, UINT16 lump); char *W_GetLumpFolderNamePK3(UINT16 wad, UINT16 lump); From 5fd606ead34a9e02811aaee9a27492dd4b703f8b Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Fri, 13 Dec 2024 15:18:27 -0300 Subject: [PATCH 253/353] Fix #1324 --- src/d_think.h | 2 ++ src/f_finale.c | 2 +- src/g_demo.c | 4 ++-- src/g_game.c | 2 +- src/lua_script.c | 4 ++-- src/m_cheat.c | 4 ++-- src/m_perfstats.c | 2 +- src/netcode/d_clisrv.c | 2 +- src/p_enemy.c | 14 +++++++------- src/p_inter.c | 16 ++++++++-------- src/p_mobj.c | 21 ++++++++++----------- src/p_polyobj.c | 2 +- src/p_saveg.c | 13 ++++++------- src/p_setup.c | 6 +++--- src/p_spec.c | 8 ++++---- src/p_tick.c | 5 +++-- src/p_user.c | 38 +++++++++++++++++++------------------- src/st_stuff.c | 2 +- 18 files changed, 74 insertions(+), 73 deletions(-) diff --git a/src/d_think.h b/src/d_think.h index 589124587..76c1bb5b8 100644 --- a/src/d_think.h +++ b/src/d_think.h @@ -51,6 +51,8 @@ typedef struct thinker_s // killough 11/98: count of how many other objects reference // this one using pointers. Used for garbage collection. INT32 references; + + boolean removing; boolean cachable; #ifdef PARANOIA diff --git a/src/f_finale.c b/src/f_finale.c index 37e4ba070..a992a0dfd 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -3435,7 +3435,7 @@ void F_TitleScreenTicker(boolean run) { for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; diff --git a/src/g_demo.c b/src/g_demo.c index b0e16adda..8315e716b 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -614,7 +614,7 @@ void G_ConsGhostTic(void) mobj = NULL; for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mobj = (mobj_t *)th; if (mobj->type == (mobjtype_t)type && mobj->x == x && mobj->y == y && mobj->z == z) @@ -2696,7 +2696,7 @@ void G_DoPlayMetal(void) // find metal sonic for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo = (mobj_t *)th; diff --git a/src/g_game.c b/src/g_game.c index d409bb2cf..175e757ec 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3072,7 +3072,7 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo) // scan all thinkers for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; diff --git a/src/lua_script.c b/src/lua_script.c index 623d88673..686555a16 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -1779,7 +1779,7 @@ void LUA_Archive(save_t *save_p) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; // archive function will determine when to skip mobjs, @@ -1817,7 +1817,7 @@ void LUA_UnArchive(save_t *save_p) mobjnum = P_ReadUINT32(save_p); // read a mobjnum for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; if (((mobj_t *)th)->mobjnum != mobjnum) // find matching mobj continue; diff --git a/src/m_cheat.c b/src/m_cheat.c index 2b32253fa..4be071bb2 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -562,7 +562,7 @@ void Command_Teleport_f(void) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -1072,7 +1072,7 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo = (mobj_t *)th; diff --git a/src/m_perfstats.c b/src/m_perfstats.c index b9948bdc0..0a52b0125 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -584,7 +584,7 @@ static void PS_CountThinkers(void) for (thinker = thlist[i].next; thinker != &thlist[i]; thinker = thinker->next) { ps_thinkercount.value.i++; - if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (thinker->removing) ps_removecount.value.i++; else if (i == THINK_POLYOBJ) ps_polythcount.value.i++; diff --git a/src/netcode/d_clisrv.c b/src/netcode/d_clisrv.c index d34dbc4e0..591923571 100644 --- a/src/netcode/d_clisrv.c +++ b/src/netcode/d_clisrv.c @@ -1814,7 +1814,7 @@ INT16 Consistancy(void) { for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo = (mobj_t *)th; diff --git a/src/p_enemy.c b/src/p_enemy.c index 59ca95409..60cffebfc 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3744,7 +3744,7 @@ static void P_DoBossVictory(mobj_t *mo) // scan the remaining thinkers to see if all bosses are dead for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -6449,7 +6449,7 @@ void A_RingExplode(mobj_t *actor) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -8756,7 +8756,7 @@ void A_FindTarget(mobj_t *actor) // scan the thinkers for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -8820,7 +8820,7 @@ void A_FindTracer(mobj_t *actor) // scan the thinkers for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -9498,7 +9498,7 @@ void A_RemoteAction(mobj_t *actor) // scan the thinkers for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -9761,7 +9761,7 @@ void A_SetObjectTypeState(mobj_t *actor) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -10391,7 +10391,7 @@ void A_CheckThingCount(mobj_t *actor) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; diff --git a/src/p_inter.c b/src/p_inter.c index dc606a47e..0e63fea1b 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -101,7 +101,7 @@ void P_ClearStarPost(INT32 postnum) // scan the thinkers for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -130,7 +130,7 @@ void P_ResetStarposts(void) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; post = (mobj_t *)th; @@ -1003,7 +1003,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // scan the thinkers to find the corresponding anchorpoint for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -1097,7 +1097,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // scan the remaining thinkers for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -1147,7 +1147,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // in from the paraloop. Isn't this just so efficient? for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -1522,7 +1522,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) // scan the remaining thinkers to find koopa for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -2020,7 +2020,7 @@ void P_TouchStarPost(mobj_t *post, player_t *player, boolean snaptopost) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -2870,7 +2870,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget // scan the thinkers to make sure all the old pinch dummies are gone on death for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo = (mobj_t *)th; diff --git a/src/p_mobj.c b/src/p_mobj.c index fb9e7d78e..488c3d617 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -765,7 +765,7 @@ void P_EmeraldManager(void) for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next) { - if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (think->removing) continue; mo = (mobj_t *)think; @@ -3455,7 +3455,7 @@ void P_DestroyRobots(void) for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next) { - if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (think->removing) continue; mo = (mobj_t *)think; @@ -4254,7 +4254,7 @@ static void P_Boss3Thinker(mobj_t *mobj) // this can happen if the boss was hurt earlier than expected for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -5343,7 +5343,7 @@ static void P_Boss9Thinker(mobj_t *mobj) // Build a hoop linked list of 'em! for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -6045,7 +6045,7 @@ mobj_t *P_GetClosestAxis(mobj_t *source) // scan the thinkers to find the closest axis point for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -11183,17 +11183,16 @@ tic_t itemrespawntime[ITEMQUESIZE]; size_t iquehead, iquetail; #ifdef PARANOIA -#define SCRAMBLE_REMOVED // Force debug build to crash when Removed mobj is accessed +#define SCRAMBLE_REMOVED // Force debug build to crash when a removed mobj is accessed #endif void P_RemoveMobj(mobj_t *mobj) { I_Assert(mobj != NULL); - if (P_MobjWasRemoved(mobj)) - return; // something already removing this mobj. + if (P_MobjWasRemoved(mobj) || mobj->thinker.removing) + return; // Something already removed or is removing this mobj. - mobj->thinker.function.acp1 = (actionf_p1)P_RemoveThinkerDelayed; // shh. no recursing. + mobj->thinker.removing = true; // Set earlier to avoid recursion. LUA_HookMobj(mobj, MOBJ_HOOK(MobjRemoved)); - mobj->thinker.function.acp1 = (actionf_p1)P_MobjThinker; // needed for P_UnsetThingPosition, etc. to work. // Rings only, please! if (mobj->spawnpoint && @@ -12863,7 +12862,7 @@ static boolean P_MapAlreadyHasStarPost(mobj_t *mobj) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 168fca61f..4833b5896 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -1316,7 +1316,7 @@ void Polyobj_InitLevel(void) // the mobj_t pointers on a queue for use below. for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo = (mobj_t *)th; diff --git a/src/p_saveg.c b/src/p_saveg.c index e939cf8e3..650622f59 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -2972,8 +2972,7 @@ static void P_NetArchiveThinkers(save_t *save_p) // save off the current thinkers for (th = thlist[i].next; th != &thlist[i]; th = th->next) { - if (!(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed - || th->function.acp1 == (actionf_p1)P_NullPrecipThinker)) + if (!(th->removing || th->function.acp1 == (actionf_p1)P_NullPrecipThinker)) numsaved++; if (th->function.acp1 == (actionf_p1)P_MobjThinker) @@ -3186,7 +3185,7 @@ static void P_NetArchiveThinkers(save_t *save_p) } #ifdef PARANOIA else - I_Assert(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed); // wait garbage collection + I_Assert(th->removing); // wait garbage collection #endif } @@ -3207,7 +3206,7 @@ mobj_t *P_FindNewPosition(UINT32 oldposition) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mobj = (mobj_t *)th; @@ -4528,7 +4527,7 @@ static inline void P_FinishMobjs(void) for (currentthinker = thlist[THINK_MOBJ].next; currentthinker != &thlist[THINK_MOBJ]; currentthinker = currentthinker->next) { - if (currentthinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (currentthinker->removing) continue; mobj = (mobj_t *)currentthinker; @@ -4546,7 +4545,7 @@ static void P_RelinkPointers(void) for (currentthinker = thlist[THINK_MOBJ].next; currentthinker != &thlist[THINK_MOBJ]; currentthinker = currentthinker->next) { - if (currentthinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (currentthinker->removing) continue; mobj = (mobj_t *)currentthinker; @@ -5376,7 +5375,7 @@ void P_SaveNetGame(save_t *save_p, boolean resending) // Assign the mobjnumber for pointer tracking for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mobj = (mobj_t *)th; diff --git a/src/p_setup.c b/src/p_setup.c index 906195c18..93286219d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -692,7 +692,7 @@ void P_ReloadRings(void) // scan the thinkers to find rings/spheres/hoops to unset for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo = (mobj_t *)th; @@ -750,7 +750,7 @@ void P_SwitchSpheresBonusMode(boolean bonustime) // scan the thinkers to find spheres to switch for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo = (mobj_t *)th; @@ -7333,7 +7333,7 @@ void P_RespawnThings(void) for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next) { - if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (think->removing) continue; P_RemoveMobj((mobj_t *)think); } diff --git a/src/p_spec.c b/src/p_spec.c index 9b124f9af..d375d3e2f 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3642,7 +3642,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) if (mo2->type != MT_EGGTRAP) continue; - if (mo2->thinker.function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (mo2->thinker.removing) continue; P_KillMobj(mo2, NULL, mo, 0); @@ -3854,7 +3854,7 @@ void P_SetupSignExit(player_t *player) // spin all signposts in the level then. for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next) { - if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (think->removing) continue; thing = (mobj_t *)think; @@ -3892,7 +3892,7 @@ boolean P_IsFlagAtBase(mobjtype_t flag) for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next) { - if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (think->removing) continue; mo = (mobj_t *)think; @@ -4395,7 +4395,7 @@ static void P_ProcessEggCapsule(player_t *player, sector_t *sector) // The chimps are my friends.. heeheeheheehehee..... - LouisJM for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; if (mo2->type != MT_EGGTRAP) diff --git a/src/p_tick.c b/src/p_tick.c index 68de09138..db8688484 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -162,7 +162,7 @@ void Command_CountMobjs_f(void) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; if (((mobj_t *)th)->type == i) @@ -182,7 +182,7 @@ void Command_CountMobjs_f(void) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; if (((mobj_t *)th)->type == i) @@ -348,6 +348,7 @@ void P_RemoveThinkerDelayed(thinker_t *thinker) void P_RemoveThinker(thinker_t *thinker) { LUA_InvalidateUserdata(thinker); + thinker->removing = true; thinker->function.acp1 = (actionf_p1)P_RemoveThinkerDelayed; } diff --git a/src/p_user.c b/src/p_user.c index a2bae228b..3301987a2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -435,7 +435,7 @@ UINT8 P_FindLowestMare(void) // to find the egg capsule with the lowest mare for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -488,7 +488,7 @@ boolean P_TransferToNextMare(player_t *player) // to find the closest axis point for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -539,7 +539,7 @@ static mobj_t *P_FindAxis(INT32 mare, INT32 axisnum) // to find the closest axis point for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -574,7 +574,7 @@ static mobj_t *P_FindAxisTransfer(INT32 mare, INT32 axisnum, mobjtype_t type) // to find the closest axis point for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -615,7 +615,7 @@ void P_TransferToAxis(player_t *player, INT32 axisnum) // to find the closest axis point for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -716,7 +716,7 @@ static void P_DeNightserizePlayer(player_t *player) // Check to see if the player should be killed. for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -1899,7 +1899,7 @@ void P_SpawnShieldOrb(player_t *player) // blaze through the thinkers to see if an orb already exists! for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; shieldobj = (mobj_t *)th; @@ -5112,7 +5112,7 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -6479,7 +6479,7 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad // Find next waypoint for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -6515,7 +6515,7 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad { for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -6544,7 +6544,7 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad { for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -7276,7 +7276,7 @@ static void P_NiGHTSMovement(player_t *player) // to find the closest axis point for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -8176,7 +8176,7 @@ void P_MovePlayer(player_t *player) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -9161,7 +9161,7 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius) for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next) { - if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (think->removing) continue; mo = (mobj_t *)think; @@ -9259,7 +9259,7 @@ mobj_t *P_LookForFocusTarget(player_t *player, mobj_t *exclude, SINT8 direction, for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next) { - if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (think->removing) continue; mo = (mobj_t *)think; @@ -9378,7 +9378,7 @@ mobj_t *P_LookForEnemies(player_t *player, boolean nonenemies, boolean bullet) for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next) { - if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (think->removing) continue; mo = (mobj_t *)think; @@ -9524,7 +9524,7 @@ void P_FindEmerald(void) // to find all emeralds for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; @@ -10925,7 +10925,7 @@ static mobj_t *P_GetAxis(INT32 num) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mobj = (mobj_t *)th; @@ -12007,7 +12007,7 @@ void P_PlayerThink(player_t *player) for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; diff --git a/src/st_stuff.c b/src/st_stuff.c index a44771e4b..5bb3aa98c 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2655,7 +2655,7 @@ static boolean ST_doItemFinderIconsAndSound(void) // Scan thinkers to find emblem mobj with these ids for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next) { - if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed) + if (th->removing) continue; mo2 = (mobj_t *)th; From c9a1984da5f73538e003f6c34e45d5d6f6a4fe32 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Fri, 13 Dec 2024 19:55:50 -0300 Subject: [PATCH 254/353] Simplify P_BlockThingsIterator There was no reason to do what I did, since the loop only needs to hold a reference to the next block. This reverts the function to how it was before 7469a6271b4b1b9e3bfcc7bd81d817cfed0a88c2, but holds the reference properly. --- src/p_maputl.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/p_maputl.c b/src/p_maputl.c index f10a396a3..6842677b3 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -1052,7 +1052,6 @@ boolean P_BlockLinesIterator(INT32 x, INT32 y, boolean (*func)(line_t *)) // boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *)) { - mobj_t *bnext = NULL; blocknode_t *block, *next = NULL; if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight) @@ -1061,26 +1060,15 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *)) // Check interaction with the objects in the blockmap. for (block = blocklinks[y*bmapwidth + x]; block; block = next) { - next = block->mnext; - if (next) - P_SetTarget(&bnext, next->mobj); // We want to note our reference to bnext here in case it is MF_NOTHINK and gets removed! + next = block->mnext; // We want to note our reference to mnext here in case the object gets removed! if (!func(block->mobj)) - { - P_SetTarget(&bnext, NULL); return false; - } - if (P_MobjWasRemoved(tmthing) // func just popped our tmthing, cannot continue. - || (bnext && P_MobjWasRemoved(bnext))) // func just broke blockmap chain, cannot continue. - { - P_SetTarget(&bnext, NULL); + if (P_MobjWasRemoved(tmthing)) // func just popped our tmthing, cannot continue. return true; - } } - P_SetTarget(&bnext, NULL); - return true; } From e7f581a958d74f34d290805e79f82c525a5efa4d Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Fri, 13 Dec 2024 20:21:34 -0300 Subject: [PATCH 255/353] Remove MAXRADIUS adjustment from bounding box calculations This was added by the Doom developers to work around the issue where objects were not linked into all blockmap cells they were touching, and instead just the one at the object's center. Since this is no longer the case after commit 41613d89a179f1c3cb1f394ecd3f5b49ae32861c, this adjustment is no longer necessary. --- src/lua_blockmaplib.c | 9 +++--- src/p_local.h | 5 ---- src/p_map.c | 66 ++++++++++++++++++++----------------------- src/p_mobj.c | 8 +++--- src/p_polyobj.c | 10 +++---- 5 files changed, 43 insertions(+), 55 deletions(-) diff --git a/src/lua_blockmaplib.c b/src/lua_blockmaplib.c index c29eadecc..f570c229b 100644 --- a/src/lua_blockmaplib.c +++ b/src/lua_blockmaplib.c @@ -254,11 +254,10 @@ static int lib_searchBlockmap(lua_State *L) } else // mobj and function only - search around mobj's radius by default { - fixed_t radius = mobj->radius + MAXRADIUS; - x1 = mobj->x - radius; - x2 = mobj->x + radius; - y1 = mobj->y - radius; - y2 = mobj->y + radius; + x1 = mobj->x - mobj->radius; + x2 = mobj->x + mobj->radius; + y1 = mobj->y - mobj->radius; + y2 = mobj->y + mobj->radius; } lua_settop(L, 2); // pop everything except function, mobj diff --git a/src/p_local.h b/src/p_local.h index 39856bffb..3253ef0b6 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -39,11 +39,6 @@ // Convenience macro to fix issue with collision along bottom/left edges of blockmap -Red #define BMBOUNDFIX(xl, xh, yl, yh) {if (xl > xh) xl = 0; if (yl > yh) yl = 0;} -// MAXRADIUS is for precalculated sector block boxes -// the spider demon is larger, -// but we do not have any moving sectors nearby -#define MAXRADIUS (32*FRACUNIT) - // max Z move up or down without jumping // above this, a height difference is considered as a 'dropoff' #define MAXSTEPMOVE (24*FRACUNIT) diff --git a/src/p_map.c b/src/p_map.c index 1116ae06a..35cf7db0e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -36,6 +36,9 @@ #include "m_perfstats.h" // ps_checkposition_calls +// Formerly called MAXRADIUS +#define MAXTRYMOVE (32*FRACUNIT) + fixed_t tmbbox[4]; mobj_t *tmthing; static INT32 tmflags; @@ -2165,15 +2168,10 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) } } - // The bounding box is extended by MAXRADIUS - // because mobj_ts are grouped into mapblocks - // based on their origin point, and can overlap - // into adjacent blocks by up to MAXRADIUS units. - - xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT; - xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT; - yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT; - yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT; + xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT; + xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT; + yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT; + yh = (unsigned)(tmbbox[BOXTOP] - bmaporgy)>>MAPBLOCKSHIFT; BMBOUNDFIX(xl, xh, yl, yh); @@ -2393,11 +2391,6 @@ boolean P_CheckCameraPosition(fixed_t x, fixed_t y, camera_t *thiscam) } } - // The bounding box is extended by MAXRADIUS - // because mobj_ts are grouped into mapblocks - // based on their origin point, and can overlap - // into adjacent blocks by up to MAXRADIUS units. - xl = (unsigned)(tmbbox[BOXLEFT] - bmaporgx)>>MAPBLOCKSHIFT; xh = (unsigned)(tmbbox[BOXRIGHT] - bmaporgx)>>MAPBLOCKSHIFT; yl = (unsigned)(tmbbox[BOXBOTTOM] - bmaporgy)>>MAPBLOCKSHIFT; @@ -2528,16 +2521,16 @@ boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam) } do { - if (x-tryx > MAXRADIUS) - tryx += MAXRADIUS; - else if (x-tryx < -MAXRADIUS) - tryx -= MAXRADIUS; + if (x-tryx > MAXTRYMOVE) + tryx += MAXTRYMOVE; + else if (x-tryx < -MAXTRYMOVE) + tryx -= MAXTRYMOVE; else tryx = x; - if (y-tryy > MAXRADIUS) - tryy += MAXRADIUS; - else if (y-tryy < -MAXRADIUS) - tryy -= MAXRADIUS; + if (y-tryy > MAXTRYMOVE) + tryy += MAXTRYMOVE; + else if (y-tryy < -MAXTRYMOVE) + tryy -= MAXTRYMOVE; else tryy = y; @@ -2683,7 +2676,7 @@ increment_move floatok = false; // This makes sure that there are no freezes from computing extremely small movements. - // Originally was MAXRADIUS/2, but that can cause some bad inconsistencies for small players. + // Originally was MAXTRYMOVE/2, but that can cause some bad inconsistencies for small players. radius = max(radius, thing->scale); // And we also have to prevent Big Large (tm) movements, as those can skip too far @@ -2872,10 +2865,10 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) { INT32 xl, xh, yl, yh; - yh = (unsigned)(thing->y + MAXRADIUS - bmaporgy)>>MAPBLOCKSHIFT; - yl = (unsigned)(thing->y - MAXRADIUS - bmaporgy)>>MAPBLOCKSHIFT; - xh = (unsigned)(thing->x + MAXRADIUS - bmaporgx)>>MAPBLOCKSHIFT; - xl = (unsigned)(thing->x - MAXRADIUS - bmaporgx)>>MAPBLOCKSHIFT; + yh = (unsigned)(thing->y + thing->radius - bmaporgy)>>MAPBLOCKSHIFT; + yl = (unsigned)(thing->y - thing->radius - bmaporgy)>>MAPBLOCKSHIFT; + xh = (unsigned)(thing->x + thing->radius - bmaporgx)>>MAPBLOCKSHIFT; + xl = (unsigned)(thing->x - thing->radius - bmaporgx)>>MAPBLOCKSHIFT; BMBOUNDFIX(xl, xh, yl, yh); @@ -2947,16 +2940,16 @@ boolean P_SceneryTryMove(mobj_t *thing, fixed_t x, fixed_t y) tryx = thing->x; tryy = thing->y; do { - if (x-tryx > MAXRADIUS) - tryx += MAXRADIUS; - else if (x-tryx < -MAXRADIUS) - tryx -= MAXRADIUS; + if (x-tryx > MAXTRYMOVE) + tryx += MAXTRYMOVE; + else if (x-tryx < -MAXTRYMOVE) + tryx -= MAXTRYMOVE; else tryx = x; - if (y-tryy > MAXRADIUS) - tryy += MAXRADIUS; - else if (y-tryy < -MAXRADIUS) - tryy -= MAXRADIUS; + if (y-tryy > MAXTRYMOVE) + tryy += MAXTRYMOVE; + else if (y-tryy < -MAXTRYMOVE) + tryy -= MAXTRYMOVE; else tryy = y; @@ -4215,7 +4208,8 @@ void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist, UINT8 dama INT32 xl, xh, yl, yh; fixed_t dist; - dist = FixedMul(damagedist, spot->scale) + MAXRADIUS; + dist = FixedMul(damagedist, spot->scale); + yh = (unsigned)(spot->y + dist - bmaporgy)>>MAPBLOCKSHIFT; yl = (unsigned)(spot->y - dist - bmaporgy)>>MAPBLOCKSHIFT; xh = (unsigned)(spot->x + dist - bmaporgx)>>MAPBLOCKSHIFT; diff --git a/src/p_mobj.c b/src/p_mobj.c index fb9e7d78e..3ee3dc029 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9337,10 +9337,10 @@ static void P_PointPushThink(mobj_t *mobj) radius = mobj->spawnpoint->args[0] << FRACBITS; pushmobj = mobj; - xl = (unsigned)(mobj->x - radius - bmaporgx - MAXRADIUS)>>MAPBLOCKSHIFT; - xh = (unsigned)(mobj->x + radius - bmaporgx + MAXRADIUS)>>MAPBLOCKSHIFT; - yl = (unsigned)(mobj->y - radius - bmaporgy - MAXRADIUS)>>MAPBLOCKSHIFT; - yh = (unsigned)(mobj->y + radius - bmaporgy + MAXRADIUS)>>MAPBLOCKSHIFT; + xl = (unsigned)(mobj->x - radius - bmaporgx)>>MAPBLOCKSHIFT; + xh = (unsigned)(mobj->x + radius - bmaporgx)>>MAPBLOCKSHIFT; + yl = (unsigned)(mobj->y - radius - bmaporgy)>>MAPBLOCKSHIFT; + yh = (unsigned)(mobj->y + radius - bmaporgy)>>MAPBLOCKSHIFT; P_DoBlockThingsIterate(xl, yl, xh, yh, PIT_PushThing); } diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 168fca61f..ab3ff6859 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -927,11 +927,11 @@ static INT32 Polyobj_clipThings(polyobj_t *po, line_t *line) if (!(po->flags & POF_SOLID)) return hitflags; - // adjust linedef bounding box to blockmap, extend by MAXRADIUS - linebox[BOXLEFT] = (unsigned)(line->bbox[BOXLEFT] - bmaporgx - MAXRADIUS) >> MAPBLOCKSHIFT; - linebox[BOXRIGHT] = (unsigned)(line->bbox[BOXRIGHT] - bmaporgx + MAXRADIUS) >> MAPBLOCKSHIFT; - linebox[BOXBOTTOM] = (unsigned)(line->bbox[BOXBOTTOM] - bmaporgy - MAXRADIUS) >> MAPBLOCKSHIFT; - linebox[BOXTOP] = (unsigned)(line->bbox[BOXTOP] - bmaporgy + MAXRADIUS) >> MAPBLOCKSHIFT; + // adjust linedef bounding box to blockmap + linebox[BOXLEFT] = (unsigned)(line->bbox[BOXLEFT] - bmaporgx) >> MAPBLOCKSHIFT; + linebox[BOXRIGHT] = (unsigned)(line->bbox[BOXRIGHT] - bmaporgx) >> MAPBLOCKSHIFT; + linebox[BOXBOTTOM] = (unsigned)(line->bbox[BOXBOTTOM] - bmaporgy) >> MAPBLOCKSHIFT; + linebox[BOXTOP] = (unsigned)(line->bbox[BOXTOP] - bmaporgy) >> MAPBLOCKSHIFT; // check all mobj blockmap cells the line contacts for (y = linebox[BOXBOTTOM]; y <= linebox[BOXTOP]; ++y) From 2d2007acb8b00f7f4a81ef8b86c979a56bc1f739 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Fri, 13 Dec 2024 23:28:49 -0600 Subject: [PATCH 256/353] dta -> pk3 --- assets/CMakeLists.txt | 4 ++-- src/config.h.in | 2 +- src/d_main.c | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt index dfb2f4180..68c848195 100644 --- a/assets/CMakeLists.txt +++ b/assets/CMakeLists.txt @@ -27,10 +27,10 @@ list(TRANSFORM SRB2_ASSETS_DOCS PREPEND "${SRB2_ASSET_DIRECTORY_ABSOLUTE}") set(SRB2_ASSETS_GAME "srb2.pk3" - "player.dta" + "characters.pk3" "zones.pk3" "patch.pk3" - "music.dta" + "music.pk3" "models.dat" ) list(TRANSFORM SRB2_ASSETS_GAME PREPEND "/") diff --git a/src/config.h.in b/src/config.h.in index 9aa4f6da5..5af558a46 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -44,7 +44,7 @@ */ #define ASSET_HASH_SRB2_PK3 "4ef6f57eefdf263288cae12084791cd2" #define ASSET_HASH_ZONES_PK3 "b7db0245434ca3ad61935ee36403e966" -#define ASSET_HASH_PLAYER_DTA "2e7aaae8a6b1b77d90ffe7606ceadb6c" +#define ASSET_HASH_CHARACTERS_PK3 "2e7aaae8a6b1b77d90ffe7606ceadb6c" #ifdef USE_PATCH_DTA #define ASSET_HASH_PATCH_PK3 "3c7b73f34af7e9a7bceb2d5260f76172" #endif diff --git a/src/d_main.c b/src/d_main.c index a6a9385d2..342fb1478 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1180,7 +1180,7 @@ static void IdentifyVersion(void) D_AddFile(&startupwadfiles, va(pandf,srb2waddir, "zones.pk3")); // Add the players - D_AddFile(&startupwadfiles, va(pandf,srb2waddir, "player.dta")); + D_AddFile(&startupwadfiles, va(pandf,srb2waddir, "characters.pk3")); #ifdef USE_PATCH_DTA // Add our crappy patches to fix our bugs @@ -1199,7 +1199,7 @@ static void IdentifyVersion(void) I_Error("File "str" has been modified with non-music/sound lumps"); \ } - MUSICTEST("music.dta") + MUSICTEST("music.pk3") //MUSICTEST("patch_music.pk3") } #endif @@ -1431,7 +1431,7 @@ void D_SRB2Main(void) // Make backups of some SOCcable tables. P_BackupTables(); - mainwads = 3; // doesn't include music.dta + mainwads = 3; // doesn't include music.pk3 #ifdef USE_PATCH_DTA mainwads++; #endif @@ -1446,11 +1446,11 @@ void D_SRB2Main(void) // Check MD5s of autoloaded files W_VerifyFileMD5(0, ASSET_HASH_SRB2_PK3); // srb2.pk3 W_VerifyFileMD5(1, ASSET_HASH_ZONES_PK3); // zones.pk3 - W_VerifyFileMD5(2, ASSET_HASH_PLAYER_DTA); // player.dta + W_VerifyFileMD5(2, ASSET_HASH_CHARACTERS_PK3); // characters.pk3 #ifdef USE_PATCH_DTA W_VerifyFileMD5(3, ASSET_HASH_PATCH_PK3); // patch.pk3 #endif - // don't check music.dta because people like to modify it, and it doesn't matter if they do + // don't check music.pk3 because people like to modify it, and it doesn't matter if they do // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for. #endif //ifndef DEVELOP From 4a9f10c076169bbf77e495186dedf665534f0d6d Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sat, 14 Dec 2024 15:09:56 +0100 Subject: [PATCH 257/353] Adjust CMakeLists.txt for Haiku --- src/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 20caecf7b..fbd29cddd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -172,6 +172,11 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") endif() endif() +if("${CMAKE_SYSTEM_NAME}" MATCHES "Haiku") + target_compile_definitions(SRB2SDL2 PRIVATE -DNOEXECINFO) + target_link_libraries(SRB2SDL2 PRIVATE network) +endif() + if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") target_compile_definitions(SRB2SDL2 PRIVATE -DMACOSX) endif() From 983453e2b05fbc5ece79be9a3b80fd65dc9c931a Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Sat, 14 Dec 2024 22:17:21 -0600 Subject: [PATCH 258/353] Hardcode OLDK --- src/hardware/hw_light.c | 1 + src/info.c | 34 ++++++++++++++++++++++++++++++++++ src/info.h | 8 ++++++++ src/p_mobj.c | 4 ++++ 4 files changed, 47 insertions(+) diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 1d2772dc4..a390092d1 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -575,6 +575,7 @@ light_t *t_lspr[NUMSPRITES] = &lspr[BLUEBALL_L], // SPR_SBFL, &lspr[BLUEBALL_L], // SPR_SBSK, &lspr[NOLIGHT], // SPR_BATT, + &lspr[NOLIGHT], // SPR_OLDK, // Debris &lspr[RINGSPARK_L], // SPR_SPRK diff --git a/src/info.c b/src/info.c index 715fe5d53..2361de627 100644 --- a/src/info.c +++ b/src/info.c @@ -486,6 +486,7 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "SBFL", "SBSK", "HBAT", + "OLDK", // Debris "SPRK", // Sparkle @@ -3936,6 +3937,11 @@ state_t states[NUMSTATES] = {SPR_HBAT, 3, 1, {NULL}, 0, 0, S_HANGSTER_RETURN1, 0}, // S_HANGSTER_RETURN2 {SPR_HBAT, 0, 15, {NULL}, 0, 0, S_HANGSTER_LOOK, 0}, // S_HANGSTER_RETURN3 + {SPR_OLDK, FF_ANIMATE, -1, {NULL}, 1, 16, S_NULL, 0}, // S_OLDK_STND + {SPR_OLDK, 2, 0, {A_ForceWin}, 0, 0, S_OLDK_DIE1, 0}, // S_OLDK_DIE0 + {SPR_OLDK, 2, 0, {A_Scream}, 0, 0, S_OLDK_DIE2, 0}, // S_OLDK_DIE1 + {SPR_OLDK, 2, -1, {A_ZThrust}, 14, 1|(1<<16), S_NULL, 0}, // S_OLDK_DIE2 + {SPR_NULL, 0, 35, {NULL}, 0, 0, S_CRUMBLE2, 0}, // S_CRUMBLE1 {SPR_NULL, 0, 105, {A_Scream}, 0, 0, S_NULL, 0}, // S_CRUMBLE2 @@ -20496,6 +20502,34 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + // MT_OLDK + { + 666, // doomednum + S_OLDK_STND, // spawnstate + 2, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 32, // reactiontime + sfx_None, // attacksound + S_OLDK_DIE0, // painstate + 128, // painchance + sfx_s3k35, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_OLDK_DIE0, // deathstate + S_NULL, // xdeathstate + sfx_s3k35, // deathsound + 2*FRACUNIT, // speed + 32*FRACUNIT, // radius + 64*FRACUNIT, // height + 0, // display offset + 1000, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL|MF_SHOOTABLE|MF_NOGRAVITY|MF_BOSS, // flags + S_NULL // raisestate + }, + { // MT_TELEPORTMAN 751, // doomednum S_INVISIBLE, // spawnstate diff --git a/src/info.h b/src/info.h index ddbfc31b7..37babf44b 100644 --- a/src/info.h +++ b/src/info.h @@ -1037,6 +1037,7 @@ typedef enum sprite SPR_SBFL, SPR_SBSK, SPR_HBAT, + SPR_OLDK, // Debris SPR_SPRK, // Sparkle @@ -4308,6 +4309,11 @@ typedef enum state S_HANGSTER_RETURN2, S_HANGSTER_RETURN3, + S_OLDK_STND, + S_OLDK_DIE0, + S_OLDK_DIE1, + S_OLDK_DIE2, + S_CRUMBLE1, S_CRUMBLE2, @@ -5116,6 +5122,8 @@ typedef enum mobj_type MT_SPINBOBERT_FIRE2, MT_HANGSTER, + MT_OLDK, + // Utility Objects MT_TELEPORTMAN, MT_ALTVIEWMAN, diff --git a/src/p_mobj.c b/src/p_mobj.c index fb9e7d78e..b02c4be49 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9529,6 +9529,10 @@ static boolean P_MobjRegularThink(mobj_t *mobj) if (!P_HangsterThink(mobj)) return false; break; + case MT_OLDK: + if (mobj->health <= 0) + mobj->momz -= ((2*FRACUNIT)/3); + break; case MT_LHRT: mobj->momx = FixedMul(mobj->momx, mobj->extravalue2); mobj->momy = FixedMul(mobj->momy, mobj->extravalue2); From 588aa1db2de4256a214646e256c2d227e9c21725 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Mon, 16 Dec 2024 21:18:54 -0600 Subject: [PATCH 259/353] Update credits + add special stage clear themes --- src/f_finale.c | 6 ++++++ src/y_inter.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index 37e4ba070..702e29a77 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1080,6 +1080,7 @@ static const char *credits[] = { "Louis-Antoine \"LJ Sonic\" de Moulins", // de Rochefort doesn't quite fit on the screen sorry lol "John \"JTE\" Muniz", "Colin \"Sonict\" Pfaff", + "\"Radicalicious\"", "James \"james\" Robert Roman", "Sean \"Sryder13\" Ryder", "Ehab \"Wolfy\" Saeed", @@ -1163,14 +1164,19 @@ static const char *credits[] = { "James \"SeventhSentinel\" Hall", "Kepa \"Nev3r\" Iceta", "Thomas \"Shadow Hog\" Igoe", + "Mujamel \"MK\" Khan", + "\"Krabs\"", "\"Kaito Sinclaire\"", "Alexander \"DrTapeworm\" Moench-Ford", + "\"Radicalicious\"", "\"Revan\"", "Anna \"QueenDelta\" Sandlin", "Wessel \"sphere\" Smit", "\"SSNTails\"", + "Aaron \"Othius\" Stojkov", "Rob Tisdell", "\"Torgo\"", + "Samuel \"Spectorious\" Tuttle", "Jarrett \"JEV3\" Voight", "Johnny \"Sonikku\" Wallbank", "Marco \"mazmazz\" Zafra", diff --git a/src/y_inter.c b/src/y_inter.c index 17f585223..769b2a187 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1129,7 +1129,7 @@ void Y_Ticker(void) else if (mapheaderinfo[gamemap-1]->musintername[0] && S_MusicExists(mapheaderinfo[gamemap-1]->musintername, !midi_disabled, !digital_disabled)) S_ChangeMusicInternal(mapheaderinfo[gamemap-1]->musintername, false); // don't loop it else - S_ChangeMusicInternal("_clear", false); // don't loop it + S_ChangeMusicInternal(stagefailed ? "CHFAIL" : "CHPASS", false); // don't loop it tallydonetic = -1; } From 5d0e99a3e754b135dd5c17a743628cd6751e642b Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Mon, 16 Dec 2024 21:19:06 -0600 Subject: [PATCH 260/353] Revert "Hardcode OLDK" This reverts commit 983453e2b05fbc5ece79be9a3b80fd65dc9c931a. --- src/hardware/hw_light.c | 1 - src/info.c | 34 ---------------------------------- src/info.h | 8 -------- src/p_mobj.c | 4 ---- 4 files changed, 47 deletions(-) diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index a390092d1..1d2772dc4 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -575,7 +575,6 @@ light_t *t_lspr[NUMSPRITES] = &lspr[BLUEBALL_L], // SPR_SBFL, &lspr[BLUEBALL_L], // SPR_SBSK, &lspr[NOLIGHT], // SPR_BATT, - &lspr[NOLIGHT], // SPR_OLDK, // Debris &lspr[RINGSPARK_L], // SPR_SPRK diff --git a/src/info.c b/src/info.c index 2361de627..715fe5d53 100644 --- a/src/info.c +++ b/src/info.c @@ -486,7 +486,6 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "SBFL", "SBSK", "HBAT", - "OLDK", // Debris "SPRK", // Sparkle @@ -3937,11 +3936,6 @@ state_t states[NUMSTATES] = {SPR_HBAT, 3, 1, {NULL}, 0, 0, S_HANGSTER_RETURN1, 0}, // S_HANGSTER_RETURN2 {SPR_HBAT, 0, 15, {NULL}, 0, 0, S_HANGSTER_LOOK, 0}, // S_HANGSTER_RETURN3 - {SPR_OLDK, FF_ANIMATE, -1, {NULL}, 1, 16, S_NULL, 0}, // S_OLDK_STND - {SPR_OLDK, 2, 0, {A_ForceWin}, 0, 0, S_OLDK_DIE1, 0}, // S_OLDK_DIE0 - {SPR_OLDK, 2, 0, {A_Scream}, 0, 0, S_OLDK_DIE2, 0}, // S_OLDK_DIE1 - {SPR_OLDK, 2, -1, {A_ZThrust}, 14, 1|(1<<16), S_NULL, 0}, // S_OLDK_DIE2 - {SPR_NULL, 0, 35, {NULL}, 0, 0, S_CRUMBLE2, 0}, // S_CRUMBLE1 {SPR_NULL, 0, 105, {A_Scream}, 0, 0, S_NULL, 0}, // S_CRUMBLE2 @@ -20502,34 +20496,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - // MT_OLDK - { - 666, // doomednum - S_OLDK_STND, // spawnstate - 2, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 32, // reactiontime - sfx_None, // attacksound - S_OLDK_DIE0, // painstate - 128, // painchance - sfx_s3k35, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_OLDK_DIE0, // deathstate - S_NULL, // xdeathstate - sfx_s3k35, // deathsound - 2*FRACUNIT, // speed - 32*FRACUNIT, // radius - 64*FRACUNIT, // height - 0, // display offset - 1000, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL|MF_SHOOTABLE|MF_NOGRAVITY|MF_BOSS, // flags - S_NULL // raisestate - }, - { // MT_TELEPORTMAN 751, // doomednum S_INVISIBLE, // spawnstate diff --git a/src/info.h b/src/info.h index 37babf44b..ddbfc31b7 100644 --- a/src/info.h +++ b/src/info.h @@ -1037,7 +1037,6 @@ typedef enum sprite SPR_SBFL, SPR_SBSK, SPR_HBAT, - SPR_OLDK, // Debris SPR_SPRK, // Sparkle @@ -4309,11 +4308,6 @@ typedef enum state S_HANGSTER_RETURN2, S_HANGSTER_RETURN3, - S_OLDK_STND, - S_OLDK_DIE0, - S_OLDK_DIE1, - S_OLDK_DIE2, - S_CRUMBLE1, S_CRUMBLE2, @@ -5122,8 +5116,6 @@ typedef enum mobj_type MT_SPINBOBERT_FIRE2, MT_HANGSTER, - MT_OLDK, - // Utility Objects MT_TELEPORTMAN, MT_ALTVIEWMAN, diff --git a/src/p_mobj.c b/src/p_mobj.c index b02c4be49..fb9e7d78e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9529,10 +9529,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj) if (!P_HangsterThink(mobj)) return false; break; - case MT_OLDK: - if (mobj->health <= 0) - mobj->momz -= ((2*FRACUNIT)/3); - break; case MT_LHRT: mobj->momx = FixedMul(mobj->momx, mobj->extravalue2); mobj->momy = FixedMul(mobj->momy, mobj->extravalue2); From ebc29ef0c8cca45e2269639d297fe1645072c9a8 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 17 Dec 2024 15:42:22 -0300 Subject: [PATCH 261/353] Fix more code that uses block->mnext --- src/p_map.c | 6 +++--- src/p_maputl.c | 4 ++-- src/p_polyobj.c | 16 +++++++++------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 1116ae06a..ab6e62edd 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -4385,15 +4385,15 @@ static boolean P_CheckSectorPolyObjects(sector_t *sector, boolean realcrush, boo { mobj_t *mo; blocknode_t *block; + blocknode_t *next = NULL; if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight) continue; - block = blocklinks[y * bmapwidth + x]; - - for (; block; block = block->mnext) + for (block = blocklinks[y * bmapwidth + x]; block != NULL; block = next) { mo = block->mobj; + next = block->mnext; // Monster Iestyn: do we need to check if a mobj has already been checked? ...probably not I suspect if (!P_MobjInsidePolyobj(po, mo)) diff --git a/src/p_maputl.c b/src/p_maputl.c index 6842677b3..5398fd7a4 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -1058,9 +1058,9 @@ boolean P_BlockThingsIterator(INT32 x, INT32 y, boolean (*func)(mobj_t *)) return true; // Check interaction with the objects in the blockmap. - for (block = blocklinks[y*bmapwidth + x]; block; block = next) + for (block = blocklinks[y*bmapwidth + x]; block != NULL; block = next) { - next = block->mnext; // We want to note our reference to mnext here in case the object gets removed! + next = block->mnext; // We want to note our reference to mnext here! if (!func(block->mobj)) return false; diff --git a/src/p_polyobj.c b/src/p_polyobj.c index 168fca61f..1d651dcd2 100644 --- a/src/p_polyobj.c +++ b/src/p_polyobj.c @@ -878,15 +878,15 @@ static void Polyobj_carryThings(polyobj_t *po, fixed_t dx, fixed_t dy) { mobj_t *mo; blocknode_t *block; + blocknode_t *next = NULL; if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight) continue; - block = blocklinks[y * bmapwidth + x]; - - for (; block; block = block->mnext) + for (block = blocklinks[y * bmapwidth + x]; block != NULL; block = next) { mo = block->mobj; + next = block->mnext; if (mo->lastlook == pomovecount) continue; @@ -942,9 +942,11 @@ static INT32 Polyobj_clipThings(polyobj_t *po, line_t *line) { mobj_t *mo = NULL; blocknode_t *block = blocklinks[y * bmapwidth + x]; + blocknode_t *next = NULL; - for (; block; block = block->mnext) + for (; block != NULL; block = next) { + next = block->mnext; mo = block->mobj; // Don't scroll objects that aren't affected by gravity @@ -1115,15 +1117,15 @@ static void Polyobj_rotateThings(polyobj_t *po, vector2_t origin, angle_t delta, { mobj_t *mo; blocknode_t *block; + blocknode_t *next = NULL; if (x < 0 || y < 0 || x >= bmapwidth || y >= bmapheight) continue; - block = blocklinks[y * bmapwidth + x]; - - for (; block; block = block->mnext) + for (block = blocklinks[y * bmapwidth + x]; block != NULL; block = next) { mo = block->mobj; + next = block->mnext; if (mo->lastlook == pomovecount) continue; From cb233bd500660f5227f25e3ca7d5888b66830873 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Tue, 17 Dec 2024 12:57:19 -0600 Subject: [PATCH 262/353] Reapply "Hardcode OLDK" This reverts commit 5d0e99a3e754b135dd5c17a743628cd6751e642b. --- src/hardware/hw_light.c | 1 + src/info.c | 34 ++++++++++++++++++++++++++++++++++ src/info.h | 8 ++++++++ src/p_mobj.c | 4 ++++ 4 files changed, 47 insertions(+) diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 1d2772dc4..a390092d1 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -575,6 +575,7 @@ light_t *t_lspr[NUMSPRITES] = &lspr[BLUEBALL_L], // SPR_SBFL, &lspr[BLUEBALL_L], // SPR_SBSK, &lspr[NOLIGHT], // SPR_BATT, + &lspr[NOLIGHT], // SPR_OLDK, // Debris &lspr[RINGSPARK_L], // SPR_SPRK diff --git a/src/info.c b/src/info.c index 715fe5d53..2361de627 100644 --- a/src/info.c +++ b/src/info.c @@ -486,6 +486,7 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "SBFL", "SBSK", "HBAT", + "OLDK", // Debris "SPRK", // Sparkle @@ -3936,6 +3937,11 @@ state_t states[NUMSTATES] = {SPR_HBAT, 3, 1, {NULL}, 0, 0, S_HANGSTER_RETURN1, 0}, // S_HANGSTER_RETURN2 {SPR_HBAT, 0, 15, {NULL}, 0, 0, S_HANGSTER_LOOK, 0}, // S_HANGSTER_RETURN3 + {SPR_OLDK, FF_ANIMATE, -1, {NULL}, 1, 16, S_NULL, 0}, // S_OLDK_STND + {SPR_OLDK, 2, 0, {A_ForceWin}, 0, 0, S_OLDK_DIE1, 0}, // S_OLDK_DIE0 + {SPR_OLDK, 2, 0, {A_Scream}, 0, 0, S_OLDK_DIE2, 0}, // S_OLDK_DIE1 + {SPR_OLDK, 2, -1, {A_ZThrust}, 14, 1|(1<<16), S_NULL, 0}, // S_OLDK_DIE2 + {SPR_NULL, 0, 35, {NULL}, 0, 0, S_CRUMBLE2, 0}, // S_CRUMBLE1 {SPR_NULL, 0, 105, {A_Scream}, 0, 0, S_NULL, 0}, // S_CRUMBLE2 @@ -20496,6 +20502,34 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + // MT_OLDK + { + 666, // doomednum + S_OLDK_STND, // spawnstate + 2, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 32, // reactiontime + sfx_None, // attacksound + S_OLDK_DIE0, // painstate + 128, // painchance + sfx_s3k35, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_OLDK_DIE0, // deathstate + S_NULL, // xdeathstate + sfx_s3k35, // deathsound + 2*FRACUNIT, // speed + 32*FRACUNIT, // radius + 64*FRACUNIT, // height + 0, // display offset + 1000, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL|MF_SHOOTABLE|MF_NOGRAVITY|MF_BOSS, // flags + S_NULL // raisestate + }, + { // MT_TELEPORTMAN 751, // doomednum S_INVISIBLE, // spawnstate diff --git a/src/info.h b/src/info.h index ddbfc31b7..37babf44b 100644 --- a/src/info.h +++ b/src/info.h @@ -1037,6 +1037,7 @@ typedef enum sprite SPR_SBFL, SPR_SBSK, SPR_HBAT, + SPR_OLDK, // Debris SPR_SPRK, // Sparkle @@ -4308,6 +4309,11 @@ typedef enum state S_HANGSTER_RETURN2, S_HANGSTER_RETURN3, + S_OLDK_STND, + S_OLDK_DIE0, + S_OLDK_DIE1, + S_OLDK_DIE2, + S_CRUMBLE1, S_CRUMBLE2, @@ -5116,6 +5122,8 @@ typedef enum mobj_type MT_SPINBOBERT_FIRE2, MT_HANGSTER, + MT_OLDK, + // Utility Objects MT_TELEPORTMAN, MT_ALTVIEWMAN, diff --git a/src/p_mobj.c b/src/p_mobj.c index fb9e7d78e..b02c4be49 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9529,6 +9529,10 @@ static boolean P_MobjRegularThink(mobj_t *mobj) if (!P_HangsterThink(mobj)) return false; break; + case MT_OLDK: + if (mobj->health <= 0) + mobj->momz -= ((2*FRACUNIT)/3); + break; case MT_LHRT: mobj->momx = FixedMul(mobj->momx, mobj->extravalue2); mobj->momy = FixedMul(mobj->momy, mobj->extravalue2); From e215d233768bfebb8b0b94f1a2a2a6c496c89096 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Tue, 17 Dec 2024 20:26:17 +0100 Subject: [PATCH 263/353] Update outdated __HAIKU__ ifdefs --- src/dedicated/i_system.c | 21 +++++++++------------ src/sdl/i_system.c | 19 ++++++++----------- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 23c0149ca..87a8a8033 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -65,9 +65,9 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #pragma warning(default : 4214 4244) #endif -#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) -#if defined (__linux__) -#include +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (__linux__) || defined (__HAIKU__) +#include #else #include #include @@ -81,7 +81,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #endif #endif -#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) +#if defined (__linux__) || defined (UNIXCOMMON) #ifndef NOTERMIOS #include #include // ioctl @@ -96,8 +96,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #if defined (__unix__) || (defined (UNIXCOMMON) && !defined (__APPLE__)) #include #include +#ifndef __HAIKU__ // haiku's crash dialog is just objectively better #define NEWSIGNALHANDLER #endif +#endif #ifndef NOMUMBLE #ifdef __linux__ // need -lrt @@ -374,7 +376,7 @@ void I_Sleep(UINT32 ms) void I_SleepDuration(precise_t duration) { -#if defined(__linux__) || defined(__FreeBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__) UINT64 precision = I_GetPrecisePrecision(); struct timespec ts = { .tv_sec = duration / precision, @@ -1226,18 +1228,13 @@ void I_ShutdownSystem(void) void I_GetDiskFreeSpace(INT64* freespace) { #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) -#if defined (SOLARIS) || defined (__HAIKU__) - *freespace = INT32_MAX; - return; -#else // Both Linux and BSD have this, apparently. - struct statfs stfs; - if (statfs(srb2home, &stfs) == -1) + struct statvfs stfs; + if (statvfs(srb2home, &stfs) == -1) { *freespace = INT32_MAX; return; } *freespace = stfs.f_bavail * stfs.f_bsize; -#endif #elif defined (_WIN32) static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL; static boolean testwin95 = false; diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 07088b957..f787bbfbd 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -78,9 +78,9 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include "SDL_cpuinfo.h" #define HAVE_SDLCPUINFO -#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) -#if defined (__linux__) -#include +#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) +#if defined (__linux__) || defined (__HAIKU__) +#include #else #include #include @@ -94,7 +94,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #endif #endif -#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (__HAIKU__)) +#if defined (__linux__) || defined (UNIXCOMMON) #ifndef NOTERMIOS #include #include // ioctl @@ -109,8 +109,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #if defined (__unix__) || (defined (UNIXCOMMON) && !defined (__APPLE__)) #include #include +#ifndef __HAIKU__ // haiku's crash dialog is just objectively better #define NEWSIGNALHANDLER #endif +#endif #ifndef NOMUMBLE #ifdef __linux__ // need -lrt @@ -2754,18 +2756,13 @@ void I_ShutdownSystem(void) void I_GetDiskFreeSpace(INT64 *freespace) { #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) -#if defined (SOLARIS) || defined (__HAIKU__) - *freespace = INT32_MAX; - return; -#else // Both Linux and BSD have this, apparently. - struct statfs stfs; - if (statfs(srb2home, &stfs) == -1) + struct statvfs stfs; + if (statvfs(srb2home, &stfs) == -1) { *freespace = INT32_MAX; return; } *freespace = stfs.f_bavail * stfs.f_bsize; -#endif #elif defined (_WIN32) static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL; static boolean testwin95 = false; From f7b0e771debcf020596c1a2bdb58027dbb881f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Tue, 17 Dec 2024 20:43:09 +0100 Subject: [PATCH 264/353] Fix FreeBSD build --- src/dedicated/i_system.c | 1 + src/sdl/i_system.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 87a8a8033..02cb22a4f 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -69,6 +69,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #if defined (__linux__) || defined (__HAIKU__) #include #else +#include #include #include /*For meminfo*/ diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index f787bbfbd..77660f469 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -82,6 +82,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #if defined (__linux__) || defined (__HAIKU__) #include #else +#include #include #include /*For meminfo*/ From b20b71b895a528de2ac9f4ec07b7b8fa6e30b833 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Tue, 17 Dec 2024 19:18:31 -0600 Subject: [PATCH 265/353] Fix Knuckles --- src/hardware/hw_light.c | 4 ++- src/info.c | 69 +++++++++++++++++++++-------------------- src/info.h | 19 +++++++----- src/p_mobj.c | 8 ++--- 4 files changed, 53 insertions(+), 47 deletions(-) diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index a390092d1..2fefe3ed2 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -575,7 +575,6 @@ light_t *t_lspr[NUMSPRITES] = &lspr[BLUEBALL_L], // SPR_SBFL, &lspr[BLUEBALL_L], // SPR_SBSK, &lspr[NOLIGHT], // SPR_BATT, - &lspr[NOLIGHT], // SPR_OLDK, // Debris &lspr[RINGSPARK_L], // SPR_SPRK @@ -615,6 +614,9 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_GWLG &lspr[NOLIGHT], // SPR_GWLR + // LJ Knuckles + &lspr[NOLIGHT], // SPR_OLDK, + // Free slots &lspr[NOLIGHT], &lspr[NOLIGHT], diff --git a/src/info.c b/src/info.c index 2361de627..842d8bceb 100644 --- a/src/info.c +++ b/src/info.c @@ -486,7 +486,6 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "SBFL", "SBSK", "HBAT", - "OLDK", // Debris "SPRK", // Sparkle @@ -525,6 +524,9 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = // Gravity Well Objects "GWLG", "GWLR", + + // LJ Knuckles + "OLDK", }; char spr2names[NUMPLAYERSPRITES][MAXSPRITENAME + 1] = @@ -3937,11 +3939,6 @@ state_t states[NUMSTATES] = {SPR_HBAT, 3, 1, {NULL}, 0, 0, S_HANGSTER_RETURN1, 0}, // S_HANGSTER_RETURN2 {SPR_HBAT, 0, 15, {NULL}, 0, 0, S_HANGSTER_LOOK, 0}, // S_HANGSTER_RETURN3 - {SPR_OLDK, FF_ANIMATE, -1, {NULL}, 1, 16, S_NULL, 0}, // S_OLDK_STND - {SPR_OLDK, 2, 0, {A_ForceWin}, 0, 0, S_OLDK_DIE1, 0}, // S_OLDK_DIE0 - {SPR_OLDK, 2, 0, {A_Scream}, 0, 0, S_OLDK_DIE2, 0}, // S_OLDK_DIE1 - {SPR_OLDK, 2, -1, {A_ZThrust}, 14, 1|(1<<16), S_NULL, 0}, // S_OLDK_DIE2 - {SPR_NULL, 0, 35, {NULL}, 0, 0, S_CRUMBLE2, 0}, // S_CRUMBLE1 {SPR_NULL, 0, 105, {A_Scream}, 0, 0, S_NULL, 0}, // S_CRUMBLE2 @@ -4001,6 +3998,11 @@ state_t states[NUMSTATES] = {SPR_BRIY, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 31, 1, S_NULL, 0}, // S_YELLOWBRICKDEBRIS {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL, 0}, // S_NAMECHECK + + {SPR_OLDK, FF_ANIMATE, -1, {NULL}, 1, 16, S_NULL, 0}, // S_OLDK_STND + {SPR_OLDK, 2, 0, {A_ForceWin}, 0, 0, S_OLDK_DIE1, 0}, // S_OLDK_DIE0 + {SPR_OLDK, 2, 0, {A_Scream}, 0, 0, S_OLDK_DIE2, 0}, // S_OLDK_DIE1 + {SPR_OLDK, 2, -1, {A_ZThrust}, 14, 1|(1<<16), S_NULL, 0}, // S_OLDK_DIE2 }; mobjinfo_t mobjinfo[NUMMOBJTYPES] = @@ -20502,34 +20504,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - // MT_OLDK - { - 666, // doomednum - S_OLDK_STND, // spawnstate - 2, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 32, // reactiontime - sfx_None, // attacksound - S_OLDK_DIE0, // painstate - 128, // painchance - sfx_s3k35, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_OLDK_DIE0, // deathstate - S_NULL, // xdeathstate - sfx_s3k35, // deathsound - 2*FRACUNIT, // speed - 32*FRACUNIT, // radius - 64*FRACUNIT, // height - 0, // display offset - 1000, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL|MF_SHOOTABLE|MF_NOGRAVITY|MF_BOSS, // flags - S_NULL // raisestate - }, - { // MT_TELEPORTMAN 751, // doomednum S_INVISIBLE, // spawnstate @@ -21638,6 +21612,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = MF_NOBLOCKMAP|MF_NOSECTOR|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags S_NULL // raisestate }, + + { // MT_OLDK + 666, // doomednum + S_OLDK_STND, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 32, // reactiontime + sfx_None, // attacksound + S_OLDK_DIE0, // painstate + 128, // painchance + sfx_s3k35, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_OLDK_DIE0, // deathstate + S_NULL, // xdeathstate + sfx_s3k35, // deathsound + 2*FRACUNIT, // speed + 32*FRACUNIT, // radius + 64*FRACUNIT, // height + 0, // display offset + 1000, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL|MF_SHOOTABLE|MF_NOGRAVITY|MF_BOSS, // flags + S_NULL // raisestate + }, }; skincolor_t skincolors[MAXSKINCOLORS] = { diff --git a/src/info.h b/src/info.h index 37babf44b..db846fc1c 100644 --- a/src/info.h +++ b/src/info.h @@ -1037,7 +1037,6 @@ typedef enum sprite SPR_SBFL, SPR_SBSK, SPR_HBAT, - SPR_OLDK, // Debris SPR_SPRK, // Sparkle @@ -1077,6 +1076,9 @@ typedef enum sprite SPR_GWLG, SPR_GWLR, + // LJ Knuckles + SPR_OLDK, + SPR_FIRSTFREESLOT, SPR_LASTFREESLOT = SPR_FIRSTFREESLOT + NUMSPRITEFREESLOTS - 1, NUMSPRITES @@ -4309,11 +4311,6 @@ typedef enum state S_HANGSTER_RETURN2, S_HANGSTER_RETURN3, - S_OLDK_STND, - S_OLDK_DIE0, - S_OLDK_DIE1, - S_OLDK_DIE2, - S_CRUMBLE1, S_CRUMBLE2, @@ -4374,6 +4371,12 @@ typedef enum state S_NAMECHECK, + // LJ Knuckles + S_OLDK_STND, + S_OLDK_DIE0, + S_OLDK_DIE1, + S_OLDK_DIE2, + S_FIRSTFREESLOT, S_LASTFREESLOT = S_FIRSTFREESLOT + NUMSTATEFREESLOTS - 1, NUMSTATES @@ -5122,8 +5125,6 @@ typedef enum mobj_type MT_SPINBOBERT_FIRE2, MT_HANGSTER, - MT_OLDK, - // Utility Objects MT_TELEPORTMAN, MT_ALTVIEWMAN, @@ -5174,6 +5175,8 @@ typedef enum mobj_type MT_NAMECHECK, MT_RAY, // General purpose mobj + MT_OLDK, + MT_FIRSTFREESLOT, MT_LASTFREESLOT = MT_FIRSTFREESLOT + NUMMOBJFREESLOTS - 1, NUMMOBJTYPES diff --git a/src/p_mobj.c b/src/p_mobj.c index b02c4be49..aa17ddaac 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8061,6 +8061,10 @@ static boolean P_MobjBossThink(mobj_t *mobj) case MT_METALSONIC_BATTLE: P_Boss9Thinker(mobj); break; + case MT_OLDK: + if (mobj->health <= 0) + mobj->momz -= (2*FRACUNIT)/3; + break; default: // Generic SOC-made boss if (mobj->flags2 & MF2_SKULLFLY) P_SpawnGhostMobj(mobj); @@ -9529,10 +9533,6 @@ static boolean P_MobjRegularThink(mobj_t *mobj) if (!P_HangsterThink(mobj)) return false; break; - case MT_OLDK: - if (mobj->health <= 0) - mobj->momz -= ((2*FRACUNIT)/3); - break; case MT_LHRT: mobj->momx = FixedMul(mobj->momx, mobj->extravalue2); mobj->momy = FixedMul(mobj->momy, mobj->extravalue2); From 493190675398fbd9455bfd1915434cbbf4c53970 Mon Sep 17 00:00:00 2001 From: Fancy2209 <4370-Fancy2209@users.noreply.git.do.srb2.org> Date: Wed, 18 Dec 2024 18:51:58 +0000 Subject: [PATCH 266/353] Fix CMake not finding OpenMPT on Haiku --- cmake/Modules/Findlibopenmpt.cmake | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/Findlibopenmpt.cmake b/cmake/Modules/Findlibopenmpt.cmake index d7de22134..96cc31026 100644 --- a/cmake/Modules/Findlibopenmpt.cmake +++ b/cmake/Modules/Findlibopenmpt.cmake @@ -1,14 +1,16 @@ include(LibFindMacros) -libfind_pkg_check_modules(libopenmpt_PKGCONF openmpt) +libfind_pkg_check_modules(libopenmpt_PKGCONF openmpt libopenmpt) find_path(libopenmpt_INCLUDE_DIR NAMES libopenmpt.h PATHS ${libopenmpt_PKGCONF_INCLUDE_DIRS} - "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/libopenmpt" - "/usr/include/libopenmpt" - "/usr/local/include/libopenmpt" + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" + "/usr/include" + "/usr/local/include" + PATH_SUFFIXES ++ libopenmpt ) find_library(libopenmpt_LIBRARY From 5205d64f4a4ddd61de2b462655cdeb3ee8070657 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:10:22 -0600 Subject: [PATCH 267/353] Update f_finale.c --- src/f_finale.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index 0f7ef65c5..2258d3773 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1136,6 +1136,7 @@ static const char *credits[] = { "Victor \"VAdaPEGA\" Ara\x1Fjo", // Araújo "Malcolm \"RedXVI\" Brown", "Dave \"DemonTomatoDave\" Bulmer", + "Dan Cidoni", // aka Krabs "Paul \"Boinciel\" Clempson", "\"Cyan Helkaraxe\"", "Claire \"clairebun\" Ellis", @@ -1154,18 +1155,19 @@ static const char *credits[] = { "Colette \"fickleheart\" Bordelon", "Hank \"FuriousFox\" Brannock", "Matthew \"Fawfulfan\" Chapman", + "Dan Cidoni", // aka Krabs "Paul \"Boinciel\" Clempson", "Sally \"TehRealSalt\" Cochenour", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", "Ben \"Mystic\" Geyer", "Nathan \"Jazz\" Giroux", + "\"GomaTheMascar\"", "Vivian \"toaster\" Grannell", "James \"SeventhSentinel\" Hall", "Kepa \"Nev3r\" Iceta", "Thomas \"Shadow Hog\" Igoe", "Mujamel \"MK\" Khan", - "\"Krabs\"", "\"Kaito Sinclaire\"", "Alexander \"DrTapeworm\" Moench-Ford", "\"Radicalicious\"", From 4dfbfa80d57d77b137f367b15f4a5b46d34e0b74 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 18 Dec 2024 21:07:34 -0300 Subject: [PATCH 268/353] Restrict console script execution the same way Lua does --- src/command.c | 77 +++++++++++++++++++++++++++++---------------------- src/command.h | 3 ++ src/deh_soc.c | 4 +-- src/p_setup.c | 4 +-- src/p_spec.c | 2 +- 5 files changed, 52 insertions(+), 38 deletions(-) diff --git a/src/command.c b/src/command.c index 8f9166361..29f491e29 100644 --- a/src/command.c +++ b/src/command.c @@ -648,7 +648,7 @@ static void COM_ExecuteString(char *ptext) { if ((com_flags & COM_LUA) && !(cmd->flags & COM_LUA)) { - CONS_Alert(CONS_WARNING, "Command '%s' cannot be run from Lua.\n", cmd->name); + CONS_Alert(CONS_WARNING, "Command '%s' cannot be run from a script.\n", cmd->name); return; } @@ -809,49 +809,60 @@ static void COM_CEchoDuration_f(void) /** Executes a script file. */ -static void COM_Exec_f(void) +boolean COM_ExecFile(const char *scriptname, com_flags_t flags, boolean silent) { UINT8 *buf = NULL; char filename[256]; + if (!D_CheckPathAllowed(scriptname, "tried to exec")) + return false; + + // load file + // Try with Argv passed verbatim first, for back compat + FIL_ReadFile(scriptname, &buf); + + if (!buf) + { + // Now try by searching the file path + // filename is modified with the full found path + strlcpy(filename, scriptname, sizeof(filename)); + if (findfile(filename, NULL, true) != FS_NOTFOUND) + FIL_ReadFile(filename, &buf); + + if (!buf) + return false; + } + + if (!silent) + CONS_Printf(M_GetText("Executing %s\n"), scriptname); + + // insert text file into the command buffer + COM_BufAddTextEx((char *)buf, flags); + COM_BufAddTextEx("\n", flags); + + // free buffer + Z_Free(buf); + + return true; +} + +static void COM_Exec_f(void) +{ + boolean silent; + if (COM_Argc() < 2 || COM_Argc() > 3) { CONS_Printf(M_GetText("exec : run a script file\n")); return; } - if (!D_CheckPathAllowed(COM_Argv(1), "tried to exec")) + silent = COM_CheckParm("-silent"); + + if (COM_ExecFile(COM_Argv(1), com_flags, silent)) return; - // load file - // Try with Argv passed verbatim first, for back compat - FIL_ReadFile(COM_Argv(1), &buf); - - if (!buf) - { - // Now try by searching the file path - // filename is modified with the full found path - strcpy(filename, COM_Argv(1)); - if (findfile(filename, NULL, true) != FS_NOTFOUND) - FIL_ReadFile(filename, &buf); - - if (!buf) - { - if (!COM_CheckParm("-noerror")) - CONS_Printf(M_GetText("couldn't execute file %s\n"), COM_Argv(1)); - return; - } - } - - if (!COM_CheckParm("-silent")) - CONS_Printf(M_GetText("executing %s\n"), COM_Argv(1)); - - // insert text file into the command buffer - COM_BufAddTextEx((char *)buf, com_flags); - COM_BufAddTextEx("\n", com_flags); - - // free buffer - Z_Free(buf); + if (!COM_CheckParm("-noerror")) + CONS_Printf(M_GetText("Couldn't execute file %s\n"), COM_Argv(1)); } /** Delays execution of the rest of the commands until the next frame. @@ -2493,7 +2504,7 @@ static boolean CV_Command(void) if (CV_Immutable(v)) { - CONS_Alert(CONS_WARNING, "Variable '%s' cannot be changed from Lua.\n", v->name); + CONS_Alert(CONS_WARNING, "Variable '%s' cannot be changed from a script.\n", v->name); return true; } diff --git a/src/command.h b/src/command.h index c1ac7d486..70342a785 100644 --- a/src/command.h +++ b/src/command.h @@ -66,6 +66,9 @@ void COM_ImmedExecute(const char *ptext); // Execute commands in buffer, flush them void COM_BufExecute(void); +// Executes a script from a file +boolean COM_ExecFile(const char *scriptname, com_flags_t flags, boolean silent); + // As above; and progress the wait timer. void COM_BufTicker(void); diff --git a/src/deh_soc.c b/src/deh_soc.c index c0e646f60..912ac5425 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3584,7 +3584,7 @@ void readmaincfg(MYFILE *f) if (fastcmp(word, "EXECCFG")) { if (strchr(word2, '.')) - COM_BufAddText(va("exec %s\n", word2)); + COM_ExecFile(word2, COM_LUA, false); else { lumpnum_t lumpnum; @@ -3599,7 +3599,7 @@ void readmaincfg(MYFILE *f) if (lumpnum == LUMPERROR || W_LumpLength(lumpnum) == 0) CONS_Debug(DBG_SETUP, "SOC Error: script lump %s not found/not valid.\n", newname); else - COM_BufInsertText(W_CacheLumpNum(lumpnum, PU_CACHE)); + COM_BufInsertTextEx(W_CacheLumpNum(lumpnum, PU_CACHE), COM_LUA); } } diff --git a/src/p_setup.c b/src/p_setup.c index 93286219d..8a40868a5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7369,11 +7369,11 @@ static void P_RunLevelScript(const char *scriptname) return; } - COM_BufInsertText(W_CacheLumpNum(lumpnum, PU_CACHE)); + COM_BufInsertTextEx(W_CacheLumpNum(lumpnum, PU_CACHE), COM_LUA); } else { - COM_BufAddText(va("exec %s\n", scriptname)); + COM_ExecFile(scriptname, COM_LUA, false); } COM_BufExecute(); // Run it! } diff --git a/src/p_spec.c b/src/p_spec.c index d375d3e2f..7d53c4ba8 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2546,7 +2546,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) char *text = Z_Malloc(len + 1, PU_CACHE, NULL); memcpy(text, lump, len); text[len] = '\0'; - COM_BufInsertText(text); + COM_BufInsertTextEx(text, COM_LUA); Z_Free(text); } } From 102ba86869b0da2308397aca362addfd3fbea77f Mon Sep 17 00:00:00 2001 From: pastel Date: Thu, 19 Dec 2024 14:11:01 -0600 Subject: [PATCH 269/353] Correctly force Sonic in the tutorial --- src/m_menu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/m_menu.c b/src/m_menu.c index 63a702474..88a69b5a5 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8511,6 +8511,7 @@ static void M_StartTutorial(INT32 choice) gamecomplete = 0; cursaveslot = 0; maplistoption = 0; + CV_StealthSet(&cv_skin, DEFAULTSKIN); // tutorial accounts for sonic only G_DeferedInitNew(false, G_BuildMapName(tutorialmap), 0, false, false); } From db5d9053f2dbe37286926ddec791889537526b47 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Thu, 19 Dec 2024 21:49:52 -0600 Subject: [PATCH 270/353] Most Pipe Towers stuff, I'm tired Added Linedef type 430: Bounce Player, bouncy FOFs suck ass Revamped a few existing PTZ assets Added most new PTZ decorations, only missing shield mushrooms and trampolines (but I'll probably replace the latter with springs idk) also Dave goes by Skydusk now --- src/deh_tables.c | 65 +++-- src/f_finale.c | 3 +- src/hardware/hw_light.c | 17 ++ src/info.c | 554 ++++++++++++++++++++++++++++++++++++++-- src/info.h | 82 ++++-- src/p_enemy.c | 11 +- src/p_setup.c | 4 + src/p_spec.c | 12 + src/sounds.c | 2 + src/sounds.h | 2 + 10 files changed, 688 insertions(+), 64 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 91163b206..48ce34931 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3185,37 +3185,28 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_RINGEXPLODE", - "S_COIN1", - "S_COIN2", - "S_COIN3", + // Mario-specific stuff + "S_COIN", "S_COINSPARKLE1", "S_COINSPARKLE2", - "S_COINSPARKLE3", - "S_COINSPARKLE4", "S_GOOMBA1", "S_GOOMBA1B", "S_GOOMBA2", "S_GOOMBA3", "S_GOOMBA4", "S_GOOMBA5", - "S_GOOMBA6", - "S_GOOMBA7", - "S_GOOMBA8", - "S_GOOMBA9", "S_GOOMBA_DEAD", + "S_GOOMBA_DEAD2", + "S_GOOMBA_DEAD3", "S_BLUEGOOMBA1", "S_BLUEGOOMBA1B", "S_BLUEGOOMBA2", "S_BLUEGOOMBA3", "S_BLUEGOOMBA4", "S_BLUEGOOMBA5", - "S_BLUEGOOMBA6", - "S_BLUEGOOMBA7", - "S_BLUEGOOMBA8", - "S_BLUEGOOMBA9", "S_BLUEGOOMBA_DEAD", - - // Mario-specific stuff + "S_BLUEGOOMBA_DEAD2", + "S_BLUEGOOMBA_DEAD3", "S_FIREFLOWER1", "S_FIREFLOWER2", "S_FIREFLOWER3", @@ -3223,6 +3214,13 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_FIREBALL", "S_FIREBALLTRAIL1", "S_FIREBALLTRAIL2", + "S_GREENKOOPASPAWN", + "S_GREENKOOPA1", + "S_GREENKOOPA2", + "S_GREENKOOPA3", + "S_GREENKOOPA4", + "S_GREENKOOPADEATH1", + "S_GREENKOOPADEATH2", "S_SHELL", "S_PUMA_START1", "S_PUMA_START2", @@ -3248,6 +3246,21 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_MARIOBUSH1", "S_MARIOBUSH2", "S_TOAD", + "S_PTZSHROOM", + "S_PTZFLAG1", + "S_PTZFLAG2", + "S_PTZFLAG3", + "S_PTZFLAG4", + "S_PTZFLAG5", + "S_MARIOBUSH", + "S_BSBSHROOM", + "S_BLBSHROOM", + "S_BNWSHROOM", + "S_REDMFLOWER", + "S_BLUEMFLOWER", + "S_YELLOWMFLOWER", + "S_WHITEDANDELION", + "S_MAR64TREE", // Nights-specific stuff "S_NIGHTSDRONE_MAN1", @@ -3550,6 +3563,11 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_REDBRICKDEBRIS", "S_BLUEBRICKDEBRIS", "S_YELLOWBRICKDEBRIS", + "S_MARIOBRICKDEBRIS", + "S_MARIOBRICKDEBRISS", + "S_MARIOBRICKDEBRISB", + "S_MARIOBRICKDEBRISC", + "S_MARIOBRICKDEBRISM", "S_NAMECHECK", }; @@ -4219,6 +4237,7 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_FIREFLOWER", "MT_FIREBALL", "MT_FIREBALLTRAIL", + "MT_GREENKOOPA", "MT_SHELL", "MT_PUMA", "MT_PUMATRAIL", @@ -4229,6 +4248,17 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_MARIOBUSH1", "MT_MARIOBUSH2", "MT_TOAD", + "MT_PTZSHROOM", + "MT_PTZFLAG", + "MT_BSBSHROOM", + "MT_BLBSHROOM", + "MT_BNWSHROOM", + "MT_MARIOBUSH", + "MT_REDMFLOWER", + "MT_BLUEMFLOWER", + "MT_YELLOWMFLOWER", + "MT_WHITEDANDELION", + "MT_MAR64TREE", // NiGHTS Stuff "MT_AXIS", @@ -4326,6 +4356,11 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_REDBRICKDEBRIS", "MT_BLUEBRICKDEBRIS", "MT_YELLOWBRICKDEBRIS", + "MT_MARIOBRICKDEBRIS", + "MT_MARIOBRICKDEBRISS", + "MT_MARIOBRICKDEBRISB", + "MT_MARIOBRICKDEBRISC", + "MT_MARIOBRICKDEBRISM", "MT_NAMECHECK", "MT_RAY", diff --git a/src/f_finale.c b/src/f_finale.c index 2258d3773..61c2ff561 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1104,7 +1104,6 @@ static const char *credits[] = { "\"ChrispyPixels\"", "Paul \"Boinciel\" Clempson", "Sally \"TehRealSalt\" Cochenour", - "\"Dave Lite\"", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", "\"DirkTheHusky\"", @@ -1124,6 +1123,7 @@ static const char *credits[] = { "\"MotorRoach\"", "Phillip \"TelosTurntable\" Robinson", "\"Scizor300\"", + "\"Skydusk\"", "Wessel \"sphere\" Smit", "David \"Instant Sonic\" Spencer Jr.", "\"SSNTails\"", @@ -1173,6 +1173,7 @@ static const char *credits[] = { "\"Radicalicious\"", "\"Revan\"", "Anna \"QueenDelta\" Sandlin", + "\"Skydusk\"", "Wessel \"sphere\" Smit", "\"SSNTails\"", "Aaron \"Othius\" Stojkov", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 2fefe3ed2..e118fff51 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -539,6 +539,7 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_BGOM &lspr[REDBALL_L], // SPR_FFWR &lspr[SMALLREDBALL_L], // SPR_FBLL + &lspr[NOLIGHT], // SPR_MKOP &lspr[NOLIGHT], // SPR_SHLL &lspr[REDBALL_L], // SPR_PUMA &lspr[NOLIGHT], // SPR_HAMM @@ -609,6 +610,22 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_BRIR &lspr[NOLIGHT], // SPR_BRIB &lspr[NOLIGHT], // SPR_BRIY + &lspr[NOLIGHT], // SPR_MBRI + &lspr[NOLIGHT], // SPR_MBRS + &lspr[NOLIGHT], // SPR_MBRB + &lspr[NOLIGHT], // SPR_MBRC + &lspr[NOLIGHT], // SPR_MTRI + &lspr[NOLIGHT], // SPR_MARS + &lspr[NOLIGHT], // SPR_MRFL + &lspr[NOLIGHT], // SPR_MAUH + &lspr[NOLIGHT], // SPR_MBSA + &lspr[NOLIGHT], // SPR_MBSB + &lspr[NOLIGHT], // SPR_MBSC + &lspr[NOLIGHT], // SPR_MFRE + &lspr[NOLIGHT], // SPR_MFYE + &lspr[NOLIGHT], // SPR_MFBE + &lspr[NOLIGHT], // SPR_MFWD + &lspr[NOLIGHT], // SPR_MUS3 // Gravity Well Objects &lspr[NOLIGHT], // SPR_GWLG diff --git a/src/info.c b/src/info.c index 842d8bceb..0008b4dae 100644 --- a/src/info.c +++ b/src/info.c @@ -450,6 +450,7 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "BGOM", "FFWR", "FBLL", + "MKOP", "SHLL", "PUMA", "HAMM", @@ -459,6 +460,17 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "MUS1", "MUS2", "TOAD", + "MARS", + "MRFL", + "MAUH", + "MBSA", + "MBSB", + "MBSC", + "MFRE", + "MFYE", + "MFBE", + "MFWD", + "MUS3", // NiGHTS Stuff "NDRN", // NiGHTS drone @@ -520,6 +532,11 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "BRIR", // CEZ3 colored bricks "BRIB", // CEZ3 colored bricks "BRIY", // CEZ3 colored bricks + "MBRI", + "MBRS", + "MBRB", + "MBRC", + "MTRI", // Gravity Well Objects "GWLG", @@ -3599,41 +3616,33 @@ state_t states[NUMSTATES] = {SPR_NULL, 0, 1, {A_RingExplode}, 0, 0, S_XPLD1, 0}, // S_RINGEXPLODE // Coin - {SPR_COIN, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_COIN2, 0}, // S_COIN1 - {SPR_COIN, FF_FULLBRIGHT|1, 5, {NULL}, 0, 0, S_COIN3, 0}, // S_COIN2 - {SPR_COIN, FF_FULLBRIGHT|2, 5, {NULL}, 0, 0, S_COIN1, 0}, // S_COIN3 + {SPR_COIN, FF_ANIMATE, 32, {NULL}, 15, 2, S_COIN, 0}, // S_COIN // Coin Sparkle - {SPR_CPRK, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_COINSPARKLE2, 0}, // S_COINSPARKLE1 - {SPR_CPRK, FF_FULLBRIGHT|1, 5, {NULL}, 0, 0, S_COINSPARKLE3, 0}, // S_COINSPARKLE2 - {SPR_CPRK, FF_FULLBRIGHT|2, 5, {NULL}, 0, 0, S_COINSPARKLE4, 0}, // S_COINSPARKLE3 - {SPR_CPRK, FF_FULLBRIGHT|3, 5, {NULL}, 0, 0, S_NULL, 0}, // S_COINSPARKLE4 + {SPR_CPRK, 1|FF_FULLBRIGHT|FF_TRANS30|FF_ADD, 2, {A_ForceStop}, 0, 0, S_COINSPARKLE2, 0}, // S_COINSPARKLE1 + {SPR_CPRK, 2|FF_FULLBRIGHT|FF_ANIMATE|FF_TRANS30|FF_ADD, 20, {NULL}, 9, 2, S_NULL, 0}, // S_COINSPARKLE2 // Goomba {SPR_GOOM, 0, 6, {A_Look}, 0, 0, S_GOOMBA1B, 0}, // S_GOOMBA1 {SPR_GOOM, 1, 6, {A_Look}, 0, 0, S_GOOMBA1, 0}, // S_GOOMBA1B - {SPR_GOOM, 0, 3, {A_Chase}, 0, 0, S_GOOMBA3, 0}, // S_GOOMBA2 - {SPR_GOOM, 0, 3, {A_Chase}, 0, 0, S_GOOMBA4, 0}, // S_GOOMBA3 - {SPR_GOOM, 1, 3, {A_Chase}, 0, 0, S_GOOMBA5, 0}, // S_GOOMBA4 - {SPR_GOOM, 1, 3, {A_Chase}, 0, 0, S_GOOMBA6, 0}, // S_GOOMBA5 - {SPR_GOOM, 0, 3, {A_Chase}, 0, 0, S_GOOMBA7, 0}, // S_GOOMBA6 - {SPR_GOOM, 0, 3, {A_Chase}, 0, 0, S_GOOMBA8, 0}, // S_GOOMBA7 - {SPR_GOOM, 1, 3, {A_Chase}, 0, 0, S_GOOMBA9, 0}, // S_GOOMBA8 - {SPR_GOOM, 1, 3, {A_Chase}, 0, 0, S_GOOMBA2, 0}, // S_GOOMBA9 - {SPR_GOOM, 2, 16, {A_Scream}, 0, 0, S_NULL, 0}, // S_GOOMBA_DEAD + {SPR_GOOM, 0, 6, {A_Chase}, 0, 0, S_GOOMBA3, 0}, // S_GOOMBA2 + {SPR_GOOM, 1, 6, {A_Chase}, 0, 0, S_GOOMBA4, 0}, // S_GOOMBA3 + {SPR_GOOM, 2, 6, {A_Chase}, 0, 0, S_GOOMBA5, 0}, // S_GOOMBA4 + {SPR_GOOM, 3, 6, {A_Chase}, 0, 0, S_GOOMBA2, 0}, // S_GOOMBA5 + {SPR_GOOM, 4, 8, {A_Scream}, 0, 0, S_GOOMBA_DEAD2, 0}, // S_GOOMBA_DEAD + {SPR_GOOM, 5, 4, {NULL}, 0, 0, S_GOOMBA_DEAD3, 0}, // S_GOOMBA_DEAD2 + {SPR_GOOM, 4, 15, {NULL}, 0, 0, S_NULL, 0}, // S_GOOMBA_DEAD3 // Blue Goomba {SPR_BGOM, 0, 6, {A_Look}, 0, 0, S_BLUEGOOMBA1B, 0}, // S_BLUEGOOMBA1 {SPR_BGOM, 1, 6, {A_Look}, 0, 0, S_BLUEGOOMBA1, 0}, // S_BLUEGOOMBA1B - {SPR_BGOM, 0, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA3, 0}, // S_BLUEGOOMBA2 - {SPR_BGOM, 0, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA4, 0}, // S_BLUEGOOMBA3 - {SPR_BGOM, 1, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA5, 0}, // S_BLUEGOOMBA4 - {SPR_BGOM, 1, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA6, 0}, // S_BLUEGOOMBA5 - {SPR_BGOM, 0, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA7, 0}, // S_BLUEGOOMBA6 - {SPR_BGOM, 0, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA8, 0}, // S_BLUEGOOMBA7 - {SPR_BGOM, 1, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA9, 0}, // S_BLUEGOOMBA8 - {SPR_BGOM, 1, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA2, 0}, // S_BLUEGOOMBA9 - {SPR_BGOM, 2, 16, {A_Scream}, 0, 0, S_NULL, 0}, // S_BLUEGOOMBA_DEAD + {SPR_BGOM, 0, 6, {A_Chase}, 0, 0, S_BLUEGOOMBA3, 0}, // S_BLUEGOOMBA2 + {SPR_BGOM, 1, 6, {A_Chase}, 0, 0, S_BLUEGOOMBA4, 0}, // S_BLUEGOOMBA3 + {SPR_BGOM, 2, 6, {A_Chase}, 0, 0, S_BLUEGOOMBA5, 0}, // S_BLUEGOOMBA4 + {SPR_BGOM, 3, 6, {A_Chase}, 0, 0, S_BLUEGOOMBA2, 0}, // S_BLUEGOOMBA5 + {SPR_BGOM, 4, 8, {A_Scream}, 0, 0, S_BLUEGOOMBA_DEAD2, 0}, // S_BLUEGOOMBA_DEAD + {SPR_BGOM, 5, 4, {NULL}, 0, 0, S_BLUEGOOMBA_DEAD3, 0}, // S_BLUEGOOMBA_DEAD2 + {SPR_BGOM, 4, 15, {NULL}, 0, 0, S_NULL, 0}, // S_BLUEGOOMBA_DEAD3 // Fire Flower {SPR_FFWR, 0, 3, {NULL}, 0, 0, S_FIREFLOWER2, 0}, // S_FIREFLOWER1 @@ -3646,7 +3655,16 @@ state_t states[NUMSTATES] = {SPR_FBLL, 1|FF_FULLBRIGHT|FF_TRANS50, 1, {A_SetScale}, FRACUNIT*3/4, 0, S_FIREBALLTRAIL2, 0}, // S_FIREBALLTRAIL1 {SPR_FBLL, 1|FF_FULLBRIGHT|FF_TRANS50, 8, {A_SetScale}, FRACUNIT/6, 1, S_NULL, 0}, // S_FIREBALLTRAIL2 - // Turtle Shell + // Green Koopa + {SPR_MKOP, 0, 1, {A_Look}, 0, 0, S_GREENKOOPASPAWN, 0}, // S_GREENKOOPASPAWN + {SPR_MKOP, 0, 5, {A_GuardChase}, 1, 0, S_GREENKOOPA2, 0}, // S_GREENKOOPA1 + {SPR_MKOP, 1, 5, {A_GuardChase}, 1, 0, S_GREENKOOPA3, 0}, // S_GREENKOOPA2 + {SPR_MKOP, 2, 5, {A_GuardChase}, 1, 0, S_GREENKOOPA4, 0}, // S_GREENKOOPA3 + {SPR_MKOP, 3, 5, {A_GuardChase}, 1, 0, S_GREENKOOPA1, 0}, // S_GREENKOOPA4 + {SPR_MKOP, 3, 1, {A_Scream}, 0, 0, S_GREENKOOPADEATH2, 0}, // S_GREENKOOPADEATH1 + {SPR_MKOP, 3, 1, {A_SpawnObjectRelative}, 0|0, 0|MT_SHELL, S_NULL, 0}, // S_GREENKOOPADEATH2 + + // Koopa Shell {SPR_SHLL, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHELL // Puma (Mario fireball) @@ -3684,6 +3702,22 @@ state_t states[NUMSTATES] = {SPR_MUS2, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_MARIOBUSH2 {SPR_TOAD, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_TOAD + {SPR_MARS, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_PTZSHROOM + {SPR_MRFL, 0|FF_PAPERSPRITE, 4, {NULL}, 0, 0, S_PTZFLAG2, 0}, // S_PTZFLAG1 + {SPR_MRFL, 1|FF_PAPERSPRITE, 4, {NULL}, 0, 0, S_PTZFLAG3, 0}, // S_PTZFLAG2 + {SPR_MRFL, 2|FF_PAPERSPRITE, 4, {NULL}, 0, 0, S_PTZFLAG4, 0}, // S_PTZFLAG3 + {SPR_MRFL, 3|FF_PAPERSPRITE, 4, {NULL}, 0, 0, S_PTZFLAG5, 0}, // S_PTZFLAG4 + {SPR_MRFL, 4|FF_PAPERSPRITE, 4, {NULL}, 0, 0, S_PTZFLAG1, 0}, // S_PTZFLAG5 + {SPR_MAUH, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL, 0}, // S_MARIOBUSH + {SPR_MBSA, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BSBSHROOM + {SPR_MBSB, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BLBSHROOM + {SPR_MBSC, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BNWSHROOM + {SPR_MFRE, FF_ANIMATE, -1, {NULL}, 3, 4, S_NULL, 0}, // S_REDMFLOWER + {SPR_MFBE, FF_ANIMATE, -1, {NULL}, 3, 4, S_NULL, 0}, // S_BLUEMFLOWER + {SPR_MFYE, FF_ANIMATE, -1, {NULL}, 3, 4, S_NULL, 0}, // S_YELLOWMFLOWER + {SPR_MFWD, FF_ANIMATE, -1, {NULL}, 3, 6, S_NULL, 0}, // S_WHITEDANDELION + {SPR_MUS3, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_MAR64TREE + // Nights Drone {SPR_NDRN, 0, -1, {NULL}, 0, 0, S_NIGHTSDRONE_MAN2, 0}, // S_NIGHTSDRONE_MAN1 {SPR_NDRN, 0, -1, {NULL}, 0, 0, S_NIGHTSDRONE_MAN1, 0}, // S_NIGHTSDRONE_MAN2 @@ -3996,6 +4030,11 @@ state_t states[NUMSTATES] = {SPR_BRIR, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 31, 1, S_NULL, 0}, // S_REDBRICKDEBRIS {SPR_BRIB, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 31, 1, S_NULL, 0}, // S_BLUEBRICKDEBRIS {SPR_BRIY, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 31, 1, S_NULL, 0}, // S_YELLOWBRICKDEBRIS + {SPR_MBRI, FF_ANIMATE, 50, {NULL}, 9, 2, S_NULL, 0}, // S_MARIOBRICKDEBRIS + {SPR_MBRS, FF_ANIMATE, 50, {NULL}, 9, 2, S_NULL, 0}, // S_MARIOBRICKDEBRISS + {SPR_MBRB, FF_ANIMATE, 50, {NULL}, 9, 2, S_NULL, 0}, // S_MARIOBRICKDEBRISB + {SPR_MBRC, FF_ANIMATE, 50, {NULL}, 9, 2, S_NULL, 0}, // S_MARIOBRICKDEBRISC + {SPR_MTRI, FF_ANIMATE, 50, {NULL}, 3, 4, S_NULL, 0}, // S_MARIOBRICKDEBRISM {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL, 0}, // S_NAMECHECK @@ -18887,7 +18926,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_COIN 1800, // doomednum - S_COIN1, // spawnstate + S_COIN, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -18914,7 +18953,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_FLINGCOIN -1, // doomednum - S_COIN1, // spawnstate + S_COIN, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -19074,6 +19113,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_GREENKOOPA + 1832, // doomednum + S_GREENKOOPASPAWN, // spawnstate + 1, // spawnhealth + S_GREENKOOPA1, // seestate + sfx_None, // seesound + 1, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_GREENKOOPADEATH1, // deathstate + S_NULL, // xdeathstate + sfx_mario2, // deathsound + 12, // speed + 16*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 1, // damage + sfx_mario1, // activesound + MF_SPECIAL|MF_SHOOTABLE|MF_BOUNCE, // flags + S_NULL // raisestate + }, + { // MT_SHELL 1804, // doomednum S_SHELL, // spawnstate @@ -19343,6 +19409,303 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_PTZSHROOM + 1811, // doomednum + S_PTZSHROOM, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 96*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_PTZFLAG + 1812, // doomednum + S_PTZFLAG1, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 96*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_MARIOBUSH + 1819, // doomednum + S_MARIOBUSH, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 96*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_BSBSHROOM + 1820, // doomednum + S_BSBSHROOM, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 96*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_BLBSHROOM + 1821, // doomednum + S_BLBSHROOM, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 96*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_BNWSHROOM + 1822, // doomednum + S_BNWSHROOM, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 96*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_REDMFLOWER + 1823, // doomednum + S_REDMFLOWER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 96*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_BLUEMFLOWER + 1842, // doomednum + S_BLUEMFLOWER, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 96*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_YELLOWMFLOWER + 1824, // doomednum + S_YELLOWMFLOWER,// spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 96*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_WHITEDANDELION + 1840, // doomednum + S_WHITEDANDELION, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 96*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_MAR64TREE + 1847, // doomednum + S_MAR64TREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 150*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + { // MT_AXIS 1700, // doomednum S_INVISIBLE, // spawnstate @@ -21559,6 +21922,141 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_MARIOBRICKDEBRIS + -1, // doomednum + S_MARIOBRICKDEBRIS, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 35, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 6, // speed + 16*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_marioc, // activesound + MF_NOCLIPHEIGHT|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_MARIOBRICKDEBRISS + -1, // doomednum + S_MARIOBRICKDEBRISS, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 35, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 6, // speed + 16*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_marioc, // activesound + MF_NOCLIPHEIGHT|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_MARIOBRICKDEBRISB + -1, // doomednum + S_MARIOBRICKDEBRISB, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 35, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 6, // speed + 16*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_marioc, // activesound + MF_NOCLIPHEIGHT|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_MARIOBRICKDEBRISC + -1, // doomednum + S_MARIOBRICKDEBRISC, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 35, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 6, // speed + 16*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_marioc, // activesound + MF_NOCLIPHEIGHT|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_MARIOBRICKDEBRISM + -1, // doomednum + S_MARIOBRICKDEBRISM, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 35, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 6, // speed + 16*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_marioc, // activesound + MF_NOCLIPHEIGHT|MF_SCENERY, // flags + S_NULL // raisestate + }, + { // MT_NAMECHECK -1, // doomednum S_NAMECHECK, // spawnstate diff --git a/src/info.h b/src/info.h index db846fc1c..be75e0024 100644 --- a/src/info.h +++ b/src/info.h @@ -1001,6 +1001,7 @@ typedef enum sprite SPR_BGOM, SPR_FFWR, SPR_FBLL, + SPR_MKOP, SPR_SHLL, SPR_PUMA, SPR_HAMM, @@ -1010,6 +1011,17 @@ typedef enum sprite SPR_MUS1, SPR_MUS2, SPR_TOAD, + SPR_MARS, + SPR_MRFL, + SPR_MAUH, + SPR_MBSA, + SPR_MBSB, + SPR_MBSC, + SPR_MFRE, + SPR_MFYE, + SPR_MFBE, + SPR_MFWD, + SPR_MUS3, // NiGHTS Stuff SPR_NDRN, // NiGHTS drone @@ -1071,6 +1083,11 @@ typedef enum sprite SPR_BRIR, // CEZ3 colored bricks SPR_BRIB, SPR_BRIY, + SPR_MBRI, + SPR_MBRS, + SPR_MBRB, + SPR_MBRC, + SPR_MTRI, // Gravity Well Objects SPR_GWLG, @@ -4003,37 +4020,28 @@ typedef enum state S_RINGEXPLODE, - S_COIN1, - S_COIN2, - S_COIN3, + // Mario-specific stuff + S_COIN, S_COINSPARKLE1, S_COINSPARKLE2, - S_COINSPARKLE3, - S_COINSPARKLE4, S_GOOMBA1, S_GOOMBA1B, S_GOOMBA2, S_GOOMBA3, S_GOOMBA4, S_GOOMBA5, - S_GOOMBA6, - S_GOOMBA7, - S_GOOMBA8, - S_GOOMBA9, S_GOOMBA_DEAD, + S_GOOMBA_DEAD2, + S_GOOMBA_DEAD3, S_BLUEGOOMBA1, S_BLUEGOOMBA1B, S_BLUEGOOMBA2, S_BLUEGOOMBA3, S_BLUEGOOMBA4, S_BLUEGOOMBA5, - S_BLUEGOOMBA6, - S_BLUEGOOMBA7, - S_BLUEGOOMBA8, - S_BLUEGOOMBA9, S_BLUEGOOMBA_DEAD, - - // Mario-specific stuff + S_BLUEGOOMBA_DEAD2, + S_BLUEGOOMBA_DEAD3, S_FIREFLOWER1, S_FIREFLOWER2, S_FIREFLOWER3, @@ -4041,6 +4049,13 @@ typedef enum state S_FIREBALL, S_FIREBALLTRAIL1, S_FIREBALLTRAIL2, + S_GREENKOOPASPAWN, + S_GREENKOOPA1, + S_GREENKOOPA2, + S_GREENKOOPA3, + S_GREENKOOPA4, + S_GREENKOOPADEATH1, + S_GREENKOOPADEATH2, S_SHELL, S_PUMA_START1, S_PUMA_START2, @@ -4066,6 +4081,21 @@ typedef enum state S_MARIOBUSH1, S_MARIOBUSH2, S_TOAD, + S_PTZSHROOM, + S_PTZFLAG1, + S_PTZFLAG2, + S_PTZFLAG3, + S_PTZFLAG4, + S_PTZFLAG5, + S_MARIOBUSH, + S_BSBSHROOM, + S_BLBSHROOM, + S_BNWSHROOM, + S_REDMFLOWER, + S_BLUEMFLOWER, + S_YELLOWMFLOWER, + S_WHITEDANDELION, + S_MAR64TREE, // Nights-specific stuff S_NIGHTSDRONE_MAN1, @@ -4368,6 +4398,11 @@ typedef enum state S_REDBRICKDEBRIS, // for CEZ3 S_BLUEBRICKDEBRIS, // for CEZ3 S_YELLOWBRICKDEBRIS, // for CEZ3 + S_MARIOBRICKDEBRIS, + S_MARIOBRICKDEBRISS, + S_MARIOBRICKDEBRISB, + S_MARIOBRICKDEBRISC, + S_MARIOBRICKDEBRISM, S_NAMECHECK, @@ -5064,6 +5099,7 @@ typedef enum mobj_type MT_FIREFLOWER, MT_FIREBALL, MT_FIREBALLTRAIL, + MT_GREENKOOPA, MT_SHELL, MT_PUMA, MT_PUMATRAIL, @@ -5074,6 +5110,17 @@ typedef enum mobj_type MT_MARIOBUSH1, MT_MARIOBUSH2, MT_TOAD, + MT_PTZSHROOM, + MT_PTZFLAG, + MT_BSBSHROOM, + MT_BLBSHROOM, + MT_BNWSHROOM, + MT_MARIOBUSH, + MT_REDMFLOWER, + MT_BLUEMFLOWER, + MT_YELLOWMFLOWER, + MT_WHITEDANDELION, + MT_MAR64TREE, // NiGHTS Stuff MT_AXIS, @@ -5171,6 +5218,11 @@ typedef enum mobj_type MT_REDBRICKDEBRIS, // for CEZ3 MT_BLUEBRICKDEBRIS, // for CEZ3 MT_YELLOWBRICKDEBRIS, // for CEZ3 + MT_MARIOBRICKDEBRIS, + MT_MARIOBRICKDEBRISS, + MT_MARIOBRICKDEBRISB, + MT_MARIOBRICKDEBRISC, + MT_MARIOBRICKDEBRISM, MT_NAMECHECK, MT_RAY, // General purpose mobj diff --git a/src/p_enemy.c b/src/p_enemy.c index 60cffebfc..9ebd32069 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -7837,13 +7837,14 @@ void A_BuzzFly(mobj_t *actor) // Function: A_GuardChase // -// Description: Modified A_Chase for Egg Guard +// Description: Modified A_Chase for Egg Guard and Koopa Troopas // -// var1 = unused +// var1 = shield (0) or no shield (1) // var2 = unused // void A_GuardChase(mobj_t *actor) { + INT32 locvar1 = var1; INT32 delta; if (LUA_CallAction(A_GUARDCHASE, actor)) @@ -7852,11 +7853,11 @@ void A_GuardChase(mobj_t *actor) if (actor->reactiontime) actor->reactiontime--; - if (actor->threshold != 42) // In formation... + if (actor->threshold != 42 || locvar1 == 1) // In formation... { fixed_t speed; - if (!actor->tracer || !actor->tracer->health) + if ((!actor->tracer || !actor->tracer->health) && locvar1 == 0) { P_SetTarget(&actor->tracer, NULL); actor->threshold = 42; @@ -7945,7 +7946,7 @@ void A_GuardChase(mobj_t *actor) // Now that we've moved, its time for our shield to move! // Otherwise it'll never act as a proper overlay. if (actor->tracer && actor->tracer->state - && actor->tracer->state->action.acp1) + && actor->tracer->state->action.acp1 && locvar1 == 0) { var1 = actor->tracer->state->var1, var2 = actor->tracer->state->var2; actor->tracer->state->action.acp1(actor->tracer); diff --git a/src/p_setup.c b/src/p_setup.c index 93286219d..87bd391c6 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -5866,6 +5866,10 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[0] = tag; lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); break; + case 465: // Bounce Player (purely for backwards compatibility with new Pipe Towers) + lines[i].args[0] = (FixedHypot(lines[i].dx, lines[i].dy) / 8) >> FRACBITS; + lines[i].special = 430; + break; case 466: //Set level failure state lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB); break; diff --git a/src/p_spec.c b/src/p_spec.c index d375d3e2f..a9d1e8392 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2702,6 +2702,18 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) EV_DoCrush(line->args[0], line, crushBothOnce); break; + case 430: // Bounce Player + if (mo && mo->player) + { + P_SetObjectMomZ(mo, line->args[0]*FRACUNIT, false); + S_StartSound(NULL, sfx_s3k8a); + mo->player->pflags |= PF_JUMPED; + if (skins[mo->player->skin]->flags & SF_NOJUMPSPIN) + P_SetMobjState(mo, S_PLAY_SPRING); + else + P_SetMobjState(mo, S_PLAY_JUMP); + } + break; case 432: // Enable/Disable 2D Mode if (mo && mo->player) { diff --git a/src/sounds.c b/src/sounds.c index 19b69dd28..75bccb396 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -284,6 +284,8 @@ sfxinfo_t S_sfx[NUMSFX] = {"mario8", false, 48, SF_X4AWAYSOUND, -1, NULL, 0, -1, -1, LUMPERROR, "Hurt"}, {"mario9", true, 120, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Emerging power-up"}, {"marioa", true, 192, 0, -1, NULL, 0, -1, -1, LUMPERROR, "One-up"}, + {"mariob", true, 127, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Spring"}, + {"marioc", true, 127, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Crumbling"}, {"thwomp", true, 127, SF_X4AWAYSOUND, -1, NULL, 0, -1, -1, LUMPERROR, "Thwomp"}, // Black Eggman diff --git a/src/sounds.h b/src/sounds.h index bf9342768..a01d192e6 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -332,6 +332,8 @@ typedef enum sfx_mario8, sfx_mario9, sfx_marioa, + sfx_mariob, + sfx_marioc, sfx_thwomp, // Black Eggman From 468cef704fcb38363d7cbaf68518d5f468169d14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Fri, 20 Dec 2024 17:36:38 +0100 Subject: [PATCH 271/353] Fix some components of ticcmd being blocked in IntermissionThinker --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index 175e757ec..ca02ac7e3 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1384,7 +1384,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (PLAYERINPUTDOWN(ssplayer, GC_SPIN) || (usejoystick && axis > 0)) cmd->buttons |= BT_SPIN; - if (gamestate != GS_LEVEL) // not in a level, don't build anything else + if (gamestate == GS_INTRO) // prevent crash in intro { cmd->angleturn = ticcmd_oldangleturn[forplayer]; cmd->aiming = G_ClipAimingPitch(myaiming); From 5093e9eb8eda42209d11c28c1f51f249da7a1280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Fri, 20 Dec 2024 18:04:49 +0100 Subject: [PATCH 272/353] Re-add gamestate check alongside addedtogame --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index ca02ac7e3..894063585 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1722,7 +1722,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) // At this point, cmd doesn't contain the final angle yet, // So we need to temporarily transform it so Lua scripters // don't need to handle it differently than in other hooks. - if (addedtogame) + if (addedtogame && gamestate == GS_LEVEL) { INT16 extra = ticcmd_oldangleturn[forplayer] - player->oldrelangleturn; INT16 origangle = cmd->angleturn; From b91854fa253758dbbb0cdd2a192534c553f7e613 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:52:28 -0600 Subject: [PATCH 273/353] Add Evertone to credits and adjust some objs --- src/f_finale.c | 1 + src/info.c | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 61c2ff561..1d6c1c009 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1160,6 +1160,7 @@ static const char *credits[] = { "Sally \"TehRealSalt\" Cochenour", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", + "\"Evertone\"", // summit showdown hehehehe "Ben \"Mystic\" Geyer", "Nathan \"Jazz\" Giroux", "\"GomaTheMascar\"", diff --git a/src/info.c b/src/info.c index 0008b4dae..4dfb5bc06 100644 --- a/src/info.c +++ b/src/info.c @@ -19589,7 +19589,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 16*FRACUNIT, // radius - 96*FRACUNIT, // height + 48*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage @@ -19616,7 +19616,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 16*FRACUNIT, // radius - 96*FRACUNIT, // height + 48*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage @@ -19643,7 +19643,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 16*FRACUNIT, // radius - 96*FRACUNIT, // height + 48*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage @@ -19670,7 +19670,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 16*FRACUNIT, // radius - 96*FRACUNIT, // height + 48*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage @@ -19702,7 +19702,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags + MF_SOLID|MF_SCENERY, // flags S_NULL // raisestate }, From bc0735c02724f28050665814734869efda994ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sat, 21 Dec 2024 12:33:00 +0100 Subject: [PATCH 274/353] Fix segfault due to leftover ztargetfocus when switching maps --- src/g_game.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index 175e757ec..6f02fde3c 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1867,6 +1867,10 @@ void G_DoLoadLevel(boolean resetplayer) if (gamestate == GS_INTERMISSION) Y_EndIntermission(); + // clear the target on map change, since the object will be invalidated + P_SetTarget(&ticcmd_ztargetfocus[0], NULL); + P_SetTarget(&ticcmd_ztargetfocus[1], NULL); + // cleanup if (titlemapinaction == TITLEMAP_LOADING) { From ae0886e279148ad10f941c25c68f764a0f11040f Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Sat, 21 Dec 2024 19:38:40 -0600 Subject: [PATCH 275/353] Trampolines! --- src/deh_tables.c | 73 ++++++++++ src/f_finale.c | 2 +- src/hardware/hw_light.c | 9 ++ src/info.c | 315 ++++++++++++++++++++++++++++++++++++++++ src/info.h | 82 +++++++++++ 5 files changed, 480 insertions(+), 1 deletion(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 48ce34931..44b3870d5 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -2913,6 +2913,69 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_BHORIZ7", "S_BHORIZ8", + // Yellow Trampoline + "S_YELLOWTRAMPOLINE", + "S_YELLOWTRAMPOLINE2", + "S_YELLOWTRAMPOLINE3", + "S_YELLOWTRAMPOLINE4", + "S_YELLOWTRAMPOLINE5", + + // Red Trampoline + "S_REDTRAMPOLINE", + "S_REDTRAMPOLINE2", + "S_REDTRAMPOLINE3", + "S_REDTRAMPOLINE4", + "S_REDTRAMPOLINE5", + + // Blue Trampoline + "S_BLUETRAMPOLINE", + "S_BLUETRAMPOLINE2", + "S_BLUETRAMPOLINE3", + "S_BLUETRAMPOLINE4", + "S_BLUETRAMPOLINE5", + + // Horizontal Yellow Trampoline + "S_HORIZYELLOWTRAMPOLINE", + "S_HORIZYELLOWTRAMPOLINE2", + "S_HORIZYELLOWTRAMPOLINE3", + "S_HORIZYELLOWTRAMPOLINE4", + "S_HORIZYELLOWTRAMPOLINE5", + + // Horizontal Red Trampoline + "S_HORIZREDTRAMPOLINE", + "S_HORIZREDTRAMPOLINE2", + "S_HORIZREDTRAMPOLINE3", + "S_HORIZREDTRAMPOLINE4", + "S_HORIZREDTRAMPOLINE5", + + // Horizontal Blue Trampoline + "S_HORIZBLUETRAMPOLINE", + "S_HORIZBLUETRAMPOLINE2", + "S_HORIZBLUETRAMPOLINE3", + "S_HORIZBLUETRAMPOLINE4", + "S_HORIZBLUETRAMPOLINE5", + + // Diagonal Yellow Trampoline + "S_DIAGYELLOWTRAMPOLINE", + "S_DIAGYELLOWTRAMPOLINE2", + "S_DIAGYELLOWTRAMPOLINE3", + "S_DIAGYELLOWTRAMPOLINE4", + "S_DIAGYELLOWTRAMPOLINE5", + + // Diagonal Red Trampoline + "S_DIAGREDTRAMPOLINE", + "S_DIAGREDTRAMPOLINE2", + "S_DIAGREDTRAMPOLINE3", + "S_DIAGREDTRAMPOLINE4", + "S_DIAGREDTRAMPOLINE5", + + // Diagonal Blue Trampoline + "S_DIAGBLUETRAMPOLINE", + "S_DIAGBLUETRAMPOLINE2", + "S_DIAGBLUETRAMPOLINE3", + "S_DIAGBLUETRAMPOLINE4", + "S_DIAGBLUETRAMPOLINE5", + // Booster "S_BOOSTERSOUND", "S_YELLOWBOOSTERROLLER", @@ -3744,6 +3807,16 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_REDHORIZ", "MT_BLUEHORIZ", + "MT_YELLOWTRAMPOLINE", + "MT_REDTRAMPOLINE", + "MT_BLUETRAMPOLINE", + "MT_HORIZYELLOWTRAMPOLINE", + "MT_HORIZREDTRAMPOLINE", + "MT_HORIZBLUETRAMPOLINE", + "MT_DIAGYELLOWTRAMPOLINE", + "MT_DIAGREDTRAMPOLINE", + "MT_DIAGBLUETRAMPOLINE", + "MT_BOOSTERSEG", "MT_BOOSTERROLLER", "MT_YELLOWBOOSTER", diff --git a/src/f_finale.c b/src/f_finale.c index 1d6c1c009..c6ca7877f 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1160,7 +1160,6 @@ static const char *credits[] = { "Sally \"TehRealSalt\" Cochenour", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", - "\"Evertone\"", // summit showdown hehehehe "Ben \"Mystic\" Geyer", "Nathan \"Jazz\" Giroux", "\"GomaTheMascar\"", @@ -1171,6 +1170,7 @@ static const char *credits[] = { "Mujamel \"MK\" Khan", "\"Kaito Sinclaire\"", "Alexander \"DrTapeworm\" Moench-Ford", + "\"orbitalviolet\"", // summit showdown hehehehe (aka Evertone) "\"Radicalicious\"", "\"Revan\"", "Anna \"QueenDelta\" Sandlin", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index e118fff51..2e6ad7db7 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -481,6 +481,15 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_SSWY &lspr[NOLIGHT], // SPR_SSWR &lspr[NOLIGHT], // SPR_SSWB + &lspr[NOLIGHT], // SPR_MPRY + &lspr[NOLIGHT], // SPR_MPRR + &lspr[NOLIGHT], // SPR_MPRB + &lspr[NOLIGHT], // SPR_MSWY + &lspr[NOLIGHT], // SPR_MSWR + &lspr[NOLIGHT], // SPR_MSWB + &lspr[NOLIGHT], // SPR_MDIY + &lspr[NOLIGHT], // SPR_MDIR + &lspr[NOLIGHT], // SPR_MDIB &lspr[NOLIGHT], // SPR_BSTY &lspr[NOLIGHT], // SPR_BSTR diff --git a/src/info.c b/src/info.c index 4dfb5bc06..7855b6157 100644 --- a/src/info.c +++ b/src/info.c @@ -392,6 +392,15 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "SSWY", // Yellow Side Spring "SSWR", // Red Side Spring "SSWB", // Blue Side Spring + "MPRY", // Yellow trampoline + "MPRR", // Red trampoline + "MPRB", // Blue trampoline + "MSWY", // Yellow horizontal trampoline + "MSWR", // Red horizontal trampoline + "MSWB", // Blue horizontal trampoline + "MDIY", // Yellow diagonal trampoline + "MDIR", // Red diagonal trampoline + "MDIB", // Blue diagonal trampoline "BSTY", // Yellow Booster "BSTR", // Red Booster @@ -3321,6 +3330,69 @@ state_t states[NUMSTATES] = {SPR_SSWB, 2, 1, {NULL}, 0, 0, S_BHORIZ8, 0}, // S_BHORIZ7 {SPR_SSWB, 1, 1, {NULL}, 0, 0, S_BHORIZ1, 0}, // S_BHORIZ8 + // Yellow trampoline + {SPR_MPRY, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_YELLOWTRAMPOLINE + {SPR_MPRY, 4, 4, {A_Pain}, 0, 0, S_YELLOWTRAMPOLINE3, 0}, // S_YELLOWTRAMPOLINE2 + {SPR_MPRY, 3, 1, {NULL}, 0, 0, S_YELLOWTRAMPOLINE4, 0}, // S_YELLOWTRAMPOLINE3 + {SPR_MPRY, 2, 1, {NULL}, 0, 0, S_YELLOWTRAMPOLINE5, 0}, // S_YELLOWTRAMPOLINE4 + {SPR_MPRY, 1, 1, {NULL}, 0, 0, S_YELLOWTRAMPOLINE, 0}, // S_YELLOWTRAMPOLINE5 + + // Red trampoline + {SPR_MPRR, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_REDTRAMPOLINE + {SPR_MPRR, 4, 4, {A_Pain}, 0, 0, S_REDTRAMPOLINE3, 0}, // S_REDTRAMPOLINE2 + {SPR_MPRR, 3, 1, {NULL}, 0, 0, S_REDTRAMPOLINE4, 0}, // S_REDTRAMPOLINE3 + {SPR_MPRR, 2, 1, {NULL}, 0, 0, S_REDTRAMPOLINE5, 0}, // S_REDTRAMPOLINE4 + {SPR_MPRR, 1, 1, {NULL}, 0, 0, S_REDTRAMPOLINE, 0}, // S_REDTRAMPOLINE5 + + // Blue trampoline + {SPR_MPRB, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BLUETRAMPOLINE + {SPR_MPRB, 4, 4, {A_Pain}, 0, 0, S_BLUETRAMPOLINE3, 0}, // S_BLUETRAMPOLINE2 + {SPR_MPRB, 3, 1, {NULL}, 0, 0, S_BLUETRAMPOLINE4, 0}, // S_BLUETRAMPOLINE3 + {SPR_MPRB, 2, 1, {NULL}, 0, 0, S_BLUETRAMPOLINE5, 0}, // S_BLUETRAMPOLINE4 + {SPR_MPRB, 1, 1, {NULL}, 0, 0, S_BLUETRAMPOLINE, 0}, // S_BLUETRAMPOLINE5 + + // Yellow horizontal trampoline + {SPR_MSWY, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_HORIZYELLOWTRAMPOLINE + {SPR_MSWY, 4, 4, {A_Pain}, 0, 0, S_HORIZYELLOWTRAMPOLINE3, 0}, // S_HORIZYELLOWTRAMPOLINE2 + {SPR_MSWY, 3, 1, {NULL}, 0, 0, S_HORIZYELLOWTRAMPOLINE4, 0}, // S_HORIZYELLOWTRAMPOLINE3 + {SPR_MSWY, 2, 1, {NULL}, 0, 0, S_HORIZYELLOWTRAMPOLINE5, 0}, // S_HORIZYELLOWTRAMPOLINE4 + {SPR_MSWY, 1, 1, {NULL}, 0, 0, S_HORIZYELLOWTRAMPOLINE, 0}, // S_HORIZYELLOWTRAMPOLINE5 + + // Red horizontal trampoline + {SPR_MSWR, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_HORIZREDTRAMPOLINE + {SPR_MSWR, 4, 4, {A_Pain}, 0, 0, S_HORIZREDTRAMPOLINE3, 0}, // S_HORIZREDTRAMPOLINE2 + {SPR_MSWR, 3, 1, {NULL}, 0, 0, S_HORIZREDTRAMPOLINE4, 0}, // S_HORIZREDTRAMPOLINE3 + {SPR_MSWR, 2, 1, {NULL}, 0, 0, S_HORIZREDTRAMPOLINE5, 0}, // S_HORIZREDTRAMPOLINE4 + {SPR_MSWR, 1, 1, {NULL}, 0, 0, S_HORIZREDTRAMPOLINE, 0}, // S_HORIZREDTRAMPOLINE5 + + // Blue horizontal trampoline + {SPR_MSWB, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_HORIZBLUETRAMPOLINE + {SPR_MSWB, 4, 4, {A_Pain}, 0, 0, S_HORIZBLUETRAMPOLINE3, 0}, // S_HORIZBLUETRAMPOLINE2 + {SPR_MSWB, 3, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE4, 0}, // S_HORIZBLUETRAMPOLINE3 + {SPR_MSWB, 2, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE5, 0}, // S_HORIZBLUETRAMPOLINE4 + {SPR_MSWB, 1, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE, 0}, // S_HORIZBLUETRAMPOLINE5 + + // Yellow diagonal trampoline + {SPR_MDIY, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_DIAGYELLOWTRAMPOLINE + {SPR_MDIY, 4, 4, {A_Pain}, 0, 0, S_DIAGYELLOWTRAMPOLINE3, 0}, // S_DIAGYELLOWTRAMPOLINE2 + {SPR_MDIY, 3, 1, {NULL}, 0, 0, S_DIAGYELLOWTRAMPOLINE4, 0}, // S_DIAGYELLOWTRAMPOLINE3 + {SPR_MDIY, 2, 1, {NULL}, 0, 0, S_DIAGYELLOWTRAMPOLINE5, 0}, // S_DIAGYELLOWTRAMPOLINE4 + {SPR_MDIY, 1, 1, {NULL}, 0, 0, S_DIAGYELLOWTRAMPOLINE, 0}, // S_DIAGYELLOWTRAMPOLINE5 + + // Red diagonal trampoline + {SPR_MDIR, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_DIAGREDTRAMPOLINE + {SPR_MDIR, 4, 4, {A_Pain}, 0, 0, S_DIAGREDTRAMPOLINE3, 0}, // S_DIAGREDTRAMPOLINE2 + {SPR_MDIR, 3, 1, {NULL}, 0, 0, S_DIAGREDTRAMPOLINE4, 0}, // S_DIAGREDTRAMPOLINE3 + {SPR_MDIR, 2, 1, {NULL}, 0, 0, S_DIAGREDTRAMPOLINE5, 0}, // S_DIAGREDTRAMPOLINE4 + {SPR_MDIR, 1, 1, {NULL}, 0, 0, S_DIAGREDTRAMPOLINE, 0}, // S_DIAGREDTRAMPOLINE5 + + // Blue diagonal trampoline + {SPR_MDIB, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_DIAGBLUETRAMPOLINE + {SPR_MDIB, 4, 4, {A_Pain}, 0, 0, S_DIAGBLUETRAMPOLINE3, 0}, // S_DIAGBLUETRAMPOLINE2 + {SPR_MDIB, 3, 1, {NULL}, 0, 0, S_DIAGBLUETRAMPOLINE4, 0}, // S_DIAGBLUETRAMPOLINE3 + {SPR_MDIB, 2, 1, {NULL}, 0, 0, S_DIAGBLUETRAMPOLINE5, 0}, // S_DIAGBLUETRAMPOLINE4 + {SPR_MDIB, 1, 1, {NULL}, 0, 0, S_DIAGBLUETRAMPOLINE, 0}, // S_DIAGBLUETRAMPOLINE5 + // Boosters {SPR_NULL, 0, 1, {A_Pain}, 0, 0, S_INVISIBLE, 0}, // S_BOOSTERSOUND {SPR_BSTY, FF_ANIMATE, -1, {NULL}, 2, 1, S_NULL, 0}, // S_YELLOWBOOSTERROLLER @@ -7847,6 +7919,249 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_BHORIZ2 // raisestate }, + { // MT_YELLOWTRAMPOLINE + 1814, // doomednum + S_YELLOWTRAMPOLINE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_mariob, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 20*FRACUNIT, // mass + 0, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING, // flags + S_YELLOWTRAMPOLINE2 // raisestate + }, + + { // MT_REDTRAMPOLINE + 1815, // doomednum + S_REDTRAMPOLINE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_mariob, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 32*FRACUNIT, // mass + 0, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING, // flags + S_REDTRAMPOLINE2 // raisestate + }, + + { // MT_BLUETRAMPOLINE + 1813, // doomednum + S_BLUETRAMPOLINE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_mariob, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 11*FRACUNIT, // mass + 0, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING, // flags + S_BLUETRAMPOLINE2 // raisestate + }, + + { // MT_HORIZYELLOWTRAMPOLINE + 1817, // doomednum + S_HORIZYELLOWTRAMPOLINE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_mariob, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 0, // mass + 36*FRACUNIT, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING, // flags + S_HORIZYELLOWTRAMPOLINE2 // raisestate + }, + + { // MT_HORIZREDTRAMPOLINE + 1818, // doomednum + S_HORIZREDTRAMPOLINE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_mariob, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 0, // mass + 72*FRACUNIT, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING, // flags + S_HORIZREDTRAMPOLINE2 // raisestate + }, + + { // MT_HORIZBLUETRAMPOLINE + 1816, // doomednum + S_HORIZBLUETRAMPOLINE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_mariob, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 0, // mass + 18*FRACUNIT, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING, // flags + S_HORIZBLUETRAMPOLINE2 // raisestate + }, + + { // MT_DIAGYELLOWTRAMPOLINE + 2551, // doomednum + S_DIAGYELLOWTRAMPOLINE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_mariob, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 20*FRACUNIT, // mass + 20*FRACUNIT, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING, // flags + S_DIAGYELLOWTRAMPOLINE2 // raisestate + }, + + { // MT_DIAGREDTRAMPOLINE + 2552, // doomednum + S_DIAGREDTRAMPOLINE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_mariob, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 32*FRACUNIT, // mass + 32*FRACUNIT, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING, // flags + S_DIAGREDTRAMPOLINE2 // raisestate + }, + + { // MT_DIAGBLUETRAMPOLINE + 2550, // doomednum + S_DIAGBLUETRAMPOLINE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_mariob, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 11*FRACUNIT, // mass + 11*FRACUNIT, // damage + sfx_None, // activesound + MF_SOLID|MF_SPRING, // flags + S_DIAGBLUETRAMPOLINE2 // raisestate + }, + { // MT_BOOSTERSEG -1, // doomednum S_INVISIBLE, // spawnstate diff --git a/src/info.h b/src/info.h index be75e0024..4552fb2ee 100644 --- a/src/info.h +++ b/src/info.h @@ -943,6 +943,15 @@ typedef enum sprite SPR_SSWY, // Yellow Side Spring SPR_SSWR, // Red Side Spring SPR_SSWB, // Blue Side Spring + SPR_MPRY, // Yellow trampoline + SPR_MPRR, // Red trampoline + SPR_MPRB, // Blue trampoline + SPR_MSWY, // Yellow horizontal trampoline + SPR_MSWR, // Red horizontal trampoline + SPR_MSWB, // Blue horizontal trampoline + SPR_MDIY, // Yellow diagonal trampoline + SPR_MDIR, // Red diagonal trampoline + SPR_MDIB, // Blue diagonal trampoline SPR_BSTY, // Yellow Booster SPR_BSTR, // Red Booster @@ -3748,6 +3757,69 @@ typedef enum state S_BHORIZ7, S_BHORIZ8, + // Yellow Trampoline + S_YELLOWTRAMPOLINE, + S_YELLOWTRAMPOLINE2, + S_YELLOWTRAMPOLINE3, + S_YELLOWTRAMPOLINE4, + S_YELLOWTRAMPOLINE5, + + // Red Trampoline + S_REDTRAMPOLINE, + S_REDTRAMPOLINE2, + S_REDTRAMPOLINE3, + S_REDTRAMPOLINE4, + S_REDTRAMPOLINE5, + + // Blue Trampoline + S_BLUETRAMPOLINE, + S_BLUETRAMPOLINE2, + S_BLUETRAMPOLINE3, + S_BLUETRAMPOLINE4, + S_BLUETRAMPOLINE5, + + // Horizontal Yellow Trampoline + S_HORIZYELLOWTRAMPOLINE, + S_HORIZYELLOWTRAMPOLINE2, + S_HORIZYELLOWTRAMPOLINE3, + S_HORIZYELLOWTRAMPOLINE4, + S_HORIZYELLOWTRAMPOLINE5, + + // Horizontal Red Trampoline + S_HORIZREDTRAMPOLINE, + S_HORIZREDTRAMPOLINE2, + S_HORIZREDTRAMPOLINE3, + S_HORIZREDTRAMPOLINE4, + S_HORIZREDTRAMPOLINE5, + + // Horizontal Blue Trampoline + S_HORIZBLUETRAMPOLINE, + S_HORIZBLUETRAMPOLINE2, + S_HORIZBLUETRAMPOLINE3, + S_HORIZBLUETRAMPOLINE4, + S_HORIZBLUETRAMPOLINE5, + + // Diagonal Yellow Trampoline + S_DIAGYELLOWTRAMPOLINE, + S_DIAGYELLOWTRAMPOLINE2, + S_DIAGYELLOWTRAMPOLINE3, + S_DIAGYELLOWTRAMPOLINE4, + S_DIAGYELLOWTRAMPOLINE5, + + // Diagonal Red Trampoline + S_DIAGREDTRAMPOLINE, + S_DIAGREDTRAMPOLINE2, + S_DIAGREDTRAMPOLINE3, + S_DIAGREDTRAMPOLINE4, + S_DIAGREDTRAMPOLINE5, + + // Diagonal Blue Trampoline + S_DIAGBLUETRAMPOLINE, + S_DIAGBLUETRAMPOLINE2, + S_DIAGBLUETRAMPOLINE3, + S_DIAGBLUETRAMPOLINE4, + S_DIAGBLUETRAMPOLINE5, + // Booster S_BOOSTERSOUND, S_YELLOWBOOSTERROLLER, @@ -4606,6 +4678,16 @@ typedef enum mobj_type MT_REDHORIZ, MT_BLUEHORIZ, + MT_YELLOWTRAMPOLINE, + MT_REDTRAMPOLINE, + MT_BLUETRAMPOLINE, + MT_HORIZYELLOWTRAMPOLINE, + MT_HORIZREDTRAMPOLINE, + MT_HORIZBLUETRAMPOLINE, + MT_DIAGYELLOWTRAMPOLINE, + MT_DIAGREDTRAMPOLINE, + MT_DIAGBLUETRAMPOLINE, + MT_BOOSTERSEG, MT_BOOSTERROLLER, MT_YELLOWBOOSTER, From 41a8bb2d24c64bdf1257baad9748220a160d3fc6 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Sat, 21 Dec 2024 22:23:35 -0600 Subject: [PATCH 276/353] Silver Shiver trees --- src/deh_tables.c | 8 +++ src/f_finale.c | 1 + src/hardware/hw_light.c | 2 + src/info.c | 114 ++++++++++++++++++++++++++++++++++++++++ src/info.h | 10 ++++ src/p_mobj.c | 28 ++++++++++ 6 files changed, 163 insertions(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index 44b3870d5..76febc4a6 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -2245,6 +2245,10 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_LAMPPOST2", // with snow "S_HANGSTAR", "S_MISTLETOE", + "S_SSZTREE", + "S_SSZTREE_BRANCH", + "S_SSZTREE2", + "S_SSZTREE2_BRANCH", // Xmas GFZ bushes "S_XMASBLUEBERRYBUSH", "S_XMASBERRYBUSH", @@ -4114,6 +4118,10 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_LAMPPOST2", // with snow "MT_HANGSTAR", "MT_MISTLETOE", + "MT_SSZTREE", + "MT_SSZTREE_BRANCH", + "MT_SSZTREE2", + "MT_SSZTREE2_BRANCH", // Xmas GFZ bushes "MT_XMASBLUEBERRYBUSH", "MT_XMASBERRYBUSH", diff --git a/src/f_finale.c b/src/f_finale.c index c6ca7877f..76dc3b0a4 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1128,6 +1128,7 @@ static const char *credits[] = { "David \"Instant Sonic\" Spencer Jr.", "\"SSNTails\"", "Daniel \"Inazuma\" Trinh", + "Samuel \"Spectorious\" Tuttle", "\"VelocitOni\"", "Jarrett \"JEV3\" Voight", "", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 2e6ad7db7..4b4d82fd2 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -395,6 +395,8 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_XMS4 &lspr[NOLIGHT], // SPR_XMS5 &lspr[NOLIGHT], // SPR_XMS6 + &lspr[NOLIGHT], // SPR_SNTT + &lspr[NOLIGHT], // SPR_SSTT &lspr[NOLIGHT], // SPR_FHZI &lspr[NOLIGHT], // SPR_ROSY diff --git a/src/info.c b/src/info.c index 7855b6157..33b4064af 100644 --- a/src/info.c +++ b/src/info.c @@ -306,6 +306,8 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "XMS4", // Lamppost "XMS5", // Hanging Star "XMS6", // Mistletoe + "SNTT", // Silver Shiver tree + "SSTT", // Silver Shiver tree with snow "FHZI", // FHZ ice "ROSY", @@ -2658,6 +2660,10 @@ state_t states[NUMSTATES] = {SPR_XMS4, 1, -1, {NULL}, 0, 0, S_NULL, 0}, // S_LAMPPOST2 {SPR_XMS5, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_HANGSTAR {SPR_XMS6, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_MISTLETOE + {SPR_SNTT, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SSZTREE + {SPR_SNTT, 1|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SSZTREE_BRANCH + {SPR_SSTT, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SSZTREE2 + {SPR_SSTT, 1|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SSZTREE2_BRANCH // Xmas GFZ bushes {SPR_BUS3, 1, -1, {NULL}, 0, 0, S_NULL, 0}, // S_XMASBLUEBERRYBUSH {SPR_BUS1, 1, -1, {NULL}, 0, 0, S_NULL, 0}, // S_XMASBERRYBUSH @@ -14885,6 +14891,114 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_SSZTREE + 1860, // doomednum + S_SSZTREE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 256*FRACUNIT, // height + 0, // display offset + 100, // mass + 1, // damage + sfx_None, // activesound + MF_SOLID|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_SSZTREE_BRANCH + -1, // doomednum + S_SSZTREE_BRANCH, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 256*FRACUNIT, // height + 0, // display offset + 100, // mass + 1, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_SSZTREE2 + 1861, // doomednum + S_SSZTREE2, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 256*FRACUNIT, // height + 0, // display offset + 100, // mass + 1, // damage + sfx_None, // activesound + MF_SOLID|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_SSZTREE2_BRANCH + -1, // doomednum + S_SSZTREE2_BRANCH, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 20*FRACUNIT, // radius + 256*FRACUNIT, // height + 0, // display offset + 100, // mass + 1, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags + S_NULL // raisestate + }, + { // MT_XMASBLUEBERRYBUSH 1859, // doomednum S_XMASBLUEBERRYBUSH, // spawnstate diff --git a/src/info.h b/src/info.h index 4552fb2ee..57edf289d 100644 --- a/src/info.h +++ b/src/info.h @@ -857,6 +857,8 @@ typedef enum sprite SPR_XMS4, // Lamppost SPR_XMS5, // Hanging Star SPR_XMS6, // Mistletoe + SPR_SNTT, // Silver Shiver tree + SPR_SSTT, // Silver Shiver tree with snow SPR_FHZI, // FHZ Ice SPR_ROSY, @@ -3089,6 +3091,10 @@ typedef enum state S_LAMPPOST2, // with snow S_HANGSTAR, S_MISTLETOE, + S_SSZTREE, + S_SSZTREE_BRANCH, + S_SSZTREE2, + S_SSZTREE2_BRANCH, // Xmas GFZ bushes S_XMASBLUEBERRYBUSH, S_XMASBERRYBUSH, @@ -4985,6 +4991,10 @@ typedef enum mobj_type MT_LAMPPOST2, // with snow MT_HANGSTAR, MT_MISTLETOE, + MT_SSZTREE, + MT_SSZTREE_BRANCH, + MT_SSZTREE2, + MT_SSZTREE2_BRANCH, // Xmas GFZ bushes MT_XMASBLUEBERRYBUSH, MT_XMASBERRYBUSH, diff --git a/src/p_mobj.c b/src/p_mobj.c index 0ce217e50..dc9648d63 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -13153,6 +13153,34 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean banner->angle = mobjangle + ANGLE_90; } break; + case MT_SSZTREE: + { // Spawn the branches + angle_t mobjangle = FixedAngle((mthing->angle % 113) << FRACBITS); + mobj_t *branch = P_SpawnMobjFromMobj(mobj, FRACUNIT, 0, 0, MT_SSZTREE_BRANCH); + if (!P_MobjWasRemoved(branch)) + branch->angle = mobjangle + ANGLE_22h; + branch = P_SpawnMobjFromMobj(mobj, 0, FRACUNIT, 0, MT_SSZTREE_BRANCH); + if (!P_MobjWasRemoved(branch)) + branch->angle = mobjangle + ANGLE_157h; + branch = P_SpawnMobjFromMobj(mobj, -FRACUNIT, 0, 0, MT_SSZTREE_BRANCH); + if (!P_MobjWasRemoved(branch)) + branch->angle = mobjangle + ANGLE_270; + } + break; + case MT_SSZTREE2: + { // Spawn the branches + angle_t mobjangle = FixedAngle((mthing->angle % 113) << FRACBITS); + mobj_t *branch = P_SpawnMobjFromMobj(mobj, FRACUNIT, 0, 0, MT_SSZTREE2_BRANCH); + if (!P_MobjWasRemoved(branch)) + branch->angle = mobjangle + ANGLE_22h; + branch = P_SpawnMobjFromMobj(mobj, 0, FRACUNIT, 0, MT_SSZTREE2_BRANCH); + if (!P_MobjWasRemoved(branch)) + branch->angle = mobjangle + ANGLE_157h; + branch = P_SpawnMobjFromMobj(mobj, -FRACUNIT, 0, 0, MT_SSZTREE2_BRANCH); + if (!P_MobjWasRemoved(branch)) + branch->angle = mobjangle + ANGLE_270; + } + break; case MT_HHZTREE_TOP: { // Spawn the branches angle_t mobjangle = FixedAngle(mthing->angle << FRACBITS) & (ANGLE_90 - 1); From fd6058826261d08b0c2e8467851295a61e326b3a Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Sun, 22 Dec 2024 02:29:48 -0600 Subject: [PATCH 277/353] Mario power up hardcoding --- src/deh_tables.c | 60 ++++++++ src/info.c | 359 ++++++++++++++++++++++++++++++++++++++++++++++- src/info.h | 72 ++++++++++ 3 files changed, 490 insertions(+), 1 deletion(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 76febc4a6..5d32595f4 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3329,6 +3329,53 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_WHITEDANDELION", "S_MAR64TREE", + // Power up mushrooms + "S_LIFESHROOM", + "S_LIFESHROOM2", + "S_LIFESHROOMD", + "S_LIFESHROOM_INVISIBLE", + "S_LIFESHROOM_INVISIBLE_TOUCH", + + "S_POISONSHROOM", + "S_POISONSHROOM2", + "S_POISONSHROOMD", + + "S_NUKESHROOM", + "S_NUKESHROOM2", + "S_NUKESHROOMD", + + "S_FORCESHROOM", + "S_FORCESHROOM2", + "S_FORCESHROOMD", + + "S_ATTRACTSHROOM", + "S_ATTRACTSHROOM2", + "S_ATTRACTSHROOMD", + + "S_ELEMENTALSHROOM", + "S_ELEMENTALSHROOM2", + "S_ELEMENTALSHROOMD", + + "S_CLOUDSHROOM", + "S_CLOUDSHROOM2", + "S_CLOUDSHROOMD", + + "S_STARMAN", + "S_STARMAN1", + "S_STARMAN2", + "S_STARMAN3", + "S_STARMAND", + + "S_SPEEDWINGS", + "S_SPEEDWINGSD", + + "S_PARTICLEPICKUP1", + "S_PARTICLEPICKUP2", + "S_1000SCOREAWARD", + "S_POWERUPAWARD", + "S_POWERUPAWARD1", + "S_POWERUPAWARD2", + // Nights-specific stuff "S_NIGHTSDRONE_MAN1", "S_NIGHTSDRONE_MAN2", @@ -4341,6 +4388,19 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_WHITEDANDELION", "MT_MAR64TREE", + // Power up mushrooms + "MT_LIFESHROOM", + "MT_LIFESHROOM_INVISIBLE", + "MT_POISONSHROOM", + "MT_NUKESHROOM", + "MT_FORCESHROOM", + "MT_ATTRACTSHROOM", + "MT_ELEMENTALSHROOM", + "MT_CLOUDSHROOM", + "MT_STARMAN", + "MT_SPEEDWINGS", + "MT_POWERUPAWARD", + // NiGHTS Stuff "MT_AXIS", "MT_AXISTRANSFER", diff --git a/src/info.c b/src/info.c index 33b4064af..d891ab270 100644 --- a/src/info.c +++ b/src/info.c @@ -483,6 +483,18 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "MFWD", "MUS3", + // Mario powerups + "MSIV", // invincibility + "MS1P", // 1-up + "MSAT", // attract + "MSFO", // force + "MSAR", // nuke + "MSWW", // whirlwind + "MSEL", // elemental + "MSSP", // speed shoes + "MEGH", // poison + "UPPB", // particle pickup + // NiGHTS Stuff "NDRN", // NiGHTS drone "NSPK", // NiGHTS sparkle @@ -3796,6 +3808,54 @@ state_t states[NUMSTATES] = {SPR_MFWD, FF_ANIMATE, -1, {NULL}, 3, 6, S_NULL, 0}, // S_WHITEDANDELION {SPR_MUS3, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_MAR64TREE + // Mario powerups + {SPR_MS1P, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_LIFESHROOM2, 0}, // S_LIFESHROOM + {SPR_MS1P, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_LIFESHROOM, 0}, // S_LIFESHROOM2 + {SPR_MS1P, 0, 1, {A_ExtraLife}, 0, 0, S_PARTICLEPICKUP1, 0}, // S_LIFESHROOMD + + {SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_LIFESHROOM_INVISIBLE + {SPR_NULL, 0, 1, {A_ExtraLife}, 0, 0, S_NULL, 0}, // S_LIFESHROOM_INVISIBLE_TOUCH + + {SPR_MEGH, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_POISONSHROOM2, 0}, // S_POISONSHROOM + {SPR_MEGH, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_POISONSHROOM, 0}, // S_POISONSHROOM2 + {SPR_MEGH, 0, 1, {A_EggmanBox}, 0, 0, S_PARTICLEPICKUP1, 0}, // S_POISONSHROOMD + + {SPR_MSAR, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_NUKESHROOM2, 0}, // S_NUKESHROOM + {SPR_MSAR, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_NUKESHROOM, 0}, // S_NUKESHROOM2 + {SPR_MSAR, 0, 1, {A_GiveShield}, SH_ARMAGEDDON, 0, S_1000SCOREAWARD, 0}, // S_NUKESHROOMD + + {SPR_MSFO, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_FORCESHROOM2, 0}, // S_FORCESHROOM + {SPR_MSFO, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_FORCESHROOM, 0}, // S_FORCESHROOM2 + {SPR_MSFO, 0, 1, {A_GiveShield}, SH_FORCE|1, 0, S_1000SCOREAWARD, 0}, // S_FORCESHROOMD + + {SPR_MSAT, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_ATTRACTSHROOM2, 0}, // S_ATTRACTSHROOM + {SPR_MSAT, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_ATTRACTSHROOM, 0}, // S_ATTRACTSHROOM2 + {SPR_MSAT, 0, 1, {A_GiveShield}, SH_ATTRACT, 0, S_1000SCOREAWARD, 0}, // S_ATTRACTSHROOMD + + {SPR_MSEL, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_ELEMENTALSHROOM2, 0}, // S_ELEMENTALSHROOM + {SPR_MSEL, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_ELEMENTALSHROOM, 0}, // S_ELEMENTALSHROOM2 + {SPR_MSEL, 0, 1, {A_GiveShield}, SH_ELEMENTAL, 0, S_1000SCOREAWARD, 0}, // S_ELEMENTALSHROOMD + + {SPR_MSWW, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_CLOUDSHROOM2, 0}, // S_CLOUDSHROOM + {SPR_MSWW, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_CLOUDSHROOM, 0}, // S_CLOUDSHROOM2 + {SPR_MSWW, 0, 1, {A_GiveShield}, SH_WHIRLWIND, 0, S_1000SCOREAWARD, 0}, // S_CLOUDSHROOMD + + {SPR_MSIV, 0, 1, {A_Look}, 3, 1, S_STARMAN, 0}, // S_STARMAN + {SPR_MSIV, 0, 2, {A_BunnyHop}, 7, 6, S_STARMAN2, 0}, // S_STARMAN1 + {SPR_MSIV, 0, 1, {A_SmokeTrailer}, MT_BOXSPARKLE, 0, S_STARMAN3, 0}, // S_STARMAN2 + {SPR_MSIV, 0, 1, {A_GhostMe}, 0, 0, S_STARMAN1, 0}, // S_STARMAN3 + {SPR_MSIV, 0, 1, {A_Invincibility}, 0, 0, S_PARTICLEPICKUP1, 0}, // S_STARMAND + + {SPR_MSSP, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SPEEDWINGS + {SPR_MSSP, 0, 1, {A_SuperSneakers}, 0, 0, S_NULL, 0}, // S_SPEEDWINGSD + + {SPR_UPPB, FF_ADD, 1, {A_ForceStop}, 0, 0, S_PARTICLEPICKUP2, 0}, // S_PARTICLEPICKUP1 + {SPR_UPPB, 1|FF_ANIMATE|FF_ADD, 19, {NULL}, 18, 1, S_NULL, 0}, // S_PARTICLEPICKUP2 + {SPR_NULL, 0, 1, {A_SpawnObjectRelative}, 0, MT_POWERUPAWARD, S_PARTICLEPICKUP1, 0}, // S_1000SCOREAWARD + {SPR_NULL, 0, 1, {NULL}, 0, 0, S_POWERUPAWARD1, 0}, // S_POWERUPAWARD + {SPR_NULL, 0, 1, {A_FindTarget}, MT_PLAYER, 0, S_POWERUPAWARD2, 0}, // S_POWERUPAWARD1 + {SPR_NULL, 0, 1, {A_AwardScore}, 0, 0, S_NULL, 0}, // S_POWERUPAWARD2 + // Nights Drone {SPR_NDRN, 0, -1, {NULL}, 0, 0, S_NIGHTSDRONE_MAN2, 0}, // S_NIGHTSDRONE_MAN1 {SPR_NDRN, 0, -1, {NULL}, 0, 0, S_NIGHTSDRONE_MAN1, 0}, // S_NIGHTSDRONE_MAN2 @@ -19565,7 +19625,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_mario1, // activesound - MF_SPECIAL|MF_SHOOTABLE|MF_BOUNCE, // flags + MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY, // flags S_NULL // raisestate }, @@ -20135,6 +20195,303 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_LIFESHROOM + 1826, // doomednum + S_LIFESHROOM, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_LIFESHROOMD, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL, // flags + S_NULL // raisestate + }, + + { // MT_LIFESHROOM_INVISIBLE + 1841, // doomednum + S_LIFESHROOM_INVISIBLE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_LIFESHROOM_INVISIBLE_TOUCH, // deathstate + S_NULL, // xdeathstate + sfx_mario3, // deathsound + -3072, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL|MF_NOGRAVITY, // flags + S_NULL // raisestate + }, + + { // MT_POISONSHROOM + 2303, // doomednum + S_POISONSHROOM, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_POISONSHROOMD,// deathstate + S_NULL, // xdeathstate + sfx_mario3, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL, // flags + S_NULL // raisestate + }, + + { // MT_NUKESHROOM + 1829, // doomednum + S_NUKESHROOM, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NUKESHROOMD, // deathstate + S_NULL, // xdeathstate + sfx_mario3, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL, // flags + S_NULL // raisestate + }, + + { // MT_FORCESHROOM + 1828, // doomednum + S_FORCESHROOM, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_FORCESHROOMD, // deathstate + S_NULL, // xdeathstate + sfx_mario3, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL, // flags + S_NULL // raisestate + }, + + { // MT_ATTRACTSHROOM + 1827, // doomednum + S_ATTRACTSHROOM,// spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_ATTRACTSHROOMD, // deathstate + S_NULL, // xdeathstate + sfx_mario3, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL, // flags + S_NULL // raisestate + }, + + { // MT_ELEMENTALSHROOM + 1831, // doomednum + S_ELEMENTALSHROOM, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_ELEMENTALSHROOMD, // deathstate + S_NULL, // xdeathstate + sfx_mario3, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL, // flags + S_NULL // raisestate + }, + + { // MT_CLOUDSHROOM + 1830, // doomednum + S_CLOUDSHROOM, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_CLOUDSHROOMD, // deathstate + S_NULL, // xdeathstate + sfx_mario3, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL, // flags + S_NULL // raisestate + }, + + { // MT_STARMAN + 1825, // doomednum + S_STARMAN, // spawnstate + 1000, // spawnhealth + S_STARMAN1, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_STARMAND, // deathstate + S_NULL, // xdeathstate + sfx_mario3, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL, // flags + S_NULL // raisestate + }, + + { // MT_SPEEDWINGS + 2304, // doomednum + S_SPEEDWINGS, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_SPEEDWINGSD, // deathstate + S_NULL, // xdeathstate + sfx_mario3, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL, // flags + S_NULL // raisestate + }, + + { // MT_POWERUPAWARD + -1, // doomednum + S_POWERUPAWARD, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_mario4, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 24*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SLIDEME|MF_NOGRAVITY, // flags + S_NULL // raisestate + }, + { // MT_AXIS 1700, // doomednum S_INVISIBLE, // spawnstate diff --git a/src/info.h b/src/info.h index 57edf289d..9404b9401 100644 --- a/src/info.h +++ b/src/info.h @@ -1034,6 +1034,18 @@ typedef enum sprite SPR_MFWD, SPR_MUS3, + // Mario powerups + SPR_MSIV, // invincibility + SPR_MS1P, // 1-up + SPR_MSAT, // attract + SPR_MSFO, // force + SPR_MSAR, // nuke + SPR_MSWW, // whirlwind + SPR_MSEL, // elemental + SPR_MSSP, // speed shoes + SPR_MEGH, // poison + SPR_UPPB, // particle pickup + // NiGHTS Stuff SPR_NDRN, // NiGHTS drone SPR_NSPK, // NiGHTS sparkle @@ -4175,6 +4187,53 @@ typedef enum state S_WHITEDANDELION, S_MAR64TREE, + // Power up mushrooms + S_LIFESHROOM, + S_LIFESHROOM2, + S_LIFESHROOMD, + S_LIFESHROOM_INVISIBLE, + S_LIFESHROOM_INVISIBLE_TOUCH, + + S_POISONSHROOM, + S_POISONSHROOM2, + S_POISONSHROOMD, + + S_NUKESHROOM, + S_NUKESHROOM2, + S_NUKESHROOMD, + + S_FORCESHROOM, + S_FORCESHROOM2, + S_FORCESHROOMD, + + S_ATTRACTSHROOM, + S_ATTRACTSHROOM2, + S_ATTRACTSHROOMD, + + S_ELEMENTALSHROOM, + S_ELEMENTALSHROOM2, + S_ELEMENTALSHROOMD, + + S_CLOUDSHROOM, + S_CLOUDSHROOM2, + S_CLOUDSHROOMD, + + S_STARMAN, + S_STARMAN1, + S_STARMAN2, + S_STARMAN3, + S_STARMAND, + + S_SPEEDWINGS, + S_SPEEDWINGSD, + + S_PARTICLEPICKUP1, + S_PARTICLEPICKUP2, + S_1000SCOREAWARD, + S_POWERUPAWARD, + S_POWERUPAWARD1, + S_POWERUPAWARD2, + // Nights-specific stuff S_NIGHTSDRONE_MAN1, S_NIGHTSDRONE_MAN2, @@ -5214,6 +5273,19 @@ typedef enum mobj_type MT_WHITEDANDELION, MT_MAR64TREE, + // Power up mushrooms + MT_LIFESHROOM, + MT_LIFESHROOM_INVISIBLE, + MT_POISONSHROOM, + MT_NUKESHROOM, + MT_FORCESHROOM, + MT_ATTRACTSHROOM, + MT_ELEMENTALSHROOM, + MT_CLOUDSHROOM, + MT_STARMAN, + MT_SPEEDWINGS, + MT_POWERUPAWARD, + // NiGHTS Stuff MT_AXIS, MT_AXISTRANSFER, From 90a23b8a8487a7f641521d2f0c3785ace0998b9b Mon Sep 17 00:00:00 2001 From: pastel Date: Sun, 22 Dec 2024 11:19:12 -0600 Subject: [PATCH 278/353] Increase ps_samplesize default value to 100 --- src/netcode/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index 630999cd0..8376f26b9 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -391,7 +391,7 @@ static CV_PossibleValue_t perfstats_cons_t[] = { consvar_t cv_perfstats = CVAR_INIT ("perfstats", "Off", CV_CALL, perfstats_cons_t, PS_PerfStats_OnChange); static CV_PossibleValue_t ps_samplesize_cons_t[] = { {1, "MIN"}, {1000, "MAX"}, {0, NULL}}; -consvar_t cv_ps_samplesize = CVAR_INIT ("ps_samplesize", "1", CV_CALL, ps_samplesize_cons_t, PS_SampleSize_OnChange); +consvar_t cv_ps_samplesize = CVAR_INIT ("ps_samplesize", "175", CV_CALL, ps_samplesize_cons_t, PS_SampleSize_OnChange); static CV_PossibleValue_t ps_descriptor_cons_t[] = { {1, "Average"}, {2, "SD"}, {3, "Minimum"}, {4, "Maximum"}, {0, NULL}}; consvar_t cv_ps_descriptor = CVAR_INIT ("ps_descriptor", "Average", 0, ps_descriptor_cons_t, NULL); From 2fcc7e6a5d3113b9b64673be1fa8cb9c2bab7aa7 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:55:13 -0600 Subject: [PATCH 279/353] Pristine Shores and Crystalline Heights --- src/deh_tables.c | 6 +++ src/hardware/hw_light.c | 2 + src/info.c | 87 +++++++++++++++++++++++++++++++++++++++++ src/info.h | 8 ++++ 4 files changed, 103 insertions(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index 5d32595f4..ed6648d83 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -2369,6 +2369,9 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_DBALL5", "S_DBALL6", "S_EGGSTATUE2", + "S_GINE", + "S_PPAL", + "S_PPEL", // Shield Orb "S_ARMA1", @@ -4248,6 +4251,9 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t // Misc scenery "MT_DBALL", "MT_EGGSTATUE2", + "MT_GINE", + "MT_PPAL", + "MT_PPEL", // Powerup Indicators "MT_ELEMENTAL_ORB", // Elemental shield mobj diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 4b4d82fd2..5503f3ed9 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -430,6 +430,8 @@ light_t *t_lspr[NUMSPRITES] = // Misc Scenery &lspr[NOLIGHT], // SPR_STLG &lspr[NOLIGHT], // SPR_DBAL + &lspr[NOLIGHT], // SPR_GINE + &lspr[NOLIGHT], // SPR_PPAL // Powerup Indicators &lspr[NOLIGHT], // SPR_ARMA diff --git a/src/info.c b/src/info.c index d891ab270..cf635c011 100644 --- a/src/info.c +++ b/src/info.c @@ -341,6 +341,8 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = // Misc Scenery "STLG", // Stalagmites "DBAL", // Disco + "GINE", // Crystalline Heights tree + "PPAL", // Pristine Shores palm trees // Powerup Indicators "ARMA", // Armageddon Shield Orb @@ -2799,6 +2801,10 @@ state_t states[NUMSTATES] = {SPR_ESTA, 1, -1, {NULL}, 0, 0, S_NULL, 0}, // S_EGGSTATUE2 + {SPR_GINE, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_GINE + {SPR_PPAL, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_PPAL + {SPR_PPAL, 1, -1, {NULL}, 0, 0, S_NULL, 0}, // S_PPEL + // Shield Orb {SPR_ARMA, FF_TRANS40 , 2, {NULL}, 0, 0, S_ARMA2 , 0}, // S_ARMA1 {SPR_ARMA, FF_TRANS40| 1, 2, {NULL}, 0, 0, S_ARMA3 , 0}, // S_ARMA2 @@ -16898,6 +16904,87 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_GINE + 3048, // doomednum + S_GINE, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 32*FRACUNIT, // radius + 628*FRACUNIT, // height + 0, // display offset + 100, // mass + 1, // damage + sfx_None, // activesound + MF_SOLID|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_PPAL + 3050, // doomednum + S_PPAL, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 626*FRACUNIT, // height + 0, // display offset + 100, // mass + 1, // damage + sfx_None, // activesound + MF_SOLID|MF_SCENERY, // flags + S_NULL // raisestate + }, + + { // MT_PPEL + 3051, // doomednum + S_PPEL, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 517*FRACUNIT, // height + 0, // display offset + 100, // mass + 1, // damage + sfx_None, // activesound + MF_SOLID|MF_SCENERY, // flags + S_NULL // raisestate + }, + { // MT_ELEMENTAL_ORB -1, // doomednum S_ELEM1, // spawnstate diff --git a/src/info.h b/src/info.h index 9404b9401..bf8306887 100644 --- a/src/info.h +++ b/src/info.h @@ -892,6 +892,8 @@ typedef enum sprite // Misc Scenery SPR_STLG, // Stalagmites SPR_DBAL, // Disco + SPR_GINE, // Crystalline Heights tree + SPR_PPAL, // Pristine Shores palm trees // Powerup Indicators SPR_ARMA, // Armageddon Shield Orb @@ -3227,6 +3229,9 @@ typedef enum state S_DBALL5, S_DBALL6, S_EGGSTATUE2, + S_GINE, + S_PPAL, + S_PPEL, // Shield Orb S_ARMA1, @@ -5133,6 +5138,9 @@ typedef enum mobj_type // Misc scenery MT_DBALL, MT_EGGSTATUE2, + MT_GINE, + MT_PPAL, + MT_PPEL, // Powerup Indicators MT_ELEMENTAL_ORB, // Elemental shield mobj From f27b2900d2b714ada30c7db9b67437b23e5a5351 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Mon, 23 Dec 2024 23:27:41 -0300 Subject: [PATCH 280/353] Fix plane offsets overflow in the software renderer --- src/r_plane.c | 57 ++++++++++++++++++++++++++++++-------------------- src/r_plane.h | 4 ++-- src/r_splats.c | 2 +- 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/r_plane.c b/src/r_plane.c index 7642a4dd6..a0de048ea 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -83,7 +83,7 @@ static fixed_t planeheight; fixed_t yslopetab[MAXVIDHEIGHT*16]; fixed_t *yslope; -static fixed_t xoffs, yoffs; +static INT64 xoffs, yoffs; static dvector3_t slope_origin, slope_u, slope_v; static dvector3_t slope_lightu, slope_lightv; @@ -376,19 +376,25 @@ visplane_t *R_FindPlane(sector_t *sector, fixed_t height, INT32 picnum, INT32 li visplane_t *check; unsigned hash; + float offset_xd = FixedToFloat(xoff) / FixedToFloat(xscale ? xscale : 1); + float offset_yd = FixedToFloat(yoff) / FixedToFloat(yscale ? yscale : 1); + + INT64 offset_x = offset_xd * FRACUNIT; + INT64 offset_y = offset_yd * FRACUNIT; + if (!slope) // Don't mess with this right now if a slope is involved { - xoff += FixedMul(viewx, xscale); - yoff -= FixedMul(viewy, yscale); + offset_x += viewx; + offset_y -= viewy; if (plangle != 0) { // Add the view offset, rotated by the plane angle. float ang = ANG2RAD(plangle); - float x = FixedToFloat(xoff); - float y = FixedToFloat(yoff); - xoff = FloatToFixed(x * cos(ang) + y * sin(ang)); - yoff = FloatToFixed(-x * sin(ang) + y * cos(ang)); + float x = offset_x / (float)FRACUNIT; + float y = offset_y / (float)FRACUNIT; + offset_x = (x * cos(ang) + y * sin(ang)) * FRACUNIT; + offset_y = (-x * sin(ang) + y * cos(ang)) * FRACUNIT; } } @@ -399,16 +405,19 @@ visplane_t *R_FindPlane(sector_t *sector, fixed_t height, INT32 picnum, INT32 li float ang = ANG2RAD(polyobj->angle); float x = FixedToFloat(polyobj->centerPt.x); float y = FixedToFloat(polyobj->centerPt.y); - xoff -= FloatToFixed(x * cos(ang) + y * sin(ang)); - yoff -= FloatToFixed(x * sin(ang) - y * cos(ang)); + offset_x -= (x * cos(ang) + y * sin(ang)) * FRACUNIT; + offset_y -= (x * sin(ang) - y * cos(ang)) * FRACUNIT; } else { - xoff -= polyobj->centerPt.x; - yoff += polyobj->centerPt.y; + offset_x -= polyobj->centerPt.x; + offset_y += polyobj->centerPt.y; } } + offset_x = ((INT64)offset_x * xscale) / FRACUNIT; + offset_y = ((INT64)offset_y * yscale) / FRACUNIT; + // This appears to fix the Nimbus Ruins sky bug. if (picnum == skyflatnum && pfloor) { @@ -423,7 +432,7 @@ visplane_t *R_FindPlane(sector_t *sector, fixed_t height, INT32 picnum, INT32 li { if (height == check->height && picnum == check->picnum && lightlevel == check->lightlevel - && xoff == check->xoffs && yoff == check->yoffs + && offset_x == check->xoffs && offset_y == check->yoffs && xscale == check->xscale && yscale == check->yscale && planecolormap == check->extra_colormap && check->viewx == viewx && check->viewy == viewy && check->viewz == viewz @@ -449,8 +458,8 @@ visplane_t *R_FindPlane(sector_t *sector, fixed_t height, INT32 picnum, INT32 li check->lightlevel = lightlevel; check->minx = vid.width; check->maxx = -1; - check->xoffs = xoff; - check->yoffs = yoff; + check->xoffs = offset_x; + check->yoffs = offset_y; check->xscale = xscale; check->yscale = yscale; check->extra_colormap = planecolormap; @@ -658,13 +667,13 @@ static void R_DrawSkyPlane(visplane_t *pl) } // Returns the height of the sloped plane at (x, y) as a double -static double R_GetSlopeZAt(const pslope_t *slope, fixed_t x, fixed_t y) +static double R_GetSlopeZAt(const pslope_t *slope, INT64 x, INT64 y) { // If you want to reimplement this using just the equation constants, use this instead: // (d + a*x + b*y) * -(1.0 / c) - double px = FixedToDouble(x) - slope->dorigin.x; - double py = FixedToDouble(y) - slope->dorigin.y; + double px = (x / (double)FRACUNIT) - slope->dorigin.x; + double py = (y / (double)FRACUNIT) - slope->dorigin.y; double dist = (px * slope->dnormdir.x) + (py * slope->dnormdir.y); @@ -672,10 +681,10 @@ static double R_GetSlopeZAt(const pslope_t *slope, fixed_t x, fixed_t y) } // Sets the texture origin vector of the sloped plane. -static void R_SetSlopePlaneOrigin(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, fixed_t xoff, fixed_t yoff, fixed_t angle) +static void R_SetSlopePlaneOrigin(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, INT64 xoff, INT64 yoff, fixed_t angle) { - INT64 vx = (INT64)xpos + (INT64)xoff; - INT64 vy = (INT64)ypos - (INT64)yoff; + INT64 vx = (INT64)xpos + xoff; + INT64 vy = (INT64)ypos - yoff; float vxf = vx / (float)FRACUNIT; float vyf = vy / (float)FRACUNIT; @@ -702,7 +711,7 @@ void R_SetSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, slope->moved = false; } - R_SetSlopePlaneOrigin(slope, xpos, ypos, zpos, xoff, yoff, angle); + R_SetSlopePlaneOrigin(slope, xpos, ypos, zpos, (INT64)xoff, (INT64)yoff, angle); height = R_GetSlopeZAt(slope, xpos, ypos); zeroheight = height - FixedToDouble(zpos); @@ -735,7 +744,7 @@ void R_SetSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, } // This function calculates all of the vectors necessary for drawing a sloped and scaled plane. -void R_SetScaledSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, fixed_t xs, fixed_t ys, fixed_t xoff, fixed_t yoff, angle_t angle, angle_t plangle) +void R_SetScaledSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, fixed_t xs, fixed_t ys, INT64 xoff, INT64 yoff, angle_t angle, angle_t plangle) { double height, z_at_xy; float ang; @@ -836,9 +845,11 @@ static void CalcSlopePlaneVectors(visplane_t *pl, fixed_t xoff, fixed_t yoff) { if (!ds_fog && (pl->xscale != FRACUNIT || pl->yscale != FRACUNIT)) { + float offset_x = FixedToFloat(xoff) / FixedToFloat(pl->xscale ? pl->xscale : 1); + float offset_y = FixedToFloat(yoff) / FixedToFloat(pl->yscale ? pl->yscale : 1); R_SetScaledSlopePlane(pl->slope, pl->viewx, pl->viewy, pl->viewz, FixedDiv(FRACUNIT, pl->xscale), FixedDiv(FRACUNIT, pl->yscale), - FixedDiv(xoff, pl->xscale), FixedDiv(yoff, pl->yscale), pl->viewangle, pl->plangle); + (INT64)(offset_x * FRACUNIT), (INT64)(offset_y * FRACUNIT), pl->viewangle, pl->plangle); } else R_SetSlopePlane(pl->slope, pl->viewx, pl->viewy, pl->viewz, xoff, yoff, pl->viewangle, pl->plangle); diff --git a/src/r_plane.h b/src/r_plane.h index 69620f25e..cd9477501 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -48,7 +48,7 @@ typedef struct visplane_s UINT16 padbottomstart, bottom[MAXVIDWIDTH], padbottomend; INT32 high, low; // R_PlaneBounds should set these. - fixed_t xoffs, yoffs; // Scrolling flats. + INT64 xoffs, yoffs; // Scrolling flats. fixed_t xscale, yscale; sector_t *sector; @@ -85,7 +85,7 @@ void R_DrawSinglePlane(visplane_t *pl); // Calculates the slope vectors needed for tilted span drawing. void R_SetSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, fixed_t xoff, fixed_t yoff, angle_t angle, angle_t plangle); -void R_SetScaledSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, fixed_t xs, fixed_t ys, fixed_t xoff, fixed_t yoff, angle_t angle, angle_t plangle); +void R_SetScaledSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos, fixed_t xs, fixed_t ys, INT64 xoff, INT64 yoff, angle_t angle, angle_t plangle); typedef struct planemgr_s { diff --git a/src/r_splats.c b/src/r_splats.c index 813c4b243..ce35a35b4 100644 --- a/src/r_splats.c +++ b/src/r_splats.c @@ -381,7 +381,7 @@ static void R_RasterizeFloorSplat(floorsplat_t *pSplat, vector2_t *verts, visspr if (pSplat->slope) { - R_SetScaledSlopePlane(pSplat->slope, vis->viewpoint.x, vis->viewpoint.y, vis->viewpoint.z, pSplat->xscale, pSplat->yscale, -pSplat->verts[0].x, pSplat->verts[0].y, vis->viewpoint.angle, pSplat->angle); + R_SetScaledSlopePlane(pSplat->slope, vis->viewpoint.x, vis->viewpoint.y, vis->viewpoint.z, (INT64)pSplat->xscale, (INT64)pSplat->yscale, -pSplat->verts[0].x, pSplat->verts[0].y, vis->viewpoint.angle, pSplat->angle); } else if (!ds_solidcolor) { From 171720ba351a0232d0d3c635803c2c2b21257759 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Wed, 25 Dec 2024 19:47:52 -0600 Subject: [PATCH 281/353] add jump to credits (almost forgor) --- src/f_finale.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/f_finale.c b/src/f_finale.c index 76dc3b0a4..0dd1a8f86 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1104,6 +1104,7 @@ static const char *credits[] = { "\"ChrispyPixels\"", "Paul \"Boinciel\" Clempson", "Sally \"TehRealSalt\" Cochenour", + "\"DaJumpJump\"", // New Ringslinger graphics (2.2.14) "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", "\"DirkTheHusky\"", From be7c2d9dd31feb33558c72799ef77faf2fcafb76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 29 Dec 2024 12:57:42 +0100 Subject: [PATCH 282/353] Reset target focus in P_LoadLevel instead --- src/g_game.c | 4 ---- src/p_setup.c | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 6f02fde3c..175e757ec 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1867,10 +1867,6 @@ void G_DoLoadLevel(boolean resetplayer) if (gamestate == GS_INTERMISSION) Y_EndIntermission(); - // clear the target on map change, since the object will be invalidated - P_SetTarget(&ticcmd_ztargetfocus[0], NULL); - P_SetTarget(&ticcmd_ztargetfocus[1], NULL); - // cleanup if (titlemapinaction == TITLEMAP_LOADING) { diff --git a/src/p_setup.c b/src/p_setup.c index 93286219d..a62e287ac 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7853,6 +7853,10 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) maptol = mapheaderinfo[gamemap-1]->typeoflevel; gametyperules = gametypedefaultrules[gametype]; + // clear the target on map change, since the object will be invalidated + P_SetTarget(&ticcmd_ztargetfocus[0], NULL); + P_SetTarget(&ticcmd_ztargetfocus[1], NULL); + CON_Drawer(); // let the user know what we are going to do I_FinishUpdate(); // page flip or blit buffer From 4fdb2f6b0888c165ae70a46f8e2d5cb59a090a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 29 Dec 2024 13:42:36 +0100 Subject: [PATCH 283/353] Fix segfault when switching perfstats screen before sampling is done --- src/m_perfstats.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/m_perfstats.c b/src/m_perfstats.c index 0a52b0125..33a774acf 100644 --- a/src/m_perfstats.c +++ b/src/m_perfstats.c @@ -453,7 +453,7 @@ static int PS_DrawPerfRows(int x, int y, int color, perfstatrow_t *rows) return draw_y; } -static void PS_UpdateMetricHistory(ps_metric_t *metric, boolean time_metric, boolean frame_metric, boolean set_user) +static void PS_UpdateMetricHistory(ps_metric_t *metric, boolean time_metric, boolean frame_metric) { int index = frame_metric ? ps_frame_index : ps_tick_index; @@ -461,7 +461,7 @@ static void PS_UpdateMetricHistory(ps_metric_t *metric, boolean time_metric, boo { // allocate history table int value_size = time_metric ? sizeof(precise_t) : sizeof(INT32); - void** memory_user = set_user ? &metric->history : NULL; + void** memory_user = &metric->history; metric->history = Z_Calloc(value_size * cv_ps_samplesize.value, PU_PERFSTATS, memory_user); @@ -491,7 +491,7 @@ static void PS_UpdateRowHistories(perfstatrow_t *rows, boolean frame_metric) for (row = rows; row->lores_label; row++) { if (PS_IsRowValid(row)) - PS_UpdateMetricHistory(row->metric, !!(row->flags & PS_TIME), frame_metric, true); + PS_UpdateMetricHistory(row->metric, !!(row->flags & PS_TIME), frame_metric); } } @@ -649,17 +649,17 @@ void PS_UpdateTickStats(void) if (cv_perfstats.value == 3) { for (i = 0; i < thinkframe_hooks_length; i++) - PS_UpdateMetricHistory(&thinkframe_hooks[i].time_taken, true, false, false); + PS_UpdateMetricHistory(&thinkframe_hooks[i].time_taken, true, false); } else if (cv_perfstats.value == 4) { for (i = 0; i < prethinkframe_hooks_length; i++) - PS_UpdateMetricHistory(&prethinkframe_hooks[i].time_taken, true, false, false); + PS_UpdateMetricHistory(&prethinkframe_hooks[i].time_taken, true, false); } else if (cv_perfstats.value == 5) { for (i = 0; i < postthinkframe_hooks_length; i++) - PS_UpdateMetricHistory(&postthinkframe_hooks[i].time_taken, true, false, false); + PS_UpdateMetricHistory(&postthinkframe_hooks[i].time_taken, true, false); } } if (cv_perfstats.value) From 91d1c11617c75f71eaad1c823902d9872caafd78 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Mon, 30 Dec 2024 00:03:41 +0100 Subject: [PATCH 284/353] Fix io.open() crashing the client sometimes --- src/netcode/d_netfil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/netcode/d_netfil.c b/src/netcode/d_netfil.c index adec1a0e4..362979b0c 100644 --- a/src/netcode/d_netfil.c +++ b/src/netcode/d_netfil.c @@ -606,7 +606,7 @@ void AddLuaFileTransfer(const char *filename, const char *mode) prevnext = &((*prevnext)->next); // Allocate file transfer information and append it to the transfer list - filetransfer = malloc(sizeof(luafiletransfer_t)); + filetransfer = calloc(1, sizeof(luafiletransfer_t)); if (!filetransfer) I_Error("AddLuaFileTransfer: Out of memory\n"); *prevnext = filetransfer; From 770ee7b53cc5c3d5c451c430e8a95667757f708a Mon Sep 17 00:00:00 2001 From: Hanicef Date: Fri, 16 Feb 2024 18:04:55 +0100 Subject: [PATCH 285/353] Put HTTP downloading on a background thread --- src/netcode/client_connection.c | 5 +- src/netcode/d_netfil.c | 139 +++++++++++++++++--------------- src/netcode/d_netfil.h | 1 + 3 files changed, 77 insertions(+), 68 deletions(-) diff --git a/src/netcode/client_connection.c b/src/netcode/client_connection.c index 917e32b59..c740d53a6 100644 --- a/src/netcode/client_connection.c +++ b/src/netcode/client_connection.c @@ -546,6 +546,7 @@ static void AbortConnection(void) { Snake_Free(&snake); + CURLAbortFile(); D_QuitNetGame(); CL_Reset(); D_StartTitle(); @@ -1062,10 +1063,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic } } - // Rusty TODO: multithread - if (filedownload.http_running) - CURLGetFile(); - if (waitmore) break; // exit the case diff --git a/src/netcode/d_netfil.c b/src/netcode/d_netfil.c index 362979b0c..ee1f7a9b2 100644 --- a/src/netcode/d_netfil.c +++ b/src/netcode/d_netfil.c @@ -1672,6 +1672,8 @@ boolean CURLPrepareFile(const char* url, int dfilenum) filedownload.current = dfilenum; filedownload.http_running = true; + I_spawn_thread("http-download", (I_thread_fn)CURLGetFile, NULL); + return true; } @@ -1680,95 +1682,103 @@ boolean CURLPrepareFile(const char* url, int dfilenum) return false; } +void CURLAbortFile(void) +{ + filedownload.http_running = false; +} + void CURLGetFile(void) { CURLMcode mc; /* return code used by curl_multi_wait() */ CURLcode easyres; /* Return from easy interface */ - int numfds; CURLMsg *m; /* for picking up messages with the transfer status */ CURL *e; int msgs_left; /* how many messages are left */ const char *easy_handle_error; + boolean running = true; - if (curl_runninghandles) + while (running && filedownload.http_running) { - curl_multi_perform(multi_handle, &curl_runninghandles); - - /* wait for activity, timeout or "nothing" */ - mc = curl_multi_wait(multi_handle, NULL, 0, 1000, &numfds); - - if (mc != CURLM_OK) + if (curl_runninghandles) { - CONS_Alert(CONS_WARNING, "curl_multi_wait() failed, code %d.\n", mc); - return; + curl_multi_perform(multi_handle, &curl_runninghandles); + + /* wait for activity, timeout or "nothing" */ + mc = curl_multi_wait(multi_handle, NULL, 0, 1000, NULL); + + if (mc != CURLM_OK) + { + CONS_Alert(CONS_WARNING, "curl_multi_wait() failed, code %d.\n", mc); + continue; + } + curl_curfile->currentsize = curl_dlnow; + curl_curfile->totalsize = curl_dltotal; } - curl_curfile->currentsize = curl_dlnow; - curl_curfile->totalsize = curl_dltotal; - } - /* See how the transfers went */ - while ((m = curl_multi_info_read(multi_handle, &msgs_left))) - { - if (m && (m->msg == CURLMSG_DONE)) + /* See how the transfers went */ + while ((m = curl_multi_info_read(multi_handle, &msgs_left))) { - e = m->easy_handle; - easyres = m->data.result; - - char *filename = Z_StrDup(curl_realname); - nameonly(filename); - - if (easyres != CURLE_OK) + if (m && (m->msg == CURLMSG_DONE)) { - long response_code = 0; + running = false; + e = m->easy_handle; + easyres = m->data.result; - if (easyres == CURLE_HTTP_RETURNED_ERROR) - curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, &response_code); + char *filename = Z_StrDup(curl_realname); + nameonly(filename); - if (response_code == 404) - curl_curfile->failed = FDOWNLOAD_FAIL_NOTFOUND; - else - curl_curfile->failed = FDOWNLOAD_FAIL_OTHER; - - easy_handle_error = (response_code) ? va("HTTP response code %ld", response_code) : curl_easy_strerror(easyres); - curl_curfile->status = FS_FALLBACK; - curl_curfile->currentsize = curl_origfilesize; - curl_curfile->totalsize = curl_origtotalfilesize; - filedownload.http_failed = true; - fclose(curl_curfile->file); - remove(curl_curfile->filename); - CONS_Alert(CONS_ERROR, M_GetText("Failed to download addon \"%s\" (%s)\n"), filename, easy_handle_error); - } - else - { - fclose(curl_curfile->file); - - CONS_Printf(M_GetText("Finished download of \"%s\"\n"), filename); - - if (checkfilemd5(curl_curfile->filename, curl_curfile->md5sum) == FS_MD5SUMBAD) + if (easyres != CURLE_OK) { - CONS_Alert(CONS_WARNING, M_GetText("File \"%s\" does not match the version used by the server\n"), filename); + long response_code = 0; + + if (easyres == CURLE_HTTP_RETURNED_ERROR) + curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, &response_code); + + if (response_code == 404) + curl_curfile->failed = FDOWNLOAD_FAIL_NOTFOUND; + else + curl_curfile->failed = FDOWNLOAD_FAIL_OTHER; + + easy_handle_error = (response_code) ? va("HTTP response code %ld", response_code) : curl_easy_strerror(easyres); curl_curfile->status = FS_FALLBACK; - curl_curfile->failed = FDOWNLOAD_FAIL_MD5SUMBAD; + curl_curfile->currentsize = curl_origfilesize; + curl_curfile->totalsize = curl_origtotalfilesize; filedownload.http_failed = true; + fclose(curl_curfile->file); + remove(curl_curfile->filename); + CONS_Alert(CONS_ERROR, M_GetText("Failed to download addon \"%s\" (%s)\n"), filename, easy_handle_error); } else { - filedownload.completednum++; - filedownload.completedsize += curl_curfile->totalsize; - curl_curfile->status = FS_FOUND; + fclose(curl_curfile->file); + + CONS_Printf(M_GetText("Finished download of \"%s\"\n"), filename); + + if (checkfilemd5(curl_curfile->filename, curl_curfile->md5sum) == FS_MD5SUMBAD) + { + CONS_Alert(CONS_WARNING, M_GetText("File \"%s\" does not match the version used by the server\n"), filename); + curl_curfile->status = FS_FALLBACK; + curl_curfile->failed = FDOWNLOAD_FAIL_MD5SUMBAD; + filedownload.http_failed = true; + } + else + { + filedownload.completednum++; + filedownload.completedsize += curl_curfile->totalsize; + curl_curfile->status = FS_FOUND; + } } + + Z_Free(filename); + + curl_curfile->file = NULL; + filedownload.remaining--; + curl_multi_remove_handle(multi_handle, e); + curl_easy_cleanup(e); + + if (!filedownload.remaining) + break; } - - Z_Free(filename); - - curl_curfile->file = NULL; - filedownload.http_running = false; - filedownload.remaining--; - curl_multi_remove_handle(multi_handle, e); - curl_easy_cleanup(e); - - if (!filedownload.remaining) - break; } } @@ -1777,6 +1787,7 @@ void CURLGetFile(void) curl_multi_cleanup(multi_handle); curl_global_cleanup(); } + filedownload.http_running = false; } HTTP_login * diff --git a/src/netcode/d_netfil.h b/src/netcode/d_netfil.h index 4039b5e2d..9f29d18bb 100644 --- a/src/netcode/d_netfil.h +++ b/src/netcode/d_netfil.h @@ -140,6 +140,7 @@ boolean CL_SendFileRequest(void); void PT_RequestFile(SINT8 node); boolean CURLPrepareFile(const char* url, int dfilenum); +void CURLAbortFile(void); void CURLGetFile(void); HTTP_login * CURLGetLogin (const char *url, HTTP_login ***return_prev_next); From c04dd70a433edb19055d7d1e8b50fcbb954a9465 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Fri, 16 Feb 2024 18:38:40 +0100 Subject: [PATCH 286/353] Avoid double initialization of CURL --- src/netcode/d_netfil.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/netcode/d_netfil.c b/src/netcode/d_netfil.c index ee1f7a9b2..da3a8727b 100644 --- a/src/netcode/d_netfil.c +++ b/src/netcode/d_netfil.c @@ -1609,11 +1609,13 @@ boolean CURLPrepareFile(const char* url, int dfilenum) I_Error("Attempted to download files in -nodownload mode"); #endif - curl_global_init(CURL_GLOBAL_ALL); + if (!multi_handle) + { + curl_global_init(CURL_GLOBAL_ALL); + multi_handle = curl_multi_init(); + } http_handle = curl_easy_init(); - multi_handle = curl_multi_init(); - if (http_handle && multi_handle) { I_mkdir(downloaddir, 0755); @@ -1782,10 +1784,11 @@ void CURLGetFile(void) } } - if (!filedownload.remaining) + if (!filedownload.remaining || !filedownload.http_running) { curl_multi_cleanup(multi_handle); curl_global_cleanup(); + multi_handle = NULL; } filedownload.http_running = false; } From 93d48ca97e59fc045b566f320d5c5bed5e0771fb Mon Sep 17 00:00:00 2001 From: Hanicef Date: Mon, 30 Dec 2024 17:12:56 +0100 Subject: [PATCH 287/353] Fix segfault when aborting HTTP download --- src/netcode/d_netfil.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/netcode/d_netfil.c b/src/netcode/d_netfil.c index da3a8727b..313905f43 100644 --- a/src/netcode/d_netfil.c +++ b/src/netcode/d_netfil.c @@ -95,6 +95,7 @@ static filetran_t transfer[MAXNETNODES]; INT32 fileneedednum; // Number of files needed to join the server fileneeded_t *fileneeded; // List of needed files static tic_t lasttimeackpacketsent = 0; +static I_mutex downloadmutex; char downloaddir[512] = "DOWNLOAD"; // For resuming failed downloads @@ -1687,10 +1688,15 @@ boolean CURLPrepareFile(const char* url, int dfilenum) void CURLAbortFile(void) { filedownload.http_running = false; + + // lock and unlock to wait for the download thread to exit + I_lock_mutex(&downloadmutex); + I_unlock_mutex(downloadmutex); } void CURLGetFile(void) { + I_lock_mutex(&downloadmutex); CURLMcode mc; /* return code used by curl_multi_wait() */ CURLcode easyres; /* Return from easy interface */ CURLMsg *m; /* for picking up messages with the transfer status */ @@ -1791,6 +1797,7 @@ void CURLGetFile(void) multi_handle = NULL; } filedownload.http_running = false; + I_unlock_mutex(downloadmutex); } HTTP_login * From 9eecedf3ae292f4cf4fcd2ab3330f9be0a22b251 Mon Sep 17 00:00:00 2001 From: pastel Date: Tue, 31 Dec 2024 14:05:51 -0600 Subject: [PATCH 288/353] Fix being unable to use CTRL keyboard shortcuts on menu input fields --- src/m_menu.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 88a69b5a5..15442cf17 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3399,6 +3399,13 @@ boolean M_Responder(event_t *ev) // Handle menuitems which need a specific key handling if (routine && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_KEYHANDLER) { + // block text input if ctrl is held, to allow using ctrl+c ctrl+v and ctrl+x + if (ctrldown) + { + routine(ch); + return true; + } + // ignore ev_keydown events if the key maps to a character, since // the ev_text event will follow immediately after in that case. if (ev->type == ev_keydown && ((ch >= 32 && ch <= 127) || (ch >= KEY_KEYPAD7 && ch <= KEY_KPADDEL))) @@ -12116,8 +12123,7 @@ static void M_HandleConnectIP(INT32 choice) if ( ctrldown ) { switch (choice) { - case 'v': - case 'V': // ctrl+v, pasting + case 'v': // ctrl+v, pasting { const char *paste = I_ClipboardPaste(); @@ -12130,8 +12136,7 @@ static void M_HandleConnectIP(INT32 choice) break; } case KEY_INS: - case 'c': - case 'C': // ctrl+c, ctrl+insert, copying + case 'c': // ctrl+c, ctrl+insert, copying if (l != 0) // Don't replace the clipboard without any text { I_ClipboardCopy(setupm_ip, l); @@ -12139,8 +12144,7 @@ static void M_HandleConnectIP(INT32 choice) } break; - case 'x': - case 'X': // ctrl+x, cutting + case 'x': // ctrl+x, cutting if (l != 0) // Don't replace the clipboard without any text { I_ClipboardCopy(setupm_ip, l); From 7168aa73bfeb041d534a6d2c420799d661e505ec Mon Sep 17 00:00:00 2001 From: pastel Date: Wed, 1 Jan 2025 13:14:13 -0600 Subject: [PATCH 289/353] Hide shield overlays and not just the shield while shieldscale zero --- src/p_mobj.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index dcebd334f..12b385468 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6656,12 +6656,12 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) if (scale < 1) { P_SetScale(thing, thing->target->scale, true); thing->old_scale = thing->target->old_scale; - + thing->flags2 |= (MF2_DONTDRAW|MF2_JUSTATTACKED); //Hide and indicate we're hidden } else { P_SetScale(thing, scale, true); thing->old_scale = FixedMul(thing->target->old_scale, thing->target->player->shieldscale); - + //Only unhide if we were hidden by the above code if (thing->flags2 & MF2_JUSTATTACKED) thing->flags2 &= ~(MF2_DONTDRAW|MF2_JUSTATTACKED); @@ -6790,6 +6790,12 @@ void P_RunOverlays(void) else zoffs = 0; + // hide the overlay as well if we're part of a hidden shield + if ((mo->target->flags2 & (MF2_JUSTATTACKED|MF2_DONTDRAW)) == (MF2_JUSTATTACKED|MF2_DONTDRAW)) + mo->flags2 |= (MF2_DONTDRAW|MF2_JUSTATTACKED); + else if (mo->flags2 & MF2_JUSTATTACKED) + mo->flags2 &= ~(MF2_DONTDRAW|MF2_JUSTATTACKED); + P_UnsetThingPosition(mo); mo->x = mo->target->x; mo->y = mo->target->y; From 8fd68b01b977d2bd31fda578673e668f01722436 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Thu, 2 Jan 2025 15:50:25 -0600 Subject: [PATCH 290/353] internal playtest 1 --- src/config.h.in | 8 ++++---- src/version.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index 5af558a46..280c01de5 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -40,11 +40,11 @@ * Last updated 2023 / 05 / 02 - v2.2.11 - patch.pk3 & zones.pk3 * Last updated 2023 / 09 / 06 - v2.2.12 - patch.pk3 * Last updated 2023 / 09 / 09 - v2.2.13 - none - * Last updated 2024 / 07 / 04 - v2.2.14 - main assets + * Last updated 2025 / 01 / 02 - v2.2.14 - main assets */ -#define ASSET_HASH_SRB2_PK3 "4ef6f57eefdf263288cae12084791cd2" -#define ASSET_HASH_ZONES_PK3 "b7db0245434ca3ad61935ee36403e966" -#define ASSET_HASH_CHARACTERS_PK3 "2e7aaae8a6b1b77d90ffe7606ceadb6c" +#define ASSET_HASH_SRB2_PK3 "ff169c784a7b38925aefeb7723f94c96" +#define ASSET_HASH_ZONES_PK3 "47a2e252d3c1dee1c1417ce08df1fcde" +#define ASSET_HASH_CHARACTERS_PK3 "97ce7008d16152731fe037141309aa24" #ifdef USE_PATCH_DTA #define ASSET_HASH_PATCH_PK3 "3c7b73f34af7e9a7bceb2d5260f76172" #endif diff --git a/src/version.h b/src/version.h index 2e8e52ddb..734d044cb 100644 --- a/src/version.h +++ b/src/version.h @@ -12,4 +12,4 @@ #define MODVERSION 55 // Define this as a prerelease version suffix (pre#, RC#) -#define BETAVERSION "pre1" +#define BETAVERSION "pre4" From f3f3fafdc4f19f7289801614ee779cabf2f92a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sat, 4 Jan 2025 18:27:11 +0100 Subject: [PATCH 291/353] Fix buffer overflow when reading string from R_TextureNameForNum into Lua --- src/lua_baselib.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 19775eb8a..18ae53405 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -3181,17 +3181,25 @@ static int lib_rTextureNumForName(lua_State *L) static int lib_rCheckTextureNameForNum(lua_State *L) { + char s[9]; INT32 num = (INT32)luaL_checkinteger(L, 1); //HUDSAFE - lua_pushstring(L, R_CheckTextureNameForNum(num)); + + M_Memcpy(s, R_CheckTextureNameForNum(num), 8); + s[8] = '\0'; + lua_pushstring(L, s); return 1; } static int lib_rTextureNameForNum(lua_State *L) { + char s[9]; INT32 num = (INT32)luaL_checkinteger(L, 1); //HUDSAFE - lua_pushstring(L, R_TextureNameForNum(num)); + + M_Memcpy(s, R_TextureNameForNum(num), 8); + s[8] = '\0'; + lua_pushstring(L, s); return 1; } From c00d139e556c7231aeb5ed61cd4c9999866f5a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sat, 4 Jan 2025 20:12:00 +0100 Subject: [PATCH 292/353] Further improve sleep accuracy on UNIX systems --- src/sdl/i_system.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 07088b957..4d62c4287 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2309,13 +2309,21 @@ void I_SleepDuration(precise_t duration) { #if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__) UINT64 precision = I_GetPrecisePrecision(); - struct timespec ts = { - .tv_sec = duration / precision, - .tv_nsec = duration * 1000000000 / precision % 1000000000, - }; - int status; - do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts); - while (status == EINTR); + precise_t dest = I_GetPreciseTime() + duration; + if (duration > 100000) + { + duration -= 100000; // 0.1 ms slack + struct timespec ts = { + .tv_sec = duration / precision, + .tv_nsec = duration * 1000000000 / precision % 1000000000, + }; + int status; + do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts); + while (status == EINTR); + } + + // busy-wait the rest + while (((INT64)dest - (INT64)I_GetPreciseTime()) > 0); #elif defined (MIN_SLEEP_DURATION_MS) UINT64 precision = I_GetPrecisePrecision(); INT32 sleepvalue = cv_sleep.value; From d20552c49d9fd6a2075ebd7d46b0b133c69f1dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 5 Jan 2025 15:58:18 +0100 Subject: [PATCH 293/353] Adjust slack based on precision --- 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 4d62c4287..18a5cb46d 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2310,9 +2310,9 @@ void I_SleepDuration(precise_t duration) #if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__) UINT64 precision = I_GetPrecisePrecision(); precise_t dest = I_GetPreciseTime() + duration; - if (duration > 100000) + if (duration * 100000 / precision > 1) { - duration -= 100000; // 0.1 ms slack + duration -= (precision / 10000); // 0.1 ms slack struct timespec ts = { .tv_sec = duration / precision, .tv_nsec = duration * 1000000000 / precision % 1000000000, From 1da55066d43ed6a0cb666999c20316bef463024b Mon Sep 17 00:00:00 2001 From: Hanicef Date: Sun, 5 Jan 2025 19:18:57 +0100 Subject: [PATCH 294/353] Slight optimization --- src/sdl/i_system.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 18a5cb46d..f32d97e22 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2310,9 +2310,10 @@ void I_SleepDuration(precise_t duration) #if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__) UINT64 precision = I_GetPrecisePrecision(); precise_t dest = I_GetPreciseTime() + duration; - if (duration * 100000 / precision > 1) + precise_t slack = (precision / 10000); // 0.1 ms slack + if (duration > slack) { - duration -= (precision / 10000); // 0.1 ms slack + duration -= slack; struct timespec ts = { .tv_sec = duration / precision, .tv_nsec = duration * 1000000000 / precision % 1000000000, From fb80091ac322c8a41bf8b983499596b5eec356b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Mon, 6 Jan 2025 09:49:04 +0100 Subject: [PATCH 295/353] Double slack time for busy-wait --- src/dedicated/i_system.c | 23 ++++++++++++++++------- src/sdl/i_system.c | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index 23c0149ca..79cdd9bb6 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -376,13 +376,22 @@ void I_SleepDuration(precise_t duration) { #if defined(__linux__) || defined(__FreeBSD__) UINT64 precision = I_GetPrecisePrecision(); - struct timespec ts = { - .tv_sec = duration / precision, - .tv_nsec = duration * 1000000000 / precision % 1000000000, - }; - int status; - do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts); - while (status == EINTR); + precise_t dest = I_GetPreciseTime() + duration; + precise_t slack = (precision / 5000); // 0.2 ms slack + if (duration > slack) + { + duration -= slack; + struct timespec ts = { + .tv_sec = duration / precision, + .tv_nsec = duration * 1000000000 / precision % 1000000000, + }; + int status; + do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts); + while (status == EINTR); + } + + // busy-wait the rest + while (((INT64)dest - (INT64)I_GetPreciseTime()) > 0); #else UINT64 precision = I_GetPrecisePrecision(); INT32 sleepvalue = cv_sleep.value; diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index f32d97e22..f78f74d57 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2310,7 +2310,7 @@ void I_SleepDuration(precise_t duration) #if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__) UINT64 precision = I_GetPrecisePrecision(); precise_t dest = I_GetPreciseTime() + duration; - precise_t slack = (precision / 10000); // 0.1 ms slack + precise_t slack = (precision / 5000); // 0.2 ms slack if (duration > slack) { duration -= slack; From ddc1c63fc637030576f8d45d27fe8ba5f836baa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?chromaticpipe=20=E2=80=8E?= Date: Wed, 8 Jan 2025 22:31:20 +0000 Subject: [PATCH 296/353] register slope contrast cvar so it actually works --- src/hardware/hw_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index da8965454..e426bcddd 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5794,6 +5794,7 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_glskydome); CV_RegisterVar(&cv_glspritebillboarding); CV_RegisterVar(&cv_glfakecontrast); + CV_RegisterVar(&cv_glslopecontrast); CV_RegisterVar(&cv_glshearing); CV_RegisterVar(&cv_glshaders); From 3b1711c02820cf0c65faf5b81ff38ad608e411f7 Mon Sep 17 00:00:00 2001 From: "Spectrum (Jonathan Dove)" <763-spectrumuk2@users.noreply.git.do.srb2.org> Date: Fri, 10 Jan 2025 03:02:30 +0000 Subject: [PATCH 297/353] Extra resolutions --- src/sdl/i_video.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 36bfd380f..68e65a975 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -87,7 +87,7 @@ #endif // maximum number of windowed modes (see windowedModes[][]) -#define MAXWINMODES (18) +#define MAXWINMODES (21) /** \brief */ @@ -157,7 +157,9 @@ static INT32 windowedModes[MAXWINMODES][2] = {1920,1080}, // 1.66 {1680,1050}, // 1.60,5.25 {1600,1200}, // 1.33 + {1600,1000}, // 1.60,5.00 {1600, 900}, // 1.66 + {1536, 864}, // 1.66,4.80 {1366, 768}, // 1.66 {1440, 900}, // 1.60,4.50 {1280,1024}, // 1.33? @@ -166,6 +168,7 @@ static INT32 windowedModes[MAXWINMODES][2] = {1280, 720}, // 1.66 {1152, 864}, // 1.33,3.60 {1024, 768}, // 1.33,3.20 + { 960, 600}, // 1.60,3.00 { 800, 600}, // 1.33,2.50 { 640, 480}, // 1.33,2.00 { 640, 400}, // 1.60,2.00 From 819ecb0152262f346fc0f9f87df7b6e26f2e6b07 Mon Sep 17 00:00:00 2001 From: Hanicef Date: Fri, 10 Jan 2025 03:37:58 +0000 Subject: [PATCH 298/353] Fix issues with custom pause menu binds --- 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 15442cf17..afc45fcf0 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3318,7 +3318,7 @@ boolean M_Responder(event_t *ev) if (ch == -1) return false; - else if (ch == gamecontrol[GC_SYSTEMMENU][0] || ch == gamecontrol[GC_SYSTEMMENU][1]) // allow remappable ESC key + else if (ev->type != ev_text && (ch == gamecontrol[GC_SYSTEMMENU][0] || ch == gamecontrol[GC_SYSTEMMENU][1])) // allow remappable ESC key ch = KEY_ESCAPE; // F-Keys @@ -3436,7 +3436,7 @@ boolean M_Responder(event_t *ev) { // dirty hack: for customising controls, I want only buttons/keys, not moves if (ev->type == ev_mouse || ev->type == ev_mouse2 || ev->type == ev_joystick - || ev->type == ev_joystick2) + || ev->type == ev_joystick2 || ev->type == ev_text) return true; if (routine) { From 1bb51b0ed3e89211a41d57974fcd49ce8ab0e470 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Sat, 11 Jan 2025 13:12:08 +0000 Subject: [PATCH 299/353] Revert "Merge branch 'slopecontrast-fix' into 'next'" This reverts merge request !2585 --- src/hardware/hw_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index e426bcddd..da8965454 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5794,7 +5794,6 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_glskydome); CV_RegisterVar(&cv_glspritebillboarding); CV_RegisterVar(&cv_glfakecontrast); - CV_RegisterVar(&cv_glslopecontrast); CV_RegisterVar(&cv_glshearing); CV_RegisterVar(&cv_glshaders); From 3d6d53a9267673e99ad9edbe2643d5feeb0d933a Mon Sep 17 00:00:00 2001 From: Lugent <35547583+Lugent@users.noreply.github.com> Date: Sun, 12 Jan 2025 00:54:27 -0400 Subject: [PATCH 300/353] Oops, forgot the commit. --- 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 95a08a387..e67e89b8b 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -109,6 +109,7 @@ typedef union UINT16 *color[MAXPLAYERS]; // Winner's color # boolean spectator[MAXPLAYERS]; // Spectator list UINT8 *character[MAXPLAYERS]; // Winner's character # + INT32 ctfteam[MAXPLAYERS]; // Winner's ctfteam # INT32 num[MAXPLAYERS]; // Winner's player # char *name[MAXPLAYERS]; // Winner's name patch_t *result; // RESULT @@ -849,7 +850,7 @@ void Y_IntermissionDrawer(void) { UINT8 *colormap = R_GetTranslationColormap(*data.match.character[i], *data.match.color[i], GTC_CACHE); - if (*data.match.color[i] == SKINCOLOR_RED) //red + if (data.match.ctfteam[i] == 1) //red { if (redplayers++ > 9) continue; @@ -857,7 +858,7 @@ void Y_IntermissionDrawer(void) y = (redplayers * 16) + 32; V_DrawCenteredString(x+6, y, 0, va("%d", redplayers)); } - else if (*data.match.color[i] == SKINCOLOR_BLUE) //blue + else if (data.match.ctfteam[i] == 2) //blue { if (blueplayers++ > 9) continue; @@ -1687,6 +1688,7 @@ static void Y_CalculateTimeRaceWinners(void) if (players[i].realtime <= data.match.scores[data.match.numplayers] && completed[i] == false) { + data.match.ctfteam[data.match.numplayers] = players[i].ctfteam; data.match.scores[data.match.numplayers] = players[i].realtime; data.match.color[data.match.numplayers] = &players[i].skincolor; data.match.character[data.match.numplayers] = &players[i].skin; From 201d0fd0233e0fbeb00731f727c27933f54b4b27 Mon Sep 17 00:00:00 2001 From: Lugent <35547583+Lugent@users.noreply.github.com> Date: Sun, 12 Jan 2025 11:23:33 -0400 Subject: [PATCH 301/353] Make chat aware of team colors on normal chat plus custom team colors --- src/hu_stuff.c | 91 +++++++++++++++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 38 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 9333a61d2..319157d14 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -590,6 +590,45 @@ static void Command_CSay_f(void) UINT8 spam_tokens[MAXPLAYERS] = { 1 }; // fill the buffer with 1 so the motd can be sent. tic_t spam_tics[MAXPLAYERS]; +static char *GetChatColorFromSkinColor(INT32 skincolor) +{ + const char *textcolor = NULL; + UINT16 chatcolor = skincolors[skincolor].chatcolor; + if (!chatcolor || chatcolor%0x1000 || chatcolor>V_INVERTMAP) + textcolor = "\x80"; + else if (chatcolor == V_MAGENTAMAP) + textcolor = "\x81"; + else if (chatcolor == V_YELLOWMAP) + textcolor = "\x82"; + else if (chatcolor == V_GREENMAP) + textcolor = "\x83"; + else if (chatcolor == V_BLUEMAP) + textcolor = "\x84"; + else if (chatcolor == V_REDMAP) + textcolor = "\x85"; + else if (chatcolor == V_GRAYMAP) + textcolor = "\x86"; + else if (chatcolor == V_ORANGEMAP) + textcolor = "\x87"; + else if (chatcolor == V_SKYMAP) + textcolor = "\x88"; + else if (chatcolor == V_PURPLEMAP) + textcolor = "\x89"; + else if (chatcolor == V_AQUAMAP) + textcolor = "\x8a"; + else if (chatcolor == V_PERIDOTMAP) + textcolor = "\x8b"; + else if (chatcolor == V_AZUREMAP) + textcolor = "\x8c"; + else if (chatcolor == V_BROWNMAP) + textcolor = "\x8d"; + else if (chatcolor == V_ROSYMAP) + textcolor = "\x8e"; + else if (chatcolor == V_INVERTMAP) + textcolor = "\x8f"; + return textcolor; +} + /** Receives a message, processing an ::XD_SAY command. * \sa DoSayCommand * \author Graue @@ -709,51 +748,27 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum) { if (players[playernum].ctfteam == 1) // red { - cstart = "\x85"; - textcolor = "\x85"; + cstart = textcolor = GetChatColorFromSkinColor(skincolor_redteam); } else // blue { - cstart = "\x84"; - textcolor = "\x84"; + cstart = textcolor = GetChatColorFromSkinColor(skincolor_blueteam); } } else { - UINT16 chatcolor = skincolors[players[playernum].skincolor].chatcolor; - - if (!chatcolor || chatcolor%0x1000 || chatcolor>V_INVERTMAP) - cstart = "\x80"; - else if (chatcolor == V_MAGENTAMAP) - cstart = "\x81"; - else if (chatcolor == V_YELLOWMAP) - cstart = "\x82"; - else if (chatcolor == V_GREENMAP) - cstart = "\x83"; - else if (chatcolor == V_BLUEMAP) - cstart = "\x84"; - else if (chatcolor == V_REDMAP) - cstart = "\x85"; - else if (chatcolor == V_GRAYMAP) - cstart = "\x86"; - else if (chatcolor == V_ORANGEMAP) - cstart = "\x87"; - else if (chatcolor == V_SKYMAP) - cstart = "\x88"; - else if (chatcolor == V_PURPLEMAP) - cstart = "\x89"; - else if (chatcolor == V_AQUAMAP) - cstart = "\x8a"; - else if (chatcolor == V_PERIDOTMAP) - cstart = "\x8b"; - else if (chatcolor == V_AZUREMAP) - cstart = "\x8c"; - else if (chatcolor == V_BROWNMAP) - cstart = "\x8d"; - else if (chatcolor == V_ROSYMAP) - cstart = "\x8e"; - else if (chatcolor == V_INVERTMAP) - cstart = "\x8f"; + cstart = GetChatColorFromSkinColor(players[playernum].skincolor); + if (G_GametypeHasTeams()) + { + if (players[playernum].ctfteam == 1) // red + { + cstart = GetChatColorFromSkinColor(skincolor_redteam); + } + else // blue + { + cstart = GetChatColorFromSkinColor(skincolor_blueteam); + } + } } prefix = cstart; From db606d0111f627c8638b44c00e000a70cb1510cb Mon Sep 17 00:00:00 2001 From: Lugent <35547583+Lugent@users.noreply.github.com> Date: Sun, 12 Jan 2025 11:42:11 -0400 Subject: [PATCH 302/353] Fix bruh moment --- src/hu_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 319157d14..33d74f614 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -590,7 +590,7 @@ static void Command_CSay_f(void) UINT8 spam_tokens[MAXPLAYERS] = { 1 }; // fill the buffer with 1 so the motd can be sent. tic_t spam_tics[MAXPLAYERS]; -static char *GetChatColorFromSkinColor(INT32 skincolor) +static const char *GetChatColorFromSkinColor(INT32 skincolor) { const char *textcolor = NULL; UINT16 chatcolor = skincolors[skincolor].chatcolor; From e1cd2ecda7af0b7242cf36b09dd23d7dae2ac70b Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:30:41 -0600 Subject: [PATCH 303/353] Update p_mobj.c --- src/p_mobj.c | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 1b6515856..aa846a93c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -13159,30 +13159,28 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean break; case MT_SSZTREE: { // Spawn the branches - angle_t mobjangle = FixedAngle((mthing->angle % 113) << FRACBITS); - mobj_t *branch = P_SpawnMobjFromMobj(mobj, FRACUNIT, 0, 0, MT_SSZTREE_BRANCH); - if (!P_MobjWasRemoved(branch)) - branch->angle = mobjangle + ANGLE_22h; - branch = P_SpawnMobjFromMobj(mobj, 0, FRACUNIT, 0, MT_SSZTREE_BRANCH); - if (!P_MobjWasRemoved(branch)) - branch->angle = mobjangle + ANGLE_157h; - branch = P_SpawnMobjFromMobj(mobj, -FRACUNIT, 0, 0, MT_SSZTREE_BRANCH); - if (!P_MobjWasRemoved(branch)) - branch->angle = mobjangle + ANGLE_270; + INT32 i; + mobj_t *branch; + for (i = 0; i < 5; i++) + { + branch = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_SSZTREE_BRANCH); + if (P_MobjWasRemoved(branch)) + continue; + branch->angle = mobj->angle + FixedAngle(i*72*FRACUNIT); + } } break; case MT_SSZTREE2: { // Spawn the branches - angle_t mobjangle = FixedAngle((mthing->angle % 113) << FRACBITS); - mobj_t *branch = P_SpawnMobjFromMobj(mobj, FRACUNIT, 0, 0, MT_SSZTREE2_BRANCH); - if (!P_MobjWasRemoved(branch)) - branch->angle = mobjangle + ANGLE_22h; - branch = P_SpawnMobjFromMobj(mobj, 0, FRACUNIT, 0, MT_SSZTREE2_BRANCH); - if (!P_MobjWasRemoved(branch)) - branch->angle = mobjangle + ANGLE_157h; - branch = P_SpawnMobjFromMobj(mobj, -FRACUNIT, 0, 0, MT_SSZTREE2_BRANCH); - if (!P_MobjWasRemoved(branch)) - branch->angle = mobjangle + ANGLE_270; + INT32 i; + mobj_t *branch; + for (i = 0; i < 5; i++) + { + branch = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_SSZTREE2_BRANCH); + if (P_MobjWasRemoved(branch)) + continue; + branch->angle = mobj->angle + FixedAngle(i*72*FRACUNIT); + } } break; case MT_HHZTREE_TOP: From 8664705cdaefedc4ff3bbf133c06824f2579c86c Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Wed, 15 Jan 2025 20:30:40 -0600 Subject: [PATCH 304/353] 2.2.14 --- src/config.h.in | 6 +++--- src/version.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index 280c01de5..16e81326a 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -40,10 +40,10 @@ * Last updated 2023 / 05 / 02 - v2.2.11 - patch.pk3 & zones.pk3 * Last updated 2023 / 09 / 06 - v2.2.12 - patch.pk3 * Last updated 2023 / 09 / 09 - v2.2.13 - none - * Last updated 2025 / 01 / 02 - v2.2.14 - main assets + * Last updated 2025 / 01 / 15 - v2.2.14 - main assets */ -#define ASSET_HASH_SRB2_PK3 "ff169c784a7b38925aefeb7723f94c96" -#define ASSET_HASH_ZONES_PK3 "47a2e252d3c1dee1c1417ce08df1fcde" +#define ASSET_HASH_SRB2_PK3 "e89de8711156ee613e7d855dad83daad" +#define ASSET_HASH_ZONES_PK3 "681fb748b05c5c56936109d9acfbc639" #define ASSET_HASH_CHARACTERS_PK3 "97ce7008d16152731fe037141309aa24" #ifdef USE_PATCH_DTA #define ASSET_HASH_PATCH_PK3 "3c7b73f34af7e9a7bceb2d5260f76172" diff --git a/src/version.h b/src/version.h index 734d044cb..21204e016 100644 --- a/src/version.h +++ b/src/version.h @@ -12,4 +12,4 @@ #define MODVERSION 55 // Define this as a prerelease version suffix (pre#, RC#) -#define BETAVERSION "pre4" +//#define BETAVERSION "pre4" From 8fbbf802e642f6296be4590a0d001cca33c5493e Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Thu, 16 Jan 2025 14:12:27 -0300 Subject: [PATCH 305/353] Update copyrights to 2025 --- assets/README.txt | 2 +- assets/debian-template/copyright | 4 ++-- debian-template/copyright | 4 ++-- src/d_main.c | 4 ++-- src/dedicated/i_system.c | 2 +- src/lua_baselib.c | 2 +- src/m_menu.c | 2 +- src/sdl/i_system.c | 2 +- src/win32/Srb2win.rc | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/assets/README.txt b/assets/README.txt index 2c522966e..fe238dec0 100644 --- a/assets/README.txt +++ b/assets/README.txt @@ -39,7 +39,7 @@ https://facebook.com/SonicRoboBlast2 COPYRIGHT AND DISCLAIMER -Design and content in Sonic Robo Blast 2 is copyright 1998-2024 by Sonic Team Jr. +Design and content in Sonic Robo Blast 2 is copyright 1998-2025 by Sonic Team Jr. All original material in this game is copyrighted by their respective owners, and no copyright infringement is intended. Sonic Team Jr. is in no way affiliated with SEGA or Sonic Team, and we do not claim ownership of any of SEGA's intellectual property used in SRB2. diff --git a/assets/debian-template/copyright b/assets/debian-template/copyright index 649e796fb..71d2cf583 100644 --- a/assets/debian-template/copyright +++ b/assets/debian-template/copyright @@ -12,7 +12,7 @@ Upstream Author(s): Copyright: - Copyright (C) 1998-2024 by Sonic Team Junior + Copyright (C) 1998-2025 by Sonic Team Junior License: @@ -21,7 +21,7 @@ License: The Debian packaging is: Copyright (C) 2010 Callum Dickinson - Copyright (C) 2010-2024 by Sonic Team Junior + Copyright (C) 2010-2025 by Sonic Team Junior and is licensed under the GPL version 2, see "/usr/share/common-licenses/GPL-2". diff --git a/debian-template/copyright b/debian-template/copyright index 649e796fb..71d2cf583 100644 --- a/debian-template/copyright +++ b/debian-template/copyright @@ -12,7 +12,7 @@ Upstream Author(s): Copyright: - Copyright (C) 1998-2024 by Sonic Team Junior + Copyright (C) 1998-2025 by Sonic Team Junior License: @@ -21,7 +21,7 @@ License: The Debian packaging is: Copyright (C) 2010 Callum Dickinson - Copyright (C) 2010-2024 by Sonic Team Junior + Copyright (C) 2010-2025 by Sonic Team Junior and is licensed under the GPL version 2, see "/usr/share/common-licenses/GPL-2". diff --git a/src/d_main.c b/src/d_main.c index 444671e5a..485f21057 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2024 by Sonic Team Junior. +// Copyright (C) 1999-2025 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -1250,7 +1250,7 @@ void D_SRB2Main(void) // Print GPL notice for our console users (Linux) CONS_Printf( "\n\nSonic Robo Blast 2\n" - "Copyright (C) 1998-2024 by Sonic Team Junior\n\n" + "Copyright (C) 1998-2025 by Sonic Team Junior\n\n" "This program comes with ABSOLUTELY NO WARRANTY.\n\n" "This is free software, and you are welcome to redistribute it\n" "and/or modify it under the terms of the GNU General Public License\n" diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index fcbdf5462..ab872713a 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -3,7 +3,7 @@ // // Copyright (C) 1993-1996 by id Software, Inc. // Portions Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 2014-2024 by Sonic Team Junior. +// Copyright (C) 2014-2025 by Sonic Team Junior. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 18ae53405..ef9115e50 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2012-2016 by John "JTE" Muniz. -// Copyright (C) 2012-2024 by Sonic Team Junior. +// Copyright (C) 2012-2025 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/m_menu.c b/src/m_menu.c index 2ac6ac779..fc9763e3a 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3,7 +3,7 @@ // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 2011-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 1999-2024 by Sonic Team Junior. +// Copyright (C) 1999-2025 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 653af13ea..b2396e269 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -5,7 +5,7 @@ // // Copyright (C) 1993-1996 by id Software, Inc. // Portions Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 2014-2023 by Sonic Team Junior. +// Copyright (C) 2014-2025 by Sonic Team Junior. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/src/win32/Srb2win.rc b/src/win32/Srb2win.rc index bbe61cb17..6fba9f9a8 100644 --- a/src/win32/Srb2win.rc +++ b/src/win32/Srb2win.rc @@ -98,7 +98,7 @@ BEGIN VALUE "FileDescription", "Sonic Robo Blast 2\0" VALUE "FileVersion", VERSIONSTRING_RC VALUE "InternalName", "srb2\0" - VALUE "LegalCopyright", "Copyright 1998-2024 by Sonic Team Junior\0" + VALUE "LegalCopyright", "Copyright 1998-2025 by Sonic Team Junior\0" VALUE "LegalTrademarks", "Sonic the Hedgehog and related characters are trademarks of Sega.\0" VALUE "OriginalFilename", "srb2win.exe\0" VALUE "PrivateBuild", "\0" From b58ad6492b161fe8fa25e9bd01c8c8a42ce5e253 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Thu, 16 Jan 2025 14:57:21 -0300 Subject: [PATCH 306/353] Revert "Remove OpenGL-only fake contrast cvars" This reverts commit 64aefe7322db8b5b181298c44c60527a112e6138. --- src/hardware/hw_main.c | 91 ++++++++++++++++++++++++++++++++++++++---- src/hardware/hw_main.h | 2 + 2 files changed, 86 insertions(+), 7 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index da290ec47..da8965454 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -226,17 +226,87 @@ UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap) // Let's see if return surfcolor.s.alpha; } -static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y) // TODO: improve "fake contrast" system +static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y) { INT16 finallight = lightnum; - const UINT8 contrast = 8; - if (v1y == v2y) - finallight -= contrast; - else if (v1x == v2x) - finallight += contrast; + if (cv_glfakecontrast.value != 0) + { + const UINT8 contrast = 8; + fixed_t extralight = 0; - return (FUINT)max(0, min(255, finallight)); + if (cv_glfakecontrast.value == 2) // Smooth setting + { + extralight = (-(contrast<> FRACBITS; + } + else + { + if (v1y == v2y) + extralight = -contrast; + else if (v1x == v2x) + extralight = contrast; + } + + if (extralight != 0) + { + finallight += extralight; + + if (finallight < 0) + finallight = 0; + if (finallight > 255) + finallight = 255; + } + } + + return (FUINT)finallight; +} + +static FUINT HWR_CalcSlopeLight(FUINT lightnum, angle_t dir, fixed_t delta) +{ + INT16 finallight = lightnum; + + if (cv_glfakecontrast.value != 0 && cv_glslopecontrast.value != 0) + { + const UINT8 contrast = 8; + fixed_t extralight = 0; + + if (cv_glfakecontrast.value == 2) // Smooth setting + { + fixed_t dirmul = abs(FixedDiv(AngleFixed(dir) - (180<> FRACBITS; + } + else + { + dir = ((dir + ANGLE_45) / ANGLE_90) * ANGLE_90; + + if (dir == ANGLE_180) + extralight = -contrast; + else if (dir == 0) + extralight = contrast; + + if (delta >= FRACUNIT/2) + extralight *= 2; + } + + if (extralight != 0) + { + finallight += extralight; + + if (finallight < 0) + finallight = 0; + if (finallight > 255) + finallight = 255; + } + } + + return (FUINT)finallight; } static UINT8 HWR_SideLightLevel(side_t *side, INT16 base_lightlevel) @@ -428,6 +498,9 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool for (i = 0, v3d = planeVerts; i < (INT32)nrPlaneVerts; i++,v3d++,pv++) SETUP3DVERT(v3d, pv->x, pv->y); + if (slope) + lightlevel = HWR_CalcSlopeLight(lightlevel, R_PointToAngle2(0, 0, slope->normal.x, slope->normal.y), abs(slope->zdelta)); + HWR_Lighting(&Surf, lightlevel, planecolormap); if (PolyFlags & (PF_Translucent|PF_Fog|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Environment)) @@ -5603,6 +5676,7 @@ void HWR_LoadLevel(void) static CV_PossibleValue_t glshaders_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Ignore custom shaders"}, {0, NULL}}; static CV_PossibleValue_t glmodelinterpolation_cons_t[] = {{0, "Off"}, {1, "Sometimes"}, {2, "Always"}, {0, NULL}}; +static CV_PossibleValue_t glfakecontrast_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Smooth"}, {0, NULL}}; static CV_PossibleValue_t glshearing_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Third-person"}, {0, NULL}}; static void CV_glfiltermode_OnChange(void); @@ -5636,6 +5710,8 @@ consvar_t cv_glmodellighting = CVAR_INIT ("gr_modellighting", "Off", CV_SAVE|CV_ consvar_t cv_glshearing = CVAR_INIT ("gr_shearing", "Off", CV_SAVE, glshearing_cons_t, NULL); consvar_t cv_glspritebillboarding = CVAR_INIT ("gr_spritebillboarding", "Off", CV_SAVE, CV_OnOff, NULL); consvar_t cv_glskydome = CVAR_INIT ("gr_skydome", "On", CV_SAVE, CV_OnOff, NULL); +consvar_t cv_glfakecontrast = CVAR_INIT ("gr_fakecontrast", "Smooth", CV_SAVE, glfakecontrast_cons_t, NULL); +consvar_t cv_glslopecontrast = CVAR_INIT ("gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NULL); consvar_t cv_glfiltermode = CVAR_INIT ("gr_filtermode", "Nearest", CV_SAVE|CV_CALL, glfiltermode_cons_t, CV_glfiltermode_OnChange); consvar_t cv_glanisotropicmode = CVAR_INIT ("gr_anisotropicmode", "1", CV_SAVE|CV_CALL, glanisotropicmode_cons_t, CV_glanisotropic_OnChange); @@ -5717,6 +5793,7 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_glskydome); CV_RegisterVar(&cv_glspritebillboarding); + CV_RegisterVar(&cv_glfakecontrast); CV_RegisterVar(&cv_glshearing); CV_RegisterVar(&cv_glshaders); diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 8faa1f692..2277c32f3 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -91,6 +91,8 @@ extern consvar_t cv_glsolvetjoin; extern consvar_t cv_glshearing; extern consvar_t cv_glspritebillboarding; extern consvar_t cv_glskydome; +extern consvar_t cv_glfakecontrast; +extern consvar_t cv_glslopecontrast; extern consvar_t cv_glbatching; extern consvar_t cv_glpaletterendering; extern consvar_t cv_glpalettedepth; From 92022bd5094b2e90c332772684325bb2f431803e Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Thu, 16 Jan 2025 15:03:36 -0300 Subject: [PATCH 307/353] Reapply "Merge branch 'slopecontrast-fix' into 'next'" This reverts commit 1bb51b0ed3e89211a41d57974fcd49ce8ab0e470. --- src/hardware/hw_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index da8965454..e426bcddd 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5794,6 +5794,7 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_glskydome); CV_RegisterVar(&cv_glspritebillboarding); CV_RegisterVar(&cv_glfakecontrast); + CV_RegisterVar(&cv_glslopecontrast); CV_RegisterVar(&cv_glshearing); CV_RegisterVar(&cv_glshaders); From 60bd1527decbf7265820b91453ad1bfa73b28c09 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Thu, 16 Jan 2025 18:26:54 -0600 Subject: [PATCH 308/353] Update m_menu.c --- src/m_menu.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index fc9763e3a..e15f14b66 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -14417,6 +14417,28 @@ static INT32 quitsounds[] = sfx_chchng // Tails 11-09-99 }; +const char *QuitScreenMessages[3] = { + "Design and content in\n" + "SRB2 is copyright\n" + "1998-2025 by STJr. All\n" + "original material in\n" + "this game is copyrighted\n" + "by their respective\n" + "owners, and no copyright\n" + "infringement is\n" + "intended. STJr's staff\n" + "make no profit\n" + "whatsoever (in\n" + "fact, we lose\n" + "money).\n" + , + + "THIS GAME SHOULD NOT BE SOLD!", + + "STJr is in no way affiliated\n" + "with SEGA or Sonic Team.\n" +}; + void M_QuitResponse(INT32 ch) { tic_t ptime; @@ -14438,6 +14460,9 @@ void M_QuitResponse(INT32 ch) while (ptime > I_GetTime()) { V_DrawScaledPatch(0, 0, 0, W_CachePatchName("GAMEQUIT", PU_PATCH)); // Demo 3 Quit Screen Tails 06-16-2001 + V_DrawCenteredString(2+(V_StringWidth(QuitScreenMessages[0], V_ALLOWLOWERCASE)/2), 4, V_ALLOWLOWERCASE, QuitScreenMessages[0]); + V_DrawCenteredString(160, 166, V_ALLOWLOWERCASE|V_REDMAP, QuitScreenMessages[1]); + V_DrawCenteredString(160, 176, V_ALLOWLOWERCASE, QuitScreenMessages[2]); I_FinishUpdate(); // Update the screen with the image Tails 06-19-2001 I_Sleep(cv_sleep.value); I_UpdateTime(cv_timescale.value); From 7b6bf976646e44f6fa4ed92700770b64dfcdcfbc Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Thu, 16 Jan 2025 19:09:33 -0600 Subject: [PATCH 309/353] 2.2.14 - final asset updates --- src/config.h.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index 16e81326a..a6dabcbaf 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -40,10 +40,10 @@ * Last updated 2023 / 05 / 02 - v2.2.11 - patch.pk3 & zones.pk3 * Last updated 2023 / 09 / 06 - v2.2.12 - patch.pk3 * Last updated 2023 / 09 / 09 - v2.2.13 - none - * Last updated 2025 / 01 / 15 - v2.2.14 - main assets + * Last updated 2025 / 01 / 16 - v2.2.14 - main assets */ -#define ASSET_HASH_SRB2_PK3 "e89de8711156ee613e7d855dad83daad" -#define ASSET_HASH_ZONES_PK3 "681fb748b05c5c56936109d9acfbc639" +#define ASSET_HASH_SRB2_PK3 "c1d9a4b3452b350d4662f41eb301dc6c" +#define ASSET_HASH_ZONES_PK3 "2ab758817fff96bc60ee9dec85e0b534" #define ASSET_HASH_CHARACTERS_PK3 "97ce7008d16152731fe037141309aa24" #ifdef USE_PATCH_DTA #define ASSET_HASH_PATCH_PK3 "3c7b73f34af7e9a7bceb2d5260f76172" From b22c89ed22fdb8e54f732878948951be3c5516b3 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Fri, 17 Jan 2025 20:32:00 -0600 Subject: [PATCH 310/353] Fix freeslots + add DeltaSanic to the credits --- src/deh_tables.c | 8 ++++++++ src/f_finale.c | 1 + 2 files changed, 9 insertions(+) diff --git a/src/deh_tables.c b/src/deh_tables.c index ed6648d83..8fa32558b 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3687,6 +3687,12 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_MARIOBRICKDEBRISM", "S_NAMECHECK", + + // LJ Knuckles + "S_OLDK_STND", + "S_OLDK_DIE0", + "S_OLDK_DIE1", + "S_OLDK_DIE2", }; // RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1", @@ -4511,6 +4517,8 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_NAMECHECK", "MT_RAY", + + "MT_OLDK", }; const char *const MOBJFLAG_LIST[] = { diff --git a/src/f_finale.c b/src/f_finale.c index 0dd1a8f86..06db0b44f 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1105,6 +1105,7 @@ static const char *credits[] = { "Paul \"Boinciel\" Clempson", "Sally \"TehRealSalt\" Cochenour", "\"DaJumpJump\"", // New Ringslinger graphics (2.2.14) + "\"DeltaSanic\"", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", "\"DirkTheHusky\"", From d1013fdd6625d163d82962da408d407b8782f799 Mon Sep 17 00:00:00 2001 From: Radicalicious <77638573+Radicalicious@users.noreply.github.com> Date: Fri, 17 Jan 2025 21:08:35 -0600 Subject: [PATCH 311/353] Update m_menu.c --- src/m_menu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index e15f14b66..af7fef39f 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -14433,7 +14433,8 @@ const char *QuitScreenMessages[3] = { "money).\n" , - "THIS GAME SHOULD NOT BE SOLD!", + "THIS GAME SHOULD NOT BE SOLD!" + , "STJr is in no way affiliated\n" "with SEGA or Sonic Team.\n" From 1e58ccb8aa9f4189fa4dfa812002a702e408eb23 Mon Sep 17 00:00:00 2001 From: pastel Date: Sat, 18 Jan 2025 05:04:16 +0000 Subject: [PATCH 312/353] Fix pipeline broken on clang --- src/m_menu.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index e15f14b66..d92f56ffa 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -14418,6 +14418,7 @@ static INT32 quitsounds[] = }; const char *QuitScreenMessages[3] = { + ( "Design and content in\n" "SRB2 is copyright\n" "1998-2025 by STJr. All\n" @@ -14430,13 +14431,17 @@ const char *QuitScreenMessages[3] = { "make no profit\n" "whatsoever (in\n" "fact, we lose\n" - "money).\n" - , + "money)." + ), - "THIS GAME SHOULD NOT BE SOLD!", + ( + "THIS GAME SHOULD NOT BE SOLD!" + ), + ( "STJr is in no way affiliated\n" - "with SEGA or Sonic Team.\n" + "with SEGA or Sonic Team." + ) }; void M_QuitResponse(INT32 ch) From d263182981569fe50075e5e60cf0ad93b22e1257 Mon Sep 17 00:00:00 2001 From: pastel Date: Sat, 18 Jan 2025 09:18:40 -0600 Subject: [PATCH 313/353] Revert "Revert invcolor tweaks for Red/Rosy/Lavender" This reverts commit 50fc1abf9a0d6721012a42aa6bf53127854aca1c. Conflicts: src/info.c --- src/info.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/info.c b/src/info.c index cf635c011..2ac815134 100644 --- a/src/info.c +++ b/src/info.c @@ -3395,7 +3395,7 @@ state_t states[NUMSTATES] = {SPR_MSWB, 3, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE4, 0}, // S_HORIZBLUETRAMPOLINE3 {SPR_MSWB, 2, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE5, 0}, // S_HORIZBLUETRAMPOLINE4 {SPR_MSWB, 1, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE, 0}, // S_HORIZBLUETRAMPOLINE5 - + // Yellow diagonal trampoline {SPR_MDIY, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_DIAGYELLOWTRAMPOLINE {SPR_MDIY, 4, 4, {A_Pain}, 0, 0, S_DIAGYELLOWTRAMPOLINE3, 0}, // S_DIAGYELLOWTRAMPOLINE2 @@ -23045,15 +23045,15 @@ skincolor_t skincolors[MAXSKINCOLORS] = { {"Moss", {0x58, 0x58, 0x59, 0x59, 0x5a, 0x5a, 0x5b, 0x5b, 0x5b, 0x5c, 0x5d, 0x5d, 0x5e, 0x5e, 0x5f, 0x5f}, SKINCOLOR_BEIGE, 13, V_GREENMAP, true}, // SKINCOLOR_MOSS {"Azure", {0x90, 0x90, 0x91, 0x91, 0xaa, 0xaa, 0xab, 0xab, 0xab, 0xac, 0xad, 0xad, 0xae, 0xae, 0xaf, 0xaf}, SKINCOLOR_PINK, 5, V_AZUREMAP, true}, // SKINCOLOR_AZURE {"Eggplant", { 4, 8, 11, 11, 16, 195, 195, 195, 196, 186, 187, 187, 254, 254, 30, 31}, SKINCOLOR_ROSEBUSH, 5, V_PURPLEMAP, true}, // SKINCOLOR_EGGPLANT - {"Lavender", {0xc0, 0xc0, 0xc1, 0xc1, 0xc2, 0xc2, 0xc3, 0xc3, 0xc3, 0xc4, 0xc5, 0xc5, 0xc6, 0xc6, 0xc7, 0xc7}, SKINCOLOR_GOLD, 4, V_PURPLEMAP, true}, // SKINCOLOR_LAVENDER + {"Lavender", {0xc0, 0xc0, 0xc1, 0xc1, 0xc2, 0xc2, 0xc3, 0xc3, 0xc3, 0xc4, 0xc5, 0xc5, 0xc6, 0xc6, 0xc7, 0xc7}, SKINCOLOR_HEADLIGHT, 8, V_PURPLEMAP, true}, // SKINCOLOR_LAVENDER // Viv's vivid colours (toast 21/07/17) // Tweaks & additions (Lach, Chrispy, sphere, Alice, MotorRoach & Saneko 26/10/22) {"Ruby", {0xb0, 0xb0, 0xc9, 0xca, 0xcc, 0x26, 0x27, 0x28, 0x29, 0x2a, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfd}, SKINCOLOR_EMERALD, 10, V_REDMAP, true}, // SKINCOLOR_RUBY {"Cherry", { 202, 203, 204, 205, 206, 40, 41, 42, 43, 44, 186, 187, 28, 29, 30, 31}, SKINCOLOR_MIDNIGHT, 10, V_REDMAP, true}, // SKINCOLOR_CHERRY {"Salmon", {0xd0, 0xd0, 0xd1, 0xd2, 0x20, 0x21, 0x24, 0x25, 0x26, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e}, SKINCOLOR_FOREST, 6, V_REDMAP, true}, // SKINCOLOR_SALMON - {"Pepper", { 210, 32, 33, 34, 35, 35, 36, 37, 38, 39, 41, 43, 45, 45, 46, 47}, SKINCOLOR_MASTER, 8, V_REDMAP, true}, // SKINCOLOR_PEPPER - {"Red", {0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x47, 0x2e, 0x2f}, SKINCOLOR_GREEN, 10, V_REDMAP, true}, // SKINCOLOR_RED + {"Pepper", { 210, 32, 33, 34, 35, 35, 36, 37, 38, 39, 41, 43, 45, 45, 46, 47}, SKINCOLOR_GREEN, 10, V_REDMAP, true}, // SKINCOLOR_PEPPER + {"Red", {0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x47, 0x2e, 0x2f}, SKINCOLOR_MASTER, 8, V_REDMAP, true}, // SKINCOLOR_RED {"Crimson", {0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2b, 0x2b, 0x2c, 0x2d, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x1f}, SKINCOLOR_ICY, 10, V_REDMAP, true}, // SKINCOLOR_CRIMSON {"Flame", {0x31, 0x32, 0x33, 0x36, 0x22, 0x22, 0x25, 0x25, 0x25, 0xcd, 0xcf, 0xcf, 0xc5, 0xc5, 0xc7, 0xc7}, SKINCOLOR_PURPLE, 8, V_REDMAP, true}, // SKINCOLOR_FLAME {"Garnet", { 0, 83, 50, 53, 34, 35, 37, 38, 39, 40, 42, 44, 45, 46, 47, 47}, SKINCOLOR_AQUAMARINE, 6, V_REDMAP, true}, // SKINCOLOR_GARNET @@ -23068,7 +23068,7 @@ skincolor_t skincolors[MAXSKINCOLORS] = { {"Rust", {0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3c, 0x3d, 0x3d, 0x3d, 0x3f, 0x2c, 0x2d, 0x47, 0x2e, 0x2f, 0x2f}, SKINCOLOR_YOGURT, 8, V_ORANGEMAP, true}, // SKINCOLOR_RUST {"Tangerine", { 81, 83, 64, 64, 51, 52, 53, 54, 56, 58, 60, 61, 63, 45, 46, 47}, SKINCOLOR_OCEAN, 12, V_ORANGEMAP, true}, // SKINCOLOR_TANGERINE {"Topaz", { 0, 81, 83, 73, 74, 74, 65, 52, 53, 54, 56, 58, 60, 42, 43, 45}, SKINCOLOR_MOONSTONE, 10, V_YELLOWMAP, true}, // SKINCOLOR_TOPAZ - {"Gold", {0x51, 0x51, 0x54, 0x54, 0x41, 0x42, 0x43, 0x43, 0x44, 0x45, 0x46, 0x3f, 0x2d, 0x2e, 0x2f, 0x2f}, SKINCOLOR_LAVENDER, 10, V_YELLOWMAP, true}, // SKINCOLOR_GOLD + {"Gold", {0x51, 0x51, 0x54, 0x54, 0x41, 0x42, 0x43, 0x43, 0x44, 0x45, 0x46, 0x3f, 0x2d, 0x2e, 0x2f, 0x2f}, SKINCOLOR_MAUVE, 8, V_YELLOWMAP, true}, // SKINCOLOR_GOLD {"Sandy", {0x53, 0x40, 0x41, 0x42, 0x43, 0xe6, 0xe9, 0xe9, 0xea, 0xec, 0xec, 0xc6, 0xc6, 0xc7, 0xc7, 0xfe}, SKINCOLOR_SKY, 8, V_YELLOWMAP, true}, // SKINCOLOR_SANDY {"Goldenrod", { 0, 80, 81, 81, 83, 73, 73, 64, 65, 66, 67, 68, 69, 62, 44, 45}, SKINCOLOR_MAJESTY, 8, V_YELLOWMAP, true}, // SKINCOLOR_GOLDENROD {"Yellow", {0x52, 0x53, 0x49, 0x49, 0x4a, 0x4a, 0x4b, 0x4b, 0x4b, 0x4c, 0x4d, 0x4d, 0x4e, 0x4e, 0x4f, 0xed}, SKINCOLOR_CORNFLOWER, 8, V_YELLOWMAP, true}, // SKINCOLOR_YELLOW @@ -23078,19 +23078,19 @@ skincolor_t skincolors[MAXSKINCOLORS] = { {"Lime", {0x50, 0x51, 0x52, 0x53, 0x48, 0xbc, 0xbd, 0xbe, 0xbe, 0xbf, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f}, SKINCOLOR_MAGENTA, 9, V_PERIDOTMAP, true}, // SKINCOLOR_LIME {"Peridot", {0x58, 0x58, 0xbc, 0xbc, 0xbd, 0xbd, 0xbe, 0xbe, 0xbe, 0xbf, 0x5e, 0x5e, 0x5f, 0x5f, 0x77, 0x77}, SKINCOLOR_COBALT, 2, V_PERIDOTMAP, true}, // SKINCOLOR_PERIDOT {"Apple", {0x49, 0x49, 0xbc, 0xbd, 0xbe, 0xbe, 0xbe, 0x67, 0x69, 0x6a, 0x6b, 0x6b, 0x6c, 0x6d, 0x6d, 0x6d}, SKINCOLOR_RASPBERRY, 13, V_PERIDOTMAP, true}, // SKINCOLOR_APPLE - {"Headlight", { 0, 80, 81, 82, 73, 84, 64, 65, 91, 91, 124, 125, 126, 137, 138, 139}, SKINCOLOR_MAUVE, 8, V_YELLOWMAP, true}, // SKINCOLOR_HEADLIGHT + {"Headlight", { 0, 80, 81, 82, 73, 84, 64, 65, 91, 91, 124, 125, 126, 137, 138, 139}, SKINCOLOR_LAVENDER, 10, V_YELLOWMAP, true}, // SKINCOLOR_HEADLIGHT {"Chartreuse", { 80, 82, 72, 73, 188, 188, 113, 114, 114, 125, 126, 137, 138, 139, 253, 254}, SKINCOLOR_NOBLE, 9, V_PERIDOTMAP, true}, // SKINCOLOR_CHARTREUSE - {"Green", {0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f}, SKINCOLOR_RED, 6, V_GREENMAP, true}, // SKINCOLOR_GREEN + {"Green", {0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f}, SKINCOLOR_PEPPER, 8, V_GREENMAP, true}, // SKINCOLOR_GREEN {"Forest", {0x65, 0x66, 0x67, 0x68, 0x69, 0x69, 0x6a, 0x6b, 0x6b, 0x6c, 0x6d, 0x6d, 0x6e, 0x6e, 0x6e, 0x6f}, SKINCOLOR_SALMON, 9, V_GREENMAP, true}, // SKINCOLOR_FOREST {"Shamrock", {0x70, 0x70, 0x71, 0x71, 0x72, 0x72, 0x73, 0x73, 0x73, 0x74, 0x75, 0x75, 0x76, 0x76, 0x77, 0x77}, SKINCOLOR_SIBERITE, 10, V_GREENMAP, true}, // SKINCOLOR_SHAMROCK - {"Jade", { 128, 120, 121, 122, 122, 113, 114, 114, 115, 116, 117, 118, 119, 110, 111, 30}, SKINCOLOR_TAFFY, 10, V_GREENMAP, true}, // SKINCOLOR_JADE + {"Jade", { 128, 120, 121, 122, 122, 113, 114, 114, 115, 116, 117, 118, 119, 110, 111, 30}, SKINCOLOR_ROSY, 7, V_GREENMAP, true}, // SKINCOLOR_JADE {"Mint", {0x00, 0x00, 0x58, 0x58, 0x59, 0x62, 0x62, 0x62, 0x64, 0x67, 0x7e, 0x7e, 0x8f, 0x8f, 0x8a, 0x8a}, SKINCOLOR_VIOLET, 5, V_GREENMAP, true}, // SKINCOLOR_MINT - {"Master", { 0, 80, 88, 96, 112, 113, 99, 100, 124, 125, 126, 117, 107, 118, 119, 111}, SKINCOLOR_PEPPER, 8, V_GREENMAP, true}, // SKINCOLOR_MASTER + {"Master", { 0, 80, 88, 96, 112, 113, 99, 100, 124, 125, 126, 117, 107, 118, 119, 111}, SKINCOLOR_RED, 6, V_GREENMAP, true}, // SKINCOLOR_MASTER {"Emerald", { 80, 96, 112, 113, 114, 114, 125, 125, 126, 126, 137, 137, 138, 138, 139, 139}, SKINCOLOR_RUBY, 9, V_GREENMAP, true}, // SKINCOLOR_EMERALD {"Seafoam", {0x01, 0x58, 0x59, 0x5a, 0x7c, 0x7d, 0x7d, 0x7e, 0x7e, 0x8f, 0x8f, 0x8a, 0x8a, 0x8b, 0xfd, 0xfd}, SKINCOLOR_PLUM, 6, V_AQUAMAP, true}, // SKINCOLOR_SEAFOAM {"Island", { 96, 97, 113, 113, 114, 124, 142, 136, 136, 150, 151, 153, 168, 168, 169, 169}, SKINCOLOR_GALAXY, 7, V_AQUAMAP, true}, // SKINCOLOR_ISLAND {"Bottle", { 0, 1, 3, 4, 5, 140, 141, 141, 124, 125, 126, 127, 118, 119, 111, 111}, SKINCOLOR_LATTE, 14, V_AQUAMAP, true}, // SKINCOLOR_BOTTLE - {"Aqua", {0x78, 0x79, 0x7a, 0x7a, 0x7b, 0x7b, 0x7c, 0x7c, 0x7c, 0x7d, 0x7e, 0x7e, 0x7f, 0x7f, 0x76, 0x77}, SKINCOLOR_ROSY, 7, V_AQUAMAP, true}, // SKINCOLOR_AQUA + {"Aqua", {0x78, 0x79, 0x7a, 0x7a, 0x7b, 0x7b, 0x7c, 0x7c, 0x7c, 0x7d, 0x7e, 0x7e, 0x7f, 0x7f, 0x76, 0x77}, SKINCOLOR_TAFFY, 10, V_AQUAMAP, true}, // SKINCOLOR_AQUA {"Teal", {0x78, 0x78, 0x8c, 0x8c, 0x8d, 0x8d, 0x8d, 0x8e, 0x8e, 0x8f, 0x8f, 0x8f, 0x8a, 0x8a, 0x8a, 0x8a}, SKINCOLOR_PEACHY, 7, V_SKYMAP, true}, // SKINCOLOR_TEAL {"Ocean", { 120, 121, 122, 122, 123, 141, 142, 142, 136, 137, 138, 138, 139, 139, 253, 253}, SKINCOLOR_TANGERINE, 4, V_AQUAMAP, true}, // SKINCOLOR_OCEAN {"Wave", {0x00, 0x78, 0x78, 0x79, 0x8d, 0x87, 0x88, 0x89, 0x89, 0xae, 0xa8, 0xa8, 0xa9, 0xa9, 0xfd, 0xfd}, SKINCOLOR_QUAIL, 5, V_SKYMAP, true}, // SKINCOLOR_WAVE @@ -23124,12 +23124,12 @@ skincolor_t skincolors[MAXSKINCOLORS] = { {"Violet", {0xd0, 0xd1, 0xd2, 0xca, 0xcc, 0xb8, 0xb9, 0xb9, 0xba, 0xa8, 0xa8, 0xa9, 0xa9, 0xfd, 0xfe, 0xfe}, SKINCOLOR_MINT, 6, V_MAGENTAMAP, true}, // SKINCOLOR_VIOLET {"Royal", { 208, 209, 192, 192, 192, 193, 193, 194, 194, 172, 173, 174, 175, 175, 139, 139}, SKINCOLOR_FANCY, 9, V_PURPLEMAP, true}, // SKINCOLOR_ROYAL {"Lilac", {0x00, 0xd0, 0xd1, 0xd2, 0xd3, 0xc1, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc5, 0xc6, 0xc6, 0xfe, 0x1f}, SKINCOLOR_VAPOR, 4, V_ROSYMAP, true}, // SKINCOLOR_LILAC - {"Mauve", { 176, 177, 178, 192, 193, 194, 195, 195, 196, 185, 185, 186, 186, 187, 187, 253}, SKINCOLOR_HEADLIGHT, 8, V_PURPLEMAP, true}, // SKINCOLOR_MAUVE + {"Mauve", { 176, 177, 178, 192, 193, 194, 195, 195, 196, 185, 185, 186, 186, 187, 187, 253}, SKINCOLOR_GOLD, 4, V_PURPLEMAP, true}, // SKINCOLOR_MAUVE {"Eventide", { 51, 52, 53, 33, 34, 204, 183, 183, 184, 184, 166, 167, 168, 169, 253, 254}, SKINCOLOR_DAYBREAK, 13, V_MAGENTAMAP, true}, // SKINCOLOR_EVENTIDE {"Plum", {0xc8, 0xd3, 0xd5, 0xd6, 0xd7, 0xce, 0xcf, 0xb9, 0xb9, 0xba, 0xba, 0xa9, 0xa9, 0xa9, 0xfd, 0xfe}, SKINCOLOR_MINT, 7, V_ROSYMAP, true}, // SKINCOLOR_PLUM {"Raspberry", {0xc8, 0xc9, 0xca, 0xcb, 0xcb, 0xcc, 0xcd, 0xcd, 0xce, 0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xfe, 0xfe}, SKINCOLOR_APPLE, 13, V_ROSYMAP, true}, // SKINCOLOR_RASPBERRY - {"Taffy", { 1, 176, 176, 177, 178, 179, 202, 203, 204, 204, 205, 206, 207, 44, 45, 46}, SKINCOLOR_JADE, 8, V_ROSYMAP, true}, // SKINCOLOR_TAFFY - {"Rosy", {0xfc, 0xc8, 0xc8, 0xc9, 0xc9, 0xca, 0xca, 0xcb, 0xcb, 0xcc, 0xcc, 0xcd, 0xcd, 0xce, 0xce, 0xcf}, SKINCOLOR_AQUA, 1, V_ROSYMAP, true}, // SKINCOLOR_ROSY + {"Taffy", { 1, 176, 176, 177, 178, 179, 202, 203, 204, 204, 205, 206, 207, 44, 45, 46}, SKINCOLOR_AQUA, 1, V_ROSYMAP, true}, // SKINCOLOR_TAFFY + {"Rosy", {0xfc, 0xc8, 0xc8, 0xc9, 0xc9, 0xca, 0xca, 0xcb, 0xcb, 0xcc, 0xcc, 0xcd, 0xcd, 0xce, 0xce, 0xcf}, SKINCOLOR_JADE, 8, V_ROSYMAP, true}, // SKINCOLOR_ROSY {"Fancy", { 0, 208, 49, 210, 210, 202, 202, 203, 204, 204, 205, 206, 207, 207, 186, 186}, SKINCOLOR_ROYAL, 9, V_ROSYMAP, true}, // SKINCOLOR_FANCY {"Sangria", { 210, 32, 33, 34, 34, 215, 215, 207, 207, 185, 186, 186, 186, 169, 169, 253}, SKINCOLOR_TURQUOISE, 12, V_ROSYMAP, true}, // SKINCOLOR_SANGRIA {"Volcanic", { 54, 36, 42, 44, 45, 46, 46, 47, 28, 253, 253, 254, 254, 30, 31, 31}, SKINCOLOR_BRONZE, 9, V_REDMAP, true}, // SKINCOLOR_VOLCANIC From 6f1a11567c9db54e5016bb5e043181b2164d1b7e Mon Sep 17 00:00:00 2001 From: pastel Date: Sat, 18 Jan 2025 09:34:20 -0600 Subject: [PATCH 314/353] Fix file download checking the old asset file names --- src/netcode/d_netfil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/netcode/d_netfil.c b/src/netcode/d_netfil.c index 313905f43..bfb67838f 100644 --- a/src/netcode/d_netfil.c +++ b/src/netcode/d_netfil.c @@ -1345,9 +1345,9 @@ void PT_FileFragment(SINT8 node, INT32 netconsole) if (!(strcmp(filename, "srb2.pk3") && strcmp(filename, "zones.pk3") - && strcmp(filename, "player.dta") + && strcmp(filename, "characters.pk3") && strcmp(filename, "patch.pk3") - && strcmp(filename, "music.dta") + && strcmp(filename, "music.pk3") )) I_Error("Tried to download \"%s\"", filename); From 52b88d63fe538249fb863f20bea3b6d0802c23bc Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 18 Jan 2025 14:57:09 -0300 Subject: [PATCH 315/353] Make v.getSprite2Patch able to fallback to non-super sprites --- src/lua_hudlib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index d2b3d9679..c8327658a 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -613,6 +613,10 @@ static int libd_getSprite2Patch(lua_State *L) if (super) j |= SPR2F_SUPER; + // If there is no "super" variation of this sprite, try with the normal one. + if (!P_IsValidSprite2(skins[i], j)) + j &= ~SPR2F_SUPER; + sprdef = P_GetSkinSpritedef(skins[i], j); // set frame number From 7eaa7ca85b773ac1b91760034e0fde96eccc5a83 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 18 Jan 2025 13:52:26 -0600 Subject: [PATCH 316/353] Begin version 2.2.15 cycle --- src/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/version.h b/src/version.h index 21204e016..8e69194cd 100644 --- a/src/version.h +++ b/src/version.h @@ -1,4 +1,4 @@ -#define SRB2VERSION "2.2.14"/* this must be the first line, for cmake !! */ +#define SRB2VERSION "2.2.15"/* this must be the first line, for cmake !! */ // The Modification ID; must be obtained from a Master Server Admin ( https://mb.srb2.org/members/?key=ms_admin ). // DO NOT try to set this otherwise, or your modification will be unplayable through the Master Server. @@ -9,7 +9,7 @@ // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.2.0 is not version "1". -#define MODVERSION 55 +#define MODVERSION 56 // Define this as a prerelease version suffix (pre#, RC#) //#define BETAVERSION "pre4" From 6a453d11fd88dfda8925e62725463a6eb96f7980 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 18 Jan 2025 13:54:20 -0600 Subject: [PATCH 317/353] Revert "Mario power up hardcoding" This reverts commit fd6058826261d08b0c2e8467851295a61e326b3a. --- src/deh_tables.c | 60 -------- src/info.c | 359 +---------------------------------------------- src/info.h | 72 ---------- 3 files changed, 1 insertion(+), 490 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 8fa32558b..76df6a510 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3332,53 +3332,6 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_WHITEDANDELION", "S_MAR64TREE", - // Power up mushrooms - "S_LIFESHROOM", - "S_LIFESHROOM2", - "S_LIFESHROOMD", - "S_LIFESHROOM_INVISIBLE", - "S_LIFESHROOM_INVISIBLE_TOUCH", - - "S_POISONSHROOM", - "S_POISONSHROOM2", - "S_POISONSHROOMD", - - "S_NUKESHROOM", - "S_NUKESHROOM2", - "S_NUKESHROOMD", - - "S_FORCESHROOM", - "S_FORCESHROOM2", - "S_FORCESHROOMD", - - "S_ATTRACTSHROOM", - "S_ATTRACTSHROOM2", - "S_ATTRACTSHROOMD", - - "S_ELEMENTALSHROOM", - "S_ELEMENTALSHROOM2", - "S_ELEMENTALSHROOMD", - - "S_CLOUDSHROOM", - "S_CLOUDSHROOM2", - "S_CLOUDSHROOMD", - - "S_STARMAN", - "S_STARMAN1", - "S_STARMAN2", - "S_STARMAN3", - "S_STARMAND", - - "S_SPEEDWINGS", - "S_SPEEDWINGSD", - - "S_PARTICLEPICKUP1", - "S_PARTICLEPICKUP2", - "S_1000SCOREAWARD", - "S_POWERUPAWARD", - "S_POWERUPAWARD1", - "S_POWERUPAWARD2", - // Nights-specific stuff "S_NIGHTSDRONE_MAN1", "S_NIGHTSDRONE_MAN2", @@ -4400,19 +4353,6 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_WHITEDANDELION", "MT_MAR64TREE", - // Power up mushrooms - "MT_LIFESHROOM", - "MT_LIFESHROOM_INVISIBLE", - "MT_POISONSHROOM", - "MT_NUKESHROOM", - "MT_FORCESHROOM", - "MT_ATTRACTSHROOM", - "MT_ELEMENTALSHROOM", - "MT_CLOUDSHROOM", - "MT_STARMAN", - "MT_SPEEDWINGS", - "MT_POWERUPAWARD", - // NiGHTS Stuff "MT_AXIS", "MT_AXISTRANSFER", diff --git a/src/info.c b/src/info.c index cf635c011..e2aee594f 100644 --- a/src/info.c +++ b/src/info.c @@ -485,18 +485,6 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "MFWD", "MUS3", - // Mario powerups - "MSIV", // invincibility - "MS1P", // 1-up - "MSAT", // attract - "MSFO", // force - "MSAR", // nuke - "MSWW", // whirlwind - "MSEL", // elemental - "MSSP", // speed shoes - "MEGH", // poison - "UPPB", // particle pickup - // NiGHTS Stuff "NDRN", // NiGHTS drone "NSPK", // NiGHTS sparkle @@ -3814,54 +3802,6 @@ state_t states[NUMSTATES] = {SPR_MFWD, FF_ANIMATE, -1, {NULL}, 3, 6, S_NULL, 0}, // S_WHITEDANDELION {SPR_MUS3, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_MAR64TREE - // Mario powerups - {SPR_MS1P, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_LIFESHROOM2, 0}, // S_LIFESHROOM - {SPR_MS1P, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_LIFESHROOM, 0}, // S_LIFESHROOM2 - {SPR_MS1P, 0, 1, {A_ExtraLife}, 0, 0, S_PARTICLEPICKUP1, 0}, // S_LIFESHROOMD - - {SPR_NULL, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_LIFESHROOM_INVISIBLE - {SPR_NULL, 0, 1, {A_ExtraLife}, 0, 0, S_NULL, 0}, // S_LIFESHROOM_INVISIBLE_TOUCH - - {SPR_MEGH, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_POISONSHROOM2, 0}, // S_POISONSHROOM - {SPR_MEGH, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_POISONSHROOM, 0}, // S_POISONSHROOM2 - {SPR_MEGH, 0, 1, {A_EggmanBox}, 0, 0, S_PARTICLEPICKUP1, 0}, // S_POISONSHROOMD - - {SPR_MSAR, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_NUKESHROOM2, 0}, // S_NUKESHROOM - {SPR_MSAR, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_NUKESHROOM, 0}, // S_NUKESHROOM2 - {SPR_MSAR, 0, 1, {A_GiveShield}, SH_ARMAGEDDON, 0, S_1000SCOREAWARD, 0}, // S_NUKESHROOMD - - {SPR_MSFO, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_FORCESHROOM2, 0}, // S_FORCESHROOM - {SPR_MSFO, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_FORCESHROOM, 0}, // S_FORCESHROOM2 - {SPR_MSFO, 0, 1, {A_GiveShield}, SH_FORCE|1, 0, S_1000SCOREAWARD, 0}, // S_FORCESHROOMD - - {SPR_MSAT, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_ATTRACTSHROOM2, 0}, // S_ATTRACTSHROOM - {SPR_MSAT, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_ATTRACTSHROOM, 0}, // S_ATTRACTSHROOM2 - {SPR_MSAT, 0, 1, {A_GiveShield}, SH_ATTRACT, 0, S_1000SCOREAWARD, 0}, // S_ATTRACTSHROOMD - - {SPR_MSEL, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_ELEMENTALSHROOM2, 0}, // S_ELEMENTALSHROOM - {SPR_MSEL, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_ELEMENTALSHROOM, 0}, // S_ELEMENTALSHROOM2 - {SPR_MSEL, 0, 1, {A_GiveShield}, SH_ELEMENTAL, 0, S_1000SCOREAWARD, 0}, // S_ELEMENTALSHROOMD - - {SPR_MSWW, 0, 1, {A_FlickyHop}, FRACUNIT/6, 5*FRACUNIT, S_CLOUDSHROOM2, 0}, // S_CLOUDSHROOM - {SPR_MSWW, 0, 1, {A_FlickyAim}, ANGLE_90, 64*FRACUNIT, S_CLOUDSHROOM, 0}, // S_CLOUDSHROOM2 - {SPR_MSWW, 0, 1, {A_GiveShield}, SH_WHIRLWIND, 0, S_1000SCOREAWARD, 0}, // S_CLOUDSHROOMD - - {SPR_MSIV, 0, 1, {A_Look}, 3, 1, S_STARMAN, 0}, // S_STARMAN - {SPR_MSIV, 0, 2, {A_BunnyHop}, 7, 6, S_STARMAN2, 0}, // S_STARMAN1 - {SPR_MSIV, 0, 1, {A_SmokeTrailer}, MT_BOXSPARKLE, 0, S_STARMAN3, 0}, // S_STARMAN2 - {SPR_MSIV, 0, 1, {A_GhostMe}, 0, 0, S_STARMAN1, 0}, // S_STARMAN3 - {SPR_MSIV, 0, 1, {A_Invincibility}, 0, 0, S_PARTICLEPICKUP1, 0}, // S_STARMAND - - {SPR_MSSP, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SPEEDWINGS - {SPR_MSSP, 0, 1, {A_SuperSneakers}, 0, 0, S_NULL, 0}, // S_SPEEDWINGSD - - {SPR_UPPB, FF_ADD, 1, {A_ForceStop}, 0, 0, S_PARTICLEPICKUP2, 0}, // S_PARTICLEPICKUP1 - {SPR_UPPB, 1|FF_ANIMATE|FF_ADD, 19, {NULL}, 18, 1, S_NULL, 0}, // S_PARTICLEPICKUP2 - {SPR_NULL, 0, 1, {A_SpawnObjectRelative}, 0, MT_POWERUPAWARD, S_PARTICLEPICKUP1, 0}, // S_1000SCOREAWARD - {SPR_NULL, 0, 1, {NULL}, 0, 0, S_POWERUPAWARD1, 0}, // S_POWERUPAWARD - {SPR_NULL, 0, 1, {A_FindTarget}, MT_PLAYER, 0, S_POWERUPAWARD2, 0}, // S_POWERUPAWARD1 - {SPR_NULL, 0, 1, {A_AwardScore}, 0, 0, S_NULL, 0}, // S_POWERUPAWARD2 - // Nights Drone {SPR_NDRN, 0, -1, {NULL}, 0, 0, S_NIGHTSDRONE_MAN2, 0}, // S_NIGHTSDRONE_MAN1 {SPR_NDRN, 0, -1, {NULL}, 0, 0, S_NIGHTSDRONE_MAN1, 0}, // S_NIGHTSDRONE_MAN2 @@ -19712,7 +19652,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_mario1, // activesound - MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY, // flags + MF_SPECIAL|MF_SHOOTABLE|MF_BOUNCE, // flags S_NULL // raisestate }, @@ -20282,303 +20222,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_LIFESHROOM - 1826, // doomednum - S_LIFESHROOM, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_LIFESHROOMD, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL, // flags - S_NULL // raisestate - }, - - { // MT_LIFESHROOM_INVISIBLE - 1841, // doomednum - S_LIFESHROOM_INVISIBLE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_LIFESHROOM_INVISIBLE_TOUCH, // deathstate - S_NULL, // xdeathstate - sfx_mario3, // deathsound - -3072, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL|MF_NOGRAVITY, // flags - S_NULL // raisestate - }, - - { // MT_POISONSHROOM - 2303, // doomednum - S_POISONSHROOM, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_POISONSHROOMD,// deathstate - S_NULL, // xdeathstate - sfx_mario3, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL, // flags - S_NULL // raisestate - }, - - { // MT_NUKESHROOM - 1829, // doomednum - S_NUKESHROOM, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NUKESHROOMD, // deathstate - S_NULL, // xdeathstate - sfx_mario3, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL, // flags - S_NULL // raisestate - }, - - { // MT_FORCESHROOM - 1828, // doomednum - S_FORCESHROOM, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_FORCESHROOMD, // deathstate - S_NULL, // xdeathstate - sfx_mario3, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL, // flags - S_NULL // raisestate - }, - - { // MT_ATTRACTSHROOM - 1827, // doomednum - S_ATTRACTSHROOM,// spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_ATTRACTSHROOMD, // deathstate - S_NULL, // xdeathstate - sfx_mario3, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL, // flags - S_NULL // raisestate - }, - - { // MT_ELEMENTALSHROOM - 1831, // doomednum - S_ELEMENTALSHROOM, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_ELEMENTALSHROOMD, // deathstate - S_NULL, // xdeathstate - sfx_mario3, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL, // flags - S_NULL // raisestate - }, - - { // MT_CLOUDSHROOM - 1830, // doomednum - S_CLOUDSHROOM, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_CLOUDSHROOMD, // deathstate - S_NULL, // xdeathstate - sfx_mario3, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL, // flags - S_NULL // raisestate - }, - - { // MT_STARMAN - 1825, // doomednum - S_STARMAN, // spawnstate - 1000, // spawnhealth - S_STARMAN1, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_STARMAND, // deathstate - S_NULL, // xdeathstate - sfx_mario3, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL, // flags - S_NULL // raisestate - }, - - { // MT_SPEEDWINGS - 2304, // doomednum - S_SPEEDWINGS, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_SPEEDWINGSD, // deathstate - S_NULL, // xdeathstate - sfx_mario3, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 32*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SPECIAL, // flags - S_NULL // raisestate - }, - - { // MT_POWERUPAWARD - -1, // doomednum - S_POWERUPAWARD, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_mario4, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 24*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_SLIDEME|MF_NOGRAVITY, // flags - S_NULL // raisestate - }, - { // MT_AXIS 1700, // doomednum S_INVISIBLE, // spawnstate diff --git a/src/info.h b/src/info.h index bf8306887..50affb04b 100644 --- a/src/info.h +++ b/src/info.h @@ -1036,18 +1036,6 @@ typedef enum sprite SPR_MFWD, SPR_MUS3, - // Mario powerups - SPR_MSIV, // invincibility - SPR_MS1P, // 1-up - SPR_MSAT, // attract - SPR_MSFO, // force - SPR_MSAR, // nuke - SPR_MSWW, // whirlwind - SPR_MSEL, // elemental - SPR_MSSP, // speed shoes - SPR_MEGH, // poison - SPR_UPPB, // particle pickup - // NiGHTS Stuff SPR_NDRN, // NiGHTS drone SPR_NSPK, // NiGHTS sparkle @@ -4192,53 +4180,6 @@ typedef enum state S_WHITEDANDELION, S_MAR64TREE, - // Power up mushrooms - S_LIFESHROOM, - S_LIFESHROOM2, - S_LIFESHROOMD, - S_LIFESHROOM_INVISIBLE, - S_LIFESHROOM_INVISIBLE_TOUCH, - - S_POISONSHROOM, - S_POISONSHROOM2, - S_POISONSHROOMD, - - S_NUKESHROOM, - S_NUKESHROOM2, - S_NUKESHROOMD, - - S_FORCESHROOM, - S_FORCESHROOM2, - S_FORCESHROOMD, - - S_ATTRACTSHROOM, - S_ATTRACTSHROOM2, - S_ATTRACTSHROOMD, - - S_ELEMENTALSHROOM, - S_ELEMENTALSHROOM2, - S_ELEMENTALSHROOMD, - - S_CLOUDSHROOM, - S_CLOUDSHROOM2, - S_CLOUDSHROOMD, - - S_STARMAN, - S_STARMAN1, - S_STARMAN2, - S_STARMAN3, - S_STARMAND, - - S_SPEEDWINGS, - S_SPEEDWINGSD, - - S_PARTICLEPICKUP1, - S_PARTICLEPICKUP2, - S_1000SCOREAWARD, - S_POWERUPAWARD, - S_POWERUPAWARD1, - S_POWERUPAWARD2, - // Nights-specific stuff S_NIGHTSDRONE_MAN1, S_NIGHTSDRONE_MAN2, @@ -5281,19 +5222,6 @@ typedef enum mobj_type MT_WHITEDANDELION, MT_MAR64TREE, - // Power up mushrooms - MT_LIFESHROOM, - MT_LIFESHROOM_INVISIBLE, - MT_POISONSHROOM, - MT_NUKESHROOM, - MT_FORCESHROOM, - MT_ATTRACTSHROOM, - MT_ELEMENTALSHROOM, - MT_CLOUDSHROOM, - MT_STARMAN, - MT_SPEEDWINGS, - MT_POWERUPAWARD, - // NiGHTS Stuff MT_AXIS, MT_AXISTRANSFER, From 5cc68e23d58f15efacf9098a681b11723c375f90 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 18 Jan 2025 13:54:31 -0600 Subject: [PATCH 318/353] Revert "Trampolines!" This reverts commit ae0886e279148ad10f941c25c68f764a0f11040f. --- src/deh_tables.c | 73 ---------- src/f_finale.c | 2 +- src/hardware/hw_light.c | 9 -- src/info.c | 315 ---------------------------------------- src/info.h | 82 ----------- 5 files changed, 1 insertion(+), 480 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index 76df6a510..f0a632f40 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -2920,69 +2920,6 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_BHORIZ7", "S_BHORIZ8", - // Yellow Trampoline - "S_YELLOWTRAMPOLINE", - "S_YELLOWTRAMPOLINE2", - "S_YELLOWTRAMPOLINE3", - "S_YELLOWTRAMPOLINE4", - "S_YELLOWTRAMPOLINE5", - - // Red Trampoline - "S_REDTRAMPOLINE", - "S_REDTRAMPOLINE2", - "S_REDTRAMPOLINE3", - "S_REDTRAMPOLINE4", - "S_REDTRAMPOLINE5", - - // Blue Trampoline - "S_BLUETRAMPOLINE", - "S_BLUETRAMPOLINE2", - "S_BLUETRAMPOLINE3", - "S_BLUETRAMPOLINE4", - "S_BLUETRAMPOLINE5", - - // Horizontal Yellow Trampoline - "S_HORIZYELLOWTRAMPOLINE", - "S_HORIZYELLOWTRAMPOLINE2", - "S_HORIZYELLOWTRAMPOLINE3", - "S_HORIZYELLOWTRAMPOLINE4", - "S_HORIZYELLOWTRAMPOLINE5", - - // Horizontal Red Trampoline - "S_HORIZREDTRAMPOLINE", - "S_HORIZREDTRAMPOLINE2", - "S_HORIZREDTRAMPOLINE3", - "S_HORIZREDTRAMPOLINE4", - "S_HORIZREDTRAMPOLINE5", - - // Horizontal Blue Trampoline - "S_HORIZBLUETRAMPOLINE", - "S_HORIZBLUETRAMPOLINE2", - "S_HORIZBLUETRAMPOLINE3", - "S_HORIZBLUETRAMPOLINE4", - "S_HORIZBLUETRAMPOLINE5", - - // Diagonal Yellow Trampoline - "S_DIAGYELLOWTRAMPOLINE", - "S_DIAGYELLOWTRAMPOLINE2", - "S_DIAGYELLOWTRAMPOLINE3", - "S_DIAGYELLOWTRAMPOLINE4", - "S_DIAGYELLOWTRAMPOLINE5", - - // Diagonal Red Trampoline - "S_DIAGREDTRAMPOLINE", - "S_DIAGREDTRAMPOLINE2", - "S_DIAGREDTRAMPOLINE3", - "S_DIAGREDTRAMPOLINE4", - "S_DIAGREDTRAMPOLINE5", - - // Diagonal Blue Trampoline - "S_DIAGBLUETRAMPOLINE", - "S_DIAGBLUETRAMPOLINE2", - "S_DIAGBLUETRAMPOLINE3", - "S_DIAGBLUETRAMPOLINE4", - "S_DIAGBLUETRAMPOLINE5", - // Booster "S_BOOSTERSOUND", "S_YELLOWBOOSTERROLLER", @@ -3820,16 +3757,6 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_REDHORIZ", "MT_BLUEHORIZ", - "MT_YELLOWTRAMPOLINE", - "MT_REDTRAMPOLINE", - "MT_BLUETRAMPOLINE", - "MT_HORIZYELLOWTRAMPOLINE", - "MT_HORIZREDTRAMPOLINE", - "MT_HORIZBLUETRAMPOLINE", - "MT_DIAGYELLOWTRAMPOLINE", - "MT_DIAGREDTRAMPOLINE", - "MT_DIAGBLUETRAMPOLINE", - "MT_BOOSTERSEG", "MT_BOOSTERROLLER", "MT_YELLOWBOOSTER", diff --git a/src/f_finale.c b/src/f_finale.c index 06db0b44f..ee6491b69 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1163,6 +1163,7 @@ static const char *credits[] = { "Sally \"TehRealSalt\" Cochenour", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", + "\"Evertone\"", // summit showdown hehehehe "Ben \"Mystic\" Geyer", "Nathan \"Jazz\" Giroux", "\"GomaTheMascar\"", @@ -1173,7 +1174,6 @@ static const char *credits[] = { "Mujamel \"MK\" Khan", "\"Kaito Sinclaire\"", "Alexander \"DrTapeworm\" Moench-Ford", - "\"orbitalviolet\"", // summit showdown hehehehe (aka Evertone) "\"Radicalicious\"", "\"Revan\"", "Anna \"QueenDelta\" Sandlin", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 5503f3ed9..9d6bdc910 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -485,15 +485,6 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_SSWY &lspr[NOLIGHT], // SPR_SSWR &lspr[NOLIGHT], // SPR_SSWB - &lspr[NOLIGHT], // SPR_MPRY - &lspr[NOLIGHT], // SPR_MPRR - &lspr[NOLIGHT], // SPR_MPRB - &lspr[NOLIGHT], // SPR_MSWY - &lspr[NOLIGHT], // SPR_MSWR - &lspr[NOLIGHT], // SPR_MSWB - &lspr[NOLIGHT], // SPR_MDIY - &lspr[NOLIGHT], // SPR_MDIR - &lspr[NOLIGHT], // SPR_MDIB &lspr[NOLIGHT], // SPR_BSTY &lspr[NOLIGHT], // SPR_BSTR diff --git a/src/info.c b/src/info.c index e2aee594f..95cc64135 100644 --- a/src/info.c +++ b/src/info.c @@ -396,15 +396,6 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "SSWY", // Yellow Side Spring "SSWR", // Red Side Spring "SSWB", // Blue Side Spring - "MPRY", // Yellow trampoline - "MPRR", // Red trampoline - "MPRB", // Blue trampoline - "MSWY", // Yellow horizontal trampoline - "MSWR", // Red horizontal trampoline - "MSWB", // Blue horizontal trampoline - "MDIY", // Yellow diagonal trampoline - "MDIR", // Red diagonal trampoline - "MDIB", // Blue diagonal trampoline "BSTY", // Yellow Booster "BSTR", // Red Booster @@ -3342,69 +3333,6 @@ state_t states[NUMSTATES] = {SPR_SSWB, 2, 1, {NULL}, 0, 0, S_BHORIZ8, 0}, // S_BHORIZ7 {SPR_SSWB, 1, 1, {NULL}, 0, 0, S_BHORIZ1, 0}, // S_BHORIZ8 - // Yellow trampoline - {SPR_MPRY, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_YELLOWTRAMPOLINE - {SPR_MPRY, 4, 4, {A_Pain}, 0, 0, S_YELLOWTRAMPOLINE3, 0}, // S_YELLOWTRAMPOLINE2 - {SPR_MPRY, 3, 1, {NULL}, 0, 0, S_YELLOWTRAMPOLINE4, 0}, // S_YELLOWTRAMPOLINE3 - {SPR_MPRY, 2, 1, {NULL}, 0, 0, S_YELLOWTRAMPOLINE5, 0}, // S_YELLOWTRAMPOLINE4 - {SPR_MPRY, 1, 1, {NULL}, 0, 0, S_YELLOWTRAMPOLINE, 0}, // S_YELLOWTRAMPOLINE5 - - // Red trampoline - {SPR_MPRR, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_REDTRAMPOLINE - {SPR_MPRR, 4, 4, {A_Pain}, 0, 0, S_REDTRAMPOLINE3, 0}, // S_REDTRAMPOLINE2 - {SPR_MPRR, 3, 1, {NULL}, 0, 0, S_REDTRAMPOLINE4, 0}, // S_REDTRAMPOLINE3 - {SPR_MPRR, 2, 1, {NULL}, 0, 0, S_REDTRAMPOLINE5, 0}, // S_REDTRAMPOLINE4 - {SPR_MPRR, 1, 1, {NULL}, 0, 0, S_REDTRAMPOLINE, 0}, // S_REDTRAMPOLINE5 - - // Blue trampoline - {SPR_MPRB, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BLUETRAMPOLINE - {SPR_MPRB, 4, 4, {A_Pain}, 0, 0, S_BLUETRAMPOLINE3, 0}, // S_BLUETRAMPOLINE2 - {SPR_MPRB, 3, 1, {NULL}, 0, 0, S_BLUETRAMPOLINE4, 0}, // S_BLUETRAMPOLINE3 - {SPR_MPRB, 2, 1, {NULL}, 0, 0, S_BLUETRAMPOLINE5, 0}, // S_BLUETRAMPOLINE4 - {SPR_MPRB, 1, 1, {NULL}, 0, 0, S_BLUETRAMPOLINE, 0}, // S_BLUETRAMPOLINE5 - - // Yellow horizontal trampoline - {SPR_MSWY, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_HORIZYELLOWTRAMPOLINE - {SPR_MSWY, 4, 4, {A_Pain}, 0, 0, S_HORIZYELLOWTRAMPOLINE3, 0}, // S_HORIZYELLOWTRAMPOLINE2 - {SPR_MSWY, 3, 1, {NULL}, 0, 0, S_HORIZYELLOWTRAMPOLINE4, 0}, // S_HORIZYELLOWTRAMPOLINE3 - {SPR_MSWY, 2, 1, {NULL}, 0, 0, S_HORIZYELLOWTRAMPOLINE5, 0}, // S_HORIZYELLOWTRAMPOLINE4 - {SPR_MSWY, 1, 1, {NULL}, 0, 0, S_HORIZYELLOWTRAMPOLINE, 0}, // S_HORIZYELLOWTRAMPOLINE5 - - // Red horizontal trampoline - {SPR_MSWR, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_HORIZREDTRAMPOLINE - {SPR_MSWR, 4, 4, {A_Pain}, 0, 0, S_HORIZREDTRAMPOLINE3, 0}, // S_HORIZREDTRAMPOLINE2 - {SPR_MSWR, 3, 1, {NULL}, 0, 0, S_HORIZREDTRAMPOLINE4, 0}, // S_HORIZREDTRAMPOLINE3 - {SPR_MSWR, 2, 1, {NULL}, 0, 0, S_HORIZREDTRAMPOLINE5, 0}, // S_HORIZREDTRAMPOLINE4 - {SPR_MSWR, 1, 1, {NULL}, 0, 0, S_HORIZREDTRAMPOLINE, 0}, // S_HORIZREDTRAMPOLINE5 - - // Blue horizontal trampoline - {SPR_MSWB, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_HORIZBLUETRAMPOLINE - {SPR_MSWB, 4, 4, {A_Pain}, 0, 0, S_HORIZBLUETRAMPOLINE3, 0}, // S_HORIZBLUETRAMPOLINE2 - {SPR_MSWB, 3, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE4, 0}, // S_HORIZBLUETRAMPOLINE3 - {SPR_MSWB, 2, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE5, 0}, // S_HORIZBLUETRAMPOLINE4 - {SPR_MSWB, 1, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE, 0}, // S_HORIZBLUETRAMPOLINE5 - - // Yellow diagonal trampoline - {SPR_MDIY, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_DIAGYELLOWTRAMPOLINE - {SPR_MDIY, 4, 4, {A_Pain}, 0, 0, S_DIAGYELLOWTRAMPOLINE3, 0}, // S_DIAGYELLOWTRAMPOLINE2 - {SPR_MDIY, 3, 1, {NULL}, 0, 0, S_DIAGYELLOWTRAMPOLINE4, 0}, // S_DIAGYELLOWTRAMPOLINE3 - {SPR_MDIY, 2, 1, {NULL}, 0, 0, S_DIAGYELLOWTRAMPOLINE5, 0}, // S_DIAGYELLOWTRAMPOLINE4 - {SPR_MDIY, 1, 1, {NULL}, 0, 0, S_DIAGYELLOWTRAMPOLINE, 0}, // S_DIAGYELLOWTRAMPOLINE5 - - // Red diagonal trampoline - {SPR_MDIR, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_DIAGREDTRAMPOLINE - {SPR_MDIR, 4, 4, {A_Pain}, 0, 0, S_DIAGREDTRAMPOLINE3, 0}, // S_DIAGREDTRAMPOLINE2 - {SPR_MDIR, 3, 1, {NULL}, 0, 0, S_DIAGREDTRAMPOLINE4, 0}, // S_DIAGREDTRAMPOLINE3 - {SPR_MDIR, 2, 1, {NULL}, 0, 0, S_DIAGREDTRAMPOLINE5, 0}, // S_DIAGREDTRAMPOLINE4 - {SPR_MDIR, 1, 1, {NULL}, 0, 0, S_DIAGREDTRAMPOLINE, 0}, // S_DIAGREDTRAMPOLINE5 - - // Blue diagonal trampoline - {SPR_MDIB, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_DIAGBLUETRAMPOLINE - {SPR_MDIB, 4, 4, {A_Pain}, 0, 0, S_DIAGBLUETRAMPOLINE3, 0}, // S_DIAGBLUETRAMPOLINE2 - {SPR_MDIB, 3, 1, {NULL}, 0, 0, S_DIAGBLUETRAMPOLINE4, 0}, // S_DIAGBLUETRAMPOLINE3 - {SPR_MDIB, 2, 1, {NULL}, 0, 0, S_DIAGBLUETRAMPOLINE5, 0}, // S_DIAGBLUETRAMPOLINE4 - {SPR_MDIB, 1, 1, {NULL}, 0, 0, S_DIAGBLUETRAMPOLINE, 0}, // S_DIAGBLUETRAMPOLINE5 - // Boosters {SPR_NULL, 0, 1, {A_Pain}, 0, 0, S_INVISIBLE, 0}, // S_BOOSTERSOUND {SPR_BSTY, FF_ANIMATE, -1, {NULL}, 2, 1, S_NULL, 0}, // S_YELLOWBOOSTERROLLER @@ -7931,249 +7859,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_BHORIZ2 // raisestate }, - { // MT_YELLOWTRAMPOLINE - 1814, // doomednum - S_YELLOWTRAMPOLINE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_mariob, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 20*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 20*FRACUNIT, // mass - 0, // damage - sfx_None, // activesound - MF_SOLID|MF_SPRING, // flags - S_YELLOWTRAMPOLINE2 // raisestate - }, - - { // MT_REDTRAMPOLINE - 1815, // doomednum - S_REDTRAMPOLINE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_mariob, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 20*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 32*FRACUNIT, // mass - 0, // damage - sfx_None, // activesound - MF_SOLID|MF_SPRING, // flags - S_REDTRAMPOLINE2 // raisestate - }, - - { // MT_BLUETRAMPOLINE - 1813, // doomednum - S_BLUETRAMPOLINE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_mariob, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 20*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 11*FRACUNIT, // mass - 0, // damage - sfx_None, // activesound - MF_SOLID|MF_SPRING, // flags - S_BLUETRAMPOLINE2 // raisestate - }, - - { // MT_HORIZYELLOWTRAMPOLINE - 1817, // doomednum - S_HORIZYELLOWTRAMPOLINE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_mariob, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 20*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 0, // mass - 36*FRACUNIT, // damage - sfx_None, // activesound - MF_SOLID|MF_SPRING, // flags - S_HORIZYELLOWTRAMPOLINE2 // raisestate - }, - - { // MT_HORIZREDTRAMPOLINE - 1818, // doomednum - S_HORIZREDTRAMPOLINE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_mariob, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 20*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 0, // mass - 72*FRACUNIT, // damage - sfx_None, // activesound - MF_SOLID|MF_SPRING, // flags - S_HORIZREDTRAMPOLINE2 // raisestate - }, - - { // MT_HORIZBLUETRAMPOLINE - 1816, // doomednum - S_HORIZBLUETRAMPOLINE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_mariob, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 20*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 0, // mass - 18*FRACUNIT, // damage - sfx_None, // activesound - MF_SOLID|MF_SPRING, // flags - S_HORIZBLUETRAMPOLINE2 // raisestate - }, - - { // MT_DIAGYELLOWTRAMPOLINE - 2551, // doomednum - S_DIAGYELLOWTRAMPOLINE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_mariob, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 20*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 20*FRACUNIT, // mass - 20*FRACUNIT, // damage - sfx_None, // activesound - MF_SOLID|MF_SPRING, // flags - S_DIAGYELLOWTRAMPOLINE2 // raisestate - }, - - { // MT_DIAGREDTRAMPOLINE - 2552, // doomednum - S_DIAGREDTRAMPOLINE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_mariob, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 20*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 32*FRACUNIT, // mass - 32*FRACUNIT, // damage - sfx_None, // activesound - MF_SOLID|MF_SPRING, // flags - S_DIAGREDTRAMPOLINE2 // raisestate - }, - - { // MT_DIAGBLUETRAMPOLINE - 2550, // doomednum - S_DIAGBLUETRAMPOLINE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 0, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_mariob, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 20*FRACUNIT, // radius - 16*FRACUNIT, // height - 0, // display offset - 11*FRACUNIT, // mass - 11*FRACUNIT, // damage - sfx_None, // activesound - MF_SOLID|MF_SPRING, // flags - S_DIAGBLUETRAMPOLINE2 // raisestate - }, - { // MT_BOOSTERSEG -1, // doomednum S_INVISIBLE, // spawnstate diff --git a/src/info.h b/src/info.h index 50affb04b..5f49c88a3 100644 --- a/src/info.h +++ b/src/info.h @@ -947,15 +947,6 @@ typedef enum sprite SPR_SSWY, // Yellow Side Spring SPR_SSWR, // Red Side Spring SPR_SSWB, // Blue Side Spring - SPR_MPRY, // Yellow trampoline - SPR_MPRR, // Red trampoline - SPR_MPRB, // Blue trampoline - SPR_MSWY, // Yellow horizontal trampoline - SPR_MSWR, // Red horizontal trampoline - SPR_MSWB, // Blue horizontal trampoline - SPR_MDIY, // Yellow diagonal trampoline - SPR_MDIR, // Red diagonal trampoline - SPR_MDIB, // Blue diagonal trampoline SPR_BSTY, // Yellow Booster SPR_BSTR, // Red Booster @@ -3768,69 +3759,6 @@ typedef enum state S_BHORIZ7, S_BHORIZ8, - // Yellow Trampoline - S_YELLOWTRAMPOLINE, - S_YELLOWTRAMPOLINE2, - S_YELLOWTRAMPOLINE3, - S_YELLOWTRAMPOLINE4, - S_YELLOWTRAMPOLINE5, - - // Red Trampoline - S_REDTRAMPOLINE, - S_REDTRAMPOLINE2, - S_REDTRAMPOLINE3, - S_REDTRAMPOLINE4, - S_REDTRAMPOLINE5, - - // Blue Trampoline - S_BLUETRAMPOLINE, - S_BLUETRAMPOLINE2, - S_BLUETRAMPOLINE3, - S_BLUETRAMPOLINE4, - S_BLUETRAMPOLINE5, - - // Horizontal Yellow Trampoline - S_HORIZYELLOWTRAMPOLINE, - S_HORIZYELLOWTRAMPOLINE2, - S_HORIZYELLOWTRAMPOLINE3, - S_HORIZYELLOWTRAMPOLINE4, - S_HORIZYELLOWTRAMPOLINE5, - - // Horizontal Red Trampoline - S_HORIZREDTRAMPOLINE, - S_HORIZREDTRAMPOLINE2, - S_HORIZREDTRAMPOLINE3, - S_HORIZREDTRAMPOLINE4, - S_HORIZREDTRAMPOLINE5, - - // Horizontal Blue Trampoline - S_HORIZBLUETRAMPOLINE, - S_HORIZBLUETRAMPOLINE2, - S_HORIZBLUETRAMPOLINE3, - S_HORIZBLUETRAMPOLINE4, - S_HORIZBLUETRAMPOLINE5, - - // Diagonal Yellow Trampoline - S_DIAGYELLOWTRAMPOLINE, - S_DIAGYELLOWTRAMPOLINE2, - S_DIAGYELLOWTRAMPOLINE3, - S_DIAGYELLOWTRAMPOLINE4, - S_DIAGYELLOWTRAMPOLINE5, - - // Diagonal Red Trampoline - S_DIAGREDTRAMPOLINE, - S_DIAGREDTRAMPOLINE2, - S_DIAGREDTRAMPOLINE3, - S_DIAGREDTRAMPOLINE4, - S_DIAGREDTRAMPOLINE5, - - // Diagonal Blue Trampoline - S_DIAGBLUETRAMPOLINE, - S_DIAGBLUETRAMPOLINE2, - S_DIAGBLUETRAMPOLINE3, - S_DIAGBLUETRAMPOLINE4, - S_DIAGBLUETRAMPOLINE5, - // Booster S_BOOSTERSOUND, S_YELLOWBOOSTERROLLER, @@ -4689,16 +4617,6 @@ typedef enum mobj_type MT_REDHORIZ, MT_BLUEHORIZ, - MT_YELLOWTRAMPOLINE, - MT_REDTRAMPOLINE, - MT_BLUETRAMPOLINE, - MT_HORIZYELLOWTRAMPOLINE, - MT_HORIZREDTRAMPOLINE, - MT_HORIZBLUETRAMPOLINE, - MT_DIAGYELLOWTRAMPOLINE, - MT_DIAGREDTRAMPOLINE, - MT_DIAGBLUETRAMPOLINE, - MT_BOOSTERSEG, MT_BOOSTERROLLER, MT_YELLOWBOOSTER, From 70df636bb6c8d2468995707264492fd1e7875e4b Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 18 Jan 2025 13:54:32 -0600 Subject: [PATCH 319/353] Revert "Add Evertone to credits and adjust some objs" This reverts commit b91854fa253758dbbb0cdd2a192534c553f7e613. --- src/f_finale.c | 1 - src/info.c | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index ee6491b69..dd85cc6d5 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1163,7 +1163,6 @@ static const char *credits[] = { "Sally \"TehRealSalt\" Cochenour", "Desmond \"Blade\" DesJardins", "Sherman \"CoatRack\" DesJardins", - "\"Evertone\"", // summit showdown hehehehe "Ben \"Mystic\" Geyer", "Nathan \"Jazz\" Giroux", "\"GomaTheMascar\"", diff --git a/src/info.c b/src/info.c index 95cc64135..47cef8656 100644 --- a/src/info.c +++ b/src/info.c @@ -19790,7 +19790,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 16*FRACUNIT, // radius - 48*FRACUNIT, // height + 96*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage @@ -19817,7 +19817,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 16*FRACUNIT, // radius - 48*FRACUNIT, // height + 96*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage @@ -19844,7 +19844,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 16*FRACUNIT, // radius - 48*FRACUNIT, // height + 96*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage @@ -19871,7 +19871,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 16*FRACUNIT, // radius - 48*FRACUNIT, // height + 96*FRACUNIT, // height 0, // display offset 100, // mass 0, // damage @@ -19903,7 +19903,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_SOLID|MF_SCENERY, // flags + MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, From 7062fe394ca22654e3ae565c53e89d7059b28e53 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 18 Jan 2025 13:55:53 -0600 Subject: [PATCH 320/353] Revert "Most Pipe Towers stuff, I'm tired" This reverts commit db5d9053f2dbe37286926ddec791889537526b47. --- src/deh_tables.c | 65 ++--- src/f_finale.c | 2 - src/hardware/hw_light.c | 17 -- src/info.c | 554 ++-------------------------------------- src/info.h | 82 ++---- src/p_enemy.c | 11 +- src/p_setup.c | 4 - src/p_spec.c | 12 - src/sounds.c | 2 - src/sounds.h | 2 - 10 files changed, 63 insertions(+), 688 deletions(-) diff --git a/src/deh_tables.c b/src/deh_tables.c index f0a632f40..509d75dd3 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3192,28 +3192,37 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_RINGEXPLODE", - // Mario-specific stuff - "S_COIN", + "S_COIN1", + "S_COIN2", + "S_COIN3", "S_COINSPARKLE1", "S_COINSPARKLE2", + "S_COINSPARKLE3", + "S_COINSPARKLE4", "S_GOOMBA1", "S_GOOMBA1B", "S_GOOMBA2", "S_GOOMBA3", "S_GOOMBA4", "S_GOOMBA5", + "S_GOOMBA6", + "S_GOOMBA7", + "S_GOOMBA8", + "S_GOOMBA9", "S_GOOMBA_DEAD", - "S_GOOMBA_DEAD2", - "S_GOOMBA_DEAD3", "S_BLUEGOOMBA1", "S_BLUEGOOMBA1B", "S_BLUEGOOMBA2", "S_BLUEGOOMBA3", "S_BLUEGOOMBA4", "S_BLUEGOOMBA5", + "S_BLUEGOOMBA6", + "S_BLUEGOOMBA7", + "S_BLUEGOOMBA8", + "S_BLUEGOOMBA9", "S_BLUEGOOMBA_DEAD", - "S_BLUEGOOMBA_DEAD2", - "S_BLUEGOOMBA_DEAD3", + + // Mario-specific stuff "S_FIREFLOWER1", "S_FIREFLOWER2", "S_FIREFLOWER3", @@ -3221,13 +3230,6 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_FIREBALL", "S_FIREBALLTRAIL1", "S_FIREBALLTRAIL2", - "S_GREENKOOPASPAWN", - "S_GREENKOOPA1", - "S_GREENKOOPA2", - "S_GREENKOOPA3", - "S_GREENKOOPA4", - "S_GREENKOOPADEATH1", - "S_GREENKOOPADEATH2", "S_SHELL", "S_PUMA_START1", "S_PUMA_START2", @@ -3253,21 +3255,6 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_MARIOBUSH1", "S_MARIOBUSH2", "S_TOAD", - "S_PTZSHROOM", - "S_PTZFLAG1", - "S_PTZFLAG2", - "S_PTZFLAG3", - "S_PTZFLAG4", - "S_PTZFLAG5", - "S_MARIOBUSH", - "S_BSBSHROOM", - "S_BLBSHROOM", - "S_BNWSHROOM", - "S_REDMFLOWER", - "S_BLUEMFLOWER", - "S_YELLOWMFLOWER", - "S_WHITEDANDELION", - "S_MAR64TREE", // Nights-specific stuff "S_NIGHTSDRONE_MAN1", @@ -3570,11 +3557,6 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_REDBRICKDEBRIS", "S_BLUEBRICKDEBRIS", "S_YELLOWBRICKDEBRIS", - "S_MARIOBRICKDEBRIS", - "S_MARIOBRICKDEBRISS", - "S_MARIOBRICKDEBRISB", - "S_MARIOBRICKDEBRISC", - "S_MARIOBRICKDEBRISM", "S_NAMECHECK", @@ -4257,7 +4239,6 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_FIREFLOWER", "MT_FIREBALL", "MT_FIREBALLTRAIL", - "MT_GREENKOOPA", "MT_SHELL", "MT_PUMA", "MT_PUMATRAIL", @@ -4268,17 +4249,6 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_MARIOBUSH1", "MT_MARIOBUSH2", "MT_TOAD", - "MT_PTZSHROOM", - "MT_PTZFLAG", - "MT_BSBSHROOM", - "MT_BLBSHROOM", - "MT_BNWSHROOM", - "MT_MARIOBUSH", - "MT_REDMFLOWER", - "MT_BLUEMFLOWER", - "MT_YELLOWMFLOWER", - "MT_WHITEDANDELION", - "MT_MAR64TREE", // NiGHTS Stuff "MT_AXIS", @@ -4376,11 +4346,6 @@ const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity t "MT_REDBRICKDEBRIS", "MT_BLUEBRICKDEBRIS", "MT_YELLOWBRICKDEBRIS", - "MT_MARIOBRICKDEBRIS", - "MT_MARIOBRICKDEBRISS", - "MT_MARIOBRICKDEBRISB", - "MT_MARIOBRICKDEBRISC", - "MT_MARIOBRICKDEBRISM", "MT_NAMECHECK", "MT_RAY", diff --git a/src/f_finale.c b/src/f_finale.c index dd85cc6d5..4d117ca95 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1125,7 +1125,6 @@ static const char *credits[] = { "\"MotorRoach\"", "Phillip \"TelosTurntable\" Robinson", "\"Scizor300\"", - "\"Skydusk\"", "Wessel \"sphere\" Smit", "David \"Instant Sonic\" Spencer Jr.", "\"SSNTails\"", @@ -1176,7 +1175,6 @@ static const char *credits[] = { "\"Radicalicious\"", "\"Revan\"", "Anna \"QueenDelta\" Sandlin", - "\"Skydusk\"", "Wessel \"sphere\" Smit", "\"SSNTails\"", "Aaron \"Othius\" Stojkov", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 9d6bdc910..9011ff05e 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -543,7 +543,6 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_BGOM &lspr[REDBALL_L], // SPR_FFWR &lspr[SMALLREDBALL_L], // SPR_FBLL - &lspr[NOLIGHT], // SPR_MKOP &lspr[NOLIGHT], // SPR_SHLL &lspr[REDBALL_L], // SPR_PUMA &lspr[NOLIGHT], // SPR_HAMM @@ -614,22 +613,6 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_BRIR &lspr[NOLIGHT], // SPR_BRIB &lspr[NOLIGHT], // SPR_BRIY - &lspr[NOLIGHT], // SPR_MBRI - &lspr[NOLIGHT], // SPR_MBRS - &lspr[NOLIGHT], // SPR_MBRB - &lspr[NOLIGHT], // SPR_MBRC - &lspr[NOLIGHT], // SPR_MTRI - &lspr[NOLIGHT], // SPR_MARS - &lspr[NOLIGHT], // SPR_MRFL - &lspr[NOLIGHT], // SPR_MAUH - &lspr[NOLIGHT], // SPR_MBSA - &lspr[NOLIGHT], // SPR_MBSB - &lspr[NOLIGHT], // SPR_MBSC - &lspr[NOLIGHT], // SPR_MFRE - &lspr[NOLIGHT], // SPR_MFYE - &lspr[NOLIGHT], // SPR_MFBE - &lspr[NOLIGHT], // SPR_MFWD - &lspr[NOLIGHT], // SPR_MUS3 // Gravity Well Objects &lspr[NOLIGHT], // SPR_GWLG diff --git a/src/info.c b/src/info.c index 47cef8656..26d5d805b 100644 --- a/src/info.c +++ b/src/info.c @@ -454,7 +454,6 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "BGOM", "FFWR", "FBLL", - "MKOP", "SHLL", "PUMA", "HAMM", @@ -464,17 +463,6 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "MUS1", "MUS2", "TOAD", - "MARS", - "MRFL", - "MAUH", - "MBSA", - "MBSB", - "MBSC", - "MFRE", - "MFYE", - "MFBE", - "MFWD", - "MUS3", // NiGHTS Stuff "NDRN", // NiGHTS drone @@ -536,11 +524,6 @@ char sprnames[NUMSPRITES + 1][MAXSPRITENAME + 1] = "BRIR", // CEZ3 colored bricks "BRIB", // CEZ3 colored bricks "BRIY", // CEZ3 colored bricks - "MBRI", - "MBRS", - "MBRB", - "MBRC", - "MTRI", // Gravity Well Objects "GWLG", @@ -3628,33 +3611,41 @@ state_t states[NUMSTATES] = {SPR_NULL, 0, 1, {A_RingExplode}, 0, 0, S_XPLD1, 0}, // S_RINGEXPLODE // Coin - {SPR_COIN, FF_ANIMATE, 32, {NULL}, 15, 2, S_COIN, 0}, // S_COIN + {SPR_COIN, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_COIN2, 0}, // S_COIN1 + {SPR_COIN, FF_FULLBRIGHT|1, 5, {NULL}, 0, 0, S_COIN3, 0}, // S_COIN2 + {SPR_COIN, FF_FULLBRIGHT|2, 5, {NULL}, 0, 0, S_COIN1, 0}, // S_COIN3 // Coin Sparkle - {SPR_CPRK, 1|FF_FULLBRIGHT|FF_TRANS30|FF_ADD, 2, {A_ForceStop}, 0, 0, S_COINSPARKLE2, 0}, // S_COINSPARKLE1 - {SPR_CPRK, 2|FF_FULLBRIGHT|FF_ANIMATE|FF_TRANS30|FF_ADD, 20, {NULL}, 9, 2, S_NULL, 0}, // S_COINSPARKLE2 + {SPR_CPRK, FF_FULLBRIGHT, 5, {NULL}, 0, 0, S_COINSPARKLE2, 0}, // S_COINSPARKLE1 + {SPR_CPRK, FF_FULLBRIGHT|1, 5, {NULL}, 0, 0, S_COINSPARKLE3, 0}, // S_COINSPARKLE2 + {SPR_CPRK, FF_FULLBRIGHT|2, 5, {NULL}, 0, 0, S_COINSPARKLE4, 0}, // S_COINSPARKLE3 + {SPR_CPRK, FF_FULLBRIGHT|3, 5, {NULL}, 0, 0, S_NULL, 0}, // S_COINSPARKLE4 // Goomba {SPR_GOOM, 0, 6, {A_Look}, 0, 0, S_GOOMBA1B, 0}, // S_GOOMBA1 {SPR_GOOM, 1, 6, {A_Look}, 0, 0, S_GOOMBA1, 0}, // S_GOOMBA1B - {SPR_GOOM, 0, 6, {A_Chase}, 0, 0, S_GOOMBA3, 0}, // S_GOOMBA2 - {SPR_GOOM, 1, 6, {A_Chase}, 0, 0, S_GOOMBA4, 0}, // S_GOOMBA3 - {SPR_GOOM, 2, 6, {A_Chase}, 0, 0, S_GOOMBA5, 0}, // S_GOOMBA4 - {SPR_GOOM, 3, 6, {A_Chase}, 0, 0, S_GOOMBA2, 0}, // S_GOOMBA5 - {SPR_GOOM, 4, 8, {A_Scream}, 0, 0, S_GOOMBA_DEAD2, 0}, // S_GOOMBA_DEAD - {SPR_GOOM, 5, 4, {NULL}, 0, 0, S_GOOMBA_DEAD3, 0}, // S_GOOMBA_DEAD2 - {SPR_GOOM, 4, 15, {NULL}, 0, 0, S_NULL, 0}, // S_GOOMBA_DEAD3 + {SPR_GOOM, 0, 3, {A_Chase}, 0, 0, S_GOOMBA3, 0}, // S_GOOMBA2 + {SPR_GOOM, 0, 3, {A_Chase}, 0, 0, S_GOOMBA4, 0}, // S_GOOMBA3 + {SPR_GOOM, 1, 3, {A_Chase}, 0, 0, S_GOOMBA5, 0}, // S_GOOMBA4 + {SPR_GOOM, 1, 3, {A_Chase}, 0, 0, S_GOOMBA6, 0}, // S_GOOMBA5 + {SPR_GOOM, 0, 3, {A_Chase}, 0, 0, S_GOOMBA7, 0}, // S_GOOMBA6 + {SPR_GOOM, 0, 3, {A_Chase}, 0, 0, S_GOOMBA8, 0}, // S_GOOMBA7 + {SPR_GOOM, 1, 3, {A_Chase}, 0, 0, S_GOOMBA9, 0}, // S_GOOMBA8 + {SPR_GOOM, 1, 3, {A_Chase}, 0, 0, S_GOOMBA2, 0}, // S_GOOMBA9 + {SPR_GOOM, 2, 16, {A_Scream}, 0, 0, S_NULL, 0}, // S_GOOMBA_DEAD // Blue Goomba {SPR_BGOM, 0, 6, {A_Look}, 0, 0, S_BLUEGOOMBA1B, 0}, // S_BLUEGOOMBA1 {SPR_BGOM, 1, 6, {A_Look}, 0, 0, S_BLUEGOOMBA1, 0}, // S_BLUEGOOMBA1B - {SPR_BGOM, 0, 6, {A_Chase}, 0, 0, S_BLUEGOOMBA3, 0}, // S_BLUEGOOMBA2 - {SPR_BGOM, 1, 6, {A_Chase}, 0, 0, S_BLUEGOOMBA4, 0}, // S_BLUEGOOMBA3 - {SPR_BGOM, 2, 6, {A_Chase}, 0, 0, S_BLUEGOOMBA5, 0}, // S_BLUEGOOMBA4 - {SPR_BGOM, 3, 6, {A_Chase}, 0, 0, S_BLUEGOOMBA2, 0}, // S_BLUEGOOMBA5 - {SPR_BGOM, 4, 8, {A_Scream}, 0, 0, S_BLUEGOOMBA_DEAD2, 0}, // S_BLUEGOOMBA_DEAD - {SPR_BGOM, 5, 4, {NULL}, 0, 0, S_BLUEGOOMBA_DEAD3, 0}, // S_BLUEGOOMBA_DEAD2 - {SPR_BGOM, 4, 15, {NULL}, 0, 0, S_NULL, 0}, // S_BLUEGOOMBA_DEAD3 + {SPR_BGOM, 0, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA3, 0}, // S_BLUEGOOMBA2 + {SPR_BGOM, 0, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA4, 0}, // S_BLUEGOOMBA3 + {SPR_BGOM, 1, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA5, 0}, // S_BLUEGOOMBA4 + {SPR_BGOM, 1, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA6, 0}, // S_BLUEGOOMBA5 + {SPR_BGOM, 0, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA7, 0}, // S_BLUEGOOMBA6 + {SPR_BGOM, 0, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA8, 0}, // S_BLUEGOOMBA7 + {SPR_BGOM, 1, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA9, 0}, // S_BLUEGOOMBA8 + {SPR_BGOM, 1, 3, {A_Chase}, 0, 0, S_BLUEGOOMBA2, 0}, // S_BLUEGOOMBA9 + {SPR_BGOM, 2, 16, {A_Scream}, 0, 0, S_NULL, 0}, // S_BLUEGOOMBA_DEAD // Fire Flower {SPR_FFWR, 0, 3, {NULL}, 0, 0, S_FIREFLOWER2, 0}, // S_FIREFLOWER1 @@ -3667,16 +3658,7 @@ state_t states[NUMSTATES] = {SPR_FBLL, 1|FF_FULLBRIGHT|FF_TRANS50, 1, {A_SetScale}, FRACUNIT*3/4, 0, S_FIREBALLTRAIL2, 0}, // S_FIREBALLTRAIL1 {SPR_FBLL, 1|FF_FULLBRIGHT|FF_TRANS50, 8, {A_SetScale}, FRACUNIT/6, 1, S_NULL, 0}, // S_FIREBALLTRAIL2 - // Green Koopa - {SPR_MKOP, 0, 1, {A_Look}, 0, 0, S_GREENKOOPASPAWN, 0}, // S_GREENKOOPASPAWN - {SPR_MKOP, 0, 5, {A_GuardChase}, 1, 0, S_GREENKOOPA2, 0}, // S_GREENKOOPA1 - {SPR_MKOP, 1, 5, {A_GuardChase}, 1, 0, S_GREENKOOPA3, 0}, // S_GREENKOOPA2 - {SPR_MKOP, 2, 5, {A_GuardChase}, 1, 0, S_GREENKOOPA4, 0}, // S_GREENKOOPA3 - {SPR_MKOP, 3, 5, {A_GuardChase}, 1, 0, S_GREENKOOPA1, 0}, // S_GREENKOOPA4 - {SPR_MKOP, 3, 1, {A_Scream}, 0, 0, S_GREENKOOPADEATH2, 0}, // S_GREENKOOPADEATH1 - {SPR_MKOP, 3, 1, {A_SpawnObjectRelative}, 0|0, 0|MT_SHELL, S_NULL, 0}, // S_GREENKOOPADEATH2 - - // Koopa Shell + // Turtle Shell {SPR_SHLL, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_SHELL // Puma (Mario fireball) @@ -3714,22 +3696,6 @@ state_t states[NUMSTATES] = {SPR_MUS2, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_MARIOBUSH2 {SPR_TOAD, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_TOAD - {SPR_MARS, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_PTZSHROOM - {SPR_MRFL, 0|FF_PAPERSPRITE, 4, {NULL}, 0, 0, S_PTZFLAG2, 0}, // S_PTZFLAG1 - {SPR_MRFL, 1|FF_PAPERSPRITE, 4, {NULL}, 0, 0, S_PTZFLAG3, 0}, // S_PTZFLAG2 - {SPR_MRFL, 2|FF_PAPERSPRITE, 4, {NULL}, 0, 0, S_PTZFLAG4, 0}, // S_PTZFLAG3 - {SPR_MRFL, 3|FF_PAPERSPRITE, 4, {NULL}, 0, 0, S_PTZFLAG5, 0}, // S_PTZFLAG4 - {SPR_MRFL, 4|FF_PAPERSPRITE, 4, {NULL}, 0, 0, S_PTZFLAG1, 0}, // S_PTZFLAG5 - {SPR_MAUH, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL, 0}, // S_MARIOBUSH - {SPR_MBSA, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BSBSHROOM - {SPR_MBSB, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BLBSHROOM - {SPR_MBSC, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_BNWSHROOM - {SPR_MFRE, FF_ANIMATE, -1, {NULL}, 3, 4, S_NULL, 0}, // S_REDMFLOWER - {SPR_MFBE, FF_ANIMATE, -1, {NULL}, 3, 4, S_NULL, 0}, // S_BLUEMFLOWER - {SPR_MFYE, FF_ANIMATE, -1, {NULL}, 3, 4, S_NULL, 0}, // S_YELLOWMFLOWER - {SPR_MFWD, FF_ANIMATE, -1, {NULL}, 3, 6, S_NULL, 0}, // S_WHITEDANDELION - {SPR_MUS3, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_MAR64TREE - // Nights Drone {SPR_NDRN, 0, -1, {NULL}, 0, 0, S_NIGHTSDRONE_MAN2, 0}, // S_NIGHTSDRONE_MAN1 {SPR_NDRN, 0, -1, {NULL}, 0, 0, S_NIGHTSDRONE_MAN1, 0}, // S_NIGHTSDRONE_MAN2 @@ -4042,11 +4008,6 @@ state_t states[NUMSTATES] = {SPR_BRIR, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 31, 1, S_NULL, 0}, // S_REDBRICKDEBRIS {SPR_BRIB, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 31, 1, S_NULL, 0}, // S_BLUEBRICKDEBRIS {SPR_BRIY, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 31, 1, S_NULL, 0}, // S_YELLOWBRICKDEBRIS - {SPR_MBRI, FF_ANIMATE, 50, {NULL}, 9, 2, S_NULL, 0}, // S_MARIOBRICKDEBRIS - {SPR_MBRS, FF_ANIMATE, 50, {NULL}, 9, 2, S_NULL, 0}, // S_MARIOBRICKDEBRISS - {SPR_MBRB, FF_ANIMATE, 50, {NULL}, 9, 2, S_NULL, 0}, // S_MARIOBRICKDEBRISB - {SPR_MBRC, FF_ANIMATE, 50, {NULL}, 9, 2, S_NULL, 0}, // S_MARIOBRICKDEBRISC - {SPR_MTRI, FF_ANIMATE, 50, {NULL}, 3, 4, S_NULL, 0}, // S_MARIOBRICKDEBRISM {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL, 0}, // S_NAMECHECK @@ -19127,7 +19088,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_COIN 1800, // doomednum - S_COIN, // spawnstate + S_COIN1, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -19154,7 +19115,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_FLINGCOIN -1, // doomednum - S_COIN, // spawnstate + S_COIN1, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -19314,33 +19275,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_GREENKOOPA - 1832, // doomednum - S_GREENKOOPASPAWN, // spawnstate - 1, // spawnhealth - S_GREENKOOPA1, // seestate - sfx_None, // seesound - 1, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_GREENKOOPADEATH1, // deathstate - S_NULL, // xdeathstate - sfx_mario2, // deathsound - 12, // speed - 16*FRACUNIT, // radius - 48*FRACUNIT, // height - 0, // display offset - 100, // mass - 1, // damage - sfx_mario1, // activesound - MF_SPECIAL|MF_SHOOTABLE|MF_BOUNCE, // flags - S_NULL // raisestate - }, - { // MT_SHELL 1804, // doomednum S_SHELL, // spawnstate @@ -19610,303 +19544,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_PTZSHROOM - 1811, // doomednum - S_PTZSHROOM, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 96*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_PTZFLAG - 1812, // doomednum - S_PTZFLAG1, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 96*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_MARIOBUSH - 1819, // doomednum - S_MARIOBUSH, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 96*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_BSBSHROOM - 1820, // doomednum - S_BSBSHROOM, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 96*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_BLBSHROOM - 1821, // doomednum - S_BLBSHROOM, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 96*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_BNWSHROOM - 1822, // doomednum - S_BNWSHROOM, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 96*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_REDMFLOWER - 1823, // doomednum - S_REDMFLOWER, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 96*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_BLUEMFLOWER - 1842, // doomednum - S_BLUEMFLOWER, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 96*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_YELLOWMFLOWER - 1824, // doomednum - S_YELLOWMFLOWER,// spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 96*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_WHITEDANDELION - 1840, // doomednum - S_WHITEDANDELION, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 96*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_MAR64TREE - 1847, // doomednum - S_MAR64TREE, // spawnstate - 1000, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 8, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 0, // speed - 16*FRACUNIT, // radius - 150*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_None, // activesound - MF_NOCLIP|MF_SCENERY, // flags - S_NULL // raisestate - }, - { // MT_AXIS 1700, // doomednum S_INVISIBLE, // spawnstate @@ -22123,141 +21760,6 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_MARIOBRICKDEBRIS - -1, // doomednum - S_MARIOBRICKDEBRIS, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 35, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 6, // speed - 16*FRACUNIT, // radius - 48*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_marioc, // activesound - MF_NOCLIPHEIGHT|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_MARIOBRICKDEBRISS - -1, // doomednum - S_MARIOBRICKDEBRISS, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 35, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 6, // speed - 16*FRACUNIT, // radius - 48*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_marioc, // activesound - MF_NOCLIPHEIGHT|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_MARIOBRICKDEBRISB - -1, // doomednum - S_MARIOBRICKDEBRISB, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 35, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 6, // speed - 16*FRACUNIT, // radius - 48*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_marioc, // activesound - MF_NOCLIPHEIGHT|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_MARIOBRICKDEBRISC - -1, // doomednum - S_MARIOBRICKDEBRISC, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 35, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 6, // speed - 16*FRACUNIT, // radius - 48*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_marioc, // activesound - MF_NOCLIPHEIGHT|MF_SCENERY, // flags - S_NULL // raisestate - }, - - { // MT_MARIOBRICKDEBRISM - -1, // doomednum - S_MARIOBRICKDEBRISM, // spawnstate - 1, // spawnhealth - S_NULL, // seestate - sfx_None, // seesound - 35, // reactiontime - sfx_None, // attacksound - S_NULL, // painstate - 0, // painchance - sfx_None, // painsound - S_NULL, // meleestate - S_NULL, // missilestate - S_NULL, // deathstate - S_NULL, // xdeathstate - sfx_None, // deathsound - 6, // speed - 16*FRACUNIT, // radius - 48*FRACUNIT, // height - 0, // display offset - 100, // mass - 0, // damage - sfx_marioc, // activesound - MF_NOCLIPHEIGHT|MF_SCENERY, // flags - S_NULL // raisestate - }, - { // MT_NAMECHECK -1, // doomednum S_NAMECHECK, // spawnstate diff --git a/src/info.h b/src/info.h index 5f49c88a3..d9aff0cbe 100644 --- a/src/info.h +++ b/src/info.h @@ -1005,7 +1005,6 @@ typedef enum sprite SPR_BGOM, SPR_FFWR, SPR_FBLL, - SPR_MKOP, SPR_SHLL, SPR_PUMA, SPR_HAMM, @@ -1015,17 +1014,6 @@ typedef enum sprite SPR_MUS1, SPR_MUS2, SPR_TOAD, - SPR_MARS, - SPR_MRFL, - SPR_MAUH, - SPR_MBSA, - SPR_MBSB, - SPR_MBSC, - SPR_MFRE, - SPR_MFYE, - SPR_MFBE, - SPR_MFWD, - SPR_MUS3, // NiGHTS Stuff SPR_NDRN, // NiGHTS drone @@ -1087,11 +1075,6 @@ typedef enum sprite SPR_BRIR, // CEZ3 colored bricks SPR_BRIB, SPR_BRIY, - SPR_MBRI, - SPR_MBRS, - SPR_MBRB, - SPR_MBRC, - SPR_MTRI, // Gravity Well Objects SPR_GWLG, @@ -4031,28 +4014,37 @@ typedef enum state S_RINGEXPLODE, - // Mario-specific stuff - S_COIN, + S_COIN1, + S_COIN2, + S_COIN3, S_COINSPARKLE1, S_COINSPARKLE2, + S_COINSPARKLE3, + S_COINSPARKLE4, S_GOOMBA1, S_GOOMBA1B, S_GOOMBA2, S_GOOMBA3, S_GOOMBA4, S_GOOMBA5, + S_GOOMBA6, + S_GOOMBA7, + S_GOOMBA8, + S_GOOMBA9, S_GOOMBA_DEAD, - S_GOOMBA_DEAD2, - S_GOOMBA_DEAD3, S_BLUEGOOMBA1, S_BLUEGOOMBA1B, S_BLUEGOOMBA2, S_BLUEGOOMBA3, S_BLUEGOOMBA4, S_BLUEGOOMBA5, + S_BLUEGOOMBA6, + S_BLUEGOOMBA7, + S_BLUEGOOMBA8, + S_BLUEGOOMBA9, S_BLUEGOOMBA_DEAD, - S_BLUEGOOMBA_DEAD2, - S_BLUEGOOMBA_DEAD3, + + // Mario-specific stuff S_FIREFLOWER1, S_FIREFLOWER2, S_FIREFLOWER3, @@ -4060,13 +4052,6 @@ typedef enum state S_FIREBALL, S_FIREBALLTRAIL1, S_FIREBALLTRAIL2, - S_GREENKOOPASPAWN, - S_GREENKOOPA1, - S_GREENKOOPA2, - S_GREENKOOPA3, - S_GREENKOOPA4, - S_GREENKOOPADEATH1, - S_GREENKOOPADEATH2, S_SHELL, S_PUMA_START1, S_PUMA_START2, @@ -4092,21 +4077,6 @@ typedef enum state S_MARIOBUSH1, S_MARIOBUSH2, S_TOAD, - S_PTZSHROOM, - S_PTZFLAG1, - S_PTZFLAG2, - S_PTZFLAG3, - S_PTZFLAG4, - S_PTZFLAG5, - S_MARIOBUSH, - S_BSBSHROOM, - S_BLBSHROOM, - S_BNWSHROOM, - S_REDMFLOWER, - S_BLUEMFLOWER, - S_YELLOWMFLOWER, - S_WHITEDANDELION, - S_MAR64TREE, // Nights-specific stuff S_NIGHTSDRONE_MAN1, @@ -4409,11 +4379,6 @@ typedef enum state S_REDBRICKDEBRIS, // for CEZ3 S_BLUEBRICKDEBRIS, // for CEZ3 S_YELLOWBRICKDEBRIS, // for CEZ3 - S_MARIOBRICKDEBRIS, - S_MARIOBRICKDEBRISS, - S_MARIOBRICKDEBRISB, - S_MARIOBRICKDEBRISC, - S_MARIOBRICKDEBRISM, S_NAMECHECK, @@ -5117,7 +5082,6 @@ typedef enum mobj_type MT_FIREFLOWER, MT_FIREBALL, MT_FIREBALLTRAIL, - MT_GREENKOOPA, MT_SHELL, MT_PUMA, MT_PUMATRAIL, @@ -5128,17 +5092,6 @@ typedef enum mobj_type MT_MARIOBUSH1, MT_MARIOBUSH2, MT_TOAD, - MT_PTZSHROOM, - MT_PTZFLAG, - MT_BSBSHROOM, - MT_BLBSHROOM, - MT_BNWSHROOM, - MT_MARIOBUSH, - MT_REDMFLOWER, - MT_BLUEMFLOWER, - MT_YELLOWMFLOWER, - MT_WHITEDANDELION, - MT_MAR64TREE, // NiGHTS Stuff MT_AXIS, @@ -5236,11 +5189,6 @@ typedef enum mobj_type MT_REDBRICKDEBRIS, // for CEZ3 MT_BLUEBRICKDEBRIS, // for CEZ3 MT_YELLOWBRICKDEBRIS, // for CEZ3 - MT_MARIOBRICKDEBRIS, - MT_MARIOBRICKDEBRISS, - MT_MARIOBRICKDEBRISB, - MT_MARIOBRICKDEBRISC, - MT_MARIOBRICKDEBRISM, MT_NAMECHECK, MT_RAY, // General purpose mobj diff --git a/src/p_enemy.c b/src/p_enemy.c index 9ebd32069..60cffebfc 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -7837,14 +7837,13 @@ void A_BuzzFly(mobj_t *actor) // Function: A_GuardChase // -// Description: Modified A_Chase for Egg Guard and Koopa Troopas +// Description: Modified A_Chase for Egg Guard // -// var1 = shield (0) or no shield (1) +// var1 = unused // var2 = unused // void A_GuardChase(mobj_t *actor) { - INT32 locvar1 = var1; INT32 delta; if (LUA_CallAction(A_GUARDCHASE, actor)) @@ -7853,11 +7852,11 @@ void A_GuardChase(mobj_t *actor) if (actor->reactiontime) actor->reactiontime--; - if (actor->threshold != 42 || locvar1 == 1) // In formation... + if (actor->threshold != 42) // In formation... { fixed_t speed; - if ((!actor->tracer || !actor->tracer->health) && locvar1 == 0) + if (!actor->tracer || !actor->tracer->health) { P_SetTarget(&actor->tracer, NULL); actor->threshold = 42; @@ -7946,7 +7945,7 @@ void A_GuardChase(mobj_t *actor) // Now that we've moved, its time for our shield to move! // Otherwise it'll never act as a proper overlay. if (actor->tracer && actor->tracer->state - && actor->tracer->state->action.acp1 && locvar1 == 0) + && actor->tracer->state->action.acp1) { var1 = actor->tracer->state->var1, var2 = actor->tracer->state->var2; actor->tracer->state->action.acp1(actor->tracer); diff --git a/src/p_setup.c b/src/p_setup.c index 04d4b7728..c2b8f2db2 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -5866,10 +5866,6 @@ static void P_ConvertBinaryLinedefTypes(void) lines[i].args[0] = tag; lines[i].args[1] = !!(lines[i].flags & ML_NOCLIMB); break; - case 465: // Bounce Player (purely for backwards compatibility with new Pipe Towers) - lines[i].args[0] = (FixedHypot(lines[i].dx, lines[i].dy) / 8) >> FRACBITS; - lines[i].special = 430; - break; case 466: //Set level failure state lines[i].args[0] = !!(lines[i].flags & ML_NOCLIMB); break; diff --git a/src/p_spec.c b/src/p_spec.c index e402180fe..7d53c4ba8 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2702,18 +2702,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) EV_DoCrush(line->args[0], line, crushBothOnce); break; - case 430: // Bounce Player - if (mo && mo->player) - { - P_SetObjectMomZ(mo, line->args[0]*FRACUNIT, false); - S_StartSound(NULL, sfx_s3k8a); - mo->player->pflags |= PF_JUMPED; - if (skins[mo->player->skin]->flags & SF_NOJUMPSPIN) - P_SetMobjState(mo, S_PLAY_SPRING); - else - P_SetMobjState(mo, S_PLAY_JUMP); - } - break; case 432: // Enable/Disable 2D Mode if (mo && mo->player) { diff --git a/src/sounds.c b/src/sounds.c index 75bccb396..19b69dd28 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -284,8 +284,6 @@ sfxinfo_t S_sfx[NUMSFX] = {"mario8", false, 48, SF_X4AWAYSOUND, -1, NULL, 0, -1, -1, LUMPERROR, "Hurt"}, {"mario9", true, 120, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Emerging power-up"}, {"marioa", true, 192, 0, -1, NULL, 0, -1, -1, LUMPERROR, "One-up"}, - {"mariob", true, 127, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Spring"}, - {"marioc", true, 127, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Crumbling"}, {"thwomp", true, 127, SF_X4AWAYSOUND, -1, NULL, 0, -1, -1, LUMPERROR, "Thwomp"}, // Black Eggman diff --git a/src/sounds.h b/src/sounds.h index a01d192e6..bf9342768 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -332,8 +332,6 @@ typedef enum sfx_mario8, sfx_mario9, sfx_marioa, - sfx_mariob, - sfx_marioc, sfx_thwomp, // Black Eggman From 668a6f75417ab84b4045cc437678673037be3314 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Sat, 18 Jan 2025 14:30:48 -0600 Subject: [PATCH 321/353] Re-add inadvertently removed orbitalviolet credit --- src/f_finale.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/f_finale.c b/src/f_finale.c index 4d117ca95..843c8d59e 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -1121,6 +1121,7 @@ static const char *credits[] = { "Alice \"Alacroix\" de Lemos", "Logan \"Hyperchaotix\" McCloud", "Alexander \"DrTapeworm\" Moench-Ford", + "\"orbitalviolet\"", // summit showdown hehehehe (aka Evertone) "Andrew \"Senku Niola\" Moran", "\"MotorRoach\"", "Phillip \"TelosTurntable\" Robinson", From be9adc3883ff44658dd56b26817154ac1da058a9 Mon Sep 17 00:00:00 2001 From: Lugent <35547583+Lugent@users.noreply.github.com> Date: Sat, 18 Jan 2025 17:05:17 -0400 Subject: [PATCH 322/353] Fix it team scoreboard properly --- src/y_inter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index 331a3da38..1622f6652 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1623,6 +1623,7 @@ static void Y_CalculateMatchWinners(void) boolean completed[MAXPLAYERS]; // Initialize variables + memset(data.match.ctfteam, 0, sizeof (data.match.ctfteam)); memset(data.match.scores, 0, sizeof (data.match.scores)); memset(data.match.color, 0, sizeof (data.match.color)); memset(data.match.character, 0, sizeof (data.match.character)); @@ -1643,8 +1644,12 @@ static void Y_CalculateMatchWinners(void) if (players[i].score >= data.match.scores[data.match.numplayers] && completed[i] == false) { + data.match.ctfteam[data.match.numplayers] = players[i].ctfteam; data.match.scores[data.match.numplayers] = players[i].score; data.match.color[data.match.numplayers] = &players[i].skincolor; + if (data.match.ctfteam[data.match.numplayers] == 1) { data.match.color[data.match.numplayers] = &skincolor_redteam; } // red team + else if (data.match.ctfteam[data.match.numplayers] == 2) { data.match.color[data.match.numplayers] = &skincolor_blueteam; } // blue team + data.match.character[data.match.numplayers] = &players[i].skin; data.match.name[data.match.numplayers] = player_names[i]; data.match.spectator[data.match.numplayers] = players[i].spectator; @@ -1688,7 +1693,6 @@ static void Y_CalculateTimeRaceWinners(void) if (players[i].realtime <= data.match.scores[data.match.numplayers] && completed[i] == false) { - data.match.ctfteam[data.match.numplayers] = players[i].ctfteam; data.match.scores[data.match.numplayers] = players[i].realtime; data.match.color[data.match.numplayers] = &players[i].skincolor; data.match.character[data.match.numplayers] = &players[i].skin; From 3e4df506d0338ca6d7a2ffa86db3fa942fc63a27 Mon Sep 17 00:00:00 2001 From: Lugent <35547583+Lugent@users.noreply.github.com> Date: Sat, 18 Jan 2025 17:22:37 -0400 Subject: [PATCH 323/353] Better formatting --- src/y_inter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 1622f6652..e9905f1de 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1647,8 +1647,11 @@ static void Y_CalculateMatchWinners(void) data.match.ctfteam[data.match.numplayers] = players[i].ctfteam; data.match.scores[data.match.numplayers] = players[i].score; data.match.color[data.match.numplayers] = &players[i].skincolor; - if (data.match.ctfteam[data.match.numplayers] == 1) { data.match.color[data.match.numplayers] = &skincolor_redteam; } // red team - else if (data.match.ctfteam[data.match.numplayers] == 2) { data.match.color[data.match.numplayers] = &skincolor_blueteam; } // blue team + if (data.match.ctfteam[data.match.numplayers] == 1) // red team + data.match.color[data.match.numplayers] = &skincolor_redteam; + + if (data.match.ctfteam[data.match.numplayers] == 2) // blue team + data.match.color[data.match.numplayers] = &skincolor_blueteam; data.match.character[data.match.numplayers] = &players[i].skin; data.match.name[data.match.numplayers] = player_names[i]; From 00c928d930acdee41f57a16e55742e242def8878 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 18 Jan 2025 21:49:02 -0300 Subject: [PATCH 324/353] Fix #1378 --- src/f_finale.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/f_finale.c b/src/f_finale.c index 06db0b44f..119e6daba 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -3658,7 +3658,7 @@ static void F_DrawContinueCharacter(INT32 dx, INT32 dy, UINT8 n) ( HUD_HOOK(continue), luahuddrawlist_continue[n], contPlayers[n], dx, dy, contskins[n]->highresscale, - (INT32)(&contskins[n] - skins), cont_spr2[n][0], cont_spr2[n][1], cont_spr2[n][2] + 1, contColors[n], // add 1 to rotation to convert internal angle numbers (0-7) to WAD editor angle numbers (1-8) + (INT32)(contskins[n]->skinnum), cont_spr2[n][0], cont_spr2[n][1], cont_spr2[n][2] + 1, contColors[n], // add 1 to rotation to convert internal angle numbers (0-7) to WAD editor angle numbers (1-8) imcontinuing ? continuetime : timetonext, imcontinuing ); } @@ -3724,7 +3724,7 @@ void F_ContinueDrawer(void) else if (ncontinues > 10) { if (!(continuetime & 1) || continuetime > 17) - V_DrawContinueIcon(x, 68, 0, (INT32)(&contskins[0] - skins), contColors[0]); + V_DrawContinueIcon(x, 68, 0, contskins[0]->skinnum, contColors[0]); V_DrawScaledPatch(x+12, 66, 0, stlivex); V_DrawRightAlignedString(x+38, 64, 0, va("%d",(imcontinuing ? ncontinues-1 : ncontinues))); @@ -3738,7 +3738,7 @@ void F_ContinueDrawer(void) { if (i == (ncontinues/2) && ((continuetime & 1) || continuetime > 17)) continue; - V_DrawContinueIcon(x - (i*30), 68, 0, (INT32)(&contskins[0] - skins), contColors[0]); + V_DrawContinueIcon(x - (i*30), 68, 0, contskins[0]->skinnum, contColors[0]); } x = BASEVIDWIDTH>>1; } From f86a7382a66c6b2650f900fa23d59190e5cfe323 Mon Sep 17 00:00:00 2001 From: Krabs <> Date: Thu, 24 Aug 2023 22:20:13 -0400 Subject: [PATCH 325/353] Use SPR_PLAY for all npc player boss/cameo objects --- src/d_main.c | 2 +- src/d_player.h | 17 ++-- src/deh_tables.c | 10 +- src/info.c | 258 +++++++++++++++++++++++++---------------------- src/info.h | 21 +++- src/p_mobj.c | 47 +++++---- src/p_user.c | 3 + src/r_things.c | 4 +- 8 files changed, 205 insertions(+), 157 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index bb7420299..d75a4d501 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1179,7 +1179,7 @@ static void IdentifyVersion(void) // Add the maps D_AddFile(&startupwadfiles, va(pandf,srb2waddir, "zones.pk3")); - // Add the players + // Add the characters D_AddFile(&startupwadfiles, va(pandf,srb2waddir, "characters.pk3")); #ifdef USE_PATCH_DTA diff --git a/src/d_player.h b/src/d_player.h index 5f5bf53d6..2c4da74d0 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -45,14 +45,15 @@ typedef enum SF_MARIODAMAGE = SF_NOJUMPDAMAGE|SF_STOMPDAMAGE, // The Mario method of being able to damage enemies, etc. SF_MACHINE = 1<<10, // Beep boop. Are you a robot? SF_DASHMODE = 1<<11, // Sonic Advance 2 style top speed increase? - SF_FASTEDGE = 1<<12, // Faster edge teeter? - SF_MULTIABILITY = 1<<13, // Revenge of Final Demo. - SF_NONIGHTSROTATION = 1<<14, // Disable sprite rotation for NiGHTS - 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_NOSHIELDABILITY = 1<<19, // Disable shield abilities + SF_FASTWAIT = 1<<12, // Faster wait animation? + SF_FASTEDGE = 1<<13, // Faster edge teeter? + SF_MULTIABILITY = 1<<14, // Revenge of Final Demo. + SF_NONIGHTSROTATION = 1<<15, // Disable sprite rotation for NiGHTS + SF_NONIGHTSSUPER = 1<<16, // Disable super colors for NiGHTS (if you have SF_SUPER) + SF_NOSUPERSPRITES = 1<<17, // Don't use super sprites while super + SF_NOSUPERJUMPBOOST = 1<<18, // Disable the jump boost given while super (i.e. Knuckles) + SF_CANBUSTWALLS = 1<<19, // Can naturally bust walls on contact? (i.e. Knuckles) + SF_NOSHIELDABILITY = 1<<20, // Disable shield abilities // free up to and including 1<<31 } skinflags_t; diff --git a/src/deh_tables.c b/src/deh_tables.c index 509d75dd3..848642168 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -1081,11 +1081,11 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_FANG_FIRE1", "S_FANG_FIRE2", "S_FANG_FIRE3", - "S_FANG_FIRE4", "S_FANG_FIREREPEAT", "S_FANG_LOBSHOT0", "S_FANG_LOBSHOT1", "S_FANG_LOBSHOT2", + "S_FANG_LOBSHOT3", "S_FANG_WAIT1", "S_FANG_WAIT2", "S_FANG_WALLHIT", @@ -1107,6 +1107,7 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_FANG_PINCHLOBSHOT2", "S_FANG_PINCHLOBSHOT3", "S_FANG_PINCHLOBSHOT4", + "S_FANG_PINCHLOBSHOT5", "S_FANG_DIE1", "S_FANG_DIE2", "S_FANG_DIE3", @@ -2256,11 +2257,9 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi // FHZ "S_FHZICE1", "S_FHZICE2", - "S_ROSY_IDLE1", - "S_ROSY_IDLE2", - "S_ROSY_IDLE3", - "S_ROSY_IDLE4", + "S_ROSY_IDLE", "S_ROSY_JUMP", + "S_ROSY_FALL", "S_ROSY_WALK", "S_ROSY_HUG", "S_ROSY_PAIN", @@ -5258,6 +5257,7 @@ struct int_const_s const INT_CONST[] = { {"SF_MARIODAMAGE",SF_MARIODAMAGE}, {"SF_MACHINE",SF_MACHINE}, {"SF_DASHMODE",SF_DASHMODE}, + {"SF_FASTWAIT",SF_FASTWAIT}, {"SF_FASTEDGE",SF_FASTEDGE}, {"SF_MULTIABILITY",SF_MULTIABILITY}, {"SF_NONIGHTSROTATION",SF_NONIGHTSROTATION}, diff --git a/src/info.c b/src/info.c index 26d5d805b..235d97c3b 100644 --- a/src/info.c +++ b/src/info.c @@ -600,6 +600,17 @@ char spr2names[NUMPLAYERSPRITES][MAXSPRITENAME + 1] = "TALB", "TALC", + "MSC0", + "MSC1", + "MSC2", + "MSC3", + "MSC4", + "MSC5", + "MSC6", + "MSC7", + "MSC8", + "MSC9", + "CNT1", "CNT2", "CNT3", @@ -683,6 +694,17 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = { SPR2_SPNG, // SPR2_CNT3, SPR2_CNT1, // SPR2_CNT4, + 0, // SPR2_MSC0, + 0, // SPR2_MSC1, + 0, // SPR2_MSC2, + 0, // SPR2_MSC3, + 0, // SPR2_MSC4, + 0, // SPR2_MSC5, + 0, // SPR2_MSC6, + 0, // SPR2_MSC7, + 0, // SPR2_MSC8, + 0, // SPR2_MSC9, + 0, // SPR2_SIGN, 0, // SPR2_LIFE, @@ -716,7 +738,7 @@ state_t states[NUMSTATES] = // Player {SPR_PLAY, SPR2_STND|FF_ANIMATE, 105, {NULL}, 0, 7, S_PLAY_WAIT, 0}, // S_PLAY_STND - {SPR_PLAY, SPR2_WAIT|FF_ANIMATE, -1, {NULL}, 0, 16, S_NULL, 0}, // S_PLAY_WAIT + {SPR_PLAY, SPR2_WAIT, 16, {NULL}, 0, 0, S_PLAY_WAIT, 0}, // S_PLAY_WAIT {SPR_PLAY, SPR2_WALK, 4, {NULL}, 0, 0, S_PLAY_WALK, 0}, // S_PLAY_WALK {SPR_PLAY, SPR2_SKID, 1, {NULL}, 0, 0, S_PLAY_WALK, 0}, // S_PLAY_SKID {SPR_PLAY, SPR2_RUN , 2, {NULL}, 0, 0, S_PLAY_RUN, 0}, // S_PLAY_RUN @@ -1375,116 +1397,117 @@ state_t states[NUMSTATES] = // Boss 5 {SPR_NULL, 0, 2, {A_CheckFlags2}, MF2_AMBUSH, S_FANG_IDLE0, S_FANG_INTRO0, 0}, // S_FANG_SETUP - {SPR_NULL, 0, 2, {NULL}, 0, 0, S_FANG_INTRO1, 0}, // S_FANG_INTRO0 - {SPR_NULL, 0, 2, {A_Boss5MakeJunk}, -S_FANG_CLONE1, 0, S_FANG_INTRO2, 0}, // S_FANG_INTRO1 - {SPR_NULL, 0, 0, {A_Repeat}, 25, S_FANG_INTRO1, S_FANG_INTRO3, 0}, // S_FANG_INTRO2 - {SPR_NULL, 0, 0, {A_Boss5MakeJunk}, 0, 1, S_FANG_INTRO4, 0}, // S_FANG_INTRO3 - {SPR_FANG, 30, 1, {A_ZThrust}, 9, (1<<16)|1, S_FANG_INTRO5, 0}, // S_FANG_INTRO4 - {SPR_FANG, 27, 1, {A_Boss5CheckOnGround}, S_FANG_INTRO9, 0, S_FANG_INTRO6, 0}, // S_FANG_INTRO5 - {SPR_FANG, 28, 1, {A_Boss5CheckOnGround}, S_FANG_INTRO9, 0, S_FANG_INTRO7, 0}, // S_FANG_INTRO6 - {SPR_FANG, 29, 1, {A_Boss5CheckOnGround}, S_FANG_INTRO9, 0, S_FANG_INTRO8, 0}, // S_FANG_INTRO7 - {SPR_FANG, 30, 1, {A_Boss5CheckOnGround}, S_FANG_INTRO9, 0, S_FANG_INTRO5, 0}, // S_FANG_INTRO8 - {SPR_FANG, 23|FF_ANIMATE, 50, {NULL}, 1, 4, S_FANG_INTRO10, 0}, // S_FANG_INTRO9 - {SPR_FANG, 25, 5, {NULL}, 0, 0, S_FANG_INTRO11, 0}, // S_FANG_INTRO10 - {SPR_FANG, 26, 2, {A_Boss5MakeJunk}, S_BROKENROBOTD, 2, S_FANG_INTRO12, 0}, // S_FANG_INTRO11 - {SPR_FANG, 31|FF_ANIMATE, 50, {NULL}, 3, 4, S_FANG_IDLE1, 0}, // S_FANG_INTRO12 + {SPR_NULL, 0, 2, {NULL}, 0, 0, S_FANG_INTRO1, 0}, // S_FANG_INTRO0 + {SPR_NULL, 0, 2, {A_Boss5MakeJunk}, -S_FANG_CLONE1, 0, S_FANG_INTRO2, 0}, // S_FANG_INTRO1 + {SPR_NULL, 0, 0, {A_Repeat}, 25, S_FANG_INTRO1, S_FANG_INTRO3, 0}, // S_FANG_INTRO2 + {SPR_NULL, 0, 0, {A_Boss5MakeJunk}, 0, 1, S_FANG_INTRO4, 0}, // S_FANG_INTRO3 + {SPR_PLAY, SPR2_ROLL, 1, {A_ZThrust}, 9, (1<<16)|1, S_FANG_INTRO5, 0}, // S_FANG_INTRO4 + {SPR_PLAY, SPR2_ROLL, 1, {A_Boss5CheckOnGround}, S_FANG_INTRO9, 0, S_FANG_INTRO6, 0}, // S_FANG_INTRO5 + {SPR_PLAY, SPR2_ROLL, 1, {A_Boss5CheckOnGround}, S_FANG_INTRO9, 0, S_FANG_INTRO7, 0}, // S_FANG_INTRO6 + {SPR_PLAY, SPR2_ROLL, 1, {A_Boss5CheckOnGround}, S_FANG_INTRO9, 0, S_FANG_INTRO8, 0}, // S_FANG_INTRO7 + {SPR_PLAY, SPR2_ROLL, 1, {A_Boss5CheckOnGround}, S_FANG_INTRO9, 0, S_FANG_INTRO5, 0}, // S_FANG_INTRO8 + {SPR_PLAY, SPR2_MSC0|FF_ANIMATE, 50, {NULL}, 0, 4, S_FANG_INTRO10, 0}, // S_FANG_INTRO9 + {SPR_PLAY, SPR2_MSC1, 5, {NULL}, 0, 0, S_FANG_INTRO11, 0}, // S_FANG_INTRO10 + {SPR_PLAY, SPR2_MSC2, 2, {A_Boss5MakeJunk}, S_BROKENROBOTD, 2, S_FANG_INTRO12, 0}, // S_FANG_INTRO11 + {SPR_PLAY, SPR2_CNT1|FF_ANIMATE, 50, {NULL}, 0, 4, S_FANG_IDLE1, 0}, // S_FANG_INTRO12 - {SPR_FANG, 11, 2, {A_Boss5MakeJunk}, 0, -1, S_FANG_CLONE2, 0}, // S_FANG_CLONE1 - {SPR_FANG, 11, 0, {A_Repeat}, 49, S_FANG_CLONE1, S_FANG_CLONE3, 0}, // S_FANG_INTRO2 - {SPR_FANG, 12, 0, {A_SetObjectFlags}, MF_NOGRAVITY, 1, S_FANG_CLONE4, 0}, // S_FANG_CLONE3 - {SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_IDLE0, 0, S_FANG_CLONE4, 0}, // S_FANG_CLONE4 + {SPR_PLAY, SPR2_SPNG, 2, {A_Boss5MakeJunk}, 0, -1, S_FANG_CLONE2, 0}, // S_FANG_CLONE1 + {SPR_PLAY, SPR2_SPNG, 0, {A_Repeat}, 49, S_FANG_CLONE1, S_FANG_CLONE3, 0}, // S_FANG_CLONE2 + {SPR_PLAY, SPR2_FALL, 0, {A_SetObjectFlags}, MF_NOGRAVITY, 1, S_FANG_CLONE4, 0}, // S_FANG_CLONE3 + {SPR_PLAY, SPR2_FALL, 1, {A_Boss5CheckOnGround}, S_FANG_IDLE0, 0, S_FANG_CLONE4, 0}, // S_FANG_CLONE4 - {SPR_FANG, 0, 0, {A_SetObjectFlags}, MF_NOCLIPTHING, 1, S_FANG_IDLE1, 0}, // S_FANG_IDLE0 - {SPR_FANG, 2, 16, {A_Look}, 1, 0, S_FANG_IDLE2, 0}, // S_FANG_IDLE1 - {SPR_FANG, 3, 16, {A_Look}, 1, 0, S_FANG_IDLE3, 0}, // S_FANG_IDLE2 - {SPR_FANG, 3, 16, {A_Look}, 1, 0, S_FANG_IDLE4, 0}, // S_FANG_IDLE3 - {SPR_FANG, 3, 16, {A_Look}, 1, 0, S_FANG_IDLE5, 0}, // S_FANG_IDLE4 - {SPR_FANG, 2, 16, {A_Look}, 1, 0, S_FANG_IDLE6, 0}, // S_FANG_IDLE5 - {SPR_FANG, 1, 16, {A_Look}, 1, 0, S_FANG_IDLE7, 0}, // S_FANG_IDLE6 - {SPR_FANG, 1, 16, {A_Look}, 1, 0, S_FANG_IDLE8, 0}, // S_FANG_IDLE7 - {SPR_FANG, 1, 16, {A_Look}, 1, 0, S_FANG_IDLE1, 0}, // S_FANG_IDLE8 + {SPR_PLAY, 0, 0, {A_SetObjectFlags}, MF_NOCLIPTHING, 1, S_FANG_IDLE1, 0}, // S_FANG_IDLE0 + {SPR_PLAY, SPR2_WAIT, 16, {A_Look}, 1, 0, S_FANG_IDLE2, 0}, // S_FANG_IDLE1 + {SPR_PLAY, SPR2_WAIT, 16, {A_Look}, 1, 0, S_FANG_IDLE3, 0}, // S_FANG_IDLE2 + {SPR_PLAY, SPR2_WAIT, 16, {A_Look}, 1, 0, S_FANG_IDLE4, 0}, // S_FANG_IDLE3 + {SPR_PLAY, SPR2_WAIT, 16, {A_Look}, 1, 0, S_FANG_IDLE5, 0}, // S_FANG_IDLE4 + {SPR_PLAY, SPR2_WAIT, 16, {A_Look}, 1, 0, S_FANG_IDLE6, 0}, // S_FANG_IDLE5 + {SPR_PLAY, SPR2_WAIT, 16, {A_Look}, 1, 0, S_FANG_IDLE7, 0}, // S_FANG_IDLE6 + {SPR_PLAY, SPR2_WAIT, 16, {A_Look}, 1, 0, S_FANG_IDLE8, 0}, // S_FANG_IDLE7 + {SPR_PLAY, SPR2_WAIT, 16, {A_Look}, 1, 0, S_FANG_IDLE1, 0}, // S_FANG_IDLE8 - {SPR_FANG, 14, 0, {A_DoNPCPain}, FRACUNIT, 0, S_FANG_PAIN2, 0}, // S_FANG_PAIN1 - {SPR_FANG, 14, 1, {A_Boss5CheckOnGround}, S_FANG_PATHINGSTART1, S_FANG_PINCHPATHINGSTART1, S_FANG_PAIN2, 0}, // S_FANG_PAIN2 + {SPR_PLAY, 0, 0, {A_DoNPCPain}, FRACUNIT, 0, S_FANG_PAIN2, 0}, // S_FANG_PAIN1 + {SPR_PLAY, SPR2_PAIN, 1, {A_Boss5CheckOnGround}, S_FANG_PATHINGSTART1, S_FANG_PINCHPATHINGSTART1, S_FANG_PAIN2, 0}, // S_FANG_PAIN2 - {SPR_FANG, 8, 0, {A_Boss5ExtraRepeat}, 5, 4, S_FANG_PATHINGSTART2, 0}, // S_FANG_PATHINGSTART1 - {SPR_FANG, 8, 0, {A_PlayActiveSound}, 0, 0, S_FANG_PATHING, 0}, // S_FANG_PATHINGSTART2 - {SPR_FANG, 8, 0, {A_Boss5FindWaypoint}, 0, 0, S_FANG_BOUNCE1, 0}, // S_FANG_PATHING + {SPR_PLAY, 0, 0, {A_Boss5ExtraRepeat}, 5, 4, S_FANG_PATHINGSTART2, 0}, // S_FANG_PATHINGSTART1 + {SPR_PLAY, 0, 0, {A_PlayActiveSound}, 0, 0, S_FANG_PATHING, 0}, // S_FANG_PATHINGSTART2 + {SPR_PLAY, 0, 0, {A_Boss5FindWaypoint}, 0, 0, S_FANG_BOUNCE1, 0}, // S_FANG_PATHING - {SPR_FANG, 8, 2, {A_Thrust}, 0, 1, S_FANG_BOUNCE2, 0}, // S_FANG_BOUNCE1 - {SPR_FANG, 9, 2, {NULL}, 0, 0, S_FANG_BOUNCE3, 0}, // S_FANG_BOUNCE2 - {SPR_FANG, 10, 1, {A_Boss5Jump}, 0, 0, S_FANG_BOUNCE4, 0}, // S_FANG_BOUNCE3 - {SPR_FANG, 10, 1, {A_Boss5CheckFalling}, S_FANG_CHECKPATH1, S_FANG_FALL1, S_FANG_BOUNCE4, 0}, // S_FANG_BOUNCE4 + {SPR_PLAY, SPR2_LAND, 2, {A_Thrust}, 0, 1, S_FANG_BOUNCE2, 0}, // S_FANG_BOUNCE1 + {SPR_PLAY, SPR2_LAND, 2, {NULL}, 0, 0, S_FANG_BOUNCE3, 0}, // S_FANG_BOUNCE2 + {SPR_PLAY, SPR2_LAND, 1, {A_Boss5Jump}, 0, 0, S_FANG_BOUNCE4, 0}, // S_FANG_BOUNCE3 + {SPR_PLAY, SPR2_BNCE, 1, {A_Boss5CheckFalling}, S_FANG_CHECKPATH1, S_FANG_FALL1, S_FANG_BOUNCE4, 0}, // S_FANG_BOUNCE4 - {SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_CHECKPATH1, 0, S_FANG_FALL2, 0}, // S_FANG_FALL1 - {SPR_FANG, 13, 1, {A_Boss5CheckOnGround}, S_FANG_CHECKPATH1, 0, S_FANG_FALL1, 0}, // S_FANG_FALL2 + {SPR_PLAY, SPR2_FALL, 1, {A_Boss5CheckOnGround}, S_FANG_CHECKPATH1, 0, S_FANG_FALL2, 0}, // S_FANG_FALL1 + {SPR_PLAY, SPR2_FALL, 1, {A_Boss5CheckOnGround}, S_FANG_CHECKPATH1, 0, S_FANG_FALL1, 0}, // S_FANG_FALL2 - {SPR_FANG, 8, 0, {A_Boss5Calm}, 0, 0, S_FANG_CHECKPATH2, 0}, // S_FANG_CHECKPATH1 - {SPR_FANG, 8, 0, {A_Repeat}, 0, S_FANG_PATHINGCONT1, S_FANG_SKID1, 0}, // S_FANG_CHECKPATH2 + {SPR_PLAY, 0, 0, {A_Boss5Calm}, 0, 0, S_FANG_CHECKPATH2, 0}, // S_FANG_CHECKPATH1 + {SPR_PLAY, 0, 0, {A_Repeat}, 0, S_FANG_PATHINGCONT1, S_FANG_SKID1, 0}, // S_FANG_CHECKPATH2 - {SPR_FANG, 9, 0, {A_Boss5PinchShot}, MT_FBOMB, -16, S_FANG_PATHINGCONT2, 0}, // S_FANG_PATHINGCONT1 - {SPR_FANG, 9, 0, {A_PlayActiveSound}, 0, 0, S_FANG_PATHINGCONT3, 0}, // S_FANG_PATHINGCONT2 - {SPR_FANG, 9, 2, {A_Thrust}, 0, 1, S_FANG_PATHING, 0}, // S_FANG_PATHINGCONT3 + {SPR_PLAY, 0, 0, {A_Boss5PinchShot}, MT_FBOMB, -16, S_FANG_PATHINGCONT2, 0}, // S_FANG_PATHINGCONT1 + {SPR_PLAY, 0, 0, {A_PlayActiveSound}, 0, 0, S_FANG_PATHINGCONT3, 0}, // S_FANG_PATHINGCONT2 + {SPR_PLAY, SPR2_LAND, 2, {A_Thrust}, 0, 1, S_FANG_PATHING, 0}, // S_FANG_PATHINGCONT3 - {SPR_FANG, 4, 0, {A_PlayAttackSound}, 0, 0, S_FANG_SKID2, 0}, // S_FANG_SKID1 - {SPR_FANG, 4, 1, {A_DoNPCSkid}, S_FANG_SKID3, 0, S_FANG_SKID2, 0}, // S_FANG_SKID2 - {SPR_FANG, 4, 10, {NULL}, 0, 0, S_FANG_CHOOSEATTACK, 0}, // S_FANG_SKID3 + {SPR_PLAY, 0, 0, {A_PlayAttackSound}, 0, 0, S_FANG_SKID2, 0}, // S_FANG_SKID1 + {SPR_PLAY, SPR2_SKID, 1, {A_DoNPCSkid}, S_FANG_SKID3, 0, S_FANG_SKID2, 0}, // S_FANG_SKID2 + {SPR_PLAY, SPR2_SKID, 10, {NULL}, 0, 0, S_FANG_CHOOSEATTACK, 0}, // S_FANG_SKID3 - {SPR_FANG, 0, 0, {A_RandomState}, S_FANG_LOBSHOT0, S_FANG_FIRESTART1, S_NULL, 0}, // S_FANG_CHOOSEATTACK + {SPR_PLAY, 0, 0, {A_RandomState}, S_FANG_LOBSHOT0, S_FANG_FIRESTART1, S_NULL, 0}, // S_FANG_CHOOSEATTACK - {SPR_FANG, 5, 0, {A_PrepareRepeat}, 3, 0, S_FANG_FIRESTART2, 0}, // S_FANG_FIRESTART1 // Reset loop - {SPR_FANG, 5, 18, {A_LookForBetter}, 1, 0, S_FANG_FIRE1, 0}, // S_FANG_FIRESTART2 - {SPR_FANG, 5, 5, {A_FireShot}, MT_CORK, -16, S_FANG_FIRE2, 0}, // S_FANG_FIRE1 // Start of loop - {SPR_FANG, 6, 5, {NULL}, 0, 0, S_FANG_FIRE3, 0}, // S_FANG_FIRE2 - {SPR_FANG, 7, 5, {NULL}, 0, 0, S_FANG_FIRE4, 0}, // S_FANG_FIRE3 - {SPR_FANG, 5, 5, {NULL}, 2, 0, S_FANG_FIREREPEAT, 0}, // S_FANG_FIRE4 - {SPR_FANG, 5, 0, {A_Repeat}, 3, S_FANG_FIRE1, S_FANG_WAIT1, 0}, // S_FANG_FIREREPEAT // End of loop + {SPR_PLAY, 0, 0, {A_PrepareRepeat}, 3, 0, S_FANG_FIRESTART2, 0}, // S_FANG_FIRESTART1 // Reset loop + {SPR_PLAY, SPR2_FIRE, 18, {A_LookForBetter}, 1, 0, S_FANG_FIRE1, 0}, // S_FANG_FIRESTART2 + {SPR_PLAY, SPR2_FIRE, 2, {A_FireShot}, MT_CORK, -16, S_FANG_FIRE2, 0}, // S_FANG_FIRE1 // Start of loop + {SPR_PLAY, SPR2_FIRE, 2, {NULL}, 0, 0, S_FANG_FIRE3, 0}, // S_FANG_FIRE2 + {SPR_PLAY, SPR2_FIRE, 16, {NULL}, 0, 0, S_FANG_FIREREPEAT, 0}, // S_FANG_FIRE3 + {SPR_PLAY, 0, 0, {A_Repeat}, 3, S_FANG_FIRE1, S_FANG_WAIT1, 0}, // S_FANG_FIREREPEAT // End of loop - {SPR_FANG, 18, 16, {A_LookForBetter}, 1, 0, S_FANG_LOBSHOT1, 0}, // S_FANG_LOBSHOT0 - {SPR_FANG, 19, 2, {A_LookForBetter}, 1, 0, S_FANG_LOBSHOT2, 0}, // S_FANG_LOBSHOT1 - {SPR_FANG, 20, 18, {A_BrakLobShot}, MT_FBOMB, 32+(1<<16), S_FANG_WAIT1, 0}, // S_FANG_LOBSHOT2 + {SPR_PLAY, SPR2_MSC3, 14, {A_LookForBetter}, 1, 0, S_FANG_LOBSHOT1, 0}, // S_FANG_LOBSHOT0 + {SPR_PLAY, SPR2_MSC3, 2, {A_LookForBetter}, 1, 0, S_FANG_LOBSHOT2, 0}, // S_FANG_LOBSHOT1 + {SPR_PLAY, SPR2_MSC3, 2, {A_LookForBetter}, 1, 0, S_FANG_LOBSHOT3, 0}, // S_FANG_LOBSHOT2 + {SPR_PLAY, SPR2_MSC3, 18, {A_BrakLobShot}, MT_FBOMB, 32+(1<<16), S_FANG_WAIT1, 0}, // S_FANG_LOBSHOT3 - {SPR_FANG, FF_ANIMATE|15, 70, {NULL}, 1, 5, S_FANG_WAIT2, 0}, // S_FANG_WAIT1 - {SPR_FANG, 0, 35, {A_Look}, 1, 0, S_FANG_IDLE1, 0}, // S_FANG_WAIT2 + {SPR_PLAY, SPR2_MLEL|FF_ANIMATE, 70, {NULL}, 0, 5, S_FANG_WAIT2, 0}, // S_FANG_WAIT1 + {SPR_PLAY, SPR2_STND, 35, {A_Look}, 1, 0, S_FANG_IDLE1, 0}, // S_FANG_WAIT2 - {SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_PATHINGSTART2, S_FANG_PINCHPATHINGSTART1, S_FANG_WALLHIT, 0}, // S_FANG_WALLHIT + {SPR_PLAY, SPR2_FALL, 1, {A_Boss5CheckOnGround}, S_FANG_PATHINGSTART2, S_FANG_PINCHPATHINGSTART1, S_FANG_WALLHIT, 0}, // S_FANG_WALLHIT - {SPR_FANG, 8, 0, {A_PrepareRepeat}, 1, 0, S_FANG_PINCHPATHINGSTART2, 0}, // S_FANG_PINCHPATHINGSTART1 - {SPR_FANG, 8, 0, {A_PlayActiveSound}, 0, 0, S_FANG_PINCHPATHING, 0}, // S_FANG_PINCHPATHINGSTART2 - {SPR_FANG, 8, 0, {A_Boss5FindWaypoint}, 1, 0, S_FANG_PINCHBOUNCE0, 0}, // S_FANG_PINCHPATHING - {SPR_FANG, 8, 0, {A_SetObjectFlags}, MF_NOCLIP|MF_NOCLIPHEIGHT, 2, S_FANG_PINCHBOUNCE1, 0}, // S_FANG_PINCHBOUNCE0 - {SPR_FANG, 8, 2, {A_Thrust}, 0, 1, S_FANG_PINCHBOUNCE2, 0}, // S_FANG_PINCHBOUNCE1 - {SPR_FANG, 9, 2, {NULL}, 0, 0, S_FANG_PINCHBOUNCE3, 0}, // S_FANG_PINCHBOUNCE2 - {SPR_FANG, 10, 2, {A_Boss5Jump}, 0, 0, S_FANG_PINCHBOUNCE4, 0}, // S_FANG_PINCHBOUNCE3 - {SPR_FANG, 10, 1, {A_Boss5CheckFalling}, S_FANG_PINCHSKID1, S_FANG_PINCHFALL0, S_FANG_PINCHBOUNCE4, 0}, // S_FANG_PINCHBOUNCE4 - {SPR_FANG, 12, 0, {A_SetObjectFlags}, MF_NOCLIP|MF_NOCLIPHEIGHT, 1, S_FANG_PINCHFALL1, 0}, // S_FANG_PINCHFALL0 - {SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_PINCHSKID1, 0, S_FANG_PINCHFALL2, 0}, // S_FANG_PINCHFALL1 - {SPR_FANG, 13, 1, {A_Boss5CheckOnGround}, S_FANG_PINCHSKID1, 0, S_FANG_PINCHFALL1, 0}, // S_FANG_PINCHFALL2 - {SPR_FANG, 4, 0, {A_PlayAttackSound}, 0, 0, S_FANG_PINCHSKID2, 0}, // S_FANG_PINCHSKID1 - {SPR_FANG, 4, 1, {A_DoNPCSkid}, S_FANG_PINCHLOBSHOT0, 0, S_FANG_PINCHSKID2, 0}, // S_FANG_PINCHSKID2 - {SPR_FANG, 18, 16, {A_FaceTarget}, 3, 0, S_FANG_PINCHLOBSHOT1, 0}, // S_FANG_PINCHLOBSHOT0 - {SPR_FANG, 19, 2, {A_FaceTarget}, 3, 0, S_FANG_PINCHLOBSHOT2, 0}, // S_FANG_PINCHLOBSHOT1 - {SPR_FANG, 20, 30, {A_Boss5MakeItRain}, MT_FBOMB, -16, S_FANG_PINCHLOBSHOT3, 0}, // S_FANG_PINCHLOBSHOT2 - {SPR_FANG, 20, 18, {A_LinedefExecuteFromArg}, 4, 0, S_FANG_PINCHLOBSHOT4, 0}, // S_FANG_PINCHLOBSHOT3 - {SPR_FANG, 0, 0, {A_Boss5Calm}, 0, 0, S_FANG_PATHINGSTART1, 0}, // S_FANG_PINCHLOBSHOT4 + {SPR_PLAY, 0, 0, {A_PrepareRepeat}, 1, 0, S_FANG_PINCHPATHINGSTART2, 0}, // S_FANG_PINCHPATHINGSTART1 + {SPR_PLAY, 0, 0, {A_PlayActiveSound}, 0, 0, S_FANG_PINCHPATHING, 0}, // S_FANG_PINCHPATHINGSTART2 + {SPR_PLAY, 0, 0, {A_Boss5FindWaypoint}, 1, 0, S_FANG_PINCHBOUNCE0, 0}, // S_FANG_PINCHPATHING + {SPR_PLAY, 0, 0, {A_SetObjectFlags}, MF_NOCLIP|MF_NOCLIPHEIGHT, 2, S_FANG_PINCHBOUNCE1, 0}, // S_FANG_PINCHBOUNCE0 + {SPR_PLAY, SPR2_LAND, 2, {A_Thrust}, 0, 1, S_FANG_PINCHBOUNCE2, 0}, // S_FANG_PINCHBOUNCE1 + {SPR_PLAY, SPR2_LAND, 2, {NULL}, 0, 0, S_FANG_PINCHBOUNCE3, 0}, // S_FANG_PINCHBOUNCE2 + {SPR_PLAY, SPR2_LAND, 2, {A_Boss5Jump}, 0, 0, S_FANG_PINCHBOUNCE4, 0}, // S_FANG_PINCHBOUNCE3 + {SPR_PLAY, SPR2_BNCE, 1, {A_Boss5CheckFalling}, S_FANG_PINCHSKID1, S_FANG_PINCHFALL0, S_FANG_PINCHBOUNCE4, 0}, // S_FANG_PINCHBOUNCE4 + {SPR_PLAY, 0, 0, {A_SetObjectFlags}, MF_NOCLIP|MF_NOCLIPHEIGHT, 1, S_FANG_PINCHFALL1, 0}, // S_FANG_PINCHFALL0 + {SPR_PLAY, SPR2_FALL, 1, {A_Boss5CheckOnGround}, S_FANG_PINCHSKID1, 0, S_FANG_PINCHFALL2, 0}, // S_FANG_PINCHFALL1 + {SPR_PLAY, SPR2_FALL, 1, {A_Boss5CheckOnGround}, S_FANG_PINCHSKID1, 0, S_FANG_PINCHFALL1, 0}, // S_FANG_PINCHFALL2 + {SPR_PLAY, 0, 0, {A_PlayAttackSound}, 0, 0, S_FANG_PINCHSKID2, 0}, // S_FANG_PINCHSKID1 + {SPR_PLAY, SPR2_SKID, 1, {A_DoNPCSkid}, S_FANG_PINCHLOBSHOT0, 0, S_FANG_PINCHSKID2, 0}, // S_FANG_PINCHSKID2 + {SPR_PLAY, SPR2_MSC3, 16, {A_FaceTarget}, 1, 5, S_FANG_PINCHLOBSHOT1, 0}, // S_FANG_PINCHLOBSHOT0 + {SPR_PLAY, SPR2_MSC3, 2, {A_FaceTarget}, 3, 0, S_FANG_PINCHLOBSHOT2, 0}, // S_FANG_PINCHLOBSHOT1 + {SPR_PLAY, SPR2_MSC3, 2, {A_FaceTarget}, 3, 0, S_FANG_PINCHLOBSHOT3, 0}, // S_FANG_PINCHLOBSHOT2 + {SPR_PLAY, SPR2_MSC3, 30, {A_Boss5MakeItRain}, MT_FBOMB, -16, S_FANG_PINCHLOBSHOT4, 0}, // S_FANG_PINCHLOBSHOT3 + {SPR_PLAY, SPR2_STND, 18, {A_LinedefExecuteFromArg}, 4, 0, S_FANG_PINCHLOBSHOT5, 0}, // S_FANG_PINCHLOBSHOT4 + {SPR_PLAY, 0, 0, {A_Boss5Calm}, 0, 0, S_FANG_PATHINGSTART1, 0}, // S_FANG_PINCHLOBSHOT5 - {SPR_FANG, 21, 0, {A_DoNPCPain}, 0, 0, S_FANG_DIE2, 0}, // S_FANG_DIE1 - {SPR_FANG, 21, 1, {A_Boss5CheckOnGround}, S_FANG_DIE3, 0, S_FANG_DIE2, 0}, // S_FANG_DIE2 + {SPR_PLAY, 0, 0, {A_DoNPCPain}, 0, 0, S_FANG_DIE2, 0}, // S_FANG_DIE1 + {SPR_PLAY, SPR2_MSC4, 1, {A_Boss5CheckOnGround}, S_FANG_DIE3, 0, S_FANG_DIE2, 0}, // S_FANG_DIE2 - {SPR_FANG, 22, 0, {A_Scream}, 0, 0, S_FANG_DIE4, 0}, // S_FANG_DIE3 - {SPR_FANG, 22, -1, {A_SetFuse}, 70, 0, S_FANG_DIE5, 0}, // S_FANG_DIE4 + {SPR_PLAY, 0, 0, {A_Scream}, 0, 0, S_FANG_DIE4, 0}, // S_FANG_DIE3 + {SPR_PLAY, SPR2_MSC5, -1, {A_SetFuse}, 70, 0, S_FANG_DIE5, 0}, // S_FANG_DIE4 - {SPR_FANG, 11, 0, {A_PlaySound}, sfx_jump, 0, S_FANG_DIE6, 0}, // S_FANG_DIE5 - {SPR_FANG, 11, 1, {A_ZThrust}, 6, (1<<16)|1, S_FANG_DIE7, 0}, // S_FANG_DIE6 - {SPR_FANG, 11, 1, {A_Boss5CheckFalling}, S_FANG_FLEEPATHING1, S_FANG_DIE8, S_FANG_DIE7, 0}, // S_FANG_DIE7 - {SPR_FANG, 12, 1, {A_Boss5CheckOnGround}, S_FANG_FLEEPATHING1, 0, S_FANG_DIE8, 0}, // S_FANG_DIE8 + {SPR_PLAY, 0, 0, {A_PlaySound}, sfx_jump, 0, S_FANG_DIE6, 0}, // S_FANG_DIE5 + {SPR_PLAY, SPR2_JUMP, 1, {A_ZThrust}, 6, (1<<16)|1, S_FANG_DIE7, 0}, // S_FANG_DIE6 + {SPR_PLAY, SPR2_JUMP, 1, {A_Boss5CheckFalling}, S_FANG_FLEEPATHING1, S_FANG_DIE8, S_FANG_DIE7, 0}, // S_FANG_DIE7 + {SPR_PLAY, SPR2_FALL, 1, {A_Boss5CheckOnGround}, S_FANG_FLEEPATHING1, 0, S_FANG_DIE8, 0}, // S_FANG_DIE8 - {SPR_FANG, 9, 0, {A_PlayActiveSound}, 0, 0, S_FANG_FLEEPATHING2, 0}, // S_FANG_FLEEPATHING1 - {SPR_FANG, 8, 2, {A_Boss5FindWaypoint}, 2, 0, S_FANG_FLEEBOUNCE1, 0}, // S_FANG_FLEEPATHING2 - {SPR_FANG, 9, 2, {NULL}, 0, 0, S_FANG_FLEEBOUNCE2, 0}, // S_FANG_FLEEBOUNCE1 - {SPR_FANG, 10, -1, {A_BossDeath}, 0, 0, S_NULL, 0}, // S_FANG_FLEEBOUNCE2 + {SPR_PLAY, 0, 0, {A_PlayActiveSound}, 0, 0, S_FANG_FLEEPATHING2, 0}, // S_FANG_FLEEPATHING1 + {SPR_PLAY, SPR2_LAND, 2, {A_Boss5FindWaypoint}, 2, 0, S_FANG_FLEEBOUNCE1, 0}, // S_FANG_FLEEPATHING2 + {SPR_PLAY, SPR2_LAND, 2, {NULL}, 0, 0, S_FANG_FLEEBOUNCE2, 0}, // S_FANG_FLEEBOUNCE1 + {SPR_PLAY, SPR2_LAND, -1, {A_BossDeath}, 0, 0, S_NULL, 0}, // S_FANG_FLEEBOUNCE2 - {SPR_FANG, 17, 7*TICRATE, {NULL}, 0, 0, S_NULL, 0}, // S_FANG_KO + {SPR_PLAY, SPR2_DEAD, 7*TICRATE, {NULL}, 0, 0, S_NULL, 0}, // S_FANG_KO {SPR_NULL, 0, -1, {A_RandomStateRange}, S_BROKENROBOTA, S_BROKENROBOTF, S_NULL, 0}, // S_BROKENROBOTRANDOM {SPR_BRKN, FF_ANIMATE|FF_RANDOMANIM, -1, {NULL}, 3, 4, S_NULL, 0}, // S_BROKENROBOTA @@ -1767,22 +1790,22 @@ state_t states[NUMSTATES] = // Metal Sonic {SPR_PLAY, SPR2_STND, -1, {NULL}, 0, 0, S_METALSONIC_RACE, 0}, // S_METALSONIC_RACE - {SPR_METL, 4, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT, 0}, // S_METALSONIC_FLOAT - {SPR_METL, 16|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_METALSONIC_STUN, 0}, // S_METALSONIC_VECTOR - {SPR_METL, 15, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT, 0}, // S_METALSONIC_STUN - {SPR_METL, 17, 20, {NULL}, 0, 0, S_METALSONIC_GATHER, 0},// S_METALSONIC_RAISE - {SPR_METL, 18, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT, 0}, // S_METALSONIC_GATHER - {SPR_METL, 6|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, -1, {NULL}, 1, 2, S_METALSONIC_BOUNCE, 0},// S_METALSONIC_DASH - {SPR_METL, 18|FF_FULLBRIGHT|FF_ANIMATE|FF_GLOBALANIM, -1, {NULL}, 1, 2, S_METALSONIC_FLOAT, 0}, // S_METALSONIC_BOUNCE - {SPR_METL, 14, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT, 0}, // S_METALSONIC_BADBOUNCE - {SPR_METL, 17, -1, {NULL}, 0, 0, S_METALSONIC_GATHER, 0},// S_METALSONIC_SHOOT - {SPR_METL, 15, 40, {A_Pain}, 0, 0, S_METALSONIC_FLOAT, 0}, // S_METALSONIC_PAIN - {SPR_METL, 17, 2, {A_Fall}, 0, 0, S_METALSONIC_DEATH2, 0},// S_METALSONIC_DEATH1 - {SPR_METL, 17, 4, {A_BossScream}, 0, 0, S_METALSONIC_DEATH3, 0},// S_METALSONIC_DEATH2 - {SPR_METL, 17, 0, {A_Repeat}, 17, S_METALSONIC_DEATH2, S_METALSONIC_DEATH4, 0}, // S_METALSONIC_DEATH3 - {SPR_METL, 17, -1, {A_BossDeath}, 0, 0, S_NULL, 0}, // S_METALSONIC_DEATH4 - {SPR_METL, 15, 1, {A_BossScream}, 0, 0, S_METALSONIC_FLEE2, 0}, // S_METALSONIC_FLEE1 - {SPR_METL, 15, 7, {NULL}, 0, 0, S_METALSONIC_FLEE1, 0}, // S_METALSONIC_FLEE2 + {SPR_PLAY, SPR2_WALK, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT, 0}, // S_METALSONIC_FLOAT + {SPR_PLAY, SPR2_MSC1|FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_METALSONIC_STUN, 0}, // S_METALSONIC_VECTOR + {SPR_PLAY, SPR2_MSC0, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT, 0},// S_METALSONIC_STUN + {SPR_PLAY, SPR2_SPNG, 20, {NULL}, 0, 0, S_METALSONIC_GATHER, 0}, // S_METALSONIC_RAISE + {SPR_PLAY, SPR2_MSC2, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT, 0}, // S_METALSONIC_GATHER + {SPR_PLAY, SPR2_DASH|FF_FULLBRIGHT, -1, {NULL}, 1, 2, S_METALSONIC_BOUNCE, 0}, // S_METALSONIC_DASH + {SPR_PLAY, SPR2_MSC2|FF_FULLBRIGHT, -1, {NULL}, 1, 2, S_METALSONIC_FLOAT, 0}, // S_METALSONIC_BOUNCE + {SPR_PLAY, SPR2_PAIN, -1, {NULL}, 0, 0, S_METALSONIC_FLOAT, 0}, // S_METALSONIC_BADBOUNCE + {SPR_PLAY, SPR2_SPNG, -1, {NULL}, 0, 0, S_METALSONIC_GATHER, 0}, // S_METALSONIC_SHOOT + {SPR_PLAY, SPR2_FLT, 40, {A_Pain}, 0, 0, S_METALSONIC_FLOAT, 0}, // S_METALSONIC_PAIN + {SPR_PLAY, SPR2_SPNG, 2, {A_Fall}, 0, 0, S_METALSONIC_DEATH2, 0}, // S_METALSONIC_DEATH1 + {SPR_PLAY, SPR2_SPNG, 4, {A_BossScream}, 0, 0, S_METALSONIC_DEATH3, 0}, // S_METALSONIC_DEATH2 + {SPR_PLAY, SPR2_SPNG, 0, {A_Repeat}, 17, S_METALSONIC_DEATH2, S_METALSONIC_DEATH4, 0}, // S_METALSONIC_DEATH3 + {SPR_PLAY, SPR2_SPNG, -1, {A_BossDeath}, 0, 0, S_NULL, 0}, // S_METALSONIC_DEATH4 + {SPR_PLAY, SPR2_FLT, 1, {A_BossScream}, 0, 0, S_METALSONIC_FLEE2, 0}, // S_METALSONIC_FLEE1 + {SPR_PLAY, SPR2_FLT, 7, {NULL}, 0, 0, S_METALSONIC_FLEE1, 0}, // S_METALSONIC_FLEE2 {SPR_MSCF, FF_FULLBRIGHT|FF_TRANS30|FF_ANIMATE, -1, {NULL}, 11, 1, S_NULL, 0}, // S_MSSHIELD_F1 {SPR_MSCF, FF_FULLBRIGHT|FF_ANIMATE|12, -1, {NULL}, 8, 2, S_NULL, 0}, // S_MSSHIELD_F2 @@ -2647,16 +2670,15 @@ state_t states[NUMSTATES] = // FHZ {SPR_FHZI, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_FHZICE1 {SPR_FHZI, 1, -1, {NULL}, 0, 0, S_NULL, 0}, // S_FHZICE2 - {SPR_ROSY, 16, 8, {NULL}, 0, 0, S_ROSY_IDLE2, 0}, // S_ROSY_IDLE1 - {SPR_ROSY, 17, 4, {NULL}, 0, 0, S_ROSY_IDLE3, 0}, // S_ROSY_IDLE2 - {SPR_ROSY, 18, 8, {NULL}, 0, 0, S_ROSY_IDLE4, 0}, // S_ROSY_IDLE3 - {SPR_ROSY, 17, 4, {NULL}, 0, 0, S_ROSY_IDLE1, 0}, // S_ROSY_IDLE4 - {SPR_ROSY, 14, -1, {NULL}, 1, 0, S_NULL, 0}, // S_ROSY_JUMP - {SPR_ROSY, 5, -1, {NULL}, 7, 0, S_NULL, 0}, // S_ROSY_WALK - {SPR_ROSY, 19, -1, {NULL}, 0, 0, S_NULL, 0}, // S_ROSY_HUG - {SPR_ROSY, 13, -1, {NULL}, 0, 0, S_NULL, 0}, // S_ROSY_PAIN - {SPR_ROSY, 1|FF_ANIMATE, -1, {NULL}, 3, 16, S_NULL, 0}, // S_ROSY_STND - {SPR_ROSY, 20|FF_ANIMATE, TICRATE, {NULL}, 3, 4, S_ROSY_WALK, 0}, // S_ROSY_UNHAPPY + // Amy FHZ cameo + {SPR_PLAY, SPR2_CNT1|FF_ANIMATE, -1, {NULL}, 0, 0, S_NULL, 0}, // S_ROSY_IDLE + {SPR_PLAY, SPR2_MSC0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_ROSY_JUMP + {SPR_PLAY, SPR2_MSC1, -1, {NULL}, 0, 0, S_NULL, 0}, // S_ROSY_FALL + {SPR_PLAY, SPR2_WALK, -1, {NULL}, 7, 0, S_NULL, 0}, // S_ROSY_WALK + {SPR_PLAY, SPR2_MSC2, -1, {NULL}, 0, 0, S_NULL, 0}, // S_ROSY_HUG + {SPR_PLAY, SPR2_PAIN, -1, {NULL}, 0, 0, S_NULL, 0}, // S_ROSY_PAIN + {SPR_PLAY, SPR2_WAIT|FF_ANIMATE, -1, {NULL}, 0, 5, S_NULL, 0}, // S_ROSY_STND + {SPR_PLAY, SPR2_MSC3|FF_ANIMATE, TICRATE, {NULL}, 0, 4, S_ROSY_WALK, 0}, // S_ROSY_UNHAPPY // Halloween Scenery // Pumpkins @@ -14788,7 +14810,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_ROSY 2104, // doomednum - S_ROSY_IDLE1, // spawnstate + S_ROSY_IDLE, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound diff --git a/src/info.h b/src/info.h index d9aff0cbe..2b955a387 100644 --- a/src/info.h +++ b/src/info.h @@ -1156,6 +1156,18 @@ typedef enum playersprite SPR2_TALB, SPR2_TALC, + //Misc slots + SPR2_MSC0, + SPR2_MSC1, + SPR2_MSC2, + SPR2_MSC3, + SPR2_MSC4, + SPR2_MSC5, + SPR2_MSC6, + SPR2_MSC7, + SPR2_MSC8, + SPR2_MSC9, + SPR2_CNT1, // continue disappointment SPR2_CNT2, // continue lift SPR2_CNT3, // continue spin @@ -1903,11 +1915,11 @@ typedef enum state S_FANG_FIRE1, S_FANG_FIRE2, S_FANG_FIRE3, - S_FANG_FIRE4, S_FANG_FIREREPEAT, S_FANG_LOBSHOT0, S_FANG_LOBSHOT1, S_FANG_LOBSHOT2, + S_FANG_LOBSHOT3, S_FANG_WAIT1, S_FANG_WAIT2, S_FANG_WALLHIT, @@ -1929,6 +1941,7 @@ typedef enum state S_FANG_PINCHLOBSHOT2, S_FANG_PINCHLOBSHOT3, S_FANG_PINCHLOBSHOT4, + S_FANG_PINCHLOBSHOT5, S_FANG_DIE1, S_FANG_DIE2, S_FANG_DIE3, @@ -3078,11 +3091,9 @@ typedef enum state // FHZ S_FHZICE1, S_FHZICE2, - S_ROSY_IDLE1, - S_ROSY_IDLE2, - S_ROSY_IDLE3, - S_ROSY_IDLE4, + S_ROSY_IDLE, S_ROSY_JUMP, + S_ROSY_FALL, S_ROSY_WALK, S_ROSY_HUG, S_ROSY_PAIN, diff --git a/src/p_mobj.c b/src/p_mobj.c index aa846a93c..e71089b7d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -344,8 +344,10 @@ static boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) mobj->state = st; mobj->tics = st->tics; - // Adjust the player's animation speed to match their velocity. - if (player->panim == PA_EDGE && (player->charflags & SF_FASTEDGE)) + // Adjust the player's animation speed + if (mobj->state-states == S_PLAY_WAIT && (player->charflags & SF_FASTWAIT)) + mobj->tics = 5; + else if (player->panim == PA_EDGE && (player->charflags & SF_FASTEDGE)) mobj->tics = 2; else if (!(disableSpeedAdjust || player->charflags & SF_NOSPEEDADJUST)) { @@ -7322,7 +7324,7 @@ static void P_RosySceneryThink(mobj_t *mobj) player = &players[i]; } - if (stat == S_ROSY_JUMP || stat == S_ROSY_PAIN) + if (stat == S_ROSY_JUMP || stat == S_ROSY_FALL || stat == S_ROSY_PAIN) { if (P_IsObjectOnGround(mobj)) { @@ -7333,16 +7335,16 @@ static void P_RosySceneryThink(mobj_t *mobj) stat = S_ROSY_WALK; P_SetMobjState(mobj, stat); } - else if (P_MobjFlip(mobj)*mobj->momz < 0) - mobj->frame = mobj->state->frame + mobj->state->var1; + else if (P_MobjFlip(mobj)*mobj->momz < 0 && stat == S_ROSY_JUMP) + P_SetMobjState(mobj, S_ROSY_FALL); } if (!player) { - if ((stat < S_ROSY_IDLE1 || stat > S_ROSY_IDLE4) && stat != S_ROSY_JUMP) + if (stat != S_ROSY_IDLE && stat != S_ROSY_JUMP && stat != S_ROSY_FALL) { mobj->momx = mobj->momy = 0; - P_SetMobjState(mobj, S_ROSY_IDLE1); + P_SetMobjState(mobj, S_ROSY_IDLE); } } else @@ -7356,13 +7358,11 @@ static void P_RosySceneryThink(mobj_t *mobj) switch (stat) { - case S_ROSY_IDLE1: - case S_ROSY_IDLE2: - case S_ROSY_IDLE3: - case S_ROSY_IDLE4: + case S_ROSY_IDLE: dojump = true; break; case S_ROSY_JUMP: + case S_ROSY_FALL: case S_ROSY_PAIN: // handled above break; @@ -7388,8 +7388,7 @@ static void P_RosySceneryThink(mobj_t *mobj) max = pdist; if ((--mobj->extravalue1) <= 0) { - if (++mobj->frame > mobj->state->frame + mobj->state->var1) - mobj->frame = mobj->state->frame; + P_SetMobjState(mobj, S_ROSY_WALK); if (mom > 12*mobj->scale) mobj->extravalue1 = 2; else if (mom > 6*mobj->scale) @@ -10627,6 +10626,19 @@ static fixed_t P_DefaultMobjShadowScale (mobj_t *thing) } } +static INT32 P_SetupNPC(mobj_t *mobj, const char *name) +{ + INT32 skinnum = R_SkinAvailable(name); + + if (skinnum != -1) + { + mobj->skin = skins[skinnum]; + mobj->color = skins[skinnum]->prefcolor; + } + + return skinnum; +} + // // P_SpawnMobj // @@ -10980,17 +10992,14 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...) nummaprings++; break; case MT_METALSONIC_RACE: - mobj->skin = skins[5]; - /* FALLTHRU */ case MT_METALSONIC_BATTLE: - mobj->color = skins[5]->prefcolor; - sc = 5; + sc = P_SetupNPC(mobj, "metalsonic"); break; case MT_FANG: - sc = 4; + sc = P_SetupNPC(mobj, "fang"); break; case MT_ROSY: - sc = 3; + sc = P_SetupNPC(mobj, "amy"); break; case MT_CORK: mobj->flags2 |= MF2_SUPERFIRE; diff --git a/src/p_user.c b/src/p_user.c index bb5d8f44f..7817aa78c 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11540,6 +11540,9 @@ void P_DoMetalJetFume(player_t *player, mobj_t *fume) return; } + if (player->skidtime) // Rotate during metal sonic's new skid animation + angle += ANGLE_90; + if (underwater) // No fume underwater; spawn bubbles instead! { fume->movedir += FixedAngle(FixedDiv(2 * player->speed, 3 * mo->scale)); diff --git a/src/r_things.c b/src/r_things.c index 50855e2fc..2c0529e47 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -968,7 +968,9 @@ UINT8 *R_GetTranslationForThing(mobj_t *mobj, skincolornum_t color, UINT16 trans if (color != SKINCOLOR_NONE) { // New colormap stuff for skins Tails 06-07-2002 - if (mobj->colorized) + if ((mobj->state-states == S_METALSONIC_DASH || mobj->state-states == S_METALSONIC_BOUNCE) && (((leveltime/2) & 1))) // Metal boss doing attack + skinnum = TC_DASHMODE; + else if (mobj->colorized) skinnum = TC_RAINBOW; else if (mobj->player && mobj->player->dashmode >= DASHMODE_THRESHOLD && (mobj->player->charflags & SF_DASHMODE) From 8ca2b44ccdf93362de2aa8aecd04b7b2df4f4022 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 19 Jan 2025 02:27:50 -0300 Subject: [PATCH 326/353] Fix map thing type check in OP_CreateNewMapThing --- src/m_cheat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 4be071bb2..aa992621a 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1110,7 +1110,7 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c mt->pitch = mt->roll = 0; // Ignore offsets - if (mt->type == MT_EMBLEM) + if (mt->type == mobjinfo[MT_EMBLEM].doomednum) mt->args[1] = 1; else mt->args[0] = 1; From 9142bfbf7d13878eeb96c3802832a3763b26cb85 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 19 Jan 2025 02:29:33 -0300 Subject: [PATCH 327/353] Don't make Metal Sonic or Amy grayscale when spawning them using objectplace --- src/m_cheat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index aa992621a..21ecc3312 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1112,7 +1112,7 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c // Ignore offsets if (mt->type == mobjinfo[MT_EMBLEM].doomednum) mt->args[1] = 1; - else + else if (!(mt->type == mobjinfo[MT_METALSONIC_RACE].doomednum || mt->type == mobjinfo[MT_ROSY].doomednum)) mt->args[0] = 1; return mt; From 8f388ef9ae775651304d0fe205546c358fe73761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 19 Jan 2025 18:03:35 +0100 Subject: [PATCH 328/353] Remove redundant P_CyclePlayerMobjState function --- src/p_mobj.c | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index aa846a93c..5a508e008 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -178,27 +178,6 @@ static void P_CycleMobjState(mobj_t *mobj) } } -// -// P_CycleMobjState for players. -// -static void P_CyclePlayerMobjState(mobj_t *mobj) -{ - // state animations - P_CycleStateAnimation(mobj); - - // cycle through states, - // calling action functions at transitions - if (mobj->tics != -1) - { - mobj->tics--; - - // you can cycle through multiple states in a tic - if (!mobj->tics && mobj->state) - if (!P_SetMobjState(mobj, mobj->state->nextstate)) - return; // freed itself - } -} - // // P_SetPlayerMobjState // Returns true if the mobj is still present. @@ -3803,7 +3782,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj) } animonly: - P_CyclePlayerMobjState(mobj); + P_CycleMobjState(mobj); } static void CalculatePrecipFloor(precipmobj_t *mobj) @@ -10334,10 +10313,7 @@ void P_MobjThinker(mobj_t *mobj) } // Can end up here if a player dies. - if (mobj->player) - P_CyclePlayerMobjState(mobj); - else - P_CycleMobjState(mobj); + P_CycleMobjState(mobj); if (P_MobjWasRemoved(mobj)) return; From d0096ff89db297c22f078744e82101b3127b25a5 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sun, 19 Jan 2025 18:05:00 -0300 Subject: [PATCH 329/353] Fix order of spr2defaults --- src/info.c | 10 +++++----- src/info.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/info.c b/src/info.c index 235d97c3b..4e934bb7e 100644 --- a/src/info.c +++ b/src/info.c @@ -689,11 +689,6 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = { SPR2_TAL0, // SPR2_TALB, SPR2_TAL6, // SPR2_TALC, - SPR2_WAIT, // SPR2_CNT1, - SPR2_FALL, // SPR2_CNT2, - SPR2_SPNG, // SPR2_CNT3, - SPR2_CNT1, // SPR2_CNT4, - 0, // SPR2_MSC0, 0, // SPR2_MSC1, 0, // SPR2_MSC2, @@ -705,6 +700,11 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = { 0, // SPR2_MSC8, 0, // SPR2_MSC9, + SPR2_WAIT, // SPR2_CNT1, + SPR2_FALL, // SPR2_CNT2, + SPR2_SPNG, // SPR2_CNT3, + SPR2_CNT1, // SPR2_CNT4, + 0, // SPR2_SIGN, 0, // SPR2_LIFE, diff --git a/src/info.h b/src/info.h index 2b955a387..189200643 100644 --- a/src/info.h +++ b/src/info.h @@ -1156,7 +1156,7 @@ typedef enum playersprite SPR2_TALB, SPR2_TALC, - //Misc slots + // Misc slots SPR2_MSC0, SPR2_MSC1, SPR2_MSC2, From 83de7c93a4cf328b0d9c3489a3639283e7220fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Mon, 20 Jan 2025 16:52:58 +0100 Subject: [PATCH 330/353] Fix in-game masterserver listing --- src/m_menu.c | 12 ++++++------ src/netcode/d_clisrv.c | 4 ++-- src/netcode/http-mserv.c | 4 ++-- src/netcode/mserv.c | 7 ++++--- src/netcode/mserv.h | 5 ----- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index d92f56ffa..9a6fbc8ae 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -11373,7 +11373,7 @@ static void M_Refresh(INT32 choice) // note: this is the one case where 0 is a valid room number // because it corresponds to "All" - CL_UpdateServerList(!(ms_RoomId < 0), ms_RoomId); + CL_UpdateServerList(cv_masterserver_room_id.value >= 0, cv_masterserver_room_id.value); // first page of servers serverlistpage = 0; @@ -11459,7 +11459,7 @@ static void M_DrawConnectMenu(void) numPages = 1; // Room name - if (ms_RoomId < 0) + if (cv_masterserver_room_id.value < 0) V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ConnectMenu[mp_connect_room].alphaKey, V_YELLOWMAP, (itemOn == mp_connect_room) ? "" : ""); else @@ -11951,7 +11951,7 @@ static void M_ServerOptions(INT32 choice) static void M_StartServerMenu(INT32 choice) { (void)choice; - ms_RoomId = -1; + CV_SetValue(&cv_masterserver_room_id, -1); levellistmode = LLM_CREATESERVER; Newgametype_OnChange(); M_SetupNextMenu(&MP_ServerDef); diff --git a/src/netcode/d_clisrv.c b/src/netcode/d_clisrv.c index 067458852..6702e2591 100644 --- a/src/netcode/d_clisrv.c +++ b/src/netcode/d_clisrv.c @@ -663,7 +663,7 @@ void D_QuitNetGame(void) if (netnodes[i].ingame) HSendPacket(i, true, 0, 0); #ifdef MASTERSERVER - if (serverrunning && ms_RoomId > 0) + if (serverrunning && cv_masterserver_room_id.value > 0) UnregisterServer(); #endif } @@ -797,7 +797,7 @@ void SV_SpawnServer(void) { I_NetOpenSocket(); #ifdef MASTERSERVER - if (ms_RoomId > 0) + if (cv_masterserver_room_id.value > 0) RegisterServer(); #endif } diff --git a/src/netcode/http-mserv.c b/src/netcode/http-mserv.c index 4a0804984..8ce20af95 100644 --- a/src/netcode/http-mserv.c +++ b/src/netcode/http-mserv.c @@ -426,7 +426,7 @@ HMS_register (void) char *title; - hms = HMS_connect(PROTO_V4, "rooms/%d/register", ms_RoomId); + hms = HMS_connect(PROTO_V4, "rooms/%d/register", cv_masterserver_room_id.value); if (! hms) return 0; @@ -462,7 +462,7 @@ HMS_register (void) if (!hms_allow_ipv6) return ok; - hms = HMS_connect(PROTO_V6, "rooms/%d/register", ms_RoomId); + hms = HMS_connect(PROTO_V6, "rooms/%d/register", cv_masterserver_room_id.value); if (! hms) return 0; diff --git a/src/netcode/mserv.c b/src/netcode/mserv.c index fba36a3ba..f17db4b6e 100644 --- a/src/netcode/mserv.c +++ b/src/netcode/mserv.c @@ -67,9 +67,10 @@ consvar_t cv_masterserver = CVAR_INIT ("masterserver", "https://ds.ms.srb2.org/M consvar_t cv_servername = CVAR_INIT_WITH_CALLBACKS ("servername", "SRB2 server", CV_SAVE|CV_NETVAR|CV_CALL|CV_NOINIT|CV_ALLOWLUA, NULL, Update_parameters, ServerName_CanChange); consvar_t cv_masterserver_update_rate = CVAR_INIT ("masterserver_update_rate", "15", CV_SAVE|CV_CALL|CV_NOINIT, masterserver_update_rate_cons_t, Update_parameters); -consvar_t cv_masterserver_room_id = CVAR_INIT ("masterserver_room_id", "0", CV_CALL, CV_Unsigned, RoomId_OnChange); +CV_PossibleValue_t cv_masterserver_room_values[] = {{-1, "MIN"}, {999999999, "MAX"}, {0, NULL}}; +consvar_t cv_masterserver_room_id = CVAR_INIT ("masterserver_room_id", "-1", CV_CALL, cv_masterserver_room_values, RoomId_OnChange); -INT16 ms_RoomId = 0; +static INT16 ms_RoomId = -1; #if defined (MASTERSERVER) && defined (HAVE_THREADS) int ms_QueryId; @@ -449,7 +450,7 @@ void UnregisterServer(void) static boolean Online (void) { - return ( serverrunning && ms_RoomId > 0 ); + return ( serverrunning && cv_masterserver_room_id.value > 0 ); } static inline void SendPingToMasterServer(void) diff --git a/src/netcode/mserv.h b/src/netcode/mserv.h index 419c11a89..ed3c9b27b 100644 --- a/src/netcode/mserv.h +++ b/src/netcode/mserv.h @@ -71,11 +71,6 @@ extern consvar_t cv_masterserver_timeout; extern consvar_t cv_masterserver_debug; extern consvar_t cv_masterserver_token; -// < 0 to not connect (usually -1) (offline mode) -// == 0 to show all rooms, not a valid hosting room -// anything else is whatever room the MS assigns to that number (online mode) -extern INT16 ms_RoomId; - #ifdef HAVE_THREADS extern int ms_QueryId; extern I_mutex ms_QueryId_mutex; From 18e39ee42e81e830d2cad5f3bf35dc0306642505 Mon Sep 17 00:00:00 2001 From: pastel Date: Mon, 20 Jan 2025 14:32:56 -0600 Subject: [PATCH 331/353] Fix single player level select conditions --- src/m_menu.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index d92f56ffa..d75ee252d 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3917,12 +3917,16 @@ void M_StartControlPanel(void) } else if (!(netgame || multiplayer)) // Single Player { - // Devmode unlocks Pandora's Box in the pause menu - boolean pandora = ((M_SecretUnlocked(SECRET_PANDORA, serverGamedata) || cv_debug || devparm) && !marathonmode); + // Devmode unlocks Pandora's Box and Level Select in the pause menu + boolean isforbidden = (marathonmode || ultimatemode); + boolean isdebug = ((cv_debug || devparm) && !isforbidden); + boolean pandora = ((M_SecretUnlocked(SECRET_PANDORA, serverGamedata) && !isforbidden) || isdebug); + boolean lselect = ((M_SecretUnlocked(SECRET_LEVELSELECT, serverGamedata) && !isforbidden) || isdebug); - if (gamestate != GS_LEVEL || ultimatemode) // intermission, so gray out stuff. + if (gamestate != GS_LEVEL) // intermission, so gray out stuff. { SPauseMenu[spause_pandora].status = (pandora) ? (IT_GRAYEDOUT) : (IT_DISABLED); + SPauseMenu[spause_levelselect].status = (lselect) ? (IT_STRING | IT_CALL) : (IT_DISABLED); SPauseMenu[spause_retry].status = IT_GRAYEDOUT; } else @@ -3932,6 +3936,11 @@ void M_StartControlPanel(void) ++numlives; SPauseMenu[spause_pandora].status = (pandora) ? (IT_STRING | IT_CALL) : (IT_DISABLED); + SPauseMenu[spause_levelselect].status = (lselect) ? (IT_STRING | IT_CALL) : (IT_DISABLED); + if (ultimatemode) + { + SPauseMenu[spause_retry].status = IT_GRAYEDOUT; + } // The list of things that can disable retrying is (was?) a little too complex // for me to want to use the short if statement syntax @@ -3941,13 +3950,6 @@ void M_StartControlPanel(void) SPauseMenu[spause_retry].status = (IT_STRING | IT_CALL); } - // We can always use level select though. :33 - // Guarantee it if we have either it unlocked or devmode is enabled - if ((maplistoption != 0 || M_SecretUnlocked(SECRET_LEVELSELECT, serverGamedata) || cv_debug || devparm) && !marathonmode) - SPauseMenu[spause_levelselect].status = (IT_STRING | IT_CALL); - else - SPauseMenu[spause_levelselect].status = (IT_DISABLED); - // And emblem hints. SPauseMenu[spause_hints].status = (M_SecretUnlocked(SECRET_EMBLEMHINTS, clientGamedata) && !marathonmode) ? (IT_STRING | IT_CALL) : (IT_DISABLED); @@ -7792,7 +7794,7 @@ static void M_PauseLevelSelect(INT32 choice) // and we have the level select unlocked so that it // transfers the level select list from the menu // used to enter the game to the pause menu. - if (maplistoption == 0 && M_SecretUnlocked(SECRET_LEVELSELECT, serverGamedata)) + if (maplistoption == 0) maplistoption = 1; if (!M_PrepareLevelPlatter(-1, true)) From f1006ece347ee264180312de48749b08ca738155 Mon Sep 17 00:00:00 2001 From: Neon Date: Tue, 21 Jan 2025 01:31:57 +0000 Subject: [PATCH 332/353] Spawn Torchflower's flame after the original object is scaled from a mapthing --- src/p_mobj.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index b377ff82f..05249ea88 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11012,13 +11012,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type, ...) mcsolid->angle = mobj->angle + ANGLE_90; } break; - case MT_TORCHFLOWER: - { - mobj_t *fire = P_SpawnMobjFromMobj(mobj, 0, 0, 46*FRACUNIT, MT_FLAME); - if (!P_MobjWasRemoved(fire)) - P_SetTarget(&mobj->target, fire); - break; - } case MT_PYREFLY: mobj->extravalue1 = (FixedHypot(mobj->x, mobj->y)/FRACUNIT) % 360; mobj->extravalue2 = 0; @@ -13012,6 +13005,13 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean } } break; + case MT_TORCHFLOWER: + { + mobj_t *fire = P_SpawnMobjFromMobj(mobj, 0, 0, 46*FRACUNIT, MT_FLAME); + if (!P_MobjWasRemoved(fire)) + P_SetTarget(&mobj->target, fire); + break; + } case MT_CANDLE: case MT_CANDLEPRICKET: if (mthing->args[0]) From 74777eeb81696e0ff9b74bb7691cd7e0b147227f Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 21 Jan 2025 17:53:23 -0300 Subject: [PATCH 333/353] Only show level select option if started a session from a level select --- src/m_menu.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index d75ee252d..6c93da048 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3921,7 +3921,7 @@ void M_StartControlPanel(void) boolean isforbidden = (marathonmode || ultimatemode); boolean isdebug = ((cv_debug || devparm) && !isforbidden); boolean pandora = ((M_SecretUnlocked(SECRET_PANDORA, serverGamedata) && !isforbidden) || isdebug); - boolean lselect = ((M_SecretUnlocked(SECRET_LEVELSELECT, serverGamedata) && !isforbidden) || isdebug); + boolean lselect = ((maplistoption != 0 && !isforbidden) || isdebug); if (gamestate != GS_LEVEL) // intermission, so gray out stuff. { @@ -7790,13 +7790,9 @@ static void M_PauseLevelSelect(INT32 choice) SP_PauseLevelSelectDef.prevMenu = currentMenu; levellistmode = LLM_LEVELSELECT; - // maplistoption is only specified if not set already - // and we have the level select unlocked so that it + // maplistoption is NOT specified, so that this // transfers the level select list from the menu // used to enter the game to the pause menu. - if (maplistoption == 0) - maplistoption = 1; - if (!M_PrepareLevelPlatter(-1, true)) { M_StartMessage(M_GetText("No selectable levels found.\n"),NULL,MM_NOTHING); From 5fa0f7b8d1646b51e9165372b3ebb2dc471c77ae Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 21 Jan 2025 16:54:33 -0500 Subject: [PATCH 334/353] CircleCI: fixup linux64 build --- .circleci/config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b86b39f75..2ffd87e29 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -51,10 +51,10 @@ jobs: - checkout - run: name: make master depend file - command: find make/linux64/SDL/deps/ -type f -print0 | sort -z | xargs -r0 cat > make/linux64/SDL.deps + command: find make/linux/64/SDL/deps/ -type f -print0 | sort -z | xargs -r0 cat > make/linux/64/SDL.deps - restore_cache: keys: - - v1-SRB2-{{ .Branch }}-{{ checksum "make/linux64/SDL.deps" }} + - v1-SRB2-{{ .Branch }}-{{ checksum "make/linux/64/SDL.deps" }} - run: name: Compile command: make -C src LINUX64=1 ERRORMODE=1 -k -j4 @@ -62,6 +62,6 @@ jobs: path: /home/circleci/SRB2/bin/ destination: bin - save_cache: - key: v1-SRB2-{{ .Branch }}-{{ checksum "make/linux64/SDL.deps" }} + key: v1-SRB2-{{ .Branch }}-{{ checksum "make/linux/64/SDL.deps" }} paths: - /home/circleci/.ccache From ef9aa81b06f48b108580d876d7658f9c042ed6f4 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 21 Jan 2025 16:59:36 -0500 Subject: [PATCH 335/353] CircleCI: make deps folder --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2ffd87e29..7bdf790ff 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,6 +49,9 @@ jobs: paths: - /home/circleci/.cache/apt - checkout + - run: + name: Create deps folder as needed + command: mkdir -p make/linux/64/SDL/deps/ - run: name: make master depend file command: find make/linux/64/SDL/deps/ -type f -print0 | sort -z | xargs -r0 cat > make/linux/64/SDL.deps From 953dbad8481f6f7c1b442fc04c610603e0b6c409 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 21 Jan 2025 17:06:50 -0500 Subject: [PATCH 336/353] CireceCI: ignore unused results --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7bdf790ff..5bb36e60e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,7 @@ jobs: environment: CC: ccache gcc CCACHE_COMPRESS: true + WFLAGS: -Wno-error=unused-result #- image: ubuntu:trusty # environment: # CC: ccache gcc -m32 From 89daa40fb00ced78e129aa510e0378b7cd13de6f Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 21 Jan 2025 17:10:40 -0500 Subject: [PATCH 337/353] CireceCI: ignore unused results with CFLAGS --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5bb36e60e..9cf3c2a4e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ jobs: environment: CC: ccache gcc CCACHE_COMPRESS: true - WFLAGS: -Wno-error=unused-result + CFLAGS: -Wno-error=unused-result #- image: ubuntu:trusty # environment: # CC: ccache gcc -m32 From f691d35ee92166bcec52bffe894b8637455fbe82 Mon Sep 17 00:00:00 2001 From: Logan Aerl Arias Date: Tue, 21 Jan 2025 22:13:26 +0000 Subject: [PATCH 338/353] add cmake to the gitlab ci jobs --- ...ml => alpine-3-gcc-dedicated-makefile.yml} | 10 +- .gitlab/ci/jobs/alpine-3-gcc-makefile.yml | 135 ++++++++++++++++++ .gitlab/ci/jobs/alpine-3-gcc.yml | 20 ++- .gitlab/ci/jobs/batocera-arm64-makefile.yml | 38 +++++ .gitlab/ci/jobs/batocera-arm64.yml | 14 +- .../jobs/debian-oldstable-amd64-makefile.yml | 40 ++++++ .gitlab/ci/jobs/debian-oldstable-amd64.yml | 14 +- .../jobs/debian-oldstable-arm64-makefile.yml | 40 ++++++ .gitlab/ci/jobs/debian-oldstable-arm64.yml | 14 +- .../ci/jobs/debian-stable-amd64-makefile.yml | 45 ++++++ .gitlab/ci/jobs/debian-stable-amd64.yml | 14 +- .../ci/jobs/debian-stable-arm64-makefile.yml | 46 ++++++ .gitlab/ci/jobs/debian-stable-arm64.yml | 15 +- .../ci/jobs/debian-stable-i386-makefile.yml | 45 ++++++ .gitlab/ci/jobs/debian-stable-i386.yml | 15 +- .../debian-testing-gcc-amd64-makefile.yml | 46 ++++++ .gitlab/ci/jobs/debian-testing-gcc-amd64.yml | 14 +- .gitlab/ci/jobs/macos-arm64.yml | 2 +- .gitlab/ci/jobs/macos-x86_64.yml | 75 ++++++++++ .gitlab/ci/jobs/windows-x64-makefile.yml | 35 +++++ .gitlab/ci/jobs/windows-x64.yml | 22 ++- .gitlab/ci/jobs/windows-x86-makefile.yml | 35 +++++ .gitlab/ci/jobs/windows-x86.yml | 103 ++++++++++++- CMakeLists.txt | 2 + src/CMakeLists.txt | 9 +- src/sdl/CMakeLists.txt | 9 +- 26 files changed, 812 insertions(+), 45 deletions(-) rename .gitlab/ci/jobs/{alpine-3-gcc-dedicated.yml => alpine-3-gcc-dedicated-makefile.yml} (86%) create mode 100644 .gitlab/ci/jobs/alpine-3-gcc-makefile.yml create mode 100644 .gitlab/ci/jobs/batocera-arm64-makefile.yml create mode 100644 .gitlab/ci/jobs/debian-oldstable-amd64-makefile.yml create mode 100644 .gitlab/ci/jobs/debian-oldstable-arm64-makefile.yml create mode 100644 .gitlab/ci/jobs/debian-stable-amd64-makefile.yml create mode 100644 .gitlab/ci/jobs/debian-stable-arm64-makefile.yml create mode 100644 .gitlab/ci/jobs/debian-stable-i386-makefile.yml create mode 100644 .gitlab/ci/jobs/debian-testing-gcc-amd64-makefile.yml create mode 100644 .gitlab/ci/jobs/windows-x64-makefile.yml create mode 100644 .gitlab/ci/jobs/windows-x86-makefile.yml diff --git a/.gitlab/ci/jobs/alpine-3-gcc-dedicated.yml b/.gitlab/ci/jobs/alpine-3-gcc-dedicated-makefile.yml similarity index 86% rename from .gitlab/ci/jobs/alpine-3-gcc-dedicated.yml rename to .gitlab/ci/jobs/alpine-3-gcc-dedicated-makefile.yml index 242ddd0ea..fe63e09c8 100644 --- a/.gitlab/ci/jobs/alpine-3-gcc-dedicated.yml +++ b/.gitlab/ci/jobs/alpine-3-gcc-dedicated-makefile.yml @@ -1,18 +1,18 @@ -Alpine 3 GCC Dedicated: - extends: Alpine 3 GCC +Alpine 3 GCC Dedicated Makefile: + extends: Alpine 3 GCC Makefile artifacts: paths: - "bin/" - "src/comptime.h" - expose_as: "Apline-3-Dedicated" - name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Apline-3-Dedicated" + expose_as: "Apline-3-Dedicated-makefile" + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Apline-3-Dedicated-makefile" script: - - | # apk_toolchain echo -e "\e[0Ksection_start:`date +%s`:apk_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" - - apk add gcc + - apk add gcc g++ - | # apk_toolchain echo -e "\e[0Ksection_end:`date +%s`:apk_toolchain\r\e[0K" diff --git a/.gitlab/ci/jobs/alpine-3-gcc-makefile.yml b/.gitlab/ci/jobs/alpine-3-gcc-makefile.yml new file mode 100644 index 000000000..2cc656ca7 --- /dev/null +++ b/.gitlab/ci/jobs/alpine-3-gcc-makefile.yml @@ -0,0 +1,135 @@ +Alpine 3 GCC Makefile: + stage: build + + when: manual + + image: alpine:3 + + allow_failure: true + + cache: + - key: apk-$CI_JOB_IMAGE-makefile + paths: + - apk-cache + unprotect: true + + artifacts: + paths: + - "bin/" + - "src/comptime.h" + expose_as: "Apline-3-makefile" + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Apline-3-makefile" + + before_script: + - - | + # apk_cache + echo -e "\e[0Ksection_start:`date +%s`:apk_cache[collapsed=true]\r\e[0KUpdating APK listing" + - export APK_CACHE_DIR=`pwd`/apk-cache + - mkdir --parents --verbose $APK_CACHE_DIR/ + - ln -sf /etc/apk/cache $APK_CACHE_DIR + - | + # apk_cache + echo -e "\e[0Ksection_end:`date +%s`:apk_cache\r\e[0K" + + - - | + # apk_update + echo -e "\e[0Ksection_start:`date +%s`:apk_update[collapsed=true]\r\e[0KUpdating APK listing" + - apk update + - | + # apk_update + echo -e "\e[0Ksection_end:`date +%s`:apk_update\r\e[0K" + + - - | + # apk_upgrade + echo -e "\e[0Ksection_start:`date +%s`:apk_upgrade[collapsed=true]\r\e[0KUpdating existing packages" + - apk upgrade + - | + # apk_update + echo -e "\e[0Ksection_end:`date +%s`:apk_upgrade\r\e[0K" + + - - | + # apk_common + echo -e "\e[0Ksection_start:`date +%s`:apk_common[collapsed=true]\r\e[0KInstalling common packages" + - apk add make git ccache nasm + - | + # apk_common + echo -e "\e[0Ksection_end:`date +%s`:apk_common\r\e[0K" + + - - | + # ccache_config + echo -e "\e[0Ksection_start:`date +%s`:ccache_config[collapsed=true]\r\e[0KSetting up ccache config" + - mkdir --parents --verbose ~/.ccache/ + - touch ~/.ccache/ccache.conf + - | + # cache.conf + echo Adding ccache configution option + - | + # base_dir + echo base_dir = $PWD | tee -a ~/.ccache/ccache.conf + - | + # cache_dir + echo cache_dir = $PWD/ccache | tee -a ~/.ccache/ccache.conf + - | + # compiler_check + echo compiler_check = content | tee -a ~/.ccache/ccache.conf + - | + # stats_log + echo stats_log = $PWD/ccache_statslog | tee -a ~/.ccache/ccache.conf + - | + # max_size + echo max_size = 50M | tee -a ~/.ccache/ccache.conf + - | + # ccache_config + echo -e "\e[0Ksection_end:`date +%s`:ccache_config\r\e[0K" + + - - | + # cache_reset + echo -e "\e[0Ksection_start:`date +%s`:ccache_reset[collapsed=true]\r\e[0KResetting ccache statistics" + - ccache --zero-stats + - ccache --show-stats + - | + # ccache_reset + echo -e "\e[0Ksection_end:`date +%s`:ccache_reset\r\e[0K" + + script: + - - | + # apk_toolchain + echo -e "\e[0Ksection_start:`date +%s`:apk_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" + - apk add gcc g++ + - | + # apk_toolchain + echo -e "\e[0Ksection_end:`date +%s`:apk_toolchain\r\e[0K" + + - - | + # apk_development + echo -e "\e[0Ksection_start:`date +%s`:apk_development[collapsed=true]\r\e[0KInstalling development packages" + - apk add cmake musl-dev sdl2_mixer-dev libpng-dev curl-dev libgme-dev libopenmpt-dev miniupnpc-dev elfutils-dev + - | + # apk_development + echo -e "\e[0Ksection_end:`date +%s`:apk_development\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 NOEXECINFO=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 NOEXECINFO=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" + + after_script: + - - | + # apk_clean + echo -e "\e[0Ksection_start:`date +%s`:apk_clean[collapsed=true]\r\e[0KCleaning of unneeded APK packages" + - apk cache clean + - | + # apk_clean + echo -e "\e[0Ksection_end:`date +%s`:apk_clean\r\e[0K" + + - - | + # ccache_stats + echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:" + - ccache --show-stats --verbose + - ccache --show-log-stats --verbose + - | + # ccahe_stats + echo -e "\e[0Ksection_end:`date +%s`:ccache_stats\r\e[0K" diff --git a/.gitlab/ci/jobs/alpine-3-gcc.yml b/.gitlab/ci/jobs/alpine-3-gcc.yml index b3b12e401..1881bf3c2 100644 --- a/.gitlab/ci/jobs/alpine-3-gcc.yml +++ b/.gitlab/ci/jobs/alpine-3-gcc.yml @@ -15,8 +15,8 @@ Alpine 3 GCC: artifacts: paths: - - "bin/" - - "src/comptime.h" + - "build.alpine3/bin/" + - "build.alpine3/src/config.h" expose_as: "Apline-3" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Apline-3" @@ -50,7 +50,7 @@ Alpine 3 GCC: - - | # apk_common echo -e "\e[0Ksection_start:`date +%s`:apk_common[collapsed=true]\r\e[0KInstalling common packages" - - apk add make git ccache nasm + - apk add cmake make git ccache nasm - | # apk_common echo -e "\e[0Ksection_end:`date +%s`:apk_common\r\e[0K" @@ -95,7 +95,7 @@ Alpine 3 GCC: - - | # apk_toolchain echo -e "\e[0Ksection_start:`date +%s`:apk_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" - - apk add gcc + - apk add gcc g++ - | # apk_toolchain echo -e "\e[0Ksection_end:`date +%s`:apk_toolchain\r\e[0K" @@ -103,15 +103,23 @@ Alpine 3 GCC: - - | # apk_development echo -e "\e[0Ksection_start:`date +%s`:apk_development[collapsed=true]\r\e[0KInstalling development packages" - - apk add musl-dev sdl2_mixer-dev libpng-dev curl-dev libgme-dev libopenmpt-dev miniupnpc-dev + - apk add cmake musl-dev sdl2_mixer-dev libpng-dev curl-dev libgme-dev libopenmpt-dev miniupnpc-dev elfutils-dev - | # apk_development echo -e "\e[0Ksection_end:`date +%s`:apk_development\r\e[0K" + - - | + # cmake + echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake -B build.alpine3 -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DSRB2_CONFIG_EXECINFO=NO -G "Unix Makefiles" + - | + # cmake + echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" + - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 NOEXECINFO=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 NOEXECINFO=1 + - make --directory=build.alpine3 --keep-going || make --directory=build.alpine3 --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/batocera-arm64-makefile.yml b/.gitlab/ci/jobs/batocera-arm64-makefile.yml new file mode 100644 index 000000000..9a590807d --- /dev/null +++ b/.gitlab/ci/jobs/batocera-arm64-makefile.yml @@ -0,0 +1,38 @@ +batocera:arm64 Makefile: + extends: Debian stable:arm64 Makefile + + when: manual + + allow_failure: true + + artifacts: + paths: + - "bin/" + - "src/comptime.h" + expose_as: "Debian old arm64 makefile" + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-batocera-aarch64-makefile" + + script: + - - | + # apt_toolchain + echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" + - apt-get install gcc-aarch64-linux-gnu || apt-get install gcc + - | + # apt_toolchain + echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K" + + - - | + # apt_development + echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages" + - apt-get install libsdl2-mixer-dev:arm64 libpng-dev:arm64 libcurl4-openssl-dev:arm64 libopenmpt-dev:arm64 libminiupnpc-dev:arm64 + - | + # apt_development + echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 ERRORMODE=1 NONX86=1 ARM64=1 NOGME=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NONX86=1 ARM64=1 NOGME=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/batocera-arm64.yml b/.gitlab/ci/jobs/batocera-arm64.yml index 3e43aa875..c83a5badb 100644 --- a/.gitlab/ci/jobs/batocera-arm64.yml +++ b/.gitlab/ci/jobs/batocera-arm64.yml @@ -7,8 +7,8 @@ batocera:arm64: artifacts: paths: - - "bin/" - - "src/comptime.h" + - "build.cmake/bin/" + - "build.cmake/src/config.h" expose_as: "Debian old arm64" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-batocera-aarch64" @@ -29,10 +29,18 @@ batocera:arm64: # apt_development echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + - - | + # cmake + echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS=ON -DSRB2_CONFIG_USE_GME=OFF -G "Unix Makefiles" + - | + # cmake + echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" + - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 ERRORMODE=1 NONX86=1 ARM64=1 NOGME=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NONX86=1 ARM64=1 NOGME=1 + - make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-oldstable-amd64-makefile.yml b/.gitlab/ci/jobs/debian-oldstable-amd64-makefile.yml new file mode 100644 index 000000000..ba2e745bd --- /dev/null +++ b/.gitlab/ci/jobs/debian-oldstable-amd64-makefile.yml @@ -0,0 +1,40 @@ +Debian oldstable:amd64 Makefile: + extends: Debian stable:amd64 Makefile + + when: manual + + image: git.do.srb2.org:5050/stjr/srb2ci/srb2ci:oldstable + + allow_failure: true + + artifacts: + paths: + - "bin/" + - "src/comptime.h" + expose_as: "Debian old amd64 makefile" + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-old-x86-64-makefile" + + script: + - - | + # apt_toolchain + echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" + - apt-get install gcc-x86-64-linux-gnu || apt-get install gcc + - | + # apt_toolchain + echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K" + + - - | + # apt_development + echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages" + - apt-get install libsdl2-mixer-dev:amd64 libpng-dev:amd64 libcurl4-openssl-dev:amd64 libopenmpt-dev:amd64 libminiupnpc-dev:amd64 + - | + # apt_development + echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NOGME=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NOGME=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-oldstable-amd64.yml b/.gitlab/ci/jobs/debian-oldstable-amd64.yml index 3929ecdcd..32c7f3e40 100644 --- a/.gitlab/ci/jobs/debian-oldstable-amd64.yml +++ b/.gitlab/ci/jobs/debian-oldstable-amd64.yml @@ -9,8 +9,8 @@ Debian oldstable:amd64: artifacts: paths: - - "bin/" - - "src/comptime.h" + - "build.cmake/bin/" + - "build.cmake/src/config.h" expose_as: "Debian old amd64" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-old-x86-64" @@ -31,10 +31,18 @@ Debian oldstable:amd64: # apt_development echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + - - | + # cmake + echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DSRB2_CONFIG_USE_GME=OFF -G "Unix Makefiles" + - | + # cmake + echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" + - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NOGME=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NOGME=1 + - make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-oldstable-arm64-makefile.yml b/.gitlab/ci/jobs/debian-oldstable-arm64-makefile.yml new file mode 100644 index 000000000..79e282bc6 --- /dev/null +++ b/.gitlab/ci/jobs/debian-oldstable-arm64-makefile.yml @@ -0,0 +1,40 @@ +Debian oldstable:arm64 Makefile: + extends: Debian stable:arm64 Makefile + + when: manual + + image: git.do.srb2.org:5050/stjr/srb2ci/srb2ci:oldstable + + allow_failure: true + + artifacts: + paths: + - "bin/" + - "src/comptime.h" + expose_as: "Debian old arm64 makefile" + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-old-aarch64-makefile" + + script: + - - | + # apt_toolchain + echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" + - apt-get install gcc-aarch64-linux-gnu || apt-get install gcc + - | + # apt_toolchain + echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K" + + - - | + # apt_development + echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages" + - apt-get install libsdl2-mixer-dev:arm64 libpng-dev:arm64 libcurl4-openssl-dev:arm64 libopenmpt-dev:arm64 libminiupnpc-dev:arm64 + - | + # apt_development + echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 ERRORMODE=1 NONX86=1 ARM64=1 NOGME=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NONX86=1 ARM64=1 NOGME=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-oldstable-arm64.yml b/.gitlab/ci/jobs/debian-oldstable-arm64.yml index b18d538cd..4bf324e3b 100644 --- a/.gitlab/ci/jobs/debian-oldstable-arm64.yml +++ b/.gitlab/ci/jobs/debian-oldstable-arm64.yml @@ -9,8 +9,8 @@ Debian oldstable:arm64: artifacts: paths: - - "bin/" - - "src/comptime.h" + - "build.cmake/bin/" + - "build.cmake/src/config.h" expose_as: "Debian old arm64" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-old-aarch64" @@ -31,10 +31,18 @@ Debian oldstable:arm64: # apt_development echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + - - | + # cmake + echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS=ON -DSRB2_CONFIG_USE_GME=OFF -G "Unix Makefiles" + - | + # cmake + echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" + - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 ERRORMODE=1 NONX86=1 ARM64=1 NOGME=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NONX86=1 ARM64=1 NOGME=1 + - make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-stable-amd64-makefile.yml b/.gitlab/ci/jobs/debian-stable-amd64-makefile.yml new file mode 100644 index 000000000..6dfe176cd --- /dev/null +++ b/.gitlab/ci/jobs/debian-stable-amd64-makefile.yml @@ -0,0 +1,45 @@ +Debian stable:amd64 Makefile: + extends: .srb2ci + + stage: build + + artifacts: + paths: + - "bin/" + - "src/comptime.h" + expose_as: "Debian amd64 makefile" + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-x86-64-makefile" + + variables: + CC: x86_64-linux-gnu-gcc + LDFLAGS: -Wl,-fuse-ld=gold + OBJCOPY: x86_64-linux-gnu-objcopy + OBJDUMP: x86_64-linux-gnu-objdump + PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig + + when: on_success + + script: + - - | + # apt_toolchain + echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" + - apt-get install gcc-x86-64-linux-gnu || apt-get install gcc + - | + # apt_toolchain + echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K" + + - - | + # apt_development + echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages" + - apt-get install libsdl2-mixer-dev:amd64 libpng-dev:amd64 libcurl4-openssl-dev:amd64 libgme-dev:amd64 libopenmpt-dev:amd64 libminiupnpc-dev:amd64 + - | + # apt_development + echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-stable-amd64.yml b/.gitlab/ci/jobs/debian-stable-amd64.yml index 4a757afe0..533a3151d 100644 --- a/.gitlab/ci/jobs/debian-stable-amd64.yml +++ b/.gitlab/ci/jobs/debian-stable-amd64.yml @@ -5,8 +5,8 @@ Debian stable:amd64: artifacts: paths: - - "bin/" - - "src/comptime.h" + - "build.cmake/bin/" + - "build.cmake/src/config.h" expose_as: "Debian amd64" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-x86-64" @@ -36,10 +36,18 @@ Debian stable:amd64: # apt_development echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + - - | + # cmake + echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -G "Unix Makefiles" + - | + # cmake + echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" + - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 + - make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-stable-arm64-makefile.yml b/.gitlab/ci/jobs/debian-stable-arm64-makefile.yml new file mode 100644 index 000000000..d932e9f42 --- /dev/null +++ b/.gitlab/ci/jobs/debian-stable-arm64-makefile.yml @@ -0,0 +1,46 @@ +Debian stable:arm64 Makefile: + extends: .srb2ci + + stage: build + + when: manual + + artifacts: + paths: + - "bin/" + - "src/comptime.h" + expose_as: "Debian arm64 makefile" + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-aarch64-makefile" + + variables: + CC: aarch64-linux-gnu-gcc + LDFLAGS: -Wl,-fuse-ld=gold + OBJCOPY: aarch64-linux-gnu-objcopy + OBJDUMP: aarch64-linux-gnu-objdump + LD: aarch64-linux-gnu-ld + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig + + script: + - - | + # apt_toolchain + echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" + - apt-get install gcc-aarch64-linux-gnu || apt-get install gcc + - | + # apt_toolchain + echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K" + + - - | + # apt_development + echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages" + - apt-get install libsdl2-mixer-dev:arm64 libpng-dev:arm64 libcurl4-openssl-dev:arm64 libgme-dev:arm64 libopenmpt-dev:arm64 libminiupnpc-dev:arm64 + - | + # apt_development + echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 ERRORMODE=1 NONX86=1 ARM64=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NONX86=1 ARM64=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-stable-arm64.yml b/.gitlab/ci/jobs/debian-stable-arm64.yml index 879391aff..db82ee38a 100644 --- a/.gitlab/ci/jobs/debian-stable-arm64.yml +++ b/.gitlab/ci/jobs/debian-stable-arm64.yml @@ -7,8 +7,8 @@ Debian stable:arm64: artifacts: paths: - - "bin/" - - "src/comptime.h" + - "build.cmake/bin/" + - "build.cmake/src/config.h" expose_as: "Debian arm64" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-aarch64" @@ -17,6 +17,7 @@ Debian stable:arm64: LDFLAGS: -Wl,-fuse-ld=gold OBJCOPY: aarch64-linux-gnu-objcopy OBJDUMP: aarch64-linux-gnu-objdump + LD: aarch64-linux-gnu-ld PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig script: @@ -36,10 +37,18 @@ Debian stable:arm64: # apt_development echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + - - | + # cmake + echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS=ON -G "Unix Makefiles" + - | + # cmake + echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" + - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 ERRORMODE=1 NONX86=1 ARM64=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX64=1 NONX86=1 ARM64=1 + - make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-stable-i386-makefile.yml b/.gitlab/ci/jobs/debian-stable-i386-makefile.yml new file mode 100644 index 000000000..bbabee4a6 --- /dev/null +++ b/.gitlab/ci/jobs/debian-stable-i386-makefile.yml @@ -0,0 +1,45 @@ +Debian stable:i386 Makefile: + extends: .srb2ci + + stage: build + + when: manual + + artifacts: + paths: + - "bin/" + - "src/comptime.h" + expose_as: "Debian i386 makefile" + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-i686-makefile" + + variables: + CC: i686-linux-gnu-gcc + OBJCOPY: i686-linux-gnu-objcopy + OBJDUMP: i686-linux-gnu-objdump + LD: i686-linux-gnu-ld + PKG_CONFIG_PATH: /usr/lib/i386-linux-gnu/pkgconfig + + script: + - - | + # apt_toolchain + echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" + - apt-get install gcc-i686-linux-gnu || apt-get install gcc + - | + # apt_toolchain + echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K" + + - - | + # apt_development + echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages" + - apt-get install libsdl2-mixer-dev:i386 libpng-dev:i386 libcurl4-openssl-dev:i386 libgme-dev:i386 libopenmpt-dev:i386 libminiupnpc-dev:i386 + - | + # apt_development + echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-stable-i386.yml b/.gitlab/ci/jobs/debian-stable-i386.yml index cd6206e55..8d9ea4964 100644 --- a/.gitlab/ci/jobs/debian-stable-i386.yml +++ b/.gitlab/ci/jobs/debian-stable-i386.yml @@ -7,8 +7,8 @@ Debian stable:i386: artifacts: paths: - - "bin/" - - "src/comptime.h" + - "build.cmake/bin/" + - "build.cmake/src/config.h" expose_as: "Debian i386" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-i686" @@ -16,6 +16,7 @@ Debian stable:i386: CC: i686-linux-gnu-gcc OBJCOPY: i686-linux-gnu-objcopy OBJDUMP: i686-linux-gnu-objdump + LD: i686-linux-gnu-ld PKG_CONFIG_PATH: /usr/lib/i386-linux-gnu/pkgconfig script: @@ -35,10 +36,18 @@ Debian stable:i386: # apt_development echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + - - | + # cmake + echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -G "Unix Makefiles" + - | + # cmake + echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" + - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 LINUX=1 + - make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-testing-gcc-amd64-makefile.yml b/.gitlab/ci/jobs/debian-testing-gcc-amd64-makefile.yml new file mode 100644 index 000000000..5edaddf33 --- /dev/null +++ b/.gitlab/ci/jobs/debian-testing-gcc-amd64-makefile.yml @@ -0,0 +1,46 @@ +Debian testing GCC Makefile: + extends: .srb2ci + + stage: build + + when: manual + + image: debian:testing-slim + + allow_failure: true + + artifacts: + paths: + - "bin/" + - "src/comptime.h" + expose_as: "testing-gcc-makefile" + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-testing-gcc-makefile" + + variables: + CC: gcc + LDFLAGS: -Wl,-fuse-ld=gold + + script: + - - | + # apt_toolchain + echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" + - apt-get install gcc + - | + # apt_toolchain + echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K" + + - - | + # apt_development + echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages" + - apt-get install libsdl2-mixer-dev libpng-dev libcurl4-openssl-dev libgme-dev libopenmpt-dev libminiupnpc-dev + - | + # apt_development + echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/debian-testing-gcc-amd64.yml b/.gitlab/ci/jobs/debian-testing-gcc-amd64.yml index 10799b305..458c6d1ef 100644 --- a/.gitlab/ci/jobs/debian-testing-gcc-amd64.yml +++ b/.gitlab/ci/jobs/debian-testing-gcc-amd64.yml @@ -11,8 +11,8 @@ Debian testing GCC: artifacts: paths: - - "bin/" - - "src/comptime.h" + - "build.cmake/bin/" + - "build.cmake/src/config.h" expose_as: "testing-gcc" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-testing-gcc" @@ -37,10 +37,18 @@ Debian testing GCC: # apt_development echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + - - | + # cmake + echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -G "Unix Makefiles" + - | + # cmake + echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" + - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 NONX86=1 + - make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/macos-arm64.yml b/.gitlab/ci/jobs/macos-arm64.yml index 392841361..a9e31773e 100644 --- a/.gitlab/ci/jobs/macos-arm64.yml +++ b/.gitlab/ci/jobs/macos-arm64.yml @@ -30,7 +30,7 @@ osxcross arm64: - - | # cmake echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" - - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_CONFIG_USE_GME:BOOL=OFF -G "Unix Makefiles" + - cmake -B build.osxcross --toolchain /osxcross/toolchain.cmake -DCPM_USE_LOCAL_PACKAGES:BOOL=ON -DOPENMPT_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/include" -DSDL2_INCLUDE_DIR:PATH="/osxcross/macports/pkgs/opt/local/lib" -DSRB2_CONFIG_ENABLE_TESTS:BOOL=OFF -DSRB2_CONFIG_SYSTEM_LIBRARIES:BOOL=ON -DSRB2_CONFIG_FORCE_NO_MS_BITFIELDS:BOOL=ON -DSRB2_CONFIG_USE_GME:BOOL=OFF -G "Unix Makefiles" - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/macos-x86_64.yml b/.gitlab/ci/jobs/macos-x86_64.yml index 818028e49..525a919c8 100644 --- a/.gitlab/ci/jobs/macos-x86_64.yml +++ b/.gitlab/ci/jobs/macos-x86_64.yml @@ -3,6 +3,30 @@ osxcross x86_64: stage: build + cache: + - key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG + fallback_keys: + - ccache-$CI_JOB_NAME_SLUG-$CI_DEFAULT_BRANCH + - ccache-$CI_JOB_NAME_SLUG-master + paths: + - build/ccache + - build/ccache_statslog + + - key: apt-$CI_JOB_IMAGE + paths: + - build/apt-cache + unprotect: true + + - key: vcpkg-root + paths: + - build/vcpkg-root + unprotect: true + + - key: vcpkg-binary-cache-x64-osx + paths: + - build/vcpkg-binary-cache + unprotect: true + artifacts: paths: - "build.osxcross/bin/" @@ -15,6 +39,27 @@ osxcross x86_64: LD: x86_64-apple-darwin21.4-ld script: + - | + # vcpkg + echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KUpdating vcpkg" + + if [ -d "build/vcpkg-root" ]; then + pushd build/vcpkg-root + git fetch https://github.com/Microsoft/vcpkg master + git reset --hard FETCH_HEAD + popd + else + mkdir -p build + git clone https://github.com/Microsoft/vcpkg build/vcpkg-root + fi + + export VCPKG_ROOT=$(pwd)/build/vcpkg-root + export VCPKG_BINARY_SOURCES="clear;files,$(pwd)/build/vcpkg-binary-cache,readwrite" + + mkdir -p "build/vcpkg-binary-cache" + + echo -e "\e[0Ksection_end:`date +%s`:vcpkg-root\r\e[0K" + - - | # apt_development echo -e "\e[0Ksection_start:`date +%s`:macports_development[collapsed=true]\r\e[0KInstalling development packages" @@ -38,3 +83,33 @@ osxcross x86_64: - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" + + after_script: + - - | + # apt_clean + echo -e "\e[0Ksection_start:`date +%s`:apt_clean[collapsed=true]\r\e[0KCleaning of unneeded APT packages" + - apt-get autoclean + - | + # apt_clean + echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K" + + - - | + # vcpkg_clean + echo -e "\e[0Ksection_start:`date +%s`:vcpkg_clean[collapsed=true]\r\e[0KCleaning vcpkg-root" + + if [ -d "build/vcpkg-root" ]; then + pushd "build/vcpkg-root" + git clean + popd + fi + + echo -e "\e[0Ksection_end:`date +%s`:vcpkg_clean\r\e[0K" + + - - | + # ccache_stats + echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:" + - ccache --show-stats + - ccache --show-log-stats || true + - | + # ccahe_stats + echo -e "\e[0Ksection_end:`date +%s`:ccache_stats\r\e[0K" diff --git a/.gitlab/ci/jobs/windows-x64-makefile.yml b/.gitlab/ci/jobs/windows-x64-makefile.yml new file mode 100644 index 000000000..f28fa219c --- /dev/null +++ b/.gitlab/ci/jobs/windows-x64-makefile.yml @@ -0,0 +1,35 @@ +Windows x64 Makefile: + extends: .srb2ci + + stage: build + + when: manual + + allow_failure: true + + artifacts: + paths: + - "bin/" + - "src/comptime.h" + expose_as: "Win64-makefile" + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win64-makefile" + + variables: + PREFIX: x86_64-w64-mingw32 + + script: + - - | + # apt_toolchain + echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" + - apt-get install gcc-mingw-w64-x86-64-win32 + - | + # apt_toolchain + echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW64=1 SDL=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW64=1 SDL=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/windows-x64.yml b/.gitlab/ci/jobs/windows-x64.yml index da8d960bd..180fa773c 100644 --- a/.gitlab/ci/jobs/windows-x64.yml +++ b/.gitlab/ci/jobs/windows-x64.yml @@ -9,8 +9,8 @@ Windows x64: artifacts: paths: - - "bin/" - - "src/comptime.h" + - "build.cmake/bin/" + - "build.cmake/src/config.h" expose_as: "Win64" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win64" @@ -26,10 +26,26 @@ Windows x64: # apt_toolchain echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K" + - - | + # apt_development + echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages" + - apt-get install ninja-build + - | + # apt_development + echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + + - - | + # cmake + echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake -B build.cmake -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/toolchains/mingw.cmake + - | + # cmake + echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" + - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW64=1 SDL=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW64=1 SDL=1 + - make --directory=build.cmake --keep-going || make --directory=build.cmake --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/windows-x86-makefile.yml b/.gitlab/ci/jobs/windows-x86-makefile.yml new file mode 100644 index 000000000..9601cd6e6 --- /dev/null +++ b/.gitlab/ci/jobs/windows-x86-makefile.yml @@ -0,0 +1,35 @@ +Windows x86 Makefile: + extends: .srb2ci + + stage: build + + when: on_success + + artifacts: + paths: + - "bin/" + - "src/comptime.h" + expose_as: "Win32-makefile" + name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win32-makefile" + + variables: + PREFIX: i686-w64-mingw32 + CC: /usr/bin/i686-w64-mingw32-gcc-posix + CXX: /usr/bin/i686-w64-mingw32-g++-posix + + script: + - - | + # apt_toolchain + echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" + - apt-get install gcc-mingw-w64-i686-win32 + - | + # apt_toolchain + echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K" + + - - | + # make + echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" + - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW=1 SDL=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW=1 SDL=1 + - | + # make + echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" diff --git a/.gitlab/ci/jobs/windows-x86.yml b/.gitlab/ci/jobs/windows-x86.yml index 311c767bb..2d8855085 100644 --- a/.gitlab/ci/jobs/windows-x86.yml +++ b/.gitlab/ci/jobs/windows-x86.yml @@ -3,12 +3,38 @@ Windows x86: stage: build - when: on_success + when: manual + + allow_failure: true + + cache: + - key: ccache-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG + fallback_keys: + - ccache-$CI_JOB_NAME_SLUG-$CI_DEFAULT_BRANCH + - ccache-$CI_JOB_NAME_SLUG-master + paths: + - build/ccache + - build/ccache_statslog + + - key: apt-$CI_JOB_IMAGE + paths: + - build/apt-cache + unprotect: true + + - key: vcpkg-root + paths: + - build/vcpkg-root + unprotect: true + + - key: vcpkg-binary-cache-x86-mingw-static + paths: + - build/vcpkg-binary-cache + unprotect: true artifacts: paths: - - "bin/" - - "src/comptime.h" + - "build/ninja-x86_mingw_static_vcpkg-debug/bin/" + - "build/ninja-x86_mingw_static_vcpkg-debug/src/config.h" expose_as: "Win32" name: "$CI_PROJECT_PATH_SLUG-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-Win32" @@ -18,6 +44,27 @@ Windows x86: CXX: /usr/bin/i686-w64-mingw32-g++-posix script: + - | + # vcpkg + echo -e "\e[0Ksection_start:`date +%s`:vcpkg-root[collapsed=true]\r\e[0KUpdating vcpkg" + + if [ -d "build/vcpkg-root" ]; then + pushd build/vcpkg-root + git fetch https://github.com/Microsoft/vcpkg master + git reset --hard FETCH_HEAD + popd + else + mkdir -p build + git clone https://github.com/Microsoft/vcpkg build/vcpkg-root + fi + + export VCPKG_ROOT=$(pwd)/build/vcpkg-root + export VCPKG_BINARY_SOURCES="clear;files,$(pwd)/build/vcpkg-binary-cache,readwrite" + + mkdir -p "build/vcpkg-binary-cache" + + echo -e "\e[0Ksection_end:`date +%s`:vcpkg-root\r\e[0K" + - - | # apt_toolchain echo -e "\e[0Ksection_start:`date +%s`:apt_toolchain[collapsed=true]\r\e[0KInstalling toolchain packages" @@ -26,10 +73,58 @@ Windows x86: # apt_toolchain echo -e "\e[0Ksection_end:`date +%s`:apt_toolchain\r\e[0K" + - - | + # apt_development + echo -e "\e[0Ksection_start:`date +%s`:apt_development[collapsed=true]\r\e[0KInstalling development packages" + - apt-get install ninja-build + - | + # apt_development + echo -e "\e[0Ksection_end:`date +%s`:apt_development\r\e[0K" + + - - | + # cmake + echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" + # cmake + echo -e "\e[0Ksection_start:`date +%s`:cmake[collapsed=false]\r\e[0KBuilding Makefiles" + - cmake --preset ninja-x86_mingw_static_vcpkg-debug -G "Unix Makefiles" -DSRB2_USE_CCACHE=YES -DSRB2_CONFIG_ERRORMODE=ON -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake + - | + # cmake + echo -e "\e[0Ksection_end:`date +%s`:cmake\r\e[0K" + - - | # make echo -e "\e[0Ksection_start:`date +%s`:make[collapsed=false]\r\e[0KCompiling SRB2" - - make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW=1 SDL=1 || make --directory=src --keep-going CCACHE=1 ERRORMODE=1 MINGW=1 SDL=1 + - cmake --build --preset ninja-x86_mingw_static_vcpkg-debug --parallel 1 -- --keep-going || cmake --build --preset ninja-x86_mingw_static_vcpkg-debug --parallel 1 -- --keep-going - | # make echo -e "\e[0Ksection_end:`date +%s`:make\r\e[0K" + + after_script: + - - | + # apt_clean + echo -e "\e[0Ksection_start:`date +%s`:apt_clean[collapsed=true]\r\e[0KCleaning of unneeded APT packages" + - apt-get autoclean + - | + # apt_clean + echo -e "\e[0Ksection_end:`date +%s`:apt_clean\r\e[0K" + + - - | + # vcpkg_clean + echo -e "\e[0Ksection_start:`date +%s`:vcpkg_clean[collapsed=true]\r\e[0KCleaning vcpkg-root" + + if [ -d "build/vcpkg-root" ]; then + pushd "build/vcpkg-root" + git clean -f + popd + fi + + echo -e "\e[0Ksection_end:`date +%s`:vcpkg_clean\r\e[0K" + + - - | + # ccache_stats + echo -e "\e[0Ksection_start:`date +%s`:ccache_stats[collapsed=true]\r\e[0Kccache statistics:" + - ccache --show-stats + - ccache --show-log-stats || true + - | + # ccahe_stats + echo -e "\e[0Ksection_end:`date +%s`:ccache_stats\r\e[0K" diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b08a9fac..a4c631102 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") include(CMakeDependentOption) +include(CheckCXXCompilerFlag) file(STRINGS src/version.h SRB2_VERSION) string(REGEX MATCH "[0-9]+\\.[0-9.]+" SRB2_VERSION ${SRB2_VERSION}) @@ -72,6 +73,7 @@ option(SRB2_CONFIG_MOBJCONSISTANCY "Compile with MOBJCONSISTANCY defined." OFF) option(SRB2_CONFIG_PACKETDROP "Compile with PACKETDROP defined." OFF) option(SRB2_CONFIG_EXECINFO "Enable stack trace dump support." ON) option(SRB2_CONFIG_ZDEBUG "Compile with ZDEBUG defined." OFF) +option(SRB2_CONFIG_FORCE_NO_MS_BITFIELDS "Compile without -mno-ms-bitfields compiler flag" OFF) # SRB2_CONFIG_PROFILEMODE is probably superceded by some CMake setting. option(SRB2_CONFIG_PROFILEMODE "Compile for profiling (GCC only)." OFF) set(SRB2_CONFIG_ASSET_DIRECTORY "" CACHE PATH "Path to directory that contains all asset files for the installer. If set, assets will be part of installation and cpack.") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fbd29cddd..2cfb56f6e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -234,9 +234,12 @@ endif() # Compatibility flag with later versions of GCC # We should really fix our code to not need this -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|x64|amd64|AMD64|em64t|EM64T)") - target_compile_options(SRB2SDL2 PRIVATE -mno-ms-bitfields) +if (NOT SRB2_CONFIG_FORCE_NO_MS_BITFIELDS) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + check_cxx_compiler_flag("-mno-ms-bitfields" HAS_NO_MS_BITFIELDS) + if(HAS_NO_MS_BITFIELDS) + target_compile_options(SRB2SDL2 PRIVATE -mno-ms-bitfields) + endif() endif() endif() diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 99425108e..8950846ee 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -14,8 +14,13 @@ target_sources(SRB2SDL2 PRIVATE # Compatibility flag with later versions of GCC # We should really fix our code to not need this -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - target_compile_options(SRB2SDL2 PRIVATE -mno-ms-bitfields) +if (NOT SRB2_CONFIG_FORCE_NO_MS_BITFIELDS) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + check_cxx_compiler_flag("-mno-ms-bitfields" HAS_NO_MS_BITFIELDS) + if(HAS_NO_MS_BITFIELDS) + target_compile_options(SRB2SDL2 PRIVATE -mno-ms-bitfields) + endif() + endif() endif() # Yes we know we use insecure CRT functions... From 019fe32a414aa7d2116a8256d10fe6d903f90185 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Tue, 21 Jan 2025 19:14:55 -0300 Subject: [PATCH 339/353] Update asset hashes --- src/config.h.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index a6dabcbaf..ebbd6b8ac 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -41,12 +41,13 @@ * Last updated 2023 / 09 / 06 - v2.2.12 - patch.pk3 * Last updated 2023 / 09 / 09 - v2.2.13 - none * Last updated 2025 / 01 / 16 - v2.2.14 - main assets + * Last updated 2025 / 01 / 21 - v2.2.15 - main assets */ -#define ASSET_HASH_SRB2_PK3 "c1d9a4b3452b350d4662f41eb301dc6c" -#define ASSET_HASH_ZONES_PK3 "2ab758817fff96bc60ee9dec85e0b534" -#define ASSET_HASH_CHARACTERS_PK3 "97ce7008d16152731fe037141309aa24" +#define ASSET_HASH_SRB2_PK3 "b3e3431983a9b16817fd11dbbaec65e4" +#define ASSET_HASH_ZONES_PK3 "5ba928b05eda4a13154edd6699118414" +#define ASSET_HASH_CHARACTERS_PK3 "5f184b8ba0560b32ae342c231e9c6f9a" #ifdef USE_PATCH_DTA -#define ASSET_HASH_PATCH_PK3 "3c7b73f34af7e9a7bceb2d5260f76172" +#define ASSET_HASH_PATCH_PK3 "00000000000000000000000000000000" #endif #endif From 4258e898ff48365dd202841442a02a156153242c Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 21 Jan 2025 23:26:47 -0500 Subject: [PATCH 340/353] whitespace cleanup --- extras/conf/SRB2-22.cfg | 6 +- extras/conf/udb/Includes/SRB222_common.cfg | 4 +- extras/conf/udb/Includes/SRB222_linedefs.cfg | 4 +- extras/conf/udb/Includes/SRB222_misc.cfg | 58 ++++++++++---------- extras/conf/udb/Includes/SRB222_things.cfg | 36 ++++++------ extras/conf/udb/SRB2-22binary.cfg | 6 +- src/command.c | 2 +- src/d_player.h | 2 +- src/d_ticcmd.h | 4 +- src/dedicated/i_system.c | 1 - src/dedicated/i_video.c | 3 +- src/deh_tables.c | 2 +- src/filesrch.c | 2 +- src/hardware/hw_main.c | 14 ++--- src/hardware/hw_md2.c | 4 +- src/hardware/r_opengl/r_opengl.c | 2 +- src/hu_stuff.c | 6 +- src/info.c | 2 +- src/info.h | 2 +- src/lua_baselib.c | 8 +-- src/m_cond.c | 2 +- src/m_random.c | 4 +- src/p_enemy.c | 4 +- src/p_inter.c | 6 +- src/p_mobj.c | 4 +- src/p_slopes.c | 2 +- src/p_spec.c | 2 +- src/p_user.c | 2 +- src/r_bbox.c | 2 +- src/r_main.c | 6 +- src/r_textures.c | 4 +- src/st_stuff.c | 2 +- src/string.c | 3 +- src/v_video.c | 10 ++-- src/y_inter.c | 2 +- thirdparty/curl.cmake | 1 - thirdparty/sdl2-mixer-ext.cmake | 1 - thirdparty/zlib.cmake | 1 - 38 files changed, 110 insertions(+), 116 deletions(-) diff --git a/extras/conf/SRB2-22.cfg b/extras/conf/SRB2-22.cfg index 41ad99889..7ef5ab1e1 100644 --- a/extras/conf/SRB2-22.cfg +++ b/extras/conf/SRB2-22.cfg @@ -41,7 +41,7 @@ linetagindicatesectors = true; // The format interface handles the map data format - DoomMapSetIO for SRB2DB2, SRB2MapSetIO for Zone Builder formatinterface = "SRB2MapSetIO"; - + //Maximum safe map size check (0 means skip check) safeboundary = 0; @@ -502,7 +502,7 @@ gen_sectortypes { 0 = "Normal"; 512 = "Wind/Current "; - 1024 = "Conveyor Belt "; + 1024 = "Conveyor Belt "; 1280 = "Speed Pad"; 1536 = "Flip Gravity on Jump"; } @@ -3730,7 +3730,7 @@ thingtypes 3328 = "3D Mode Start"; } - + starts { color = 1; // Blue diff --git a/extras/conf/udb/Includes/SRB222_common.cfg b/extras/conf/udb/Includes/SRB222_common.cfg index e5cafead4..9bf882f56 100644 --- a/extras/conf/udb/Includes/SRB222_common.cfg +++ b/extras/conf/udb/Includes/SRB222_common.cfg @@ -96,7 +96,7 @@ mapformat_udmf { include("SRB222_misc.cfg", "universalfields"); } - + // Disable Doom-related modes that don't make sense for SRB2 soundsupport = false; automapsupport = false; @@ -195,4 +195,4 @@ mapformat_udmf { include("SRB222_linedefs.cfg", "udmf"); } -} \ No newline at end of file +} diff --git a/extras/conf/udb/Includes/SRB222_linedefs.cfg b/extras/conf/udb/Includes/SRB222_linedefs.cfg index fc505fb60..ce1979581 100644 --- a/extras/conf/udb/Includes/SRB222_linedefs.cfg +++ b/extras/conf/udb/Includes/SRB222_linedefs.cfg @@ -8,7 +8,7 @@ udmf { title = "None"; } - + 6 { title = "Sector Set Portal"; @@ -897,7 +897,7 @@ udmf } } } - + 190 { title = "Rising"; diff --git a/extras/conf/udb/Includes/SRB222_misc.cfg b/extras/conf/udb/Includes/SRB222_misc.cfg index c37c29ce0..e5786977b 100644 --- a/extras/conf/udb/Includes/SRB222_misc.cfg +++ b/extras/conf/udb/Includes/SRB222_misc.cfg @@ -240,7 +240,7 @@ universalfields type = 1; default = 1.0; } - + comment { type = 2; @@ -252,19 +252,19 @@ universalfields type = 2; default = ""; } - + stringarg0 { type = 2; default = ""; } - + stringarg1 { type = 2; default = ""; } - + executordelay { type = 0; @@ -279,19 +279,19 @@ universalfields type = 2; default = ""; } - + light { type = 0; default = 0; } - + lightabsolute { type = 3; default = false; } - + //light_top //{ // type = 0; @@ -326,8 +326,8 @@ universalfields //{ // type = 3; // default = false; - //} - + //} + offsetx_bottom { type = 1; @@ -339,7 +339,7 @@ universalfields type = 1; default = 0.0; } - + offsetx_top { type = 1; @@ -357,43 +357,43 @@ universalfields type = 1; default = 0.0; } - + offsety_top { type = 1; default = 0.0; } - + scalex_bottom { type = 1; default = 1.0; } - + scalex_mid { type = 1; default = 1.0; } - + scalex_top { type = 1; default = 1.0; } - + scaley_bottom { type = 1; default = 1.0; } - + scaley_mid { type = 1; default = 1.0; } - + scaley_top { type = 1; @@ -408,41 +408,41 @@ universalfields type = 2; default = ""; } - + pitch { type = 0; } - + roll { type = 0; } - + scalex { type = 1; default = 1.0; } - + scaley { type = 1; default = 1.0; } - + stringarg0 { type = 2; default = ""; } - + stringarg1 { type = 2; default = ""; } - + mobjscale { type = 1; @@ -450,7 +450,7 @@ universalfields managed = false; } } - + sector { comment @@ -530,7 +530,7 @@ universalfields type = 1; default = 1.0; } - + yscalefloor { type = 1; @@ -542,7 +542,7 @@ universalfields type = 0; default = 0; } - + lightfloorabsolute { type = 3; @@ -572,7 +572,7 @@ universalfields type = 1; default = 1.0; } - + yscaleceiling { type = 1; @@ -584,7 +584,7 @@ universalfields type = 0; default = 0; } - + lightceilingabsolute { type = 3; diff --git a/extras/conf/udb/Includes/SRB222_things.cfg b/extras/conf/udb/Includes/SRB222_things.cfg index c028f9439..8b1e29751 100644 --- a/extras/conf/udb/Includes/SRB222_things.cfg +++ b/extras/conf/udb/Includes/SRB222_things.cfg @@ -1127,12 +1127,12 @@ udmf } } } - + bossinvisibles { title = "Misc. Invisible"; color = 15; // White - + 290 { arrow = 0; @@ -2021,7 +2021,7 @@ udmf } } } - + hazards { color = 17; // Orange @@ -2983,7 +2983,7 @@ udmf { title = "Mace Spawnpoints"; color = 11; - + 1104 { title = "Mace Spawn"; @@ -3188,7 +3188,7 @@ udmf title = "Flags"; type = 12; enum = "maceflags"; - + } } 1108 @@ -3320,7 +3320,7 @@ udmf } } } - + 1100 { title = "Chain (Decorative)"; @@ -3570,12 +3570,12 @@ udmf color = 2; // Green title = "Arid Canyon"; - + cacti { title = "Cacti"; color = 17; - + 1203 { title = "Tiny Red Flower Cactus"; @@ -3654,12 +3654,12 @@ udmf height = 60; } } - + minecarts { title = "Minecart"; color = 11; - + 1219 { title = "Minecart Spawner"; @@ -3706,7 +3706,7 @@ udmf } } } - + 1200 { title = "Tumbleweed (Big)"; @@ -4611,7 +4611,7 @@ udmf title = "Botanic Serenity"; width = 16; height = 32; - + flowers { title = "Flowers"; @@ -4706,7 +4706,7 @@ udmf sprite = "BSZ3F0"; } } - + tulips { title = "Tulips"; @@ -4771,7 +4771,7 @@ udmf sprite = "BSZ5F0"; } } - + bushes { title = "Bushes"; @@ -4806,7 +4806,7 @@ udmf sprite = "BSZ6F0"; } } - + vines { title = "Vines"; @@ -5063,7 +5063,7 @@ udmf } } } - + mario { color = 2; // Green @@ -5574,7 +5574,7 @@ udmf } } } - + editor { color = 15; // White @@ -5587,4 +5587,4 @@ udmf 3328 = "3D Mode Start"; } -} \ No newline at end of file +} diff --git a/extras/conf/udb/SRB2-22binary.cfg b/extras/conf/udb/SRB2-22binary.cfg index 3073b76c4..2144ff7a6 100644 --- a/extras/conf/udb/SRB2-22binary.cfg +++ b/extras/conf/udb/SRB2-22binary.cfg @@ -41,7 +41,7 @@ linetagindicatesectors = true; // The format interface handles the map data format - DoomMapSetIO for SRB2DB2, SRB2MapSetIO for Zone Builder formatinterface = "DoomMapSetIO"; - + //Maximum safe map size check (0 means skip check) safeboundary = 0; @@ -502,7 +502,7 @@ gen_sectortypes { 0 = "Normal"; 512 = "Wind/Current "; - 1024 = "Conveyor Belt "; + 1024 = "Conveyor Belt "; 1280 = "Speed Pad"; 1536 = "Flip Gravity on Jump"; } @@ -3636,7 +3636,7 @@ thingtypes 3328 = "3D Mode Start"; } - + starts { color = 1; // Blue diff --git a/src/command.c b/src/command.c index 29f491e29..ab6cfc08a 100644 --- a/src/command.c +++ b/src/command.c @@ -705,7 +705,7 @@ static void add_alias(char *newname, char *newcmd) { if (!stricmp(newname, a->name)) { - Z_Free(a->value); // Free old cmd + Z_Free(a->value); // Free old cmd a->value = newcmd; return; } diff --git a/src/d_player.h b/src/d_player.h index 5f5bf53d6..3c6df8ec0 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -158,7 +158,7 @@ typedef enum PF_FORCESTRAFE = 1<<28, // Turning inputs are translated into strafing inputs PF_CANCARRY = 1<<29, // Can carry another player? PF_FINISHED = 1<<30, // The player finished the level. NOT the same as exiting - + // True if shield button down last tic // This may be the final flag, but 2.3 could free up the others PF_SHIELDDOWN = 1<<31, diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h index 43eb0f00b..0f1eca460 100644 --- a/src/d_ticcmd.h +++ b/src/d_ticcmd.h @@ -28,7 +28,7 @@ typedef enum { // First 3 bits are weapon change info, DO NOT USE! BT_WEAPONMASK = 0x07, //our first three bits. - + BT_SHIELD = 1<<3, // shield or super action BT_WEAPONNEXT = 1<<4, // select next weapon @@ -41,7 +41,7 @@ typedef enum BT_TOSSFLAG = 1<<10, // toss flag or emeralds BT_JUMP = 1<<11, // jump action BT_FIRENORMAL = 1<<12, // fire a normal ring no matter what - + // custom lua buttons BT_CUSTOM1 = 1<<13, BT_CUSTOM2 = 1<<14, diff --git a/src/dedicated/i_system.c b/src/dedicated/i_system.c index ab872713a..643e24f5a 100644 --- a/src/dedicated/i_system.c +++ b/src/dedicated/i_system.c @@ -1573,4 +1573,3 @@ boolean I_GetTextInputMode(void) } #include "../sdl/dosstr.c" - diff --git a/src/dedicated/i_video.c b/src/dedicated/i_video.c index 2c998117a..19f2d0cbd 100644 --- a/src/dedicated/i_video.c +++ b/src/dedicated/i_video.c @@ -1,4 +1,4 @@ -#include "../doomdef.h" +#include "../doomdef.h" #include "../command.h" #include "../i_video.h" @@ -76,4 +76,3 @@ void I_ReadScreen(UINT8 *scr) void I_BeginRead(void){} void I_EndRead(void){} - diff --git a/src/deh_tables.c b/src/deh_tables.c index ed6648d83..712886be8 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -3371,7 +3371,7 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi "S_SPEEDWINGS", "S_SPEEDWINGSD", - + "S_PARTICLEPICKUP1", "S_PARTICLEPICKUP2", "S_1000SCOREAWARD", diff --git a/src/filesrch.c b/src/filesrch.c index 67a2e8976..7f104f8ca 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -698,7 +698,7 @@ static void initdirpath(char *dirpath, size_t *dirpathindex, int depthleft) dirpathindex[depthleft]--; } -//sortdir by name? +//sortdir by name? static int lumpnamecompare(const void *A, const void *B) { const lumpinfo_t *pA = A; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index e426bcddd..a5befe112 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -2491,16 +2491,16 @@ static void HWR_Subsector(size_t num) rover; rover = rover->next) { fixed_t bottomCullHeight, topCullHeight, centerHeight; - + if (!(rover->fofflags & FOF_EXISTS) || !(rover->fofflags & FOF_RENDERPLANES)) continue; if (sub->validcount == validcount) continue; - + // rendering heights for bottom and top planes bottomCullHeight = P_GetFFloorBottomZAt(rover, viewx, viewy); topCullHeight = P_GetFFloorTopZAt(rover, viewx, viewy); - + if (gl_frontsector->cullheight) { if (HWR_DoCulling(gl_frontsector->cullheight, viewsector->cullheight, gl_viewz, FIXED_TO_FLOAT(*rover->bottomheight), FIXED_TO_FLOAT(*rover->topheight))) @@ -3105,7 +3105,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) // baseWallVerts is used to know the final shape to easily get the vertex // co-ordinates memcpy(wallVerts, baseWallVerts, sizeof(baseWallVerts)); - + fixed_t newalpha = spr->mobj->alpha; // if sprite has linkdraw, then dont write to z-buffer (by not using PF_Occlude) @@ -3150,7 +3150,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr) blend = HWR_GetBlendModeFlag(blendmode)|occlusion; if (!occlusion) use_linkdraw_hack = true; } - + Surf.PolyColor.s.alpha = FixedMul(newalpha, Surf.PolyColor.s.alpha); if (HWR_UseShader()) @@ -3349,7 +3349,7 @@ static void HWR_DrawBoundingBox(gl_vissprite_t *vis) v[15].y = v[16].y = v[17].y = v[21].y = v[22].y = v[23].y = vis->gzt; // top Surf.PolyColor = V_GetColor(R_GetBoundingBoxColor(vis->mobj)); - + HWR_ProcessPolygon(&Surf, v, 24, (cv_renderhitboxgldepth.value ? 0 : PF_NoDepthTest)|PF_Modulated|PF_NoTexture|PF_WireFrame, SHADER_NONE, false); } @@ -3645,7 +3645,7 @@ static void HWR_DrawSprite(gl_vissprite_t *spr) blend = HWR_GetBlendModeFlag(blendmode)|occlusion; if (!occlusion) use_linkdraw_hack = true; } - + Surf.PolyColor.s.alpha = FixedMul(newalpha, Surf.PolyColor.s.alpha); if (spr->renderflags & RF_SHADOWEFFECTS) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index 011b478e5..931867142 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1373,7 +1373,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) // Apparently people don't like jump frames like that, so back it goes if (tics > durs) durs = tics; - + // Make linkdraw objects use their tracer's alpha value fixed_t newalpha = spr->mobj->alpha; if ((spr->mobj->flags2 & MF2_LINKDRAW) && spr->mobj->tracer) @@ -1392,7 +1392,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) Surf.PolyColor.s.alpha = (spr->mobj->flags2 & MF2_SHADOW) ? 0x40 : 0xff; Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode); } - + Surf.PolyColor.s.alpha = FixedMul(newalpha, Surf.PolyColor.s.alpha); // don't forget to enable the depth test because we can't do this diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index e11dd4f16..02a32957a 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -713,7 +713,7 @@ EXPORT boolean HWRAPI(InitShaders) (void) #ifdef GL_SHADERS if (!pglUseProgram) return false; - + gl_fallback_shader.vertex_shader = Z_StrDup(GLSL_FALLBACK_VERTEX_SHADER); gl_fallback_shader.fragment_shader = Z_StrDup(GLSL_FALLBACK_FRAGMENT_SHADER); diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 081a30ef8..e30025bda 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1289,7 +1289,7 @@ static void HU_drawMiniChat(void) V_DrawChatCharacter(x + dx + 2, y+dy, msg[j] |V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_MONOSPACE|transflag, true, colormap); dx += charwidth; - + if (dx >= boxw-charwidth-2) { dx = 0; @@ -1540,9 +1540,9 @@ static void HU_DrawChat(void) else if ((n == 1) && !(w_chat[3] == '0') && (!((i == 1) || ((i >= 10) && (i <= 19))))) continue; else if ((n == 2) && !(w_chat[3] == '0') && (!((i == 2) || ((i >= 20) && (i <= 29))))) - continue; + continue; else if ((n == 3) && !(w_chat[3] == '0') && (!((i == 3) || ((i >= 30) && (i <= 31))))) - continue; + continue; else // general case. if (i != n) continue; } diff --git a/src/info.c b/src/info.c index cf635c011..0359070de 100644 --- a/src/info.c +++ b/src/info.c @@ -3395,7 +3395,7 @@ state_t states[NUMSTATES] = {SPR_MSWB, 3, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE4, 0}, // S_HORIZBLUETRAMPOLINE3 {SPR_MSWB, 2, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE5, 0}, // S_HORIZBLUETRAMPOLINE4 {SPR_MSWB, 1, 1, {NULL}, 0, 0, S_HORIZBLUETRAMPOLINE, 0}, // S_HORIZBLUETRAMPOLINE5 - + // Yellow diagonal trampoline {SPR_MDIY, 0, -1, {NULL}, 0, 0, S_NULL, 0}, // S_DIAGYELLOWTRAMPOLINE {SPR_MDIY, 4, 4, {A_Pain}, 0, 0, S_DIAGYELLOWTRAMPOLINE3, 0}, // S_DIAGYELLOWTRAMPOLINE2 diff --git a/src/info.h b/src/info.h index bf8306887..225f45f66 100644 --- a/src/info.h +++ b/src/info.h @@ -4231,7 +4231,7 @@ typedef enum state S_SPEEDWINGS, S_SPEEDWINGSD, - + S_PARTICLEPICKUP1, S_PARTICLEPICKUP2, S_1000SCOREAWARD, diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 0d828df85..ecd1ee55e 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1987,7 +1987,7 @@ static int lib_pLineIsBlocking(lua_State *L) return LUA_ErrInvalid(L, "mobj_t"); if (!line) return LUA_ErrInvalid(L, "line_t"); - + // P_LineOpening in P_LineIsBlocking sets these variables. // We want to keep their old values after so that whatever // map collision code uses them doesn't get messed up. @@ -2000,9 +2000,9 @@ static int lib_pLineIsBlocking(lua_State *L) pslope_t *oldopenbottomslope = openbottomslope; ffloor_t *oldopenfloorrover = openfloorrover; ffloor_t *oldopenceilingrover = openceilingrover; - + lua_pushboolean(L, P_LineIsBlocking(mo, line)); - + opentop = oldopentop; openbottom = oldopenbottom; openrange = oldopenrange; @@ -2012,7 +2012,7 @@ static int lib_pLineIsBlocking(lua_State *L) openbottomslope = oldopenbottomslope; openfloorrover = oldopenfloorrover; openceilingrover = oldopenceilingrover; - + return 1; } diff --git a/src/m_cond.c b/src/m_cond.c index 418b2ff2b..9706f76c8 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -475,7 +475,7 @@ UINT8 M_MapLocked(INT32 mapnum, gamedata_t *data) // that's better than making dedicated server's lives hell. return false; } - + if (cv_debug || devparm) return false; // Unlock every level when in devmode. diff --git a/src/m_random.c b/src/m_random.c index 536fbfbbd..a063e88f4 100644 --- a/src/m_random.c +++ b/src/m_random.c @@ -193,9 +193,9 @@ INT32 M_RandomKey(INT32 a) */ INT32 M_RandomRange(INT32 a, INT32 b) { - if (b < a) + if (b < a) { - INT32 temp; + INT32 temp; temp = a; a = b; diff --git a/src/p_enemy.c b/src/p_enemy.c index 9ebd32069..568483d58 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3922,7 +3922,7 @@ static void P_DoBoss5Death(mobj_t *mo) pole->angle = mo->tracer->angle; pole->momx = P_ReturnThrustX(pole, pole->angle, speed); pole->momy = P_ReturnThrustY(pole, pole->angle, speed); - + P_SetTarget(&pole->tracer, P_SpawnMobj( pole->x, pole->y, pole->z - 256*FRACUNIT, @@ -8333,7 +8333,7 @@ void A_Shockwave(mobj_t *actor) ang += interval; sprev = shock; } - + S_StartSound(actor, shock->info->seesound); } diff --git a/src/p_inter.c b/src/p_inter.c index 0e63fea1b..27e612154 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -538,14 +538,14 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if ((P_MobjFlip(toucher)*toucher->momz < 0) && (elementalpierce != 1) && (!(player->powers[pw_strong] & STR_HEAVY))) { 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! @@ -2572,7 +2572,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget if (!(target->flags2 & MF2_DONTRESPAWN)) { if (!(netgame || multiplayer)) - target->fuse = atoi(cv_itemrespawntime.defaultvalue)*TICRATE + 2; + target->fuse = atoi(cv_itemrespawntime.defaultvalue)*TICRATE + 2; else if (cv_itemrespawn.value) target->fuse = cv_itemrespawntime.value*TICRATE + 2; } diff --git a/src/p_mobj.c b/src/p_mobj.c index aa846a93c..7172b275b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6660,12 +6660,12 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) if (scale < 1) { P_SetScale(thing, thing->target->scale, true); thing->old_scale = thing->target->old_scale; - + thing->flags2 |= (MF2_DONTDRAW|MF2_JUSTATTACKED); //Hide and indicate we're hidden } else { P_SetScale(thing, scale, true); thing->old_scale = FixedMul(thing->target->old_scale, thing->target->player->shieldscale); - + //Only unhide if we were hidden by the above code if (thing->flags2 & MF2_JUSTATTACKED) thing->flags2 &= ~(MF2_DONTDRAW|MF2_JUSTATTACKED); diff --git a/src/p_slopes.c b/src/p_slopes.c index 7f070e2a1..739032936 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -181,7 +181,7 @@ void T_DynamicSlopeLine (dynlineplanethink_t* th) { pslope_t* slope = th->slope; line_t* srcline = th->sourceline; - + fixed_t zdelta, oldoz = slope->o.z; switch(th->type) { diff --git a/src/p_spec.c b/src/p_spec.c index e402180fe..529a60a10 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2406,7 +2406,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec) z = line->args[4] << FRACBITS; P_SetOrigin(mo, mo->x + x, mo->y + y, mo->z + z); - + if (mo->player) { if (bot) // This might put poor Tails in a wall if he's too far behind! D: But okay, whatever! >:3 diff --git a/src/p_user.c b/src/p_user.c index bb5d8f44f..5fc77106a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -978,7 +978,7 @@ boolean P_PlayerInPain(player_t *player) { if (P_MobjWasRemoved(player->mo)) return false; - + // no silly, sliding isn't pain if (!(player->pflags & PF_SLIDING) && player->mo->state == &states[player->mo->info->painstate] && player->powers[pw_flashing]) return true; diff --git a/src/r_bbox.c b/src/r_bbox.c index 8ccad2bb5..93fa2dca2 100644 --- a/src/r_bbox.c +++ b/src/r_bbox.c @@ -275,7 +275,7 @@ boolean R_ThingBoundingBoxVisible(mobj_t *thing) switch (thing->type) { default: - // First person / awayviewmobj -- rendering a bbox + // First person / awayviewmobj -- rendering a bbox // too close to the viewpoint causes anomalies // and these are exactly on the viewpoint! if (thing != r_viewmobj) diff --git a/src/r_main.c b/src/r_main.c index ee05876da..46bac9dc7 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1095,7 +1095,7 @@ void R_SetupFrame(player_t *player) camera_t *thiscam; boolean chasecam = R_ViewpointHasChasecam(player); boolean ispaused = paused || P_AutoPause(); - + if (splitscreen && player == &players[secondarydisplayplayer] && player != &players[consoleplayer]) thiscam = &camera2; else @@ -1375,7 +1375,7 @@ boolean R_ViewpointHasChasecam(player_t *player) chasecam = true; // force chasecam on else if (player->spectator) // no spectator chasecam chasecam = false; // force chasecam off - + if (chasecam && !thiscam->chase) { P_ResetCamera(player, thiscam); @@ -1386,7 +1386,7 @@ boolean R_ViewpointHasChasecam(player_t *player) P_ResetCamera(player, thiscam); thiscam->chase = false; } - + if (isplayer2) { R_SetViewContext(VIEWCONTEXT_PLAYER2); diff --git a/src/r_textures.c b/src/r_textures.c index bd22a2df1..4c52f75eb 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -1110,7 +1110,7 @@ static lumpnum_t W_GetTexPatchLumpNum(const char *name) lumpnum_t lump = LUMPERROR; INT32 lump_type_it; - + for (lump_type_it = 0; lump_type_it < USE__MAX; lump_type_it++) { @@ -1716,7 +1716,7 @@ const char *R_CheckTextureNameForNum(INT32 num) { if (num > 0 && num < numtextures) return textures[num]->name; - + return "-"; } diff --git a/src/st_stuff.c b/src/st_stuff.c index 391d038a4..23f2f3b29 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2822,7 +2822,7 @@ static void ST_overlayDrawer(void) } else if (cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerups)) ST_drawPowerupHUD(); // same as it ever was... - + } else if (!(netgame || multiplayer) && cv_powerupdisplay.value == 2 && LUA_HudEnabled(hud_powerups)) ST_drawPowerupHUD(); // same as it ever was... diff --git a/src/string.c b/src/string.c index c5d95b224..79573283e 100644 --- a/src/string.c +++ b/src/string.c @@ -83,7 +83,7 @@ char *xstrtok(char *line, const char *delims) return NULL; p = saveline; // save start of this token - + saveline += strcspn(saveline, delims); // get the number of non-delims characters, go past delimiter if(*saveline != '\0') // trash the delim if necessary @@ -91,4 +91,3 @@ char *xstrtok(char *line, const char *delims) return p; } - diff --git a/src/v_video.c b/src/v_video.c index 42a4aaa00..39a1001d1 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1137,7 +1137,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c) } #endif - + if (splitscreen && (c & V_PERPLAYER)) { @@ -1953,7 +1953,7 @@ char *V_FontWordWrap(INT32 x, INT32 w, INT32 option, fixed_t scale, const char * INT32 spacewidth = font.spacewidth, charwidth = 0; slen = strlen(string); - + if (w == 0) w = BASEVIDWIDTH; w -= x; @@ -2131,7 +2131,7 @@ void V_DrawAlignedFontStringAtFixed(fixed_t x, fixed_t y, INT32 option, fixed_t lx = x - (V_FontStringWidth(line, option, font)*pscale); break; } - + V_DrawFontStringAtFixed(lx, ly, option, pscale, vscale, line, font); ly += FixedMul(((option & V_RETURN8) ? 8 : font.linespacing)< MAXSCORE) players[i].score = MAXSCORE; diff --git a/thirdparty/curl.cmake b/thirdparty/curl.cmake index 5c3aa26e3..7b6c3a299 100644 --- a/thirdparty/curl.cmake +++ b/thirdparty/curl.cmake @@ -55,4 +55,3 @@ else() endif() FetchContent_MakeAvailable(curl) - diff --git a/thirdparty/sdl2-mixer-ext.cmake b/thirdparty/sdl2-mixer-ext.cmake index a52b11584..1998a7bd9 100644 --- a/thirdparty/sdl2-mixer-ext.cmake +++ b/thirdparty/sdl2-mixer-ext.cmake @@ -36,4 +36,3 @@ FetchContent_Declare( ) FetchContent_MakeAvailable(SDL2_mixer_ext) - diff --git a/thirdparty/zlib.cmake b/thirdparty/zlib.cmake index 257609f77..50c567dda 100644 --- a/thirdparty/zlib.cmake +++ b/thirdparty/zlib.cmake @@ -33,4 +33,3 @@ FetchContent_MakeAvailable(ZLIB) add_library(ZLIB::ZLIB ALIAS zlibstatic) set(ZLIB_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/zlib" "${zlib_BINARY_DIR}" CACHE PATH "" FORCE) - From a286790510920fadc1ade721b7e5148744fa802b Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Wed, 22 Jan 2025 00:43:22 -0500 Subject: [PATCH 341/353] whitespace cleanup in next --- src/y_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index d1cdb6b12..086c0d860 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1648,7 +1648,7 @@ static void Y_CalculateMatchWinners(void) data.match.scores[data.match.numplayers] = players[i].score; data.match.color[data.match.numplayers] = &players[i].skincolor; if (data.match.ctfteam[data.match.numplayers] == 1) // red team - data.match.color[data.match.numplayers] = &skincolor_redteam; + data.match.color[data.match.numplayers] = &skincolor_redteam; if (data.match.ctfteam[data.match.numplayers] == 2) // blue team data.match.color[data.match.numplayers] = &skincolor_blueteam; From c09bdf5407697a7f9ffca1c11ecec81b5245c866 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 22 Jan 2025 20:47:39 -0300 Subject: [PATCH 342/353] Revert "Merge branch 'shield-button-prompt' into 'next'" This reverts commit 3849ba65aa6a1f9ddd4f4baebb5bc8d61a772cab, reversing changes made to 2ac80138a8efc2bec6b8872eb2f202da3e49796e. --- src/m_menu.c | 238 --------------------------------------------------- src/m_menu.h | 1 - src/m_misc.c | 5 -- 3 files changed, 244 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index e345a6a87..c38459fe0 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -140,7 +140,6 @@ static char *char_notes = NULL; boolean menuactive = false; boolean fromlevelselect = false; -tic_t shieldprompt_timer = 0; // Show a prompt about the new Shield button for old configs // TODO: 2.3: Remove typedef enum { @@ -3162,7 +3161,6 @@ static void Command_Manual_f(void) if (modeattacking) return; M_StartControlPanel(); - if (shieldprompt_timer) return; // TODO: 2.3: Delete this line currentMenu = &MISC_HelpDef; itemOn = 0; } @@ -3342,7 +3340,6 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); - if (shieldprompt_timer) return true; // TODO: 2.3: Delete this line M_Options(0); // Uncomment the below if you want the menu to reset to the top each time like before. M_SetupNextMenu will fix it automatically. //OP_SoundOptionsDef.lastOn = 0; @@ -3353,7 +3350,6 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); - if (shieldprompt_timer) return true; // TODO: 2.3: Delete this line M_Options(0); M_VideoModeMenu(0); return true; @@ -3365,7 +3361,6 @@ boolean M_Responder(event_t *ev) if (modeattacking) return true; M_StartControlPanel(); - if (shieldprompt_timer) return true; // TODO: 2.3: Delete this line M_Options(0); M_SetupNextMenu(&OP_MainDef); return true; @@ -3643,230 +3638,6 @@ void M_Drawer(void) } } -// Handle the "Do you want to assign Shield Ability now?" pop-up for old configs // TODO: 2.3: Remove this line... -static UINT8 shieldprompt_currentchoice = 0; // ...and this line... - -static void M_ShieldPromptUseDefaults(void) // ...and this function -{ - // With a default config from v2.2.10 to v2.2.13, the B button will be set to Custom 1, - // and Controls per Key defaults to "One", so it will override the default Shield button. - // A default config from v2.2.0 to v2.2.9 has Next Weapon on B, so it suffers from this too. - - // So for "Use default Shield Ability buttons", we should update old configs to mitigate gamepad conflicts - // (even with "Several" Controls per Key!), and show a message with the default bindings - - for (setupcontrols = gamecontrol; true; setupcontrols = gamecontrolbis) // Do stuff for both P1 and P2 - { - INT32 JOY1 = (setupcontrols == gamecontrol) ? KEY_JOY1 : KEY_2JOY1; // Is this for P1 or for P2? - - if ((setupcontrols[GC_CUSTOM1][0] == JOY1+1 || setupcontrols[GC_CUSTOM1][1] == JOY1+1) - && (setupcontrols[GC_CUSTOM2][0] == JOY1+3 || setupcontrols[GC_CUSTOM2][1] == JOY1+3) - && (setupcontrols[GC_CUSTOM3][0] == JOY1+8 || setupcontrols[GC_CUSTOM3][1] == JOY1+8)) - { - // If the player has v2.2.13's default gamepad Custom 1/2/3 buttons, - // shuffle Custom 1/2/3 around to make room for Shield Ability on B - UINT8 shield_slot = (setupcontrols[GC_SHIELD ][0] == KEY_NULL ) ? 0 : 1; - UINT8 custom1_slot = (setupcontrols[GC_CUSTOM1][0] == JOY1+1) ? 0 : 1; - UINT8 custom2_slot = (setupcontrols[GC_CUSTOM2][0] == JOY1+3) ? 0 : 1; - UINT8 custom3_slot = (setupcontrols[GC_CUSTOM3][0] == JOY1+8) ? 0 : 1; - - setupcontrols[GC_SHIELD ][shield_slot ] = JOY1+1; // Assign Shield Ability to B - setupcontrols[GC_CUSTOM1][custom1_slot] = JOY1+3; // Move Custom 1 from B to Y - setupcontrols[GC_CUSTOM2][custom2_slot] = JOY1+8; // Move Custom 2 from Y to LS - setupcontrols[GC_CUSTOM3][custom3_slot] = KEY_NULL; // Unassign Custom 3 from LS... - // (The alternative would be to check and update the ENTIRE gamepad layout. - // That'd be nice, but it would mess with people that are used to the old defaults.) - } - else if ((setupcontrols[GC_WEAPONNEXT][0] == JOY1+1 || setupcontrols[GC_WEAPONNEXT][1] == JOY1+1) - && (setupcontrols[GC_WEAPONPREV][0] == JOY1+2 || setupcontrols[GC_WEAPONPREV][1] == JOY1+2)) - { - // Or if the user has a default config from v2.2.0 to v2.2.9, - // the B button will be Next Weapon, and X will be Previous Weapon. - // It's "safe" to discard one of them, you just have to press X multiple times to select in the other direction - UINT8 shield_slot = (setupcontrols[GC_SHIELD ][0] == KEY_NULL ) ? 0 : 1; - UINT8 nweapon_slot = (setupcontrols[GC_WEAPONNEXT][0] == JOY1+1) ? 0 : 1; - UINT8 pweapon_slot = (setupcontrols[GC_WEAPONPREV][0] == JOY1+2) ? 0 : 1; - - setupcontrols[GC_SHIELD ][shield_slot ] = JOY1+1; // Assign Shield Ability to B - setupcontrols[GC_WEAPONNEXT][nweapon_slot] = JOY1+3; // Move Next Weapon from B to X - setupcontrols[GC_WEAPONPREV][pweapon_slot] = KEY_NULL; // Unassign Previous Weapon from X - } - - if (setupcontrols == gamecontrolbis) // If we've already updated both players, break out - break; - } - - - // Now, show a message about the default Shield Ability bindings - if ((gamecontrol[GC_SHIELD][0] == KEY_LALT && gamecontrol[GC_SHIELD][1] == KEY_JOY1+1) - || (gamecontrol[GC_SHIELD][0] == KEY_JOY1+1 && gamecontrol[GC_SHIELD][1] == KEY_LALT)) - { - // Left Alt and the B button are both assigned - M_StartMessage(M_GetText("Shield Ability defaults to\nthe \x82""Left Alt\x80"" key on keyboard,\nand the \x85""B button\x80"" on gamepads." - "\n\nYou can always reassign it\nin the Options menu later." - "\n\n\nPress 'Enter' to continue\n"), - NULL, MM_NOTHING); - MessageDef.x = 43; // Change the pop-up message's background position/width - MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 27; - } - else if (gamecontrol[GC_SHIELD][0] == KEY_LALT || gamecontrol[GC_SHIELD][1] == KEY_LALT) - { - // Left Alt is assigned, but the B button isn't. - M_StartMessage(M_GetText("Shield Ability defaults to\nthe \x82""Left Alt\x80"" key on keyboard.\nThe \x85""B button\x80"" on gamepads was taken." - "\n\nYou can always reassign it\nin the Options menu later." - "\n\n\nPress 'Enter' to continue\n"), - NULL, MM_NOTHING); - MessageDef.x = 24; // Change the pop-up message's background position/width - MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 32; - } - else if (gamecontrol[GC_SHIELD][0] == KEY_JOY1+1 || gamecontrol[GC_SHIELD][1] == KEY_JOY1+1) - { - // The B button is assigned, but Left Alt isn't - M_StartMessage(M_GetText("Shield Ability defaults to\nthe \x85""B button\x80"" on gamepads.\nThe \x82""Left Alt\x80"" key on keyboard was taken." - "\n\nYou can always reassign it\nin the Options menu later." - "\n\n\nPress 'Enter' to continue\n"), - NULL, MM_NOTHING); - MessageDef.x = 8; // Change the pop-up message's background position/width - MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 36; - } - else if (gamecontrol[GC_SHIELD][0] == KEY_NULL && gamecontrol[GC_SHIELD][1] == KEY_NULL) - { - // Neither Left Alt nor the B button are assigned - M_StartMessage(M_GetText("Shield Ability is unassigned!\nThe \x82""Left Alt\x80"" key on keyboard and\nthe \x85""B button\x80"" on gamepads were taken." - "\n\nYou should assign Shield Ability\nin the Options menu later." - "\n\n\nPress 'Enter' to continue\n"), - NULL, MM_NOTHING); - MessageDef.x = 19; // Change the pop-up message's background position/width - MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 33; - } - else - { - // Neither Left Alt nor the B button are assigned... but something else is??? - // (This can technically happen if you edit your config or use setcontrol in the console before opening the menu) - char keystr[16+16+2+7+1]; // Two 16-char keys + two colour codes + "' and '" + null - - if (gamecontrol[GC_SHIELD][0] != KEY_NULL && gamecontrol[GC_SHIELD][1] != KEY_NULL) - STRBUFCPY(keystr, va("%s\x80""' and '\x82""%s", - G_KeyNumToName(gamecontrol[GC_SHIELD][0]), - G_KeyNumToName(gamecontrol[GC_SHIELD][1]))); - else if (gamecontrol[GC_SHIELD][0] != KEY_NULL) - STRBUFCPY(keystr, G_KeyNumToName(gamecontrol[GC_SHIELD][0])); - else //if (gamecontrol[GC_SHIELD][1] != KEY_NULL) - STRBUFCPY(keystr, G_KeyNumToName(gamecontrol[GC_SHIELD][1])); - - M_StartMessage(va("Shield Ability is assigned to\n'\x82""%s\x80""'." - "\n\nYou can always reassign it\nin the Options menu later." - "\n\n\nPress 'Enter' to continue\n", - keystr), NULL, MM_NOTHING); - MessageDef.x = 23; // Change the pop-up message's background position/width - MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 32; - } -} - -static void M_HandleShieldPromptMenu(INT32 choice) // TODO: 2.3: Remove -{ - switch (choice) - { - case KEY_ESCAPE: - if (I_GetTime() <= shieldprompt_timer) // Don't mash past the pop-up by accident! - break; - - S_StartSound(NULL, sfx_menu1); - noFurtherInput = true; - shieldprompt_timer = 0; - M_ShieldPromptUseDefaults(); - break; - - case KEY_ENTER: - if (I_GetTime() <= shieldprompt_timer) // Don't mash past the pop-up by accident! - break; - - S_StartSound(NULL, sfx_menu1); - noFurtherInput = true; - shieldprompt_timer = 0; - - if (shieldprompt_currentchoice == 0) - { - OP_ChangeControlsDef.lastOn = 8; // Highlight Shield Ability in the controls menu - M_Setup1PControlsMenu(0); // Set up P1's controls menu and call M_SetupNextMenu - } - else if (shieldprompt_currentchoice == 1) // Copy the Spin buttons to the Shield buttons - { - CV_SetValue(&cv_controlperkey, 2); // Make sure that Controls per Key is "Several" - - gamecontrol [GC_SHIELD][0] = gamecontrol [GC_SPIN][0]; - gamecontrol [GC_SHIELD][1] = gamecontrol [GC_SPIN][1]; - gamecontrolbis[GC_SHIELD][0] = gamecontrolbis[GC_SPIN][0]; - gamecontrolbis[GC_SHIELD][1] = gamecontrolbis[GC_SPIN][1]; - CV_SetValue(&cv_shieldaxis, cv_spinaxis.value); - CV_SetValue(&cv_shieldaxis2, cv_spinaxis2.value); - - M_StartMessage(M_GetText("Spin and Shield Ability are now\nthe same button." - "\n\nYou can always reassign them\nin the Options menu later." - "\n\n\nPress 'Enter' to continue\n"), - NULL, MM_NOTHING); - MessageDef.x = 36; // Change the pop-up message's background position/width - MessageDef.lastOn = (MessageDef.lastOn & ~0xFF) | 29; - } - else - M_ShieldPromptUseDefaults(); - break; - - case KEY_UPARROW: - S_StartSound(NULL, sfx_menu1); - shieldprompt_currentchoice = (shieldprompt_currentchoice+2)%3; - break; - - case KEY_DOWNARROW: - S_StartSound(NULL, sfx_menu1); - shieldprompt_currentchoice = (shieldprompt_currentchoice+1)%3; - break; - } - - MessageDef.prevMenu = &MainDef; -} - -static void M_DrawShieldPromptMenu(void) // TODO: 2.3: Remove -{ - INT16 cursorx = (BASEVIDWIDTH/2) - 24; - - V_DrawFill(10-3, 68-3, 300+6, 40+6, 159); - // V_DrawCenteredString doesn't centre newlines, so we have to draw each line separately - V_DrawCenteredString(BASEVIDWIDTH/2, 68, V_ALLOWLOWERCASE, "Welcome back! Since you last played,"); - V_DrawCenteredString(BASEVIDWIDTH/2, 76, V_ALLOWLOWERCASE, "Spin has been split into separate"); - V_DrawCenteredString(BASEVIDWIDTH/2, 84, V_ALLOWLOWERCASE, "\"Spin\" and \"Shield Ability\" controls."); - - V_DrawCenteredString(BASEVIDWIDTH/2, 98, V_ALLOWLOWERCASE, "Do you want to assign Shield Ability now?"); - - - V_DrawCenteredString(BASEVIDWIDTH/2, 164, - (shieldprompt_currentchoice == 0) ? V_YELLOWMAP : 0, "Open Control Setup"); - V_DrawCenteredString(BASEVIDWIDTH/2, 172, - (shieldprompt_currentchoice == 1) ? V_YELLOWMAP : 0, "Keep the old behaviour"); - V_DrawCenteredString(BASEVIDWIDTH/2, 180, - (shieldprompt_currentchoice == 2) ? V_YELLOWMAP : 0, "Use default Shield Ability buttons"); - - switch (shieldprompt_currentchoice) - { - case 0: cursorx -= V_StringWidth("Open Control Setup", 0)/2; break; - case 1: cursorx -= V_StringWidth("Keep the old behaviour", 0)/2; break; - default: cursorx -= V_StringWidth("Use default Shield Ability buttons", 0)/2; break; - } - V_DrawScaledPatch(cursorx, 164 + (shieldprompt_currentchoice*8), 0, W_CachePatchName("M_CURSOR", PU_PATCH)); -} - -static menuitem_t OP_ShieldPromptMenu[] = {{IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleShieldPromptMenu, 0}}; // TODO: 2.3: Remove - -menu_t OP_ShieldPromptDef = { // TODO: 2.3: Remove - MN_SPECIAL, - NULL, - 1, - &MainDef, - OP_ShieldPromptMenu, - M_DrawShieldPromptMenu, - 0, 0, 0, NULL -}; - // // M_StartControlPanel // @@ -3898,15 +3669,6 @@ void M_StartControlPanel(void) currentMenu = &MainDef; itemOn = singleplr; M_UpdateItemOn(); - - if (shieldprompt_timer) // For old configs, show a pop-up about the new Shield button // TODO: 2.3: Remove - { - S_StartSound(NULL, sfx_strpst); - noFurtherInput = true; - shieldprompt_timer = I_GetTime() + TICRATE; // Don't mash past the pop-up by accident! - - M_SetupNextMenu(&OP_ShieldPromptDef); - } } else if (modeattacking) { diff --git a/src/m_menu.h b/src/m_menu.h index cfe811d0b..552d28122 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -176,7 +176,6 @@ typedef struct extern menupres_t menupres[NUMMENUTYPES]; extern UINT32 prevMenuId; extern UINT32 activeMenuId; -extern tic_t shieldprompt_timer; // Show a prompt about the new Shield button for old configs // TODO: 2.3: Remove void M_InitMenuPresTables(void); UINT8 M_GetYoungestChildMenu(void); diff --git a/src/m_misc.c b/src/m_misc.c index dda3ffc86..24616e9db 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -560,11 +560,6 @@ void M_FirstLoadConfig(void) COM_BufInsertText(va("exec \"%s\"\n", configfile)); // no COM_BufExecute() needed; that does it right away - // For configs loaded at startup only, check for pre-Shield-button configs // TODO: 2.3: Remove - if (GETMAJOREXECVERSION(cv_execversion.value) < 55 // Pre-v2.2.14 configs - && cv_execversion.value != 25) // Make sure that the config exists, too - shieldprompt_timer = 1; - // don't filter anymore vars and don't let this convsvar be changed COM_BufInsertText(va("%s \"%d\"\n", cv_execversion.name, EXECVERSION)); CV_ToggleExecVersion(false); From a6a5767335af87e0cabf968f8d73e3c87ebcf16d Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 22 Jan 2025 20:53:37 -0300 Subject: [PATCH 343/353] Revert "Merge branch 'shield-button-touchups' into 'next'" This reverts commit 89620dbd9e9df00930f5f1f07904e92c74cdfa46, reversing changes made to 55a7afde5282bed7807cfdcd7ca87fa475e1aba1. --- src/deh_lua.c | 15 ++---- src/deh_tables.c | 1 - src/g_demo.c | 6 +-- src/g_game.c | 55 +++++++++----------- src/g_game.h | 5 +- src/g_input.c | 1 + src/lua_baselib.c | 12 ----- src/m_menu.c | 38 ++++++-------- src/netcode/d_netcmd.c | 2 - src/p_local.h | 1 - src/p_user.c | 114 ++++++++++++++++++++--------------------- src/st_stuff.c | 6 +-- 12 files changed, 105 insertions(+), 151 deletions(-) diff --git a/src/deh_lua.c b/src/deh_lua.c index e5b3b03de..3513f5b3d 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -11,7 +11,6 @@ /// \brief Lua SOC library #include "deh_lua.h" -#include "g_input.h" // freeslot takes a name (string only!) // and allocates it to the appropriate free slot. @@ -600,20 +599,12 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word) return luaL_error(L, "translation '%s' could not be found.\n", word); } - // TODO: 2.3: Delete these aliases - else if (fastcmp(word, "BT_USE")) + // TODO: 2.3: Delete this alias + if (fastcmp(word, "BT_USE")) { CacheAndPushConstant(L, word, (lua_Integer)BT_SPIN); return 1; - } - else if (fastcmp(word, "GC_WEPSLOT8") || fastcmp(word, "GC_WEPSLOT9") || fastcmp(word, "GC_WEPSLOT10")) - { - // Using GC_WEPSLOT7 isn't accurate, but ensures that "if x >= GC_WEPSLOT1 and x <= GC_WEPSLOT10" keeps the intended effect - CacheAndPushConstant(L, word, (lua_Integer)GC_WEPSLOT7); - if (!mathlib) - LUA_Deprecated(L, "GC_WEPSLOT8\"-\"GC_WEPSLOT10", "GC_WEPSLOT1\"-\"GC_WEPSLOT7"); - return 1; - } + } for (i = 0; INT_CONST[i].n; i++) if (fastcmp(word,INT_CONST[i].n)) { diff --git a/src/deh_tables.c b/src/deh_tables.c index 61ae27b45..41c29a16b 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5767,7 +5767,6 @@ struct int_const_s const INT_CONST[] = { {"JA_DIGITAL",JA_DIGITAL}, {"JA_JUMP",JA_JUMP}, {"JA_SPIN",JA_SPIN}, - {"JA_SHIELD",JA_SHIELD}, {"JA_FIRE",JA_FIRE}, {"JA_FIRENORMAL",JA_FIRENORMAL}, {"JOYAXISRANGE",JOYAXISRANGE}, diff --git a/src/g_demo.c b/src/g_demo.c index 8315e716b..479020905 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -100,7 +100,7 @@ demoghost *ghosts = NULL; // DEMO RECORDING // -#define DEMOVERSION 0x0012 +#define DEMOVERSION 0x0011 #define DEMOHEADER "\xF0" "SRB2Replay" "\x0F" #define DF_GHOST 0x01 // This demo contains ghost data too! @@ -185,11 +185,7 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum) if (ziptic & ZT_ANGLE) oldcmd.angleturn = READINT16(demo_p); if (ziptic & ZT_BUTTONS) - { oldcmd.buttons = (oldcmd.buttons & (BT_CAMLEFT|BT_CAMRIGHT)) | (READUINT16(demo_p) & ~(BT_CAMLEFT|BT_CAMRIGHT)); - if (demoversion < 0x0012 && oldcmd.buttons & BT_SPIN) - oldcmd.buttons |= BT_SHIELD; // Copy BT_SPIN to BT_SHIELD for pre-Shield-button demos - } if (ziptic & ZT_AIMING) oldcmd.aiming = READINT16(demo_p); if (ziptic & ZT_LATENCY) diff --git a/src/g_game.c b/src/g_game.c index 894063585..2a83c085f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -401,29 +401,27 @@ consvar_t cv_cam_lockonboss[2] = { CVAR_INIT ("cam2_lockaimassist", "Full", CV_SAVE|CV_ALLOWLUA, lockedassist_cons_t, NULL), }; -consvar_t cv_moveaxis = CVAR_INIT ("joyaxis_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_sideaxis = CVAR_INIT ("joyaxis_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_lookaxis = CVAR_INIT ("joyaxis_look", "X-Rudder-", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_turnaxis = CVAR_INIT ("joyaxis_turn", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_jumpaxis = CVAR_INIT ("joyaxis_jump", "None", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_spinaxis = CVAR_INIT ("joyaxis_spin", "None", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_shieldaxis = CVAR_INIT ("joyaxis_shield", "None", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_fireaxis = CVAR_INIT ("joyaxis_fire", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_firenaxis = CVAR_INIT ("joyaxis_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_deadzone = CVAR_INIT ("joy_deadzone", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL); -consvar_t cv_digitaldeadzone = CVAR_INIT ("joy_digdeadzone", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL); +consvar_t cv_moveaxis = CVAR_INIT ("joyaxis_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_sideaxis = CVAR_INIT ("joyaxis_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_lookaxis = CVAR_INIT ("joyaxis_look", "X-Rudder-", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_turnaxis = CVAR_INIT ("joyaxis_turn", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_jumpaxis = CVAR_INIT ("joyaxis_jump", "None", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_spinaxis = CVAR_INIT ("joyaxis_spin", "None", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_fireaxis = CVAR_INIT ("joyaxis_fire", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_firenaxis = CVAR_INIT ("joyaxis_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_deadzone = CVAR_INIT ("joy_deadzone", "0.125", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL); +consvar_t cv_digitaldeadzone = CVAR_INIT ("joy_digdeadzone", "0.25", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL); -consvar_t cv_moveaxis2 = CVAR_INIT ("joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_sideaxis2 = CVAR_INIT ("joyaxis2_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_lookaxis2 = CVAR_INIT ("joyaxis2_look", "X-Rudder-", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_turnaxis2 = CVAR_INIT ("joyaxis2_turn", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_jumpaxis2 = CVAR_INIT ("joyaxis2_jump", "None", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_spinaxis2 = CVAR_INIT ("joyaxis2_spin", "None", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_shieldaxis2 = CVAR_INIT ("joyaxis2_shield", "None", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_fireaxis2 = CVAR_INIT ("joyaxis2_fire", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL); -consvar_t cv_firenaxis2 = CVAR_INIT ("joyaxis2_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL); -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); +consvar_t cv_moveaxis2 = CVAR_INIT ("joyaxis2_move", "Y-Axis", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_sideaxis2 = CVAR_INIT ("joyaxis2_side", "X-Axis", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_lookaxis2 = CVAR_INIT ("joyaxis2_look", "X-Rudder-", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_turnaxis2 = CVAR_INIT ("joyaxis2_turn", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_jumpaxis2 = CVAR_INIT ("joyaxis2_jump", "None", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_spinaxis2 = CVAR_INIT ("joyaxis2_spin", "None", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_fireaxis2 = CVAR_INIT ("joyaxis2_fire", "Z-Rudder", CV_SAVE, joyaxis_cons_t, NULL); +consvar_t cv_firenaxis2 = CVAR_INIT ("joyaxis2_firenormal", "Z-Axis", CV_SAVE, joyaxis_cons_t, NULL); +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); player_t *seenplayer; // player we're aiming at right now @@ -894,9 +892,6 @@ INT32 JoyAxis(joyaxis_e axissel) case JA_SPIN: axisval = cv_spinaxis.value; break; - case JA_SHIELD: - axisval = cv_shieldaxis.value; - break; case JA_FIRE: axisval = cv_fireaxis.value; break; @@ -970,9 +965,6 @@ INT32 Joy2Axis(joyaxis_e axissel) case JA_SPIN: axisval = cv_spinaxis2.value; break; - case JA_SHIELD: - axisval = cv_shieldaxis2.value; - break; case JA_FIRE: axisval = cv_fireaxis2.value; break; @@ -1340,8 +1332,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (PLAYERINPUTDOWN(ssplayer, GC_WEAPONPREV)) cmd->buttons |= BT_WEAPONPREV; // Previous Weapon -#if NUM_WEAPONS > 7 -"Add extra inputs to g_input.h/gamecontrols_e, and fix conflicts in d_ticcmd.h/ticcmd_t/buttons" +#if NUM_WEAPONS > 10 +"Add extra inputs to g_input.h/gamecontrols_e" #endif //use the three avaliable bits to determine the weapon. cmd->buttons &= ~BT_WEAPONMASK; @@ -1367,8 +1359,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) cmd->buttons |= BT_TOSSFLAG; // Shield button - axis = PlayerJoyAxis(ssplayer, JA_SHIELD); - if (PLAYERINPUTDOWN(ssplayer, GC_SHIELD) || (usejoystick && axis > 0)) + if (PLAYERINPUTDOWN(ssplayer, GC_SHIELD)) cmd->buttons |= BT_SHIELD; // Lua scriptable buttons diff --git a/src/g_game.h b/src/g_game.h index 2680fa973..f72ea6b41 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -71,8 +71,8 @@ typedef enum { #define P_ControlStyle(player) ((((player)->pflags & PF_ANALOGMODE) ? CS_LMAOGALOG : 0) | (((player)->pflags & PF_DIRECTIONCHAR) ? CS_STANDARD : 0)) extern consvar_t cv_autobrake, cv_autobrake2; -extern consvar_t cv_sideaxis, cv_turnaxis, cv_moveaxis, cv_lookaxis, cv_jumpaxis, cv_spinaxis, cv_shieldaxis, cv_fireaxis, cv_firenaxis, cv_deadzone, cv_digitaldeadzone; -extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_shieldaxis2,cv_fireaxis2,cv_firenaxis2,cv_deadzone2,cv_digitaldeadzone2; +extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_spinaxis,cv_fireaxis,cv_firenaxis,cv_deadzone,cv_digitaldeadzone; +extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2,cv_deadzone2,cv_digitaldeadzone2; extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest; // hi here's some new controls @@ -100,7 +100,6 @@ typedef enum JA_JUMP = JA_DIGITAL, JA_SPIN, - JA_SHIELD, JA_FIRE, JA_FIRENORMAL, } joyaxis_e; diff --git a/src/g_input.c b/src/g_input.c index 3ba709978..8092ffc84 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1001,6 +1001,7 @@ static void setcontrol(INT32 (*gc)[2]) // TODO: 2.3: Delete the "use" alias namectrl = (stricmp(COM_Argv(1), "use")) ? COM_Argv(1) : "spin"; + for (numctrl = 0; numctrl < NUM_GAMECONTROLS && stricmp(namectrl, gamecontrolname[numctrl]); numctrl++) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index ecd1ee55e..085a9b23e 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2513,17 +2513,6 @@ static int lib_pDoSuperTransformation(lua_State *L) return 0; } -static int lib_pDoSuperDetransformation(lua_State *L) -{ - player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); - NOHUD - INLEVEL - if (!player) - return LUA_ErrInvalid(L, "player_t"); - P_DoSuperDetransformation(player); - return 0; -} - static int lib_pExplodeMissile(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); @@ -4532,7 +4521,6 @@ static luaL_Reg lib[] = { {"P_VectorInstaThrust",lib_pVectorInstaThrust}, {"P_SetMobjStateNF",lib_pSetMobjStateNF}, {"P_DoSuperTransformation",lib_pDoSuperTransformation}, - {"P_DoSuperDetransformation",lib_pDoSuperDetransformation}, {"P_ExplodeMissile",lib_pExplodeMissile}, {"P_MobjTouchingSectorSpecial",lib_pMobjTouchingSectorSpecial}, {"P_ThingOnSpecial3DFloor",lib_pThingOnSpecial3DFloor}, diff --git a/src/m_menu.c b/src/m_menu.c index c38459fe0..de1ac2ea5 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1071,9 +1071,9 @@ static menuitem_t OP_ChangeControlsMenu[] = {IT_CALL | IT_STRING2, NULL, "Move Backward", M_ChangeControl, GC_BACKWARD }, {IT_CALL | IT_STRING2, NULL, "Move Left", M_ChangeControl, GC_STRAFELEFT }, {IT_CALL | IT_STRING2, NULL, "Move Right", M_ChangeControl, GC_STRAFERIGHT }, - {IT_CALL | IT_STRING2, NULL, "Jump", M_ChangeControl, GC_JUMP }, - {IT_CALL | IT_STRING2, NULL, "Spin", M_ChangeControl, GC_SPIN }, - {IT_CALL | IT_STRING2, NULL, "Shield Ability", M_ChangeControl, GC_SHIELD }, + {IT_CALL | IT_STRING2, NULL, "Jump", M_ChangeControl, GC_JUMP }, + {IT_CALL | IT_STRING2, NULL, "Spin", M_ChangeControl, GC_SPIN }, + {IT_CALL | IT_STRING2, NULL, "Shield", M_ChangeControl, GC_SHIELD }, {IT_HEADER, NULL, "Camera", NULL, 0}, {IT_SPACE, NULL, NULL, NULL, 0}, // padding {IT_CALL | IT_STRING2, NULL, "Look Up", M_ChangeControl, GC_LOOKUP }, @@ -1122,15 +1122,13 @@ static menuitem_t OP_ChangeControlsMenu[] = static menuitem_t OP_Joystick1Menu[] = { - {IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup1PJoystickMenu, 0}, - - {IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis , 20}, - {IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis , 30}, - {IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis , 40}, - {IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis , 50}, - {IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis , 60}, - {IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis , 70}, - {IT_STRING | IT_CVAR, NULL, "Shield Axis" , &cv_shieldaxis , 80}, + {IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup1PJoystickMenu, 10}, + {IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis , 30}, + {IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis , 40}, + {IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis , 50}, + {IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis , 60}, + {IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis , 70}, + {IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis , 80}, {IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis , 90}, {IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis ,100}, @@ -1142,15 +1140,13 @@ static menuitem_t OP_Joystick1Menu[] = static menuitem_t OP_Joystick2Menu[] = { - {IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup2PJoystickMenu, 0}, - - {IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis2 , 20}, - {IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis2 , 30}, - {IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis2 , 40}, - {IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis2 , 50}, - {IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis2 , 60}, - {IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis2 , 70}, - {IT_STRING | IT_CVAR, NULL, "Shield Axis" , &cv_shieldaxis2 , 80}, + {IT_STRING | IT_CALL, NULL, "Select Gamepad...", M_Setup2PJoystickMenu, 10}, + {IT_STRING | IT_CVAR, NULL, "Move \x17 Axis" , &cv_moveaxis2 , 30}, + {IT_STRING | IT_CVAR, NULL, "Move \x18 Axis" , &cv_sideaxis2 , 40}, + {IT_STRING | IT_CVAR, NULL, "Camera \x17 Axis" , &cv_lookaxis2 , 50}, + {IT_STRING | IT_CVAR, NULL, "Camera \x18 Axis" , &cv_turnaxis2 , 60}, + {IT_STRING | IT_CVAR, NULL, "Jump Axis" , &cv_jumpaxis2 , 70}, + {IT_STRING | IT_CVAR, NULL, "Spin Axis" , &cv_spinaxis2 , 80}, {IT_STRING | IT_CVAR, NULL, "Fire Axis" , &cv_fireaxis2 , 90}, {IT_STRING | IT_CVAR, NULL, "Fire Normal Axis" , &cv_firenaxis2 ,100}, diff --git a/src/netcode/d_netcmd.c b/src/netcode/d_netcmd.c index 7bdf229fd..94170fa0d 100644 --- a/src/netcode/d_netcmd.c +++ b/src/netcode/d_netcmd.c @@ -824,8 +824,6 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_jumpaxis2); CV_RegisterVar(&cv_spinaxis); CV_RegisterVar(&cv_spinaxis2); - CV_RegisterVar(&cv_shieldaxis); - CV_RegisterVar(&cv_shieldaxis2); CV_RegisterVar(&cv_fireaxis); CV_RegisterVar(&cv_fireaxis2); CV_RegisterVar(&cv_firenaxis); diff --git a/src/p_local.h b/src/p_local.h index de519b211..8a4ec5943 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -544,7 +544,6 @@ void P_ThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move); void P_VectorInstaThrust(fixed_t xa, fixed_t xb, fixed_t xc, fixed_t ya, fixed_t yb, fixed_t yc, fixed_t za, fixed_t zb, fixed_t zc, fixed_t momentum, mobj_t *mo); void P_DoSuperTransformation(player_t *player, boolean giverings); -void P_DoSuperDetransformation(player_t *player); void P_ExplodeMissile(mobj_t *mo); void P_CheckGravity(mobj_t *mo, boolean affect); void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope); diff --git a/src/p_user.c b/src/p_user.c index a093ecb95..2c8f3d2db 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1395,7 +1395,7 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) // P_DoSuperDetransformation // // Detransform into regular Sonic! -void P_DoSuperDetransformation(player_t *player) +static void P_DoSuperDetransformation(player_t *player) { player->powers[pw_emeralds] = 0; // lost the power stones P_SpawnGhostMobj(player->mo); @@ -4199,6 +4199,16 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) I_Assert(player != NULL); I_Assert(!P_MobjWasRemoved(player->mo)); + + // Toss a flag + if (cmd->buttons & BT_TOSSFLAG && G_GametypeHasTeams() + && !(player->powers[pw_super]) && !(player->tossdelay)) + { + if (!(player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))) + P_PlayerEmeraldBurst(player, true); // Toss emeralds + else + P_PlayerFlagBurst(player, true); + } if (!(cmd->buttons & (BT_ATTACK|BT_FIRENORMAL))) { @@ -4208,7 +4218,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) return; } - if (player->pflags & PF_ATTACKDOWN || player->climbing || (G_TagGametype() && !(player->pflags & PF_TAGIT))) + if (player->pflags & PF_ATTACKDOWN || player->climbing) return; // Fire a fireball if we have the Fire Flower powerup! @@ -4224,7 +4234,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) } // No ringslinging outside of ringslinger! - if (!G_RingSlingerGametype() || player->weapondelay) + if (!G_RingSlingerGametype() || player->weapondelay || (G_TagGametype() && !(player->pflags & PF_TAGIT))) return; player->pflags |= PF_ATTACKDOWN; @@ -5277,7 +5287,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock // // Handles player jumping // -static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd, boolean spinshieldhack) +static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) { mobj_t *lockonthok = NULL, *visual = NULL; @@ -5310,52 +5320,45 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd, boolean spinshieldhac ; else if (P_PlayerShieldThink(player, cmd, lockonthok, visual)) ; - else if (cmd->buttons & BT_SPIN) + else if ((cmd->buttons & BT_SPIN) && !LUA_HookPlayer(player, HOOK(JumpSpinSpecial))) { if (spinshieldhack && !(player->pflags & PF_SPINDOWN) && P_SuperReady(player)) { - // If you're using two-button play, can turn Super and aren't already, - // and you don't have a shield, then turn Super! - P_DoSuperTransformation(player, false); - } - else if (!LUA_HookPlayer(player, HOOK(JumpSpinSpecial))) - switch (player->charability) - { - case CA_THOK: - if (player->powers[pw_super]) // Super Sonic float + case CA_THOK: + if (player->powers[pw_super]) // Super Sonic float + { + if ((player->speed > 5*player->mo->scale) // FixedMul(5<mo->scale), but scale is FRACUNIT-based + && (P_MobjFlip(player->mo)*player->mo->momz <= 0)) { - if ((player->speed > 5*player->mo->scale) // FixedMul(5<mo->scale), but scale is FRACUNIT-based - && (P_MobjFlip(player->mo)*player->mo->momz <= 0)) + if (player->panim != PA_RUN && player->panim != PA_WALK) { - if (player->panim != PA_RUN && player->panim != PA_WALK) - { - if (player->speed >= FixedMul(player->runspeed, player->mo->scale)) - P_SetMobjState(player->mo, S_PLAY_FLOAT_RUN); - else - P_SetMobjState(player->mo, S_PLAY_FLOAT); - } - - player->mo->momz = 0; - player->pflags &= ~(PF_STARTJUMP|PF_SPINNING); - player->secondjump = 1; + if (player->speed >= FixedMul(player->runspeed, player->mo->scale)) + P_SetMobjState(player->mo, S_PLAY_FLOAT_RUN); + else + P_SetMobjState(player->mo, S_PLAY_FLOAT); } + + player->mo->momz = 0; + player->pflags &= ~(PF_STARTJUMP|PF_SPINNING); + player->secondjump = 1; } - break; - case CA_TELEKINESIS: - if (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || (player->charflags & SF_MULTIABILITY)) - { - P_Telekinesis(player, - -FixedMul(player->actionspd, player->mo->scale), // -ve thrust (pulling towards player) - FixedMul(384*FRACUNIT, player->mo->scale)); - } - break; - case CA_TWINSPIN: - if ((player->charability2 == CA2_MELEE) && (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || player->charflags & SF_MULTIABILITY)) - P_DoTwinSpin(player); - break; - default: - break; - } + } + break; + case CA_TELEKINESIS: + if (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || (player->charflags & SF_MULTIABILITY)) + { + P_Telekinesis(player, + -FixedMul(player->actionspd, player->mo->scale), // -ve thrust (pulling towards player) + FixedMul(384*FRACUNIT, player->mo->scale)); + } + break; + case CA_TWINSPIN: + if ((player->charability2 == CA2_MELEE) && (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || player->charflags & SF_MULTIABILITY)) + P_DoTwinSpin(player); + break; + default: + break; + } } } @@ -8070,7 +8073,6 @@ void P_MovePlayer(player_t *player) { ticcmd_t *cmd; INT32 i; - boolean spinshieldhack = false; // Hack: Is Spin and Shield bound to the same button (pressed on the same tic)? fixed_t runspd; @@ -8692,13 +8694,10 @@ void P_MovePlayer(player_t *player) && !(player->mo->eflags & (MFE_UNDERWATER|MFE_TOUCHWATER))) P_ElementalFire(player, false); - if ((cmd->buttons & (BT_SPIN|BT_SHIELD)) == (BT_SPIN|BT_SHIELD) && !(player->pflags & (PF_SPINDOWN|PF_SHIELDDOWN))) - spinshieldhack = true; // Spin and Shield is bound to the same button (pressed on the same tic), so enable two-button play (Jump and Spin+Shield) - P_DoSpinAbility(player, cmd); // jumping - P_DoJumpStuff(player, cmd, spinshieldhack); + P_DoJumpStuff(player, cmd); // If you're not spinning, you'd better not be spindashing! if (!(player->pflags & PF_SPINNING) && player->powers[pw_carry] != CR_NIGHTSMODE) @@ -8787,13 +8786,18 @@ void P_MovePlayer(player_t *player) } // Check for fire and shield buttons - if (!player->exiting) + if (!player->exiting && !(player->pflags & PF_STASIS)) { + // Check for fire buttons P_DoFiring(player, cmd); - + + // Release the shield button + if (!(cmd->buttons & BT_SHIELD)) + player->pflags &= ~PF_SHIELDDOWN; + // Shield button behavior // Check P_PlayerShieldThink for actual shields! - if ((cmd->buttons & BT_SHIELD) && !(player->pflags & PF_SHIELDDOWN) && !spinshieldhack) + else if (!(player->pflags & PF_SHIELDDOWN)) { // Transform into super if we can! if (P_SuperReady(player)) @@ -12059,7 +12063,7 @@ void P_PlayerThink(player_t *player) ticmiss++; P_DoRopeHang(player); - P_DoJumpStuff(player, &player->cmd, false); // P_DoRopeHang would set PF_SPINDOWN, so no spinshieldhack here + P_DoJumpStuff(player, &player->cmd); } else //if (player->powers[pw_carry] == CR_ZOOMTUBE) { @@ -12333,12 +12337,6 @@ void P_PlayerThink(player_t *player) player->pflags &= ~PF_SPINDOWN; } - // Check for Shield button - if (cmd->buttons & BT_SHIELD) - player->pflags |= PF_SHIELDDOWN; - else - player->pflags &= ~PF_SHIELDDOWN; - // IF PLAYER NOT HERE THEN FLASH END IF if (player->quittime && player->powers[pw_flashing] < flashingtics - 1 && !(G_TagGametype() && !(player->pflags & PF_TAGIT)) && !player->gotflag) diff --git a/src/st_stuff.c b/src/st_stuff.c index 23f2f3b29..4fdacd51a 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1176,10 +1176,8 @@ static void ST_drawInput(void) V_DrawFill(x+16+(xoffs), y+(yoffs)-offs, 10, 10, col);\ V_DrawCharacter(x+16+1+(xoffs), y+1+(yoffs)-offs, hudinfo[HUD_INPUT].f|symb, false) - drawbutt( 4,-3, BT_JUMP, 'J' ); - drawbutt(15,-3, BT_SPIN, 'S' ); - drawbutt(26,-3, BT_SHIELD, '\0'); // Instead of a wide 'J' or 'S', we'll draw a thin "SH" for Shield - V_DrawThinString(x+16+26, y+2+(-3)-offs, hudinfo[HUD_LIVES].f, "SH"); + drawbutt( 4,-3, BT_JUMP, 'J'); + drawbutt(15,-3, BT_SPIN, 'S'); V_DrawFill(x+16+4, y+8, 21, 10, hudinfo[HUD_INPUT].f|20); // sundial backing if (stplyr->mo) From a884abb6c8f72ce53e23f51f9c1d43a8338adc0c Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 22 Jan 2025 20:54:08 -0300 Subject: [PATCH 344/353] Revert "Merge branch 'shield-gamepad-defaults' into 'next'" This reverts commit 14d640a3853e0ed5cab5e5d12ce68d491fff2756, reversing changes made to d4053057401f341bec407da4ba96a102c83766fb. --- src/g_input.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/g_input.c b/src/g_input.c index 8092ffc84..b330b7d1e 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -743,34 +743,34 @@ void G_DefineDefaultControls(void) // Gamepad controls -- same for both schemes gamecontroldefault[i][GC_JUMP ][1] = KEY_JOY1+0; // A gamecontroldefault[i][GC_SPIN ][1] = KEY_JOY1+2; // X - gamecontroldefault[i][GC_SHIELD ][1] = KEY_JOY1+1; // B - gamecontroldefault[i][GC_CUSTOM1 ][1] = KEY_JOY1+3; // Y - gamecontroldefault[i][GC_CUSTOM2 ][1] = KEY_JOY1+4; // LB - gamecontroldefault[i][GC_CENTERVIEW ][1] = KEY_JOY1+5; // RB + gamecontroldefault[i][GC_CUSTOM1 ][1] = KEY_JOY1+1; // B + gamecontroldefault[i][GC_CUSTOM2 ][1] = KEY_JOY1+3; // Y gamecontroldefault[i][GC_CUSTOM3 ][1] = KEY_JOY1+8; // Left Stick - gamecontroldefault[i][GC_CAMTOGGLE ][1] = KEY_JOY1+9; // Right Stick + gamecontroldefault[i][GC_SHIELD ][1] = KEY_JOY1+4; // LB + gamecontroldefault[i][GC_CENTERVIEW ][1] = KEY_JOY1+5; // RB gamecontroldefault[i][GC_SCORES ][1] = KEY_JOY1+6; // Back gamecontroldefault[i][GC_SYSTEMMENU ][0] = KEY_JOY1+7; // Start - gamecontroldefault[i][GC_VIEWPOINTNEXT][1] = KEY_HAT1+0; // D-Pad Up - gamecontroldefault[i][GC_TOSSFLAG ][1] = KEY_HAT1+1; // D-Pad Down gamecontroldefault[i][GC_WEAPONPREV ][1] = KEY_HAT1+2; // D-Pad Left gamecontroldefault[i][GC_WEAPONNEXT ][1] = KEY_HAT1+3; // D-Pad Right + gamecontroldefault[i][GC_VIEWPOINTNEXT][1] = KEY_JOY1+9; // Right Stick + gamecontroldefault[i][GC_TOSSFLAG ][1] = KEY_HAT1+0; // D-Pad Up + gamecontroldefault[i][GC_CAMTOGGLE ][1] = KEY_HAT1+1; // D-Pad Down // Second player controls only have joypad defaults gamecontrolbisdefault[i][GC_JUMP ][1] = KEY_2JOY1+0; // A gamecontrolbisdefault[i][GC_SPIN ][1] = KEY_2JOY1+2; // X - gamecontrolbisdefault[i][GC_SHIELD ][1] = KEY_2JOY1+1; // B - gamecontrolbisdefault[i][GC_CUSTOM1 ][1] = KEY_2JOY1+3; // Y - gamecontrolbisdefault[i][GC_CUSTOM2 ][1] = KEY_2JOY1+4; // LB - gamecontrolbisdefault[i][GC_CENTERVIEW ][1] = KEY_2JOY1+5; // RB + gamecontrolbisdefault[i][GC_CUSTOM1 ][1] = KEY_2JOY1+1; // B + gamecontrolbisdefault[i][GC_CUSTOM2 ][1] = KEY_2JOY1+3; // Y gamecontrolbisdefault[i][GC_CUSTOM3 ][1] = KEY_2JOY1+8; // Left Stick - gamecontrolbisdefault[i][GC_CAMTOGGLE ][1] = KEY_2JOY1+9; // Right Stick + gamecontrolbisdefault[i][GC_SHIELD ][1] = KEY_2JOY1+4; // LB + gamecontrolbisdefault[i][GC_CENTERVIEW ][1] = KEY_2JOY1+5; // RB //gamecontrolbisdefault[i][GC_SCORES ][1] = KEY_2JOY1+6; // Back //gamecontrolbisdefault[i][GC_SYSTEMMENU ][0] = KEY_2JOY1+7; // Start - gamecontrolbisdefault[i][GC_VIEWPOINTNEXT][1] = KEY_2HAT1+0; // D-Pad Up - gamecontrolbisdefault[i][GC_TOSSFLAG ][1] = KEY_2HAT1+1; // D-Pad Down gamecontrolbisdefault[i][GC_WEAPONPREV ][1] = KEY_2HAT1+2; // D-Pad Left gamecontrolbisdefault[i][GC_WEAPONNEXT ][1] = KEY_2HAT1+3; // D-Pad Right + gamecontrolbisdefault[i][GC_VIEWPOINTNEXT][1] = KEY_2JOY1+9; // Right Stick + gamecontrolbisdefault[i][GC_TOSSFLAG ][1] = KEY_2HAT1+0; // D-Pad Up + gamecontrolbisdefault[i][GC_CAMTOGGLE ][1] = KEY_2HAT1+1; // D-Pad Down } } From ee6ce2a1fb98f6ca008ae359b0386c929643f5f1 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 22 Jan 2025 21:01:45 -0300 Subject: [PATCH 345/353] Revert "Merge branch 'superbutton' into 'next'" This reverts commit 4706e80df1c2b78447ad41de17d534279cedac88, reversing changes made to 5f98f7696e20d244ec5f310719711944a41b512d. --- src/d_player.h | 4 - src/d_ticcmd.h | 25 ++--- src/deh_lua.c | 2 +- src/deh_tables.c | 7 +- src/g_game.c | 8 +- src/g_input.c | 22 ++-- src/g_input.h | 4 +- src/m_menu.c | 57 +++++----- src/p_user.c | 279 +++++++++++++++++++++++------------------------ src/y_inter.c | 2 +- 10 files changed, 200 insertions(+), 210 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 3c5e61a86..cdb547d3b 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -160,10 +160,6 @@ typedef enum PF_CANCARRY = 1<<29, // Can carry another player? PF_FINISHED = 1<<30, // The player finished the level. NOT the same as exiting - // True if shield button down last tic - // This may be the final flag, but 2.3 could free up the others - PF_SHIELDDOWN = 1<<31, - // up to 1<<31 is free } pflags_t; diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h index 0f1eca460..2481ed738 100644 --- a/src/d_ticcmd.h +++ b/src/d_ticcmd.h @@ -26,23 +26,20 @@ // Button/action code definitions. typedef enum { - // First 3 bits are weapon change info, DO NOT USE! - BT_WEAPONMASK = 0x07, //our first three bits. + // First 4 bits are weapon change info, DO NOT USE! + BT_WEAPONMASK = 0x0F, //our first four bits. - BT_SHIELD = 1<<3, // shield or super action + BT_WEAPONNEXT = 1<<4, + BT_WEAPONPREV = 1<<5, - BT_WEAPONNEXT = 1<<4, // select next weapon - BT_WEAPONPREV = 1<<5, // select previous weapon + BT_ATTACK = 1<<6, // shoot rings + BT_SPIN = 1<<7, + BT_CAMLEFT = 1<<8, // turn camera left + BT_CAMRIGHT = 1<<9, // turn camera right + BT_TOSSFLAG = 1<<10, + BT_JUMP = 1<<11, + BT_FIRENORMAL = 1<<12, // Fire a normal ring no matter what - BT_ATTACK = 1<<6, // shoot rings - BT_SPIN = 1<<7, // spin action - BT_CAMLEFT = 1<<8, // turn camera left - BT_CAMRIGHT = 1<<9, // turn camera right - BT_TOSSFLAG = 1<<10, // toss flag or emeralds - BT_JUMP = 1<<11, // jump action - BT_FIRENORMAL = 1<<12, // fire a normal ring no matter what - - // custom lua buttons BT_CUSTOM1 = 1<<13, BT_CUSTOM2 = 1<<14, BT_CUSTOM3 = 1<<15, diff --git a/src/deh_lua.c b/src/deh_lua.c index 3513f5b3d..48f737a1f 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -604,7 +604,7 @@ static int ScanConstants(lua_State *L, boolean mathlib, const char *word) { CacheAndPushConstant(L, word, (lua_Integer)BT_SPIN); return 1; - } + } for (i = 0; INT_CONST[i].n; i++) if (fastcmp(word,INT_CONST[i].n)) { diff --git a/src/deh_tables.c b/src/deh_tables.c index 41c29a16b..d71463253 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5607,8 +5607,7 @@ struct int_const_s const INT_CONST[] = { {"ROTAXIS_Z",ROTAXIS_Z}, // Buttons (ticcmd_t) - {"BT_WEAPONMASK",BT_WEAPONMASK}, //our first three bits. - {"BT_SHIELD",BT_SHIELD}, + {"BT_WEAPONMASK",BT_WEAPONMASK}, //our first four bits. {"BT_WEAPONNEXT",BT_WEAPONNEXT}, {"BT_WEAPONPREV",BT_WEAPONPREV}, {"BT_ATTACK",BT_ATTACK}, // shoot rings @@ -5788,7 +5787,9 @@ struct int_const_s const INT_CONST[] = { {"GC_WEPSLOT5",GC_WEPSLOT5}, {"GC_WEPSLOT6",GC_WEPSLOT6}, {"GC_WEPSLOT7",GC_WEPSLOT7}, - {"GC_SHIELD",GC_SHIELD}, + {"GC_WEPSLOT8",GC_WEPSLOT8}, + {"GC_WEPSLOT9",GC_WEPSLOT9}, + {"GC_WEPSLOT10",GC_WEPSLOT10}, {"GC_FIRE",GC_FIRE}, {"GC_FIRENORMAL",GC_FIRENORMAL}, {"GC_TOSSFLAG",GC_TOSSFLAG}, diff --git a/src/g_game.c b/src/g_game.c index 2a83c085f..1c186ae03 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1335,7 +1335,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) #if NUM_WEAPONS > 10 "Add extra inputs to g_input.h/gamecontrols_e" #endif - //use the three avaliable bits to determine the weapon. + //use the four avaliable bits to determine the weapon. cmd->buttons &= ~BT_WEAPONMASK; for (i = 0; i < NUM_WEAPONS; ++i) if (PLAYERINPUTDOWN(ssplayer, GC_WEPSLOT1 + i)) @@ -1354,14 +1354,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer) if (PLAYERINPUTDOWN(ssplayer, GC_FIRENORMAL) || (usejoystick && axis > 0)) cmd->buttons |= BT_FIRENORMAL; - // Toss flag button if (PLAYERINPUTDOWN(ssplayer, GC_TOSSFLAG)) cmd->buttons |= BT_TOSSFLAG; - // Shield button - if (PLAYERINPUTDOWN(ssplayer, GC_SHIELD)) - cmd->buttons |= BT_SHIELD; - // Lua scriptable buttons if (PLAYERINPUTDOWN(ssplayer, GC_CUSTOM1)) cmd->buttons |= BT_CUSTOM1; @@ -2768,7 +2763,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) p->pflags |= PF_SPINDOWN; p->pflags |= PF_ATTACKDOWN; p->pflags |= PF_JUMPDOWN; - p->pflags |= PF_SHIELDDOWN; p->playerstate = PST_LIVE; p->panim = PA_IDLE; // standing animation diff --git a/src/g_input.c b/src/g_input.c index b330b7d1e..4fbdf5e75 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -576,7 +576,9 @@ static const char *gamecontrolname[NUM_GAMECONTROLS] = "weapon5", "weapon6", "weapon7", - "shield", + "weapon8", + "weapon9", + "weapon10", "fire", "firenormal", "tossflag", @@ -691,7 +693,6 @@ void G_DefineDefaultControls(void) gamecontroldefault[gcs_fps][GC_CENTERVIEW ][0] = KEY_LCTRL; gamecontroldefault[gcs_fps][GC_JUMP ][0] = KEY_SPACE; gamecontroldefault[gcs_fps][GC_SPIN ][0] = KEY_LSHIFT; - gamecontroldefault[gcs_fps][GC_SHIELD ][0] = KEY_LALT; gamecontroldefault[gcs_fps][GC_FIRE ][0] = KEY_RCTRL; gamecontroldefault[gcs_fps][GC_FIRE ][1] = KEY_MOUSE1+0; gamecontroldefault[gcs_fps][GC_FIRENORMAL ][0] = KEY_RALT; @@ -712,7 +713,6 @@ void G_DefineDefaultControls(void) gamecontroldefault[gcs_platform][GC_CENTERVIEW ][0] = KEY_END; gamecontroldefault[gcs_platform][GC_JUMP ][0] = KEY_SPACE; gamecontroldefault[gcs_platform][GC_SPIN ][0] = KEY_LSHIFT; - gamecontroldefault[gcs_platform][GC_SHIELD ][0] = KEY_LALT; gamecontroldefault[gcs_platform][GC_FIRE ][0] = 's'; gamecontroldefault[gcs_platform][GC_FIRE ][1] = KEY_MOUSE1+0; gamecontroldefault[gcs_platform][GC_FIRENORMAL ][0] = 'w'; @@ -728,6 +728,9 @@ void G_DefineDefaultControls(void) gamecontroldefault[i][GC_WEPSLOT5 ][0] = '5'; gamecontroldefault[i][GC_WEPSLOT6 ][0] = '6'; gamecontroldefault[i][GC_WEPSLOT7 ][0] = '7'; + gamecontroldefault[i][GC_WEPSLOT8 ][0] = '8'; + gamecontroldefault[i][GC_WEPSLOT9 ][0] = '9'; + gamecontroldefault[i][GC_WEPSLOT10 ][0] = '0'; gamecontroldefault[i][GC_TOSSFLAG ][0] = '\''; gamecontroldefault[i][GC_CAMTOGGLE ][0] = 'v'; gamecontroldefault[i][GC_CAMRESET ][0] = 'r'; @@ -746,15 +749,15 @@ void G_DefineDefaultControls(void) gamecontroldefault[i][GC_CUSTOM1 ][1] = KEY_JOY1+1; // B gamecontroldefault[i][GC_CUSTOM2 ][1] = KEY_JOY1+3; // Y gamecontroldefault[i][GC_CUSTOM3 ][1] = KEY_JOY1+8; // Left Stick - gamecontroldefault[i][GC_SHIELD ][1] = KEY_JOY1+4; // LB + gamecontroldefault[i][GC_CAMTOGGLE ][1] = KEY_JOY1+4; // LB gamecontroldefault[i][GC_CENTERVIEW ][1] = KEY_JOY1+5; // RB - gamecontroldefault[i][GC_SCORES ][1] = KEY_JOY1+6; // Back + gamecontroldefault[i][GC_SCREENSHOT ][1] = KEY_JOY1+6; // Back gamecontroldefault[i][GC_SYSTEMMENU ][0] = KEY_JOY1+7; // Start gamecontroldefault[i][GC_WEAPONPREV ][1] = KEY_HAT1+2; // D-Pad Left gamecontroldefault[i][GC_WEAPONNEXT ][1] = KEY_HAT1+3; // D-Pad Right gamecontroldefault[i][GC_VIEWPOINTNEXT][1] = KEY_JOY1+9; // Right Stick gamecontroldefault[i][GC_TOSSFLAG ][1] = KEY_HAT1+0; // D-Pad Up - gamecontroldefault[i][GC_CAMTOGGLE ][1] = KEY_HAT1+1; // D-Pad Down + gamecontroldefault[i][GC_SCORES ][1] = KEY_HAT1+1; // D-Pad Down // Second player controls only have joypad defaults gamecontrolbisdefault[i][GC_JUMP ][1] = KEY_2JOY1+0; // A @@ -762,15 +765,15 @@ void G_DefineDefaultControls(void) gamecontrolbisdefault[i][GC_CUSTOM1 ][1] = KEY_2JOY1+1; // B gamecontrolbisdefault[i][GC_CUSTOM2 ][1] = KEY_2JOY1+3; // Y gamecontrolbisdefault[i][GC_CUSTOM3 ][1] = KEY_2JOY1+8; // Left Stick - gamecontrolbisdefault[i][GC_SHIELD ][1] = KEY_2JOY1+4; // LB + gamecontrolbisdefault[i][GC_CAMTOGGLE ][1] = KEY_2JOY1+4; // LB gamecontrolbisdefault[i][GC_CENTERVIEW ][1] = KEY_2JOY1+5; // RB - //gamecontrolbisdefault[i][GC_SCORES ][1] = KEY_2JOY1+6; // Back + gamecontrolbisdefault[i][GC_SCREENSHOT ][1] = KEY_2JOY1+6; // Back //gamecontrolbisdefault[i][GC_SYSTEMMENU ][0] = KEY_2JOY1+7; // Start gamecontrolbisdefault[i][GC_WEAPONPREV ][1] = KEY_2HAT1+2; // D-Pad Left gamecontrolbisdefault[i][GC_WEAPONNEXT ][1] = KEY_2HAT1+3; // D-Pad Right gamecontrolbisdefault[i][GC_VIEWPOINTNEXT][1] = KEY_2JOY1+9; // Right Stick gamecontrolbisdefault[i][GC_TOSSFLAG ][1] = KEY_2HAT1+0; // D-Pad Up - gamecontrolbisdefault[i][GC_CAMTOGGLE ][1] = KEY_2HAT1+1; // D-Pad Down + //gamecontrolbisdefault[i][GC_SCORES ][1] = KEY_2HAT1+1; // D-Pad Down } } @@ -1001,7 +1004,6 @@ static void setcontrol(INT32 (*gc)[2]) // TODO: 2.3: Delete the "use" alias namectrl = (stricmp(COM_Argv(1), "use")) ? COM_Argv(1) : "spin"; - for (numctrl = 0; numctrl < NUM_GAMECONTROLS && stricmp(namectrl, gamecontrolname[numctrl]); numctrl++) diff --git a/src/g_input.h b/src/g_input.h index 48c103076..e9c909e6e 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -74,7 +74,9 @@ typedef enum GC_WEPSLOT5, GC_WEPSLOT6, GC_WEPSLOT7, - GC_SHIELD, + GC_WEPSLOT8, + GC_WEPSLOT9, + GC_WEPSLOT10, GC_FIRE, GC_FIRENORMAL, GC_TOSSFLAG, diff --git a/src/m_menu.c b/src/m_menu.c index de1ac2ea5..37d191a0d 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1073,7 +1073,6 @@ static menuitem_t OP_ChangeControlsMenu[] = {IT_CALL | IT_STRING2, NULL, "Move Right", M_ChangeControl, GC_STRAFERIGHT }, {IT_CALL | IT_STRING2, NULL, "Jump", M_ChangeControl, GC_JUMP }, {IT_CALL | IT_STRING2, NULL, "Spin", M_ChangeControl, GC_SPIN }, - {IT_CALL | IT_STRING2, NULL, "Shield", M_ChangeControl, GC_SHIELD }, {IT_HEADER, NULL, "Camera", NULL, 0}, {IT_SPACE, NULL, NULL, NULL, 0}, // padding {IT_CALL | IT_STRING2, NULL, "Look Up", M_ChangeControl, GC_LOOKUP }, @@ -13324,23 +13323,23 @@ static void M_Setup1PControlsMenu(INT32 choice) currentMenu->lastOn = itemOn; // Unhide the nine non-P2 controls and their headers - //OP_ChangeControlsMenu[19+0].status = IT_HEADER; - //OP_ChangeControlsMenu[19+1].status = IT_SPACE; + //OP_ChangeControlsMenu[18+0].status = IT_HEADER; + //OP_ChangeControlsMenu[18+1].status = IT_SPACE; // ... - OP_ChangeControlsMenu[19+2].status = IT_CALL|IT_STRING2; - OP_ChangeControlsMenu[19+3].status = IT_CALL|IT_STRING2; - OP_ChangeControlsMenu[19+4].status = IT_CALL|IT_STRING2; - OP_ChangeControlsMenu[19+5].status = IT_CALL|IT_STRING2; - OP_ChangeControlsMenu[19+6].status = IT_CALL|IT_STRING2; - //OP_ChangeControlsMenu[19+7].status = IT_CALL|IT_STRING2; - //OP_ChangeControlsMenu[19+8].status = IT_CALL|IT_STRING2; - OP_ChangeControlsMenu[19+9].status = IT_CALL|IT_STRING2; + OP_ChangeControlsMenu[18+2].status = IT_CALL|IT_STRING2; + OP_ChangeControlsMenu[18+3].status = IT_CALL|IT_STRING2; + OP_ChangeControlsMenu[18+4].status = IT_CALL|IT_STRING2; + OP_ChangeControlsMenu[18+5].status = IT_CALL|IT_STRING2; + OP_ChangeControlsMenu[18+6].status = IT_CALL|IT_STRING2; + //OP_ChangeControlsMenu[18+7].status = IT_CALL|IT_STRING2; + //OP_ChangeControlsMenu[18+8].status = IT_CALL|IT_STRING2; + OP_ChangeControlsMenu[18+9].status = IT_CALL|IT_STRING2; // ... - OP_ChangeControlsMenu[29+0].status = IT_HEADER; - OP_ChangeControlsMenu[29+1].status = IT_SPACE; + OP_ChangeControlsMenu[28+0].status = IT_HEADER; + OP_ChangeControlsMenu[28+1].status = IT_SPACE; // ... - OP_ChangeControlsMenu[29+2].status = IT_CALL|IT_STRING2; - OP_ChangeControlsMenu[29+3].status = IT_CALL|IT_STRING2; + OP_ChangeControlsMenu[28+2].status = IT_CALL|IT_STRING2; + OP_ChangeControlsMenu[28+3].status = IT_CALL|IT_STRING2; OP_ChangeControlsDef.prevMenu = &OP_P1ControlsDef; OP_ChangeControlsDef.menuid &= ~(((1 << MENUBITS) - 1) << MENUBITS); // remove second level @@ -13356,23 +13355,23 @@ static void M_Setup2PControlsMenu(INT32 choice) currentMenu->lastOn = itemOn; // Hide the nine non-P2 controls and their headers - //OP_ChangeControlsMenu[19+0].status = IT_GRAYEDOUT2; - //OP_ChangeControlsMenu[19+1].status = IT_GRAYEDOUT2; + //OP_ChangeControlsMenu[18+0].status = IT_GRAYEDOUT2; + //OP_ChangeControlsMenu[18+1].status = IT_GRAYEDOUT2; // ... - OP_ChangeControlsMenu[19+2].status = IT_GRAYEDOUT2; - OP_ChangeControlsMenu[19+3].status = IT_GRAYEDOUT2; - OP_ChangeControlsMenu[19+4].status = IT_GRAYEDOUT2; - OP_ChangeControlsMenu[19+5].status = IT_GRAYEDOUT2; - OP_ChangeControlsMenu[19+6].status = IT_GRAYEDOUT2; - //OP_ChangeControlsMenu[19+7].status = IT_GRAYEDOUT2; - //OP_ChangeControlsMenu[19+8].status = IT_GRAYEDOUT2; - OP_ChangeControlsMenu[19+9].status = IT_GRAYEDOUT2; + OP_ChangeControlsMenu[18+2].status = IT_GRAYEDOUT2; + OP_ChangeControlsMenu[18+3].status = IT_GRAYEDOUT2; + OP_ChangeControlsMenu[18+4].status = IT_GRAYEDOUT2; + OP_ChangeControlsMenu[18+5].status = IT_GRAYEDOUT2; + OP_ChangeControlsMenu[18+6].status = IT_GRAYEDOUT2; + //OP_ChangeControlsMenu[18+7].status = IT_GRAYEDOUT2; + //OP_ChangeControlsMenu[18+8].status = IT_GRAYEDOUT2; + OP_ChangeControlsMenu[18+9].status = IT_GRAYEDOUT2; // ... - OP_ChangeControlsMenu[29+0].status = IT_GRAYEDOUT2; - OP_ChangeControlsMenu[29+1].status = IT_GRAYEDOUT2; + OP_ChangeControlsMenu[28+0].status = IT_GRAYEDOUT2; + OP_ChangeControlsMenu[28+1].status = IT_GRAYEDOUT2; // ... - OP_ChangeControlsMenu[29+2].status = IT_GRAYEDOUT2; - OP_ChangeControlsMenu[29+3].status = IT_GRAYEDOUT2; + OP_ChangeControlsMenu[28+2].status = IT_GRAYEDOUT2; + OP_ChangeControlsMenu[28+3].status = IT_GRAYEDOUT2; OP_ChangeControlsDef.prevMenu = &OP_P2ControlsDef; OP_ChangeControlsDef.menuid &= ~(((1 << MENUBITS) - 1) << MENUBITS); // remove second level diff --git a/src/p_user.c b/src/p_user.c index 2c8f3d2db..62eb74228 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -669,7 +669,7 @@ static void P_DeNightserizePlayer(player_t *player) player->powers[pw_carry] = CR_NIGHTSFALL; player->powers[pw_underwater] = 0; - player->pflags &= ~(PF_SPINDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_SHIELDDOWN|PF_STARTDASH|PF_GLIDING|PF_STARTJUMP|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED|PF_SPINNING|PF_DRILLING|PF_TRANSFERTOCLOSEST); + player->pflags &= ~(PF_SPINDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_STARTJUMP|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED|PF_SPINNING|PF_DRILLING|PF_TRANSFERTOCLOSEST); player->secondjump = 0; player->homing = 0; player->climbing = 0; @@ -802,7 +802,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) if (mapheaderinfo[gamemap-1]->nightstimer[newmare] > 0) nighttime = mapheaderinfo[gamemap-1]->nightstimer[newmare]; - player->pflags &= ~(PF_SPINDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_SHIELDDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY|PF_SPINNING|PF_DRILLING); + player->pflags &= ~(PF_SPINDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE|PF_THOKKED|PF_SHIELDABILITY|PF_SPINNING|PF_DRILLING); player->homing = 0; player->mo->fuse = 0; player->speed = 0; @@ -1362,6 +1362,8 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOSSMUSIC) && P_IsLocalPlayer(player)) P_PlayJingle(player, JT_SUPER); + S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi + player->mo->momx = player->mo->momy = player->mo->momz = player->cmomx = player->cmomy = player->rmomx = player->rmomy = 0; // Transformation animation @@ -1378,11 +1380,8 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) player->powers[pw_sneakers] = 0; } - if (G_CoopGametype()) - S_StartSound(player->mo, sfx_supert); //only hear it near yourself in co-op - else + if (!G_CoopGametype()) { - S_StartSound(NULL, sfx_supert); //let all players hear it -mattw_cfi HU_SetCEchoFlags(0); HU_SetCEchoDuration(5); HU_DoCEcho(va("%s\\is now super.\\\\\\\\", player_names[player-players])); @@ -1391,56 +1390,6 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) P_PlayerFlagBurst(player, false); } -// -// P_DoSuperDetransformation -// -// Detransform into regular Sonic! -static void P_DoSuperDetransformation(player_t *player) -{ - player->powers[pw_emeralds] = 0; // lost the power stones - P_SpawnGhostMobj(player->mo); - - player->powers[pw_super] = 0; - - // Restore color - if ((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER) - { - player->mo->color = SKINCOLOR_WHITE; - G_GhostAddColor(GHC_FIREFLOWER); - } - else - { - player->mo->color = P_GetPlayerColor(player); - G_GhostAddColor(GHC_NORMAL); - } - - if (!G_CoopGametype()) - player->powers[pw_flashing] = flashingtics-1; - - if (player->mo->sprite2 & SPR2F_SUPER) - P_SetMobjState(player->mo, player->mo->state-states); - - // Inform the netgame that the champion has fallen in the heat of battle. - if (!G_CoopGametype()) - { - S_StartSound(NULL, sfx_s3k66); //let all players hear it. - HU_SetCEchoFlags(0); - HU_SetCEchoDuration(5); - HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players])); - } - - // Resume normal music if you're the console player - if (P_IsLocalPlayer(player)) - { - music_stack_noposition = true; // HACK: Do not reposition next music - music_stack_fadeout = MUSICRATE/2; // HACK: Fade out current music - } - P_RestoreMusic(player); - - // If you had a shield, restore its visual significance. - P_SpawnShieldOrb(player); -} - // Adds to the player's score void P_AddPlayerScore(player_t *player, UINT32 amount) { @@ -4199,16 +4148,6 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) I_Assert(player != NULL); I_Assert(!P_MobjWasRemoved(player->mo)); - - // Toss a flag - if (cmd->buttons & BT_TOSSFLAG && G_GametypeHasTeams() - && !(player->powers[pw_super]) && !(player->tossdelay)) - { - if (!(player->gotflag & (GF_REDFLAG|GF_BLUEFLAG))) - P_PlayerEmeraldBurst(player, true); // Toss emeralds - else - P_PlayerFlagBurst(player, true); - } if (!(cmd->buttons & (BT_ATTACK|BT_FIRENORMAL))) { @@ -4218,10 +4157,9 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) return; } - if (player->pflags & PF_ATTACKDOWN || player->climbing) + if (player->pflags & PF_ATTACKDOWN || player->climbing || (G_TagGametype() && !(player->pflags & PF_TAGIT))) return; - // Fire a fireball if we have the Fire Flower powerup! if (((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER) && !(player->weapondelay)) { player->pflags |= PF_ATTACKDOWN; @@ -4233,8 +4171,7 @@ static void P_DoFiring(player_t *player, ticcmd_t *cmd) return; } - // No ringslinging outside of ringslinger! - if (!G_RingSlingerGametype() || player->weapondelay || (G_TagGametype() && !(player->pflags & PF_TAGIT))) + if (!G_RingSlingerGametype() || player->weapondelay) return; player->pflags |= PF_ATTACKDOWN; @@ -4412,7 +4349,34 @@ static void P_DoSuperStuff(player_t *player) // If you're super and not Sonic, de-superize! if (!(ALL7EMERALDS(emeralds) && player->charflags & SF_SUPER)) { - P_DoSuperDetransformation(player); + player->powers[pw_super] = 0; + P_SetPlayerMobjState(player->mo, S_PLAY_STND); + if (P_IsLocalPlayer(player)) + { + music_stack_noposition = true; // HACK: Do not reposition next music + music_stack_fadeout = MUSICRATE/2; // HACK: Fade out current music + } + P_RestoreMusic(player); + P_SpawnShieldOrb(player); + + // Restore color + if ((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER) + { + player->mo->color = SKINCOLOR_WHITE; + G_GhostAddColor(GHC_FIREFLOWER); + } + else + { + player->mo->color = P_GetPlayerColor(player); + G_GhostAddColor(GHC_NORMAL); + } + + if (!G_CoopGametype()) + { + HU_SetCEchoFlags(0); + HU_SetCEchoDuration(5); + HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players])); + } return; } @@ -4439,31 +4403,69 @@ static void P_DoSuperStuff(player_t *player) // Ran out of rings while super! if (player->rings <= 0 || player->exiting) - P_DoSuperDetransformation(player); + { + player->powers[pw_emeralds] = 0; // lost the power stones + P_SpawnGhostMobj(player->mo); + + player->powers[pw_super] = 0; + + // Restore color + if ((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER) + { + player->mo->color = SKINCOLOR_WHITE; + G_GhostAddColor(GHC_FIREFLOWER); + } + else + { + player->mo->color = P_GetPlayerColor(player); + G_GhostAddColor(GHC_NORMAL); + } + + if (!G_CoopGametype()) + player->powers[pw_flashing] = flashingtics-1; + + if (player->mo->sprite2 & FF_SPR2SUPER) + P_SetPlayerMobjState(player->mo, player->mo->state-states); + + // Inform the netgame that the champion has fallen in the heat of battle. + if (!G_CoopGametype()) + { + S_StartSound(NULL, sfx_s3k66); //let all players hear it. + HU_SetCEchoFlags(0); + HU_SetCEchoDuration(5); + HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players])); + } + + // Resume normal music if you're the console player + if (P_IsLocalPlayer(player)) + { + music_stack_noposition = true; // HACK: Do not reposition next music + music_stack_fadeout = MUSICRATE/2; // HACK: Fade out current music + } + P_RestoreMusic(player); + + // If you had a shield, restore its visual significance. + P_SpawnShieldOrb(player); + } } } // // P_SuperReady // -// Returns true if player is ready to transform or detransform +// Returns true if player is ready to turn super, duh // boolean P_SuperReady(player_t *player) { - if (player->mo - && (player->rings >= 50) - && ALL7EMERALDS(emeralds) + if (!player->powers[pw_super] + && !player->powers[pw_invulnerability] + && !player->powers[pw_tailsfly] && (player->charflags & SF_SUPER) && (player->pflags & PF_JUMPED) - && !player->powers[pw_super] - && !player->powers[pw_invulnerability] && !(player->powers[pw_shield] & SH_NOSTACK) - && !player->powers[pw_tailsfly] - && !player->powers[pw_carry] - && !P_PlayerInPain(player) - && !player->climbing - && !(player->pflags & (PF_JUMPSTASIS|PF_THOKKED|PF_STARTDASH|PF_GLIDING|PF_SLIDING|PF_SHIELDABILITY)) - && !(maptol & TOL_NIGHTS)) + && !(maptol & TOL_NIGHTS) + && ALL7EMERALDS(emeralds) + && (player->rings >= 50)) return true; return false; @@ -5168,7 +5170,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock { mobj_t *lockonshield = NULL; - if ((player->powers[pw_shield] & SH_NOSTACK) && !player->powers[pw_super] && !(player->pflags & PF_SHIELDDOWN) + 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 && !(player->charflags & SF_NOSHIELDABILITY)) @@ -5198,7 +5200,7 @@ static boolean P_PlayerShieldThink(player_t *player, ticcmd_t *cmd, mobj_t *lock } } } - if ((!(player->charflags & SF_NOSHIELDABILITY)) && (cmd->buttons & BT_SHIELD && !LUA_HookPlayer(player, HOOK(ShieldSpecial)))) // Shield button effects + if ((!(player->charflags & SF_NOSHIELDABILITY)) && (cmd->buttons & BT_SPIN && !LUA_HookPlayer(player, HOOK(ShieldSpecial)))) // Spin button effects { // Force stop if ((player->powers[pw_shield] & ~(SH_FORCEHP|SH_STACK)) == SH_FORCE) @@ -5320,45 +5322,52 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) ; else if (P_PlayerShieldThink(player, cmd, lockonthok, visual)) ; - else if ((cmd->buttons & BT_SPIN) && !LUA_HookPlayer(player, HOOK(JumpSpinSpecial))) + else if ((cmd->buttons & BT_SPIN)) { - if (spinshieldhack && !(player->pflags & PF_SPINDOWN) && P_SuperReady(player)) + if (!(player->pflags & PF_SPINDOWN) && P_SuperReady(player)) { - case CA_THOK: - if (player->powers[pw_super]) // Super Sonic float - { - if ((player->speed > 5*player->mo->scale) // FixedMul(5<mo->scale), but scale is FRACUNIT-based - && (P_MobjFlip(player->mo)*player->mo->momz <= 0)) - { - if (player->panim != PA_RUN && player->panim != PA_WALK) - { - if (player->speed >= FixedMul(player->runspeed, player->mo->scale)) - P_SetMobjState(player->mo, S_PLAY_FLOAT_RUN); - else - P_SetMobjState(player->mo, S_PLAY_FLOAT); - } - - player->mo->momz = 0; - player->pflags &= ~(PF_STARTJUMP|PF_SPINNING); - player->secondjump = 1; - } - } - break; - case CA_TELEKINESIS: - if (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || (player->charflags & SF_MULTIABILITY)) - { - P_Telekinesis(player, - -FixedMul(player->actionspd, player->mo->scale), // -ve thrust (pulling towards player) - FixedMul(384*FRACUNIT, player->mo->scale)); - } - break; - case CA_TWINSPIN: - if ((player->charability2 == CA2_MELEE) && (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || player->charflags & SF_MULTIABILITY)) - P_DoTwinSpin(player); - break; - default: - break; + // If you can turn super and aren't already, + // and you don't have a shield, do it! + P_DoSuperTransformation(player, false); } + else if (!LUA_HookPlayer(player, HOOK(JumpSpinSpecial))) + switch (player->charability) + { + case CA_THOK: + if (player->powers[pw_super]) // Super Sonic float + { + if ((player->speed > 5*player->mo->scale) // FixedMul(5<mo->scale), but scale is FRACUNIT-based + && (P_MobjFlip(player->mo)*player->mo->momz <= 0)) + { + if (player->panim != PA_RUN && player->panim != PA_WALK) + { + if (player->speed >= FixedMul(player->runspeed, player->mo->scale)) + P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN); + else + P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT); + } + + player->mo->momz = 0; + player->pflags &= ~(PF_STARTJUMP|PF_SPINNING); + player->secondjump = 1; + } + } + break; + case CA_TELEKINESIS: + if (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || (player->charflags & SF_MULTIABILITY)) + { + P_Telekinesis(player, + -FixedMul(player->actionspd, player->mo->scale), // -ve thrust (pulling towards player) + FixedMul(384*FRACUNIT, player->mo->scale)); + } + break; + case CA_TWINSPIN: + if ((player->charability2 == CA2_MELEE) && (!(player->pflags & (PF_THOKKED|PF_SPINDOWN)) || player->charflags & SF_MULTIABILITY)) + P_DoTwinSpin(player); + break; + default: + break; + } } } @@ -5421,6 +5430,12 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) } else if (player->pflags & PF_SLIDING || ((gametyperules & GTR_TEAMFLAGS) && player->gotflag) || player->pflags & PF_SHIELDABILITY) ; + /*else if (P_SuperReady(player)) + { + // If you can turn super and aren't already, + // and you don't have a shield, do it! + P_DoSuperTransformation(player, false); + }*/ else if (player->pflags & PF_JUMPED) { if (!LUA_HookPlayer(player, HOOK(AbilitySpecial))) @@ -8785,25 +8800,9 @@ void P_MovePlayer(player_t *player) P_PlayerFlagBurst(player, true); } - // Check for fire and shield buttons - if (!player->exiting && !(player->pflags & PF_STASIS)) - { - // Check for fire buttons + // check for fire + if (!player->exiting) P_DoFiring(player, cmd); - - // Release the shield button - if (!(cmd->buttons & BT_SHIELD)) - player->pflags &= ~PF_SHIELDDOWN; - - // Shield button behavior - // Check P_PlayerShieldThink for actual shields! - else if (!(player->pflags & PF_SHIELDDOWN)) - { - // Transform into super if we can! - if (P_SuperReady(player)) - P_DoSuperTransformation(player, false); - } - } { boolean atspinheight = false; diff --git a/src/y_inter.c b/src/y_inter.c index 086c0d860..d7e644567 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -581,7 +581,7 @@ void Y_IntermissionDrawer(void) if (LUA_HudEnabled(hud_intermissiontitletext)) { const char *ringtext = "\x82" "50 rings, no shield"; - const char *tut1text = "\x82" "press " "\x80" "shield"; + const char *tut1text = "\x82" "press " "\x80" "spin"; const char *tut2text = "\x82" "mid-" "\x80" "jump"; ttheight = 8; V_DrawLevelTitle(data.spec.passedx1 + xoffset1, ttheight, 0, data.spec.passed1); From a9cff13a1cedc7f020a9c10b9eb00a25c3766745 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 22 Jan 2025 21:03:58 -0300 Subject: [PATCH 346/353] Fix building --- src/p_user.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 62eb74228..a43736b85 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4350,7 +4350,7 @@ static void P_DoSuperStuff(player_t *player) if (!(ALL7EMERALDS(emeralds) && player->charflags & SF_SUPER)) { player->powers[pw_super] = 0; - P_SetPlayerMobjState(player->mo, S_PLAY_STND); + P_SetMobjState(player->mo, S_PLAY_STND); if (P_IsLocalPlayer(player)) { music_stack_noposition = true; // HACK: Do not reposition next music @@ -4425,7 +4425,7 @@ static void P_DoSuperStuff(player_t *player) player->powers[pw_flashing] = flashingtics-1; if (player->mo->sprite2 & FF_SPR2SUPER) - P_SetPlayerMobjState(player->mo, player->mo->state-states); + P_SetMobjState(player->mo, player->mo->state-states); // Inform the netgame that the champion has fallen in the heat of battle. if (!G_CoopGametype()) @@ -5342,9 +5342,9 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) if (player->panim != PA_RUN && player->panim != PA_WALK) { if (player->speed >= FixedMul(player->runspeed, player->mo->scale)) - P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN); + P_SetMobjState(player->mo, S_PLAY_FLOAT_RUN); else - P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT); + P_SetMobjState(player->mo, S_PLAY_FLOAT); } player->mo->momz = 0; From 746a014ad1b5845aac82b3611536771839ca6e44 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 22 Jan 2025 21:11:06 -0300 Subject: [PATCH 347/353] Re-add P_DoSuperDetransformation --- src/lua_baselib.c | 12 ++++++ src/p_local.h | 1 + src/p_user.c | 93 ++++++++++++++++++++++++++--------------------- 3 files changed, 64 insertions(+), 42 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 085a9b23e..ecd1ee55e 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2513,6 +2513,17 @@ static int lib_pDoSuperTransformation(lua_State *L) return 0; } +static int lib_pDoSuperDetransformation(lua_State *L) +{ + player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); + NOHUD + INLEVEL + if (!player) + return LUA_ErrInvalid(L, "player_t"); + P_DoSuperDetransformation(player); + return 0; +} + static int lib_pExplodeMissile(lua_State *L) { mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); @@ -4521,6 +4532,7 @@ static luaL_Reg lib[] = { {"P_VectorInstaThrust",lib_pVectorInstaThrust}, {"P_SetMobjStateNF",lib_pSetMobjStateNF}, {"P_DoSuperTransformation",lib_pDoSuperTransformation}, + {"P_DoSuperDetransformation",lib_pDoSuperDetransformation}, {"P_ExplodeMissile",lib_pExplodeMissile}, {"P_MobjTouchingSectorSpecial",lib_pMobjTouchingSectorSpecial}, {"P_ThingOnSpecial3DFloor",lib_pThingOnSpecial3DFloor}, diff --git a/src/p_local.h b/src/p_local.h index 8a4ec5943..de519b211 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -544,6 +544,7 @@ void P_ThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move); void P_VectorInstaThrust(fixed_t xa, fixed_t xb, fixed_t xc, fixed_t ya, fixed_t yb, fixed_t yc, fixed_t za, fixed_t zb, fixed_t zc, fixed_t momentum, mobj_t *mo); void P_DoSuperTransformation(player_t *player, boolean giverings); +void P_DoSuperDetransformation(player_t *player); void P_ExplodeMissile(mobj_t *mo); void P_CheckGravity(mobj_t *mo, boolean affect); void P_SetPitchRollFromSlope(mobj_t *mo, pslope_t *slope); diff --git a/src/p_user.c b/src/p_user.c index a43736b85..7cc9c02ae 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1390,6 +1390,56 @@ void P_DoSuperTransformation(player_t *player, boolean giverings) P_PlayerFlagBurst(player, false); } +// +// P_DoSuperDetransformation +// +// Detransform into regular Sonic! +void P_DoSuperDetransformation(player_t *player) +{ + player->powers[pw_emeralds] = 0; // lost the power stones + P_SpawnGhostMobj(player->mo); + + player->powers[pw_super] = 0; + + // Restore color + if ((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER) + { + player->mo->color = SKINCOLOR_WHITE; + G_GhostAddColor(GHC_FIREFLOWER); + } + else + { + player->mo->color = P_GetPlayerColor(player); + G_GhostAddColor(GHC_NORMAL); + } + + if (!G_CoopGametype()) + player->powers[pw_flashing] = flashingtics-1; + + if (player->mo->sprite2 & FF_SPR2SUPER) + P_SetMobjState(player->mo, player->mo->state-states); + + // Inform the netgame that the champion has fallen in the heat of battle. + if (!G_CoopGametype()) + { + S_StartSound(NULL, sfx_s3k66); //let all players hear it. + HU_SetCEchoFlags(0); + HU_SetCEchoDuration(5); + HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players])); + } + + // Resume normal music if you're the console player + if (P_IsLocalPlayer(player)) + { + music_stack_noposition = true; // HACK: Do not reposition next music + music_stack_fadeout = MUSICRATE/2; // HACK: Fade out current music + } + P_RestoreMusic(player); + + // If you had a shield, restore its visual significance. + P_SpawnShieldOrb(player); +} + // Adds to the player's score void P_AddPlayerScore(player_t *player, UINT32 amount) { @@ -4404,48 +4454,7 @@ static void P_DoSuperStuff(player_t *player) // Ran out of rings while super! if (player->rings <= 0 || player->exiting) { - player->powers[pw_emeralds] = 0; // lost the power stones - P_SpawnGhostMobj(player->mo); - - player->powers[pw_super] = 0; - - // Restore color - if ((player->powers[pw_shield] & SH_STACK) == SH_FIREFLOWER) - { - player->mo->color = SKINCOLOR_WHITE; - G_GhostAddColor(GHC_FIREFLOWER); - } - else - { - player->mo->color = P_GetPlayerColor(player); - G_GhostAddColor(GHC_NORMAL); - } - - if (!G_CoopGametype()) - player->powers[pw_flashing] = flashingtics-1; - - if (player->mo->sprite2 & FF_SPR2SUPER) - P_SetMobjState(player->mo, player->mo->state-states); - - // Inform the netgame that the champion has fallen in the heat of battle. - if (!G_CoopGametype()) - { - S_StartSound(NULL, sfx_s3k66); //let all players hear it. - HU_SetCEchoFlags(0); - HU_SetCEchoDuration(5); - HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players])); - } - - // Resume normal music if you're the console player - if (P_IsLocalPlayer(player)) - { - music_stack_noposition = true; // HACK: Do not reposition next music - music_stack_fadeout = MUSICRATE/2; // HACK: Fade out current music - } - P_RestoreMusic(player); - - // If you had a shield, restore its visual significance. - P_SpawnShieldOrb(player); + P_DoSuperDetransformation(player); } } } From 24a2d88eb2410f775e6a7c3cdaa09fda9796957e Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Wed, 22 Jan 2025 21:40:00 -0300 Subject: [PATCH 348/353] Fix skin.sprites[i] when used with FF_SPR2SUPER --- src/lua_skinlib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lua_skinlib.c b/src/lua_skinlib.c index 0e8860804..6650e60e6 100644 --- a/src/lua_skinlib.c +++ b/src/lua_skinlib.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 2014-2016 by John "JTE" Muniz. -// Copyright (C) 2014-2024 by Sonic Team Junior. +// Copyright (C) 2014-2025 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -368,7 +368,10 @@ static int lib_numSkinsSprites(lua_State *L) static int lib_getSkinSpriteCompat(lua_State *L) { spritedef_t *sksprites = *(spritedef_t **)luaL_checkudata(L, 1, META_SKINSPRITESCOMPAT); - playersprite_t i = luaL_checkinteger(L, 2); + INT32 i = luaL_checkinteger(L, 2) & (SPR2F_MASK | SPR2F_SUPER); + + if (i & SPR2F_SUPER) + i = (i & ~SPR2F_SUPER) + NUMPLAYERSPRITES; if (i < 0 || i >= NUMPLAYERSPRITES*2) return luaL_error(L, "skin sprites index %d out of range (0 - %d)", i, (NUMPLAYERSPRITES*2)-1); From f2a4e7629548afa3a584161626530fc9e0d92b95 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Thu, 23 Jan 2025 03:15:29 -0300 Subject: [PATCH 349/353] Use deh_strlcpy instead of strncpy or strlcpy in SOC parser --- src/deh_soc.c | 139 +++++++++++++++++++++++++++++++------------------ src/doomstat.h | 6 +-- src/m_menu.h | 8 +-- 3 files changed, 94 insertions(+), 59 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index df11a3e6d..343beb301 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -1,7 +1,7 @@ // SONIC ROBO BLAST 2 //----------------------------------------------------------------------------- // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2024 by Sonic Team Junior. +// Copyright (C) 1999-2025 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -286,6 +286,7 @@ void readPlayer(MYFILE *f, INT32 num) } if (playertext) { + // PLAYERTEXT is really weird, so this doesn't use deh_strlcpy. strlcpy(description[num].notes, playertext, NOTE_SIZE); strlcat(description[num].notes, myhashfgets(playertext, NOTE_SIZE, f), NOTE_SIZE); @@ -324,7 +325,8 @@ void readPlayer(MYFILE *f, INT32 num) if (fastcmp(word, "PICNAME")) { SLOTFOUND - strncpy(description[num].picname, word2, sizeof(description[num].picname)-1); + deh_strlcpy(description[num].picname, word2, sizeof description[num].picname, + va("Character %d: picname", num)); } else if (fastcmp(word, "DISPLAYNAME")) { @@ -345,7 +347,8 @@ void readPlayer(MYFILE *f, INT32 num) cur = strchr(cur, '#'); } - strlcpy(description[num].displayname, stringvalue, sizeof description[num].displayname); + deh_strlcpy(description[num].displayname, stringvalue, sizeof description[num].displayname, + va("Character %d: displayname", num)); } else if (fastcmp(word, "OPPOSITECOLOR") || fastcmp(word, "OPPOSITECOLOUR")) { @@ -355,7 +358,8 @@ void readPlayer(MYFILE *f, INT32 num) else if (fastcmp(word, "NAMETAG") || fastcmp(word, "TAGNAME")) { SLOTFOUND - strncpy(description[num].nametag, word2, sizeof(description[num].nametag)-1); + deh_strlcpy(description[num].nametag, word2, sizeof description[num].nametag, + va("Character %d: nametag", num)); } else if (fastcmp(word, "TAGTEXTCOLOR") || fastcmp(word, "TAGTEXTCOLOUR")) { @@ -387,7 +391,8 @@ void readPlayer(MYFILE *f, INT32 num) { // Send to free slot. SLOTFOUND - strlcpy(description[num].skinname, word2, sizeof description[num].skinname); + deh_strlcpy(description[num].skinname, word2, sizeof description[num].skinname, + va("Character %d: skinname", num)); strlwr(description[num].skinname); } else if (!failure) @@ -1196,6 +1201,7 @@ void readgametype(MYFILE *f, char *gtname) } if (descr) { + // DESCRIPTION is really weird, so this doesn't use deh_strlcpy. strlcpy(gtdescription, descr, sizeof (gtdescription)); strlcat(gtdescription, myhashfgets(descr, sizeof (gtdescription), f), @@ -1402,7 +1408,7 @@ void readlevelheader(MYFILE *f, INT32 num) { deh_strlcpy(mapheaderinfo[num-1]->lvlttl, word2, sizeof(mapheaderinfo[num-1]->lvlttl), va("Level header %d: levelname", num)); - strlcpy(mapheaderinfo[num-1]->selectheading, word2, sizeof(mapheaderinfo[num-1]->selectheading)); // not deh_ so only complains once + strlcpy(mapheaderinfo[num-1]->selectheading, word2, sizeof(mapheaderinfo[num-1]->selectheading)); // not deh_strlcpy so only complains once continue; } // CHEAP HACK: move this over here for lowercase subtitles @@ -1445,10 +1451,10 @@ void readlevelheader(MYFILE *f, INT32 num) // Newly allocated modoption = &mapheaderinfo[num-1]->customopts[j]; - strncpy(modoption->option, word, 31); - modoption->option[31] = '\0'; - strncpy(modoption->value, word2, 255); - modoption->value[255] = '\0'; + deh_strlcpy(modoption->option, word, sizeof(modoption->option), + va("Level header %d: custom option %d key", num, j)); + deh_strlcpy(modoption->value, word2, sizeof(modoption->value), + va("Level header %d: custom option %d value", num, j)); continue; } @@ -1626,7 +1632,7 @@ void readlevelheader(MYFILE *f, INT32 num) else if (fastcmp(word, "KEYWORDS")) { deh_strlcpy(mapheaderinfo[num-1]->keywords, word2, - sizeof(mapheaderinfo[num-1]->keywords), va("Level header %d: keywords", num)); + sizeof(mapheaderinfo[num-1]->keywords), va("Level header %d: keywords", num)); } else if (fastcmp(word, "MUSIC")) { @@ -1675,7 +1681,8 @@ void readlevelheader(MYFILE *f, INT32 num) } else if (fastcmp(word, "FORCECHARACTER")) { - strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, SKINNAMESIZE+1); + deh_strlcpy(mapheaderinfo[num-1]->forcecharacter, word2, sizeof mapheaderinfo[num-1]->forcecharacter, + va("Level header %d: forcecharacter", num)); strlwr(mapheaderinfo[num-1]->forcecharacter); // skin names are lowercase } else if (fastcmp(word, "WEATHER")) @@ -1683,7 +1690,10 @@ void readlevelheader(MYFILE *f, INT32 num) else if (fastcmp(word, "SKYNUM")) mapheaderinfo[num-1]->skynum = (INT16)i; else if (fastcmp(word, "INTERSCREEN")) - strncpy(mapheaderinfo[num-1]->interscreen, word2, sizeof(mapheaderinfo[num-1]->interscreen)-1); + { + deh_strlcpy(mapheaderinfo[num-1]->interscreen, word2, sizeof mapheaderinfo[num-1]->interscreen, + va("Level header %d: interscreen", num)); + } else if (fastcmp(word, "PRECUTSCENENUM")) mapheaderinfo[num-1]->precutscenenum = (UINT8)i; else if (fastcmp(word, "CUTSCENENUM")) @@ -1985,14 +1995,17 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) picid = (UINT8)atoi(word + 3); if (picid > 8 || picid == 0) { - deh_warning("CutSceneScene %d: unknown word '%s'", num, word); + deh_warning("Cutscene %d, scene %d: pic number %d out of range (1 - %d)", + num + 1, scenenum + 1, picid, 8); continue; } --picid; if (fastcmp(word+4, "NAME")) { - strncpy(cutscenes[num]->scene[scenenum].picname[picid], word2, 8); + deh_strlcpy(cutscenes[num]->scene[scenenum].picname[picid], word2, + sizeof cutscenes[num]->scene[scenenum].picname[picid], + va("Cutscene %d, scene %d, pic %d: name", num + 1, scenenum + 1, picid + 1)); } else if (fastcmp(word+4, "HIRES")) { @@ -2011,12 +2024,13 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) cutscenes[num]->scene[scenenum].ycoord[picid] = usi; } else - deh_warning("CutSceneScene %d: unknown word '%s'", num, word); + deh_warning("Cutscene %d, scene %d: unknown word '%s'", num + 1, scenenum + 1, word); } else if (fastcmp(word, "MUSIC")) { - strncpy(cutscenes[num]->scene[scenenum].musswitch, word2, 7); - cutscenes[num]->scene[scenenum].musswitch[6] = 0; + deh_strlcpy(cutscenes[num]->scene[scenenum].musswitch, word2, + sizeof cutscenes[num]->scene[scenenum].musswitch, + va("Cutscene %d, scene %d: music", num + 1, scenenum + 1)); } else if (fastcmp(word, "MUSICTRACK")) { @@ -2051,7 +2065,7 @@ static void readcutscenescene(MYFILE *f, INT32 num, INT32 scenenum) cutscenes[num]->scene[scenenum].fadecolor = (UINT8)i; } else - deh_warning("CutSceneScene %d: unknown word '%s'", num, word); + deh_warning("Cutscene %d, scene %d: unknown word '%s'", num + 1, scenenum + 1, word); } } while (!myfeof(f)); // finish when the line is empty @@ -2109,11 +2123,10 @@ void readcutscene(MYFILE *f, INT32 num) readcutscenescene(f, num, value - 1); } else - deh_warning("Scene number %d out of range (1 - 128)", value); - + deh_warning("Cutscene %d: scene number %d out of range (1 - 128)", num + 1, value); } else - deh_warning("Cutscene %d: unknown word '%s', Scene expected.", num, word); + deh_warning("Cutscene %d: unknown word '%s', Scene expected.", num + 1, word); } } while (!myfeof(f)); // finish when the line is empty @@ -2234,7 +2247,8 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum) for (picid = 0; picid < MAX_PROMPT_PICS; picid++) { - strncpy(textprompts[num]->page[pagenum].picname[picid], textprompts[num]->page[metapagenum].picname[picid], 8); + // Doesn't use deh_strlcpy because it's not copying input. + strlcpy(textprompts[num]->page[pagenum].picname[picid], textprompts[num]->page[metapagenum].picname[picid], sizeof textprompts[num]->page[pagenum].picname[picid]); textprompts[num]->page[pagenum].pichires[picid] = textprompts[num]->page[metapagenum].pichires[picid]; textprompts[num]->page[pagenum].picduration[picid] = textprompts[num]->page[metapagenum].picduration[picid]; textprompts[num]->page[pagenum].xcoord[picid] = textprompts[num]->page[metapagenum].xcoord[picid]; @@ -2247,14 +2261,17 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum) picid = (UINT8)atoi(word + 3); if (picid > MAX_PROMPT_PICS || picid == 0) { - deh_warning("textpromptscene %d: unknown word '%s'", num, word); + deh_warning("Text prompt %d, page %d: pic number %d out of range (1 - %d)", + num + 1, pagenum + 1, picid, MAX_PROMPT_PICS); continue; } --picid; if (fastcmp(word+4, "NAME")) { - strncpy(textprompts[num]->page[pagenum].picname[picid], word2, 8); + deh_strlcpy(textprompts[num]->page[pagenum].picname[picid], word2, + sizeof textprompts[num]->page[pagenum].picname[picid], + va("Text prompt %d, page %d, pic %d: name", num + 1, pagenum + 1, picid + 1)); } else if (fastcmp(word+4, "HIRES")) { @@ -2273,12 +2290,16 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum) textprompts[num]->page[pagenum].ycoord[picid] = usi; } else - deh_warning("textpromptscene %d: unknown word '%s'", num, word); + { + deh_warning("Text prompt %d, page %d: unknown word '%s'", + num + 1, pagenum + 1, word); + } } else if (fastcmp(word, "MUSIC")) { - strncpy(textprompts[num]->page[pagenum].musswitch, word2, 7); - textprompts[num]->page[pagenum].musswitch[6] = 0; + deh_strlcpy(textprompts[num]->page[pagenum].musswitch, word2, + sizeof textprompts[num]->page[pagenum].musswitch, + va("Text prompt %d, page %d: music", num + 1, pagenum + 1)); } else if (fastcmp(word, "MUSICTRACK")) { @@ -2293,30 +2314,35 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum) { if (*word2 != '\0') { - INT32 j; + size_t j; // HACK: Add yellow control char now // so the drawing function doesn't call it repeatedly - char name[34]; + char name[32 + 2]; name[0] = '\x82'; // color yellow - name[1] = 0; - strncat(name, word2, 32); - name[33] = 0; + + // So that we still get a warning. + deh_strlcpy(name + 1, word2, (sizeof(name)) - 1, + va("Text prompt %d, page %d: name", num + 1, pagenum + 1)); // Replace _ with ' ' - for (j = 0; j < 32 && name[j]; j++) + for (j = 1; j < sizeof(name) && name[j]; j++) { if (name[j] == '_') name[j] = ' '; } - strncpy(textprompts[num]->page[pagenum].name, name, sizeof(textprompts[num]->page[pagenum].name)); + strlcpy(textprompts[num]->page[pagenum].name, name, sizeof(textprompts[num]->page[pagenum].name)); } else *textprompts[num]->page[pagenum].name = '\0'; } else if (fastcmp(word, "ICON")) - strncpy(textprompts[num]->page[pagenum].iconname, word2, 8); + { + deh_strlcpy(textprompts[num]->page[pagenum].iconname, word2, + sizeof textprompts[num]->page[pagenum].iconname, + va("Text prompt %d, page %d: icon", num + 1, pagenum + 1)); + } else if (fastcmp(word, "ICONALIGN")) textprompts[num]->page[pagenum].rightside = (i || word2[0] == 'R'); else if (fastcmp(word, "ICONFLIP")) @@ -2383,8 +2409,9 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum) { UINT8 metapagenum = usi - 1; - strncpy(textprompts[num]->page[pagenum].name, textprompts[num]->page[metapagenum].name, 32); - strncpy(textprompts[num]->page[pagenum].iconname, textprompts[num]->page[metapagenum].iconname, 8); + // Doesn't use deh_strlcpy because it's not copying input. + strlcpy(textprompts[num]->page[pagenum].name, textprompts[num]->page[metapagenum].name, sizeof textprompts[num]->page[pagenum].name); + strlcpy(textprompts[num]->page[pagenum].iconname, textprompts[num]->page[metapagenum].iconname, sizeof textprompts[num]->page[pagenum].iconname); textprompts[num]->page[pagenum].rightside = textprompts[num]->page[metapagenum].rightside; textprompts[num]->page[pagenum].iconflip = textprompts[num]->page[metapagenum].iconflip; textprompts[num]->page[pagenum].lines = textprompts[num]->page[metapagenum].lines; @@ -2399,17 +2426,25 @@ static void readtextpromptpage(MYFILE *f, INT32 num, INT32 pagenum) } } else if (fastcmp(word, "TAG")) - strncpy(textprompts[num]->page[pagenum].tag, word2, 33); + { + deh_strlcpy(textprompts[num]->page[pagenum].tag, word2, + sizeof textprompts[num]->page[pagenum].tag, + va("Text prompt %d, page %d: tag", num + 1, pagenum + 1)); + } else if (fastcmp(word, "NEXTPROMPT")) textprompts[num]->page[pagenum].nextprompt = usi; else if (fastcmp(word, "NEXTPAGE")) textprompts[num]->page[pagenum].nextpage = usi; else if (fastcmp(word, "NEXTTAG")) - strncpy(textprompts[num]->page[pagenum].nexttag, word2, 33); + { + deh_strlcpy(textprompts[num]->page[pagenum].nexttag, word2, + sizeof textprompts[num]->page[pagenum].nexttag, + va("Text prompt %d, page %d: nexttag", num + 1, pagenum + 1)); + } else if (fastcmp(word, "TIMETONEXT")) textprompts[num]->page[pagenum].timetonext = get_number(word2); else - deh_warning("PromptPage %d: unknown word '%s'", num, word); + deh_warning("Text prompt %d, page %d: unknown word '%s'", num + 1, pagenum + 1, word); } } while (!myfeof(f)); // finish when the line is empty @@ -2469,11 +2504,11 @@ void readtextprompt(MYFILE *f, INT32 num) readtextpromptpage(f, num, value - 1); } else - deh_warning("Page number %d out of range (1 - %d)", value, MAX_PAGES); + deh_warning("Prompt %d: page number %d out of range (1 - %d)", num + 1, value, MAX_PAGES); } else - deh_warning("Prompt %d: unknown word '%s', Page expected.", num, word); + deh_warning("Prompt %d: unknown word '%s', Page expected.", num + 1, word); } } while (!myfeof(f)); // finish when the line is empty @@ -2522,7 +2557,8 @@ void readmenu(MYFILE *f, INT32 num) if (fastcmp(word, "BACKGROUNDNAME")) { - strncpy(menupres[num].bgname, word2, 8); + deh_strlcpy(menupres[num].bgname, word2, + sizeof menupres[num].bgname, va("Menu %d: backgroundname", num)); titlechanged = true; } else if (fastcmp(word, "HIDEBACKGROUND")) @@ -2565,7 +2601,8 @@ void readmenu(MYFILE *f, INT32 num) } else if (fastcmp(word, "TITLEPICSNAME")) { - strncpy(menupres[num].ttname, word2, 9); + deh_strlcpy(menupres[num].ttname, word2, + sizeof menupres[num].ttname, va("Menu %d: titlepicsname", num)); titlechanged = true; } else if (fastcmp(word, "TITLEPICSX")) @@ -2601,8 +2638,8 @@ void readmenu(MYFILE *f, INT32 num) } else if (fastcmp(word, "MUSIC")) { - strncpy(menupres[num].musname, word2, 7); - menupres[num].musname[6] = 0; + deh_strlcpy(menupres[num].musname, word2, + sizeof menupres[num].musname, va("Menu %d: music", num)); titlechanged = true; } else if (fastcmp(word, "MUSICTRACK")) @@ -3590,9 +3627,7 @@ void readmaincfg(MYFILE *f) lumpnum_t lumpnum; char newname[9]; - strncpy(newname, word2, 8); - - newname[8] = '\0'; + deh_strlcpy(newname, word2, sizeof newname, va("Maincfg: execcfg")); lumpnum = W_CheckNumForName(newname); @@ -3800,7 +3835,7 @@ void readmaincfg(MYFILE *f) } else if (fastcmp(word, "TITLEPICSNAME")) { - strncpy(ttname, word2, sizeof(ttname)-1); + deh_strlcpy(ttname, word2, sizeof ttname, va("Maincfg: titlepicsname")); titlechanged = true; } else if (fastcmp(word, "TITLEPICSX")) @@ -3910,7 +3945,7 @@ void readmaincfg(MYFILE *f) } else if (fastcmp(word, "CUSTOMVERSION")) { - strlcpy(customversionstring, word2, sizeof (customversionstring)); + deh_strlcpy(customversionstring, word2, sizeof customversionstring, va("Maincfg: customversion")); //titlechanged = true; } else if (fastcmp(word, "BOOTMAP")) diff --git a/src/doomstat.h b/src/doomstat.h index 5246349de..4abc9d21a 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. -// Copyright (C) 1999-2024 by Sonic Team Junior. +// Copyright (C) 1999-2025 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -209,7 +209,7 @@ typedef struct UINT8 picmode; // sequence mode after displaying last pic, 0 = persist, 1 = loop, 2 = destroy UINT8 pictoloop; // if picmode == loop, which pic to loop to? UINT8 pictostart; // initial pic number to show - char picname[MAX_PROMPT_PICS][8]; + char picname[MAX_PROMPT_PICS][9]; UINT8 pichires[MAX_PROMPT_PICS]; UINT16 xcoord[MAX_PROMPT_PICS]; // gfx UINT16 ycoord[MAX_PROMPT_PICS]; // gfx @@ -221,7 +221,7 @@ typedef struct char tag[33]; // page tag char name[34]; // narrator name, extra char for color - char iconname[8]; // narrator icon lump + char iconname[9]; // narrator icon lump boolean rightside; // narrator side, false = left, true = right boolean iconflip; // narrator flip icon horizontally UINT8 hidehud; // hide hud, 0 = show all, 1 = hide depending on prompt position (top/bottom), 2 = hide all diff --git a/src/m_menu.h b/src/m_menu.h index cfe811d0b..58c557341 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -3,7 +3,7 @@ // Copyright (C) 1993-1996 by id Software, Inc. // Copyright (C) 1998-2000 by DooM Legacy Team. // Copyright (C) 2011-2016 by Matthew "Kaito Sinclaire" Walsh. -// Copyright (C) 1999-2024 by Sonic Team Junior. +// Copyright (C) 1999-2025 by Sonic Team Junior. // // This program is free software distributed under the // terms of the GNU General Public License, version 2. @@ -143,7 +143,7 @@ typedef enum typedef struct { - char bgname[8]; // name for background gfx lump; lays over titlemap if this is set + char bgname[9]; // name for background gfx lump; lays over titlemap if this is set SINT8 fadestrength; // darken background when displaying this menu, strength 0-31 or -1 for undefined INT32 bgcolor; // fill color, overrides bg name. -1 means follow bg name rules. INT32 titlescrollxspeed; // background gfx scroll per menu; inherits global setting @@ -371,7 +371,7 @@ typedef struct { boolean used; char notes[441]; - char picname[8]; + char picname[9]; char skinname[SKINNAMESIZE*2+2]; // skin&skin\0 patch_t *charpic; UINT8 prev; @@ -379,7 +379,7 @@ typedef struct char displayname[SKINNAMESIZE+1]; INT16 skinnum[2]; UINT16 oppositecolor; - char nametag[8+1]; + char nametag[9]; patch_t *namepic; UINT16 tagtextcolor; UINT16 tagoutlinecolor; From d314a977b81284efb21840375319fbcb03634f6a Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Thu, 23 Jan 2025 03:23:01 -0300 Subject: [PATCH 350/353] Consistency --- src/doomstat.h | 24 ++++++++++++------------ src/m_menu.h | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/doomstat.h b/src/doomstat.h index 4abc9d21a..b5b298440 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -209,19 +209,19 @@ typedef struct UINT8 picmode; // sequence mode after displaying last pic, 0 = persist, 1 = loop, 2 = destroy UINT8 pictoloop; // if picmode == loop, which pic to loop to? UINT8 pictostart; // initial pic number to show - char picname[MAX_PROMPT_PICS][9]; + char picname[MAX_PROMPT_PICS][8+1]; UINT8 pichires[MAX_PROMPT_PICS]; UINT16 xcoord[MAX_PROMPT_PICS]; // gfx UINT16 ycoord[MAX_PROMPT_PICS]; // gfx UINT16 picduration[MAX_PROMPT_PICS]; - char musswitch[7]; + char musswitch[6+1]; UINT16 musswitchflags; UINT8 musicloop; - char tag[33]; // page tag - char name[34]; // narrator name, extra char for color - char iconname[9]; // narrator icon lump + char tag[32+1]; // page tag + char name[32+2]; // narrator name, extra char for color + char iconname[8+1]; // narrator icon lump boolean rightside; // narrator side, false = left, true = right boolean iconflip; // narrator flip icon horizontally UINT8 hidehud; // hide hud, 0 = show all, 1 = hide depending on prompt position (top/bottom), 2 = hide all @@ -233,7 +233,7 @@ typedef struct sfxenum_t textsfx; // sfx_ id for printing text UINT8 nextprompt; // next prompt to jump to, one-based. 0 = current prompt UINT8 nextpage; // next page to jump to, one-based. 0 = next page within prompt->numpages - char nexttag[33]; // next tag to jump to. If set, this overrides nextprompt and nextpage. + char nexttag[32+1]; // next tag to jump to. If set, this overrides nextprompt and nextpage. INT32 timetonext; // time in tics to jump to next page automatically. 0 = don't jump automatically char *text; } textpage_t; @@ -287,8 +287,8 @@ typedef struct // (This is not ifdeffed so the map header structure can stay identical, just in case.) typedef struct { - char option[32]; // 31 usable characters - char value[256]; // 255 usable characters. If this seriously isn't enough then wtf. + char option[31+1]; // 31 usable characters + char value[255+1]; // 255 usable characters. If this seriously isn't enough then wtf. } customoption_t; /** Map header information. @@ -303,7 +303,7 @@ typedef struct INT16 nextlevel; ///< Map number of next level, or 1100-1102 to end. INT16 marathonnext; ///< See nextlevel, but for Marathon mode. Necessary to support hub worlds ala SUGOI. char keywords[32+1]; ///< Keywords separated by space to search for. 32 characters. - char musname[7]; ///< Music track to play. "" for no music. + char musname[6+1]; ///< Music track to play. "" for no music. UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. UINT32 muspos; ///< Music position to jump to. char forcecharacter[16+1]; ///< (SKINNAMESIZE+1) Skin to switch to or "" to disable. @@ -330,7 +330,7 @@ typedef struct UINT16 levelflags; ///< LF_flags: merged booleans into one UINT16 for space, see below UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus - char selectheading[22]; ///< Level select heading. Allows for controllable grouping. + char selectheading[21+1]; ///< Level select heading. Allows for controllable grouping. UINT16 startrings; ///< Number of rings players start with. INT32 sstimer; ///< Timer for special stages. UINT32 ssspheres; ///< Sphere requirement in special stages. @@ -352,9 +352,9 @@ typedef struct // Music stuff. UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds - char musintername[7]; ///< Intermission screen music. + char musintername[6+1]; ///< Intermission screen music. - char muspostbossname[7]; ///< Post-bossdeath music. + char muspostbossname[6+1]; ///< Post-bossdeath music. UINT16 muspostbosstrack; ///< Post-bossdeath track. UINT32 muspostbosspos; ///< Post-bossdeath position UINT32 muspostbossfadein; ///< Post-bossdeath fade-in milliseconds. diff --git a/src/m_menu.h b/src/m_menu.h index 58c557341..2181acc0e 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -143,7 +143,7 @@ typedef enum typedef struct { - char bgname[9]; // name for background gfx lump; lays over titlemap if this is set + char bgname[8+1]; // name for background gfx lump; lays over titlemap if this is set SINT8 fadestrength; // darken background when displaying this menu, strength 0-31 or -1 for undefined INT32 bgcolor; // fill color, overrides bg name. -1 means follow bg name rules. INT32 titlescrollxspeed; // background gfx scroll per menu; inherits global setting @@ -153,13 +153,13 @@ typedef struct SINT8 hidetitlepics; // hide title gfx per menu; -1 means undefined, inherits global setting ttmode_enum ttmode; // title wing animation mode; default TTMODE_OLD UINT8 ttscale; // scale of title wing gfx (FRACUNIT / ttscale); -1 means undefined, inherits global setting - char ttname[9]; // lump name of title wing gfx. If name length is <= 6, engine will attempt to load numbered frames (TTNAMExx) + char ttname[8+1]; // lump name of title wing gfx. If name length is <= 6, engine will attempt to load numbered frames (TTNAMExx) INT16 ttx; // X position of title wing INT16 tty; // Y position of title wing INT16 ttloop; // # frame to loop; -1 means dont loop UINT16 tttics; // # of tics per frame - char musname[7]; ///< Music track to play. "" for no music. + char musname[6+1]; ///< Music track to play. "" for no music. UINT16 mustrack; ///< Subsong to play. Only really relevant for music modules and specific formats supported by GME. 0 to ignore. boolean muslooping; ///< Loop the music boolean musstop; ///< Don't play any music @@ -370,8 +370,8 @@ extern menu_t OP_JoystickSetDef; typedef struct { boolean used; - char notes[441]; - char picname[9]; + char notes[440+1]; + char picname[8+1]; char skinname[SKINNAMESIZE*2+2]; // skin&skin\0 patch_t *charpic; UINT8 prev; @@ -379,7 +379,7 @@ typedef struct char displayname[SKINNAMESIZE+1]; INT16 skinnum[2]; UINT16 oppositecolor; - char nametag[9]; + char nametag[8+1]; patch_t *namepic; UINT16 tagtextcolor; UINT16 tagoutlinecolor; From 3b36c10d2acc71b5370b78070d472ed2ee4945cf Mon Sep 17 00:00:00 2001 From: Lugent Date: Fri, 24 Jan 2025 19:53:04 +0000 Subject: [PATCH 351/353] Inline P_MobjWasRemoved --- src/p_local.h | 7 ++++++- src/p_mobj.c | 9 --------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index de519b211..85a31cf89 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -289,7 +289,6 @@ void P_RecalcPrecipInSector(sector_t *sector); void P_PrecipitationEffects(void); void P_RemoveMobj(mobj_t *th); -boolean P_MobjWasRemoved(mobj_t *th); void P_RemoveSavegameMobj(mobj_t *th); boolean P_SetMobjState(mobj_t *mobj, statenum_t state); void P_RunShields(void); @@ -301,6 +300,12 @@ boolean P_CheckSkyHit(mobj_t *mo, line_t *line); void P_PushableThinker(mobj_t *mobj); void P_SceneryThinker(mobj_t *mobj); +// This does not need to be added to Lua. +// To test it in Lua, check mobj.valid +FUNCINLINE static ATTRINLINE boolean P_MobjWasRemoved(mobj_t *mobj) +{ + return mobj == NULL || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker; +} fixed_t P_MobjFloorZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean lowest, boolean perfect); fixed_t P_MobjCeilingZ(sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, fixed_t radius, line_t *line, boolean lowest, boolean perfect); diff --git a/src/p_mobj.c b/src/p_mobj.c index 85ae8b256..9ddc7fd8e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11273,15 +11273,6 @@ void P_RemoveMobj(mobj_t *mobj) #endif } -// This does not need to be added to Lua. -// To test it in Lua, check mobj.valid -boolean P_MobjWasRemoved(mobj_t *mobj) -{ - if (mobj && mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker) - return false; - return true; -} - void P_RemovePrecipMobj(precipmobj_t *mobj) { // unlink from sector and block lists From cbbe0439b56f12cb42ebdf8694d3c4b1d4d86c2c Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Fri, 24 Jan 2025 23:37:00 -0300 Subject: [PATCH 352/353] Update asset hashes --- src/config.h.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config.h.in b/src/config.h.in index ebbd6b8ac..0f24cfc44 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -41,13 +41,13 @@ * Last updated 2023 / 09 / 06 - v2.2.12 - patch.pk3 * Last updated 2023 / 09 / 09 - v2.2.13 - none * Last updated 2025 / 01 / 16 - v2.2.14 - main assets - * Last updated 2025 / 01 / 21 - v2.2.15 - main assets + * Last updated 2025 / 01 / 24 - v2.2.15 - main assets */ -#define ASSET_HASH_SRB2_PK3 "b3e3431983a9b16817fd11dbbaec65e4" -#define ASSET_HASH_ZONES_PK3 "5ba928b05eda4a13154edd6699118414" -#define ASSET_HASH_CHARACTERS_PK3 "5f184b8ba0560b32ae342c231e9c6f9a" +#define ASSET_HASH_SRB2_PK3 "3182ce524acc2072ddaa81acf4b6a9aa" +#define ASSET_HASH_ZONES_PK3 "88ff4c300851ccdb0406698eadd89907" +#define ASSET_HASH_CHARACTERS_PK3 "5c5936b8a690e007c0939bd0785a41fb" #ifdef USE_PATCH_DTA -#define ASSET_HASH_PATCH_PK3 "00000000000000000000000000000000" +#define ASSET_HASH_PATCH_PK3 "00000000000000000000000000000000" #endif #endif From 8701ef41f617c06e23a7b8ccd2199c160c5d1dd1 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Sat, 25 Jan 2025 19:35:40 -0300 Subject: [PATCH 353/353] Remove Facebook URL from the README --- assets/README.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/assets/README.txt b/assets/README.txt index fe238dec0..1ddacc999 100644 --- a/assets/README.txt +++ b/assets/README.txt @@ -33,9 +33,6 @@ https://discord.gg/b3BGb8A Twitter: https://twitter.com/SonicTeamJr -Facebook: -https://facebook.com/SonicRoboBlast2 - COPYRIGHT AND DISCLAIMER