[Scummvm-git-logs] scummvm master -> a7cf349bf8f6d22f7d75a52608f0bd1f8e777f8f
AndywinXp
noreply at scummvm.org
Sun Nov 12 14:57:27 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a7cf349bf8 SCUMM: MI1 (SegaCD JAP)/INDY4 (DOS/Mac Jap): Fix multline text rendering
Commit: a7cf349bf8f6d22f7d75a52608f0bd1f8e777f8f
https://github.com/scummvm/scummvm/commit/a7cf349bf8f6d22f7d75a52608f0bd1f8e777f8f
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-11-12T15:57:19+01:00
Commit Message:
SCUMM: MI1 (SegaCD JAP)/INDY4 (DOS/Mac Jap): Fix multline text rendering
My intuition for MI1 Jap was correct, but the code had to be moved elsewhere.
This as a bonus finally yields pixel perfect positioning for text for INDY4 as well.
Changed paths:
engines/scumm/charset.cpp
engines/scumm/scumm.h
engines/scumm/string.cpp
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index b356aac84d1..ecca27e0047 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -92,10 +92,7 @@ void ScummEngine::loadCJKFont() {
_2byteWidth = _2byteHeight = 12;
_useCJKMode = true;
#endif
- } else if ((_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD && _language == Common::JA_JPN)
- || (_game.id == GID_INDY4 &&
- (_game.platform == Common::kPlatformMacintosh || _game.platform == Common::kPlatformDOS) &&
- _language == Common::JA_JPN)) {
+ } else if ((_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD && _language == Common::JA_JPN) || _isIndy4Jap) {
_2byteWidth = 16;
_2byteHeight = 16;
_useCJKMode = true;
@@ -249,8 +246,7 @@ byte *ScummEngine::get2byteCharPtr(int idx) {
idx = ((idx % 256) - 0xb0) * 94 + (idx / 256) - 0xa1;
break;
case Common::JA_JPN:
- if ((_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD)
- || (_game.id == GID_INDY4 && (_game.platform == Common::kPlatformMacintosh || _game.platform == Common::kPlatformDOS))) {
+ if ((_game.id == GID_MONKEY && _game.platform == Common::kPlatformSegaCD) || _isIndy4Jap) {
// init pointer to charset resource
if (_2byteFontPtr[0] == 0xFF) {
int charsetId = 5;
@@ -442,14 +438,11 @@ void CharsetRendererV3::setCurID(int32 id) {
int CharsetRendererCommon::getFontHeight() const {
bool isSegaCD = _vm->_game.platform == Common::kPlatformSegaCD;
- bool isIndyDOSJap = (_vm->_game.id == GID_INDY4 &&
- _vm->_game.platform == Common::kPlatformDOS &&
- _vm->_language == Common::JA_JPN);
-
- if (isSegaCD && _vm->_segaForce2ByteCharHeight) {
- return MAX(_vm->_2byteHeight, _fontHeight);
- } else if (isIndyDOSJap) {
- return _curId == 5 ? 14 : _fontHeight;
+
+ if (isSegaCD) {
+ return _vm->_force2ByteCharHeight ? _vm->_2byteHeight : _fontHeight;
+ } else if (_vm->_isIndy4Jap) {
+ return _vm->_force2ByteCharHeight ? 14 : _fontHeight;
} else if (_vm->_useCJKMode && !isSegaCD) {
return MAX(_vm->_2byteHeight + 1, _fontHeight);
} else {
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index c8853caced3..0c9596c1920 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1628,7 +1628,7 @@ public:
bool _useMultiFont = false;
int _numLoadedFont = 0;
int _2byteShadow = 0;
- bool _segaForce2ByteCharHeight = false;
+ bool _force2ByteCharHeight = false;
int _2byteHeight = 0;
int _2byteWidth = 0;
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index b16d68fd503..272c5f6599f 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -573,24 +573,7 @@ bool ScummEngine::newLine() {
} else if (!(_game.platform == Common::kPlatformFMTowns) && _string[0].height) {
_nextTop += _string[0].height;
} else {
- if (_game.platform == Common::kPlatformSegaCD && _useCJKMode) {
- // The JAP Sega CD version of Monkey Island 1 doesn't just calculate
- // the font height, but instead relies on the actual string height.
- // If the string contains at least a 2 byte character, then we signal it with
- // a flag, so that getFontHeight() can yield the correct result.
- for (int i = 0; _charsetBuffer[i]; i++) {
- // Handle the special 0xFAFD character, which actually is a 0x20 space char.
- if (_charsetBuffer[i] == 0xFD && _charsetBuffer[i + 1] == 0xFA) {
- i++;
- continue;
- }
-
- if (is2ByteCharacter(_language, _charsetBuffer[i])) {
- _segaForce2ByteCharHeight = true;
- break;
- }
- }
-
+ if ((_game.platform == Common::kPlatformSegaCD || _isIndy4Jap) && _useCJKMode) {
_nextTop += _charset->getFontHeight();
} else {
bool useCJK = _useCJKMode;
@@ -606,8 +589,6 @@ bool ScummEngine::newLine() {
_charset->_disableOffsX = true;
}
- _segaForce2ByteCharHeight = false;
-
return true;
}
@@ -850,6 +831,8 @@ void ScummEngine::CHARSET_1() {
if (!_haveMsg)
return;
+ _force2ByteCharHeight = false;
+
if (_game.version >= 4 && _game.version <= 6) {
// Do nothing while the camera is moving
if ((camera._dest.x / 8) != (camera._cur.x / 8) || camera._cur.x != camera._last.x)
@@ -1167,6 +1150,19 @@ void ScummEngine::CHARSET_1() {
byte *buffer = _charsetBuffer + _charsetBufPos;
c += *buffer++ * 256; //LE
_charsetBufPos = buffer - _charsetBuffer;
+
+ // The JAP Sega CD version of Monkey Island 1 doesn't just calculate
+ // the font height, but instead relies on the actual string height.
+ // If the string contains at least a 2 byte character, then we signal it with
+ // a flag, so that getFontHeight() can yield the correct result.
+ // It has been verified on the disasm for Indy4 Japanese DOS/V and Mac that
+ // this is the correct behavior for the latter game as well.
+ // Monkey Island 1 seems to have an exception for the 0xFAFD character, which
+ // is a space character with a two byte character height and width, but those
+ // dimensions apparently are never used, and the 0x20 character is used instead.
+ if (_game.platform != Common::kPlatformSegaCD || c != 0xFAFD) {
+ _force2ByteCharHeight = true;
+ }
}
}
if (_game.version <= 3) {
More information about the Scummvm-git-logs
mailing list