- Some ugly hackery to try to make it more compatible.

This commit is contained in:
drfrag 2019-04-23 21:24:10 +02:00
parent da5c1c90dc
commit e5f7bf068c
5 changed files with 38 additions and 4 deletions

View file

@ -1947,6 +1947,18 @@ DEFINE_ACTION_FUNCTION_NATIVE(FFont, StringWidth, StringWidth)
ACTION_RETURN_INT(StringWidth(self, str));
}
static int CanPrint(FFont *font, const FString &str) // hack hack
{
return 0;
}
DEFINE_ACTION_FUNCTION_NATIVE(FFont, CanPrint, CanPrint)
{
PARAM_SELF_STRUCT_PROLOGUE(FFont);
PARAM_STRING(str);
ACTION_RETURN_INT(CanPrint(self, str));
}
static int FindFontColor(int name)
{
return V_FindFontColor(ENamedName(name));

View file

@ -3661,7 +3661,13 @@ void V_InitFonts()
{
BigFont = SmallFont;
}
// hack hack
NewConsoleFont = ConFont;
NewSmallFont = SmallFont;
AlternativeSmallFont = SmallFont;
OriginalSmallFont = SmallFont;
OriginalBigFont = BigFont;
}
void V_ClearFonts()
@ -3671,6 +3677,6 @@ void V_ClearFonts()
delete FFont::FirstFont;
}
FFont::FirstFont = NULL;
SmallFont = SmallFont2 = BigFont = ConFont = IntermissionFont = NULL;
AlternativeSmallFont = OriginalBigFont = OriginalSmallFont = CurrentConsoleFont = NewSmallFont = NewConsoleFont = SmallFont = SmallFont2 = BigFont = ConFont = IntermissionFont = nullptr;
}

View file

@ -113,6 +113,8 @@ public:
inline int StringWidth (const char *str) const { return StringWidth ((const uint8_t *)str); }
inline int StringWidth (const FString &str) const { return StringWidth ((const uint8_t *)str.GetChars()); }
inline bool CanPrint(const uint8_t *str) const { return false; } // hack hack
int GetCharCode(int code, bool needpic) const;
char GetCursor() const { return Cursor; }
void SetCursor(char c) { Cursor = c; }
@ -158,7 +160,7 @@ protected:
};
extern FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont;
extern FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *NewSmallFont, *CurrentConsoleFont, *OriginalSmallFont, *AlternativeSmallFont, *OriginalBigFont;
void V_InitFonts();
void V_ClearFonts();

View file

@ -155,7 +155,7 @@ const FTexture::Span FPaletteTester::DummySpan[2] = { { 0, 16 }, { 0, 0 } };
int DisplayWidth, DisplayHeight, DisplayBits;
FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont;
FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *NewSmallFont, *CurrentConsoleFont, *OriginalSmallFont, *AlternativeSmallFont, *OriginalBigFont;
uint32_t Col2RGB8[65][256];
uint32_t *Col2RGB8_LessPrecision[65];
@ -211,6 +211,7 @@ bool setmodeneeded = false;
// [RH] Resolution to change to when setmodeneeded is true
int NewWidth, NewHeight, NewBits;
bool generic_ui = false; // hack hack
//==========================================================================
//
@ -1713,6 +1714,11 @@ DEFINE_GLOBAL(SmallFont)
DEFINE_GLOBAL(SmallFont2)
DEFINE_GLOBAL(BigFont)
DEFINE_GLOBAL(ConFont)
DEFINE_GLOBAL(NewConsoleFont)
DEFINE_GLOBAL(NewSmallFont)
DEFINE_GLOBAL(AlternativeSmallFont)
DEFINE_GLOBAL(OriginalSmallFont)
DEFINE_GLOBAL(OriginalBigFont)
DEFINE_GLOBAL(IntermissionFont)
DEFINE_GLOBAL(CleanXfac)
DEFINE_GLOBAL(CleanYfac)
@ -1722,3 +1728,4 @@ DEFINE_GLOBAL(CleanXfac_1)
DEFINE_GLOBAL(CleanYfac_1)
DEFINE_GLOBAL(CleanWidth_1)
DEFINE_GLOBAL(CleanHeight_1)
DEFINE_GLOBAL(generic_ui)

View file

@ -25,6 +25,11 @@ struct _ native // These are the global variables, the struct is only here to av
native readonly Font smallfont2;
native readonly Font bigfont;
native readonly Font confont;
native readonly Font NewConsoleFont;
native readonly Font NewSmallFont;
native readonly Font AlternativeSmallFont;
native readonly Font OriginalSmallFont;
native readonly Font OriginalBigFont;
native readonly Font intermissionfont;
native readonly int CleanXFac;
native readonly int CleanYFac;
@ -46,6 +51,7 @@ struct _ native // These are the global variables, the struct is only here to av
native int LocalViewPitch;
deprecated("3.8") native readonly bool globalfreeze;
native readonly @MusPlayingInfo musplaying;
native readonly bool generic_ui;
}
@ -299,6 +305,7 @@ struct Font native
native int GetCharWidth(int code);
native int StringWidth(String code);
native bool CanPrint(String code);
native int GetHeight();
native String GetCursor();