mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 17:30:00 +00:00
More fonts
This commit is contained in:
parent
3ebd08e38c
commit
95448eea3d
|
@ -8,6 +8,9 @@
|
||||||
#include "FileMgr.h"
|
#include "FileMgr.h"
|
||||||
#endif
|
#endif
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
#include "Frontend.h"
|
||||||
|
|
||||||
|
//--LCS: todo scaling (needs CSprite2d reversed), SuspendHandler, ReplaceGermanSZ, volatile mem, other todos
|
||||||
|
|
||||||
void
|
void
|
||||||
AsciiToUnicode(const char *src, wchar *dst)
|
AsciiToUnicode(const char *src, wchar *dst)
|
||||||
|
@ -125,6 +128,7 @@ int CFont::PS2Symbol = BUTTON_NONE;
|
||||||
int CFont::ButtonsSlot = -1;
|
int CFont::ButtonsSlot = -1;
|
||||||
#endif // BUTTON_ICONS
|
#endif // BUTTON_ICONS
|
||||||
|
|
||||||
|
//--TODO(LCS): volatile memory
|
||||||
void
|
void
|
||||||
CFont::Initialise(void)
|
CFont::Initialise(void)
|
||||||
{
|
{
|
||||||
|
@ -244,6 +248,7 @@ CFont::ReloadFonts(uint8 set)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//--TODO(LCS): gpFonts
|
||||||
void
|
void
|
||||||
CFont::Shutdown(void)
|
CFont::Shutdown(void)
|
||||||
{
|
{
|
||||||
|
@ -267,6 +272,7 @@ CFont::Shutdown(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: Done
|
||||||
void
|
void
|
||||||
CFont::InitPerFrame(void)
|
CFont::InitPerFrame(void)
|
||||||
{
|
{
|
||||||
|
@ -306,6 +312,7 @@ CFont::DrawButton(float x, float y)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//--LCS: TODO (mostly done but could use some checking)
|
||||||
void
|
void
|
||||||
CFont::PrintChar(float x, float y, wchar c)
|
CFont::PrintChar(float x, float y, wchar c)
|
||||||
{
|
{
|
||||||
|
@ -319,7 +326,9 @@ CFont::PrintChar(float x, float y, wchar c)
|
||||||
bDontPrint = c == '\0';
|
bDontPrint = c == '\0';
|
||||||
float w = GetCharacterWidth(c) / 32.0f;
|
float w = GetCharacterWidth(c) / 32.0f;
|
||||||
|
|
||||||
// TODO (LCS): bit here
|
if ( !RenderState.proportional && RenderState.rightJustify )
|
||||||
|
x += (GetCharacterWidth(c) - GetCharacterWidth(c, true)) * RenderState.scaleX;
|
||||||
|
|
||||||
if (Details.bFontHalfTexture && c == 208)
|
if (Details.bFontHalfTexture && c == 208)
|
||||||
c = '\0';
|
c = '\0';
|
||||||
|
|
||||||
|
@ -327,15 +336,12 @@ CFont::PrintChar(float x, float y, wchar c)
|
||||||
float xoff = c % 16;
|
float xoff = c % 16;
|
||||||
float yoff = c / 16;
|
float yoff = c / 16;
|
||||||
|
|
||||||
|
// small float modifiers were left for pc
|
||||||
|
|
||||||
if(RenderState.style == FONT_BANK || RenderState.style == FONT_STANDARD){
|
if(RenderState.style == FONT_BANK || RenderState.style == FONT_STANDARD){
|
||||||
// TODO (LCS): bit here
|
|
||||||
if (bDontPrint) return;
|
if (bDontPrint) return;
|
||||||
if (RenderState.slant == 0.0f) {
|
if (RenderState.slant == 0.0f) {
|
||||||
#ifdef FIX_BUGS
|
|
||||||
if (c < 192) {
|
if (c < 192) {
|
||||||
#else
|
|
||||||
if (c < 193) {
|
|
||||||
#endif
|
|
||||||
CSprite2d::AddToBuffer(
|
CSprite2d::AddToBuffer(
|
||||||
CRect(x, y,
|
CRect(x, y,
|
||||||
x + 32.0f * RenderState.scaleX * 0.96f,
|
x + 32.0f * RenderState.scaleX * 0.96f,
|
||||||
|
@ -346,10 +352,13 @@ CFont::PrintChar(float x, float y, wchar c)
|
||||||
xoff / 16.0f, (yoff + 1.0f) / 12.8f - 0.0021f,
|
xoff / 16.0f, (yoff + 1.0f) / 12.8f - 0.0021f,
|
||||||
(xoff + 1.0f) / 16.0f - 0.001f, (yoff + 1.0f) / 12.8f - 0.0021f);
|
(xoff + 1.0f) / 16.0f - 0.001f, (yoff + 1.0f) / 12.8f - 0.0021f);
|
||||||
} else {
|
} else {
|
||||||
|
float xScale = 0.54f;
|
||||||
|
if (FrontEndMenuManager.m_PrefsUseWideScreen)
|
||||||
|
xScale = 0.486f;
|
||||||
CSprite2d::AddToBuffer(
|
CSprite2d::AddToBuffer(
|
||||||
CRect(x, y,
|
CRect(x, y + RenderState.scaleY * 4.0f,
|
||||||
x + 32.0f * RenderState.scaleX * 0.96f,
|
x + 32.0f * RenderState.scaleY * xScale * 0.96f,
|
||||||
y + 33.0f * RenderState.scaleY * 0.5f),
|
y + 4.0f * RenderState.scaleY * + 16.0f * RenderState.scaleY),
|
||||||
RenderState.color,
|
RenderState.color,
|
||||||
xoff / 16.0f, yoff / 12.8f + 0.0021f,
|
xoff / 16.0f, yoff / 12.8f + 0.0021f,
|
||||||
(xoff + 1.0f) / 16.0f - 0.001f, yoff / 12.8f + 0.0021f,
|
(xoff + 1.0f) / 16.0f - 0.001f, yoff / 12.8f + 0.0021f,
|
||||||
|
@ -402,6 +411,7 @@ bool CFont::IsAnsiCharacter(wchar *s)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//--LCS: TODO (mostly done but could use some checking)
|
||||||
void
|
void
|
||||||
CFont::RenderFontBuffer()
|
CFont::RenderFontBuffer()
|
||||||
{
|
{
|
||||||
|
@ -414,7 +424,7 @@ CFont::RenderFontBuffer()
|
||||||
bool bFlash = false;
|
bool bFlash = false;
|
||||||
|
|
||||||
Sprite[RenderState.style].SetRenderState();
|
Sprite[RenderState.style].SetRenderState();
|
||||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); // TODO: not in lcs
|
||||||
RenderState = *(CFontRenderState*)&FontRenderStateBuf[0];
|
RenderState = *(CFontRenderState*)&FontRenderStateBuf[0];
|
||||||
textPosX = RenderState.fTextPosX;
|
textPosX = RenderState.fTextPosX;
|
||||||
textPosY = RenderState.fTextPosY;
|
textPosY = RenderState.fTextPosY;
|
||||||
|
@ -456,16 +466,15 @@ CFont::RenderFontBuffer()
|
||||||
}
|
}
|
||||||
Details.color.alpha = Details.bFlashState ? 0 : 255;
|
Details.color.alpha = Details.bFlashState ? 0 : 255;
|
||||||
}
|
}
|
||||||
if (!RenderState.bIsShadow)
|
if (!RenderState.bIsShadow && !RenderState.bOutlineOn)
|
||||||
RenderState.color = color;
|
RenderState.color = color;
|
||||||
}
|
}
|
||||||
wchar c = *pRenderStateBufPointer.pStr;
|
wchar c = *pRenderStateBufPointer.pStr;
|
||||||
c -= ' ';
|
c -= ' ';
|
||||||
|
if (c == 200) c = '^';
|
||||||
|
if (c == 201) c = '>';
|
||||||
if (RenderState.bFontHalfTexture)
|
if (RenderState.bFontHalfTexture)
|
||||||
c = FindNewCharacter(c);
|
c = FindNewCharacter(c);
|
||||||
else if (c > 155)
|
|
||||||
c = '\0';
|
|
||||||
|
|
||||||
if (RenderState.slant != 0.0f)
|
if (RenderState.slant != 0.0f)
|
||||||
textPosY = (RenderState.slantRefX - textPosX) * RenderState.slant + RenderState.slantRefY;
|
textPosY = (RenderState.slantRefX - textPosX) * RenderState.slant + RenderState.slantRefY;
|
||||||
PrintChar(textPosX, textPosY, c);
|
PrintChar(textPosX, textPosY, c);
|
||||||
|
@ -474,11 +483,11 @@ CFont::RenderFontBuffer()
|
||||||
PrintChar(textPosX + 2.0f, textPosY, c);
|
PrintChar(textPosX + 2.0f, textPosY, c);
|
||||||
textPosX += 2.0f;
|
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);
|
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')
|
if (c == '\0')
|
||||||
textPosX += RenderState.fExtraSpace;
|
textPosX += RenderState.fExtraSpace;
|
||||||
}
|
}
|
||||||
|
@ -486,6 +495,8 @@ CFont::RenderFontBuffer()
|
||||||
FontRenderStatePointer.pRenderState = (CFontRenderState*)FontRenderStateBuf;
|
FontRenderStatePointer.pRenderState = (CFontRenderState*)FontRenderStateBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--LCS: TODO
|
||||||
void
|
void
|
||||||
CFont::PrintString(float x, float y, uint32, wchar *start, wchar *end, float spwidth)
|
CFont::PrintString(float x, float y, uint32, wchar *start, wchar *end, float spwidth)
|
||||||
{
|
{
|
||||||
|
@ -496,24 +507,36 @@ CFont::PrintString(float x, float y, uint32, wchar *start, wchar *end, float spw
|
||||||
RenderState.style = Details.style;
|
RenderState.style = Details.style;
|
||||||
}
|
}
|
||||||
|
|
||||||
float dropShadowPosition = Details.dropShadowPosition;
|
if (Details.outlineColor.a != 0) {
|
||||||
if (dropShadowPosition != 0.0f && (Details.style == FONT_BANK || Details.style == FONT_STANDARD)) {
|
|
||||||
CRGBA color = Details.color;
|
CRGBA color = Details.color;
|
||||||
Details.color = Details.dropColor;
|
Details.color = Details.outlineColor;
|
||||||
|
Details.bOutlineOn = true;
|
||||||
|
Details.outlineColor.a = 0;
|
||||||
Details.dropShadowPosition = 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;
|
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 (FontRenderStatePointer.pStr >= (wchar*)&FontRenderStateBuf[ARRAY_SIZE(FontRenderStateBuf)] - (end - start + 26)) // why 26?
|
||||||
RenderFontBuffer();
|
RenderFontBuffer();
|
||||||
|
@ -552,16 +575,17 @@ CFont::PrintString(float x, float y, uint32, wchar *start, wchar *end, float spw
|
||||||
FontRenderStatePointer.Align();
|
FontRenderStatePointer.Align();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LCS: Done
|
||||||
void
|
void
|
||||||
CFont::PrintStringFromBottom(float x, float y, wchar *str)
|
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)
|
if (Details.slant != 0.0f)
|
||||||
y -= ((Details.slantRefX - x) * Details.slant + Details.slantRefY);
|
y -= ((Details.slantRefX - x) * Details.slant + Details.slantRefY);
|
||||||
PrintString(x, y, str);
|
PrintString(x, y, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: TODO
|
||||||
void
|
void
|
||||||
CFont::PrintString(float xstart, float ystart, wchar *s)
|
CFont::PrintString(float xstart, float ystart, wchar *s)
|
||||||
{
|
{
|
||||||
|
@ -572,7 +596,8 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
|
||||||
bool first;
|
bool first;
|
||||||
wchar *start, *t;
|
wchar *start, *t;
|
||||||
|
|
||||||
Details.bFlash = false;
|
CRGBA outlineColor = Details.outlineColor;
|
||||||
|
CFont::SetFlashOff();
|
||||||
|
|
||||||
if(*s == '*')
|
if(*s == '*')
|
||||||
return;
|
return;
|
||||||
|
@ -707,6 +732,7 @@ CFont::PrintString(float xstart, float ystart, wchar *s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: TODO
|
||||||
int
|
int
|
||||||
CFont::GetNumberLines(float xstart, float ystart, wchar *s)
|
CFont::GetNumberLines(float xstart, float ystart, wchar *s)
|
||||||
{
|
{
|
||||||
|
@ -808,6 +834,7 @@ CFont::GetNumberLines(float xstart, float ystart, wchar *s)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: TODO
|
||||||
void
|
void
|
||||||
CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s)
|
CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s)
|
||||||
{
|
{
|
||||||
|
@ -913,27 +940,32 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
bool IsPunctuation(wchar c)
|
bool IsPunctuation(wchar c)
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case '!':
|
case '!':
|
||||||
case '$':
|
|
||||||
case ',':
|
|
||||||
case '.':
|
|
||||||
case '/':
|
|
||||||
case ':':
|
|
||||||
case '?':
|
case '?':
|
||||||
case '\\':
|
case '.':
|
||||||
|
case ',':
|
||||||
|
case ':':
|
||||||
|
case ';':
|
||||||
|
|
||||||
|
// these are lucid it seems
|
||||||
|
//case '$':
|
||||||
|
//case '/':
|
||||||
|
//case '\\':
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
float
|
float
|
||||||
CFont::GetCharacterWidth(wchar c)
|
CFont::GetCharacterWidth(wchar c, bool forceProportional)
|
||||||
{
|
{
|
||||||
if (RenderState.proportional)
|
if (RenderState.proportional || forceProportional)
|
||||||
{
|
{
|
||||||
float inc = c < 192 ? 0.0f : 4.0f;
|
float inc = c < 192 ? 0.0f : 4.0f;
|
||||||
return Size[RenderState.style][c] + Size[RenderState.style][c + 209] + FontSizeIncrementers[RenderState.style] + inc;
|
return Size[RenderState.style][c] + Size[RenderState.style][c + 209] + FontSizeIncrementers[RenderState.style] + inc;
|
||||||
|
@ -945,6 +977,7 @@ CFont::GetCharacterWidth(wchar c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
float
|
float
|
||||||
CFont::GetCharacterSize(wchar c)
|
CFont::GetCharacterSize(wchar c)
|
||||||
{
|
{
|
||||||
|
@ -965,6 +998,7 @@ CFont::GetCharacterSize(wchar c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: TODO
|
||||||
float
|
float
|
||||||
CFont::GetStringWidth(wchar *s, bool spaces)
|
CFont::GetStringWidth(wchar *s, bool spaces)
|
||||||
{
|
{
|
||||||
|
@ -1077,6 +1111,19 @@ CFont::GetStringWidth_Jap(wchar* s)
|
||||||
}
|
}
|
||||||
#endif
|
#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*
|
wchar*
|
||||||
CFont::GetNextSpace(wchar *s)
|
CFont::GetNextSpace(wchar *s)
|
||||||
{
|
{
|
||||||
|
@ -1107,6 +1154,7 @@ CFont::GetNextSpace(wchar *s)
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
wchar*
|
wchar*
|
||||||
CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
|
CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
|
||||||
{
|
{
|
||||||
|
@ -1136,16 +1184,19 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
|
||||||
color.r = 75;
|
color.r = 75;
|
||||||
color.g = 151;
|
color.g = 151;
|
||||||
color.b = 75;
|
color.b = 75;
|
||||||
|
Details.anonymous_23 = true;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
color.r = 255;
|
color.r = 255;
|
||||||
color.g = 255;
|
color.g = 255;
|
||||||
color.b = 255;
|
color.b = 255;
|
||||||
|
Details.anonymous_23 = true;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
color.r = 0;
|
color.r = 0;
|
||||||
color.g = 0;
|
color.g = 0;
|
||||||
color.b = 0;
|
color.b = 0;
|
||||||
|
Details.anonymous_23 = true;
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
color.r = 229;
|
color.r = 229;
|
||||||
|
@ -1176,6 +1227,7 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
|
||||||
color.r = 225;
|
color.r = 225;
|
||||||
color.g = 225;
|
color.g = 225;
|
||||||
color.b = 225;
|
color.b = 225;
|
||||||
|
Details.anonymous_23 = true;
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
color.r = 132;
|
color.r = 132;
|
||||||
|
@ -1211,122 +1263,34 @@ CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
|
||||||
}
|
}
|
||||||
while (*s != '~')
|
while (*s != '~')
|
||||||
++s;
|
++s;
|
||||||
if (*(++s) == '~')
|
|
||||||
s = ParseToken(s, color, flash, bold);
|
// seem to be gone in lcs
|
||||||
|
//if (*(++s) == '~')
|
||||||
|
// s = ParseToken(s, color, flash, bold);
|
||||||
|
|
||||||
|
// wtf?
|
||||||
|
if (*s == '\0') s++;
|
||||||
|
s++;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MORE_LANGUAGES
|
//--LCS: done
|
||||||
wchar*
|
|
||||||
CFont::ParseToken(wchar *s, bool japShit)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
wchar*
|
wchar*
|
||||||
CFont::ParseToken(wchar *s)
|
CFont::ParseToken(wchar *s)
|
||||||
{
|
{
|
||||||
Details.anonymous_23 = false;
|
bool flash = false;
|
||||||
s++;
|
bool bold = false;
|
||||||
if(Details.color.r || Details.color.g || Details.color.b)
|
CRGBA color = Details.color;
|
||||||
switch(*s){
|
s = ParseToken(s, color, flash, bold);
|
||||||
case 'B':
|
Details.bFlash = flash;
|
||||||
Details.bBold = !Details.bBold;
|
Details.bBold = bold;
|
||||||
break;
|
|
||||||
case 'N':
|
if (Details.anonymous_23)
|
||||||
case 'n':
|
Details.color = color;
|
||||||
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': SetColor(CRGBA(0, 207, 133, 255)); Details.anonymous_23 = true; break;
|
|
||||||
case 'h': SetColor(CRGBA(255, 255, 255, 255)); Details.anonymous_23 = true; break;
|
|
||||||
case 'l': SetColor(CRGBA(0, 0, 0, 255)); Details.anonymous_23 = true; break;
|
|
||||||
case 'o': SetColor(CRGBA(229, 125, 126, 255)); Details.anonymous_23 = true; break;
|
|
||||||
case 'p': SetColor(CRGBA(168, 110, 252, 255)); Details.anonymous_23 = true; break;
|
|
||||||
case 'q': SetColor(CRGBA(199, 144, 203, 255)); Details.anonymous_23 = true; break;
|
|
||||||
case 'r': SetColor(CRGBA(255, 72, 77, 255)); Details.anonymous_23 = true; break;
|
|
||||||
case 't': SetColor(CRGBA(86, 212, 146, 255)); Details.anonymous_23 = true; break;
|
|
||||||
case 'w': SetColor(CRGBA(225, 225, 225, 255)); Details.anonymous_23 = true; break;
|
|
||||||
case 'x': SetColor(CRGBA(132, 146, 197, 255)); Details.anonymous_23 = true; break;
|
|
||||||
case 'y': SetColor(CRGBA(255, 227, 79, 255)); 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);
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::FilterOutTokensFromString(wchar *str)
|
CFont::FilterOutTokensFromString(wchar *str)
|
||||||
{
|
{
|
||||||
|
@ -1345,12 +1309,14 @@ CFont::FilterOutTokensFromString(wchar *str)
|
||||||
str[newIdx] = '\0';
|
str[newIdx] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::DrawFonts(void)
|
CFont::DrawFonts(void)
|
||||||
{
|
{
|
||||||
RenderFontBuffer();
|
RenderFontBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetScale(float x, float y)
|
CFont::SetScale(float x, float y)
|
||||||
{
|
{
|
||||||
|
@ -1358,6 +1324,7 @@ CFont::SetScale(float x, float y)
|
||||||
Details.scaleY = y;
|
Details.scaleY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetSlantRefPoint(float x, float y)
|
CFont::SetSlantRefPoint(float x, float y)
|
||||||
{
|
{
|
||||||
|
@ -1365,12 +1332,14 @@ CFont::SetSlantRefPoint(float x, float y)
|
||||||
Details.slantRefY = y;
|
Details.slantRefY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetSlant(float s)
|
CFont::SetSlant(float s)
|
||||||
{
|
{
|
||||||
Details.slant = s;
|
Details.slant = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetColor(CRGBA col)
|
CFont::SetColor(CRGBA col)
|
||||||
{
|
{
|
||||||
|
@ -1379,8 +1348,14 @@ CFont::SetColor(CRGBA col)
|
||||||
Details.color.a *= Details.alphaFade / 255.0f;
|
Details.color.a *= Details.alphaFade / 255.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
|
void
|
||||||
|
CFont::SetFlashOff()
|
||||||
|
{
|
||||||
|
Details.bFlash = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetJustifyOn(void)
|
CFont::SetJustifyOn(void)
|
||||||
{
|
{
|
||||||
|
@ -1389,6 +1364,7 @@ CFont::SetJustifyOn(void)
|
||||||
Details.rightJustify = false;
|
Details.rightJustify = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetJustifyOff(void)
|
CFont::SetJustifyOff(void)
|
||||||
{
|
{
|
||||||
|
@ -1396,6 +1372,7 @@ CFont::SetJustifyOff(void)
|
||||||
Details.rightJustify = false;
|
Details.rightJustify = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetCentreOn(void)
|
CFont::SetCentreOn(void)
|
||||||
{
|
{
|
||||||
|
@ -1404,53 +1381,65 @@ CFont::SetCentreOn(void)
|
||||||
Details.rightJustify = false;
|
Details.rightJustify = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetCentreOff(void)
|
CFont::SetCentreOff(void)
|
||||||
{
|
{
|
||||||
Details.centre = false;
|
Details.centre = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: TODO
|
||||||
void
|
void
|
||||||
CFont::SetWrapx(float x)
|
CFont::SetWrapx(float x)
|
||||||
{
|
{
|
||||||
|
// uncomment when scaling is done
|
||||||
|
//x = clamp(x, 0.0f, DEFAULT_SCREEN_WIDTH);
|
||||||
Details.wrapX = x;
|
Details.wrapX = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetCentreSize(float s)
|
CFont::SetCentreSize(float s)
|
||||||
{
|
{
|
||||||
Details.centreSize = s;
|
Details.centreSize = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetBackgroundOn(void)
|
CFont::SetBackgroundOn(void)
|
||||||
{
|
{
|
||||||
Details.background = true;
|
Details.background = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetBackgroundOff(void)
|
CFont::SetBackgroundOff(void)
|
||||||
{
|
{
|
||||||
Details.background = false;
|
Details.background = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetBackgroundColor(CRGBA col)
|
CFont::SetBackgroundColor(CRGBA col)
|
||||||
{
|
{
|
||||||
Details.backgroundColor = col;
|
Details.backgroundColor = col;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetBackGroundOnlyTextOn(void)
|
CFont::SetBackGroundOnlyTextOn(void)
|
||||||
{
|
{
|
||||||
Details.backgroundOnlyText = true;
|
Details.backgroundOnlyText = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetBackGroundOnlyTextOff(void)
|
CFont::SetBackGroundOnlyTextOff(void)
|
||||||
{
|
{
|
||||||
Details.backgroundOnlyText = false;
|
Details.backgroundOnlyText = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetRightJustifyOn(void)
|
CFont::SetRightJustifyOn(void)
|
||||||
{
|
{
|
||||||
|
@ -1459,6 +1448,7 @@ CFont::SetRightJustifyOn(void)
|
||||||
Details.centre = false;
|
Details.centre = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetRightJustifyOff(void)
|
CFont::SetRightJustifyOff(void)
|
||||||
{
|
{
|
||||||
|
@ -1467,18 +1457,21 @@ CFont::SetRightJustifyOff(void)
|
||||||
Details.centre = false;
|
Details.centre = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetPropOff(void)
|
CFont::SetPropOff(void)
|
||||||
{
|
{
|
||||||
Details.proportional = false;
|
Details.proportional = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetPropOn(void)
|
CFont::SetPropOn(void)
|
||||||
{
|
{
|
||||||
Details.proportional = true;
|
Details.proportional = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetFontStyle(int16 style)
|
CFont::SetFontStyle(int16 style)
|
||||||
{
|
{
|
||||||
|
@ -1492,24 +1485,29 @@ CFont::SetFontStyle(int16 style)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetRightJustifyWrap(float wrap)
|
CFont::SetRightJustifyWrap(float wrap)
|
||||||
{
|
{
|
||||||
Details.rightJustifyWrap = wrap;
|
Details.rightJustifyWrap = wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetAlphaFade(float fade)
|
CFont::SetAlphaFade(float fade)
|
||||||
{
|
{
|
||||||
Details.alphaFade = fade;
|
Details.alphaFade = fade;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--LCS: done
|
||||||
void
|
void
|
||||||
CFont::SetDropColor(CRGBA col)
|
CFont::SetDropColor(CRGBA col)
|
||||||
{
|
{
|
||||||
Details.dropColor = col;
|
Details.dropColor = col;
|
||||||
if (Details.alphaFade < 255.0f)
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,9 @@ struct CFontRenderState
|
||||||
bool8 proportional;
|
bool8 proportional;
|
||||||
bool8 anonymous_14;
|
bool8 anonymous_14;
|
||||||
int16 style;
|
int16 style;
|
||||||
|
int bOutlineOn;
|
||||||
|
int line;
|
||||||
|
bool8 rightJustify;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CSprite2d;
|
class CSprite2d;
|
||||||
|
@ -146,7 +149,6 @@ public:
|
||||||
static void PrintChar(float x, float y, wchar c);
|
static void PrintChar(float x, float y, wchar c);
|
||||||
static void PrintString(float x, float y, wchar *s);
|
static void PrintString(float x, float y, wchar *s);
|
||||||
#ifdef XBOX_SUBTITLES
|
#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);
|
static void PrintOutlinedString(float x, float y, wchar *str, float outlineStrength, bool fromBottom, CRGBA outlineColor);
|
||||||
#endif
|
#endif
|
||||||
static int GetNumberLines(float xstart, float ystart, wchar *s);
|
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);
|
static void PrintString(float x, float y, uint32, wchar *start, wchar *end, float spwidth);
|
||||||
#endif
|
#endif
|
||||||
static void PrintStringFromBottom(float x, float y, wchar *str);
|
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 GetCharacterSize(wchar c);
|
||||||
static float GetStringWidth(wchar *s, bool spaces = false);
|
static float GetStringWidth(wchar *s, bool spaces = false);
|
||||||
#ifdef MORE_LANGUAGES
|
#ifdef MORE_LANGUAGES
|
||||||
|
@ -189,6 +191,7 @@ public:
|
||||||
static void SetBackgroundOff(void);
|
static void SetBackgroundOff(void);
|
||||||
static void SetBackGroundOnlyTextOn(void);
|
static void SetBackGroundOnlyTextOn(void);
|
||||||
static void SetBackGroundOnlyTextOff(void);
|
static void SetBackGroundOnlyTextOff(void);
|
||||||
|
static void SetFlashOff(void);
|
||||||
static void SetPropOn(void);
|
static void SetPropOn(void);
|
||||||
static void SetPropOff(void);
|
static void SetPropOff(void);
|
||||||
static void SetFontStyle(int16 style);
|
static void SetFontStyle(int16 style);
|
||||||
|
@ -205,6 +208,7 @@ public:
|
||||||
|
|
||||||
static int16 FindNewCharacter(int16 c);
|
static int16 FindNewCharacter(int16 c);
|
||||||
static void FilterOutTokensFromString(wchar*);
|
static void FilterOutTokensFromString(wchar*);
|
||||||
|
static bool16 CheckNewLine(wchar *s);
|
||||||
#ifdef MORE_LANGUAGES
|
#ifdef MORE_LANGUAGES
|
||||||
static void ReloadFonts(uint8 set);
|
static void ReloadFonts(uint8 set);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue