- backend update from Raze.

This commit is contained in:
Christoph Oelckers 2021-05-17 20:44:19 +02:00
parent 97b8c0ccfb
commit 8a4fa8b65f
12 changed files with 100 additions and 19 deletions

View file

@ -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)

View file

@ -1108,3 +1108,4 @@ xy(menu_advance, "menu/advance")
xx(zoomsize)
xx(ScreenJobRunner)
xx(RazeStatusBar)

View file

@ -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);

View file

@ -535,8 +535,6 @@ size_t FStringTable::ProcessEscapes (char *iptr)
}
else if (c == '\n')
continue;
}
*optr++ = c;
}

View file

@ -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)

View file

@ -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");

View file

@ -1006,6 +1006,22 @@ DEFINE_ACTION_FUNCTION_NATIVE(FDynArray_String, Push, ArrayPush<FDynArray_String
ACTION_RETURN_INT(self->Push(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<FDynArray_String>)
{
PARAM_SELF_STRUCT_PROLOGUE(FDynArray_String);

View file

@ -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)

View file

@ -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)

View file

@ -89,8 +89,8 @@ TArray<uint8_t> 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;

View file

@ -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);

View file

@ -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);