Back to index

extremetuxracer  0.5beta
etracer.h
Go to the documentation of this file.
00001 /* 
00002  * ETRacer 
00003  * Copyright (C) 2004-2005 Volker Stroebel <volker@planetpenguin.de>
00004  *
00005  * Copyright (C) 1999-2001 Jasmin F. Patry
00006  * 
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020  */
00021 
00022 #ifndef _PPRACER_H_
00023 #define _PPRACER_H_
00024 
00025 #ifdef HAVE_CONFIG_H
00026 #   include <config.h>
00027 #endif
00028 
00029 #if defined ( __MWERKS__ ) || defined( _MSC_VER )
00030 #   define NATIVE_WIN32_COMPILER 1
00031 #else
00032 /* Assume UNIX compatible by default */
00033 #   define COMPILER_IS_UNIX_COMPATIBLE 1
00034 #endif
00035 
00036 #if defined( WIN32 ) || defined( __CYGWIN__ ) || \
00037     defined ( NATIVE_WIN32_COMPILER )
00038 #  ifndef WIN32
00039 #     define WIN32
00040 #  endif
00041 #  include <windows.h>
00042 #endif 
00043 
00044 #if defined( NATIVE_WIN32_COMPILER )
00045 /* Need to manually define some things that autoconf defines for
00046    us in config.h */
00047 #   define VERSION "0.3.1"
00048 #   define HAVE_SDL_MIXER 1
00049 #   define HAVE_SDL_JOYSTICKOPEN 1
00050 #   define TCL_HEADER <tcl.h>
00051 
00052 #   define HAVE__ISNAN
00053 
00054 #   ifdef _MSC_VER
00055 #       pragma warning (disable:4244) /* conversion from double to float */
00056 #       pragma warning (disable:4305) /* truncation from const dbl to float */
00057 #       pragma warning (disable:4761) /* integral size mismatch */
00058 #   endif /* _MSC_VER */
00059 
00060 #   ifdef __MWERKS__
00061         /* Codewarrior 4 seems to need this... */
00062         int _isnan( double x );
00063 #   endif /* __MWERKS__ */
00064 #endif
00065 
00066 /* Include all (or most) system include files here.  This slows down
00067    compilation but makes maintenance easier since system-dependent
00068    #ifdefs are centralized. */
00069 #include <math.h>
00070 #include <stdlib.h>
00071 #include <stdio.h>
00072 #include <errno.h>
00073 #include <time.h>
00074 #include <ctype.h>
00075 #include <sys/stat.h>
00076 #include <string.h>
00077 #include <limits.h>
00078 #include <stdarg.h>
00079 
00080 /* Macros and include files for non-standard math routines */
00081 #ifdef HAVE_IEEEFP_H
00082 #   include <ieeefp.h>
00083 #endif
00084 #include <float.h>
00085 
00086 /* System-dependent includes */
00087 #if defined( NATIVE_WIN32_COMPILER )
00088 #  include <io.h>
00089 #  include <direct.h>
00090 #endif
00091 
00092 #if defined( COMPILER_IS_UNIX_COMPATIBLE )
00093 #   include <unistd.h>
00094 #   include <sys/types.h>
00095 #      ifndef WIN32
00096 #      include <pwd.h>
00097 #      endif
00098 #   include <dirent.h>
00099 #   include <sys/time.h>
00100 #   include <sys/types.h>
00101 #   include <dirent.h>
00102 #endif
00103 
00104 /* OpenGL */
00105 #include <GL/gl.h>
00106 #include <GL/glu.h>
00107 
00108 #ifdef HAVE_GL_GLX_H
00109 #   include <GL/glx.h>
00110 #endif
00111 
00112 
00113 
00114 #include <iostream>
00115 
00116 /* Tcl -- name of header is system-dependent :( */
00117 //#include TCL_HEADER
00118 #include <tcl.h>
00119 
00120 
00121 #ifndef M_PI
00122 #   define M_PI 3.1415926535
00123 #endif
00124 
00125 /* Some versions of sys/stat.h don't define S_ISDIR */
00126 #ifndef S_ISDIR
00127 #   define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
00128 #endif /* S_ISDIR */
00129 
00130 /* Header files to include by default */
00131 #include "debug.h"
00132 #include "error_util.h"
00133 
00134 #define PROG_NAME "etracer"
00135 
00136 #if defined( HAVE_FINITE )
00137 #   define FINITE(x) (finite(x))
00138 #elif defined( HAVE__FINITE )
00139 #   define FINITE(x) (_finite(x))
00140 #elif defined( HAVE_ISNAN )
00141 #   define FINITE(x) (!isnan(x))
00142 #elif defined( HAVE__ISNAN )
00143 #   define FINITE(x) (!_isnan(x))
00144 #else
00145 #   error "You don't have finite(), _finite(), isnan(), or _isnan() on your system!"
00146 #endif
00147 
00148 
00149 /* Macros for swapping bytes */
00150 #define SWAP_WORD(x) \
00151 { \
00152 unsigned long tmp; \
00153 tmp  = ((x) >> 24) & 0x000000ff; \
00154 tmp |= ((x) >> 8)  & 0x0000ff00; \
00155 tmp |= ((x) << 8)  & 0x00ff0000; \
00156 tmp |= ((x) << 24) & 0xff000000; \
00157 (x) = tmp; \
00158 }
00159 
00160 #define SWAP_SHORT(x) \
00161 { \
00162 unsigned short tmp; \
00163 tmp  = ((x) << 8)  & 0xff00; \
00164 tmp |= ((x) >> 8)  & 0x00ff; \
00165 (x) = tmp; \
00166 }
00167 
00168 
00169 /* define this to turn off all debugging assertions/checks */
00170 /* #define TUXRACER_NO_ASSERT */
00171 
00172 /* Directory separator */
00173 #ifdef WIN32
00174 #   define DIR_SEPARATOR "\\"
00175 #else
00176 #   define DIR_SEPARATOR "/"
00177 #endif
00178 
00179 #define BUFF_LEN 512
00180 
00181 /* Multiplayer is not yet supported */
00182 #define MAX_PLAYERS 1
00183 
00184 /* Number of lives players get to complete a cup */
00185 #define INIT_NUM_LIVES 4
00186 
00187 #ifndef CONST84
00188 #   define CONST84
00189 #      define FUCKTCL (char*)
00190 #else
00191 #      define FUCKTCL
00192 #endif
00193 
00194 
00195 extern Tcl_Interp *tclInterp;
00196 
00197 
00198 #endif