]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - include/imap.h
uncrustify! now the code is only ugly on the *inside*
[xonotic/netradiant.git] / include / imap.h
1 /*
2    Copyright (C) 1999-2007 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 //
24 // DESCRIPTION:
25 // map format interface (.map and .xmap, Q3 and other games)
26 //
27
28 #ifndef __IMAP_H__
29 #define __IMAP_H__
30
31 /*! IMap depends on IDataStream, including the header there for now */
32 #include "idatastream.h"
33
34 /*! header for CPtrArray */
35 #include "missing.h"
36
37 #define MAP_MAJOR "map"
38 /*!
39    define a GUID for this interface so everyone can acces and reference it
40    {75076973-3414-49c9-be5b-2378ec5601af}
41  */
42 static const GUID QERPlugMapTable_GUID =
43 { 0x75076973, 0x3414, 0x49c9, { 0xbe, 0x5b, 0x23, 0x78, 0xec, 0x56, 0x01, 0xaf } };
44
45 /*!
46    read from a stream into a list of entities
47    \param in the input stream. For regular map file parsing it's possible to copy the content in a text buffer
48    and use the old school parser
49    \param ents the list of entities read from the stream. They are not linked to the world, and their brushes
50    are not either.
51  */
52 typedef void ( *PFN_MAP_READ )( IDataStream *in, CPtrArray *ents ); ///< read from a stream into a list of entities
53 typedef void ( *PFN_MAP_WRITE )( CPtrArray *ents, IDataStream *out ); ///< save a list of entities into a stream
54
55 struct _QERPlugMapTable
56 {
57         int m_nSize;
58         PFN_MAP_READ m_pfnMap_Read;
59         PFN_MAP_WRITE m_pfnMap_Write;
60 };
61
62 /*!
63    this set of macros will define the functions to map on a given table
64    it should be used in the headers (see modules source, plugin.h)
65    we don't want those defines in the part where WE implement the Map_LoadFile
66    so we're using a define to disable .. should find a standard define name
67    (for instance QCOM_CLIENT / QCOM_SERVER ?)
68    or the name should be specific to any interface .. it's not a client/server thing here anyway
69  */
70 #ifdef USE_MAPTABLE_DEFINE
71 #ifndef __MAPTABLENAME
72 /*!
73    TTimo NOTE: this is the default table name we map to
74    if you are using a different table name, just define __MAPTABLENAME before you include the imap.h header
75  */
76 #define __MAPTABLENAME g_MapTable
77 #endif
78 #define Map_Read __MAPTABLENAME.m_pfnMap_Read
79 #define Map_Write __MAPTABLENAME.m_pfnMap_Write
80 #endif
81
82 #endif