summaryrefslogtreecommitdiffstats
path: root/tools/worldbuilder/code/main/worldbuilder.h
blob: 846247a3a647171b40fd616304eb435c04d5b310 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
//=============================================================================
// Copyright (C) 2002 Radical Entertainment Ltd.  All rights reserved.
//
// File:        worldbuilder.h
//
// Description: Blahblahblah
//
// History:     16/05/2002 + Created -- Cary Brisebois
//
//=============================================================================

#ifndef WORLDBUILDER_H
#define WORLDBUILDER_H

//========================================
// Nested Includes
//========================================
#include "precompiled/PCH.h"

#include <assert.h>

#include <..\..\..\game\code\meta\locatortypes.h>

//========================================
// Forward References
//========================================

//=============================================================================
//
// Synopsis:    Blahblahblah
//
//=============================================================================

const char* const WORLD_BUILDER_NAME        = "WBWorldBuilder";
const char* const LOCATORS_NAME             = "WBLocators";
const char* const TRIGGER_VOLUMES_NAME      = "WBTriggerVolumes";
const char* const SPLINES_NAME              = "WBSplines";

class WorldBuilder
{
public:
    
    enum { MAX_PREFIX_LENGTH = 24, MAX_NAME_LENGTH = 256 };

    enum DisplayLevel
    {
        EVENT_LOCATORS              = ( 1 << 0 ),
        SCRIPT_LOCATORS             = ( 1 << 1 ),
        GENERIC_LOCATORS            = ( 1 << 2 ),
        CARSTART_LOCATORS           = ( 1 << 3 ),
        ZONE_EVENT_LOCATORS         = ( 1 << 4 ),
        OCCLUSION_LOCATORS          = ( 1 << 5 ),
        RAILCAM_LOCATORS            = ( 1 << 6 ),
        INTERIOR_LOCATORS           = ( 1 << 7 ),
        DIRECTIONAL_LOCATORS        = ( 1 << 8 ),
        ACTION_EVENT_LOCATORS       = ( 1 << 9 ),
        FOV_LOCATORS                = ( 1 << 10 ),
        BREAKABLE_CAMERA_LOCATORS   = ( 1 << 11 ),
        STATIC_CAMERA_LOCATORS      = ( 1 << 12 ),
        PED_GROUP_LOCATORS          = ( 1 << 13 ),


        LOCATORS = EVENT_LOCATORS | SCRIPT_LOCATORS | 
                   GENERIC_LOCATORS | ZONE_EVENT_LOCATORS | 
                   OCCLUSION_LOCATORS | RAILCAM_LOCATORS | 
                   INTERIOR_LOCATORS | DIRECTIONAL_LOCATORS |
                   ACTION_EVENT_LOCATORS | FOV_LOCATORS |
                   BREAKABLE_CAMERA_LOCATORS | STATIC_CAMERA_LOCATORS |
                   PED_GROUP_LOCATORS,

        TRIGGER_VOLUMES = ( 1 << 20 ),

        ALL = ~0,

        TOTAL_LEVELS = 6
    };
    
    WorldBuilder();
    virtual ~WorldBuilder();

    static unsigned int GetDisplayLevel();
    static LocatorType::Type GetLocatorType();

    static void SetPrefix( const char* prefix );
    static const char* const GetPrefix();

    static bool Exists();
    static MStatus AddChild( MObject& obj );

    static void SetSelectedLocator( const char* name );
    static const char* GetSelectedLocator();

    static const char* sName;

protected:

    friend class WBChangeDisplayCommand;
    static unsigned int sDisplayLevel;

    friend class WBSetLocatorTypeCmd;
    static LocatorType::Type sLocatorType;

    static char sPrefix[MAX_PREFIX_LENGTH + 1];  //+ 1 for the \n
    static char sSelectedLocator[MAX_NAME_LENGTH + 1];

    static void SetDisplayLevel( unsigned int level, bool on );
    static void SetLocatorType( LocatorType::Type type );

private:

    static void CreateWorldBuilderNode();

    //Prevent wasteful constructor creation.
    WorldBuilder( const WorldBuilder& worldbuilder );
    WorldBuilder& operator=( const WorldBuilder& worldbuilder );
};

//*****************************************************************************
//
// Inline Public Methods
//
//*****************************************************************************

//=============================================================================
// WorldBuilder::GetDisplayLevel
//=============================================================================
// Description: Comment
//
// Parameters:  ()
//
// Return:      DisplayLevel 
//
//=============================================================================
inline unsigned int WorldBuilder::GetDisplayLevel()
{
    return sDisplayLevel;
}

//=============================================================================
// WorldBuilder::GetLocatorType
//=============================================================================
// Description: Comment
//
// Parameters:  ()
//
// Return:      LocatorType 
//
//=============================================================================
inline LocatorType::Type WorldBuilder::GetLocatorType()
{
    return sLocatorType;
}

//=============================================================================
// WorldBuilder::SetLocatorType
//=============================================================================
// Description: Comment
//
// Parameters:  ( LocatorType::Type type )
//
// Return:      void 
//
//=============================================================================
inline void WorldBuilder::SetLocatorType( LocatorType::Type type )
{
    sLocatorType = type;
}

//=============================================================================
// WorldBuilder::GetPrefix
//=============================================================================
// Description: Comment
//
// Parameters:  ()
//
// Return:      const char* const 
//
//=============================================================================
inline const char* const WorldBuilder::GetPrefix()
{
    return sPrefix;
}

//=============================================================================
// WorldBuilder::SetPrefix
//=============================================================================
// Description: Comment
//
// Parameters:  ( const char* prefix )
//
// Return:      void 
//
//=============================================================================
inline void WorldBuilder::SetPrefix( const char* prefix )
{
    strcpy( sPrefix, prefix );
    sPrefix[MAX_PREFIX_LENGTH] = '\0';
}

//=============================================================================
// WorldBuilder::SetSelectedLocator
//=============================================================================
// Description: Comment
//
// Parameters:  ( const char* name )
//
// Return:      void 
//
//=============================================================================
inline void WorldBuilder::SetSelectedLocator( const char* name )
{
    strcpy( sSelectedLocator, name );
    sSelectedLocator[MAX_NAME_LENGTH] = '\0';
}

//=============================================================================
// WorldBuilder::GetSelectedLocator
//=============================================================================
// Description: Comment
//
// Parameters:  ()
//
// Return:      const 
//
//=============================================================================
inline const char* WorldBuilder::GetSelectedLocator()
{
    return sSelectedLocator;
}

//*****************************************************************************
//
// Inline Protected Methods
//
//*****************************************************************************

//=============================================================================
// WorldBuilder::SetDisplayLevel
//=============================================================================
// Description: Comment
//
// Parameters:  ( unsigned int level, bool on )
//
// Return:      inline 
//
//=============================================================================
inline void WorldBuilder::SetDisplayLevel( unsigned int level, bool on )
{
    assert( level <= TOTAL_LEVELS );

    on ? sDisplayLevel |= ( 1 << level ) : sDisplayLevel &= ~( 1 << level );
}

//*****************************************************************************
//
// Inline Private Methods
//
//*****************************************************************************

#endif //WORLDBUILDER_H