aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/agi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agi/agi.cpp')
-rw-r--r--engines/agi/agi.cpp100
1 files changed, 58 insertions, 42 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index a0496bf00b..74795271fc 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -69,6 +69,8 @@ void AgiEngine::processEvents() {
_system->quit();
break;
case Common::EVENT_PREDICTIVE_DIALOG:
+ if (_predictiveDialogRunning)
+ break;
if (_game.playerControl && predictiveDialog()) {
if (_game.inputMode == INPUT_NORMAL) {
strcpy((char *)_game.inputBuffer, _predictiveResult);
@@ -115,7 +117,7 @@ void AgiEngine::processEvents() {
_keyControl = 0;
_keyAlt = 0;
- if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == 'd') {
+ if (event.kbd.flags == Common::KBD_CTRL && event.kbd.keycode == Common::KEYCODE_d) {
_console->attach();
break;
}
@@ -127,106 +129,107 @@ void AgiEngine::processEvents() {
_keyAlt = 1;
switch (key = event.kbd.keycode) {
- case 256 + 20: // left arrow
- case 260: // key pad 4
+ case Common::KEYCODE_LEFT:
+ case Common::KEYCODE_KP4:
if (_allowSynthetic || !event.synthetic)
key = KEY_LEFT;
break;
- case 256 + 19: // right arrow
- case 262: // key pad 6
+ case Common::KEYCODE_RIGHT:
+ case Common::KEYCODE_KP6:
if (_allowSynthetic || !event.synthetic)
key = KEY_RIGHT;
break;
- case 256 + 17: // up arrow
- case 264: // key pad 8
+ case Common::KEYCODE_UP:
+ case Common::KEYCODE_KP8:
if (_allowSynthetic || !event.synthetic)
key = KEY_UP;
break;
- case 256 + 18: // down arrow
- case 258: // key pad 2
+ case Common::KEYCODE_DOWN:
+ case Common::KEYCODE_KP2:
if (_allowSynthetic || !event.synthetic)
key = KEY_DOWN;
break;
- case 256 + 24: // page up
- case 265: // key pad 9
+ case Common::KEYCODE_PAGEUP:
+ case Common::KEYCODE_KP9:
if (_allowSynthetic || !event.synthetic)
key = KEY_UP_RIGHT;
break;
- case 256 + 25: // page down
- case 259: // key pad 3
+ case Common::KEYCODE_PAGEDOWN:
+ case Common::KEYCODE_KP3:
if (_allowSynthetic || !event.synthetic)
key = KEY_DOWN_RIGHT;
break;
- case 256 + 22: // home
- case 263: // key pad 7
+ case Common::KEYCODE_HOME:
+ case Common::KEYCODE_KP7:
if (_allowSynthetic || !event.synthetic)
key = KEY_UP_LEFT;
break;
- case 256 + 23: // end
- case 257: // key pad 1
+ case Common::KEYCODE_END:
+ case Common::KEYCODE_KP1:
if (_allowSynthetic || !event.synthetic)
key = KEY_DOWN_LEFT;
break;
- case 261: // key pad 5
+ case Common::KEYCODE_KP5:
key = KEY_STATIONARY;
break;
- case '+':
+ case Common::KEYCODE_PLUS:
key = '+';
break;
- case '-':
+ case Common::KEYCODE_MINUS:
key = '-';
break;
- case 9:
+ case Common::KEYCODE_9:
key = 0x0009;
break;
- case 282:
+ case Common::KEYCODE_F1:
key = 0x3b00;
break;
- case 283:
+ case Common::KEYCODE_F2:
key = 0x3c00;
break;
- case 284:
+ case Common::KEYCODE_F3:
key = 0x3d00;
break;
- case 285:
+ case Common::KEYCODE_F4:
key = 0x3e00;
break;
- case 286:
+ case Common::KEYCODE_F5:
key = 0x3f00;
break;
- case 287:
+ case Common::KEYCODE_F6:
key = 0x4000;
break;
- case 288:
+ case Common::KEYCODE_F7:
key = 0x4100;
break;
- case 289:
+ case Common::KEYCODE_F8:
key = 0x4200;
break;
- case 290:
+ case Common::KEYCODE_F9:
key = 0x4300;
break;
- case 291:
+ case Common::KEYCODE_F10:
key = 0x4400;
break;
- case 292:
+ case Common::KEYCODE_F11:
key = KEY_STATUSLN;
break;
- case 293:
+ case Common::KEYCODE_F12:
key = KEY_PRIORITY;
break;
- case 27:
+ case Common::KEYCODE_ESCAPE:
key = 0x1b;
break;
- case '\n':
- case '\r':
+ case Common::KEYCODE_RETURN:
+ case Common::KEYCODE_KP_ENTER:
key = KEY_ENTER;
break;
+ case Common::KEYCODE_BACKSPACE:
+ key = KEY_BACKSPACE;
+ break;
default:
if (key < 256 && !isalpha(key)) {
- // Make sure backspace works right (this fixes a small issue on OS X)
- if (key != 8)
- key = event.kbd.ascii;
+ key = event.kbd.ascii;
break;
}
if (_keyControl)
@@ -410,6 +413,10 @@ int AgiEngine::agiInit() {
if (getFeatures() & GF_AGDS)
_game.gameFlags |= ID_AGDS;
+ // Make the 256 color AGI screen the default AGI screen when AGI256 or AGI256-2 is used
+ if (getFeatures() & (GF_AGI256 | GF_AGI256_2))
+ _game.sbuf = _game.sbuf256c;
+
if (_game.gameFlags & ID_AMIGA)
report("Amiga padded game detected.\n");
@@ -591,7 +598,10 @@ AgiEngine::AgiEngine(OSystem *syst) : Engine(syst) {
_oldMode = -1;
- _searchTreeRoot = 0;
+ _predictiveDialogRunning = false;
+ _predictiveDictText = NULL;
+ _predictiveDictLine = NULL;
+ _predictiveDictLineCount = 0;
_firstSlot = 0;
}
@@ -640,7 +650,10 @@ void AgiEngine::initialize() {
_game.name[0] = '\0';
- _game.sbuf = (uint8 *)calloc(_WIDTH, _HEIGHT);
+ _game.sbufOrig = (uint8 *)calloc(_WIDTH, _HEIGHT * 2); // Allocate space for two AGI screens vertically
+ _game.sbuf16c = _game.sbufOrig + SBUF16_OFFSET; // Make sbuf16c point to the 16 color (+control line & priority info) AGI screen
+ _game.sbuf256c = _game.sbufOrig + SBUF256_OFFSET; // Make sbuf256c point to the 256 color AGI screen
+ _game.sbuf = _game.sbuf16c; // Make sbuf point to the 16 color (+control line & priority info) AGI screen by default
_gfx->initVideo();
_sound->initSound();
@@ -668,10 +681,13 @@ AgiEngine::~AgiEngine() {
delete _sound;
_gfx->deinitVideo();
delete _sprites;
- free(_game.sbuf);
+ free(_game.sbufOrig);
_gfx->deinitMachine();
delete _rnd;
delete _console;
+
+ free(_predictiveDictLine);
+ free(_predictiveDictText);
}
int AgiEngine::init() {