mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-21 07:33:45 +00:00
Replaced a ton of ConsoleMethods with the DefineConsoleMethod Macro.
This commit is contained in:
parent
378a933894
commit
acb192e2a5
133 changed files with 1716 additions and 2087 deletions
|
|
@ -48,6 +48,7 @@
|
|||
#include "T3D/physics/physicsCollision.h"
|
||||
#include "console/engineAPI.h"
|
||||
|
||||
#include "console/engineAPI.h"
|
||||
using namespace Torque;
|
||||
|
||||
IMPLEMENT_CO_NETOBJECT_V1(TerrainBlock);
|
||||
|
|
@ -141,29 +142,15 @@ ConsoleDocFragment _getTerrainUnderWorldPoint2(
|
|||
"bool getTerrainUnderWorldPoint( F32 x, F32 y, F32 z);"
|
||||
);
|
||||
|
||||
ConsoleFunction(getTerrainUnderWorldPoint, S32, 2, 4, "(Point3F x/y/z) Gets the terrain block that is located under the given world point.\n"
|
||||
DefineConsoleFunction( getTerrainUnderWorldPoint, S32, (Point3F position), ,
|
||||
"(Point3F x/y/z) Gets the terrain block that is located under the given world point.\n"
|
||||
"@param x/y/z The world coordinates (floating point values) you wish to query at. "
|
||||
"These can be formatted as either a string (\"x y z\") or separately as (x, y, z)\n"
|
||||
"@return Returns the ID of the requested terrain block (0 if not found).\n\n"
|
||||
"@hide")
|
||||
{
|
||||
Point3F pos;
|
||||
if(argc == 2)
|
||||
dSscanf(argv[1], "%f %f %f", &pos.x, &pos.y, &pos.z);
|
||||
else if(argc == 4)
|
||||
{
|
||||
pos.x = dAtof(argv[1]);
|
||||
pos.y = dAtof(argv[2]);
|
||||
pos.z = dAtof(argv[3]);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Con::errorf("getTerrainUnderWorldPoint(Point3F): Invalid argument count! Valid arguments are either \"x y z\" or x,y,z\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
TerrainBlock* terrain = getTerrainUnderWorldPoint(pos);
|
||||
TerrainBlock* terrain = getTerrainUnderWorldPoint(position);
|
||||
if(terrain != NULL)
|
||||
{
|
||||
return terrain->getId();
|
||||
|
|
@ -1284,21 +1271,13 @@ ConsoleDocFragment _getTerrainHeight2(
|
|||
"bool getTerrainHeight( F32 x, F32 y);"
|
||||
);
|
||||
|
||||
ConsoleFunction(getTerrainHeight, F32, 2, 3, "(Point2 pos) - gets the terrain height at the specified position."
|
||||
DefineConsoleFunction( getTerrainHeight, F32, (Point2F pos), , "(Point2 pos) - gets the terrain height at the specified position."
|
||||
"@param pos The world space point, minus the z (height) value\n Can be formatted as either (\"x y\") or (x,y)\n"
|
||||
"@return Returns the terrain height at the given point as an F32 value.\n"
|
||||
"@hide")
|
||||
{
|
||||
Point2F pos;
|
||||
F32 height = 0.0f;
|
||||
|
||||
if(argc == 2)
|
||||
dSscanf(argv[1],"%f %f",&pos.x,&pos.y);
|
||||
else if(argc == 3)
|
||||
{
|
||||
pos.x = dAtof(argv[1]);
|
||||
pos.y = dAtof(argv[2]);
|
||||
}
|
||||
|
||||
TerrainBlock * terrain = getTerrainUnderWorldPoint(Point3F(pos.x, pos.y, 5000.0f));
|
||||
if(terrain)
|
||||
|
|
@ -1330,29 +1309,15 @@ ConsoleDocFragment _getTerrainHeightBelowPosition2(
|
|||
"bool getTerrainHeightBelowPosition( F32 x, F32 y);"
|
||||
);
|
||||
|
||||
ConsoleFunction(getTerrainHeightBelowPosition, F32, 2, 4, "(Point3F pos) - gets the terrain height at the specified position."
|
||||
DefineConsoleFunction( getTerrainHeightBelowPosition, F32, (Point3F pos), ,
|
||||
"(Point3F pos) - gets the terrain height at the specified position."
|
||||
"@param pos The world space point. Can be formatted as either (\"x y z\") or (x,y,z)\n"
|
||||
"@note This function is useful if you simply want to grab the terrain height underneath an object.\n"
|
||||
"@return Returns the terrain height at the given point as an F32 value.\n"
|
||||
"@hide")
|
||||
{
|
||||
Point3F pos;
|
||||
F32 height = 0.0f;
|
||||
|
||||
if(argc == 2)
|
||||
dSscanf(argv[1], "%f %f %f", &pos.x, &pos.y, &pos.z);
|
||||
else if(argc == 4)
|
||||
{
|
||||
pos.x = dAtof(argv[1]);
|
||||
pos.y = dAtof(argv[2]);
|
||||
pos.z = dAtof(argv[3]);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Con::errorf("getTerrainHeightBelowPosition(Point3F): Invalid argument count! Valid arguments are either \"x y z\" or x,y,z\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
TerrainBlock * terrain = getTerrainUnderWorldPoint(pos);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue