summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/Frontend.cpp79
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/main.cpp4
-rw-r--r--src/fakerw/fake.cpp9
-rw-r--r--src/fakerw/rpanisot.h6
-rw-r--r--src/peds/PedAI.cpp1
-rw-r--r--src/render/Font.cpp932
-rw-r--r--src/render/Font.h27
-rw-r--r--src/rw/TexRead.cpp11
9 files changed, 417 insertions, 653 deletions
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 42acd25f..652b9db7 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -40,16 +40,16 @@
#include "User.h"
#include "sampman.h"
-// --MIAMI: file done
+// --LCS: changed a bit to have lcs feel, needs more work
// Similar story to Hud.cpp:
// Game has colors inlined in code.
// For easier modification we collect them here:
-const CRGBA LABEL_COLOR(255, 150, 225, 255);
+const CRGBA LABEL_COLOR(115, 173, 216, 255);
const CRGBA SELECTIONBORDER_COLOR(25, 130, 70, 255);
const CRGBA MENUOPTION_COLOR = LABEL_COLOR;
-const CRGBA SELECTEDMENUOPTION_COLOR = LABEL_COLOR;
-const CRGBA HEADER_COLOR = LABEL_COLOR;
+const CRGBA SELECTEDMENUOPTION_COLOR(255, 255, 255, 255);
+const CRGBA HEADER_COLOR(197, 0, 0, 255);
const CRGBA DARKMENUOPTION_COLOR(195, 90, 165, 255);
const CRGBA SLIDERON_COLOR(97, 194, 247, 255);
const CRGBA SLIDEROFF_COLOR(27, 89, 130, 255);
@@ -195,7 +195,7 @@ wchar* CMenuManager::m_pDialogText = nil;
#endif
#define SET_FONT_FOR_MENU_HEADER \
- CFont::SetRightJustifyOn(); \
+ CFont::SetRightJustifyOff(); \
CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING)); \
CFont::SetScale(MENU_X(MENUHEADER_WIDTH), MENU_Y(MENUHEADER_HEIGHT)); \
CFont::SetDropShadowPosition(0);
@@ -932,11 +932,11 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
if (aScreens[m_nCurrScreen].m_ScreenName[0] != '\0') {
SET_FONT_FOR_MENU_HEADER
- CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255)));
- CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
+ //CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255)));
+ //CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255)));
- CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
+ CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get(aScreens[m_nCurrScreen].m_ScreenName));
}
// Label
@@ -1016,11 +1016,14 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE));
CFont::SetDropShadowPosition(0);
} else {
- CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
+ CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
CFont::SetDropShadowPosition(2);
CFont::SetDropColor(CRGBA(0, 0, 0, FadeIn(255)));
- CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255)));
+ if (i == m_nCurrOption && itemsAreSelectable)
+ CFont::SetColor(CRGBA(SELECTEDMENUOPTION_COLOR.r, SELECTEDMENUOPTION_COLOR.g, SELECTEDMENUOPTION_COLOR.b, FadeIn(255)));
+ else
+ CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255)));
}
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Align == MENUALIGN_LEFT) {
CFont::SetCentreOff();
@@ -1361,7 +1364,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
// Actually bottomRight and bottomLeft should be exchanged here(although this is original code).
// So this shows us either R* didn't use same struct for menu BG and highlight, or they just kept fields as x1,y1 etc. Yikes.
- if (m_nOptionHighlightTransitionBlend == 0) {
+ /*if (m_nOptionHighlightTransitionBlend == 0) {
if (m_firstStartCounter == 255 && m_nMenuFadeAlpha == 255 && !bMenuChangeOngoing) {
CSprite2d::Draw2DPolygon(MENU_X_LEFT_ALIGNED(menuOptionHighlight.topLeft_x), MENU_Y(menuOptionHighlight.topLeft_y),
MENU_X_LEFT_ALIGNED(menuOptionHighlight.topRight_x), MENU_Y(menuOptionHighlight.topRight_y),
@@ -1397,7 +1400,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
MENU_X_LEFT_ALIGNED(menuOptionHighlight.bottomRight_x), MENU_Y(menuOptionHighlight.bottomRight_y),
MENU_X_LEFT_ALIGNED(menuOptionHighlight.bottomLeft_x), MENU_Y(menuOptionHighlight.bottomLeft_y), SELECTIONBORDER_COLOR);
}
- }
+ }*/
static PauseModeTime lastBlendChange = 0;
if (m_nOptionHighlightTransitionBlend <= 255) {
@@ -1427,7 +1430,7 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(MEDIUMTEXT_X_SCALE), MENU_Y(MEDIUMTEXT_Y_SCALE));
} else {
- CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
+ CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
}
CFont::PrintString(MENU_X_LEFT_ALIGNED(DEFAULT_SCREEN_WIDTH - RIGHT_ALIGNED_TEXT_RIGHT_MARGIN(xMargin)), MENU_Y(aScreens[m_nCurrScreen].m_aEntries[i].m_Y MINUS_SCROLL_OFFSET), rightText);
@@ -2000,18 +2003,18 @@ CMenuManager::DrawControllerSetupScreen()
// Shadow
CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255)));
- if (m_ControlMethod == CONTROL_STANDARD)
- CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_STI"));
- else if (m_ControlMethod == CONTROL_CLASSIC)
- CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_CTI"));
+ //if (m_ControlMethod == CONTROL_STANDARD)
+ // CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_STI"));
+ //else if (m_ControlMethod == CONTROL_CLASSIC)
+ // CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_CTI"));
// Real header
CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255)));
if (m_ControlMethod == CONTROL_STANDARD)
- CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_STI"));
+ CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_STI"));
else if (m_ControlMethod == CONTROL_CLASSIC)
- CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_CTI"));
+ CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_CTI"));
wchar *actionTexts[33];
actionTexts[0] = TheText.Get("FEC_FIR");
@@ -2164,7 +2167,7 @@ CMenuManager::DrawControllerSetupScreen()
}
// Back button and it's shadow
- CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
+ CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
CFont::SetRightJustifyOn();
CFont::SetDropShadowPosition(2);
@@ -2223,7 +2226,7 @@ CMenuManager::DrawBackground(bool transitionCall)
PrintMap();
// Left border
- CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT,
+ /*CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT,
SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), 0.0f, 0.0f, CRGBA(0, 0, 0, 255));
// Top border
@@ -2236,7 +2239,7 @@ CMenuManager::DrawBackground(bool transitionCall)
// Right border
CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y),
- SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255));
+ SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255));*/
} else {
m_nMenuFadeAlpha = 255;
m_firstStartCounter = 255;
@@ -2245,7 +2248,7 @@ CMenuManager::DrawBackground(bool transitionCall)
PrintMap();
// Left border
- CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT,
+ /*CSprite2d::Draw2DPolygon(SCREEN_STRETCH_X(menuBg.bottomLeft_x), SCREEN_STRETCH_Y(menuBg.bottomLeft_y), 0.0f, SCREEN_HEIGHT,
SCREEN_STRETCH_X(menuBg.topLeft_x), SCREEN_STRETCH_Y(menuBg.topLeft_y), 0.0f, 0.0f, CRGBA(0, 0, 0, 255));
// Top border
@@ -2258,7 +2261,7 @@ CMenuManager::DrawBackground(bool transitionCall)
// Right border
CSprite2d::Draw2DPolygon(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_STRETCH_X(menuBg.bottomRight_x), SCREEN_STRETCH_Y(menuBg.bottomRight_y),
- SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255));
+ SCREEN_WIDTH, 0.0f, SCREEN_STRETCH_X(menuBg.topRight_x), SCREEN_STRETCH_Y(menuBg.topRight_y), CRGBA(0, 0, 0, 255));*/
}
} else {
menuBg.SaveCurrentCoors();
@@ -2350,9 +2353,9 @@ CMenuManager::DrawBackground(bool transitionCall)
|| forceFadeInCounter > 30
#endif
) {
- m_nMenuFadeAlpha += 20;
+ m_nMenuFadeAlpha += 50;
if (m_firstStartCounter < 255) {
- m_firstStartCounter = Min(m_firstStartCounter + 20, 255);
+ m_firstStartCounter = Min(m_firstStartCounter + 50, 255);
}
LastFade = CTimer::GetTimeInMillisecondsPauseMode();
}
@@ -2404,12 +2407,12 @@ CMenuManager::DrawBackground(bool transitionCall)
CFont::DrawFonts();
SetFrontEndRenderStates();
- if (m_nCurrScreen != MENUPAGE_OUTRO)
- if (m_firstStartCounter == 255) {
- m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255));
- } else {
- m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, FadeIn(255)));
- }
+ //if (m_nCurrScreen != MENUPAGE_OUTRO)
+ // if (m_firstStartCounter == 255) {
+ // m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255));
+ // } else {
+ // m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(SCREEN_STRETCH_X(27.0f), MENU_Y(8.0f), SCREEN_STRETCH_X(27.0f) + MENU_X(130.f), MENU_Y(138.0f)), CRGBA(255, 255, 255, FadeIn(255)));
+ // }
if (m_ShowEmptyBindingError) {
static PauseModeTime lastBindingError = CTimer::GetTimeInMillisecondsPauseMode();
@@ -2528,11 +2531,11 @@ CMenuManager::DrawPlayerSetupScreen(bool activeScreen)
MENU_X_RIGHT_ALIGNED(PLAYERSETUP_LIST_RIGHT), SCREEN_SCALE_FROM_BOTTOM(PLAYERSETUP_LIST_BOTTOM)), CRGBA(LIST_BACKGROUND_COLOR.r, LIST_BACKGROUND_COLOR.g, LIST_BACKGROUND_COLOR.b, FadeIn(LIST_BACKGROUND_COLOR.a)));
SET_FONT_FOR_MENU_HEADER
- CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255)));
- CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_PS"));
+ //CFont::SetColor(CRGBA(30, 30, 30, FadeIn(255)));
+ //CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X) - MENU_X(7.f), SCREEN_SCALE_Y(MENUHEADER_POS_Y + 7.f), TheText.Get("FET_PS"));
CFont::SetColor(CRGBA(HEADER_COLOR.r, HEADER_COLOR.g, HEADER_COLOR.b, FadeIn(255)));
- CFont::PrintString(SCREEN_STRETCH_FROM_RIGHT(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_PS"));
+ CFont::PrintString(SCREEN_STRETCH_X(MENUHEADER_POS_X), SCREEN_SCALE_Y(MENUHEADER_POS_Y), TheText.Get("FET_PS"));
// Header (Skin - Date)
if (m_nCurrExLayer == HOVEROPTION_LIST) {
@@ -2712,7 +2715,7 @@ CMenuManager::DrawPlayerSetupScreen(bool activeScreen)
// Big apply button
if (strcmp(m_aSkinName, m_PrefsSkinFile) != 0) {
- CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
+ CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
switch (m_PrefsLanguage) {
case LANGUAGE_FRENCH:
CFont::SetScale(MENU_X(1.1f), MENU_Y(1.9f));
@@ -2732,7 +2735,7 @@ CMenuManager::DrawPlayerSetupScreen(bool activeScreen)
CFont::SetRightJustifyOff();
CFont::PrintString(MENU_X_LEFT_ALIGNED(24.0f), MENU_Y(220.0f), TheText.Get("FET_APP"));
}
- CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
+ CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
@@ -2804,7 +2807,7 @@ CMenuManager::DrawPlayerSetupScreen(bool activeScreen)
m_nHoverOption = HOVEROPTION_NOT_HOVERING;
}
}
- CFont::SetFontStyle(FONT_LOCALE(FONT_HEADING));
+ CFont::SetFontStyle(FONT_LOCALE(FONT_STANDARD));
CFont::SetScale(MENU_X(BIGTEXT_X_SCALE), MENU_Y(BIGTEXT_Y_SCALE));
CFont::SetRightJustifyOn();
CFont::SetColor(CRGBA(MENUOPTION_COLOR.r, MENUOPTION_COLOR.g, MENUOPTION_COLOR.b, FadeIn(255)));
diff --git a/src/core/config.h b/src/core/config.h
index 58bc9ffd..02356e6e 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -265,6 +265,7 @@ enum Config {
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
//#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time
#define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync
+#define ANISOTROPIC_FILTERING // set all textures to max anisotropic filtering
//#define USE_TEXTURE_POOL
#ifdef LIBRW
#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 5d18c5fa..bbfb588c 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -3,7 +3,7 @@
#include "rphanim.h"
#include "rpskin.h"
#include "rtbmp.h"
-#ifndef LIBRW
+#ifdef ANISOTROPIC_FILTERING
#include "rpanisot.h"
#endif
@@ -406,7 +406,7 @@ PluginAttach(void)
return FALSE;
}
-#ifndef LIBRW
+#ifdef ANISOTROPIC_FILTERING
RpAnisotPluginAttach();
#endif
#ifdef EXTENDED_PIPELINES
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp
index 835cb849..768c11f4 100644
--- a/src/fakerw/fake.cpp
+++ b/src/fakerw/fake.cpp
@@ -967,3 +967,12 @@ RtCharset *RtCharsetSetColors(RtCharset * charSet, const RwRGBA * foreGround,
RtCharset *RtCharsetGetDesc(RtCharset * charset, RtCharsetDesc * desc) { *desc = charset->desc; return charset; }
RtCharset *RtCharsetCreate(const RwRGBA * foreGround, const RwRGBA * backGround) { return Charset::create(foreGround, backGround); }
RwBool RtCharsetDestroy(RtCharset * charSet) { charSet->destroy(); return true; }
+
+
+
+#include <rpanisot.h>
+
+RwInt8 RpAnisotGetMaxSupportedMaxAnisotropy(void) { return rw::getMaxSupportedMaxAnisotropy(); }
+RwTexture *RpAnisotTextureSetMaxAnisotropy(RwTexture *tex, RwInt8 val) { tex->setMaxAnisotropy(val); return tex; }
+RwInt8 RpAnisotTextureGetMaxAnisotropy(RwTexture *tex) { return tex->getMaxAnisotropy(); }
+RwBool RpAnisotPluginAttach(void) { rw::registerAnisotropyPlugin(); return true; }
diff --git a/src/fakerw/rpanisot.h b/src/fakerw/rpanisot.h
new file mode 100644
index 00000000..a886512f
--- /dev/null
+++ b/src/fakerw/rpanisot.h
@@ -0,0 +1,6 @@
+#pragma once
+
+RwInt8 RpAnisotGetMaxSupportedMaxAnisotropy(void);
+RwTexture *RpAnisotTextureSetMaxAnisotropy(RwTexture *tex, RwInt8 val);
+RwInt8 RpAnisotTextureGetMaxAnisotropy(RwTexture *tex);
+RwBool RpAnisotPluginAttach(void);
diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp
index a28ded8c..cd1befd9 100644
--- a/src/peds/PedAI.cpp
+++ b/src/peds/PedAI.cpp
@@ -6334,7 +6334,6 @@ CPed::PositionAnyPedOutOfCollision(void)
int smallestDistNearVeh = 999;
int smallestDistSomewhereClose = 999;
- CVector vehPos = m_pMyVehicle->GetPosition();
CVector potentialPos;
potentialPos.y = GetPosition().y - 3.5f;
potentialPos.z = GetPosition().z;
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index de1ee8b4..b559ca7a 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -1,5 +1,6 @@
#include "common.h"
+#include "main.h"
#include "Sprite2d.h"
#include "TxdStore.h"
#include "Font.h"
@@ -7,6 +8,9 @@
#include "FileMgr.h"
#endif
#include "Timer.h"
+#include "Frontend.h"
+
+//--LCS: todo scaling (needs CSprite2d reversed), SuspendHandler, ReplaceGermanSZ, volatile mem, other todos
void
AsciiToUnicode(const char *src, wchar *dst)
@@ -49,157 +53,48 @@ UnicodeMakeUpperCase(wchar *dst, const wchar *src) //idk what to do with it, see
}
CFontDetails CFont::Details;
-int16 CFont::NewLine;
+bool16 CFont::NewLine;
CSprite2d CFont::Sprite[MAX_FONTS];
CFontRenderState CFont::RenderState;
-#ifdef MORE_LANGUAGES
-uint8 CFont::LanguageSet = FONT_LANGSET_EFIGS;
-int32 CFont::Slot = -1;
-#define JAP_TERMINATION (0x8000 | '~')
-
-int16 CFont::Size[LANGSET_MAX][MAX_FONTS][210] = {
- {
-#else
-int16 CFont::Size[MAX_FONTS][210] = {
-#endif
- {
- 12, 9, 22, 17, 19, 19, 25, 4, 33, 33, 25, 35, 11, 10, 6, 33, 18, 10, 17, 17, 17, 17, 17, 15, 12, 16, 5, 30, 30, 30, 30, 30, 12, 16, 19,
- 16, 19, 18, 18, 17, 22, 11, 17, 18, 18, 30, 22, 19, 22, 19, 19, 20, 18, 19, 19, 29, 19, 18, 19, 19, 33, 33, 19, 19, 12, 14, 11, 11, 16, 11,
- 12, 14, 14, 10, 13, 12, 10, 19, 18, 12, 16, 13, 13, 11, 12, 15, 12, 15, 13, 12, 12, 37, 33, 37, 35, 37, 16, 16, 16, 16, 33, 17, 18, 18, 18,
- 18, 11, 11, 11, 11, 19, 19, 19, 19, 19, 19, 19, 19, 15, 14, 14, 14, 14, 20, 14, 11, 11, 11, 11, 10, 10, 10, 10, 12, 12, 12, 12, 15, 15, 15,
- 15, 24, 18, 21, 10, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 16
- },
- {
- 15, 7, 31, 25, 20, 23, 21, 7, 11, 10, 26, 14, 6, 12, 6, 26, 20, 7, 20, 20, 21, 20, 20, 19, 21, 20, 8, 30, 24, 30, 24, 19, 20, 22, 22, 21, 22, 18, 18, 22,
- 22, 9, 14, 21, 18, 27, 21, 24, 22, 22, 23, 20, 19, 23, 22, 31, 23, 23, 21, 25, 13, 30, 10, 19, 10, 17, 17, 16, 17, 17, 11, 17, 17, 7, 7, 18, 7, 25, 17,
- 17, 17, 17, 11, 17, 11, 17, 18, 25, 19, 18, 17, 28, 26, 20, 15, 15, 20, 20, 20, 20, 29, 22, 19, 19, 19, 19, 9, 9, 9, 9, 23, 23, 23, 23, 24, 24, 24, 24,
- 20, 19, 17, 17, 17, 30, 16, 17, 17, 17, 17, 11, 11, 15, 12, 17, 17, 17, 17, 17, 17, 17, 17, 19, 20, 20, 20, 18, 19, 19, 21, 19, 19, 19, 19, 19, 16, 19,
- 19, 19, 20, 19, 16, 19, 19, 9, 19, 20, 14, 29, 19, 19, 19, 19, 19, 19, 21, 19, 20, 32, 20, 19, 19, 19, 19, 19, 19, 29, 19, 19, 19, 19, 19, 9, 9, 9, 9,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 21, 21, 10, 9, 10, 20
- }
-#ifdef MORE_LANGUAGES
- },
- {
- { 13, 12, 31, 35, 23, 35, 31, 9, 14, 15, 25, 30, 11, 17,
- 13, 31, 23, 16, 22, 21, 24, 23, 23, 20, 23, 22, 10,
- 35, 26, 26, 26, 26, 30, 26, 24, 23, 24, 22, 21, 24,
- 26, 10, 20, 26, 22, 29, 26, 25, 23, 25, 24, 24, 22,
- 25, 24, 29, 29, 23, 25, 37, 22, 37, 35, 37, 35, 21,
- 22, 21, 21, 22, 13, 22, 21, 10, 16, 22, 11, 32, 21,
- 21, 23, 22, 16, 20, 14, 21, 20, 30, 25, 21, 21, 13,
- 33, 13, 13, 13, 24, 22, 22, 19, 26, 21, 30, 20, 23,
- 23, 21, 24, 26, 23, 22, 23, 21, 22, 20, 20, 26, 25,
- 24, 22, 31, 32, 23, 30, 22, 22, 32, 23, 19, 18, 18,
- 15, 22, 19, 27, 19, 20, 20, 18, 22, 24, 20, 19, 19,
- 20, 19, 16, 19, 28, 20, 20, 18, 26, 27, 19, 26, 18,
- 19, 27, 19, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 26, 18, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 20 },
- { 13, 9, 21, 35, 23, 35, 35, 11, 35, 35, 25, 35, 11,
- 17, 13, 33, 28, 14, 22, 21, 24, 23, 23, 21, 23, 22,
- 10, 35, 13, 35, 13, 33, 5, 25, 22, 23, 24, 21, 21, 24,
- 24, 9, 20, 24, 21, 27, 25, 25, 22, 25, 23, 20, 23, 23,
- 23, 31, 23, 23, 23, 37, 33, 37, 35, 37, 35, 21, 19,
- 19, 21, 19, 17, 21, 21, 8, 17, 18, 14, 24, 21, 21, 20,
- 22, 19, 20, 20, 19, 20, 26, 21, 20, 21, 33, 33, 33,
- 33, 35, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 16, },
- { 15, 14, 16, 25, 19,
- 26, 22, 11, 18, 18, 27, 26, 13, 19, 9, 27, 19, 18, 19,
- 19, 22, 19, 20, 18, 19, 20, 12, 32, 15, 32, 15, 35,
- 15, 19, 19, 19, 19, 19, 16, 19, 20, 9, 19, 20, 14, 29,
- 19, 20, 19, 19, 19, 19, 21, 19, 20, 32, 20, 19, 19,
- 33, 31, 39, 37, 39, 37, 21, 21, 21, 23, 21, 19, 23, 23, 10, 19, 20, 16, 26, 23,
- 21, 21, 20, 20, 22, 21, 22, 22, 26, 22, 22, 23, 35,
- 35, 35, 35, 37, 19, 19, 19, 19, 19, 19, 29, 19, 19,
- 19, 20, 22, 31, 19, 19, 19, 19, 19, 29, 19, 29, 19,
- 21, 19, 30, 31, 21, 29, 19, 19, 29, 19, 21, 23, 32,
- 21, 21, 30, 31, 22, 21, 32, 33, 23, 32, 21, 21, 32,
- 21, 19, 19, 30, 31, 22, 22, 21, 32, 33, 23, 32, 21,
- 21, 32, 21, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 11, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19 },
- },
-
- {
- {
- 13, 12, 31, 35, 23, 35, 31, 9, 14, 15, 25, 30, 11, 17, 13, 31,
- 23, 16, 22, 21, 24, 23, 23, 20, 23, 22, 10, 35, 26, 26, 26, 26,
- 30, 26, 24, 23, 24, 22, 21, 24, 26, 10, 20, 26, 22, 29, 26, 25,
- 23, 25, 24, 24, 22, 25, 24, 29, 29, 23, 25, 37, 22, 37, 35, 37,
- 35, 21, 22, 21, 21, 22, 13, 22, 21, 10, 16, 22, 11, 32, 21, 21,
- 23, 22, 16, 20, 14, 21, 20, 30, 25, 21, 21, 33, 33, 33, 33, 35,
- 27, 27, 27, 27, 32, 24, 23, 23, 23, 23, 11, 11, 11, 11, 26, 26,
- 26, 26, 26, 26, 26, 25, 26, 21, 21, 21, 21, 32, 23, 22, 22, 22,
- 22, 11, 11, 11, 11, 22, 22, 22, 22, 22, 22, 22, 22, 26, 21, 24,
- 12, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 18, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
- 20
- },
-
- {
- 13, 9, 21, 35, 23, 35, 35, 11, 35, 35, 25, 35, 11, 17, 13, 33,
- 28, 14, 22, 21, 24, 23, 23, 21, 23, 22, 10, 35, 13, 35, 13, 33,
- 5, 25, 22, 23, 24, 21, 21, 24, 24, 9, 20, 24, 21, 27, 25, 25,
- 22, 25, 23, 20, 23, 23, 23, 31, 23, 23, 23, 37, 33, 37, 35, 37,
- 35, 21, 19, 19, 21, 19, 17, 21, 21, 8, 17, 18, 14, 24, 21, 21,
- 20, 22, 19, 20, 20, 19, 20, 26, 21, 20, 21, 33, 33, 33, 33, 35,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 16
- },
-
- {
- 15, 14, 16, 25, 19, 26, 22, 11, 18, 18, 27, 26, 13, 19, 9, 27,
- 19, 18, 19, 19, 22, 19, 20, 18, 19, 20, 12, 32, 15, 32, 15, 35,
- 15, 19, 19, 19, 19, 19, 16, 19, 20, 9, 19, 20, 14, 29, 19, 20,
- 19, 19, 19, 19, 21, 19, 20, 32, 20, 19, 19, 33, 31, 39, 37, 39,
- 37, 21, 21, 21, 23, 21, 19, 23, 23, 10, 19, 20, 16, 26, 23, 23,
- 20, 20, 20, 22, 21, 22, 22, 26, 22, 22, 23, 35, 35, 35, 35, 37,
- 19, 19, 19, 19, 29, 19, 19, 19, 19, 19, 9, 9, 9, 9, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 30, 19, 19, 19, 19,
- 19, 10, 10, 10, 10, 19, 19, 19, 19, 19, 19, 19, 19, 19, 23, 35,
- 12, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 11, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
- 19
- }
- }
-#endif
+int16 CFont::Size[MAX_FONTS][419] = {
+ {15, 6, 8, 24, 22, 28, 28, 2, 8, 8, 12, 24, 8, 10, 8, 12, 24, 8, 22, 20, 24, 22, 22, 22, 24, 22, 8, 8, 22, 22, 24, 16, 28, 26, 20, 22, 22, 18, 18,
+ 24, 22, 4, 16, 20, 18, 26, 20, 24, 20, 24, 22, 24, 20, 20, 26, 32, 26, 26, 20, 10, 12, 8, 22, 18, 6, 26, 20, 22, 22, 18, 18, 24, 22, 4, 16, 20, 18, 26,
+ 20, 24, 20, 24, 22, 24, 20, 20, 26, 32, 26, 26, 20, 10, 12, 8, 22, 18, 26, 26, 26, 26, 26, 26, 26, 22, 18, 18, 18, 18, 8, 8, 10, 10, 26, 20, 24, 24, 24,
+ 24, 24, 22, 24, 20, 20, 20, 20, 26, 22, 20, 26, 26, 26, 26, 26, 26, 26, 22, 18, 18, 18, 18, 8, 8, 10, 10, 26, 20, 24, 24, 24, 24, 24, 22, 24, 20, 20, 20,
+ 20, 26, 22, 24, 24, 8, 16, 10, 8, 28, 8, 8, 18, 16, 10, 28, 8, 28, 24, 6, 16, 22, 18, 24, 4, 14, 10, 26, 14, 16, 26, 12, 2, 16, 16, 32, 19, 19, 19,
+ 19, 19, 19, 19, 19, 24, 19, 19, 19, 19, 19, 19, 19, 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, -2, 0, -2, -2, 0, 0, 0, 0, -2, -2, -2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, -2, 0, -2, -2, 0, 0, 0, 0, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28},
+ {10, 12, 20, 24, 28, 30, 28, 12, 14, 14, 20, 24, 12, 16, 10, 28, 26, 20, 24, 24, 26, 24, 24, 24, 24, 24, 12, 12, 22, 22, 24, 24, 32, 28, 24, 26, 26, 24, 22,
+ 28, 26, 10, 22, 26, 22, 30, 28, 28, 26, 30, 26, 26, 28, 26, 26, 32, 26, 26, 26, 14, 18, 14, 22, 22, 14, 22, 22, 22, 22, 22, 18, 22, 22, 10, 12, 20, 10, 28,
+ 20, 22, 22, 22, 20, 22, 20, 20, 20, 30, 20, 22, 20, 16, 10, 16, 20, 0, 28, 28, 28, 28, 28, 28, 32, 26, 24, 24, 24, 24, 14, 14, 18, 16, 30, 28, 28, 28, 28,
+ 28, 28, 20, 30, 26, 26, 26, 26, 28, 26, 22, 22, 22, 22, 22, 22, 22, 32, 22, 22, 22, 22, 22, 14, 14, 18, 16, 22, 20, 22, 22, 22, 22, 22, 22, 24, 20, 20, 20,
+ 20, 22, 22, 22, 26, 12, 18, 18, 12, 32, 12, 12, 18, 18, 18, 32, 12, 32, 28, 10, 22, 28, 24, 28, 10, 26, 16, 30, 16, 20, 30, 18, 14, 18, 24, 32, 30, 30, 30,
+ 30, 24, 28, 24, 20, 24, 20, 20, 22, 20, 20, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 0, 0, -2, -2, 0, 0, 2, 0, 0, 0, 0, -2, -2, 0, 0, 0, -2, -2, -2, 0, -2, 0, -2, 0, 0, 0, 0, 0, 0,
+ 0, 0, -2, -2, 0, 0, -2, 0, -2, 1, 0, -2, -1, 0, 0, 0, -2, 0, 0, 0, -2, 0, 0, -2, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, -2, -2, -2, -2, 0, 0, -2, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28},
+ {15, 8, 0, 0, 18, 0, 22, 8, 13, 13, 0, 0, 7, 0, 8, 22, 18, 17, 18, 18, 20, 18, 18, 18, 18, 18, 8, 18, 18, 18, 18, 18, 15, 18, 18, 8, 18, 18, 13,
+ 28, 18, 18, 18, 18, 18, 18, 20, 18, 19, 30, 18, 18, 18, 18, 18, 18, 0, 18, 0, 28, 18, 18, 18, 18, 0, 8, 8, 8, 8, 0, 18, 18, 18, 18, 0, 18, 0, 0,
+ 18, 18, 18, 18, 0, 0, 20, 30, 18, 8, 9, 9, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22}
};
-#ifdef MORE_LANGUAGES
-int16 Size_jp[] = {
- 15, 14, 16, 20, 19, 26, 22, 11, 18, 18, 27, 26, 13, //; 0
- 19, 20, 27, 19, 15, 19, 19, 21, 19, 20, 18, 19, 15, //; 13
- 13, 28, 15, 32, 15, 35, 15, 19, 19, 19, 19, 17, 16, //; 26
- 19, 20, 15, 19, 20, 14, 17, 19, 19, 19, 19, 19, 19, //; 39
- 19, 19, 20, 25, 20, 19, 19, 33, 31, 39, 37, 39, 37, //; 52
- 21, 21, 21, 19, 17, 15, 23, 21, 15, 19, 20, 16, 19, //; 65
- 19, 19, 20, 20, 17, 22, 19, 22, 22, 19, 22, 22, 23, //; 78
- 35, 35, 35, 35, 37, 19, 19, 19, 19, 29, 19, 19, 19, //; 91
- 19, 19, 9, 9, 9, 9, 19, 19, 19, 19, 19, 19, 19, 19, //; 104
- 19, 19, 19, 19, 19, 30, 19, 19, 19, 19, 19, 10, 10, //; 118
- 10, 10, 19, 19, 19, 19, 19, 19, 19, 19, 19, 23, 35, //; 131
- 12, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, //; 144
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, //; 157
- 19, 19, 19, 11, 19, 19, 19, 19, 19, 19, 19, 19, 19, //; 170
- 19, 19, 19, 19, 19, 19, 19, 19, 19, 21
-};
-#endif
+
+int FontSizeIncrementers[] = { 4, -2, 2 };
wchar foreign_table[128] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -233,44 +128,26 @@ int CFont::PS2Symbol = BUTTON_NONE;
int CFont::ButtonsSlot = -1;
#endif // BUTTON_ICONS
+//--TODO(LCS): volatile memory
void
CFont::Initialise(void)
{
int slot;
- slot = CTxdStore::AddTxdSlot("fonts");
-#ifdef MORE_LANGUAGES
- Slot = slot;
- switch (LanguageSet)
+ if (gMakeResources)
{
- case FONT_LANGSET_EFIGS:
- default:
+ slot = CTxdStore::AddTxdSlot("fonts");
CTxdStore::LoadTxd(slot, "MODELS/FONTS.TXD");
- break;
- case FONT_LANGSET_POLISH:
- CTxdStore::LoadTxd(slot, "MODELS/FONTS_P.TXD");
- break;
- case FONT_LANGSET_RUSSIAN:
- CTxdStore::LoadTxd(slot, "MODELS/FONTS_R.TXD");
- break;
- case FONT_LANGSET_JAPANESE:
- CTxdStore::LoadTxd(slot, "MODELS/FONTS_J.TXD");
- break;
- }
-#else
- CTxdStore::LoadTxd(slot, "MODELS/FONTS.TXD");
-#endif
- CTxdStore::AddRef(slot);
- CTxdStore::PushCurrentTxd();
- CTxdStore::SetCurrentTxd(slot);
- Sprite[0].SetTexture("font2", "font2m");
-#ifdef MORE_LANGUAGES
- if (IsJapanese()) {
- Sprite[1].SetTexture("FONTJAP", "FONTJAP_mask");
- Sprite[3].SetTexture("FONTJAP", "FONTJAP_mask");
+ CTxdStore::AddRef(slot);
+ CTxdStore::PushCurrentTxd();
+ CTxdStore::SetCurrentTxd(slot);
+ Sprite[0].SetTexture("font2", "font2m");
+ Sprite[1].SetTexture("font1", "font1m");
+ Sprite[2].SetTexture("font3", "font3m");
+ CTxdStore::PopCurrentTxd();
}
-#endif // MORE_LANGUAGES
- Sprite[1].SetTexture("font1", "font1m");
+ else
+ slot = CTxdStore::FindTxdSlot("fonts");
SetScale(1.0f, 1.0f);
SetSlantRefPoint(SCREEN_WIDTH, 0.0f);
SetSlant(0.0f);
@@ -287,7 +164,17 @@ CFont::Initialise(void)
SetRightJustifyWrap(0.0f);
SetAlphaFade(255.0f);
SetDropShadowPosition(0);
- CTxdStore::PopCurrentTxd();
+ SetOutlineColor(CRGBA(0, 0, 0, 0));
+ SetOutlineOn(0);
+ SetNewLineAdd(0);
+ SetNewLineAdd(2);
+
+ /*
+ if (mspCompressedTexList)
+ {
+ // TODO (LCS): volatile shit
+ }
+ */
#ifdef BUTTON_ICONS
if (int file = CFileMgr::OpenFile("MODELS/X360BTNS.TXD")) {
@@ -361,6 +248,7 @@ CFont::ReloadFonts(uint8 set)
}
#endif
+//--TODO(LCS): gpFonts
void
CFont::Shutdown(void)
{
@@ -373,6 +261,7 @@ CFont::Shutdown(void)
#endif
Sprite[0].Delete();
Sprite[1].Delete();
+ Sprite[2].Delete();
#ifdef MORE_LANGUAGES
if (IsJapanese())
Sprite[3].Delete();
@@ -383,6 +272,7 @@ CFont::Shutdown(void)
#endif
}
+//--LCS: Done
void
CFont::InitPerFrame(void)
{
@@ -422,39 +312,39 @@ CFont::DrawButton(float x, float y)
}
#endif
+//--LCS: TODO (mostly done but could use some checking)
void
CFont::PrintChar(float x, float y, wchar c)
{
+ if (!(c >= 0 && c < 209)) return;
+
bool bDontPrint = false;
if(x <= 0.0f || x > SCREEN_WIDTH ||
- y <= 0.0f || y > SCREEN_HEIGHT) // BUG: game uses SCREENW again
+ y <= -12.0f || y > SCREEN_HEIGHT) // BUG: game uses SCREENW again
return;
bDontPrint = c == '\0';
float w = GetCharacterWidth(c) / 32.0f;
+
+ if ( !RenderState.proportional && RenderState.rightJustify )
+ x += (GetCharacterWidth(c) - GetCharacterWidth(c, true)) * RenderState.scaleX;
+
if (Details.bFontHalfTexture && c == 208)
c = '\0';
+
+
float xoff = c % 16;
float yoff = c / 16;
-#ifdef MORE_LANGUAGES
- if (IsJapaneseFont()) {
- w = 21.0f;
- xoff = (float)(c % 48);
- yoff = c / 48;
- }
-#endif
+
+ // small float modifiers were left for pc
if(RenderState.style == FONT_BANK || RenderState.style == FONT_STANDARD){
if (bDontPrint) return;
if (RenderState.slant == 0.0f) {
-#ifdef FIX_BUGS
if (c < 192) {
-#else
- if (c < 193) {
-#endif
CSprite2d::AddToBuffer(
CRect(x, y,
- x + 32.0f * RenderState.scaleX * 1.0f,
+ x + 32.0f * RenderState.scaleX * 0.96f,
y + 40.0f * RenderState.scaleY * 0.5f),
RenderState.color,
xoff / 16.0f, yoff / 12.8f + 0.0021f,
@@ -462,10 +352,13 @@ CFont::PrintChar(float x, float y, wchar c)
xoff / 16.0f, (yoff + 1.0f) / 12.8f - 0.0021f,
(xoff + 1.0f) / 16.0f - 0.001f, (yoff + 1.0f) / 12.8f - 0.0021f);
} else {
+ float xScale = 0.54f;
+ if (FrontEndMenuManager.m_PrefsUseWideScreen)
+ xScale = 0.486f;
CSprite2d::AddToBuffer(
- CRect(x, y,
- x + 32.0f * RenderState.scaleX * 1.0f,
- y + 33.0f * RenderState.scaleY * 0.5f),
+ CRect(x, y + RenderState.scaleY * 4.0f,
+ x + 32.0f * RenderState.scaleY * xScale * 0.96f,
+ y + 4.0f * RenderState.scaleY * + 16.0f * RenderState.scaleY),
RenderState.color,
xoff / 16.0f, yoff / 12.8f + 0.0021f,
(xoff + 1.0f) / 16.0f - 0.001f, yoff / 12.8f + 0.0021f,
@@ -475,37 +368,13 @@ CFont::PrintChar(float x, float y, wchar c)
} else
CSprite2d::AddToBuffer(
CRect(x, y,
- x + 32.0f * RenderState.scaleX * 1.0f,
+ x + 32.0f * RenderState.scaleX * 0.96f,
y + 40.0f * RenderState.scaleY * 0.5f),
RenderState.color,
xoff / 16.0f, yoff / 12.8f + 0.00055f,
(xoff + 1.0f) / 16.0f - 0.001f, yoff / 12.8f + 0.0021f + 0.01f,
xoff / 16.0f, (yoff + 1.0f) / 12.8f - 0.009f,
(xoff + 1.0f) / 16.0f - 0.001f, (yoff + 1.0f) / 12.8f - 0.0021f + 0.01f);
-#ifdef MORE_LANGUAGES
- }else if (IsJapaneseFont()) {
- if (Details.dropShadowPosition != 0) {
- CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank
- CRect(x + SCREEN_SCALE_X(Details.dropShadowPosition),
- y + SCREEN_SCALE_Y(Details.dropShadowPosition),
- x + SCREEN_SCALE_X(Details.dropShadowPosition) + 32.0f * Details.scaleX * 1.0f,
- y + SCREEN_SCALE_Y(Details.dropShadowPosition) + 40.0f * Details.scaleY / 2.75f),
- Details.dropColor,
- xoff * w / 1024.0f, yoff / 25.6f,
- xoff * w / 1024.0f + (1.0f / 48.0f) - 0.001f, yoff / 25.6f,
- xoff * w / 1024.0f, (yoff + 1.0f) / 25.6f,
- xoff * w / 1024.0f + (1.0f / 48.0f) - 0.001f, (yoff + 1.0f) / 25.6f - 0.0001f);
- }
- CSprite2d::AddSpriteToBank(Details.bank + Details.style, // BUG: game doesn't add bank
- CRect(x, y,
- x + 32.0f * Details.scaleX * 1.0f,
- y + 40.0f * Details.scaleY / 2.75f),
- Details.color,
- xoff * w / 1024.0f, yoff / 25.6f,
- xoff * w / 1024.0f + (1.0f / 48.0f) - 0.001f, yoff / 25.6f,
- xoff * w / 1024.0f, (yoff + 1.0f) / 25.6f - 0.002f,
- xoff * w / 1024.0f + (1.0f / 48.0f) - 0.001f, (yoff + 1.0f) / 25.6f - 0.0001f);
-#endif
} else {
if (bDontPrint) return;
CSprite2d::AddToBuffer(
@@ -513,10 +382,10 @@ CFont::PrintChar(float x, float y, wchar c)
x + 32.0f * RenderState.scaleX * w,
y + 32.0f * RenderState.scaleY * 0.5f),
RenderState.color,
- xoff / 16.0f, yoff / 16.0f,
- (xoff + w) / 16.0f, yoff / 16.0f,
- xoff / 16.0f, (yoff + 1.0f) / 16.0f,
- (xoff + w) / 16.0f - 0.0001f, (yoff + 1.0f) / 16.0f - 0.0001f);
+ xoff / 16.0f, yoff / 6.4f,
+ (xoff + w) / 16.0f, yoff / 6.4f,
+ xoff / 16.0f, (yoff + 1.0f) / 6.4f,
+ (xoff + w) / 16.0f, (yoff + 1.0f) / 6.4f);
}
}
@@ -542,6 +411,7 @@ bool CFont::IsAnsiCharacter(wchar *s)
}
#endif
+//--LCS: TODO (mostly done but could use some checking)
void
CFont::RenderFontBuffer()
{
@@ -554,7 +424,7 @@ CFont::RenderFontBuffer()
bool bFlash = false;
Sprite[RenderState.style].SetRenderState();
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); // TODO: not in lcs
RenderState = *(CFontRenderState*)&FontRenderStateBuf[0];
textPosX = RenderState.fTextPosX;
textPosY = RenderState.fTextPosY;
@@ -596,16 +466,15 @@ CFont::RenderFontBuffer()
}
Details.color.alpha = Details.bFlashState ? 0 : 255;
}
- if (!RenderState.bIsShadow)
+ if (!RenderState.bIsShadow && !RenderState.bOutlineOn)
RenderState.color = color;
}
wchar c = *pRenderStateBufPointer.pStr;
c -= ' ';
+ if (c == 200) c = '^';
+ if (c == 201) c = '>';
if (RenderState.bFontHalfTexture)
- c = FindNewCharacter(c);
- else if (c > 155)
- c = '\0';
-
+ c = FindNewCharacter(c);
if (RenderState.slant != 0.0f)
textPosY = (RenderState.slantRefX - textPosX) * RenderState.slant + RenderState.slantRefY;
PrintChar(textPosX, textPosY, c);
@@ -614,11 +483,11 @@ CFont::RenderFontBuffer()
PrintChar(textPosX + 2.0f, textPosY, c);
textPosX += 2.0f;
}
-#ifdef FIX_BUGS
- // PS2 uses different chars for some symbols
- if (!RenderState.bFontHalfTexture && c == 30) c = 61; // wanted star
-#endif
textPosX += RenderState.scaleX * GetCharacterWidth(c);
+//#ifdef FIX_BUGS
+// // PS2 uses different chars for some symbols
+// if (!RenderState.bFontHalfTexture && c == 30) c = 61; // wanted star
+//#endif
if (c == '\0')
textPosX += RenderState.fExtraSpace;
}
@@ -626,50 +495,8 @@ CFont::RenderFontBuffer()
FontRenderStatePointer.pRenderState = (CFontRenderState*)FontRenderStateBuf;
}
-#ifdef MORE_LANGUAGES
-bool
-CFont::PrintString(float x, float y, wchar *start, wchar *&end, float spwidth, float japX)
-{
- wchar *s, c, unused;
-
- if (IsJapanese()) {
- float jx = 0.0f;
- for (s = start; s < end; s++) {
- if (*s == JAP_TERMINATION || *s == '~')
- s = ParseToken(s, &unused, true);
- if (NewLine) {
- NewLine = false;
- break;
- }
- jx += GetCharacterSize(*s - ' ');
- }
- s = start;
- if (Details.centre)
- x = japX - jx / 2.0f;
- else if (Details.rightJustify)
- x = japX - jx;
- }
- for (s = start; s < end; s++) {
- if (*s == '~' || (IsJapanese() && *s == JAP_TERMINATION))
- s = ParseToken(s, &unused);
- if (NewLine && IsJapanese()) {
- NewLine = false;
- end = s;
- return true;
- }
- c = *s - ' ';
- if (Details.slant != 0.0f && !IsJapanese())
- y = (Details.slantRefX - x) * Details.slant + Details.slantRefY;
-
- PrintChar(x, y, c);
- x += GetCharacterSize(c);
- if (c == 0 && (!NewLine || !IsJapanese())) // space
- x += spwidth;
- }
- return false;
-}
-#else
+//--LCS: TODO
void
CFont::PrintString(float x, float y, uint32, wchar *start, wchar *end, float spwidth)
{
@@ -680,26 +507,38 @@ CFont::PrintString(float x, float y, uint32, wchar *start, wchar *end, float spw
RenderState.style = Details.style;
}
- float dropShadowPosition = Details.dropShadowPosition;
- if (dropShadowPosition != 0.0f && (Details.style == FONT_BANK || Details.style == FONT_STANDARD)) {
+ if (Details.outlineColor.a != 0) {
CRGBA color = Details.color;
- Details.color = Details.dropColor;
+ Details.color = Details.outlineColor;
+ Details.bOutlineOn = true;
+ Details.outlineColor.a = 0;
Details.dropShadowPosition = 0;
- Details.bIsShadow = true;
- if (Details.slant != 0.0f) {
- Details.slantRefX += SCREEN_SCALE_X(dropShadowPosition);
- Details.slantRefY += SCREEN_SCALE_Y(dropShadowPosition);
- PrintString(SCREEN_SCALE_X(dropShadowPosition) + x, SCREEN_SCALE_Y(dropShadowPosition) + y, Details.anonymous_25, start, end, spwidth);
- Details.slantRefX -= SCREEN_SCALE_X(dropShadowPosition);
- Details.slantRefY -= SCREEN_SCALE_Y(dropShadowPosition);
- } else {
- PrintString(SCREEN_SCALE_X(dropShadowPosition) + x, SCREEN_SCALE_Y(dropShadowPosition) + y, Details.anonymous_25, start, end, spwidth);
- }
- Details.color = color;
- Details.dropShadowPosition = dropShadowPosition;
Details.bIsShadow = false;
+ PrintString(x, y, Details.anonymous_25, start, end, spwidth);
+ Details.color = color;
+ Details.bOutlineOn = false;
+ } else {
+ float dropShadowPosition = Details.dropShadowPosition;
+ if (dropShadowPosition != 0.0f && (Details.style == FONT_BANK || Details.style == FONT_STANDARD)) {
+ CRGBA color = Details.color;
+ Details.color = Details.dropColor;
+ Details.dropShadowPosition = 0;
+ Details.bIsShadow = true;
+ if (Details.slant != 0.0f) {
+ Details.slantRefX += SCREEN_SCALE_X(dropShadowPosition);
+ Details.slantRefY += SCREEN_SCALE_Y(dropShadowPosition);
+ PrintString(SCREEN_SCALE_X(dropShadowPosition) + x, SCREEN_SCALE_Y(dropShadowPosition) + y, Details.anonymous_25, start, end, spwidth);
+ Details.slantRefX -= SCREEN_SCALE_X(dropShadowPosition);
+ Details.slantRefY -= SCREEN_SCALE_Y(dropShadowPosition);
+ } else {
+ PrintString(SCREEN_SCALE_X(dropShadowPosition) + x, SCREEN_SCALE_Y(dropShadowPosition) + y, Details.anonymous_25, start, end, spwidth);
+ }
+ Details.color = color;
+ Details.dropShadowPosition = dropShadowPosition;
+ Details.bIsShadow = false;
+ }
}
- if (FontRenderStatePointer.pStr >= (wchar*)&FontRenderStateBuf[ARRAY_SIZE(FontRenderStateBuf)] - (end - start + 26)) // why 26?
+ if ((uintptr)FontRenderStatePointer.pStr >= (uintptr)&FontRenderStateBuf[ARRAY_SIZE(FontRenderStateBuf)] - sizeof(wchar) * (end - start + 2) - sizeof(CFontRenderState))
RenderFontBuffer();
CFontRenderState *pRenderState = FontRenderStatePointer.pRenderState;
pRenderState->fTextPosX = x;
@@ -735,17 +574,18 @@ CFont::PrintString(float x, float y, uint32, wchar *start, wchar *end, float spw
*(FontRenderStatePointer.pStr++) = '\0';
FontRenderStatePointer.Align();
}
-#endif
+// LCS: Done
void
CFont::PrintStringFromBottom(float x, float y, wchar *str)
{
- y -= (32.0f * Details.scaleY / 2.0f + 2.0f * Details.scaleY) * GetNumberLines(x, y, str);
+ y -= (32.0f * Details.scaleY / 2.0f + Details.line * Details.scaleY) * GetNumberLines(x, y, str);
if (Details.slant != 0.0f)
y -= ((Details.slantRefX - x) * Details.slant + Details.slantRefY);
PrintString(x, y, str);
}
+//--LCS: TODO
void
CFont::PrintString(float xstart, float ystart, wchar *s)
{
@@ -756,7 +596,8 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
bool first;
wchar *start, *t;
- Details.bFlash = false;
+ CRGBA outlineColor = Details.outlineColor;
+ CFont::SetFlashOff();
if(*s == '*')
return;
@@ -891,6 +732,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
}
}
+//--LCS: TODO
int
CFont::GetNumberLines(float xstart, float ystart, wchar *s)
{
@@ -992,6 +834,7 @@ CFont::GetNumberLines(float xstart, float ystart, wchar *s)
return n;
}
+//--LCS: TODO
void
CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s)
{
@@ -1097,103 +940,65 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s)
}
}
-float
-CFont::GetCharacterWidth(wchar c)
+//--LCS: done
+bool IsPunctuation(wchar c)
{
-#ifdef MORE_LANGUAGES
- if (IsJapanese()) {
- if (!Details.proportional)
- return Size[0][Details.style][192];
- if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_BANK) {
- switch (Details.style)
- {
- case FONT_JAPANESE:
- return Size_jp[c];
- default:
- return Size[0][Details.style][c];
- }
- }
- if (c < 254 && Details.style == FONT_PAGER)
- return 29.4f;
-
- switch (Details.style)
- {
- case FONT_JAPANESE:
- return 29.4f;
- case FONT_BANK:
- return 10.0f;
- case FONT_PAGER:
- return 31.5f;
- default:
- return Size[0][Details.style][c];
- }
+ switch (c)
+ {
+ case '!':
+ case '?':
+ case '.':
+ case ',':
+ case ':':
+ case ';':
+
+ // these are lucid it seems
+ //case '$':
+ //case '/':
+ //case '\\':
+ return true;
}
-
- else if (Details.proportional)
- return Size[LanguageSet][Details.style][c];
- else
- return Size[LanguageSet][Details.style][192];
-#else
-
- if (RenderState.proportional)
- return Size[RenderState.style][c];
- else
- return Size[RenderState.style][209];
-#endif // MORE_LANGUAGES
+ return false;
}
+//--LCS: done
float
-CFont::GetCharacterSize(wchar c)
+CFont::GetCharacterWidth(wchar c, bool forceProportional)
{
-#ifdef MORE_LANGUAGES
-
- if (IsJapanese())
+ if (RenderState.proportional || forceProportional)
{
- if (!Details.proportional)
- return Size[0][Details.style][209] * Details.scaleX;
- if (c <= 94 || Details.style == FONT_HEADING || Details.style == FONT_BANK) {
- switch (Details.style)
- {
- case FONT_JAPANESE:
- return Size_jp[c] * Details.scaleX;
- default:
- return Size[0][Details.style][c] * Details.scaleX;
- }
- }
- if (c < 254 && (Details.style == FONT_PAGER))
- return 29.4f * Details.scaleX;
-
- switch (Details.style)
- {
- case FONT_JAPANESE:
- return 29.4f * Details.scaleX;
- case FONT_BANK:
- return 10.0f * Details.scaleX;
- case FONT_PAGER:
- return 31.5f * Details.scaleX;
- default:
- return Size[0][Details.style][c] * Details.scaleX;
- }
+ float inc = c < 192 ? 0.0f : 4.0f;
+ return Size[RenderState.style][c] + Size[RenderState.style][c + 209] + FontSizeIncrementers[RenderState.style] + inc;
+ } else {
+ if (IsPunctuation(c + ' '))
+ return Size[RenderState.style][418] / 1.6f + FontSizeIncrementers[RenderState.style];
+ else
+ return Size[RenderState.style][418] + FontSizeIncrementers[RenderState.style];
}
- else if(Details.proportional)
- return Size[LanguageSet][Details.style][c] * Details.scaleX;
- else
- return Size[LanguageSet][Details.style][209] * Details.scaleX;
-#else
+}
-#ifdef FIX_BUGS
+//--LCS: done
+float
+CFont::GetCharacterSize(wchar c)
+{
+//#ifdef FIX_BUGS
// PS2 don't call FindNewCharacter in here at all, and also uses different chars for some symbols
- if (!Details.bFontHalfTexture && c == 30) c = 61; // wanted star
-#endif
+// if (!Details.bFontHalfTexture && c == 30) c = 61; // wanted star
+//#endif
if (Details.bFontHalfTexture)
c = FindNewCharacter(c);
- if (Details.proportional)
- return Size[Details.style][c] * Details.scaleX;
- else
- return Size[Details.style][209] * Details.scaleX;
-#endif // MORE_LANGUAGES
+ if (Details.proportional) {
+ float inc = c < 192 ? 0.0f : 4.0f;
+ return (Size[Details.style][c] + Size[Details.style][c + 209] + FontSizeIncrementers[Details.style] + inc) * Details.scaleX;
+ } else {
+ if (IsPunctuation(c + ' '))
+ return (Size[Details.style][418] + FontSizeIncrementers[Details.style]) / 1.6f * Details.scaleX;
+ else
+ return Size[Details.style][418] + FontSizeIncrementers[Details.style] * Details.scaleX;
+ }
}
+//--LCS: TODO
float
CFont::GetStringWidth(wchar *s, bool spaces)
{
@@ -1306,6 +1111,19 @@ CFont::GetStringWidth_Jap(wchar* s)
}
#endif
+//--LCS: done
+bool16
+CFont::CheckNewLine(wchar *s)
+{
+ while (*s == ' ')
+ s++;
+
+ if (*s == '~')
+ return s[1] == 'N' || s[1] == 'n';
+ return false;
+}
+
+//--LCS: TODO
wchar*
CFont::GetNextSpace(wchar *s)
{
@@ -1336,6 +1154,7 @@ CFont::GetNextSpace(wchar *s)
return s;
}
+//--LCS: done
wchar*
CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
{
@@ -1348,28 +1167,36 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
case 'B':
bold = !bold;
break;
+ case 'Y':
+ color.r = 255;
+ color.g = 227;
+ color.b = 79;
+ break;
case 'b':
- color.r = 27;
- color.g = 89;
- color.b = 130;
+ color.r = 77;
+ color.g = 155;
+ color.b = 210;
break;
case 'f':
flash = !flash;
break;
case 'g':
- color.r = 255;
- color.g = 150;
- color.b = 225;
+ color.r = 75;
+ color.g = 151;
+ color.b = 75;
+ Details.anonymous_23 = true;
break;
case 'h':
- color.r = 225;
- color.g = 225;
- color.b = 225;
+ color.r = 255;
+ color.g = 255;
+ color.b = 255;
+ Details.anonymous_23 = true;
break;
case 'l':
color.r = 0;
color.g = 0;
color.b = 0;
+ Details.anonymous_23 = true;
break;
case 'o':
color.r = 229;
@@ -1377,9 +1204,9 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
color.b = 126;
break;
case 'p':
- color.r = 168;
- color.g = 110;
- color.b = 252;
+ color.r = 151;
+ color.g = 82;
+ color.b = 197;
break;
case 'q':
color.r = 199;
@@ -1387,9 +1214,9 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
color.b = 203;
break;
case 'r':
- color.r = 255;
- color.g = 150;
- color.b = 225;
+ color.r = 174;
+ color.g = 0;
+ color.b = 0;
break;
case 't':
color.r = 86;
@@ -1397,27 +1224,20 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
color.b = 146;
break;
case 'w':
- color.r = 175;
- color.g = 175;
- color.b = 175;
- break;
-#ifdef FIX_BUGS
- case 'x':
- color.r = 0;
- color.g = 255;
- color.b = 255;
+ color.r = 225;
+ color.g = 225;
+ color.b = 225;
+ Details.anonymous_23 = true;
break;
-#else
case 'x':
color.r = 132;
color.g = 146;
color.b = 197;
break;
-#endif
case 'y':
color.r = 255;
- color.g = 227;
- color.b = 79;
+ color.g = 255;
+ color.b = 0;
break;
#ifdef BUTTON_ICONS
case 'U': PS2Symbol = BUTTON_UP; break;
@@ -1443,183 +1263,34 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
}
while (*s != '~')
++s;
- if (*(++s) == '~')
- s = ParseToken(s, color, flash, bold);
- return s;
-}
-#ifdef MORE_LANGUAGES
-wchar*
-CFont::ParseToken(wchar *s, bool japShit)
-{
+ // seem to be gone in lcs
+ //if (*(++s) == '~')
+ // s = ParseToken(s, color, flash, bold);
+
+ // wtf?
+ if (*s == '\0') s++;
s++;
- if ((Details.color.r || Details.color.g || Details.color.b) && !japShit) {
- wchar c = *s;
- if (IsJapanese())
- c &= 0x7FFF;
- switch (c) {
- case 'N':
- case 'n':
- NewLine = true;
- break;
- case 'b': SetColor(CRGBA(128, 167, 243, 255)); break;
- case 'g': SetColor(CRGBA(95, 160, 106, 255)); break;
- case 'h': SetColor(CRGBA(225, 225, 225, 255)); break;
- case 'l': SetColor(CRGBA(0, 0, 0, 255)); break;
- case 'p': SetColor(CRGBA(168, 110, 252, 255)); break;
- case 'r': SetColor(CRGBA(113, 43, 73, 255)); break;
- case 'w': SetColor(CRGBA(175, 175, 175, 255)); break;
- case 'y': SetColor(CRGBA(210, 196, 106, 255)); break;
-#ifdef BUTTON_ICONS
- case 'U': PS2Symbol = BUTTON_UP; break;
- case 'D': PS2Symbol = BUTTON_DOWN; break;
- case '<': PS2Symbol = BUTTON_LEFT; break;
- case '>': PS2Symbol = BUTTON_RIGHT; break;
- case 'X': PS2Symbol = BUTTON_CROSS; break;
- case 'O': PS2Symbol = BUTTON_CIRCLE; break;
- case 'Q': PS2Symbol = BUTTON_SQUARE; break;
- case 'T': PS2Symbol = BUTTON_TRIANGLE; break;
- case 'K': PS2Symbol = BUTTON_L1; break;
- case 'M': PS2Symbol = BUTTON_L2; break;
- case 'A': PS2Symbol = BUTTON_L3; break;
- case 'J': PS2Symbol = BUTTON_R1; break;
- case 'V': PS2Symbol = BUTTON_R2; break;
- case 'C': PS2Symbol = BUTTON_R3; break;
- case '(': PS2Symbol = BUTTON_RSTICK_LEFT; break;
- case ')': PS2Symbol = BUTTON_RSTICK_RIGHT; break;
-#endif
- }
- } else if (IsJapanese()) {
- if ((*s & 0x7FFF) == 'N' || (*s & 0x7FFF) == 'n')
- NewLine = true;
- }
- while ((!IsJapanese() || (*s != JAP_TERMINATION)) && *s != '~') s++;
- return s + 1;
+ return s;
}
-#else
+
+//--LCS: done
wchar*
CFont::ParseToken(wchar *s)
{
- Details.anonymous_23 = false;
- s++;
- if(Details.color.r || Details.color.g || Details.color.b)
- switch(*s){
- case 'B':
- Details.bBold = !Details.bBold;
- break;
- case 'N':
- case 'n':
- NewLine = true;
- break;
- case 'b':
- Details.color.r = 27;
- Details.color.g = 89;
- Details.color.b = 130;
- Details.anonymous_23 = true;
- break;
- case 'f':
- Details.bFlash = !Details.bFlash;
- if (!Details.bFlash)
- Details.color.a = 255;
- break;
- case 'g':
- Details.color.r = 255;
- Details.color.g = 150;
- Details.color.b = 225;
- Details.anonymous_23 = true;
- break;
- case 'h':
- Details.color.r = 225;
- Details.color.g = 225;
- Details.color.b = 225;
- Details.anonymous_23 = true;
- break;
- case 'l':
- Details.color.r = 0;
- Details.color.g = 0;
- Details.color.b = 0;
- Details.anonymous_23 = true;
- break;
- case 'o':
- Details.color.r = 229;
- Details.color.g = 125;
- Details.color.b = 126;
- Details.anonymous_23 = true;
- break;
- case 'p':
- Details.color.r = 168;
- Details.color.g = 110;
- Details.color.b = 252;
- Details.anonymous_23 = true;
- break;
- case 'q':
- Details.color.r = 199;
- Details.color.g = 144;
- Details.color.b = 203;
- Details.anonymous_23 = true;
- break;
- case 'r':
- Details.color.r = 255;
- Details.color.g = 150;
- Details.color.b = 225;
- Details.anonymous_23 = true;
- break;
- case 't':
- Details.color.r = 86;
- Details.color.g = 212;
- Details.color.b = 146;
- Details.anonymous_23 = true;
- break;
- case 'w':
- Details.color.r = 175;
- Details.color.g = 175;
- Details.color.b = 175;
- Details.anonymous_23 = true;
- break;
- case 'x':
-#ifdef FIX_BUGS
- Details.color.r = 0;
- Details.color.g = 255;
- Details.color.b = 255;
-#else
- Details.color.r = 132;
- Details.color.g = 146;
- Details.color.b = 197;
-#endif
- Details.anonymous_23 = true;
- break;
- case 'y':
- Details.color.r = 255;
- Details.color.g = 227;
- Details.color.b = 79;
- Details.anonymous_23 = true;
- break;
-#ifdef BUTTON_ICONS
- case 'U': PS2Symbol = BUTTON_UP; break;
- case 'D': PS2Symbol = BUTTON_DOWN; break;
- case '<': PS2Symbol = BUTTON_LEFT; break;
- case '>': PS2Symbol = BUTTON_RIGHT; break;
- case 'X': PS2Symbol = BUTTON_CROSS; break;
- case 'O': PS2Symbol = BUTTON_CIRCLE; break;
- case 'Q': PS2Symbol = BUTTON_SQUARE; break;
- case 'T': PS2Symbol = BUTTON_TRIANGLE; break;
- case 'K': PS2Symbol = BUTTON_L1; break;
- case 'M': PS2Symbol = BUTTON_L2; break;
- case 'A': PS2Symbol = BUTTON_L3; break;
- case 'J': PS2Symbol = BUTTON_R1; break;
- case 'V': PS2Symbol = BUTTON_R2; break;
- case 'C': PS2Symbol = BUTTON_R3; break;
- case '(': PS2Symbol = BUTTON_RSTICK_LEFT; break;
- case ')': PS2Symbol = BUTTON_RSTICK_RIGHT; break;
-#endif
- }
- while(*s != '~') s++;
- if (*(++s) == '~')
- s = ParseToken(s);
+ bool flash = false;
+ bool bold = false;
+ CRGBA color = Details.color;
+ s = ParseToken(s, color, flash, bold);
+ Details.bFlash = flash;
+ Details.bBold = bold;
+
+ if (Details.anonymous_23)
+ Details.color = color;
return s;
}
-#endif
+//--LCS: done
void
CFont::FilterOutTokensFromString(wchar *str)
{
@@ -1638,25 +1309,22 @@ CFont::FilterOutTokensFromString(wchar *str)
str[newIdx] = '\0';
}
+//--LCS: done
void
CFont::DrawFonts(void)
{
RenderFontBuffer();
}
+//--LCS: done
void
CFont::SetScale(float x, float y)
{
-#ifdef MORE_LANGUAGES
- /*if (IsJapanese()) {
- x *= 1.35f;
- y *= 1.25f;
- }*/
-#endif
Details.scaleX = x;
Details.scaleY = y;
}
+//--LCS: done
void
CFont::SetSlantRefPoint(float x, float y)
{
@@ -1664,12 +1332,14 @@ CFont::SetSlantRefPoint(float x, float y)
Details.slantRefY = y;
}
+//--LCS: done
void
CFont::SetSlant(float s)
{
Details.slant = s;
}
+//--LCS: done
void
CFont::SetColor(CRGBA col)
{
@@ -1678,6 +1348,14 @@ CFont::SetColor(CRGBA col)
Details.color.a *= Details.alphaFade / 255.0f;
}
+//--LCS: done
+void
+CFont::SetFlashOff()
+{
+ Details.bFlash = false;
+}
+
+//--LCS: done
void
CFont::SetJustifyOn(void)
{
@@ -1686,6 +1364,7 @@ CFont::SetJustifyOn(void)
Details.rightJustify = false;
}
+//--LCS: done
void
CFont::SetJustifyOff(void)
{
@@ -1693,6 +1372,7 @@ CFont::SetJustifyOff(void)
Details.rightJustify = false;
}
+//--LCS: done
void
CFont::SetCentreOn(void)
{
@@ -1701,54 +1381,65 @@ CFont::SetCentreOn(void)
Details.rightJustify = false;
}
+//--LCS: done
void
CFont::SetCentreOff(void)
{
Details.centre = false;
}
+//--LCS: TODO
void
CFont::SetWrapx(float x)
{
+ // uncomment when scaling is done
+ //x = clamp(x, 0.0f, DEFAULT_SCREEN_WIDTH);
Details.wrapX = x;
}
+//--LCS: done
void
CFont::SetCentreSize(float s)
{
Details.centreSize = s;
}
+//--LCS: done
void
CFont::SetBackgroundOn(void)
{
Details.background = true;
}
+//--LCS: done
void
CFont::SetBackgroundOff(void)
{
Details.background = false;
}
+//--LCS: done
void
CFont::SetBackgroundColor(CRGBA col)
{
Details.backgroundColor = col;
}
+//--LCS: done
void
CFont::SetBackGroundOnlyTextOn(void)
{
Details.backgroundOnlyText = true;
}
+//--LCS: done
void
CFont::SetBackGroundOnlyTextOff(void)
{
Details.backgroundOnlyText = false;
}
+//--LCS: done
void
CFont::SetRightJustifyOn(void)
{
@@ -1757,6 +1448,7 @@ CFont::SetRightJustifyOn(void)
Details.centre = false;
}
+//--LCS: done
void
CFont::SetRightJustifyOff(void)
{
@@ -1765,70 +1457,118 @@ CFont::SetRightJustifyOff(void)
Details.centre = false;
}
+//--LCS: done
void
CFont::SetPropOff(void)
{
Details.proportional = false;
}
+//--LCS: done
void
CFont::SetPropOn(void)
{
Details.proportional = true;
}
+//--LCS: done
void
CFont::SetFontStyle(int16 style)
{
if (style == FONT_HEADING) {
- Details.style = FONT_STANDARD;
+ Details.style = FONT_HEADING;
Details.bFontHalfTexture = true;
- } else {
+ }
+ else {
Details.style = style;
Details.bFontHalfTexture = false;
}
}
+//--LCS: done
void
CFont::SetRightJustifyWrap(float wrap)
{
Details.rightJustifyWrap = wrap;
}
+//--LCS: done
void
CFont::SetAlphaFade(float fade)
{
Details.alphaFade = fade;
}
+//--LCS: done
void
CFont::SetDropColor(CRGBA col)
{
Details.dropColor = col;
if (Details.alphaFade < 255.0f)
- Details.dropColor.a *= Details.alphaFade / 255.0f;
+ // TODO: was this a copypaste bug in here?
+ //Details.dropColor.a *= Details.alphaFade / 255.0f;
+ Details.dropColor.a = Details.color.a * Details.alphaFade / 255.0f;
+}
+
+
+//--LCS: done
+void
+CFont::SetOutlineColor(CRGBA col)
+{
+ Details.outlineColor = col;
+ if (Details.alphaFade < 255.0f)
+ Details.outlineColor.a *= Details.alphaFade / 255.0f;
+}
+
+//--LCS: done
+void
+CFont::SetOutlineOn(int on)
+{
+ Details.bOutlineOn = on;
}
+//--LCS: done
+void
+CFont::SetNewLineAdd(int line)
+{
+ Details.line = line;
+}
+
+//--LCS: done
void
CFont::SetDropShadowPosition(int16 pos)
{
Details.dropShadowPosition = pos;
}
-wchar CFont::FindNewCharacter(wchar c)
+int16 CFont::FindNewCharacter(int16 c)
{
- if (c >= 16 && c <= 26) return c + 128;
- if (c >= 8 && c <= 9) return c + 86;
- if (c == 4) return c + 89;
- if (c == 7) return 206;
- if (c == 14) return 207;
- if (c >= 33 && c <= 58) return c + 122;
- if (c >= 65 && c <= 90) return c + 90;
- if (c >= 96 && c <= 118) return c + 85;
- if (c >= 119 && c <= 140) return c + 62;
- if (c >= 141 && c <= 142) return 204;
- if (c == 143) return 205;
- if (c == 1) return 208;
+ if (c >= 33 && c <= 33 + 25)
+ return c - 6;
+ else if(c >= 65 && c <= 65 + 25)
+ return c - 38;
+ else if (c >= 96 && c <= 96 + 31)
+ return c - 43;
+ else if (c >= 128 && c <= 128 + 31)
+ return c - 75;
+
+ switch (c)
+ {
+ case 190:
+ return 90;
+ case 175:
+ return 87;
+ case 184:
+ return 88;
+ case 187:
+ return 89;
+ case 31:
+ return 88;
+ }
+ if (c >= 27 && c < 31)
+ return 2;
+ if (c >= 180 && c < 256)
+ c = 2;
return c;
}
@@ -1838,4 +1578,4 @@ CFont::character_code(uint8 c)
if(c < 128)
return c;
return foreign_table[c-128];
-} \ No newline at end of file
+}
diff --git a/src/render/Font.h b/src/render/Font.h
index 4b2dda2b..05c367fb 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -37,6 +37,9 @@ struct CFontDetails
int nFlashTimer;
bool8 anonymous_23;
uint32 anonymous_25;
+ CRGBA outlineColor;
+ int bOutlineOn;
+ int line;
};
struct CFontRenderState
@@ -56,6 +59,9 @@ struct CFontRenderState
bool8 proportional;
bool8 anonymous_14;
int16 style;
+ int bOutlineOn;
+ int line;
+ bool8 rightJustify;
};
class CSprite2d;
@@ -64,10 +70,7 @@ enum {
FONT_BANK,
FONT_STANDARD,
FONT_HEADING,
-#ifdef MORE_LANGUAGES
- FONT_JAPANESE,
-#endif
- MAX_FONTS = FONT_HEADING
+ MAX_FONTS
};
enum {
@@ -123,9 +126,9 @@ class CFont
static uint8 LanguageSet;
static int32 Slot;
#else
- static int16 Size[MAX_FONTS][210];
+ static int16 Size[MAX_FONTS][419];
#endif
- static int16 NewLine;
+ static bool16 NewLine;
public:
static CSprite2d Sprite[MAX_FONTS];
static CFontDetails Details;
@@ -146,7 +149,6 @@ public:
static void PrintChar(float x, float y, wchar c);
static void PrintString(float x, float y, wchar *s);
#ifdef XBOX_SUBTITLES
- static void PrintStringFromBottom(float x, float y, wchar *str);
static void PrintOutlinedString(float x, float y, wchar *str, float outlineStrength, bool fromBottom, CRGBA outlineColor);
#endif
static int GetNumberLines(float xstart, float ystart, wchar *s);
@@ -157,7 +159,7 @@ public:
static void PrintString(float x, float y, uint32, wchar *start, wchar *end, float spwidth);
#endif
static void PrintStringFromBottom(float x, float y, wchar *str);
- static float GetCharacterWidth(wchar c);
+ static float GetCharacterWidth(wchar c, bool forceProportional = false);
static float GetCharacterSize(wchar c);
static float GetStringWidth(wchar *s, bool spaces = false);
#ifdef MORE_LANGUAGES
@@ -189,6 +191,7 @@ public:
static void SetBackgroundOff(void);
static void SetBackGroundOnlyTextOn(void);
static void SetBackGroundOnlyTextOff(void);
+ static void SetFlashOff(void);
static void SetPropOn(void);
static void SetPropOff(void);
static void SetFontStyle(int16 style);
@@ -198,8 +201,14 @@ public:
static void SetBackgroundColor(CRGBA col);
static void SetColor(CRGBA col);
static void SetDropColor(CRGBA col);
- static wchar FindNewCharacter(wchar c);
+
+ static void SetOutlineColor(CRGBA col);
+ static void SetOutlineOn(int on);
+ static void SetNewLineAdd(int line);
+
+ static int16 FindNewCharacter(int16 c);
static void FilterOutTokensFromString(wchar*);
+ static bool16 CheckNewLine(wchar *s);
#ifdef MORE_LANGUAGES
static void ReloadFonts(uint8 set);
diff --git a/src/rw/TexRead.cpp b/src/rw/TexRead.cpp
index c5252f77..632cec02 100644
--- a/src/rw/TexRead.cpp
+++ b/src/rw/TexRead.cpp
@@ -5,7 +5,7 @@
#define WITHD3D
#endif
#include "common.h"
-#ifndef LIBRW
+#ifdef ANISOTROPIC_FILTERING
#include "rpanisot.h"
#endif
#include "crossplatform.h"
@@ -55,12 +55,9 @@ RwTextureGtaStreamRead(RwStream *stream)
texNumLoaded++;
}
- if(tex == nil)
- return nil;
-
-#ifndef LIBRW
- if(RpAnisotTextureGetMaxAnisotropy(tex) > 1)
- RpAnisotTextureSetMaxAnisotropy(tex, RpAnisotTextureGetMaxAnisotropy(tex));
+#ifdef ANISOTROPIC_FILTERING
+ if(tex && RpAnisotGetMaxSupportedMaxAnisotropy() > 1) // BUG? this was RpAnisotTextureGetMaxAnisotropy, but that doesn't make much sense
+ RpAnisotTextureSetMaxAnisotropy(tex, RpAnisotGetMaxSupportedMaxAnisotropy());
#endif
return tex;