2019-02-01 23:24:43 +00:00
2020-10-05 17:56:44 +00:00
// constants for A_PlaySound
enum ESoundFlags
{
CHAN_AUTO = 0,
CHAN_WEAPON = 1,
CHAN_VOICE = 2,
CHAN_ITEM = 3,
CHAN_BODY = 4,
CHAN_5 = 5,
CHAN_6 = 6,
CHAN_7 = 7,
// modifier flags
CHAN_LISTENERZ = 8,
CHAN_MAYBE_LOCAL = 16,
CHAN_UI = 32,
CHAN_NOPAUSE = 64,
CHAN_LOOP = 256,
CHAN_PICKUP = (CHAN_ITEM|CHAN_MAYBE_LOCAL), // Do not use this with A_StartSound! It would not do what is expected.
CHAN_NOSTOP = 4096,
CHAN_OVERLAP = 8192,
// Same as above, with an F appended to allow better distinction of channel and channel flags.
CHANF_DEFAULT = 0, // just to make the code look better and avoid literal 0's.
CHANF_LISTENERZ = 8,
CHANF_MAYBE_LOCAL = 16,
CHANF_UI = 32,
CHANF_NOPAUSE = 64,
CHANF_LOOP = 256,
CHANF_NOSTOP = 4096,
CHANF_OVERLAP = 8192,
CHANF_LOCAL = 16384,
CHANF_LOOPING = CHANF_LOOP | CHANF_NOSTOP, // convenience value for replicating the old 'looping' boolean.
};
// sound attenuation values
const ATTN_NONE = 0;
const ATTN_NORM = 1;
const ATTN_IDLE = 1.001;
const ATTN_STATIC = 3;
enum ERenderStyle
{
STYLE_None, // Do not draw
STYLE_Normal, // Normal; just copy the image to the screen
STYLE_Fuzzy, // Draw silhouette using "fuzz" effect
STYLE_SoulTrans, // Draw translucent with amount in r_transsouls
STYLE_OptFuzzy, // Draw as fuzzy or translucent, based on user preference
STYLE_Stencil, // Fill image interior with alphacolor
STYLE_Translucent, // Draw translucent
STYLE_Add, // Draw additive
STYLE_Shaded, // Treat patch data as alpha values for alphacolor
STYLE_TranslucentStencil,
STYLE_Shadow,
STYLE_Subtract, // Actually this is 'reverse subtract' but this is what normal people would expect by 'subtract'.
STYLE_AddStencil, // Fill image interior with alphacolor
STYLE_AddShaded, // Treat patch data as alpha values for alphacolor
STYLE_Multiply, // Multiply source with destination (HW renderer only.)
STYLE_InverseMultiply, // Multiply source with inverse of destination (HW renderer only.)
STYLE_ColorBlend, // Use color intensity as transparency factor
STYLE_Source, // No blending (only used internally)
STYLE_ColorAdd, // Use color intensity as transparency factor and blend additively.
};
enum EGameState
{
GS_LEVEL,
GS_INTERMISSION,
GS_FINALE,
GS_DEMOSCREEN,
2021-08-03 10:30:44 +00:00
GS_FULLCONSOLE, // [RH] Fullscreen console
GS_HIDECONSOLE, // [RH] The menu just did something that should hide fs console
GS_STARTUP, // [RH] Console is fullscreen, and game is just starting
GS_TITLELEVEL, // [RH] A combination of GS_LEVEL and GS_DEMOSCREEN
GS_INTRO,
GS_CUTSCENE,
2020-10-05 17:56:44 +00:00
GS_MENUSCREEN = GS_DEMOSCREEN,
}
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!";
enum EMonospacing
{
Mono_Off = 0,
Mono_CellLeft = 1,
Mono_CellCenter = 2,
Mono_CellRight = 3
};
enum EPrintLevel
{
PRINT_LOW, // pickup messages
PRINT_MEDIUM, // death messages
PRINT_HIGH, // critical messages
PRINT_CHAT, // chat messages
PRINT_TEAMCHAT, // chat messages from a teammate
PRINT_LOG, // only to logfile
PRINT_BOLD = 200, // What Printf_Bold used
PRINT_TYPES = 1023, // Bitmask.
PRINT_NONOTIFY = 1024, // Flag - do not add to notify buffer
PRINT_NOLOG = 2048, // Flag - do not print to log file
};
2017-03-18 14:42:34 +00:00
struct _ native // These are the global variables, the struct is only here to avoid extending the parser for this.
2017-03-13 13:42:14 +00:00
{
2018-09-24 00:16:49 +00:00
native readonly Array<class> AllClasses;
2017-03-13 13:42:14 +00:00
native readonly bool multiplayer;
native @KeyBindings Bindings;
native @KeyBindings AutomapBindings;
native readonly @GameInfoStruct gameinfo;
2018-12-02 11:51:54 +00:00
native readonly ui bool netgame;
2019-02-13 13:59:55 +00:00
native readonly uint gameaction;
2017-03-13 13:42:14 +00:00
native readonly int gamestate;
native readonly Font smallfont;
native readonly Font smallfont2;
native readonly Font bigfont;
native readonly Font confont;
2019-03-11 19:59:43 +00:00
native readonly Font NewConsoleFont;
2019-03-17 15:22:38 +00:00
native readonly Font NewSmallFont;
2019-04-21 06:09:31 +00:00
native readonly Font AlternativeSmallFont;
2020-10-17 12:00:29 +00:00
native readonly Font AlternativeBigFont;
2019-04-22 08:23:28 +00:00
native readonly Font OriginalSmallFont;
2019-04-23 07:34:28 +00:00
native readonly Font OriginalBigFont;
2017-03-13 13:42:14 +00:00
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 ui int menuactive;
native readonly @FOptionMenuSettings OptionMenuSettings;
native readonly bool demoplayback;
native ui int BackbuttonTime;
native ui float BackbuttonAlpha;
2019-02-28 17:45:32 +00:00
native readonly @MusPlayingInfo musplaying;
2019-04-09 22:45:32 +00:00
native readonly bool generic_ui;
2020-10-04 18:26:37 +00:00
native readonly int GameTicRate;
2020-10-07 14:00:39 +00:00
native MenuDelegateBase menuDelegate;
2019-02-01 23:24:43 +00:00
native readonly int consoleplayer;
2020-10-10 22:16:58 +00:00
native readonly double NotifyFontScale;
2017-03-13 13:42:14 +00:00
}
2021-08-03 10:30:44 +00:00
struct System native
{
native static void StopMusic();
native static void StopAllSounds();
native static bool SoundEnabled();
native static bool MusicEnabled();
native static double GetTimeFrac();
static bool specialKeyEvent(InputEvent ev)
{
if (ev.type == InputEvent.Type_KeyDown || ev.type == InputEvent.Type_KeyUp)
{
int key = ev.KeyScan;
if (key == InputEvent.KEY_VOLUMEDOWN || key == InputEvent.KEY_VOLUMEUP || (key > InputEvent.KEY_LASTJOYBUTTON && key < InputEvent.KEY_PAD_LTHUMB_RIGHT)) return true;
}
return false;
}
}
2019-02-27 18:53:30 +00:00
struct MusPlayingInfo native
{
native String name;
native int baseorder;
native bool loop;
2021-05-03 12:13:03 +00:00
native voidptr handle;
2019-02-27 18:53:30 +00:00
};
2017-01-15 22:21:38 +00:00
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,
2019-02-19 00:22:12 +00:00
DontCreate = 32,
2021-05-03 12:13:03 +00:00
Localize = 64,
ForceLookup = 128,
NoAlias = 256
2017-01-15 22:21:38 +00:00
};
2017-02-09 11:02:07 +00:00
enum ETexReplaceFlags
{
NOT_BOTTOM = 1,
NOT_MIDDLE = 2,
NOT_TOP = 4,
NOT_FLOOR = 8,
NOT_CEILING = 16,
NOT_WALL = 7,
NOT_FLAT = 24
};
2017-01-15 22:21:38 +00:00
2020-10-07 16:29:34 +00:00
native static TextureID CheckForTexture(String name, int usetype = Type_Any, int flags = TryAny);
2017-10-24 08:11:33 +00:00
native static String GetName(TextureID tex);
2017-02-11 15:11:48 +00:00
native static int, int GetSize(TextureID tex);
native static Vector2 GetScaledSize(TextureID tex);
2017-03-18 18:34:03 +00:00
native static Vector2 GetScaledOffset(TextureID tex);
2017-03-18 11:16:44 +00:00
native static int CheckRealHeight(TextureID tex);
2019-02-20 23:35:27 +00:00
native static bool OkForLocalization(TextureID patch, String textSubstitute);
2021-05-03 12:13:03 +00:00
native static bool UseGamePalette(TextureID tex);
2017-01-15 22:21:38 +00:00
}
2020-10-04 08:15:52 +00:00
enum EScaleMode
{
FSMode_None = 0,
FSMode_ScaleToFit = 1,
FSMode_ScaleToFill = 2,
FSMode_ScaleToFit43 = 3,
FSMode_ScaleToScreen = 4,
FSMode_ScaleToFit43Top = 5,
FSMode_ScaleToFit43Bottom = 6,
FSMode_ScaleToHeight = 7,
FSMode_Max,
// These all use ScaleToFit43, their purpose is to cut down on verbosity because they imply the virtual screen size.
FSMode_Predefined = 1000,
FSMode_Fit320x200 = 1000,
FSMode_Fit320x240,
FSMode_Fit640x400,
FSMode_Fit640x480,
FSMode_Fit320x200Top,
FSMode_Predefined_Max,
};
2017-02-05 17:07:12 +00:00
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,
2018-03-29 14:21:21 +00:00
DTA_Desaturate, // explicit desaturation factor (does not do anything in Legacy OpenGL)
2017-02-05 17:07:12 +00:00
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
2018-03-28 14:40:09 +00:00
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,
2018-07-14 20:58:24 +00:00
DTA_SrcHeight,
DTA_LegacyRenderStyle, // takes an old-style STYLE_* constant instead of an FRenderStyle
2018-12-01 08:52:51 +00:00
DTA_Internal3,
2019-04-13 10:17:38 +00:00
DTA_Spacing, // Strings only: Additional spacing between characters
DTA_Monospace, // Strings only: Use a fixed distance between characters.
2020-03-15 09:22:42 +00:00
2020-03-15 14:56:35 +00:00
DTA_FullscreenEx, // advanced fullscreen control.
2020-06-06 10:51:03 +00:00
DTA_FullscreenScale, // enable DTA_Fullscreen coordinate calculation for placed overlays.
2020-09-27 07:17:41 +00:00
DTA_ScaleX,
DTA_ScaleY,
DTA_ViewportX, // Defines the viewport on the screen that should be rendered to.
DTA_ViewportY,
DTA_ViewportWidth,
DTA_ViewportHeight,
DTA_CenterOffsetRel, // Apply texture offsets relative to center, instead of top left. This is standard alignment for Build's 2D content.
DTA_TopLeft, // always align to top left. Added to have a boolean condition for this alignment.
DTA_Pin, // Pin a non-widescreen image to the left/right edge of the screen.
DTA_Rotate,
DTA_FlipOffsets, // Flips offsets when using DTA_FlipX and DTA_FlipY, this cannot be automatic due to unexpected behavior with unoffsetted graphics.
DTA_Indexed, // Use an indexed texture combined with the given translation.
2020-10-04 08:15:52 +00:00
DTA_CleanTop, // Like DTA_Clean but aligns to the top of the screen instead of the center.
2020-10-09 20:44:34 +00:00
DTA_NoOffset, // Ignore 2D drawer's offset.
2020-09-27 07:17:41 +00:00
2017-02-05 17:07:12 +00:00
};
2019-06-07 18:22:27 +00:00
class Shape2DTransform : Object native
{
native void Clear();
native void Rotate(double angle);
native void Scale(Vector2 scaleVec);
native void Translate(Vector2 translateVec);
}
2018-06-07 18:58:31 +00:00
class Shape2D : Object native
{
enum EClearWhich
{
C_Verts = 1,
C_Coords = 2,
C_Indices = 4,
};
2019-06-07 18:22:27 +00:00
native void SetTransform(Shape2DTransform transform);
2018-06-07 18:58:31 +00:00
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 );
}
2017-01-17 16:31:54 +00:00
struct Screen native
2017-02-10 12:20:19 +00:00
{
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);
2017-02-18 19:12:06 +00:00
native static void Dim(Color col, double amount, int x, int y, int w, int h);
2017-02-10 12:20:19 +00:00
native static vararg void DrawTexture(TextureID tex, bool animate, double x, double y, ...);
2018-06-07 18:58:31 +00:00
native static vararg void DrawShape(TextureID tex, bool animate, Shape2D s, ...);
2017-02-10 12:20:19 +00:00
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, ...);
2018-09-26 16:59:22 +00:00
native static void DrawLine(int x0, int y0, int x1, int y1, Color color, int alpha = 255);
2020-10-07 16:29:34 +00:00
native static void DrawLineFrame(Color color, int x0, int y0, int w, int h, int thickness = 1);
2018-09-26 16:59:22 +00:00
native static void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, Color color, int alpha = 255);
2017-03-22 13:59:12 +00:00
native static Vector2, Vector2 VirtualToRealCoords(Vector2 pos, Vector2 size, Vector2 vsize, bool vbottom=false, bool handleaspect=true);
2017-03-22 23:25:26 +00:00
native static double GetAspectRatio();
2017-03-30 10:13:28 +00:00
native static void SetClipRect(int x, int y, int w, int h);
native static void ClearClipRect();
native static int, int, int, int GetClipRect();
2018-01-20 20:02:36 +00:00
native static int, int, int, int GetViewWindow();
2020-10-04 08:15:52 +00:00
native static double, double, double, double GetFullscreenRect(double vwidth, double vheight, int fsmode);
2020-10-09 20:44:34 +00:00
native static Vector2 SetOffset(double x, double y);
2021-05-03 12:13:03 +00:00
native static void ClearScreen(color col = 0);
native static void SetScreenFade(double factor);
2017-02-10 12:20:19 +00:00
}
struct Font native
2017-01-15 22:21:38 +00:00
{
2017-02-03 23:19:25 +00:00
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,
2017-09-23 08:01:07 +00:00
CR_ICE,
CR_FIRE,
CR_SAPPHIRE,
CR_TEAL,
2017-02-03 23:19:25 +00:00
NUM_TEXT_COLORS
};
2017-02-10 23:36:53 +00:00
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";
2017-09-23 08:01:07 +00:00
const TEXTCOLOR_ICE = "\034W";
const TEXTCOLOR_FIRE = "\034X";
const TEXTCOLOR_SAPPHIRE = "\034Y";
const TEXTCOLOR_TEAL = "\034Z";
2017-02-10 23:36:53 +00:00
const TEXTCOLOR_NORMAL = "\034-";
const TEXTCOLOR_BOLD = "\034+";
const TEXTCOLOR_CHAT = "\034*";
const TEXTCOLOR_TEAMCHAT = "\034!";
2017-02-05 15:18:41 +00:00
2017-02-05 12:55:05 +00:00
native int GetCharWidth(int code);
native int StringWidth(String code);
2019-07-30 08:52:24 +00:00
native int GetMaxAscender(String code);
2019-04-22 07:08:43 +00:00
native bool CanPrint(String code);
2017-02-10 10:44:46 +00:00
native int GetHeight();
2019-07-14 10:44:42 +00:00
native int GetDisplacement();
2017-02-11 15:11:48 +00:00
native String GetCursor();
2017-02-10 10:44:46 +00:00
2017-02-05 12:55:05 +00:00
native static int FindFontColor(Name color);
2018-12-01 23:34:28 +00:00
native double GetBottomAlignOffset(int code);
2017-02-05 12:14:22 +00:00
native static Font FindFont(Name fontname);
native static Font GetFont(Name fontname);
2017-02-18 22:39:02 +00:00
native BrokenLines BreakLines(String text, int maxlen);
2020-10-07 16:29:34 +00:00
native int GetGlyphHeight(int code);
2021-08-03 10:30:44 +00:00
native int GetDefaultKerning();
2017-02-03 23:46:22 +00:00
}
2017-01-17 16:31:54 +00:00
struct Console native
{
native static void HideConsole();
2017-02-12 15:02:55 +00:00
native static vararg void Printf(string fmt, ...);
2017-01-17 16:31:54 +00:00
}
2017-02-09 23:25:50 +00:00
struct CVar native
{
2017-02-10 23:36:53 +00:00
enum ECVarType
{
CVAR_Bool,
CVAR_Int,
CVAR_Float,
CVAR_String,
CVAR_Color,
};
2017-04-06 07:46:49 +00:00
native static CVar FindCVar(Name name);
2017-10-25 07:33:18 +00:00
bool GetBool() { return GetInt(); }
2017-02-10 12:20:19 +00:00
native int GetInt();
native double GetFloat();
native String GetString();
2017-10-25 07:33:18 +00:00
void SetBool(bool b) { SetInt(b); }
2017-02-10 23:36:53 +00:00
native void SetInt(int v);
native void SetFloat(double v);
native void SetString(String s);
native int GetRealType();
native int ResetToDefault();
2017-02-09 23:25:50 +00:00
}
2017-03-05 13:03:27 +00:00
struct GIFont version("2.4")
2017-02-22 22:52:25 +00:00
{
Name fontname;
Name color;
};
2017-01-17 16:31:54 +00:00
struct GameInfoStruct native
{
2017-01-19 16:40:34 +00:00
native int gametype;
2017-02-19 14:23:33 +00:00
native String mBackButton;
2017-10-14 17:05:15 +00:00
native Name mSliderColor;
2020-11-17 16:29:39 +00:00
native Name mSliderBackColor;
2017-01-17 16:31:54 +00:00
}
2020-08-27 16:43:50 +00:00
struct SystemTime
{
native static ui int Now(); // This returns the epoch time
native static clearscope String Format(String timeForm, int timeVal); // This converts an epoch time to a local time, then uses the strftime syntax to format it
}
2016-10-30 13:00:11 +00:00
class Object native
{
2020-04-12 20:10:41 +00:00
const TICRATE = 35;
2016-11-22 22:42:32 +00:00
native bool bDestroyed;
2018-11-25 10:41:29 +00:00
// 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.
2019-01-10 01:12:43 +00:00
private native static Object BuiltinNew(Class<Object> cls, int outerclass, int compatibility);
2018-11-25 20:47:28 +00:00
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);
2018-11-25 10:41:29 +00:00
2017-02-10 12:20:19 +00:00
native static uint MSTime();
2017-03-22 23:25:26 +00:00
native vararg static void ThrowAbortException(String fmt, ...);
2016-11-18 21:12:53 +00:00
2017-02-18 02:07:12 +00:00
native virtualscope void Destroy();
2016-12-27 18:25:55 +00:00
2017-01-12 21:49:18 +00:00
// This does not call into the native method of the same name to avoid problems with objects that get garbage collected late on shutdown.
2017-02-18 04:56:00 +00:00
virtual virtualscope void OnDestroy() {}
2016-10-30 13:00:11 +00:00
}
2017-03-05 13:03:27 +00:00
class BrokenLines : Object native version("2.4")
2017-02-18 22:39:02 +00:00
{
native int Count();
native int StringWidth(int line);
native String StringAt(int line);
}
2016-11-28 17:15:18 +00:00
struct StringTable native
{
2017-02-12 13:28:38 +00:00
native static String Localize(String val, bool prefixed = true);
2016-11-28 17:15:18 +00:00
}
2020-10-05 17:56:44 +00:00
struct Wads // todo: make FileSystem an alias to 'Wads'
2016-11-26 00:14:47 +00:00
{
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,
}
2017-10-29 08:06:52 +00:00
enum FindLumpNamespace
{
GlobalNamespace = 0,
AnyNamespace = 1,
}
2016-11-26 00:14:47 +00:00
native static int CheckNumForName(string name, int ns, int wadnum = -1, bool exact = false);
2017-10-29 13:11:49 +00:00
native static int CheckNumForFullName(string name);
2017-10-29 08:06:52 +00:00
native static int FindLump(string name, int startlump = 0, FindLumpNamespace ns = GlobalNamespace);
2017-10-29 08:07:17 +00:00
native static string ReadLump(int lump);
2019-11-25 15:37:56 +00:00
2020-04-21 07:07:24 +00:00
native static int GetNumLumps();
2019-11-25 15:37:56 +00:00
native static string GetLumpName(int lump);
native static string GetLumpFullName(int lump);
native static int GetLumpNamespace(int lump);
2016-11-27 23:49:10 +00:00
}
2017-10-28 08:26:55 +00:00
enum EmptyTokenType
{
TOK_SKIPEMPTY = 0,
TOK_KEEPEMPTY = 1,
}
2016-11-28 17:15:18 +00:00
// Although String is a builtin type, this is a convenient way to attach methods to it.
2017-01-23 18:09:36 +00:00
struct StringStruct native
2016-11-28 17:15:18 +00:00
{
2017-04-13 15:37:29 +00:00
native static vararg String Format(String fmt, ...);
2017-02-05 15:47:33 +00:00
native vararg void AppendFormat(String fmt, ...);
2017-02-06 11:18:10 +00:00
native void Replace(String pattern, String replacement);
2017-04-13 15:20:06 +00:00
native String Left(int len) const;
native String Mid(int pos = 0, int len = 2147483647) const;
2017-02-18 20:18:23 +00:00
native void Truncate(int newlen);
2017-11-12 12:44:21 +00:00
native void Remove(int index, int remlen);
2020-03-10 08:31:21 +00:00
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;
2019-04-13 07:31:36 +00:00
native int ByteAt(int pos) const;
2017-02-18 20:18:23 +00:00
native String Filter();
2017-07-22 07:54:32 +00:00
native int IndexOf(String substr, int startIndex = 0) const;
2020-03-10 08:31:21 +00:00
deprecated("3.5.1", "use RightIndexOf() instead") native int LastIndexOf(String substr, int endIndex = 2147483647) const;
2018-08-25 18:39:58 +00:00
native int RightIndexOf(String substr, int endIndex = 2147483647) const;
2020-03-10 08:31:21 +00:00
deprecated("4.1", "use MakeUpper() instead") native void ToUpper();
deprecated("4.1", "use MakeLower() instead") native void ToLower();
2019-04-13 19:18:47 +00:00
native String MakeUpper() const;
native String MakeLower() const;
2019-04-13 08:26:55 +00:00
native static int CharUpper(int ch);
native static int CharLower(int ch);
2017-08-25 12:09:18 +00:00
native int ToInt(int base = 0) const;
native double ToDouble() const;
2017-10-28 08:26:55 +00:00
native void Split(out Array<String> tokens, String delimiter, EmptyTokenType keepEmpty = TOK_KEEPEMPTY) const;
2019-02-16 20:29:46 +00:00
native void AppendCharacter(int c);
native void DeleteLastCharacter();
2019-04-13 19:18:47 +00:00
native int CodePointCount() const;
native int, int GetNextCodePoint(int position) const;
2021-05-03 12:13:03 +00:00
native void Substitute(String str, String replace);
2021-08-03 10:30:44 +00:00
native void StripRight(String junk = "");
2016-11-28 17:15:18 +00:00
}
2020-10-07 13:44:08 +00:00
struct Translation version("2.4")
{
static int MakeID(int group, int num)
{
return (group << 16) + num;
}
}