Преглед на файлове

created 14 more ScriptBinding files (with new docs format).

Charlie Patterson преди 12 години
родител
ревизия
de1e58a4f7
променени са 27 файла, в които са добавени 131 реда и са изтрити 1233 реда
  1. 13 0
      engine/compilers/VisualStudio 2012/Torque 2D.vcxproj
  2. 39 0
      engine/compilers/VisualStudio 2012/Torque 2D.vcxproj.filters
  3. 7 88
      engine/source/collection/undo.cc
  4. BIN
      engine/source/collection/undo_ScriptBinding.h
  5. 2 72
      engine/source/component/simComponent.cpp
  6. BIN
      engine/source/component/simComponent_ScriptBinding.h
  7. 2 37
      engine/source/console/consoleDoc.cc
  8. BIN
      engine/source/console/consoleDoc_ScriptBinding.h
  9. 2 16
      engine/source/console/consoleLogger.cc
  10. BIN
      engine/source/console/consoleLogger_ScriptBinding.h
  11. 2 64
      engine/source/game/gameConnection.cc
  12. BIN
      engine/source/game/gameConnection_ScriptBinding.h
  13. 2 114
      engine/source/io/streamObject.cc
  14. BIN
      engine/source/io/streamObject_ScriptBinding.h
  15. 2 128
      engine/source/io/zip/zipObject.cc
  16. BIN
      engine/source/io/zip/zipObject_ScriptBinding.h
  17. 49 0
      engine/source/math/box_ScriptBinding.h
  18. 5 370
      engine/source/math/mathTypes.cc
  19. BIN
      engine/source/math/matrix_ScriptBinding.h
  20. BIN
      engine/source/math/random_ScriptBinding.h
  21. BIN
      engine/source/math/vector_ScriptBinding.h
  22. 2 84
      engine/source/messaging/dispatcher.cc
  23. BIN
      engine/source/messaging/dispatcher_ScriptBinding.h
  24. 2 165
      engine/source/network/netConnection.cc
  25. BIN
      engine/source/network/netConnection_ScriptBinding.h
  26. 2 95
      engine/source/platform/menus/popupMenu.cc
  27. BIN
      engine/source/platform/menus/popupMenu_ScriptBinding.h

+ 13 - 0
engine/compilers/VisualStudio 2012/Torque 2D.vcxproj

@@ -784,6 +784,7 @@
     <ClInclude Include="..\..\source\collection\simpleHashTable.h" />
     <ClInclude Include="..\..\source\collection\simpleHashTable.h" />
     <ClInclude Include="..\..\source\collection\sparseArray.h" />
     <ClInclude Include="..\..\source\collection\sparseArray.h" />
     <ClInclude Include="..\..\source\collection\undo.h" />
     <ClInclude Include="..\..\source\collection\undo.h" />
+    <ClInclude Include="..\..\source\collection\undo_ScriptBinding.h" />
     <ClInclude Include="..\..\source\collection\vector.h" />
     <ClInclude Include="..\..\source\collection\vector.h" />
     <ClInclude Include="..\..\source\collection\vector2d.h" />
     <ClInclude Include="..\..\source\collection\vector2d.h" />
     <ClInclude Include="..\..\source\collection\vectorHeap.h" />
     <ClInclude Include="..\..\source\collection\vectorHeap.h" />
@@ -792,10 +793,13 @@
     <ClInclude Include="..\..\source\component\behaviors\behaviorComponent_ScriptBinding.h" />
     <ClInclude Include="..\..\source\component\behaviors\behaviorComponent_ScriptBinding.h" />
     <ClInclude Include="..\..\source\component\behaviors\behaviorInstance_ScriptBinding.h" />
     <ClInclude Include="..\..\source\component\behaviors\behaviorInstance_ScriptBinding.h" />
     <ClInclude Include="..\..\source\component\behaviors\behaviorTemplate_ScriptBinding.h" />
     <ClInclude Include="..\..\source\component\behaviors\behaviorTemplate_ScriptBinding.h" />
+    <ClInclude Include="..\..\source\component\simComponent_ScriptBinding.h" />
     <ClInclude Include="..\..\source\console\consoleBaseType.h" />
     <ClInclude Include="..\..\source\console\consoleBaseType.h" />
     <ClInclude Include="..\..\source\console\consoleDictionary.h" />
     <ClInclude Include="..\..\source\console\consoleDictionary.h" />
+    <ClInclude Include="..\..\source\console\consoleDoc_ScriptBinding.h" />
     <ClInclude Include="..\..\source\console\consoleExprEvalState.h" />
     <ClInclude Include="..\..\source\console\consoleExprEvalState.h" />
     <ClInclude Include="..\..\source\console\consoleInternal.h" />
     <ClInclude Include="..\..\source\console\consoleInternal.h" />
+    <ClInclude Include="..\..\source\console\consoleLogger_ScriptBinding.h" />
     <ClInclude Include="..\..\source\console\consoleNamespace.h" />
     <ClInclude Include="..\..\source\console\consoleNamespace.h" />
     <ClInclude Include="..\..\source\console\ConsoleTypeValidators.h" />
     <ClInclude Include="..\..\source\console\ConsoleTypeValidators.h" />
     <ClInclude Include="..\..\source\console\expando_ScriptBinding.h" />
     <ClInclude Include="..\..\source\console\expando_ScriptBinding.h" />
@@ -812,6 +816,7 @@
     <ClInclude Include="..\..\source\delegates\delegateSignal.h" />
     <ClInclude Include="..\..\source\delegates\delegateSignal.h" />
     <ClInclude Include="..\..\source\delegates\FastDelegate.h" />
     <ClInclude Include="..\..\source\delegates\FastDelegate.h" />
     <ClInclude Include="..\..\source\game\defaultGame.h" />
     <ClInclude Include="..\..\source\game\defaultGame.h" />
+    <ClInclude Include="..\..\source\game\gameConnection_ScriptBinding.h" />
     <ClInclude Include="..\..\source\game\gameInterface.h" />
     <ClInclude Include="..\..\source\game\gameInterface.h" />
     <ClInclude Include="..\..\source\game\gameInterface_ScriptBinding.h" />
     <ClInclude Include="..\..\source\game\gameInterface_ScriptBinding.h" />
     <ClInclude Include="..\..\source\game\version_ScriptBinding.h" />
     <ClInclude Include="..\..\source\game\version_ScriptBinding.h" />
@@ -877,6 +882,7 @@
     <ClInclude Include="..\..\source\io\resource\resourceManager.h" />
     <ClInclude Include="..\..\source\io\resource\resourceManager.h" />
     <ClInclude Include="..\..\source\io\stream.h" />
     <ClInclude Include="..\..\source\io\stream.h" />
     <ClInclude Include="..\..\source\io\streamObject.h" />
     <ClInclude Include="..\..\source\io\streamObject.h" />
+    <ClInclude Include="..\..\source\io\streamObject_ScriptBinding.h" />
     <ClInclude Include="..\..\source\io\zip\centralDir.h" />
     <ClInclude Include="..\..\source\io\zip\centralDir.h" />
     <ClInclude Include="..\..\source\io\zip\compressor.h" />
     <ClInclude Include="..\..\source\io\zip\compressor.h" />
     <ClInclude Include="..\..\source\io\zip\extraField.h" />
     <ClInclude Include="..\..\source\io\zip\extraField.h" />
@@ -887,12 +893,17 @@
     <ClInclude Include="..\..\source\io\zip\zipStatFilter.h" />
     <ClInclude Include="..\..\source\io\zip\zipStatFilter.h" />
     <ClInclude Include="..\..\source\io\zip\zipSubStream.h" />
     <ClInclude Include="..\..\source\io\zip\zipSubStream.h" />
     <ClInclude Include="..\..\source\io\zip\zipTempStream.h" />
     <ClInclude Include="..\..\source\io\zip\zipTempStream.h" />
+    <ClInclude Include="..\..\source\math\box_ScriptBinding.h" />
+    <ClInclude Include="..\..\source\math\matrix_ScriptBinding.h" />
+    <ClInclude Include="..\..\source\math\random_ScriptBinding.h" />
     <ClInclude Include="..\..\source\math\rectClipper.h" />
     <ClInclude Include="..\..\source\math\rectClipper.h" />
+    <ClInclude Include="..\..\source\math\vector_ScriptBinding.h" />
     <ClInclude Include="..\..\source\memory\dataChunker.h" />
     <ClInclude Include="..\..\source\memory\dataChunker.h" />
     <ClInclude Include="..\..\source\memory\factoryCache.h" />
     <ClInclude Include="..\..\source\memory\factoryCache.h" />
     <ClInclude Include="..\..\source\memory\frameAllocator.h" />
     <ClInclude Include="..\..\source\memory\frameAllocator.h" />
     <ClInclude Include="..\..\source\memory\safeDelete.h" />
     <ClInclude Include="..\..\source\memory\safeDelete.h" />
     <ClInclude Include="..\..\source\messaging\dispatcher.h" />
     <ClInclude Include="..\..\source\messaging\dispatcher.h" />
+    <ClInclude Include="..\..\source\messaging\dispatcher_ScriptBinding.h" />
     <ClInclude Include="..\..\source\messaging\eventManager.h" />
     <ClInclude Include="..\..\source\messaging\eventManager.h" />
     <ClInclude Include="..\..\source\messaging\eventManager_ScriptBinding.h" />
     <ClInclude Include="..\..\source\messaging\eventManager_ScriptBinding.h" />
     <ClInclude Include="..\..\source\messaging\message.h" />
     <ClInclude Include="..\..\source\messaging\message.h" />
@@ -909,6 +920,7 @@
     <ClInclude Include="..\..\source\network\connectionStringTable.h" />
     <ClInclude Include="..\..\source\network\connectionStringTable.h" />
     <ClInclude Include="..\..\source\network\httpObject.h" />
     <ClInclude Include="..\..\source\network\httpObject.h" />
     <ClInclude Include="..\..\source\network\netConnection.h" />
     <ClInclude Include="..\..\source\network\netConnection.h" />
