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 Array<class<Actor> > AllActorClasses;
native readonly Array<@PlayerClass> PlayerClasses;
native readonly Array<@PlayerSkin> PlayerSkins;
native readonly Array<@Team> Teams;
native int validcount;
native readonly bool multiplayer;
native play @LevelLocals level;
native @KeyBindings Bindings;
native @KeyBindings AutomapBindings;
native play @DehInfo deh;
native readonly @GameInfoStruct gameinfo;
native play @PlayerInfo players[MAXPLAYERS];
native readonly bool playeringame[MAXPLAYERS];
2017-03-28 09:00:05 +00:00
native readonly bool automapactive;
2017-03-13 13:42:14 +00:00
native play uint gameaction;
native readonly int gamestate;
native readonly TextureID skyflatnum;
native readonly uint8 globalfreeze;
native readonly int consoleplayer;
native readonly Font smallfont;
native readonly Font smallfont2;
native readonly Font bigfont;
native readonly Font confont;
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 int gametic;
native readonly bool demoplayback;
native ui int BackbuttonTime;
native ui float BackbuttonAlpha;
2017-03-18 14:42:34 +00:00
native readonly int Net_Arbitrator;
2017-03-21 19:09:09 +00:00
native ui BaseStatusBar StatusBar;
2017-04-12 20:46:49 +00:00
native readonly Weapon WP_NOCHANGE;
2017-04-30 22:25:21 +00:00
native int LocalViewPitch;
2017-03-13 13:42:14 +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,
DontCreate = 32
};
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
native static TextureID CheckForTexture(String name, int usetype, int flags = TryAny);
2017-02-09 11:02:07 +00:00
native static void ReplaceTextures(String from, String to, int flags);
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);
2017-04-19 09:01:56 +00:00
2017-08-31 20:37:29 +00:00
native static void SetCameraToTexture(Actor viewpoint, String texture, double fov);
2017-01-15 22:21:38 +00:00
}
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-03-28 14:40:09 +00:00
2017-02-05 17:07:12 +00:00
};
2018-06-07 18:58:31 +00:00
class Shape2D : Object native
{
enum EClearWhich
{
C_Verts = 1,
C_Coords = 2,
C_Indices = 4,
};
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);
native static void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, Color color, int alpha = 255);
2017-02-11 15:11:48 +00:00
native static void DrawFrame(int x, int y, int w, int h);
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();
2017-03-30 10:13:28 +00:00
2017-03-24 21:57:44 +00:00
// This is a leftover of the abandoned Inventory.DrawPowerup method.
deprecated("2.5") static ui void DrawHUDTexture(TextureID tex, double x, double y)
{
2017-03-26 16:41:24 +00:00
statusBar.DrawTexture(tex, (x, y), BaseStatusBar.DI_SCREEN_RIGHT_TOP, 1., (32, 32));
2017-03-24 21:57:44 +00:00
}
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);
2017-02-10 10:44:46 +00:00
native int GetHeight();
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);
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);
2017-02-03 23:46:22 +00:00
}
2017-03-05 13:03:27 +00:00
struct Translation version("2.4")
2017-02-11 15:11:48 +00:00
{
Color colors[256];
2017-02-12 15:48:29 +00:00
native int AddTranslation();
2017-02-11 15:11:48 +00:00
native static bool SetPlayerTranslation(int group, int num, int plrnum, PlayerClass pclass);
2017-04-14 15:40:05 +00:00
native static int GetID(Name transname);
2017-02-11 15:11:48 +00:00
static int MakeID(int group, int num)
{
return (group << 16) + num;
}
}
2017-01-17 16:31:54 +00:00
struct Console native
{
native static void HideConsole();
2017-02-05 12:14:22 +00:00
native static void MidPrint(Font fontname, string textlabel, bool bold = false);
2017-02-12 15:02:55 +00:00
native static vararg void Printf(string fmt, ...);
2017-01-17 16:31:54 +00:00
}
2017-01-18 21:15:48 +00:00
struct DamageTypeDefinition native
{
native static bool IgnoreArmor(Name type);
}
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-04-06 07:51:36 +00:00
native static CVar GetCVar(Name name, PlayerInfo player = null);
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
{
// will be extended as needed.
native Name backpacktype;
native double Armor2Percent;
2017-01-18 21:15:48 +00:00
native String ArmorIcon1;
native String ArmorIcon2;
2017-01-19 16:40:34 +00:00
native int gametype;
2017-02-17 22:56:22 +00:00
native bool norandomplayerclass;
2017-02-18 23:08:30 +00:00
native Array<Name> infoPages;
2017-02-19 14:23:33 +00:00
native String mBackButton;
2017-02-22 22:52:25 +00:00
native GIFont mStatscreenMapNameFont;
native GIFont mStatscreenEnteringFont;
native GIFont mStatscreenFinishedFont;
2017-02-28 12:40:46 +00:00
native double gibfactor;
2017-03-18 18:34:03 +00:00
native bool intermissioncounter;
2017-10-14 17:05:15 +00:00
native Name mSliderColor;
2018-11-24 06:45:49 +00:00
native double telefogheight;
2018-11-25 00:12:45 +00:00
native int defKickback;
2017-01-17 16:31:54 +00:00
}
2016-10-30 13:00:11 +00:00
class Object native
{
2016-11-22 22:42:32 +00:00
native bool bDestroyed;
2016-11-18 21:12:53 +00:00
// These really should be global functions...
2017-03-24 01:12:03 +00:00
native static String G_SkillName();
2016-11-18 21:12:53 +00:00
native static int G_SkillPropertyInt(int p);
native static double G_SkillPropertyFloat(int p);
2016-11-25 18:52:35 +00:00
native static vector3, int G_PickDeathmatchStart();
native static vector3, int G_PickPlayerStart(int pnum, int flags = 0);
2016-11-28 10:52:03 +00:00
native static void S_Sound (Sound sound_id, int channel, float volume = 1, float attenuation = ATTN_NORM);
2017-01-03 19:06:20 +00:00
native static void S_PauseSound (bool notmusic, bool notsfx);
native static void S_ResumeSound (bool notsfx);
2016-11-30 00:25:51 +00:00
native static bool S_ChangeMusic(String music_name, int order = 0, bool looping = true, bool force = false);
2018-01-06 23:42:37 +00:00
native static float S_GetLength(Sound sound_id);
2018-11-25 06:43:05 +00:00
native static void MarkSound(Sound snd);
2016-11-29 16:17:10 +00:00
native static uint BAM(double angle);
2016-12-28 20:41:06 +00:00
native static void SetMusicVolume(float vol);
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);
}
2017-03-03 21:30:02 +00:00
class Thinker : Object native play
2016-10-30 13:00:11 +00:00
{
2016-11-29 18:50:34 +00:00
enum EStatnums
{
// Thinkers that don't actually think
STAT_INFO, // An info queue
STAT_DECAL, // A decal
STAT_AUTODECAL, // A decal that can be automatically deleted
STAT_CORPSEPOINTER, // An entry in Hexen's corpse queue
STAT_TRAVELLING, // An actor temporarily travelling to a new map
2017-02-25 16:14:03 +00:00
STAT_STATIC,
2016-11-29 18:50:34 +00:00
// Thinkers that do think
STAT_FIRST_THINKING=32,
STAT_SCROLLER=STAT_FIRST_THINKING, // A DScroller thinker
STAT_PLAYER, // A player actor
STAT_BOSSTARGET, // A boss brain target
STAT_LIGHTNING, // The lightning thinker
STAT_DECALTHINKER, // An object that thinks for a decal
STAT_INVENTORY, // An inventory item
STAT_LIGHT, // A sector light effect
STAT_LIGHTTRANSFER, // A sector light transfer. These must be ticked after the light effects.
STAT_EARTHQUAKE, // Earthquake actors
STAT_MAPMARKER, // Map marker actors
2017-03-12 15:56:00 +00:00
STAT_DLIGHT, // Dynamic lights
2016-11-29 18:50:34 +00:00
2017-08-12 11:08:11 +00:00
STAT_USER = 70,
STAT_USER_MAX = 90,
2016-11-29 18:50:34 +00:00
STAT_DEFAULT = 100, // Thinkers go here unless specified otherwise.
STAT_SECTOREFFECT, // All sector effects that cause floor and ceiling movement
STAT_ACTORMOVER, // actor movers
STAT_SCRIPTS, // The ACS thinker. This is to ensure that it can't tick before all actors called PostBeginPlay
STAT_BOT, // Bot thinker
MAX_STATNUM = 127
}
2016-11-23 20:26:59 +00:00
const TICRATE = 35;
2016-11-21 13:59:17 +00:00
virtual native void Tick();
virtual native void PostBeginPlay();
2016-11-29 18:50:34 +00:00
virtual native void ChangeStatNum(int stat);
2017-03-20 18:04:17 +00:00
2017-03-21 19:09:09 +00:00
static clearscope int Tics2Seconds(int tics)
2017-03-20 18:04:17 +00:00
{
2017-12-25 10:36:37 +00:00
return int(tics / TICRATE);
2017-03-20 18:04:17 +00:00
}
2016-10-31 16:02:47 +00:00
}
class ThinkerIterator : Object native
{
2016-11-29 18:50:34 +00:00
native static ThinkerIterator Create(class<Object> type = "Actor", int statnum=Thinker.MAX_STATNUM+1);
2016-11-05 00:19:41 +00:00
native Thinker Next(bool exact = false);
2016-10-31 16:02:47 +00:00
native void Reinit();
}
2016-11-16 00:36:21 +00:00
class ActorIterator : Object native
2017-03-13 11:48:25 +00:00
{
2016-11-16 00:36:21 +00:00
native static ActorIterator Create(int tid, class<Actor> type = "Actor");
native Actor Next();
native void Reinit();
}
2016-11-29 17:42:48 +00:00
class BlockThingsIterator : Object native
{
native Actor thing;
native Vector3 position;
native int portalflags;
native static BlockThingsIterator Create(Actor origin, double checkradius = -1, bool ignorerestricted = false);
native static BlockThingsIterator CreateFromPos(double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted);
native bool Next();
}
2017-03-09 15:45:48 +00:00
class BlockLinesIterator : Object native
{
native Line CurLine;
native Vector3 position;
native int portalflags;
2017-09-26 07:54:55 +00:00
native static BlockLinesIterator Create(Actor origin, double checkradius = -1);
native static BlockLinesIterator CreateFromPos(Vector3 pos, double checkh, double checkradius, Sector sec = null);
2017-03-09 15:45:48 +00:00
native bool Next();
}
2018-01-20 13:37:03 +00:00
enum ETraceStatus
{
TRACE_Stop, // stop the trace, returning this hit
TRACE_Continue, // continue the trace, returning this hit if there are none further along
TRACE_Skip, // continue the trace; do not return this hit
TRACE_Abort // stop the trace, returning no hits
}
enum ETraceFlags
{
2018-04-25 16:26:31 +00:00
TRACE_NoSky = 0x0001, // Hitting the sky returns TRACE_HitNone
//TRACE_PCross = 0x0002, // Trigger SPAC_PCROSS lines
//TRACE_Impact = 0x0004, // Trigger SPAC_IMPACT lines
TRACE_PortalRestrict = 0x0008, // Cannot go through portals without a static link offset.
TRACE_ReportPortals = 0x0010, // Report any portal crossing to the TraceCallback
//TRACE_3DCallback = 0x0020, // [ZZ] use TraceCallback to determine whether we need to go through a line to do 3D floor check, or not. without this, only line flag mask is used
2018-11-02 05:14:02 +00:00
TRACE_HitSky = 0x0040 // Hitting the sky returns TRACE_HasHitSky
2018-01-20 13:37:03 +00:00
}
enum ETraceResult
{
TRACE_HitNone,
TRACE_HitFloor,
TRACE_HitCeiling,
TRACE_HitWall,
TRACE_HitActor,
2018-11-02 05:14:02 +00:00
TRACE_CrossingPortal,
TRACE_HasHitSky
2018-01-20 13:37:03 +00:00
}
enum ELineTier
{
TIER_Middle,
TIER_Upper,
TIER_Lower,
TIER_FFloor
}
struct TraceResults native
{
2018-01-20 13:49:46 +00:00
native Sector HitSector; // originally called "Sector". cannot be named like this in ZScript.
2018-01-20 13:37:03 +00:00
native TextureID HitTexture;
native vector3 HitPos;
native vector3 HitVector;
native vector3 SrcFromTarget;
native double SrcAngleFromTarget;
native double Distance;
native double Fraction;
2018-01-20 13:49:46 +00:00
native Actor HitActor; // valid if hit an actor. // originally called "Actor".
2018-01-20 13:37:03 +00:00
2018-01-20 13:49:46 +00:00
native Line HitLine; // valid if hit a line // originally called "Line".
2018-01-20 13:37:03 +00:00
native uint8 Side;
native uint8 Tier; // see Tracer.ELineTier
native bool unlinked; // passed through a portal without static offset.
native ETraceResult HitType;
// F3DFloor *ffloor;
native Sector CrossedWater; // For Boom-style, Transfer_Heights-based deep water
native vector3 CrossedWaterPos; // remember the position so that we can use it for spawning the splash
native Sector Crossed3DWater; // For 3D floor-based deep water
native vector3 Crossed3DWaterPos;
}
2018-01-27 08:32:26 +00:00
class LineTracer : Object native
2018-01-20 13:37:03 +00:00
{
native @TraceResults Results;
native bool Trace(vector3 start, Sector sec, vector3 direction, double maxDist, ETraceFlags traceFlags);
virtual ETraceStatus TraceCallback()
{
// Normally you would examine Results.HitType (for ETraceResult), and determine either:
// - stop tracing and return the entity that was found (return TRACE_Stop)
// - ignore some object, like noclip, e.g. only count solid walls and floors, and ignore actors (return TRACE_Skip)
// - find last object of some type (return TRACE_Continue)
// - stop tracing entirely and assume we found nothing (return TRACE_Abort)
// TRACE_Abort and TRACE_Continue are of limited use in scripting.
return TRACE_Stop; // default callback returns first hit, whatever it is.
}
}
2017-03-09 15:45:48 +00:00
2017-02-08 19:37:22 +00:00
struct DropItem native
2016-10-31 16:02:47 +00:00
{
native readonly DropItem Next;
2016-11-05 00:19:41 +00:00
native readonly name Name;
2016-10-31 16:02:47 +00:00
native readonly int Probability;
2017-06-21 09:39:59 +00:00
native readonly int Amount;
2016-10-31 16:02:47 +00:00
}
2016-11-18 21:12:53 +00:00
class SpotState : Object native
{
native static SpotState GetSpotState();
native SpecialSpot GetNextInList(class<Actor> type, int skipcounter);
2016-11-24 00:23:35 +00:00
native SpecialSpot GetSpotWithMinMaxDistance(Class<Actor> type, double x, double y, double mindist, double maxdist);
2016-11-22 18:20:31 +00:00
}
2016-11-22 23:35:06 +00:00
struct LevelLocals native
{
2017-02-15 00:03:47 +00:00
enum EUDMF
{
UDMF_Line,
UDMF_Side,
UDMF_Sector,
//UDMF_Thing // not implemented
};
2017-03-13 11:48:25 +00:00
native Array<@Sector> Sectors;
native Array<@Line> Lines;
native Array<@Side> Sides;
native readonly Array<@Vertex> Vertexes;
2018-04-15 10:16:46 +00:00
native internal Array<@SectorPortal> SectorPortals;
2017-03-13 11:48:25 +00:00
2016-11-22 23:35:06 +00:00
native readonly int time;
native readonly int maptime;
native readonly int totaltime;
native readonly int starttime;
native readonly int partime;
native readonly int sucktime;
native readonly int cluster;
native readonly int clusterflags;
native readonly int levelnum;
native readonly String LevelName;
native readonly String MapName;
native String NextMap;
native String NextSecretMap;
2017-02-18 23:08:30 +00:00
native String F1Pic;
2016-11-22 23:35:06 +00:00
native readonly int maptype;
native readonly String Music;
native readonly int musicorder;
2018-01-26 18:46:08 +00:00
native readonly TextureID skytexture1;
native readonly TextureID skytexture2;
native float skyspeed1;
native float skyspeed2;
2016-11-29 18:50:34 +00:00
native int total_secrets;
2016-11-22 23:35:06 +00:00
native int found_secrets;
2016-11-29 18:50:34 +00:00
native int total_items;
2016-11-22 23:35:06 +00:00
native int found_items;
2016-11-29 18:50:34 +00:00
native int total_monsters;
2016-11-22 23:35:06 +00:00
native int killed_monsters;
2017-03-05 13:03:27 +00:00
native play double gravity;
native play double aircontrol;
native play double airfriction;
native play int airsupply;
native readonly double teamdamage;
2017-03-22 23:25:26 +00:00
native readonly bool noinventorybar;
2017-03-05 13:03:27 +00:00
native readonly bool monsterstelefrag;
native readonly bool actownspecial;
native readonly bool sndseqtotalctrl;
2016-11-22 23:35:06 +00:00
native bool allmap;
2017-03-05 13:03:27 +00:00
native readonly bool missilesactivateimpact;
native readonly bool monsterfallingdamage;
native readonly bool checkswitchrange;
native readonly bool polygrind;
native readonly bool nomonsters;
2017-04-30 22:25:21 +00:00
native readonly bool allowrespawn;
2017-01-03 19:06:20 +00:00
native bool frozen;
2017-03-05 13:03:27 +00:00
native readonly bool infinite_flight;
native readonly bool no_dlg_freeze;
2017-03-14 12:54:24 +00:00
native readonly int fogdensity;
native readonly int outsidefogdensity;
native readonly int skyfog;
2017-12-29 07:42:03 +00:00
native readonly float pixelstretch;
2018-11-24 19:32:12 +00:00
native name deathsequence;
2016-11-22 23:35:06 +00:00
// level_info_t *info cannot be done yet.
2017-02-15 00:03:47 +00:00
native String GetUDMFString(int type, int index, Name key);
native int GetUDMFInt(int type, int index, Name key);
native double GetUDMFFloat(int type, int index, Name key);
2017-02-15 21:49:13 +00:00
native bool ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0);
2017-08-18 08:25:33 +00:00
native static void GiveSecret(Actor activator, bool printmsg = true, bool playsound = true);
2017-03-14 09:41:13 +00:00
native static void StartSlideshow(Name whichone = 'none');
2017-03-18 14:42:34 +00:00
native static void WorldDone();
native static void RemoveAllBots(bool fromlist);
2017-03-18 18:34:03 +00:00
native void SetInterMusic(String nextmap);
2017-03-29 12:20:22 +00:00
native String FormatMapName(int mapnamecolor);
2017-04-30 22:25:21 +00:00
native bool IsJumpingAllowed() const;
2017-04-30 20:16:32 +00:00
native bool IsCrouchingAllowed() const;
2017-04-30 22:25:21 +00:00
native bool IsFreelookAllowed() const;
2018-11-24 19:32:12 +00:00
native void StartIntermission(Name type, int state) const;
2018-01-01 01:02:14 +00:00
2018-11-07 20:03:32 +00:00
native static clearscope bool IsPointInMap(vector3 p);
2018-01-01 01:02:14 +00:00
native static clearscope vector2 Vec2Diff(vector2 v1, vector2 v2);
native static clearscope vector3 Vec3Diff(vector3 v1, vector3 v2);
2018-08-20 23:31:52 +00:00
native static clearscope vector3 SphericalCoords(vector3 viewpoint, vector3 targetPos, vector2 viewAngles = (0, 0), bool absolute = false);
2018-04-16 21:43:17 +00:00
native static clearscope vector2 Vec2Offset(vector2 pos, vector2 dir, bool absolute = false);
native static clearscope vector3 Vec2OffsetZ(vector2 pos, vector2 dir, double atz, bool absolute = false);
native static clearscope vector3 Vec3Offset(vector3 pos, vector3 dir, bool absolute = false);
2018-01-07 00:59:49 +00:00
native String GetChecksum() const;
2018-01-26 18:46:08 +00:00
native void ChangeSky( TextureID sky1, TextureID sky2 );
2017-03-29 12:20:22 +00:00
String TimeFormatted(bool totals = false)
2017-03-24 01:12:03 +00:00
{
2017-03-29 12:20:22 +00:00
int sec = Thinker.Tics2Seconds(totals? totaltime : time);
2017-03-24 01:12:03 +00:00
return String.Format("%02d:%02d:%02d", sec / 3600, (sec % 3600) / 60, sec % 60);
}
2016-11-22 23:35:06 +00:00
}
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
}
2016-11-25 00:33:04 +00:00
// a few values of this need to be readable by the play code.
// Most are handled at load time and are omitted here.
struct DehInfo native
{
2018-04-01 06:37:32 +00:00
native readonly int MaxSoulsphere;
native readonly uint8 ExplosionStyle;
native readonly double ExplosionAlpha;
native readonly int NoAutofreeze;
native readonly int BFGCells;
native readonly int BlueAC;
2016-11-25 00:33:04 +00:00
}
2016-11-22 23:35:06 +00:00
struct State native
{
2018-04-01 06:37:32 +00:00
native readonly State NextState;
native readonly int sprite;
native readonly int16 Tics;
native readonly uint16 TicRange;
native readonly uint8 Frame;
native readonly uint8 UseFlags;
native readonly int Misc1;
native readonly int Misc2;
native readonly uint16 bSlow;
native readonly uint16 bFast;
native readonly bool bFullbright;
native readonly bool bNoDelay;
native readonly bool bSameFrame;
native readonly bool bCanRaise;
native readonly bool bDehacked;
2016-11-28 22:30:14 +00:00
native int DistanceTo(state other);
2017-01-19 16:40:34 +00:00
native bool ValidateSpriteFrame();
2017-02-11 15:11:48 +00:00
native TextureID, bool, Vector2 GetSpriteTexture(int rotation, int skin = 0, Vector2 scale = (0,0));
2016-11-22 23:35:06 +00:00
}
2016-11-25 15:05:03 +00:00
struct F3DFloor native
{
}
2016-11-26 00:14:47 +00:00
struct 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,
}
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);
2016-11-27 23:49:10 +00:00
}
struct TerrainDef native
{
native Name TerrainName;
native int Splash;
native int DamageAmount;
native Name DamageMOD;
native int DamageTimeMask;
native double FootClip;
native float StepVolume;
native int WalkStepTics;
native int RunStepTics;
native Sound LeftStepSound;
native Sound RightStepSound;
native bool IsLiquid;
native bool AllowProtection;
native double Friction;
native double MoveFactor;
};
2016-11-28 00:30:36 +00:00
enum EPickStart
{
PPS_FORCERANDOM = 1,
PPS_NOBLOCKINGCHECK = 2,
}
2016-11-28 17:15:18 +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);
2017-04-13 15:20:06 +00:00
native String CharAt(int pos) const;
native int CharCodeAt(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;
2018-08-25 18:54:16 +00:00
deprecated("3.5.1") 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;
2017-08-07 12:24:18 +00:00
native void ToUpper();
native void ToLower();
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;
2016-11-28 17:15:18 +00:00
}
2016-11-28 20:33:14 +00:00
2017-04-12 20:46:49 +00:00
class SectorEffect : Thinker native
{
native protected Sector m_Sector;
2018-01-28 20:25:19 +00:00
2018-03-03 08:28:25 +00:00
native Sector GetSector();
2017-04-12 20:46:49 +00:00
}
class Mover : SectorEffect native
{}
class MovingFloor : Mover native
{}
class MovingCeiling : Mover native
{}
class Floor : MovingFloor native
2016-11-28 20:33:14 +00:00
{
// only here so that some constants and functions can be added. Not directly usable yet.
enum EFloor
{
floorLowerToLowest,
floorLowerToNearest,
floorLowerToHighest,
floorLowerByValue,
floorRaiseByValue,
floorRaiseToHighest,
floorRaiseToNearest,
floorRaiseAndCrush,
floorRaiseAndCrushDoom,
floorCrushStop,
floorLowerInstant,
floorRaiseInstant,
floorMoveToValue,
floorRaiseToLowestCeiling,
2017-03-05 13:03:27 +00:00
floorRaiseByTexture,
2016-11-28 20:33:14 +00:00
floorLowerAndChange,
floorRaiseAndChange,
floorRaiseToLowest,
floorRaiseToCeiling,
floorLowerToLowestCeiling,
2017-03-05 13:03:27 +00:00
floorLowerByTexture,
2016-11-28 20:33:14 +00:00
floorLowerToCeiling,
donutRaise,
buildStair,
waitStair,
resetStair,
2017-02-12 22:05:39 +00:00
// Not to be used as parameters to DoFloor()
2016-11-28 20:33:14 +00:00
genFloorChg0,
genFloorChgT,
genFloorChg
};
2016-11-30 00:25:51 +00:00
native static bool CreateFloor(sector sec, EFloor floortype, line ln, double speed, double height = 0, int crush = -1, int change = 0, bool crushmode = false, bool hereticlower = false);
}
2017-04-12 20:46:49 +00:00
class Ceiling : MovingCeiling native
2016-11-30 00:25:51 +00:00
{
enum ECeiling
{
ceilLowerByValue,
ceilRaiseByValue,
ceilMoveToValue,
ceilLowerToHighestFloor,
ceilLowerInstant,
ceilRaiseInstant,
ceilCrushAndRaise,
ceilLowerAndCrush,
ceil_placeholder,
ceilCrushRaiseAndStay,
ceilRaiseToNearest,
ceilLowerToLowest,
ceilLowerToFloor,
// The following are only used by Generic_Ceiling
ceilRaiseToHighest,
ceilLowerToHighest,
ceilRaiseToLowest,
ceilLowerToNearest,
ceilRaiseToHighestFloor,
ceilRaiseToFloor,
2017-03-05 13:03:27 +00:00
ceilRaiseByTexture,
ceilLowerByTexture,
2016-11-30 00:25:51 +00:00
genCeilingChg0,
genCeilingChgT,
genCeilingChg
}
enum ECrushMode
{
crushDoom = 0,
crushHexen = 1,
crushSlowdown = 2
}
2017-11-25 13:54:48 +00:00
native static bool CreateCeiling(sector sec, int type, line ln, double speed, double speed2, double height = 0, int crush = -1, int silent = 0, int change = 0, int crushmode = crushDoom);
2016-11-28 20:33:14 +00:00
2016-11-30 00:25:51 +00:00
}
struct LookExParams
{
double Fov;
double minDist;
double maxDist;
double maxHeardist;
int flags;
State seestate;
};
2017-03-19 12:15:38 +00:00
class Lighting : SectorEffect native
{
}
2017-07-03 20:30:49 +00:00
struct Shader native
{
2017-07-08 12:44:07 +00:00
native clearscope static void SetEnabled(PlayerInfo player, string shaderName, bool enable);
native clearscope static void SetUniform1f(PlayerInfo player, string shaderName, string uniformName, float value);
native clearscope static void SetUniform2f(PlayerInfo player, string shaderName, string uniformName, vector2 value);
native clearscope static void SetUniform3f(PlayerInfo player, string shaderName, string uniformName, vector3 value);
native clearscope static void SetUniform1i(PlayerInfo player, string shaderName, string uniformName, int value);
2017-07-03 20:30:49 +00:00
}
2018-11-24 14:12:30 +00:00
struct FRailParams
{
native int damage;
native double offset_xy;
native double offset_z;
native int color1, color2;
native double maxdiff;
native int flags;
native Class<Actor> puff;
native double angleoffset;
native double pitchoffset;
native double distance;
native int duration;
native double sparsity;
native double drift;
native Class<Actor> spawnclass;
native int SpiralOffset;
native int limit;
}; // [RH] Shoot a railgun