- moved all exports from class Font to vmthunks.cpp and gave them direct native entrypoints.

- changed PARAM_STRING to use the passed string by reference instead of by value. The 3 instances where passing by value was needed now use PARAM_STRING_VAL.
This commit is contained in:
Christoph Oelckers 2018-12-01 10:29:23 +01:00
commit a7e472b4b3
7 changed files with 142 additions and 53 deletions

View file

@ -336,14 +336,6 @@ FFont *V_GetFont(const char *name)
return font;
}
DEFINE_ACTION_FUNCTION(FFont, GetFont)
{
PARAM_PROLOGUE;
PARAM_NAME(name);
ACTION_RETURN_POINTER(V_GetFont(name.GetChars()));
}
//==========================================================================
//
// FFont :: FFont
@ -528,13 +520,6 @@ FFont *FFont::FindFont (FName name)
return nullptr;
}
DEFINE_ACTION_FUNCTION(FFont, FindFont)
{
PARAM_PROLOGUE;
PARAM_NAME(name);
ACTION_RETURN_POINTER(FFont::FindFont(name));
}
//==========================================================================
//
// RecordTextureColors
@ -856,17 +841,21 @@ int FFont::GetCharWidth (int code) const
return (code < 0) ? SpaceWidth : Chars[code - FirstChar].XMove;
}
DEFINE_ACTION_FUNCTION(FFont, GetCharWidth)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
PARAM_INT(code);
ACTION_RETURN_INT(self->GetCharWidth(code));
}
//==========================================================================
//
//
//
//==========================================================================
DEFINE_ACTION_FUNCTION(FFont, GetHeight)
double GetBottomAlignOffset(FFont *font, int c)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
ACTION_RETURN_INT(self->GetHeight());
int w;
FTexture *tex_zero = font->GetChar('0', &w);
FTexture *texc = font->GetChar(c, &w);
double offset = 0;
if (texc) offset += texc->GetScaledTopOffsetDouble(0);
if (tex_zero) offset += -tex_zero->GetScaledTopOffsetDouble(0) + tex_zero->GetScaledHeightDouble();
return offset;
}
//==========================================================================
@ -914,15 +903,6 @@ int FFont::StringWidth(const uint8_t *string) const
return MAX(maxw, w);
}
DEFINE_ACTION_FUNCTION(FFont, StringWidth)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
PARAM_STRING(str);
const char *txt = str[0] == '$' ? GStrings(&str[1]) : str.GetChars();
ACTION_RETURN_INT(self->StringWidth(txt));
}
//==========================================================================
//
// FFont :: LoadTranslations
@ -2540,13 +2520,6 @@ EColorRange V_FindFontColor (FName name)
return CR_UNTRANSLATED;
}
DEFINE_ACTION_FUNCTION(FFont, FindFontColor)
{
PARAM_PROLOGUE;
PARAM_NAME(code);
ACTION_RETURN_INT((int)V_FindFontColor(code));
}
//==========================================================================
//
// V_LogColorFromColorRange
@ -2721,8 +2694,3 @@ void V_ClearFonts()
SmallFont = SmallFont2 = BigFont = ConFont = IntermissionFont = NULL;
}
DEFINE_ACTION_FUNCTION(FFont, GetCursor)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
ACTION_RETURN_STRING(FString(self->GetCursor()));
}