Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

l_utils.h

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, 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 Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 
00023 #ifndef MAX_PATH
00024     #define MAX_PATH            64
00025 #endif
00026 
00027 #ifndef PATH_SEPERATORSTR
00028     #if defined(WIN32)|defined(_WIN32)|defined(__NT__)|defined(__WINDOWS__)|defined(__WINDOWS_386__)
00029         #define PATHSEPERATOR_STR       "\\"
00030     #else
00031         #define PATHSEPERATOR_STR       "/"
00032     #endif
00033 #endif
00034 #ifndef PATH_SEPERATORCHAR
00035     #if defined(WIN32)|defined(_WIN32)|defined(__NT__)|defined(__WINDOWS__)|defined(__WINDOWS_386__)
00036         #define PATHSEPERATOR_CHAR      '\\'
00037     #else
00038         #define PATHSEPERATOR_CHAR      '/'
00039     #endif
00040 #endif
00041 
00042 //random in the range [0, 1]
00043 #define random()            ((rand () & 0x7fff) / ((float)0x7fff))
00044 //random in the range [-1, 1]
00045 #define crandom()           (2.0 * (random() - 0.5))
00046 //min and max
00047 #define Maximum(x,y)        (x > y ? x : y)
00048 #define Minimum(x,y)        (x < y ? x : y)
00049 //absolute value
00050 #define FloatAbs(x)     (*(float *) &((* (int *) &(x)) & 0x7FFFFFFF))
00051 #define IntAbs(x)           (~(x))
00052 //coordinates
00053 #define _X      0
00054 #define _Y      1
00055 #define _Z      2
00056 
00057 typedef struct foundfile_s
00058 {
00059     int offset;
00060     int length;
00061     char filename[MAX_PATH];        //screw LCC, array must be at end of struct
00062 } foundfile_t;
00063 
00064 void Vector2Angles(vec3_t value1, vec3_t angles);
00065 //set the correct path seperators
00066 void ConvertPath(char *path);
00067 //append a path seperator to the given path not exceeding the length
00068 void AppendPathSeperator(char *path, int length);
00069 //find a file in a pak file
00070 qboolean FindFileInPak(char *pakfile, char *filename, foundfile_t *file);
00071 //find a quake file
00072 #ifdef BOTLIB
00073 qboolean FindQuakeFile(char *filename, foundfile_t *file);
00074 #else //BOTLIB
00075 qboolean FindQuakeFile(char *basedir, char *gamedir, char *filename, foundfile_t *file);
00076 #endif //BOTLIB
00077 
00078 
00079 

Generated on Thu Aug 25 12:37:13 2005 for Quake III Arena by  doxygen 1.3.9.1