Debian Codegraph @

radiant/map.h

raw symbols SCIP
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 #if !defined( INCLUDED_MAP_H )
23 #define INCLUDED_MAP_H
24
25 #include "iscenegraph.h"
26 #include "generic/callback.h"
27 #include "signal/signalfwd.h"
28 #include "string/stringfwd.h"
29
30 class Map;
31 extern Map g_map;
32
33 class MapFormat;
34
35 void Map_addValidCallback( Map& map, const SignalHandler& handler );
36 bool Map_Valid( const Map& map );
37
38 class DeferredDraw
39 {
40 Callback<void()> m_draw;
41 bool m_defer;
42 bool m_deferred;
43 public:
44 DeferredDraw( const Callback<void()>& draw ) : m_draw( draw ), m_defer( false ), m_deferred( false ){
45 }
46 void defer(){
47 m_defer = true;
48 }
49 void draw(){
50 if ( m_defer ) {
51 m_deferred = true;
52 }
53 else
54 {
55 m_draw();
56 }
57 }
58 void flush(){
59 if ( m_defer && m_deferred ) {
60 m_draw();
61 }
62 m_deferred = false;
63 m_defer = false;
64 }
65 };
66
67 inline void DeferredDraw_onMapValidChanged( DeferredDraw& self ){
68 if ( Map_Valid( g_map ) ) {
69 self.flush();
70 }
71 else
72 {
73 self.defer();
74 }
75 }
76 typedef ReferenceCaller<DeferredDraw, void(), DeferredDraw_onMapValidChanged> DeferredDrawOnMapValidChangedCaller;
77
78
79
80 const char* Map_Name( const Map& map );
81 const MapFormat& Map_getFormat( const Map& map );
82 bool Map_Unnamed( const Map& map );
83
84
85 namespace scene
86 {
87 class Node;
88 class Graph;
89 }
90
91 scene::Node* Map_GetWorldspawn( const Map& map );
92 scene::Node* Map_FindWorldspawn( Map& map );
93 scene::Node& Map_FindOrInsertWorldspawn( Map& map );
94
95 template<typename Element> class BasicVector3;
96 typedef BasicVector3<float> Vector3;
97
98 extern Vector3 region_mins, region_maxs;
99 extern bool region_active;
100
101 // used to be #defines, multiple engine support suggests we should go towards dynamic
102 extern float g_MaxWorldCoord;
103 extern float g_MinWorldCoord;
104
105 void Map_LoadFile( const char* filename );
106 bool Map_SaveFile( const char* filename );
107
108 void Map_New();
109 void Map_Free();
110
111 void Map_RegionOff();
112
113 bool Map_SaveRegion( const char* filename );
114
115 class TextInputStream;
116 class TextOutputStream;
117
118 void Map_ImportSelected( TextInputStream& in, const MapFormat& format );
119 void Map_ExportSelected( TextOutputStream& out, const MapFormat& format );
120
121 bool Map_Modified( const Map& map );
122 void Map_SetModified( Map& map, bool modified );
123
124 bool Map_Save();
125 bool Map_SaveAs();
126
127 scene::Node& Node_Clone( scene::Node& node );
128 scene::Node& Node_Clone_Selected( scene::Node& node );
129
130 void DoMapInfo();
131
132 void Scene_parentSelectedBrushesToEntity( scene::Graph& graph, scene::Node& parent );
133 std::size_t Scene_countSelectedBrushes( scene::Graph& graph );
134
135 void Scene_parentSelected();
136
137 void OnUndoSizeChanged();
138
139 void NewMap();
140 void OpenMap();
141 void ImportMap();
142 void SaveMapAs();
143 void SaveMap();
144 void ExportMap();
145 void SaveRegion();
146
147
148 void Map_Traverse( scene::Node& root, const scene::Traversable::Walker& walker );
149
150
151 void SelectBrush( int entitynum, int brushnum );
152
153 extern CopiedString g_strLastMap;
154 extern bool g_bLoadLastMap;
155
156 void Map_Construct();
157 void Map_Destroy();
158
159
160 void Map_gatherNamespaced( scene::Node& root );
161 void Map_mergeClonedNames();
162
163
164 const char* getMapsPath();
165
166 #endif