From 6f4f38a34bd7055478ac9540fff77d8e209f9de0 Mon Sep 17 00:00:00 2001 From: Kevin Caccamo Date: Sat, 12 Jun 2021 12:21:22 -0400 Subject: [PATCH] Initial work on documenting ZScript intrinsics --- wadsrc/static/zscript/engine/base.zs | 42 +++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/wadsrc/static/zscript/engine/base.zs b/wadsrc/static/zscript/engine/base.zs index 58f510c4e7..cfc01765d0 100644 --- a/wadsrc/static/zscript/engine/base.zs +++ b/wadsrc/static/zscript/engine/base.zs @@ -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 +{ + 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 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;