]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/pakstuff.h
fix unzip code
[xonotic/netradiant.git] / libs / pakstuff.h
index 340e8798e9fbd5cb3b57a329cc862aacfca3dbb2..a2ace159f04d2ad60b0a13f9b08bd8adcead8944 100644 (file)
@@ -1,23 +1,23 @@
 /*
-Copyright (C) 1999-2007 id Software, Inc. and contributors.
-For a list of contributors, see the accompanying CONTRIBUTORS file.
+   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.
+   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 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.
+   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
-*/
+   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
+ */
 
 #ifndef _PAKSTUFF_H_
 #define _PAKSTUFF_H_
@@ -37,18 +37,18 @@ extern "C"
 {
 #endif
 
-typedef char           Int8;
-typedef short          Int16;
-typedef long           Int32;
-typedef unsigned char  UInt8;
+typedef char Int8;
+typedef short Int16;
+typedef long Int32;
+typedef unsigned char UInt8;
 typedef unsigned short UInt16;
-typedef unsigned long  UInt32;
-typedef float          Float32;
-typedef double         Float64;
-#define MAX(a, b)              (((a) > (b)) ? (a) : (b))
-#define MIN(a, b)              (((a) < (b)) ? (a) : (b))
-#define RANDOM(x)              (random() % (x))
-#define RANDOMIZE()             srand((int) time(NULL))
+typedef unsigned long UInt32;
+typedef float Float32;
+typedef double Float64;
+#define MAX( a, b )              ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#define MIN( a, b )              ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
+#define RANDOM( x )              ( random() % ( x ) )
+#define RANDOMIZE()             srand( (int) time( NULL ) )
 
 #define FTYPE_UNKNOWN 0
 #define FTYPE_IWAD    1    /* .wad  "IWAD" */
@@ -73,75 +73,75 @@ typedef double         Float64;
 #define FTYPE_ERROR   -1
 
 #ifdef FAT_ENDIAN
-Bool   ReadInt16               (FILE *file, UInt16 huge *x);
-Bool   ReadInt32               (FILE *file, UInt32 huge *x);
-Bool   ReadFloat32             (FILE *file, Float32 huge *x);
-Bool   WriteInt16              (FILE *file, UInt16 huge *x);
-Bool   WriteInt32              (FILE *file, UInt32 huge *x);
-Bool   WriteFloat32    (FILE *file, Float32 huge *x);
-UInt16 SwapInt16               (UInt16 x);
-UInt32 SwapInt32               (UInt32 x);
-Float32        SwapFloat32             (Float32 x);
+Bool    ReadInt16( FILE *file, UInt16 huge *x );
+Bool    ReadInt32( FILE *file, UInt32 huge *x );
+Bool    ReadFloat32( FILE *file, Float32 huge *x );
+Bool    WriteInt16( FILE *file, UInt16 huge *x );
+Bool    WriteInt32( FILE *file, UInt32 huge *x );
+Bool    WriteFloat32( FILE *file, Float32 huge *x );
+UInt16  SwapInt16( UInt16 x );
+UInt32  SwapInt32( UInt32 x );
+Float32 SwapFloat32( Float32 x );
 #else
-#define ReadInt16(f, p)                ReadBytes((f), (p), 2L)
-#define ReadInt32(f, p)                ReadBytes((f), (p), 4L)
-#define ReadFloat32(f, p)      ReadBytes((f), (p), 4L)
-#define WriteInt16(f, p)       WriteBytes((f), (p), 2L)
-#define WriteInt32(f, p)       WriteBytes((f), (p), 4L)
-#define WriteFloat32(f, p)     WriteBytes((f), (p), 4L)
-#define SwapInt16(x)           (x)
-#define SwapInt32(x)           (x)
-#define SwapFloat32(x)         (x)
+#define ReadInt16( f, p )     ReadBytes( ( f ), ( p ), 2L )
+#define ReadInt32( f, p )     ReadBytes( ( f ), ( p ), 4L )
+#define ReadFloat32( f, p )   ReadBytes( ( f ), ( p ), 4L )
+#define WriteInt16( f, p )    WriteBytes( ( f ), ( p ), 2L )
+#define WriteInt32( f, p )    WriteBytes( ( f ), ( p ), 4L )
+#define WriteFloat32( f, p )  WriteBytes( ( f ), ( p ), 4L )
+#define SwapInt16( x )        ( x )
+#define SwapInt32( x )        ( x )
+#define SwapFloat32( x )      ( x )
 #endif /* FAT_ENDIAN */
 
-#define FROMDISK       -1
+#define FROMDISK    -1
 struct PACKDirectory
 {
-   char   name[56];             /* name of file */
-   UInt32 offset;               /* offset to start of data */
-   UInt32 size;                 /* byte size of data */
+       char name[56];              /* name of file */
+       UInt32 offset;              /* offset to start of data */
+       UInt32 size;                /* byte size of data */
 };
 typedef struct PACKDirectory *PACKDirPtr;
 
 typedef struct DirListStruct
 {
-       char                                    dirname[1024];
-       int                                             from;
-       struct  DirListStruct   *next;
+       char dirname[1024];
+       int from;
+       struct  DirListStruct   *next;
 } DIRLIST;
 
 typedef struct FileListStruct
 {
-       char                                    filename[1024];
-       UInt32                                  offset;
-       UInt32                                  size;
-       struct  FileListStruct  *next;
+       char filename[1024];
+       UInt32 offset;
+       UInt32 size;
+       struct  FileListStruct  *next;
 } FILELIST;
 
 typedef struct DirStruct
 {
-       char                            name[1024];
-       FILELIST                        *files;
-       struct DirStruct        *next;
+       char name[1024];
+       FILELIST            *files;
+       struct DirStruct    *next;
 } DIRECTORY;
 
 
 extern int m_nPAKIndex;
 extern FILE* pakfile[16];
 extern bool pakopen;
-extern DIRECTORY       *paktextures;
-
-void ClearFileList                             (FILELIST **);
-void ClearDirList                              (DIRLIST **);
-bool GetPackFileList                           (FILELIST **, char *);
-bool GetPackTextureDirs                        (DIRLIST **);
-bool AddToDirListAlphabetized  (DIRLIST **, char *, int);
-bool AddToFileListAlphabetized (FILELIST **t, char *, UInt32, UInt32, bool);
-bool PakLoadFile                                       (const char *, void **);
-void OpenPakFile                                       (const char *);
-void ClosePakFile                              (void);
-int  PakLoadAnyFile(const char *filename, void **bufferptr);
-void WINAPI InitPakFile(const char * pBasePath, const char *pName);
+extern DIRECTORY    *paktextures;
+
+void ClearFileList( FILELIST ** );
+void ClearDirList( DIRLIST ** );
+bool GetPackFileList( FILELIST **, char * );
+bool GetPackTextureDirs( DIRLIST ** );
+bool AddToDirListAlphabetized( DIRLIST **, char *, int );
+bool AddToFileListAlphabetized( FILELIST * *t, char *, UInt32, UInt32, bool );
+bool PakLoadFile( const char *, void ** );
+void OpenPakFile( const char * );
+void ClosePakFile( void );
+int  PakLoadAnyFile( const char *filename, void **bufferptr );
+void WINAPI InitPakFile( const char * pBasePath, const char *pName );
 
 #ifdef __cplusplus
 }