From 2f045f0f49a1f71b07c9f5d640d63f467997edec Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Tue, 30 Jun 2020 05:10:48 +0000 Subject: [PATCH] Comply with ISO C11. Engine will now compile with -pedantic, w/o extra warnings But don't actually use -std=c11 because computed gotos is a gcc extension that makes the QCVM 30 percent faster in all situations. c11 obviously disables gcc extensions. But this is a nice thing to achieve as far as portability is concerned. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12756 d7cf8633-e32d-0410-b094-e92efae38249 --- common.h | 4 +- csprogs.c | 2 +- gl_backend.c | 2 +- makefile.inc | 1 + model_shared.c | 2 +- mvm_cmds.c | 81 ++++----- progsvm.h | 6 +- prvm_cmds.c | 13 +- prvm_edict.c | 2 +- prvm_exec.c | 2 +- render.h | 70 ++++---- svvm_cmds.c | 445 +++++++++++++++++++++++++------------------------ sys_linux.c | 20 +-- sys_sdl.c | 16 +- vid_sdl.c | 11 +- zone.c | 4 +- 16 files changed, 332 insertions(+), 349 deletions(-) diff --git a/common.h b/common.h index e816608f..64dba290 100644 --- a/common.h +++ b/common.h @@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef WIN32 # define strcasecmp _stricmp # define strncasecmp _strnicmp +#else +#include "strings.h" #endif // Create our own define for Mac OS X @@ -34,7 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #ifdef SUNOS -#include ///< Needed for FNDELAY +#include ///< Needed for O_NDELAY #endif //============================================================================ diff --git a/csprogs.c b/csprogs.c index 665d4887..fa1673b4 100644 --- a/csprogs.c +++ b/csprogs.c @@ -1015,7 +1015,7 @@ void CL_VM_Init (void) } else { - Con_DPrintf("Not using buffered \"%s\" (buffered: %p, %d)\n", csprogsfn, cls.caughtcsprogsdata, (int) cls.caughtcsprogsdatasize); + Con_DPrintf("Not using buffered \"%s\" (buffered: %p, %d)\n", csprogsfn, (void *)cls.caughtcsprogsdata, (int) cls.caughtcsprogsdatasize); csprogsdata = FS_LoadFile(csprogsfn, tempmempool, true, &csprogsdatasize); } } diff --git a/gl_backend.c b/gl_backend.c index b16916a7..5f53208d 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -1907,7 +1907,7 @@ void R_Mesh_VertexPointer(int components, int gltype, size_t stride, const void { int bufferobject = vertexbuffer ? vertexbuffer->bufferobject : 0; if (!bufferobject && gl_paranoid.integer) - Con_DPrintf("Warning: no bufferobject in R_Mesh_VertexPointer(%i, %i, %i, %p, %p, %08x)", components, gltype, (int)stride, pointer, vertexbuffer, (unsigned int)bufferoffset); + Con_DPrintf("Warning: no bufferobject in R_Mesh_VertexPointer(%i, %i, %i, %p, %p, %08x)", components, gltype, (int)stride, pointer, (void *)vertexbuffer, (unsigned int)bufferoffset); gl_state.pointer_vertex_components = components; gl_state.pointer_vertex_gltype = gltype; gl_state.pointer_vertex_stride = stride; diff --git a/makefile.inc b/makefile.inc index ce15fefa..2d83af48 100644 --- a/makefile.inc +++ b/makefile.inc @@ -173,6 +173,7 @@ OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o thread_sdl.o $(OBJ_MENU) $(OBJ_SND_COMM # Compilation CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_SND_XMP) $(CFLAGS_NET) $(CFLAGS_SDL) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../ +# CFLAGS_STANDARD=-D_POSIX_C_SOURCE=200112L -std=c11 -pedantic CFLAGS_CLIENT=-DCONFIG_MENU $(CFLAGS_VIDEO_CAPTURE) CFLAGS_SERVER= CFLAGS_DEBUG=-ggdb diff --git a/model_shared.c b/model_shared.c index 077197aa..f4f74cd9 100644 --- a/model_shared.c +++ b/model_shared.c @@ -748,7 +748,7 @@ qboolean Mod_ValidateElements(int *element3i, unsigned short *element3s, int num } if (invalidintcount || invalidshortcount || invalidmismatchcount) { - Con_Printf("Mod_ValidateElements(%i, %i, %i, %p, %p) called at %s:%d", numelements, first, last, element3i, element3s, filename, fileline); + Con_Printf("Mod_ValidateElements(%i, %i, %i, %p, %p) called at %s:%d", numelements, first, last, (void *)element3i, (void *)element3s, filename, fileline); Con_Printf(", %i elements are invalid in element3i (example: element3i[%i] == %i)", invalidintcount, invalidintexample, element3i ? element3i[invalidintexample] : 0); Con_Printf(", %i elements are invalid in element3s (example: element3s[%i] == %i)", invalidshortcount, invalidshortexample, element3s ? element3s[invalidshortexample] : 0); Con_Printf(", %i elements mismatch between element3i and element3s (example: element3s[%i] is %i and element3i[%i] is %i)", invalidmismatchcount, invalidmismatchexample, element3s ? element3s[invalidmismatchexample] : 0, invalidmismatchexample, element3i ? element3i[invalidmismatchexample] : 0); diff --git a/mvm_cmds.c b/mvm_cmds.c index df6497fa..c9da3166 100644 --- a/mvm_cmds.c +++ b/mvm_cmds.c @@ -10,46 +10,47 @@ //============================================================================ // Menu -const char *vm_m_extensions = -"BX_WAL_SUPPORT " -"DP_CINEMATIC_DPV " -"DP_COVERAGE " -"DP_CRYPTO " -"DP_CSQC_BINDMAPS " -"DP_GFX_FONTS " -"DP_GFX_FONTS_FREETYPE " -"DP_UTF8 " -"DP_FONT_VARIABLEWIDTH " -"DP_MENU_EXTRESPONSEPACKET " -"DP_QC_ASINACOSATANATAN2TAN " -"DP_QC_AUTOCVARS " -"DP_QC_CMD " -"DP_QC_CRC16 " -"DP_QC_CVAR_TYPE " -"DP_QC_CVAR_DESCRIPTION " -"DP_QC_DIGEST " -"DP_QC_DIGEST_SHA256 " -"DP_QC_FINDCHAIN_TOFIELD " -"DP_QC_I18N " -"DP_QC_LOG " -"DP_QC_RENDER_SCENE " -"DP_QC_SPRINTF " -"DP_QC_STRFTIME " -"DP_QC_STRINGBUFFERS " -"DP_QC_STRINGBUFFERS_CVARLIST " -"DP_QC_STRINGBUFFERS_EXT_WIP " -"DP_QC_STRINGCOLORFUNCTIONS " -"DP_QC_STRING_CASE_FUNCTIONS " -"DP_QC_STRREPLACE " -"DP_QC_TOKENIZEBYSEPARATOR " -"DP_QC_TOKENIZE_CONSOLE " -"DP_QC_UNLIMITEDTEMPSTRINGS " -"DP_QC_URI_ESCAPE " -"DP_QC_URI_GET " -"DP_QC_URI_POST " -"DP_QC_WHICHPACK " -"FTE_STRINGS " -; +const char *vm_m_extensions[] = { +"BX_WAL_SUPPORT", +"DP_CINEMATIC_DPV", +"DP_COVERAGE", +"DP_CRYPTO", +"DP_CSQC_BINDMAPS", +"DP_GFX_FONTS", +"DP_GFX_FONTS_FREETYPE", +"DP_UTF8", +"DP_FONT_VARIABLEWIDTH", +"DP_MENU_EXTRESPONSEPACKET", +"DP_QC_ASINACOSATANATAN2TAN", +"DP_QC_AUTOCVARS", +"DP_QC_CMD", +"DP_QC_CRC16", +"DP_QC_CVAR_TYPE", +"DP_QC_CVAR_DESCRIPTION", +"DP_QC_DIGEST", +"DP_QC_DIGEST_SHA256", +"DP_QC_FINDCHAIN_TOFIELD", +"DP_QC_I18N", +"DP_QC_LOG", +"DP_QC_RENDER_SCENE", +"DP_QC_SPRINTF", +"DP_QC_STRFTIME", +"DP_QC_STRINGBUFFERS", +"DP_QC_STRINGBUFFERS_CVARLIST", +"DP_QC_STRINGBUFFERS_EXT_WIP", +"DP_QC_STRINGCOLORFUNCTIONS", +"DP_QC_STRING_CASE_FUNCTIONS", +"DP_QC_STRREPLACE", +"DP_QC_TOKENIZEBYSEPARATOR", +"DP_QC_TOKENIZE_CONSOLE", +"DP_QC_UNLIMITEDTEMPSTRINGS", +"DP_QC_URI_ESCAPE", +"DP_QC_URI_GET", +"DP_QC_URI_POST", +"DP_QC_WHICHPACK", +"FTE_STRINGS", +NULL +}; /* ========= diff --git a/progsvm.h b/progsvm.h index 26517494..e9999ca4 100644 --- a/progsvm.h +++ b/progsvm.h @@ -685,7 +685,7 @@ typedef struct prvm_prog_s // flag - used to store general flags like PRVM_GE_SELF, etc. int flag; - const char *extensionstring; // [INIT] + const char **extensionstring; // [INIT] qboolean loadintoworld; // [INIT] @@ -763,8 +763,8 @@ extern const int vm_sv_numbuiltins; extern const int vm_cl_numbuiltins; extern const int vm_m_numbuiltins; -extern const char * vm_sv_extensions; // client also uses this -extern const char * vm_m_extensions; +extern const char *vm_sv_extensions[]; // client also uses this +extern const char *vm_m_extensions[]; void SVVM_init_cmd(prvm_prog_t *prog); void SVVM_reset_cmd(prvm_prog_t *prog); diff --git a/prvm_cmds.c b/prvm_cmds.c index 65fc3a18..6833080e 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -265,20 +265,11 @@ checkextension(extensionname) // kind of helper function static qboolean checkextension(prvm_prog_t *prog, const char *name) { - int len; - const char *e, *start; - len = (int)strlen(name); + const char **e; for (e = prog->extensionstring;*e;e++) { - while (*e == ' ') - e++; - if (!*e) - break; - start = e; - while (*e && *e != ' ') - e++; - if ((e - start) == len && !strncasecmp(start, name, len)) + if(!strcasecmp(*e, name)) { #ifdef USEODE // special sheck for ODE diff --git a/prvm_edict.c b/prvm_edict.c index 83d194d3..dc639e3c 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -3128,7 +3128,7 @@ int PRVM_SetEngineString(prvm_prog_t *prog, const char *s) return PRVM_KNOWNSTRINGBASE + i; // new unknown engine string if (developer_insane.integer) - Con_DPrintf("new engine string %p = \"%s\"\n", s, s); + Con_DPrintf("new engine string %p = \"%s\"\n", (void *)s, s); for (i = prog->firstfreeknownstring;i < prog->numknownstrings;i++) if (!prog->knownstrings[i]) break; diff --git a/prvm_exec.c b/prvm_exec.c index e3dc1902..b6766757 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -716,7 +716,7 @@ static void PRVM_StatementCoverageEvent(prvm_prog_t *prog, mfunction_t *func, in Con_Printf("prvm_coverage: %s just executed a statement at %s for the first time. Coverage: %.2f%%.\n", prog->name, PRVM_WhereAmI(vabuf, sizeof(vabuf), prog, func, statement), prog->statements_covered * 100.0 / prog->numstatements); } -#ifdef __GNUC__ +#if defined (__GNUC__) && (_GNU_SOURCE) #define HAVE_COMPUTED_GOTOS 1 #endif diff --git a/render.h b/render.h index 2367fbfe..c8d63be8 100644 --- a/render.h +++ b/render.h @@ -69,43 +69,39 @@ typedef enum shadermode_e } shadermode_t; -typedef enum shaderpermutation_e -{ - SHADERPERMUTATION_DIFFUSE = 1<<0, ///< (lightsource) whether to use directional shading - SHADERPERMUTATION_VERTEXTEXTUREBLEND = 1<<1, ///< indicates this is a two-layer material blend based on vertex alpha (q3bsp) - SHADERPERMUTATION_VIEWTINT = 1<<2, ///< view tint (postprocessing only), use vertex colors (generic only) - SHADERPERMUTATION_COLORMAPPING = 1<<3, ///< indicates this is a colormapped skin - SHADERPERMUTATION_SATURATION = 1<<4, ///< saturation (postprocessing only) - SHADERPERMUTATION_FOGINSIDE = 1<<5, ///< tint the color by fog color or black if using additive blend mode - SHADERPERMUTATION_FOGOUTSIDE = 1<<6, ///< tint the color by fog color or black if using additive blend mode - SHADERPERMUTATION_FOGHEIGHTTEXTURE = 1<<7, ///< fog color and density determined by texture mapped on vertical axis - SHADERPERMUTATION_FOGALPHAHACK = 1<<8, ///< fog color and density determined by texture mapped on vertical axis - SHADERPERMUTATION_GAMMARAMPS = 1<<9, ///< gamma (postprocessing only) - SHADERPERMUTATION_CUBEFILTER = 1<<10, ///< (lightsource) use cubemap light filter - SHADERPERMUTATION_GLOW = 1<<11, ///< (lightmap) blend in an additive glow texture - SHADERPERMUTATION_BLOOM = 1<<12, ///< bloom (postprocessing only) - SHADERPERMUTATION_SPECULAR = 1<<13, ///< (lightsource or deluxemapping) render specular effects - SHADERPERMUTATION_POSTPROCESSING = 1<<14, ///< user defined postprocessing (postprocessing only) - SHADERPERMUTATION_REFLECTION = 1<<15, ///< normalmap-perturbed reflection of the scene infront of the surface, preformed as an overlay on the surface - SHADERPERMUTATION_OFFSETMAPPING = 1<<16, ///< adjust texcoords to roughly simulate a displacement mapped surface - SHADERPERMUTATION_OFFSETMAPPING_RELIEFMAPPING = 1<<17, ///< adjust texcoords to accurately simulate a displacement mapped surface (requires OFFSETMAPPING to also be set!) - SHADERPERMUTATION_SHADOWMAP2D = 1<<18, ///< (lightsource) use shadowmap texture as light filter - SHADERPERMUTATION_SHADOWMAPVSDCT = 1<<19, ///< (lightsource) use virtual shadow depth cube texture for shadowmap indexing - SHADERPERMUTATION_SHADOWMAPORTHO = 1<<20, ///< (lightsource) use orthographic shadowmap projection - SHADERPERMUTATION_DEFERREDLIGHTMAP = 1<<21, ///< (lightmap) read Texture_ScreenDiffuse/Specular textures and add them on top of lightmapping - SHADERPERMUTATION_ALPHAKILL = 1<<22, ///< (deferredgeometry) discard pixel if diffuse texture alpha below 0.5, (generic) apply global alpha - SHADERPERMUTATION_REFLECTCUBE = 1<<23, ///< fake reflections using global cubemap (not HDRI light probe) - SHADERPERMUTATION_NORMALMAPSCROLLBLEND = 1<<24, ///< (water) counter-direction normalmaps scrolling - SHADERPERMUTATION_BOUNCEGRID = 1<<25, ///< (lightmap) use Texture_BounceGrid as an additional source of ambient light - SHADERPERMUTATION_BOUNCEGRIDDIRECTIONAL = 1<<26, ///< (lightmap) use 16-component pixels in bouncegrid texture for directional lighting rather than standard 4-component - SHADERPERMUTATION_TRIPPY = 1<<27, ///< use trippy vertex shader effect - SHADERPERMUTATION_DEPTHRGB = 1<<28, ///< read/write depth values in RGB color coded format for older hardware without depth samplers - SHADERPERMUTATION_ALPHAGEN_VERTEX = 1<<29, ///< alphaGen vertex - SHADERPERMUTATION_SKELETAL = 1<<30, ///< (skeletal models) use skeletal matrices to deform vertices (gpu-skinning) - SHADERPERMUTATION_OCCLUDE = 1<<31, ///< use occlusion buffer for corona - SHADERPERMUTATION_COUNT = 32 ///< size of shaderpermutationinfo array -} -shaderpermutation_t; +#define SHADERPERMUTATION_DIFFUSE (1<<0) ///< (lightsource) whether to use directional shading +#define SHADERPERMUTATION_VERTEXTEXTUREBLEND (1<<1) ///< indicates this is a two-layer material blend based on vertex alpha (q3bsp) +#define SHADERPERMUTATION_VIEWTINT (1<<2) ///< view tint (postprocessing only), use vertex colors (generic only) +#define SHADERPERMUTATION_COLORMAPPING (1<<3) ///< indicates this is a colormapped skin +#define SHADERPERMUTATION_SATURATION (1<<4) ///< saturation (postprocessing only) +#define SHADERPERMUTATION_FOGINSIDE (1<<5) ///< tint the color by fog color or black if using additive blend mode +#define SHADERPERMUTATION_FOGOUTSIDE (1<<6) ///< tint the color by fog color or black if using additive blend mode +#define SHADERPERMUTATION_FOGHEIGHTTEXTURE (1<<7) ///< fog color and density determined by texture mapped on vertical axis +#define SHADERPERMUTATION_FOGALPHAHACK (1<<8) ///< fog color and density determined by texture mapped on vertical axis +#define SHADERPERMUTATION_GAMMARAMPS (1<<9) ///< gamma (postprocessing only) +#define SHADERPERMUTATION_CUBEFILTER (1<<10) ///< (lightsource) use cubemap light filter +#define SHADERPERMUTATION_GLOW (1<<11) ///< (lightmap) blend in an additive glow texture +#define SHADERPERMUTATION_BLOOM (1<<12) ///< bloom (postprocessing only) +#define SHADERPERMUTATION_SPECULAR (1<<13) ///< (lightsource or deluxemapping) render specular effects +#define SHADERPERMUTATION_POSTPROCESSING (1<<14) ///< user defined postprocessing (postprocessing only) +#define SHADERPERMUTATION_REFLECTION (1<<15) ///< normalmap-perturbed reflection of the scene infront of the surface, preformed as an overlay on the surface +#define SHADERPERMUTATION_OFFSETMAPPING (1<<16) ///< adjust texcoords to roughly simulate a displacement mapped surface +#define SHADERPERMUTATION_OFFSETMAPPING_RELIEFMAPPING (1<<17) ///< adjust texcoords to accurately simulate a displacement mapped surface (requires OFFSETMAPPING to also be set!) +#define SHADERPERMUTATION_SHADOWMAP2D (1<<18) ///< (lightsource) use shadowmap texture as light filter +#define SHADERPERMUTATION_SHADOWMAPVSDCT (1<<19) ///< (lightsource) use virtual shadow depth cube texture for shadowmap indexing +#define SHADERPERMUTATION_SHADOWMAPORTHO (1<<20) ///< (lightsource) use orthographic shadowmap projection +#define SHADERPERMUTATION_DEFERREDLIGHTMAP (1<<21) ///< (lightmap) read Texture_ScreenDiffuse/Specular textures and add them on top of lightmapping +#define SHADERPERMUTATION_ALPHAKILL (1<<22) ///< (deferredgeometry) discard pixel if diffuse texture alpha below 0.5, (generic) apply global alpha +#define SHADERPERMUTATION_REFLECTCUBE (1<<23) ///< fake reflections using global cubemap (not HDRI light probe) +#define SHADERPERMUTATION_NORMALMAPSCROLLBLEND (1<<24) ///< (water) counter-direction normalmaps scrolling +#define SHADERPERMUTATION_BOUNCEGRID (1<<25) ///< (lightmap) use Texture_BounceGrid as an additional source of ambient light +#define SHADERPERMUTATION_BOUNCEGRIDDIRECTIONAL (1<<26) ///< (lightmap) use 16-component pixels in bouncegrid texture for directional lighting rather than standard 4-component +#define SHADERPERMUTATION_TRIPPY (1<<27) ///< use trippy vertex shader effect +#define SHADERPERMUTATION_DEPTHRGB (1<<28) ///< read/write depth values in RGB color coded format for older hardware without depth samplers +#define SHADERPERMUTATION_ALPHAGEN_VERTEX (1<<29) ///< alphaGen vertex +#define SHADERPERMUTATION_SKELETAL (1<<30) ///< (skeletal models) use skeletal matrices to deform vertices (gpu-skinning) +#define SHADERPERMUTATION_OCCLUDE (1<<31) ///< use occlusion buffer for corona +#define SHADERPERMUTATION_COUNT 32 ///< size of shaderpermutationinfo array // 1.0f / N table extern float ixtable[4096]; diff --git a/svvm_cmds.c b/svvm_cmds.c index 12ef69da..4d46fd9d 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -8,228 +8,229 @@ -const char *vm_sv_extensions = -"BX_WAL_SUPPORT " -"DP_BUTTONCHAT " -"DP_BUTTONUSE " -"DP_CL_LOADSKY " -"DP_CON_ALIASPARAMETERS " -"DP_CON_BESTWEAPON " -"DP_CON_EXPANDCVAR " -"DP_CON_SET " -"DP_CON_SETA " -"DP_CON_STARTMAP " -"DP_COVERAGE " -"DP_CRYPTO " -"DP_CSQC_BINDMAPS " -"DP_CSQC_ENTITYWORLDOBJECT " -"DP_CSQC_ENTITYMODELLIGHT " -"DP_CSQC_ENTITYTRANSPARENTSORTING_OFFSET " -"DP_CSQC_MAINVIEW " -"DP_CSQC_MINFPS_QUALITY " -"DP_CSQC_MULTIFRAME_INTERPOLATION " -"DP_CSQC_BOXPARTICLES " -"DP_CSQC_SPAWNPARTICLE " -"DP_CSQC_QUERYRENDERENTITY " -"DP_CSQC_ROTATEMOVES " -"DP_CSQC_SETPAUSE " -"DP_CSQC_V_CALCREFDEF_WIP1 " -"DP_CSQC_V_CALCREFDEF_WIP2 " -"DP_EF_ADDITIVE " -"DP_EF_BLUE " -"DP_EF_DOUBLESIDED " -"DP_EF_DYNAMICMODELLIGHT " -"DP_EF_FLAME " -"DP_EF_FULLBRIGHT " -"DP_EF_NODEPTHTEST " -"DP_EF_NODRAW " -"DP_EF_NOGUNBOB " -"DP_EF_NOSELFSHADOW " -"DP_EF_NOSHADOW " -"DP_EF_RED " -"DP_EF_RESTARTANIM_BIT " -"DP_EF_STARDUST " -"DP_EF_TELEPORT_BIT " -"DP_ENT_ALPHA " -"DP_ENT_COLORMOD " -"DP_ENT_CUSTOMCOLORMAP " -"DP_ENT_EXTERIORMODELTOCLIENT " -"DP_ENT_GLOW " -"DP_ENT_GLOWMOD " -"DP_ENT_LOWPRECISION " -"DP_ENT_SCALE " -"DP_ENT_TRAILEFFECTNUM " -"DP_ENT_VIEWMODEL " -"DP_GFX_EXTERNALTEXTURES " -"DP_GFX_EXTERNALTEXTURES_PERMAP " -"DP_GFX_FOG " -"DP_GFX_MODEL_INTERPOLATION " -"DP_GFX_QUAKE3MODELTAGS " -"DP_GFX_SKINFILES " -"DP_GFX_SKYBOX " -"DP_GFX_FONTS " -"DP_GFX_FONTS_FREETYPE " -"DP_UTF8 " -"DP_FONT_VARIABLEWIDTH " -"DP_HALFLIFE_MAP " -"DP_HALFLIFE_MAP_CVAR " -"DP_HALFLIFE_SPRITE " -"DP_INPUTBUTTONS " -"DP_LIGHTSTYLE_STATICVALUE " -"DP_LITSPRITES " -"DP_LITSUPPORT " -"DP_MONSTERWALK " -"DP_MOVETYPEBOUNCEMISSILE " -"DP_MOVETYPEFLYWORLDONLY " -"DP_MOVETYPEFOLLOW " -"DP_NULL_MODEL " -"DP_QC_ASINACOSATANATAN2TAN " -"DP_QC_AUTOCVARS " -"DP_QC_CHANGEPITCH " -"DP_QC_CMD " -"DP_QC_COPYENTITY " -"DP_QC_CRC16 " -"DP_QC_CVAR_DEFSTRING " -"DP_QC_CVAR_DESCRIPTION " -"DP_QC_CVAR_STRING " -"DP_QC_CVAR_TYPE " -"DP_QC_DIGEST " -"DP_QC_DIGEST_SHA256 " -"DP_QC_EDICT_NUM " -"DP_QC_ENTITYDATA " -"DP_QC_ENTITYSTRING " -"DP_QC_ETOS " -"DP_QC_EXTRESPONSEPACKET " -"DP_QC_FINDCHAIN " -"DP_QC_FINDCHAINFLAGS " -"DP_QC_FINDCHAINFLOAT " -"DP_QC_FINDCHAIN_TOFIELD " -"DP_QC_FINDFLAGS " -"DP_QC_FINDFLOAT " -"DP_QC_FS_SEARCH " -"DP_QC_GETLIGHT " -"DP_QC_GETSURFACE " -"DP_QC_GETSURFACETRIANGLE " -"DP_QC_GETSURFACEPOINTATTRIBUTE " -"DP_QC_GETTAGINFO " -"DP_QC_GETTAGINFO_BONEPROPERTIES " -"DP_QC_GETTIME " -"DP_QC_GETTIME_CDTRACK " -"DP_QC_I18N " -"DP_QC_LOG " -"DP_QC_MINMAXBOUND " -"DP_QC_MULTIPLETEMPSTRINGS " -"DP_QC_NUM_FOR_EDICT " -"DP_QC_RANDOMVEC " -"DP_QC_SINCOSSQRTPOW " -"DP_QC_SPRINTF " -"DP_QC_STRFTIME " -"DP_QC_STRINGBUFFERS " -"DP_QC_STRINGBUFFERS_CVARLIST " -"DP_QC_STRINGBUFFERS_EXT_WIP " -"DP_QC_STRINGCOLORFUNCTIONS " -"DP_QC_STRING_CASE_FUNCTIONS " -"DP_QC_STRREPLACE " -"DP_QC_TOKENIZEBYSEPARATOR " -"DP_QC_TOKENIZE_CONSOLE " -"DP_QC_TRACEBOX " -"DP_QC_TRACETOSS " -"DP_QC_TRACE_MOVETYPE_HITMODEL " -"DP_QC_TRACE_MOVETYPE_WORLDONLY " -"DP_QC_UNLIMITEDTEMPSTRINGS " -"DP_QC_URI_ESCAPE " -"DP_QC_URI_GET " -"DP_QC_URI_POST " -"DP_QC_VECTOANGLES_WITH_ROLL " -"DP_QC_VECTORVECTORS " -"DP_QC_WHICHPACK " -"DP_QUAKE2_MODEL " -"DP_QUAKE2_SPRITE " -"DP_QUAKE3_MAP " -"DP_QUAKE3_MODEL " -"DP_REGISTERCVAR " -"DP_SKELETONOBJECTS " -"DP_SND_DIRECTIONLESSATTNNONE " -"DP_SND_FAKETRACKS " -"DP_SND_SOUND7_WIP1 " -"DP_SND_SOUND7_WIP2 " -"DP_SND_OGGVORBIS " -"DP_SND_SETPARAMS " -"DP_SND_STEREOWAV " -"DP_SND_GETSOUNDTIME " -"DP_VIDEO_DPV " -"DP_VIDEO_SUBTITLES " -"DP_SOLIDCORPSE " -"DP_SPRITE32 " -"DP_SV_BOTCLIENT " -"DP_SV_BOUNCEFACTOR " -"DP_SV_CLIENTCAMERA " -"DP_SV_CLIENTCOLORS " -"DP_SV_CLIENTNAME " -"DP_SV_CMD " -"DP_SV_CUSTOMIZEENTITYFORCLIENT " -"DP_SV_DISABLECLIENTPREDICTION " -"DP_SV_DISCARDABLEDEMO " -"DP_SV_DRAWONLYTOCLIENT " -"DP_SV_DROPCLIENT " -"DP_SV_EFFECT " -"DP_SV_ENTITYCONTENTSTRANSITION " -"DP_SV_MODELFLAGS_AS_EFFECTS " -"DP_SV_MOVETYPESTEP_LANDEVENT " -"DP_SV_NETADDRESS " -"DP_SV_NODRAWTOCLIENT " -"DP_SV_ONENTITYNOSPAWNFUNCTION " -"DP_SV_ONENTITYPREPOSTSPAWNFUNCTION " -"DP_SV_PING " -"DP_SV_PING_PACKETLOSS " -"DP_SV_PLAYERPHYSICS " -"DP_PHYSICS_ODE " -"DP_SV_POINTPARTICLES " -"DP_SV_POINTSOUND " -"DP_SV_PRECACHEANYTIME " -"DP_SV_PRINT " -"DP_SV_PUNCHVECTOR " -"DP_SV_QCSTATUS " -"DP_SV_ROTATINGBMODEL " -"DP_SV_SETCOLOR " -"DP_SV_SHUTDOWN " -"DP_SV_SLOWMO " -"DP_SV_SPAWNFUNC_PREFIX " -"DP_SV_WRITEPICTURE " -"DP_SV_WRITEUNTERMINATEDSTRING " -"DP_TE_BLOOD " -"DP_TE_BLOODSHOWER " -"DP_TE_CUSTOMFLASH " -"DP_TE_EXPLOSIONRGB " -"DP_TE_FLAMEJET " -"DP_TE_PARTICLECUBE " -"DP_TE_PARTICLERAIN " -"DP_TE_PARTICLESNOW " -"DP_TE_PLASMABURN " -"DP_TE_QUADEFFECTS1 " -"DP_TE_SMALLFLASH " -"DP_TE_SPARK " -"DP_TE_STANDARDEFFECTBUILTINS " -"DP_TRACE_HITCONTENTSMASK_SURFACEINFO " -"DP_USERMOVETYPES " -"DP_VIEWZOOM " -"EXT_BITSHIFT " -"FRIK_FILE " -"FTE_CSQC_SKELETONOBJECTS " -"FTE_QC_CHECKPVS " -"FTE_STRINGS " -"KRIMZON_SV_PARSECLIENTCOMMAND " -"NEH_CMD_PLAY2 " -"NEH_RESTOREGAME " -"NEXUIZ_PLAYERMODEL " -"NXQ_GFX_LETTERBOX " -"PRYDON_CLIENTCURSOR " -"TENEBRAE_GFX_DLIGHTS " -"TW_SV_STEPCONTROL " -"ZQ_PAUSE " -"DP_RM_CLIPGROUP " -//"EXT_CSQC " // not ready yet -; +const char *vm_sv_extensions[] = { +"BX_WAL_SUPPORT", +"DP_BUTTONCHAT", +"DP_BUTTONUSE", +"DP_CL_LOADSKY", +"DP_CON_ALIASPARAMETERS", +"DP_CON_BESTWEAPON", +"DP_CON_EXPANDCVAR", +"DP_CON_SET", +"DP_CON_SETA", +"DP_CON_STARTMAP", +"DP_COVERAGE", +"DP_CRYPTO", +"DP_CSQC_BINDMAPS", +"DP_CSQC_ENTITYWORLDOBJECT", +"DP_CSQC_ENTITYMODELLIGHT", +"DP_CSQC_ENTITYTRANSPARENTSORTING_OFFSET", +"DP_CSQC_MAINVIEW", +"DP_CSQC_MINFPS_QUALITY", +"DP_CSQC_MULTIFRAME_INTERPOLATION", +"DP_CSQC_BOXPARTICLES", +"DP_CSQC_SPAWNPARTICLE", +"DP_CSQC_QUERYRENDERENTITY", +"DP_CSQC_ROTATEMOVES", +"DP_CSQC_SETPAUSE", +"DP_CSQC_V_CALCREFDEF_WIP1", +"DP_CSQC_V_CALCREFDEF_WIP2", +"DP_EF_ADDITIVE", +"DP_EF_BLUE", +"DP_EF_DOUBLESIDED", +"DP_EF_DYNAMICMODELLIGHT", +"DP_EF_FLAME", +"DP_EF_FULLBRIGHT", +"DP_EF_NODEPTHTEST", +"DP_EF_NODRAW", +"DP_EF_NOGUNBOB", +"DP_EF_NOSELFSHADOW", +"DP_EF_NOSHADOW", +"DP_EF_RED", +"DP_EF_RESTARTANIM_BIT", +"DP_EF_STARDUST", +"DP_EF_TELEPORT_BIT", +"DP_ENT_ALPHA", +"DP_ENT_COLORMOD", +"DP_ENT_CUSTOMCOLORMAP", +"DP_ENT_EXTERIORMODELTOCLIENT", +"DP_ENT_GLOW", +"DP_ENT_GLOWMOD", +"DP_ENT_LOWPRECISION", +"DP_ENT_SCALE", +"DP_ENT_TRAILEFFECTNUM", +"DP_ENT_VIEWMODEL", +"DP_GFX_EXTERNALTEXTURES", +"DP_GFX_EXTERNALTEXTURES_PERMAP", +"DP_GFX_FOG", +"DP_GFX_MODEL_INTERPOLATION", +"DP_GFX_QUAKE3MODELTAGS", +"DP_GFX_SKINFILES", +"DP_GFX_SKYBOX", +"DP_GFX_FONTS", +"DP_GFX_FONTS_FREETYPE", +"DP_UTF8", +"DP_FONT_VARIABLEWIDTH", +"DP_HALFLIFE_MAP", +"DP_HALFLIFE_MAP_CVAR", +"DP_HALFLIFE_SPRITE", +"DP_INPUTBUTTONS", +"DP_LIGHTSTYLE_STATICVALUE", +"DP_LITSPRITES", +"DP_LITSUPPORT", +"DP_MONSTERWALK", +"DP_MOVETYPEBOUNCEMISSILE", +"DP_MOVETYPEFLYWORLDONLY", +"DP_MOVETYPEFOLLOW", +"DP_NULL_MODEL", +"DP_QC_ASINACOSATANATAN2TAN", +"DP_QC_AUTOCVARS", +"DP_QC_CHANGEPITCH", +"DP_QC_CMD", +"DP_QC_COPYENTITY", +"DP_QC_CRC16", +"DP_QC_CVAR_DEFSTRING", +"DP_QC_CVAR_DESCRIPTION", +"DP_QC_CVAR_STRING", +"DP_QC_CVAR_TYPE", +"DP_QC_DIGEST", +"DP_QC_DIGEST_SHA256", +"DP_QC_EDICT_NUM", +"DP_QC_ENTITYDATA", +"DP_QC_ENTITYSTRING", +"DP_QC_ETOS", +"DP_QC_EXTRESPONSEPACKET", +"DP_QC_FINDCHAIN", +"DP_QC_FINDCHAINFLAGS", +"DP_QC_FINDCHAINFLOAT", +"DP_QC_FINDCHAIN_TOFIELD", +"DP_QC_FINDFLAGS", +"DP_QC_FINDFLOAT", +"DP_QC_FS_SEARCH", +"DP_QC_GETLIGHT", +"DP_QC_GETSURFACE", +"DP_QC_GETSURFACETRIANGLE", +"DP_QC_GETSURFACEPOINTATTRIBUTE", +"DP_QC_GETTAGINFO", +"DP_QC_GETTAGINFO_BONEPROPERTIES", +"DP_QC_GETTIME", +"DP_QC_GETTIME_CDTRACK", +"DP_QC_I18N", +"DP_QC_LOG", +"DP_QC_MINMAXBOUND", +"DP_QC_MULTIPLETEMPSTRINGS", +"DP_QC_NUM_FOR_EDICT", +"DP_QC_RANDOMVEC", +"DP_QC_SINCOSSQRTPOW", +"DP_QC_SPRINTF", +"DP_QC_STRFTIME", +"DP_QC_STRINGBUFFERS", +"DP_QC_STRINGBUFFERS_CVARLIST", +"DP_QC_STRINGBUFFERS_EXT_WIP", +"DP_QC_STRINGCOLORFUNCTIONS", +"DP_QC_STRING_CASE_FUNCTIONS", +"DP_QC_STRREPLACE", +"DP_QC_TOKENIZEBYSEPARATOR", +"DP_QC_TOKENIZE_CONSOLE", +"DP_QC_TRACEBOX", +"DP_QC_TRACETOSS", +"DP_QC_TRACE_MOVETYPE_HITMODEL", +"DP_QC_TRACE_MOVETYPE_WORLDONLY", +"DP_QC_UNLIMITEDTEMPSTRINGS", +"DP_QC_URI_ESCAPE", +"DP_QC_URI_GET", +"DP_QC_URI_POST", +"DP_QC_VECTOANGLES_WITH_ROLL", +"DP_QC_VECTORVECTORS", +"DP_QC_WHICHPACK", +"DP_QUAKE2_MODEL", +"DP_QUAKE2_SPRITE", +"DP_QUAKE3_MAP", +"DP_QUAKE3_MODEL", +"DP_REGISTERCVAR", +"DP_SKELETONOBJECTS", +"DP_SND_DIRECTIONLESSATTNNONE", +"DP_SND_FAKETRACKS", +"DP_SND_SOUND7_WIP1", +"DP_SND_SOUND7_WIP2", +"DP_SND_OGGVORBIS", +"DP_SND_SETPARAMS", +"DP_SND_STEREOWAV", +"DP_SND_GETSOUNDTIME", +"DP_VIDEO_DPV", +"DP_VIDEO_SUBTITLES", +"DP_SOLIDCORPSE", +"DP_SPRITE32", +"DP_SV_BOTCLIENT", +"DP_SV_BOUNCEFACTOR", +"DP_SV_CLIENTCAMERA", +"DP_SV_CLIENTCOLORS", +"DP_SV_CLIENTNAME", +"DP_SV_CMD", +"DP_SV_CUSTOMIZEENTITYFORCLIENT", +"DP_SV_DISABLECLIENTPREDICTION", +"DP_SV_DISCARDABLEDEMO", +"DP_SV_DRAWONLYTOCLIENT", +"DP_SV_DROPCLIENT", +"DP_SV_EFFECT", +"DP_SV_ENTITYCONTENTSTRANSITION", +"DP_SV_MODELFLAGS_AS_EFFECTS", +"DP_SV_MOVETYPESTEP_LANDEVENT", +"DP_SV_NETADDRESS", +"DP_SV_NODRAWTOCLIENT", +"DP_SV_ONENTITYNOSPAWNFUNCTION", +"DP_SV_ONENTITYPREPOSTSPAWNFUNCTION", +"DP_SV_PING", +"DP_SV_PING_PACKETLOSS", +"DP_SV_PLAYERPHYSICS", +"DP_PHYSICS_ODE", +"DP_SV_POINTPARTICLES", +"DP_SV_POINTSOUND", +"DP_SV_PRECACHEANYTIME", +"DP_SV_PRINT", +"DP_SV_PUNCHVECTOR", +"DP_SV_QCSTATUS", +"DP_SV_ROTATINGBMODEL", +"DP_SV_SETCOLOR", +"DP_SV_SHUTDOWN", +"DP_SV_SLOWMO", +"DP_SV_SPAWNFUNC_PREFIX", +"DP_SV_WRITEPICTURE", +"DP_SV_WRITEUNTERMINATEDSTRING", +"DP_TE_BLOOD", +"DP_TE_BLOODSHOWER", +"DP_TE_CUSTOMFLASH", +"DP_TE_EXPLOSIONRGB", +"DP_TE_FLAMEJET", +"DP_TE_PARTICLECUBE", +"DP_TE_PARTICLERAIN", +"DP_TE_PARTICLESNOW", +"DP_TE_PLASMABURN", +"DP_TE_QUADEFFECTS1", +"DP_TE_SMALLFLASH", +"DP_TE_SPARK", +"DP_TE_STANDARDEFFECTBUILTINS", +"DP_TRACE_HITCONTENTSMASK_SURFACEINFO" +"DP_USERMOVETYPES", +"DP_VIEWZOOM", +"EXT_BITSHIFT", +"FRIK_FILE", +"FTE_CSQC_SKELETONOBJECTS", +"FTE_QC_CHECKPVS", +"FTE_STRINGS", +"KRIMZON_SV_PARSECLIENTCOMMAND", +"NEH_CMD_PLAY2", +"NEH_RESTOREGAME", +"NEXUIZ_PLAYERMODEL", +"NXQ_GFX_LETTERBOX", +"PRYDON_CLIENTCURSOR", +"TENEBRAE_GFX_DLIGHTS", +"TW_SV_STEPCONTROL", +"ZQ_PAUSE", +"DP_RM_CLIPGROUP", +NULL +//"EXT_CSQC" // not ready yet +}; /* ================= diff --git a/sys_linux.c b/sys_linux.c index 127f2bf3..24ea6482 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -5,9 +5,9 @@ #include #include "conio.h" #else +#include #include #include -#include #endif #include @@ -21,9 +21,7 @@ sys_t sys; // ======================================================================= void Sys_Shutdown (void) { -#ifdef FNDELAY - fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY); -#endif + fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NDELAY); fflush(stdout); } @@ -33,9 +31,7 @@ void Sys_Error (const char *error, ...) char string[MAX_INPUTLINE]; // change stdin to non blocking -#ifdef FNDELAY - fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY); -#endif + fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NDELAY); va_start (argptr,error); dpvsnprintf (string, sizeof (string), error, argptr); @@ -51,13 +47,11 @@ void Sys_PrintToTerminal(const char *text) { if(sys.outfd < 0) return; -#ifdef FNDELAY // BUG: for some reason, NDELAY also affects stdout (1) when used on stdin (0). // this is because both go to /dev/tty by default! { int origflags = fcntl (sys.outfd, F_GETFL, 0); - fcntl (sys.outfd, F_SETFL, origflags & ~FNDELAY); -#endif + fcntl (sys.outfd, F_SETFL, origflags & ~O_NDELAY); #ifdef WIN32 #define write _write #endif @@ -68,10 +62,8 @@ void Sys_PrintToTerminal(const char *text) break; // sorry, I cannot do anything about this error - without an output text += written; } -#ifdef FNDELAY fcntl (sys.outfd, F_SETFL, origflags); } -#endif //fprintf(stdout, "%s", text); } @@ -164,9 +156,7 @@ int main (int argc, char **argv) else sys.outfd = 1; -#ifdef FNDELAY - fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY); -#endif + fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NDELAY); Host_Main(); diff --git a/sys_sdl.c b/sys_sdl.c index 06d72ae9..9285f55d 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -10,10 +10,6 @@ #ifdef __ANDROID__ #include - -#ifndef FNDELAY -#define FNDELAY O_NDELAY -#endif #endif #include @@ -41,7 +37,7 @@ void Sys_Shutdown (void) Sys_AllowProfiling(false); #endif #ifndef WIN32 - fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY); + fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NDELAY); #endif fflush(stdout); SDL_Quit(); @@ -55,7 +51,7 @@ void Sys_Error (const char *error, ...) // change stdin to non blocking #ifndef WIN32 - fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY); + fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NDELAY); #endif va_start (argptr,error); @@ -81,12 +77,12 @@ void Sys_PrintToTerminal(const char *text) #else if(sys.outfd < 0) return; -#ifdef FNDELAY +#ifdef O_NDELAY // BUG: for some reason, NDELAY also affects stdout (1) when used on stdin (0). // this is because both go to /dev/tty by default! { int origflags = fcntl (sys.outfd, F_GETFL, 0); - fcntl (sys.outfd, F_SETFL, origflags & ~FNDELAY); + fcntl (sys.outfd, F_SETFL, origflags & ~O_NDELAY); #endif #ifdef WIN32 #define write _write @@ -98,7 +94,7 @@ void Sys_PrintToTerminal(const char *text) break; // sorry, I cannot do anything about this error - without an output text += written; } -#ifdef FNDELAY +#ifdef O_NDELAY fcntl (sys.outfd, F_SETFL, origflags); } #endif @@ -218,7 +214,7 @@ int main (int argc, char *argv[]) sys.outfd = 1; #ifndef WIN32 - fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY); + fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NDELAY); #endif // we don't know which systems we'll want to init, yet... diff --git a/vid_sdl.c b/vid_sdl.c index b88e6ecb..b2c007bc 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -1606,10 +1606,15 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) Cvar_SetQuick(&gl_info_driver, gl_driver); // LadyHavoc: report supported extensions + Con_DPrintf("\nQuakeC extensions for server and client:"); + for (i = 0; vm_sv_extensions[i]; i++) + Con_DPrintf(" %s", vm_sv_extensions[i]); + Con_DPrintf("\n"); #ifdef CONFIG_MENU - Con_DPrintf("\nQuakeC extensions for server and client: %s\nQuakeC extensions for menu: %s\n", vm_sv_extensions, vm_m_extensions); -#else - Con_DPrintf("\nQuakeC extensions for server and client: %s\n", vm_sv_extensions); + Con_DPrintf("\nQuakeC extensions for menu:"); + for (i = 0; vm_m_extensions[i]; i++) + Con_DPrintf(" %s", vm_m_extensions[i]); + Con_DPrintf("\n"); #endif // clear to black (loading plaque will be seen over this) diff --git a/zone.c b/zone.c index 5a0c8987..69d053d8 100644 --- a/zone.c +++ b/zone.c @@ -758,9 +758,9 @@ void Mem_ExpandableArray_FreeRecord(memexpandablearray_t *l, void *record) // co { j = (p - l->arrays[i].data) / l->recordsize; if (p != l->arrays[i].data + j * l->recordsize) - Sys_Error("Mem_ExpandableArray_FreeRecord: no such record %p\n", p); + Sys_Error("Mem_ExpandableArray_FreeRecord: no such record %p\n", (void *)p); if (!l->arrays[i].allocflags[j]) - Sys_Error("Mem_ExpandableArray_FreeRecord: record %p is already free!\n", p); + Sys_Error("Mem_ExpandableArray_FreeRecord: record %p is already free!\n", (void *)p); l->arrays[i].allocflags[j] = false; l->arrays[i].numflaggedrecords--; return; -- 2.39.2