mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2024-11-10 15:21:59 +00:00
91 lines
4.3 KiB
C
91 lines
4.3 KiB
C
/*
|
|
Copyright (C) 1999-2007 id Software, Inc. and contributors.
|
|
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
|
|
|
This file is part of GtkRadiant.
|
|
|
|
GtkRadiant is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
GtkRadiant is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GtkRadiant; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
/*
|
|
Camera plugin for GtkRadiant
|
|
Copyright (C) 2002 Splash Damage Ltd.
|
|
*/
|
|
|
|
void Sys_ERROR( char* text, ... );
|
|
char* UnixToDosPath( char* path );
|
|
void CAMERA_ExtractFilePath( const char *path, char *dest );
|
|
const char* ExtractFilename( const char* path );
|
|
bool FileExists( const char *filename );
|
|
int Q_stricmp( const char *s1, const char *s2 );
|
|
|
|
typedef void * fileHandle_t;
|
|
|
|
#define qfalse false
|
|
#define qtrue true
|
|
|
|
extern "C" {
|
|
// command buffer
|
|
void Cbuf_AddText( const char *text );
|
|
void Cbuf_Execute( void );
|
|
|
|
// common
|
|
#ifndef CDECL
|
|
#ifdef _WIN32
|
|
#define CDECL __cdecl
|
|
#else
|
|
#define CDECL
|
|
#endif
|
|
#endif
|
|
|
|
void CDECL Com_Error( int level, const char *error, ... );
|
|
void CDECL Com_Printf( const char *msg, ... );
|
|
void CDECL Com_DPrintf( const char *msg, ... );
|
|
void *Com_Allocate( int bytes );
|
|
void Com_Dealloc( void *ptr );
|
|
|
|
// filesystem
|
|
int FS_Read( void *buffer, int len, fileHandle_t f );
|
|
int FS_Write( const void *buffer, int len, fileHandle_t h );
|
|
int FS_ReadFile( const char *qpath, void **buffer );
|
|
void FS_FreeFile( void *buffer );
|
|
int FS_FOpenFileRead( const char *filename, fileHandle_t *file, qboolean uniqueFILE );
|
|
fileHandle_t FS_FOpenFileWrite( const char *filename );
|
|
void FS_FCloseFile( fileHandle_t f );
|
|
}
|
|
|
|
// vectors
|
|
#define DotProduct( a,b ) ( ( a )[0] * ( b )[0] + ( a )[1] * ( b )[1] + ( a )[2] * ( b )[2] )
|
|
#define VectorSubtract( a,b,c ) ( ( c )[0] = ( a )[0] - ( b )[0],( c )[1] = ( a )[1] - ( b )[1],( c )[2] = ( a )[2] - ( b )[2] )
|
|
#define VectorAdd( a,b,c ) ( ( c )[0] = ( a )[0] + ( b )[0],( c )[1] = ( a )[1] + ( b )[1],( c )[2] = ( a )[2] + ( b )[2] )
|
|
#define VectorCopy( a,b ) ( ( b )[0] = ( a )[0],( b )[1] = ( a )[1],( b )[2] = ( a )[2] )
|
|
|
|
#define VectorScale( v, s, o ) ( ( o )[0] = ( v )[0] * ( s ),( o )[1] = ( v )[1] * ( s ),( o )[2] = ( v )[2] * ( s ) )
|
|
#define VectorMA( 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 ) )
|
|
#define CrossProduct( a,b,c ) ( ( c )[0] = ( a )[1] * ( b )[2] - ( a )[2] * ( b )[1],( c )[1] = ( a )[2] * ( b )[0] - ( a )[0] * ( b )[2],( c )[2] = ( a )[0] * ( b )[1] - ( a )[1] * ( b )[0] )
|
|
|
|
#define DotProduct4( x,y ) ( ( x )[0] * ( y )[0] + ( x )[1] * ( y )[1] + ( x )[2] * ( y )[2] + ( x )[3] * ( y )[3] )
|
|
#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] )
|
|
#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] )
|
|
#define VectorCopy4( a,b ) ( ( b )[0] = ( a )[0],( b )[1] = ( a )[1],( b )[2] = ( a )[2],( b )[3] = ( a )[3] )
|
|
#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 ) )
|
|
#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 ) )
|
|
|
|
#define VectorClear( a ) ( ( a )[0] = ( a )[1] = ( a )[2] = 0 )
|
|
#define VectorNegate( a,b ) ( ( b )[0] = -( a )[0],( b )[1] = -( a )[1],( b )[2] = -( a )[2] )
|
|
#define VectorSet( v, x, y, z ) ( ( v )[0] = ( x ), ( v )[1] = ( y ), ( v )[2] = ( z ) )
|
|
#define Vector4Copy( a,b ) ( ( b )[0] = ( a )[0],( b )[1] = ( a )[1],( b )[2] = ( a )[2],( b )[3] = ( a )[3] )
|
|
|
|
#define SnapVector( v ) {v[0] = (int)v[0]; v[1] = (int)v[1]; v[2] = (int)v[2]; }
|