+    <ClInclude Include="..\..\source\network\netConnection_ScriptBinding.h" />
     <ClInclude Include="..\..\source\network\netInterface.h" />
     <ClInclude Include="..\..\source\network\netInterface.h" />
     <ClInclude Include="..\..\source\network\netObject.h" />
     <ClInclude Include="..\..\source\network\netObject.h" />
     <ClInclude Include="..\..\source\network\netStringTable.h" />
     <ClInclude Include="..\..\source\network\netStringTable.h" />
@@ -998,6 +1010,7 @@
     <ClInclude Include="..\..\source\platform\GLCoreFunc.h" />
     <ClInclude Include="..\..\source\platform\GLCoreFunc.h" />
     <ClInclude Include="..\..\source\platform\GLExtFunc.h" />
     <ClInclude Include="..\..\source\platform\GLExtFunc.h" />
     <ClInclude Include="..\..\source\platform\GLUFunc.h" />
     <ClInclude Include="..\..\source\platform\GLUFunc.h" />
+    <ClInclude Include="..\..\source\platform\menus\popupMenu_ScriptBinding.h" />
     <ClInclude Include="..\..\source\platform\nativeDialogs\fileDialog_ScriptBinding.h" />
     <ClInclude Include="..\..\source\platform\nativeDialogs\fileDialog_ScriptBinding.h" />
     <ClInclude Include="..\..\source\platform\platform.h" />
     <ClInclude Include="..\..\source\platform\platform.h" />
     <ClInclude Include="..\..\source\platform\platformAL.h" />
     <ClInclude Include="..\..\source\platform\platformAL.h" />

+ 39 - 0
engine/compilers/VisualStudio 2012/Torque 2D.vcxproj.filters

@@ -2808,6 +2808,45 @@
     <ClInclude Include="..\..\source\platform\nativeDialogs\fileDialog_ScriptBinding.h">
     <ClInclude Include="..\..\source\platform\nativeDialogs\fileDialog_ScriptBinding.h">
       <Filter>platform\nativeDialogs</Filter>
       <Filter>platform\nativeDialogs</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="..\..\source\console\consoleLogger_ScriptBinding.h">
+      <Filter>console</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\network\netConnection_ScriptBinding.h">
+      <Filter>network</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\game\gameConnection_ScriptBinding.h">
+      <Filter>game</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\platform\menus\popupMenu_ScriptBinding.h">
+      <Filter>platform\menus</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\io\streamObject_ScriptBinding.h">
+      <Filter>io</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\collection\undo_ScriptBinding.h">
+      <Filter>collection</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\console\consoleDoc_ScriptBinding.h">
+      <Filter>console</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\messaging\dispatcher_ScriptBinding.h">
+      <Filter>messaging</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\math\random_ScriptBinding.h">
+      <Filter>math</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\math\matrix_ScriptBinding.h">
+      <Filter>math</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\math\vector_ScriptBinding.h">
+      <Filter>math</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\math\box_ScriptBinding.h">
+      <Filter>math</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\source\component\simComponent_ScriptBinding.h">
+      <Filter>component</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <CustomBuild Include="..\..\source\math\mMath_ASM.asm">
     <CustomBuild Include="..\..\source\math\mMath_ASM.asm">

+ 7 - 88
engine/source/collection/undo.cc

@@ -25,6 +25,8 @@
 #include "console/console.h"
 #include "console/console.h"
 #include "console/consoleTypes.h"
 #include "console/consoleTypes.h"
 
 
+#include "undo_ScriptBinding.h"
+
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // UndoAction
 // UndoAction
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -37,6 +39,11 @@ UndoAction::UndoAction( const UTF8* actionName)
    mUndoManager = NULL;
    mUndoManager = NULL;
 }
 }
 
 
+S32 UndoManager::getRedoCount()
+{
+   return mRedoStack.size();
+}
+
 // Modified to clean up quiet sub actions [KNM | 08/10/11 | ITGB-152]
 // Modified to clean up quiet sub actions [KNM | 08/10/11 | ITGB-152]
 UndoAction::~UndoAction()
 UndoAction::~UndoAction()
 {
 {
@@ -141,12 +148,6 @@ UndoManager& UndoManager::getDefaultManager()
    return *defaultMan;
    return *defaultMan;
 }
 }
 
 
-ConsoleMethod(UndoManager, clearAll, void, 2, 2, "Clears the undo manager."
-              "@return No Return Value")
-{
-   object->clearAll();
-}
-
 void UndoManager::clearAll()
 void UndoManager::clearAll()
 {
 {
    clearStack(mUndoStack); clearStack(mRedoStack);
    clearStack(mUndoStack); clearStack(mRedoStack);
@@ -263,23 +264,11 @@ void UndoManager::redo()
    (*react).redo();
    (*react).redo();
 }
 }
 
 
-ConsoleMethod(UndoManager, getUndoCount, S32, 2, 2, "() \n @return Returns the number of UndoActions stored as an integer")
-{
-   return object->getUndoCount();
-}
-
 S32 UndoManager::getUndoCount()
 S32 UndoManager::getUndoCount()
 {
 {
    return mUndoStack.size();
    return mUndoStack.size();
 }
 }
 
 
-ConsoleMethod(UndoManager, getUndoName, const char*, 3, 3, "( S32 index ) Gets the name of the UndoAction at given index.\n "
-              "@param index An integer index value for the desired undo\n"
-              "@return The name as a string")
-{
-   return object->getUndoName(dAtoi(argv[2]));
-}
-
 StringTableEntry UndoManager::getUndoName(S32 index)
 StringTableEntry UndoManager::getUndoName(S32 index)
 {
 {
    if ((index < getUndoCount()) && (index >= 0))
    if ((index < getUndoCount()) && (index >= 0))
@@ -288,23 +277,6 @@ StringTableEntry UndoManager::getUndoName(S32 index)
    return NULL;
    return NULL;
 }
 }
 
 
-ConsoleMethod(UndoManager, getRedoCount, S32, 2, 2, "() \n @return Returns the number of redo Actions stored as an integer")
-{
-   return object->getRedoCount();
-}
-
-S32 UndoManager::getRedoCount()
-{
-   return mRedoStack.size();
-}
-
-ConsoleMethod(UndoManager, getRedoName, const char*, 3, 3, "( S32 index ) Gets the name of the Action at given index.\n "
-              "@param index An integer index value for the desired redo\n"
-              "@return The name as a string")
-{
-   return object->getRedoName(dAtoi(argv[2]));
-}
-
 StringTableEntry UndoManager::getRedoName(S32 index)
 StringTableEntry UndoManager::getRedoName(S32 index)
 {
 {
    if ((index < getRedoCount()) && (index >= 0))
    if ((index < getRedoCount()) && (index >= 0))
@@ -346,56 +318,3 @@ void UndoManager::addAction(UndoAction* action)
    // clear the redo stack
    // clear the redo stack
    clearStack(mRedoStack);
    clearStack(mRedoStack);
 }
 }
-
-//-----------------------------------------------------------------------------
-ConsoleMethod(UndoAction, addToManager, void, 2, 3, "action.addToManager([undoManager]) Adds an UndoAction to the manager"
-              "@param undoManager The manager to add the object to (default NULL)\n"
-              "@return No Return Value")
-{
-   UndoManager *theMan = NULL;
-   if(argc == 3)
-   {
-      SimObject *obj = Sim::findObject(argv[2]);
-      if(obj)
-         theMan = dynamic_cast<UndoManager*> (obj);
-   }
-   object->addToManager(theMan);
-}
-
-//-----------------------------------------------------------------------------
-ConsoleMethod(UndoManager, undo, void, 2, 2, "UndoManager.undo(); Pops the top undo action off the stack, resolves it, "
-                                            "and then pushes it onto the redo stack")
-{
-   object->undo();
-}
-
-//-----------------------------------------------------------------------------
-ConsoleMethod(UndoManager, redo, void, 2, 2, "UndoManager.redo(); Pops the top redo action off the stack, resolves it, "
-                                            "and then pushes it onto the undo stack")
-{
-   object->redo();
-}
-
-//-----------------------------------------------------------------------------
-ConsoleMethod(UndoManager, getNextUndoName, const char *, 2, 2, "UndoManager.getNextUndoName(); Gets the name of the action at the top of the undo stack\n"
-              "@return The name of the top action on the undo stack")
-{
-   StringTableEntry name = object->getNextUndoName();
-   if(!name)
-      return NULL;
-   char *ret = Con::getReturnBuffer(dStrlen(name) + 1);
-   dStrcpy(ret, name);
-   return ret;
-}
-
-//-----------------------------------------------------------------------------
-ConsoleMethod(UndoManager, getNextRedoName, const char *, 2, 2, "UndoManager.getNextRedoName(); Gets the name of the action at the top of the undo stack\n"
-              "@return The name of the top action on the redo stack")
-{
-   StringTableEntry name = object->getNextRedoName();
-   if(!name)
-      return NULL;
-   char *ret = Con::getReturnBuffer(dStrlen(name) + 1);
-   dStrcpy(ret, name);
-   return ret;
-}

BIN
engine/source/collection/undo_ScriptBinding.h


+ 2 - 72
engine/source/component/simComponent.cpp

@@ -27,6 +27,8 @@
 #include "io/stream.h"
 #include "io/stream.h"
 #include "behaviors/behaviorTemplate.h"
 #include "behaviors/behaviorTemplate.h"
 
 
