[Scummvm-cvs-logs] SF.net SVN: scummvm:[42121] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sun Jul 5 13:27:11 CEST 2009


Revision: 42121
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42121&view=rev
Author:   drmccoy
Date:     2009-07-05 11:27:11 +0000 (Sun, 05 Jul 2009)

Log Message:
-----------
Added a Key and ShortKey enum

Modified Paths:
--------------
    scummvm/trunk/engines/gob/demos/demoplayer.cpp
    scummvm/trunk/engines/gob/game_v1.cpp
    scummvm/trunk/engines/gob/game_v2.cpp
    scummvm/trunk/engines/gob/game_v6.cpp
    scummvm/trunk/engines/gob/inter.cpp
    scummvm/trunk/engines/gob/inter_bargon.cpp
    scummvm/trunk/engines/gob/inter_v6.cpp
    scummvm/trunk/engines/gob/mult.cpp
    scummvm/trunk/engines/gob/sound/sound.cpp
    scummvm/trunk/engines/gob/util.cpp
    scummvm/trunk/engines/gob/util.h
    scummvm/trunk/engines/gob/videoplayer.cpp
    scummvm/trunk/engines/gob/videoplayer.h

Modified: scummvm/trunk/engines/gob/demos/demoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/demos/demoplayer.cpp	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/demos/demoplayer.cpp	2009-07-05 11:27:11 UTC (rev 42121)
@@ -222,7 +222,7 @@
 			int16 key;
 			bool end = false;
 			while (_vm->_util->checkKey(key))
-				if (key == 0x011B)
+				if (key == kKeyEscape)
 					end = true;
 			if (end)
 				break;

Modified: scummvm/trunk/engines/gob/game_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v1.cpp	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/game_v1.cpp	2009-07-05 11:27:11 UTC (rev 42121)
@@ -684,7 +684,7 @@
 			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 @@
 			return 0;
 
 		switch (key) {
-		case 0:
+		case kKeyNone:
 			if (*collResId == 0)
 				return 0;
 
@@ -1099,19 +1099,19 @@
 			}
 			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 @@
 			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 @@
 			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 @@
 	}
 
 	if ((_mouseButtons != kMouseButtonsLeft) && (all == 0))
-		return 0x11B;
+		return kKeyEscape;
 
 	return 0;
 }

Modified: scummvm/trunk/engines/gob/game_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v2.cpp	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/game_v2.cpp	2009-07-05 11:27:11 UTC (rev 42121)
@@ -735,7 +735,7 @@
 					&_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 @@
 			return 0;
 
 		switch (key) {
-		case 0:
+		case kKeyNone:
 			if (*collResId == 0)
 				return 0;
 
@@ -1158,19 +1158,19 @@
 			}
 			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 @@
 			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 @@
 			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 @@
 					_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 @@
 	}
 
 	if ((_mouseButtons != kMouseButtonsLeft) && (all == 0))
-		return 0x11B;
+		return kKeyEscape;
 
 	return 0;
 }

Modified: scummvm/trunk/engines/gob/game_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v6.cpp	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/game_v6.cpp	2009-07-05 11:27:11 UTC (rev 42121)
@@ -630,7 +630,7 @@
 					&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 @@
 	}
 
 	if ((_mouseButtons != kMouseButtonsLeft) && (all == 0))
-		return 0x11B;
+		return kKeyEscape;
 
 	return 0;
 }

Modified: scummvm/trunk/engines/gob/inter.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter.cpp	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/inter.cpp	2009-07-05 11:27:11 UTC (rev 42121)
@@ -189,20 +189,20 @@
 	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;
 

Modified: scummvm/trunk/engines/gob/inter_bargon.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_bargon.cpp	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/inter_bargon.cpp	2009-07-05 11:27:11 UTC (rev 42121)
@@ -107,13 +107,13 @@
 	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 @@
 			_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;
 		}

Modified: scummvm/trunk/engines/gob/inter_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v6.cpp	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/inter_v6.cpp	2009-07-05 11:27:11 UTC (rev 42121)
@@ -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"

Modified: scummvm/trunk/engines/gob/mult.cpp
===================================================================
--- scummvm/trunk/engines/gob/mult.cpp	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/mult.cpp	2009-07-05 11:27:11 UTC (rev 42121)
@@ -204,7 +204,7 @@
 			stop = false;
 
 		_vm->_util->processInput();
-		if (checkEscape && (_vm->_util->checkKey() == 0x11B))
+		if (checkEscape && (_vm->_util->checkKey() == kKeyEscape))
 			stop = true;
 
 		_frame++;

Modified: scummvm/trunk/engines/gob/sound/sound.cpp
===================================================================
--- scummvm/trunk/engines/gob/sound/sound.cpp	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/sound/sound.cpp	2009-07-05 11:27:11 UTC (rev 42121)
@@ -506,7 +506,7 @@
 		_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;
 		}

Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/util.cpp	2009-07-05 11:27:11 UTC (rev 42121)
@@ -179,26 +179,26 @@
 		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++)

Modified: scummvm/trunk/engines/gob/util.h
===================================================================
--- scummvm/trunk/engines/gob/util.h	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/util.h	2009-07-05 11:27:11 UTC (rev 42121)
@@ -42,6 +42,39 @@
 	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;

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2009-07-05 11:27:11 UTC (rev 42121)
@@ -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"

Modified: scummvm/trunk/engines/gob/videoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.h	2009-07-05 11:26:42 UTC (rev 42120)
+++ scummvm/trunk/engines/gob/videoplayer.h	2009-07-05 11:27:11 UTC (rev 42121)
@@ -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 @@
 
 	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);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list