diff --git a/configure.ac b/configure.ac index f944a520d..7b1302f12 100644 --- a/configure.ac +++ b/configure.ac @@ -1389,7 +1389,7 @@ AC_ARG_ENABLE(Werror, dnl We want warnings, lots of warnings... if test "x$GCC" = "xyes"; then if test "x$enable_Werror" $cvs_def_enabled; then - CFLAGS="$CFLAGS -Wall -Werror" + CFLAGS="$CFLAGS -Wall -Werror -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" else CFLAGS="$CFLAGS -Wall" fi diff --git a/include/QF/GL/qf_rmain.h b/include/QF/GL/qf_rmain.h index 40190ed75..b0d2d1c03 100644 --- a/include/QF/GL/qf_rmain.h +++ b/include/QF/GL/qf_rmain.h @@ -41,6 +41,5 @@ extern vec3_t lightspot; void R_RotateForEntity (struct entity_s *e); void glrmain_init (void); -int R_InitGraphTextures (int base); #endif // __QF_GL_rmain_h diff --git a/include/QF/console.h b/include/QF/console.h index 18781084e..f0e1cf930 100644 --- a/include/QF/console.h +++ b/include/QF/console.h @@ -129,6 +129,10 @@ void Con_Skyboxlist_f (void); void Con_Demolist_QWD_f (void); void Con_Demolist_DEM_f (void); +//FIXME need a better way to communicate this (bah, need a better menu system +// in general :P) +void C_DrawInputLine (inputline_t *il); + void Menu_Init (void); void Menu_Load (void); void Menu_Draw (void); diff --git a/include/QF/csqc.h b/include/QF/csqc.h index 1f9352ec8..381e47af3 100644 --- a/include/QF/csqc.h +++ b/include/QF/csqc.h @@ -32,7 +32,7 @@ #ifndef __QF_csqc_h #define __QF_csqc_h -void BI_Init (); +void BI_Init (void); struct progs_s; struct cbuf_s; diff --git a/include/QF/gib_process.h b/include/QF/gib_process.h index 9eab68c8b..0beea9708 100644 --- a/include/QF/gib_process.h +++ b/include/QF/gib_process.h @@ -29,6 +29,5 @@ $Id$ */ -void GIB_Process_Variable (struct dstring_s *token); int GIB_Process_Math (struct dstring_s *token); int GIB_Process_Token (struct dstring_s *token, char delim); diff --git a/include/QF/in_event.h b/include/QF/in_event.h index a6d013029..2608e7c0c 100644 --- a/include/QF/in_event.h +++ b/include/QF/in_event.h @@ -90,9 +90,9 @@ void IE_Multiplier_Event (ie_event_t *event, float value); void IE_CallHandler (ie_handler handler, ie_event_t *event, float value); -ie_translation_table_t *IE_Translation_Table_Create (); +ie_translation_table_t *IE_Translation_Table_Create (void); void IE_Translation_Table_Modify (ie_translation_table_t *table, int offset, ie_event_t *event); -ie_translation_index_t *IE_Translation_Index_Create (); +ie_translation_index_t *IE_Translation_Index_Create (void); /* typedef struct { diff --git a/include/QF/locs.h b/include/QF/locs.h index 03b0fac9c..be0c85a0b 100644 --- a/include/QF/locs.h +++ b/include/QF/locs.h @@ -44,7 +44,7 @@ void locs_edit (const vec3_t loc, const char *desc); void locs_load(const char *filename); void locs_mark (const vec3_t loc, const char *desc); int locs_nearest (const vec3_t loc); -void locs_reset (); +void locs_reset (void); void locs_save (const char *filename, qboolean gz); void map_to_loc (const char *mapname, char *filename); diff --git a/include/QF/mathlib.h b/include/QF/mathlib.h index a4edcd384..6cdb90ed7 100644 --- a/include/QF/mathlib.h +++ b/include/QF/mathlib.h @@ -88,7 +88,7 @@ vec_t _DotProduct (const vec3_t v1, const vec3_t v2); void _VectorAdd (const vec3_t veca, const vec3_t vecb, vec3_t out); void _VectorCopy (const vec3_t in, vec3_t out); int _VectorCompare (const vec3_t v1, const vec3_t v2); // uses EQUAL_EPSILON -//vec_t _VectorLength (vec3_t v); +vec_t _VectorLength (const vec3_t v); void _VectorMA (const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc); void _VectorScale (const vec3_t in, vec_t scale, vec3_t out); @@ -138,7 +138,8 @@ void RotatePointAroundVector (vec3_t dst, const vec3_t axis, extern mplane_t frustum[4]; - +extern inline qboolean R_CullBox (const vec3_t mins, const vec3_t maxs); +extern inline qboolean R_CullSphere (const vec3_t origin, const float radius); #ifndef IMPLEMENT_R_Cull extern inline #endif diff --git a/include/QF/plugin.h b/include/QF/plugin.h index fa435db60..b4215ff08 100644 --- a/include/QF/plugin.h +++ b/include/QF/plugin.h @@ -85,10 +85,10 @@ typedef struct plugin_data_s { typedef struct plugin_s { plugin_type_t type; void *handle; - char *api_version; - char *plugin_version; - char *description; - char *copyright; + const char *api_version; + const char *plugin_version; + const char *description; + const char *copyright; plugin_funcs_t *functions; plugin_data_t *data; } plugin_t; diff --git a/include/QF/progs.h b/include/QF/progs.h index 5f0620a99..313d5e8e8 100644 --- a/include/QF/progs.h +++ b/include/QF/progs.h @@ -257,6 +257,7 @@ extern const char *pr_gametype; // PR Cmds stuff // +const char *PF_VarString (progs_t *pr, int first); void PR_Cmds_Init (progs_t *pr); //============================================================================ diff --git a/include/QF/qargs.h b/include/QF/qargs.h index 8c42863a8..8579fc2bd 100644 --- a/include/QF/qargs.h +++ b/include/QF/qargs.h @@ -34,8 +34,8 @@ #include "QF/qtypes.h" extern int com_argc; -extern char **com_argv; -extern char *com_cmdline; +extern const char **com_argv; +extern const char *com_cmdline; int COM_CheckParm (const char *parm); void COM_AddParm (const char *parm); diff --git a/include/QF/qfplist.h b/include/QF/qfplist.h index 617191a91..b644e149e 100644 --- a/include/QF/qfplist.h +++ b/include/QF/qfplist.h @@ -89,7 +89,7 @@ typedef struct pldata_s { // Unparsed property list string unsigned int end; unsigned int pos; unsigned int line; - char *error; + const char *error; } pldata_t; /* diff --git a/include/QF/quakefs.h b/include/QF/quakefs.h index 6e8c68de4..cacf99df5 100644 --- a/include/QF/quakefs.h +++ b/include/QF/quakefs.h @@ -66,7 +66,7 @@ int _COM_FOpenFile (const char *filename, QFile **gzfile, char *foundname, int z int COM_FOpenFile (const char *filename, QFile **gzfile); void COM_CloseFile (QFile *h); void COM_FileBase (const char *in, char *out); -void COM_DefaultExtension (char *path, char *extension); +void COM_DefaultExtension (char *path, const char *extension); const char *COM_SkipPath (const char *pathname); void COM_StripExtension (const char *in, char *out); int COM_NextFilename (char *filename, const char *prefix, const char *ext); diff --git a/include/QF/render.h b/include/QF/render.h index 7d1b4e0d8..6292c4112 100644 --- a/include/QF/render.h +++ b/include/QF/render.h @@ -192,6 +192,7 @@ dlight_t *R_AllocDlight (int key); void R_DecayLights (double frametime); void R_ClearDlights (void); +int R_InitGraphTextures (int base); void R_LineGraph (int x, int y, int *h_vals, int count); struct progs_s; void R_Progs_Init (struct progs_s *pr); diff --git a/include/QF/teamplay.h b/include/QF/teamplay.h index 688ead38d..346cb7052 100644 --- a/include/QF/teamplay.h +++ b/include/QF/teamplay.h @@ -33,9 +33,9 @@ extern struct cvar_s *cl_parsesay; extern struct cvar_s *cl_nofake; extern struct cvar_s *cl_freply; -typedef char * (*ffunc_t) (char *args); +typedef const char *(*ffunc_t) (char *args); typedef struct freply_s { - char *name; + const char *name; ffunc_t func; float lasttime; } freply_t; diff --git a/include/d_iface.h b/include/d_iface.h index d592a5d49..b7925e264 100644 --- a/include/d_iface.h +++ b/include/d_iface.h @@ -180,6 +180,7 @@ void D_DisableBackBufferAccess (void); void D_EndDirectRect (int x, int y, int width, int height); void D_PolysetDraw (void); void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts); +void D_PolysetSetEdgeTable (void); void D_DrawParticle (particle_t *pparticle); void D_DrawPoly (void); void D_DrawSprite (void); diff --git a/include/exp.h b/include/exp.h index 1eac2d26d..7bf4940c1 100644 --- a/include/exp.h +++ b/include/exp.h @@ -31,14 +31,14 @@ typedef double (*funcfunc) (double *oplist, unsigned int numops); typedef struct optable_s { - char *str; + const char *str; opfunc func; unsigned int operands; } optable_t; typedef struct functable_s { - char *str; + const char *str; funcfunc func; // Heh unsigned int operands; } functable_t; diff --git a/include/getopt.h b/include/getopt.h index cfcc92c0f..441d87dd4 100644 --- a/include/getopt.h +++ b/include/getopt.h @@ -127,14 +127,7 @@ struct option `getopt'. */ #if defined __STDC__ && __STDC__ -# ifdef __GNU_LIBRARY__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ extern int getopt (int argc, char *const *argv, const char *__shortopts); -# else /* not __GNU_LIBRARY__ */ -extern int getopt (); -# endif /* __GNU_LIBRARY__ */ # ifndef __need_getopt extern int getopt_long (int argc, char *const *argv, const char *__shortopts, diff --git a/include/regex.h b/include/regex.h index 408dd2103..8a38499ab 100644 --- a/include/regex.h +++ b/include/regex.h @@ -466,7 +466,7 @@ extern void re_set_registers unsigned num_regs, regoff_t *starts, regoff_t *ends)); /* 4.2 bsd compatibility. */ -extern char *re_comp _RE_ARGS ((const char *)); +extern const char *re_comp _RE_ARGS ((const char *)); extern int re_exec _RE_ARGS ((const char *)); /* POSIX compatibility. */ diff --git a/libs/audio/cd.c b/libs/audio/cd.c index 9a81c5fbd..fe913f8d9 100644 --- a/libs/audio/cd.c +++ b/libs/audio/cd.c @@ -83,7 +83,7 @@ CDAudio_Update (void) cdmodule->functions->cd->pCDAudio_Update (); } -void +static void CD_f (void) { if (cdmodule) diff --git a/libs/audio/cd/cd_linux.c b/libs/audio/cd/cd_linux.c index e9d5008b9..cf332462c 100644 --- a/libs/audio/cd/cd_linux.c +++ b/libs/audio/cd/cd_linux.c @@ -451,6 +451,7 @@ I_CDAudio_Init (void) Mus_CDChange, "device to use for CD music"); } +QFPLUGIN plugin_t *PLUGIN_INFO(cd, linux) (void); QFPLUGIN plugin_t * PLUGIN_INFO(cd, linux) (void) { diff --git a/libs/audio/cd/cd_null.c b/libs/audio/cd/cd_null.c index 1fec477a8..551475f9f 100644 --- a/libs/audio/cd/cd_null.c +++ b/libs/audio/cd/cd_null.c @@ -78,6 +78,7 @@ I_CD_f (void) { } +QFPLUGIN plugin_t *PLUGIN_INFO(cd, null) (void); QFPLUGIN plugin_t * PLUGIN_INFO(cd, null) (void) { diff --git a/libs/audio/cd/cd_sdl.c b/libs/audio/cd/cd_sdl.c index 29bb6ea3a..19238e853 100644 --- a/libs/audio/cd/cd_sdl.c +++ b/libs/audio/cd/cd_sdl.c @@ -277,6 +277,7 @@ I_CDAudio_Init (void) Sys_Printf ("CD Audio Initialized.\n"); } +QFPLUGIN plugin_t *PLUGIN_INFO(cd, sdl) (void); QFPLUGIN plugin_t * PLUGIN_INFO(cd, sdl) (void) { diff --git a/libs/audio/cd/cd_sgi.c b/libs/audio/cd/cd_sgi.c index 82b5de976..c1427276b 100644 --- a/libs/audio/cd/cd_sgi.c +++ b/libs/audio/cd/cd_sgi.c @@ -360,7 +360,8 @@ I_SGI_Init (void) return ; } -QFPLUGIN plugin_t * +QFPLUGIN plugin_t *PLUGIN_INFO(cd, sgi) (void); +QFPLUGIN plugin_t * PLUGIN_INFO(cd, sgi) (void) { plugin_info.type = qfp_cd; diff --git a/libs/audio/cd/cd_win.c b/libs/audio/cd/cd_win.c index 2ef5d0079..3f1dbdee4 100644 --- a/libs/audio/cd/cd_win.c +++ b/libs/audio/cd/cd_win.c @@ -496,6 +496,7 @@ I_CDAudio_Init (void) } } +QFPLUGIN plugin_t *PLUGIN_INFO(cd, win) (void); QFPLUGIN plugin_t * PLUGIN_INFO(cd, win) (void) { diff --git a/libs/audio/cd/cd_xmms.c b/libs/audio/cd/cd_xmms.c index abfc6c8d5..420588a9f 100644 --- a/libs/audio/cd/cd_xmms.c +++ b/libs/audio/cd/cd_xmms.c @@ -533,7 +533,8 @@ I_XMMS_f (void) return; } -QFPLUGIN plugin_t * +QFPLUGIN plugin_t *PLUGIN_INFO(cd, xmms) (void); +QFPLUGIN plugin_t * PLUGIN_INFO(cd, xmms) (void) { plugin_info.type = qfp_cd; diff --git a/libs/audio/renderer/snd_dma.c b/libs/audio/renderer/snd_dma.c index 124d8b9de..4c2a17122 100644 --- a/libs/audio/renderer/snd_dma.c +++ b/libs/audio/renderer/snd_dma.c @@ -114,7 +114,7 @@ SND_AmbientOn (void) snd_ambient = true; } -void +static void SND_SoundInfo_f (void) { if (!sound_started || !shm) { @@ -132,7 +132,7 @@ SND_SoundInfo_f (void) Sys_Printf ("%5d total_channels\n", total_channels); } -void +static void SND_Startup (void) { int rc; @@ -154,7 +154,7 @@ SND_Startup (void) } // Load a sound =============================================================== -sfx_t * +static sfx_t * SND_FindName (const char *name) { int i; @@ -406,7 +406,7 @@ SND_StopAllSounds (qboolean clear) SND_ClearBuffer (); } -void +static void SND_StopAllSoundsC (void) { SND_StopAllSounds (true); @@ -484,7 +484,7 @@ SND_StaticSound (sfx_t *sfx, const vec3_t origin, float vol, //============================================================================= -void +static void SND_UpdateAmbientSounds (void) { float vol; @@ -534,7 +534,7 @@ SND_UpdateAmbientSounds (void) } } -void +static void SND_GetSoundtime (void) { int fullsamples, samplepos; @@ -561,7 +561,7 @@ SND_GetSoundtime (void) soundtime = buffers * fullsamples + samplepos / shm->channels; } -void +static void SND_Update_ (void) { int samps; @@ -689,7 +689,7 @@ SND_ExtraUpdate (void) /* console functions */ -void +static void SND_Play (void) { char name[256]; @@ -715,7 +715,7 @@ SND_Play (void) } } -void +static void SND_PlayVol (void) { char name[256]; @@ -743,7 +743,7 @@ SND_PlayVol (void) } } -void +static void SND_SoundList (void) { int load, size, total, i; @@ -828,7 +828,7 @@ SND_UnblockSound (void) S_O_UnblockSound (); } -void +static void SND_Init_Cvars (void) { ambient_fade = Cvar_Get ("ambient_fade", "100", CVAR_NONE, NULL, @@ -952,6 +952,7 @@ SND_Shutdown (void) shm = 0; } +QFPLUGIN plugin_t *PLUGIN_INFO(snd_render, default) (void); QFPLUGIN plugin_t * PLUGIN_INFO(snd_render, default) (void) { diff --git a/libs/audio/renderer/snd_mem.c b/libs/audio/renderer/snd_mem.c index 1430041c5..e546f5a19 100644 --- a/libs/audio/renderer/snd_mem.c +++ b/libs/audio/renderer/snd_mem.c @@ -177,7 +177,7 @@ SND_ResampleSfx (sfxcache_t *sc, byte * data) sc->data[sc->bytes + 2], sc->data[sc->bytes + 3]); } -sfxcache_t * +static sfxcache_t * SND_LoadSound (sfx_t *sfx, cache_allocator_t allocator) { char namebuffer[256]; @@ -250,7 +250,7 @@ byte *last_chunk; byte *iff_data; int iff_chunk_len; -short +static short SND_GetLittleShort (void) { short val = 0; @@ -261,7 +261,7 @@ SND_GetLittleShort (void) return val; } -int +static int SND_GetLittleLong (void) { int val = 0; @@ -274,8 +274,8 @@ SND_GetLittleLong (void) return val; } -void -SND_FindNexctChunk (char *name) +static void +SND_FindNexctChunk (const char *name) { while (1) { data_p = last_chunk; @@ -299,14 +299,14 @@ SND_FindNexctChunk (char *name) } } -void -SND_FindChunk (char *name) +static void +SND_FindChunk (const char *name) { last_chunk = iff_data; SND_FindNexctChunk (name); } - -void +/* +static void SND_DumpChunks (void) { char str[5]; @@ -322,7 +322,7 @@ SND_DumpChunks (void) data_p += (iff_chunk_len + 1) & ~1; } while (data_p < iff_end); } - +*/ wavinfo_t SND_GetWavinfo (const char *name, byte * wav, int wavlength) { diff --git a/libs/audio/renderer/snd_mix.c b/libs/audio/renderer/snd_mix.c index 0ab51ca73..2dd68e00e 100644 --- a/libs/audio/renderer/snd_mix.c +++ b/libs/audio/renderer/snd_mix.c @@ -79,7 +79,7 @@ SND_WriteLinearBlastStereo16 (void) } #endif -void +static void SND_TransferStereo16 (int endtime) { int lpaintedtime, lpos; @@ -133,7 +133,7 @@ SND_TransferStereo16 (int endtime) #endif } -void +static void SND_TransferPaintBuffer (int endtime) { int count, out_idx, out_mask, snd_vol, step, val; diff --git a/libs/audio/renderer/snd_null.c b/libs/audio/renderer/snd_null.c index 8133eeef9..a45e11baf 100644 --- a/libs/audio/renderer/snd_null.c +++ b/libs/audio/renderer/snd_null.c @@ -162,6 +162,7 @@ SND_UnblockSound (void) { } +QFPLUGIN plugin_t *PLUGIN_INFO(snd_render, null) (void); QFPLUGIN plugin_t * PLUGIN_INFO(snd_render, null) (void) { diff --git a/libs/audio/targets/snd_alsa_0_5.c b/libs/audio/targets/snd_alsa_0_5.c index 133a848b3..d80a01ab1 100644 --- a/libs/audio/targets/snd_alsa_0_5.c +++ b/libs/audio/targets/snd_alsa_0_5.c @@ -403,8 +403,10 @@ SNDDMA_UnblockSound (void) snd_pcm_playback_pause (pcm_handle, 0); } -plugin_t * -PLUGIN_INFO(snd_output, alsa0_5) (void) { +QFPLUGIN plugin_t *PLUGIN_INFO(snd_output, alsa0_5) (void); +QFPLUGIN plugin_t * +PLUGIN_INFO(snd_output, alsa0_5) (void) +{ plugin_info.type = qfp_snd_output; plugin_info.api_version = QFPLUGIN_VERSION; plugin_info.plugin_version = "0.1"; diff --git a/libs/audio/targets/snd_alsa_0_9.c b/libs/audio/targets/snd_alsa_0_9.c index e141c6458..4f51fa2b2 100644 --- a/libs/audio/targets/snd_alsa_0_9.c +++ b/libs/audio/targets/snd_alsa_0_9.c @@ -362,7 +362,8 @@ SNDDMA_UnblockSound (void) qfsnd_pcm_pause (pcm, 0); } -plugin_t * +QFPLUGIN plugin_t *PLUGIN_INFO(snd_output, alsa0_9) (void); +QFPLUGIN plugin_t * PLUGIN_INFO(snd_output, alsa0_9) (void) { plugin_info.type = qfp_snd_output; diff --git a/libs/audio/targets/snd_disk.c b/libs/audio/targets/snd_disk.c index 1d5918f73..0d68de157 100644 --- a/libs/audio/targets/snd_disk.c +++ b/libs/audio/targets/snd_disk.c @@ -152,6 +152,7 @@ SNDDMA_UnblockSound (void) --snd_blocked; } +QFPLUGIN plugin_t *PLUGIN_INFO(snd_output, disk) (void); QFPLUGIN plugin_t * PLUGIN_INFO(snd_output, disk) (void) { plugin_info.type = qfp_snd_output; diff --git a/libs/audio/targets/snd_null.c b/libs/audio/targets/snd_null.c index 03f68e1ce..9671328d3 100644 --- a/libs/audio/targets/snd_null.c +++ b/libs/audio/targets/snd_null.c @@ -84,6 +84,7 @@ SNDDMA_UnblockSound (void) { } +QFPLUGIN plugin_t *PLUGIN_INFO(snd_output, null) (void); QFPLUGIN plugin_t * PLUGIN_INFO(snd_output, null) (void) { plugin_info.type = qfp_snd_output; diff --git a/libs/audio/targets/snd_oss.c b/libs/audio/targets/snd_oss.c index c6b430d6f..972614606 100644 --- a/libs/audio/targets/snd_oss.c +++ b/libs/audio/targets/snd_oss.c @@ -377,6 +377,7 @@ SNDDMA_UnblockSound (void) { } +QFPLUGIN plugin_t *PLUGIN_INFO(snd_output, oss) (void); QFPLUGIN plugin_t * PLUGIN_INFO(snd_output, oss) (void) { plugin_info.type = qfp_snd_output; diff --git a/libs/audio/targets/snd_sdl.c b/libs/audio/targets/snd_sdl.c index eec86ba11..1df3ca808 100644 --- a/libs/audio/targets/snd_sdl.c +++ b/libs/audio/targets/snd_sdl.c @@ -228,6 +228,7 @@ SNDDMA_UnblockSound (void) --snd_blocked; } +QFPLUGIN plugin_t *PLUGIN_INFO(snd_output, sdl) (void); QFPLUGIN plugin_t * PLUGIN_INFO(snd_output, sdl) (void) { diff --git a/libs/audio/targets/snd_sgi.c b/libs/audio/targets/snd_sgi.c index ddf5080e0..b18eeebc8 100644 --- a/libs/audio/targets/snd_sgi.c +++ b/libs/audio/targets/snd_sgi.c @@ -339,6 +339,7 @@ SNDDMA_UnblockSound (void) { } +QFPLUGIN plugin_t *PLUGIN_INFO(snd_output, sgi) (void); QFPLUGIN plugin_t * PLUGIN_INFO(snd_output, sgi) (void) { diff --git a/libs/audio/targets/snd_sun.c b/libs/audio/targets/snd_sun.c index 9d229cb1d..976045e0a 100644 --- a/libs/audio/targets/snd_sun.c +++ b/libs/audio/targets/snd_sun.c @@ -251,6 +251,7 @@ SNDDMA_UnblockSound (void) --snd_blocked; } +QFPLUGIN plugin_t *PLUGIN_INFO(snd_output, sun) (void); QFPLUGIN plugin_t * PLUGIN_INFO(snd_output, sun) (void) { plugin_info.type = qfp_snd_output; diff --git a/libs/audio/targets/snd_win.c b/libs/audio/targets/snd_win.c index 8a0bf0d1c..e15ac73d7 100644 --- a/libs/audio/targets/snd_win.c +++ b/libs/audio/targets/snd_win.c @@ -106,7 +106,7 @@ SNDDMA_Init_Cvars (void) { } -void +static void SNDDMA_BlockSound (void) { // DirectSound takes care of blocking itself @@ -115,7 +115,7 @@ SNDDMA_BlockSound (void) waveOutReset (hWaveOut); } -void +static void SNDDMA_UnblockSound (void) { // DirectSound takes care of blocking itself @@ -492,7 +492,7 @@ SNDDMA_InitWav (void) Try to find a sound device to mix for. Returns false if nothing is found. */ -qboolean +static qboolean SNDDMA_Init (void) { sndinitstat stat; @@ -718,6 +718,7 @@ DSOUND_Restore (void) return; } +QFPLUGIN plugin_t *PLUGIN_INFO(snd_output, win) (void); QFPLUGIN plugin_t * PLUGIN_INFO(snd_output, win) (void) { plugin_info.type = qfp_snd_output; diff --git a/libs/console/client.c b/libs/console/client.c index 7295de635..2de683c9b 100644 --- a/libs/console/client.c +++ b/libs/console/client.c @@ -269,7 +269,7 @@ Condump_f (void) Qclose (file); } -qboolean +static qboolean CheckForCommand (const char *line) { char command[128]; @@ -340,7 +340,7 @@ C_SayTeam (const char *line) } -void +static void C_GIB_Print_Center_f (void) { if (GIB_Argc () != 2) { @@ -439,7 +439,7 @@ Linefeed (void) All console printing must go through this in order to be logged to disk If no console is visible, the notify window will pop up. */ -void +static void C_Print (const char *fmt, va_list args) { char *s; @@ -857,6 +857,7 @@ static plugin_t plugin_info = { &plugin_info_data, }; +QFPLUGIN plugin_t *PLUGIN_INFO(console, client) (void); QFPLUGIN plugin_t * PLUGIN_INFO(console, client) (void) { diff --git a/libs/console/filelist.c b/libs/console/filelist.c index 5e68b536d..482bcfaaa 100644 --- a/libs/console/filelist.c +++ b/libs/console/filelist.c @@ -168,7 +168,7 @@ filelist_print (struct filelist *filelist) Fills a list with files of a specific extension. */ -void +static void filelist_fill (struct filelist *filelist, const char *path, const char *ext) { searchpath_t *search; @@ -224,7 +224,7 @@ Con_Skinlist_f (void) filelist_free (skinlist); } -char *sb_endings[] = { +const char *sb_endings[] = { "bk", "dn", "ft", diff --git a/libs/console/menu.c b/libs/console/menu.c index c441e0456..402fff758 100644 --- a/libs/console/menu.c +++ b/libs/console/menu.c @@ -45,10 +45,6 @@ static const char rcsid[] = #include "QF/render.h" #include "QF/sys.h" -//FIXME need a better way to communicate this (bah, need a better menu system -// in general :P) -void C_DrawInputLine (inputline_t *il); - typedef struct menu_pic_s { struct menu_pic_s *next; int x, y; @@ -87,7 +83,7 @@ static const char *top_menu; static int menu_resolve_globals (void) { - char *sym; + const char *sym; dfunction_t *f; if (!(f = ED_FindFunction (&menu_pr_state, sym = "menu_init"))) diff --git a/libs/console/server.c b/libs/console/server.c index 4bd545d9d..008f5d82e 100644 --- a/libs/console/server.c +++ b/libs/console/server.c @@ -237,11 +237,12 @@ sv_logfile_f (cvar_t *var) char *fname = strdup (var->string); char *flags = strrchr (fname, ':'); - if (flags) + if (flags) { *flags++ = 0; - else - flags = ""; - flags = nva ("a%s", flags); + flags = nva ("a%s", flags); + } else { + flags = nva ("a"); + } log_file = Qopen (va ("%s/%s", fs_userpath->string, fname), flags); free (flags); free (fname); @@ -452,22 +453,22 @@ C_ProcessInput (void) } } -void +static void C_KeyEvent (knum_t key, short unicode, qboolean down) { } -void +static void C_DrawConsole (int lines) { } -void +static void C_CheckResize (void) { } -void +static void C_NewMap (void) { } @@ -515,6 +516,7 @@ static plugin_t plugin_info = { &plugin_info_data, }; +QFPLUGIN plugin_t *PLUGIN_INFO(console, server) (void); QFPLUGIN plugin_t * PLUGIN_INFO(console, server) (void) { diff --git a/libs/gamecode/builtins/bi_cbuf.c b/libs/gamecode/builtins/bi_cbuf.c index c677fc8e5..a8f15c0ec 100644 --- a/libs/gamecode/builtins/bi_cbuf.c +++ b/libs/gamecode/builtins/bi_cbuf.c @@ -33,6 +33,7 @@ static const char rcsid[] = #include #include "QF/cbuf.h" +#include "QF/csqc.h" #include "QF/idparse.h" // For now, use the id console parser #include "QF/progs.h" diff --git a/libs/gamecode/builtins/bi_cmd.c b/libs/gamecode/builtins/bi_cmd.c index 325a44f09..832ed2a6b 100644 --- a/libs/gamecode/builtins/bi_cmd.c +++ b/libs/gamecode/builtins/bi_cmd.c @@ -43,6 +43,7 @@ static const char rcsid[] = #endif #include "QF/cmd.h" +#include "QF/csqc.h" #include "QF/hash.h" #include "QF/progs.h" #include "QF/sys.h" diff --git a/libs/gamecode/builtins/bi_cvar.c b/libs/gamecode/builtins/bi_cvar.c index adc6f7e90..7384934a3 100644 --- a/libs/gamecode/builtins/bi_cvar.c +++ b/libs/gamecode/builtins/bi_cvar.c @@ -38,6 +38,7 @@ static const char rcsid[] = # include #endif +#include "QF/csqc.h" #include "QF/cvar.h" #include "QF/progs.h" #include "QF/zone.h" diff --git a/libs/gamecode/builtins/bi_file.c b/libs/gamecode/builtins/bi_file.c index 6c30a698d..827419289 100644 --- a/libs/gamecode/builtins/bi_file.c +++ b/libs/gamecode/builtins/bi_file.c @@ -52,6 +52,7 @@ static const char rcsid[] = int fnmatch (const char *__pattern, const char *__string, int __flags); #endif +#include "QF/csqc.h" #include "QF/progs.h" #include "QF/quakefs.h" #include "QF/va.h" diff --git a/libs/gamecode/builtins/bi_inputline.c b/libs/gamecode/builtins/bi_inputline.c index c0f56fd02..12214daff 100644 --- a/libs/gamecode/builtins/bi_inputline.c +++ b/libs/gamecode/builtins/bi_inputline.c @@ -40,6 +40,7 @@ static const char rcsid[] = #endif #include "QF/console.h" +#include "QF/csqc.h" #include "QF/draw.h" #include "QF/progs.h" #include "QF/sys.h" diff --git a/libs/gamecode/builtins/bi_strhash.c b/libs/gamecode/builtins/bi_strhash.c index 061cd8797..ab14587d2 100644 --- a/libs/gamecode/builtins/bi_strhash.c +++ b/libs/gamecode/builtins/bi_strhash.c @@ -39,6 +39,7 @@ static const char rcsid[] = # include #endif +#include "QF/csqc.h" #include "QF/console.h" #include "QF/draw.h" #include "QF/progs.h" diff --git a/libs/gamecode/builtins/bi_string.c b/libs/gamecode/builtins/bi_string.c index 79ec5bdec..9fa902177 100644 --- a/libs/gamecode/builtins/bi_string.c +++ b/libs/gamecode/builtins/bi_string.c @@ -38,6 +38,7 @@ static const char rcsid[] = # include #endif +#include "QF/csqc.h" #include "QF/progs.h" #include "QF/zone.h" diff --git a/libs/gamecode/builtins/pr_cmds.c b/libs/gamecode/builtins/pr_cmds.c index ca711aaa4..4cda56f4c 100644 --- a/libs/gamecode/builtins/pr_cmds.c +++ b/libs/gamecode/builtins/pr_cmds.c @@ -81,7 +81,7 @@ PF_VarString (progs_t *pr, int first) vector normalize(vector) */ -void +static void PF_normalize (progs_t *pr) { float new; @@ -111,7 +111,7 @@ PF_normalize (progs_t *pr) scalar vlen(vector) */ -void +static void PF_vlen (progs_t *pr) { float new; @@ -131,7 +131,7 @@ PF_vlen (progs_t *pr) float vectoyaw(vector) */ -void +static void PF_vectoyaw (progs_t *pr) { float yaw; @@ -155,7 +155,7 @@ PF_vectoyaw (progs_t *pr) vector vectoangles(vector) */ -void +static void PF_vectoangles (progs_t *pr) { float forward, pitch, yaw; @@ -192,7 +192,7 @@ PF_vectoangles (progs_t *pr) random() */ -void +static void PF_random (progs_t *pr) { float num; @@ -207,7 +207,7 @@ PF_random (progs_t *pr) break() */ -void +static void PF_break (progs_t *pr) { Sys_Printf ("break statement\n"); @@ -239,7 +239,7 @@ PF_localcmd (progs_t *pr) float cvar (string) */ -void +static void PF_cvar (progs_t *pr) { const char *str; @@ -254,7 +254,7 @@ PF_cvar (progs_t *pr) float cvar (string) */ -void +static void PF_cvar_set (progs_t *pr) { const char *var_name, *val; @@ -273,7 +273,7 @@ PF_cvar_set (progs_t *pr) Cvar_Set (var, val); } -void +static void PF_fabs (progs_t *pr) { float v; @@ -283,7 +283,7 @@ PF_fabs (progs_t *pr) } // entity (entity start, .string field, string match) find = #5; -void +static void PF_Find (progs_t *pr) { const char *s = 0, *t; // ev_string @@ -344,37 +344,37 @@ PF_Find (progs_t *pr) RETURN_EDICT (pr, *pr->edicts); } -void +static void PF_coredump (progs_t *pr) { ED_PrintEdicts (pr, ""); } -void +static void PF_traceon (progs_t *pr) { pr->pr_trace = true; } -void +static void PF_traceoff (progs_t *pr) { pr->pr_trace = false; } -void +static void PF_eprint (progs_t *pr) { ED_PrintNum (pr, P_EDICTNUM (pr, 0)); } -void +static void PF_dprint (progs_t *pr) { Sys_Printf ("%s", PF_VarString (pr, 0)); } -void +static void PF_rint (progs_t *pr) { float f; @@ -386,13 +386,13 @@ PF_rint (progs_t *pr) R_FLOAT (pr) = (int) (f - 0.5); } -void +static void PF_floor (progs_t *pr) { R_FLOAT (pr) = floor (P_FLOAT (pr, 0)); } -void +static void PF_ceil (progs_t *pr) { R_FLOAT (pr) = ceil (P_FLOAT (pr, 0)); @@ -403,7 +403,7 @@ PF_ceil (progs_t *pr) entity nextent(entity) */ -void +static void PF_nextent (progs_t *pr) { int i; @@ -436,7 +436,7 @@ PF_nextent (progs_t *pr) integer (float f) ftoi */ -void +static void PF_ftoi (progs_t *pr) { R_INT (pr) = P_FLOAT (pr, 0); @@ -447,7 +447,7 @@ PF_ftoi (progs_t *pr) string (float f) ftos */ -void +static void PF_ftos (progs_t *pr) { char string[STRING_BUF]; @@ -473,7 +473,7 @@ PF_ftos (progs_t *pr) float (integer i) itof */ -void +static void PF_itof (progs_t *pr) { R_FLOAT (pr) = P_INT (pr, 0); @@ -484,7 +484,7 @@ PF_itof (progs_t *pr) string (integer i) itos */ -void +static void PF_itos (progs_t *pr) { char string[STRING_BUF]; @@ -499,7 +499,7 @@ PF_itos (progs_t *pr) float (string s) stof */ -void +static void PF_stof (progs_t *pr) { R_FLOAT (pr) = atof (P_STRING (pr, 0)); @@ -510,7 +510,7 @@ PF_stof (progs_t *pr) integer (string s) stoi */ -void +static void PF_stoi (progs_t *pr) { R_INT (pr) = atoi (P_STRING (pr, 0)); @@ -521,7 +521,7 @@ PF_stoi (progs_t *pr) vector (string s) stov */ -void +static void PF_stov (progs_t *pr) { float v[3] = {0, 0, 0}; @@ -536,7 +536,7 @@ PF_stov (progs_t *pr) string (vector v) vtos */ -void +static void PF_vtos (progs_t *pr) { char string[STRING_BUF * 3 + 5]; @@ -554,7 +554,7 @@ PF_vtos (progs_t *pr) float(string s) strlen */ -void +static void PF_strlen (progs_t *pr) { const char *s; @@ -568,7 +568,7 @@ PF_strlen (progs_t *pr) float(string char, string s) charcount */ -void +static void PF_charcount (progs_t *pr) { char goal; @@ -599,7 +599,7 @@ PF_charcount (progs_t *pr) #define MAX_ARG 23 -void +static void PF_sprintf (progs_t *pr) { char *format; @@ -834,7 +834,7 @@ PF_sprintf (progs_t *pr) PR_Error (pr, "PF_sprintf: argument limit exceeded\n"); } -void +static void PR_gametype (progs_t *pr) { RETURN_STRING (pr, pr_gametype); diff --git a/libs/gamecode/engine/pr_debug.c b/libs/gamecode/engine/pr_debug.c index c72a5daf7..f02072fe7 100644 --- a/libs/gamecode/engine/pr_debug.c +++ b/libs/gamecode/engine/pr_debug.c @@ -103,7 +103,7 @@ PR_Debug_Init_Cvars (void) "to look (within gamedir) for source files"); } -file_t * +static file_t * PR_Load_Source_File (progs_t *pr, const char *fname) { char *path, *l; diff --git a/libs/gamecode/engine/pr_edict.c b/libs/gamecode/engine/pr_edict.c index 8c9b896d9..42047bb4b 100644 --- a/libs/gamecode/engine/pr_edict.c +++ b/libs/gamecode/engine/pr_edict.c @@ -157,36 +157,6 @@ ED_Alloc (progs_t *pr) return e; } -/* - ED_FreeRefs - - NULLs all references to entity -*/ -void -ED_FreeRefs (progs_t *pr, edict_t *ed) -{ - int i, j, k; - ddef_t *def; - for (i = 0; i < pr->progs->numglobaldefs; i++) { - def = &pr->pr_globaldefs[i]; - if ((def->type & ~DEF_SAVEGLOBAL) == ev_entity) { - if (ed == G_EDICT (pr, def->ofs)) { - Sys_Printf ("Reference found to free'd edict: %p\n", ed); - } - } - } - for (i = 0; i < pr->progs->numfielddefs; i++) { - def = &pr->pr_fielddefs[i]; - if ((def->type & ~DEF_SAVEGLOBAL) == ev_entity) { - for (j = 0; j < *pr->num_edicts; j++) { - k = E_var (EDICT_NUM (pr, j), def->ofs, entity); - if (ed == PROG_TO_EDICT (pr, k)) - Sys_Printf ("Reference found to free'd edict: %p\n", ed); - } - } - } -} - /* ED_Free @@ -218,7 +188,7 @@ ED_Free (progs_t *pr, edict_t *ed) Returns a string describing *data in a type-specific manner */ -char * +static const char * PR_ValueString (progs_t *pr, etype_t type, pr_type_t *val) { static char line[256]; @@ -295,7 +265,7 @@ PR_GlobalString (progs_t *pr, int ofs, etype_t type) { ddef_t *def = NULL; static dstring_t *line = NULL; - char *s; + const char *s; if (!line) line = dstring_newstr(); @@ -312,8 +282,8 @@ PR_GlobalString (progs_t *pr, int ofs, etype_t type) if (!def && type == ev_void) dsprintf (line, "[$%x]", ofs); else { - char *name = "?"; - char *oi = ""; + const char *name = "?"; + const char *oi = ""; if (def) { if (type == ev_void) type = def->type; diff --git a/libs/gamecode/engine/pr_exec.c b/libs/gamecode/engine/pr_exec.c index 4805938d6..a42359a2b 100644 --- a/libs/gamecode/engine/pr_exec.c +++ b/libs/gamecode/engine/pr_exec.c @@ -144,7 +144,7 @@ PR_EnterFunction (progs_t * pr, dfunction_t *f) return; } -void +static void PR_LeaveFunction (progs_t * pr) { int c; diff --git a/libs/gamecode/engine/pr_obj.c b/libs/gamecode/engine/pr_obj.c index 20cb7003a..4a3bef458 100644 --- a/libs/gamecode/engine/pr_obj.c +++ b/libs/gamecode/engine/pr_obj.c @@ -115,7 +115,7 @@ dump_ivars (progs_t *pr, pointer_t _ivars) } } -string_t +static string_t object_get_class_name (progs_t *pr, pr_id_t *object) { pr_class_t *class; diff --git a/libs/gamecode/engine/pr_parse.c b/libs/gamecode/engine/pr_parse.c index 2ccf49cc2..931abcff8 100644 --- a/libs/gamecode/engine/pr_parse.c +++ b/libs/gamecode/engine/pr_parse.c @@ -61,7 +61,7 @@ static const char rcsid[] = Returns a string describing *data in a type specific manner Easier to parse than PR_ValueString */ -char * +static char * PR_UglyValueString (progs_t *pr, etype_t type, pr_type_t *val) { static char line[256]; @@ -221,7 +221,7 @@ ED_NewString (progs_t *pr, const char *string) Can parse either fields or globals returns false if error */ -qboolean +static qboolean ED_ParseEpair (progs_t *pr, pr_type_t *base, ddef_t *key, const char *s) { int i; diff --git a/libs/gamecode/engine/pr_resolve.c b/libs/gamecode/engine/pr_resolve.c index afee18e97..868ab7ef6 100644 --- a/libs/gamecode/engine/pr_resolve.c +++ b/libs/gamecode/engine/pr_resolve.c @@ -161,8 +161,8 @@ ED_FindFunction (progs_t * pr, const char *name) int PR_ResolveGlobals (progs_t *pr) { - char *sym; - ddef_t *def; + const char *sym; + ddef_t *def; if (!(def = PR_FindGlobal (pr, sym = "time"))) goto error; diff --git a/libs/gib/exp.c b/libs/gib/exp.c index 39bf8e93d..26e51f818 100644 --- a/libs/gib/exp.c +++ b/libs/gib/exp.c @@ -69,7 +69,7 @@ functable_t functable[] = }; // Error handling -exp_error_t +static exp_error_t EXP_Error (exp_error_t err, const char *msg) { EXP_ERROR = err; @@ -85,7 +85,7 @@ EXP_GetErrorMsg (void) return exp_error_msg; } -token +static token *EXP_NewToken (void) { token *new; @@ -110,7 +110,7 @@ EXP_FindIndexByFunc (opfunc func) } */ -optable_t * +static optable_t * EXP_FindOpByStr (const char *str) { int i, len, fi; @@ -126,7 +126,7 @@ EXP_FindOpByStr (const char *str) return 0; } -functable_t * +static functable_t * EXP_FindFuncByStr (const char *str) { int i, len, fi; @@ -142,7 +142,7 @@ EXP_FindFuncByStr (const char *str) return 0; } -int +static int EXP_ContainsCommas (token *chain) { token *cur; @@ -160,7 +160,7 @@ EXP_ContainsCommas (token *chain) return -1; // We should never get here } -int +static int EXP_DoFunction (token *chain) { token *cur, *temp; @@ -196,7 +196,7 @@ EXP_DoFunction (token *chain) return -2; // We shouldn't get here } -int +static int EXP_DoUnary (token *chain) { if (chain->generic.next->generic.type == TOKEN_OP) diff --git a/libs/gib/gib_builtin.c b/libs/gib/gib_builtin.c index 9b1253186..bbae41478 100644 --- a/libs/gib/gib_builtin.c +++ b/libs/gib/gib_builtin.c @@ -67,12 +67,12 @@ hashtab_t *gib_builtins; /* Hashtable callbacks */ -const char * +static const char * GIB_Builtin_Get_Key (void *ele, void *ptr) { return ((gib_builtin_t *)ele)->name->str; } -void +static void GIB_Builtin_Free (void *ele, void *ptr) { gib_builtin_t *b; @@ -153,7 +153,7 @@ GIB_Return (const char *str) See GIB docs for information. */ -void +static void GIB_Function_f (void) { if (GIB_Argc () != 3) @@ -162,7 +162,7 @@ GIB_Function_f (void) GIB_Function_Define (GIB_Argv(1), GIB_Argv(2)); } -void +static void GIB_Function_Get_f (void) { if (GIB_Argc () != 2) @@ -176,7 +176,7 @@ GIB_Function_Get_f (void) } } -void +static void GIB_Local_f (void) { int i; @@ -188,7 +188,7 @@ GIB_Local_f (void) GIB_Var_Set_Local (cbuf_active, GIB_Argv(i), ""); } -void +static void GIB_Global_f (void) { int i; @@ -200,7 +200,7 @@ GIB_Global_f (void) GIB_Var_Set_Global (GIB_Argv(i), ""); } -void +static void GIB_Global_Delete_f (void) { if (GIB_Argc () != 2) @@ -209,7 +209,7 @@ GIB_Global_Delete_f (void) GIB_Var_Free_Global (GIB_Argv(1)); } -void +static void GIB_Return_f (void) { cbuf_t *sp; @@ -243,7 +243,7 @@ GIB_Return_f (void) } } -void +static void GIB_If_f (void) { int condition; @@ -264,7 +264,7 @@ GIB_If_f (void) GIB_USAGE ("condition program [else ...]"); } -void +static void GIB_While_f (void) { if (GIB_Argc() != 3) { @@ -285,12 +285,12 @@ GIB_While_f (void) } } -void +static void GIB_Field_Get_f (void) { unsigned int field; - char *list, *end; - const char *ifs; + char *end; + const char *list, *ifs; if (GIB_Argc() < 3 || GIB_Argc() > 4) { GIB_USAGE ("list element [fs]"); return; @@ -303,7 +303,7 @@ GIB_Field_Get_f (void) ifs = " \t\n\r"; if (!*ifs) { if (field < strlen(GIB_Argv(1))) { - GIB_Argv(1)[field+1] = 0; + ((char *)GIB_Argv(1))[field+1] = 0; GIB_Return (GIB_Argv(1)+field); } else GIB_Return (""); @@ -321,13 +321,13 @@ GIB_Field_Get_f (void) } field--; } - for (end = list; !strchr(ifs, *end); end++); + for (end = (char *)list; !strchr(ifs, *end); end++); *end = 0; GIB_Return (list); } -void +static void GIB___For_f (void) { char *end = 0, old = 0; @@ -356,7 +356,7 @@ GIB___For_f (void) GIB_DATA(cbuf_active)->loop_list_p = end; } -void +static void GIB_For_f (void) { if (strcmp ("in", GIB_Argv (2)) || @@ -396,7 +396,7 @@ GIB_For_f (void) } } -void +static void GIB_Break_f (void) { if (GIB_DATA(cbuf_active)->type != GIB_BUFFER_LOOP) @@ -409,7 +409,7 @@ GIB_Break_f (void) } } -void +static void GIB_Continue_f (void) { if (GIB_DATA(cbuf_active)->type != GIB_BUFFER_LOOP) @@ -421,7 +421,7 @@ GIB_Continue_f (void) } // Note: this is a standard console command, not a GIB builtin -void +static void GIB_Runexported_f (void) { gib_function_t *f; @@ -439,7 +439,7 @@ GIB_Runexported_f (void) } } -void +static void GIB_Function_Export_f (void) { gib_function_t *f; @@ -457,7 +457,7 @@ GIB_Function_Export_f (void) } } -void +static void GIB_String_Length_f (void) { dstring_t *ret; @@ -467,7 +467,7 @@ GIB_String_Length_f (void) dsprintf (ret, "%i", (int) strlen(GIB_Argv(1))); } -void +static void GIB_String_Equal_f (void) { if (GIB_Argc() != 3) @@ -478,11 +478,11 @@ GIB_String_Equal_f (void) GIB_Return ("1"); } -void +static void GIB_String_Findsub_f (void) { dstring_t *ret; - char *haystack, *res; + const char *haystack, *res; if (GIB_Argc() != 3) { GIB_USAGE ("string substr"); return; @@ -495,7 +495,7 @@ GIB_String_Findsub_f (void) GIB_Return ("-1"); } -void +static void GIB_Regex_Match_f (void) { regex_t *reg; @@ -513,7 +513,7 @@ GIB_Regex_Match_f (void) GIB_Return ("1"); } -void +static void GIB_Regex_Replace_f (void) { regex_t *reg; @@ -538,7 +538,7 @@ GIB_Regex_Replace_f (void) GIB_Return (GIB_Argv(1)); } -void +static void GIB_Regex_Extract_f (void) { regex_t *reg; @@ -559,9 +559,9 @@ GIB_Regex_Extract_f (void) for (i = 0; i < GIB_Argc() - 4; i++) { if (match[i].rm_so != -1 && *GIB_Argv(i+4)) { o = GIB_Argv(1)[match[i].rm_eo]; - GIB_Argv(1)[match[i].rm_eo] = 0; + ((char *)GIB_Argv(1))[match[i].rm_eo] = 0; GIB_Var_Set_Local (cbuf_active, GIB_Argv(i+4), GIB_Argv(1)+match[i].rm_so); - GIB_Argv(1)[match[i].rm_eo] = o; + ((char *)GIB_Argv(1))[match[i].rm_eo] = o; } } if ((ret = GIB_Return (0))) @@ -571,7 +571,7 @@ GIB_Regex_Extract_f (void) free (match); } -void +static void GIB_Thread_Create_f (void) { dstring_t *ret; @@ -586,7 +586,7 @@ GIB_Thread_Create_f (void) } } -void +static void GIB_Thread_Kill_f (void) { if (GIB_Argc() != 2) @@ -610,7 +610,7 @@ GIB_Thread_Kill_f (void) } } -void +static void GIB_Event_Register_f (void) { gib_function_t *func; @@ -626,7 +626,7 @@ GIB_Event_Register_f (void) int (*GIB_File_Transform_Path) (dstring_t *path) = NULL; -int +static int GIB_File_Transform_Path_Null (dstring_t *path) { char *s; @@ -637,7 +637,7 @@ GIB_File_Transform_Path_Null (dstring_t *path) return 0; } -int +static int GIB_File_Transform_Path_Secure (dstring_t *path) { char *s /* , e_dir[MAX_OSPATH] */; @@ -652,11 +652,11 @@ GIB_File_Transform_Path_Secure (dstring_t *path) return 0; } -void +static void GIB_File_Read_f (void) { QFile *file; - char *path; + const char *path; int len; dstring_t *ret; @@ -693,11 +693,11 @@ GIB_File_Read_f (void) } } -void +static void GIB_File_Write_f (void) { QFile *file; - char *path; + const char *path; if (GIB_Argc () != 3) { GIB_USAGE ("file data"); @@ -723,12 +723,13 @@ GIB_File_Write_f (void) Qclose (file); } -void +static void GIB_File_Find_f (void) { DIR *directory; struct dirent *entry; - char *path, *glob = 0, *s; + const char *path, *glob = 0; + char *s; const char *ifs; dstring_t *list; @@ -773,10 +774,10 @@ GIB_File_Find_f (void) closedir (directory); } -void +static void GIB_File_Move_f (void) { - char *path1, *path2; + const char *path1, *path2; if (GIB_Argc () != 3) { GIB_USAGE ("from_file to_file"); @@ -800,10 +801,10 @@ GIB_File_Move_f (void) path1, path2, strerror(errno)); } -void +static void GIB_File_Delete_f (void) { - char *path; + const char *path; if (GIB_Argc () != 2) { GIB_USAGE ("file"); @@ -821,7 +822,7 @@ GIB_File_Delete_f (void) path, strerror(errno)); } -void +static void GIB_Range_f (void) { double i, inc, start, limit; @@ -846,7 +847,7 @@ GIB_Range_f (void) dstr->str[dstr->size-2] = 0; } -void +static void GIB_Print_f (void) { if (GIB_Argc() != 2) { diff --git a/libs/gib/gib_function.c b/libs/gib/gib_function.c index 8cbc0baa5..0ef1a0bf0 100644 --- a/libs/gib/gib_function.c +++ b/libs/gib/gib_function.c @@ -55,7 +55,7 @@ hashtab_t *gib_functions = 0; Builds a new function struct and returns a pointer to it. */ -gib_function_t * +static gib_function_t * GIB_Function_New (void) { gib_function_t *new = calloc (1, sizeof (gib_function_t)); @@ -68,12 +68,12 @@ GIB_Function_New (void) /* Hashtable callbacks */ -const char * +static const char * GIB_Function_Get_Key (void *ele, void *ptr) { return ((gib_function_t *)ele)->name->str; } -void +static void GIB_Function_Free (void *ele, void *ptr) { gib_function_t *func = (gib_function_t *)ele; diff --git a/libs/gib/gib_init.c b/libs/gib/gib_init.c index 2a597986f..33523ff3e 100644 --- a/libs/gib/gib_init.c +++ b/libs/gib/gib_init.c @@ -35,6 +35,7 @@ static const char rcsid[] = #include "QF/qtypes.h" #include "QF/cbuf.h" #include "QF/quakefs.h" +#include "QF/gib_init.h" #include "QF/gib_parse.h" #include "QF/gib_builtin.h" #include "QF/gib_regex.h" @@ -44,7 +45,7 @@ static const char rcsid[] = #include "QF/zone.h" #include "QF/cvar.h" -void +static void GIB_Exec_Override_f (void) { char *f; int mark; diff --git a/libs/gib/gib_parse.c b/libs/gib/gib_parse.c index 60407cce3..cc9e22032 100644 --- a/libs/gib/gib_parse.c +++ b/libs/gib/gib_parse.c @@ -91,7 +91,7 @@ GIB_Escaped (const char *str, int i) 0 on success, or the character it could not match otherwise */ -char +static char GIB_Parse_Match_Dquote (const char *str, unsigned int *i) { unsigned int n = *i; @@ -494,7 +494,7 @@ FILTER_ERROR: return; } -inline qboolean +static inline qboolean GIB_Parse_Execute_Varexp (cbuf_t *cbuf) { char *s; diff --git a/libs/gib/gib_process.c b/libs/gib/gib_process.c index 10c710ac9..2ab36bd96 100644 --- a/libs/gib/gib_process.c +++ b/libs/gib/gib_process.c @@ -44,11 +44,12 @@ static const char rcsid[] = #include "QF/cvar.h" #include "QF/gib_buffer.h" #include "QF/gib_parse.h" +#include "QF/gib_process.h" #include "QF/gib_vars.h" #include "exp.h" -int +static int GIB_Process_Index (dstring_t *index, unsigned int pos, int *i1, int *i2) { int i, v1, v2; @@ -77,7 +78,7 @@ GIB_Process_Index (dstring_t *index, unsigned int pos, int *i1, int *i2) return 0; } -unsigned int +static unsigned int GIB_Process_Variable (struct dstring_s *dstr, unsigned int pos, qboolean tolerant) { cvar_t *cvar; @@ -119,7 +120,7 @@ GIB_Process_Math (struct dstring_s *token) return 0; } -int +static int GIB_Process_Embedded (struct dstring_s *token) { cbuf_t *sub; @@ -264,7 +265,7 @@ ERROR: return c ? -1 : 0; } -void +static void GIB_Process_Escapes (dstring_t *token) { int i; diff --git a/libs/gib/gib_regex.c b/libs/gib/gib_regex.c index 4e8c5814b..de4f14ff2 100644 --- a/libs/gib/gib_regex.c +++ b/libs/gib/gib_regex.c @@ -45,13 +45,13 @@ static const char rcsid[] = hashtab_t *gib_regexs; static char errstr[1024]; -const char * +static const char * GIB_Regex_Get_Key (void *ele, void *ptr) { return ((gib_regex_t *) ele)->regex; } -void +static void GIB_Regex_Free (void *ele, void *ptr) { regfree (&(((gib_regex_t *) ele)->comp)); diff --git a/libs/gib/gib_thread.c b/libs/gib/gib_thread.c index 92da661fc..95100bdca 100644 --- a/libs/gib/gib_thread.c +++ b/libs/gib/gib_thread.c @@ -92,7 +92,7 @@ GIB_Thread_New (void) return new; } -void +static void GIB_Thread_Delete (gib_thread_t *thread) { Cbuf_DeleteStack (thread->cbuf); @@ -117,12 +117,13 @@ GIB_Thread_Execute (void) } } -const char * +static const char * GIB_Event_Get_Key (void *ele, void *ptr) { return ((gib_event_t *)ele)->name; } -void + +static void GIB_Event_Free (void *ele, void *ptr) { gib_event_t *ev = (gib_event_t *)ele; diff --git a/libs/gib/gib_vars.c b/libs/gib/gib_vars.c index 565b36783..5b650e682 100644 --- a/libs/gib/gib_vars.c +++ b/libs/gib/gib_vars.c @@ -41,7 +41,7 @@ static const char rcsid[] = hashtab_t *gib_globals = 0; -gib_var_t * +static gib_var_t * GIB_Var_New (void) { gib_var_t *new = calloc (1, sizeof (gib_var_t)); @@ -67,7 +67,7 @@ GIB_Var_Free (void *ele, void *ptr) Hash_DelTable (l->subvars); } -gib_var_t * +static gib_var_t * GIB_Var_Get_R (hashtab_t *vars, char *name) { char *p; @@ -86,7 +86,7 @@ GIB_Var_Get_R (hashtab_t *vars, char *name) return Hash_Find (vars, name); } -void +static void GIB_Var_Set_R (hashtab_t *vars, char *name, const char *value) { char *p; diff --git a/libs/gib/ops.c b/libs/gib/ops.c index 4d22940ad..10ca3757e 100644 --- a/libs/gib/ops.c +++ b/libs/gib/ops.c @@ -21,6 +21,8 @@ #include +#include "ops.h" + double OP_Not (double op1, double op2) { diff --git a/libs/gib/regex.c b/libs/gib/regex.c index 81ab69f5b..e4305bf2c 100644 --- a/libs/gib/regex.c +++ b/libs/gib/regex.c @@ -91,7 +91,7 @@ extern char *re_syntax_table; static char re_syntax_table[CHAR_SET_SIZE]; static void -init_syntax_once () +init_syntax_once (void) { register int c; static int done = 0; @@ -839,11 +839,23 @@ static const char *re_error_msg[] = /* Subroutine declarations and macros for regex_compile. */ -static void store_op1 (), store_op2 (); -static void insert_op1 (), insert_op2 (); -static boolean at_begline_loc_p (), at_endline_loc_p (); -static boolean group_in_compile_stack (); -static reg_errcode_t compile_range (); + +typedef struct +{ + struct compile_stack_elt_t *stack; + unsigned size; + unsigned avail; /* Offset of next open position. */ +} compile_stack_type; + +/* But patterns can have more than `MAX_REGNUM' registers. We just + ignore the excess. */ +typedef unsigned regnum_t; + +static void store_op1 (re_opcode_t op, unsigned char *loc, int arg), store_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2); +static void insert_op1 (re_opcode_t op, unsigned char *loc, int arg, unsigned char *end), insert_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2, unsigned char *end); +static boolean at_begline_loc_p (const char *pattern, const char *p, reg_syntax_t syntax), at_endline_loc_p (const char *pattern, const char *p, int syntax); +static boolean group_in_compile_stack (compile_stack_type compile_stack, regnum_t regnum); +static reg_errcode_t compile_range (const char **p_ptr, const char *pend, char *translate, reg_syntax_t syntax, unsigned char *b); /* Fetch the next character in the uncompiled pattern---translating it if necessary. Also cast from a signed character in the constant @@ -969,10 +981,6 @@ static reg_errcode_t compile_range (); things about is what fits in that byte. */ #define MAX_REGNUM 255 -/* But patterns can have more than `MAX_REGNUM' registers. We just - ignore the excess. */ -typedef unsigned regnum_t; - /* Macros for the compile stack. */ @@ -980,7 +988,7 @@ typedef unsigned regnum_t; be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */ typedef int pattern_offset_t; -typedef struct +typedef struct compile_stack_elt_t { pattern_offset_t begalt_offset; pattern_offset_t fixup_alt_jump; @@ -990,14 +998,6 @@ typedef struct } compile_stack_elt_t; -typedef struct -{ - compile_stack_elt_t *stack; - unsigned size; - unsigned avail; /* Offset of next open position. */ -} compile_stack_type; - - #define INIT_COMPILE_STACK_SIZE 32 #define COMPILE_STACK_EMPTY (compile_stack.avail == 0) @@ -1058,6 +1058,7 @@ typedef struct The `fastmap' and `newline_anchor' fields are neither examined nor set. */ +static reg_errcode_t regex_compile (const char *pattern, int size, reg_syntax_t syntax, struct re_pattern_buffer *bufp); static reg_errcode_t regex_compile (pattern, size, syntax, bufp) const char *pattern; @@ -2996,11 +2997,11 @@ re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) } /* re_search_2 */ /* Declarations and macros for re_match_2. */ - -static int bcmp_translate (); -static boolean alt_match_null_string_p (), - common_op_match_null_string_p (), - group_match_null_string_p (); +union register_info_type; +static int bcmp_translate (const unsigned char *s1, const unsigned char *s2, int len, char *translate); +static boolean alt_match_null_string_p (unsigned char *p, unsigned char *end, union register_info_type *reg_info), + common_op_match_null_string_p (unsigned char **p, unsigned char *end, union register_info_type *reg_info), + group_match_null_string_p (unsigned char **p, unsigned char *end, union register_info_type *reg_info); /* Structure for per-register (a.k.a. per-group) information. This must not be longer than one word, because we push this value @@ -3013,7 +3014,7 @@ static boolean alt_match_null_string_p (), the compiler will pack our bit fields into something that fits into the type of `word', i.e., is something that fits into one item on the failure stack. */ -typedef union +typedef union register_info_type { fail_stack_elt_t word; struct @@ -4595,11 +4596,11 @@ common_op_match_null_string_p (p, end, reg_info) static int bcmp_translate (s1, s2, len, translate) - unsigned char *s1, *s2; + const unsigned char *s1, *s2; register int len; char *translate; { - register unsigned char *p1 = s1, *p2 = s2; + register const unsigned char *p1 = s1, *p2 = s2; while (len) { if (translate[*p1++] != translate[*p2++]) return 1; @@ -4652,7 +4653,7 @@ re_compile_pattern (pattern, length, bufp) /* BSD has one and only one pattern buffer. */ static struct re_pattern_buffer re_comp_buf; -char * +const char * re_comp (s) const char *s; { diff --git a/libs/models/alias/gl_mesh.c b/libs/models/alias/gl_mesh.c index b71d65da8..dd1817b92 100644 --- a/libs/models/alias/gl_mesh.c +++ b/libs/models/alias/gl_mesh.c @@ -74,7 +74,7 @@ int stripcount; int strip_size; -void +static void alloc_used (int size) { if (size <= used_size) @@ -86,7 +86,7 @@ alloc_used (int size) used_size = size; } -void +static void add_command (int cmd) { if (numcommands + 1 > commands_size) { @@ -98,7 +98,7 @@ add_command (int cmd) commands[numcommands++] = cmd; } -void +static void add_vertex (int vert) { if (numorder + 1 > vertexorder_size) { @@ -110,7 +110,7 @@ add_vertex (int vert) vertexorder[numorder++] = vert; } -void +static void add_strip (int vert, int tri) { if (stripcount + 1 > strip_size) { @@ -125,7 +125,7 @@ add_strip (int vert, int tri) stripcount++; } -int +static int StripLength (int starttri, int startv) { int m1, m2, j, k; @@ -183,7 +183,7 @@ done: return stripcount - 2; } -int +static int FanLength (int starttri, int startv) { int m1, m2, j, k; @@ -245,7 +245,7 @@ FanLength (int starttri, int startv) Generate a list of trifans or strips for the model, which holds for all frames */ -void +static void BuildTris (void) { float s, t; diff --git a/libs/models/alias/gl_model_alias.c b/libs/models/alias/gl_model_alias.c index ae38c2274..1a05c497c 100644 --- a/libs/models/alias/gl_model_alias.c +++ b/libs/models/alias/gl_model_alias.c @@ -82,7 +82,7 @@ typedef struct { Fill background pixels so mipmapping doesn't have halos - Ed */ -void +static void Mod_FloodFillSkin (byte * skin, int skinwidth, int skinheight) { byte fillcolor = *skin; // assume this is the pixel to fill @@ -264,7 +264,7 @@ Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr) } } -void +static void Mod_LoadExternalSkin (maliasskindesc_t *pskindesc, char *filename) { tex_t *targa; diff --git a/libs/models/alias/model_alias.c b/libs/models/alias/model_alias.c index eea14475a..1fb77f7e5 100644 --- a/libs/models/alias/model_alias.c +++ b/libs/models/alias/model_alias.c @@ -65,7 +65,7 @@ int posenum = 0; int aliasbboxmins[3], aliasbboxmaxs[3]; -void * +static void * Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype, int *pskinindex) { byte *skin; diff --git a/libs/models/brush/gl_model_brush.c b/libs/models/brush/gl_model_brush.c index 7d280257b..40e4bd7a8 100644 --- a/libs/models/brush/gl_model_brush.c +++ b/libs/models/brush/gl_model_brush.c @@ -163,7 +163,7 @@ Mod_LoadLighting (lump_t *l) msurface_t *warpface; -void +static void BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs) { float *v; @@ -181,7 +181,7 @@ BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs) } } -void +static void SubdividePolygon (int numverts, float *verts) { float frac, m, s, t; diff --git a/libs/models/brush/model_brush.c b/libs/models/brush/model_brush.c index 35e013466..41b90b3a3 100644 --- a/libs/models/brush/model_brush.c +++ b/libs/models/brush/model_brush.c @@ -80,7 +80,7 @@ Mod_PointInLeaf (const vec3_t p, model_t *model) return NULL; // never reached } -byte * +static byte * Mod_DecompressVis (byte * in, model_t *model) { static byte decompressed[MAX_MAP_LEAFS / 8]; @@ -131,7 +131,7 @@ Mod_LeafPVS (mleaf_t *leaf, model_t *model) byte *mod_base; -void +static void Mod_LoadTextures (lump_t *l) { dmiptexlump_t *m; @@ -265,7 +265,7 @@ Mod_LoadTextures (lump_t *l) } } -void +static void Mod_LoadVisibility (lump_t *l) { if (!l->filelen) { @@ -276,7 +276,7 @@ Mod_LoadVisibility (lump_t *l) memcpy (loadmodel->visdata, mod_base + l->fileofs, l->filelen); } -void +static void Mod_LoadEntities (lump_t *l) { if (!l->filelen) { @@ -287,7 +287,7 @@ Mod_LoadEntities (lump_t *l) memcpy (loadmodel->entities, mod_base + l->fileofs, l->filelen); } -void +static void Mod_LoadVertexes (lump_t *l) { dvertex_t *in; @@ -310,7 +310,7 @@ Mod_LoadVertexes (lump_t *l) } } -void +static void Mod_LoadSubmodels (lump_t *l) { dmodel_t *in, *out; @@ -339,7 +339,7 @@ Mod_LoadSubmodels (lump_t *l) } } -void +static void Mod_LoadEdges (lump_t *l) { dedge_t *in; @@ -361,7 +361,7 @@ Mod_LoadEdges (lump_t *l) } } -void +static void Mod_LoadTexinfo (lump_t *l) { float len1, len2; @@ -419,7 +419,7 @@ Mod_LoadTexinfo (lump_t *l) Fills in s->texturemins[] and s->extents[] */ -void +static void CalcSurfaceExtents (msurface_t *s) { float mins[2], maxs[2], val; @@ -464,7 +464,7 @@ CalcSurfaceExtents (msurface_t *s) } } -void +static void Mod_LoadFaces (lump_t *l) { dface_t *in; @@ -531,7 +531,7 @@ Mod_LoadFaces (lump_t *l) } } -void +static void Mod_SetParent (mnode_t *node, mnode_t *parent) { node->parent = parent; @@ -541,7 +541,7 @@ Mod_SetParent (mnode_t *node, mnode_t *parent) Mod_SetParent (node->children[1], node); } -void +static void Mod_LoadNodes (lump_t *l) { dnode_t *in; @@ -581,7 +581,7 @@ Mod_LoadNodes (lump_t *l) Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs } -void +static void Mod_LoadLeafs (lump_t *l) { dleaf_t *in; @@ -636,7 +636,7 @@ Mod_LoadLeafs (lump_t *l) } } -void +static void Mod_LoadClipnodes (lump_t *l) { dclipnode_t *in, *out; @@ -695,7 +695,7 @@ Mod_LoadClipnodes (lump_t *l) Deplicate the drawing hull structure as a clipping hull */ -void +static void Mod_MakeHull0 (void) { dclipnode_t *out; @@ -726,7 +726,7 @@ Mod_MakeHull0 (void) } } -void +static void Mod_LoadMarksurfaces (lump_t *l) { int count, i, j; @@ -750,7 +750,7 @@ Mod_LoadMarksurfaces (lump_t *l) } } -void +static void Mod_LoadSurfedges (lump_t *l) { int count, i; @@ -769,7 +769,7 @@ Mod_LoadSurfedges (lump_t *l) out[i] = LittleLong (in[i]); } -void +static void Mod_LoadPlanes (lump_t *l) { dplane_t *in; diff --git a/libs/models/model.c b/libs/models/model.c index 05c6f091b..a3370cf33 100644 --- a/libs/models/model.c +++ b/libs/models/model.c @@ -140,7 +140,7 @@ Mod_FindName (const char *name) return mod; } -model_t * +static model_t * Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator) { unsigned int *buf; @@ -211,7 +211,7 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator) Loads a model into the cache */ -model_t * +static model_t * Mod_LoadModel (model_t *mod, qboolean crash) { if (!mod->needload) { diff --git a/libs/models/sprite/model_sprite.c b/libs/models/sprite/model_sprite.c index 1d9c9b6b3..afabdf542 100644 --- a/libs/models/sprite/model_sprite.c +++ b/libs/models/sprite/model_sprite.c @@ -43,7 +43,7 @@ static const char rcsid[] = #include "compat.h" -void * +static void * Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum) { dspriteframe_t *pinframe; @@ -79,7 +79,7 @@ Mod_LoadSpriteFrame (void *pin, mspriteframe_t **ppframe, int framenum) return (void *) ((byte *) pinframe + sizeof (dspriteframe_t) + size); } -void * +static void * Mod_LoadSpriteGroup (void *pin, mspriteframe_t **ppframe, int framenum) { dspritegroup_t *pingroup; diff --git a/libs/util/buildnum.c b/libs/util/buildnum.c index e5b28af2e..a61a2cb4d 100644 --- a/libs/util/buildnum.c +++ b/libs/util/buildnum.c @@ -39,10 +39,12 @@ static const char rcsid[] = #include -static char *date = __DATE__; // Was "Dec 21 1999" -static char *mon[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", - "Aug", "Sep", "Oct", "Nov", "Dec" }; -static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; +#include "buildnum.h" + +static const char *date = __DATE__; // Was "Dec 21 1999" +static const char *mon[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", + "Aug", "Sep", "Oct", "Nov", "Dec" }; +static const char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; /* returns days since Dec 21 1999 */ diff --git a/libs/util/cmd.c b/libs/util/cmd.c index e9089f26e..7c9665f00 100644 --- a/libs/util/cmd.c +++ b/libs/util/cmd.c @@ -309,7 +309,7 @@ cmd_get_key (void *c, void *unused) return cmd->name; } -void +static void Cmd_Runalias_f (void) { cmdalias_t *a; @@ -325,7 +325,7 @@ Cmd_Runalias_f (void) } } -void +static void Cmd_Alias_f (void) { cmdalias_t *alias; @@ -381,7 +381,7 @@ Cmd_Alias_f (void) alias->value = cmd; } -void +static void Cmd_UnAlias_f (void) { cmdalias_t *alias; @@ -412,7 +412,7 @@ Cmd_UnAlias_f (void) } } -void +static void Cmd_CmdList_f (void) { cmd_function_t *cmd; @@ -432,7 +432,7 @@ Cmd_CmdList_f (void) Sys_Printf ("------------\n%d commands\n", i); } -void +static void Cmd_Help_f (void) { const char *name; @@ -463,7 +463,7 @@ Cmd_Help_f (void) Sys_Printf ("variable/command not found\n"); } -void +static void Cmd_Exec_f (void) { char *f; @@ -492,7 +492,7 @@ Cmd_Exec_f (void) Just prints the rest of the line to the console */ -void +static void Cmd_Echo_f (void) { if (Cmd_Argc () == 2) @@ -503,7 +503,7 @@ Cmd_Echo_f (void) /* Pauses execution of the current stack until next call of Cmd_Execute (usually next frame) */ -void +static void Cmd_Wait_f (void) { cbuf_active->state = CBUF_STATE_WAIT; @@ -511,7 +511,7 @@ Cmd_Wait_f (void) /* Pauses execution for a specified number of seconds */ -void +static void Cmd_Sleep_f (void) { double waittime; @@ -528,31 +528,33 @@ Cmd_StuffCmds (cbuf_t *cbuf) int i, j; int s; char *build, c; + char *cmdline; s = strlen (com_cmdline); if (!s) return; + cmdline = strdup (com_cmdline); // pull out the commands build = malloc (s + 1); SYS_CHECKMEM (build); build[0] = 0; for (i = 0; i < s - 1; i++) { - if (com_cmdline[i] == '+') { + if (cmdline[i] == '+') { i++; - for (j = i; !((com_cmdline[j] == '+') - || (com_cmdline[j] == '-' - && (j == 0 || com_cmdline[j - 1] == ' ')) - || (com_cmdline[j] == 0)); j++); + for (j = i; !((cmdline[j] == '+') + || (cmdline[j] == '-' + && (j == 0 || cmdline[j - 1] == ' ')) + || (cmdline[j] == 0)); j++); - c = com_cmdline[j]; - com_cmdline[j] = 0; + c = cmdline[j]; + cmdline[j] = 0; - strncat (build, com_cmdline + i, s - strlen (build)); + strncat (build, cmdline + i, s - strlen (build)); strncat (build, "\n", s - strlen (build)); - com_cmdline[j] = c; + cmdline[j] = c; i = j - 1; } } @@ -561,9 +563,10 @@ Cmd_StuffCmds (cbuf_t *cbuf) Cbuf_InsertText (cbuf, build); free (build); + free (cmdline); } -void +static void Cmd_StuffCmds_f (void) { Cmd_StuffCmds (cbuf_active); diff --git a/libs/util/cvar.c b/libs/util/cvar.c index 3d58ee945..2062467dd 100644 --- a/libs/util/cvar.c +++ b/libs/util/cvar.c @@ -58,7 +58,7 @@ static const char rcsid[] = cvar_t *developer; cvar_t *cvar_vars; -char *cvar_null_string = ""; +const char *cvar_null_string = ""; cvar_alias_t *calias_vars; hashtab_t *cvar_hash; hashtab_t *calias_hash; @@ -339,7 +339,7 @@ Cvar_WriteVariables (QFile *f) Qprintf (f, "%s \"%s\"\n", var->name, var->string); } -void +static void Cvar_Set_f (void) { cvar_t *var; @@ -370,7 +370,7 @@ Cvar_Set_f (void) } } -void +static void Cvar_Setrom_f (void) { cvar_t *var; @@ -402,7 +402,7 @@ Cvar_Setrom_f (void) } } -void +static void Cvar_Toggle_f (void) { cvar_t *var; @@ -423,7 +423,7 @@ Cvar_Toggle_f (void) Cvar_Set (var, var->int_val ? "0" : "1"); } -void +static void Cvar_CvarList_f (void) { cvar_t *var; diff --git a/libs/util/getopt.c b/libs/util/getopt.c index 00167d366..ffb793c1d 100644 --- a/libs/util/getopt.c +++ b/libs/util/getopt.c @@ -209,9 +209,11 @@ static char *posixly_correct; whose names are inconsistent. */ #ifndef getenv -extern char *getenv (); +extern char *getenv (const char *); #endif +static char *my_index (const char *str, int chr); + static char * my_index (str, chr) const char *str; diff --git a/libs/util/idparse.c b/libs/util/idparse.c index 45f5e7ae1..b6e9bef1d 100644 --- a/libs/util/idparse.c +++ b/libs/util/idparse.c @@ -40,6 +40,7 @@ static const char rcsid[] = #include "QF/dstring.h" #include "QF/cbuf.h" #include "QF/cmd.h" +#include "QF/idparse.h" static dstring_t *_com_token; const char *com_token; @@ -120,7 +121,7 @@ COM_TokenizeString (const char *str, cbuf_args_t *args) return; } -void +static void COM_extract_line (cbuf_t *cbuf) { int i; @@ -159,14 +160,14 @@ COM_extract_line (cbuf_t *cbuf) } } -void +static void COM_parse_line (cbuf_t *cbuf) { COM_TokenizeString (cbuf->line->str, cbuf->args); dstring_clearstr (cbuf->line); } -void +static void COM_execute_line (cbuf_t *cbuf) { Cmd_Command (cbuf->args); diff --git a/libs/util/info.c b/libs/util/info.c index 7ce36e99d..a93327c98 100644 --- a/libs/util/info.c +++ b/libs/util/info.c @@ -226,7 +226,7 @@ Info_ParseString (const char *s, int maxsize) if (*end) *end++ = 0; } else { - value = end = ""; + value = end = (char *)""; } Info_SetValueForStarKey (info, key, value, 0); key = end; diff --git a/libs/util/mathlib.c b/libs/util/mathlib.c index e6001d404..2b0e95fd5 100644 --- a/libs/util/mathlib.c +++ b/libs/util/mathlib.c @@ -52,7 +52,7 @@ const vec3_t vec3_origin = { 0, 0, 0 }; #define DEG2RAD(a) (a * (M_PI / 180.0)) -void +static void ProjectPointOnPlane (vec3_t dst, const vec3_t p, const vec3_t normal) { float inv_denom, d; @@ -68,7 +68,7 @@ ProjectPointOnPlane (vec3_t dst, const vec3_t p, const vec3_t normal) } // assumes "src" is normalized -void +static void PerpendicularVector (vec3_t dst, const vec3_t src) { int pos, i; @@ -181,6 +181,7 @@ anglemod (float a) Split out like this for ASM to call. */ +void __attribute__ ((noreturn)) BOPS_Error (void); void __attribute__ ((noreturn)) BOPS_Error (void) { diff --git a/libs/util/plugin.c b/libs/util/plugin.c index 8d04663c7..3f4d3a0dc 100644 --- a/libs/util/plugin.c +++ b/libs/util/plugin.c @@ -138,7 +138,7 @@ pi_info_name (char *info_name, int size, const char *type, const char *name) snprintf (info_name, size, "PluginInfo"); } -void +static void PI_InitCvars (void) { fs_pluginpath = Cvar_Get ("fs_pluginpath", FS_PLUGINPATH, CVAR_ROM, NULL, diff --git a/libs/util/qargs.c b/libs/util/qargs.c index cbdc4f45f..92cc1ee0d 100644 --- a/libs/util/qargs.c +++ b/libs/util/qargs.c @@ -45,21 +45,22 @@ static const char rcsid[] = #include "QF/cmd.h" #include "QF/crc.h" +#include "QF/qargs.h" #include "QF/qtypes.h" #include "QF/sys.h" -static char **largv; -static char *argvdummy = " "; +static const char **largv; +static const char *argvdummy = " "; -static char *safeargvs[] = +static const char *safeargvs[] = { "-stdvid", "-nolan", "-nosound", "-nocdaudio", "-nojoy", "-nomouse", "-dibonly" }; #define NUM_SAFE_ARGVS (sizeof(safeargvs)/sizeof(safeargvs[0])) int com_argc; -char **com_argv; -char *com_cmdline; +const char **com_argv; +const char *com_cmdline; qboolean nouse = false; // 1999-10-29 +USE fix by Maddes @@ -71,7 +72,7 @@ qboolean nouse = false; // 1999-10-29 +USE fix by Maddes where the given parameter apears, or 0 if not present */ int -COM_CheckParm (char *parm) +COM_CheckParm (const char *parm) { int i; @@ -87,15 +88,16 @@ COM_CheckParm (char *parm) } void -COM_InitArgv (int argc, char **argv) +COM_InitArgv (int argc, const char **argv) { qboolean safe; int i, len; + char *cmdline; safe = false; - largv = (char **) calloc (1, (argc + NUM_SAFE_ARGVS + 1) * - sizeof (char **)); + largv = (const char **) calloc (1, (argc + NUM_SAFE_ARGVS + 1) * + sizeof (const char **)); for (com_argc = 0, len = 0; com_argc < argc; com_argc++) { largv[com_argc] = argv[com_argc]; @@ -105,16 +107,17 @@ COM_InitArgv (int argc, char **argv) len += strlen (argv[com_argc]) + 1; } - com_cmdline = (char *) calloc (1, len + 1); // need strlen(com_cmdline)+2 - com_cmdline[0] = 0; + cmdline = (char *) calloc (1, len + 1); // need strlen(cmdline)+2 + cmdline[0] = 0; if (len) { for (i = 1; i < argc; i++) { - strncat (com_cmdline, argv[i], len - strlen (com_cmdline)); - assert (len - strlen (com_cmdline) > 0); - strncat (com_cmdline, " ", len - strlen (com_cmdline)); + strncat (cmdline, argv[i], len - strlen (cmdline)); + assert (len - strlen (cmdline) > 0); + strncat (cmdline, " ", len - strlen (cmdline)); } - com_cmdline[len - 1] = '\0'; + cmdline[len - 1] = '\0'; } + com_cmdline = cmdline; if (safe) { // force all the safe-mode switches. Note that we reserved extra space @@ -139,7 +142,7 @@ COM_InitArgv (int argc, char **argv) Adds the given string at the end of the current argument list */ void -COM_AddParm (char *parm) +COM_AddParm (const char *parm) { largv[com_argc++] = parm; } diff --git a/libs/util/qfplist.c b/libs/util/qfplist.c index 3c8f2fda6..d95abcae5 100644 --- a/libs/util/qfplist.c +++ b/libs/util/qfplist.c @@ -219,7 +219,7 @@ PL_ParseQuotedString (pldata_t *pl) } if (pl->pos - start - shrink == 0) { - str = ""; + str = strdup (""); } else { char chars[pl->pos - start - shrink]; unsigned int j; diff --git a/libs/util/quakefs.c b/libs/util/quakefs.c index 53170d8db..8adca34f6 100644 --- a/libs/util/quakefs.c +++ b/libs/util/quakefs.c @@ -252,7 +252,7 @@ COM_CreatePath (const char *path) } } -QFile * +static QFile * COM_OpenRead (const char *path, int offs, int len, int zip) { QFile *file; @@ -328,7 +328,7 @@ COM_CompressPath (const char *pth) Checks if a string contains an updir ('..'), either at the ends or surrounded by slashes ('/'). Doesn't check for leading slash. */ -int +static int contains_updir (const char *filename) { int i; @@ -566,7 +566,7 @@ COM_LoadStackFile (const char *path, void *buffer, int bufsize) Loads the header and directory, adding the files at the beginning of the list so they override previous pack files. */ -pack_t * +static pack_t * COM_LoadPackFile (char *packfile) { pack_t *pack = pack_open (packfile); @@ -613,7 +613,7 @@ qstrcmp (char **os1, char **os2) } } -void +static void COM_LoadGameDirectory (const char *dir) { searchpath_t *search; @@ -692,7 +692,7 @@ COM_LoadGameDirectory (const char *dir) Sets com_gamedir, adds the directory to the head of the path, then loads and adds pak1.pak pak2.pak ... */ -void +static void COM_AddDirectory (const char *dir) { searchpath_t *search; @@ -720,7 +720,7 @@ COM_AddDirectory (const char *dir) COM_LoadGameDirectory (dir); } -void +static void COM_AddGameDirectory (const char *dir) { Sys_DPrintf ("COM_AddGameDirectory (\"%s/%s\")\n", @@ -852,7 +852,7 @@ COM_FileExtension (const char *in) } void -COM_DefaultExtension (char *path, char *extension) +COM_DefaultExtension (char *path, const char *extension) { char *src; diff --git a/libs/util/string.c b/libs/util/string.c index 75d127f10..045322346 100644 --- a/libs/util/string.c +++ b/libs/util/string.c @@ -34,7 +34,7 @@ static const char rcsid[] = #include #include -#include "compat.h" +#include "qstring.h" #ifdef IRIX #define _vsnprintf vsnprintf diff --git a/libs/util/ver_check.c b/libs/util/ver_check.c index 5bf0d199b..8240c35d2 100644 --- a/libs/util/ver_check.c +++ b/libs/util/ver_check.c @@ -36,6 +36,7 @@ static const char rcsid[] = #include #include "QF/qtypes.h" +#include "QF/ver_check.h" /* diff --git a/libs/util/zone.c b/libs/util/zone.c index 9dc1d8b18..f427af377 100644 --- a/libs/util/zone.c +++ b/libs/util/zone.c @@ -253,8 +253,8 @@ Z_Realloc (memzone_t *zone, void *ptr, int size) return ptr; } - -void +/* +static void Z_Print (memzone_t *zone) { memblock_t *block; @@ -276,7 +276,7 @@ Z_Print (memzone_t *zone) Sys_Printf ("ERROR: two consecutive free blocks\n"); } } - +*/ void Z_CheckHeap (memzone_t *zone) { @@ -339,7 +339,8 @@ Hunk_Check (void) Otherwise, allocations with the same name will be totaled up before printing. */ -void +/* +static void Hunk_Print (qboolean all) { char name[9]; @@ -403,7 +404,7 @@ Hunk_Print (qboolean all) Sys_Printf ("-------------------------\n"); Sys_Printf ("%8i total blocks\n", totalblocks); } - +*/ void * Hunk_AllocName (int size, const char *name) { @@ -577,7 +578,7 @@ static void *Cache_RealAlloc (cache_user_t *c, int size, const char *name); cache_writelock--; } #ifndef MMAPPED_CACHE -void +static void Cache_Move (cache_system_t * c) { cache_system_t *new; @@ -650,7 +651,7 @@ Cache_FreeHigh (int new_high_hunk) #endif } -void +static void Cache_UnlinkLRU (cache_system_t * cs) { if (!cs->lru_next || !cs->lru_prev) @@ -662,7 +663,7 @@ Cache_UnlinkLRU (cache_system_t * cs) cs->lru_prev = cs->lru_next = NULL; } -void +static void Cache_MakeLRU (cache_system_t * cs) { if (cs->lru_next || cs->lru_prev) @@ -674,8 +675,8 @@ Cache_MakeLRU (cache_system_t * cs) cache_head.lru_next = cs; } -qboolean -Cache_FreeLRU () +static qboolean +Cache_FreeLRU (void) { cache_system_t *cs; @@ -805,7 +806,7 @@ Cache_Flush (void) CACHE_WRITE_UNLOCK; } -void +static void Cache_Print (void) { cache_system_t *cd; @@ -827,12 +828,7 @@ Cache_Report (void) CACHE_WRITE_UNLOCK; } -void -Cache_Compact (void) -{ -} - -void +static void Cache_Init (void) { cache_head.next = cache_head.prev = &cache_head; diff --git a/libs/video/renderer/gl/gl_dyn_lights.c b/libs/video/renderer/gl/gl_dyn_lights.c index 4fdf3d089..bdf9ff00c 100644 --- a/libs/video/renderer/gl/gl_dyn_lights.c +++ b/libs/video/renderer/gl/gl_dyn_lights.c @@ -44,8 +44,10 @@ static const char rcsid[] = #include "QF/render.h" #include "QF/GL/defines.h" #include "QF/GL/funcs.h" +#include "QF/GL/qf_rlight.h" #include "r_cvar.h" +#include "r_dynamic.h" #include "r_local.h" #include "r_shared.h" @@ -69,7 +71,7 @@ R_InitBubble (void) } } -void +static void R_RenderDlight (dlight_t *light) { float rad; diff --git a/libs/video/renderer/gl/gl_dyn_part.c b/libs/video/renderer/gl/gl_dyn_part.c index f546e05b3..a3d5d8cd5 100644 --- a/libs/video/renderer/gl/gl_dyn_part.c +++ b/libs/video/renderer/gl/gl_dyn_part.c @@ -54,6 +54,7 @@ static const char rcsid[] = #include "compat.h" #include "r_cvar.h" #include "r_dynamic.h" +#include "r_local.h" #include "r_shared.h" #include "varrays.h" @@ -203,7 +204,7 @@ R_ReadPointFile_f (void) Con_Printf ("%i points read\n", c); } -void +static void R_ParticleExplosion_QF (const vec3_t org) { // R_NewExplosion (org); @@ -214,7 +215,7 @@ R_ParticleExplosion_QF (const vec3_t org) 0.5 + qfrandom (0.25), 0.0); } -void +static void R_ParticleExplosion2_QF (const vec3_t org, int colorStart, int colorLength) { unsigned int i; @@ -233,7 +234,7 @@ R_ParticleExplosion2_QF (const vec3_t org, int colorStart, int colorLength) } } -void +static void R_BlobExplosion_QF (const vec3_t org) { unsigned int i; @@ -285,13 +286,13 @@ R_BloodPuff_QF (const vec3_t org, int count) r_realtime + 99.0, 70 + (rand () & 3), 0.5, 0.0); } -void +static void R_BloodPuffEffect_QF (const vec3_t org, int count) { R_BloodPuff_QF (org, count); } -void +static void R_GunshotEffect_QF (const vec3_t org, int count) { int scale = 16; @@ -301,7 +302,7 @@ R_GunshotEffect_QF (const vec3_t org, int count) R_RunSparkEffect_QF (org, count >> 1, scale); } -void +static void R_LightningBloodEffect_QF (const vec3_t org) { int count = 7; @@ -322,7 +323,7 @@ R_LightningBloodEffect_QF (const vec3_t org) 0.0); } -void +static void R_RunParticleEffect_QF (const vec3_t org, const vec3_t dir, int color, int count) { @@ -349,19 +350,19 @@ R_RunParticleEffect_QF (const vec3_t org, const vec3_t dir, int color, } } -void +static void R_SpikeEffect_QF (const vec3_t org) { R_RunSparkEffect_QF (org, 5, 8); } -void +static void R_SuperSpikeEffect_QF (const vec3_t org) { R_RunSparkEffect_QF (org, 10, 8); } -void +static void R_KnightSpikeEffect_QF (const vec3_t org) { unsigned int count = 10; @@ -378,7 +379,7 @@ R_KnightSpikeEffect_QF (const vec3_t org) r_realtime + 5.0, 234, 1.0, 0.0); } -void +static void R_WizSpikeEffect_QF (const vec3_t org) { unsigned int count = 15; @@ -395,7 +396,7 @@ R_WizSpikeEffect_QF (const vec3_t org) r_realtime + 5.0, 63, 1.0, 0.0); } -void +static void R_LavaSplash_QF (const vec3_t org) { float vel; @@ -431,7 +432,7 @@ R_LavaSplash_QF (const vec3_t org) } } -void +static void R_TeleportSplash_QF (const vec3_t org) { float vel; @@ -470,7 +471,7 @@ R_TeleportSplash_QF (const vec3_t org) } } -void +static void R_RocketTrail_QF (entity_t *ent) { float dist, maxlen, origlen, percent, pscale, pscalenext; @@ -503,7 +504,7 @@ R_RocketTrail_QF (entity_t *ent) } } -void +static void R_GrenadeTrail_QF (entity_t *ent) { float dist, maxlen, origlen, percent, pscale, pscalenext; @@ -536,7 +537,7 @@ R_GrenadeTrail_QF (entity_t *ent) } } -void +static void R_BloodTrail_QF (entity_t *ent) { float dist, maxlen, origlen, percent, pscale, pscalenext; @@ -575,7 +576,7 @@ R_BloodTrail_QF (entity_t *ent) } } -void +static void R_SlightBloodTrail_QF (entity_t *ent) { float dist, maxlen, origlen, percent, pscale, pscalenext; @@ -614,7 +615,7 @@ R_SlightBloodTrail_QF (entity_t *ent) } } -void +static void R_WizTrail_QF (entity_t *ent) { float maxlen, origlen, percent; @@ -654,7 +655,7 @@ R_WizTrail_QF (entity_t *ent) } } -void +static void R_FlameTrail_QF (entity_t *ent) { float maxlen, origlen, percent; @@ -694,7 +695,7 @@ R_FlameTrail_QF (entity_t *ent) } } -void +static void R_VoorTrail_QF (entity_t *ent) { float maxlen, origlen, percent; @@ -726,7 +727,7 @@ R_VoorTrail_QF (entity_t *ent) } } -void +static void R_GlowTrail_QF (entity_t *ent, int glow_color) { float maxlen, origlen, percent; @@ -759,7 +760,7 @@ R_GlowTrail_QF (entity_t *ent, int glow_color) } } -void +static void R_ParticleExplosion_EE (const vec3_t org) { /* @@ -772,7 +773,7 @@ R_ParticleExplosion_EE (const vec3_t org) 0.5 + qfrandom (0.25), 0.0); } -void +static void R_TeleportSplash_EE (const vec3_t org) { float vel; @@ -809,7 +810,7 @@ R_TeleportSplash_EE (const vec3_t org) } } -void +static void R_RocketTrail_EE (entity_t *ent) { float dist, maxlen, origlen, percent, pscale, pscalenext; @@ -843,7 +844,7 @@ R_RocketTrail_EE (entity_t *ent) } } -void +static void R_GrenadeTrail_EE (entity_t *ent) { float dist, maxlen, origlen, percent, pscale, pscalenext; @@ -877,7 +878,7 @@ R_GrenadeTrail_EE (entity_t *ent) } } -void +static void R_ParticleExplosion_ID (const vec3_t org) { unsigned int i; @@ -899,7 +900,7 @@ R_ParticleExplosion_ID (const vec3_t org) } } -void +static void R_BlobExplosion_ID (const vec3_t org) { unsigned int i; @@ -922,7 +923,7 @@ R_BlobExplosion_ID (const vec3_t org) } } -void +static void R_RunParticleEffect_ID (const vec3_t org, const vec3_t dir, int color, int count) { @@ -954,49 +955,49 @@ R_RunParticleEffect_ID (const vec3_t org, const vec3_t dir, int color, } } -void +static void R_BloodPuffEffect_ID (const vec3_t org, int count) { R_RunParticleEffect_ID (org, vec3_origin, 73, count); } -void +static void R_GunshotEffect_ID (const vec3_t org, int count) { R_RunParticleEffect_ID (org, vec3_origin, 0, count); } -void +static void R_LightningBloodEffect_ID (const vec3_t org) { R_RunParticleEffect_ID (org, vec3_origin, 225, 50); } -void +static void R_SpikeEffect_ID (const vec3_t org) { R_RunParticleEffect_ID (org, vec3_origin, 0, 10); } -void +static void R_SuperSpikeEffect_ID (const vec3_t org) { R_RunParticleEffect_ID (org, vec3_origin, 0, 20); } -void +static void R_KnightSpikeEffect_ID (const vec3_t org) { R_RunParticleEffect_ID (org, vec3_origin, 226, 20); } -void +static void R_WizSpikeEffect_ID (const vec3_t org) { R_RunParticleEffect_ID (org, vec3_origin, 20, 30); } -void +static void R_LavaSplash_ID (const vec3_t org) { float vel; @@ -1032,7 +1033,7 @@ R_LavaSplash_ID (const vec3_t org) } } -void +static void R_TeleportSplash_ID (const vec3_t org) { float vel; @@ -1071,7 +1072,7 @@ R_TeleportSplash_ID (const vec3_t org) } } -void +static void R_RocketTrail_ID (entity_t *ent) { float maxlen; @@ -1102,7 +1103,7 @@ R_RocketTrail_ID (entity_t *ent) } } -void +static void R_GrenadeTrail_ID (entity_t *ent) { float maxlen; @@ -1133,7 +1134,7 @@ R_GrenadeTrail_ID (entity_t *ent) } } -void +static void R_BloodTrail_ID (entity_t *ent) { float maxlen; @@ -1163,7 +1164,7 @@ R_BloodTrail_ID (entity_t *ent) } } -void +static void R_SlightBloodTrail_ID (entity_t *ent) { float maxlen; @@ -1193,7 +1194,7 @@ R_SlightBloodTrail_ID (entity_t *ent) } } -void +static void R_WizTrail_ID (entity_t *ent) { float maxlen; @@ -1229,7 +1230,7 @@ R_WizTrail_ID (entity_t *ent) } } -void +static void R_FlameTrail_ID (entity_t *ent) { float maxlen; @@ -1265,7 +1266,7 @@ R_FlameTrail_ID (entity_t *ent) } } -void +static void R_VoorTrail_ID (entity_t *ent) { float maxlen; @@ -1609,7 +1610,7 @@ r_particles_style_f (cvar_t *var) } } -void +static void R_ParticleFunctionInit (void) { r_particles_style_f (r_particles_style); diff --git a/libs/video/renderer/gl/gl_dyn_textures.c b/libs/video/renderer/gl/gl_dyn_textures.c index c3fc1d643..c1a9f11c4 100644 --- a/libs/video/renderer/gl/gl_dyn_textures.c +++ b/libs/video/renderer/gl/gl_dyn_textures.c @@ -43,6 +43,7 @@ static const char rcsid[] = #include "QF/GL/defines.h" #include "QF/GL/funcs.h" #include "QF/GL/qf_noisetextures.h" +#include "QF/GL/qf_textures.h" #include "QF/GL/qf_vid.h" /* diff --git a/libs/video/renderer/gl/gl_graph.c b/libs/video/renderer/gl/gl_graph.c index 80bada753..f08488034 100644 --- a/libs/video/renderer/gl/gl_graph.c +++ b/libs/video/renderer/gl/gl_graph.c @@ -42,6 +42,7 @@ static const char rcsid[] = #include "QF/cvar.h" #include "QF/draw.h" +#include "QF/render.h" #include "QF/sys.h" #include "QF/GL/defines.h" #include "QF/GL/funcs.h" diff --git a/libs/video/renderer/gl/gl_mod_alias.c b/libs/video/renderer/gl/gl_mod_alias.c index e70d3a482..bc54583ce 100644 --- a/libs/video/renderer/gl/gl_mod_alias.c +++ b/libs/video/renderer/gl/gl_mod_alias.c @@ -258,7 +258,7 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, vert_order_t *vo) } } -vert_order_t * +static vert_order_t * GL_GetAliasFrameVerts16 (int frame, aliashdr_t *paliashdr, entity_t *e) { float interval; @@ -362,7 +362,7 @@ GL_GetAliasFrameVerts16 (int frame, aliashdr_t *paliashdr, entity_t *e) return vo; } -vert_order_t * +static vert_order_t * GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e) { float interval; @@ -464,7 +464,7 @@ GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e) return vo; } -maliasskindesc_t * +static maliasskindesc_t * R_AliasGetSkindesc (int skinnum, aliashdr_t *ahdr) { maliasskindesc_t *pskindesc; diff --git a/libs/video/renderer/gl/gl_rmain.c b/libs/video/renderer/gl/gl_rmain.c index 1338965f4..6d504d48c 100644 --- a/libs/video/renderer/gl/gl_rmain.c +++ b/libs/video/renderer/gl/gl_rmain.c @@ -54,6 +54,7 @@ static const char rcsid[] = #include "QF/GL/defines.h" #include "QF/GL/funcs.h" #include "QF/GL/qf_rlight.h" +#include "QF/GL/qf_rmain.h" #include "QF/GL/qf_rsurf.h" #include "QF/GL/qf_screen.h" #include "QF/GL/qf_vid.h" diff --git a/libs/video/renderer/gl/gl_rmisc.c b/libs/video/renderer/gl/gl_rmisc.c index efcdb89c9..be042b00f 100644 --- a/libs/video/renderer/gl/gl_rmisc.c +++ b/libs/video/renderer/gl/gl_rmisc.c @@ -67,7 +67,7 @@ int r_init = 0; Grab six views for environment mapping tests */ -void +static void R_Envmap_f (void) { byte buffer[256 * 256 * 4]; diff --git a/libs/video/renderer/gl/gl_screen.c b/libs/video/renderer/gl/gl_screen.c index 4dc796f70..8a96c459a 100644 --- a/libs/video/renderer/gl/gl_screen.c +++ b/libs/video/renderer/gl/gl_screen.c @@ -217,7 +217,7 @@ SCR_ScreenShot_f (void) Con_Printf ("Wrote %s\n", pcxname); } -void +static void SCR_TileClear (void) { if (r_refdef.vrect.x > 0) { diff --git a/libs/video/renderer/gl/gl_sky.c b/libs/video/renderer/gl/gl_sky.c index 2d66c3de0..981f46a6b 100644 --- a/libs/video/renderer/gl/gl_sky.c +++ b/libs/video/renderer/gl/gl_sky.c @@ -56,7 +56,7 @@ static const char rcsid[] = #include "r_shared.h" #include "view.h" -char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" }; +const char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" }; int solidskytexture; int alphaskytexture; @@ -109,7 +109,7 @@ R_LoadSkys (const char *skyname) Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname); } -inline void +static inline void R_SkyBoxPolyVec (vec5_t v) { // avoid interpolation seams @@ -165,7 +165,7 @@ vec5_t skyvec[6][4] = { }; #undef ftc -void +static void R_DrawSkyBox (void) { int i, j; @@ -186,7 +186,7 @@ R_DrawSkyBox (void) vec3_t domescale; -void +static void R_DrawSkyLayer (float s) { float x, y, a1x, a1y, a2x, a2y; @@ -230,7 +230,7 @@ R_DrawSkyLayer (float s) } } -void +static void R_DrawSkyDome (void) { float speedscale; // for top sky and bottom sky diff --git a/libs/video/renderer/gl/gl_sky_clip.c b/libs/video/renderer/gl/gl_sky_clip.c index fb29065ba..4737e83f2 100644 --- a/libs/video/renderer/gl/gl_sky_clip.c +++ b/libs/video/renderer/gl/gl_sky_clip.c @@ -599,7 +599,7 @@ render_box (const struct box_def *box) } } -void +static void R_DrawSkyBoxPoly (const glpoly_t *poly) { int i; @@ -657,7 +657,7 @@ R_DrawSkyBoxPoly (const glpoly_t *poly) render_box (&box); } -void +static void EmitSkyPolys (float speedscale, const msurface_t *fa) { float length, s, t; diff --git a/libs/video/renderer/gl/gl_textures.c b/libs/video/renderer/gl/gl_textures.c index c944f4514..cbd93d9a6 100644 --- a/libs/video/renderer/gl/gl_textures.c +++ b/libs/video/renderer/gl/gl_textures.c @@ -70,7 +70,7 @@ static gltexture_t gltextures[MAX_GLTEXTURES]; static int numgltextures = 0; typedef struct { - char *name; + const char *name; int minimize, maximize; } glmode_t; @@ -84,10 +84,10 @@ static glmode_t modes[] = { }; typedef struct { - char *name; + const char *name; int format; } glformat_t; - +#if 0 static glformat_t formats[] = { /* 1-4 are standardly supported formats by GL, not exactly the @@ -174,7 +174,7 @@ static glformat_t formats[] = { */ {"NULL", 0} }; - +#endif int gl_alpha_format = 4, gl_lightmap_format = 4, gl_solid_format = 3; @@ -218,8 +218,8 @@ GL_TextureMode_f (void) } } } - -int +#if 0 +static int GL_TextureDepth_f (int format) { int i; @@ -245,7 +245,7 @@ GL_TextureDepth_f (int format) return formats[i].format; } - +#endif static void GL_ResampleTexture (unsigned int *in, int inwidth, int inheight, unsigned int *out, int outwidth, int outheight) diff --git a/libs/video/renderer/gl/gl_warp.c b/libs/video/renderer/gl/gl_warp.c index 5c4fd5ded..1f54c0109 100644 --- a/libs/video/renderer/gl/gl_warp.c +++ b/libs/video/renderer/gl/gl_warp.c @@ -39,6 +39,7 @@ static const char rcsid[] = #include "QF/GL/defines.h" #include "QF/GL/funcs.h" +#include "QF/GL/qf_rsurf.h" // speed up sin calculations - Ed float turbsin[] = { diff --git a/libs/video/renderer/gl/noisetextures.c b/libs/video/renderer/gl/noisetextures.c index 0db4e3cd1..4df66f9a8 100644 --- a/libs/video/renderer/gl/noisetextures.c +++ b/libs/video/renderer/gl/noisetextures.c @@ -45,6 +45,7 @@ static const char rcsid[] = #include "QF/mathlib.h" #include "QF/sys.h" +#include "QF/GL/qf_noisetextures.h" #include "compat.h" diff --git a/libs/video/renderer/r_cvar.c b/libs/video/renderer/r_cvar.c index fc0eb57f3..6e514dc88 100644 --- a/libs/video/renderer/r_cvar.c +++ b/libs/video/renderer/r_cvar.c @@ -39,6 +39,7 @@ static const char rcsid[] = #include "QF/cvar.h" #include "QF/model.h" #include "QF/qendian.h" +#include "QF/render.h" #include "compat.h" #include "r_cvar.h" diff --git a/libs/video/renderer/r_efrag.c b/libs/video/renderer/r_efrag.c index c9ee339ed..3b87a42e9 100644 --- a/libs/video/renderer/r_efrag.c +++ b/libs/video/renderer/r_efrag.c @@ -91,7 +91,7 @@ R_RemoveEfrags (entity_t *ent) static mnode_t *node_stack[NODE_STACK_SIZE]; static mnode_t **node_ptr = node_stack + NODE_STACK_SIZE; -void +static void R_SplitEntityOnNode (mnode_t *node) { efrag_t *ef; diff --git a/libs/video/renderer/r_ent.c b/libs/video/renderer/r_ent.c index 25b61151d..f876c864e 100644 --- a/libs/video/renderer/r_ent.c +++ b/libs/video/renderer/r_ent.c @@ -54,11 +54,6 @@ int r_numvisedicts; entity_t *r_visedicts[MAX_VISEDICTS]; -void -R_Ents_Init (void) -{ -} - void R_ClearEnts (void) { diff --git a/libs/video/renderer/r_light.c b/libs/video/renderer/r_light.c index 2ec50551c..c84f40f2c 100644 --- a/libs/video/renderer/r_light.c +++ b/libs/video/renderer/r_light.c @@ -45,6 +45,7 @@ static const char rcsid[] = #include "compat.h" #include "r_cvar.h" +#include "r_dynamic.h" #include "r_local.h" #include "r_shared.h" @@ -382,7 +383,7 @@ calc_lighting_3 (msurface_t *surf, int ds, int dt) return r; } -int +static int RecursiveLightPoint (mnode_t *node, const vec3_t start, const vec3_t end) { int i, r, s, t, ds, dt, side; diff --git a/libs/video/renderer/r_part.c b/libs/video/renderer/r_part.c index cc765cb13..83d11217f 100644 --- a/libs/video/renderer/r_part.c +++ b/libs/video/renderer/r_part.c @@ -38,6 +38,7 @@ static const char rcsid[] = #include "QF/render.h" #include "compat.h" +#include "r_dynamic.h" #include "r_local.h" unsigned int r_maxparticles, numparticles; @@ -52,19 +53,19 @@ void (*R_WizTrail) (struct entity_s *ent); void (*R_FlameTrail) (struct entity_s *ent); void (*R_VoorTrail) (struct entity_s *ent); void (*R_GlowTrail) (struct entity_s *ent, int glow_color); -void (*R_RunParticleEffect) (vec3_t org, vec3_t dir, int color, int count); -void (*R_BloodPuffEffect) (vec3_t org, int count); -void (*R_GunshotEffect) (vec3_t org, int count); -void (*R_LightningBloodEffect) (vec3_t org); -void (*R_SpikeEffect) (vec3_t org); -void (*R_KnightSpikeEffect) (vec3_t org); -void (*R_SuperSpikeEffect) (vec3_t org); -void (*R_WizSpikeEffect) (vec3_t org); -void (*R_BlobExplosion) (vec3_t org); -void (*R_ParticleExplosion) (vec3_t org); -void (*R_ParticleExplosion2) (vec3_t org, int colorStart, int colorLength); -void (*R_LavaSplash) (vec3_t org); -void (*R_TeleportSplash) (vec3_t org); +void (*R_RunParticleEffect) (const vec3_t org, const vec3_t dir, int color, int count); +void (*R_BloodPuffEffect) (const vec3_t org, int count); +void (*R_GunshotEffect) (const vec3_t org, int count); +void (*R_LightningBloodEffect) (const vec3_t org); +void (*R_SpikeEffect) (const vec3_t org); +void (*R_KnightSpikeEffect) (const vec3_t org); +void (*R_SuperSpikeEffect) (const vec3_t org); +void (*R_WizSpikeEffect) (const vec3_t org); +void (*R_BlobExplosion) (const vec3_t org); +void (*R_ParticleExplosion) (const vec3_t org); +void (*R_ParticleExplosion2) (const vec3_t org, int colorStart, int colorLength); +void (*R_LavaSplash) (const vec3_t org); +void (*R_TeleportSplash) (const vec3_t org); /* diff --git a/libs/video/renderer/r_screen.c b/libs/video/renderer/r_screen.c index bb9823e2d..ace36f42b 100644 --- a/libs/video/renderer/r_screen.c +++ b/libs/video/renderer/r_screen.c @@ -159,7 +159,7 @@ SCR_CenterPrint (const char *str) } } -void +static void SCR_DrawCenterString (void) { char *start; @@ -242,7 +242,7 @@ CalcFov (float fov_x, float width, float height) Keybinding command */ -void +static void SCR_SizeUp_f (void) { if (scr_viewsize->int_val < 120) { @@ -256,7 +256,7 @@ SCR_SizeUp_f (void) Keybinding command */ -void +static void SCR_SizeDown_f (void) { Cvar_SetValue (scr_viewsize, scr_viewsize->int_val - 10); @@ -295,6 +295,7 @@ SCR_DrawTurtle (void) Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle); } +extern int fps_count; //FIXME void SCR_DrawFPS (void) @@ -305,8 +306,6 @@ SCR_DrawFPS (void) int i, x, y; static int lastfps; - extern int fps_count; //FIXME - if (!show_fps->int_val) return; @@ -343,7 +342,7 @@ void SCR_DrawTime (void) { char st[80]; - char *timefmt = NULL; + const char *timefmt = NULL; int x, y; struct tm *local = NULL; time_t utc = 0; @@ -462,7 +461,7 @@ MipColor (int r, int g, int b) // in draw.c -void +static void SCR_DrawCharToSnap (int num, byte * dest, int width) { byte *source; @@ -503,38 +502,6 @@ SCR_DrawStringToSnap (const char *s, tex_t *tex, int x, int y) } } -char *scr_notifystring; - -void -SCR_DrawNotifyString (void) -{ - char *start; - int l, x, y; - - start = scr_notifystring; - - y = vid.height * 0.35; - - do { - // scan the width of the line - for (l = 0; l < 40; l++) - if (start[l] == '\n' || !start[l]) - break; - x = (vid.width - l * 8) / 2; - Draw_nString (x, y, start, l); - - y += 8; - - while (*start && *start != '\n') - start++; - - if (!*start) - break; - start++; // skip the \n - } while (1); -} - - void SCR_Init (void) { diff --git a/libs/video/renderer/sw/d_edge.c b/libs/video/renderer/sw/d_edge.c index 0df0ea895..eaf789238 100644 --- a/libs/video/renderer/sw/d_edge.c +++ b/libs/video/renderer/sw/d_edge.c @@ -74,7 +74,7 @@ D_MipLevelForScale (float scale) // FIXME: clean this up -void +static void D_DrawSolidSurface (surf_t *surf, int color) { espan_t *span; @@ -106,7 +106,7 @@ D_DrawSolidSurface (surf_t *surf, int color) } -void +static void D_CalcGradients (msurface_t *pface) { mplane_t *pplane; diff --git a/libs/video/renderer/sw/d_init.c b/libs/video/renderer/sw/d_init.c index 6e1550b10..3cf896ee4 100644 --- a/libs/video/renderer/sw/d_init.c +++ b/libs/video/renderer/sw/d_init.c @@ -68,18 +68,6 @@ D_Init (void) VID_InitBuffers (); } -void -D_CopyRects (vrect_t *prects, int transparent) -{ -/* - this function is only required if the CPU doesn't have direct access to the - back buffer, and there's some driver interface function that the driver - doesn't support and requires Quake to do in software (such as drawing the - console); Quake will then draw into wherever the driver points vid.buffer - and will call this function before swapping buffers -*/ -} - void D_EnableBackBufferAccess (void) { diff --git a/libs/video/renderer/sw/d_modech.c b/libs/video/renderer/sw/d_modech.c index a42303e34..dcfe4d651 100644 --- a/libs/video/renderer/sw/d_modech.c +++ b/libs/video/renderer/sw/d_modech.c @@ -44,7 +44,7 @@ int d_scantable[MAXHEIGHT]; short *zspantable[MAXHEIGHT]; -void +static void D_Patch (void) { #ifdef PIC diff --git a/libs/video/renderer/sw/d_polyse.c b/libs/video/renderer/sw/d_polyse.c index 71c8c795d..816f22c78 100644 --- a/libs/video/renderer/sw/d_polyse.c +++ b/libs/video/renderer/sw/d_polyse.c @@ -485,7 +485,7 @@ D_PolysetScanLeftEdge (int height) #endif // !USE_INTEL_ASM -void +static void D_PolysetSetUpForLineScan (fixed8_t startvertu, fixed8_t startvertv, fixed8_t endvertu, fixed8_t endvertv) { @@ -575,10 +575,10 @@ D_PolysetCalcGradients (int skinwidth) } #endif // !USE_INTEL_ASM - +#if 0 //XXX eh? byte gelmap[256]; -void +static void InitGel (byte * palette) { int i; @@ -592,7 +592,7 @@ InitGel (byte * palette) gelmap[i] = /* 64 */ 0 + r; } } - +#endif #ifndef USE_INTEL_ASM void @@ -654,37 +654,6 @@ D_PolysetDrawSpans8 (spanpackage_t * pspanpackage) #endif // !USE_INTEL_ASM -void -D_PolysetFillSpans8 (spanpackage_t * pspanpackage) -{ - int color; - -// FIXME: do z buffering - - color = d_aflatcolor++; - - while (1) { - int lcount; - byte *lpdest; - - lcount = pspanpackage->count; - - if (lcount == -1) - return; - - if (lcount) { - lpdest = pspanpackage->pdest; - - do { - *lpdest++ = color; - } while (--lcount); - } - - pspanpackage++; - } -} - - void D_RasterizeAliasPolySmooth (void) { diff --git a/libs/video/renderer/sw/d_sky.c b/libs/video/renderer/sw/d_sky.c index 2a8c9efb9..42f0a1c21 100644 --- a/libs/video/renderer/sw/d_sky.c +++ b/libs/video/renderer/sw/d_sky.c @@ -40,7 +40,7 @@ static const char rcsid[] = #define SKY_SPAN_MAX (1 << SKY_SPAN_SHIFT) -void +static void D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t) { float wu, wv, temp; diff --git a/libs/video/renderer/sw/d_sprite.c b/libs/video/renderer/sw/d_sprite.c index a4fa993e6..123e86175 100644 --- a/libs/video/renderer/sw/d_sprite.c +++ b/libs/video/renderer/sw/d_sprite.c @@ -196,7 +196,7 @@ D_SpriteDrawSpans (sspan_t *pspan) } #endif -void +static void D_SpriteScanLeftEdge (void) { int i, v, itop, ibottom, lmaxindex; @@ -250,7 +250,7 @@ D_SpriteScanLeftEdge (void) } while (i != lmaxindex); } -void +static void D_SpriteScanRightEdge (void) { int i, v, itop, ibottom; @@ -324,7 +324,7 @@ D_SpriteScanRightEdge (void) pspan->count = DS_SPAN_LIST_END; // mark the end of the span list } -void +static void D_SpriteCalculateGradients (void) { vec3_t p_normal, p_saxis, p_taxis, p_temp1; diff --git a/libs/video/renderer/sw/d_surf.c b/libs/video/renderer/sw/d_surf.c index f746c241d..8b9087596 100644 --- a/libs/video/renderer/sw/d_surf.c +++ b/libs/video/renderer/sw/d_surf.c @@ -34,6 +34,7 @@ static const char rcsid[] = #include #include "QF/qargs.h" +#include "QF/render.h" #include "QF/sys.h" #include "compat.h" @@ -74,7 +75,7 @@ D_SurfaceCacheForRes (int width, int height) return size; } -void +static void D_CheckCacheGuard (void) { byte *s; @@ -86,7 +87,7 @@ D_CheckCacheGuard (void) Sys_Error ("D_CheckCacheGuard: failed"); } -void +static void D_ClearCacheGuard (void) { byte *s; @@ -134,7 +135,7 @@ D_FlushCaches (void) sc_base->size = sc_size; } -surfcache_t * +static surfcache_t * D_SCAlloc (int width, int size) { surfcache_t *new; @@ -212,7 +213,8 @@ D_SCAlloc (int width, int size) return new; } -void +#if 0 +static void D_SCDump (void) { surfcache_t *test; @@ -224,33 +226,7 @@ D_SCDump (void) test->width); } } - -// if the num is not a power of 2, assume it will not repeat -int -MaskForNum (int num) -{ - if (num == 128) - return 127; - if (num == 64) - return 63; - if (num == 32) - return 31; - if (num == 16) - return 15; - return 255; -} - -int -D_log2 (int num) -{ - int c; - - c = 0; - - while (num >>= 1) - c++; - return c; -} +#endif surfcache_t * D_CacheSurface (msurface_t *surface, int miplevel) diff --git a/libs/video/renderer/sw/draw.c b/libs/video/renderer/sw/draw.c index d1b7fb935..1bca92203 100644 --- a/libs/video/renderer/sw/draw.c +++ b/libs/video/renderer/sw/draw.c @@ -282,7 +282,7 @@ Draw_AltString (int x, int y, const char *str) } -void +static void Draw_Pixel (int x, int y, byte color) { byte *dest; @@ -509,7 +509,7 @@ Draw_ConsoleBackground (int lines) lines - 14, cl_verstring->string); } -void +static void R_DrawRect (vrect_t *prect, int rowbytes, byte * psrc, int transparent) { byte t; diff --git a/libs/video/renderer/sw/screen.c b/libs/video/renderer/sw/screen.c index 1089efdff..34de783e1 100644 --- a/libs/video/renderer/sw/screen.c +++ b/libs/video/renderer/sw/screen.c @@ -145,7 +145,7 @@ SCR_CalcRefdef (void) } -void +static void SCR_ApplyBlend (void) // Used to be V_UpdatePalette { int r, g, b, i; diff --git a/libs/video/renderer/sw/sw_raclip.c b/libs/video/renderer/sw/sw_raclip.c index 1afb71716..188594ccf 100644 --- a/libs/video/renderer/sw/sw_raclip.c +++ b/libs/video/renderer/sw/sw_raclip.c @@ -44,7 +44,7 @@ static auxvert_t av[8]; pfv0 is the unclipped vertex, pfv1 is the z-clipped vertex */ -void +static void R_Alias_clip_z (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) { float scale; @@ -175,7 +175,7 @@ R_Alias_clip_bottom (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) #endif -int +static int R_AliasClip (finalvert_t *in, finalvert_t *out, int flag, int count, void (*clip) (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)) diff --git a/libs/video/renderer/sw/sw_ralias.c b/libs/video/renderer/sw/sw_ralias.c index a99a96722..c1b06c683 100644 --- a/libs/video/renderer/sw/sw_ralias.c +++ b/libs/video/renderer/sw/sw_ralias.c @@ -246,7 +246,7 @@ R_AliasTransformVector (vec3_t in, vec3_t out) } -void +static void R_AliasClipAndProjectFinalVert (finalvert_t *fv, auxvert_t *av) { if (av->fv[2] < ALIAS_Z_CLIP_PLANE) { @@ -266,7 +266,7 @@ R_AliasClipAndProjectFinalVert (finalvert_t *fv, auxvert_t *av) fv->flags |= ALIAS_BOTTOM_CLIP; } -void +static void R_AliasTransformFinalVert16 (finalvert_t *fv, auxvert_t *av, trivertx_t *pverts) { trivertx_t * pextra; @@ -284,7 +284,7 @@ R_AliasTransformFinalVert16 (finalvert_t *fv, auxvert_t *av, trivertx_t *pverts) aliastransform[2][3]; } -void +static void R_AliasTransformFinalVert8 (finalvert_t *fv, auxvert_t *av, trivertx_t *pverts) { av->fv[0] = DotProduct (pverts->v, aliastransform[0]) + @@ -300,7 +300,7 @@ R_AliasTransformFinalVert8 (finalvert_t *fv, auxvert_t *av, trivertx_t *pverts) General clipped case */ -void +static void R_AliasPreparePoints (void) { int i; @@ -528,7 +528,7 @@ R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av) fv->v[1] = (av->fv[1] * aliasyscale * zi) + aliasycenter; } -void +static void R_AliasPrepareUnclippedPoints (void) { stvert_t *pstverts; @@ -553,7 +553,7 @@ R_AliasPrepareUnclippedPoints (void) } -void +static void R_AliasSetupSkin (void) { int skinnum; @@ -614,7 +614,7 @@ R_AliasSetupSkin (void) } -void +static void R_AliasSetupLighting (alight_t *plighting) { // guarantee that no vertex will ever be lit below LIGHT_MIN, so we don't @@ -648,7 +648,7 @@ R_AliasSetupLighting (alight_t *plighting) set r_apverts */ -void +static void R_AliasSetupFrame (void) { int frame; diff --git a/libs/video/renderer/sw/sw_rbsp.c b/libs/video/renderer/sw/sw_rbsp.c index 3f7c8d134..bc3f120fe 100644 --- a/libs/video/renderer/sw/sw_rbsp.c +++ b/libs/video/renderer/sw/sw_rbsp.c @@ -66,7 +66,7 @@ static mvertex_t *pfrontenter, *pfrontexit; static qboolean makeclippededge; -void +static void R_EntityRotate (vec3_t vec) { vec3_t tvec; @@ -150,7 +150,7 @@ R_RotateBmodel (void) } -void +static void R_RecursiveClipBPoly (bedge_t *pedges, mnode_t *pnode, msurface_t *psurf) { bedge_t *psideedges[2], *pnextedge, *ptedge; @@ -396,7 +396,7 @@ R_DrawSubmodelPolygons (model_t *pmodel, int clipflags) } -void +static void R_RecursiveWorldNode (mnode_t *node, int clipflags) { int i, c, side, *pindex; diff --git a/libs/video/renderer/sw/sw_rdraw.c b/libs/video/renderer/sw/sw_rdraw.c index 22b6820ba..2db49dff1 100644 --- a/libs/video/renderer/sw/sw_rdraw.c +++ b/libs/video/renderer/sw/sw_rdraw.c @@ -329,7 +329,7 @@ R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip) #endif // !USE_INTEL_ASM -void +static void R_EmitCachedEdge (void) { edge_t *pedge_t; diff --git a/libs/video/renderer/sw/sw_redge.c b/libs/video/renderer/sw/sw_redge.c index 96aab0916..9182336b3 100644 --- a/libs/video/renderer/sw/sw_redge.c +++ b/libs/video/renderer/sw/sw_redge.c @@ -79,7 +79,7 @@ edge_t edge_sentinel; float fv; -void +static void R_DrawCulledPolys (void) { surf_t *s; @@ -251,132 +251,6 @@ R_StepActiveU (edge_t *pedge) #endif // !USE_INTEL_ASM -void -R_CleanupSpan (void) -{ - surf_t *surf; - int iu; - espan_t *span; - - // now that we've reached the right edge of the screen, we're done with any - // unfinished surfaces, so emit a span for whatever's on top - surf = surfaces[1].next; - iu = edge_tail_u_shift20; - if (iu > surf->last_u) { - span = span_p++; - span->u = surf->last_u; - span->count = iu - span->u; - span->v = current_iv; - span->pnext = surf->spans; - surf->spans = span; - } - // reset spanstate for all surfaces in the surface stack - do { - surf->spanstate = 0; - surf = surf->next; - } while (surf != &surfaces[1]); -} - -void -R_LeadingEdgeBackwards (edge_t *edge) -{ - espan_t *span; - surf_t *surf, *surf2; - int iu; - - // it's adding a new surface in, so find the correct place - surf = &surfaces[edge->surfs[1]]; - - // don't start a span if this is an inverted span, with the end edge - // preceding the start edge (that is, we've already seen the end edge) - if (++surf->spanstate == 1) { - surf2 = surfaces[1].next; - - if (surf->key > surf2->key) - goto newtop; - - // if it's two surfaces on the same plane, the one that's already - // active is in front, so keep going unless it's a bmodel - if (surf->insubmodel && (surf->key == surf2->key)) { - // must be two bmodels in the same leaf; don't care, because - // they'll never be farthest anyway - goto newtop; - } - - continue_search: - - do { - surf2 = surf2->next; - } while (surf->key < surf2->key); - - if (surf->key == surf2->key) { - // if it's two surfaces on the same plane, the one that's already - // active is in front, so keep going unless it's a bmodel - if (!surf->insubmodel) - goto continue_search; - - // must be two bmodels in the same leaf; don't care which is - // really in front, because they'll never be farthest anyway - } - - goto gotposition; - - newtop: - // emit a span (obscures current top) - iu = edge->u >> 20; - - if (iu > surf2->last_u) { - span = span_p++; - span->u = surf2->last_u; - span->count = iu - span->u; - span->v = current_iv; - span->pnext = surf2->spans; - surf2->spans = span; - } - // set last_u on the new span - surf->last_u = iu; - - gotposition: - // insert before surf2 - surf->next = surf2; - surf->prev = surf2->prev; - surf2->prev->next = surf; - surf2->prev = surf; - } -} - -void -R_TrailingEdge (surf_t *surf, edge_t *edge) -{ - espan_t *span; - int iu; - - // don't generate a span if this is an inverted span, with the end edge - // preceding the start edge (that is, we haven't seen the start edge yet) - if (--surf->spanstate == 0) { - if (surf->insubmodel) - r_bmodelactive--; - - if (surf == surfaces[1].next) { - // emit a span (current top going away) - iu = edge->u >> 20; - if (iu > surf->last_u) { - span = span_p++; - span->u = surf->last_u; - span->count = iu - span->u; - span->v = current_iv; - span->pnext = surf->spans; - surf->spans = span; - } - // set last_u on the surface below - surf->next->last_u = iu; - } - - surf->prev->next = surf->next; - surf->next->prev = surf->prev; - } -} - #ifndef USE_INTEL_ASM void @@ -520,29 +394,6 @@ R_GenerateSpans (void) #endif // !USE_INTEL_ASM -void -R_GenerateSpansBackward (void) -{ - edge_t *edge; - - r_bmodelactive = 0; - - // clear active surfaces to just the background surface - surfaces[1].next = surfaces[1].prev = &surfaces[1]; - surfaces[1].last_u = edge_head_u_shift20; - - // generate spans - for (edge = edge_head.next; edge != &edge_tail; edge = edge->next) { - if (edge->surfs[0]) - R_TrailingEdge (&surfaces[edge->surfs[0]], edge); - - if (edge->surfs[1]) - R_LeadingEdgeBackwards (edge); - } - - R_CleanupSpan (); -} - /* R_ScanEdges diff --git a/libs/video/renderer/sw/sw_rmain.c b/libs/video/renderer/sw/sw_rmain.c index 303f675a6..983a37edc 100644 --- a/libs/video/renderer/sw/sw_rmain.c +++ b/libs/video/renderer/sw/sw_rmain.c @@ -475,7 +475,7 @@ R_ShowNearestLoc (void) } } -void +static void R_DrawEntitiesOnList (void) { int i, j; @@ -544,7 +544,7 @@ R_DrawEntitiesOnList (void) } } -void +static void R_DrawViewModel (void) { // FIXME: remove and do real lighting @@ -604,7 +604,7 @@ R_DrawViewModel (void) R_AliasDrawModel (&r_viewlighting); } -int +static int R_BmodelCheckBBox (model_t *clmodel, float *minmaxs) { int i, *pindex, clipflags; @@ -658,7 +658,7 @@ R_BmodelCheckBBox (model_t *clmodel, float *minmaxs) return clipflags; } -void +static void R_DrawBEntitiesOnList (void) { int i, j, k, clipflags; @@ -769,7 +769,7 @@ R_DrawBEntitiesOnList (void) insubmodel = false; } -void +static void R_EdgeDrawing (void) { edge_t ledges[NUMSTACKEDGES + @@ -836,7 +836,7 @@ R_EdgeDrawing (void) r_refdef must be set before the first call */ -void +static void R_RenderView_ (void) { byte warpbuffer[WARP_WIDTH * WARP_HEIGHT]; diff --git a/libs/video/renderer/sw/sw_rmisc.c b/libs/video/renderer/sw/sw_rmisc.c index 4f8c386d0..a6b865cf3 100644 --- a/libs/video/renderer/sw/sw_rmisc.c +++ b/libs/video/renderer/sw/sw_rmisc.c @@ -42,28 +42,11 @@ static const char rcsid[] = #include "r_local.h" -void +static void R_CheckVariables (void) { } -/* - Show - - Debugging use -*/ -void -Show (void) -{ - vrect_t vr; - - vr.x = vr.y = 0; - vr.width = vid.width; - vr.height = vid.height; - vr.pnext = NULL; - VID_Update (&vr); -} - /* R_TimeRefresh_f @@ -157,28 +140,6 @@ R_PrintAliasStats (void) Con_Printf ("%3i polygon model drawn\n", r_amodels_drawn); } -void -WarpPalette (void) -{ - int i, j; - byte newpalette[768]; - int basecolor[3]; - - basecolor[0] = 130; - basecolor[1] = 80; - basecolor[2] = 50; - - // pull the colors halfway to bright brown - for (i = 0; i < 256; i++) { - for (j = 0; j < 3; j++) { - newpalette[i * 3 + j] = - (vid.palette[i * 3 + j] + basecolor[j]) / 2; - } - } - - VID_ShiftPalette (newpalette); -} - void R_TransformFrustum (void) { @@ -225,7 +186,7 @@ R_TransformPlane (mplane_t *p, float *normal, float *dist) TransformVector (p->normal, normal); } -void +static void R_SetUpFrustumIndexes (void) { int i, j, *pindex; diff --git a/libs/video/renderer/sw/sw_rpart.c b/libs/video/renderer/sw/sw_rpart.c index ef452cbdb..bfc698d43 100644 --- a/libs/video/renderer/sw/sw_rpart.c +++ b/libs/video/renderer/sw/sw_rpart.c @@ -117,7 +117,7 @@ R_ReadPointFile_f (void) Con_Printf ("%i points read\n", c); } -void +static void R_ParticleExplosion_QF (const vec3_t org) { int i, j; @@ -153,7 +153,7 @@ R_ParticleExplosion_QF (const vec3_t org) } } -void +static void R_ParticleExplosion2_QF (const vec3_t org, int colorStart, int colorLength) { int i, j; @@ -182,7 +182,7 @@ R_ParticleExplosion2_QF (const vec3_t org, int colorStart, int colorLength) } } -void +static void R_BlobExplosion_QF (const vec3_t org) { int i, j; @@ -219,7 +219,7 @@ R_BlobExplosion_QF (const vec3_t org) } } -void +static void R_RunParticleEffect_QF (const vec3_t org, const vec3_t dir, int color, int count) { @@ -247,49 +247,49 @@ R_RunParticleEffect_QF (const vec3_t org, const vec3_t dir, int color, } } -void +static void R_SpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 0, 10); } -void +static void R_SuperSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect (org, vec3_origin, 0, 20); } -void +static void R_KnightSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 226, 20); } -void +static void R_WizSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 20, 30); } -void +static void R_BloodPuffEffect_QF (const vec3_t org, int count) { R_RunParticleEffect_QF (org, vec3_origin, 73, count); } -void +static void R_GunshotEffect_QF (const vec3_t org, int count) { R_RunParticleEffect_QF (org, vec3_origin, 0, count); } -void +static void R_LightningBloodEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 225, 50); } -void +static void R_LavaSplash_QF (const vec3_t org) { int i, j, k; @@ -328,7 +328,7 @@ R_LavaSplash_QF (const vec3_t org) } } -void +static void R_TeleportSplash_QF (const vec3_t org) { int i, j, k; @@ -367,7 +367,7 @@ R_TeleportSplash_QF (const vec3_t org) } } -void +static void R_RocketTrail_QF (entity_t *ent) { float len; @@ -404,7 +404,7 @@ R_RocketTrail_QF (entity_t *ent) } } -void +static void R_GrenadeTrail_QF (entity_t *ent) { float len; @@ -441,7 +441,7 @@ R_GrenadeTrail_QF (entity_t *ent) } } -void +static void R_BloodTrail_QF (entity_t *ent) { float len; @@ -478,7 +478,7 @@ R_BloodTrail_QF (entity_t *ent) } } -void +static void R_SlightBloodTrail_QF (entity_t *ent) { float len; @@ -514,7 +514,7 @@ R_SlightBloodTrail_QF (entity_t *ent) } } -void +static void R_WizTrail_QF (entity_t *ent) { float len; @@ -559,7 +559,7 @@ R_WizTrail_QF (entity_t *ent) } } -void +static void R_FlameTrail_QF (entity_t *ent) { float len; @@ -604,7 +604,7 @@ R_FlameTrail_QF (entity_t *ent) } } -void +static void R_VoorTrail_QF (entity_t *ent) { float len; @@ -744,7 +744,7 @@ r_particles_style_f (cvar_t *var) { } -void +static void R_ParticleFunctionInit (void) { R_BlobExplosion = R_BlobExplosion_QF; diff --git a/libs/video/renderer/sw/sw_rsky.c b/libs/video/renderer/sw/sw_rsky.c index 2acc681e9..494e1098d 100644 --- a/libs/video/renderer/sw/sw_rsky.c +++ b/libs/video/renderer/sw/sw_rsky.c @@ -31,6 +31,8 @@ static const char rcsid[] = # include "config.h" #endif +#include "QF/render.h" + #include "r_local.h" diff --git a/libs/video/renderer/sw/sw_rsprite.c b/libs/video/renderer/sw/sw_rsprite.c index bb4488006..25ba9d7f8 100644 --- a/libs/video/renderer/sw/sw_rsprite.c +++ b/libs/video/renderer/sw/sw_rsprite.c @@ -52,7 +52,7 @@ static int sprite_width, sprite_height; spritedesc_t r_spritedesc; -void +static void R_RotateSprite (float beamlength) { vec3_t vec; @@ -72,7 +72,7 @@ R_RotateSprite (float beamlength) Clips the winding at clip_verts[clip_current] and changes clip_current Throws out the back side */ -int +static int R_ClipSpriteFace (int nump, clipplane_t *pclipplane) { int i, outcount; @@ -147,7 +147,7 @@ R_ClipSpriteFace (int nump, clipplane_t *pclipplane) } -void +static void R_SetupAndDrawSprite (void) { int i, nump; @@ -241,7 +241,7 @@ R_SetupAndDrawSprite (void) } -mspriteframe_t * +static mspriteframe_t * R_GetSpriteframe (msprite_t *psprite) { mspritegroup_t *pspritegroup; diff --git a/libs/video/renderer/sw/sw_rsurf.c b/libs/video/renderer/sw/sw_rsurf.c index e8ab0c77e..1a81385c0 100644 --- a/libs/video/renderer/sw/sw_rsurf.c +++ b/libs/video/renderer/sw/sw_rsurf.c @@ -58,7 +58,7 @@ static void (*surfmiptable[4]) (void) = { unsigned int blocklights[34 * 34]; //FIXME make dynamic -void +static void R_AddDynamicLights (void) { msurface_t *surf; @@ -124,7 +124,7 @@ R_AddDynamicLights (void) Combine and scale multiple lightmaps into the 8.8 format in blocklights */ -void +static void R_BuildLightMap (void) { int smax, tmax; @@ -460,7 +460,7 @@ R_DrawSurfaceBlock_mip3 (void) #endif -void +static void R_GenTurbTile (byte *pbasetex, void *pdest) { int *turb; diff --git a/libs/video/renderer/sw32/d_edge.c b/libs/video/renderer/sw32/d_edge.c index af6da34bc..4f4da92f8 100644 --- a/libs/video/renderer/sw32/d_edge.c +++ b/libs/video/renderer/sw32/d_edge.c @@ -75,7 +75,7 @@ D_MipLevelForScale (float scale) // FIXME: clean this up -void +static void D_DrawSolidSurface (surf_t *surf, int color) { espan_t *span; @@ -136,7 +136,7 @@ D_DrawSolidSurface (surf_t *surf, int color) } -void +static void D_CalcGradients (msurface_t *pface) { mplane_t *pplane; diff --git a/libs/video/renderer/sw32/d_init.c b/libs/video/renderer/sw32/d_init.c index deff60b22..ca773d35f 100644 --- a/libs/video/renderer/sw32/d_init.c +++ b/libs/video/renderer/sw32/d_init.c @@ -75,18 +75,6 @@ D_Init (void) VID_InitBuffers (); } -void -D_CopyRects (vrect_t *prects, int transparent) -{ -/* - this function is only required if the CPU doesn't have direct access to the - back buffer, and there's some driver interface function that the driver - doesn't support and requires Quake to do in software (such as drawing the - console); Quake will then draw into wherever the driver points vid.buffer - and will call this function before swapping buffers -*/ -} - void D_EnableBackBufferAccess (void) { diff --git a/libs/video/renderer/sw32/d_modech.c b/libs/video/renderer/sw32/d_modech.c index 9fb95027b..459f30224 100644 --- a/libs/video/renderer/sw32/d_modech.c +++ b/libs/video/renderer/sw32/d_modech.c @@ -43,7 +43,7 @@ int d_scantable[MAXHEIGHT]; short *zspantable[MAXHEIGHT]; -void +static void D_Patch (void) { } diff --git a/libs/video/renderer/sw32/d_polyse.c b/libs/video/renderer/sw32/d_polyse.c index 83cb00171..f36f309b8 100644 --- a/libs/video/renderer/sw32/d_polyse.c +++ b/libs/video/renderer/sw32/d_polyse.c @@ -164,7 +164,7 @@ D_PolysetSetEdgeTable (void) pedgetable = &edgetables[edgetableindex]; } -void +static void D_DrawNonSubdiv (void) { mtriangle_t *ptri; @@ -293,7 +293,7 @@ D_PolysetScanLeftEdge (int height) } while (--height); } -void +static void D_PolysetSetUpForLineScan (fixed8_t startvertu, fixed8_t startvertv, fixed8_t endvertu, fixed8_t endvertv) { @@ -376,7 +376,7 @@ D_PolysetCalcGradients (int skinwidth) } -void +static void D_PolysetDrawSpans (spanpackage_t * pspanpackage) { int i, j, texscantable[1024], *texscan; diff --git a/libs/video/renderer/sw32/d_scan.c b/libs/video/renderer/sw32/d_scan.c index f136b7826..fe2cd9057 100644 --- a/libs/video/renderer/sw32/d_scan.c +++ b/libs/video/renderer/sw32/d_scan.c @@ -198,7 +198,7 @@ D_WarpScreen (void) } } -void +static void D_DrawTurbulentSpan (void) { int sturb, tturb; diff --git a/libs/video/renderer/sw32/d_sky.c b/libs/video/renderer/sw32/d_sky.c index 0675dead3..32aa3e58e 100644 --- a/libs/video/renderer/sw32/d_sky.c +++ b/libs/video/renderer/sw32/d_sky.c @@ -41,7 +41,7 @@ static const char rcsid[] = #define SKY_SPAN_MAX (1 << SKY_SPAN_SHIFT) -void +static void D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t) { float wu, wv, temp; diff --git a/libs/video/renderer/sw32/d_sprite.c b/libs/video/renderer/sw32/d_sprite.c index 8f15097c7..4004ed02d 100644 --- a/libs/video/renderer/sw32/d_sprite.c +++ b/libs/video/renderer/sw32/d_sprite.c @@ -506,7 +506,7 @@ NextSpan4: } } -void +static void D_SpriteScanLeftEdge (void) { int i, v, itop, ibottom, lmaxindex; @@ -560,7 +560,7 @@ D_SpriteScanLeftEdge (void) } while (i != lmaxindex); } -void +static void D_SpriteScanRightEdge (void) { int i, v, itop, ibottom; @@ -634,7 +634,7 @@ D_SpriteScanRightEdge (void) pspan->count = DS_SPAN_LIST_END; // mark the end of the span list } -void +static void D_SpriteCalculateGradients (void) { vec3_t p_normal, p_saxis, p_taxis, p_temp1; diff --git a/libs/video/renderer/sw32/d_surf.c b/libs/video/renderer/sw32/d_surf.c index e444922a8..bf6c91513 100644 --- a/libs/video/renderer/sw32/d_surf.c +++ b/libs/video/renderer/sw32/d_surf.c @@ -34,6 +34,7 @@ static const char rcsid[] = #include #include "QF/qargs.h" +#include "QF/render.h" #include "QF/sys.h" #include "compat.h" @@ -78,7 +79,7 @@ D_SurfaceCacheForRes (int width, int height) } -void +static void D_CheckCacheGuard (void) { byte *s; @@ -91,7 +92,7 @@ D_CheckCacheGuard (void) } -void +static void D_ClearCacheGuard (void) { byte *s; @@ -142,7 +143,7 @@ D_FlushCaches (void) } -surfcache_t * +static surfcache_t * D_SCAlloc (int width, int size) { surfcache_t *new; @@ -222,49 +223,6 @@ D_SCAlloc (int width, int size) } -void -D_SCDump (void) -{ - surfcache_t *test; - - for (test = sc_base; test; test = test->next) { - if (test == sc_rover) - Sys_Printf ("ROVER:\n"); - Sys_Printf ("%p : %i bytes %i width\n", test, test->size, - test->width); - } -} - - -// if the num is not a power of 2, assume it will not repeat -int -MaskForNum (int num) -{ - if (num == 128) - return 127; - if (num == 64) - return 63; - if (num == 32) - return 31; - if (num == 16) - return 15; - return 255; -} - - -int -D_log2 (int num) -{ - int c; - - c = 0; - - while (num >>= 1) - c++; - return c; -} - - surfcache_t * D_CacheSurface (msurface_t *surface, int miplevel) { diff --git a/libs/video/renderer/sw32/draw.c b/libs/video/renderer/sw32/draw.c index d0e1a6a96..48fed95f9 100644 --- a/libs/video/renderer/sw32/draw.c +++ b/libs/video/renderer/sw32/draw.c @@ -344,7 +344,7 @@ Draw_AltString (int x, int y, const char *str) } -void +static void Draw_Pixel (int x, int y, byte color) { switch(r_pixbytes) @@ -718,7 +718,7 @@ Draw_ConsoleBackground (int lines) lines - 14, cl_verstring->string); } -void +static void R_DrawRect (vrect_t *prect, int rowbytes, byte * psrc, int transparent) { switch(r_pixbytes) { diff --git a/libs/video/renderer/sw32/screen.c b/libs/video/renderer/sw32/screen.c index a69d54869..5b42ee6bd 100644 --- a/libs/video/renderer/sw32/screen.c +++ b/libs/video/renderer/sw32/screen.c @@ -146,7 +146,7 @@ SCR_CalcRefdef (void) } -void +static void SCR_ApplyBlend (void) // Used to be V_UpdatePalette { int r, g, b, i; diff --git a/libs/video/renderer/sw32/sw32_raclip.c b/libs/video/renderer/sw32/sw32_raclip.c index ee81b4fbe..3933716c6 100644 --- a/libs/video/renderer/sw32/sw32_raclip.c +++ b/libs/video/renderer/sw32/sw32_raclip.c @@ -44,7 +44,7 @@ static auxvert_t av[8]; pfv0 is the unclipped vertex, pfv1 is the z-clipped vertex */ -void +static void R_Alias_clip_z (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) { float scale; @@ -172,7 +172,7 @@ R_Alias_clip_bottom (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out) } -int +static int R_AliasClip (finalvert_t *in, finalvert_t *out, int flag, int count, void (*clip) (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out)) diff --git a/libs/video/renderer/sw32/sw32_ralias.c b/libs/video/renderer/sw32/sw32_ralias.c index ddaeadc95..6e05f020d 100644 --- a/libs/video/renderer/sw32/sw32_ralias.c +++ b/libs/video/renderer/sw32/sw32_ralias.c @@ -246,7 +246,7 @@ R_AliasTransformVector (vec3_t in, vec3_t out) } -void +static void R_AliasClipAndProjectFinalVert (finalvert_t *fv, auxvert_t *av) { if (av->fv[2] < ALIAS_Z_CLIP_PLANE) { @@ -266,7 +266,7 @@ R_AliasClipAndProjectFinalVert (finalvert_t *fv, auxvert_t *av) fv->flags |= ALIAS_BOTTOM_CLIP; } -void +static void R_AliasTransformFinalVert16 (finalvert_t *fv, auxvert_t *av, trivertx_t *pverts) { trivertx_t * pextra; @@ -284,7 +284,7 @@ R_AliasTransformFinalVert16 (finalvert_t *fv, auxvert_t *av, trivertx_t *pverts) aliastransform[2][3]; } -void +static void R_AliasTransformFinalVert8 (finalvert_t *fv, auxvert_t *av, trivertx_t *pverts) { av->fv[0] = DotProduct (pverts->v, aliastransform[0]) + @@ -300,7 +300,7 @@ R_AliasTransformFinalVert8 (finalvert_t *fv, auxvert_t *av, trivertx_t *pverts) General clipped case */ -void +static void R_AliasPreparePoints (void) { int i; @@ -524,7 +524,7 @@ R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av) } -void +static void R_AliasPrepareUnclippedPoints (void) { stvert_t *pstverts; @@ -543,7 +543,7 @@ R_AliasPrepareUnclippedPoints (void) } -void +static void R_AliasSetupSkin (void) { int skinnum; @@ -603,7 +603,7 @@ R_AliasSetupSkin (void) } } -void +static void R_AliasSetupLighting (alight_t *plighting) { // guarantee that no vertex will ever be lit below LIGHT_MIN, so we don't @@ -637,7 +637,7 @@ R_AliasSetupLighting (alight_t *plighting) set r_apverts */ -void +static void R_AliasSetupFrame (void) { int frame; diff --git a/libs/video/renderer/sw32/sw32_rbsp.c b/libs/video/renderer/sw32/sw32_rbsp.c index c7bae0849..c1f10be41 100644 --- a/libs/video/renderer/sw32/sw32_rbsp.c +++ b/libs/video/renderer/sw32/sw32_rbsp.c @@ -66,7 +66,7 @@ static mvertex_t *pfrontenter, *pfrontexit; static qboolean makeclippededge; -void +static void R_EntityRotate (vec3_t vec) { vec3_t tvec; @@ -150,7 +150,7 @@ R_RotateBmodel (void) } -void +static void R_RecursiveClipBPoly (bedge_t *pedges, mnode_t *pnode, msurface_t *psurf) { bedge_t *psideedges[2], *pnextedge, *ptedge; @@ -396,7 +396,7 @@ R_DrawSubmodelPolygons (model_t *pmodel, int clipflags) } -void +static void R_RecursiveWorldNode (mnode_t *node, int clipflags) { int i, c, side, *pindex; diff --git a/libs/video/renderer/sw32/sw32_rdraw.c b/libs/video/renderer/sw32/sw32_rdraw.c index 184deba43..4cd5907ff 100644 --- a/libs/video/renderer/sw32/sw32_rdraw.c +++ b/libs/video/renderer/sw32/sw32_rdraw.c @@ -322,7 +322,7 @@ R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip) } -void +static void R_EmitCachedEdge (void) { edge_t *pedge_t; diff --git a/libs/video/renderer/sw32/sw32_redge.c b/libs/video/renderer/sw32/sw32_redge.c index 047c20d4e..4d8e78f2f 100644 --- a/libs/video/renderer/sw32/sw32_redge.c +++ b/libs/video/renderer/sw32/sw32_redge.c @@ -79,7 +79,7 @@ edge_t edge_sentinel; float fv; -void +static void R_DrawCulledPolys (void) { surf_t *s; @@ -243,7 +243,7 @@ R_StepActiveU (edge_t *pedge) } } -void +static void R_CleanupSpan (void) { surf_t *surf; @@ -269,75 +269,7 @@ R_CleanupSpan (void) } while (surf != &surfaces[1]); } -void -R_LeadingEdgeBackwards (edge_t *edge) -{ - espan_t *span; - surf_t *surf, *surf2; - int iu; - - // it's adding a new surface in, so find the correct place - surf = &surfaces[edge->surfs[1]]; - - // don't start a span if this is an inverted span, with the end edge - // preceding the start edge (that is, we've already seen the end edge) - if (++surf->spanstate == 1) { - surf2 = surfaces[1].next; - - if (surf->key > surf2->key) - goto newtop; - - // if it's two surfaces on the same plane, the one that's already - // active is in front, so keep going unless it's a bmodel - if (surf->insubmodel && (surf->key == surf2->key)) { - // must be two bmodels in the same leaf; don't care, because - // they'll never be farthest anyway - goto newtop; - } - - continue_search: - - do { - surf2 = surf2->next; - } while (surf->key < surf2->key); - - if (surf->key == surf2->key) { - // if it's two surfaces on the same plane, the one that's already - // active is in front, so keep going unless it's a bmodel - if (!surf->insubmodel) - goto continue_search; - - // must be two bmodels in the same leaf; don't care which is - // really in front, because they'll never be farthest anyway - } - - goto gotposition; - - newtop: - // emit a span (obscures current top) - iu = edge->u >> 20; - - if (iu > surf2->last_u) { - span = span_p++; - span->u = surf2->last_u; - span->count = iu - span->u; - span->v = current_iv; - span->pnext = surf2->spans; - surf2->spans = span; - } - // set last_u on the new span - surf->last_u = iu; - - gotposition: - // insert before surf2 - surf->next = surf2; - surf->prev = surf2->prev; - surf2->prev->next = surf; - surf2->prev = surf; - } -} - -void +static void R_TrailingEdge (surf_t *surf, edge_t *edge) { espan_t *span; @@ -366,7 +298,7 @@ R_TrailingEdge (surf_t *surf, edge_t *edge) } } -void +static void R_LeadingEdge (edge_t *edge) { espan_t *span; @@ -500,27 +432,6 @@ R_GenerateSpans (void) R_CleanupSpan (); } -void -R_GenerateSpansBackward (void) -{ - edge_t *edge; - - // clear active surfaces to just the background surface - surfaces[1].next = surfaces[1].prev = &surfaces[1]; - surfaces[1].last_u = edge_head_u_shift20; - - // generate spans - for (edge = edge_head.next; edge != &edge_tail; edge = edge->next) { - if (edge->surfs[0]) - R_TrailingEdge (&surfaces[edge->surfs[0]], edge); - - if (edge->surfs[1]) - R_LeadingEdgeBackwards (edge); - } - - R_CleanupSpan (); -} - /* R_ScanEdges diff --git a/libs/video/renderer/sw32/sw32_rmain.c b/libs/video/renderer/sw32/sw32_rmain.c index 247e56d41..e6c5c348b 100644 --- a/libs/video/renderer/sw32/sw32_rmain.c +++ b/libs/video/renderer/sw32/sw32_rmain.c @@ -497,7 +497,7 @@ R_ShowNearestLoc (void) } } -void +static void R_DrawEntitiesOnList (void) { int i, j; @@ -566,7 +566,7 @@ R_DrawEntitiesOnList (void) } } -void +static void R_DrawViewModel (void) { // FIXME: remove and do real lighting @@ -625,7 +625,7 @@ R_DrawViewModel (void) R_AliasDrawModel (&r_viewlighting); } -int +static int R_BmodelCheckBBox (model_t *clmodel, float *minmaxs) { int i, *pindex, clipflags; @@ -679,7 +679,7 @@ R_BmodelCheckBBox (model_t *clmodel, float *minmaxs) return clipflags; } -void +static void R_DrawBEntitiesOnList (void) { int i, j, k, clipflags; @@ -790,7 +790,7 @@ R_DrawBEntitiesOnList (void) insubmodel = false; } -void +static void R_EdgeDrawing (void) { edge_t ledges[NUMSTACKEDGES + @@ -860,7 +860,7 @@ byte warpbuffer[WARP_WIDTH * WARP_HEIGHT * 4]; r_refdef must be set before the first call */ -void +static void R_RenderView_ (void) { r_warpbuffer = warpbuffer; diff --git a/libs/video/renderer/sw32/sw32_rmisc.c b/libs/video/renderer/sw32/sw32_rmisc.c index a621db5d2..760ff1245 100644 --- a/libs/video/renderer/sw32/sw32_rmisc.c +++ b/libs/video/renderer/sw32/sw32_rmisc.c @@ -42,28 +42,11 @@ static const char rcsid[] = #include "r_local.h" -void +static void R_CheckVariables (void) { } -/* - Show - - Debugging use -*/ -void -Show (void) -{ - vrect_t vr; - - vr.x = vr.y = 0; - vr.width = vid.width; - vr.height = vid.height; - vr.pnext = NULL; - VID_Update (&vr); -} - /* R_TimeRefresh_f @@ -157,28 +140,6 @@ R_PrintAliasStats (void) Con_Printf ("%3i polygon model drawn\n", r_amodels_drawn); } -void -WarpPalette (void) -{ - int i, j; - byte newpalette[768]; - int basecolor[3]; - - basecolor[0] = 130; - basecolor[1] = 80; - basecolor[2] = 50; - - // pull the colors halfway to bright brown - for (i = 0; i < 256; i++) { - for (j = 0; j < 3; j++) { - newpalette[i * 3 + j] = - (vid.palette[i * 3 + j] + basecolor[j]) / 2; - } - } - - VID_ShiftPalette (newpalette); -} - void R_TransformFrustum (void) { @@ -219,7 +180,7 @@ R_TransformPlane (mplane_t *p, float *normal, float *dist) TransformVector (p->normal, normal); } -void +static void R_SetUpFrustumIndexes (void) { int i, j, *pindex; diff --git a/libs/video/renderer/sw32/sw32_rpart.c b/libs/video/renderer/sw32/sw32_rpart.c index 41bc930a6..89d43c134 100644 --- a/libs/video/renderer/sw32/sw32_rpart.c +++ b/libs/video/renderer/sw32/sw32_rpart.c @@ -117,7 +117,7 @@ R_ReadPointFile_f (void) Con_Printf ("%i points read\n", c); } -void +static void R_ParticleExplosion_QF (const vec3_t org) { int i, j; @@ -153,7 +153,7 @@ R_ParticleExplosion_QF (const vec3_t org) } } -void +static void R_ParticleExplosion2_QF (const vec3_t org, int colorStart, int colorLength) { int i, j; @@ -182,7 +182,7 @@ R_ParticleExplosion2_QF (const vec3_t org, int colorStart, int colorLength) } } -void +static void R_BlobExplosion_QF (const vec3_t org) { int i, j; @@ -219,7 +219,7 @@ R_BlobExplosion_QF (const vec3_t org) } } -void +static void R_LavaSplash_QF (const vec3_t org) { int i, j, k; @@ -258,7 +258,7 @@ R_LavaSplash_QF (const vec3_t org) } } -void +static void R_TeleportSplash_QF (const vec3_t org) { float vel; @@ -297,7 +297,7 @@ R_TeleportSplash_QF (const vec3_t org) } } -void +static void R_RunParticleEffect_QF (const vec3_t org, const vec3_t dir, int color, int count) { @@ -325,49 +325,49 @@ R_RunParticleEffect_QF (const vec3_t org, const vec3_t dir, int color, } } -void +static void R_SpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 0, 10); } -void +static void R_SuperSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect (org, vec3_origin, 0, 20); } -void +static void R_KnightSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 226, 20); } -void +static void R_WizSpikeEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 20, 30); } -void +static void R_BloodPuffEffect_QF (const vec3_t org, int count) { R_RunParticleEffect_QF (org, vec3_origin, 73, count); } -void +static void R_GunshotEffect_QF (const vec3_t org, int count) { R_RunParticleEffect_QF (org, vec3_origin, 0, count); } -void +static void R_LightningBloodEffect_QF (const vec3_t org) { R_RunParticleEffect_QF (org, vec3_origin, 225, 50); } -void +static void R_RocketTrail_QF (entity_t *ent) { float len; @@ -404,7 +404,7 @@ R_RocketTrail_QF (entity_t *ent) } } -void +static void R_GrenadeTrail_QF (entity_t *ent) { float len; @@ -441,7 +441,7 @@ R_GrenadeTrail_QF (entity_t *ent) } } -void +static void R_BloodTrail_QF (entity_t *ent) { float len; @@ -478,7 +478,7 @@ R_BloodTrail_QF (entity_t *ent) } } -void +static void R_SlightBloodTrail_QF (entity_t *ent) { float len; @@ -514,7 +514,7 @@ R_SlightBloodTrail_QF (entity_t *ent) } } -void +static void R_WizTrail_QF (entity_t *ent) { float len; @@ -559,7 +559,7 @@ R_WizTrail_QF (entity_t *ent) } } -void +static void R_FlameTrail_QF (entity_t *ent) { float len; @@ -604,7 +604,7 @@ R_FlameTrail_QF (entity_t *ent) } } -void +static void R_VoorTrail_QF (entity_t *ent) { float len; @@ -745,7 +745,7 @@ r_particles_style_f (cvar_t *var) { } -void +static void R_ParticleFunctionInit (void) { R_BlobExplosion = R_BlobExplosion_QF; diff --git a/libs/video/renderer/sw32/sw32_rsky.c b/libs/video/renderer/sw32/sw32_rsky.c index 43eca4b1e..9ce02f2c3 100644 --- a/libs/video/renderer/sw32/sw32_rsky.c +++ b/libs/video/renderer/sw32/sw32_rsky.c @@ -38,6 +38,7 @@ static const char rcsid[] = #endif #include "QF/sys.h" +#include "QF/render.h" #include "r_local.h" diff --git a/libs/video/renderer/sw32/sw32_rsprite.c b/libs/video/renderer/sw32/sw32_rsprite.c index 595122b95..169bc8de2 100644 --- a/libs/video/renderer/sw32/sw32_rsprite.c +++ b/libs/video/renderer/sw32/sw32_rsprite.c @@ -52,7 +52,7 @@ static int sprite_width, sprite_height; spritedesc_t r_spritedesc; -void +static void R_RotateSprite (float beamlength) { vec3_t vec; @@ -72,7 +72,7 @@ R_RotateSprite (float beamlength) Clips the winding at clip_verts[clip_current] and changes clip_current Throws out the back side */ -int +static int R_ClipSpriteFace (int nump, clipplane_t *pclipplane) { int i, outcount; @@ -140,7 +140,7 @@ R_ClipSpriteFace (int nump, clipplane_t *pclipplane) } -void +static void R_SetupAndDrawSprite (void) { int i, nump; @@ -234,7 +234,7 @@ R_SetupAndDrawSprite (void) } -mspriteframe_t * +static mspriteframe_t * R_GetSpriteframe (msprite_t *psprite) { mspritegroup_t *pspritegroup; diff --git a/libs/video/renderer/sw32/sw32_rsurf.c b/libs/video/renderer/sw32/sw32_rsurf.c index dd16aa70f..7210243cb 100644 --- a/libs/video/renderer/sw32/sw32_rsurf.c +++ b/libs/video/renderer/sw32/sw32_rsurf.c @@ -76,7 +76,7 @@ static void (*surfmiptable32[4]) (void) = { int blocklights[34 * 34]; //FIXME make dynamic -void +static void R_AddDynamicLights (void) { msurface_t *surf; @@ -142,7 +142,7 @@ R_AddDynamicLights (void) Combine and scale multiple lightmaps into the 8.8 format in blocklights */ -void +static void R_BuildLightMap (void) { int smax, tmax; diff --git a/libs/video/targets/context_sdl.c b/libs/video/targets/context_sdl.c index 738eaf12b..e3ae14785 100644 --- a/libs/video/targets/context_sdl.c +++ b/libs/video/targets/context_sdl.c @@ -19,6 +19,8 @@ static const char rcsid[] = #include "QF/va.h" #include "QF/vid.h" +#include "context_sdl.h" + cvar_t *vid_bitdepth; extern SDL_Surface *screen; @@ -60,7 +62,7 @@ VID_Shutdown (void) SDL_Quit (); } -void +static void VID_UpdateFullscreen (cvar_t *vid_fullscreen) { if (!vid.initialized) diff --git a/libs/video/targets/context_x11.c b/libs/video/targets/context_x11.c index 175471dc1..86053ff4e 100644 --- a/libs/video/targets/context_x11.c +++ b/libs/video/targets/context_x11.c @@ -136,7 +136,7 @@ X11_RemoveEvent (int event, void (*event_handler) (XEvent *)) return true; } -void +static void X11_ProcessEventProxy(XEvent *x_event) { if (x_event->type >= LASTEvent) { @@ -237,7 +237,7 @@ X11_CreateNullCursor (void) XDefineCursor (x_disp, x_win, nullcursor); } -void +static void X11_ForceMove (int x, int y) { int nx, ny; @@ -370,7 +370,7 @@ X11_SetVidMode (int width, int height) #endif } -void +static void X11_UpdateFullscreen (cvar_t *fullscreen) { if (!vid_context_created) @@ -466,8 +466,8 @@ X11_CreateWindow (int width, int height) if (ClassHint) { resname = strrchr (com_argv[0], '/'); - ClassHint->res_name = (resname ? resname + 1 : com_argv[0]); - ClassHint->res_class = PACKAGE; + ClassHint->res_name = (char *)(resname ? resname + 1 : com_argv[0]); + ClassHint->res_class = (char *)PACKAGE; XSetClassHint (x_disp, x_win, ClassHint); XFree (ClassHint); } @@ -504,7 +504,7 @@ X11_RestoreVidMode (void) #endif } -void +static void X11_GrabKeyboardBool(qboolean yes) { static qboolean is_grabbed = false; @@ -523,14 +523,15 @@ X11_GrabKeyboardBool(qboolean yes) is_grabbed = false; } } - -void +#if 0 +static void X11_UngrabKeyboard (void) { XUngrabKeyboard (x_disp, CurrentTime); } +#endif -void +static void X11_GrabMouseBool (qboolean yes) { static qboolean is_grabbed = false; @@ -552,13 +553,15 @@ X11_GrabMouseBool (qboolean yes) vid.height / 2); } -void +#if 0 +static void X11_UngrabMouse(void) { XUngrabPointer (x_disp, CurrentTime); XWarpPointer (x_disp, x_win, x_win, 0, 0, 0, 0, vid.width / 2, vid.height / 2); } +#endif void X11_Grabber (qboolean grab) diff --git a/libs/video/targets/fbset_modes_l.l b/libs/video/targets/fbset_modes_l.l index 20d750b96..f13c43af6 100644 --- a/libs/video/targets/fbset_modes_l.l +++ b/libs/video/targets/fbset_modes_l.l @@ -24,6 +24,8 @@ #include "fbset_modes_y.h" #define YY_NO_UNPUT +#define YY_DECL int yylex YY_PROTO(( void )) +YY_DECL; struct keyword { const char *name; @@ -58,13 +60,14 @@ static struct keyword keywords[] = { int line = 1; +void yyerror(const char *s); void yyerror(const char *s) { Die("%s:%d: %s", Opt_modedb, line, s); } -int yywrap(void) +static int yywrap(void) { return 1; } diff --git a/libs/video/targets/in_fbdev.c b/libs/video/targets/in_fbdev.c index cf36c396b..f3479301e 100644 --- a/libs/video/targets/in_fbdev.c +++ b/libs/video/targets/in_fbdev.c @@ -39,9 +39,10 @@ static const char rcsid[] = #include #include "QF/cvar.h" +#include "QF/input.h" #include "QF/keys.h" -int +static int fd_blocking (int fd, int on) { int x; @@ -141,11 +142,6 @@ IN_LL_Ungrab_Input (void) { } -void -IN_LL_ModeChanged (void) -{ -} - void IN_LL_ClearStates (void) { diff --git a/libs/video/targets/in_svgalib.c b/libs/video/targets/in_svgalib.c index 784253156..5e1a66c1e 100644 --- a/libs/video/targets/in_svgalib.c +++ b/libs/video/targets/in_svgalib.c @@ -367,7 +367,7 @@ IN_InitMouse (void) { int mtype; int mouserate = MOUSE_DEFAULTSAMPLERATE; - char *mousedev; + const char *mousedev; mouse_buttons = 3; @@ -392,7 +392,7 @@ IN_InitMouse (void) //FIXME: vga_init() opens the mouse automoatically // closing it to ensure its opened how we want it mouse_close(); - if (mouse_init (mousedev, mtype, mouserate)) { + if (mouse_init ((char *)mousedev, mtype, mouserate)) { Con_Printf ("No mouse found. Check your libvga.conf mouse settings" " and that the mouse\n" "device has appropriate permission settings.\n"); diff --git a/libs/video/targets/joy.c b/libs/video/targets/joy.c index 721e0d555..d94906d51 100644 --- a/libs/video/targets/joy.c +++ b/libs/video/targets/joy.c @@ -52,8 +52,8 @@ qboolean joy_found = false; qboolean joy_active = false; typedef struct { - char *name; - char *string; + const char *name; + const char *string; } ocvar_t; ocvar_t joy_axes_cvar_init[JOY_MAX_AXES] = { diff --git a/libs/video/targets/joy_win.c b/libs/video/targets/joy_win.c index 82d8f2a3b..b1c51e030 100644 --- a/libs/video/targets/joy_win.c +++ b/libs/video/targets/joy_win.c @@ -112,7 +112,7 @@ int joy_id; DWORD joy_flags; DWORD joy_numbuttons; -PDWORD +static PDWORD RawValuePointer (int axis) { switch (axis) { @@ -132,7 +132,7 @@ RawValuePointer (int axis) return NULL; } -qboolean +static qboolean _JOY_Read (void) { memset (&ji, 0, sizeof (ji)); @@ -216,7 +216,7 @@ JOY_Read (void) } } -int +static int JOY_StartupJoystick (void) { int /* i, */ numdevs; @@ -292,7 +292,7 @@ JOY_Close (void) { } -void +static void JOY_AdvancedUpdate_f (void) { // called once by JOY_ReadJoystick and by user whenever an update is diff --git a/libs/video/targets/keys.c b/libs/video/targets/keys.c index 4bcdba2a2..492c5074f 100644 --- a/libs/video/targets/keys.c +++ b/libs/video/targets/keys.c @@ -71,7 +71,7 @@ static int keyhelp; static cbuf_t *cbuf; typedef struct { - char *name; + const char *name; imt_t imtnum; } imtname_t; @@ -101,7 +101,7 @@ imtname_t imtnames[] = { }; typedef struct { - char *name; + const char *name; knum_t keynum; } keyname_t; @@ -391,7 +391,7 @@ keyname_t keynames[] = { Game key handling. */ -qboolean +static qboolean Key_Game (knum_t key, short unicode) { const char *kb; @@ -430,7 +430,7 @@ Key_Game (knum_t key, short unicode) Interactive line editing and console scrollback */ -void +static void Key_Console (knum_t key, short unicode) { // escape is un-bindable @@ -448,7 +448,7 @@ Key_Console (knum_t key, short unicode) the given string. Single ascii characters return themselves, while the QFK_* names are matched up. */ -int +static int Key_StringToIMTnum (const char *str) { imtname_t *kn; @@ -469,7 +469,7 @@ Key_StringToIMTnum (const char *str) Returns a string (a QFK_* name) for the given imtnum. FIXME: handle quote special (general escape sequence?) */ -char * +static const char * Key_IMTnumToString (const int imtnum) { imtname_t *kn; @@ -491,7 +491,7 @@ Key_IMTnumToString (const int imtnum) the given string. Single ascii characters return themselves, while the QFK_* names are matched up. */ -int +static int Key_StringToKeynum (const char *str) { keyname_t *kn; @@ -527,7 +527,7 @@ Key_KeynumToString (knum_t keynum) return ""; } -void +static void Key_In_Unbind (const char *imt, const char *key) { int t, b; @@ -547,7 +547,7 @@ Key_In_Unbind (const char *imt, const char *key) Key_SetBinding (t, b, NULL); } -void +static void Key_In_Unbind_f (void) { if (Cmd_Argc () != 3) { @@ -557,7 +557,7 @@ Key_In_Unbind_f (void) Key_In_Unbind (Cmd_Argv (1), Cmd_Argv (2)); } -void +static void Key_Unbindall_f (void) { int i, j; @@ -567,7 +567,7 @@ Key_Unbindall_f (void) Key_SetBinding (j, i, NULL); } -void +static void Key_In_Bind (const char *imt, const char *key, const char *cmd) { int t, b; @@ -595,7 +595,7 @@ Key_In_Bind (const char *imt, const char *key, const char *cmd) Key_SetBinding (t, b, cmd); } -void +static void Key_In_Bind_f (void) { int c, i; @@ -628,7 +628,7 @@ Key_In_Bind_f (void) Key_In_Bind (imt, key, cmd); } -void +static void Key_Unbind_f (void) { const char *key; @@ -641,7 +641,7 @@ Key_Unbind_f (void) Key_In_Unbind (in_bind_imt->string, key); } -void +static void Key_Bind_f (void) { int c, i; @@ -673,7 +673,7 @@ Key_Bind_f (void) Key_In_Bind (imt, key, cmd); } -void +static void Key_GIB_Bind_Get_f (void) { const char *imt, *key, *cmd; @@ -708,7 +708,7 @@ Key_GIB_Bind_Get_f (void) } -void +static void in_bind_imt_f (cvar_t *var) { if (Key_StringToIMTnum (var->string) == -1) { @@ -718,7 +718,7 @@ in_bind_imt_f (cvar_t *var) } } -void +static void Key_InputMappingTable_f (void) { int c, t; @@ -765,13 +765,13 @@ Key_WriteBindings (QFile *f) } } -void +static void Key_Bindlist_f (void) { Key_WriteBindings (0); } -void +static void keyhelp_f (void) { keyhelp = 1; diff --git a/libs/video/targets/old_keys.c b/libs/video/targets/old_keys.c index 294d42569..fb197abb9 100644 --- a/libs/video/targets/old_keys.c +++ b/libs/video/targets/old_keys.c @@ -53,9 +53,11 @@ void *alloca(size_t size); #include "QF/console.h" #include "QF/hash.h" +#include "old_keys.h" + typedef struct { - char *old_name; - char *new_name; + const char *old_name; + const char *new_name; } old_keyname_t; old_keyname_t old_keynames[] = { diff --git a/libs/video/targets/pr_keys.c b/libs/video/targets/pr_keys.c index 666f292ae..53b249079 100644 --- a/libs/video/targets/pr_keys.c +++ b/libs/video/targets/pr_keys.c @@ -38,6 +38,7 @@ static const char rcsid[] = # include #endif +#include "QF/csqc.h" #include "QF/keys.h" #include "QF/progs.h" #include "QF/zone.h" diff --git a/libs/video/targets/qfgl_ext.c b/libs/video/targets/qfgl_ext.c index 5d85117bc..200c98964 100644 --- a/libs/video/targets/qfgl_ext.c +++ b/libs/video/targets/qfgl_ext.c @@ -119,7 +119,7 @@ GLF_Init (void) It takes a bit of care to be fool-proof about parsing an OpenGL extensions string. Don't be fooled by sub-strings, etc. */ -qboolean +static qboolean QFGL_ParseExtensionList (const GLubyte * list, const char *name) { const char *start; diff --git a/libs/video/targets/vid.c b/libs/video/targets/vid.c index 6e252e0b4..5fc526ce2 100644 --- a/libs/video/targets/vid.c +++ b/libs/video/targets/vid.c @@ -115,7 +115,7 @@ VID_GetWindowSize (int def_w, int def_h) /* GAMMA FUNCTIONS */ -void +static void VID_BuildGammaTable (double gamma) { int i; diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index ad3bdca85..b17063382 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -53,6 +53,7 @@ static const char rcsid[] = #include "QF/vid.h" #include "QF/GL/extensions.h" #include "QF/GL/funcs.h" +#include "QF/GL/qf_vid.h" #include "compat.h" #include "sbar.h" @@ -157,7 +158,7 @@ VID_Shutdown (void) qf_fxMesaDestroyContext (fc); } -void +static void GL_Init (void) { QF_3DfxSetDitherModeEXT dither_select = NULL; @@ -354,24 +355,6 @@ VID_Init_Cvars (void) "Use system gamma control if available"); } -void -VID_ExtraOptionDraw (unsigned int options_draw_cursor) -{ -/* Port specific Options menu entrys */ -} - -void -VID_ExtraOptionCmd (int option_cursor) -{ -/* - switch(option_cursor) - { - case 12: // Always start with 12 - break; - } -*/ -} - void VID_SetCaption (const char *text) { diff --git a/libs/video/targets/vid_common_gl.c b/libs/video/targets/vid_common_gl.c index 0d480541f..f36b681c2 100644 --- a/libs/video/targets/vid_common_gl.c +++ b/libs/video/targets/vid_common_gl.c @@ -51,8 +51,10 @@ static const char rcsid[] = #include "QF/GL/defines.h" #include "QF/GL/extensions.h" #include "QF/GL/funcs.h" +#include "QF/GL/qf_vid.h" #include "compat.h" +#include "d_iface.h" #include "sbar.h" #define WARP_WIDTH 320 @@ -103,7 +105,7 @@ gl_screenshot_byte_swap_f (cvar_t *var) qfglPixelStorei (GL_PACK_SWAP_BYTES, var->int_val ? GL_TRUE : GL_FALSE); } -void +static void GL_Common_Init_Cvars (void) { vid_use8bit = Cvar_Get ("vid_use8bit", "0", CVAR_ROM, NULL, "Use 8-bit " @@ -127,7 +129,7 @@ GL_Common_Init_Cvars (void) Check for ARB multitexture support */ -void +static void CheckMultiTextureExtensions (void) { Con_Printf ("Checking for multitexture: "); @@ -159,7 +161,7 @@ CheckMultiTextureExtensions (void) } } -void +static void CheckVertexArraySize (void) { qfglGetIntegerv (GL_MAX_ELEMENTS_VERTICES, &vaelements); @@ -310,7 +312,7 @@ VID_Is8bit (void) return is8bit; } -void +static void Tdfx_Init8bitPalette (void) { // Check for 8bit Extensions and initialize them. @@ -359,7 +361,7 @@ Tdfx_Init8bitPalette (void) the GL_EXT_shared_texture_palette spec might be a very good idea in general. */ -void +static void Shared_Init8bitPalette (void) { int i; diff --git a/libs/video/targets/vid_common_sw32.c b/libs/video/targets/vid_common_sw32.c index fe58cf32f..86721b83e 100644 --- a/libs/video/targets/vid_common_sw32.c +++ b/libs/video/targets/vid_common_sw32.c @@ -50,7 +50,7 @@ unsigned char d_15to8table[65536]; LordHavoc: finds nearest matching color in a palette */ -int +static int lhfindcolor (byte *pal, int colors, int r, int g, int b) { int i, dist, best, bestdist, rd, gd, bd; @@ -79,7 +79,7 @@ lhfindcolor (byte *pal, int colors, int r, int g, int b) LordHavoc: makes a 32bit color*light table, RGBA order, no endian, may need to be re-ordered to hardware at display time */ -void +static void VID_MakeColormap32 (void *outcolormap, byte *pal) { int c, l; @@ -119,7 +119,8 @@ VID_MakeColormap32 (void *outcolormap, byte *pal) } } -unsigned short lh24to16bit (int red, int green, int blue) +static unsigned short +lh24to16bit (int red, int green, int blue) { red = bound(0, red, 255); green = bound(0, green, 255); @@ -138,7 +139,7 @@ unsigned short lh24to16bit (int red, int green, int blue) LordHavoc: makes a 16bit color*light table, RGB order, native endian, may need to be translated to hardware order at display time */ -void +static void VID_MakeColormap16 (void *outcolormap, byte *pal) { int c, l; @@ -166,7 +167,7 @@ VID_MakeColormap16 (void *outcolormap, byte *pal) LordHavoc: makes a 8bit color*light table */ -void +static void VID_MakeColormap8 (void *outcolormap, byte *pal) { int c, l; diff --git a/libs/video/targets/vid_fbdev.c b/libs/video/targets/vid_fbdev.c index 726442b30..8857e5eff 100644 --- a/libs/video/targets/vid_fbdev.c +++ b/libs/video/targets/vid_fbdev.c @@ -73,6 +73,7 @@ static const char rcsid[] = #include "QF/sys.h" #include "QF/vid.h" +#include "d_iface.h" #include "fbset.h" static struct VideoMode current_mode; @@ -269,7 +270,7 @@ VID_SetPalette (byte * palette) } } -int +static int VID_SetMode (const char *name, unsigned char *palette) { struct VideoMode *vmode; @@ -389,7 +390,7 @@ VID_Init (unsigned char *palette) { struct VideoMode *vmode; const char *modestr; - char *fbname; + const char *fbname; // plugin_load("in_fbdev.so"); diff --git a/libs/video/targets/vid_glx.c b/libs/video/targets/vid_glx.c index 9fbd69aea..fd556382b 100644 --- a/libs/video/targets/vid_glx.c +++ b/libs/video/targets/vid_glx.c @@ -59,6 +59,7 @@ static const char rcsid[] = #include "QF/va.h" #include "QF/vid.h" #include "QF/GL/funcs.h" +#include "QF/GL/qf_vid.h" #include "compat.h" #include "context_x11.h" @@ -151,7 +152,7 @@ VID_Shutdown (void) X11_CloseDisplay (); } -void +static void GL_Init (void) { GL_Init_Common (); @@ -165,7 +166,7 @@ GL_EndRendering (void) Sbar_Changed (); } -void +static void VID_Center_f (void) { X11_ForceViewPort (); } @@ -284,12 +285,6 @@ VID_SetCaption (const char *text) } } -void -VID_ForceViewPort(void) -{ - X11_ForceViewPort (); -} - qboolean VID_SetGamma (double gamma) { diff --git a/libs/video/targets/vid_null.c b/libs/video/targets/vid_null.c index af71b4e93..b4d6342a9 100644 --- a/libs/video/targets/vid_null.c +++ b/libs/video/targets/vid_null.c @@ -31,6 +31,7 @@ static const char rcsid[] = # include "config.h" #endif +#include "d_iface.h" #include "d_local.h" viddef_t vid; // global video state diff --git a/libs/video/targets/vid_sdl.c b/libs/video/targets/vid_sdl.c index 3a0e4571b..1b8c5d064 100644 --- a/libs/video/targets/vid_sdl.c +++ b/libs/video/targets/vid_sdl.c @@ -46,6 +46,8 @@ static const char rcsid[] = #include "QF/sys.h" #include "QF/vid.h" +#include "d_iface.h" + #ifdef WIN32 // FIXME: evil hack to get full DirectSound support with SDL #include #include diff --git a/libs/video/targets/vid_sgl.c b/libs/video/targets/vid_sgl.c index 5e76263b1..c49ab4e68 100644 --- a/libs/video/targets/vid_sgl.c +++ b/libs/video/targets/vid_sgl.c @@ -47,8 +47,10 @@ static const char rcsid[] = #include "QF/sys.h" #include "QF/vid.h" #include "QF/GL/funcs.h" +#include "QF/GL/qf_vid.h" #include "compat.h" +#include "context_sdl.h" #include "r_cvar.h" #include "sbar.h" @@ -65,8 +67,6 @@ int VID_options_items = 1; SDL_Surface *screen = NULL; -extern void VID_SDL_GammaCheck (void); - void * QFGL_GetProcAddress (void *handle, const char *name) @@ -83,7 +83,7 @@ QFGL_LoadLibrary (void) return NULL; } -void +static void GL_Init (void) { GL_Init_Common (); @@ -143,9 +143,9 @@ VID_Init (unsigned char *palette) // FIXME: Maybe this could be put in a different spot, but I don't // know where. Anyway, it's to work around a 3Dfx Glide bug. SDL_WM_GrabInput (SDL_GRAB_ON); - putenv ("MESA_GLX_FX=fullscreen"); + putenv ((char *)"MESA_GLX_FX=fullscreen"); } else { - putenv ("MESA_GLX_FX=window"); + putenv ((char *)"MESA_GLX_FX=window"); #endif } diff --git a/libs/video/targets/vid_svgalib.c b/libs/video/targets/vid_svgalib.c index de8c7d1a8..91c562f72 100644 --- a/libs/video/targets/vid_svgalib.c +++ b/libs/video/targets/vid_svgalib.c @@ -62,6 +62,7 @@ static const char rcsid[] = #include "QF/vid.h" #include "compat.h" +#include "d_iface.h" static int num_modes, current_mode; static vga_modeinfo *modes; @@ -276,7 +277,7 @@ VID_SetPalette (byte * palette) } } -int +static int VID_SetMode (int modenum, unsigned char *palette) { int err; @@ -464,21 +465,6 @@ VID_Update (vrect_t *rects) } } -char * -VID_ModeInfo (int modenum) -{ - static char *badmodestr = "Bad mode number"; - static char modestr[40]; - - if (modenum == 0) { - snprintf (modestr, sizeof (modestr), "%d x %d, %d bpp", vid.width, - vid.height, modes[current_mode].bytesperpixel * 8); - return (modestr); - } else { - return (badmodestr); - } -} - void VID_LockBuffer (void) { diff --git a/libs/video/targets/vid_wgl.c b/libs/video/targets/vid_wgl.c index b48c76de6..9f7a86f70 100644 --- a/libs/video/targets/vid_wgl.c +++ b/libs/video/targets/vid_wgl.c @@ -48,6 +48,7 @@ static const char rcsid[] = #include "QF/va.h" #include "QF/vid.h" #include "QF/GL/funcs.h" +#include "QF/GL/qf_vid.h" #include "compat.h" #include "in_win.h" diff --git a/libs/video/targets/vid_x11.c b/libs/video/targets/vid_x11.c index 826ee8acc..43a88b280 100644 --- a/libs/video/targets/vid_x11.c +++ b/libs/video/targets/vid_x11.c @@ -77,6 +77,7 @@ static const char rcsid[] = #include "compat.h" #include "context_x11.h" +#include "d_iface.h" #include "dga_check.h" static Colormap x_cmap; @@ -393,7 +394,7 @@ event_shm (XEvent * event) oktodraw = true; } -void +static void VID_Center_f (void) { X11_ForceViewPort (); } diff --git a/nq/include/host.h b/nq/include/host.h index 2d4eb644f..f20298133 100644 --- a/nq/include/host.h +++ b/nq/include/host.h @@ -37,9 +37,7 @@ extern qboolean noclip_anglehack; typedef struct { int argc; - char **argv; - void *membase; - int memsize; + const char **argv; } quakeparms_t; extern quakeparms_t host_parms; @@ -63,7 +61,7 @@ extern struct cbuf_s *host_cbuf; void Host_ClearMemory (void); void Host_ServerFrame (void); void Host_InitCommands (void); -void Host_Init (); +void Host_Init (void); void Host_Skin_Init (void); void Host_Skin_Init_Cvars (void); void Host_Shutdown(void); diff --git a/nq/include/net.h b/nq/include/net.h index d95550e43..9fff5dded 100644 --- a/nq/include/net.h +++ b/nq/include/net.h @@ -308,7 +308,7 @@ typedef struct _PollProcedure { struct _PollProcedure *next; double nextTime; - void (*procedure)(); + void (*procedure)(void *); void *arg; } PollProcedure; diff --git a/nq/include/server.h b/nq/include/server.h index c7259f50e..8144ce0c9 100644 --- a/nq/include/server.h +++ b/nq/include/server.h @@ -271,7 +271,7 @@ void SV_MoveToGoal (progs_t *pr); void SV_CheckForNewClients (void); void SV_RunClients (void); -void SV_SaveSpawnparms (); +void SV_SaveSpawnparms (void); void SV_SpawnServer (const char *server); void SV_LoadProgs (void); @@ -282,4 +282,6 @@ void Cvar_Info (struct cvar_s *var); #define STOP_EPSILON 0.1 +extern struct clip_hull_s *pf_hull_list[]; + #endif // __server_h diff --git a/nq/include/sv_pr_cmds.h b/nq/include/sv_pr_cmds.h index 2b6dc3b47..9b7dfb3aa 100644 --- a/nq/include/sv_pr_cmds.h +++ b/nq/include/sv_pr_cmds.h @@ -32,7 +32,6 @@ #ifndef __sv_pr_cmds_h #define __sv_pr_cmds_h -const char * PF_VarString (progs_t * pr, int first); void PF_error (progs_t * pr); void PF_objerror (progs_t * pr); void PF_makevectors (progs_t * pr); diff --git a/nq/source/cl_cam.c b/nq/source/cl_cam.c index 319836976..3f6250ddf 100644 --- a/nq/source/cl_cam.c +++ b/nq/source/cl_cam.c @@ -34,6 +34,7 @@ static const char rcsid[] = #include "QF/cvar.h" #include "QF/mathlib.h" +#include "chase.h" #include "client.h" #include "world.h" @@ -73,7 +74,7 @@ Chase_Reset (void) // start position 12 units behind head } -void +static void TraceLine (vec3_t start, vec3_t end, vec3_t impact) { trace_t trace; diff --git a/nq/source/cl_cmd.c b/nq/source/cl_cmd.c index d8acf082b..b38b62620 100644 --- a/nq/source/cl_cmd.c +++ b/nq/source/cl_cmd.c @@ -71,20 +71,3 @@ CL_Cmd_ForwardToServer (void) else SZ_Print (&cls.message, "\n"); } - -void -cl_Cmd_Init (void) -{ - // register our commands - Cmd_AddCommand ("cmd", CL_Cmd_ForwardToServer, "Send a command to the " - "server.\n" - "Commands:\n" - "download - Same as the command.\n" - "kill - Same as the command.\n" - "msg (value) - Same as the command.\n" - "prespawn (entity) (spot) - Find a spawn spot for the " - "player entity.\n" - "spawn (entity) - Spawn the player entity.\n" - "setinfo - Same as the command.\n" - "serverinfo - Same as the command."); -} diff --git a/nq/source/cl_demo.c b/nq/source/cl_demo.c index 963d801a8..a950dcf26 100644 --- a/nq/source/cl_demo.c +++ b/nq/source/cl_demo.c @@ -96,7 +96,7 @@ CL_StopPlayback (void) Dumps the current net message, prefixed by the length and view angles */ -void +static void CL_WriteDemoMessage (void) { int len; @@ -287,7 +287,7 @@ CL_Record_f (void) } -void +static void CL_StartDemo (void) { char name[256]; @@ -347,7 +347,7 @@ CL_PlayDemo_f (void) CL_StartDemo (); } -void +static void CL_StartTimeDemo (void) { CL_StartDemo (); diff --git a/nq/source/cl_input.c b/nq/source/cl_input.c index b0fe9d4c8..d9457b2a3 100644 --- a/nq/source/cl_input.c +++ b/nq/source/cl_input.c @@ -75,7 +75,7 @@ kbutton_t in_up, in_down; int in_impulse; -void +static void KeyDown (kbutton_t *b) { const char *c; @@ -105,7 +105,7 @@ KeyDown (kbutton_t *b) b->state |= 1 + 2; // down + impulse down } -void +static void KeyUp (kbutton_t *b) { const char *c; @@ -139,25 +139,25 @@ KeyUp (kbutton_t *b) b->state |= 4; // impulse up } -void +static void IN_KLookDown (void) { KeyDown (&in_klook); } -void +static void IN_KLookUp (void) { KeyUp (&in_klook); } -void +static void IN_MLookDown (void) { KeyDown (&in_mlook); } -void +static void IN_MLookUp (void) { KeyUp (&in_mlook); @@ -165,187 +165,187 @@ IN_MLookUp (void) V_StartPitchDrift (); } -void +static void IN_UpDown (void) { KeyDown (&in_up); } -void +static void IN_UpUp (void) { KeyUp (&in_up); } -void +static void IN_DownDown (void) { KeyDown (&in_down); } -void +static void IN_DownUp (void) { KeyUp (&in_down); } -void +static void IN_LeftDown (void) { KeyDown (&in_left); } -void +static void IN_LeftUp (void) { KeyUp (&in_left); } -void +static void IN_RightDown (void) { KeyDown (&in_right); } -void +static void IN_RightUp (void) { KeyUp (&in_right); } -void +static void IN_ForwardDown (void) { KeyDown (&in_forward); } -void +static void IN_ForwardUp (void) { KeyUp (&in_forward); } -void +static void IN_BackDown (void) { KeyDown (&in_back); } -void +static void IN_BackUp (void) { KeyUp (&in_back); } -void +static void IN_LookupDown (void) { KeyDown (&in_lookup); } -void +static void IN_LookupUp (void) { KeyUp (&in_lookup); } -void +static void IN_LookdownDown (void) { KeyDown (&in_lookdown); } -void +static void IN_LookdownUp (void) { KeyUp (&in_lookdown); } -void +static void IN_MoveleftDown (void) { KeyDown (&in_moveleft); } -void +static void IN_MoveleftUp (void) { KeyUp (&in_moveleft); } -void +static void IN_MoverightDown (void) { KeyDown (&in_moveright); } -void +static void IN_MoverightUp (void) { KeyUp (&in_moveright); } -void +static void IN_SpeedDown (void) { KeyDown (&in_speed); } -void +static void IN_SpeedUp (void) { KeyUp (&in_speed); } -void +static void IN_StrafeDown (void) { KeyDown (&in_strafe); } -void +static void IN_StrafeUp (void) { KeyUp (&in_strafe); } -void +static void IN_AttackDown (void) { KeyDown (&in_attack); } -void +static void IN_AttackUp (void) { KeyUp (&in_attack); } -void +static void IN_UseDown (void) { KeyDown (&in_use); } -void +static void IN_UseUp (void) { KeyUp (&in_use); } -void +static void IN_JumpDown (void) { KeyDown (&in_jump); } -void +static void IN_JumpUp (void) { KeyUp (&in_jump); } -void +static void IN_Impulse (void) { in_impulse = atoi (Cmd_Argv (1)); @@ -414,7 +414,7 @@ cvar_t *cl_yawspeed; Moves the local angle positions */ -void +static void CL_AdjustAngles (void) { float speed, up, down; diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 571e1955b..274aa07d3 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -93,14 +93,14 @@ cl_entity_state_t cl_baselines[MAX_EDICTS]; entity_t cl_static_entities[MAX_STATIC_ENTITIES]; -void +static void CL_Sbar_f (cvar_t *var) { vid.recalc_refdef = true; r_lineadj = var->int_val ? sb_lines : 0; } -void +static void cl_hudswap_f (cvar_t *var) { if (cl_hudswap) @@ -204,7 +204,7 @@ CL_ClearState (void) Cleans the Cshifts, so your screen doesn't stay red after a timedemo :) */ -void +static void CL_StopCshifts (void) { int i; @@ -362,7 +362,7 @@ CL_NextDemo (void) cls.demonum++; } -void +static void CL_PrintEntities_f (void) { entity_t *ent; @@ -386,7 +386,7 @@ CL_PrintEntities_f (void) Debugging tool, just flashes the screen */ -void +static void SetPal (int i) { #if 0 @@ -418,7 +418,7 @@ SetPal (int i) #endif } -void +static void CL_NewDlight (int key, vec3_t org, int effects) { float radius; @@ -469,7 +469,7 @@ CL_NewDlight (int key, vec3_t org, int effects) Determines the fraction between the last two messages that the objects should be put at. */ -float +static float CL_LerpPoint (void) { float f, frac; @@ -505,7 +505,7 @@ CL_LerpPoint (void) return frac; } -void +static void CL_RelinkEntities (void) { entity_t **_ent; @@ -741,7 +741,7 @@ CL_SetState (cactive_t state) con_module->data->console->force_commandline = (state != ca_active); } -void +static void Force_CenterView_f (void) { cl.viewangles[PITCH] = 0; diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index cd066b5c0..4b259cb75 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -55,7 +55,7 @@ static const char rcsid[] = #include "server.h" #include "game.h" -char *svc_strings[] = { +const char *svc_strings[] = { "svc_bad", "svc_nop", "svc_disconnect", @@ -107,7 +107,7 @@ char *svc_strings[] = { This error checks and tracks the total number of entities */ -cl_entity_state_t * +static cl_entity_state_t * CL_EntityNum (int num) { if (num >= cl.num_entities) { @@ -124,7 +124,7 @@ CL_EntityNum (int num) return &cl_baselines[num]; } -void +static void CL_ParseStartSoundPacket (void) { float attenuation; @@ -164,7 +164,7 @@ CL_ParseStartSoundPacket (void) When the client is taking a long time to load stuff, send keepalive messages so the server doesn't disconnect. */ -void +static void CL_KeepaliveMessage (void) { byte olddata[8192]; @@ -240,7 +240,7 @@ map_cfg (const char *mapname, int all) free (name); } -void +static void CL_NewMap (const char *mapname) { R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS); @@ -249,7 +249,7 @@ CL_NewMap (const char *mapname) map_cfg (mapname, 1); } -void +static void CL_ParseServerInfo (void) { char model_precache[MAX_MODELS][MAX_QPATH]; @@ -359,7 +359,7 @@ int bitcounts[16]; If an entities model or origin changes from frame to frame, it must be relinked. Other attributes can change without relinking. */ -void +static void CL_ParseUpdate (int bits) { entity_t *ent; @@ -551,7 +551,7 @@ link: } } -void +static void CL_ParseBaseline (cl_entity_state_t *state) { state->baseline.modelindex = MSG_ReadByte (net_message); @@ -575,7 +575,7 @@ CL_ParseBaseline (cl_entity_state_t *state) Server information pertaining to this client only */ -void +static void CL_ParseClientdata (int bits) { int i, j; @@ -675,7 +675,7 @@ CL_ParseClientdata (int bits) } } -void +static void CL_ParseStatic (void) { cl_entity_state_t state; @@ -712,7 +712,7 @@ CL_ParseStatic (void) R_AddEfrags (ent); } -void +static void CL_ParseStaticSound (void) { int sound_num, vol, atten; diff --git a/nq/source/cl_screen.c b/nq/source/cl_screen.c index 384b72d38..063a31490 100644 --- a/nq/source/cl_screen.c +++ b/nq/source/cl_screen.c @@ -52,7 +52,7 @@ static const char rcsid[] = #include "sbar.h" -void +static void SCR_DrawNet (void) { if (realtime - cl.last_received_message < 0.3) diff --git a/nq/source/cl_tent.c b/nq/source/cl_tent.c index 0d6a9c242..2a0773e33 100644 --- a/nq/source/cl_tent.c +++ b/nq/source/cl_tent.c @@ -161,7 +161,7 @@ CL_ClearTEnts (void) } } -explosion_t * +static explosion_t * CL_AllocExplosion (void) { float time; @@ -260,7 +260,7 @@ beam_setup (beam_t *b) } } -void +static void CL_ParseBeam (model_t *m) { beam_t *b; @@ -454,7 +454,7 @@ CL_ParseTEnt (void) } } -void +static void CL_UpdateBeams (void) { beam_t *b; @@ -521,7 +521,7 @@ CL_UpdateBeams (void) } } -void +static void CL_UpdateExplosions (void) { entity_t **ent; diff --git a/nq/source/cl_view.c b/nq/source/cl_view.c index 7709f50ba..e3f37b17c 100644 --- a/nq/source/cl_view.c +++ b/nq/source/cl_view.c @@ -91,7 +91,7 @@ cshift_t cshift_lava = { {255, 80, 0}, 150}; cshift_t cshift_bonus = { {215, 186, 60}, 50}; -float +static float V_CalcBob (void) { float bob, cycle; @@ -152,7 +152,7 @@ V_StopPitchDrift (void) Drifting is enabled when the center view key is hit, mlook is released and lookspring is non 0, or when */ -void +static void V_DriftPitch (void) { float delta, move; @@ -260,7 +260,7 @@ V_ParseDamage (void) v_dmg_time = v_kicktime->value; } -void +static void V_cshift_f (void) { cshift_empty.destcolor[0] = atoi (Cmd_Argv (1)); @@ -274,7 +274,7 @@ V_cshift_f (void) When you run over an item, the server sends this command */ -void +static void V_BonusFlash_f (void) { if (!cl_cshift_bonus->int_val) @@ -311,7 +311,7 @@ V_SetContentsColor (int contents) } } -void +static void V_CalcPowerupCshift (void) { if (!cl.stats[STAT_ITEMS] & (IT_SUIT || IT_INVISIBILITY || IT_QUAD @@ -438,7 +438,7 @@ V_PrepBlend (void) /* VIEW RENDERING */ -float +static float angledelta (float a) { a = anglemod (a); @@ -447,7 +447,7 @@ angledelta (float a) return a; } -void +static void CalcGunAngle (void) { float yaw, pitch, move; @@ -495,7 +495,7 @@ CalcGunAngle (void) v_iyaw_level->value; } -void +static void V_BoundOffsets (void) { entity_t *ent; @@ -524,7 +524,7 @@ V_BoundOffsets (void) Idle swaying */ -void +static void V_AddIdle (void) { r_refdef.viewangles[ROLL] += @@ -543,7 +543,7 @@ V_AddIdle (void) Roll is induced by movement and damage */ -void +static void V_CalcViewRoll (void) { float side; @@ -566,7 +566,7 @@ V_CalcViewRoll (void) } -void +static void V_CalcIntermissionRefdef (void) { entity_t *ent, *view; @@ -589,7 +589,7 @@ V_CalcIntermissionRefdef (void) Cvar_SetValue (v_idlescale, old); } -void +static void V_CalcRefdef (void) { entity_t *ent, *view; diff --git a/nq/source/com.c b/nq/source/com.c index 647a82ded..34a02b50a 100644 --- a/nq/source/com.c +++ b/nq/source/com.c @@ -53,7 +53,7 @@ int static_registered = 1; Immediately exits out if an alternate game was attempted to be started without being registered. */ -void +static void COM_CheckRegistered (void) { unsigned short check[128]; diff --git a/nq/source/host.c b/nq/source/host.c index 9f1c97d11..f883cc2a5 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -193,7 +193,7 @@ Host_Error (const char *error, ...) longjmp (host_abortserver, 1); } -void +static void Host_FindMaxClients (void) { int i; @@ -236,7 +236,7 @@ Host_FindMaxClients (void) Cvar_SetValue (deathmatch, 0.0); } -void +static void Host_InitLocal (void) { Host_InitCommands (); @@ -277,7 +277,7 @@ Host_InitLocal (void) Writes key bindings and archived cvars to config.cfg */ -void +static void Host_WriteConfiguration (void) { QFile *f; @@ -508,7 +508,7 @@ Host_ClearMemory (void) Returns false if the time is too short to run a frame */ -qboolean +static qboolean Host_FilterTime (float time) { float timedifference; @@ -543,7 +543,7 @@ Host_FilterTime (float time) Add them exactly as if they had been typed at the console */ -void +static void Host_GetConsoleCommands (void) { Con_ProcessInput (); @@ -580,7 +580,7 @@ Host_ServerFrame (void) Runs all active servers */ -void +static void _Host_Frame (float time) { static double time1 = 0, time2 = 0, time3 = 0; @@ -728,7 +728,7 @@ Host_Frame (float time) #define VCR_SIGNATURE 0x56435231 // "VCR1" -void +static void Host_InitVCR (quakeparms_t *parms) { char *p; @@ -813,7 +813,7 @@ check_quakerc (void) return ret; } -void +static void CL_Init_Memory (void) { int mem_parm = COM_CheckParm ("-mem"); diff --git a/nq/source/host_cmd.c b/nq/source/host_cmd.c index 3c1bf7b10..1843727a2 100644 --- a/nq/source/host_cmd.c +++ b/nq/source/host_cmd.c @@ -67,7 +67,7 @@ Host_Quit_f (void) Sys_Quit (); } -void +static void Host_Status_f (void) { client_t *client; @@ -119,7 +119,7 @@ Host_Status_f (void) Sets client to godmode */ -void +static void Host_God_f (void) { if (cmd_source == src_command) { @@ -137,7 +137,7 @@ Host_God_f (void) SV_ClientPrintf ("godmode ON\n"); } -void +static void Host_Notarget_f (void) { if (cmd_source == src_command) { @@ -158,7 +158,7 @@ Host_Notarget_f (void) qboolean noclip_anglehack; -void +static void Host_Noclip_f (void) { if (cmd_source == src_command) { @@ -185,7 +185,7 @@ Host_Noclip_f (void) Sets client to flymode */ -void +static void Host_Fly_f (void) { if (cmd_source == src_command) { @@ -205,7 +205,7 @@ Host_Fly_f (void) } } -void +static void Host_Ping_f (void) { int i, j; @@ -255,7 +255,7 @@ nice_time (float time) map command from the console. Active clients are kicked off. */ -void +static void Host_Map_f (void) { int i; @@ -321,7 +321,7 @@ Host_Map_f (void) Goes to a new map, taking all clients along */ -void +static void Host_Changelevel_f (void) { char level[MAX_QPATH]; @@ -345,7 +345,7 @@ Host_Changelevel_f (void) Restarts the current server for a dead player */ -void +static void Host_Restart_f (void) { char mapname[MAX_QPATH]; @@ -366,7 +366,7 @@ Host_Restart_f (void) This command causes the client to wait for the signon messages again. This is sent just before a server changes levels */ -void +static void Host_Reconnect_f (void) { // SCR_BeginLoadingPlaque (); @@ -378,7 +378,7 @@ Host_Reconnect_f (void) User command to connect to server */ -void +static void Host_Connect_f (void) { char name[MAX_QPATH]; @@ -402,7 +402,7 @@ Host_Connect_f (void) Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current */ -void +static void Host_SavegameComment (char *text) { int i; @@ -421,7 +421,7 @@ Host_SavegameComment (char *text) text[SAVEGAME_COMMENT_LENGTH] = '\0'; } -void +static void Host_Savegame_f (void) { char name[256]; @@ -502,7 +502,7 @@ Host_Savegame_f (void) Con_Printf ("done.\n"); } -void +static void Host_Loadgame_f (void) { char name[MAX_OSPATH]; @@ -642,7 +642,7 @@ Host_Loadgame_f (void) //============================================================================ -void +static void Host_Name_f (void) { const char *newName; @@ -678,14 +678,14 @@ Host_Name_f (void) MSG_WriteString (&sv.reliable_datagram, host_client->name); } -void +static void Host_Version_f (void) { Con_Printf ("Version %s\n", VERSION); Con_Printf ("Exe: " __TIME__ " " __DATE__ "\n"); } -void +static void Host_Say (qboolean teamonly) { client_t *client; @@ -744,19 +744,19 @@ Host_Say (qboolean teamonly) Con_Printf ("%s", &text[1]); } -void +static void Host_Say_f (void) { Host_Say (false); } -void +static void Host_Say_Team_f (void) { Host_Say (true); } -void +static void Host_Tell_f (void) { client_t *client; @@ -805,7 +805,7 @@ Host_Tell_f (void) host_client = save; } -void +static void Host_Kill_f (void) { if (cmd_source == src_command) { @@ -823,7 +823,7 @@ Host_Kill_f (void) PR_ExecuteProgram (&sv_pr_state, sv_funcs.ClientKill); } -void +static void Host_Pause_f (void) { @@ -854,7 +854,7 @@ Host_Pause_f (void) //=========================================================================== -void +static void Host_PreSpawn_f (void) { if (cmd_source == src_command) { @@ -873,7 +873,7 @@ Host_PreSpawn_f (void) host_client->sendsignon = true; } -void +static void Host_Spawn_f (void) { int i; @@ -980,7 +980,7 @@ Host_Spawn_f (void) host_client->sendsignon = true; } -void +static void Host_Begin_f (void) { if (cmd_source == src_command) { @@ -998,7 +998,7 @@ Host_Begin_f (void) Kicks a user off of the server */ -void +static void Host_Kick_f (void) { const char *who; @@ -1193,7 +1193,7 @@ Host_Give_f (void) } #endif -edict_t * +static edict_t * FindViewthing (void) { int i; @@ -1209,7 +1209,7 @@ FindViewthing (void) return NULL; } -void +static void Host_Viewmodel_f (void) { edict_t *e; @@ -1229,7 +1229,7 @@ Host_Viewmodel_f (void) cl.model_precache[(int) SVfloat (e, modelindex)] = m; } -void +static void Host_Viewframe_f (void) { edict_t *e; @@ -1248,7 +1248,7 @@ Host_Viewframe_f (void) SVfloat (e, frame) = f; } -void +static void PrintFrameName (model_t *m, int frame) { aliashdr_t *hdr; @@ -1263,7 +1263,7 @@ PrintFrameName (model_t *m, int frame) Cache_Release (&m->cache); } -void +static void Host_Viewnext_f (void) { edict_t *e; @@ -1281,7 +1281,7 @@ Host_Viewnext_f (void) PrintFrameName (m, SVfloat (e, frame)); } -void +static void Host_Viewprev_f (void) { edict_t *e; @@ -1302,7 +1302,7 @@ Host_Viewprev_f (void) // DEMO LOOP CONTROL ========================================================== -void +static void Host_Startdemos_f (void) { int i, c; @@ -1335,7 +1335,7 @@ Host_Startdemos_f (void) Return to looping demos */ -void +static void Host_Demos_f (void) { if (cls.state == ca_dedicated) @@ -1351,7 +1351,7 @@ Host_Demos_f (void) Return to looping demos */ -void +static void Host_Stopdemo_f (void) { if (cls.state == ca_dedicated) diff --git a/nq/source/host_skin.c b/nq/source/host_skin.c index f8c5ecde1..4a78dd849 100644 --- a/nq/source/host_skin.c +++ b/nq/source/host_skin.c @@ -59,7 +59,7 @@ cvar_t *cl_color; -void +static void Host_Color_f (void) { // just for quake compatability... diff --git a/nq/source/locs.c b/nq/source/locs.c index a65b52283..9c11e7016 100644 --- a/nq/source/locs.c +++ b/nq/source/locs.c @@ -87,7 +87,7 @@ locs_find (const vec3_t target) return locations[i]; } -void +static void locs_more (void) { size_t size; diff --git a/nq/source/net_dgrm.c b/nq/source/net_dgrm.c index 1fe962765..09921dcb1 100644 --- a/nq/source/net_dgrm.c +++ b/nq/source/net_dgrm.c @@ -139,7 +139,7 @@ StrAddr (struct qsockaddr *addr) unsigned long banAddr = 0x00000000; unsigned long banMask = 0xffffffff; -void +static void NET_Ban_f (void) { char addrStr[32]; @@ -235,7 +235,7 @@ Datagram_SendMessage (qsocket_t * sock, sizebuf_t *data) } -int +static int SendMessageNext (qsocket_t * sock) { unsigned int packetLen; @@ -267,7 +267,7 @@ SendMessageNext (qsocket_t * sock) } -int +static int ReSendMessage (qsocket_t * sock) { unsigned int packetLen; @@ -485,7 +485,7 @@ Datagram_GetMessage (qsocket_t * sock) } -void +static void PrintStats (qsocket_t * s) { Con_Printf ("canSend = %4u \n", s->canSend); @@ -494,7 +494,7 @@ PrintStats (qsocket_t * s) Con_Printf ("\n"); } -void +static void NET_Stats_f (void) { qsocket_t *s; @@ -538,11 +538,11 @@ static int testPollCount; static int testDriver; static int testSocket; -static void Test_Poll (void); +static void Test_Poll (void *); PollProcedure testPollProcedure = { NULL, 0.0, Test_Poll }; static void -Test_Poll (void) +Test_Poll (void *unused) { struct qsockaddr clientaddr; int control; @@ -670,11 +670,11 @@ static qboolean test2InProgress = false; static int test2Driver; static int test2Socket; -static void Test2_Poll (void); +static void Test2_Poll (void *); PollProcedure test2PollProcedure = { NULL, 0.0, Test2_Poll }; static void -Test2_Poll (void) +Test2_Poll (void *unused) { struct qsockaddr clientaddr; int control; diff --git a/nq/source/net_main.c b/nq/source/net_main.c index eb74e7c18..20bbdab23 100644 --- a/nq/source/net_main.c +++ b/nq/source/net_main.c @@ -83,8 +83,8 @@ qboolean slistLocal = true; static double slistStartTime; static int slistLastShown; -static void Slist_Send (void); -static void Slist_Poll (void); +static void Slist_Send (void *); +static void Slist_Poll (void *); PollProcedure slistSendProcedure = { NULL, 0.0, Slist_Send }; PollProcedure slistPollProcedure = { NULL, 0.0, Slist_Poll }; @@ -348,7 +348,7 @@ NET_Slist_f (void) static void -Slist_Send (void) +Slist_Send (void *unused) { for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++) { @@ -365,7 +365,7 @@ Slist_Send (void) static void -Slist_Poll (void) +Slist_Poll (void *unused) { for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++) { diff --git a/nq/source/net_udp.c b/nq/source/net_udp.c index 131ccacec..cdfc325db 100644 --- a/nq/source/net_udp.c +++ b/nq/source/net_udp.c @@ -328,7 +328,7 @@ UDP_Read (int socket, byte * buf, int len, struct qsockaddr *addr) return ret; } -int +static int UDP_MakeSocketBroadcastCapable (int socket) { int i = 1; diff --git a/nq/source/net_vcr.c b/nq/source/net_vcr.c index 1acb8d242..3126bdd4e 100644 --- a/nq/source/net_vcr.c +++ b/nq/source/net_vcr.c @@ -68,7 +68,7 @@ VCR_Init (void) return 0; } -void +static void VCR_ReadNext (void) { if (Qread (vcrFile, &next, sizeof (next)) == 0) { diff --git a/nq/source/net_wins.c b/nq/source/net_wins.c index b7eccdd6f..f3258e5f8 100644 --- a/nq/source/net_wins.c +++ b/nq/source/net_wins.c @@ -88,7 +88,7 @@ WSADATA winsockdata; static double blocktime; -BOOL PASCAL FAR +static BOOL PASCAL FAR BlockingHook (void) { MSG msg; @@ -113,8 +113,8 @@ BlockingHook (void) } -void -WINS_GetLocalAddress () +static void +WINS_GetLocalAddress (void) { struct hostent *local = NULL; char buff[MAXHOSTNAMELEN]; @@ -432,7 +432,7 @@ WINS_Read (int socket, byte * buf, int len, struct qsockaddr *addr) //============================================================================= -int +static int WINS_MakeSocketBroadcastCapable (int socket) { int i = 1; diff --git a/nq/source/pr_cmds.c b/nq/source/pr_cmds.c index 5d14dd1fa..dd7b18a11 100644 --- a/nq/source/pr_cmds.c +++ b/nq/source/pr_cmds.c @@ -138,7 +138,7 @@ PF_setorigin (progs_t *pr) SV_LinkEdict (e, false); } -void +static void SetMinMaxSize (progs_t *pr, edict_t *e, const vec3_t min, const vec3_t max, qboolean rotate) { @@ -680,7 +680,7 @@ PF_Remove (progs_t *pr) ED_Free (pr, ed); } -void +static void PR_CheckEmptyString (progs_t *pr, const char *s) { if (s[0] <= ' ') @@ -989,7 +989,7 @@ PF_changeyaw (progs_t *pr) #define MSG_ALL 2 // reliable to all #define MSG_INIT 3 // write to the init string -sizebuf_t * +static sizebuf_t * WriteDest (progs_t *pr) { int entnum; @@ -1307,7 +1307,7 @@ PF_Fixme (progs_t *pr) } -void +static void PF_checkextension (progs_t *pr) { G_FLOAT(pr, OFS_RETURN) = 0; //FIXME make this function actually useful :P diff --git a/nq/source/sbar.c b/nq/source/sbar.c index 37aacbb03..1a8f1bbcb 100644 --- a/nq/source/sbar.c +++ b/nq/source/sbar.c @@ -90,7 +90,7 @@ qpic_t *hsb_items[2]; // MED 01/04/97 added hipnotic items array qboolean headsup; qboolean sbar_centered; -int +static int Sbar_ColorForMap (int m) { return m + 8; // FIXME: Might want this to be @@ -103,7 +103,7 @@ Sbar_ColorForMap (int m) Tab key has been pressed, inform sbar it needs to show scores */ -void +static void Sbar_ShowScores (void) { if (sb_showscores) @@ -118,7 +118,7 @@ Sbar_ShowScores (void) Tab key up, show normal sbar again */ -void +static void Sbar_DontShowScores (void) { if (!sb_showscores) @@ -235,7 +235,7 @@ Sbar_DrawString (int x, int y, char *str) Convert an int to ascii */ -int +static int Sbar_itoa (int num, char *buf) { char *str; @@ -264,7 +264,7 @@ Sbar_itoa (int num, char *buf) } -void +static void Sbar_DrawNum (int x, int y, int num, int digits, int color) { char str[12]; @@ -299,7 +299,7 @@ int scoreboardcount[MAX_SCOREBOARD]; int scoreboardlines; -void +static void Sbar_SortFrags (void) { int i, j, k; @@ -325,33 +325,7 @@ Sbar_SortFrags (void) } -void -Sbar_UpdateScoreboard (void) -{ - int i, k; - int top, bottom; - scoreboard_t *s; - - Sbar_SortFrags (); - - // draw the text - memset (scoreboardtext, 0, sizeof (scoreboardtext)); - - for (i = 0; i < scoreboardlines; i++) { - k = fragsort[i]; - s = &cl.scores[k]; - snprintf (&scoreboardtext[i][1], sizeof (&scoreboardtext[i][1]), - "%3i %s", s->frags, s->name); - - top = s->colors & 0xf0; - bottom = (s->colors & 15) << 4; - scoreboardtop[i] = Sbar_ColorForMap (top); - scoreboardbottom[i] = Sbar_ColorForMap (bottom); - } -} - - -void +static void Sbar_SoloScoreboard (void) { char str[80]; @@ -383,7 +357,7 @@ Sbar_SoloScoreboard (void) } -void +static void Sbar_DrawScoreboard (void) { Sbar_SoloScoreboard (); @@ -392,7 +366,7 @@ Sbar_DrawScoreboard (void) } -void +static void Sbar_DrawInventory (void) { int i; @@ -603,7 +577,7 @@ Sbar_DrawInventory (void) } -void +static void Sbar_DrawFrags (void) { int i, k, l; @@ -659,7 +633,7 @@ Sbar_DrawFrags (void) } -void +static void Sbar_DrawFace (void) { int f, anim; @@ -748,7 +722,7 @@ Sbar_DrawFace (void) } -void +static void Sbar_DrawNormal (void) { if (!headsup) @@ -873,7 +847,7 @@ Sbar_Draw (void) } -void +static void Sbar_IntermissionNumber (int x, int y, int num, int digits, int color) { char str[12]; diff --git a/nq/source/sv_cl_phys.c b/nq/source/sv_cl_phys.c index a7adc9daa..e0fac4192 100644 --- a/nq/source/sv_cl_phys.c +++ b/nq/source/sv_cl_phys.c @@ -51,7 +51,7 @@ static const char rcsid[] = This is a big hack to try and fix the rare case of getting stuck in the world clipping hull. */ -void +static void SV_CheckStuck (edict_t *ent) { int i, j, z; @@ -87,7 +87,7 @@ SV_CheckStuck (edict_t *ent) Con_DPrintf ("player is stuck.\n"); } -qboolean +static qboolean SV_CheckWater (edict_t *ent) { int cont; @@ -118,7 +118,7 @@ SV_CheckWater (edict_t *ent) return SVfloat (ent, waterlevel) > 1; } -void +static void SV_WallFriction (edict_t *ent, trace_t *trace) { float d, i; @@ -150,7 +150,7 @@ SV_WallFriction (edict_t *ent, trace_t *trace) This is a hack, but in the interest of good gameplay... */ -int +static int SV_TryUnstick (edict_t *ent, vec3_t oldvel) { int i, clip; @@ -225,7 +225,7 @@ SV_TryUnstick (edict_t *ent, vec3_t oldvel) Only used by players */ -void +static void SV_WalkMove (edict_t *ent) { int clip, oldonground; diff --git a/nq/source/sv_ded.c b/nq/source/sv_ded.c index 4becb6f82..3f3124014 100644 --- a/nq/source/sv_ded.c +++ b/nq/source/sv_ded.c @@ -34,13 +34,21 @@ static const char rcsid[] = #include #include +#include "QF/cdaudio.h" +#include "QF/csqc.h" #include "QF/cvar.h" +#include "QF/draw.h" #include "QF/keys.h" #include "QF/plugin.h" +#include "QF/screen.h" #include "QF/sys.h" +#include "chase.h" #include "client.h" #include "host.h" +#include "r_dynamic.h" +#include "sbar.h" +#include "view.h" client_state_t cl; client_static_t cls; @@ -82,9 +90,10 @@ CL_Cmd_ForwardToServer (void) { } -void +int CDAudio_Init (void) { + return 0; } void @@ -307,6 +316,7 @@ V_Init_Cvars (void) { } +QFPLUGIN plugin_t *console_client_PluginInfo (void); QFPLUGIN plugin_t * console_client_PluginInfo (void) { diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index 605e6cb74..a7a5a8094 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -178,7 +178,7 @@ SV_StartSound (edict_t *entity, int channel, const char *sample, int volume, Sends the first message from the server to a connected client. This will be sent on the initial connection and upon each server load. */ -void +static void SV_SendServerinfo (client_t *client) { const char **s; @@ -234,7 +234,7 @@ SV_SendServerinfo (client_t *client) Initializes a client_t for a new net connection. This will only be called once for a player each game, not once for each level change. */ -void +static void SV_ConnectClient (int clientnum) { edict_t *ent; @@ -326,7 +326,7 @@ SV_ClearDatagram (void) int fatbytes; byte fatpvs[MAX_MAP_LEAFS / 8]; -void +static void SV_AddToFatPVS (vec3_t org, mnode_t *node) { int i; @@ -364,7 +364,7 @@ SV_AddToFatPVS (vec3_t org, mnode_t *node) Calculates a PVS that is the inclusive or of all leafs within 8 pixels of the given point. */ -byte * +static byte * SV_FatPVS (vec3_t org) { fatbytes = (sv.worldmodel->numleafs + 31) >> 3; @@ -375,7 +375,7 @@ SV_FatPVS (vec3_t org) //============================================================================= -void +static void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) { int bits, e, i; @@ -492,7 +492,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) } } -void +static void SV_CleanupEnts (void) { int e; @@ -623,7 +623,7 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) } } -qboolean +static qboolean SV_SendClientDatagram (client_t *client) { byte buf[MAX_DATAGRAM]; @@ -654,7 +654,7 @@ SV_SendClientDatagram (client_t *client) return true; } -void +static void SV_UpdateToReliableMessages (void) { int i, j; @@ -695,7 +695,7 @@ SV_UpdateToReliableMessages (void) Send a nop message without trashing or sending the accumulated client message buffer */ -void +static void SV_SendNop (client_t *client) { sizebuf_t msg; @@ -792,7 +792,7 @@ SV_ModelIndex (const char *name) return i; } -void +static void SV_CreateBaseline (void) { int entnum; @@ -845,7 +845,7 @@ SV_CreateBaseline (void) Tell all the clients that the server is changing levels */ -void +static void SV_SendReconnect (void) { char data[128]; diff --git a/nq/source/sv_model.c b/nq/source/sv_model.c index 6be81886b..cd364dc1b 100644 --- a/nq/source/sv_model.c +++ b/nq/source/sv_model.c @@ -34,6 +34,7 @@ static const char rcsid[] = #include "QF/cvar.h" #include "QF/model.h" +#include "QF/render.h" int mod_lightmap_bytes = 1; diff --git a/nq/source/sv_move.c b/nq/source/sv_move.c index bb6ecd650..730f64f72 100644 --- a/nq/source/sv_move.c +++ b/nq/source/sv_move.c @@ -224,7 +224,7 @@ SV_movestep (edict_t *ent, const vec3_t move, qboolean relink) Turns to the movement direction, and walks the current distance if facing it. */ -qboolean +static qboolean SV_StepDirection (edict_t *ent, float yaw, float dist) { float delta; @@ -253,7 +253,7 @@ SV_StepDirection (edict_t *ent, float yaw, float dist) return false; } -void +static void SV_FixCheckBottom (edict_t *ent) { SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_PARTIALGROUND; @@ -261,7 +261,7 @@ SV_FixCheckBottom (edict_t *ent) #define DI_NODIR -1 -void +static void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist) { float deltax, deltay, olddir, tdir, turnaround; @@ -333,7 +333,7 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist) SV_FixCheckBottom (actor); } -qboolean +static qboolean SV_CloseEnough (edict_t *ent, edict_t *goal, float dist) { int i; diff --git a/nq/source/sv_phys.c b/nq/source/sv_phys.c index fa653089b..27fc7b9db 100644 --- a/nq/source/sv_phys.c +++ b/nq/source/sv_phys.c @@ -67,8 +67,8 @@ cvar_t *sv_maxvelocity; cvar_t *sv_nostep; #define MOVE_EPSILON 0.01 - -void +#if 0 +static void SV_CheckAllEnts (void) { edict_t *check; @@ -89,7 +89,7 @@ SV_CheckAllEnts (void) Con_Printf ("entity in invalid position\n"); } } - +#endif void SV_CheckVelocity (edict_t *ent) { @@ -166,7 +166,7 @@ SV_RunThink (edict_t *ent) Two entities have touched, so run their touch functions */ -void +static void SV_Impact (edict_t *e1, edict_t *e2) { int old_self, old_other; @@ -193,7 +193,7 @@ SV_Impact (edict_t *e1, edict_t *e2) Slide off of the impacting object returns the blocked flags (1 = floor, 2 = step / wall) */ -int +static int ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) { float backoff, change; @@ -389,7 +389,7 @@ SV_PushEntity (edict_t *ent, vec3_t push) return trace; } -qboolean +static qboolean SV_Push (edict_t *pusher, vec3_t move) { float solid_save; @@ -490,7 +490,7 @@ SV_Push (edict_t *pusher, vec3_t move) return true; } -void +static void SV_PushMove (edict_t *pusher, float movetime) { vec3_t move; @@ -506,7 +506,7 @@ SV_PushMove (edict_t *pusher, float movetime) SVfloat (pusher, ltime) += movetime; } -void +static void SV_Physics_Pusher (edict_t *ent) { float movetime, oldltime, thinktime; @@ -541,7 +541,7 @@ SV_Physics_Pusher (edict_t *ent) Non moving objects can only think */ -void +static void SV_Physics_None (edict_t *ent) { // regular thinking @@ -554,7 +554,7 @@ SV_Physics_None (edict_t *ent) A moving object that doesn't obey physics */ -void +static void SV_Physics_Noclip (edict_t *ent) { // regular thinking @@ -571,7 +571,7 @@ SV_Physics_Noclip (edict_t *ent) /* TOSS / BOUNCE */ -void +static void SV_CheckWaterTransition (edict_t *ent) { int cont; @@ -674,7 +674,7 @@ SV_Physics_Toss (edict_t *ent) This is also used for objects that have become still on the ground, but will fall if the floor is pulled out from under them. */ -void +static void SV_Physics_Step (edict_t *ent) { qboolean hitsound; @@ -702,7 +702,7 @@ SV_Physics_Step (edict_t *ent) SV_CheckWaterTransition (ent); } -void +static void SV_ProgStartFrame (void) { // let the progs know that a new frame has started @@ -712,7 +712,7 @@ SV_ProgStartFrame (void) PR_ExecuteProgram (&sv_pr_state, sv_funcs.StartFrame); } -void +static void SV_RunEntity (edict_t *ent) { if (sv_fields.lastruntime != -1) { @@ -746,7 +746,7 @@ SV_RunEntity (edict_t *ent) } } -void +static void SV_RunNewmis (void) { edict_t *ent; diff --git a/nq/source/sv_progs.c b/nq/source/sv_progs.c index a58466520..dba2d85d1 100644 --- a/nq/source/sv_progs.c +++ b/nq/source/sv_progs.c @@ -92,7 +92,7 @@ prune_edict (progs_t *pr, edict_t *ent) return 0; } -void +static void ED_PrintEdicts_f (void) { ED_PrintEdicts (&sv_pr_state, Cmd_Argv (1)); @@ -103,7 +103,7 @@ ED_PrintEdicts_f (void) For debugging, prints a single edicy */ -void +static void ED_PrintEdict_f (void) { int i; @@ -113,7 +113,7 @@ ED_PrintEdict_f (void) ED_PrintNum (&sv_pr_state, i); } -void +static void ED_Count_f (void) { ED_Count (&sv_pr_state); diff --git a/nq/source/sv_user.c b/nq/source/sv_user.c index 950b6f709..e20bc42e7 100644 --- a/nq/source/sv_user.c +++ b/nq/source/sv_user.c @@ -130,7 +130,7 @@ SV_SetIdealPitch (void) SVfloat (sv_player, idealpitch) = -dir * sv_idealpitchscale->value; } -void +static void SV_UserFriction (void) { float *vel; @@ -196,7 +196,7 @@ SV_Accelerate (vec3_t wishvel) } #endif -void +static void SV_Accelerate (void) { int i; @@ -214,7 +214,7 @@ SV_Accelerate (void) velocity[i] += accelspeed * wishdir[i]; } -void +static void SV_AirAccelerate (vec3_t wishveloc) { int i; @@ -236,7 +236,7 @@ SV_AirAccelerate (vec3_t wishveloc) velocity[i] += accelspeed * wishveloc[i]; } -void +static void DropPunchAngle (void) { float len; @@ -250,7 +250,7 @@ DropPunchAngle (void) punchangle)); } -void +static void SV_WaterMove (void) { int i; @@ -302,7 +302,7 @@ SV_WaterMove (void) velocity[i] += accelspeed * wishvel[i]; } -void +static void SV_WaterJump (void) { if (sv.time > SVfloat (sv_player, teleport_time) || @@ -315,7 +315,7 @@ SV_WaterJump (void) SVvector (sv_player, velocity)[1] = SVvector (sv_player, movedir)[1]; } -void +static void SV_AirMove (void) { int i; @@ -409,7 +409,7 @@ SV_ClientThink (void) SV_AirMove (); } -void +static void SV_ReadClientMove (usercmd_t *move) { int i, bits; @@ -445,7 +445,7 @@ SV_ReadClientMove (usercmd_t *move) Returns false if the client should be killed */ -qboolean +static qboolean SV_ReadClientMessage (void) { int cmd, ret; diff --git a/nq/source/sys_sdl.c b/nq/source/sys_sdl.c index c18dc0499..2bcda4833 100644 --- a/nq/source/sys_sdl.c +++ b/nq/source/sys_sdl.c @@ -75,7 +75,7 @@ int noconinput; # include "winquake.h" #endif -void +static void startup (void) { #ifdef WIN32 diff --git a/nq/source/sys_win.c b/nq/source/sys_win.c index da7aa6946..00e942212 100644 --- a/nq/source/sys_win.c +++ b/nq/source/sys_win.c @@ -75,7 +75,7 @@ static HANDLE heventChild; #define MAX_HANDLES 10 QFile *sys_handles[MAX_HANDLES]; -int +static int findhandle (void) { int i; @@ -89,7 +89,7 @@ findhandle (void) // SYSTEM IO ================================================================== -void +static void startup (void) { LARGE_INTEGER PerformanceFreq; @@ -147,7 +147,7 @@ shutdown (void) // WINDOWS CRAP =============================================================== -void +static void SleepUntilInput (int time) { MsgWaitForMultipleObjects (1, &tevent, FALSE, time, QS_ALLINPUT); @@ -155,8 +155,8 @@ SleepUntilInput (int time) HINSTANCE global_hInstance; int global_nCmdShow; -char *argv[MAX_NUM_ARGVS]; -static char *empty_string = ""; +const char *argv[MAX_NUM_ARGVS]; +static const char *empty_string = ""; HWND hwnd_dialog; int WINAPI @@ -208,7 +208,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, } } - COM_InitArgv (host_parms.argc, (const char**)argv); + COM_InitArgv (host_parms.argc, argv); host_parms.argc = com_argc; host_parms.argv = com_argv; diff --git a/nq/source/world.c b/nq/source/world.c index aeeed83de..0a903295c 100644 --- a/nq/source/world.c +++ b/nq/source/world.c @@ -105,7 +105,7 @@ SV_InitHull (hull_t *hull, dclipnode_t *clipnodes, mplane_t *planes) } } -void +static void SV_InitBoxHull (void) { SV_InitHull (&box_hull, box_clipnodes, box_planes); @@ -117,7 +117,7 @@ SV_InitBoxHull (void) To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being compared directly. */ -hull_t * +static hull_t * SV_HullForBox (const vec3_t mins, const vec3_t maxs) { box_planes[0].dist = maxs[0]; @@ -161,7 +161,6 @@ SV_HullForEntity (edict_t *ent, const vec3_t mins, const vec3_t maxs, // decide which clipping hull to use, based on the size if (sv_fields.rotated_bbox != -1 && SVinteger (ent, rotated_bbox)) { - extern clip_hull_t *pf_hull_list[]; int h = SVinteger (ent, rotated_bbox) - 1; hull = pf_hull_list[h]->hulls[hull_index]; } if (SVfloat (ent, solid) == SOLID_BSP) { @@ -197,7 +196,7 @@ SV_HullForEntity (edict_t *ent, const vec3_t mins, const vec3_t maxs, areanode_t sv_areanodes[AREA_NODES]; int sv_numareanodes; -areanode_t * +static areanode_t * SV_CreateAreaNode (int depth, const vec3_t mins, const vec3_t maxs) { areanode_t *anode; @@ -263,7 +262,7 @@ SV_UnlinkEdict (edict_t *ent) } -void +static void SV_TouchLinks (edict_t *ent, areanode_t *node) { edict_t *touch; @@ -310,7 +309,7 @@ SV_TouchLinks (edict_t *ent, areanode_t *node) } -void +static void SV_FindTouchedLeafs (edict_t *ent, mnode_t *node) { int leafnum, sides; @@ -592,7 +591,7 @@ SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, Handles selection or creation of a clipping hull, and offseting (and eventually rotation) of the end points */ -trace_t +static trace_t SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end) { @@ -633,7 +632,7 @@ SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, const vec3_t start, Mins and maxs enclose the entire area swept by the move */ -void +static void SV_ClipToLinks (areanode_t *node, moveclip_t * clip) { edict_t *touch; @@ -707,7 +706,7 @@ SV_ClipToLinks (areanode_t *node, moveclip_t * clip) SV_ClipToLinks (node->children[1], clip); } -void +static void SV_MoveBounds (const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, vec3_t boxmins, vec3_t boxmaxs) { diff --git a/qw/include/crudefile.h b/qw/include/crudefile.h index 788288449..25c42fab4 100644 --- a/qw/include/crudefile.h +++ b/qw/include/crudefile.h @@ -29,13 +29,13 @@ #ifndef _CRUDEFILE_H #define _CRUDEFILE_H -void CF_Init (); -void CF_CloseAllFiles (); +void CF_Init (void); +void CF_CloseAllFiles (void); int CF_Open (const char *path, const char *mode); void CF_Close (int desc); const char * CF_Read (int desc); int CF_Write (int desc, const char *buf); int CF_EOF (int desc); -int CF_Quota (); +int CF_Quota (void); #endif // _CRUDEFILE_H diff --git a/qw/include/host.h b/qw/include/host.h index 96b9b7469..f1f3f35c5 100644 --- a/qw/include/host.h +++ b/qw/include/host.h @@ -65,7 +65,7 @@ void Host_ShutdownServer (qboolean crash); typedef struct { int argc; - char **argv; + const char **argv; } quakeparms_t; /* Host */ diff --git a/qw/include/net.h b/qw/include/net.h index 62dafd688..182f5539b 100644 --- a/qw/include/net.h +++ b/qw/include/net.h @@ -143,5 +143,6 @@ void Analyze_Server_Packet (const byte * data, int len); extern struct cvar_s *net_packetlog; extern qboolean is_server; +qboolean ServerPaused (void); #endif // _NET_H diff --git a/qw/include/server.h b/qw/include/server.h index b94eaa2d3..addd069a2 100644 --- a/qw/include/server.h +++ b/qw/include/server.h @@ -445,6 +445,8 @@ void SV_LoadProgs (void); void Con_Printf (const char *fmt, ...) __attribute__((format(printf,1,2))); void Con_DPrintf (const char *fmt, ...) __attribute__((format(printf,1,2))); +extern struct clip_hull_s *pf_hull_list[]; + // // sv_main.c // diff --git a/qw/include/sv_pr_cmds.h b/qw/include/sv_pr_cmds.h index 303f76402..b3ed7e55e 100644 --- a/qw/include/sv_pr_cmds.h +++ b/qw/include/sv_pr_cmds.h @@ -1,4 +1,3 @@ - /* sv_pr_cmds.h @@ -35,7 +34,6 @@ typedef struct progs_s progs_t; # define PROGS_T #endif -const char *PF_VarString (progs_t *pr, int first); void PF_error (progs_t *pr); void PF_objerror (progs_t *pr); void PF_makevectors (progs_t *pr); diff --git a/qw/source/cl_cam.c b/qw/source/cl_cam.c index dc29da77c..afcc4678f 100644 --- a/qw/source/cl_cam.c +++ b/qw/source/cl_cam.c @@ -166,7 +166,7 @@ Cam_TrackNum (void) return spec_track; } -void +static void Cam_Unlock (void) { if (autocam) { @@ -201,7 +201,7 @@ Cam_Lock (int playernum) Sbar_Changed (); } -pmtrace_t +static pmtrace_t Cam_DoTrace (vec3_t vec1, vec3_t vec2) { #if 0 @@ -678,7 +678,7 @@ CL_Cam_Init_Cvars (void) chase_active = Cvar_Get ("chase_active", "0", CVAR_NONE, NULL, "None"); } -void +static void TraceLine (vec3_t start, vec3_t end, vec3_t impact) { pmtrace_t trace; diff --git a/qw/source/cl_cmd.c b/qw/source/cl_cmd.c index 53ad2c5d7..031251168 100644 --- a/qw/source/cl_cmd.c +++ b/qw/source/cl_cmd.c @@ -91,7 +91,7 @@ CL_Cmd_ForwardToServer (void) } // don't forward the first argument -void +static void CL_Cmd_ForwardToServer_f (void) { if (cls.state == ca_disconnected) { diff --git a/qw/source/cl_demo.c b/qw/source/cl_demo.c index 1a7bfcc6a..819d0966e 100644 --- a/qw/source/cl_demo.c +++ b/qw/source/cl_demo.c @@ -52,6 +52,7 @@ static const char rcsid[] = #include "QF/va.h" #include "cl_cam.h" +#include "cl_demo.h" #include "cl_ents.h" #include "cl_main.h" #include "client.h" @@ -79,7 +80,6 @@ td_stats_t *timedemo_data; static void CL_FinishTimeDemo (void); -static void CL_TimeFrames_Reset (void); static void CL_TimeFrames_DumpLog (void); cvar_t *demo_speed; @@ -161,7 +161,7 @@ CL_WriteDemoCmd (usercmd_t *pcmd) Dumps the current net message, prefixed by the length and view angles */ -void +static void CL_WriteDemoMessage (sizebuf_t *msg) { byte c; @@ -197,7 +197,7 @@ static const char *dem_names[] = { }; #endif -qboolean +static qboolean CL_GetDemoMessage (void) { byte c, newtime; @@ -440,7 +440,7 @@ CL_Stop_f (void) Dumps the current net message, prefixed by the length and view angles */ -void +static void CL_WriteRecordDemoMessage (sizebuf_t *msg, int seq) { byte c; @@ -468,7 +468,7 @@ CL_WriteRecordDemoMessage (sizebuf_t *msg, int seq) Qflush (cls.demofile); } -void +static void CL_WriteSetDemoMessage (void) { byte c; @@ -861,7 +861,7 @@ CL_ReRecord_f (void) CL_BeginServerConnect (); } -void +static void CL_StartDemo (void) { char name[MAX_OSPATH]; @@ -918,7 +918,7 @@ CL_PlayDemo_f (void) CL_StartDemo (); } -void +static void CL_StartTimeDemo (void) { CL_StartDemo (); @@ -1042,7 +1042,7 @@ CL_Demo_Init (void) "< 1 slow-mo, > 1 timelapse"); } -static void +void CL_TimeFrames_Reset (void) { cl_timeframes_index = 0; @@ -1071,7 +1071,7 @@ static void CL_TimeFrames_DumpLog (void) { char e_path[MAX_OSPATH]; - char *filename = "timeframes.txt"; + const char *filename = "timeframes.txt"; int i; long frame; QFile *outputfile; diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index 9bd655032..e4de94a59 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -87,7 +87,7 @@ CL_ClearEnts () CL_Init_Entity (&cl_player_ents[i]); } -void +static void CL_NewDlight (int key, vec3_t org, int effects, byte glow_size, byte glow_color) { @@ -161,7 +161,7 @@ CL_NewDlight (int key, vec3_t org, int effects, byte glow_size, Can go from either a baseline or a previous packet_entity */ -void +static void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits) { int i; @@ -251,7 +251,7 @@ CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits) // Ender (QSG - End) } -void +static void FlushEntityPacket (void) { entity_state_t olde, newe; @@ -408,7 +408,7 @@ CL_ParsePacketEntities (qboolean delta) newp->num_entities = newindex; } -void +static void CL_LinkPacketEntities (void) { int pnum, i; @@ -606,7 +606,7 @@ CL_ParseProjectiles (qboolean nail2) } } -void +static void CL_LinkProjectiles (void) { int i; @@ -624,7 +624,7 @@ CL_LinkProjectiles (void) } } -int +static int TranslateFlags (int src) { int dst = 0; @@ -801,7 +801,7 @@ CL_ParsePlayerinfo (void) Called when the CTF flags are set */ -void +static void CL_AddFlagModels (entity_t *ent, int team, int key) { static float flag_offsets[] = { @@ -849,7 +849,7 @@ CL_AddFlagModels (entity_t *ent, int team, int key) Create visible entities in the correct position for all current players */ -void +static void CL_LinkPlayers (void) { double playertime; diff --git a/qw/source/cl_input.c b/qw/source/cl_input.c index 338d3f4ec..4adcc09be 100644 --- a/qw/source/cl_input.c +++ b/qw/source/cl_input.c @@ -86,7 +86,7 @@ kbutton_t in_up, in_down; int in_impulse; -void +static void KeyDown (kbutton_t *b) { int k; @@ -116,7 +116,7 @@ KeyDown (kbutton_t *b) b->state |= 1 + 2; // down + impulse down } -void +static void KeyUp (kbutton_t *b) { int k; @@ -150,25 +150,25 @@ KeyUp (kbutton_t *b) b->state |= 4; // impulse up } -void +static void IN_KLookDown (void) { KeyDown (&in_klook); } -void +static void IN_KLookUp (void) { KeyUp (&in_klook); } -void +static void IN_MLookDown (void) { KeyDown (&in_mlook); } -void +static void IN_MLookUp (void) { KeyUp (&in_mlook); @@ -176,187 +176,187 @@ IN_MLookUp (void) V_StartPitchDrift (); } -void +static void IN_UpDown (void) { KeyDown (&in_up); } -void +static void IN_UpUp (void) { KeyUp (&in_up); } -void +static void IN_DownDown (void) { KeyDown (&in_down); } -void +static void IN_DownUp (void) { KeyUp (&in_down); } -void +static void IN_LeftDown (void) { KeyDown (&in_left); } -void +static void IN_LeftUp (void) { KeyUp (&in_left); } -void +static void IN_RightDown (void) { KeyDown (&in_right); } -void +static void IN_RightUp (void) { KeyUp (&in_right); } -void +static void IN_ForwardDown (void) { KeyDown (&in_forward); } -void +static void IN_ForwardUp (void) { KeyUp (&in_forward); } -void +static void IN_BackDown (void) { KeyDown (&in_back); } -void +static void IN_BackUp (void) { KeyUp (&in_back); } -void +static void IN_LookupDown (void) { KeyDown (&in_lookup); } -void +static void IN_LookupUp (void) { KeyUp (&in_lookup); } -void +static void IN_LookdownDown (void) { KeyDown (&in_lookdown); } -void +static void IN_LookdownUp (void) { KeyUp (&in_lookdown); } -void +static void IN_MoveleftDown (void) { KeyDown (&in_moveleft); } -void +static void IN_MoveleftUp (void) { KeyUp (&in_moveleft); } -void +static void IN_MoverightDown (void) { KeyDown (&in_moveright); } -void +static void IN_MoverightUp (void) { KeyUp (&in_moveright); } -void +static void IN_SpeedDown (void) { KeyDown (&in_speed); } -void +static void IN_SpeedUp (void) { KeyUp (&in_speed); } -void +static void IN_StrafeDown (void) { KeyDown (&in_strafe); } -void +static void IN_StrafeUp (void) { KeyUp (&in_strafe); } -void +static void IN_AttackDown (void) { KeyDown (&in_attack); } -void +static void IN_AttackUp (void) { KeyUp (&in_attack); } -void +static void IN_UseDown (void) { KeyDown (&in_use); } -void +static void IN_UseUp (void) { KeyUp (&in_use); } -void +static void IN_JumpDown (void) { KeyDown (&in_jump); } -void +static void IN_JumpUp (void) { KeyUp (&in_jump); } -void +static void IN_Impulse (void) { in_impulse = atoi (Cmd_Argv (1)); @@ -431,7 +431,7 @@ cvar_t *cl_yawspeed; Moves the local angle positions */ -void +static void CL_AdjustAngles (void) { float down, up, speed; @@ -550,7 +550,7 @@ CL_BaseMove (usercmd_t *cmd) } } -int +static int MakeChar (int i) { i &= ~3; @@ -561,7 +561,7 @@ MakeChar (int i) return i; } -void +static void CL_FinishMove (usercmd_t *cmd) { int ms, i; diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 8fd110ce7..9f51f738c 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -231,14 +231,14 @@ char soundlist_name[] = "soundlist %i %i"; extern cvar_t *cl_showscoresuid; -void +static void CL_Sbar_f (cvar_t *var) { vid.recalc_refdef = true; r_lineadj = var->int_val ? sb_lines : 0; } -void +static void CL_Quit_f (void) { if (!con_module) @@ -247,7 +247,7 @@ CL_Quit_f (void) Sys_Quit (); } -void +static void CL_Version_f (void) { Con_Printf ("%s Version %s\n", PROGRAM, VERSION); @@ -259,7 +259,7 @@ CL_Version_f (void) called by CL_Connect_f and CL_CheckResend */ -void +static void CL_SendConnectPacket (void) { char data[2048]; @@ -299,7 +299,7 @@ CL_SendConnectPacket (void) Resend a connect message if the last one has timed out */ -void +static void CL_CheckForResend (void) { char data[2048]; @@ -339,7 +339,7 @@ CL_BeginServerConnect (void) CL_CheckForResend (); } -void +static void CL_Connect_f (void) { const char *server; @@ -363,7 +363,7 @@ CL_Connect_f (void) Send the rest of the command line over as an unconnected command. */ -void +static void CL_Rcon_f (void) { char message[1024]; @@ -430,7 +430,7 @@ CL_ClearState (void) Cleans the Cshifts, so your screen doesn't stay red after a timedemo :) */ -void +static void CL_StopCshifts (void) { int i; @@ -441,7 +441,7 @@ CL_StopCshifts (void) cl.stats[i] = 0; } -void +static void CL_RemoveQFInfoKeys (void) { Info_RemoveKey (cls.userinfo, "*cap"); @@ -525,7 +525,7 @@ CL_Disconnect_f (void) Dump userdata / masterdata for a user */ -void +static void CL_User_f (void) { int uid, i; @@ -554,7 +554,7 @@ CL_User_f (void) Dump userids for all current players */ -void +static void CL_Users_f (void) { int c, i; @@ -578,7 +578,7 @@ CL_Users_f (void) Sent by server when serverinfo changes */ -void +static void CL_FullServerinfo_f (void) { const char *p; @@ -632,7 +632,7 @@ CL_FullServerinfo_f (void) } } -void +static void CL_AddQFInfoKeys (void) { char cap[100] = ""; // max of 98 or so flags @@ -661,7 +661,7 @@ CL_AddQFInfoKeys (void) Allow clients to change userinfo Casey was here :) */ -void +static void CL_FullInfo_f (void) { char key[512], value[512]; @@ -710,7 +710,7 @@ CL_FullInfo_f (void) Allow clients to change userinfo */ -void +static void CL_SetInfo_f (void) { if (Cmd_Argc () == 1) { @@ -738,7 +738,7 @@ CL_SetInfo_f (void) packet Contents allows \n escape character */ -void +static void CL_Packet_f (void) { char send[2048]; @@ -806,7 +806,7 @@ CL_NextDemo (void) Just sent as a hint to the client that they should drop to full console */ -void +static void CL_Changing_f (void) { if (cls.download) // don't change when downloading @@ -824,7 +824,7 @@ CL_Changing_f (void) The server is changing levels */ -void +static void CL_Reconnect_f (void) { if (cls.download) // don't change when downloading @@ -856,7 +856,7 @@ CL_Reconnect_f (void) Responses to broadcasts, etc */ -void +static void CL_ConnectionlessPacket (void) { const char *s; @@ -1066,7 +1066,7 @@ CL_ReadPackets (void) } -void +static void CL_Download_f (void) { if (cls.state == ca_disconnected || cls.demoplayback) { @@ -1098,7 +1098,7 @@ CL_Download_f (void) } } -void +static void cl_hudswap_f (cvar_t *var) { if (cl_hudswap) @@ -1107,7 +1107,7 @@ cl_hudswap_f (cvar_t *var) hudswap = 0; } -void +static void Force_CenterView_f (void) { cl.viewangles[PITCH] = 0; @@ -1237,7 +1237,7 @@ cl_usleep_f (cvar_t *var) cl_usleep_cache = var->int_val; } -void +static void CL_Init_Cvars (void) { cl_model_crcs = Cvar_Get ("cl_model_crcs", "1", CVAR_ARCHIVE, NULL, @@ -1628,7 +1628,7 @@ check_quakerc (void) return ret; } -void +static void CL_Init_Memory (void) { int mem_parm = COM_CheckParm ("-mem"); diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index 5ce4efbcf..df2c95c44 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -76,7 +76,7 @@ static const char rcsid[] = #include "sbar.h" #include "view.h" -char *svc_strings[] = { +const char *svc_strings[] = { "svc_bad", "svc_nop", "svc_disconnect", @@ -275,7 +275,7 @@ map_cfg (const char *mapname, int all) free (name); } -void +static void CL_NewMap (const char *mapname) { R_NewMap (cl.worldmodel, cl.model_precache, MAX_MODELS); @@ -286,7 +286,7 @@ CL_NewMap (const char *mapname) map_cfg (mapname, 1); } -void +static void Model_NextDownload (void) { char *s; @@ -372,7 +372,7 @@ Model_NextDownload (void) } } -void +static void Sound_NextDownload (void) { char *s; @@ -412,7 +412,7 @@ Sound_NextDownload (void) } } -void +static void CL_RequestNextDownload (void) { switch (cls.downloadtype) { @@ -438,7 +438,7 @@ CL_RequestNextDownload (void) A download message has been received from the server */ -void +static void CL_ParseDownload (void) { byte name[1024]; @@ -632,7 +632,7 @@ CL_StopUpload (void) // SERVER CONNECTING MESSAGES ================================================= // LordHavoc: BIG BUG-FIX! Clear baselines each time it connects... -void +static void CL_ClearBaselines (void) { int i; @@ -647,7 +647,7 @@ CL_ClearBaselines (void) } } -void +static void CL_ParseServerData (void) { char fn[MAX_OSPATH]; @@ -655,8 +655,6 @@ CL_ParseServerData (void) int protover; qboolean cflag = false; - extern char gamedirfile[MAX_OSPATH]; - Con_DPrintf ("Serverdata packet received.\n"); // wipe the client_state_t struct @@ -751,7 +749,7 @@ CL_ParseServerData (void) CL_ClearBaselines (); } -void +static void CL_ParseSoundlist (void) { const char *str; @@ -786,7 +784,7 @@ CL_ParseSoundlist (void) Sound_NextDownload (); } -void +static void CL_ParseModellist (void) { int nummodels, n; @@ -837,7 +835,7 @@ CL_ParseModellist (void) Model_NextDownload (); } -void +static void CL_ParseBaseline (entity_state_t *es) { es->modelindex = MSG_ReadByte (net_message); @@ -861,7 +859,7 @@ CL_ParseBaseline (entity_state_t *es) Static entities are non-interactive world objects like torches */ -void +static void CL_ParseStatic (void) { entity_t *ent; @@ -885,7 +883,7 @@ CL_ParseStatic (void) R_AddEfrags (ent); } -void +static void CL_ParseStaticSound (void) { int sound_num, vol, atten; @@ -901,7 +899,7 @@ CL_ParseStaticSound (void) // ACTION MESSAGES ============================================================ -void +static void CL_ParseStartSoundPacket (void) { float attenuation; @@ -973,7 +971,7 @@ CL_ParseClientdata (void) } } -void +static void CL_ProcessUserInfo (int slot, player_info_t *player) { char skin[512]; @@ -1006,7 +1004,7 @@ CL_ProcessUserInfo (int slot, player_info_t *player) Sbar_Changed (); } -void +static void CL_UpdateUserinfo (void) { int slot, uid; @@ -1034,7 +1032,7 @@ CL_UpdateUserinfo (void) } } -void +static void CL_SetInfo (void) { char key[MAX_MSGLEN], value[MAX_MSGLEN]; @@ -1064,7 +1062,7 @@ CL_SetInfo (void) CL_ProcessUserInfo (slot, player); } -void +static void CL_ServerInfo (void) { char key[MAX_MSGLEN], value[MAX_MSGLEN]; @@ -1092,7 +1090,7 @@ CL_ServerInfo (void) } } -void +static void CL_SetStat (int stat, int value) { if (stat < 0 || stat >= MAX_CL_STATS) @@ -1120,7 +1118,7 @@ CL_SetStat (int stat, int value) cl.stats[stat] = value; } -void +static void CL_MuzzleFlash (void) { dlight_t *dl; diff --git a/qw/source/cl_pred.c b/qw/source/cl_pred.c index 171b67839..daa248c75 100644 --- a/qw/source/cl_pred.c +++ b/qw/source/cl_pred.c @@ -40,6 +40,7 @@ static const char rcsid[] = #include "bothdefs.h" #include "compat.h" #include "cl_ents.h" +#include "cl_pred.h" #include "client.h" #include "pmove.h" diff --git a/qw/source/cl_screen.c b/qw/source/cl_screen.c index 05be2bb1e..ee917f695 100644 --- a/qw/source/cl_screen.c +++ b/qw/source/cl_screen.c @@ -55,7 +55,7 @@ static const char rcsid[] = #include "r_cvar.h" #include "sbar.h" -void +static void SCR_DrawNet (void) { if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < @@ -67,7 +67,7 @@ SCR_DrawNet (void) Draw_Pic (scr_vrect.x + 64, scr_vrect.y, scr_net); } -void +static void CL_NetStats (void) { int x, y; diff --git a/qw/source/cl_skin.c b/qw/source/cl_skin.c index f8d138479..9922f5011 100644 --- a/qw/source/cl_skin.c +++ b/qw/source/cl_skin.c @@ -141,7 +141,7 @@ CL_AllSkins_f (void) CL_Skins_f (); } -void +static void CL_Color_f (void) { // just for quake compatability... diff --git a/qw/source/cl_slist.c b/qw/source/cl_slist.c index f67bcb11a..8c75b5f3c 100644 --- a/qw/source/cl_slist.c +++ b/qw/source/cl_slist.c @@ -99,7 +99,7 @@ cvar_t *sl_game; cvar_t *sl_ping; -void +static void S_Refresh (server_entry_t *slrefresh) { netadr_t addy; @@ -117,8 +117,8 @@ S_Refresh (server_entry_t *slrefresh) slrefresh->waitstatus = 1; } -server_entry_t * -SL_Add (server_entry_t *start, char *ip, char *desc) +static server_entry_t * +SL_Add (server_entry_t *start, const char *ip, const char *desc) { server_entry_t *p; @@ -154,8 +154,8 @@ SL_Add (server_entry_t *start, char *ip, char *desc) p->status = NULL; return (start); } - -server_entry_t * +/* +static server_entry_t * SL_Del (server_entry_t *start, server_entry_t *del) { server_entry_t *n; @@ -182,7 +182,7 @@ SL_Del (server_entry_t *start, server_entry_t *del) return (start); } -server_entry_t * +static server_entry_t * SL_InsB (server_entry_t *start, server_entry_t *place, char *ip, char *desc) { server_entry_t *new, *other; @@ -204,8 +204,8 @@ SL_InsB (server_entry_t *start, server_entry_t *place, char *ip, char *desc) return new; return start; } - -void +*/ +static void SL_Swap (server_entry_t *swap1, server_entry_t *swap2) { server_entry_t *next1, *next2, *prev1, *prev2; @@ -226,7 +226,7 @@ SL_Swap (server_entry_t *swap1, server_entry_t *swap2) swap2->prev = prev2; } -int +static int SL_CheckFilter (server_entry_t *sl_filteritem) { if (!sl_filter->int_val) @@ -249,7 +249,7 @@ SL_CheckFilter (server_entry_t *sl_filteritem) return(1); } -server_entry_t * +static server_entry_t * SL_Get_By_Num (server_entry_t *start, int n) { int i; @@ -268,7 +268,7 @@ SL_Get_By_Num (server_entry_t *start, int n) return (start); } -int +static int SL_Len (server_entry_t *start) { int i; @@ -278,7 +278,7 @@ SL_Len (server_entry_t *start) return i; } -void +static void SL_Del_All (server_entry_t *start) { server_entry_t *n; @@ -294,7 +294,7 @@ SL_Del_All (server_entry_t *start) } } -void +static void SL_SaveF (QFile *f, server_entry_t *start) { do { @@ -322,7 +322,7 @@ SL_Shutdown (void) SL_Del_All (all_slist); } -char * +static char * gettokstart (char *str, int req, char delim) { char *start = str; @@ -348,7 +348,7 @@ gettokstart (char *str, int req, char delim) return start; } -int +static int gettoklen (char *str, int req, char delim) { char *start = 0; @@ -365,13 +365,13 @@ gettoklen (char *str, int req, char delim) return len; } -void +static void timepassed (double time1, double *time2) { *time2 -= time1; } -void +static void SL_SortEntry (server_entry_t *start) { int i = 0; @@ -405,7 +405,7 @@ SL_SortEntry (server_entry_t *start) } } -void +static void SL_Sort (cvar_t *var) { server_entry_t *p; @@ -417,7 +417,7 @@ SL_Sort (cvar_t *var) SL_SortEntry (p); } -void +static void SL_Con_List (server_entry_t *sldata) { int serv; @@ -434,7 +434,7 @@ SL_Con_List (server_entry_t *sldata) } } -void +static void SL_Connect (server_entry_t *sldata, int slitemno) { CL_Disconnect (); @@ -443,7 +443,7 @@ SL_Connect (server_entry_t *sldata, int slitemno) CL_BeginServerConnect (); } -void +static void SL_Update (server_entry_t *sldata) { // FIXME - Need to change this so the info is not sent in 1 burst @@ -459,7 +459,7 @@ SL_Update (server_entry_t *sldata) } } -void +static void SL_Con_Details (server_entry_t *sldata, int slitemno) { int i, playercount; @@ -494,7 +494,7 @@ SL_Con_Details (server_entry_t *sldata, int slitemno) Con_Printf("No Details Available\n"); } -void +static void SL_MasterUpdate(void) { char data[] = "c\n\0"; @@ -520,7 +520,7 @@ SL_MasterUpdate(void) NET_SendPacket (3, data, addy); } -int +static int SL_Switch (void) { if (!which_slist) @@ -537,7 +537,7 @@ SL_Switch (void) return (which_slist); } -void +static void SL_Command (void) { int sltemp = 0; @@ -610,7 +610,7 @@ MSL_ParseServerList(const char *msl_data) } } -server_entry_t * +static server_entry_t * SL_LoadF (QFile *f, server_entry_t *start) { //This could get messy diff --git a/qw/source/cl_sys_sdl.c b/qw/source/cl_sys_sdl.c index 331c9ba4c..6ad099667 100644 --- a/qw/source/cl_sys_sdl.c +++ b/qw/source/cl_sys_sdl.c @@ -76,7 +76,7 @@ int noconinput; # include "winquake.h" #endif -void +static void startup (void) { #ifdef WIN32 diff --git a/qw/source/cl_sys_win.c b/qw/source/cl_sys_win.c index 5caaecf8c..28f4a3f2f 100644 --- a/qw/source/cl_sys_win.c +++ b/qw/source/cl_sys_win.c @@ -74,7 +74,7 @@ HANDLE qwclsemaphore; static HANDLE tevent; -void +static void startup (void) { OSVERSIONINFO vinfo; @@ -124,7 +124,7 @@ shutdown (void) CloseHandle (qwclsemaphore); } -void +static void SleepUntilInput (int time) { MsgWaitForMultipleObjects (1, &tevent, FALSE, time, QS_ALLINPUT); @@ -132,8 +132,8 @@ SleepUntilInput (int time) HINSTANCE global_hInstance; int global_nCmdShow; -char *argv[MAX_NUM_ARGVS]; -static char *empty_string = ""; +const char *argv[MAX_NUM_ARGVS]; +static const char *empty_string = ""; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, @@ -182,7 +182,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, } } - COM_InitArgv (host_parms.argc, (const char**)argv); + COM_InitArgv (host_parms.argc, argv); host_parms.argc = com_argc; host_parms.argv = com_argv; diff --git a/qw/source/cl_tent.c b/qw/source/cl_tent.c index 768b31a79..ce5f48351 100644 --- a/qw/source/cl_tent.c +++ b/qw/source/cl_tent.c @@ -164,7 +164,7 @@ CL_ClearTEnts (void) } } -explosion_t * +static explosion_t * CL_AllocExplosion (void) { float time; @@ -263,7 +263,7 @@ beam_setup (beam_t *b) } } -void +static void CL_ParseBeam (model_t *m) { beam_t *b; @@ -470,7 +470,7 @@ CL_ParseTEnt (void) #define BEAM_SEED_INTERVAL 72 #define BEAM_SEED_PRIME 3191 -void +static void CL_UpdateBeams (void) { beam_t *b; @@ -506,7 +506,7 @@ CL_UpdateBeams (void) } } -void +static void CL_UpdateExplosions (void) { int f, i; diff --git a/qw/source/cl_view.c b/qw/source/cl_view.c index 589eaa421..0d4ab9d4d 100644 --- a/qw/source/cl_view.c +++ b/qw/source/cl_view.c @@ -114,7 +114,7 @@ V_CalcRoll (const vec3_t angles, const vec3_t velocity) return side * sign; } -float +static float V_CalcBob (void) { static double bobtime; @@ -184,7 +184,7 @@ V_StopPitchDrift (void) Drifting is enabled when the center view key is hit, mlook is released and lookspring is non 0, or when */ -void +static void V_DriftPitch (void) { float delta, move; @@ -292,7 +292,7 @@ V_ParseDamage (void) v_dmg_time = v_kicktime->value; } -void +static void V_cshift_f (void) { cshift_empty.destcolor[0] = atoi (Cmd_Argv (1)); @@ -306,7 +306,7 @@ V_cshift_f (void) When you run over an item, the server sends this command */ -void +static void V_BonusFlash_f (void) { if (!cl_cshift_bonus->int_val @@ -349,7 +349,7 @@ V_SetContentsColor (int contents) } } -void +static void V_CalcPowerupCshift (void) { if (!cl.stats[STAT_ITEMS] & (IT_SUIT || IT_INVISIBILITY || IT_QUAD @@ -475,7 +475,7 @@ V_PrepBlend (void) /* VIEW RENDERING */ -float +static float angledelta (float a) { a = anglemod (a); @@ -484,7 +484,7 @@ angledelta (float a) return a; } -void +static void CalcGunAngle (void) { float yaw, pitch, move; @@ -522,32 +522,12 @@ CalcGunAngle (void) cl.viewent.angles[PITCH] = -(r_refdef.viewangles[PITCH] + pitch); } -void -V_BoundOffsets (void) -{ - // absolutely bound refresh reletive to entity clipping hull - // so the view can never be inside a solid wall - - if (r_refdef.vieworg[0] < cl.simorg[0] - 14) - r_refdef.vieworg[0] = cl.simorg[0] - 14; - else if (r_refdef.vieworg[0] > cl.simorg[0] + 14) - r_refdef.vieworg[0] = cl.simorg[0] + 14; - if (r_refdef.vieworg[1] < cl.simorg[1] - 14) - r_refdef.vieworg[1] = cl.simorg[1] - 14; - else if (r_refdef.vieworg[1] > cl.simorg[1] + 14) - r_refdef.vieworg[1] = cl.simorg[1] + 14; - if (r_refdef.vieworg[2] < cl.simorg[2] - 22) - r_refdef.vieworg[2] = cl.simorg[2] - 22; - else if (r_refdef.vieworg[2] > cl.simorg[2] + 30) - r_refdef.vieworg[2] = cl.simorg[2] + 30; -} - /* V_AddIdle Idle swaying */ -void +static void V_AddIdle (void) { r_refdef.viewangles[ROLL] += v_idlescale->value * @@ -570,7 +550,7 @@ V_AddIdle (void) Roll is induced by movement and damage */ -void +static void V_CalcViewRoll (void) { float side; @@ -588,7 +568,7 @@ V_CalcViewRoll (void) } -void +static void V_CalcIntermissionRefdef (void) { entity_t *view; @@ -611,7 +591,7 @@ V_CalcIntermissionRefdef (void) #include "cl_cam.h" -void +static void V_CalcRefdef (void) { entity_t *view; @@ -718,7 +698,7 @@ V_CalcRefdef (void) Chase_Update (); } -void +static void DropPunchAngle (void) { cl.punchangle -= 10 * host_frametime; diff --git a/qw/source/com.c b/qw/source/com.c index b6bbafaad..4927d197a 100644 --- a/qw/source/com.c +++ b/qw/source/com.c @@ -36,6 +36,7 @@ static const char rcsid[] = #include "QF/cmd.h" #include "QF/console.h" #include "QF/cvar.h" +#include "QF/qargs.h" #include "QF/quakefs.h" #include "QF/sys.h" @@ -53,7 +54,7 @@ qboolean com_modified; // set true if using non-id files Immediately exits out if an alternate game was attempted to be started without being registered. */ -void +static void COM_CheckRegistered (void) { unsigned short check[128]; diff --git a/qw/source/crudefile.c b/qw/source/crudefile.c index 3e2ec584f..7801be25f 100644 --- a/qw/source/crudefile.c +++ b/qw/source/crudefile.c @@ -80,7 +80,7 @@ int cf_openfiles; // used elements Returns 1 if the file descriptor is valid. */ -int +static int CF_ValidDesc (int desc) { if (desc >= 0 && desc < cf_filepcount && cf_filep[desc].file) @@ -94,7 +94,7 @@ CF_ValidDesc (int desc) Returns 1 if mode == 'r' and the file is already open for writing, or if if mode == 'w' and the file's already open at all. */ -int +static int CF_AlreadyOpen (const char * path, char mode) { int i; @@ -116,7 +116,7 @@ CF_AlreadyOpen (const char * path, char mode) Returns the size of the specified file */ -int +static int CF_GetFileSize (const char *path) { struct stat buf; @@ -132,8 +132,8 @@ CF_GetFileSize (const char *path) Calculates the currently used space */ -void -CF_BuildQuota () +static void +CF_BuildQuota (void) { char *file, *path; struct dirent *i; @@ -169,7 +169,7 @@ CF_BuildQuota () Ye ol' Init function :) */ void -CF_Init () +CF_Init (void) { CF_BuildQuota(); crudefile_quota = Cvar_Get ("crudefile_quota", "-1", CVAR_ROM, NULL, diff --git a/qw/source/game.c b/qw/source/game.c index ff9ea6f87..a42a254eb 100644 --- a/qw/source/game.c +++ b/qw/source/game.c @@ -56,7 +56,7 @@ static const char rcsid[] = Sets the gamedir and path to a different directory. */ -void +static void SV_Gamedir_f (void) { const char *dir; diff --git a/qw/source/locs.c b/qw/source/locs.c index 682975c37..67dccc6ae 100644 --- a/qw/source/locs.c +++ b/qw/source/locs.c @@ -88,7 +88,7 @@ locs_find (const vec3_t target) return locations[i]; } -void +static void locs_more (void) { size_t size; diff --git a/qw/source/master.c b/qw/source/master.c index dc8b5eb54..f48de7273 100644 --- a/qw/source/master.c +++ b/qw/source/master.c @@ -156,9 +156,9 @@ typedef struct { qboolean notimeout; } server_t; -int +static int QW_AddHeartbeat (server_t **servers_p, int slen, - struct sockaddr_in *addr, char *buf, qboolean notimeout) + struct sockaddr_in *addr, const char *buf, qboolean notimeout) { server_t *servers = *servers_p; int freeslot = -1; @@ -215,7 +215,7 @@ QW_AddHeartbeat (server_t **servers_p, int slen, return slen; } -void +static void QW_TimeoutHearts (server_t *servers, int slen) { time_t t; @@ -235,7 +235,7 @@ QW_TimeoutHearts (server_t *servers, int slen) } } -void +static void QW_HeartShutdown (struct sockaddr_in *addr, server_t *servers, int slen) { @@ -254,7 +254,7 @@ QW_HeartShutdown (struct sockaddr_in *addr, server_t *servers, } } -void +static void QW_SendHearts (int sock, msghdr_t *msghdr, server_t *servers, int serverlen) { unsigned char *out; @@ -293,7 +293,7 @@ QW_SendHearts (int sock, msghdr_t *msghdr, server_t *servers, int serverlen) free (out); } -void +static void QW_Pong (int sock, msghdr_t *msghdr) { // connectionless packet @@ -305,7 +305,7 @@ QW_Pong (int sock, msghdr_t *msghdr) int serverlen = SLIST_MULTIPLE; server_t *servers; -void +static void QW_Master (struct sockaddr_in *addr) { int sock; @@ -407,7 +407,7 @@ read_hosts (const char *fname) FILE *host_file; int host_port; char host_name[256]; - static char *fake_heartbeat = " "; + static const char *fake_heartbeat = " "; char *buf; struct sockaddr_in host_addr; diff --git a/qw/source/msg_ucmd.c b/qw/source/msg_ucmd.c index f706c42d7..10eedb7c1 100644 --- a/qw/source/msg_ucmd.c +++ b/qw/source/msg_ucmd.c @@ -41,6 +41,7 @@ static const char rcsid[] = #include "QF/qendian.h" #include "QF/sys.h" +#include "msg_ucmd.h" #include "net.h" #include "protocol.h" diff --git a/qw/source/net_chan.c b/qw/source/net_chan.c index ca08fb796..6120912b5 100644 --- a/qw/source/net_chan.c +++ b/qw/source/net_chan.c @@ -227,8 +227,6 @@ Netchan_CanReliable (netchan_t *chan) return Netchan_CanPacket (chan); } -qboolean ServerPaused (void); //FIXME - /* Netchan_Transmit diff --git a/qw/source/net_packetlog.c b/qw/source/net_packetlog.c index 5e7fdb326..74eeceb79 100644 --- a/qw/source/net_packetlog.c +++ b/qw/source/net_packetlog.c @@ -173,8 +173,8 @@ static msg_t packet = {0, 0, &_packet}; Prints packet to logfile, adds time stamp etc. */ -void -Net_LogPrintf (char *fmt, ...) +static void +Net_LogPrintf (const char *fmt, ...) { char text[2048]; va_list argptr; @@ -189,7 +189,7 @@ Net_LogPrintf (char *fmt, ...) Qflush (Net_PacketLog); } -int +static int Net_LogStart (const char *fname) { char e_path[MAX_OSPATH]; @@ -210,7 +210,7 @@ Net_LogStop (void) Net_PacketLog = NULL; } -void +static void hex_dump_buf (unsigned char *buf, int len) { int pos = 0, llen, i; @@ -232,8 +232,8 @@ hex_dump_buf (unsigned char *buf, int len) pos += llen; } } - -void +/* +static void ascii_dump_buf (unsigned char *buf, int len) { int pos = 0, llen, i; @@ -247,7 +247,7 @@ ascii_dump_buf (unsigned char *buf, int len) pos += llen; } } - +*/ void Log_Incoming_Packet (const char *p, int len) { @@ -296,7 +296,7 @@ Log_Outgoing_Packet (const char *p, int len) return; } -void +static void Log_Delta(int bits) { entity_state_t to; @@ -374,8 +374,8 @@ Log_Delta(int bits) } -void -Parse_Server_Packet () +static void +Parse_Server_Packet (void) { const char *s; int c, i, ii, iii, mask1, mask2; @@ -817,7 +817,7 @@ Analyze_Server_Packet (const byte * data, int len) Net_PacketLog = NULL; } -void +static void Parse_Client_Packet (void) { int mask, i, c, ii; @@ -923,7 +923,7 @@ Analyze_Client_Packet (const byte * data, int len) Net_PacketLog = NULL; } -void +static void Net_PacketLog_f (cvar_t *var) { if (var->int_val) { @@ -933,7 +933,7 @@ Net_PacketLog_f (cvar_t *var) } } -void +static void Net_PacketLog_Zap_f (void) { if (Net_PacketLog && Net_PacketLog != _stdout) { diff --git a/qw/source/net_udp.c b/qw/source/net_udp.c index 4e099c33c..e6bc00647 100644 --- a/qw/source/net_udp.c +++ b/qw/source/net_udp.c @@ -111,7 +111,7 @@ byte net_message_buffer[MAX_UDP_PACKET]; -void +static void NetadrToSockadr (netadr_t *a, struct sockaddr_in *s) { memset (s, 0, sizeof (*s)); @@ -121,7 +121,7 @@ NetadrToSockadr (netadr_t *a, struct sockaddr_in *s) s->sin_port = a->port; } -void +static void SockadrToNetadr (struct sockaddr_in *s, netadr_t *a) { memcpy (&a->ip, &s->sin_addr, 4); @@ -342,7 +342,7 @@ NET_SendPacket (int length, void *data, netadr_t to) } } -int +static int UDP_OpenSocket (int port) { int newsocket, i; @@ -379,7 +379,7 @@ UDP_OpenSocket (int port) return newsocket; } -void +static void NET_GetLocalAddress (void) { char buff[MAXHOSTNAMELEN]; diff --git a/qw/source/pmove.c b/qw/source/pmove.c index c3d2e0447..69ec6a9cd 100644 --- a/qw/source/pmove.c +++ b/qw/source/pmove.c @@ -80,7 +80,7 @@ Pmove_Init_Cvars (void) Slide off of the impacting object returns the blocked flags (1 = floor, 2 = step / wall) */ -int +static int PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) { float backoff, change; @@ -111,7 +111,7 @@ PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) The basic solid body movement clip that slides along multiple planes */ -int +static int PM_FlyMove (void) { float time_left, d; @@ -217,7 +217,7 @@ PM_FlyMove (void) Pre-PM_FlyMove function for MOVETYPE_FLY players. Could have altered other physics to fit this in, but that's to easy to screw up. --KB */ -void +static void PM_FlymodeMove (void) { float pmspeed; @@ -257,7 +257,7 @@ PM_FlymodeMove (void) Player is on ground, with no upwards velocity */ -void +static void PM_GroundMove (void) { float downdist, updist; @@ -335,7 +335,7 @@ PM_GroundMove (void) Handles both ground friction and water friction */ -void +static void PM_Friction (void) { float drop, friction, speed, newspeed; @@ -415,7 +415,7 @@ PM_Accelerate (vec3_t wishdir, float wishspeed, float accel) pmove.velocity[i] += accelspeed * wishdir[i]; } -void +static void PM_AirAccelerate (vec3_t wishdir, float wishspeed, float accel) { float addspeed, accelspeed, currentspeed, wishspd = wishspeed; @@ -440,7 +440,7 @@ PM_AirAccelerate (vec3_t wishdir, float wishspeed, float accel) pmove.velocity[i] += accelspeed * wishdir[i]; } -void +static void PM_WaterMove (void) { float wishspeed; @@ -487,7 +487,7 @@ PM_WaterMove (void) PM_FlyMove (); } -void +static void PM_AirMove (void) { float fmove, smove, wishspeed; @@ -607,7 +607,7 @@ PM_CategorizePosition (void) } } -void +static void JumpButton (void) { if (pmove.dead) { @@ -650,7 +650,7 @@ JumpButton (void) pmove.oldbuttons |= BUTTON_JUMP; // don't jump again until released } -void +static void CheckWaterJump (void) { int cont; @@ -692,7 +692,7 @@ CheckWaterJump (void) try nudging slightly on all axis to allow for the cut precision of the net coordinates */ -void +static void NudgePosition (void) { int i, x, y, z; @@ -725,7 +725,7 @@ NudgePosition (void) // Con_DPrintf ("NudgePosition: stuck\n"); } -void +static void SpectatorMove (void) { float control, drop, friction, fmove, smove, speed, newspeed; diff --git a/qw/source/pmovetst.c b/qw/source/pmovetst.c index a232e1d8a..bfc11b86b 100644 --- a/qw/source/pmovetst.c +++ b/qw/source/pmovetst.c @@ -90,7 +90,7 @@ PM_InitBoxHull (void) To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being compared directly. */ -hull_t * +static hull_t * PM_HullForBox (const vec3_t mins, const vec3_t maxs) { box_planes[0].dist = maxs[0]; diff --git a/qw/source/sbar.c b/qw/source/sbar.c index 3f87d93d7..fe771a6ae 100644 --- a/qw/source/sbar.c +++ b/qw/source/sbar.c @@ -100,7 +100,7 @@ static void (*Sbar_Draw_DMO_func) (int l, int y, int skip); Tab key down */ -void +static void Sbar_ShowTeamScores (void) { if (sb_showteamscores) @@ -115,7 +115,7 @@ Sbar_ShowTeamScores (void) Tab key up */ -void +static void Sbar_DontShowTeamScores (void) { sb_showteamscores = false; @@ -127,7 +127,7 @@ Sbar_DontShowTeamScores (void) Tab key down */ -void +static void Sbar_ShowScores (void) { if (sb_showscores) @@ -142,7 +142,7 @@ Sbar_ShowScores (void) Tab key up */ -void +static void Sbar_DontShowScores (void) { sb_showscores = false; @@ -296,12 +296,12 @@ Sbar_DrawCharacter (int x, int y, int num) } static inline void -Sbar_DrawString (int x, int y, char *str) +Sbar_DrawString (int x, int y, const char *str) { Draw_String (x, y + vid.height - SBAR_HEIGHT, str); } -int +static int Sbar_itoa (int num, char *buf) { char *str; @@ -328,7 +328,7 @@ Sbar_itoa (int num, char *buf) return str - buf; } -void +static void Sbar_DrawNum (int x, int y, int num, int digits, int color) { char str[12]; @@ -366,7 +366,7 @@ int teamsort[MAX_CLIENTS]; int fragsort[MAX_CLIENTS]; // ZOID changed this from [MAX_SCOREBOARD] int scoreboardlines, scoreboardteams; -void +static void Sbar_SortFrags (qboolean includespec) { int i, j, k; @@ -393,7 +393,7 @@ Sbar_SortFrags (qboolean includespec) } } -void +static void Sbar_SortTeams (void) { char t[16 + 1]; @@ -457,13 +457,13 @@ Sbar_SortTeams (void) } } -int +static int Sbar_ColorForMap (int m) { return (bound (0, m, 13) * 16) + 8; } -void +static void Sbar_SoloScoreboard (void) { char str[80]; @@ -480,7 +480,7 @@ Sbar_SoloScoreboard (void) Sbar_DrawString (184, 4, str); } -void +static void Sbar_DrawInventory (void) { char num[6]; @@ -575,7 +575,7 @@ Sbar_DrawInventory (void) } } -void +static void Sbar_DrawFrags (void) { int i, k, l; @@ -626,7 +626,7 @@ Sbar_DrawFrags (void) } } -void +static void Sbar_DrawFace (void) { int f, anim; @@ -662,7 +662,7 @@ Sbar_DrawFace (void) Sbar_DrawPic (112, 0, sb_faces[f][anim]); } -void +static void Sbar_DrawNormal (void) { if (cl_sbar->int_val || scr_viewsize->int_val < 100) @@ -772,32 +772,6 @@ Sbar_Draw (void) Sbar_MiniDeathmatchOverlay (); } -void -Sbar_IntermissionNumber (int x, int y, int num, int digits, int color) -{ - char str[12]; - char *ptr; - int l, frame; - - l = Sbar_itoa (num, str); - ptr = str; - if (l > digits) - ptr += (l - digits); - if (l < digits) - x += (digits - l) * 24; - - while (*ptr) { - if (*ptr == '-') - frame = STAT_MINUS; - else - frame = *ptr - '0'; - - Draw_Pic (x, y, sb_nums[color][frame]); - x += 24; - ptr++; - } -} - /* Sbar_TeamOverlay diff --git a/qw/source/sv_ccmds.c b/qw/source/sv_ccmds.c index ba94090be..b637828e2 100644 --- a/qw/source/sv_ccmds.c +++ b/qw/source/sv_ccmds.c @@ -87,7 +87,7 @@ match_char (char a, char b) FIXME: this function and it's callers are getting progressively uglier as more features are added :) */ -client_t * +static client_t * SV_Match_User (const char *substr) { int i, j, uid; @@ -152,7 +152,7 @@ SV_Match_User (const char *substr) Make a master server current */ -void +static void SV_SetMaster_f (void) { char data[2]; @@ -187,7 +187,7 @@ SV_SetMaster_f (void) svs.last_heartbeat = -99999; } -void +static void SV_Quit_f (void) { SV_FinalMessage ("server shutdown\n"); @@ -195,7 +195,7 @@ SV_Quit_f (void) Sys_Quit (); } -void +static void SV_Fraglogfile_f (void) { char name[MAX_OSPATH]; @@ -233,7 +233,7 @@ SV_Fraglogfile_f (void) Sets host_client and sv_player to the player with idnum Cmd_Argv(1) */ -qboolean +static qboolean SV_SetPlayer (void) { client_t *cl; @@ -259,7 +259,7 @@ SV_SetPlayer (void) Sets client to godmode */ -void +static void SV_God_f (void) { if (!sv_allow_cheats) { @@ -278,7 +278,7 @@ SV_God_f (void) SV_ClientPrintf (1, host_client, PRINT_HIGH, "godmode ON\n"); } -void +static void SV_Noclip_f (void) { if (!sv_allow_cheats) { @@ -299,7 +299,7 @@ SV_Noclip_f (void) } } -void +static void SV_Give_f (void) { const char *t; @@ -392,7 +392,7 @@ nice_time (float time) map command from the console or progs. */ -void +static void SV_Map_f (void) { char level[MAX_QPATH]; @@ -437,7 +437,7 @@ SV_Map_f (void) Kick a user off of the server */ -void +static void SV_Kick_f (void) { client_t *cl; @@ -555,7 +555,7 @@ SV_Status_f (void) #define MAXPENALTY 10.0 -void +static void SV_Cuff_f (void) { int i; @@ -618,7 +618,7 @@ SV_Cuff_f (void) } -void +static void SV_Mute_f (void) { int i; @@ -678,7 +678,7 @@ SV_Mute_f (void) } } -void +static void SV_Tell (const char *prefix) { char *p; @@ -712,7 +712,7 @@ SV_Tell (const char *prefix) SV_ClientPrintf (1, cl, PRINT_CHAT, "%s", ""); // bell } -void +static void SV_Ban_f (void) { double mins = 30.0; @@ -739,7 +739,7 @@ SV_Ban_f (void) mins), src_command); } -void +static void SV_Match_f (void) { if (Cmd_Argc() != 2) { @@ -752,7 +752,7 @@ SV_Match_f (void) } -void +static void SV_ConSay (const char *prefix) { char *p; @@ -792,7 +792,7 @@ SV_ConSay (const char *prefix) } } -void +static void SV_Tell_f (void) { if (rcon_from_user) @@ -801,7 +801,7 @@ SV_Tell_f (void) SV_Tell("Console"); } -void +static void SV_ConSay_f (void) { if (rcon_from_user) @@ -810,19 +810,19 @@ SV_ConSay_f (void) SV_ConSay("Console"); } -void +static void SV_ConSay_Info_f (void) { SV_ConSay("Info"); } -void +static void SV_Heartbeat_f (void) { svs.last_heartbeat = -9999; } -void +static void SV_SendServerInfoChange (const char *key, const char *value) { if (!sv.state) @@ -871,7 +871,7 @@ Cvar_Info (cvar_t *var) Examine or change the serverinfo string */ -void +static void SV_Serverinfo_f (void) { cvar_t *var; @@ -908,7 +908,7 @@ SV_Serverinfo_f (void) Examine or change the serverinfo string */ -void +static void SV_Localinfo_f (void) { if (Cmd_Argc () == 1) { @@ -938,7 +938,7 @@ SV_Localinfo_f (void) Examine a users info strings */ -void +static void SV_User_f (void) { if (Cmd_Argc () != 2) { @@ -957,7 +957,7 @@ SV_User_f (void) Sets the fake *gamedir to a different directory. */ -void +static void SV_Gamedir (void) { const char *dir; @@ -990,7 +990,7 @@ SV_Gamedir (void) Sets the gamedir and path to a different directory. */ -void +static void SV_Floodprot_f (void) { int arg1, arg2, arg3; @@ -1035,7 +1035,7 @@ SV_Floodprot_f (void) fp_secondsdead = arg3; } -void +static void SV_Floodprotmsg_f (void) { if (Cmd_Argc () == 1) { @@ -1048,7 +1048,7 @@ SV_Floodprotmsg_f (void) snprintf (fp_msg, sizeof (fp_msg), "%s", Cmd_Argv (1)); } -void +static void SV_Snap (int uid) { char pcxname[80]; @@ -1097,7 +1097,7 @@ SV_Snap (int uid) SV_Printf ("Requesting snap from user %d...\n", uid); } -void +static void SV_Snap_f (void) { int uid; @@ -1112,7 +1112,7 @@ SV_Snap_f (void) SV_Snap (uid); } -void +static void SV_SnapAll_f (void) { client_t *cl; diff --git a/qw/source/sv_demo.c b/qw/source/sv_demo.c index ea4989f49..29feb8289 100644 --- a/qw/source/sv_demo.c +++ b/qw/source/sv_demo.c @@ -86,21 +86,6 @@ static int header = (int) &((header_t *) 0)->data; entity_state_t demo_entities[UPDATE_MASK + 1][MAX_DEMO_PACKET_ENTITIES]; -// only one .. is allowed (security) -qboolean -sv_demoDir_OnChange (cvar_t *cvar, char *value) -{ - if (!value[0]) - return true; - - if (value[0] == '.' && value[1] == '.') - value += 2; - if (strstr (value, "/..")) - return true; - - return false; -} - void SV_DemoPings (void) { @@ -121,7 +106,7 @@ SV_DemoPings (void) } } -void +static void DemoBuffer_Init (dbuffer_t * dbuffer, byte * buf, size_t size) { demobuffer = dbuffer; @@ -162,7 +147,7 @@ DemoSetMsgBuf (demobuf_t * prev, demobuf_t * cur) Message is cleared from demobuf after that */ -void +static void SV_DemoWriteToDisk (int type, int to, float time) { int pos = 0, oldm, oldd; @@ -251,7 +236,7 @@ DemoSetBuf (byte type, int to) demo.dbuf->h = p; } -void +static void DemoMoveBuf (void) { // set the last message mark to the previous frame (i/e begining of this @@ -383,7 +368,7 @@ SV_WriteDemoMessage (sizebuf_t *msg, int type, int to, float time) and writes packets to the disk/memory */ -float +static float adjustangle (float current, float ideal, float fraction) { float move; @@ -556,7 +541,7 @@ SV_DemoWritePackets (int num) demo.dbuf->sz.maxsize = MAXSIZE + demo.dbuf->bufsize; } -int +static int memwrite (QFile * _mem, const void *buffer, int size) { int i; @@ -569,7 +554,7 @@ memwrite (QFile * _mem, const void *buffer, int size) return size; } -qboolean +static qboolean SV_InitRecord (void) { if (!USACACHE) { @@ -689,7 +674,7 @@ SV_Stop_f (void) Stops recording, and removes the demo */ -void +static void SV_Cancel_f (void) { SV_Stop (2); @@ -701,7 +686,7 @@ SV_Cancel_f (void) Dumps the current net message, prefixed by the length and view angles */ -void +static void SV_WriteRecordDemoMessage (sizebuf_t *msg, int seq) { int len; @@ -725,7 +710,7 @@ SV_WriteRecordDemoMessage (sizebuf_t *msg, int seq) Qflush (demo.file); } -void +static void SV_WriteSetDemoMessage (void) { int len; @@ -752,7 +737,7 @@ SV_WriteSetDemoMessage (void) Qflush (demo.file); } -static char * +static const char * SV_PrintTeams (void) { char teams[MAX_CLIENTS][128]; @@ -822,7 +807,7 @@ SV_Record (char *name) char buf_data[MAX_MSGLEN]; int n, i; char path[MAX_OSPATH]; - char *info; + const char *info; dstring_t *tn = demo.name, *tp = demo.path; client_t *player; @@ -1073,7 +1058,7 @@ SV_Record (char *name) Cleans the demo name, removes restricted chars, makes name lowercase */ -char * +static char * SV_CleanName (const unsigned char *name) { static char text[1024]; @@ -1098,7 +1083,7 @@ SV_CleanName (const unsigned char *name) record */ -void +static void SV_Record_f (void) { dstring_t *name = dstring_newstr (); @@ -1138,8 +1123,8 @@ SV_Record_f (void) easyrecord [demoname] */ -int -Dem_CountPlayers () +static int +Dem_CountPlayers (void) { int i, count; @@ -1152,7 +1137,7 @@ Dem_CountPlayers () return count; } -const char * +static const char * Dem_Team (int num) { int i; @@ -1182,7 +1167,7 @@ Dem_Team (int num) return lastteam[index]; } -char * +static const char * Dem_PlayerName (int num) { int i; @@ -1199,7 +1184,7 @@ Dem_PlayerName (int num) return ""; } -void +static void SV_EasyRecord_f (void) { dstring_t *name = dstring_newstr (); @@ -1271,7 +1256,7 @@ SV_EasyRecord_f (void) dstring_delete (name2); } -void +static void SV_DemoList_f (void) { /* @@ -1314,7 +1299,7 @@ SV_DemoList_f (void) */ } -char * +static char * SV_DemoNum (int num) { /* @@ -1340,7 +1325,7 @@ SV_DemoNum (int num) return NULL; } -char * +static char * SV_DemoName2Txt (char *name) { char s[MAX_OSPATH]; @@ -1358,13 +1343,13 @@ SV_DemoName2Txt (char *name) return va ("%s", s); } -char * +static char * SV_DemoTxTNum (int num) { return SV_DemoName2Txt (SV_DemoNum (num)); } -void +static void SV_DemoRemove_f (void) { dstring_t *name = dstring_newstr (); @@ -1449,7 +1434,7 @@ SV_DemoRemove_f (void) unlink (SV_DemoName2Txt (path)); } -void +static void SV_DemoRemoveNum_f (void) { int num; @@ -1499,7 +1484,7 @@ SV_DemoRemoveNum_f (void) Con_Printf ("invalid demo num\n"); } -void +static void SV_DemoInfoAdd_f (void) { const char *name = 0, *args; @@ -1548,7 +1533,7 @@ SV_DemoInfoAdd_f (void) Qclose (f); } -void +static void SV_DemoInfoRemove_f (void) { char *name = 0, path[MAX_OSPATH]; @@ -1584,7 +1569,7 @@ SV_DemoInfoRemove_f (void) Con_Printf ("file removed\n"); } -void +static void SV_DemoInfo_f (void) { const char *buf; diff --git a/qw/source/sv_ents.c b/qw/source/sv_ents.c index de33d3d7d..1a2a77938 100644 --- a/qw/source/sv_ents.c +++ b/qw/source/sv_ents.c @@ -59,7 +59,7 @@ byte fatpvs[MAX_MAP_LEAFS / 8]; int fatbytes; -void +static void SV_AddToFatPVS (vec3_t org, mnode_t *node) { byte *pvs; @@ -97,7 +97,7 @@ SV_AddToFatPVS (vec3_t org, mnode_t *node) Calculates a PVS that is the inclusive or of all leafs within 8 pixels of the given point. */ -byte * +static byte * SV_FatPVS (vec3_t org) { fatbytes = (sv.worldmodel->numleafs + 31) >> 3; @@ -113,7 +113,7 @@ int numnails; int nailcount; -qboolean +static qboolean SV_AddNailUpdate (edict_t *ent) { if (SVfloat (ent, modelindex) != sv_nailmodel @@ -126,7 +126,7 @@ SV_AddNailUpdate (edict_t *ent) return true; } -void +static void SV_EmitNailUpdate (sizebuf_t *msg, qboolean recorder) { byte *buf; // [48 bits] xyzpy 12 12 12 4 8 @@ -173,7 +173,7 @@ SV_EmitNailUpdate (sizebuf_t *msg, qboolean recorder) Writes part of a packetentities message. Can delta from either a baseline or a previous packet_entity */ -void +static void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, int stdver) { @@ -322,7 +322,7 @@ SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, Writes a delta update of a packet_entities_t to the message. */ -void +static void SV_EmitPacketEntities (client_t *client, packet_entities_t *to, sizebuf_t *msg) { int newindex, oldindex, newnum, oldnum, oldmax; @@ -393,7 +393,7 @@ SV_EmitPacketEntities (client_t *client, packet_entities_t *to, sizebuf_t *msg) MSG_WriteShort (msg, 0); // end of packetentities } -void +static void SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs, sizebuf_t *msg) { diff --git a/qw/source/sv_init.c b/qw/source/sv_init.c index 74479171b..3350ee705 100644 --- a/qw/source/sv_init.c +++ b/qw/source/sv_init.c @@ -103,7 +103,7 @@ SV_FlushSignon (void) to the clients -- only the fields that differ from the baseline will be transmitted */ -void +static void SV_CreateBaseline (void) { int entnum; @@ -199,7 +199,7 @@ SV_SaveSpawnparms (void) Expands the PVS and calculates the PHS (Potentially Hearable Set) */ -void +static void SV_CalcPHS (void) { byte *scan; @@ -263,7 +263,7 @@ SV_CalcPHS (void) vcount / num, count / num, num); } -unsigned int +static unsigned int SV_CheckModel (const char *mdl) { byte stackbuf[1024]; // avoid dirtying the cache heap diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 7029f3f26..976941dc1 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -227,7 +227,7 @@ ServerPaused (void) Informs all masters that this server is going down */ -void +static void Master_Shutdown (void) { char string[2048]; @@ -270,7 +270,7 @@ SV_Shutdown (void) Sends a datagram to all the clients informing them of the server crash, then exits */ -void +static void SV_Error (const char *error, va_list argptr) { static qboolean inerror = false; @@ -419,7 +419,7 @@ make_info_string_filter (const char *key) void SV_FullClientUpdate (client_t *client, sizebuf_t *buf) { - char *info; + const char *info; int i; i = client - svs.clients; @@ -479,7 +479,7 @@ SV_FullClientUpdateToClient (client_t *client, client_t *cl) Bad sides: affects gamespy and spytools somewhat... */ -int +static int CheckForFlood (flood_enum_t cmdtype) { double currenttime; @@ -549,7 +549,7 @@ CheckForFlood (flood_enum_t cmdtype) Responds with all the info that qplug or qspy can see This message can be up to around 5k with worst case string lengths. */ -void +static void SVC_Status (void) { client_t *cl; @@ -587,7 +587,7 @@ SVC_Status (void) #define LOG_HIGHWATER 4096 #define LOG_FLUSH 10*60 -void +static void SV_CheckLog (void) { sizebuf_t *sz; @@ -615,7 +615,7 @@ SV_CheckLog (void) the same as the current sequence, an A2A_NACK will be returned instead of the data. */ -void +static void SVC_Log (void) { char data[MAX_DATAGRAM + 64]; @@ -656,7 +656,7 @@ SVC_Log (void) Just responds with an acknowledgement */ -void +static void SVC_Ping (void) { char data; @@ -680,11 +680,11 @@ SVC_Ping (void) flood the server with invalid connection IPs. With a challenge, they must give a valid IP address. */ -void +static void SVC_GetChallenge (void) { int oldest, oldestTime, i; - char *extended = ""; + const char *extended = ""; oldest = 0; oldestTime = 0x7fffffff; @@ -721,7 +721,7 @@ SVC_GetChallenge (void) A connection request that did not come from the master */ -void +static void SVC_DirectConnect (void) { info_t *userinfo = 0; @@ -958,7 +958,7 @@ SVC_DirectConnect (void) newcl->cuff_time = SV_RestorePenaltyFilter(newcl, ft_cuff); } -int +static int Rcon_Validate (cvar_t *pass) { if (!strlen (pass->string)) @@ -970,7 +970,7 @@ Rcon_Validate (cvar_t *pass) return 1; } -char * +static char * Name_of_sender (void) { client_t *cl; @@ -995,7 +995,7 @@ Name_of_sender (void) Shift down the remaining args Redirect all printfs */ -void +static void SVC_RemoteCommand (void) { const char *command; @@ -1068,7 +1068,7 @@ SVC_RemoteCommand (void) Clients that are in the game can still send connectionless packets. */ -void +static void SV_ConnectionlessPacket (void) { const char *c, *s; @@ -1162,7 +1162,7 @@ int numipfilters; ipfilter_t ipfilters[MAX_IPFILTERS]; unsigned int ipmasks[33]; // network byte order -void +static void SV_GenerateIPMasks (void) { int i; @@ -1175,7 +1175,7 @@ SV_GenerateIPMasks (void) } // Note: this function is non-reentrant and not threadsafe -const char * +static const char * SV_PrintIP (byte *ip) { #ifdef HAVE_IPV6 @@ -1264,7 +1264,7 @@ SV_IPCopy (byte *dest, byte *src) ((unsigned int *)dest)[i] = ((unsigned int *)src)[i]; } -qboolean +static qboolean SV_StringToFilter (const char *address, ipfilter_t *f) { #ifdef HAVE_IPV6 @@ -1360,7 +1360,7 @@ bad_address: return false; } -void +static void SV_RemoveIPFilter (int i) { for (; i + 1 < numipfilters; i++) @@ -1370,11 +1370,11 @@ SV_RemoveIPFilter (int i) } -void +static void SV_CleanIPList (void) { int i; - char *type; + const char *type; for (i = 0; i < numipfilters;) { if (ipfilters[i].time && (ipfilters[i].time <= realtime)) { @@ -1392,7 +1392,7 @@ SV_CleanIPList (void) } } -void +static void SV_AddIP_f (void) { int i; @@ -1435,7 +1435,7 @@ SV_AddIP_f (void) for (i = 0; i < MAX_CLIENTS; i++) { client_t *cl = &svs.clients[i]; char text[1024]; - char *typestr; + const char *typestr; char timestr[1024]; if (cl->state == cs_free) @@ -1480,7 +1480,7 @@ SV_AddIP_f (void) } } -void +static void SV_RemoveIP_f (void) { int i; @@ -1498,11 +1498,11 @@ SV_RemoveIP_f (void) SV_Printf ("Didn't find %s/%u.\n", SV_PrintIP (f.ip), f.mask); } -void +static void SV_ListIP_f (void) { int i; - char *type; + const char *type; char timestr[30]; SV_Printf ("IP Filter list:\n"); @@ -1527,13 +1527,13 @@ SV_ListIP_f (void) numipfilters == 1 ? "" : "s"); } -void +static void SV_WriteIP_f (void) { char name[MAX_OSPATH]; int i; QFile *f; - char *type; + const char *type; snprintf (name, sizeof (name), "%s/listip.cfg", com_gamedir); @@ -1559,7 +1559,7 @@ SV_WriteIP_f (void) Qclose (f); } -void +static void SV_netDoSexpire_f (void) { int arg1, i; @@ -1588,7 +1588,7 @@ SV_netDoSexpire_f (void) return; } -void +static void SV_netDoSvalues_f (void) { int arg1, i; @@ -1617,7 +1617,7 @@ SV_netDoSvalues_f (void) return; } -void +static void SV_MaxRate_f (cvar_t *var) { client_t *cl; @@ -1644,7 +1644,7 @@ SV_MaxRate_f (cvar_t *var) } } -void +static void SV_SendBan (double till) { char data[128]; @@ -1673,7 +1673,7 @@ SV_SendBan (double till) // FIXME: this should send a disconnect to the client! } -qboolean +static qboolean SV_FilterIP (byte *ip, double *until) { int i; @@ -1749,7 +1749,7 @@ SV_RestorePenaltyFilter (client_t *cl, filtertype_t type) return 0.0; } -void +static void SV_ReadPackets (void) { //NOTE star volatile, not volatile star @@ -1824,7 +1824,7 @@ SV_ReadPackets (void) state for a few seconds to make sure any final reliable message gets resent if necessary */ -void +static void SV_CheckTimeouts (void) { client_t *cl; @@ -1862,7 +1862,7 @@ SV_CheckTimeouts (void) Add them exactly as if they had been typed at the console */ -void +static void SV_GetConsoleCommands (void) { Con_ProcessInput (); @@ -1871,7 +1871,7 @@ SV_GetConsoleCommands (void) /* SV_CheckVars */ -void +static void SV_CheckVars (void) { static char const *pw, *spw; @@ -1902,8 +1902,8 @@ SV_CheckVars (void) Run string GC on progs every pr_gc_interval frames */ -void -SV_GarbageCollect () +static void +SV_GarbageCollect (void) { if (pr_gc->int_val == 1 || (pr_gc->int_val == 2 && sv_pr_state.progs->version == PROG_VERSION)) { @@ -2011,7 +2011,7 @@ SV_Frame (float time) Con_ProcessInput (); //XXX evil hack to get the cursor in the right place } -void +static void SV_InitLocal (void) { int i; @@ -2393,7 +2393,7 @@ SV_ExtractFromUserinfo (client_t *cl) cl->stdver = atof (Info_ValueForKey (cl->userinfo, "*qsg_version")); } -void +static void SV_InitNet (void) { int port, p; @@ -2416,7 +2416,7 @@ SV_InitNet (void) sv_net_initialized = 1; } -void +static void SV_Init_Memory (void) { int mem_parm = COM_CheckParm ("-mem"); diff --git a/qw/source/sv_model.c b/qw/source/sv_model.c index 6be81886b..cd364dc1b 100644 --- a/qw/source/sv_model.c +++ b/qw/source/sv_model.c @@ -34,6 +34,7 @@ static const char rcsid[] = #include "QF/cvar.h" #include "QF/model.h" +#include "QF/render.h" int mod_lightmap_bytes = 1; diff --git a/qw/source/sv_move.c b/qw/source/sv_move.c index bb6ecd650..730f64f72 100644 --- a/qw/source/sv_move.c +++ b/qw/source/sv_move.c @@ -224,7 +224,7 @@ SV_movestep (edict_t *ent, const vec3_t move, qboolean relink) Turns to the movement direction, and walks the current distance if facing it. */ -qboolean +static qboolean SV_StepDirection (edict_t *ent, float yaw, float dist) { float delta; @@ -253,7 +253,7 @@ SV_StepDirection (edict_t *ent, float yaw, float dist) return false; } -void +static void SV_FixCheckBottom (edict_t *ent) { SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_PARTIALGROUND; @@ -261,7 +261,7 @@ SV_FixCheckBottom (edict_t *ent) #define DI_NODIR -1 -void +static void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist) { float deltax, deltay, olddir, tdir, turnaround; @@ -333,7 +333,7 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist) SV_FixCheckBottom (actor); } -qboolean +static qboolean SV_CloseEnough (edict_t *ent, edict_t *goal, float dist) { int i; diff --git a/qw/source/sv_nchan.c b/qw/source/sv_nchan.c index 50fd6acfd..72cb95c8e 100644 --- a/qw/source/sv_nchan.c +++ b/qw/source/sv_nchan.c @@ -42,7 +42,7 @@ static const char rcsid[] = #include "server.h" -void +static void PushBackbuf (client_t *cl) { memset (&cl->backbuf, 0, sizeof (cl->backbuf)); diff --git a/qw/source/sv_phys.c b/qw/source/sv_phys.c index 960a892de..177136996 100644 --- a/qw/source/sv_phys.c +++ b/qw/source/sv_phys.c @@ -70,8 +70,8 @@ cvar_t *sv_friction; cvar_t *sv_waterfriction; #define MOVE_EPSILON 0.01 - -void +#if 0 +static void SV_CheckAllEnts (void) { edict_t *check; @@ -92,7 +92,7 @@ SV_CheckAllEnts (void) Con_Printf ("entity in invalid position\n"); } } - +#endif void SV_CheckVelocity (edict_t *ent) { @@ -196,7 +196,7 @@ SV_Impact (edict_t *e1, edict_t *e2) Slide off of the impacting object returns the blocked flags (1 = floor, 2 = step / wall) */ -int +static int ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) { float backoff, change; @@ -232,7 +232,7 @@ ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) 4 = dead stop If steptrace is not NULL, the trace of any vertical wall hit will be stored */ -int +static int SV_FlyMove (edict_t *ent, float time, trace_t *steptrace) { float d, time_left; @@ -363,7 +363,7 @@ SV_AddGravity (edict_t *ent) Does not change the entities velocity at all */ -trace_t +static trace_t SV_PushEntity (edict_t *ent, vec3_t push) { trace_t trace; @@ -392,7 +392,7 @@ SV_PushEntity (edict_t *ent, vec3_t push) return trace; } -qboolean +static qboolean SV_Push (edict_t *pusher, vec3_t move) { float solid_save; @@ -498,7 +498,7 @@ SV_Push (edict_t *pusher, vec3_t move) return true; } -void +static void SV_PushMove (edict_t *pusher, float movetime) { vec3_t move; @@ -514,7 +514,7 @@ SV_PushMove (edict_t *pusher, float movetime) SVfloat (pusher, ltime) += movetime; } -void +static void SV_Physics_Pusher (edict_t *ent) { float movetime, oldltime, thinktime; @@ -558,7 +558,7 @@ SV_Physics_Pusher (edict_t *ent) Non moving objects can only think */ -void +static void SV_Physics_None (edict_t *ent) { // regular thinking @@ -571,7 +571,7 @@ SV_Physics_None (edict_t *ent) A moving object that doesn't obey physics */ -void +static void SV_Physics_Noclip (edict_t *ent) { // regular thinking @@ -588,7 +588,7 @@ SV_Physics_Noclip (edict_t *ent) /* TOSS / BOUNCE */ -void +static void SV_CheckWaterTransition (edict_t *ent) { int cont; @@ -695,7 +695,7 @@ SV_Physics_Toss (edict_t *ent) will fall if the floor is pulled out from under them. FIXME: is this true? */ -void +static void SV_Physics_Step (edict_t *ent) { qboolean hitsound; @@ -733,7 +733,7 @@ SV_ProgStartFrame (void) PR_ExecuteProgram (&sv_pr_state, sv_funcs.StartFrame); } -void +static void SV_RunEntity (edict_t *ent) { if (sv_fields.lastruntime != -1) { diff --git a/qw/source/sv_pr_cmds.c b/qw/source/sv_pr_cmds.c index 93e90ea6c..80fae0471 100644 --- a/qw/source/sv_pr_cmds.c +++ b/qw/source/sv_pr_cmds.c @@ -392,7 +392,7 @@ PF_traceline (progs_t *pr) Wrapper around SV_Move, this makes PF_movetoground and PF_traceline redundant. */ -void +static void PF_checkmove (progs_t *pr) { edict_t *ent; @@ -1015,7 +1015,7 @@ PF_changeyaw (progs_t *pr) #define MSG_INIT 3 // write to the init string #define MSG_MULTICAST 4 // for multicast() -sizebuf_t * +static sizebuf_t * WriteDest (progs_t *pr) { int dest; @@ -1358,7 +1358,7 @@ PF_multicast (progs_t *pr) float(string path, string mode) cfopen */ -void +static void PF_cfopen (progs_t *pr) { R_FLOAT (pr) = CF_Open (P_STRING (pr, 0), @@ -1370,7 +1370,7 @@ PF_cfopen (progs_t *pr) void (float desc) cfclose */ -void +static void PF_cfclose (progs_t *pr) { CF_Close ((int) P_FLOAT (pr, 0)); @@ -1381,7 +1381,7 @@ PF_cfclose (progs_t *pr) string (float desc) cfread */ -void +static void PF_cfread (progs_t *pr) { RETURN_STRING (pr, CF_Read((int) P_FLOAT (pr, 0))); @@ -1392,7 +1392,7 @@ PF_cfread (progs_t *pr) float (float desc, string buf) cfwrite */ -void +static void PF_cfwrite (progs_t *pr) { R_FLOAT (pr) = CF_Write((int) P_FLOAT (pr, 0), P_STRING (pr, 1)); @@ -1403,7 +1403,7 @@ PF_cfwrite (progs_t *pr) float () cfeof */ -void +static void PF_cfeof (progs_t *pr) { R_FLOAT (pr) = CF_EOF ((int) P_FLOAT (pr, 0)); @@ -1414,13 +1414,13 @@ PF_cfeof (progs_t *pr) float () cfquota */ -void +static void PF_cfquota (progs_t *pr) { R_FLOAT (pr) = CF_Quota(); } -void +static void PF_setinfokey (progs_t *pr) { edict_t *edict = P_EDICT (pr, 0); @@ -1634,7 +1634,7 @@ PF_Fixme (progs_t *pr) PR_RunError (pr, "Unimplemented builtin function called"); } -void +static void PF_Checkextension (progs_t *pr) { R_FLOAT(pr) = 0; //FIXME make this function actually useful :P diff --git a/qw/source/sv_progs.c b/qw/source/sv_progs.c index 7823fbad1..ea75348b0 100644 --- a/qw/source/sv_progs.c +++ b/qw/source/sv_progs.c @@ -113,7 +113,7 @@ prune_edict (progs_t *pr, edict_t *ent) return 0; } -void +static void ED_PrintEdicts_f (void) { ED_PrintEdicts (&sv_pr_state, Cmd_Argv (1)); @@ -124,7 +124,7 @@ ED_PrintEdicts_f (void) For debugging, prints a single edicy */ -void +static void ED_PrintEdict_f (void) { int i; @@ -134,7 +134,7 @@ ED_PrintEdict_f (void) ED_PrintNum (&sv_pr_state, i); } -void +static void ED_Count_f (void) { ED_Count (&sv_pr_state); diff --git a/qw/source/sv_send.c b/qw/source/sv_send.c index 72ecc66f5..e36e5099f 100644 --- a/qw/source/sv_send.c +++ b/qw/source/sv_send.c @@ -66,7 +66,7 @@ int con_printf_no_log; redirect_t sv_redirected; -void +static void SV_FlushRedirect (void) { char send[8000 + 6]; @@ -627,7 +627,7 @@ get_stats (edict_t *ent, int spectator, int stats[MAX_CL_STATS]) Performs a delta update of the stats array. This should only be performed when a reliable message can be delivered this frame. */ -void +static void SV_UpdateClientStats (client_t *client) { edict_t *ent; @@ -658,7 +658,7 @@ SV_UpdateClientStats (client_t *client) } } -qboolean +static qboolean SV_SendClientDatagram (client_t *client) { byte buf[MAX_DATAGRAM]; @@ -700,7 +700,7 @@ SV_SendClientDatagram (client_t *client) return true; } -void +static void SV_UpdateToReliableMessages (void) { client_t *client; diff --git a/qw/source/sv_sys_unix.c b/qw/source/sv_sys_unix.c index 998ac9bca..e30987106 100644 --- a/qw/source/sv_sys_unix.c +++ b/qw/source/sv_sys_unix.c @@ -110,7 +110,7 @@ wrfpcr(unsigned long val) } #endif -void +static void startup (void) { #ifdef __alpha__ diff --git a/qw/source/sv_sys_win.c b/qw/source/sv_sys_win.c index daa9cd586..e8fa27bfc 100644 --- a/qw/source/sv_sys_win.c +++ b/qw/source/sv_sys_win.c @@ -49,7 +49,7 @@ server_static_t svs; info_t **svs_info = &svs.info; -void +static void startup (void) { OSVERSIONINFO vinfo; diff --git a/qw/source/sv_user.c b/qw/source/sv_user.c index 3ecf8fce2..afeeb1221 100644 --- a/qw/source/sv_user.c +++ b/qw/source/sv_user.c @@ -103,7 +103,7 @@ gib_event_t *sv_chat_e; Sends the first message from the server to a connected client. This will be sent on the initial connection and upon each server load. */ -void +static void SV_New_f (ucmd_t *cmd) { const char *gamedir; @@ -170,7 +170,7 @@ SV_New_f (ucmd_t *cmd) Info_MakeString (svs.info, 0))); } -void +static void SV_Soundlist_f (ucmd_t *cmd) { const char **s; @@ -217,7 +217,7 @@ SV_Soundlist_f (ucmd_t *cmd) MSG_WriteByte (&host_client->netchan.message, 0); } -void +static void SV_Modellist_f (ucmd_t *cmd) { const char **s; @@ -263,7 +263,7 @@ SV_Modellist_f (ucmd_t *cmd) MSG_WriteByte (&host_client->netchan.message, 0); } -void +static void SV_PreSpawn_f (ucmd_t *cmd) { char *command; @@ -327,7 +327,7 @@ SV_PreSpawn_f (ucmd_t *cmd) MSG_WriteString (msg, command); } -void +static void SV_Spawn_f (ucmd_t *cmd) { int i, n; @@ -424,7 +424,7 @@ SV_Spawn_f (ucmd_t *cmd) ClientReliableWrite_String (host_client, "skins\n"); } -void +static void SV_SpawnSpectator (void) { int i; @@ -446,7 +446,7 @@ SV_SpawnSpectator (void) } -void +static void SV_Begin_f (ucmd_t *cmd) { unsigned int pmodel = 0, emodel = 0; @@ -542,7 +542,7 @@ SV_Begin_f (ucmd_t *cmd) //============================================================================= -void +static void SV_NextDownload_f (ucmd_t *cmd) { byte buffer[1024]; @@ -574,8 +574,8 @@ SV_NextDownload_f (ucmd_t *cmd) } -void -OutofBandPrintf (netadr_t where, char *fmt, ...) +static void +OutofBandPrintf (netadr_t where, const char *fmt, ...) { char send[1024]; va_list argptr; @@ -592,7 +592,7 @@ OutofBandPrintf (netadr_t where, char *fmt, ...) NET_SendPacket (strlen (send) + 1, send, where); } -void +static void SV_NextUpload (void) { int percent, size; @@ -659,7 +659,7 @@ SV_NextUpload (void) } -void +static void SV_BeginDownload_f (ucmd_t *cmd) { const char *name; @@ -746,7 +746,7 @@ SV_BeginDownload_f (ucmd_t *cmd) //============================================================================= -void +static void SV_Say (qboolean team) { char *i, *p; @@ -866,13 +866,13 @@ SV_Say (qboolean team) MSG_WriteString (&demo.dbuf->sz, text); } -void +static void SV_Say_f (ucmd_t *cmd) { SV_Say (false); } -void +static void SV_Say_Team_f (ucmd_t *cmd) { SV_Say (true); @@ -886,7 +886,7 @@ SV_Say_Team_f (ucmd_t *cmd) The client is showing the scoreboard, so send new ping times for all clients */ -void +static void SV_Pings_f (ucmd_t *cmd) { client_t *client; @@ -905,7 +905,7 @@ SV_Pings_f (ucmd_t *cmd) } } -void +static void SV_Kill_f (ucmd_t *cmd) { if (SVfloat (sv_player, health) <= 0) { @@ -941,7 +941,7 @@ SV_TogglePause (const char *msg) } } -void +static void SV_Pause_f (ucmd_t *cmd) { char st[sizeof (host_client->name) + 32]; @@ -983,7 +983,7 @@ SV_Pause_f (ucmd_t *cmd) The client is going to disconnect, so remove the connection immediately */ -void +static void SV_Drop_f (ucmd_t *cmd) { SV_EndRedirect (); @@ -997,7 +997,7 @@ SV_Drop_f (ucmd_t *cmd) Change the bandwidth estimate for a client */ -void +static void SV_PTrack_f (ucmd_t *cmd) { edict_t *ent, *tent; @@ -1038,7 +1038,7 @@ SV_PTrack_f (ucmd_t *cmd) Change the bandwidth estimate for a client */ -void +static void SV_Rate_f (ucmd_t *cmd) { int rate; @@ -1065,7 +1065,7 @@ SV_Rate_f (ucmd_t *cmd) Change the message level for a client */ -void +static void SV_Msg_f (ucmd_t *cmd) { if (Cmd_Argc () != 2) { @@ -1086,7 +1086,7 @@ SV_Msg_f (ucmd_t *cmd) Allow clients to change userinfo */ -void +static void SV_SetInfo_f (ucmd_t *cmd) { if (Cmd_Argc () == 1) { @@ -1142,13 +1142,13 @@ SV_SetInfo_f (ucmd_t *cmd) Dump serverinfo into a string */ -void +static void SV_ShowServerinfo_f (ucmd_t *cmd) { Info_Print (svs.info); } -void +static void SV_NoSnap_f (ucmd_t *cmd) { if (*host_client->uploadfn) { @@ -1217,7 +1217,7 @@ ucmds_free (void *_c, void *unused) } } -void +static void SV_AddUserCommand (progs_t *pr) { const char *name = P_STRING (pr, 0); @@ -1283,7 +1283,7 @@ SV_ExecuteUserCommand (const char *s) Used by view and sv_user */ -float +static float SV_CalcRoll (vec3_t angles, vec3_t velocity) { vec3_t forward, right, up; @@ -1309,7 +1309,7 @@ SV_CalcRoll (vec3_t angles, vec3_t velocity) vec3_t pmove_mins, pmove_maxs; -void +static void AddLinksToPmove (areanode_t *node) { edict_t *check; @@ -1348,7 +1348,6 @@ AddLinksToPmove (areanode_t *node) if (sv_fields.rotated_bbox != -1 && SVinteger (check, rotated_bbox)) { - extern clip_hull_t *pf_hull_list[]; int h = SVinteger (check, rotated_bbox) - 1; pe->hull = pf_hull_list[h]->hulls[1]; @@ -1376,56 +1375,6 @@ AddLinksToPmove (areanode_t *node) AddLinksToPmove (node->children[1]); } -/* - AddAllEntsToPmove - - For debugging -*/ -void -AddAllEntsToPmove (void) -{ - edict_t *check; - int pl, e, i; - physent_t *pe; - - pl = EDICT_TO_PROG (&sv_pr_state, sv_player); - check = NEXT_EDICT (&sv_pr_state, sv.edicts); - for (e = 1; e < sv.num_edicts; e++, - check = NEXT_EDICT (&sv_pr_state, check)) { - if (check->free) - continue; - if (SVentity (check, owner) == pl) - continue; - if (SVfloat (check, solid) == SOLID_BSP - || SVfloat (check, solid) == SOLID_BBOX - || SVfloat (check, solid) == SOLID_SLIDEBOX) { - if (check == sv_player) - continue; - - for (i = 0; i < 3; i++) - if (SVvector (check, absmin)[i] > pmove_maxs[i] - || SVvector (check, absmax)[i] < pmove_mins[i]) - break; - if (i != 3) - continue; - pe = &pmove.physents[pmove.numphysent]; - - VectorCopy (SVvector (check, origin), pe->origin); - pmove.physents[pmove.numphysent].info = e; - if (SVfloat (check, solid) == SOLID_BSP) - pe->model = sv.models[(int) (SVfloat (check, modelindex))]; - else { - pe->model = NULL; - VectorCopy (SVvector (check, mins), pe->mins); - VectorCopy (SVvector (check, maxs), pe->maxs); - } - - if (++pmove.numphysent == MAX_PHYSENTS) - break; - } - } -} - byte playertouch[(MAX_EDICTS + 7) / 8]; /* @@ -1433,7 +1382,7 @@ byte playertouch[(MAX_EDICTS + 7) / 8]; Done before running a player command. Clears the touch array */ -void +static void SV_PreRunCmd (void) { memset (playertouch, 0, sizeof (playertouch)); @@ -1495,7 +1444,7 @@ check_usecs (usercmd_t *ucmd) SV_DropClient (host_client); } -void +static void SV_RunCmd (usercmd_t *ucmd, qboolean inside) { int oldmsec, i, n; @@ -1660,7 +1609,7 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside) Done after running a player command. */ -void +static void SV_PostRunCmd (void) { // run post-think diff --git a/qw/source/teamplay.c b/qw/source/teamplay.c index 60683999a..432e7b705 100644 --- a/qw/source/teamplay.c +++ b/qw/source/teamplay.c @@ -332,7 +332,7 @@ Team_Init_Cvars (void) Location marker manipulation */ -void +static void locs_loc (void) { char locfile[MAX_OSPATH]; @@ -402,7 +402,7 @@ locs_loc (void) } } -void +static void Locs_Loc_Get (void) { location_t *location; @@ -425,13 +425,13 @@ Locs_Init (void) GIB_Builtin_Add ("loc::get", Locs_Loc_Get, GIB_BUILTIN_NORMAL); } -char * +static const char * Team_F_Version (char *args) { return va ("say %s %s", PROGRAM, VERSION); } -char * +static const char * Team_F_Skins (char *args) { int totalfb, l; diff --git a/qw/source/world.c b/qw/source/world.c index aeeed83de..0a903295c 100644 --- a/qw/source/world.c +++ b/qw/source/world.c @@ -105,7 +105,7 @@ SV_InitHull (hull_t *hull, dclipnode_t *clipnodes, mplane_t *planes) } } -void +static void SV_InitBoxHull (void) { SV_InitHull (&box_hull, box_clipnodes, box_planes); @@ -117,7 +117,7 @@ SV_InitBoxHull (void) To keep everything totally uniform, bounding boxes are turned into small BSP trees instead of being compared directly. */ -hull_t * +static hull_t * SV_HullForBox (const vec3_t mins, const vec3_t maxs) { box_planes[0].dist = maxs[0]; @@ -161,7 +161,6 @@ SV_HullForEntity (edict_t *ent, const vec3_t mins, const vec3_t maxs, // decide which clipping hull to use, based on the size if (sv_fields.rotated_bbox != -1 && SVinteger (ent, rotated_bbox)) { - extern clip_hull_t *pf_hull_list[]; int h = SVinteger (ent, rotated_bbox) - 1; hull = pf_hull_list[h]->hulls[hull_index]; } if (SVfloat (ent, solid) == SOLID_BSP) { @@ -197,7 +196,7 @@ SV_HullForEntity (edict_t *ent, const vec3_t mins, const vec3_t maxs, areanode_t sv_areanodes[AREA_NODES]; int sv_numareanodes; -areanode_t * +static areanode_t * SV_CreateAreaNode (int depth, const vec3_t mins, const vec3_t maxs) { areanode_t *anode; @@ -263,7 +262,7 @@ SV_UnlinkEdict (edict_t *ent) } -void +static void SV_TouchLinks (edict_t *ent, areanode_t *node) { edict_t *touch; @@ -310,7 +309,7 @@ SV_TouchLinks (edict_t *ent, areanode_t *node) } -void +static void SV_FindTouchedLeafs (edict_t *ent, mnode_t *node) { int leafnum, sides; @@ -592,7 +591,7 @@ SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, Handles selection or creation of a clipping hull, and offseting (and eventually rotation) of the end points */ -trace_t +static trace_t SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end) { @@ -633,7 +632,7 @@ SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, const vec3_t start, Mins and maxs enclose the entire area swept by the move */ -void +static void SV_ClipToLinks (areanode_t *node, moveclip_t * clip) { edict_t *touch; @@ -707,7 +706,7 @@ SV_ClipToLinks (areanode_t *node, moveclip_t * clip) SV_ClipToLinks (node->children[1], clip); } -void +static void SV_MoveBounds (const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, vec3_t boxmins, vec3_t boxmaxs) { diff --git a/tools/bsp2img/bsp2img.c b/tools/bsp2img/bsp2img.c index 482bdb111..61b6b84cd 100644 --- a/tools/bsp2img/bsp2img.c +++ b/tools/bsp2img/bsp2img.c @@ -95,8 +95,8 @@ typedef struct { long height; } image_t; -void -show_help () +static void +show_help (void) { printf ("BSP->bitmap, version %d.%d.%d\n\n", V_MAJOR, V_MINOR, V_REV); printf ("Usage:\n"); @@ -125,7 +125,7 @@ show_help () return; } -void +static void plotpoint (image_t * image, long xco, long yco, unsigned int color) { unsigned int bigcol = 0; @@ -147,7 +147,7 @@ plotpoint (image_t * image, long xco, long yco, unsigned int color) return; } -void +static void bresline (image_t * image, long x1, long y1, long x2, long y2, unsigned int color) { @@ -211,7 +211,7 @@ bresline (image_t * image, long x1, long y1, long x2, long y2, } } -void +static void def_options (struct options_t *opt) { static struct options_t locopt; @@ -240,7 +240,7 @@ def_options (struct options_t *opt) return; } -void +static void get_options (struct options_t *opt, int argc, char *argv[]) { static struct options_t locopt; @@ -386,7 +386,7 @@ get_options (struct options_t *opt, int argc, char *argv[]) return; } -void +static void show_options (struct options_t *opt) { char dirstr[80]; diff --git a/tools/carne/main.c b/tools/carne/main.c index a67c461c4..a8cf76422 100644 --- a/tools/carne/main.c +++ b/tools/carne/main.c @@ -24,7 +24,7 @@ extern gib_thread_t *gib_threads; static qboolean carne_done = false; static int carne_exitcode = 0; -void +static void Carne_GIB_Exit_f (void) { carne_done = true; @@ -35,7 +35,7 @@ Carne_GIB_Exit_f (void) carne_exitcode = atoi (GIB_Argv(1)); } -int +static int Carne_Execute_Script (const char *path, cbuf_args_t *args) { QFile *file; @@ -80,8 +80,8 @@ Carne_Execute_Script (const char *path, cbuf_args_t *args) return carne_exitcode; } -int -Carne_Execute_Stdin () +static int +Carne_Execute_Stdin (void) { char linebuf[1024]; cbuf_t *cbuf = Cbuf_New (&gib_interp); diff --git a/tools/qfbsp/include/bsp5.h b/tools/qfbsp/include/bsp5.h index 09cd38537..7b4e9ab39 100644 --- a/tools/qfbsp/include/bsp5.h +++ b/tools/qfbsp/include/bsp5.h @@ -250,7 +250,7 @@ qboolean FillOutside (node_t *node); extern brushset_t *brushset; -void qprintf (char *fmt, ...); // only prints if verbose +void qprintf (const char *fmt, ...) __attribute ((format (printf, 1, 2))); // only prints if verbose extern int valid; diff --git a/tools/qfbsp/include/map.h b/tools/qfbsp/include/map.h index be2a5a655..0bf622fbf 100644 --- a/tools/qfbsp/include/map.h +++ b/tools/qfbsp/include/map.h @@ -57,14 +57,14 @@ extern entity_t entities[MAX_MAP_ENTITIES]; extern int nummiptex; extern char miptex[MAX_MAP_TEXINFO][16]; -void LoadMapFile (char *filename); +void LoadMapFile (const char *filename); -int FindMiptex (char *name); +int FindMiptex (const char *name); void PrintEntity (entity_t *ent); -char *ValueForKey (entity_t *ent, char *key); -void SetKeyValue (entity_t *ent, char *key, char *value); -float FloatForKey (entity_t *ent, char *key); -void GetVectorForKey (entity_t *ent, char *key, vec3_t vec); +const char *ValueForKey (entity_t *ent, const char *key); +void SetKeyValue (entity_t *ent, const char *key, const char *value); +float FloatForKey (entity_t *ent, const char *key); +void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec); void WriteEntitiesToString (void); diff --git a/tools/qfbsp/include/options.h b/tools/qfbsp/include/options.h index 5abeadc75..50654fff5 100644 --- a/tools/qfbsp/include/options.h +++ b/tools/qfbsp/include/options.h @@ -46,7 +46,7 @@ typedef struct { char *portfile; char *pointfile; char *hullfile; - char *wadpath; + const char *wadpath; } options_t; extern options_t options; diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index 5efcf454b..898f7de5a 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -47,7 +47,7 @@ mface_t faces[128]; // beveled clipping hull can generate many extra Note: this will not catch 0 area polygons */ -void +static void CheckFace (face_t *f) { int i, j; @@ -101,7 +101,7 @@ CheckFace (face_t *f) } } -void +static void ClearBounds (brushset_t *bs) { int i, j; @@ -113,7 +113,7 @@ ClearBounds (brushset_t *bs) } } -void +static void AddToBounds (brushset_t *bs, vec3_t v) { int i; @@ -155,7 +155,7 @@ PlaneTypeForNormal (vec3_t normal) #define DISTEPSILON 0.01 #define ANGLEEPSILON 0.00001 -void +static void NormalizePlane (plane_t *dp) { vec_t ax, ay, az; @@ -244,91 +244,6 @@ FindPlane (plane_t *dplane, int *side) return numbrushplanes - 1; } -/* - FindPlane_old - - Returns a global plane number and the side that will be the front -*/ -int -FindPlane_old (plane_t *dplane, int *side) -{ - int i; - plane_t *dp; - vec_t dot, ax, ay, az; - - dot = VectorLength (dplane->normal); - if (dot < 1.0 - ANGLEEPSILON || dot > 1.0 + ANGLEEPSILON) - Sys_Error ("FindPlane: normalization error"); - - dp = planes; - - for (i = 0; i < numbrushplanes; i++, dp++) { - dot = DotProduct (dplane->normal, dp->normal); - if (dot > 1.0 - ANGLEEPSILON && fabs (dplane->dist - dp->dist) - < DISTEPSILON) { // regular match - *side = 0; - return i; - } - if (dot < -1.0 + ANGLEEPSILON && fabs (dplane->dist + dp->dist) - < DISTEPSILON) { // inverse of vector - *side = 1; - return i; - } - } - - // allocate a new plane, flipping normal to a consistant direction if - // needed - *dp = *dplane; - - if (numbrushplanes == MAX_MAP_PLANES) - Sys_Error ("numbrushplanes == MAX_MAP_PLANES"); - numbrushplanes++; - - *side = 0; - - // NOTE: should these have an epsilon around 1.0? - if (dplane->normal[0] == 1.0) - dp->type = PLANE_X; - else if (dplane->normal[1] == 1.0) - dp->type = PLANE_Y; - else if (dplane->normal[2] == 1.0) - dp->type = PLANE_Z; - else if (dplane->normal[0] == -1.0) { - dp->type = PLANE_X; - dp->normal[0] = 1.0; - dp->dist = -dp->dist; - *side = 1; - } else if (dplane->normal[1] == -1.0) { - dp->type = PLANE_Y; - dp->normal[1] = 1.0; - dp->dist = -dp->dist; - *side = 1; - } else if (dplane->normal[2] == -1.0) { - dp->type = PLANE_Z; - dp->normal[2] = 1.0; - dp->dist = -dp->dist; - *side = 1; - } else { - ax = fabs (dplane->normal[0]); - ay = fabs (dplane->normal[1]); - az = fabs (dplane->normal[2]); - - if (ax >= ay && ax >= az) - dp->type = PLANE_ANYX; - else if (ay >= ax && ay >= az) - dp->type = PLANE_ANYY; - else - dp->type = PLANE_ANYZ; - if (dplane->normal[dp->type - PLANE_ANYX] < 0) { - VectorSubtract (vec3_origin, dp->normal, dp->normal); - dp->dist = -dp->dist; - *side = 1; - } - } - - return i; -} - /* Turn brushes into groups of faces. */ @@ -337,7 +252,7 @@ vec3_t brush_mins, brush_maxs; face_t *brush_faces; #define ZERO_EPSILON 0.001 -void +static void CreateBrushFaces (void) { face_t *f; @@ -423,7 +338,7 @@ vec3_t hull_corners[MAX_HULL_POINTS * 8]; int num_hull_edges; int hull_edges[MAX_HULL_EDGES][2]; -void +static void AddBrushPlane (plane_t *plane) { float l; @@ -453,7 +368,7 @@ AddBrushPlane (plane_t *plane) Adds the given plane to the brush description if all of the original brush vertexes can be put on the front side */ -void +static void TestAddPlane (plane_t *plane) { int c, i; @@ -509,7 +424,7 @@ TestAddPlane (plane_t *plane) Doesn't add if duplicated */ -int +static int AddHullPoint (vec3_t p, int hullnum) { int i, x, y, z; @@ -545,7 +460,7 @@ AddHullPoint (vec3_t p, int hullnum) Creates all of the hull planes around the given edge, if not done already */ -void +static void AddHullEdge (vec3_t p1, vec3_t p2, int hullnum) { int pt1, pt2, a, b, c, d, e, i; @@ -593,7 +508,7 @@ AddHullEdge (vec3_t p1, vec3_t p2, int hullnum) } } -void +static void ExpandBrush (int hullnum) { face_t *f; @@ -646,7 +561,7 @@ ExpandBrush (int hullnum) Converts a mapbrush to a bsp brush */ -brush_t * +static brush_t * LoadBrush (mbrush_t *mb, int hullnum) { brush_t *b; @@ -711,7 +626,7 @@ LoadBrush (mbrush_t *mb, int hullnum) return b; } -void +static void Brush_DrawAll (brushset_t *bs) { brush_t *b; diff --git a/tools/qfbsp/source/csg4.c b/tools/qfbsp/source/csg4.c index 7caa1c023..b1dbe6ee6 100644 --- a/tools/qfbsp/source/csg4.c +++ b/tools/qfbsp/source/csg4.c @@ -45,13 +45,6 @@ int csgfaces; int csgmergefaces; -void -DrawList (face_t *list) -{ - for (; list; list = list->next) - Draw_DrawFace (list); -} - /* NewFaceFromFace @@ -183,7 +176,7 @@ SplitFace (face_t *in, plane_t *split, face_t **front, face_t **back) frontside is the side of the plane that holds the outside list */ -void +static void ClipInside (int splitplane, int frontside, qboolean precedence) { face_t *insidelist, *next, *f; @@ -227,7 +220,7 @@ ClipInside (int splitplane, int frontside, qboolean precedence) Saves all of the faces in the outside list to the bsp plane list */ -void +static void SaveOutside (qboolean mirror) { face_t *f, *next, *newf; @@ -268,7 +261,7 @@ SaveOutside (qboolean mirror) Free all the faces that got clipped out */ -void +static void FreeInside (int contents) { face_t *next, *f; @@ -320,7 +313,7 @@ BuildSurfaces (void) return surfhead; } -void +static void CopyFacesToOutside (brush_t *b) { face_t *newf, *f; diff --git a/tools/qfbsp/source/map.c b/tools/qfbsp/source/map.c index 08d562e68..f8f168f4f 100644 --- a/tools/qfbsp/source/map.c +++ b/tools/qfbsp/source/map.c @@ -48,7 +48,7 @@ char miptex[MAX_MAP_TEXINFO][16]; int -FindMiptex (char *name) +FindMiptex (const char *name) { int i; @@ -68,7 +68,7 @@ FindMiptex (char *name) Returns a global texinfo number */ -int +static int FindTexinfo (texinfo_t *t) { int i, j; @@ -108,7 +108,7 @@ qboolean unget; char *script_p; int scriptline; -void +static void StartTokenParsing (char *data) { scriptline = 1; @@ -116,7 +116,7 @@ StartTokenParsing (char *data) unget = false; } -qboolean +static qboolean GetToken (qboolean crossline) { char *token_p; @@ -176,15 +176,9 @@ GetToken (qboolean crossline) return true; } -void -UngetToken () -{ - unget = true; -} - entity_t *mapent; -void +static void ParseEpair (void) { epair_t *e; @@ -212,7 +206,7 @@ vec3_t baseaxis[18] = { {0, -1, 0}, {1, 0, 0}, {0, 0, -1} // north wall }; -void +static void TextureAxisFromPlane (plane_t *pln, vec3_t xv, vec3_t yv) { float dot, best; @@ -233,7 +227,7 @@ TextureAxisFromPlane (plane_t *pln, vec3_t xv, vec3_t yv) VectorCopy (baseaxis[bestaxis * 3 + 2], yv); } -void +static void ParseBrush (void) { float shift[2], rotate, scale[2]; @@ -392,7 +386,7 @@ ParseBrush (void) } while (1); } -qboolean +static qboolean ParseEntity (void) { if (!GetToken (true)) @@ -423,7 +417,7 @@ ParseEntity (void) } void -LoadMapFile (char *filename) +LoadMapFile (const char *filename) { char *buf; QFile *file; @@ -461,8 +455,8 @@ PrintEntity (entity_t *ent) } -char * -ValueForKey (entity_t *ent, char *key) +const char * +ValueForKey (entity_t *ent, const char *key) { epair_t *ep; @@ -473,7 +467,7 @@ ValueForKey (entity_t *ent, char *key) } void -SetKeyValue (entity_t *ent, char *key, char *value) +SetKeyValue (entity_t *ent, const char *key, const char *value) { epair_t *ep; @@ -491,18 +485,18 @@ SetKeyValue (entity_t *ent, char *key, char *value) } float -FloatForKey (entity_t *ent, char *key) +FloatForKey (entity_t *ent, const char *key) { - char *k; + const char *k; k = ValueForKey (ent, key); return atof (k); } void -GetVectorForKey (entity_t *ent, char *key, vec3_t vec) +GetVectorForKey (entity_t *ent, const char *key, vec3_t vec) { - char *k; + const char *k; double v1, v2, v3; k = ValueForKey (ent, key); diff --git a/tools/qfbsp/source/merge.c b/tools/qfbsp/source/merge.c index 341ccf3b6..26ee86ae9 100644 --- a/tools/qfbsp/source/merge.c +++ b/tools/qfbsp/source/merge.c @@ -31,29 +31,6 @@ static const char rcsid[] = #define CONTINUOUS_EPSILON 0.001 -void -CheckColinear (face_t *f) -{ - int i, j; - vec3_t v1, v2; - - for (i = 0; i < f->numpoints; i++) { - // skip the point if the vector from the previous point is the same as - // the vector to the next point - j = (i - 1 < 0) ? f->numpoints - 1 : i - 1; - VectorSubtract (f->pts[i], f->pts[j], v1); - _VectorNormalize (v1); - - j = (i + 1 == f->numpoints) ? 0 : i + 1; - VectorSubtract (f->pts[j], f->pts[i], v2); - _VectorNormalize (v2); - - if (_VectorCompare (v1, v2)) - Sys_Error ("Colinear edge"); - } - -} - /* TryMerge @@ -63,7 +40,7 @@ CheckColinear (face_t *f) Returns NULL if the faces couldn't be merged, or the new face. The originals will NOT be freed. */ -face_t * +static face_t * TryMerge (face_t *f1, face_t *f2) { face_t *newf; diff --git a/tools/qfbsp/source/outside.c b/tools/qfbsp/source/outside.c index f2a679cd8..3a7422561 100644 --- a/tools/qfbsp/source/outside.c +++ b/tools/qfbsp/source/outside.c @@ -30,7 +30,7 @@ static const char rcsid[] = int outleafs; -node_t * +static node_t * PointInLeaf (node_t *node, vec3_t point) { vec_t d; @@ -47,7 +47,7 @@ PointInLeaf (node_t *node, vec3_t point) return PointInLeaf (node->children[1], point); } -qboolean +static qboolean PlaceOccupant (int num, vec3_t point, node_t *headnode) { node_t *n; @@ -62,7 +62,7 @@ PlaceOccupant (int num, vec3_t point, node_t *headnode) portal_t *prevleaknode; FILE *leakfile; -void +static void MarkLeakTrail (portal_t *n2) { float len; @@ -112,7 +112,7 @@ int backdraw; If fill is false, just check, don't fill Returns true if an occupied leaf is reached */ -qboolean +static qboolean RecursiveFillOutside (node_t *l, qboolean fill) { portal_t *p; @@ -158,7 +158,7 @@ RecursiveFillOutside (node_t *l, qboolean fill) return res; } -void +static void ClearOutFaces (node_t *node) { face_t **fp; diff --git a/tools/qfbsp/source/portals.c b/tools/qfbsp/source/portals.c index 0b271a34c..e5f5ea95d 100644 --- a/tools/qfbsp/source/portals.c +++ b/tools/qfbsp/source/portals.c @@ -35,7 +35,7 @@ static const char rcsid[] = node_t outside_node; // portals outside the world face this -void +static void AddPortalToNodes (portal_t *p, node_t *front, node_t *back) { if (p->nodes[0] || p->nodes[1]) @@ -50,7 +50,7 @@ AddPortalToNodes (portal_t *p, node_t *front, node_t *back) back->portals = p; } -void +static void RemovePortalFromNode (portal_t *portal, node_t *l) { portal_t **pp, *t; @@ -82,24 +82,12 @@ RemovePortalFromNode (portal_t *portal, node_t *l) } } -void -PrintPortal (portal_t *p) -{ - int i; - winding_t *w; - - w = p->winding; - for (i = 0; i < w->numpoints; i++) - printf ("(%5.0f,%5.0f,%5.0f)\n", w->points[i][0] - , w->points[i][1], w->points[i][2]); -} - /* MakeHeadnodePortals The created portals will face the global outside_node */ -void +static void MakeHeadnodePortals (node_t *node) { int side, i, j, n; @@ -156,42 +144,8 @@ MakeHeadnodePortals (node_t *node) //============================================================================ -void -CheckWindingInNode (winding_t *w, node_t *node) -{ - int i, j; - for (i = 0; i < w->numpoints; i++) { - for (j = 0; j < 3; j++) - if (w->points[i][j] < node->mins[j] - 1 - || w->points[i][j] > node->maxs[j] + 1) { - printf ("WARNING: CheckWindingInNode: outside\n"); - return; - } - } -} - -void -CheckWindingArea (winding_t *w) -{ - float total, add; - int i; - vec3_t v1, v2, cross; - - total = 0; - for (i = 1; i < w->numpoints; i++) { - VectorSubtract (w->points[i], w->points[0], v1); - VectorSubtract (w->points[i + 1], w->points[0], v2); - CrossProduct (v1, v2, cross); - add = VectorLength (cross); - total += add * 0.5; - } - if (total < 16) - printf ("WARNING: winding area %f\n", total); -} - - -void +static void PlaneFromWinding (winding_t *w, plane_t *plane) { vec3_t v1, v2; @@ -204,51 +158,7 @@ PlaneFromWinding (winding_t *w, plane_t *plane) plane->dist = DotProduct (w->points[0], plane->normal); } -void -CheckLeafPortalConsistancy (node_t *node) -{ - float dist; - int side, side2, i; - plane_t plane, plane2; - portal_t *p, *p2; - winding_t *w; - - side = side2 = 0; // quiet compiler warning - - for (p = node->portals; p; p = p->next[side]) { - if (p->nodes[0] == node) - side = 0; - else if (p->nodes[1] == node) - side = 1; - else - Sys_Error ("CutNodePortals_r: mislinked portal"); - CheckWindingInNode (p->winding, node); - CheckWindingArea (p->winding); - - // check that the side orders are correct - plane = planes[p->planenum]; - PlaneFromWinding (p->winding, &plane2); - - for (p2 = node->portals; p2; p2 = p2->next[side2]) { - if (p2->nodes[0] == node) - side2 = 0; - else if (p2->nodes[1] == node) - side2 = 1; - else - Sys_Error ("CutNodePortals_r: mislinked portal"); - w = p2->winding; - for (i = 0; i < w->numpoints; i++) { - dist = DotProduct (w->points[i], plane.normal) - plane.dist; - if ((side == 0 && dist < -1) || (side == 1 && dist > 1)) { - printf ("WARNING: portal siding direction is wrong\n"); - return; - } - } - } - } -} - -void +static void CutNodePortals_r (node_t *node) { int side; @@ -397,7 +307,7 @@ FILE *pf; int num_visleafs; // leafs the player can be in int num_visportals; -void +static void WriteFloat (FILE *f, vec_t v) { if (fabs (v - RINT (v)) < 0.001) @@ -406,7 +316,7 @@ WriteFloat (FILE *f, vec_t v) fprintf (f, "%f ", v); } -void +static void WritePortalFile_r (node_t *node) { int i; @@ -458,7 +368,7 @@ WritePortalFile_r (node_t *node) } -void +static void NumberLeafs_r (node_t *node) { portal_t *p; diff --git a/tools/qfbsp/source/qfbsp.c b/tools/qfbsp/source/qfbsp.c index 4af1dc7f2..2fb8a389e 100644 --- a/tools/qfbsp/source/qfbsp.c +++ b/tools/qfbsp/source/qfbsp.c @@ -64,7 +64,7 @@ int hullnum; void -qprintf (char *fmt, ...) +qprintf (const char *fmt, ...) { va_list argptr; @@ -360,15 +360,6 @@ DivideWinding (winding_t *in, plane_t *split, winding_t **front, Sys_Error ("ClipWinding: points exceeded estimate"); } -void -PrintMemory (void) -{ - printf ("faces : %6i (%6i)\n", c_activefaces, c_peakfaces); - printf ("surfaces: %6i (%6i)\n", c_activesurfaces, c_peaksurfaces); - printf ("windings: %6i (%6i)\n", c_activewindings, c_peakwindings); - printf ("portals : %6i (%6i)\n", c_activeportals, c_peakportals); -} - winding_t * NewWinding (int points) { @@ -485,7 +476,7 @@ AllocBrush (void) return b; } -void +static void ProcessEntity (int entnum) { brushset_t *bs; @@ -582,7 +573,7 @@ ProcessEntity (int entnum) } } -void +static void UpdateEntLump (void) { int m, entnum; @@ -613,7 +604,7 @@ UpdateEntLump (void) Write the clipping hull out to a text file so the parent process can get it */ -void +static void WriteClipHull (void) { FILE *f; @@ -654,7 +645,7 @@ WriteClipHull (void) Read the files written out by the child processes */ -void +static void ReadClipHull (int hullnum) { FILE *f; @@ -711,7 +702,7 @@ ReadClipHull (int hullnum) } -void +static void CreateSingleHull (void) { int entnum; @@ -727,7 +718,7 @@ CreateSingleHull (void) WriteClipHull (); } -void +static void CreateHulls (void) { // commanded to create a single hull only @@ -793,8 +784,8 @@ CreateHulls (void) } -void -ProcessFile () +static void +ProcessFile (void) { // create filenames COM_StripExtension (options.bspfile, options.hullfile); @@ -840,8 +831,6 @@ ProcessFile () int main (int argc, char **argv) { - char sourcename[1024]; - char destname[1024]; double start, end; // let forked processes change name for ps status @@ -855,7 +844,7 @@ main (int argc, char **argv) // do it! start = Sys_DoubleTime (); - ProcessFile (sourcename, destname); + ProcessFile (); end = Sys_DoubleTime (); printf ("%5.1f seconds elapsed\n", end - start); diff --git a/tools/qfbsp/source/region.c b/tools/qfbsp/source/region.c index 887c0b1c6..526e6c2ca 100644 --- a/tools/qfbsp/source/region.c +++ b/tools/qfbsp/source/region.c @@ -54,7 +54,7 @@ int firstedge; vec3_t region_mins, region_maxs; -void +static void AddPointToRegion (vec3_t p) { int i; @@ -67,14 +67,7 @@ AddPointToRegion (vec3_t p) } } -void -ClearRegionSize (void) -{ - region_mins[0] = region_mins[1] = region_mins[2] = 9999; - region_maxs[0] = region_maxs[1] = region_maxs[2] = -9999; -} - -void +static void AddFaceToRegionSize (face_t *f) { int i; @@ -83,7 +76,7 @@ AddFaceToRegionSize (face_t *f) AddPointToRegion (f->pts[i]); } -qboolean +static qboolean CanJoinFaces (face_t *f, face_t *f2) { int i; @@ -121,7 +114,7 @@ CanJoinFaces (face_t *f, face_t *f2) return true; } -void +static void RecursiveGrowRegion (dface_t *r, face_t *f) { face_t *f2; @@ -163,144 +156,8 @@ RecursiveGrowRegion (dface_t *r, face_t *f) } -void -PrintDface (int f) -{ // for debugging - dedge_t *e; - dface_t *df; - int i, n; - - df = &bsp->faces[f]; - for (i = 0; i < df->numedges; i++) { - n = bsp->surfedges[df->firstedge + i]; - e = &bsp->edges[abs (n)]; - if (n < 0) - printf ("%5i = %5i : %5i\n", n, e->v[1], e->v[0]); - else - printf ("%5i = %5i : %5i\n", n, e->v[0], e->v[1]); - } -} - -void -FindVertexUse (int v) -{ // for debugging - dedge_t *e; - dface_t *df; - int i, j, n; - - for (i = firstmodelface; i < bsp->numfaces; i++) { - df = &bsp->faces[i]; - for (j = 0; j < df->numedges; j++) { - n = bsp->surfedges[df->firstedge + j]; - e = &bsp->edges[abs (n)]; - if (e->v[0] == v || e->v[1] == v) { - printf ("on face %i\n", i); - break; - } - } - } -} - -void -FindEdgeUse (int v) -{ // for debugging - dface_t *df; - int i, j, n; - - for (i = firstmodelface; i < bsp->numfaces; i++) { - df = &bsp->faces[i]; - for (j = 0; j < df->numedges; j++) { - n = bsp->surfedges[df->firstedge + j]; - if (n == v || -n == v) { - printf ("on face %i\n", i); - break; - } - } - } -} - int edgemapping[MAX_MAP_EDGES]; -/* - HealEdges - - Extends e1 so that it goes all the way to e2, and removes all references - to e2 -*/ -void -HealEdges (int e1, int e2) -{ - int saved, i, j, n; - int foundj[2]; - dedge_t *ed, *ed2; - dface_t *df; - dface_t *found[2]; - vec3_t v1, v2; - - return; - e1 = edgemapping[e1]; - e2 = edgemapping[e2]; - - // extend e1 to e2 - ed = &bsp->edges[e1]; - ed2 = &bsp->edges[e2]; - VectorSubtract (bsp->vertexes[ed->v[1]].point, - bsp->vertexes[ed->v[0]].point, v1); - _VectorNormalize (v1); - - if (ed->v[0] == ed2->v[0]) - ed->v[0] = ed2->v[1]; - else if (ed->v[0] == ed2->v[1]) - ed->v[0] = ed2->v[0]; - else if (ed->v[1] == ed2->v[0]) - ed->v[1] = ed2->v[1]; - else if (ed->v[1] == ed2->v[1]) - ed->v[1] = ed2->v[0]; - else - Sys_Error ("HealEdges: edges don't meet"); - - VectorSubtract (bsp->vertexes[ed->v[1]].point, - bsp->vertexes[ed->v[0]].point, v2); - _VectorNormalize (v2); - - if (!_VectorCompare (v1, v2)) - Sys_Error ("HealEdges: edges not colinear"); - - edgemapping[e2] = e1; - saved = 0; - - // remove all uses of e2 - for (i = firstmodelface; i < bsp->numfaces; i++) { - df = &bsp->faces[i]; - for (j = 0; j < df->numedges; j++) { - n = bsp->surfedges[df->firstedge + j]; - if (n == e2 || n == -e2) { - found[saved] = df; - foundj[saved] = j; - saved++; - break; - } - } - } - - if (saved != 2) - printf ("WARNING: didn't find both faces for a saved edge\n"); - else { - for (i = 0; i < 2; i++) { // remove this edge - df = found[i]; - j = foundj[i]; - for (j++; j < df->numedges; j++) - bsp->surfedges[df->firstedge + j - 1] = - bsp->surfedges[df->firstedge + j]; - bsp->surfedges[df->firstedge + j - 1] = 0; - df->numedges--; - } - - - edgefaces[e2][0] = edgefaces[e2][1] = NULL; - } -} - typedef struct { int numedges; int edges[2]; @@ -308,61 +165,7 @@ typedef struct { checkpoint_t checkpoints[MAX_MAP_VERTS]; -void -RemoveColinearEdges (void) -{ - checkpoint_t *cp; - int c0, c1, c2, c3, i, j, v; - - // no edges remapped yet - for (i = 0; i < bsp->numedges; i++) - edgemapping[i] = i; - - // find vertexes that only have two edges - memset (checkpoints, 0, sizeof (checkpoints)); - - for (i = firstmodeledge; i < bsp->numedges; i++) { - if (!edgefaces[i][0]) - continue; // removed - for (j = 0; j < 2; j++) { - v = bsp->edges[i].v[j]; - cp = &checkpoints[v]; - if (cp->numedges < 2) - cp->edges[cp->numedges] = i; - cp->numedges++; - } - } - - // if a vertex only has two edges and they are colinear, it can be removed - c0 = c1 = c2 = c3 = 0; - - for (i = 0; i < bsp->numvertexes; i++) { - cp = &checkpoints[i]; - switch (cp->numedges) { - case 0: - c0++; - break; - case 1: - c1++; - break; - case 2: - c2++; - HealEdges (cp->edges[0], cp->edges[1]); - break; - default: - c3++; - break; - } - } - -// qprintf ("%5i c0\n", c0); -// qprintf ("%5i c1\n", c1); -// qprintf ("%5i c2\n", c2); -// qprintf ("%5i c3+\n", c3); - qprintf ("%5i deges removed by tjunction healing\n", c2); -} - -void +static void CountRealNumbers (void) { int c, i; @@ -382,7 +185,7 @@ CountRealNumbers (void) qprintf ("%5i real edges\n", c); } -void +static void GrowNodeRegion_r (node_t * node) { dface_t r; diff --git a/tools/qfbsp/source/solidbsp.c b/tools/qfbsp/source/solidbsp.c index 9a5aa9a6a..b15e5f3ba 100644 --- a/tools/qfbsp/source/solidbsp.c +++ b/tools/qfbsp/source/solidbsp.c @@ -43,7 +43,7 @@ qboolean usemidsplit; For BSP hueristic */ -int +static int FaceSide (face_t *in, plane_t *split) { int frontcount, backcount, i; @@ -94,7 +94,7 @@ FaceSide (face_t *in, plane_t *split) The clipping hull BSP doesn't worry about avoiding splits */ -surface_t * +static surface_t * ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs) { int j, l; @@ -152,7 +152,7 @@ ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs) The real BSP hueristic */ -surface_t * +static surface_t * ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs, qboolean usefloors) { @@ -237,7 +237,7 @@ ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs, Selects a surface from a linked list of surfaces to split the group on returns NULL if the surface list can not be divided any more (a leaf) */ -surface_t * +static surface_t * SelectPartition (surface_t *surfaces) { int i, j; @@ -320,7 +320,7 @@ CalcSurfaceInfo (surface_t * surf) } } -void +static void DividePlane (surface_t *in, plane_t *split, surface_t **front, surface_t **back) { @@ -422,7 +422,7 @@ DividePlane (surface_t *in, plane_t *split, surface_t **front, CalcSurfaceInfo (in); } -void +static void DivideNodeBounds (node_t *node, plane_t *split) { VectorCopy (node->mins, node->children[0]->mins); @@ -444,7 +444,7 @@ DivideNodeBounds (node_t *node, plane_t *split) Determines the contents of the leaf and creates the final list of original faces that have some fragment inside this leaf */ -void +static void LinkConvexFaces (surface_t *planelist, node_t *leafnode) { face_t *f, *next; @@ -508,7 +508,7 @@ LinkConvexFaces (surface_t *planelist, node_t *leafnode) Returns a duplicated list of all faces on surface */ -face_t * +static face_t * LinkNodeFaces (surface_t *surface) { face_t *list, *new, **prevptr, *f; @@ -539,7 +539,7 @@ LinkNodeFaces (surface_t *surface) return list; } -void +static void PartitionSurfaces (surface_t *surfaces, node_t *node) { surface_t *split, *p, *next; @@ -597,25 +597,6 @@ PartitionSurfaces (surface_t *surfaces, node_t *node) PartitionSurfaces (backlist, node->children[1]); } -void -DrawSurface (surface_t *surf) -{ - face_t *f; - - for (f = surf->faces; f; f = f->next) - Draw_DrawFace (f); -} - -void -DrawSurfaceList (surface_t *surf) -{ - Draw_ClearWindow (); - while (surf) { - DrawSurface (surf); - surf = surf->next; - } -} - node_t * SolidBSP (surface_t *surfhead, qboolean midsplit) { diff --git a/tools/qfbsp/source/surfaces.c b/tools/qfbsp/source/surfaces.c index b786a74e6..8ee1e3790 100644 --- a/tools/qfbsp/source/surfaces.c +++ b/tools/qfbsp/source/surfaces.c @@ -133,7 +133,7 @@ SubdivideFaces (surface_t *surfhead) Frees the current node tree and returns a new chain of the surfaces that have inside faces. */ -void +static void GatherNodeFaces_r (node_t *node) { face_t *next, *f; @@ -239,7 +239,7 @@ HashVec (vec3_t vec) return h; } -int +static int GetVertex (vec3_t in, int planenum) { hashvert_t *hv; @@ -309,7 +309,7 @@ int c_tryedges; Don't allow four way edges */ -int +static int GetEdge (vec3_t p1, vec3_t p2, face_t *f) { dedge_t edge; @@ -341,7 +341,7 @@ GetEdge (vec3_t p1, vec3_t p2, face_t *f) return i; } -void +static void FindFaceEdges (face_t *face) { int i; @@ -355,79 +355,7 @@ FindFaceEdges (face_t *face) (face->pts[i], face->pts[(i + 1) % face->numpoints], face); } -void -CheckVertexes (void) -{ - hashvert_t *hv; - int cb, c0, c1, c2, c3; - - cb = c0 = c1 = c2 = c3 = 0; - for (hv = hvertex; hv != hvert_p; hv++) { - if (hv->numedges < 0 || hv->numedges & 1) - cb++; - else if (!hv->numedges) - c0++; - else if (hv->numedges == 2) - c1++; - else if (hv->numedges == 4) - c2++; - else - c3++; - } - - qprintf ("%5i bad edge points\n", cb); - qprintf ("%5i 0 edge points\n", c0); - qprintf ("%5i 2 edge points\n", c1); - qprintf ("%5i 4 edge points\n", c2); - qprintf ("%5i 6+ edge points\n", c3); -} - -void -CheckEdges (void) -{ - dedge_t *edge; - dvertex_t *d1, *d2; - face_t *f1, *f2; - int c_multitexture, c_nonconvex, i; - - c_nonconvex = c_multitexture = 0; - -// CheckVertexes (); - - for (i = 1; i < bsp->numedges; i++) { - edge = &bsp->edges[i]; - if (!edgefaces[i][1]) { - d1 = &bsp->vertexes[edge->v[0]]; - d2 = &bsp->vertexes[edge->v[1]]; - qprintf ("unshared edge at: (%8.2f, %8.2f, %8.2f) (%8.2f, %8.2f, " - "%8.2f)\n", d1->point[0], d1->point[1], d1->point[2], - d2->point[0], d2->point[1], d2->point[2]); - } else { - f1 = edgefaces[i][0]; - f2 = edgefaces[i][1]; - if (f1->planeside != f2->planeside) - continue; - if (f1->planenum != f2->planenum) - continue; - - // on the same plane, might be discardable - if (f1->texturenum == f2->texturenum) { - hvertex[edge->v[0]].numedges -= 2; - hvertex[edge->v[1]].numedges -= 2; - c_nonconvex++; - } else - c_multitexture++; - } - } - -// qprintf ("%5i edges\n", i); -// qprintf ("%5i c_nonconvex\n", c_nonconvex); -// qprintf ("%5i c_multitexture\n", c_multitexture); - -// CheckVertexes (); -} - -void +static void MakeFaceEdges_r (node_t *node) { face_t *f; diff --git a/tools/qfbsp/source/tjunc.c b/tools/qfbsp/source/tjunc.c index 71926d91c..ae0af5e44 100644 --- a/tools/qfbsp/source/tjunc.c +++ b/tools/qfbsp/source/tjunc.c @@ -54,17 +54,6 @@ int tjuncfaces; wvert_t wverts[MAXWVERTS]; wedge_t wedges[MAXWEDGES]; - -void -PrintFace (face_t *f) -{ - int i; - - for (i = 0; i < f->numpoints; i++) - printf ("(%5.2f, %5.2f, %5.2f)\n", f->pts[i][0], f->pts[i][1], - f->pts[i][2]); -} - #define NUM_HASH 1024 wedge_t *wedge_hash[NUM_HASH]; @@ -107,7 +96,7 @@ HashVec (vec3_t vec) return h; } -void +static void CanonicalVector (vec3_t vec) { _VectorNormalize (vec); @@ -137,7 +126,7 @@ CanonicalVector (vec3_t vec) Sys_Error ("CanonicalVector: degenerate"); } -wedge_t * +static wedge_t * FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) { int h; @@ -202,7 +191,7 @@ FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) #define T_EPSILON 0.01 -void +static void AddVert (wedge_t *w, vec_t t) { wvert_t *v, *newv; @@ -230,7 +219,7 @@ AddVert (wedge_t *w, vec_t t) v->prev = newv; } -void +static void AddEdge (vec3_t p1, vec3_t p2) { wedge_t *w; @@ -241,7 +230,7 @@ AddEdge (vec3_t p1, vec3_t p2) AddVert (w, t2); } -void +static void AddFaceEdges (face_t *f) { int i, j; @@ -260,7 +249,7 @@ void FixFaceEdges (face_t * f); face_t *newlist; -void +static void SplitFaceForTjunc (face_t *f, face_t *original) { face_t *new, *chain; @@ -388,7 +377,7 @@ FixFaceEdges (face_t *f) //============================================================================ -void +static void tjunc_find_r (node_t *node) { face_t *f; @@ -403,7 +392,7 @@ tjunc_find_r (node_t *node) tjunc_find_r (node->children[1]); } -void +static void tjunc_fix_r (node_t *node) { face_t *next, *f; diff --git a/tools/qfbsp/source/writebsp.c b/tools/qfbsp/source/writebsp.c index 654fea4b4..21f9a4d8f 100644 --- a/tools/qfbsp/source/writebsp.c +++ b/tools/qfbsp/source/writebsp.c @@ -79,7 +79,7 @@ FindFinalPlane (dplane_t *p) int planemapping[MAX_MAP_PLANES]; -void +static void WriteNodePlanes_r (node_t *node) { dplane_t dplane; @@ -113,7 +113,7 @@ WriteNodePlanes (node_t *nodes) WriteNodePlanes_r (nodes); } -int +static int WriteClipNodes_r (node_t *node) { dclipnode_t cn; @@ -149,7 +149,7 @@ WriteClipNodes (node_t *nodes) WriteClipNodes_r (nodes); } -void +static void WriteLeaf (node_t *node) { dleaf_t leaf_p; @@ -182,7 +182,7 @@ WriteLeaf (node_t *node) BSP_AddLeaf (bsp, &leaf_p); } -void +static void WriteDrawNodes_r (node_t *node) { static dnode_t dummy; @@ -296,7 +296,7 @@ typedef struct wadlist_s { QFile *texfile; wadlist_t *wadlist; -void +static void CleanupName (char *in, char *out) { int i; @@ -312,7 +312,7 @@ CleanupName (char *in, char *out) out[i] = 0; } -int +static int TEX_InitFromWad (char *path) { int i; @@ -348,7 +348,7 @@ TEX_InitFromWad (char *path) return 0; } -int +static int LoadLump (char *name, dstring_t *dest) { char cname[16]; @@ -374,7 +374,7 @@ LoadLump (char *name, dstring_t *dest) return 0; } -void +static void AddAnimatingTextures (void) { int base, i, j, k; @@ -409,7 +409,7 @@ AddAnimatingTextures (void) printf ("added %i texture frames\n", nummiptex - base); } -void +static void WriteMiptex (void) { dstring_t *data; @@ -419,9 +419,9 @@ WriteMiptex (void) dmiptexlump_t *l; int i, len, res = -1; - wad_list = ValueForKey (&entities[0], "_wad"); + (const char *)wad_list = ValueForKey (&entities[0], "_wad"); if (!wad_list || !wad_list[0]) { - wad_list = ValueForKey (&entities[0], "wad"); + (const char *)wad_list = ValueForKey (&entities[0], "wad"); if (!wad_list || !wad_list[0]) { printf ("WARNING: no wadfile specified\n"); bsp->texdatasize = 0; diff --git a/tools/qfcc/include/cpp.h b/tools/qfcc/include/cpp.h index d285ec7eb..6246cc50f 100644 --- a/tools/qfcc/include/cpp.h +++ b/tools/qfcc/include/cpp.h @@ -32,7 +32,7 @@ #ifndef __cpp_h #define __cpp_h -void parse_cpp_name (); +void parse_cpp_name (void); void add_cpp_def (const char *arg); FILE * preprocess_file (const char *filename); extern const char *cpp_name; diff --git a/tools/qfcc/include/def.h b/tools/qfcc/include/def.h index f2d50079d..643c5e815 100644 --- a/tools/qfcc/include/def.h +++ b/tools/qfcc/include/def.h @@ -119,8 +119,8 @@ def_t *new_def (struct type_s *type, const char *name, scope_t *scope); int new_location (struct type_s *type, defspace_t *space); void free_location (def_t *def); def_t *get_tempdef (struct type_s *type, scope_t *scope); -void free_tempdefs (); -void reset_tempdefs (); +void free_tempdefs (void); +void reset_tempdefs (void); void flush_scope (scope_t *scope, int force_used); void def_initialized (def_t *d); diff --git a/tools/qfcc/include/idstuff.h b/tools/qfcc/include/idstuff.h index 1ec63b3ae..94e89e937 100644 --- a/tools/qfcc/include/idstuff.h +++ b/tools/qfcc/include/idstuff.h @@ -39,6 +39,6 @@ void PrecacheSound (struct def_s *e, int ch); void PrecacheModel (struct def_s *e, int ch); void PrecacheFile (struct def_s *e, int ch); int WriteFiles (const char *sourcedir); -int WriteProgdefs (char *filename); +int WriteProgdefs (const char *filename); #endif//__idstuff_h diff --git a/tools/qfcc/source/cpp.c b/tools/qfcc/source/cpp.c index 4e438e202..0e1b52045 100644 --- a/tools/qfcc/source/cpp.c +++ b/tools/qfcc/source/cpp.c @@ -94,7 +94,7 @@ add_cpp_def (const char *arg) } void -parse_cpp_name () +parse_cpp_name (void) { char *n; @@ -154,7 +154,7 @@ preprocess_file (const char *filename) pid_t pid; int tempfd = 0; #endif - char *temp1; + const char *temp1; char *temp2 = strrchr (this_program, PATH_SEPARATOR); if (cpp_name) { diff --git a/tools/qfcc/source/emit.c b/tools/qfcc/source/emit.c index 3f8d6377c..6667ba740 100644 --- a/tools/qfcc/source/emit.c +++ b/tools/qfcc/source/emit.c @@ -95,7 +95,7 @@ codespace_newstatement (codespace_t *codespace) return codespace->code + codespace->size++; } -void +static void add_statement_ref (def_t *def, dstatement_t *st, reloc_type type) { if (def) { @@ -167,7 +167,7 @@ emit_statement (expr_t *e, opcode_t *op, def_t *var_a, def_t *var_b, return var_c; } -void +static void emit_branch (expr_t *_e, opcode_t *op, expr_t *e, expr_t *l) { dstatement_t *st; @@ -192,7 +192,7 @@ emit_branch (expr_t *_e, opcode_t *op, expr_t *e, expr_t *l) } } -def_t * +static def_t * emit_function_call (expr_t *e, def_t *dest) { def_t *func = emit_sub_expr (e->e.expr.e1, 0); @@ -236,7 +236,7 @@ emit_function_call (expr_t *e, def_t *dest) } } -def_t * +static def_t * emit_assign_expr (int oper, expr_t *e) { def_t *def_a, *def_b, *def_c; @@ -295,7 +295,7 @@ emit_assign_expr (int oper, expr_t *e) } } -def_t * +static def_t * emit_bind_expr (expr_t *e1, expr_t *e2) { type_t *t1 = get_type (e1); @@ -319,7 +319,7 @@ emit_bind_expr (expr_t *e1, expr_t *e2) return e2->e.temp.def; } -def_t * +static def_t * emit_move_expr (expr_t *e) { expr_t *e1 = e->e.expr.e1; @@ -351,7 +351,7 @@ emit_move_expr (expr_t *e) return emit_statement (e, op, src, size, dst); } -def_t * +static def_t * emit_address_expr (expr_t *e) { def_t *def_a, *def_b, *d; @@ -364,7 +364,7 @@ emit_address_expr (expr_t *e) return d; } -def_t * +static def_t * emit_deref_expr (expr_t *e, def_t *dest) { def_t *d; diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 41d747e11..391fa1193 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -247,7 +247,7 @@ error (expr_t *e, const char *fmt, ...) return e; } -void +static void _warning (expr_t *e, const char *fmt, va_list args) { string_t file = pr.source_file; @@ -349,7 +349,7 @@ get_op_string (int op) } } -expr_t * +static expr_t * type_mismatch (expr_t *e1, expr_t *e2, int op) { etype_t t1, t2; @@ -361,7 +361,7 @@ type_mismatch (expr_t *e1, expr_t *e2, int op) pr_type_name[t1], get_op_string (op), pr_type_name[t2]); } -void +static void check_initialized (expr_t *e) { if (options.warnings.uninited_variable) { @@ -409,7 +409,7 @@ new_label_name (void) return lname; } -expr_t * +static expr_t * new_error_expr (void) { expr_t *e = new_expr (); @@ -1368,7 +1368,7 @@ convert_int (expr_t *e) e->e.float_val = e->e.integer_val; } -void +static void convert_nil (expr_t *e, type_t *t) { e->type = expr_types[t->type]; @@ -1746,7 +1746,7 @@ bitnot_expr: abort (); } -int +static int has_function_call (expr_t *e) { switch (e->type) { diff --git a/tools/qfcc/source/idstuff.c b/tools/qfcc/source/idstuff.c index 966f0071f..5a9576573 100644 --- a/tools/qfcc/source/idstuff.c +++ b/tools/qfcc/source/idstuff.c @@ -47,6 +47,7 @@ static const char rcsid[] = #include "def.h" #include "qfcc.h" #include "expr.h" +#include "idstuff.h" #include "options.h" #include "strpool.h" #include "type.h" @@ -206,7 +207,7 @@ WriteFiles (const char *sourcedir) at load time. */ int -WriteProgdefs (char *filename) +WriteProgdefs (const char *filename) { def_t *d; FILE *f; diff --git a/tools/qfcc/source/linker.c b/tools/qfcc/source/linker.c index 9307d53fd..f37bc71ef 100644 --- a/tools/qfcc/source/linker.c +++ b/tools/qfcc/source/linker.c @@ -402,7 +402,7 @@ add_lines (qfo_t *qfo) } static void -fixup_relocs () +fixup_relocs (void) { qfo_reloc_t *reloc; qfo_def_t *def, *field_def; @@ -606,7 +606,7 @@ linker_begin (void) pr.strings = strings; } -void +static void linker_add_qfo (qfo_t *qfo) { code_base = code->size; diff --git a/tools/qfcc/source/obj_file.c b/tools/qfcc/source/obj_file.c index abd6b0734..1459cb2f2 100644 --- a/tools/qfcc/source/obj_file.c +++ b/tools/qfcc/source/obj_file.c @@ -478,7 +478,7 @@ qfo_open (const char *filename) return qfo; } -defspace_t * +static defspace_t * init_space (int size, pr_type_t *data) { defspace_t *space = new_defspace (); diff --git a/tools/qfcc/source/qc-lex.l b/tools/qfcc/source/qc-lex.l index 8bf33a047..be8381314 100644 --- a/tools/qfcc/source/qc-lex.l +++ b/tools/qfcc/source/qc-lex.l @@ -57,6 +57,8 @@ static const char rcsid[] = #include "qc-parse.h" #define YY_NO_UNPUT +#define YY_DECL int yylex YY_PROTO(( void )) +YY_DECL; int type_or_name (char *token); diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index dc25f4ee0..9caa03e09 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -65,13 +65,13 @@ static const char rcsid[] = extern char *yytext; -void +static void yyerror (const char *s) { error (0, "%s %s\n", yytext, s); } -void +static void parse_error (void) { error (0, "parse error before %s", yytext); diff --git a/tools/qfcc/source/qfcc.c b/tools/qfcc/source/qfcc.c index 981474e18..feaeeab97 100644 --- a/tools/qfcc/source/qfcc.c +++ b/tools/qfcc/source/qfcc.c @@ -124,7 +124,7 @@ save_string (const char *str) return s; } -void +static void InitData (void) { int i; @@ -157,7 +157,7 @@ InitData (void) } -int +static int WriteData (int crc) { def_t *def; @@ -330,7 +330,7 @@ WriteData (int crc) } -void +static void begin_compilation (void) { pr.near_data->size = RESERVED_OFS; @@ -339,7 +339,7 @@ begin_compilation (void) pr.error_count = 0; } -qboolean +static qboolean finish_compilation (void) { def_t *d; diff --git a/tools/qfcc/source/qfodump.c b/tools/qfcc/source/qfodump.c index 33201ef84..52a3edd88 100644 --- a/tools/qfcc/source/qfodump.c +++ b/tools/qfcc/source/qfodump.c @@ -47,9 +47,11 @@ static const char rcsid[] = #include "QF/quakeio.h" #include "class.h" +#include "debug.h" #include "def.h" #include "emit.h" #include "function.h" +#include "immediate.h" #include "obj_file.h" #include "options.h" #include "qfcc.h" @@ -74,7 +76,7 @@ static const struct option long_options[] = { {NULL, 0, NULL, 0}, }; -void +static void dump_defs (qfo_t *qfo) { qfo_def_t *def; @@ -113,7 +115,7 @@ dump_defs (qfo_t *qfo) } } -void +static void dump_funcs (qfo_t *qfo) { qfo_func_t *func; @@ -144,7 +146,7 @@ const char *reloc_names[] = { "def_field", }; -void +static void dump_relocs (qfo_t *qfo) { qfo_reloc_t *reloc; @@ -157,7 +159,7 @@ dump_relocs (qfo_t *qfo) } } -void +static void dump_lines (qfo_t *qfo) { pr_lineno_t *line; diff --git a/tools/qfcc/source/type.c b/tools/qfcc/source/type.c index 5c95e2715..8544bc60b 100644 --- a/tools/qfcc/source/type.c +++ b/tools/qfcc/source/type.c @@ -284,7 +284,7 @@ print_type (type_t *type) } } -void +static void _encode_type (dstring_t *encoding, type_t *type, int level) { struct_field_t *field; diff --git a/tools/qfdefs/source/fix_globals.c b/tools/qfdefs/source/fix_globals.c index 14da7bb09..1c3f4c4d4 100644 --- a/tools/qfdefs/source/fix_globals.c +++ b/tools/qfdefs/source/fix_globals.c @@ -40,7 +40,7 @@ static const char rcsid[] = #include "def.h" -void +static void update_offsets (dprograms_t *pr, int mark, int count) { if (pr->ofs_statements > mark) diff --git a/tools/qfdefs/source/gendefs.c b/tools/qfdefs/source/gendefs.c index 961015149..1ba804ddd 100644 --- a/tools/qfdefs/source/gendefs.c +++ b/tools/qfdefs/source/gendefs.c @@ -37,7 +37,7 @@ static const char rcsid[] = int offset; -void +static void output_def (FILE *out, const char *line) { const char *type, *type_e; diff --git a/tools/qfdefs/source/qfdefs.c b/tools/qfdefs/source/qfdefs.c index 7e298bac9..2e01a8a8f 100644 --- a/tools/qfdefs/source/qfdefs.c +++ b/tools/qfdefs/source/qfdefs.c @@ -120,7 +120,7 @@ init_qf (void) pr.free_progs_mem = free_progs_mem; } -int +static int load_progs (const char *name) { QFile *file; diff --git a/tools/qflight/include/entities.h b/tools/qflight/include/entities.h index 3b5d9a72f..ac9f59c08 100644 --- a/tools/qflight/include/entities.h +++ b/tools/qflight/include/entities.h @@ -53,10 +53,10 @@ typedef struct entity_s { extern entity_t entities[MAX_MAP_ENTITIES]; extern int num_entities; -char *ValueForKey (entity_t *ent, char *key); -void SetKeyValue (entity_t *ent, char *key, char *value); -float FloatForKey (entity_t *ent, char *key); -void GetVectorForKey (entity_t *ent, char *key, vec3_t vec); +const char *ValueForKey (entity_t *ent, const char *key); +void SetKeyValue (entity_t *ent, const char *key, const char *value); +float FloatForKey (entity_t *ent, const char *key); +void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec); void LoadEntities (void); void WriteEntitiesToString (void); diff --git a/tools/qflight/source/entities.c b/tools/qflight/source/entities.c index 1d772c093..977b50afe 100644 --- a/tools/qflight/source/entities.c +++ b/tools/qflight/source/entities.c @@ -72,7 +72,7 @@ int numlighttargets; char lighttargets[32][64]; -int +static int LightStyleForTargetname (char *targetname, qboolean alloc) { int i; @@ -89,7 +89,7 @@ LightStyleForTargetname (char *targetname, qboolean alloc) return numlighttargets - 1 + 32; } -void +static void MatchTargets (void) { int i, j; @@ -226,8 +226,8 @@ LoadEntities (void) MatchTargets (); } -char * -ValueForKey (entity_t *ent, char *key) +const char * +ValueForKey (entity_t *ent, const char *key) { epair_t *ep; @@ -238,7 +238,7 @@ ValueForKey (entity_t *ent, char *key) } void -SetKeyValue (entity_t *ent, char *key, char *value) +SetKeyValue (entity_t *ent, const char *key, const char *value) { epair_t *ep; @@ -255,18 +255,18 @@ SetKeyValue (entity_t *ent, char *key, char *value) } float -FloatForKey (entity_t *ent, char *key) +FloatForKey (entity_t *ent, const char *key) { - char *k; + const char*k; k = ValueForKey (ent, key); return atof (k); } void -GetVectorForKey (entity_t *ent, char *key, vec3_t vec) +GetVectorForKey (entity_t *ent, const char *key, vec3_t vec) { - char *k; + const char *k; k = ValueForKey (ent, key); sscanf (k, "%f %f %f", &vec[0], &vec[1], &vec[2]); diff --git a/tools/qflight/source/ltface.c b/tools/qflight/source/ltface.c index 0a3084b7e..90b372b5c 100644 --- a/tools/qflight/source/ltface.c +++ b/tools/qflight/source/ltface.c @@ -89,7 +89,7 @@ int c_culldistplane, c_proper; Returns the distance between the points, or -1 if blocked */ -vec_t +static vec_t CastRay (vec3_t p1, vec3_t p2) { int i; @@ -133,7 +133,7 @@ towards the center until it is valid. Fills in texorg, worldtotex. and textoworld */ -void +static void CalcFaceVectors (lightinfo_t *l) { texinfo_t *tex; @@ -198,7 +198,7 @@ CalcFaceVectors (lightinfo_t *l) Fills in s->texmins[] and s->texsize[] also sets exactmins[] and exactmaxs[] */ -void +static void CalcFaceExtents (lightinfo_t *l) { dface_t *s; @@ -252,7 +252,7 @@ CalcFaceExtents (lightinfo_t *l) For each texture aligned grid point, back project onto the plane to get the world xyz value of the sample point */ -void +static void CalcPoints (lightinfo_t *l) { int step, i, j , s, t, w, h; @@ -337,7 +337,7 @@ CalcPoints (lightinfo_t *l) } } -void +static void SingleLightFace (entity_t *light, lightinfo_t *l) { int mapnum, size, c, i; @@ -420,7 +420,7 @@ SingleLightFace (entity_t *light, lightinfo_t *l) } } -void +static void FixMinlight (lightinfo_t *l) { float minlight; diff --git a/tools/qflight/source/qflight.c b/tools/qflight/source/qflight.c index ac8763cca..195b6e657 100644 --- a/tools/qflight/source/qflight.c +++ b/tools/qflight/source/qflight.c @@ -92,7 +92,7 @@ GetFileSpace (int size) return ofs; } -void * +static void * LightThread (void *junk) { int i; @@ -108,7 +108,7 @@ LightThread (void *junk) } } -void +static void LightWorld (void) { lightdata = dstring_new (); diff --git a/tools/qflight/source/trace.c b/tools/qflight/source/trace.c index 98f240302..02418a118 100644 --- a/tools/qflight/source/trace.c +++ b/tools/qflight/source/trace.c @@ -82,7 +82,7 @@ by recursive subdivision of the line by the BSP tree. Converts the disk node structure into the efficient tracing structure */ -void +static void MakeTnode (int nodenum) { dnode_t *node; diff --git a/tools/qfmodelgen/include/cmdlib.h b/tools/qfmodelgen/include/cmdlib.h index 6e997a9c0..528c43705 100644 --- a/tools/qfmodelgen/include/cmdlib.h +++ b/tools/qfmodelgen/include/cmdlib.h @@ -43,8 +43,8 @@ extern char **myargv; char *strupr (char *in); char *strlower (char *in); -int Q_strncasecmp (char *s1, char *s2, int n); -int Q_strcasecmp (char *s1, char *s2); +int Q_strncasecmp (const char *s1, const char *s2, int n); +int Q_strcasecmp (const char *s1, const char *s2); void Q_getwd (char *out); int FileTime (char *path); @@ -54,24 +54,24 @@ void Q_mkdir (char *path); extern char qdir[1024]; extern char gamedir[1024]; void SetQdirFromPath (char *path); -char *ExpandPath (char *path); -char *ExpandPathAndArchive (char *path); +const char *ExpandPath (const char *path); +const char *ExpandPathAndArchive (const char *path); double I_FloatTime (void); -void Error (char *error, ...); -int CheckParm (char *check); +void Error (const char *error, ...); +int CheckParm (const char *check); -QFile *SafeOpenWrite (char *filename); -QFile *SafeOpenRead (char *filename); +QFile *SafeOpenWrite (const char *filename); +QFile *SafeOpenRead (const char *filename); void SafeRead (QFile *f, void *buffer, int count); void SafeWrite (QFile *f, void *buffer, int count); -int LoadFile (char *filename, void **bufferptr); -void SaveFile (char *filename, void *buffer, int count); +int LoadFile (const char *filename, void **bufferptr); +void SaveFile (const char *filename, void *buffer, int count); -void DefaultExtension (char *path, char *extension); +void DefaultExtension (char *path, const char *extension); void DefaultPath (char *path, char *basepath); void StripFilename (char *path); void StripExtension (char *path); @@ -88,15 +88,15 @@ char *COM_Parse (char *data); extern char com_token[1024]; extern qboolean com_eof; -char *copystring(char *s); +char *copystring(const char *s); void CRC_Init(unsigned short *crcvalue); void CRC_ProcessByte(unsigned short *crcvalue, byte data); unsigned short CRC_Value(unsigned short crcvalue); -void CreatePath (char *path); -void CopyFile (char *from, char *to); +void CreatePath (const char *path); +void CopyFile (const char *from, const char *to); extern qboolean archive; extern char archivedir[1024]; diff --git a/tools/qfmodelgen/source/cmdlib.c b/tools/qfmodelgen/source/cmdlib.c index c0fdfcad8..2b9fe2647 100644 --- a/tools/qfmodelgen/source/cmdlib.c +++ b/tools/qfmodelgen/source/cmdlib.c @@ -56,7 +56,7 @@ For abnormal program terminations ================= */ void -Error (char *error, ...) +Error (const char *error, ...) { va_list argptr; @@ -115,8 +115,8 @@ SetQdirFromPath (char *path) Error ("SetQdirFromPath: no 'quake' in %s", path); } -char * -ExpandPath (char *path) +const char * +ExpandPath (const char *path) { static char full[1024]; @@ -128,10 +128,10 @@ ExpandPath (char *path) return full; } -char * -ExpandPathAndArchive (char *path) +const char * +ExpandPathAndArchive (const char *path) { - char *expanded; + const char *expanded; char archivename[1024]; expanded = ExpandPath (path); @@ -144,7 +144,7 @@ ExpandPathAndArchive (char *path) } char * -copystring(char *s) +copystring(const char *s) { char *b; @@ -222,7 +222,7 @@ FileTime (char *path) } int -Q_strncasecmp (char *s1, char *s2, int n) +Q_strncasecmp (const char *s1, const char *s2, int n) { int c1, c2; @@ -249,7 +249,7 @@ Q_strncasecmp (char *s1, char *s2, int n) } int -Q_strcasecmp (char *s1, char *s2) +Q_strcasecmp (const char *s1, const char *s2) { return Q_strncasecmp (s1, s2, 99999); } @@ -297,7 +297,7 @@ Returns the argument number (1 to argc-1) or 0 if not present ================= */ int -CheckParm (char *check) +CheckParm (const char *check) { int i; @@ -310,7 +310,7 @@ CheckParm (char *check) } QFile * -SafeOpenWrite (char *filename) +SafeOpenWrite (const char *filename) { QFile *f; @@ -323,7 +323,7 @@ SafeOpenWrite (char *filename) } QFile * -SafeOpenRead (char *filename) +SafeOpenRead (const char *filename) { QFile *f; @@ -350,7 +350,7 @@ SafeWrite (QFile *f, void *buffer, int count) } void -SaveFile (char *filename, void *buffer, int count) +SaveFile (const char *filename, void *buffer, int count) { QFile *f; @@ -360,7 +360,7 @@ SaveFile (char *filename, void *buffer, int count) } void -DefaultExtension (char *path, char *extension) +DefaultExtension (char *path, const char *extension) { char *src; @@ -472,7 +472,7 @@ ExtractFileExtension (char *path, char *dest) strcpy (dest,src); } -int +static int ParseHex (char *hex) { char *str; @@ -515,129 +515,6 @@ ParseNum (char *str) ============================================================================ */ -#ifdef _SGI_SOURCE -#define __BIG_ENDIAN__ -#endif - -#ifdef __BIG_ENDIAN__ - -short -LittleShort (short l) -{ - byte b1,b2; - - b1 = l&255; - b2 = (l>>8)&255; - - return (b1<<8) + b2; -} - -short -BigShort (short l) -{ - return l; -} - -int -LittleLong (int l) -{ - byte b1,b2,b3,b4; - - b1 = l&255; - b2 = (l>>8)&255; - b3 = (l>>16)&255; - b4 = (l>>24)&255; - - return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4; -} - -int -BigLong (int l) -{ - return l; -} - -float -LittleFloat (float l) -{ - union {byte b[4]; float f;} in, out; - - in.f = l; - out.b[0] = in.b[3]; - out.b[1] = in.b[2]; - out.b[2] = in.b[1]; - out.b[3] = in.b[0]; - - return out.f; -} - -float -BigFloat (float l) -{ - return l; -} - -#else - -short -BigShort (short l) -{ - byte b1,b2; - - b1 = l&255; - b2 = (l>>8)&255; - - return (b1<<8) + b2; -} - -short -LittleShort (short l) -{ - return l; -} - - -int -BigLong (int l) -{ - byte b1,b2,b3,b4; - - b1 = l&255; - b2 = (l>>8)&255; - b3 = (l>>16)&255; - b4 = (l>>24)&255; - - return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4; -} - -int -LittleLong (int l) -{ - return l; -} - -float -BigFloat (float l) -{ - union {byte b[4]; float f;} in, out; - - in.f = l; - out.b[0] = in.b[3]; - out.b[1] = in.b[2]; - out.b[2] = in.b[1]; - out.b[3] = in.b[0]; - - return out.f; -} - -float -LittleFloat (float l) -{ - return l; -} - -#endif - //======================================================= @@ -707,8 +584,9 @@ CRC_Value (unsigned short crcvalue) //============================================================================= void -CreatePath (char *path) +CreatePath (const char *_path) { + char *path = strdup (_path); char *ofs, c; for (ofs = path+1 ; *ofs ; ofs++) { @@ -720,10 +598,11 @@ CreatePath (char *path) *ofs = c; } } + free (path); } int -LoadFile (char *fname, void **buf) +LoadFile (const char *fname, void **buf) { QFile *file; char *src; @@ -750,7 +629,7 @@ CopyFile ============ */ void -CopyFile (char *from, char *to) +CopyFile (const char *from, const char *to) { void *buffer; int length; diff --git a/tools/qfmodelgen/source/lbmlib.c b/tools/qfmodelgen/source/lbmlib.c index bdec69932..56831a924 100644 --- a/tools/qfmodelgen/source/lbmlib.c +++ b/tools/qfmodelgen/source/lbmlib.c @@ -42,7 +42,7 @@ bmhd_t bmhd; -int +static int Align (int l) { if (l&1) @@ -57,7 +57,7 @@ LBMRLEdecompress Source must be evenly aligned! ================ */ -byte * +static byte * LBMRLEDecompress (byte *source, byte *unpacked, int bpwidth) { int count; @@ -102,7 +102,7 @@ MungeBitPlanes8 Asm version destroys the bit plane data! ================= */ -void +static void MungeBitPlanes8 (int width, byte *dest) { int i, ind = 0; @@ -155,7 +155,7 @@ done: #endif } -void +static void MungeBitPlanes4 (int width, byte *dest) { int i, ind = 0; @@ -198,7 +198,7 @@ done: #endif } -void +static void MungeBitPlanes2 (int width, byte *dest) { int i, ind = 0; @@ -234,7 +234,7 @@ done: #endif } -void +static void MungeBitPlanes1 (int width, byte *dest) { int i, ind = 0; diff --git a/tools/qfmodelgen/source/modelgen.c b/tools/qfmodelgen/source/modelgen.c index ec41a4d05..5680514b4 100644 --- a/tools/qfmodelgen/source/modelgen.c +++ b/tools/qfmodelgen/source/modelgen.c @@ -112,7 +112,7 @@ trivertx_t tarray[MAXVERTS]; char outname[1024]; -void +static void ClearModel (void) { memset (&model, 0, sizeof (model)); @@ -134,7 +134,7 @@ ClearModel (void) totsize = 0.0; } -void +static void WriteFrame (QFile *modelouthandle, int framenum) { int j, k; @@ -177,7 +177,7 @@ WriteFrame (QFile *modelouthandle, int framenum) Qwrite (modelouthandle, &tarray[0], model.numverts * sizeof(tarray[0])); } -void +static void WriteGroupBBox (QFile *modelouthandle, int numframes, int curframe) { int i, j, k; @@ -212,7 +212,7 @@ WriteGroupBBox (QFile *modelouthandle, int numframes, int curframe) Qwrite (modelouthandle, &dagroup, sizeof(dagroup)); } -void +static void WriteModelFile (QFile *modelouthandle) { int i, curframe, curskin; @@ -346,7 +346,7 @@ WriteModelFile (QFile *modelouthandle) } } -void +static void WriteModel (void) { QFile *modelouthandle; @@ -391,7 +391,7 @@ SetSkinValues Called for the base frame ============ */ -void +static void SetSkinValues (void) { float basex, basey, v; @@ -490,7 +490,7 @@ SetSkinValues (void) model.skinwidth, skinwidth, model.skinheight); } -void +static void Cmd_Base (void) { triangle_t *ptri; @@ -545,7 +545,7 @@ Cmd_Base (void) SetSkinValues (); } -void +static void Cmd_Skin (void) { byte *ppal, *pskinbitmap, *ptemp1, *ptemp2; @@ -597,7 +597,7 @@ Cmd_Skin (void) Error ("Too many skins; increase MAXSKINS"); } -void +static void GrabFrame (char *frame, int isgroup) { int numtris, time1, i, j; @@ -757,7 +757,7 @@ GrabFrame (char *frame, int isgroup) firstframe = 0; } -void +static void Cmd_Frame (int isgroup) { while (TokenAvailable ()) { @@ -769,7 +769,7 @@ Cmd_Frame (int isgroup) } } -void +static void Cmd_SkinGroupStart (void) { int groupskin; @@ -800,7 +800,7 @@ Cmd_SkinGroupStart (void) Error ("Empty group\n"); } -void +static void Cmd_FrameGroupStart (void) { int groupframe; @@ -832,7 +832,7 @@ Cmd_FrameGroupStart (void) Error ("Empty group\n"); } -void +static void Cmd_Origin (void) { // rotate points into frame of reference so model points down the positive x @@ -847,7 +847,7 @@ Cmd_Origin (void) adjust[2] = -atof (token); } -void +static void Cmd_Eyeposition (void) { // rotate points into frame of reference so model points down the positive x @@ -862,21 +862,21 @@ Cmd_Eyeposition (void) model.eyeposition[2] = atof (token); } -void +static void Cmd_ScaleUp (void) { GetToken (false); scale_up = atof (token); } -void +static void Cmd_Flags (void) { GetToken (false); model.flags = atoi (token); } -void +static void Cmd_Modelname (void) { WriteModel (); @@ -884,7 +884,7 @@ Cmd_Modelname (void) strcpy (outname, token); } -void +static void ParseScript (void) { while (1) { diff --git a/tools/qfmodelgen/source/trilib.c b/tools/qfmodelgen/source/trilib.c index 0a3d7726f..c7fc86c95 100644 --- a/tools/qfmodelgen/source/trilib.c +++ b/tools/qfmodelgen/source/trilib.c @@ -55,7 +55,7 @@ typedef struct { } tf_triangle; -void +static void ByteSwapTri (tf_triangle *tri) { int i; diff --git a/tools/qfprogs/source/globals.c b/tools/qfprogs/source/globals.c index 4af5578f3..3cca9f99a 100644 --- a/tools/qfprogs/source/globals.c +++ b/tools/qfprogs/source/globals.c @@ -50,7 +50,7 @@ dump_globals (progs_t *pr) const char *type; int saveglobal; int offset; - char *comment; + const char *comment; for (i = 0; i < pr->progs->numglobaldefs; i++) { ddef_t *def = &pr->pr_globaldefs[i]; @@ -90,7 +90,7 @@ dump_fields (progs_t *pr) const char *name; const char *type; int offset; - char *comment; + const char *comment; for (i = 0; i < pr->progs->numfielddefs; i++) { ddef_t *def = &pr->pr_fielddefs[i]; @@ -111,7 +111,7 @@ dump_functions (progs_t *pr) int i, j; const char *name; int start, count; - char *comment; + const char *comment; for (i = 0; i < pr->progs->numfunctions; i++) { dfunction_t *func = &pr->pr_functions[i]; diff --git a/tools/qfprogs/source/modules.c b/tools/qfprogs/source/modules.c index c961f2be7..c333fdf0c 100644 --- a/tools/qfprogs/source/modules.c +++ b/tools/qfprogs/source/modules.c @@ -50,7 +50,7 @@ static const char rcsid[] = #include "qfprogs.h" #include "modules.h" -void +static void dump_methods (progs_t *pr, pr_method_list_t *methods, int class) { int i; @@ -72,7 +72,7 @@ dump_methods (progs_t *pr, pr_method_list_t *methods, int class) } } -void +static void dump_class (progs_t *pr, pr_class_t *class) { pr_class_t *meta = &G_STRUCT (pr, pr_class_t, class->class_pointer); @@ -95,7 +95,7 @@ dump_class (progs_t *pr, pr_class_t *class) dump_methods (pr, &G_STRUCT (pr, pr_method_list_t, meta->methods), 1); } -void +static void dump_category (progs_t *pr, pr_category_t *category) { const char *category_name = ""; @@ -115,7 +115,7 @@ dump_category (progs_t *pr, pr_category_t *category) 1); } -void +static void dump_module (progs_t *pr, pr_module_t *module) { pr_symtab_t *symtab = &G_STRUCT (pr, pr_symtab_t, module->symtab); diff --git a/tools/qfprogs/source/qfprogs.c b/tools/qfprogs/source/qfprogs.c index b825da88e..61f5fc173 100644 --- a/tools/qfprogs/source/qfprogs.c +++ b/tools/qfprogs/source/qfprogs.c @@ -62,6 +62,7 @@ static const char rcsid[] = #include "globals.h" #include "lines.h" #include "modules.h" +#include "qfprogs.h" #include "strings.h" static const struct option long_options[] = { @@ -180,7 +181,7 @@ init_qf (void) Hash_SetHashCompare (func_tab, func_hash, func_compare); } -int +static int load_progs (const char *name) { QFile *file; diff --git a/tools/qfvis/source/flow.c b/tools/qfvis/source/flow.c index 7891596b2..300369dce 100644 --- a/tools/qfvis/source/flow.c +++ b/tools/qfvis/source/flow.c @@ -60,7 +60,7 @@ static const char rcsid[] = #include "vis.h" #include "options.h" -void +static void CheckStack (leaf_t *leaf, threaddata_t *thread) { pstack_t *portal; @@ -84,7 +84,7 @@ CheckStack (leaf_t *leaf, threaddata_t *thread) order goes source, pass, target. If the order goes pass, source, target then flipclip should be set. */ -winding_t * +static winding_t * ClipToSeparators (winding_t *source, winding_t *pass, winding_t *target, qboolean flipclip) { @@ -193,7 +193,7 @@ ClipToSeparators (winding_t *source, winding_t *pass, winding_t *target, Flood fill through the leafs If src_portal is NULL, this is the originating leaf */ -void +static void RecursiveLeafFlow (int leafnum, threaddata_t *thread, pstack_t *prevstack) { int i, j; diff --git a/tools/qfvis/source/qfvis.c b/tools/qfvis/source/qfvis.c index ea8725787..ac090c2d0 100644 --- a/tools/qfvis/source/qfvis.c +++ b/tools/qfvis/source/qfvis.c @@ -92,7 +92,7 @@ dstring_t *visdata; byte *uncompressed; // [bitbytes * portalleafs] -void +static void PlaneFromWinding (winding_t *winding, plane_t *plane) { vec3_t v1, v2; @@ -246,7 +246,7 @@ ClipWinding (winding_t *in, plane_t *split, qboolean keepon) Returns the portals from the least complex, so the later ones can reuse the earlier information. */ -portal_t * +static portal_t * GetNextPortal (void) { int j; @@ -273,7 +273,7 @@ GetNextPortal (void) return p; } -void * +static void * LeafThread (void *thread) { portal_t *portal; @@ -295,7 +295,7 @@ LeafThread (void *thread) return NULL; } -int +static int CompressRow (byte *vis, byte *dest) { int j; @@ -370,7 +370,7 @@ LeafFlow (int leafnum) dstring_append (visdata, compressed, i); } -void +static void CalcPortalVis (void) { long i; @@ -426,7 +426,7 @@ CalcPortalVis (void) } } -void +static void CalcVis (void) { int i; @@ -441,8 +441,8 @@ CalcVis (void) if (options.verbosity >= 0) printf ("average leafs visible: %i\n", totalvis / portalleafs); } - -qboolean +#if 0 +static qboolean PlaneCompare (plane_t *p1, plane_t *p2) { int i; @@ -457,7 +457,7 @@ PlaneCompare (plane_t *p1, plane_t *p2) return true; } -sep_t * +static sep_t * FindPassages (winding_t *source, winding_t *pass) { double length; @@ -562,7 +562,7 @@ FindPassages (winding_t *source, winding_t *pass) return list; } -void +static void CalcPassages (void) { int count, count2, i, j, k; @@ -615,8 +615,8 @@ CalcPassages (void) printf ("total passages: %i\n", count_sep); } } - -void +#endif +static void LoadPortals (char *name) { char magic[80]; diff --git a/tools/qfvis/source/soundphs.c b/tools/qfvis/source/soundphs.c index c37f57d2d..3a3560dae 100644 --- a/tools/qfvis/source/soundphs.c +++ b/tools/qfvis/source/soundphs.c @@ -66,7 +66,7 @@ static const char rcsid[] = leaf. */ -void +static void SurfaceBBox (dface_t *s, vec3_t mins, vec3_t maxs) { int vi, e, i, j; diff --git a/tools/qwaq/builtins.c b/tools/qwaq/builtins.c index 28908bc3a..3724977e2 100644 --- a/tools/qwaq/builtins.c +++ b/tools/qwaq/builtins.c @@ -40,6 +40,8 @@ static const char rcsid[] = #include #include +#include "qwaq.h" + static void bi_print (progs_t *pr) { diff --git a/tools/qwaq/main.c b/tools/qwaq/main.c index 58d2b57fa..f046027a1 100644 --- a/tools/qwaq/main.c +++ b/tools/qwaq/main.c @@ -40,6 +40,8 @@ static const char rcsid[] = #include "QF/va.h" #include +#include "qwaq.h" + #define MAX_EDICTS 1024 static edict_t *edicts; @@ -49,8 +51,6 @@ static progs_t pr; static void *membase; static int memsize = 16*1024*1024; -void BI_Init (progs_t *pr); - static QFile * open_file (const char *path, int *len) { diff --git a/tools/qwaq/qwaq.h b/tools/qwaq/qwaq.h new file mode 100644 index 000000000..46721070b --- /dev/null +++ b/tools/qwaq/qwaq.h @@ -0,0 +1 @@ +void BI_Init (progs_t *pr); diff --git a/tools/wav/qfwavinfo.c b/tools/wav/qfwavinfo.c index cf1e8c99e..cd5483081 100644 --- a/tools/wav/qfwavinfo.c +++ b/tools/wav/qfwavinfo.c @@ -85,7 +85,7 @@ typedef struct list_s { | ((unsigned char)(c) << 8) \ | (unsigned char)(d)) -char * +static char * read_string (FILE *f, int len) { char c[2] = {0, 0}; @@ -105,7 +105,7 @@ read_string (FILE *f, int len) return s; } -void * +static void * read_data (FILE *f, int len) { void *data = malloc (len); @@ -115,13 +115,13 @@ read_data (FILE *f, int len) return data; } -void +static void read_ltxt (FILE *f, int len, d_ltxt_t *ltxt) { fread (ltxt, 1, len, f); } -void +static void read_adtl (dstring_t *list_buf, FILE *f, int len) { d_chunk_t ck, *chunk = 0; @@ -170,7 +170,7 @@ read_adtl (dstring_t *list_buf, FILE *f, int len) list = (list_t *) list_buf->str; } -list_t * +static list_t * read_list (d_chunk_t *ck, FILE *f, int len) { d_chunk_t *chunk = 0; @@ -235,7 +235,7 @@ read_list (d_chunk_t *ck, FILE *f, int len) return list; } -d_cue_t * +static d_cue_t * read_cue (FILE *f, int len) { d_cue_t *cue = malloc (len); @@ -245,7 +245,7 @@ read_cue (FILE *f, int len) return cue; } -list_t * +static list_t * read_riff (const char *filename) { dstring_t *riff_buf;