pcx: show developer warning for uncommon pcx files

This commit is contained in:
Denis Pauk 2024-07-31 11:16:36 +03:00
parent 7ee871dc76
commit 1b62173355
7 changed files with 91 additions and 78 deletions

View file

@ -5,7 +5,7 @@ on:
tags:
- "*"
jobs:
build64:
build_x86_64:
runs-on: windows-latest
strategy:
fail-fast: false
@ -68,7 +68,7 @@ jobs:
with:
files: |
yquake2remaster-${{matrix.env}}-${{github.ref_name}}.zip
build32:
build_x86_32:
runs-on: windows-latest
strategy:
fail-fast: false
@ -86,7 +86,6 @@ jobs:
zip
unzip
mingw-w64-${{matrix.env}}-curl
mingw-w64-${{matrix.env}}-ffmpeg
mingw-w64-${{matrix.env}}-gcc
mingw-w64-${{matrix.env}}-make
mingw-w64-${{matrix.env}}-openal

View file

@ -1012,7 +1012,7 @@ CLIENT_OBJS_ := \
src/client/sound/sdl.o \
src/client/sound/sound.o \
src/client/sound/wave.o \
src/client/vid/image.o \
src/client/cl_image.o \
src/client/vid/vid.o \
src/common/argproc.o \
src/common/clientserver.o \

View file

@ -24,9 +24,10 @@
* =======================================================================
*/
#include "../../client/header/client.h"
#include "header/client.h"
#define PCX_IDENT ((0x05 << 8) + 0x0a)
// don't need HDR stuff
#define STBI_NO_LINEAR
#define STBI_NO_HDR
@ -38,7 +39,7 @@
#define STBI_NO_THREAD_LOCALS
// include implementation part of stb_image into this file
#define STB_IMAGE_IMPLEMENTATION
#include "../refresh/files/stb_image.h"
#include "refresh/files/stb_image.h"
// Fix Jennell Jaquays' name in the Quitscreen
// this is 98x11 pixels, each value an index
@ -235,7 +236,8 @@ PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palett
}
full_size = (pcx_height + 1) * (pcx_width + 1);
if (pcx->color_planes == 3 && pcx->bits_per_pixel == 8)
if ((pcx->color_planes == 3 || pcx->color_planes == 4)
&& pcx->bits_per_pixel == 8)
{
full_size *= 4;
*bitsPerPixel = 32;
@ -445,6 +447,13 @@ PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palett
*pic = NULL;
}
if (pcx->color_planes != 1 || pcx->bits_per_pixel != 8)
{
Com_DPrintf("%s: %s has uncommon flags, "
"could be unsupported by other engines\n",
__func__, name);
}
if (data - (byte *)pcx > len)
{
Com_DPrintf("%s: %s file was malformed\n", __func__, name);

View file

@ -143,7 +143,7 @@ M_PopMenu(void)
if (m_menudepth < 1)
{
Com_Error(ERR_FATAL, "M_PopMenu: depth < 1");
Com_Error(ERR_FATAL, "%s: depth < 1", __func__);
}
m_menudepth--;
@ -5610,6 +5610,11 @@ PlayerDirectoryList(void)
ReplaceCharacters(list[i], '\\', '/');
/*
* search slash after "players/" and use only directory name
* pak search does not return directory names, only files in
* directories
*/
dirsize = strchr(list[i] + listoff, '/');
if (dirsize)
{
@ -5757,7 +5762,6 @@ HasSkinsInDir(const char *dirname, int *num)
return list;
}
/*
* list all valid player models.
* call PlayerDirectoryList first.
@ -6454,4 +6458,3 @@ M_Keydown(int key)
}
}
}

View file

@ -751,8 +751,8 @@ R_DrawAliasModel(entity_t *currententity, const model_t *currentmodel)
}
/* ir goggles color override */
if (r_newrefdef.rdflags & RDF_IRGOGGLES && currententity->flags &
RF_IR_VISIBLE)
if ((r_newrefdef.rdflags & RDF_IRGOGGLES) &&
(currententity->flags & RF_IR_VISIBLE))
{
shadelight[0] = 1.0;
shadelight[1] = 0.0;

View file

@ -306,7 +306,7 @@ FS_HandleForFile(const char *path, fileHandle_t *f)
}
/* Failed. */
Com_Error(ERR_DROP, "FS_HandleForFile: none free");
Com_Error(ERR_DROP, "%s: none free", __func__);
return NULL;
}
@ -319,7 +319,7 @@ FS_GetFileByHandle(fileHandle_t f)
{
if ((f < 0) || (f > MAX_HANDLES))
{
Com_Error(ERR_DROP, "FS_GetFileByHandle: out of range");
Com_Error(ERR_DROP, "%s: out of range", __func__);
}
if (f == 0)
@ -506,8 +506,8 @@ FS_FOpenFile(const char *rawname, fileHandle_t *f, qboolean gamedir_only)
/* Found it! */
if (fs_debug->value)
{
Com_Printf("FS_FOpenFile: '%s' (found in '%s').\n",
handle->name, pack->name);
Com_Printf("%s: '%s' (found in '%s').\n",
__func__, handle->name, pack->name);
}
// save the name with *correct case* in the handle
@ -585,8 +585,8 @@ FS_FOpenFile(const char *rawname, fileHandle_t *f, qboolean gamedir_only)
{
if (fs_debug->value)
{
Com_Printf("FS_FOpenFile: '%s' (found in '%s').\n",
handle->name, search->path);
Com_Printf("%s: '%s' (found in '%s').\n",
__func__, handle->name, search->path);
}
return FS_FileLength(handle->file);
@ -595,7 +595,7 @@ FS_FOpenFile(const char *rawname, fileHandle_t *f, qboolean gamedir_only)
}
if (fs_debug->value)
{
Com_Printf("FS_FOpenFile: couldn't find '%s'.\n", handle->name);
Com_Printf("%s: couldn't find '%s'.\n", __func__, handle->name);
}
/* Couldn't open, so free the handle. */
@ -769,13 +769,15 @@ FS_Read(void *buffer, int size, fileHandle_t f)
else
{
/* Already tried once. */
Com_Error(ERR_FATAL, "FS_Read: 0 bytes read from '%s'", handle->name);
Com_Error(ERR_FATAL, "%s: 0 bytes read from '%s'",
__func__, handle->name);
return size - remaining;
}
}
else if (r == -1)
{
Com_Error(ERR_FATAL, "FS_Read: -1 bytes read from '%s'", handle->name);
Com_Error(ERR_FATAL, "%s: -1 bytes read from '%s'",
__func__, handle->name);
}
remaining -= r;
@ -2028,7 +2030,7 @@ FS_Dir_f(void)
/*
* This function returns true if a real file (e.g. not something
* in a pak, somthing in the file system itself) exists in the
* in a pak, something in the file system itself) exists in the
* current gamedir.
*/
qboolean