From d865b5660afc5a687aabd981f612ce1ce127f27d Mon Sep 17 00:00:00 2001 From: Alam Arias Date: Wed, 27 Feb 2019 14:37:31 -0500 Subject: [PATCH 1/7] CircleCI: test build SRB2 without network support --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ca9105685..3129c3bdf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,12 +36,15 @@ jobs: - v1-SRB2-APT - run: name: Install SDK - command: apt-get -qq -y install git build-essential nasm libpng12-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 gettext ccache wget gcc-multilib upx + command: apt-get -qq -y --no-install-recommends install git build-essential nasm libpng12-dev:i386 libsdl2-mixer-dev:i386 libgme-dev:i386 gettext ccache wget gcc-multilib upx - save_cache: key: v1-SRB2-APT paths: - /var/cache/apt/archives - checkout + - run: + name: Compile without network support + command: make -C src LINUX=1 ERRORMODE=1 -k NONET=1 - run: name: Clean build command: make -C src LINUX=1 clean From 15b27bb7d7fbeff916fc4142ba287e7a3508d8f7 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Wed, 27 Feb 2019 15:55:39 -0500 Subject: [PATCH 2/7] Upped MAXNETNODES --- src/d_net.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/d_net.h b/src/d_net.h index 61c669dbb..8e8afcffa 100644 --- a/src/d_net.h +++ b/src/d_net.h @@ -20,6 +20,7 @@ // Max computers in a game #define MAXNETNODES 32 +#define MAXNETNODES (MAXPLAYERS+4) #define BROADCASTADDR MAXNETNODES #define MAXSPLITSCREENPLAYERS 2 // Max number of players on a single computer //#define NETSPLITSCREEN // Kart's splitscreen netgame feature From fa990e8603f45a551b7980ea7211fcdc7f87cc51 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Wed, 27 Feb 2019 16:05:43 -0500 Subject: [PATCH 3/7] Remove double define --- src/d_net.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/d_net.h b/src/d_net.h index 8e8afcffa..3d1058702 100644 --- a/src/d_net.h +++ b/src/d_net.h @@ -19,7 +19,6 @@ #define __D_NET__ // Max computers in a game -#define MAXNETNODES 32 #define MAXNETNODES (MAXPLAYERS+4) #define BROADCASTADDR MAXNETNODES #define MAXSPLITSCREENPLAYERS 2 // Max number of players on a single computer From 5620d0188e3de7fb1a86f9dfeb7472831a7255f2 Mon Sep 17 00:00:00 2001 From: wolfs Date: Sat, 16 Feb 2019 06:18:22 -0500 Subject: [PATCH 4/7] Merge branch 'apng' into 'master' Support aPNG in new versions of libpng See merge request KartKrew/Kart-Public!63 --- src/CMakeLists.txt | 6 + src/Makefile | 2 + src/apng.c | 266 ++++++++++++++++++ src/apng.h | 66 +++++ src/m_misc.c | 123 +++----- src/sdl/CMakeLists.txt | 5 +- src/sdl/Srb2SDL-vc10.vcxproj | 2 + src/sdl/Srb2SDL-vc10.vcxproj.filters | 3 + src/sdl/Srb2SDL-vc9.vcproj | 44 +++ .../macosx/Srb2mac.xcodeproj/project.pbxproj | 5 + src/sdl12/Srb2SDL-vc10.vcxproj | 11 + src/sdl12/Srb2SDL-vc9.vcproj | 44 +++ .../macosx/Srb2mac.pbproj/project.pbxproj | 14 + .../macosx/Srb2mac.xcodeproj/project.pbxproj | 5 + src/win32/Srb2win-vc10.vcxproj | 2 + src/win32/Srb2win-vc9.vcproj | 44 +++ 16 files changed, 563 insertions(+), 79 deletions(-) create mode 100644 src/apng.c create mode 100644 src/apng.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4a9ef5ba8..a6fab34ff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -377,6 +377,12 @@ if(${SRB2_CONFIG_HAVE_PNG} AND ${SRB2_CONFIG_HAVE_ZLIB}) set(SRB2_HAVE_PNG ON) add_definitions(-DHAVE_PNG) add_definitions(-D_LARGEFILE64_SOURCE) + set(SRB2_PNG_SOURCES apng.c) + set(SRB2_PNG_HEADERS apng.h) + prepend_sources(SRB2_PNG_SOURCES) + prepend_sources(SRB2_PNG_HEADERS) + source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS} + ${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS}) else() message(WARNING "You have specified that PNG is available but it was not found. SRB2 may not compile correctly.") endif() diff --git a/src/Makefile b/src/Makefile index c894203a4..6363ab7dc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -338,6 +338,8 @@ endif LIBS+=$(PNG_LDFLAGS) CFLAGS+=$(PNG_CFLAGS) + +OBJS+=$(OBJDIR)/apng.o endif ifdef HAVE_LIBGME diff --git a/src/apng.c b/src/apng.c new file mode 100644 index 000000000..2109c0a07 --- /dev/null +++ b/src/apng.c @@ -0,0 +1,266 @@ +/* +Copyright 2019, James R. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include + +#include "apng.h" + +#define APNG_WROTE_acTL 0x10000U + +struct apng_info_def +{ + png_uint_32 mode; + png_uint_32 valid; + + png_uint_32 num_frames; + png_uint_32 num_plays; + + long start_acTL;/* acTL is written here */ + + png_flush_ptr output_flush_fn; + apng_seek_ptr output_seek_fn; + apng_tell_ptr output_tell_fn; + + apng_set_acTL_ptr set_acTL_fn; +}; + +/* PROTOS (FUCK COMPILER) */ +void apng_seek (png_structp, apng_const_infop, size_t); +size_t apng_tell (png_structp, apng_const_infop); +#ifdef PNG_WRITE_FLUSH_SUPPORTED +void apng_flush (png_structp, apng_infop); +#ifdef PNG_STDIO_SUPPORTED +void apng_default_flush (png_structp); +#endif/* PNG_STDIO_SUPPORTED */ +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ +#ifdef PNG_STDIO_SUPPORTED +void apng_default_seek (png_structp, size_t); +size_t apng_default_tell (png_structp); +#endif/* PNG_STDIO_SUPPORTED */ +void apng_write_IEND (png_structp); +void apng_write_acTL (png_structp, png_uint_32, png_uint_32); + +apng_infop +apng_create_info_struct (png_structp pngp) +{ + apng_infop ainfop; + (void)pngp; + if (( ainfop = calloc(sizeof (apng_info),1) )) + { + apng_set_write_fn(pngp, ainfop, 0, 0, 0, 0, 0); + apng_set_set_acTL_fn(pngp, ainfop, 0); + } + return ainfop; +} + +void +apng_destroy_info_struct (png_structp pngp, apng_infopp ainfopp) +{ + (void)pngp; + if (!( pngp && ainfopp )) + return; + + free((*ainfopp)); +} + +void +apng_seek (png_structp pngp, apng_const_infop ainfop, size_t l) +{ + (*(ainfop->output_seek_fn))(pngp, l); +} + +size_t +apng_tell (png_structp pngp, apng_const_infop ainfop) +{ + return (*(ainfop->output_tell_fn))(pngp); +} + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +void +apng_flush (png_structp pngp, apng_infop ainfop) +{ + if (ainfop->output_flush_fn) + (*(ainfop->output_flush_fn))(pngp); +} + +#ifdef PNG_STDIO_SUPPORTED +void +apng_default_flush (png_structp pngp) +{ + if (!( pngp )) + return; + + fflush((png_FILE_p)png_get_io_ptr); +} +#endif/* PNG_STDIO_SUPPORTED */ +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ + +#ifdef PNG_STDIO_SUPPORTED +void +apng_default_seek (png_structp pngp, size_t l) +{ + if (!( pngp )) + return; + + if (fseek((png_FILE_p)png_get_io_ptr(pngp), (long)l, SEEK_SET) == -1) + png_error(pngp, "Seek Error"); +} + +size_t +apng_default_tell (png_structp pngp) +{ + long l; + + if (!( pngp )) + { + png_error(pngp, "Call to apng_default_tell with NULL pngp failed"); + } + + if (( l = ftell((png_FILE_p)png_get_io_ptr(pngp)) ) == -1) + png_error(pngp, "Tell Error"); + + return (size_t)l; +} +#endif/* PNG_STDIO_SUPPORTED */ + +void +apng_set_write_fn (png_structp pngp, apng_infop ainfop, png_voidp iop, + png_rw_ptr write_f, png_flush_ptr flush_f, + apng_seek_ptr seek_f, apng_tell_ptr tell_f) +{ + if (!( pngp && ainfop )) + return; + + png_set_write_fn(pngp, iop, write_f, flush_f); + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +#ifdef PNG_STDIO_SUPPORTED + if (!flush_f) + ainfop->output_flush_fn = &apng_default_flush; + else +#endif/* PNG_STDIO_SUPPORTED */ + ainfop->output_flush_fn = flush_f; +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ +#ifdef PNG_STDIO_SUPPORTED + if (!seek_f) + ainfop->output_seek_fn = &apng_default_seek; + else +#endif/* PNG_STDIO_SUPPORTED */ + ainfop->output_seek_fn = seek_f; +#ifdef PNG_STDIO_SUPPORTED + if (!seek_f) + ainfop->output_tell_fn = apng_default_tell; + else +#endif/* PNG_STDIO_SUPPORTED */ + ainfop->output_tell_fn = tell_f; +} + +void +apng_write_IEND (png_structp pngp) +{ + png_byte chunkc[] = "IEND"; + png_write_chunk(pngp, chunkc, 0, 0); +} + +void +apng_write_acTL (png_structp pngp, png_uint_32 frames, png_uint_32 plays) +{ + png_byte chunkc[] = "acTL"; + png_byte buf[8]; + png_save_uint_32(buf, frames); + png_save_uint_32(buf + 4, plays); + png_write_chunk(pngp, chunkc, buf, 8); +} + +png_uint_32 +apng_set_acTL (png_structp pngp, png_infop infop, apng_infop ainfop, + png_uint_32 frames, png_uint_32 plays) +{ + (void)pngp; + (void)infop; + if (!( pngp && infop && ainfop )) + return 0; + + ainfop->num_frames = frames; + ainfop->num_plays = plays; + + ainfop->valid |= PNG_INFO_acTL; + + return 1; +} + +void +apng_write_info_before_PLTE (png_structp pngp, png_infop infop, + apng_infop ainfop) +{ + if (!( pngp && infop && ainfop )) + return; + + png_write_info_before_PLTE(pngp, infop); + + if (( ainfop->valid & PNG_INFO_acTL ) &&!( ainfop->mode & APNG_WROTE_acTL )) + { + ainfop->start_acTL = apng_tell(pngp, ainfop); + + apng_write_acTL(pngp, 0, 0); + /* modified for runtime dynamic linking */ + (*(ainfop->set_acTL_fn))(pngp, infop, PNG_UINT_31_MAX, 0); + + ainfop->mode |= APNG_WROTE_acTL; + } +} + +void +apng_write_info (png_structp pngp, png_infop infop, + apng_infop ainfop) +{ + apng_write_info_before_PLTE(pngp, infop, ainfop); + png_write_info(pngp, infop); +} + +void +apng_write_end (png_structp pngp, png_infop infop, apng_infop ainfop) +{ + (void)infop; + apng_write_IEND(pngp); + apng_seek(pngp, ainfop, ainfop->start_acTL); + apng_write_acTL(pngp, ainfop->num_frames, ainfop->num_plays); + +#ifdef PNG_WRITE_FLUSH_SUPPORTED +#ifdef PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED + apng_flush(pngp, infop); +#endif/* PNG_WRITE_FLUSH_SUPPORTED */ +#endif/* PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED */ +} + +/* Dynamic runtime linking capable! (Hopefully.) */ +void +apng_set_set_acTL_fn (png_structp pngp, apng_infop ainfop, + apng_set_acTL_ptr set_acTL_f) +{ + (void)pngp; + if (!ainfop->set_acTL_fn) + ainfop->set_acTL_fn = &png_set_acTL; + else + ainfop->set_acTL_fn = set_acTL_f; +} diff --git a/src/apng.h b/src/apng.h new file mode 100644 index 000000000..eefd6aaa3 --- /dev/null +++ b/src/apng.h @@ -0,0 +1,66 @@ +/* +Copyright 2019, James R. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef APNG_H +#define APNG_H + +#include + +typedef struct apng_info_def apng_info; +typedef apng_info * apng_infop; +typedef const apng_info * apng_const_infop; +typedef apng_info * * apng_infopp; + +typedef void (*apng_seek_ptr)(png_structp, size_t); +typedef size_t (*apng_tell_ptr)(png_structp); + +typedef png_uint_32 (*apng_set_acTL_ptr)(png_structp, png_infop, + png_uint_32, png_uint_32); + +apng_infop apng_create_info_struct (png_structp png_ptr); + +void apng_destroy_info_struct (png_structp png_ptr, + apng_infopp info_ptr_ptr); + +/* Call the following functions in place of the libpng counterparts. */ + +png_uint_32 apng_set_acTL (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr, + png_uint_32 num_frames, png_uint_32 num_plays); + +void apng_write_info_before_PLTE (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr); +void apng_write_info (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr); + +void apng_write_end (png_structp png_ptr, png_infop info_ptr, + apng_infop ainfo_ptr); + +void apng_set_write_fn (png_structp png_ptr, apng_infop ainfo_ptr, + png_voidp io_ptr, + png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn, + apng_seek_ptr output_seek_fn, apng_tell_ptr output_tell_fn); + +void apng_set_set_acTL_fn (png_structp png_ptr, apng_infop ainfo_ptr, + apng_set_acTL_ptr set_acTL_fn); + +#endif/* APNG_H */ diff --git a/src/m_misc.c b/src/m_misc.c index c99fa1736..fe5215922 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -93,9 +93,8 @@ typedef off_t off64_t; #ifdef PNG_WRITE_SUPPORTED #define USE_PNG // Only actually use PNG if write is supported. #if defined (PNG_WRITE_APNG_SUPPORTED) //|| !defined(PNG_STATIC) - #if (PNG_LIBPNG_VER_MAJOR) == 1 && (PNG_LIBPNG_VER_MINOR <= 4) // Supposedly, the current APNG code can't work on newer versions as is + #include "apng.h" #define USE_APNG - #endif #endif // See hardware/hw_draw.c for a similar check to this one. #endif @@ -794,13 +793,13 @@ static inline void M_PNGImage(png_structp png_ptr, png_infop png_info_ptr, PNG_C #ifdef USE_APNG static png_structp apng_ptr = NULL; static png_infop apng_info_ptr = NULL; +static apng_infop apng_ainfo_ptr = NULL; static png_FILE_p apng_FILE = NULL; static png_uint_32 apng_frames = 0; -static png_byte acTL_cn[5] = { 97, 99, 84, 76, '\0'}; #ifdef PNG_STATIC // Win32 build have static libpng -#define apng_set_acTL png_set_acTL -#define apng_write_frame_head png_write_frame_head -#define apng_write_frame_tail png_write_frame_tail +#define aPNG_set_acTL png_set_acTL +#define aPNG_write_frame_head png_write_frame_head +#define aPNG_write_frame_tail png_write_frame_tail #else // outside libpng may not have apng support #ifndef PNG_WRITE_APNG_SUPPORTED // libpng header may not have apng patch @@ -837,20 +836,20 @@ static png_byte acTL_cn[5] = { 97, 99, 84, 76, '\0'}; #endif #endif -typedef PNG_EXPORT(png_uint_32, (*P_png_set_acTL)) PNGARG((png_structp png_ptr, - png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays)); -typedef PNG_EXPORT (void, (*P_png_write_frame_head)) PNGARG((png_structp png_ptr, +typedef png_uint_32 (*P_png_set_acTL) (png_structp png_ptr, + png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays); +typedef void (*P_png_write_frame_head) (png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers, png_uint_32 width, png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset, png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op, - png_byte blend_op)); + png_byte blend_op); -typedef PNG_EXPORT (void, (*P_png_write_frame_tail)) PNGARG((png_structp png_ptr, - png_infop info_ptr)); -static P_png_set_acTL apng_set_acTL = NULL; -static P_png_write_frame_head apng_write_frame_head = NULL; -static P_png_write_frame_tail apng_write_frame_tail = NULL; +typedef void (*P_png_write_frame_tail) (png_structp png_ptr, + png_infop info_ptr); +static P_png_set_acTL aPNG_set_acTL = NULL; +static P_png_write_frame_head aPNG_write_frame_head = NULL; +static P_png_write_frame_tail aPNG_write_frame_tail = NULL; #endif static inline boolean M_PNGLib(void) @@ -859,7 +858,7 @@ static inline boolean M_PNGLib(void) return true; #else static void *pnglib = NULL; - if (apng_set_acTL && apng_write_frame_head && apng_write_frame_tail) + if (aPNG_set_acTL && aPNG_write_frame_head && aPNG_write_frame_tail) return true; if (pnglib) return false; @@ -879,16 +878,16 @@ static inline boolean M_PNGLib(void) if (!pnglib) return false; #ifdef HAVE_SDL - apng_set_acTL = hwSym("png_set_acTL", pnglib); - apng_write_frame_head = hwSym("png_write_frame_head", pnglib); - apng_write_frame_tail = hwSym("png_write_frame_tail", pnglib); + aPNG_set_acTL = hwSym("png_set_acTL", pnglib); + aPNG_write_frame_head = hwSym("png_write_frame_head", pnglib); + aPNG_write_frame_tail = hwSym("png_write_frame_tail", pnglib); #endif #ifdef _WIN32 - apng_set_acTL = GetProcAddress("png_set_acTL", pnglib); - apng_write_frame_head = GetProcAddress("png_write_frame_head", pnglib); - apng_write_frame_tail = GetProcAddress("png_write_frame_tail", pnglib); + aPNG_set_acTL = GetProcAddress("png_set_acTL", pnglib); + aPNG_write_frame_head = GetProcAddress("png_write_frame_head", pnglib); + aPNG_write_frame_tail = GetProcAddress("png_write_frame_tail", pnglib); #endif - return (apng_set_acTL && apng_write_frame_head && apng_write_frame_tail); + return (aPNG_set_acTL && aPNG_write_frame_head && aPNG_write_frame_tail); #endif } @@ -902,11 +901,6 @@ static void M_PNGFrame(png_structp png_ptr, png_infop png_info_ptr, png_bytep pn apng_frames++; -#ifndef PNG_STATIC - if (apng_set_acTL) -#endif - apng_set_acTL(apng_ptr, apng_info_ptr, apng_frames, 0); - for (y = 0; y < height; y++) { row_pointers[y] = png_buf; @@ -914,9 +908,9 @@ static void M_PNGFrame(png_structp png_ptr, png_infop png_info_ptr, png_bytep pn } #ifndef PNG_STATIC - if (apng_write_frame_head) + if (aPNG_write_frame_head) #endif - apng_write_frame_head(apng_ptr, apng_info_ptr, row_pointers, + aPNG_write_frame_head(apng_ptr, apng_info_ptr, row_pointers, vid.width, /* width */ height, /* height */ 0, /* x offset */ @@ -929,57 +923,21 @@ static void M_PNGFrame(png_structp png_ptr, png_infop png_info_ptr, png_bytep pn png_write_image(png_ptr, row_pointers); #ifndef PNG_STATIC - if (apng_write_frame_tail) + if (aPNG_write_frame_tail) #endif - apng_write_frame_tail(apng_ptr, apng_info_ptr); + aPNG_write_frame_tail(apng_ptr, apng_info_ptr); png_free(png_ptr, (png_voidp)row_pointers); } -static inline boolean M_PNGfind_acTL(void) +static void M_PNGfix_acTL(png_structp png_ptr, png_infop png_info_ptr, + apng_infop png_ainfo_ptr) { - png_byte cn[8]; // 4 bytes for len then 4 byes for name - long endpos = ftell(apng_FILE); // not the real end of file, just what of libpng wrote - for (fseek(apng_FILE, 0, SEEK_SET); // let go to the start of the file - ftell(apng_FILE)+12 < endpos; // let not go over the file bound - fseek(apng_FILE, 1, SEEK_CUR) // we went 8 steps back and now we go 1 step forward - ) - { - if (fread(cn, sizeof(cn), 1, apng_FILE) != 1) // read 8 bytes - return false; // failed to read data - if (fseek(apng_FILE, -8, SEEK_CUR) != 0) //rewind 8 bytes - return false; // failed to rewird - if (!png_memcmp(cn+4, acTL_cn, 4)) //cmp for chuck header - return true; // found it - } - return false; // acTL chuck not found -} - -static void M_PNGfix_acTL(png_structp png_ptr, png_infop png_info_ptr) -{ - png_byte data[16]; - long oldpos; - -#ifndef PNG_STATIC - if (apng_set_acTL) -#endif - apng_set_acTL(png_ptr, png_info_ptr, apng_frames, 0); + apng_set_acTL(png_ptr, png_info_ptr, png_ainfo_ptr, apng_frames, 0); #ifndef NO_PNG_DEBUG png_debug(1, "in png_write_acTL\n"); #endif - - png_ptr->num_frames_to_write = apng_frames; - - png_save_uint_32(data, apng_frames); - png_save_uint_32(data + 4, 0); - - oldpos = ftell(apng_FILE); - - if (M_PNGfind_acTL()) - png_write_chunk(png_ptr, (png_bytep)acTL_cn, data, (png_size_t)8); - - fseek(apng_FILE, oldpos, SEEK_SET); } static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal) @@ -1011,6 +969,16 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal) return false; } + apng_ainfo_ptr = apng_create_info_struct(apng_ptr); + if (!apng_ainfo_ptr) + { + CONS_Debug(DBG_RENDER, "M_StartMovie: Error on allocate for apng\n"); + png_destroy_write_struct(&apng_ptr, &apng_info_ptr); + fclose(apng_FILE); + remove(filename); + return false; + } + png_init_io(apng_ptr, apng_FILE); #ifdef PNG_SET_USER_LIMITS_SUPPORTED @@ -1028,12 +996,11 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal) M_PNGText(apng_ptr, apng_info_ptr, true); -#ifndef PNG_STATIC - if (apng_set_acTL) -#endif - apng_set_acTL(apng_ptr, apng_info_ptr, PNG_UINT_31_MAX, 0); + apng_set_set_acTL_fn(apng_ptr, apng_ainfo_ptr, aPNG_set_acTL); - png_write_info(apng_ptr, apng_info_ptr); + apng_set_acTL(apng_ptr, apng_info_ptr, apng_ainfo_ptr, PNG_UINT_31_MAX, 0); + + apng_write_info(apng_ptr, apng_info_ptr, apng_ainfo_ptr); apng_frames = 0; @@ -1236,8 +1203,8 @@ void M_StopMovie(void) if (apng_frames) { - M_PNGfix_acTL(apng_ptr, apng_info_ptr); - png_write_end(apng_ptr, apng_info_ptr); + M_PNGfix_acTL(apng_ptr, apng_info_ptr, apng_ainfo_ptr); + apng_write_end(apng_ptr, apng_info_ptr, apng_ainfo_ptr); } png_destroy_write_struct(&apng_ptr, &apng_info_ptr); diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index f7b7c7ba4..7f8f052ba 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -70,6 +70,8 @@ if(${SDL2_FOUND}) set(SRB2_SDL2_TOTAL_SOURCES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS} + ${SRB2_PNG_SOURCES} + ${SRB2_PNG_HEADERS} ${SRB2_CORE_RENDER_SOURCES} ${SRB2_CORE_GAME_SOURCES} ${SRB2_LUA_SOURCES} @@ -80,7 +82,8 @@ if(${SDL2_FOUND}) ${SRB2_SDL2_HEADERS} ) - source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS}) + source_group("Main" FILES ${SRB2_CORE_SOURCES} ${SRB2_CORE_HEADERS} + ${SRB2_PNG_SOURCES} ${SRB2_PNG_HEADERS}) source_group("Renderer" FILES ${SRB2_CORE_RENDER_SOURCES}) source_group("Game" FILES ${SRB2_CORE_GAME_SOURCES}) source_group("Assembly" FILES ${SRB2_ASM_SOURCES} ${SRB2_NASM_SOURCES}) diff --git a/src/sdl/Srb2SDL-vc10.vcxproj b/src/sdl/Srb2SDL-vc10.vcxproj index 04af6a8e1..e43772179 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj +++ b/src/sdl/Srb2SDL-vc10.vcxproj @@ -164,6 +164,7 @@ + @@ -316,6 +317,7 @@ + diff --git a/src/sdl/Srb2SDL-vc10.vcxproj.filters b/src/sdl/Srb2SDL-vc10.vcxproj.filters index ac0b03177..d67ac6308 100644 --- a/src/sdl/Srb2SDL-vc10.vcxproj.filters +++ b/src/sdl/Srb2SDL-vc10.vcxproj.filters @@ -294,6 +294,9 @@ LUA + + M_Misc + M_Misc diff --git a/src/sdl/Srb2SDL-vc9.vcproj b/src/sdl/Srb2SDL-vc9.vcproj index d2a268f8d..3898aeba4 100644 --- a/src/sdl/Srb2SDL-vc9.vcproj +++ b/src/sdl/Srb2SDL-vc9.vcproj @@ -2834,6 +2834,50 @@ RelativePath="..\m_argv.h" > + + + + + + + + + + + + + + + + diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index 94a3fbb63..a8ecbf7f8 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -43,6 +43,7 @@ 1E44AF0D0B67CDE900BAD059 /* m_fixed.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEFE0B67CDE900BAD059 /* m_fixed.c */; }; 1E44AF0F0B67CDE900BAD059 /* m_menu.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF000B67CDE900BAD059 /* m_menu.c */; }; 1E44AF110B67CDE900BAD059 /* m_misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF020B67CDE900BAD059 /* m_misc.c */; }; + 1E44AF110B67CDE900BAD059 /* apng.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF020B67CDE900BAD059 /* apng.c */; }; 1E44AF130B67CDE900BAD059 /* m_random.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF040B67CDE900BAD059 /* m_random.c */; }; 1E44AF1A0B67CE2A00BAD059 /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF180B67CE2A00BAD059 /* info.c */; }; 1E44AF1E0B67CE3600BAD059 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF1C0B67CE3600BAD059 /* md5.c */; }; @@ -253,7 +254,9 @@ 1E44AF000B67CDE900BAD059 /* m_menu.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_menu.c; path = ../../m_menu.c; sourceTree = SOURCE_ROOT; }; 1E44AF010B67CDE900BAD059 /* m_menu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_menu.h; path = ../../m_menu.h; sourceTree = SOURCE_ROOT; }; 1E44AF020B67CDE900BAD059 /* m_misc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_misc.c; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; }; + 1E44AF020B67CDE900BAD059 /* apng.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = apng.c; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; }; 1E44AF030B67CDE900BAD059 /* m_misc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_misc.h; path = ../../m_misc.h; sourceTree = SOURCE_ROOT; }; + 1E44AF020B67CDE900BAD059 /* apng.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = apng.h; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; }; 1E44AF040B67CDE900BAD059 /* m_random.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_random.c; path = ../../m_random.c; sourceTree = SOURCE_ROOT; }; 1E44AF050B67CDE900BAD059 /* m_random.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_random.h; path = ../../m_random.h; sourceTree = SOURCE_ROOT; }; 1E44AF060B67CDE900BAD059 /* m_swap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_swap.h; path = ../../m_swap.h; sourceTree = SOURCE_ROOT; }; @@ -679,6 +682,8 @@ 1E44AEFF0B67CDE900BAD059 /* m_fixed.h */, 1E44AF020B67CDE900BAD059 /* m_misc.c */, 1E44AF030B67CDE900BAD059 /* m_misc.h */, + 1E44AF020B67CDE900BAD059 /* apng.c */, + 1E44AF030B67CDE900BAD059 /* apng.h */, 676BB51C0E0DE06100C95963 /* m_queue.c */, 676BB51D0E0DE06100C95963 /* m_queue.h */, 1E44AF040B67CDE900BAD059 /* m_random.c */, diff --git a/src/sdl12/Srb2SDL-vc10.vcxproj b/src/sdl12/Srb2SDL-vc10.vcxproj index 958cd7d02..99916f58d 100644 --- a/src/sdl12/Srb2SDL-vc10.vcxproj +++ b/src/sdl12/Srb2SDL-vc10.vcxproj @@ -835,6 +835,16 @@ %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) + + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) %(PreprocessorDefinitions) @@ -1293,6 +1303,7 @@ + diff --git a/src/sdl12/Srb2SDL-vc9.vcproj b/src/sdl12/Srb2SDL-vc9.vcproj index d2a268f8d..fa386e381 100644 --- a/src/sdl12/Srb2SDL-vc9.vcproj +++ b/src/sdl12/Srb2SDL-vc9.vcproj @@ -2790,6 +2790,50 @@ + + + + + + + + + + + + + + + + diff --git a/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj index de12201f5..1f8e3276a 100644 --- a/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj +++ b/src/sdl12/macosx/Srb2mac.pbproj/project.pbxproj @@ -1365,6 +1365,20 @@ path = ../../m_misc.h; refType = 2; }; + 84177764085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = apng.c; + path = ../../apng.c; + refType = 2; + }; + 84177765085A10EB000C01D8 = { + fileEncoding = 30; + isa = PBXFileReference; + name = m_misc.h; + path = ../../apng.h; + refType = 2; + }; 84177766085A10EB000C01D8 = { fileEncoding = 30; isa = PBXFileReference; diff --git a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj index 0ab40c45e..69c544c56 100644 --- a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -43,6 +43,7 @@ 1E44AF0D0B67CDE900BAD059 /* m_fixed.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AEFE0B67CDE900BAD059 /* m_fixed.c */; }; 1E44AF0F0B67CDE900BAD059 /* m_menu.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF000B67CDE900BAD059 /* m_menu.c */; }; 1E44AF110B67CDE900BAD059 /* m_misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF020B67CDE900BAD059 /* m_misc.c */; }; + 1E44AF110B67CDE900BAD059 /* apng.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF020B67CDE900BAD059 /* apng.c */; }; 1E44AF130B67CDE900BAD059 /* m_random.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF040B67CDE900BAD059 /* m_random.c */; }; 1E44AF1A0B67CE2A00BAD059 /* info.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF180B67CE2A00BAD059 /* info.c */; }; 1E44AF1E0B67CE3600BAD059 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 1E44AF1C0B67CE3600BAD059 /* md5.c */; }; @@ -254,6 +255,8 @@ 1E44AF010B67CDE900BAD059 /* m_menu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_menu.h; path = ../../m_menu.h; sourceTree = SOURCE_ROOT; }; 1E44AF020B67CDE900BAD059 /* m_misc.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_misc.c; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; }; 1E44AF030B67CDE900BAD059 /* m_misc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_misc.h; path = ../../m_misc.h; sourceTree = SOURCE_ROOT; }; + 1E44AF020B67CDE900BAD059 /* apng.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = apng.c; path = ../../m_misc.c; sourceTree = SOURCE_ROOT; }; + 1E44AF030B67CDE900BAD059 /* apng.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = apng.h; path = ../../m_misc.h; sourceTree = SOURCE_ROOT; }; 1E44AF040B67CDE900BAD059 /* m_random.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = m_random.c; path = ../../m_random.c; sourceTree = SOURCE_ROOT; }; 1E44AF050B67CDE900BAD059 /* m_random.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_random.h; path = ../../m_random.h; sourceTree = SOURCE_ROOT; }; 1E44AF060B67CDE900BAD059 /* m_swap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = m_swap.h; path = ../../m_swap.h; sourceTree = SOURCE_ROOT; }; @@ -679,6 +682,8 @@ 1E44AEFF0B67CDE900BAD059 /* m_fixed.h */, 1E44AF020B67CDE900BAD059 /* m_misc.c */, 1E44AF030B67CDE900BAD059 /* m_misc.h */, + 1E44AF020B67CDE900BAD059 /* apng.c */, + 1E44AF030B67CDE900BAD059 /* apng.h */, 676BB51C0E0DE06100C95963 /* m_queue.c */, 676BB51D0E0DE06100C95963 /* m_queue.h */, 1E44AF040B67CDE900BAD059 /* m_random.c */, diff --git a/src/win32/Srb2win-vc10.vcxproj b/src/win32/Srb2win-vc10.vcxproj index ca73b1293..774ce5cbe 100644 --- a/src/win32/Srb2win-vc10.vcxproj +++ b/src/win32/Srb2win-vc10.vcxproj @@ -182,6 +182,7 @@ + @@ -330,6 +331,7 @@ + diff --git a/src/win32/Srb2win-vc9.vcproj b/src/win32/Srb2win-vc9.vcproj index 24235bc7b..a64b8638c 100644 --- a/src/win32/Srb2win-vc9.vcproj +++ b/src/win32/Srb2win-vc9.vcproj @@ -2851,6 +2851,50 @@ RelativePath="..\m_misc.h" > + + + + + + + + + + + + + + + + From 7cd60a544a1f801de664002a026390982539adc2 Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 19 Feb 2019 12:51:52 -0500 Subject: [PATCH 5/7] Merge branch 'apng-oh-shit-fixes' into 'master' Compiling errors for apng fixed See merge request KartKrew/Kart-Public!69 --- src/apng.c | 29 ++++++++++++++++++++++++++--- src/apng.h | 16 ++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/apng.c b/src/apng.c index 2109c0a07..694b3d1e8 100644 --- a/src/apng.c +++ b/src/apng.c @@ -25,6 +25,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "apng.h" +#define APNG_INFO_acTL 0x20000U + #define APNG_WROTE_acTL 0x10000U struct apng_info_def @@ -59,6 +61,10 @@ size_t apng_default_tell (png_structp); #endif/* PNG_STDIO_SUPPORTED */ void apng_write_IEND (png_structp); void apng_write_acTL (png_structp, png_uint_32, png_uint_32); +#ifndef PNG_WRITE_APNG_SUPPORTED +png_uint_32 apng_set_acTL_dummy (png_structp, png_infop, + png_uint_32, png_uint_32); +#endif/* PNG_WRITE_APNG_SUPPORTED */ apng_infop apng_create_info_struct (png_structp pngp) @@ -145,7 +151,7 @@ apng_default_tell (png_structp pngp) void apng_set_write_fn (png_structp pngp, apng_infop ainfop, png_voidp iop, - png_rw_ptr write_f, png_flush_ptr flush_f, + png_rw_ptr write_f, png_flush_ptr flush_f, apng_seek_ptr seek_f, apng_tell_ptr tell_f) { if (!( pngp && ainfop )) @@ -204,7 +210,7 @@ apng_set_acTL (png_structp pngp, png_infop infop, apng_infop ainfop, ainfop->num_frames = frames; ainfop->num_plays = plays; - ainfop->valid |= PNG_INFO_acTL; + ainfop->valid |= APNG_INFO_acTL; return 1; } @@ -218,7 +224,7 @@ apng_write_info_before_PLTE (png_structp pngp, png_infop infop, png_write_info_before_PLTE(pngp, infop); - if (( ainfop->valid & PNG_INFO_acTL ) &&!( ainfop->mode & APNG_WROTE_acTL )) + if (( ainfop->valid & APNG_INFO_acTL )&&!( ainfop->mode & APNG_WROTE_acTL )) { ainfop->start_acTL = apng_tell(pngp, ainfop); @@ -253,6 +259,19 @@ apng_write_end (png_structp pngp, png_infop infop, apng_infop ainfop) #endif/* PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED */ } +#ifndef PNG_WRITE_APNG_SUPPORTED +png_uint_32 +apng_set_acTL_dummy (png_structp pngp, png_infop infop, + png_uint_32 frames, png_uint_32 plays) +{ + (void)pngp; + (void)infop; + (void)frames; + (void)plays; + return 0; +} +#endif/* PNG_WRITE_APNG_SUPPORTED */ + /* Dynamic runtime linking capable! (Hopefully.) */ void apng_set_set_acTL_fn (png_structp pngp, apng_infop ainfop, @@ -260,7 +279,11 @@ apng_set_set_acTL_fn (png_structp pngp, apng_infop ainfop, { (void)pngp; if (!ainfop->set_acTL_fn) +#ifndef PNG_WRITE_APNG_SUPPORTED + ainfop->set_acTL_fn = &apng_set_acTL_dummy; +#else ainfop->set_acTL_fn = &png_set_acTL; +#endif/* PNG_WRITE_APNG_SUPPORTED */ else ainfop->set_acTL_fn = set_acTL_f; } diff --git a/src/apng.h b/src/apng.h index eefd6aaa3..aa7fac3df 100644 --- a/src/apng.h +++ b/src/apng.h @@ -23,6 +23,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef APNG_H #define APNG_H +#ifndef _MSC_VER +#ifndef _WII +#ifndef _LARGEFILE64_SOURCE +#define _LARGEFILE64_SOURCE +#endif +#endif +#endif + +#ifndef _LFS64_LARGEFILE +#define _LFS64_LARGEFILE +#endif + +#ifndef _FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 0 +#endif + #include typedef struct apng_info_def apng_info; From 97de2ae4f615e81db0ebd5950fe28cfe0759c710 Mon Sep 17 00:00:00 2001 From: wolfy852 Date: Fri, 1 Mar 2019 00:07:58 -0600 Subject: [PATCH 6/7] Stop Linux servers from hanging every 34 hours --- 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 50c3018aa..b5597784e 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2045,8 +2045,8 @@ static void I_ShutdownTimer(void) // tic_t I_GetTime (void) { - static Uint32 basetime = 0; - Uint32 ticks = SDL_GetTicks(); + static Uint64 basetime = 0; + Uint64 ticks = SDL_GetTicks(); if (!basetime) basetime = ticks; From f823768699bd6b7ca29a52ee0ad74637041fbe0d Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Fri, 1 Mar 2019 17:31:32 -0500 Subject: [PATCH 7/7] Fix building without BLUA support --- src/d_clisrv.c | 2 ++ src/w_wad.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 2529b05d0..a0f9f40ab 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2415,6 +2415,8 @@ static void CL_RemovePlayer(INT32 playernum, INT32 reason) #ifdef HAVE_BLUA LUAh_PlayerQuit(&players[playernum], reason); // Lua hook for player quitting +#else + (void)reason; #endif // Reset player data diff --git a/src/w_wad.c b/src/w_wad.c index 88e89974a..1279c23e3 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -185,6 +185,7 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors) static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum) { UINT16 posStart, posEnd; +#ifdef HAVE_BLUA posStart = W_CheckNumForFolderStartPK3("Lua/", wadnum, 0); if (posStart != INT16_MAX) { @@ -193,6 +194,7 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum) for (; posStart < posEnd; posStart++) LUA_LoadLump(wadnum, posStart); } +#endif posStart = W_CheckNumForFolderStartPK3("SOC/", wadnum, 0); if (posStart != INT16_MAX) { @@ -792,9 +794,11 @@ UINT16 W_InitFile(const char *filename) CONS_Printf(M_GetText("Loading SOC from %s\n"), wadfile->filename); DEH_LoadDehackedLumpPwad(numwadfiles - 1, 0); break; +#ifdef HAVE_BLUA case RET_LUA: LUA_LoadLump(numwadfiles - 1, 0); break; +#endif default: break; }