mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
- transitioned the 2D drawer to FGameTexture.
This commit is contained in:
parent
d9928b51a8
commit
9e7094848c
21 changed files with 135 additions and 153 deletions
|
@ -2150,7 +2150,7 @@ void DAutomap::drawSubsectors()
|
|||
fadelevel = 1. - clamp(floorlight, 0, 255) / 255.f;
|
||||
}
|
||||
|
||||
twod->AddPoly(TexMan.GetTexture(maptex, true),
|
||||
twod->AddPoly(TexMan.GetGameTexture(maptex, true),
|
||||
&points[0], points.Size(),
|
||||
originx, originy,
|
||||
scale / scalex,
|
||||
|
|
|
@ -234,7 +234,7 @@ void F2DDrawer::AddIndices(int firstvert, TArray<int> &v)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool F2DDrawer::SetStyle(FTexture *tex, DrawParms &parms, PalEntry &vertexcolor, RenderCommand &quad)
|
||||
bool F2DDrawer::SetStyle(FGameTexture *tex, DrawParms &parms, PalEntry &vertexcolor, RenderCommand &quad)
|
||||
{
|
||||
FRenderStyle style = parms.style;
|
||||
float alpha;
|
||||
|
@ -390,7 +390,7 @@ void F2DDrawer::SetColorOverlay(PalEntry color, float alpha, PalEntry &vertexcol
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
|
||||
void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms)
|
||||
{
|
||||
if (parms.style.BlendOp == STYLEOP_None) return; // not supposed to be drawn.
|
||||
|
||||
|
@ -472,7 +472,7 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddShape( FTexture *img, DShape2D *shape, DrawParms &parms )
|
||||
void F2DDrawer::AddShape(FGameTexture* img, DShape2D* shape, DrawParms& parms)
|
||||
{
|
||||
// [MK] bail out if vertex/coord array sizes are mismatched
|
||||
if ( shape->mVertices.Size() != shape->mCoords.Size() )
|
||||
|
@ -550,12 +550,11 @@ void F2DDrawer::AddShape( FTexture *img, DShape2D *shape, DrawParms &parms )
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints,
|
||||
void F2DDrawer::AddPoly(FGameTexture *texture, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, const FColormap &colormap, PalEntry flatcolor, double fadelevel,
|
||||
uint32_t *indices, size_t indexcount)
|
||||
{
|
||||
|
||||
RenderCommand poly;
|
||||
|
||||
poly.mType = DrawTypeTriangles;
|
||||
|
@ -630,7 +629,7 @@ void F2DDrawer::AddPoly(FTexture *texture, FVector2 *points, int npoints,
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddPoly(FTexture* img, FVector4* vt, size_t vtcount, unsigned int* ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2)
|
||||
void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, unsigned int* ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2)
|
||||
{
|
||||
RenderCommand dg = {};
|
||||
int method = 0;
|
||||
|
@ -677,7 +676,7 @@ void F2DDrawer::AddPoly(FTexture* img, FVector4* vt, size_t vtcount, unsigned in
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin)
|
||||
void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, bool local_origin)
|
||||
{
|
||||
float fU1, fU2, fV1, fV2;
|
||||
|
||||
|
@ -693,17 +692,17 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FTexture *
|
|||
// scaling is not used here.
|
||||
if (!local_origin)
|
||||
{
|
||||
fU1 = float(left) / src->GetDisplayWidth();
|
||||
fV1 = float(top) / src->GetDisplayHeight();
|
||||
fU2 = float(right) / src->GetDisplayWidth();
|
||||
fV2 = float(bottom) / src->GetDisplayHeight();
|
||||
fU1 = float(left) / (float)src->GetDisplayWidth();
|
||||
fV1 = float(top) / (float)src->GetDisplayHeight();
|
||||
fU2 = float(right) / (float)src->GetDisplayWidth();
|
||||
fV2 = float(bottom) / (float)src->GetDisplayHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
fU1 = 0;
|
||||
fV1 = 0;
|
||||
fU2 = float(right - left) / src->GetDisplayWidth();
|
||||
fV2 = float(bottom - top) / src->GetDisplayHeight();
|
||||
fU2 = float(right - left) / (float)src->GetDisplayWidth();
|
||||
fV2 = float(bottom - top) / (float)src->GetDisplayHeight();
|
||||
}
|
||||
dg.mVertIndex = (int)mVertices.Reserve(4);
|
||||
auto ptr = &mVertices[dg.mVertIndex];
|
||||
|
|
|
@ -124,7 +124,7 @@ public:
|
|||
int mIndexIndex;
|
||||
int mIndexCount;
|
||||
|
||||
FTexture *mTexture;
|
||||
FGameTexture *mTexture;
|
||||
int mTranslationId;
|
||||
PalEntry mSpecialColormap[2];
|
||||
int mScissor[4];
|
||||
|
@ -170,24 +170,19 @@ public:
|
|||
void AddIndices(int firstvert, int count, ...);
|
||||
private:
|
||||
void AddIndices(int firstvert, TArray<int> &v);
|
||||
bool SetStyle(FTexture *tex, DrawParms &parms, PalEntry &color0, RenderCommand &quad);
|
||||
bool SetStyle(FGameTexture *tex, DrawParms &parms, PalEntry &color0, RenderCommand &quad);
|
||||
void SetColorOverlay(PalEntry color, float alpha, PalEntry &vertexcolor, PalEntry &overlaycolor);
|
||||
|
||||
public:
|
||||
void AddTexture(FTexture *img, DrawParms &parms);
|
||||
void AddShape(FTexture *img, DShape2D *shape, DrawParms &parms);
|
||||
void AddPoly(FTexture *texture, FVector2 *points, int npoints,
|
||||
void AddTexture(FGameTexture* img, DrawParms& parms);
|
||||
void AddShape(FGameTexture *img, DShape2D *shape, DrawParms &parms);
|
||||
void AddPoly(FGameTexture *texture, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, const FColormap &colormap, PalEntry flatcolor, double lightlevel, uint32_t *indices, size_t indexcount);
|
||||
void AddPoly(FTexture* img, FVector4 *vt, size_t vtcount, unsigned int *ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2);
|
||||
void AddPoly(FGameTexture* img, FVector4 *vt, size_t vtcount, unsigned int *ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2);
|
||||
void FillPolygon(int* rx1, int* ry1, int* xb1, int32_t npoints, int picnum, int palette, int shade, int props, const FVector2& xtex, const FVector2& ytex, const FVector2& otex,
|
||||
int clipx1, int clipy1, int clipx2, int clipy2);
|
||||
void AddFlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin = false);
|
||||
void AddFlatFill(int left, int top, int right, int bottom, FGameTexture* src, bool local_origin = false)
|
||||
{
|
||||
AddFlatFill(left, top, right, bottom, src->GetTexture(), local_origin);
|
||||
}
|
||||
|
||||
void AddFlatFill(int left, int top, int right, int bottom, FGameTexture *src, bool local_origin = false);
|
||||
|
||||
void AddColorOnlyQuad(int left, int top, int width, int height, PalEntry color, FRenderStyle *style = nullptr);
|
||||
void ClearScreen(PalEntry color = 0xff000000);
|
||||
|
|
|
@ -180,7 +180,7 @@ int CleanXfac_1, CleanYfac_1, CleanWidth_1, CleanHeight_1;
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DrawTexture(F2DDrawer *drawer, FTexture* img, double x, double y, int tags_first, ...)
|
||||
void DrawTexture(F2DDrawer *drawer, FGameTexture* img, double x, double y, int tags_first, ...)
|
||||
{
|
||||
Va_List tags;
|
||||
va_start(tags.list, tags_first);
|
||||
|
@ -203,7 +203,7 @@ void DrawTexture(F2DDrawer *drawer, FTexture* img, double x, double y, int tags_
|
|||
|
||||
int ListGetInt(VMVa_List &tags);
|
||||
|
||||
static void DrawTexture(F2DDrawer *drawer, FTexture *img, double x, double y, VMVa_List &args)
|
||||
static void DrawTexture(F2DDrawer *drawer, FGameTexture *img, double x, double y, VMVa_List &args)
|
||||
{
|
||||
DrawParms parms;
|
||||
uint32_t tag = ListGetInt(args);
|
||||
|
@ -224,7 +224,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawTexture)
|
|||
|
||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
|
||||
FTexture *tex = TexMan.ByIndex(texid, animate);
|
||||
auto tex = TexMan.GameByIndex(texid, animate);
|
||||
VMVa_List args = { param + 4, 0, numparam - 5, va_reginfo + 4 };
|
||||
DrawTexture(twod, tex, x, y, args);
|
||||
return 0;
|
||||
|
@ -236,7 +236,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawTexture)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DrawShape(F2DDrawer *drawer, FTexture *img, DShape2D *shape, int tags_first, ...)
|
||||
void DrawShape(F2DDrawer *drawer, FGameTexture *img, DShape2D *shape, int tags_first, ...)
|
||||
{
|
||||
Va_List tags;
|
||||
va_start(tags.list, tags_first);
|
||||
|
@ -248,7 +248,7 @@ void DrawShape(F2DDrawer *drawer, FTexture *img, DShape2D *shape, int tags_first
|
|||
drawer->AddShape(img, shape, parms);
|
||||
}
|
||||
|
||||
void DrawShape(F2DDrawer *drawer, FTexture *img, DShape2D *shape, VMVa_List &args)
|
||||
void DrawShape(F2DDrawer *drawer, FGameTexture *img, DShape2D *shape, VMVa_List &args)
|
||||
{
|
||||
DrawParms parms;
|
||||
uint32_t tag = ListGetInt(args);
|
||||
|
@ -269,7 +269,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawShape)
|
|||
|
||||
if (!twod->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
|
||||
FTexture *tex = TexMan.ByIndex(texid, animate);
|
||||
auto tex = TexMan.GameByIndex(texid, animate);
|
||||
VMVa_List args = { param + 3, 0, numparam - 4, va_reginfo + 3 };
|
||||
|
||||
DrawShape(twod, tex, shape, args);
|
||||
|
@ -334,7 +334,7 @@ DEFINE_ACTION_FUNCTION(_Screen, GetClipRect)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FTexture *img, double xx, double yy)
|
||||
bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FGameTexture *img, double xx, double yy)
|
||||
{
|
||||
auto GetWidth = [=]() { return drawer->GetWidth(); };
|
||||
auto GetHeight = [=]() {return drawer->GetHeight(); };
|
||||
|
@ -342,8 +342,8 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FTexture *img, double
|
|||
{
|
||||
parms->x = xx;
|
||||
parms->y = yy;
|
||||
parms->texwidth = img->GetDisplayWidthDouble();
|
||||
parms->texheight = img->GetDisplayHeightDouble();
|
||||
parms->texwidth = img->GetDisplayWidth();
|
||||
parms->texheight = img->GetDisplayHeight();
|
||||
if (parms->top == INT_MAX || parms->fortext)
|
||||
{
|
||||
parms->top = img->GetDisplayTopOffset();
|
||||
|
@ -354,11 +354,11 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FTexture *img, double
|
|||
}
|
||||
if (parms->destwidth == INT_MAX || parms->fortext)
|
||||
{
|
||||
parms->destwidth = img->GetDisplayWidthDouble();
|
||||
parms->destwidth = img->GetDisplayWidth();
|
||||
}
|
||||
if (parms->destheight == INT_MAX || parms->fortext)
|
||||
{
|
||||
parms->destheight = img->GetDisplayHeightDouble();
|
||||
parms->destheight = img->GetDisplayHeight();
|
||||
}
|
||||
|
||||
switch (parms->cleanmode)
|
||||
|
@ -387,8 +387,8 @@ bool SetTextureParms(F2DDrawer * drawer, DrawParms *parms, FTexture *img, double
|
|||
case DTA_FullscreenEx:
|
||||
{
|
||||
double aspect;
|
||||
double srcwidth = img->GetDisplayWidthDouble();
|
||||
double srcheight = img->GetDisplayHeightDouble();
|
||||
double srcwidth = img->GetDisplayWidth();
|
||||
double srcheight = img->GetDisplayHeight();
|
||||
int autoaspect = parms->fsscalemode;
|
||||
aspect = autoaspect == 0 || (srcwidth == 320 && srcheight == 200) || (srcwidth == 640 && srcheight == 400)? 1.333 : srcwidth / srcheight;
|
||||
parms->x = parms->y = 0;
|
||||
|
@ -531,7 +531,7 @@ static inline FSpecialColormap * ListGetSpecialColormap(VMVa_List &tags)
|
|||
//==========================================================================
|
||||
|
||||
template<class T>
|
||||
bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y, uint32_t tag, T& tags, DrawParms *parms, bool fortext)
|
||||
bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture *img, double x, double y, uint32_t tag, T& tags, DrawParms *parms, bool fortext)
|
||||
{
|
||||
INTBOOL boolval;
|
||||
int intval;
|
||||
|
@ -724,8 +724,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
if (img == NULL) return false;
|
||||
parms->cleanmode = DTA_Fullscreen;
|
||||
parms->fsscalemode = (uint8_t)twod->fullscreenautoaspect;
|
||||
parms->virtWidth = img->GetDisplayWidthDouble();
|
||||
parms->virtHeight = img->GetDisplayHeightDouble();
|
||||
parms->virtWidth = img->GetDisplayWidth();
|
||||
parms->virtHeight = img->GetDisplayHeight();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -738,8 +738,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
if (img == NULL) return false;
|
||||
parms->cleanmode = DTA_Fullscreen;
|
||||
parms->fsscalemode = (uint8_t)intval;
|
||||
parms->virtWidth = img->GetDisplayWidthDouble();
|
||||
parms->virtHeight = img->GetDisplayHeightDouble();
|
||||
parms->virtWidth = img->GetDisplayWidth();
|
||||
parms->virtHeight = img->GetDisplayHeight();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -785,19 +785,19 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
break;
|
||||
|
||||
case DTA_SrcX:
|
||||
parms->srcx = ListGetDouble(tags) / img->GetDisplayWidthDouble();
|
||||
parms->srcx = ListGetDouble(tags) / img->GetDisplayWidth();
|
||||
break;
|
||||
|
||||
case DTA_SrcY:
|
||||
parms->srcy = ListGetDouble(tags) / img->GetDisplayHeightDouble();
|
||||
parms->srcy = ListGetDouble(tags) / img->GetDisplayHeight();
|
||||
break;
|
||||
|
||||
case DTA_SrcWidth:
|
||||
parms->srcwidth = ListGetDouble(tags) / img->GetDisplayWidthDouble();
|
||||
parms->srcwidth = ListGetDouble(tags) / img->GetDisplayWidth();
|
||||
break;
|
||||
|
||||
case DTA_SrcHeight:
|
||||
parms->srcheight = ListGetDouble(tags) / img->GetDisplayHeightDouble();
|
||||
parms->srcheight = ListGetDouble(tags) / img->GetDisplayHeight();
|
||||
break;
|
||||
|
||||
case DTA_TopOffset:
|
||||
|
@ -829,8 +829,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
if (fortext) return false;
|
||||
if (ListGetInt(tags))
|
||||
{
|
||||
parms->left = img->GetDisplayWidthDouble() * 0.5;
|
||||
parms->top = img->GetDisplayHeightDouble() * 0.5;
|
||||
parms->left = img->GetDisplayWidth() * 0.5;
|
||||
parms->top = img->GetDisplayHeight() * 0.5;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -839,8 +839,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
if (fortext) return false;
|
||||
if (ListGetInt(tags))
|
||||
{
|
||||
parms->left = img->GetDisplayWidthDouble() * 0.5;
|
||||
parms->top = img->GetDisplayHeightDouble();
|
||||
parms->left = img->GetDisplayWidth() * 0.5;
|
||||
parms->top = img->GetDisplayHeight();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1038,8 +1038,8 @@ bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture *img, double x, double y,
|
|||
}
|
||||
// explicitly instantiate both versions for v_text.cpp.
|
||||
|
||||
template bool ParseDrawTextureTags<Va_List>(F2DDrawer* drawer, FTexture *img, double x, double y, uint32_t tag, Va_List& tags, DrawParms *parms, bool fortext);
|
||||
template bool ParseDrawTextureTags<VMVa_List>(F2DDrawer* drawer, FTexture *img, double x, double y, uint32_t tag, VMVa_List& tags, DrawParms *parms, bool fortext);
|
||||
template bool ParseDrawTextureTags<Va_List>(F2DDrawer* drawer, FGameTexture *img, double x, double y, uint32_t tag, Va_List& tags, DrawParms *parms, bool fortext);
|
||||
template bool ParseDrawTextureTags<VMVa_List>(F2DDrawer* drawer, FGameTexture *img, double x, double y, uint32_t tag, VMVa_List& tags, DrawParms *parms, bool fortext);
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -1131,7 +1131,7 @@ void VirtualToRealCoordsInt(F2DDrawer *drawer, int &x, int &y, int &w, int &h,
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FillBorder (F2DDrawer *drawer, FTexture *img)
|
||||
void FillBorder (F2DDrawer *drawer, FGameTexture *img)
|
||||
{
|
||||
auto Width = drawer->GetWidth();
|
||||
auto Height = drawer->GetHeight();
|
||||
|
@ -1351,7 +1351,7 @@ void DrawBorder (F2DDrawer *drawer, FTextureID picnum, int x1, int y1, int x2, i
|
|||
{
|
||||
if (picnum.isValid())
|
||||
{
|
||||
drawer->AddFlatFill (x1, y1, x2, y2, TexMan.GetTexture(picnum, false));
|
||||
drawer->AddFlatFill (x1, y1, x2, y2, TexMan.GetGameTexture(picnum, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -203,27 +203,21 @@ inline int active_con_scale(F2DDrawer *drawer)
|
|||
#endif
|
||||
|
||||
template<class T>
|
||||
bool ParseDrawTextureTags(F2DDrawer *drawer, FTexture* img, double x, double y, uint32_t tag, T& tags, DrawParms* parms, bool fortext);
|
||||
bool ParseDrawTextureTags(F2DDrawer *drawer, FGameTexture* img, double x, double y, uint32_t tag, T& tags, DrawParms* parms, bool fortext);
|
||||
|
||||
template<class T>
|
||||
void DrawTextCommon(F2DDrawer *drawer, FFont* font, int normalcolor, double x, double y, const T* string, DrawParms& parms);
|
||||
bool SetTextureParms(F2DDrawer *drawer, DrawParms* parms, FTexture* img, double x, double y);
|
||||
bool SetTextureParms(F2DDrawer *drawer, DrawParms* parms, FGameTexture* img, double x, double y);
|
||||
|
||||
void DrawText(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, const char* string, int tag_first, ...);
|
||||
void DrawText(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, const char32_t* string, int tag_first, ...);
|
||||
void DrawChar(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, int character, int tag_first, ...);
|
||||
|
||||
template <typename ...Params>
|
||||
void DrawTexture(F2DDrawer* drawer, FGameTexture* img, double x, double y, int tags_first, Params&&... params)
|
||||
{
|
||||
void DrawTexture(F2DDrawer * drawer, FTexture * img, double x, double y, int tags_first, ...);
|
||||
|
||||
DrawTexture(drawer, img->GetTexture(), x, y, tags_first, std::forward<Params>(params)...);
|
||||
}
|
||||
void DrawTexture(F2DDrawer* drawer, FGameTexture* img, double x, double y, int tags_first, ...);
|
||||
|
||||
void DoDim(F2DDrawer* drawer, PalEntry color, float amount, int x1, int y1, int w, int h, FRenderStyle* style = nullptr);
|
||||
void Dim(F2DDrawer* drawer, PalEntry color, float damount, int x1, int y1, int w, int h, FRenderStyle* style = nullptr);
|
||||
void FillBorder(F2DDrawer *drawer, FTexture* img); // Fills the border around a 4:3 part of the screen on non-4:3 displays
|
||||
void FillBorder(F2DDrawer *drawer, FGameTexture* img); // Fills the border around a 4:3 part of the screen on non-4:3 displays
|
||||
|
||||
void DrawFrame(F2DDrawer* drawer, int left, int top, int width, int height);
|
||||
void DrawBorder(F2DDrawer* drawer, FTextureID, int x1, int y1, int x2, int y2);
|
||||
|
|
|
@ -53,7 +53,7 @@ int ListGetInt(VMVa_List &tags);
|
|||
//
|
||||
//==========================================================================
|
||||
#if 0
|
||||
FTexture * BuildTextTexture(FFont *font, const char *string, int textcolor)
|
||||
FGameTexture * BuildTextTexture(FFont *font, const char *string, int textcolor)
|
||||
{
|
||||
int w;
|
||||
const uint8_t *ch;
|
||||
|
@ -61,7 +61,7 @@ FTexture * BuildTextTexture(FFont *font, const char *string, int textcolor)
|
|||
int cy;
|
||||
int trans = -1;
|
||||
int kerning;
|
||||
FTexture *pic;
|
||||
FGameTexture *pic;
|
||||
|
||||
kerning = font->GetDefaultKerning();
|
||||
|
||||
|
@ -170,7 +170,7 @@ void DrawChar(F2DDrawer *drawer, FFont* font, int normalcolor, double x, double
|
|||
if (normalcolor >= NumTextColors)
|
||||
normalcolor = CR_UNTRANSLATED;
|
||||
|
||||
FTexture* pic;
|
||||
FGameTexture* pic;
|
||||
int dummy;
|
||||
bool redirected;
|
||||
|
||||
|
@ -200,7 +200,7 @@ void DrawChar(F2DDrawer *drawer, FFont *font, int normalcolor, double x, double
|
|||
if (normalcolor >= NumTextColors)
|
||||
normalcolor = CR_UNTRANSLATED;
|
||||
|
||||
FTexture *pic;
|
||||
FGameTexture *pic;
|
||||
int dummy;
|
||||
bool redirected;
|
||||
|
||||
|
@ -256,7 +256,7 @@ void DrawTextCommon(F2DDrawer *drawer, FFont *font, int normalcolor, double x, d
|
|||
int boldcolor;
|
||||
int trans = -1;
|
||||
int kerning;
|
||||
FTexture *pic;
|
||||
FGameTexture *pic;
|
||||
|
||||
if (parms.celly == 0) parms.celly = font->GetHeight() + 1;
|
||||
parms.celly *= parms.scaley;
|
||||
|
|
|
@ -73,7 +73,6 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
int i;
|
||||
FTextureID lump;
|
||||
char buffer[12];
|
||||
int maxyoffs;
|
||||
DVector2 Scale = { 1, 1 };
|
||||
|
||||
noTranslate = notranslate;
|
||||
|
@ -91,9 +90,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
translateUntranslated = false;
|
||||
int FixedWidth = 0;
|
||||
|
||||
maxyoffs = 0;
|
||||
|
||||
TMap<int, FTexture*> charMap;
|
||||
TMap<int, FGameTexture*> charMap;
|
||||
int minchar = INT_MAX;
|
||||
int maxchar = INT_MIN;
|
||||
|
||||
|
@ -231,13 +228,13 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
Type = Multilump;
|
||||
if (position < minchar) minchar = position;
|
||||
if (position > maxchar) maxchar = position;
|
||||
charMap.Insert(position, TexMan.GetTexture(lump));
|
||||
charMap.Insert(position, TexMan.GetGameTexture(lump));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FTexture *texs[256] = {};
|
||||
FGameTexture *texs[256] = {};
|
||||
if (lcount > 256 - start) lcount = 256 - start;
|
||||
for (i = 0; i < lcount; i++)
|
||||
{
|
||||
|
@ -247,8 +244,8 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
TexMan.ListTextures(buffer, array, true);
|
||||
for (auto entry : array)
|
||||
{
|
||||
FTexture *tex = TexMan.GetTexture(entry, false);
|
||||
if (tex && tex->GetSourceLump() >= 0 && fileSystem.GetFileContainer(tex->GetSourceLump()) <= fileSystem.GetMaxIwadNum() && tex->GetUseType() == ETextureType::MiscPatch)
|
||||
auto tex = TexMan.GetGameTexture(entry, false);
|
||||
if (tex && !tex->isUserContent() && tex->GetUseType() == ETextureType::MiscPatch)
|
||||
{
|
||||
texs[i] = tex;
|
||||
}
|
||||
|
@ -292,7 +289,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
{
|
||||
if ((int)position < minchar) minchar = (int)position;
|
||||
if ((int)position > maxchar) maxchar = (int)position;
|
||||
auto tex = TexMan.GetTexture(lump);
|
||||
auto tex = TexMan.GetGameTexture(lump);
|
||||
tex->SetScale(Scale);
|
||||
charMap.Insert((int)position, tex);
|
||||
Type = Folder;
|
||||
|
@ -312,17 +309,13 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
auto lump = charMap.CheckKey(FirstChar + i);
|
||||
if (lump != nullptr)
|
||||
{
|
||||
FTexture *pic = *lump;
|
||||
auto pic = *lump;
|
||||
if (pic != nullptr)
|
||||
{
|
||||
int height = pic->GetDisplayHeight();
|
||||
int yoffs = pic->GetDisplayTopOffset();
|
||||
double fheight = pic->GetDisplayHeight();
|
||||
double yoffs = pic->GetDisplayTopOffset();
|
||||
|
||||
if (yoffs > maxyoffs)
|
||||
{
|
||||
maxyoffs = yoffs;
|
||||
}
|
||||
height += abs(yoffs);
|
||||
int height = int(fheight + abs(yoffs) + 0.5);
|
||||
if (height > fontheight)
|
||||
{
|
||||
fontheight = height;
|
||||
|
@ -333,21 +326,23 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
}
|
||||
}
|
||||
|
||||
Chars[i].OriginalPic = new FImageTexture(pic->GetImage(), "");
|
||||
Chars[i].OriginalPic->SetUseType(ETextureType::FontChar);
|
||||
Chars[i].OriginalPic->CopySize(pic);
|
||||
TexMan.AddTexture(Chars[i].OriginalPic);
|
||||
auto orig = pic->GetTexture();
|
||||
auto tex = new FImageTexture(orig->GetImage(), "");
|
||||
tex->SetUseType(ETextureType::FontChar);
|
||||
tex->CopySize(orig);
|
||||
TexMan.AddTexture(tex);
|
||||
Chars[i].OriginalPic = tex;
|
||||
|
||||
if (!noTranslate)
|
||||
{
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar1(pic->GetImage()), "");
|
||||
Chars[i].TranslatedPic->CopySize(pic);
|
||||
Chars[i].TranslatedPic = new FImageTexture(new FFontChar1(orig->GetImage()), "");
|
||||
Chars[i].TranslatedPic->CopySize(orig);
|
||||
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||
TexMan.AddTexture(Chars[i].TranslatedPic);
|
||||
}
|
||||
else
|
||||
{
|
||||
Chars[i].TranslatedPic = Chars[i].OriginalPic;
|
||||
Chars[i].TranslatedPic = tex;
|
||||
}
|
||||
|
||||
Chars[i].XMove = Chars[i].TranslatedPic->GetDisplayWidth();
|
||||
|
@ -389,7 +384,7 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
|||
{
|
||||
// all valid lumps must be named with a hex number that represents the Unicode character index for its first character,
|
||||
TArray<TexPart> part(1, true);
|
||||
TMap<int, FTexture*> charMap;
|
||||
TMap<int, FGameTexture*> charMap;
|
||||
int minchar = INT_MAX;
|
||||
int maxchar = INT_MIN;
|
||||
for (auto &entry : folderdata)
|
||||
|
@ -433,7 +428,7 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
|||
tex->bNoDecals = false;
|
||||
tex->SourceLump = -1; // We do not really care.
|
||||
TexMan.AddTexture(tex);
|
||||
charMap.Insert(int(position) + x + y * numtex_x, tex);
|
||||
charMap.Insert(int(position) + x + y * numtex_x, reinterpret_cast<FGameTexture*>(tex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -458,7 +453,7 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
|
|||
auto lump = charMap.CheckKey(FirstChar + i);
|
||||
if (lump != nullptr)
|
||||
{
|
||||
FTexture *pic = *lump;
|
||||
FTexture *pic = (*lump)->GetTexture();
|
||||
|
||||
auto b = pic->Get8BitPixels(false);
|
||||
|
||||
|
@ -982,7 +977,7 @@ int FFont::GetCharCode(int code, bool needpic) const
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *FFont::GetChar (int code, int translation, int *const width, bool *redirected) const
|
||||
FGameTexture *FFont::GetChar (int code, int translation, int *const width, bool *redirected) const
|
||||
{
|
||||
code = GetCharCode(code, true);
|
||||
int xmove = SpaceWidth;
|
||||
|
@ -1007,12 +1002,12 @@ FTexture *FFont::GetChar (int code, int translation, int *const width, bool *red
|
|||
if (redirect)
|
||||
{
|
||||
assert(Chars[code].OriginalPic->UseType == ETextureType::FontChar);
|
||||
return Chars[code].OriginalPic;
|
||||
return reinterpret_cast<FGameTexture*>(Chars[code].OriginalPic);
|
||||
}
|
||||
}
|
||||
if (redirected) *redirected = false;
|
||||
assert(Chars[code].TranslatedPic->UseType == ETextureType::FontChar);
|
||||
return Chars[code].TranslatedPic;
|
||||
return reinterpret_cast<FGameTexture*>(Chars[code].TranslatedPic);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1037,11 +1032,11 @@ int FFont::GetCharWidth (int code) const
|
|||
double GetBottomAlignOffset(FFont *font, int c)
|
||||
{
|
||||
int w;
|
||||
FTexture *tex_zero = font->GetChar('0', CR_UNDEFINED, &w);
|
||||
FTexture *texc = font->GetChar(c, CR_UNDEFINED, &w);
|
||||
auto tex_zero = font->GetChar('0', CR_UNDEFINED, &w);
|
||||
auto texc = font->GetChar(c, CR_UNDEFINED, &w);
|
||||
double offset = 0;
|
||||
if (texc) offset += texc->GetDisplayTopOffsetDouble();
|
||||
if (tex_zero) offset += -tex_zero->GetDisplayTopOffsetDouble() + tex_zero->GetDisplayHeightDouble();
|
||||
if (texc) offset += texc->GetDisplayTopOffset();
|
||||
if (tex_zero) offset += -tex_zero->GetDisplayTopOffset() + tex_zero->GetDisplayHeight();
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
FSinglePicFont(const char *picname);
|
||||
|
||||
// FFont interface
|
||||
FTexture *GetChar(int code, int translation, int *const width, bool *redirected = nullptr) const override;
|
||||
FGameTexture *GetChar(int code, int translation, int *const width, bool *redirected = nullptr) const override;
|
||||
int GetCharWidth (int code) const;
|
||||
|
||||
protected:
|
||||
|
@ -94,13 +94,13 @@ FSinglePicFont::FSinglePicFont(const char *picname) :
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTexture *FSinglePicFont::GetChar (int code, int translation, int *const width, bool *redirected) const
|
||||
FGameTexture *FSinglePicFont::GetChar (int code, int translation, int *const width, bool *redirected) const
|
||||
{
|
||||
*width = SpaceWidth;
|
||||
if (redirected) *redirected = false;
|
||||
if (code == 'a' || code == 'A')
|
||||
{
|
||||
return TexMan.GetPalettedTexture(PicNum, true);
|
||||
return TexMan.GetGameTexture(PicNum, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "name.h"
|
||||
|
||||
class DCanvas;
|
||||
class FTexture;
|
||||
class FGameTexture;
|
||||
struct FRemapTable;
|
||||
|
||||
enum EColorRange : int
|
||||
|
@ -77,7 +77,7 @@ enum EColorRange : int
|
|||
|
||||
extern int NumTextColors;
|
||||
|
||||
using GlyphSet = TMap<int, FTexture*>;
|
||||
using GlyphSet = TMap<int, FGameTexture*>;
|
||||
|
||||
class FFont
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ public:
|
|||
FFont (const char *fontname, const char *nametemplate, const char *filetemplate, int first, int count, int base, int fdlump, int spacewidth=-1, bool notranslate = false, bool iwadonly = false, bool doomtemplate = false, GlyphSet *baseGlpyphs = nullptr);
|
||||
virtual ~FFont ();
|
||||
|
||||
virtual FTexture *GetChar (int code, int translation, int *const width, bool *redirected = nullptr) const;
|
||||
virtual FGameTexture *GetChar (int code, int translation, int *const width, bool *redirected = nullptr) const;
|
||||
virtual int GetCharWidth (int code) const;
|
||||
int GetColorTranslation (EColorRange range, PalEntry *color = nullptr) const;
|
||||
int GetLump() const { return Lump; }
|
||||
|
|
|
@ -874,3 +874,4 @@ bool FGameTexture::isUserContent() const
|
|||
int filenum = fileSystem.GetFileContainer(wrapped.GetSourceLump());
|
||||
return (filenum > fileSystem.GetMaxIwadNum());
|
||||
}
|
||||
|
||||
|
|
|
@ -24,12 +24,11 @@ public:
|
|||
private:
|
||||
int ResolveLocalizedTexture(int texnum);
|
||||
|
||||
FTexture *InternalGetTexture(int texnum, bool animate, bool localize, bool palettesubst)
|
||||
FTexture *InternalGetTexture(int texnum, bool animate, bool localize)
|
||||
{
|
||||
if ((unsigned)texnum >= Textures.Size()) return nullptr;
|
||||
if (animate) texnum = Translation[texnum];
|
||||
if (localize && Textures[texnum].HasLocalization) texnum = ResolveLocalizedTexture(texnum);
|
||||
if (palettesubst) texnum = PalCheck(texnum);
|
||||
return Textures[texnum].Texture;
|
||||
}
|
||||
public:
|
||||
|
@ -37,7 +36,7 @@ public:
|
|||
FTexture *GetTextureByName(const char *name, bool animate = false)
|
||||
{
|
||||
FTextureID texnum = GetTextureID (name, ETextureType::MiscPatch);
|
||||
return InternalGetTexture(texnum.GetIndex(), animate, true, false);
|
||||
return InternalGetTexture(texnum.GetIndex(), animate, true);
|
||||
}
|
||||
|
||||
FGameTexture* GetGameTextureByName(const char *name, bool animate = false)
|
||||
|
@ -47,23 +46,17 @@ public:
|
|||
|
||||
FTexture *GetTexture(FTextureID texnum, bool animate = false)
|
||||
{
|
||||
return InternalGetTexture(texnum.GetIndex(), animate, true, false);
|
||||
return InternalGetTexture(texnum.GetIndex(), animate, true);
|
||||
}
|
||||
|
||||
FGameTexture* GetGameTexture(FTextureID texnum, bool animate = false)
|
||||
{
|
||||
return reinterpret_cast<FGameTexture*>(GetTexture(texnum, animate));
|
||||
}
|
||||
|
||||
// This is the only access function that should be used inside the software renderer.
|
||||
FTexture *GetPalettedTexture(FTextureID texnum, bool animate)
|
||||
{
|
||||
return InternalGetTexture(texnum.GetIndex(), animate, true, true);
|
||||
}
|
||||
|
||||
FTexture *ByIndex(int i, bool animate = false)
|
||||
{
|
||||
return InternalGetTexture(i, animate, true, false);
|
||||
return InternalGetTexture(i, animate, true);
|
||||
}
|
||||
|
||||
FGameTexture* GameByIndex(int i, bool animate = false)
|
||||
|
|
|
@ -438,6 +438,7 @@ protected:
|
|||
|
||||
virtual void ResolvePatches() {}
|
||||
|
||||
public:
|
||||
void SetScale(const DVector2 &scale)
|
||||
{
|
||||
Scale = scale;
|
||||
|
@ -589,17 +590,24 @@ public:
|
|||
|
||||
bool isValid() { return wrapped.isValid(); }
|
||||
bool isWarped() { return wrapped.isWarped(); }
|
||||
bool isHardwareCanvas() const { return wrapped.isHardwareCanvas(); } // There's two here so that this can deal with software canvases in the hardware renderer later.
|
||||
bool isSoftwareCanvas() const { return wrapped.isCanvas(); }
|
||||
bool isMiscPatch() const { return wrapped.GetUseType() == ETextureType::MiscPatch; } // only used by the intermission screen to decide whether to tile the background image or not.
|
||||
bool useWorldPanning() { return wrapped.UseWorldPanning(); }
|
||||
ETextureType GetUseType() const { return wrapped.GetUseType(); }
|
||||
float GetShaderSpeed() const { return wrapped.GetShaderSpeed(); }
|
||||
uint16_t GetRotations() const { return wrapped.GetRotations(); }
|
||||
int GetSkyOffset() const { return wrapped.GetSkyOffset(); }
|
||||
FTextureID GetID() const { return wrapped.GetID(); }
|
||||
ISoftwareTexture* GetSoftwareTexture() { return wrapped.GetSoftwareTexture(); }
|
||||
void SetSoftwareTexture(ISoftwareTexture* swtex) { wrapped.SetSoftwareTextue(swtex); }
|
||||
void SetScale(DVector2 vec) { wrapped.SetScale(vec); }
|
||||
|
||||
// These substitutions must be done on the material level because their sizes can differ. Substitution must happen before any coordinate calculations take place.
|
||||
FGameTexture* GetPalVersion() { return reinterpret_cast<FGameTexture*>(wrapped.GetPalVersion()); }
|
||||
FGameTexture* GetRawTexture() { return reinterpret_cast<FGameTexture*>(wrapped.GetRawTexture()); }
|
||||
|
||||
bool isUserContent() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2724,28 +2724,12 @@ static void CheckForHacks(BuildInfo& buildinfo)
|
|||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Bool, vid_nopalsubstitutions, false, CVAR_ARCHIVE | CVAR_NOINITCALL)
|
||||
{
|
||||
// This is in case the sky texture has been substituted.
|
||||
R_InitSkyMap();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FTextureManager :: PalCheck taken out of the texture manager because it ties it to other subsystems
|
||||
// todo: move elsewhere
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
int PalCheck(int tex)
|
||||
{
|
||||
// In any true color mode this shouldn't do anything.
|
||||
if (vid_nopalsubstitutions || V_IsTrueColor()) return tex;
|
||||
FTexture *ftex = TexMan.ByIndex(tex);
|
||||
if (ftex != nullptr && ftex->GetPalVersion() != nullptr) return ftex->GetPalVersion()->GetID().GetIndex();
|
||||
return tex;
|
||||
}
|
||||
|
||||
static void Doom_CastSpriteIDToString(FString* a, unsigned int b)
|
||||
{
|
||||
*a = (b >= sprites.Size()) ? "TNT1" : sprites[b].name;
|
||||
|
|
|
@ -1464,7 +1464,7 @@ public:
|
|||
DTA_Alpha, Alpha,
|
||||
TAG_DONE);
|
||||
if (script->spacingCharacter == '\0')
|
||||
ax += width + spacing - (c->GetDisplayLeftOffsetDouble() + 1);
|
||||
ax += width + spacing - (c->GetDisplayLeftOffset() + 1);
|
||||
else //width gets changed at the call to GetChar()
|
||||
ax += font->GetCharWidth((unsigned char) script->spacingCharacter) + spacing;
|
||||
}
|
||||
|
|
|
@ -1796,7 +1796,7 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
|
|||
|
||||
dx = monospaced
|
||||
? spacing
|
||||
: width + spacing - (c->GetDisplayLeftOffsetDouble() + 1);
|
||||
: width + spacing - (c->GetDisplayLeftOffset() + 1);
|
||||
|
||||
// Take text scale into account
|
||||
x += dx * scaleX;
|
||||
|
|
|
@ -220,7 +220,7 @@ void DIntermissionScreen::Drawer ()
|
|||
}
|
||||
else
|
||||
{
|
||||
twod->AddFlatFill(0,0, twod->GetWidth(), twod->GetHeight(), TexMan.GetTexture(mBackground));
|
||||
twod->AddFlatFill(0,0, twod->GetWidth(), twod->GetHeight(), TexMan.GetGameTexture(mBackground));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -365,7 +365,7 @@ void DIntermissionScreenText::Drawer ()
|
|||
Super::Drawer();
|
||||
if (mTicker >= mTextDelay)
|
||||
{
|
||||
FTexture *pic;
|
||||
FGameTexture *pic;
|
||||
int w;
|
||||
size_t count;
|
||||
int c;
|
||||
|
|
|
@ -164,7 +164,7 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
|
|||
|
||||
if (cmd.mTexture != nullptr)
|
||||
{
|
||||
auto mat = FMaterial::ValidateTexture(cmd.mTexture, false);
|
||||
auto mat = FMaterial::ValidateTexture(cmd.mTexture->GetTexture(), false);
|
||||
if (mat == nullptr) continue;
|
||||
|
||||
state.SetMaterial(mat, cmd.mFlags & F2DDrawer::DTF_Wrap ? CLAMP_NONE : CLAMP_XY_NOMIP, cmd.mTranslationId, -1);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "swrenderer/viewport/r_walldrawer.h"
|
||||
#include "r_line.h"
|
||||
|
||||
class FTexture;
|
||||
struct FLightNode;
|
||||
struct seg_t;
|
||||
struct FLightNode;
|
||||
|
|
|
@ -7,7 +7,6 @@ struct FRenderer;
|
|||
extern FRenderer *SWRenderer;
|
||||
|
||||
class FSerializer;
|
||||
class FTexture;
|
||||
class AActor;
|
||||
class player_t;
|
||||
struct sector_t;
|
||||
|
|
|
@ -86,7 +86,7 @@ void FSoftwareRenderer::PreparePrecache(FGameTexture *ttex, int cache)
|
|||
{
|
||||
bool isbgra = V_IsTrueColor();
|
||||
|
||||
if (ttex != nullptr && ttex->isValid() && !ttex->GetTexture()->isCanvas())
|
||||
if (ttex != nullptr && ttex->isValid() && !ttex->isSoftwareCanvas())
|
||||
{
|
||||
FSoftwareTexture *tex = GetSoftwareTexture(ttex);
|
||||
|
||||
|
@ -105,7 +105,7 @@ void FSoftwareRenderer::PrecacheTexture(FGameTexture *ttex, int cache)
|
|||
{
|
||||
bool isbgra = V_IsTrueColor();
|
||||
|
||||
if (ttex != nullptr && ttex->isValid() && !ttex->GetTexture()->isCanvas())
|
||||
if (ttex != nullptr && ttex->isValid() && !ttex->isSoftwareCanvas())
|
||||
{
|
||||
FSoftwareTexture *tex = GetSoftwareTexture(ttex);
|
||||
if (cache & FTextureManager::HIT_Columnmode)
|
||||
|
|
|
@ -597,8 +597,7 @@ FSoftwareTexture* GetSoftwareTexture(FGameTexture* tex)
|
|||
FSoftwareTexture* SoftwareTexture = static_cast<FSoftwareTexture*>(tex->GetSoftwareTexture());
|
||||
if (!SoftwareTexture)
|
||||
{
|
||||
auto source = tex->GetTexture();
|
||||
if (source->isCanvas()) SoftwareTexture = new FSWCanvasTexture(tex);
|
||||
if (tex->isSoftwareCanvas()) SoftwareTexture = new FSWCanvasTexture(tex);
|
||||
else if (tex->isWarped()) SoftwareTexture = new FWarpTexture(tex, tex->isWarped());
|
||||
else SoftwareTexture = new FSoftwareTexture(tex);
|
||||
tex->SetSoftwareTexture(SoftwareTexture);
|
||||
|
@ -606,14 +605,30 @@ FSoftwareTexture* GetSoftwareTexture(FGameTexture* tex)
|
|||
return SoftwareTexture;
|
||||
}
|
||||
|
||||
|
||||
CUSTOM_CVAR(Bool, vid_nopalsubstitutions, false, CVAR_ARCHIVE | CVAR_NOINITCALL)
|
||||
{
|
||||
// This is in case the sky texture has been substituted.
|
||||
R_InitSkyMap();
|
||||
}
|
||||
|
||||
static FGameTexture* PalCheck(FGameTexture* tex)
|
||||
{
|
||||
// In any true color mode this shouldn't do anything.
|
||||
if (vid_nopalsubstitutions || V_IsTrueColor() || tex == nullptr) return tex;
|
||||
auto palvers = tex->GetPalVersion();
|
||||
if (palvers) return palvers;
|
||||
return tex;
|
||||
}
|
||||
|
||||
FSoftwareTexture* GetPalettedSWTexture(FTextureID texid, bool animate, FLevelLocals *checkcompat, bool allownull)
|
||||
{
|
||||
auto tex = TexMan.GetPalettedTexture(texid, true);
|
||||
auto tex = PalCheck(TexMan.GetGameTexture(texid, true));
|
||||
if (checkcompat && tex && tex->isValid() && checkcompat->i_compatflags & COMPATF_MASKEDMIDTEX)
|
||||
{
|
||||
tex = tex->GetRawTexture();
|
||||
}
|
||||
FSoftwareTexture* pic = tex && (allownull || tex->isValid()) ? GetSoftwareTexture(reinterpret_cast<FGameTexture*>(tex)) : nullptr;
|
||||
FSoftwareTexture* pic = tex && (allownull || tex->isValid()) ? GetSoftwareTexture(tex) : nullptr;
|
||||
return pic;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue