mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-01 00:21:43 +00:00
- backend update from Raze.
This commit is contained in:
parent
58d8ce1a4f
commit
9925cc380e
11 changed files with 38 additions and 17 deletions
|
@ -186,8 +186,9 @@ void DrawChar(F2DDrawer *drawer, FFont* font, int normalcolor, double x, double
|
|||
{
|
||||
return;
|
||||
}
|
||||
bool palettetrans = (normalcolor == CR_UNDEFINED && parms.TranslationId != 0);
|
||||
PalEntry color = 0xffffffff;
|
||||
parms.TranslationId = redirected ? -1 : font->GetColorTranslation((EColorRange)normalcolor, &color);
|
||||
if (!palettetrans) parms.TranslationId = redirected ? -1 : font->GetColorTranslation((EColorRange)normalcolor, &color);
|
||||
parms.color = PalEntry((color.a * parms.color.a) / 255, (color.r * parms.color.r) / 255, (color.g * parms.color.g) / 255, (color.b * parms.color.b) / 255);
|
||||
drawer->AddTexture(pic, parms);
|
||||
}
|
||||
|
@ -211,8 +212,9 @@ void DrawChar(F2DDrawer *drawer, FFont *font, int normalcolor, double x, double
|
|||
uint32_t tag = ListGetInt(args);
|
||||
bool res = ParseDrawTextureTags(drawer, pic, x, y, tag, args, &parms, false);
|
||||
if (!res) return;
|
||||
bool palettetrans = (normalcolor == CR_UNDEFINED && parms.TranslationId != 0);
|
||||
PalEntry color = 0xffffffff;
|
||||
parms.TranslationId = redirected ? -1 : font->GetColorTranslation((EColorRange)normalcolor, &color);
|
||||
if (!palettetrans) parms.TranslationId = redirected ? -1 : font->GetColorTranslation((EColorRange)normalcolor, &color);
|
||||
parms.color = PalEntry((color.a * parms.color.a) / 255, (color.r * parms.color.r) / 255, (color.g * parms.color.g) / 255, (color.b * parms.color.b) / 255);
|
||||
drawer->AddTexture(pic, parms);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
#include "intrect.h"
|
||||
|
||||
struct event_t;
|
||||
class FRenderState;
|
||||
class FGameTexture;
|
||||
enum EUpscaleFlags : int;
|
||||
|
||||
struct SystemCallbacks
|
||||
{
|
||||
|
@ -27,6 +30,8 @@ struct SystemCallbacks
|
|||
void (*MenuClosed)();
|
||||
bool (*CheckMenudefOption)(const char* opt);
|
||||
void (*ConsoleToggled)(int state);
|
||||
bool (*PreBindTexture)(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flags, int& scaleflags, int& clampmode, int& translation, int& overrideshader);
|
||||
void (*FontCharCreated)(FGameTexture* base, FGameTexture* untranslated, FGameTexture* translated);
|
||||
};
|
||||
|
||||
extern SystemCallbacks sysCallbacks;
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "fontchars.h"
|
||||
#include "multipatchtexture.h"
|
||||
#include "texturemanager.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
#include "fontinternals.h"
|
||||
|
||||
|
@ -342,6 +343,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
{
|
||||
Chars[i].TranslatedPic = tex;
|
||||
}
|
||||
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic, Chars[i].TranslatedPic);
|
||||
|
||||
Chars[i].XMove = (int)Chars[i].TranslatedPic->GetDisplayWidth();
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "image.h"
|
||||
#include "fontchars.h"
|
||||
#include "texturemanager.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
#include "fontinternals.h"
|
||||
|
||||
|
@ -116,6 +117,7 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FGameTexture
|
|||
}
|
||||
else Chars[i].TranslatedPic = Chars[i].OriginalPic;
|
||||
Chars[i].XMove = (int)Chars[i].TranslatedPic->GetDisplayWidth();
|
||||
if (sysCallbacks.FontCharCreated) sysCallbacks.FontCharCreated(pic, Chars[i].OriginalPic, Chars[i].TranslatedPic);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -267,7 +267,7 @@ private:
|
|||
|
||||
void *operator new(size_t len, nonew&)
|
||||
{
|
||||
return M_Malloc(len);
|
||||
return M_Calloc(len, 1);
|
||||
}
|
||||
public:
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "hw_material.h"
|
||||
#include "texmanip.h"
|
||||
#include "version.h"
|
||||
#include "i_interface.h"
|
||||
|
||||
struct FColormap;
|
||||
class IVertexBuffer;
|
||||
|
@ -569,6 +570,7 @@ public:
|
|||
mBias.mChanged = true;
|
||||
}
|
||||
|
||||
private:
|
||||
void SetMaterial(FMaterial *mat, int clampmode, int translation, int overrideshader)
|
||||
{
|
||||
mMaterial.mMaterial = mat;
|
||||
|
@ -581,10 +583,16 @@ public:
|
|||
mStreamData.uDetailParms = { scale.X, scale.Y, 2, 0 };
|
||||
}
|
||||
|
||||
public:
|
||||
void SetMaterial(FGameTexture* tex, EUpscaleFlags upscalemask, int scaleflags, int clampmode, int translation, int overrideshader)
|
||||
{
|
||||
if (shouldUpscale(tex, upscalemask)) scaleflags |= CTF_Upscale;
|
||||
SetMaterial(FMaterial::ValidateTexture(tex, scaleflags), clampmode, translation, overrideshader);
|
||||
if (!sysCallbacks.PreBindTexture || !sysCallbacks.PreBindTexture(this, tex, upscalemask, scaleflags, clampmode, translation, overrideshader))
|
||||
{
|
||||
if (shouldUpscale(tex, upscalemask)) scaleflags |= CTF_Upscale;
|
||||
}
|
||||
auto mat = FMaterial::ValidateTexture(tex, scaleflags);
|
||||
assert(mat);
|
||||
SetMaterial(mat, clampmode, translation, overrideshader);
|
||||
}
|
||||
|
||||
void SetClipSplit(float bottom, float top)
|
||||
|
|
|
@ -124,7 +124,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawImage, SBar_DrawImage)
|
|||
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);
|
||||
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);
|
||||
|
||||
DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawString, SBar_DrawString)
|
||||
{
|
||||
|
@ -140,7 +140,8 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, DrawString, SBar_DrawString)
|
|||
PARAM_INT(linespacing);
|
||||
PARAM_FLOAT(scaleX);
|
||||
PARAM_FLOAT(scaleY);
|
||||
SBar_DrawString(self, font, string, x, y, flags, trans, alpha, wrapwidth, linespacing, scaleX, scaleY);
|
||||
PARAM_INT(pt);
|
||||
SBar_DrawString(self, font, string, x, y, flags, trans, alpha, wrapwidth, linespacing, scaleX, scaleY, pt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -79,8 +79,8 @@ void VMFunction::CreateRegUse()
|
|||
int count = 0;
|
||||
if (!Proto)
|
||||
{
|
||||
if (RegTypes) return;
|
||||
Printf(TEXTCOLOR_ORANGE "Function without prototype needs register info manually set: %s\n", PrintableName.GetChars());
|
||||
//if (RegTypes) return;
|
||||
//Printf(TEXTCOLOR_ORANGE "Function without prototype needs register info manually set: %s\n", PrintableName.GetChars());
|
||||
return;
|
||||
}
|
||||
assert(Proto->isPrototype());
|
||||
|
|
|
@ -57,7 +57,7 @@ IMPLEMENT_CLASS(DHUDFont, false, false);
|
|||
|
||||
CVAR(Color, crosshaircolor, 0xff0000, CVAR_ARCHIVE);
|
||||
CVAR(Int, crosshairhealth, 2, CVAR_ARCHIVE);
|
||||
CVAR(Float, crosshairscale, 1.0, CVAR_ARCHIVE);
|
||||
CVARD(Float, crosshairscale, 0.5, CVAR_ARCHIVE, "changes the size of the crosshair");
|
||||
CVAR(Bool, crosshairgrow, false, CVAR_ARCHIVE);
|
||||
EXTERN_CVAR(Bool, vid_fps)
|
||||
|
||||
|
@ -602,7 +602,7 @@ void DStatusBarCore::DrawGraphic(FGameTexture* tex, double x, double y, int flag
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY)
|
||||
void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY, int pt)
|
||||
{
|
||||
bool monospaced = monospacing != EMonospacing::Off;
|
||||
double dx = 0;
|
||||
|
@ -724,10 +724,11 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
|||
DTA_FillColor, 0,
|
||||
TAG_DONE);
|
||||
}
|
||||
DrawChar(twod, font, fontcolor, rx, ry, ch,
|
||||
DrawChar(twod, font, pt == 0? fontcolor : CR_UNDEFINED, rx, ry, ch,
|
||||
DTA_DestWidthF, rw,
|
||||
DTA_DestHeightF, rh,
|
||||
DTA_Alpha, Alpha,
|
||||
DTA_TranslationIndex, pt,
|
||||
TAG_DONE);
|
||||
|
||||
dx = monospaced
|
||||
|
@ -739,7 +740,7 @@ void DStatusBarCore::DrawString(FFont* font, const FString& cstring, double x, d
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
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 pt)
|
||||
{
|
||||
if (font == nullptr) ThrowAbortException(X_READ_NIL, nullptr);
|
||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
|
@ -758,13 +759,13 @@ void SBar_DrawString(DStatusBarCore* self, DHUDFont* font, const FString& string
|
|||
auto brk = V_BreakLines(font->mFont, int(wrapwidth * scaleX), string, true);
|
||||
for (auto& line : brk)
|
||||
{
|
||||
self->DrawString(font->mFont, line.Text, x, y, flags, alpha, trans, font->mSpacing, font->mMonospacing, font->mShadowX, font->mShadowY, scaleX, scaleY);
|
||||
self->DrawString(font->mFont, line.Text, x, y, flags, alpha, trans, font->mSpacing, font->mMonospacing, font->mShadowX, font->mShadowY, scaleX, scaleY, pt);
|
||||
y += (font->mFont->GetHeight() + linespacing) * scaleY;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
self->DrawString(font->mFont, string, x, y, flags, alpha, trans, font->mSpacing, font->mMonospacing, font->mShadowX, font->mShadowY, scaleX, scaleY);
|
||||
self->DrawString(font->mFont, string, x, y, flags, alpha, trans, font->mSpacing, font->mMonospacing, font->mShadowX, font->mShadowY, scaleX, scaleY, pt);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -186,7 +186,7 @@ public:
|
|||
void StatusbarToRealCoords(double& x, double& y, double& w, double& h) const;
|
||||
void DrawGraphic(FGameTexture* texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0, ERenderStyle style = STYLE_Translucent);
|
||||
void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0, ERenderStyle style = STYLE_Translucent);
|
||||
void DrawString(FFont* font, const FString& cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY);
|
||||
void DrawString(FFont* font, const FString& cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY, int pt);
|
||||
void TransformRect(double& x, double& y, double& w, double& h, int flags = 0);
|
||||
void Fill(PalEntry color, double x, double y, double w, double h, int flags = 0);
|
||||
void SetClipRect(double x, double y, double w, double h, int flags = 0);
|
||||
|
|
|
@ -361,7 +361,7 @@ inline FGameTexture* MakeGameTexture(FTexture* tex, const char *name, ETextureTy
|
|||
return t;
|
||||
}
|
||||
|
||||
enum EUpscaleFlags
|
||||
enum EUpscaleFlags : int
|
||||
{
|
||||
UF_None = 0,
|
||||
UF_Texture = 1,
|
||||
|
|
Loading…
Reference in a new issue