mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-28 15:55:39 +00:00
Eliminate unnecessary uses of ConsoleFunction
This commit is contained in:
parent
6be736ff85
commit
2bbc716db6
12 changed files with 103 additions and 158 deletions
|
|
@ -2722,33 +2722,32 @@ void GameConnection::resetDatablockCache()
|
||||||
afx_saved_db_cache_CRC = 0xffffffff;
|
afx_saved_db_cache_CRC = 0xffffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction(resetDatablockCache, void, 1, 1, "resetDatablockCache()")
|
DefineEngineFunction(resetDatablockCache, void, (),,"")
|
||||||
{
|
{
|
||||||
GameConnection::resetDatablockCache();
|
GameConnection::resetDatablockCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction(isDatablockCacheSaved, bool, 1, 1, "resetDatablockCache()")
|
DefineEngineFunction(isDatablockCacheSaved, bool, (),,"")
|
||||||
{
|
{
|
||||||
return afx_saved_db_cache;
|
return afx_saved_db_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction(getDatablockCacheCRC, S32, 1, 1, "getDatablockCacheCRC()")
|
DefineEngineFunction(getDatablockCacheCRC, S32, (),,"")
|
||||||
{
|
{
|
||||||
return (S32)afx_saved_db_cache_CRC;
|
return (S32)afx_saved_db_cache_CRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction(extractDatablockCacheCRC, S32, 2, 2, "extractDatablockCacheCRC(filename)")
|
DefineEngineFunction(extractDatablockCacheCRC, S32, (const char* fileName),,"")
|
||||||
{
|
{
|
||||||
FileStream f_stream;
|
FileStream f_stream;
|
||||||
const char* fileName = argv[1];
|
if (!f_stream.open(fileName, Torque::FS::File::Read))
|
||||||
if(!f_stream.open(fileName, Torque::FS::File::Read))
|
|
||||||
{
|
{
|
||||||
Con::errorf("Failed to open file '%s'.", fileName);
|
Con::errorf("Failed to open file '%s'.", fileName);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 stream_sz = f_stream.getStreamSize();
|
U32 stream_sz = f_stream.getStreamSize();
|
||||||
if (stream_sz < 4*32)
|
if (stream_sz < 4 * 32)
|
||||||
{
|
{
|
||||||
Con::errorf("File '%s' is not a valid datablock cache.", fileName);
|
Con::errorf("File '%s' is not a valid datablock cache.", fileName);
|
||||||
f_stream.close();
|
f_stream.close();
|
||||||
|
|
@ -2777,17 +2776,16 @@ ConsoleFunction(extractDatablockCacheCRC, S32, 2, 2, "extractDatablockCacheCRC(f
|
||||||
return (S32)crc_code;
|
return (S32)crc_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction(setDatablockCacheCRC, void, 2, 2, "setDatablockCacheCRC(crc)")
|
DefineEngineFunction(setDatablockCacheCRC, void, (U32 crc), , "")
|
||||||
{
|
{
|
||||||
GameConnection *conn = GameConnection::getConnectionToServer();
|
GameConnection *conn = GameConnection::getConnectionToServer();
|
||||||
if(!conn)
|
if (!conn)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
U32 crc_u = (U32)dAtoi(argv[1]);
|
conn->setServerCacheCRC(crc);
|
||||||
conn->setServerCacheCRC(crc_u);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleMethod( GameConnection, saveDatablockCache, void, 2, 2, "saveDatablockCache()")
|
DefineEngineMethod(GameConnection, saveDatablockCache, void, (),, "")
|
||||||
{
|
{
|
||||||
if (GameConnection::serverCacheEnabled() && !afx_saved_db_cache)
|
if (GameConnection::serverCacheEnabled() && !afx_saved_db_cache)
|
||||||
{
|
{
|
||||||
|
|
@ -2802,14 +2800,14 @@ ConsoleMethod( GameConnection, saveDatablockCache, void, 2, 2, "saveDatablockCac
|
||||||
Con::expandScriptFilename(filename_buffer, sizeof(filename_buffer), filename.c_str());
|
Con::expandScriptFilename(filename_buffer, sizeof(filename_buffer), filename.c_str());
|
||||||
Torque::Path givenPath(Torque::Path::CompressPath(filename_buffer));
|
Torque::Path givenPath(Torque::Path::CompressPath(filename_buffer));
|
||||||
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(givenPath);
|
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(givenPath);
|
||||||
if ( fileRef == NULL )
|
if (fileRef == NULL)
|
||||||
Con::errorf("saveDatablockCache() failed to get CRC for file '%s'.", filename.c_str());
|
Con::errorf("saveDatablockCache() failed to get CRC for file '%s'.", filename.c_str());
|
||||||
else
|
else
|
||||||
afx_saved_db_cache_CRC = (S32)fileRef->getChecksum();
|
afx_saved_db_cache_CRC = (S32)fileRef->getChecksum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleMethod( GameConnection, loadDatablockCache, void, 2, 2, "loadDatablockCache()")
|
DefineEngineMethod(GameConnection, loadDatablockCache, void, (),, "")
|
||||||
{
|
{
|
||||||
if (GameConnection::clientCacheEnabled())
|
if (GameConnection::clientCacheEnabled())
|
||||||
{
|
{
|
||||||
|
|
@ -2817,7 +2815,7 @@ ConsoleMethod( GameConnection, loadDatablockCache, void, 2, 2, "loadDatablockCac
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleMethod( GameConnection, loadDatablockCache_Begin, bool, 2, 2, "loadDatablockCache_Begin()")
|
DefineEngineMethod(GameConnection, loadDatablockCache_Begin, bool, (),, "")
|
||||||
{
|
{
|
||||||
if (GameConnection::clientCacheEnabled())
|
if (GameConnection::clientCacheEnabled())
|
||||||
{
|
{
|
||||||
|
|
@ -2827,7 +2825,7 @@ ConsoleMethod( GameConnection, loadDatablockCache_Begin, bool, 2, 2, "loadDatabl
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleMethod( GameConnection, loadDatablockCache_Continue, bool, 2, 2, "loadDatablockCache_Continue()")
|
DefineEngineMethod(GameConnection, loadDatablockCache_Continue, bool, (),, "")
|
||||||
{
|
{
|
||||||
if (GameConnection::clientCacheEnabled())
|
if (GameConnection::clientCacheEnabled())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -584,69 +584,33 @@ DefineEngineFunction(getRandomDir, Point3F, (Point3F axis, float thetaMin, float
|
||||||
return MathUtils::randomDir(axis, thetaMin, thetaMax, phiMin, phiMax);
|
return MathUtils::randomDir(axis, thetaMin, thetaMax, phiMin, phiMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction( MatrixInverseMulVector, const char*, 3, 3, "(MatrixF xfrm, Point3F vector)"
|
DefineEngineFunction(MatrixInverseMulVector, Point3F, (MatrixF xfrm, Point3F vector),,
|
||||||
"@brief Multiply the vector by the affine inverse of the transform.\n\n"
|
"@brief Multiply the vector by the affine inverse of the transform.\n\n"
|
||||||
"@ingroup AFX")
|
"@ingroup AFX")
|
||||||
{
|
{
|
||||||
Point3F pos1(0.0f,0.0f,0.0f);
|
xfrm.affineInverse();
|
||||||
AngAxisF aa1(Point3F(0.0f,0.0f,0.0f),0.0f);
|
|
||||||
dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle);
|
|
||||||
|
|
||||||
MatrixF temp1(true);
|
|
||||||
aa1.setMatrix(&temp1);
|
|
||||||
temp1.setColumn(3, pos1);
|
|
||||||
|
|
||||||
Point3F vec1(0.0f,0.0f,0.0f);
|
|
||||||
dSscanf(argv[2], "%g %g %g", &vec1.x, &vec1.y, &vec1.z);
|
|
||||||
|
|
||||||
temp1.affineInverse();
|
|
||||||
|
|
||||||
Point3F result;
|
Point3F result;
|
||||||
temp1.mulV(vec1, &result);
|
xfrm.mulV(vector, &result);
|
||||||
|
|
||||||
char* ret = Con::getReturnBuffer(256);
|
return result;
|
||||||
dSprintf(ret, 255, "%g %g %g", result.x, result.y, result.z);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction(moveTransformAbs, const char*, 3, 3, "(MatrixF xfrm, Point3F pos)"
|
DefineEngineFunction(moveTransformAbs, MatrixF, (MatrixF xfrm, Point3F pos),,
|
||||||
"@brief Move the transform to the new absolute position.\n\n"
|
"@brief Move the transform to the new absolute position.\n\n"
|
||||||
"@ingroup AFX")
|
"@ingroup AFX")
|
||||||
{
|
{
|
||||||
Point3F pos1(0.0f,0.0f,0.0f);
|
xfrm.setPosition(pos);
|
||||||
AngAxisF aa1(Point3F(0.0f,0.0f,0.0f),0.0f);
|
return xfrm;
|
||||||
dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle);
|
|
||||||
|
|
||||||
Point3F pos2(0.0f,0.0f,0.0f);
|
|
||||||
dSscanf(argv[2], "%g %g %g", &pos2.x, &pos2.y, &pos2.z);
|
|
||||||
|
|
||||||
char* returnBuffer = Con::getReturnBuffer(256);
|
|
||||||
dSprintf(returnBuffer, 255, "%g %g %g %g %g %g %g",
|
|
||||||
pos2.x, pos2.y, pos2.z,
|
|
||||||
aa1.axis.x, aa1.axis.y, aa1.axis.z,
|
|
||||||
aa1.angle);
|
|
||||||
return returnBuffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction(moveTransformRel, const char*, 3, 3, "(MatrixF xfrm, Point3F pos)"
|
DefineEngineFunction(moveTransformRel, MatrixF, (MatrixF xfrm, Point3F pos),,
|
||||||
"@brief Move the transform to the new relative position.\n\n"
|
"@brief Move the transform to the new relative position.\n\n"
|
||||||
"@ingroup AFX")
|
"@ingroup AFX")
|
||||||
{
|
{
|
||||||
Point3F pos1(0.0f,0.0f,0.0f);
|
pos += xfrm.getPosition();
|
||||||
AngAxisF aa1(Point3F(0.0f,0.0f,0.0f),0.0f);
|
xfrm.setPosition(pos);
|
||||||
dSscanf(argv[1], "%g %g %g %g %g %g %g", &pos1.x, &pos1.y, &pos1.z, &aa1.axis.x, &aa1.axis.y, &aa1.axis.z, &aa1.angle);
|
return xfrm;
|
||||||
|
|
||||||
Point3F pos2(0.0f,0.0f,0.0f);
|
|
||||||
dSscanf(argv[2], "%g %g %g", &pos2.x, &pos2.y, &pos2.z);
|
|
||||||
|
|
||||||
pos2 += pos1;
|
|
||||||
|
|
||||||
char* returnBuffer = Con::getReturnBuffer(256);
|
|
||||||
dSprintf(returnBuffer, 255, "%g %g %g %g %g %g %g",
|
|
||||||
pos2.x, pos2.y, pos2.z,
|
|
||||||
aa1.axis.x, aa1.axis.y, aa1.axis.z,
|
|
||||||
aa1.angle);
|
|
||||||
return returnBuffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineEngineFunction(getFreeTargetPosition, Point3F, (),,
|
DefineEngineFunction(getFreeTargetPosition, Point3F, (),,
|
||||||
|
|
|
||||||
|
|
@ -218,8 +218,10 @@ DefineEngineFunction( getRealTime, S32, (), , "()"
|
||||||
return Platform::getRealMilliseconds();
|
return Platform::getRealMilliseconds();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction( getLocalTime, const char *, 1, 1, "Return the current local time as: weekday month day year hour min sec.\n\n"
|
DefineEngineFunction(getLocalTime, const char*, (),,
|
||||||
"Local time is platform defined.")
|
"@brief Return the current local time as: weekday month day year hour min sec.\n\n"
|
||||||
|
"Local time is platform defined."
|
||||||
|
"@ingroup Platform")
|
||||||
{
|
{
|
||||||
Platform::LocalTime lt;
|
Platform::LocalTime lt;
|
||||||
Platform::getLocalTime(lt);
|
Platform::getLocalTime(lt);
|
||||||
|
|
|
||||||
|
|
@ -2646,26 +2646,23 @@ DefineEngineFunction( getPrefsPath, const char *, ( const char* relativeFileName
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ConsoleFunction( execPrefs, bool, 2, 4, "( string relativeFileName, bool noCalls=false, bool journalScript=false )"
|
DefineEngineFunction(execPrefs, bool, (const char* relativeFileName, bool noCalls, bool journalScript),(false, false),
|
||||||
"@brief Manually execute a special script file that contains game or editor preferences\n\n"
|
"@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 relativeFileName Name and path to file from project folder\n"
|
||||||
"@param noCalls Deprecated\n"
|
"@param noCalls Deprecated\n"
|
||||||
"@param journalScript Deprecated\n"
|
"@param journalScript Deprecated\n"
|
||||||
"@return True if script was successfully executed\n"
|
"@return True if script was successfully executed\n"
|
||||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||||
"@ingroup Scripting")
|
"@ingroup Scripting")
|
||||||
{
|
{
|
||||||
const char *filename = Platform::getPrefsPath(argv[1]);
|
if (relativeFileName == NULL || *relativeFileName == 0)
|
||||||
if(filename == NULL || *filename == 0)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Scripts do this a lot, so we may as well help them out
|
// Scripts do this a lot, so we may as well help them out
|
||||||
if(! Platform::isFile(filename) && ! Torque::FS::IsFile(filename))
|
if (!Platform::isFile(relativeFileName) && !Torque::FS::IsFile(relativeFileName))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
argv[0] = "exec";
|
return Con::executeFile(relativeFileName, noCalls, journalScript);
|
||||||
argv[1] = filename;
|
|
||||||
return dAtob(Con::execute(argc, argv));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include "core/tSimpleHashTable.h"
|
#include "core/tSimpleHashTable.h"
|
||||||
#include "core/strings/stringFunctions.h"
|
#include "core/strings/stringFunctions.h"
|
||||||
#include "core/stringTable.h"
|
#include "core/stringTable.h"
|
||||||
#include "console/console.h"
|
#include "console/engineAPI.h"
|
||||||
#include "console/compiler.h"
|
#include "console/compiler.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -342,28 +342,26 @@ bool collapseScriptFilename(char *filename, U32 size, const char *src)
|
||||||
// Console Functions
|
// Console Functions
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ConsoleFunction(expandFilename, const char*, 2, 2, "(string filename)"
|
DefineEngineFunction(expandFilename, const char*, (const char* filename),,
|
||||||
"@brief Grabs the full path of a specified file\n\n"
|
"@brief Grabs the full path of a specified file\n\n"
|
||||||
"@param filename Name of the local file to locate\n"
|
"@param filename Name of the local file to locate\n"
|
||||||
"@return String containing the full filepath on disk\n"
|
"@return String containing the full filepath on disk\n"
|
||||||
"@ingroup FileSystem")
|
"@ingroup FileSystem")
|
||||||
{
|
{
|
||||||
TORQUE_UNUSED(argc);
|
|
||||||
static const U32 bufSize = 1024;
|
static const U32 bufSize = 1024;
|
||||||
char* ret = Con::getReturnBuffer( bufSize );
|
char* ret = Con::getReturnBuffer(bufSize);
|
||||||
Con::expandScriptFilename(ret, bufSize, argv[1]);
|
Con::expandScriptFilename(ret, bufSize, filename);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction(expandOldFilename, const char*, 2, 2, "(string filename)"
|
DefineEngineFunction(expandOldFilename, const char*, (const char* filename),,
|
||||||
"@brief Retrofits a filepath that uses old Torque style\n\n"
|
"@brief Retrofits a filepath that uses old Torque style\n\n"
|
||||||
"@return String containing filepath with new formatting\n"
|
"@return String containing filepath with new formatting\n"
|
||||||
"@ingroup FileSystem")
|
"@ingroup FileSystem")
|
||||||
{
|
{
|
||||||
TORQUE_UNUSED(argc);
|
|
||||||
static const U32 bufSize = 1024;
|
static const U32 bufSize = 1024;
|
||||||
char* ret = Con::getReturnBuffer( bufSize );
|
char* ret = Con::getReturnBuffer(bufSize);
|
||||||
Con::expandOldScriptFilename(ret, bufSize, argv[1]);
|
Con::expandOldScriptFilename(ret, bufSize, filename);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -536,80 +536,67 @@ float LinearColorF::sSrgbToLinear[256] =
|
||||||
#endif
|
#endif
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ConsoleFunction( getStockColorCount, S32, 1, 1, "() - Gets a count of available stock colors.\n"
|
DefineEngineFunction(getStockColorCount, S32, (),,
|
||||||
"@return A count of available stock colors." )
|
"@brief Gets a count of available stock colors.\n"
|
||||||
|
"@return A count of available stock colors.")
|
||||||
{
|
{
|
||||||
return StockColor::getCount();
|
return StockColor::getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ConsoleFunction( getStockColorName, const char*, 2, 2, "(stockColorIndex) - Gets the stock color name at the specified index.\n"
|
DefineEngineFunction(getStockColorName, const char*, (S32 stockColorIndex),,
|
||||||
|
"@brief Gets the stock color name at the specified index.\n"
|
||||||
"@param stockColorIndex The zero-based index of the stock color name to retrieve.\n"
|
"@param stockColorIndex The zero-based index of the stock color name to retrieve.\n"
|
||||||
"@return The stock color name at the specified index or nothing if the string is invalid." )
|
"@return The stock color name at the specified index or nothing if the string is invalid.")
|
||||||
{
|
{
|
||||||
// Fetch stock color index.
|
|
||||||
const S32 stockColorIndex = dAtoi(argv[1]);
|
|
||||||
|
|
||||||
// Fetch the color item.
|
// Fetch the color item.
|
||||||
const StockColorItem* pColorItem = StockColor::getColorItem( stockColorIndex );
|
const StockColorItem* pColorItem = StockColor::getColorItem(stockColorIndex);
|
||||||
|
|
||||||
return pColorItem == NULL ? NULL : pColorItem->getColorName();
|
return pColorItem == NULL ? NULL : pColorItem->getColorName();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ConsoleFunction( isStockColor, bool, 2, 2, "(stockColorName) - Gets whether the specified name is a stock color or not.\n"
|
DefineEngineFunction(isStockColor, bool, (const char* stockColorName),,
|
||||||
|
"@brief Gets whether the specified name is a stock color or not.\n"
|
||||||
"@param stockColorName - The stock color name to test for.\n"
|
"@param stockColorName - The stock color name to test for.\n"
|
||||||
"@return Whether the specified name is a stock color or not.\n" )
|
"@return Whether the specified name is a stock color or not.\n")
|
||||||
{
|
{
|
||||||
// Fetch stock color name.
|
|
||||||
const char* pStockColorName = argv[1];
|
|
||||||
|
|
||||||
// Return whether this is a stock color name or not.
|
// Return whether this is a stock color name or not.
|
||||||
return StockColor::isColor( pStockColorName );
|
return StockColor::isColor(stockColorName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ConsoleFunction( getStockColorF, const char*, 2, 2, "(stockColorName) - Gets a floating-point-based stock color by name.\n"
|
DefineEngineFunction(getStockColorF, LinearColorF, (const char* stockColorName),,
|
||||||
|
"@brief Gets a floating-point-based stock color by name.\n"
|
||||||
"@param stockColorName - The stock color name to retrieve.\n"
|
"@param stockColorName - The stock color name to retrieve.\n"
|
||||||
"@return The stock color that matches the specified color name. Returns nothing if the color name is not found.\n" )
|
"@return The stock color that matches the specified color name. Returns nothing if the color name is not found.\n")
|
||||||
{
|
{
|
||||||
// Fetch stock color name.
|
|
||||||
const char* pStockColorName = argv[1];
|
|
||||||
|
|
||||||
// Return nothing if stock color name is invalid.
|
// Return nothing if stock color name is invalid.
|
||||||
if ( !StockColor::isColor( pStockColorName ) )
|
if (!StockColor::isColor(stockColorName))
|
||||||
return StringTable->EmptyString();
|
return StringTable->EmptyString();
|
||||||
|
|
||||||
// Fetch stock color.
|
// Fetch stock color.
|
||||||
const LinearColorF& color = StockColor::colorF( pStockColorName );
|
const LinearColorF& color = StockColor::colorF(stockColorName);
|
||||||
|
|
||||||
// Format stock color.
|
return color;
|
||||||
char* returnBuffer = Con::getReturnBuffer(256);
|
|
||||||
dSprintf(returnBuffer, 256, "%g %g %g %g", color.red, color.green, color.blue, color.alpha);
|
|
||||||
return(returnBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ConsoleFunction( getStockColorI, const char*, 2, 2, "(stockColorName) - Gets a byte-based stock color by name.\n"
|
DefineEngineFunction(getStockColorI, ColorI, (const char* stockColorName),,
|
||||||
|
"@brief Gets a byte-based stock color by name.\n"
|
||||||
"@param stockColorName - The stock color name to retrieve.\n"
|
"@param stockColorName - The stock color name to retrieve.\n"
|
||||||
"@return The stock color that matches the specified color name. Returns nothing if the color name is not found.\n" )
|
"@return The stock color that matches the specified color name. Returns nothing if the color name is not found.\n")
|
||||||
{
|
{
|
||||||
// Fetch stock color name.
|
|
||||||
const char* pStockColorName = argv[1];
|
|
||||||
|
|
||||||
// Return nothing if stock color name is invalid.
|
// Return nothing if stock color name is invalid.
|
||||||
if ( !StockColor::isColor( pStockColorName ) )
|
if (!StockColor::isColor(stockColorName))
|
||||||
return StringTable->EmptyString();
|
return StringTable->EmptyString();
|
||||||
|
|
||||||
// Fetch stock color.
|
// Fetch stock color.
|
||||||
const ColorI& color = StockColor::colorI( pStockColorName );
|
const ColorI& color = StockColor::colorI(stockColorName);
|
||||||
|
|
||||||
// Format stock color.
|
return color;
|
||||||
char* returnBuffer = Con::getReturnBuffer(256);
|
|
||||||
dSprintf(returnBuffer, 256, "%d %d %d %d", color.red, color.green, color.blue, color.alpha);
|
|
||||||
return(returnBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "core/frameAllocator.h"
|
#include "core/frameAllocator.h"
|
||||||
#include "console/console.h"
|
#include "console/engineAPI.h"
|
||||||
|
|
||||||
U8* FrameAllocator::smBuffer = NULL;
|
U8* FrameAllocator::smBuffer = NULL;
|
||||||
U32 FrameAllocator::smWaterMark = 0;
|
U32 FrameAllocator::smWaterMark = 0;
|
||||||
|
|
@ -30,7 +30,7 @@ U32 FrameAllocator::smHighWaterMark = 0;
|
||||||
#ifdef TORQUE_DEBUG
|
#ifdef TORQUE_DEBUG
|
||||||
U32 FrameAllocator::smMaxFrameAllocation = 0;
|
U32 FrameAllocator::smMaxFrameAllocation = 0;
|
||||||
|
|
||||||
ConsoleFunction(getMaxFrameAllocation, S32, 1,1, "getMaxFrameAllocation();")
|
DefineEngineFunction(getMaxFrameAllocation, S32, (),,"")
|
||||||
{
|
{
|
||||||
return FrameAllocator::getMaxFrameAllocation();
|
return FrameAllocator::getMaxFrameAllocation();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -222,18 +222,17 @@ ResourceBase ResourceManager::nextResource()
|
||||||
ConsoleFunctionGroupBegin(ResourceManagerFunctions, "Resource management functions.");
|
ConsoleFunctionGroupBegin(ResourceManagerFunctions, "Resource management functions.");
|
||||||
|
|
||||||
|
|
||||||
ConsoleFunction(resourceDump, void, 1, 1, "()"
|
DefineEngineFunction(resourceDump, void, (),,
|
||||||
"@brief List the currently managed resources\n\n"
|
"@brief List the currently managed resources\n\n"
|
||||||
"Currently used by editors only, internal\n"
|
"Currently used by editors only, internal\n"
|
||||||
"@ingroup Editors\n"
|
"@ingroup Editors\n"
|
||||||
"@internal")
|
"@internal")
|
||||||
{
|
{
|
||||||
#ifdef TORQUE_DEBUG
|
#ifdef TORQUE_DEBUG
|
||||||
ResourceManager::get().dumpToConsole();
|
ResourceManager::get().dumpToConsole();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DefineEngineFunction( reloadResource, void, ( const char* path ),,
|
DefineEngineFunction( reloadResource, void, ( const char* path ),,
|
||||||
"Force the resource at specified input path to be reloaded\n"
|
"Force the resource at specified input path to be reloaded\n"
|
||||||
"@param path Path to the resource to be reloaded\n\n"
|
"@param path Path to the resource to be reloaded\n\n"
|
||||||
|
|
|
||||||
|
|
@ -992,7 +992,7 @@ public:
|
||||||
|
|
||||||
static GFXGLRegisterDevice pGLRegisterDevice;
|
static GFXGLRegisterDevice pGLRegisterDevice;
|
||||||
|
|
||||||
ConsoleFunction(cycleResources, void, 1, 1, "")
|
DefineEngineFunction(cycleResources, void, (),, "")
|
||||||
{
|
{
|
||||||
static_cast<GFXGLDevice*>(GFX)->zombify();
|
static_cast<GFXGLDevice*>(GFX)->zombify();
|
||||||
static_cast<GFXGLDevice*>(GFX)->resurrect();
|
static_cast<GFXGLDevice*>(GFX)->resurrect();
|
||||||
|
|
|
||||||
|
|
@ -508,14 +508,15 @@ bool compiledFileNeedsUpdate(UTF8* filename)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleFunction(CompileLanguage, void, 2, 3, "(string inputFile, [bool createMap]) Compiles a LSO language file."
|
DefineEngineFunction(CompileLanguage, void, (const char* inputFile, bool createMap), (false),
|
||||||
|
"@brief Compiles a LSO language file."
|
||||||
" if createIndex is true, will also create languageMap.cs with"
|
" if createIndex is true, will also create languageMap.cs with"
|
||||||
" the global variables for each string index."
|
" the global variables for each string index."
|
||||||
" The input file must follow this example layout:"
|
" The input file must follow this example layout:"
|
||||||
" TXT_HELLO_WORLD = Hello world in english!")
|
" TXT_HELLO_WORLD = Hello world in english!")
|
||||||
{
|
{
|
||||||
UTF8 scriptFilenameBuffer[1024];
|
UTF8 scriptFilenameBuffer[1024];
|
||||||
Con::expandScriptFilename((char*)scriptFilenameBuffer, sizeof(scriptFilenameBuffer), argv[1]);
|
Con::expandScriptFilename((char*)scriptFilenameBuffer, sizeof(scriptFilenameBuffer), inputFile);
|
||||||
|
|
||||||
if (!Torque::FS::IsFile(scriptFilenameBuffer))
|
if (!Torque::FS::IsFile(scriptFilenameBuffer))
|
||||||
{
|
{
|
||||||
|
|
@ -532,7 +533,6 @@ ConsoleFunction(CompileLanguage, void, 2, 3, "(string inputFile, [bool createMap
|
||||||
|
|
||||||
if (compiledFileNeedsUpdate(scriptFilenameBuffer))
|
if (compiledFileNeedsUpdate(scriptFilenameBuffer))
|
||||||
{
|
{
|
||||||
bool createMap = argc > 2 ? dAtob(argv[2]) : false;
|
|
||||||
FileStream *mapStream = NULL;
|
FileStream *mapStream = NULL;
|
||||||
if (createMap)
|
if (createMap)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "core/strings/stringFunctions.h"
|
#include "core/strings/stringFunctions.h"
|
||||||
#include "console/console.h"
|
#include "console/engineAPI.h"
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------- STATIC Declaration
|
//-------------------------------------- STATIC Declaration
|
||||||
|
|
@ -167,8 +167,8 @@ const char* avar(const char *message, ...)
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
ConsoleFunction( Assert, void, 3, 3, "(condition, message) - Fatal Script Assertion" )
|
DefineEngineFunction(Assert, void, (bool condition, const char* message),, "Fatal Script Assertion")
|
||||||
{
|
{
|
||||||
// Process Assertion.
|
// Process Assertion.
|
||||||
AssertISV( dAtob(argv[1]), argv[2] );
|
AssertISV(condition, message);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "platform/platformInput.h"
|
#include "platform/platformInput.h"
|
||||||
#include "console/console.h"
|
#include "console/engineAPI.h"
|
||||||
#include "core/util/journal/process.h"
|
#include "core/util/journal/process.h"
|
||||||
#include "windowManager/platformWindowMgr.h"
|
#include "windowManager/platformWindowMgr.h"
|
||||||
|
|
||||||
|
|
@ -97,16 +97,16 @@ void Input::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
ConsoleFunction( isJoystickDetected, bool, 1, 1, "isJoystickDetected()" )
|
DefineEngineFunction(isJoystickDetected, bool, (),, "")
|
||||||
{
|
{
|
||||||
return( SDL_NumJoysticks() > 0 );
|
return(SDL_NumJoysticks() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
ConsoleFunction( getJoystickAxes, const char*, 2, 2, "getJoystickAxes( instance )" )
|
DefineEngineFunction(getJoystickAxes, const char*, (const char* instance), , "")
|
||||||
{
|
{
|
||||||
// TODO SDL
|
// TODO SDL
|
||||||
return( "" );
|
return("");
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue