[Scummvm-git-logs] scummvm master -> 41f11b8da9a20284c17f4d680d77db93084ab317
athrxx
noreply at scummvm.org
Mon Mar 11 19:45:05 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9d914bc6f6 SCUMM : string code cleanup
41f11b8da9 SCUMM: fix/silence various coverity warnings
Commit: 9d914bc6f63ddd985314fdcdafbea4a5a7dd1db6
https://github.com/scummvm/scummvm/commit/9d914bc6f63ddd985314fdcdafbea4a5a7dd1db6
Author: athrxx (athrxx at scummvm.org)
Date: 2024-03-11T20:44:11+01:00
Commit Message:
SCUMM : string code cleanup
(move huge special purpose code blob to extra
function)
Changed paths:
engines/scumm/scumm.h
engines/scumm/string.cpp
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index becd5071229..5b8369f3b1e 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1617,6 +1617,7 @@ protected:
bool newLine();
void drawString(int a, const byte *msg);
virtual void fakeBidiString(byte *ltext, bool ignoreVerb, int ltextSize) const;
+ void wrapSegaCDText();
void debugMessage(const byte *msg);
virtual void showMessageDialog(const byte *msg);
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index 2859359f904..89ce6e58d14 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -726,6 +726,124 @@ void ScummEngine::fakeBidiString(byte *ltext, bool ignoreVerb, int ltextSize) co
free(stack);
}
+void ScummEngine::wrapSegaCDText() {
+ // MI1 Sega CD appears to be doing its own thing in here when
+ // the string x coordinate is on the right side of the screen:
+ // - Applies some tentative line breaks;
+ // - Go line by line and check if the string still overflows
+ // on the last 16 pixels of the right side of the screen;
+ // - If so, take the original string and apply a stricter final wrapping;
+ // - Finally, clip the string final position to 16 pixels from the right
+ // and from the left sides of the screen.
+ //
+ // I agree that this is very convoluted :-) , but it's the only way
+ // to display pixel accurate text on both ENG and JAP editions of this
+ // version.
+ int predictionMaxWidth = _charset->_right - _string[0].xpos;
+ int predictionNextLeft = _nextLeft;
+
+ bool useStricterWrapping = (_string[0].xpos > _screenWidth / 2);
+
+ // Predict if a stricter wrapping is going to be necessary
+ if (!useStricterWrapping) {
+ if (predictionMaxWidth > predictionNextLeft)
+ predictionMaxWidth = predictionNextLeft;
+ predictionMaxWidth *= 2;
+
+ byte predictionString[512];
+
+ memcpy(predictionString, _charsetBuffer, sizeof(predictionString));
+
+ // Impose a tentative max string width for the wrapping
+ _charset->addLinebreaks(0, predictionString + _charsetBufPos, 0, predictionMaxWidth);
+
+ int predictionStringWidth = _charset->getStringWidth(0, predictionString + _charsetBufPos);
+ predictionNextLeft -= predictionStringWidth / 2;
+
+ if (predictionNextLeft < 16)
+ predictionNextLeft = 16;
+
+ byte *ptrToCurLine = predictionString + _charsetBufPos;
+ byte curChar = *ptrToCurLine;
+
+ // Go line by line and check if the string overflows
+ // on the last 16 pixels on the right side of the screen...
+ while (curChar) {
+ predictionStringWidth = _charset->getStringWidth(0, ptrToCurLine);
+ predictionNextLeft -= predictionStringWidth / 2;
+
+ if (predictionNextLeft < 16)
+ predictionNextLeft = 16;
+
+ useStricterWrapping |= (predictionNextLeft + predictionStringWidth > (_screenWidth - 16));
+
+ if (useStricterWrapping)
+ break;
+
+ // Advance to next line, if any...
+ do {
+ // Control code handling...
+ if (curChar == 0xFE || curChar == 0xFF) {
+ // Advance to the control code and
+ // check if it's a new line instruction...
+ ptrToCurLine++;
+ curChar = *ptrToCurLine;
+
+ // Gotcha!
+ if (curChar == 1 || (_newLineCharacter && curChar == _newLineCharacter)) {
+ ptrToCurLine++;
+ curChar = *ptrToCurLine;
+ break;
+ }
+
+ // If we're here, we don't need this control code,
+ // let's just skip it...
+ ptrToCurLine++;
+ } else if (_useCJKMode && curChar & 0x80) { // CJK char
+ ptrToCurLine++;
+ }
+
+ // Line breaks and string termination
+ if (curChar == '\r' || curChar == '\n') {
+ ptrToCurLine++;
+ curChar = *ptrToCurLine;
+ break;
+ } else if (curChar == '\0') {
+ curChar = *ptrToCurLine;
+ break;
+ }
+
+ ptrToCurLine++;
+ curChar = *ptrToCurLine;
+ } while (true);
+ }
+ }
+
+ // Impose the final line breaks with the correct max string width;
+ // this part is practically the default v5 text centering code...
+ int finalMaxWidth = _charset->_right - _string[0].xpos;
+ finalMaxWidth -= useStricterWrapping ? 16 : 0;
+ if (finalMaxWidth > _nextLeft)
+ finalMaxWidth = _nextLeft;
+ finalMaxWidth *= 2;
+
+ _charset->addLinebreaks(0, _charsetBuffer + _charsetBufPos, 0, finalMaxWidth);
+
+ int finalStringWidth = _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos);
+ _nextLeft -= finalStringWidth / 2;
+
+ // Final additional clippings (these will also be repeated on newLine()):
+ // Clip 16 pixels away from the right
+ if (_nextLeft + finalStringWidth > (_screenWidth - 16)) {
+ _nextLeft -= (_nextLeft + finalStringWidth) - (_screenWidth - 16);
+ }
+
+ // Clip 16 pixels away from the left
+ if (_nextLeft < 16) {
+ _nextLeft = 16;
+ }
+}
+
void ScummEngine_v2::drawSentence() {
Common::Rect sentenceline;
const byte *temp;
@@ -960,126 +1078,8 @@ void ScummEngine::CHARSET_1() {
}
if (_charset->_center) {
- // MI1 Sega CD appears to be doing its own thing in here when
- // the string x coordinate is on the right side of the screen:
- // - Applies some tentative line breaks;
- // - Go line by line and check if the string still overflows
- // on the last 16 pixels of the right side of the screen;
- // - If so, take the original string and apply a stricter final wrapping;
- // - Finally, clip the string final position to 16 pixels from the right
- // and from the left sides of the screen.
- //
- // I agree that this is very convoluted :-) , but it's the only way
- // to display pixel accurate text on both ENG and JAP editions of this
- // version.
-
if (_game.platform == Common::kPlatformSegaCD) {
- int predictionMaxWidth = _charset->_right - _string[0].xpos;
- int predictionNextLeft = _nextLeft;
-
- bool useStricterWrapping = (_string[0].xpos > _screenWidth / 2);
-
- // Predict if a stricter wrapping is going to be necessary
- if (!useStricterWrapping) {
- if (predictionMaxWidth > predictionNextLeft)
- predictionMaxWidth = predictionNextLeft;
- predictionMaxWidth *= 2;
-
- byte predictionString[512];
-
- memcpy(predictionString, _charsetBuffer, sizeof(predictionString));
-
- // Impose a tentative max string width for the wrapping
- _charset->addLinebreaks(0, predictionString + _charsetBufPos, 0, predictionMaxWidth);
-
- int predictionStringWidth = _charset->getStringWidth(0, predictionString + _charsetBufPos);
- predictionNextLeft -= predictionStringWidth / 2;
-
- if (predictionNextLeft < 16)
- predictionNextLeft = 16;
-
- byte *ptrToCurLine = predictionString + _charsetBufPos;
- byte curChar = *ptrToCurLine;
-
- // Go line by line and check if the string overflows
- // on the last 16 pixels on the right side of the screen...
- while (curChar) {
- predictionStringWidth = _charset->getStringWidth(0, ptrToCurLine);
- predictionNextLeft -= predictionStringWidth / 2;
-
- if (predictionNextLeft < 16)
- predictionNextLeft = 16;
-
- useStricterWrapping |= (predictionNextLeft + predictionStringWidth > (_screenWidth - 16));
-
- if (useStricterWrapping)
- break;
-
- // Advance to next line, if any...
- do {
- // Control code handling...
- if (curChar == 0xFE || curChar == 0xFF) {
- // Advance to the control code and
- // check if it's a new line instruction...
- ptrToCurLine++;
- curChar = *ptrToCurLine;
-
- // Gotcha!
- if (curChar == 1 || (_newLineCharacter && curChar == _newLineCharacter)) {
- ptrToCurLine++;
- curChar = *ptrToCurLine;
- break;
- }
-
- // If we're here, we don't need this control code,
- // let's just skip it...
- ptrToCurLine++;
- } else if (_useCJKMode && curChar & 0x80) { // CJK char
- ptrToCurLine++;
- }
-
- // Line breaks and string termination
- if (curChar == '\r' || curChar == '\n') {
- ptrToCurLine++;
- curChar = *ptrToCurLine;
- break;
- } else if (curChar == '\0') {
- curChar = *ptrToCurLine;
- break;
- }
-
- ptrToCurLine++;
- curChar = *ptrToCurLine;
- } while (true);
- }
- }
-
-
- // Impose the final line breaks with the correct max string width;
- // this part is practically the default v5 text centering code...
- int finalMaxWidth = _charset->_right - _string[0].xpos;
- finalMaxWidth -= useStricterWrapping ? 16 : 0;
-
- if (finalMaxWidth > _nextLeft)
- finalMaxWidth = _nextLeft;
- finalMaxWidth *= 2;
-
- _charset->addLinebreaks(0, _charsetBuffer + _charsetBufPos, 0, finalMaxWidth);
-
- int finalStringWidth = _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos);
- _nextLeft -= finalStringWidth / 2;
-
- // Final additional clippings (these will also be repeated on newLine()):
-
- // Clip 16 pixels away from the right
- if (_nextLeft + finalStringWidth > (_screenWidth - 16)) {
- _nextLeft -= (_nextLeft + finalStringWidth) - (_screenWidth - 16);
- }
-
- // Clip 16 pixels away from the left
- if (_nextLeft < 16) {
- _nextLeft = 16;
- }
+ wrapSegaCDText();
} else {
int stringWidth = _charset->getStringWidth(0, _charsetBuffer + _charsetBufPos);
_nextLeft -= stringWidth / 2;
Commit: 41f11b8da9a20284c17f4d680d77db93084ab317
https://github.com/scummvm/scummvm/commit/41f11b8da9a20284c17f4d680d77db93084ab317
Author: athrxx (athrxx at scummvm.org)
Date: 2024-03-11T20:44:18+01:00
Commit Message:
SCUMM: fix/silence various coverity warnings
Changed paths:
engines/scumm/actor.cpp
engines/scumm/charset.cpp
engines/scumm/dialogs.cpp
engines/scumm/dialogs.h
engines/scumm/metaengine.cpp
engines/scumm/object.cpp
engines/scumm/players/player_mac_loom_monkey.cpp
engines/scumm/players/player_mac_new.cpp
engines/scumm/scumm.cpp
engines/scumm/sound.cpp
engines/scumm/string.cpp
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index b1f369c858c..b842de62e4a 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -2180,7 +2180,7 @@ bool ScummEngine::isValidActor(int id) const {
Actor *ScummEngine::derefActor(int id, const char *errmsg) const {
if (id == 0)
debugC(DEBUG_ACTORS, "derefActor(0, \"%s\") in script %d, opcode 0x%x",
- errmsg, vm.slot[_currentScript].number, _opcode);
+ errmsg, _currentScript != 0xFF ? vm.slot[_currentScript].number : -1, _opcode);
if (!isValidActor(id)) {
if (errmsg)
@@ -2194,11 +2194,11 @@ Actor *ScummEngine::derefActor(int id, const char *errmsg) const {
Actor *ScummEngine::derefActorSafe(int id, const char *errmsg) const {
if (id == 0)
debugC(DEBUG_ACTORS, "derefActorSafe(0, \"%s\") in script %d, opcode 0x%x",
- errmsg, vm.slot[_currentScript].number, _opcode);
+ errmsg, _currentScript != 0xFF ? vm.slot[_currentScript].number : -1, _opcode);
if (!isValidActor(id)) {
debugC(DEBUG_ACTORS, "Invalid actor %d in %s (script %d, opcode 0x%x)",
- id, errmsg, vm.slot[_currentScript].number, _opcode);
+ id, errmsg, _currentScript != 0xFF ? vm.slot[_currentScript].number : -1, _opcode);
return nullptr;
}
return _actors[id];
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 7f426f01dfc..0764f8e3392 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -336,7 +336,7 @@ CharsetRenderer::~CharsetRenderer() {
}
CharsetRendererCommon::CharsetRendererCommon(ScummEngine *vm)
- : CharsetRenderer(vm), _bitsPerPixel(0), _fontHeight(0), _numChars(0) {
+ : CharsetRenderer(vm), _fontPtr(nullptr), _bitsPerPixel(0), _fontHeight(0), _numChars(0) {
_enableShadow = false;
_shadowColor = 0;
}
@@ -744,7 +744,8 @@ void CharsetRendererPC::drawBits1(Graphics::Surface &dest, int x, int y, const b
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();
+ VirtScreen *vs = _vm->findVirtScreen(_top);
+ bool canDrawShadow = vs != nullptr && vs->number == kMainVirtScreen && !_vm->isMessageBannerActive();
enableShadow(canDrawShadow);
}
@@ -1604,7 +1605,7 @@ void CharsetRendererPCE::setDrawCharIntern(uint16 chr) {
#endif
CharsetRendererMac::CharsetRendererMac(ScummEngine *vm, const Common::Path &fontFile)
- : CharsetRendererCommon(vm) {
+ : CharsetRendererCommon(vm), _lastTop(0) {
// The original Macintosh interpreter didn't use the correct spacing
// between characters for some of the text, e.g. the Grail Diary. This
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 5fdef0cd9dd..9055e7800a1 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -1661,8 +1661,8 @@ void MI1CdGameOptionsWidget::updateOutlookAdjustmentValue() {
#ifdef USE_ENET
// HE Network Play Adjustment settings
-HENetworkGameOptionsWidget::HENetworkGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain, Common::String gameid) :
- ScummOptionsContainerWidget(boss, name, "HENetworkGameOptionsDialog", domain), _gameid(gameid) {
+HENetworkGameOptionsWidget::HENetworkGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain, const Common::String &&gameid) :
+ ScummOptionsContainerWidget(boss, name, "HENetworkGameOptionsDialog", domain), _gameid(Common::move(gameid)) {
Common::String extra = ConfMan.get("extra", domain);
// Add back the "Load modded audio" option.
diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h
index ea146520447..00f78024ea1 100644
--- a/engines/scumm/dialogs.h
+++ b/engines/scumm/dialogs.h
@@ -388,7 +388,7 @@ private:
*/
class HENetworkGameOptionsWidget : public ScummOptionsContainerWidget {
public:
- HENetworkGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain, const Common::String gameid);
+ HENetworkGameOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain, const Common::String &&gameid);
~HENetworkGameOptionsWidget() override {};
void load() override;
diff --git a/engines/scumm/metaengine.cpp b/engines/scumm/metaengine.cpp
index aae7c0ef5a7..59c10742881 100644
--- a/engines/scumm/metaengine.cpp
+++ b/engines/scumm/metaengine.cpp
@@ -179,7 +179,7 @@ Common::Path ScummEngine_v70he::generateFilename(const int room) const {
// For mac they're stored in game binary.
result = _filenamePattern.pattern;
} else {
- Common::String pattern = id == 'b' ? bPattern : _filenamePattern.pattern;
+ Common::String pattern = id == 'b' ? Common::move(bPattern) : _filenamePattern.pattern;
if (_filenamePattern.genMethod == kGenHEMac)
result = Common::String::format("%s (%c)", pattern.c_str(), id);
else
@@ -618,7 +618,7 @@ GUI::OptionsContainerWidget *ScummMetaEngine::buildEngineOptionsWidget(GUI::GuiO
#ifdef USE_ENET
else if (gameid == "football" || gameid == "baseball2001" || gameid == "football2002" ||
gameid == "moonbase")
- return new Scumm::HENetworkGameOptionsWidget(boss, name, target, gameid);
+ return new Scumm::HENetworkGameOptionsWidget(boss, name, target, Common::move(gameid));
#endif
const ExtraGuiOptions engineOptions = getExtraGuiOptions(target);
diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp
index 3a9b61bad9d..18bb27a3feb 100644
--- a/engines/scumm/object.cpp
+++ b/engines/scumm/object.cpp
@@ -148,8 +148,8 @@ void ScummEngine::setOwnerOf(int obj, int owner) {
// For now we follow a more defensive route: We perform the check
// if ss->number is small enough.
- ss = &vm.slot[_currentScript];
- if (ss->where == WIO_INVENTORY) {
+ ss = (_currentScript != 0xFF) ? &vm.slot[_currentScript] : nullptr;
+ if (ss != nullptr && ss->where == WIO_INVENTORY) {
if (ss->number < _numInventory && _inventory[ss->number] == obj) {
error("Odd setOwnerOf case #1: Please report to Fingolfin where you encountered this");
putOwner(obj, 0);
diff --git a/engines/scumm/players/player_mac_loom_monkey.cpp b/engines/scumm/players/player_mac_loom_monkey.cpp
index c15f9c4a565..652ee78bbcc 100644
--- a/engines/scumm/players/player_mac_loom_monkey.cpp
+++ b/engines/scumm/players/player_mac_loom_monkey.cpp
@@ -140,7 +140,7 @@ private:
const byte _numInstrumentsMax;
};
-MacSndLoader::Instrument::Instrument(uint32 id, Common::SeekableReadStream *&in, Common::String &&name) : _id(id), _name(name) {
+MacSndLoader::Instrument::Instrument(uint32 id, Common::SeekableReadStream *&in, Common::String &&name) : _id(id), _name(Common::move(name)) {
in->seek(2);
uint16 numTypes = in->readUint16BE();
in->seek(numTypes * 6 + 4);
diff --git a/engines/scumm/players/player_mac_new.cpp b/engines/scumm/players/player_mac_new.cpp
index a37c235641c..4d73b346ba6 100644
--- a/engines/scumm/players/player_mac_new.cpp
+++ b/engines/scumm/players/player_mac_new.cpp
@@ -563,6 +563,10 @@ void MacSndChannel::flush() {
}
void MacSndChannel::loadWaveTable(const byte *data, uint16 dataSize) {
+ if (!data) {
+ warning("MacSndChannel::loadWaveTable(): nullptr wavetable argument");
+ return;
+ }
assert(dataSize == _len);
int8 *buff = new int8[dataSize]();
const int8 *s = reinterpret_cast<const int8*>(data);
@@ -572,6 +576,10 @@ void MacSndChannel::loadWaveTable(const byte *data, uint16 dataSize) {
}
void MacSndChannel::loadInstrument(const MacLowLevelPCMDriver::PCMSound *snd) {
+ if (!snd) {
+ warning("MacSndChannel::loadInstrument(): nullptr sound argument");
+ return;
+ }
setupSound(snd);
setupRateConv(_drv->getStatus().deviceRate, 0x10000, snd->rate, false);
}
@@ -617,7 +625,7 @@ void MacSndChannel::enqueueSndCmd(uint8 c, uint16 p1, uint32 p2, byte mode) {
}
void MacSndChannel::enqueueSndCmd(uint8 c, uint16 p1, const void *p2, byte ptrType, byte mode) {
- if (mode == MacLowLevelPCMDriver::kImmediate && (c == 60 || c == 80)) {
+ if (mode == MacLowLevelPCMDriver::kImmediate && (c == 13 || c == 60 || c == 80)) {
if (c == 60)
loadWaveTable(reinterpret_cast<const byte*>(p2), p1);
else if (c == 80)
@@ -958,7 +966,7 @@ uint32 MacSndChannel::calcRate(uint32 outRate, uint32 factor, uint32 dataRate) {
} else {
c = dataRate % (outRate >> 16);
dataRate /= (outRate >> 16);
- t = ((c << 16) | (factor >> 16)) - (dataRate * (outRate & 0xffff));
+ t = ((c << 16) | (factor >> 16)) - ((dataRate & 0xffff) * (outRate & 0xffff));
factor = (factor << 16) | dataRate;
dataRate = t & (uint32)-1;;
altpth = (int64)t < 0;
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index aaca0b136dd..f603d37b121 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -3793,7 +3793,7 @@ bool ScummEngine::startManiac() {
// Set up the chanined games to Maniac Mansion, and then back
// to the current game again with that save slot.
- ChainedGamesMan.push(maniacTarget);
+ ChainedGamesMan.push(Common::move(maniacTarget));
ChainedGamesMan.push(ConfMan.getActiveDomainName(), 100);
// Force a return to the launcher. This will start the first
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index c81aa42b740..4899a51914c 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -2105,6 +2105,7 @@ static void convertADResource(ResourceManager *res, const GameSettings& game, Re
int current_note[3];
int track_time[3];
byte *track_data[3];
+ memset(current_instr, 0, sizeof(current_instr));
int track_ctr = 0;
byte chunk_type = 0;
diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp
index 89ce6e58d14..0935b24edd7 100644
--- a/engines/scumm/string.cpp
+++ b/engines/scumm/string.cpp
@@ -2016,35 +2016,35 @@ void ScummEngine_v7::translateText(const byte *text, byte *trans_buff, int trans
if (_game.id == GID_DIG) {
// Based on the second release of The Dig
// Only applies to the subtitles and not speech
- if (!strcmp((const char *)text, "faint light"))
+ if (!strncmp((const char *)text, "faint light", 11))
text = (const byte *)"/NEW.007/faint light";
- else if (!strcmp((const char *)text, "glowing crystal"))
+ else if (!strncmp((const char *)text, "glowing crystal", 15))
text = (const byte *)"/NEW.008/glowing crystal";
- else if (!strcmp((const char *)text, "glowing crystals"))
+ else if (!strncmp((const char *)text, "glowing crystals", 16))
text = (const byte *)"/NEW.009/glowing crystals";
- else if (!strcmp((const char *)text, "pit"))
+ else if (!strncmp((const char *)text, "pit", 3))
text = (const byte *)"/NEW.010/pit";
- else if (!strcmp((const char *)text, "You wish."))
+ else if (!strncmp((const char *)text, "You wish.", 9))
text = (const byte *)"/NEW.011/You wish.";
- else if (!strcmp((const char *)text, "In your dreams."))
+ else if (!strncmp((const char *)text, "In your dreams.", 15))
text = (const byte *)"/NEW.012/In your dreams";
- else if (!strcmp((const char *)text, "left"))
+ else if (!strncmp((const char *)text, "left", 4))
text = (const byte *)"/CATHPLAT.068/left";
- else if (!strcmp((const char *)text, "right"))
+ else if (!strncmp((const char *)text, "right", 5))
text = (const byte *)"/CATHPLAT.070/right";
- else if (!strcmp((const char *)text, "top"))
+ else if (!strncmp((const char *)text, "top", 3))
text = (const byte *)"/CATHPLAT.067/top";
- else if (!strcmp((const char *)text, "exit"))
+ else if (!strncmp((const char *)text, "exit", 4))
text = (const byte *)"/SKY.008/exit";
- else if (!strcmp((const char *)text, "unattached lens"))
+ else if (!strncmp((const char *)text, "unattached lens", 15))
text = (const byte *)"/NEW.013/unattached lens";
- else if (!strcmp((const char *)text, "lens slot"))
+ else if (!strncmp((const char *)text, "lens slot", 9))
text = (const byte *)"/NEW.014/lens slot";
- else if (!strcmp((const char *)text, "Jonathon Jackson"))
+ else if (!strncmp((const char *)text, "Jonathon Jackson", 16))
text = (const byte *)"Aram Gutowski";
- else if (!strcmp((const char *)text, "Brink"))
+ else if (!strncmp((const char *)text, "Brink", 5))
text = (const byte *)"/CREVICE.049/Brink";
- else if (!strcmp((const char *)text, "Robbins"))
+ else if (!strncmp((const char *)text, "Robbins", 7))
text = (const byte *)"/NEST.061/Robbins";
}
More information about the Scummvm-git-logs
mailing list