+#include "simComponent_ScriptBinding.h"
+
 SimComponent::SimComponent() : mOwner( NULL )
 SimComponent::SimComponent() : mOwner( NULL )
 {
 {
    mComponentList.clear();
    mComponentList.clear();
@@ -310,75 +312,3 @@ bool SimComponent::callMethodOnComponents( U32 argc, const char* argv[], const c
 
 
    return false;
    return false;
 }
 }
-
-//////////////////////////////////////////////////////////////////////////
-// Console Methods
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod( SimComponent, addComponents, bool, 3, 64, "%obj.addComponents( %compObjName, %compObjName2, ... );\n"
-              "Adds additional components to current list.\n"
-              "@param Up to 62 component names\n"
-              "@return Returns true on success, false otherwise.")
-{
-   for(S32 i = 2; i < argc; i++)
-   {
-      SimComponent *obj = dynamic_cast<SimComponent*> (Sim::findObject(argv[i]) );
-      if(obj)
-         object->addComponent(obj);
-      else
-         Con::printf("SimComponent::addComponents - Invalid Component Object \"%s\"", argv[i]);
-   }
-   return true;
-}
-
-ConsoleMethod( SimComponent, removeComponents, bool, 3, 64, "%obj.removeComponents( %compObjName, %compObjName2, ... );\n"
-              "Removes components by name from current list.\n"
-              "@param objNamex Up to 62 component names\n"
-              "@return Returns true on success, false otherwise.")
-{
-   for(S32 i = 2; i < argc; i++)
-   {
-      SimComponent *obj = dynamic_cast<SimComponent*> (Sim::findObject(argv[i]) );
-      if(obj)
-         object->removeComponent(obj);
-      else
-         Con::printf("SimComponent::removeComponents - Invalid Component Object \"%s\"", argv[i]);
-   }
-   return true;
-}
-
-ConsoleMethod( SimComponent, getComponentCount, S32, 2, 2, "() Get the current component count\n"
-              "@return The number of components in the list as an integer")
-{
-   return object->getComponentCount();
-}
-
-ConsoleMethod( SimComponent, getComponent, S32, 3, 3, "(idx) Get the component corresponding to the given index.\n"
-              "@param idx An integer index value corresponding to the desired component.\n"
-              "@return The id of the component at the given index as an integer")
-{
-   S32 idx = dAtoi(argv[2]);
-   if(idx < 0 || idx >= (S32)object->getComponentCount())
-   {
-      Con::errorf("SimComponent::getComponent - Invalid index %d", idx);
-      return 0;
-   }
-
-   SimComponent *c = object->getComponent(idx);
-   return c ? c->getId() : 0;
-}
-
-ConsoleMethod(SimComponent, setEnabled, void, 3, 3, "(enabled) Sets or unsets the enabled flag\n"
-              "@param enabled Boolean value\n"
-              "@return No return value")
-{
-   object->setEnabled(dAtob(argv[2]));
-}
-
-ConsoleMethod(SimComponent, isEnabled, bool, 2, 2, "() Check whether SimComponent is currently enabled\n"
-              "@return true if enabled and false if not")
-{
-   return object->isEnabled();
-}
-
-

BIN
engine/source/component/simComponent_ScriptBinding.h


+ 2 - 37
engine/source/console/consoleDoc.cc

@@ -34,48 +34,13 @@
 #include "console/compiler.h"
 #include "console/compiler.h"
 #include "memory/frameAllocator.h"
 #include "memory/frameAllocator.h"
 
 
+#include "consoleDoc_ScriptBinding.h"
+
 //--- Information pertaining to this page... ------------------
 //--- Information pertaining to this page... ------------------
 /// @file
 /// @file
 ///
 ///
 /// For specifics on using the consoleDoc functionality, see @ref console_autodoc
 /// For specifics on using the consoleDoc functionality, see @ref console_autodoc
 
 
-ConsoleFunctionGroupBegin(ConsoleDoc, "Console self-documentation functions. These output psuedo C++ suitable for feeeding through Doxygen or another auto documentation tool.");
-
-ConsoleFunction(dumpConsoleClasses, void, 1, 3, "(bool dumpScript = true, bool dumpEngine = true) dumps all declared console classes to the console.\n"
-																"This will dump all classes and methods that were registered from within the engine, AND from the console via scripts.\n"
-                "@param dumpScript Specifies whether or not classes defined in script should be dumped.\n"
-                "@param dumpEngine Specifies whether or not classes defined in the engine should be dumped.")
-{
-   bool dumpScript = true;
-   if( argc > 1 )
-      dumpScript = dAtob( argv[1] );
-   
-   bool dumpEngine = true;
-   if( argc > 2 )
-      dumpEngine = dAtob( argv[2] );
-
-   Namespace::dumpClasses( dumpScript, dumpEngine );
-}
-
-ConsoleFunction(dumpConsoleFunctions, void, 1, 3, "(bool dumpScript = true, bool dumpEngine = true) Dumps all declared console functions to the console.\n"
-				"This will dump all funtions that were registered from within the engine, AND from the console via scripts.\n"
-                "@param dumpScript Specifies whether or not functions defined in script should be dumped.\n"
-                "@param dumpEngine Specifies whether or not functions defined in the engine should be dumped."
-				"@sa dumpConsoleMethods")
-{
-   bool dumpScript = true;
-   if( argc > 1 )
-      dumpScript = dAtob( argv[1] );
-   
-   bool dumpEngine = true;
-   if( argc > 2 )
-      dumpEngine = dAtob( argv[2] );
-
-   Namespace::dumpFunctions( dumpScript, dumpEngine );
-}
-
-ConsoleFunctionGroupEnd(ConsoleDoc);
-
 /// Helper table to convert type ids to human readable names.
 /// Helper table to convert type ids to human readable names.
 const char *typeNames[] = 
 const char *typeNames[] = 
 {
 {

BIN
engine/source/console/consoleDoc_ScriptBinding.h


+ 2 - 16
engine/source/console/consoleLogger.cc

@@ -22,6 +22,8 @@
 #include "console/consoleLogger.h"
 #include "console/consoleLogger.h"
 #include "console/consoleTypes.h"
 #include "console/consoleTypes.h"
 
 
+#include "consoleLogger_ScriptBinding.h"
+
 Vector<ConsoleLogger *> ConsoleLogger::mActiveLoggers;
 Vector<ConsoleLogger *> ConsoleLogger::mActiveLoggers;
 bool ConsoleLogger::smInitialized = false;
 bool ConsoleLogger::smInitialized = false;
 
 
@@ -218,19 +220,3 @@ void ConsoleLogger::log( const char *consoleLine )
 }
 }
 
 
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-
-ConsoleMethod( ConsoleLogger, attach, bool, 2, 2, "() Attaches this object to the console and begins logging\n"
-			  "@return Returns true on success, and false on failure.")
-{
-   ConsoleLogger *logger = static_cast<ConsoleLogger *>( object );
-   return logger->attach();
-}
-
-//-----------------------------------------------------------------------------
-
-ConsoleMethod( ConsoleLogger, detach, bool, 2, 2, "() Detaches this object from the console and stops logging\n" 
-			  "@return Returns true on success, and false on failure.")
-{
-   ConsoleLogger *logger = static_cast<ConsoleLogger *>( object );
-   return logger->detach();
-}

BIN
engine/source/console/consoleLogger_ScriptBinding.h


+ 2 - 64
engine/source/game/gameConnection.cc

@@ -28,6 +28,8 @@
 #include "game/gameConnection.h"
 #include "game/gameConnection.h"
 #include "io/resource/resourceManager.h"
 #include "io/resource/resourceManager.h"
 
 
+#include "gameConnection_ScriptBinding.h"
+
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------
 #define MAX_MOVE_PACKET_SENDS 4
 #define MAX_MOVE_PACKET_SENDS 4
 
 
@@ -86,24 +88,6 @@ void GameConnection::setJoinPassword(const char *password)
    mJoinPassword = dStrdup(password);
    mJoinPassword = dStrdup(password);
 }
 }
 
 
-ConsoleMethod(GameConnection, setJoinPassword, void, 3, 3, "( password ) Use the setJoinPassword method to set the password required to connect to this server-side GameConnection.\n"
-                                                                "Pass a NULL string to clear the password.\n"
-                                                                "@param password A string representing the case insensitive password to use for this server-side GameConnection.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa setConnectArgs")
-{
-   object->setJoinPassword(argv[2]);
-}
-
-ConsoleMethod(GameConnection, setConnectArgs, void, 3, 17, "( name [ , arg1 , ... , arg15 ] ) Use the setConnectArgs method to set the connection arguments for this client-side GameConnection. These values will be passed to the server upon establishing a connection.\n"
-                                                                "@param name Generally, the first argument is the name of the player.\n"
-                                                                "@param arg1 ... , arg15 - 15 additional arguments may be passed.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa setJoinPassword")
-{
-   object->setConnectArgs(argc - 2, argv + 2);
-}
-
 void GameConnection::onTimedOut()
 void GameConnection::onTimedOut()
 {
 {
    if(isConnectionToServer())
    if(isConnectionToServer())
@@ -423,54 +407,8 @@ void GameConnection::handleConnectionMessage(U32 message, U32 sequence, U32 ghos
    Parent::handleConnectionMessage(message, sequence, ghostCount);
    Parent::handleConnectionMessage(message, sequence, ghostCount);
 }
 }
 
 
-//----------------------------------------------------------------------------
-
-
-ConsoleMethod( GameConnection, activateGhosting, void, 2, 2, "() Use the activateGhosting method to GameConnection instance to start ghosting objects to the client.\n"
-                                                                "This is called on each client connection by the server.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa resetGhosting")
-{
-   object->activateGhosting();
-}
-
-ConsoleMethod( GameConnection, resetGhosting, void, 2, 2, "() Use the resetGhosting method to reset ghosting. This in effect tells the server to resend each ghost to insure that all objects which should be ghosts and are in fact ghosted.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa activateGhosting")
-{
-   object->resetGhosting();
-}
-
-
-ConsoleMethod( GameConnection, delete, void, 2, 3, "( [ reason ] ) Use the delete method to destroy and disconnect the current connection, giving an optional reason. If reason is specified, it will be transmitted to the client/server on the other end of the connection.\n"
-                                                                "@param reason A string explaining while the connection is being severed.\n"
-                                                                "@return No return value")
-{
-   if (argc == 3)
-      object->setDisconnectReason(argv[2]);
-   object->deleteObject();
-}
-
-
 //--------------------------------------------------------------------------
 //--------------------------------------------------------------------------
 void GameConnection::consoleInit()
 void GameConnection::consoleInit()
 {
 {
    Con::addVariable("Pref::Net::LagThreshold", TypeS32, &mLagThresholdMS);
    Con::addVariable("Pref::Net::LagThreshold", TypeS32, &mLagThresholdMS);
 }
 }
-
-ConsoleStaticMethod(GameConnection, getServerConnection, S32, 2, 2, "() Get the server connection if any.")
-{
-   if(GameConnection::getConnectionToServer())
-      return GameConnection::getConnectionToServer()->getId();
-   else
-   {
-      Con::errorf("GameConnection::getServerConnection - no connection available.");
-      return -1;
-   }
-}
-
-//added for a lack of a better place
-ConsoleFunction( purgeResources, void, 1, 1, "() Purge resources from the resource manager.")
-{
-   ResourceManager->purge();
-}

BIN
engine/source/game/gameConnection_ScriptBinding.h


+ 2 - 114
engine/source/io/streamObject.cc

@@ -22,6 +22,8 @@
 
 
 #include "streamObject.h"
 #include "streamObject.h"
 
 
+#include "streamObject_ScriptBinding.h"
+
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 // Constructor/Destructor
 // Constructor/Destructor
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -114,117 +116,3 @@ const char *StreamObject::readLongString(U32 maxStringLen)
    mStream->readLongString(maxStringLen, buffer);
    mStream->readLongString(maxStringLen, buffer);
    return buffer;
    return buffer;
 }
 }
-
-//////////////////////////////////////////////////////////////////////////
-// Console Methods
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(StreamObject, getStatus, const char *, 2, 2, "() Gets the current status of the StreamObject"
-              "@return The current status as a string (Ok, IOError, EOS, IllegalCall, Closed, UnknownError, Invalid)")
-{
-   return object->getStatus();
-}
-
-ConsoleMethod(StreamObject, isEOS, bool, 2, 2, "() Test for end of stream"
-              "@return Returns true if at the end of the stream, false otherwise.")
-{
-   return object->isEOS();
-}
-
-ConsoleMethod(StreamObject, isEOF, bool, 2, 2, "() Test for end of file stream (identical to isEOS()"
-              "@return Returns true if at the end of the stream, false otherwise."
-              "@sa isEOS")
-{
-   return object->isEOS();
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(StreamObject, getPosition, S32, 2, 2, "()\n" 
-              "@return Returns the current position in the stream as an integer or zero if failed")
-{
-   return object->getPosition();
-}
-
-ConsoleMethod(StreamObject, setPosition, bool, 3, 3, "(newPosition) Resets the current stream position\n"
-              "@param The desired index\n"
-              "@return Returns true if succeeded, flase otherwise")
-{
-   return object->setPosition(dAtoi(argv[2]));
-}
-
-ConsoleMethod(StreamObject, getStreamSize, S32, 2, 2, "() Get the size of the stream"
-              "@return The size of the stream as an integer")
-{
-   return object->getStreamSize();
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(StreamObject, readLine, const char *, 2, 2, "() Read the stream until '\\n' or EOS\n"
-              "@return A string containing the read line or an empty string if failed\n")
-{
-   const char *str = object->readLine();
-   return str ? str : "";
-}
-
-ConsoleMethod(StreamObject, writeLine, void, 3, 3, "(line) Writes a line of text to the stream buffer\n"
-              "@param The line to write\n"
-              "@return No return value.")
-{
-   object->writeLine((U8 *)argv[2]);
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(StreamObject, readSTString, const char *, 2, 3, "([caseSensitive = false]) Read a String and insert it into a StringTable\n"
-              "@param caseSensitive A boolean representing whether the parser should ignore case or not (default false)\n"
-              "@return Returns the string, or empty string if failed\n")
-{
-   const char *str = object->readSTString(argc > 2 ? dAtob(argv[2]) : false);
-   return str ? str : "";
-}
-
-ConsoleMethod(StreamObject, readString, const char *, 2, 2, "() Reads a string from a stream buffer\n"
-              "@return The string or an empty string if failed.")
-{
-   const char *str = object->readString();
-   return str ? str : "";
-}
-
-ConsoleMethod(StreamObject, readLongString, const char *, 3, 3, "(maxLength) Reads a string of provided length from the stream buffer.\n"
-              "@param The maximum length to read in\n"
-              "@return The requested string")
-{
-   const char *str = object->readLongString(dAtoi(argv[2]));
-   return str ? str : "";
-}
-
-ConsoleMethod(StreamObject, writeLongString, void, 4, 4, "(maxLength, string) Writes a string to buffer or provided length\n"
-              "@param maxLength The maximum length to write\n"
-              "@param string The string to write\n"
-              "@return No return value")
-{
-   object->writeLongString(dAtoi(argv[2]), argv[3]);
-}
-
-ConsoleMethod(StreamObject, writeString, void, 3, 4, "(string, [maxLength = 255]) Write a string to the stream buffer\n"
-              "@param string The string to write\n"
-              "@param maxLength The maximum length to write (default 255).\n"
-              "@return No return value.")
-{
-   object->writeString(argv[2], argc > 3 ? dAtoi(argv[3]) : 255);
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(StreamObject, copyFrom, bool, 3, 3, "(StreamObject other) Copies stream contents from current position\n"
-              "@param other The StreamObject from which to copy\n"
-              "@return Returns true on success, and false otherwise.")
-{
-   StreamObject *other = dynamic_cast<StreamObject *>(Sim::findObject(argv[2]));
-   if(other == NULL)
-      return false;
-
-   return object->copyFrom(other);
-}

BIN
engine/source/io/streamObject_ScriptBinding.h


+ 2 - 128
engine/source/io/zip/zipObject.cc

@@ -23,6 +23,8 @@
 #include "io/zip/zipObject.h"
 #include "io/zip/zipObject.h"
 #include "memory/safeDelete.h"
 #include "memory/safeDelete.h"
 
 
+#include "zipObject_ScriptBinding.h"
+
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 // Constructor/Destructor
 // Constructor/Destructor
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -197,131 +199,3 @@ const char *ZipObject::getFileEntry(S32 idx)
    return StringTable->insert(buffer, true);
    return StringTable->insert(buffer, true);
 }
 }
 
 
-//////////////////////////////////////////////////////////////////////////
-// Console Methods
-//////////////////////////////////////////////////////////////////////////
-
-static const struct
-{
-   const char *strMode;
-   Zip::ZipArchive::AccessMode mode;
-} gModeMap[]=
-{
-   { "read", Zip::ZipArchive::Read },
-   { "write", Zip::ZipArchive::Write },
-   { "readwrite", Zip::ZipArchive::ReadWrite },
-   { NULL, (Zip::ZipArchive::AccessMode)0 }
-};
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(ZipObject, openArchive, bool, 3, 4, "(filename, [accessMode = Read]) Open a zip file"
-              "@param filename The file's name\n"
-              "@param accessMode The mode in which to open the file (default Read)\n"
-              "@return Returns true on success, false otherwise"
-              "@sa closeArchive, openFileForRead, openFileForWrite, closeFile" )
-{
-   Zip::ZipArchive::AccessMode mode = Zip::ZipArchive::Read;
-
-   if(argc > 3)
-   {
-      for(S32 i = 0;gModeMap[i].strMode;++i)
-      {
-         if(dStricmp(gModeMap[i].strMode, argv[3]) == 0)
-         {
-            mode = gModeMap[i].mode;
-            break;
-         }
-      }
-   }
-
-   char buf[512];
-   Con::expandPath(buf, sizeof(buf), argv[2]);
-
-   return object->openArchive(buf, mode);
-}
-
-ConsoleMethod(ZipObject, closeArchive, void, 2, 2, "() Close the zip file\n"
-              "@return No return value.")
-{
-   object->closeArchive();
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(ZipObject, openFileForRead, S32, 3, 3, "(filename) Open a file within the zip for reading\n"
-              "@param filename The file's name to open in current zip file\n"
-              "@return The file stream ID as an integer or zero on failure.")
-{
-   StreamObject *stream = object->openFileForRead(argv[2]);
-   return stream ? stream->getId() : 0;
-}
-
-ConsoleMethod(ZipObject, openFileForWrite, S32, 3, 3, "(filename) Open a file within the zip for writing\n"
-              "@param filename The file's name to open in current zip file\n"
-              "@return The file stream ID as an integer or 0 on failure.")
-{
-   StreamObject *stream = object->openFileForWrite(argv[2]);
-   return stream ? stream->getId() : 0;
-}
-
-ConsoleMethod(ZipObject, closeFile, void, 3, 3, "(stream) Close a file within the zip"
-              "@param stream The file stream ID\n"
-              "@return No return value.")
-{
-   StreamObject *stream = dynamic_cast<StreamObject *>(Sim::findObject(argv[2]));
-   if(stream == NULL)
-   {
-      Con::errorf("ZipObject::closeFile - Invalid stream specified");
-      return;
-   }
-
-   object->closeFile(stream);
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(ZipObject, addFile, bool, 4, 5, "(filename, pathInZip[, replace = true]) Add a file to the zip\n"
-              "@param filename The name of the file\n"
-              "@param pathInZip The internal (to the zip) path to the file\n"
-              "@param replace Set whether to replace the file if one already exists with the name in the path (default true)"
-              "@return Returns true on success and false otherwise")
-{
-   // Left this line commented out as it was useful when i had a problem
-   //  with the zip's i was creating. [2/21/2007 justind]
-   // [tom, 2/21/2007] To is now a warnf() for better visual separation in the console
-  // Con::errorf("zipAdd: %s", argv[2]);
-   //Con::warnf("    To: %s", argv[3]);
-
-   return object->addFile(argv[2], argv[3], argc > 4 ? dAtob(argv[4]) : true);
-}
-
-ConsoleMethod(ZipObject, extractFile, bool, 4, 4, "(pathInZip, filename) Extract a file from the zip"
-              "@param pathInZip The internal path of the desired file\n"
-              "@param filename The file's name\n"
-              "@return Returns true on success and false otherwise")
-{
-   return object->extractFile(argv[2], argv[3]);
-}
-
-ConsoleMethod(ZipObject, deleteFile, bool, 3, 3, "(pathInZip) Delete a file from the zip" 
-              "@param pathInZip The full internal path of the file\n"
-              "@return Returns true on success and false otherwise.")
-{
-   return object->deleteFile(argv[2]);
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(ZipObject, getFileEntryCount, S32, 2, 2, "() Get number of files in the zip\n" 
-              "@return Returns the number of files found in zip")
-{
-   return object->getFileEntryCount();
-}
-
-ConsoleMethod(ZipObject, getFileEntry, const char *, 3, 3, "(index) Get file entry.\n" 
-              "@param index Index to file entry\n"
-              "@return Returns tab separated string containing filename, uncompressed size, compressed size, compression method and CRC32")
-{
-   return object->getFileEntry(dAtoi(argv[2]));
-}

BIN
engine/source/io/zip/zipObject_ScriptBinding.h


+ 49 - 0
engine/source/math/box_ScriptBinding.h

@@ -0,0 +1,49 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2013 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+
+/*! @defgroup BoxFunctions Box Math
+	@ingroup TorqueScriptFunctions
+	@{
+*/
+
+/*! Use the getBoxCenter function to find the centroid of a cube (box).
+	@param box A vector containing two three-element floating-point position vectors: \"X1 Y1 Z1 X2 Y2 Z2\".
+	@return Returns a vector containing a three-element floating-point position vector equal to the centroid of the area defined by box
+*/
+
+ConsoleFunctionWithDocs( getBoxCenter, const char*, 2, 2, (box) )
+{
+   Box3F box;
+   box.mMin.set(0,0,0);
+   box.mMax.set(0,0,0);
+   dSscanf(argv[1],"%g %g %g %g %g %g",
+           &box.mMin.x,&box.mMin.y,&box.mMin.z,
+           &box.mMax.x,&box.mMax.y,&box.mMax.z);
+   Point3F p;
+   box.getCenter(&p);
+   char* returnBuffer = Con::getReturnBuffer(256);
+   dSprintf(returnBuffer,256,"%g %g %g",p.x,p.y,p.z);
+   return returnBuffer;
+}
+
+/*! @} */ // group BoxFunctions

+ 5 - 370
engine/source/math/mathTypes.cc

@@ -29,6 +29,11 @@
 #include "math/mathTypes.h"
 #include "math/mathTypes.h"
 #include "math/mRandom.h"
 #include "math/mRandom.h"
 
 
+#include "vector_ScriptBinding.h"
+#include "matrix_ScriptBinding.h"
+#include "random_ScriptBinding.h"
+#include "box_ScriptBinding.h"
+
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 // TypePoint2I
 // TypePoint2I
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -344,375 +349,5 @@ ConsoleSetType( TypeBox3F )
    }
    }
 }
 }
 
 
-
-//----------------------------------------------------------------------------
-
-ConsoleFunctionGroupBegin( VectorMath, "Vector manipulation functions.");
-
-ConsoleFunction( VectorAdd, const char*, 3, 3, "( vecA , vecB ) Use the VectorAdd function to add two vectors of up to three elements each to each other\n"
-                                                                "@param vecA A vector of up to three elements.\n"
-                                                                "@param vecB A vector of up to three elements.\n"
-                                                                "@return Returns the result of vecA + vecB.\n"
-                                                                "@sa vectorSub")
-{
-   VectorF v1(0,0,0),v2(0,0,0);
-   dSscanf(argv[1],"%g %g %g",&v1.x,&v1.y,&v1.z);
-   dSscanf(argv[2],"%g %g %g",&v2.x,&v2.y,&v2.z);
-   VectorF v;
-   v = v1 + v2;
-   char* returnBuffer = Con::getReturnBuffer(256);
-   dSprintf(returnBuffer,256,"%g %g %g",v.x,v.y,v.z);
-   return returnBuffer;
-}
-
-ConsoleFunction( VectorSub, const char*, 3, 3, "( vecA , vecB ) Use the VectorSub function to subtract vecB from vecA.\n"
-                                                                "@param vecA Left side vector in subtraction equation.\n"
-                                                                "@param vecB Right side vector in subtraction equation.\n"
-                                                                "@return Returns a new vector equivalent to: \"vecA - vecB\".\n"
-                                                                "@sa vectorAdd")
-{
-   VectorF v1(0,0,0),v2(0,0,0);
-   dSscanf(argv[1],"%g %g %g",&v1.x,&v1.y,&v1.z);
-   dSscanf(argv[2],"%g %g %g",&v2.x,&v2.y,&v2.z);
-   VectorF v;
-   v = v1 - v2;
-   char* returnBuffer = Con::getReturnBuffer(256);
-   dSprintf(returnBuffer,256,"%g %g %g",v.x,v.y,v.z);
-   return returnBuffer;
-}
-
-ConsoleFunction( VectorScale, const char*, 3, 3, "( vec , scale ) Use the VectorScale function to scale the vector vec by the scalar scale.\n"
-                                                                "@param vec A vector of up to three elements.\n"
-                                                                "@param scale A numeric value (integer or floating-point) representing the scaling factor.\n"
-                                                                "@return Returns a scaled version of the vector vec, equivalent to: ( scale * X ) ( scale * Y ) ( scale * Z )\".\n"
-                                                                "@sa VectorNormalize")
-{
-   VectorF v(0,0,0);
-   dSscanf(argv[1],"%g %g %g",&v.x,&v.y,&v.z);
-   v *= dAtof(argv[2]);
-   char* returnBuffer = Con::getReturnBuffer(256);
-   dSprintf(returnBuffer,256,"%g %g %g",v.x,v.y,v.z);
-   return returnBuffer;
-}
-
-ConsoleFunction( VectorNormalize, const char*, 2, 2, "( vec ) Use the VectorNormalize function to calculated the unit vector equivalent of the vector vec.\n"
-                                                                "@param vec A vector of up to three elements.\n"
-                                                                "@return Returns the unit vector equivalent of the vector vec.\n"
-                                                                "@sa VectorScale")
-{
-   VectorF v(0,0,0);
-   dSscanf(argv[1],"%g %g %g",&v.x,&v.y,&v.z);
-   if (v.len() != 0)
-      v.normalize();
-   char* returnBuffer = Con::getReturnBuffer(256);
-   dSprintf(returnBuffer,256,"%g %g %g",v.x,v.y,v.z);
-   return returnBuffer;
-}
-
-ConsoleFunction( VectorDot, F32, 3, 3, "( vecA , vecB ) Use the VectorCross function to calculate the dot product of two unit vectors of up to three elements each. Warning! Be sure to always normalize both vecA and vecB before attempting to find the dot product. Calculating a dot product using un-normalized vectors (non- unit vectors) will result in meaningless results.\n"
-                                                                "If the return value is < 0, the inner-angle between the vectors is > 90 degrees. If the return value is == 0, the inner-angle between the vectors is == 90 degrees. If the return value is > 0, the inner-angle between the vectors is < 90 degrees.\n"
-                                                                "@param vecA A unit-vector of up to three elements.\n"
-                                                                "@param vecB A unit-vector of up to three elements.\n"
-                                                                "@return Returns a scalar value equal to the result of vecA . vecB. This value which will always be a single floating-point value in the range [ -1 , +1 ].\n"
-                                                                "@sa VectorCross")
-{
-   VectorF v1(0,0,0),v2(0,0,0);
-   dSscanf(argv[1],"%g %g %g",&v1.x,&v1.y,&v1.z);
-   dSscanf(argv[2],"%g %g %g",&v2.x,&v2.y,&v2.z);
-   return mDot(v1,v2);
-}
-
-ConsoleFunction(VectorCross, const char*, 3, 3, "( vecA , vecB ) Use the VectorCross function to calculate the cross product of two vectors of up to three elements each.\n"
-                                                                "Remember, the resultant vector will always be an right angles (orthogonal) to both input vectors.\n"
-                                                                "@param vecA A vector of up to three elements.\n"
-                                                                "@param vecB A vector of up to three elements.\n"
-                                                                "@return Returns the result of vecA x vecB.\n"
-                                                                "@sa VectorDot")
-{
-   VectorF v1(0,0,0),v2(0,0,0);
-   dSscanf(argv[1],"%g %g %g",&v1.x,&v1.y,&v1.z);
-   dSscanf(argv[2],"%g %g %g",&v2.x,&v2.y,&v2.z);
-   VectorF v;
-   mCross(v1,v2,&v);
-   char* returnBuffer = Con::getReturnBuffer(256);
-   dSprintf(returnBuffer,256,"%g %g %g",v.x,v.y,v.z);
-   return returnBuffer;
-}
-
-ConsoleFunction(VectorDist, F32, 3, 3, "( vecA , vecB ) Use the VectorDist function to calculate distance between two vectors of up to three elements each.\n"
-                                                                "@param vecA A vector of up to three elements.\n"
-                                                                "@param vecB A vector of up to three elements.\n"
-                                                                "@return Returns the result of \" |Xa - Xb| |Ya - Yb| |Za - Zb| \".\n"
-                                                                "@sa VectorLen")
-{
-   VectorF v1(0,0,0),v2(0,0,0);
-   dSscanf(argv[1],"%g %g %g",&v1.x,&v1.y,&v1.z);
-   dSscanf(argv[2],"%g %g %g",&v2.x,&v2.y,&v2.z);
-   VectorF v = v2 - v1;
-   return mSqrt((v.x * v.x) + (v.y * v.y) + (v.z * v.z));
-}
-
-ConsoleFunction(VectorLen, F32, 2, 2, "( vec ) Use the VectorLen function to calculate the length of vector vec.\n"
-                                                                "@param vec A vector of up to three elements.\n"
-                                                                "@return Returns a scalar representing the length of the vector vec.\n"
-                                                                "@sa VectorDist")
-{
-   VectorF v(0,0,0);
-   dSscanf(argv[1],"%g %g %g",&v.x,&v.y,&v.z);
-   return mSqrt((v.x * v.x) + (v.y * v.y) + (v.z * v.z));
-}
-
-ConsoleFunction( VectorOrthoBasis, const char*, 2, 2, "( vec ) Use the VectorOrthoBasis function to calculate a 3x3 Row-Major formated matrix representing the orthogonal basis for the vector vec.\n"
-                                                                "@param vec A four element vector of the form \"AxisX AxisY AxisZ theta\", where theta is the angle of rotation about the vector formed by the prior three values.\n"
-                                                                "@return Returns a 3x3 Row-Major formated matrix")
-{
-   AngAxisF aa;
-   dSscanf(argv[1],"%g %g %g %g", &aa.axis.x,&aa.axis.y,&aa.axis.z,&aa.angle);
-   MatrixF mat;
-   aa.setMatrix(&mat);
-   Point3F col0, col1, col2;
-   mat.getColumn(0, &col0);
-   mat.getColumn(1, &col1);
-   mat.getColumn(2, &col2);
-   char* returnBuffer = Con::getReturnBuffer(256);
-   dSprintf(returnBuffer,256,"%g %g %g %g %g %g %g %g %g",
-            col0.x, col0.y, col0.z, col1.x, col1.y, col1.z, col2.x, col2.y, col2.z);
-   return returnBuffer;
-}
-
-ConsoleFunctionGroupEnd(VectorMath);
-
-ConsoleFunctionGroupBegin(MatrixMath, "Matrix manipulation functions.");
-
-ConsoleFunction( MatrixCreate, const char*, 3, 3, "( posVec , rotVec ) Use the matrixCreate function to create a transform matrix from a three-element floating-point translation vector and a four-element floating-point rotation vector.\n"
-                                                                "@param posVec A three-element floating-point translation vector: \"PosX PosY PosZ\".\n"
-                                                                "@param rotVec A four-element floating-point rotation vector: \"RotX RotY RotZ\".\n"
-                                                                "@param These re rotations about the specified axes.\n"
-                                                                "@return Returns a transform matrix of the form \"PosX PosY PosZ RotX RotY RotZ theta\".\n"
-                                                                "@sa MatrixCreateFromEuler")
-{
-   Point3F pos;
-   dSscanf(argv[1], "%g %g %g", &pos.x, &pos.y, &pos.z);
-
-   AngAxisF aa(Point3F(0,0,0),0);
-   dSscanf(argv[2], "%g %g %g %g", &aa.axis.x, &aa.axis.y, &aa.axis.z, &aa.angle);
-   aa.angle = mDegToRad(aa.angle);
-
-   char* returnBuffer = Con::getReturnBuffer(256);
-   dSprintf(returnBuffer, 255, "%g %g %g %g %g %g %g",
-            pos.x, pos.y, pos.z,
-            aa.axis.x, aa.axis.y, aa.axis.z,
-            aa.angle);
-   return returnBuffer;
-}
-
-ConsoleFunction( MatrixCreateFromEuler, const char*, 2, 2, " ( rotVec ) Use the MatrixCreateFromEuler function to calculate a transform matrix from a three-element floating-point rotation vector.\n"
-                                                                "@param rotVec A three-element floating-point rotation vector: \"RotX RotY RotZ\". These are rotations about the specified axes.\n"
-                                                                "@return Returns a transform matrix of the form \"0 0 0 X Y Z theta\".\n"
-                                                                "@sa MatrixCreate")
-{
-   EulerF rot;
-   dSscanf(argv[1], "%g %g %g", &rot.x, &rot.y, &rot.z);
-
-   QuatF rotQ(rot);
-   AngAxisF aa;
-   aa.set(rotQ);
-
-   char* ret = Con::getReturnBuffer(256);
-   dSprintf(ret, 255, "0 0 0 %g %g %g %g",aa.axis.x,aa.axis.y,aa.axis.z,aa.angle);
-   return ret;
-}
-
-
-ConsoleFunction( MatrixMultiply, const char*, 3, 3, "( transformA , transformB ) Use the MatrixMultiply function to multiply two seven-element transform matrices to produce a new seven element matrix.\n"
-                                                                "@param transformA A seven-element transform matrix of the form \"PosX PosY PosZ RotX RotY RotZ theta\".\n"
-                                                                "@param transformB A seven-element transform matrix of the form \"PosX PosY PosZ RotX RotY RotZ theta\".\n"
-                                                                "@return Returns a seven-element matrix resulting from transiformA x transformB.\n"
-                                                                "@sa MatrixMulPoint, MatrixMulVector")
-{
-   Point3F pos1;
-   AngAxisF aa1(Point3F(0,0,0),0);
-   dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle);
-
-   MatrixF temp1(true);
-   aa1.setMatrix(&temp1);
-   temp1.setColumn(3, pos1);
-
-   Point3F pos2;
-   AngAxisF aa2(Point3F(0,0,0),0);
-   dSscanf(argv[2], "%g %g %g %g %g %g %g", &pos2.x, &pos2.y, &pos2.z, &aa2.axis.x, &aa2.axis.y, &aa2.axis.z, &aa2.angle);
-
-   MatrixF temp2(true);
-   aa2.setMatrix(&temp2);
-   temp2.setColumn(3, pos2);
-
-   temp1.mul(temp2);
-
-
-   Point3F pos;
-   AngAxisF aa(temp1);
-
-   aa.axis.normalize();
-   temp1.getColumn(3, &pos);
-
-   char* ret = Con::getReturnBuffer(256);
-   dSprintf(ret, 255, "%g %g %g %g %g %g %g",
-            pos.x, pos.y, pos.z,
-            aa.axis.x, aa.axis.y, aa.axis.z,
-            aa.angle);
-   return ret;
-}
-
-
-ConsoleFunction( MatrixMulVector, const char*, 3, 3, "( transform , vector ) Use the MatrixMulVector function to multiply a seven-element transform matrix with a three-element matrix.\n"
-                                                                "@param transform A seven-element transform matrix of the form \"PosX PosY PosZ RotX RotY RotZ theta\".\n"
-                                                                "@param vector A three-element vector.\n"
-                                                                "@return Returns three-element resulting from vector * transform.\n"
-                                                                "@sa MatrixMulPoint, MatrixMultiply")
-{
-   Point3F pos1;
-   AngAxisF aa1(Point3F(0,0,0),0);
-   dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle);
-
-   MatrixF temp1(true);
-   aa1.setMatrix(&temp1);
-   temp1.setColumn(3, pos1);
-
-   Point3F vec1;
-   dSscanf(argv[2], "%g %g %g", &vec1.x, &vec1.y, &vec1.z);
-
-   Point3F result;
-   temp1.mulV(vec1, &result);
-
-   char* ret = Con::getReturnBuffer(256);
-   dSprintf(ret, 255, "%g %g %g", result.x, result.y, result.z);
-   return ret;
-}
-
-ConsoleFunction( MatrixMulPoint, const char*, 3, 3, "( transform , point ) Use the MatrixMulPoint function to multiply a seven element transform matrix by a three element point vector, producing a three element position vector.\n"
-                                                                "@param transform A seven-element transform matrix.\n"
-                                                                "@param point A three-element point/position vector.\n"
-                                                                "@return Returns a three-element position vector.\n"
-                                                                "@sa MatrixMultiply, MatrixMulVector")
-{
-   Point3F pos1;
-   AngAxisF aa1(Point3F(0,0,0),0);
-   dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle);
-
-   MatrixF temp1(true);
-   aa1.setMatrix(&temp1);
-   temp1.setColumn(3, pos1);
-
-   Point3F vec1;
-   dSscanf(argv[2], "%g %g %g", &vec1.x, &vec1.y, &vec1.z);
-
-   Point3F result;
-   temp1.mulP(vec1, &result);
-
-   char* ret = Con::getReturnBuffer(256);
-   dSprintf(ret, 255, "%g %g %g", result.x, result.y, result.z);
-   return ret;
-}
-
-ConsoleFunctionGroupEnd(MatrixMath);
-
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 
 
-ConsoleFunction( getBoxCenter, const char*, 2, 2, "( box ) Use the getBoxCenter function to find the centroid of a cube (box).\n"
-                                                                "@param box A vector containing two three-element floating-point position vectors: \"X1 Y1 Z1 X2 Y2 Z2\".\n"
-                                                                "@return Returns a vector containing a three-element floating-point position vector equal to the centroid of the area defined by box")
-{
-   Box3F box;
-   box.mMin.set(0,0,0);
-   box.mMax.set(0,0,0);
-   dSscanf(argv[1],"%g %g %g %g %g %g",
-           &box.mMin.x,&box.mMin.y,&box.mMin.z,
-           &box.mMax.x,&box.mMax.y,&box.mMax.z);
-   Point3F p;
-   box.getCenter(&p);
-   char* returnBuffer = Con::getReturnBuffer(256);
-   dSprintf(returnBuffer,256,"%g %g %g",p.x,p.y,p.z);
-   return returnBuffer;
-}
-
-
-//------------------------------------------------------------------------------
-ConsoleFunctionGroupBegin(RandomNumbers, "Functions relating to the generation of random numbers.");
-
-ConsoleFunction(setRandomSeed, void, 1, 2, "( startSeed ) Use the setRandomSeed function to initialize the random number generator with the initial seed of startSeed.\n"
-                                                                "@param startSeed The new starting seed value for the random generator.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa getRandom, getRandomSeed")
-{
-    U32 seed = Platform::getRealMilliseconds();
-    if (argc == 2)
-        seed = dAtoi(argv[1]);
-    RandomLCG::setGlobalRandSeed(seed);
-}
-
-ConsoleFunction(getRandomSeed, S32, 1, 1, "() Use the getRandomSeed function to get the current seed for the random generator.\n"
-                                                                "You can re-seed the generator with this value to allow you to recreate a random sequence. Merely save the seed and execute your random sequence. Later, to reproduce this sequence re-seed the generator with setRandomSeed and your saved value. Then, the generator will produce the same random sequence that followed the call to getRandomSeed.\n"
-                                                                "@return Returns an integer value representing the current seed of the random generator.\n"
-                                                                "@sa getRandom, setRandomSeed")
-{
-   return gRandGen.getSeed();
-}
-
-S32 mRandI( const S32 i1, const S32 i2)
-{
-   return gRandGen.randRangeI(i1, i2);
-}
-
-F32 mRandF(const F32 f1, const F32 f2)
-{
-   return gRandGen.randRangeF(f1, f2);
-}
-
-ConsoleFunction(getRandom, F32, 1, 3, "([ min ],[ max ]) Use the getRandom function to get a random floating-point or integer value. This function comes in three forms.\n"
-                                                                "The first getRandom() takes no arguments and will return a random floating-point value in the range of 0.0 to 1.0. The second getRandom( max ) takes one argument representing the max integer value this will return. It will return an integer value between 0 and max. The third getRandom( min , max ) takes two arguments representing the min and max integer values this will return. It will return an integer value between min and max. Only the no-args version will return a floating point.\n"
-                                                                "@param min Minimum inclusive integer value to return.\n"
-                                                                "@param max Maximum inclusive integer value to return.\n"
-                                                                "@return If no arguments are passed, will return a floating-point value between 0.0 and 1.0. If one argument is passed, will return an integer value between 0 and max inclusive. If two arguments are passed, will return an integer value between min and max inclusive.\n"
-                                                                "@sa getRandomSeed")
-{
-   if (argc == 2)
-      return F32(gRandGen.randRangeI(0,getMax( dAtoi(argv[1]), 0 )));
-   else
-   {
-      if (argc == 3) 
-      {
-         S32 min = dAtoi(argv[1]);
-         S32 max = dAtoi(argv[2]);
-         if (min > max) 
-         {
-            S32 t = min;
-            min = max;
-            max = t;
-         }
-         return F32(gRandGen.randRangeI(min,max));
-      }
-   }
-   return gRandGen.randF();
-}
-
-ConsoleFunction(getRandomF, F32, 3, 3,  "(min, max) Gets a random floating-point number from min to max.\n"
-                                        "@param min The minimum range of the random floating-point number.\n"
-                                        "@param max The maximum range of the random floating-point number.\n"
-                                        "@return A random floating-point number from min to max.\n" )
-{
-    F32 min = dAtof(argv[1]);
-    F32 max = dAtof(argv[2]);
-    
-    if ( min > max )
-    {
-        const F32 temp = min;
-        min = max;
-        max = temp;
-    }
-    
-    return min + (gRandGen.randF() * (max-min));
-    
-}
-
-ConsoleFunctionGroupEnd(RandomNumbers);
-//------------------------------------------------------------------------------

