Skip to content

Commit

Permalink
BLADERUNNER: Override original FONT and TRE
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniou79 committed Dec 11, 2018
1 parent 8a06213 commit 117a1d5
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
17 changes: 10 additions & 7 deletions engines/bladerunner/bladerunner.cpp
Expand Up @@ -357,6 +357,16 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {

_gameTime = new Time(this);

// Try to load the SUBTITLES.MIX first, before Startup.MIX
// allows overriding any identically named resources (such as the original font files and as a bonus also the TRE files for the UI and dialogue menu)
_subtitles = new Subtitles(this);
r = openArchive("SUBTITLES.MIX");
if (!r) {
_subtitles->setSubtitlesSystemInactive(true); // no subtitles support
}
_subtitles->init();


r = openArchive("STARTUP.MIX");
if (!r)
return false;
Expand Down Expand Up @@ -504,13 +514,6 @@ bool BladeRunnerEngine::startup(bool hasSavegames) {
_mainFont->open("KIA6PT.FON", 640, 480, -1, 0, 0x252D);
_mainFont->setSpacing(1, 0);

_subtitles = new Subtitles(this);
r = openArchive("SUBTITLES.MIX");
if (!r) {
_subtitles->setSubtitlesSystemInactive(true); // no subtitles support
}
_subtitles->init();

for (int i = 0; i != 43; ++i) {
Shape *shape = new Shape(this);
shape->open("SHAPES.SHP", i);
Expand Down
51 changes: 26 additions & 25 deletions engines/bladerunner/font.cpp
Expand Up @@ -68,31 +68,32 @@ bool Font::open(const Common::String &fileName, int screenWidth, int screenHeigh
_characters[i].width = stream->readUint32LE();
_characters[i].height = stream->readUint32LE();
_characters[i].dataOffset = stream->readUint32LE();
// special explicit alignment fixes for TAHOMA18 (INTERNAL) font
if (fileName == "TAHOMA18.FON") {
switch (i) {
case 46: // '-'
case 72: // G
case 74: // I
case 75: // J
_characters[i].x = 0; // original value was 1
break;
case 81: // P (ascii code 80 + 1)
_characters[i].x = 0; // original value was 1
_characters[i].y = 7; // original value was 6 -- bring them down for one (1) pixel
break;
case 83: // R
case 84: // S
case 86: // U
case 87: // V
case 88: // W
case 89: // X
case 90: // Y
case 91: // Z
_characters[i].y = 7; // original value was 6 -- bring them down for one (1) pixel
break;
}
}
// Commented out. Explicit fixes don't really make sense if we can override the TAHOMA18 font
// // special explicit alignment fixes for TAHOMA18 (INTERNAL) font
// if (fileName == "TAHOMA18.FON") {
// switch (i) {
// case 46: // '-'
// case 72: // G
// case 74: // I
// case 75: // J
// _characters[i].x -= 1; // original value was 1
// break;
// case 81: // P (ascii code 80 + 1)
// _characters[i].x -= 1; // original value was 1
// _characters[i].y += 1; // original value was 6 -- bring them down for one (1) pixel
// break;
// case 83: // R
// case 84: // S
// case 86: // U
// case 87: // V
// case 88: // W
// case 89: // X
// case 90: // Y
// case 91: // Z
// _characters[i].y += 1; // original value was 6 -- bring them down for one (1) pixel
// break;
// }
// }
//debug("char::%d character x: %d, y: %d, w: %d, h:%d, do: %d", i, _characters[i].x, _characters[i].y, _characters[i].width, _characters[i].height, _characters[i].dataOffset);
}
for (int i = 0; i < _dataSize; i++) {
Expand Down
4 changes: 2 additions & 2 deletions engines/bladerunner/ui/kia_section_settings.cpp
Expand Up @@ -122,8 +122,8 @@ void KIASectionSettings::draw(Graphics::Surface &surface) {
const char *textDark = _vm->_textOptions->getText(14);
const char *textLight = _vm->_textOptions->getText(15);
const char *textDesignersCut = _vm->_textOptions->getText(18);
// TODO REPLACE THIS STRING LITERAL MAYBE WITH A TEXT RESOURCE ITEM?
const char *textSubtitles = "Subtitles";
// Allow this to be loading as an extra text item in the resource for text options
const char *textSubtitles = strcmp(_vm->_textOptions->getText(42), "") == 0? "Subtitles" : _vm->_textOptions->getText(42); // +1 to the max of original index of textOptions which is 41

int posConversationChoices = 320 - _vm->_mainFont->getTextWidth(textConversationChoices) / 2;
int posMusic = 320 - _vm->_mainFont->getTextWidth(textMusic) / 2;
Expand Down

0 comments on commit 117a1d5

Please sign in to comment.