diff --git a/src/doomtype.h b/src/doomtype.h index c73a03908..3d8f4f81a 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -202,14 +202,6 @@ enum class ELightMode : int8_t DoomSoftware = 16 }; -// Screenshot buffer image data types -enum ESSType -{ - SS_PAL, - SS_RGB, - SS_BGRA -}; - // always use our own definition for consistency. #ifdef M_PI #undef M_PI diff --git a/src/g_game.cpp b/src/g_game.cpp index 300e4bb35..863c01bd5 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -75,6 +75,7 @@ #include "i_system.h" #include "p_conversation.h" +#include "v_video.h" #include "g_hub.h" #include "g_levellocals.h" #include "events.h" diff --git a/src/gamedata/textures/formats/pngtexture.cpp b/src/gamedata/textures/formats/pngtexture.cpp index ccf13d0da..a6557592a 100644 --- a/src/gamedata/textures/formats/pngtexture.cpp +++ b/src/gamedata/textures/formats/pngtexture.cpp @@ -41,6 +41,7 @@ #include "bitmap.h" #include "imagehelpers.h" #include "image.h" +#include "textures.h" //========================================================================== // diff --git a/src/gamedata/textures/image.h b/src/gamedata/textures/image.h index 75efc56e4..64d9d22c6 100644 --- a/src/gamedata/textures/image.h +++ b/src/gamedata/textures/image.h @@ -2,6 +2,7 @@ #include #include "tarray.h" +#include "textures.h" #include "textures/bitmap.h" #include "memarena.h" diff --git a/src/gamedata/textures/imagehelpers.h b/src/gamedata/textures/imagehelpers.h index 39cd83e67..12f730db6 100644 --- a/src/gamedata/textures/imagehelpers.h +++ b/src/gamedata/textures/imagehelpers.h @@ -41,6 +41,7 @@ #include "tarray.h" #include "colormatcher.h" #include "v_palette.h" +#include "v_colortables.h" #include "textures/bitmap.h" #include "r_data/renderstyle.h" #include "r_data/r_translate.h" diff --git a/src/menu/loadsavemenu.cpp b/src/menu/loadsavemenu.cpp index 9c79906e9..8b43c9602 100644 --- a/src/menu/loadsavemenu.cpp +++ b/src/menu/loadsavemenu.cpp @@ -43,6 +43,7 @@ #include "serializer.h" #include "vm.h" #include "i_system.h" +#include "v_video.h" // Save name length limit for old binary formats. #define OLDSAVESTRINGSIZE 24 diff --git a/src/playsim/p_acs.cpp b/src/playsim/p_acs.cpp index dca86a7c8..5ba454856 100644 --- a/src/playsim/p_acs.cpp +++ b/src/playsim/p_acs.cpp @@ -75,6 +75,7 @@ #include "types.h" #include "scriptutil.h" #include "s_music.h" +#include "v_video.h" // P-codes for ACS scripts enum diff --git a/src/rendering/gl/system/gl_framebuffer.h b/src/rendering/gl/system/gl_framebuffer.h index 512ea037b..7578103fb 100644 --- a/src/rendering/gl/system/gl_framebuffer.h +++ b/src/rendering/gl/system/gl_framebuffer.h @@ -2,6 +2,7 @@ #define __GL_FRAMEBUFFER #include "gl_sysfb.h" +#include "m_png.h" #include diff --git a/src/rendering/hwrenderer/textures/hw_material.cpp b/src/rendering/hwrenderer/textures/hw_material.cpp index a70d749fd..4c4e37ca0 100644 --- a/src/rendering/hwrenderer/textures/hw_material.cpp +++ b/src/rendering/hwrenderer/textures/hw_material.cpp @@ -26,6 +26,7 @@ #include "stats.h" #include "r_utility.h" #include "c_dispatch.h" +#include "v_video.h" #include "hw_ihwtexture.h" #include "hw_material.h" diff --git a/src/rendering/v_video.h b/src/rendering/v_video.h index 285d8d4c6..580f711e3 100644 --- a/src/rendering/v_video.h +++ b/src/rendering/v_video.h @@ -39,6 +39,7 @@ #include "vectors.h" #include "doomdef.h" +#include "m_png.h" #include "dobject.h" #include "r_data/renderstyle.h" #include "c_cvars.h" diff --git a/src/utility/m_crc32.h b/src/utility/m_crc32.h index a39e189ea..079bffec4 100644 --- a/src/utility/m_crc32.h +++ b/src/utility/m_crc32.h @@ -33,7 +33,7 @@ */ #include -#include "basics.h" +#include // zlib includes some CRC32 stuff, so just use that @@ -50,3 +50,8 @@ inline uint32_t CRC1 (uint32_t crc, const uint8_t c, const uint32_t *crcTable) { return crcTable[(crc & 0xff) ^ c] ^ (crc >> 8); } + +inline uint32_t Bcrc32(const void* data, int length, uint32_t crc) +{ + return crc32(crc, (const Bytef*)data, length); +} diff --git a/src/utility/m_png.cpp b/src/utility/m_png.cpp index 52d46f3e4..e58742da4 100644 --- a/src/utility/m_png.cpp +++ b/src/utility/m_png.cpp @@ -34,18 +34,21 @@ // HEADER FILES ------------------------------------------------------------ +#include #include #include +#include #ifdef _MSC_VER #include // for alloca() #endif +#include "basics.h" #include "m_crc32.h" #include "m_swap.h" #include "c_cvars.h" -#include "r_defs.h" #include "m_png.h" + // MACROS ------------------------------------------------------------------ // The maximum size of an IDAT chunk ZDoom will write. This is also the @@ -243,7 +246,7 @@ bool M_AppendPNGText (FileWriter *file, const char *keyword, const char *text) { struct { uint32_t len, id; char key[80]; } head; int len = (int)strlen (text); - int keylen = MIN ((int)strlen (keyword), 79); + int keylen = std::min ((int)strlen (keyword), 79); uint32_t crc; head.len = BigLong(len + keylen + 1); @@ -326,7 +329,7 @@ char *M_GetPNGText (PNGHandle *png, const char *keyword) if (strncmp (keyword, png->TextChunks[i], 80) == 0) { // Woo! A match was found! - keylen = MIN (80, strlen (keyword) + 1); + keylen = std::min (80, strlen (keyword) + 1); textlen = strlen (png->TextChunks[i] + keylen) + 1; char *str = new char[textlen]; strcpy (str, png->TextChunks[i] + keylen); @@ -348,7 +351,7 @@ bool M_GetPNGText (PNGHandle *png, const char *keyword, char *buffer, size_t buf if (strncmp (keyword, png->TextChunks[i], 80) == 0) { // Woo! A match was found! - keylen = MIN (80, strlen (keyword) + 1); + keylen = std::min (80, strlen (keyword) + 1); strncpy (buffer, png->TextChunks[i] + keylen, buffsize); return true; } @@ -563,7 +566,7 @@ bool M_ReadIDAT (FileReader &file, uint8_t *buffer, int width, int height, int p if (stream.avail_in == 0 && chunklen > 0) { stream.next_in = chunkbuffer; - stream.avail_in = (uInt)file.Read (chunkbuffer, MIN(chunklen,sizeof(chunkbuffer))); + stream.avail_in = (uInt)file.Read (chunkbuffer, std::min(chunklen,sizeof(chunkbuffer))); chunklen -= stream.avail_in; } diff --git a/src/utility/m_png.h b/src/utility/m_png.h index 10fd4c8e6..12e6d5adf 100644 --- a/src/utility/m_png.h +++ b/src/utility/m_png.h @@ -34,9 +34,18 @@ */ #include -#include "doomtype.h" -#include "v_video.h" +#include "zstring.h" #include "files.h" +#include "palentry.h" +#include "basics.h" + +// Screenshot buffer image data types +enum ESSType +{ + SS_PAL, + SS_RGB, + SS_BGRA +}; class FileWriter; // PNG Writing --------------------------------------------------------------