Eliminate ConsoleFunction and ConsoleMethod, replace with DefineEngineStringlyVariadic

This commit is contained in:
Lukas Joergensen 2018-04-20 22:09:58 +02:00
parent 6b524ae58a
commit 7d91d0a577
18 changed files with 112 additions and 84 deletions

View file

@ -452,7 +452,7 @@ const char* afxCamera::getMode()
static char buffer[100];
ConsoleMethod(afxCamera, setOrbitMode, void, 7, 8,
DefineEngineStringlyVariadicMethod(afxCamera, setOrbitMode, void, 7, 8,
"(GameBase orbitObject, TransformF mat, float minDistance, float maxDistance, float curDistance, bool ownClientObject)"
"Set the camera to orbit around some given object.\n\n"
"@param orbitObject Object we want to orbit.\n"

View file

@ -2633,29 +2633,29 @@ DefineEngineMethod(afxMagicSpell, getImpactedObject, S32, (),,
return (imp_obj) ? imp_obj->getId() : -1;
}
ConsoleMethod(afxMagicSpell, setTimeFactor, void, 3, 4, "(F32 factor) or (string phase, F32 factor)"
"Sets the time-factor for the spell, either overall or for a specific phrase.\n\n"
"@ingroup AFX")
DefineEngineStringlyVariadicMethod(afxMagicSpell, setTimeFactor, void, 3, 4, "(F32 factor) or (string phase, F32 factor)"
"Sets the time-factor for the spell, either overall or for a specific phrase.\n\n"
"@ingroup AFX")
{
if (argc == 3)
object->setTimeFactor(dAtof(argv[2]));
else
{
if (dStricmp(argv[2], "overall") == 0)
object->setTimeFactor(dAtof(argv[3]));
else if (dStricmp(argv[2], "casting") == 0)
object->setTimeFactor(afxMagicSpell::CASTING_PHRASE, dAtof(argv[3]));
else if (dStricmp(argv[2], "launch") == 0)
object->setTimeFactor(afxMagicSpell::LAUNCH_PHRASE, dAtof(argv[3]));
else if (dStricmp(argv[2], "delivery") == 0)
object->setTimeFactor(afxMagicSpell::DELIVERY_PHRASE, dAtof(argv[3]));
else if (dStricmp(argv[2], "impact") == 0)
object->setTimeFactor(afxMagicSpell::IMPACT_PHRASE, dAtof(argv[3]));
else if (dStricmp(argv[2], "linger") == 0)
object->setTimeFactor(afxMagicSpell::LINGER_PHRASE, dAtof(argv[3]));
else
Con::errorf("afxMagicSpell::setTimeFactor() -- unknown spell phrase [%s].", argv[2].getStringValue());
}
if (argc == 3)
object->setTimeFactor(dAtof(argv[2]));
else
{
if (dStricmp(argv[2], "overall") == 0)
object->setTimeFactor(dAtof(argv[3]));
else if (dStricmp(argv[2], "casting") == 0)
object->setTimeFactor(afxMagicSpell::CASTING_PHRASE, dAtof(argv[3]));
else if (dStricmp(argv[2], "launch") == 0)
object->setTimeFactor(afxMagicSpell::LAUNCH_PHRASE, dAtof(argv[3]));
else if (dStricmp(argv[2], "delivery") == 0)
object->setTimeFactor(afxMagicSpell::DELIVERY_PHRASE, dAtof(argv[3]));
else if (dStricmp(argv[2], "impact") == 0)
object->setTimeFactor(afxMagicSpell::IMPACT_PHRASE, dAtof(argv[3]));
else if (dStricmp(argv[2], "linger") == 0)
object->setTimeFactor(afxMagicSpell::LINGER_PHRASE, dAtof(argv[3]));
else
Con::errorf("afxMagicSpell::setTimeFactor() -- unknown spell phrase [%s].", argv[2].getStringValue());
}
}
DefineEngineMethod(afxMagicSpell, interruptStage, void, (),,

View file

@ -860,18 +860,18 @@ DefineEngineFunction(getMaxF, F32, (float a, float b),,
return getMax(a, b);
}
ConsoleFunction(echoThru, const char*, 2, 0, "(string passthru, string text...)"
"Like echo(), but first argument is returned.\n"
"@ingroup AFX")
DefineEngineStringlyVariadicFunction(echoThru, const char*, 2, 0, "(string passthru, string text...)"
"Like echo(), but first argument is returned.\n"
"@ingroup AFX")
{
U32 len = 0;
S32 i;
for(i = 2; i < argc; i++)
for (i = 2; i < argc; i++)
len += dStrlen(argv[i]);
char *ret = Con::getReturnBuffer(len + 1);
ret[0] = 0;
for(i = 2; i < argc; i++)
for (i = 2; i < argc; i++)
dStrcat(ret, argv[i], len + 1);
Con::printf("%s -- [%s]", ret, argv[1].getStringValue());
@ -880,7 +880,7 @@ ConsoleFunction(echoThru, const char*, 2, 0, "(string passthru, string text...)"
return argv[1];
}
ConsoleFunction(warnThru, const char*, 2, 0, "(string passthru, string text...)"
DefineEngineStringlyVariadicFunction(warnThru, const char*, 2, 0, "(string passthru, string text...)"
"Like warn(), but first argument is returned.\n"
"@ingroup AFX")
{
@ -900,7 +900,7 @@ ConsoleFunction(warnThru, const char*, 2, 0, "(string passthru, string text...)"
return argv[1];
}
ConsoleFunction(errorThru, const char*, 2, 0, "(string passthru, string text...)"
DefineEngineStringlyVariadicFunction(errorThru, const char*, 2, 0, "(string passthru, string text...)"
"Like error(), but first argument is returned.\n"
"@ingroup AFX")
{