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

View file

@ -1012,7 +1012,7 @@ CLIENT_OBJS_ := \
src/client/sound/sdl.o \ src/client/sound/sdl.o \
src/client/sound/sound.o \ src/client/sound/sound.o \
src/client/sound/wave.o \ src/client/sound/wave.o \
src/client/vid/image.o \ src/client/cl_image.o \
src/client/vid/vid.o \ src/client/vid/vid.o \
src/common/argproc.o \ src/common/argproc.o \
src/common/clientserver.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) #define PCX_IDENT ((0x05 << 8) + 0x0a)
// don't need HDR stuff // don't need HDR stuff
#define STBI_NO_LINEAR #define STBI_NO_LINEAR
#define STBI_NO_HDR #define STBI_NO_HDR
@ -38,7 +39,7 @@
#define STBI_NO_THREAD_LOCALS #define STBI_NO_THREAD_LOCALS
// include implementation part of stb_image into this file // include implementation part of stb_image into this file
#define STB_IMAGE_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION
#include "../refresh/files/stb_image.h" #include "refresh/files/stb_image.h"
// Fix Jennell Jaquays' name in the Quitscreen // Fix Jennell Jaquays' name in the Quitscreen
// this is 98x11 pixels, each value an index // 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); 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; full_size *= 4;
*bitsPerPixel = 32; *bitsPerPixel = 32;
@ -445,6 +447,13 @@ PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palett
*pic = NULL; *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) if (data - (byte *)pcx > len)
{ {
Com_DPrintf("%s: %s file was malformed\n", __func__, name); Com_DPrintf("%s: %s file was malformed\n", __func__, name);

View file

@ -143,7 +143,7 @@ M_PopMenu(void)
if (m_menudepth < 1) if (m_menudepth < 1)
{ {
Com_Error(ERR_FATAL, "M_PopMenu: depth < 1"); Com_Error(ERR_FATAL, "%s: depth < 1", __func__);
} }
m_menudepth--; m_menudepth--;
@ -156,7 +156,7 @@ M_PopMenu(void)
M_ForceMenuOff(); M_ForceMenuOff();
/* play music */ /* play music */
if (Cvar_VariableValue("ogg_pausewithgame") == 1 && if (Cvar_VariableValue("ogg_pausewithgame") == 1 &&
OGG_Status() == PAUSE && cl.attractloop == false) OGG_Status() == PAUSE && cl.attractloop == false)
{ {
Cbuf_AddText("ogg toggle\n"); Cbuf_AddText("ogg toggle\n");
} }
@ -172,14 +172,14 @@ M_PopMenu(void)
* 2. If the requested menu is already open, close it. * 2. If the requested menu is already open, close it.
* *
* 3. If the requested menu is already open but not * 3. If the requested menu is already open but not
* on top, close all menus above it and the menu * on top, close all menus above it and the menu
* itself. This is necessary since an instance of * itself. This is necessary since an instance of
* the reqeuested menu is in flight and will be * the reqeuested menu is in flight and will be
* displayed. * displayed.
* *
* 4. Save the previous menu on top (which was in flight) * 4. Save the previous menu on top (which was in flight)
* to the stack and make the requested menu the menu in * to the stack and make the requested menu the menu in
* flight. * flight.
*/ */
void void
M_PushMenu(menuframework_s* menu) M_PushMenu(menuframework_s* menu)
@ -193,7 +193,7 @@ M_PushMenu(menuframework_s* menu)
} }
if ((Cvar_VariableValue("maxclients") == 1) && if ((Cvar_VariableValue("maxclients") == 1) &&
Com_ServerState()) Com_ServerState())
{ {
Cvar_Set("paused", "1"); Cvar_Set("paused", "1");
} }
@ -263,31 +263,31 @@ Key_GetMenuKey(int key)
switch (key) switch (key)
{ {
case K_KP_UPARROW: case K_KP_UPARROW:
if (IN_NumpadIsOn() == true) { break; } if (IN_NumpadIsOn() == true) { break; }
case K_UPARROW: case K_UPARROW:
case K_DPAD_UP: case K_DPAD_UP:
return K_UPARROW; return K_UPARROW;
case K_TAB: case K_TAB:
case K_KP_DOWNARROW: case K_KP_DOWNARROW:
if (IN_NumpadIsOn() == true) { break; } if (IN_NumpadIsOn() == true) { break; }
case K_DOWNARROW: case K_DOWNARROW:
case K_DPAD_DOWN: case K_DPAD_DOWN:
return K_DOWNARROW; return K_DOWNARROW;
case K_KP_LEFTARROW: case K_KP_LEFTARROW:
if (IN_NumpadIsOn() == true) { break; } if (IN_NumpadIsOn() == true) { break; }
case K_LEFTARROW: case K_LEFTARROW:
case K_DPAD_LEFT: case K_DPAD_LEFT:
case K_SHOULDER_LEFT: case K_SHOULDER_LEFT:
return K_LEFTARROW; return K_LEFTARROW;
case K_KP_RIGHTARROW: case K_KP_RIGHTARROW:
if (IN_NumpadIsOn() == true) { break; } if (IN_NumpadIsOn() == true) { break; }
case K_RIGHTARROW: case K_RIGHTARROW:
case K_DPAD_RIGHT: case K_DPAD_RIGHT:
case K_SHOULDER_RIGHT: case K_SHOULDER_RIGHT:
return K_RIGHTARROW; return K_RIGHTARROW;
case K_MOUSE1: case K_MOUSE1:
case K_MOUSE2: case K_MOUSE2:
@ -298,23 +298,23 @@ Key_GetMenuKey(int key)
case K_KP_ENTER: case K_KP_ENTER:
case K_ENTER: case K_ENTER:
case K_BTN_A: case K_BTN_A:
return K_ENTER; return K_ENTER;
case K_ESCAPE: case K_ESCAPE:
case K_JOY_BACK: case K_JOY_BACK:
case K_BTN_B: case K_BTN_B:
return K_ESCAPE; return K_ESCAPE;
case K_BACKSPACE: case K_BACKSPACE:
case K_DEL: case K_DEL:
case K_KP_DEL: case K_KP_DEL:
if (IN_NumpadIsOn() == true) { break; } if (IN_NumpadIsOn() == true) { break; }
case K_BTN_Y: case K_BTN_Y:
return K_BACKSPACE; return K_BACKSPACE;
case K_KP_INS: case K_KP_INS:
if (IN_NumpadIsOn() == true) { break; } if (IN_NumpadIsOn() == true) { break; }
case K_INS: case K_INS:
return K_INS; return K_INS;
} }
return key; return key;
@ -941,14 +941,14 @@ M_UnbindCommand(char *command, int scope)
switch (scope) switch (scope)
{ {
case KEYS_KEYBOARD_MOUSE: case KEYS_KEYBOARD_MOUSE:
end = K_JOY_FIRST_REGULAR; end = K_JOY_FIRST_REGULAR;
break; break;
case KEYS_CONTROLLER: case KEYS_CONTROLLER:
begin = K_JOY_FIRST_REGULAR; begin = K_JOY_FIRST_REGULAR;
end = K_JOY_LAST_REGULAR + 1; end = K_JOY_LAST_REGULAR + 1;
break; break;
case KEYS_CONTROLLER_ALT: case KEYS_CONTROLLER_ALT:
begin = K_JOY_FIRST_REGULAR_ALT; begin = K_JOY_FIRST_REGULAR_ALT;
} }
for (j = begin; j < end; j++) for (j = begin; j < end; j++)
@ -977,14 +977,14 @@ M_FindKeysForCommand(char *command, int *twokeys, int scope)
switch (scope) switch (scope)
{ {
case KEYS_KEYBOARD_MOUSE: case KEYS_KEYBOARD_MOUSE:
end = K_JOY_FIRST_REGULAR; end = K_JOY_FIRST_REGULAR;
break; break;
case KEYS_CONTROLLER: case KEYS_CONTROLLER:
begin = K_JOY_FIRST_REGULAR; begin = K_JOY_FIRST_REGULAR;
end = K_JOY_LAST_REGULAR + 1; end = K_JOY_LAST_REGULAR + 1;
break; break;
case KEYS_CONTROLLER_ALT: case KEYS_CONTROLLER_ALT:
begin = K_JOY_FIRST_REGULAR_ALT; begin = K_JOY_FIRST_REGULAR_ALT;
} }
twokeys[0] = twokeys[1] = -1; twokeys[0] = twokeys[1] = -1;
@ -1025,7 +1025,7 @@ KeyCursorDrawFunc(menuframework_s *menu)
else else
{ {
Draw_CharScaled(menu->x, (menu->y + menu->cursor * 9) * scale, 12 + Draw_CharScaled(menu->x, (menu->y + menu->cursor * 9) * scale, 12 +
((int)(Sys_Milliseconds() / 250) & 1), scale); ((int)(Sys_Milliseconds() / 250) & 1), scale);
} }
} }
@ -1041,7 +1041,7 @@ DrawKeyBindingFunc(void *self)
if (keys[0] == -1) if (keys[0] == -1)
{ {
Menu_DrawString(a->generic.x + a->generic.parent->x + RCOLUMN_OFFSET * scale, Menu_DrawString(a->generic.x + a->generic.parent->x + RCOLUMN_OFFSET * scale,
a->generic.y + a->generic.parent->y, "???"); a->generic.y + a->generic.parent->y, "???");
} }
else else
{ {
@ -1051,7 +1051,7 @@ DrawKeyBindingFunc(void *self)
name = Key_KeynumToString(keys[0]); name = Key_KeynumToString(keys[0]);
Menu_DrawString(a->generic.x + a->generic.parent->x + RCOLUMN_OFFSET * scale, Menu_DrawString(a->generic.x + a->generic.parent->x + RCOLUMN_OFFSET * scale,
a->generic.y + a->generic.parent->y, name); a->generic.y + a->generic.parent->y, name);
x = strlen(name) * 8; x = strlen(name) * 8;
@ -2354,8 +2354,8 @@ UpdateSoundQualityFunc(void *unused)
} }
m_popup_string = "Restarting the sound system. This\n" m_popup_string = "Restarting the sound system. This\n"
"could take up to a minute, so\n" "could take up to a minute, so\n"
"please be patient."; "please be patient.";
m_popup_endtime = cls.realtime + 2000; m_popup_endtime = cls.realtime + 2000;
M_Popup(); M_Popup();
@ -2999,7 +2999,7 @@ M_Credits_Draw(void)
int x; int x;
x = (viddef.width / scale- (int)strlen(credits[i]) * 8 - stringoffset * x = (viddef.width / scale- (int)strlen(credits[i]) * 8 - stringoffset *
8) / 2 + (j + stringoffset) * 8; 8) / 2 + (j + stringoffset) * 8;
if (bold) if (bold)
{ {
@ -3743,7 +3743,7 @@ LoadGame_MenuKey(int key)
{ {
if (ExecDeleteSaveFunc(m, menu_key)) if (ExecDeleteSaveFunc(m, menu_key))
{ {
LoadGame_MenuInit(); LoadGame_MenuInit();
} }
return menu_move_sound; return menu_move_sound;
} }
@ -3811,8 +3811,8 @@ SaveGameCallback(void *self)
if (a->generic.localdata[0] == -1) if (a->generic.localdata[0] == -1)
{ {
m_popup_string = "This slot is reserved for\n" m_popup_string = "This slot is reserved for\n"
"quicksaving, so please select\n" "quicksaving, so please select\n"
"another one."; "another one.";
m_popup_endtime = cls.realtime + 2000; m_popup_endtime = cls.realtime + 2000;
M_Popup(); M_Popup();
return; return;
@ -3820,8 +3820,8 @@ SaveGameCallback(void *self)
else if (a->generic.localdata[0] == 0) else if (a->generic.localdata[0] == 0)
{ {
m_popup_string = "This slot is reserved for\n" m_popup_string = "This slot is reserved for\n"
"autosaving, so please select\n" "autosaving, so please select\n"
"another one."; "another one.";
m_popup_endtime = cls.realtime + 2000; m_popup_endtime = cls.realtime + 2000;
M_Popup(); M_Popup();
return; return;
@ -4034,7 +4034,7 @@ JoinServerFunc(void *self)
} }
Com_sprintf(buffer, sizeof(buffer), "connect %s\n", Com_sprintf(buffer, sizeof(buffer), "connect %s\n",
NET_AdrToString(local_server_netadr[index])); NET_AdrToString(local_server_netadr[index]));
Cbuf_AddText(buffer); Cbuf_AddText(buffer);
M_ForceMenuOff(); M_ForceMenuOff();
} }
@ -4059,8 +4059,8 @@ SearchLocalGames(void)
} }
m_popup_string = "Searching for local servers. This\n" m_popup_string = "Searching for local servers. This\n"
"could take up to a minute, so\n" "could take up to a minute, so\n"
"please be patient."; "please be patient.";
m_popup_endtime = cls.realtime + 2000; m_popup_endtime = cls.realtime + 2000;
M_Popup(); M_Popup();
@ -4754,11 +4754,11 @@ DMFlagCallback(void *self)
{ {
if (f == &s_no_mines_box) if (f == &s_no_mines_box)
{ {
bit = DF_NO_MINES; /* Equivalent to DF_CTF_FORCEJOIN in CTF */ bit = DF_NO_MINES; /* Equivalent to DF_CTF_FORCEJOIN in CTF */
} }
else if (f == &s_no_nukes_box) else if (f == &s_no_nukes_box)
{ {
bit = DF_NO_NUKES; /* Equivalent to DF_CTF_NO_TECH in CTF */ bit = DF_NO_NUKES; /* Equivalent to DF_CTF_NO_TECH in CTF */
} }
else if (f == &s_stack_double_box) else if (f == &s_stack_double_box)
{ {
@ -4783,7 +4783,7 @@ setvalue:
Cvar_SetValue("dmflags", (float)flags); Cvar_SetValue("dmflags", (float)flags);
Com_sprintf(dmoptions_statusbar, sizeof(dmoptions_statusbar), Com_sprintf(dmoptions_statusbar, sizeof(dmoptions_statusbar),
"dmflags = %d", flags); "dmflags = %d", flags);
} }
static void static void
@ -5336,7 +5336,7 @@ static stringlist_t s_directory;
static int rate_tbl[] = {2500, 3200, 5000, 10000, 25000, 0}; static int rate_tbl[] = {2500, 3200, 5000, 10000, 25000, 0};
static const char *rate_names[] = {"28.8 Modem", "33.6 Modem", "Single ISDN", static const char *rate_names[] = {"28.8 Modem", "33.6 Modem", "Single ISDN",
"Dual ISDN/Cable", "T1/LAN", "User defined", 0 }; "Dual ISDN/Cable", "T1/LAN", "User defined", 0 };
static void static void
DownloadOptionsFunc(void *self) DownloadOptionsFunc(void *self)
@ -5404,7 +5404,7 @@ StripExtension(char* path)
if (path[length] == '/') if (path[length] == '/')
{ {
return; // no extension return; // no extension
} }
} }
@ -5610,6 +5610,11 @@ PlayerDirectoryList(void)
ReplaceCharacters(list[i], '\\', '/'); 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, '/'); dirsize = strchr(list[i] + listoff, '/');
if (dirsize) if (dirsize)
{ {
@ -5757,7 +5762,6 @@ HasSkinsInDir(const char *dirname, int *num)
return list; return list;
} }
/* /*
* list all valid player models. * list all valid player models.
* call PlayerDirectoryList first. * call PlayerDirectoryList first.
@ -6277,7 +6281,7 @@ PlayerConfig_MenuKey(int key)
Cvar_Set("name", name); Cvar_Set("name", name);
Cvar_Set("skin", skin); Cvar_Set("skin", skin);
PlayerModelFree(); // free player skins, models and directories PlayerModelFree(); // free player skins, models and directories
} }
return Default_MenuKey(&s_player_config_menu, key); return Default_MenuKey(&s_player_config_menu, key);
@ -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 */ /* ir goggles color override */
if (r_newrefdef.rdflags & RDF_IRGOGGLES && currententity->flags & if ((r_newrefdef.rdflags & RDF_IRGOGGLES) &&
RF_IR_VISIBLE) (currententity->flags & RF_IR_VISIBLE))
{ {
shadelight[0] = 1.0; shadelight[0] = 1.0;
shadelight[1] = 0.0; shadelight[1] = 0.0;

View file

@ -188,7 +188,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
for (surfnum = 0; surfnum < count; surfnum++, in++, out++) for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
{ {
int side, ti, planenum, lightofs; int side, ti, planenum, lightofs;
out->firstedge = in->firstedge; out->firstedge = in->firstedge;
out->numedges = in->numedges; out->numedges = in->numedges;

View file

@ -306,7 +306,7 @@ FS_HandleForFile(const char *path, fileHandle_t *f)
} }
/* Failed. */ /* Failed. */
Com_Error(ERR_DROP, "FS_HandleForFile: none free"); Com_Error(ERR_DROP, "%s: none free", __func__);
return NULL; return NULL;
} }
@ -319,7 +319,7 @@ FS_GetFileByHandle(fileHandle_t f)
{ {
if ((f < 0) || (f > MAX_HANDLES)) 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) if (f == 0)
@ -506,8 +506,8 @@ FS_FOpenFile(const char *rawname, fileHandle_t *f, qboolean gamedir_only)
/* Found it! */ /* Found it! */
if (fs_debug->value) if (fs_debug->value)
{ {
Com_Printf("FS_FOpenFile: '%s' (found in '%s').\n", Com_Printf("%s: '%s' (found in '%s').\n",
handle->name, pack->name); __func__, handle->name, pack->name);
} }
// save the name with *correct case* in the handle // 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) if (fs_debug->value)
{ {
Com_Printf("FS_FOpenFile: '%s' (found in '%s').\n", Com_Printf("%s: '%s' (found in '%s').\n",
handle->name, search->path); __func__, handle->name, search->path);
} }
return FS_FileLength(handle->file); return FS_FileLength(handle->file);
@ -595,7 +595,7 @@ FS_FOpenFile(const char *rawname, fileHandle_t *f, qboolean gamedir_only)
} }
if (fs_debug->value) 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. */ /* Couldn't open, so free the handle. */
@ -769,13 +769,15 @@ FS_Read(void *buffer, int size, fileHandle_t f)
else else
{ {
/* Already tried once. */ /* 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; return size - remaining;
} }
} }
else if (r == -1) 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; remaining -= r;
@ -1127,7 +1129,7 @@ FS_LoadSIN(const char *packPath)
if (numFiles > MAX_FILES_IN_PACK) if (numFiles > MAX_FILES_IN_PACK)
{ {
Com_Printf("%s: '%s' has %i > %i files\n", Com_Printf("%s: '%s' has %i > %i files\n",
__func__, packPath, numFiles, MAX_FILES_IN_PACK); __func__, packPath, numFiles, MAX_FILES_IN_PACK);
} }
info = malloc(header.dirlen); info = malloc(header.dirlen);
@ -2028,7 +2030,7 @@ FS_Dir_f(void)
/* /*
* This function returns true if a real file (e.g. not something * 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. * current gamedir.
*/ */
qboolean qboolean