Initial work on documenting ZScript intrinsics

This commit is contained in:
Kevin Caccamo 2021-06-12 12:21:22 -04:00 committed by Christoph Oelckers
parent bf6849d184
commit 6f4f38a34b

View file

@ -143,6 +143,31 @@ enum EPrintLevel
PRINT_NOLOG = 2048, // Flag - do not print to log file
};
/*
// These are here to document the intrinsic methods and fields available on
// the built-in ZScript types
class Vector2
{
double x;
double y;
native double Length();
native Vector2 Unit();
}
class Vector3 : Vector2
{
double z;
Vector2 xy;
native double Length();
native Vector3 Unit();
}
class Array<T>
{
native int Size();
}
*/
struct _ native // These are the global variables, the struct is only here to avoid extending the parser for this.
{
native readonly Array<class> AllClasses;
@ -269,6 +294,18 @@ struct TexMan
native static bool UseGamePalette(TextureID tex);
}
/*
// Intrinsic TextureID methods
struct TextureID
{
native bool IsValid();
native bool IsNull();
native bool Exists();
native void SetInvalid();
native void SetNull();
}
*/
enum EScaleMode
{
FSMode_None = 0,
@ -595,6 +632,8 @@ class Object native
// This does not call into the native method of the same name to avoid problems with objects that get garbage collected late on shutdown.
virtual virtualscope void OnDestroy() {}
// clearscope Object GetParentClass(); // Intrinsic - Get the parent class of this object
// clearscope Name GetClassName(); // Intrinsic - Get the name of this object's class
}
class BrokenLines : Object native version("2.4")
@ -665,7 +704,8 @@ struct StringStruct native
{
native static vararg String Format(String fmt, ...);
native vararg void AppendFormat(String fmt, ...);
// native int Length(); // Intrinsic
// bool operator~==(String other) // Case-insensitive equality comparison
native void Replace(String pattern, String replacement);
native String Left(int len) const;
native String Mid(int pos = 0, int len = 2147483647) const;