From bfa166b2eb402e2b42ad44d33536611aa212b8c8 Mon Sep 17 00:00:00 2001 From: XProger Date: Sun, 31 Mar 2019 03:44:46 +0300 Subject: [PATCH] fix TR2/TR3 glyphs colorization for Japanese and Greek --- src/lang.h | 16 ++++++++-------- src/level.h | 2 ++ src/ui.h | 34 +++++++++++++++++++++++++++++++--- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/lang.h b/src/lang.h index 8047089..9fab55c 100644 --- a/src/lang.h +++ b/src/lang.h @@ -274,14 +274,14 @@ const char *helpText = "C - Look@" "R - Slow motion@" "T - Fast motion@" - "Roll - Up + Down@" - "Step Left - Walk + Left@" - "Step Right - Walk + Right@" - "Out of water - Up + Action@" - "Handstand - Up + Walk@" - "Swan dive - Up + Walk + Jump@" - "First Person View - Look + Action@" - "DOZY on - Look + Duck + Action + Jump@" + "Roll - Up & Down@" + "Step Left - Walk & Left@" + "Step Right - Walk & Right@" + "Out of water - Up & Action@" + "Handstand - Up & Walk@" + "Swan dive - Up & Walk & Jump@" + "First Person View - Look & Action@" + "DOZY on - Look & Duck & Action & Jump@" "DOZY off - Walk"; #include "lang/en.h" diff --git a/src/level.h b/src/level.h index c2daaa9..7034d4a 100644 --- a/src/level.h +++ b/src/level.h @@ -1582,9 +1582,11 @@ struct Level : IGame { atlasSprites = sAtlas->pack(true); atlasGlyphs = gAtlas->pack(false); + #ifdef _OS_3DS ASSERT(atlasRooms->width <= 1024 && atlasRooms->height <= 1024); ASSERT(atlasObjects->width <= 1024 && atlasObjects->height <= 1024); ASSERT(atlasSprites->width <= 1024 && atlasSprites->height <= 1024); + #endif delete[] tileData; tileData = NULL; diff --git a/src/ui.h b/src/ui.h index f055253..3f7f5e1 100644 --- a/src/ui.h +++ b/src/ui.h @@ -336,7 +336,14 @@ namespace UI { y -= getTextSize(text).y / 2; } - Color32 tColor, bColor, sColor = Color32(48, 12, 0, alpha); + Color32 tColor, bColor, sColor; + tColor = bColor = sColor = Color32(0, 0, 0, 255); + + switch (level->version & TR::VER_VERSION) { + case TR::VER_TR1 : sColor = Color32(48, 12, 0, alpha); break; + case TR::VER_TR2 : sColor = Color32(0, 49, 0, alpha); break; + case TR::VER_TR3 : sColor = shade == SHADE_ORANGE ? Color32(48, 12, 0, alpha) : Color32(12, 12, 12, alpha); break; + } char lastChar = 0; @@ -356,8 +363,29 @@ namespace UI { mesh->addDynSprite(index, short3(x , 1 + y - 1, 0), false, false, sColor, sColor, true); mesh->addDynSprite(index, short3(x , 1 + y + 1, 0), false, false, sColor, sColor, true); - tColor = Color32(252, 236, 136, alpha); - bColor = Color32(160, 104, 56, alpha); + switch (level->version & TR::VER_VERSION) { + case TR::VER_TR1 : + tColor = Color32(252, 236, 136, alpha); + bColor = Color32(160, 104, 56, alpha); + break; + case TR::VER_TR2 : + tColor = Color32(99, 189, 95, alpha); + bColor = Color32( 79, 152, 76, alpha); + break; + case TR::VER_TR3 : + if (shade == SHADE_NONE) { + tColor = Color32(255, 255, 255, alpha); + bColor = Color32(255, 255, 255, alpha); + } else if (shade == SHADE_ORANGE) { + tColor = Color32(255, 190, 90, alpha); + bColor = Color32(140, 50, 10, alpha); + } else if (shade == SHADE_GRAY) { + tColor = Color32(255, 255, 255, alpha); + bColor = Color32(128, 128, 128, alpha); + } + break; + } + mesh->addDynSprite(index, short3(x, 1 + y, 0), false, false, tColor, bColor, true); } x += getWideCharGlyphWidth(glyph);