From dff8339ba315269d49339fd77839b466d3ec904f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 4 Oct 2020 19:33:50 +0200 Subject: [PATCH] - backend update from GZDoom. --- source/common/2d/v_draw.cpp | 31 +++++++++++++++++++ source/common/2d/v_draw.h | 1 + source/common/audio/music/music_config.cpp | 4 +-- .../common/scripting/interface/vmnatives.cpp | 21 +++++++++++-- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/source/common/2d/v_draw.cpp b/source/common/2d/v_draw.cpp index a37f930f3..86a85c55c 100644 --- a/source/common/2d/v_draw.cpp +++ b/source/common/2d/v_draw.cpp @@ -410,6 +410,29 @@ void CalcFullscreenScale(DrawParms *parms, double srcwidth, double srcheight, in } } +DEFINE_ACTION_FUNCTION(_Screen, GetFullscreenRect) +{ + PARAM_PROLOGUE; + PARAM_FLOAT(virtw); + PARAM_FLOAT(virth); + PARAM_INT(fsmode); + + if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function"); + + DrawParms parms; + DoubleRect rect; + parms.viewport.width = twod->GetWidth(); + parms.viewport.height = twod->GetHeight(); + CalcFullscreenScale(&parms, virtw, virth, fsmode, rect); + if (numret >= 1) ret[0].SetFloat(rect.left); + if (numret >= 2) ret[1].SetFloat(rect.top); + if (numret >= 3) ret[2].SetFloat(rect.width); + if (numret >= 4) ret[3].SetFloat(rect.height); + return MIN(numret, 4); +} + + + //========================================================================== // // Draw parameter parsing @@ -460,6 +483,13 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FGameTexture *img, do parms->destheight = parms->texheight * CleanYfac; break; + case DTA_CleanTop: + parms->x = (parms->x - 160.0) * CleanXfac + (GetWidth() * 0.5); + parms->y = (parms->y) * CleanYfac; + parms->destwidth = parms->texwidth * CleanXfac; + parms->destheight = parms->texheight * CleanYfac; + break; + case DTA_CleanNoMove: parms->destwidth = parms->texwidth * CleanXfac; parms->destheight = parms->texheight * CleanYfac; @@ -716,6 +746,7 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double break; case DTA_Clean: + case DTA_CleanTop: boolval = ListGetInt(tags); if (boolval) { diff --git a/source/common/2d/v_draw.h b/source/common/2d/v_draw.h index c18566936..dc9b8d28c 100644 --- a/source/common/2d/v_draw.h +++ b/source/common/2d/v_draw.h @@ -130,6 +130,7 @@ enum DTA_Rotate, DTA_FlipOffsets, // Flips offsets when using DTA_FlipX and DTA_FlipY, this cannot be automatic due to unexpected behavior with unoffsetted graphics. DTA_Indexed, // Use an indexed texture combined with the given translation. + DTA_CleanTop, // Like DTA_Clean but aligns to the top of the screen instead of the center. }; diff --git a/source/common/audio/music/music_config.cpp b/source/common/audio/music/music_config.cpp index af3f7430a..e0b341b0a 100644 --- a/source/common/audio/music/music_config.cpp +++ b/source/common/audio/music/music_config.cpp @@ -99,9 +99,9 @@ CUSTOM_CVAR(String, adl_custom_bank, "", CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR FORWARD_STRING_CVAR(adl_custom_bank); } -CUSTOM_CVAR(Int, adl_volume_model, 3/*ADLMIDI_VolumeModel_DMX*/, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_VIRTUAL) +CUSTOM_CVAR(Int, adl_volume_model, 0 /*ADLMIDI_VolumeModel_AUTO*/, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_VIRTUAL) { - FORWARD_CVAR(adl_bank); + FORWARD_CVAR(adl_volume_model); } #endif //========================================================================== diff --git a/source/common/scripting/interface/vmnatives.cpp b/source/common/scripting/interface/vmnatives.cpp index e1aa14957..c4499b5a4 100644 --- a/source/common/scripting/interface/vmnatives.cpp +++ b/source/common/scripting/interface/vmnatives.cpp @@ -541,7 +541,7 @@ DEFINE_ACTION_FUNCTION(_CVar, FindCVar) // // //============================================================================= -#if 0 + DEFINE_ACTION_FUNCTION(FKeyBindings, SetBind) { PARAM_SELF_STRUCT_PROLOGUE(FKeyBindings); @@ -569,6 +569,14 @@ DEFINE_ACTION_FUNCTION(FKeyBindings, NameKeys) ACTION_RETURN_STRING(buffer); } +DEFINE_ACTION_FUNCTION(FKeyBindings, NameAllKeys) +{ + PARAM_PROLOGUE; + PARAM_POINTER(array, TArray); + auto buffer = C_NameKeys(array->Data(), array->Size(), true); + ACTION_RETURN_STRING(buffer); +} + DEFINE_ACTION_FUNCTION(FKeyBindings, GetKeysForCommand) { PARAM_SELF_STRUCT_PROLOGUE(FKeyBindings); @@ -580,6 +588,15 @@ DEFINE_ACTION_FUNCTION(FKeyBindings, GetKeysForCommand) return MIN(numret, 2); } +DEFINE_ACTION_FUNCTION(FKeyBindings, GetAllKeysForCommand) +{ + PARAM_SELF_STRUCT_PROLOGUE(FKeyBindings); + PARAM_POINTER(array, TArray); + PARAM_STRING(cmd); + *array = self->GetKeysForCommand(cmd); + return 0; +} + DEFINE_ACTION_FUNCTION(FKeyBindings, UnbindACommand) { PARAM_SELF_STRUCT_PROLOGUE(FKeyBindings); @@ -606,7 +623,7 @@ DEFINE_ACTION_FUNCTION(DOptionMenuItemCommand, DoCommand) C_DoCommand(cmd); return 0; } -#endif + DEFINE_ACTION_FUNCTION(_Console, MidPrint) { PARAM_PROLOGUE;