diff --git a/include/QF/GL/extensions.h b/include/QF/GL/extensions.h index 5d0b63d52..f1656f797 100644 --- a/include/QF/GL/extensions.h +++ b/include/QF/GL/extensions.h @@ -236,7 +236,13 @@ typedef void (GLAPIENTRY *QF_glTexCoordPointerEXT) (GLint size, GLenum type, GLs typedef void (GLAPIENTRY *QF_glVertexPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); // 3Dfx +typedef long FxI32; +typedef FxI32 GrScreenResolution_t; +typedef FxI32 GrDitherMode_t; +typedef FxI32 GrScreenRefresh_t; + typedef void (GLAPIENTRY *QF_gl3DfxSetPaletteEXT) (GLuint *pal); +typedef void (GLAPIENTRY * QF_3DfxSetDitherModeEXT) (GrDitherMode_t mode); // GLX 1.3 typedef void *(GLAPIENTRY *QF_glXGetProcAddressARB) (const GLubyte *procName); diff --git a/include/QF/GL/qf_rsurf.h b/include/QF/GL/qf_rsurf.h index ba756c679..a3f9ee4af 100644 --- a/include/QF/GL/qf_rsurf.h +++ b/include/QF/GL/qf_rsurf.h @@ -39,4 +39,6 @@ void R_DrawBrushModel (struct entity_s *e); void R_DrawWorld (void); void R_RenderBrushPoly (msurface_t *fa); +void EmitWaterPolys (msurface_t *fa); + #endif // __QF_GL_rsurf_h diff --git a/include/QF/draw.h b/include/QF/draw.h index f492ac2fc..efe39ed1d 100644 --- a/include/QF/draw.h +++ b/include/QF/draw.h @@ -55,6 +55,8 @@ void Draw_AltString (int x, int y, const char *str); qpic_t *Draw_PicFromWad (const char *name); qpic_t *Draw_CachePic (const char *path, qboolean alpha); +void Draw_ClearCache (void); + void GL_Set2D (void); void GL_FlushText (void); diff --git a/include/QF/model.h b/include/QF/model.h index 9e10761d9..1d576523c 100644 --- a/include/QF/model.h +++ b/include/QF/model.h @@ -452,6 +452,13 @@ void Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, void Mod_FinalizeAliasModel (model_t *m, aliashdr_t *hdr); void Mod_SpriteLoadTexture (mspriteframe_t *pspriteframe, int framenum); +void Mod_LoadBrushModel (model_t *mod, void *buffer); +void Mod_LoadAliasModel (model_t *mod, void *buffer, + cache_allocator_t allocator); +void Mod_LoadSpriteModel (model_t *mod, void *buffer); +void Mod_SubdivideSurface (msurface_t *fa); + +void Mod_Print (void); extern struct cvar_s *gl_mesh_cache; extern struct cvar_s *gl_subdivide_size; diff --git a/include/QF/render.h b/include/QF/render.h index 73e5d1226..7d1b4e0d8 100644 --- a/include/QF/render.h +++ b/include/QF/render.h @@ -196,4 +196,9 @@ void R_LineGraph (int x, int y, int *h_vals, int count); struct progs_s; void R_Progs_Init (struct progs_s *pr); +void R_DrawAliasModel (entity_t *e); +void R_DrawSpriteModel (entity_t *e); + +void R_MarkLeaves (void); + #endif // __render_h diff --git a/include/QF/sound.h b/include/QF/sound.h index 95c354599..a125c4ffd 100644 --- a/include/QF/sound.h +++ b/include/QF/sound.h @@ -158,6 +158,10 @@ void SND_LocalSound (const char *s); void SND_BlockSound (void); void SND_UnblockSound (void); +void SND_ResampleSfx (sfxcache_t *sc, byte * data); +sfxcache_t *SND_GetCache (long samples, int rate, int inwidth, int channels, + sfx_t *sfx, cache_allocator_t allocator); + void SND_InitScaletable (void); // picks a channel based on priorities, empty slots, number of channels channel_t *SND_PickChannel(int entnum, int entchannel); @@ -234,4 +238,12 @@ void S_AmbientOn (void); extern struct model_s **snd_worldmodel; +void SND_CallbackLoad (void *object, cache_allocator_t allocator); +sfxcache_t *SND_LoadOgg (QFile *file, sfx_t *sfx, cache_allocator_t allocator); +wavinfo_t SND_GetWavinfo (const char *name, byte * wav, int wavlength); + +void SND_WriteLinearBlastStereo16 (void); +void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count); +void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int count); + #endif // _SOUND_H diff --git a/include/QF/vid.h b/include/QF/vid.h index 9bbb3628b..c7e9201ef 100644 --- a/include/QF/vid.h +++ b/include/QF/vid.h @@ -143,4 +143,6 @@ void GL_Pre_Init (void); void VID_MakeColormaps (int fullbrights, byte *pal); +void VGA_UpdatePlanarScreen (void *srcbuffer); + #endif // __vid_h_ diff --git a/include/QF/zone.h b/include/QF/zone.h index 2a6efb0e0..1507cb1ee 100644 --- a/include/QF/zone.h +++ b/include/QF/zone.h @@ -138,6 +138,8 @@ void *Cache_Check (cache_user_t *c); // if present, otherwise returns NULL void Cache_Free (cache_user_t *c); +void Cache_FreeLow (int new_low_hunk); +void Cache_FreeHigh (int new_high_hunk); void *Cache_Alloc (cache_user_t *c, int size, const char *name); // Returns NULL if all purgable data was tossed and there still diff --git a/include/d_local.h b/include/d_local.h index a680c3ae7..d5fa46ed9 100644 --- a/include/d_local.h +++ b/include/d_local.h @@ -119,4 +119,11 @@ extern float d_scalemip[3]; extern void (*d_drawspans) (espan_t *pspan); +void D_RasterizeAliasPolySmooth (void); +void D_PolysetCalcGradients (int skinwidth); +void D_PolysetScanLeftEdge (int height); +struct spanpackage_s; +void D_PolysetDrawSpans8 (struct spanpackage_s * pspanpackage); +void D_DrawTurbulent8Span (void); + #endif // _D_LOCAL_H diff --git a/include/fbset.h b/include/fbset.h index 8e625252f..82f2f9bd3 100644 --- a/include/fbset.h +++ b/include/fbset.h @@ -82,3 +82,13 @@ extern int yyparse(void); extern void Die(const char *fmt, ...) __attribute__ ((noreturn)); extern void AddVideoMode(const struct VideoMode *vmode); extern void makeRGBA(struct VideoMode *vmode, const char* opt); + +void ConvertFromVideoMode(const struct VideoMode *vmode, + struct fb_var_screeninfo *var); +void ConvertToVideoMode(const struct fb_var_screeninfo *var, + struct VideoMode *vmode); +struct VideoMode *FindVideoMode(const char *name); +extern struct VideoMode *VideoModes; +int fbset_main (int argc, const char *argv[]); +void ReadModeDB (void); + diff --git a/include/r_dynamic.h b/include/r_dynamic.h index 84772436e..7745fd5bd 100644 --- a/include/r_dynamic.h +++ b/include/r_dynamic.h @@ -77,6 +77,7 @@ void R_PushDlights (const vec3_t entorigin); struct cvar_s; void R_MaxDlightsCheck (struct cvar_s *var); void R_Particles_Init_Cvars (void); +void R_InitBubble (void); void R_InitParticles (void); inline void R_ClearParticles (void); diff --git a/include/r_local.h b/include/r_local.h index 48a829011..e4368066f 100644 --- a/include/r_local.h +++ b/include/r_local.h @@ -341,4 +341,38 @@ void R_LowFPPrecision (void); void R_HighFPPrecision (void); void R_SetFPCW (void); +void R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av); +void R_Alias_clip_left (finalvert_t *pfv0, finalvert_t *pfv1, + finalvert_t *out); +void R_Alias_clip_right (finalvert_t *pfv0, finalvert_t *pfv1, + finalvert_t *out); +void R_Alias_clip_bottom (finalvert_t *pfv0, finalvert_t *pfv1, + finalvert_t *out); +void R_Alias_clip_top (finalvert_t *pfv0, finalvert_t *pfv1, finalvert_t *out); + +void R_AliasSetUpTransform (int trivial_accept); +void R_AliasTransformVector (vec3_t in, vec3_t out); +void R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av, + trivertx_t *pverts, stvert_t *pstverts); +void R_AliasTransformAndProjectFinalVerts (finalvert_t *fv, stvert_t *pstverts); + +void R_GenerateSpans (void); + +void R_InitVars (void); + +void R_LoadSky_f (void); + +void R_DrawSurfaceBlock_mip0 (void); +void R_DrawSurfaceBlock_mip1 (void); +void R_DrawSurfaceBlock_mip2 (void); +void R_DrawSurfaceBlock_mip3 (void); +void R_DrawSurfaceBlock16_mip0 (void); +void R_DrawSurfaceBlock16_mip1 (void); +void R_DrawSurfaceBlock16_mip2 (void); +void R_DrawSurfaceBlock16_mip3 (void); +void R_DrawSurfaceBlock32_mip0 (void); +void R_DrawSurfaceBlock32_mip1 (void); +void R_DrawSurfaceBlock32_mip2 (void); +void R_DrawSurfaceBlock32_mip3 (void); + #endif // _R_LOCAL_H diff --git a/include/sbar.h b/include/sbar.h index c698e64fa..c42532491 100644 --- a/include/sbar.h +++ b/include/sbar.h @@ -52,4 +52,9 @@ void Sbar_IntermissionOverlay (void); void Sbar_FinaleOverlay (void); +void Sbar_LogFrags (void); +void Sbar_TeamOverlay (void); +void Sbar_DeathmatchOverlay (int start); +void Sbar_MiniDeathmatchOverlay (void); + #endif diff --git a/include/world.h b/include/world.h index 12946315f..8366741ea 100644 --- a/include/world.h +++ b/include/world.h @@ -113,5 +113,8 @@ struct edict_s *SV_TestPlayerPosition (struct edict_s *ent, int SV_HullPointContents (hull_t *hull, int num, const vec3_t p); hull_t *SV_HullForEntity (struct edict_s *ent, const vec3_t mins, const vec3_t maxs, vec3_t offset); +qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, + const vec3_t p1, const vec3_t p2, + trace_t *trace); #endif // __world_h diff --git a/libs/audio/cd/cd_sgi.c b/libs/audio/cd/cd_sgi.c index 2e04545fe..82b5de976 100644 --- a/libs/audio/cd/cd_sgi.c +++ b/libs/audio/cd/cd_sgi.c @@ -65,8 +65,6 @@ static char cd_dev[64] = "/dev/cdrom"; static CDPLAYER *cdp = NULL; -void I_SGI_Stop (void); - static void I_SGI_Eject (void) { diff --git a/libs/audio/renderer/snd_dma.c b/libs/audio/renderer/snd_dma.c index e35ff06d7..124d8b9de 100644 --- a/libs/audio/renderer/snd_dma.c +++ b/libs/audio/renderer/snd_dma.c @@ -49,20 +49,6 @@ static const char rcsid[] = #include "QF/sound.h" #include "QF/plugin.h" -void SND_Play (void); -void SND_PlayVol (void); -void SND_SoundList (void); -void SND_StopAllSounds (qboolean clear); -void SND_StopAllSoundsC (void); -void SND_Update_ (void); - -sfx_t *SND_PrecacheSound (const char *name); -void SND_ClearBuffer (void); -void SND_PaintChannels (int endtime); -void SND_CallbackLoad (void *object, cache_allocator_t allocator); - -void SND_Init_Cvars (); - // Internal sound data & structures =========================================== int snd_blocked = 0; @@ -167,130 +153,6 @@ SND_Startup (void) sound_started = 1; } -void -SND_Init (void) -{ - Sys_Printf ("\nSound Initialization\n"); - - Cmd_AddCommand ("play", SND_Play, - "Play selected sound effect (play pathto/sound.wav)"); - Cmd_AddCommand ("playvol", SND_PlayVol, "Play selected sound effect at " - "selected volume (playvol pathto/sound.wav num"); - Cmd_AddCommand ("stopsound", SND_StopAllSoundsC, - "Stops all sounds currently being played"); - Cmd_AddCommand ("soundlist", SND_SoundList, - "Reports a list of sounds in the cache"); - Cmd_AddCommand ("soundinfo", SND_SoundInfo_f, - "Report information on the sound system"); - - SND_Init_Cvars (); - - if (COM_CheckParm ("-nosound")) - return; - - if (COM_CheckParm ("-simsound")) - fakedma = true; - -// FIXME -// if (host_parms.memsize < 0x800000) { -// Cvar_Set (snd_loadas8bit, "1"); -// Sys_Printf ("loading all sounds as 8bit\n"); -// } - - snd_initialized = true; - - SND_Startup (); - - if (sound_started == 0) // sound startup failed? Bail out. - return; - - SND_InitScaletable (); - - known_sfx = Hunk_AllocName (MAX_SFX * sizeof (sfx_t), "sfx_t"); - - num_sfx = 0; - - // create a piece of DMA memory - if (fakedma) { - shm = (void *) Hunk_AllocName (sizeof (*shm), "shm"); - shm->splitbuffer = 0; - shm->samplebits = 16; - shm->speed = 22050; - shm->channels = 2; - shm->samples = 32768; - shm->samplepos = 0; - shm->soundalive = true; - shm->gamealive = true; - shm->submission_chunk = 1; - shm->buffer = Hunk_AllocName (1 << 16, "shmbuf"); - } -// Sys_Printf ("Sound sampling rate: %i\n", shm->speed); - - // provides a tick sound until washed clean - -// if (shm->buffer) -// shm->buffer[4] = shm->buffer[5] = 0x7f; // force a pop for debugging - - ambient_sfx[AMBIENT_WATER] = SND_PrecacheSound ("ambience/water1.wav"); - ambient_sfx[AMBIENT_SKY] = SND_PrecacheSound ("ambience/wind2.wav"); - - SND_StopAllSounds (true); -} - -void -SND_Init_Cvars (void) -{ - ambient_fade = Cvar_Get ("ambient_fade", "100", CVAR_NONE, NULL, - "How quickly ambient sounds fade in or out"); - ambient_level = Cvar_Get ("ambient_level", "0.3", CVAR_NONE, NULL, - "Ambient sounds' volume"); - nosound = Cvar_Get ("nosound", "0", CVAR_NONE, NULL, - "Set to turn sound off"); - precache = Cvar_Get ("precache", "1", CVAR_NONE, NULL, - "Toggle the use of a precache"); - bgmvolume = Cvar_Get ("bgmvolume", "1", CVAR_ARCHIVE, NULL, - "Volume of CD music"); - volume = Cvar_Get ("volume", "0.7", CVAR_ARCHIVE, NULL, - "Set the volume for sound playback"); - snd_interp = Cvar_Get ("snd_interp", "1", CVAR_ARCHIVE, NULL, - "control sample interpolation"); - snd_loadas8bit = Cvar_Get ("snd_loadas8bit", "0", CVAR_NONE, NULL, - "Toggles loading sounds as 8-bit samples"); - snd_mixahead = Cvar_Get ("snd_mixahead", "0.1", CVAR_ARCHIVE, NULL, - "Delay time for sounds"); - snd_noextraupdate = Cvar_Get ("snd_noextraupdate", "0", CVAR_NONE, NULL, - "Toggles the correct value display in " - "host_speeds. Usually messes up sound " - "playback when in effect"); - snd_phasesep = Cvar_Get ("snd_phasesep", "0.0", CVAR_ARCHIVE, NULL, - "max stereo phase separation in ms. 0.6 is for " - "20cm head"); - snd_show = Cvar_Get ("snd_show", "0", CVAR_NONE, NULL, - "Toggles display of sounds currently being played"); - snd_volumesep = Cvar_Get ("snd_volumesep", "1.0", CVAR_ARCHIVE, NULL, - "max stereo volume separation. 1.0 is max"); -} - -// Shutdown sound engine ====================================================== -void -SND_Shutdown (void) -{ - - if (!sound_started) - return; - - if (shm) - shm->gamealive = 0; - - sound_started = 0; - - if (!fakedma) { - S_O_Shutdown (); - } - - shm = 0; -} - // Load a sound =============================================================== sfx_t * SND_FindName (const char *name) @@ -672,6 +534,67 @@ SND_UpdateAmbientSounds (void) } } +void +SND_GetSoundtime (void) +{ + int fullsamples, samplepos; + static int buffers, oldsamplepos; + + fullsamples = shm->samples / shm->channels; + + // it is possible to miscount buffers if it has wrapped twice between + // calls to SND_Update. Oh well. + samplepos = S_O_GetDMAPos (); + + if (samplepos < oldsamplepos) { + buffers++; // buffer wrapped + + if (paintedtime > 0x40000000) { // time to chop things off to avoid + // 32 bit limits + buffers = 0; + paintedtime = fullsamples; + SND_StopAllSounds (true); + } + } + oldsamplepos = samplepos; + + soundtime = buffers * fullsamples + samplepos / shm->channels; +} + +void +SND_Update_ (void) +{ + int samps; + unsigned int endtime; + + if (!sound_started || (snd_blocked > 0)) + return; + + // Updates DMA time + SND_GetSoundtime (); + + // check to make sure that we haven't overshot + if (paintedtime < soundtime) { +// Sys_Printf ("S_Update_ : overflow\n"); + paintedtime = soundtime; + } + // mix ahead of current position + endtime = soundtime + snd_mixahead->value * shm->speed; + samps = shm->samples >> (shm->channels - 1); + if (endtime - soundtime > samps) + endtime = soundtime + samps; + +#if 0 +#ifdef _WIN32 + if (pDSBuf) + DSOUND_Restore (); +#endif +#endif + + SND_PaintChannels (endtime); + S_O_Submit (); +} + /* SND_Update @@ -756,33 +679,6 @@ SND_Update (const vec3_t origin, const vec3_t forward, const vec3_t right, SND_Update_ (); } -void -SND_GetSoundtime (void) -{ - int fullsamples, samplepos; - static int buffers, oldsamplepos; - - fullsamples = shm->samples / shm->channels; - - // it is possible to miscount buffers if it has wrapped twice between - // calls to SND_Update. Oh well. - samplepos = S_O_GetDMAPos (); - - if (samplepos < oldsamplepos) { - buffers++; // buffer wrapped - - if (paintedtime > 0x40000000) { // time to chop things off to avoid - // 32 bit limits - buffers = 0; - paintedtime = fullsamples; - SND_StopAllSounds (true); - } - } - oldsamplepos = samplepos; - - soundtime = buffers * fullsamples + samplepos / shm->channels; -} - void SND_ExtraUpdate (void) { @@ -791,40 +687,6 @@ SND_ExtraUpdate (void) SND_Update_ (); } -void -SND_Update_ (void) -{ - int samps; - unsigned int endtime; - - if (!sound_started || (snd_blocked > 0)) - return; - - // Updates DMA time - SND_GetSoundtime (); - - // check to make sure that we haven't overshot - if (paintedtime < soundtime) { -// Sys_Printf ("S_Update_ : overflow\n"); - paintedtime = soundtime; - } - // mix ahead of current position - endtime = soundtime + snd_mixahead->value * shm->speed; - samps = shm->samples >> (shm->channels - 1); - if (endtime - soundtime > samps) - endtime = soundtime + samps; - -#if 0 -#ifdef _WIN32 - if (pDSBuf) - DSOUND_Restore (); -#endif -#endif - - SND_PaintChannels (endtime); - S_O_Submit (); -} - /* console functions */ void @@ -966,6 +828,130 @@ SND_UnblockSound (void) S_O_UnblockSound (); } +void +SND_Init_Cvars (void) +{ + ambient_fade = Cvar_Get ("ambient_fade", "100", CVAR_NONE, NULL, + "How quickly ambient sounds fade in or out"); + ambient_level = Cvar_Get ("ambient_level", "0.3", CVAR_NONE, NULL, + "Ambient sounds' volume"); + nosound = Cvar_Get ("nosound", "0", CVAR_NONE, NULL, + "Set to turn sound off"); + precache = Cvar_Get ("precache", "1", CVAR_NONE, NULL, + "Toggle the use of a precache"); + bgmvolume = Cvar_Get ("bgmvolume", "1", CVAR_ARCHIVE, NULL, + "Volume of CD music"); + volume = Cvar_Get ("volume", "0.7", CVAR_ARCHIVE, NULL, + "Set the volume for sound playback"); + snd_interp = Cvar_Get ("snd_interp", "1", CVAR_ARCHIVE, NULL, + "control sample interpolation"); + snd_loadas8bit = Cvar_Get ("snd_loadas8bit", "0", CVAR_NONE, NULL, + "Toggles loading sounds as 8-bit samples"); + snd_mixahead = Cvar_Get ("snd_mixahead", "0.1", CVAR_ARCHIVE, NULL, + "Delay time for sounds"); + snd_noextraupdate = Cvar_Get ("snd_noextraupdate", "0", CVAR_NONE, NULL, + "Toggles the correct value display in " + "host_speeds. Usually messes up sound " + "playback when in effect"); + snd_phasesep = Cvar_Get ("snd_phasesep", "0.0", CVAR_ARCHIVE, NULL, + "max stereo phase separation in ms. 0.6 is for " + "20cm head"); + snd_show = Cvar_Get ("snd_show", "0", CVAR_NONE, NULL, + "Toggles display of sounds currently being played"); + snd_volumesep = Cvar_Get ("snd_volumesep", "1.0", CVAR_ARCHIVE, NULL, + "max stereo volume separation. 1.0 is max"); +} + +void +SND_Init (void) +{ + Sys_Printf ("\nSound Initialization\n"); + + Cmd_AddCommand ("play", SND_Play, + "Play selected sound effect (play pathto/sound.wav)"); + Cmd_AddCommand ("playvol", SND_PlayVol, "Play selected sound effect at " + "selected volume (playvol pathto/sound.wav num"); + Cmd_AddCommand ("stopsound", SND_StopAllSoundsC, + "Stops all sounds currently being played"); + Cmd_AddCommand ("soundlist", SND_SoundList, + "Reports a list of sounds in the cache"); + Cmd_AddCommand ("soundinfo", SND_SoundInfo_f, + "Report information on the sound system"); + + SND_Init_Cvars (); + + if (COM_CheckParm ("-nosound")) + return; + + if (COM_CheckParm ("-simsound")) + fakedma = true; + +// FIXME +// if (host_parms.memsize < 0x800000) { +// Cvar_Set (snd_loadas8bit, "1"); +// Sys_Printf ("loading all sounds as 8bit\n"); +// } + + snd_initialized = true; + + SND_Startup (); + + if (sound_started == 0) // sound startup failed? Bail out. + return; + + SND_InitScaletable (); + + known_sfx = Hunk_AllocName (MAX_SFX * sizeof (sfx_t), "sfx_t"); + + num_sfx = 0; + + // create a piece of DMA memory + if (fakedma) { + shm = (void *) Hunk_AllocName (sizeof (*shm), "shm"); + shm->splitbuffer = 0; + shm->samplebits = 16; + shm->speed = 22050; + shm->channels = 2; + shm->samples = 32768; + shm->samplepos = 0; + shm->soundalive = true; + shm->gamealive = true; + shm->submission_chunk = 1; + shm->buffer = Hunk_AllocName (1 << 16, "shmbuf"); + } +// Sys_Printf ("Sound sampling rate: %i\n", shm->speed); + + // provides a tick sound until washed clean + +// if (shm->buffer) +// shm->buffer[4] = shm->buffer[5] = 0x7f; // force a pop for debugging + + ambient_sfx[AMBIENT_WATER] = SND_PrecacheSound ("ambience/water1.wav"); + ambient_sfx[AMBIENT_SKY] = SND_PrecacheSound ("ambience/wind2.wav"); + + SND_StopAllSounds (true); +} + +// Shutdown sound engine ====================================================== +void +SND_Shutdown (void) +{ + + if (!sound_started) + return; + + if (shm) + shm->gamealive = 0; + + sound_started = 0; + + if (!fakedma) { + S_O_Shutdown (); + } + + shm = 0; +} + QFPLUGIN plugin_t * PLUGIN_INFO(snd_render, default) (void) { @@ -1014,4 +1000,3 @@ PLUGIN_INFO(snd_render, default) (void) return &plugin_info; } - diff --git a/libs/audio/renderer/snd_mem.c b/libs/audio/renderer/snd_mem.c index 250e8f364..1430041c5 100644 --- a/libs/audio/renderer/snd_mem.c +++ b/libs/audio/renderer/snd_mem.c @@ -45,11 +45,6 @@ static const char rcsid[] = int cache_full_cycle; -byte *SND_Alloc (int size); -wavinfo_t SND_GetWavinfo (const char *name, byte * wav, int wavlength); -sfxcache_t *SND_LoadSound (sfx_t *sfx, cache_allocator_t allocator); -sfxcache_t *SND_LoadOgg (QFile *file, sfx_t *sfx, cache_allocator_t allocator); - sfxcache_t * SND_GetCache (long samples, int rate, int inwidth, int channels, sfx_t *sfx, cache_allocator_t allocator) diff --git a/libs/audio/renderer/snd_mix.c b/libs/audio/renderer/snd_mix.c index 381cb1039..0ab51ca73 100644 --- a/libs/audio/renderer/snd_mix.c +++ b/libs/audio/renderer/snd_mix.c @@ -53,8 +53,6 @@ int snd_scaletable[32][256]; int *snd_p, snd_linear_count, snd_vol; short *snd_out; -void SND_WriteLinearBlastStereo16 (void); - #ifndef USE_INTEL_ASM void SND_WriteLinearBlastStereo16 (void) @@ -206,9 +204,6 @@ SND_TransferPaintBuffer (int endtime) /* CHANNEL MIXING */ -void SND_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int endtime); -void SND_PaintChannelFrom16 (channel_t *ch, sfxcache_t *sc, int endtime); - void SND_PaintChannels (int endtime) { diff --git a/libs/audio/renderer/snd_null.c b/libs/audio/renderer/snd_null.c index 8f9587a1d..8133eeef9 100644 --- a/libs/audio/renderer/snd_null.c +++ b/libs/audio/renderer/snd_null.c @@ -51,11 +51,6 @@ general_funcs_t plugin_info_general_funcs; sound_data_t plugin_info_sound_data; sound_funcs_t plugin_info_sound_funcs; -void SND_Init_Cvars (void); - - - - void SND_Init (void) { diff --git a/libs/audio/renderer/vorbis.c b/libs/audio/renderer/vorbis.c index 26252ffba..690bf9ffc 100644 --- a/libs/audio/renderer/vorbis.c +++ b/libs/audio/renderer/vorbis.c @@ -50,10 +50,6 @@ static const char rcsid[] = #include "QF/sys.h" #include "QF/quakeio.h" -//FIXME should be in header -void SND_ResampleSfx (sfxcache_t *sc, byte * data); -sfxcache_t *SND_GetCache (long samples, int rate, int inwidth, int channels, - sfx_t *sfx, cache_allocator_t allocator); static size_t read_func (void *ptr, size_t size, size_t nmemb, void *datasource) diff --git a/libs/gamecode/engine/pr_edict.c b/libs/gamecode/engine/pr_edict.c index 78fafd41a..8c9b896d9 100644 --- a/libs/gamecode/engine/pr_edict.c +++ b/libs/gamecode/engine/pr_edict.c @@ -99,8 +99,6 @@ const char *pr_type_name[ev_type_count] = { "array", }; -ddef_t *ED_FieldAtOfs (progs_t *pr, int ofs); - /* ED_ClearEdict diff --git a/libs/models/brush/gl_model_brush.c b/libs/models/brush/gl_model_brush.c index 2e46d341f..7d280257b 100644 --- a/libs/models/brush/gl_model_brush.c +++ b/libs/models/brush/gl_model_brush.c @@ -40,6 +40,7 @@ static const char rcsid[] = # include #endif +#include "QF/cvar.h" #include "QF/model.h" #include "QF/qendian.h" #include "QF/quakefs.h" @@ -158,3 +159,133 @@ Mod_LoadLighting (lump_t *l) for (i = 0; i < l->filelen ; i++) *out++ = gammatable[*in++]; } + +msurface_t *warpface; + + +void +BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs) +{ + float *v; + int i, j; + + mins[0] = mins[1] = mins[2] = 9999; + maxs[0] = maxs[1] = maxs[2] = -9999; + v = verts; + for (i = 0; i < numverts; i++) + for (j = 0; j < 3; j++, v++) { + if (*v < mins[j]) + mins[j] = *v; + if (*v > maxs[j]) + maxs[j] = *v; + } +} + +void +SubdividePolygon (int numverts, float *verts) +{ + float frac, m, s, t; + float dist[64]; + float *v; + int b, f, i, j, k; + glpoly_t *poly; + vec3_t mins, maxs; + vec3_t front[64], back[64]; + + if (numverts > 60) + Sys_Error ("numverts = %i", numverts); + + BoundPoly (numverts, verts, mins, maxs); + + for (i = 0; i < 3; i++) { + m = (mins[i] + maxs[i]) * 0.5; + m = gl_subdivide_size->value * floor (m / gl_subdivide_size->value + + 0.5); + if (maxs[i] - m < 8) + continue; + if (m - mins[i] < 8) + continue; + + // cut it + v = verts + i; + for (j = 0; j < numverts; j++, v += 3) + dist[j] = *v - m; + + // wrap cases + dist[j] = dist[0]; + v -= i; + VectorCopy (verts, v); + + f = b = 0; + v = verts; + for (j = 0; j < numverts; j++, v += 3) { + if (dist[j] >= 0) { + VectorCopy (v, front[f]); + f++; + } + if (dist[j] <= 0) { + VectorCopy (v, back[b]); + b++; + } + if (dist[j] == 0 || dist[j + 1] == 0) + continue; + if ((dist[j] > 0) != (dist[j + 1] > 0)) { + // clip point + frac = dist[j] / (dist[j] - dist[j + 1]); + for (k = 0; k < 3; k++) + front[f][k] = back[b][k] = v[k] + frac * (v[3 + k] - v[k]); + f++; + b++; + } + } + + SubdividePolygon (f, front[0]); + SubdividePolygon (b, back[0]); + return; + } + + poly = Hunk_Alloc (sizeof (glpoly_t) + (numverts - 4) * VERTEXSIZE * + sizeof (float)); + poly->next = warpface->polys; + warpface->polys = poly; + poly->numverts = numverts; + for (i = 0; i < numverts; i++, verts += 3) { + VectorCopy (verts, poly->verts[i]); + s = DotProduct (verts, warpface->texinfo->vecs[0]); + t = DotProduct (verts, warpface->texinfo->vecs[1]); + poly->verts[i][3] = s; + poly->verts[i][4] = t; + } +} + +/* + Mod_SubdivideSurface + + Breaks a polygon up along axial 64 unit + boundaries so that turbulent and sky warps + can be done reasonably. +*/ +void +Mod_SubdivideSurface (msurface_t *fa) +{ + float *vec; + int lindex, numverts, i; + vec3_t verts[64]; + + warpface = fa; + + // convert edges back to a normal polygon + numverts = 0; + for (i = 0; i < fa->numedges; i++) { + lindex = loadmodel->surfedges[fa->firstedge + i]; + + if (lindex > 0) + vec = loadmodel->vertexes[loadmodel->edges[lindex].v[0]].position; + else + vec = loadmodel->vertexes[loadmodel->edges[-lindex].v[1]].position; + VectorCopy (vec, verts[numverts]); + numverts++; + } + + SubdividePolygon (numverts, verts[0]); +} diff --git a/libs/models/brush/model_brush.c b/libs/models/brush/model_brush.c index 050497857..35e013466 100644 --- a/libs/models/brush/model_brush.c +++ b/libs/models/brush/model_brush.c @@ -55,10 +55,6 @@ byte mod_novis[MAX_MAP_LEAFS / 8]; cvar_t *gl_sky_divide; -void GL_SubdivideSurface (msurface_t *fa); -void R_InitSky (struct texture_s *mt); - - mleaf_t * Mod_PointInLeaf (const vec3_t p, model_t *model) { @@ -300,7 +296,7 @@ Mod_LoadVertexes (lump_t *l) in = (void *) (mod_base + l->fileofs); if (l->filelen % sizeof (*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); count = l->filelen / sizeof (*in); out = Hunk_AllocName (count * sizeof (*out), loadname); @@ -322,7 +318,7 @@ Mod_LoadSubmodels (lump_t *l) in = (void *) (mod_base + l->fileofs); if (l->filelen % sizeof (*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); count = l->filelen / sizeof (*in); out = Hunk_AllocName (count * sizeof (*out), loadname); @@ -352,7 +348,7 @@ Mod_LoadEdges (lump_t *l) in = (void *) (mod_base + l->fileofs); if (l->filelen % sizeof (*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); count = l->filelen / sizeof (*in); out = Hunk_AllocName ((count + 1) * sizeof (*out), loadname); @@ -375,7 +371,7 @@ Mod_LoadTexinfo (lump_t *l) in = (void *) (mod_base + l->fileofs); if (l->filelen % sizeof (*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); count = l->filelen / sizeof (*in); out = Hunk_AllocName (count * sizeof (*out), loadname); @@ -477,7 +473,7 @@ Mod_LoadFaces (lump_t *l) in = (void *) (mod_base + l->fileofs); if (l->filelen % sizeof (*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); count = l->filelen / sizeof (*in); out = Hunk_AllocName (count * sizeof (*out), loadname); @@ -517,7 +513,7 @@ Mod_LoadFaces (lump_t *l) if (!strncmp (out->texinfo->texture->name, "sky", 3)) { // sky out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED); if (gl_sky_divide && gl_sky_divide->int_val) - GL_SubdivideSurface (out); + Mod_SubdivideSurface (out); continue; } @@ -529,7 +525,7 @@ Mod_LoadFaces (lump_t *l) out->extents[i] = 16384; out->texturemins[i] = -8192; } - GL_SubdivideSurface (out); // cut up polygon for warps + Mod_SubdivideSurface (out); // cut up polygon for warps continue; } } @@ -554,7 +550,7 @@ Mod_LoadNodes (lump_t *l) in = (void *) (mod_base + l->fileofs); if (l->filelen % sizeof (*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); count = l->filelen / sizeof (*in); out = Hunk_AllocName (count * sizeof (*out), loadname); @@ -595,7 +591,7 @@ Mod_LoadLeafs (lump_t *l) in = (void *) (mod_base + l->fileofs); if (l->filelen % sizeof (*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); count = l->filelen / sizeof (*in); out = Hunk_AllocName (count * sizeof (*out), loadname); @@ -649,7 +645,7 @@ Mod_LoadClipnodes (lump_t *l) in = (void *) (mod_base + l->fileofs); if (l->filelen % sizeof (*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); count = l->filelen / sizeof (*in); out = Hunk_AllocName (count * sizeof (*out), loadname); @@ -739,7 +735,7 @@ Mod_LoadMarksurfaces (lump_t *l) in = (void *) (mod_base + l->fileofs); if (l->filelen % sizeof (*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); count = l->filelen / sizeof (*in); out = Hunk_AllocName (count * sizeof (*out), loadname); @@ -762,7 +758,7 @@ Mod_LoadSurfedges (lump_t *l) in = (void *) (mod_base + l->fileofs); if (l->filelen % sizeof (*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); count = l->filelen / sizeof (*in); out = Hunk_AllocName (count * sizeof (*out), loadname); @@ -782,7 +778,7 @@ Mod_LoadPlanes (lump_t *l) in = (void *) (mod_base + l->fileofs); if (l->filelen % sizeof (*in)) - Sys_Error ("MOD_LoadBmodel: funny lump size in %s", loadmodel->name); + Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); count = l->filelen / sizeof (*in); out = Hunk_AllocName (count * 2 * sizeof (*out), loadname); diff --git a/libs/models/brush/sw_model_brush.c b/libs/models/brush/sw_model_brush.c index 1bef53271..90f983e22 100644 --- a/libs/models/brush/sw_model_brush.c +++ b/libs/models/brush/sw_model_brush.c @@ -46,7 +46,7 @@ int mod_lightmap_bytes = 1; void -GL_SubdivideSurface (msurface_t *fa) +Mod_SubdivideSurface (msurface_t *fa) { } diff --git a/libs/models/model.c b/libs/models/model.c index bd0b5d646..05c6f091b 100644 --- a/libs/models/model.c +++ b/libs/models/model.c @@ -48,14 +48,6 @@ static const char rcsid[] = #include "compat.h" -void Mod_LoadAliasModel (model_t *mod, void *buf, - cache_allocator_t allocator); -void Mod_LoadSpriteModel (model_t *mod, void *buf); -void Mod_LoadBrushModel (model_t *mod, void *buf); -model_t * Mod_RealLoadModel (model_t *mod, qboolean crash, - cache_allocator_t allocator); -void Mod_CallbackLoad (void *object, cache_allocator_t allocator); - model_t *loadmodel; char loadname[32]; // for hunk tags @@ -68,6 +60,7 @@ texture_t *r_notexture_mip; cvar_t *gl_mesh_cache; cvar_t *gl_subdivide_size; +static void Mod_CallbackLoad (void *object, cache_allocator_t allocator); void Mod_Init (void) @@ -147,24 +140,6 @@ Mod_FindName (const char *name) return mod; } -/* - Mod_LoadModel - - Loads a model into the cache -*/ -model_t * -Mod_LoadModel (model_t *mod, qboolean crash) -{ - if (!mod->needload) { - if (mod->type == mod_alias) { - if (Cache_Check (&mod->cache)) - return mod; - } else - return mod; // not cached at all - } - return Mod_RealLoadModel (mod, crash, Cache_Alloc); -} - model_t * Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator) { @@ -231,12 +206,30 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator) return mod; } +/* + Mod_LoadModel + + Loads a model into the cache +*/ +model_t * +Mod_LoadModel (model_t *mod, qboolean crash) +{ + if (!mod->needload) { + if (mod->type == mod_alias) { + if (Cache_Check (&mod->cache)) + return mod; + } else + return mod; // not cached at all + } + return Mod_RealLoadModel (mod, crash, Cache_Alloc); +} + /* Mod_CallbackLoad Callback used to load model automatically */ -void +static void Mod_CallbackLoad (void *object, cache_allocator_t allocator) { if (((model_t *)object)->type != mod_alias) diff --git a/libs/util/bspfile.c b/libs/util/bspfile.c index 9216dd559..8579135f1 100644 --- a/libs/util/bspfile.c +++ b/libs/util/bspfile.c @@ -315,28 +315,32 @@ BSP_New (void) return calloc (1, sizeof (bsp_t)); } -void BSP_AddPlane (bsp_t *bsp, dplane_t *plane) +void +BSP_AddPlane (bsp_t *bsp, dplane_t *plane) { bsp->planes = realloc (bsp->planes, (bsp->numplanes + 1) * sizeof (dplane_t)); bsp->planes[bsp->numplanes++] = *plane; } -void BSP_AddLeaf (bsp_t *bsp, dleaf_t *leaf) +void +BSP_AddLeaf (bsp_t *bsp, dleaf_t *leaf) { bsp->leafs = realloc (bsp->leafs, (bsp->numleafs + 1) * sizeof (dleaf_t)); bsp->leafs[bsp->numleafs++] = *leaf; } -void BSP_AddVertex (bsp_t *bsp, dvertex_t *vertex) +void +BSP_AddVertex (bsp_t *bsp, dvertex_t *vertex) { bsp->vertexes = realloc (bsp->vertexes, (bsp->numvertexes + 1) * sizeof (dvertex_t)); bsp->vertexes[bsp->numvertexes++] = *vertex; } -void BSP_AddNode (bsp_t *bsp, dnode_t *node) +void +BSP_AddNode (bsp_t *bsp, dnode_t *node) { bsp->nodes = realloc (bsp->nodes, (bsp->numnodes + 1) * sizeof (dnode_t)); @@ -351,21 +355,24 @@ BSP_AddTexinfo (bsp_t *bsp, texinfo_t *texinfo) bsp->texinfo[bsp->numtexinfo++] = *texinfo; } -void BSP_AddFace (bsp_t *bsp, dface_t *face) +void +BSP_AddFace (bsp_t *bsp, dface_t *face) { bsp->faces = realloc (bsp->faces, (bsp->numfaces + 1) * sizeof (dface_t)); bsp->faces[bsp->numfaces++] = *face; } -void BSP_AddClipnode (bsp_t *bsp, dclipnode_t *clipnode) +void +BSP_AddClipnode (bsp_t *bsp, dclipnode_t *clipnode) { bsp->clipnodes = realloc (bsp->clipnodes, (bsp->numclipnodes + 1) * sizeof (dclipnode_t)); bsp->clipnodes[bsp->numclipnodes++] = *clipnode; } -void BSP_AddMarkSurface (bsp_t *bsp, unsigned short marksurface) +void +BSP_AddMarkSurface (bsp_t *bsp, unsigned short marksurface) { bsp->marksurfaces = realloc (bsp->marksurfaces, (bsp->nummarksurfaces + 1) @@ -373,49 +380,56 @@ void BSP_AddMarkSurface (bsp_t *bsp, unsigned short marksurface) bsp->marksurfaces[bsp->nummarksurfaces++] = marksurface; } -void BSP_AddSurfEdge (bsp_t *bsp, int surfedge) +void +BSP_AddSurfEdge (bsp_t *bsp, int surfedge) { bsp->surfedges = realloc (bsp->surfedges, (bsp->numsurfedges + 1) * sizeof (int)); bsp->surfedges[bsp->numsurfedges++] = surfedge; } -void BSP_AddEdge (bsp_t *bsp, dedge_t *edge) +void +BSP_AddEdge (bsp_t *bsp, dedge_t *edge) { bsp->edges = realloc (bsp->edges, (bsp->numedges + 1) * sizeof (dedge_t)); bsp->edges[bsp->numedges++] = *edge; } -void BSP_AddModel (bsp_t *bsp, dmodel_t *model) +void +BSP_AddModel (bsp_t *bsp, dmodel_t *model) { bsp->models = realloc (bsp->models, (bsp->nummodels + 1) * sizeof (dmodel_t)); bsp->models[bsp->nummodels++] = *model; } -void BSP_AddLighting (bsp_t *bsp, byte *lightdata, int lightdatasize) +void +BSP_AddLighting (bsp_t *bsp, byte *lightdata, int lightdatasize) { bsp->lightdatasize = lightdatasize; bsp->lightdata = malloc (lightdatasize); memcpy (bsp->lightdata, lightdata, lightdatasize); } -void BSP_AddVisibility (bsp_t *bsp, byte *visdata, int visdatasize) +void +BSP_AddVisibility (bsp_t *bsp, byte *visdata, int visdatasize) { bsp->visdatasize = visdatasize; bsp->visdata = malloc (visdatasize); memcpy (bsp->visdata, visdata, visdatasize); } -void BSP_AddEntities (bsp_t *bsp, char *entdata, int entdatasize) +void +BSP_AddEntities (bsp_t *bsp, char *entdata, int entdatasize) { bsp->entdatasize = entdatasize; bsp->entdata = malloc (entdatasize); memcpy (bsp->entdata, entdata, entdatasize); } -void BSP_AddTextures (bsp_t *bsp, byte *texdata, int texdatasize) +void +BSP_AddTextures (bsp_t *bsp, byte *texdata, int texdatasize) { bsp->texdatasize = texdatasize; bsp->texdata = malloc (texdatasize); diff --git a/libs/util/exp.c b/libs/util/exp.c index 882d38eea..2c7446878 100644 --- a/libs/util/exp.c +++ b/libs/util/exp.c @@ -64,7 +64,8 @@ functable_t functable[] = {"", 0, 0} }; -token *EXP_NewToken (void) +token +*EXP_NewToken (void) { token *new; @@ -77,7 +78,8 @@ token *EXP_NewToken (void) } /* -int EXP_FindIndexByFunc (opfunc func) +int +EXP_FindIndexByFunc (opfunc func) { int i; for (i = 0; optable[i].func; i++) @@ -87,7 +89,8 @@ int EXP_FindIndexByFunc (opfunc func) } */ -optable_t *EXP_FindOpByStr (const char *str) +optable_t * +EXP_FindOpByStr (const char *str) { int i, len, fi; @@ -102,7 +105,8 @@ optable_t *EXP_FindOpByStr (const char *str) return 0; } -functable_t *EXP_FindFuncByStr (const char *str) +functable_t * +EXP_FindFuncByStr (const char *str) { int i, len, fi; @@ -117,7 +121,8 @@ functable_t *EXP_FindFuncByStr (const char *str) return 0; } -int EXP_ContainsCommas (token *chain) +int +EXP_ContainsCommas (token *chain) { token *cur; int paren = 0; @@ -134,7 +139,8 @@ int EXP_ContainsCommas (token *chain) return -1; // We should never get here } -int EXP_DoFunction (token *chain) +int +EXP_DoFunction (token *chain) { token *cur, *temp; double *oplist = 0; @@ -169,7 +175,8 @@ int EXP_DoFunction (token *chain) return -2; // We shouldn't get here } -int EXP_DoUnary (token *chain) +int +EXP_DoUnary (token *chain) { if (chain->generic.next->generic.type == TOKEN_OP) EXP_DoUnary (chain->generic.next); @@ -180,7 +187,8 @@ int EXP_DoUnary (token *chain) return 0; } -token *EXP_ParseString (char *str) +token * +EXP_ParseString (char *str) { char buf[256]; @@ -292,7 +300,8 @@ token *EXP_ParseString (char *str) return chain; } -exp_error_t EXP_SimplifyTokens (token *chain) +exp_error_t +EXP_SimplifyTokens (token *chain) { exp_error_t res; int i; @@ -354,14 +363,16 @@ exp_error_t EXP_SimplifyTokens (token *chain) return EXP_E_NORMAL; } -void EXP_RemoveToken (token *tok) +void +EXP_RemoveToken (token *tok) { tok->generic.prev->generic.next = tok->generic.next; tok->generic.next->generic.prev = tok->generic.prev; free(tok); } -void EXP_DestroyTokens (token *chain) +void +EXP_DestroyTokens (token *chain) { token *temp; for (;chain; chain = temp) @@ -371,7 +382,8 @@ void EXP_DestroyTokens (token *chain) } } -double EXP_Evaluate (char *str) +double +EXP_Evaluate (char *str) { token *chain; double res; @@ -405,7 +417,8 @@ double EXP_Evaluate (char *str) return res; } -void EXP_InsertTokenAfter (token *spot, token *new) +void +EXP_InsertTokenAfter (token *spot, token *new) { spot->generic.next->generic.prev = new; new->generic.next = spot->generic.next; @@ -414,7 +427,8 @@ void EXP_InsertTokenAfter (token *spot, token *new) } -exp_error_t EXP_Validate (token *chain) +exp_error_t +EXP_Validate (token *chain) { token *cur, *new; int paren = 0; @@ -463,7 +477,8 @@ exp_error_t EXP_Validate (token *chain) return 0; } -void EXP_PrintTokens (token *chain) +void +EXP_PrintTokens (token *chain) { for (; chain; chain = chain->generic.next) switch (chain->generic.type) diff --git a/libs/util/gib_buffer.c b/libs/util/gib_buffer.c index a11e438a8..09b3a8c54 100644 --- a/libs/util/gib_buffer.c +++ b/libs/util/gib_buffer.c @@ -43,7 +43,8 @@ static const char rcsid[] = #include "QF/hash.h" #include "QF/gib_buffer.h" -void GIB_Buffer_Construct (struct cbuf_s *cbuf) +void +GIB_Buffer_Construct (struct cbuf_s *cbuf) { cbuf->data = calloc (1, sizeof (gib_buffer_data_t)); GIB_DATA (cbuf)->arg_composite = dstring_newstr (); @@ -51,7 +52,8 @@ void GIB_Buffer_Construct (struct cbuf_s *cbuf) GIB_DATA (cbuf)->ret.retval = dstring_newstr (); } -void GIB_Buffer_Destruct (struct cbuf_s *cbuf) +void +GIB_Buffer_Destruct (struct cbuf_s *cbuf) { dstring_delete (GIB_DATA (cbuf)->arg_composite); dstring_delete (GIB_DATA (cbuf)->current_token); diff --git a/libs/util/gib_parse.c b/libs/util/gib_parse.c index 980dcc4fe..b749e7d08 100644 --- a/libs/util/gib_parse.c +++ b/libs/util/gib_parse.c @@ -51,9 +51,7 @@ static const char rcsid[] = // Interpreter structure and prototypes -void GIB_Parse_Extract_Line (cbuf_t *cbuf); -void GIB_Parse_Tokenize_Line (cbuf_t *cbuf); -void GIB_Parse_Execute_Line (cbuf_t *cbuf); +static void GIB_Parse_Execute_Line (cbuf_t *cbuf); cbuf_interpreter_t gib_interp = { GIB_Parse_Extract_Line, @@ -508,7 +506,8 @@ FILTER_ERROR: Assignment to a local/global variable Normal quake console commands */ -void GIB_Parse_Execute_Line (cbuf_t *cbuf) +static void +GIB_Parse_Execute_Line (cbuf_t *cbuf) { cbuf_args_t *args = cbuf->args; gib_builtin_t *b; diff --git a/libs/util/gib_process.c b/libs/util/gib_process.c index 60b8bb305..922a31e30 100644 --- a/libs/util/gib_process.c +++ b/libs/util/gib_process.c @@ -48,8 +48,6 @@ static const char rcsid[] = #include "exp.h" -int GIB_Process_Variables_All (struct dstring_s *token); - int GIB_Process_Index (dstring_t *index, unsigned int pos, int *i1, int *i2) { diff --git a/libs/util/ops.c b/libs/util/ops.c index e8142d0e1..109caa786 100644 --- a/libs/util/ops.c +++ b/libs/util/ops.c @@ -21,105 +21,129 @@ #include -double OP_Not (double op1, double op2) +double +OP_Not (double op1, double op2) { return !op1; } -double OP_Negate (double op1, double op2) +double +OP_Negate (double op1, double op2) { return -op1; } -double OP_Add (double op1, double op2) +double +OP_Add (double op1, double op2) { return op1 + op2; } -double OP_Sub (double op1, double op2) +double +OP_Sub (double op1, double op2) { return op1 - op2; } -double OP_Mult (double op1, double op2) +double +OP_Mult (double op1, double op2) { return op1 * op2; } -double OP_Div (double op1, double op2) +double +OP_Div (double op1, double op2) { return op1 / op2; } -double OP_Exp (double op1, double op2) +double +OP_Exp (double op1, double op2) { return pow(op1, op2); } -double OP_Eq (double op1, double op2) +double +OP_Eq (double op1, double op2) { return op1 == op2; } -double OP_Neq (double op1, double op2) +double +OP_Neq (double op1, double op2) { return op1 != op2; } -double OP_Or (double op1, double op2) +double +OP_Or (double op1, double op2) { return op1 || op2; } -double OP_And (double op1, double op2) +double +OP_And (double op1, double op2) { return op1 && op2; } -double OP_GreaterThan (double op1, double op2) + +double +OP_GreaterThan (double op1, double op2) { return op1 > op2; } -double OP_LessThan (double op1, double op2) +double +OP_LessThan (double op1, double op2) { return op1 < op2; } -double OP_GreaterThanEqual (double op1, double op2) + +double +OP_GreaterThanEqual (double op1, double op2) { return op1 >= op2; } -double OP_LessThanEqual (double op1, double op2) + +double +OP_LessThanEqual (double op1, double op2) { return op1 <= op2; } -double Func_Sin (double *oplist, unsigned int numops) +double +Func_Sin (double *oplist, unsigned int numops) { return sin (oplist[0]); } -double Func_Cos (double *oplist, unsigned int numops) +double +Func_Cos (double *oplist, unsigned int numops) { return cos (oplist[0]); } -double Func_Tan (double *oplist, unsigned int numops) +double +Func_Tan (double *oplist, unsigned int numops) { return tan (oplist[0]); } -double Func_Asin (double *oplist, unsigned int numops) +double +Func_Asin (double *oplist, unsigned int numops) { return asin (oplist[0]); } -double Func_Acos (double *oplist, unsigned int numops) +double +Func_Acos (double *oplist, unsigned int numops) { return acos (oplist[0]); } -double Func_Atan (double *oplist, unsigned int numops) +double +Func_Atan (double *oplist, unsigned int numops) { return atan (oplist[0]); } diff --git a/libs/util/wad.c b/libs/util/wad.c index 50616a6d6..0bf80e93e 100644 --- a/libs/util/wad.c +++ b/libs/util/wad.c @@ -47,9 +47,6 @@ int wad_numlumps; lumpinfo_t *wad_lumps; byte *wad_base; -void SwapPic (qpic_t *pic); - - /* W_CleanupName diff --git a/libs/util/zone.c b/libs/util/zone.c index 1ffefbed5..9dc1d8b18 100644 --- a/libs/util/zone.c +++ b/libs/util/zone.c @@ -67,9 +67,6 @@ static const char rcsid[] = #define MINFRAGMENT 64 -void Cache_FreeLow (int new_low_hunk); -void Cache_FreeHigh (int new_high_hunk); - /* ZONE MEMORY ALLOCATION @@ -316,9 +313,6 @@ int hunk_tempmark; qboolean hunk_tempactive; -void R_FreeTextures (void); - - /* Hunk_Check @@ -564,14 +558,14 @@ typedef struct cache_system_s { struct cache_system_s *lru_prev, *lru_next; // for LRU flushing } cache_system_t; -cache_system_t *Cache_TryAlloc (int size, qboolean nobottom); -void Cache_RealFree (cache_user_t *c); -void *Cache_RealCheck (cache_user_t *c); -void *Cache_RealAlloc (cache_user_t *c, int size, const char *name); cache_system_t cache_head; int cache_writelock; -void Cache_Profile (void); +static void *Cache_RealCheck (cache_user_t *c); +static cache_system_t *Cache_TryAlloc (int size, qboolean nobottom); +static void Cache_RealFree (cache_user_t *c); +static void Cache_Profile (void); +static void *Cache_RealAlloc (cache_user_t *c, int size, const char *name); #define CACHE_WRITE_LOCK { if (cache_writelock) \ Sys_Error ("Cache double-locked!"); \ @@ -699,7 +693,7 @@ Cache_FreeLRU () Looks for a free block of memory between the high and low hunk marks Size should already include the header and padding */ -cache_system_t * +static cache_system_t * Cache_TryAlloc (int size, qboolean nobottom) { #ifndef MMAPPED_CACHE @@ -865,7 +859,7 @@ Cache_Free (cache_user_t *c) CACHE_WRITE_UNLOCK; } -void +static void Cache_RealFree (cache_user_t *c) { cache_system_t *cs; @@ -891,7 +885,7 @@ Cache_RealFree (cache_user_t *c) #endif } -void * +void * Cache_Check (cache_user_t *c) { void *mem; @@ -902,7 +896,7 @@ Cache_Check (cache_user_t *c) return mem; } -void * +static void * Cache_RealCheck (cache_user_t *c) { cache_system_t *cs; @@ -930,7 +924,7 @@ Cache_Alloc (cache_user_t *c, int size, const char *name) return mem; } -void * +static void * Cache_RealAlloc (cache_user_t *c, int size, const char *name) { cache_system_t *cs; @@ -960,7 +954,7 @@ Cache_RealAlloc (cache_user_t *c, int size, const char *name) return Cache_RealCheck (c); } -void +static void Cache_Profile (void) { cache_system_t *cs; diff --git a/libs/video/renderer/gl/gl_dyn_lights.c b/libs/video/renderer/gl/gl_dyn_lights.c index e36e5ec2a..4fdf3d089 100644 --- a/libs/video/renderer/gl/gl_dyn_lights.c +++ b/libs/video/renderer/gl/gl_dyn_lights.c @@ -53,7 +53,7 @@ float bubble_sintable[33], bubble_costable[33]; void -R_InitBubble () +R_InitBubble (void) { float a; float *bub_sin, *bub_cos; diff --git a/libs/video/renderer/gl/gl_rmain.c b/libs/video/renderer/gl/gl_rmain.c index 113a075ff..1338965f4 100644 --- a/libs/video/renderer/gl/gl_rmain.c +++ b/libs/video/renderer/gl/gl_rmain.c @@ -101,10 +101,6 @@ int d_lightstylevalue[256]; // 8.8 fraction of base light value vec3_t shadecolor; // Ender (Extend) Colormod float modelalpha; // Ender (Extend) Alpha -void R_MarkLeaves (void); -void R_DrawAliasModel (entity_t *e); -void R_DrawSpriteModel (entity_t *e); - void glrmain_init (void) diff --git a/libs/video/renderer/gl/gl_rmisc.c b/libs/video/renderer/gl/gl_rmisc.c index 1f587eef7..efcdb89c9 100644 --- a/libs/video/renderer/gl/gl_rmisc.c +++ b/libs/video/renderer/gl/gl_rmisc.c @@ -62,10 +62,6 @@ static const char rcsid[] = int r_init = 0; -qboolean VID_Is8bit (void); -void R_InitBubble (void); - - /* R_Envmap_f diff --git a/libs/video/renderer/gl/gl_rsurf.c b/libs/video/renderer/gl/gl_rsurf.c index 031e4b0c6..5418e2b85 100644 --- a/libs/video/renderer/gl/gl_rsurf.c +++ b/libs/video/renderer/gl/gl_rsurf.c @@ -48,6 +48,7 @@ static const char rcsid[] = #include "QF/GL/funcs.h" #include "QF/GL/qf_lightmap.h" #include "QF/GL/qf_rmain.h" +#include "QF/GL/qf_rsurf.h" #include "QF/GL/qf_sky.h" #include "QF/GL/qf_textures.h" #include "QF/GL/qf_vid.h" @@ -90,8 +91,6 @@ extern qboolean lightmap_modified[MAX_LIGHTMAPS]; extern glpoly_t *lightmap_polys[MAX_LIGHTMAPS]; extern glRect_t lightmap_rectchange[MAX_LIGHTMAPS]; -void EmitWaterPolys (msurface_t *fa); - /* R_TextureAnimation diff --git a/libs/video/renderer/gl/gl_screen.c b/libs/video/renderer/gl/gl_screen.c index 5063f5f94..14fbcb1aa 100644 --- a/libs/video/renderer/gl/gl_screen.c +++ b/libs/video/renderer/gl/gl_screen.c @@ -139,8 +139,6 @@ float scr_disabled_time; qboolean block_drawing; -void SCR_ScreenShot_f (void); - /* CENTER PRINTING */ char scr_centerstring[1024]; @@ -347,22 +345,6 @@ SCR_SizeDown_f (void) vid.recalc_refdef = 1; } -void -SCR_Init (void) -{ - // register our commands - Cmd_AddCommand ("screenshot", SCR_ScreenShot_f, "Take a screenshot, " - "saves as qfxxx.tga in the current directory"); - Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increases the screen size"); - Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decreases the screen size"); - - scr_ram = Draw_PicFromWad ("ram"); - scr_net = Draw_PicFromWad ("net"); - scr_turtle = Draw_PicFromWad ("turtle"); - - scr_initialized = true; -} - void SCR_DrawRam (void) { @@ -862,3 +844,19 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs) GL_FlushText (); qfglFlush (); } + +void +SCR_Init (void) +{ + // register our commands + Cmd_AddCommand ("screenshot", SCR_ScreenShot_f, "Take a screenshot, " + "saves as qfxxx.tga in the current directory"); + Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increases the screen size"); + Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decreases the screen size"); + + scr_ram = Draw_PicFromWad ("ram"); + scr_net = Draw_PicFromWad ("net"); + scr_turtle = Draw_PicFromWad ("turtle"); + + scr_initialized = true; +} diff --git a/libs/video/renderer/gl/gl_warp.c b/libs/video/renderer/gl/gl_warp.c index 94f0ca247..5c4fd5ded 100644 --- a/libs/video/renderer/gl/gl_warp.c +++ b/libs/video/renderer/gl/gl_warp.c @@ -40,136 +40,6 @@ static const char rcsid[] = #include "QF/GL/defines.h" #include "QF/GL/funcs.h" -msurface_t *warpface; - - -void -BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs) -{ - float *v; - int i, j; - - mins[0] = mins[1] = mins[2] = 9999; - maxs[0] = maxs[1] = maxs[2] = -9999; - v = verts; - for (i = 0; i < numverts; i++) - for (j = 0; j < 3; j++, v++) { - if (*v < mins[j]) - mins[j] = *v; - if (*v > maxs[j]) - maxs[j] = *v; - } -} - -void -SubdividePolygon (int numverts, float *verts) -{ - float frac, m, s, t; - float dist[64]; - float *v; - int b, f, i, j, k; - glpoly_t *poly; - vec3_t mins, maxs; - vec3_t front[64], back[64]; - - if (numverts > 60) - Sys_Error ("numverts = %i", numverts); - - BoundPoly (numverts, verts, mins, maxs); - - for (i = 0; i < 3; i++) { - m = (mins[i] + maxs[i]) * 0.5; - m = gl_subdivide_size->value * floor (m / gl_subdivide_size->value + - 0.5); - if (maxs[i] - m < 8) - continue; - if (m - mins[i] < 8) - continue; - - // cut it - v = verts + i; - for (j = 0; j < numverts; j++, v += 3) - dist[j] = *v - m; - - // wrap cases - dist[j] = dist[0]; - v -= i; - VectorCopy (verts, v); - - f = b = 0; - v = verts; - for (j = 0; j < numverts; j++, v += 3) { - if (dist[j] >= 0) { - VectorCopy (v, front[f]); - f++; - } - if (dist[j] <= 0) { - VectorCopy (v, back[b]); - b++; - } - if (dist[j] == 0 || dist[j + 1] == 0) - continue; - if ((dist[j] > 0) != (dist[j + 1] > 0)) { - // clip point - frac = dist[j] / (dist[j] - dist[j + 1]); - for (k = 0; k < 3; k++) - front[f][k] = back[b][k] = v[k] + frac * (v[3 + k] - v[k]); - f++; - b++; - } - } - - SubdividePolygon (f, front[0]); - SubdividePolygon (b, back[0]); - return; - } - - poly = Hunk_Alloc (sizeof (glpoly_t) + (numverts - 4) * VERTEXSIZE * - sizeof (float)); - poly->next = warpface->polys; - warpface->polys = poly; - poly->numverts = numverts; - for (i = 0; i < numverts; i++, verts += 3) { - VectorCopy (verts, poly->verts[i]); - s = DotProduct (verts, warpface->texinfo->vecs[0]); - t = DotProduct (verts, warpface->texinfo->vecs[1]); - poly->verts[i][3] = s; - poly->verts[i][4] = t; - } -} - -/* - GL_SubdivideSurface - - Breaks a polygon up along axial 64 unit - boundaries so that turbulent and sky warps - can be done reasonably. -*/ -void -GL_SubdivideSurface (msurface_t *fa) -{ - float *vec; - int lindex, numverts, i; - vec3_t verts[64]; - - warpface = fa; - - // convert edges back to a normal polygon - numverts = 0; - for (i = 0; i < fa->numedges; i++) { - lindex = loadmodel->surfedges[fa->firstedge + i]; - - if (lindex > 0) - vec = loadmodel->vertexes[loadmodel->edges[lindex].v[0]].position; - else - vec = loadmodel->vertexes[loadmodel->edges[-lindex].v[1]].position; - VectorCopy (vec, verts[numverts]); - numverts++; - } - - SubdividePolygon (numverts, verts[0]); -} - // speed up sin calculations - Ed float turbsin[] = { # include "gl_warp_sin.h" diff --git a/libs/video/renderer/sw/d_polyse.c b/libs/video/renderer/sw/d_polyse.c index ae6851a47..8b72d9fd0 100644 --- a/libs/video/renderer/sw/d_polyse.c +++ b/libs/video/renderer/sw/d_polyse.c @@ -42,7 +42,7 @@ static const char rcsid[] = #define DPS_MAXSPANS MAXHEIGHT+1 // +1 for spanpackage marking end // !!! if this is changed, it must be changed in asm_draw.h too !!! -typedef struct { +typedef struct spanpackage_s { void *pdest; short *pz; int count; @@ -118,15 +118,6 @@ byte *skintable[MAX_LBM_HEIGHT]; int skinwidth; byte *skinstart; -void D_PolysetDrawSpans8 (spanpackage_t * pspanpackage); -void D_PolysetCalcGradients (int skinwidth); -void D_DrawSubdiv (void); -void D_DrawNonSubdiv (void); -void D_PolysetRecursiveTriangle (int *p1, int *p2, int *p3); -void D_PolysetSetEdgeTable (void); -void D_RasterizeAliasPolySmooth (void); -void D_PolysetScanLeftEdge (int height); - #ifdef PIC #undef USE_INTEL_ASM //XXX asm pic hack #endif diff --git a/libs/video/renderer/sw/d_scan.c b/libs/video/renderer/sw/d_scan.c index 94e62776d..1f9b132d8 100644 --- a/libs/video/renderer/sw/d_scan.c +++ b/libs/video/renderer/sw/d_scan.c @@ -42,9 +42,6 @@ fixed16_t r_turb_s, r_turb_t, r_turb_sstep, r_turb_tstep; int *r_turb_turb; int r_turb_spancount; -void D_DrawTurbulent8Span (void); - - /* D_WarpScreen diff --git a/libs/video/renderer/sw/screen.c b/libs/video/renderer/sw/screen.c index b6fab4ba8..af27da591 100644 --- a/libs/video/renderer/sw/screen.c +++ b/libs/video/renderer/sw/screen.c @@ -133,8 +133,6 @@ qboolean scr_skipupdate; qboolean block_drawing; -void SCR_ScreenShot_f (void); - /* CENTER PRINTING */ @@ -399,23 +397,6 @@ SCR_SizeDown_f (void) //============================================================================ -void -SCR_Init (void) -{ - // register our commands - Cmd_AddCommand ("screenshot", SCR_ScreenShot_f, "Take a screenshot and " - "write it as qfxxx.tga in the current directory"); - Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increase the size of the screen"); - Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decrease the size of the " - "screen"); - - scr_ram = Draw_PicFromWad ("ram"); - scr_net = Draw_PicFromWad ("net"); - scr_turtle = Draw_PicFromWad ("turtle"); - - scr_initialized = true; -} - void SCR_DrawRam (void) { @@ -907,3 +888,20 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs) VID_Update (&vrect); } } + +void +SCR_Init (void) +{ + // register our commands + Cmd_AddCommand ("screenshot", SCR_ScreenShot_f, "Take a screenshot and " + "write it as qfxxx.tga in the current directory"); + Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increase the size of the screen"); + Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decrease the size of the " + "screen"); + + scr_ram = Draw_PicFromWad ("ram"); + scr_net = Draw_PicFromWad ("net"); + scr_turtle = Draw_PicFromWad ("turtle"); + + scr_initialized = true; +} diff --git a/libs/video/renderer/sw/sw_raclip.c b/libs/video/renderer/sw/sw_raclip.c index 75ecf09d6..1afb71716 100644 --- a/libs/video/renderer/sw/sw_raclip.c +++ b/libs/video/renderer/sw/sw_raclip.c @@ -39,17 +39,6 @@ static const char rcsid[] = static finalvert_t fv[2][8]; static auxvert_t av[8]; -void R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av); -void R_Alias_clip_top (finalvert_t *pfv0, finalvert_t *pfv1, - finalvert_t *out); -void R_Alias_clip_bottom (finalvert_t *pfv0, finalvert_t *pfv1, - finalvert_t *out); -void R_Alias_clip_left (finalvert_t *pfv0, finalvert_t *pfv1, - finalvert_t *out); -void R_Alias_clip_right (finalvert_t *pfv0, finalvert_t *pfv1, - finalvert_t *out); - - /* R_Alias_clip_z diff --git a/libs/video/renderer/sw/sw_ralias.c b/libs/video/renderer/sw/sw_ralias.c index aea25b657..a99a96722 100644 --- a/libs/video/renderer/sw/sw_ralias.c +++ b/libs/video/renderer/sw/sw_ralias.c @@ -89,14 +89,6 @@ float r_avertexnormals[NUMVERTEXNORMALS][3] = { #include "anorms.h" }; -void R_AliasTransformAndProjectFinalVerts (finalvert_t *fv, - stvert_t *pstverts); -void R_AliasSetUpTransform (int trivial_accept); -void R_AliasTransformVector (vec3_t in, vec3_t out); -void R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av, - trivertx_t *pverts, stvert_t *pstverts); -void R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av); - qboolean R_AliasCheckBBox (void) { diff --git a/libs/video/renderer/sw/sw_redge.c b/libs/video/renderer/sw/sw_redge.c index d9af5989d..96aab0916 100644 --- a/libs/video/renderer/sw/sw_redge.c +++ b/libs/video/renderer/sw/sw_redge.c @@ -79,13 +79,6 @@ edge_t edge_sentinel; float fv; -void R_GenerateSpans (void); -void R_GenerateSpansBackward (void); -void R_LeadingEdge (edge_t *edge); -void R_LeadingEdgeBackwards (edge_t *edge); -void R_TrailingEdge (surf_t *surf, edge_t *edge); - - void R_DrawCulledPolys (void) { diff --git a/libs/video/renderer/sw/sw_rmain.c b/libs/video/renderer/sw/sw_rmain.c index 680168864..303f675a6 100644 --- a/libs/video/renderer/sw/sw_rmain.c +++ b/libs/video/renderer/sw/sw_rmain.c @@ -138,11 +138,6 @@ int d_lightstylevalue[256]; // 8.8 fraction of base light value float dp_time1, dp_time2, db_time1, db_time2, rw_time1, rw_time2; float se_time1, se_time2, de_time1, de_time2, dv_time1, dv_time2; -void R_MarkLeaves (void); - -void R_LoadSky_f (void); -void R_InitVars (void); - void R_Init (void) { diff --git a/libs/video/renderer/sw/sw_rsurf.c b/libs/video/renderer/sw/sw_rsurf.c index ea1144ac5..e8ab0c77e 100644 --- a/libs/video/renderer/sw/sw_rsurf.c +++ b/libs/video/renderer/sw/sw_rsurf.c @@ -51,11 +51,6 @@ int r_lightwidth; int r_numhblocks, r_numvblocks; unsigned char *r_source, *r_sourcemax; -void R_DrawSurfaceBlock_mip0 (void); -void R_DrawSurfaceBlock_mip1 (void); -void R_DrawSurfaceBlock_mip2 (void); -void R_DrawSurfaceBlock_mip3 (void); - static void (*surfmiptable[4]) (void) = { R_DrawSurfaceBlock_mip0, R_DrawSurfaceBlock_mip1, R_DrawSurfaceBlock_mip2, R_DrawSurfaceBlock_mip3}; diff --git a/libs/video/renderer/sw32/d_polyse.c b/libs/video/renderer/sw32/d_polyse.c index e28414682..83cb00171 100644 --- a/libs/video/renderer/sw32/d_polyse.c +++ b/libs/video/renderer/sw32/d_polyse.c @@ -115,26 +115,53 @@ static adivtab_t adivtab[32 * 32] = { #include "adivtab.h" }; -void D_PolysetDrawSpans (spanpackage_t * pspanpackage); -void D_PolysetCalcGradients (int skinwidth); -void D_DrawNonSubdiv (void); -void D_PolysetSetEdgeTable (void); -void D_RasterizeAliasPolySmooth (void); -void D_PolysetScanLeftEdge (int height); - void -D_PolysetDraw (void) +D_PolysetSetEdgeTable (void) { - spanpackage_t spans[DPS_MAXSPANS + 1 + - ((CACHE_SIZE - 1) / sizeof (spanpackage_t)) + 1]; + int edgetableindex; - // one extra because of cache line pretouching + // assume the vertices are already in top to bottom order + edgetableindex = 0; - a_spans = (spanpackage_t *) - (((long) &spans[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1)); + // determine which edges are right & left, and the order in which + // to rasterize them + if (r_p0[1] >= r_p1[1]) { + if (r_p0[1] == r_p1[1]) { + if (r_p0[1] < r_p2[1]) + pedgetable = &edgetables[2]; + else + pedgetable = &edgetables[5]; - D_DrawNonSubdiv (); + return; + } else { + edgetableindex = 1; + } + } + + if (r_p0[1] == r_p2[1]) { + if (edgetableindex) + pedgetable = &edgetables[8]; + else + pedgetable = &edgetables[9]; + + return; + } else if (r_p1[1] == r_p2[1]) { + if (edgetableindex) + pedgetable = &edgetables[10]; + else + pedgetable = &edgetables[11]; + + return; + } + + if (r_p0[1] > r_p2[1]) + edgetableindex += 2; + + if (r_p1[1] > r_p2[1]) + edgetableindex += 4; + + pedgetable = &edgetables[edgetableindex]; } void @@ -196,6 +223,20 @@ D_DrawNonSubdiv (void) } } +void +D_PolysetDraw (void) +{ + spanpackage_t spans[DPS_MAXSPANS + 1 + + ((CACHE_SIZE - 1) / sizeof (spanpackage_t)) + 1]; + + // one extra because of cache line pretouching + + a_spans = (spanpackage_t *) + (((long) &spans[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1)); + + D_DrawNonSubdiv (); +} + void D_PolysetScanLeftEdge (int height) { @@ -756,52 +797,3 @@ D_RasterizeAliasPolySmooth (void) D_PolysetDrawSpans (pstart); } } - - -void -D_PolysetSetEdgeTable (void) -{ - int edgetableindex; - - // assume the vertices are already in top to bottom order - edgetableindex = 0; - - // determine which edges are right & left, and the order in which - // to rasterize them - if (r_p0[1] >= r_p1[1]) { - if (r_p0[1] == r_p1[1]) { - if (r_p0[1] < r_p2[1]) - pedgetable = &edgetables[2]; - else - pedgetable = &edgetables[5]; - - return; - } else { - edgetableindex = 1; - } - } - - if (r_p0[1] == r_p2[1]) { - if (edgetableindex) - pedgetable = &edgetables[8]; - else - pedgetable = &edgetables[9]; - - return; - } else if (r_p1[1] == r_p2[1]) { - if (edgetableindex) - pedgetable = &edgetables[10]; - else - pedgetable = &edgetables[11]; - - return; - } - - if (r_p0[1] > r_p2[1]) - edgetableindex += 2; - - if (r_p1[1] > r_p2[1]) - edgetableindex += 4; - - pedgetable = &edgetables[edgetableindex]; -} diff --git a/libs/video/renderer/sw32/d_scan.c b/libs/video/renderer/sw32/d_scan.c index 04aa25f20..f136b7826 100644 --- a/libs/video/renderer/sw32/d_scan.c +++ b/libs/video/renderer/sw32/d_scan.c @@ -45,10 +45,6 @@ fixed16_t r_turb_s, r_turb_t, r_turb_sstep, r_turb_tstep; int *r_turb_turb; int r_turb_spancount; -void D_DrawTurbulentSpan (void); - - - /* D_WarpScreen diff --git a/libs/video/renderer/sw32/screen.c b/libs/video/renderer/sw32/screen.c index 0fe467c8b..32a19e4cd 100644 --- a/libs/video/renderer/sw32/screen.c +++ b/libs/video/renderer/sw32/screen.c @@ -133,8 +133,6 @@ qboolean scr_skipupdate; qboolean block_drawing; -void SCR_ScreenShot_f (void); - /* CENTER PRINTING */ @@ -466,23 +464,6 @@ SCR_SizeDown_f (void) //============================================================================ -void -SCR_Init (void) -{ - // register our commands - Cmd_AddCommand ("screenshot", SCR_ScreenShot_f, "Take a screenshot and " - "write it as qfxxx.tga in the current directory"); - Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increase the size of the screen"); - Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decrease the size of the " - "screen"); - - scr_ram = Draw_PicFromWad ("ram"); - scr_net = Draw_PicFromWad ("net"); - scr_turtle = Draw_PicFromWad ("turtle"); - - scr_initialized = true; -} - void SCR_DrawRam (void) { @@ -925,3 +906,20 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs) VID_Update (&vrect); } } + +void +SCR_Init (void) +{ + // register our commands + Cmd_AddCommand ("screenshot", SCR_ScreenShot_f, "Take a screenshot and " + "write it as qfxxx.tga in the current directory"); + Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increase the size of the screen"); + Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decrease the size of the " + "screen"); + + scr_ram = Draw_PicFromWad ("ram"); + scr_net = Draw_PicFromWad ("net"); + scr_turtle = Draw_PicFromWad ("turtle"); + + scr_initialized = true; +} diff --git a/libs/video/renderer/sw32/sw32_raclip.c b/libs/video/renderer/sw32/sw32_raclip.c index 1085cedc2..ee81b4fbe 100644 --- a/libs/video/renderer/sw32/sw32_raclip.c +++ b/libs/video/renderer/sw32/sw32_raclip.c @@ -39,17 +39,6 @@ static const char rcsid[] = static finalvert_t fv[2][8]; static auxvert_t av[8]; -void R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av); -void R_Alias_clip_top (finalvert_t *pfv0, finalvert_t *pfv1, - finalvert_t *out); -void R_Alias_clip_bottom (finalvert_t *pfv0, finalvert_t *pfv1, - finalvert_t *out); -void R_Alias_clip_left (finalvert_t *pfv0, finalvert_t *pfv1, - finalvert_t *out); -void R_Alias_clip_right (finalvert_t *pfv0, finalvert_t *pfv1, - finalvert_t *out); - - /* R_Alias_clip_z diff --git a/libs/video/renderer/sw32/sw32_ralias.c b/libs/video/renderer/sw32/sw32_ralias.c index 0b2b38246..ddaeadc95 100644 --- a/libs/video/renderer/sw32/sw32_ralias.c +++ b/libs/video/renderer/sw32/sw32_ralias.c @@ -89,15 +89,6 @@ float r_avertexnormals[NUMVERTEXNORMALS][3] = { #include "anorms.h" }; -void R_AliasTransformAndProjectFinalVerts (finalvert_t *fv, - stvert_t *pstverts); -void R_AliasSetUpTransform (int trivial_accept); -void R_AliasTransformVector (vec3_t in, vec3_t out); -void R_AliasTransformFinalVert (finalvert_t *fv, auxvert_t *av, - trivertx_t *pverts, stvert_t *pstverts); -void R_AliasProjectFinalVert (finalvert_t *fv, auxvert_t *av); - - qboolean R_AliasCheckBBox (void) { diff --git a/libs/video/renderer/sw32/sw32_redge.c b/libs/video/renderer/sw32/sw32_redge.c index e9ce3dff0..047c20d4e 100644 --- a/libs/video/renderer/sw32/sw32_redge.c +++ b/libs/video/renderer/sw32/sw32_redge.c @@ -79,13 +79,6 @@ edge_t edge_sentinel; float fv; -void R_GenerateSpans (void); -void R_GenerateSpansBackward (void); -void R_LeadingEdge (edge_t *edge); -void R_LeadingEdgeBackwards (edge_t *edge); -void R_TrailingEdge (surf_t *surf, edge_t *edge); - - void R_DrawCulledPolys (void) { diff --git a/libs/video/renderer/sw32/sw32_rmain.c b/libs/video/renderer/sw32/sw32_rmain.c index d724637aa..247e56d41 100644 --- a/libs/video/renderer/sw32/sw32_rmain.c +++ b/libs/video/renderer/sw32/sw32_rmain.c @@ -135,11 +135,6 @@ int d_lightstylevalue[256]; // 8.8 fraction of base light value float dp_time1, dp_time2, db_time1, db_time2, rw_time1, rw_time2; float se_time1, se_time2, de_time1, de_time2, dv_time1, dv_time2; -void R_LoadSky_f (void); -void R_MarkLeaves (void); -void CreatePassages (void); -void SetVisibilityByPassages (void); - cvar_t *r_draworder; diff --git a/libs/video/renderer/sw32/sw32_rsurf.c b/libs/video/renderer/sw32/sw32_rsurf.c index 4b5cfc395..dd16aa70f 100644 --- a/libs/video/renderer/sw32/sw32_rsurf.c +++ b/libs/video/renderer/sw32/sw32_rsurf.c @@ -52,19 +52,6 @@ int r_lightwidth; int r_numhblocks, r_numvblocks; byte *r_source, *r_sourcemax; -void R_DrawSurfaceBlock8_mip0 (void); -void R_DrawSurfaceBlock8_mip1 (void); -void R_DrawSurfaceBlock8_mip2 (void); -void R_DrawSurfaceBlock8_mip3 (void); -void R_DrawSurfaceBlock16_mip0 (void); -void R_DrawSurfaceBlock16_mip1 (void); -void R_DrawSurfaceBlock16_mip2 (void); -void R_DrawSurfaceBlock16_mip3 (void); -void R_DrawSurfaceBlock32_mip0 (void); -void R_DrawSurfaceBlock32_mip1 (void); -void R_DrawSurfaceBlock32_mip2 (void); -void R_DrawSurfaceBlock32_mip3 (void); - static void (*surfmiptable8[4]) (void) = { R_DrawSurfaceBlock8_mip0, R_DrawSurfaceBlock8_mip1, diff --git a/libs/video/targets/fbset.c b/libs/video/targets/fbset.c index 1472c212d..1243848d3 100644 --- a/libs/video/targets/fbset.c +++ b/libs/video/targets/fbset.c @@ -189,24 +189,18 @@ struct VideoMode Current; /* Function Prototypes */ -int OpenFrameBuffer(const char *name); -void CloseFrameBuffer(int fh); -int GetVarScreenInfo(int fh, struct fb_var_screeninfo *var); -int SetVarScreenInfo(int fh, struct fb_var_screeninfo *var); -int GetFixScreenInfo(int fh, struct fb_fix_screeninfo *fix); -void ConvertFromVideoMode(const struct VideoMode *vmode, - struct fb_var_screeninfo *var); -void ConvertToVideoMode(const struct fb_var_screeninfo *var, - struct VideoMode *vmode); +static int OpenFrameBuffer(const char *name); +static void CloseFrameBuffer(int fh); +static int GetVarScreenInfo(int fh, struct fb_var_screeninfo *var); +static int SetVarScreenInfo(int fh, struct fb_var_screeninfo *var); +static int GetFixScreenInfo(int fh, struct fb_fix_screeninfo *fix); static int atoboolean(const char *var); -void ReadModeDB(void); struct VideoMode *FindVideoMode(const char *name); static void ModifyVideoMode(struct VideoMode *vmode); static void DisplayVModeInfo(struct VideoMode *vmode); static void DisplayFBInfo(struct fb_fix_screeninfo *fix); static int FillScanRates(struct VideoMode *vmode); static void Usage(void); -int main(int argc, char *argv[]); #define Die Sys_Printf diff --git a/libs/video/targets/in_win.c b/libs/video/targets/in_win.c index 032225af4..6de4d5bca 100644 --- a/libs/video/targets/in_win.c +++ b/libs/video/targets/in_win.c @@ -58,8 +58,6 @@ HRESULT (WINAPI * pDirectInputCreate) (HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUT * lplpDirectInput, LPUNKNOWN punkOuter); -void VID_UpdateWindowStatus (int window_x, int window_y); - extern qboolean win_canalttab; extern DEVMODE win_gdevmode; diff --git a/libs/video/targets/joy_win.c b/libs/video/targets/joy_win.c index 66007a78e..1f3623050 100644 --- a/libs/video/targets/joy_win.c +++ b/libs/video/targets/joy_win.c @@ -112,11 +112,6 @@ int joy_id; DWORD joy_flags; DWORD joy_numbuttons; -void JOY_AdvancedUpdate_f (void); -int JOY_StartupJoystick (void); -PDWORD RawValuePointer (int axis); - - qboolean _JOY_Read (void) { diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index 71c23bfa4..ad3bdca85 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -73,11 +73,6 @@ static const char rcsid[] = typedef struct tfxMesaContext *fxMesaContext; -typedef long FxI32; -typedef FxI32 GrScreenResolution_t; -typedef FxI32 GrDitherMode_t; -typedef FxI32 GrScreenRefresh_t; - #define GR_REFRESH_75Hz 0x3 #define GR_DITHER_2x2 0x1 @@ -101,9 +96,6 @@ void (* qf_fxMesaSwapBuffers) (void); fxMesaContext (* qf_fxMesaCreateContext) (GLuint win, GrScreenResolution_t, GrScreenRefresh_t, const GLint attribList[]); void (* qf_fxMesaMakeCurrent) (fxMesaContext ctx); -// FIXME!!!!! This belongs in include/qfgl_ext.h -- deek -typedef void (GLAPIENTRY * QF_3DfxSetDitherModeEXT) (GrDitherMode_t mode); - static fxMesaContext fc = NULL; int VID_options_items = 0; diff --git a/libs/video/targets/vid_ext.c b/libs/video/targets/vid_ext.c index 5ec2d1d89..b3cb94344 100644 --- a/libs/video/targets/vid_ext.c +++ b/libs/video/targets/vid_ext.c @@ -1,4 +1,3 @@ - /* vid_ext.c @@ -134,12 +133,6 @@ static int totalvidmem; static byte *ppal; qboolean vsync_exists, de_exists; -qboolean VID_ExtraGetModeInfo (int modenum); -int VID_ExtraInitMode (viddef_t *vid, vmode_t * pcurrentmode); -void VID_ExtraSwapBuffers (viddef_t *vid, vmode_t * pcurrentmode, - - vrect_t *rects); - /* ================ diff --git a/libs/video/targets/vid_fbdev.c b/libs/video/targets/vid_fbdev.c index c570a58e1..ffa02b2f2 100644 --- a/libs/video/targets/vid_fbdev.c +++ b/libs/video/targets/vid_fbdev.c @@ -75,15 +75,6 @@ static const char rcsid[] = #include "fbset.h" -void ConvertFromVideoMode(const struct VideoMode *vmode, - struct fb_var_screeninfo *var); -void ConvertToVideoMode(const struct fb_var_screeninfo *var, - struct VideoMode *vmode); -struct VideoMode *FindVideoMode(const char *name); -extern struct VideoMode *VideoModes; -int fbset_main (int argc, const char *argv[]); -void ReadModeDB (void); - static struct VideoMode current_mode; static char current_name[32]; static int num_modes; @@ -204,9 +195,6 @@ VID_NumModes_f (void) Con_Printf ("%d modes\n", VID_NumModes ()); } -int VID_SetMode (const char *name, unsigned char *palette); - - static void VID_fbset_f (void) { diff --git a/libs/video/targets/vid_svgalib.c b/libs/video/targets/vid_svgalib.c index 92cbaf634..ffc396439 100644 --- a/libs/video/targets/vid_svgalib.c +++ b/libs/video/targets/vid_svgalib.c @@ -63,9 +63,6 @@ static const char rcsid[] = #include "compat.h" -void VGA_UpdatePlanarScreen (void *srcbuffer); - - static int num_modes, current_mode; static vga_modeinfo *modes; diff --git a/libs/video/targets/vid_x11.c b/libs/video/targets/vid_x11.c index 213ca1bb9..826ee8acc 100644 --- a/libs/video/targets/vid_x11.c +++ b/libs/video/targets/vid_x11.c @@ -82,9 +82,6 @@ static const char rcsid[] = static Colormap x_cmap; static GC x_gc; -int XShmQueryExtension (Display *); -int XShmGetEventBase (Display *); - static qboolean doShm; static XShmSegmentInfo x_shminfo[2]; diff --git a/nq/include/client.h b/nq/include/client.h index 369429e0d..78bd76998 100644 --- a/nq/include/client.h +++ b/nq/include/client.h @@ -322,6 +322,7 @@ int CL_ReadFromServer (void); void CL_WriteToServer (usercmd_t *cmd); void CL_BaseMove (usercmd_t *cmd); +float CL_KeyState (kbutton_t *key); // cl_demo.c void CL_StopPlayback (void); diff --git a/nq/source/cl_cam.c b/nq/source/cl_cam.c index 32f441d14..319836976 100644 --- a/nq/source/cl_cam.c +++ b/nq/source/cl_cam.c @@ -40,9 +40,6 @@ static const char rcsid[] = #include "QF/keys.h" #include "QF/input.h" -float CL_KeyState (kbutton_t *key); -qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, - vec3_t p1, vec3_t p2, trace_t *trace); vec3_t camera_origin = {0,0,0}; vec3_t camera_angles = {0,0,0}; diff --git a/nq/source/cl_demo.c b/nq/source/cl_demo.c index 7d2c20af3..963d801a8 100644 --- a/nq/source/cl_demo.c +++ b/nq/source/cl_demo.c @@ -54,7 +54,7 @@ static const char rcsid[] = char demoname[1024]; int timedemo_count; -void CL_FinishTimeDemo (void); +static void CL_FinishTimeDemo (void); cvar_t *demo_gzip; cvar_t *demo_speed; @@ -360,7 +360,7 @@ CL_StartTimeDemo (void) cls.td_lastframe = -1; // get a new message this frame } -void +static void CL_FinishTimeDemo (void) { int frames; diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index 4131c7782..8f68121c7 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -218,7 +218,8 @@ CL_KeepaliveMessage (void) SZ_Clear (&cls.message); } -void CL_NewMap (const char *mapname) +void +CL_NewMap (const char *mapname) { char *name = malloc (strlen (mapname) + 4 + 1); diff --git a/nq/source/com.c b/nq/source/com.c index 847861a5e..647a82ded 100644 --- a/nq/source/com.c +++ b/nq/source/com.c @@ -38,8 +38,7 @@ static const char rcsid[] = #include "QF/quakefs.h" #include "game.h" - -void Cvar_Info (struct cvar_s *var); +#include "server.h" cvar_t *registered; cvar_t *cmdline; diff --git a/nq/source/conproc.c b/nq/source/conproc.c index 7c88cc1fc..7fa48bcdd 100644 --- a/nq/source/conproc.c +++ b/nq/source/conproc.c @@ -1,4 +1,3 @@ - /* conproc.c diff --git a/nq/source/host_cmd.c b/nq/source/host_cmd.c index ffe9e8b05..afb801d9e 100644 --- a/nq/source/host_cmd.c +++ b/nq/source/host_cmd.c @@ -52,9 +52,6 @@ static const char rcsid[] = int current_skill; -void Mod_Print (void); - - void Host_Quit_f (void) { diff --git a/nq/source/locs.c b/nq/source/locs.c index 384288aae..ac3f4a1cd 100644 --- a/nq/source/locs.c +++ b/nq/source/locs.c @@ -59,8 +59,6 @@ int locations_alloced = 0; int locations_count = 0; int location_blocks = 0; -void locs_more (void); - int locs_nearest (const vec3_t loc) { @@ -89,6 +87,24 @@ locs_find (const vec3_t target) return locations[i]; } +void +locs_more (void) +{ + size_t size; + + location_blocks++; + locations_alloced += LOCATION_BLOCK; + size = (sizeof (location_t *) * LOCATION_BLOCK * location_blocks); + + if (locations) + locations = realloc (locations, size); + else + locations = malloc (size); + + if (!locations) + Sys_Error ("ERROR! Can not alloc memory for location block!"); +} + void locs_add (const vec3_t location, const char *name) { @@ -174,24 +190,6 @@ locs_reset (void) locations = NULL; } -void -locs_more (void) -{ - size_t size; - - location_blocks++; - locations_alloced += LOCATION_BLOCK; - size = (sizeof (location_t *) * LOCATION_BLOCK * location_blocks); - - if (locations) - locations = realloc (locations, size); - else - locations = malloc (size); - - if (!locations) - Sys_Error ("ERROR! Can not alloc memory for location block!"); -} - void locs_save (const char *filename, qboolean gz) { diff --git a/nq/source/mplib.c b/nq/source/mplib.c index fdb882600..a613883ff 100644 --- a/nq/source/mplib.c +++ b/nq/source/mplib.c @@ -1,4 +1,3 @@ - /* mplib.c diff --git a/nq/source/mplpc.c b/nq/source/mplpc.c index fd4694df8..6315825d6 100644 --- a/nq/source/mplpc.c +++ b/nq/source/mplpc.c @@ -1,4 +1,3 @@ - /* mplpc.c diff --git a/nq/source/sbar.c b/nq/source/sbar.c index 23216cfa4..37aacbb03 100644 --- a/nq/source/sbar.c +++ b/nq/source/sbar.c @@ -90,10 +90,6 @@ qpic_t *hsb_items[2]; // MED 01/04/97 added hipnotic items array qboolean headsup; qboolean sbar_centered; -void Sbar_MiniDeathmatchOverlay (void); -void Sbar_DeathmatchOverlay (void); - - int Sbar_ColorForMap (int m) { @@ -392,7 +388,7 @@ Sbar_DrawScoreboard (void) { Sbar_SoloScoreboard (); if (cl.gametype == GAME_DEATHMATCH) - Sbar_DeathmatchOverlay (); + Sbar_DeathmatchOverlay (0); } @@ -905,7 +901,7 @@ Sbar_IntermissionNumber (int x, int y, int num, int digits, int color) void -Sbar_DeathmatchOverlay (void) +Sbar_DeathmatchOverlay (int start) { qpic_t *pic; int i, k, l; @@ -1045,7 +1041,7 @@ Sbar_IntermissionOverlay (void) scr_fullupdate = 0; if (cl.gametype == GAME_DEATHMATCH) { - Sbar_DeathmatchOverlay (); + Sbar_DeathmatchOverlay (0); return; } diff --git a/nq/source/sv_model.c b/nq/source/sv_model.c index f39e25c1f..6be81886b 100644 --- a/nq/source/sv_model.c +++ b/nq/source/sv_model.c @@ -37,16 +37,13 @@ static const char rcsid[] = int mod_lightmap_bytes = 1; -void Mod_LoadBrushModel (model_t *mod, void *buffer); - - void Mod_LoadLighting (lump_t *l) { } void -Mod_LoadAliasModel (model_t *mod, void *buf) +Mod_LoadAliasModel (model_t *mod, void *buf, cache_allocator_t allocator) { } @@ -76,6 +73,6 @@ Mod_LoadExternalTextures (model_t *mod) } void -GL_SubdivideSurface (msurface_t *fa) +Mod_SubdivideSurface (msurface_t *fa) { } diff --git a/qw/include/cl_input.h b/qw/include/cl_input.h index 0ea907806..cb6e6e6fa 100644 --- a/qw/include/cl_input.h +++ b/qw/include/cl_input.h @@ -47,6 +47,8 @@ int CL_ReadFromServer (void); void CL_WriteToServer (usercmd_t *cmd); void CL_BaseMove (usercmd_t *cmd); +float CL_KeyState (kbutton_t *key); + extern kbutton_t in_left, in_right, in_forward, in_back; extern kbutton_t in_lookup, in_lookdown, in_moveleft, in_moveright; extern kbutton_t in_use, in_jump, in_attack; diff --git a/qw/include/client.h b/qw/include/client.h index 3e60cc4bf..12f666f66 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -364,6 +364,8 @@ void V_PrepBlend (void); void CL_Cmd_ForwardToServer (void); void CL_Cmd_Init (void); +void CL_RSShot_f (void); + #define RSSHOT_WIDTH 320 #define RSSHOT_HEIGHT 200 diff --git a/qw/include/net.h b/qw/include/net.h index 56e80f2bf..62dafd688 100644 --- a/qw/include/net.h +++ b/qw/include/net.h @@ -137,6 +137,8 @@ int Net_Log_Init (const char **sound_precache); void Log_Incoming_Packet (const char *p, int len); void Log_Outgoing_Packet (const char *p, int len); void Net_LogStop (void); +void Analyze_Client_Packet (const byte * data, int len); +void Analyze_Server_Packet (const byte * data, int len); extern struct cvar_s *net_packetlog; diff --git a/qw/include/pmove.h b/qw/include/pmove.h index 4dec647c8..f26942f9a 100644 --- a/qw/include/pmove.h +++ b/qw/include/pmove.h @@ -114,6 +114,10 @@ extern int watertype; extern vec3_t player_mins; extern vec3_t player_maxs; +void PM_Accelerate (vec3_t wishdir, float wishspeed, float accel); +void PM_CategorizePosition (void); +void PM_InitBoxHull (void); + void PlayerMove (void); void Pmove_Init (void); void Pmove_Init_Cvars (void); diff --git a/qw/include/server.h b/qw/include/server.h index 84d7beff1..b94eaa2d3 100644 --- a/qw/include/server.h +++ b/qw/include/server.h @@ -458,6 +458,7 @@ void SV_FinalMessage (const char *message); void SV_DropClient (client_t *drop); int SV_CalcPing (client_t *cl); void SV_FullClientUpdate (client_t *client, sizebuf_t *buf); +void SV_FullClientUpdateToClient (client_t *client, client_t *cl); int SV_ModelIndex (const char *name); diff --git a/qw/include/sv_demo.h b/qw/include/sv_demo.h index 0e4ee4a9c..3cd16c041 100644 --- a/qw/include/sv_demo.h +++ b/qw/include/sv_demo.h @@ -127,5 +127,6 @@ void SV_Stop (int reason); void DemoSetMsgBuf (demobuf_t * prev, demobuf_t * cur); void Demo_Init (void); void SV_DemoPings (void); +void SV_WriteDemoMessage (sizebuf_t *msg, int type, int to, float time); #endif//__sv_demo_h diff --git a/qw/source/cl_cam.c b/qw/source/cl_cam.c index 52c695ceb..dc29da77c 100644 --- a/qw/source/cl_cam.c +++ b/qw/source/cl_cam.c @@ -68,8 +68,6 @@ static const char rcsid[] = #include "QF/mathlib.h" #include "world.h" -float CL_KeyState (kbutton_t *key); - vec3_t camera_origin = {0,0,0}; vec3_t camera_angles = {0,0,0}; vec3_t player_origin = {0,0,0}; diff --git a/qw/source/cl_demo.c b/qw/source/cl_demo.c index 7526b3e9e..1a7bfcc6a 100644 --- a/qw/source/cl_demo.c +++ b/qw/source/cl_demo.c @@ -78,9 +78,9 @@ int timedemo_runs; td_stats_t *timedemo_data; -void CL_FinishTimeDemo (void); -void CL_TimeFrames_Reset (void); -void CL_TimeFrames_DumpLog (void); +static void CL_FinishTimeDemo (void); +static void CL_TimeFrames_Reset (void); +static void CL_TimeFrames_DumpLog (void); cvar_t *demo_speed; cvar_t *demo_gzip; @@ -945,7 +945,7 @@ sqr (double x) return x * x; } -void +static void CL_FinishTimeDemo (void) { float time; @@ -1042,7 +1042,7 @@ CL_Demo_Init (void) "< 1 slow-mo, > 1 timelapse"); } -void +static void CL_TimeFrames_Reset (void) { cl_timeframes_index = 0; @@ -1067,7 +1067,8 @@ CL_TimeFrames_AddTimestamp (void) return; } -void CL_TimeFrames_DumpLog (void) +static void +CL_TimeFrames_DumpLog (void) { char e_path[MAX_OSPATH]; char *filename = "timeframes.txt"; diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 42a90e5f1..89fa7ad87 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -112,8 +112,6 @@ static plugin_list_t client_plugin_list[] = { CLIENT_PLUGIN_LIST }; -void CL_RemoveQFInfoKeys (); - // we need to declare some mouse variables here, because the menu system // references them even when on a unix system. @@ -217,8 +215,6 @@ int fps_count; jmp_buf host_abort; -void Master_Connect_f (void); - char *server_version = NULL; // version of server we connected to char emodel_name[] = "emodel"; @@ -227,8 +223,6 @@ char prespawn_name[] = "prespawn %i 0 %i"; char modellist_name[] = "modellist %i %i"; char soundlist_name[] = "soundlist %i %i"; -void CL_RSShot_f (void); - extern cvar_t *cl_showscoresuid; @@ -442,6 +436,14 @@ CL_StopCshifts (void) cl.stats[i] = 0; } +void +CL_RemoveQFInfoKeys (void) +{ + Info_RemoveKey (cls.userinfo, "*cap"); + Info_RemoveKey (cls.userinfo, "*qf_version"); + Info_RemoveKey (cls.userinfo, "*qsg_version"); +} + /* CL_Disconnect @@ -658,14 +660,6 @@ CL_AddQFInfoKeys (void) Info_SetValueForStarKey (cls.userinfo, "*qsg_version", QW_QSG_VERSION, 0); } -void -CL_RemoveQFInfoKeys (void) -{ - Info_RemoveKey (cls.userinfo, "*cap"); - Info_RemoveKey (cls.userinfo, "*qf_version"); - Info_RemoveKey (cls.userinfo, "*qsg_version"); -} - /* CL_FullInfo_f diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index e50033649..08dcd9a99 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -48,6 +48,7 @@ static const char rcsid[] = #include "QF/cmd.h" #include "QF/console.h" #include "QF/cvar.h" +#include "QF/draw.h" #include "QF/hash.h" #include "QF/msg.h" #include "QF/quakeio.h" @@ -252,7 +253,8 @@ CL_CheckOrDownloadFile (const char *filename) return false; } -void CL_NewMap (const char *mapname) +void +CL_NewMap (const char *mapname) { char *name = malloc (strlen (mapname) + 4 + 1); @@ -611,8 +613,21 @@ CL_StopUpload (void) // SERVER CONNECTING MESSAGES ================================================= -void Draw_ClearCache (void); -void CL_ClearBaselines (void); // LordHavoc: BIG BUG-FIX! +// LordHavoc: BIG BUG-FIX! Clear baselines each time it connects... +void +CL_ClearBaselines (void) +{ + int i; + + memset (cl_baselines, 0, sizeof (cl_baselines)); + for (i = 0; i < MAX_EDICTS; i++) { + cl_baselines[i].colormod = 255; + cl_baselines[i].alpha = 255; + cl_baselines[i].scale = 16; + cl_baselines[i].glow_size = 0; + cl_baselines[i].glow_color = 254; + } +} void CL_ParseServerData (void) @@ -718,22 +733,6 @@ CL_ParseServerData (void) CL_ClearBaselines (); } -// LordHavoc: BIG BUG-FIX! Clear baselines each time it connects... -void -CL_ClearBaselines (void) -{ - int i; - - memset (cl_baselines, 0, sizeof (cl_baselines)); - for (i = 0; i < MAX_EDICTS; i++) { - cl_baselines[i].colormod = 255; - cl_baselines[i].alpha = 255; - cl_baselines[i].scale = 16; - cl_baselines[i].glow_size = 0; - cl_baselines[i].glow_color = 254; - } -} - void CL_ParseSoundlist (void) { @@ -1196,8 +1195,6 @@ CL_MuzzleFlash (void) int received_framecount; -void Sbar_LogFrags(void); - void CL_ParseServerMessage (void) { diff --git a/qw/source/cl_slist.c b/qw/source/cl_slist.c index 6c71c3a60..f67bcb11a 100644 --- a/qw/source/cl_slist.c +++ b/qw/source/cl_slist.c @@ -365,7 +365,8 @@ gettoklen (char *str, int req, char delim) return len; } -void timepassed (double time1, double *time2) +void +timepassed (double time1, double *time2) { *time2 -= time1; } @@ -648,7 +649,8 @@ SL_LoadF (QFile *f, server_entry_t *start) } } -void SL_Init (void) +void +SL_Init (void) { char e_path[MAX_OSPATH]; QFile *servlist; diff --git a/qw/source/com.c b/qw/source/com.c index 95560b580..b6bbafaad 100644 --- a/qw/source/com.c +++ b/qw/source/com.c @@ -45,9 +45,6 @@ int static_registered = 1; // only for startup check, then set qboolean com_modified; // set true if using non-id files -void COM_Path_f (void); - - /* COM_CheckRegistered diff --git a/qw/source/crudefile.c b/qw/source/crudefile.c index 48ad32183..3e2ec584f 100644 --- a/qw/source/crudefile.c +++ b/qw/source/crudefile.c @@ -403,7 +403,8 @@ CF_EOF (int desc) cfquota returns the number of characters left in the quota, or <= 0 if it's met or (somehow) exceeded. */ -int CF_Quota() +int +CF_Quota() { return cf_maxsize - cf_cursize; } diff --git a/qw/source/locs.c b/qw/source/locs.c index 9f6bf682b..682975c37 100644 --- a/qw/source/locs.c +++ b/qw/source/locs.c @@ -59,8 +59,6 @@ int locations_alloced = 0; int locations_count = 0; int location_blocks = 0; -void locs_more (void); - int locs_nearest (const vec3_t loc) { @@ -90,6 +88,24 @@ locs_find (const vec3_t target) return locations[i]; } +void +locs_more (void) +{ + size_t size; + + location_blocks++; + locations_alloced += LOCATION_BLOCK; + size = (sizeof (location_t *) * LOCATION_BLOCK * location_blocks); + + if (locations) + locations = realloc (locations, size); + else + locations = malloc (size); + + if (!locations) + Sys_Error ("ERROR! Can not alloc memory for location block!"); +} + void locs_add (const vec3_t location, const char *name) { @@ -174,24 +190,6 @@ locs_reset (void) locations = NULL; } -void -locs_more (void) -{ - size_t size; - - location_blocks++; - locations_alloced += LOCATION_BLOCK; - size = (sizeof (location_t *) * LOCATION_BLOCK * location_blocks); - - if (locations) - locations = realloc (locations, size); - else - locations = malloc (size); - - if (!locations) - Sys_Error ("ERROR! Can not alloc memory for location block!"); -} - void locs_save (const char *filename, qboolean gz) { diff --git a/qw/source/net_chan.c b/qw/source/net_chan.c index b5a0c1961..ca08fb796 100644 --- a/qw/source/net_chan.c +++ b/qw/source/net_chan.c @@ -227,7 +227,7 @@ Netchan_CanReliable (netchan_t *chan) return Netchan_CanPacket (chan); } -qboolean ServerPaused (void); +qboolean ServerPaused (void); //FIXME /* Netchan_Transmit diff --git a/qw/source/net_packetlog.c b/qw/source/net_packetlog.c index f53ba906d..503997b7a 100644 --- a/qw/source/net_packetlog.c +++ b/qw/source/net_packetlog.c @@ -62,14 +62,6 @@ static const char rcsid[] = cvar_t *net_packetlog; cvar_t *net_loglevel; -int Net_LogStart (const char *fname); - -void Analyze_Server_Packet (const byte * data, int len); -void Analyze_Client_Packet (const byte * data, int len); -void Parse_Server_Packet (void); -void Parse_Client_Packet (void); -void Net_LogStop (void); - // note: this is SUPPOSED to be duplicate, like many others const char *svc_string[] = { "svc_bad", @@ -381,19 +373,6 @@ Log_Delta(int bits) return; } -void -Analyze_Server_Packet (const byte * data, int len) -{ - if (!Net_PacketLog) - Net_PacketLog = _stdout; - packet.message->data = (byte*)data; - packet.message->cursize = len; - MSG_BeginReading (&packet); - Parse_Server_Packet (); - if (Net_PacketLog == _stdout) - Net_PacketLog = NULL; -} - void Parse_Server_Packet () @@ -826,14 +805,14 @@ Parse_Server_Packet () } void -Analyze_Client_Packet (const byte * data, int len) +Analyze_Server_Packet (const byte * data, int len) { if (!Net_PacketLog) Net_PacketLog = _stdout; packet.message->data = (byte*)data; packet.message->cursize = len; MSG_BeginReading (&packet); - Parse_Client_Packet (); + Parse_Server_Packet (); if (Net_PacketLog == _stdout) Net_PacketLog = NULL; } @@ -931,6 +910,19 @@ Parse_Client_Packet (void) } } +void +Analyze_Client_Packet (const byte * data, int len) +{ + if (!Net_PacketLog) + Net_PacketLog = _stdout; + packet.message->data = (byte*)data; + packet.message->cursize = len; + MSG_BeginReading (&packet); + Parse_Client_Packet (); + if (Net_PacketLog == _stdout) + Net_PacketLog = NULL; +} + void Net_PacketLog_f (cvar_t *var) { diff --git a/qw/source/pmove.c b/qw/source/pmove.c index 9ca22208e..c3d2e0447 100644 --- a/qw/source/pmove.c +++ b/qw/source/pmove.c @@ -56,10 +56,6 @@ vec3_t forward, right, up; vec3_t player_mins = { -16, -16, -24 }; vec3_t player_maxs = { 16, 16, 32 }; -void PM_InitBoxHull (void); -void PM_CategorizePosition (void); - - void Pmove_Init (void) { @@ -215,8 +211,6 @@ PM_FlyMove (void) return blocked; } -void PM_Accelerate (vec3_t, float, float); - /* PM_FlymodeMove diff --git a/qw/source/sbar.c b/qw/source/sbar.c index 34e7f87a4..3f87d93d7 100644 --- a/qw/source/sbar.c +++ b/qw/source/sbar.c @@ -85,10 +85,6 @@ qboolean sb_showteamscores; int sb_lines; // scan lines to draw -void Sbar_DeathmatchOverlay (int start); -void Sbar_TeamOverlay (void); -void Sbar_MiniDeathmatchOverlay (void); - static qboolean largegame = false; cvar_t *cl_showscoresuid; diff --git a/qw/source/sv_demo.c b/qw/source/sv_demo.c index 1cb4e02a8..88e8e75d2 100644 --- a/qw/source/sv_demo.c +++ b/qw/source/sv_demo.c @@ -79,8 +79,6 @@ cvar_t *sv_ondemoremove; cvar_t *sv_demotxt; cvar_t *serverdemo; -void SV_WriteDemoMessage (sizebuf_t *msg, int type, int to, float time); - int (*dwrite) (QFile * file, const void *buf, int count); static dbuffer_t *demobuffer; diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 56b2275b8..9a77d18d5 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -197,10 +197,6 @@ int pr_gc_count = 0; int sv_net_initialized; -void SV_AcceptClient (netadr_t adr, int userid, char *userinfo); -void Master_Shutdown (void); - - const char *client_info_filters[] = { // Info keys needed by client "name", "topcolor", @@ -225,6 +221,28 @@ ServerPaused (void) return sv.paused; } +/* + Master_Shutdown + + Informs all masters that this server is going down +*/ +void +Master_Shutdown (void) +{ + char string[2048]; + int i; + + snprintf (string, sizeof (string), "%c\n", S2M_SHUTDOWN); + + // send to group master + for (i = 0; i < MAX_MASTERS; i++) + if (master_adr[i].port) { + SV_Printf ("Sending heartbeat to %s\n", + NET_AdrToString (master_adr[i])); + NET_SendPacket (strlen (string), string, master_adr[i]); + } +} + /* SV_Shutdown @@ -2244,28 +2262,6 @@ Master_Heartbeat (void) } } -/* - Master_Shutdown - - Informs all masters that this server is going down -*/ -void -Master_Shutdown (void) -{ - char string[2048]; - int i; - - snprintf (string, sizeof (string), "%c\n", S2M_SHUTDOWN); - - // send to group master - for (i = 0; i < MAX_MASTERS; i++) - if (master_adr[i].port) { - SV_Printf ("Sending heartbeat to %s\n", - NET_AdrToString (master_adr[i])); - NET_SendPacket (strlen (string), string, master_adr[i]); - } -} - static inline qboolean iswhitespace (char c) { diff --git a/qw/source/sv_model.c b/qw/source/sv_model.c index f39e25c1f..6be81886b 100644 --- a/qw/source/sv_model.c +++ b/qw/source/sv_model.c @@ -37,16 +37,13 @@ static const char rcsid[] = int mod_lightmap_bytes = 1; -void Mod_LoadBrushModel (model_t *mod, void *buffer); - - void Mod_LoadLighting (lump_t *l) { } void -Mod_LoadAliasModel (model_t *mod, void *buf) +Mod_LoadAliasModel (model_t *mod, void *buf, cache_allocator_t allocator) { } @@ -76,6 +73,6 @@ Mod_LoadExternalTextures (model_t *mod) } void -GL_SubdivideSurface (msurface_t *fa) +Mod_SubdivideSurface (msurface_t *fa) { } diff --git a/qw/source/sv_pr_cmds.c b/qw/source/sv_pr_cmds.c index 73be1dffd..93e90ea6c 100644 --- a/qw/source/sv_pr_cmds.c +++ b/qw/source/sv_pr_cmds.c @@ -1197,8 +1197,6 @@ PF_WriteEntity (progs_t *pr) MSG_WriteShort (WriteDest (pr), P_EDICTNUM (pr, 1)); } -int SV_ModelIndex (const char *name); - void PF_makestatic (progs_t *pr) { diff --git a/qw/source/sv_send.c b/qw/source/sv_send.c index f8f6347c5..72ecc66f5 100644 --- a/qw/source/sv_send.c +++ b/qw/source/sv_send.c @@ -847,7 +847,6 @@ SV_SendClientMessages (void) // if the reliable message overflowed, drop the client if (c->netchan.message.overflowed) { int i; - extern void Analyze_Server_Packet (byte *data, int len); byte *data = Hunk_TempAlloc (MAX_MSGLEN + 8); memset (data, 0, 8); diff --git a/qw/source/sv_user.c b/qw/source/sv_user.c index 2f4646e14..98344085e 100644 --- a/qw/source/sv_user.c +++ b/qw/source/sv_user.c @@ -92,9 +92,6 @@ cvar_t *sv_timekick_interval; cvar_t *sv_timecheck_fuzz; cvar_t *sv_timecheck_decay; -void SV_FullClientUpdateToClient (client_t *client, client_t *cl); - - // USER STRINGCMD EXECUTION host_client and sv_player will be valid. /* diff --git a/tools/qfcc/source/obj_file.c b/tools/qfcc/source/obj_file.c index 296681ba8..abd6b0734 100644 --- a/tools/qfcc/source/obj_file.c +++ b/tools/qfcc/source/obj_file.c @@ -462,7 +462,8 @@ qfo_read (QFile *file) return qfo; } -qfo_t *qfo_open (const char *filename) +qfo_t * +qfo_open (const char *filename) { qfo_t *qfo; QFile *file; diff --git a/tools/qfmodelgen/source/cmdlib.c b/tools/qfmodelgen/source/cmdlib.c index 313d506bf..c0fdfcad8 100644 --- a/tools/qfmodelgen/source/cmdlib.c +++ b/tools/qfmodelgen/source/cmdlib.c @@ -267,7 +267,8 @@ strupr (char *start) return start; } -char *strlower (char *start) +char * +strlower (char *start) { char *in; diff --git a/tools/qfmodelgen/source/modelgen.c b/tools/qfmodelgen/source/modelgen.c index ed8b6beb9..ec41a4d05 100644 --- a/tools/qfmodelgen/source/modelgen.c +++ b/tools/qfmodelgen/source/modelgen.c @@ -545,7 +545,8 @@ Cmd_Base (void) SetSkinValues (); } -void Cmd_Skin (void) +void +Cmd_Skin (void) { byte *ppal, *pskinbitmap, *ptemp1, *ptemp2; int time1, i;