summaryrefslogtreecommitdiffstats
path: root/tools/worldbuilder/code/main
diff options
context:
space:
mode:
authorSvxy <aidan61605@gmail.com>2023-05-31 23:31:32 +0200
committerSvxy <aidan61605@gmail.com>2023-05-31 23:31:32 +0200
commiteb4b3404aa00220d659e532151dab13d642c17a3 (patch)
tree7e1107c4995489a26c4007e41b53ea8d00ab2134 /tools/worldbuilder/code/main
downloadThe-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.gz
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.bz2
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.lz
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.xz
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.tar.zst
The-Simpsons-Hit-and-Run-eb4b3404aa00220d659e532151dab13d642c17a3.zip
Diffstat (limited to 'tools/worldbuilder/code/main')
-rw-r--r--tools/worldbuilder/code/main/constants.h31
-rw-r--r--tools/worldbuilder/code/main/pluginMain.cpp193
-rw-r--r--tools/worldbuilder/code/main/pluginMain.h38
-rw-r--r--tools/worldbuilder/code/main/toolhack.h8
-rw-r--r--tools/worldbuilder/code/main/worldbuilder.cpp267
-rw-r--r--tools/worldbuilder/code/main/worldbuilder.h260
6 files changed, 797 insertions, 0 deletions
diff --git a/tools/worldbuilder/code/main/constants.h b/tools/worldbuilder/code/main/constants.h
new file mode 100644
index 0000000..fbdc641
--- /dev/null
+++ b/tools/worldbuilder/code/main/constants.h
@@ -0,0 +1,31 @@
+#ifndef WB_CONSTANTS
+#define WB_CONSTANTS
+
+namespace WBConstants
+{
+ const unsigned int TypeIDPrefix = 0x00040201;
+ const float Scale = 100.0f;
+
+ namespace NodeIDs
+ {
+ const unsigned int EventLocator = 0xd0;
+ const unsigned int ScriptLocator = 0xd1;
+ const unsigned int GenericLocator = 0xd2;
+ const unsigned int CarStartLocator = 0xd3;
+ const unsigned int SplineLocator = 0xd4;
+ const unsigned int ZoneEventLocator = 0xd5;
+ const unsigned int OcclusionLocator = 0xd6;
+ const unsigned int RailCamLocator = 0xd7;
+ const unsigned int InteriorEntranceLocator = 0xd8;
+ const unsigned int DirectionalLocator = 0xd9;
+ const unsigned int ActionEventLocator = 0xda;
+ const unsigned int FOVLocator = 0xdb;
+ const unsigned int BreakableCameraLocator = 0xdc;
+ const unsigned int StaticCameraLocator = 0xdd;
+ const unsigned int PedGroupLocator = 0xde;
+
+ const unsigned int TriggerVolume = 0xe0;
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/tools/worldbuilder/code/main/pluginMain.cpp b/tools/worldbuilder/code/main/pluginMain.cpp
new file mode 100644
index 0000000..220f8e6
--- /dev/null
+++ b/tools/worldbuilder/code/main/pluginMain.cpp
@@ -0,0 +1,193 @@
+//
+// Copyright (C) 2002 Radical Entertainment
+//
+// File: pluginMain.cpp
+//
+// Author: Maya SDK Wizard
+//
+
+#include <maya/MFnPlugin.h>
+
+//This is a warning provided by the STL... It seems that toollib gets whacky when there
+//is other templates made... Sigh...
+#pragma warning(disable:4786)
+
+#include "pluginmain.h"
+#include "worldbuilder.h"
+
+#include "utility/mayahandles.h"
+#include "utility/mext.h"
+
+#include "gameengine/gameengine.h"
+
+#include "../../../game/code/meta/locatorevents.h"
+
+//Nodes
+#include "nodes/eventlocatornode.h"
+#include "nodes/scriptlocatornode.h"
+#include "nodes/genericlocatornode.h"
+#include "nodes/carstartlocatornode.h"
+#include "nodes/splinelocatornode.h"
+#include "nodes/triggervolumenode.h"
+#include "nodes/zoneeventlocatornode.h"
+#include "nodes/occlusionlocatornode.h"
+#include "nodes/railcamlocatornode.h"
+#include "nodes/interiorentrancelocatornode.h"
+#include "nodes/directionallocatornode.h"
+#include "nodes/actioneventlocatornode.h"
+#include "nodes/fovlocatornode.h"
+#include "nodes/BreakableCameraLocatorNode.h"
+#include "nodes/staticcameralocatornode.h"
+#include "nodes/pedgrouplocator.h"
+
+
+//Contexts
+#include "contexts/LocatorContext.h"
+#include "contexts/TriggerContext.h"
+
+//Commands
+#include "commands/worldbuildercommands.h"
+#include "commands/export.h"
+
+#include <radtime.hpp>
+#include <radmemory.hpp>
+#include <radthread.hpp>
+
+WorldBuilder* gWB;
+
+MStatus initializePlugin( MObject obj )
+//
+// Description:
+// this method is called when the plug-in is loaded into Maya. It
+// registers all of the services that this plug-in provides with
+// Maya.
+//
+// Arguments:
+// obj - a handle to the plug-in object (use MFnPlugin to access it)
+//
+{
+ MStatus status;
+
+
+ MayaHandles::SetHInstance( (void*)(MhInstPlugin) );
+
+ MFnPlugin plugin( obj, "Radical Entertainment", "4.0.1", "Any", &status );
+ assert( status );
+
+ radTimeInitialize();
+ radMemoryInitialize();
+ radThreadInitialize();
+
+ // Add plug-in feature registration here
+ //
+
+ //This is a test due to changes in the SRR stuff.
+ bool test = LocatorEvent::TestEvents();
+ assert( test );
+
+
+ //Register Nodes
+ REGISTER_LOCATOR( plugin, ScriptLocatorNode );
+ REGISTER_LOCATOR( plugin, GenericLocatorNode );
+ REGISTER_LOCATOR( plugin, CarStartLocatorNode );
+ REGISTER_LOCATOR( plugin, SplineLocatorNode );
+ REGISTER_LOCATOR( plugin, TriggerVolumeNode );
+ REGISTER_LOCATOR( plugin, EventLocatorNode );
+ REGISTER_LOCATOR( plugin, ZoneEventLocatorNode );
+ REGISTER_LOCATOR( plugin, OcclusionLocatorNode );
+ REGISTER_LOCATOR( plugin, RailCamLocatorNode );
+ REGISTER_LOCATOR( plugin, InteriorEntranceLocatorNode );
+ REGISTER_LOCATOR( plugin, DirectionalLocatorNode );
+ REGISTER_LOCATOR( plugin, ActionEventLocatorNode );
+ REGISTER_LOCATOR( plugin, FOVLocatorNode );
+ REGISTER_LOCATOR( plugin, BreakableCameraLocatorNode );
+ REGISTER_LOCATOR( plugin, StaticCameraLocatorNode );
+ REGISTER_LOCATOR( plugin, PedGroupLocatorNode );
+
+ //Register Contexts
+ REGISTER_CONTEXT( plugin, LocatorContext );
+ REGISTER_CONTEXT( plugin, TriggerContext );
+
+ //Register Commands
+ REGISTER_COMMAND( plugin, WBChangeDisplayCommand );
+ REGISTER_COMMAND( plugin, WBSetLocatorTypeCmd );
+ REGISTER_COMMAND( plugin, WBSetPrefixCmd );
+ REGISTER_COMMAND( plugin, WBSnapLocatorCmd );
+ REGISTER_COMMAND( plugin, ExportCommand );
+ REGISTER_COMMAND( plugin, WBSplineCompleteCmd );
+ REGISTER_COMMAND( plugin, WBCoinSplineCompleteCmd );
+ REGISTER_COMMAND( plugin, WBSelectObjectCmd );
+
+ gWB = new WorldBuilder();
+
+ //Run any startup scripts.
+ MGlobal::sourceFile( MString( "wb_main.mel" ) );
+
+ GameEngine::CreateInstance();
+
+ return status;
+}
+
+MStatus uninitializePlugin( MObject obj )
+//
+// Description:
+// this method is called when the plug-in is unloaded from Maya. It
+// deregisters all of the services that it was providing.
+//
+// Arguments:
+// obj - a handle to the plug-in object (use MFnPlugin to access it)
+//
+{
+ MStatus status;
+ MFnPlugin plugin( obj );
+
+ // Add plug-in feature deregistration here
+ //
+
+ //Run any cleanup scripts.
+ MGlobal::sourceFile( MString( "wb_cleanup.mel" ) );
+
+ if ( gWB )
+ {
+ delete gWB;
+ }
+
+ //Deregister Commands
+ DEREGISTER_COMMAND( plugin, WBSelectObjectCmd );
+ DEREGISTER_COMMAND( plugin, WBSplineCompleteCmd );
+ DEREGISTER_COMMAND( plugin, WBCoinSplineCompleteCmd );
+ DEREGISTER_COMMAND( plugin, ExportCommand );
+ DEREGISTER_COMMAND( plugin, WBSnapLocatorCmd );
+ DEREGISTER_COMMAND( plugin, WBSetPrefixCmd );
+ DEREGISTER_COMMAND( plugin, WBChangeDisplayCommand );
+ DEREGISTER_COMMAND( plugin, WBSetLocatorTypeCmd );
+
+ //Deregister Contexts
+ DEREGISTER_CONTEXT( plugin, TriggerContext );
+ DEREGISTER_CONTEXT( plugin, LocatorContext );
+
+ //Deregister Nodes
+ DEREGISTER_NODE( plugin, SplineLocatorNode );
+ DEREGISTER_NODE( plugin, TriggerVolumeNode );
+ DEREGISTER_NODE( plugin, CarStartLocatorNode);
+ DEREGISTER_NODE( plugin, GenericLocatorNode );
+ DEREGISTER_NODE( plugin, ScriptLocatorNode );
+ DEREGISTER_NODE( plugin, EventLocatorNode );
+ DEREGISTER_NODE( plugin, ZoneEventLocatorNode );
+ DEREGISTER_NODE( plugin, OcclusionLocatorNode );
+ DEREGISTER_NODE( plugin, RailCamLocatorNode );
+ DEREGISTER_NODE( plugin, InteriorEntranceLocatorNode );
+ DEREGISTER_NODE( plugin, DirectionalLocatorNode );
+ DEREGISTER_NODE( plugin, ActionEventLocatorNode );
+ DEREGISTER_NODE( plugin, FOVLocatorNode );
+ DEREGISTER_NODE( plugin, BreakableCameraLocatorNode );
+ DEREGISTER_NODE( plugin, StaticCameraLocatorNode );
+ DEREGISTER_NODE( plugin, PedGroupLocatorNode );
+
+ GameEngine::DestroyInstance();
+
+ radTimeTerminate();
+
+ return status;
+}
+ \ No newline at end of file
diff --git a/tools/worldbuilder/code/main/pluginMain.h b/tools/worldbuilder/code/main/pluginMain.h
new file mode 100644
index 0000000..3645a0d
--- /dev/null
+++ b/tools/worldbuilder/code/main/pluginMain.h
@@ -0,0 +1,38 @@
+//----------------------------------------
+// MACROS
+//----------------------------------------
+
+#define REGISTER_COMMAND( p, c ) if ( ! ( ( p ).registerCommand( c##::stringId, \
+ c##::creator ) \
+ ) \
+ ) return MS::kFailure
+
+#define REGISTER_CONTEXT( p, c ) if ( ! ( ( p ).registerContextCommand( c##::stringId, \
+ c##Cmd::creator ) \
+ ) \
+ ) return MS::kFailure
+
+
+#define REGISTER_LOCATOR( p, n ) if ( ! ( ( p ).registerNode( n##::stringId, \
+ n##::id, \
+ n##::creator, \
+ n##::initialize, \
+ MPxNode::kLocatorNode ) \
+ ) \
+ ) return MS::kFailure
+
+#define REGISTER_NODE( p, n ) if ( ! ( ( p ).registerNode( n##::stringId, \
+ n##::id, \
+ n##::creator, \
+ n##::initialize ) \
+ ) \
+ ) return MS::kFailure
+
+#define DEREGISTER_COMMAND( p, c ) ( p ).deregisterCommand( c##::stringId )
+
+#define DEREGISTER_CONTEXT( p, c ) ( p ).deregisterContextCommand( c##::stringId )
+
+//#define DEREGISTER_NODE( p, n ) n##::Unload();\
+// ( p ).deregisterNode( n##::id )
+
+#define DEREGISTER_NODE( p, n ) ( p ).deregisterNode( n##::id )
diff --git a/tools/worldbuilder/code/main/toolhack.h b/tools/worldbuilder/code/main/toolhack.h
new file mode 100644
index 0000000..633195c
--- /dev/null
+++ b/tools/worldbuilder/code/main/toolhack.h
@@ -0,0 +1,8 @@
+#ifndef TOOL_HACK
+#define TOOL_HACK
+
+//FUCKING HACK!
+enum tLoadStatus { LOAD_OK, LOAD_ERROR };
+typedef enum tLoadStatus tlLoadStatus;
+
+#endif \ No newline at end of file
diff --git a/tools/worldbuilder/code/main/worldbuilder.cpp b/tools/worldbuilder/code/main/worldbuilder.cpp
new file mode 100644
index 0000000..8a0d034
--- /dev/null
+++ b/tools/worldbuilder/code/main/worldbuilder.cpp
@@ -0,0 +1,267 @@
+//=============================================================================
+// Copyright (C) 2002 Radical Entertainment Ltd. All rights reserved.
+//
+// File: WorldBuilder.cpp
+//
+// Description: Implement WorldBuilder
+//
+// History: 16/05/2002 + Created -- Cary Brisebois
+//
+//=============================================================================
+
+//========================================
+// System Includes
+//========================================
+// Foundation Tech
+
+//========================================
+// Project Includes
+//========================================
+#include "WorldBuilder.h"
+#include "utility/mext.h"
+
+#include "nodes/eventlocatornode.h"
+#include "nodes/scriptlocatornode.h"
+#include "nodes/genericlocatornode.h"
+#include "nodes/carstartlocatornode.h"
+#include "nodes/splinelocatornode.h"
+#include "nodes/triggervolumenode.h"
+#include "nodes/zoneeventlocatornode.h"
+#include "nodes/occlusionlocatornode.h"
+#include "nodes/railcamlocatornode.h"
+#include "nodes/interiorentrancelocatornode.h"
+#include "nodes/directionallocatornode.h"
+#include "nodes/actioneventlocatornode.h"
+#include "nodes/fovlocatornode.h"
+#include "nodes/BreakableCameraLocatorNode.h"
+#include "nodes/staticcameralocatornode.h"
+#include "nodes/pedgrouplocator.h"
+
+
+//******************************************************************************
+//
+// Global Data, Local Data, Local Classes
+//
+//******************************************************************************
+
+//******************************************************************************
+//
+// Public Member Functions
+//
+//******************************************************************************
+
+unsigned int WorldBuilder::sDisplayLevel = ALL;
+LocatorType::Type WorldBuilder::sLocatorType = LocatorType::EVENT;
+
+const char* WorldBuilder::sName = "WORLD_BUILDER_NAME";
+
+char WorldBuilder::sPrefix[MAX_PREFIX_LENGTH + 1];
+char WorldBuilder::sSelectedLocator[MAX_NAME_LENGTH + 1];
+
+//==============================================================================
+// WorldBuilder::WorldBuilder
+//==============================================================================
+// Description: Constructor.
+//
+// Parameters: None.
+//
+// Return: N/A.
+//
+//==============================================================================
+WorldBuilder::WorldBuilder()
+{
+ sPrefix[0] = '\0';
+ sPrefix[MAX_PREFIX_LENGTH] = '\0';
+}
+
+//==============================================================================
+// WorldBuilder::~WorldBuilder
+//==============================================================================
+// Description: Destructor.
+//
+// Parameters: None.
+//
+// Return: N/A.
+//
+//==============================================================================
+WorldBuilder::~WorldBuilder()
+{
+}
+
+//=============================================================================
+// WorldBuilder::Exists
+//=============================================================================
+// Description: Comment
+//
+// Parameters: ()
+//
+// Return: bool
+//
+//=============================================================================
+bool WorldBuilder::Exists()
+{
+ MDagPath pathToWorldBuilder;
+ return MExt::FindDagNodeByName( &pathToWorldBuilder, MString( WorldBuilder::sName ) );
+}
+
+//=============================================================================
+// WorldBuilder::AddChild
+//=============================================================================
+// Description: Comment
+//
+// Parameters: ( MObject& obj )
+//
+// Return: MStatus
+//
+//=============================================================================
+MStatus WorldBuilder::AddChild( MObject& obj )
+{
+ //Make sure this exists.
+ CreateWorldBuilderNode();
+
+ MDagPath pathToWorldBuilder;
+
+ bool good = false;
+
+ if ( MExt::FindDagNodeByName( &pathToWorldBuilder, MString( WorldBuilder::sName ) ) )
+ {
+ good = true;
+ }
+
+ if ( good )
+ {
+ MFnDagNode fnDagNodeWB;
+
+ //Which type?
+ MFnDagNode fnDagNodeObj( obj );
+
+ if ( fnDagNodeObj.typeId() == EventLocatorNode::id ||
+ fnDagNodeObj.typeId() == ScriptLocatorNode::id ||
+ fnDagNodeObj.typeId() == CarStartLocatorNode::id ||
+ fnDagNodeObj.typeId() == SplineLocatorNode::id ||
+ fnDagNodeObj.typeId() == ZoneEventLocatorNode::id ||
+ fnDagNodeObj.typeId() == GenericLocatorNode::id ||
+ fnDagNodeObj.typeId() == RailCamLocatorNode::id ||
+ fnDagNodeObj.typeId() == ActionEventLocatorNode::id ||
+ fnDagNodeObj.typeId() == DirectionalLocatorNode::id ||
+ fnDagNodeObj.typeId() == InteriorEntranceLocatorNode::id ||
+ fnDagNodeObj.typeId() == FOVLocatorNode::id ||
+ fnDagNodeObj.typeId() == BreakableCameraLocatorNode::id ||
+ fnDagNodeObj.typeId() == StaticCameraLocatorNode::id ||
+ fnDagNodeObj.typeId() == OcclusionLocatorNode::id ||
+ fnDagNodeObj.typeId() == PedGroupLocatorNode::id )
+ {
+ //This is a locator, parent to the "Locator" node.
+ MDagPath dagPath;
+ if ( MExt::FindDagNodeByName( &dagPath, MString(LOCATORS_NAME), pathToWorldBuilder.node() ) )
+ {
+ fnDagNodeWB.setObject( dagPath.node() );
+ }
+ else
+ {
+ MExt::DisplayError( "Someone has deleted World Builder nodes!!" );
+ }
+ }
+ else if ( fnDagNodeObj.typeId() == TriggerVolumeNode::id )
+ {
+ //This is a locator, parent to the "TriggerVolumes" node.
+ MDagPath dagPath;
+ if ( MExt::FindDagNodeByName( &dagPath, MString(TRIGGER_VOLUMES_NAME), pathToWorldBuilder.node() ) )
+ {
+ fnDagNodeWB.setObject( dagPath.node() );
+ }
+ else
+ {
+ MExt::DisplayError( "Someone has deleted World Builder nodes!!" );
+ }
+ }
+ else
+ {
+ MStatus status;
+ MFnNurbsCurve fnNurbs( obj, &status );
+ if ( status )
+ {
+ MDagPath dagPath;
+ if ( MExt::FindDagNodeByName( &dagPath, MString(SPLINES_NAME), pathToWorldBuilder.node() ) )
+ {
+ fnDagNodeWB.setObject( dagPath.node() );
+ }
+ else
+ {
+ MExt::DisplayError( "Someone has deleted World Builder nodes!!" );
+ }
+ }
+ else
+ {
+ fnDagNodeWB.setObject( pathToWorldBuilder.node() );
+ }
+ }
+
+ MObject objT = fnDagNodeObj.parent( 0 );
+
+ return fnDagNodeWB.addChild( objT );
+ }
+
+ return MS::kFailure;
+}
+
+//******************************************************************************
+//
+// Private Member Functions
+//
+//******************************************************************************
+
+//=============================================================================
+// WorldBuilder::CreateWorldBuilderNode
+//=============================================================================
+// Description: Comment
+//
+// Parameters: ()
+//
+// Return: void
+//
+//=============================================================================
+void WorldBuilder::CreateWorldBuilderNode()
+{
+ MStatus status;
+
+ MFnTransform transform;
+ MObject wb, loc, tv, sp;
+
+ MDagPath pathToWorldBuilder, testPath;
+
+ if ( !MExt::FindDagNodeByName( &pathToWorldBuilder, MString( WorldBuilder::sName ) ) )
+ {
+ //Create the worldbuilder transform.
+ wb = transform.create( MObject::kNullObj, &status );
+ assert( status );
+ transform.setName( MString( WorldBuilder::sName ) );
+ }
+ else
+ {
+ wb = pathToWorldBuilder.node();
+ }
+
+ if ( !MExt::FindDagNodeByName( &pathToWorldBuilder, MString( LOCATORS_NAME ) ) )
+ {
+ loc = transform.create( wb, &status );
+ assert( status );
+ transform.setName( MString( LOCATORS_NAME ) );
+ }
+
+ if ( !MExt::FindDagNodeByName( &pathToWorldBuilder, MString( TRIGGER_VOLUMES_NAME ) ) )
+ {
+ tv = transform.create( wb, &status );
+ assert( status );
+ transform.setName( MString( TRIGGER_VOLUMES_NAME ) );
+ }
+
+ if ( !MExt::FindDagNodeByName( &pathToWorldBuilder, MString( SPLINES_NAME ) ) )
+ {
+ sp = transform.create( wb, &status );
+ assert( status );
+ transform.setName( MString( SPLINES_NAME ) );
+ }
+
+ MGlobal::executeCommand( "wb_Create_WorldBuilderNode()" );
+} \ No newline at end of file
diff --git a/tools/worldbuilder/code/main/worldbuilder.h b/tools/worldbuilder/code/main/worldbuilder.h
new file mode 100644
index 0000000..846247a
--- /dev/null
+++ b/tools/worldbuilder/code/main/worldbuilder.h
@@ -0,0 +1,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