From d1a66b1504773e5da10463fd15d524697b0c2ba2 Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 12 Nov 2007 14:28:40 +0000 Subject: [PATCH] move two #defined to quakedef.h, and always include quakedef.h first before any other includes, even system headers. This is to make compilation with gcc -combine work. Also, fix some type mismatches between source files. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7689 d7cf8633-e32d-0410-b094-e92efae38249 --- cd_bsd.c | 3 ++- cd_linux.c | 3 +-- cd_win.c | 2 +- clvm_cmds.c | 4 +++- common.c | 4 ++-- conproc.c | 3 ++- console.c | 3 ++- curves.c | 2 ++ fs.c | 3 --- host.c | 3 ++- keys.c | 2 +- lhnet.c | 5 ++++- mathlib.c | 3 ++- matrixlib.c | 1 + mdfour.c | 2 ++ menu.c | 8 -------- menu.h | 10 ++++++++++ mvm_cmds.c | 10 ++++++---- polygon.c | 2 ++ prvm_cmds.c | 2 ++ quakedef.h | 6 ++++++ snd_alsa.c | 2 +- snd_bsd.c | 2 +- snd_coreaudio.c | 3 ++- snd_oss.c | 2 +- snd_sdl.c | 2 +- svbsp.c | 2 ++ svvm_cmds.c | 2 ++ sys_linux.c | 3 +-- sys_sdl.c | 3 +-- vid_agl.c | 3 ++- vid_glx.c | 4 ++-- vid_null.c | 3 ++- vid_sdl.c | 4 ++-- 34 files changed, 73 insertions(+), 43 deletions(-) diff --git a/cd_bsd.c b/cd_bsd.c index a514fc0b..e74a567a 100644 --- a/cd_bsd.c +++ b/cd_bsd.c @@ -18,6 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "quakedef.h" + #include #include #include @@ -31,7 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # include #endif -#include "quakedef.h" #include "cdaudio.h" diff --git a/cd_linux.c b/cd_linux.c index 2db702cb..c8cdd6c3 100644 --- a/cd_linux.c +++ b/cd_linux.c @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // rights reserved. // suggested by Zero_Dogg to fix a compile problem on Mandriva Linux -#define __KERNEL_STRICT_NAMES +#include "quakedef.h" #include #include @@ -31,7 +31,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#include "quakedef.h" #include "cdaudio.h" diff --git a/cd_win.c b/cd_win.c index 495fe020..2cc71613 100644 --- a/cd_win.c +++ b/cd_win.c @@ -20,10 +20,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Quake is a trademark of Id Software, Inc., (c) 1996 Id Software, Inc. All // rights reserved. +#include "quakedef.h" #include #include -#include "quakedef.h" #include "cdaudio.h" #if _MSC_VER < 1300 diff --git a/clvm_cmds.c b/clvm_cmds.c index 5547057d..92c2d8b4 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -1,3 +1,5 @@ +#include "quakedef.h" + #include "prvm_cmds.h" #include "csprogs.h" #include "cl_collision.h" @@ -22,7 +24,7 @@ void Sbar_SortFrags (void); void CL_FindNonSolidLocation(const vec3_t in, vec3_t out, vec_t radius); void CSQC_RelinkAllEntities (int drawmask); void CSQC_RelinkCSQCEntities (void); -char *Key_GetBind (int key); +const char *Key_GetBind (int key); diff --git a/common.c b/common.c index 79325dc7..42511e49 100644 --- a/common.c +++ b/common.c @@ -19,14 +19,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // common.c -- misc functions used in client and server +#include "quakedef.h" + #include #include #ifndef WIN32 #include #endif -#include "quakedef.h" - cvar_t registered = {0, "registered","0", "indicates if this is running registered quake (whether gfx/pop.lmp was found)"}; cvar_t cmdline = {0, "cmdline","0", "contains commandline the engine was launched with"}; diff --git a/conproc.c b/conproc.c index 63a1e465..dd21407d 100644 --- a/conproc.c +++ b/conproc.c @@ -19,9 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // conproc.c +#include "quakedef.h" + #include #include -#include "quakedef.h" #include "conproc.h" HANDLE heventDone; diff --git a/console.c b/console.c index eb13a112..c11f548c 100644 --- a/console.c +++ b/console.c @@ -19,11 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // console.c +#include "quakedef.h" + #if !defined(WIN32) || defined(__MINGW32__) # include #endif #include -#include "quakedef.h" int con_linewidth; diff --git a/curves.c b/curves.c index de3f423a..3a9e22a1 100644 --- a/curves.c +++ b/curves.c @@ -39,6 +39,8 @@ double bsplinesample(int dimensions, double t, double *param) } */ +#include "quakedef.h" + #include #include "curves.h" diff --git a/fs.c b/fs.c index 362b36ad..8f66fe88 100644 --- a/fs.c +++ b/fs.c @@ -22,9 +22,6 @@ Boston, MA 02111-1307, USA */ -// on UNIX platforms we need to define this so that video saving does not cause a SIGFSZ (file size) signal when a video clip exceeds 2GB -#define _FILE_OFFSET_BITS 64 - #include "quakedef.h" #include diff --git a/host.c b/host.c index 36fa7ac5..4638ee8f 100644 --- a/host.c +++ b/host.c @@ -19,8 +19,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // host.c -- coordinates spawning and killing of local servers -#include #include "quakedef.h" + +#include #include "libcurl.h" #include "cdaudio.h" #include "cl_video.h" diff --git a/keys.c b/keys.c index 610f448a..11280e0f 100644 --- a/keys.c +++ b/keys.c @@ -506,7 +506,7 @@ qboolean chat_team; char chat_buffer[MAX_INPUTLINE]; unsigned int chat_bufferlen = 0; -extern unsigned int Nicks_CompleteChatLine(char *buffer, size_t size, int pos); +extern int Nicks_CompleteChatLine(char *buffer, size_t size, unsigned int pos); static void Key_Message (int key, char ascii) diff --git a/lhnet.c b/lhnet.c index b97be361..d72589d1 100644 --- a/lhnet.c +++ b/lhnet.c @@ -1,6 +1,10 @@ // Written by Forest Hale 2003-06-15 and placed into public domain. +#ifndef STANDALONETEST +#include "quakedef.h" +#endif + #include #include #include @@ -23,7 +27,6 @@ // for Z_Malloc/Z_Free in quake #ifndef STANDALONETEST -#include "quakedef.h" #include "zone.h" #include "sys.h" #include "netconn.h" diff --git a/mathlib.c b/mathlib.c index eaa1a765..c1e65b5a 100644 --- a/mathlib.c +++ b/mathlib.c @@ -19,9 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // mathlib.c -- math primitives -#include #include "quakedef.h" +#include + vec3_t vec3_origin = {0,0,0}; float ixtable[4096]; diff --git a/matrixlib.c b/matrixlib.c index e430a7d4..a0499861 100644 --- a/matrixlib.c +++ b/matrixlib.c @@ -1,3 +1,4 @@ +#include "quakedef.h" #include #include "matrixlib.h" diff --git a/mdfour.c b/mdfour.c index 9859f94a..c550651e 100644 --- a/mdfour.c +++ b/mdfour.c @@ -27,6 +27,8 @@ $Id$ */ +#include "quakedef.h" + #include /* XoXus: needed for memset call */ #include "mdfour.h" diff --git a/menu.c b/menu.c index fe931e6e..54e2e520 100644 --- a/menu.c +++ b/menu.c @@ -2764,14 +2764,6 @@ static void M_Reset_Draw (void) /* VIDEO MENU */ // note: if modes are added to the beginning of this list, update VID_DEFAULT -typedef struct video_resolution_s -{ - const char *type; - int width, height; - int conwidth, conheight; - double pixelheight; // pixel aspect -} -video_resolution_t; video_resolution_t video_resolutions[] = { {"Standard 4x3" , 320, 240, 320, 240, 1 }, diff --git a/menu.h b/menu.h index 8fdba99d..df58facb 100644 --- a/menu.h +++ b/menu.h @@ -83,5 +83,15 @@ extern void (*MR_KeyEvent) (int key, char ascii, qboolean downevent); extern void (*MR_Draw) (void); extern void (*MR_ToggleMenu_f) (void); extern void (*MR_Shutdown) (void); + +typedef struct video_resolution_s +{ + const char *type; + int width, height; + int conwidth, conheight; + double pixelheight; // pixel aspect +} +video_resolution_t; +video_resolution_t video_resolutions[]; #endif diff --git a/mvm_cmds.c b/mvm_cmds.c index 304be4c3..e3aea4b4 100644 --- a/mvm_cmds.c +++ b/mvm_cmds.c @@ -1,4 +1,7 @@ +#include "quakedef.h" + #include "prvm_cmds.h" +#include "menu.h" //============================================================================ // Menu @@ -195,7 +198,6 @@ VM_M_getresolution vector getresolution(float number) ========= */ -extern unsigned short video_resolutions[][2]; void VM_M_getresolution(void) { int nr; @@ -203,9 +205,9 @@ void VM_M_getresolution(void) nr = (int)PRVM_G_FLOAT(OFS_PARM0); - - PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr][0]; - PRVM_G_VECTOR(OFS_RETURN)[1] = video_resolutions[nr][1]; + // FIXME bounds check + PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr].width; + PRVM_G_VECTOR(OFS_RETURN)[1] = video_resolutions[nr].height; PRVM_G_VECTOR(OFS_RETURN)[2] = 0; } diff --git a/polygon.c b/polygon.c index 2bc897fb..a02c032c 100644 --- a/polygon.c +++ b/polygon.c @@ -3,6 +3,8 @@ Polygon clipping routines written by Forest Hale and placed into public domain. */ +#include "quakedef.h" + #include #include "polygon.h" diff --git a/prvm_cmds.c b/prvm_cmds.c index 57f192b3..73d36bca 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -4,6 +4,8 @@ // cause large (I think they will) parts are from pr_cmds the same copyright like in pr_cmds // also applies here +#include "quakedef.h" + #include "prvm_cmds.h" #include diff --git a/quakedef.h b/quakedef.h index 1d9c7715..c2843b31 100644 --- a/quakedef.h +++ b/quakedef.h @@ -22,6 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef QUAKEDEF_H #define QUAKEDEF_H +// on UNIX platforms we need to define this so that video saving does not cause a SIGFSZ (file size) signal when a video clip exceeds 2GB +#define _FILE_OFFSET_BITS 64 + +// for cd_linux.c +#define __KERNEL_STRICT_NAMES + #if defined(__GNUC__) && (__GNUC__ > 2) #define DP_FUNC_PRINTF(n) __attribute__ ((format (printf, n, n+1))) #else diff --git a/snd_alsa.c b/snd_alsa.c index bed25d2b..96c8b2d1 100644 --- a/snd_alsa.c +++ b/snd_alsa.c @@ -23,10 +23,10 @@ // ALSA module, used by Linux +#include "quakedef.h" #include -#include "quakedef.h" #include "snd_main.h" diff --git a/snd_bsd.c b/snd_bsd.c index e202342b..0dd7186a 100644 --- a/snd_bsd.c +++ b/snd_bsd.c @@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "quakedef.h" #include #include @@ -31,7 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #include -#include "quakedef.h" #include "snd_main.h" diff --git a/snd_coreaudio.c b/snd_coreaudio.c index 246cff1d..1e36c768 100644 --- a/snd_coreaudio.c +++ b/snd_coreaudio.c @@ -20,12 +20,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ +#include "quakedef.h" + #include #include #include -#include "quakedef.h" #include "snd_main.h" diff --git a/snd_oss.c b/snd_oss.c index c991516b..bde3d508 100644 --- a/snd_oss.c +++ b/snd_oss.c @@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // OSS module, used by Linux and FreeBSD +#include "quakedef.h" #include #include @@ -27,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -#include "quakedef.h" #include "snd_main.h" diff --git a/snd_sdl.c b/snd_sdl.c index bcef10da..64f0dde6 100644 --- a/snd_sdl.c +++ b/snd_sdl.c @@ -16,11 +16,11 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "quakedef.h" #include #include -#include "quakedef.h" #include "snd_main.h" diff --git a/svbsp.c b/svbsp.c index ca6a1cf4..7dcfffed 100644 --- a/svbsp.c +++ b/svbsp.c @@ -2,6 +2,8 @@ // Shadow Volume BSP code written by Forest "LordHavoc" Hale on 2003-11-06 and placed into public domain. // Modified by LordHavoc (to make it work and other nice things like that) on 2007-01-24 and 2007-01-25 +#include "quakedef.h" + #include #include #include "svbsp.h" diff --git a/svvm_cmds.c b/svvm_cmds.c index 5700b21a..dffc4fda 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -1,3 +1,5 @@ +#include "quakedef.h" + #include "prvm_cmds.h" //============================================================================ diff --git a/sys_linux.c b/sys_linux.c index 725eecac..6a876d1b 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -1,3 +1,4 @@ +#include "quakedef.h" #ifdef WIN32 #include @@ -10,8 +11,6 @@ #include -#include "quakedef.h" - #ifdef WIN32 cvar_t sys_usetimegettime = {CVAR_SAVE, "sys_usetimegettime", "1", "use windows timeGetTime function (which has issues on some motherboards) for timing rather than QueryPerformanceCounter timer (which has issues on multicore/multiprocessor machines and processors which are designed to conserve power)"}; diff --git a/sys_sdl.c b/sys_sdl.c index c781cfed..d7ed9179 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -1,3 +1,4 @@ +#include "quakedef.h" #ifdef WIN32 #include @@ -10,8 +11,6 @@ #include -#include "quakedef.h" - #include // ======================================================================= diff --git a/vid_agl.c b/vid_agl.c index 944f9559..5937a167 100644 --- a/vid_agl.c +++ b/vid_agl.c @@ -21,6 +21,8 @@ */ +#include "quakedef.h" + #include #include #include @@ -30,7 +32,6 @@ #include #include #include "vid_agl_mackeys.h" // this is SDL/src/video/maccommon/SDL_mackeys.h -#include "quakedef.h" #ifndef kCGLCEMPEngine #define kCGLCEMPEngine 313 diff --git a/vid_glx.c b/vid_glx.c index dd7ad346..68896def 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -17,6 +17,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "quakedef.h" + #include #include @@ -35,8 +37,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #include -#include "quakedef.h" - #include "nexuiz.xpm" #include "darkplaces.xpm" diff --git a/vid_null.c b/vid_null.c index 28f92f8c..48755028 100644 --- a/vid_null.c +++ b/vid_null.c @@ -17,9 +17,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include "quakedef.h" +#include + int cl_available = false; qboolean vid_supportrefreshrate = false; diff --git a/vid_sdl.c b/vid_sdl.c index 39755e52..22376f66 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -16,12 +16,12 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "quakedef.h" + #undef WIN32_LEAN_AND_MEAN //hush a warning, SDL.h redefines this #include #include -#include "quakedef.h" - // Tell startup code that we have a client int cl_available = true; -- 2.39.2