parent
4ade45cb11
commit
1cae66c128
5 changed files with 30 additions and 28 deletions
|
@ -119,7 +119,7 @@ Common::String AdlEngine::readString(Common::ReadStream &stream, byte until) con
|
||||||
break;
|
break;
|
||||||
|
|
||||||
str += b;
|
str += b;
|
||||||
}
|
};
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -209,13 +209,21 @@ Common::String AdlEngine::inputString(byte prompt) const {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b < 0xa0 && b == (Common::KEYCODE_BACKSPACE | 0x80) && !s.empty()) {
|
if (b < 0xa0) {
|
||||||
_display->moveCursorBackward();
|
switch (b) {
|
||||||
_display->setCharAtCursor(APPLEBYTE(' '));
|
case Common::KEYCODE_BACKSPACE | 0x80:
|
||||||
s.deleteLastChar();
|
if (!s.empty()) {
|
||||||
} else if (s.size() < 255) {
|
_display->moveCursorBackward();
|
||||||
s += b;
|
_display->setCharAtCursor(APPLECHAR(' '));
|
||||||
_display->printString(Common::String(b));
|
s.deleteLastChar();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (s.size() < 255) {
|
||||||
|
s += b;
|
||||||
|
_display->printString(Common::String(b));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +233,7 @@ byte AdlEngine::inputKey(bool showCursor) const {
|
||||||
|
|
||||||
// If debug script is active, we fake a return press for the text overflow handling
|
// If debug script is active, we fake a return press for the text overflow handling
|
||||||
if (_inputScript && !_scriptPaused)
|
if (_inputScript && !_scriptPaused)
|
||||||
return APPLEBYTE('\r');
|
return APPLECHAR('\r');
|
||||||
|
|
||||||
if (showCursor)
|
if (showCursor)
|
||||||
_display->showCursor(true);
|
_display->showCursor(true);
|
||||||
|
@ -244,12 +252,12 @@ byte AdlEngine::inputKey(bool showCursor) const {
|
||||||
default:
|
default:
|
||||||
if (event.kbd.ascii >= 0x20 && event.kbd.ascii < 0x80)
|
if (event.kbd.ascii >= 0x20 && event.kbd.ascii < 0x80)
|
||||||
key = convertKey(event.kbd.ascii);
|
key = convertKey(event.kbd.ascii);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// If debug script was activated in the meantime, abort input
|
// If debug script was activated in the meantime, abort input
|
||||||
if (_inputScript && !_scriptPaused)
|
if (_inputScript && !_scriptPaused)
|
||||||
return APPLEBYTE('\r');
|
return APPLECHAR('\r');
|
||||||
|
|
||||||
_display->updateTextScreen();
|
_display->updateTextScreen();
|
||||||
g_system->delayMillis(16);
|
g_system->delayMillis(16);
|
||||||
|
@ -909,11 +917,11 @@ Common::Error AdlEngine::saveGameState(int slot, const Common::String &desc) {
|
||||||
char name[SAVEGAME_NAME_LEN] = { };
|
char name[SAVEGAME_NAME_LEN] = { };
|
||||||
|
|
||||||
if (!desc.empty())
|
if (!desc.empty())
|
||||||
Common::strlcpy(name, desc.c_str(), sizeof(name) - 1);
|
strncpy(name, desc.c_str(), sizeof(name) - 1);
|
||||||
else {
|
else {
|
||||||
Common::String defaultName("Save ");
|
Common::String defaultName("Save ");
|
||||||
defaultName += 'A' + slot;
|
defaultName += 'A' + slot;
|
||||||
Common::strlcpy(name, defaultName.c_str(), sizeof(name) - 1);
|
strncpy(name, defaultName.c_str(), sizeof(name) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
outFile->write(name, sizeof(name));
|
outFile->write(name, sizeof(name));
|
||||||
|
@ -984,7 +992,7 @@ byte AdlEngine::convertKey(uint16 ascii) const {
|
||||||
|
|
||||||
Common::String AdlEngine::getLine() {
|
Common::String AdlEngine::getLine() {
|
||||||
while (1) {
|
while (1) {
|
||||||
Common::String line = inputString(APPLEBYTE('?'));
|
Common::String line = inputString(APPLECHAR('?'));
|
||||||
|
|
||||||
if (shouldQuit() || _isRestoring)
|
if (shouldQuit() || _isRestoring)
|
||||||
return Common::String();
|
return Common::String();
|
||||||
|
@ -1020,10 +1028,8 @@ Common::String AdlEngine::getWord(const Common::String &line, uint &index) const
|
||||||
|
|
||||||
// Copy up to 8 characters
|
// Copy up to 8 characters
|
||||||
while (1) {
|
while (1) {
|
||||||
if (copied < 8) {
|
if (copied < 8)
|
||||||
str.setChar(line[index], copied);
|
str.setChar(line[index], copied++);
|
||||||
copied++;
|
|
||||||
}
|
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
|
|
|
@ -383,9 +383,6 @@ static byte processColorBits(uint16 &bits, bool &odd, bool secondPal) {
|
||||||
break;
|
break;
|
||||||
case 0x5: // 101 (color)
|
case 0x5: // 101 (color)
|
||||||
color = 2 + !odd;
|
color = 2 + !odd;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (secondPal)
|
if (secondPal)
|
||||||
|
@ -480,9 +477,9 @@ static void renderPixelRowMono(byte *dst, byte *src) {
|
||||||
static void copyEvenSurfaceRows(Graphics::Surface &surf) {
|
static void copyEvenSurfaceRows(Graphics::Surface &surf) {
|
||||||
byte *src = (byte *)surf.getPixels();
|
byte *src = (byte *)surf.getPixels();
|
||||||
|
|
||||||
for (uint16 y = 0; y < surf.h / 2; ++y) {
|
for (uint y = 0; y < surf.h / 2; ++y) {
|
||||||
byte *dst = src + surf.pitch;
|
byte *dst = src + surf.pitch;
|
||||||
for (uint16 x = 0; x < surf.w; ++x)
|
for (uint x = 0; x < surf.w; ++x)
|
||||||
dst[x] = ALTCOL(src[x]);
|
dst[x] = ALTCOL(src[x]);
|
||||||
src += surf.pitch * 2;
|
src += surf.pitch * 2;
|
||||||
}
|
}
|
||||||
|
@ -556,8 +553,8 @@ void Display::createFont() {
|
||||||
byte *buf = (byte *)_font->getPixels();
|
byte *buf = (byte *)_font->getPixels();
|
||||||
byte *bufInv = buf + (_font->h / 2) * _font->pitch;
|
byte *bufInv = buf + (_font->h / 2) * _font->pitch;
|
||||||
|
|
||||||
for (uint16 row = 0; row < _font->h / 2; row += 2) {
|
for (uint row = 0; row < _font->h / 2; row += 2) {
|
||||||
for (uint16 col = 0; col < _font->w; ++col)
|
for (uint col = 0; col < _font->w; ++col)
|
||||||
bufInv[col] = (buf[col] ? 0 : 1);
|
bufInv[col] = (buf[col] ? 0 : 1);
|
||||||
|
|
||||||
buf += _font->pitch * 2;
|
buf += _font->pitch * 2;
|
||||||
|
|
|
@ -52,7 +52,6 @@ enum DisplayMode {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define APPLECHAR(C) ((char)((C) | 0x80))
|
#define APPLECHAR(C) ((char)((C) | 0x80))
|
||||||
#define APPLEBYTE(C) ((byte)((C) | 0x80))
|
|
||||||
|
|
||||||
class Display {
|
class Display {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -398,7 +398,7 @@ void HiRes1Engine::printString(const Common::String &str) {
|
||||||
|
|
||||||
Common::String HiRes1Engine::loadMessage(uint idx) const {
|
Common::String HiRes1Engine::loadMessage(uint idx) const {
|
||||||
StreamPtr stream(_messages[idx]->createReadStream());
|
StreamPtr stream(_messages[idx]->createReadStream());
|
||||||
return readString(*stream, APPLEBYTE('\r')) + APPLEBYTE('\r');
|
return readString(*stream, APPLECHAR('\r')) + APPLECHAR('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
void HiRes1Engine::printMessage(uint idx) {
|
void HiRes1Engine::printMessage(uint idx) {
|
||||||
|
|
|
@ -214,7 +214,7 @@ void HiRes6Engine::runIntro() {
|
||||||
error("Failed to open disk volume 0");
|
error("Failed to open disk volume 0");
|
||||||
|
|
||||||
stream.reset(files->createReadStream("\010\010\010\010\010\010"));
|
stream.reset(files->createReadStream("\010\010\010\010\010\010"));
|
||||||
Common::String copyright(readStringAt(*stream, 0x103, APPLEBYTE('\r')));
|
Common::String copyright(readStringAt(*stream, 0x103, APPLECHAR('\r')));
|
||||||
|
|
||||||
delete files;
|
delete files;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue