]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/camera/misc.h
fixed eol-style
[xonotic/netradiant.git] / contrib / camera / misc.h
1 /*
2 Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5 This file is part of GtkRadiant.
6
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 */
21
22 /*
23 Camera plugin for GtkRadiant
24 Copyright (C) 2002 Splash Damage Ltd.
25 */
26
27 void Sys_ERROR( char* text, ... );
28 char* UnixToDosPath( char* path );
29 void ExtractFilePath( const char *path, char *dest );
30 const char* ExtractFilename( const char* path );
31 bool FileExists (const char *filename);
32 int Q_stricmp (const char *s1, const char *s2);
33
34 typedef int fileHandle_t;
35
36 extern "C" {
37 // command buffer
38 void Cbuf_AddText( const char *text );
39 void Cbuf_Execute (void);
40
41 // common
42 #ifndef CDECL
43 #ifdef WIN32
44         #define CDECL __cdecl
45 #else
46         #define CDECL
47 #endif
48 #endif
49
50 void CDECL Com_Error( int level, const char *error, ... );
51 void CDECL Com_Printf( const char *msg, ... );
52 void CDECL Com_DPrintf( const char *msg, ... );
53 void *Com_Allocate( int bytes );
54 void Com_Dealloc( void *ptr );
55
56 // filesystem
57 int FS_Read( void *buffer, int len, fileHandle_t f );
58 int FS_Write( const void *buffer, int len, fileHandle_t h );
59 int FS_ReadFile( const char *qpath, void **buffer );
60 void FS_FreeFile( void *buffer );
61 int FS_FOpenFileRead( const char *filename, fileHandle_t *file, bool uniqueFILE );
62 fileHandle_t FS_FOpenFileWrite( const char *filename );
63 void FS_FCloseFile( fileHandle_t f );
64 }
65
66 // vectors
67 #define DotProduct4(x,y)                ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]+(x)[3]*(y)[3])
68 #define VectorSubtract4(a,b,c)  ((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2],(c)[3]=(a)[3]-(b)[3])
69 #define VectorAdd4(a,b,c)               ((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2],(c)[3]=(a)[3]+(b)[3])
70 #define VectorCopy4(a,b)                ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
71 #define VectorScale4(v, s, o)   ((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s),(o)[3]=(v)[3]*(s))
72 #define VectorMA4(v, s, b, o)   ((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s),(o)[2]=(v)[2]+(b)[2]*(s),(o)[3]=(v)[3]+(b)[3]*(s))
73
74 #define Vector4Copy(a,b)                ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])
75
76 #define SnapVector(v) {v[0]=(int)v[0];v[1]=(int)v[1];v[2]=(int)v[2];}