aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2009-07-05 11:27:11 +0000
committerSven Hesse2009-07-05 11:27:11 +0000
commite861fab808897b8ec10a03930d94a079f1c7f1bb (patch)
treed7f609032b7bda2982239a19a20ffea946066a04
parent704895b35ff365525e894f8caf92c4383d446209 (diff)
downloadscummvm-rg350-e861fab808897b8ec10a03930d94a079f1c7f1bb.tar.gz
scummvm-rg350-e861fab808897b8ec10a03930d94a079f1c7f1bb.tar.bz2
scummvm-rg350-e861fab808897b8ec10a03930d94a079f1c7f1bb.zip
Added a Key and ShortKey enum
svn-id: r42121
-rw-r--r--engines/gob/demos/demoplayer.cpp2
-rw-r--r--engines/gob/game_v1.cpp73
-rw-r--r--engines/gob/game_v2.cpp73
-rw-r--r--engines/gob/game_v6.cpp4
-rw-r--r--engines/gob/inter.cpp28
-rw-r--r--engines/gob/inter_bargon.cpp8
-rw-r--r--engines/gob/inter_v6.cpp1
-rw-r--r--engines/gob/mult.cpp2
-rw-r--r--engines/gob/sound/sound.cpp2
-rw-r--r--engines/gob/util.cpp40
-rw-r--r--engines/gob/util.h33
-rw-r--r--engines/gob/videoplayer.cpp1
-rw-r--r--engines/gob/videoplayer.h8
13 files changed, 154 insertions, 121 deletions
diff --git a/engines/gob/demos/demoplayer.cpp b/engines/gob/demos/demoplayer.cpp
index 0229bb7515..7f65721ce5 100644
--- a/engines/gob/demos/demoplayer.cpp
+++ b/engines/gob/demos/demoplayer.cpp
@@ -222,7 +222,7 @@ void DemoPlayer::playVideoDoubled() {
int16 key;
bool end = false;
while (_vm->_util->checkKey(key))
- if (key == 0x011B)
+ if (key == kKeyEscape)
end = true;
if (end)
break;
diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp
index 7db4f65f2c..ca6a7044cb 100644
--- a/engines/gob/game_v1.cpp
+++ b/engines/gob/game_v1.cpp
@@ -684,7 +684,7 @@ void Game_v1::collisionsBlock(void) {
key = multiEdit(deltaTime, index, &curEditIndex,
descArray, &_activeCollResId, &_activeCollIndex);
- if (key == 0x1C0D) {
+ if (key == kKeyReturn) {
for (i = 0; i < 250; i++) {
if (_collisionAreas[i].left == 0xFFFF)
continue;
@@ -1066,7 +1066,7 @@ int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos,
return 0;
switch (key) {
- case 0:
+ case kKeyNone:
if (*collResId == 0)
return 0;
@@ -1099,19 +1099,19 @@ int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos,
}
break;
- case 0x3B00:
- case 0x3C00:
- case 0x3D00:
- case 0x3E00:
- case 0x3F00:
- case 0x4000:
- case 0x4100:
- case 0x4200:
- case 0x4300:
- case 0x4400:
+ case kKeyF1:
+ case kKeyF2:
+ case kKeyF3:
+ case kKeyF4:
+ case kKeyF5:
+ case kKeyF6:
+ case kKeyF7:
+ case kKeyF8:
+ case kKeyF9:
+ case kKeyF10:
return key;
- case 0x1C0D:
+ case kKeyReturn:
if (index == 1)
return key;
@@ -1124,12 +1124,12 @@ int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos,
pCurPos[0]++;
break;
- case 0x5000:
+ case kKeyDown:
if (index - 1 > *pCurPos)
pCurPos[0]++;
break;
- case 0x4800:
+ case kKeyUp:
if (*pCurPos > 0)
pCurPos[0]--;
break;
@@ -1259,51 +1259,50 @@ int16 Game_v1::inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
return 0;
switch (key) {
- case 0x4D00: // Right Arrow
+ case kKeyRight:
if ((pos < strlen(str)) && (pos < (editSize - 1))) {
pos++;
continue;
}
- return 0x5000;
+ return kKeyDown;
- case 0x4B00: // Left Arrow
+ case kKeyLeft:
if (pos > 0) {
pos--;
continue;
}
- return 0x4800;
+ return kKeyUp;
- case 0xE08: // Backspace
+ case kKeyBackspace:
if (pos > 0) {
_vm->_util->cutFromStr(str, pos - 1, 1);
pos--;
continue;
}
- case 0x5300: // Del
-
+ case kKeyDelete:
if (pos >= strlen(str))
continue;
_vm->_util->cutFromStr(str, pos, 1);
continue;
- case 0x1C0D: // Enter
- case 0x3B00: // F1
- case 0x3C00: // F2
- case 0x3D00: // F3
- case 0x3E00: // F4
- case 0x3F00: // F5
- case 0x4000: // F6
- case 0x4100: // F7
- case 0x4200: // F8
- case 0x4300: // F9
- case 0x4400: // F10
- case 0x4800: // Up arrow
- case 0x5000: // Down arrow
+ case kKeyReturn:
+ case kKeyF1:
+ case kKeyF2:
+ case kKeyF3:
+ case kKeyF4:
+ case kKeyF5:
+ case kKeyF6:
+ case kKeyF7:
+ case kKeyF8:
+ case kKeyF9:
+ case kKeyF10:
+ case kKeyUp:
+ case kKeyDown:
return key;
- case 0x11B: // Escape
+ case kKeyEscape:
if (_vm->_global->_useMouse != 0)
continue;
@@ -1418,7 +1417,7 @@ int16 Game_v1::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) {
}
if ((_mouseButtons != kMouseButtonsLeft) && (all == 0))
- return 0x11B;
+ return kKeyEscape;
return 0;
}
diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp
index 9d494ad6fe..db4e87287f 100644
--- a/engines/gob/game_v2.cpp
+++ b/engines/gob/game_v2.cpp
@@ -735,7 +735,7 @@ void Game_v2::collisionsBlock(void) {
&_activeCollResId, &_activeCollIndex);
WRITE_VAR(55, curEditIndex);
- if (key == 0x1C0D) {
+ if (key == kKeyReturn) {
for (i = 0; i < 150; i++) {
if (_collisionAreas[i].left == 0xFFFF)
break;
@@ -1099,7 +1099,7 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos,
return 0;
switch (key) {
- case 0:
+ case kKeyNone:
if (*collResId == 0)
return 0;
@@ -1158,19 +1158,19 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos,
}
break;
- case 0x3B00:
- case 0x3C00:
- case 0x3D00:
- case 0x3E00:
- case 0x3F00:
- case 0x4000:
- case 0x4100:
- case 0x4200:
- case 0x4300:
- case 0x4400:
+ case kKeyF1:
+ case kKeyF2:
+ case kKeyF3:
+ case kKeyF4:
+ case kKeyF5:
+ case kKeyF6:
+ case kKeyF7:
+ case kKeyF8:
+ case kKeyF9:
+ case kKeyF10:
return key;
- case 0x1C0D:
+ case kKeyReturn:
if (index == 1)
return key;
@@ -1183,12 +1183,12 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos,
pCurPos[0]++;
break;
- case 0x5000:
+ case kKeyDown:
if (index - 1 > *pCurPos)
pCurPos[0]++;
break;
- case 0x4800:
+ case kKeyUp:
if (*pCurPos > 0)
pCurPos[0]--;
break;
@@ -1377,21 +1377,21 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
return 0;
switch (key) {
- case 0x4D00: // Right Arrow
+ case kKeyRight:
if ((pos > strlen(str)) || (pos > (editSize - 1)) || (editSize == 0)) {
pos++;
continue;
}
- return 0x5000;
+ return kKeyDown;
- case 0x4B00: // Left Arrow
+ case kKeyLeft:
if (pos > 0) {
pos--;
continue;
}
- return 0x4800;
+ return kKeyUp;
- case 0xE08: // Backspace
+ case kKeyBackspace:
if (pos > 0) {
_vm->_util->cutFromStr(str, pos - 1, 1);
pos--;
@@ -1401,30 +1401,29 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
_vm->_util->cutFromStr(str, pos, 1);
}
- case 0x5300: // Del
-
+ case kKeyDelete:
if (pos >= strlen(str))
continue;
_vm->_util->cutFromStr(str, pos, 1);
continue;
- case 0x1C0D: // Enter
- case 0x3B00: // F1
- case 0x3C00: // F2
- case 0x3D00: // F3
- case 0x3E00: // F4
- case 0x3F00: // F5
- case 0x4000: // F6
- case 0x4100: // F7
- case 0x4200: // F8
- case 0x4300: // F9
- case 0x4400: // F10
- case 0x4800: // Up arrow
- case 0x5000: // Down arrow
+ case kKeyReturn:
+ case kKeyF1:
+ case kKeyF2:
+ case kKeyF3:
+ case kKeyF4:
+ case kKeyF5:
+ case kKeyF6:
+ case kKeyF7:
+ case kKeyF8:
+ case kKeyF9:
+ case kKeyF10:
+ case kKeyUp:
+ case kKeyDown:
return key;
- case 0x11B: // Escape
+ case kKeyEscape:
if (_vm->_global->_useMouse != 0)
continue;
@@ -1555,7 +1554,7 @@ int16 Game_v2::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) {
}
if ((_mouseButtons != kMouseButtonsLeft) && (all == 0))
- return 0x11B;
+ return kKeyEscape;
return 0;
}
diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp
index e2c0c52919..985f72c23a 100644
--- a/engines/gob/game_v6.cpp
+++ b/engines/gob/game_v6.cpp
@@ -630,7 +630,7 @@ void Game_v6::collisionsBlock(void) {
&activeCollResId, &activeCollIndex, false);
WRITE_VAR(55, curEditIndex);
- if (key == 0x1C0D) {
+ if (key == kKeyReturn) {
for (i = 0; i < 150; i++) {
if (_collisionAreas[i].left == 0xFFFF)
break;
@@ -1089,7 +1089,7 @@ int16 Game_v6::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) {
}
if ((_mouseButtons != kMouseButtonsLeft) && (all == 0))
- return 0x11B;
+ return kKeyEscape;
return 0;
}
diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp
index 3cbdaa3584..5ec0647d29 100644
--- a/engines/gob/inter.cpp
+++ b/engines/gob/inter.cpp
@@ -189,20 +189,20 @@ void Inter::storeKey(int16 key) {
storeMouse();
WRITE_VAR(1, _vm->_sound->blasterPlayingSound());
- if (key == 0x4800)
- key = 0x0B;
- else if (key == 0x5000)
- key = 0x0A;
- else if (key == 0x4D00)
- key = 0x09;
- else if (key == 0x4B00)
- key = 0x08;
- else if (key == 0x011B)
- key = 0x1B;
- else if (key == 0x0E08)
- key = 0x19;
- else if (key == 0x5300)
- key = 0x1A;
+ if (key == kKeyUp)
+ key = kShortKeyUp;
+ else if (key == kKeyDown)
+ key = kShortKeyDown;
+ else if (key == kKeyRight)
+ key = kShortKeyRight;
+ else if (key == kKeyLeft)
+ key = kShortKeyLeft;
+ else if (key == kKeyEscape)
+ key = kShortKeyEscape;
+ else if (key == kKeyBackspace)
+ key = kShortKeyBackspace;
+ else if (key == kKeyDelete)
+ key = kShortKeyDelete;
else if ((key & 0xFF) != 0)
key &= 0xFF;
diff --git a/engines/gob/inter_bargon.cpp b/engines/gob/inter_bargon.cpp
index 1cffe4ca2d..b955057bac 100644
--- a/engines/gob/inter_bargon.cpp
+++ b/engines/gob/inter_bargon.cpp
@@ -107,13 +107,13 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
for (i = 320; i >= 0; i--) {
_vm->_util->setScrollOffset(i, 0);
_vm->_video->dirtyRectsAll();
- if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) ||
+ if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == kKeyEscape) ||
_vm->shouldQuit()) {
_vm->_palAnim->fade(0, -2, 0);
_vm->_video->clearSurf(*_vm->_draw->_frontSurface);
memset((char *) _vm->_draw->_vgaPalette, 0, 768);
WRITE_VAR(4, buttons);
- WRITE_VAR(0, 0x11B);
+ WRITE_VAR(0, kKeyEscape);
WRITE_VAR(57, (uint32) -1);
break;
}
@@ -158,14 +158,14 @@ void Inter_Bargon::oBargon_intro3(OpGobParams &params) {
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
_vm->_util->longDelay(_vm->_util->getRandom(200));
}
- if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) ||
+ if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == kKeyEscape) ||
_vm->shouldQuit()) {
_vm->_sound->blasterStop(10);
_vm->_palAnim->fade(0, -2, 0);
_vm->_video->clearSurf(*_vm->_draw->_frontSurface);
memset(_vm->_draw->_vgaPalette, 0, 768);
WRITE_VAR(4, buttons);
- WRITE_VAR(0, 0x11B);
+ WRITE_VAR(0, kKeyEscape);
WRITE_VAR(57, (uint32) -1);
break;
}
diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp
index 506de821d4..14bfa1e840 100644
--- a/engines/gob/inter_v6.cpp
+++ b/engines/gob/inter_v6.cpp
@@ -31,6 +31,7 @@
#include "gob/inter.h"
#include "gob/helper.h"
#include "gob/global.h"
+#include "gob/dataio.h"
#include "gob/game.h"
#include "gob/expression.h"
#include "gob/script.h"
diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp
index 5aec5ff76e..d383d955c7 100644
--- a/engines/gob/mult.cpp
+++ b/engines/gob/mult.cpp
@@ -204,7 +204,7 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape,
stop = false;
_vm->_util->processInput();
- if (checkEscape && (_vm->_util->checkKey() == 0x11B))
+ if (checkEscape && (_vm->_util->checkKey() == kKeyEscape))
stop = true;
_frame++;
diff --git a/engines/gob/sound/sound.cpp b/engines/gob/sound/sound.cpp
index d3afc9baa3..2d7ba02385 100644
--- a/engines/gob/sound/sound.cpp
+++ b/engines/gob/sound/sound.cpp
@@ -506,7 +506,7 @@ void Sound::blasterWaitEndPlay(bool interruptible, bool stopComp) {
_blaster->endComposition();
while (_blaster->isPlaying() && !_vm->shouldQuit()) {
- if (interruptible && (_vm->_util->checkKey() == 0x11B)) {
+ if (interruptible && (_vm->_util->checkKey() == kKeyEscape)) {
WRITE_VAR(57, (uint32) -1);
return;
}
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index 4830c4be51..bb206eb52d 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -179,26 +179,26 @@ int16 Util::translateKey(const Common::KeyState &key) {
int16 from;
int16 to;
} keys[] = {
- {Common::KEYCODE_INVALID, 0x0000},
- {Common::KEYCODE_BACKSPACE, 0x0E08},
- {Common::KEYCODE_SPACE, 0x3920},
- {Common::KEYCODE_RETURN, 0x1C0D},
- {Common::KEYCODE_ESCAPE, 0x011B},
- {Common::KEYCODE_DELETE, 0x5300},
- {Common::KEYCODE_UP, 0x4800},
- {Common::KEYCODE_DOWN, 0x5000},
- {Common::KEYCODE_RIGHT, 0x4D00},
- {Common::KEYCODE_LEFT, 0x4B00},
- {Common::KEYCODE_F1, 0x3B00},
- {Common::KEYCODE_F2, 0x3C00},
- {Common::KEYCODE_F3, 0x3D00},
- {Common::KEYCODE_F4, 0x3E00},
- {Common::KEYCODE_F5, 0x011B},
- {Common::KEYCODE_F6, 0x4000},
- {Common::KEYCODE_F7, 0x4100},
- {Common::KEYCODE_F8, 0x4200},
- {Common::KEYCODE_F9, 0x4300},
- {Common::KEYCODE_F10, 0x4400}
+ {Common::KEYCODE_INVALID, kKeyNone },
+ {Common::KEYCODE_BACKSPACE, kKeyBackspace},
+ {Common::KEYCODE_SPACE, kKeySpace },
+ {Common::KEYCODE_RETURN, kKeyReturn },
+ {Common::KEYCODE_ESCAPE, kKeyEscape },
+ {Common::KEYCODE_DELETE, kKeyDelete },
+ {Common::KEYCODE_UP, kKeyUp },
+ {Common::KEYCODE_DOWN, kKeyDown },
+ {Common::KEYCODE_RIGHT, kKeyRight },
+ {Common::KEYCODE_LEFT, kKeyLeft },
+ {Common::KEYCODE_F1, kKeyF1 },
+ {Common::KEYCODE_F2, kKeyF2 },
+ {Common::KEYCODE_F3, kKeyF3 },
+ {Common::KEYCODE_F4, kKeyF4 },
+ {Common::KEYCODE_F5, kKeyEscape },
+ {Common::KEYCODE_F6, kKeyF6 },
+ {Common::KEYCODE_F7, kKeyF7 },
+ {Common::KEYCODE_F8, kKeyF8 },
+ {Common::KEYCODE_F9, kKeyF9 },
+ {Common::KEYCODE_F10, kKeyF10 }
};
for (int i = 0; i < ARRAYSIZE(keys); i++)
diff --git a/engines/gob/util.h b/engines/gob/util.h
index b0bcf70d0c..088a78a64d 100644
--- a/engines/gob/util.h
+++ b/engines/gob/util.h
@@ -42,6 +42,39 @@ enum MouseButtons {
kMouseButtonsAny = 4
};
+enum Keys {
+ kKeyNone = 0x0000,
+ kKeyBackspace = 0x0E08,
+ kKeySpace = 0x3920,
+ kKeyReturn = 0x1C0D,
+ kKeyEscape = 0x011B,
+ kKeyDelete = 0x5300,
+ kKeyUp = 0x4800,
+ kKeyDown = 0x5000,
+ kKeyRight = 0x4D00,
+ kKeyLeft = 0x4B00,
+ kKeyF1 = 0x3B00,
+ kKeyF2 = 0x3C00,
+ kKeyF3 = 0x3D00,
+ kKeyF4 = 0x3E00,
+ kKeyF5 = 0x3F00,
+ kKeyF6 = 0x4000,
+ kKeyF7 = 0x4100,
+ kKeyF8 = 0x4200,
+ kKeyF9 = 0x4300,
+ kKeyF10 = 0x4400
+};
+
+enum ShortKey {
+ kShortKeyUp = 0x0B,
+ kShortKeyDown = 0x0A,
+ kShortKeyRight = 0x09,
+ kShortKeyLeft = 0x08,
+ kShortKeyEscape = 0x1B,
+ kShortKeyBackspace = 0x19,
+ kShortKeyDelete = 0x1A
+};
+
class Util {
public:
struct ListNode;
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index 6c07d22333..da552d7202 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -27,7 +27,6 @@
#include "gob/videoplayer.h"
#include "gob/helper.h"
#include "gob/global.h"
-#include "gob/util.h"
#include "gob/dataio.h"
#include "gob/video.h"
#include "gob/draw.h"
diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h
index 842426f90a..ead752d446 100644
--- a/engines/gob/videoplayer.h
+++ b/engines/gob/videoplayer.h
@@ -31,11 +31,12 @@
#include "graphics/video/coktelvideo/coktelvideo.h"
-#include "gob/dataio.h"
+#include "gob/util.h"
namespace Gob {
class GobEngine;
+class DataStream;
class VideoPlayer {
public:
@@ -60,13 +61,14 @@ public:
bool primaryOpen(const char *videoFile, int16 x = -1, int16 y = -1,
int32 flags = kFlagFrontSurface, Type which = kVideoTypeTry);
- bool primaryPlay(int16 startFrame = -1, int16 lastFrame = -1, int16 breakKey = 27,
+ bool primaryPlay(int16 startFrame = -1, int16 lastFrame = -1,
+ int16 breakKey = kShortKeyEscape,
uint16 palCmd = 8, int16 palStart = 0, int16 palEnd = 255,
int16 palFrame = -1, int16 endFrame = -1, bool fade = false,
int16 reverseTo = -1, bool forceSeek = false);
void primaryClose();
- void playFrame(int16 frame, int16 breakKey = 27,
+ void playFrame(int16 frame, int16 breakKey = kShortKeyEscape,
uint16 palCmd = 8, int16 palStart = 0, int16 palEnd = 255,
int16 palFrame = -1 , int16 endFrame = -1);