diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 57574b01..40466602 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -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 diff --git a/Makefile b/Makefile index 3d1e4aa6..23a2f9d2 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/src/client/vid/image.c b/src/client/cl_image.c similarity index 98% rename from src/client/vid/image.c rename to src/client/cl_image.c index ba4c8068..addc69f2 100644 --- a/src/client/vid/image.c +++ b/src/client/cl_image.c @@ -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); diff --git a/src/client/menu/menu.c b/src/client/menu/menu.c index de545198..03f0b1f9 100644 --- a/src/client/menu/menu.c +++ b/src/client/menu/menu.c @@ -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--; @@ -156,7 +156,7 @@ M_PopMenu(void) M_ForceMenuOff(); /* play music */ if (Cvar_VariableValue("ogg_pausewithgame") == 1 && - OGG_Status() == PAUSE && cl.attractloop == false) + OGG_Status() == PAUSE && cl.attractloop == false) { Cbuf_AddText("ogg toggle\n"); } @@ -172,14 +172,14 @@ M_PopMenu(void) * 2. If the requested menu is already open, close it. * * 3. If the requested menu is already open but not - * on top, close all menus above it and the menu - * itself. This is necessary since an instance of - * the reqeuested menu is in flight and will be - * displayed. + * on top, close all menus above it and the menu + * itself. This is necessary since an instance of + * the reqeuested menu is in flight and will be + * displayed. * * 4. Save the previous menu on top (which was in flight) - * to the stack and make the requested menu the menu in - * flight. + * to the stack and make the requested menu the menu in + * flight. */ void M_PushMenu(menuframework_s* menu) @@ -193,7 +193,7 @@ M_PushMenu(menuframework_s* menu) } if ((Cvar_VariableValue("maxclients") == 1) && - Com_ServerState()) + Com_ServerState()) { Cvar_Set("paused", "1"); } @@ -263,31 +263,31 @@ Key_GetMenuKey(int key) switch (key) { case K_KP_UPARROW: - if (IN_NumpadIsOn() == true) { break; } + if (IN_NumpadIsOn() == true) { break; } case K_UPARROW: case K_DPAD_UP: - return K_UPARROW; + return K_UPARROW; case K_TAB: case K_KP_DOWNARROW: - if (IN_NumpadIsOn() == true) { break; } + if (IN_NumpadIsOn() == true) { break; } case K_DOWNARROW: case K_DPAD_DOWN: - return K_DOWNARROW; + return K_DOWNARROW; case K_KP_LEFTARROW: - if (IN_NumpadIsOn() == true) { break; } + if (IN_NumpadIsOn() == true) { break; } case K_LEFTARROW: case K_DPAD_LEFT: case K_SHOULDER_LEFT: - return K_LEFTARROW; + return K_LEFTARROW; case K_KP_RIGHTARROW: - if (IN_NumpadIsOn() == true) { break; } + if (IN_NumpadIsOn() == true) { break; } case K_RIGHTARROW: case K_DPAD_RIGHT: case K_SHOULDER_RIGHT: - return K_RIGHTARROW; + return K_RIGHTARROW; case K_MOUSE1: case K_MOUSE2: @@ -298,23 +298,23 @@ Key_GetMenuKey(int key) case K_KP_ENTER: case K_ENTER: case K_BTN_A: - return K_ENTER; + return K_ENTER; case K_ESCAPE: case K_JOY_BACK: case K_BTN_B: - return K_ESCAPE; + return K_ESCAPE; case K_BACKSPACE: case K_DEL: case K_KP_DEL: - if (IN_NumpadIsOn() == true) { break; } + if (IN_NumpadIsOn() == true) { break; } case K_BTN_Y: - return K_BACKSPACE; + return K_BACKSPACE; case K_KP_INS: - if (IN_NumpadIsOn() == true) { break; } + if (IN_NumpadIsOn() == true) { break; } case K_INS: - return K_INS; + return K_INS; } return key; @@ -941,14 +941,14 @@ M_UnbindCommand(char *command, int scope) switch (scope) { case KEYS_KEYBOARD_MOUSE: - end = K_JOY_FIRST_REGULAR; - break; + end = K_JOY_FIRST_REGULAR; + break; case KEYS_CONTROLLER: - begin = K_JOY_FIRST_REGULAR; - end = K_JOY_LAST_REGULAR + 1; - break; + begin = K_JOY_FIRST_REGULAR; + end = K_JOY_LAST_REGULAR + 1; + break; case KEYS_CONTROLLER_ALT: - begin = K_JOY_FIRST_REGULAR_ALT; + begin = K_JOY_FIRST_REGULAR_ALT; } for (j = begin; j < end; j++) @@ -977,14 +977,14 @@ M_FindKeysForCommand(char *command, int *twokeys, int scope) switch (scope) { case KEYS_KEYBOARD_MOUSE: - end = K_JOY_FIRST_REGULAR; - break; + end = K_JOY_FIRST_REGULAR; + break; case KEYS_CONTROLLER: - begin = K_JOY_FIRST_REGULAR; - end = K_JOY_LAST_REGULAR + 1; - break; + begin = K_JOY_FIRST_REGULAR; + end = K_JOY_LAST_REGULAR + 1; + break; case KEYS_CONTROLLER_ALT: - begin = K_JOY_FIRST_REGULAR_ALT; + begin = K_JOY_FIRST_REGULAR_ALT; } twokeys[0] = twokeys[1] = -1; @@ -1025,7 +1025,7 @@ KeyCursorDrawFunc(menuframework_s *menu) else { 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) { 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 { @@ -1051,7 +1051,7 @@ DrawKeyBindingFunc(void *self) name = Key_KeynumToString(keys[0]); 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; @@ -2354,8 +2354,8 @@ UpdateSoundQualityFunc(void *unused) } m_popup_string = "Restarting the sound system. This\n" - "could take up to a minute, so\n" - "please be patient."; + "could take up to a minute, so\n" + "please be patient."; m_popup_endtime = cls.realtime + 2000; M_Popup(); @@ -2999,7 +2999,7 @@ M_Credits_Draw(void) int x; x = (viddef.width / scale- (int)strlen(credits[i]) * 8 - stringoffset * - 8) / 2 + (j + stringoffset) * 8; + 8) / 2 + (j + stringoffset) * 8; if (bold) { @@ -3743,7 +3743,7 @@ LoadGame_MenuKey(int key) { if (ExecDeleteSaveFunc(m, menu_key)) { - LoadGame_MenuInit(); + LoadGame_MenuInit(); } return menu_move_sound; } @@ -3811,8 +3811,8 @@ SaveGameCallback(void *self) if (a->generic.localdata[0] == -1) { m_popup_string = "This slot is reserved for\n" - "quicksaving, so please select\n" - "another one."; + "quicksaving, so please select\n" + "another one."; m_popup_endtime = cls.realtime + 2000; M_Popup(); return; @@ -3820,8 +3820,8 @@ SaveGameCallback(void *self) else if (a->generic.localdata[0] == 0) { m_popup_string = "This slot is reserved for\n" - "autosaving, so please select\n" - "another one."; + "autosaving, so please select\n" + "another one."; m_popup_endtime = cls.realtime + 2000; M_Popup(); return; @@ -4034,7 +4034,7 @@ JoinServerFunc(void *self) } Com_sprintf(buffer, sizeof(buffer), "connect %s\n", - NET_AdrToString(local_server_netadr[index])); + NET_AdrToString(local_server_netadr[index])); Cbuf_AddText(buffer); M_ForceMenuOff(); } @@ -4059,8 +4059,8 @@ SearchLocalGames(void) } m_popup_string = "Searching for local servers. This\n" - "could take up to a minute, so\n" - "please be patient."; + "could take up to a minute, so\n" + "please be patient."; m_popup_endtime = cls.realtime + 2000; M_Popup(); @@ -4754,11 +4754,11 @@ DMFlagCallback(void *self) { 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) { - 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) { @@ -4783,7 +4783,7 @@ setvalue: Cvar_SetValue("dmflags", (float)flags); Com_sprintf(dmoptions_statusbar, sizeof(dmoptions_statusbar), - "dmflags = %d", flags); + "dmflags = %d", flags); } static void @@ -5336,7 +5336,7 @@ static stringlist_t s_directory; static int rate_tbl[] = {2500, 3200, 5000, 10000, 25000, 0}; 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 DownloadOptionsFunc(void *self) @@ -5404,7 +5404,7 @@ StripExtension(char* path) if (path[length] == '/') { - return; // no extension + return; // no extension } } @@ -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. @@ -6277,7 +6281,7 @@ PlayerConfig_MenuKey(int key) Cvar_Set("name", name); 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); @@ -6454,4 +6458,3 @@ M_Keydown(int key) } } } - diff --git a/src/client/refresh/vk/vk_mesh.c b/src/client/refresh/vk/vk_mesh.c index 6d642d8f..019d57ba 100644 --- a/src/client/refresh/vk/vk_mesh.c +++ b/src/client/refresh/vk/vk_mesh.c @@ -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; diff --git a/src/client/refresh/vk/vk_model.c b/src/client/refresh/vk/vk_model.c index 1024effa..ba581b19 100644 --- a/src/client/refresh/vk/vk_model.c +++ b/src/client/refresh/vk/vk_model.c @@ -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++) { - int side, ti, planenum, lightofs; + int side, ti, planenum, lightofs; out->firstedge = in->firstedge; out->numedges = in->numedges; diff --git a/src/common/filesystem.c b/src/common/filesystem.c index 71d222f1..513e0df9 100644 --- a/src/common/filesystem.c +++ b/src/common/filesystem.c @@ -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; @@ -1127,7 +1129,7 @@ FS_LoadSIN(const char *packPath) if (numFiles > MAX_FILES_IN_PACK) { 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); @@ -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