fix errata

master
an 2019-11-25 16:20:03 -05:00
parent d03dd0c701
commit 2ebc7fb7dd
27 changed files with 73 additions and 31 deletions

View File

@ -5,10 +5,6 @@ cmake_policy(SET CMP0071 NEW)
project(agw-quake C) project(agw-quake C)
if(NOT MSVC)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wextra -Werror")
endif()
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
@ -157,23 +153,36 @@ set(srcs
source/zone.c source/zone.c
source/zone.h) source/zone.h)
if(WIN32) set(srcs_linux
list(APPEND srcs source/linux/pl_linux.c)
source/net_win.c
source/net_wins.c set(srcs_osx
source/net_wins.h source/osx/pl_osx.c)
source/net_wipx.c
source/net_wipx.h set(srcs_unix
source/pl_win.c source/unix/net_bsd.c
source/sys_sdl_win.c source/unix/net_udp.c
source/wsaerror.h) source/unix/net_udp.h
source/unix/sys_sdl_unix.c)
set(srcs_windows
source/windows/net_win.c
source/windows/net_wins.c
source/windows/net_wins.h
source/windows/net_wipx.c
source/windows/net_wipx.h
source/windows/pl_win.c
source/windows/sys_sdl_win.c
source/windows/wsaerror.h)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND srcs ${srcs_windows})
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND srcs ${srcs_unix} ${srcs_linux})
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
list(APPEND srcs ${srcs_unix} ${srcs_osx})
else() else()
list(APPEND srcs message(FATAL_ERROR "platform not supported")
source/net_bsd.c
source/net_udp.c
source/net_udp.h
source/pl_linux.c
source/sys_sdl_unix.c)
endif() endif()
add_executable(quake WIN32 ${srcs}) add_executable(quake WIN32 ${srcs})
@ -190,4 +199,9 @@ agw_checked_library(USE_CODEC_VORBIS Vorbis)
agw_checked_library(USE_CODEC_OPUS Opus) agw_checked_library(USE_CODEC_OPUS Opus)
agw_checked_library(USE_CODEC_MikMod MikMod) agw_checked_library(USE_CODEC_MikMod MikMod)
target_compile_options(quake PUBLIC
$<$<C_COMPILER_ID:AppleClang,Clang,GNU>:
-Wall -Wextra -Werror -Wno-missing-field-initializers>
$<$<C_COMPILER_ID:MSVC>: /W4>)
target_include_directories(quake PUBLIC source)
target_link_libraries(quake m OpenGL::GL PkgConfig::SDL2) target_link_libraries(quake m OpenGL::GL PkgConfig::SDL2)

View File

@ -22,6 +22,7 @@
int CDAudio_Play(byte track, qboolean looping) int CDAudio_Play(byte track, qboolean looping)
{ {
(void)track, (void)looping;
return -1; return -1;
} }

View File

