- added DavidPH's sqrt for DECORATE submission.
SVN r3586 (trunk)
This commit is contained in:
parent
44519f3972
commit
4df1ea63b5
6 changed files with 541 additions and 381 deletions
|
|
@ -2279,22 +2279,6 @@ FxFunctionCall::~FxFunctionCall()
|
|||
|
||||
FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
||||
{
|
||||
// There's currently only 2 global functions.
|
||||
// This will have to change later!
|
||||
if (MethodName == NAME_Sin || MethodName == NAME_Cos)
|
||||
{
|
||||
if (Self != NULL)
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Global variables cannot have a self pointer");
|
||||
delete this;
|
||||
return NULL;
|
||||
}
|
||||
FxExpression *x = new FxGlobalFunctionCall(MethodName, ArgList, ScriptPosition);
|
||||
ArgList = NULL;
|
||||
delete this;
|
||||
return x->Resolve(ctx);
|
||||
}
|
||||
|
||||
int min, max, special;
|
||||
if (MethodName == NAME_ACS_NamedExecuteWithResult || MethodName == NAME_CallACS)
|
||||
{
|
||||
|
|
@ -2328,6 +2312,19 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
|
|||
delete this;
|
||||
return x->Resolve(ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Self != NULL)
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "Global variables cannot have a self pointer");
|
||||
delete this;
|
||||
return NULL;
|
||||
}
|
||||
FxExpression *x = FxGlobalFunctionCall::StaticCreate(MethodName, ArgList, ScriptPosition);
|
||||
ArgList = NULL;
|
||||
delete this;
|
||||
return x->Resolve(ctx);
|
||||
}
|
||||
|
||||
ScriptPosition.Message(MSG_ERROR, "Call to unknown function '%s'", MethodName.GetChars());
|
||||
delete this;
|
||||
|
|
@ -2474,60 +2471,6 @@ FxGlobalFunctionCall::~FxGlobalFunctionCall()
|
|||
SAFE_DELETE(ArgList);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// // so far just a quick hack to handle sin and cos
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FxExpression *FxGlobalFunctionCall::Resolve(FCompileContext& ctx)
|
||||
{
|
||||
CHECKRESOLVED();
|
||||
|
||||
if (ArgList == NULL || ArgList->Size() != 1)
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "%s only has one parameter", Name.GetChars());
|
||||
delete this;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
(*ArgList)[0] = (*ArgList)[0]->Resolve(ctx);
|
||||
if ((*ArgList)[0] == NULL)
|
||||
{
|
||||
delete this;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(*ArgList)[0]->ValueType.isNumeric())
|
||||
{
|
||||
ScriptPosition.Message(MSG_ERROR, "numeric value expected for parameter");
|
||||
delete this;
|
||||
return NULL;
|
||||
}
|
||||
ValueType = VAL_Float;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
ExpVal FxGlobalFunctionCall::EvalExpression (AActor *self)
|
||||
{
|
||||
double v = (*ArgList)[0]->EvalExpression(self).GetFloat();
|
||||
ExpVal ret;
|
||||
ret.Type = VAL_Float;
|
||||
|
||||
// shall we use the CRT's sin and cos functions?
|
||||
angle_t angle = angle_t(v * ANGLE_90/90.);
|
||||
if (Name == NAME_Sin) ret.Float = FIXED2FLOAT (finesine[angle>>ANGLETOFINESHIFT]);
|
||||
else ret.Float = FIXED2FLOAT (finecosine[angle>>ANGLETOFINESHIFT]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue