Attempted to add Vector4 to ZScript

This commit is contained in:
Shiny Metagross 2022-11-11 16:38:22 +01:00 committed by Christoph Oelckers
commit a525233914
18 changed files with 675 additions and 61 deletions

View file

@ -339,6 +339,7 @@ public:
bool IsVector() const { return ValueType == TypeVector2 || ValueType == TypeVector3 || ValueType == TypeFVector2 || ValueType == TypeFVector3; };
bool IsVector2() const { return ValueType == TypeVector2 || ValueType == TypeFVector2; };
bool IsVector3() const { return ValueType == TypeVector3 || ValueType == TypeFVector3; };
bool IsVector4() const { return ValueType == TypeVector4 || ValueType == TypeFVector4; };
bool IsBoolCompat() const { return ValueType->isScalar(); }
bool IsObject() const { return ValueType->isObjectPointer(); }
bool IsArray() const { return ValueType->isArray() || (ValueType->isPointer() && ValueType->toPointer()->PointedType->isArray()); }
@ -550,20 +551,20 @@ public:
class FxVectorValue : public FxExpression
{
FxExpression *xyz[3];
FxExpression *xyzw[4];
bool isConst; // gets set to true if all element are const (used by function defaults parser)
public:
friend class ZCCCompiler;
FxVectorValue(FxExpression *x, FxExpression *y, FxExpression *z, const FScriptPosition &sc);
FxVectorValue(FxExpression *x, FxExpression *y, FxExpression *z, FxExpression* w, const FScriptPosition &sc);
~FxVectorValue();
FxExpression *Resolve(FCompileContext&);
bool isConstVector(int dim)
{
if (!isConst) return false;
return dim == 2 ? xyz[2] == nullptr : xyz[2] != nullptr;
return dim == 2 ? xyzw[2] == nullptr : xyzw[2] != nullptr;
}
ExpEmit Emit(VMFunctionBuilder *build);