mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
Remove all state expression/param stuff
- This all became vestigial code after the relevant information was all moved into FStateTempCall. Now that the MBF code pointer code has been converted, I can be sure it wasn't still used anywhere.
This commit is contained in:
parent
9485752b55
commit
4a1fbdb32a
6 changed files with 1 additions and 187 deletions
|
@ -87,7 +87,6 @@ class PSymbolActionFunction : public PSymbol
|
|||
public:
|
||||
FString Arguments;
|
||||
VMFunction *Function;
|
||||
int defaultparameterindex;
|
||||
|
||||
PSymbolActionFunction(FName name) : PSymbol(name) {}
|
||||
PSymbolActionFunction() : PSymbol(NAME_None) {}
|
||||
|
|
|
@ -276,7 +276,7 @@ static void DumpFunction(FILE *dump, VMScriptFunction *sfunc, const char *label,
|
|||
|
||||
static void FinishThingdef()
|
||||
{
|
||||
int errorcount = StateParams.ResolveAll();
|
||||
int errorcount = 0;
|
||||
unsigned i, j;
|
||||
int codesize = 0;
|
||||
|
||||
|
@ -419,7 +419,6 @@ void LoadActors ()
|
|||
cycle_t timer;
|
||||
|
||||
timer.Reset(); timer.Clock();
|
||||
StateParams.Clear();
|
||||
ActorDamageFuncs.Clear();
|
||||
GlobalSymbols.ReleaseSymbols();
|
||||
FScriptPosition::ResetErrorCounter();
|
||||
|
|
|
@ -127,33 +127,6 @@ struct FStateTempCall
|
|||
int NumStates;
|
||||
};
|
||||
extern TDeletingArray<FStateTempCall *> StateTempCalls;
|
||||
|
||||
struct FStateExpression
|
||||
{
|
||||
FxExpression *expr;
|
||||
PClassActor *owner;
|
||||
bool constant;
|
||||
bool cloned;
|
||||
};
|
||||
|
||||
class FStateExpressions
|
||||
{
|
||||
TArray<FStateExpression> expressions;
|
||||
|
||||
public:
|
||||
~FStateExpressions() { Clear(); }
|
||||
void Clear();
|
||||
int Add(FxExpression *x, PClassActor *o, bool c);
|
||||
int Reserve(int num, PClassActor *cls);
|
||||
// void Set(int num, FxExpression *x, bool cloned = false);
|
||||
// void Copy(int dest, int src, int cnt);
|
||||
int ResolveAll();
|
||||
FxExpression *Get(int no);
|
||||
unsigned int Size() { return expressions.Size(); }
|
||||
};
|
||||
|
||||
extern FStateExpressions StateParams;
|
||||
|
||||
extern TDeletingArray<class FxExpression *> ActorDamageFuncs;
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -3990,133 +3990,3 @@ ExpEmit FxDamageValue::Emit(VMFunctionBuilder *build)
|
|||
|
||||
return ExpEmit();
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// NOTE: I don't expect any of the following to survive Doomscript ;)
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FStateExpressions StateParams;
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FStateExpressions::Clear()
|
||||
{
|
||||
for(unsigned i=0; i<Size(); i++)
|
||||
{
|
||||
if (expressions[i].expr != NULL && !expressions[i].cloned)
|
||||
{
|
||||
delete expressions[i].expr;
|
||||
}
|
||||
}
|
||||
expressions.Clear();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int FStateExpressions::Add(FxExpression *x, PClassActor *o, bool c)
|
||||
{
|
||||
int idx = expressions.Reserve(1);
|
||||
FStateExpression &exp = expressions[idx];
|
||||
exp.expr = x;
|
||||
exp.owner = o;
|
||||
exp.constant = c;
|
||||
exp.cloned = false;
|
||||
return idx;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int FStateExpressions::Reserve(int num, PClassActor *cls)
|
||||
{
|
||||
int idx = expressions.Reserve(num);
|
||||
FStateExpression *exp = &expressions[idx];
|
||||
for(int i = 0; i < num; i++)
|
||||
{
|
||||
exp[i].expr = NULL;
|
||||
exp[i].owner = cls;
|
||||
exp[i].constant = false;
|
||||
exp[i].cloned = false;
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int FStateExpressions::ResolveAll()
|
||||
{
|
||||
int errorcount = 0;
|
||||
|
||||
FCompileContext ctx;
|
||||
ctx.lax = true;
|
||||
for(unsigned i=0; i<Size(); i++)
|
||||
{
|
||||
if (expressions[i].cloned)
|
||||
{
|
||||
// Now that everything coming before has been resolved we may copy the actual pointer.
|
||||
unsigned ii = unsigned((intptr_t)expressions[i].expr);
|
||||
expressions[i].expr = expressions[ii].expr;
|
||||
}
|
||||
else if (expressions[i].expr != NULL)
|
||||
{
|
||||
ctx.cls = expressions[i].owner;
|
||||
ctx.isconst = expressions[i].constant;
|
||||
expressions[i].expr = expressions[i].expr->Resolve(ctx);
|
||||
if (expressions[i].expr == NULL)
|
||||
{
|
||||
errorcount++;
|
||||
}
|
||||
else if (expressions[i].constant && !expressions[i].expr->isConstant())
|
||||
{
|
||||
expressions[i].expr->ScriptPosition.Message(MSG_ERROR, "Constant expression expected");
|
||||
errorcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned i=0; i<Size(); i++)
|
||||
{
|
||||
if (expressions[i].expr != NULL)
|
||||
{
|
||||
if (!expressions[i].expr->isresolved)
|
||||
{
|
||||
expressions[i].expr->ScriptPosition.Message(MSG_ERROR, "Expression at index %d not resolved\n", i);
|
||||
errorcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errorcount;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FxExpression *FStateExpressions::Get(int num)
|
||||
{
|
||||
if (num >= 0 && num < int(Size()))
|
||||
return expressions[num].expr;
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -1010,18 +1010,6 @@ static void ParseActionDef (FScanner &sc, PClassActor *cls)
|
|||
PSymbolActionFunction *sym = new PSymbolActionFunction(funcname);
|
||||
sym->Arguments = args;
|
||||
sym->Function = *(afd->VMPointer);
|
||||
if (hasdefaults)
|
||||
{
|
||||
sym->defaultparameterindex = StateParams.Size();
|
||||
for(unsigned int i = 0; i < DefaultParams.Size(); i++)
|
||||
{
|
||||
StateParams.Add(DefaultParams[i], cls, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sym->defaultparameterindex = -1;
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
FScriptPosition::ErrorCounter++;
|
||||
|
|
|
@ -331,25 +331,13 @@ do_stop:
|
|||
{
|
||||
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()));
|
||||
}
|
||||
|
||||
while (*params)
|
||||
{
|
||||
FxExpression *x;
|
||||
|
@ -381,7 +369,6 @@ do_stop:
|
|||
// Use the generic parameter parser for everything else
|
||||
x = ParseParameter(sc, bag.Info, *params, false);
|
||||
}
|
||||
// StateParams.Set(paramindex++, x);
|
||||
tcall->Parameters.Push(new FxParameter(x));
|
||||
params++;
|
||||
varargcount++;
|
||||
|
@ -391,11 +378,9 @@ do_stop:
|
|||
{
|
||||
if (sc.CheckString(")"))
|
||||
{
|
||||
// StateParams.Set(paramstart, new FxConstant(argcount, sc));
|
||||
goto endofstate;
|
||||
}
|
||||
params--;
|
||||
StateParams.Reserve(1, bag.Info);
|
||||
}
|
||||
else if ((islower(*params) || *params=='!') && sc.CheckString(")"))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue