diff --git a/src/common/console/c_cvars.cpp b/src/common/console/c_cvars.cpp index c9b859f2d84..2d08d7b6824 100644 --- a/src/common/console/c_cvars.cpp +++ b/src/common/console/c_cvars.cpp @@ -55,9 +55,6 @@ struct FLatchedValue static TArray LatchedValues; -bool FBaseCVar::m_DoNoSet = false; -bool FBaseCVar::m_UseCallback = false; - FBaseCVar *CVars = NULL; int cvar_defflags; diff --git a/src/common/console/c_cvars.h b/src/common/console/c_cvars.h index 38462b077e3..cc83824e1a7 100644 --- a/src/common/console/c_cvars.h +++ b/src/common/console/c_cvars.h @@ -216,8 +216,8 @@ class FBaseCVar void (*m_Callback)(FBaseCVar &); FBaseCVar *m_Next; - static bool m_UseCallback; - static bool m_DoNoSet; + static inline bool m_UseCallback = false; + static inline bool m_DoNoSet = false; void *m_ExtraDataPointer; diff --git a/src/common/cutscenes/movieplayer.cpp b/src/common/cutscenes/movieplayer.cpp index f709defcd08..afd710e2cd0 100644 --- a/src/common/cutscenes/movieplayer.cpp +++ b/src/common/cutscenes/movieplayer.cpp @@ -255,7 +255,6 @@ class VpxPlayer : public MoviePlayer failed = true; } - // The decoder needs a buffer with even height Pic.Resize(width * height * 4); diff --git a/src/common/engine/i_interface.cpp b/src/common/engine/i_interface.cpp index 613c3d5deb9..217f9212f23 100644 --- a/src/common/engine/i_interface.cpp +++ b/src/common/engine/i_interface.cpp @@ -1,6 +1,8 @@ #include "i_interface.h" +#include "st_start.h" // Some global engine variables taken out of the backend code. +FStartupScreen* StartWindow; SystemCallbacks sysCallbacks; FString endoomName; bool batchrun; diff --git a/src/common/filesystem/filesystem.cpp b/src/common/filesystem/filesystem.cpp index 4afb284e14c..5af6215fb67 100644 --- a/src/common/filesystem/filesystem.cpp +++ b/src/common/filesystem/filesystem.cpp @@ -1698,4 +1698,4 @@ CCMD(fs_dir) bool hidden = fileSystem.FindFile(fn1) != i; Printf(PRINT_NONOTIFY, "%s%-64s %-15s (%5d) %10d %s %s\n", hidden ? TEXTCOLOR_RED : TEXTCOLOR_UNTRANSLATED, fn1, fns, fnid, length, container, hidden ? "(h)" : ""); } -} +} \ No newline at end of file diff --git a/src/common/rendering/gl/gl_stereo3d.cpp b/src/common/rendering/gl/gl_stereo3d.cpp index c9a4bdd75df..9f6bb56f5e8 100644 --- a/src/common/rendering/gl/gl_stereo3d.cpp +++ b/src/common/rendering/gl/gl_stereo3d.cpp @@ -430,4 +430,4 @@ void FGLRenderer::PresentStereo() } } -} +} \ No newline at end of file diff --git a/src/common/rendering/hwrenderer/data/hw_skydome.cpp b/src/common/rendering/hwrenderer/data/hw_skydome.cpp index 8734b352cd9..aa726d02be4 100644 --- a/src/common/rendering/hwrenderer/data/hw_skydome.cpp +++ b/src/common/rendering/hwrenderer/data/hw_skydome.cpp @@ -455,7 +455,7 @@ void FSkyVertexBuffer::RenderRow(FRenderState& state, EDrawType prim, int row, T // //----------------------------------------------------------------------------- -void FSkyVertexBuffer::RenderDome(FRenderState& state, FGameTexture* tex, int mode, bool which, PalEntry color) +void FSkyVertexBuffer::DoRenderDome(FRenderState& state, FGameTexture* tex, int mode, bool which, PalEntry color) { auto& primStart = which ? mPrimStartBuild : mPrimStartDoom; if (tex && tex->isValid()) @@ -510,7 +510,7 @@ void FSkyVertexBuffer::RenderDome(FRenderState& state, FGameTexture* tex, float { SetupMatrices(tex, x_offset, y_offset, mirror, mode, state.mModelMatrix, state.mTextureMatrix, tiled, xscale, yscale); } - RenderDome(state, tex, mode, false, color); + DoRenderDome(state, tex, mode, false, color); } @@ -570,5 +570,6 @@ void FSkyVertexBuffer::RenderBox(FRenderState& state, FSkyBox* tex, float x_offs state.Draw(DT_TriangleStrip, FaceStart(4), 4); state.EnableModelMatrix(false); + state.SetObjectColor(0xffffffff); } diff --git a/src/common/rendering/hwrenderer/data/hw_skydome.h b/src/common/rendering/hwrenderer/data/hw_skydome.h index 213394c328f..0016b31389b 100644 --- a/src/common/rendering/hwrenderer/data/hw_skydome.h +++ b/src/common/rendering/hwrenderer/data/hw_skydome.h @@ -90,7 +90,7 @@ class FSkyVertexBuffer } void RenderRow(FRenderState& state, EDrawType prim, int row, TArray& mPrimStart, bool apply = true); - void RenderDome(FRenderState& state, FGameTexture* tex, int mode, bool which, PalEntry color = 0xffffffff); + void DoRenderDome(FRenderState& state, FGameTexture* tex, int mode, bool which, PalEntry color = 0xffffffff); void RenderDome(FRenderState& state, FGameTexture* tex, float x_offset, float y_offset, bool mirror, int mode, bool tiled, float xscale = 0, float yscale = 0, PalEntry color = 0xffffffff); void RenderBox(FRenderState& state, FSkyBox* tex, float x_offset, bool sky2, float stretch, const FVector3& skyrotatevector, const FVector3& skyrotatevector2, PalEntry color = 0xffffffff); diff --git a/src/common/scripting/backend/codegen.cpp b/src/common/scripting/backend/codegen.cpp index f43960f7899..0fd13f9ce69 100644 --- a/src/common/scripting/backend/codegen.cpp +++ b/src/common/scripting/backend/codegen.cpp @@ -11158,7 +11158,7 @@ ExpEmit FxLocalArrayDeclaration::Emit(VMFunctionBuilder *build) auto zero = build->GetConstantInt(0); auto elementSizeConst = build->GetConstantInt(static_cast(ValueType)->ElementSize); - int arrOffsetReg; + int arrOffsetReg = 0; if (!isDynamicArray) { arrOffsetReg = build->Registers[REGT_POINTER].Get(1); diff --git a/src/common/scripting/frontend/zcc_parser.cpp b/src/common/scripting/frontend/zcc_parser.cpp index 6060373f335..cae956672da 100644 --- a/src/common/scripting/frontend/zcc_parser.cpp +++ b/src/common/scripting/frontend/zcc_parser.cpp @@ -425,9 +425,9 @@ PNamespace *ParseOneScript(const int baselump, ZCCParseState &state) { FString fullPath = IncludeLocs[i].FileName.GetChars(); // get full path, format 'wad:filepath/filename' - long start = fullPath.IndexOf(":"); // find first ':' + auto start = fullPath.IndexOf(":"); // find first ':' - long end = fullPath.LastIndexOf("/"); // find last '/' + auto end = fullPath.LastIndexOf("/"); // find last '/' if (start!=-1&&end!=-1) { @@ -443,7 +443,7 @@ PNamespace *ParseOneScript(const int baselump, ZCCParseState &state) while (relativePath.IndexOf("../") == 0) // go back one folder for each '..' { relativePath = relativePath.Mid(3); - long slash_index = resolvedPath.LastIndexOf("/"); + auto slash_index = resolvedPath.LastIndexOf("/"); if (slash_index != -1) { resolvedPath = resolvedPath.Mid(0,slash_index); } else { diff --git a/src/common/startscreen/startscreen.cpp b/src/common/startscreen/startscreen.cpp index 9da8b0934b3..14adefac443 100644 --- a/src/common/startscreen/startscreen.cpp +++ b/src/common/startscreen/startscreen.cpp @@ -350,15 +350,15 @@ FStartScreen* GetGameStartScreen(int max_progress) { try { - if (GameStartupInfo.Type == FStartupInfo::HexenStartup || (gameinfo.gametype == GAME_Hexen && GameStartupInfo.Type == FStartupInfo::DefaultStartup)) + if (GameStartupInfo.Type == FStartupInfo::HexenStartup) { return CreateHexenStartScreen(max_progress); } - else if (GameStartupInfo.Type == FStartupInfo::HereticStartup || (gameinfo.gametype == GAME_Heretic && GameStartupInfo.Type == FStartupInfo::DefaultStartup)) + else if (GameStartupInfo.Type == FStartupInfo::HereticStartup) { return CreateHereticStartScreen(max_progress); } - else if (GameStartupInfo.Type == FStartupInfo::StrifeStartup || (gameinfo.gametype == GAME_Strife && GameStartupInfo.Type == FStartupInfo::DefaultStartup)) + else if (GameStartupInfo.Type == FStartupInfo::StrifeStartup) { return CreateStrifeStartScreen(max_progress); } diff --git a/src/common/textures/formats/startscreentexture.cpp b/src/common/textures/formats/startscreentexture.cpp index 75b110a57a9..490b74fd73d 100644 --- a/src/common/textures/formats/startscreentexture.cpp +++ b/src/common/textures/formats/startscreentexture.cpp @@ -34,7 +34,6 @@ ** */ -#include "doomtype.h" #include "files.h" #include "gi.h" #include "bitmap.h" diff --git a/src/common/utility/i_time.cpp b/src/common/utility/i_time.cpp index 22516ed45ad..4f2ac96cb0b 100644 --- a/src/common/utility/i_time.cpp +++ b/src/common/utility/i_time.cpp @@ -198,34 +198,26 @@ void I_ResetFrameTime() FirstFrameStartTime += (CurrentFrameStartTime - ft); } -double I_GetInputFrac(bool const synchronised, double const ticrate) +double I_GetInputFrac(bool const synchronised) { if (!synchronised) { - const double max = 1000. / ticrate; const double now = I_msTimeF(); - const double elapsedInputTicks = std::min(now - lastinputtime, max); + const double result = (now - lastinputtime) * GameTicRate * (1. / 1000.); lastinputtime = now; - if (elapsedInputTicks < max) + if (result < 1) { // Calculate an amplification to apply to the result before returning, // factoring in the game's ticrate and the value of the result. // This rectifies a deviation of 100+ ms or more depending on the length // of the operation to be within 1-2 ms of synchronised input // from 60 fps to at least 1000 fps at ticrates of 30 and 40 Hz. - const double result = elapsedInputTicks * ticrate * (1. / 1000.); - return result * (1. + 0.35 * (1. - ticrate * (1. / 50.)) * (1. - result)); + return result * (1. + 0.35 * (1. - GameTicRate * (1. / 50.)) * (1. - result)); } - else - { - return 1; - } - } - else - { - return 1; } + + return 1; } void I_ResetInputTime() diff --git a/src/common/utility/i_time.h b/src/common/utility/i_time.h index 4e7874bb89f..d9501ea96a5 100644 --- a/src/common/utility/i_time.h +++ b/src/common/utility/i_time.h @@ -40,7 +40,7 @@ uint64_t I_nsTime(); void I_ResetFrameTime(); // Return a decimal fraction to scale input operations at framerate -double I_GetInputFrac(bool const synchronised, double const ticrate = GameTicRate); +double I_GetInputFrac(bool const synchronised); // Reset the last input check to after a lengthy operation void I_ResetInputTime(); diff --git a/src/d_main.cpp b/src/d_main.cpp index 87830ba900a..0d340877807 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -335,7 +335,6 @@ int restart = 0; bool AppActive = true; bool playedtitlemusic; -FStartupScreen* StartWindow; FStartScreen* StartScreen; cycle_t FrameCycles; @@ -3098,6 +3097,17 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray& allwads, TArr int max_progress = TexMan.GuesstimateNumTextures(); int per_shader_progress = 0;//screen->GetShaderCount()? (max_progress / 10 / screen->GetShaderCount()) : 0; bool nostartscreen = batchrun || restart || Args->CheckParm("-join") || Args->CheckParm("-host") || Args->CheckParm("-norun"); + + if (GameStartupInfo.Type == FStartupInfo::DefaultStartup) + { + if (gameinfo.gametype == GAME_Hexen) + GameStartupInfo.Type = FStartupInfo::HexenStartup; + else if (gameinfo.gametype == GAME_Heretic) + GameStartupInfo.Type = FStartupInfo::HereticStartup; + else if (gameinfo.gametype == GAME_Strife) + GameStartupInfo.Type = FStartupInfo::StrifeStartup; + } + StartScreen = nostartscreen? nullptr : GetGameStartScreen(per_shader_progress > 0 ? max_progress * 10 / 9 : max_progress + 3); GameConfig->DoKeySetup(gameinfo.ConfigName); diff --git a/wadsrc/static/zscript/engine/base.zs b/wadsrc/static/zscript/engine/base.zs index 3b53743f75b..83ad9fdfacc 100644 --- a/wadsrc/static/zscript/engine/base.zs +++ b/wadsrc/static/zscript/engine/base.zs @@ -220,13 +220,17 @@ struct System native 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; + let binding = Bindings.GetBinding(key); + bool volumekeys = key == InputEvent.KEY_VOLUMEDOWN || key == InputEvent.KEY_VOLUMEUP; + bool gamepadkeys = key > InputEvent.KEY_LASTJOYBUTTON && key < InputEvent.KEY_PAD_LTHUMB_RIGHT; + bool altkeys = key == InputEvent.KEY_LALT || key == InputEvent.KEY_RALT; + if (volumekeys || gamepadkeys || altkeys || binding ~== "screenshot") return true; } return false; } diff --git a/wadsrc/static/zscript/engine/ui/menu/colorpickermenu.zs b/wadsrc/static/zscript/engine/ui/menu/colorpickermenu.zs index f8ce5187462..ac02f739443 100644 --- a/wadsrc/static/zscript/engine/ui/menu/colorpickermenu.zs +++ b/wadsrc/static/zscript/engine/ui/menu/colorpickermenu.zs @@ -73,20 +73,20 @@ class ColorpickerMenu : OptionMenu int mStartItem; CVar mCVar; - + double GetColor(int index) { double v = index == 0? mRed : index == 1? mGreen : mBlue; return v; } - + void SetColor(int index, double val) { if (index == 0) mRed = val; else if (index == 1) mGreen = val; else mBlue = val; } - + //============================================================================= // // @@ -119,7 +119,7 @@ class ColorpickerMenu : OptionMenu mDesc.mIndent = 0; mDesc.CalcIndent(); } - + //============================================================================= // // @@ -273,7 +273,7 @@ class ColorpickerMenu : OptionMenu if (h > fh) h = fh; else if (h < 4) return; // no space to draw it. - + int indent = (screen.GetWidth() / 2); int p = 0; @@ -328,7 +328,7 @@ class ColorpickerMenu : OptionMenu y += 49*CleanYfac_1; screen.DrawText (SmallFont, Font.CR_GRAY, x+(48-SmallFont.StringWidth("---->")/2)*CleanXfac_1, y, "---->", DTA_CleanNoMove_1, true); } - + override void OnDestroy() { if (mStartItem >= 0) diff --git a/wadsrc/static/zscript/engine/ui/menu/imagescroller.zs b/wadsrc/static/zscript/engine/ui/menu/imagescroller.zs index cab771ae7d9..6fd58bb6a76 100644 --- a/wadsrc/static/zscript/engine/ui/menu/imagescroller.zs +++ b/wadsrc/static/zscript/engine/ui/menu/imagescroller.zs @@ -47,20 +47,20 @@ class ImageScrollerDescriptor : MenuDescriptor native class ImageScrollerPage : MenuItemBase { int virtWidth, virtHeight; - + protected void DrawText(Font fnt, int color, double x, double y, String text) { screen.DrawText(fnt, color, x, y, text, DTA_VirtualWidth, virtWidth, DTA_VirtualHeight, virtHeight, DTA_FullscreenScale, FSMode_ScaleToFit43); } - + protected void DrawTexture(TextureID tex, double x, double y) { screen.DrawTexture(tex, true, x, y, DTA_VirtualWidth, virtWidth, DTA_VirtualHeight, virtHeight, DTA_FullscreenScale, FSMode_ScaleToFit43); } - + virtual void OnStartPage() {} - + virtual void OnEndPage() {} } @@ -74,13 +74,13 @@ class ImageScrollerPage : MenuItemBase class ImageScrollerPageImageItem : ImageScrollerPage { TextureID mTexture; - + void Init(ImageScrollerDescriptor desc, String patch) { Super.Init(); mTexture = TexMan.CheckForTexture(patch); } - + override void Drawer(bool selected) { Screen.DrawTexture(mTexture, true, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal); @@ -100,7 +100,7 @@ class ImageScrollerPageTextItem : ImageScrollerPage TextureID mTexture; Color mBrightness; double mTextScale; - + void Init(ImageScrollerDescriptor desc, String txt, int y = -1) { Super.Init(); @@ -110,16 +110,16 @@ class ImageScrollerPageTextItem : ImageScrollerPage mTextScale = desc.textScale; virtWidth = desc.virtWidth; virtHeight = desc.virtHeight; - + mText = mFont.BreakLines(Stringtable.Localize(txt.Filter()), int(virtWidth / mTextScale)); mYpos = y >= 0? y : virtHeight / 2 - mText.Count() * mFont.GetHeight() * mTextScale / 2; - + } - + override void Drawer(bool selected) { Screen.DrawTexture(mTexture, true, 0, 0, DTA_FullscreenEx, FSMode_ScaleToFit43, DTA_LegacyRenderStyle, STYLE_Normal, DTA_Color, mBrightness); - + let fontheight = mFont.GetHeight() * mTextScale; let y = mYpos; let c = mText.Count(); @@ -180,7 +180,7 @@ class ImageScrollerMenu : Menu // // //============================================================================= - + override bool MenuEvent(int mkey, bool fromcontroller) { if (mDesc.mItems.Size() <= 1) @@ -228,7 +228,7 @@ class ImageScrollerMenu : Menu // // //============================================================================= - + override bool MouseEvent(int type, int x, int y) { // Todo: Implement some form of drag event to switch between pages. @@ -244,7 +244,7 @@ class ImageScrollerMenu : Menu // // //============================================================================= - + private bool DrawTransition() { double now = MSTime() * (120. / 1000.); @@ -270,7 +270,7 @@ class ImageScrollerMenu : Menu // // //============================================================================= - + override void Drawer() { if (previous != null) diff --git a/wadsrc/static/zscript/engine/ui/menu/joystickmenu.zs b/wadsrc/static/zscript/engine/ui/menu/joystickmenu.zs index 48b5840e7a2..06b412f177e 100644 --- a/wadsrc/static/zscript/engine/ui/menu/joystickmenu.zs +++ b/wadsrc/static/zscript/engine/ui/menu/joystickmenu.zs @@ -41,7 +41,7 @@ class OptionMenuSliderJoySensitivity : OptionMenuSliderBase { JoystickConfig mJoy; - + OptionMenuSliderJoySensitivity Init(String label, double min, double max, double step, int showval, JoystickConfig joy) { Super.Init(label, min, max, step, showval); @@ -71,7 +71,7 @@ class OptionMenuSliderJoyScale : OptionMenuSliderBase int mAxis; int mNeg; JoystickConfig mJoy; - + OptionMenuSliderJoyScale Init(String label, int axis, double min, double max, double step, int showval, JoystickConfig joy) { Super.Init(label, min, max, step, showval); @@ -138,7 +138,7 @@ class OptionMenuItemJoyMap : OptionMenuItemOptionBase { int mAxis; JoystickConfig mJoy; - + OptionMenuItemJoyMap Init(String label, int axis, Name values, int center, JoystickConfig joy) { Super.Init(label, 'none', values, null, center); @@ -191,7 +191,7 @@ class OptionMenuItemInverter : OptionMenuItemOptionBase { int mAxis; JoystickConfig mJoy; - + OptionMenuItemInverter Init(String label, int axis, int center, JoystickConfig joy) { Super.Init(label, "none", "YesNo", NULL, center); @@ -223,7 +223,7 @@ class OptionMenuItemInverter : OptionMenuItemOptionBase class OptionMenuItemJoyConfigMenu : OptionMenuItemSubmenu { JoystickConfig mJoy; - + OptionMenuItemJoyConfigMenu Init(String label, JoystickConfig joy) { Super.Init(label, "JoystickConfigMenu"); @@ -243,7 +243,7 @@ class OptionMenuItemJoyConfigMenu : OptionMenuItemSubmenu if (res && joymenu != null) joymenu.mJoy = mJoy; return res; } - + static void SetController(OptionMenuDescriptor opt, JoystickConfig joy) { OptionMenuItem it; @@ -296,7 +296,7 @@ class OptionMenuItemJoyConfigMenu : OptionMenuItemSubmenu opt.mPosition = -25; opt.CalcIndent(); } - + } //============================================================================= diff --git a/wadsrc/static/zscript/engine/ui/menu/listmenu.zs b/wadsrc/static/zscript/engine/ui/menu/listmenu.zs index cc4656d9533..66d9a1ce672 100644 --- a/wadsrc/static/zscript/engine/ui/menu/listmenu.zs +++ b/wadsrc/static/zscript/engine/ui/menu/listmenu.zs @@ -120,7 +120,7 @@ class ListMenu : Menu mDesc.mItems[i].OnMenuCreated(); } } - + //============================================================================= // // @@ -136,7 +136,7 @@ class ListMenu : Menu } return NULL; } - + //============================================================================= // @@ -243,7 +243,7 @@ class ListMenu : Menu int h = mDesc.DisplayHeight(); double fx, fy, fw, fh; [fx, fy, fw, fh] = Screen.GetFullscreenRect(w, h, FSMode_ScaleToFit43); - + x = int((x - fx) * w / fw); y = int((y - fy) * h / fh); } @@ -311,7 +311,7 @@ class ListMenu : Menu } Super.Drawer(); } - + //============================================================================= // // diff --git a/wadsrc/static/zscript/engine/ui/menu/listmenuitems.zs b/wadsrc/static/zscript/engine/ui/menu/listmenuitems.zs index 8b47d288c6e..9e22578209f 100644 --- a/wadsrc/static/zscript/engine/ui/menu/listmenuitems.zs +++ b/wadsrc/static/zscript/engine/ui/menu/listmenuitems.zs @@ -109,7 +109,7 @@ class ListMenuItemStaticPatch : ListMenuItem mColor = desc.mFontColor; } - + override void Draw(bool selected, ListMenuDescriptor desc) { if (!mTexture.Exists()) @@ -163,7 +163,7 @@ class ListMenuItemStaticText : ListMenuItem mColor = color >= 0? color : desc.mFontColor; mCentered = false; } - + void InitDirect(double x, double y, String text, Font font, int color = Font.CR_UNTRANSLATED, bool centered = false) { Super.Init(x, y); @@ -172,7 +172,7 @@ class ListMenuItemStaticText : ListMenuItem mColor = color; mCentered = centered; } - + override void Draw(bool selected, ListMenuDescriptor desc) { if (mText.Length() != 0) @@ -216,12 +216,12 @@ class ListMenuItemSelectable : ListMenuItem mParam = param; mHotkey = 0; } - + override bool CheckCoordinate(int x, int y) { return mEnabled > 0 && y >= mYpos && y < mYpos + mHeight; // no x check here } - + override bool Selectable() { return mEnabled > 0; @@ -231,13 +231,13 @@ class ListMenuItemSelectable : ListMenuItem { return c > 0 && c == mHotkey; } - + override bool Activate() { Menu.SetMenu(mAction, mParam); return true; } - + override bool MouseEvent(int type, int x, int y) { if (type == Menu.MOUSE_Release) @@ -250,7 +250,7 @@ class ListMenuItemSelectable : ListMenuItem } return false; } - + override Name, int GetAction() { return mAction, mParam; @@ -279,7 +279,7 @@ class ListMenuItemTextItem : ListMenuItemSelectable mColorSelected = desc.mFontcolor2; mHotkey = hotkey.GetNextCodePoint(0); } - + void InitDirect(double x, double y, int height, String hotkey, String text, Font font, int color, int color2, Name child, int param = 0) { Super.Init(x, y, height, child, param); @@ -290,7 +290,7 @@ class ListMenuItemTextItem : ListMenuItemSelectable int pos = 0; mHotkey = hotkey.GetNextCodePoint(0); } - + override void Draw(bool selected, ListMenuDescriptor desc) { let font = menuDelegate.PickFont(mFont); @@ -313,31 +313,31 @@ class ListMenuItemTextItem : ListMenuItemSelectable class ListMenuItemPatchItem : ListMenuItemSelectable { TextureID mTexture; - + void Init(ListMenuDescriptor desc, TextureID patch, String hotkey, Name child, int param = 0) { Super.Init(desc.mXpos, desc.mYpos, desc.mLinespacing, child, param); mHotkey = hotkey.GetNextCodePoint(0); mTexture = patch; } - + void InitDirect(double x, double y, int height, TextureID patch, String hotkey, Name child, int param = 0) { Super.Init(x, y, height, child, param); mHotkey = hotkey.GetNextCodePoint(0); mTexture = patch; } - + override void Draw(bool selected, ListMenuDescriptor desc) { DrawTexture(desc, mTexture, mXpos, mYpos); } - + override int GetWidth() { return TexMan.GetSize(mTexture); } - + } //============================================================================= @@ -357,7 +357,7 @@ class ListMenuItemCaptionItem : ListMenuItem mText = text; mFont = Font.FindFont(fnt); } - + override void Draw(bool selected, ListMenuDescriptor desc) { let font = menuDelegate.PickFont(desc.mFont); diff --git a/wadsrc/static/zscript/engine/ui/menu/loadsavemenu.zs b/wadsrc/static/zscript/engine/ui/menu/loadsavemenu.zs index 3fac8bf4036..e15ca266f4e 100644 --- a/wadsrc/static/zscript/engine/ui/menu/loadsavemenu.zs +++ b/wadsrc/static/zscript/engine/ui/menu/loadsavemenu.zs @@ -87,7 +87,7 @@ class LoadSaveMenu : ListMenu int listboxLeft; int listboxTop; int listboxWidth; - + int listboxRows; int listboxHeight; int listboxRight; @@ -101,10 +101,10 @@ class LoadSaveMenu : ListMenu bool mEntering; TextEnterMenu mInput; double FontScale; - + BrokenLines BrokenSaveComment; - + //============================================================================= // @@ -119,13 +119,13 @@ class LoadSaveMenu : ListMenu manager.ReadSaveStrings(); SetWindows(); } - + private void SetWindows() { bool aspect43 = true; int Width43 = screen.GetHeight() * 4 / 3; int Left43 = (screen.GetWidth() - Width43) / 2; - + double wScale = Width43 / 640.; savepicLeft = Left43 + int(20 * wScale); @@ -135,7 +135,7 @@ class LoadSaveMenu : ListMenu FontScale = max(screen.GetHeight() / 480, 1); rowHeight = int(max((NewConsoleFont.GetHeight() + 1) * FontScale, 1)); - + listboxLeft = savepicLeft + savepicWidth + int(20*wScale); listboxTop = savepicTop; listboxWidth = Width43 + Left43 - listboxLeft - int(30 * wScale); @@ -151,7 +151,7 @@ class LoadSaveMenu : ListMenu commentRows = commentHeight / rowHeight; } - + //============================================================================= // // @@ -202,7 +202,7 @@ class LoadSaveMenu : ListMenu if (Selected >= manager.SavegameCount()) Selected = 0; String text = (Selected == -1 || !manager.GetSavegame(Selected).bOldVersion)? Stringtable.Localize("$MNU_NOPICTURE") : Stringtable.Localize("$MNU_DIFFVERSION"); int textlen = NewSmallFont.StringWidth(text); - + screen.DrawText (NewSmallFont, Font.CR_GOLD, (savepicLeft + savepicWidth / 2) / FontScale - textlen/2, (savepicTop+(savepicHeight-rowHeight)/2) / FontScale, text, DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true); } @@ -218,7 +218,7 @@ class LoadSaveMenu : ListMenu screen.DrawText(NewConsoleFont, Font.CR_ORANGE, commentLeft / FontScale, (commentTop + rowHeight * i) / FontScale, BrokenSaveComment.StringAt(i), DTA_VirtualWidthF, screen.GetWidth() / FontScale, DTA_VirtualHeightF, screen.GetHeight() / FontScale, DTA_KeepRatio, true); } - + // Draw file area DrawFrame (listboxLeft, listboxTop, listboxWidth, listboxHeight); @@ -257,7 +257,7 @@ class LoadSaveMenu : ListMenu } screen.SetClipRect(listboxLeft, listboxTop+rowHeight*i, listboxRight, listboxTop+rowHeight*(i+1)); - + if (j == Selected) { screen.Clear (listboxLeft, listboxTop+rowHeight*i, listboxRight, listboxTop+rowHeight*(i+1), mEntering ? Color(255,255,0,0) : Color(255,0,0,255)); @@ -388,7 +388,7 @@ class LoadSaveMenu : ListMenu return Super.MenuEvent(mkey, fromcontroller); } } - + //============================================================================= // // @@ -422,8 +422,8 @@ class LoadSaveMenu : ListMenu return Super.MouseEvent(type, x, y); } - - + + //============================================================================= // // @@ -466,13 +466,13 @@ class LoadSaveMenu : ListMenu return Super.OnUIEvent(ev); } - + } class SaveMenu : LoadSaveMenu { String mSaveName; - + //============================================================================= // // @@ -508,7 +508,7 @@ class SaveMenu : LoadSaveMenu // // //============================================================================= - + override bool MenuEvent (int mkey, bool fromcontroller) { if (Super.MenuEvent(mkey, fromcontroller)) @@ -603,7 +603,7 @@ class SaveMenu : LoadSaveMenu mSaveName = ""; } } - + } //============================================================================= diff --git a/wadsrc/static/zscript/engine/ui/menu/menu.zs b/wadsrc/static/zscript/engine/ui/menu/menu.zs index 8e08870aaec..18123480859 100644 --- a/wadsrc/static/zscript/engine/ui/menu/menu.zs +++ b/wadsrc/static/zscript/engine/ui/menu/menu.zs @@ -76,14 +76,14 @@ struct JoystickConfig native version("2.4") native float GetAxisDeadZone(int axis); native void SetAxisDeadZone(int axis, float zone); - + native int GetAxisMap(int axis); native void SetAxisMap(int axis, int gameaxis); - + native String GetName(); native int GetNumAxes(); native String GetAxisName(int axis); - + } class Menu : Object native ui version("2.4") @@ -139,7 +139,7 @@ class Menu : Object native ui version("2.4") native static void SetMouseCapture(bool on); native void Close(); native void ActivateMenu(); - + //============================================================================= // // @@ -156,7 +156,7 @@ class Menu : Object native ui version("2.4") AnimatedTransition = false; Animated = false; } - + //============================================================================= // // @@ -230,7 +230,7 @@ class Menu : Object native ui version("2.4") { SetCapture(true); } - + } else if (ev.type == UIEvent.Type_MouseMove) { @@ -259,7 +259,7 @@ class Menu : Object native ui version("2.4") { return false; } - + //============================================================================= // // @@ -289,7 +289,7 @@ class Menu : Object native ui version("2.4") } } } - + //============================================================================= // // @@ -330,34 +330,34 @@ class Menu : Object native ui version("2.4") { menuDelegate.PlaySound(snd); } - + deprecated("4.0") static void DrawConText (int color, int x, int y, String str) { screen.DrawText (ConFont, color, x, y, str, DTA_CellX, 8 * CleanXfac, DTA_CellY, 8 * CleanYfac); } - + static Font OptionFont() { return NewSmallFont; } - + static int OptionHeight() { return OptionFont().GetHeight(); } - + static int OptionWidth(String s) { return OptionFont().StringWidth(s); } - + static void DrawOptionText(int x, int y, int color, String text, bool grayed = false) { String label = Stringtable.Localize(text); int overlay = grayed? Color(96,48,0,0) : 0; screen.DrawText (OptionFont(), color, x, y, text, DTA_CleanNoMove_1, true, DTA_ColorOverlay, overlay); } - + } diff --git a/wadsrc/static/zscript/engine/ui/menu/menucustomize.zs b/wadsrc/static/zscript/engine/ui/menu/menucustomize.zs index 75b114e5478..390a2a703fe 100644 --- a/wadsrc/static/zscript/engine/ui/menu/menucustomize.zs +++ b/wadsrc/static/zscript/engine/ui/menu/menucustomize.zs @@ -7,11 +7,11 @@ class MenuDelegateBase ui if (drawit) screen.DrawText(fnt, OptionMenuSettings.mTitleColor, (screen.GetWidth() - fnt.StringWidth(title) * CleanXfac_1) / 2, 10 * CleanYfac_1, title, DTA_CleanNoMove_1, true); return (y + fnt.GetHeight()) * CleanYfac_1; // return is spacing in screen pixels. } - + virtual void PlaySound(Name sound) { } - + virtual bool DrawSelector(ListMenuDescriptor desc) { return false; @@ -21,7 +21,7 @@ class MenuDelegateBase ui { // overriding this allows to execute special actions when the menu closes } - + virtual Font PickFont(Font fnt) { if (generic_ui || !fnt) return NewSmallFont; diff --git a/wadsrc/static/zscript/engine/ui/menu/messagebox.zs b/wadsrc/static/zscript/engine/ui/menu/messagebox.zs index 94f8a38fd08..8e76cae31b8 100644 --- a/wadsrc/static/zscript/engine/ui/menu/messagebox.zs +++ b/wadsrc/static/zscript/engine/ui/menu/messagebox.zs @@ -68,7 +68,7 @@ class MessageBoxMenu : Menu if (SmallFont && SmallFont.CanPrint(message) && SmallFont.CanPrint("$TXT_YES") && SmallFont.CanPrint("$TXT_NO")) textFont = SmallFont; else if (OriginalSmallFont && OriginalSmallFont.CanPrint(message) && OriginalSmallFont.CanPrint("$TXT_YES") && OriginalSmallFont.CanPrint("$TXT_NO")) textFont = OriginalSmallFont; } - + if (!textFont) { arrowFont = textFont = NewSmallFont; @@ -97,7 +97,7 @@ class MessageBoxMenu : Menu } Handler = native_handler; } - + //============================================================================= // // @@ -140,7 +140,7 @@ class MessageBoxMenu : Menu } } - + //============================================================================= // // @@ -227,7 +227,7 @@ class MessageBoxMenu : Menu } return Super.OnUIEvent(ev); } - + override bool OnInputEvent(InputEvent ev) { if (ev.type == InputEvent.Type_KeyDown) diff --git a/wadsrc/static/zscript/engine/ui/menu/optionmenu.zs b/wadsrc/static/zscript/engine/ui/menu/optionmenu.zs index a1078f4802e..1928d70abfe 100644 --- a/wadsrc/static/zscript/engine/ui/menu/optionmenu.zs +++ b/wadsrc/static/zscript/engine/ui/menu/optionmenu.zs @@ -65,7 +65,7 @@ class OptionMenuDescriptor : MenuDescriptor native mIndent = 0; mDontDim = 0; } - + //============================================================================= // // @@ -133,7 +133,7 @@ class OptionMenu : Menu } } - + //============================================================================= // // @@ -149,7 +149,7 @@ class OptionMenu : Menu } return NULL; } - + //============================================================================= // @@ -284,7 +284,7 @@ class OptionMenu : Menu do { ++mDesc.mSelectedItem; - + if (CanScrollDown && mDesc.mSelectedItem == VisBottom) { mDesc.mScrollPos++; @@ -380,7 +380,7 @@ class OptionMenu : Menu return true; } - + //============================================================================= // // @@ -417,7 +417,7 @@ class OptionMenu : Menu return Super.MouseEvent(type, x, y); } - + //============================================================================= // // @@ -432,7 +432,7 @@ class OptionMenu : Menu mDesc.mItems[i].Ticker(); } } - + //============================================================================= // // @@ -533,12 +533,12 @@ class OptionMenu : Menu { mFocusControl = OptionMenuItem(fc); } - + override bool CheckFocus(MenuItemBase fc) { return mFocusControl == fc; } - + override void ReleaseFocus() { mFocusControl = NULL; diff --git a/wadsrc/static/zscript/engine/ui/menu/optionmenuitems.zs b/wadsrc/static/zscript/engine/ui/menu/optionmenuitems.zs index 7ece141763b..02b9d0a8977 100644 --- a/wadsrc/static/zscript/engine/ui/menu/optionmenuitems.zs +++ b/wadsrc/static/zscript/engine/ui/menu/optionmenuitems.zs @@ -36,7 +36,7 @@ class OptionMenuItem : MenuItemBase { String mLabel; bool mCentered; - + protected void Init(String label, String command, bool center = false) { Super.Init(0, 0, command); @@ -48,11 +48,11 @@ class OptionMenuItem : MenuItemBase { Menu.DrawOptionText(x, y, color, text, grayed); } - + protected int drawLabel(int indent, int y, int color, bool grayed = false) { String label = Stringtable.Localize(mLabel); - + int x; int w = Menu.OptionWidth(label) * CleanXfac_1; if (!mCentered) x = indent - w; @@ -66,24 +66,24 @@ class OptionMenuItem : MenuItemBase Menu.DrawOptionText(indent + CursorSpace(), y, color, text, grayed); } - + int CursorSpace() { return (14 * CleanXfac_1); } - + override bool Selectable() { return true; } - + override int GetIndent() { if (mCentered) return 0; if (screen.GetWidth() < 640) return screen.GetWidth() / 2; return Menu.OptionWidth(Stringtable.Localize(mLabel)); } - + override bool MouseEvent(int type, int x, int y) { if (Selectable() && type == Menu.MOUSE_Release) @@ -147,7 +147,7 @@ class OptionMenuItemLabeledSubmenu : OptionMenuItemSubmenu override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor); - + String text = mLabelCVar.GetString(); if (text.Length() == 0) text = Stringtable.Localize("$notset"); drawValue(indent, y, OptionMenuSettings.mFontColorValue, text); @@ -166,7 +166,7 @@ class OptionMenuItemCommand : OptionMenuItemSubmenu private String ccmd; // do not allow access to this from the outside. bool mCloseOnSelect; private bool mUnsafe; - + OptionMenuItemCommand Init(String label, Name command, bool centered = false, bool closeonselect = false) { Super.Init(label, command, 0, centered); @@ -255,7 +255,7 @@ class OptionMenuItemOptionBase : OptionMenuItem Name mValues; // Entry in OptionValues table CVar mGrayCheck; int mCenter; - + const OP_VALUES = 0x11001; protected void Init(String label, Name command, Name values, CVar graycheck, int center) @@ -288,11 +288,11 @@ class OptionMenuItemOptionBase : OptionMenuItem { return 0; } - + virtual void SetSelection(int Selection) { } - + //============================================================================= override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { @@ -338,7 +338,7 @@ class OptionMenuItemOptionBase : OptionMenuItem } return true; } - + virtual bool isGrayed() { return mGrayCheck != null && !mGrayCheck.GetInt(); @@ -542,7 +542,7 @@ class OptionMenuItemControlBase : OptionMenuItem } return false; } - + void SendKey(int key) { mInput = key; @@ -717,7 +717,7 @@ class OptionMenuSliderBase : OptionMenuItem { return 0; } - + virtual void SetSliderValue(double val) { } @@ -862,7 +862,7 @@ class OptionMenuSliderBase : OptionMenuItem class OptionMenuItemSlider : OptionMenuSliderBase { CVar mCVar; - + OptionMenuItemSlider Init(String label, Name command, double min, double max, double step, int showval = 1, CVar graycheck = NULL) { Super.Init(label, min, max, step, showval, command, graycheck); @@ -941,11 +941,11 @@ class OptionMenuItemColorPicker : OptionMenuItem if (mCVar != null) { Menu.MenuSound("menu/choose"); - + // This code is a bit complicated because it should allow subclassing the // colorpicker menu. // New color pickers must inherit from the internal one to work here. - + let desc = MenuDescriptor.GetDescriptor('Colorpickermenu'); if (desc != NULL && (desc.mClass == null || desc.mClass is "ColorPickerMenu")) { @@ -1042,7 +1042,7 @@ class OptionMenuFieldBase : OptionMenuItem class OptionMenuItemTextField : OptionMenuFieldBase { TextEnterMenu mEnter; - + OptionMenuItemTextField Init (String label, Name command, CVar graycheck = null) { Super.Init(label, command, graycheck); @@ -1175,7 +1175,7 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider String TextZero; String TextNegOne; int mClickVal; - + OptionMenuItemScaleSlider Init(String label, Name command, double min, double max, double step, String zero, String negone = "") { Super.Init(label, command, min, max, step, 0); @@ -1204,7 +1204,7 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider } return indent; } - + override bool MouseEvent(int type, int x, int y) { int value = int(GetSliderValue()); @@ -1214,11 +1214,11 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider mClickVal = value; if (value <= 0) return false; return Super.MouseEvent(type, x, y); - + case Menu.MOUSE_Move: if (mClickVal <= 0) return false; return Super.MouseEvent(type, x, y); - + case Menu.MOUSE_Release: if (mClickVal <= 0) { @@ -1231,7 +1231,7 @@ class OptionMenuItemScaleSlider : OptionMenuItemSlider } return false; } - + } //============================================================================= diff --git a/wadsrc/static/zscript/engine/ui/menu/reverbedit.zs b/wadsrc/static/zscript/engine/ui/menu/reverbedit.zs index 65fa5158e37..282fce55d0a 100644 --- a/wadsrc/static/zscript/engine/ui/menu/reverbedit.zs +++ b/wadsrc/static/zscript/engine/ui/menu/reverbedit.zs @@ -15,14 +15,14 @@ class ReverbEdit : OptionMenu super.Init(parent, desc); OnReturn(); } - + override void OnReturn() { string env; int id; - + [env, id] = GetSelectedEnvironment(); - + let li = GetItem('EvironmentName'); if (li != NULL) { @@ -126,7 +126,7 @@ class OptionMenuItemReverbSelect : OptionMenuItemSubMenu return self; } - + override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { int x = drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor); @@ -164,7 +164,7 @@ class OptionMenuItemReverbOption : OptionMenuItemOptionBase { return int(ReverbEdit.GetValue(mValIndex)); } - + override void SetSelection(int Selection) { ReverbEdit.SetValue(mValIndex, Selection); @@ -182,7 +182,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase int mValIndex; String mEditValue; TextEnterMenu mEnter; - + OptionMenuItemSliderReverbEditOption Init(String label, double min, double max, double step, int showval, int valindex) { Super.Init(label, min, max, step, showval); @@ -190,7 +190,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase mEnter = null; return self; } - + override double GetSliderValue() { @@ -201,7 +201,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase { ReverbEdit.SetValue(mValIndex, val); } - + override bool Selectable() { return !ReverbEdit.GrayCheck(); @@ -228,7 +228,7 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase } return indent; } - + override bool MenuEvent (int mkey, bool fromcontroller) { if (mkey == Menu.MKEY_Enter) @@ -253,6 +253,6 @@ class OptionMenuItemSliderReverbEditOption : OptionMenuSliderBase return Super.MenuEvent(mkey, fromcontroller); } - + } diff --git a/wadsrc/static/zscript/engine/ui/menu/textentermenu.zs b/wadsrc/static/zscript/engine/ui/menu/textentermenu.zs index 6fc7abe0265..9a83deb5036 100644 --- a/wadsrc/static/zscript/engine/ui/menu/textentermenu.zs +++ b/wadsrc/static/zscript/engine/ui/menu/textentermenu.zs @@ -38,7 +38,7 @@ class TextEnterMenu : Menu { const INPUTGRID_WIDTH = 13; const INPUTGRID_HEIGHT = 5; - + const Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+-=.,!?@'\":;[]()<>^#$%&*/_ \b"; String mEnterString; @@ -50,7 +50,7 @@ class TextEnterMenu : Menu int CursorSize; bool AllowColors; Font displayFont; - + //============================================================================= // // @@ -106,13 +106,13 @@ class TextEnterMenu : Menu { return mEnterString; } - + override bool TranslateKeyboardEvents() { return mInputGridOkay; } - - + + //============================================================================= // // @@ -303,7 +303,7 @@ class TextEnterMenu : Menu return false; } - + //============================================================================= // // @@ -375,5 +375,5 @@ class TextEnterMenu : Menu } Super.Drawer(); } - + } diff --git a/wadsrc/static/zscript/engine/ui/statusbar/statusbarcore.zs b/wadsrc/static/zscript/engine/ui/statusbar/statusbarcore.zs index 86f93773c13..b00af3fde68 100644 --- a/wadsrc/static/zscript/engine/ui/statusbar/statusbarcore.zs +++ b/wadsrc/static/zscript/engine/ui/statusbar/statusbarcore.zs @@ -23,22 +23,22 @@ class StatusBarCore native ui DI_MIRROR = 0x1000, // flip the texture horizontally, like a mirror DI_ITEM_RELCENTER = 0x2000, DI_MIRRORY = 0x40000000, - + DI_SCREEN_AUTO = 0, // decide based on given offsets. DI_SCREEN_MANUAL_ALIGN = 0x4000, // If this is on, the following flags will have an effect - + DI_SCREEN_TOP = DI_SCREEN_MANUAL_ALIGN, DI_SCREEN_VCENTER = 0x8000 | DI_SCREEN_MANUAL_ALIGN, DI_SCREEN_BOTTOM = 0x10000 | DI_SCREEN_MANUAL_ALIGN, DI_SCREEN_VOFFSET = 0x18000 | DI_SCREEN_MANUAL_ALIGN, DI_SCREEN_VMASK = 0x18000 | DI_SCREEN_MANUAL_ALIGN, - + DI_SCREEN_LEFT = DI_SCREEN_MANUAL_ALIGN, DI_SCREEN_HCENTER = 0x20000 | DI_SCREEN_MANUAL_ALIGN, DI_SCREEN_RIGHT = 0x40000 | DI_SCREEN_MANUAL_ALIGN, DI_SCREEN_HOFFSET = 0x60000 | DI_SCREEN_MANUAL_ALIGN, DI_SCREEN_HMASK = 0x60000 | DI_SCREEN_MANUAL_ALIGN, - + DI_SCREEN_LEFT_TOP = DI_SCREEN_TOP | DI_SCREEN_LEFT, DI_SCREEN_RIGHT_TOP = DI_SCREEN_TOP | DI_SCREEN_RIGHT, DI_SCREEN_LEFT_BOTTOM = DI_SCREEN_BOTTOM | DI_SCREEN_LEFT, @@ -49,21 +49,21 @@ class StatusBarCore native ui DI_SCREEN_CENTER_TOP = DI_SCREEN_TOP | DI_SCREEN_HCENTER, DI_SCREEN_CENTER_BOTTOM = DI_SCREEN_BOTTOM | DI_SCREEN_HCENTER, DI_SCREEN_OFFSETS = DI_SCREEN_HOFFSET | DI_SCREEN_VOFFSET, - + DI_ITEM_AUTO = 0, // equivalent with bottom center, which is the default alignment. - + DI_ITEM_TOP = 0x80000, DI_ITEM_VCENTER = 0x100000, DI_ITEM_BOTTOM = 0, // this is the default vertical alignment DI_ITEM_VOFFSET = 0x180000, DI_ITEM_VMASK = 0x180000, - + DI_ITEM_LEFT = 0x200000, DI_ITEM_HCENTER = 0, // this is the default horizontal alignment DI_ITEM_RIGHT = 0x400000, DI_ITEM_HOFFSET = 0x600000, DI_ITEM_HMASK = 0x600000, - + DI_ITEM_LEFT_TOP = DI_ITEM_TOP|DI_ITEM_LEFT, DI_ITEM_RIGHT_TOP = DI_ITEM_TOP|DI_ITEM_RIGHT, DI_ITEM_LEFT_BOTTOM = DI_ITEM_BOTTOM|DI_ITEM_LEFT, @@ -71,7 +71,7 @@ class StatusBarCore native ui DI_ITEM_CENTER = DI_ITEM_VCENTER|DI_ITEM_HCENTER, DI_ITEM_CENTER_BOTTOM = DI_ITEM_BOTTOM|DI_ITEM_HCENTER, DI_ITEM_OFFSETS = DI_ITEM_HOFFSET|DI_ITEM_VOFFSET, - + DI_TEXT_ALIGN_LEFT = 0, DI_TEXT_ALIGN_RIGHT = 0x800000, DI_TEXT_ALIGN_CENTER = 0x1000000, @@ -94,7 +94,7 @@ class StatusBarCore native ui FNF_WHENNOTZERO = 0x1, FNF_FILLZEROS = 0x2, } - + // These are block properties for the drawers. A child class can set them to have a block of items use the same settings. native double Alpha; native Vector2 drawOffset; // can be set by subclasses to offset drawing operations @@ -118,17 +118,17 @@ class StatusBarCore native ui native double, double, double, double TransformRect(double x, double y, double w, double h, int flags = 0); native void Fill(Color col, double x, double y, double w, double h, int flags = 0); native void SetClipRect(double x, double y, double w, double h, int flags = 0); - + native void SetSize(int height, int vwidth, int vheight, int hwidth = -1, int hheight = -1); native Vector2 GetHUDScale(); native void BeginStatusBar(bool forceScaled = false, int resW = -1, int resH = -1, int rel = -1); native void BeginHUD(double Alpha = 1., bool forcescaled = false, int resW = -1, int resH = -1); - + void ClearClipRect() { screen.ClearClipRect(); } - + //============================================================================ // // Returns how much the status bar's graphics extend into the view @@ -137,7 +137,7 @@ class StatusBarCore native ui // by the element requesting this information. // //============================================================================ - + virtual int GetProtrusion(double scaleratio) const { return 0; @@ -156,7 +156,7 @@ class LinearValueInterpolator : Object { int mCurrentValue; int mMaxChange; - + static LinearValueInterpolator Create(int startval, int maxchange) { let v = new("LinearValueInterpolator"); @@ -164,12 +164,12 @@ class LinearValueInterpolator : Object v.mMaxChange = maxchange; return v; } - + void Reset(int value) { mCurrentValue = value; } - + // This must be called periodically in the status bar's Tick function. // Do not call this in the Draw function because that may skip some frames! void Update(int destvalue) @@ -183,7 +183,7 @@ class LinearValueInterpolator : Object mCurrentValue = min(destvalue, mCurrentValue + mMaxChange); } } - + // This must be called in the draw function to retrieve the value for output. int GetValue() { @@ -197,8 +197,8 @@ class DynamicValueInterpolator : Object int mMinChange; int mMaxChange; double mChangeFactor; - - + + static DynamicValueInterpolator Create(int startval, double changefactor, int minchange, int maxchange) { let v = new("DynamicValueInterpolator"); @@ -208,12 +208,12 @@ class DynamicValueInterpolator : Object v.mChangeFactor = changefactor; return v; } - + void Reset(int value) { mCurrentValue = value; } - + // This must be called periodically in the status bar's Tick function. // Do not call this in the Draw function because that may skip some frames! void Update(int destvalue) @@ -228,7 +228,7 @@ class DynamicValueInterpolator : Object mCurrentValue = min(destvalue, mCurrentValue + diff); } } - + // This must be called in the draw function to retrieve the value for output. int GetValue() {