mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- wrap the va_list that gets passed around by the Draw functions into a struct so that the templates can use reliable, identical semantics for both this and the VM's arg list.
This commit is contained in:
parent
a4dbbf6969
commit
d90f2ba1fa
3 changed files with 25 additions and 20 deletions
|
@ -129,12 +129,12 @@ static int PalFromRGB(uint32 rgb)
|
||||||
|
|
||||||
void DCanvas::DrawTexture (FTexture *img, double x, double y, int tags_first, ...)
|
void DCanvas::DrawTexture (FTexture *img, double x, double y, int tags_first, ...)
|
||||||
{
|
{
|
||||||
va_list tags;
|
Va_List tags;
|
||||||
va_start(tags, tags_first);
|
va_start(tags.list, tags_first);
|
||||||
DrawParms parms;
|
DrawParms parms;
|
||||||
|
|
||||||
bool res = ParseDrawTextureTags(img, x, y, tags_first, tags, &parms, false);
|
bool res = ParseDrawTextureTags(img, x, y, tags_first, tags, &parms, false);
|
||||||
va_end(tags);
|
va_end(tags.list);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -457,30 +457,30 @@ bool DCanvas::SetTextureParms(DrawParms *parms, FTexture *img, double xx, double
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ListEnd(va_list &tags)
|
static void ListEnd(Va_List &tags)
|
||||||
{
|
{
|
||||||
va_end(tags);
|
va_end(tags.list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ListGetInt(va_list &tags)
|
static int ListGetInt(Va_List &tags)
|
||||||
{
|
{
|
||||||
return va_arg(tags, int);
|
return va_arg(tags.list, int);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline double ListGetDouble(va_list &tags)
|
static inline double ListGetDouble(Va_List &tags)
|
||||||
{
|
{
|
||||||
return va_arg(tags, double);
|
return va_arg(tags.list, double);
|
||||||
}
|
}
|
||||||
|
|
||||||
// These two options are only being used by the D3D version of the HUD weapon drawer, they serve no purpose anywhere else.
|
// These two options are only being used by the D3D version of the HUD weapon drawer, they serve no purpose anywhere else.
|
||||||
static inline FSpecialColormap * ListGetSpecialColormap(va_list &tags)
|
static inline FSpecialColormap * ListGetSpecialColormap(Va_List &tags)
|
||||||
{
|
{
|
||||||
return va_arg(tags, FSpecialColormap *);
|
return va_arg(tags.list, FSpecialColormap *);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline FColormapStyle * ListGetColormapStyle(va_list &tags)
|
static inline FColormapStyle * ListGetColormapStyle(Va_List &tags)
|
||||||
{
|
{
|
||||||
return va_arg(tags, FColormapStyle *);
|
return va_arg(tags.list, FColormapStyle *);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ListEnd(VMVa_List &tags)
|
static void ListEnd(VMVa_List &tags)
|
||||||
|
@ -946,7 +946,7 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag,
|
||||||
}
|
}
|
||||||
// explicitly instantiate both versions for v_text.cpp.
|
// explicitly instantiate both versions for v_text.cpp.
|
||||||
|
|
||||||
template bool DCanvas::ParseDrawTextureTags<va_list>(FTexture *img, double x, double y, DWORD tag, va_list& tags, DrawParms *parms, bool fortext) const;
|
template bool DCanvas::ParseDrawTextureTags<Va_List>(FTexture *img, double x, double y, DWORD tag, Va_List& tags, DrawParms *parms, bool fortext) const;
|
||||||
template bool DCanvas::ParseDrawTextureTags<VMVa_List>(FTexture *img, double x, double y, DWORD tag, VMVa_List& tags, DrawParms *parms, bool fortext) const;
|
template bool DCanvas::ParseDrawTextureTags<VMVa_List>(FTexture *img, double x, double y, DWORD tag, VMVa_List& tags, DrawParms *parms, bool fortext) const;
|
||||||
|
|
||||||
void DCanvas::VirtualToRealCoords(double &x, double &y, double &w, double &h,
|
void DCanvas::VirtualToRealCoords(double &x, double &y, double &w, double &h,
|
||||||
|
|
|
@ -71,10 +71,10 @@ void DCanvas::DrawChar (FFont *font, int normalcolor, double x, double y, int ch
|
||||||
if (NULL != (pic = font->GetChar (character, &dummy)))
|
if (NULL != (pic = font->GetChar (character, &dummy)))
|
||||||
{
|
{
|
||||||
DrawParms parms;
|
DrawParms parms;
|
||||||
va_list tags;
|
Va_List tags;
|
||||||
va_start(tags, tag_first);
|
va_start(tags.list, tag_first);
|
||||||
bool res = ParseDrawTextureTags(pic, x, y, tag_first, tags, &parms, false);
|
bool res = ParseDrawTextureTags(pic, x, y, tag_first, tags, &parms, false);
|
||||||
va_end(tags);
|
va_end(tags.list);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -197,15 +197,15 @@ void DCanvas::DrawTextCommon(FFont *font, int normalcolor, double x, double y, c
|
||||||
|
|
||||||
void DCanvas::DrawText(FFont *font, int normalcolor, double x, double y, const char *string, int tag_first, ...)
|
void DCanvas::DrawText(FFont *font, int normalcolor, double x, double y, const char *string, int tag_first, ...)
|
||||||
{
|
{
|
||||||
va_list tags;
|
Va_List tags;
|
||||||
DrawParms parms;
|
DrawParms parms;
|
||||||
|
|
||||||
if (font == NULL || string == NULL)
|
if (font == NULL || string == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
va_start(tags, tag_first);
|
va_start(tags.list, tag_first);
|
||||||
bool res = ParseDrawTextureTags(nullptr, 0, 0, tag_first, tags, &parms, true);
|
bool res = ParseDrawTextureTags(nullptr, 0, 0, tag_first, tags, &parms, true);
|
||||||
va_end(tags);
|
va_end(tags.list);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -177,6 +177,11 @@ struct DrawParms
|
||||||
bool virtBottom;
|
bool virtBottom;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Va_List
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
};
|
||||||
|
|
||||||
struct VMVa_List
|
struct VMVa_List
|
||||||
{
|
{
|
||||||
VMValue *args;
|
VMValue *args;
|
||||||
|
|
Loading…
Reference in a new issue