summaryrefslogtreecommitdiffstats
path: root/src/renderer/Font.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderer/Font.cpp')
-rw-r--r--src/renderer/Font.cpp1018
1 files changed, 346 insertions, 672 deletions
diff --git a/src/renderer/Font.cpp b/src/renderer/Font.cpp
index 9c499248..b38b0efd 100644
--- a/src/renderer/Font.cpp
+++ b/src/renderer/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,225 +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
- {
- //FONT2 EFIGS
- //SPC,!, $, %, &, ', [, ], +, , -, .,
- 12, 9, 22, 17, 19, 19, 25, 4, 33, 33, 25, 35, 11, 10, 6, 33,
- //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, :, ??,
- 18, 10, 17, 17, 17, 17, 17, 15, 12, 16, 5, 30, 30, 30, 30, 30,
- // A, B, C, D, E, F, G, H, I, J, K, L, M, N, O,
- 12, 16, 19, 16, 19, 18, 18, 17, 22, 11, 17, 18, 18, 30, 22, 19,
- //P, Q, R, S, T, U, V, W, X, Y, Z, ??, ??, ??, ¡, \,
- #ifdef FIX_BUGS
- 22, 19, 19, 20, 18, 19, 19, 29, 19, 18, 19, 19, 33, 33, 10, 19,
- #else
- 22, 19, 19, 20, 18, 19, 19, 29, 19, 18, 19, 19, 33, 33, 19, 19,
- #endif
- //??,a, b, c, d, e, f, g, h, i, j, k, l, m, n, o,
- 12, 14, 11, 11, 16, 11, 12, 14, 14, 10, 13, 12, 10, 19, 18, 12,
- //p, q, r, s, t, u, v, w, x, y, z, ??, ??, ??, ??, ??,
- 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,
- //ë, ì, í, î, ï, ò, ó, ô, ö, ù, ú, û, ü, Ñ, ñ, ¿,
- #ifdef FIX_BUGS
- 11, 10, 10, 10, 10, 12, 12, 12, 12, 15, 15, 15, 15, 22, 18, 21,
- #else
- 11, 10, 10, 10, 10, 12, 12, 12, 12, 15, 15, 15, 15, 24, 18, 21,
- #endif
- //i,BLANKS
- 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,
- //space, unprop
- 19, 16
- },
- {
- //FONT1 EFIGS
- //Characters with a '2' refer to the Pricedown font.
- //Characters that are referred as '*I' are characters that contain icons for PS2/XBOX, but contain regular characters on PC
- //in order to display them properly in the Keyboard controls menu.
- //!2,!, *I,(R), $, %, &, ', [, ], *I, +, , -, ., *I,
- 15, 7, 31, 25, 20, 23, 21, 7, 11, 10, 26, 14, 6, 12, 6, 26,
- //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, :, *I, *I, *I, *I, ?,
- 20, 7, 20, 20, 21, 20, 20, 19, 21, 20, 8, 30, 24, 30, 24, 19,
- //TM,A, B, C, D, E, F, G, H, I, J, K, L, M, N, O,
- 20, 22, 22, 21, 22, 18, 18, 22, 22, 9, 14, 21, 18, 27, 21, 24,
- //P, Q, R, S, T, U, V, W, X, Y, Z, *I, \, *I, ¡, °,
- #ifdef FIX_BUGS
- 22, 22, 23, 20, 19, 23, 22, 31, 23, 23, 21, 25, 13, 30, 7, 19,
- #else
- 22, 22, 23, 20, 19, 23, 22, 31, 23, 23, 21, 25, 13, 30, 10, 19,
- #endif
- //(C),a, b, c, d, e, f, g, h, i, j, k, l, m, n, o,
- 10, 17, 17, 16, 17, 17, 11, 17, 17, 7, 7, 18, 7, 25, 17, 17,
- //p, q, r, s, t, u, v, w, x, y, z, *I, *I, $2, (2, )2,
- 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,
- //ë, ì, í, î, ï, ò, ó, ô, ö, ù, ú, û, ü, Ñ, ñ, ¿,
- #ifdef FIX_BUGS
- 17, 11, 11, 15, 12, 17, 17, 17, 17, 17, 17, 17, 17, 21, 17, 19,
- #else
- 17, 11, 11, 15, 12, 17, 17, 17, 17, 17, 17, 17, 17, 19, 20, 20,
- #endif
- //02,12,22, 32, 42, 52, 62, 72, 82, 92, :2, A2, B2, C2, D2, E2,
- 20, 18, 19, 19, 21, 19, 19, 19, 19, 19, 16, 19, 19, 19, 20, 19,
- //F2,G2,H2, I2, J2, K2, L2, M2, N2, O2, P2, Q2, R2, S2, T2, U2,
- 16, 19, 19, 9, 19, 20, 14, 29, 19, 19, 19, 19, 19, 19, 21, 19,
- //V2,W2,X2, Y2, Z2, À2, Á2, Â2, Ä2, Æ2, Ç2, È2, É2, Ê2, Ë2, Ì2,
- 20, 32, 20, 19, 19, 19, 19, 19, 19, 29, 19, 19, 19, 19, 19, 9,
- //Í2,Î2,Ï2, Ò2, Ó2, Ô2, Ö2, Ù2, Ú2, Û2, Ü2, ß2, Ñ2, ¿2, '2, .2,
- #ifdef FIX_BUGS
- 9, 9, 9, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 10, 9,
- #else
- 9, 9, 9, 19, 19, 19, 19, 19, 19, 19, 19, 19, 21, 21, 10, 9,
- #endif
- //space, unprop
- 10, 20
- }
-
-#ifdef MORE_LANGUAGES
- },
- {
- {
- 5, 9, 9, 0, 17, 17, 23, 3, 21, 18, 0, 8, 3, 8, 3, 0,
- 16, 9, 16, 16, 15, 19, 15, 14, 17, 17, 4, 4, 0, 0, 0, 17,
- 19, 17, 19, 15, 21, 18, 19, 16, 21, 13, 15, 21, 20, 28, 21, 18,
- 22, 17, 21, 20, 18, 18, 20, 26, 22, 18, 18, 0, 8, 0, 9, 8,
- 0, 14, 11, 12, 16, 11, 13, 13, 15, 10, 14, 15, 11, 21, 17, 10,
- 20, 15, 12, 12, 16, 17, 13, 16, 13, 21, 11, 0, 0, 0, 0, 0,
- 20, 19, 19, 22, 27, 15, 18, 18, 20, 26, 21, 23, 17, 22, 21, 17,
- 26, 25, 26, 17, 20, 26, 17, 16, 11, 12, 13, 21, 11, 17, 17, 12,
- 21, 17, 17, 15, 24, 16, 10, 20, 23, 16, 7, 9, 16, 23, 12, 11,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19,
- 19, 16
- },
- {
- 11, 5, 10, 15, 19, 22, 20, 5, 9, 8, 11, 12, 5, 12, 6, 12,
- 19, 5, 18, 19, 20, 18, 19, 18, 20, 19, 5, 6, 26, 12, 30, 19,
- 23, 21, 20, 20, 20, 16, 16, 21, 19, 5, 13, 19, 16, 24, 20, 21,
- 20, 21, 20, 19, 17, 20, 21, 30, 22, 21, 20, 25, 13, 30, 5, 9,
- 10, 15, 15, 14, 15, 16, 10, 15, 15, 5, 5, 15, 5, 23, 15, 16,
- 15, 15, 9, 16, 10, 15, 17, 24, 18, 15, 15, 27, 5, 19, 2, 2,
- 20, 20, 16, 23, 30, 19, 20, 20, 21, 24, 19, 19, 20, 23, 22, 19,
- 27, 29, 25, 20, 20, 28, 24, 16, 16, 14, 19, 25, 16, 16, 16, 17,
- 19, 16, 16, 17, 25, 19, 15, 23, 26, 21, 16, 14, 22, 20, 16, 19,
- 15, 14, 15, 16, 17, 15, 15, 15, 15, 15, 7, 15, 15, 15, 15, 15,
- 13, 15, 15, 7, 15, 16, 13, 23, 15, 15, 15, 15, 15, 15, 17, 15,
- 16, 24, 17, 17, 17, 15, 15, 13, 20, 23, 15, 17, 17, 16, 24, 15,
- 15, 15, 23, 18, 15, 23, 26, 23, 16, 15, 23, 15, 15, 19, 2, 2,
- 10, 20
- },
- },
- {
- {
- //FONT2 EFIGS
- //SPC,!, $, %, &, ', [, ], +, , -, .,
- 12, 9, 22, 17, 19, 19, 25, 4, 33, 33, 25, 35, 11, 10, 6, 33,
- //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, :, ??,
- 18, 10, 17, 17, 17, 17, 17, 15, 12, 16, 5, 30, 30, 30, 30, 30,
- // A, B, C, D, E, F, G, H, I, J, K, L, M, N, O,
- 12, 16, 19, 16, 19, 18, 18, 17, 22, 11, 17, 18, 18, 30, 22, 19,
- //P, Q, R, S, T, U, V, W, X, Y, Z, ??, ??, ??, ¡, \,
- 22, 19, 19, 20, 18, 19, 19, 29, 19, 18, 19, 19, 33, 33, 10, 19,
- //??,a, b, c, d, e, f, g, h, i, j, k, l, m, n, o,
- 12, 14, 11, 11, 16, 11, 12, 14, 14, 10, 13, 12, 10, 19, 18, 12,
- //p, q, r, s, t, u, v, w, x, y, z, ??, ??, ??, ??, ??,
- 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, 22, 18, 21,
- //i,BLANKS
- 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,
- //space, unprop
- 19, 16
- },
- {
- //FONT1 EFIGS
- //Characters with a '2' refer to the Pricedown font.
- //Characters that are referred as '*I' are characters that contain icons for PS2/XBOX, but contain regular characters on PC
- //in order to display them properly in the Keyboard controls menu.
- //!2,!, *I,(R), $, %, &, ', [, ], *I, +, , -, ., *I,
- 15, 7, 31, 25, 20, 23, 21, 7, 11, 10, 26, 14, 6, 12, 6, 26,
- //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, :, *I, *I, *I, *I, ?,
- 20, 7, 20, 20, 21, 20, 20, 19, 21, 20, 8, 30, 24, 30, 24, 19,
- //TM,A, B, C, D, E, F, G, H, I, J, K, L, M, N, O,
- 20, 22, 22, 21, 22, 18, 18, 22, 22, 9, 14, 21, 18, 27, 21, 24,
- //P, Q, R, S, T, U, V, W, X, Y, Z, *I, \, *I, ¡, °,
- 22, 22, 23, 20, 19, 23, 22, 31, 23, 23, 21, 25, 13, 30, 7, 19,
- //(C),a, b, c, d, e, f, g, h, i, j, k, l, m, n, o,
- 10, 17, 17, 16, 17, 17, 11, 17, 17, 7, 7, 18, 7, 25, 17, 17,
- //p, q, r, s, t, u, v, w, x, y, z, *I, *I, $2, (2, )2,
- 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, 21, 17, 19,
- //02,12,22, 32, 42, 52, 62, 72, 82, 92, :2, A2, B2, C2, D2, E2,
- 20, 18, 19, 19, 21, 19, 19, 19, 19, 19, 16, 19, 19, 19, 20, 19,
- //F2,G2,H2, I2, J2, K2, L2, M2, N2, O2, P2, Q2, R2, S2, T2, U2,
- 16, 19, 19, 9, 19, 20, 14, 29, 19, 19, 19, 19, 19, 19, 21, 19,
- //V2,W2,X2, Y2, Z2, À2, Á2, Â2, Ä2, Æ2, Ç2, È2, É2, Ê2, Ë2, Ì2,
- 20, 32, 20, 19, 19, 19, 19, 19, 19, 29, 19, 19, 19, 19, 19, 9,
- //Í2,Î2,Ï2, Ò2, Ó2, Ô2, Ö2, Ù2, Ú2, Û2, Ü2, ß2, Ñ2, ¿2, '2, .2,
- 9, 9, 9, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 10, 9,
- //space, unprop
- 10, 20
- }
- }
-#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,
@@ -301,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);
@@ -355,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
+ }
+ */
#if !defined(GAMEPAD_MENU) && defined(BUTTON_ICONS)
// loaded in CMenuManager with GAMEPAD_MENU defined
@@ -418,8 +237,9 @@ CFont::ReloadFonts(uint8 set)
if (Slot != -1 && LanguageSet != set) {
Sprite[0].Delete();
Sprite[1].Delete();
+ Sprite[2].Delete();
if (IsJapanese())
- Sprite[2].Delete();
+ Sprite[3].Delete();
CTxdStore::PushCurrentTxd();
CTxdStore::RemoveTxd(Slot);
switch (set)
@@ -441,15 +261,19 @@ CFont::ReloadFonts(uint8 set)
CTxdStore::SetCurrentTxd(Slot);
Sprite[0].SetTexture("font2", "font2_mask");
if (set == FONT_LANGSET_JAPANESE) {
- Sprite[2].SetTexture("FONTJAP", "FONTJAP_mask");
+ Sprite[1].SetTexture("FONTJAP", "FONTJAP_mask");
+ Sprite[3].SetTexture("FONTJAP", "FONTJAP_mask");
}
- Sprite[1].SetTexture("font1", "font1_mask");
+ else
+ Sprite[1].SetTexture("pager", "pager_mask");
+ Sprite[2].SetTexture("font1", "font1_mask");
CTxdStore::PopCurrentTxd();
}
LanguageSet = set;
}
#endif
+//--TODO(LCS): gpFonts
void
CFont::Shutdown(void)
{
@@ -463,6 +287,7 @@ CFont::Shutdown(void)
#endif
Sprite[0].Delete();
Sprite[1].Delete();
+ Sprite[2].Delete();
#ifdef MORE_LANGUAGES
if (IsJapanese())
Sprite[3].Delete();
@@ -473,6 +298,7 @@ CFont::Shutdown(void)
#endif
}
+//--LCS: Done
void
CFont::InitPerFrame(void)
{
@@ -515,39 +341,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,
@@ -555,10 +381,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,
@@ -568,37 +397,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(
@@ -606,10 +411,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);
}
}
@@ -635,6 +440,7 @@ bool CFont::IsAnsiCharacter(wchar *s)
}
#endif
+//--LCS: TODO (mostly done but could use some checking)
void
CFont::RenderFontBuffer()
{
@@ -647,7 +453,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;
@@ -689,16 +495,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);
@@ -707,11 +512,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;
}
@@ -719,50 +524,8 @@ CFont::RenderFontBuffer()
FontRenderStatePointer.pRenderState = (CFontRenderState*)FontRenderStateBuf;
}
-#if 0 //def 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)
{
@@ -773,26 +536,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;
@@ -828,17 +603,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)
{
@@ -849,7 +625,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;
@@ -896,7 +673,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
float xleft = Details.centre ? xstart - x/2 :
Details.rightJustify ? xstart - x :
xstart;
-#if 0//def MORE_LANGUAGES
+#ifdef MORE_LANGUAGES
PrintString(xleft, y, start, s, spaceWidth, xstart);
#else
PrintString(xleft, y, Details.anonymous_25, start, s, spaceWidth);
@@ -934,7 +711,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
#endif
lineLength = x;
s = t+1;
-#if 0 //def MORE_LANGUAGES
+#ifdef MORE_LANGUAGES
if (IsJapaneseFont() && !*s) {
x += GetStringWidth(s);
if (IsAnsiCharacter(s))
@@ -966,7 +743,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
float xleft = Details.centre ? xstart - x/2 :
Details.rightJustify ? xstart - x :
xstart;
-#if 0 //def MORE_LANGUAGES
+#ifdef MORE_LANGUAGES
if (PrintString(xleft, y, start, s, 0.0f, xstart) && IsJapaneseFont()) {
start = s;
if (!Details.centre && !Details.rightJustify)
@@ -984,6 +761,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
}
}
+//--LCS: TODO
int
CFont::GetNumberLines(float xstart, float ystart, wchar *s)
{
@@ -992,7 +770,7 @@ CFont::GetNumberLines(float xstart, float ystart, wchar *s)
wchar *t;
n = 0;
-#if 0//def MORE_LANGUAGES
+#ifdef MORE_LANGUAGES
bool bSomeJapBool = false;
if (IsJapanese()) {
@@ -1085,6 +863,7 @@ CFont::GetNumberLines(float xstart, float ystart, wchar *s)
return n;
}
+//--LCS: TODO
void
CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s)
{
@@ -1190,101 +969,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 (!RenderState.proportional)
- return Size[0][Details.style][192];
- if (c <= 94 || Details.style == FONT_HEADING || RenderState.style == FONT_BANK) {
- switch (RenderState.style)
- {
- case FONT_JAPANESE:
- return Size_jp[c];
- default:
- return Size[0][RenderState.style][c];
- }
- }
-
- switch (RenderState.style)
- {
- case FONT_JAPANESE:
- return 29.4f;
- case FONT_BANK:
- return 10.0f;
- default:
- return Size[0][RenderState.style][c];
- }
+ switch (c)
+ {
+ case '!':
+ case '?':
+ case '.':
+ case ',':
+ case ':':
+ case ';':
+
+ // these are lucid it seems
+ //case '$':
+ //case '/':
+ //case '\\':
+ return true;
}
-
- else if (RenderState.proportional)
- return Size[LanguageSet][RenderState.style][c];
- else
- return Size[LanguageSet][RenderState.style][209];
-#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 (!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;
- }
- }
-
- switch (Details.style)
- {
- case FONT_JAPANESE:
- return 29.4f * Details.scaleX;
- case FONT_BANK:
- return 10.0f * Details.scaleX;
- default:
- return Size[0][Details.style][c] * Details.scaleX;
- }
- }
- else
+ if (RenderState.proportional || forceProportional)
{
- if (!Details.bFontHalfTexture && c == 30) c = 61; // wanted star
- if (Details.bFontHalfTexture)
- c = FindNewCharacter(c);
- if (Details.proportional)
- return Size[LanguageSet][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[LanguageSet][Details.style][209] * Details.scaleX;
+ return Size[RenderState.style][418] + FontSizeIncrementers[RenderState.style];
}
-#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)
{
@@ -1397,6 +1140,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)
{
@@ -1427,6 +1183,7 @@ CFont::GetNextSpace(wchar *s)
return s;
}
+//--LCS: done
wchar*
CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
{
@@ -1439,28 +1196,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;
@@ -1468,9 +1233,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;
@@ -1478,9 +1243,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;
@@ -1488,27 +1253,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;
@@ -1536,187 +1294,34 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
}
while (*s != '~')
++s;
- if (*(++s) == '~')
- s = ParseToken(s, color, flash, bold);
- return s;
-}
-#if 0//def 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 'H': PS2Symbol = BUTTON_RSTICK_UP; break;
- case 'L': PS2Symbol = BUTTON_RSTICK_DOWN; 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 'H': PS2Symbol = BUTTON_RSTICK_UP; break;
- case 'L': PS2Symbol = BUTTON_RSTICK_DOWN; 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)
{
@@ -1735,25 +1340,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)
{
@@ -1761,12 +1363,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)
{
@@ -1775,6 +1379,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)
{
@@ -1783,6 +1395,7 @@ CFont::SetJustifyOn(void)
Details.rightJustify = false;
}
+//--LCS: done
void
CFont::SetJustifyOff(void)
{
@@ -1790,6 +1403,7 @@ CFont::SetJustifyOff(void)
Details.rightJustify = false;
}
+//--LCS: done
void
CFont::SetCentreOn(void)
{
@@ -1798,54 +1412,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)
{
@@ -1854,6 +1479,7 @@ CFont::SetRightJustifyOn(void)
Details.centre = false;
}
+//--LCS: done
void
CFont::SetRightJustifyOff(void)
{
@@ -1862,70 +1488,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;
}
@@ -1935,4 +1609,4 @@ CFont::character_code(uint8 c)
if(c < 128)
return c;
return foreign_table[c-128];
-} \ No newline at end of file
+}