mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- added some ZScript basics.
This is merely the basics needed to actually implement something.
This commit is contained in:
parent
7edcd3125a
commit
e29eb5bbed
12 changed files with 1183 additions and 3 deletions
|
@ -790,6 +790,7 @@ set (PCH_SOURCES
|
|||
core/gamecontrol.cpp
|
||||
core/inputstate.cpp
|
||||
core/searchpaths.cpp
|
||||
core/screenjob.cpp
|
||||
core/initfs.cpp
|
||||
core/statistics.cpp
|
||||
core/secrets.cpp
|
||||
|
|
|
@ -1071,4 +1071,4 @@ xx(PlayerColors)
|
|||
xx(PlayerSkin)
|
||||
xx(NewPlayerMenu)
|
||||
xx(AltHud)
|
||||
|
||||
xx(GameScreen)
|
||||
|
|
94
source/core/screenjob.cpp
Normal file
94
source/core/screenjob.cpp
Normal file
|
@ -0,0 +1,94 @@
|
|||
|
||||
#include "types.h"
|
||||
#include "build.h"
|
||||
#include "screenjob.h"
|
||||
#include "dobject.h"
|
||||
|
||||
|
||||
void RunScreen(const char *classname, VMValue *params, int numparams, std::function<void(bool aborted)> completion)
|
||||
{
|
||||
int ticker = 0;
|
||||
auto ototalclock = totalclock;
|
||||
|
||||
PClass *cls = PClass::FindClass(classname);
|
||||
if (cls != nullptr && cls->IsDescendantOf(NAME_GameScreen))
|
||||
{
|
||||
auto func = dyn_cast<PFunction>(cls->FindSymbol("Init", true));
|
||||
if (func != nullptr && !(func->Variants[0].Flags & (VARF_Protected | VARF_Private))) // skip internal classes which have a protected init method.
|
||||
{
|
||||
TArray<VMValue> args(numparams+1);
|
||||
for(int i = 0;i<numparams;i++) args[i+1] = params[i];
|
||||
auto item = cls->CreateNew();
|
||||
if (!item)
|
||||
{
|
||||
completion(true);
|
||||
return;
|
||||
}
|
||||
args[0] = item;
|
||||
VMCallWithDefaults(func->Variants[0].Implementation, args, nullptr, 0);
|
||||
|
||||
while (true)
|
||||
{
|
||||
handleevents();
|
||||
event_t *ev;
|
||||
// This should later run off D_ProcessEvents, but currently requires a local copy here
|
||||
while (eventtail != eventhead)
|
||||
{
|
||||
ev = &events[eventtail];
|
||||
eventtail = (eventtail + 1) & (MAXEVENTS - 1);
|
||||
if (ev->type == EV_None)
|
||||
continue;
|
||||
if (ev->type == EV_DeviceChange)
|
||||
UpdateJoystickMenu(I_UpdateDeviceList());
|
||||
#if 0 // this isn't safe with the current engine structure
|
||||
if (C_Responder (ev))
|
||||
continue; // console ate the event
|
||||
if (M_Responder (ev))
|
||||
continue; // menu ate the event
|
||||
#endif
|
||||
|
||||
IFVIRTUALPTRNAME(item, NAME_GameScreen, OnEvent)
|
||||
{
|
||||
FInputEvent e = ev;
|
||||
VMValue params[] = { (DObject*)item, &e };
|
||||
int retval;
|
||||
VMReturn ret(&retval);
|
||||
VMCall(func, params, 2, &ret, 1);
|
||||
if (!retval)
|
||||
{
|
||||
completion(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while ((int)(totalclock - ototalclock) >= 1)
|
||||
{
|
||||
IFVIRTUALPTRNAME(item, NAME_GameScreen, Tick)
|
||||
{
|
||||
FInputEvent e = ev;
|
||||
VMValue params[] = { (DObject*)item, ticker };
|
||||
ticker++;
|
||||
int retval;
|
||||
VMReturn ret(&retval);
|
||||
VMCall(func, params, 2, &ret, 1);
|
||||
if (!retval)
|
||||
{
|
||||
completion(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
IFVIRTUALPTRNAME(item, NAME_GameScreen, Draw)
|
||||
{
|
||||
FInputEvent e = ev;
|
||||
VMValue params[] = { (DObject*)item };
|
||||
ticker++;
|
||||
VMCall(func, params, 1, nullptr, 0);
|
||||
}
|
||||
videoNextPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
completion(true);
|
||||
}
|
5
source/core/screenjob.h
Normal file
5
source/core/screenjob.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
#pragma once
|
||||
#include <functional>
|
||||
#include "vm.h"
|
||||
|
||||
void RunScreen(const char *classname, VMValue *params, int numparams, std::function<void(bool aborted)> completion);
|
|
@ -48,8 +48,8 @@ const char *GetVersionString();
|
|||
#define RC_PRODUCTVERSION 0,6,0,0
|
||||
#define RC_PRODUCTVERSION2 VERSIONSTR
|
||||
// These are for content versioning.
|
||||
#define VER_MAJOR 0
|
||||
#define VER_MINOR 6
|
||||
#define VER_MAJOR 4
|
||||
#define VER_MINOR 3
|
||||
#define VER_REVISION 0
|
||||
|
||||
#define ENG_MAJOR 0
|
||||
|
|
7
wadsrc/static/zscript.txt
Normal file
7
wadsrc/static/zscript.txt
Normal file
|
@ -0,0 +1,7 @@
|
|||
version "4.3"
|
||||
#include "zscript/base.zs"
|
||||
#include "zscript/dynarrays.zs"
|
||||
#include "zscript/constants.zs"
|
||||
#include "zscript/events.zs"
|
||||
#include "zscript/dictionary.zs"
|
||||
#include "zscript/gamescreen.zs"
|
448
wadsrc/static/zscript/base.zs
Normal file
448
wadsrc/static/zscript/base.zs
Normal file
|
@ -0,0 +1,448 @@
|
|||
|
||||
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;
|
||||
}
|
146
wadsrc/static/zscript/constants.zs
Normal file
146
wadsrc/static/zscript/constants.zs
Normal file
|
@ -0,0 +1,146 @@
|
|||
|
||||
// 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 ETranslationTable
|
||||
{
|
||||
TRANSLATION_Invalid,
|
||||
TRANSLATION_Basepalette,
|
||||
TRANSLATION_Remap,
|
||||
};
|
||||
|
||||
enum EGameState
|
||||
{
|
||||
GS_LEVEL,
|
||||
GS_INTERMISSION,
|
||||
GS_FINALE,
|
||||
GS_DEMOSCREEN,
|
||||
GS_FULLCONSOLE,
|
||||
GS_HIDECONSOLE,
|
||||
GS_STARTUP,
|
||||
GS_TITLELEVEL,
|
||||
}
|
||||
|
||||
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
|
||||
};
|
65
wadsrc/static/zscript/dictionary.zs
Normal file
65
wadsrc/static/zscript/dictionary.zs
Normal file
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* Dictionary provides key-value storage.
|
||||
*
|
||||
* Both keys and values are strings.
|
||||
*
|
||||
* @note keys are case-sensitive.
|
||||
*/
|
||||
class Dictionary
|
||||
{
|
||||
native static Dictionary Create();
|
||||
|
||||
native void Insert(String key, String value);
|
||||
native void Remove(String key);
|
||||
|
||||
/**
|
||||
* Returns the value for the specified key.
|
||||
*/
|
||||
native String At(String key) const;
|
||||
|
||||
/**
|
||||
* Deserializes a dictionary from a string.
|
||||
*
|
||||
* @param s serialized string, must be either empty or returned from ToString().
|
||||
*/
|
||||
native static Dictionary FromString(String s);
|
||||
|
||||
/**
|
||||
* Serializes a dictionary to a string.
|
||||
*/
|
||||
native String ToString() const;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides iterating over a Dictionary.
|
||||
*
|
||||
* Order is not specified.
|
||||
*
|
||||
* DictionaryIterator is not serializable. To make DictionaryIterator a class
|
||||
* member, use `transient` keyword.
|
||||
*/
|
||||
class DictionaryIterator
|
||||
{
|
||||
native static DictionaryIterator Create(Dictionary dict);
|
||||
|
||||
/**
|
||||
* Returns false if there are no more entries in the dictionary.
|
||||
* Otherwise, returns true.
|
||||
*
|
||||
* While it returns true, get key and value for the current entry
|
||||
* with Key() and Value() functions.
|
||||
*/
|
||||
native bool Next();
|
||||
|
||||
/**
|
||||
* Returns the key for the current dictionary entry.
|
||||
* Do not call this function before calling Next().
|
||||
*/
|
||||
native String Key() const;
|
||||
|
||||
/**
|
||||
* Returns the value for the current dictionary entry.
|
||||
* Do not call this function before calling Next().
|
||||
*/
|
||||
native String Value() const;
|
||||
}
|
162
wadsrc/static/zscript/dynarrays.zs
Normal file
162
wadsrc/static/zscript/dynarrays.zs
Normal file
|
@ -0,0 +1,162 @@
|
|||
// The VM uses 7 integral data types, so for dynamic array support we need one specific set of functions for each of these types.
|
||||
// Do not use these structs directly, they are incomplete and only needed to create prototypes for the needed functions.
|
||||
|
||||
struct DynArray_I8 native
|
||||
{
|
||||
native readonly uint Size;
|
||||
|
||||
native void Copy(DynArray_I8 other);
|
||||
native void Move(DynArray_I8 other);
|
||||
native void Append (DynArray_I8 other);
|
||||
native uint Find(int item) const;
|
||||
native uint Push (int item);
|
||||
native bool Pop ();
|
||||
native void Delete (uint index, int deletecount = 1);
|
||||
native void Insert (uint index, int item);
|
||||
native void ShrinkToFit ();
|
||||
native void Grow (uint amount);
|
||||
native void Resize (uint amount);
|
||||
native uint Reserve (uint amount);
|
||||
native uint Max () const;
|
||||
native void Clear ();
|
||||
}
|
||||
|
||||
struct DynArray_I16 native
|
||||
{
|
||||
native readonly uint Size;
|
||||
|
||||
native void Copy(DynArray_I16 other);
|
||||
native void Move(DynArray_I16 other);
|
||||
native void Append (DynArray_I16 other);
|
||||
native uint Find(int item) const;
|
||||
native uint Push (int item);
|
||||
native bool Pop ();
|
||||
native void Delete (uint index, int deletecount = 1);
|
||||
native void Insert (uint index, int item);
|
||||
native void ShrinkToFit ();
|
||||
native void Grow (uint amount);
|
||||
native void Resize (uint amount);
|
||||
native uint Reserve (uint amount);
|
||||
native uint Max () const;
|
||||
native void Clear ();
|
||||
}
|
||||
|
||||
struct DynArray_I32 native
|
||||
{
|
||||
native readonly uint Size;
|
||||
|
||||
native void Copy(DynArray_I32 other);
|
||||
native void Move(DynArray_I32 other);
|
||||
native void Append (DynArray_I32 other);
|
||||
native uint Find(int item) const;
|
||||
native uint Push (int item);
|
||||
native bool Pop ();
|
||||
native void Delete (uint index, int deletecount = 1);
|
||||
native void Insert (uint index, int item);
|
||||
native void ShrinkToFit ();
|
||||
native void Grow (uint amount);
|
||||
native void Resize (uint amount);
|
||||
native uint Reserve (uint amount);
|
||||
native uint Max () const;
|
||||
native void Clear ();
|
||||
}
|
||||
|
||||
struct DynArray_F32 native
|
||||
{
|
||||
native readonly uint Size;
|
||||
|
||||
native void Copy(DynArray_F32 other);
|
||||
native void Move(DynArray_F32 other);
|
||||
native void Append (DynArray_F32 other);
|
||||
native uint Find(double item) const;
|
||||
native uint Push (double item);
|
||||
native bool Pop ();
|
||||
native void Delete (uint index, int deletecount = 1);
|
||||
native void Insert (uint index, double item);
|
||||
native void ShrinkToFit ();
|
||||
native void Grow (uint amount);
|
||||
native void Resize (uint amount);
|
||||
native uint Reserve (uint amount);
|
||||
native uint Max () const;
|
||||
native void Clear ();
|
||||
}
|
||||
|
||||
struct DynArray_F64 native
|
||||
{
|
||||
native readonly uint Size;
|
||||
|
||||
native void Copy(DynArray_F64 other);
|
||||
native void Move(DynArray_F64 other);
|
||||
native void Append (DynArray_F64 other);
|
||||
native uint Find(double item) const;
|
||||
native uint Push (double item);
|
||||
native bool Pop ();
|
||||
native void Delete (uint index, int deletecount = 1);
|
||||
native void Insert (uint index, double item);
|
||||
native void ShrinkToFit ();
|
||||
native void Grow (uint amount);
|
||||
native void Resize (uint amount);
|
||||
native uint Reserve (uint amount);
|
||||
native uint Max () const;
|
||||
native void Clear ();
|
||||
}
|
||||
|
||||
struct DynArray_Ptr native
|
||||
{
|
||||
native readonly uint Size;
|
||||
|
||||
native void Copy(DynArray_Ptr other);
|
||||
native void Move(DynArray_Ptr other);
|
||||
native void Append (DynArray_Ptr other);
|
||||
native uint Find(voidptr item) const;
|
||||
native uint Push (voidptr item);
|
||||
native bool Pop ();
|
||||
native void Delete (uint index, int deletecount = 1);
|
||||
native void Insert (uint index, voidptr item);
|
||||
native void ShrinkToFit ();
|
||||
native void Grow (uint amount);
|
||||
native void Resize (uint amount);
|
||||
native uint Reserve (uint amount);
|
||||
native uint Max () const;
|
||||
native void Clear ();
|
||||
}
|
||||
|
||||
struct DynArray_Obj native
|
||||
{
|
||||
native readonly uint Size;
|
||||
|
||||
native void Copy(DynArray_Obj other);
|
||||
native void Move(DynArray_Obj other);
|
||||
native void Append (DynArray_Obj other);
|
||||
native uint Find(Object item) const;
|
||||
native uint Push (Object item);
|
||||
native bool Pop ();
|
||||
native void Delete (uint index, int deletecount = 1);
|
||||
native void Insert (uint index, Object item);
|
||||
native void ShrinkToFit ();
|
||||
native void Grow (uint amount);
|
||||
native void Resize (uint amount);
|
||||
native uint Reserve (uint amount);
|
||||
native uint Max () const;
|
||||
native void Clear ();
|
||||
}
|
||||
|
||||
struct DynArray_String native
|
||||
{
|
||||
native readonly uint Size;
|
||||
|
||||
native void Copy(DynArray_String other);
|
||||
native void Move(DynArray_String other);
|
||||
native void Append (DynArray_String other);
|
||||
native uint Find(String item) const;
|
||||
native uint Push (String item);
|
||||
native bool Pop ();
|
||||
native void Delete (uint index, int deletecount = 1);
|
||||
native void Insert (uint index, String item);
|
||||
native void ShrinkToFit ();
|
||||
native void Grow (uint amount);
|
||||
native void Resize (uint amount);
|
||||
native uint Reserve (uint amount);
|
||||
native uint Max () const;
|
||||
native void Clear ();
|
||||
}
|
234
wadsrc/static/zscript/events.zs
Normal file
234
wadsrc/static/zscript/events.zs
Normal file
|
@ -0,0 +1,234 @@
|
|||
|
||||
struct UiEvent ui native
|
||||
{
|
||||
// d_gui.h
|
||||
enum EGUIEvent
|
||||
{
|
||||
Type_None,
|
||||
Type_KeyDown,
|
||||
Type_KeyRepeat,
|
||||
Type_KeyUp,
|
||||
Type_Char,
|
||||
Type_FirstMouseEvent, // ?
|
||||
Type_MouseMove,
|
||||
Type_LButtonDown,
|
||||
Type_LButtonUp,
|
||||
Type_LButtonClick,
|
||||
Type_MButtonDown,
|
||||
Type_MButtonUp,
|
||||
Type_MButtonClick,
|
||||
Type_RButtonDown,
|
||||
Type_RButtonUp,
|
||||
Type_RButtonClick,
|
||||
Type_WheelUp,
|
||||
Type_WheelDown,
|
||||
Type_WheelRight, // ???
|
||||
Type_WheelLeft, // ???
|
||||
Type_BackButtonDown, // ???
|
||||
Type_BackButtonUp, // ???
|
||||
Type_FwdButtonDown, // ???
|
||||
Type_FwdButtonUp, // ???
|
||||
Type_LastMouseEvent
|
||||
}
|
||||
|
||||
// for KeyDown, KeyRepeat, KeyUp
|
||||
enum ESpecialGUIKeys
|
||||
{
|
||||
Key_PgDn = 1,
|
||||
Key_PgUp = 2,
|
||||
Key_Home = 3,
|
||||
Key_End = 4,
|
||||
Key_Left = 5,
|
||||
Key_Right = 6,
|
||||
Key_Alert = 7, // ASCII bell
|
||||
Key_Backspace = 8, // ASCII
|
||||
Key_Tab = 9, // ASCII
|
||||
Key_LineFeed = 10, // ASCII
|
||||
Key_Down = 10,
|
||||
Key_VTab = 11, // ASCII
|
||||
Key_Up = 11,
|
||||
Key_FormFeed = 12, // ASCII
|
||||
Key_Return = 13, // ASCII
|
||||
Key_F1 = 14,
|
||||
Key_F2 = 15,
|
||||
Key_F3 = 16,
|
||||
Key_F4 = 17,
|
||||
Key_F5 = 18,
|
||||
Key_F6 = 19,
|
||||
Key_F7 = 20,
|
||||
Key_F8 = 21,
|
||||
Key_F9 = 22,
|
||||
Key_F10 = 23,
|
||||
Key_F11 = 24,
|
||||
Key_F12 = 25,
|
||||
Key_Del = 26,
|
||||
Key_Escape = 27, // ASCII
|
||||
Key_Free1 = 28,
|
||||
Key_Free2 = 29,
|
||||
Key_Back = 30, // browser back key
|
||||
Key_CEscape = 31 // color escape
|
||||
}
|
||||
|
||||
//
|
||||
native readonly EGUIEvent Type;
|
||||
//
|
||||
native readonly String KeyString;
|
||||
native readonly int KeyChar;
|
||||
//
|
||||
native readonly int MouseX;
|
||||
native readonly int MouseY;
|
||||
//
|
||||
native readonly bool IsShift;
|
||||
native readonly bool IsCtrl;
|
||||
native readonly bool IsAlt;
|
||||
}
|
||||
|
||||
struct InputEvent native play version("2.4")
|
||||
{
|
||||
enum EGenericEvent
|
||||
{
|
||||
Type_None,
|
||||
Type_KeyDown,
|
||||
Type_KeyUp,
|
||||
Type_Mouse,
|
||||
Type_GUI, // unused, kept for completeness
|
||||
Type_DeviceChange
|
||||
}
|
||||
|
||||
// ew.
|
||||
enum EDoomInputKeys
|
||||
{
|
||||
Key_Pause = 0xc5, // DIK_PAUSE
|
||||
Key_RightArrow = 0xcd, // DIK_RIGHT
|
||||
Key_LeftArrow = 0xcb, // DIK_LEFT
|
||||
Key_UpArrow = 0xc8, // DIK_UP
|
||||
Key_DownArrow = 0xd0, // DIK_DOWN
|
||||
Key_Escape = 0x01, // DIK_ESCAPE
|
||||
Key_Enter = 0x1c, // DIK_RETURN
|
||||
Key_Space = 0x39, // DIK_SPACE
|
||||
Key_Tab = 0x0f, // DIK_TAB
|
||||
Key_F1 = 0x3b, // DIK_F1
|
||||
Key_F2 = 0x3c, // DIK_F2
|
||||
Key_F3 = 0x3d, // DIK_F3
|
||||
Key_F4 = 0x3e, // DIK_F4
|
||||
Key_F5 = 0x3f, // DIK_F5
|
||||
Key_F6 = 0x40, // DIK_F6
|
||||
Key_F7 = 0x41, // DIK_F7
|
||||
Key_F8 = 0x42, // DIK_F8
|
||||
Key_F9 = 0x43, // DIK_F9
|
||||
Key_F10 = 0x44, // DIK_F10
|
||||
Key_F11 = 0x57, // DIK_F11
|
||||
Key_F12 = 0x58, // DIK_F12
|
||||
Key_Grave = 0x29, // DIK_GRAVE
|
||||
|
||||
Key_Backspace = 0x0e, // DIK_BACK
|
||||
|
||||
Key_Equals = 0x0d, // DIK_EQUALS
|
||||
Key_Minus = 0x0c, // DIK_MINUS
|
||||
|
||||
Key_LShift = 0x2A, // DIK_LSHIFT
|
||||
Key_LCtrl = 0x1d, // DIK_LCONTROL
|
||||
Key_LAlt = 0x38, // DIK_LMENU
|
||||
|
||||
Key_RShift = Key_LSHIFT,
|
||||
Key_RCtrl = Key_LCTRL,
|
||||
Key_RAlt = Key_LALT,
|
||||
|
||||
Key_Ins = 0xd2, // DIK_INSERT
|
||||
Key_Del = 0xd3, // DIK_DELETE
|
||||
Key_End = 0xcf, // DIK_END
|
||||
Key_Home = 0xc7, // DIK_HOME
|
||||
Key_PgUp = 0xc9, // DIK_PRIOR
|
||||
Key_PgDn = 0xd1, // DIK_NEXT
|
||||
|
||||
Key_Mouse1 = 0x100,
|
||||
Key_Mouse2 = 0x101,
|
||||
Key_Mouse3 = 0x102,
|
||||
Key_Mouse4 = 0x103,
|
||||
Key_Mouse5 = 0x104,
|
||||
Key_Mouse6 = 0x105,
|
||||
Key_Mouse7 = 0x106,
|
||||
Key_Mouse8 = 0x107,
|
||||
|
||||
Key_FirstJoyButton = 0x108,
|
||||
Key_Joy1 = (Key_FirstJoyButton+0),
|
||||
Key_Joy2 = (Key_FirstJoyButton+1),
|
||||
Key_Joy3 = (Key_FirstJoyButton+2),
|
||||
Key_Joy4 = (Key_FirstJoyButton+3),
|
||||
Key_Joy5 = (Key_FirstJoyButton+4),
|
||||
Key_Joy6 = (Key_FirstJoyButton+5),
|
||||
Key_Joy7 = (Key_FirstJoyButton+6),
|
||||
Key_Joy8 = (Key_FirstJoyButton+7),
|
||||
Key_LastJoyButton = 0x187,
|
||||
Key_JoyPOV1_Up = 0x188,
|
||||
Key_JoyPOV1_Right = 0x189,
|
||||
Key_JoyPOV1_Down = 0x18a,
|
||||
Key_JoyPOV1_Left = 0x18b,
|
||||
Key_JoyPOV2_Up = 0x18c,
|
||||
Key_JoyPOV3_Up = 0x190,
|
||||
Key_JoyPOV4_Up = 0x194,
|
||||
|
||||
Key_MWheelUp = 0x198,
|
||||
Key_MWheelDown = 0x199,
|
||||
Key_MWheelRight = 0x19A,
|
||||
Key_MWheelLeft = 0x19B,
|
||||
|
||||
Key_JoyAxis1Plus = 0x19C,
|
||||
Key_JoyAxis1Minus = 0x19D,
|
||||
Key_JoyAxis2Plus = 0x19E,
|
||||
Key_JoyAxis2Minus = 0x19F,
|
||||
Key_JoyAxis3Plus = 0x1A0,
|
||||
Key_JoyAxis3Minus = 0x1A1,
|
||||
Key_JoyAxis4Plus = 0x1A2,
|
||||
Key_JoyAxis4Minus = 0x1A3,
|
||||
Key_JoyAxis5Plus = 0x1A4,
|
||||
Key_JoyAxis5Minus = 0x1A5,
|
||||
Key_JoyAxis6Plus = 0x1A6,
|
||||
Key_JoyAxis6Minus = 0x1A7,
|
||||
Key_JoyAxis7Plus = 0x1A8,
|
||||
Key_JoyAxis7Minus = 0x1A9,
|
||||
Key_JoyAxis8Plus = 0x1AA,
|
||||
Key_JoyAxis8Minus = 0x1AB,
|
||||
Num_JoyAxisButtons = 8,
|
||||
|
||||
Key_Pad_LThumb_Right = 0x1AC,
|
||||
Key_Pad_LThumb_Left = 0x1AD,
|
||||
Key_Pad_LThumb_Down = 0x1AE,
|
||||
Key_Pad_LThumb_Up = 0x1AF,
|
||||
|
||||
Key_Pad_RThumb_Right = 0x1B0,
|
||||
Key_Pad_RThumb_Left = 0x1B1,
|
||||
Key_Pad_RThumb_Down = 0x1B2,
|
||||
Key_Pad_RThumb_Up = 0x1B3,
|
||||
|
||||
Key_Pad_DPad_Up = 0x1B4,
|
||||
Key_Pad_DPad_Down = 0x1B5,
|
||||
Key_Pad_DPad_Left = 0x1B6,
|
||||
Key_Pad_DPad_Right = 0x1B7,
|
||||
Key_Pad_Start = 0x1B8,
|
||||
Key_Pad_Back = 0x1B9,
|
||||
Key_Pad_LThumb = 0x1BA,
|
||||
Key_Pad_RThumb = 0x1BB,
|
||||
Key_Pad_LShoulder = 0x1BC,
|
||||
Key_Pad_RShoulder = 0x1BD,
|
||||
Key_Pad_LTrigger = 0x1BE,
|
||||
Key_Pad_RTrigger = 0x1BF,
|
||||
Key_Pad_A = 0x1C0,
|
||||
Key_Pad_B = 0x1C1,
|
||||
Key_Pad_X = 0x1C2,
|
||||
Key_Pad_Y = 0x1C3,
|
||||
|
||||
Num_Keys = 0x1C4
|
||||
}
|
||||
|
||||
//
|
||||
native readonly EGenericEvent Type;
|
||||
//
|
||||
native readonly int KeyScan; // as in EDoomInputKeys enum
|
||||
native readonly String KeyString;
|
||||
native readonly int KeyChar; // ASCII char (if any)
|
||||
//
|
||||
native readonly int MouseX;
|
||||
native readonly int MouseY;
|
||||
}
|
||||
|
18
wadsrc/static/zscript/gamescreen.zs
Normal file
18
wadsrc/static/zscript/gamescreen.zs
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
// Base class for game screens.
|
||||
class GameScreen : Object ui
|
||||
{
|
||||
virtual bool OnEvent(InputEvent ev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool Tick(int framenum)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void Draw()
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue