From 21a6ed247b42357e958f56b81161a79e297ecf25 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 16 Jan 2021 16:06:11 +0200 Subject: Use of sized bool types for CFont --- src/render/Font.h | 111 ++++++++++++++++++------------------------------------ 1 file changed, 36 insertions(+), 75 deletions(-) (limited to 'src/render/Font.h') diff --git a/src/render/Font.h b/src/render/Font.h index 36424bf5..4b2dda2b 100644 --- a/src/render/Font.h +++ b/src/render/Font.h @@ -14,28 +14,28 @@ struct CFontDetails float slant; float slantRefX; float slantRefY; - bool justify; - bool centre; - bool rightJustify; - bool background; - bool backgroundOnlyText; - bool proportional; - bool bIsShadow; - bool bFlash; - bool bBold; + bool8 justify; + bool8 centre; + bool8 rightJustify; + bool8 background; + bool8 backgroundOnlyText; + bool8 proportional; + bool8 bIsShadow; + bool8 bFlash; + bool8 bBold; float alphaFade; CRGBA backgroundColor; float wrapX; float centreSize; float rightJustifyWrap; int16 style; - bool bFontHalfTexture; + bool8 bFontHalfTexture; uint32 bank; int16 dropShadowPosition; CRGBA dropColor; - bool bFlashState; + bool8 bFlashState; int nFlashTimer; - bool anonymous_23; + bool8 anonymous_23; uint32 anonymous_25; }; @@ -51,10 +51,10 @@ struct CFontRenderState float slant; float slantRefX; float slantRefY; - bool bIsShadow; - bool bFontHalfTexture; - bool proportional; - bool anonymous_14; + bool8 bIsShadow; + bool8 bFontHalfTexture; + bool8 proportional; + bool8 anonymous_14; int16 style; }; @@ -168,72 +168,33 @@ public: static uint16 *ParseToken(wchar *s, bool japShit = false); #else static uint16 *ParseToken(wchar *s); - static uint16* ParseToken(wchar *s, CRGBA &color, bool &flash, bool &bold); + static uint16 *ParseToken(wchar *s, CRGBA &color, bool &flash, bool &bold); #endif static void DrawFonts(void); static void RenderFontBuffer(void); static uint16 character_code(uint8 c); - static CFontDetails GetDetails() { return Details; } static void SetScale(float x, float y); - static void SetSlantRefPoint(float x, float y) { Details.slantRefX = x; Details.slantRefY = y; } - static void SetSlant(float s) { Details.slant = s; } - static void SetJustifyOn(void) { - Details.justify = true; - Details.centre = false; - Details.rightJustify = false; - } - static void SetJustifyOff(void) { - Details.justify = false; - Details.rightJustify = false; - } - static void SetRightJustifyOn(void) { - Details.rightJustify = true; - Details.justify = false; - Details.centre = false; - } - static void SetRightJustifyOff(void) { - Details.rightJustify = false; - Details.justify = false; - Details.centre = false; - } - static void SetCentreOn(void) { - Details.centre = true; - Details.justify = false; - Details.rightJustify = false; - } - static void SetCentreOff(void) { - Details.centre = false; - } - static void SetAlignment(uint8 alignment) { - if (alignment == ALIGN_LEFT) { - CFont::Details.justify = true; - CFont::Details.centre = false; - CFont::Details.rightJustify = false; - } - else if (alignment == ALIGN_CENTER) { - CFont::Details.justify = false; - CFont::Details.centre = true; - CFont::Details.rightJustify = false; - } - else if (alignment == ALIGN_RIGHT) { - CFont::Details.justify = false; - CFont::Details.centre = false; - CFont::Details.rightJustify = true; - } - } - static void SetWrapx(float x) { Details.wrapX = x; } - static void SetCentreSize(float s) { Details.centreSize = s; } - static void SetBackgroundOn(void) { Details.background = true; } - static void SetBackgroundOff(void) { Details.background = false; } - static void SetBackGroundOnlyTextOn(void) { Details.backgroundOnlyText = true; } - static void SetBackGroundOnlyTextOff(void) { Details.backgroundOnlyText = false; } - static void SetPropOn(void) { Details.proportional = true; } - static void SetPropOff(void) { Details.proportional = false; } + static void SetSlantRefPoint(float x, float y); + static void SetSlant(float s); + static void SetJustifyOn(void); + static void SetJustifyOff(void); + static void SetRightJustifyOn(void); + static void SetRightJustifyOff(void); + static void SetCentreOn(void); + static void SetCentreOff(void); + static void SetWrapx(float x); + static void SetCentreSize(float s); + static void SetBackgroundOn(void); + static void SetBackgroundOff(void); + static void SetBackGroundOnlyTextOn(void); + static void SetBackGroundOnlyTextOff(void); + static void SetPropOn(void); + static void SetPropOff(void); static void SetFontStyle(int16 style); - static void SetRightJustifyWrap(float wrap) { Details.rightJustifyWrap = wrap; } - static void SetAlphaFade(float fade) { Details.alphaFade = fade; } - static void SetDropShadowPosition(int16 pos) { Details.dropShadowPosition = pos; } + static void SetRightJustifyWrap(float wrap); + static void SetAlphaFade(float fade); + static void SetDropShadowPosition(int16 pos); static void SetBackgroundColor(CRGBA col); static void SetColor(CRGBA col); static void SetDropColor(CRGBA col); -- cgit v1.2.3