- transitioned the 2D drawer to FGameTexture.
This commit is contained in:
parent
d9928b51a8
commit
9e7094848c
21 changed files with 135 additions and 153 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue