[Scummvm-git-logs] scummvm branch-2-5 -> 9eab66d45c8846e1ec5f96632c532d9cf9ddab36
sluicebox
noreply at scummvm.org
Sat Dec 18 22:07:31 UTC 2021
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
81289fc0bc SCI: Fix newline handling in Japanese PQ2
d423e1e774 SCI: Update detection entries for Japanese games
14839374bb SCI: Fix uninitialied variable in multi-language parser
9eab66d45c SCI: Fix PQ3 lockup when showing judge evidence
Commit: 81289fc0bc6e44def4a32c6dd08ff834b0bca3cb
https://github.com/scummvm/scummvm/commit/81289fc0bc6e44def4a32c6dd08ff834b0bca3cb
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-12-18T17:03:19-05:00
Commit Message:
SCI: Fix newline handling in Japanese PQ2
Many PQ2 Japanese strings contain escaped newlines ("\n") which we have
not been handling. We have been handling these in getSciLanguageString()
when returning Japanese text but that's not where SSCI does this work.
PQ2's Print procedure in script 255 parses Japanese text itself and our
getSciLanguageString() is never involved.
Now Japanese newline handling is done in the core text measuring and
drawing functions, which is closer to where SSCI did it, but without the
hack of having GetLongest() patch out Japanese newlines like in SSCI.
Fixes bug #13154
Changed paths:
engines/sci/engine/state.cpp
engines/sci/graphics/text16.cpp
engines/sci/graphics/text16.h
engines/sci/sci.h
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index de1f7d34af..9418b3cf1e 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -261,24 +261,6 @@ Common::String SciEngine::getSciLanguageString(const Common::String &str, kLangu
switch (curChar) {
case 0: // Terminator NUL
return fullWidth;
- case '\\':
- // "\n", "\N", "\r" and "\R" were overwritten with SPACE + 0x0D in PC-9801 SSCI
- // inside GetLongest() (text16). We do it here, because it's much cleaner and
- // we have to process the text here anyway.
- // Occurs for example in Police Quest 2 intro
- curChar2 = *(textPtr + 1);
- switch (curChar2) {
- case 'n':
- case 'N':
- case 'r':
- case 'R':
- fullWidth += ' ';
- fullWidth += 0x0D; // CR
- textPtr += 2;
- continue;
- default:
- break;
- }
default:
break;
}
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp
index f354e6f048..2cb008ec9c 100644
--- a/engines/sci/graphics/text16.cpp
+++ b/engines/sci/graphics/text16.cpp
@@ -202,6 +202,7 @@ int16 GfxText16::GetLongest(const char *&textPtr, int16 maxWidth, GuiResourceId
uint16 curWidth = 0, tempWidth = 0;
GuiResourceId previousFontId = GetFontId();
int16 previousPenColor = _ports->_curPort->penClr;
+ bool escapedNewLine = false;
GetFont();
if (!_font)
@@ -212,6 +213,14 @@ int16 GfxText16::GetLongest(const char *&textPtr, int16 maxWidth, GuiResourceId
if (_font->isDoubleByte(curChar)) {
curChar |= (*(const byte *)(textPtr + 1)) << 8;
}
+ if (escapedNewLine) {
+ escapedNewLine = false;
+ curChar = 0x0D;
+ } else if (isJapaneseNewLine(curChar, *(textPtr + 1))) {
+ escapedNewLine = true;
+ curChar = ' ';
+ }
+
switch (curChar) {
case 0x7C:
if (getSciVersion() >= SCI_VERSION_1_1) {
@@ -373,6 +382,7 @@ void GfxText16::Width(const char *text, int16 from, int16 len, GuiResourceId org
int16 previousPenColor = _ports->_curPort->penClr;
textWidth = 0; textHeight = 0;
+ bool escapedNewLine = false;
GetFont();
if (_font) {
@@ -383,6 +393,14 @@ void GfxText16::Width(const char *text, int16 from, int16 len, GuiResourceId org
curChar |= (*(const byte *)text++) << 8;
len--;
}
+ if (escapedNewLine) {
+ escapedNewLine = false;
+ curChar = 0x0D;
+ } else if (isJapaneseNewLine(curChar, *text)) {
+ escapedNewLine = true;
+ curChar = ' ';
+ }
+
switch (curChar) {
case 0x0A:
case 0x0D:
@@ -490,12 +508,21 @@ void GfxText16::Draw(const char *text, int16 from, int16 len, GuiResourceId orgF
rect.top = _ports->_curPort->curTop;
rect.bottom = rect.top + _ports->_curPort->fontHeight;
text += from;
+ bool escapedNewLine = false;
while (len--) {
curChar = (*(const byte *)text++);
if (_font->isDoubleByte(curChar)) {
curChar |= (*(const byte *)text++) << 8;
len--;
}
+ if (escapedNewLine) {
+ escapedNewLine = false;
+ curChar = 0x0D;
+ } else if (isJapaneseNewLine(curChar, *text)) {
+ escapedNewLine = true;
+ curChar = ' ';
+ }
+
switch (curChar) {
case 0x0A:
case 0x0D:
@@ -735,6 +762,17 @@ bool GfxText16::SwitchToFont900OnSjis(const char *text, uint16 languageSplitter)
return false;
}
+// In PC-9801 SSCI, "\n", "\N", "\r" and "\R" were overwritten with SPACE + 0x0D
+// inside GetLongest() (text16). This was a bit of a hack since it meant this
+// version altered the input that it's normally only supposed to be measuring.
+// Instead, we detect the newline sequences during string processing loops and
+// apply the substitute characters on the fly. PQ2 is the only game known to use
+// this feature. "\n" appears in most of its Japanese strings.
+bool GfxText16::isJapaneseNewLine(int16 curChar, int16 nextChar) {
+ return g_sci->getLanguage() == Common::JA_JPN &&
+ curChar == '\\' && (nextChar == 'n' || nextChar == 'N' || nextChar == 'r' || nextChar == 'R');
+}
+
reg_t GfxText16::allocAndFillReferenceRectArray() {
uint rectCount = _codeRefRects.size();
if (rectCount) {
diff --git a/engines/sci/graphics/text16.h b/engines/sci/graphics/text16.h
index 1f53c5b4b0..d00e4bd9ba 100644
--- a/engines/sci/graphics/text16.h
+++ b/engines/sci/graphics/text16.h
@@ -80,6 +80,7 @@ private:
void init();
bool SwitchToFont1001OnKorean(const char *text, uint16 languageSplitter);
bool SwitchToFont900OnSjis(const char *text, uint16 languageSplitter);
+ static bool isJapaneseNewLine(int16 curChar, int16 nextChar);
GfxCache *_cache;
GfxPorts *_ports;
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 3d6e85be5d..fd187b0cb2 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -228,7 +228,7 @@ public:
void setSciLanguage(kLanguage lang);
void setSciLanguage();
- Common::String getSciLanguageString(const Common::String &str, kLanguage lang, kLanguage *lang2 = NULL, uint16 *languageSplitter = NULL) const;
+ Common::String getSciLanguageString(const Common::String &str, kLanguage requestedLanguage, kLanguage *secondaryLanguage = nullptr, uint16 *languageSplitter = nullptr) const;
// Check if vocabulary needs to get switched (in multilingual parser games)
void checkVocabularySwitch();
Commit: d423e1e774bdc96af1c825a45e2eaf5bd3eaa730
https://github.com/scummvm/scummvm/commit/d423e1e774bdc96af1c825a45e2eaf5bd3eaa730
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-12-18T17:03:32-05:00
Commit Message:
SCI: Update detection entries for Japanese games
- Remove unnecessary English entry for SQ4
- Update game flags for KQ5 and QFG1
Changed paths:
engines/sci/detection_tables.h
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index f715ba6081..8f8e785e00 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -1983,7 +1983,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.000", 0, "71afd220d46bde1109c58e6acc0f3a01", 469094},
{"resource.001", 0, "72a569f46f1abf2d9d2b1526ad3799c3", 12808839},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformFMTowns, ADGF_ADDENGLISH, GUIO4(GUIO_NOASPECT, GAMEOPTION_ORIGINAL_SAVELOAD, GUIO_MIDITOWNS, GAMEOPTION_RGB_RENDERING) },
+ Common::JA_JPN, Common::kPlatformFMTowns, ADGF_ADDENGLISH, GUIO_STD16_HIRES },
// King's Quest 5 - Japanese PC-98 Floppy 0.000.015 (supplied by omer_mor in bug report #5384)
{"kq5", "", {
@@ -4411,7 +4411,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "a21451ef6fa8179bd4b22c4950004c44", 1136968},
{"resource.003", 0, "a21451ef6fa8179bd4b22c4950004c44", 769897},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_RGB_RENDERING) },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO7(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING) },
// Quest for Glory 1 - Japanese PC-98 5.25" Floppy (also includes English language)
// Executable scanning reports "S.old.201"
@@ -4421,7 +4421,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
{"resource.002", 0, "a21451ef6fa8179bd4b22c4950004c44", 1147121},
{"resource.003", 0, "a21451ef6fa8179bd4b22c4950004c44", 777575},
AD_LISTEND},
- Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO4(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_RGB_RENDERING) },
+ Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO7(GUIO_NOSPEECH, GUIO_NOASPECT, GAMEOPTION_EGA_UNDITHER, GAMEOPTION_PREFER_DIGITAL_SFX, GAMEOPTION_ORIGINAL_SAVELOAD, GAMEOPTION_MIDI_MODE, GAMEOPTION_RGB_RENDERING) },
// Quest for Glory 1 - English Amiga
// Executable scanning reports "1.002.020"
@@ -5360,16 +5360,6 @@ static const struct ADGameDescription SciGameDescriptions[] = {
AD_LISTEND},
Common::JA_JPN, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_STD16_HIRES },
- // Space Quest 4 - Japanese PC-98 5.25" Floppy (also includes english language)
- // SCI interpreter version 1.000.1068
- {"sq4", "", {
- {"resource.map", 0, "ca7bba01019222b6f3e54e9051067a99", 5283},
- {"resource.000", 0, "161d719f38ed98d33f058a8cf3dc09c3", 952909},
- {"resource.001", 0, "454684e3a7a68cbca073945e50778447", 1187088},
- {"resource.002", 0, "6dc668326cc22cb9e8bd8ca9e68d2a66", 1181249},
- AD_LISTEND},
- Common::EN_ANY, Common::kPlatformPC98, ADGF_ADDENGLISH, GUIO_STD16_HIRES },
-
// Space Quest 4 - English DOS CD (from the Space Quest Collection)
// Executable scanning reports "1.001.064", VERSION file reports "1.0"
{"sq4", "CD", {
Commit: 14839374bbf7853b0ef2da1ac12be6b2fd604fff
https://github.com/scummvm/scummvm/commit/14839374bbf7853b0ef2da1ac12be6b2fd604fff
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-12-18T17:03:46-05:00
Commit Message:
SCI: Fix uninitialied variable in multi-language parser
Fixes QFG1 Japanese message display when messages are set to
Japanese and subtitles are enabled
Huge thanks to DarkSoul for verifying original PC-98 behavior
Changed paths:
engines/sci/engine/state.cpp
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 9418b3cf1e..653e3fd32f 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -221,6 +221,9 @@ static kLanguage charToLanguage(const char c) {
Common::String SciEngine::getSciLanguageString(const Common::String &str, kLanguage requestedLanguage, kLanguage *secondaryLanguage, uint16 *languageSplitter) const {
kLanguage foundLanguage = K_LANG_NONE;
const byte *textPtr = (const byte *)str.c_str();
+ if (secondaryLanguage) {
+ *secondaryLanguage = K_LANG_NONE;
+ }
byte curChar = 0;
byte curChar2 = 0;
Commit: 9eab66d45c8846e1ec5f96632c532d9cf9ddab36
https://github.com/scummvm/scummvm/commit/9eab66d45c8846e1ec5f96632c532d9cf9ddab36
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2021-12-18T17:03:58-05:00
Commit Message:
SCI: Fix PQ3 lockup when showing judge evidence
Changed paths:
engines/sci/engine/script_patches.cpp
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index 1bc3292604..ae4236b2d9 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -11434,6 +11434,35 @@ static const uint16 pq3PatchHouseFireRepeats[] = {
PATCH_END
};
+// Showing a second piece of evidence to the judge while having the locket in
+// inventory locks up the game. The hands-off script givenTwo doesn't set a cue
+// in state 5, preventing the script from ever advancing and the player from
+// regaining control.
+//
+// We fix this by setting a 10 second delay as Sierra did in later versions.
+//
+// Applies to: English PC VGA Floppy
+// Responsible method: givenTwo:changeState(5)
+static const uint16 pq3SignatureJudgeEvidenceLockup[] = {
+ 0x72, SIG_ADDTOOFFSET(+2), // lofsa ijudge
+ 0x36, // push
+ 0x39, 0x2c, // pushi 2c
+ 0x39, 0x10, // pushi 10
+ 0x45, 0x10, SIG_MAGICDWORD, 0x06, // callb proc0_16
+ 0x32, SIG_UINT16(0x0022), // jmp 0022 [ end of method ]
+ SIG_END
+};
+
+static const uint16 pq3PatchJudgeEvidenceLockup[] = {
+ 0x74, PATCH_ADDTOOFFSET(+2), // lofss ijudge
+ 0x39, 0x2c, // pushi 2c
+ 0x39, 0x10, // pushi 10
+ 0x45, 0x10, 0x06, // callb proc0_16
+ 0x35, 0x0a, // ldi 0a
+ 0x65, 0x12, // aTop seconds [ seconds = 10 ]
+ PATCH_END
+};
+
// When driving at high speeds, road signs don't always update. The scripts
// implicitly depend on the sign being already hidden before showing it, as
// they don't redraw the view. roadSignScript sets a three second timer before
@@ -11492,13 +11521,14 @@ static const uint16 pq3PatchNrsSpeedThrottle[] = {
PATCH_END
};
-// script, description, signature patch
+// script, description, signature patch
static const SciScriptPatcherEntry pq3Signatures[] = {
- { true, 25, "fix road sign updates", 1, pq3SignatureRoadSignUpdates, pq3PatchRoadSignUpdates },
- { true, 33, "prevent house fire repeating", 1, pq3SignatureHouseFireRepeats, pq3PatchHouseFireRepeats },
- { true, 36, "give locket missing points", 1, pq3SignatureGiveLocketPoints, pq3PatchGiveLocketPoints },
- { true, 36, "doctor mouth speed", 1, pq3SignatureDoctorMouthSpeed, pq3PatchDoctorMouthSpeed },
- { true, 994, "NRS: remove speed throttle", 1, pq3SignatureNrsSpeedThrottle, pq3PatchNrsSpeedThrottle },
+ { true, 25, "fix road sign updates", 1, pq3SignatureRoadSignUpdates, pq3PatchRoadSignUpdates },
+ { true, 33, "prevent house fire repeating", 1, pq3SignatureHouseFireRepeats, pq3PatchHouseFireRepeats },
+ { true, 36, "give locket missing points", 1, pq3SignatureGiveLocketPoints, pq3PatchGiveLocketPoints },
+ { true, 36, "doctor mouth speed", 1, pq3SignatureDoctorMouthSpeed, pq3PatchDoctorMouthSpeed },
+ { true, 44, "fix judge evidence lockup", 1, pq3SignatureJudgeEvidenceLockup, pq3PatchJudgeEvidenceLockup },
+ { true, 994, "NRS: remove speed throttle", 1, pq3SignatureNrsSpeedThrottle, pq3PatchNrsSpeedThrottle },
SCI_SIGNATUREENTRY_TERMINATOR
};
More information about the Scummvm-git-logs
mailing list