[Scummvm-git-logs] scummvm master -> 003be954ea50cfb5473cc73ae1b4980fdac955f0
AndywinXp
noreply at scummvm.org
Sun Nov 12 13:39:54 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:
003be954ea SCUMM: INDY4 (DOS/Mac Jap): Fix verb text height, kerning and banner text positioning
Commit: 003be954ea50cfb5473cc73ae1b4980fdac955f0
https://github.com/scummvm/scummvm/commit/003be954ea50cfb5473cc73ae1b4980fdac955f0
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-11-12T14:39:46+01:00
Commit Message:
SCUMM: INDY4 (DOS/Mac Jap): Fix verb text height, kerning and banner text positioning
Changed paths:
engines/scumm/charset.cpp
engines/scumm/gfx_gui.cpp
engines/scumm/scumm.cpp
engines/scumm/scumm.h
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index f83ac38b8d2..b356aac84d1 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -542,6 +542,14 @@ int CharsetRenderer::getStringWidth(int arg, const byte *text) {
// This strange character conversion is the exact way the original does it here.
// This is the only way to get an accurate text formatting in the MI1 intro.
chr = (int8)text[pos++] | (chr << 8);
+ } else if (_vm->_isIndy4Jap) {
+ if (checkSJISCode(chr)) {
+ chr = text[pos++] | (chr << 8);
+ if (chr >= 256) {
+ width += 15;
+ continue;
+ }
+ }
} else if (chr & 0x80) {
if (_vm->_game.platform == Common::kPlatformSegaCD) {
// Special character: this one has to be rendered as a space (0x20)
@@ -741,10 +749,7 @@ void CharsetRendererPC::drawBits1(Graphics::Surface &dest, int x, int y, const b
int pitch = dest.pitch - width * dest.format.bytesPerPixel;
byte *dst2 = dst + dest.pitch;
- bool isIndy4Jap = _vm->_game.id == GID_INDY4 && _vm->_language == Common::JA_JPN &&
- (_vm->_game.platform == Common::kPlatformDOS || _vm->_game.platform == Common::kPlatformMacintosh);
-
- if (isIndy4Jap) {
+ if (_vm->_isIndy4Jap) {
// Characters allow shadows only if this is the main virtual screen, and we are not drawing
// a message on a GUI banner. The main menu is fine though, and allows shadows as well.
bool canDrawShadow = _vm->findVirtScreen(_top)->number == kMainVirtScreen && !_vm->isMessageBannerActive();
@@ -763,7 +768,7 @@ void CharsetRendererPC::drawBits1(Graphics::Surface &dest, int x, int y, const b
// Mac and DOS/V versions of Japanese INDY4 don't
// draw a shadow pixel below the first pixel.
// Verified from disasm.
- if (!isIndy4Jap)
+ if (!_vm->_isIndy4Jap)
dst2[0] = _shadowColor;
} else if (_shadowType == kHorizontalShadowType) {
dst[1] = _shadowColor;
@@ -1125,17 +1130,18 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) {
// used as character widths (e.g. 13, 15, 16), but we adapt them to small negative
// numbers using the formula:_cjkSpacing = japWidthCorrection - 16; where 16 is the
// full width of a Japanese character in this version.
- if (_vm->_game.id == GID_INDY4 && _vm->_language == Common::JA_JPN &&
- (_vm->_game.platform == Common::kPlatformDOS || _vm->_game.platform == Common::kPlatformMacintosh)) {
- int japWidthCorrection = (_left == 161) ? 13 : 14;
- //int japHeightCorrection = 15;
+ if (_vm->_isIndy4Jap) {
+ int japWidthCorrection = (_top == 161) ? 13 : 14;
+ int japHeightCorrection = 15;
if (_vm->findVirtScreen(_top)->number == kMainVirtScreen && !_vm->isMessageBannerActive()) {
japWidthCorrection = 15;
- //japHeightCorrection = 16;
+ japHeightCorrection = 16;
} else if (_vm->isMessageBannerActive()) {
japWidthCorrection = 13;
}
+ if (is2byte)
+ _height = _origHeight = japHeightCorrection;
_cjkSpacing = japWidthCorrection - 16;
}
diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index b99e8f1dbaa..10644a581fe 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -170,9 +170,14 @@ Common::KeyState ScummEngine::showBannerAndPause(int bannerId, int32 waitTime, c
// Take all the necessary measurements for the box which
// will contain the string...
bool isCOMIDemo = (_game.id == GID_CMI && (_game.features & GF_DEMO) != 0);
+
bannerMsgHeight = ((_game.id == GID_DIG || isCOMIDemo) ? getGUIStringHeight("ABC \x80\x78 \xb0\x78") : getGUIStringHeight(bannerMsg)) + 5;
bannerMsgWidth = getGUIStringWidth(bannerMsg);
+
+ if (_isIndy4Jap)
+ bannerMsgWidth += 32;
+
if (bannerMsgWidth < 100)
bannerMsgWidth = 100;
@@ -187,6 +192,11 @@ Common::KeyState ScummEngine::showBannerAndPause(int bannerId, int32 waitTime, c
xPos = _screenWidth / 2 + roundedWidth + 3;
yPos = 1 - bannerMsgHeight;
_bannerSaveYStart = startingPointY;
+ } else if (_isIndy4Jap) {
+ startingPointX = 156 - bannerMsgWidth / 2;
+ startingPointY = 80;
+ xPos = bannerMsgWidth / 2 + 164;
+ yPos = -18;
} else if (_game.id == GID_MONKEY && _game.platform == Common::kPlatformFMTowns) {
bannerMsgWidth = getGUIStringWidth(bannerMsg) / 2;
startingPointX = ((160 - bannerMsgWidth) - 8) & 0xFFF8;
@@ -659,6 +669,8 @@ void ScummEngine::drawInternalGUIControl(int id, bool highlightColor) {
bool centerFlag;
char buttonString[512];
+ bool isSaveSlot = (id >= GUI_CTRL_FIRST_SG && id <= GUI_CTRL_LAST_SG) && _game.platform != Common::kPlatformSegaCD;
+
ctrl = &_internalGUIControls[id];
relCentX = ctrl->relativeCenterX;
if (ctrl->relativeCenterX != -1) {
@@ -766,6 +778,16 @@ void ScummEngine::drawInternalGUIControl(int id, bool highlightColor) {
for (const int8 *s = drwOffsets[id - GUI_CTRL_ARROW_UP_BUTTON]; *s != -1; s += 4)
drawLine(textXPos + s[0], relCentY + s[1], textXPos + s[2], relCentY + s[3], textColor);
+ } else if (_isIndy4Jap) {
+ Common::Rect indyClipRect(relCentX, relCentY, x, y);
+ textYPos = (y - relCentY) / 2 + relCentY;
+ if ((id < GUI_CTRL_FIRST_SG) || (id > GUI_CTRL_LAST_SG && id != GUI_CTRL_PATH_BUTTON)) {
+ textYPos -= 7;
+ } else {
+ textYPos -= 3;
+ }
+
+ drawGUIText(buttonString, isSaveSlot ? &indyClipRect : nullptr, textXPos, textYPos, textColor, centerFlag);
} else {
int tmpRight = _string[5].right;
bool nudgeJapYPos = _language == Common::JA_JPN;
@@ -786,7 +808,6 @@ void ScummEngine::drawInternalGUIControl(int id, bool highlightColor) {
// The original CJK DIG interpreter limits the clipping to the save slots. Other elements
// seem to (theoretically) be allowed to draw text wherever they want...
- bool isSaveSlot = (id >= GUI_CTRL_FIRST_SG && id <= GUI_CTRL_LAST_SG) && _game.platform != Common::kPlatformSegaCD;
Common::Rect clipRect(relCentX, relCentY, x, y);
drawGUIText(buttonString, isSaveSlot ? &clipRect : nullptr, textXPos, textYPos, textColor, centerFlag);
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index ae0d6849c1a..be67a708884 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -398,6 +398,10 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
assert(!_mainMenuDialog);
_mainMenuDialog = new ScummMenuDialog(this);
#endif
+
+ _isIndy4Jap = _game.id == GID_INDY4 &&
+ (_game.platform == Common::kPlatformMacintosh || _game.platform == Common::kPlatformDOS) &&
+ _language == Common::JA_JPN;
}
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 9fdcef43f54..c8853caced3 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -662,6 +662,8 @@ public:
bool isUsingOriginalGUI();
bool isMessageBannerActive(); // For Indy4 Jap character shadows
+ bool _isIndy4Jap = false;
+
protected:
Dialog *_pauseDialog = nullptr;
Dialog *_messageDialog = nullptr;
More information about the Scummvm-git-logs
mailing list