aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kernel.cpp2
-rw-r--r--engines/sci/engine/kevent.cpp58
-rw-r--r--engines/sci/event.cpp144
-rw-r--r--engines/sci/event.h98
-rw-r--r--engines/sci/gfx/menubar.cpp12
-rw-r--r--engines/sci/gui/gui.cpp2
-rw-r--r--engines/sci/gui/gui_controls.cpp16
-rw-r--r--engines/sci/gui/gui_menu.cpp56
-rw-r--r--engines/sci/gui32/gui32.cpp64
9 files changed, 226 insertions, 226 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index c334d6af0b..73c65245cd 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -678,7 +678,7 @@ void kernel_sleep(SciEvent *event, uint32 msecs ) {
while (true) {
// let backend process events and update the screen
- event->get(SCI_EVT_PEEK);
+ event->get(SCI_EVENT_PEEK);
// TODO: we need to call SciGuiCursor::refreshPosition() before each screen update to limit the mouse cursor position
g_system->updateScreen();
time = g_system->getMillis();
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index e57cd55b0e..2ca8e13ab8 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -42,16 +42,16 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
reg_t obj = argv[1];
sciEvent curEvent;
int oldx, oldy;
- int modifier_mask = getSciVersion() <= SCI_VERSION_01 ? SCI_EVM_ALL : SCI_EVM_NO_FOOLOCK;
+ int modifier_mask = getSciVersion() <= SCI_VERSION_01 ? SCI_KEYMOD_ALL : SCI_KEYMOD_NO_FOOLOCK;
SegManager *segMan = s->_segMan;
const Common::Point mousePos = s->_gui->getCursorPos();
// If there's a simkey pending, and the game wants a keyboard event, use the
// simkey instead of a normal event
- if (g_debug_simulated_key && (mask & SCI_EVT_KEYBOARD)) {
- PUT_SEL32V(segMan, obj, type, SCI_EVT_KEYBOARD); // Keyboard event
+ if (g_debug_simulated_key && (mask & SCI_EVENT_KEYBOARD)) {
+ PUT_SEL32V(segMan, obj, type, SCI_EVENT_KEYBOARD); // Keyboard event
PUT_SEL32V(segMan, obj, message, g_debug_simulated_key);
- PUT_SEL32V(segMan, obj, modifiers, SCI_EVM_NUMLOCK); // Numlock on
+ PUT_SEL32V(segMan, obj, modifiers, SCI_KEYMOD_NUMLOCK); // Numlock on
PUT_SEL32V(segMan, obj, x, mousePos.x);
PUT_SEL32V(segMan, obj, y, mousePos.y);
g_debug_simulated_key = 0;
@@ -70,21 +70,21 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
//s->_gui->moveCursor(s->gfx_state->pointer_pos.x, s->gfx_state->pointer_pos.y);
switch (curEvent.type) {
- case SCI_EVT_QUIT:
+ case SCI_EVENT_QUIT:
quit_vm();
break;
- case SCI_EVT_KEYBOARD:
- if ((curEvent.buckybits & SCI_EVM_LSHIFT) && (curEvent.buckybits & SCI_EVM_RSHIFT) && (curEvent.data == '-')) {
+ case SCI_EVENT_KEYBOARD:
+ if ((curEvent.buckybits & SCI_KEYMOD_LSHIFT) && (curEvent.buckybits & SCI_KEYMOD_RSHIFT) && (curEvent.data == '-')) {
printf("Debug mode activated\n");
g_debugState.seeking = kDebugSeekNothing;
g_debugState.runningStep = 0;
- } else if ((curEvent.buckybits & SCI_EVM_CTRL) && (curEvent.data == '`')) {
+ } else if ((curEvent.buckybits & SCI_KEYMOD_CTRL) && (curEvent.data == '`')) {
printf("Debug mode activated\n");
g_debugState.seeking = kDebugSeekNothing;
g_debugState.runningStep = 0;
} else {
- PUT_SEL32V(segMan, obj, type, SCI_EVT_KEYBOARD); // Keyboard event
+ PUT_SEL32V(segMan, obj, type, SCI_EVENT_KEYBOARD); // Keyboard event
s->r_acc = make_reg(0, 1);
PUT_SEL32V(segMan, obj, message, curEvent.character);
@@ -93,11 +93,11 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
}
break;
- case SCI_EVT_MOUSE_RELEASE:
- case SCI_EVT_MOUSE_PRESS:
+ case SCI_EVENT_MOUSE_RELEASE:
+ case SCI_EVENT_MOUSE_PRESS:
// track left buttton clicks, if requested
- if (curEvent.type == SCI_EVT_MOUSE_PRESS && curEvent.data == 1 && g_debug_track_mouse_clicks) {
+ if (curEvent.type == SCI_EVENT_MOUSE_PRESS && curEvent.data == 1 && g_debug_track_mouse_clicks) {
((SciEngine *)g_engine)->getSciDebugger()->DebugPrintf("Mouse clicked at %d, %d\n",
mousePos.x, mousePos.y);
}
@@ -107,10 +107,10 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
switch (curEvent.data) {
case 2:
- extra_bits = SCI_EVM_LSHIFT | SCI_EVM_RSHIFT;
+ extra_bits = SCI_KEYMOD_LSHIFT | SCI_KEYMOD_RSHIFT;
break;
case 3:
- extra_bits = SCI_EVM_CTRL;
+ extra_bits = SCI_KEYMOD_CTRL;
default:
break;
}
@@ -133,14 +133,14 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
Console *con = ((Sci::SciEngine*)g_engine)->getSciDebugger();
con->DebugPrintf("SCI event occured: ");
switch (curEvent.type) {
- case SCI_EVT_QUIT:
+ case SCI_EVENT_QUIT:
con->DebugPrintf("quit event\n");
break;
- case SCI_EVT_KEYBOARD:
+ case SCI_EVENT_KEYBOARD:
con->DebugPrintf("keyboard event\n");
break;
- case SCI_EVT_MOUSE_RELEASE:
- case SCI_EVT_MOUSE_PRESS:
+ case SCI_EVENT_MOUSE_RELEASE:
+ case SCI_EVENT_MOUSE_PRESS:
con->DebugPrintf("mouse click event\n");
break;
default:
@@ -158,35 +158,35 @@ reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) {
reg_t obj = argv[0];
SegManager *segMan = s->_segMan;
- if (GET_SEL32V(segMan, obj, type) == SCI_EVT_KEYBOARD) { // Keyboard
+ if (GET_SEL32V(segMan, obj, type) == SCI_EVENT_KEYBOARD) { // Keyboard
int mover = -1;
switch (GET_SEL32V(segMan, obj, message)) {
- case SCI_K_HOME:
+ case SCI_KEY_HOME:
mover = 8;
break;
- case SCI_K_UP:
+ case SCI_KEY_UP:
mover = 1;
break;
- case SCI_K_PGUP:
+ case SCI_KEY_PGUP:
mover = 2;
break;
- case SCI_K_LEFT:
+ case SCI_KEY_LEFT:
mover = 7;
break;
- case SCI_K_CENTER:
+ case SCI_KEY_CENTER:
case 76:
mover = 0;
break;
- case SCI_K_RIGHT:
+ case SCI_KEY_RIGHT:
mover = 3;
break;
- case SCI_K_END:
+ case SCI_KEY_END:
mover = 6;
break;
- case SCI_K_DOWN:
+ case SCI_KEY_DOWN:
mover = 5;
break;
- case SCI_K_PGDOWN:
+ case SCI_KEY_PGDOWN:
mover = 4;
break;
default:
@@ -194,7 +194,7 @@ reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) {
}
if (mover >= 0) {
- PUT_SEL32V(segMan, obj, type, SCI_EVT_JOYSTICK);
+ PUT_SEL32V(segMan, obj, type, SCI_EVENT_JOYSTICK);
PUT_SEL32V(segMan, obj, message, mover);
return make_reg(0, 1);
} else
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index c011a8c777..4e06866601 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -92,8 +92,8 @@ int SciEvent::shiftify (int c) {
return shifted_numbers[c-'0'];
switch (c) {
- case SCI_K_TAB:
- return SCI_K_SHIFT_TAB;
+ case SCI_KEY_TAB:
+ return SCI_KEY_SHIFT_TAB;
case ']':
return '}';
case '[':
@@ -121,7 +121,7 @@ int SciEvent::shiftify (int c) {
}
}
- if (c >= SCI_K_F1 && c <= SCI_K_F10)
+ if (c >= SCI_KEY_F1 && c <= SCI_KEY_F10)
return c + 25;
return c;
@@ -129,27 +129,27 @@ int SciEvent::shiftify (int c) {
int SciEvent::numlockify (int c) {
switch (c) {
- case SCI_K_DELETE:
+ case SCI_KEY_DELETE:
return '.';
- case SCI_K_INSERT:
+ case SCI_KEY_INSERT:
return '0';
- case SCI_K_END:
+ case SCI_KEY_END:
return '1';
- case SCI_K_DOWN:
+ case SCI_KEY_DOWN:
return '2';
- case SCI_K_PGDOWN:
+ case SCI_KEY_PGDOWN:
return '3';
- case SCI_K_LEFT:
+ case SCI_KEY_LEFT:
return '4';
- case SCI_K_CENTER:
+ case SCI_KEY_CENTER:
return '5';
- case SCI_K_RIGHT:
+ case SCI_KEY_RIGHT:
return '6';
- case SCI_K_HOME:
+ case SCI_KEY_HOME:
return '7';
- case SCI_K_UP:
+ case SCI_KEY_UP:
return '8';
- case SCI_K_PGUP:
+ case SCI_KEY_PGUP:
return '9';
default:
return c; // Unchanged
@@ -158,7 +158,7 @@ int SciEvent::numlockify (int c) {
sciEvent SciEvent::getFromScummVM() {
static int _modifierStates = 0; // FIXME: Avoid non-const global vars
- sciEvent input = { SCI_EVT_NONE, 0, 0, 0 };
+ sciEvent input = { SCI_EVENT_NONE, 0, 0, 0 };
Common::EventManager *em = g_system->getEventManager();
Common::Event ev;
@@ -190,23 +190,23 @@ sciEvent SciEvent::getFromScummVM() {
switch (ev.kbd.keycode) {
case Common::KEYCODE_CAPSLOCK:
if (ev.type == Common::EVENT_KEYDOWN) {
- _modifierStates |= SCI_EVM_CAPSLOCK;
+ _modifierStates |= SCI_KEYMOD_CAPSLOCK;
} else {
- _modifierStates &= ~SCI_EVM_CAPSLOCK;
+ _modifierStates &= ~SCI_KEYMOD_CAPSLOCK;
}
break;
case Common::KEYCODE_NUMLOCK:
if (ev.type == Common::EVENT_KEYDOWN) {
- _modifierStates |= SCI_EVM_NUMLOCK;
+ _modifierStates |= SCI_KEYMOD_NUMLOCK;
} else {
- _modifierStates &= ~SCI_EVM_NUMLOCK;
+ _modifierStates &= ~SCI_KEYMOD_NUMLOCK;
}
break;
case Common::KEYCODE_SCROLLOCK:
if (ev.type == Common::EVENT_KEYDOWN) {
- _modifierStates |= SCI_EVM_SCRLOCK;
+ _modifierStates |= SCI_KEYMOD_SCRLOCK;
} else {
- _modifierStates &= ~SCI_EVM_SCRLOCK;
+ _modifierStates &= ~SCI_KEYMOD_SCRLOCK;
}
break;
default:
@@ -216,9 +216,9 @@ sciEvent SciEvent::getFromScummVM() {
//TODO: SCI_EVM_INSERT
input.buckybits =
- ((modifiers & Common::KBD_ALT) ? SCI_EVM_ALT : 0) |
- ((modifiers & Common::KBD_CTRL) ? SCI_EVM_CTRL : 0) |
- ((modifiers & Common::KBD_SHIFT) ? SCI_EVM_LSHIFT | SCI_EVM_RSHIFT : 0) |
+ ((modifiers & Common::KBD_ALT) ? SCI_KEYMOD_ALT : 0) |
+ ((modifiers & Common::KBD_CTRL) ? SCI_KEYMOD_CTRL : 0) |
+ ((modifiers & Common::KBD_SHIFT) ? SCI_KEYMOD_LSHIFT | SCI_KEYMOD_RSHIFT : 0) |
_modifierStates;
switch (ev.type) {
@@ -234,7 +234,7 @@ sciEvent SciEvent::getFromScummVM() {
con->attach();
// Clear keyboard event
- input.type = SCI_EVT_NONE;
+ input.type = SCI_EVENT_NONE;
input.character = 0;
input.data = 0;
input.buckybits = 0;
@@ -244,83 +244,83 @@ sciEvent SciEvent::getFromScummVM() {
if (!(input.data & 0xFF00)) {
// Directly accept most common keys without conversion
- input.type = SCI_EVT_KEYBOARD;
+ input.type = SCI_EVENT_KEYBOARD;
if (input.data == Common::KEYCODE_TAB) {
// Tab
- input.type = SCI_EVT_KEYBOARD;
- input.data = SCI_K_TAB;
- if (input.buckybits & (SCI_EVM_LSHIFT | SCI_EVM_RSHIFT))
- input.character = SCI_K_SHIFT_TAB;
+ input.type = SCI_EVENT_KEYBOARD;
+ input.data = SCI_KEY_TAB;
+ if (input.buckybits & (SCI_KEYMOD_LSHIFT | SCI_KEYMOD_RSHIFT))
+ input.character = SCI_KEY_SHIFT_TAB;
else
- input.character = SCI_K_TAB;
+ input.character = SCI_KEY_TAB;
}
} else if ((input.data >= Common::KEYCODE_F1) && input.data <= Common::KEYCODE_F10) {
// F1-F10
- input.type = SCI_EVT_KEYBOARD;
+ input.type = SCI_EVENT_KEYBOARD;
// SCI_K_F1 == 59 << 8
// SCI_K_SHIFT_F1 == 84 << 8
- input.data = SCI_K_F1 + ((input.data - Common::KEYCODE_F1)<<8);
- if (input.buckybits & (SCI_EVM_LSHIFT | SCI_EVM_RSHIFT))
+ input.data = SCI_KEY_F1 + ((input.data - Common::KEYCODE_F1)<<8);
+ if (input.buckybits & (SCI_KEYMOD_LSHIFT | SCI_KEYMOD_RSHIFT))
input.character = input.data + 25;
else
input.character = input.data;
} else {
// Special keys that need conversion
- input.type = SCI_EVT_KEYBOARD;
+ input.type = SCI_EVENT_KEYBOARD;
switch (ev.kbd.keycode) {
case Common::KEYCODE_UP:
- input.data = SCI_K_UP;
+ input.data = SCI_KEY_UP;
break;
case Common::KEYCODE_DOWN:
- input.data = SCI_K_DOWN;
+ input.data = SCI_KEY_DOWN;
break;
case Common::KEYCODE_RIGHT:
- input.data = SCI_K_RIGHT;
+ input.data = SCI_KEY_RIGHT;
break;
case Common::KEYCODE_LEFT:
- input.data = SCI_K_LEFT;
+ input.data = SCI_KEY_LEFT;
break;
case Common::KEYCODE_INSERT:
- input.data = SCI_K_INSERT;
+ input.data = SCI_KEY_INSERT;
break;
case Common::KEYCODE_HOME:
- input.data = SCI_K_HOME;
+ input.data = SCI_KEY_HOME;
break;
case Common::KEYCODE_END:
- input.data = SCI_K_END;
+ input.data = SCI_KEY_END;
break;
case Common::KEYCODE_PAGEUP:
- input.data = SCI_K_PGUP;
+ input.data = SCI_KEY_PGUP;
break;
case Common::KEYCODE_PAGEDOWN:
- input.data = SCI_K_PGDOWN;
+ input.data = SCI_KEY_PGDOWN;
break;
case Common::KEYCODE_DELETE:
- input.data = SCI_K_DELETE;
+ input.data = SCI_KEY_DELETE;
break;
// Keypad keys
case Common::KEYCODE_KP8: // up
- if (!(_modifierStates & SCI_EVM_NUMLOCK))
- input.data = SCI_K_UP;
+ if (!(_modifierStates & SCI_KEYMOD_NUMLOCK))
+ input.data = SCI_KEY_UP;
break;
case Common::KEYCODE_KP2: // down
- if (!(_modifierStates & SCI_EVM_NUMLOCK))
- input.data = SCI_K_DOWN;
+ if (!(_modifierStates & SCI_KEYMOD_NUMLOCK))
+ input.data = SCI_KEY_DOWN;
break;
case Common::KEYCODE_KP6: // right
- if (!(_modifierStates & SCI_EVM_NUMLOCK))
- input.data = SCI_K_RIGHT;
+ if (!(_modifierStates & SCI_KEYMOD_NUMLOCK))
+ input.data = SCI_KEY_RIGHT;
break;
case Common::KEYCODE_KP4: // left
- if (!(_modifierStates & SCI_EVM_NUMLOCK))
- input.data = SCI_K_LEFT;
+ if (!(_modifierStates & SCI_KEYMOD_NUMLOCK))
+ input.data = SCI_KEY_LEFT;
break;
case Common::KEYCODE_KP5: // center
- if (!(_modifierStates & SCI_EVM_NUMLOCK))
- input.data = SCI_K_CENTER;
+ if (!(_modifierStates & SCI_KEYMOD_NUMLOCK))
+ input.data = SCI_KEY_CENTER;
break;
default:
- input.type = SCI_EVT_NONE;
+ input.type = SCI_EVENT_NONE;
break;
}
input.character = input.data;
@@ -329,25 +329,25 @@ sciEvent SciEvent::getFromScummVM() {
// Mouse events
case Common::EVENT_LBUTTONDOWN:
- input.type = SCI_EVT_MOUSE_PRESS;
+ input.type = SCI_EVENT_MOUSE_PRESS;
input.data = 1;
break;
case Common::EVENT_RBUTTONDOWN:
- input.type = SCI_EVT_MOUSE_PRESS;
+ input.type = SCI_EVENT_MOUSE_PRESS;
input.data = 2;
break;
case Common::EVENT_LBUTTONUP:
- input.type = SCI_EVT_MOUSE_RELEASE;
+ input.type = SCI_EVENT_MOUSE_RELEASE;
input.data = 1;
break;
case Common::EVENT_RBUTTONUP:
- input.type = SCI_EVT_MOUSE_RELEASE;
+ input.type = SCI_EVENT_MOUSE_RELEASE;
input.data = 2;
break;
// Misc events
case Common::EVENT_QUIT:
- input.type = SCI_EVT_QUIT;
+ input.type = SCI_EVENT_QUIT;
break;
default:
@@ -370,9 +370,9 @@ sciEvent SciEvent::get(unsigned int mask) {
// Get all queued events from graphics driver
do {
event = getFromScummVM();
- if (event.type != SCI_EVT_NONE)
+ if (event.type != SCI_EVENT_NONE)
_events.push_back(event);
- } while (event.type != SCI_EVT_NONE);
+ } while (event.type != SCI_EVENT_NONE);
// Search for matching event in queue
Common::List<sciEvent>::iterator iter = _events.begin();
@@ -384,7 +384,7 @@ sciEvent SciEvent::get(unsigned int mask) {
event = *iter;
// If not peeking at the queue, remove the event
- if (!(mask & SCI_EVT_PEEK)) {
+ if (!(mask & SCI_EVENT_PEEK)) {
_events.erase(iter);
}
} else {
@@ -394,29 +394,29 @@ sciEvent SciEvent::get(unsigned int mask) {
// there is no need to change it.
}
- if (event.type == SCI_EVT_KEYBOARD) {
+ if (event.type == SCI_EVENT_KEYBOARD) {
// Do we still have to translate the key?
event.character = event.data;
// TODO: Remove this as soon as ScummVM handles Ctrl-Alt-X to us
- if ((event.buckybits == SCI_EVM_CTRL) && (event.character = 'x'))
- event.buckybits |= SCI_EVM_ALT;
+ if ((event.buckybits == SCI_KEYMOD_CTRL) && (event.character = 'x'))
+ event.buckybits |= SCI_KEYMOD_ALT;
// Scancodify if appropriate
- if (event.buckybits & SCI_EVM_ALT) {
+ if (event.buckybits & SCI_KEYMOD_ALT) {
event.character = altify(event.character);
- } else if (event.buckybits & SCI_EVM_CTRL) {
+ } else if (event.buckybits & SCI_KEYMOD_CTRL) {
event.character = controlify(event.character);
}
// Shift if appropriate
- else if (((event.buckybits & (SCI_EVM_RSHIFT | SCI_EVM_LSHIFT)) && !(event.buckybits & SCI_EVM_CAPSLOCK))
- || (!(event.buckybits & (SCI_EVM_RSHIFT | SCI_EVM_LSHIFT)) && (event.buckybits & SCI_EVM_CAPSLOCK)))
+ else if (((event.buckybits & (SCI_KEYMOD_RSHIFT | SCI_KEYMOD_LSHIFT)) && !(event.buckybits & SCI_KEYMOD_CAPSLOCK))
+ || (!(event.buckybits & (SCI_KEYMOD_RSHIFT | SCI_KEYMOD_LSHIFT)) && (event.buckybits & SCI_KEYMOD_CAPSLOCK)))
event.character = shiftify(event.character);
// Numlockify if appropriate
- else if (event.buckybits & SCI_EVM_NUMLOCK)
+ else if (event.buckybits & SCI_KEYMOD_NUMLOCK)
event.data = numlockify(event.data);
}
diff --git a/engines/sci/event.h b/engines/sci/event.h
index 868ad29ead..1645d2294d 100644
--- a/engines/sci/event.h
+++ b/engines/sci/event.h
@@ -51,65 +51,65 @@ struct sciEvent {
};
/*Values for type*/
-#define SCI_EVT_NONE 0
-#define SCI_EVT_MOUSE_PRESS (1<<0)
-#define SCI_EVT_MOUSE_RELEASE (1<<1)
-#define SCI_EVT_KEYBOARD (1<<2)
-#define SCI_EVT_JOYSTICK (1<<6)
-#define SCI_EVT_SAID (1<<7)
+#define SCI_EVENT_NONE 0
+#define SCI_EVENT_MOUSE_PRESS (1<<0)
+#define SCI_EVENT_MOUSE_RELEASE (1<<1)
+#define SCI_EVENT_KEYBOARD (1<<2)
+#define SCI_EVENT_JOYSTICK (1<<6)
+#define SCI_EVENT_SAID (1<<7)
/*Fake values for other events*/
-#define SCI_EVT_ERROR (1<<10)
-#define SCI_EVT_QUIT (1<<11)
-#define SCI_EVT_PEEK (1<<15)
+#define SCI_EVENT_ERROR (1<<10)
+#define SCI_EVENT_QUIT (1<<11)
+#define SCI_EVENT_PEEK (1<<15)
/* The QUIT event may be used to signal an external 'quit' command being
** issued to the gfx driver. */
-#define SCI_EVT_ANY 0x7fff
+#define SCI_EVENT_ANY 0x7fff
/* Keycodes of special keys: */
-#define SCI_K_ESC 27
-#define SCI_K_BACKSPACE 8
-#define SCI_K_ENTER 13
-#define SCI_K_TAB '\t'
-#define SCI_K_SHIFT_TAB (0xf << 8)
-
-#define SCI_K_HOME (71 << 8) // 7
-#define SCI_K_UP (72 << 8) // 8
-#define SCI_K_PGUP (73 << 8) // 9
+#define SCI_KEY_ESC 27
+#define SCI_KEY_BACKSPACE 8
+#define SCI_KEY_ENTER 13
+#define SCI_KEY_TAB '\t'
+#define SCI_KEY_SHIFT_TAB (0xf << 8)
+
+#define SCI_KEY_HOME (71 << 8) // 7
+#define SCI_KEY_UP (72 << 8) // 8
+#define SCI_KEY_PGUP (73 << 8) // 9
//
-#define SCI_K_LEFT (75 << 8) // 4
-#define SCI_K_CENTER (76 << 8) // 5
-#define SCI_K_RIGHT (77 << 8) // 6
+#define SCI_KEY_LEFT (75 << 8) // 4
+#define SCI_KEY_CENTER (76 << 8) // 5
+#define SCI_KEY_RIGHT (77 << 8) // 6
//
-#define SCI_K_END (79 << 8) // 1
-#define SCI_K_DOWN (80 << 8) // 2
-#define SCI_K_PGDOWN (81 << 8) // 3
+#define SCI_KEY_END (79 << 8) // 1
+#define SCI_KEY_DOWN (80 << 8) // 2
+#define SCI_KEY_PGDOWN (81 << 8) // 3
//
-#define SCI_K_INSERT (82 << 8) // 0
-#define SCI_K_DELETE (83 << 8) // .
-
-#define SCI_K_F1 (59<<8)
-#define SCI_K_F2 (60<<8)
-#define SCI_K_F3 (61<<8)
-#define SCI_K_F4 (62<<8)
-#define SCI_K_F5 (63<<8)
-#define SCI_K_F6 (64<<8)
-#define SCI_K_F7 (65<<8)
-#define SCI_K_F8 (66<<8)
-#define SCI_K_F9 (67<<8)
-#define SCI_K_F10 (68<<8)
+#define SCI_KEY_INSERT (82 << 8) // 0
+#define SCI_KEY_DELETE (83 << 8) // .
+
+#define SCI_KEY_F1 (59<<8)
+#define SCI_KEY_F2 (60<<8)
+#define SCI_KEY_F3 (61<<8)
+#define SCI_KEY_F4 (62<<8)
+#define SCI_KEY_F5 (63<<8)
+#define SCI_KEY_F6 (64<<8)
+#define SCI_KEY_F7 (65<<8)
+#define SCI_KEY_F8 (66<<8)
+#define SCI_KEY_F9 (67<<8)
+#define SCI_KEY_F10 (68<<8)
/*Values for buckybits */
-#define SCI_EVM_RSHIFT (1<<0)
-#define SCI_EVM_LSHIFT (1<<1)
-#define SCI_EVM_CTRL (1<<2)
-#define SCI_EVM_ALT (1<<3)
-#define SCI_EVM_SCRLOCK (1<<4)
-#define SCI_EVM_NUMLOCK (1<<5)
-#define SCI_EVM_CAPSLOCK (1<<6)
-#define SCI_EVM_INSERT (1<<7)
-
-#define SCI_EVM_NO_FOOLOCK (~(SCI_EVM_SCRLOCK | SCI_EVM_NUMLOCK | SCI_EVM_CAPSLOCK | SCI_EVM_INSERT))
-#define SCI_EVM_ALL 0xFF
+#define SCI_KEYMOD_RSHIFT (1<<0)
+#define SCI_KEYMOD_LSHIFT (1<<1)
+#define SCI_KEYMOD_CTRL (1<<2)
+#define SCI_KEYMOD_ALT (1<<3)
+#define SCI_KEYMOD_SCRLOCK (1<<4)
+#define SCI_KEYMOD_NUMLOCK (1<<5)
+#define SCI_KEYMOD_CAPSLOCK (1<<6)
+#define SCI_KEYMOD_INSERT (1<<7)
+
+#define SCI_KEYMOD_NO_FOOLOCK (~(SCI_KEYMOD_SCRLOCK | SCI_KEYMOD_NUMLOCK | SCI_KEYMOD_CAPSLOCK | SCI_KEYMOD_INSERT))
+#define SCI_KEYMOD_ALL 0xFF
class SciEvent {
public:
diff --git a/engines/sci/gfx/menubar.cpp b/engines/sci/gfx/menubar.cpp
index 4474b9eefa..8dcefdcd34 100644
--- a/engines/sci/gfx/menubar.cpp
+++ b/engines/sci/gfx/menubar.cpp
@@ -203,10 +203,10 @@ void Menubar::addMenu(GfxState *state, const Common::String &title, const Common
if (right[0] == '#') {
right[0] = SCI_SPECIAL_CHAR_FUNCTION; // Function key
- key = SCI_K_F1 + ((right[1] - '1') << 8);
+ key = SCI_KEY_F1 + ((right[1] - '1') << 8);
if (right[1] == '0')
- key = SCI_K_F10; // F10
+ key = SCI_KEY_F10; // F10
if (right[2] == '=') {
tag = atoi(right + 3);
@@ -215,7 +215,7 @@ void Menubar::addMenu(GfxState *state, const Common::String &title, const Common
} else if (right[0] == '@') { // Alt key
right[0] = SCI_SPECIAL_CHAR_ALT; // ALT
key = right[1];
- modifiers = SCI_EVM_ALT;
+ modifiers = SCI_KEYMOD_ALT;
if ((key >= 'a') && (key <= 'z'))
right[1] = key - 'a' + 'A';
@@ -228,7 +228,7 @@ void Menubar::addMenu(GfxState *state, const Common::String &title, const Common
if (right[0] == '^') {
right[0] = SCI_SPECIAL_CHAR_CTRL; // Control key - there must be a replacement...
key = right[1];
- modifiers = SCI_EVM_CTRL;
+ modifiers = SCI_KEYMOD_CTRL;
if ((key >= 'a') && (key <= 'z'))
right[1] = key - 'a' + 'A';
@@ -278,10 +278,10 @@ void Menubar::addMenu(GfxState *state, const Common::String &title, const Common
}
bool MenuItem::matchKey(int message, int modifiers) {
- if ((_key == message) && ((modifiers & (SCI_EVM_CTRL | SCI_EVM_ALT)) == _modifiers))
+ if ((_key == message) && ((modifiers & (SCI_KEYMOD_CTRL | SCI_KEYMOD_ALT)) == _modifiers))
return true;
- if (message == '\t' && _key == 'i' && ((modifiers & (SCI_EVM_CTRL | SCI_EVM_ALT)) == 0) && _modifiers == SCI_EVM_CTRL)
+ if (message == '\t' && _key == 'i' && ((modifiers & (SCI_KEYMOD_CTRL | SCI_KEYMOD_ALT)) == 0) && _modifiers == SCI_KEYMOD_CTRL)
return true; // Match TAB to ^I
return 0;
diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp
index 5316a51df1..d649e5b478 100644
--- a/engines/sci/gui/gui.cpp
+++ b/engines/sci/gui/gui.cpp
@@ -769,7 +769,7 @@ void SciGui::moveCursor(Common::Point pos) {
// Trigger event reading to make sure the mouse coordinates will
// actually have changed the next time we read them.
- _s->_event->get(SCI_EVT_PEEK);
+ _s->_event->get(SCI_EVENT_PEEK);
}
void SciGui::setCursorZone(Common::Rect zone) {
diff --git a/engines/sci/gui/gui_controls.cpp b/engines/sci/gui/gui_controls.cpp
index 5b048bfb86..55385084dc 100644
--- a/engines/sci/gui/gui_controls.cpp
+++ b/engines/sci/gui/gui_controls.cpp
@@ -156,34 +156,34 @@ void SciGuiControls::TexteditChange(reg_t controlObject, reg_t eventObject) {
eventType = GET_SEL32V(_segMan, eventObject, type);
switch (eventType) {
- case SCI_EVT_MOUSE_PRESS:
+ case SCI_EVENT_MOUSE_PRESS:
// TODO: Implement mouse support for cursor change
break;
- case SCI_EVT_KEYBOARD:
+ case SCI_EVENT_KEYBOARD:
eventKey = GET_SEL32V(_segMan, eventObject, message);
switch (eventKey) {
- case SCI_K_BACKSPACE:
+ case SCI_KEY_BACKSPACE:
if (cursorPos > 0) {
cursorPos--; text.deleteChar(cursorPos);
textChanged = true;
}
break;
- case SCI_K_DELETE:
+ case SCI_KEY_DELETE:
text.deleteChar(cursorPos);
textChanged = true;
break;
- case SCI_K_HOME: // HOME
+ case SCI_KEY_HOME: // HOME
cursorPos = 0; textChanged = true;
break;
- case SCI_K_END: // END
+ case SCI_KEY_END: // END
cursorPos = textSize; textChanged = true;
break;
- case SCI_K_LEFT: // LEFT
+ case SCI_KEY_LEFT: // LEFT
if (cursorPos > 0) {
cursorPos--; textChanged = true;
}
break;
- case SCI_K_RIGHT: // RIGHT
+ case SCI_KEY_RIGHT: // RIGHT
if (cursorPos + 1 <= textSize) {
cursorPos++; textChanged = true;
}
diff --git a/engines/sci/gui/gui_menu.cpp b/engines/sci/gui/gui_menu.cpp
index 104a6cb2bb..0f171106d8 100644
--- a/engines/sci/gui/gui_menu.cpp
+++ b/engines/sci/gui/gui_menu.cpp
@@ -125,7 +125,7 @@ void SciGuiMenu::add(Common::String title, Common::String content, reg_t content
// Control/Alt/Function key mapping...
if (controlPos) {
content.setChar(SCI_MENU_REPLACE_ONCONTROL, controlPos);
- itemEntry->keyModifier = SCI_EVM_CTRL;
+ itemEntry->keyModifier = SCI_KEYMOD_CTRL;
tempPos = controlPos + 1;
if (tempPos >= contentSize)
error("control marker at end of item");
@@ -134,7 +134,7 @@ void SciGuiMenu::add(Common::String title, Common::String content, reg_t content
}
if (altPos) {
content.setChar(SCI_MENU_REPLACE_ONALT, altPos);
- itemEntry->keyModifier = SCI_EVM_ALT;
+ itemEntry->keyModifier = SCI_KEYMOD_ALT;
tempPos = altPos + 1;
if (tempPos >= contentSize)
error("alt marker at end of item");
@@ -148,16 +148,16 @@ void SciGuiMenu::add(Common::String title, Common::String content, reg_t content
error("function marker at end of item");
itemEntry->keyPress = content[tempPos];
switch (content[functionPos + 1]) {
- case '1': itemEntry->keyPress = SCI_K_F1; break;
- case '2': itemEntry->keyPress = SCI_K_F2; break;
- case '3': itemEntry->keyPress = SCI_K_F3; break;
- case '4': itemEntry->keyPress = SCI_K_F4; break;
- case '5': itemEntry->keyPress = SCI_K_F5; break;
- case '6': itemEntry->keyPress = SCI_K_F6; break;
- case '7': itemEntry->keyPress = SCI_K_F7; break;
- case '8': itemEntry->keyPress = SCI_K_F8; break;
- case '9': itemEntry->keyPress = SCI_K_F9; break;
- case '0': itemEntry->keyPress = SCI_K_F10; break;
+ case '1': itemEntry->keyPress = SCI_KEY_F1; break;
+ case '2': itemEntry->keyPress = SCI_KEY_F2; break;
+ case '3': itemEntry->keyPress = SCI_KEY_F3; break;
+ case '4': itemEntry->keyPress = SCI_KEY_F4; break;
+ case '5': itemEntry->keyPress = SCI_KEY_F5; break;
+ case '6': itemEntry->keyPress = SCI_KEY_F6; break;
+ case '7': itemEntry->keyPress = SCI_KEY_F7; break;
+ case '8': itemEntry->keyPress = SCI_KEY_F8; break;
+ case '9': itemEntry->keyPress = SCI_KEY_F9; break;
+ case '0': itemEntry->keyPress = SCI_KEY_F10; break;
default:
error("illegal function key specified");
}
@@ -341,13 +341,13 @@ reg_t SciGuiMenu::select(reg_t eventObject) {
byte saidSpec[64];
switch (eventType) {
- case SCI_EVT_KEYBOARD:
+ case SCI_EVENT_KEYBOARD:
keyPress = GET_SEL32V(_segMan, eventObject, message);
keyModifier = GET_SEL32V(_segMan, eventObject, modifiers);
switch (keyPress) {
case 0:
break;
- case SCI_K_ESC:
+ case SCI_KEY_ESC:
itemEntry = interactiveWithKeyboard();
forceClaimed = true;
break;
@@ -363,7 +363,7 @@ reg_t SciGuiMenu::select(reg_t eventObject) {
}
break;
- case SCI_EVT_SAID:
+ case SCI_EVENT_SAID:
// HACK: should be removed as soon as said() is cleaned up
s = ((SciEngine *)g_engine)->getEngineState();
while (itemIterator != itemEnd) {
@@ -381,7 +381,7 @@ reg_t SciGuiMenu::select(reg_t eventObject) {
itemEntry = NULL;
break;
- case SCI_EVT_MOUSE_PRESS:
+ case SCI_EVENT_MOUSE_PRESS:
mousePosition = _cursor->getPosition();
if (mousePosition.y < 10) {
itemEntry = interactiveWithMouse();
@@ -576,33 +576,33 @@ GuiMenuItemEntry *SciGuiMenu::interactiveWithKeyboard() {
_gfx->BitsShow(_menuRect);
while (true) {
- curEvent = _event->get(SCI_EVT_ANY);
+ curEvent = _event->get(SCI_EVENT_ANY);
switch (curEvent.type) {
- case SCI_EVT_KEYBOARD:
+ case SCI_EVENT_KEYBOARD:
// We don't 100% follow sierra here: - sierra didn't wrap around when changing item id
// - sierra allowed item id to be 0, which didnt make any sense
do {
switch (curEvent.data) {
- case SCI_K_ESC:
+ case SCI_KEY_ESC:
_curMenuId = curItemEntry->menuId; _curItemId = curItemEntry->id;
return NULL;
- case SCI_K_ENTER:
+ case SCI_KEY_ENTER:
if (curItemEntry->enabled) {
_curMenuId = curItemEntry->menuId; _curItemId = curItemEntry->id;
return curItemEntry;
}
break;
- case SCI_K_LEFT:
+ case SCI_KEY_LEFT:
newMenuId--; newItemId = 1;
break;
- case SCI_K_RIGHT:
+ case SCI_KEY_RIGHT:
newMenuId++; newItemId = 1;
break;
- case SCI_K_UP:
+ case SCI_KEY_UP:
newItemId--;
break;
- case SCI_K_DOWN:
+ case SCI_KEY_DOWN:
newItemId++;
break;
}
@@ -613,9 +613,9 @@ GuiMenuItemEntry *SciGuiMenu::interactiveWithKeyboard() {
// if we do this step again because of a separator line -> don't repeat left/right, but go down
switch (curEvent.data) {
- case SCI_K_LEFT:
- case SCI_K_RIGHT:
- curEvent.data = SCI_K_DOWN;
+ case SCI_KEY_LEFT:
+ case SCI_KEY_RIGHT:
+ curEvent.data = SCI_KEY_DOWN;
}
}
} while (newItemEntry->separatorLine);
@@ -633,7 +633,7 @@ GuiMenuItemEntry *SciGuiMenu::interactiveWithKeyboard() {
}
break;
- case SCI_EVT_NONE:
+ case SCI_EVENT_NONE:
kernel_sleep(_event, 2500 / 1000);
break;
}
diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp
index fc93307416..f48437b291 100644
--- a/engines/sci/gui32/gui32.cpp
+++ b/engines/sci/gui32/gui32.cpp
@@ -871,16 +871,16 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
#endif
/* Check whether we can claim the event directly as a keyboard or said event */
- if (type & (SCI_EVT_KEYBOARD | SCI_EVT_SAID)) {
+ if (type & (SCI_EVENT_KEYBOARD | SCI_EVENT_SAID)) {
int menuc, itemc;
- if ((type == SCI_EVT_KEYBOARD)
- && (message == SCI_K_ESC))
+ if ((type == SCI_EVENT_KEYBOARD)
+ && (message == SCI_KEY_ESC))
menu_mode = 1;
- else if ((type == SCI_EVT_SAID) || message) { /* Don't claim 0 keyboard event */
+ else if ((type == SCI_EVENT_SAID) || message) { /* Don't claim 0 keyboard event */
debugC(2, kDebugLevelMenu, "Menu: Got %s event: %04x/%04x\n",
- ((type == SCI_EVT_SAID) ? "SAID" : "KBD"), message, modifiers);
+ ((type == SCI_EVENT_SAID) ? "SAID" : "KBD"), message, modifiers);
for (menuc = 0; menuc < (int)_s->_menubar->_menus.size(); menuc++)
for (itemc = 0; itemc < (int)_s->_menubar->_menus[menuc]._items.size(); itemc++) {
@@ -891,11 +891,11 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
item->_type, item->_enabled ? "enabled" : "disabled");
if ((item->_type == MENU_TYPE_NORMAL && item->_enabled)
- && ((type == SCI_EVT_KEYBOARD
+ && ((type == SCI_EVENT_KEYBOARD
&& item->matchKey(message, modifiers)
)
||
- (type == SCI_EVT_SAID
+ (type == SCI_EVENT_SAID
&& (item->_flags & MENU_ATTRIBUTE_FLAGS_SAID)
&& said(_s, item->_said, debug_parser) != SAID_NO_MATCH
)
@@ -913,7 +913,7 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
Common::Point cursorPos = _cursor->getPosition();
- if ((type == SCI_EVT_MOUSE_PRESS) && (cursorPos.y < 10)) {
+ if ((type == SCI_EVENT_MOUSE_PRESS) && (cursorPos.y < 10)) {
menu_mode = 1;
mouse_down = 1;
}
@@ -946,29 +946,29 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
old_menu = -1;
while (menu_mode) {
- sciEvent ev = _s->_event->get(SCI_EVT_ANY);
+ sciEvent ev = _s->_event->get(SCI_EVENT_ANY);
claimed = false;
switch (ev.type) {
- case SCI_EVT_QUIT:
+ case SCI_EVENT_QUIT:
quit_vm();
return NULL_REG;
- case SCI_EVT_KEYBOARD:
+ case SCI_EVENT_KEYBOARD:
switch (ev.data) {
- case SCI_K_ESC:
+ case SCI_KEY_ESC:
menu_mode = 0;
break;
- case SCI_K_ENTER:
+ case SCI_KEY_ENTER:
menu_mode = 0;
if ((item_nr >= 0) && (menu_nr >= 0))
claimed = true;
break;
- case SCI_K_LEFT:
+ case SCI_KEY_LEFT:
if (menu_nr > 0)
--menu_nr;
else
@@ -977,7 +977,7 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
item_nr = _menu_go_down(_s->_menubar, menu_nr, -1);
break;
- case SCI_K_RIGHT:
+ case SCI_KEY_RIGHT:
if (menu_nr < ((int)_s->_menubar->_menus.size() - 1))
++menu_nr;
else
@@ -986,7 +986,7 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
item_nr = _menu_go_down(_s->_menubar, menu_nr, -1);
break;
- case SCI_K_UP:
+ case SCI_KEY_UP:
if (item_nr > -1) {
do { --item_nr; }
@@ -994,7 +994,7 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
}
break;
- case SCI_K_DOWN: {
+ case SCI_KEY_DOWN: {
item_nr = _menu_go_down(_s->_menubar, menu_nr, item_nr);
}
break;
@@ -1002,7 +1002,7 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
}
break;
- case SCI_EVT_MOUSE_RELEASE:
+ case SCI_EVENT_MOUSE_RELEASE:
{
Common::Point curMousePos = _cursor->getPosition();
menu_mode = (curMousePos.y < 10);
@@ -1011,11 +1011,11 @@ reg_t SciGui32::menuSelect(reg_t eventObject) {
}
break;
- case SCI_EVT_MOUSE_PRESS:
+ case SCI_EVENT_MOUSE_PRESS:
mouse_down = 1;
break;
- case SCI_EVT_NONE:
+ case SCI_EVENT_NONE:
kernel_sleep(_s->_event, 2500 / 1000);
break;
}
@@ -1251,7 +1251,7 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) {
break; // NOP
case K_CONTROL_EDIT:
- if (eventObject.segment && ((GET_SEL32V(_s->_segMan, eventObject, type)) == SCI_EVT_KEYBOARD)) {
+ if (eventObject.segment && ((GET_SEL32V(_s->_segMan, eventObject, type)) == SCI_EVENT_KEYBOARD)) {
int max_displayed = GET_SEL32V(_s->_segMan, controlObject, max);
int max = max_displayed;
int cursor = GET_SEL32V(_s->_segMan, controlObject, cursor);
@@ -1277,7 +1277,7 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) {
if (cursor > textlen)
cursor = textlen;
- if (modifiers & SCI_EVM_CTRL) {
+ if (modifiers & SCI_KEYMOD_CTRL) {
switch (tolower((char)key)) {
case 'a':
@@ -1304,7 +1304,7 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) {
}
PUT_SEL32V(_s->_segMan, eventObject, claimed, 1);
- } else if (modifiers & SCI_EVM_ALT) { // Ctrl has precedence over Alt
+ } else if (modifiers & SCI_KEYMOD_ALT) { // Ctrl has precedence over Alt
switch (key) {
case 0x2100 /* A-f */:
while ((cursor < textlen) && (text[cursor++] != ' '))
@@ -1330,7 +1330,7 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) {
} else if (key < 31) {
PUT_SEL32V(_s->_segMan, eventObject, claimed, 1);
switch (key) {
- case SCI_K_BACKSPACE:
+ case SCI_KEY_BACKSPACE:
_K_EDIT_BACKSPACE;
break;
default:
@@ -1338,29 +1338,29 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) {
}
} else if (key & 0xff00) {
switch (key) {
- case SCI_K_HOME:
+ case SCI_KEY_HOME:
cursor = 0;
break;
- case SCI_K_END:
+ case SCI_KEY_END:
cursor = textlen;
break;
- case SCI_K_RIGHT:
+ case SCI_KEY_RIGHT:
if (cursor + 1 <= textlen)
++cursor;
break;
- case SCI_K_LEFT:
+ case SCI_KEY_LEFT:
if (cursor > 0)
--cursor;
break;
- case SCI_K_DELETE:
+ case SCI_KEY_DELETE:
_K_EDIT_DELETE;
break;
}
PUT_SEL32V(_s->_segMan, eventObject, claimed, 1);
} else if ((key > 31) && (key < 128)) {
- int inserting = (modifiers & SCI_EVM_INSERT);
+ int inserting = (modifiers & SCI_KEYMOD_INSERT);
- modifiers &= ~(SCI_EVM_RSHIFT | SCI_EVM_LSHIFT | SCI_EVM_CAPSLOCK);
+ modifiers &= ~(SCI_KEYMOD_RSHIFT | SCI_KEYMOD_LSHIFT | SCI_KEYMOD_CAPSLOCK);
if (cursor == textlen) {
if (textlen < max) {
@@ -2966,7 +2966,7 @@ void SciGui32::moveCursor(Common::Point pos) {
// Trigger event reading to make sure the mouse coordinates will
// actually have changed the next time we read them.
- _s->_event->get(SCI_EVT_PEEK);
+ _s->_event->get(SCI_EVENT_PEEK);
}
void SciGui32::graphAdjustPriority(int top, int bottom) {