@ -58,6 +58,7 @@ GL_Overbright_f -- johnfitz
*/ */
static void GL_Overbright_f (cvar_t *var) static void GL_Overbright_f (cvar_t *var)
{ {
(void)var;
R_RebuildAllLightmaps (); R_RebuildAllLightmaps ();
} }
@ -68,6 +69,7 @@ GL_Fullbrights_f -- johnfitz
*/ */
static void GL_Fullbrights_f (cvar_t *var) static void GL_Fullbrights_f (cvar_t *var)
{ {
(void)var;
TexMgr_ReloadNobrightImages (); TexMgr_ReloadNobrightImages ();
} }
@ -81,6 +83,7 @@ static void R_SetClearColor_f (cvar_t *var)
byte *rgb; byte *rgb;
int s; int s;
(void)var;
s = (int)r_clearcolor.value & 0xFF; s = (int)r_clearcolor.value & 0xFF;
rgb = (byte*)(d_8to24table + s); rgb = (byte*)(d_8to24table + s);
glClearColor (rgb[0]/255.0,rgb[1]/255.0,rgb[2]/255.0,0); glClearColor (rgb[0]/255.0,rgb[1]/255.0,rgb[2]/255.0,0);
@ -94,6 +97,7 @@ R_Novis_f -- johnfitz
static void R_VisChanged (cvar_t *var) static void R_VisChanged (cvar_t *var)
{ {
extern int vis_changed; extern int vis_changed;
(void)var;
vis_changed = 1; vis_changed = 1;
} }
@ -104,6 +108,7 @@ R_Model_ExtraFlags_List_f -- johnfitz -- called when r_nolerp_list or r_noshadow
*/ */
static void R_Model_ExtraFlags_List_f (cvar_t *var) static void R_Model_ExtraFlags_List_f (cvar_t *var)
{ {
(void)var;
int i; int i;
for (i=0; i < MAX_MODELS; i++) for (i=0; i < MAX_MODELS; i++)
Mod_SetExtraFlags (cl.model_precache[i]); Mod_SetExtraFlags (cl.model_precache[i]);
@ -462,7 +467,7 @@ static qboolean GL_CheckShader (GLuint shader)
memset(infolog, 0, sizeof(infolog)); memset(infolog, 0, sizeof(infolog));
GL_GetShaderInfoLogFunc (shader, sizeof(infolog), NULL, infolog); GL_GetShaderInfoLogFunc (shader, sizeof(infolog), NULL, infolog);
Con_Warning ("GLSL program failed to compile: %s", infolog); Con_Warning ("GLSL program failed to compile: %s", infolog);
return false; return false;
@ -549,12 +554,12 @@ GLuint GL_CreateProgram (const GLchar *vertSource, const GLchar *fragSource, int
GL_DeleteShaderFunc (vertShader); GL_DeleteShaderFunc (vertShader);
GL_AttachShaderFunc (program, fragShader); GL_AttachShaderFunc (program, fragShader);
GL_DeleteShaderFunc (fragShader); GL_DeleteShaderFunc (fragShader);
for (i = 0; i < numbindings; i++) for (i = 0; i < numbindings; i++)
{ {
GL_BindAttribLocationFunc (program, bindings[i].attrib, bindings[i].name); GL_BindAttribLocationFunc (program, bindings[i].attrib, bindings[i].name);
} }
GL_LinkProgramFunc (program); GL_LinkProgramFunc (program);
if (!GL_CheckProgram (program)) if (!GL_CheckProgram (program))
@ -610,7 +615,7 @@ void GL_BindBuffer (GLenum target, GLuint buffer)
if (!gl_vbo_able) if (!gl_vbo_able)
return; return;
switch (target) switch (target)
{ {
case GL_ARRAY_BUFFER: case GL_ARRAY_BUFFER:
@ -623,7 +628,7 @@ void GL_BindBuffer (GLenum target, GLuint buffer)
Host_Error("GL_BindBuffer: unsupported target %d", (int)target); Host_Error("GL_BindBuffer: unsupported target %d", (int)target);
return; return;
} }
if (*cache != buffer) if (*cache != buffer)
{ {
*cache = buffer; *cache = buffer;

View File

@ -357,6 +357,7 @@ void SCR_SizeDown_f (void)
static void SCR_Callback_refdef (cvar_t *var) static void SCR_Callback_refdef (cvar_t *var)
{ {
(void)var;
vid.recalc_refdef = 1; vid.recalc_refdef = 1;
} }
@ -367,6 +368,7 @@ SCR_Conwidth_f -- johnfitz -- called when scr_conwidth or scr_conscale changes
*/ */
void SCR_Conwidth_f (cvar_t *var) void SCR_Conwidth_f (cvar_t *var)
{ {
(void)var;
vid.recalc_refdef = 1; vid.recalc_refdef = 1;
vid.conwidth = (scr_conwidth.value > 0) ? (int)scr_conwidth.value : (scr_conscale.value > 0) ? (int)(vid.width/scr_conscale.value) : vid.width; vid.conwidth = (scr_conwidth.value > 0) ? (int)scr_conwidth.value : (scr_conscale.value > 0) ? (int)(vid.width/scr_conscale.value) : vid.width;
vid.conwidth = CLAMP (320, vid.conwidth, vid.width); vid.conwidth = CLAMP (320, vid.conwidth, vid.width);
@ -805,7 +807,7 @@ void SCR_ScreenShot_f (void)
SCR_ScreenShot_Usage (); SCR_ScreenShot_Usage ();
return; return;
} }
// find a file name to save it to // find a file name to save it to
for (i=0; i<10000; i++) for (i=0; i<10000; i++)
{ {

View File

@ -129,6 +129,8 @@ static void TexMgr_TextureMode_f (cvar_t *var)
gltexture_t *glt; gltexture_t *glt;
int i; int i;
(void)var;
for (i = 0; i < NUM_GLMODES; i++) for (i = 0; i < NUM_GLMODES; i++)
{ {
if (!Q_strcmp (glmodes[i].name, gl_texturemode.string)) if (!Q_strcmp (glmodes[i].name, gl_texturemode.string))
@ -172,6 +174,7 @@ TexMgr_Anisotropy_f -- called when gl_texture_anisotropy changes
*/ */
static void TexMgr_Anisotropy_f (cvar_t *var) static void TexMgr_Anisotropy_f (cvar_t *var)
{ {
(void)var;
if (gl_texture_anisotropy.value < 1) if (gl_texture_anisotropy.value < 1)
{ {
Cvar_SetQuick (&gl_texture_anisotropy, "1"); Cvar_SetQuick (&gl_texture_anisotropy, "1");
@ -359,7 +362,7 @@ void TexMgr_FreeTexture (gltexture_t *kill)
if (in_reload_images) if (in_reload_images)
return; return;
if (kill == NULL) if (kill == NULL)
{ {
Con_Printf ("TexMgr_FreeTexture: NULL texture\n"); Con_Printf ("TexMgr_FreeTexture: NULL texture\n");
@ -573,7 +576,7 @@ void TexMgr_RecalcWarpImageSize (void)
// after vid_restart TexMgr_ReloadImage reloads textures // after vid_restart TexMgr_ReloadImage reloads textures
// to tx->source_width/source_height, which might not match oldsize. // to tx->source_width/source_height, which might not match oldsize.
// fixes: https://sourceforge.net/p/quakespasm/bugs/13/ // fixes: https://sourceforge.net/p/quakespasm/bugs/13/
// //
// resize the textures in opengl // resize the textures in opengl
// //
@ -1414,7 +1417,7 @@ void TexMgr_ReloadImages (void)
glGenTextures(1, &glt->texnum); glGenTextures(1, &glt->texnum);
TexMgr_ReloadImage (glt, -1, -1); TexMgr_ReloadImage (glt, -1, -1);
} }
in_reload_images = false; in_reload_images = false;
} }
@ -1453,7 +1456,7 @@ void GL_SelectTexture (GLenum target)
{ {
if (target == currenttarget) if (target == currenttarget)
return; return;
GL_SelectTextureFunc(target); GL_SelectTextureFunc(target);
currenttarget = target; currenttarget = target;
} }
@ -1528,7 +1531,7 @@ static void GL_DeleteTexture (gltexture_t *texture)
/* /*
================ ================
GL_ClearBindings -- ericw GL_ClearBindings -- ericw
Invalidates cached bindings, so the next GL_Bind calls for each TMU will Invalidates cached bindings, so the next GL_Bind calls for each TMU will
make real glBindTexture calls. make real glBindTexture calls.
Call this after changing the binding outside of GL_Bind. Call this after changing the binding outside of GL_Bind.

View File

@ -237,6 +237,7 @@ VID_Gamma_f -- callback when the cvar changes
*/ */
static void VID_Gamma_f (cvar_t *var) static void VID_Gamma_f (cvar_t *var)
{ {
(void)var;
if (gl_glsl_gamma_able) if (gl_glsl_gamma_able)
return; return;
@ -627,6 +628,7 @@ VID_Changed_f -- kristian -- notify us that a value has changed that requires a
*/ */
static void VID_Changed_f (cvar_t *var) static void VID_Changed_f (cvar_t *var)
{ {
(void)var;
vid_changed = true; vid_changed = true;
} }

View File

@ -93,6 +93,7 @@ Max_Edicts_f -- johnfitz
*/ */
static void Max_Edicts_f (cvar_t *var) static void Max_Edicts_f (cvar_t *var)
{ {
(void)var;
//TODO: clamp it here? //TODO: clamp it here?
if (cls.state == ca_connected || sv.active) if (cls.state == ca_connected || sv.active)
Con_Printf ("Changes to max_edicts will not take effect until the next time a map is loaded.\n"); Con_Printf ("Changes to max_edicts will not take effect until the next time a map is loaded.\n");

View File

@ -83,6 +83,7 @@ static int SDLCALL IN_FilterMouseEvents (const SDL_Event *event)
static int SDLCALL IN_SDL2_FilterMouseEvents (void *userdata, SDL_Event *event) static int SDLCALL IN_SDL2_FilterMouseEvents (void *userdata, SDL_Event *event)
{ {
(void)userdata;
return IN_FilterMouseEvents (event); return IN_FilterMouseEvents (event);
} }

View File

@ -2441,6 +2441,7 @@ void M_Search_Draw (void)
void M_Search_Key (int key) void M_Search_Key (int key)
{ {
(void)key;
} }
//============================================================================= //=============================================================================

View File

@ -253,6 +253,7 @@ qboolean Datagram_CanSendMessage (qsocket_t *sock)
qboolean Datagram_CanSendUnreliableMessage (qsocket_t *sock) qboolean Datagram_CanSendUnreliableMessage (qsocket_t *sock)
{ {
(void)sock;
return true; return true;
} }
@ -533,6 +534,8 @@ static void Test_Poll (void *unused)
int frags; int frags;
int connectTime; int connectTime;
(void)unused;
net_landriverlevel = testDriver; net_landriverlevel = testDriver;
while (1) while (1)
@ -663,6 +666,8 @@ static void Test2_Poll (void *unused)
char name[256]; char name[256];
char value[256]; char value[256];
(void)unused;
net_landriverlevel = test2Driver; net_landriverlevel = test2Driver;
name[0] = 0; name[0] = 0;

View File

@ -45,11 +45,14 @@ void Loop_Shutdown (void)
void Loop_Listen (qboolean state) void Loop_Listen (qboolean state)
{ {
(void)state;
} }
void Loop_SearchForHosts (qboolean xmit) void Loop_SearchForHosts (qboolean xmit)
{ {
(void)xmit;
if (!sv.active) if (!sv.active)
return; return;
@ -231,6 +234,7 @@ qboolean Loop_CanSendMessage (qsocket_t *sock)
qboolean Loop_CanSendUnreliableMessage (qsocket_t *sock) qboolean Loop_CanSendUnreliableMessage (qsocket_t *sock)
{ {
(void)sock;
return true; return true;
} }

View File

@ -361,6 +361,7 @@ const char *NET_SlistPrintServerName (int idx)
static void Slist_Send (void *unused) static void Slist_Send (void *unused)
{ {
(void)unused;
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++) for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++)
{ {
if (!slistLocal && IS_LOOP_DRIVER(net_driverlevel)) if (!slistLocal && IS_LOOP_DRIVER(net_driverlevel))
@ -377,6 +378,7 @@ static void Slist_Send (void *unused)
static void Slist_Poll (void *unused) static void Slist_Poll (void *unused)
{ {
(void)unused;
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++) for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++)
{ {
if (!slistLocal && IS_LOOP_DRIVER(net_driverlevel)) if (!slistLocal && IS_LOOP_DRIVER(net_driverlevel))

View File

@ -124,6 +124,7 @@ R_SetParticleTexture_f -- johnfitz
*/ */
static void R_SetParticleTexture_f (cvar_t *var) static void R_SetParticleTexture_f (cvar_t *var)
{ {
(void)var;
switch ((int)(r_particles.value)) switch ((int)(r_particles.value))
{ {
case 1: case 1: