mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-17 13:43:48 +00:00
fixed lots of tabs and space
This commit is contained in:
parent
d30a3f9271
commit
bb38a40bcb
53 changed files with 2695 additions and 2695 deletions
|
|
@ -35,9 +35,9 @@ static U32 sAIPlayerLoSMask = TerrainObjectType | StaticShapeObjectType | Static
|
|||
IMPLEMENT_CO_NETOBJECT_V1(AIPlayer);
|
||||
|
||||
ConsoleDocClass( AIPlayer,
|
||||
"@brief A Player object not controlled by conventional input, but by an AI engine.\n\n"
|
||||
"@brief A Player object not controlled by conventional input, but by an AI engine.\n\n"
|
||||
|
||||
"The AIPlayer provides a Player object that may be controlled from script. You control "
|
||||
"The AIPlayer provides a Player object that may be controlled from script. You control "
|
||||
"where the player moves and how fast. You may also set where the AIPlayer is aiming at "
|
||||
"-- either a location or another game object.\n\n"
|
||||
|
||||
|
|
@ -70,19 +70,19 @@ ConsoleDocClass( AIPlayer,
|
|||
"position to the center of the target's bounding box. The LOS ray test only checks against interiors, "
|
||||
"statis shapes, and terrain.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Create the demo player object\n"
|
||||
"%player = new AiPlayer()\n"
|
||||
"{\n"
|
||||
" dataBlock = DemoPlayer;\n"
|
||||
" path = \"\";\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"// Create the demo player object\n"
|
||||
"%player = new AiPlayer()\n"
|
||||
"{\n"
|
||||
" dataBlock = DemoPlayer;\n"
|
||||
" path = \"\";\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@see Player for a list of all inherited functions, variables, and base description\n"
|
||||
"@see Player for a list of all inherited functions, variables, and base description\n"
|
||||
|
||||
"@ingroup AI\n"
|
||||
"@ingroup gameObjects\n");
|
||||
"@ingroup AI\n"
|
||||
"@ingroup gameObjects\n");
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
|
@ -147,7 +147,7 @@ void AIPlayer::initPersistFields()
|
|||
|
||||
addField( "AttackRadius", TypeF32, Offset( mAttackRadius, AIPlayer ),
|
||||
"@brief Distance considered in firing range for callback purposes.");
|
||||
|
||||
|
||||
endGroup( "AI" );
|
||||
|
||||
#ifdef TORQUE_NAVIGATION_ENABLED
|
||||
|
|
@ -399,11 +399,11 @@ bool AIPlayer::getAIMove(Move *movePtr)
|
|||
{
|
||||
clearPath();
|
||||
mMoveState = ModeStop;
|
||||
throwCallback("onTargetInRange");
|
||||
throwCallback("onTargetInRange");
|
||||
}
|
||||
else if((getPosition() - mFollowData.object->getPosition()).len() < mAttackRadius)
|
||||
{
|
||||
throwCallback("onTargetInFiringRange");
|
||||
throwCallback("onTargetInFiringRange");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -854,7 +854,7 @@ DefineEngineMethod(AIPlayer, getPathDestination, Point3F, (),,
|
|||
|
||||
"@see setPathDestination()\n")
|
||||
{
|
||||
return object->getPathDestination();
|
||||
return object->getPathDestination();
|
||||
}
|
||||
|
||||
void AIPlayer::followNavPath(NavPath *path)
|
||||
|
|
@ -1148,7 +1148,7 @@ DefineEngineMethod( AIPlayer, setMoveSpeed, void, ( F32 speed ),,
|
|||
|
||||
"@see getMoveDestination()\n")
|
||||
{
|
||||
object->setMoveSpeed(speed);
|
||||
object->setMoveSpeed(speed);
|
||||
}
|
||||
|
||||
DefineEngineMethod( AIPlayer, getMoveSpeed, F32, ( ),,
|
||||
|
|
@ -1186,7 +1186,7 @@ DefineEngineMethod( AIPlayer, getMoveDestination, Point3F, (),,
|
|||
|
||||
"@see setMoveDestination()\n")
|
||||
{
|
||||
return object->getMoveDestination();
|
||||
return object->getMoveDestination();
|
||||
}
|
||||
|
||||
DefineEngineMethod( AIPlayer, setAimLocation, void, ( Point3F target ),,
|
||||
|
|
@ -1196,7 +1196,7 @@ DefineEngineMethod( AIPlayer, setAimLocation, void, ( Point3F target ),,
|
|||
|
||||
"@see getAimLocation()\n")
|
||||
{
|
||||
object->setAimLocation(target);
|
||||
object->setAimLocation(target);
|
||||
}
|
||||
|
||||
DefineEngineMethod( AIPlayer, getAimLocation, Point3F, (),,
|
||||
|
|
@ -1212,7 +1212,7 @@ DefineEngineMethod( AIPlayer, getAimLocation, Point3F, (),,
|
|||
"@see setAimLocation()\n"
|
||||
"@see setAimObject()\n")
|
||||
{
|
||||
return object->getAimLocation();
|
||||
return object->getAimLocation();
|
||||
}
|
||||
|
||||
ConsoleDocFragment _setAimObject(
|
||||
|
|
@ -1240,7 +1240,7 @@ ConsoleDocFragment _setAimObject(
|
|||
|
||||
DefineConsoleMethod( AIPlayer, setAimObject, void, ( const char * objName, Point3F offset ), (Point3F::Zero), "( GameBase obj, [Point3F offset] )"
|
||||
"Sets the bot's target object. Optionally set an offset from target location."
|
||||
"@hide")
|
||||
"@hide")
|
||||
{
|
||||
|
||||
// Find the target
|
||||
|
|
@ -1262,7 +1262,7 @@ DefineEngineMethod( AIPlayer, getAimObject, S32, (),,
|
|||
|
||||
"@see setAimObject()\n")
|
||||
{
|
||||
GameBase* obj = object->getAimObject();
|
||||
GameBase* obj = object->getAimObject();
|
||||
return obj? obj->getId(): -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1222,17 +1222,17 @@ DefineEngineMethod( TSStatic, getTargetName, const char*, ( S32 index ),(0),
|
|||
"@return the name of the indexed material.\n"
|
||||
"@see getTargetCount()\n")
|
||||
{
|
||||
TSStatic *obj = dynamic_cast< TSStatic* > ( object );
|
||||
if(obj)
|
||||
{
|
||||
// Try to use the client object (so we get the reskinned targets in the Material Editor)
|
||||
if ((TSStatic*)obj->getClientObject())
|
||||
obj = (TSStatic*)obj->getClientObject();
|
||||
TSStatic *obj = dynamic_cast< TSStatic* > ( object );
|
||||
if(obj)
|
||||
{
|
||||
// Try to use the client object (so we get the reskinned targets in the Material Editor)
|
||||
if ((TSStatic*)obj->getClientObject())
|
||||
obj = (TSStatic*)obj->getClientObject();
|
||||
|
||||
return obj->getShapeInstance()->getTargetName(index);
|
||||
}
|
||||
return obj->getShapeInstance()->getTargetName(index);
|
||||
}
|
||||
|
||||
return "";
|
||||
return "";
|
||||
}
|
||||
|
||||
DefineEngineMethod( TSStatic, getTargetCount, S32,(),,
|
||||
|
|
@ -1240,17 +1240,17 @@ DefineEngineMethod( TSStatic, getTargetCount, S32,(),,
|
|||
"@return the number of materials in the shape.\n"
|
||||
"@see getTargetName()\n")
|
||||
{
|
||||
TSStatic *obj = dynamic_cast< TSStatic* > ( object );
|
||||
if(obj)
|
||||
{
|
||||
// Try to use the client object (so we get the reskinned targets in the Material Editor)
|
||||
if ((TSStatic*)obj->getClientObject())
|
||||
obj = (TSStatic*)obj->getClientObject();
|
||||
TSStatic *obj = dynamic_cast< TSStatic* > ( object );
|
||||
if(obj)
|
||||
{
|
||||
// Try to use the client object (so we get the reskinned targets in the Material Editor)
|
||||
if ((TSStatic*)obj->getClientObject())
|
||||
obj = (TSStatic*)obj->getClientObject();
|
||||
|
||||
return obj->getShapeInstance()->getTargetCount();
|
||||
}
|
||||
return obj->getShapeInstance()->getTargetCount();
|
||||
}
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// This method is able to change materials per map to with others. The material that is being replaced is being mapped to
|
||||
|
|
@ -1317,10 +1317,10 @@ DefineEngineMethod( TSStatic, getModelFile, const char *, (),,
|
|||
|
||||
"@return the shape filename\n\n"
|
||||
"@tsexample\n"
|
||||
"// Acquire the model filename used on this shape.\n"
|
||||
"%modelFilename = %obj.getModelFile();\n"
|
||||
"// Acquire the model filename used on this shape.\n"
|
||||
"%modelFilename = %obj.getModelFile();\n"
|
||||
"@endtsexample\n"
|
||||
)
|
||||
{
|
||||
return object->getShapeFileName();
|
||||
return object->getShapeFileName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ void BadWordFilter::create()
|
|||
{
|
||||
Con::addVariable("pref::enableBadWordFilter", TypeBool, &filteringEnabled,
|
||||
"@brief If true, the bad word filter will be enabled.\n\n"
|
||||
"@ingroup Game");
|
||||
"@ingroup Game");
|
||||
gBadWordFilter = new BadWordFilter;
|
||||
gBadWordFilter->addBadWord("shit");
|
||||
gBadWordFilter->addBadWord("fuck");
|
||||
|
|
@ -251,7 +251,7 @@ DefineEngineFunction(addBadWord, bool, (const char* badWord),,
|
|||
|
||||
"@ingroup Game")
|
||||
{
|
||||
return gBadWordFilter->addBadWord(badWord);
|
||||
return gBadWordFilter->addBadWord(badWord);
|
||||
}
|
||||
|
||||
DefineEngineFunction(filterString, const char *, (const char* baseString, const char* replacementChars), (nullAsType<const char*>(), nullAsType<const char*>()),
|
||||
|
|
@ -279,17 +279,17 @@ DefineEngineFunction(filterString, const char *, (const char* baseString, const
|
|||
|
||||
"@ingroup Game")
|
||||
{
|
||||
const char *replaceStr = NULL;
|
||||
const char *replaceStr = NULL;
|
||||
|
||||
if(replacementChars)
|
||||
replaceStr = replacementChars;
|
||||
else
|
||||
replaceStr = gBadWordFilter->getDefaultReplaceStr();
|
||||
if(replacementChars)
|
||||
replaceStr = replacementChars;
|
||||
else
|
||||
replaceStr = gBadWordFilter->getDefaultReplaceStr();
|
||||
|
||||
char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1);
|
||||
dStrcpy(ret, baseString);
|
||||
gBadWordFilter->filterString(ret, replaceStr);
|
||||
return ret;
|
||||
char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1);
|
||||
dStrcpy(ret, baseString);
|
||||
gBadWordFilter->filterString(ret, replaceStr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
DefineEngineFunction(containsBadWords, bool, (const char* text),,
|
||||
|
|
@ -316,17 +316,17 @@ DefineEngineFunction(containsBadWords, bool, (const char* text),,
|
|||
"// Otherwise print the original text\n"
|
||||
"if(containsBadWords(%userText))\n"
|
||||
"{\n"
|
||||
" // Filter the string\n"
|
||||
" %filteredText = filterString(%userText, %replacementChars);\n\n"
|
||||
" // Print filtered text\n"
|
||||
" echo(%filteredText);\n"
|
||||
" // Filter the string\n"
|
||||
" %filteredText = filterString(%userText, %replacementChars);\n\n"
|
||||
" // Print filtered text\n"
|
||||
" echo(%filteredText);\n"
|
||||
"}\n"
|
||||
"else\n"
|
||||
" echo(%userText);\n\n"
|
||||
" echo(%userText);\n\n"
|
||||
"@endtsexample\n"
|
||||
|
||||
"@ingroup Game")
|
||||
{
|
||||
return gBadWordFilter->containsBadWords(text);
|
||||
return gBadWordFilter->containsBadWords(text);
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -49,40 +49,40 @@ ConsoleDocClass( SimXMLDocument,
|
|||
"// Thanks to Rex Hiebert for this example\n"
|
||||
"// Given the following XML\n"
|
||||
"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n"
|
||||
"<DataTables>\n"
|
||||
" <table tableName=\"2DShapes\">\n"
|
||||
" <rec id=\"1\">Triangle</rec>\n"
|
||||
" <rec id=\"2\">Square</rec>\n"
|
||||
" <rec id=\"3\">Circle</rec>\n"
|
||||
" </table>\n"
|
||||
" <table tableName=\"3DShapes\">\n"
|
||||
" <rec id=\"1\">Pyramid</rec>\n"
|
||||
" <rec id=\"2\">Cube</rec>\n"
|
||||
" <rec id=\"3\">Sphere</rec>\n"
|
||||
" </table>\n"
|
||||
"</DataTables>\n\n"
|
||||
"<DataTables>\n"
|
||||
" <table tableName=\"2DShapes\">\n"
|
||||
" <rec id=\"1\">Triangle</rec>\n"
|
||||
" <rec id=\"2\">Square</rec>\n"
|
||||
" <rec id=\"3\">Circle</rec>\n"
|
||||
" </table>\n"
|
||||
" <table tableName=\"3DShapes\">\n"
|
||||
" <rec id=\"1\">Pyramid</rec>\n"
|
||||
" <rec id=\"2\">Cube</rec>\n"
|
||||
" <rec id=\"3\">Sphere</rec>\n"
|
||||
" </table>\n"
|
||||
"</DataTables>\n\n"
|
||||
"// Using SimXMLDocument by itself\n"
|
||||
"function readXmlExample(%filename)\n"
|
||||
"{\n"
|
||||
" %xml = new SimXMLDocument() {};\n"
|
||||
" %xml.loadFile(%filename);\n\n"
|
||||
" %xml.pushChildElement(\"DataTables\");\n"
|
||||
" %xml.pushFirstChildElement(\"table\");\n"
|
||||
" while(true)\n"
|
||||
" {\n"
|
||||
" echo(\"TABLE:\" SPC %xml.attribute(\"tableName\"));\n"
|
||||
" %xml.pushFirstChildElement(\"rec\");\n"
|
||||
" while (true)\n"
|
||||
" {\n"
|
||||
" %id = %xml.attribute(\"id\");\n"
|
||||
" %desc = %xml.getData();\n"
|
||||
" echo(\" Shape\" SPC %id SPC %desc);\n"
|
||||
" if (!%xml.nextSiblingElement(\"rec\")) break;\n"
|
||||
" }\n"
|
||||
" %xml.popElement();\n"
|
||||
" if (!%xml.nextSiblingElement(\"table\")) break;\n"
|
||||
" }\n"
|
||||
"}\n\n"
|
||||
"{\n"
|
||||
" %xml = new SimXMLDocument() {};\n"
|
||||
" %xml.loadFile(%filename);\n\n"
|
||||
" %xml.pushChildElement(\"DataTables\");\n"
|
||||
" %xml.pushFirstChildElement(\"table\");\n"
|
||||
" while(true)\n"
|
||||
" {\n"
|
||||
" echo(\"TABLE:\" SPC %xml.attribute(\"tableName\"));\n"
|
||||
" %xml.pushFirstChildElement(\"rec\");\n"
|
||||
" while (true)\n"
|
||||
" {\n"
|
||||
" %id = %xml.attribute(\"id\");\n"
|
||||
" %desc = %xml.getData();\n"
|
||||
" echo(\" Shape\" SPC %id SPC %desc);\n"
|
||||
" if (!%xml.nextSiblingElement(\"rec\")) break;\n"
|
||||
" }\n"
|
||||
" %xml.popElement();\n"
|
||||
" if (!%xml.nextSiblingElement(\"table\")) break;\n"
|
||||
" }\n"
|
||||
"}\n\n"
|
||||
|
||||
"// Thanks to Scott Peal for this example\n"
|
||||
"// Using FileObject in conjunction with SimXMLDocument\n"
|
||||
|
|
@ -90,45 +90,45 @@ ConsoleDocClass( SimXMLDocument,
|
|||
"// <Models>\n"
|
||||
"// <Model category=\"\" name=\"\" path=\"\" />\n"
|
||||
"// </Models>\n"
|
||||
"function getModelsInCatagory()\n"
|
||||
"{\n"
|
||||
" %file = \"./Catalog.xml\";\n"
|
||||
" %fo = new FileObject();\n"
|
||||
" %text = \"\";\n\n"
|
||||
" if(%fo.openForRead(%file))\n"
|
||||
" {\n"
|
||||
" while(!%fo.isEOF())\n"
|
||||
" {\n"
|
||||
" %text = %text @ %fo.readLine();\n"
|
||||
" if (!%fo.isEOF()) %text = %text @ \"\\n\";\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" echo(\"Unable to locate the file: \" @ %file);\n"
|
||||
" }\n\n"
|
||||
" %fo.delete();\n\n"
|
||||
" %xml = new SimXMLDocument() {};\n"
|
||||
" %xml.parse(%text);\n"
|
||||
" // \"Get\" inside of the root element, \"Models\".\n"
|
||||
" %xml.pushChildElement(0);\n\n"
|
||||
" // \"Get\" into the first child element\n"
|
||||
" if (%xml.pushFirstChildElement(\"Model\"))\n"
|
||||
" {\n"
|
||||
" while (true)\n"
|
||||
" {\n"
|
||||
" // \n"
|
||||
" // Here, i read the element's attributes.\n"
|
||||
" // You might want to save these values in an array or call the %xml.getElementValue()\n"
|
||||
" // if you have a different XML structure.\n\n"
|
||||
" %catagory = %xml.attribute(\"catagory\");\n"
|
||||
" %name = %xml.attribute(\"name\");\n"
|
||||
" %path = %xml.attribute(\"path\");\n\n"
|
||||
" // now, read the next \"Model\"\n"
|
||||
" if (!%xml.nextSiblingElement(\"Model\")) break;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"function getModelsInCatagory()\n"
|
||||
"{\n"
|
||||
" %file = \"./Catalog.xml\";\n"
|
||||
" %fo = new FileObject();\n"
|
||||
" %text = \"\";\n\n"
|
||||
" if(%fo.openForRead(%file))\n"
|
||||
" {\n"
|
||||
" while(!%fo.isEOF())\n"
|
||||
" {\n"
|
||||
" %text = %text @ %fo.readLine();\n"
|
||||
" if (!%fo.isEOF()) %text = %text @ \"\\n\";\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" else\n"
|
||||
" {\n"
|
||||
" echo(\"Unable to locate the file: \" @ %file);\n"
|
||||
" }\n\n"
|
||||
" %fo.delete();\n\n"
|
||||
" %xml = new SimXMLDocument() {};\n"
|
||||
" %xml.parse(%text);\n"
|
||||
" // \"Get\" inside of the root element, \"Models\".\n"
|
||||
" %xml.pushChildElement(0);\n\n"
|
||||
" // \"Get\" into the first child element\n"
|
||||
" if (%xml.pushFirstChildElement(\"Model\"))\n"
|
||||
" {\n"
|
||||
" while (true)\n"
|
||||
" {\n"
|
||||
" // \n"
|
||||
" // Here, i read the element's attributes.\n"
|
||||
" // You might want to save these values in an array or call the %xml.getElementValue()\n"
|
||||
" // if you have a different XML structure.\n\n"
|
||||
" %catagory = %xml.attribute(\"catagory\");\n"
|
||||
" %name = %xml.attribute(\"name\");\n"
|
||||
" %path = %xml.attribute(\"path\");\n\n"
|
||||
" // now, read the next \"Model\"\n"
|
||||
" if (!%xml.nextSiblingElement(\"Model\")) break;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@note SimXMLDocument is a wrapper around TinyXml, a standard XML library. If you're familiar "
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class SimXMLDocument: public SimObject
|
|||
{
|
||||
// This typedef is required for tie ins with the script language.
|
||||
// --------------------------------------------------------------------------
|
||||
protected:
|
||||
protected:
|
||||
typedef SimObject Parent;
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -85,8 +85,8 @@ class SimXMLDocument: public SimObject
|
|||
bool nextSiblingElement(const char* rName);
|
||||
// push child element at index onto stack.
|
||||
bool pushChildElement(S32 index);
|
||||
// Get element value
|
||||
const char* elementValue();
|
||||
// Get element value
|
||||
const char* elementValue();
|
||||
|
||||
// Pop last element off of stack.
|
||||
void popElement(void);
|
||||
|
|
@ -94,16 +94,16 @@ class SimXMLDocument: public SimObject
|
|||
// Get attribute from top element on element stack.
|
||||
const char* attribute(const char* rAttribute);
|
||||
|
||||
// Does the attribute exist in the current element
|
||||
// Does the attribute exist in the current element
|
||||
bool attributeExists(const char* rAttribute);
|
||||
|
||||
// Obtain the name of the current element's first or last attribute
|
||||
const char* firstAttribute();
|
||||
const char* lastAttribute();
|
||||
// Obtain the name of the current element's first or last attribute
|
||||
const char* firstAttribute();
|
||||
const char* lastAttribute();
|
||||
|
||||
// Move through the current element's attributes to obtain their names
|
||||
const char* nextAttribute();
|
||||
const char* prevAttribute();
|
||||
// Move through the current element's attributes to obtain their names
|
||||
const char* nextAttribute();
|
||||
const char* prevAttribute();
|
||||
|
||||
// Set attribute of top element on element stack.
|
||||
void setAttribute(const char* rAttribute, const char* rVal);
|
||||
|
|
@ -139,8 +139,8 @@ class SimXMLDocument: public SimObject
|
|||
TiXmlDocument* m_qDocument;
|
||||
// Stack of nodes.
|
||||
Vector<TiXmlElement*> m_paNode;
|
||||
// The current attribute
|
||||
TiXmlAttribute* m_CurrentAttribute;
|
||||
// The current attribute
|
||||
TiXmlAttribute* m_CurrentAttribute;
|
||||
|
||||
public:
|
||||
DECLARE_CONOBJECT(SimXMLDocument);
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public:
|
|||
|
||||
/// Returns the value for a given index.
|
||||
/// Will return a null value for an invalid index
|
||||
const String& getValueFromIndex( S32 index ) const;
|
||||
const String& getValueFromIndex( S32 index ) const;
|
||||
|
||||
///
|
||||
S32 getIndexFromKeyValue( const String &key, const String &value ) const;
|
||||
|
|
|
|||
|
|
@ -11,78 +11,78 @@
|
|||
#define yychar CMDchar
|
||||
#define yydebug CMDdebug
|
||||
#define yynerrs CMDnerrs
|
||||
#define rwDEFINE 258
|
||||
#define rwENDDEF 259
|
||||
#define rwDECLARE 260
|
||||
#define rwDECLARESINGLETON 261
|
||||
#define rwBREAK 262
|
||||
#define rwELSE 263
|
||||
#define rwCONTINUE 264
|
||||
#define rwGLOBAL 265
|
||||
#define rwIF 266
|
||||
#define rwNIL 267
|
||||
#define rwRETURN 268
|
||||
#define rwWHILE 269
|
||||
#define rwDO 270
|
||||
#define rwENDIF 271
|
||||
#define rwENDWHILE 272
|
||||
#define rwENDFOR 273
|
||||
#define rwDEFAULT 274
|
||||
#define rwFOR 275
|
||||
#define rwFOREACH 276
|
||||
#define rwFOREACHSTR 277
|
||||
#define rwIN 278
|
||||
#define rwDATABLOCK 279
|
||||
#define rwSWITCH 280
|
||||
#define rwCASE 281
|
||||
#define rwSWITCHSTR 282
|
||||
#define rwCASEOR 283
|
||||
#define rwPACKAGE 284
|
||||
#define rwNAMESPACE 285
|
||||
#define rwCLASS 286
|
||||
#define rwASSERT 287
|
||||
#define ILLEGAL_TOKEN 288
|
||||
#define CHRCONST 289
|
||||
#define INTCONST 290
|
||||
#define TTAG 291
|
||||
#define VAR 292
|
||||
#define IDENT 293
|
||||
#define TYPEIDENT 294
|
||||
#define DOCBLOCK 295
|
||||
#define STRATOM 296
|
||||
#define TAGATOM 297
|
||||
#define FLTCONST 298
|
||||
#define opINTNAME 299
|
||||
#define opINTNAMER 300
|
||||
#define opMINUSMINUS 301
|
||||
#define opPLUSPLUS 302
|
||||
#define STMT_SEP 303
|
||||
#define opSHL 304
|
||||
#define opSHR 305
|
||||
#define opPLASN 306
|
||||
#define opMIASN 307
|
||||
#define opMLASN 308
|
||||
#define opDVASN 309
|
||||
#define opMODASN 310
|
||||
#define opANDASN 311
|
||||
#define opXORASN 312
|
||||
#define opORASN 313
|
||||
#define opSLASN 314
|
||||
#define opSRASN 315
|
||||
#define opCAT 316
|
||||
#define opEQ 317
|
||||
#define opNE 318
|
||||
#define opGE 319
|
||||
#define opLE 320
|
||||
#define opAND 321
|
||||
#define opOR 322
|
||||
#define opSTREQ 323
|
||||
#define opCOLONCOLON 324
|
||||
#define opMDASN 325
|
||||
#define opNDASN 326
|
||||
#define opNTASN 327
|
||||
#define opSTRNE 328
|
||||
#define UNARY 329
|
||||
#define rwDEFINE 258
|
||||
#define rwENDDEF 259
|
||||
#define rwDECLARE 260
|
||||
#define rwDECLARESINGLETON 261
|
||||
#define rwBREAK 262
|
||||
#define rwELSE 263
|
||||
#define rwCONTINUE 264
|
||||
#define rwGLOBAL 265
|
||||
#define rwIF 266
|
||||
#define rwNIL 267
|
||||
#define rwRETURN 268
|
||||
#define rwWHILE 269
|
||||
#define rwDO 270
|
||||
#define rwENDIF 271
|
||||
#define rwENDWHILE 272
|
||||
#define rwENDFOR 273
|
||||
#define rwDEFAULT 274
|
||||
#define rwFOR 275
|
||||
#define rwFOREACH 276
|
||||
#define rwFOREACHSTR 277
|
||||
#define rwIN 278
|
||||
#define rwDATABLOCK 279
|
||||
#define rwSWITCH 280
|
||||
#define rwCASE 281
|
||||
#define rwSWITCHSTR 282
|
||||
#define rwCASEOR 283
|
||||
#define rwPACKAGE 284
|
||||
#define rwNAMESPACE 285
|
||||
#define rwCLASS 286
|
||||
#define rwASSERT 287
|
||||
#define ILLEGAL_TOKEN 288
|
||||
#define CHRCONST 289
|
||||
#define INTCONST 290
|
||||
#define TTAG 291
|
||||
#define VAR 292
|
||||
#define IDENT 293
|
||||
#define TYPEIDENT 294
|
||||
#define DOCBLOCK 295
|
||||
#define STRATOM 296
|
||||
#define TAGATOM 297
|
||||
#define FLTCONST 298
|
||||
#define opINTNAME 299
|
||||
#define opINTNAMER 300
|
||||
#define opMINUSMINUS 301
|
||||
#define opPLUSPLUS 302
|
||||
#define STMT_SEP 303
|
||||
#define opSHL 304
|
||||
#define opSHR 305
|
||||
#define opPLASN 306
|
||||
#define opMIASN 307
|
||||
#define opMLASN 308
|
||||
#define opDVASN 309
|
||||
#define opMODASN 310
|
||||
#define opANDASN 311
|
||||
#define opXORASN 312
|
||||
#define opORASN 313
|
||||
#define opSLASN 314
|
||||
#define opSRASN 315
|
||||
#define opCAT 316
|
||||
#define opEQ 317
|
||||
#define opNE 318
|
||||
#define opGE 319
|
||||
#define opLE 320
|
||||
#define opAND 321
|
||||
#define opOR 322
|
||||
#define opSTREQ 323
|
||||
#define opCOLONCOLON 324
|
||||
#define opMDASN 325
|
||||
#define opNDASN 326
|
||||
#define opNTASN 327
|
||||
#define opSTRNE 328
|
||||
#define UNARY 329
|
||||
|
||||
#line 1 "cmdgram.y"
|
||||
|
||||
|
|
@ -182,9 +182,9 @@ typedef
|
|||
|
||||
|
||||
|
||||
#define YYFINAL 388
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 100
|
||||
#define YYFINAL 388
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 100
|
||||
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 329 ? yytranslate[x] : 140)
|
||||
|
||||
|
|
@ -502,7 +502,7 @@ static const short yypgoto[] = {-32768,
|
|||
};
|
||||
|
||||
|
||||
#define YYLAST 3042
|
||||
#define YYLAST 3042
|
||||
|
||||
|
||||
static const short yytable[] = { 47,
|
||||
|
|
@ -1183,50 +1183,50 @@ void *alloca ();
|
|||
It is replaced by the list of actions, each action
|
||||
as one case of the switch. */
|
||||
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
#define yyclearin (yychar = YYEMPTY)
|
||||
#define YYEMPTY -2
|
||||
#define YYEOF 0
|
||||
#define YYACCEPT return(0)
|
||||
#define YYABORT return(1)
|
||||
#define YYERROR goto yyerrlab1
|
||||
#define yyerrok (yyerrstatus = 0)
|
||||
#define yyclearin (yychar = YYEMPTY)
|
||||
#define YYEMPTY -2
|
||||
#define YYEOF 0
|
||||
#define YYACCEPT return(0)
|
||||
#define YYABORT return(1)
|
||||
#define YYERROR goto yyerrlab1
|
||||
/* Like YYERROR except do call yyerror.
|
||||
This remains here temporarily to ease the
|
||||
transition to the new meaning of YYERROR, for GCC.
|
||||
Once GCC version 2 has supplanted version 1, this can go. */
|
||||
#define YYFAIL goto yyerrlab
|
||||
#define YYFAIL goto yyerrlab
|
||||
#define YYRECOVERING() (!!yyerrstatus)
|
||||
#define YYBACKUP(token, value) \
|
||||
do \
|
||||
if (yychar == YYEMPTY && yylen == 1) \
|
||||
{ yychar = (token), yylval = (value); \
|
||||
yychar1 = YYTRANSLATE (yychar); \
|
||||
YYPOPSTACK; \
|
||||
goto yybackup; \
|
||||
} \
|
||||
else \
|
||||
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
|
||||
do \
|
||||
if (yychar == YYEMPTY && yylen == 1) \
|
||||
{ yychar = (token), yylval = (value); \
|
||||
yychar1 = YYTRANSLATE (yychar); \
|
||||
YYPOPSTACK; \
|
||||
goto yybackup; \
|
||||
} \
|
||||
else \
|
||||
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
|
||||
while (0)
|
||||
|
||||
#define YYTERROR 1
|
||||
#define YYERRCODE 256
|
||||
#define YYTERROR 1
|
||||
#define YYERRCODE 256
|
||||
|
||||
#ifndef YYPURE
|
||||
#define YYLEX yylex()
|
||||
#define YYLEX yylex()
|
||||
#endif
|
||||
|
||||
#ifdef YYPURE
|
||||
#ifdef YYLSP_NEEDED
|
||||
#ifdef YYLEX_PARAM
|
||||
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
|
||||
#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
|
||||
#else
|
||||
#define YYLEX yylex(&yylval, &yylloc)
|
||||
#define YYLEX yylex(&yylval, &yylloc)
|
||||
#endif
|
||||
#else /* not YYLSP_NEEDED */
|
||||
#ifdef YYLEX_PARAM
|
||||
#define YYLEX yylex(&yylval, YYLEX_PARAM)
|
||||
#define YYLEX yylex(&yylval, YYLEX_PARAM)
|
||||
#else
|
||||
#define YYLEX yylex(&yylval)
|
||||
#define YYLEX yylex(&yylval)
|
||||
#endif
|
||||
#endif /* not YYLSP_NEEDED */
|
||||
#endif
|
||||
|
|
@ -1235,27 +1235,27 @@ while (0)
|
|||
|
||||
#ifndef YYPURE
|
||||
|
||||
int yychar; /* the lookahead symbol */
|
||||
YYSTYPE yylval; /* the semantic value of the */
|
||||
/* lookahead symbol */
|
||||
int yychar; /* the lookahead symbol */
|
||||
YYSTYPE yylval; /* the semantic value of the */
|
||||
/* lookahead symbol */
|
||||
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE yylloc; /* location data for the lookahead */
|
||||
/* symbol */
|
||||
YYLTYPE yylloc; /* location data for the lookahead */
|
||||
/* symbol */
|
||||
#endif
|
||||
|
||||
int yynerrs; /* number of parse errors so far */
|
||||
int yynerrs; /* number of parse errors so far */
|
||||
#endif /* not YYPURE */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
int yydebug; /* nonzero means print parse trace */
|
||||
int yydebug; /* nonzero means print parse trace */
|
||||
/* Since this is uninitialized, it does not stop multiple parsers
|
||||
from coexisting. */
|
||||
#endif
|
||||
|
||||
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
||||
/* YYINITDEPTH indicates the initial size of the parser's stacks */
|
||||
|
||||
#ifndef YYINITDEPTH
|
||||
#ifndef YYINITDEPTH
|
||||
#define YYINITDEPTH 200
|
||||
#endif
|
||||
|
||||
|
|
@ -1275,9 +1275,9 @@ int yydebug; /* nonzero means print parse trace */
|
|||
int yyparse (void);
|
||||
#endif
|
||||
|
||||
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||
#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
||||
#else /* not GNU C or C++ */
|
||||
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||
#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT)
|
||||
#else /* not GNU C or C++ */
|
||||
#ifndef __cplusplus
|
||||
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
|
|
@ -1337,17 +1337,17 @@ yyparse(YYPARSE_PARAM)
|
|||
int yyn;
|
||||
short *yyssp;
|
||||
YYSTYPE *yyvsp;
|
||||
int yyerrstatus; /* number of tokens to shift before error messages enabled */
|
||||
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
|
||||
int yyerrstatus; /* number of tokens to shift before error messages enabled */
|
||||
int yychar1 = 0; /* lookahead token as an internal (translated) token number */
|
||||
|
||||
short yyssa[YYINITDEPTH]; /* the state stack */
|
||||
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
|
||||
short yyssa[YYINITDEPTH]; /* the state stack */
|
||||
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
|
||||
|
||||
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
|
||||
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
|
||||
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
|
||||
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
|
||||
|
||||
#ifdef YYLSP_NEEDED
|
||||
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
|
||||
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
|
||||
YYLTYPE *yyls = yylsa;
|
||||
YYLTYPE *yylsp;
|
||||
|
||||
|
|
@ -1367,9 +1367,9 @@ yyparse(YYPARSE_PARAM)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
YYSTYPE yyval; /* the variable used to return */
|
||||
/* semantic values from the action */
|
||||
/* routines */
|
||||
YYSTYPE yyval; /* the variable used to return */
|
||||
/* semantic values from the action */
|
||||
/* routines */
|
||||
|
||||
int yylen;
|
||||
|
||||
|
|
@ -1381,7 +1381,7 @@ yyparse(YYPARSE_PARAM)
|
|||
yystate = 0;
|
||||
yyerrstatus = 0;
|
||||
yynerrs = 0;
|
||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||
yychar = YYEMPTY; /* Cause a token to be read. */
|
||||
|
||||
/* Initialize stack pointers.
|
||||
Waste one element of value and location stack
|
||||
|
|
@ -1416,20 +1416,20 @@ yynewstate:
|
|||
|
||||
#ifdef yyoverflow
|
||||
/* Each stack pointer address is followed by the size of
|
||||
the data in use in that stack, in bytes. */
|
||||
the data in use in that stack, in bytes. */
|
||||
#ifdef YYLSP_NEEDED
|
||||
/* This used to be a conditional around just the two extra args,
|
||||
but that might be undefined if yyoverflow is a macro. */
|
||||
but that might be undefined if yyoverflow is a macro. */
|
||||
yyoverflow("parser stack overflow",
|
||||
&yyss1, size * sizeof (*yyssp),
|
||||
&yyvs1, size * sizeof (*yyvsp),
|
||||
&yyls1, size * sizeof (*yylsp),
|
||||
&yystacksize);
|
||||
&yyss1, size * sizeof (*yyssp),
|
||||
&yyvs1, size * sizeof (*yyvsp),
|
||||
&yyls1, size * sizeof (*yylsp),
|
||||
&yystacksize);
|
||||
#else
|
||||
yyoverflow("parser stack overflow",
|
||||
&yyss1, size * sizeof (*yyssp),
|
||||
&yyvs1, size * sizeof (*yyvsp),
|
||||
&yystacksize);
|
||||
&yyss1, size * sizeof (*yyssp),
|
||||
&yyvs1, size * sizeof (*yyvsp),
|
||||
&yystacksize);
|
||||
#endif
|
||||
|
||||
yyss = yyss1; yyvs = yyvs1;
|
||||
|
|
@ -1439,13 +1439,13 @@ yynewstate:
|
|||
#else /* no yyoverflow */
|
||||
/* Extend the stack our own way. */
|
||||
if (yystacksize >= YYMAXDEPTH)
|
||||
{
|
||||
yyerror("parser stack overflow");
|
||||
return 2;
|
||||
}
|
||||
{
|
||||
yyerror("parser stack overflow");
|
||||
return 2;
|
||||
}
|
||||
yystacksize *= 2;
|
||||
if (yystacksize > YYMAXDEPTH)
|
||||
yystacksize = YYMAXDEPTH;
|
||||
yystacksize = YYMAXDEPTH;
|
||||
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
|
||||
__yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
|
||||
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
|
||||
|
|
@ -1464,11 +1464,11 @@ yynewstate:
|
|||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
||||
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
|
||||
#endif
|
||||
|
||||
if (yyssp >= yyss + yystacksize - 1)
|
||||
YYABORT;
|
||||
YYABORT;
|
||||
}
|
||||
|
||||
#if YYDEBUG != 0
|
||||
|
|
@ -1498,21 +1498,21 @@ yynewstate:
|
|||
{
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Reading a token: ");
|
||||
fprintf(stderr, "Reading a token: ");
|
||||
#endif
|
||||
yychar = YYLEX;
|
||||
}
|
||||
|
||||
/* Convert token to internal form (in yychar1) for indexing tables with */
|
||||
|
||||
if (yychar <= 0) /* This means end of input. */
|
||||
if (yychar <= 0) /* This means end of input. */
|
||||
{
|
||||
yychar1 = 0;
|
||||
yychar = YYEOF; /* Don't call YYLEX any more */
|
||||
yychar = YYEOF; /* Don't call YYLEX any more */
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Now at end of input.\n");
|
||||
fprintf(stderr, "Now at end of input.\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
|
@ -1521,15 +1521,15 @@ yynewstate:
|
|||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
{
|
||||
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
||||
/* Give the individual parser a way to print the precise meaning
|
||||
of a token, for further debugging info. */
|
||||
{
|
||||
fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
|
||||
/* Give the individual parser a way to print the precise meaning
|
||||
of a token, for further debugging info. */
|
||||
#ifdef YYPRINT
|
||||
YYPRINT (stderr, yychar, yylval);
|
||||
YYPRINT (stderr, yychar, yylval);
|
||||
#endif
|
||||
fprintf (stderr, ")\n");
|
||||
}
|
||||
fprintf (stderr, ")\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -1549,7 +1549,7 @@ yynewstate:
|
|||
if (yyn < 0)
|
||||
{
|
||||
if (yyn == YYFLAG)
|
||||
goto yyerrlab;
|
||||
goto yyerrlab;
|
||||
yyn = -yyn;
|
||||
goto yyreduce;
|
||||
}
|
||||
|
|
@ -1600,11 +1600,11 @@ yyreduce:
|
|||
int i;
|
||||
|
||||
fprintf (stderr, "Reducing via rule %d (line %d), ",
|
||||
yyn, yyrline[yyn]);
|
||||
yyn, yyrline[yyn]);
|
||||
|
||||
/* Print the symbols being reduced, and their result. */
|
||||
for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
|
||||
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
|
||||
fprintf (stderr, "%s ", yytname[yyrhs[i]]);
|
||||
fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2265,7 +2265,7 @@ case 162:
|
|||
short *ssp1 = yyss - 1;
|
||||
fprintf (stderr, "state stack now");
|
||||
while (ssp1 != yyssp)
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2315,44 +2315,44 @@ yyerrlab: /* here on detecting error */
|
|||
yyn = yypact[yystate];
|
||||
|
||||
if (yyn > YYFLAG && yyn < YYLAST)
|
||||
{
|
||||
int size = 0;
|
||||
char *msg;
|
||||
int x, count;
|
||||
{
|
||||
int size = 0;
|
||||
char *msg;
|
||||
int x, count;
|
||||
|
||||
count = 0;
|
||||
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
|
||||
for (x = (yyn < 0 ? -yyn : 0);
|
||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
size += strlen(yytname[x]) + 15, count++;
|
||||
msg = (char *) malloc(size + 15);
|
||||
if (msg != 0)
|
||||
{
|
||||
strcpy(msg, "parse error");
|
||||
count = 0;
|
||||
/* Start X at -yyn if nec to avoid negative indexes in yycheck. */
|
||||
for (x = (yyn < 0 ? -yyn : 0);
|
||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
size += strlen(yytname[x]) + 15, count++;
|
||||
msg = (char *) malloc(size + 15);
|
||||
if (msg != 0)
|
||||
{
|
||||
strcpy(msg, "parse error");
|
||||
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (x = (yyn < 0 ? -yyn : 0);
|
||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
{
|
||||
strcat(msg, count == 0 ? ", expecting `" : " or `");
|
||||
strcat(msg, yytname[x]);
|
||||
strcat(msg, "'");
|
||||
count++;
|
||||
}
|
||||
}
|
||||
yyerror(msg);
|
||||
free(msg);
|
||||
}
|
||||
else
|
||||
yyerror ("parse error; also virtual memory exceeded");
|
||||
}
|
||||
if (count < 5)
|
||||
{
|
||||
count = 0;
|
||||
for (x = (yyn < 0 ? -yyn : 0);
|
||||
x < (sizeof(yytname) / sizeof(char *)); x++)
|
||||
if (yycheck[x + yyn] == x)
|
||||
{
|
||||
strcat(msg, count == 0 ? ", expecting `" : " or `");
|
||||
strcat(msg, yytname[x]);
|
||||
strcat(msg, "'");
|
||||
count++;
|
||||
}
|
||||
}
|
||||
yyerror(msg);
|
||||
free(msg);
|
||||
}
|
||||
else
|
||||
yyerror ("parse error; also virtual memory exceeded");
|
||||
}
|
||||
else
|
||||
#endif /* YYERROR_VERBOSE */
|
||||
yyerror("parse error");
|
||||
yyerror("parse error");
|
||||
}
|
||||
|
||||
goto yyerrlab1;
|
||||
|
|
@ -2364,11 +2364,11 @@ yyerrlab1: /* here on error raised explicitly by an action */
|
|||
|
||||
/* return failure if at end of input */
|
||||
if (yychar == YYEOF)
|
||||
YYABORT;
|
||||
YYABORT;
|
||||
|
||||
#if YYDEBUG != 0
|
||||
if (yydebug)
|
||||
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
||||
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
|
||||
#endif
|
||||
|
||||
yychar = YYEMPTY;
|
||||
|
|
@ -2377,7 +2377,7 @@ yyerrlab1: /* here on error raised explicitly by an action */
|
|||
/* Else will try to reuse lookahead token
|
||||
after shifting the error token. */
|
||||
|
||||
yyerrstatus = 3; /* Each real token shifted decrements this */
|
||||
yyerrstatus = 3; /* Each real token shifted decrements this */
|
||||
|
||||
goto yyerrhandle;
|
||||
|
||||
|
|
@ -2405,7 +2405,7 @@ yyerrpop: /* pop the current state because it cannot handle the error token */
|
|||
short *ssp1 = yyss - 1;
|
||||
fprintf (stderr, "Error: state stack now");
|
||||
while (ssp1 != yyssp)
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, " %d", *++ssp1);
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2424,7 +2424,7 @@ yyerrhandle:
|
|||
if (yyn < 0)
|
||||
{
|
||||
if (yyn == YYFLAG)
|
||||
goto yyerrpop;
|
||||
goto yyerrpop;
|
||||
yyn = -yyn;
|
||||
goto yyreduce;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,78 +15,78 @@ typedef union {
|
|||
AssignDecl asn;
|
||||
IfStmtNode* ifnode;
|
||||
} YYSTYPE;
|
||||
#define rwDEFINE 258
|
||||
#define rwENDDEF 259
|
||||
#define rwDECLARE 260
|
||||
#define rwDECLARESINGLETON 261
|
||||
#define rwBREAK 262
|
||||
#define rwELSE 263
|
||||
#define rwCONTINUE 264
|
||||
#define rwGLOBAL 265
|
||||
#define rwIF 266
|
||||
#define rwNIL 267
|
||||
#define rwRETURN 268
|
||||
#define rwWHILE 269
|
||||
#define rwDO 270
|
||||
#define rwENDIF 271
|
||||
#define rwENDWHILE 272
|
||||
#define rwENDFOR 273
|
||||
#define rwDEFAULT 274
|
||||
#define rwFOR 275
|
||||
#define rwFOREACH 276
|
||||
#define rwFOREACHSTR 277
|
||||
#define rwIN 278
|
||||
#define rwDATABLOCK 279
|
||||
#define rwSWITCH 280
|
||||
#define rwCASE 281
|
||||
#define rwSWITCHSTR 282
|
||||
#define rwCASEOR 283
|
||||
#define rwPACKAGE 284
|
||||
#define rwNAMESPACE 285
|
||||
#define rwCLASS 286
|
||||
#define rwASSERT 287
|
||||
#define ILLEGAL_TOKEN 288
|
||||
#define CHRCONST 289
|
||||
#define INTCONST 290
|
||||
#define TTAG 291
|
||||
#define VAR 292
|
||||
#define IDENT 293
|
||||
#define TYPEIDENT 294
|
||||
#define DOCBLOCK 295
|
||||
#define STRATOM 296
|
||||
#define TAGATOM 297
|
||||
#define FLTCONST 298
|
||||
#define opINTNAME 299
|
||||
#define opINTNAMER 300
|
||||
#define opMINUSMINUS 301
|
||||
#define opPLUSPLUS 302
|
||||
#define STMT_SEP 303
|
||||
#define opSHL 304
|
||||
#define opSHR 305
|
||||
#define opPLASN 306
|
||||
#define opMIASN 307
|
||||
#define opMLASN 308
|
||||
#define opDVASN 309
|
||||
#define opMODASN 310
|
||||
#define opANDASN 311
|
||||
#define opXORASN 312
|
||||
#define opORASN 313
|
||||
#define opSLASN 314
|
||||
#define opSRASN 315
|
||||
#define opCAT 316
|
||||
#define opEQ 317
|
||||
#define opNE 318
|
||||
#define opGE 319
|
||||
#define opLE 320
|
||||
#define opAND 321
|
||||
#define opOR 322
|
||||
#define opSTREQ 323
|
||||
#define opCOLONCOLON 324
|
||||
#define opMDASN 325
|
||||
#define opNDASN 326
|
||||
#define opNTASN 327
|
||||
#define opSTRNE 328
|
||||
#define UNARY 329
|
||||
#define rwDEFINE 258
|
||||
#define rwENDDEF 259
|
||||
#define rwDECLARE 260
|
||||
#define rwDECLARESINGLETON 261
|
||||
#define rwBREAK 262
|
||||
#define rwELSE 263
|
||||
#define rwCONTINUE 264
|
||||
#define rwGLOBAL 265
|
||||
#define rwIF 266
|
||||
#define rwNIL 267
|
||||
#define rwRETURN 268
|
||||
#define rwWHILE 269
|
||||
#define rwDO 270
|
||||
#define rwENDIF 271
|
||||
#define rwENDWHILE 272
|
||||
#define rwENDFOR 273
|
||||
#define rwDEFAULT 274
|
||||
#define rwFOR 275
|
||||
#define rwFOREACH 276
|
||||
#define rwFOREACHSTR 277
|
||||
#define rwIN 278
|
||||
#define rwDATABLOCK 279
|
||||
#define rwSWITCH 280
|
||||
#define rwCASE 281
|
||||
#define rwSWITCHSTR 282
|
||||
#define rwCASEOR 283
|
||||
#define rwPACKAGE 284
|
||||
#define rwNAMESPACE 285
|
||||
#define rwCLASS 286
|
||||
#define rwASSERT 287
|
||||
#define ILLEGAL_TOKEN 288
|
||||
#define CHRCONST 289
|
||||
#define INTCONST 290
|
||||
#define TTAG 291
|
||||
#define VAR 292
|
||||
#define IDENT 293
|
||||
#define TYPEIDENT 294
|
||||
#define DOCBLOCK 295
|
||||
#define STRATOM 296
|
||||
#define TAGATOM 297
|
||||
#define FLTCONST 298
|
||||
#define opINTNAME 299
|
||||
#define opINTNAMER 300
|
||||
#define opMINUSMINUS 301
|
||||
#define opPLUSPLUS 302
|
||||
#define STMT_SEP 303
|
||||
#define opSHL 304
|
||||
#define opSHR 305
|
||||
#define opPLASN 306
|
||||
#define opMIASN 307
|
||||
#define opMLASN 308
|
||||
#define opDVASN 309
|
||||
#define opMODASN 310
|
||||
#define opANDASN 311
|
||||
#define opXORASN 312
|
||||
#define opORASN 313
|
||||
#define opSLASN 314
|
||||
#define opSRASN 315
|
||||
#define opCAT 316
|
||||
#define opEQ 317
|
||||
#define opNE 318
|
||||
#define opGE 319
|
||||
#define opLE 320
|
||||
#define opAND 321
|
||||
#define opOR 322
|
||||
#define opSTREQ 323
|
||||
#define opCOLONCOLON 324
|
||||
#define opMDASN 325
|
||||
#define opNDASN 326
|
||||
#define opNTASN 327
|
||||
#define opSTRNE 328
|
||||
#define UNARY 329
|
||||
|
||||
|
||||
extern YYSTYPE CMDlval;
|
||||
|
|
|
|||
|
|
@ -455,8 +455,8 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
|
|||
|
||||
bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, const char *inScript, bool overrideNoDso)
|
||||
{
|
||||
AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread");
|
||||
|
||||
AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread");
|
||||
|
||||
// This will return true, but return value is ignored
|
||||
char *script;
|
||||
chompUTF8BOM( inScript, &script );
|
||||
|
|
@ -572,8 +572,8 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con
|
|||
|
||||
ConsoleValueRef CodeBlock::compileExec(StringTableEntry fileName, const char *inString, bool noCalls, S32 setFrame)
|
||||
{
|
||||
AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread");
|
||||
|
||||
AssertFatal(Con::isMainThread(), "Compiling code on a secondary thread");
|
||||
|
||||
// Check for a UTF8 script file
|
||||
char *string;
|
||||
chompUTF8BOM( inString, &string );
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ inline void ExprEvalState::setCurVarName(StringTableEntry name)
|
|||
else if( getStackDepth() > 0 )
|
||||
currentVariable = getCurrentFrame().lookup(name);
|
||||
if(!currentVariable && gWarnUndefinedScriptVariables)
|
||||
Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name);
|
||||
Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name);
|
||||
}
|
||||
|
||||
inline void ExprEvalState::setCurVarNameCreate(StringTableEntry name)
|
||||
|
|
@ -316,7 +316,7 @@ inline void ExprEvalState::setCopyVariable()
|
|||
default:
|
||||
currentVariable->setStringValue(copyVariable->getStringValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -398,7 +398,7 @@ static void setFieldComponent( SimObject* object, StringTableEntry field, const
|
|||
|
||||
// Ensure that the variable has a value
|
||||
if (!prevVal)
|
||||
return;
|
||||
return;
|
||||
|
||||
static const StringTableEntry xyzw[] =
|
||||
{
|
||||
|
|
@ -419,7 +419,7 @@ static void setFieldComponent( SimObject* object, StringTableEntry field, const
|
|||
// Insert the value into the specified
|
||||
// component of the string.
|
||||
if ( subField == xyzw[0] || subField == rgba[0] )
|
||||
dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") );
|
||||
dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") );
|
||||
|
||||
else if ( subField == xyzw[1] || subField == rgba[1] )
|
||||
dStrcpy( val, StringUnit::setUnit( prevVal, 1, strValue, " \t\n") );
|
||||
|
|
@ -1020,7 +1020,7 @@ breakContinue:
|
|||
dataBlock->deleteObject();
|
||||
currentNewObject = NULL;
|
||||
ip = failJump;
|
||||
|
||||
|
||||
// Prevent stack value corruption
|
||||
CSTK.popFrame();
|
||||
STR.popFrame();
|
||||
|
|
@ -1164,8 +1164,8 @@ breakContinue:
|
|||
|
||||
// This fixes a bug when not explicitly returning a value.
|
||||
case OP_RETURN_VOID:
|
||||
STR.setStringValue("");
|
||||
// We're falling thru here on purpose.
|
||||
STR.setStringValue("");
|
||||
// We're falling thru here on purpose.
|
||||
|
||||
case OP_RETURN:
|
||||
retValue = STR.getStringValuePtr();
|
||||
|
|
@ -1437,7 +1437,7 @@ breakContinue:
|
|||
case OP_SAVEVAR_STR:
|
||||
gEvalState.setStringVariable(STR.getStringValue());
|
||||
break;
|
||||
|
||||
|
||||
case OP_SAVEVAR_VAR:
|
||||
// this basically handles %var1 = %var2
|
||||
gEvalState.setCopyVariable();
|
||||
|
|
|
|||
|
|
@ -278,8 +278,8 @@ bool useTimestamp = false;
|
|||
ConsoleFunctionGroupBegin( Clipboard, "Miscellaneous functions to control the clipboard and clear the console.");
|
||||
|
||||
DefineConsoleFunction( cls, void, (), , "()"
|
||||
"@brief Clears the console output.\n\n"
|
||||
"@ingroup Console")
|
||||
"@brief Clears the console output.\n\n"
|
||||
"@ingroup Console")
|
||||
{
|
||||
if(consoleLogLocked)
|
||||
return;
|
||||
|
|
@ -288,17 +288,17 @@ DefineConsoleFunction( cls, void, (), , "()"
|
|||
};
|
||||
|
||||
DefineConsoleFunction( getClipboard, const char*, (), , "()"
|
||||
"@brief Get text from the clipboard.\n\n"
|
||||
"@internal")
|
||||
"@brief Get text from the clipboard.\n\n"
|
||||
"@internal")
|
||||
{
|
||||
return Platform::getClipboard();
|
||||
return Platform::getClipboard();
|
||||
};
|
||||
|
||||
DefineConsoleFunction( setClipboard, bool, (const char* text), , "(string text)"
|
||||
"@brief Set the system clipboard.\n\n"
|
||||
"@internal")
|
||||
"@internal")
|
||||
{
|
||||
return Platform::setClipboard(text);
|
||||
return Platform::setClipboard(text);
|
||||
};
|
||||
|
||||
ConsoleFunctionGroupEnd( Clipboard );
|
||||
|
|
@ -332,25 +332,25 @@ void init()
|
|||
// Variables
|
||||
setVariable("Con::prompt", "% ");
|
||||
addVariable("Con::logBufferEnabled", TypeBool, &logBufferEnabled, "If true, the log buffer will be enabled.\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
addVariable("Con::printLevel", TypeS32, &printLevel,
|
||||
"@brief This is deprecated.\n\n"
|
||||
"It is no longer in use and does nothing.\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
addVariable("Con::warnUndefinedVariables", TypeBool, &gWarnUndefinedScriptVariables, "If true, a warning will be displayed in the console whenever a undefined variable is used in script.\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
addVariable( "instantGroup", TypeRealString, &gInstantGroup, "The group that objects will be added to when they are created.\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
|
||||
addVariable("Con::objectCopyFailures", TypeS32, &gObjectCopyFailures, "If greater than zero then it counts the number of object creation "
|
||||
"failures based on a missing copy object and does not report an error..\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
|
||||
// Current script file name and root
|
||||
addVariable( "Con::File", TypeString, &gCurrentFile, "The currently executing script file.\n"
|
||||
"@ingroup FileSystem\n");
|
||||
"@ingroup FileSystem\n");
|
||||
addVariable( "Con::Root", TypeString, &gCurrentRoot, "The mod folder for the currently executing script file.\n"
|
||||
"@ingroup FileSystem\n" );
|
||||
"@ingroup FileSystem\n" );
|
||||
|
||||
// alwaysUseDebugOutput determines whether to send output to the platform's
|
||||
// "debug" system. see winConsole for an example.
|
||||
|
|
@ -364,14 +364,14 @@ void init()
|
|||
addVariable("Con::alwaysUseDebugOutput", TypeBool, &alwaysUseDebugOutput,
|
||||
"@brief Determines whether to send output to the platform's \"debug\" system.\n\n"
|
||||
"@note This is disabled in shipping builds.\n"
|
||||
"@ingroup Console");
|
||||
"@ingroup Console");
|
||||
#else
|
||||
alwaysUseDebugOutput = false;
|
||||
#endif
|
||||
|
||||
// controls whether a timestamp is prepended to every console message
|
||||
addVariable("Con::useTimestamp", TypeBool, &useTimestamp, "If true a timestamp is prepended to every console message.\n"
|
||||
"@ingroup Console\n");
|
||||
"@ingroup Console\n");
|
||||
|
||||
// Plug us into the journaled console input signal.
|
||||
smConsoleInput.notify(postConsoleInput);
|
||||
|
|
@ -599,7 +599,7 @@ static void log(const char *string)
|
|||
static void _printf(ConsoleLogEntry::Level level, ConsoleLogEntry::Type type, const char* fmt, va_list argptr)
|
||||
{
|
||||
if (!active)
|
||||
return;
|
||||
return;
|
||||
Con::active = false;
|
||||
|
||||
char buffer[8192];
|
||||
|
|
@ -781,7 +781,7 @@ Dictionary::Entry *getAddVariableEntry(const char *name)
|
|||
StringTableEntry stName = StringTable->insert(name);
|
||||
Dictionary::Entry *entry = gEvalState.globalVars.lookup(stName);
|
||||
if (!entry)
|
||||
entry = gEvalState.globalVars.add(stName);
|
||||
entry = gEvalState.globalVars.add(stName);
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
@ -791,7 +791,7 @@ Dictionary::Entry *getAddLocalVariableEntry(const char *name)
|
|||
StringTableEntry stName = StringTable->insert(name);
|
||||
Dictionary::Entry *entry = gEvalState.getCurrentFrame().lookup(stName);
|
||||
if (!entry)
|
||||
entry = gEvalState.getCurrentFrame().add(stName);
|
||||
entry = gEvalState.getCurrentFrame().add(stName);
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
@ -802,7 +802,7 @@ void setVariable(const char *name, const char *value)
|
|||
|
||||
if (getVariableObjectField(name, &obj, &objField))
|
||||
{
|
||||
obj->setDataField(StringTable->insert(objField), 0, value);
|
||||
obj->setDataField(StringTable->insert(objField), 0, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -824,13 +824,13 @@ void setBoolVariable(const char *varName, bool value)
|
|||
|
||||
if (getVariableObjectField(varName, &obj, &objField))
|
||||
{
|
||||
obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0");
|
||||
obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0");
|
||||
}
|
||||
else
|
||||
{
|
||||
varName = prependDollar(varName);
|
||||
Dictionary::Entry *entry = getAddVariableEntry(varName);
|
||||
entry->setStringValue(value ? "1" : "0");
|
||||
entry->setStringValue(value ? "1" : "0");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -841,9 +841,9 @@ void setIntVariable(const char *varName, S32 value)
|
|||
|
||||
if (getVariableObjectField(varName, &obj, &objField))
|
||||
{
|
||||
char scratchBuffer[32];
|
||||
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value);
|
||||
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
||||
char scratchBuffer[32];
|
||||
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value);
|
||||
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -860,15 +860,15 @@ void setFloatVariable(const char *varName, F32 value)
|
|||
|
||||
if (getVariableObjectField(varName, &obj, &objField))
|
||||
{
|
||||
char scratchBuffer[32];
|
||||
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value);
|
||||
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
||||
char scratchBuffer[32];
|
||||
dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value);
|
||||
obj->setDataField(StringTable->insert(objField), 0, scratchBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
varName = prependDollar(varName);
|
||||
Dictionary::Entry *entry = getAddVariableEntry(varName);
|
||||
entry->setFloatValue(value);
|
||||
entry->setFloatValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1020,7 +1020,7 @@ F32 getFloatVariable(const char *varName, F32 def)
|
|||
else
|
||||
{
|
||||
Dictionary::Entry *entry = getVariableEntry(varName);
|
||||
return entry ? entry->getFloatValue() : def;
|
||||
return entry ? entry->getFloatValue() : def;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1308,8 +1308,8 @@ bool executeFile(const char* fileName, bool noCalls, bool journalScript)
|
|||
|
||||
// Let's do a sanity check to complain about DSOs in the future.
|
||||
//
|
||||
// MM: This doesn't seem to be working correctly for now so let's just not issue
|
||||
// the warning until someone knows how to resolve it.
|
||||
// MM: This doesn't seem to be working correctly for now so let's just not issue
|
||||
// the warning until someone knows how to resolve it.
|
||||
//
|
||||
//if(compiled && rCom && rScr && Platform::compareFileTimes(comModifyTime, scrModifyTime) < 0)
|
||||
//{
|
||||
|
|
@ -1515,7 +1515,7 @@ ConsoleValueRef execute(S32 argc, ConsoleValueRef argv[])
|
|||
#endif
|
||||
ConsoleStackFrameSaver stackSaver;
|
||||
stackSaver.save();
|
||||
return _internalExecute(argc, argv);
|
||||
return _internalExecute(argc, argv);
|
||||
#ifdef TORQUE_MULTITHREAD
|
||||
}
|
||||
else
|
||||
|
|
@ -2616,7 +2616,7 @@ const char *ConsoleValue::getStringValue()
|
|||
|
||||
U32 stringLen = dStrlen(internalValue);
|
||||
U32 newLen = ((stringLen + 1) + 15) & ~15; // pad upto next cache line
|
||||
|
||||
|
||||
if (bufferLen == 0)
|
||||
sval = (char *) dMalloc(newLen);
|
||||
else if(newLen > bufferLen)
|
||||
|
|
|
|||
|
|
@ -95,8 +95,8 @@ struct ConsoleLogEntry
|
|||
Script,
|
||||
GUI,
|
||||
Network,
|
||||
GGConnect,
|
||||
NUM_TYPE
|
||||
GGConnect,
|
||||
NUM_TYPE
|
||||
} mType;
|
||||
|
||||
/// Indicates the actual log entry.
|
||||
|
|
@ -897,28 +897,28 @@ template<typename P1> struct _EngineConsoleExecCallbackHelper;
|
|||
|
||||
namespace Con
|
||||
{
|
||||
/// @name Console Execution - executef
|
||||
/// {
|
||||
///
|
||||
/// Implements a script function thunk which automatically converts parameters to relevant console types.
|
||||
/// Can be used as follows:
|
||||
/// - Con::executef("functionName", ...);
|
||||
/// - Con::executef(mySimObject, "functionName", ...);
|
||||
///
|
||||
/// NOTE: if you get a rather cryptic template error coming through here, most likely you are trying to
|
||||
/// convert a parameter which EngineMarshallType does not have a specialization for.
|
||||
/// Another problem can occur if you do not include "console/simBase.h" and "console/engineAPI.h"
|
||||
/// since _EngineConsoleExecCallbackHelper and SimConsoleThreadExecCallback are required.
|
||||
///
|
||||
/// @see _EngineConsoleExecCallbackHelper
|
||||
///
|
||||
template<typename R, typename ...ArgTs>
|
||||
ConsoleValueRef executef(R r, ArgTs ...argTs)
|
||||
{
|
||||
_EngineConsoleExecCallbackHelper<R> callback( r );
|
||||
return callback.template call<ConsoleValueRef>(argTs...);
|
||||
}
|
||||
/// }
|
||||
/// @name Console Execution - executef
|
||||
/// {
|
||||
///
|
||||
/// Implements a script function thunk which automatically converts parameters to relevant console types.
|
||||
/// Can be used as follows:
|
||||
/// - Con::executef("functionName", ...);
|
||||
/// - Con::executef(mySimObject, "functionName", ...);
|
||||
///
|
||||
/// NOTE: if you get a rather cryptic template error coming through here, most likely you are trying to
|
||||
/// convert a parameter which EngineMarshallType does not have a specialization for.
|
||||
/// Another problem can occur if you do not include "console/simBase.h" and "console/engineAPI.h"
|
||||
/// since _EngineConsoleExecCallbackHelper and SimConsoleThreadExecCallback are required.
|
||||
///
|
||||
/// @see _EngineConsoleExecCallbackHelper
|
||||
///
|
||||
template<typename R, typename ...ArgTs>
|
||||
ConsoleValueRef executef(R r, ArgTs ...argTs)
|
||||
{
|
||||
_EngineConsoleExecCallbackHelper<R> callback( r );
|
||||
return callback.template call<ConsoleValueRef>(argTs...);
|
||||
}
|
||||
/// }
|
||||
};
|
||||
|
||||
extern void expandEscape(char *dest, const char *src);
|
||||
|
|
@ -1143,19 +1143,19 @@ class ConsoleStackFrameSaver
|
|||
{
|
||||
public:
|
||||
|
||||
bool mSaved;
|
||||
bool mSaved;
|
||||
|
||||
ConsoleStackFrameSaver() : mSaved(false)
|
||||
{
|
||||
}
|
||||
ConsoleStackFrameSaver() : mSaved(false)
|
||||
{
|
||||
}
|
||||
|
||||
~ConsoleStackFrameSaver()
|
||||
{
|
||||
restore();
|
||||
}
|
||||
~ConsoleStackFrameSaver()
|
||||
{
|
||||
restore();
|
||||
}
|
||||
|
||||
void save();
|
||||
void restore();
|
||||
void save();
|
||||
void restore();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ DefineConsoleFunction( dumpConsoleClasses, void, (bool dumpScript, bool dumpEngi
|
|||
"@brief Dumps all declared console classes to the console.\n\n"
|
||||
"@param dumpScript Optional parameter specifying whether or not classes defined in script should be dumped.\n"
|
||||
"@param dumpEngine Optional parameter specifying whether or not classes defined in the engine should be dumped.\n"
|
||||
"@ingroup Logging")
|
||||
"@ingroup Logging")
|
||||
{
|
||||
Namespace::dumpClasses( dumpScript, dumpEngine );
|
||||
}
|
||||
|
|
@ -54,7 +54,7 @@ DefineConsoleFunction(dumpConsoleFunctions, void, ( bool dumpScript, bool dumpEn
|
|||
"@brief Dumps all declared console functions to the console.\n"
|
||||
"@param dumpScript Optional parameter specifying whether or not functions defined in script should be dumped.\n"
|
||||
"@param dumpEngine Optional parameter specitying whether or not functions defined in the engine should be dumped.\n"
|
||||
"@ingroup Logging")
|
||||
"@ingroup Logging")
|
||||
{
|
||||
Namespace::dumpFunctions( dumpScript, dumpEngine );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -463,12 +463,12 @@ DefineConsoleFunction( strposr, S32, ( const char* haystack, const char* needle,
|
|||
U32 sublen = dStrlen( needle );
|
||||
U32 strlen = dStrlen( haystack );
|
||||
S32 start = strlen - offset;
|
||||
|
||||
|
||||
if(start < 0 || start > strlen)
|
||||
return -1;
|
||||
|
||||
if (start + sublen > strlen)
|
||||
start = strlen - sublen;
|
||||
start = strlen - sublen;
|
||||
for(; start >= 0; start--)
|
||||
if(!dStrncmp(haystack + start, needle, sublen))
|
||||
return start;
|
||||
|
|
@ -1022,15 +1022,15 @@ DefineConsoleFunction( strrchrpos, S32, ( const char* str, const char* chr, S32
|
|||
//----------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction(ColorFloatToInt, ColorI, (ColorF color), ,
|
||||
"Convert from a float color to an integer color (0.0 - 1.0 to 0 to 255).\n"
|
||||
"@param color Float color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n"
|
||||
"@return Converted color value (0 - 255)\n\n"
|
||||
"@tsexample\n"
|
||||
"ColorFloatToInt( \"0 0 1 0.5\" ) // Returns \"0 0 255 128\".\n"
|
||||
"@endtsexample\n"
|
||||
"@ingroup Strings")
|
||||
"Convert from a float color to an integer color (0.0 - 1.0 to 0 to 255).\n"
|
||||
"@param color Float color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n"
|
||||
"@return Converted color value (0 - 255)\n\n"
|
||||
"@tsexample\n"
|
||||
"ColorFloatToInt( \"0 0 1 0.5\" ) // Returns \"0 0 255 128\".\n"
|
||||
"@endtsexample\n"
|
||||
"@ingroup Strings")
|
||||
{
|
||||
return (ColorI)color;
|
||||
return (ColorI)color;
|
||||
}
|
||||
|
||||
DefineConsoleFunction(ColorIntToFloat, ColorF, (ColorI color), ,
|
||||
|
|
@ -1201,8 +1201,8 @@ DefineConsoleFunction( isValidIP, bool, ( const char* str),,
|
|||
ConsoleFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]"
|
||||
"Adds case sensitive strings to the StringTable.")
|
||||
{
|
||||
for(int i = 1; i < argc; i++)
|
||||
StringTable->insert(argv[i], true);
|
||||
for(int i = 1; i < argc; i++)
|
||||
StringTable->insert(argv[i], true);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
@ -1645,7 +1645,7 @@ DefineConsoleFunction( nextToken, const char*, ( const char* str1, const char* t
|
|||
"@endtsexample\n\n"
|
||||
"@ingroup Strings" )
|
||||
{
|
||||
char buffer[4096];
|
||||
char buffer[4096];
|
||||
dStrncpy(buffer, str1, 4096);
|
||||
char *str = buffer;
|
||||
|
||||
|
|
@ -1812,7 +1812,7 @@ DefineEngineFunction( detag, const char*, ( const char* str ),,
|
|||
"{\n"
|
||||
" onChatMessage(detag(%msgString), %voice, %pitch);\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@see \\ref syntaxDataTypes under Tagged %Strings\n"
|
||||
"@see getTag()\n"
|
||||
|
|
@ -2017,8 +2017,8 @@ DefineConsoleFunction( collapseEscape, const char*, ( const char* text ),,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction( setLogMode, void, ( S32 mode ),,
|
||||
"@brief Determines how log files are written.\n\n"
|
||||
"Sets the operational mode of the console logging system.\n\n"
|
||||
"@brief Determines how log files are written.\n\n"
|
||||
"Sets the operational mode of the console logging system.\n\n"
|
||||
"@param mode Parameter specifying the logging mode. This can be:\n"
|
||||
"- 1: Open and close the console log file for each seperate string of output. This will ensure that all "
|
||||
"parts get written out to disk and that no parts remain in intermediate buffers even if the process crashes.\n"
|
||||
|
|
@ -2030,8 +2030,8 @@ DefineEngineFunction( setLogMode, void, ( S32 mode ),,
|
|||
"combined by binary OR with 0x4 to cause the logging system to flush all console log messages that had already been "
|
||||
"issued to the console system into the newly created log file.\n\n"
|
||||
|
||||
"@note Xbox 360 does not support logging to a file. Use Platform::OutputDebugStr in C++ instead."
|
||||
"@ingroup Logging" )
|
||||
"@note Xbox 360 does not support logging to a file. Use Platform::OutputDebugStr in C++ instead."
|
||||
"@ingroup Logging" )
|
||||
{
|
||||
Con::setLogMode( mode );
|
||||
}
|
||||
|
|
@ -2144,7 +2144,7 @@ DefineEngineFunction( gotoWebPage, void, ( const char* address ),,
|
|||
DefineEngineFunction( displaySplashWindow, bool, (const char* path), ("art/gui/splash.bmp"),
|
||||
"Display a startup splash window suitable for showing while the engine still starts up.\n\n"
|
||||
"@note This is currently only implemented on Windows.\n\n"
|
||||
"@param path relative path to splash screen image to display.\n"
|
||||
"@param path relative path to splash screen image to display.\n"
|
||||
"@return True if the splash window could be successfully initialized.\n\n"
|
||||
"@ingroup Platform" )
|
||||
{
|
||||
|
|
@ -2390,19 +2390,19 @@ DefineConsoleFunction( setVariable, void, ( const char* varName, const char* val
|
|||
}
|
||||
|
||||
DefineConsoleFunction( isFunction, bool, ( const char* funcName ), , "(string funcName)"
|
||||
"@brief Determines if a function exists or not\n\n"
|
||||
"@param funcName String containing name of the function\n"
|
||||
"@return True if the function exists, false if not\n"
|
||||
"@ingroup Scripting")
|
||||
"@brief Determines if a function exists or not\n\n"
|
||||
"@param funcName String containing name of the function\n"
|
||||
"@return True if the function exists, false if not\n"
|
||||
"@ingroup Scripting")
|
||||
{
|
||||
return Con::isFunction(funcName);
|
||||
}
|
||||
|
||||
DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName ), , "(string funcName)"
|
||||
"@brief Provides the name of the package the function belongs to\n\n"
|
||||
"@param funcName String containing name of the function\n"
|
||||
"@return The name of the function's package\n"
|
||||
"@ingroup Packages")
|
||||
"@brief Provides the name of the package the function belongs to\n\n"
|
||||
"@param funcName String containing name of the function\n"
|
||||
"@return The name of the function's package\n"
|
||||
"@ingroup Packages")
|
||||
{
|
||||
Namespace::Entry* nse = Namespace::global()->lookup( StringTable->insert( funcName ) );
|
||||
if( !nse )
|
||||
|
|
@ -2412,11 +2412,11 @@ DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName )
|
|||
}
|
||||
|
||||
DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* method ), , "(string namespace, string method)"
|
||||
"@brief Determines if a class/namespace method exists\n\n"
|
||||
"@param namespace Class or namespace, such as Player\n"
|
||||
"@param method Name of the function to search for\n"
|
||||
"@return True if the method exists, false if not\n"
|
||||
"@ingroup Scripting\n")
|
||||
"@brief Determines if a class/namespace method exists\n\n"
|
||||
"@param namespace Class or namespace, such as Player\n"
|
||||
"@param method Name of the function to search for\n"
|
||||
"@return True if the method exists, false if not\n"
|
||||
"@ingroup Scripting\n")
|
||||
{
|
||||
Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) );
|
||||
Namespace::Entry* nse = ns->lookup( StringTable->insert( method ) );
|
||||
|
|
@ -2427,11 +2427,11 @@ DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* meth
|
|||
}
|
||||
|
||||
DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, const char* method ), , "(string namespace, string method)"
|
||||
"@brief Provides the name of the package the method belongs to\n\n"
|
||||
"@param namespace Class or namespace, such as Player\n"
|
||||
"@param method Name of the funciton to search for\n"
|
||||
"@return The name of the method's package\n"
|
||||
"@ingroup Packages")
|
||||
"@brief Provides the name of the package the method belongs to\n\n"
|
||||
"@param namespace Class or namespace, such as Player\n"
|
||||
"@param method Name of the funciton to search for\n"
|
||||
"@return The name of the method's package\n"
|
||||
"@ingroup Packages")
|
||||
{
|
||||
Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) );
|
||||
if( !ns )
|
||||
|
|
@ -2445,13 +2445,13 @@ DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, c
|
|||
}
|
||||
|
||||
DefineConsoleFunction( isDefined, bool, ( const char* varName, const char* varValue ), ("") , "(string varName)"
|
||||
"@brief Determines if a variable exists and contains a value\n"
|
||||
"@param varName Name of the variable to search for\n"
|
||||
"@return True if the variable was defined in script, false if not\n"
|
||||
"@brief Determines if a variable exists and contains a value\n"
|
||||
"@param varName Name of the variable to search for\n"
|
||||
"@return True if the variable was defined in script, false if not\n"
|
||||
"@tsexample\n"
|
||||
"isDefined( \"$myVar\" );\n"
|
||||
"@endtsexample\n\n"
|
||||
"@ingroup Scripting")
|
||||
"@ingroup Scripting")
|
||||
{
|
||||
if(String::isEmpty(varName))
|
||||
{
|
||||
|
|
@ -2590,10 +2590,10 @@ DefineConsoleFunction( isCurrentScriptToolScript, bool, (), , "()"
|
|||
}
|
||||
|
||||
DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), , "(string path)"
|
||||
"@brief Attempts to extract a mod directory from path. Returns empty string on failure.\n\n"
|
||||
"@param File path of mod folder\n"
|
||||
"@note This is no longer relevant in Torque 3D (which does not use mod folders), should be deprecated\n"
|
||||
"@internal")
|
||||
"@brief Attempts to extract a mod directory from path. Returns empty string on failure.\n\n"
|
||||
"@param File path of mod folder\n"
|
||||
"@note This is no longer relevant in Torque 3D (which does not use mod folders), should be deprecated\n"
|
||||
"@internal")
|
||||
{
|
||||
StringTableEntry modPath = Con::getModNameFromPath(path);
|
||||
return modPath ? modPath : "";
|
||||
|
|
@ -2602,11 +2602,11 @@ DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), ,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group])"
|
||||
"@brief Pushes the current $instantGroup on a stack "
|
||||
"and sets it to the given value (or clears it).\n\n"
|
||||
"@note Currently only used for editors\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
"@brief Pushes the current $instantGroup on a stack "
|
||||
"and sets it to the given value (or clears it).\n\n"
|
||||
"@note Currently only used for editors\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
{
|
||||
if( group.size() > 0 )
|
||||
Con::pushInstantGroup( group );
|
||||
|
|
@ -2615,10 +2615,10 @@ DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group]
|
|||
}
|
||||
|
||||
DefineConsoleFunction( popInstantGroup, void, (), , "()"
|
||||
"@brief Pop and restore the last setting of $instantGroup off the stack.\n\n"
|
||||
"@note Currently only used for editors\n\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
"@brief Pop and restore the last setting of $instantGroup off the stack.\n\n"
|
||||
"@note Currently only used for editors\n\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
{
|
||||
Con::popInstantGroup();
|
||||
}
|
||||
|
|
@ -2626,8 +2626,8 @@ DefineConsoleFunction( popInstantGroup, void, (), , "()"
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileName ), (""), "([relativeFileName])"
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@internal")
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@internal")
|
||||
{
|
||||
const char *filename = Platform::getPrefsPath(relativeFileName);
|
||||
if(filename == NULL || *filename == 0)
|
||||
|
|
@ -2639,13 +2639,13 @@ DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileNam
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( execPrefs, bool, 2, 4, "( string relativeFileName, bool noCalls=false, bool journalScript=false )"
|
||||
"@brief Manually execute a special script file that contains game or editor preferences\n\n"
|
||||
"@param relativeFileName Name and path to file from project folder\n"
|
||||
"@param noCalls Deprecated\n"
|
||||
"@param journalScript Deprecated\n"
|
||||
"@return True if script was successfully executed\n"
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@ingroup Scripting")
|
||||
"@brief Manually execute a special script file that contains game or editor preferences\n\n"
|
||||
"@param relativeFileName Name and path to file from project folder\n"
|
||||
"@param noCalls Deprecated\n"
|
||||
"@param journalScript Deprecated\n"
|
||||
"@return True if script was successfully executed\n"
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@ingroup Scripting")
|
||||
{
|
||||
const char *filename = Platform::getPrefsPath(argv[1]);
|
||||
if(filename == NULL || *filename == 0)
|
||||
|
|
@ -2786,8 +2786,8 @@ DefineEngineFunction( isToolBuild, bool, (),,
|
|||
}
|
||||
|
||||
DefineEngineFunction( getMaxDynamicVerts, S32, (),,
|
||||
"Get max number of allowable dynamic vertices in a single vertex buffer.\n\n"
|
||||
"@return the max number of allowable dynamic vertices in a single vertex buffer" )
|
||||
"Get max number of allowable dynamic vertices in a single vertex buffer.\n\n"
|
||||
"@return the max number of allowable dynamic vertices in a single vertex buffer" )
|
||||
{
|
||||
return MAX_DYNAMIC_VERTS / 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -510,7 +510,7 @@ void ConsoleValue::setStringValue(const char * value)
|
|||
return;
|
||||
}
|
||||
*/
|
||||
if (value == typeValueEmpty)
|
||||
if (value == typeValueEmpty)
|
||||
{
|
||||
if (bufferLen > 0)
|
||||
{
|
||||
|
|
@ -544,7 +544,7 @@ void ConsoleValue::setStringValue(const char * value)
|
|||
|
||||
// may as well pad to the next cache line
|
||||
U32 newLen = ((stringLen + 1) + 15) & ~15;
|
||||
|
||||
|
||||
if(bufferLen == 0)
|
||||
sval = (char *) dMalloc(newLen);
|
||||
else if(newLen > bufferLen)
|
||||
|
|
@ -573,7 +573,7 @@ void ConsoleValue::setStackStringValue(const char *value)
|
|||
bufferLen = 0;
|
||||
}
|
||||
|
||||
if (value == typeValueEmpty)
|
||||
if (value == typeValueEmpty)
|
||||
{
|
||||
sval = typeValueEmpty;
|
||||
fval = 0.f;
|
||||
|
|
@ -607,7 +607,7 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue)
|
|||
if(type <= ConsoleValue::TypeInternalString)
|
||||
{
|
||||
const char *value = StringStackPtrRef(ptrValue).getPtr(&STR);
|
||||
if (bufferLen > 0)
|
||||
if (bufferLen > 0)
|
||||
{
|
||||
dFree(sval);
|
||||
bufferLen = 0;
|
||||
|
|
@ -1418,14 +1418,14 @@ ConsoleValueRef Namespace::Entry::execute(S32 argc, ConsoleValueRef *argv, ExprE
|
|||
case StringCallbackType:
|
||||
return ConsoleValueRef::fromValue(CSTK.pushStackString(cb.mStringCallbackFunc(state->thisObject, argc, argv)));
|
||||
case IntCallbackType:
|
||||
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
case FloatCallbackType:
|
||||
return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
case VoidCallbackType:
|
||||
cb.mVoidCallbackFunc(state->thisObject, argc, argv);
|
||||
return ConsoleValueRef();
|
||||
case BoolCallbackType:
|
||||
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv)));
|
||||
}
|
||||
|
||||
return ConsoleValueRef();
|
||||
|
|
|
|||
|
|
@ -226,20 +226,20 @@ void ConsoleLogger::log( const char *consoleLine )
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger to the console and begins writing to file"
|
||||
"@tsexample\n"
|
||||
"// Create the logger\n"
|
||||
"// Will automatically start writing to testLogging.txt with normal priority\n"
|
||||
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
|
||||
"// Send something to the console, with the logger consumes and writes to file\n"
|
||||
"echo(\"This is logged to the file\");\n\n"
|
||||
"// Stop logging, but do not delete the logger\n"
|
||||
"logger.detach();\n\n"
|
||||
"echo(\"This is not logged to the file\");\n\n"
|
||||
"// Attach the logger to the console again\n"
|
||||
"logger.attach();\n\n"
|
||||
"// Logging has resumed\n"
|
||||
"echo(\"Logging has resumed\");"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"// Create the logger\n"
|
||||
"// Will automatically start writing to testLogging.txt with normal priority\n"
|
||||
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
|
||||
"// Send something to the console, with the logger consumes and writes to file\n"
|
||||
"echo(\"This is logged to the file\");\n\n"
|
||||
"// Stop logging, but do not delete the logger\n"
|
||||
"logger.detach();\n\n"
|
||||
"echo(\"This is not logged to the file\");\n\n"
|
||||
"// Attach the logger to the console again\n"
|
||||
"logger.attach();\n\n"
|
||||
"// Logging has resumed\n"
|
||||
"echo(\"Logging has resumed\");"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
ConsoleLogger *logger = static_cast<ConsoleLogger *>( object );
|
||||
return logger->attach();
|
||||
|
|
@ -248,20 +248,20 @@ DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( ConsoleLogger, detach, bool, (), , "() Detaches the logger from the console and stops writing to file"
|
||||
"@tsexample\n"
|
||||
"// Create the logger\n"
|
||||
"// Will automatically start writing to testLogging.txt with normal priority\n"
|
||||
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
|
||||
"// Send something to the console, with the logger consumes and writes to file\n"
|
||||
"echo(\"This is logged to the file\");\n\n"
|
||||
"// Stop logging, but do not delete the logger\n"
|
||||
"logger.detach();\n\n"
|
||||
"echo(\"This is not logged to the file\");\n\n"
|
||||
"// Attach the logger to the console again\n"
|
||||
"logger.attach();\n\n"
|
||||
"// Logging has resumed\n"
|
||||
"echo(\"Logging has resumed\");"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"// Create the logger\n"
|
||||
"// Will automatically start writing to testLogging.txt with normal priority\n"
|
||||
"new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n"
|
||||
"// Send something to the console, with the logger consumes and writes to file\n"
|
||||
"echo(\"This is logged to the file\");\n\n"
|
||||
"// Stop logging, but do not delete the logger\n"
|
||||
"logger.detach();\n\n"
|
||||
"echo(\"This is not logged to the file\");\n\n"
|
||||
"// Attach the logger to the console again\n"
|
||||
"logger.attach();\n\n"
|
||||
"// Logging has resumed\n"
|
||||
"echo(\"Logging has resumed\");"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
ConsoleLogger *logger = static_cast<ConsoleLogger *>( object );
|
||||
return logger->detach();
|
||||
|
|
|
|||
|
|
@ -334,15 +334,15 @@ AbstractClassRep *AbstractClassRep::getCommonParent( const AbstractClassRep *oth
|
|||
static char replacebuf[1024];
|
||||
static char* suppressSpaces(const char* in_pname)
|
||||
{
|
||||
U32 i = 0;
|
||||
char chr;
|
||||
do
|
||||
{
|
||||
chr = in_pname[i];
|
||||
replacebuf[i++] = (chr != 32) ? chr : '_';
|
||||
} while(chr);
|
||||
U32 i = 0;
|
||||
char chr;
|
||||
do
|
||||
{
|
||||
chr = in_pname[i];
|
||||
replacebuf[i++] = (chr != 32) ? chr : '_';
|
||||
} while(chr);
|
||||
|
||||
return replacebuf;
|
||||
return replacebuf;
|
||||
}
|
||||
|
||||
void ConsoleObject::addGroup(const char* in_pGroupname, const char* in_pGroupDocs)
|
||||
|
|
@ -740,8 +740,8 @@ static const char* returnClassList( Vector< AbstractClassRep* >& classes, U32 bu
|
|||
//------------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction( isClass, bool, ( const char* identifier ),,
|
||||
"@brief Returns true if the passed identifier is the name of a declared class.\n\n"
|
||||
"@ingroup Console")
|
||||
"@brief Returns true if the passed identifier is the name of a declared class.\n\n"
|
||||
"@ingroup Console")
|
||||
{
|
||||
AbstractClassRep* rep = AbstractClassRep::findClassRep( identifier );
|
||||
return rep != NULL;
|
||||
|
|
@ -765,10 +765,10 @@ DefineEngineFunction( isMemberOfClass, bool, ( const char* className, const char
|
|||
}
|
||||
|
||||
DefineEngineFunction( getDescriptionOfClass, const char*, ( const char* className ),,
|
||||
"@brief Returns the description string for the named class.\n\n"
|
||||
"@param className The name of the class.\n"
|
||||
"@return The class description in string format.\n"
|
||||
"@ingroup Console")
|
||||
"@brief Returns the description string for the named class.\n\n"
|
||||
"@param className The name of the class.\n"
|
||||
"@return The class description in string format.\n"
|
||||
"@ingroup Console")
|
||||
{
|
||||
AbstractClassRep* rep = AbstractClassRep::findClassRep( className );
|
||||
if( rep )
|
||||
|
|
@ -779,9 +779,9 @@ DefineEngineFunction( getDescriptionOfClass, const char*, ( const char* classNam
|
|||
}
|
||||
|
||||
DefineEngineFunction( getCategoryOfClass, const char*, ( const char* className ),,
|
||||
"@brief Returns the category of the given class.\n\n"
|
||||
"@param className The name of the class.\n"
|
||||
"@ingroup Console")
|
||||
"@brief Returns the category of the given class.\n\n"
|
||||
"@param className The name of the class.\n"
|
||||
"@ingroup Console")
|
||||
{
|
||||
AbstractClassRep* rep = AbstractClassRep::findClassRep( className );
|
||||
if( rep )
|
||||
|
|
@ -792,12 +792,12 @@ DefineEngineFunction( getCategoryOfClass, const char*, ( const char* className
|
|||
}
|
||||
|
||||
DefineEngineFunction( enumerateConsoleClasses, const char*, ( const char* className ), ( "" ),
|
||||
"@brief Returns a list of classes that derive from the named class.\n\n"
|
||||
"@brief Returns a list of classes that derive from the named class.\n\n"
|
||||
"If the named class is omitted this dumps all the classes.\n"
|
||||
"@param className The optional base class name.\n"
|
||||
"@return A tab delimited list of classes.\n"
|
||||
"@return A tab delimited list of classes.\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
"@internal")
|
||||
{
|
||||
AbstractClassRep *base = NULL;
|
||||
if(className && *className)
|
||||
|
|
@ -822,11 +822,11 @@ DefineEngineFunction( enumerateConsoleClasses, const char*, ( const char* classN
|
|||
}
|
||||
|
||||
DefineEngineFunction( enumerateConsoleClassesByCategory, const char*, ( String category ),,
|
||||
"@brief Provide a list of classes that belong to the given category.\n\n"
|
||||
"@param category The category name.\n"
|
||||
"@return A tab delimited list of classes.\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
"@brief Provide a list of classes that belong to the given category.\n\n"
|
||||
"@param category The category name.\n"
|
||||
"@return A tab delimited list of classes.\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
{
|
||||
U32 categoryLength = category.length();
|
||||
|
||||
|
|
@ -914,10 +914,10 @@ DefineEngineFunction( dumpNetStats, void, (),,
|
|||
}
|
||||
|
||||
DefineEngineFunction( sizeof, S32, ( const char *objectOrClass ),,
|
||||
"@brief Determines the memory consumption of a class or object.\n\n"
|
||||
"@param objectOrClass The object or class being measured.\n"
|
||||
"@return Returns the total size of an object in bytes.\n"
|
||||
"@ingroup Debugging\n")
|
||||
"@brief Determines the memory consumption of a class or object.\n\n"
|
||||
"@param objectOrClass The object or class being measured.\n"
|
||||
"@return Returns the total size of an object in bytes.\n"
|
||||
"@ingroup Debugging\n")
|
||||
{
|
||||
AbstractClassRep *acr = NULL;
|
||||
SimObject *obj = Sim::findObject(objectOrClass);
|
||||
|
|
|
|||
|
|
@ -35,21 +35,21 @@ static ConsoleParser *gDefaultParser = NULL;
|
|||
|
||||
void freeConsoleParserList(void)
|
||||
{
|
||||
while(gParserList)
|
||||
{
|
||||
while(gParserList)
|
||||
{
|
||||
ConsoleParser * pParser = gParserList;
|
||||
gParserList = pParser->next;
|
||||
delete pParser;
|
||||
}
|
||||
gParserList = pParser->next;
|
||||
delete pParser;
|
||||
}
|
||||
|
||||
gDefaultParser = NULL;
|
||||
gDefaultParser = NULL;
|
||||
}
|
||||
|
||||
bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnParse p, fnRestart r, fnSetScanBuffer ssb, bool def)
|
||||
{
|
||||
AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments");
|
||||
AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments");
|
||||
|
||||
ConsoleParser * pParser = new ConsoleParser;
|
||||
ConsoleParser * pParser = new ConsoleParser;
|
||||
|
||||
pParser->ext = ext;
|
||||
pParser->getCurrentFile = gcf;
|
||||
|
|
@ -69,23 +69,23 @@ bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnP
|
|||
|
||||
ConsoleParser * getParserForFile(const char *filename)
|
||||
{
|
||||
if(filename == NULL)
|
||||
return gDefaultParser;
|
||||
if(filename == NULL)
|
||||
return gDefaultParser;
|
||||
|
||||
char *ptr = dStrrchr((char *)filename, '.');
|
||||
if(ptr != NULL)
|
||||
{
|
||||
ptr++;
|
||||
char *ptr = dStrrchr((char *)filename, '.');
|
||||
if(ptr != NULL)
|
||||
{
|
||||
ptr++;
|
||||
|
||||
ConsoleParser *p;
|
||||
for(p = gParserList; p; p = p->next)
|
||||
{
|
||||
if(dStricmp(ptr, p->ext) == 0)
|
||||
return p;
|
||||
}
|
||||
}
|
||||
ConsoleParser *p;
|
||||
for(p = gParserList; p; p = p->next)
|
||||
{
|
||||
if(dStricmp(ptr, p->ext) == 0)
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
return gDefaultParser;
|
||||
return gDefaultParser;
|
||||
}
|
||||
|
||||
} // end namespace Con
|
||||
|
|
|
|||
|
|
@ -57,15 +57,15 @@ typedef void (*fnSetScanBuffer)(const char *sb, const char *fn);
|
|||
//-----------------------------------------------------------------------------
|
||||
struct ConsoleParser
|
||||
{
|
||||
struct ConsoleParser *next; //!< Next object in list or NULL
|
||||
struct ConsoleParser *next; //!< Next object in list or NULL
|
||||
|
||||
char *ext; //!< Filename extension handled by this parser
|
||||
|
||||
fnGetCurrentFile getCurrentFile; //!< GetCurrentFile lexer function
|
||||
fnGetCurrentLine getCurrentLine; //!< GetCurrentLine lexer function
|
||||
fnParse parse; //!< Parse lexer function
|
||||
fnRestart restart; //!< Restart lexer function
|
||||
fnSetScanBuffer setScanBuffer; //!< SetScanBuffer lexer function
|
||||
char *ext; //!< Filename extension handled by this parser
|
||||
|
||||
fnGetCurrentFile getCurrentFile; //!< GetCurrentFile lexer function
|
||||
fnGetCurrentLine getCurrentLine; //!< GetCurrentLine lexer function
|
||||
fnParse parse; //!< Parse lexer function
|
||||
fnRestart restart; //!< Restart lexer function
|
||||
fnSetScanBuffer setScanBuffer; //!< SetScanBuffer lexer function
|
||||
};
|
||||
|
||||
// Macros
|
||||
|
|
@ -74,18 +74,18 @@ struct ConsoleParser
|
|||
/// \brief Declare a parser's function prototypes
|
||||
//-----------------------------------------------------------------------------
|
||||
#define CON_DECLARE_PARSER(prefix) \
|
||||
const char * prefix##GetCurrentFile(); \
|
||||
S32 prefix##GetCurrentLine(); \
|
||||
void prefix##SetScanBuffer(const char *sb, const char *fn); \
|
||||
S32 prefix##parse(); \
|
||||
void prefix##restart(FILE *input_file)
|
||||
const char * prefix##GetCurrentFile(); \
|
||||
S32 prefix##GetCurrentLine(); \
|
||||
void prefix##SetScanBuffer(const char *sb, const char *fn); \
|
||||
S32 prefix##parse(); \
|
||||
void prefix##restart(FILE *input_file)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \brief Helper macro to add console parsers
|
||||
//-----------------------------------------------------------------------------
|
||||
#define CON_ADD_PARSER(prefix, ext, def) \
|
||||
Compiler::addConsoleParser(ext, prefix##GetCurrentFile, prefix##GetCurrentLine, prefix##parse, \
|
||||
prefix##restart, prefix##SetScanBuffer, def)
|
||||
Compiler::addConsoleParser(ext, prefix##GetCurrentFile, prefix##GetCurrentLine, prefix##parse, \
|
||||
prefix##restart, prefix##SetScanBuffer, def)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \brief Free the console parser list
|
||||
|
|
|
|||
|
|
@ -339,14 +339,14 @@ struct EngineUnmarshallData< ConsoleValueRef >
|
|||
|
||||
|
||||
template<typename T> struct _EngineTrampoline {
|
||||
struct Args {};
|
||||
struct Args {};
|
||||
};
|
||||
|
||||
template< typename R, typename ...ArgTs >
|
||||
struct _EngineTrampoline< R( ArgTs ... ) >
|
||||
{
|
||||
typedef std::tuple<ArgTs ...> Args;
|
||||
std::tuple<ArgTs ...> argT;
|
||||
typedef std::tuple<ArgTs ...> Args;
|
||||
std::tuple<ArgTs ...> argT;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
|
|
@ -363,21 +363,21 @@ template< typename R, typename ...ArgTs >
|
|||
struct _EngineFunctionTrampoline< R(ArgTs...) > : public _EngineFunctionTrampolineBase< R(ArgTs...) >
|
||||
{
|
||||
private:
|
||||
using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >;
|
||||
using ArgsType = typename Super::Args;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq<I...>) {
|
||||
return R( fn(std::get<I>(args) ...) );
|
||||
}
|
||||
using Super = _EngineFunctionTrampolineBase< R(ArgTs...) >;
|
||||
using ArgsType = typename Super::Args;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(typename Super::FunctionType fn, const ArgsType& args, Seq<I...>) {
|
||||
return R( fn(std::get<I>(args) ...) );
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
public:
|
||||
static R jmp(typename Super::FunctionType fn, const ArgsType& args )
|
||||
static R jmp(typename Super::FunctionType fn, const ArgsType& args )
|
||||
{
|
||||
return dispatchHelper(fn, args, SeqType());
|
||||
}
|
||||
|
|
@ -394,25 +394,25 @@ struct _EngineMethodTrampoline {};
|
|||
template< typename Frame, typename R, typename ...ArgTs >
|
||||
struct _EngineMethodTrampoline< Frame, R(ArgTs ...) > : public _EngineMethodTrampolineBase< R(ArgTs ...) >
|
||||
{
|
||||
using FunctionType = R( typename Frame::ObjectType*, ArgTs ...);
|
||||
using FunctionType = R( typename Frame::ObjectType*, ArgTs ...);
|
||||
private:
|
||||
using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >;
|
||||
using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(Frame f, const ArgsType& args, Seq<I...>) {
|
||||
return R( f._exec(std::get<I>(args) ...) );
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
using Super = _EngineMethodTrampolineBase< R(ArgTs ...) >;
|
||||
using ArgsType = typename _EngineFunctionTrampolineBase< R(ArgTs ...) >::Args;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(Frame f, const ArgsType& args, Seq<I...>) {
|
||||
return R( f._exec(std::get<I>(args) ...) );
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
public:
|
||||
static R jmp( typename Frame::ObjectType* object, const ArgsType& args )
|
||||
{
|
||||
|
||||
|
||||
Frame f;
|
||||
f.object = object;
|
||||
return dispatchHelper(f, args, SeqType());
|
||||
|
|
@ -515,13 +515,13 @@ struct _EngineConsoleThunkType< void >
|
|||
struct _EngineConsoleThunkCountArgs
|
||||
{
|
||||
|
||||
template<typename ...ArgTs> U32 operator()(ArgTs... args){
|
||||
return sizeof...(ArgTs);
|
||||
}
|
||||
|
||||
operator U32() const{ // FIXME: WHAT IS THIS?? I'm pretty sure it's incorrect, and it's the version that is invoked by all the macros
|
||||
return 0;
|
||||
}
|
||||
template<typename ...ArgTs> U32 operator()(ArgTs... args){
|
||||
return sizeof...(ArgTs);
|
||||
}
|
||||
|
||||
operator U32() const{ // FIXME: WHAT IS THIS?? I'm pretty sure it's incorrect, and it's the version that is invoked by all the macros
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -529,61 +529,61 @@ struct _EngineConsoleThunkCountArgs
|
|||
|
||||
// Encapsulation of a legacy console function invocation.
|
||||
namespace engineAPI{
|
||||
namespace detail{
|
||||
template<S32 startArgc, typename R, typename ...ArgTs>
|
||||
struct ThunkHelpers {
|
||||
using SelfType = ThunkHelpers<startArgc, R, ArgTs...>;
|
||||
using FunctionType = R(*)(ArgTs...);
|
||||
template<typename Frame> using MethodType = R(Frame::*)(ArgTs ...) const;
|
||||
template<size_t I> using IthArgType = typename std::tuple_element<I, std::tuple<ArgTs ...> >::type;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
|
||||
static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc;
|
||||
|
||||
template<size_t index, size_t method_offset = 0, typename ...RealArgTs>
|
||||
static IthArgType<index> getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs)
|
||||
{
|
||||
if((startArgc + index) < argc)
|
||||
{
|
||||
return EngineUnmarshallData< IthArgType<index> >()( argv[ startArgc + index ] );
|
||||
} else {
|
||||
return std::get<index + method_offset>(defaultArgs.mArgs);
|
||||
}
|
||||
}
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs, Seq<I...>){
|
||||
return fn(SelfType::getRealArgValue<I>(argc, argv, defaultArgs) ...);
|
||||
}
|
||||
|
||||
template<typename Frame, size_t ...I>
|
||||
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs, Seq<I...>){
|
||||
return (frame->*fn)(SelfType::getRealArgValue<I,1>(argc, argv, defaultArgs) ...);
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
};
|
||||
|
||||
template<typename ArgVT> struct MarshallHelpers {
|
||||
template<typename ...ArgTs> static void marshallEach(S32 &argc, ArgVT *argv, const ArgTs& ...args){}
|
||||
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ArgVT *argv, const H& head, const Tail& ...tail){
|
||||
argv[argc++] = EngineMarshallData(head);
|
||||
marshallEach(argc, argv, tail...);
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct MarshallHelpers<ConsoleValueRef> {
|
||||
template<typename ...ArgTs> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){}
|
||||
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const H& head, const Tail& ...tail){
|
||||
EngineMarshallData(head, argc, argv);
|
||||
marshallEach(argc, argv, tail...);
|
||||
}
|
||||
};
|
||||
}
|
||||
namespace detail{
|
||||
template<S32 startArgc, typename R, typename ...ArgTs>
|
||||
struct ThunkHelpers {
|
||||
using SelfType = ThunkHelpers<startArgc, R, ArgTs...>;
|
||||
using FunctionType = R(*)(ArgTs...);
|
||||
template<typename Frame> using MethodType = R(Frame::*)(ArgTs ...) const;
|
||||
template<size_t I> using IthArgType = typename std::tuple_element<I, std::tuple<ArgTs ...> >::type;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
|
||||
static constexpr S32 NUM_ARGS = sizeof...(ArgTs) + startArgc;
|
||||
|
||||
template<size_t index, size_t method_offset = 0, typename ...RealArgTs>
|
||||
static IthArgType<index> getRealArgValue(S32 argc, ConsoleValueRef *argv, const _EngineFunctionDefaultArguments< void(RealArgTs...) >& defaultArgs)
|
||||
{
|
||||
if((startArgc + index) < argc)
|
||||
{
|
||||
return EngineUnmarshallData< IthArgType<index> >()( argv[ startArgc + index ] );
|
||||
} else {
|
||||
return std::get<index + method_offset>(defaultArgs.mArgs);
|
||||
}
|
||||
}
|
||||
|
||||
template<size_t ...I>
|
||||
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs, Seq<I...>){
|
||||
return fn(SelfType::getRealArgValue<I>(argc, argv, defaultArgs) ...);
|
||||
}
|
||||
|
||||
template<typename Frame, size_t ...I>
|
||||
static R dispatchHelper(S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs, Seq<I...>){
|
||||
return (frame->*fn)(SelfType::getRealArgValue<I,1>(argc, argv, defaultArgs) ...);
|
||||
}
|
||||
|
||||
using SeqType = typename Gens<sizeof...(ArgTs)>::type;
|
||||
};
|
||||
|
||||
template<typename ArgVT> struct MarshallHelpers {
|
||||
template<typename ...ArgTs> static void marshallEach(S32 &argc, ArgVT *argv, const ArgTs& ...args){}
|
||||
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ArgVT *argv, const H& head, const Tail& ...tail){
|
||||
argv[argc++] = EngineMarshallData(head);
|
||||
marshallEach(argc, argv, tail...);
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct MarshallHelpers<ConsoleValueRef> {
|
||||
template<typename ...ArgTs> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const ArgTs& ...args){}
|
||||
template<typename H, typename ...Tail> static void marshallEach(S32 &argc, ConsoleValueRef *argv, const H& head, const Tail& ...tail){
|
||||
EngineMarshallData(head, argc, argv);
|
||||
marshallEach(argc, argv, tail...);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
template< S32 startArgc, typename T >
|
||||
|
|
@ -593,22 +593,22 @@ template< S32 startArgc, typename R, typename ...ArgTs >
|
|||
struct _EngineConsoleThunk< startArgc, R(ArgTs...) >
|
||||
{
|
||||
private:
|
||||
using Helper = engineAPI::detail::ThunkHelpers<startArgc, R, ArgTs...>;
|
||||
using SeqType = typename Helper::SeqType;
|
||||
using Helper = engineAPI::detail::ThunkHelpers<startArgc, R, ArgTs...>;
|
||||
using SeqType = typename Helper::SeqType;
|
||||
public:
|
||||
typedef typename Helper::FunctionType FunctionType;
|
||||
typedef typename Helper::ReturnType ReturnType;
|
||||
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
||||
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
||||
|
||||
typedef typename Helper::FunctionType FunctionType;
|
||||
typedef typename Helper::ReturnType ReturnType;
|
||||
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
||||
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
||||
|
||||
static ReturnType thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs)
|
||||
{
|
||||
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType()));
|
||||
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType()));
|
||||
}
|
||||
template< typename Frame >
|
||||
static ReturnType thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
||||
static ReturnType thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
||||
{
|
||||
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType()));
|
||||
return _EngineConsoleThunkReturnValue( Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType()));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -616,23 +616,23 @@ public:
|
|||
template<S32 startArgc, typename ...ArgTs>
|
||||
struct _EngineConsoleThunk<startArgc, void(ArgTs...)> {
|
||||
private:
|
||||
using Helper = engineAPI::detail::ThunkHelpers<startArgc, void, ArgTs...>;
|
||||
using SeqType = typename Helper::SeqType;
|
||||
using Helper = engineAPI::detail::ThunkHelpers<startArgc, void, ArgTs...>;
|
||||
using SeqType = typename Helper::SeqType;
|
||||
public:
|
||||
typedef typename Helper::FunctionType FunctionType;
|
||||
typedef typename Helper::ReturnType ReturnType;
|
||||
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
||||
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
||||
|
||||
static void thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs)
|
||||
{
|
||||
Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType());
|
||||
}
|
||||
template< typename Frame >
|
||||
static void thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
||||
{
|
||||
Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType());
|
||||
}
|
||||
typedef typename Helper::FunctionType FunctionType;
|
||||
typedef typename Helper::ReturnType ReturnType;
|
||||
template<typename Frame> using MethodType = typename Helper::template MethodType<Frame>;
|
||||
static constexpr S32 NUM_ARGS = Helper::NUM_ARGS;
|
||||
|
||||
static void thunk( S32 argc, ConsoleValueRef *argv, FunctionType fn, const _EngineFunctionDefaultArguments< void(ArgTs...) >& defaultArgs)
|
||||
{
|
||||
Helper::dispatchHelper(argc, argv, fn, defaultArgs, SeqType());
|
||||
}
|
||||
template< typename Frame >
|
||||
static void thunk( S32 argc, ConsoleValueRef *argv, MethodType<Frame> fn, Frame* frame, const _EngineFunctionDefaultArguments< void( typename Frame::ObjectType*, ArgTs...) >& defaultArgs)
|
||||
{
|
||||
Helper::dispatchHelper(argc, argv, fn, frame, defaultArgs, SeqType());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1182,7 +1182,7 @@ public:
|
|||
struct _EngineConsoleCallbackHelper : public _BaseEngineConsoleCallbackHelper
|
||||
{
|
||||
private:
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
public:
|
||||
|
||||
_EngineConsoleCallbackHelper( StringTableEntry callbackName, SimObject* pThis )
|
||||
|
|
@ -1191,7 +1191,7 @@ public:
|
|||
mArgc = mInitialArgc = pThis ? 2 : 1 ;
|
||||
mCallbackName = callbackName;
|
||||
}
|
||||
|
||||
|
||||
template< typename R, typename ...ArgTs >
|
||||
R call(ArgTs ...args)
|
||||
{
|
||||
|
|
@ -1200,9 +1200,9 @@ public:
|
|||
ConsoleStackFrameSaver sav; sav.save();
|
||||
CSTK.reserveValues(mArgc + sizeof...(ArgTs), mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
return R( EngineUnmarshallData< R >()( _exec() ) );
|
||||
}
|
||||
else
|
||||
|
|
@ -1211,9 +1211,9 @@ public:
|
|||
SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc + sizeof...(ArgTs), NULL, false, &cb);
|
||||
evt->populateArgs(mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime());
|
||||
|
||||
return R( EngineUnmarshallData< R >()( cb.waitForResult() ) );
|
||||
|
|
@ -1227,7 +1227,7 @@ public:
|
|||
template<typename P1> struct _EngineConsoleExecCallbackHelper : public _BaseEngineConsoleCallbackHelper
|
||||
{
|
||||
private:
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
public:
|
||||
|
||||
_EngineConsoleExecCallbackHelper( SimObject* pThis )
|
||||
|
|
@ -1247,7 +1247,7 @@ public:
|
|||
CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(simCB);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
return R( EngineUnmarshallData< R >()( _exec() ) );
|
||||
}
|
||||
|
|
@ -1257,8 +1257,8 @@ public:
|
|||
SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+sizeof...(ArgTs), NULL, true, &cb);
|
||||
evt->populateArgs(mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(simCB);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
Sim::postEvent(mThis, evt, Sim::getCurrentTime());
|
||||
|
||||
|
|
@ -1271,7 +1271,7 @@ public:
|
|||
template<> struct _EngineConsoleExecCallbackHelper<const char*> : public _BaseEngineConsoleCallbackHelper
|
||||
{
|
||||
private:
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
using Helper = engineAPI::detail::MarshallHelpers<ConsoleValueRef>;
|
||||
public:
|
||||
_EngineConsoleExecCallbackHelper( const char *callbackName )
|
||||
{
|
||||
|
|
@ -1288,9 +1288,9 @@ public:
|
|||
ConsoleStackFrameSaver sav; sav.save();
|
||||
CSTK.reserveValues(mArgc+sizeof...(ArgTs), mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
return R( EngineUnmarshallData< R >()( _exec() ) );
|
||||
}
|
||||
else
|
||||
|
|
@ -1299,8 +1299,8 @@ public:
|
|||
SimConsoleThreadExecEvent *evt = new SimConsoleThreadExecEvent(mArgc+sizeof...(ArgTs), NULL, false, &cb);
|
||||
evt->populateArgs(mArgv);
|
||||
mArgv[ 0 ].value->setStackStringValue(mCallbackName);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
Helper::marshallEach(mArgc, mArgv, args...);
|
||||
|
||||
Sim::postEvent((SimObject*)Sim::getRootGroup(), evt, Sim::getCurrentTime());
|
||||
return R( EngineUnmarshallData< R >()( cb.waitForResult() ) );
|
||||
|
|
|
|||
|
|
@ -93,35 +93,35 @@ struct _EngineFunctionDefaultArguments {};
|
|||
template<typename ...ArgTs>
|
||||
struct _EngineFunctionDefaultArguments< void(ArgTs...) > : public EngineFunctionDefaultArguments
|
||||
{
|
||||
template<typename T> using DefVST = typename EngineTypeTraits<T>::DefaultArgumentValueStoreType;
|
||||
std::tuple<DefVST<ArgTs> ...> mArgs;
|
||||
template<typename T> using DefVST = typename EngineTypeTraits<T>::DefaultArgumentValueStoreType;
|
||||
std::tuple<DefVST<ArgTs> ...> mArgs;
|
||||
private:
|
||||
using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<typename ...TailTs, size_t ...I>
|
||||
static void copyHelper(std::tuple<DefVST<ArgTs> ...> &args, std::tuple<DefVST<TailTs> ...> &defaultArgs, Seq<I...>) {
|
||||
constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs));
|
||||
std::tie(std::get<I + offset>(args)...) = defaultArgs;
|
||||
}
|
||||
|
||||
template<typename ...TailTs> using MaybeSelfEnabled = typename std::enable_if<sizeof...(TailTs) <= sizeof...(ArgTs), decltype(mArgs)>::type;
|
||||
|
||||
template<typename ...TailTs> static MaybeSelfEnabled<TailTs...> tailInit(TailTs ...tail) {
|
||||
std::tuple<DefVST<ArgTs>...> argsT;
|
||||
std::tuple<DefVST<TailTs>...> tailT = std::make_tuple(tail...);
|
||||
SelfType::copyHelper<TailTs...>(argsT, tailT, typename Gens<sizeof...(TailTs)>::type());
|
||||
return argsT;
|
||||
};
|
||||
|
||||
using SelfType = _EngineFunctionDefaultArguments< void(ArgTs...) >;
|
||||
|
||||
template<size_t ...> struct Seq {};
|
||||
template<size_t N, size_t ...S> struct Gens : Gens<N-1, N-1, S...> {};
|
||||
|
||||
template<size_t ...I> struct Gens<0, I...>{ typedef Seq<I...> type; };
|
||||
|
||||
template<typename ...TailTs, size_t ...I>
|
||||
static void copyHelper(std::tuple<DefVST<ArgTs> ...> &args, std::tuple<DefVST<TailTs> ...> &defaultArgs, Seq<I...>) {
|
||||
constexpr size_t offset = (sizeof...(ArgTs) - sizeof...(TailTs));
|
||||
std::tie(std::get<I + offset>(args)...) = defaultArgs;
|
||||
}
|
||||
|
||||
template<typename ...TailTs> using MaybeSelfEnabled = typename std::enable_if<sizeof...(TailTs) <= sizeof...(ArgTs), decltype(mArgs)>::type;
|
||||
|
||||
template<typename ...TailTs> static MaybeSelfEnabled<TailTs...> tailInit(TailTs ...tail) {
|
||||
std::tuple<DefVST<ArgTs>...> argsT;
|
||||
std::tuple<DefVST<TailTs>...> tailT = std::make_tuple(tail...);
|
||||
SelfType::copyHelper<TailTs...>(argsT, tailT, typename Gens<sizeof...(TailTs)>::type());
|
||||
return argsT;
|
||||
};
|
||||
|
||||
public:
|
||||
template<typename ...TailTs> _EngineFunctionDefaultArguments(TailTs ...tail)
|
||||
: EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...))
|
||||
{}
|
||||
template<typename ...TailTs> _EngineFunctionDefaultArguments(TailTs ...tail)
|
||||
: EngineFunctionDefaultArguments({sizeof...(TailTs)}), mArgs(SelfType::tailInit(tail...))
|
||||
{}
|
||||
};
|
||||
|
||||
#pragma pack( pop )
|
||||
|
|
|
|||
|
|
@ -109,15 +109,15 @@ void FieldBrushObject::destroyFields()
|
|||
static char replacebuf[1024];
|
||||
static char* suppressSpaces(const char* in_pname)
|
||||
{
|
||||
U32 i = 0;
|
||||
char chr;
|
||||
do
|
||||
{
|
||||
chr = in_pname[i];
|
||||
replacebuf[i++] = (chr != 32) ? chr : '_';
|
||||
} while(chr);
|
||||
U32 i = 0;
|
||||
char chr;
|
||||
do
|
||||
{
|
||||
chr = in_pname[i];
|
||||
replacebuf[i++] = (chr != 32) ? chr : '_';
|
||||
} while(chr);
|
||||
|
||||
return replacebuf;
|
||||
return replacebuf;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -125,7 +125,7 @@ static char* suppressSpaces(const char* in_pname)
|
|||
//-----------------------------------------------------------------------------
|
||||
DefineConsoleMethod(FieldBrushObject, queryGroups, const char*, (const char* simObjName), , "(simObject) Query available static-field groups for selected object./\n"
|
||||
"@param simObject Object to query static-field groups on.\n"
|
||||
"@return Space-seperated static-field group list.")
|
||||
"@return Space-seperated static-field group list.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
|
@ -194,7 +194,7 @@ DefineConsoleMethod(FieldBrushObject, queryGroups, const char*, (const char* sim
|
|||
DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* simObjName, const char* groupList), (""), "(simObject, [groupList]) Query available static-fields for selected object./\n"
|
||||
"@param simObject Object to query static-fields on.\n"
|
||||
"@param groupList groups to filter static-fields against.\n"
|
||||
"@return Space-seperated static-field list.")
|
||||
"@return Space-seperated static-field list.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
|
@ -369,7 +369,7 @@ DefineConsoleMethod(FieldBrushObject, queryFields, const char*, (const char* sim
|
|||
DefineConsoleMethod(FieldBrushObject, copyFields, void, (const char* simObjName, const char* pFieldList), (""), "(simObject, [fieldList]) Copy selected static-fields for selected object./\n"
|
||||
"@param simObject Object to copy static-fields from.\n"
|
||||
"@param fieldList fields to filter static-fields against.\n"
|
||||
"@return No return value.")
|
||||
"@return No return value.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
|
@ -502,7 +502,7 @@ void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList
|
|||
//-----------------------------------------------------------------------------
|
||||
DefineConsoleMethod(FieldBrushObject, pasteFields, void, (const char* simObjName), , "(simObject) Paste copied static-fields to selected object./\n"
|
||||
"@param simObject Object to paste static-fields to.\n"
|
||||
"@return No return value.")
|
||||
"@return No return value.")
|
||||
{
|
||||
// Fetch selected object.
|
||||
SimObject* pSimObject = dynamic_cast<SimObject*>( Sim::findObject( simObjName ) );
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ DefineEngineFunction( findNextFile, String, ( const char* pattern ), ( "" ),
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction( getFileCount, S32, ( const char* pattern, bool recurse ), ( "", true ),
|
||||
"@brief Returns the number of files in the directory tree that match the given patterns\n\n"
|
||||
"@brief Returns the number of files in the directory tree that match the given patterns\n\n"
|
||||
|
||||
"This function differs from getFileCountMultiExpr() in that it supports a single search "
|
||||
"pattern being passed in.\n\n"
|
||||
|
|
@ -246,7 +246,7 @@ DefineEngineFunction( getFileCount, S32, ( const char* pattern, bool recurse ),
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool recurse ), ( "", true),
|
||||
"@brief Returns the first file in the directory system matching the given patterns.\n\n"
|
||||
"@brief Returns the first file in the directory system matching the given patterns.\n\n"
|
||||
|
||||
"Use the corresponding findNextFileMultiExpr() to step through "
|
||||
"the results. If you're only interested in the number of files returned by the "
|
||||
|
|
@ -259,10 +259,10 @@ DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool
|
|||
"call to findFirstFile() and findFirstFileMultiExpr() initiates a new search and renders "
|
||||
"a previous search invalid.\n\n"
|
||||
|
||||
"@param pattern The path and file name pattern to match against, such as *.cs. Separate "
|
||||
"@param pattern The path and file name pattern to match against, such as *.cs. Separate "
|
||||
"multiple patterns with TABs. For example: \"*.cs\" TAB \"*.dso\"\n"
|
||||
"@param recurse If true, the search will exhaustively recurse into subdirectories "
|
||||
"of the given path and match the given filename patterns.\n"
|
||||
"@param recurse If true, the search will exhaustively recurse into subdirectories "
|
||||
"of the given path and match the given filename patterns.\n"
|
||||
"@return String of the first matching file path, or an empty string if no matching "
|
||||
"files were found.\n\n"
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool
|
|||
"@see findNextFileMultiExpr()"
|
||||
"@see getFileCountMultiExpr()"
|
||||
"@see findFirstFile()"
|
||||
"@ingroup FileSearches")
|
||||
"@ingroup FileSearches")
|
||||
{
|
||||
S32 numResults = buildFileList(pattern, recurse, true);
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool
|
|||
DefineEngineFunction(findNextFileMultiExpr, String, ( const char* pattern ), (""),
|
||||
"@brief Returns the next file matching a search begun in findFirstFileMultiExpr().\n\n"
|
||||
|
||||
"@param pattern The path and file name pattern to match against. This is optional "
|
||||
"@param pattern The path and file name pattern to match against. This is optional "
|
||||
"and may be left out as it is not used by the code. It is here for legacy reasons.\n"
|
||||
"@return String of the next matching file path, or an empty string if no matching "
|
||||
"files were found.\n\n"
|
||||
|
|
@ -319,7 +319,7 @@ DefineEngineFunction(findNextFileMultiExpr, String, ( const char* pattern ), (""
|
|||
"@endtsexample\n\n"
|
||||
|
||||
"@see findFirstFileMultiExpr()"
|
||||
"@ingroup FileSearches")
|
||||
"@ingroup FileSearches")
|
||||
{
|
||||
if ( sgFindFilesPos + 1 > sgFindFilesResults.size() )
|
||||
return String();
|
||||
|
|
@ -328,16 +328,16 @@ DefineEngineFunction(findNextFileMultiExpr, String, ( const char* pattern ), (""
|
|||
}
|
||||
|
||||
DefineEngineFunction(getFileCountMultiExpr, S32, ( const char* pattern, bool recurse ), ( "", true),
|
||||
"@brief Returns the number of files in the directory tree that match the given patterns\n\n"
|
||||
"@brief Returns the number of files in the directory tree that match the given patterns\n\n"
|
||||
|
||||
"If you're interested in a list of files that match the given patterns and not just "
|
||||
"the number of files, use findFirstFileMultiExpr() and findNextFileMultiExpr().\n\n"
|
||||
|
||||
"@param pattern The path and file name pattern to match against, such as *.cs. Separate "
|
||||
"@param pattern The path and file name pattern to match against, such as *.cs. Separate "
|
||||
"multiple patterns with TABs. For example: \"*.cs\" TAB \"*.dso\"\n"
|
||||
"@param recurse If true, the search will exhaustively recurse into subdirectories "
|
||||
"of the given path and match the given filename pattern.\n"
|
||||
"@return Number of files located using the patterns\n\n"
|
||||
"@param recurse If true, the search will exhaustively recurse into subdirectories "
|
||||
"of the given path and match the given filename pattern.\n"
|
||||
"@return Number of files located using the patterns\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Count all DTS or Collada models\n"
|
||||
|
|
@ -347,7 +347,7 @@ DefineEngineFunction(getFileCountMultiExpr, S32, ( const char* pattern, bool rec
|
|||
|
||||
"@see findFirstFileMultiExpr()"
|
||||
"@see findNextFileMultiExpr()"
|
||||
"@ingroup FileSearches")
|
||||
"@ingroup FileSearches")
|
||||
{
|
||||
S32 numResults = buildFileList(pattern, recurse, true);
|
||||
|
||||
|
|
@ -399,14 +399,14 @@ DefineEngineFunction(isFile, bool, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction( IsDirectory, bool, ( const char* directory ),,
|
||||
"@brief Determines if a specified directory exists or not\n\n"
|
||||
"@brief Determines if a specified directory exists or not\n\n"
|
||||
|
||||
"@param directory String containing path in the form of \"foo/bar\"\n"
|
||||
"@param directory String containing path in the form of \"foo/bar\"\n"
|
||||
"@return Returns true if the directory was found.\n"
|
||||
|
||||
"@note Do not include a trailing slash '/'.\n"
|
||||
"@note Do not include a trailing slash '/'.\n"
|
||||
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
String dir(Torque::Path::CleanSeparators(directory));
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), dir.c_str());
|
||||
|
|
@ -416,12 +416,12 @@ DefineEngineFunction( IsDirectory, bool, ( const char* directory ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(isWriteableFileName, bool, ( const char* fileName ),,
|
||||
"@brief Determines if a file name can be written to using File I/O\n\n"
|
||||
"@brief Determines if a file name can be written to using File I/O\n\n"
|
||||
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return Returns true if the file can be written to.\n"
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return Returns true if the file can be written to.\n"
|
||||
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
String filename(Torque::Path::CleanSeparators(fileName));
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), filename.c_str());
|
||||
|
|
@ -434,32 +434,32 @@ DefineEngineFunction(isWriteableFileName, bool, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(startFileChangeNotifications, void, (),,
|
||||
"@brief Start watching resources for file changes\n\n"
|
||||
"@brief Start watching resources for file changes\n\n"
|
||||
"Typically this is called during initializeCore().\n\n"
|
||||
"@see stopFileChangeNotifications()\n"
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
Torque::FS::StartFileChangeNotifications();
|
||||
}
|
||||
|
||||
DefineEngineFunction(stopFileChangeNotifications, void, (),,
|
||||
"@brief Stop watching resources for file changes\n\n"
|
||||
"@brief Stop watching resources for file changes\n\n"
|
||||
"Typically this is called during shutdownCore().\n\n"
|
||||
"@see startFileChangeNotifications()\n"
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
Torque::FS::StopFileChangeNotifications();
|
||||
}
|
||||
|
||||
|
||||
DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ), ( "", 0 ),
|
||||
"@brief Gathers a list of directories starting at the given path.\n\n"
|
||||
"@brief Gathers a list of directories starting at the given path.\n\n"
|
||||
|
||||
"@param path String containing the path of the directory\n"
|
||||
"@param depth Depth of search, as in how many subdirectories to parse through\n"
|
||||
"@return Tab delimited string containing list of directories found during search, \"\" if no files were found\n"
|
||||
"@param path String containing the path of the directory\n"
|
||||
"@param depth Depth of search, as in how many subdirectories to parse through\n"
|
||||
"@return Tab delimited string containing list of directories found during search, \"\" if no files were found\n"
|
||||
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
// Grab the full path.
|
||||
char fullpath[1024];
|
||||
|
|
@ -508,23 +508,23 @@ DefineEngineFunction(getDirectoryList, String, ( const char* path, S32 depth ),
|
|||
}
|
||||
|
||||
DefineEngineFunction(fileSize, S32, ( const char* fileName ),,
|
||||
"@brief Determines the size of a file on disk\n\n"
|
||||
"@brief Determines the size of a file on disk\n\n"
|
||||
|
||||
"@param fileName Name and path of the file to check\n"
|
||||
"@return Returns filesize in bytes, or -1 if no file\n"
|
||||
"@param fileName Name and path of the file to check\n"
|
||||
"@return Returns filesize in bytes, or -1 if no file\n"
|
||||
|
||||
"@ingroup FileSystem")
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileName);
|
||||
return Platform::getFileSize( sgScriptFilenameBuffer );
|
||||
}
|
||||
|
||||
DefineEngineFunction( fileModifiedTime, String, ( const char* fileName ),,
|
||||
"@brief Returns a platform specific formatted string with the last modified time for the file.\n\n"
|
||||
"@brief Returns a platform specific formatted string with the last modified time for the file.\n\n"
|
||||
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return Formatted string (OS specific) containing modified time, \"9/3/2010 12:33:47 PM\" for example\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return Formatted string (OS specific) containing modified time, \"9/3/2010 12:33:47 PM\" for example\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
Con::expandScriptFilename(sgScriptFilenameBuffer, sizeof(sgScriptFilenameBuffer), fileName);
|
||||
|
||||
|
|
@ -566,12 +566,12 @@ DefineEngineFunction( fileCreatedTime, String, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(fileDelete, bool, ( const char* path ),,
|
||||
"@brief Delete a file from the hard drive\n\n"
|
||||
"@brief Delete a file from the hard drive\n\n"
|
||||
|
||||
"@param path Name and path of the file to delete\n"
|
||||
"@note THERE IS NO RECOVERY FROM THIS. Deleted file is gone for good.\n"
|
||||
"@return True if file was successfully deleted\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param path Name and path of the file to delete\n"
|
||||
"@note THERE IS NO RECOVERY FROM THIS. Deleted file is gone for good.\n"
|
||||
"@return True if file was successfully deleted\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
static char fileName[1024];
|
||||
static char sandboxFileName[1024];
|
||||
|
|
@ -586,11 +586,11 @@ DefineEngineFunction(fileDelete, bool, ( const char* path ),,
|
|||
//----------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction(fileExt, String, ( const char* fileName ),,
|
||||
"@brief Get the extension of a file\n\n"
|
||||
"@brief Get the extension of a file\n\n"
|
||||
|
||||
"@param fileName Name and path of file\n"
|
||||
"@return String containing the extension, such as \".exe\" or \".cs\"\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param fileName Name and path of file\n"
|
||||
"@return String containing the extension, such as \".exe\" or \".cs\"\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
const char *ret = dStrrchr(fileName, '.');
|
||||
if(ret)
|
||||
|
|
@ -626,11 +626,11 @@ DefineEngineFunction(fileBase, String, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(fileName, String, ( const char* fileName ),,
|
||||
"@brief Get only the file name of a path and file name string (removes path)\n\n"
|
||||
"@brief Get only the file name of a path and file name string (removes path)\n\n"
|
||||
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return String containing the file name, minus the path\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return String containing the file name, minus the path\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
S32 pathLen = dStrlen( fileName );
|
||||
FrameTemp<char> szPathCopy( pathLen + 1);
|
||||
|
|
@ -649,11 +649,11 @@ DefineEngineFunction(fileName, String, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(filePath, String, ( const char* fileName ),,
|
||||
"@brief Get the path of a file (removes name and extension)\n\n"
|
||||
"@brief Get the path of a file (removes name and extension)\n\n"
|
||||
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return String containing the path, minus name and extension\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param fileName Name and path of file to check\n"
|
||||
"@return String containing the path, minus name and extension\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
S32 pathLen = dStrlen( fileName );
|
||||
FrameTemp<char> szPathCopy( pathLen + 1);
|
||||
|
|
@ -672,10 +672,10 @@ DefineEngineFunction(filePath, String, ( const char* fileName ),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(getWorkingDirectory, String, (),,
|
||||
"@brief Reports the current directory\n\n"
|
||||
"@brief Reports the current directory\n\n"
|
||||
|
||||
"@return String containing full file path of working directory\n"
|
||||
"@ingroup FileSystem")
|
||||
"@return String containing full file path of working directory\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
return Platform::getCurrentDirectory();
|
||||
}
|
||||
|
|
@ -687,13 +687,13 @@ DefineEngineFunction(getWorkingDirectory, String, (),,
|
|||
// are not currently built with TORQUE_TOOLS defined.
|
||||
|
||||
DefineEngineFunction(makeFullPath, String, ( const char* path, const char* cwd ), ( "", ""),
|
||||
"@brief Converts a relative file path to a full path\n\n"
|
||||
"@brief Converts a relative file path to a full path\n\n"
|
||||
|
||||
"For example, \"./console.log\" becomes \"C:/Torque/t3d/examples/FPS Example/game/console.log\"\n"
|
||||
"@param path Name of file or path to check\n"
|
||||
"For example, \"./console.log\" becomes \"C:/Torque/t3d/examples/FPS Example/game/console.log\"\n"
|
||||
"@param path Name of file or path to check\n"
|
||||
"@param cwd Optional current working directory from which to build the full path.\n"
|
||||
"@return String containing non-relative directory of path\n"
|
||||
"@ingroup FileSystem")
|
||||
"@return String containing non-relative directory of path\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
static const U32 bufSize = 512;
|
||||
char *buf = Con::getReturnBuffer(bufSize);
|
||||
|
|
@ -702,25 +702,25 @@ DefineEngineFunction(makeFullPath, String, ( const char* path, const char* cwd )
|
|||
}
|
||||
|
||||
DefineEngineFunction(makeRelativePath, String, ( const char* path, const char* to ), ( "", ""),
|
||||
"@brief Turns a full or local path to a relative one\n\n"
|
||||
"@brief Turns a full or local path to a relative one\n\n"
|
||||
|
||||
"For example, \"./game/art\" becomes \"game/art\"\n"
|
||||
"@param path Full path (may include a file) to convert\n"
|
||||
"@param to Optional base path used for the conversion. If not supplied the current "
|
||||
"working directory is used.\n"
|
||||
"@returns String containing relative path\n"
|
||||
"@ingroup FileSystem")
|
||||
"@returns String containing relative path\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
return Platform::makeRelativePathName( path, dStrlen(to) > 1 ? to : NULL );
|
||||
}
|
||||
|
||||
DefineEngineFunction(pathConcat, String, ( const char* path, const char* file), ( "", ""),
|
||||
"@brief Combines two separate strings containing a file path and file name together into a single string\n\n"
|
||||
"@brief Combines two separate strings containing a file path and file name together into a single string\n\n"
|
||||
|
||||
"@param path String containing file path\n"
|
||||
"@param file String containing file name\n"
|
||||
"@return String containing concatenated file name and path\n"
|
||||
"@ingroup FileSystem")
|
||||
"@param path String containing file path\n"
|
||||
"@param file String containing file name\n"
|
||||
"@return String containing concatenated file name and path\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
static const U32 bufSize = 1024;
|
||||
char *buf = Con::getReturnBuffer(bufSize);
|
||||
|
|
@ -731,10 +731,10 @@ DefineEngineFunction(pathConcat, String, ( const char* path, const char* file),
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction(getExecutableName, String, (),,
|
||||
"@brief Gets the name of the game's executable\n\n"
|
||||
"@brief Gets the name of the game's executable\n\n"
|
||||
|
||||
"@return String containing this game's executable name\n"
|
||||
"@ingroup FileSystem")
|
||||
"@return String containing this game's executable name\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
return Platform::getExecutableName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,22 +34,22 @@
|
|||
IMPLEMENT_CONOBJECT(PersistenceManager);
|
||||
|
||||
ConsoleDocClass( PersistenceManager,
|
||||
"@brief this class manages updating SimObjects in the file they were "
|
||||
"created in non-destructively (mostly aimed at datablocks and materials).\n\n"
|
||||
"@brief this class manages updating SimObjects in the file they were "
|
||||
"created in non-destructively (mostly aimed at datablocks and materials).\n\n"
|
||||
|
||||
"Basic scripting interface:\n\n"
|
||||
" - Creation: new PersistenceManager(FooManager);\n"
|
||||
" - Flag objects as dirty: FooManager.setDirty(<object name or id>);\n"
|
||||
" - Remove objects from dirty list: FooManager.removeDirty(<object name or id>);\n"
|
||||
" - List all currently dirty objects: FooManager.listDirty();\n"
|
||||
" - Check to see if an object is dirty: FooManager.isDirty(<object name or id>);\n"
|
||||
" - Save dirty objects to their files: FooManager.saveDirty();\n\n"
|
||||
"@note Dirty objects don't update their files until saveDirty() is "
|
||||
"called so you can change their properties after you flag them as dirty\n\n"
|
||||
"@note Currently only used by editors, not intended for actual game development\n\n"
|
||||
"@ingroup Console\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal");
|
||||
"Basic scripting interface:\n\n"
|
||||
" - Creation: new PersistenceManager(FooManager);\n"
|
||||
" - Flag objects as dirty: FooManager.setDirty(<object name or id>);\n"
|
||||
" - Remove objects from dirty list: FooManager.removeDirty(<object name or id>);\n"
|
||||
" - List all currently dirty objects: FooManager.listDirty();\n"
|
||||
" - Check to see if an object is dirty: FooManager.isDirty(<object name or id>);\n"
|
||||
" - Save dirty objects to their files: FooManager.saveDirty();\n\n"
|
||||
"@note Dirty objects don't update their files until saveDirty() is "
|
||||
"called so you can change their properties after you flag them as dirty\n\n"
|
||||
"@note Currently only used by editors, not intended for actual game development\n\n"
|
||||
"@ingroup Console\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal");
|
||||
|
||||
PersistenceManager::PersistenceManager()
|
||||
{
|
||||
|
|
@ -890,7 +890,7 @@ PersistenceManager::ParsedObject* PersistenceManager::findParsedObject(SimObject
|
|||
{
|
||||
const ParsedProperty &prop = testObj->properties[j];
|
||||
|
||||
if ( dStrcmp( prop.name, "internalName" ) == 0 &&
|
||||
if ( dStrcmp( prop.name, "internalName" ) == 0 &&
|
||||
dStrcmp( prop.value, object->getInternalName() ) == 0 )
|
||||
return testObj;
|
||||
else if ( dStrcmp(prop.name, "internalName") == 0)
|
||||
|
|
@ -2037,24 +2037,24 @@ bool PersistenceManager::saveDirtyObject(SimObject* object)
|
|||
const char *name = object->getName();
|
||||
if (name)
|
||||
{
|
||||
Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s %s (%d)",
|
||||
dirtyObject.fileName, object->getClassName(), name, object->getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s (%d)",
|
||||
dirtyObject.fileName, object->getClassName(), object->getId());
|
||||
}
|
||||
Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s %s (%d)",
|
||||
dirtyObject.fileName, object->getClassName(), name, object->getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
Con::errorf("PersistenceManager::saveDirtyObject(): Unable to open %s to save %s (%d)",
|
||||
dirtyObject.fileName, object->getClassName(), object->getId());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// if the file exists then lets update and save
|
||||
if(mCurrentFile)
|
||||
{
|
||||
updateObject(object);
|
||||
if(mCurrentFile)
|
||||
{
|
||||
updateObject(object);
|
||||
saveDirtyFile();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -2230,7 +2230,7 @@ DefineConsoleMethod( PersistenceManager, removeDirty, void, ( const char * objNa
|
|||
"Remove a SimObject from the dirty list.")
|
||||
{
|
||||
SimObject *dirtyObject = NULL;
|
||||
if (dStrcmp( objName,"")!=0)
|
||||
if (dStrcmp( objName,"")!=0)
|
||||
{
|
||||
if (!Sim::findObject(objName, dirtyObject))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -343,10 +343,10 @@ bool collapseScriptFilename(char *filename, U32 size, const char *src)
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction(expandFilename, const char*, 2, 2, "(string filename)"
|
||||
"@brief Grabs the full path of a specified file\n\n"
|
||||
"@param filename Name of the local file to locate\n"
|
||||
"@return String containing the full filepath on disk\n"
|
||||
"@ingroup FileSystem")
|
||||
"@brief Grabs the full path of a specified file\n\n"
|
||||
"@param filename Name of the local file to locate\n"
|
||||
"@return String containing the full filepath on disk\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
static const U32 bufSize = 1024;
|
||||
|
|
@ -356,9 +356,9 @@ ConsoleFunction(expandFilename, const char*, 2, 2, "(string filename)"
|
|||
}
|
||||
|
||||
ConsoleFunction(expandOldFilename, const char*, 2, 2, "(string filename)"
|
||||
"@brief Retrofits a filepath that uses old Torque style\n\n"
|
||||
"@return String containing filepath with new formatting\n"
|
||||
"@ingroup FileSystem")
|
||||
"@brief Retrofits a filepath that uses old Torque style\n\n"
|
||||
"@return String containing filepath with new formatting\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
static const U32 bufSize = 1024;
|
||||
|
|
@ -372,7 +372,7 @@ ConsoleFunction(expandOldFilename, const char*, 2, 2, "(string filename)"
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleToolFunction(collapseFilename, const char*, 2, 2, "(string filename)"
|
||||
"@internal Editor use only")
|
||||
"@internal Editor use only")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
static const U32 bufSize = 1024;
|
||||
|
|
@ -382,7 +382,7 @@ ConsoleToolFunction(collapseFilename, const char*, 2, 2, "(string filename)"
|
|||
}
|
||||
|
||||
ConsoleToolFunction(setScriptPathExpando, void, 3, 4, "(string expando, string path[, bool toolsOnly])"
|
||||
"@internal Editor use only")
|
||||
"@internal Editor use only")
|
||||
{
|
||||
if(argc == 4)
|
||||
Con::setScriptPathExpando(argv[1], argv[2], dAtob(argv[3]));
|
||||
|
|
@ -391,13 +391,13 @@ ConsoleToolFunction(setScriptPathExpando, void, 3, 4, "(string expando, string p
|
|||
}
|
||||
|
||||
ConsoleToolFunction(removeScriptPathExpando, void, 2, 2, "(string expando)"
|
||||
"@internal Editor use only")
|
||||
"@internal Editor use only")
|
||||
{
|
||||
Con::removeScriptPathExpando(argv[1]);
|
||||
}
|
||||
|
||||
ConsoleToolFunction(isScriptPathExpando, bool, 2, 2, "(string expando)"
|
||||
"@internal Editor use only")
|
||||
"@internal Editor use only")
|
||||
{
|
||||
return Con::isScriptPathExpando(argv[1]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,13 +53,13 @@ ConsoleDocClass( ScriptObject,
|
|||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptObject, onAdd, void, ( SimObjectId ID ), ( ID ),
|
||||
"Called when this ScriptObject is added to the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
"Called when this ScriptObject is added to the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptObject, onRemove, void, ( SimObjectId ID ), ( ID ),
|
||||
"Called when this ScriptObject is removed from the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
"Called when this ScriptObject is removed from the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
);
|
||||
|
||||
ScriptObject::ScriptObject()
|
||||
|
|
@ -105,18 +105,18 @@ ConsoleDocClass( ScriptTickObject,
|
|||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptTickObject, onInterpolateTick, void, ( F32 delta ), ( delta ),
|
||||
"This is called every frame, but only if the object is set to process ticks.\n"
|
||||
"@param delta The time delta for this frame.\n"
|
||||
"This is called every frame, but only if the object is set to process ticks.\n"
|
||||
"@param delta The time delta for this frame.\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptTickObject, onProcessTick, void, (), (),
|
||||
"Called once every 32ms if this object is set to process ticks.\n"
|
||||
"Called once every 32ms if this object is set to process ticks.\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptTickObject, onAdvanceTime, void, ( F32 timeDelta ), ( timeDelta ),
|
||||
"This is called every frame regardless if the object is set to process ticks, but only "
|
||||
"This is called every frame regardless if the object is set to process ticks, but only "
|
||||
"if the callOnAdvanceTime property is set to true.\n"
|
||||
"@param timeDelta The time delta for this frame.\n"
|
||||
"@param timeDelta The time delta for this frame.\n"
|
||||
"@see callOnAdvanceTime\n"
|
||||
);
|
||||
|
||||
|
|
@ -188,37 +188,37 @@ DefineEngineMethod( ScriptTickObject, isProcessingTicks, bool, ( ),,
|
|||
IMPLEMENT_CONOBJECT(ScriptGroup);
|
||||
|
||||
ConsoleDocClass( ScriptGroup,
|
||||
"@brief Essentially a SimGroup, but with onAdd and onRemove script callbacks.\n\n"
|
||||
"@brief Essentially a SimGroup, but with onAdd and onRemove script callbacks.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// First container, SimGroup containing a ScriptGroup\n"
|
||||
"new SimGroup(Scenes)\n"
|
||||
"{\n"
|
||||
" // Subcontainer, ScriptGroup containing variables\n"
|
||||
" // related to a cut scene and a starting WayPoint\n"
|
||||
" new ScriptGroup(WelcomeScene)\n"
|
||||
" {\n"
|
||||
" class = \"Scene\";\n"
|
||||
" pathName = \"Pathx\";\n"
|
||||
" description = \"A small orc village set in the Hardesty mountains. This town and its surroundings will be used to illustrate some the Torque Game Engine\'s features.\";\n"
|
||||
" pathTime = \"0\";\n"
|
||||
" title = \"Welcome to Orc Town\";\n\n"
|
||||
" new WayPoint(start)\n"
|
||||
" {\n"
|
||||
" position = \"163.873 -103.82 208.354\";\n"
|
||||
" rotation = \"0.136165 -0.0544916 0.989186 44.0527\";\n"
|
||||
" scale = \"1 1 1\";\n"
|
||||
" dataBlock = \"WayPointMarker\";\n"
|
||||
" team = \"0\";\n"
|
||||
" };\n"
|
||||
" };\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"// First container, SimGroup containing a ScriptGroup\n"
|
||||
"new SimGroup(Scenes)\n"
|
||||
"{\n"
|
||||
" // Subcontainer, ScriptGroup containing variables\n"
|
||||
" // related to a cut scene and a starting WayPoint\n"
|
||||
" new ScriptGroup(WelcomeScene)\n"
|
||||
" {\n"
|
||||
" class = \"Scene\";\n"
|
||||
" pathName = \"Pathx\";\n"
|
||||
" description = \"A small orc village set in the Hardesty mountains. This town and its surroundings will be used to illustrate some the Torque Game Engine\'s features.\";\n"
|
||||
" pathTime = \"0\";\n"
|
||||
" title = \"Welcome to Orc Town\";\n\n"
|
||||
" new WayPoint(start)\n"
|
||||
" {\n"
|
||||
" position = \"163.873 -103.82 208.354\";\n"
|
||||
" rotation = \"0.136165 -0.0544916 0.989186 44.0527\";\n"
|
||||
" scale = \"1 1 1\";\n"
|
||||
" dataBlock = \"WayPointMarker\";\n"
|
||||
" team = \"0\";\n"
|
||||
" };\n"
|
||||
" };\n"
|
||||
"};\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@see SimGroup\n"
|
||||
"@see SimGroup\n"
|
||||
|
||||
"@ingroup Console\n"
|
||||
"@ingroup Scripting"
|
||||
"@ingroup Console\n"
|
||||
"@ingroup Scripting"
|
||||
);
|
||||
|
||||
ScriptGroup::ScriptGroup()
|
||||
|
|
@ -226,13 +226,13 @@ ScriptGroup::ScriptGroup()
|
|||
}
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptGroup, onAdd, void, ( SimObjectId ID ), ( ID ),
|
||||
"Called when this ScriptGroup is added to the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
"Called when this ScriptGroup is added to the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( ScriptGroup, onRemove, void, ( SimObjectId ID ), ( ID ),
|
||||
"Called when this ScriptObject is removed from the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
"Called when this ScriptObject is removed from the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
);
|
||||
|
||||
bool ScriptGroup::onAdd()
|
||||
|
|
@ -248,7 +248,7 @@ bool ScriptGroup::onAdd()
|
|||
void ScriptGroup::onRemove()
|
||||
{
|
||||
// Call onRemove in script!
|
||||
onRemove_callback(getId());
|
||||
onRemove_callback(getId());
|
||||
|
||||
Parent::onRemove();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ DefineConsoleFunction( spawnObject, S32, ( const char * spawnClass
|
|||
, const char * spawnProperties
|
||||
, const char * spawnScript
|
||||
),("","","","") ,"spawnObject(class [, dataBlock, name, properties, script])"
|
||||
"@hide")
|
||||
"@hide")
|
||||
{
|
||||
SimObject* spawnObject = Sim::spawnObject(spawnClass, spawnDataBlock, spawnName, spawnProperties, spawnScript);
|
||||
|
||||
|
|
@ -203,12 +203,12 @@ ConsoleFunction(schedule, S32, 4, 0, "schedule(time, refobject|0, command, <arg1
|
|||
}
|
||||
|
||||
DefineConsoleFunction( getUniqueName, const char*, (const char * baseName), ,
|
||||
"( String baseName )\n"
|
||||
"@brief Returns a unique unused SimObject name based on a given base name.\n\n"
|
||||
"@baseName Name to conver to a unique string if another instance exists\n"
|
||||
"@note Currently only used by editors\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
"( String baseName )\n"
|
||||
"@brief Returns a unique unused SimObject name based on a given base name.\n\n"
|
||||
"@baseName Name to conver to a unique string if another instance exists\n"
|
||||
"@note Currently only used by editors\n"
|
||||
"@ingroup Editors\n"
|
||||
"@internal")
|
||||
{
|
||||
String outName = Sim::getUniqueName( baseName );
|
||||
|
||||
|
|
@ -247,10 +247,10 @@ DefineConsoleFunction( getUniqueInternalName, const char*, (const char * baseNam
|
|||
}
|
||||
|
||||
DefineConsoleFunction( isValidObjectName, bool, (const char * name), , "( string name )"
|
||||
"@brief Return true if the given name makes for a valid object name.\n\n"
|
||||
"@param name Name of object\n"
|
||||
"@return True if name is allowed, false if denied (usually because it starts with a number, _, or invalid character"
|
||||
"@ingroup Console")
|
||||
"@brief Return true if the given name makes for a valid object name.\n\n"
|
||||
"@param name Name of object\n"
|
||||
"@return True if name is allowed, false if denied (usually because it starts with a number, _, or invalid character"
|
||||
"@ingroup Console")
|
||||
{
|
||||
return Sim::isValidObjectName( name );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ void SimNameDictionary::remove(SimObject* obj)
|
|||
if(*walk == obj)
|
||||
{
|
||||
*walk = obj->nextNameObject;
|
||||
obj->nextNameObject = (SimObject*)-1;
|
||||
obj->nextNameObject = (SimObject*)-1;
|
||||
hashEntryCount--;
|
||||
|
||||
Mutex::unlockMutex(mutex);
|
||||
|
|
@ -164,7 +164,7 @@ void SimNameDictionary::remove(SimObject* obj)
|
|||
root.erase(name);
|
||||
#endif
|
||||
Mutex::unlockMutex(mutex);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ void SimManagerNameDictionary::remove(SimObject* obj)
|
|||
if(*walk == obj)
|
||||
{
|
||||
*walk = obj->nextManagerNameObject;
|
||||
obj->nextManagerNameObject = (SimObject*)-1;
|
||||
obj->nextManagerNameObject = (SimObject*)-1;
|
||||
hashEntryCount--;
|
||||
|
||||
Mutex::unlockMutex(mutex);
|
||||
|
|
@ -293,7 +293,7 @@ void SimManagerNameDictionary::remove(SimObject* obj)
|
|||
root.erase(name);
|
||||
#endif
|
||||
Mutex::unlockMutex(mutex);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ struct StringTableEntryEq
|
|||
}
|
||||
};
|
||||
|
||||
typedef std::unordered_map<StringTableEntry, SimObject*, StringTableEntryHash, StringTableEntryEq> StringDictDef;
|
||||
typedef std::unordered_map<StringTableEntry, SimObject*, StringTableEntryHash, StringTableEntryEq> StringDictDef;
|
||||
typedef std::unordered_map<SimObjectId, SimObject*> SimObjectIdDictDef;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ SimConsoleEvent::SimConsoleEvent(S32 argc, ConsoleValueRef *argv, bool onObject)
|
|||
mArgv[i].value = new ConsoleValue();
|
||||
mArgv[i].value->type = ConsoleValue::TypeInternalString;
|
||||
mArgv[i].value->init();
|
||||
if (argv)
|
||||
{
|
||||
mArgv[i].value->setStringValue((const char*)argv[i]);
|
||||
}
|
||||
if (argv)
|
||||
{
|
||||
mArgv[i].value->setStringValue((const char*)argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,13 +93,13 @@ static void shutdownEventQueue()
|
|||
|
||||
U32 postEvent(SimObject *destObject, SimEvent* event,U32 time)
|
||||
{
|
||||
AssertFatal(time == -1 || time >= getCurrentTime(),
|
||||
AssertFatal(time == -1 || time >= getCurrentTime(),
|
||||
"Sim::postEvent() - Event time must be greater than or equal to the current time." );
|
||||
AssertFatal(destObject, "Sim::postEvent() - Destination object for event doesn't exist.");
|
||||
|
||||
Mutex::lockMutex(gEventQueueMutex);
|
||||
|
||||
if( time == -1 ) // FIXME: a smart compiler will remove this check. - see http://garagegames.com/community/resources/view/19785 for a fix
|
||||
if( time == -1 ) // FIXME: a smart compiler will remove this check. - see http://garagegames.com/community/resources/view/19785 for a fix
|
||||
time = gCurrentTime;
|
||||
|
||||
event->time = time;
|
||||
|
|
@ -256,7 +256,7 @@ void advanceToTime(SimTime targetTime)
|
|||
event->process(obj);
|
||||
delete event;
|
||||
}
|
||||
gCurrentTime = targetTime;
|
||||
gCurrentTime = targetTime;
|
||||
|
||||
Mutex::unlockMutex(gEventQueueMutex);
|
||||
}
|
||||
|
|
@ -393,7 +393,7 @@ SimObject* findObject(const char* name)
|
|||
|
||||
SimObject* findObject(SimObjectId id)
|
||||
{
|
||||
return gIdDictionary->find(id);
|
||||
return gIdDictionary->find(id);
|
||||
}
|
||||
|
||||
SimObject *spawnObject(String spawnClass, String spawnDataBlock, String spawnName,
|
||||
|
|
@ -600,7 +600,7 @@ SimDataBlockGroup::SimDataBlockGroup()
|
|||
|
||||
S32 QSORT_CALLBACK SimDataBlockGroup::compareModifiedKey(const void* a,const void* b)
|
||||
{
|
||||
const SimDataBlock* dba = *((const SimDataBlock**)a);
|
||||
const SimDataBlock* dba = *((const SimDataBlock**)a);
|
||||
const SimDataBlock* dbb = *((const SimDataBlock**)b);
|
||||
|
||||
return dba->getModifiedKey() - dbb->getModifiedKey();
|
||||
|
|
@ -612,6 +612,6 @@ void SimDataBlockGroup::sort()
|
|||
if(mLastModifiedKey != SimDataBlock::getNextModifiedKey())
|
||||
{
|
||||
mLastModifiedKey = SimDataBlock::getNextModifiedKey();
|
||||
dQsort(objectList.address(),objectList.size(),sizeof(SimObject *),compareModifiedKey);
|
||||
dQsort(objectList.address(),objectList.size(),sizeof(SimObject *),compareModifiedKey);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ SimObject::SimObject()
|
|||
mFlags.set( ModStaticFields | ModDynamicFields );
|
||||
|
||||
mFieldDictionary = NULL;
|
||||
mCanSaveFieldDictionary = true;
|
||||
mCanSaveFieldDictionary = true;
|
||||
|
||||
mClassName = NULL;
|
||||
mSuperClassName = NULL;
|
||||
|
|
@ -592,7 +592,7 @@ void SimObject::setDeclarationLine(U32 lineNumber)
|
|||
bool SimObject::registerObject()
|
||||
{
|
||||
AssertFatal( !mFlags.test( Added ), "reigsterObject - Object already registered!");
|
||||
mFlags.clear(Deleted | Removed);
|
||||
mFlags.clear(Deleted | Removed);
|
||||
|
||||
if(smForceId)
|
||||
{
|
||||
|
|
@ -609,11 +609,11 @@ bool SimObject::registerObject()
|
|||
AssertFatal(Sim::gIdDictionary && Sim::gNameDictionary,
|
||||
"SimObject::registerObject - tried to register an object before Sim::init()!");
|
||||
|
||||
Sim::gIdDictionary->insert(this);
|
||||
Sim::gIdDictionary->insert(this);
|
||||
|
||||
Sim::gNameDictionary->insert(this);
|
||||
|
||||
// Notify object
|
||||
// Notify object
|
||||
bool ret = onAdd();
|
||||
|
||||
if(!ret)
|
||||
|
|
@ -661,10 +661,10 @@ void SimObject::deleteObject()
|
|||
|
||||
void SimObject::_destroySelf()
|
||||
{
|
||||
AssertFatal( !isDeleted(), "SimObject::destroySelf - Object has already been deleted" );
|
||||
AssertFatal( !isRemoved(), "SimObject::destroySelf - Object in the process of being removed" );
|
||||
AssertFatal( !isDeleted(), "SimObject::destroySelf - Object has already been deleted" );
|
||||
AssertFatal( !isRemoved(), "SimObject::destroySelf - Object in the process of being removed" );
|
||||
|
||||
mFlags.set( Deleted );
|
||||
mFlags.set( Deleted );
|
||||
|
||||
if( mFlags.test( Added ) )
|
||||
unregisterObject();
|
||||
|
|
@ -1308,7 +1308,7 @@ void SimObject::dumpClassHierarchy()
|
|||
while(pRep)
|
||||
{
|
||||
Con::warnf("%s ->", pRep->getClassName());
|
||||
pRep = pRep->getParentClass();
|
||||
pRep = pRep->getParentClass();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1376,7 +1376,7 @@ bool SimObject::isChildOfGroup(SimGroup* pGroup)
|
|||
if(pGroup == dynamic_cast<SimGroup*>(this))
|
||||
return true;
|
||||
|
||||
SimGroup* temp = mGroup;
|
||||
SimGroup* temp = mGroup;
|
||||
while(temp)
|
||||
{
|
||||
if(temp == pGroup)
|
||||
|
|
@ -2884,7 +2884,7 @@ DefineConsoleMethod( SimObject, isMemberOfClass, bool, ( const char* className )
|
|||
return true;
|
||||
}
|
||||
|
||||
pRep = pRep->getParentClass();
|
||||
pRep = pRep->getParentClass();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -826,7 +826,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks
|
|||
virtual bool readObject(Stream *stream);
|
||||
|
||||
/// Set whether fields created at runtime should be saved. Default is true.
|
||||
void setCanSaveDynamicFields( bool bCanSave ) { mCanSaveFieldDictionary = bCanSave; }
|
||||
void setCanSaveDynamicFields( bool bCanSave ) { mCanSaveFieldDictionary = bCanSave; }
|
||||
|
||||
/// Get whether fields created at runtime should be saved. Default is true.
|
||||
bool getCanSaveDynamicFields( ) { return mCanSaveFieldDictionary;}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
SimObjectMemento::SimObjectMemento()
|
||||
: mState( NULL ),
|
||||
mIsDatablock( false )
|
||||
mIsDatablock( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -45,16 +45,16 @@ void SimObjectMemento::save( SimObject *object )
|
|||
dFree( mState );
|
||||
mObjectName = String::EmptyString;
|
||||
|
||||
// Use a stream to save the state.
|
||||
// Use a stream to save the state.
|
||||
MemStream stream( 256 );
|
||||
|
||||
U32 writeFlags = 0;
|
||||
SimDataBlock* db = dynamic_cast<SimDataBlock*>(object);
|
||||
if( !db )
|
||||
stream.write( sizeof( "return " ) - 1, "return " );
|
||||
else
|
||||
SimDataBlock* db = dynamic_cast<SimDataBlock*>(object);
|
||||
if( !db )
|
||||
stream.write( sizeof( "return " ) - 1, "return " );
|
||||
else
|
||||
{
|
||||
mIsDatablock = true;
|
||||
mIsDatablock = true;
|
||||
|
||||
// Cull the datablock name from the output so that
|
||||
// we can easily replace it in case the datablock's name
|
||||
|
|
@ -64,7 +64,7 @@ void SimObjectMemento::save( SimObject *object )
|
|||
|
||||
writeFlags |= SimObject::NoName;
|
||||
}
|
||||
|
||||
|
||||
object->write( stream, 0, writeFlags );
|
||||
stream.write( (UTF8)0 );
|
||||
|
||||
|
|
@ -82,9 +82,9 @@ SimObject *SimObjectMemento::restore() const
|
|||
// TODO: We could potentially make this faster by
|
||||
// caching the CodeBlock generated from the string
|
||||
|
||||
SimObject* object;
|
||||
if( !mIsDatablock )
|
||||
{
|
||||
SimObject* object;
|
||||
if( !mIsDatablock )
|
||||
{
|
||||
// Set the redefine behavior to automatically giving
|
||||
// the new objects unique names. This will restore the
|
||||
// old names if they are still available or give reasonable
|
||||
|
|
@ -95,22 +95,22 @@ SimObject *SimObjectMemento::restore() const
|
|||
|
||||
// Read the object.
|
||||
|
||||
const UTF8* result = Con::evaluate( mState );
|
||||
const UTF8* result = Con::evaluate( mState );
|
||||
|
||||
// Restore the redefine behavior.
|
||||
|
||||
Con::setVariable( "$Con::redefineBehavior", oldRedefineBehavior );
|
||||
|
||||
if ( !result || !result[ 0 ] )
|
||||
return NULL;
|
||||
if ( !result || !result[ 0 ] )
|
||||
return NULL;
|
||||
|
||||
// Look up the object.
|
||||
|
||||
U32 objectId = dAtoi( result );
|
||||
object = Sim::findObject( objectId );
|
||||
}
|
||||
else
|
||||
{
|
||||
U32 objectId = dAtoi( result );
|
||||
object = Sim::findObject( objectId );
|
||||
}
|
||||
else
|
||||
{
|
||||
String objectName = mObjectName;
|
||||
|
||||
// For datablocks, it's getting a little complicated. Datablock definitions cannot be used
|
||||
|
|
@ -140,16 +140,16 @@ SimObject *SimObjectMemento::restore() const
|
|||
dStrcpy( &tempBuffer[ numCharsToLeftParen + uniqueNameLen ], &mState[ numCharsToLeftParen ] );
|
||||
}
|
||||
|
||||
Con::evaluate( tempBuffer );
|
||||
Con::evaluate( tempBuffer );
|
||||
|
||||
if( tempBuffer != mState )
|
||||
dFree( tempBuffer );
|
||||
|
||||
if( objectName == String::EmptyString )
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
object = Sim::findObject( objectName );
|
||||
}
|
||||
object = Sim::findObject( objectName );
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ protected:
|
|||
|
||||
/// The captured object's name.
|
||||
String mObjectName;
|
||||
bool mIsDatablock;
|
||||
bool mIsDatablock;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@
|
|||
IMPLEMENT_CONOBJECT( SimPersistSet );
|
||||
|
||||
ConsoleDocClass( SimPersistSet,
|
||||
"@brief A SimSet that can be safely persisted.\n\n"
|
||||
"Uses SimPersistIDs to reference objects in the set "
|
||||
"while persisted on disk. This allows the set to resolve "
|
||||
"its references no matter whether they are loaded before or "
|
||||
"after the set is created.\n\n"
|
||||
"Not intended for game development, for editors or internal use only.\n\n "
|
||||
"@internal");
|
||||
"@brief A SimSet that can be safely persisted.\n\n"
|
||||
"Uses SimPersistIDs to reference objects in the set "
|
||||
"while persisted on disk. This allows the set to resolve "
|
||||
"its references no matter whether they are loaded before or "
|
||||
"after the set is created.\n\n"
|
||||
"Not intended for game development, for editors or internal use only.\n\n "
|
||||
"@internal");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -213,18 +213,18 @@ SimObject *loadObjectStream(Stream *stream)
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction(saveObject, bool, ( SimObject *object, const char *filename ),,
|
||||
"@brief Serialize the object to a file.\n\n"
|
||||
"@param object The object to serialize.\n"
|
||||
"@param filename The file name and path.\n"
|
||||
"@ingroup Console\n")
|
||||
"@brief Serialize the object to a file.\n\n"
|
||||
"@param object The object to serialize.\n"
|
||||
"@param filename The file name and path.\n"
|
||||
"@ingroup Console\n")
|
||||
{
|
||||
return object && Sim::saveObject(object, filename);
|
||||
}
|
||||
|
||||
DefineEngineFunction(loadObject, SimObject*, ( const char *filename ),,
|
||||
"@brief Loads a serialized object from a file.\n\n"
|
||||
"@param Name and path to text file containing the object\n"
|
||||
"@ingroup Console\n")
|
||||
"@brief Loads a serialized object from a file.\n\n"
|
||||
"@param Name and path to text file containing the object\n"
|
||||
"@ingroup Console\n")
|
||||
{
|
||||
return Sim::loadObjectStream(filename);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ bool ConsoleValueStack::reserveValues(U32 count, ConsoleValueRef *outValues)
|
|||
//Con::printf("[%i]CSTK reserveValues %i", mStackPos, count);
|
||||
for (U32 i=0; i<count; i++)
|
||||
{
|
||||
outValues[i].value = &mStack[mStackPos+i];
|
||||
outValues[i].value = &mStack[mStackPos+i];
|
||||
}
|
||||
mStackPos += count;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -67,17 +67,17 @@ DefineConsoleFunction( telnetSetParameters, void, ( int port, const char* consol
|
|||
"@param consolePass Password for read/write access to console.\n"
|
||||
"@param listenPass Password for read access to console.\n"
|
||||
"@param remoteEcho [optional] Enable echoing back to the client, off by default.\n\n"
|
||||
"@ingroup Debugging")
|
||||
"@ingroup Debugging")
|
||||
{
|
||||
if (TelConsole)
|
||||
TelConsole->setTelnetParameters(port, consolePass, listenPass, remoteEcho);
|
||||
TelConsole->setTelnetParameters(port, consolePass, listenPass, remoteEcho);
|
||||
}
|
||||
|
||||
static void telnetCallback(U32 level, const char *consoleLine)
|
||||
{
|
||||
TORQUE_UNUSED(level);
|
||||
if (TelConsole)
|
||||
TelConsole->processConsoleLine(consoleLine);
|
||||
TelConsole->processConsoleLine(consoleLine);
|
||||
}
|
||||
|
||||
TelnetConsole::TelnetConsole()
|
||||
|
|
@ -121,9 +121,9 @@ void TelnetConsole::setTelnetParameters(S32 port, const char *telnetPassword, co
|
|||
mAcceptPort = port;
|
||||
if(mAcceptPort != -1 && mAcceptPort != 0)
|
||||
{
|
||||
NetAddress address;
|
||||
Net::getIdealListenAddress(&address);
|
||||
address.port = mAcceptPort;
|
||||
NetAddress address;
|
||||
Net::getIdealListenAddress(&address);
|
||||
address.port = mAcceptPort;
|
||||
|
||||
mAcceptSocket = Net::openSocket();
|
||||
Net::bindAddress(address, mAcceptSocket);
|
||||
|
|
|
|||
|
|
@ -115,8 +115,8 @@ MODULE_END;
|
|||
|
||||
DefineConsoleFunction( dbgSetParameters, void, (S32 port, const char * password, bool waitForClient ), (false), "( int port, string password, bool waitForClient )"
|
||||
"Open a debug server port on the specified port, requiring the specified password, "
|
||||
"and optionally waiting for the debug client to connect.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
"and optionally waiting for the debug client to connect.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
{
|
||||
if (TelDebugger)
|
||||
{
|
||||
|
|
@ -126,17 +126,17 @@ DefineConsoleFunction( dbgSetParameters, void, (S32 port, const char * password,
|
|||
|
||||
DefineConsoleFunction( dbgIsConnected, bool, (), , "()"
|
||||
"Returns true if a script debugging client is connected else return false.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
{
|
||||
return TelDebugger && TelDebugger->isConnected();
|
||||
}
|
||||
|
||||
DefineConsoleFunction( dbgDisconnect, void, (), , "()"
|
||||
"Forcibly disconnects any attached script debugging client.\n"
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
"@internal Primarily used for Torsion and other debugging tools")
|
||||
{
|
||||
if (TelDebugger)
|
||||
TelDebugger->disconnect();
|
||||
TelDebugger->disconnect();
|
||||
}
|
||||
|
||||
static void debuggerConsumer(U32 level, const char *line)
|
||||
|
|
@ -244,9 +244,9 @@ void TelnetDebugger::setDebugParameters(S32 port, const char *password, bool wai
|
|||
mAcceptPort = port;
|
||||
if(mAcceptPort != -1 && mAcceptPort != 0)
|
||||
{
|
||||
NetAddress address;
|
||||
Net::getIdealListenAddress(&address);
|
||||
address.port = mAcceptPort;
|
||||
NetAddress address;
|
||||
Net::getIdealListenAddress(&address);
|
||||
address.port = mAcceptPort;
|
||||
|
||||
mAcceptSocket = Net::openSocket();
|
||||
Net::bindAddress(address, mAcceptSocket);
|
||||
|
|
@ -588,7 +588,7 @@ void TelnetDebugger::addAllBreakpoints(CodeBlock *code)
|
|||
// TODO: This assumes that the OS file names are case
|
||||
// insensitive... Torque needs a dFilenameCmp() function.
|
||||
if( dStricmp( cur->fileName, code->name ) == 0 )
|
||||
{
|
||||
{
|
||||
cur->code = code;
|
||||
|
||||
// Find the fist breakline starting from and
|
||||
|
|
@ -741,7 +741,7 @@ void TelnetDebugger::removeBreakpoint(const char *fileName, S32 line)
|
|||
{
|
||||
Breakpoint *brk = *bp;
|
||||
*bp = brk->next;
|
||||
if ( brk->code )
|
||||
if ( brk->code )
|
||||
brk->code->clearBreakpoint(brk->lineNumber);
|
||||
dFree(brk->testExpression);
|
||||
delete brk;
|
||||
|
|
@ -754,7 +754,7 @@ void TelnetDebugger::removeAllBreakpoints()
|
|||
while(walk)
|
||||
{
|
||||
Breakpoint *temp = walk->next;
|
||||
if ( walk->code )
|
||||
if ( walk->code )
|
||||
walk->code->clearBreakpoint(walk->lineNumber);
|
||||
dFree(walk->testExpression);
|
||||
delete walk;
|
||||
|
|
@ -792,10 +792,10 @@ void TelnetDebugger::setBreakOnNextStatement( bool enabled )
|
|||
for(CodeBlock *walk = CodeBlock::getCodeBlockList(); walk; walk = walk->nextFile)
|
||||
walk->clearAllBreaks();
|
||||
for(Breakpoint *w = mBreakpoints; w; w = w->next)
|
||||
{
|
||||
if ( w->code )
|
||||
{
|
||||
if ( w->code )
|
||||
w->code->setBreakpoint(w->lineNumber);
|
||||
}
|
||||
}
|
||||
mBreakOnNextStatement = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -848,7 +848,7 @@ void TelnetDebugger::debugStepOut()
|
|||
setBreakOnNextStatement( false );
|
||||
mStackPopBreakIndex = gEvalState.getStackDepth() - 1;
|
||||
if ( mStackPopBreakIndex == 0 )
|
||||
mStackPopBreakIndex = -1;
|
||||
mStackPopBreakIndex = -1;
|
||||
mProgramPaused = false;
|
||||
send("RUNNING\r\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,42 +49,42 @@ void TypeValidator::consoleError(SimObject *object, const char *format, ...)
|
|||
|
||||
void FRangeValidator::validateType(SimObject *object, void *typePtr)
|
||||
{
|
||||
F32 *v = (F32 *) typePtr;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Must be between %g and %g", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
F32 *v = (F32 *) typePtr;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Must be between %g and %g", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
}
|
||||
|
||||
void IRangeValidator::validateType(SimObject *object, void *typePtr)
|
||||
{
|
||||
S32 *v = (S32 *) typePtr;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Must be between %d and %d", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
S32 *v = (S32 *) typePtr;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Must be between %d and %d", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
}
|
||||
|
||||
void IRangeValidatorScaled::validateType(SimObject *object, void *typePtr)
|
||||
{
|
||||
S32 *v = (S32 *) typePtr;
|
||||
*v /= factor;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Scaled value must be between %d and %d", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
S32 *v = (S32 *) typePtr;
|
||||
*v /= factor;
|
||||
if(*v < minV || *v > maxV)
|
||||
{
|
||||
consoleError(object, "Scaled value must be between %d and %d", minV, maxV);
|
||||
if(*v < minV)
|
||||
*v = minV;
|
||||
else if(*v > maxV)
|
||||
*v = maxV;
|
||||
}
|
||||
}
|
||||
|
||||
void Point3NormalizeValidator::validateType(SimObject *object, void *typePtr)
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ DefineEngineFunction( stopVideoCapture, void, (),,
|
|||
|
||||
DefineEngineFunction( playJournalToVideo, void,
|
||||
( const char *journalFile, const char *videoFile, const char *encoder, F32 framerate, Point2I resolution ),
|
||||
( nullAsType<const char*>(), "THEORA", 30.0f, Point2I::Zero ),
|
||||
( nullAsType<const char*>(), "THEORA", 30.0f, Point2I::Zero ),
|
||||
"Load a journal file and capture it video.\n"
|
||||
"@ingroup Rendering\n" )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,42 +52,42 @@
|
|||
IMPLEMENT_CONOBJECT(GuiCanvas);
|
||||
|
||||
ConsoleDocClass( GuiCanvas,
|
||||
"@brief A canvas on which rendering occurs.\n\n"
|
||||
"@brief A canvas on which rendering occurs.\n\n"
|
||||
|
||||
"@section GuiCanvas_contents What a GUICanvas Can Contain...\n\n"
|
||||
"@section GuiCanvas_contents What a GUICanvas Can Contain...\n\n"
|
||||
|
||||
"@subsection GuiCanvas_content_contentcontrol Content Control\n"
|
||||
"A content control is the top level GuiControl for a screen. This GuiControl "
|
||||
"will be the parent control for all other GuiControls on that particular "
|
||||
"screen.\n\n"
|
||||
"@subsection GuiCanvas_content_contentcontrol Content Control\n"
|
||||
"A content control is the top level GuiControl for a screen. This GuiControl "
|
||||
"will be the parent control for all other GuiControls on that particular "
|
||||
"screen.\n\n"
|
||||
|
||||
"@subsection GuiCanvas_content_dialogs Dialogs\n\n"
|
||||
"@subsection GuiCanvas_content_dialogs Dialogs\n\n"
|
||||
|
||||
"A dialog is essentially another screen, only it gets overlaid on top of the "
|
||||
"current content control, and all input goes to the dialog. This is most akin "
|
||||
"to the \"Open File\" dialog box found in most operating systems. When you "
|
||||
"choose to open a file, and the \"Open File\" dialog pops up, you can no longer "
|
||||
"send input to the application, and must complete or cancel the open file "
|
||||
"request. Torque keeps track of layers of dialogs. The dialog with the highest "
|
||||
"layer is on top and will get all the input, unless the dialog is "
|
||||
"modeless, which is a profile option.\n\n"
|
||||
"A dialog is essentially another screen, only it gets overlaid on top of the "
|
||||
"current content control, and all input goes to the dialog. This is most akin "
|
||||
"to the \"Open File\" dialog box found in most operating systems. When you "
|
||||
"choose to open a file, and the \"Open File\" dialog pops up, you can no longer "
|
||||
"send input to the application, and must complete or cancel the open file "
|
||||
"request. Torque keeps track of layers of dialogs. The dialog with the highest "
|
||||
"layer is on top and will get all the input, unless the dialog is "
|
||||
"modeless, which is a profile option.\n\n"
|
||||
|
||||
"@see GuiControlProfile\n\n"
|
||||
"@see GuiControlProfile\n\n"
|
||||
|
||||
"@section GuiCanvas_dirty Dirty Rectangles\n\n"
|
||||
"@section GuiCanvas_dirty Dirty Rectangles\n\n"
|
||||
|
||||
"The GuiCanvas is based on dirty regions. "
|
||||
"Every frame the canvas paints only the areas of the canvas that are 'dirty' "
|
||||
"or need updating. In most cases, this only is the area under the mouse cursor. "
|
||||
"This is why if you look in guiCanvas.cc the call to glClear is commented out. "
|
||||
|
||||
"What you will see is a black screen, except in the dirty regions, where the "
|
||||
"screen will be painted normally. If you are making an animated GuiControl "
|
||||
"you need to add your control to the dirty areas of the canvas.\n\n"
|
||||
"The GuiCanvas is based on dirty regions. "
|
||||
"Every frame the canvas paints only the areas of the canvas that are 'dirty' "
|
||||
"or need updating. In most cases, this only is the area under the mouse cursor. "
|
||||
"This is why if you look in guiCanvas.cc the call to glClear is commented out. "
|
||||
|
||||
"What you will see is a black screen, except in the dirty regions, where the "
|
||||
"screen will be painted normally. If you are making an animated GuiControl "
|
||||
"you need to add your control to the dirty areas of the canvas.\n\n"
|
||||
|
||||
"@see GuiControl\n\n"
|
||||
"@see GuiControl\n\n"
|
||||
|
||||
"@ingroup GuiCore\n");
|
||||
"@ingroup GuiCore\n");
|
||||
|
||||
ColorI gCanvasClearColor( 255, 0, 255 ); ///< For GFX->clear
|
||||
|
||||
|
|
@ -209,29 +209,29 @@ bool GuiCanvas::onAdd()
|
|||
//If we're recording, store the intial video resolution
|
||||
if (Journal::IsRecording())
|
||||
{
|
||||
Journal::Write(vm.resolution.x);
|
||||
Journal::Write(vm.resolution.y);
|
||||
Journal::Write(vm.fullScreen);
|
||||
Journal::Write(vm.resolution.x);
|
||||
Journal::Write(vm.resolution.y);
|
||||
Journal::Write(vm.fullScreen);
|
||||
}
|
||||
|
||||
//If we're playing, read the intial video resolution from the journal
|
||||
if (Journal::IsPlaying())
|
||||
{
|
||||
Journal::Read(&vm.resolution.x);
|
||||
Journal::Read(&vm.resolution.y);
|
||||
Journal::Read(&vm.fullScreen);
|
||||
Journal::Read(&vm.resolution.x);
|
||||
Journal::Read(&vm.resolution.y);
|
||||
Journal::Read(&vm.fullScreen);
|
||||
}
|
||||
|
||||
if (a && a->mType != NullDevice)
|
||||
{
|
||||
mPlatformWindow = WindowManager->createWindow(newDevice, vm);
|
||||
|
||||
//Disable window resizing if recording ir playing a journal
|
||||
if (Journal::IsRecording() || Journal::IsPlaying())
|
||||
mPlatformWindow->lockSize(true);
|
||||
|
||||
// Set a minimum on the window size so people can't break us by resizing tiny.
|
||||
mPlatformWindow->setMinimumWindowSize(Point2I(640,480));
|
||||
//Disable window resizing if recording ir playing a journal
|
||||
if (Journal::IsRecording() || Journal::IsPlaying())
|
||||
mPlatformWindow->lockSize(true);
|
||||
|
||||
// Set a minimum on the window size so people can't break us by resizing tiny.
|
||||
mPlatformWindow->setMinimumWindowSize(Point2I(640,480));
|
||||
|
||||
// Now, we have to hook in our event callbacks so we'll get
|
||||
// appropriate events from the window.
|
||||
|
|
@ -326,12 +326,12 @@ CanvasSizeChangeSignal GuiCanvas::smCanvasSizeChangeSignal;
|
|||
void GuiCanvas::handleResize( WindowId did, S32 width, S32 height )
|
||||
{
|
||||
getCanvasSizeChangeSignal().trigger(this);
|
||||
if (Journal::IsPlaying() && mPlatformWindow)
|
||||
{
|
||||
mPlatformWindow->lockSize(false);
|
||||
mPlatformWindow->setSize(Point2I(width, height));
|
||||
mPlatformWindow->lockSize(true);
|
||||
}
|
||||
if (Journal::IsPlaying() && mPlatformWindow)
|
||||
{
|
||||
mPlatformWindow->lockSize(false);
|
||||
mPlatformWindow->setSize(Point2I(width, height));
|
||||
mPlatformWindow->lockSize(true);
|
||||
}
|
||||
|
||||
// Notify the scripts
|
||||
if ( isMethod( "onResize" ) )
|
||||
|
|
@ -342,9 +342,9 @@ void GuiCanvas::handlePaintEvent(WindowId did)
|
|||
{
|
||||
bool canRender = mPlatformWindow->isVisible() && GFX->allowRender() && !GFX->canCurrentlyRender();
|
||||
|
||||
// Do the screenshot first.
|
||||
// Do the screenshot first.
|
||||
if ( gScreenShot != NULL && gScreenShot->isPending() && canRender )
|
||||
gScreenShot->capture( this );
|
||||
gScreenShot->capture( this );
|
||||
|
||||
// If the video capture is waiting for a canvas, start the capture
|
||||
if ( VIDCAP->isWaitingForCanvas() && canRender )
|
||||
|
|
@ -560,19 +560,19 @@ bool GuiCanvas::tabNext(void)
|
|||
//save the old
|
||||
GuiControl *oldResponder = mFirstResponder;
|
||||
|
||||
GuiControl* newResponder = ctrl->findNextTabable(mFirstResponder);
|
||||
GuiControl* newResponder = ctrl->findNextTabable(mFirstResponder);
|
||||
if ( !newResponder )
|
||||
newResponder = ctrl->findFirstTabable();
|
||||
|
||||
if ( newResponder && newResponder != oldResponder )
|
||||
{
|
||||
newResponder->setFirstResponder();
|
||||
if ( newResponder && newResponder != oldResponder )
|
||||
{
|
||||
newResponder->setFirstResponder();
|
||||
|
||||
// CodeReview Can this get killed? Note tabPrev code. BJG - 3/25/07
|
||||
// if ( oldResponder )
|
||||
// oldResponder->onLoseFirstResponder();
|
||||
// if ( oldResponder )
|
||||
// oldResponder->onLoseFirstResponder();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -585,30 +585,30 @@ bool GuiCanvas::tabPrev(void)
|
|||
//save the old
|
||||
GuiControl *oldResponder = mFirstResponder;
|
||||
|
||||
GuiControl* newResponder = ctrl->findPrevTabable(mFirstResponder);
|
||||
if ( !newResponder )
|
||||
GuiControl* newResponder = ctrl->findPrevTabable(mFirstResponder);
|
||||
if ( !newResponder )
|
||||
newResponder = ctrl->findLastTabable();
|
||||
|
||||
if ( newResponder && newResponder != oldResponder )
|
||||
{
|
||||
newResponder->setFirstResponder();
|
||||
|
||||
if ( newResponder && newResponder != oldResponder )
|
||||
{
|
||||
newResponder->setFirstResponder();
|
||||
|
||||
// CodeReview As with tabNext() above, looks like this can now go. DAW - 7/05/09
|
||||
//if ( oldResponder )
|
||||
// oldResponder->onLoseFirstResponder();
|
||||
//if ( oldResponder )
|
||||
// oldResponder->onLoseFirstResponder();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GuiCanvas::processInputEvent(InputEventInfo &inputEvent)
|
||||
{
|
||||
// First call the general input handler (on the extremely off-chance that it will be handled):
|
||||
if (mFirstResponder && mFirstResponder->onInputEvent(inputEvent))
|
||||
// First call the general input handler (on the extremely off-chance that it will be handled):
|
||||
if (mFirstResponder && mFirstResponder->onInputEvent(inputEvent))
|
||||
{
|
||||
return(true);
|
||||
return(true);
|
||||
}
|
||||
|
||||
switch (inputEvent.deviceType)
|
||||
|
|
@ -1786,9 +1786,9 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
|
|||
addUpdateRegion(pos - Point2I(2, 2), Point2I(cext.x + 4, cext.y + 4));
|
||||
}
|
||||
|
||||
mLastCursorEnabled = cursorVisible;
|
||||
mLastCursor = mouseCursor;
|
||||
mLastCursorPt = cursorPos;
|
||||
mLastCursorEnabled = cursorVisible;
|
||||
mLastCursor = mouseCursor;
|
||||
mLastCursorPt = cursorPos;
|
||||
|
||||
// Begin GFX
|
||||
PROFILE_START(GFXBeginScene);
|
||||
|
|
@ -1830,7 +1830,7 @@ void GuiCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
|
|||
|
||||
resetUpdateRegions();
|
||||
|
||||
// Make sure we have a clean matrix state
|
||||
// Make sure we have a clean matrix state
|
||||
// before we start rendering anything!
|
||||
GFX->setWorldMatrix( MatrixF::Identity );
|
||||
GFX->setViewMatrix( MatrixF::Identity );
|
||||
|
|
@ -2039,46 +2039,46 @@ void GuiCanvas::resetUpdateRegions()
|
|||
|
||||
void GuiCanvas::setFirstResponder( GuiControl* newResponder )
|
||||
{
|
||||
GuiControl* oldResponder = mFirstResponder;
|
||||
Parent::setFirstResponder( newResponder );
|
||||
GuiControl* oldResponder = mFirstResponder;
|
||||
Parent::setFirstResponder( newResponder );
|
||||
|
||||
if( oldResponder == mFirstResponder )
|
||||
return;
|
||||
|
||||
if( oldResponder && ( oldResponder != newResponder ) )
|
||||
oldResponder->onLoseFirstResponder();
|
||||
if( oldResponder && ( oldResponder != newResponder ) )
|
||||
oldResponder->onLoseFirstResponder();
|
||||
|
||||
if( newResponder && ( newResponder != oldResponder ) )
|
||||
newResponder->onGainFirstResponder();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, getContent, S32, (),,
|
||||
"@brief Get the GuiControl which is being used as the content.\n\n"
|
||||
"@brief Get the GuiControl which is being used as the content.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"Canvas.getContent();\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"Canvas.getContent();\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@return ID of current content control")
|
||||
"@return ID of current content control")
|
||||
{
|
||||
GuiControl *ctrl = object->getContentControl();
|
||||
GuiControl *ctrl = object->getContentControl();
|
||||
if(ctrl)
|
||||
return ctrl->getId();
|
||||
return -1;
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, setContent, void, (GuiControl* ctrl),,
|
||||
"@brief Set the content of the canvas to a specified control.\n\n"
|
||||
"@brief Set the content of the canvas to a specified control.\n\n"
|
||||
|
||||
"@param ctrl ID or name of GuiControl to set content to\n\n"
|
||||
"@param ctrl ID or name of GuiControl to set content to\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"Canvas.setContent(PlayGui);\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"Canvas.setContent(PlayGui);\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
// Not using old error reporting until we modify the engineAPI - mperry
|
||||
// Not using old error reporting until we modify the engineAPI - mperry
|
||||
|
||||
//GuiControl *gui = NULL;
|
||||
//GuiControl *gui = NULL;
|
||||
// if(argv[2][0])
|
||||
// {
|
||||
// if (!Sim::findObject(argv[2], gui))
|
||||
|
|
@ -2088,11 +2088,11 @@ DefineEngineMethod( GuiCanvas, setContent, void, (GuiControl* ctrl),,
|
|||
// }
|
||||
// }
|
||||
|
||||
if(!ctrl)
|
||||
{
|
||||
Con::errorf("GuiCanvas::setContent - Invalid control specified')");
|
||||
return;
|
||||
}
|
||||
if(!ctrl)
|
||||
{
|
||||
Con::errorf("GuiCanvas::setContent - Invalid control specified')");
|
||||
return;
|
||||
}
|
||||
|
||||
//set the new content control
|
||||
object->setContentControl(ctrl);
|
||||
|
|
@ -2111,11 +2111,11 @@ ConsoleDocFragment _pushDialog(
|
|||
);
|
||||
|
||||
DefineConsoleMethod( GuiCanvas, pushDialog, void, (const char * ctrlName, S32 layer, bool center), ( 0, false), "(GuiControl ctrl, int layer=0, bool center=false)"
|
||||
"@hide")
|
||||
"@hide")
|
||||
{
|
||||
GuiControl *gui;
|
||||
|
||||
if (! Sim::findObject(ctrlName, gui))
|
||||
if (! Sim::findObject(ctrlName, gui))
|
||||
{
|
||||
Con::printf("pushDialog(): Invalid control: %s", ctrlName);
|
||||
return;
|
||||
|
|
@ -2148,7 +2148,7 @@ ConsoleDocFragment _popDialog2(
|
|||
);
|
||||
|
||||
DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType<GuiControl*>()), "(GuiControl ctrl=NULL)"
|
||||
"@hide")
|
||||
"@hide")
|
||||
{
|
||||
if (gui)
|
||||
object->popDialogControl(gui);
|
||||
|
|
@ -2157,160 +2157,160 @@ DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType
|
|||
}
|
||||
|
||||
ConsoleDocFragment _popLayer1(
|
||||
"@brief Removes the top most layer of dialogs\n\n"
|
||||
"@tsexample\n"
|
||||
"Canvas.popLayer();\n"
|
||||
"@endtsexample\n\n",
|
||||
"GuiCanvas",
|
||||
"void popLayer();"
|
||||
"@brief Removes the top most layer of dialogs\n\n"
|
||||
"@tsexample\n"
|
||||
"Canvas.popLayer();\n"
|
||||
"@endtsexample\n\n",
|
||||
"GuiCanvas",
|
||||
"void popLayer();"
|
||||
);
|
||||
|
||||
ConsoleDocFragment _popLayer2(
|
||||
"@brief Removes a specified layer of dialogs\n\n"
|
||||
"@param layer Number of the layer to pop\n\n"
|
||||
"@tsexample\n"
|
||||
"Canvas.popLayer(1);\n"
|
||||
"@endtsexample\n\n",
|
||||
"GuiCanvas",
|
||||
"void popLayer(S32 layer);"
|
||||
"@brief Removes a specified layer of dialogs\n\n"
|
||||
"@param layer Number of the layer to pop\n\n"
|
||||
"@tsexample\n"
|
||||
"Canvas.popLayer(1);\n"
|
||||
"@endtsexample\n\n",
|
||||
"GuiCanvas",
|
||||
"void popLayer(S32 layer);"
|
||||
);
|
||||
|
||||
DefineConsoleMethod( GuiCanvas, popLayer, void, (S32 layer), (0), "(int layer)"
|
||||
"@hide")
|
||||
"@hide")
|
||||
{
|
||||
|
||||
object->popDialogControl(layer);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, cursorOn, void, (),,
|
||||
"@brief Turns on the mouse cursor.\n\n"
|
||||
"@tsexample\n"
|
||||
"Canvas.cursorOn();\n"
|
||||
"@endtsexample\n\n")
|
||||
"@brief Turns on the mouse cursor.\n\n"
|
||||
"@tsexample\n"
|
||||
"Canvas.cursorOn();\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
object->setCursorON(true);
|
||||
object->setCursorON(true);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, cursorOff, void, (),,
|
||||
"@brief Turns on the mouse off.\n\n"
|
||||
"@tsexample\n"
|
||||
"Canvas.cursorOff();\n"
|
||||
"@endtsexample\n\n")
|
||||
"@brief Turns on the mouse off.\n\n"
|
||||
"@tsexample\n"
|
||||
"Canvas.cursorOff();\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
object->setCursorON(false);
|
||||
object->setCursorON(false);
|
||||
}
|
||||
|
||||
|
||||
DefineEngineMethod( GuiCanvas, setCursor, void, (GuiCursor* cursor),,
|
||||
"@brief Sets the cursor for the canvas.\n\n"
|
||||
"@brief Sets the cursor for the canvas.\n\n"
|
||||
|
||||
"@param cursor Name of the GuiCursor to use\n\n"
|
||||
"@param cursor Name of the GuiCursor to use\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"Canvas.setCursor(\"DefaultCursor\");\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"Canvas.setCursor(\"DefaultCursor\");\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
if(!cursor)
|
||||
{
|
||||
Con::errorf("GuiCanvas::setCursor - Invalid GuiCursor name or ID");
|
||||
return;
|
||||
}
|
||||
object->setCursor(cursor);
|
||||
if(!cursor)
|
||||
{
|
||||
Con::errorf("GuiCanvas::setCursor - Invalid GuiCursor name or ID");
|
||||
return;
|
||||
}
|
||||
object->setCursor(cursor);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, renderFront, void, ( bool enable ),,
|
||||
"@brief This turns on/off front-buffer rendering.\n\n"
|
||||
"@brief This turns on/off front-buffer rendering.\n\n"
|
||||
|
||||
"@param enable True if all rendering should be done to the front buffer\n\n"
|
||||
"@param enable True if all rendering should be done to the front buffer\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"Canvas.renderFront(false);\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"Canvas.renderFront(false);\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
object->setRenderFront(enable);
|
||||
object->setRenderFront(enable);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, showCursor, void, (),,
|
||||
"@brief Enable rendering of the cursor.\n\n"
|
||||
"@brief Enable rendering of the cursor.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"Canvas.showCursor();\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"Canvas.showCursor();\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
object->showCursor(true);
|
||||
object->showCursor(true);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, hideCursor, void, (),,
|
||||
"@brief Disable rendering of the cursor.\n\n"
|
||||
"@brief Disable rendering of the cursor.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"Canvas.hideCursor();\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"Canvas.hideCursor();\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
object->showCursor(false);
|
||||
object->showCursor(false);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, isCursorOn, bool, (),,
|
||||
"@brief Determines if mouse cursor is enabled.\n\n"
|
||||
"@brief Determines if mouse cursor is enabled.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Is cursor on?\n"
|
||||
"if(Canvas.isCursorOn())\n"
|
||||
" echo(\"Canvas cursor is on\");\n"
|
||||
"@endtsexample\n\n"
|
||||
"@return Returns true if the cursor is on.\n\n")
|
||||
"@tsexample\n"
|
||||
"// Is cursor on?\n"
|
||||
"if(Canvas.isCursorOn())\n"
|
||||
" echo(\"Canvas cursor is on\");\n"
|
||||
"@endtsexample\n\n"
|
||||
"@return Returns true if the cursor is on.\n\n")
|
||||
{
|
||||
return object->isCursorON();
|
||||
return object->isCursorON();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, isCursorShown, bool, (),,
|
||||
"@brief Determines if mouse cursor is rendering.\n\n"
|
||||
"@brief Determines if mouse cursor is rendering.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Is cursor rendering?\n"
|
||||
"if(Canvas.isCursorShown())\n"
|
||||
" echo(\"Canvas cursor is rendering\");\n"
|
||||
"@endtsexample\n\n"
|
||||
"@return Returns true if the cursor is rendering.\n\n")
|
||||
"@tsexample\n"
|
||||
"// Is cursor rendering?\n"
|
||||
"if(Canvas.isCursorShown())\n"
|
||||
" echo(\"Canvas cursor is rendering\");\n"
|
||||
"@endtsexample\n\n"
|
||||
"@return Returns true if the cursor is rendering.\n\n")
|
||||
{
|
||||
return object->isCursorShown();
|
||||
return object->isCursorShown();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, repaint, void, ( S32 elapsedMS ), (0),
|
||||
"@brief Force canvas to redraw.\n"
|
||||
"@brief Force canvas to redraw.\n"
|
||||
"If the elapsed time is greater than the time since the last paint "
|
||||
"then the repaint will be skipped.\n"
|
||||
"@param elapsedMS The optional elapsed time in milliseconds.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"Canvas.repaint();\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"Canvas.repaint();\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
object->repaint(elapsedMS < 0 ? 0 : elapsedMS);
|
||||
object->repaint(elapsedMS < 0 ? 0 : elapsedMS);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, reset, void, (),,
|
||||
"@brief Reset the update regions for the canvas.\n\n"
|
||||
"@brief Reset the update regions for the canvas.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"Canvas.reset();\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"Canvas.reset();\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
object->resetUpdateRegions();
|
||||
object->resetUpdateRegions();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, getCursorPos, Point2I, (),,
|
||||
"@brief Get the current position of the cursor in screen-space. Note that this position"
|
||||
"@brief Get the current position of the cursor in screen-space. Note that this position"
|
||||
" might be outside the Torque window. If you want to get the position within the Canvas,"
|
||||
" call screenToClient on the result.\n\n"
|
||||
"@see Canvas::screenToClient()\n\n"
|
||||
"@param param Description\n\n"
|
||||
"@tsexample\n"
|
||||
"%cursorPos = Canvas.getCursorPos();\n"
|
||||
"@endtsexample\n\n"
|
||||
"@return Screen coordinates of mouse cursor, in format \"X Y\"")
|
||||
"@param param Description\n\n"
|
||||
"@tsexample\n"
|
||||
"%cursorPos = Canvas.getCursorPos();\n"
|
||||
"@endtsexample\n\n"
|
||||
"@return Screen coordinates of mouse cursor, in format \"X Y\"")
|
||||
{
|
||||
return object->getCursorPos();
|
||||
return object->getCursorPos();
|
||||
}
|
||||
|
||||
ConsoleDocFragment _setCursorPos1(
|
||||
|
|
@ -2334,21 +2334,21 @@ ConsoleDocFragment _setCursorPos2(
|
|||
);
|
||||
|
||||
DefineConsoleMethod( GuiCanvas, setCursorPos, void, (Point2I pos), , "(Point2I pos)"
|
||||
"@hide")
|
||||
"@hide")
|
||||
{
|
||||
|
||||
object->setCursorPos(pos);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),,
|
||||
"@brief Gets the gui control under the mouse.\n\n"
|
||||
"@tsexample\n"
|
||||
"%underMouse = Canvas.getMouseControl();\n"
|
||||
"@endtsexample\n\n"
|
||||
"@brief Gets the gui control under the mouse.\n\n"
|
||||
"@tsexample\n"
|
||||
"%underMouse = Canvas.getMouseControl();\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@return ID of the gui control, if one was found. NULL otherwise")
|
||||
"@return ID of the gui control, if one was found. NULL otherwise")
|
||||
{
|
||||
GuiControl* control = object->getMouseControl();
|
||||
GuiControl* control = object->getMouseControl();
|
||||
if (control)
|
||||
return control->getId();
|
||||
|
||||
|
|
@ -2356,18 +2356,18 @@ DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),,
|
|||
}
|
||||
|
||||
DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),,
|
||||
"@brief Used to exclude/prevent all other instances using the same identifier specified\n\n"
|
||||
"@brief Used to exclude/prevent all other instances using the same identifier specified\n\n"
|
||||
|
||||
"@note Not used on OSX, Xbox, or in Win debug builds\n\n"
|
||||
"@note Not used on OSX, Xbox, or in Win debug builds\n\n"
|
||||
|
||||
"@param appIdentifier Name of the app set up for exclusive use.\n"
|
||||
"@param appIdentifier Name of the app set up for exclusive use.\n"
|
||||
|
||||
"@return False if another app is running that specified the same appIdentifier\n\n"
|
||||
"@return False if another app is running that specified the same appIdentifier\n\n"
|
||||
|
||||
"@ingroup Platform\n"
|
||||
"@ingroup GuiCore")
|
||||
"@ingroup Platform\n"
|
||||
"@ingroup GuiCore")
|
||||
{
|
||||
// mac/360 can only run one instance in general.
|
||||
// mac/360 can only run one instance in general.
|
||||
#if !defined(TORQUE_OS_MAC) && !defined(TORQUE_OS_XENON) && !defined(TORQUE_DEBUG) && !defined(TORQUE_OS_LINUX)
|
||||
return Platform::excludeOtherInstances(appIdentifer);
|
||||
#else
|
||||
|
|
@ -2377,82 +2377,82 @@ DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),,
|
|||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, getExtent, Point2I, (),,
|
||||
"@brief Returns the dimensions of the canvas\n\n"
|
||||
"@brief Returns the dimensions of the canvas\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"%extent = Canvas.getExtent();\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"%extent = Canvas.getExtent();\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@return Width and height of canvas. Formatted as numerical values in a single string \"# #\"")
|
||||
"@return Width and height of canvas. Formatted as numerical values in a single string \"# #\"")
|
||||
{
|
||||
return object->getExtent();
|
||||
return object->getExtent();
|
||||
}
|
||||
|
||||
|
||||
DefineEngineMethod( GuiCanvas, setWindowTitle, void, ( const char* newTitle),,
|
||||
"@brief Change the title of the OS window.\n\n"
|
||||
"@brief Change the title of the OS window.\n\n"
|
||||
|
||||
"@param newTitle String containing the new name\n\n"
|
||||
"@param newTitle String containing the new name\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"Canvas.setWindowTitle(\"Documentation Rocks!\");\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"Canvas.setWindowTitle(\"Documentation Rocks!\");\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
object->setWindowTitle(newTitle);
|
||||
object->setWindowTitle(newTitle);
|
||||
}
|
||||
|
||||
|
||||
DefineEngineMethod( GuiCanvas, findFirstMatchingMonitor, S32, (const char* name),,
|
||||
"@brief Find the first monitor index that matches the given name.\n\n"
|
||||
"@brief Find the first monitor index that matches the given name.\n\n"
|
||||
"The actual match algorithm depends on the implementation.\n"
|
||||
"@param name The name to search for.\n\n"
|
||||
"@return The number of monitors attached to the system, including the default monoitor.")
|
||||
"@return The number of monitors attached to the system, including the default monoitor.")
|
||||
{
|
||||
return PlatformWindowManager::get()->findFirstMatchingMonitor(name);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, getMonitorCount, S32, (),,
|
||||
"@brief Gets the number of monitors attached to the system.\n\n"
|
||||
"@brief Gets the number of monitors attached to the system.\n\n"
|
||||
|
||||
"@return The number of monitors attached to the system, including the default monoitor.")
|
||||
"@return The number of monitors attached to the system, including the default monoitor.")
|
||||
{
|
||||
return PlatformWindowManager::get()->getMonitorCount();
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, getMonitorName, const char*, (S32 index),,
|
||||
"@brief Gets the name of the requested monitor.\n\n"
|
||||
"@brief Gets the name of the requested monitor.\n\n"
|
||||
"@param index The monitor index.\n\n"
|
||||
"@return The name of the requested monitor.")
|
||||
"@return The name of the requested monitor.")
|
||||
{
|
||||
return PlatformWindowManager::get()->getMonitorName(index);
|
||||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, getMonitorRect, RectI, (S32 index),,
|
||||
"@brief Gets the region of the requested monitor.\n\n"
|
||||
"@brief Gets the region of the requested monitor.\n\n"
|
||||
"@param index The monitor index.\n\n"
|
||||
"@return The rectangular region of the requested monitor.")
|
||||
"@return The rectangular region of the requested monitor.")
|
||||
{
|
||||
return PlatformWindowManager::get()->getMonitorRect(index);
|
||||
}
|
||||
|
||||
|
||||
DefineEngineMethod( GuiCanvas, getVideoMode, const char*, (),,
|
||||
"@brief Gets the current screen mode as a string.\n\n"
|
||||
"@brief Gets the current screen mode as a string.\n\n"
|
||||
|
||||
"The return string will contain 5 values (width, height, fullscreen, bitdepth, refreshRate). "
|
||||
"You will need to parse out each one for individual use.\n\n"
|
||||
"The return string will contain 5 values (width, height, fullscreen, bitdepth, refreshRate). "
|
||||
"You will need to parse out each one for individual use.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"%screenWidth = getWord(Canvas.getVideoMode(), 0);\n"
|
||||
"%screenHeight = getWord(Canvas.getVideoMode(), 1);\n"
|
||||
"%isFullscreen = getWord(Canvas.getVideoMode(), 2);\n"
|
||||
"%bitdepth = getWord(Canvas.getVideoMode(), 3);\n"
|
||||
"%refreshRate = getWord(Canvas.getVideoMode(), 4);\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"%screenWidth = getWord(Canvas.getVideoMode(), 0);\n"
|
||||
"%screenHeight = getWord(Canvas.getVideoMode(), 1);\n"
|
||||
"%isFullscreen = getWord(Canvas.getVideoMode(), 2);\n"
|
||||
"%bitdepth = getWord(Canvas.getVideoMode(), 3);\n"
|
||||
"%refreshRate = getWord(Canvas.getVideoMode(), 4);\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@return String formatted with screen width, screen height, screen mode, bit depth, and refresh rate.")
|
||||
"@return String formatted with screen width, screen height, screen mode, bit depth, and refresh rate.")
|
||||
{
|
||||
// Grab the video mode.
|
||||
// Grab the video mode.
|
||||
if (!object->getPlatformWindow())
|
||||
return "";
|
||||
|
||||
|
|
@ -2463,17 +2463,17 @@ DefineEngineMethod( GuiCanvas, getVideoMode, const char*, (),,
|
|||
|
||||
|
||||
DefineEngineMethod( GuiCanvas, getModeCount, S32, (),,
|
||||
"@brief Gets the number of modes available on this device.\n\n"
|
||||
"@brief Gets the number of modes available on this device.\n\n"
|
||||
|
||||
"@param param Description\n\n"
|
||||
"@param param Description\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"%modeCount = Canvas.getModeCount()\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"%modeCount = Canvas.getModeCount()\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@return The number of video modes supported by the device")
|
||||
"@return The number of video modes supported by the device")
|
||||
{
|
||||
if (!object->getPlatformWindow())
|
||||
if (!object->getPlatformWindow())
|
||||
return 0;
|
||||
|
||||
// Grab the available mode list from the device.
|
||||
|
|
@ -2485,12 +2485,12 @@ DefineEngineMethod( GuiCanvas, getModeCount, S32, (),,
|
|||
}
|
||||
|
||||
DefineEngineMethod( GuiCanvas, getMode, const char*, (S32 modeId),,
|
||||
"@brief Gets information on the specified mode of this device.\n\n"
|
||||
"@param modeId Index of the mode to get data from.\n"
|
||||
"@return A video mode string given an adapter and mode index.\n\n"
|
||||
"@see GuiCanvas::getVideoMode()")
|
||||
"@brief Gets information on the specified mode of this device.\n\n"
|
||||
"@param modeId Index of the mode to get data from.\n"
|
||||
"@return A video mode string given an adapter and mode index.\n\n"
|
||||
"@see GuiCanvas::getVideoMode()")
|
||||
{
|
||||
if (!object->getPlatformWindow())
|
||||
if (!object->getPlatformWindow())
|
||||
return 0;
|
||||
|
||||
// Grab the available mode list from the device.
|
||||
|
|
@ -2515,14 +2515,14 @@ DefineEngineMethod( GuiCanvas, getMode, const char*, (S32 modeId),,
|
|||
|
||||
|
||||
DefineEngineMethod( GuiCanvas, toggleFullscreen, void, (),,
|
||||
"@brief toggle canvas from fullscreen to windowed mode or back.\n\n"
|
||||
"@brief toggle canvas from fullscreen to windowed mode or back.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// If we are in windowed mode, the following will put is in fullscreen\n"
|
||||
"Canvas.toggleFullscreen();"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"// If we are in windowed mode, the following will put is in fullscreen\n"
|
||||
"Canvas.toggleFullscreen();"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
if (Platform::getWebDeployment())
|
||||
if (Platform::getWebDeployment())
|
||||
return;
|
||||
|
||||
if (!object->getPlatformWindow())
|
||||
|
|
@ -2693,7 +2693,7 @@ DefineConsoleMethod( GuiCanvas, setVideoMode, void,
|
|||
"\\param fullscreen Specify true to run fullscreen or false to run in a window\n"
|
||||
"\\param bitDepth [optional] The desired bit-depth. Defaults to the current setting. This parameter is ignored if you are running in a window.\n"
|
||||
"\\param refreshRate [optional] The desired refresh rate. Defaults to the current setting. This parameter is ignored if you are running in a window"
|
||||
"\\param antialiasLevel [optional] The level of anti-aliasing to apply 0 = none" )
|
||||
"\\param antialiasLevel [optional] The level of anti-aliasing to apply 0 = none" )
|
||||
{
|
||||
if (!object->getPlatformWindow())
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -716,16 +716,16 @@ void GuiEditCtrl::onRender(Point2I offset, const RectI &updateRect)
|
|||
ctOffset = getCurrentAddSet()->localToGlobalCoord(Point2I(0,0));
|
||||
RectI box(ctOffset.x, ctOffset.y, cext.x, cext.y);
|
||||
|
||||
box.inset( -5, -5 );
|
||||
box.inset( -5, -5 );
|
||||
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
||||
box.inset( 1, 1 );
|
||||
box.inset( 1, 1 );
|
||||
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
||||
box.inset( 1, 1 );
|
||||
box.inset( 1, 1 );
|
||||
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
||||
box.inset( 1, 1 );
|
||||
box.inset( 1, 1 );
|
||||
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
||||
box.inset( 1, 1 );
|
||||
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
||||
box.inset( 1, 1 );
|
||||
drawer->drawRect( box, ColorI( 50, 101, 152, 128 ) );
|
||||
}
|
||||
Vector<GuiControl *>::iterator i;
|
||||
bool multisel = mSelectedControls.size() > 1;
|
||||
|
|
@ -2481,16 +2481,16 @@ DefineConsoleMethod( GuiEditCtrl, getContentControl, S32, (), , "() - Return the
|
|||
|
||||
DefineConsoleMethod( GuiEditCtrl, setContentControl, void, (GuiControl *ctrl ), , "( GuiControl ctrl ) - Set the toplevel control to edit in the GUI editor." )
|
||||
{
|
||||
if (ctrl)
|
||||
object->setContentControl(ctrl);
|
||||
if (ctrl)
|
||||
object->setContentControl(ctrl);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineConsoleMethod( GuiEditCtrl, addNewCtrl, void, (GuiControl *ctrl), , "(GuiControl ctrl)")
|
||||
{
|
||||
if (ctrl)
|
||||
object->addNewControl(ctrl);
|
||||
if (ctrl)
|
||||
object->addNewControl(ctrl);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -2518,7 +2518,7 @@ DefineConsoleMethod( GuiEditCtrl, clearSelection, void, (), , "Clear selected co
|
|||
|
||||
DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiControl ctrl)")
|
||||
{
|
||||
if (ctrl)
|
||||
if (ctrl)
|
||||
object->setSelection(ctrl, false);
|
||||
}
|
||||
|
||||
|
|
@ -2526,7 +2526,7 @@ DefineConsoleMethod( GuiEditCtrl, select, void, (GuiControl *ctrl), , "(GuiContr
|
|||
|
||||
DefineConsoleMethod( GuiEditCtrl, setCurrentAddSet, void, (GuiControl *addSet), , "(GuiControl ctrl)")
|
||||
{
|
||||
if (addSet)
|
||||
if (addSet)
|
||||
object->setCurrentAddSet(addSet);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ ConsoleDocClass( GuiMenuBar,
|
|||
"@tsexample\n"
|
||||
"new GuiMenuBar(newMenuBar)\n"
|
||||
"{\n"
|
||||
" Padding = \"0\";\n"
|
||||
" //Properties not specific to this control have been omitted from this example.\n"
|
||||
" Padding = \"0\";\n"
|
||||
" //Properties not specific to this control have been omitted from this example.\n"
|
||||
"};\n\n"
|
||||
"// Add a menu to the menu bar\n"
|
||||
"newMenuBar.addMenu(0,\"New Menu\");\n\n"
|
||||
|
|
@ -105,7 +105,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMouseInMenu, void, (bool isInMenu),( isInMenu
|
|||
"// Mouse enters or persists within the menu, causing the callback to occur.\n"
|
||||
"GuiMenuBar::onMouseInMenu(%this,%hasLeftMenu)\n"
|
||||
"{\n"
|
||||
" // Code to run when the callback occurs\n"
|
||||
" // Code to run when the callback occurs\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiTickCtrl\n\n"
|
||||
|
|
@ -119,14 +119,14 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMenuSelect, void, ( S32 menuId, const char* me
|
|||
"// A menu has been selected, causing the callback to occur.\n"
|
||||
"GuiMenuBar::onMenuSelect(%this,%menuId,%menuText)\n"
|
||||
"{\n"
|
||||
" // Code to run when the callback occurs\n"
|
||||
" // Code to run when the callback occurs\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiTickCtrl\n\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char* menuText, S32 menuItemId, const char* menuItemText ),
|
||||
( menuId, menuText, menuItemId, menuItemText ),
|
||||
( menuId, menuText, menuItemId, menuItemText ),
|
||||
"@brief Called whenever an item in a menu is selected.\n\n"
|
||||
"@param menuId Index id of the menu which contains the selected menu item\n"
|
||||
"@param menuText Text of the menu which contains the selected menu item\n\n"
|
||||
|
|
@ -136,7 +136,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onMenuItemSelect, void, ( S32 menuId, const char
|
|||
"// A menu item has been selected, causing the callback to occur.\n"
|
||||
"GuiMenuBar::onMenuItemSelect(%this,%menuId,%menuText,%menuItemId,%menuItemText)\n"
|
||||
"{\n"
|
||||
" // Code to run when the callback occurs\n"
|
||||
" // Code to run when the callback occurs\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiTickCtrl\n\n"
|
||||
|
|
@ -149,7 +149,7 @@ IMPLEMENT_CALLBACK( GuiMenuBar, onSubmenuSelect, void, ( S32 submenuId, const ch
|
|||
"@tsexample\n"
|
||||
"GuiMenuBar::onSubmenuSelect(%this,%submenuId,%submenuText)\n"
|
||||
"{\n"
|
||||
" // Code to run when the callback occurs\n"
|
||||
" // Code to run when the callback occurs\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see GuiTickCtrl\n\n"
|
||||
|
|
@ -216,7 +216,7 @@ DefineEngineMethod(GuiMenuBar, addMenu, void, (const char* menuText, S32 menuId)
|
|||
}
|
||||
|
||||
DefineEngineMethod(GuiMenuBar, addMenuItem, void, (const char* targetMenu, const char* menuItemText, S32 menuItemId, const char* accelerator, int checkGroup, const char *cmd),
|
||||
("","",0,nullAsType<const char*>(),-1,""),
|
||||
("","",0,nullAsType<const char*>(),-1,""),
|
||||
"@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n"
|
||||
"@param menu Menu name or menu Id to add the new item to.\n"
|
||||
"@param menuItemText Text for the new menu item.\n"
|
||||
|
|
@ -637,7 +637,7 @@ DefineEngineMethod(GuiMenuBar, setMenuItemSubmenuState, void, (const char* menuT
|
|||
}
|
||||
|
||||
DefineEngineMethod(GuiMenuBar, addSubmenuItem, void, (const char* menuTarget, const char* menuItem, const char* submenuItemText,
|
||||
int submenuItemId, const char* accelerator, int checkGroup),,
|
||||
int submenuItemId, const char* accelerator, int checkGroup),,
|
||||
"@brief Adds a menu item to the specified menu. The menu argument can be either the text of a menu or its id.\n\n"
|
||||
"@param menuTarget Menu to affect a submenu in\n"
|
||||
"@param menuItem Menu item to affect\n"
|
||||
|
|
@ -814,21 +814,21 @@ void GuiMenuBar::addMenu(const char *menuText, U32 menuId)
|
|||
|
||||
GuiMenuBar::Menu *GuiMenuBar::findMenu(const char *menu)
|
||||
{
|
||||
if(dIsdigit(menu[0]))
|
||||
{
|
||||
U32 id = dAtoi(menu);
|
||||
if(dIsdigit(menu[0]))
|
||||
{
|
||||
U32 id = dAtoi(menu);
|
||||
for (U32 i = 0; i < mMenuList.size(); ++i)
|
||||
if (id == mMenuList[i]->id)
|
||||
return mMenuList[i];
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (U32 i = 0; i < mMenuList.size(); ++i)
|
||||
if (!dStricmp(menu, mMenuList[i]->text))
|
||||
return mMenuList[i];
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
GuiMenuBar::MenuItem *GuiMenuBar::findMenuItem(Menu *menu, const char *menuItem)
|
||||
|
|
@ -981,13 +981,13 @@ GuiMenuBar::MenuItem *GuiMenuBar::findSubmenuItem(Menu *menu, const char *menuIt
|
|||
U32 id = dAtoi(menuItem);
|
||||
for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem)
|
||||
if(id == walk->id)
|
||||
{
|
||||
if(walk->isSubmenu && walk->submenu)
|
||||
{
|
||||
{
|
||||
if(walk->isSubmenu && walk->submenu)
|
||||
{
|
||||
return GuiMenuBar::findMenuItem(walk->submenu, submenuItem);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
|
|
@ -995,13 +995,13 @@ GuiMenuBar::MenuItem *GuiMenuBar::findSubmenuItem(Menu *menu, const char *menuIt
|
|||
// Search by name
|
||||
for(MenuItem *walk = menu->firstMenuItem; walk; walk = walk->nextMenuItem)
|
||||
if(!dStricmp(menuItem, walk->text))
|
||||
{
|
||||
if(walk->isSubmenu && walk->submenu)
|
||||
{
|
||||
{
|
||||
if(walk->isSubmenu && walk->submenu)
|
||||
{
|
||||
return GuiMenuBar::findMenuItem(walk->submenu, submenuItem);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -1021,7 +1021,7 @@ void GuiMenuBar::addSubmenuItem(Menu *menu, MenuItem *submenu, const char *text,
|
|||
if(submenu && !submenu->isSubmenu)
|
||||
{
|
||||
Con::errorf("GuiMenuBar::addSubmenuItem: Attempting to add menuitem '%s' to an invalid submenu",text);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
// allocate the new menu item
|
||||
|
|
@ -1074,7 +1074,7 @@ void GuiMenuBar::removeSubmenuItem(MenuItem *menuItem, MenuItem *submenuItem)
|
|||
if(menuItem && !menuItem->isSubmenu)
|
||||
{
|
||||
Con::errorf("GuiMenuBar::removeSubmenuItem: Attempting to remove submenuitem '%s' from an invalid submenu",submenuItem->text);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
GuiMenuBar::removeMenuItem(menuItem->submenu, submenuItem);
|
||||
|
|
@ -1087,7 +1087,7 @@ void GuiMenuBar::clearSubmenuItems(MenuItem *menuitem)
|
|||
if(menuitem && !menuitem->isSubmenu)
|
||||
{
|
||||
Con::errorf("GuiMenuBar::clearSubmenuItems: Attempting to clear an invalid submenu");
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
while(menuitem->submenu->firstMenuItem)
|
||||
|
|
@ -1175,33 +1175,33 @@ void GuiMenuBar::onPreRender()
|
|||
if (!mMenuList[i]->visible)
|
||||
continue;
|
||||
|
||||
// Bounds depends on if there is a bitmap to be drawn or not
|
||||
// Bounds depends on if there is a bitmap to be drawn or not
|
||||
if (mMenuList[i]->bitmapIndex == -1)
|
||||
{
|
||||
{
|
||||
// Text only
|
||||
mMenuList[i]->bounds.set(curX, 0, mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() - (mVerticalMargin * 2));
|
||||
|
||||
} else
|
||||
{
|
||||
{
|
||||
// Will the bitmap and text be draw?
|
||||
if (!mMenuList[i]->drawBitmapOnly)
|
||||
{
|
||||
{
|
||||
// Draw the bitmap and the text
|
||||
RectI *bitmapBounds = mProfile->mBitmapArrayRects.address();
|
||||
mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mProfile->mFont->getStrWidth(mMenuList[i]->text) + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2));
|
||||
|
||||
} else
|
||||
{
|
||||
} else
|
||||
{
|
||||
// Only the bitmap will be drawn
|
||||
RectI *bitmapBounds = mProfile->mBitmapArrayRects.address();
|
||||
mMenuList[i]->bounds.set(curX, 0, bitmapBounds[mMenuList[i]->bitmapIndex].extent.x + mBitmapMargin + (mHorizontalMargin * 2), getHeight() + (mVerticalMargin * 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
curX += mMenuList[i]->bounds.extent.x;
|
||||
}
|
||||
mouseOverMenu = NULL;
|
||||
mouseDownMenu = NULL;
|
||||
mouseOverMenu = NULL;
|
||||
mouseDownMenu = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1222,35 +1222,35 @@ void GuiMenuBar::checkMenuMouseMove(const GuiEvent &event)
|
|||
void GuiMenuBar::onMouseMove(const GuiEvent &event)
|
||||
{
|
||||
Menu *hit = findHitMenu(event.mousePoint);
|
||||
if(hit != mouseOverMenu)
|
||||
{
|
||||
// If we need to, reset the mouse over menu counter and indicate
|
||||
// that we should track it.
|
||||
if(hit)
|
||||
if(hit != mouseOverMenu)
|
||||
{
|
||||
// If we need to, reset the mouse over menu counter and indicate
|
||||
// that we should track it.
|
||||
if(hit)
|
||||
mMouseOverCounter = 0;
|
||||
if(!mCountMouseOver)
|
||||
{
|
||||
if(!mCountMouseOver)
|
||||
{
|
||||
// We've never started the counter, so start it.
|
||||
if(hit)
|
||||
mCountMouseOver = true;
|
||||
}
|
||||
}
|
||||
|
||||
mouseOverMenu = hit;
|
||||
setUpdate();
|
||||
}
|
||||
mouseOverMenu = hit;
|
||||
setUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void GuiMenuBar::onMouseLeave(const GuiEvent &event)
|
||||
{
|
||||
if(mouseOverMenu)
|
||||
setUpdate();
|
||||
mouseOverMenu = NULL;
|
||||
setUpdate();
|
||||
mouseOverMenu = NULL;
|
||||
|
||||
// As we've left the control, don't track how long the mouse has been
|
||||
// within it.
|
||||
if(mCountMouseOver && mMouseOverCounter >= mMouseHoverAmount)
|
||||
{
|
||||
onMouseInMenu_callback(false); // Last parameter indicates if we've entered or left the menu
|
||||
onMouseInMenu_callback(false); // Last parameter indicates if we've entered or left the menu
|
||||
}
|
||||
mCountMouseOver = false;
|
||||
mMouseOverCounter = 0;
|
||||
|
|
@ -1259,38 +1259,38 @@ void GuiMenuBar::onMouseLeave(const GuiEvent &event)
|
|||
void GuiMenuBar::onMouseDragged(const GuiEvent &event)
|
||||
{
|
||||
Menu *hit = findHitMenu(event.mousePoint);
|
||||
|
||||
if(hit != mouseOverMenu)
|
||||
{
|
||||
// If we need to, reset the mouse over menu counter and indicate
|
||||
// that we should track it.
|
||||
if(hit)
|
||||
|
||||
if(hit != mouseOverMenu)
|
||||
{
|
||||
// If we need to, reset the mouse over menu counter and indicate
|
||||
// that we should track it.
|
||||
if(hit)
|
||||
mMouseOverCounter = 0;
|
||||
if(!mCountMouseOver)
|
||||
{
|
||||
if(!mCountMouseOver)
|
||||
{
|
||||
// We've never started the counter, so start it.
|
||||
if(hit)
|
||||
mCountMouseOver = true;
|
||||
}
|
||||
}
|
||||
|
||||
mouseOverMenu = hit;
|
||||
mouseOverMenu = hit;
|
||||
mouseDownMenu = hit;
|
||||
setUpdate();
|
||||
setUpdate();
|
||||
onAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GuiMenuBar::onMouseDown(const GuiEvent &event)
|
||||
{
|
||||
mouseDownMenu = mouseOverMenu = findHitMenu(event.mousePoint);
|
||||
setUpdate();
|
||||
setUpdate();
|
||||
onAction();
|
||||
}
|
||||
|
||||
void GuiMenuBar::onMouseUp(const GuiEvent &event)
|
||||
{
|
||||
mouseDownMenu = NULL;
|
||||
setUpdate();
|
||||
setUpdate();
|
||||
}
|
||||
|
||||
void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
|
||||
|
|
@ -1320,20 +1320,20 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
|
|||
start.x = mMenuList[i]->bounds.point.x + mHorizontalMargin;
|
||||
start.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - mProfile->mFont->getHeight()) / 2;
|
||||
|
||||
// Draw the border
|
||||
// Draw the border
|
||||
if (mMenuList[i]->drawBorder)
|
||||
{
|
||||
{
|
||||
RectI highlightBounds = bounds;
|
||||
highlightBounds.inset(1,1);
|
||||
if (mMenuList[i] == mouseDownMenu)
|
||||
renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL );
|
||||
else if (mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL)
|
||||
renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL);
|
||||
}
|
||||
}
|
||||
|
||||
// Do we draw a bitmap?
|
||||
// Do we draw a bitmap?
|
||||
if (mMenuList[i]->bitmapIndex != -1)
|
||||
{
|
||||
{
|
||||
S32 index = mMenuList[i]->bitmapIndex * 3;
|
||||
if (mMenuList[i] == mouseDownMenu)
|
||||
++index;
|
||||
|
|
@ -1342,24 +1342,24 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
|
|||
|
||||
RectI rect = mProfile->mBitmapArrayRects[index];
|
||||
|
||||
Point2I bitmapstart(start);
|
||||
Point2I bitmapstart(start);
|
||||
bitmapstart.y = mMenuList[i]->bounds.point.y + (mMenuList[i]->bounds.extent.y - rect.extent.y) / 2;
|
||||
|
||||
drawUtil->clearBitmapModulation();
|
||||
drawUtil->drawBitmapSR( mProfile->mTextureObject, offset + bitmapstart, rect);
|
||||
|
||||
// Should we also draw the text?
|
||||
// Should we also draw the text?
|
||||
if (!mMenuList[i]->drawBitmapOnly)
|
||||
{
|
||||
{
|
||||
start.x += mBitmapMargin;
|
||||
drawUtil->setBitmapModulation( fontColor );
|
||||
drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors);
|
||||
}
|
||||
} else
|
||||
{
|
||||
}
|
||||
} else
|
||||
{
|
||||
drawUtil->setBitmapModulation( fontColor );
|
||||
drawUtil->drawText(mProfile->mFont, start + offset, mMenuList[i]->text, mProfile->mFontColors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
renderChildControls( offset, updateRect );
|
||||
|
|
@ -1381,7 +1381,7 @@ void GuiMenuBar::buildWindowAcceleratorMap( WindowInputGenerator &inputGenerator
|
|||
continue;
|
||||
}
|
||||
EventDescriptor accelEvent;
|
||||
ActionMap::createEventDescriptor(item->accelerator, &accelEvent);
|
||||
ActionMap::createEventDescriptor(item->accelerator, &accelEvent);
|
||||
|
||||
//now we have a modifier, and a key, add them to the canvas
|
||||
inputGenerator.addAcceleratorKey( this, item->cmd, accelEvent.eventCode, accelEvent.flags);
|
||||
|
|
@ -1412,7 +1412,7 @@ void GuiMenuBar::acceleratorKeyPress(U32 index)
|
|||
{
|
||||
// first, call the script callback for menu selection:
|
||||
onMenuSelect_callback(mMenuList[i]->id, mMenuList[i]->text);
|
||||
|
||||
|
||||
if(item->visible)
|
||||
menuItemSelected(mMenuList[i], item);
|
||||
return;
|
||||
|
|
@ -1551,15 +1551,15 @@ void GuiMenuTextListCtrl::onMouseUp(const GuiEvent &event)
|
|||
|
||||
void GuiMenuTextListCtrl::onCellHighlighted(Point2I cell)
|
||||
{
|
||||
// If this text list control is part of a submenu, then don't worry about
|
||||
// passing this along
|
||||
if(!isSubMenu)
|
||||
{
|
||||
RectI globalbounds(getBounds());
|
||||
Point2I globalpoint = localToGlobalCoord(globalbounds.point);
|
||||
globalbounds.point = globalpoint;
|
||||
mMenuBarCtrl->highlightedMenuItem(cell.y, globalbounds, mCellSize);
|
||||
}
|
||||
// If this text list control is part of a submenu, then don't worry about
|
||||
// passing this along
|
||||
if(!isSubMenu)
|
||||
{
|
||||
RectI globalbounds(getBounds());
|
||||
Point2I globalpoint = localToGlobalCoord(globalbounds.point);
|
||||
globalbounds.point = globalpoint;
|
||||
mMenuBarCtrl->highlightedMenuItem(cell.y, globalbounds, mCellSize);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -1582,9 +1582,9 @@ bool GuiSubmenuBackgroundCtrl::pointInControl(const Point2I& parentCoordPoint)
|
|||
S32 yt = parentCoordPoint.y - getTop();
|
||||
|
||||
if(findHitControl(Point2I(xt,yt)) == this)
|
||||
return false;
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
return true;
|
||||
// return xt >= 0 && yt >= 0 && xt < getWidth() && yt < getHeight();
|
||||
}
|
||||
|
||||
|
|
@ -1609,7 +1609,7 @@ void GuiMenuBar::onSleep()
|
|||
void GuiMenuBar::closeMenu()
|
||||
{
|
||||
// First close any open submenu
|
||||
closeSubmenu();
|
||||
closeSubmenu();
|
||||
|
||||
// Get the selection from the text list:
|
||||
S32 selectionIndex = mTextList->getSelectedCell().y;
|
||||
|
|
@ -1657,25 +1657,25 @@ void GuiMenuBar::highlightedMenuItem(S32 selectionIndex, const RectI& bounds, Po
|
|||
}
|
||||
|
||||
if(list)
|
||||
{
|
||||
{
|
||||
// If the highlighted item has changed...
|
||||
if(mouseOverSubmenu != list)
|
||||
{
|
||||
{
|
||||
closeSubmenu();
|
||||
mouseOverSubmenu = NULL;
|
||||
|
||||
// Check if this is a submenu. If so, open the submenu.
|
||||
if(list->isSubmenu)
|
||||
{
|
||||
// If there are submenu items, then open the submenu
|
||||
{
|
||||
// If there are submenu items, then open the submenu
|
||||
if(list->submenu->firstMenuItem)
|
||||
{
|
||||
mouseOverSubmenu = list;
|
||||
onSubmenuAction(selstore, bounds, cellSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
mouseOverSubmenu = list;
|
||||
onSubmenuAction(selstore, bounds, cellSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1745,11 +1745,11 @@ void GuiMenuBar::onAction()
|
|||
|
||||
char buf[512];
|
||||
|
||||
// If this menu item is a submenu, then set the isSubmenu to 2 to indicate
|
||||
// an arrow should be drawn. Otherwise set the isSubmenu normally.
|
||||
char isSubmenu = 1;
|
||||
if(walk->isSubmenu)
|
||||
isSubmenu = 2;
|
||||
// If this menu item is a submenu, then set the isSubmenu to 2 to indicate
|
||||
// an arrow should be drawn. Otherwise set the isSubmenu normally.
|
||||
char isSubmenu = 1;
|
||||
if(walk->isSubmenu)
|
||||
isSubmenu = 2;
|
||||
|
||||
char bitmapIndex = 1;
|
||||
if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size()))
|
||||
|
|
@ -1861,8 +1861,8 @@ void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2
|
|||
|
||||
char buf[512];
|
||||
|
||||
// Can't have submenus within submenus.
|
||||
char isSubmenu = 1;
|
||||
// Can't have submenus within submenus.
|
||||
char isSubmenu = 1;
|
||||
|
||||
char bitmapIndex = 1;
|
||||
if(walk->bitmapIndex >= 0 && (walk->bitmapIndex * 3 <= mProfile->mBitmapArrayRects.size()))
|
||||
|
|
@ -1916,7 +1916,7 @@ void GuiMenuBar::onSubmenuAction(S32 selectionIndex, const RectI& bounds, Point2
|
|||
void GuiMenuBar::closeSubmenu()
|
||||
{
|
||||
if(!mSubmenuBackground || !mSubmenuTextList)
|
||||
return;
|
||||
return;
|
||||
|
||||
// Get the selection from the text list:
|
||||
S32 selectionIndex = mSubmenuTextList->getSelectedCell().y;
|
||||
|
|
@ -1934,8 +1934,8 @@ void GuiMenuBar::closeSubmenu()
|
|||
if ( selectionIndex != -1 )
|
||||
{
|
||||
MenuItem *list = NULL;
|
||||
if(mouseOverSubmenu)
|
||||
{
|
||||
if(mouseOverSubmenu)
|
||||
{
|
||||
list = mouseOverSubmenu->submenu->firstMenuItem;
|
||||
|
||||
while(selectionIndex && list)
|
||||
|
|
@ -1943,7 +1943,7 @@ void GuiMenuBar::closeSubmenu()
|
|||
list = list->nextMenuItem;
|
||||
selectionIndex--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(list)
|
||||
menuItemSelected(list->submenuParentMenu, list);
|
||||
}
|
||||
|
|
@ -1981,13 +1981,13 @@ void GuiMenuBar::processTick()
|
|||
{
|
||||
// If we're at a particular number of ticks, notify the script function
|
||||
if(mMouseOverCounter < mMouseHoverAmount)
|
||||
{
|
||||
{
|
||||
++mMouseOverCounter;
|
||||
|
||||
} else if(mMouseOverCounter == mMouseHoverAmount)
|
||||
{
|
||||
} else if(mMouseOverCounter == mMouseHoverAmount)
|
||||
{
|
||||
++mMouseOverCounter;
|
||||
onMouseInMenu_callback(true); // Last parameter indicates if we've entered or left the menu
|
||||
}
|
||||
onMouseInMenu_callback(true); // Last parameter indicates if we've entered or left the menu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
GFXShaderConstHandle *lightInvRadiusSqSC,
|
||||
GFXShaderConstHandle *lightSpotDirSC,
|
||||
GFXShaderConstHandle *lightSpotAngleSC,
|
||||
GFXShaderConstHandle *lightSpotFalloffSC,
|
||||
GFXShaderConstHandle *lightSpotFalloffSC,
|
||||
GFXShaderConstBuffer *shaderConsts )
|
||||
{
|
||||
PROFILE_SCOPE( LightManager_Update4LightConsts );
|
||||
|
|
@ -317,7 +317,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
lightInvRadiusSqSC->isValid() ||
|
||||
lightSpotDirSC->isValid() ||
|
||||
lightSpotAngleSC->isValid() ||
|
||||
lightSpotFalloffSC->isValid() )
|
||||
lightSpotFalloffSC->isValid() )
|
||||
{
|
||||
PROFILE_SCOPE( LightManager_Update4LightConsts_setLights );
|
||||
|
||||
|
|
@ -326,7 +326,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
static AlignedArray<Point4F> lightColors( 4, sizeof( Point4F ) );
|
||||
static Point4F lightInvRadiusSq;
|
||||
static Point4F lightSpotAngle;
|
||||
static Point4F lightSpotFalloff;
|
||||
static Point4F lightSpotFalloff;
|
||||
F32 range;
|
||||
|
||||
// Need to clear the buffers so that we don't leak
|
||||
|
|
@ -359,10 +359,10 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
lightSpotDirs[2][i] = lightDir.z;
|
||||
|
||||
if ( light->getType() == LightInfo::Spot )
|
||||
{
|
||||
{
|
||||
lightSpotAngle[i] = mCos( mDegToRad( light->getOuterConeAngle() / 2.0f ) );
|
||||
lightSpotFalloff[i] = 1.0f / getMax( F32_MIN, mCos( mDegToRad( light->getInnerConeAngle() / 2.0f ) ) - lightSpotAngle[i] );
|
||||
}
|
||||
lightSpotFalloff[i] = 1.0f / getMax( F32_MIN, mCos( mDegToRad( light->getInnerConeAngle() / 2.0f ) ) - lightSpotAngle[i] );
|
||||
}
|
||||
|
||||
// Prescale the light color by the brightness to
|
||||
// avoid doing this in the shader.
|
||||
|
|
@ -379,7 +379,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
|
||||
shaderConsts->setSafe( lightSpotDirSC, lightSpotDirs );
|
||||
shaderConsts->setSafe( lightSpotAngleSC, lightSpotAngle );
|
||||
shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff );
|
||||
shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff );
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ struct NetAddress
|
|||
|
||||
bool isSameAddress(const NetAddress &other) const
|
||||
{
|
||||
if (type != other.type)
|
||||
return false;
|
||||
if (type != other.type)
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
|
@ -102,32 +102,32 @@ struct NetAddress
|
|||
|
||||
bool isSameAddressAndPort(const NetAddress &other) const
|
||||
{
|
||||
if (type != other.type)
|
||||
return false;
|
||||
if (type != other.type)
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case NetAddress::IPAddress:
|
||||
return (dMemcmp(other.address.ipv4.netNum, address.ipv4.netNum, 4) == 0) && other.port == port;
|
||||
break;
|
||||
case NetAddress::IPV6Address:
|
||||
return (dMemcmp(other.address.ipv6.netNum, address.ipv6.netNum, 16) == 0) && other.port == port;
|
||||
break;
|
||||
case NetAddress::IPBroadcastAddress:
|
||||
return true;
|
||||
break;
|
||||
case NetAddress::IPV6MulticastAddress:
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case NetAddress::IPAddress:
|
||||
return (dMemcmp(other.address.ipv4.netNum, address.ipv4.netNum, 4) == 0) && other.port == port;
|
||||
break;
|
||||
case NetAddress::IPV6Address:
|
||||
return (dMemcmp(other.address.ipv6.netNum, address.ipv6.netNum, 16) == 0) && other.port == port;
|
||||
break;
|
||||
case NetAddress::IPBroadcastAddress:
|
||||
return true;
|
||||
break;
|
||||
case NetAddress::IPV6MulticastAddress:
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isEqual(const NetAddress &other) const
|
||||
{
|
||||
if (type != other.type)
|
||||
return false;
|
||||
if (type != other.type)
|
||||
return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
|
@ -193,7 +193,7 @@ struct Net
|
|||
WouldBlock,
|
||||
NotASocket,
|
||||
UnknownError,
|
||||
NeedHostLookup
|
||||
NeedHostLookup
|
||||
};
|
||||
|
||||
enum ConnectionState {
|
||||
|
|
@ -214,11 +214,11 @@ struct Net
|
|||
static bool smMulticastEnabled;
|
||||
static bool smIpv4Enabled;
|
||||
static bool smIpv6Enabled;
|
||||
|
||||
static ConnectionNotifyEvent* smConnectionNotify;
|
||||
static ConnectionAcceptedEvent* smConnectionAccept;
|
||||
static ConnectionReceiveEvent* smConnectionReceive;
|
||||
static PacketReceiveEvent* smPacketReceive;
|
||||
|
||||
static ConnectionNotifyEvent* smConnectionNotify;
|
||||
static ConnectionAcceptedEvent* smConnectionAccept;
|
||||
static ConnectionReceiveEvent* smConnectionReceive;
|
||||
static PacketReceiveEvent* smPacketReceive;
|
||||
|
||||
|
||||
static bool init();
|
||||
|
|
|
|||
|
|
@ -135,26 +135,26 @@ U32 endHighResolutionTimer(U32 time[2])
|
|||
|
||||
|
||||
void startHighResolutionTimer(U32 time[2]) {
|
||||
U64 now = mach_absolute_time();
|
||||
AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]");
|
||||
memcpy(time, &now, sizeof(U64));
|
||||
U64 now = mach_absolute_time();
|
||||
AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]");
|
||||
memcpy(time, &now, sizeof(U64));
|
||||
}
|
||||
|
||||
U32 endHighResolutionTimer(U32 time[2]) {
|
||||
static mach_timebase_info_data_t sTimebaseInfo = {0, 0};
|
||||
|
||||
U64 now = mach_absolute_time();
|
||||
AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]");
|
||||
U64 then;
|
||||
memcpy(&then, time, sizeof(U64));
|
||||
|
||||
if(sTimebaseInfo.denom == 0){
|
||||
mach_timebase_info(&sTimebaseInfo);
|
||||
}
|
||||
// Handle the micros/nanos conversion first, because shedding a few bits is better than overflowing.
|
||||
U64 elapsedMicros = ((now - then) / 1000) * sTimebaseInfo.numer / sTimebaseInfo.denom;
|
||||
|
||||
return (U32)elapsedMicros; // Just truncate, and hope we didn't overflow
|
||||
static mach_timebase_info_data_t sTimebaseInfo = {0, 0};
|
||||
|
||||
U64 now = mach_absolute_time();
|
||||
AssertFatal(sizeof(U32[2]) == sizeof(U64), "Can't pack mach_absolute_time into U32[2]");
|
||||
U64 then;
|
||||
memcpy(&then, time, sizeof(U64));
|
||||
|
||||
if(sTimebaseInfo.denom == 0){
|
||||
mach_timebase_info(&sTimebaseInfo);
|
||||
}
|
||||
// Handle the micros/nanos conversion first, because shedding a few bits is better than overflowing.
|
||||
U64 elapsedMicros = ((now - then) / 1000) * sTimebaseInfo.numer / sTimebaseInfo.denom;
|
||||
|
||||
return (U32)elapsedMicros; // Just truncate, and hope we didn't overflow
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
@ -730,37 +730,37 @@ DefineEngineFunction( profilerMarkerEnable, void, ( const char* markerName, bool
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction( profilerEnable, void, ( bool enable ),,
|
||||
"@brief Enables or disables the profiler.\n\n"
|
||||
"Data is only gathered while the profiler is enabled.\n\n"
|
||||
"@note Profiler is not available in shipping builds.\n"
|
||||
"T3D has predefined profiling areas surrounded by markers, "
|
||||
"but you may need to define additional markers (in C++) around areas you wish to profile,"
|
||||
" by using the PROFILE_START( markerName ); and PROFILE_END(); macros.\n\n"
|
||||
"@ingroup Debugging\n" )
|
||||
"@brief Enables or disables the profiler.\n\n"
|
||||
"Data is only gathered while the profiler is enabled.\n\n"
|
||||
"@note Profiler is not available in shipping builds.\n"
|
||||
"T3D has predefined profiling areas surrounded by markers, "
|
||||
"but you may need to define additional markers (in C++) around areas you wish to profile,"
|
||||
" by using the PROFILE_START( markerName ); and PROFILE_END(); macros.\n\n"
|
||||
"@ingroup Debugging\n" )
|
||||
{
|
||||
if(gProfiler)
|
||||
gProfiler->enable(enable);
|
||||
}
|
||||
|
||||
DefineEngineFunction(profilerDump, void, (),,
|
||||
"@brief Dumps current profiling stats to the console window.\n\n"
|
||||
"@note Markers disabled with profilerMarkerEnable() will be skipped over. "
|
||||
"If the profiler is currently running, it will be disabled.\n"
|
||||
"@ingroup Debugging")
|
||||
"@brief Dumps current profiling stats to the console window.\n\n"
|
||||
"@note Markers disabled with profilerMarkerEnable() will be skipped over. "
|
||||
"If the profiler is currently running, it will be disabled.\n"
|
||||
"@ingroup Debugging")
|
||||
{
|
||||
if(gProfiler)
|
||||
gProfiler->dumpToConsole();
|
||||
}
|
||||
|
||||
DefineEngineFunction( profilerDumpToFile, void, ( const char* fileName ),,
|
||||
"@brief Dumps current profiling stats to a file.\n\n"
|
||||
"@note If the profiler is currently running, it will be disabled.\n"
|
||||
"@param fileName Name and path of file to save profiling stats to. Must use forward slashes (/). "
|
||||
"Will attempt to create the file if it does not already exist.\n"
|
||||
"@tsexample\n"
|
||||
"profilerDumpToFile( \"C:/Torque/log1.txt\" );\n"
|
||||
"@endtsexample\n\n"
|
||||
"@ingroup Debugging" )
|
||||
"@brief Dumps current profiling stats to a file.\n\n"
|
||||
"@note If the profiler is currently running, it will be disabled.\n"
|
||||
"@param fileName Name and path of file to save profiling stats to. Must use forward slashes (/). "
|
||||
"Will attempt to create the file if it does not already exist.\n"
|
||||
"@tsexample\n"
|
||||
"profilerDumpToFile( \"C:/Torque/log1.txt\" );\n"
|
||||
"@endtsexample\n\n"
|
||||
"@ingroup Debugging" )
|
||||
{
|
||||
if(gProfiler)
|
||||
gProfiler->dumpToFile(fileName);
|
||||
|
|
@ -768,9 +768,9 @@ DefineEngineFunction( profilerDumpToFile, void, ( const char* fileName ),,
|
|||
|
||||
DefineEngineFunction( profilerReset, void, (),,
|
||||
"@brief Resets the profiler, clearing it of all its data.\n\n"
|
||||
"If the profiler is currently running, it will first be disabled. "
|
||||
"All markers will retain their current enabled/disabled status.\n\n"
|
||||
"@ingroup Debugging" )
|
||||
"If the profiler is currently running, it will first be disabled. "
|
||||
"All markers will retain their current enabled/disabled status.\n\n"
|
||||
"@ingroup Debugging" )
|
||||
{
|
||||
if(gProfiler)
|
||||
gProfiler->reset();
|
||||
|
|
|
|||
|
|
@ -68,54 +68,54 @@ bool dFileTouch(const char *path)
|
|||
//-----------------------------------------------------------------------------
|
||||
bool dPathCopy(const char* source, const char* dest, bool nooverwrite)
|
||||
{
|
||||
if(source == NULL || dest == NULL)
|
||||
return false;
|
||||
|
||||
@autoreleasepool {
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
|
||||
NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)];
|
||||
NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)];
|
||||
NSString *ndestFolder = [ndest stringByDeletingLastPathComponent];
|
||||
|
||||
if(! [manager fileExistsAtPath:nsource])
|
||||
{
|
||||
Con::errorf("dPathCopy: no file exists at %s",source);
|
||||
return false;
|
||||
}
|
||||
|
||||
if( [manager fileExistsAtPath:ndest] )
|
||||
{
|
||||
if(nooverwrite)
|
||||
{
|
||||
Con::errorf("dPathCopy: file already exists at %s",dest);
|
||||
return false;
|
||||
}
|
||||
Con::warnf("Deleting files at path: %s", dest);
|
||||
if(![manager removeItemAtPath:ndest error:nil] || [manager fileExistsAtPath:ndest])
|
||||
{
|
||||
Con::errorf("Copy failed! Could not delete files at path: %s", dest);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if([manager fileExistsAtPath:ndestFolder] == NO)
|
||||
{
|
||||
ndestFolder = [ndestFolder stringByAppendingString:@"/"]; // createpath requires a trailing slash
|
||||
Platform::createPath([ndestFolder UTF8String]);
|
||||
}
|
||||
|
||||
bool ret = [manager copyItemAtPath:nsource toPath:ndest error:nil];
|
||||
// n.b.: The "success" semantics don't guarantee a copy actually took place, so we'll verify
|
||||
// because this is surprising behavior for a method called copy.
|
||||
if( ![manager fileExistsAtPath:ndest] )
|
||||
{
|
||||
Con::warnf("The filemanager returned success, but the file was not copied. Something strange is happening");
|
||||
ret = false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
if(source == NULL || dest == NULL)
|
||||
return false;
|
||||
|
||||
@autoreleasepool {
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
|
||||
NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)];
|
||||
NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)];
|
||||
NSString *ndestFolder = [ndest stringByDeletingLastPathComponent];
|
||||
|
||||
if(! [manager fileExistsAtPath:nsource])
|
||||
{
|
||||
Con::errorf("dPathCopy: no file exists at %s",source);
|
||||
return false;
|
||||
}
|
||||
|
||||
if( [manager fileExistsAtPath:ndest] )
|
||||
{
|
||||
if(nooverwrite)
|
||||
{
|
||||
Con::errorf("dPathCopy: file already exists at %s",dest);
|
||||
return false;
|
||||
}
|
||||
Con::warnf("Deleting files at path: %s", dest);
|
||||
if(![manager removeItemAtPath:ndest error:nil] || [manager fileExistsAtPath:ndest])
|
||||
{
|
||||
Con::errorf("Copy failed! Could not delete files at path: %s", dest);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if([manager fileExistsAtPath:ndestFolder] == NO)
|
||||
{
|
||||
ndestFolder = [ndestFolder stringByAppendingString:@"/"]; // createpath requires a trailing slash
|
||||
Platform::createPath([ndestFolder UTF8String]);
|
||||
}
|
||||
|
||||
bool ret = [manager copyItemAtPath:nsource toPath:ndest error:nil];
|
||||
// n.b.: The "success" semantics don't guarantee a copy actually took place, so we'll verify
|
||||
// because this is surprising behavior for a method called copy.
|
||||
if( ![manager fileExistsAtPath:ndest] )
|
||||
{
|
||||
Con::warnf("The filemanager returned success, but the file was not copied. Something strange is happening");
|
||||
ret = false;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -124,36 +124,36 @@ bool dFileRename(const char *source, const char *dest)
|
|||
{
|
||||
if(source == NULL || dest == NULL)
|
||||
return false;
|
||||
|
||||
@autoreleasepool {
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
|
||||
NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)];
|
||||
NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)];
|
||||
|
||||
if(! [manager fileExistsAtPath:nsource])
|
||||
{
|
||||
Con::errorf("dFileRename: no file exists at %s",source);
|
||||
return false;
|
||||
}
|
||||
|
||||
if( [manager fileExistsAtPath:ndest] )
|
||||
{
|
||||
Con::warnf("dFileRename: Deleting files at path: %s", dest);
|
||||
}
|
||||
|
||||
bool ret = [manager moveItemAtPath:nsource toPath:ndest error:nil];
|
||||
// n.b.: The "success" semantics don't guarantee a move actually took place, so we'll verify
|
||||
// because this is surprising behavior for a method called rename.
|
||||
|
||||
if( ![manager fileExistsAtPath:ndest] )
|
||||
{
|
||||
Con::warnf("The filemanager returned success, but the file was not moved. Something strange is happening");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@autoreleasepool {
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
|
||||
NSString *nsource = [manager stringWithFileSystemRepresentation:source length:dStrlen(source)];
|
||||
NSString *ndest = [manager stringWithFileSystemRepresentation:dest length:dStrlen(dest)];
|
||||
|
||||
if(! [manager fileExistsAtPath:nsource])
|
||||
{
|
||||
Con::errorf("dFileRename: no file exists at %s",source);
|
||||
return false;
|
||||
}
|
||||
|
||||
if( [manager fileExistsAtPath:ndest] )
|
||||
{
|
||||
Con::warnf("dFileRename: Deleting files at path: %s", dest);
|
||||
}
|
||||
|
||||
bool ret = [manager moveItemAtPath:nsource toPath:ndest error:nil];
|
||||
// n.b.: The "success" semantics don't guarantee a move actually took place, so we'll verify
|
||||
// because this is surprising behavior for a method called rename.
|
||||
|
||||
if( ![manager fileExistsAtPath:ndest] )
|
||||
{
|
||||
Con::warnf("The filemanager returned success, but the file was not moved. Something strange is happening");
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -857,7 +857,7 @@ static bool recurseDumpDirectories(const char *basePath, const char *subPath, Ve
|
|||
|
||||
while (d = readdir(dip))
|
||||
{
|
||||
bool isDir;
|
||||
bool isDir;
|
||||
isDir = false;
|
||||
if (d->d_type == DT_UNKNOWN)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -892,7 +892,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en
|
|||
*info = ri;
|
||||
info->point.interpolate(start, end, info->t);
|
||||
currentT = ri.t;
|
||||
info->distance = (start - info->point).len();
|
||||
info->distance = (start - info->point).len();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -991,7 +991,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en
|
|||
*info = ri;
|
||||
info->point.interpolate(start, end, info->t);
|
||||
currentT = ri.t;
|
||||
info->distance = (start - info->point).len();
|
||||
info->distance = (start - info->point).len();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1088,7 +1088,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en
|
|||
*info = ri;
|
||||
info->point.interpolate(start, end, info->t);
|
||||
currentT = ri.t;
|
||||
info->distance = (start - info->point).len();
|
||||
info->distance = (start - info->point).len();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,138 +36,138 @@
|
|||
IMPLEMENT_CONOBJECT(ActionMap);
|
||||
|
||||
ConsoleDocClass( ActionMap,
|
||||
"@brief ActionMaps assign platform input events to console commands.\n\n"
|
||||
"@brief ActionMaps assign platform input events to console commands.\n\n"
|
||||
|
||||
"Any platform input event can be bound in a single, generic way. In theory, the game doesn't need to know if the event came from the keyboard, mouse, joystick "
|
||||
"or some other input device. This allows users of the game to map keys and actions according to their own preferences. "
|
||||
"Game action maps are arranged in a stack for processing so individual parts of the game can define specific "
|
||||
"actions. For example, when the player jumps into a vehicle it could push a vehicle action map and pop the default player action map.\n\n"
|
||||
"Any platform input event can be bound in a single, generic way. In theory, the game doesn't need to know if the event came from the keyboard, mouse, joystick "
|
||||
"or some other input device. This allows users of the game to map keys and actions according to their own preferences. "
|
||||
"Game action maps are arranged in a stack for processing so individual parts of the game can define specific "
|
||||
"actions. For example, when the player jumps into a vehicle it could push a vehicle action map and pop the default player action map.\n\n"
|
||||
|
||||
"@section ActionMap_creation Creating an ActionMap\n"
|
||||
"@section ActionMap_creation Creating an ActionMap\n"
|
||||
|
||||
"The input system allows for the creation of multiple ActionMaps, so long as they have unique names and do not already exist. It's a simple "
|
||||
"three step process.\n\n"
|
||||
"1. Check to see if the ActionMap exists\n"
|
||||
"2. Delete it if it exists\n"
|
||||
"3. Instantiate the ActionMap\n\n"
|
||||
"The input system allows for the creation of multiple ActionMaps, so long as they have unique names and do not already exist. It's a simple "
|
||||
"three step process.\n\n"
|
||||
"1. Check to see if the ActionMap exists\n"
|
||||
"2. Delete it if it exists\n"
|
||||
"3. Instantiate the ActionMap\n\n"
|
||||
|
||||
"The following is an example of how to create a new ActionMap:\n"
|
||||
"The following is an example of how to create a new ActionMap:\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"if ( isObject( moveMap ) )\n"
|
||||
" moveMap.delete();\n"
|
||||
"new ActionMap(moveMap);"
|
||||
"@endtsexample\n\n\n"
|
||||
|
||||
"@section ActionMap_binding Binding Functions\n"
|
||||
"Once you have created an ActionMap, you can start binding functionality to events. Currently, Torque 3D supports the following devices out of the box\n\n"
|
||||
"* Mouse\n\n"
|
||||
"* Keyboard\n\n"
|
||||
"* Joystick/Gamepad\n\n"
|
||||
"* Xbox 360 Controller\n\n"
|
||||
"@tsexample\n"
|
||||
"if ( isObject( moveMap ) )\n"
|
||||
" moveMap.delete();\n"
|
||||
"new ActionMap(moveMap);"
|
||||
"@endtsexample\n\n\n"
|
||||
|
||||
"@section ActionMap_binding Binding Functions\n"
|
||||
"Once you have created an ActionMap, you can start binding functionality to events. Currently, Torque 3D supports the following devices out of the box\n\n"
|
||||
"* Mouse\n\n"
|
||||
"* Keyboard\n\n"
|
||||
"* Joystick/Gamepad\n\n"
|
||||
"* Xbox 360 Controller\n\n"
|
||||
|
||||
"The two most commonly used binding methods are bind() and bindCmd(). Both are similar in that they will bind functionality to a device and event, "
|
||||
"The two most commonly used binding methods are bind() and bindCmd(). Both are similar in that they will bind functionality to a device and event, "
|
||||
"but different in how the event is interpreted. With bind(), "
|
||||
"you specify a device, action to bind, then a function to be called when the event happens.\n\n"
|
||||
"you specify a device, action to bind, then a function to be called when the event happens.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Simple function that prints to console\n"
|
||||
"// %val - Sent by the device letting the user know\n"
|
||||
"// if an input was pressed (true) or released (false)\n"
|
||||
"function testInput(%val)\n"
|
||||
"{\n"
|
||||
" if(%val)\n"
|
||||
" echo(\"Key is down\");\n"
|
||||
" else\n"
|
||||
" echo(\"Key was released\");\n"
|
||||
"}\n\n"
|
||||
"// Bind the \'K\' key to the testInput function\n"
|
||||
"moveMap.bind(keyboard, \"k\", testInput);\n\n"
|
||||
"@endtsexample\n\n\n"
|
||||
"@tsexample\n"
|
||||
"// Simple function that prints to console\n"
|
||||
"// %val - Sent by the device letting the user know\n"
|
||||
"// if an input was pressed (true) or released (false)\n"
|
||||
"function testInput(%val)\n"
|
||||
"{\n"
|
||||
" if(%val)\n"
|
||||
" echo(\"Key is down\");\n"
|
||||
" else\n"
|
||||
" echo(\"Key was released\");\n"
|
||||
"}\n\n"
|
||||
"// Bind the \'K\' key to the testInput function\n"
|
||||
"moveMap.bind(keyboard, \"k\", testInput);\n\n"
|
||||
"@endtsexample\n\n\n"
|
||||
|
||||
"bindCmd is an alternative method for binding commands. This function is similar to bind(), "
|
||||
"bindCmd is an alternative method for binding commands. This function is similar to bind(), "
|
||||
"except two functions are set to be called when the event is processed.\n\n"
|
||||
"One will be called when the event is activated (input down), while the other is activated when the event is broken (input release). "
|
||||
"One will be called when the event is activated (input down), while the other is activated when the event is broken (input release). "
|
||||
"When using bindCmd(), pass the functions as strings rather than the function names.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Print to the console when the spacebar is pressed\n"
|
||||
"function onSpaceDown()\n"
|
||||
"{\n"
|
||||
" echo(\"Space bar down!\");\n"
|
||||
"}\n\n"
|
||||
"@tsexample\n"
|
||||
"// Print to the console when the spacebar is pressed\n"
|
||||
"function onSpaceDown()\n"
|
||||
"{\n"
|
||||
" echo(\"Space bar down!\");\n"
|
||||
"}\n\n"
|
||||
|
||||
"// Print to the console when the spacebar is released\n"
|
||||
"function onSpaceUp()\n"
|
||||
"{\n"
|
||||
" echo(\"Space bar up!\");\n"
|
||||
"}\n\n"
|
||||
"// Print to the console when the spacebar is released\n"
|
||||
"function onSpaceUp()\n"
|
||||
"{\n"
|
||||
" echo(\"Space bar up!\");\n"
|
||||
"}\n\n"
|
||||
|
||||
"// Bind the commands onSpaceDown and onSpaceUp to spacebar events\n"
|
||||
"moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@section ActionMap_switching Switching ActionMaps\n"
|
||||
"Let's say you want to have different ActionMaps activated based on game play situations. A classic example would be first person shooter controls and racing controls "
|
||||
"in the same game. On foot, spacebar may cause your player to jump. In a vehicle, it may cause some kind of \"turbo charge\". You simply need to push/pop the ActionMaps appropriately:\n\n"
|
||||
"// Bind the commands onSpaceDown and onSpaceUp to spacebar events\n"
|
||||
"moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@section ActionMap_switching Switching ActionMaps\n"
|
||||
"Let's say you want to have different ActionMaps activated based on game play situations. A classic example would be first person shooter controls and racing controls "
|
||||
"in the same game. On foot, spacebar may cause your player to jump. In a vehicle, it may cause some kind of \"turbo charge\". You simply need to push/pop the ActionMaps appropriately:\n\n"
|
||||
|
||||
"First, create two separate ActionMaps:\n\n"
|
||||
"@tsexample\n"
|
||||
"// Create the two ActionMaps\n"
|
||||
"if ( isObject( moveMap ) )\n"
|
||||
" moveMap.delete();\n"
|
||||
"new ActionMap(moveMap);\n\n"
|
||||
"if ( isObject( carMap ) )\n"
|
||||
" carMap.delete();\n"
|
||||
"new ActionMap(carMap);\n\n"
|
||||
"@endtsexample\n\n"
|
||||
"First, create two separate ActionMaps:\n\n"
|
||||
"@tsexample\n"
|
||||
"// Create the two ActionMaps\n"
|
||||
"if ( isObject( moveMap ) )\n"
|
||||
" moveMap.delete();\n"
|
||||
"new ActionMap(moveMap);\n\n"
|
||||
"if ( isObject( carMap ) )\n"
|
||||
" carMap.delete();\n"
|
||||
"new ActionMap(carMap);\n\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"Next, create the two separate functions. Both will be bound to spacebar, but not the same ActionMap:\n\n"
|
||||
"@tsexample\n"
|
||||
"// Print to the console the player is jumping\n"
|
||||
"function playerJump(%val)\n"
|
||||
"{\n"
|
||||
" if(%val)\n"
|
||||
" echo(\"Player jumping!\");\n"
|
||||
"}\n\n"
|
||||
"// Print to the console the vehicle is charging\n"
|
||||
"function turboCharge()\n"
|
||||
"{\n"
|
||||
" if(%val)\n"
|
||||
" echo(\"Vehicle turbo charging!\");\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"You are now ready to bind functions to your ActionMaps' devices:\n\n"
|
||||
"Next, create the two separate functions. Both will be bound to spacebar, but not the same ActionMap:\n\n"
|
||||
"@tsexample\n"
|
||||
"// Print to the console the player is jumping\n"
|
||||
"function playerJump(%val)\n"
|
||||
"{\n"
|
||||
" if(%val)\n"
|
||||
" echo(\"Player jumping!\");\n"
|
||||
"}\n\n"
|
||||
"// Print to the console the vehicle is charging\n"
|
||||
"function turboCharge()\n"
|
||||
"{\n"
|
||||
" if(%val)\n"
|
||||
" echo(\"Vehicle turbo charging!\");\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"You are now ready to bind functions to your ActionMaps' devices:\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Bind the spacebar to the playerJump function\n"
|
||||
"// when moveMap is the active ActionMap\n"
|
||||
"moveMap.bind(keyboard, \"space\", playerJump);\n\n"
|
||||
"// Bind the spacebar to the turboCharge function\n"
|
||||
"// when carMap is the active ActionMap\n"
|
||||
"carMap.bind(keyboard, \"space\", turboCharge);\n"
|
||||
"@endtsexample\n"
|
||||
"@tsexample\n"
|
||||
"// Bind the spacebar to the playerJump function\n"
|
||||
"// when moveMap is the active ActionMap\n"
|
||||
"moveMap.bind(keyboard, \"space\", playerJump);\n\n"
|
||||
"// Bind the spacebar to the turboCharge function\n"
|
||||
"// when carMap is the active ActionMap\n"
|
||||
"carMap.bind(keyboard, \"space\", turboCharge);\n"
|
||||
"@endtsexample\n"
|
||||
|
||||
"Finally, you can use the push() and pop() commands on each ActionMap to toggle activation. To activate an ActionMap, use push():\n\n"
|
||||
"Finally, you can use the push() and pop() commands on each ActionMap to toggle activation. To activate an ActionMap, use push():\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Make moveMap the active action map\n"
|
||||
"// You should now be able to activate playerJump with spacebar\n"
|
||||
"moveMap.push();\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"// Make moveMap the active action map\n"
|
||||
"// You should now be able to activate playerJump with spacebar\n"
|
||||
"moveMap.push();\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"To switch ActionMaps, first pop() the old one. Then you can push() the new one:\n\n"
|
||||
"To switch ActionMaps, first pop() the old one. Then you can push() the new one:\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Deactivate moveMap\n"
|
||||
"moveMap.pop();\n\n"
|
||||
"// Activate carMap\n"
|
||||
"carMap.push();\n\n"
|
||||
"@endtsexample\n\n\n"
|
||||
"@tsexample\n"
|
||||
"// Deactivate moveMap\n"
|
||||
"moveMap.pop();\n\n"
|
||||
"// Activate carMap\n"
|
||||
"carMap.push();\n\n"
|
||||
"@endtsexample\n\n\n"
|
||||
|
||||
"@ingroup Input"
|
||||
|
||||
"@ingroup Input"
|
||||
|
||||
);
|
||||
|
||||
// This is used for determing keys that have ascii codes for the foreign keyboards. IsAlpha doesn't work on foreign keys.
|
||||
|
|
@ -775,32 +775,32 @@ const char* ActionMap::getBinding( const char* command )
|
|||
//
|
||||
const char* ActionMap::getCommand( const char* device, const char* action )
|
||||
{
|
||||
U32 deviceType;
|
||||
U32 deviceInst;
|
||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||
{
|
||||
EventDescriptor eventDescriptor;
|
||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||
{
|
||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||
if ( mapNode )
|
||||
{
|
||||
if ( mapNode->flags & Node::BindCmd )
|
||||
{
|
||||
S32 bufferLen = dStrlen( mapNode->makeConsoleCommand ) + dStrlen( mapNode->breakConsoleCommand ) + 2;
|
||||
char* returnString = Con::getReturnBuffer( bufferLen );
|
||||
dSprintf( returnString, bufferLen, "%s\t%s",
|
||||
( mapNode->makeConsoleCommand ? mapNode->makeConsoleCommand : "" ),
|
||||
( mapNode->breakConsoleCommand ? mapNode->breakConsoleCommand : "" ) );
|
||||
return( returnString );
|
||||
}
|
||||
else
|
||||
return( mapNode->consoleFunction );
|
||||
}
|
||||
}
|
||||
}
|
||||
U32 deviceType;
|
||||
U32 deviceInst;
|
||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||
{
|
||||
EventDescriptor eventDescriptor;
|
||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||
{
|
||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||
if ( mapNode )
|
||||
{
|
||||
if ( mapNode->flags & Node::BindCmd )
|
||||
{
|
||||
S32 bufferLen = dStrlen( mapNode->makeConsoleCommand ) + dStrlen( mapNode->breakConsoleCommand ) + 2;
|
||||
char* returnString = Con::getReturnBuffer( bufferLen );
|
||||
dSprintf( returnString, bufferLen, "%s\t%s",
|
||||
( mapNode->makeConsoleCommand ? mapNode->makeConsoleCommand : "" ),
|
||||
( mapNode->breakConsoleCommand ? mapNode->breakConsoleCommand : "" ) );
|
||||
return( returnString );
|
||||
}
|
||||
else
|
||||
return( mapNode->consoleFunction );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return( "" );
|
||||
return( "" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -808,92 +808,92 @@ const char* ActionMap::getCommand( const char* device, const char* action )
|
|||
// Obviously, this should only be used for axes.
|
||||
bool ActionMap::isInverted( const char* device, const char* action )
|
||||
{
|
||||
U32 deviceType;
|
||||
U32 deviceInst;
|
||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||
{
|
||||
EventDescriptor eventDescriptor;
|
||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||
{
|
||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||
if ( mapNode )
|
||||
return( mapNode->flags & Node::Inverted );
|
||||
}
|
||||
}
|
||||
U32 deviceType;
|
||||
U32 deviceInst;
|
||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||
{
|
||||
EventDescriptor eventDescriptor;
|
||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||
{
|
||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||
if ( mapNode )
|
||||
return( mapNode->flags & Node::Inverted );
|
||||
}
|
||||
}
|
||||
|
||||
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
||||
return( false );
|
||||
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
||||
return( false );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
F32 ActionMap::getScale( const char* device, const char* action )
|
||||
{
|
||||
U32 deviceType;
|
||||
U32 deviceInst;
|
||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||
{
|
||||
EventDescriptor eventDescriptor;
|
||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||
{
|
||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||
if ( mapNode )
|
||||
{
|
||||
if ( mapNode->flags & Node::HasScale )
|
||||
return( mapNode->scaleFactor );
|
||||
U32 deviceType;
|
||||
U32 deviceInst;
|
||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||
{
|
||||
EventDescriptor eventDescriptor;
|
||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||
{
|
||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||
if ( mapNode )
|
||||
{
|
||||
if ( mapNode->flags & Node::HasScale )
|
||||
return( mapNode->scaleFactor );
|
||||
else
|
||||
return( 1.0f );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
||||
return( 1.0f );
|
||||
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
||||
return( 1.0f );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
const char* ActionMap::getDeadZone( const char* device, const char* action )
|
||||
{
|
||||
U32 deviceType;
|
||||
U32 deviceInst;
|
||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||
{
|
||||
EventDescriptor eventDescriptor;
|
||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||
{
|
||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||
if ( mapNode )
|
||||
{
|
||||
if ( mapNode->flags & Node::HasDeadZone )
|
||||
U32 deviceType;
|
||||
U32 deviceInst;
|
||||
if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
|
||||
{
|
||||
EventDescriptor eventDescriptor;
|
||||
if ( createEventDescriptor( action, &eventDescriptor ) )
|
||||
{
|
||||
const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
|
||||
if ( mapNode )
|
||||
{
|
||||
if ( mapNode->flags & Node::HasDeadZone )
|
||||
{
|
||||
char buf[64];
|
||||
dSprintf( buf, sizeof( buf ), "%g %g", mapNode->deadZoneBegin, mapNode->deadZoneEnd );
|
||||
char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 );
|
||||
dStrcpy( returnString, buf );
|
||||
return( returnString );
|
||||
}
|
||||
else
|
||||
return( "0 0" );
|
||||
}
|
||||
}
|
||||
}
|
||||
char buf[64];
|
||||
dSprintf( buf, sizeof( buf ), "%g %g", mapNode->deadZoneBegin, mapNode->deadZoneEnd );
|
||||
char* returnString = Con::getReturnBuffer( dStrlen( buf ) + 1 );
|
||||
dStrcpy( returnString, buf );
|
||||
return( returnString );
|
||||
}
|
||||
else
|
||||
return( "0 0" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
||||
return( "" );
|
||||
Con::errorf( "The input event specified by %s %s is not in this action map!", device, action );
|
||||
return( "" );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
const char* ActionMap::buildActionString( const InputEventInfo* event )
|
||||
{
|
||||
const char* modifierString = getModifierString( event->modifier );
|
||||
const char* modifierString = getModifierString( event->modifier );
|
||||
|
||||
char objectBuffer[64];
|
||||
if ( !getKeyString( event->objInst, objectBuffer ) )
|
||||
return( "" );
|
||||
char objectBuffer[64];
|
||||
if ( !getKeyString( event->objInst, objectBuffer ) )
|
||||
return( "" );
|
||||
|
||||
U32 returnLen = dStrlen( modifierString ) + dStrlen( objectBuffer ) + 2;
|
||||
char* returnString = Con::getReturnBuffer( returnLen );
|
||||
dSprintf( returnString, returnLen - 1, "%s%s", modifierString, objectBuffer );
|
||||
return( returnString );
|
||||
U32 returnLen = dStrlen( modifierString ) + dStrlen( objectBuffer ) + 2;
|
||||
char* returnString = Con::getReturnBuffer( returnLen );
|
||||
dSprintf( returnString, returnLen - 1, "%s%s", modifierString, objectBuffer );
|
||||
return( returnString );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -989,15 +989,15 @@ bool ActionMap::getDeviceName(const U32 deviceType, const U32 deviceInstance, ch
|
|||
//------------------------------------------------------------------------------
|
||||
const char* ActionMap::getModifierString(const U32 modifiers)
|
||||
{
|
||||
U32 realModifiers = modifiers;
|
||||
if ( modifiers & SI_LSHIFT || modifiers & SI_RSHIFT )
|
||||
realModifiers |= SI_SHIFT;
|
||||
if ( modifiers & SI_LCTRL || modifiers & SI_RCTRL )
|
||||
realModifiers |= SI_CTRL;
|
||||
if ( modifiers & SI_LALT || modifiers & SI_RALT )
|
||||
realModifiers |= SI_ALT;
|
||||
if ( modifiers & SI_MAC_LOPT || modifiers & SI_MAC_ROPT )
|
||||
realModifiers |= SI_MAC_OPT;
|
||||
U32 realModifiers = modifiers;
|
||||
if ( modifiers & SI_LSHIFT || modifiers & SI_RSHIFT )
|
||||
realModifiers |= SI_SHIFT;
|
||||
if ( modifiers & SI_LCTRL || modifiers & SI_RCTRL )
|
||||
realModifiers |= SI_CTRL;
|
||||
if ( modifiers & SI_LALT || modifiers & SI_RALT )
|
||||
realModifiers |= SI_ALT;
|
||||
if ( modifiers & SI_MAC_LOPT || modifiers & SI_MAC_ROPT )
|
||||
realModifiers |= SI_MAC_OPT;
|
||||
|
||||
switch (realModifiers & (SI_SHIFT|SI_CTRL|SI_ALT|SI_MAC_OPT))
|
||||
{
|
||||
|
|
@ -1820,19 +1820,19 @@ static ConsoleDocFragment _ActionMapbind1(
|
|||
"@param command The function to bind to the action. Function must have a single boolean argument.\n"
|
||||
"@return True if the binding was successful, false if the device was unknown or description failed.\n\n"
|
||||
"@tsexample\n"
|
||||
"// Simple function that prints to console\n"
|
||||
"// %val - Sent by the device letting the user know\n"
|
||||
"// if an input was pressed (true) or released (false)\n"
|
||||
"function testInput(%val)\n"
|
||||
"{\n"
|
||||
" if(%val)\n"
|
||||
" echo(\"Key is down\");\n"
|
||||
" else\n"
|
||||
" echo(\"Key was released\");\n"
|
||||
"}\n\n"
|
||||
"// Bind the \'K\' key to the testInput function\n"
|
||||
"moveMap.bind(keyboard, k, testInput);\n\n"
|
||||
"@endtsexample\n\n\n",
|
||||
"// Simple function that prints to console\n"
|
||||
"// %val - Sent by the device letting the user know\n"
|
||||
"// if an input was pressed (true) or released (false)\n"
|
||||
"function testInput(%val)\n"
|
||||
"{\n"
|
||||
" if(%val)\n"
|
||||
" echo(\"Key is down\");\n"
|
||||
" else\n"
|
||||
" echo(\"Key was released\");\n"
|
||||
"}\n\n"
|
||||
"// Bind the \'K\' key to the testInput function\n"
|
||||
"moveMap.bind(keyboard, k, testInput);\n\n"
|
||||
"@endtsexample\n\n\n",
|
||||
"ActionMap",
|
||||
"bool bind( string device, string action, string command );");
|
||||
|
||||
|
|
@ -1854,22 +1854,22 @@ static ConsoleDocFragment _ActionMapbind2(
|
|||
"@param command The function bound to the action. Must take in a single argument.\n"
|
||||
"@return True if the binding was successful, false if the device was unknown or description failed.\n\n"
|
||||
"@tsexample\n"
|
||||
"// Simple function that adjusts the pitch of the camera based on the "
|
||||
"// Simple function that adjusts the pitch of the camera based on the "
|
||||
"mouse's movement along the X axis.\n"
|
||||
"function testPitch(%val)\n"
|
||||
"{\n"
|
||||
" %pitchAdj = getMouseAdjustAmount(%val);\n"
|
||||
" $mvPitch += %pitchAdj;\n"
|
||||
"}\n\n"
|
||||
"// Bind the mouse's X axis to the testPitch function\n"
|
||||
"// DI is flagged, meaning input is inverted and has a deadzone\n"
|
||||
"%this.bind( mouse, \"xaxis\", \"DI\", \"-0.23 0.23\", testPitch );\n"
|
||||
"@endtsexample\n\n\n",
|
||||
"function testPitch(%val)\n"
|
||||
"{\n"
|
||||
" %pitchAdj = getMouseAdjustAmount(%val);\n"
|
||||
" $mvPitch += %pitchAdj;\n"
|
||||
"}\n\n"
|
||||
"// Bind the mouse's X axis to the testPitch function\n"
|
||||
"// DI is flagged, meaning input is inverted and has a deadzone\n"
|
||||
"%this.bind( mouse, \"xaxis\", \"DI\", \"-0.23 0.23\", testPitch );\n"
|
||||
"@endtsexample\n\n\n",
|
||||
"ActionMap",
|
||||
"bool bind( string device, string action, string flag, string deadZone, string scale, string command );");
|
||||
|
||||
ConsoleMethod( ActionMap, bind, bool, 5, 10, "actionMap.bind( device, action, [modifier spec, mod...], command )"
|
||||
"@hide")
|
||||
"@hide")
|
||||
{
|
||||
StringStackWrapper args(argc - 2, argv + 2);
|
||||
return object->processBind( args.count(), args, NULL );
|
||||
|
|
@ -1918,7 +1918,7 @@ static ConsoleDocFragment _ActionMapbindObj2(
|
|||
"bool bindObj( string device, string action, string flag, string deadZone, string scale, string command, SimObjectID object );");
|
||||
|
||||
ConsoleMethod( ActionMap, bindObj, bool, 6, 11, "(device, action, [modifier spec, mod...], command, object)"
|
||||
"@hide")
|
||||
"@hide")
|
||||
{
|
||||
SimObject* simObject = Sim::findObject(argv[argc - 1]);
|
||||
if ( simObject == NULL )
|
||||
|
|
@ -1941,20 +1941,20 @@ DefineEngineMethod( ActionMap, bindCmd, bool, ( const char* device, const char*
|
|||
"@param makeCmd The command to execute when the device/action is made.\n"
|
||||
"@param breakCmd [optional] The command to execute when the device or action is unmade.\n"
|
||||
"@return True the bind was successful, false if the device was unknown or description failed.\n"
|
||||
"@tsexample\n"
|
||||
"// Print to the console when the spacebar is pressed\n"
|
||||
"function onSpaceDown()\n"
|
||||
"{\n"
|
||||
" echo(\"Space bar down!\");\n"
|
||||
"}\n\n"
|
||||
"// Print to the console when the spacebar is released\n"
|
||||
"function onSpaceUp()\n"
|
||||
"{\n"
|
||||
" echo(\"Space bar up!\");\n"
|
||||
"}\n\n"
|
||||
"@tsexample\n"
|
||||
"// Print to the console when the spacebar is pressed\n"
|
||||
"function onSpaceDown()\n"
|
||||
"{\n"
|
||||
" echo(\"Space bar down!\");\n"
|
||||
"}\n\n"
|
||||
"// Print to the console when the spacebar is released\n"
|
||||
"function onSpaceUp()\n"
|
||||
"{\n"
|
||||
" echo(\"Space bar up!\");\n"
|
||||
"}\n\n"
|
||||
"// Bind the commands onSpaceDown() and onSpaceUp() to spacebar events\n\n"
|
||||
"moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n"
|
||||
"@endtsexample\n\n")
|
||||
"moveMap.bindCmd(keyboard, \"space\", \"onSpaceDown();\", \"onSpaceUp();\");\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
return object->processBindCmd( device, action, makeCmd, breakCmd );
|
||||
}
|
||||
|
|
@ -1964,9 +1964,9 @@ DefineEngineMethod( ActionMap, unbind, bool, ( const char* device, const char* a
|
|||
"@param device The device to unbind from. Can be a keyboard, mouse, joystick or a gamepad.\n"
|
||||
"@param action The device action to unbind from. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||
"@return True if the unbind was successful, false if the device was unknown or description failed.\n\n"
|
||||
"@tsexample\n"
|
||||
"moveMap.unbind(\"keyboard\", \"space\");\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"moveMap.unbind(\"keyboard\", \"space\");\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
return object->processUnbind( device, action );
|
||||
}
|
||||
|
|
@ -1977,7 +1977,7 @@ DefineEngineMethod( ActionMap, unbindObj, bool, ( const char* device, const char
|
|||
"@param action The device action to unbind from. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||
"@param obj The object to perform unbind against.\n"
|
||||
"@return True if the unbind was successful, false if the device was unknown or description failed.\n"
|
||||
"@tsexample\n"
|
||||
"@tsexample\n"
|
||||
"moveMap.unbindObj(\"keyboard\", \"numpad1\", \"rangeChange\", %player);"
|
||||
"@endtsexample\n\n\n")
|
||||
{
|
||||
|
|
@ -1996,10 +1996,10 @@ DefineEngineMethod( ActionMap, save, void, ( const char* fileName, bool append )
|
|||
"@param fileName The file path to save the ActionMap to. If a filename is not specified "
|
||||
" the ActionMap will be dumped to the console.\n"
|
||||
"@param append Whether to write the ActionMap at the end of the file or overwrite it.\n"
|
||||
"@tsexample\n"
|
||||
"// Write out the actionmap into the config.cs file\n"
|
||||
"@tsexample\n"
|
||||
"// Write out the actionmap into the config.cs file\n"
|
||||
"moveMap.save( \"scripts/client/config.cs\" );"
|
||||
"@endtsexample\n\n")
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
char buffer[1024];
|
||||
|
||||
|
|
@ -2015,7 +2015,7 @@ DefineEngineMethod( ActionMap, save, void, ( const char* fileName, bool append )
|
|||
DefineEngineFunction( getCurrentActionMap, ActionMap*, (),,
|
||||
"@brief Returns the current %ActionMap.\n"
|
||||
"@see ActionMap"
|
||||
"@ingroup Input")
|
||||
"@ingroup Input")
|
||||
{
|
||||
SimSet* pActionMapSet = Sim::getActiveActionMapSet();
|
||||
return dynamic_cast< ActionMap* >( pActionMapSet->last() );
|
||||
|
|
@ -2024,10 +2024,10 @@ DefineEngineFunction( getCurrentActionMap, ActionMap*, (),,
|
|||
DefineEngineMethod( ActionMap, push, void, (),,
|
||||
"@brief Push the ActionMap onto the %ActionMap stack.\n\n"
|
||||
"Activates an ActionMap and placees it at the top of the ActionMap stack.\n\n"
|
||||
"@tsexample\n"
|
||||
"// Make moveMap the active action map\n"
|
||||
"moveMap.push();\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"// Make moveMap the active action map\n"
|
||||
"moveMap.push();\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see ActionMap")
|
||||
{
|
||||
SimSet* pActionMapSet = Sim::getActiveActionMapSet();
|
||||
|
|
@ -2037,10 +2037,10 @@ DefineEngineMethod( ActionMap, push, void, (),,
|
|||
DefineEngineMethod( ActionMap, pop, void, (),,
|
||||
"@brief Pop the ActionMap off the %ActionMap stack.\n\n"
|
||||
"Deactivates an %ActionMap and removes it from the @ActionMap stack.\n"
|
||||
"@tsexample\n"
|
||||
"// Deactivate moveMap\n"
|
||||
"moveMap.pop();\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"// Deactivate moveMap\n"
|
||||
"moveMap.pop();\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see ActionMap")
|
||||
{
|
||||
SimSet* pActionMapSet = Sim::getActiveActionMapSet();
|
||||
|
|
@ -2053,20 +2053,20 @@ DefineEngineMethod( ActionMap, getBinding, const char*, ( const char* command ),
|
|||
"@param command The function to search bindings for.\n"
|
||||
"@return The binding against the specified command. Returns an empty string(\"\") "
|
||||
"if a binding wasn't found.\n"
|
||||
"@tsexample\n"
|
||||
"// Find what the function \"jump()\" is bound to in moveMap\n"
|
||||
"%bind = moveMap.getBinding( \"jump\" );\n\n"
|
||||
"if ( %bind !$= \"\" )\n"
|
||||
"{\n"
|
||||
"// Find out what device is used in the binding\n"
|
||||
" %device = getField( %bind, 0 );\n\n"
|
||||
"// Find out what action (such as a key) is used in the binding\n"
|
||||
" %action = getField( %bind, 1 );\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
"@tsexample\n"
|
||||
"// Find what the function \"jump()\" is bound to in moveMap\n"
|
||||
"%bind = moveMap.getBinding( \"jump\" );\n\n"
|
||||
"if ( %bind !$= \"\" )\n"
|
||||
"{\n"
|
||||
"// Find out what device is used in the binding\n"
|
||||
" %device = getField( %bind, 0 );\n\n"
|
||||
"// Find out what action (such as a key) is used in the binding\n"
|
||||
" %action = getField( %bind, 1 );\n"
|
||||
"}\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see getField")
|
||||
{
|
||||
return object->getBinding( command );
|
||||
return object->getBinding( command );
|
||||
}
|
||||
|
||||
DefineEngineMethod( ActionMap, getCommand, const char*, ( const char* device, const char* action ),,
|
||||
|
|
@ -2074,15 +2074,15 @@ DefineEngineMethod( ActionMap, getCommand, const char*, ( const char* device, co
|
|||
"@param device The device that was bound. Can be a keyboard, mouse, joystick or a gamepad.\n"
|
||||
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||
"@return The command against the specified device and action.\n"
|
||||
"@tsexample\n"
|
||||
"// Find what function is bound to a device\'s action\n"
|
||||
"// In this example, \"jump()\" was assigned to the space key in another script\n"
|
||||
"%command = moveMap.getCommand(\"keyboard\", \"space\");\n\n"
|
||||
"// Should print \"jump\" in the console\n"
|
||||
"echo(%command)\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"// Find what function is bound to a device\'s action\n"
|
||||
"// In this example, \"jump()\" was assigned to the space key in another script\n"
|
||||
"%command = moveMap.getCommand(\"keyboard\", \"space\");\n\n"
|
||||
"// Should print \"jump\" in the console\n"
|
||||
"echo(%command)\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
return object->getCommand( device, action );
|
||||
return object->getCommand( device, action );
|
||||
}
|
||||
|
||||
DefineEngineMethod( ActionMap, isInverted, bool, ( const char* device, const char* action ),,
|
||||
|
|
@ -2091,12 +2091,12 @@ DefineEngineMethod( ActionMap, isInverted, bool, ( const char* device, const cha
|
|||
"@param device The device that was bound. Can be a keyboard, mouse, joystick or a gamepad.\n"
|
||||
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||
"@return True if the specified device and action is inverted.\n"
|
||||
"@tsexample\n"
|
||||
"@tsexample\n"
|
||||
"%if ( moveMap.isInverted( \"mouse\", \"xaxis\"))\n"
|
||||
" echo(\"Mouse's xAxis is inverted\");"
|
||||
"@endtsexample\n\n")
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
return object->isInverted( device, action );
|
||||
return object->isInverted( device, action );
|
||||
}
|
||||
|
||||
DefineEngineMethod( ActionMap, getScale, F32, ( const char* device, const char* action ),,
|
||||
|
|
@ -2104,11 +2104,11 @@ DefineEngineMethod( ActionMap, getScale, F32, ( const char* device, const char*
|
|||
"@param device The device that was bound. Can be keyboard, mouse, joystick or gamepad.\n"
|
||||
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||
"@return Any scaling applied to the specified device and action.\n"
|
||||
"@tsexample\n"
|
||||
"%scale = %moveMap.getScale( \"gamepad\", \"thumbrx\");\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"%scale = %moveMap.getScale( \"gamepad\", \"thumbrx\");\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
return object->getScale( device, action );
|
||||
return object->getScale( device, action );
|
||||
}
|
||||
|
||||
DefineEngineMethod( ActionMap, getDeadZone, const char*, ( const char* device, const char* action ),,
|
||||
|
|
@ -2117,11 +2117,11 @@ DefineEngineMethod( ActionMap, getDeadZone, const char*, ( const char* device, c
|
|||
"@param action The device action that was bound. The action is dependant upon the device. Specify a key for keyboards.\n"
|
||||
"@return The dead zone for the specified device and action. Returns \"0 0\" if there is no dead zone "
|
||||
"or an empty string(\"\") if the mapping was not found.\n"
|
||||
"@tsexample\n"
|
||||
"%deadZone = moveMap.getDeadZone( \"gamepad\", \"thumbrx\");\n"
|
||||
"@endtsexample\n\n")
|
||||
"@tsexample\n"
|
||||
"%deadZone = moveMap.getDeadZone( \"gamepad\", \"thumbrx\");\n"
|
||||
"@endtsexample\n\n")
|
||||
{
|
||||
return object->getDeadZone( device, action );
|
||||
return object->getDeadZone( device, action );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public:
|
|||
{
|
||||
eCommandType type; // Command type
|
||||
StringTableEntry name; // Command name
|
||||
static constexpr U32 MAX_ARGS = 10;
|
||||
static constexpr U32 MAX_ARGS = 10;
|
||||
String argv[MAX_ARGS]; // Command arguments
|
||||
S32 argc; // Number of arguments
|
||||
Command() : type(CmdInvalid), name(0), argc(0) { }
|
||||
|
|
@ -106,12 +106,12 @@ public:
|
|||
{
|
||||
name = StringTable->insert( _name );
|
||||
}
|
||||
|
||||
// Helper functions to fill in the command arguments
|
||||
template<typename ...ArgTs> inline void addArgs(ArgTs ...args){
|
||||
using Helper = engineAPI::detail::MarshallHelpers<String>;
|
||||
Helper::marshallEach(argc, argv, args...);
|
||||
}
|
||||
|
||||
// Helper functions to fill in the command arguments
|
||||
template<typename ...ArgTs> inline void addArgs(ArgTs ...args){
|
||||
using Helper = engineAPI::detail::MarshallHelpers<String>;
|
||||
Helper::marshallEach(argc, argv, args...);
|
||||
}
|
||||
};
|
||||
|
||||
Vector<Command> mCommands;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue