本文整理汇总了C++中FState::SetAction方法的典型用法代码示例。如果您正苦于以下问题:C++ FState::SetAction方法的具体用法?C++ FState::SetAction怎么用?C++ FState::SetAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FState
的用法示例。
在下文中一共展示了FState::SetAction方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoActionSpecials
//==========================================================================
//***
// DoActionSpecials
// handles action specials as code pointers
//
//==========================================================================
bool DoActionSpecials(FScanner &sc, FState & state, Baggage &bag)
{
int i;
int min_args, max_args;
FString specname = sc.String;
int special = P_FindLineSpecial(sc.String, &min_args, &max_args);
if (special > 0 && min_args >= 0)
{
int paramindex=PrepareStateParameters(&state, 6, bag.Info->Class);
StateParams.Set(paramindex, new FxConstant(special, sc));
// Make this consistent with all other parameter parsing
if (sc.CheckToken('('))
{
for (i = 0; i < 5;)
{
StateParams.Set(paramindex+i+1, ParseExpression (sc, bag.Info->Class));
i++;
if (!sc.CheckToken (',')) break;
}
sc.MustGetToken (')');
}
else i=0;
if (i < min_args)
{
sc.ScriptError ("Too few arguments to %s", specname.GetChars());
}
if (i > max_args)
{
sc.ScriptError ("Too many arguments to %s", specname.GetChars());
}
state.SetAction(FindGlobalActionFunction("A_CallSpecial"), false);
return true;
}
return false;
}
示例2: ParseStates
//.........这里部分代码省略.........
if (sc.Compare("LIGHT"))
{
sc.MustGetStringName("(");
do
{
sc.MustGetString();
#ifdef DYNLIGHT
AddStateLight(&state, sc.String);
#endif
}
while (sc.CheckString(","));
sc.MustGetStringName(")");
continue;
}
if (sc.Compare("CANRAISE"))
{
state.CanRaise = true;
continue;
}
// Make the action name lowercase
strlwr (sc.String);
if (DoActionSpecials(sc, state, bag))
{
goto endofstate;
}
FName funcname = FName(sc.String, true);
PSymbol *sym = bag.Info->Class->Symbols.FindSymbol (funcname, true);
if (sym != NULL && sym->SymbolType == SYM_ActionFunction)
{
PSymbolActionFunction *afd = static_cast<PSymbolActionFunction *>(sym);
state.SetAction(afd, false);
if (!afd->Arguments.IsEmpty())
{
const char *params = afd->Arguments.GetChars();
int numparams = (int)afd->Arguments.Len();
int v;
if (!islower(*params))
{
sc.MustGetStringName("(");
}
else
{
if (!sc.CheckString("("))
{
state.ParameterIndex = afd->defaultparameterindex+1;
goto endofstate;
}
}
int paramindex = PrepareStateParameters(&state, numparams, bag.Info->Class);
int paramstart = paramindex;
bool varargs = params[numparams - 1] == '+';
int varargcount = 0;
if (varargs)
{
paramindex++;
}
else if (afd->defaultparameterindex > -1)
{
StateParams.Copy(paramindex, afd->defaultparameterindex, int(afd->Arguments.Len()));