diff --git a/src/common/audio/sound/s_sound.cpp b/src/common/audio/sound/s_sound.cpp index 7fdbd74c67..8ec5fc76b5 100644 --- a/src/common/audio/sound/s_sound.cpp +++ b/src/common/audio/sound/s_sound.cpp @@ -929,12 +929,7 @@ void SoundEngine::StopSound(int sourcetype, const void* actor, int channel, int void SoundEngine::StopActorSounds(int sourcetype, const void* actor, int chanmin, int chanmax) { const bool all = (chanmin == 0 && chanmax == 0); - if (!all && chanmax > chanmin) - { - const int temp = chanmax; - chanmax = chanmin; - chanmin = temp; - } + if (chanmax < chanmin) std::swap(chanmin, chanmax); FSoundChan* chan = Channels; while (chan != nullptr) diff --git a/src/common/engine/namedef.h b/src/common/engine/namedef.h index 8ec5d40813..af285ce7ed 100644 --- a/src/common/engine/namedef.h +++ b/src/common/engine/namedef.h @@ -1108,3 +1108,4 @@ xy(menu_advance, "menu/advance") xx(zoomsize) xx(ScreenJobRunner) +xx(RazeStatusBar) diff --git a/src/common/engine/sc_man.h b/src/common/engine/sc_man.h index 56a4a8d823..1caa177a25 100644 --- a/src/common/engine/sc_man.h +++ b/src/common/engine/sc_man.h @@ -145,6 +145,12 @@ public: return true; } + bool GetFloat(float& var, bool evaluate = false) + { + if (!GetFloat(evaluate)) return false; + var = float(Float); + return true; + } void MustGetFloat(bool evaluate = false); bool CheckFloat(bool evaluate = false); diff --git a/src/common/engine/stringtable.cpp b/src/common/engine/stringtable.cpp index c983afc378..a666a4d9c9 100644 --- a/src/common/engine/stringtable.cpp +++ b/src/common/engine/stringtable.cpp @@ -535,8 +535,6 @@ size_t FStringTable::ProcessEscapes (char *iptr) } else if (c == '\n') continue; - - } *optr++ = c; } diff --git a/src/common/objects/dobject.cpp b/src/common/objects/dobject.cpp index 3676e7eaf4..9f4a164e44 100644 --- a/src/common/objects/dobject.cpp +++ b/src/common/objects/dobject.cpp @@ -314,7 +314,7 @@ void DObject::Release() // //========================================================================== -void DObject:: Destroy () +void DObject::Destroy () { // We cannot call the VM during shutdown because all the needed data has been or is in the process of being deleted. if (PClass::bVMOperational) diff --git a/src/common/rendering/vulkan/renderer/vk_renderbuffers.cpp b/src/common/rendering/vulkan/renderer/vk_renderbuffers.cpp index 34e44096d5..75288a4f2e 100644 --- a/src/common/rendering/vulkan/renderer/vk_renderbuffers.cpp +++ b/src/common/rendering/vulkan/renderer/vk_renderbuffers.cpp @@ -239,8 +239,13 @@ void VkRenderBuffers::CreateShadowmap() ImageBuilder builder; builder.setSize(gl_shadowmap_quality, 1024); - builder.setFormat(VK_FORMAT_R32_SFLOAT); + builder.setFormat(SceneNormalFormat); builder.setUsage(VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT); + if (!builder.isFormatSupported(fb->device, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT | VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) + { + SceneNormalFormat = VK_FORMAT_R8G8B8A8_UNORM; + builder.setFormat(SceneNormalFormat); + } Shadowmap.Image = builder.create(fb->device); Shadowmap.Image->SetDebugName("VkRenderBuffers.Shadowmap"); diff --git a/src/common/scripting/core/dynarrays.cpp b/src/common/scripting/core/dynarrays.cpp index 6be216c12c..21a3622481 100644 --- a/src/common/scripting/core/dynarrays.cpp +++ b/src/common/scripting/core/dynarrays.cpp @@ -1006,6 +1006,22 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_String, Push, ArrayPushPush(val)); } +DEFINE_ACTION_FUNCTION(FDynArray_String, PushV) +{ + PARAM_SELF_STRUCT_PROLOGUE(FDynArray_String); + PARAM_VA_POINTER(va_reginfo); // Get the hidden type information array + VMVa_List args = { param + 1, 0, numparam - 2, va_reginfo + 1 }; + while (args.curindex < args.numargs) + { + if (args.reginfo[args.curindex] == REGT_STRING) + { + self->Push(args.args[args.curindex++].s()); + } + else ThrowAbortException(X_OTHER, "Invalid parameter in pushv, string expected"); + } + ACTION_RETURN_INT(self->Size() - 1); +} + DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_String, Pop, ArrayPop) { PARAM_SELF_STRUCT_PROLOGUE(FDynArray_String); diff --git a/src/common/scripting/interface/vmnatives.cpp b/src/common/scripting/interface/vmnatives.cpp index 23705b93a5..6276ac9065 100644 --- a/src/common/scripting/interface/vmnatives.cpp +++ b/src/common/scripting/interface/vmnatives.cpp @@ -81,10 +81,10 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, StatusbarToRealCoords, StatusbarTo return MIN(4, numret); } -void SBar_DrawTexture(DStatusBarCore* self, int texid, double x, double y, int flags, double alpha, double w, double h, double scaleX, double scaleY, int style) +void SBar_DrawTexture(DStatusBarCore* self, int texid, double x, double y, int flags, double alpha, double w, double h, double scaleX, double scaleY, int style, int color, int translation, double clipwidth) { if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function"); - self->DrawGraphic(FSetTextureID(texid), x, y, flags, alpha, w, h, scaleX, scaleY, ERenderStyle(style)); + self->DrawGraphic(FSetTextureID(texid), x, y, flags, alpha, w, h, scaleX, scaleY, ERenderStyle(style), color, translation, clipwidth); } DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawTexture, SBar_DrawTexture) @@ -100,14 +100,17 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawTexture, SBar_DrawTexture) PARAM_FLOAT(scaleX); PARAM_FLOAT(scaleY); PARAM_INT(style); - SBar_DrawTexture(self, texid, x, y, flags, alpha, w, h, scaleX, scaleY, style); + PARAM_INT(col); + PARAM_INT(trans); + PARAM_FLOAT(clipwidth); + SBar_DrawTexture(self, texid, x, y, flags, alpha, w, h, scaleX, scaleY, style, col, trans, clipwidth); return 0; } -void SBar_DrawImage(DStatusBarCore* self, const FString& texid, double x, double y, int flags, double alpha, double w, double h, double scaleX, double scaleY, int style) +void SBar_DrawImage(DStatusBarCore* self, const FString& texid, double x, double y, int flags, double alpha, double w, double h, double scaleX, double scaleY, int style, int color, int translation, double clipwidth) { if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function"); - self->DrawGraphic(TexMan.CheckForTexture(texid, ETextureType::Any), x, y, flags, alpha, w, h, scaleX, scaleY, ERenderStyle(style)); + self->DrawGraphic(TexMan.CheckForTexture(texid, ETextureType::Any), x, y, flags, alpha, w, h, scaleX, scaleY, ERenderStyle(style), color, translation, clipwidth); } DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawImage, SBar_DrawImage) @@ -123,10 +126,62 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawImage, SBar_DrawImage) PARAM_FLOAT(scaleX); PARAM_FLOAT(scaleY); PARAM_INT(style); - SBar_DrawImage(self, texid, x, y, flags, alpha, w, h, scaleX, scaleY, style); + PARAM_INT(col); + PARAM_INT(trans); + PARAM_FLOAT(clipwidth); + SBar_DrawImage(self, texid, x, y, flags, alpha, w, h, scaleX, scaleY, style, col, trans, clipwidth); return 0; } +void SBar_DrawImageRotated(DStatusBarCore* self, const FString& texid, double x, double y, int flags, double angle, double alpha, double scaleX, double scaleY, int style, int color, int translation) +{ + if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function"); + self->DrawRotated(TexMan.CheckForTexture(texid, ETextureType::Any), x, y, flags, angle, alpha, scaleX, scaleY, color, translation, (ERenderStyle)style); +} + +DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawImageRotated, SBar_DrawImageRotated) +{ + PARAM_SELF_PROLOGUE(DStatusBarCore); + PARAM_STRING(texid); + PARAM_FLOAT(x); + PARAM_FLOAT(y); + PARAM_INT(flags); + PARAM_FLOAT(angle); + PARAM_FLOAT(alpha); + PARAM_FLOAT(scaleX); + PARAM_FLOAT(scaleY); + PARAM_INT(style); + PARAM_INT(col); + PARAM_INT(trans); + SBar_DrawImageRotated(self, texid, x, y, flags, angle, alpha, scaleX, scaleY, style, col, trans); + return 0; +} + +void SBar_DrawTextureRotated(DStatusBarCore* self, int texid, double x, double y, int flags, double angle, double alpha, double scaleX, double scaleY, int style, int color, int translation) +{ + if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function"); + self->DrawRotated(FSetTextureID(texid), x, y, flags, alpha, scaleX, scaleY, color, translation, style); +} + +DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawTextureRotated, SBar_DrawTextureRotated) +{ + PARAM_SELF_PROLOGUE(DStatusBarCore); + PARAM_INT(texid); + PARAM_FLOAT(x); + PARAM_FLOAT(y); + PARAM_INT(flags); + PARAM_FLOAT(angle); + PARAM_FLOAT(alpha); + PARAM_FLOAT(scaleX); + PARAM_FLOAT(scaleY); + PARAM_INT(style); + PARAM_INT(col); + PARAM_INT(trans); + SBar_DrawTextureRotated(self, texid, x, y, flags, angle, alpha, scaleX, scaleY, style, col, trans); + return 0; +} + + void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY, int translation, int style); DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawString, SBar_DrawString) diff --git a/src/common/statusbar/base_sbar.cpp b/src/common/statusbar/base_sbar.cpp index 1dc34da9c8..32cd341edc 100644 --- a/src/common/statusbar/base_sbar.cpp +++ b/src/common/statusbar/base_sbar.cpp @@ -51,7 +51,7 @@ FGameTexture* CrosshairImage; static int CrosshairNum; -IMPLEMENT_CLASS(DStatusBarCore, true, false) +IMPLEMENT_CLASS(DStatusBarCore, false, false) IMPLEMENT_CLASS(DHUDFont, false, false); @@ -458,7 +458,7 @@ void DStatusBarCore::DrawGraphic(FTextureID texture, double x, double y, int fla return; FGameTexture* tex = TexMan.GetGameTexture(texture, !(flags & DI_DONTANIMATE)); - DrawGraphic(tex, x, y, flags, Alpha, boxwidth, boxheight, scaleX, scaleY, style, color, translation); + DrawGraphic(tex, x, y, flags, Alpha, boxwidth, boxheight, scaleX, scaleY, style, color, translation, clipwidth); } void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, ERenderStyle style, PalEntry color, int translation, double clipwidth) diff --git a/src/common/thirdparty/base64.cpp b/src/common/thirdparty/base64.cpp index e7099711ab..fcd0ae4147 100644 --- a/src/common/thirdparty/base64.cpp +++ b/src/common/thirdparty/base64.cpp @@ -89,8 +89,8 @@ TArray base64_encode(unsigned char const* bytes_to_encode, size_t in_le while((i++ < 3)) reta.Push('='); - reta.Push(0); } + reta.Push(0); return reta; diff --git a/wadsrc/static/zscript/engine/dynarrays.zs b/wadsrc/static/zscript/engine/dynarrays.zs index 1db4a62246..009350b8ee 100644 --- a/wadsrc/static/zscript/engine/dynarrays.zs +++ b/wadsrc/static/zscript/engine/dynarrays.zs @@ -151,6 +151,7 @@ struct DynArray_String native native void Append (DynArray_String other); native uint Find(String item) const; native uint Push (String item); + native vararg uint PushV(String item, ...); native bool Pop (); native void Delete (uint index, int deletecount = 1); native void Insert (uint index, String item); diff --git a/wadsrc/static/zscript/engine/ui/statusbar/statusbarcore.zs b/wadsrc/static/zscript/engine/ui/statusbar/statusbarcore.zs index 01157fdc61..86f93773c1 100644 --- a/wadsrc/static/zscript/engine/ui/statusbar/statusbarcore.zs +++ b/wadsrc/static/zscript/engine/ui/statusbar/statusbarcore.zs @@ -110,6 +110,10 @@ class StatusBarCore native ui native double, double, double, double StatusbarToRealCoords(double x, double y=0, double w=0, double h=0); native void DrawTexture(TextureID texture, Vector2 pos, int flags = 0, double Alpha = 1., Vector2 box = (-1, -1), Vector2 scale = (1, 1), ERenderStyle style = STYLE_Translucent, Color col = 0xffffffff, int translation = 0, double clipwidth = -1); native void DrawImage(String texture, Vector2 pos, int flags = 0, double Alpha = 1., Vector2 box = (-1, -1), Vector2 scale = (1, 1), ERenderStyle style = STYLE_Translucent, Color col = 0xffffffff, int translation = 0, double clipwidth = -1); + + native void DrawTextureRotated(TextureID texid, Vector2 pos, int flags, double angle, double alpha = 1, Vector2 scale = (1, 1), ERenderStyle style = STYLE_Translucent, Color col = 0xffffffff, int translation = 0); + native void DrawImageRotated(String texid, Vector2 pos, int flags, double angle, double alpha = 1, Vector2 scale = (1, 1), ERenderStyle style = STYLE_Translucent, Color col = 0xffffffff, int translation = 0); + native void DrawString(HUDFont font, String string, Vector2 pos, int flags = 0, int translation = Font.CR_UNTRANSLATED, double Alpha = 1., int wrapwidth = -1, int linespacing = 4, Vector2 scale = (1, 1), int pt = 0, ERenderStyle style = STYLE_Translucent); 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);