mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 01:46:42 +00:00
ADL: Implement hires6 verb/noun error messages
This commit is contained in:
parent
d435f5b4eb
commit
f8d75bbc86
@ -855,6 +855,22 @@ Common::String AdlEngine::getWord(const Common::String &line, uint &index) const
|
||||
}
|
||||
}
|
||||
|
||||
Common::String AdlEngine::formatVerbError(const Common::String &verbStr) const {
|
||||
Common::String err = _strings.verbError;
|
||||
for (uint i = 0; i < verbStr.size(); ++i)
|
||||
err.setChar(verbStr[i], i + 19);
|
||||
return err;
|
||||
}
|
||||
|
||||
Common::String AdlEngine::formatNounError(const Common::String &verbStr, const Common::String &nounStr) const {
|
||||
Common::String err = _strings.nounError;
|
||||
for (uint i = 0; i < verbStr.size(); ++i)
|
||||
err.setChar(verbStr[i], i + 19);
|
||||
for (uint i = 0; i < nounStr.size(); ++i)
|
||||
err.setChar(nounStr[i], i + 30);
|
||||
return err;
|
||||
}
|
||||
|
||||
void AdlEngine::getInput(uint &verb, uint &noun) {
|
||||
while (1) {
|
||||
_display->printString(_strings.enterCommand);
|
||||
@ -867,10 +883,7 @@ void AdlEngine::getInput(uint &verb, uint &noun) {
|
||||
Common::String verbStr = getWord(line, index);
|
||||
|
||||
if (!_verbs.contains(verbStr)) {
|
||||
Common::String err = _strings.verbError;
|
||||
for (uint i = 0; i < verbStr.size(); ++i)
|
||||
err.setChar(verbStr[i], i + 19);
|
||||
_display->printString(err);
|
||||
_display->printString(formatVerbError(verbStr));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -879,12 +892,7 @@ void AdlEngine::getInput(uint &verb, uint &noun) {
|
||||
Common::String nounStr = getWord(line, index);
|
||||
|
||||
if (!_nouns.contains(nounStr)) {
|
||||
Common::String err = _strings.nounError;
|
||||
for (uint i = 0; i < verbStr.size(); ++i)
|
||||
err.setChar(verbStr[i], i + 19);
|
||||
for (uint i = 0; i < nounStr.size(); ++i)
|
||||
err.setChar(nounStr[i], i + 30);
|
||||
_display->printString(err);
|
||||
_display->printString(formatNounError(verbStr, nounStr));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -234,6 +234,8 @@ protected:
|
||||
Common::String inputString(byte prompt = 0) const;
|
||||
byte inputKey(bool showCursor = true) const;
|
||||
|
||||
virtual Common::String formatVerbError(const Common::String &verbStr) const;
|
||||
virtual Common::String formatNounError(const Common::String &verbStr, const Common::String &nounStr) const;
|
||||
void loadWords(Common::ReadStream &stream, WordMap &map, Common::StringArray &pri) const;
|
||||
void readCommands(Common::ReadStream &stream, Commands &commands);
|
||||
void checkInput(byte verb, byte noun);
|
||||
|
@ -363,6 +363,43 @@ void HiRes6Engine::showRoom() {
|
||||
_linesPrinted = 0;
|
||||
}
|
||||
|
||||
Common::String HiRes6Engine::formatVerbError(const Common::String &verbStr) const {
|
||||
Common::String err = _strings.verbError;
|
||||
|
||||
for (uint i = 0; i < verbStr.size(); ++i)
|
||||
err.setChar(verbStr[i], i + 24);
|
||||
|
||||
err.setChar(APPLECHAR(' '), 32);
|
||||
|
||||
uint i = 24;
|
||||
while (err[i] != APPLECHAR(' '))
|
||||
++i;
|
||||
|
||||
err.setChar(APPLECHAR('.'), i);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
Common::String HiRes6Engine::formatNounError(const Common::String &verbStr, const Common::String &nounStr) const {
|
||||
Common::String err = _strings.nounError;
|
||||
|
||||
for (uint i = 0; i < nounStr.size(); ++i)
|
||||
err.setChar(nounStr[i], i + 24);
|
||||
|
||||
for (uint i = 35; i > 31; --i)
|
||||
err.setChar(APPLECHAR(' '), i);
|
||||
|
||||
uint i = 24;
|
||||
while (err[i] != APPLECHAR(' '))
|
||||
++i;
|
||||
|
||||
err.setChar(APPLECHAR('I'), i + 1);
|
||||
err.setChar(APPLECHAR('S'), i + 2);
|
||||
err.setChar(APPLECHAR('.'), i + 3);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void HiRes6Engine::printString(const Common::String &str) {
|
||||
Common::String s;
|
||||
uint found = 0;
|
||||
|
@ -74,6 +74,8 @@ private:
|
||||
void initGameState();
|
||||
void printRoomDescription();
|
||||
void showRoom();
|
||||
Common::String formatVerbError(const Common::String &verbStr) const;
|
||||
Common::String formatNounError(const Common::String &verbStr, const Common::String &nounStr) const;
|
||||
|
||||
// AdlEngine_v2
|
||||
void printString(const Common::String &str);
|
||||
|
Loading…
x
Reference in New Issue
Block a user