- rewrote the condition nodes from SBARINFO in ZScript. This compiles but hasn't been tested yet.

This commit is contained in:
Christoph Oelckers 2017-03-23 00:25:26 +01:00
commit 31ea33bfc4
9 changed files with 694 additions and 29 deletions

View file

@ -1541,7 +1541,8 @@ DEFINE_ACTION_FUNCTION(_CVar, FindCVar)
{
PARAM_PROLOGUE;
PARAM_NAME(name);
ACTION_RETURN_POINTER(FindCVar(name, nullptr));
PARAM_POINTER_DEF(plyr, player_t);
ACTION_RETURN_POINTER(GetCVar(plyr ? plyr->mo : nullptr, name));
}
FBaseCVar *FindCVarSub (const char *var_name, int namelen)

View file

@ -1960,6 +1960,7 @@ DEFINE_FIELD(FLevelLocals, teamdamage)
DEFINE_FIELD(FLevelLocals, fogdensity)
DEFINE_FIELD(FLevelLocals, outsidefogdensity)
DEFINE_FIELD(FLevelLocals, skyfog)
DEFINE_FIELD_BIT(FLevelLocals, flags, noinventorybar, LEVEL_NOINVENTORYBAR)
DEFINE_FIELD_BIT(FLevelLocals, flags, monsterstelefrag, LEVEL_MONSTERSTELEFRAG)
DEFINE_FIELD_BIT(FLevelLocals, flags, actownspecial, LEVEL_ACTOWNSPECIAL)
DEFINE_FIELD_BIT(FLevelLocals, flags, sndseqtotalctrl, LEVEL_SNDSEQTOTALCTRL)

View file

@ -1470,24 +1470,4 @@ DEFINE_ACTION_FUNCTION(DStatusbarWidget, BeginCondition)
ACTION_RETURN_POINTER(head);
}
DEFINE_ACTION_FUNCTION(DStatusbarWidget, EndCondition)
{
PARAM_SELF_PROLOGUE(DObject);
auto owner = self->PointerVar<DObject>(NAME_Owner);
if (owner == nullptr || !owner->IsKindOf(NAME_StatusbarCondition))
{
ThrowAbortException(X_OTHER, "No matching BeginCondition found for EndCondition");
}
ACTION_RETURN_POINTER(owner);
}
DEFINE_ACTION_FUNCTION(DStatusbarWidget, Finish)
{
PARAM_SELF_PROLOGUE(DObject);
auto owner = self->PointerVar<DObject>(NAME_Owner);
if (owner == nullptr || owner->PointerVar<DObject>(NAME_Owner) != owner || owner->GetClass()->TypeName != NAME_StatusbarWidget)
{
ThrowAbortException(X_OTHER, "No matching Begin found for Finish");
}
ACTION_RETURN_POINTER(owner);
}

View file

@ -649,6 +649,7 @@ xx(DeathmatchStatusScreen)
xx(CoopStatusScreen)
xx(RavenStatusScreen)
xx(StatusbarWidget)
xx(StatusbarHead)
xx(StatusbarCondition)
xx(Next)
xx(Prev)

View file

@ -6872,7 +6872,8 @@ ExpEmit FxStackVariable::Emit(VMFunctionBuilder *build)
{
if (offsetreg == -1) offsetreg = build->GetConstantInt(0);
auto op = membervar->Type->GetLoadOp();
if (op == OP_LO) op = OP_LOS;
if (op == OP_LO)
op = OP_LOS;
build->Emit(op, loc.RegNum, build->FramePointer.RegNum, offsetreg);
}
else

View file

@ -565,6 +565,14 @@ void ThrowAbortException(EVMAbortException reason, const char *moreinfo, ...)
va_end(ap);
}
DEFINE_ACTION_FUNCTION(DObject, ThrowAbortException)
{
PARAM_PROLOGUE;
FString s = FStringFormat(param, defaultparam, numparam, ret, numret);
ThrowAbortException(X_OTHER, s.GetChars());
return 0;
}
void NullParam(const char *varname)
{
ThrowAbortException(X_READ_NIL, "In function parameter %s", varname);

View file

@ -1700,6 +1700,11 @@ float ActiveRatio(int width, int height, float *trueratio)
return (fakeratio != -1) ? forcedRatioTypes[fakeratio] : ratio;
}
DEFINE_ACTION_FUNCTION(_Screen, GetAspectRatio)
{
ACTION_RETURN_FLOAT(ActiveRatio(screen->GetWidth(), screen->GetHeight(), nullptr));
}
// Tries to guess the physical dimensions of the screen based on the
// screen's pixel dimensions. Can return:
// 0: 4:3