Skip to content

Commit 8956c54

Browse files
committed
Keep the glyph rendering changes to S;G only
1 parent 5140de7 commit 8956c54

1 file changed

Lines changed: 80 additions & 36 deletions

File tree

LanguageBarrier/GameText.cpp

Lines changed: 80 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ void integerToMagesGlyphs(int value, std::uint8_t* output, int digitCount,
771771
const char ch = text[start + i];
772772

773773
const std::uint16_t glyph =
774-
ch == ' ' ? (alternateSpace ? 0x8000 : 0x8000)
774+
ch == ' ' ? (alternateSpace ? 0x8001 : 0x8001)
775775
: static_cast<std::uint16_t>(0x8001 + ch - '0');
776776
*output++ = static_cast<std::uint8_t>(glyph >> 8);
777777
*output++ = static_cast<std::uint8_t>(glyph & 0xFF);
@@ -3187,12 +3187,20 @@ unsigned int sglbpGlyphMask(int textureId, int a2, float glyphInTextureStartX,
31873187
float glyphInTextureWidth,
31883188
float glyphInTextureHeight, float a7, float a8,
31893189
float a9, float a10, float a11, float a12,
3190-
signed int inColor, signed int opacity) {
3191-
constexpr float gutter = 1.5f;
3192-
const float x = glyphInTextureStartX + FONT_X_OFFSET - gutter;
3193-
const float y = glyphInTextureStartY + FONT_Y_OFFSET - gutter;
3194-
const float w = glyphInTextureWidth + 2.0f * gutter;
3195-
const float h = glyphInTextureHeight + 2.0f * gutter;
3190+
signed int inColor, signed int opacity) {
3191+
float x = glyphInTextureStartX + FONT_X_OFFSET;
3192+
float y = glyphInTextureStartY + FONT_Y_OFFSET;
3193+
float w = glyphInTextureWidth;
3194+
float h = glyphInTextureHeight;
3195+
3196+
if (currentGame == SG) {
3197+
constexpr float gutter = 1.5f;
3198+
x -= gutter;
3199+
y -= gutter;
3200+
w += 2.0f * gutter;
3201+
h += 2.0f * gutter;
3202+
}
3203+
31963204
return gameExeDrawLbpGlyphMaskReal(
31973205
textureId, a2, x, y, w, h, a7, a8, a9, a10, a11, a12, inColor, opacity);
31983206
}
@@ -3216,12 +3224,18 @@ int sg0DrawGlyphHook(int textureId, float glyphInTextureStartX,
32163224
}
32173225
}
32183226

3219-
constexpr float gutter = 1.5f;
3227+
float x = glyphInTextureStartX + FONT_X_OFFSET;
3228+
float y = glyphInTextureStartY + FONT_Y_OFFSET;
3229+
float w = glyphInTextureWidth;
3230+
float h = glyphInTextureHeight;
32203231

3221-
const float x = glyphInTextureStartX + FONT_X_OFFSET - gutter;
3222-
const float y = glyphInTextureStartY + FONT_Y_OFFSET - gutter;
3223-
const float w = glyphInTextureWidth + 2.0f * gutter;
3224-
const float h = glyphInTextureHeight + 2.0f * gutter;
3232+
if (currentGame == SG) {
3233+
constexpr float gutter = 1.5f;
3234+
x -= gutter;
3235+
y -= gutter;
3236+
w += 2.0f * gutter;
3237+
h += 2.0f * gutter;
3238+
}
32253239

32263240
return gameExeDrawGlyphReal(
32273241
textureId, x, y, w, h,
@@ -3241,11 +3255,18 @@ int rnDrawGlyphHook(int textureId, float glyphInTextureStartX,
32413255
// TextRendering::Instance().replaceFontSurface(glyphInTextureHeight);
32423256
}
32433257

3244-
constexpr float gutter = 1.5f;
3245-
const float x = glyphInTextureStartX - gutter;
3246-
const float y = glyphInTextureStartY - gutter;
3247-
const float w = glyphInTextureWidth + 2.0f * gutter;
3248-
const float h = glyphInTextureHeight + 2.0f * gutter;
3258+
float x = glyphInTextureStartX;
3259+
float y = glyphInTextureStartY;
3260+
float w = glyphInTextureWidth;
3261+
float h = glyphInTextureHeight;
3262+
3263+
if (currentGame == SG) {
3264+
constexpr float gutter = 1.5f;
3265+
x -= gutter;
3266+
y -= gutter;
3267+
w += 2.0f * gutter;
3268+
h += 2.0f * gutter;
3269+
}
32493270

32503271
return gameExeDrawGlyphReal(
32513272
textureId, x, y, w, h, displayStartX, displayStartY,
@@ -3390,18 +3411,25 @@ unsigned int sg0DrawGlyph2Hook(int textureId, int a2,
33903411
}
33913412
}
33923413

3393-
constexpr float gutter = 1.5f;
3394-
const float sx = glyphInTextureStartX - gutter;
3395-
const float sy = glyphInTextureStartY - gutter;
3396-
const float sw = glyphInTextureWidth + 2.0f * gutter;
3397-
const float sh = glyphInTextureHeight + 2.0f * gutter;
3414+
float sx = glyphInTextureStartX;
3415+
float sy = glyphInTextureStartY;
3416+
float sw = glyphInTextureWidth;
3417+
float sh = glyphInTextureHeight;
3418+
3419+
if (currentGame == SG) {
3420+
constexpr float gutter = 1.5f;
3421+
sx -= gutter;
3422+
sy -= gutter;
3423+
sw += 2.0f * gutter;
3424+
sh += 2.0f * gutter;
3425+
}
33983426

33993427
if (TextRendering::Get().enabled)
34003428
if (currentGame == RNE) {
34013429
return gameExeSg0DrawGlyph2Real(
3402-
TextRendering::Get().FONT_TEXTURE_ID, a2, sx / 1.5f,
3403-
sy / 1.5f, sw / 1.5f,
3404-
sh / 1.5f, a7 / 2.0f, a8 / 2.0f, a9 / 2.0f,
3430+
TextRendering::Get().FONT_TEXTURE_ID, a2, glyphInTextureStartX / 1.5f,
3431+
glyphInTextureStartY / 1.5f, glyphInTextureWidth / 1.5f,
3432+
glyphInTextureHeight / 1.5f, a7 / 2.0f, a8 / 2.0f, a9 / 2.0f,
34053433
a10 / 2.0f, a11 / 2.0f, a12 / 2.0f, inColor, opacity, a15, a16);
34063434
} else {
34073435
return gameExeSg0DrawGlyph2Real(
@@ -3422,12 +3450,20 @@ unsigned int sg0DrawGlyph3HookInt(int textureId, int maskTextureId,
34223450
int textureStartX, int textureStartY,
34233451
int textureSizeX, int textureSizeY,
34243452
int startPosX, int startPosY, int EndPosX,
3425-
int EndPosY, int color, int opacity) {
3426-
constexpr float gutter = 1.0f;
3427-
const float x = textureStartX + FONT_X_OFFSET - gutter;
3428-
const float y = textureStartY + FONT_Y_OFFSET - gutter;
3429-
const float w = textureSizeX + 2.0f * gutter;
3430-
const float h = textureSizeY + 2.0f * gutter;
3453+
int EndPosY, int color, int opacity) {
3454+
float x = (float)(textureStartX + FONT_X_OFFSET);
3455+
float y = (float)(textureStartY + FONT_Y_OFFSET);
3456+
float w = (float)textureSizeX;
3457+
float h = (float)textureSizeY;
3458+
3459+
if (currentGame == SG) {
3460+
constexpr float gutter = 1.0f;
3461+
x -= gutter;
3462+
y -= gutter;
3463+
w += 2.0f * gutter;
3464+
h += 2.0f * gutter;
3465+
}
3466+
34313467
return gameExeSg0DrawGlyph3_Int_Real(
34323468
textureId, maskTextureId, (int)x, (int)y, (int)w,
34333469
(int)h, startPosX, startPosY, EndPosX, EndPosY, color, opacity);
@@ -3439,11 +3475,19 @@ unsigned int sg0DrawGlyph3HookFloat(int textureId, int maskTextureId,
34393475
float startPosX, float startPosY,
34403476
float EndPosX, float EndPosY, int color,
34413477
int opacity) {
3442-
constexpr float gutter = 1.5f;
3443-
const float x = textureStartX + FONT_X_OFFSET - gutter;
3444-
const float y = textureStartY + FONT_Y_OFFSET - gutter;
3445-
const float w = textureSizeX + 2.0f * gutter;
3446-
const float h = textureSizeY + 2.0f * gutter;
3478+
float x = textureStartX + FONT_X_OFFSET;
3479+
float y = textureStartY + FONT_Y_OFFSET;
3480+
float w = textureSizeX;
3481+
float h = textureSizeY;
3482+
3483+
if (currentGame == SG) {
3484+
constexpr float gutter = 1.5f;
3485+
x -= gutter;
3486+
y -= gutter;
3487+
w += 2.0f * gutter;
3488+
h += 2.0f * gutter;
3489+
}
3490+
34473491
return gameExeSg0DrawGlyph3_Float_Real(
34483492
textureId, maskTextureId, x, y, w, h,
34493493
startPosX, startPosY, EndPosX, EndPosY, color, opacity);

0 commit comments

Comments
 (0)