mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-29 23:42:08 +00:00
e29eb5bbed
This is merely the basics needed to actually implement something.
448 lines
14 KiB
Text
448 lines
14 KiB
Text
|
|
struct _ native // These are the global variables, the struct is only here to avoid extending the parser for this.
|
|
{
|
|
native readonly Array<class> AllClasses;
|
|
//native readonly int GameTicRate;
|
|
|
|
native readonly Font smallfont;
|
|
native readonly Font smallfont2;
|
|
native readonly Font bigfont;
|
|
native readonly Font confont;
|
|
native readonly Font NewConsoleFont;
|
|
native readonly Font NewSmallFont;
|
|
native readonly Font AlternativeSmallFont;
|
|
native readonly Font OriginalSmallFont;
|
|
native readonly Font OriginalBigFont;
|
|
native readonly Font intermissionfont;
|
|
native readonly int CleanXFac;
|
|
native readonly int CleanYFac;
|
|
native readonly int CleanWidth;
|
|
native readonly int CleanHeight;
|
|
native readonly int CleanXFac_1;
|
|
native readonly int CleanYFac_1;
|
|
native readonly int CleanWidth_1;
|
|
native readonly int CleanHeight_1;
|
|
native readonly @MusPlayingInfo musplaying;
|
|
}
|
|
|
|
|
|
struct MusPlayingInfo native
|
|
{
|
|
native String name;
|
|
native int baseorder;
|
|
native bool loop;
|
|
};
|
|
|
|
struct TexMan
|
|
{
|
|
enum EUseTypes
|
|
{
|
|
Type_Any,
|
|
Type_Wall,
|
|
Type_Flat,
|
|
Type_Sprite,
|
|
Type_WallPatch,
|
|
Type_Build,
|
|
Type_SkinSprite,
|
|
Type_Decal,
|
|
Type_MiscPatch,
|
|
Type_FontChar,
|
|
Type_Override, // For patches between TX_START/TX_END
|
|
Type_Autopage, // Automap background - used to enable the use of FAutomapTexture
|
|
Type_SkinGraphic,
|
|
Type_Null,
|
|
Type_FirstDefined,
|
|
};
|
|
|
|
enum EFlags
|
|
{
|
|
TryAny = 1,
|
|
Overridable = 2,
|
|
ReturnFirst = 4,
|
|
AllowSkins = 8,
|
|
ShortNameOnly = 16,
|
|
DontCreate = 32,
|
|
Localize = 64
|
|
};
|
|
|
|
enum ETexReplaceFlags
|
|
{
|
|
NOT_BOTTOM = 1,
|
|
NOT_MIDDLE = 2,
|
|
NOT_TOP = 4,
|
|
NOT_FLOOR = 8,
|
|
NOT_CEILING = 16,
|
|
NOT_WALL = 7,
|
|
NOT_FLAT = 24
|
|
};
|
|
|
|
native static TextureID CheckForTexture(String name, int usetype, int flags = TryAny);
|
|
native static String GetName(TextureID tex);
|
|
native static int, int GetSize(TextureID tex);
|
|
native static Vector2 GetScaledSize(TextureID tex);
|
|
native static Vector2 GetScaledOffset(TextureID tex);
|
|
native static int CheckRealHeight(TextureID tex);
|
|
native static bool OkForLocalization(TextureID patch, String textSubstitute);
|
|
}
|
|
|
|
enum DrawTextureTags
|
|
{
|
|
TAG_USER = (1<<30),
|
|
DTA_Base = TAG_USER + 5000,
|
|
DTA_DestWidth, // width of area to draw to
|
|
DTA_DestHeight, // height of area to draw to
|
|
DTA_Alpha, // alpha value for translucency
|
|
DTA_FillColor, // color to stencil onto the destination (RGB is the color for truecolor drawers, A is the palette index for paletted drawers)
|
|
DTA_TranslationIndex, // translation table to recolor the source
|
|
DTA_AlphaChannel, // bool: the source is an alpha channel; used with DTA_FillColor
|
|
DTA_Clean, // bool: scale texture size and position by CleanXfac and CleanYfac
|
|
DTA_320x200, // bool: scale texture size and position to fit on a virtual 320x200 screen
|
|
DTA_Bottom320x200, // bool: same as DTA_320x200 but centers virtual screen on bottom for 1280x1024 targets
|
|
DTA_CleanNoMove, // bool: like DTA_Clean but does not reposition output position
|
|
DTA_CleanNoMove_1, // bool: like DTA_CleanNoMove, but uses Clean[XY]fac_1 instead
|
|
DTA_FlipX, // bool: flip image horizontally //FIXME: Does not work with DTA_Window(Left|Right)
|
|
DTA_ShadowColor, // color of shadow
|
|
DTA_ShadowAlpha, // alpha of shadow
|
|
DTA_Shadow, // set shadow color and alphas to defaults
|
|
DTA_VirtualWidth, // pretend the canvas is this wide
|
|
DTA_VirtualHeight, // pretend the canvas is this tall
|
|
DTA_TopOffset, // override texture's top offset
|
|
DTA_LeftOffset, // override texture's left offset
|
|
DTA_CenterOffset, // bool: override texture's left and top offsets and set them for the texture's middle
|
|
DTA_CenterBottomOffset,// bool: override texture's left and top offsets and set them for the texture's bottom middle
|
|
DTA_WindowLeft, // don't draw anything left of this column (on source, not dest)
|
|
DTA_WindowRight, // don't draw anything at or to the right of this column (on source, not dest)
|
|
DTA_ClipTop, // don't draw anything above this row (on dest, not source)
|
|
DTA_ClipBottom, // don't draw anything at or below this row (on dest, not source)
|
|
DTA_ClipLeft, // don't draw anything to the left of this column (on dest, not source)
|
|
DTA_ClipRight, // don't draw anything at or to the right of this column (on dest, not source)
|
|
DTA_Masked, // true(default)=use masks from texture, false=ignore masks
|
|
DTA_HUDRules, // use fullscreen HUD rules to position and size textures
|
|
DTA_HUDRulesC, // only used internally for marking HUD_HorizCenter
|
|
DTA_KeepRatio, // doesn't adjust screen size for DTA_Virtual* if the aspect ratio is not 4:3
|
|
DTA_RenderStyle, // same as render style for actors
|
|
DTA_ColorOverlay, // DWORD: ARGB to overlay on top of image; limited to black for software
|
|
DTA_Internal1,
|
|
DTA_Internal2,
|
|
DTA_Desaturate, // explicit desaturation factor (does not do anything in Legacy OpenGL)
|
|
DTA_Fullscreen, // Draw image fullscreen (same as DTA_VirtualWidth/Height with graphics size.)
|
|
|
|
// floating point duplicates of some of the above:
|
|
DTA_DestWidthF,
|
|
DTA_DestHeightF,
|
|
DTA_TopOffsetF,
|
|
DTA_LeftOffsetF,
|
|
DTA_VirtualWidthF,
|
|
DTA_VirtualHeightF,
|
|
DTA_WindowLeftF,
|
|
DTA_WindowRightF,
|
|
|
|
// For DrawText calls only:
|
|
DTA_TextLen, // stop after this many characters, even if \0 not hit
|
|
DTA_CellX, // horizontal size of character cell
|
|
DTA_CellY, // vertical size of character cell
|
|
|
|
DTA_Color,
|
|
DTA_FlipY, // bool: flip image vertically
|
|
DTA_SrcX, // specify a source rectangle (this supersedes the poorly implemented DTA_WindowLeft/Right
|
|
DTA_SrcY,
|
|
DTA_SrcWidth,
|
|
DTA_SrcHeight,
|
|
DTA_LegacyRenderStyle, // takes an old-style STYLE_* constant instead of an FRenderStyle
|
|
DTA_Internal3,
|
|
DTA_Spacing, // Strings only: Additional spacing between characters
|
|
DTA_Monospace, // Strings only: Use a fixed distance between characters.
|
|
|
|
DTA_FullscreenEx, // advanced fullscreen control.
|
|
DTA_FullscreenScale, // enable DTA_Fullscreen coordinate calculation for placed overlays.
|
|
|
|
};
|
|
|
|
class Shape2DTransform : Object native
|
|
{
|
|
native void Clear();
|
|
native void Rotate(double angle);
|
|
native void Scale(Vector2 scaleVec);
|
|
native void Translate(Vector2 translateVec);
|
|
}
|
|
|
|
class Shape2D : Object native
|
|
{
|
|
enum EClearWhich
|
|
{
|
|
C_Verts = 1,
|
|
C_Coords = 2,
|
|
C_Indices = 4,
|
|
};
|
|
|
|
native void SetTransform(Shape2DTransform transform);
|
|
|
|
native void Clear( int which = C_Verts|C_Coords|C_Indices );
|
|
native void PushVertex( Vector2 v );
|
|
native void PushCoord( Vector2 c );
|
|
native void PushTriangle( int a, int b, int c );
|
|
}
|
|
|
|
struct Screen native
|
|
{
|
|
native static Color PaletteColor(int index);
|
|
native static int GetWidth();
|
|
native static int GetHeight();
|
|
native static void Clear(int left, int top, int right, int bottom, Color color, int palcolor = -1);
|
|
native static void Dim(Color col, double amount, int x, int y, int w, int h);
|
|
|
|
native static vararg void DrawTexture(TextureID tex, bool animate, double x, double y, ...);
|
|
native static vararg void DrawShape(TextureID tex, bool animate, Shape2D s, ...);
|
|
native static vararg void DrawChar(Font font, int normalcolor, double x, double y, int character, ...);
|
|
native static vararg void DrawText(Font font, int normalcolor, double x, double y, String text, ...);
|
|
native static void DrawLine(int x0, int y0, int x1, int y1, Color color, int alpha = 255);
|
|
native static void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, Color color, int alpha = 255);
|
|
native static Vector2, Vector2 VirtualToRealCoords(Vector2 pos, Vector2 size, Vector2 vsize, bool vbottom=false, bool handleaspect=true);
|
|
native static double GetAspectRatio();
|
|
native static void SetClipRect(int x, int y, int w, int h);
|
|
native static void ClearClipRect();
|
|
native static int, int, int, int GetClipRect();
|
|
//native static int, int, int, int GetViewWindow();
|
|
}
|
|
|
|
struct Font native
|
|
{
|
|
enum EColorRange
|
|
{
|
|
CR_UNDEFINED = -1,
|
|
CR_BRICK,
|
|
CR_TAN,
|
|
CR_GRAY,
|
|
CR_GREY = CR_GRAY,
|
|
CR_GREEN,
|
|
CR_BROWN,
|
|
CR_GOLD,
|
|
CR_RED,
|
|
CR_BLUE,
|
|
CR_ORANGE,
|
|
CR_WHITE,
|
|
CR_YELLOW,
|
|
CR_UNTRANSLATED,
|
|
CR_BLACK,
|
|
CR_LIGHTBLUE,
|
|
CR_CREAM,
|
|
CR_OLIVE,
|
|
CR_DARKGREEN,
|
|
CR_DARKRED,
|
|
CR_DARKBROWN,
|
|
CR_PURPLE,
|
|
CR_DARKGRAY,
|
|
CR_CYAN,
|
|
CR_ICE,
|
|
CR_FIRE,
|
|
CR_SAPPHIRE,
|
|
CR_TEAL,
|
|
NUM_TEXT_COLORS
|
|
};
|
|
|
|
const TEXTCOLOR_BRICK = "\034A";
|
|
const TEXTCOLOR_TAN = "\034B";
|
|
const TEXTCOLOR_GRAY = "\034C";
|
|
const TEXTCOLOR_GREY = "\034C";
|
|
const TEXTCOLOR_GREEN = "\034D";
|
|
const TEXTCOLOR_BROWN = "\034E";
|
|
const TEXTCOLOR_GOLD = "\034F";
|
|
const TEXTCOLOR_RED = "\034G";
|
|
const TEXTCOLOR_BLUE = "\034H";
|
|
const TEXTCOLOR_ORANGE = "\034I";
|
|
const TEXTCOLOR_WHITE = "\034J";
|
|
const TEXTCOLOR_YELLOW = "\034K";
|
|
const TEXTCOLOR_UNTRANSLATED = "\034L";
|
|
const TEXTCOLOR_BLACK = "\034M";
|
|
const TEXTCOLOR_LIGHTBLUE = "\034N";
|
|
const TEXTCOLOR_CREAM = "\034O";
|
|
const TEXTCOLOR_OLIVE = "\034P";
|
|
const TEXTCOLOR_DARKGREEN = "\034Q";
|
|
const TEXTCOLOR_DARKRED = "\034R";
|
|
const TEXTCOLOR_DARKBROWN = "\034S";
|
|
const TEXTCOLOR_PURPLE = "\034T";
|
|
const TEXTCOLOR_DARKGRAY = "\034U";
|
|
const TEXTCOLOR_CYAN = "\034V";
|
|
const TEXTCOLOR_ICE = "\034W";
|
|
const TEXTCOLOR_FIRE = "\034X";
|
|
const TEXTCOLOR_SAPPHIRE = "\034Y";
|
|
const TEXTCOLOR_TEAL = "\034Z";
|
|
|
|
const TEXTCOLOR_NORMAL = "\034-";
|
|
const TEXTCOLOR_BOLD = "\034+";
|
|
|
|
const TEXTCOLOR_CHAT = "\034*";
|
|
const TEXTCOLOR_TEAMCHAT = "\034!";
|
|
|
|
|
|
native int GetCharWidth(int code);
|
|
native int StringWidth(String code);
|
|
native int GetMaxAscender(String code);
|
|
native bool CanPrint(String code);
|
|
native int GetHeight();
|
|
native int GetDisplacement();
|
|
native String GetCursor();
|
|
|
|
native static int FindFontColor(Name color);
|
|
native double GetBottomAlignOffset(int code);
|
|
native static Font FindFont(Name fontname);
|
|
native static Font GetFont(Name fontname);
|
|
native BrokenLines BreakLines(String text, int maxlen);
|
|
}
|
|
|
|
struct Console native
|
|
{
|
|
native static void HideConsole();
|
|
native static void MidPrint(Font fontname, string textlabel, bool bold = false);
|
|
native static vararg void Printf(string fmt, ...);
|
|
}
|
|
|
|
struct CVar native
|
|
{
|
|
enum ECVarType
|
|
{
|
|
CVAR_Bool,
|
|
CVAR_Int,
|
|
CVAR_Float,
|
|
CVAR_String,
|
|
CVAR_Color,
|
|
};
|
|
|
|
native static CVar FindCVar(Name name);
|
|
//native static CVar GetCVar(Name name, PlayerInfo player = null);
|
|
bool GetBool() { return GetInt(); }
|
|
native int GetInt();
|
|
native double GetFloat();
|
|
native String GetString();
|
|
void SetBool(bool b) { SetInt(b); }
|
|
native void SetInt(int v);
|
|
native void SetFloat(double v);
|
|
native void SetString(String s);
|
|
native int GetRealType();
|
|
native int ResetToDefault();
|
|
}
|
|
|
|
struct GIFont version("2.4")
|
|
{
|
|
Name fontname;
|
|
Name color;
|
|
};
|
|
|
|
class Object native
|
|
{
|
|
const TICRATE = 35;
|
|
native bool bDestroyed;
|
|
|
|
// These must be defined in some class, so that the compiler can find them. Object is just fine, as long as they are private to external code.
|
|
private native static Object BuiltinNew(Class<Object> cls, int outerclass, int compatibility);
|
|
private native static int BuiltinRandom(voidptr rng, int min, int max);
|
|
private native static double BuiltinFRandom(voidptr rng, double min, double max);
|
|
private native static int BuiltinRandom2(voidptr rng, int mask);
|
|
private native static void BuiltinRandomSeed(voidptr rng, int seed);
|
|
private native static Class<Object> BuiltinNameToClass(Name nm, Class<Object> filter);
|
|
private native static Object BuiltinClassCast(Object inptr, Class<Object> test);
|
|
|
|
native static uint MSTime();
|
|
native vararg static void ThrowAbortException(String fmt, ...);
|
|
|
|
native virtualscope void Destroy();
|
|
|
|
// 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() {}
|
|
}
|
|
|
|
class BrokenLines : Object native version("2.4")
|
|
{
|
|
native int Count();
|
|
native int StringWidth(int line);
|
|
native String StringAt(int line);
|
|
}
|
|
|
|
struct StringTable native
|
|
{
|
|
native static String Localize(String val, bool prefixed = true);
|
|
}
|
|
|
|
struct Wads // todo: make FileSystem an alias to 'Wads'
|
|
{
|
|
enum WadNamespace
|
|
{
|
|
ns_hidden = -1,
|
|
|
|
ns_global = 0,
|
|
ns_sprites,
|
|
ns_flats,
|
|
ns_colormaps,
|
|
ns_acslibrary,
|
|
ns_newtextures,
|
|
ns_bloodraw,
|
|
ns_bloodsfx,
|
|
ns_bloodmisc,
|
|
ns_strifevoices,
|
|
ns_hires,
|
|
ns_voxels,
|
|
|
|
ns_specialzipdirectory,
|
|
ns_sounds,
|
|
ns_patches,
|
|
ns_graphics,
|
|
ns_music,
|
|
|
|
ns_firstskin,
|
|
}
|
|
|
|
enum FindLumpNamespace
|
|
{
|
|
GlobalNamespace = 0,
|
|
AnyNamespace = 1,
|
|
}
|
|
|
|
native static int CheckNumForName(string name, int ns, int wadnum = -1, bool exact = false);
|
|
native static int CheckNumForFullName(string name);
|
|
native static int FindLump(string name, int startlump = 0, FindLumpNamespace ns = GlobalNamespace);
|
|
native static string ReadLump(int lump);
|
|
|
|
native static int GetNumLumps();
|
|
native static string GetLumpName(int lump);
|
|
native static string GetLumpFullName(int lump);
|
|
native static int GetLumpNamespace(int lump);
|
|
}
|
|
|
|
enum EmptyTokenType
|
|
{
|
|
TOK_SKIPEMPTY = 0,
|
|
TOK_KEEPEMPTY = 1,
|
|
}
|
|
|
|
// Although String is a builtin type, this is a convenient way to attach methods to it.
|
|
struct StringStruct native
|
|
{
|
|
native static vararg String Format(String fmt, ...);
|
|
native vararg void AppendFormat(String fmt, ...);
|
|
|
|
native void Replace(String pattern, String replacement);
|
|
native String Left(int len) const;
|
|
native String Mid(int pos = 0, int len = 2147483647) const;
|
|
native void Truncate(int newlen);
|
|
native void Remove(int index, int remlen);
|
|
deprecated("4.1", "use Left() or Mid() instead") native String CharAt(int pos) const;
|
|
deprecated("4.1", "use ByteAt() instead") native int CharCodeAt(int pos) const;
|
|
native int ByteAt(int pos) const;
|
|
native String Filter();
|
|
native int IndexOf(String substr, int startIndex = 0) const;
|
|
deprecated("3.5.1", "use RightIndexOf() instead") native int LastIndexOf(String substr, int endIndex = 2147483647) const;
|
|
native int RightIndexOf(String substr, int endIndex = 2147483647) const;
|
|
deprecated("4.1", "use MakeUpper() instead") native void ToUpper();
|
|
deprecated("4.1", "use MakeLower() instead") native void ToLower();
|
|
native String MakeUpper() const;
|
|
native String MakeLower() const;
|
|
native static int CharUpper(int ch);
|
|
native static int CharLower(int ch);
|
|
native int ToInt(int base = 0) const;
|
|
native double ToDouble() const;
|
|
native void Split(out Array<String> tokens, String delimiter, EmptyTokenType keepEmpty = TOK_KEEPEMPTY) const;
|
|
native void AppendCharacter(int c);
|
|
native void DeleteLastCharacter();
|
|
native int CodePointCount() const;
|
|
native int, int GetNextCodePoint(int position) const;
|
|
}
|