BIN
engine/source/math/matrix_ScriptBinding.h


BIN
engine/source/math/random_ScriptBinding.h


BIN
engine/source/math/vector_ScriptBinding.h


+ 2 - 84
engine/source/messaging/dispatcher.cc

@@ -38,6 +38,8 @@
 #include "collection/simpleHashTable.h"
 #include "collection/simpleHashTable.h"
 #include "memory/safeDelete.h"
 #include "memory/safeDelete.h"
 
 
+#include "dispatcher_ScriptBinding.h"
+
 namespace Dispatcher
 namespace Dispatcher
 {
 {
 
 
@@ -298,87 +300,3 @@ extern void unlockDispatcherMutex()
 }
 }
 
 
 } // end namespace Dispatcher
 } // end namespace Dispatcher
-
-//////////////////////////////////////////////////////////////////////////
-// Console Methods
-//////////////////////////////////////////////////////////////////////////
-
-using namespace Dispatcher;
-
-ConsoleFunction(isQueueRegistered, bool, 2, 2, "(queueName) Checks whether message queue is registered\n"
-                "@param queueName The name of the queue to check\n"
-                "@return Returns true if registered and false if not")
-{
-   return isQueueRegistered(argv[1]);
-}
-
-ConsoleFunction(registerMessageQueue, void, 2, 2, "(queueName) Registers given message queue\n"
-                "@param queueName The name of the message queue\n"
-                "@return No Return Value")
-{
-   return registerMessageQueue(argv[1]);
-}
-
-ConsoleFunction(unregisterMessageQueue, void, 2, 2, "(queueName) Unregisters given message queue\n"
-                "@param The name of the message queue\n"
-                "@return No Return Value")
-{
-   return unregisterMessageQueue(argv[1]);
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleFunction(registerMessageListener, bool, 3, 3, "(queueName, listener) Registers a message listener on a message queue\n"
-                "@param queueName The name of the message queue\n"
-                "@param listener The name of the listener to register\n"
-                "@return Returns true on success, and false otherwise (probably not found)")
-{
-   IMessageListener *listener = dynamic_cast<IMessageListener *>(Sim::findObject(argv[2]));
-   if(listener == NULL)
-   {
-      Con::errorf("registerMessageListener - Unable to find listener object, not an IMessageListener ?!");
-      return false;
-   }
-
-   return registerMessageListener(argv[1], listener);
-}
-
-ConsoleFunction(unregisterMessageListener, void, 3, 3, "(queueName, listener) Unregisters the message listener on given message queue"
-                "@param queueName The name of the message queue\n"
-                "@param listener The name of the listener to unregister\n"
-                "@return No Return Value")
-{
-   IMessageListener *listener = dynamic_cast<IMessageListener *>(Sim::findObject(argv[2]));
-   if(listener == NULL)
-   {
-      Con::errorf("unregisterMessageListener - Unable to find listener object, not an IMessageListener ?!");
-      return;
-   }
-
-   unregisterMessageListener(argv[1], listener);
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleFunction(dispatchMessage, bool, 3, 4, "(queueName, event, data) Dispatches a message to given message queue\n"
-                "@param queueName The queue to dispatch to\n"
-                "@param event The message you are passing\n"
-                "@param data Data\n"
-                "@return Returns true on success and false otherwise")
-{
-   return dispatchMessage(argv[1], argv[2], argc > 3 ? argv[3] : "" );
-}
-
-ConsoleFunction(dispatchMessageObject, bool, 3, 3, "(queueName, message) Dispatches a message object to the given queue\n"
-                "@param queueName The name of the queue to dispatch object to\n"
-                "@param message The message object\n")
-{
-   Message *msg = dynamic_cast<Message *>(Sim::findObject(argv[2]));
-   if(msg == NULL)
-   {
-      Con::errorf("dispatchMessageObject - Unable to find message object");
-      return false;
-   }
-
-   return dispatchMessageObject(argv[1], msg);
-}

BIN
engine/source/messaging/dispatcher_ScriptBinding.h


+ 2 - 165
engine/source/network/netConnection.cc

@@ -31,6 +31,8 @@
 #include "netInterface.h"
 #include "netInterface.h"
 #include <stdarg.h>
 #include <stdarg.h>
 
 
+#include "netConnection_ScriptBinding.h"
+
 S32 gNetBitsSent = 0;
 S32 gNetBitsSent = 0;
 extern S32 gNetBitsReceived;
 extern S32 gNetBitsReceived;
 U32 gGhostUpdates = 0;
 U32 gGhostUpdates = 0;
@@ -359,58 +361,6 @@ void NetConnection::handleConnectionEstablished()
 
 
 //--------------------------------------------------------------------------
 //--------------------------------------------------------------------------
 
 
-ConsoleMethod(NetConnection,getAddress,const char *,2,2,"() Use the getAddress method to get the address and port that this NetConnection is currently attached to.\n"
-                                                                "@return Returns the address and port that this NetConnection is currently attached to, where the addres will be of the form: A.B.C.D:Port. A .. B are standard IP numbers between 0 and 255 and Port can be between 1000 and 65536. If the connection is local, the string 'local' will be returned. If a this NetConnection is not currently connected the method will return a NULL string.\n"
-                                                                "@sa connect, connectLocal")
-{
-   if(object->isLocalConnection())
-      return "local";
-   char *buffer = Con::getReturnBuffer(256);
-   Net::addressToString(object->getNetAddress(), buffer);
-   return buffer;
-}
-
-ConsoleMethod(NetConnection,setSimulatedNetParams,void,4, 4,"( packetLoss , delay ) Use the setSimulatedNetParams method to force a connection to experience a certain degree of packet-loss and/or latency. This is a debug feature to allow us to see how a distributed game will behave in the face of poor connection quality.\n"
-                                                                "@param packetLoss A floating-point value between 0.0 (0%) and 1.0 (100%) dictating the percentage of packets to be artificially lost.\n"
-                                                                "@param delay An integer value specifying the number of milliseconds to insert into transmission latencies.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa getPacketLoss, getPing")
-{
-   object->setSimulatedNetParams(dAtof(argv[2]), dAtoi(argv[3]));
-}
-
-ConsoleMethod( NetConnection, getPing, S32, 2, 2, "() Use the getPing method to determine the round-trip travel time from this connection to the agent on the other end and back again.\n"
-                                                                "@return Returns an integer value representing the total time in milliseconds it takes for a ping request to travel to the agent on the other end of a connection and back to this agent.\n"
-                                                                "@sa getPacketLoss")
-{
-   return( S32( object->getRoundTripTime() ) );
-}
-
-ConsoleMethod( NetConnection, getPacketLoss, S32, 2, 2, "() Use the getPacketLoss method to determine the current packetLoss count for this connection.\n"
-                                                                "@return Returns an integer value between 0 and inf, indicating the number of packets that have been lost to date on this net connection.\n"
-                                                                "@sa getPing")
-{
-   return( S32( 100 * object->getPacketLoss() ) );
-}
-
-ConsoleMethod( NetConnection, checkMaxRate, void, 2, 2, "() Use the checkMaxRate method to retrieve the current maximum packet rate for this connection.\n"
-                                                                "The period may not neccesarily be one second. To adjust packet rates, see the preference variables above\n"
-                                                                "@return Returns an integer value representing the maximum number of packets that can be transmitted by this connection per transmission period.")
-{
-   object->checkMaxRate();
-}
-
-#ifdef TORQUE_DEBUG_NET
-
-ConsoleMethod( NetConnection, setLogging, void, 3, 3, "conn.setLogging(bool)")
-{
-   object->setLogging(dAtob(argv[2]));
-}
-
-#endif
-
-//--------------------------------------------------------------------
-
 void NetConnection::setEstablished()
 void NetConnection::setEstablished()
 {
 {
    AssertFatal(!mEstablished, "NetConnection::setEstablished - Error, this NetConnection has already been established.");
    AssertFatal(!mEstablished, "NetConnection::setEstablished - Error, this NetConnection has already been established.");
@@ -1083,116 +1033,3 @@ bool NetConnection::readConnectAccept(BitStream *stream, const char **errorStrin
 {
 {
    return true;
    return true;
 }
 }
-
-ConsoleMethod(NetConnection, resolveGhostID, S32, 3, 3, "( S32 ghostID ) Convert a ghost id from this connection to a real id."
-              "@return The ID as an integer")
-{
-   S32 gID = dAtoi(argv[2]);
-
-   // Safety check
-   if(gID < 0 || gID > NetConnection::MaxGhostCount) return 0;
-
-   NetObject *foo = object->resolveGhost(gID);
-
-   if(foo)
-      return foo->getId();
-   else
-      return 0;
-}
-
-ConsoleMethod(NetConnection, resolveObjectFromGhostIndex, S32, 3, 3, "( S32 ghostIdx) Convert a ghost index from this connection to a real id."
-              "@return The ID as an integer")
-{
-   S32 gID = dAtoi(argv[2]);
-
-   // Safety check
-   if(gID < 0 || gID > NetConnection::MaxGhostCount) return 0;
-
-   NetObject *foo = object->resolveObjectFromGhostIndex(gID);
-
-   if(foo)
-      return foo->getId();
-   else
-      return 0;
-}
-
-ConsoleMethod(NetConnection, getGhostID, S32, 3, 3, "( S32 realID ) Convert a real id to the ghost id for this connection."
-              "@return The ID as an integer")
-{
-   NetObject * foo;
-
-   if(Sim::findObject(argv[2], foo))
-   {
-      return object->getGhostIndex(foo);
-   }
-   else
-   {
-      Con::errorf("NetConnection::serverToGhostID - could not find specified object");
-      return -1;
-   }
-}
-
-ConsoleMethod(NetConnection, connect, void, 3, 3, "( remoteAddress ) Use the connect method to request a connection to a remote server at the address remoteAddress.\n"
-                                                                "@param remoteAddress A string containing an address of the form: A.B.C.D:Port, where A .. B are standard IP numbers between 0 and 255 and Port can be between 1000 and 65536.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa connectLocal, getAddress")
-{
-   NetAddress addr;
-   if(!Net::stringToAddress(argv[2], &addr))
-   {
-      Con::errorf("NetConnection::connect: invalid address - %s", argv[2]);
-      return;
-   }
-   object->connect(&addr);
-}
-
-ConsoleMethod(NetConnection, connectLocal, const char *, 2, 2, "() Use the connectLocal method to connect the current client-side connection to a local NetConnection, that is to create an internal connection from this client to the internal server. This is accomplished through the use of a back door mechanism and has an extremely high bandwidth.\n"
-                                                                "@return No return value.\n"
-                                                                "@sa connect, getAddress")
-{
-   ConsoleObject *co = ConsoleObject::create(object->getClassName());
-   NetConnection *client = object;
-   NetConnection *server = dynamic_cast<NetConnection *>(co);
-   const char *error = NULL;
-   BitStream *stream = BitStream::getPacketStream();
-
-   if(!server || !server->canRemoteCreate())
-       goto errorOut;
-   server->registerObject();
-   server->setIsLocalClientConnection();
-
-   server->setSequence(0);
-   client->setSequence(0);
-   client->setRemoteConnectionObject(server);
-   server->setRemoteConnectionObject(client);
-
-   stream->setPosition(0);
-   client->writeConnectRequest(stream);
-   stream->setPosition(0);
-   if(!server->readConnectRequest(stream, &error))
-      goto errorOut;
-
-   stream->setPosition(0);
-   server->writeConnectAccept(stream);
-   stream->setPosition(0);
-
-   if(!client->readConnectAccept(stream, &error))
-      goto errorOut;
-
-   client->onConnectionEstablished(true);
-   server->onConnectionEstablished(false);
-   client->setEstablished();
-   server->setEstablished();
-   client->setConnectSequence(0);
-   server->setConnectSequence(0);
-   NetConnection::setLocalClientConnection(server);
-   server->assignName("LocalClientConnection");
-   return "";
-
-errorOut:
-   server->deleteObject();
-   client->deleteObject();
-   if(!error)
-      error = "Unknown Error";
-   return error;
-}

BIN
engine/source/network/netConnection_ScriptBinding.h


+ 2 - 95
engine/source/platform/menus/popupMenu.cc

@@ -25,6 +25,8 @@
 #include "gui/guiCanvas.h"
 #include "gui/guiCanvas.h"
 #include "memory/safeDelete.h"
 #include "memory/safeDelete.h"
 
 
+#include "popupMenu_ScriptBinding.h"
+
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
 // Constructor/Destructor
 // Constructor/Destructor
 //////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////
@@ -98,98 +100,3 @@ bool PopupMenu::onMessageObjectReceived(StringTableEntry queue, Message *msg )
 {
 {
    return Con::executef(this, 4, "onMessageReceived", queue, Con::getIntArg(msg->getId()));
    return Con::executef(this, 4, "onMessageReceived", queue, Con::getIntArg(msg->getId()));
 }
 }
-
-//////////////////////////////////////////////////////////////////////////
-// Console Methods
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(PopupMenu, insertItem, S32, 3, 5, "(pos[, title][, accelerator) Insert a new menu item\n"
-              "@param pos The position of the item\n"
-              "@param title The title of the item to add (optional)\n"
-              "@param accelerator A keyboard accelerator for the menu item\n"
-              "@return Returns the id of the new menu item as a nonnegative integer (-1 on fail)")
-{
-   return object->insertItem(dAtoi(argv[2]), argc < 4 ? NULL : argv[3], argc < 5 ? "" : argv[4]);
-}
-
-ConsoleMethod(PopupMenu, removeItem, void, 3, 3, "(pos) Removes the menu item at the given position\n"
-              "@param pos The position of the desired menu item to obliterate\n"
-              "@return No return value")
-{
-   object->removeItem(dAtoi(argv[2]));
-}
-
-ConsoleMethod(PopupMenu, insertSubMenu, S32, 5, 5, "(pos, title, subMenu) Inserts a menu item into the current object\n"
-              "@param pos The position of the menu item\n"
-              "@param The desired title of the sub menu\n"
-              "@param subMenu The submenu you are inserting.\n"
-              "@return Returns the ID of the inserted item or -1 on failure")
-{
-   PopupMenu *mnu = dynamic_cast<PopupMenu *>(Sim::findObject(argv[4]));
-   if(mnu == NULL)
-   {
-      Con::errorf("PopupMenu::insertSubMenu - Invalid PopupMenu object specified for submenu");
-      return -1;
-   }
-   return object->insertSubMenu(dAtoi(argv[2]), argv[3], mnu);
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(PopupMenu, enableItem, void, 4, 4, "(pos, enabled) Enables the item at the given position\n"
-              "@param pos The item's position\n"
-              "@param enabled A boolean value to set its current status\n"
-              "@return No return value")
-{
-   object->enableItem(dAtoi(argv[2]), dAtob(argv[3]));
-}
-
-ConsoleMethod(PopupMenu, checkItem, void, 4, 4, "(pos, checked) Sets the given item's \"checked\" status\n"
-              "@param pos The item's position\n"
-              "@return No return value")
-{
-   object->checkItem(dAtoi(argv[2]), dAtob(argv[3]));
-}
-
-ConsoleMethod(PopupMenu, checkRadioItem, void, 5, 5, "(firstPos, lastPos, checkPos) Checks the specified menu item and makes it a radio item\n"
-              "@param firstPos The position of the first item in the group\n"
-              "@param lastPos The position of the last item in the group\n"
-              "@param checkPos The position of the item to check\n"
-              "@return No return value.")
-{
-   object->checkRadioItem(dAtoi(argv[2]), dAtoi(argv[3]), dAtoi(argv[4]));
-}
-
-ConsoleMethod(PopupMenu, isItemChecked, bool, 3, 3, "(pos) Checks (no pun intended) the \"checked\" flag of the given menu item\n"
-              "@param pos The position of the desired item\n"
-              "@return Returns true if checked, false otherwise")
-{
-   return object->isItemChecked(dAtoi(argv[2]));
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(PopupMenu, attachToMenuBar, void, 4, 4, "(pos, title) Attaches given menu item to menu bar\n"
-              "@param pos The position of the desired menu item\n"
-              "@param title The menu item title\n"
-              "@return No return value")
-{
-   object->attachToMenuBar(dAtoi(argv[2]), argv[3]);
-}
-
-ConsoleMethod(PopupMenu, removeFromMenuBar, void, 2, 2, "() Removes current item from menu bar"
-              "@return No return value")
-{
-   object->removeFromMenuBar();
-}
-
-//////////////////////////////////////////////////////////////////////////
-
-ConsoleMethod(PopupMenu, showPopup, void, 2, 4, "([x, y]) Show the menu (optional: specify position)\n"
-              "@param x,y Coodinates to display menu (upper left corner)\n"
-              "@return No return value.")
-{
-   S32 x = argc >= 3 ? dAtoi(argv[2]) : -1;
-   S32 y = argc >= 4 ? dAtoi(argv[3]) : -1;
-   object->showPopup(x, y);
-}

BIN
engine/source/platform/menus/popupMenu_ScriptBinding.h